@livelayer/react 0.23.2 → 0.23.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +3 -3
  2. package/dist/index.mjs +1228 -1213
  3. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import { jsxs as S, jsx as r, Fragment as Ve } from "react/jsx-runtime";
3
- import { Component as Sr, useState as M, useRef as T, useEffect as I, useCallback as C, useMemo as at, useLayoutEffect as Qn, forwardRef as rn, useImperativeHandle as Er, createElement as Ar } from "react";
4
- import { createPortal as on } from "react-dom";
5
- import { LiveKitSession as Nr, registerFields as Mr } from "@livelayer/sdk";
6
- import { clearFieldRegistry as Bo, getRegisteredFields as Wo, registerFields as qo, setFieldValue as Uo } from "@livelayer/sdk";
7
- import { createLocalAudioTrack as Ir, Track as er, createLocalVideoTrack as Tr } from "livekit-client";
8
- class Rr extends Sr {
3
+ import { Component as Er, useState as M, useRef as R, useEffect as I, useCallback as L, useMemo as at, useLayoutEffect as er, forwardRef as on, useImperativeHandle as Ar, createElement as Nr } from "react";
4
+ import { createPortal as ln } from "react-dom";
5
+ import { LiveKitSession as Mr, registerFields as Ir } from "@livelayer/sdk";
6
+ import { clearFieldRegistry as Wo, getRegisteredFields as qo, registerFields as Uo, setFieldValue as jo } from "@livelayer/sdk";
7
+ import { createLocalAudioTrack as Rr, Track as tr, createLocalVideoTrack as Tr } from "livekit-client";
8
+ class Pr extends Er {
9
9
  constructor() {
10
10
  super(...arguments), this.state = { hasError: !1, error: null }, this.reset = () => {
11
11
  this.setState({ hasError: !1, error: null });
@@ -36,25 +36,25 @@ class Rr extends Sr {
36
36
  }
37
37
  }
38
38
  function Dr(e) {
39
- const [t, n] = M("idle"), [i, l] = M("idle"), [o, s] = M([]), [a, c] = M(null), [u, m] = M(null), [p, h] = M(null), [P, _] = M(!1), [k, g] = M(null), w = T(null), D = T(e.onDataMessage);
40
- D.current = e.onDataMessage, I(() => {
41
- const y = {
39
+ const [t, n] = M("idle"), [i, l] = M("idle"), [o, s] = M([]), [a, c] = M(null), [d, g] = M(null), [p, m] = M(null), [D, x] = M(!1), [C, y] = M(null), w = R(null), P = R(e.onDataMessage);
40
+ P.current = e.onDataMessage, I(() => {
41
+ const v = {
42
42
  onConnectionStateChange: (B) => {
43
- n(B), B === "connected" && g(null);
43
+ n(B), B === "connected" && y(null);
44
44
  },
45
45
  onAgentStateChange: l,
46
46
  onTranscript: (B) => s([...B]),
47
47
  onAgentConfig: c,
48
- onAudioTrack: (B) => h(B),
49
- onVideoTrack: (B) => m(B),
50
- onVideoTrackRemoved: () => m(null),
51
- onError: (B) => g(B),
48
+ onAudioTrack: (B) => m(B),
49
+ onVideoTrack: (B) => g(B),
50
+ onVideoTrackRemoved: () => g(null),
51
+ onError: (B) => y(B),
52
52
  onDataMessage: (B) => {
53
53
  var J;
54
- (J = D.current) == null || J.call(D, B);
54
+ (J = P.current) == null || J.call(P, B);
55
55
  },
56
- onResumabilityChange: _
57
- }, z = new Nr(
56
+ onResumabilityChange: x
57
+ }, z = new Mr(
58
58
  {
59
59
  agentId: e.agentId,
60
60
  baseUrl: e.baseUrl,
@@ -62,9 +62,9 @@ function Dr(e) {
62
62
  sessionEndpoint: e.sessionEndpoint,
63
63
  sessionBody: e.sessionBody
64
64
  },
65
- y
65
+ v
66
66
  );
67
- return w.current = z, n("idle"), l("idle"), s([]), c(null), m(null), h(null), _(!1), g(null), () => {
67
+ return w.current = z, n("idle"), l("idle"), s([]), c(null), g(null), m(null), x(!1), y(null), () => {
68
68
  var B;
69
69
  (B = z.destroy) == null || B.call(z), w.current = null;
70
70
  };
@@ -75,139 +75,139 @@ function Dr(e) {
75
75
  e.sessionEndpoint,
76
76
  JSON.stringify(e.sessionBody ?? {})
77
77
  ]);
78
- const E = C(async () => {
79
- const y = w.current;
80
- if (y)
78
+ const E = L(async () => {
79
+ const v = w.current;
80
+ if (v)
81
81
  try {
82
- await y.connect();
82
+ await v.connect();
83
83
  } catch (z) {
84
- throw g(z instanceof Error ? z.message : String(z)), z;
84
+ throw y(z instanceof Error ? z.message : String(z)), z;
85
85
  }
86
- }, []), v = C(() => {
87
- const y = w.current;
88
- y && y.disconnect();
89
- }, []), O = C(() => {
90
- var y;
91
- return ((y = w.current) == null ? void 0 : y.getRoom()) ?? null;
86
+ }, []), b = L(() => {
87
+ const v = w.current;
88
+ v && v.disconnect();
89
+ }, []), O = L(() => {
90
+ var v;
91
+ return ((v = w.current) == null ? void 0 : v.getRoom()) ?? null;
92
92
  }, []);
93
93
  return {
94
94
  connectionState: t,
95
95
  agentState: i,
96
96
  transcript: o,
97
97
  agentConfig: a,
98
- videoElement: u,
98
+ videoElement: d,
99
99
  audioElement: p,
100
- canResume: P,
101
- error: k,
100
+ canResume: D,
101
+ error: C,
102
102
  connect: E,
103
- disconnect: v,
103
+ disconnect: b,
104
104
  getRoom: O,
105
105
  session: w.current
106
106
  };
107
107
  }
108
- function Pr() {
109
- const e = T(null), t = T(/* @__PURE__ */ new Map()), n = T(null), i = T(/* @__PURE__ */ new Set()), l = C(() => {
110
- const _ = t.current;
111
- if (_.size === 0) {
108
+ function zr() {
109
+ const e = R(null), t = R(/* @__PURE__ */ new Map()), n = R(null), i = R(/* @__PURE__ */ new Set()), l = L(() => {
110
+ const x = t.current;
111
+ if (x.size === 0) {
112
112
  n.current = null;
113
113
  return;
114
114
  }
115
- let k = 0;
116
- for (const { analyser: g, buffer: w } of _.values()) {
117
- g.getByteFrequencyData(w);
118
- let D = 0;
119
- for (let v = 0; v < w.length; v++) D += w[v];
120
- const E = D / w.length / 255;
121
- E > k && (k = E);
115
+ let C = 0;
116
+ for (const { analyser: y, buffer: w } of x.values()) {
117
+ y.getByteFrequencyData(w);
118
+ let P = 0;
119
+ for (let b = 0; b < w.length; b++) P += w[b];
120
+ const E = P / w.length / 255;
121
+ E > C && (C = E);
122
122
  }
123
- for (const g of i.current)
123
+ for (const y of i.current)
124
124
  try {
125
- g(k);
125
+ y(C);
126
126
  } catch (w) {
127
127
  console.error("[useAudioLevel] subscriber threw:", w);
128
128
  }
129
129
  n.current = requestAnimationFrame(l);
130
- }, []), o = C(() => e.current ? e.current : typeof window > "u" || typeof AudioContext > "u" ? null : (e.current = new AudioContext(), e.current), []), s = C(() => {
130
+ }, []), o = L(() => e.current ? e.current : typeof window > "u" || typeof AudioContext > "u" ? null : (e.current = new AudioContext(), e.current), []), s = L(() => {
131
131
  n.current === null && t.current.size > 0 && (n.current = requestAnimationFrame(l));
132
- }, [l]), a = C((_) => {
133
- const k = t.current.get(_);
134
- if (k) {
132
+ }, [l]), a = L((x) => {
133
+ const C = t.current.get(x);
134
+ if (C) {
135
135
  try {
136
- k.node.disconnect();
136
+ C.node.disconnect();
137
137
  } catch {
138
138
  }
139
139
  try {
140
- k.analyser.disconnect();
140
+ C.analyser.disconnect();
141
141
  } catch {
142
142
  }
143
- t.current.delete(_);
143
+ t.current.delete(x);
144
144
  }
145
- }, []), c = C(
146
- (_, k) => {
147
- const g = o();
148
- if (!g) return;
149
- a(_);
150
- const w = k(g);
145
+ }, []), c = L(
146
+ (x, C) => {
147
+ const y = o();
148
+ if (!y) return;
149
+ a(x);
150
+ const w = C(y);
151
151
  if (!w) return;
152
- const D = g.createAnalyser();
153
- D.fftSize = 64;
152
+ const P = y.createAnalyser();
153
+ P.fftSize = 64;
154
154
  try {
155
- w.connect(D);
155
+ w.connect(P);
156
156
  } catch (E) {
157
- console.warn("[useAudioLevel] connect failed for slot", _, E);
157
+ console.warn("[useAudioLevel] connect failed for slot", x, E);
158
158
  return;
159
159
  }
160
- t.current.set(_, {
161
- analyser: D,
160
+ t.current.set(x, {
161
+ analyser: P,
162
162
  node: w,
163
- buffer: new Uint8Array(new ArrayBuffer(D.frequencyBinCount))
163
+ buffer: new Uint8Array(new ArrayBuffer(P.frequencyBinCount))
164
164
  }), s();
165
165
  },
166
166
  [a, o, s]
167
- ), u = C(
168
- (_, k = "agent") => {
169
- c(k, (g) => {
167
+ ), d = L(
168
+ (x, C = "agent") => {
169
+ c(C, (y) => {
170
170
  try {
171
- return g.createMediaElementSource(_);
171
+ return y.createMediaElementSource(x);
172
172
  } catch (w) {
173
173
  return console.warn(
174
174
  "[useAudioLevel] createMediaElementSource failed for slot",
175
- k,
175
+ C,
176
176
  w
177
177
  ), null;
178
178
  }
179
179
  });
180
180
  },
181
181
  [c]
182
- ), m = C(
183
- (_, k = "mic") => {
184
- c(k, (g) => {
182
+ ), g = L(
183
+ (x, C = "mic") => {
184
+ c(C, (y) => {
185
185
  try {
186
- return g.createMediaStreamSource(_);
186
+ return y.createMediaStreamSource(x);
187
187
  } catch (w) {
188
188
  return console.warn(
189
189
  "[useAudioLevel] createMediaStreamSource failed for slot",
190
- k,
190
+ C,
191
191
  w
192
192
  ), null;
193
193
  }
194
194
  });
195
195
  },
196
196
  [c]
197
- ), p = C(
198
- (_) => {
199
- a(_), t.current.size === 0 && n.current !== null && (cancelAnimationFrame(n.current), n.current = null);
197
+ ), p = L(
198
+ (x) => {
199
+ a(x), t.current.size === 0 && n.current !== null && (cancelAnimationFrame(n.current), n.current = null);
200
200
  },
201
201
  [a]
202
- ), h = C(() => {
202
+ ), m = L(() => {
203
203
  n.current !== null && (cancelAnimationFrame(n.current), n.current = null);
204
- for (const _ of Array.from(t.current.keys()))
205
- a(_);
206
- }, [a]), P = C((_) => (i.current.add(_), () => {
207
- i.current.delete(_);
204
+ for (const x of Array.from(t.current.keys()))
205
+ a(x);
206
+ }, [a]), D = L((x) => (i.current.add(x), () => {
207
+ i.current.delete(x);
208
208
  }), []);
209
209
  return I(() => () => {
210
- if (h(), e.current) {
210
+ if (m(), e.current) {
211
211
  try {
212
212
  e.current.close();
213
213
  } catch {
@@ -215,162 +215,162 @@ function Pr() {
215
215
  e.current = null;
216
216
  }
217
217
  i.current.clear();
218
- }, [h]), { attach: u, attachStream: m, detach: h, detachSlot: p, subscribe: P };
218
+ }, [m]), { attach: d, attachStream: g, detach: m, detachSlot: p, subscribe: D };
219
219
  }
220
- function zr(e) {
220
+ function $r(e) {
221
221
  const t = e == null ? void 0 : e.mediaStreamTrack;
222
222
  return t ? new MediaStream([t]) : null;
223
223
  }
224
- function $r(e = {}) {
225
- const t = e.gateUntilAgentReady ?? !1, n = e.agentState ?? null, [i, l] = M(t), [o, s] = M(""), [a, c] = M(null), u = T(null), m = T(null), p = T({
224
+ function Hr(e = {}) {
225
+ const t = e.gateUntilAgentReady ?? !1, n = e.agentState ?? null, [i, l] = M(t), [o, s] = M(""), [a, c] = M(null), d = R(null), g = R(null), p = R({
226
226
  active: t,
227
227
  lastAutoIntent: null
228
- }), h = C(async (E) => {
229
- var v, O;
230
- if (u.current && m.current) {
228
+ }), m = L(async (E) => {
229
+ var b, O;
230
+ if (d.current && g.current) {
231
231
  try {
232
- await m.current.localParticipant.unpublishTrack(u.current);
232
+ await g.current.localParticipant.unpublishTrack(d.current);
233
233
  } catch {
234
234
  }
235
- u.current.stop(), u.current = null;
235
+ d.current.stop(), d.current = null;
236
236
  }
237
- m.current = E, c(null);
237
+ g.current = E, c(null);
238
238
  try {
239
- const y = await Ir({
239
+ const v = await Rr({
240
240
  echoCancellation: !0,
241
241
  noiseSuppression: !0
242
242
  });
243
- await E.localParticipant.publishTrack(y), u.current = y, p.current.active ? (await E.localParticipant.setMicrophoneEnabled(!1), p.current.lastAutoIntent = !1, l(!0)) : l(y.isMuted);
244
- const z = (O = (v = y.mediaStreamTrack) == null ? void 0 : v.getSettings) == null ? void 0 : O.call(v);
243
+ await E.localParticipant.publishTrack(v), d.current = v, p.current.active ? (await E.localParticipant.setMicrophoneEnabled(!1), p.current.lastAutoIntent = !1, l(!0)) : l(v.isMuted);
244
+ const z = (O = (b = v.mediaStreamTrack) == null ? void 0 : b.getSettings) == null ? void 0 : O.call(b);
245
245
  z != null && z.deviceId && s(z.deviceId);
246
- } catch (y) {
247
- const z = y instanceof Error && y.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
248
- throw c(z), y;
246
+ } catch (v) {
247
+ const z = v instanceof Error && v.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
248
+ throw c(z), v;
249
249
  }
250
- }, []), P = C((E) => {
251
- m.current = E;
252
- }, []), _ = C(async (E) => {
253
- const v = m.current;
254
- if (v)
250
+ }, []), D = L((E) => {
251
+ g.current = E;
252
+ }, []), x = L(async (E) => {
253
+ const b = g.current;
254
+ if (b)
255
255
  try {
256
- await v.switchActiveDevice("audioinput", E), s(E);
256
+ await b.switchActiveDevice("audioinput", E), s(E);
257
257
  } catch (O) {
258
258
  console.warn("[useMicrophoneState] switchDevice failed:", O);
259
259
  }
260
- }, []), k = C(async () => {
261
- const E = m.current, v = !i;
262
- if (l(v), p.current.active = !1, !!E)
260
+ }, []), C = L(async () => {
261
+ const E = g.current, b = !i;
262
+ if (l(b), p.current.active = !1, !!E)
263
263
  try {
264
- await E.localParticipant.setMicrophoneEnabled(!v);
264
+ await E.localParticipant.setMicrophoneEnabled(!b);
265
265
  } catch (O) {
266
- console.warn("[useMicrophoneState] setMicrophoneEnabled failed:", O), l(!v);
266
+ console.warn("[useMicrophoneState] setMicrophoneEnabled failed:", O), l(!b);
267
267
  }
268
268
  }, [i]);
269
269
  I(() => {
270
270
  if (!p.current.active || n !== "listening") return;
271
- const E = m.current, v = E == null ? void 0 : E.localParticipant;
272
- if (!v) {
271
+ const E = g.current, b = E == null ? void 0 : E.localParticipant;
272
+ if (!b) {
273
273
  p.current.active = !1;
274
274
  return;
275
275
  }
276
- v.isMicrophoneEnabled === p.current.lastAutoIntent && (v.setMicrophoneEnabled(!0), p.current.lastAutoIntent = !0, l(!1)), p.current.active = !1;
276
+ b.isMicrophoneEnabled === p.current.lastAutoIntent && (b.setMicrophoneEnabled(!0), p.current.lastAutoIntent = !0, l(!1)), p.current.active = !1;
277
277
  }, [n]);
278
- const g = C(() => {
279
- const E = u.current, v = m.current;
280
- if (E && v) {
278
+ const y = L(() => {
279
+ const E = d.current, b = g.current;
280
+ if (E && b) {
281
281
  try {
282
- v.localParticipant.unpublishTrack(E);
282
+ b.localParticipant.unpublishTrack(E);
283
283
  } catch {
284
284
  }
285
285
  E.stop();
286
286
  }
287
- u.current = null, m.current = null, p.current = { active: t, lastAutoIntent: null }, l(t), s("");
288
- }, [t]), w = C(() => c(null), []), D = C(() => zr(u.current), []);
287
+ d.current = null, g.current = null, p.current = { active: t, lastAutoIntent: null }, l(t), s("");
288
+ }, [t]), w = L(() => c(null), []), P = L(() => $r(d.current), []);
289
289
  return {
290
290
  isMuted: i,
291
291
  activeDeviceId: o,
292
292
  micError: a,
293
- toggleMute: k,
294
- setupMic: h,
295
- attachRoom: P,
296
- switchDevice: _,
297
- teardownMic: g,
293
+ toggleMute: C,
294
+ setupMic: m,
295
+ attachRoom: D,
296
+ switchDevice: x,
297
+ teardownMic: y,
298
298
  clearError: w,
299
- getMicStream: D
299
+ getMicStream: P
300
300
  };
301
301
  }
302
- const Hr = { resolution: { width: 640, height: 480, frameRate: 24 } };
303
- function Or() {
304
- const [e, t] = M(!1), [n, i] = M(null), [l, o] = M(null), [s, a] = M(""), c = T(null), u = T(null), m = C((w) => {
302
+ const Or = { resolution: { width: 640, height: 480, frameRate: 24 } };
303
+ function Fr() {
304
+ const [e, t] = M(!1), [n, i] = M(null), [l, o] = M(null), [s, a] = M(""), c = R(null), d = R(null), g = L((w) => {
305
305
  c.current = w;
306
- }, []), p = C(() => {
306
+ }, []), p = L(() => {
307
307
  var E;
308
- const w = c.current, D = u.current;
309
- if (D && w) {
310
- const v = w.localParticipant.getTrackPublication(er.Source.Camera), y = (v == null ? void 0 : v.track) ?? D;
308
+ const w = c.current, P = d.current;
309
+ if (P && w) {
310
+ const b = w.localParticipant.getTrackPublication(tr.Source.Camera), v = (b == null ? void 0 : b.track) ?? P;
311
311
  try {
312
- w.localParticipant.unpublishTrack(y);
312
+ w.localParticipant.unpublishTrack(v);
313
313
  } catch {
314
314
  }
315
315
  try {
316
- (E = y.stop) == null || E.call(y);
316
+ (E = v.stop) == null || E.call(v);
317
317
  } catch {
318
318
  }
319
319
  }
320
- u.current = null, o(null), t(!1);
321
- }, []), h = C(async (w) => {
322
- const D = c.current;
323
- if (D) {
320
+ d.current = null, o(null), t(!1);
321
+ }, []), m = L(async (w) => {
322
+ const P = c.current;
323
+ if (P) {
324
324
  i(null);
325
325
  try {
326
- const E = { ...Hr };
326
+ const E = { ...Or };
327
327
  w && (E.deviceId = w);
328
- const v = await Tr(E);
329
- await D.localParticipant.publishTrack(v), u.current = v;
330
- const O = v.attach();
328
+ const b = await Tr(E);
329
+ await P.localParticipant.publishTrack(b), d.current = b;
330
+ const O = b.attach();
331
331
  o(O), t(!0), w && a(w);
332
332
  try {
333
- D.localParticipant.publishData(
333
+ P.localParticipant.publishData(
334
334
  new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
335
335
  { reliable: !0 }
336
336
  );
337
337
  } catch {
338
338
  }
339
339
  } catch (E) {
340
- const v = E instanceof Error && E.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
341
- i(v);
340
+ const b = E instanceof Error && E.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
341
+ i(b);
342
342
  }
343
343
  }
344
- }, []), P = C(async () => {
345
- e ? p() : await h(s || void 0);
346
- }, [e, s, p, h]), _ = C(async (w) => {
347
- p(), await h(w);
348
- }, [p, h]), k = C(() => {
344
+ }, []), D = L(async () => {
345
+ e ? p() : await m(s || void 0);
346
+ }, [e, s, p, m]), x = L(async (w) => {
347
+ p(), await m(w);
348
+ }, [p, m]), C = L(() => {
349
349
  p(), c.current = null, i(null), a("");
350
- }, [p]), g = C(() => i(null), []);
350
+ }, [p]), y = L(() => i(null), []);
351
351
  return I(() => () => {
352
- u.current && u.current.stop();
352
+ d.current && d.current.stop();
353
353
  }, []), {
354
354
  isEnabled: e,
355
355
  error: n,
356
356
  previewEl: l,
357
357
  activeDeviceId: s,
358
- toggle: P,
359
- switchDevice: _,
360
- attachRoom: m,
361
- teardown: k,
362
- clearError: g
358
+ toggle: D,
359
+ switchDevice: x,
360
+ attachRoom: g,
361
+ teardown: C,
362
+ clearError: y
363
363
  };
364
364
  }
365
- function Fr() {
366
- const [e, t] = M(!1), [n, i] = M(null), [l, o] = M(null), s = T(null), a = C((h) => {
367
- s.current = h;
368
- }, []), c = C(() => o(null), []), u = C(async () => {
369
- const h = s.current;
370
- if (h) {
365
+ function Br() {
366
+ const [e, t] = M(!1), [n, i] = M(null), [l, o] = M(null), s = R(null), a = L((m) => {
367
+ s.current = m;
368
+ }, []), c = L(() => o(null), []), d = L(async () => {
369
+ const m = s.current;
370
+ if (m) {
371
371
  if (e) {
372
372
  try {
373
- await h.localParticipant.setScreenShareEnabled(!1);
373
+ await m.localParticipant.setScreenShareEnabled(!1);
374
374
  } catch {
375
375
  }
376
376
  c(), t(!1);
@@ -378,15 +378,15 @@ function Fr() {
378
378
  }
379
379
  i(null);
380
380
  try {
381
- await h.localParticipant.setScreenShareEnabled(!0);
382
- let P = 0;
383
- const _ = () => {
384
- const k = h.localParticipant.getTrackPublication(er.Source.ScreenShare);
385
- if (k != null && k.track) {
386
- const g = k.track.attach();
387
- o(g), t(!0);
381
+ await m.localParticipant.setScreenShareEnabled(!0);
382
+ let D = 0;
383
+ const x = () => {
384
+ const C = m.localParticipant.getTrackPublication(tr.Source.ScreenShare);
385
+ if (C != null && C.track) {
386
+ const y = C.track.attach();
387
+ o(y), t(!0);
388
388
  try {
389
- h.localParticipant.publishData(
389
+ m.localParticipant.publishData(
390
390
  new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
391
391
  { reliable: !0 }
392
392
  );
@@ -394,27 +394,27 @@ function Fr() {
394
394
  }
395
395
  return;
396
396
  }
397
- P++ < 10 ? setTimeout(_, 100) : t(!0);
397
+ D++ < 10 ? setTimeout(x, 100) : t(!0);
398
398
  };
399
- _();
400
- } catch (P) {
401
- const _ = P instanceof Error ? P.name : "";
402
- _ !== "NotAllowedError" && _ !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
399
+ x();
400
+ } catch (D) {
401
+ const x = D instanceof Error ? D.name : "";
402
+ x !== "NotAllowedError" && x !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
403
403
  }
404
404
  }
405
- }, [e, c]), m = C(() => {
406
- const h = s.current;
407
- if (h && e)
405
+ }, [e, c]), g = L(() => {
406
+ const m = s.current;
407
+ if (m && e)
408
408
  try {
409
- h.localParticipant.setScreenShareEnabled(!1);
409
+ m.localParticipant.setScreenShareEnabled(!1);
410
410
  } catch {
411
411
  }
412
412
  c(), t(!1), i(null), s.current = null;
413
- }, [e, c]), p = C(() => i(null), []);
414
- return { isEnabled: e, error: n, previewEl: l, toggle: u, attachRoom: a, teardown: m, clearError: p };
413
+ }, [e, c]), p = L(() => i(null), []);
414
+ return { isEnabled: e, error: n, previewEl: l, toggle: d, attachRoom: a, teardown: g, clearError: p };
415
415
  }
416
- function Br() {
417
- const [e, t] = M([]), [n, i] = M([]), l = C(async () => {
416
+ function Wr() {
417
+ const [e, t] = M([]), [n, i] = M([]), l = L(async () => {
418
418
  if (!(typeof navigator > "u" || !navigator.mediaDevices))
419
419
  try {
420
420
  const o = await navigator.mediaDevices.enumerateDevices();
@@ -428,30 +428,30 @@ function Br() {
428
428
  return navigator.mediaDevices.addEventListener("devicechange", o), () => navigator.mediaDevices.removeEventListener("devicechange", o);
429
429
  }, [l]), { mics: e, cameras: n, refresh: l };
430
430
  }
431
- function Wr(e, t, n = !1) {
431
+ function qr(e, t, n = !1) {
432
432
  const [i, l] = M(null), [o, s] = M(null), [a, c] = M(!n && !!e);
433
433
  return I(() => {
434
434
  if (n || !e) {
435
435
  c(!1);
436
436
  return;
437
437
  }
438
- const u = new AbortController(), m = t || "https://app.livelayer.studio";
439
- return c(!0), s(null), fetch(`${m}/api/widget/agent/${encodeURIComponent(e)}`, {
440
- signal: u.signal
438
+ const d = new AbortController(), g = t || "https://app.livelayer.studio";
439
+ return c(!0), s(null), fetch(`${g}/api/widget/agent/${encodeURIComponent(e)}`, {
440
+ signal: d.signal
441
441
  }).then(async (p) => {
442
442
  if (!p.ok) {
443
- const h = await p.json().catch(() => ({}));
444
- throw new Error(h.error || `HTTP ${p.status}`);
443
+ const m = await p.json().catch(() => ({}));
444
+ throw new Error(m.error || `HTTP ${p.status}`);
445
445
  }
446
446
  return p.json();
447
447
  }).then((p) => {
448
- u.signal.aborted || (l(p), c(!1));
448
+ d.signal.aborted || (l(p), c(!1));
449
449
  }).catch((p) => {
450
- u.signal.aborted || (s(p instanceof Error ? p.message : "Agent lookup failed"), c(!1));
451
- }), () => u.abort();
450
+ d.signal.aborted || (s(p instanceof Error ? p.message : "Agent lookup failed"), c(!1));
451
+ }), () => d.abort();
452
452
  }, [e, t, n]), { info: i, error: o, loading: a };
453
453
  }
454
- function tr(e) {
454
+ function nr(e) {
455
455
  if (typeof window > "u") return null;
456
456
  try {
457
457
  return window.localStorage.getItem(e);
@@ -459,26 +459,26 @@ function tr(e) {
459
459
  return null;
460
460
  }
461
461
  }
462
- function nr(e, t) {
462
+ function rr(e, t) {
463
463
  if (!(typeof window > "u"))
464
464
  try {
465
465
  window.localStorage.setItem(e, t);
466
466
  } catch {
467
467
  }
468
468
  }
469
- function qr(e) {
469
+ function Ur(e) {
470
470
  if (!(typeof window > "u"))
471
471
  try {
472
472
  window.localStorage.removeItem(e);
473
473
  } catch {
474
474
  }
475
475
  }
476
- function Ur({
476
+ function jr({
477
477
  value: e,
478
478
  defaultValue: t = "expanded",
479
479
  onChange: n
480
480
  } = {}) {
481
- const i = e !== void 0, [l, o] = M(t), s = i ? e : l, a = C(
481
+ const i = e !== void 0, [l, o] = M(t), s = i ? e : l, a = L(
482
482
  (c) => {
483
483
  c !== s && (i || o(c), n == null || n(c));
484
484
  },
@@ -486,32 +486,32 @@ function Ur({
486
486
  );
487
487
  return [s, a];
488
488
  }
489
- const jr = ["hidden", "minimized", "expanded"];
490
- function Vr(e) {
491
- return e && jr.includes(e) ? e : null;
489
+ const Vr = ["hidden", "minimized", "expanded"];
490
+ function Yr(e) {
491
+ return e && Vr.includes(e) ? e : null;
492
492
  }
493
- function Yr({
493
+ function Gr({
494
494
  value: e,
495
495
  defaultValue: t = "expanded",
496
496
  onChange: n,
497
497
  persistKey: i = "ll-widget",
498
498
  disablePersistence: l = !1
499
499
  } = {}) {
500
- const o = `${i}:display-mode`, s = T(!1), [a, c] = Ur({
500
+ const o = `${i}:display-mode`, s = R(!1), [a, c] = jr({
501
501
  value: e,
502
502
  defaultValue: t,
503
- onChange: (u) => {
504
- e === void 0 && !l && nr(o, u), n == null || n(u);
503
+ onChange: (d) => {
504
+ e === void 0 && !l && rr(o, d), n == null || n(d);
505
505
  }
506
506
  });
507
507
  return I(() => {
508
508
  if (s.current || (s.current = !0, l || e !== void 0)) return;
509
- const u = Vr(tr(o));
510
- u && u !== a && c(u);
509
+ const d = Yr(nr(o));
510
+ d && d !== a && c(d);
511
511
  }, []), [a, c];
512
512
  }
513
- const Gr = 640;
514
- function Xr(e = Gr) {
513
+ const Xr = 640;
514
+ function Kr(e = Xr) {
515
515
  const [t, n] = M(!1);
516
516
  return I(() => {
517
517
  if (e === !1) {
@@ -526,11 +526,11 @@ function Xr(e = Gr) {
526
526
  });
527
527
  }, [e]), t;
528
528
  }
529
- const Kr = 280, Jr = 380, Zr = 8, Qr = 4;
530
- function Xt(e) {
529
+ const Jr = 280, Zr = 380, Qr = 8, ei = 4;
530
+ function Kt(e) {
531
531
  return `${e}:geometry`;
532
532
  }
533
- function ei(e) {
533
+ function ti(e) {
534
534
  if (!e) return null;
535
535
  let t;
536
536
  try {
@@ -542,69 +542,69 @@ function ei(e) {
542
542
  const n = t, { top: i, left: l, width: o, height: s } = n;
543
543
  return typeof i != "number" || typeof l != "number" || typeof o != "number" || typeof s != "number" || !Number.isFinite(i) || !Number.isFinite(l) || !Number.isFinite(o) || !Number.isFinite(s) ? null : { top: i, left: l, width: o, height: s };
544
544
  }
545
- function $t() {
545
+ function Ht() {
546
546
  return typeof window > "u" ? { vw: 0, vh: 0 } : { vw: window.innerWidth, vh: window.innerHeight };
547
547
  }
548
- function Kt(e, t, n) {
549
- const { minWidth: i, minHeight: l, edgeMargin: o, vw: s, vh: a } = n, c = Math.max(i, s - o * 2), u = Math.max(l, a - o * 2);
548
+ function Jt(e, t, n) {
549
+ const { minWidth: i, minHeight: l, edgeMargin: o, vw: s, vh: a } = n, c = Math.max(i, s - o * 2), d = Math.max(l, a - o * 2);
550
550
  return {
551
551
  width: Math.max(i, Math.min(c, e)),
552
- height: Math.max(l, Math.min(u, t))
552
+ height: Math.max(l, Math.min(d, t))
553
553
  };
554
554
  }
555
- function Jt(e, t, n, i, l) {
556
- const { edgeMargin: o, vw: s, vh: a } = l, c = o, u = o, m = Math.max(c, s - n - o), p = Math.max(u, a - i - o);
555
+ function Zt(e, t, n, i, l) {
556
+ const { edgeMargin: o, vw: s, vh: a } = l, c = o, d = o, g = Math.max(c, s - n - o), p = Math.max(d, a - i - o);
557
557
  return {
558
- top: Math.max(u, Math.min(p, e)),
559
- left: Math.max(c, Math.min(m, t))
558
+ top: Math.max(d, Math.min(p, e)),
559
+ left: Math.max(c, Math.min(g, t))
560
560
  };
561
561
  }
562
- function ti(e) {
562
+ function ni(e) {
563
563
  const {
564
564
  draggable: t,
565
565
  resizable: n,
566
566
  persistKey: i,
567
567
  disablePersistence: l,
568
- minWidth: o = Kr,
569
- minHeight: s = Jr,
570
- edgeMargin: a = Zr
571
- } = e, [c, u] = M(null), [m, p] = M(!1), [h, P] = M(!1), _ = T(null), k = T(null), g = T(!1), w = T(null);
568
+ minWidth: o = Jr,
569
+ minHeight: s = Zr,
570
+ edgeMargin: a = Qr
571
+ } = e, [c, d] = M(null), [g, p] = M(!1), [m, D] = M(!1), x = R(null), C = R(null), y = R(!1), w = R(null);
572
572
  w.current = c;
573
- const D = C(
573
+ const P = L(
574
574
  (f) => {
575
- l || (f === null ? qr(Xt(i)) : nr(Xt(i), JSON.stringify(f)));
575
+ l || (f === null ? Ur(Kt(i)) : rr(Kt(i), JSON.stringify(f)));
576
576
  },
577
577
  [l, i]
578
578
  );
579
579
  I(() => {
580
- if (g.current || (g.current = !0, l)) return;
581
- const f = ei(tr(Xt(i)));
580
+ if (y.current || (y.current = !0, l)) return;
581
+ const f = ti(nr(Kt(i)));
582
582
  if (!f) return;
583
- const { vw: A, vh: $ } = $t(), q = Kt(f.width, f.height, {
583
+ const { vw: A, vh: $ } = Ht(), q = Jt(f.width, f.height, {
584
584
  minWidth: o,
585
585
  minHeight: s,
586
586
  edgeMargin: a,
587
587
  vw: A,
588
588
  vh: $
589
- }), X = Jt(f.top, f.left, q.width, q.height, {
589
+ }), X = Zt(f.top, f.left, q.width, q.height, {
590
590
  edgeMargin: a,
591
591
  vw: A,
592
592
  vh: $
593
593
  });
594
- u({ ...X, ...q });
594
+ d({ ...X, ...q });
595
595
  }, []), I(() => {
596
596
  if (typeof window > "u") return;
597
597
  const f = () => {
598
- u((A) => {
598
+ d((A) => {
599
599
  if (A === null) return null;
600
- const { vw: $, vh: q } = $t(), X = Kt(A.width, A.height, {
600
+ const { vw: $, vh: q } = Ht(), X = Jt(A.width, A.height, {
601
601
  minWidth: o,
602
602
  minHeight: s,
603
603
  edgeMargin: a,
604
604
  vw: $,
605
605
  vh: q
606
606
  });
607
- return { ...Jt(A.top, A.left, X.width, X.height, {
607
+ return { ...Zt(A.top, A.left, X.width, X.height, {
608
608
  edgeMargin: a,
609
609
  vw: $,
610
610
  vh: q
@@ -613,120 +613,120 @@ function ti(e) {
613
613
  };
614
614
  return window.addEventListener("resize", f), () => window.removeEventListener("resize", f);
615
615
  }, [o, s, a]);
616
- const E = C(
616
+ const E = L(
617
617
  (f) => {
618
618
  if (!t || f.pointerType === "mouse" && f.button !== 0) return;
619
619
  const A = f.target;
620
620
  if (A && typeof A.closest == "function" && A.closest('button, a, input, select, textarea, [role="listbox"], [role="option"], [data-ll-no-drag]'))
621
621
  return;
622
- let $, q, X, ee;
622
+ let $, q, X, te;
623
623
  const W = w.current;
624
624
  if (W)
625
- ({ top: $, left: q, width: X, height: ee } = W);
625
+ ({ top: $, left: q, width: X, height: te } = W);
626
626
  else {
627
- const te = f.currentTarget.closest(".ll-widget"), ie = te == null ? void 0 : te.getBoundingClientRect();
627
+ const ne = f.currentTarget.closest(".ll-widget"), ie = ne == null ? void 0 : ne.getBoundingClientRect();
628
628
  if (!ie) return;
629
- $ = ie.top, q = ie.left, X = ie.width, ee = ie.height;
629
+ $ = ie.top, q = ie.left, X = ie.width, te = ie.height;
630
630
  }
631
631
  try {
632
632
  f.currentTarget.setPointerCapture(f.pointerId);
633
633
  } catch {
634
634
  }
635
- _.current = {
635
+ x.current = {
636
636
  startClientX: f.clientX,
637
637
  startClientY: f.clientY,
638
638
  startTop: $,
639
639
  startLeft: q,
640
640
  width: X,
641
- height: ee,
641
+ height: te,
642
642
  moved: !1
643
643
  };
644
644
  },
645
645
  [t]
646
- ), v = C(
646
+ ), b = L(
647
647
  (f) => {
648
- const A = _.current;
648
+ const A = x.current;
649
649
  if (!A) return;
650
650
  const $ = f.clientX - A.startClientX, q = f.clientY - A.startClientY;
651
- if (!A.moved && Math.abs($) + Math.abs(q) > Qr && (A.moved = !0, p(!0)), !A.moved) return;
652
- const { vw: X, vh: ee } = $t(), W = Jt(
651
+ if (!A.moved && Math.abs($) + Math.abs(q) > ei && (A.moved = !0, p(!0)), !A.moved) return;
652
+ const { vw: X, vh: te } = Ht(), W = Zt(
653
653
  A.startTop + q,
654
654
  A.startLeft + $,
655
655
  A.width,
656
656
  A.height,
657
- { edgeMargin: a, vw: X, vh: ee }
657
+ { edgeMargin: a, vw: X, vh: te }
658
658
  );
659
- u({ ...W, width: A.width, height: A.height });
659
+ d({ ...W, width: A.width, height: A.height });
660
660
  },
661
661
  [a]
662
- ), O = C(
662
+ ), O = L(
663
663
  (f) => {
664
- const A = _.current;
664
+ const A = x.current;
665
665
  if (A) {
666
666
  try {
667
667
  f.currentTarget.releasePointerCapture(f.pointerId);
668
668
  } catch {
669
669
  }
670
- _.current = null, A.moved && (p(!1), u(($) => ($ && D($), $)));
670
+ x.current = null, A.moved && (p(!1), d(($) => ($ && P($), $)));
671
671
  }
672
672
  },
673
- [D]
674
- ), y = C(() => {
675
- _.current = null, k.current = null, p(!1), P(!1), u(null), D(null);
676
- }, [D]), z = C(
673
+ [P]
674
+ ), v = L(() => {
675
+ x.current = null, C.current = null, p(!1), D(!1), d(null), P(null);
676
+ }, [P]), z = L(
677
677
  (f) => {
678
678
  if (!n || f.pointerType === "mouse" && f.button !== 0) return;
679
679
  f.stopPropagation();
680
680
  let A, $, q, X;
681
- const ee = w.current;
682
- if (ee)
683
- ({ top: A, left: $, width: q, height: X } = ee);
681
+ const te = w.current;
682
+ if (te)
683
+ ({ top: A, left: $, width: q, height: X } = te);
684
684
  else {
685
- const W = f.currentTarget.closest(".ll-widget"), te = W == null ? void 0 : W.getBoundingClientRect();
686
- if (!te) return;
687
- A = te.top, $ = te.left, q = te.width, X = te.height;
685
+ const W = f.currentTarget.closest(".ll-widget"), ne = W == null ? void 0 : W.getBoundingClientRect();
686
+ if (!ne) return;
687
+ A = ne.top, $ = ne.left, q = ne.width, X = ne.height;
688
688
  }
689
689
  try {
690
690
  f.currentTarget.setPointerCapture(f.pointerId);
691
691
  } catch {
692
692
  }
693
- k.current = {
693
+ C.current = {
694
694
  startClientX: f.clientX,
695
695
  startClientY: f.clientY,
696
696
  startWidth: q,
697
697
  startHeight: X,
698
698
  top: A,
699
699
  left: $
700
- }, P(!0);
700
+ }, D(!0);
701
701
  },
702
702
  [n]
703
- ), B = C(
703
+ ), B = L(
704
704
  (f) => {
705
- const A = k.current;
705
+ const A = C.current;
706
706
  if (!A) return;
707
- const $ = f.clientX - A.startClientX, q = f.clientY - A.startClientY, { vw: X, vh: ee } = $t(), W = X - A.left - a, te = ee - A.top - a, ie = Kt(A.startWidth + $, A.startHeight + q, {
707
+ const $ = f.clientX - A.startClientX, q = f.clientY - A.startClientY, { vw: X, vh: te } = Ht(), W = X - A.left - a, ne = te - A.top - a, ie = Jt(A.startWidth + $, A.startHeight + q, {
708
708
  minWidth: o,
709
709
  minHeight: s,
710
710
  edgeMargin: a,
711
711
  // Clamp the available viewport to the room from the anchored corner
712
712
  // so the widget can't grow past the bottom/right edge.
713
713
  vw: Math.min(X, A.left + W + a),
714
- vh: Math.min(ee, A.top + te + a)
714
+ vh: Math.min(te, A.top + ne + a)
715
715
  });
716
- u({ top: A.top, left: A.left, ...ie });
716
+ d({ top: A.top, left: A.left, ...ie });
717
717
  },
718
718
  [a, o, s]
719
- ), J = C(
719
+ ), J = L(
720
720
  (f) => {
721
- if (k.current) {
721
+ if (C.current) {
722
722
  try {
723
723
  f.currentTarget.releasePointerCapture(f.pointerId);
724
724
  } catch {
725
725
  }
726
- k.current = null, P(!1), u(($) => ($ && D($), $));
726
+ C.current = null, D(!1), d(($) => ($ && P($), $));
727
727
  }
728
728
  },
729
- [D]
729
+ [P]
730
730
  );
731
731
  return {
732
732
  style: c === null ? {} : {
@@ -739,14 +739,14 @@ function ti(e) {
739
739
  height: `${c.height}px`
740
740
  },
741
741
  hasGeometry: c !== null,
742
- isDragging: m,
743
- isResizing: h,
742
+ isDragging: g,
743
+ isResizing: m,
744
744
  dragHandleProps: {
745
745
  onPointerDown: E,
746
- onPointerMove: v,
746
+ onPointerMove: b,
747
747
  onPointerUp: O,
748
748
  onPointerCancel: O,
749
- onDoubleClick: y,
749
+ onDoubleClick: v,
750
750
  "data-ll-drag-handle": t ? "" : void 0
751
751
  },
752
752
  resizeHandleProps: {
@@ -756,78 +756,78 @@ function ti(e) {
756
756
  onPointerCancel: J,
757
757
  "data-ll-resize-handle": n ? "" : void 0
758
758
  },
759
- reset: y
759
+ reset: v
760
760
  };
761
761
  }
762
- const Nn = "__llHistoryPatched", Ft = "ll:pathname";
763
- function ni() {
764
- if (typeof window > "u" || window.history[Nn]) return;
762
+ const Mn = "__llHistoryPatched", Bt = "ll:pathname";
763
+ function ri() {
764
+ if (typeof window > "u" || window.history[Mn]) return;
765
765
  const e = window.history.pushState, t = window.history.replaceState;
766
766
  window.history.pushState = function(...n) {
767
767
  const i = e.apply(this, n);
768
- return window.dispatchEvent(new Event(Ft)), i;
768
+ return window.dispatchEvent(new Event(Bt)), i;
769
769
  }, window.history.replaceState = function(...n) {
770
770
  const i = t.apply(this, n);
771
- return window.dispatchEvent(new Event(Ft)), i;
772
- }, window.history[Nn] = !0;
771
+ return window.dispatchEvent(new Event(Bt)), i;
772
+ }, window.history[Mn] = !0;
773
773
  }
774
- function Mn() {
774
+ function In() {
775
775
  return typeof window > "u" ? "/" : window.location.pathname || "/";
776
776
  }
777
- function ri(e) {
777
+ function ii(e) {
778
778
  const [t, n] = M(
779
- () => e ?? Mn()
779
+ () => e ?? In()
780
780
  );
781
781
  return I(() => {
782
782
  if (e !== void 0) return;
783
- ni();
784
- const i = () => n(Mn());
785
- return i(), window.addEventListener("popstate", i), window.addEventListener(Ft, i), () => {
786
- window.removeEventListener("popstate", i), window.removeEventListener(Ft, i);
783
+ ri();
784
+ const i = () => n(In());
785
+ return i(), window.addEventListener("popstate", i), window.addEventListener(Bt, i), () => {
786
+ window.removeEventListener("popstate", i), window.removeEventListener(Bt, i);
787
787
  };
788
788
  }, [e]), e ?? t;
789
789
  }
790
- const In = /* @__PURE__ */ new Map(), ii = /[\\^$+?.()|{}[\]]/g;
791
- function oi(e) {
792
- return e.replace(ii, "\\$&");
793
- }
790
+ const Rn = /* @__PURE__ */ new Map(), oi = /[\\^$+?.()|{}[\]]/g;
794
791
  function li(e) {
795
- const t = In.get(e);
792
+ return e.replace(oi, "\\$&");
793
+ }
794
+ function ai(e) {
795
+ const t = Rn.get(e);
796
796
  if (t) return t;
797
- const n = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", l = "", o = n.replace(/\*\*/g, i).replace(/\*/g, l), a = oi(o).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(l, "g"), "[^/]+"), c = new RegExp(`^${a}\\/?$`);
798
- return In.set(e, c), c;
797
+ const n = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", l = "", o = n.replace(/\*\*/g, i).replace(/\*/g, l), a = li(o).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(l, "g"), "[^/]+"), c = new RegExp(`^${a}\\/?$`);
798
+ return Rn.set(e, c), c;
799
799
  }
800
- function ai(e, t) {
800
+ function si(e, t) {
801
801
  const n = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
802
- return li(e).test(n);
802
+ return ai(e).test(n);
803
803
  }
804
- function si(e, t) {
805
- return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : ai(e, t);
804
+ function ci(e, t) {
805
+ return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : si(e, t);
806
806
  }
807
807
  function Tn(e, t) {
808
808
  if (!e || e.length === 0) return !1;
809
809
  for (const n of e)
810
- if (si(n, t)) return !0;
810
+ if (ci(n, t)) return !0;
811
811
  return !1;
812
812
  }
813
- function ci(e, t, n) {
813
+ function ui(e, t, n) {
814
814
  return e === void 0 ? !0 : Tn(n, e) ? !1 : t && t.length > 0 ? Tn(t, e) : !0;
815
815
  }
816
- function ui(e, t, n) {
816
+ function di(e, t, n) {
817
817
  return at(
818
- () => ci(e, t, n),
818
+ () => ui(e, t, n),
819
819
  [e, t, n]
820
820
  );
821
821
  }
822
- function di(e) {
822
+ function fi(e) {
823
823
  return e === !1 ? { navigate: !1, thinking: !1, action: !1 } : e === void 0 || e === !0 ? { navigate: !0, thinking: !0, action: !0 } : {
824
824
  navigate: e.navigate !== !1,
825
825
  thinking: e.thinking !== !1,
826
826
  action: e.action !== !1
827
827
  };
828
828
  }
829
- function fi(e) {
830
- const t = at(() => di(e.config), [e.config]), n = e.baseUrl.replace(/\/+$/, ""), i = T(null), l = C(
829
+ function pi(e) {
830
+ const t = at(() => fi(e.config), [e.config]), n = e.baseUrl.replace(/\/+$/, ""), i = R(null), l = L(
831
831
  (c) => {
832
832
  try {
833
833
  new Audio(`${n}${c}`).play().catch(() => {
@@ -836,11 +836,11 @@ function fi(e) {
836
836
  }
837
837
  },
838
838
  [n]
839
- ), o = C(() => {
839
+ ), o = L(() => {
840
840
  t.navigate && l("/audio/page-change-sound.mp3");
841
- }, [t.navigate, l]), s = C(() => {
841
+ }, [t.navigate, l]), s = L(() => {
842
842
  t.action && l("/audio/confirmation-sound.mp3");
843
- }, [t.action, l]), a = C(
843
+ }, [t.action, l]), a = L(
844
844
  (c) => {
845
845
  if (!t.thinking) {
846
846
  if (i.current) {
@@ -855,10 +855,10 @@ function fi(e) {
855
855
  if (c) {
856
856
  if (i.current) return;
857
857
  try {
858
- const u = new Audio(`${n}/audio/thinking-sound.mp3`);
859
- u.loop = !0, u.volume = 0.3, u.play().catch(() => {
858
+ const d = new Audio(`${n}/audio/thinking-sound.mp3`);
859
+ d.loop = !0, d.volume = 0.3, d.play().catch(() => {
860
860
  i.current = null;
861
- }), i.current = u;
861
+ }), i.current = d;
862
862
  } catch {
863
863
  }
864
864
  } else if (i.current) {
@@ -884,7 +884,7 @@ function fi(e) {
884
884
  [o, s, a]
885
885
  );
886
886
  }
887
- const Rn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ S(
887
+ const Pn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ S(
888
888
  "svg",
889
889
  {
890
890
  className: t,
@@ -948,7 +948,7 @@ const Rn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ S(
948
948
  }
949
949
  )
950
950
  }
951
- ), pi = ({ className: e }) => /* @__PURE__ */ r(
951
+ ), hi = ({ className: e }) => /* @__PURE__ */ r(
952
952
  "svg",
953
953
  {
954
954
  className: e,
@@ -959,12 +959,12 @@ const Rn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ S(
959
959
  "aria-hidden": "true",
960
960
  children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
961
961
  }
962
- ), hi = {
962
+ ), mi = {
963
963
  left: 180,
964
964
  right: 0,
965
965
  up: -90,
966
966
  down: 90
967
- }, Pn = ({ direction: e = "right", className: t }) => /* @__PURE__ */ r(
967
+ }, zn = ({ direction: e = "right", className: t }) => /* @__PURE__ */ r(
968
968
  "svg",
969
969
  {
970
970
  className: t,
@@ -972,19 +972,19 @@ const Rn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ S(
972
972
  viewBox: "0 0 24 24",
973
973
  stroke: "currentColor",
974
974
  strokeWidth: 2,
975
- style: { transform: `rotate(${hi[e]}deg)` },
975
+ style: { transform: `rotate(${mi[e]}deg)` },
976
976
  "aria-hidden": "true",
977
977
  children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" })
978
978
  }
979
979
  );
980
- function mi(e) {
980
+ function gi(e) {
981
981
  return e === "top-left" || e === "bottom-left" ? "left" : "right";
982
982
  }
983
- const rr = "ll-hidden-tab-center-y", gi = 5, zn = 16;
984
- function yi() {
983
+ const ir = "ll-hidden-tab-center-y", yi = 5, $n = 16;
984
+ function vi() {
985
985
  if (typeof window > "u") return null;
986
986
  try {
987
- const e = window.localStorage.getItem(rr);
987
+ const e = window.localStorage.getItem(ir);
988
988
  if (!e) return null;
989
989
  const t = Number.parseFloat(e);
990
990
  return Number.isFinite(t) ? t : null;
@@ -992,14 +992,14 @@ function yi() {
992
992
  return null;
993
993
  }
994
994
  }
995
- function $n(e) {
995
+ function Hn(e) {
996
996
  if (!(typeof window > "u"))
997
997
  try {
998
- window.localStorage.setItem(rr, String(e));
998
+ window.localStorage.setItem(ir, String(e));
999
999
  } catch {
1000
1000
  }
1001
1001
  }
1002
- const vi = ({
1002
+ const bi = ({
1003
1003
  position: e,
1004
1004
  isMobile: t,
1005
1005
  isSpeaking: n,
@@ -1009,50 +1009,50 @@ const vi = ({
1009
1009
  agentName: s,
1010
1010
  containerEl: a
1011
1011
  }) => {
1012
- const c = mi(e), u = c === "right" ? "left" : "right", m = t ? 80 : 72, p = !!o, h = !!a, [P, _] = M(null), [k, g] = M(!1), w = T(null), D = T(!1), E = C(
1012
+ const c = gi(e), d = c === "right" ? "left" : "right", g = t ? 80 : 72, p = !!o, m = !!a, [D, x] = M(null), [C, y] = M(!1), w = R(null), P = R(!1), E = L(
1013
1013
  (H) => {
1014
1014
  if (typeof window > "u") return H;
1015
- const G = m / 2, f = zn + G, A = window.innerHeight - zn - G;
1015
+ const G = g / 2, f = $n + G, A = window.innerHeight - $n - G;
1016
1016
  return A < f ? Math.max(f, H) : Math.max(f, Math.min(A, H));
1017
1017
  },
1018
- [m]
1018
+ [g]
1019
1019
  );
1020
1020
  I(() => {
1021
- if (h) {
1022
- _(null);
1021
+ if (m) {
1022
+ x(null);
1023
1023
  return;
1024
1024
  }
1025
- const H = yi();
1026
- _(E(H ?? window.innerHeight / 2));
1025
+ const H = vi();
1026
+ x(E(H ?? window.innerHeight / 2));
1027
1027
  const G = () => {
1028
- _((f) => f === null ? null : E(f));
1028
+ x((f) => f === null ? null : E(f));
1029
1029
  };
1030
1030
  return window.addEventListener("resize", G), () => window.removeEventListener("resize", G);
1031
- }, [E, h]);
1032
- const v = C(
1031
+ }, [E, m]);
1032
+ const b = L(
1033
1033
  (H) => {
1034
- if (!h && !(H.pointerType === "mouse" && H.button !== 0) && P !== null) {
1034
+ if (!m && !(H.pointerType === "mouse" && H.button !== 0) && D !== null) {
1035
1035
  try {
1036
1036
  H.currentTarget.setPointerCapture(H.pointerId);
1037
1037
  } catch {
1038
1038
  }
1039
1039
  w.current = {
1040
1040
  startClientY: H.clientY,
1041
- startCenterY: P,
1041
+ startCenterY: D,
1042
1042
  moved: !1
1043
1043
  };
1044
1044
  }
1045
1045
  },
1046
- [P, h]
1047
- ), O = C(
1046
+ [D, m]
1047
+ ), O = L(
1048
1048
  (H) => {
1049
1049
  const G = w.current;
1050
1050
  if (!G) return;
1051
1051
  const f = H.clientY - G.startClientY;
1052
- !G.moved && Math.abs(f) > gi && (G.moved = !0, g(!0)), G.moved && _(E(G.startCenterY + f));
1052
+ !G.moved && Math.abs(f) > yi && (G.moved = !0, y(!0)), G.moved && x(E(G.startCenterY + f));
1053
1053
  },
1054
1054
  [E]
1055
- ), y = C(
1055
+ ), v = L(
1056
1056
  (H) => {
1057
1057
  const G = w.current;
1058
1058
  if (G) {
@@ -1060,25 +1060,25 @@ const vi = ({
1060
1060
  H.currentTarget.releasePointerCapture(H.pointerId);
1061
1061
  } catch {
1062
1062
  }
1063
- w.current = null, G.moved && (g(!1), D.current = !0, _((f) => (f !== null && $n(f), f)));
1063
+ w.current = null, G.moved && (y(!1), P.current = !0, x((f) => (f !== null && Hn(f), f)));
1064
1064
  }
1065
1065
  },
1066
1066
  []
1067
- ), z = C(() => {
1068
- if (D.current) {
1069
- D.current = !1;
1067
+ ), z = L(() => {
1068
+ if (P.current) {
1069
+ P.current = !1;
1070
1070
  return;
1071
1071
  }
1072
1072
  i();
1073
- }, [i]), B = C(
1073
+ }, [i]), B = L(
1074
1074
  (H) => {
1075
1075
  if (H.key === "ArrowUp" || H.key === "ArrowDown") {
1076
1076
  H.preventDefault();
1077
1077
  const G = H.key === "ArrowUp" ? -8 : 8;
1078
- _((f) => {
1078
+ x((f) => {
1079
1079
  if (f === null) return f;
1080
1080
  const A = E(f + G);
1081
- return $n(A), A;
1081
+ return Hn(A), A;
1082
1082
  });
1083
1083
  }
1084
1084
  },
@@ -1088,19 +1088,19 @@ const vi = ({
1088
1088
  `ll-hidden--${c}`,
1089
1089
  t ? "ll-hidden--mobile" : "ll-hidden--desktop",
1090
1090
  n ? "ll-hidden--speaking" : null,
1091
- k ? "is-dragging" : null,
1091
+ C ? "is-dragging" : null,
1092
1092
  p ? "ll-hidden--with-avatar" : null,
1093
- h ? "ll-hidden--scoped" : null
1094
- ].filter(Boolean).join(" "), le = P === null ? void 0 : { top: `${P - m / 2}px`, transform: "none" };
1093
+ m ? "ll-hidden--scoped" : null
1094
+ ].filter(Boolean).join(" "), le = D === null ? void 0 : { top: `${D - g / 2}px`, transform: "none" };
1095
1095
  return /* @__PURE__ */ r(
1096
1096
  "button",
1097
1097
  {
1098
1098
  type: "button",
1099
1099
  className: J,
1100
- onPointerDown: v,
1100
+ onPointerDown: b,
1101
1101
  onPointerMove: O,
1102
- onPointerUp: y,
1103
- onPointerCancel: y,
1102
+ onPointerUp: v,
1103
+ onPointerCancel: v,
1104
1104
  onClick: z,
1105
1105
  onKeyDown: B,
1106
1106
  "aria-label": l,
@@ -1113,9 +1113,9 @@ const vi = ({
1113
1113
  // avatar-based experience" even when collapsed.
1114
1114
  /* @__PURE__ */ S(Ve, { children: [
1115
1115
  /* @__PURE__ */ r(
1116
- Pn,
1116
+ zn,
1117
1117
  {
1118
- direction: u,
1118
+ direction: d,
1119
1119
  className: "ll-hidden__chevron ll-hidden__chevron--mini"
1120
1120
  }
1121
1121
  ),
@@ -1130,15 +1130,15 @@ const vi = ({
1130
1130
  )
1131
1131
  ] })
1132
1132
  ) : /* @__PURE__ */ r(
1133
- Pn,
1133
+ zn,
1134
1134
  {
1135
- direction: u,
1135
+ direction: d,
1136
1136
  className: "ll-hidden__chevron"
1137
1137
  }
1138
1138
  )
1139
1139
  }
1140
1140
  );
1141
- }, bi = ({
1141
+ }, wi = ({
1142
1142
  audioLevel: e,
1143
1143
  bars: t = 20,
1144
1144
  maxHeight: n = 20,
@@ -1146,31 +1146,31 @@ const vi = ({
1146
1146
  className: l,
1147
1147
  barClassName: o
1148
1148
  }) => {
1149
- const s = T(null), a = T([]), c = at(() => {
1150
- const m = (Math.sqrt(5) - 1) / 2;
1151
- return Array.from({ length: t }, (p, h) => 0.5 + h * m % 1 * 0.5);
1149
+ const s = R(null), a = R([]), c = at(() => {
1150
+ const g = (Math.sqrt(5) - 1) / 2;
1151
+ return Array.from({ length: t }, (p, m) => 0.5 + m * g % 1 * 0.5);
1152
1152
  }, [t]);
1153
1153
  I(() => e.subscribe((p) => {
1154
- for (let h = 0; h < t; h++) {
1155
- const P = a.current[h];
1156
- if (!P) continue;
1157
- const _ = Math.max(i, p * n * c[h]);
1158
- P.style.height = `${_}px`;
1154
+ for (let m = 0; m < t; m++) {
1155
+ const D = a.current[m];
1156
+ if (!D) continue;
1157
+ const x = Math.max(i, p * n * c[m]);
1158
+ D.style.height = `${x}px`;
1159
1159
  }
1160
1160
  }), [e, t, n, i, c]);
1161
- const u = ["ll-waveform", l].filter(Boolean).join(" ");
1162
- return /* @__PURE__ */ r("div", { ref: s, className: u, "aria-hidden": "true", children: Array.from({ length: t }, (m, p) => /* @__PURE__ */ r(
1161
+ const d = ["ll-waveform", l].filter(Boolean).join(" ");
1162
+ return /* @__PURE__ */ r("div", { ref: s, className: d, "aria-hidden": "true", children: Array.from({ length: t }, (g, p) => /* @__PURE__ */ r(
1163
1163
  "div",
1164
1164
  {
1165
- ref: (h) => {
1166
- a.current[p] = h;
1165
+ ref: (m) => {
1166
+ a.current[p] = m;
1167
1167
  },
1168
1168
  className: ["ll-waveform__bar", o].filter(Boolean).join(" "),
1169
1169
  style: { height: `${i}px` }
1170
1170
  },
1171
1171
  p
1172
1172
  )) });
1173
- }, wi = ({
1173
+ }, _i = ({
1174
1174
  position: e,
1175
1175
  isMobile: t,
1176
1176
  agentName: n,
@@ -1180,7 +1180,7 @@ const vi = ({
1180
1180
  audioLevel: s,
1181
1181
  onExpand: a,
1182
1182
  onToggleMute: c,
1183
- onClose: u
1183
+ onClose: d
1184
1184
  }) => t ? /* @__PURE__ */ r(
1185
1185
  "div",
1186
1186
  {
@@ -1207,7 +1207,7 @@ const vi = ({
1207
1207
  )
1208
1208
  ) : /* @__PURE__ */ r("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
1209
1209
  /* @__PURE__ */ r(
1210
- bi,
1210
+ wi,
1211
1211
  {
1212
1212
  audioLevel: s,
1213
1213
  bars: 16,
@@ -1223,14 +1223,14 @@ const vi = ({
1223
1223
  className: "ll-minimized__btn",
1224
1224
  role: "button",
1225
1225
  tabIndex: 0,
1226
- onClick: (m) => {
1227
- m.stopPropagation(), c();
1226
+ onClick: (g) => {
1227
+ g.stopPropagation(), c();
1228
1228
  },
1229
- onKeyDown: (m) => {
1230
- (m.key === "Enter" || m.key === " ") && (m.stopPropagation(), m.preventDefault(), c());
1229
+ onKeyDown: (g) => {
1230
+ (g.key === "Enter" || g.key === " ") && (g.stopPropagation(), g.preventDefault(), c());
1231
1231
  },
1232
1232
  "aria-label": o ? "Unmute microphone" : "Mute microphone",
1233
- children: /* @__PURE__ */ r(Rn, { muted: o, className: "ll-minimized__icon" })
1233
+ children: /* @__PURE__ */ r(Pn, { muted: o, className: "ll-minimized__icon" })
1234
1234
  }
1235
1235
  ),
1236
1236
  /* @__PURE__ */ r(Dn, { className: "ll-minimized__icon ll-minimized__icon--expand" })
@@ -1270,7 +1270,7 @@ const vi = ({
1270
1270
  className: "ll-minimized__btn",
1271
1271
  onClick: c,
1272
1272
  "aria-label": o ? "Unmute microphone" : "Mute microphone",
1273
- children: /* @__PURE__ */ r(Rn, { muted: o, className: "ll-minimized__icon" })
1273
+ children: /* @__PURE__ */ r(Pn, { muted: o, className: "ll-minimized__icon" })
1274
1274
  }
1275
1275
  ),
1276
1276
  /* @__PURE__ */ r(
@@ -1288,22 +1288,22 @@ const vi = ({
1288
1288
  {
1289
1289
  type: "button",
1290
1290
  className: "ll-minimized__btn ll-minimized__btn--close",
1291
- onClick: u,
1291
+ onClick: d,
1292
1292
  "aria-label": "Close widget",
1293
- children: /* @__PURE__ */ r(pi, { className: "ll-minimized__icon" })
1293
+ children: /* @__PURE__ */ r(hi, { className: "ll-minimized__icon" })
1294
1294
  }
1295
1295
  )
1296
1296
  ] })
1297
1297
  ] })
1298
1298
  }
1299
- ), _i = ({
1299
+ ), xi = ({
1300
1300
  src: e,
1301
1301
  alt: t,
1302
1302
  preCannedPlaying: n = !1,
1303
1303
  className: i,
1304
1304
  style: l
1305
1305
  }) => {
1306
- const [o, s] = M(!1), a = T(e);
1306
+ const [o, s] = M(!1), a = R(e);
1307
1307
  if (I(() => {
1308
1308
  a.current !== e && (a.current = e, s(!1));
1309
1309
  }, [e]), !e) return null;
@@ -1334,11 +1334,11 @@ const vi = ({
1334
1334
  }
1335
1335
  )
1336
1336
  );
1337
- }, xi = "#E06540";
1337
+ }, ki = "#E06540";
1338
1338
  function Li({
1339
1339
  size: e = 14,
1340
1340
  className: t,
1341
- fill: n = xi
1341
+ fill: n = ki
1342
1342
  }) {
1343
1343
  return /* @__PURE__ */ S(
1344
1344
  "svg",
@@ -1376,14 +1376,14 @@ function Li({
1376
1376
  }
1377
1377
  );
1378
1378
  }
1379
- const Ci = 8, Hn = 8, ki = ({
1379
+ const Ci = 8, On = 8, Si = ({
1380
1380
  open: e,
1381
1381
  onClose: t,
1382
1382
  anchorRef: n,
1383
1383
  children: i
1384
1384
  }) => {
1385
- const l = T(null), [o, s] = M(null);
1386
- return Qn(() => {
1385
+ const l = R(null), [o, s] = M(null);
1386
+ return er(() => {
1387
1387
  if (!e) {
1388
1388
  s(null);
1389
1389
  return;
@@ -1391,27 +1391,27 @@ const Ci = 8, Hn = 8, ki = ({
1391
1391
  const a = n.current;
1392
1392
  if (!a) return;
1393
1393
  const c = () => {
1394
- const u = a.getBoundingClientRect(), m = {
1395
- top: u.top - Ci,
1396
- left: u.left + u.width / 2
1397
- }, p = Hn + 90, h = window.innerWidth - Hn - 90;
1398
- m.left < p && (m.left = p), m.left > h && (m.left = h), s(m);
1394
+ const d = a.getBoundingClientRect(), g = {
1395
+ top: d.top - Ci,
1396
+ left: d.left + d.width / 2
1397
+ }, p = On + 90, m = window.innerWidth - On - 90;
1398
+ g.left < p && (g.left = p), g.left > m && (g.left = m), s(g);
1399
1399
  };
1400
1400
  return c(), window.addEventListener("scroll", c, !0), window.addEventListener("resize", c), () => {
1401
1401
  window.removeEventListener("scroll", c, !0), window.removeEventListener("resize", c);
1402
1402
  };
1403
1403
  }, [e, n]), I(() => {
1404
1404
  if (!e) return;
1405
- const a = (u) => {
1406
- const m = u.target, p = l.current, h = n.current;
1407
- p && p.contains(m) || h && h.contains(m) || t();
1408
- }, c = (u) => {
1409
- u.key === "Escape" && (u.stopPropagation(), t());
1405
+ const a = (d) => {
1406
+ const g = d.target, p = l.current, m = n.current;
1407
+ p && p.contains(g) || m && m.contains(g) || t();
1408
+ }, c = (d) => {
1409
+ d.key === "Escape" && (d.stopPropagation(), t());
1410
1410
  };
1411
1411
  return document.addEventListener("mousedown", a), document.addEventListener("keydown", c), () => {
1412
1412
  document.removeEventListener("mousedown", a), document.removeEventListener("keydown", c);
1413
1413
  };
1414
- }, [e, t, n]), !e || o === null || typeof document > "u" ? null : on(
1414
+ }, [e, t, n]), !e || o === null || typeof document > "u" ? null : ln(
1415
1415
  /* @__PURE__ */ r(
1416
1416
  "div",
1417
1417
  {
@@ -1431,7 +1431,7 @@ const Ci = 8, Hn = 8, ki = ({
1431
1431
  ),
1432
1432
  document.body
1433
1433
  );
1434
- }, Si = ({
1434
+ }, Ei = ({
1435
1435
  isMuted: e,
1436
1436
  onToggleMute: t,
1437
1437
  isCameraEnabled: n,
@@ -1441,13 +1441,13 @@ const Ci = 8, Hn = 8, ki = ({
1441
1441
  onToggleScreenShare: s,
1442
1442
  allowScreenShare: a,
1443
1443
  isSpeakerMuted: c,
1444
- onToggleSpeaker: u,
1445
- allowTyping: m,
1444
+ onToggleSpeaker: d,
1445
+ allowTyping: g,
1446
1446
  isTypingOpen: p,
1447
- onToggleTyping: h,
1448
- onDisconnect: P
1447
+ onToggleTyping: m,
1448
+ onDisconnect: D
1449
1449
  }) => {
1450
- const [_, k] = M(!1), g = T(null);
1450
+ const [x, C] = M(!1), y = R(null);
1451
1451
  return /* @__PURE__ */ S(Ve, { children: [
1452
1452
  /* @__PURE__ */ S(
1453
1453
  "div",
@@ -1463,20 +1463,20 @@ const Ci = 8, Hn = 8, ki = ({
1463
1463
  className: `ll-tool ${e ? "is-muted" : ""}`,
1464
1464
  onClick: t,
1465
1465
  "aria-label": e ? "Unmute microphone" : "Mute microphone",
1466
- children: /* @__PURE__ */ r(lr, { muted: e })
1466
+ children: /* @__PURE__ */ r(ar, { muted: e })
1467
1467
  }
1468
1468
  ),
1469
1469
  /* @__PURE__ */ r(
1470
1470
  "button",
1471
1471
  {
1472
- ref: g,
1472
+ ref: y,
1473
1473
  type: "button",
1474
- className: `ll-tool ${_ ? "is-on" : ""}`,
1475
- onClick: () => k((w) => !w),
1474
+ className: `ll-tool ${x ? "is-on" : ""}`,
1475
+ onClick: () => C((w) => !w),
1476
1476
  "aria-label": "More controls",
1477
1477
  "aria-haspopup": "menu",
1478
- "aria-expanded": _,
1479
- children: /* @__PURE__ */ r(Ei, {})
1478
+ "aria-expanded": x,
1479
+ children: /* @__PURE__ */ r(Ai, {})
1480
1480
  }
1481
1481
  ),
1482
1482
  /* @__PURE__ */ r(
@@ -1484,20 +1484,20 @@ const Ci = 8, Hn = 8, ki = ({
1484
1484
  {
1485
1485
  type: "button",
1486
1486
  className: "ll-tool ll-tool--danger",
1487
- onClick: P,
1487
+ onClick: D,
1488
1488
  "aria-label": "End conversation",
1489
- children: /* @__PURE__ */ r(sr, {})
1489
+ children: /* @__PURE__ */ r(cr, {})
1490
1490
  }
1491
1491
  )
1492
1492
  ]
1493
1493
  }
1494
1494
  ),
1495
1495
  /* @__PURE__ */ S(
1496
- ki,
1496
+ Si,
1497
1497
  {
1498
- open: _,
1499
- onClose: () => k(!1),
1500
- anchorRef: g,
1498
+ open: x,
1499
+ onClose: () => C(!1),
1500
+ anchorRef: y,
1501
1501
  children: [
1502
1502
  l && /* @__PURE__ */ S(
1503
1503
  "button",
@@ -1505,10 +1505,10 @@ const Ci = 8, Hn = 8, ki = ({
1505
1505
  type: "button",
1506
1506
  className: `ll-overflow-popover__item ${n ? "is-on" : ""}`,
1507
1507
  onClick: () => {
1508
- i(), k(!1);
1508
+ i(), C(!1);
1509
1509
  },
1510
1510
  children: [
1511
- /* @__PURE__ */ r(or, {}),
1511
+ /* @__PURE__ */ r(lr, {}),
1512
1512
  /* @__PURE__ */ r("span", { children: n ? "Stop camera" : "Start camera" })
1513
1513
  ]
1514
1514
  }
@@ -1519,10 +1519,10 @@ const Ci = 8, Hn = 8, ki = ({
1519
1519
  type: "button",
1520
1520
  className: `ll-overflow-popover__item ${o ? "is-on" : ""}`,
1521
1521
  onClick: () => {
1522
- s(), k(!1);
1522
+ s(), C(!1);
1523
1523
  },
1524
1524
  children: [
1525
- /* @__PURE__ */ r(ir, {}),
1525
+ /* @__PURE__ */ r(or, {}),
1526
1526
  /* @__PURE__ */ r("span", { children: o ? "Stop sharing" : "Share screen" })
1527
1527
  ]
1528
1528
  }
@@ -1533,24 +1533,24 @@ const Ci = 8, Hn = 8, ki = ({
1533
1533
  type: "button",
1534
1534
  className: `ll-overflow-popover__item ${c ? "is-on" : ""}`,
1535
1535
  onClick: () => {
1536
- u(), k(!1);
1536
+ d(), C(!1);
1537
1537
  },
1538
1538
  children: [
1539
- /* @__PURE__ */ r(ar, { muted: c }),
1539
+ /* @__PURE__ */ r(sr, { muted: c }),
1540
1540
  /* @__PURE__ */ r("span", { children: c ? "Unmute speaker" : "Mute speaker" })
1541
1541
  ]
1542
1542
  }
1543
1543
  ),
1544
- m && /* @__PURE__ */ S(
1544
+ g && /* @__PURE__ */ S(
1545
1545
  "button",
1546
1546
  {
1547
1547
  type: "button",
1548
1548
  className: `ll-overflow-popover__item ${p ? "is-on" : ""}`,
1549
1549
  onClick: () => {
1550
- h(), k(!1);
1550
+ m(), C(!1);
1551
1551
  },
1552
1552
  children: [
1553
- /* @__PURE__ */ r(Ai, {}),
1553
+ /* @__PURE__ */ r(Ni, {}),
1554
1554
  /* @__PURE__ */ r("span", { children: p ? "Hide typing" : "Type a message" })
1555
1555
  ]
1556
1556
  }
@@ -1573,7 +1573,7 @@ const Ci = 8, Hn = 8, ki = ({
1573
1573
  )
1574
1574
  ] });
1575
1575
  };
1576
- function Ei() {
1576
+ function Ai() {
1577
1577
  return /* @__PURE__ */ S(
1578
1578
  "svg",
1579
1579
  {
@@ -1590,7 +1590,7 @@ function Ei() {
1590
1590
  }
1591
1591
  );
1592
1592
  }
1593
- function Ai() {
1593
+ function Ni() {
1594
1594
  return /* @__PURE__ */ r(
1595
1595
  "svg",
1596
1596
  {
@@ -1607,7 +1607,7 @@ function Ai() {
1607
1607
  }
1608
1608
  );
1609
1609
  }
1610
- const Ni = ({
1610
+ const Mi = ({
1611
1611
  position: e,
1612
1612
  isMobile: t,
1613
1613
  agentName: n,
@@ -1617,20 +1617,20 @@ const Ni = ({
1617
1617
  branding: s,
1618
1618
  teamMembers: a,
1619
1619
  currentTeamMemberId: c,
1620
- isSwitchingTeamMember: u,
1621
- teamSwitcherOpen: m,
1620
+ isSwitchingTeamMember: d,
1621
+ teamSwitcherOpen: g,
1622
1622
  onToggleTeamSwitcher: p,
1623
- onSelectTeamMember: h,
1624
- languageMenuOpen: P,
1625
- onToggleLanguageMenu: _,
1626
- connectionState: k,
1627
- agentState: g,
1623
+ onSelectTeamMember: m,
1624
+ languageMenuOpen: D,
1625
+ onToggleLanguageMenu: x,
1626
+ connectionState: C,
1627
+ agentState: y,
1628
1628
  transcript: w,
1629
- canResume: D,
1629
+ canResume: P,
1630
1630
  needsUserGesture: E,
1631
- error: v,
1631
+ error: b,
1632
1632
  isMuted: O,
1633
- micError: y,
1633
+ micError: v,
1634
1634
  micDevices: z,
1635
1635
  activeMicId: B,
1636
1636
  isCameraEnabled: J,
@@ -1642,21 +1642,21 @@ const Ni = ({
1642
1642
  isSpeakerMuted: $,
1643
1643
  allowCamera: q,
1644
1644
  allowScreenShare: X,
1645
- allowTyping: ee,
1645
+ allowTyping: te,
1646
1646
  showMinimize: W = !0,
1647
- showClose: te = !0,
1647
+ showClose: ne = !0,
1648
1648
  chromeless: ie = !1,
1649
1649
  compactControls: U = !1,
1650
1650
  transforming: ge,
1651
1651
  transformingLabel: Z,
1652
- avatarVideoContainerRef: Ce,
1653
- agentVideoEl: ne,
1652
+ avatarVideoContainerRef: Le,
1653
+ agentVideoEl: re,
1654
1654
  onConnect: Me,
1655
1655
  onDisconnect: st,
1656
1656
  onRetry: _t,
1657
1657
  onResumeAudio: xt,
1658
1658
  onToggleMute: ct,
1659
- onSwitchMicDevice: Lt,
1659
+ onSwitchMicDevice: kt,
1660
1660
  onToggleCamera: Ye,
1661
1661
  onSwitchCameraDevice: Ge,
1662
1662
  onToggleScreenShare: $e,
@@ -1669,75 +1669,75 @@ const Ni = ({
1669
1669
  resizeHandleProps: F
1670
1670
  }) => {
1671
1671
  var et;
1672
- const qe = ((a == null ? void 0 : a.length) ?? 0) > 1, Ke = k === "connecting" || k === "connected", ke = k === "connected", Ct = k === "idle" || k === "disconnected" || k === "error", [ut, Ie] = M(!1);
1672
+ const qe = ((a == null ? void 0 : a.length) ?? 0) > 1, Ke = C === "connecting" || C === "connected", Ce = C === "connected", Lt = C === "idle" || C === "disconnected" || C === "error", [ut, Ie] = M(!1);
1673
1673
  I(() => {
1674
- if (!ne) {
1674
+ if (!re) {
1675
1675
  Ie(!1);
1676
1676
  return;
1677
1677
  }
1678
- if (!ne.paused && ne.readyState >= 2) {
1678
+ if (!re.paused && re.readyState >= 2) {
1679
1679
  Ie(!0);
1680
1680
  return;
1681
1681
  }
1682
1682
  Ie(!1);
1683
- const x = () => Ie(!0);
1684
- return ne.addEventListener("playing", x), ne.addEventListener("loadeddata", x), () => {
1685
- ne.removeEventListener("playing", x), ne.removeEventListener("loadeddata", x);
1683
+ const k = () => Ie(!0);
1684
+ return re.addEventListener("playing", k), re.addEventListener("loadeddata", k), () => {
1685
+ re.removeEventListener("playing", k), re.removeEventListener("loadeddata", k);
1686
1686
  };
1687
- }, [ne]);
1688
- const [dt, kt] = M(!1);
1687
+ }, [re]);
1688
+ const [dt, Ct] = M(!1);
1689
1689
  I(() => {
1690
- g === "speaking" && kt(!0);
1691
- }, [g]), I(() => {
1692
- (k === "disconnected" || k === "idle") && kt(!1);
1693
- }, [k]);
1690
+ y === "speaking" && Ct(!0);
1691
+ }, [y]), I(() => {
1692
+ (C === "disconnected" || C === "idle") && Ct(!1);
1693
+ }, [C]);
1694
1694
  const [Ue, ue] = M(!1);
1695
1695
  I(() => {
1696
- if (!ke) {
1696
+ if (!Ce) {
1697
1697
  ue(!1);
1698
1698
  return;
1699
1699
  }
1700
1700
  if (dt) return;
1701
- const x = setTimeout(() => ue(!0), 12e3);
1702
- return () => clearTimeout(x);
1703
- }, [ke, dt]);
1704
- const St = k === "connecting" || ke && !dt && !Ue, de = T(null), ve = T(null);
1701
+ const k = setTimeout(() => ue(!0), 12e3);
1702
+ return () => clearTimeout(k);
1703
+ }, [Ce, dt]);
1704
+ const St = C === "connecting" || Ce && !dt && !Ue, de = R(null), ve = R(null);
1705
1705
  I(() => {
1706
- const x = de.current;
1707
- x && (x.innerHTML = "", le && (le.style.width = "100%", le.style.height = "100%", le.style.objectFit = "cover", le.style.transform = "scaleX(-1)", x.appendChild(le)));
1706
+ const k = de.current;
1707
+ k && (k.innerHTML = "", le && (le.style.width = "100%", le.style.height = "100%", le.style.objectFit = "cover", le.style.transform = "scaleX(-1)", k.appendChild(le)));
1708
1708
  }, [le]), I(() => {
1709
- const x = ve.current;
1710
- x && (x.innerHTML = "", A && (A.style.width = "100%", A.style.height = "100%", A.style.objectFit = "contain", x.appendChild(A)));
1709
+ const k = ve.current;
1710
+ k && (k.innerHTML = "", A && (A.style.width = "100%", A.style.height = "100%", A.style.objectFit = "contain", k.appendChild(A)));
1711
1711
  }, [A]);
1712
- const [Je, Ze] = M(!1), [pe, be] = M(!1), Et = T(null), At = T(null);
1712
+ const [Je, Ze] = M(!1), [pe, be] = M(!1), Et = R(null), At = R(null);
1713
1713
  I(() => {
1714
- if (!Je && !pe && !P && !m) return;
1715
- const x = () => {
1716
- Ze(!1), be(!1), P && _(), m && p();
1714
+ if (!Je && !pe && !D && !g) return;
1715
+ const k = () => {
1716
+ Ze(!1), be(!1), D && x(), g && p();
1717
1717
  };
1718
- return document.addEventListener("click", x), () => document.removeEventListener("click", x);
1718
+ return document.addEventListener("click", k), () => document.removeEventListener("click", k);
1719
1719
  }, [
1720
1720
  Je,
1721
1721
  pe,
1722
- P,
1723
- m,
1724
- _,
1722
+ D,
1723
+ g,
1724
+ x,
1725
1725
  p
1726
1726
  ]);
1727
- const [Nt, ln] = M(!1), an = C(() => ln((x) => !x), []), [_e, Te] = M(""), Ae = C(
1728
- (x) => {
1729
- x.preventDefault();
1727
+ const [Nt, an] = M(!1), sn = L(() => an((k) => !k), []), [_e, Re] = M(""), Ae = L(
1728
+ (k) => {
1729
+ k.preventDefault();
1730
1730
  const ae = _e.trim();
1731
- ae && (Oe(ae), Te(""));
1731
+ ae && (Oe(ae), Re(""));
1732
1732
  },
1733
1733
  [_e, Oe]
1734
- ), Re = s.productName || "Live Layer", ft = !s.productName;
1735
- let De = null, Se = null;
1736
- for (let x = w.length - 1; x >= 0; x--) {
1737
- const ae = w[x];
1738
- if (!De && ae.role === "agent" ? De = ae : !Se && ae.role === "user" && (Se = ae), De && Se) break;
1734
+ ), Te = s.productName || "Live Layer", ft = !s.productName;
1735
+ let Pe = null, Se = null;
1736
+ for (let k = w.length - 1; k >= 0; k--) {
1737
+ const ae = w[k];
1738
+ if (!Pe && ae.role === "agent" ? Pe = ae : !Se && ae.role === "user" && (Se = ae), Pe && Se) break;
1739
1739
  }
1740
- const Qe = ke ? (De == null ? void 0 : De.text) || null : o || null, pt = ke && (Se == null ? void 0 : Se.text) || null, ht = [
1740
+ const Qe = Ce ? (Pe == null ? void 0 : Pe.text) || null : o || null, pt = Ce && (Se == null ? void 0 : Se.text) || null, ht = [
1741
1741
  "ll-expanded",
1742
1742
  t ? "ll-expanded--mobile" : "ll-expanded--desktop"
1743
1743
  ].join(" ");
@@ -1746,20 +1746,20 @@ const Ni = ({
1746
1746
  {
1747
1747
  className: ht,
1748
1748
  "data-position": e,
1749
- "data-state": ke ? "connected" : Ke ? "connecting" : "idle",
1749
+ "data-state": Ce ? "connected" : Ke ? "connecting" : "idle",
1750
1750
  role: "dialog",
1751
1751
  "aria-label": `${n} widget`,
1752
1752
  children: [
1753
1753
  /* @__PURE__ */ S("div", { className: "ll-expanded__bg", children: [
1754
1754
  i ? /* @__PURE__ */ r(
1755
- _i,
1755
+ xi,
1756
1756
  {
1757
1757
  src: i,
1758
1758
  alt: n,
1759
1759
  className: "ll-expanded__bg-img"
1760
1760
  }
1761
1761
  ) : /* @__PURE__ */ r("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ r("span", { className: "ll-expanded__bg-initial", children: ((et = n == null ? void 0 : n.charAt(0)) == null ? void 0 : et.toUpperCase()) || "A" }) }),
1762
- l && !ke && /* @__PURE__ */ r(
1762
+ l && !Ce && /* @__PURE__ */ r(
1763
1763
  "video",
1764
1764
  {
1765
1765
  className: "ll-expanded__bg-idle",
@@ -1774,16 +1774,16 @@ const Ni = ({
1774
1774
  /* @__PURE__ */ r(
1775
1775
  "div",
1776
1776
  {
1777
- ref: Ce,
1777
+ ref: Le,
1778
1778
  className: "ll-expanded__video",
1779
1779
  "data-ready": ut
1780
1780
  }
1781
1781
  ),
1782
1782
  St && /* @__PURE__ */ S("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1783
1783
  /* @__PURE__ */ r("div", { className: "ll-expanded__spinner" }),
1784
- /* @__PURE__ */ r("p", { className: "ll-expanded__overlay-text", children: u ? "Switching..." : "Connecting..." })
1784
+ /* @__PURE__ */ r("p", { className: "ll-expanded__overlay-text", children: d ? "Switching..." : "Connecting..." })
1785
1785
  ] }),
1786
- E && ke && /* @__PURE__ */ S(
1786
+ E && Ce && /* @__PURE__ */ S(
1787
1787
  "button",
1788
1788
  {
1789
1789
  type: "button",
@@ -1817,45 +1817,45 @@ const Ni = ({
1817
1817
  {
1818
1818
  type: "button",
1819
1819
  className: "ll-hpill",
1820
- onClick: (x) => {
1821
- qe && (x.stopPropagation(), p());
1820
+ onClick: (k) => {
1821
+ qe && (k.stopPropagation(), p());
1822
1822
  },
1823
1823
  "aria-haspopup": qe ? "listbox" : void 0,
1824
- "aria-expanded": qe ? m : void 0,
1824
+ "aria-expanded": qe ? g : void 0,
1825
1825
  children: [
1826
1826
  /* @__PURE__ */ r("span", { className: "ll-hpill__label", children: n }),
1827
- qe && /* @__PURE__ */ r(Ht, {})
1827
+ qe && /* @__PURE__ */ r(Ot, {})
1828
1828
  ]
1829
1829
  }
1830
1830
  ),
1831
- qe && m && /* @__PURE__ */ r(
1831
+ qe && g && /* @__PURE__ */ r(
1832
1832
  "div",
1833
1833
  {
1834
1834
  className: "ll-hmenu",
1835
- onClick: (x) => x.stopPropagation(),
1835
+ onClick: (k) => k.stopPropagation(),
1836
1836
  role: "listbox",
1837
- children: a == null ? void 0 : a.map((x) => /* @__PURE__ */ S(
1837
+ children: a == null ? void 0 : a.map((k) => /* @__PURE__ */ S(
1838
1838
  "button",
1839
1839
  {
1840
1840
  type: "button",
1841
- className: `ll-hmenu__item ${x.id === c ? "is-active" : ""}`,
1842
- onClick: () => h(x.id),
1841
+ className: `ll-hmenu__item ${k.id === c ? "is-active" : ""}`,
1842
+ onClick: () => m(k.id),
1843
1843
  role: "option",
1844
- "aria-selected": x.id === c,
1844
+ "aria-selected": k.id === c,
1845
1845
  children: [
1846
- x.avatarImageUrl && /* @__PURE__ */ r(
1846
+ k.avatarImageUrl && /* @__PURE__ */ r(
1847
1847
  "img",
1848
1848
  {
1849
- src: x.avatarImageUrl,
1849
+ src: k.avatarImageUrl,
1850
1850
  alt: "",
1851
1851
  className: "ll-hmenu__avatar"
1852
1852
  }
1853
1853
  ),
1854
- /* @__PURE__ */ r("span", { className: "ll-hmenu__name", children: x.name }),
1855
- x.role && /* @__PURE__ */ r("span", { className: "ll-hmenu__role", children: x.role })
1854
+ /* @__PURE__ */ r("span", { className: "ll-hmenu__name", children: k.name }),
1855
+ k.role && /* @__PURE__ */ r("span", { className: "ll-hmenu__role", children: k.role })
1856
1856
  ]
1857
1857
  },
1858
- x.id
1858
+ k.id
1859
1859
  ))
1860
1860
  }
1861
1861
  )
@@ -1866,24 +1866,24 @@ const Ni = ({
1866
1866
  {
1867
1867
  type: "button",
1868
1868
  className: "ll-hpill ll-hpill--compact",
1869
- onClick: (x) => {
1870
- x.stopPropagation(), _();
1869
+ onClick: (k) => {
1870
+ k.stopPropagation(), x();
1871
1871
  },
1872
1872
  "aria-haspopup": "listbox",
1873
- "aria-expanded": P,
1873
+ "aria-expanded": D,
1874
1874
  "aria-label": "Language: English",
1875
1875
  title: "Language: English",
1876
1876
  children: [
1877
1877
  /* @__PURE__ */ r("span", { className: "ll-hpill__label", children: "EN" }),
1878
- /* @__PURE__ */ r(Ht, {})
1878
+ /* @__PURE__ */ r(Ot, {})
1879
1879
  ]
1880
1880
  }
1881
1881
  ),
1882
- P && /* @__PURE__ */ r(
1882
+ D && /* @__PURE__ */ r(
1883
1883
  "div",
1884
1884
  {
1885
1885
  className: "ll-hmenu",
1886
- onClick: (x) => x.stopPropagation(),
1886
+ onClick: (k) => k.stopPropagation(),
1887
1887
  role: "listbox",
1888
1888
  children: /* @__PURE__ */ r(
1889
1889
  "button",
@@ -1901,8 +1901,8 @@ const Ni = ({
1901
1901
  /* @__PURE__ */ r(
1902
1902
  "span",
1903
1903
  {
1904
- className: `ll-expanded__state ll-expanded__state--${g}`,
1905
- children: g
1904
+ className: `ll-expanded__state ll-expanded__state--${y}`,
1905
+ children: y
1906
1906
  }
1907
1907
  )
1908
1908
  ] }),
@@ -1915,10 +1915,10 @@ const Ni = ({
1915
1915
  onClick: Fe,
1916
1916
  "aria-label": "Minimize widget",
1917
1917
  title: "Minimize",
1918
- children: /* @__PURE__ */ r(Fn, {})
1918
+ children: /* @__PURE__ */ r(Bn, {})
1919
1919
  }
1920
1920
  ),
1921
- te !== !1 && /* @__PURE__ */ r(
1921
+ ne !== !1 && /* @__PURE__ */ r(
1922
1922
  "button",
1923
1923
  {
1924
1924
  type: "button",
@@ -1926,14 +1926,14 @@ const Ni = ({
1926
1926
  onClick: Be,
1927
1927
  "aria-label": "End call",
1928
1928
  title: "End call",
1929
- children: /* @__PURE__ */ r(On, {})
1929
+ children: /* @__PURE__ */ r(Fn, {})
1930
1930
  }
1931
1931
  )
1932
1932
  ] })
1933
1933
  ] }),
1934
- U && /* @__PURE__ */ S("div", { className: "ll-compact-status", "data-state": g, children: [
1934
+ U && /* @__PURE__ */ S("div", { className: "ll-compact-status", "data-state": y, children: [
1935
1935
  /* @__PURE__ */ r("span", { className: "ll-compact-status__dot", "aria-hidden": !0 }),
1936
- /* @__PURE__ */ r("span", { className: "ll-compact-status__label", children: g })
1936
+ /* @__PURE__ */ r("span", { className: "ll-compact-status__label", children: y })
1937
1937
  ] })
1938
1938
  ] }) : (
1939
1939
  // Idle-state header. In compactControls mode (mobile WIDGET +
@@ -1956,10 +1956,10 @@ const Ni = ({
1956
1956
  title: "Powered by LiveLayer — visit livelayer.studio",
1957
1957
  children: [
1958
1958
  /* @__PURE__ */ r(Li, { size: 14, className: "ll-expanded__brand-mark" }),
1959
- /* @__PURE__ */ r("span", { children: Re })
1959
+ /* @__PURE__ */ r("span", { children: Te })
1960
1960
  ]
1961
1961
  }
1962
- ) : /* @__PURE__ */ r("span", { className: "ll-expanded__brand", children: Re })),
1962
+ ) : /* @__PURE__ */ r("span", { className: "ll-expanded__brand", children: Te })),
1963
1963
  /* @__PURE__ */ S("div", { className: "ll-expanded__header-actions", children: [
1964
1964
  !U && W !== !1 && /* @__PURE__ */ r(
1965
1965
  "button",
@@ -1968,35 +1968,35 @@ const Ni = ({
1968
1968
  className: "ll-hbtn ll-hbtn--ghost",
1969
1969
  onClick: Fe,
1970
1970
  "aria-label": "Minimize widget",
1971
- children: /* @__PURE__ */ r(Fn, {})
1971
+ children: /* @__PURE__ */ r(Bn, {})
1972
1972
  }
1973
1973
  ),
1974
- te !== !1 && /* @__PURE__ */ r(
1974
+ ne !== !1 && /* @__PURE__ */ r(
1975
1975
  "button",
1976
1976
  {
1977
1977
  type: "button",
1978
1978
  className: "ll-hbtn ll-hbtn--danger",
1979
1979
  onClick: Be,
1980
1980
  "aria-label": "Close widget",
1981
- children: /* @__PURE__ */ r(On, {})
1981
+ children: /* @__PURE__ */ r(Fn, {})
1982
1982
  }
1983
1983
  )
1984
1984
  ] })
1985
1985
  ] })
1986
1986
  ),
1987
- Ct && /* @__PURE__ */ (() => {
1988
- const x = D ? "Resume session" : k === "disconnected" ? "Reconnect to agent" : "Start video call";
1987
+ Lt && /* @__PURE__ */ (() => {
1988
+ const k = P ? "Resume session" : C === "disconnected" ? "Reconnect to agent" : "Start video call";
1989
1989
  return /* @__PURE__ */ S(Ve, { children: [
1990
- !v && /* @__PURE__ */ S(
1990
+ !b && /* @__PURE__ */ S(
1991
1991
  "button",
1992
1992
  {
1993
1993
  type: "button",
1994
1994
  className: "ll-expanded__play",
1995
1995
  onClick: Me,
1996
- "aria-label": x,
1996
+ "aria-label": k,
1997
1997
  children: [
1998
1998
  /* @__PURE__ */ r("div", { className: "ll-expanded__play-circle", children: /* @__PURE__ */ r("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ r("polygon", { points: "6 3 20 12 6 21 6 3" }) }) }),
1999
- U && /* @__PURE__ */ r("span", { className: "ll-expanded__play-label", children: x })
1999
+ U && /* @__PURE__ */ r("span", { className: "ll-expanded__play-label", children: k })
2000
2000
  ]
2001
2001
  }
2002
2002
  ),
@@ -2008,8 +2008,8 @@ const Ni = ({
2008
2008
  type: "button",
2009
2009
  className: "ll-expanded__cta",
2010
2010
  onClick: Me,
2011
- "aria-label": x,
2012
- children: x
2011
+ "aria-label": k,
2012
+ children: k
2013
2013
  }
2014
2014
  )
2015
2015
  ] })
@@ -2054,7 +2054,7 @@ const Ni = ({
2054
2054
  children: /* @__PURE__ */ r("p", { className: "ll-expanded__transcript-text", children: pt })
2055
2055
  }
2056
2056
  ),
2057
- !ie && !U && /* @__PURE__ */ S("div", { className: "ll-toolbar", onClick: (x) => x.stopPropagation(), children: [
2057
+ !ie && !U && /* @__PURE__ */ S("div", { className: "ll-toolbar", onClick: (k) => k.stopPropagation(), children: [
2058
2058
  X && /* @__PURE__ */ r(
2059
2059
  "button",
2060
2060
  {
@@ -2063,7 +2063,7 @@ const Ni = ({
2063
2063
  onClick: $e,
2064
2064
  "aria-label": f ? "Stop sharing screen" : "Share screen",
2065
2065
  title: f ? "Stop sharing" : "Share screen",
2066
- children: /* @__PURE__ */ r(ir, {})
2066
+ children: /* @__PURE__ */ r(or, {})
2067
2067
  }
2068
2068
  ),
2069
2069
  q && /* @__PURE__ */ S("div", { className: "ll-tool-split", children: [
@@ -2075,7 +2075,7 @@ const Ni = ({
2075
2075
  onClick: Ye,
2076
2076
  "aria-label": J ? "Turn off camera" : "Turn on camera",
2077
2077
  title: J ? "Stop camera" : "Start camera",
2078
- children: /* @__PURE__ */ r(or, {})
2078
+ children: /* @__PURE__ */ r(lr, {})
2079
2079
  }
2080
2080
  ),
2081
2081
  /* @__PURE__ */ r(
@@ -2084,24 +2084,24 @@ const Ni = ({
2084
2084
  ref: At,
2085
2085
  type: "button",
2086
2086
  className: `ll-tool ll-tool--right ${J ? "is-on" : ""}`,
2087
- onClick: (x) => {
2088
- x.stopPropagation(), be((ae) => !ae), Ze(!1);
2087
+ onClick: (k) => {
2088
+ k.stopPropagation(), be((ae) => !ae), Ze(!1);
2089
2089
  },
2090
2090
  "aria-label": "Camera devices",
2091
2091
  "aria-haspopup": "listbox",
2092
2092
  "aria-expanded": pe,
2093
- children: /* @__PURE__ */ r(Ht, {})
2093
+ children: /* @__PURE__ */ r(Ot, {})
2094
2094
  }
2095
2095
  ),
2096
2096
  pe && H.length > 0 && /* @__PURE__ */ r(
2097
- Bn,
2097
+ Wn,
2098
2098
  {
2099
2099
  label: "Camera",
2100
2100
  devices: H,
2101
2101
  activeId: G,
2102
2102
  anchorRef: At,
2103
- onPick: (x) => {
2104
- be(!1), Ge(x);
2103
+ onPick: (k) => {
2104
+ be(!1), Ge(k);
2105
2105
  }
2106
2106
  }
2107
2107
  )
@@ -2115,7 +2115,7 @@ const Ni = ({
2115
2115
  onClick: ct,
2116
2116
  "aria-label": O ? "Unmute microphone" : "Mute microphone",
2117
2117
  title: O ? "Unmute" : "Mute",
2118
- children: /* @__PURE__ */ r(lr, { muted: O })
2118
+ children: /* @__PURE__ */ r(ar, { muted: O })
2119
2119
  }
2120
2120
  ),
2121
2121
  /* @__PURE__ */ r(
@@ -2124,24 +2124,24 @@ const Ni = ({
2124
2124
  ref: Et,
2125
2125
  type: "button",
2126
2126
  className: `ll-tool ll-tool--right ${O ? "is-muted" : ""}`,
2127
- onClick: (x) => {
2128
- x.stopPropagation(), Ze((ae) => !ae), be(!1);
2127
+ onClick: (k) => {
2128
+ k.stopPropagation(), Ze((ae) => !ae), be(!1);
2129
2129
  },
2130
2130
  "aria-label": "Microphone devices",
2131
2131
  "aria-haspopup": "listbox",
2132
2132
  "aria-expanded": Je,
2133
- children: /* @__PURE__ */ r(Ht, {})
2133
+ children: /* @__PURE__ */ r(Ot, {})
2134
2134
  }
2135
2135
  ),
2136
2136
  Je && z.length > 0 && /* @__PURE__ */ r(
2137
- Bn,
2137
+ Wn,
2138
2138
  {
2139
2139
  label: "Microphone",
2140
2140
  devices: z,
2141
2141
  activeId: B,
2142
2142
  anchorRef: Et,
2143
- onPick: (x) => {
2144
- Ze(!1), Lt(x);
2143
+ onPick: (k) => {
2144
+ Ze(!1), kt(k);
2145
2145
  }
2146
2146
  }
2147
2147
  )
@@ -2154,7 +2154,7 @@ const Ni = ({
2154
2154
  onClick: He,
2155
2155
  "aria-label": $ ? "Unmute speaker" : "Mute speaker",
2156
2156
  title: $ ? "Unmute speaker" : "Mute speaker",
2157
- children: /* @__PURE__ */ r(ar, { muted: $ })
2157
+ children: /* @__PURE__ */ r(sr, { muted: $ })
2158
2158
  }
2159
2159
  ),
2160
2160
  /* @__PURE__ */ r(
@@ -2165,12 +2165,12 @@ const Ni = ({
2165
2165
  onClick: st,
2166
2166
  "aria-label": "End conversation",
2167
2167
  title: "End conversation",
2168
- children: /* @__PURE__ */ r(sr, {})
2168
+ children: /* @__PURE__ */ r(cr, {})
2169
2169
  }
2170
2170
  )
2171
2171
  ] }),
2172
2172
  !ie && U && /* @__PURE__ */ r(
2173
- Si,
2173
+ Ei,
2174
2174
  {
2175
2175
  isMuted: O,
2176
2176
  onToggleMute: ct,
@@ -2182,13 +2182,13 @@ const Ni = ({
2182
2182
  allowScreenShare: X,
2183
2183
  isSpeakerMuted: $,
2184
2184
  onToggleSpeaker: He,
2185
- allowTyping: ee,
2185
+ allowTyping: te,
2186
2186
  isTypingOpen: Nt,
2187
- onToggleTyping: an,
2187
+ onToggleTyping: sn,
2188
2188
  onDisconnect: st
2189
2189
  }
2190
2190
  ),
2191
- !ie && ee && (U ? Nt : !0) && /* @__PURE__ */ S("form", { className: "ll-message-input", onSubmit: Ae, children: [
2191
+ !ie && te && (U ? Nt : !0) && /* @__PURE__ */ S("form", { className: "ll-message-input", onSubmit: Ae, children: [
2192
2192
  /* @__PURE__ */ r(
2193
2193
  "input",
2194
2194
  {
@@ -2196,7 +2196,7 @@ const Ni = ({
2196
2196
  className: "ll-message-input__field",
2197
2197
  placeholder: "Message...",
2198
2198
  value: _e,
2199
- onChange: (x) => Te(x.target.value),
2199
+ onChange: (k) => Re(k.target.value),
2200
2200
  "aria-label": "Message the agent"
2201
2201
  }
2202
2202
  ),
@@ -2206,15 +2206,15 @@ const Ni = ({
2206
2206
  type: "submit",
2207
2207
  className: "ll-message-input__send",
2208
2208
  "aria-label": "Send message",
2209
- children: /* @__PURE__ */ r(Mi, {})
2209
+ children: /* @__PURE__ */ r(Ii, {})
2210
2210
  }
2211
2211
  )
2212
2212
  ] })
2213
2213
  ] }) : null,
2214
2214
  (() => {
2215
- if (y && k !== "error")
2215
+ if (v && C !== "error")
2216
2216
  return /* @__PURE__ */ S("div", { className: "ll-expanded__banner", role: "alert", children: [
2217
- /* @__PURE__ */ r("span", { children: y }),
2217
+ /* @__PURE__ */ r("span", { children: v }),
2218
2218
  /* @__PURE__ */ r(
2219
2219
  "button",
2220
2220
  {
@@ -2226,10 +2226,10 @@ const Ni = ({
2226
2226
  }
2227
2227
  )
2228
2228
  ] });
2229
- if (!v || k !== "error") return null;
2230
- let x = "Failed to connect", ae = "Try again";
2231
- return v === "MIC_PERMISSION_DENIED" ? x = "Microphone blocked. Allow access to talk." : v === "MIC_NOT_FOUND" ? x = "No microphone found. Plug one in + retry." : v === "MIC_UNAVAILABLE" ? x = "Mic unavailable. Check other apps using it." : v === "AGENT_TIMEOUT" ? x = "Agent didn't pick up. Try again." : v === "CONNECT_FAILED" ? x = "Connection failed. Check your network." : v.length < 80 && (x = v), /* @__PURE__ */ S("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
2232
- /* @__PURE__ */ r("span", { children: x }),
2229
+ if (!b || C !== "error") return null;
2230
+ let k = "Failed to connect", ae = "Try again";
2231
+ return b === "MIC_PERMISSION_DENIED" ? k = "Microphone blocked. Allow access to talk." : b === "MIC_NOT_FOUND" ? k = "No microphone found. Plug one in + retry." : b === "MIC_UNAVAILABLE" ? k = "Mic unavailable. Check other apps using it." : b === "AGENT_TIMEOUT" ? k = "Agent didn't pick up. Try again." : b === "CONNECT_FAILED" ? k = "Connection failed. Check your network." : b.length < 80 && (k = b), /* @__PURE__ */ S("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
2232
+ /* @__PURE__ */ r("span", { children: k }),
2233
2233
  /* @__PURE__ */ r(
2234
2234
  "button",
2235
2235
  {
@@ -2257,32 +2257,32 @@ const Ni = ({
2257
2257
  }
2258
2258
  );
2259
2259
  };
2260
- function Ht() {
2260
+ function Ot() {
2261
2261
  return /* @__PURE__ */ r("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ r("polyline", { points: "6 9 12 15 18 9" }) });
2262
2262
  }
2263
- function On() {
2263
+ function Fn() {
2264
2264
  return /* @__PURE__ */ S("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
2265
2265
  /* @__PURE__ */ r("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
2266
2266
  /* @__PURE__ */ r("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
2267
2267
  ] });
2268
2268
  }
2269
- function Fn() {
2269
+ function Bn() {
2270
2270
  return /* @__PURE__ */ r("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ r("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
2271
2271
  }
2272
- function ir() {
2272
+ function or() {
2273
2273
  return /* @__PURE__ */ S("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
2274
2274
  /* @__PURE__ */ r("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
2275
2275
  /* @__PURE__ */ r("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
2276
2276
  /* @__PURE__ */ r("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
2277
2277
  ] });
2278
2278
  }
2279
- function or() {
2279
+ function lr() {
2280
2280
  return /* @__PURE__ */ S("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: [
2281
2281
  /* @__PURE__ */ r("path", { d: "M23 7l-7 5 7 5V7z" }),
2282
2282
  /* @__PURE__ */ r("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
2283
2283
  ] });
2284
2284
  }
2285
- function lr({ muted: e }) {
2285
+ function ar({ muted: e }) {
2286
2286
  return /* @__PURE__ */ S("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: [
2287
2287
  /* @__PURE__ */ r("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
2288
2288
  /* @__PURE__ */ r("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
@@ -2290,7 +2290,7 @@ function lr({ muted: e }) {
2290
2290
  e && /* @__PURE__ */ r("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
2291
2291
  ] });
2292
2292
  }
2293
- function ar({ muted: e }) {
2293
+ function sr({ muted: e }) {
2294
2294
  return /* @__PURE__ */ S("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: [
2295
2295
  /* @__PURE__ */ r("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
2296
2296
  e ? /* @__PURE__ */ r("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ S(Ve, { children: [
@@ -2299,13 +2299,13 @@ function ar({ muted: e }) {
2299
2299
  ] })
2300
2300
  ] });
2301
2301
  }
2302
- function Mi() {
2302
+ function Ii() {
2303
2303
  return /* @__PURE__ */ S("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
2304
2304
  /* @__PURE__ */ r("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
2305
2305
  /* @__PURE__ */ r("polyline", { points: "12 5 19 12 12 19" })
2306
2306
  ] });
2307
2307
  }
2308
- function sr() {
2308
+ function cr() {
2309
2309
  return /* @__PURE__ */ r("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__ */ r(
2310
2310
  "path",
2311
2311
  {
@@ -2314,7 +2314,7 @@ function sr() {
2314
2314
  }
2315
2315
  ) });
2316
2316
  }
2317
- const Bn = ({
2317
+ const Wn = ({
2318
2318
  label: e,
2319
2319
  devices: t,
2320
2320
  activeId: n,
@@ -2322,20 +2322,20 @@ const Bn = ({
2322
2322
  anchorRef: l
2323
2323
  }) => {
2324
2324
  const [o, s] = M(null);
2325
- return Qn(() => {
2325
+ return er(() => {
2326
2326
  const a = () => {
2327
2327
  const c = l.current;
2328
2328
  if (!c) return;
2329
- const u = c.getBoundingClientRect(), m = 126, p = window.innerWidth - 16 - 110, h = u.left + u.width / 2;
2329
+ const d = c.getBoundingClientRect(), g = 126, p = window.innerWidth - 16 - 110, m = d.left + d.width / 2;
2330
2330
  s({
2331
- top: u.top - 8,
2332
- left: Math.max(m, Math.min(p, h))
2331
+ top: d.top - 8,
2332
+ left: Math.max(g, Math.min(p, m))
2333
2333
  });
2334
2334
  };
2335
2335
  return a(), window.addEventListener("scroll", a, !0), window.addEventListener("resize", a), () => {
2336
2336
  window.removeEventListener("scroll", a, !0), window.removeEventListener("resize", a);
2337
2337
  };
2338
- }, [l]), o === null || typeof document > "u" ? null : on(
2338
+ }, [l]), o === null || typeof document > "u" ? null : ln(
2339
2339
  /* @__PURE__ */ S(
2340
2340
  "div",
2341
2341
  {
@@ -2352,17 +2352,17 @@ const Bn = ({
2352
2352
  children: [
2353
2353
  /* @__PURE__ */ r("p", { className: "ll-device-menu__label", children: e }),
2354
2354
  t.map((a, c) => {
2355
- const u = n === a.deviceId;
2355
+ const d = n === a.deviceId;
2356
2356
  return /* @__PURE__ */ S(
2357
2357
  "button",
2358
2358
  {
2359
2359
  type: "button",
2360
- className: `ll-device-menu__item ${u ? "is-active" : ""}`,
2360
+ className: `ll-device-menu__item ${d ? "is-active" : ""}`,
2361
2361
  onClick: () => i(a.deviceId),
2362
2362
  role: "option",
2363
- "aria-selected": u,
2363
+ "aria-selected": d,
2364
2364
  children: [
2365
- u && /* @__PURE__ */ r("span", { className: "ll-device-menu__dot", children: "●" }),
2365
+ d && /* @__PURE__ */ r("span", { className: "ll-device-menu__dot", children: "●" }),
2366
2366
  /* @__PURE__ */ r("span", { className: "ll-device-menu__name", children: a.label || `${e} ${c + 1}` })
2367
2367
  ]
2368
2368
  },
@@ -2374,7 +2374,7 @@ const Bn = ({
2374
2374
  ),
2375
2375
  document.body
2376
2376
  );
2377
- }, Ii = [
2377
+ }, Ri = [
2378
2378
  // Accept any value (or empty) — `<input data-ll-private />` and
2379
2379
  // `<input data-ll-private="true" />` both opt out. The bare attribute
2380
2380
  // is the recommended spelling; "true" is preserved for back-compat.
@@ -2382,17 +2382,17 @@ const Bn = ({
2382
2382
  "[data-ll-skip]",
2383
2383
  ".ll-widget"
2384
2384
  ];
2385
- function Bt(e) {
2385
+ function Wt(e) {
2386
2386
  let t = e;
2387
2387
  for (; t; ) {
2388
- for (const n of Ii)
2388
+ for (const n of Ri)
2389
2389
  if (t.matches(n)) return !0;
2390
2390
  t = t.parentElement;
2391
2391
  }
2392
2392
  return !1;
2393
2393
  }
2394
- function tn(e) {
2395
- if (Bt(e)) return !1;
2394
+ function nn(e) {
2395
+ if (Wt(e)) return !1;
2396
2396
  if (e instanceof HTMLInputElement) {
2397
2397
  if (e.type === "password") return !1;
2398
2398
  const t = (e.getAttribute("autocomplete") || "").toLowerCase();
@@ -2400,66 +2400,66 @@ function tn(e) {
2400
2400
  }
2401
2401
  return !0;
2402
2402
  }
2403
- const Ti = /\b(continue|next|proceed|move\s*on|forward)\b|→|›/i, Wn = /\b(back|previous|prev|go\s*back)\b|←|‹/i, Ri = /\b(submit|finish|done|complete|send)\b/i, wt = /* @__PURE__ */ new Map();
2404
- function qn(e) {
2403
+ const Ti = /\b(continue|next|proceed|move\s*on|forward)\b|→|›/i, qn = /\b(back|previous|prev|go\s*back)\b|←|‹/i, Pi = /\b(submit|finish|done|complete|send)\b/i, wt = /* @__PURE__ */ new Map();
2404
+ function Un(e) {
2405
2405
  const t = wt.get(e);
2406
2406
  return t && t.isConnected ? t : null;
2407
2407
  }
2408
2408
  function it(e) {
2409
- if (Bt(e) || e.hidden || e.getAttribute("aria-hidden") === "true") return !0;
2409
+ if (Wt(e) || e.hidden || e.getAttribute("aria-hidden") === "true") return !0;
2410
2410
  const t = typeof window < "u" && window.getComputedStyle ? window.getComputedStyle(e) : null;
2411
2411
  return !!(t && (t.display === "none" || t.visibility === "hidden"));
2412
2412
  }
2413
2413
  function Di(e) {
2414
2414
  return !!(e.disabled || e.getAttribute("aria-disabled") === "true");
2415
2415
  }
2416
- function Pi(e) {
2416
+ function zi(e) {
2417
2417
  return (e.innerText || e.textContent || e.getAttribute("aria-label") || e.value || "").trim();
2418
2418
  }
2419
- function zi(e) {
2419
+ function $i(e) {
2420
2420
  return Array.from(e.querySelectorAll('button, [role="button"], input[type="submit"], input[type="button"]')).filter(
2421
2421
  (n) => !it(n) && !Di(n)
2422
2422
  );
2423
2423
  }
2424
- function cr(e) {
2424
+ function ur(e) {
2425
2425
  wt.clear();
2426
- const t = zi(e);
2426
+ const t = $i(e);
2427
2427
  let n, i, l;
2428
2428
  for (const a of t) {
2429
- const c = Pi(a);
2429
+ const c = zi(a);
2430
2430
  if (!c || c.length > 40) continue;
2431
- const u = a.getAttribute("type") === "submit" || a.tagName === "BUTTON" && !a.getAttribute("type") && !!a.closest("form");
2432
- !n && Ti.test(c) && !Wn.test(c) ? (n = { id: "ll-advance", label: c }, wt.set("ll-advance", a)) : !i && Wn.test(c) ? (i = { id: "ll-back", label: c }, wt.set("ll-back", a)) : !l && (Ri.test(c) || u) && (l = { id: "ll-submit", label: c }, wt.set("ll-submit", a));
2431
+ const d = a.getAttribute("type") === "submit" || a.tagName === "BUTTON" && !a.getAttribute("type") && !!a.closest("form");
2432
+ !n && Ti.test(c) && !qn.test(c) ? (n = { id: "ll-advance", label: c }, wt.set("ll-advance", a)) : !i && qn.test(c) ? (i = { id: "ll-back", label: c }, wt.set("ll-back", a)) : !l && (Pi.test(c) || d) && (l = { id: "ll-submit", label: c }, wt.set("ll-submit", a));
2433
2433
  }
2434
- const o = qi(e);
2434
+ const o = Ui(e);
2435
2435
  return { kind: n || o.totalSteps ? "multi-step" : "single-page", advance: n, back: i, submit: l, ...o };
2436
2436
  }
2437
- const $i = 60;
2438
- function ur(e) {
2439
- return e.replace(/^\s*(step\s+)?\d{1,2}(?:[.):\-]+\s*|\s+)/i, "").replace(/\s+/g, " ").trim().slice(0, $i);
2437
+ const Hi = 60;
2438
+ function dr(e) {
2439
+ return e.replace(/^\s*(step\s+)?\d{1,2}(?:[.):\-]+\s*|\s+)/i, "").replace(/\s+/g, " ").trim().slice(0, Hi);
2440
2440
  }
2441
- function Hi(e) {
2441
+ function Oi(e) {
2442
2442
  const t = e.getAttribute("class");
2443
2443
  return t ? t.toLowerCase() : "";
2444
2444
  }
2445
- const Oi = /stepper|wizard|ant-steps|step-indicator/;
2446
- function Fi(e) {
2447
- return Oi.test(Hi(e));
2445
+ const Fi = /stepper|wizard|ant-steps|step-indicator/;
2446
+ function Bi(e) {
2447
+ return Fi.test(Oi(e));
2448
2448
  }
2449
- function Un(e) {
2449
+ function jn(e) {
2450
2450
  const t = e.getAttribute("aria-current");
2451
2451
  return t === "step" || t === "true" ? !0 : Array.from(e.classList).some(
2452
2452
  (n) => /(^|[-_])(active|current|selected)([-_]|$)/i.test(n)
2453
2453
  );
2454
2454
  }
2455
- const Bi = '[aria-current="step"],[aria-current="true"],[class*="active"],[class*="Active"],[class*="current"],[class*="Current"],[class*="selected"],[class*="Selected"]';
2456
- function Wi(e) {
2457
- return Un(e) ? !0 : Array.from(e.querySelectorAll(Bi)).some(
2458
- Un
2455
+ const Wi = '[aria-current="step"],[aria-current="true"],[class*="active"],[class*="Active"],[class*="current"],[class*="Current"],[class*="selected"],[class*="Selected"]';
2456
+ function qi(e) {
2457
+ return jn(e) ? !0 : Array.from(e.querySelectorAll(Wi)).some(
2458
+ jn
2459
2459
  );
2460
2460
  }
2461
- function jn(e, t) {
2462
- const n = ur(
2461
+ function Vn(e, t) {
2462
+ const n = dr(
2463
2463
  e[t].innerText || e[t].textContent || ""
2464
2464
  );
2465
2465
  return {
@@ -2468,13 +2468,13 @@ function jn(e, t) {
2468
2468
  ...n ? { stepLabel: n } : {}
2469
2469
  };
2470
2470
  }
2471
- function qi(e) {
2471
+ function Ui(e) {
2472
2472
  const t = e.querySelector('[aria-current="step"]');
2473
2473
  if (t && t.parentElement && !it(t)) {
2474
2474
  const l = Array.from(t.parentElement.children).filter(
2475
2475
  (s) => s.tagName === t.tagName && !it(s)
2476
2476
  ), o = l.indexOf(t);
2477
- if (o >= 0 && l.length >= 2) return jn(l, o);
2477
+ if (o >= 0 && l.length >= 2) return Vn(l, o);
2478
2478
  }
2479
2479
  const n = e.querySelector('[role="progressbar"]');
2480
2480
  if (n && !it(n)) {
@@ -2484,7 +2484,7 @@ function qi(e) {
2484
2484
  return {
2485
2485
  totalSteps: o,
2486
2486
  currentStep: l,
2487
- ...s ? { stepLabel: ur(s) } : {}
2487
+ ...s ? { stepLabel: dr(s) } : {}
2488
2488
  };
2489
2489
  }
2490
2490
  }
@@ -2492,19 +2492,19 @@ function qi(e) {
2492
2492
  e.querySelectorAll(
2493
2493
  '[class*="step"], [class*="Step"], [class*="wizard"], [class*="Wizard"]'
2494
2494
  )
2495
- ).filter((l) => !it(l) && Fi(l));
2495
+ ).filter((l) => !it(l) && Bi(l));
2496
2496
  for (const l of i) {
2497
2497
  const o = Array.from(l.children).filter(
2498
2498
  (a) => !it(a) && (a.textContent || "").trim().length > 0
2499
2499
  );
2500
2500
  if (o.length < 2 || o.length > 12) continue;
2501
- const s = o.findIndex(Wi);
2501
+ const s = o.findIndex(qi);
2502
2502
  if (!(s < 0))
2503
- return jn(o, s);
2503
+ return Vn(o, s);
2504
2504
  }
2505
2505
  return {};
2506
2506
  }
2507
- const Ot = 4096, Ui = 20, ji = 20, Vi = 10, Yi = 10, Gi = 30, Xi = 20, Vn = 500, Ki = [
2507
+ const Ft = 4096, ji = 20, Vi = 20, Yi = 10, Gi = 10, Xi = 30, Ki = 20, Yn = 500, Ji = [
2508
2508
  '[data-ll-private="true"]',
2509
2509
  ".ll-widget",
2510
2510
  "script",
@@ -2516,7 +2516,7 @@ function vt(e) {
2516
2516
  if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
2517
2517
  let t = e;
2518
2518
  for (; t; ) {
2519
- for (const n of Ki)
2519
+ for (const n of Ji)
2520
2520
  if (t.matches(n)) return !0;
2521
2521
  t = t.parentElement;
2522
2522
  }
@@ -2529,7 +2529,7 @@ function bt(e) {
2529
2529
  const n = window.innerHeight || document.documentElement.clientHeight, i = window.innerWidth || document.documentElement.clientWidth;
2530
2530
  return t.bottom > 0 && t.right > 0 && t.top < n && t.left < i;
2531
2531
  }
2532
- function Yn(e) {
2532
+ function Gn(e) {
2533
2533
  const t = e.getAttribute("id");
2534
2534
  if (t) {
2535
2535
  const o = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(t) : t.replace(/"/g, '\\"'), s = document.querySelector(`label[for="${o}"]`);
@@ -2559,10 +2559,10 @@ function Yn(e) {
2559
2559
  function ce(e, t) {
2560
2560
  return e.length <= t ? e : e.slice(0, t - 1) + "…";
2561
2561
  }
2562
- function Ji(e) {
2562
+ function Zi(e) {
2563
2563
  return e && e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || null;
2564
2564
  }
2565
- function Zi(e) {
2565
+ function Qi(e) {
2566
2566
  const t = e.getAttribute("aria-label");
2567
2567
  if (t) return t.trim().slice(0, 80);
2568
2568
  const n = e.getAttribute("aria-labelledby");
@@ -2591,7 +2591,7 @@ function Zi(e) {
2591
2591
  function rt(e) {
2592
2592
  return e.length;
2593
2593
  }
2594
- function Qi(e, t = {}) {
2594
+ function eo(e, t = {}) {
2595
2595
  const n = t.doc ?? (typeof document < "u" ? document : null);
2596
2596
  if (!n)
2597
2597
  return {
@@ -2608,63 +2608,63 @@ function Qi(e, t = {}) {
2608
2608
  const i = typeof window < "u" && window.location.href || "", l = typeof window < "u" && window.location.pathname || "/", o = n.title || "", s = Array.from(
2609
2609
  n.querySelectorAll("[data-ll-region]")
2610
2610
  ), a = [];
2611
- for (const y of s) {
2612
- if (a.length >= Vi) break;
2613
- if (vt(y) || !bt(y)) continue;
2614
- const z = y.getAttribute("data-ll-region") ?? "", B = y.getAttribute("data-ll-intent") ?? void 0, J = ce(
2615
- (y.innerText || y.textContent || "").trim(),
2616
- Vn * 2
2611
+ for (const v of s) {
2612
+ if (a.length >= Yi) break;
2613
+ if (vt(v) || !bt(v)) continue;
2614
+ const z = v.getAttribute("data-ll-region") ?? "", B = v.getAttribute("data-ll-intent") ?? void 0, J = ce(
2615
+ (v.innerText || v.textContent || "").trim(),
2616
+ Yn * 2
2617
2617
  );
2618
2618
  !z || !J || a.push({ id: z, intent: B, text: J });
2619
2619
  }
2620
- const c = [], u = ["H1", "H2", "H3", "H4", "H5", "H6"], m = Array.from(
2620
+ const c = [], d = ["H1", "H2", "H3", "H4", "H5", "H6"], g = Array.from(
2621
2621
  n.querySelectorAll("h1, h2, h3, h4, h5, h6")
2622
2622
  );
2623
- for (const y of m) {
2624
- if (vt(y) || !bt(y)) continue;
2625
- const z = (y.textContent || "").trim();
2626
- z && c.push(`${y.tagName}: ${ce(z, 200)}`);
2623
+ for (const v of g) {
2624
+ if (vt(v) || !bt(v)) continue;
2625
+ const z = (v.textContent || "").trim();
2626
+ z && c.push(`${v.tagName}: ${ce(z, 200)}`);
2627
2627
  }
2628
2628
  const p = Array.from(n.querySelectorAll("p, li"));
2629
- for (const y of p) {
2630
- if (vt(y) || !bt(y) || u.includes(y.tagName)) continue;
2631
- const z = (y.textContent || "").trim();
2632
- z.length > 10 && c.push(ce(z, Vn));
2629
+ for (const v of p) {
2630
+ if (vt(v) || !bt(v) || d.includes(v.tagName)) continue;
2631
+ const z = (v.textContent || "").trim();
2632
+ z.length > 10 && c.push(ce(z, Yn));
2633
2633
  }
2634
- const h = c.join(`
2635
- `), P = [], _ = Array.from(n.querySelectorAll("a[href]"));
2636
- for (const y of _) {
2637
- if (P.length >= Ui) break;
2638
- if (vt(y) || !bt(y)) continue;
2639
- const z = y.getAttribute("href") || "", B = (y.textContent || "").trim();
2640
- !z || !B || P.push({ href: z, text: ce(B, 100) });
2634
+ const m = c.join(`
2635
+ `), D = [], x = Array.from(n.querySelectorAll("a[href]"));
2636
+ for (const v of x) {
2637
+ if (D.length >= ji) break;
2638
+ if (vt(v) || !bt(v)) continue;
2639
+ const z = v.getAttribute("href") || "", B = (v.textContent || "").trim();
2640
+ !z || !B || D.push({ href: z, text: ce(B, 100) });
2641
2641
  }
2642
- const k = [], g = Array.from(
2642
+ const C = [], y = Array.from(
2643
2643
  n.querySelectorAll(
2644
2644
  "input, textarea, select"
2645
2645
  )
2646
2646
  );
2647
- for (const y of g) {
2648
- if (k.length >= ji) break;
2649
- if (vt(y) || !tn(y) || !bt(y)) continue;
2650
- const z = Yn(y), B = y instanceof HTMLInputElement ? y.type : y.tagName.toLowerCase();
2651
- z && k.push({ label: ce(z, 100), type: B });
2647
+ for (const v of y) {
2648
+ if (C.length >= Vi) break;
2649
+ if (vt(v) || !nn(v) || !bt(v)) continue;
2650
+ const z = Gn(v), B = v instanceof HTMLInputElement ? v.type : v.tagName.toLowerCase();
2651
+ z && C.push({ label: ce(z, 100), type: B });
2652
2652
  }
2653
- const w = Array.from(n.querySelectorAll("form")), D = [];
2653
+ const w = Array.from(n.querySelectorAll("form")), P = [];
2654
2654
  let E = 0;
2655
- for (const y of w) {
2656
- if (D.length >= Yi) break;
2657
- if (Bt(y) || y.matches(".ll-widget *, .ll-widget")) continue;
2658
- const z = y.getAttribute("id") || y.getAttribute("name") || Ji(y.getAttribute("data-ll-intent")) || `form_${E++}`, B = y.getAttribute("data-ll-intent") || Zi(y) || void 0, J = Array.from(
2659
- y.querySelectorAll(
2655
+ for (const v of w) {
2656
+ if (P.length >= Gi) break;
2657
+ if (Wt(v) || v.matches(".ll-widget *, .ll-widget")) continue;
2658
+ const z = v.getAttribute("id") || v.getAttribute("name") || Zi(v.getAttribute("data-ll-intent")) || `form_${E++}`, B = v.getAttribute("data-ll-intent") || Qi(v) || void 0, J = Array.from(
2659
+ v.querySelectorAll(
2660
2660
  "input, textarea, select"
2661
2661
  )
2662
2662
  ), le = [];
2663
2663
  let H = 0;
2664
2664
  const G = /* @__PURE__ */ new Set();
2665
2665
  for (const f of J) {
2666
- if (le.length >= Gi) break;
2667
- if (!tn(f)) continue;
2666
+ if (le.length >= Xi) break;
2667
+ if (!nn(f)) continue;
2668
2668
  if (f instanceof HTMLInputElement) {
2669
2669
  const U = f.type;
2670
2670
  if (U === "submit" || U === "button" || U === "reset" || U === "hidden" || U === "image" || U === "file") continue;
@@ -2672,14 +2672,14 @@ function Qi(e, t = {}) {
2672
2672
  const A = f.getAttribute("name") || "", $ = f.getAttribute("id") || "";
2673
2673
  let q = A || $ || `field_${H}`;
2674
2674
  G.has(q) && (q = `${q}__${H}`), G.add(q), H++;
2675
- const X = Yn(f) || q, ee = f instanceof HTMLInputElement ? f.type : f.tagName.toLowerCase(), W = {
2675
+ const X = Gn(f) || q, te = f instanceof HTMLInputElement ? f.type : f.tagName.toLowerCase(), W = {
2676
2676
  name: q,
2677
2677
  label: ce(X, 100),
2678
- type: ee
2678
+ type: te
2679
2679
  };
2680
2680
  f.required === !0 && (W.required = !0);
2681
- const te = f.getAttribute("placeholder");
2682
- if (te && (W.placeholder = ce(te.trim(), 100)), f instanceof HTMLInputElement || f instanceof HTMLTextAreaElement) {
2681
+ const ne = f.getAttribute("placeholder");
2682
+ if (ne && (W.placeholder = ce(ne.trim(), 100)), f instanceof HTMLInputElement || f instanceof HTMLTextAreaElement) {
2683
2683
  const U = f.getAttribute("minlength");
2684
2684
  if (U !== null) {
2685
2685
  const Z = parseInt(U, 10);
@@ -2698,10 +2698,10 @@ function Qi(e, t = {}) {
2698
2698
  ge !== null && (W.max = ce(ge, 50));
2699
2699
  const Z = f.getAttribute("step");
2700
2700
  Z !== null && (W.step = ce(Z, 20));
2701
- const Ce = f.getAttribute("pattern");
2702
- Ce !== null && (W.pattern = ce(Ce, 200));
2703
- const ne = (f.getAttribute("autocomplete") || "").toLowerCase();
2704
- ne && ne !== "off" && !ne.startsWith("cc-") && (W.autocomplete = ce(ne, 50));
2701
+ const Le = f.getAttribute("pattern");
2702
+ Le !== null && (W.pattern = ce(Le, 200));
2703
+ const re = (f.getAttribute("autocomplete") || "").toLowerCase();
2704
+ re && re !== "off" && !re.startsWith("cc-") && (W.autocomplete = ce(re, 50));
2705
2705
  }
2706
2706
  if (f instanceof HTMLSelectElement) {
2707
2707
  const U = [];
@@ -2712,56 +2712,56 @@ function Qi(e, t = {}) {
2712
2712
  const Me = (Z.textContent || "").trim();
2713
2713
  if (Me && !W.placeholderOption && (W.placeholderOption = ce(Me, 60)), W.hasEmptyOption = !0, Z.disabled) continue;
2714
2714
  }
2715
- if (U.length >= Xi) break;
2716
- const Ce = Z.value || "", ne = (Z.textContent || "").trim() || Ce;
2717
- !Ce && !ne || U.push({ value: Ce, label: ce(ne, 60) });
2715
+ if (U.length >= Ki) break;
2716
+ const Le = Z.value || "", re = (Z.textContent || "").trim() || Le;
2717
+ !Le && !re || U.push({ value: Le, label: ce(re, 60) });
2718
2718
  }
2719
2719
  U.length > 0 && (W.options = U);
2720
2720
  }
2721
2721
  const ie = typeof f.validationMessage == "string" ? f.validationMessage : "";
2722
2722
  ie && (W.validationMessage = ce(ie, 200)), le.push(W);
2723
2723
  }
2724
- D.push({ id: z, intent: B, fields: le });
2724
+ P.push({ id: z, intent: B, fields: le });
2725
2725
  }
2726
- const v = {
2726
+ const b = {
2727
2727
  url: i,
2728
2728
  title: o,
2729
2729
  pathname: l,
2730
2730
  regions: a,
2731
- visibleText: h,
2732
- visibleLinks: P,
2733
- visibleFields: k,
2734
- forms: D,
2735
- flow: cr(n),
2731
+ visibleText: m,
2732
+ visibleLinks: D,
2733
+ visibleFields: C,
2734
+ forms: P,
2735
+ flow: ur(n),
2736
2736
  extras: e
2737
2737
  };
2738
- let O = rt(JSON.stringify(v.regions)) + rt(v.visibleText) + rt(JSON.stringify(v.visibleLinks)) + rt(JSON.stringify(v.visibleFields));
2739
- for (; O > Ot && v.visibleFields.length > 0; )
2740
- v.visibleFields.pop(), O = rt(JSON.stringify(v.visibleFields));
2741
- for (; O > Ot && v.visibleLinks.length > 0; )
2742
- v.visibleLinks.pop(), O -= 80;
2743
- return rt(v.visibleText) > Ot && (v.visibleText = ce(v.visibleText, Ot - 100)), v;
2738
+ let O = rt(JSON.stringify(b.regions)) + rt(b.visibleText) + rt(JSON.stringify(b.visibleLinks)) + rt(JSON.stringify(b.visibleFields));
2739
+ for (; O > Ft && b.visibleFields.length > 0; )
2740
+ b.visibleFields.pop(), O = rt(JSON.stringify(b.visibleFields));
2741
+ for (; O > Ft && b.visibleLinks.length > 0; )
2742
+ b.visibleLinks.pop(), O -= 80;
2743
+ return rt(b.visibleText) > Ft && (b.visibleText = ce(b.visibleText, Ft - 100)), b;
2744
2744
  }
2745
2745
  let ot = null;
2746
- function eo(e) {
2746
+ function to(e) {
2747
2747
  const t = e.querySelectorAll("form");
2748
2748
  let n = `f${t.length}`;
2749
2749
  return t.forEach((i) => {
2750
2750
  n += `|${i.id || i.getAttribute("name") || ""}:${i.querySelectorAll("input,select,textarea").length}`;
2751
2751
  }), n;
2752
2752
  }
2753
- function Gn(e, t = {}) {
2754
- const n = Date.now(), i = t.doc ?? (typeof document < "u" ? document : null), l = typeof window < "u" && window.location.pathname || "/", o = typeof window < "u" ? window.scrollY : 0, s = `${l}::${o}::${i ? eo(i) : ""}`;
2753
+ function Xn(e, t = {}) {
2754
+ const n = Date.now(), i = t.doc ?? (typeof document < "u" ? document : null), l = typeof window < "u" && window.location.pathname || "/", o = typeof window < "u" ? window.scrollY : 0, s = `${l}::${o}::${i ? to(i) : ""}`;
2755
2755
  if (ot && ot.key === s && n - ot.at < 1e3)
2756
2756
  return ot.ctx;
2757
- const a = Qi(e, t);
2757
+ const a = eo(e, t);
2758
2758
  return ot = { key: s, at: n, ctx: a }, a;
2759
2759
  }
2760
- function to() {
2760
+ function no() {
2761
2761
  ot = null;
2762
2762
  }
2763
- const no = 200;
2764
- function ro(e) {
2763
+ const ro = 200;
2764
+ function io(e) {
2765
2765
  const t = String(e.href || "");
2766
2766
  return {
2767
2767
  href: t,
@@ -2771,47 +2771,47 @@ function ro(e) {
2771
2771
  description: e.description
2772
2772
  };
2773
2773
  }
2774
- function io(e) {
2774
+ function oo(e) {
2775
2775
  return !(!e || e.startsWith("#") || e.startsWith("javascript:") || e.startsWith("mailto:") || e.startsWith("tel:"));
2776
2776
  }
2777
- function oo(e) {
2777
+ function lo(e) {
2778
2778
  const t = e ?? (typeof document < "u" ? document : null);
2779
2779
  if (!t) return [];
2780
2780
  const n = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), l = [], o = Array.from(t.querySelectorAll("a[href]"));
2781
2781
  for (const s of o) {
2782
- if (l.length >= no) break;
2783
- if (Bt(s)) continue;
2782
+ if (l.length >= ro) break;
2783
+ if (Wt(s)) continue;
2784
2784
  const a = s.getAttribute("href") || "";
2785
- if (!io(a)) continue;
2786
- let c = a, u = !0;
2785
+ if (!oo(a)) continue;
2786
+ let c = a, d = !0;
2787
2787
  try {
2788
2788
  if (typeof window < "u") {
2789
2789
  const p = new URL(a, n);
2790
- u = p.origin === n, u && a.startsWith("http") && (c = p.pathname + p.search + p.hash);
2790
+ d = p.origin === n, d && a.startsWith("http") && (c = p.pathname + p.search + p.hash);
2791
2791
  }
2792
2792
  } catch {
2793
2793
  continue;
2794
2794
  }
2795
2795
  if (i.has(c)) continue;
2796
2796
  i.add(c);
2797
- const m = (s.textContent || "").trim().slice(0, 120);
2798
- l.push({ href: c, text: m, internal: u });
2797
+ const g = (s.textContent || "").trim().slice(0, 120);
2798
+ l.push({ href: c, text: g, internal: d });
2799
2799
  }
2800
2800
  return l;
2801
2801
  }
2802
2802
  let lt = null;
2803
- const lo = 5e3;
2804
- function Zt() {
2803
+ const ao = 5e3;
2804
+ function Qt() {
2805
2805
  const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
2806
- if (lt && lt.pathname === t && e - lt.at < lo)
2806
+ if (lt && lt.pathname === t && e - lt.at < ao)
2807
2807
  return lt.routes;
2808
- const n = oo();
2808
+ const n = lo();
2809
2809
  return lt = { at: e, pathname: t, routes: n }, n;
2810
2810
  }
2811
- function ao() {
2811
+ function so() {
2812
2812
  lt = null;
2813
2813
  }
2814
- function nn(e) {
2814
+ function rn(e) {
2815
2815
  if (e instanceof HTMLInputElement) {
2816
2816
  const t = e.type;
2817
2817
  if (t === "submit" || t === "button" || t === "reset" || t === "hidden" || t === "image" || t === "file")
@@ -2819,17 +2819,17 @@ function nn(e) {
2819
2819
  }
2820
2820
  return !0;
2821
2821
  }
2822
- function so(e, t) {
2822
+ function co(e, t) {
2823
2823
  return e.getAttribute("name") || e.getAttribute("id") || `field_${t}`;
2824
2824
  }
2825
2825
  function ze(e) {
2826
2826
  return e.toLowerCase().replace(/[^a-z0-9]+/g, "");
2827
2827
  }
2828
- function Qt(e) {
2828
+ function en(e) {
2829
2829
  const t = e.lastIndexOf(".");
2830
2830
  return t >= 0 ? e.slice(t + 1) : e;
2831
2831
  }
2832
- function co(e) {
2832
+ function uo(e) {
2833
2833
  var i;
2834
2834
  const t = e.getAttribute("id");
2835
2835
  if (t)
@@ -2843,36 +2843,36 @@ function co(e) {
2843
2843
  const n = e.closest("label");
2844
2844
  return n != null && n.textContent ? n.textContent : e.getAttribute("aria-label") || e.getAttribute("placeholder") || "";
2845
2845
  }
2846
- function uo(e, t) {
2846
+ function fo(e, t) {
2847
2847
  const n = ze(t);
2848
2848
  if (n.length < 2) return null;
2849
2849
  let i = null, l = 0;
2850
2850
  for (const o of Array.from(
2851
2851
  e.querySelectorAll("input, textarea, select")
2852
2852
  )) {
2853
- if (!nn(o)) continue;
2853
+ if (!rn(o)) continue;
2854
2854
  const s = o.getAttribute("name") || "", a = o.getAttribute("id") || "", c = [
2855
- ze(Qt(s)),
2856
- ze(Qt(a)),
2855
+ ze(en(s)),
2856
+ ze(en(a)),
2857
2857
  ze(s),
2858
2858
  ze(a)
2859
2859
  ];
2860
- let u = 0;
2861
- c.some((m) => m.length >= 2 && m === n) ? u = 4 : [
2860
+ let d = 0;
2861
+ c.some((g) => g.length >= 2 && g === n) ? d = 4 : [
2862
2862
  ze(s),
2863
- ze(Qt(s)),
2864
- ze(co(o))
2865
- ].some((p) => p.length >= 3 && (p.includes(n) || n.includes(p))) && (u = 2), u > l && (l = u, i = o);
2863
+ ze(en(s)),
2864
+ ze(uo(o))
2865
+ ].some((p) => p.length >= 3 && (p.includes(n) || n.includes(p))) && (d = 2), d > l && (l = d, i = o);
2866
2866
  }
2867
2867
  return l >= 2 ? i : null;
2868
2868
  }
2869
- function fo(e, t) {
2869
+ function po(e, t) {
2870
2870
  if (!t) return null;
2871
2871
  try {
2872
2872
  const o = e.querySelector(
2873
2873
  `[name="${t.replace(/"/g, '\\"')}"]`
2874
2874
  );
2875
- if (o && nn(o)) return o;
2875
+ if (o && rn(o)) return o;
2876
2876
  } catch {
2877
2877
  }
2878
2878
  const n = Array.from(
@@ -2881,23 +2881,23 @@ function fo(e, t) {
2881
2881
  let i = 0;
2882
2882
  const l = /* @__PURE__ */ new Map();
2883
2883
  for (const o of n) {
2884
- if (!nn(o)) continue;
2885
- const s = so(o, i);
2884
+ if (!rn(o)) continue;
2885
+ const s = co(o, i);
2886
2886
  let a = s;
2887
2887
  if (l.has(s) && (a = `${s}__${i}`), a === t) return o;
2888
2888
  l.set(s, o), i++;
2889
2889
  }
2890
- return uo(e, t);
2890
+ return fo(e, t);
2891
2891
  }
2892
- function Xn(e, t) {
2893
- const n = fo(e, t);
2894
- return n ? tn(n) ? { el: n } : { el: null, reason: "private" } : { el: null, reason: "not_found" };
2892
+ function Kn(e, t) {
2893
+ const n = po(e, t);
2894
+ return n ? nn(n) ? { el: n } : { el: null, reason: "private" } : { el: null, reason: "not_found" };
2895
2895
  }
2896
- function po(e, t) {
2896
+ function ho(e, t) {
2897
2897
  const n = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, i = Object.getOwnPropertyDescriptor(n, "value"), l = i == null ? void 0 : i.set;
2898
2898
  l ? l.call(e, t) : e.value = t;
2899
2899
  }
2900
- function ho(e, t, n = {}) {
2900
+ function mo(e, t, n = {}) {
2901
2901
  const i = n.triggerInput ?? !0, l = n.triggerChange ?? !0;
2902
2902
  if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
2903
2903
  const o = Object.getOwnPropertyDescriptor(
@@ -2907,9 +2907,9 @@ function ho(e, t, n = {}) {
2907
2907
  s ? s.call(e, a) : e.checked = a, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), l && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2908
2908
  return;
2909
2909
  }
2910
- po(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), l && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2910
+ ho(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), l && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2911
2911
  }
2912
- function Kn(e, t) {
2912
+ function Jn(e, t) {
2913
2913
  if (!t) return null;
2914
2914
  const n = t.replace(/"/g, '\\"'), i = (a) => a.closest('[data-ll-private="true"], [data-ll-skip], .ll-widget') !== null;
2915
2915
  try {
@@ -2932,23 +2932,23 @@ function Kn(e, t) {
2932
2932
  ).filter((a) => !i(a));
2933
2933
  for (const a of s) {
2934
2934
  const c = a.getAttribute("data-ll-intent");
2935
- if (c && mo(c) === t) return a;
2935
+ if (c && go(c) === t) return a;
2936
2936
  }
2937
2937
  if (/^form_\d+$/.test(t)) {
2938
2938
  const a = parseInt(t.slice(5), 10);
2939
2939
  let c = 0;
2940
- for (const u of s)
2941
- if (!(u.id || u.getAttribute("name") || u.getAttribute("data-ll-intent"))) {
2942
- if (c === a) return u;
2940
+ for (const d of s)
2941
+ if (!(d.id || d.getAttribute("name") || d.getAttribute("data-ll-intent"))) {
2942
+ if (c === a) return d;
2943
2943
  c++;
2944
2944
  }
2945
2945
  }
2946
2946
  return s.length === 1 ? s[0] : null;
2947
2947
  }
2948
- function mo(e) {
2948
+ function go(e) {
2949
2949
  return e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || null;
2950
2950
  }
2951
- function go() {
2951
+ function yo() {
2952
2952
  if (typeof window > "u" || typeof document > "u")
2953
2953
  return !1;
2954
2954
  const e = document.scrollingElement || document.documentElement;
@@ -2956,19 +2956,19 @@ function go() {
2956
2956
  const t = window.getComputedStyle(e);
2957
2957
  return !(t.overflowY === "hidden" || t.overflowY === "clip");
2958
2958
  }
2959
- function yo(e) {
2959
+ function vo(e) {
2960
2960
  if (!(e instanceof HTMLElement)) return !1;
2961
2961
  const n = window.getComputedStyle(e).overflowY;
2962
2962
  return !(n !== "auto" && n !== "scroll" || e.scrollHeight <= e.clientHeight + 2);
2963
2963
  }
2964
- function vo() {
2964
+ function bo() {
2965
2965
  if (typeof document > "u") return null;
2966
2966
  const e = Array.from(
2967
2967
  document.querySelectorAll("body, body *")
2968
2968
  );
2969
2969
  let t = null, n = 0;
2970
2970
  for (const i of e) {
2971
- if (!yo(i)) continue;
2971
+ if (!vo(i)) continue;
2972
2972
  const l = i.getBoundingClientRect();
2973
2973
  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;
2974
2974
  const o = l.width * l.height;
@@ -2976,24 +2976,24 @@ function vo() {
2976
2976
  }
2977
2977
  return t;
2978
2978
  }
2979
- function bo() {
2979
+ function wo() {
2980
2980
  if (typeof window > "u")
2981
2981
  return null;
2982
- if (go()) return window;
2983
- const e = vo();
2982
+ if (yo()) return window;
2983
+ const e = bo();
2984
2984
  return e || window;
2985
2985
  }
2986
- function Jn(e) {
2986
+ function Zn(e) {
2987
2987
  return e instanceof Window ? e.innerHeight || 0 : e.clientHeight || 0;
2988
2988
  }
2989
- function wo(e) {
2989
+ function _o(e) {
2990
2990
  var t, n;
2991
2991
  return e instanceof Window ? typeof document > "u" ? 0 : Math.max(
2992
2992
  ((t = document.body) == null ? void 0 : t.scrollHeight) ?? 0,
2993
2993
  ((n = document.documentElement) == null ? void 0 : n.scrollHeight) ?? 0
2994
2994
  ) : e.scrollHeight - e.clientHeight;
2995
2995
  }
2996
- const _o = /* @__PURE__ */ new Set([
2996
+ const xo = /* @__PURE__ */ new Set([
2997
2997
  "agent_state",
2998
2998
  "avatar_stream_ready",
2999
2999
  "avatar_active",
@@ -3028,9 +3028,9 @@ const _o = /* @__PURE__ */ new Set([
3028
3028
  // to onAgentCommand.
3029
3029
  "task_field_updated",
3030
3030
  "task_completed"
3031
- ]), dr = rn(
3031
+ ]), fr = on(
3032
3032
  function(t, n) {
3033
- var vn, bn, wn, _n, xn, Ln, Cn;
3033
+ var bn, wn, _n, xn, kn, Ln, Cn;
3034
3034
  const {
3035
3035
  agentId: i,
3036
3036
  apiKey: l,
@@ -3038,8 +3038,8 @@ const _o = /* @__PURE__ */ new Set([
3038
3038
  sessionEndpoint: s,
3039
3039
  sessionBody: a,
3040
3040
  soundEffects: c,
3041
- experienceMode: u = "WIDGET",
3042
- autoConnect: m = !1,
3041
+ experienceMode: d = "WIDGET",
3042
+ autoConnect: g = !1,
3043
3043
  displayMode: p,
3044
3044
  // Initial display mode. Mobile gets a smaller card layout (not the
3045
3045
  // full-screen sheet) so "expanded" is the right default on every
@@ -3048,17 +3048,17 @@ const _o = /* @__PURE__ */ new Set([
3048
3048
  // expanded widget but card-sized, not the bottom bar that
3049
3049
  // minimized produced). The card sizing now lives in CSS — see
3050
3050
  // .ll-expanded--mobile in styles.css.
3051
- defaultDisplayMode: h = "expanded",
3052
- onDisplayModeChange: P,
3053
- position: _ = "bottom-right",
3054
- mobileBreakpoint: k = 640,
3055
- draggable: g,
3051
+ defaultDisplayMode: m = "expanded",
3052
+ onDisplayModeChange: D,
3053
+ position: x = "bottom-right",
3054
+ mobileBreakpoint: C = 640,
3055
+ draggable: y,
3056
3056
  resizable: w,
3057
- persistKey: D = "ll-widget",
3057
+ persistKey: P = "ll-widget",
3058
3058
  disablePersistence: E = !1,
3059
- teamMembers: v,
3059
+ teamMembers: b,
3060
3060
  currentTeamMemberId: O,
3061
- onTeamMemberChange: y,
3061
+ onTeamMemberChange: v,
3062
3062
  idleLoopUrl: z,
3063
3063
  greeting: B,
3064
3064
  avatarImageUrl: J,
@@ -3070,21 +3070,21 @@ const _o = /* @__PURE__ */ new Set([
3070
3070
  blurUntilFirstSpeech: $ = !0,
3071
3071
  showMinimize: q,
3072
3072
  showClose: X,
3073
- chromeless: ee = !1,
3073
+ chromeless: te = !1,
3074
3074
  floatingChromeContainer: W = null,
3075
- compactControls: te = !1,
3075
+ compactControls: ne = !1,
3076
3076
  transforming: ie = !1,
3077
3077
  transformingLabel: U = "Transforming…",
3078
3078
  showOn: ge,
3079
3079
  hideOn: Z,
3080
- pathname: Ce,
3081
- onNavigate: ne,
3080
+ pathname: Le,
3081
+ onNavigate: re,
3082
3082
  onScrollToSelector: Me,
3083
3083
  getPageContext: st,
3084
3084
  pageContextExtras: _t,
3085
3085
  getRoutes: xt,
3086
3086
  onScrollPage: ct,
3087
- onClick: Lt,
3087
+ onClick: kt,
3088
3088
  capabilities: Ye,
3089
3089
  onConnect: Ge,
3090
3090
  onDisconnect: $e,
@@ -3097,103 +3097,103 @@ const _o = /* @__PURE__ */ new Set([
3097
3097
  controlledSession: F,
3098
3098
  className: qe,
3099
3099
  style: Ke,
3100
- zIndex: ke = 2147483647
3101
- } = t, Ct = ri(Ce), ut = ui(Ct, ge, Z);
3100
+ zIndex: Ce = 2147483647
3101
+ } = t, Lt = ii(Le), ut = di(Lt, ge, Z);
3102
3102
  I(() => {
3103
- to(), ao();
3104
- }, [Ct]);
3105
- const Ie = O !== void 0, [dt, kt] = M(() => {
3106
- var b;
3107
- return O ?? ((b = v == null ? void 0 : v[0]) == null ? void 0 : b.id);
3103
+ no(), so();
3104
+ }, [Lt]);
3105
+ const Ie = O !== void 0, [dt, Ct] = M(() => {
3106
+ var h;
3107
+ return O ?? ((h = b == null ? void 0 : b[0]) == null ? void 0 : h.id);
3108
3108
  }), Ue = Ie ? O : dt, ue = at(
3109
- () => (v == null ? void 0 : v.find((b) => b.id === Ue)) ?? null,
3110
- [v, Ue]
3111
- ), St = (ue == null ? void 0 : ue.agentId) ?? i, de = u === "EMBEDDED", ve = Xr(k), [Je, Ze] = Yr({
3109
+ () => (b == null ? void 0 : b.find((h) => h.id === Ue)) ?? null,
3110
+ [b, Ue]
3111
+ ), St = (ue == null ? void 0 : ue.agentId) ?? i, de = d === "EMBEDDED", ve = Kr(C), [Je, Ze] = Gr({
3112
3112
  value: p,
3113
- defaultValue: h,
3114
- onChange: P,
3115
- persistKey: D,
3113
+ defaultValue: m,
3114
+ onChange: D,
3115
+ persistKey: P,
3116
3116
  disablePersistence: de || E
3117
3117
  }), pe = de ? "expanded" : Je, be = de ? () => {
3118
- } : Ze, Et = q ?? !de, At = X ?? !de, Nt = te || !de && ve, _e = ti({
3119
- draggable: !de && (g ?? !ve),
3118
+ } : Ze, Et = q ?? !de, At = X ?? !de, Nt = ne || !de && ve, _e = ni({
3119
+ draggable: !de && (y ?? !ve),
3120
3120
  resizable: !de && (w ?? !ve),
3121
- persistKey: D,
3121
+ persistKey: P,
3122
3122
  disablePersistence: de || E
3123
- }), Te = Pr(), Ae = Or(), Re = Fr(), ft = Br(), [De, Se] = M(!1), [Qe, pt] = M(!1), [ht, et] = M(!1), [x, ae] = M(!1), [Wt, fr] = M(!1), Mt = fi({ baseUrl: o, config: c }), It = T(Mt);
3123
+ }), Re = zr(), Ae = Fr(), Te = Br(), ft = Wr(), [Pe, Se] = M(!1), [Qe, pt] = M(!1), [ht, et] = M(!1), [k, ae] = M(!1), [qt, pr] = M(!1), Mt = pi({ baseUrl: o, config: c }), It = R(Mt);
3124
3124
  It.current = Mt;
3125
- const qt = T(ne), Ut = T(Me), jt = T(ct), Vt = T(Lt), sn = T(st), cn = T(_t), un = T(xt), Yt = T(Ye), Ee = T(null);
3126
- qt.current = ne, Ut.current = Me, jt.current = ct, Vt.current = Lt, sn.current = st, cn.current = _t, un.current = xt, Yt.current = Ye;
3127
- function xe(b) {
3128
- const d = Yt.current;
3129
- return d ? d.includes(b) : !0;
3125
+ const Ut = R(re), jt = R(Me), Vt = R(ct), Yt = R(kt), cn = R(st), un = R(_t), dn = R(xt), Gt = R(Ye), Ee = R(null);
3126
+ Ut.current = re, jt.current = Me, Vt.current = ct, Yt.current = kt, cn.current = st, un.current = _t, dn.current = xt, Gt.current = Ye;
3127
+ function xe(h) {
3128
+ const u = Gt.current;
3129
+ return u ? u.includes(h) : !0;
3130
3130
  }
3131
- function Le(b, d) {
3131
+ function ke(h, u) {
3132
3132
  console.warn(
3133
- `[LiveLayer] Agent command "${b}" blocked — capability "${d}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
3133
+ `[LiveLayer] Agent command "${h}" blocked — capability "${u}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
3134
3134
  );
3135
3135
  }
3136
- const mt = C(
3137
- (b) => {
3138
- var re, fe, Ne, yt, Pe, kn;
3139
- const d = b;
3140
- if (!(!d.type || typeof d.type != "string")) {
3141
- if (Be == null || Be({ eventName: d.type, data: b }), d.type === "navigate") {
3136
+ const mt = L(
3137
+ (h) => {
3138
+ var Q, fe, Ne, yt, De, Sn;
3139
+ const u = h;
3140
+ if (!(!u.type || typeof u.type != "string")) {
3141
+ if (Be == null || Be({ eventName: u.type, data: h }), u.type === "navigate") {
3142
3142
  if (!xe("navigate")) {
3143
- Le("navigate", "navigate");
3143
+ ke("navigate", "navigate");
3144
3144
  return;
3145
3145
  }
3146
- const N = typeof d.href == "string" ? d.href : null;
3146
+ const N = typeof u.href == "string" ? u.href : null;
3147
3147
  if (!N) {
3148
3148
  console.warn(
3149
3149
  `[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
3150
3150
  );
3151
3151
  return;
3152
3152
  }
3153
- if (It.current.playPageChange(), qt.current) {
3153
+ if (It.current.playPageChange(), Ut.current) {
3154
3154
  try {
3155
- qt.current(N);
3156
- } catch (R) {
3155
+ Ut.current(N);
3156
+ } catch (T) {
3157
3157
  console.warn(
3158
3158
  `[LiveLayer] onNavigate threw for "${N}". Falling back. Error:`,
3159
- R
3159
+ T
3160
3160
  );
3161
3161
  }
3162
3162
  return;
3163
3163
  }
3164
3164
  if (typeof document < "u") {
3165
- const R = document.querySelector(
3165
+ const T = document.querySelector(
3166
3166
  `a[href="${N.replace(/"/g, '\\"')}"]`
3167
3167
  );
3168
- if (R) {
3169
- R.click();
3168
+ if (T) {
3169
+ T.click();
3170
3170
  return;
3171
3171
  }
3172
3172
  }
3173
3173
  if (typeof window < "u" && typeof history < "u")
3174
3174
  try {
3175
3175
  history.pushState({}, "", N), window.dispatchEvent(new PopStateEvent("popstate"));
3176
- } catch (R) {
3176
+ } catch (T) {
3177
3177
  console.warn(
3178
3178
  `[LiveLayer] history.pushState fallback failed for "${N}". Pass an onNavigate prop to use your router directly. See https://livelayer.studio/docs/react/navigation`,
3179
- R
3179
+ T
3180
3180
  );
3181
3181
  }
3182
3182
  return;
3183
3183
  }
3184
- if (d.type === "scroll_to") {
3184
+ if (u.type === "scroll_to") {
3185
3185
  if (!xe("scroll")) {
3186
- Le("scroll_to", "scroll");
3186
+ ke("scroll_to", "scroll");
3187
3187
  return;
3188
3188
  }
3189
- const N = typeof d.selector == "string" ? d.selector : null;
3189
+ const N = typeof u.selector == "string" ? u.selector : null;
3190
3190
  if (!N) return;
3191
- const R = d.behavior === "instant" ? "instant" : "smooth";
3192
- if (Ut.current) {
3191
+ const T = u.behavior === "instant" ? "instant" : "smooth";
3192
+ if (jt.current) {
3193
3193
  try {
3194
- Ut.current(
3194
+ jt.current(
3195
3195
  N,
3196
- R
3196
+ T
3197
3197
  );
3198
3198
  } catch (Y) {
3199
3199
  console.warn("[LiveLayer] onScrollToSelector threw.", Y);
@@ -3217,53 +3217,53 @@ const _o = /* @__PURE__ */ new Set([
3217
3217
  return;
3218
3218
  }
3219
3219
  Y.scrollIntoView({
3220
- behavior: R,
3220
+ behavior: T,
3221
3221
  block: "start"
3222
3222
  });
3223
3223
  }
3224
3224
  return;
3225
3225
  }
3226
- if (d.type === "request_page_context") {
3226
+ if (u.type === "request_page_context") {
3227
3227
  if (!xe("read_page")) {
3228
- Le("request_page_context", "read_page");
3228
+ ke("request_page_context", "read_page");
3229
3229
  return;
3230
3230
  }
3231
- const N = typeof d.requestId == "string" ? d.requestId : void 0, R = (re = Ee.current) == null ? void 0 : re.call(Ee), Y = (Q) => {
3232
- const V = R, he = V == null ? void 0 : V.localParticipant;
3231
+ const N = typeof u.requestId == "string" ? u.requestId : void 0, T = (Q = Ee.current) == null ? void 0 : Q.call(Ee), Y = (ee) => {
3232
+ const V = T, he = V == null ? void 0 : V.localParticipant;
3233
3233
  if (he != null && he.publishData)
3234
3234
  try {
3235
- const me = N ? { ...Q, requestId: N } : Q, oe = new TextEncoder().encode(JSON.stringify(me));
3235
+ const me = N ? { ...ee, requestId: N } : ee, oe = new TextEncoder().encode(JSON.stringify(me));
3236
3236
  he.publishData(oe, { reliable: !0 });
3237
3237
  } catch (me) {
3238
3238
  console.warn("[LiveLayer] publishData failed.", me);
3239
3239
  }
3240
- }, j = cn.current, K = sn.current;
3240
+ }, j = un.current, K = cn.current;
3241
3241
  try {
3242
3242
  if (K) {
3243
- const Q = K(j);
3244
- if (Q instanceof Promise) {
3245
- Y({ type: "page_context_pending" }), Q.then((V) => Y({ type: "page_context", context: V })).catch((V) => {
3243
+ const ee = K(j);
3244
+ if (ee instanceof Promise) {
3245
+ Y({ type: "page_context_pending" }), ee.then((V) => Y({ type: "page_context", context: V })).catch((V) => {
3246
3246
  console.warn(
3247
3247
  "[LiveLayer] getPageContext rejected; falling back to default walker.",
3248
3248
  V
3249
3249
  ), Y({
3250
3250
  type: "page_context",
3251
- context: Gn(j)
3251
+ context: Xn(j)
3252
3252
  });
3253
3253
  });
3254
3254
  return;
3255
3255
  }
3256
- Y({ type: "page_context", context: Q });
3256
+ Y({ type: "page_context", context: ee });
3257
3257
  return;
3258
3258
  }
3259
3259
  Y({
3260
3260
  type: "page_context",
3261
- context: Gn(j)
3261
+ context: Xn(j)
3262
3262
  });
3263
- } catch (Q) {
3263
+ } catch (ee) {
3264
3264
  console.warn(
3265
3265
  "[LiveLayer] page-context extraction threw. Sending empty context.",
3266
- Q
3266
+ ee
3267
3267
  ), Y({
3268
3268
  type: "page_context",
3269
3269
  context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: j }
@@ -3271,24 +3271,24 @@ const _o = /* @__PURE__ */ new Set([
3271
3271
  }
3272
3272
  return;
3273
3273
  }
3274
- if (d.type === "scroll_page") {
3274
+ if (u.type === "scroll_page") {
3275
3275
  if (!xe("scroll")) {
3276
- Le("scroll_page", "scroll");
3276
+ ke("scroll_page", "scroll");
3277
3277
  return;
3278
3278
  }
3279
- const N = d.direction;
3279
+ const N = u.direction;
3280
3280
  if (N !== "up" && N !== "down" && N !== "top" && N !== "bottom") {
3281
3281
  console.warn(
3282
3282
  `[LiveLayer] scroll_page: invalid direction "${String(N)}". Expected up | down | top | bottom.`
3283
3283
  );
3284
3284
  return;
3285
3285
  }
3286
- const R = d.behavior === "instant" ? "instant" : "smooth";
3287
- if (jt.current) {
3286
+ const T = u.behavior === "instant" ? "instant" : "smooth";
3287
+ if (Vt.current) {
3288
3288
  try {
3289
- jt.current(
3289
+ Vt.current(
3290
3290
  N,
3291
- R
3291
+ T
3292
3292
  );
3293
3293
  } catch (V) {
3294
3294
  console.warn("[LiveLayer] onScrollPage threw.", V);
@@ -3296,104 +3296,104 @@ const _o = /* @__PURE__ */ new Set([
3296
3296
  return;
3297
3297
  }
3298
3298
  if (typeof window > "u") return;
3299
- const Y = { behavior: R }, j = bo(), K = (V) => {
3299
+ const Y = { behavior: T }, j = wo(), K = (V) => {
3300
3300
  j instanceof Window ? j.scrollBy({ top: V, ...Y }) : j.scrollBy({ top: V, ...Y });
3301
- }, Q = (V) => {
3301
+ }, ee = (V) => {
3302
3302
  j instanceof Window ? j.scrollTo({ top: V, ...Y }) : j.scrollTo({ top: V, ...Y });
3303
3303
  };
3304
- N === "up" ? K(-Jn(j)) : N === "down" ? K(Jn(j)) : Q(N === "top" ? 0 : wo(j));
3304
+ N === "up" ? K(-Zn(j)) : N === "down" ? K(Zn(j)) : ee(N === "top" ? 0 : _o(j));
3305
3305
  return;
3306
3306
  }
3307
- if (d.type === "click") {
3307
+ if (u.type === "click") {
3308
3308
  if (!xe("click")) {
3309
- Le("click", "click");
3309
+ ke("click", "click");
3310
3310
  return;
3311
3311
  }
3312
- const N = typeof d.selector == "string" ? d.selector : null;
3312
+ const N = typeof u.selector == "string" ? u.selector : null;
3313
3313
  if (!N) {
3314
3314
  console.warn("[LiveLayer] click: missing selector.");
3315
3315
  return;
3316
3316
  }
3317
- if (Vt.current) {
3317
+ if (Yt.current) {
3318
3318
  try {
3319
- Vt.current(N);
3319
+ Yt.current(N);
3320
3320
  } catch (Y) {
3321
3321
  console.warn("[LiveLayer] onClick threw.", Y);
3322
3322
  }
3323
3323
  return;
3324
3324
  }
3325
3325
  if (typeof document > "u") return;
3326
- let R = null;
3326
+ let T = null;
3327
3327
  try {
3328
- R = document.querySelector(N);
3328
+ T = document.querySelector(N);
3329
3329
  } catch {
3330
3330
  console.warn(
3331
3331
  `[LiveLayer] click: invalid selector "${N}".`
3332
3332
  );
3333
3333
  return;
3334
3334
  }
3335
- if (!R) {
3335
+ if (!T) {
3336
3336
  console.warn(
3337
3337
  `[LiveLayer] click: no element matched "${N}". See https://livelayer.studio/docs/errors/click-no-match`
3338
3338
  );
3339
3339
  return;
3340
3340
  }
3341
- if (R.closest('[data-ll-private="true"], .ll-widget')) {
3341
+ if (T.closest('[data-ll-private="true"], .ll-widget')) {
3342
3342
  console.warn(
3343
3343
  "[LiveLayer] click: refusing to click element inside a private subtree."
3344
3344
  );
3345
3345
  return;
3346
3346
  }
3347
- (fe = R.click) == null || fe.call(R);
3347
+ (fe = T.click) == null || fe.call(T);
3348
3348
  return;
3349
3349
  }
3350
- if (d.type === "advance_step" || d.type === "go_back" || d.type === "submit_flow") {
3350
+ if (u.type === "advance_step" || u.type === "go_back" || u.type === "submit_flow") {
3351
3351
  if (!xe("click")) {
3352
- Le(d.type, "click");
3352
+ ke(u.type, "click");
3353
3353
  return;
3354
3354
  }
3355
3355
  if (typeof document > "u") return;
3356
- const N = d.type === "advance_step" ? "ll-advance" : d.type === "go_back" ? "ll-back" : "ll-submit";
3357
- let R = qn(N);
3358
- if (R || (cr(document), R = qn(N)), !R) {
3359
- console.warn(`[LiveLayer] ${d.type}: no "${N}" control found.`);
3356
+ const N = u.type === "advance_step" ? "ll-advance" : u.type === "go_back" ? "ll-back" : "ll-submit";
3357
+ let T = Un(N);
3358
+ if (T || (ur(document), T = Un(N)), !T) {
3359
+ console.warn(`[LiveLayer] ${u.type}: no "${N}" control found.`);
3360
3360
  return;
3361
3361
  }
3362
- (Ne = R.click) == null || Ne.call(R);
3362
+ (Ne = T.click) == null || Ne.call(T);
3363
3363
  return;
3364
3364
  }
3365
- if (d.type === "fill_form" || d.type === "focus_field") {
3365
+ if (u.type === "fill_form" || u.type === "focus_field") {
3366
3366
  if (!xe("fill_forms")) {
3367
- Le(d.type, "fill_forms");
3367
+ ke(u.type, "fill_forms");
3368
3368
  return;
3369
3369
  }
3370
3370
  if (typeof document > "u") return;
3371
- d.type === "fill_form" && It.current.playConfirmation();
3372
- const N = typeof d.formId == "string" ? d.formId : null;
3371
+ u.type === "fill_form" && It.current.playConfirmation();
3372
+ const N = typeof u.formId == "string" ? u.formId : null;
3373
3373
  if (!N) {
3374
- console.warn(`[LiveLayer] ${d.type}: missing formId.`);
3374
+ console.warn(`[LiveLayer] ${u.type}: missing formId.`);
3375
3375
  return;
3376
3376
  }
3377
- const R = Kn(document, N);
3378
- if (!R) {
3377
+ const T = Jn(document, N);
3378
+ if (!T) {
3379
3379
  console.warn(
3380
- `[LiveLayer] ${d.type}: no <form> matched id="${N}" (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.`
3380
+ `[LiveLayer] ${u.type}: no <form> matched id="${N}" (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.`
3381
3381
  );
3382
3382
  return;
3383
3383
  }
3384
- if (R.closest('[data-ll-private="true"], [data-ll-skip], .ll-widget')) {
3384
+ if (T.closest('[data-ll-private="true"], [data-ll-skip], .ll-widget')) {
3385
3385
  console.warn(
3386
- `[LiveLayer] ${d.type}: refusing to touch a form in a private / opted-out subtree.`
3386
+ `[LiveLayer] ${u.type}: refusing to touch a form in a private / opted-out subtree.`
3387
3387
  );
3388
3388
  return;
3389
3389
  }
3390
- if (d.type === "focus_field") {
3391
- const j = typeof d.fieldName == "string" ? d.fieldName : null;
3390
+ if (u.type === "focus_field") {
3391
+ const j = typeof u.fieldName == "string" ? u.fieldName : null;
3392
3392
  if (!j) {
3393
3393
  console.warn("[LiveLayer] focus_field: missing fieldName.");
3394
3394
  return;
3395
3395
  }
3396
- const K = Xn(R, j);
3396
+ const K = Kn(T, j);
3397
3397
  if (K.el === null) {
3398
3398
  K.reason === "private" ? console.warn(
3399
3399
  `[LiveLayer] focus_field: field "${j}" is privacy-protected and not focusable.`
@@ -3405,16 +3405,16 @@ const _o = /* @__PURE__ */ new Set([
3405
3405
  K.el.focus();
3406
3406
  return;
3407
3407
  }
3408
- const Y = d.values && typeof d.values == "object" ? d.values : null;
3408
+ const Y = u.values && typeof u.values == "object" ? u.values : null;
3409
3409
  if (!Y) {
3410
3410
  console.warn("[LiveLayer] fill_form: missing or invalid values.");
3411
3411
  return;
3412
3412
  }
3413
3413
  for (const [j, K] of Object.entries(Y)) {
3414
3414
  if (typeof K != "string") continue;
3415
- const Q = Xn(R, j);
3416
- if (Q.el === null) {
3417
- Q.reason === "private" ? console.warn(
3415
+ const ee = Kn(T, j);
3416
+ if (ee.el === null) {
3417
+ ee.reason === "private" ? console.warn(
3418
3418
  `[LiveLayer] fill_form: field "${j}" is privacy-protected (password / cc-* / data-ll-private). Skipping.`
3419
3419
  ) : console.warn(
3420
3420
  `[LiveLayer] fill_form: no input matching key="${j}" in form "${N}". The agent should use the field.name it observed in PageContext.forms[].fields[]. Skipping.`
@@ -3422,7 +3422,7 @@ const _o = /* @__PURE__ */ new Set([
3422
3422
  continue;
3423
3423
  }
3424
3424
  try {
3425
- ho(Q.el, K);
3425
+ mo(ee.el, K);
3426
3426
  } catch (V) {
3427
3427
  console.warn(
3428
3428
  `[LiveLayer] fill_form: failed to set "${j}".`,
@@ -3432,61 +3432,61 @@ const _o = /* @__PURE__ */ new Set([
3432
3432
  }
3433
3433
  return;
3434
3434
  }
3435
- if (d.type === "submit_form") {
3435
+ if (u.type === "submit_form") {
3436
3436
  if (!xe("submit_forms")) {
3437
- Le("submit_form", "submit_forms");
3437
+ ke("submit_form", "submit_forms");
3438
3438
  return;
3439
3439
  }
3440
3440
  if (typeof document > "u") return;
3441
- const N = typeof d.formId == "string" ? d.formId : null;
3441
+ const N = typeof u.formId == "string" ? u.formId : null;
3442
3442
  if (!N) {
3443
3443
  console.warn("[LiveLayer] submit_form: missing formId.");
3444
3444
  return;
3445
3445
  }
3446
3446
  It.current.playConfirmation();
3447
- const R = Kn(document, N);
3448
- if (!R) {
3447
+ const T = Jn(document, N);
3448
+ if (!T) {
3449
3449
  console.warn(
3450
3450
  `[LiveLayer] submit_form: no <form> matched id="${N}" (or matching name / data-ll-intent slug).`
3451
3451
  );
3452
3452
  return;
3453
3453
  }
3454
- if (R.closest('[data-ll-private="true"], [data-ll-skip], .ll-widget')) {
3454
+ if (T.closest('[data-ll-private="true"], [data-ll-skip], .ll-widget')) {
3455
3455
  console.warn(
3456
3456
  "[LiveLayer] submit_form: refusing to submit a form in a private / opted-out subtree."
3457
3457
  );
3458
3458
  return;
3459
3459
  }
3460
- const Y = typeof d.requestId == "string" ? d.requestId : void 0, j = (yt = Ee.current) == null ? void 0 : yt.call(Ee), K = (oe) => {
3460
+ const Y = typeof u.requestId == "string" ? u.requestId : void 0, j = (yt = Ee.current) == null ? void 0 : yt.call(Ee), K = (oe) => {
3461
3461
  const ye = j, je = ye == null ? void 0 : ye.localParticipant;
3462
3462
  if (je != null && je.publishData)
3463
3463
  try {
3464
- const Dt = Y ? { ...oe, requestId: Y } : oe, Pt = new TextEncoder().encode(JSON.stringify(Dt));
3465
- je.publishData(Pt, { reliable: !0 });
3464
+ const Dt = Y ? { ...oe, requestId: Y } : oe, zt = new TextEncoder().encode(JSON.stringify(Dt));
3465
+ je.publishData(zt, { reliable: !0 });
3466
3466
  } catch {
3467
3467
  }
3468
- }, Q = (oe) => {
3469
- var Pt, Sn, En, An;
3470
- const ye = oe, je = (Pt = ye.getAttribute) == null ? void 0 : Pt.call(ye, "aria-label");
3468
+ }, ee = (oe) => {
3469
+ var zt, En, An, Nn;
3470
+ const ye = oe, je = (zt = ye.getAttribute) == null ? void 0 : zt.call(ye, "aria-label");
3471
3471
  if (je) return je;
3472
3472
  const Dt = ye.id;
3473
3473
  if (Dt) {
3474
- const zt = (Sn = R.ownerDocument) == null ? void 0 : Sn.querySelector(`label[for="${Dt}"]`);
3475
- if ((En = zt == null ? void 0 : zt.textContent) != null && En.trim()) return zt.textContent.trim();
3474
+ const $t = (En = T.ownerDocument) == null ? void 0 : En.querySelector(`label[for="${Dt}"]`);
3475
+ if ((An = $t == null ? void 0 : $t.textContent) != null && An.trim()) return $t.textContent.trim();
3476
3476
  }
3477
- return ((An = ye.getAttribute) == null ? void 0 : An.call(ye, "name")) || ye.id || ye.type || "field";
3477
+ return ((Nn = ye.getAttribute) == null ? void 0 : Nn.call(ye, "name")) || ye.id || ye.type || "field";
3478
3478
  }, V = () => {
3479
3479
  try {
3480
- return Array.from(R.elements).filter(
3480
+ return Array.from(T.elements).filter(
3481
3481
  (oe) => "willValidate" in oe && oe.willValidate && !oe.checkValidity()
3482
- ).map((oe) => `${Q(oe)}: ${oe.validationMessage}`);
3482
+ ).map((oe) => `${ee(oe)}: ${oe.validationMessage}`);
3483
3483
  } catch {
3484
3484
  return [];
3485
3485
  }
3486
3486
  };
3487
- if (typeof R.checkValidity == "function" && !R.checkValidity()) {
3487
+ if (typeof T.checkValidity == "function" && !T.checkValidity()) {
3488
3488
  try {
3489
- (Pe = R.reportValidity) == null || Pe.call(R);
3489
+ (De = T.reportValidity) == null || De.call(T);
3490
3490
  } catch {
3491
3491
  }
3492
3492
  K({
@@ -3503,11 +3503,11 @@ const _o = /* @__PURE__ */ new Set([
3503
3503
  oe.defaultPrevented ? K({ type: "form_submit_uncertain", formId: N, reason: "spa_prevented" }) : K({ type: "form_submitted", formId: N });
3504
3504
  });
3505
3505
  };
3506
- R.addEventListener("submit", me, { once: !0 });
3506
+ T.addEventListener("submit", me, { once: !0 });
3507
3507
  try {
3508
- typeof R.requestSubmit == "function" ? R.requestSubmit() : R.submit();
3508
+ typeof T.requestSubmit == "function" ? T.requestSubmit() : T.submit();
3509
3509
  } catch (oe) {
3510
- console.warn("[LiveLayer] submit_form: requestSubmit threw.", oe), R.removeEventListener("submit", me), K({
3510
+ console.warn("[LiveLayer] submit_form: requestSubmit threw.", oe), T.removeEventListener("submit", me), K({
3511
3511
  type: "form_submit_blocked",
3512
3512
  formId: N,
3513
3513
  reason: "exception"
@@ -3515,7 +3515,7 @@ const _o = /* @__PURE__ */ new Set([
3515
3515
  return;
3516
3516
  }
3517
3517
  setTimeout(() => {
3518
- he || (R.removeEventListener("submit", me), K({
3518
+ he || (T.removeEventListener("submit", me), K({
3519
3519
  type: "form_submit_blocked",
3520
3520
  formId: N,
3521
3521
  reason: "validation",
@@ -3524,12 +3524,12 @@ const _o = /* @__PURE__ */ new Set([
3524
3524
  }, 500);
3525
3525
  return;
3526
3526
  }
3527
- if (d.type === "request_routes") {
3527
+ if (u.type === "request_routes") {
3528
3528
  if (!xe("read_page")) {
3529
- Le("request_routes", "read_page");
3529
+ ke("request_routes", "read_page");
3530
3530
  return;
3531
3531
  }
3532
- const N = typeof d.requestId == "string" ? d.requestId : void 0, Y = (kn = Ee.current) == null ? void 0 : kn.call(Ee), j = Y == null ? void 0 : Y.localParticipant;
3532
+ const N = typeof u.requestId == "string" ? u.requestId : void 0, Y = (Sn = Ee.current) == null ? void 0 : Sn.call(Ee), j = Y == null ? void 0 : Y.localParticipant;
3533
3533
  if (!(j != null && j.publishData)) return;
3534
3534
  const K = (V) => {
3535
3535
  try {
@@ -3538,51 +3538,51 @@ const _o = /* @__PURE__ */ new Set([
3538
3538
  } catch (he) {
3539
3539
  console.warn("[LiveLayer] request_routes: publishData failed.", he);
3540
3540
  }
3541
- }, Q = un.current;
3542
- if (Q) {
3541
+ }, ee = dn.current;
3542
+ if (ee) {
3543
3543
  try {
3544
- const V = Q(), he = (me) => {
3544
+ const V = ee(), he = (me) => {
3545
3545
  if (!Array.isArray(me)) {
3546
3546
  K([]);
3547
3547
  return;
3548
3548
  }
3549
- K(me.map(ro).slice(0, 200));
3549
+ K(me.map(io).slice(0, 200));
3550
3550
  };
3551
3551
  V instanceof Promise ? V.then(he).catch((me) => {
3552
3552
  console.warn(
3553
3553
  "[LiveLayer] getRoutes rejected; falling back to DOM walker.",
3554
3554
  me
3555
- ), K(Zt());
3555
+ ), K(Qt());
3556
3556
  }) : he(V);
3557
3557
  } catch (V) {
3558
3558
  console.warn(
3559
3559
  "[LiveLayer] getRoutes threw; falling back to DOM walker.",
3560
3560
  V
3561
- ), K(Zt());
3561
+ ), K(Qt());
3562
3562
  }
3563
3563
  return;
3564
3564
  }
3565
3565
  try {
3566
- K(Zt());
3566
+ K(Qt());
3567
3567
  } catch (V) {
3568
3568
  console.warn("[LiveLayer] request_routes: extractRoutes threw.", V);
3569
3569
  }
3570
3570
  return;
3571
3571
  }
3572
- if (d.type === "task_field_updated") {
3572
+ if (u.type === "task_field_updated") {
3573
3573
  if (!xe("collect_data")) {
3574
- Le("task_field_updated", "collect_data");
3574
+ ke("task_field_updated", "collect_data");
3575
3575
  return;
3576
3576
  }
3577
3577
  const N = {
3578
3578
  phase: "field",
3579
- fieldId: typeof d.fieldId == "string" ? d.fieldId : "",
3580
- fieldName: typeof d.fieldName == "string" ? d.fieldName : typeof d.fieldId == "string" ? d.fieldId : "",
3581
- value: typeof d.value == "string" ? d.value : "",
3582
- kind: typeof d.kind == "string" ? d.kind : "text",
3583
- source: d.source === "slide" ? "slide" : d.source === "page" ? "page" : "agent",
3584
- ...typeof d.slideId == "string" ? { slideId: d.slideId } : {},
3585
- ...typeof d.formId == "string" ? { formId: d.formId } : {}
3579
+ fieldId: typeof u.fieldId == "string" ? u.fieldId : "",
3580
+ fieldName: typeof u.fieldName == "string" ? u.fieldName : typeof u.fieldId == "string" ? u.fieldId : "",
3581
+ value: typeof u.value == "string" ? u.value : "",
3582
+ kind: typeof u.kind == "string" ? u.kind : "text",
3583
+ source: u.source === "slide" ? "slide" : u.source === "page" ? "page" : "agent",
3584
+ ...typeof u.slideId == "string" ? { slideId: u.slideId } : {},
3585
+ ...typeof u.formId == "string" ? { formId: u.formId } : {}
3586
3586
  };
3587
3587
  if (typeof document < "u")
3588
3588
  try {
@@ -3593,12 +3593,12 @@ const _o = /* @__PURE__ */ new Set([
3593
3593
  }
3594
3594
  return;
3595
3595
  }
3596
- if (d.type === "task_completed") {
3596
+ if (u.type === "task_completed") {
3597
3597
  if (!xe("collect_data")) {
3598
- Le("task_completed", "collect_data");
3598
+ ke("task_completed", "collect_data");
3599
3599
  return;
3600
3600
  }
3601
- const N = d.result;
3601
+ const N = u.result;
3602
3602
  if (!N || typeof N != "object") {
3603
3603
  console.warn(
3604
3604
  "[LiveLayer] task_completed missing `result` payload."
@@ -3618,12 +3618,12 @@ const _o = /* @__PURE__ */ new Set([
3618
3618
  We == null || We(
3619
3619
  N
3620
3620
  );
3621
- } catch (R) {
3622
- console.warn("[LiveLayer] onCollect threw.", R);
3621
+ } catch (T) {
3622
+ console.warn("[LiveLayer] onCollect threw.", T);
3623
3623
  }
3624
3624
  return;
3625
3625
  }
3626
- _o.has(d.type) || Xe == null || Xe(d);
3626
+ xo.has(u.type) || Xe == null || Xe(u);
3627
3627
  }
3628
3628
  },
3629
3629
  [Xe, Be, We]
@@ -3639,13 +3639,13 @@ const _o = /* @__PURE__ */ new Set([
3639
3639
  if (F != null && F.subscribeToDataMessages)
3640
3640
  return F.subscribeToDataMessages(mt);
3641
3641
  }, [F, mt]), Ee.current = () => {
3642
- var b;
3643
- return (b = se.getRoom) == null ? void 0 : b.call(se);
3642
+ var h;
3643
+ return (h = se.getRoom) == null ? void 0 : h.call(se);
3644
3644
  }, I(() => {
3645
- var re;
3645
+ var Q;
3646
3646
  if (typeof window > "u") return;
3647
- const b = ((re = window.location) == null ? void 0 : re.hostname) || "";
3648
- if (b === "localhost" || b === "127.0.0.1" || b === "0.0.0.0" || b.endsWith(".local") || b.endsWith(".test"))
3647
+ const h = ((Q = window.location) == null ? void 0 : Q.hostname) || "";
3648
+ if (h === "localhost" || h === "127.0.0.1" || h === "0.0.0.0" || h.endsWith(".local") || h.endsWith(".test"))
3649
3649
  return window.__livelayerSimulateCommand = (fe) => {
3650
3650
  try {
3651
3651
  mt(fe);
@@ -3656,7 +3656,7 @@ const _o = /* @__PURE__ */ new Set([
3656
3656
  delete window.__livelayerSimulateCommand;
3657
3657
  };
3658
3658
  }, [mt]);
3659
- const L = at(() => F ? {
3659
+ const _ = at(() => F ? {
3660
3660
  connectionState: F.connectionState,
3661
3661
  agentState: F.agentState,
3662
3662
  transcript: F.transcript,
@@ -3687,176 +3687,184 @@ const _o = /* @__PURE__ */ new Set([
3687
3687
  disconnect: se.disconnect,
3688
3688
  getRoom: se.getRoom,
3689
3689
  isControlled: !1
3690
- }, [F, se]), dn = T(L);
3691
- dn.current = L;
3692
- const fn = T(F);
3693
- fn.current = F, Er(
3690
+ }, [F, se]), fn = R(_);
3691
+ fn.current = _;
3692
+ const pn = R(F);
3693
+ pn.current = F, Ar(
3694
3694
  n,
3695
3695
  () => ({
3696
- sendData: async (b) => {
3696
+ sendData: async (h) => {
3697
3697
  var Ne, yt;
3698
- const d = fn.current;
3699
- if (d != null && d.publishData) {
3698
+ const u = pn.current;
3699
+ if (u != null && u.publishData) {
3700
3700
  try {
3701
- await d.publishData(b);
3702
- } catch (Pe) {
3703
- console.warn("[AvatarWidget] sendData (controlled) failed:", Pe);
3701
+ await u.publishData(h);
3702
+ } catch (De) {
3703
+ console.warn("[AvatarWidget] sendData (controlled) failed:", De);
3704
3704
  }
3705
3705
  return;
3706
3706
  }
3707
- const re = (yt = (Ne = dn.current) == null ? void 0 : Ne.getRoom) == null ? void 0 : yt.call(Ne), fe = re == null ? void 0 : re.localParticipant;
3707
+ const Q = (yt = (Ne = fn.current) == null ? void 0 : Ne.getRoom) == null ? void 0 : yt.call(Ne), fe = Q == null ? void 0 : Q.localParticipant;
3708
3708
  if (fe != null && fe.publishData)
3709
3709
  try {
3710
- const Pe = new TextEncoder().encode(JSON.stringify(b));
3711
- await fe.publishData(Pe, { reliable: !0 });
3712
- } catch (Pe) {
3713
- console.warn("[AvatarWidget] sendData failed:", Pe);
3710
+ const De = new TextEncoder().encode(JSON.stringify(h));
3711
+ await fe.publishData(De, { reliable: !0 });
3712
+ } catch (De) {
3713
+ console.warn("[AvatarWidget] sendData failed:", De);
3714
3714
  }
3715
3715
  }
3716
3716
  }),
3717
3717
  []
3718
3718
  );
3719
- const pn = T(null);
3719
+ const hn = R(null);
3720
3720
  I(() => {
3721
- const b = L.videoElement, d = pn.current;
3722
- if (!(!b || !d))
3723
- return d.appendChild(b), () => {
3724
- b.parentNode === d && d.removeChild(b);
3721
+ const h = _.videoElement, u = hn.current;
3722
+ if (!(!h || !u))
3723
+ return u.appendChild(h), () => {
3724
+ h.parentNode === u && u.removeChild(h);
3725
3725
  };
3726
- }, [L.videoElement]);
3727
- const [tt, Tt] = M(!1);
3726
+ }, [_.videoElement]);
3727
+ const [tt, Rt] = M(!1);
3728
3728
  I(() => {
3729
3729
  if (!$) {
3730
- Tt(!0);
3730
+ Rt(!0);
3731
3731
  return;
3732
3732
  }
3733
- L.agentState === "speaking" && !tt && Tt(!0);
3734
- }, [$, L.agentState, tt]), I(() => {
3733
+ _.agentState === "speaking" && !tt && Rt(!0);
3734
+ }, [$, _.agentState, tt]), I(() => {
3735
3735
  if (!$) return;
3736
- const b = L.connectionState;
3737
- (b === "disconnected" || b === "idle") && Tt(!1);
3738
- }, [$, L.connectionState]), I(() => {
3739
- if (!$ || !L.videoElement || tt) return;
3740
- const b = setTimeout(() => Tt(!0), 5e3);
3741
- return () => clearTimeout(b);
3742
- }, [$, L.videoElement, tt]), I(() => {
3743
- const b = L.videoElement;
3744
- if (b) {
3736
+ const h = _.connectionState;
3737
+ (h === "disconnected" || h === "idle") && Rt(!1);
3738
+ }, [$, _.connectionState]), I(() => {
3739
+ if (!$ || !_.videoElement || tt) return;
3740
+ const h = setTimeout(() => Rt(!0), 5e3);
3741
+ return () => clearTimeout(h);
3742
+ }, [$, _.videoElement, tt]), I(() => {
3743
+ const h = _.videoElement;
3744
+ if (h) {
3745
3745
  if (!$) {
3746
- b.style.filter = "";
3746
+ h.style.filter = "";
3747
3747
  return;
3748
3748
  }
3749
- b.style.transition = "filter 500ms ease-out", b.style.filter = tt ? "" : "blur(8px)";
3749
+ h.style.transition = "filter 500ms ease-out", h.style.filter = tt ? "" : "blur(8px)";
3750
3750
  }
3751
- }, [$, L.videoElement, tt]), I(() => {
3752
- const b = L.audioElement;
3753
- if (!b) return;
3754
- const d = document.createElement("div");
3755
- 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(b), document.body.appendChild(d), Te.attach(b);
3756
- const re = b.play();
3757
- return re && typeof re.catch == "function" && re.catch((fe) => {
3751
+ }, [$, _.videoElement, tt]);
3752
+ const Tt = R(/* @__PURE__ */ new Map());
3753
+ I(() => {
3754
+ const h = _.audioElement;
3755
+ if (!h || Tt.current.has(h)) return;
3756
+ const u = document.createElement("div");
3757
+ 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(h), document.body.appendChild(u), Tt.current.set(h, u), Re.attach(h);
3758
+ const Q = h.play();
3759
+ Q && typeof Q.catch == "function" && Q.catch((fe) => {
3758
3760
  (fe == null ? void 0 : fe.name) === "NotAllowedError" && Se(!0);
3759
- }), () => {
3760
- Te.detach(), b.parentNode === d && d.removeChild(b), d.parentNode === document.body && document.body.removeChild(d);
3761
- };
3762
- }, [L.audioElement]);
3763
- const we = $r({
3761
+ });
3762
+ }, [_.audioElement]), I(() => {
3763
+ const h = _.connectionState;
3764
+ if (!(h !== "disconnected" && h !== "idle" && h !== "error")) {
3765
+ Re.detach();
3766
+ for (const [u, Q] of Tt.current)
3767
+ u.parentNode === Q && Q.removeChild(u), Q.parentNode === document.body && document.body.removeChild(Q);
3768
+ Tt.current.clear();
3769
+ }
3770
+ }, [_.connectionState]);
3771
+ const we = Hr({
3764
3772
  gateUntilAgentReady: !0,
3765
- agentState: L.agentState
3773
+ agentState: _.agentState
3766
3774
  });
3767
3775
  I(() => {
3768
- if (L.isControlled || L.connectionState !== "connected") return;
3769
- const b = L.getRoom();
3770
- if (b)
3771
- return we.setupMic(b).then(() => {
3772
- const d = we.getMicStream();
3773
- d && Te.attachStream(d, "mic");
3776
+ if (_.isControlled || _.connectionState !== "connected") return;
3777
+ const h = _.getRoom();
3778
+ if (h)
3779
+ return we.setupMic(h).then(() => {
3780
+ const u = we.getMicStream();
3781
+ u && Re.attachStream(u, "mic");
3774
3782
  }).catch(() => {
3775
3783
  }), () => {
3776
- Te.detachSlot("mic"), we.teardownMic();
3784
+ Re.detachSlot("mic"), we.teardownMic();
3777
3785
  };
3778
- }, [L.isControlled, L.connectionState]), I(() => {
3779
- var d;
3780
- if (L.connectionState !== "connected") return;
3781
- const b = L.isControlled ? (d = F == null ? void 0 : F.getRoom) == null ? void 0 : d.call(F) : L.getRoom();
3782
- if (b)
3783
- return Ae.attachRoom(b), Re.attachRoom(b), L.isControlled && we.attachRoom(b), ft.refresh(), () => {
3784
- Ae.teardown(), Re.teardown();
3786
+ }, [_.isControlled, _.connectionState]), I(() => {
3787
+ var u;
3788
+ if (_.connectionState !== "connected") return;
3789
+ const h = _.isControlled ? (u = F == null ? void 0 : F.getRoom) == null ? void 0 : u.call(F) : _.getRoom();
3790
+ if (h)
3791
+ return Ae.attachRoom(h), Te.attachRoom(h), _.isControlled && we.attachRoom(h), ft.refresh(), () => {
3792
+ Ae.teardown(), Te.teardown();
3785
3793
  };
3786
- }, [L.isControlled, L.connectionState, F]), I(() => {
3787
- const b = L.audioElement;
3788
- b && (b.muted = Wt);
3789
- }, [L.audioElement, Wt]);
3790
- const pr = C((b) => {
3791
- const d = { type: "user_message", text: b };
3794
+ }, [_.isControlled, _.connectionState, F]), I(() => {
3795
+ const h = _.audioElement;
3796
+ h && (h.muted = qt);
3797
+ }, [_.audioElement, qt]);
3798
+ const hr = L((h) => {
3799
+ const u = { type: "user_message", text: h };
3792
3800
  if (F != null && F.publishData) {
3793
3801
  try {
3794
- F.publishData(d);
3802
+ F.publishData(u);
3795
3803
  } catch {
3796
3804
  }
3797
3805
  return;
3798
3806
  }
3799
- const re = L.getRoom();
3800
- if (re)
3807
+ const Q = _.getRoom();
3808
+ if (Q)
3801
3809
  try {
3802
- const fe = new TextEncoder().encode(JSON.stringify(d));
3803
- re.localParticipant.publishData(fe, { reliable: !0 });
3810
+ const fe = new TextEncoder().encode(JSON.stringify(u));
3811
+ Q.localParticipant.publishData(fe, { reliable: !0 });
3804
3812
  } catch {
3805
3813
  }
3806
- }, [L, F]), hr = C(() => {
3807
- fr((b) => !b);
3814
+ }, [_, F]), mr = L(() => {
3815
+ pr((h) => !h);
3808
3816
  }, []);
3809
3817
  I(() => {
3810
- Fe == null || Fe(L.connectionState), L.connectionState === "connected" ? Ge == null || Ge() : L.connectionState === "disconnected" && ($e == null || $e());
3811
- }, [L.connectionState, Ge, $e, Fe]), I(() => {
3812
- He == null || He(L.transcript);
3813
- }, [L.transcript, He]), I(() => {
3814
- Oe == null || Oe(L.agentState);
3815
- }, [L.agentState, Oe]), I(() => {
3816
- Mt.setThinking(L.agentState === "thinking");
3817
- }, [L.agentState, Mt]);
3818
- const hn = T(!1);
3818
+ Fe == null || Fe(_.connectionState), _.connectionState === "connected" ? Ge == null || Ge() : _.connectionState === "disconnected" && ($e == null || $e());
3819
+ }, [_.connectionState, Ge, $e, Fe]), I(() => {
3820
+ He == null || He(_.transcript);
3821
+ }, [_.transcript, He]), I(() => {
3822
+ Oe == null || Oe(_.agentState);
3823
+ }, [_.agentState, Oe]), I(() => {
3824
+ Mt.setThinking(_.agentState === "thinking");
3825
+ }, [_.agentState, Mt]);
3826
+ const mn = R(!1);
3819
3827
  I(() => {
3820
- !m || hn.current || ut && L.connectionState === "idle" && (hn.current = !0, L.connect());
3821
- }, [m, L.connectionState, L, ut]);
3822
- const mr = C(
3823
- (b) => {
3824
- const d = v == null ? void 0 : v.find((re) => re.id === b);
3825
- d && (et(!1), b !== Ue && (pt(!0), L.disconnect(), Ie || kt(b), y == null || y(d)));
3828
+ !g || mn.current || ut && _.connectionState === "idle" && (mn.current = !0, _.connect());
3829
+ }, [g, _.connectionState, _, ut]);
3830
+ const gr = L(
3831
+ (h) => {
3832
+ const u = b == null ? void 0 : b.find((Q) => Q.id === h);
3833
+ u && (et(!1), h !== Ue && (pt(!0), _.disconnect(), Ie || Ct(h), v == null || v(u)));
3826
3834
  },
3827
3835
  [
3828
- v,
3836
+ b,
3829
3837
  Ue,
3830
- L,
3838
+ _,
3831
3839
  Ie,
3832
- y
3840
+ v
3833
3841
  ]
3834
3842
  );
3835
3843
  I(() => {
3836
- Qe && L.connectionState === "connected" && pt(!1);
3837
- }, [L.connectionState, Qe]), I(() => {
3844
+ Qe && _.connectionState === "connected" && pt(!1);
3845
+ }, [_.connectionState, Qe]), I(() => {
3838
3846
  if (!ht) return;
3839
- const b = (d) => {
3840
- d.key === "Escape" && et(!1);
3847
+ const h = (u) => {
3848
+ u.key === "Escape" && et(!1);
3841
3849
  };
3842
- return window.addEventListener("keydown", b), () => window.removeEventListener("keydown", b);
3850
+ return window.addEventListener("keydown", h), () => window.removeEventListener("keydown", h);
3843
3851
  }, [ht]);
3844
- const gr = !!J || !!(ue != null && ue.avatarImageUrl) || L.isControlled, gt = Wr(St, o, gr);
3845
- Ye === void 0 && ((vn = gt.info) != null && vn.capabilities) && (Yt.current = gt.info.capabilities);
3846
- const Rt = (ue == null ? void 0 : ue.name) ?? le ?? ((bn = L.agentConfig) == null ? void 0 : bn.name) ?? ((wn = gt.info) == null ? void 0 : wn.name) ?? "Live Layer", Gt = (ue == null ? void 0 : ue.avatarImageUrl) ?? J ?? ((_n = L.agentConfig) == null ? void 0 : _n.avatarImageUrl) ?? ((xn = gt.info) == null ? void 0 : xn.avatarImageUrl) ?? null, yr = z ?? ((Ln = L.agentConfig) == null ? void 0 : Ln.idleLoopUrl) ?? ((Cn = gt.info) == null ? void 0 : Cn.idleLoopUrl) ?? null, vr = B ?? null, br = C(() => be("expanded"), [be]), wr = C(
3852
+ const yr = !!J || !!(ue != null && ue.avatarImageUrl) || _.isControlled, gt = qr(St, o, yr);
3853
+ Ye === void 0 && ((bn = gt.info) != null && bn.capabilities) && (Gt.current = gt.info.capabilities);
3854
+ const Pt = (ue == null ? void 0 : ue.name) ?? le ?? ((wn = _.agentConfig) == null ? void 0 : wn.name) ?? ((_n = gt.info) == null ? void 0 : _n.name) ?? "Live Layer", Xt = (ue == null ? void 0 : ue.avatarImageUrl) ?? J ?? ((xn = _.agentConfig) == null ? void 0 : xn.avatarImageUrl) ?? ((kn = gt.info) == null ? void 0 : kn.avatarImageUrl) ?? null, vr = z ?? ((Ln = _.agentConfig) == null ? void 0 : Ln.idleLoopUrl) ?? ((Cn = gt.info) == null ? void 0 : Cn.idleLoopUrl) ?? null, br = B ?? null, wr = L(() => be("expanded"), [be]), _r = L(
3847
3855
  () => be("minimized"),
3848
3856
  [be]
3849
- ), mn = C(() => {
3850
- L.disconnect(), be("hidden");
3851
- }, [L, be]), _r = C(() => {
3852
- const b = L.audioElement;
3853
- b && b.play().then(() => Se(!1)).catch(() => {
3857
+ ), gn = L(() => {
3858
+ _.disconnect(), be("hidden");
3859
+ }, [_, be]), xr = L(() => {
3860
+ const h = _.audioElement;
3861
+ h && h.play().then(() => Se(!1)).catch(() => {
3854
3862
  });
3855
- }, [L.audioElement]), xr = C(() => {
3856
- Se(!1), L.connect();
3857
- }, [L]), nt = {
3863
+ }, [_.audioElement]), kr = L(() => {
3864
+ Se(!1), _.connect();
3865
+ }, [_]), nt = {
3858
3866
  ...Ke,
3859
- ...de ? {} : { zIndex: ke }
3867
+ ...de ? {} : { zIndex: Ce }
3860
3868
  };
3861
3869
  H.primaryColor && (nt["--ll-color-primary"] = H.primaryColor), H.accentColor && (nt["--ll-color-accent"] = H.accentColor), H.backgroundColor && (nt["--ll-color-bg"] = H.backgroundColor), H.textColor && (nt["--ll-color-fg"] = H.textColor);
3862
3870
  const Lr = {
@@ -3872,33 +3880,33 @@ const _o = /* @__PURE__ */ new Set([
3872
3880
  qe
3873
3881
  ].filter(Boolean).join(" ");
3874
3882
  if (!ut) return null;
3875
- const kr = /* @__PURE__ */ r(
3883
+ const Sr = /* @__PURE__ */ r(
3876
3884
  "div",
3877
3885
  {
3878
3886
  className: Cr,
3879
3887
  style: Lr,
3880
3888
  "data-display-mode": pe,
3881
- "data-position": _,
3882
- "data-experience-mode": u === "EMBEDDED" ? "embedded" : "widget",
3889
+ "data-position": x,
3890
+ "data-experience-mode": d === "EMBEDDED" ? "embedded" : "widget",
3883
3891
  children: pe === "expanded" && /* @__PURE__ */ r(
3884
- Ni,
3892
+ Mi,
3885
3893
  {
3886
- position: _,
3894
+ position: x,
3887
3895
  isMobile: ve,
3888
- agentName: Rt,
3889
- avatarImageUrl: Gt,
3890
- idleLoopUrl: yr,
3891
- greeting: vr,
3896
+ agentName: Pt,
3897
+ avatarImageUrl: Xt,
3898
+ idleLoopUrl: vr,
3899
+ greeting: br,
3892
3900
  branding: H,
3893
- teamMembers: v,
3901
+ teamMembers: b,
3894
3902
  currentTeamMemberId: Ue,
3895
3903
  isSwitchingTeamMember: Qe,
3896
3904
  teamSwitcherOpen: ht,
3897
- onToggleTeamSwitcher: () => et((b) => !b),
3898
- onSelectTeamMember: mr,
3899
- connectionState: L.connectionState,
3900
- agentState: L.agentState,
3901
- transcript: L.transcript,
3905
+ onToggleTeamSwitcher: () => et((h) => !h),
3906
+ onSelectTeamMember: gr,
3907
+ connectionState: _.connectionState,
3908
+ agentState: _.agentState,
3909
+ transcript: _.transcript,
3902
3910
  isMuted: we.isMuted,
3903
3911
  micDevices: ft.mics,
3904
3912
  activeMicId: we.activeDeviceId,
@@ -3906,46 +3914,53 @@ const _o = /* @__PURE__ */ new Set([
3906
3914
  cameraPreviewEl: Ae.previewEl,
3907
3915
  cameraDevices: ft.cameras,
3908
3916
  activeCameraId: Ae.activeDeviceId,
3909
- isScreenShareEnabled: Re.isEnabled,
3910
- screenPreviewEl: Re.previewEl,
3911
- isSpeakerMuted: Wt,
3917
+ isScreenShareEnabled: Te.isEnabled,
3918
+ screenPreviewEl: Te.previewEl,
3919
+ isSpeakerMuted: qt,
3912
3920
  allowCamera: G,
3913
3921
  allowScreenShare: f,
3914
3922
  allowTyping: A,
3915
3923
  showMinimize: ve && !de ? !1 : Et,
3916
3924
  showClose: At,
3917
- chromeless: ee,
3925
+ chromeless: te,
3918
3926
  compactControls: Nt,
3919
3927
  transforming: ie,
3920
3928
  transformingLabel: U,
3921
- languageMenuOpen: x,
3922
- onToggleLanguageMenu: () => ae((b) => !b),
3923
- needsUserGesture: De,
3924
- canResume: L.canResume,
3929
+ languageMenuOpen: k,
3930
+ onToggleLanguageMenu: () => ae((h) => !h),
3931
+ needsUserGesture: Pe,
3932
+ canResume: _.canResume,
3925
3933
  micError: we.micError,
3926
- error: L.error,
3927
- avatarVideoContainerRef: pn,
3928
- agentVideoEl: L.videoElement,
3929
- onConnect: () => void L.connect(),
3930
- onDisconnect: () => L.disconnect(),
3931
- onRetry: xr,
3932
- onResumeAudio: _r,
3934
+ error: _.error,
3935
+ avatarVideoContainerRef: hn,
3936
+ agentVideoEl: _.videoElement,
3937
+ onConnect: () => {
3938
+ Promise.resolve(_.connect()).then(() => {
3939
+ var u;
3940
+ const h = (u = _.getRoom) == null ? void 0 : u.call(_);
3941
+ h != null && h.startAudio && h.canPlaybackAudio === !1 && h.startAudio().catch(() => {
3942
+ });
3943
+ });
3944
+ },
3945
+ onDisconnect: () => _.disconnect(),
3946
+ onRetry: kr,
3947
+ onResumeAudio: xr,
3933
3948
  onToggleMute: we.toggleMute,
3934
- onSwitchMicDevice: (b) => void we.switchDevice(b),
3949
+ onSwitchMicDevice: (h) => void we.switchDevice(h),
3935
3950
  onToggleCamera: () => void Ae.toggle(),
3936
- onSwitchCameraDevice: (b) => void Ae.switchDevice(b),
3937
- onToggleScreenShare: () => void Re.toggle(),
3938
- onToggleSpeaker: hr,
3939
- onSendMessage: pr,
3940
- onMinimize: wr,
3941
- onClose: mn,
3951
+ onSwitchCameraDevice: (h) => void Ae.switchDevice(h),
3952
+ onToggleScreenShare: () => void Te.toggle(),
3953
+ onToggleSpeaker: mr,
3954
+ onSendMessage: hr,
3955
+ onMinimize: _r,
3956
+ onClose: gn,
3942
3957
  onClearMicError: we.clearError,
3943
3958
  dragHandleProps: _e.dragHandleProps,
3944
3959
  resizeHandleProps: _e.resizeHandleProps
3945
3960
  }
3946
3961
  )
3947
3962
  }
3948
- ), gn = !de && (pe === "hidden" || pe === "minimized") ? /* @__PURE__ */ S(
3963
+ ), yn = !de && (pe === "hidden" || pe === "minimized") ? /* @__PURE__ */ S(
3949
3964
  "div",
3950
3965
  {
3951
3966
  className: [
@@ -3956,53 +3971,53 @@ const _o = /* @__PURE__ */ new Set([
3956
3971
  ].join(" "),
3957
3972
  style: nt,
3958
3973
  "data-display-mode": pe,
3959
- "data-position": _,
3974
+ "data-position": x,
3960
3975
  children: [
3961
3976
  pe === "hidden" && /* @__PURE__ */ r(
3962
- vi,
3977
+ bi,
3963
3978
  {
3964
- position: _,
3979
+ position: x,
3965
3980
  isMobile: ve,
3966
- isSpeaking: L.agentState === "speaking",
3981
+ isSpeaking: _.agentState === "speaking",
3967
3982
  onExpand: () => be("expanded"),
3968
- label: `Open ${Rt} widget`,
3969
- avatarImageUrl: Gt,
3970
- agentName: Rt,
3983
+ label: `Open ${Pt} widget`,
3984
+ avatarImageUrl: Xt,
3985
+ agentName: Pt,
3971
3986
  containerEl: W
3972
3987
  }
3973
3988
  ),
3974
3989
  pe === "minimized" && /* @__PURE__ */ r(
3975
- wi,
3990
+ _i,
3976
3991
  {
3977
- position: _,
3992
+ position: x,
3978
3993
  isMobile: ve,
3979
- agentName: Rt,
3980
- avatarImageUrl: Gt,
3981
- agentState: L.agentState,
3994
+ agentName: Pt,
3995
+ avatarImageUrl: Xt,
3996
+ agentState: _.agentState,
3982
3997
  isMuted: we.isMuted,
3983
- audioLevel: Te,
3984
- onExpand: br,
3998
+ audioLevel: Re,
3999
+ onExpand: wr,
3985
4000
  onToggleMute: we.toggleMute,
3986
- onClose: mn
4001
+ onClose: gn
3987
4002
  }
3988
4003
  )
3989
4004
  ]
3990
4005
  }
3991
- ) : null, yn = W ?? (typeof document < "u" ? document.body : null);
4006
+ ) : null, vn = W ?? (typeof document < "u" ? document.body : null);
3992
4007
  return /* @__PURE__ */ S(Ve, { children: [
3993
- kr,
3994
- gn && yn && on(gn, yn)
4008
+ Sr,
4009
+ yn && vn && ln(yn, vn)
3995
4010
  ] });
3996
4011
  }
3997
4012
  );
3998
- dr.displayName = "AvatarWidgetInner";
3999
- const xo = rn(
4013
+ fr.displayName = "AvatarWidgetInner";
4014
+ const ko = on(
4000
4015
  function(t, n) {
4001
- return /* @__PURE__ */ r(Rr, { children: /* @__PURE__ */ r(dr, { ...t, ref: n }) });
4016
+ return /* @__PURE__ */ r(Pr, { children: /* @__PURE__ */ r(fr, { ...t, ref: n }) });
4002
4017
  }
4003
4018
  );
4004
- xo.displayName = "AvatarWidget";
4005
- const Ro = ({
4019
+ ko.displayName = "AvatarWidget";
4020
+ const Po = ({
4006
4021
  agentId: e,
4007
4022
  baseUrl: t,
4008
4023
  apiKey: n,
@@ -4011,26 +4026,26 @@ const Ro = ({
4011
4026
  className: o,
4012
4027
  style: s
4013
4028
  }) => {
4014
- const a = T(null), c = T(null), u = T(l);
4015
- u.current = l;
4016
- const m = C((p) => {
4017
- var P;
4018
- const h = p.detail;
4019
- (P = u.current) == null || P.call(u, h);
4029
+ const a = R(null), c = R(null), d = R(l);
4030
+ d.current = l;
4031
+ const g = L((p) => {
4032
+ var D;
4033
+ const m = p.detail;
4034
+ (D = d.current) == null || D.call(d, m);
4020
4035
  }, []);
4021
4036
  return I(() => {
4022
4037
  const p = a.current;
4023
4038
  if (!p) return;
4024
- const h = document.createElement("livelayer-widget");
4025
- return h.setAttribute("agent-id", e), t && h.setAttribute("base-url", t), n && h.setAttribute("api-key", n), i && h.setAttribute("mode", i), h.addEventListener("agent-event", m), p.appendChild(h), c.current = h, () => {
4026
- h.removeEventListener("agent-event", m), p.removeChild(h), c.current = null;
4039
+ const m = document.createElement("livelayer-widget");
4040
+ return m.setAttribute("agent-id", e), t && m.setAttribute("base-url", t), n && m.setAttribute("api-key", n), i && m.setAttribute("mode", i), m.addEventListener("agent-event", g), p.appendChild(m), c.current = m, () => {
4041
+ m.removeEventListener("agent-event", g), p.removeChild(m), c.current = null;
4027
4042
  };
4028
4043
  }, [e]), I(() => {
4029
4044
  c.current && (i ? c.current.setAttribute("mode", i) : c.current.removeAttribute("mode"));
4030
4045
  }, [i]), /* @__PURE__ */ r("div", { ref: a, className: o, style: s });
4031
- }, Do = rn(
4046
+ }, Do = on(
4032
4047
  function({ id: t, intent: n, as: i = "div", className: l, style: o, children: s }, a) {
4033
- return Ar(
4048
+ return Nr(
4034
4049
  i,
4035
4050
  {
4036
4051
  ref: a,
@@ -4043,60 +4058,60 @@ const Ro = ({
4043
4058
  );
4044
4059
  }
4045
4060
  );
4046
- function Po(e = {}) {
4047
- const { onFieldUpdate: t, onComplete: n, source: i = "all" } = e, [l, o] = M({}), [s, a] = M(!1), [c, u] = M(null), m = T(t), p = T(n), h = T(i);
4061
+ function zo(e = {}) {
4062
+ const { onFieldUpdate: t, onComplete: n, source: i = "all" } = e, [l, o] = M({}), [s, a] = M(!1), [c, d] = M(null), g = R(t), p = R(n), m = R(i);
4048
4063
  I(() => {
4049
- m.current = t, p.current = n, h.current = i;
4064
+ g.current = t, p.current = n, m.current = i;
4050
4065
  }, [t, n, i]);
4051
- const P = C(() => {
4066
+ const D = L(() => {
4052
4067
  o({}), a(!1);
4053
4068
  }, []);
4054
4069
  return I(() => {
4055
4070
  if (typeof window > "u") return;
4056
- const _ = (k) => {
4057
- var w, D;
4058
- const g = k.detail;
4059
- if (g) {
4060
- if (g.phase === "field") {
4061
- if (h.current !== "all" && g.source !== h.current)
4071
+ const x = (C) => {
4072
+ var w, P;
4073
+ const y = C.detail;
4074
+ if (y) {
4075
+ if (y.phase === "field") {
4076
+ if (m.current !== "all" && y.source !== m.current)
4062
4077
  return;
4063
4078
  a(!0), o(
4064
- (E) => E[g.fieldName] === g.value ? E : { ...E, [g.fieldName]: g.value }
4079
+ (E) => E[y.fieldName] === y.value ? E : { ...E, [y.fieldName]: y.value }
4065
4080
  );
4066
4081
  try {
4067
- (w = m.current) == null || w.call(m, g);
4082
+ (w = g.current) == null || w.call(g, y);
4068
4083
  } catch (E) {
4069
4084
  console.warn("[LiveLayer] useCollect onFieldUpdate threw.", E);
4070
4085
  }
4071
4086
  return;
4072
4087
  }
4073
- if (g.phase === "complete") {
4074
- const E = g.result;
4075
- if (h.current !== "all" && E.source !== h.current)
4088
+ if (y.phase === "complete") {
4089
+ const E = y.result;
4090
+ if (m.current !== "all" && E.source !== m.current)
4076
4091
  return;
4077
- u(E), a(!1);
4092
+ d(E), a(!1);
4078
4093
  try {
4079
- (D = p.current) == null || D.call(p, E);
4080
- } catch (v) {
4081
- console.warn("[LiveLayer] useCollect onComplete threw.", v);
4094
+ (P = p.current) == null || P.call(p, E);
4095
+ } catch (b) {
4096
+ console.warn("[LiveLayer] useCollect onComplete threw.", b);
4082
4097
  }
4083
4098
  }
4084
4099
  }
4085
4100
  };
4086
- return document.addEventListener("ll-collected", _), () => document.removeEventListener("ll-collected", _);
4087
- }, []), { fields: l, isCollecting: s, lastResult: c, reset: P };
4101
+ return document.addEventListener("ll-collected", x), () => document.removeEventListener("ll-collected", x);
4102
+ }, []), { fields: l, isCollecting: s, lastResult: c, reset: D };
4088
4103
  }
4089
- let Zn = 1;
4090
- function zo({
4104
+ let Qn = 1;
4105
+ function $o({
4091
4106
  onMount: e,
4092
4107
  defaultOpen: t = !1,
4093
4108
  storageKey: n = "ll-debug-open"
4094
4109
  }) {
4095
- const [i, l] = M(t), [o, s] = M([]), [a, c] = M(""), [u, m] = M(!1), p = T(/* @__PURE__ */ new Set()), h = T([]), P = T(u);
4096
- P.current = u, I(() => {
4110
+ const [i, l] = M(t), [o, s] = M([]), [a, c] = M(""), [d, g] = M(!1), p = R(/* @__PURE__ */ new Set()), m = R([]), D = R(d);
4111
+ D.current = d, I(() => {
4097
4112
  try {
4098
- const g = localStorage.getItem(n);
4099
- g === "1" && l(!0), g === "0" && l(!1);
4113
+ const y = localStorage.getItem(n);
4114
+ y === "1" && l(!0), y === "0" && l(!1);
4100
4115
  } catch {
4101
4116
  }
4102
4117
  }, [n]), I(() => {
@@ -4105,48 +4120,48 @@ function zo({
4105
4120
  } catch {
4106
4121
  }
4107
4122
  }, [i, n]), I(() => {
4108
- const g = (w) => {
4109
- (w.metaKey || w.ctrlKey) && w.shiftKey && w.key.toLowerCase() === "l" && (w.preventDefault(), l((D) => !D));
4123
+ const y = (w) => {
4124
+ (w.metaKey || w.ctrlKey) && w.shiftKey && w.key.toLowerCase() === "l" && (w.preventDefault(), l((P) => !P));
4110
4125
  };
4111
- return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
4126
+ return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
4112
4127
  }, []), I(() => {
4113
- const g = setInterval(() => {
4114
- if (h.current.length === 0 || P.current) return;
4115
- const w = h.current.splice(0, h.current.length);
4128
+ const y = setInterval(() => {
4129
+ if (m.current.length === 0 || D.current) return;
4130
+ const w = m.current.splice(0, m.current.length);
4116
4131
  s(
4117
- (D) => [...w.reverse(), ...D].slice(0, 200)
4132
+ (P) => [...w.reverse(), ...P].slice(0, 200)
4118
4133
  );
4119
4134
  }, 100);
4120
- return () => clearInterval(g);
4135
+ return () => clearInterval(y);
4121
4136
  }, []);
4122
- const _ = T(!1);
4137
+ const x = R(!1);
4123
4138
  if (I(() => {
4124
- !e || _.current || (_.current = !0, e((g) => {
4125
- h.current.push({
4126
- id: Zn++,
4139
+ !e || x.current || (x.current = !0, e((y) => {
4140
+ m.current.push({
4141
+ id: Qn++,
4127
4142
  ts: Date.now(),
4128
4143
  kind: "event",
4129
- type: g.eventName,
4130
- data: g.data
4144
+ type: y.eventName,
4145
+ data: y.data
4131
4146
  });
4132
4147
  }));
4133
4148
  }, [e]), I(() => {
4134
- const g = console.warn, w = console.log, D = (E, v) => function(...O) {
4149
+ const y = console.warn, w = console.log, P = (E, b) => function(...O) {
4135
4150
  try {
4136
- const y = typeof O[0] == "string" ? O[0] : "";
4137
- y.startsWith("[LiveLayer]") && h.current.push({
4138
- id: Zn++,
4151
+ const v = typeof O[0] == "string" ? O[0] : "";
4152
+ v.startsWith("[LiveLayer]") && m.current.push({
4153
+ id: Qn++,
4139
4154
  ts: Date.now(),
4140
4155
  kind: E,
4141
- type: y.slice(0, 120),
4156
+ type: v.slice(0, 120),
4142
4157
  data: { args: O.slice(1).map((z) => Co(z)) }
4143
4158
  });
4144
4159
  } catch {
4145
4160
  }
4146
- return v.apply(this, O);
4161
+ return b.apply(this, O);
4147
4162
  };
4148
- return console.warn = D("warn", g), console.log = D("log", w), () => {
4149
- console.warn = g, console.log = w;
4163
+ return console.warn = P("warn", y), console.log = P("log", w), () => {
4164
+ console.warn = y, console.log = w;
4150
4165
  };
4151
4166
  }, []), !i)
4152
4167
  return /* @__PURE__ */ r(
@@ -4175,10 +4190,10 @@ function zo({
4175
4190
  children: "🛰 LL debug"
4176
4191
  }
4177
4192
  );
4178
- const k = o.filter((g) => {
4193
+ const C = o.filter((y) => {
4179
4194
  if (!a) return !0;
4180
4195
  const w = a.toLowerCase();
4181
- return g.type.toLowerCase().includes(w) || JSON.stringify(g.data || {}).toLowerCase().includes(w);
4196
+ return y.type.toLowerCase().includes(w) || JSON.stringify(y.data || {}).toLowerCase().includes(w);
4182
4197
  });
4183
4198
  return /* @__PURE__ */ S(
4184
4199
  "div",
@@ -4225,10 +4240,10 @@ function zo({
4225
4240
  "button",
4226
4241
  {
4227
4242
  type: "button",
4228
- onClick: () => m((g) => !g),
4229
- style: en(u ? "#f59e0b" : "transparent"),
4243
+ onClick: () => g((y) => !y),
4244
+ style: tn(d ? "#f59e0b" : "transparent"),
4230
4245
  title: "Pause / resume capture",
4231
- children: u ? "▶ resume" : "⏸ pause"
4246
+ children: d ? "▶ resume" : "⏸ pause"
4232
4247
  }
4233
4248
  ),
4234
4249
  /* @__PURE__ */ r(
@@ -4236,9 +4251,9 @@ function zo({
4236
4251
  {
4237
4252
  type: "button",
4238
4253
  onClick: () => {
4239
- s([]), h.current = [];
4254
+ s([]), m.current = [];
4240
4255
  },
4241
- style: en("transparent"),
4256
+ style: tn("transparent"),
4242
4257
  title: "Clear buffer",
4243
4258
  children: "clear"
4244
4259
  }
@@ -4248,7 +4263,7 @@ function zo({
4248
4263
  {
4249
4264
  type: "button",
4250
4265
  onClick: () => l(!1),
4251
- style: en("transparent"),
4266
+ style: tn("transparent"),
4252
4267
  "aria-label": "Close",
4253
4268
  title: "Close (Cmd/Ctrl + Shift + L)",
4254
4269
  children: "✕"
@@ -4262,7 +4277,7 @@ function zo({
4262
4277
  {
4263
4278
  type: "text",
4264
4279
  value: a,
4265
- onChange: (g) => c(g.target.value),
4280
+ onChange: (y) => c(y.target.value),
4266
4281
  placeholder: "filter by type or data…",
4267
4282
  style: {
4268
4283
  margin: 8,
@@ -4284,7 +4299,7 @@ function zo({
4284
4299
  overflowY: "auto",
4285
4300
  padding: "0 8px 8px"
4286
4301
  },
4287
- children: k.length === 0 ? /* @__PURE__ */ S(
4302
+ children: C.length === 0 ? /* @__PURE__ */ S(
4288
4303
  "div",
4289
4304
  {
4290
4305
  style: {
@@ -4314,16 +4329,16 @@ function zo({
4314
4329
  )
4315
4330
  ]
4316
4331
  }
4317
- ) : k.map((g) => /* @__PURE__ */ r(
4332
+ ) : C.map((y) => /* @__PURE__ */ r(
4318
4333
  Lo,
4319
4334
  {
4320
- entry: g,
4321
- expanded: p.current.has(g.id),
4335
+ entry: y,
4336
+ expanded: p.current.has(y.id),
4322
4337
  onToggle: () => {
4323
- p.current.has(g.id) ? p.current.delete(g.id) : p.current.add(g.id), s((w) => [...w]);
4338
+ p.current.has(y.id) ? p.current.delete(y.id) : p.current.add(y.id), s((w) => [...w]);
4324
4339
  }
4325
4340
  },
4326
- g.id
4341
+ y.id
4327
4342
  ))
4328
4343
  }
4329
4344
  )
@@ -4401,7 +4416,7 @@ function Lo({
4401
4416
  }
4402
4417
  );
4403
4418
  }
4404
- function en(e) {
4419
+ function tn(e) {
4405
4420
  return {
4406
4421
  background: e,
4407
4422
  color: "#fff",
@@ -4419,15 +4434,15 @@ function Co(e) {
4419
4434
  return String(e);
4420
4435
  }
4421
4436
  }
4422
- function ko(e) {
4437
+ function So(e) {
4423
4438
  const t = JSON.stringify(e);
4424
- I(() => Mr(e), [t]);
4439
+ I(() => Ir(e), [t]);
4425
4440
  }
4426
- function $o({ fields: e, children: t }) {
4427
- return ko(e), /* @__PURE__ */ r(Ve, { children: t });
4441
+ function Ho({ fields: e, children: t }) {
4442
+ return So(e), /* @__PURE__ */ r(Ve, { children: t });
4428
4443
  }
4429
- function Ho() {
4430
- const [e, t] = M([]), n = C((l) => {
4444
+ function Oo() {
4445
+ const [e, t] = M([]), n = L((l) => {
4431
4446
  t((o) => {
4432
4447
  const s = o.findIndex((a) => a.id === l.id);
4433
4448
  if (s >= 0) {
@@ -4436,7 +4451,7 @@ function Ho() {
4436
4451
  }
4437
4452
  return [...o, l];
4438
4453
  });
4439
- }, []), i = C(() => t([]), []);
4454
+ }, []), i = L(() => t([]), []);
4440
4455
  return {
4441
4456
  entries: e,
4442
4457
  pushSegment: n,
@@ -4445,38 +4460,38 @@ function Ho() {
4445
4460
  };
4446
4461
  }
4447
4462
  export {
4448
- xo as AvatarWidget,
4449
- Rr as ErrorBoundary,
4450
- $o as FieldProvider,
4451
- zo as LiveLayerDebugPanel,
4463
+ ko as AvatarWidget,
4464
+ Pr as ErrorBoundary,
4465
+ Ho as FieldProvider,
4466
+ $o as LiveLayerDebugPanel,
4452
4467
  Do as LiveLayerRegion,
4453
- Ro as LiveLayerWidget,
4454
- Bo as clearFieldRegistry,
4455
- to as clearPageContextCache,
4456
- ao as clearRoutesCache,
4457
- Qi as extractPageContext,
4458
- oo as extractRoutes,
4459
- Gn as getCachedPageContext,
4460
- Zt as getCachedRoutes,
4461
- Wo as getRegisteredFields,
4462
- si as matchesPattern,
4463
- ro as normalizeRouteInput,
4464
- qo as registerFields,
4465
- Uo as setFieldValue,
4466
- ci as shouldRenderAtPath,
4467
- Wr as useAgentInfo,
4468
- Pr as useAudioLevel,
4469
- Or as useCameraState,
4470
- Po as useCollect,
4471
- Ur as useDisplayMode,
4472
- Yr as useDisplayModePersistence,
4473
- Xr as useIsMobile,
4468
+ Po as LiveLayerWidget,
4469
+ Wo as clearFieldRegistry,
4470
+ no as clearPageContextCache,
4471
+ so as clearRoutesCache,
4472
+ eo as extractPageContext,
4473
+ lo as extractRoutes,
4474
+ Xn as getCachedPageContext,
4475
+ Qt as getCachedRoutes,
4476
+ qo as getRegisteredFields,
4477
+ ci as matchesPattern,
4478
+ io as normalizeRouteInput,
4479
+ Uo as registerFields,
4480
+ jo as setFieldValue,
4481
+ ui as shouldRenderAtPath,
4482
+ qr as useAgentInfo,
4483
+ zr as useAudioLevel,
4484
+ Fr as useCameraState,
4485
+ zo as useCollect,
4486
+ jr as useDisplayMode,
4487
+ Gr as useDisplayModePersistence,
4488
+ Kr as useIsMobile,
4474
4489
  Dr as useLiveKitSession,
4475
- Br as useMediaDevices,
4476
- $r as useMicrophoneState,
4477
- ri as usePathname,
4478
- ko as useRegisterFields,
4479
- ui as useRouteMatch,
4480
- Fr as useScreenShareState,
4481
- Ho as useTranscript
4490
+ Wr as useMediaDevices,
4491
+ Hr as useMicrophoneState,
4492
+ ii as usePathname,
4493
+ So as useRegisterFields,
4494
+ di as useRouteMatch,
4495
+ Br as useScreenShareState,
4496
+ Oo as useTranscript
4482
4497
  };