@livelayer/react 0.5.5 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -34,7 +34,7 @@ class mn extends dn {
34
34
  }
35
35
  }
36
36
  function gn(e) {
37
- const [t, r] = S("idle"), [o, i] = S("idle"), [l, s] = S([]), [d, u] = S(null), [m, h] = S(null), [a, c] = S(null), [R, C] = S(!1), [L, v] = S(null), b = E(null), z = E(e.onDataMessage);
37
+ const [t, r] = S("idle"), [o, i] = S("idle"), [l, s] = S([]), [d, f] = S(null), [g, m] = S(null), [a, c] = S(null), [R, C] = S(!1), [L, v] = S(null), b = E(null), z = E(e.onDataMessage);
38
38
  z.current = e.onDataMessage, T(() => {
39
39
  const N = {
40
40
  onConnectionStateChange: (D) => {
@@ -42,10 +42,10 @@ function gn(e) {
42
42
  },
43
43
  onAgentStateChange: i,
44
44
  onTranscript: (D) => s([...D]),
45
- onAgentConfig: u,
45
+ onAgentConfig: f,
46
46
  onAudioTrack: (D) => c(D),
47
- onVideoTrack: (D) => h(D),
48
- onVideoTrackRemoved: () => h(null),
47
+ onVideoTrack: (D) => m(D),
48
+ onVideoTrackRemoved: () => m(null),
49
49
  onError: (D) => v(D),
50
50
  onDataMessage: (D) => {
51
51
  var A;
@@ -62,7 +62,7 @@ function gn(e) {
62
62
  },
63
63
  N
64
64
  );
65
- return b.current = B, r("idle"), i("idle"), s([]), u(null), h(null), c(null), C(!1), v(null), () => {
65
+ return b.current = B, r("idle"), i("idle"), s([]), f(null), m(null), c(null), C(!1), v(null), () => {
66
66
  var D;
67
67
  (D = B.destroy) == null || D.call(B), b.current = null;
68
68
  };
@@ -93,7 +93,7 @@ function gn(e) {
93
93
  agentState: o,
94
94
  transcript: l,
95
95
  agentConfig: d,
96
- videoElement: m,
96
+ videoElement: g,
97
97
  audioElement: a,
98
98
  canResume: R,
99
99
  error: L,
@@ -129,7 +129,7 @@ function yn() {
129
129
  if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
130
130
  const a = new AudioContext(), c = a.createAnalyser();
131
131
  c.fftSize = 64, c.connect(a.destination), e.current = a, t.current = c;
132
- }, []), u = k(
132
+ }, []), f = k(
133
133
  (a) => {
134
134
  if (d(), !(!e.current || !t.current)) {
135
135
  if (r.current) {
@@ -150,7 +150,7 @@ function yn() {
150
150
  }
151
151
  },
152
152
  [d, s]
153
- ), m = k(() => {
153
+ ), g = k(() => {
154
154
  if (o.current !== null && (cancelAnimationFrame(o.current), o.current = null), r.current) {
155
155
  try {
156
156
  r.current.disconnect();
@@ -158,11 +158,11 @@ function yn() {
158
158
  }
159
159
  r.current = null;
160
160
  }
161
- }, []), h = k((a) => (i.current.add(a), () => {
161
+ }, []), m = k((a) => (i.current.add(a), () => {
162
162
  i.current.delete(a);
163
163
  }), []);
164
164
  return T(() => () => {
165
- if (m(), t.current) {
165
+ if (g(), t.current) {
166
166
  try {
167
167
  t.current.disconnect();
168
168
  } catch {
@@ -177,10 +177,10 @@ function yn() {
177
177
  e.current = null;
178
178
  }
179
179
  i.current.clear(), l.current = null;
180
- }, [m]), { attach: u, detach: m, subscribe: h };
180
+ }, [g]), { attach: f, detach: g, subscribe: m };
181
181
  }
182
182
  function vn() {
183
- const [e, t] = S(!1), [r, o] = S(null), i = E(null), l = E(null), s = k(async (h) => {
183
+ const [e, t] = S(!1), [r, o] = S(null), i = E(null), l = E(null), s = k(async (m) => {
184
184
  if (i.current && l.current) {
185
185
  try {
186
186
  await l.current.localParticipant.unpublishTrack(i.current);
@@ -188,46 +188,46 @@ function vn() {
188
188
  }
189
189
  i.current.stop(), i.current = null;
190
190
  }
191
- l.current = h, o(null);
191
+ l.current = m, o(null);
192
192
  try {
193
193
  const a = await pn({
194
194
  echoCancellation: !0,
195
195
  noiseSuppression: !0
196
196
  });
197
- await h.localParticipant.publishTrack(a), i.current = a, t(a.isMuted);
197
+ await m.localParticipant.publishTrack(a), i.current = a, t(a.isMuted);
198
198
  } catch (a) {
199
199
  const c = a instanceof Error && a.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
200
200
  throw o(c), a;
201
201
  }
202
202
  }, []), d = k(() => {
203
- const h = i.current;
204
- h && (h.isMuted ? (h.unmute(), t(!1)) : (h.mute(), t(!0)));
205
- }, []), u = k(() => {
206
- const h = i.current, a = l.current;
207
- if (h && a) {
203
+ const m = i.current;
204
+ m && (m.isMuted ? (m.unmute(), t(!1)) : (m.mute(), t(!0)));
205
+ }, []), f = k(() => {
206
+ const m = i.current, a = l.current;
207
+ if (m && a) {
208
208
  try {
209
- a.localParticipant.unpublishTrack(h);
209
+ a.localParticipant.unpublishTrack(m);
210
210
  } catch {
211
211
  }
212
- h.stop();
212
+ m.stop();
213
213
  }
214
214
  i.current = null, l.current = null, t(!1);
215
- }, []), m = k(() => o(null), []);
215
+ }, []), g = k(() => o(null), []);
216
216
  return {
217
217
  isMuted: e,
218
218
  micError: r,
219
219
  toggleMute: d,
220
220
  setupMic: s,
221
- teardownMic: u,
222
- clearError: m
221
+ teardownMic: f,
222
+ clearError: g
223
223
  };
224
224
  }
225
225
  const bn = { resolution: { width: 640, height: 480, frameRate: 24 } };
226
226
  function wn() {
227
- const [e, t] = S(!1), [r, o] = S(null), [i, l] = S(null), [s, d] = S(""), u = E(null), m = E(null), h = k((b) => {
228
- u.current = b;
227
+ const [e, t] = S(!1), [r, o] = S(null), [i, l] = S(null), [s, d] = S(""), f = E(null), g = E(null), m = k((b) => {
228
+ f.current = b;
229
229
  }, []), a = k(() => {
230
- const b = u.current, z = m.current;
230
+ const b = f.current, z = g.current;
231
231
  if (z && b) {
232
232
  const I = b.localParticipant.getTrackPublication(jt.Source.Camera);
233
233
  if (I != null && I.track) {
@@ -239,16 +239,16 @@ function wn() {
239
239
  } else
240
240
  z.stop();
241
241
  }
242
- m.current = null, l(null), t(!1);
242
+ g.current = null, l(null), t(!1);
243
243
  }, []), c = k(async (b) => {
244
- const z = u.current;
244
+ const z = f.current;
245
245
  if (z) {
246
246
  o(null);
247
247
  try {
248
248
  const I = { ...bn };
249
249
  b && (I.deviceId = b);
250
250
  const H = await hn(I);
251
- await z.localParticipant.publishTrack(H), m.current = H;
251
+ await z.localParticipant.publishTrack(H), g.current = H;
252
252
  const p = H.attach();
253
253
  l(p), t(!0), b && d(b);
254
254
  try {
@@ -268,10 +268,10 @@ function wn() {
268
268
  }, [e, s, a, c]), C = k(async (b) => {
269
269
  a(), await c(b);
270
270
  }, [a, c]), L = k(() => {
271
- a(), u.current = null, o(null), d("");
271
+ a(), f.current = null, o(null), d("");
272
272
  }, [a]), v = k(() => o(null), []);
273
273
  return T(() => () => {
274
- m.current && m.current.stop();
274
+ g.current && g.current.stop();
275
275
  }, []), {
276
276
  isEnabled: e,
277
277
  error: r,
@@ -279,7 +279,7 @@ function wn() {
279
279
  activeDeviceId: s,
280
280
  toggle: R,
281
281
  switchDevice: C,
282
- attachRoom: h,
282
+ attachRoom: m,
283
283
  teardown: L,
284
284
  clearError: v
285
285
  };
@@ -287,7 +287,7 @@ function wn() {
287
287
  function _n() {
288
288
  const [e, t] = S(!1), [r, o] = S(null), [i, l] = S(null), s = E(null), d = k((c) => {
289
289
  s.current = c;
290
- }, []), u = k(() => l(null), []), m = k(async () => {
290
+ }, []), f = k(() => l(null), []), g = k(async () => {
291
291
  const c = s.current;
292
292
  if (c) {
293
293
  if (e) {
@@ -295,7 +295,7 @@ function _n() {
295
295
  await c.localParticipant.setScreenShareEnabled(!1);
296
296
  } catch {
297
297
  }
298
- u(), t(!1);
298
+ f(), t(!1);
299
299
  return;
300
300
  }
301
301
  o(null);
@@ -324,16 +324,16 @@ function _n() {
324
324
  C !== "NotAllowedError" && C !== "AbortError" && o("Screen share unavailable. Try again."), t(!1);
325
325
  }
326
326
  }
327
- }, [e, u]), h = k(() => {
327
+ }, [e, f]), m = k(() => {
328
328
  const c = s.current;
329
329
  if (c && e)
330
330
  try {
331
331
  c.localParticipant.setScreenShareEnabled(!1);
332
332
  } catch {
333
333
  }
334
- u(), t(!1), o(null), s.current = null;
335
- }, [e, u]), a = k(() => o(null), []);
336
- return { isEnabled: e, error: r, previewEl: i, toggle: m, attachRoom: d, teardown: h, clearError: a };
334
+ f(), t(!1), o(null), s.current = null;
335
+ }, [e, f]), a = k(() => o(null), []);
336
+ return { isEnabled: e, error: r, previewEl: i, toggle: g, attachRoom: d, teardown: m, clearError: a };
337
337
  }
338
338
  function xn() {
339
339
  const [e, t] = S([]), [r, o] = S([]), i = k(async () => {
@@ -351,15 +351,15 @@ function xn() {
351
351
  }, [i]), { mics: e, cameras: r, refresh: i };
352
352
  }
353
353
  function kn(e, t, r = !1) {
354
- const [o, i] = S(null), [l, s] = S(null), [d, u] = S(!r && !!e);
354
+ const [o, i] = S(null), [l, s] = S(null), [d, f] = S(!r && !!e);
355
355
  return T(() => {
356
356
  if (r || !e) {
357
- u(!1);
357
+ f(!1);
358
358
  return;
359
359
  }
360
- const m = new AbortController(), h = t || "https://app.livelayer.studio";
361
- return u(!0), s(null), fetch(`${h}/api/widget/agent/${encodeURIComponent(e)}`, {
362
- signal: m.signal
360
+ const g = new AbortController(), m = t || "https://app.livelayer.studio";
361
+ return f(!0), s(null), fetch(`${m}/api/widget/agent/${encodeURIComponent(e)}`, {
362
+ signal: g.signal
363
363
  }).then(async (a) => {
364
364
  if (!a.ok) {
365
365
  const c = await a.json().catch(() => ({}));
@@ -367,10 +367,10 @@ function kn(e, t, r = !1) {
367
367
  }
368
368
  return a.json();
369
369
  }).then((a) => {
370
- m.signal.aborted || (i(a), u(!1));
370
+ g.signal.aborted || (i(a), f(!1));
371
371
  }).catch((a) => {
372
- m.signal.aborted || (s(a instanceof Error ? a.message : "Agent lookup failed"), u(!1));
373
- }), () => m.abort();
372
+ g.signal.aborted || (s(a instanceof Error ? a.message : "Agent lookup failed"), f(!1));
373
+ }), () => g.abort();
374
374
  }, [e, t, r]), { info: o, error: l, loading: d };
375
375
  }
376
376
  function Ln(e) {
@@ -394,8 +394,8 @@ function Cn({
394
394
  onChange: r
395
395
  } = {}) {
396
396
  const o = e !== void 0, [i, l] = S(t), s = o ? e : i, d = k(
397
- (u) => {
398
- u !== s && (o || l(u), r == null || r(u));
397
+ (f) => {
398
+ f !== s && (o || l(f), r == null || r(f));
399
399
  },
400
400
  [s, o, r]
401
401
  );
@@ -412,18 +412,18 @@ function An({
412
412
  persistKey: o = "ll-widget",
413
413
  disablePersistence: i = !1
414
414
  } = {}) {
415
- const l = `${o}:display-mode`, s = E(!1), [d, u] = Cn({
415
+ const l = `${o}:display-mode`, s = E(!1), [d, f] = Cn({
416
416
  value: e,
417
417
  defaultValue: t,
418
- onChange: (m) => {
419
- e === void 0 && !i && Sn(l, m), r == null || r(m);
418
+ onChange: (g) => {
419
+ e === void 0 && !i && Sn(l, g), r == null || r(g);
420
420
  }
421
421
  });
422
422
  return T(() => {
423
423
  if (s.current || (s.current = !0, i || e !== void 0)) return;
424
- const m = Nn(Ln(l));
425
- m && m !== d && u(m);
426
- }, []), [d, u];
424
+ const g = Nn(Ln(l));
425
+ g && g !== d && f(g);
426
+ }, []), [d, f];
427
427
  }
428
428
  const Rn = 640;
429
429
  function In(e = Rn) {
@@ -476,8 +476,8 @@ function Dn(e) {
476
476
  function $n(e) {
477
477
  const t = Rt.get(e);
478
478
  if (t) return t;
479
- const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, o = "", i = "", l = r.replace(/\*\*/g, o).replace(/\*/g, i), d = Dn(l).replace(new RegExp(`\\/${o}`, "g"), "(?:\\/.*)?").replace(new RegExp(o, "g"), ".*").replace(new RegExp(i, "g"), "[^/]+"), u = new RegExp(`^${d}\\/?$`);
480
- return Rt.set(e, u), u;
479
+ const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, o = "", i = "", l = r.replace(/\*\*/g, o).replace(/\*/g, i), d = Dn(l).replace(new RegExp(`\\/${o}`, "g"), "(?:\\/.*)?").replace(new RegExp(o, "g"), ".*").replace(new RegExp(i, "g"), "[^/]+"), f = new RegExp(`^${d}\\/?$`);
480
+ return Rt.set(e, f), f;
481
481
  }
482
482
  function zn(e, t) {
483
483
  const r = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
@@ -625,13 +625,13 @@ const Vn = ({
625
625
  avatarImageUrl: l,
626
626
  agentName: s
627
627
  }) => {
628
- const d = Fn(e), u = d === "right" ? "left" : "right", m = t ? 80 : 72, h = !!l, [a, c] = S(null), [R, C] = S(!1), L = E(null), v = E(!1), b = k(
628
+ const d = Fn(e), f = d === "right" ? "left" : "right", g = t ? 80 : 72, m = !!l, [a, c] = S(null), [R, C] = S(!1), L = E(null), v = E(!1), b = k(
629
629
  (A) => {
630
630
  if (typeof window > "u") return A;
631
- const O = m / 2, W = Dt + O, V = window.innerHeight - Dt - O;
632
- return V < W ? Math.max(W, A) : Math.max(W, Math.min(V, A));
631
+ const O = g / 2, W = Dt + O, Y = window.innerHeight - Dt - O;
632
+ return Y < W ? Math.max(W, A) : Math.max(W, Math.min(Y, A));
633
633
  },
634
- [m]
634
+ [g]
635
635
  );
636
636
  T(() => {
637
637
  const A = jn();
@@ -689,8 +689,8 @@ const Vn = ({
689
689
  const O = A.key === "ArrowUp" ? -8 : 8;
690
690
  c((W) => {
691
691
  if (W === null) return W;
692
- const V = b(W + O);
693
- return $t(V), V;
692
+ const Y = b(W + O);
693
+ return $t(Y), Y;
694
694
  });
695
695
  }
696
696
  },
@@ -701,8 +701,8 @@ const Vn = ({
701
701
  t ? "ll-hidden--mobile" : "ll-hidden--desktop",
702
702
  r ? "ll-hidden--speaking" : null,
703
703
  R ? "is-dragging" : null,
704
- h ? "ll-hidden--with-avatar" : null
705
- ].filter(Boolean).join(" "), D = a === null ? void 0 : { top: `${a - m / 2}px`, transform: "none" };
704
+ m ? "ll-hidden--with-avatar" : null
705
+ ].filter(Boolean).join(" "), D = a === null ? void 0 : { top: `${a - g / 2}px`, transform: "none" };
706
706
  return /* @__PURE__ */ n(
707
707
  "button",
708
708
  {
@@ -717,7 +717,7 @@ const Vn = ({
717
717
  "aria-label": i,
718
718
  "data-position": e,
719
719
  style: D,
720
- children: h ? (
720
+ children: m ? (
721
721
  // Layout: tiny chevron flush against the inward edge (peeks out
722
722
  // as the click affordance), then the circular avatar photo
723
723
  // taking the rest of the tab. Reinforces "this is an
@@ -726,7 +726,7 @@ const Vn = ({
726
726
  /* @__PURE__ */ n(
727
727
  Pt,
728
728
  {
729
- direction: u,
729
+ direction: f,
730
730
  className: "ll-hidden__chevron ll-hidden__chevron--mini"
731
731
  }
732
732
  ),
@@ -743,7 +743,7 @@ const Vn = ({
743
743
  ) : /* @__PURE__ */ n(
744
744
  Pt,
745
745
  {
746
- direction: u,
746
+ direction: f,
747
747
  className: "ll-hidden__chevron"
748
748
  }
749
749
  )
@@ -757,20 +757,20 @@ const Vn = ({
757
757
  className: i,
758
758
  barClassName: l
759
759
  }) => {
760
- const s = E(null), d = E([]), u = Ze(() => {
761
- const h = (Math.sqrt(5) - 1) / 2;
762
- return Array.from({ length: t }, (a, c) => 0.5 + c * h % 1 * 0.5);
760
+ const s = E(null), d = E([]), f = Ze(() => {
761
+ const m = (Math.sqrt(5) - 1) / 2;
762
+ return Array.from({ length: t }, (a, c) => 0.5 + c * m % 1 * 0.5);
763
763
  }, [t]);
764
764
  T(() => e.subscribe((a) => {
765
765
  for (let c = 0; c < t; c++) {
766
766
  const R = d.current[c];
767
767
  if (!R) continue;
768
- const C = Math.max(o, a * r * u[c]);
768
+ const C = Math.max(o, a * r * f[c]);
769
769
  R.style.height = `${C}px`;
770
770
  }
771
- }), [e, t, r, o, u]);
772
- const m = ["ll-waveform", i].filter(Boolean).join(" ");
773
- return /* @__PURE__ */ n("div", { ref: s, className: m, "aria-hidden": "true", children: Array.from({ length: t }, (h, a) => /* @__PURE__ */ n(
771
+ }), [e, t, r, o, f]);
772
+ const g = ["ll-waveform", i].filter(Boolean).join(" ");
773
+ return /* @__PURE__ */ n("div", { ref: s, className: g, "aria-hidden": "true", children: Array.from({ length: t }, (m, a) => /* @__PURE__ */ n(
774
774
  "div",
775
775
  {
776
776
  ref: (c) => {
@@ -781,7 +781,7 @@ const Vn = ({
781
781
  },
782
782
  a
783
783
  )) });
784
- }, Gn = ({
784
+ }, Jn = ({
785
785
  position: e,
786
786
  isMobile: t,
787
787
  agentName: r,
@@ -790,8 +790,8 @@ const Vn = ({
790
790
  isMuted: l,
791
791
  audioLevel: s,
792
792
  onExpand: d,
793
- onToggleMute: u,
794
- onClose: m
793
+ onToggleMute: f,
794
+ onClose: g
795
795
  }) => t ? /* @__PURE__ */ n(
796
796
  "div",
797
797
  {
@@ -834,11 +834,11 @@ const Vn = ({
834
834
  className: "ll-minimized__btn",
835
835
  role: "button",
836
836
  tabIndex: 0,
837
- onClick: (h) => {
838
- h.stopPropagation(), u();
837
+ onClick: (m) => {
838
+ m.stopPropagation(), f();
839
839
  },
840
- onKeyDown: (h) => {
841
- (h.key === "Enter" || h.key === " ") && (h.stopPropagation(), h.preventDefault(), u());
840
+ onKeyDown: (m) => {
841
+ (m.key === "Enter" || m.key === " ") && (m.stopPropagation(), m.preventDefault(), f());
842
842
  },
843
843
  "aria-label": l ? "Unmute microphone" : "Mute microphone",
844
844
  children: /* @__PURE__ */ n(Mt, { muted: l, className: "ll-minimized__icon" })
@@ -879,7 +879,7 @@ const Vn = ({
879
879
  {
880
880
  type: "button",
881
881
  className: "ll-minimized__btn",
882
- onClick: u,
882
+ onClick: f,
883
883
  "aria-label": l ? "Unmute microphone" : "Mute microphone",
884
884
  children: /* @__PURE__ */ n(Mt, { muted: l, className: "ll-minimized__icon" })
885
885
  }
@@ -899,7 +899,7 @@ const Vn = ({
899
899
  {
900
900
  type: "button",
901
901
  className: "ll-minimized__btn ll-minimized__btn--close",
902
- onClick: m,
902
+ onClick: g,
903
903
  "aria-label": "Close widget",
904
904
  children: /* @__PURE__ */ n(Bn, { className: "ll-minimized__icon" })
905
905
  }
@@ -907,7 +907,7 @@ const Vn = ({
907
907
  ] })
908
908
  ] })
909
909
  }
910
- ), Jn = ({
910
+ ), Gn = ({
911
911
  src: e,
912
912
  alt: t,
913
913
  preCannedPlaying: r = !1,
@@ -918,7 +918,7 @@ const Vn = ({
918
918
  if (T(() => {
919
919
  d.current !== e && (d.current = e, s(!1));
920
920
  }, [e]), !e) return null;
921
- const u = {
921
+ const f = {
922
922
  position: "absolute",
923
923
  inset: 0,
924
924
  width: "100%",
@@ -938,9 +938,9 @@ const Vn = ({
938
938
  src: e,
939
939
  alt: t,
940
940
  className: o,
941
- style: u,
941
+ style: f,
942
942
  loading: "eager",
943
- fetchpriority: "high",
943
+ fetchPriority: "high",
944
944
  onLoad: () => s(!0)
945
945
  }
946
946
  )
@@ -954,9 +954,9 @@ const Vn = ({
954
954
  greeting: l,
955
955
  branding: s,
956
956
  teamMembers: d,
957
- currentTeamMemberId: u,
958
- isSwitchingTeamMember: m,
959
- teamSwitcherOpen: h,
957
+ currentTeamMemberId: f,
958
+ isSwitchingTeamMember: g,
959
+ teamSwitcherOpen: m,
960
960
  onToggleTeamSwitcher: a,
961
961
  onSelectTeamMember: c,
962
962
  languageMenuOpen: R,
@@ -974,81 +974,81 @@ const Vn = ({
974
974
  cameraPreviewEl: A,
975
975
  cameraDevices: O,
976
976
  activeCameraId: W,
977
- isScreenShareEnabled: V,
977
+ isScreenShareEnabled: Y,
978
978
  screenPreviewEl: te,
979
979
  isSpeakerMuted: ue,
980
- allowCamera: He,
981
- allowScreenShare: Oe,
982
- allowTyping: qe,
983
- avatarVideoContainerRef: Be,
984
- onConnect: me,
985
- onDisconnect: ge,
986
- onRetry: ye,
987
- onResumeAudio: ve,
988
- onToggleMute: be,
989
- onToggleCamera: we,
990
- onSwitchCameraDevice: _e,
991
- onToggleScreenShare: xe,
992
- onToggleSpeaker: j,
993
- onSendMessage: We,
994
- onMinimize: Fe,
995
- onClose: Ue,
996
- onClearMicError: je
980
+ allowCamera: qe,
981
+ allowScreenShare: Be,
982
+ allowTyping: We,
983
+ avatarVideoContainerRef: Fe,
984
+ onConnect: ge,
985
+ onDisconnect: ye,
986
+ onRetry: ve,
987
+ onResumeAudio: be,
988
+ onToggleMute: we,
989
+ onToggleCamera: _e,
990
+ onSwitchCameraDevice: xe,
991
+ onToggleScreenShare: ke,
992
+ onToggleSpeaker: V,
993
+ onSendMessage: Ue,
994
+ onMinimize: je,
995
+ onClose: Ve,
996
+ onClearMicError: fe
997
997
  }) => {
998
- var Se;
999
- const ae = b.length > 0 ? b[b.length - 1] : null, ie = ((d == null ? void 0 : d.length) ?? 0) > 1, ke = L === "connecting" || L === "connected", Le = L === "connected", fe = L === "idle" || L === "disconnected" || L === "error", J = E(null), Re = E(null);
998
+ var Ce;
999
+ const ae = b.length > 0 ? b[b.length - 1] : null, ie = ((d == null ? void 0 : d.length) ?? 0) > 1, Le = L === "connecting" || L === "connected", Se = L === "connected", pe = L === "idle" || L === "disconnected" || L === "error", K = E(null), Me = E(null);
1000
1000
  T(() => {
1001
- const y = J.current;
1001
+ const y = K.current;
1002
1002
  y && (y.innerHTML = "", A && (A.style.width = "100%", A.style.height = "100%", A.style.objectFit = "cover", A.style.transform = "scaleX(-1)", y.appendChild(A)));
1003
1003
  }, [A]), T(() => {
1004
- const y = Re.current;
1004
+ const y = Me.current;
1005
1005
  y && (y.innerHTML = "", te && (te.style.width = "100%", te.style.height = "100%", te.style.objectFit = "contain", y.appendChild(te)));
1006
1006
  }, [te]);
1007
1007
  const [ne, ee] = S(!1), [le, ce] = S(!1);
1008
1008
  T(() => {
1009
- if (!ne && !le && !R && !h) return;
1009
+ if (!ne && !le && !R && !m) return;
1010
1010
  const y = () => {
1011
- ee(!1), ce(!1), R && C(), h && a();
1011
+ ee(!1), ce(!1), R && C(), m && a();
1012
1012
  };
1013
1013
  return document.addEventListener("click", y), () => document.removeEventListener("click", y);
1014
1014
  }, [
1015
1015
  ne,
1016
1016
  le,
1017
1017
  R,
1018
- h,
1018
+ m,
1019
1019
  C,
1020
1020
  a
1021
1021
  ]);
1022
- const [Q, re] = S(""), pe = k(
1022
+ const [Z, re] = S(""), he = k(
1023
1023
  (y) => {
1024
1024
  y.preventDefault();
1025
- const K = Q.trim();
1026
- K && (We(K), re(""));
1025
+ const X = Z.trim();
1026
+ X && (Ue(X), re(""));
1027
1027
  },
1028
- [Q, We]
1029
- ), Ie = s.productName || "Live Layer", Ve = Le && (ae != null && ae.text) ? ae.text : l || "", Me = [
1028
+ [Z, Ue]
1029
+ ), Te = s.productName || "Live Layer", Ye = Se && (ae != null && ae.text) ? ae.text : l || "", Pe = [
1030
1030
  "ll-expanded",
1031
1031
  t ? "ll-expanded--mobile" : "ll-expanded--desktop"
1032
1032
  ].join(" ");
1033
1033
  return /* @__PURE__ */ w(
1034
1034
  "div",
1035
1035
  {
1036
- className: Me,
1036
+ className: Pe,
1037
1037
  "data-position": e,
1038
- "data-state": Le ? "connected" : ke ? "connecting" : "idle",
1038
+ "data-state": Se ? "connected" : Le ? "connecting" : "idle",
1039
1039
  role: "dialog",
1040
1040
  "aria-label": `${r} widget`,
1041
1041
  children: [
1042
1042
  /* @__PURE__ */ w("div", { className: "ll-expanded__bg", children: [
1043
1043
  o ? /* @__PURE__ */ n(
1044
- Jn,
1044
+ Gn,
1045
1045
  {
1046
1046
  src: o,
1047
1047
  alt: r,
1048
1048
  className: "ll-expanded__bg-img"
1049
1049
  }
1050
- ) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Se = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Se.toUpperCase()) || "A" }) }),
1051
- i && !Le && /* @__PURE__ */ n(
1050
+ ) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Ce = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Ce.toUpperCase()) || "A" }) }),
1051
+ i && !Se && /* @__PURE__ */ n(
1052
1052
  "video",
1053
1053
  {
1054
1054
  className: "ll-expanded__bg-idle",
@@ -1060,24 +1060,24 @@ const Vn = ({
1060
1060
  }
1061
1061
  )
1062
1062
  ] }),
1063
- /* @__PURE__ */ n("div", { ref: Be, className: "ll-expanded__video" }),
1063
+ /* @__PURE__ */ n("div", { ref: Fe, className: "ll-expanded__video" }),
1064
1064
  L === "connecting" && /* @__PURE__ */ w("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1065
1065
  /* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
1066
- /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: m ? "Switching..." : "Connecting..." })
1066
+ /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: g ? "Switching..." : "Connecting..." })
1067
1067
  ] }),
1068
- I && Le && /* @__PURE__ */ w(
1068
+ I && Se && /* @__PURE__ */ w(
1069
1069
  "button",
1070
1070
  {
1071
1071
  type: "button",
1072
1072
  className: "ll-expanded__overlay ll-expanded__overlay--gesture",
1073
- onClick: ve,
1073
+ onClick: be,
1074
1074
  children: [
1075
1075
  /* @__PURE__ */ n("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("path", { d: "M3 9v6h4l5 5V4L7 9H3zm13.54.12a5 5 0 0 1 0 5.76l-1.41-1.41a3 3 0 0 0 0-2.94L16.54 9.12z" }) }),
1076
1076
  /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
1077
1077
  ]
1078
1078
  }
1079
1079
  ),
1080
- ke ? /* @__PURE__ */ w("div", { className: "ll-expanded__topbar", children: [
1080
+ Le ? /* @__PURE__ */ w("div", { className: "ll-expanded__topbar", children: [
1081
1081
  /* @__PURE__ */ w("div", { className: "ll-expanded__topbar-left", children: [
1082
1082
  /* @__PURE__ */ w("div", { className: "ll-expanded__pill-wrap", children: [
1083
1083
  /* @__PURE__ */ w(
@@ -1089,14 +1089,14 @@ const Vn = ({
1089
1089
  ie && (y.stopPropagation(), a());
1090
1090
  },
1091
1091
  "aria-haspopup": ie ? "listbox" : void 0,
1092
- "aria-expanded": ie ? h : void 0,
1092
+ "aria-expanded": ie ? m : void 0,
1093
1093
  children: [
1094
1094
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
1095
1095
  ie && /* @__PURE__ */ n(Xe, {})
1096
1096
  ]
1097
1097
  }
1098
1098
  ),
1099
- ie && h && /* @__PURE__ */ n(
1099
+ ie && m && /* @__PURE__ */ n(
1100
1100
  "div",
1101
1101
  {
1102
1102
  className: "ll-hmenu",
@@ -1106,10 +1106,10 @@ const Vn = ({
1106
1106
  "button",
1107
1107
  {
1108
1108
  type: "button",
1109
- className: `ll-hmenu__item ${y.id === u ? "is-active" : ""}`,
1109
+ className: `ll-hmenu__item ${y.id === f ? "is-active" : ""}`,
1110
1110
  onClick: () => c(y.id),
1111
1111
  role: "option",
1112
- "aria-selected": y.id === u,
1112
+ "aria-selected": y.id === f,
1113
1113
  children: [
1114
1114
  y.avatarImageUrl && /* @__PURE__ */ n(
1115
1115
  "img",
@@ -1180,7 +1180,7 @@ const Vn = ({
1180
1180
  {
1181
1181
  type: "button",
1182
1182
  className: "ll-hbtn",
1183
- onClick: Fe,
1183
+ onClick: je,
1184
1184
  "aria-label": "Minimize widget",
1185
1185
  title: "Minimize",
1186
1186
  children: /* @__PURE__ */ n(Ht, {})
@@ -1191,7 +1191,7 @@ const Vn = ({
1191
1191
  {
1192
1192
  type: "button",
1193
1193
  className: "ll-hbtn ll-hbtn--danger",
1194
- onClick: Ue,
1194
+ onClick: Ve,
1195
1195
  "aria-label": "End call",
1196
1196
  title: "End call",
1197
1197
  children: /* @__PURE__ */ n(zt, {})
@@ -1201,14 +1201,14 @@ const Vn = ({
1201
1201
  ] }) : (
1202
1202
  // Idle-state header with Live Layer product name + minimize/close
1203
1203
  /* @__PURE__ */ w("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
1204
- /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Ie }),
1204
+ /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Te }),
1205
1205
  /* @__PURE__ */ w("div", { className: "ll-expanded__header-actions", children: [
1206
1206
  /* @__PURE__ */ n(
1207
1207
  "button",
1208
1208
  {
1209
1209
  type: "button",
1210
1210
  className: "ll-hbtn ll-hbtn--ghost",
1211
- onClick: Fe,
1211
+ onClick: je,
1212
1212
  "aria-label": "Minimize widget",
1213
1213
  children: /* @__PURE__ */ n(Ht, {})
1214
1214
  }
@@ -1218,7 +1218,7 @@ const Vn = ({
1218
1218
  {
1219
1219
  type: "button",
1220
1220
  className: "ll-hbtn ll-hbtn--danger",
1221
- onClick: Ue,
1221
+ onClick: Ve,
1222
1222
  "aria-label": "Close widget",
1223
1223
  children: /* @__PURE__ */ n(zt, {})
1224
1224
  }
@@ -1226,15 +1226,15 @@ const Vn = ({
1226
1226
  ] })
1227
1227
  ] })
1228
1228
  ),
1229
- fe && /* @__PURE__ */ (() => {
1230
- const y = z ? "Restart paused session" : L === "disconnected" ? "Reconnect to agent" : "Start video call", K = z ? "Pick up where you left off" : null;
1229
+ pe && /* @__PURE__ */ (() => {
1230
+ const y = z ? "Restart paused session" : L === "disconnected" ? "Reconnect to agent" : "Start video call", X = z ? "Pick up where you left off" : null;
1231
1231
  return /* @__PURE__ */ w(ut, { children: [
1232
1232
  L === "idle" && !z && !H && /* @__PURE__ */ w(
1233
1233
  "button",
1234
1234
  {
1235
1235
  type: "button",
1236
1236
  className: "ll-expanded__play",
1237
- onClick: me,
1237
+ onClick: ge,
1238
1238
  "aria-label": y,
1239
1239
  children: [
1240
1240
  /* @__PURE__ */ n("div", { className: "ll-expanded__play-circle", children: /* @__PURE__ */ n("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("polygon", { points: "6 3 20 12 6 21 6 3" }) }) }),
@@ -1244,13 +1244,13 @@ const Vn = ({
1244
1244
  ),
1245
1245
  /* @__PURE__ */ w("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
1246
1246
  l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
1247
- K && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: K }),
1247
+ X && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: X }),
1248
1248
  /* @__PURE__ */ n(
1249
1249
  "button",
1250
1250
  {
1251
1251
  type: "button",
1252
1252
  className: "ll-expanded__cta",
1253
- onClick: me,
1253
+ onClick: ge,
1254
1254
  "aria-label": y,
1255
1255
  children: y
1256
1256
  }
@@ -1261,46 +1261,46 @@ const Vn = ({
1261
1261
  /* @__PURE__ */ w(
1262
1262
  "div",
1263
1263
  {
1264
- className: `ll-expanded__pip ${ke && (D || V) ? "is-visible" : ""}`,
1264
+ className: `ll-expanded__pip ${Le && (D || Y) ? "is-visible" : ""}`,
1265
1265
  children: [
1266
1266
  /* @__PURE__ */ n(
1267
1267
  "div",
1268
1268
  {
1269
- ref: Re,
1270
- className: V ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1269
+ ref: Me,
1270
+ className: Y ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1271
1271
  }
1272
1272
  ),
1273
1273
  /* @__PURE__ */ n(
1274
1274
  "div",
1275
1275
  {
1276
- ref: J,
1277
- className: !V && D ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1276
+ ref: K,
1277
+ className: !Y && D ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1278
1278
  }
1279
1279
  )
1280
1280
  ]
1281
1281
  }
1282
1282
  ),
1283
- ke ? /* @__PURE__ */ w("div", { className: "ll-expanded__bottom", children: [
1284
- Ve && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Ve }) }),
1283
+ Le ? /* @__PURE__ */ w("div", { className: "ll-expanded__bottom", children: [
1284
+ Ye && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Ye }) }),
1285
1285
  /* @__PURE__ */ w("div", { className: "ll-toolbar", onClick: (y) => y.stopPropagation(), children: [
1286
- Oe && /* @__PURE__ */ n(
1286
+ Be && /* @__PURE__ */ n(
1287
1287
  "button",
1288
1288
  {
1289
1289
  type: "button",
1290
- className: `ll-tool ${V ? "is-on" : ""}`,
1291
- onClick: xe,
1292
- "aria-label": V ? "Stop sharing screen" : "Share screen",
1293
- title: V ? "Stop sharing" : "Share screen",
1290
+ className: `ll-tool ${Y ? "is-on" : ""}`,
1291
+ onClick: ke,
1292
+ "aria-label": Y ? "Stop sharing screen" : "Share screen",
1293
+ title: Y ? "Stop sharing" : "Share screen",
1294
1294
  children: /* @__PURE__ */ n(Xn, {})
1295
1295
  }
1296
1296
  ),
1297
- He && /* @__PURE__ */ w("div", { className: "ll-tool-split", children: [
1297
+ qe && /* @__PURE__ */ w("div", { className: "ll-tool-split", children: [
1298
1298
  /* @__PURE__ */ n(
1299
1299
  "button",
1300
1300
  {
1301
1301
  type: "button",
1302
1302
  className: `ll-tool ll-tool--left ${D ? "is-on" : ""}`,
1303
- onClick: we,
1303
+ onClick: _e,
1304
1304
  "aria-label": D ? "Turn off camera" : "Turn on camera",
1305
1305
  title: D ? "Stop camera" : "Start camera",
1306
1306
  children: /* @__PURE__ */ n(Qn, {})
@@ -1312,7 +1312,7 @@ const Vn = ({
1312
1312
  type: "button",
1313
1313
  className: `ll-tool ll-tool--right ${D ? "is-on" : ""}`,
1314
1314
  onClick: (y) => {
1315
- y.stopPropagation(), ce((K) => !K), ee(!1);
1315
+ y.stopPropagation(), ce((X) => !X), ee(!1);
1316
1316
  },
1317
1317
  "aria-label": "Camera devices",
1318
1318
  "aria-haspopup": "listbox",
@@ -1327,7 +1327,7 @@ const Vn = ({
1327
1327
  devices: O,
1328
1328
  activeId: W,
1329
1329
  onPick: (y) => {
1330
- ce(!1), _e(y);
1330
+ ce(!1), xe(y);
1331
1331
  }
1332
1332
  }
1333
1333
  )
@@ -1338,7 +1338,7 @@ const Vn = ({
1338
1338
  {
1339
1339
  type: "button",
1340
1340
  className: `ll-tool ll-tool--left ${p ? "is-muted" : ""}`,
1341
- onClick: be,
1341
+ onClick: we,
1342
1342
  "aria-label": p ? "Unmute microphone" : "Mute microphone",
1343
1343
  title: p ? "Unmute" : "Mute",
1344
1344
  children: /* @__PURE__ */ n(Zn, { muted: p })
@@ -1350,7 +1350,7 @@ const Vn = ({
1350
1350
  type: "button",
1351
1351
  className: `ll-tool ll-tool--right ${p ? "is-muted" : ""}`,
1352
1352
  onClick: (y) => {
1353
- y.stopPropagation(), ee((K) => !K), ce(!1);
1353
+ y.stopPropagation(), ee((X) => !X), ce(!1);
1354
1354
  },
1355
1355
  "aria-label": "Microphone devices",
1356
1356
  "aria-haspopup": "listbox",
@@ -1373,26 +1373,26 @@ const Vn = ({
1373
1373
  {
1374
1374
  type: "button",
1375
1375
  className: `ll-tool ${ue ? "is-muted" : ""}`,
1376
- onClick: j,
1376
+ onClick: V,
1377
1377
  "aria-label": ue ? "Unmute speaker" : "Mute speaker",
1378
1378
  title: ue ? "Unmute speaker" : "Mute speaker",
1379
1379
  children: /* @__PURE__ */ n(er, { muted: ue })
1380
1380
  }
1381
1381
  )
1382
1382
  ] }),
1383
- qe && /* @__PURE__ */ w("form", { className: "ll-message-input", onSubmit: pe, children: [
1383
+ We && /* @__PURE__ */ w("form", { className: "ll-message-input", onSubmit: he, children: [
1384
1384
  /* @__PURE__ */ n(
1385
1385
  "input",
1386
1386
  {
1387
1387
  type: "text",
1388
1388
  className: "ll-message-input__field",
1389
1389
  placeholder: "Message...",
1390
- value: Q,
1390
+ value: Z,
1391
1391
  onChange: (y) => re(y.target.value),
1392
1392
  "aria-label": "Message the agent"
1393
1393
  }
1394
1394
  ),
1395
- Q.trim() && /* @__PURE__ */ n(
1395
+ Z.trim() && /* @__PURE__ */ n(
1396
1396
  "button",
1397
1397
  {
1398
1398
  type: "submit",
@@ -1407,7 +1407,7 @@ const Vn = ({
1407
1407
  {
1408
1408
  type: "button",
1409
1409
  className: "ll-expanded__end",
1410
- onClick: ge,
1410
+ onClick: ye,
1411
1411
  children: "End conversation"
1412
1412
  }
1413
1413
  )
@@ -1421,14 +1421,14 @@ const Vn = ({
1421
1421
  {
1422
1422
  type: "button",
1423
1423
  className: "ll-expanded__banner-x",
1424
- onClick: je,
1424
+ onClick: fe,
1425
1425
  "aria-label": "Dismiss",
1426
1426
  children: "×"
1427
1427
  }
1428
1428
  )
1429
1429
  ] });
1430
1430
  if (!H || L !== "error") return null;
1431
- let y = "Failed to connect", K = "Try again";
1431
+ let y = "Failed to connect", X = "Try again";
1432
1432
  return H === "MIC_PERMISSION_DENIED" ? y = "Microphone blocked. Allow access to talk." : H === "MIC_NOT_FOUND" ? y = "No microphone found. Plug one in + retry." : H === "MIC_UNAVAILABLE" ? y = "Mic unavailable. Check other apps using it." : H === "AGENT_TIMEOUT" ? y = "Agent didn't pick up. Try again." : H === "CONNECT_FAILED" ? y = "Connection failed. Check your network." : H.length < 80 && (y = H), /* @__PURE__ */ w("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1433
1433
  /* @__PURE__ */ n("span", { children: y }),
1434
1434
  /* @__PURE__ */ n(
@@ -1436,8 +1436,8 @@ const Vn = ({
1436
1436
  {
1437
1437
  type: "button",
1438
1438
  className: "ll-expanded__banner-retry",
1439
- onClick: ye,
1440
- children: K
1439
+ onClick: ve,
1440
+ children: X
1441
1441
  }
1442
1442
  )
1443
1443
  ] });
@@ -1552,7 +1552,7 @@ const Qe = 4096, rr = 20, or = 20, ir = 10, lr = 10, ar = 30, qt = 500, cr = [
1552
1552
  "noscript",
1553
1553
  "iframe"
1554
1554
  ];
1555
- function $e(e) {
1555
+ function He(e) {
1556
1556
  if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
1557
1557
  let t = e;
1558
1558
  for (; t; ) {
@@ -1562,7 +1562,7 @@ function $e(e) {
1562
1562
  }
1563
1563
  return !1;
1564
1564
  }
1565
- function ze(e) {
1565
+ function Oe(e) {
1566
1566
  if (typeof window > "u") return !0;
1567
1567
  const t = e.getBoundingClientRect();
1568
1568
  if (t.width <= 0 || t.height <= 0) return !1;
@@ -1582,10 +1582,10 @@ function Bt(e) {
1582
1582
  const i = e.closest("label");
1583
1583
  return i != null && i.textContent ? i.textContent.trim() : "";
1584
1584
  }
1585
- function he(e, t) {
1585
+ function me(e, t) {
1586
1586
  return e.length <= t ? e : e.slice(0, t - 1) + "…";
1587
1587
  }
1588
- function Ee(e) {
1588
+ function Ae(e) {
1589
1589
  return e.length;
1590
1590
  }
1591
1591
  function sr(e, t = {}) {
@@ -1607,34 +1607,34 @@ function sr(e, t = {}) {
1607
1607
  ), d = [];
1608
1608
  for (const p of s) {
1609
1609
  if (d.length >= ir) break;
1610
- if ($e(p) || !ze(p)) continue;
1611
- const N = p.getAttribute("data-ll-region") ?? "", B = p.getAttribute("data-ll-intent") ?? void 0, D = he(
1610
+ if (He(p) || !Oe(p)) continue;
1611
+ const N = p.getAttribute("data-ll-region") ?? "", B = p.getAttribute("data-ll-intent") ?? void 0, D = me(
1612
1612
  (p.innerText || p.textContent || "").trim(),
1613
1613
  qt * 2
1614
1614
  );
1615
1615
  !N || !D || d.push({ id: N, intent: B, text: D });
1616
1616
  }
1617
- const u = [], m = ["H1", "H2", "H3", "H4", "H5", "H6"], h = Array.from(
1617
+ const f = [], g = ["H1", "H2", "H3", "H4", "H5", "H6"], m = Array.from(
1618
1618
  r.querySelectorAll("h1, h2, h3, h4, h5, h6")
1619
1619
  );
1620
- for (const p of h) {
1621
- if ($e(p) || !ze(p)) continue;
1620
+ for (const p of m) {
1621
+ if (He(p) || !Oe(p)) continue;
1622
1622
  const N = (p.textContent || "").trim();
1623
- N && u.push(`${p.tagName}: ${he(N, 200)}`);
1623
+ N && f.push(`${p.tagName}: ${me(N, 200)}`);
1624
1624
  }
1625
1625
  const a = Array.from(r.querySelectorAll("p, li"));
1626
1626
  for (const p of a) {
1627
- if ($e(p) || !ze(p) || m.includes(p.tagName)) continue;
1627
+ if (He(p) || !Oe(p) || g.includes(p.tagName)) continue;
1628
1628
  const N = (p.textContent || "").trim();
1629
- N.length > 10 && u.push(he(N, qt));
1629
+ N.length > 10 && f.push(me(N, qt));
1630
1630
  }
1631
- const c = u.join(`
1631
+ const c = f.join(`
1632
1632
  `), R = [], C = Array.from(r.querySelectorAll("a[href]"));
1633
1633
  for (const p of C) {
1634
1634
  if (R.length >= rr) break;
1635
- if ($e(p) || !ze(p)) continue;
1635
+ if (He(p) || !Oe(p)) continue;
1636
1636
  const N = p.getAttribute("href") || "", B = (p.textContent || "").trim();
1637
- !N || !B || R.push({ href: N, text: he(B, 100) });
1637
+ !N || !B || R.push({ href: N, text: me(B, 100) });
1638
1638
  }
1639
1639
  const L = [], v = Array.from(
1640
1640
  r.querySelectorAll(
@@ -1643,9 +1643,9 @@ function sr(e, t = {}) {
1643
1643
  );
1644
1644
  for (const p of v) {
1645
1645
  if (L.length >= or) break;
1646
- if ($e(p) || !tt(p) || !ze(p)) continue;
1646
+ if (He(p) || !tt(p) || !Oe(p)) continue;
1647
1647
  const N = Bt(p), B = p instanceof HTMLInputElement ? p.type : p.tagName.toLowerCase();
1648
- N && L.push({ label: he(N, 100), type: B });
1648
+ N && L.push({ label: me(N, 100), type: B });
1649
1649
  }
1650
1650
  const b = Array.from(
1651
1651
  r.querySelectorAll("[data-ll-form]")
@@ -1665,8 +1665,8 @@ function sr(e, t = {}) {
1665
1665
  if (!tt(O)) continue;
1666
1666
  const W = O.getAttribute("data-ll-field") || "";
1667
1667
  if (!W) continue;
1668
- const V = Bt(O) || W, te = O instanceof HTMLInputElement ? O.type : O.tagName.toLowerCase();
1669
- A.push({ name: W, label: he(V, 100), type: te });
1668
+ const Y = Bt(O) || W, te = O instanceof HTMLInputElement ? O.type : O.tagName.toLowerCase();
1669
+ A.push({ name: W, label: me(Y, 100), type: te });
1670
1670
  }
1671
1671
  z.push({ id: N, intent: B, fields: A });
1672
1672
  }
@@ -1681,23 +1681,23 @@ function sr(e, t = {}) {
1681
1681
  forms: z,
1682
1682
  extras: e
1683
1683
  };
1684
- let H = Ee(JSON.stringify(I.regions)) + Ee(I.visibleText) + Ee(JSON.stringify(I.visibleLinks)) + Ee(JSON.stringify(I.visibleFields));
1684
+ let H = Ae(JSON.stringify(I.regions)) + Ae(I.visibleText) + Ae(JSON.stringify(I.visibleLinks)) + Ae(JSON.stringify(I.visibleFields));
1685
1685
  for (; H > Qe && I.visibleFields.length > 0; )
1686
- I.visibleFields.pop(), H = Ee(JSON.stringify(I.visibleFields));
1686
+ I.visibleFields.pop(), H = Ae(JSON.stringify(I.visibleFields));
1687
1687
  for (; H > Qe && I.visibleLinks.length > 0; )
1688
1688
  I.visibleLinks.pop(), H -= 80;
1689
- return Ee(I.visibleText) > Qe && (I.visibleText = he(I.visibleText, Qe - 100)), I;
1689
+ return Ae(I.visibleText) > Qe && (I.visibleText = me(I.visibleText, Qe - 100)), I;
1690
1690
  }
1691
- let Ne = null;
1691
+ let Re = null;
1692
1692
  function Wt(e, t = {}) {
1693
1693
  const r = Date.now(), i = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
1694
- if (Ne && Ne.key === i && r - Ne.at < 1e3)
1695
- return Ne.ctx;
1694
+ if (Re && Re.key === i && r - Re.at < 1e3)
1695
+ return Re.ctx;
1696
1696
  const l = sr(e, t);
1697
- return Ne = { key: i, at: r, ctx: l }, l;
1697
+ return Re = { key: i, at: r, ctx: l }, l;
1698
1698
  }
1699
1699
  function dr() {
1700
- Ne = null;
1700
+ Re = null;
1701
1701
  }
1702
1702
  const ur = 200;
1703
1703
  function fr(e) {
@@ -1722,33 +1722,33 @@ function hr(e) {
1722
1722
  if (pt(s)) continue;
1723
1723
  const d = s.getAttribute("href") || "";
1724
1724
  if (!pr(d)) continue;
1725
- let u = d, m = !0;
1725
+ let f = d, g = !0;
1726
1726
  try {
1727
1727
  if (typeof window < "u") {
1728
1728
  const a = new URL(d, r);
1729
- m = a.origin === r, m && d.startsWith("http") && (u = a.pathname + a.search + a.hash);
1729
+ g = a.origin === r, g && d.startsWith("http") && (f = a.pathname + a.search + a.hash);
1730
1730
  }
1731
1731
  } catch {
1732
1732
  continue;
1733
1733
  }
1734
- if (o.has(u)) continue;
1735
- o.add(u);
1736
- const h = (s.textContent || "").trim().slice(0, 120);
1737
- i.push({ href: u, text: h, internal: m });
1734
+ if (o.has(f)) continue;
1735
+ o.add(f);
1736
+ const m = (s.textContent || "").trim().slice(0, 120);
1737
+ i.push({ href: f, text: m, internal: g });
1738
1738
  }
1739
1739
  return i;
1740
1740
  }
1741
- let Ae = null;
1741
+ let Ie = null;
1742
1742
  const mr = 5e3;
1743
1743
  function st() {
1744
1744
  const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
1745
- if (Ae && Ae.pathname === t && e - Ae.at < mr)
1746
- return Ae.routes;
1745
+ if (Ie && Ie.pathname === t && e - Ie.at < mr)
1746
+ return Ie.routes;
1747
1747
  const r = hr();
1748
- return Ae = { at: e, pathname: t, routes: r }, r;
1748
+ return Ie = { at: e, pathname: t, routes: r }, r;
1749
1749
  }
1750
1750
  function gr() {
1751
- Ae = null;
1751
+ Ie = null;
1752
1752
  }
1753
1753
  function yr(e, t) {
1754
1754
  const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, o = Object.getOwnPropertyDescriptor(r, "value"), i = o == null ? void 0 : o.set;
@@ -1844,9 +1844,9 @@ function Sr(e) {
1844
1844
  sessionBody: l,
1845
1845
  autoConnect: s = !1,
1846
1846
  displayMode: d,
1847
- defaultDisplayMode: u = "expanded",
1848
- onDisplayModeChange: m,
1849
- position: h = "bottom-right",
1847
+ defaultDisplayMode: f = "expanded",
1848
+ onDisplayModeChange: g,
1849
+ position: m = "bottom-right",
1850
1850
  mobileBreakpoint: a = 640,
1851
1851
  persistKey: c = "ll-widget",
1852
1852
  disablePersistence: R = !1,
@@ -1864,63 +1864,63 @@ function Sr(e) {
1864
1864
  showOn: A,
1865
1865
  hideOn: O,
1866
1866
  pathname: W,
1867
- onNavigate: V,
1867
+ onNavigate: Y,
1868
1868
  onScrollToSelector: te,
1869
1869
  getPageContext: ue,
1870
- pageContextExtras: He,
1871
- getRoutes: Oe,
1872
- onScrollPage: qe,
1873
- onClick: Be,
1874
- capabilities: me,
1875
- onConnect: ge,
1876
- onDisconnect: ye,
1877
- onTranscript: ve,
1878
- onAgentState: be,
1879
- onConnectionStateChange: we,
1880
- onAgentEvent: _e,
1881
- onAgentCommand: xe,
1882
- controlledSession: j,
1883
- className: We,
1884
- style: Fe,
1885
- zIndex: Ue = 2147483647
1886
- } = e, je = Tn(W), ae = qn(je, A, O);
1870
+ pageContextExtras: qe,
1871
+ getRoutes: Be,
1872
+ onScrollPage: We,
1873
+ onClick: Fe,
1874
+ capabilities: ge,
1875
+ onConnect: ye,
1876
+ onDisconnect: ve,
1877
+ onTranscript: be,
1878
+ onAgentState: we,
1879
+ onConnectionStateChange: _e,
1880
+ onAgentEvent: xe,
1881
+ onAgentCommand: ke,
1882
+ controlledSession: V,
1883
+ className: Ue,
1884
+ style: je,
1885
+ zIndex: Ve = 2147483647
1886
+ } = e, fe = Tn(W), ae = qn(fe, A, O);
1887
1887
  T(() => {
1888
1888
  dr(), gr();
1889
- }, [je]);
1890
- const ie = L !== void 0, [ke, Le] = S(() => {
1891
- var g;
1892
- return L ?? ((g = C == null ? void 0 : C[0]) == null ? void 0 : g.id);
1893
- }), fe = ie ? L : ke, J = Ze(
1894
- () => (C == null ? void 0 : C.find((g) => g.id === fe)) ?? null,
1895
- [C, fe]
1896
- ), Re = (J == null ? void 0 : J.agentId) ?? t, [ne, ee] = An({
1889
+ }, [fe]);
1890
+ const ie = L !== void 0, [Le, Se] = S(() => {
1891
+ var h;
1892
+ return L ?? ((h = C == null ? void 0 : C[0]) == null ? void 0 : h.id);
1893
+ }), pe = ie ? L : Le, K = Ze(
1894
+ () => (C == null ? void 0 : C.find((h) => h.id === pe)) ?? null,
1895
+ [C, pe]
1896
+ ), Me = (K == null ? void 0 : K.agentId) ?? t, [ne, ee] = An({
1897
1897
  value: d,
1898
- defaultValue: u,
1899
- onChange: m,
1898
+ defaultValue: f,
1899
+ onChange: g,
1900
1900
  persistKey: c,
1901
1901
  disablePersistence: R
1902
- }), le = In(a), ce = yn(), Q = vn(), re = wn(), pe = _n(), Ie = xn(), [Ve, Me] = S(!1), [Se, y] = S(!1), [K, Ye] = S(!1), [Yt, Gt] = S(!1), [nt, Jt] = S(!1), rt = E(V), ot = E(te), it = E(qe), lt = E(Be), ht = E(ue), mt = E(He), gt = E(Oe), at = E(me), oe = E(null);
1903
- rt.current = V, ot.current = te, it.current = qe, lt.current = Be, ht.current = ue, mt.current = He, gt.current = Oe, at.current = me;
1904
- function se(g) {
1905
- const f = at.current;
1906
- return f ? f.includes(g) : !0;
1902
+ }), le = In(a), ce = yn(), Z = vn(), re = wn(), he = _n(), Te = xn(), [Ye, Pe] = S(!1), [Ce, y] = S(!1), [X, Je] = S(!1), [Yt, Jt] = S(!1), [nt, Gt] = S(!1), rt = E(Y), ot = E(te), it = E(We), lt = E(Fe), ht = E(ue), mt = E(qe), gt = E(Be), at = E(ge), oe = E(null);
1903
+ rt.current = Y, ot.current = te, it.current = We, lt.current = Fe, ht.current = ue, mt.current = qe, gt.current = Be, at.current = ge;
1904
+ function se(h) {
1905
+ const u = at.current;
1906
+ return u ? u.includes(h) : !0;
1907
1907
  }
1908
- function de(g, f) {
1908
+ function de(h, u) {
1909
1909
  console.warn(
1910
- `[LiveLayer] Agent command "${g}" blocked — capability "${f}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
1910
+ `[LiveLayer] Agent command "${h}" blocked — capability "${u}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
1911
1911
  );
1912
1912
  }
1913
- const Te = k(
1914
- (g) => {
1915
- var Z, Je, Ke, Et;
1916
- const f = g;
1917
- if (!(!f.type || typeof f.type != "string")) {
1918
- if (_e == null || _e({ eventName: f.type, data: g }), f.type === "navigate") {
1913
+ const De = k(
1914
+ (h) => {
1915
+ var J, Ee, Ke, Et;
1916
+ const u = h;
1917
+ if (!(!u.type || typeof u.type != "string")) {
1918
+ if (xe == null || xe({ eventName: u.type, data: h }), u.type === "navigate") {
1919
1919
  if (!se("navigate")) {
1920
1920
  de("navigate", "navigate");
1921
1921
  return;
1922
1922
  }
1923
- const x = typeof f.href == "string" ? f.href : null;
1923
+ const x = typeof u.href == "string" ? u.href : null;
1924
1924
  if (!x) {
1925
1925
  console.warn(
1926
1926
  `[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
@@ -1958,14 +1958,14 @@ function Sr(e) {
1958
1958
  }
1959
1959
  return;
1960
1960
  }
1961
- if (f.type === "scroll_to") {
1961
+ if (u.type === "scroll_to") {
1962
1962
  if (!se("scroll")) {
1963
1963
  de("scroll_to", "scroll");
1964
1964
  return;
1965
1965
  }
1966
- const x = typeof f.selector == "string" ? f.selector : null;
1966
+ const x = typeof u.selector == "string" ? u.selector : null;
1967
1967
  if (!x) return;
1968
- const M = f.behavior === "instant" ? "instant" : "smooth";
1968
+ const M = u.behavior === "instant" ? "instant" : "smooth";
1969
1969
  if (ot.current) {
1970
1970
  try {
1971
1971
  ot.current(
@@ -2000,26 +2000,26 @@ function Sr(e) {
2000
2000
  }
2001
2001
  return;
2002
2002
  }
2003
- if (f.type === "request_page_context") {
2003
+ if (u.type === "request_page_context") {
2004
2004
  if (!se("read_page")) {
2005
2005
  de("request_page_context", "read_page");
2006
2006
  return;
2007
2007
  }
2008
- const x = typeof f.requestId == "string" ? f.requestId : void 0, M = (Z = oe.current) == null ? void 0 : Z.call(oe), q = (U) => {
2008
+ const x = typeof u.requestId == "string" ? u.requestId : void 0, M = (J = oe.current) == null ? void 0 : J.call(oe), q = (j) => {
2009
2009
  const P = M, G = P == null ? void 0 : P.localParticipant;
2010
2010
  if (G != null && G.publishData)
2011
2011
  try {
2012
- const X = x ? { ...U, requestId: x } : U, Ce = new TextEncoder().encode(JSON.stringify(X));
2013
- G.publishData(Ce, { reliable: !0 });
2014
- } catch (X) {
2015
- console.warn("[LiveLayer] publishData failed.", X);
2012
+ const Q = x ? { ...j, requestId: x } : j, Ne = new TextEncoder().encode(JSON.stringify(Q));
2013
+ G.publishData(Ne, { reliable: !0 });
2014
+ } catch (Q) {
2015
+ console.warn("[LiveLayer] publishData failed.", Q);
2016
2016
  }
2017
2017
  }, $ = mt.current, F = ht.current;
2018
2018
  try {
2019
2019
  if (F) {
2020
- const U = F($);
2021
- if (U instanceof Promise) {
2022
- q({ type: "page_context_pending" }), U.then((P) => q({ type: "page_context", context: P })).catch((P) => {
2020
+ const j = F($);
2021
+ if (j instanceof Promise) {
2022
+ q({ type: "page_context_pending" }), j.then((P) => q({ type: "page_context", context: P })).catch((P) => {
2023
2023
  console.warn(
2024
2024
  "[LiveLayer] getPageContext rejected; falling back to default walker.",
2025
2025
  P
@@ -2030,17 +2030,17 @@ function Sr(e) {
2030
2030
  });
2031
2031
  return;
2032
2032
  }
2033
- q({ type: "page_context", context: U });
2033
+ q({ type: "page_context", context: j });
2034
2034
  return;
2035
2035
  }
2036
2036
  q({
2037
2037
  type: "page_context",
2038
2038
  context: Wt($)
2039
2039
  });
2040
- } catch (U) {
2040
+ } catch (j) {
2041
2041
  console.warn(
2042
2042
  "[LiveLayer] page-context extraction threw. Sending empty context.",
2043
- U
2043
+ j
2044
2044
  ), q({
2045
2045
  type: "page_context",
2046
2046
  context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: $ }
@@ -2048,19 +2048,19 @@ function Sr(e) {
2048
2048
  }
2049
2049
  return;
2050
2050
  }
2051
- if (f.type === "scroll_page") {
2051
+ if (u.type === "scroll_page") {
2052
2052
  if (!se("scroll")) {
2053
2053
  de("scroll_page", "scroll");
2054
2054
  return;
2055
2055
  }
2056
- const x = f.direction;
2056
+ const x = u.direction;
2057
2057
  if (x !== "up" && x !== "down" && x !== "top" && x !== "bottom") {
2058
2058
  console.warn(
2059
2059
  `[LiveLayer] scroll_page: invalid direction "${String(x)}". Expected up | down | top | bottom.`
2060
2060
  );
2061
2061
  return;
2062
2062
  }
2063
- const M = f.behavior === "instant" ? "instant" : "smooth";
2063
+ const M = u.behavior === "instant" ? "instant" : "smooth";
2064
2064
  if (it.current) {
2065
2065
  try {
2066
2066
  it.current(
@@ -2075,18 +2075,18 @@ function Sr(e) {
2075
2075
  if (typeof window > "u") return;
2076
2076
  const q = { behavior: M }, $ = xr(), F = (P) => {
2077
2077
  $ instanceof Window ? $.scrollBy({ top: P, ...q }) : $.scrollBy({ top: P, ...q });
2078
- }, U = (P) => {
2078
+ }, j = (P) => {
2079
2079
  $ instanceof Window ? $.scrollTo({ top: P, ...q }) : $.scrollTo({ top: P, ...q });
2080
2080
  };
2081
- x === "up" ? F(-Ft($)) : x === "down" ? F(Ft($)) : U(x === "top" ? 0 : kr($));
2081
+ x === "up" ? F(-Ft($)) : x === "down" ? F(Ft($)) : j(x === "top" ? 0 : kr($));
2082
2082
  return;
2083
2083
  }
2084
- if (f.type === "click") {
2084
+ if (u.type === "click") {
2085
2085
  if (!se("click")) {
2086
2086
  de("click", "click");
2087
2087
  return;
2088
2088
  }
2089
- const x = typeof f.selector == "string" ? f.selector : null;
2089
+ const x = typeof u.selector == "string" ? u.selector : null;
2090
2090
  if (!x) {
2091
2091
  console.warn("[LiveLayer] click: missing selector.");
2092
2092
  return;
@@ -2121,18 +2121,18 @@ function Sr(e) {
2121
2121
  );
2122
2122
  return;
2123
2123
  }
2124
- (Je = M.click) == null || Je.call(M);
2124
+ (Ee = M.click) == null || Ee.call(M);
2125
2125
  return;
2126
2126
  }
2127
- if (f.type === "fill_form" || f.type === "focus_field") {
2127
+ if (u.type === "fill_form" || u.type === "focus_field") {
2128
2128
  if (!se("fill_forms")) {
2129
- de(f.type, "fill_forms");
2129
+ de(u.type, "fill_forms");
2130
2130
  return;
2131
2131
  }
2132
2132
  if (typeof document > "u") return;
2133
- const x = typeof f.formId == "string" ? f.formId : null;
2133
+ const x = typeof u.formId == "string" ? u.formId : null;
2134
2134
  if (!x) {
2135
- console.warn(`[LiveLayer] ${f.type}: missing formId.`);
2135
+ console.warn(`[LiveLayer] ${u.type}: missing formId.`);
2136
2136
  return;
2137
2137
  }
2138
2138
  const M = document.querySelector(
@@ -2140,18 +2140,18 @@ function Sr(e) {
2140
2140
  );
2141
2141
  if (!M) {
2142
2142
  console.warn(
2143
- `[LiveLayer] ${f.type}: no form with data-ll-form="${x}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
2143
+ `[LiveLayer] ${u.type}: no form with data-ll-form="${x}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
2144
2144
  );
2145
2145
  return;
2146
2146
  }
2147
2147
  if (M.closest('[data-ll-private="true"], .ll-widget')) {
2148
2148
  console.warn(
2149
- `[LiveLayer] ${f.type}: refusing to touch a form in a private subtree.`
2149
+ `[LiveLayer] ${u.type}: refusing to touch a form in a private subtree.`
2150
2150
  );
2151
2151
  return;
2152
2152
  }
2153
- if (f.type === "focus_field") {
2154
- const $ = typeof f.fieldName == "string" ? f.fieldName : null;
2153
+ if (u.type === "focus_field") {
2154
+ const $ = typeof u.fieldName == "string" ? u.fieldName : null;
2155
2155
  if (!$) {
2156
2156
  console.warn("[LiveLayer] focus_field: missing fieldName.");
2157
2157
  return;
@@ -2172,28 +2172,28 @@ function Sr(e) {
2172
2172
  F.focus();
2173
2173
  return;
2174
2174
  }
2175
- const q = f.values && typeof f.values == "object" ? f.values : null;
2175
+ const q = u.values && typeof u.values == "object" ? u.values : null;
2176
2176
  if (!q) {
2177
2177
  console.warn("[LiveLayer] fill_form: missing or invalid values.");
2178
2178
  return;
2179
2179
  }
2180
2180
  for (const [$, F] of Object.entries(q)) {
2181
2181
  if (typeof F != "string") continue;
2182
- const U = M.querySelector(`[data-ll-field="${$.replace(/"/g, '\\"')}"]`);
2183
- if (!U) {
2182
+ const j = M.querySelector(`[data-ll-field="${$.replace(/"/g, '\\"')}"]`);
2183
+ if (!j) {
2184
2184
  console.warn(
2185
2185
  `[LiveLayer] fill_form: no field "${$}" in form "${x}". Skipping.`
2186
2186
  );
2187
2187
  continue;
2188
2188
  }
2189
- if (!tt(U)) {
2189
+ if (!tt(j)) {
2190
2190
  console.warn(
2191
2191
  `[LiveLayer] fill_form: field "${$}" is privacy-protected (password / cc-* / private). Skipping.`
2192
2192
  );
2193
2193
  continue;
2194
2194
  }
2195
2195
  try {
2196
- vr(U, F);
2196
+ vr(j, F);
2197
2197
  } catch (P) {
2198
2198
  console.warn(
2199
2199
  `[LiveLayer] fill_form: failed to set "${$}".`,
@@ -2203,13 +2203,13 @@ function Sr(e) {
2203
2203
  }
2204
2204
  return;
2205
2205
  }
2206
- if (f.type === "submit_form") {
2206
+ if (u.type === "submit_form") {
2207
2207
  if (!se("submit_forms")) {
2208
2208
  de("submit_form", "submit_forms");
2209
2209
  return;
2210
2210
  }
2211
2211
  if (typeof document > "u") return;
2212
- const x = typeof f.formId == "string" ? f.formId : null;
2212
+ const x = typeof u.formId == "string" ? u.formId : null;
2213
2213
  if (!x) {
2214
2214
  console.warn("[LiveLayer] submit_form: missing formId.");
2215
2215
  return;
@@ -2229,18 +2229,18 @@ function Sr(e) {
2229
2229
  );
2230
2230
  return;
2231
2231
  }
2232
- const q = typeof f.requestId == "string" ? f.requestId : void 0, $ = (Ke = oe.current) == null ? void 0 : Ke.call(oe), F = (G) => {
2233
- const X = $, Ce = X == null ? void 0 : X.localParticipant;
2234
- if (Ce != null && Ce.publishData)
2232
+ const q = typeof u.requestId == "string" ? u.requestId : void 0, $ = (Ke = oe.current) == null ? void 0 : Ke.call(oe), F = (G) => {
2233
+ const Q = $, Ne = Q == null ? void 0 : Q.localParticipant;
2234
+ if (Ne != null && Ne.publishData)
2235
2235
  try {
2236
2236
  const cn = q ? { ...G, requestId: q } : G, sn = new TextEncoder().encode(JSON.stringify(cn));
2237
- Ce.publishData(sn, { reliable: !0 });
2237
+ Ne.publishData(sn, { reliable: !0 });
2238
2238
  } catch {
2239
2239
  }
2240
2240
  };
2241
- let U = !1;
2241
+ let j = !1;
2242
2242
  const P = () => {
2243
- U = !0, F({ type: "form_submitted", formId: x });
2243
+ j = !0, F({ type: "form_submitted", formId: x });
2244
2244
  };
2245
2245
  M.addEventListener("submit", P, { once: !0 });
2246
2246
  try {
@@ -2254,7 +2254,7 @@ function Sr(e) {
2254
2254
  return;
2255
2255
  }
2256
2256
  setTimeout(() => {
2257
- U || (M.removeEventListener("submit", P), F({
2257
+ j || (M.removeEventListener("submit", P), F({
2258
2258
  type: "form_submit_blocked",
2259
2259
  formId: x,
2260
2260
  reason: "validation"
@@ -2262,34 +2262,34 @@ function Sr(e) {
2262
2262
  }, 500);
2263
2263
  return;
2264
2264
  }
2265
- if (f.type === "request_routes") {
2265
+ if (u.type === "request_routes") {
2266
2266
  if (!se("read_page")) {
2267
2267
  de("request_routes", "read_page");
2268
2268
  return;
2269
2269
  }
2270
- const x = typeof f.requestId == "string" ? f.requestId : void 0, q = (Et = oe.current) == null ? void 0 : Et.call(oe), $ = q == null ? void 0 : q.localParticipant;
2270
+ const x = typeof u.requestId == "string" ? u.requestId : void 0, q = (Et = oe.current) == null ? void 0 : Et.call(oe), $ = q == null ? void 0 : q.localParticipant;
2271
2271
  if (!($ != null && $.publishData)) return;
2272
2272
  const F = (P) => {
2273
2273
  try {
2274
- const G = x ? { type: "routes", routes: P, requestId: x } : { type: "routes", routes: P }, X = new TextEncoder().encode(JSON.stringify(G));
2275
- $.publishData(X, { reliable: !0 });
2274
+ const G = x ? { type: "routes", routes: P, requestId: x } : { type: "routes", routes: P }, Q = new TextEncoder().encode(JSON.stringify(G));
2275
+ $.publishData(Q, { reliable: !0 });
2276
2276
  } catch (G) {
2277
2277
  console.warn("[LiveLayer] request_routes: publishData failed.", G);
2278
2278
  }
2279
- }, U = gt.current;
2280
- if (U) {
2279
+ }, j = gt.current;
2280
+ if (j) {
2281
2281
  try {
2282
- const P = U(), G = (X) => {
2283
- if (!Array.isArray(X)) {
2282
+ const P = j(), G = (Q) => {
2283
+ if (!Array.isArray(Q)) {
2284
2284
  F([]);
2285
2285
  return;
2286
2286
  }
2287
- F(X.map(fr).slice(0, 200));
2287
+ F(Q.map(fr).slice(0, 200));
2288
2288
  };
2289
- P instanceof Promise ? P.then(G).catch((X) => {
2289
+ P instanceof Promise ? P.then(G).catch((Q) => {
2290
2290
  console.warn(
2291
2291
  "[LiveLayer] getRoutes rejected; falling back to DOM walker.",
2292
- X
2292
+ Q
2293
2293
  ), F(st());
2294
2294
  }) : G(P);
2295
2295
  } catch (P) {
@@ -2307,181 +2307,193 @@ function Sr(e) {
2307
2307
  }
2308
2308
  return;
2309
2309
  }
2310
- Lr.has(f.type) || xe == null || xe(f);
2310
+ Lr.has(u.type) || ke == null || ke(u);
2311
2311
  }
2312
2312
  },
2313
- [xe, _e]
2314
- ), Y = gn({
2315
- agentId: j ? "__controlled__" : Re,
2313
+ [ke, xe]
2314
+ ), U = gn({
2315
+ agentId: V ? "__controlled__" : Me,
2316
2316
  baseUrl: o,
2317
2317
  apiKey: r,
2318
2318
  sessionEndpoint: i,
2319
2319
  sessionBody: l,
2320
- onDataMessage: j ? void 0 : Te
2320
+ onDataMessage: V ? void 0 : De
2321
2321
  });
2322
2322
  T(() => {
2323
- if (j != null && j.subscribeToDataMessages)
2324
- return j.subscribeToDataMessages(Te);
2325
- }, [j, Te]), oe.current = () => {
2326
- var g;
2327
- return (g = Y.getRoom) == null ? void 0 : g.call(Y);
2323
+ if (V != null && V.subscribeToDataMessages)
2324
+ return V.subscribeToDataMessages(De);
2325
+ }, [V, De]), oe.current = () => {
2326
+ var h;
2327
+ return (h = U.getRoom) == null ? void 0 : h.call(U);
2328
2328
  }, T(() => {
2329
- var Z;
2329
+ var J;
2330
+ if (!fe) return;
2331
+ const h = (J = U.getRoom) == null ? void 0 : J.call(U), u = h == null ? void 0 : h.localParticipant;
2332
+ if (u != null && u.publishData)
2333
+ try {
2334
+ const Ee = new TextEncoder().encode(
2335
+ JSON.stringify({ type: "pathname", pathname: fe })
2336
+ );
2337
+ u.publishData(Ee, { reliable: !0 });
2338
+ } catch {
2339
+ }
2340
+ }, [fe, U, U.connectionState]), T(() => {
2341
+ var J;
2330
2342
  if (typeof window > "u") return;
2331
- const g = ((Z = window.location) == null ? void 0 : Z.hostname) || "";
2332
- if (g === "localhost" || g === "127.0.0.1" || g === "0.0.0.0" || g.endsWith(".local") || g.endsWith(".test"))
2333
- return window.__livelayerSimulateCommand = (Je) => {
2343
+ const h = ((J = window.location) == null ? void 0 : J.hostname) || "";
2344
+ if (h === "localhost" || h === "127.0.0.1" || h === "0.0.0.0" || h.endsWith(".local") || h.endsWith(".test"))
2345
+ return window.__livelayerSimulateCommand = (Ee) => {
2334
2346
  try {
2335
- Te(Je);
2347
+ De(Ee);
2336
2348
  } catch (Ke) {
2337
2349
  console.warn("[LiveLayer] simulate-command threw:", Ke);
2338
2350
  }
2339
2351
  }, () => {
2340
2352
  delete window.__livelayerSimulateCommand;
2341
2353
  };
2342
- }, [Te]);
2343
- const _ = Ze(() => j ? {
2344
- connectionState: j.connectionState,
2345
- agentState: j.agentState,
2346
- transcript: j.transcript,
2347
- videoElement: j.videoElement,
2348
- audioElement: j.audioElement,
2349
- canResume: j.canResume,
2350
- error: j.error,
2354
+ }, [De]);
2355
+ const _ = Ze(() => V ? {
2356
+ connectionState: V.connectionState,
2357
+ agentState: V.agentState,
2358
+ transcript: V.transcript,
2359
+ videoElement: V.videoElement,
2360
+ audioElement: V.audioElement,
2361
+ canResume: V.canResume,
2362
+ error: V.error,
2351
2363
  agentConfig: null,
2352
2364
  connect: async () => {
2353
- await j.onConnect();
2365
+ await V.onConnect();
2354
2366
  },
2355
- disconnect: () => j.onDisconnect(),
2367
+ disconnect: () => V.onDisconnect(),
2356
2368
  // Dummy getRoom for shape compatibility — controlled consumers own the Room.
2357
2369
  // Internal session's getRoom returns null when no real connect has happened,
2358
2370
  // so we reuse its reference for type consistency.
2359
- getRoom: Y.getRoom,
2371
+ getRoom: U.getRoom,
2360
2372
  isControlled: !0
2361
2373
  } : {
2362
- connectionState: Y.connectionState,
2363
- agentState: Y.agentState,
2364
- transcript: Y.transcript,
2365
- videoElement: Y.videoElement,
2366
- audioElement: Y.audioElement,
2367
- canResume: Y.canResume,
2368
- error: Y.error,
2369
- agentConfig: Y.agentConfig,
2370
- connect: Y.connect,
2371
- disconnect: Y.disconnect,
2372
- getRoom: Y.getRoom,
2374
+ connectionState: U.connectionState,
2375
+ agentState: U.agentState,
2376
+ transcript: U.transcript,
2377
+ videoElement: U.videoElement,
2378
+ audioElement: U.audioElement,
2379
+ canResume: U.canResume,
2380
+ error: U.error,
2381
+ agentConfig: U.agentConfig,
2382
+ connect: U.connect,
2383
+ disconnect: U.disconnect,
2384
+ getRoom: U.getRoom,
2373
2385
  isControlled: !1
2374
- }, [j, Y]), yt = E(null);
2386
+ }, [V, U]), yt = E(null);
2375
2387
  T(() => {
2376
- const g = _.videoElement, f = yt.current;
2377
- if (!(!g || !f))
2378
- return f.appendChild(g), () => {
2379
- g.parentNode === f && f.removeChild(g);
2388
+ const h = _.videoElement, u = yt.current;
2389
+ if (!(!h || !u))
2390
+ return u.appendChild(h), () => {
2391
+ h.parentNode === u && u.removeChild(h);
2380
2392
  };
2381
2393
  }, [_.videoElement]), T(() => {
2382
- const g = _.audioElement;
2383
- if (!g) return;
2384
- ce.attach(g);
2385
- const f = g.play();
2386
- return f && typeof f.catch == "function" && f.catch((Z) => {
2387
- (Z == null ? void 0 : Z.name) === "NotAllowedError" && Me(!0);
2394
+ const h = _.audioElement;
2395
+ if (!h) return;
2396
+ ce.attach(h);
2397
+ const u = h.play();
2398
+ return u && typeof u.catch == "function" && u.catch((J) => {
2399
+ (J == null ? void 0 : J.name) === "NotAllowedError" && Pe(!0);
2388
2400
  }), () => {
2389
2401
  ce.detach();
2390
2402
  };
2391
2403
  }, [_.audioElement]), T(() => {
2392
2404
  if (_.isControlled || _.connectionState !== "connected") return;
2393
- const g = _.getRoom();
2394
- if (g)
2395
- return Q.setupMic(g).catch(() => {
2396
- }), re.attachRoom(g), pe.attachRoom(g), Ie.refresh(), () => {
2397
- Q.teardownMic(), re.teardown(), pe.teardown();
2405
+ const h = _.getRoom();
2406
+ if (h)
2407
+ return Z.setupMic(h).catch(() => {
2408
+ }), re.attachRoom(h), he.attachRoom(h), Te.refresh(), () => {
2409
+ Z.teardownMic(), re.teardown(), he.teardown();
2398
2410
  };
2399
2411
  }, [_.isControlled, _.connectionState]), T(() => {
2400
- const g = _.audioElement;
2401
- g && (g.muted = nt);
2412
+ const h = _.audioElement;
2413
+ h && (h.muted = nt);
2402
2414
  }, [_.audioElement, nt]);
2403
- const Kt = k((g) => {
2404
- const f = _.getRoom();
2405
- if (f)
2415
+ const Kt = k((h) => {
2416
+ const u = _.getRoom();
2417
+ if (u)
2406
2418
  try {
2407
- const Z = new TextEncoder().encode(
2408
- JSON.stringify({ type: "user_message", text: g })
2419
+ const J = new TextEncoder().encode(
2420
+ JSON.stringify({ type: "user_message", text: h })
2409
2421
  );
2410
- f.localParticipant.publishData(Z, { reliable: !0 });
2422
+ u.localParticipant.publishData(J, { reliable: !0 });
2411
2423
  } catch {
2412
2424
  }
2413
2425
  }, [_]), Xt = k(() => {
2414
- Jt((g) => !g);
2426
+ Gt((h) => !h);
2415
2427
  }, []);
2416
2428
  T(() => {
2417
- we == null || we(_.connectionState), _.connectionState === "connected" ? ge == null || ge() : _.connectionState === "disconnected" && (ye == null || ye());
2418
- }, [_.connectionState, ge, ye, we]), T(() => {
2419
- ve == null || ve(_.transcript);
2420
- }, [_.transcript, ve]), T(() => {
2421
- be == null || be(_.agentState);
2422
- }, [_.agentState, be]);
2429
+ _e == null || _e(_.connectionState), _.connectionState === "connected" ? ye == null || ye() : _.connectionState === "disconnected" && (ve == null || ve());
2430
+ }, [_.connectionState, ye, ve, _e]), T(() => {
2431
+ be == null || be(_.transcript);
2432
+ }, [_.transcript, be]), T(() => {
2433
+ we == null || we(_.agentState);
2434
+ }, [_.agentState, we]);
2423
2435
  const vt = E(!1);
2424
2436
  T(() => {
2425
2437
  _.isControlled || !s || vt.current || ae && _.connectionState === "idle" && (vt.current = !0, _.connect());
2426
2438
  }, [s, _.connectionState, _, ae]);
2427
2439
  const Qt = k(
2428
- (g) => {
2429
- const f = C == null ? void 0 : C.find((Z) => Z.id === g);
2430
- f && (Ye(!1), g !== fe && (y(!0), _.disconnect(), ie || Le(g), v == null || v(f)));
2440
+ (h) => {
2441
+ const u = C == null ? void 0 : C.find((J) => J.id === h);
2442
+ u && (Je(!1), h !== pe && (y(!0), _.disconnect(), ie || Se(h), v == null || v(u)));
2431
2443
  },
2432
2444
  [
2433
2445
  C,
2434
- fe,
2446
+ pe,
2435
2447
  _,
2436
2448
  ie,
2437
2449
  v
2438
2450
  ]
2439
2451
  );
2440
2452
  T(() => {
2441
- Se && _.connectionState === "connected" && y(!1);
2442
- }, [_.connectionState, Se]), T(() => {
2443
- if (!K) return;
2444
- const g = (f) => {
2445
- f.key === "Escape" && Ye(!1);
2453
+ Ce && _.connectionState === "connected" && y(!1);
2454
+ }, [_.connectionState, Ce]), T(() => {
2455
+ if (!X) return;
2456
+ const h = (u) => {
2457
+ u.key === "Escape" && Je(!1);
2446
2458
  };
2447
- return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
2448
- }, [K]);
2449
- const Zt = !!I || !!(J != null && J.avatarImageUrl) || _.isControlled, Pe = kn(Re, o, Zt);
2450
- me === void 0 && ((wt = Pe.info) != null && wt.capabilities) && (at.current = Pe.info.capabilities);
2451
- const Ge = (J == null ? void 0 : J.name) ?? H ?? ((_t = _.agentConfig) == null ? void 0 : _t.name) ?? ((xt = Pe.info) == null ? void 0 : xt.name) ?? "Live Layer", ct = (J == null ? void 0 : J.avatarImageUrl) ?? I ?? ((kt = _.agentConfig) == null ? void 0 : kt.avatarImageUrl) ?? ((Lt = Pe.info) == null ? void 0 : Lt.avatarImageUrl) ?? null, en = b ?? ((St = _.agentConfig) == null ? void 0 : St.idleLoopUrl) ?? ((Ct = Pe.info) == null ? void 0 : Ct.idleLoopUrl) ?? null, tn = z ?? null, nn = k(() => ee("expanded"), [ee]), rn = k(
2459
+ return window.addEventListener("keydown", h), () => window.removeEventListener("keydown", h);
2460
+ }, [X]);
2461
+ const Zt = !!I || !!(K != null && K.avatarImageUrl) || _.isControlled, $e = kn(Me, o, Zt);
2462
+ ge === void 0 && ((wt = $e.info) != null && wt.capabilities) && (at.current = $e.info.capabilities);
2463
+ const Ge = (K == null ? void 0 : K.name) ?? H ?? ((_t = _.agentConfig) == null ? void 0 : _t.name) ?? ((xt = $e.info) == null ? void 0 : xt.name) ?? "Live Layer", ct = (K == null ? void 0 : K.avatarImageUrl) ?? I ?? ((kt = _.agentConfig) == null ? void 0 : kt.avatarImageUrl) ?? ((Lt = $e.info) == null ? void 0 : Lt.avatarImageUrl) ?? null, en = b ?? ((St = _.agentConfig) == null ? void 0 : St.idleLoopUrl) ?? ((Ct = $e.info) == null ? void 0 : Ct.idleLoopUrl) ?? null, tn = z ?? null, nn = k(() => ee("expanded"), [ee]), rn = k(
2452
2464
  () => ee("minimized"),
2453
2465
  [ee]
2454
2466
  ), bt = k(() => {
2455
2467
  _.disconnect(), ee("hidden");
2456
2468
  }, [_, ee]), on = k(() => {
2457
- const g = _.audioElement;
2458
- g && g.play().then(() => Me(!1)).catch(() => {
2469
+ const h = _.audioElement;
2470
+ h && h.play().then(() => Pe(!1)).catch(() => {
2459
2471
  });
2460
2472
  }, [_.audioElement]), ln = k(() => {
2461
- Me(!1), _.connect();
2462
- }, [_]), De = {
2463
- ...Fe,
2464
- zIndex: Ue
2473
+ Pe(!1), _.connect();
2474
+ }, [_]), ze = {
2475
+ ...je,
2476
+ zIndex: Ve
2465
2477
  };
2466
- p.primaryColor && (De["--ll-color-primary"] = p.primaryColor), p.accentColor && (De["--ll-color-accent"] = p.accentColor), p.backgroundColor && (De["--ll-color-bg"] = p.backgroundColor), p.textColor && (De["--ll-color-fg"] = p.textColor);
2478
+ p.primaryColor && (ze["--ll-color-primary"] = p.primaryColor), p.accentColor && (ze["--ll-color-accent"] = p.accentColor), p.backgroundColor && (ze["--ll-color-bg"] = p.backgroundColor), p.textColor && (ze["--ll-color-fg"] = p.textColor);
2467
2479
  const an = [
2468
2480
  "ll-widget",
2469
2481
  `ll-widget--${ne}`,
2470
2482
  `ll-widget--${le ? "mobile" : "desktop"}`,
2471
- We
2483
+ Ue
2472
2484
  ].filter(Boolean).join(" ");
2473
2485
  return ae ? /* @__PURE__ */ w(
2474
2486
  "div",
2475
2487
  {
2476
2488
  className: an,
2477
- style: De,
2489
+ style: ze,
2478
2490
  "data-display-mode": ne,
2479
- "data-position": h,
2491
+ "data-position": m,
2480
2492
  children: [
2481
2493
  ne === "hidden" && /* @__PURE__ */ n(
2482
2494
  Vn,
2483
2495
  {
2484
- position: h,
2496
+ position: m,
2485
2497
  isMobile: le,
2486
2498
  isSpeaking: _.agentState === "speaking",
2487
2499
  onExpand: () => ee("expanded"),
@@ -2491,24 +2503,24 @@ function Sr(e) {
2491
2503
  }
2492
2504
  ),
2493
2505
  ne === "minimized" && /* @__PURE__ */ n(
2494
- Gn,
2506
+ Jn,
2495
2507
  {
2496
- position: h,
2508
+ position: m,
2497
2509
  isMobile: le,
2498
2510
  agentName: Ge,
2499
2511
  avatarImageUrl: ct,
2500
2512
  agentState: _.agentState,
2501
- isMuted: Q.isMuted,
2513
+ isMuted: Z.isMuted,
2502
2514
  audioLevel: ce,
2503
2515
  onExpand: nn,
2504
- onToggleMute: Q.toggleMute,
2516
+ onToggleMute: Z.toggleMute,
2505
2517
  onClose: bt
2506
2518
  }
2507
2519
  ),
2508
2520
  ne === "expanded" && /* @__PURE__ */ n(
2509
2521
  Kn,
2510
2522
  {
2511
- position: h,
2523
+ position: m,
2512
2524
  isMobile: le,
2513
2525
  agentName: Ge,
2514
2526
  avatarImageUrl: ct,
@@ -2516,46 +2528,46 @@ function Sr(e) {
2516
2528
  greeting: tn,
2517
2529
  branding: p,
2518
2530
  teamMembers: C,
2519
- currentTeamMemberId: fe,
2520
- isSwitchingTeamMember: Se,
2521
- teamSwitcherOpen: K,
2522
- onToggleTeamSwitcher: () => Ye((g) => !g),
2531
+ currentTeamMemberId: pe,
2532
+ isSwitchingTeamMember: Ce,
2533
+ teamSwitcherOpen: X,
2534
+ onToggleTeamSwitcher: () => Je((h) => !h),
2523
2535
  onSelectTeamMember: Qt,
2524
2536
  connectionState: _.connectionState,
2525
2537
  agentState: _.agentState,
2526
2538
  transcript: _.transcript,
2527
- isMuted: Q.isMuted,
2528
- micDevices: Ie.mics,
2539
+ isMuted: Z.isMuted,
2540
+ micDevices: Te.mics,
2529
2541
  isCameraEnabled: re.isEnabled,
2530
2542
  cameraPreviewEl: re.previewEl,
2531
- cameraDevices: Ie.cameras,
2543
+ cameraDevices: Te.cameras,
2532
2544
  activeCameraId: re.activeDeviceId,
2533
- isScreenShareEnabled: pe.isEnabled,
2534
- screenPreviewEl: pe.previewEl,
2545
+ isScreenShareEnabled: he.isEnabled,
2546
+ screenPreviewEl: he.previewEl,
2535
2547
  isSpeakerMuted: nt,
2536
2548
  allowCamera: N,
2537
2549
  allowScreenShare: B,
2538
2550
  allowTyping: D,
2539
2551
  languageMenuOpen: Yt,
2540
- onToggleLanguageMenu: () => Gt((g) => !g),
2541
- needsUserGesture: Ve,
2552
+ onToggleLanguageMenu: () => Jt((h) => !h),
2553
+ needsUserGesture: Ye,
2542
2554
  canResume: _.canResume,
2543
- micError: Q.micError,
2555
+ micError: Z.micError,
2544
2556
  error: _.error,
2545
2557
  avatarVideoContainerRef: yt,
2546
2558
  onConnect: () => void _.connect(),
2547
2559
  onDisconnect: () => _.disconnect(),
2548
2560
  onRetry: ln,
2549
2561
  onResumeAudio: on,
2550
- onToggleMute: Q.toggleMute,
2562
+ onToggleMute: Z.toggleMute,
2551
2563
  onToggleCamera: () => void re.toggle(),
2552
- onSwitchCameraDevice: (g) => void re.switchDevice(g),
2553
- onToggleScreenShare: () => void pe.toggle(),
2564
+ onSwitchCameraDevice: (h) => void re.switchDevice(h),
2565
+ onToggleScreenShare: () => void he.toggle(),
2554
2566
  onToggleSpeaker: Xt,
2555
2567
  onSendMessage: Kt,
2556
2568
  onMinimize: rn,
2557
2569
  onClose: bt,
2558
- onClearMicError: Q.clearError
2570
+ onClearMicError: Z.clearError
2559
2571
  }
2560
2572
  )
2561
2573
  ]
@@ -2574,22 +2586,22 @@ const Pr = ({
2574
2586
  className: l,
2575
2587
  style: s
2576
2588
  }) => {
2577
- const d = E(null), u = E(null), m = E(i);
2578
- m.current = i;
2579
- const h = k((a) => {
2589
+ const d = E(null), f = E(null), g = E(i);
2590
+ g.current = i;
2591
+ const m = k((a) => {
2580
2592
  var R;
2581
2593
  const c = a.detail;
2582
- (R = m.current) == null || R.call(m, c);
2594
+ (R = g.current) == null || R.call(g, c);
2583
2595
  }, []);
2584
2596
  return T(() => {
2585
2597
  const a = d.current;
2586
2598
  if (!a) return;
2587
2599
  const c = document.createElement("livelayer-widget");
2588
- return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), o && c.setAttribute("mode", o), c.addEventListener("agent-event", h), a.appendChild(c), u.current = c, () => {
2589
- c.removeEventListener("agent-event", h), a.removeChild(c), u.current = null;
2600
+ return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), o && c.setAttribute("mode", o), c.addEventListener("agent-event", m), a.appendChild(c), f.current = c, () => {
2601
+ c.removeEventListener("agent-event", m), a.removeChild(c), f.current = null;
2590
2602
  };
2591
2603
  }, [e]), T(() => {
2592
- u.current && (o ? u.current.setAttribute("mode", o) : u.current.removeAttribute("mode"));
2604
+ f.current && (o ? f.current.setAttribute("mode", o) : f.current.removeAttribute("mode"));
2593
2605
  }, [o]), /* @__PURE__ */ n("div", { ref: d, className: l, style: s });
2594
2606
  }, Dr = ft(
2595
2607
  function({ id: t, intent: r, as: o = "div", className: i, style: l, children: s }, d) {
@@ -2623,7 +2635,7 @@ const Pr = ({
2623
2635
  const { name: o, label: i, labelClassName: l } = t, s = { name: o, "data-ll-field": o };
2624
2636
  let d;
2625
2637
  if ("as" in t && t.as === "textarea") {
2626
- const { name: u, label: m, labelClassName: h, as: a, ...c } = t;
2638
+ const { name: f, label: g, labelClassName: m, as: a, ...c } = t;
2627
2639
  d = /* @__PURE__ */ n(
2628
2640
  "textarea",
2629
2641
  {
@@ -2633,7 +2645,7 @@ const Pr = ({
2633
2645
  }
2634
2646
  );
2635
2647
  } else if ("as" in t && t.as === "select") {
2636
- const { name: u, label: m, labelClassName: h, as: a, children: c, ...R } = t;
2648
+ const { name: f, label: g, labelClassName: m, as: a, children: c, ...R } = t;
2637
2649
  d = /* @__PURE__ */ n(
2638
2650
  "select",
2639
2651
  {
@@ -2644,7 +2656,7 @@ const Pr = ({
2644
2656
  }
2645
2657
  );
2646
2658
  } else {
2647
- const { name: u, label: m, labelClassName: h, as: a, ...c } = t;
2659
+ const { name: f, label: g, labelClassName: m, as: a, ...c } = t;
2648
2660
  d = /* @__PURE__ */ n(
2649
2661
  "input",
2650
2662
  {
@@ -2666,8 +2678,8 @@ function Hr({
2666
2678
  defaultOpen: t = !1,
2667
2679
  storageKey: r = "ll-debug-open"
2668
2680
  }) {
2669
- const [o, i] = S(t), [l, s] = S([]), [d, u] = S(""), [m, h] = S(!1), a = E(/* @__PURE__ */ new Set()), c = E([]), R = E(m);
2670
- R.current = m, T(() => {
2681
+ const [o, i] = S(t), [l, s] = S([]), [d, f] = S(""), [g, m] = S(!1), a = E(/* @__PURE__ */ new Set()), c = E([]), R = E(g);
2682
+ R.current = g, T(() => {
2671
2683
  try {
2672
2684
  const v = localStorage.getItem(r);
2673
2685
  v === "1" && i(!0), v === "0" && i(!1);
@@ -2799,10 +2811,10 @@ function Hr({
2799
2811
  "button",
2800
2812
  {
2801
2813
  type: "button",
2802
- onClick: () => h((v) => !v),
2803
- style: dt(m ? "#f59e0b" : "transparent"),
2814
+ onClick: () => m((v) => !v),
2815
+ style: dt(g ? "#f59e0b" : "transparent"),
2804
2816
  title: "Pause / resume capture",
2805
- children: m ? "▶ resume" : "⏸ pause"
2817
+ children: g ? "▶ resume" : "⏸ pause"
2806
2818
  }
2807
2819
  ),
2808
2820
  /* @__PURE__ */ n(
@@ -2836,7 +2848,7 @@ function Hr({
2836
2848
  {
2837
2849
  type: "text",
2838
2850
  value: d,
2839
- onChange: (v) => u(v.target.value),
2851
+ onChange: (v) => f(v.target.value),
2840
2852
  placeholder: "filter by type or data…",
2841
2853
  style: {
2842
2854
  margin: 8,