@livelayer/react 0.20.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  "use client";
2
- import { jsxs as C, jsx as n, Fragment as We } from "react/jsx-runtime";
3
- import { Component as or, useState as M, useRef as I, useEffect as P, useCallback as L, useMemo as nt, useLayoutEffect as In, forwardRef as Bt, useImperativeHandle as lr, createElement as ar } from "react";
4
- import { createPortal as qt } from "react-dom";
5
- import { LiveKitSession as sr, registerFields as cr } from "@livelayer/sdk";
6
- import { clearFieldRegistry as io, getRegisteredFields as oo, registerFields as lo, setFieldValue as ao } from "@livelayer/sdk";
7
- import { createLocalAudioTrack as ur, Track as Rn, createLocalVideoTrack as dr } from "livekit-client";
8
- class fr extends or {
2
+ import { jsxs as k, jsx as n, Fragment as Fe } from "react/jsx-runtime";
3
+ import { Component as sr, useState as M, useRef as I, useEffect as T, useCallback as C, useMemo as et, useLayoutEffect as Tn, forwardRef as jt, useImperativeHandle as cr, createElement as ur } from "react";
4
+ import { createPortal as Vt } from "react-dom";
5
+ import { LiveKitSession as dr, registerFields as fr } from "@livelayer/sdk";
6
+ import { clearFieldRegistry as ao, getRegisteredFields as so, registerFields as co, setFieldValue as uo } from "@livelayer/sdk";
7
+ import { createLocalAudioTrack as pr, Track as Pn, createLocalVideoTrack as hr } from "livekit-client";
8
+ class mr extends sr {
9
9
  constructor() {
10
10
  super(...arguments), this.state = { hasError: !1, error: null }, this.reset = () => {
11
11
  this.setState({ hasError: !1, error: null });
@@ -20,7 +20,7 @@ class fr extends or {
20
20
  }
21
21
  render() {
22
22
  var t;
23
- return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ C("div", { className: "ll-error-boundary", role: "alert", children: [
23
+ return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ k("div", { className: "ll-error-boundary", role: "alert", children: [
24
24
  /* @__PURE__ */ n("p", { className: "ll-error-boundary__title", children: "Widget crashed" }),
25
25
  /* @__PURE__ */ n("p", { className: "ll-error-boundary__message", children: ((t = this.state.error) == null ? void 0 : t.message) || "Something went wrong." }),
26
26
  /* @__PURE__ */ n(
@@ -35,26 +35,26 @@ class fr extends or {
35
35
  ] }) : this.props.children;
36
36
  }
37
37
  }
38
- function pr(e) {
39
- const [t, r] = M("idle"), [i, l] = M("idle"), [o, s] = M([]), [a, c] = M(null), [d, v] = M(null), [p, h] = M(null), [T, _] = M(!1), [E, g] = M(null), b = I(null), R = I(e.onDataMessage);
40
- R.current = e.onDataMessage, P(() => {
38
+ function gr(e) {
39
+ const [t, r] = M("idle"), [i, l] = M("idle"), [o, s] = M([]), [a, c] = M(null), [d, b] = M(null), [p, h] = M(null), [P, x] = M(!1), [E, g] = M(null), w = I(null), R = I(e.onDataMessage);
40
+ R.current = e.onDataMessage, T(() => {
41
41
  const m = {
42
- onConnectionStateChange: (F) => {
43
- r(F), F === "connected" && g(null);
42
+ onConnectionStateChange: (W) => {
43
+ r(W), W === "connected" && g(null);
44
44
  },
45
45
  onAgentStateChange: l,
46
- onTranscript: (F) => s([...F]),
46
+ onTranscript: (W) => s([...W]),
47
47
  onAgentConfig: c,
48
- onAudioTrack: (F) => h(F),
49
- onVideoTrack: (F) => v(F),
50
- onVideoTrackRemoved: () => v(null),
51
- onError: (F) => g(F),
52
- onDataMessage: (F) => {
48
+ onAudioTrack: (W) => h(W),
49
+ onVideoTrack: (W) => b(W),
50
+ onVideoTrackRemoved: () => b(null),
51
+ onError: (W) => g(W),
52
+ onDataMessage: (W) => {
53
53
  var K;
54
- (K = R.current) == null || K.call(R, F);
54
+ (K = R.current) == null || K.call(R, W);
55
55
  },
56
- onResumabilityChange: _
57
- }, D = new sr(
56
+ onResumabilityChange: x
57
+ }, D = new dr(
58
58
  {
59
59
  agentId: e.agentId,
60
60
  baseUrl: e.baseUrl,
@@ -64,9 +64,9 @@ function pr(e) {
64
64
  },
65
65
  m
66
66
  );
67
- return b.current = D, r("idle"), l("idle"), s([]), c(null), v(null), h(null), _(!1), g(null), () => {
68
- var F;
69
- (F = D.destroy) == null || F.call(D), b.current = null;
67
+ return w.current = D, r("idle"), l("idle"), s([]), c(null), b(null), h(null), x(!1), g(null), () => {
68
+ var W;
69
+ (W = D.destroy) == null || W.call(D), w.current = null;
70
70
  };
71
71
  }, [
72
72
  e.agentId,
@@ -75,20 +75,20 @@ function pr(e) {
75
75
  e.sessionEndpoint,
76
76
  JSON.stringify(e.sessionBody ?? {})
77
77
  ]);
78
- const k = L(async () => {
79
- const m = b.current;
78
+ const S = C(async () => {
79
+ const m = w.current;
80
80
  if (m)
81
81
  try {
82
82
  await m.connect();
83
83
  } catch (D) {
84
84
  throw g(D instanceof Error ? D.message : String(D)), D;
85
85
  }
86
- }, []), y = L(() => {
87
- const m = b.current;
86
+ }, []), y = C(() => {
87
+ const m = w.current;
88
88
  m && m.disconnect();
89
- }, []), H = L(() => {
89
+ }, []), O = C(() => {
90
90
  var m;
91
- return ((m = b.current) == null ? void 0 : m.getRoom()) ?? null;
91
+ return ((m = w.current) == null ? void 0 : m.getRoom()) ?? null;
92
92
  }, []);
93
93
  return {
94
94
  connectionState: t,
@@ -97,40 +97,40 @@ function pr(e) {
97
97
  agentConfig: a,
98
98
  videoElement: d,
99
99
  audioElement: p,
100
- canResume: T,
100
+ canResume: P,
101
101
  error: E,
102
- connect: k,
102
+ connect: S,
103
103
  disconnect: y,
104
- getRoom: H,
105
- session: b.current
104
+ getRoom: O,
105
+ session: w.current
106
106
  };
107
107
  }
108
- function hr() {
109
- const e = I(null), t = I(/* @__PURE__ */ new Map()), r = I(null), i = I(/* @__PURE__ */ new Set()), l = L(() => {
110
- const _ = t.current;
111
- if (_.size === 0) {
108
+ function yr() {
109
+ const e = I(null), t = I(/* @__PURE__ */ new Map()), r = I(null), i = I(/* @__PURE__ */ new Set()), l = C(() => {
110
+ const x = t.current;
111
+ if (x.size === 0) {
112
112
  r.current = null;
113
113
  return;
114
114
  }
115
115
  let E = 0;
116
- for (const { analyser: g, buffer: b } of _.values()) {
117
- g.getByteFrequencyData(b);
116
+ for (const { analyser: g, buffer: w } of x.values()) {
117
+ g.getByteFrequencyData(w);
118
118
  let R = 0;
119
- for (let y = 0; y < b.length; y++) R += b[y];
120
- const k = R / b.length / 255;
121
- k > E && (E = k);
119
+ for (let y = 0; y < w.length; y++) R += w[y];
120
+ const S = R / w.length / 255;
121
+ S > E && (E = S);
122
122
  }
123
123
  for (const g of i.current)
124
124
  try {
125
125
  g(E);
126
- } catch (b) {
127
- console.error("[useAudioLevel] subscriber threw:", b);
126
+ } catch (w) {
127
+ console.error("[useAudioLevel] subscriber threw:", w);
128
128
  }
129
129
  r.current = requestAnimationFrame(l);
130
- }, []), o = L(() => e.current ? e.current : typeof window > "u" || typeof AudioContext > "u" ? null : (e.current = new AudioContext(), e.current), []), s = L(() => {
130
+ }, []), o = C(() => e.current ? e.current : typeof window > "u" || typeof AudioContext > "u" ? null : (e.current = new AudioContext(), e.current), []), s = C(() => {
131
131
  r.current === null && t.current.size > 0 && (r.current = requestAnimationFrame(l));
132
- }, [l]), a = L((_) => {
133
- const E = t.current.get(_);
132
+ }, [l]), a = C((x) => {
133
+ const E = t.current.get(x);
134
134
  if (E) {
135
135
  try {
136
136
  E.node.disconnect();
@@ -140,73 +140,73 @@ function hr() {
140
140
  E.analyser.disconnect();
141
141
  } catch {
142
142
  }
143
- t.current.delete(_);
143
+ t.current.delete(x);
144
144
  }
145
- }, []), c = L(
146
- (_, E) => {
145
+ }, []), c = C(
146
+ (x, E) => {
147
147
  const g = o();
148
148
  if (!g) return;
149
- a(_);
150
- const b = E(g);
151
- if (!b) return;
149
+ a(x);
150
+ const w = E(g);
151
+ if (!w) return;
152
152
  const R = g.createAnalyser();
153
153
  R.fftSize = 64;
154
154
  try {
155
- b.connect(R);
156
- } catch (k) {
157
- console.warn("[useAudioLevel] connect failed for slot", _, k);
155
+ w.connect(R);
156
+ } catch (S) {
157
+ console.warn("[useAudioLevel] connect failed for slot", x, S);
158
158
  return;
159
159
  }
160
- t.current.set(_, {
160
+ t.current.set(x, {
161
161
  analyser: R,
162
- node: b,
162
+ node: w,
163
163
  buffer: new Uint8Array(new ArrayBuffer(R.frequencyBinCount))
164
164
  }), s();
165
165
  },
166
166
  [a, o, s]
167
- ), d = L(
168
- (_, E = "agent") => {
167
+ ), d = C(
168
+ (x, E = "agent") => {
169
169
  c(E, (g) => {
170
170
  try {
171
- return g.createMediaElementSource(_);
172
- } catch (b) {
171
+ return g.createMediaElementSource(x);
172
+ } catch (w) {
173
173
  return console.warn(
174
174
  "[useAudioLevel] createMediaElementSource failed for slot",
175
175
  E,
176
- b
176
+ w
177
177
  ), null;
178
178
  }
179
179
  });
180
180
  },
181
181
  [c]
182
- ), v = L(
183
- (_, E = "mic") => {
182
+ ), b = C(
183
+ (x, E = "mic") => {
184
184
  c(E, (g) => {
185
185
  try {
186
- return g.createMediaStreamSource(_);
187
- } catch (b) {
186
+ return g.createMediaStreamSource(x);
187
+ } catch (w) {
188
188
  return console.warn(
189
189
  "[useAudioLevel] createMediaStreamSource failed for slot",
190
190
  E,
191
- b
191
+ w
192
192
  ), null;
193
193
  }
194
194
  });
195
195
  },
196
196
  [c]
197
- ), p = L(
198
- (_) => {
199
- a(_), t.current.size === 0 && r.current !== null && (cancelAnimationFrame(r.current), r.current = null);
197
+ ), p = C(
198
+ (x) => {
199
+ a(x), t.current.size === 0 && r.current !== null && (cancelAnimationFrame(r.current), r.current = null);
200
200
  },
201
201
  [a]
202
- ), h = L(() => {
202
+ ), h = C(() => {
203
203
  r.current !== null && (cancelAnimationFrame(r.current), r.current = null);
204
- for (const _ of Array.from(t.current.keys()))
205
- a(_);
206
- }, [a]), T = L((_) => (i.current.add(_), () => {
207
- i.current.delete(_);
204
+ for (const x of Array.from(t.current.keys()))
205
+ a(x);
206
+ }, [a]), P = C((x) => (i.current.add(x), () => {
207
+ i.current.delete(x);
208
208
  }), []);
209
- return P(() => () => {
209
+ return T(() => () => {
210
210
  if (h(), e.current) {
211
211
  try {
212
212
  e.current.close();
@@ -215,120 +215,120 @@ function hr() {
215
215
  e.current = null;
216
216
  }
217
217
  i.current.clear();
218
- }, [h]), { attach: d, attachStream: v, detach: h, detachSlot: p, subscribe: T };
218
+ }, [h]), { attach: d, attachStream: b, detach: h, detachSlot: p, subscribe: P };
219
219
  }
220
- function mr(e) {
220
+ function vr(e) {
221
221
  const t = e == null ? void 0 : e.mediaStreamTrack;
222
222
  return t ? new MediaStream([t]) : null;
223
223
  }
224
- function gr(e = {}) {
225
- const t = e.gateUntilAgentReady ?? !1, r = e.agentState ?? null, [i, l] = M(t), [o, s] = M(""), [a, c] = M(null), d = I(null), v = I(null), p = I({
224
+ function br(e = {}) {
225
+ const t = e.gateUntilAgentReady ?? !1, r = e.agentState ?? null, [i, l] = M(t), [o, s] = M(""), [a, c] = M(null), d = I(null), b = I(null), p = I({
226
226
  active: t,
227
227
  lastAutoIntent: null
228
- }), h = L(async (k) => {
229
- var y, H;
230
- if (d.current && v.current) {
228
+ }), h = C(async (S) => {
229
+ var y, O;
230
+ if (d.current && b.current) {
231
231
  try {
232
- await v.current.localParticipant.unpublishTrack(d.current);
232
+ await b.current.localParticipant.unpublishTrack(d.current);
233
233
  } catch {
234
234
  }
235
235
  d.current.stop(), d.current = null;
236
236
  }
237
- v.current = k, c(null);
237
+ b.current = S, c(null);
238
238
  try {
239
- const m = await ur({
239
+ const m = await pr({
240
240
  echoCancellation: !0,
241
241
  noiseSuppression: !0
242
242
  });
243
- await k.localParticipant.publishTrack(m), d.current = m, p.current.active ? (await k.localParticipant.setMicrophoneEnabled(!1), p.current.lastAutoIntent = !1, l(!0)) : l(m.isMuted);
244
- const D = (H = (y = m.mediaStreamTrack) == null ? void 0 : y.getSettings) == null ? void 0 : H.call(y);
243
+ await S.localParticipant.publishTrack(m), d.current = m, p.current.active ? (await S.localParticipant.setMicrophoneEnabled(!1), p.current.lastAutoIntent = !1, l(!0)) : l(m.isMuted);
244
+ const D = (O = (y = m.mediaStreamTrack) == null ? void 0 : y.getSettings) == null ? void 0 : O.call(y);
245
245
  D != null && D.deviceId && s(D.deviceId);
246
246
  } catch (m) {
247
247
  const D = m instanceof Error && m.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
248
248
  throw c(D), m;
249
249
  }
250
- }, []), T = L((k) => {
251
- v.current = k;
252
- }, []), _ = L(async (k) => {
253
- const y = v.current;
250
+ }, []), P = C((S) => {
251
+ b.current = S;
252
+ }, []), x = C(async (S) => {
253
+ const y = b.current;
254
254
  if (y)
255
255
  try {
256
- await y.switchActiveDevice("audioinput", k), s(k);
257
- } catch (H) {
258
- console.warn("[useMicrophoneState] switchDevice failed:", H);
256
+ await y.switchActiveDevice("audioinput", S), s(S);
257
+ } catch (O) {
258
+ console.warn("[useMicrophoneState] switchDevice failed:", O);
259
259
  }
260
- }, []), E = L(async () => {
261
- const k = v.current, y = !i;
262
- if (l(y), p.current.active = !1, !!k)
260
+ }, []), E = C(async () => {
261
+ const S = b.current, y = !i;
262
+ if (l(y), p.current.active = !1, !!S)
263
263
  try {
264
- await k.localParticipant.setMicrophoneEnabled(!y);
265
- } catch (H) {
266
- console.warn("[useMicrophoneState] setMicrophoneEnabled failed:", H), l(!y);
264
+ await S.localParticipant.setMicrophoneEnabled(!y);
265
+ } catch (O) {
266
+ console.warn("[useMicrophoneState] setMicrophoneEnabled failed:", O), l(!y);
267
267
  }
268
268
  }, [i]);
269
- P(() => {
269
+ T(() => {
270
270
  if (!p.current.active || r !== "listening") return;
271
- const k = v.current, y = k == null ? void 0 : k.localParticipant;
271
+ const S = b.current, y = S == null ? void 0 : S.localParticipant;
272
272
  if (!y) {
273
273
  p.current.active = !1;
274
274
  return;
275
275
  }
276
276
  y.isMicrophoneEnabled === p.current.lastAutoIntent && (y.setMicrophoneEnabled(!0), p.current.lastAutoIntent = !0, l(!1)), p.current.active = !1;
277
277
  }, [r]);
278
- const g = L(() => {
279
- const k = d.current, y = v.current;
280
- if (k && y) {
278
+ const g = C(() => {
279
+ const S = d.current, y = b.current;
280
+ if (S && y) {
281
281
  try {
282
- y.localParticipant.unpublishTrack(k);
282
+ y.localParticipant.unpublishTrack(S);
283
283
  } catch {
284
284
  }
285
- k.stop();
285
+ S.stop();
286
286
  }
287
- d.current = null, v.current = null, p.current = { active: t, lastAutoIntent: null }, l(t), s("");
288
- }, [t]), b = L(() => c(null), []), R = L(() => mr(d.current), []);
287
+ d.current = null, b.current = null, p.current = { active: t, lastAutoIntent: null }, l(t), s("");
288
+ }, [t]), w = C(() => c(null), []), R = C(() => vr(d.current), []);
289
289
  return {
290
290
  isMuted: i,
291
291
  activeDeviceId: o,
292
292
  micError: a,
293
293
  toggleMute: E,
294
294
  setupMic: h,
295
- attachRoom: T,
296
- switchDevice: _,
295
+ attachRoom: P,
296
+ switchDevice: x,
297
297
  teardownMic: g,
298
- clearError: b,
298
+ clearError: w,
299
299
  getMicStream: R
300
300
  };
301
301
  }
302
- const yr = { resolution: { width: 640, height: 480, frameRate: 24 } };
303
- function vr() {
304
- const [e, t] = M(!1), [r, i] = M(null), [l, o] = M(null), [s, a] = M(""), c = I(null), d = I(null), v = L((b) => {
305
- c.current = b;
306
- }, []), p = L(() => {
307
- var k;
308
- const b = c.current, R = d.current;
309
- if (R && b) {
310
- const y = b.localParticipant.getTrackPublication(Rn.Source.Camera), m = (y == null ? void 0 : y.track) ?? R;
302
+ const wr = { resolution: { width: 640, height: 480, frameRate: 24 } };
303
+ function _r() {
304
+ const [e, t] = M(!1), [r, i] = M(null), [l, o] = M(null), [s, a] = M(""), c = I(null), d = I(null), b = C((w) => {
305
+ c.current = w;
306
+ }, []), p = C(() => {
307
+ var S;
308
+ const w = c.current, R = d.current;
309
+ if (R && w) {
310
+ const y = w.localParticipant.getTrackPublication(Pn.Source.Camera), m = (y == null ? void 0 : y.track) ?? R;
311
311
  try {
312
- b.localParticipant.unpublishTrack(m);
312
+ w.localParticipant.unpublishTrack(m);
313
313
  } catch {
314
314
  }
315
315
  try {
316
- (k = m.stop) == null || k.call(m);
316
+ (S = m.stop) == null || S.call(m);
317
317
  } catch {
318
318
  }
319
319
  }
320
320
  d.current = null, o(null), t(!1);
321
- }, []), h = L(async (b) => {
321
+ }, []), h = C(async (w) => {
322
322
  const R = c.current;
323
323
  if (R) {
324
324
  i(null);
325
325
  try {
326
- const k = { ...yr };
327
- b && (k.deviceId = b);
328
- const y = await dr(k);
326
+ const S = { ...wr };
327
+ w && (S.deviceId = w);
328
+ const y = await hr(S);
329
329
  await R.localParticipant.publishTrack(y), d.current = y;
330
- const H = y.attach();
331
- o(H), t(!0), b && a(b);
330
+ const O = y.attach();
331
+ o(O), t(!0), w && a(w);
332
332
  try {
333
333
  R.localParticipant.publishData(
334
334
  new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
@@ -336,36 +336,36 @@ function vr() {
336
336
  );
337
337
  } catch {
338
338
  }
339
- } catch (k) {
340
- const y = k instanceof Error && k.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
339
+ } catch (S) {
340
+ const y = S instanceof Error && S.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
341
341
  i(y);
342
342
  }
343
343
  }
344
- }, []), T = L(async () => {
344
+ }, []), P = C(async () => {
345
345
  e ? p() : await h(s || void 0);
346
- }, [e, s, p, h]), _ = L(async (b) => {
347
- p(), await h(b);
348
- }, [p, h]), E = L(() => {
346
+ }, [e, s, p, h]), x = C(async (w) => {
347
+ p(), await h(w);
348
+ }, [p, h]), E = C(() => {
349
349
  p(), c.current = null, i(null), a("");
350
- }, [p]), g = L(() => i(null), []);
351
- return P(() => () => {
350
+ }, [p]), g = C(() => i(null), []);
351
+ return T(() => () => {
352
352
  d.current && d.current.stop();
353
353
  }, []), {
354
354
  isEnabled: e,
355
355
  error: r,
356
356
  previewEl: l,
357
357
  activeDeviceId: s,
358
- toggle: T,
359
- switchDevice: _,
360
- attachRoom: v,
358
+ toggle: P,
359
+ switchDevice: x,
360
+ attachRoom: b,
361
361
  teardown: E,
362
362
  clearError: g
363
363
  };
364
364
  }
365
- function br() {
366
- const [e, t] = M(!1), [r, i] = M(null), [l, o] = M(null), s = I(null), a = L((h) => {
365
+ function xr() {
366
+ const [e, t] = M(!1), [r, i] = M(null), [l, o] = M(null), s = I(null), a = C((h) => {
367
367
  s.current = h;
368
- }, []), c = L(() => o(null), []), d = L(async () => {
368
+ }, []), c = C(() => o(null), []), d = C(async () => {
369
369
  const h = s.current;
370
370
  if (h) {
371
371
  if (e) {
@@ -379,9 +379,9 @@ function br() {
379
379
  i(null);
380
380
  try {
381
381
  await h.localParticipant.setScreenShareEnabled(!0);
382
- let T = 0;
383
- const _ = () => {
384
- const E = h.localParticipant.getTrackPublication(Rn.Source.ScreenShare);
382
+ let P = 0;
383
+ const x = () => {
384
+ const E = h.localParticipant.getTrackPublication(Pn.Source.ScreenShare);
385
385
  if (E != null && E.track) {
386
386
  const g = E.track.attach();
387
387
  o(g), t(!0);
@@ -394,15 +394,15 @@ function br() {
394
394
  }
395
395
  return;
396
396
  }
397
- T++ < 10 ? setTimeout(_, 100) : t(!0);
397
+ P++ < 10 ? setTimeout(x, 100) : t(!0);
398
398
  };
399
- _();
400
- } catch (T) {
401
- const _ = T instanceof Error ? T.name : "";
402
- _ !== "NotAllowedError" && _ !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
399
+ x();
400
+ } catch (P) {
401
+ const x = P instanceof Error ? P.name : "";
402
+ x !== "NotAllowedError" && x !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
403
403
  }
404
404
  }
405
- }, [e, c]), v = L(() => {
405
+ }, [e, c]), b = C(() => {
406
406
  const h = s.current;
407
407
  if (h && e)
408
408
  try {
@@ -410,11 +410,11 @@ function br() {
410
410
  } catch {
411
411
  }
412
412
  c(), t(!1), i(null), s.current = null;
413
- }, [e, c]), p = L(() => i(null), []);
414
- return { isEnabled: e, error: r, previewEl: l, toggle: d, attachRoom: a, teardown: v, clearError: p };
413
+ }, [e, c]), p = C(() => i(null), []);
414
+ return { isEnabled: e, error: r, previewEl: l, toggle: d, attachRoom: a, teardown: b, clearError: p };
415
415
  }
416
- function wr() {
417
- const [e, t] = M([]), [r, i] = M([]), l = L(async () => {
416
+ function Lr() {
417
+ const [e, t] = M([]), [r, i] = M([]), l = C(async () => {
418
418
  if (!(typeof navigator > "u" || !navigator.mediaDevices))
419
419
  try {
420
420
  const o = await navigator.mediaDevices.enumerateDevices();
@@ -422,21 +422,21 @@ function wr() {
422
422
  } catch {
423
423
  }
424
424
  }, []);
425
- return P(() => {
425
+ return T(() => {
426
426
  if (l(), typeof navigator > "u" || !navigator.mediaDevices) return;
427
427
  const o = () => void l();
428
428
  return navigator.mediaDevices.addEventListener("devicechange", o), () => navigator.mediaDevices.removeEventListener("devicechange", o);
429
429
  }, [l]), { mics: e, cameras: r, refresh: l };
430
430
  }
431
- function _r(e, t, r = !1) {
431
+ function Cr(e, t, r = !1) {
432
432
  const [i, l] = M(null), [o, s] = M(null), [a, c] = M(!r && !!e);
433
- return P(() => {
433
+ return T(() => {
434
434
  if (r || !e) {
435
435
  c(!1);
436
436
  return;
437
437
  }
438
- const d = new AbortController(), v = t || "https://app.livelayer.studio";
439
- return c(!0), s(null), fetch(`${v}/api/widget/agent/${encodeURIComponent(e)}`, {
438
+ const d = new AbortController(), b = t || "https://app.livelayer.studio";
439
+ return c(!0), s(null), fetch(`${b}/api/widget/agent/${encodeURIComponent(e)}`, {
440
440
  signal: d.signal
441
441
  }).then(async (p) => {
442
442
  if (!p.ok) {
@@ -451,7 +451,7 @@ function _r(e, t, r = !1) {
451
451
  }), () => d.abort();
452
452
  }, [e, t, r]), { info: i, error: o, loading: a };
453
453
  }
454
- function Tn(e) {
454
+ function Dn(e) {
455
455
  if (typeof window > "u") return null;
456
456
  try {
457
457
  return window.localStorage.getItem(e);
@@ -459,26 +459,26 @@ function Tn(e) {
459
459
  return null;
460
460
  }
461
461
  }
462
- function Pn(e, t) {
462
+ function zn(e, t) {
463
463
  if (!(typeof window > "u"))
464
464
  try {
465
465
  window.localStorage.setItem(e, t);
466
466
  } catch {
467
467
  }
468
468
  }
469
- function xr(e) {
469
+ function kr(e) {
470
470
  if (!(typeof window > "u"))
471
471
  try {
472
472
  window.localStorage.removeItem(e);
473
473
  } catch {
474
474
  }
475
475
  }
476
- function Lr({
476
+ function Sr({
477
477
  value: e,
478
478
  defaultValue: t = "expanded",
479
479
  onChange: r
480
480
  } = {}) {
481
- const i = e !== void 0, [l, o] = M(t), s = i ? e : l, a = L(
481
+ const i = e !== void 0, [l, o] = M(t), s = i ? e : l, a = C(
482
482
  (c) => {
483
483
  c !== s && (i || o(c), r == null || r(c));
484
484
  },
@@ -486,34 +486,34 @@ function Lr({
486
486
  );
487
487
  return [s, a];
488
488
  }
489
- const Cr = ["hidden", "minimized", "expanded"];
490
- function kr(e) {
491
- return e && Cr.includes(e) ? e : null;
489
+ const Er = ["hidden", "minimized", "expanded"];
490
+ function Nr(e) {
491
+ return e && Er.includes(e) ? e : null;
492
492
  }
493
- function Er({
493
+ function Ar({
494
494
  value: e,
495
495
  defaultValue: t = "expanded",
496
496
  onChange: r,
497
497
  persistKey: i = "ll-widget",
498
498
  disablePersistence: l = !1
499
499
  } = {}) {
500
- const o = `${i}:display-mode`, s = I(!1), [a, c] = Lr({
500
+ const o = `${i}:display-mode`, s = I(!1), [a, c] = Sr({
501
501
  value: e,
502
502
  defaultValue: t,
503
503
  onChange: (d) => {
504
- e === void 0 && !l && Pn(o, d), r == null || r(d);
504
+ e === void 0 && !l && zn(o, d), r == null || r(d);
505
505
  }
506
506
  });
507
- return P(() => {
507
+ return T(() => {
508
508
  if (s.current || (s.current = !0, l || e !== void 0)) return;
509
- const d = kr(Tn(o));
509
+ const d = Nr(Dn(o));
510
510
  d && d !== a && c(d);
511
511
  }, []), [a, c];
512
512
  }
513
- const Sr = 640;
514
- function Nr(e = Sr) {
513
+ const Mr = 640;
514
+ function Ir(e = Mr) {
515
515
  const [t, r] = M(!1);
516
- return P(() => {
516
+ return T(() => {
517
517
  if (e === !1) {
518
518
  r(!1);
519
519
  return;
@@ -526,11 +526,11 @@ function Nr(e = Sr) {
526
526
  });
527
527
  }, [e]), t;
528
528
  }
529
- const Ar = 280, Mr = 380, Ir = 8, Rr = 4;
530
- function zt(e) {
529
+ const Rr = 280, Tr = 380, Pr = 8, Dr = 4;
530
+ function Ot(e) {
531
531
  return `${e}:geometry`;
532
532
  }
533
- function Tr(e) {
533
+ function zr(e) {
534
534
  if (!e) return null;
535
535
  let t;
536
536
  try {
@@ -542,149 +542,149 @@ function Tr(e) {
542
542
  const r = t, { top: i, left: l, width: o, height: s } = r;
543
543
  return typeof i != "number" || typeof l != "number" || typeof o != "number" || typeof s != "number" || !Number.isFinite(i) || !Number.isFinite(l) || !Number.isFinite(o) || !Number.isFinite(s) ? null : { top: i, left: l, width: o, height: s };
544
544
  }
545
- function Lt() {
545
+ function Ct() {
546
546
  return typeof window > "u" ? { vw: 0, vh: 0 } : { vw: window.innerWidth, vh: window.innerHeight };
547
547
  }
548
- function $t(e, t, r) {
548
+ function Ft(e, t, r) {
549
549
  const { minWidth: i, minHeight: l, edgeMargin: o, vw: s, vh: a } = r, c = Math.max(i, s - o * 2), d = Math.max(l, a - o * 2);
550
550
  return {
551
551
  width: Math.max(i, Math.min(c, e)),
552
552
  height: Math.max(l, Math.min(d, t))
553
553
  };
554
554
  }
555
- function Ht(e, t, r, i, l) {
556
- const { edgeMargin: o, vw: s, vh: a } = l, c = o, d = o, v = Math.max(c, s - r - o), p = Math.max(d, a - i - o);
555
+ function Wt(e, t, r, i, l) {
556
+ const { edgeMargin: o, vw: s, vh: a } = l, c = o, d = o, b = Math.max(c, s - r - o), p = Math.max(d, a - i - o);
557
557
  return {
558
558
  top: Math.max(d, Math.min(p, e)),
559
- left: Math.max(c, Math.min(v, t))
559
+ left: Math.max(c, Math.min(b, t))
560
560
  };
561
561
  }
562
- function Pr(e) {
562
+ function $r(e) {
563
563
  const {
564
564
  draggable: t,
565
565
  resizable: r,
566
566
  persistKey: i,
567
567
  disablePersistence: l,
568
- minWidth: o = Ar,
569
- minHeight: s = Mr,
570
- edgeMargin: a = Ir
571
- } = e, [c, d] = M(null), [v, p] = M(!1), [h, T] = M(!1), _ = I(null), E = I(null), g = I(!1), b = I(null);
572
- b.current = c;
573
- const R = L(
568
+ minWidth: o = Rr,
569
+ minHeight: s = Tr,
570
+ edgeMargin: a = Pr
571
+ } = e, [c, d] = M(null), [b, p] = M(!1), [h, P] = M(!1), x = I(null), E = I(null), g = I(!1), w = I(null);
572
+ w.current = c;
573
+ const R = C(
574
574
  (f) => {
575
- l || (f === null ? xr(zt(i)) : Pn(zt(i), JSON.stringify(f)));
575
+ l || (f === null ? kr(Ot(i)) : zn(Ot(i), JSON.stringify(f)));
576
576
  },
577
577
  [l, i]
578
578
  );
579
- P(() => {
579
+ T(() => {
580
580
  if (g.current || (g.current = !0, l)) return;
581
- const f = Tr(Tn(zt(i)));
581
+ const f = zr(Dn(Ot(i)));
582
582
  if (!f) return;
583
- const { vw: S, vh: O } = Lt(), q = $t(f.width, f.height, {
583
+ const { vw: N, vh: z } = Ct(), q = Ft(f.width, f.height, {
584
584
  minWidth: o,
585
585
  minHeight: s,
586
586
  edgeMargin: a,
587
- vw: S,
588
- vh: O
589
- }), X = Ht(f.top, f.left, q.width, q.height, {
587
+ vw: N,
588
+ vh: z
589
+ }), X = Wt(f.top, f.left, q.width, q.height, {
590
590
  edgeMargin: a,
591
- vw: S,
592
- vh: O
591
+ vw: N,
592
+ vh: z
593
593
  });
594
594
  d({ ...X, ...q });
595
- }, []), P(() => {
595
+ }, []), T(() => {
596
596
  if (typeof window > "u") return;
597
597
  const f = () => {
598
- d((S) => {
599
- if (S === null) return null;
600
- const { vw: O, vh: q } = Lt(), X = $t(S.width, S.height, {
598
+ d((N) => {
599
+ if (N === null) return null;
600
+ const { vw: z, vh: q } = Ct(), X = Ft(N.width, N.height, {
601
601
  minWidth: o,
602
602
  minHeight: s,
603
603
  edgeMargin: a,
604
- vw: O,
604
+ vw: z,
605
605
  vh: q
606
606
  });
607
- return { ...Ht(S.top, S.left, X.width, X.height, {
607
+ return { ...Wt(N.top, N.left, X.width, X.height, {
608
608
  edgeMargin: a,
609
- vw: O,
609
+ vw: z,
610
610
  vh: q
611
611
  }), ...X };
612
612
  });
613
613
  };
614
614
  return window.addEventListener("resize", f), () => window.removeEventListener("resize", f);
615
615
  }, [o, s, a]);
616
- const k = L(
616
+ const S = C(
617
617
  (f) => {
618
618
  if (!t || f.pointerType === "mouse" && f.button !== 0) return;
619
- const S = f.target;
620
- if (S && typeof S.closest == "function" && S.closest('button, a, input, select, textarea, [role="listbox"], [role="option"], [data-ll-no-drag]'))
619
+ const N = f.target;
620
+ if (N && typeof N.closest == "function" && N.closest('button, a, input, select, textarea, [role="listbox"], [role="option"], [data-ll-no-drag]'))
621
621
  return;
622
- let O, q, X, Q;
623
- const Y = b.current;
624
- if (Y)
625
- ({ top: O, left: q, width: X, height: Q } = Y);
622
+ let z, q, X, ee;
623
+ const V = w.current;
624
+ if (V)
625
+ ({ top: z, left: q, width: X, height: ee } = V);
626
626
  else {
627
- const te = f.currentTarget.closest(".ll-widget"), ie = te == null ? void 0 : te.getBoundingClientRect();
628
- if (!ie) return;
629
- O = ie.top, q = ie.left, X = ie.width, Q = ie.height;
627
+ const te = f.currentTarget.closest(".ll-widget"), oe = te == null ? void 0 : te.getBoundingClientRect();
628
+ if (!oe) return;
629
+ z = oe.top, q = oe.left, X = oe.width, ee = oe.height;
630
630
  }
631
631
  try {
632
632
  f.currentTarget.setPointerCapture(f.pointerId);
633
633
  } catch {
634
634
  }
635
- _.current = {
635
+ x.current = {
636
636
  startClientX: f.clientX,
637
637
  startClientY: f.clientY,
638
- startTop: O,
638
+ startTop: z,
639
639
  startLeft: q,
640
640
  width: X,
641
- height: Q,
641
+ height: ee,
642
642
  moved: !1
643
643
  };
644
644
  },
645
645
  [t]
646
- ), y = L(
646
+ ), y = C(
647
647
  (f) => {
648
- const S = _.current;
649
- if (!S) return;
650
- const O = f.clientX - S.startClientX, q = f.clientY - S.startClientY;
651
- if (!S.moved && Math.abs(O) + Math.abs(q) > Rr && (S.moved = !0, p(!0)), !S.moved) return;
652
- const { vw: X, vh: Q } = Lt(), Y = Ht(
653
- S.startTop + q,
654
- S.startLeft + O,
655
- S.width,
656
- S.height,
657
- { edgeMargin: a, vw: X, vh: Q }
648
+ const N = x.current;
649
+ if (!N) return;
650
+ const z = f.clientX - N.startClientX, q = f.clientY - N.startClientY;
651
+ if (!N.moved && Math.abs(z) + Math.abs(q) > Dr && (N.moved = !0, p(!0)), !N.moved) return;
652
+ const { vw: X, vh: ee } = Ct(), V = Wt(
653
+ N.startTop + q,
654
+ N.startLeft + z,
655
+ N.width,
656
+ N.height,
657
+ { edgeMargin: a, vw: X, vh: ee }
658
658
  );
659
- d({ ...Y, width: S.width, height: S.height });
659
+ d({ ...V, width: N.width, height: N.height });
660
660
  },
661
661
  [a]
662
- ), H = L(
662
+ ), O = C(
663
663
  (f) => {
664
- const S = _.current;
665
- if (S) {
664
+ const N = x.current;
665
+ if (N) {
666
666
  try {
667
667
  f.currentTarget.releasePointerCapture(f.pointerId);
668
668
  } catch {
669
669
  }
670
- _.current = null, S.moved && (p(!1), d((O) => (O && R(O), O)));
670
+ x.current = null, N.moved && (p(!1), d((z) => (z && R(z), z)));
671
671
  }
672
672
  },
673
673
  [R]
674
- ), m = L(() => {
675
- _.current = null, E.current = null, p(!1), T(!1), d(null), R(null);
676
- }, [R]), D = L(
674
+ ), m = C(() => {
675
+ x.current = null, E.current = null, p(!1), P(!1), d(null), R(null);
676
+ }, [R]), D = C(
677
677
  (f) => {
678
678
  if (!r || f.pointerType === "mouse" && f.button !== 0) return;
679
679
  f.stopPropagation();
680
- let S, O, q, X;
681
- const Q = b.current;
682
- if (Q)
683
- ({ top: S, left: O, width: q, height: X } = Q);
680
+ let N, z, q, X;
681
+ const ee = w.current;
682
+ if (ee)
683
+ ({ top: N, left: z, width: q, height: X } = ee);
684
684
  else {
685
- const Y = f.currentTarget.closest(".ll-widget"), te = Y == null ? void 0 : Y.getBoundingClientRect();
685
+ const V = f.currentTarget.closest(".ll-widget"), te = V == null ? void 0 : V.getBoundingClientRect();
686
686
  if (!te) return;
687
- S = te.top, O = te.left, q = te.width, X = te.height;
687
+ N = te.top, z = te.left, q = te.width, X = te.height;
688
688
  }
689
689
  try {
690
690
  f.currentTarget.setPointerCapture(f.pointerId);
@@ -695,35 +695,35 @@ function Pr(e) {
695
695
  startClientY: f.clientY,
696
696
  startWidth: q,
697
697
  startHeight: X,
698
- top: S,
699
- left: O
700
- }, T(!0);
698
+ top: N,
699
+ left: z
700
+ }, P(!0);
701
701
  },
702
702
  [r]
703
- ), F = L(
703
+ ), W = C(
704
704
  (f) => {
705
- const S = E.current;
706
- if (!S) return;
707
- const O = f.clientX - S.startClientX, q = f.clientY - S.startClientY, { vw: X, vh: Q } = Lt(), Y = X - S.left - a, te = Q - S.top - a, ie = $t(S.startWidth + O, S.startHeight + q, {
705
+ const N = E.current;
706
+ if (!N) return;
707
+ const z = f.clientX - N.startClientX, q = f.clientY - N.startClientY, { vw: X, vh: ee } = Ct(), V = X - N.left - a, te = ee - N.top - a, oe = Ft(N.startWidth + z, N.startHeight + q, {
708
708
  minWidth: o,
709
709
  minHeight: s,
710
710
  edgeMargin: a,
711
711
  // Clamp the available viewport to the room from the anchored corner
712
712
  // so the widget can't grow past the bottom/right edge.
713
- vw: Math.min(X, S.left + Y + a),
714
- vh: Math.min(Q, S.top + te + a)
713
+ vw: Math.min(X, N.left + V + a),
714
+ vh: Math.min(ee, N.top + te + a)
715
715
  });
716
- d({ top: S.top, left: S.left, ...ie });
716
+ d({ top: N.top, left: N.left, ...oe });
717
717
  },
718
718
  [a, o, s]
719
- ), K = L(
719
+ ), K = C(
720
720
  (f) => {
721
721
  if (E.current) {
722
722
  try {
723
723
  f.currentTarget.releasePointerCapture(f.pointerId);
724
724
  } catch {
725
725
  }
726
- E.current = null, T(!1), d((O) => (O && R(O), O));
726
+ E.current = null, P(!1), d((z) => (z && R(z), z));
727
727
  }
728
728
  },
729
729
  [R]
@@ -739,19 +739,19 @@ function Pr(e) {
739
739
  height: `${c.height}px`
740
740
  },
741
741
  hasGeometry: c !== null,
742
- isDragging: v,
742
+ isDragging: b,
743
743
  isResizing: h,
744
744
  dragHandleProps: {
745
- onPointerDown: k,
745
+ onPointerDown: S,
746
746
  onPointerMove: y,
747
- onPointerUp: H,
748
- onPointerCancel: H,
747
+ onPointerUp: O,
748
+ onPointerCancel: O,
749
749
  onDoubleClick: m,
750
750
  "data-ll-drag-handle": t ? "" : void 0
751
751
  },
752
752
  resizeHandleProps: {
753
753
  onPointerDown: D,
754
- onPointerMove: F,
754
+ onPointerMove: W,
755
755
  onPointerUp: K,
756
756
  onPointerCancel: K,
757
757
  "data-ll-resize-handle": r ? "" : void 0
@@ -759,9 +759,9 @@ function Pr(e) {
759
759
  reset: m
760
760
  };
761
761
  }
762
- const un = "__llHistoryPatched", Et = "ll:pathname";
763
- function Dr() {
764
- if (typeof window > "u" || window.history[un]) return;
762
+ const fn = "__llHistoryPatched", Et = "ll:pathname";
763
+ function Hr() {
764
+ if (typeof window > "u" || window.history[fn]) return;
765
765
  const e = window.history.pushState, t = window.history.replaceState;
766
766
  window.history.pushState = function(...r) {
767
767
  const i = e.apply(this, r);
@@ -769,65 +769,65 @@ function Dr() {
769
769
  }, window.history.replaceState = function(...r) {
770
770
  const i = t.apply(this, r);
771
771
  return window.dispatchEvent(new Event(Et)), i;
772
- }, window.history[un] = !0;
772
+ }, window.history[fn] = !0;
773
773
  }
774
- function dn() {
774
+ function pn() {
775
775
  return typeof window > "u" ? "/" : window.location.pathname || "/";
776
776
  }
777
- function zr(e) {
777
+ function Or(e) {
778
778
  const [t, r] = M(
779
- () => e ?? dn()
779
+ () => e ?? pn()
780
780
  );
781
- return P(() => {
781
+ return T(() => {
782
782
  if (e !== void 0) return;
783
- Dr();
784
- const i = () => r(dn());
783
+ Hr();
784
+ const i = () => r(pn());
785
785
  return i(), window.addEventListener("popstate", i), window.addEventListener(Et, i), () => {
786
786
  window.removeEventListener("popstate", i), window.removeEventListener(Et, i);
787
787
  };
788
788
  }, [e]), e ?? t;
789
789
  }
790
- const fn = /* @__PURE__ */ new Map(), $r = /[\\^$+?.()|{}[\]]/g;
791
- function Hr(e) {
792
- return e.replace($r, "\\$&");
790
+ const hn = /* @__PURE__ */ new Map(), Fr = /[\\^$+?.()|{}[\]]/g;
791
+ function Wr(e) {
792
+ return e.replace(Fr, "\\$&");
793
793
  }
794
- function Or(e) {
795
- const t = fn.get(e);
794
+ function Br(e) {
795
+ const t = hn.get(e);
796
796
  if (t) return t;
797
- const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", l = "", o = r.replace(/\*\*/g, i).replace(/\*/g, l), a = Hr(o).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(l, "g"), "[^/]+"), c = new RegExp(`^${a}\\/?$`);
798
- return fn.set(e, c), c;
797
+ const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", l = "", o = r.replace(/\*\*/g, i).replace(/\*/g, l), a = Wr(o).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(l, "g"), "[^/]+"), c = new RegExp(`^${a}\\/?$`);
798
+ return hn.set(e, c), c;
799
799
  }
800
- function Wr(e, t) {
800
+ function qr(e, t) {
801
801
  const r = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
802
- return Or(e).test(r);
802
+ return Br(e).test(r);
803
803
  }
804
- function Fr(e, t) {
805
- return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : Wr(e, t);
804
+ function Ur(e, t) {
805
+ return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : qr(e, t);
806
806
  }
807
- function pn(e, t) {
807
+ function mn(e, t) {
808
808
  if (!e || e.length === 0) return !1;
809
809
  for (const r of e)
810
- if (Fr(r, t)) return !0;
810
+ if (Ur(r, t)) return !0;
811
811
  return !1;
812
812
  }
813
- function Br(e, t, r) {
814
- return e === void 0 ? !0 : pn(r, e) ? !1 : t && t.length > 0 ? pn(t, e) : !0;
813
+ function jr(e, t, r) {
814
+ return e === void 0 ? !0 : mn(r, e) ? !1 : t && t.length > 0 ? mn(t, e) : !0;
815
815
  }
816
- function qr(e, t, r) {
817
- return nt(
818
- () => Br(e, t, r),
816
+ function Vr(e, t, r) {
817
+ return et(
818
+ () => jr(e, t, r),
819
819
  [e, t, r]
820
820
  );
821
821
  }
822
- function Ur(e) {
822
+ function Yr(e) {
823
823
  return e === !1 ? { navigate: !1, thinking: !1, action: !1 } : e === void 0 || e === !0 ? { navigate: !0, thinking: !0, action: !0 } : {
824
824
  navigate: e.navigate !== !1,
825
825
  thinking: e.thinking !== !1,
826
826
  action: e.action !== !1
827
827
  };
828
828
  }
829
- function jr(e) {
830
- const t = nt(() => Ur(e.config), [e.config]), r = e.baseUrl.replace(/\/+$/, ""), i = I(null), l = L(
829
+ function Gr(e) {
830
+ const t = et(() => Yr(e.config), [e.config]), r = e.baseUrl.replace(/\/+$/, ""), i = I(null), l = C(
831
831
  (c) => {
832
832
  try {
833
833
  new Audio(`${r}${c}`).play().catch(() => {
@@ -836,11 +836,11 @@ function jr(e) {
836
836
  }
837
837
  },
838
838
  [r]
839
- ), o = L(() => {
839
+ ), o = C(() => {
840
840
  t.navigate && l("/audio/page-change-sound.mp3");
841
- }, [t.navigate, l]), s = L(() => {
841
+ }, [t.navigate, l]), s = C(() => {
842
842
  t.action && l("/audio/confirmation-sound.mp3");
843
- }, [t.action, l]), a = L(
843
+ }, [t.action, l]), a = C(
844
844
  (c) => {
845
845
  if (!t.thinking) {
846
846
  if (i.current) {
@@ -871,7 +871,7 @@ function jr(e) {
871
871
  },
872
872
  [r, t.thinking]
873
873
  );
874
- return P(() => () => {
874
+ return T(() => () => {
875
875
  if (i.current) {
876
876
  try {
877
877
  i.current.pause();
@@ -879,12 +879,12 @@ function jr(e) {
879
879
  }
880
880
  i.current = null;
881
881
  }
882
- }, []), nt(
882
+ }, []), et(
883
883
  () => ({ playPageChange: o, playConfirmation: s, setThinking: a }),
884
884
  [o, s, a]
885
885
  );
886
886
  }
887
- const hn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ C(
887
+ const gn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ k(
888
888
  "svg",
889
889
  {
890
890
  className: t,
@@ -930,7 +930,7 @@ const hn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ C(
930
930
  }
931
931
  )
932
932
  }
933
- ), mn = ({ className: e }) => /* @__PURE__ */ n(
933
+ ), yn = ({ className: e }) => /* @__PURE__ */ n(
934
934
  "svg",
935
935
  {
936
936
  className: e,
@@ -948,7 +948,7 @@ const hn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ C(
948
948
  }
949
949
  )
950
950
  }
951
- ), Vr = ({ className: e }) => /* @__PURE__ */ n(
951
+ ), Xr = ({ className: e }) => /* @__PURE__ */ n(
952
952
  "svg",
953
953
  {
954
954
  className: e,
@@ -959,12 +959,12 @@ const hn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ C(
959
959
  "aria-hidden": "true",
960
960
  children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
961
961
  }
962
- ), Yr = {
962
+ ), Kr = {
963
963
  left: 180,
964
964
  right: 0,
965
965
  up: -90,
966
966
  down: 90
967
- }, gn = ({ direction: e = "right", className: t }) => /* @__PURE__ */ n(
967
+ }, vn = ({ direction: e = "right", className: t }) => /* @__PURE__ */ n(
968
968
  "svg",
969
969
  {
970
970
  className: t,
@@ -972,19 +972,19 @@ const hn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ C(
972
972
  viewBox: "0 0 24 24",
973
973
  stroke: "currentColor",
974
974
  strokeWidth: 2,
975
- style: { transform: `rotate(${Yr[e]}deg)` },
975
+ style: { transform: `rotate(${Kr[e]}deg)` },
976
976
  "aria-hidden": "true",
977
977
  children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" })
978
978
  }
979
979
  );
980
- function Gr(e) {
980
+ function Jr(e) {
981
981
  return e === "top-left" || e === "bottom-left" ? "left" : "right";
982
982
  }
983
- const Dn = "ll-hidden-tab-center-y", Xr = 5, yn = 16;
984
- function Kr() {
983
+ const $n = "ll-hidden-tab-center-y", Zr = 5, bn = 16;
984
+ function Qr() {
985
985
  if (typeof window > "u") return null;
986
986
  try {
987
- const e = window.localStorage.getItem(Dn);
987
+ const e = window.localStorage.getItem($n);
988
988
  if (!e) return null;
989
989
  const t = Number.parseFloat(e);
990
990
  return Number.isFinite(t) ? t : null;
@@ -992,14 +992,14 @@ function Kr() {
992
992
  return null;
993
993
  }
994
994
  }
995
- function vn(e) {
995
+ function wn(e) {
996
996
  if (!(typeof window > "u"))
997
997
  try {
998
- window.localStorage.setItem(Dn, String(e));
998
+ window.localStorage.setItem($n, String(e));
999
999
  } catch {
1000
1000
  }
1001
1001
  }
1002
- const Jr = ({
1002
+ const ei = ({
1003
1003
  position: e,
1004
1004
  isMobile: t,
1005
1005
  isSpeaking: r,
@@ -1009,80 +1009,80 @@ const Jr = ({
1009
1009
  agentName: s,
1010
1010
  containerEl: a
1011
1011
  }) => {
1012
- const c = Gr(e), d = c === "right" ? "left" : "right", v = t ? 80 : 72, p = !!o, h = !!a, [T, _] = M(null), [E, g] = M(!1), b = I(null), R = I(!1), k = L(
1013
- (z) => {
1014
- if (typeof window > "u") return z;
1015
- const G = v / 2, f = yn + G, S = window.innerHeight - yn - G;
1016
- return S < f ? Math.max(f, z) : Math.max(f, Math.min(S, z));
1012
+ const c = Jr(e), d = c === "right" ? "left" : "right", b = t ? 80 : 72, p = !!o, h = !!a, [P, x] = M(null), [E, g] = M(!1), w = I(null), R = I(!1), S = C(
1013
+ ($) => {
1014
+ if (typeof window > "u") return $;
1015
+ const G = b / 2, f = bn + G, N = window.innerHeight - bn - G;
1016
+ return N < f ? Math.max(f, $) : Math.max(f, Math.min(N, $));
1017
1017
  },
1018
- [v]
1018
+ [b]
1019
1019
  );
1020
- P(() => {
1020
+ T(() => {
1021
1021
  if (h) {
1022
- _(null);
1022
+ x(null);
1023
1023
  return;
1024
1024
  }
1025
- const z = Kr();
1026
- _(k(z ?? window.innerHeight / 2));
1025
+ const $ = Qr();
1026
+ x(S($ ?? window.innerHeight / 2));
1027
1027
  const G = () => {
1028
- _((f) => f === null ? null : k(f));
1028
+ x((f) => f === null ? null : S(f));
1029
1029
  };
1030
1030
  return window.addEventListener("resize", G), () => window.removeEventListener("resize", G);
1031
- }, [k, h]);
1032
- const y = L(
1033
- (z) => {
1034
- if (!h && !(z.pointerType === "mouse" && z.button !== 0) && T !== null) {
1031
+ }, [S, h]);
1032
+ const y = C(
1033
+ ($) => {
1034
+ if (!h && !($.pointerType === "mouse" && $.button !== 0) && P !== null) {
1035
1035
  try {
1036
- z.currentTarget.setPointerCapture(z.pointerId);
1036
+ $.currentTarget.setPointerCapture($.pointerId);
1037
1037
  } catch {
1038
1038
  }
1039
- b.current = {
1040
- startClientY: z.clientY,
1041
- startCenterY: T,
1039
+ w.current = {
1040
+ startClientY: $.clientY,
1041
+ startCenterY: P,
1042
1042
  moved: !1
1043
1043
  };
1044
1044
  }
1045
1045
  },
1046
- [T, h]
1047
- ), H = L(
1048
- (z) => {
1049
- const G = b.current;
1046
+ [P, h]
1047
+ ), O = C(
1048
+ ($) => {
1049
+ const G = w.current;
1050
1050
  if (!G) return;
1051
- const f = z.clientY - G.startClientY;
1052
- !G.moved && Math.abs(f) > Xr && (G.moved = !0, g(!0)), G.moved && _(k(G.startCenterY + f));
1051
+ const f = $.clientY - G.startClientY;
1052
+ !G.moved && Math.abs(f) > Zr && (G.moved = !0, g(!0)), G.moved && x(S(G.startCenterY + f));
1053
1053
  },
1054
- [k]
1055
- ), m = L(
1056
- (z) => {
1057
- const G = b.current;
1054
+ [S]
1055
+ ), m = C(
1056
+ ($) => {
1057
+ const G = w.current;
1058
1058
  if (G) {
1059
1059
  try {
1060
- z.currentTarget.releasePointerCapture(z.pointerId);
1060
+ $.currentTarget.releasePointerCapture($.pointerId);
1061
1061
  } catch {
1062
1062
  }
1063
- b.current = null, G.moved && (g(!1), R.current = !0, _((f) => (f !== null && vn(f), f)));
1063
+ w.current = null, G.moved && (g(!1), R.current = !0, x((f) => (f !== null && wn(f), f)));
1064
1064
  }
1065
1065
  },
1066
1066
  []
1067
- ), D = L(() => {
1067
+ ), D = C(() => {
1068
1068
  if (R.current) {
1069
1069
  R.current = !1;
1070
1070
  return;
1071
1071
  }
1072
1072
  i();
1073
- }, [i]), F = L(
1074
- (z) => {
1075
- if (z.key === "ArrowUp" || z.key === "ArrowDown") {
1076
- z.preventDefault();
1077
- const G = z.key === "ArrowUp" ? -8 : 8;
1078
- _((f) => {
1073
+ }, [i]), W = C(
1074
+ ($) => {
1075
+ if ($.key === "ArrowUp" || $.key === "ArrowDown") {
1076
+ $.preventDefault();
1077
+ const G = $.key === "ArrowUp" ? -8 : 8;
1078
+ x((f) => {
1079
1079
  if (f === null) return f;
1080
- const S = k(f + G);
1081
- return vn(S), S;
1080
+ const N = S(f + G);
1081
+ return wn(N), N;
1082
1082
  });
1083
1083
  }
1084
1084
  },
1085
- [k]
1085
+ [S]
1086
1086
  ), K = [
1087
1087
  "ll-hidden",
1088
1088
  `ll-hidden--${c}`,
@@ -1091,29 +1091,29 @@ const Jr = ({
1091
1091
  E ? "is-dragging" : null,
1092
1092
  p ? "ll-hidden--with-avatar" : null,
1093
1093
  h ? "ll-hidden--scoped" : null
1094
- ].filter(Boolean).join(" "), oe = T === null ? void 0 : { top: `${T - v / 2}px`, transform: "none" };
1094
+ ].filter(Boolean).join(" "), ae = P === null ? void 0 : { top: `${P - b / 2}px`, transform: "none" };
1095
1095
  return /* @__PURE__ */ n(
1096
1096
  "button",
1097
1097
  {
1098
1098
  type: "button",
1099
1099
  className: K,
1100
1100
  onPointerDown: y,
1101
- onPointerMove: H,
1101
+ onPointerMove: O,
1102
1102
  onPointerUp: m,
1103
1103
  onPointerCancel: m,
1104
1104
  onClick: D,
1105
- onKeyDown: F,
1105
+ onKeyDown: W,
1106
1106
  "aria-label": l,
1107
1107
  "data-position": e,
1108
- style: oe,
1108
+ style: ae,
1109
1109
  children: p ? (
1110
1110
  // Layout: tiny chevron flush against the inward edge (peeks out
1111
1111
  // as the click affordance), then the circular avatar photo
1112
1112
  // taking the rest of the tab. Reinforces "this is an
1113
1113
  // avatar-based experience" even when collapsed.
1114
- /* @__PURE__ */ C(We, { children: [
1114
+ /* @__PURE__ */ k(Fe, { children: [
1115
1115
  /* @__PURE__ */ n(
1116
- gn,
1116
+ vn,
1117
1117
  {
1118
1118
  direction: d,
1119
1119
  className: "ll-hidden__chevron ll-hidden__chevron--mini"
@@ -1130,7 +1130,7 @@ const Jr = ({
1130
1130
  )
1131
1131
  ] })
1132
1132
  ) : /* @__PURE__ */ n(
1133
- gn,
1133
+ vn,
1134
1134
  {
1135
1135
  direction: d,
1136
1136
  className: "ll-hidden__chevron"
@@ -1138,7 +1138,7 @@ const Jr = ({
1138
1138
  )
1139
1139
  }
1140
1140
  );
1141
- }, Zr = ({
1141
+ }, ti = ({
1142
1142
  audioLevel: e,
1143
1143
  bars: t = 20,
1144
1144
  maxHeight: r = 20,
@@ -1146,20 +1146,20 @@ const Jr = ({
1146
1146
  className: l,
1147
1147
  barClassName: o
1148
1148
  }) => {
1149
- const s = I(null), a = I([]), c = nt(() => {
1150
- const v = (Math.sqrt(5) - 1) / 2;
1151
- return Array.from({ length: t }, (p, h) => 0.5 + h * v % 1 * 0.5);
1149
+ const s = I(null), a = I([]), c = et(() => {
1150
+ const b = (Math.sqrt(5) - 1) / 2;
1151
+ return Array.from({ length: t }, (p, h) => 0.5 + h * b % 1 * 0.5);
1152
1152
  }, [t]);
1153
- P(() => e.subscribe((p) => {
1153
+ T(() => e.subscribe((p) => {
1154
1154
  for (let h = 0; h < t; h++) {
1155
- const T = a.current[h];
1156
- if (!T) continue;
1157
- const _ = Math.max(i, p * r * c[h]);
1158
- T.style.height = `${_}px`;
1155
+ const P = a.current[h];
1156
+ if (!P) continue;
1157
+ const x = Math.max(i, p * r * c[h]);
1158
+ P.style.height = `${x}px`;
1159
1159
  }
1160
1160
  }), [e, t, r, i, c]);
1161
1161
  const d = ["ll-waveform", l].filter(Boolean).join(" ");
1162
- return /* @__PURE__ */ n("div", { ref: s, className: d, "aria-hidden": "true", children: Array.from({ length: t }, (v, p) => /* @__PURE__ */ n(
1162
+ return /* @__PURE__ */ n("div", { ref: s, className: d, "aria-hidden": "true", children: Array.from({ length: t }, (b, p) => /* @__PURE__ */ n(
1163
1163
  "div",
1164
1164
  {
1165
1165
  ref: (h) => {
@@ -1170,7 +1170,7 @@ const Jr = ({
1170
1170
  },
1171
1171
  p
1172
1172
  )) });
1173
- }, Qr = ({
1173
+ }, ni = ({
1174
1174
  position: e,
1175
1175
  isMobile: t,
1176
1176
  agentName: r,
@@ -1187,7 +1187,7 @@ const Jr = ({
1187
1187
  className: "ll-minimized ll-minimized--mobile",
1188
1188
  role: "region",
1189
1189
  "aria-label": `${r} widget`,
1190
- children: /* @__PURE__ */ C(
1190
+ children: /* @__PURE__ */ k(
1191
1191
  "button",
1192
1192
  {
1193
1193
  type: "button",
@@ -1207,7 +1207,7 @@ const Jr = ({
1207
1207
  )
1208
1208
  ) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
1209
1209
  /* @__PURE__ */ n(
1210
- Zr,
1210
+ ti,
1211
1211
  {
1212
1212
  audioLevel: s,
1213
1213
  bars: 16,
@@ -1216,24 +1216,24 @@ const Jr = ({
1216
1216
  }
1217
1217
  ),
1218
1218
  /* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
1219
- /* @__PURE__ */ C("div", { className: "ll-minimized__controls", children: [
1219
+ /* @__PURE__ */ k("div", { className: "ll-minimized__controls", children: [
1220
1220
  /* @__PURE__ */ n(
1221
1221
  "span",
1222
1222
  {
1223
1223
  className: "ll-minimized__btn",
1224
1224
  role: "button",
1225
1225
  tabIndex: 0,
1226
- onClick: (v) => {
1227
- v.stopPropagation(), c();
1226
+ onClick: (b) => {
1227
+ b.stopPropagation(), c();
1228
1228
  },
1229
- onKeyDown: (v) => {
1230
- (v.key === "Enter" || v.key === " ") && (v.stopPropagation(), v.preventDefault(), c());
1229
+ onKeyDown: (b) => {
1230
+ (b.key === "Enter" || b.key === " ") && (b.stopPropagation(), b.preventDefault(), c());
1231
1231
  },
1232
1232
  "aria-label": o ? "Unmute microphone" : "Mute microphone",
1233
- children: /* @__PURE__ */ n(hn, { muted: o, className: "ll-minimized__icon" })
1233
+ children: /* @__PURE__ */ n(gn, { muted: o, className: "ll-minimized__icon" })
1234
1234
  }
1235
1235
  ),
1236
- /* @__PURE__ */ n(mn, { className: "ll-minimized__icon ll-minimized__icon--expand" })
1236
+ /* @__PURE__ */ n(yn, { className: "ll-minimized__icon ll-minimized__icon--expand" })
1237
1237
  ] })
1238
1238
  ]
1239
1239
  }
@@ -1246,7 +1246,7 @@ const Jr = ({
1246
1246
  "data-position": e,
1247
1247
  role: "region",
1248
1248
  "aria-label": `${r} widget`,
1249
- children: /* @__PURE__ */ C("div", { className: "ll-minimized__surface", children: [
1249
+ children: /* @__PURE__ */ k("div", { className: "ll-minimized__surface", children: [
1250
1250
  i ? (
1251
1251
  // eslint-disable-next-line @next/next/no-img-element
1252
1252
  /* @__PURE__ */ n(
@@ -1258,11 +1258,11 @@ const Jr = ({
1258
1258
  }
1259
1259
  )
1260
1260
  ) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
1261
- /* @__PURE__ */ C("div", { className: "ll-minimized__meta", children: [
1261
+ /* @__PURE__ */ k("div", { className: "ll-minimized__meta", children: [
1262
1262
  /* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
1263
1263
  /* @__PURE__ */ n("span", { className: "ll-minimized__state", children: l === "speaking" ? "Speaking" : l === "thinking" ? "Thinking" : "Listening" })
1264
1264
  ] }),
1265
- /* @__PURE__ */ C("div", { className: "ll-minimized__controls", children: [
1265
+ /* @__PURE__ */ k("div", { className: "ll-minimized__controls", children: [
1266
1266
  /* @__PURE__ */ n(
1267
1267
  "button",
1268
1268
  {
@@ -1270,7 +1270,7 @@ const Jr = ({
1270
1270
  className: "ll-minimized__btn",
1271
1271
  onClick: c,
1272
1272
  "aria-label": o ? "Unmute microphone" : "Mute microphone",
1273
- children: /* @__PURE__ */ n(hn, { muted: o, className: "ll-minimized__icon" })
1273
+ children: /* @__PURE__ */ n(gn, { muted: o, className: "ll-minimized__icon" })
1274
1274
  }
1275
1275
  ),
1276
1276
  /* @__PURE__ */ n(
@@ -1280,7 +1280,7 @@ const Jr = ({
1280
1280
  className: "ll-minimized__btn",
1281
1281
  onClick: a,
1282
1282
  "aria-label": `Expand ${r} widget`,
1283
- children: /* @__PURE__ */ n(mn, { className: "ll-minimized__icon" })
1283
+ children: /* @__PURE__ */ n(yn, { className: "ll-minimized__icon" })
1284
1284
  }
1285
1285
  ),
1286
1286
  /* @__PURE__ */ n(
@@ -1290,13 +1290,13 @@ const Jr = ({
1290
1290
  className: "ll-minimized__btn ll-minimized__btn--close",
1291
1291
  onClick: d,
1292
1292
  "aria-label": "Close widget",
1293
- children: /* @__PURE__ */ n(Vr, { className: "ll-minimized__icon" })
1293
+ children: /* @__PURE__ */ n(Xr, { className: "ll-minimized__icon" })
1294
1294
  }
1295
1295
  )
1296
1296
  ] })
1297
1297
  ] })
1298
1298
  }
1299
- ), ei = ({
1299
+ ), ri = ({
1300
1300
  src: e,
1301
1301
  alt: t,
1302
1302
  preCannedPlaying: r = !1,
@@ -1304,7 +1304,7 @@ const Jr = ({
1304
1304
  style: l
1305
1305
  }) => {
1306
1306
  const [o, s] = M(!1), a = I(e);
1307
- if (P(() => {
1307
+ if (T(() => {
1308
1308
  a.current !== e && (a.current = e, s(!1));
1309
1309
  }, [e]), !e) return null;
1310
1310
  const c = {
@@ -1334,13 +1334,13 @@ const Jr = ({
1334
1334
  }
1335
1335
  )
1336
1336
  );
1337
- }, ti = "#E06540";
1338
- function ni({
1337
+ }, ii = "#E06540";
1338
+ function oi({
1339
1339
  size: e = 14,
1340
1340
  className: t,
1341
- fill: r = ti
1341
+ fill: r = ii
1342
1342
  }) {
1343
- return /* @__PURE__ */ C(
1343
+ return /* @__PURE__ */ k(
1344
1344
  "svg",
1345
1345
  {
1346
1346
  xmlns: "http://www.w3.org/2000/svg",
@@ -1376,14 +1376,14 @@ function ni({
1376
1376
  }
1377
1377
  );
1378
1378
  }
1379
- const ri = 8, bn = 8, ii = ({
1379
+ const li = 8, _n = 8, ai = ({
1380
1380
  open: e,
1381
1381
  onClose: t,
1382
1382
  anchorRef: r,
1383
1383
  children: i
1384
1384
  }) => {
1385
1385
  const l = I(null), [o, s] = M(null);
1386
- return In(() => {
1386
+ return Tn(() => {
1387
1387
  if (!e) {
1388
1388
  s(null);
1389
1389
  return;
@@ -1391,27 +1391,27 @@ const ri = 8, bn = 8, ii = ({
1391
1391
  const a = r.current;
1392
1392
  if (!a) return;
1393
1393
  const c = () => {
1394
- const d = a.getBoundingClientRect(), v = {
1395
- top: d.top - ri,
1394
+ const d = a.getBoundingClientRect(), b = {
1395
+ top: d.top - li,
1396
1396
  left: d.left + d.width / 2
1397
- }, p = bn + 90, h = window.innerWidth - bn - 90;
1398
- v.left < p && (v.left = p), v.left > h && (v.left = h), s(v);
1397
+ }, p = _n + 90, h = window.innerWidth - _n - 90;
1398
+ b.left < p && (b.left = p), b.left > h && (b.left = h), s(b);
1399
1399
  };
1400
1400
  return c(), window.addEventListener("scroll", c, !0), window.addEventListener("resize", c), () => {
1401
1401
  window.removeEventListener("scroll", c, !0), window.removeEventListener("resize", c);
1402
1402
  };
1403
- }, [e, r]), P(() => {
1403
+ }, [e, r]), T(() => {
1404
1404
  if (!e) return;
1405
1405
  const a = (d) => {
1406
- const v = d.target, p = l.current, h = r.current;
1407
- p && p.contains(v) || h && h.contains(v) || t();
1406
+ const b = d.target, p = l.current, h = r.current;
1407
+ p && p.contains(b) || h && h.contains(b) || t();
1408
1408
  }, c = (d) => {
1409
1409
  d.key === "Escape" && (d.stopPropagation(), t());
1410
1410
  };
1411
1411
  return document.addEventListener("mousedown", a), document.addEventListener("keydown", c), () => {
1412
1412
  document.removeEventListener("mousedown", a), document.removeEventListener("keydown", c);
1413
1413
  };
1414
- }, [e, t, r]), !e || o === null || typeof document > "u" ? null : qt(
1414
+ }, [e, t, r]), !e || o === null || typeof document > "u" ? null : Vt(
1415
1415
  /* @__PURE__ */ n(
1416
1416
  "div",
1417
1417
  {
@@ -1431,7 +1431,7 @@ const ri = 8, bn = 8, ii = ({
1431
1431
  ),
1432
1432
  document.body
1433
1433
  );
1434
- }, oi = ({
1434
+ }, si = ({
1435
1435
  isMuted: e,
1436
1436
  onToggleMute: t,
1437
1437
  isCameraEnabled: r,
@@ -1442,19 +1442,19 @@ const ri = 8, bn = 8, ii = ({
1442
1442
  allowScreenShare: a,
1443
1443
  isSpeakerMuted: c,
1444
1444
  onToggleSpeaker: d,
1445
- allowTyping: v,
1445
+ allowTyping: b,
1446
1446
  isTypingOpen: p,
1447
1447
  onToggleTyping: h,
1448
- onDisconnect: T
1448
+ onDisconnect: P
1449
1449
  }) => {
1450
- const [_, E] = M(!1), g = I(null);
1451
- return /* @__PURE__ */ C(We, { children: [
1452
- /* @__PURE__ */ C(
1450
+ const [x, E] = M(!1), g = I(null);
1451
+ return /* @__PURE__ */ k(Fe, { children: [
1452
+ /* @__PURE__ */ k(
1453
1453
  "div",
1454
1454
  {
1455
1455
  className: "ll-toolbar ll-toolbar--compact",
1456
1456
  "data-testid": "compact-toolbar",
1457
- onClick: (b) => b.stopPropagation(),
1457
+ onClick: (w) => w.stopPropagation(),
1458
1458
  children: [
1459
1459
  /* @__PURE__ */ n(
1460
1460
  "button",
@@ -1463,7 +1463,7 @@ const ri = 8, bn = 8, ii = ({
1463
1463
  className: `ll-tool ${e ? "is-muted" : ""}`,
1464
1464
  onClick: t,
1465
1465
  "aria-label": e ? "Unmute microphone" : "Mute microphone",
1466
- children: /* @__PURE__ */ n(Hn, { muted: e })
1466
+ children: /* @__PURE__ */ n(Fn, { muted: e })
1467
1467
  }
1468
1468
  ),
1469
1469
  /* @__PURE__ */ n(
@@ -1471,12 +1471,12 @@ const ri = 8, bn = 8, ii = ({
1471
1471
  {
1472
1472
  ref: g,
1473
1473
  type: "button",
1474
- className: `ll-tool ${_ ? "is-on" : ""}`,
1475
- onClick: () => E((b) => !b),
1474
+ className: `ll-tool ${x ? "is-on" : ""}`,
1475
+ onClick: () => E((w) => !w),
1476
1476
  "aria-label": "More controls",
1477
1477
  "aria-haspopup": "menu",
1478
- "aria-expanded": _,
1479
- children: /* @__PURE__ */ n(li, {})
1478
+ "aria-expanded": x,
1479
+ children: /* @__PURE__ */ n(ci, {})
1480
1480
  }
1481
1481
  ),
1482
1482
  /* @__PURE__ */ n(
@@ -1484,22 +1484,22 @@ const ri = 8, bn = 8, ii = ({
1484
1484
  {
1485
1485
  type: "button",
1486
1486
  className: "ll-tool ll-tool--danger",
1487
- onClick: T,
1487
+ onClick: P,
1488
1488
  "aria-label": "End conversation",
1489
- children: /* @__PURE__ */ n(Wn, {})
1489
+ children: /* @__PURE__ */ n(Bn, {})
1490
1490
  }
1491
1491
  )
1492
1492
  ]
1493
1493
  }
1494
1494
  ),
1495
- /* @__PURE__ */ C(
1496
- ii,
1495
+ /* @__PURE__ */ k(
1496
+ ai,
1497
1497
  {
1498
- open: _,
1498
+ open: x,
1499
1499
  onClose: () => E(!1),
1500
1500
  anchorRef: g,
1501
1501
  children: [
1502
- l && /* @__PURE__ */ C(
1502
+ l && /* @__PURE__ */ k(
1503
1503
  "button",
1504
1504
  {
1505
1505
  type: "button",
@@ -1508,12 +1508,12 @@ const ri = 8, bn = 8, ii = ({
1508
1508
  i(), E(!1);
1509
1509
  },
1510
1510
  children: [
1511
- /* @__PURE__ */ n($n, {}),
1511
+ /* @__PURE__ */ n(On, {}),
1512
1512
  /* @__PURE__ */ n("span", { children: r ? "Stop camera" : "Start camera" })
1513
1513
  ]
1514
1514
  }
1515
1515
  ),
1516
- a && /* @__PURE__ */ C(
1516
+ a && /* @__PURE__ */ k(
1517
1517
  "button",
1518
1518
  {
1519
1519
  type: "button",
@@ -1522,12 +1522,12 @@ const ri = 8, bn = 8, ii = ({
1522
1522
  s(), E(!1);
1523
1523
  },
1524
1524
  children: [
1525
- /* @__PURE__ */ n(zn, {}),
1525
+ /* @__PURE__ */ n(Hn, {}),
1526
1526
  /* @__PURE__ */ n("span", { children: o ? "Stop sharing" : "Share screen" })
1527
1527
  ]
1528
1528
  }
1529
1529
  ),
1530
- /* @__PURE__ */ C(
1530
+ /* @__PURE__ */ k(
1531
1531
  "button",
1532
1532
  {
1533
1533
  type: "button",
@@ -1536,12 +1536,12 @@ const ri = 8, bn = 8, ii = ({
1536
1536
  d(), E(!1);
1537
1537
  },
1538
1538
  children: [
1539
- /* @__PURE__ */ n(On, { muted: c }),
1539
+ /* @__PURE__ */ n(Wn, { muted: c }),
1540
1540
  /* @__PURE__ */ n("span", { children: c ? "Unmute speaker" : "Mute speaker" })
1541
1541
  ]
1542
1542
  }
1543
1543
  ),
1544
- v && /* @__PURE__ */ C(
1544
+ b && /* @__PURE__ */ k(
1545
1545
  "button",
1546
1546
  {
1547
1547
  type: "button",
@@ -1550,12 +1550,12 @@ const ri = 8, bn = 8, ii = ({
1550
1550
  h(), E(!1);
1551
1551
  },
1552
1552
  children: [
1553
- /* @__PURE__ */ n(ai, {}),
1553
+ /* @__PURE__ */ n(ui, {}),
1554
1554
  /* @__PURE__ */ n("span", { children: p ? "Hide typing" : "Type a message" })
1555
1555
  ]
1556
1556
  }
1557
1557
  ),
1558
- /* @__PURE__ */ C(
1558
+ /* @__PURE__ */ k(
1559
1559
  "button",
1560
1560
  {
1561
1561
  type: "button",
@@ -1573,8 +1573,8 @@ const ri = 8, bn = 8, ii = ({
1573
1573
  )
1574
1574
  ] });
1575
1575
  };
1576
- function li() {
1577
- return /* @__PURE__ */ C(
1576
+ function ci() {
1577
+ return /* @__PURE__ */ k(
1578
1578
  "svg",
1579
1579
  {
1580
1580
  width: "16",
@@ -1590,7 +1590,7 @@ function li() {
1590
1590
  }
1591
1591
  );
1592
1592
  }
1593
- function ai() {
1593
+ function ui() {
1594
1594
  return /* @__PURE__ */ n(
1595
1595
  "svg",
1596
1596
  {
@@ -1607,7 +1607,7 @@ function ai() {
1607
1607
  }
1608
1608
  );
1609
1609
  }
1610
- const si = ({
1610
+ const di = ({
1611
1611
  position: e,
1612
1612
  isMobile: t,
1613
1613
  agentName: r,
@@ -1618,142 +1618,142 @@ const si = ({
1618
1618
  teamMembers: a,
1619
1619
  currentTeamMemberId: c,
1620
1620
  isSwitchingTeamMember: d,
1621
- teamSwitcherOpen: v,
1621
+ teamSwitcherOpen: b,
1622
1622
  onToggleTeamSwitcher: p,
1623
1623
  onSelectTeamMember: h,
1624
- languageMenuOpen: T,
1625
- onToggleLanguageMenu: _,
1624
+ languageMenuOpen: P,
1625
+ onToggleLanguageMenu: x,
1626
1626
  connectionState: E,
1627
1627
  agentState: g,
1628
- transcript: b,
1628
+ transcript: w,
1629
1629
  canResume: R,
1630
- needsUserGesture: k,
1630
+ needsUserGesture: S,
1631
1631
  error: y,
1632
- isMuted: H,
1632
+ isMuted: O,
1633
1633
  micError: m,
1634
1634
  micDevices: D,
1635
- activeMicId: F,
1635
+ activeMicId: W,
1636
1636
  isCameraEnabled: K,
1637
- cameraPreviewEl: oe,
1638
- cameraDevices: z,
1637
+ cameraPreviewEl: ae,
1638
+ cameraDevices: $,
1639
1639
  activeCameraId: G,
1640
1640
  isScreenShareEnabled: f,
1641
- screenPreviewEl: S,
1642
- isSpeakerMuted: O,
1641
+ screenPreviewEl: N,
1642
+ isSpeakerMuted: z,
1643
1643
  allowCamera: q,
1644
1644
  allowScreenShare: X,
1645
- allowTyping: Q,
1646
- showMinimize: Y = !0,
1645
+ allowTyping: ee,
1646
+ showMinimize: V = !0,
1647
1647
  showClose: te = !0,
1648
- chromeless: ie = !1,
1648
+ chromeless: oe = !1,
1649
1649
  compactControls: U = !1,
1650
- transforming: ge,
1651
- transformingLabel: ee,
1652
- avatarVideoContainerRef: ve,
1650
+ transforming: me,
1651
+ transformingLabel: Q,
1652
+ avatarVideoContainerRef: be,
1653
1653
  agentVideoEl: ne,
1654
- onConnect: rt,
1655
- onDisconnect: it,
1656
- onRetry: mt,
1657
- onResumeAudio: gt,
1658
- onToggleMute: ot,
1659
- onSwitchMicDevice: lt,
1660
- onToggleCamera: Me,
1661
- onSwitchCameraDevice: Fe,
1654
+ onConnect: tt,
1655
+ onDisconnect: nt,
1656
+ onRetry: pt,
1657
+ onResumeAudio: ht,
1658
+ onToggleMute: rt,
1659
+ onSwitchMicDevice: mt,
1660
+ onToggleCamera: We,
1661
+ onSwitchCameraDevice: Be,
1662
1662
  onToggleScreenShare: Ie,
1663
1663
  onToggleSpeaker: Re,
1664
1664
  onSendMessage: Te,
1665
1665
  onMinimize: Pe,
1666
1666
  onClose: De,
1667
- onClearMicError: Be,
1668
- dragHandleProps: W,
1669
- resizeHandleProps: qe
1667
+ onClearMicError: qe,
1668
+ dragHandleProps: ze,
1669
+ resizeHandleProps: F
1670
1670
  }) => {
1671
- var Ke;
1672
- const ze = ((a == null ? void 0 : a.length) ?? 0) > 1, Ue = E === "connecting" || E === "connected", be = E === "connected", at = E === "idle" || E === "disconnected" || E === "error", [$e, je] = M(!1);
1673
- P(() => {
1671
+ var at;
1672
+ const $e = ((a == null ? void 0 : a.length) ?? 0) > 1, Ue = E === "connecting" || E === "connected", we = E === "connected", gt = E === "idle" || E === "disconnected" || E === "error", [He, Ne] = M(!1);
1673
+ T(() => {
1674
1674
  if (!ne) {
1675
- je(!1);
1675
+ Ne(!1);
1676
1676
  return;
1677
1677
  }
1678
1678
  if (!ne.paused && ne.readyState >= 2) {
1679
- je(!0);
1679
+ Ne(!0);
1680
1680
  return;
1681
1681
  }
1682
- je(!1);
1683
- const w = () => je(!0);
1684
- return ne.addEventListener("playing", w), ne.addEventListener("loadeddata", w), () => {
1685
- ne.removeEventListener("playing", w), ne.removeEventListener("loadeddata", w);
1682
+ Ne(!1);
1683
+ const _ = () => Ne(!0);
1684
+ return ne.addEventListener("playing", _), ne.addEventListener("loadeddata", _), () => {
1685
+ ne.removeEventListener("playing", _), ne.removeEventListener("loadeddata", _);
1686
1686
  };
1687
1687
  }, [ne]);
1688
- const [St, Ne] = M(!1);
1689
- P(() => {
1690
- if (!be) {
1691
- Ne(!1);
1688
+ const [Nt, yt] = M(!1);
1689
+ T(() => {
1690
+ if (!we) {
1691
+ yt(!1);
1692
1692
  return;
1693
1693
  }
1694
- if ($e) return;
1695
- const w = setTimeout(() => Ne(!0), 8e3);
1696
- return () => clearTimeout(w);
1697
- }, [be, $e]);
1698
- const fe = E === "connecting" || be && !!i && !$e && !St, st = I(null), ce = I(null);
1699
- P(() => {
1700
- const w = st.current;
1701
- w && (w.innerHTML = "", oe && (oe.style.width = "100%", oe.style.height = "100%", oe.style.objectFit = "cover", oe.style.transform = "scaleX(-1)", w.appendChild(oe)));
1702
- }, [oe]), P(() => {
1703
- const w = ce.current;
1704
- w && (w.innerHTML = "", S && (S.style.width = "100%", S.style.height = "100%", S.style.objectFit = "contain", w.appendChild(S)));
1705
- }, [S]);
1706
- const [pe, Ve] = M(!1), [Ye, he] = M(!1), we = I(null), yt = I(null);
1707
- P(() => {
1708
- if (!pe && !Ye && !T && !v) return;
1709
- const w = () => {
1710
- Ve(!1), he(!1), T && _(), v && p();
1694
+ if (He) return;
1695
+ const _ = setTimeout(() => yt(!0), 8e3);
1696
+ return () => clearTimeout(_);
1697
+ }, [we, He]);
1698
+ const Oe = E === "connecting" || we && !!i && !He && !Nt, ue = I(null), it = I(null);
1699
+ T(() => {
1700
+ const _ = ue.current;
1701
+ _ && (_.innerHTML = "", ae && (ae.style.width = "100%", ae.style.height = "100%", ae.style.objectFit = "cover", ae.style.transform = "scaleX(-1)", _.appendChild(ae)));
1702
+ }, [ae]), T(() => {
1703
+ const _ = it.current;
1704
+ _ && (_.innerHTML = "", N && (N.style.width = "100%", N.style.height = "100%", N.style.objectFit = "contain", _.appendChild(N)));
1705
+ }, [N]);
1706
+ const [le, pe] = M(!1), [je, Ve] = M(!1), ge = I(null), _e = I(null);
1707
+ T(() => {
1708
+ if (!le && !je && !P && !b) return;
1709
+ const _ = () => {
1710
+ pe(!1), Ve(!1), P && x(), b && p();
1711
1711
  };
1712
- return document.addEventListener("click", w), () => document.removeEventListener("click", w);
1712
+ return document.addEventListener("click", _), () => document.removeEventListener("click", _);
1713
1713
  }, [
1714
- pe,
1715
- Ye,
1716
- T,
1717
- v,
1718
- _,
1714
+ le,
1715
+ je,
1716
+ P,
1717
+ b,
1718
+ x,
1719
1719
  p
1720
1720
  ]);
1721
- const [vt, Nt] = M(!1), jt = L(() => Nt((w) => !w), []), [ct, Ee] = M(""), He = L(
1722
- (w) => {
1723
- w.preventDefault();
1724
- const le = ct.trim();
1725
- le && (Te(le), Ee(""));
1721
+ const [vt, At] = M(!1), Mt = C(() => At((_) => !_), []), [ot, It] = M(""), Ae = C(
1722
+ (_) => {
1723
+ _.preventDefault();
1724
+ const re = ot.trim();
1725
+ re && (Te(re), It(""));
1726
1726
  },
1727
- [ct, Te]
1728
- ), _e = s.productName || "Live Layer", Oe = !s.productName;
1729
- let xe = null, Ae = null;
1730
- for (let w = b.length - 1; w >= 0; w--) {
1731
- const le = b[w];
1732
- if (!xe && le.role === "agent" ? xe = le : !Ae && le.role === "user" && (Ae = le), xe && Ae) break;
1727
+ [ot, Te]
1728
+ ), Me = s.productName || "Live Layer", Se = !s.productName;
1729
+ let ye = null, xe = null;
1730
+ for (let _ = w.length - 1; _ >= 0; _--) {
1731
+ const re = w[_];
1732
+ if (!ye && re.role === "agent" ? ye = re : !xe && re.role === "user" && (xe = re), ye && xe) break;
1733
1733
  }
1734
- const Ge = be ? (xe == null ? void 0 : xe.text) || null : o || null, Xe = be && (Ae == null ? void 0 : Ae.text) || null, bt = [
1734
+ const bt = we ? (ye == null ? void 0 : ye.text) || null : o || null, Ye = we && (xe == null ? void 0 : xe.text) || null, lt = [
1735
1735
  "ll-expanded",
1736
1736
  t ? "ll-expanded--mobile" : "ll-expanded--desktop"
1737
1737
  ].join(" ");
1738
- return /* @__PURE__ */ C(
1738
+ return /* @__PURE__ */ k(
1739
1739
  "div",
1740
1740
  {
1741
- className: bt,
1741
+ className: lt,
1742
1742
  "data-position": e,
1743
- "data-state": be ? "connected" : Ue ? "connecting" : "idle",
1743
+ "data-state": we ? "connected" : Ue ? "connecting" : "idle",
1744
1744
  role: "dialog",
1745
1745
  "aria-label": `${r} widget`,
1746
1746
  children: [
1747
- /* @__PURE__ */ C("div", { className: "ll-expanded__bg", children: [
1747
+ /* @__PURE__ */ k("div", { className: "ll-expanded__bg", children: [
1748
1748
  i ? /* @__PURE__ */ n(
1749
- ei,
1749
+ ri,
1750
1750
  {
1751
1751
  src: i,
1752
1752
  alt: r,
1753
1753
  className: "ll-expanded__bg-img"
1754
1754
  }
1755
- ) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Ke = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Ke.toUpperCase()) || "A" }) }),
1756
- l && !be && /* @__PURE__ */ n(
1755
+ ) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((at = r == null ? void 0 : r.charAt(0)) == null ? void 0 : at.toUpperCase()) || "A" }) }),
1756
+ l && !we && /* @__PURE__ */ n(
1757
1757
  "video",
1758
1758
  {
1759
1759
  className: "ll-expanded__bg-idle",
@@ -1765,112 +1765,112 @@ const si = ({
1765
1765
  }
1766
1766
  )
1767
1767
  ] }),
1768
- /* @__PURE__ */ n("div", { ref: ve, className: "ll-expanded__video" }),
1769
- fe && /* @__PURE__ */ C("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1768
+ /* @__PURE__ */ n("div", { ref: be, className: "ll-expanded__video" }),
1769
+ Oe && /* @__PURE__ */ k("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1770
1770
  /* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
1771
1771
  /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: d ? "Switching..." : "Connecting..." })
1772
1772
  ] }),
1773
- k && be && /* @__PURE__ */ C(
1773
+ S && we && /* @__PURE__ */ k(
1774
1774
  "button",
1775
1775
  {
1776
1776
  type: "button",
1777
1777
  className: "ll-expanded__overlay ll-expanded__overlay--gesture",
1778
- onClick: gt,
1778
+ onClick: ht,
1779
1779
  children: [
1780
1780
  /* @__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" }) }),
1781
1781
  /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
1782
1782
  ]
1783
1783
  }
1784
1784
  ),
1785
- ge && /* @__PURE__ */ C(
1785
+ me && /* @__PURE__ */ k(
1786
1786
  "div",
1787
1787
  {
1788
1788
  className: "ll-expanded__overlay ll-expanded__overlay--transforming",
1789
1789
  role: "status",
1790
1790
  "aria-live": "polite",
1791
- "aria-label": ee,
1791
+ "aria-label": Q,
1792
1792
  children: [
1793
1793
  /* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
1794
- /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: ee })
1794
+ /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: Q })
1795
1795
  ]
1796
1796
  }
1797
1797
  ),
1798
- Ue ? /* @__PURE__ */ C(We, { children: [
1799
- !U && /* @__PURE__ */ C("div", { className: "ll-expanded__topbar", ...W, children: [
1800
- !ie && /* @__PURE__ */ C("div", { className: "ll-expanded__topbar-left", children: [
1801
- /* @__PURE__ */ C("div", { className: "ll-expanded__pill-wrap", children: [
1802
- /* @__PURE__ */ C(
1798
+ Ue ? /* @__PURE__ */ k(Fe, { children: [
1799
+ !U && /* @__PURE__ */ k("div", { className: "ll-expanded__topbar", ...ze, children: [
1800
+ !oe && /* @__PURE__ */ k("div", { className: "ll-expanded__topbar-left", children: [
1801
+ /* @__PURE__ */ k("div", { className: "ll-expanded__pill-wrap", children: [
1802
+ /* @__PURE__ */ k(
1803
1803
  "button",
1804
1804
  {
1805
1805
  type: "button",
1806
1806
  className: "ll-hpill",
1807
- onClick: (w) => {
1808
- ze && (w.stopPropagation(), p());
1807
+ onClick: (_) => {
1808
+ $e && (_.stopPropagation(), p());
1809
1809
  },
1810
- "aria-haspopup": ze ? "listbox" : void 0,
1811
- "aria-expanded": ze ? v : void 0,
1810
+ "aria-haspopup": $e ? "listbox" : void 0,
1811
+ "aria-expanded": $e ? b : void 0,
1812
1812
  children: [
1813
1813
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
1814
- ze && /* @__PURE__ */ n(Ct, {})
1814
+ $e && /* @__PURE__ */ n(kt, {})
1815
1815
  ]
1816
1816
  }
1817
1817
  ),
1818
- ze && v && /* @__PURE__ */ n(
1818
+ $e && b && /* @__PURE__ */ n(
1819
1819
  "div",
1820
1820
  {
1821
1821
  className: "ll-hmenu",
1822
- onClick: (w) => w.stopPropagation(),
1822
+ onClick: (_) => _.stopPropagation(),
1823
1823
  role: "listbox",
1824
- children: a == null ? void 0 : a.map((w) => /* @__PURE__ */ C(
1824
+ children: a == null ? void 0 : a.map((_) => /* @__PURE__ */ k(
1825
1825
  "button",
1826
1826
  {
1827
1827
  type: "button",
1828
- className: `ll-hmenu__item ${w.id === c ? "is-active" : ""}`,
1829
- onClick: () => h(w.id),
1828
+ className: `ll-hmenu__item ${_.id === c ? "is-active" : ""}`,
1829
+ onClick: () => h(_.id),
1830
1830
  role: "option",
1831
- "aria-selected": w.id === c,
1831
+ "aria-selected": _.id === c,
1832
1832
  children: [
1833
- w.avatarImageUrl && /* @__PURE__ */ n(
1833
+ _.avatarImageUrl && /* @__PURE__ */ n(
1834
1834
  "img",
1835
1835
  {
1836
- src: w.avatarImageUrl,
1836
+ src: _.avatarImageUrl,
1837
1837
  alt: "",
1838
1838
  className: "ll-hmenu__avatar"
1839
1839
  }
1840
1840
  ),
1841
- /* @__PURE__ */ n("span", { className: "ll-hmenu__name", children: w.name }),
1842
- w.role && /* @__PURE__ */ n("span", { className: "ll-hmenu__role", children: w.role })
1841
+ /* @__PURE__ */ n("span", { className: "ll-hmenu__name", children: _.name }),
1842
+ _.role && /* @__PURE__ */ n("span", { className: "ll-hmenu__role", children: _.role })
1843
1843
  ]
1844
1844
  },
1845
- w.id
1845
+ _.id
1846
1846
  ))
1847
1847
  }
1848
1848
  )
1849
1849
  ] }),
1850
- /* @__PURE__ */ C("div", { className: "ll-expanded__pill-wrap", children: [
1851
- /* @__PURE__ */ C(
1850
+ /* @__PURE__ */ k("div", { className: "ll-expanded__pill-wrap", children: [
1851
+ /* @__PURE__ */ k(
1852
1852
  "button",
1853
1853
  {
1854
1854
  type: "button",
1855
1855
  className: "ll-hpill ll-hpill--compact",
1856
- onClick: (w) => {
1857
- w.stopPropagation(), _();
1856
+ onClick: (_) => {
1857
+ _.stopPropagation(), x();
1858
1858
  },
1859
1859
  "aria-haspopup": "listbox",
1860
- "aria-expanded": T,
1860
+ "aria-expanded": P,
1861
1861
  "aria-label": "Language: English",
1862
1862
  title: "Language: English",
1863
1863
  children: [
1864
1864
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: "EN" }),
1865
- /* @__PURE__ */ n(Ct, {})
1865
+ /* @__PURE__ */ n(kt, {})
1866
1866
  ]
1867
1867
  }
1868
1868
  ),
1869
- T && /* @__PURE__ */ n(
1869
+ P && /* @__PURE__ */ n(
1870
1870
  "div",
1871
1871
  {
1872
1872
  className: "ll-hmenu",
1873
- onClick: (w) => w.stopPropagation(),
1873
+ onClick: (_) => _.stopPropagation(),
1874
1874
  role: "listbox",
1875
1875
  children: /* @__PURE__ */ n(
1876
1876
  "button",
@@ -1893,8 +1893,8 @@ const si = ({
1893
1893
  }
1894
1894
  )
1895
1895
  ] }),
1896
- /* @__PURE__ */ C("div", { className: "ll-expanded__header-actions", children: [
1897
- Y !== !1 && /* @__PURE__ */ n(
1896
+ /* @__PURE__ */ k("div", { className: "ll-expanded__header-actions", children: [
1897
+ V !== !1 && /* @__PURE__ */ n(
1898
1898
  "button",
1899
1899
  {
1900
1900
  type: "button",
@@ -1902,7 +1902,7 @@ const si = ({
1902
1902
  onClick: Pe,
1903
1903
  "aria-label": "Minimize widget",
1904
1904
  title: "Minimize",
1905
- children: /* @__PURE__ */ n(_n, {})
1905
+ children: /* @__PURE__ */ n(Ln, {})
1906
1906
  }
1907
1907
  ),
1908
1908
  te !== !1 && /* @__PURE__ */ n(
@@ -1913,12 +1913,12 @@ const si = ({
1913
1913
  onClick: De,
1914
1914
  "aria-label": "End call",
1915
1915
  title: "End call",
1916
- children: /* @__PURE__ */ n(wn, {})
1916
+ children: /* @__PURE__ */ n(xn, {})
1917
1917
  }
1918
1918
  )
1919
1919
  ] })
1920
1920
  ] }),
1921
- U && /* @__PURE__ */ C("div", { className: "ll-compact-status", "data-state": g, children: [
1921
+ U && /* @__PURE__ */ k("div", { className: "ll-compact-status", "data-state": g, children: [
1922
1922
  /* @__PURE__ */ n("span", { className: "ll-compact-status__dot", "aria-hidden": !0 }),
1923
1923
  /* @__PURE__ */ n("span", { className: "ll-compact-status__label", children: g })
1924
1924
  ] })
@@ -1931,8 +1931,8 @@ const si = ({
1931
1931
  // can always dismiss; making the whole header disappear (the
1932
1932
  // pre-0.18.0 behavior) left users no way out short of scrolling
1933
1933
  // the page itself.
1934
- /* @__PURE__ */ C("div", { className: "ll-expanded__header ll-expanded__header--idle", ...W, children: [
1935
- !U && (Oe ? /* @__PURE__ */ C(
1934
+ /* @__PURE__ */ k("div", { className: "ll-expanded__header ll-expanded__header--idle", ...ze, children: [
1935
+ !U && (Se ? /* @__PURE__ */ k(
1936
1936
  "a",
1937
1937
  {
1938
1938
  className: "ll-expanded__brand ll-expanded__brand--link",
@@ -1942,20 +1942,20 @@ const si = ({
1942
1942
  "aria-label": "Powered by LiveLayer — opens livelayer.studio in a new tab",
1943
1943
  title: "Powered by LiveLayer — visit livelayer.studio",
1944
1944
  children: [
1945
- /* @__PURE__ */ n(ni, { size: 14, className: "ll-expanded__brand-mark" }),
1946
- /* @__PURE__ */ n("span", { children: _e })
1945
+ /* @__PURE__ */ n(oi, { size: 14, className: "ll-expanded__brand-mark" }),
1946
+ /* @__PURE__ */ n("span", { children: Me })
1947
1947
  ]
1948
1948
  }
1949
- ) : /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: _e })),
1950
- /* @__PURE__ */ C("div", { className: "ll-expanded__header-actions", children: [
1951
- !U && Y !== !1 && /* @__PURE__ */ n(
1949
+ ) : /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Me })),
1950
+ /* @__PURE__ */ k("div", { className: "ll-expanded__header-actions", children: [
1951
+ !U && V !== !1 && /* @__PURE__ */ n(
1952
1952
  "button",
1953
1953
  {
1954
1954
  type: "button",
1955
1955
  className: "ll-hbtn ll-hbtn--ghost",
1956
1956
  onClick: Pe,
1957
1957
  "aria-label": "Minimize widget",
1958
- children: /* @__PURE__ */ n(_n, {})
1958
+ children: /* @__PURE__ */ n(Ln, {})
1959
1959
  }
1960
1960
  ),
1961
1961
  te !== !1 && /* @__PURE__ */ n(
@@ -1965,44 +1965,44 @@ const si = ({
1965
1965
  className: "ll-hbtn ll-hbtn--danger",
1966
1966
  onClick: De,
1967
1967
  "aria-label": "Close widget",
1968
- children: /* @__PURE__ */ n(wn, {})
1968
+ children: /* @__PURE__ */ n(xn, {})
1969
1969
  }
1970
1970
  )
1971
1971
  ] })
1972
1972
  ] })
1973
1973
  ),
1974
- at && /* @__PURE__ */ (() => {
1975
- const w = R ? "Resume session" : E === "disconnected" ? "Reconnect to agent" : "Start video call";
1976
- return /* @__PURE__ */ C(We, { children: [
1977
- !y && /* @__PURE__ */ C(
1974
+ gt && /* @__PURE__ */ (() => {
1975
+ const _ = R ? "Resume session" : E === "disconnected" ? "Reconnect to agent" : "Start video call";
1976
+ return /* @__PURE__ */ k(Fe, { children: [
1977
+ !y && /* @__PURE__ */ k(
1978
1978
  "button",
1979
1979
  {
1980
1980
  type: "button",
1981
1981
  className: "ll-expanded__play",
1982
- onClick: rt,
1983
- "aria-label": w,
1982
+ onClick: tt,
1983
+ "aria-label": _,
1984
1984
  children: [
1985
1985
  /* @__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" }) }) }),
1986
- U && /* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children: w })
1986
+ U && /* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children: _ })
1987
1987
  ]
1988
1988
  }
1989
1989
  ),
1990
- !U && /* @__PURE__ */ C("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
1990
+ !U && /* @__PURE__ */ k("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
1991
1991
  o && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: o }) }),
1992
1992
  /* @__PURE__ */ n(
1993
1993
  "button",
1994
1994
  {
1995
1995
  type: "button",
1996
1996
  className: "ll-expanded__cta",
1997
- onClick: rt,
1998
- "aria-label": w,
1999
- children: w
1997
+ onClick: tt,
1998
+ "aria-label": _,
1999
+ children: _
2000
2000
  }
2001
2001
  )
2002
2002
  ] })
2003
2003
  ] });
2004
2004
  })(),
2005
- /* @__PURE__ */ C(
2005
+ /* @__PURE__ */ k(
2006
2006
  "div",
2007
2007
  {
2008
2008
  className: `ll-expanded__pip ${Ue && (K || f) ? "is-visible" : ""}`,
@@ -2010,38 +2010,38 @@ const si = ({
2010
2010
  /* @__PURE__ */ n(
2011
2011
  "div",
2012
2012
  {
2013
- ref: ce,
2013
+ ref: it,
2014
2014
  className: f ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
2015
2015
  }
2016
2016
  ),
2017
2017
  /* @__PURE__ */ n(
2018
2018
  "div",
2019
2019
  {
2020
- ref: st,
2020
+ ref: ue,
2021
2021
  className: !f && K ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
2022
2022
  }
2023
2023
  )
2024
2024
  ]
2025
2025
  }
2026
2026
  ),
2027
- Ue ? /* @__PURE__ */ C("div", { className: "ll-expanded__bottom", children: [
2028
- !U && Ge && /* @__PURE__ */ n(
2027
+ Ue ? /* @__PURE__ */ k("div", { className: "ll-expanded__bottom", children: [
2028
+ !U && bt && /* @__PURE__ */ n(
2029
2029
  "div",
2030
2030
  {
2031
2031
  className: "ll-expanded__transcript ll-expanded__transcript--agent",
2032
2032
  "data-role": "agent",
2033
- children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Ge })
2033
+ children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: bt })
2034
2034
  }
2035
2035
  ),
2036
- !U && Xe && /* @__PURE__ */ n(
2036
+ !U && Ye && /* @__PURE__ */ n(
2037
2037
  "div",
2038
2038
  {
2039
2039
  className: "ll-expanded__transcript ll-expanded__transcript--user",
2040
2040
  "data-role": "user",
2041
- children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Xe })
2041
+ children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Ye })
2042
2042
  }
2043
2043
  ),
2044
- !ie && !U && /* @__PURE__ */ C("div", { className: "ll-toolbar", onClick: (w) => w.stopPropagation(), children: [
2044
+ !oe && !U && /* @__PURE__ */ k("div", { className: "ll-toolbar", onClick: (_) => _.stopPropagation(), children: [
2045
2045
  X && /* @__PURE__ */ n(
2046
2046
  "button",
2047
2047
  {
@@ -2050,85 +2050,85 @@ const si = ({
2050
2050
  onClick: Ie,
2051
2051
  "aria-label": f ? "Stop sharing screen" : "Share screen",
2052
2052
  title: f ? "Stop sharing" : "Share screen",
2053
- children: /* @__PURE__ */ n(zn, {})
2053
+ children: /* @__PURE__ */ n(Hn, {})
2054
2054
  }
2055
2055
  ),
2056
- q && /* @__PURE__ */ C("div", { className: "ll-tool-split", children: [
2056
+ q && /* @__PURE__ */ k("div", { className: "ll-tool-split", children: [
2057
2057
  /* @__PURE__ */ n(
2058
2058
  "button",
2059
2059
  {
2060
2060
  type: "button",
2061
2061
  className: `ll-tool ll-tool--left ${K ? "is-on" : ""}`,
2062
- onClick: Me,
2062
+ onClick: We,
2063
2063
  "aria-label": K ? "Turn off camera" : "Turn on camera",
2064
2064
  title: K ? "Stop camera" : "Start camera",
2065
- children: /* @__PURE__ */ n($n, {})
2065
+ children: /* @__PURE__ */ n(On, {})
2066
2066
  }
2067
2067
  ),
2068
2068
  /* @__PURE__ */ n(
2069
2069
  "button",
2070
2070
  {
2071
- ref: yt,
2071
+ ref: _e,
2072
2072
  type: "button",
2073
2073
  className: `ll-tool ll-tool--right ${K ? "is-on" : ""}`,
2074
- onClick: (w) => {
2075
- w.stopPropagation(), he((le) => !le), Ve(!1);
2074
+ onClick: (_) => {
2075
+ _.stopPropagation(), Ve((re) => !re), pe(!1);
2076
2076
  },
2077
2077
  "aria-label": "Camera devices",
2078
2078
  "aria-haspopup": "listbox",
2079
- "aria-expanded": Ye,
2080
- children: /* @__PURE__ */ n(Ct, {})
2079
+ "aria-expanded": je,
2080
+ children: /* @__PURE__ */ n(kt, {})
2081
2081
  }
2082
2082
  ),
2083
- Ye && z.length > 0 && /* @__PURE__ */ n(
2084
- xn,
2083
+ je && $.length > 0 && /* @__PURE__ */ n(
2084
+ Cn,
2085
2085
  {
2086
2086
  label: "Camera",
2087
- devices: z,
2087
+ devices: $,
2088
2088
  activeId: G,
2089
- anchorRef: yt,
2090
- onPick: (w) => {
2091
- he(!1), Fe(w);
2089
+ anchorRef: _e,
2090
+ onPick: (_) => {
2091
+ Ve(!1), Be(_);
2092
2092
  }
2093
2093
  }
2094
2094
  )
2095
2095
  ] }),
2096
- /* @__PURE__ */ C("div", { className: "ll-tool-split", children: [
2096
+ /* @__PURE__ */ k("div", { className: "ll-tool-split", children: [
2097
2097
  /* @__PURE__ */ n(
2098
2098
  "button",
2099
2099
  {
2100
2100
  type: "button",
2101
- className: `ll-tool ll-tool--left ${H ? "is-muted" : ""}`,
2102
- onClick: ot,
2103
- "aria-label": H ? "Unmute microphone" : "Mute microphone",
2104
- title: H ? "Unmute" : "Mute",
2105
- children: /* @__PURE__ */ n(Hn, { muted: H })
2101
+ className: `ll-tool ll-tool--left ${O ? "is-muted" : ""}`,
2102
+ onClick: rt,
2103
+ "aria-label": O ? "Unmute microphone" : "Mute microphone",
2104
+ title: O ? "Unmute" : "Mute",
2105
+ children: /* @__PURE__ */ n(Fn, { muted: O })
2106
2106
  }
2107
2107
  ),
2108
2108
  /* @__PURE__ */ n(
2109
2109
  "button",
2110
2110
  {
2111
- ref: we,
2111
+ ref: ge,
2112
2112
  type: "button",
2113
- className: `ll-tool ll-tool--right ${H ? "is-muted" : ""}`,
2114
- onClick: (w) => {
2115
- w.stopPropagation(), Ve((le) => !le), he(!1);
2113
+ className: `ll-tool ll-tool--right ${O ? "is-muted" : ""}`,
2114
+ onClick: (_) => {
2115
+ _.stopPropagation(), pe((re) => !re), Ve(!1);
2116
2116
  },
2117
2117
  "aria-label": "Microphone devices",
2118
2118
  "aria-haspopup": "listbox",
2119
- "aria-expanded": pe,
2120
- children: /* @__PURE__ */ n(Ct, {})
2119
+ "aria-expanded": le,
2120
+ children: /* @__PURE__ */ n(kt, {})
2121
2121
  }
2122
2122
  ),
2123
- pe && D.length > 0 && /* @__PURE__ */ n(
2124
- xn,
2123
+ le && D.length > 0 && /* @__PURE__ */ n(
2124
+ Cn,
2125
2125
  {
2126
2126
  label: "Microphone",
2127
2127
  devices: D,
2128
- activeId: F,
2129
- anchorRef: we,
2130
- onPick: (w) => {
2131
- Ve(!1), lt(w);
2128
+ activeId: W,
2129
+ anchorRef: ge,
2130
+ onPick: (_) => {
2131
+ pe(!1), mt(_);
2132
2132
  }
2133
2133
  }
2134
2134
  )
@@ -2137,11 +2137,11 @@ const si = ({
2137
2137
  "button",
2138
2138
  {
2139
2139
  type: "button",
2140
- className: `ll-tool ${O ? "is-muted" : ""}`,
2140
+ className: `ll-tool ${z ? "is-muted" : ""}`,
2141
2141
  onClick: Re,
2142
- "aria-label": O ? "Unmute speaker" : "Mute speaker",
2143
- title: O ? "Unmute speaker" : "Mute speaker",
2144
- children: /* @__PURE__ */ n(On, { muted: O })
2142
+ "aria-label": z ? "Unmute speaker" : "Mute speaker",
2143
+ title: z ? "Unmute speaker" : "Mute speaker",
2144
+ children: /* @__PURE__ */ n(Wn, { muted: z })
2145
2145
  }
2146
2146
  ),
2147
2147
  /* @__PURE__ */ n(
@@ -2149,92 +2149,92 @@ const si = ({
2149
2149
  {
2150
2150
  type: "button",
2151
2151
  className: "ll-tool ll-tool--danger",
2152
- onClick: it,
2152
+ onClick: nt,
2153
2153
  "aria-label": "End conversation",
2154
2154
  title: "End conversation",
2155
- children: /* @__PURE__ */ n(Wn, {})
2155
+ children: /* @__PURE__ */ n(Bn, {})
2156
2156
  }
2157
2157
  )
2158
2158
  ] }),
2159
- !ie && U && /* @__PURE__ */ n(
2160
- oi,
2159
+ !oe && U && /* @__PURE__ */ n(
2160
+ si,
2161
2161
  {
2162
- isMuted: H,
2163
- onToggleMute: ot,
2162
+ isMuted: O,
2163
+ onToggleMute: rt,
2164
2164
  isCameraEnabled: K,
2165
- onToggleCamera: Me,
2165
+ onToggleCamera: We,
2166
2166
  allowCamera: q,
2167
2167
  isScreenShareEnabled: f,
2168
2168
  onToggleScreenShare: Ie,
2169
2169
  allowScreenShare: X,
2170
- isSpeakerMuted: O,
2170
+ isSpeakerMuted: z,
2171
2171
  onToggleSpeaker: Re,
2172
- allowTyping: Q,
2172
+ allowTyping: ee,
2173
2173
  isTypingOpen: vt,
2174
- onToggleTyping: jt,
2175
- onDisconnect: it
2174
+ onToggleTyping: Mt,
2175
+ onDisconnect: nt
2176
2176
  }
2177
2177
  ),
2178
- !ie && Q && (U ? vt : !0) && /* @__PURE__ */ C("form", { className: "ll-message-input", onSubmit: He, children: [
2178
+ !oe && ee && (U ? vt : !0) && /* @__PURE__ */ k("form", { className: "ll-message-input", onSubmit: Ae, children: [
2179
2179
  /* @__PURE__ */ n(
2180
2180
  "input",
2181
2181
  {
2182
2182
  type: "text",
2183
2183
  className: "ll-message-input__field",
2184
2184
  placeholder: "Message...",
2185
- value: ct,
2186
- onChange: (w) => Ee(w.target.value),
2185
+ value: ot,
2186
+ onChange: (_) => It(_.target.value),
2187
2187
  "aria-label": "Message the agent"
2188
2188
  }
2189
2189
  ),
2190
- ct.trim() && /* @__PURE__ */ n(
2190
+ ot.trim() && /* @__PURE__ */ n(
2191
2191
  "button",
2192
2192
  {
2193
2193
  type: "submit",
2194
2194
  className: "ll-message-input__send",
2195
2195
  "aria-label": "Send message",
2196
- children: /* @__PURE__ */ n(ci, {})
2196
+ children: /* @__PURE__ */ n(fi, {})
2197
2197
  }
2198
2198
  )
2199
2199
  ] })
2200
2200
  ] }) : null,
2201
2201
  (() => {
2202
2202
  if (m && E !== "error")
2203
- return /* @__PURE__ */ C("div", { className: "ll-expanded__banner", role: "alert", children: [
2203
+ return /* @__PURE__ */ k("div", { className: "ll-expanded__banner", role: "alert", children: [
2204
2204
  /* @__PURE__ */ n("span", { children: m }),
2205
2205
  /* @__PURE__ */ n(
2206
2206
  "button",
2207
2207
  {
2208
2208
  type: "button",
2209
2209
  className: "ll-expanded__banner-x",
2210
- onClick: Be,
2210
+ onClick: qe,
2211
2211
  "aria-label": "Dismiss",
2212
2212
  children: "×"
2213
2213
  }
2214
2214
  )
2215
2215
  ] });
2216
2216
  if (!y || E !== "error") return null;
2217
- let w = "Failed to connect", le = "Try again";
2218
- return y === "MIC_PERMISSION_DENIED" ? w = "Microphone blocked. Allow access to talk." : y === "MIC_NOT_FOUND" ? w = "No microphone found. Plug one in + retry." : y === "MIC_UNAVAILABLE" ? w = "Mic unavailable. Check other apps using it." : y === "AGENT_TIMEOUT" ? w = "Agent didn't pick up. Try again." : y === "CONNECT_FAILED" ? w = "Connection failed. Check your network." : y.length < 80 && (w = y), /* @__PURE__ */ C("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
2219
- /* @__PURE__ */ n("span", { children: w }),
2217
+ let _ = "Failed to connect", re = "Try again";
2218
+ return y === "MIC_PERMISSION_DENIED" ? _ = "Microphone blocked. Allow access to talk." : y === "MIC_NOT_FOUND" ? _ = "No microphone found. Plug one in + retry." : y === "MIC_UNAVAILABLE" ? _ = "Mic unavailable. Check other apps using it." : y === "AGENT_TIMEOUT" ? _ = "Agent didn't pick up. Try again." : y === "CONNECT_FAILED" ? _ = "Connection failed. Check your network." : y.length < 80 && (_ = y), /* @__PURE__ */ k("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
2219
+ /* @__PURE__ */ n("span", { children: _ }),
2220
2220
  /* @__PURE__ */ n(
2221
2221
  "button",
2222
2222
  {
2223
2223
  type: "button",
2224
2224
  className: "ll-expanded__banner-retry",
2225
- onClick: mt,
2226
- children: le
2225
+ onClick: pt,
2226
+ children: re
2227
2227
  }
2228
2228
  )
2229
2229
  ] });
2230
2230
  })(),
2231
- (qe == null ? void 0 : qe["data-ll-resize-handle"]) !== void 0 && /* @__PURE__ */ n(
2231
+ (F == null ? void 0 : F["data-ll-resize-handle"]) !== void 0 && /* @__PURE__ */ n(
2232
2232
  "div",
2233
2233
  {
2234
2234
  className: "ll-expanded__resize-grip",
2235
- ...qe,
2235
+ ...F,
2236
2236
  "aria-hidden": !0,
2237
- children: /* @__PURE__ */ C("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
2237
+ children: /* @__PURE__ */ k("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
2238
2238
  /* @__PURE__ */ n("line", { x1: "11", y1: "4", x2: "4", y2: "11" }),
2239
2239
  /* @__PURE__ */ n("line", { x1: "11", y1: "8", x2: "8", y2: "11" })
2240
2240
  ] })
@@ -2244,55 +2244,55 @@ const si = ({
2244
2244
  }
2245
2245
  );
2246
2246
  };
2247
- function Ct() {
2247
+ function kt() {
2248
2248
  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" }) });
2249
2249
  }
2250
- function wn() {
2251
- return /* @__PURE__ */ C("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
2250
+ function xn() {
2251
+ return /* @__PURE__ */ k("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
2252
2252
  /* @__PURE__ */ n("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
2253
2253
  /* @__PURE__ */ n("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
2254
2254
  ] });
2255
2255
  }
2256
- function _n() {
2256
+ function Ln() {
2257
2257
  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" }) });
2258
2258
  }
2259
- function zn() {
2260
- return /* @__PURE__ */ C("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: [
2259
+ function Hn() {
2260
+ return /* @__PURE__ */ k("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: [
2261
2261
  /* @__PURE__ */ n("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
2262
2262
  /* @__PURE__ */ n("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
2263
2263
  /* @__PURE__ */ n("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
2264
2264
  ] });
2265
2265
  }
2266
- function $n() {
2267
- return /* @__PURE__ */ C("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: [
2266
+ function On() {
2267
+ return /* @__PURE__ */ k("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: [
2268
2268
  /* @__PURE__ */ n("path", { d: "M23 7l-7 5 7 5V7z" }),
2269
2269
  /* @__PURE__ */ n("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
2270
2270
  ] });
2271
2271
  }
2272
- function Hn({ muted: e }) {
2273
- return /* @__PURE__ */ C("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: [
2272
+ function Fn({ muted: e }) {
2273
+ return /* @__PURE__ */ k("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: [
2274
2274
  /* @__PURE__ */ n("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
2275
2275
  /* @__PURE__ */ n("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
2276
2276
  /* @__PURE__ */ n("line", { x1: "12", y1: "19", x2: "12", y2: "23" }),
2277
2277
  e && /* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
2278
2278
  ] });
2279
2279
  }
2280
- function On({ muted: e }) {
2281
- return /* @__PURE__ */ C("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: [
2280
+ function Wn({ muted: e }) {
2281
+ return /* @__PURE__ */ k("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: [
2282
2282
  /* @__PURE__ */ n("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
2283
- e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ C(We, { children: [
2283
+ e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ k(Fe, { children: [
2284
2284
  /* @__PURE__ */ n("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
2285
2285
  /* @__PURE__ */ n("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
2286
2286
  ] })
2287
2287
  ] });
2288
2288
  }
2289
- function ci() {
2290
- return /* @__PURE__ */ C("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
2289
+ function fi() {
2290
+ return /* @__PURE__ */ k("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
2291
2291
  /* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
2292
2292
  /* @__PURE__ */ n("polyline", { points: "12 5 19 12 12 19" })
2293
2293
  ] });
2294
2294
  }
2295
- function Wn() {
2295
+ function Bn() {
2296
2296
  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(
2297
2297
  "path",
2298
2298
  {
@@ -2301,7 +2301,7 @@ function Wn() {
2301
2301
  }
2302
2302
  ) });
2303
2303
  }
2304
- const xn = ({
2304
+ const Cn = ({
2305
2305
  label: e,
2306
2306
  devices: t,
2307
2307
  activeId: r,
@@ -2309,21 +2309,21 @@ const xn = ({
2309
2309
  anchorRef: l
2310
2310
  }) => {
2311
2311
  const [o, s] = M(null);
2312
- return In(() => {
2312
+ return Tn(() => {
2313
2313
  const a = () => {
2314
2314
  const c = l.current;
2315
2315
  if (!c) return;
2316
- const d = c.getBoundingClientRect(), v = 126, p = window.innerWidth - 16 - 110, h = d.left + d.width / 2;
2316
+ const d = c.getBoundingClientRect(), b = 126, p = window.innerWidth - 16 - 110, h = d.left + d.width / 2;
2317
2317
  s({
2318
2318
  top: d.top - 8,
2319
- left: Math.max(v, Math.min(p, h))
2319
+ left: Math.max(b, Math.min(p, h))
2320
2320
  });
2321
2321
  };
2322
2322
  return a(), window.addEventListener("scroll", a, !0), window.addEventListener("resize", a), () => {
2323
2323
  window.removeEventListener("scroll", a, !0), window.removeEventListener("resize", a);
2324
2324
  };
2325
- }, [l]), o === null || typeof document > "u" ? null : qt(
2326
- /* @__PURE__ */ C(
2325
+ }, [l]), o === null || typeof document > "u" ? null : Vt(
2326
+ /* @__PURE__ */ k(
2327
2327
  "div",
2328
2328
  {
2329
2329
  className: "ll-device-menu ll-device-menu--floating",
@@ -2340,7 +2340,7 @@ const xn = ({
2340
2340
  /* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
2341
2341
  t.map((a, c) => {
2342
2342
  const d = r === a.deviceId;
2343
- return /* @__PURE__ */ C(
2343
+ return /* @__PURE__ */ k(
2344
2344
  "button",
2345
2345
  {
2346
2346
  type: "button",
@@ -2361,7 +2361,7 @@ const xn = ({
2361
2361
  ),
2362
2362
  document.body
2363
2363
  );
2364
- }, ui = [
2364
+ }, pi = [
2365
2365
  // Accept any value (or empty) — `<input data-ll-private />` and
2366
2366
  // `<input data-ll-private="true" />` both opt out. The bare attribute
2367
2367
  // is the recommended spelling; "true" is preserved for back-compat.
@@ -2369,17 +2369,17 @@ const xn = ({
2369
2369
  "[data-ll-skip]",
2370
2370
  ".ll-widget"
2371
2371
  ];
2372
- function Ut(e) {
2372
+ function Yt(e) {
2373
2373
  let t = e;
2374
2374
  for (; t; ) {
2375
- for (const r of ui)
2375
+ for (const r of pi)
2376
2376
  if (t.matches(r)) return !0;
2377
2377
  t = t.parentElement;
2378
2378
  }
2379
2379
  return !1;
2380
2380
  }
2381
- function Ft(e) {
2382
- if (Ut(e)) return !1;
2381
+ function Ut(e) {
2382
+ if (Yt(e)) return !1;
2383
2383
  if (e instanceof HTMLInputElement) {
2384
2384
  if (e.type === "password") return !1;
2385
2385
  const t = (e.getAttribute("autocomplete") || "").toLowerCase();
@@ -2387,7 +2387,7 @@ function Ft(e) {
2387
2387
  }
2388
2388
  return !0;
2389
2389
  }
2390
- const kt = 4096, di = 20, fi = 20, pi = 10, hi = 10, mi = 30, gi = 20, Ln = 500, yi = [
2390
+ const St = 4096, hi = 20, mi = 20, gi = 10, yi = 10, vi = 30, bi = 20, kn = 500, wi = [
2391
2391
  '[data-ll-private="true"]',
2392
2392
  ".ll-widget",
2393
2393
  "script",
@@ -2395,24 +2395,24 @@ const kt = 4096, di = 20, fi = 20, pi = 10, hi = 10, mi = 30, gi = 20, Ln = 500,
2395
2395
  "noscript",
2396
2396
  "iframe"
2397
2397
  ];
2398
- function pt(e) {
2398
+ function dt(e) {
2399
2399
  if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
2400
2400
  let t = e;
2401
2401
  for (; t; ) {
2402
- for (const r of yi)
2402
+ for (const r of wi)
2403
2403
  if (t.matches(r)) return !0;
2404
2404
  t = t.parentElement;
2405
2405
  }
2406
2406
  return !1;
2407
2407
  }
2408
- function ht(e) {
2408
+ function ft(e) {
2409
2409
  if (typeof window > "u") return !0;
2410
2410
  const t = e.getBoundingClientRect();
2411
2411
  if (t.width <= 0 || t.height <= 0) return !1;
2412
2412
  const r = window.innerHeight || document.documentElement.clientHeight, i = window.innerWidth || document.documentElement.clientWidth;
2413
2413
  return t.bottom > 0 && t.right > 0 && t.top < r && t.left < i;
2414
2414
  }
2415
- function Cn(e) {
2415
+ function Sn(e) {
2416
2416
  const t = e.getAttribute("id");
2417
2417
  if (t) {
2418
2418
  const o = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(t) : t.replace(/"/g, '\\"'), s = document.querySelector(`label[for="${o}"]`);
@@ -2439,13 +2439,13 @@ function Cn(e) {
2439
2439
  const l = e.getAttribute("placeholder");
2440
2440
  return l ? l.trim() : "";
2441
2441
  }
2442
- function de(e, t) {
2442
+ function fe(e, t) {
2443
2443
  return e.length <= t ? e : e.slice(0, t - 1) + "…";
2444
2444
  }
2445
- function vi(e) {
2445
+ function _i(e) {
2446
2446
  return e && e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || null;
2447
2447
  }
2448
- function bi(e) {
2448
+ function xi(e) {
2449
2449
  const t = e.getAttribute("aria-label");
2450
2450
  if (t) return t.trim().slice(0, 80);
2451
2451
  const r = e.getAttribute("aria-labelledby");
@@ -2471,10 +2471,10 @@ function bi(e) {
2471
2471
  }
2472
2472
  return null;
2473
2473
  }
2474
- function Qe(e) {
2474
+ function Je(e) {
2475
2475
  return e.length;
2476
2476
  }
2477
- function wi(e, t = {}) {
2477
+ function Li(e, t = {}) {
2478
2478
  const r = t.doc ?? (typeof document < "u" ? document : null);
2479
2479
  if (!r)
2480
2480
  return {
@@ -2492,35 +2492,35 @@ function wi(e, t = {}) {
2492
2492
  r.querySelectorAll("[data-ll-region]")
2493
2493
  ), a = [];
2494
2494
  for (const m of s) {
2495
- if (a.length >= pi) break;
2496
- if (pt(m) || !ht(m)) continue;
2497
- const D = m.getAttribute("data-ll-region") ?? "", F = m.getAttribute("data-ll-intent") ?? void 0, K = de(
2495
+ if (a.length >= gi) break;
2496
+ if (dt(m) || !ft(m)) continue;
2497
+ const D = m.getAttribute("data-ll-region") ?? "", W = m.getAttribute("data-ll-intent") ?? void 0, K = fe(
2498
2498
  (m.innerText || m.textContent || "").trim(),
2499
- Ln * 2
2499
+ kn * 2
2500
2500
  );
2501
- !D || !K || a.push({ id: D, intent: F, text: K });
2501
+ !D || !K || a.push({ id: D, intent: W, text: K });
2502
2502
  }
2503
- const c = [], d = ["H1", "H2", "H3", "H4", "H5", "H6"], v = Array.from(
2503
+ const c = [], d = ["H1", "H2", "H3", "H4", "H5", "H6"], b = Array.from(
2504
2504
  r.querySelectorAll("h1, h2, h3, h4, h5, h6")
2505
2505
  );
2506
- for (const m of v) {
2507
- if (pt(m) || !ht(m)) continue;
2506
+ for (const m of b) {
2507
+ if (dt(m) || !ft(m)) continue;
2508
2508
  const D = (m.textContent || "").trim();
2509
- D && c.push(`${m.tagName}: ${de(D, 200)}`);
2509
+ D && c.push(`${m.tagName}: ${fe(D, 200)}`);
2510
2510
  }
2511
2511
  const p = Array.from(r.querySelectorAll("p, li"));
2512
2512
  for (const m of p) {
2513
- if (pt(m) || !ht(m) || d.includes(m.tagName)) continue;
2513
+ if (dt(m) || !ft(m) || d.includes(m.tagName)) continue;
2514
2514
  const D = (m.textContent || "").trim();
2515
- D.length > 10 && c.push(de(D, Ln));
2515
+ D.length > 10 && c.push(fe(D, kn));
2516
2516
  }
2517
2517
  const h = c.join(`
2518
- `), T = [], _ = Array.from(r.querySelectorAll("a[href]"));
2519
- for (const m of _) {
2520
- if (T.length >= di) break;
2521
- if (pt(m) || !ht(m)) continue;
2522
- const D = m.getAttribute("href") || "", F = (m.textContent || "").trim();
2523
- !D || !F || T.push({ href: D, text: de(F, 100) });
2518
+ `), P = [], x = Array.from(r.querySelectorAll("a[href]"));
2519
+ for (const m of x) {
2520
+ if (P.length >= hi) break;
2521
+ if (dt(m) || !ft(m)) continue;
2522
+ const D = m.getAttribute("href") || "", W = (m.textContent || "").trim();
2523
+ !D || !W || P.push({ href: D, text: fe(W, 100) });
2524
2524
  }
2525
2525
  const E = [], g = Array.from(
2526
2526
  r.querySelectorAll(
@@ -2528,78 +2528,78 @@ function wi(e, t = {}) {
2528
2528
  )
2529
2529
  );
2530
2530
  for (const m of g) {
2531
- if (E.length >= fi) break;
2532
- if (pt(m) || !Ft(m) || !ht(m)) continue;
2533
- const D = Cn(m), F = m instanceof HTMLInputElement ? m.type : m.tagName.toLowerCase();
2534
- D && E.push({ label: de(D, 100), type: F });
2531
+ if (E.length >= mi) break;
2532
+ if (dt(m) || !Ut(m) || !ft(m)) continue;
2533
+ const D = Sn(m), W = m instanceof HTMLInputElement ? m.type : m.tagName.toLowerCase();
2534
+ D && E.push({ label: fe(D, 100), type: W });
2535
2535
  }
2536
- const b = Array.from(r.querySelectorAll("form")), R = [];
2537
- let k = 0;
2538
- for (const m of b) {
2539
- if (R.length >= hi) break;
2540
- if (Ut(m) || m.matches(".ll-widget *, .ll-widget")) continue;
2541
- const D = m.getAttribute("id") || m.getAttribute("name") || vi(m.getAttribute("data-ll-intent")) || `form_${k++}`, F = m.getAttribute("data-ll-intent") || bi(m) || void 0, K = Array.from(
2536
+ const w = Array.from(r.querySelectorAll("form")), R = [];
2537
+ let S = 0;
2538
+ for (const m of w) {
2539
+ if (R.length >= yi) break;
2540
+ if (Yt(m) || m.matches(".ll-widget *, .ll-widget")) continue;
2541
+ const D = m.getAttribute("id") || m.getAttribute("name") || _i(m.getAttribute("data-ll-intent")) || `form_${S++}`, W = m.getAttribute("data-ll-intent") || xi(m) || void 0, K = Array.from(
2542
2542
  m.querySelectorAll(
2543
2543
  "input, textarea, select"
2544
2544
  )
2545
- ), oe = [];
2546
- let z = 0;
2545
+ ), ae = [];
2546
+ let $ = 0;
2547
2547
  const G = /* @__PURE__ */ new Set();
2548
2548
  for (const f of K) {
2549
- if (oe.length >= mi) break;
2550
- if (!Ft(f)) continue;
2549
+ if (ae.length >= vi) break;
2550
+ if (!Ut(f)) continue;
2551
2551
  if (f instanceof HTMLInputElement) {
2552
2552
  const U = f.type;
2553
2553
  if (U === "submit" || U === "button" || U === "reset" || U === "hidden" || U === "image" || U === "file") continue;
2554
2554
  }
2555
- const S = f.getAttribute("name") || "", O = f.getAttribute("id") || "";
2556
- let q = S || O || `field_${z}`;
2557
- G.has(q) && (q = `${q}__${z}`), G.add(q), z++;
2558
- const X = Cn(f) || q, Q = f instanceof HTMLInputElement ? f.type : f.tagName.toLowerCase(), Y = {
2555
+ const N = f.getAttribute("name") || "", z = f.getAttribute("id") || "";
2556
+ let q = N || z || `field_${$}`;
2557
+ G.has(q) && (q = `${q}__${$}`), G.add(q), $++;
2558
+ const X = Sn(f) || q, ee = f instanceof HTMLInputElement ? f.type : f.tagName.toLowerCase(), V = {
2559
2559
  name: q,
2560
- label: de(X, 100),
2561
- type: Q
2560
+ label: fe(X, 100),
2561
+ type: ee
2562
2562
  };
2563
- f.required === !0 && (Y.required = !0);
2563
+ f.required === !0 && (V.required = !0);
2564
2564
  const te = f.getAttribute("placeholder");
2565
- if (te && (Y.placeholder = de(te.trim(), 100)), f instanceof HTMLInputElement || f instanceof HTMLTextAreaElement) {
2565
+ if (te && (V.placeholder = fe(te.trim(), 100)), f instanceof HTMLInputElement || f instanceof HTMLTextAreaElement) {
2566
2566
  const U = f.getAttribute("minlength");
2567
2567
  if (U !== null) {
2568
- const ee = parseInt(U, 10);
2569
- !Number.isNaN(ee) && ee >= 0 && (Y.minLength = ee);
2568
+ const Q = parseInt(U, 10);
2569
+ !Number.isNaN(Q) && Q >= 0 && (V.minLength = Q);
2570
2570
  }
2571
- const ge = f.getAttribute("maxlength");
2572
- if (ge !== null) {
2573
- const ee = parseInt(ge, 10);
2574
- !Number.isNaN(ee) && ee >= 0 && (Y.maxLength = ee);
2571
+ const me = f.getAttribute("maxlength");
2572
+ if (me !== null) {
2573
+ const Q = parseInt(me, 10);
2574
+ !Number.isNaN(Q) && Q >= 0 && (V.maxLength = Q);
2575
2575
  }
2576
2576
  }
2577
2577
  if (f instanceof HTMLInputElement) {
2578
2578
  const U = f.getAttribute("min");
2579
- U !== null && (Y.min = de(U, 50));
2580
- const ge = f.getAttribute("max");
2581
- ge !== null && (Y.max = de(ge, 50));
2582
- const ee = f.getAttribute("step");
2583
- ee !== null && (Y.step = de(ee, 20));
2584
- const ve = f.getAttribute("pattern");
2585
- ve !== null && (Y.pattern = de(ve, 200));
2579
+ U !== null && (V.min = fe(U, 50));
2580
+ const me = f.getAttribute("max");
2581
+ me !== null && (V.max = fe(me, 50));
2582
+ const Q = f.getAttribute("step");
2583
+ Q !== null && (V.step = fe(Q, 20));
2584
+ const be = f.getAttribute("pattern");
2585
+ be !== null && (V.pattern = fe(be, 200));
2586
2586
  const ne = (f.getAttribute("autocomplete") || "").toLowerCase();
2587
- ne && ne !== "off" && !ne.startsWith("cc-") && (Y.autocomplete = de(ne, 50));
2587
+ ne && ne !== "off" && !ne.startsWith("cc-") && (V.autocomplete = fe(ne, 50));
2588
2588
  }
2589
2589
  if (f instanceof HTMLSelectElement) {
2590
2590
  const U = [];
2591
- for (let ge = 0; ge < f.options.length && !(U.length >= gi); ge++) {
2592
- const ee = f.options[ge];
2593
- if (!ee || ee.disabled) continue;
2594
- const ve = ee.value || "", ne = (ee.textContent || "").trim() || ve;
2595
- !ve && !ne || U.push({ value: ve, label: de(ne, 60) });
2591
+ for (let me = 0; me < f.options.length && !(U.length >= bi); me++) {
2592
+ const Q = f.options[me];
2593
+ if (!Q || Q.disabled) continue;
2594
+ const be = Q.value || "", ne = (Q.textContent || "").trim() || be;
2595
+ !be && !ne || U.push({ value: be, label: fe(ne, 60) });
2596
2596
  }
2597
- U.length > 0 && (Y.options = U);
2597
+ U.length > 0 && (V.options = U);
2598
2598
  }
2599
- const ie = typeof f.validationMessage == "string" ? f.validationMessage : "";
2600
- ie && (Y.validationMessage = de(ie, 200)), oe.push(Y);
2599
+ const oe = typeof f.validationMessage == "string" ? f.validationMessage : "";
2600
+ oe && (V.validationMessage = fe(oe, 200)), ae.push(V);
2601
2601
  }
2602
- R.push({ id: D, intent: F, fields: oe });
2602
+ R.push({ id: D, intent: W, fields: ae });
2603
2603
  }
2604
2604
  const y = {
2605
2605
  url: i,
@@ -2607,31 +2607,31 @@ function wi(e, t = {}) {
2607
2607
  pathname: l,
2608
2608
  regions: a,
2609
2609
  visibleText: h,
2610
- visibleLinks: T,
2610
+ visibleLinks: P,
2611
2611
  visibleFields: E,
2612
2612
  forms: R,
2613
2613
  extras: e
2614
2614
  };
2615
- let H = Qe(JSON.stringify(y.regions)) + Qe(y.visibleText) + Qe(JSON.stringify(y.visibleLinks)) + Qe(JSON.stringify(y.visibleFields));
2616
- for (; H > kt && y.visibleFields.length > 0; )
2617
- y.visibleFields.pop(), H = Qe(JSON.stringify(y.visibleFields));
2618
- for (; H > kt && y.visibleLinks.length > 0; )
2619
- y.visibleLinks.pop(), H -= 80;
2620
- return Qe(y.visibleText) > kt && (y.visibleText = de(y.visibleText, kt - 100)), y;
2615
+ let O = Je(JSON.stringify(y.regions)) + Je(y.visibleText) + Je(JSON.stringify(y.visibleLinks)) + Je(JSON.stringify(y.visibleFields));
2616
+ for (; O > St && y.visibleFields.length > 0; )
2617
+ y.visibleFields.pop(), O = Je(JSON.stringify(y.visibleFields));
2618
+ for (; O > St && y.visibleLinks.length > 0; )
2619
+ y.visibleLinks.pop(), O -= 80;
2620
+ return Je(y.visibleText) > St && (y.visibleText = fe(y.visibleText, St - 100)), y;
2621
2621
  }
2622
- let et = null;
2623
- function kn(e, t = {}) {
2622
+ let Ze = null;
2623
+ function En(e, t = {}) {
2624
2624
  const r = Date.now(), l = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
2625
- if (et && et.key === l && r - et.at < 1e3)
2626
- return et.ctx;
2627
- const o = wi(e, t);
2628
- return et = { key: l, at: r, ctx: o }, o;
2625
+ if (Ze && Ze.key === l && r - Ze.at < 1e3)
2626
+ return Ze.ctx;
2627
+ const o = Li(e, t);
2628
+ return Ze = { key: l, at: r, ctx: o }, o;
2629
2629
  }
2630
- function _i() {
2631
- et = null;
2630
+ function Ci() {
2631
+ Ze = null;
2632
2632
  }
2633
- const xi = 200;
2634
- function Li(e) {
2633
+ const ki = 200;
2634
+ function Si(e) {
2635
2635
  const t = String(e.href || "");
2636
2636
  return {
2637
2637
  href: t,
@@ -2641,18 +2641,18 @@ function Li(e) {
2641
2641
  description: e.description
2642
2642
  };
2643
2643
  }
2644
- function Ci(e) {
2644
+ function Ei(e) {
2645
2645
  return !(!e || e.startsWith("#") || e.startsWith("javascript:") || e.startsWith("mailto:") || e.startsWith("tel:"));
2646
2646
  }
2647
- function ki(e) {
2647
+ function Ni(e) {
2648
2648
  const t = e ?? (typeof document < "u" ? document : null);
2649
2649
  if (!t) return [];
2650
2650
  const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), l = [], o = Array.from(t.querySelectorAll("a[href]"));
2651
2651
  for (const s of o) {
2652
- if (l.length >= xi) break;
2653
- if (Ut(s)) continue;
2652
+ if (l.length >= ki) break;
2653
+ if (Yt(s)) continue;
2654
2654
  const a = s.getAttribute("href") || "";
2655
- if (!Ci(a)) continue;
2655
+ if (!Ei(a)) continue;
2656
2656
  let c = a, d = !0;
2657
2657
  try {
2658
2658
  if (typeof window < "u") {
@@ -2664,24 +2664,24 @@ function ki(e) {
2664
2664
  }
2665
2665
  if (i.has(c)) continue;
2666
2666
  i.add(c);
2667
- const v = (s.textContent || "").trim().slice(0, 120);
2668
- l.push({ href: c, text: v, internal: d });
2667
+ const b = (s.textContent || "").trim().slice(0, 120);
2668
+ l.push({ href: c, text: b, internal: d });
2669
2669
  }
2670
2670
  return l;
2671
2671
  }
2672
- let tt = null;
2673
- const Ei = 5e3;
2674
- function Ot() {
2672
+ let Qe = null;
2673
+ const Ai = 5e3;
2674
+ function Bt() {
2675
2675
  const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
2676
- if (tt && tt.pathname === t && e - tt.at < Ei)
2677
- return tt.routes;
2678
- const r = ki();
2679
- return tt = { at: e, pathname: t, routes: r }, r;
2676
+ if (Qe && Qe.pathname === t && e - Qe.at < Ai)
2677
+ return Qe.routes;
2678
+ const r = Ni();
2679
+ return Qe = { at: e, pathname: t, routes: r }, r;
2680
2680
  }
2681
- function Si() {
2682
- tt = null;
2681
+ function Mi() {
2682
+ Qe = null;
2683
2683
  }
2684
- function En(e) {
2684
+ function Nn(e) {
2685
2685
  if (e instanceof HTMLInputElement) {
2686
2686
  const t = e.type;
2687
2687
  if (t === "submit" || t === "button" || t === "reset" || t === "hidden" || t === "image" || t === "file")
@@ -2689,16 +2689,16 @@ function En(e) {
2689
2689
  }
2690
2690
  return !0;
2691
2691
  }
2692
- function Ni(e, t) {
2692
+ function Ii(e, t) {
2693
2693
  return e.getAttribute("name") || e.getAttribute("id") || `field_${t}`;
2694
2694
  }
2695
- function Ai(e, t) {
2695
+ function Ri(e, t) {
2696
2696
  if (!t) return null;
2697
2697
  try {
2698
2698
  const o = e.querySelector(
2699
2699
  `[name="${t.replace(/"/g, '\\"')}"]`
2700
2700
  );
2701
- if (o && En(o)) return o;
2701
+ if (o && Nn(o)) return o;
2702
2702
  } catch {
2703
2703
  }
2704
2704
  const r = Array.from(
@@ -2707,23 +2707,23 @@ function Ai(e, t) {
2707
2707
  let i = 0;
2708
2708
  const l = /* @__PURE__ */ new Map();
2709
2709
  for (const o of r) {
2710
- if (!En(o)) continue;
2711
- const s = Ni(o, i);
2710
+ if (!Nn(o)) continue;
2711
+ const s = Ii(o, i);
2712
2712
  let a = s;
2713
2713
  if (l.has(s) && (a = `${s}__${i}`), a === t) return o;
2714
2714
  l.set(s, o), i++;
2715
2715
  }
2716
2716
  return null;
2717
2717
  }
2718
- function Sn(e, t) {
2719
- const r = Ai(e, t);
2720
- return r ? Ft(r) ? { el: r } : { el: null, reason: "private" } : { el: null, reason: "not_found" };
2718
+ function An(e, t) {
2719
+ const r = Ri(e, t);
2720
+ return r ? Ut(r) ? { el: r } : { el: null, reason: "private" } : { el: null, reason: "not_found" };
2721
2721
  }
2722
- function Mi(e, t) {
2722
+ function Ti(e, t) {
2723
2723
  const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, i = Object.getOwnPropertyDescriptor(r, "value"), l = i == null ? void 0 : i.set;
2724
2724
  l ? l.call(e, t) : e.value = t;
2725
2725
  }
2726
- function Ii(e, t, r = {}) {
2726
+ function Pi(e, t, r = {}) {
2727
2727
  const i = r.triggerInput ?? !0, l = r.triggerChange ?? !0;
2728
2728
  if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
2729
2729
  const o = Object.getOwnPropertyDescriptor(
@@ -2733,9 +2733,9 @@ function Ii(e, t, r = {}) {
2733
2733
  s ? s.call(e, a) : e.checked = a, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), l && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2734
2734
  return;
2735
2735
  }
2736
- Mi(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), l && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2736
+ Ti(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), l && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2737
2737
  }
2738
- function Nn(e, t) {
2738
+ function Mn(e, t) {
2739
2739
  if (!t) return null;
2740
2740
  const r = t.replace(/"/g, '\\"');
2741
2741
  try {
@@ -2756,7 +2756,7 @@ function Nn(e, t) {
2756
2756
  const o = Array.from(e.querySelectorAll("form"));
2757
2757
  for (const s of o) {
2758
2758
  const a = s.getAttribute("data-ll-intent");
2759
- if (a && Ri(a) === t) return s;
2759
+ if (a && Di(a) === t) return s;
2760
2760
  }
2761
2761
  if (/^form_\d+$/.test(t)) {
2762
2762
  const s = parseInt(t.slice(5), 10);
@@ -2769,10 +2769,10 @@ function Nn(e, t) {
2769
2769
  }
2770
2770
  return null;
2771
2771
  }
2772
- function Ri(e) {
2772
+ function Di(e) {
2773
2773
  return e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || null;
2774
2774
  }
2775
- function Ti() {
2775
+ function zi() {
2776
2776
  if (typeof window > "u" || typeof document > "u")
2777
2777
  return !1;
2778
2778
  const e = document.scrollingElement || document.documentElement;
@@ -2780,19 +2780,19 @@ function Ti() {
2780
2780
  const t = window.getComputedStyle(e);
2781
2781
  return !(t.overflowY === "hidden" || t.overflowY === "clip");
2782
2782
  }
2783
- function Pi(e) {
2783
+ function $i(e) {
2784
2784
  if (!(e instanceof HTMLElement)) return !1;
2785
2785
  const r = window.getComputedStyle(e).overflowY;
2786
2786
  return !(r !== "auto" && r !== "scroll" || e.scrollHeight <= e.clientHeight + 2);
2787
2787
  }
2788
- function Di() {
2788
+ function Hi() {
2789
2789
  if (typeof document > "u") return null;
2790
2790
  const e = Array.from(
2791
2791
  document.querySelectorAll("body, body *")
2792
2792
  );
2793
2793
  let t = null, r = 0;
2794
2794
  for (const i of e) {
2795
- if (!Pi(i)) continue;
2795
+ if (!$i(i)) continue;
2796
2796
  const l = i.getBoundingClientRect();
2797
2797
  if (l.bottom <= 0 || l.top >= window.innerHeight || l.right <= 0 || l.left >= window.innerWidth || l.width <= 0 || l.height <= 0 || i.closest(".ll-widget")) continue;
2798
2798
  const o = l.width * l.height;
@@ -2800,24 +2800,24 @@ function Di() {
2800
2800
  }
2801
2801
  return t;
2802
2802
  }
2803
- function zi() {
2803
+ function Oi() {
2804
2804
  if (typeof window > "u")
2805
2805
  return null;
2806
- if (Ti()) return window;
2807
- const e = Di();
2806
+ if (zi()) return window;
2807
+ const e = Hi();
2808
2808
  return e || window;
2809
2809
  }
2810
- function An(e) {
2810
+ function In(e) {
2811
2811
  return e instanceof Window ? e.innerHeight || 0 : e.clientHeight || 0;
2812
2812
  }
2813
- function $i(e) {
2813
+ function Fi(e) {
2814
2814
  var t, r;
2815
2815
  return e instanceof Window ? typeof document > "u" ? 0 : Math.max(
2816
2816
  ((t = document.body) == null ? void 0 : t.scrollHeight) ?? 0,
2817
2817
  ((r = document.documentElement) == null ? void 0 : r.scrollHeight) ?? 0
2818
2818
  ) : e.scrollHeight - e.clientHeight;
2819
2819
  }
2820
- const Hi = /* @__PURE__ */ new Set([
2820
+ const Wi = /* @__PURE__ */ new Set([
2821
2821
  "agent_state",
2822
2822
  "avatar_stream_ready",
2823
2823
  "avatar_active",
@@ -2847,9 +2847,9 @@ const Hi = /* @__PURE__ */ new Set([
2847
2847
  // to onAgentCommand.
2848
2848
  "task_field_updated",
2849
2849
  "task_completed"
2850
- ]), Fn = Bt(
2850
+ ]), qn = jt(
2851
2851
  function(t, r) {
2852
- var nn, rn, on, ln, an, sn, cn;
2852
+ var on, ln, an, sn, cn, un, dn;
2853
2853
  const {
2854
2854
  agentId: i,
2855
2855
  apiKey: l,
@@ -2858,7 +2858,7 @@ const Hi = /* @__PURE__ */ new Set([
2858
2858
  sessionBody: a,
2859
2859
  soundEffects: c,
2860
2860
  experienceMode: d = "WIDGET",
2861
- autoConnect: v = !1,
2861
+ autoConnect: b = !1,
2862
2862
  displayMode: p,
2863
2863
  // Initial display mode. Mobile gets a smaller card layout (not the
2864
2864
  // full-screen sheet) so "expanded" is the right default on every
@@ -2868,95 +2868,96 @@ const Hi = /* @__PURE__ */ new Set([
2868
2868
  // minimized produced). The card sizing now lives in CSS — see
2869
2869
  // .ll-expanded--mobile in styles.css.
2870
2870
  defaultDisplayMode: h = "expanded",
2871
- onDisplayModeChange: T,
2872
- position: _ = "bottom-right",
2871
+ onDisplayModeChange: P,
2872
+ position: x = "bottom-right",
2873
2873
  mobileBreakpoint: E = 640,
2874
2874
  draggable: g,
2875
- resizable: b,
2875
+ resizable: w,
2876
2876
  persistKey: R = "ll-widget",
2877
- disablePersistence: k = !1,
2877
+ disablePersistence: S = !1,
2878
2878
  teamMembers: y,
2879
- currentTeamMemberId: H,
2879
+ currentTeamMemberId: O,
2880
2880
  onTeamMemberChange: m,
2881
2881
  idleLoopUrl: D,
2882
- greeting: F,
2882
+ greeting: W,
2883
2883
  avatarImageUrl: K,
2884
- agentName: oe,
2885
- branding: z = {},
2884
+ agentName: ae,
2885
+ branding: $ = {},
2886
2886
  allowCamera: G = !0,
2887
2887
  allowScreenShare: f = !0,
2888
- allowTyping: S = !0,
2889
- showMinimize: O,
2890
- showClose: q,
2891
- chromeless: X = !1,
2892
- floatingChromeContainer: Q = null,
2893
- compactControls: Y = !1,
2894
- transforming: te = !1,
2895
- transformingLabel: ie = "Transforming…",
2896
- showOn: U,
2897
- hideOn: ge,
2898
- pathname: ee,
2899
- onNavigate: ve,
2900
- onScrollToSelector: ne,
2901
- getPageContext: rt,
2902
- pageContextExtras: it,
2903
- getRoutes: mt,
2904
- onScrollPage: gt,
2905
- onClick: ot,
2906
- capabilities: lt,
2907
- onConnect: Me,
2908
- onDisconnect: Fe,
2909
- onTranscript: Ie,
2910
- onAgentState: Re,
2911
- onConnectionStateChange: Te,
2912
- onAgentEvent: Pe,
2913
- onAgentCommand: De,
2914
- onCollect: Be,
2915
- controlledSession: W,
2916
- className: qe,
2917
- style: ze,
2918
- zIndex: Ue = 2147483647
2919
- } = t, be = zr(ee), at = qr(be, U, ge);
2920
- P(() => {
2921
- _i(), Si();
2922
- }, [be]);
2923
- const $e = H !== void 0, [je, St] = M(() => {
2924
- var x;
2925
- return H ?? ((x = y == null ? void 0 : y[0]) == null ? void 0 : x.id);
2926
- }), Ne = $e ? H : je, fe = nt(
2927
- () => (y == null ? void 0 : y.find((x) => x.id === Ne)) ?? null,
2928
- [y, Ne]
2929
- ), st = (fe == null ? void 0 : fe.agentId) ?? i, ce = d === "EMBEDDED", pe = Nr(E), [Ve, Ye] = Er({
2888
+ allowTyping: N = !0,
2889
+ blurUntilFirstSpeech: z = !0,
2890
+ showMinimize: q,
2891
+ showClose: X,
2892
+ chromeless: ee = !1,
2893
+ floatingChromeContainer: V = null,
2894
+ compactControls: te = !1,
2895
+ transforming: oe = !1,
2896
+ transformingLabel: U = "Transforming…",
2897
+ showOn: me,
2898
+ hideOn: Q,
2899
+ pathname: be,
2900
+ onNavigate: ne,
2901
+ onScrollToSelector: tt,
2902
+ getPageContext: nt,
2903
+ pageContextExtras: pt,
2904
+ getRoutes: ht,
2905
+ onScrollPage: rt,
2906
+ onClick: mt,
2907
+ capabilities: We,
2908
+ onConnect: Be,
2909
+ onDisconnect: Ie,
2910
+ onTranscript: Re,
2911
+ onAgentState: Te,
2912
+ onConnectionStateChange: Pe,
2913
+ onAgentEvent: De,
2914
+ onAgentCommand: qe,
2915
+ onCollect: ze,
2916
+ controlledSession: F,
2917
+ className: $e,
2918
+ style: Ue,
2919
+ zIndex: we = 2147483647
2920
+ } = t, gt = Or(be), He = Vr(gt, me, Q);
2921
+ T(() => {
2922
+ Ci(), Mi();
2923
+ }, [gt]);
2924
+ const Ne = O !== void 0, [Nt, yt] = M(() => {
2925
+ var v;
2926
+ return O ?? ((v = y == null ? void 0 : y[0]) == null ? void 0 : v.id);
2927
+ }), Oe = Ne ? O : Nt, ue = et(
2928
+ () => (y == null ? void 0 : y.find((v) => v.id === Oe)) ?? null,
2929
+ [y, Oe]
2930
+ ), it = (ue == null ? void 0 : ue.agentId) ?? i, le = d === "EMBEDDED", pe = Ir(E), [je, Ve] = Ar({
2930
2931
  value: p,
2931
2932
  defaultValue: h,
2932
- onChange: T,
2933
+ onChange: P,
2933
2934
  persistKey: R,
2934
- disablePersistence: ce || k
2935
- }), he = ce ? "expanded" : Ve, we = ce ? () => {
2936
- } : Ye, yt = O ?? !ce, vt = q ?? !ce, Nt = Y || !ce && pe, Ee = Pr({
2937
- draggable: !ce && (g ?? !pe),
2938
- resizable: !ce && (b ?? !pe),
2935
+ disablePersistence: le || S
2936
+ }), ge = le ? "expanded" : je, _e = le ? () => {
2937
+ } : Ve, vt = q ?? !le, At = X ?? !le, Mt = te || !le && pe, Ae = $r({
2938
+ draggable: !le && (g ?? !pe),
2939
+ resizable: !le && (w ?? !pe),
2939
2940
  persistKey: R,
2940
- disablePersistence: ce || k
2941
- }), He = hr(), _e = vr(), Oe = br(), xe = wr(), [Ae, Ge] = M(!1), [Xe, bt] = M(!1), [Ke, w] = M(!1), [le, Bn] = M(!1), [At, qn] = M(!1), wt = jr({ baseUrl: o, config: c }), _t = I(wt);
2941
+ disablePersistence: le || S
2942
+ }), Me = yr(), Se = _r(), ye = xr(), xe = Lr(), [bt, Ye] = M(!1), [lt, at] = M(!1), [_, re] = M(!1), [Un, jn] = M(!1), [Rt, Vn] = M(!1), wt = Gr({ baseUrl: o, config: c }), _t = I(wt);
2942
2943
  _t.current = wt;
2943
- const Mt = I(ve), It = I(ne), Rt = I(gt), Tt = I(ot), Vt = I(rt), Yt = I(it), Gt = I(mt), Pt = I(lt), Le = I(null);
2944
- Mt.current = ve, It.current = ne, Rt.current = gt, Tt.current = ot, Vt.current = rt, Yt.current = it, Gt.current = mt, Pt.current = lt;
2945
- function Ce(x) {
2946
- const u = Pt.current;
2947
- return u ? u.includes(x) : !0;
2944
+ const Tt = I(ne), Pt = I(tt), Dt = I(rt), zt = I(mt), Gt = I(nt), Xt = I(pt), Kt = I(ht), $t = I(We), Le = I(null);
2945
+ Tt.current = ne, Pt.current = tt, Dt.current = rt, zt.current = mt, Gt.current = nt, Xt.current = pt, Kt.current = ht, $t.current = We;
2946
+ function Ce(v) {
2947
+ const u = $t.current;
2948
+ return u ? u.includes(v) : !0;
2948
2949
  }
2949
- function ke(x, u) {
2950
+ function ke(v, u) {
2950
2951
  console.warn(
2951
- `[LiveLayer] Agent command "${x}" blocked — capability "${u}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
2952
+ `[LiveLayer] Agent command "${v}" blocked — capability "${u}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
2952
2953
  );
2953
2954
  }
2954
- const ut = L(
2955
- (x) => {
2956
- var re, ue, Se, ft;
2957
- const u = x;
2955
+ const st = C(
2956
+ (v) => {
2957
+ var ie, de, Ee, ut;
2958
+ const u = v;
2958
2959
  if (!(!u.type || typeof u.type != "string")) {
2959
- if (Pe == null || Pe({ eventName: u.type, data: x }), u.type === "navigate") {
2960
+ if (De == null || De({ eventName: u.type, data: v }), u.type === "navigate") {
2960
2961
  if (!Ce("navigate")) {
2961
2962
  ke("navigate", "navigate");
2962
2963
  return;
@@ -2968,33 +2969,33 @@ const Hi = /* @__PURE__ */ new Set([
2968
2969
  );
2969
2970
  return;
2970
2971
  }
2971
- if (_t.current.playPageChange(), Mt.current) {
2972
+ if (_t.current.playPageChange(), Tt.current) {
2972
2973
  try {
2973
- Mt.current(A);
2974
- } catch ($) {
2974
+ Tt.current(A);
2975
+ } catch (H) {
2975
2976
  console.warn(
2976
2977
  `[LiveLayer] onNavigate threw for "${A}". Falling back. Error:`,
2977
- $
2978
+ H
2978
2979
  );
2979
2980
  }
2980
2981
  return;
2981
2982
  }
2982
2983
  if (typeof document < "u") {
2983
- const $ = document.querySelector(
2984
+ const H = document.querySelector(
2984
2985
  `a[href="${A.replace(/"/g, '\\"')}"]`
2985
2986
  );
2986
- if ($) {
2987
- $.click();
2987
+ if (H) {
2988
+ H.click();
2988
2989
  return;
2989
2990
  }
2990
2991
  }
2991
2992
  if (typeof window < "u" && typeof history < "u")
2992
2993
  try {
2993
2994
  history.pushState({}, "", A), window.dispatchEvent(new PopStateEvent("popstate"));
2994
- } catch ($) {
2995
+ } catch (H) {
2995
2996
  console.warn(
2996
2997
  `[LiveLayer] history.pushState fallback failed for "${A}". Pass an onNavigate prop to use your router directly. See https://livelayer.studio/docs/react/navigation`,
2997
- $
2998
+ H
2998
2999
  );
2999
3000
  }
3000
3001
  return;
@@ -3006,36 +3007,36 @@ const Hi = /* @__PURE__ */ new Set([
3006
3007
  }
3007
3008
  const A = typeof u.selector == "string" ? u.selector : null;
3008
3009
  if (!A) return;
3009
- const $ = u.behavior === "instant" ? "instant" : "smooth";
3010
- if (It.current) {
3010
+ const H = u.behavior === "instant" ? "instant" : "smooth";
3011
+ if (Pt.current) {
3011
3012
  try {
3012
- It.current(
3013
+ Pt.current(
3013
3014
  A,
3014
- $
3015
+ H
3015
3016
  );
3016
- } catch (V) {
3017
- console.warn("[LiveLayer] onScrollToSelector threw.", V);
3017
+ } catch (Y) {
3018
+ console.warn("[LiveLayer] onScrollToSelector threw.", Y);
3018
3019
  }
3019
3020
  return;
3020
3021
  }
3021
3022
  if (typeof document < "u") {
3022
- let V = null;
3023
+ let Y = null;
3023
3024
  try {
3024
- V = document.querySelector(A);
3025
+ Y = document.querySelector(A);
3025
3026
  } catch {
3026
3027
  console.warn(
3027
3028
  `[LiveLayer] scroll_to: invalid selector "${A}".`
3028
3029
  );
3029
3030
  return;
3030
3031
  }
3031
- if (!V) {
3032
+ if (!Y) {
3032
3033
  console.warn(
3033
3034
  `[LiveLayer] scroll_to: no element matched "${A}". The user may be on a different page. See https://livelayer.studio/docs/errors/scroll-no-match`
3034
3035
  );
3035
3036
  return;
3036
3037
  }
3037
- V.scrollIntoView({
3038
- behavior: $,
3038
+ Y.scrollIntoView({
3039
+ behavior: H,
3039
3040
  block: "start"
3040
3041
  });
3041
3042
  }
@@ -3046,43 +3047,43 @@ const Hi = /* @__PURE__ */ new Set([
3046
3047
  ke("request_page_context", "read_page");
3047
3048
  return;
3048
3049
  }
3049
- const A = typeof u.requestId == "string" ? u.requestId : void 0, $ = (re = Le.current) == null ? void 0 : re.call(Le), V = (Z) => {
3050
- const B = $, se = B == null ? void 0 : B.localParticipant;
3051
- if (se != null && se.publishData)
3050
+ const A = typeof u.requestId == "string" ? u.requestId : void 0, H = (ie = Le.current) == null ? void 0 : ie.call(Le), Y = (Z) => {
3051
+ const B = H, ce = B == null ? void 0 : B.localParticipant;
3052
+ if (ce != null && ce.publishData)
3052
3053
  try {
3053
- const me = A ? { ...Z, requestId: A } : Z, Ze = new TextEncoder().encode(JSON.stringify(me));
3054
- se.publishData(Ze, { reliable: !0 });
3055
- } catch (me) {
3056
- console.warn("[LiveLayer] publishData failed.", me);
3054
+ const he = A ? { ...Z, requestId: A } : Z, Ke = new TextEncoder().encode(JSON.stringify(he));
3055
+ ce.publishData(Ke, { reliable: !0 });
3056
+ } catch (he) {
3057
+ console.warn("[LiveLayer] publishData failed.", he);
3057
3058
  }
3058
- }, j = Yt.current, J = Vt.current;
3059
+ }, j = Xt.current, J = Gt.current;
3059
3060
  try {
3060
3061
  if (J) {
3061
3062
  const Z = J(j);
3062
3063
  if (Z instanceof Promise) {
3063
- V({ type: "page_context_pending" }), Z.then((B) => V({ type: "page_context", context: B })).catch((B) => {
3064
+ Y({ type: "page_context_pending" }), Z.then((B) => Y({ type: "page_context", context: B })).catch((B) => {
3064
3065
  console.warn(
3065
3066
  "[LiveLayer] getPageContext rejected; falling back to default walker.",
3066
3067
  B
3067
- ), V({
3068
+ ), Y({
3068
3069
  type: "page_context",
3069
- context: kn(j)
3070
+ context: En(j)
3070
3071
  });
3071
3072
  });
3072
3073
  return;
3073
3074
  }
3074
- V({ type: "page_context", context: Z });
3075
+ Y({ type: "page_context", context: Z });
3075
3076
  return;
3076
3077
  }
3077
- V({
3078
+ Y({
3078
3079
  type: "page_context",
3079
- context: kn(j)
3080
+ context: En(j)
3080
3081
  });
3081
3082
  } catch (Z) {
3082
3083
  console.warn(
3083
3084
  "[LiveLayer] page-context extraction threw. Sending empty context.",
3084
3085
  Z
3085
- ), V({
3086
+ ), Y({
3086
3087
  type: "page_context",
3087
3088
  context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: j }
3088
3089
  });
@@ -3101,12 +3102,12 @@ const Hi = /* @__PURE__ */ new Set([
3101
3102
  );
3102
3103
  return;
3103
3104
  }
3104
- const $ = u.behavior === "instant" ? "instant" : "smooth";
3105
- if (Rt.current) {
3105
+ const H = u.behavior === "instant" ? "instant" : "smooth";
3106
+ if (Dt.current) {
3106
3107
  try {
3107
- Rt.current(
3108
+ Dt.current(
3108
3109
  A,
3109
- $
3110
+ H
3110
3111
  );
3111
3112
  } catch (B) {
3112
3113
  console.warn("[LiveLayer] onScrollPage threw.", B);
@@ -3114,12 +3115,12 @@ const Hi = /* @__PURE__ */ new Set([
3114
3115
  return;
3115
3116
  }
3116
3117
  if (typeof window > "u") return;
3117
- const V = { behavior: $ }, j = zi(), J = (B) => {
3118
- j instanceof Window ? j.scrollBy({ top: B, ...V }) : j.scrollBy({ top: B, ...V });
3118
+ const Y = { behavior: H }, j = Oi(), J = (B) => {
3119
+ j instanceof Window ? j.scrollBy({ top: B, ...Y }) : j.scrollBy({ top: B, ...Y });
3119
3120
  }, Z = (B) => {
3120
- j instanceof Window ? j.scrollTo({ top: B, ...V }) : j.scrollTo({ top: B, ...V });
3121
+ j instanceof Window ? j.scrollTo({ top: B, ...Y }) : j.scrollTo({ top: B, ...Y });
3121
3122
  };
3122
- A === "up" ? J(-An(j)) : A === "down" ? J(An(j)) : Z(A === "top" ? 0 : $i(j));
3123
+ A === "up" ? J(-In(j)) : A === "down" ? J(In(j)) : Z(A === "top" ? 0 : Fi(j));
3123
3124
  return;
3124
3125
  }
3125
3126
  if (u.type === "click") {
@@ -3132,37 +3133,37 @@ const Hi = /* @__PURE__ */ new Set([
3132
3133
  console.warn("[LiveLayer] click: missing selector.");
3133
3134
  return;
3134
3135
  }
3135
- if (Tt.current) {
3136
+ if (zt.current) {
3136
3137
  try {
3137
- Tt.current(A);
3138
- } catch (V) {
3139
- console.warn("[LiveLayer] onClick threw.", V);
3138
+ zt.current(A);
3139
+ } catch (Y) {
3140
+ console.warn("[LiveLayer] onClick threw.", Y);
3140
3141
  }
3141
3142
  return;
3142
3143
  }
3143
3144
  if (typeof document > "u") return;
3144
- let $ = null;
3145
+ let H = null;
3145
3146
  try {
3146
- $ = document.querySelector(A);
3147
+ H = document.querySelector(A);
3147
3148
  } catch {
3148
3149
  console.warn(
3149
3150
  `[LiveLayer] click: invalid selector "${A}".`
3150
3151
  );
3151
3152
  return;
3152
3153
  }
3153
- if (!$) {
3154
+ if (!H) {
3154
3155
  console.warn(
3155
3156
  `[LiveLayer] click: no element matched "${A}". See https://livelayer.studio/docs/errors/click-no-match`
3156
3157
  );
3157
3158
  return;
3158
3159
  }
3159
- if ($.closest('[data-ll-private="true"], .ll-widget')) {
3160
+ if (H.closest('[data-ll-private="true"], .ll-widget')) {
3160
3161
  console.warn(
3161
3162
  "[LiveLayer] click: refusing to click element inside a private subtree."
3162
3163
  );
3163
3164
  return;
3164
3165
  }
3165
- (ue = $.click) == null || ue.call($);
3166
+ (de = H.click) == null || de.call(H);
3166
3167
  return;
3167
3168
  }
3168
3169
  if (u.type === "fill_form" || u.type === "focus_field") {
@@ -3177,14 +3178,14 @@ const Hi = /* @__PURE__ */ new Set([
3177
3178
  console.warn(`[LiveLayer] ${u.type}: missing formId.`);
3178
3179
  return;
3179
3180
  }
3180
- const $ = Nn(document, A);
3181
- if (!$) {
3181
+ const H = Mn(document, A);
3182
+ if (!H) {
3182
3183
  console.warn(
3183
3184
  `[LiveLayer] ${u.type}: no <form> matched id="${A}" (or matching name / data-ll-intent slug). Forms are auto-discovered — make sure the form has an \`id\`, \`name\`, or \`data-ll-intent\` attribute the agent observed in PageContext.forms.`
3184
3185
  );
3185
3186
  return;
3186
3187
  }
3187
- if ($.closest('[data-ll-private="true"], [data-ll-skip], .ll-widget')) {
3188
+ if (H.closest('[data-ll-private="true"], [data-ll-skip], .ll-widget')) {
3188
3189
  console.warn(
3189
3190
  `[LiveLayer] ${u.type}: refusing to touch a form in a private / opted-out subtree.`
3190
3191
  );
@@ -3196,7 +3197,7 @@ const Hi = /* @__PURE__ */ new Set([
3196
3197
  console.warn("[LiveLayer] focus_field: missing fieldName.");
3197
3198
  return;
3198
3199
  }
3199
- const J = Sn($, j);
3200
+ const J = An(H, j);
3200
3201
  if (J.el === null) {
3201
3202
  J.reason === "private" ? console.warn(
3202
3203
  `[LiveLayer] focus_field: field "${j}" is privacy-protected and not focusable.`
@@ -3208,14 +3209,14 @@ const Hi = /* @__PURE__ */ new Set([
3208
3209
  J.el.focus();
3209
3210
  return;
3210
3211
  }
3211
- const V = u.values && typeof u.values == "object" ? u.values : null;
3212
- if (!V) {
3212
+ const Y = u.values && typeof u.values == "object" ? u.values : null;
3213
+ if (!Y) {
3213
3214
  console.warn("[LiveLayer] fill_form: missing or invalid values.");
3214
3215
  return;
3215
3216
  }
3216
- for (const [j, J] of Object.entries(V)) {
3217
+ for (const [j, J] of Object.entries(Y)) {
3217
3218
  if (typeof J != "string") continue;
3218
- const Z = Sn($, j);
3219
+ const Z = An(H, j);
3219
3220
  if (Z.el === null) {
3220
3221
  Z.reason === "private" ? console.warn(
3221
3222
  `[LiveLayer] fill_form: field "${j}" is privacy-protected (password / cc-* / data-ll-private). Skipping.`
@@ -3225,7 +3226,7 @@ const Hi = /* @__PURE__ */ new Set([
3225
3226
  continue;
3226
3227
  }
3227
3228
  try {
3228
- Ii(Z.el, J);
3229
+ Pi(Z.el, J);
3229
3230
  } catch (B) {
3230
3231
  console.warn(
3231
3232
  `[LiveLayer] fill_form: failed to set "${j}".`,
@@ -3247,25 +3248,25 @@ const Hi = /* @__PURE__ */ new Set([
3247
3248
  return;
3248
3249
  }
3249
3250
  _t.current.playConfirmation();
3250
- const $ = Nn(document, A);
3251
- if (!$) {
3251
+ const H = Mn(document, A);
3252
+ if (!H) {
3252
3253
  console.warn(
3253
3254
  `[LiveLayer] submit_form: no <form> matched id="${A}" (or matching name / data-ll-intent slug).`
3254
3255
  );
3255
3256
  return;
3256
3257
  }
3257
- if ($.closest('[data-ll-private="true"], [data-ll-skip], .ll-widget')) {
3258
+ if (H.closest('[data-ll-private="true"], [data-ll-skip], .ll-widget')) {
3258
3259
  console.warn(
3259
3260
  "[LiveLayer] submit_form: refusing to submit a form in a private / opted-out subtree."
3260
3261
  );
3261
3262
  return;
3262
3263
  }
3263
- const V = typeof u.requestId == "string" ? u.requestId : void 0, j = (Se = Le.current) == null ? void 0 : Se.call(Le), J = (se) => {
3264
- const me = j, Ze = me == null ? void 0 : me.localParticipant;
3265
- if (Ze != null && Ze.publishData)
3264
+ const Y = typeof u.requestId == "string" ? u.requestId : void 0, j = (Ee = Le.current) == null ? void 0 : Ee.call(Le), J = (ce) => {
3265
+ const he = j, Ke = he == null ? void 0 : he.localParticipant;
3266
+ if (Ke != null && Ke.publishData)
3266
3267
  try {
3267
- const rr = V ? { ...se, requestId: V } : se, ir = new TextEncoder().encode(JSON.stringify(rr));
3268
- Ze.publishData(ir, { reliable: !0 });
3268
+ const lr = Y ? { ...ce, requestId: Y } : ce, ar = new TextEncoder().encode(JSON.stringify(lr));
3269
+ Ke.publishData(ar, { reliable: !0 });
3269
3270
  } catch {
3270
3271
  }
3271
3272
  };
@@ -3273,11 +3274,11 @@ const Hi = /* @__PURE__ */ new Set([
3273
3274
  const B = () => {
3274
3275
  Z = !0, J({ type: "form_submitted", formId: A });
3275
3276
  };
3276
- $.addEventListener("submit", B, { once: !0 });
3277
+ H.addEventListener("submit", B, { once: !0 });
3277
3278
  try {
3278
- typeof $.requestSubmit == "function" ? $.requestSubmit() : $.submit();
3279
- } catch (se) {
3280
- console.warn("[LiveLayer] submit_form: requestSubmit threw.", se), $.removeEventListener("submit", B), J({
3279
+ typeof H.requestSubmit == "function" ? H.requestSubmit() : H.submit();
3280
+ } catch (ce) {
3281
+ console.warn("[LiveLayer] submit_form: requestSubmit threw.", ce), H.removeEventListener("submit", B), J({
3281
3282
  type: "form_submit_blocked",
3282
3283
  formId: A,
3283
3284
  reason: "exception"
@@ -3285,7 +3286,7 @@ const Hi = /* @__PURE__ */ new Set([
3285
3286
  return;
3286
3287
  }
3287
3288
  setTimeout(() => {
3288
- Z || ($.removeEventListener("submit", B), J({
3289
+ Z || (H.removeEventListener("submit", B), J({
3289
3290
  type: "form_submit_blocked",
3290
3291
  formId: A,
3291
3292
  reason: "validation"
@@ -3298,41 +3299,41 @@ const Hi = /* @__PURE__ */ new Set([
3298
3299
  ke("request_routes", "read_page");
3299
3300
  return;
3300
3301
  }
3301
- const A = typeof u.requestId == "string" ? u.requestId : void 0, V = (ft = Le.current) == null ? void 0 : ft.call(Le), j = V == null ? void 0 : V.localParticipant;
3302
+ const A = typeof u.requestId == "string" ? u.requestId : void 0, Y = (ut = Le.current) == null ? void 0 : ut.call(Le), j = Y == null ? void 0 : Y.localParticipant;
3302
3303
  if (!(j != null && j.publishData)) return;
3303
3304
  const J = (B) => {
3304
3305
  try {
3305
- const se = A ? { type: "routes", routes: B, requestId: A } : { type: "routes", routes: B }, me = new TextEncoder().encode(JSON.stringify(se));
3306
- j.publishData(me, { reliable: !0 });
3307
- } catch (se) {
3308
- console.warn("[LiveLayer] request_routes: publishData failed.", se);
3306
+ const ce = A ? { type: "routes", routes: B, requestId: A } : { type: "routes", routes: B }, he = new TextEncoder().encode(JSON.stringify(ce));
3307
+ j.publishData(he, { reliable: !0 });
3308
+ } catch (ce) {
3309
+ console.warn("[LiveLayer] request_routes: publishData failed.", ce);
3309
3310
  }
3310
- }, Z = Gt.current;
3311
+ }, Z = Kt.current;
3311
3312
  if (Z) {
3312
3313
  try {
3313
- const B = Z(), se = (me) => {
3314
- if (!Array.isArray(me)) {
3314
+ const B = Z(), ce = (he) => {
3315
+ if (!Array.isArray(he)) {
3315
3316
  J([]);
3316
3317
  return;
3317
3318
  }
3318
- J(me.map(Li).slice(0, 200));
3319
+ J(he.map(Si).slice(0, 200));
3319
3320
  };
3320
- B instanceof Promise ? B.then(se).catch((me) => {
3321
+ B instanceof Promise ? B.then(ce).catch((he) => {
3321
3322
  console.warn(
3322
3323
  "[LiveLayer] getRoutes rejected; falling back to DOM walker.",
3323
- me
3324
- ), J(Ot());
3325
- }) : se(B);
3324
+ he
3325
+ ), J(Bt());
3326
+ }) : ce(B);
3326
3327
  } catch (B) {
3327
3328
  console.warn(
3328
3329
  "[LiveLayer] getRoutes threw; falling back to DOM walker.",
3329
3330
  B
3330
- ), J(Ot());
3331
+ ), J(Bt());
3331
3332
  }
3332
3333
  return;
3333
3334
  }
3334
3335
  try {
3335
- J(Ot());
3336
+ J(Bt());
3336
3337
  } catch (B) {
3337
3338
  console.warn("[LiveLayer] request_routes: extractRoutes threw.", B);
3338
3339
  }
@@ -3384,100 +3385,100 @@ const Hi = /* @__PURE__ */ new Set([
3384
3385
  } catch {
3385
3386
  }
3386
3387
  try {
3387
- Be == null || Be(
3388
+ ze == null || ze(
3388
3389
  A
3389
3390
  );
3390
- } catch ($) {
3391
- console.warn("[LiveLayer] onCollect threw.", $);
3391
+ } catch (H) {
3392
+ console.warn("[LiveLayer] onCollect threw.", H);
3392
3393
  }
3393
3394
  return;
3394
3395
  }
3395
- Hi.has(u.type) || De == null || De(u);
3396
+ Wi.has(u.type) || qe == null || qe(u);
3396
3397
  }
3397
3398
  },
3398
- [De, Pe, Be]
3399
- ), ae = pr({
3400
- agentId: W ? "__controlled__" : st,
3399
+ [qe, De, ze]
3400
+ ), se = gr({
3401
+ agentId: F ? "__controlled__" : it,
3401
3402
  baseUrl: o,
3402
3403
  apiKey: l,
3403
3404
  sessionEndpoint: s,
3404
3405
  sessionBody: a,
3405
- onDataMessage: W ? void 0 : ut
3406
+ onDataMessage: F ? void 0 : st
3406
3407
  });
3407
- P(() => {
3408
- if (W != null && W.subscribeToDataMessages)
3409
- return W.subscribeToDataMessages(ut);
3410
- }, [W, ut]), Le.current = () => {
3411
- var x;
3412
- return (x = ae.getRoom) == null ? void 0 : x.call(ae);
3413
- }, P(() => {
3414
- var re;
3408
+ T(() => {
3409
+ if (F != null && F.subscribeToDataMessages)
3410
+ return F.subscribeToDataMessages(st);
3411
+ }, [F, st]), Le.current = () => {
3412
+ var v;
3413
+ return (v = se.getRoom) == null ? void 0 : v.call(se);
3414
+ }, T(() => {
3415
+ var ie;
3415
3416
  if (typeof window > "u") return;
3416
- const x = ((re = window.location) == null ? void 0 : re.hostname) || "";
3417
- if (x === "localhost" || x === "127.0.0.1" || x === "0.0.0.0" || x.endsWith(".local") || x.endsWith(".test"))
3418
- return window.__livelayerSimulateCommand = (ue) => {
3417
+ const v = ((ie = window.location) == null ? void 0 : ie.hostname) || "";
3418
+ if (v === "localhost" || v === "127.0.0.1" || v === "0.0.0.0" || v.endsWith(".local") || v.endsWith(".test"))
3419
+ return window.__livelayerSimulateCommand = (de) => {
3419
3420
  try {
3420
- ut(ue);
3421
- } catch (Se) {
3422
- console.warn("[LiveLayer] simulate-command threw:", Se);
3421
+ st(de);
3422
+ } catch (Ee) {
3423
+ console.warn("[LiveLayer] simulate-command threw:", Ee);
3423
3424
  }
3424
3425
  }, () => {
3425
3426
  delete window.__livelayerSimulateCommand;
3426
3427
  };
3427
- }, [ut]);
3428
- const N = nt(() => W ? {
3429
- connectionState: W.connectionState,
3430
- agentState: W.agentState,
3431
- transcript: W.transcript,
3432
- videoElement: W.videoElement,
3433
- audioElement: W.audioElement,
3434
- canResume: W.canResume,
3435
- error: W.error,
3428
+ }, [st]);
3429
+ const L = et(() => F ? {
3430
+ connectionState: F.connectionState,
3431
+ agentState: F.agentState,
3432
+ transcript: F.transcript,
3433
+ videoElement: F.videoElement,
3434
+ audioElement: F.audioElement,
3435
+ canResume: F.canResume,
3436
+ error: F.error,
3436
3437
  agentConfig: null,
3437
3438
  connect: async () => {
3438
- await W.onConnect();
3439
+ await F.onConnect();
3439
3440
  },
3440
- disconnect: () => W.onDisconnect(),
3441
+ disconnect: () => F.onDisconnect(),
3441
3442
  // Dummy getRoom for shape compatibility — controlled consumers own the Room.
3442
3443
  // Internal session's getRoom returns null when no real connect has happened,
3443
3444
  // so we reuse its reference for type consistency.
3444
- getRoom: ae.getRoom,
3445
+ getRoom: se.getRoom,
3445
3446
  isControlled: !0
3446
3447
  } : {
3447
- connectionState: ae.connectionState,
3448
- agentState: ae.agentState,
3449
- transcript: ae.transcript,
3450
- videoElement: ae.videoElement,
3451
- audioElement: ae.audioElement,
3452
- canResume: ae.canResume,
3453
- error: ae.error,
3454
- agentConfig: ae.agentConfig,
3455
- connect: ae.connect,
3456
- disconnect: ae.disconnect,
3457
- getRoom: ae.getRoom,
3448
+ connectionState: se.connectionState,
3449
+ agentState: se.agentState,
3450
+ transcript: se.transcript,
3451
+ videoElement: se.videoElement,
3452
+ audioElement: se.audioElement,
3453
+ canResume: se.canResume,
3454
+ error: se.error,
3455
+ agentConfig: se.agentConfig,
3456
+ connect: se.connect,
3457
+ disconnect: se.disconnect,
3458
+ getRoom: se.getRoom,
3458
3459
  isControlled: !1
3459
- }, [W, ae]), Xt = I(N);
3460
- Xt.current = N;
3461
- const Kt = I(W);
3462
- Kt.current = W, lr(
3460
+ }, [F, se]), Jt = I(L);
3461
+ Jt.current = L;
3462
+ const Zt = I(F);
3463
+ Zt.current = F, cr(
3463
3464
  r,
3464
3465
  () => ({
3465
- sendData: async (x) => {
3466
- var Se, ft;
3467
- const u = Kt.current;
3466
+ sendData: async (v) => {
3467
+ var Ee, ut;
3468
+ const u = Zt.current;
3468
3469
  if (u != null && u.publishData) {
3469
3470
  try {
3470
- await u.publishData(x);
3471
+ await u.publishData(v);
3471
3472
  } catch (A) {
3472
3473
  console.warn("[AvatarWidget] sendData (controlled) failed:", A);
3473
3474
  }
3474
3475
  return;
3475
3476
  }
3476
- const re = (ft = (Se = Xt.current) == null ? void 0 : Se.getRoom) == null ? void 0 : ft.call(Se), ue = re == null ? void 0 : re.localParticipant;
3477
- if (ue != null && ue.publishData)
3477
+ const ie = (ut = (Ee = Jt.current) == null ? void 0 : Ee.getRoom) == null ? void 0 : ut.call(Ee), de = ie == null ? void 0 : ie.localParticipant;
3478
+ if (de != null && de.publishData)
3478
3479
  try {
3479
- const A = new TextEncoder().encode(JSON.stringify(x));
3480
- await ue.publishData(A, { reliable: !0 });
3480
+ const A = new TextEncoder().encode(JSON.stringify(v));
3481
+ await de.publishData(A, { reliable: !0 });
3481
3482
  } catch (A) {
3482
3483
  console.warn("[AvatarWidget] sendData failed:", A);
3483
3484
  }
@@ -3485,268 +3486,293 @@ const Hi = /* @__PURE__ */ new Set([
3485
3486
  }),
3486
3487
  []
3487
3488
  );
3488
- const Jt = I(null);
3489
- P(() => {
3490
- const x = N.videoElement, u = Jt.current;
3491
- if (!(!x || !u))
3492
- return u.appendChild(x), () => {
3493
- x.parentNode === u && u.removeChild(x);
3489
+ const Qt = I(null);
3490
+ T(() => {
3491
+ const v = L.videoElement, u = Qt.current;
3492
+ if (!(!v || !u))
3493
+ return u.appendChild(v), () => {
3494
+ v.parentNode === u && u.removeChild(v);
3494
3495
  };
3495
- }, [N.videoElement]), P(() => {
3496
- const x = N.audioElement;
3497
- if (!x) return;
3496
+ }, [L.videoElement]);
3497
+ const [Ge, xt] = M(!1);
3498
+ T(() => {
3499
+ if (!z) {
3500
+ xt(!0);
3501
+ return;
3502
+ }
3503
+ L.agentState === "speaking" && !Ge && xt(!0);
3504
+ }, [z, L.agentState, Ge]), T(() => {
3505
+ if (!z) return;
3506
+ const v = L.connectionState;
3507
+ (v === "disconnected" || v === "idle") && xt(!1);
3508
+ }, [z, L.connectionState]), T(() => {
3509
+ if (!z || !L.videoElement || Ge) return;
3510
+ const v = setTimeout(() => xt(!0), 5e3);
3511
+ return () => clearTimeout(v);
3512
+ }, [z, L.videoElement, Ge]), T(() => {
3513
+ const v = L.videoElement;
3514
+ if (v) {
3515
+ if (!z) {
3516
+ v.style.filter = "";
3517
+ return;
3518
+ }
3519
+ v.style.transition = "filter 500ms ease-out", v.style.filter = Ge ? "" : "blur(8px)";
3520
+ }
3521
+ }, [z, L.videoElement, Ge]), T(() => {
3522
+ const v = L.audioElement;
3523
+ if (!v) return;
3498
3524
  const u = document.createElement("div");
3499
- u.className = "ll-audio-sink", u.setAttribute("aria-hidden", "true"), u.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;clip:rect(0 0 0 0);pointer-events:none;", u.appendChild(x), document.body.appendChild(u), He.attach(x);
3500
- const re = x.play();
3501
- return re && typeof re.catch == "function" && re.catch((ue) => {
3502
- (ue == null ? void 0 : ue.name) === "NotAllowedError" && Ge(!0);
3525
+ u.className = "ll-audio-sink", u.setAttribute("aria-hidden", "true"), u.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;clip:rect(0 0 0 0);pointer-events:none;", u.appendChild(v), document.body.appendChild(u), Me.attach(v);
3526
+ const ie = v.play();
3527
+ return ie && typeof ie.catch == "function" && ie.catch((de) => {
3528
+ (de == null ? void 0 : de.name) === "NotAllowedError" && Ye(!0);
3503
3529
  }), () => {
3504
- He.detach(), x.parentNode === u && u.removeChild(x), u.parentNode === document.body && document.body.removeChild(u);
3530
+ Me.detach(), v.parentNode === u && u.removeChild(v), u.parentNode === document.body && document.body.removeChild(u);
3505
3531
  };
3506
- }, [N.audioElement]);
3507
- const ye = gr({
3532
+ }, [L.audioElement]);
3533
+ const ve = br({
3508
3534
  gateUntilAgentReady: !0,
3509
- agentState: N.agentState
3535
+ agentState: L.agentState
3510
3536
  });
3511
- P(() => {
3512
- if (N.isControlled || N.connectionState !== "connected") return;
3513
- const x = N.getRoom();
3514
- if (x)
3515
- return ye.setupMic(x).then(() => {
3516
- const u = ye.getMicStream();
3517
- u && He.attachStream(u, "mic");
3537
+ T(() => {
3538
+ if (L.isControlled || L.connectionState !== "connected") return;
3539
+ const v = L.getRoom();
3540
+ if (v)
3541
+ return ve.setupMic(v).then(() => {
3542
+ const u = ve.getMicStream();
3543
+ u && Me.attachStream(u, "mic");
3518
3544
  }).catch(() => {
3519
3545
  }), () => {
3520
- He.detachSlot("mic"), ye.teardownMic();
3546
+ Me.detachSlot("mic"), ve.teardownMic();
3521
3547
  };
3522
- }, [N.isControlled, N.connectionState]), P(() => {
3548
+ }, [L.isControlled, L.connectionState]), T(() => {
3523
3549
  var u;
3524
- if (N.connectionState !== "connected") return;
3525
- const x = N.isControlled ? (u = W == null ? void 0 : W.getRoom) == null ? void 0 : u.call(W) : N.getRoom();
3526
- if (x)
3527
- return _e.attachRoom(x), Oe.attachRoom(x), N.isControlled && ye.attachRoom(x), xe.refresh(), () => {
3528
- _e.teardown(), Oe.teardown();
3550
+ if (L.connectionState !== "connected") return;
3551
+ const v = L.isControlled ? (u = F == null ? void 0 : F.getRoom) == null ? void 0 : u.call(F) : L.getRoom();
3552
+ if (v)
3553
+ return Se.attachRoom(v), ye.attachRoom(v), L.isControlled && ve.attachRoom(v), xe.refresh(), () => {
3554
+ Se.teardown(), ye.teardown();
3529
3555
  };
3530
- }, [N.isControlled, N.connectionState, W]), P(() => {
3531
- const x = N.audioElement;
3532
- x && (x.muted = At);
3533
- }, [N.audioElement, At]);
3534
- const Un = L((x) => {
3535
- const u = { type: "user_message", text: x };
3536
- if (W != null && W.publishData) {
3556
+ }, [L.isControlled, L.connectionState, F]), T(() => {
3557
+ const v = L.audioElement;
3558
+ v && (v.muted = Rt);
3559
+ }, [L.audioElement, Rt]);
3560
+ const Yn = C((v) => {
3561
+ const u = { type: "user_message", text: v };
3562
+ if (F != null && F.publishData) {
3537
3563
  try {
3538
- W.publishData(u);
3564
+ F.publishData(u);
3539
3565
  } catch {
3540
3566
  }
3541
3567
  return;
3542
3568
  }
3543
- const re = N.getRoom();
3544
- if (re)
3569
+ const ie = L.getRoom();
3570
+ if (ie)
3545
3571
  try {
3546
- const ue = new TextEncoder().encode(JSON.stringify(u));
3547
- re.localParticipant.publishData(ue, { reliable: !0 });
3572
+ const de = new TextEncoder().encode(JSON.stringify(u));
3573
+ ie.localParticipant.publishData(de, { reliable: !0 });
3548
3574
  } catch {
3549
3575
  }
3550
- }, [N, W]), jn = L(() => {
3551
- qn((x) => !x);
3576
+ }, [L, F]), Gn = C(() => {
3577
+ Vn((v) => !v);
3552
3578
  }, []);
3553
- P(() => {
3554
- Te == null || Te(N.connectionState), N.connectionState === "connected" ? Me == null || Me() : N.connectionState === "disconnected" && (Fe == null || Fe());
3555
- }, [N.connectionState, Me, Fe, Te]), P(() => {
3556
- Ie == null || Ie(N.transcript);
3557
- }, [N.transcript, Ie]), P(() => {
3558
- Re == null || Re(N.agentState);
3559
- }, [N.agentState, Re]), P(() => {
3560
- wt.setThinking(N.agentState === "thinking");
3561
- }, [N.agentState, wt]);
3562
- const Zt = I(!1);
3563
- P(() => {
3564
- !v || Zt.current || at && N.connectionState === "idle" && (Zt.current = !0, N.connect());
3565
- }, [v, N.connectionState, N, at]);
3566
- const Vn = L(
3567
- (x) => {
3568
- const u = y == null ? void 0 : y.find((re) => re.id === x);
3569
- u && (w(!1), x !== Ne && (bt(!0), N.disconnect(), $e || St(x), m == null || m(u)));
3579
+ T(() => {
3580
+ Pe == null || Pe(L.connectionState), L.connectionState === "connected" ? Be == null || Be() : L.connectionState === "disconnected" && (Ie == null || Ie());
3581
+ }, [L.connectionState, Be, Ie, Pe]), T(() => {
3582
+ Re == null || Re(L.transcript);
3583
+ }, [L.transcript, Re]), T(() => {
3584
+ Te == null || Te(L.agentState);
3585
+ }, [L.agentState, Te]), T(() => {
3586
+ wt.setThinking(L.agentState === "thinking");
3587
+ }, [L.agentState, wt]);
3588
+ const en = I(!1);
3589
+ T(() => {
3590
+ !b || en.current || He && L.connectionState === "idle" && (en.current = !0, L.connect());
3591
+ }, [b, L.connectionState, L, He]);
3592
+ const Xn = C(
3593
+ (v) => {
3594
+ const u = y == null ? void 0 : y.find((ie) => ie.id === v);
3595
+ u && (re(!1), v !== Oe && (at(!0), L.disconnect(), Ne || yt(v), m == null || m(u)));
3570
3596
  },
3571
3597
  [
3572
3598
  y,
3599
+ Oe,
3600
+ L,
3573
3601
  Ne,
3574
- N,
3575
- $e,
3576
3602
  m
3577
3603
  ]
3578
3604
  );
3579
- P(() => {
3580
- Xe && N.connectionState === "connected" && bt(!1);
3581
- }, [N.connectionState, Xe]), P(() => {
3582
- if (!Ke) return;
3583
- const x = (u) => {
3584
- u.key === "Escape" && w(!1);
3605
+ T(() => {
3606
+ lt && L.connectionState === "connected" && at(!1);
3607
+ }, [L.connectionState, lt]), T(() => {
3608
+ if (!_) return;
3609
+ const v = (u) => {
3610
+ u.key === "Escape" && re(!1);
3585
3611
  };
3586
- return window.addEventListener("keydown", x), () => window.removeEventListener("keydown", x);
3587
- }, [Ke]);
3588
- const Yn = !!K || !!(fe != null && fe.avatarImageUrl) || N.isControlled, dt = _r(st, o, Yn);
3589
- lt === void 0 && ((nn = dt.info) != null && nn.capabilities) && (Pt.current = dt.info.capabilities);
3590
- const xt = (fe == null ? void 0 : fe.name) ?? oe ?? ((rn = N.agentConfig) == null ? void 0 : rn.name) ?? ((on = dt.info) == null ? void 0 : on.name) ?? "Live Layer", Dt = (fe == null ? void 0 : fe.avatarImageUrl) ?? K ?? ((ln = N.agentConfig) == null ? void 0 : ln.avatarImageUrl) ?? ((an = dt.info) == null ? void 0 : an.avatarImageUrl) ?? null, Gn = D ?? ((sn = N.agentConfig) == null ? void 0 : sn.idleLoopUrl) ?? ((cn = dt.info) == null ? void 0 : cn.idleLoopUrl) ?? null, Xn = F ?? null, Kn = L(() => we("expanded"), [we]), Jn = L(
3591
- () => we("minimized"),
3592
- [we]
3593
- ), Qt = L(() => {
3594
- N.disconnect(), we("hidden");
3595
- }, [N, we]), Zn = L(() => {
3596
- const x = N.audioElement;
3597
- x && x.play().then(() => Ge(!1)).catch(() => {
3612
+ return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
3613
+ }, [_]);
3614
+ const Kn = !!K || !!(ue != null && ue.avatarImageUrl) || L.isControlled, ct = Cr(it, o, Kn);
3615
+ We === void 0 && ((on = ct.info) != null && on.capabilities) && ($t.current = ct.info.capabilities);
3616
+ const Lt = (ue == null ? void 0 : ue.name) ?? ae ?? ((ln = L.agentConfig) == null ? void 0 : ln.name) ?? ((an = ct.info) == null ? void 0 : an.name) ?? "Live Layer", Ht = (ue == null ? void 0 : ue.avatarImageUrl) ?? K ?? ((sn = L.agentConfig) == null ? void 0 : sn.avatarImageUrl) ?? ((cn = ct.info) == null ? void 0 : cn.avatarImageUrl) ?? null, Jn = D ?? ((un = L.agentConfig) == null ? void 0 : un.idleLoopUrl) ?? ((dn = ct.info) == null ? void 0 : dn.idleLoopUrl) ?? null, Zn = W ?? null, Qn = C(() => _e("expanded"), [_e]), er = C(
3617
+ () => _e("minimized"),
3618
+ [_e]
3619
+ ), tn = C(() => {
3620
+ L.disconnect(), _e("hidden");
3621
+ }, [L, _e]), tr = C(() => {
3622
+ const v = L.audioElement;
3623
+ v && v.play().then(() => Ye(!1)).catch(() => {
3598
3624
  });
3599
- }, [N.audioElement]), Qn = L(() => {
3600
- Ge(!1), N.connect();
3601
- }, [N]), Je = {
3602
- ...ze,
3603
- ...ce ? {} : { zIndex: Ue }
3625
+ }, [L.audioElement]), nr = C(() => {
3626
+ Ye(!1), L.connect();
3627
+ }, [L]), Xe = {
3628
+ ...Ue,
3629
+ ...le ? {} : { zIndex: we }
3604
3630
  };
3605
- z.primaryColor && (Je["--ll-color-primary"] = z.primaryColor), z.accentColor && (Je["--ll-color-accent"] = z.accentColor), z.backgroundColor && (Je["--ll-color-bg"] = z.backgroundColor), z.textColor && (Je["--ll-color-fg"] = z.textColor);
3606
- const er = {
3607
- ...Je,
3608
- ...Ee.style
3609
- }, tr = [
3631
+ $.primaryColor && (Xe["--ll-color-primary"] = $.primaryColor), $.accentColor && (Xe["--ll-color-accent"] = $.accentColor), $.backgroundColor && (Xe["--ll-color-bg"] = $.backgroundColor), $.textColor && (Xe["--ll-color-fg"] = $.textColor);
3632
+ const rr = {
3633
+ ...Xe,
3634
+ ...Ae.style
3635
+ }, ir = [
3610
3636
  "ll-widget",
3611
- `ll-widget--${he}`,
3637
+ `ll-widget--${ge}`,
3612
3638
  `ll-widget--${pe ? "mobile" : "desktop"}`,
3613
- Ee.hasGeometry ? "ll-widget--has-geometry" : null,
3614
- Ee.isDragging ? "is-dragging" : null,
3615
- Ee.isResizing ? "is-resizing" : null,
3616
- qe
3639
+ Ae.hasGeometry ? "ll-widget--has-geometry" : null,
3640
+ Ae.isDragging ? "is-dragging" : null,
3641
+ Ae.isResizing ? "is-resizing" : null,
3642
+ $e
3617
3643
  ].filter(Boolean).join(" ");
3618
- if (!at) return null;
3619
- const nr = /* @__PURE__ */ n(
3644
+ if (!He) return null;
3645
+ const or = /* @__PURE__ */ n(
3620
3646
  "div",
3621
3647
  {
3622
- className: tr,
3623
- style: er,
3624
- "data-display-mode": he,
3625
- "data-position": _,
3648
+ className: ir,
3649
+ style: rr,
3650
+ "data-display-mode": ge,
3651
+ "data-position": x,
3626
3652
  "data-experience-mode": d === "EMBEDDED" ? "embedded" : "widget",
3627
- children: he === "expanded" && /* @__PURE__ */ n(
3628
- si,
3653
+ children: ge === "expanded" && /* @__PURE__ */ n(
3654
+ di,
3629
3655
  {
3630
- position: _,
3656
+ position: x,
3631
3657
  isMobile: pe,
3632
- agentName: xt,
3633
- avatarImageUrl: Dt,
3634
- idleLoopUrl: Gn,
3635
- greeting: Xn,
3636
- branding: z,
3658
+ agentName: Lt,
3659
+ avatarImageUrl: Ht,
3660
+ idleLoopUrl: Jn,
3661
+ greeting: Zn,
3662
+ branding: $,
3637
3663
  teamMembers: y,
3638
- currentTeamMemberId: Ne,
3639
- isSwitchingTeamMember: Xe,
3640
- teamSwitcherOpen: Ke,
3641
- onToggleTeamSwitcher: () => w((x) => !x),
3642
- onSelectTeamMember: Vn,
3643
- connectionState: N.connectionState,
3644
- agentState: N.agentState,
3645
- transcript: N.transcript,
3646
- isMuted: ye.isMuted,
3664
+ currentTeamMemberId: Oe,
3665
+ isSwitchingTeamMember: lt,
3666
+ teamSwitcherOpen: _,
3667
+ onToggleTeamSwitcher: () => re((v) => !v),
3668
+ onSelectTeamMember: Xn,
3669
+ connectionState: L.connectionState,
3670
+ agentState: L.agentState,
3671
+ transcript: L.transcript,
3672
+ isMuted: ve.isMuted,
3647
3673
  micDevices: xe.mics,
3648
- activeMicId: ye.activeDeviceId,
3649
- isCameraEnabled: _e.isEnabled,
3650
- cameraPreviewEl: _e.previewEl,
3674
+ activeMicId: ve.activeDeviceId,
3675
+ isCameraEnabled: Se.isEnabled,
3676
+ cameraPreviewEl: Se.previewEl,
3651
3677
  cameraDevices: xe.cameras,
3652
- activeCameraId: _e.activeDeviceId,
3653
- isScreenShareEnabled: Oe.isEnabled,
3654
- screenPreviewEl: Oe.previewEl,
3655
- isSpeakerMuted: At,
3678
+ activeCameraId: Se.activeDeviceId,
3679
+ isScreenShareEnabled: ye.isEnabled,
3680
+ screenPreviewEl: ye.previewEl,
3681
+ isSpeakerMuted: Rt,
3656
3682
  allowCamera: G,
3657
3683
  allowScreenShare: f,
3658
- allowTyping: S,
3659
- showMinimize: pe && !ce ? !1 : yt,
3660
- showClose: vt,
3661
- chromeless: X,
3662
- compactControls: Nt,
3663
- transforming: te,
3664
- transformingLabel: ie,
3665
- languageMenuOpen: le,
3666
- onToggleLanguageMenu: () => Bn((x) => !x),
3667
- needsUserGesture: Ae,
3668
- canResume: N.canResume,
3669
- micError: ye.micError,
3670
- error: N.error,
3671
- avatarVideoContainerRef: Jt,
3672
- agentVideoEl: N.videoElement,
3673
- onConnect: () => void N.connect(),
3674
- onDisconnect: () => N.disconnect(),
3675
- onRetry: Qn,
3676
- onResumeAudio: Zn,
3677
- onToggleMute: ye.toggleMute,
3678
- onSwitchMicDevice: (x) => void ye.switchDevice(x),
3679
- onToggleCamera: () => void _e.toggle(),
3680
- onSwitchCameraDevice: (x) => void _e.switchDevice(x),
3681
- onToggleScreenShare: () => void Oe.toggle(),
3682
- onToggleSpeaker: jn,
3683
- onSendMessage: Un,
3684
- onMinimize: Jn,
3685
- onClose: Qt,
3686
- onClearMicError: ye.clearError,
3687
- dragHandleProps: Ee.dragHandleProps,
3688
- resizeHandleProps: Ee.resizeHandleProps
3684
+ allowTyping: N,
3685
+ showMinimize: pe && !le ? !1 : vt,
3686
+ showClose: At,
3687
+ chromeless: ee,
3688
+ compactControls: Mt,
3689
+ transforming: oe,
3690
+ transformingLabel: U,
3691
+ languageMenuOpen: Un,
3692
+ onToggleLanguageMenu: () => jn((v) => !v),
3693
+ needsUserGesture: bt,
3694
+ canResume: L.canResume,
3695
+ micError: ve.micError,
3696
+ error: L.error,
3697
+ avatarVideoContainerRef: Qt,
3698
+ agentVideoEl: L.videoElement,
3699
+ onConnect: () => void L.connect(),
3700
+ onDisconnect: () => L.disconnect(),
3701
+ onRetry: nr,
3702
+ onResumeAudio: tr,
3703
+ onToggleMute: ve.toggleMute,
3704
+ onSwitchMicDevice: (v) => void ve.switchDevice(v),
3705
+ onToggleCamera: () => void Se.toggle(),
3706
+ onSwitchCameraDevice: (v) => void Se.switchDevice(v),
3707
+ onToggleScreenShare: () => void ye.toggle(),
3708
+ onToggleSpeaker: Gn,
3709
+ onSendMessage: Yn,
3710
+ onMinimize: er,
3711
+ onClose: tn,
3712
+ onClearMicError: ve.clearError,
3713
+ dragHandleProps: Ae.dragHandleProps,
3714
+ resizeHandleProps: Ae.resizeHandleProps
3689
3715
  }
3690
3716
  )
3691
3717
  }
3692
- ), en = !ce && (he === "hidden" || he === "minimized") ? /* @__PURE__ */ C(
3718
+ ), nn = !le && (ge === "hidden" || ge === "minimized") ? /* @__PURE__ */ k(
3693
3719
  "div",
3694
3720
  {
3695
3721
  className: [
3696
3722
  "ll-widget",
3697
3723
  "ll-widget--floating",
3698
- `ll-widget--${he}`,
3724
+ `ll-widget--${ge}`,
3699
3725
  `ll-widget--${pe ? "mobile" : "desktop"}`
3700
3726
  ].join(" "),
3701
- style: Je,
3702
- "data-display-mode": he,
3703
- "data-position": _,
3727
+ style: Xe,
3728
+ "data-display-mode": ge,
3729
+ "data-position": x,
3704
3730
  children: [
3705
- he === "hidden" && /* @__PURE__ */ n(
3706
- Jr,
3731
+ ge === "hidden" && /* @__PURE__ */ n(
3732
+ ei,
3707
3733
  {
3708
- position: _,
3734
+ position: x,
3709
3735
  isMobile: pe,
3710
- isSpeaking: N.agentState === "speaking",
3711
- onExpand: () => we("expanded"),
3712
- label: `Open ${xt} widget`,
3713
- avatarImageUrl: Dt,
3714
- agentName: xt,
3715
- containerEl: Q
3736
+ isSpeaking: L.agentState === "speaking",
3737
+ onExpand: () => _e("expanded"),
3738
+ label: `Open ${Lt} widget`,
3739
+ avatarImageUrl: Ht,
3740
+ agentName: Lt,
3741
+ containerEl: V
3716
3742
  }
3717
3743
  ),
3718
- he === "minimized" && /* @__PURE__ */ n(
3719
- Qr,
3744
+ ge === "minimized" && /* @__PURE__ */ n(
3745
+ ni,
3720
3746
  {
3721
- position: _,
3747
+ position: x,
3722
3748
  isMobile: pe,
3723
- agentName: xt,
3724
- avatarImageUrl: Dt,
3725
- agentState: N.agentState,
3726
- isMuted: ye.isMuted,
3727
- audioLevel: He,
3728
- onExpand: Kn,
3729
- onToggleMute: ye.toggleMute,
3730
- onClose: Qt
3749
+ agentName: Lt,
3750
+ avatarImageUrl: Ht,
3751
+ agentState: L.agentState,
3752
+ isMuted: ve.isMuted,
3753
+ audioLevel: Me,
3754
+ onExpand: Qn,
3755
+ onToggleMute: ve.toggleMute,
3756
+ onClose: tn
3731
3757
  }
3732
3758
  )
3733
3759
  ]
3734
3760
  }
3735
- ) : null, tn = Q ?? (typeof document < "u" ? document.body : null);
3736
- return /* @__PURE__ */ C(We, { children: [
3737
- nr,
3738
- en && tn && qt(en, tn)
3761
+ ) : null, rn = V ?? (typeof document < "u" ? document.body : null);
3762
+ return /* @__PURE__ */ k(Fe, { children: [
3763
+ or,
3764
+ nn && rn && Vt(nn, rn)
3739
3765
  ] });
3740
3766
  }
3741
3767
  );
3742
- Fn.displayName = "AvatarWidgetInner";
3743
- const Oi = Bt(
3768
+ qn.displayName = "AvatarWidgetInner";
3769
+ const Bi = jt(
3744
3770
  function(t, r) {
3745
- return /* @__PURE__ */ n(fr, { children: /* @__PURE__ */ n(Fn, { ...t, ref: r }) });
3771
+ return /* @__PURE__ */ n(mr, { children: /* @__PURE__ */ n(qn, { ...t, ref: r }) });
3746
3772
  }
3747
3773
  );
3748
- Oi.displayName = "AvatarWidget";
3749
- const Ki = ({
3774
+ Bi.displayName = "AvatarWidget";
3775
+ const Qi = ({
3750
3776
  agentId: e,
3751
3777
  baseUrl: t,
3752
3778
  apiKey: r,
@@ -3757,24 +3783,24 @@ const Ki = ({
3757
3783
  }) => {
3758
3784
  const a = I(null), c = I(null), d = I(l);
3759
3785
  d.current = l;
3760
- const v = L((p) => {
3761
- var T;
3786
+ const b = C((p) => {
3787
+ var P;
3762
3788
  const h = p.detail;
3763
- (T = d.current) == null || T.call(d, h);
3789
+ (P = d.current) == null || P.call(d, h);
3764
3790
  }, []);
3765
- return P(() => {
3791
+ return T(() => {
3766
3792
  const p = a.current;
3767
3793
  if (!p) return;
3768
3794
  const h = document.createElement("livelayer-widget");
3769
- return h.setAttribute("agent-id", e), t && h.setAttribute("base-url", t), r && h.setAttribute("api-key", r), i && h.setAttribute("mode", i), h.addEventListener("agent-event", v), p.appendChild(h), c.current = h, () => {
3770
- h.removeEventListener("agent-event", v), p.removeChild(h), c.current = null;
3795
+ return h.setAttribute("agent-id", e), t && h.setAttribute("base-url", t), r && h.setAttribute("api-key", r), i && h.setAttribute("mode", i), h.addEventListener("agent-event", b), p.appendChild(h), c.current = h, () => {
3796
+ h.removeEventListener("agent-event", b), p.removeChild(h), c.current = null;
3771
3797
  };
3772
- }, [e]), P(() => {
3798
+ }, [e]), T(() => {
3773
3799
  c.current && (i ? c.current.setAttribute("mode", i) : c.current.removeAttribute("mode"));
3774
3800
  }, [i]), /* @__PURE__ */ n("div", { ref: a, className: o, style: s });
3775
- }, Ji = Bt(
3801
+ }, eo = jt(
3776
3802
  function({ id: t, intent: r, as: i = "div", className: l, style: o, children: s }, a) {
3777
- return ar(
3803
+ return ur(
3778
3804
  i,
3779
3805
  {
3780
3806
  ref: a,
@@ -3787,110 +3813,110 @@ const Ki = ({
3787
3813
  );
3788
3814
  }
3789
3815
  );
3790
- function Zi(e = {}) {
3791
- const { onFieldUpdate: t, onComplete: r, source: i = "all" } = e, [l, o] = M({}), [s, a] = M(!1), [c, d] = M(null), v = I(t), p = I(r), h = I(i);
3792
- P(() => {
3793
- v.current = t, p.current = r, h.current = i;
3816
+ function to(e = {}) {
3817
+ const { onFieldUpdate: t, onComplete: r, source: i = "all" } = e, [l, o] = M({}), [s, a] = M(!1), [c, d] = M(null), b = I(t), p = I(r), h = I(i);
3818
+ T(() => {
3819
+ b.current = t, p.current = r, h.current = i;
3794
3820
  }, [t, r, i]);
3795
- const T = L(() => {
3821
+ const P = C(() => {
3796
3822
  o({}), a(!1);
3797
3823
  }, []);
3798
- return P(() => {
3824
+ return T(() => {
3799
3825
  if (typeof window > "u") return;
3800
- const _ = (E) => {
3801
- var b, R;
3826
+ const x = (E) => {
3827
+ var w, R;
3802
3828
  const g = E.detail;
3803
3829
  if (g) {
3804
3830
  if (g.phase === "field") {
3805
3831
  if (h.current !== "all" && g.source !== h.current)
3806
3832
  return;
3807
3833
  a(!0), o(
3808
- (k) => k[g.fieldName] === g.value ? k : { ...k, [g.fieldName]: g.value }
3834
+ (S) => S[g.fieldName] === g.value ? S : { ...S, [g.fieldName]: g.value }
3809
3835
  );
3810
3836
  try {
3811
- (b = v.current) == null || b.call(v, g);
3812
- } catch (k) {
3813
- console.warn("[LiveLayer] useCollect onFieldUpdate threw.", k);
3837
+ (w = b.current) == null || w.call(b, g);
3838
+ } catch (S) {
3839
+ console.warn("[LiveLayer] useCollect onFieldUpdate threw.", S);
3814
3840
  }
3815
3841
  return;
3816
3842
  }
3817
3843
  if (g.phase === "complete") {
3818
- const k = g.result;
3819
- if (h.current !== "all" && k.source !== h.current)
3844
+ const S = g.result;
3845
+ if (h.current !== "all" && S.source !== h.current)
3820
3846
  return;
3821
- d(k), a(!1);
3847
+ d(S), a(!1);
3822
3848
  try {
3823
- (R = p.current) == null || R.call(p, k);
3849
+ (R = p.current) == null || R.call(p, S);
3824
3850
  } catch (y) {
3825
3851
  console.warn("[LiveLayer] useCollect onComplete threw.", y);
3826
3852
  }
3827
3853
  }
3828
3854
  }
3829
3855
  };
3830
- return document.addEventListener("ll-collected", _), () => document.removeEventListener("ll-collected", _);
3831
- }, []), { fields: l, isCollecting: s, lastResult: c, reset: T };
3856
+ return document.addEventListener("ll-collected", x), () => document.removeEventListener("ll-collected", x);
3857
+ }, []), { fields: l, isCollecting: s, lastResult: c, reset: P };
3832
3858
  }
3833
- let Mn = 1;
3834
- function Qi({
3859
+ let Rn = 1;
3860
+ function no({
3835
3861
  onMount: e,
3836
3862
  defaultOpen: t = !1,
3837
3863
  storageKey: r = "ll-debug-open"
3838
3864
  }) {
3839
- const [i, l] = M(t), [o, s] = M([]), [a, c] = M(""), [d, v] = M(!1), p = I(/* @__PURE__ */ new Set()), h = I([]), T = I(d);
3840
- T.current = d, P(() => {
3865
+ const [i, l] = M(t), [o, s] = M([]), [a, c] = M(""), [d, b] = M(!1), p = I(/* @__PURE__ */ new Set()), h = I([]), P = I(d);
3866
+ P.current = d, T(() => {
3841
3867
  try {
3842
3868
  const g = localStorage.getItem(r);
3843
3869
  g === "1" && l(!0), g === "0" && l(!1);
3844
3870
  } catch {
3845
3871
  }
3846
- }, [r]), P(() => {
3872
+ }, [r]), T(() => {
3847
3873
  try {
3848
3874
  localStorage.setItem(r, i ? "1" : "0");
3849
3875
  } catch {
3850
3876
  }
3851
- }, [i, r]), P(() => {
3852
- const g = (b) => {
3853
- (b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(), l((R) => !R));
3877
+ }, [i, r]), T(() => {
3878
+ const g = (w) => {
3879
+ (w.metaKey || w.ctrlKey) && w.shiftKey && w.key.toLowerCase() === "l" && (w.preventDefault(), l((R) => !R));
3854
3880
  };
3855
3881
  return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
3856
- }, []), P(() => {
3882
+ }, []), T(() => {
3857
3883
  const g = setInterval(() => {
3858
- if (h.current.length === 0 || T.current) return;
3859
- const b = h.current.splice(0, h.current.length);
3884
+ if (h.current.length === 0 || P.current) return;
3885
+ const w = h.current.splice(0, h.current.length);
3860
3886
  s(
3861
- (R) => [...b.reverse(), ...R].slice(0, 200)
3887
+ (R) => [...w.reverse(), ...R].slice(0, 200)
3862
3888
  );
3863
3889
  }, 100);
3864
3890
  return () => clearInterval(g);
3865
3891
  }, []);
3866
- const _ = I(!1);
3867
- if (P(() => {
3868
- !e || _.current || (_.current = !0, e((g) => {
3892
+ const x = I(!1);
3893
+ if (T(() => {
3894
+ !e || x.current || (x.current = !0, e((g) => {
3869
3895
  h.current.push({
3870
- id: Mn++,
3896
+ id: Rn++,
3871
3897
  ts: Date.now(),
3872
3898
  kind: "event",
3873
3899
  type: g.eventName,
3874
3900
  data: g.data
3875
3901
  });
3876
3902
  }));
3877
- }, [e]), P(() => {
3878
- const g = console.warn, b = console.log, R = (k, y) => function(...H) {
3903
+ }, [e]), T(() => {
3904
+ const g = console.warn, w = console.log, R = (S, y) => function(...O) {
3879
3905
  try {
3880
- const m = typeof H[0] == "string" ? H[0] : "";
3906
+ const m = typeof O[0] == "string" ? O[0] : "";
3881
3907
  m.startsWith("[LiveLayer]") && h.current.push({
3882
- id: Mn++,
3908
+ id: Rn++,
3883
3909
  ts: Date.now(),
3884
- kind: k,
3910
+ kind: S,
3885
3911
  type: m.slice(0, 120),
3886
- data: { args: H.slice(1).map((D) => Fi(D)) }
3912
+ data: { args: O.slice(1).map((D) => Ui(D)) }
3887
3913
  });
3888
3914
  } catch {
3889
3915
  }
3890
- return y.apply(this, H);
3916
+ return y.apply(this, O);
3891
3917
  };
3892
- return console.warn = R("warn", g), console.log = R("log", b), () => {
3893
- console.warn = g, console.log = b;
3918
+ return console.warn = R("warn", g), console.log = R("log", w), () => {
3919
+ console.warn = g, console.log = w;
3894
3920
  };
3895
3921
  }, []), !i)
3896
3922
  return /* @__PURE__ */ n(
@@ -3921,10 +3947,10 @@ function Qi({
3921
3947
  );
3922
3948
  const E = o.filter((g) => {
3923
3949
  if (!a) return !0;
3924
- const b = a.toLowerCase();
3925
- return g.type.toLowerCase().includes(b) || JSON.stringify(g.data || {}).toLowerCase().includes(b);
3950
+ const w = a.toLowerCase();
3951
+ return g.type.toLowerCase().includes(w) || JSON.stringify(g.data || {}).toLowerCase().includes(w);
3926
3952
  });
3927
- return /* @__PURE__ */ C(
3953
+ return /* @__PURE__ */ k(
3928
3954
  "div",
3929
3955
  {
3930
3956
  style: {
@@ -3946,7 +3972,7 @@ function Qi({
3946
3972
  overflow: "hidden"
3947
3973
  },
3948
3974
  children: [
3949
- /* @__PURE__ */ C(
3975
+ /* @__PURE__ */ k(
3950
3976
  "div",
3951
3977
  {
3952
3978
  style: {
@@ -3959,7 +3985,7 @@ function Qi({
3959
3985
  },
3960
3986
  children: [
3961
3987
  /* @__PURE__ */ n("span", { style: { fontWeight: 600, fontSize: 12 }, children: "LiveLayer debug" }),
3962
- /* @__PURE__ */ C("span", { style: { fontSize: 10, color: "rgba(255,255,255,0.4)" }, children: [
3988
+ /* @__PURE__ */ k("span", { style: { fontSize: 10, color: "rgba(255,255,255,0.4)" }, children: [
3963
3989
  o.length,
3964
3990
  " event",
3965
3991
  o.length === 1 ? "" : "s"
@@ -3969,8 +3995,8 @@ function Qi({
3969
3995
  "button",
3970
3996
  {
3971
3997
  type: "button",
3972
- onClick: () => v((g) => !g),
3973
- style: Wt(d ? "#f59e0b" : "transparent"),
3998
+ onClick: () => b((g) => !g),
3999
+ style: qt(d ? "#f59e0b" : "transparent"),
3974
4000
  title: "Pause / resume capture",
3975
4001
  children: d ? "▶ resume" : "⏸ pause"
3976
4002
  }
@@ -3982,7 +4008,7 @@ function Qi({
3982
4008
  onClick: () => {
3983
4009
  s([]), h.current = [];
3984
4010
  },
3985
- style: Wt("transparent"),
4011
+ style: qt("transparent"),
3986
4012
  title: "Clear buffer",
3987
4013
  children: "clear"
3988
4014
  }
@@ -3992,7 +4018,7 @@ function Qi({
3992
4018
  {
3993
4019
  type: "button",
3994
4020
  onClick: () => l(!1),
3995
- style: Wt("transparent"),
4021
+ style: qt("transparent"),
3996
4022
  "aria-label": "Close",
3997
4023
  title: "Close (Cmd/Ctrl + Shift + L)",
3998
4024
  children: "✕"
@@ -4028,7 +4054,7 @@ function Qi({
4028
4054
  overflowY: "auto",
4029
4055
  padding: "0 8px 8px"
4030
4056
  },
4031
- children: E.length === 0 ? /* @__PURE__ */ C(
4057
+ children: E.length === 0 ? /* @__PURE__ */ k(
4032
4058
  "div",
4033
4059
  {
4034
4060
  style: {
@@ -4059,12 +4085,12 @@ function Qi({
4059
4085
  ]
4060
4086
  }
4061
4087
  ) : E.map((g) => /* @__PURE__ */ n(
4062
- Wi,
4088
+ qi,
4063
4089
  {
4064
4090
  entry: g,
4065
4091
  expanded: p.current.has(g.id),
4066
4092
  onToggle: () => {
4067
- p.current.has(g.id) ? p.current.delete(g.id) : p.current.add(g.id), s((b) => [...b]);
4093
+ p.current.has(g.id) ? p.current.delete(g.id) : p.current.add(g.id), s((w) => [...w]);
4068
4094
  }
4069
4095
  },
4070
4096
  g.id
@@ -4075,7 +4101,7 @@ function Qi({
4075
4101
  }
4076
4102
  );
4077
4103
  }
4078
- function Wi({
4104
+ function qi({
4079
4105
  entry: e,
4080
4106
  expanded: t,
4081
4107
  onToggle: r
@@ -4083,7 +4109,7 @@ function Wi({
4083
4109
  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", l = new Date(e.ts).toLocaleTimeString("en-US", {
4084
4110
  hour12: !1
4085
4111
  });
4086
- return /* @__PURE__ */ C(
4112
+ return /* @__PURE__ */ k(
4087
4113
  "button",
4088
4114
  {
4089
4115
  type: "button",
@@ -4101,7 +4127,7 @@ function Wi({
4101
4127
  lineHeight: 1.4
4102
4128
  },
4103
4129
  children: [
4104
- /* @__PURE__ */ C("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
4130
+ /* @__PURE__ */ k("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
4105
4131
  /* @__PURE__ */ n(
4106
4132
  "span",
4107
4133
  {
@@ -4145,7 +4171,7 @@ function Wi({
4145
4171
  }
4146
4172
  );
4147
4173
  }
4148
- function Wt(e) {
4174
+ function qt(e) {
4149
4175
  return {
4150
4176
  background: e,
4151
4177
  color: "#fff",
@@ -4156,22 +4182,22 @@ function Wt(e) {
4156
4182
  cursor: "pointer"
4157
4183
  };
4158
4184
  }
4159
- function Fi(e) {
4185
+ function Ui(e) {
4160
4186
  try {
4161
4187
  return e instanceof Error ? { message: e.message, stack: e.stack } : (JSON.stringify(e), e);
4162
4188
  } catch {
4163
4189
  return String(e);
4164
4190
  }
4165
4191
  }
4166
- function Bi(e) {
4192
+ function ji(e) {
4167
4193
  const t = JSON.stringify(e);
4168
- P(() => cr(e), [t]);
4194
+ T(() => fr(e), [t]);
4169
4195
  }
4170
- function eo({ fields: e, children: t }) {
4171
- return Bi(e), /* @__PURE__ */ n(We, { children: t });
4196
+ function ro({ fields: e, children: t }) {
4197
+ return ji(e), /* @__PURE__ */ n(Fe, { children: t });
4172
4198
  }
4173
- function to() {
4174
- const [e, t] = M([]), r = L((l) => {
4199
+ function io() {
4200
+ const [e, t] = M([]), r = C((l) => {
4175
4201
  t((o) => {
4176
4202
  const s = o.findIndex((a) => a.id === l.id);
4177
4203
  if (s >= 0) {
@@ -4180,7 +4206,7 @@ function to() {
4180
4206
  }
4181
4207
  return [...o, l];
4182
4208
  });
4183
- }, []), i = L(() => t([]), []);
4209
+ }, []), i = C(() => t([]), []);
4184
4210
  return {
4185
4211
  entries: e,
4186
4212
  pushSegment: r,
@@ -4189,38 +4215,38 @@ function to() {
4189
4215
  };
4190
4216
  }
4191
4217
  export {
4192
- Oi as AvatarWidget,
4193
- fr as ErrorBoundary,
4194
- eo as FieldProvider,
4195
- Qi as LiveLayerDebugPanel,
4196
- Ji as LiveLayerRegion,
4197
- Ki as LiveLayerWidget,
4198
- io as clearFieldRegistry,
4199
- _i as clearPageContextCache,
4200
- Si as clearRoutesCache,
4201
- wi as extractPageContext,
4202
- ki as extractRoutes,
4203
- kn as getCachedPageContext,
4204
- Ot as getCachedRoutes,
4205
- oo as getRegisteredFields,
4206
- Fr as matchesPattern,
4207
- Li as normalizeRouteInput,
4208
- lo as registerFields,
4209
- ao as setFieldValue,
4210
- Br as shouldRenderAtPath,
4211
- _r as useAgentInfo,
4212
- hr as useAudioLevel,
4213
- vr as useCameraState,
4214
- Zi as useCollect,
4215
- Lr as useDisplayMode,
4216
- Er as useDisplayModePersistence,
4217
- Nr as useIsMobile,
4218
- pr as useLiveKitSession,
4219
- wr as useMediaDevices,
4220
- gr as useMicrophoneState,
4221
- zr as usePathname,
4222
- Bi as useRegisterFields,
4223
- qr as useRouteMatch,
4224
- br as useScreenShareState,
4225
- to as useTranscript
4218
+ Bi as AvatarWidget,
4219
+ mr as ErrorBoundary,
4220
+ ro as FieldProvider,
4221
+ no as LiveLayerDebugPanel,
4222
+ eo as LiveLayerRegion,
4223
+ Qi as LiveLayerWidget,
4224
+ ao as clearFieldRegistry,
4225
+ Ci as clearPageContextCache,
4226
+ Mi as clearRoutesCache,
4227
+ Li as extractPageContext,
4228
+ Ni as extractRoutes,
4229
+ En as getCachedPageContext,
4230
+ Bt as getCachedRoutes,
4231
+ so as getRegisteredFields,
4232
+ Ur as matchesPattern,
4233
+ Si as normalizeRouteInput,
4234
+ co as registerFields,
4235
+ uo as setFieldValue,
4236
+ jr as shouldRenderAtPath,
4237
+ Cr as useAgentInfo,
4238
+ yr as useAudioLevel,
4239
+ _r as useCameraState,
4240
+ to as useCollect,
4241
+ Sr as useDisplayMode,
4242
+ Ar as useDisplayModePersistence,
4243
+ Ir as useIsMobile,
4244
+ gr as useLiveKitSession,
4245
+ Lr as useMediaDevices,
4246
+ br as useMicrophoneState,
4247
+ Or as usePathname,
4248
+ ji as useRegisterFields,
4249
+ Vr as useRouteMatch,
4250
+ xr as useScreenShareState,
4251
+ io as useTranscript
4226
4252
  };