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