@livelayer/react 0.9.4 → 0.9.5
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.d.ts +14 -0
- package/dist/index.js +3 -3
- package/dist/index.mjs +546 -539
- package/dist/styles.css +16 -9
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { Component as In, useState as L, useRef as S, useEffect as
|
|
2
|
+
import { jsxs as y, jsx as n, Fragment as it } from "react/jsx-runtime";
|
|
3
|
+
import { Component as In, useState as L, useRef as S, useEffect as N, useCallback as k, useMemo as Ue, useLayoutEffect as Tn, forwardRef as lt, useImperativeHandle as Mn, createElement as Dn } from "react";
|
|
4
4
|
import { LiveKitSession as Pn } from "@livelayer/sdk";
|
|
5
5
|
import { createLocalAudioTrack as $n, Track as dn, createLocalVideoTrack as zn } from "livekit-client";
|
|
6
6
|
import { createPortal as On } from "react-dom";
|
|
@@ -19,7 +19,7 @@ class Hn extends In {
|
|
|
19
19
|
}
|
|
20
20
|
render() {
|
|
21
21
|
var t;
|
|
22
|
-
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */
|
|
22
|
+
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ y("div", { className: "ll-error-boundary", role: "alert", children: [
|
|
23
23
|
/* @__PURE__ */ n("p", { className: "ll-error-boundary__title", children: "Widget crashed" }),
|
|
24
24
|
/* @__PURE__ */ n("p", { className: "ll-error-boundary__message", children: ((t = this.state.error) == null ? void 0 : t.message) || "Something went wrong." }),
|
|
25
25
|
/* @__PURE__ */ n(
|
|
@@ -35,25 +35,25 @@ class Hn extends In {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
function Wn(e) {
|
|
38
|
-
const [t, r] = L("idle"), [o, i] = L("idle"), [l, u] = L([]), [d, c] = L(null), [f, h] = L(null), [a, s] = L(null), [
|
|
39
|
-
|
|
38
|
+
const [t, r] = L("idle"), [o, i] = L("idle"), [l, u] = L([]), [d, c] = L(null), [f, h] = L(null), [a, s] = L(null), [A, D] = L(!1), [E, b] = L(null), w = S(null), R = S(e.onDataMessage);
|
|
39
|
+
R.current = e.onDataMessage, N(() => {
|
|
40
40
|
const I = {
|
|
41
|
-
onConnectionStateChange: (
|
|
42
|
-
r(
|
|
41
|
+
onConnectionStateChange: (O) => {
|
|
42
|
+
r(O), O === "connected" && b(null);
|
|
43
43
|
},
|
|
44
44
|
onAgentStateChange: i,
|
|
45
|
-
onTranscript: (
|
|
45
|
+
onTranscript: (O) => u([...O]),
|
|
46
46
|
onAgentConfig: c,
|
|
47
|
-
onAudioTrack: (
|
|
48
|
-
onVideoTrack: (
|
|
47
|
+
onAudioTrack: (O) => s(O),
|
|
48
|
+
onVideoTrack: (O) => h(O),
|
|
49
49
|
onVideoTrackRemoved: () => h(null),
|
|
50
|
-
onError: (
|
|
51
|
-
onDataMessage: (
|
|
50
|
+
onError: (O) => b(O),
|
|
51
|
+
onDataMessage: (O) => {
|
|
52
52
|
var C;
|
|
53
|
-
(C =
|
|
53
|
+
(C = R.current) == null || C.call(R, O);
|
|
54
54
|
},
|
|
55
55
|
onResumabilityChange: D
|
|
56
|
-
},
|
|
56
|
+
}, q = new Pn(
|
|
57
57
|
{
|
|
58
58
|
agentId: e.agentId,
|
|
59
59
|
baseUrl: e.baseUrl,
|
|
@@ -63,9 +63,9 @@ function Wn(e) {
|
|
|
63
63
|
},
|
|
64
64
|
I
|
|
65
65
|
);
|
|
66
|
-
return
|
|
67
|
-
var
|
|
68
|
-
(
|
|
66
|
+
return w.current = q, r("idle"), i("idle"), u([]), c(null), h(null), s(null), D(!1), b(null), () => {
|
|
67
|
+
var O;
|
|
68
|
+
(O = q.destroy) == null || O.call(q), w.current = null;
|
|
69
69
|
};
|
|
70
70
|
}, [
|
|
71
71
|
e.agentId,
|
|
@@ -75,19 +75,19 @@ function Wn(e) {
|
|
|
75
75
|
JSON.stringify(e.sessionBody ?? {})
|
|
76
76
|
]);
|
|
77
77
|
const T = k(async () => {
|
|
78
|
-
const I =
|
|
78
|
+
const I = w.current;
|
|
79
79
|
if (I)
|
|
80
80
|
try {
|
|
81
81
|
await I.connect();
|
|
82
|
-
} catch (
|
|
83
|
-
throw
|
|
82
|
+
} catch (q) {
|
|
83
|
+
throw b(q instanceof Error ? q.message : String(q)), q;
|
|
84
84
|
}
|
|
85
|
-
}, []),
|
|
86
|
-
const I =
|
|
85
|
+
}, []), z = k(() => {
|
|
86
|
+
const I = w.current;
|
|
87
87
|
I && I.disconnect();
|
|
88
|
-
}, []),
|
|
88
|
+
}, []), _ = k(() => {
|
|
89
89
|
var I;
|
|
90
|
-
return ((I =
|
|
90
|
+
return ((I = w.current) == null ? void 0 : I.getRoom()) ?? null;
|
|
91
91
|
}, []);
|
|
92
92
|
return {
|
|
93
93
|
connectionState: t,
|
|
@@ -96,12 +96,12 @@ function Wn(e) {
|
|
|
96
96
|
agentConfig: d,
|
|
97
97
|
videoElement: f,
|
|
98
98
|
audioElement: a,
|
|
99
|
-
canResume:
|
|
99
|
+
canResume: A,
|
|
100
100
|
error: E,
|
|
101
101
|
connect: T,
|
|
102
|
-
disconnect:
|
|
103
|
-
getRoom:
|
|
104
|
-
session:
|
|
102
|
+
disconnect: z,
|
|
103
|
+
getRoom: _,
|
|
104
|
+
session: w.current
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
function Bn() {
|
|
@@ -116,14 +116,14 @@ function Bn() {
|
|
|
116
116
|
));
|
|
117
117
|
const s = l.current;
|
|
118
118
|
a.getByteFrequencyData(s);
|
|
119
|
-
let
|
|
120
|
-
for (let E = 0; E < s.length; E++)
|
|
121
|
-
const D =
|
|
119
|
+
let A = 0;
|
|
120
|
+
for (let E = 0; E < s.length; E++) A += s[E];
|
|
121
|
+
const D = A / s.length / 255;
|
|
122
122
|
for (const E of i.current)
|
|
123
123
|
try {
|
|
124
124
|
E(D);
|
|
125
|
-
} catch (
|
|
126
|
-
console.error("[useAudioLevel] subscriber threw:",
|
|
125
|
+
} catch (b) {
|
|
126
|
+
console.error("[useAudioLevel] subscriber threw:", b);
|
|
127
127
|
}
|
|
128
128
|
o.current = requestAnimationFrame(u);
|
|
129
129
|
}, []), d = k(() => {
|
|
@@ -162,7 +162,7 @@ function Bn() {
|
|
|
162
162
|
}, []), h = k((a) => (i.current.add(a), () => {
|
|
163
163
|
i.current.delete(a);
|
|
164
164
|
}), []);
|
|
165
|
-
return
|
|
165
|
+
return N(() => () => {
|
|
166
166
|
if (f(), t.current) {
|
|
167
167
|
try {
|
|
168
168
|
t.current.disconnect();
|
|
@@ -225,64 +225,64 @@ function qn() {
|
|
|
225
225
|
}
|
|
226
226
|
const Fn = { resolution: { width: 640, height: 480, frameRate: 24 } };
|
|
227
227
|
function Un() {
|
|
228
|
-
const [e, t] = L(!1), [r, o] = L(null), [i, l] = L(null), [u, d] = L(""), c = S(null), f = S(null), h = k((
|
|
229
|
-
c.current =
|
|
228
|
+
const [e, t] = L(!1), [r, o] = L(null), [i, l] = L(null), [u, d] = L(""), c = S(null), f = S(null), h = k((w) => {
|
|
229
|
+
c.current = w;
|
|
230
230
|
}, []), a = k(() => {
|
|
231
|
-
const
|
|
232
|
-
if (
|
|
233
|
-
const T =
|
|
231
|
+
const w = c.current, R = f.current;
|
|
232
|
+
if (R && w) {
|
|
233
|
+
const T = w.localParticipant.getTrackPublication(dn.Source.Camera);
|
|
234
234
|
if (T != null && T.track) {
|
|
235
235
|
try {
|
|
236
|
-
|
|
236
|
+
w.localParticipant.unpublishTrack(T.track);
|
|
237
237
|
} catch {
|
|
238
238
|
}
|
|
239
239
|
T.track.stop();
|
|
240
240
|
} else
|
|
241
|
-
|
|
241
|
+
R.stop();
|
|
242
242
|
}
|
|
243
243
|
f.current = null, l(null), t(!1);
|
|
244
|
-
}, []), s = k(async (
|
|
245
|
-
const
|
|
246
|
-
if (
|
|
244
|
+
}, []), s = k(async (w) => {
|
|
245
|
+
const R = c.current;
|
|
246
|
+
if (R) {
|
|
247
247
|
o(null);
|
|
248
248
|
try {
|
|
249
249
|
const T = { ...Fn };
|
|
250
|
-
|
|
251
|
-
const
|
|
252
|
-
await
|
|
253
|
-
const
|
|
254
|
-
l(
|
|
250
|
+
w && (T.deviceId = w);
|
|
251
|
+
const z = await zn(T);
|
|
252
|
+
await R.localParticipant.publishTrack(z), f.current = z;
|
|
253
|
+
const _ = z.attach();
|
|
254
|
+
l(_), t(!0), w && d(w);
|
|
255
255
|
try {
|
|
256
|
-
|
|
256
|
+
R.localParticipant.publishData(
|
|
257
257
|
new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
|
|
258
258
|
{ reliable: !0 }
|
|
259
259
|
);
|
|
260
260
|
} catch {
|
|
261
261
|
}
|
|
262
262
|
} catch (T) {
|
|
263
|
-
const
|
|
264
|
-
o(
|
|
263
|
+
const z = T instanceof Error && T.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
|
|
264
|
+
o(z);
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
|
-
}, []),
|
|
267
|
+
}, []), A = k(async () => {
|
|
268
268
|
e ? a() : await s(u || void 0);
|
|
269
|
-
}, [e, u, a, s]), D = k(async (
|
|
270
|
-
a(), await s(
|
|
269
|
+
}, [e, u, a, s]), D = k(async (w) => {
|
|
270
|
+
a(), await s(w);
|
|
271
271
|
}, [a, s]), E = k(() => {
|
|
272
272
|
a(), c.current = null, o(null), d("");
|
|
273
|
-
}, [a]),
|
|
274
|
-
return
|
|
273
|
+
}, [a]), b = k(() => o(null), []);
|
|
274
|
+
return N(() => () => {
|
|
275
275
|
f.current && f.current.stop();
|
|
276
276
|
}, []), {
|
|
277
277
|
isEnabled: e,
|
|
278
278
|
error: r,
|
|
279
279
|
previewEl: i,
|
|
280
280
|
activeDeviceId: u,
|
|
281
|
-
toggle:
|
|
281
|
+
toggle: A,
|
|
282
282
|
switchDevice: D,
|
|
283
283
|
attachRoom: h,
|
|
284
284
|
teardown: E,
|
|
285
|
-
clearError:
|
|
285
|
+
clearError: b
|
|
286
286
|
};
|
|
287
287
|
}
|
|
288
288
|
function jn() {
|
|
@@ -302,12 +302,12 @@ function jn() {
|
|
|
302
302
|
o(null);
|
|
303
303
|
try {
|
|
304
304
|
await s.localParticipant.setScreenShareEnabled(!0);
|
|
305
|
-
let
|
|
305
|
+
let A = 0;
|
|
306
306
|
const D = () => {
|
|
307
307
|
const E = s.localParticipant.getTrackPublication(dn.Source.ScreenShare);
|
|
308
308
|
if (E != null && E.track) {
|
|
309
|
-
const
|
|
310
|
-
l(
|
|
309
|
+
const b = E.track.attach();
|
|
310
|
+
l(b), t(!0);
|
|
311
311
|
try {
|
|
312
312
|
s.localParticipant.publishData(
|
|
313
313
|
new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
|
|
@@ -317,11 +317,11 @@ function jn() {
|
|
|
317
317
|
}
|
|
318
318
|
return;
|
|
319
319
|
}
|
|
320
|
-
|
|
320
|
+
A++ < 10 ? setTimeout(D, 100) : t(!0);
|
|
321
321
|
};
|
|
322
322
|
D();
|
|
323
|
-
} catch (
|
|
324
|
-
const D =
|
|
323
|
+
} catch (A) {
|
|
324
|
+
const D = A instanceof Error ? A.name : "";
|
|
325
325
|
D !== "NotAllowedError" && D !== "AbortError" && o("Screen share unavailable. Try again."), t(!1);
|
|
326
326
|
}
|
|
327
327
|
}
|
|
@@ -345,7 +345,7 @@ function Vn() {
|
|
|
345
345
|
} catch {
|
|
346
346
|
}
|
|
347
347
|
}, []);
|
|
348
|
-
return
|
|
348
|
+
return N(() => {
|
|
349
349
|
if (i(), typeof navigator > "u" || !navigator.mediaDevices) return;
|
|
350
350
|
const l = () => void i();
|
|
351
351
|
return navigator.mediaDevices.addEventListener("devicechange", l), () => navigator.mediaDevices.removeEventListener("devicechange", l);
|
|
@@ -353,7 +353,7 @@ function Vn() {
|
|
|
353
353
|
}
|
|
354
354
|
function Yn(e, t, r = !1) {
|
|
355
355
|
const [o, i] = L(null), [l, u] = L(null), [d, c] = L(!r && !!e);
|
|
356
|
-
return
|
|
356
|
+
return N(() => {
|
|
357
357
|
if (r || !e) {
|
|
358
358
|
c(!1);
|
|
359
359
|
return;
|
|
@@ -420,7 +420,7 @@ function Zn({
|
|
|
420
420
|
e === void 0 && !i && Jn(l, f), r == null || r(f);
|
|
421
421
|
}
|
|
422
422
|
});
|
|
423
|
-
return
|
|
423
|
+
return N(() => {
|
|
424
424
|
if (u.current || (u.current = !0, i || e !== void 0)) return;
|
|
425
425
|
const f = Qn(Gn(l));
|
|
426
426
|
f && f !== d && c(f);
|
|
@@ -429,7 +429,7 @@ function Zn({
|
|
|
429
429
|
const er = 640;
|
|
430
430
|
function tr(e = er) {
|
|
431
431
|
const [t, r] = L(!1);
|
|
432
|
-
return
|
|
432
|
+
return N(() => {
|
|
433
433
|
if (e === !1) {
|
|
434
434
|
r(!1);
|
|
435
435
|
return;
|
|
@@ -461,7 +461,7 @@ function rr(e) {
|
|
|
461
461
|
const [t, r] = L(
|
|
462
462
|
() => e ?? Vt()
|
|
463
463
|
);
|
|
464
|
-
return
|
|
464
|
+
return N(() => {
|
|
465
465
|
if (e !== void 0) return;
|
|
466
466
|
nr();
|
|
467
467
|
const o = () => r(Vt());
|
|
@@ -554,7 +554,7 @@ function fr(e) {
|
|
|
554
554
|
},
|
|
555
555
|
[r, t.thinking]
|
|
556
556
|
);
|
|
557
|
-
return
|
|
557
|
+
return N(() => () => {
|
|
558
558
|
if (o.current) {
|
|
559
559
|
try {
|
|
560
560
|
o.current.pause();
|
|
@@ -567,7 +567,7 @@ function fr(e) {
|
|
|
567
567
|
[l, u, d]
|
|
568
568
|
);
|
|
569
569
|
}
|
|
570
|
-
const Jt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */
|
|
570
|
+
const Jt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ y(
|
|
571
571
|
"svg",
|
|
572
572
|
{
|
|
573
573
|
className: t,
|
|
@@ -691,7 +691,7 @@ const vr = ({
|
|
|
691
691
|
avatarImageUrl: l,
|
|
692
692
|
agentName: u
|
|
693
693
|
}) => {
|
|
694
|
-
const d = mr(e), c = d === "right" ? "left" : "right", f = t ? 80 : 72, h = !!l, [a, s] = L(null), [
|
|
694
|
+
const d = mr(e), c = d === "right" ? "left" : "right", f = t ? 80 : 72, h = !!l, [a, s] = L(null), [A, D] = L(!1), E = S(null), b = S(!1), w = k(
|
|
695
695
|
(C) => {
|
|
696
696
|
if (typeof window > "u") return C;
|
|
697
697
|
const P = f / 2, F = Qt + P, G = window.innerHeight - Qt - P;
|
|
@@ -699,15 +699,15 @@ const vr = ({
|
|
|
699
699
|
},
|
|
700
700
|
[f]
|
|
701
701
|
);
|
|
702
|
-
|
|
702
|
+
N(() => {
|
|
703
703
|
const C = yr();
|
|
704
|
-
s(
|
|
704
|
+
s(w(C ?? window.innerHeight / 2));
|
|
705
705
|
const P = () => {
|
|
706
|
-
s((F) => F === null ? null :
|
|
706
|
+
s((F) => F === null ? null : w(F));
|
|
707
707
|
};
|
|
708
708
|
return window.addEventListener("resize", P), () => window.removeEventListener("resize", P);
|
|
709
|
-
}, [
|
|
710
|
-
const
|
|
709
|
+
}, [w]);
|
|
710
|
+
const R = k(
|
|
711
711
|
(C) => {
|
|
712
712
|
if (!(C.pointerType === "mouse" && C.button !== 0) && a !== null) {
|
|
713
713
|
try {
|
|
@@ -727,10 +727,10 @@ const vr = ({
|
|
|
727
727
|
const P = E.current;
|
|
728
728
|
if (!P) return;
|
|
729
729
|
const F = C.clientY - P.startClientY;
|
|
730
|
-
!P.moved && Math.abs(F) > gr && (P.moved = !0, D(!0)), P.moved && s(
|
|
730
|
+
!P.moved && Math.abs(F) > gr && (P.moved = !0, D(!0)), P.moved && s(w(P.startCenterY + F));
|
|
731
731
|
},
|
|
732
|
-
[
|
|
733
|
-
),
|
|
732
|
+
[w]
|
|
733
|
+
), z = k(
|
|
734
734
|
(C) => {
|
|
735
735
|
const P = E.current;
|
|
736
736
|
if (P) {
|
|
@@ -738,13 +738,13 @@ const vr = ({
|
|
|
738
738
|
C.currentTarget.releasePointerCapture(C.pointerId);
|
|
739
739
|
} catch {
|
|
740
740
|
}
|
|
741
|
-
E.current = null, P.moved && (D(!1),
|
|
741
|
+
E.current = null, P.moved && (D(!1), b.current = !0, s((F) => (F !== null && Zt(F), F)));
|
|
742
742
|
}
|
|
743
743
|
},
|
|
744
744
|
[]
|
|
745
|
-
),
|
|
746
|
-
if (
|
|
747
|
-
|
|
745
|
+
), _ = k(() => {
|
|
746
|
+
if (b.current) {
|
|
747
|
+
b.current = !1;
|
|
748
748
|
return;
|
|
749
749
|
}
|
|
750
750
|
o();
|
|
@@ -755,40 +755,40 @@ const vr = ({
|
|
|
755
755
|
const P = C.key === "ArrowUp" ? -8 : 8;
|
|
756
756
|
s((F) => {
|
|
757
757
|
if (F === null) return F;
|
|
758
|
-
const G =
|
|
758
|
+
const G = w(F + P);
|
|
759
759
|
return Zt(G), G;
|
|
760
760
|
});
|
|
761
761
|
}
|
|
762
762
|
},
|
|
763
|
-
[
|
|
764
|
-
),
|
|
763
|
+
[w]
|
|
764
|
+
), q = [
|
|
765
765
|
"ll-hidden",
|
|
766
766
|
`ll-hidden--${d}`,
|
|
767
767
|
t ? "ll-hidden--mobile" : "ll-hidden--desktop",
|
|
768
768
|
r ? "ll-hidden--speaking" : null,
|
|
769
|
-
|
|
769
|
+
A ? "is-dragging" : null,
|
|
770
770
|
h ? "ll-hidden--with-avatar" : null
|
|
771
|
-
].filter(Boolean).join(" "),
|
|
771
|
+
].filter(Boolean).join(" "), O = a === null ? void 0 : { top: `${a - f / 2}px`, transform: "none" };
|
|
772
772
|
return /* @__PURE__ */ n(
|
|
773
773
|
"button",
|
|
774
774
|
{
|
|
775
775
|
type: "button",
|
|
776
|
-
className:
|
|
777
|
-
onPointerDown:
|
|
776
|
+
className: q,
|
|
777
|
+
onPointerDown: R,
|
|
778
778
|
onPointerMove: T,
|
|
779
|
-
onPointerUp:
|
|
780
|
-
onPointerCancel:
|
|
781
|
-
onClick:
|
|
779
|
+
onPointerUp: z,
|
|
780
|
+
onPointerCancel: z,
|
|
781
|
+
onClick: _,
|
|
782
782
|
onKeyDown: I,
|
|
783
783
|
"aria-label": i,
|
|
784
784
|
"data-position": e,
|
|
785
|
-
style:
|
|
785
|
+
style: O,
|
|
786
786
|
children: h ? (
|
|
787
787
|
// Layout: tiny chevron flush against the inward edge (peeks out
|
|
788
788
|
// as the click affordance), then the circular avatar photo
|
|
789
789
|
// taking the rest of the tab. Reinforces "this is an
|
|
790
790
|
// avatar-based experience" even when collapsed.
|
|
791
|
-
/* @__PURE__ */
|
|
791
|
+
/* @__PURE__ */ y(it, { children: [
|
|
792
792
|
/* @__PURE__ */ n(
|
|
793
793
|
Xt,
|
|
794
794
|
{
|
|
@@ -827,12 +827,12 @@ const vr = ({
|
|
|
827
827
|
const h = (Math.sqrt(5) - 1) / 2;
|
|
828
828
|
return Array.from({ length: t }, (a, s) => 0.5 + s * h % 1 * 0.5);
|
|
829
829
|
}, [t]);
|
|
830
|
-
|
|
830
|
+
N(() => e.subscribe((a) => {
|
|
831
831
|
for (let s = 0; s < t; s++) {
|
|
832
|
-
const
|
|
833
|
-
if (!
|
|
832
|
+
const A = d.current[s];
|
|
833
|
+
if (!A) continue;
|
|
834
834
|
const D = Math.max(o, a * r * c[s]);
|
|
835
|
-
|
|
835
|
+
A.style.height = `${D}px`;
|
|
836
836
|
}
|
|
837
837
|
}), [e, t, r, o, c]);
|
|
838
838
|
const f = ["ll-waveform", i].filter(Boolean).join(" ");
|
|
@@ -864,7 +864,7 @@ const vr = ({
|
|
|
864
864
|
className: "ll-minimized ll-minimized--mobile",
|
|
865
865
|
role: "region",
|
|
866
866
|
"aria-label": `${r} widget`,
|
|
867
|
-
children: /* @__PURE__ */
|
|
867
|
+
children: /* @__PURE__ */ y(
|
|
868
868
|
"button",
|
|
869
869
|
{
|
|
870
870
|
type: "button",
|
|
@@ -893,7 +893,7 @@ const vr = ({
|
|
|
893
893
|
}
|
|
894
894
|
),
|
|
895
895
|
/* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
|
|
896
|
-
/* @__PURE__ */
|
|
896
|
+
/* @__PURE__ */ y("div", { className: "ll-minimized__controls", children: [
|
|
897
897
|
/* @__PURE__ */ n(
|
|
898
898
|
"span",
|
|
899
899
|
{
|
|
@@ -923,7 +923,7 @@ const vr = ({
|
|
|
923
923
|
"data-position": e,
|
|
924
924
|
role: "region",
|
|
925
925
|
"aria-label": `${r} widget`,
|
|
926
|
-
children: /* @__PURE__ */
|
|
926
|
+
children: /* @__PURE__ */ y("div", { className: "ll-minimized__surface", children: [
|
|
927
927
|
o ? (
|
|
928
928
|
// eslint-disable-next-line @next/next/no-img-element
|
|
929
929
|
/* @__PURE__ */ n(
|
|
@@ -935,11 +935,11 @@ const vr = ({
|
|
|
935
935
|
}
|
|
936
936
|
)
|
|
937
937
|
) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
|
|
938
|
-
/* @__PURE__ */
|
|
938
|
+
/* @__PURE__ */ y("div", { className: "ll-minimized__meta", children: [
|
|
939
939
|
/* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
|
|
940
940
|
/* @__PURE__ */ n("span", { className: "ll-minimized__state", children: i === "speaking" ? "Speaking" : i === "thinking" ? "Thinking" : "Listening" })
|
|
941
941
|
] }),
|
|
942
|
-
/* @__PURE__ */
|
|
942
|
+
/* @__PURE__ */ y("div", { className: "ll-minimized__controls", children: [
|
|
943
943
|
/* @__PURE__ */ n(
|
|
944
944
|
"button",
|
|
945
945
|
{
|
|
@@ -981,7 +981,7 @@ const vr = ({
|
|
|
981
981
|
style: i
|
|
982
982
|
}) => {
|
|
983
983
|
const [l, u] = L(!1), d = S(e);
|
|
984
|
-
if (
|
|
984
|
+
if (N(() => {
|
|
985
985
|
d.current !== e && (d.current = e, u(!1));
|
|
986
986
|
}, [e]), !e) return null;
|
|
987
987
|
const c = {
|
|
@@ -1035,7 +1035,7 @@ const vr = ({
|
|
|
1035
1035
|
return c(), window.addEventListener("scroll", c, !0), window.addEventListener("resize", c), () => {
|
|
1036
1036
|
window.removeEventListener("scroll", c, !0), window.removeEventListener("resize", c);
|
|
1037
1037
|
};
|
|
1038
|
-
}, [e, r]),
|
|
1038
|
+
}, [e, r]), N(() => {
|
|
1039
1039
|
if (!e) return;
|
|
1040
1040
|
const d = (f) => {
|
|
1041
1041
|
const h = f.target, a = i.current, s = r.current;
|
|
@@ -1080,16 +1080,16 @@ const vr = ({
|
|
|
1080
1080
|
allowTyping: h,
|
|
1081
1081
|
isTypingOpen: a,
|
|
1082
1082
|
onToggleTyping: s,
|
|
1083
|
-
onDisconnect:
|
|
1083
|
+
onDisconnect: A
|
|
1084
1084
|
}) => {
|
|
1085
|
-
const [D, E] = L(!1),
|
|
1086
|
-
return /* @__PURE__ */
|
|
1087
|
-
/* @__PURE__ */
|
|
1085
|
+
const [D, E] = L(!1), b = S(null);
|
|
1086
|
+
return /* @__PURE__ */ y(it, { children: [
|
|
1087
|
+
/* @__PURE__ */ y(
|
|
1088
1088
|
"div",
|
|
1089
1089
|
{
|
|
1090
1090
|
className: "ll-toolbar ll-toolbar--compact",
|
|
1091
1091
|
"data-testid": "compact-toolbar",
|
|
1092
|
-
onClick: (
|
|
1092
|
+
onClick: (w) => w.stopPropagation(),
|
|
1093
1093
|
children: [
|
|
1094
1094
|
/* @__PURE__ */ n(
|
|
1095
1095
|
"button",
|
|
@@ -1104,10 +1104,10 @@ const vr = ({
|
|
|
1104
1104
|
/* @__PURE__ */ n(
|
|
1105
1105
|
"button",
|
|
1106
1106
|
{
|
|
1107
|
-
ref:
|
|
1107
|
+
ref: b,
|
|
1108
1108
|
type: "button",
|
|
1109
1109
|
className: `ll-tool ${D ? "is-on" : ""}`,
|
|
1110
|
-
onClick: () => E((
|
|
1110
|
+
onClick: () => E((w) => !w),
|
|
1111
1111
|
"aria-label": "More controls",
|
|
1112
1112
|
"aria-haspopup": "menu",
|
|
1113
1113
|
"aria-expanded": D,
|
|
@@ -1119,7 +1119,7 @@ const vr = ({
|
|
|
1119
1119
|
{
|
|
1120
1120
|
type: "button",
|
|
1121
1121
|
className: "ll-tool ll-tool--danger",
|
|
1122
|
-
onClick:
|
|
1122
|
+
onClick: A,
|
|
1123
1123
|
"aria-label": "End conversation",
|
|
1124
1124
|
children: /* @__PURE__ */ n(gn, {})
|
|
1125
1125
|
}
|
|
@@ -1127,14 +1127,14 @@ const vr = ({
|
|
|
1127
1127
|
]
|
|
1128
1128
|
}
|
|
1129
1129
|
),
|
|
1130
|
-
/* @__PURE__ */
|
|
1130
|
+
/* @__PURE__ */ y(
|
|
1131
1131
|
kr,
|
|
1132
1132
|
{
|
|
1133
1133
|
open: D,
|
|
1134
1134
|
onClose: () => E(!1),
|
|
1135
|
-
anchorRef:
|
|
1135
|
+
anchorRef: b,
|
|
1136
1136
|
children: [
|
|
1137
|
-
i && /* @__PURE__ */
|
|
1137
|
+
i && /* @__PURE__ */ y(
|
|
1138
1138
|
"button",
|
|
1139
1139
|
{
|
|
1140
1140
|
type: "button",
|
|
@@ -1148,7 +1148,7 @@ const vr = ({
|
|
|
1148
1148
|
]
|
|
1149
1149
|
}
|
|
1150
1150
|
),
|
|
1151
|
-
d && /* @__PURE__ */
|
|
1151
|
+
d && /* @__PURE__ */ y(
|
|
1152
1152
|
"button",
|
|
1153
1153
|
{
|
|
1154
1154
|
type: "button",
|
|
@@ -1162,7 +1162,7 @@ const vr = ({
|
|
|
1162
1162
|
]
|
|
1163
1163
|
}
|
|
1164
1164
|
),
|
|
1165
|
-
/* @__PURE__ */
|
|
1165
|
+
/* @__PURE__ */ y(
|
|
1166
1166
|
"button",
|
|
1167
1167
|
{
|
|
1168
1168
|
type: "button",
|
|
@@ -1176,7 +1176,7 @@ const vr = ({
|
|
|
1176
1176
|
]
|
|
1177
1177
|
}
|
|
1178
1178
|
),
|
|
1179
|
-
h && /* @__PURE__ */
|
|
1179
|
+
h && /* @__PURE__ */ y(
|
|
1180
1180
|
"button",
|
|
1181
1181
|
{
|
|
1182
1182
|
type: "button",
|
|
@@ -1190,7 +1190,7 @@ const vr = ({
|
|
|
1190
1190
|
]
|
|
1191
1191
|
}
|
|
1192
1192
|
),
|
|
1193
|
-
/* @__PURE__ */
|
|
1193
|
+
/* @__PURE__ */ y(
|
|
1194
1194
|
"button",
|
|
1195
1195
|
{
|
|
1196
1196
|
type: "button",
|
|
@@ -1209,7 +1209,7 @@ const vr = ({
|
|
|
1209
1209
|
] });
|
|
1210
1210
|
};
|
|
1211
1211
|
function Er() {
|
|
1212
|
-
return /* @__PURE__ */
|
|
1212
|
+
return /* @__PURE__ */ y(
|
|
1213
1213
|
"svg",
|
|
1214
1214
|
{
|
|
1215
1215
|
width: "16",
|
|
@@ -1256,18 +1256,18 @@ const Sr = ({
|
|
|
1256
1256
|
teamSwitcherOpen: h,
|
|
1257
1257
|
onToggleTeamSwitcher: a,
|
|
1258
1258
|
onSelectTeamMember: s,
|
|
1259
|
-
languageMenuOpen:
|
|
1259
|
+
languageMenuOpen: A,
|
|
1260
1260
|
onToggleLanguageMenu: D,
|
|
1261
1261
|
connectionState: E,
|
|
1262
|
-
agentState:
|
|
1263
|
-
transcript:
|
|
1264
|
-
canResume:
|
|
1262
|
+
agentState: b,
|
|
1263
|
+
transcript: w,
|
|
1264
|
+
canResume: R,
|
|
1265
1265
|
needsUserGesture: T,
|
|
1266
|
-
error:
|
|
1267
|
-
isMuted:
|
|
1266
|
+
error: z,
|
|
1267
|
+
isMuted: _,
|
|
1268
1268
|
micError: I,
|
|
1269
|
-
micDevices:
|
|
1270
|
-
isCameraEnabled:
|
|
1269
|
+
micDevices: q,
|
|
1270
|
+
isCameraEnabled: O,
|
|
1271
1271
|
cameraPreviewEl: C,
|
|
1272
1272
|
cameraDevices: P,
|
|
1273
1273
|
activeCameraId: F,
|
|
@@ -1280,13 +1280,13 @@ const Sr = ({
|
|
|
1280
1280
|
showMinimize: fe = !0,
|
|
1281
1281
|
chromeless: ae = !1,
|
|
1282
1282
|
compactControls: X = !1,
|
|
1283
|
-
transforming:
|
|
1283
|
+
transforming: at,
|
|
1284
1284
|
transformingLabel: je,
|
|
1285
|
-
avatarVideoContainerRef:
|
|
1285
|
+
avatarVideoContainerRef: st,
|
|
1286
1286
|
agentVideoEl: ne,
|
|
1287
1287
|
onConnect: Ve,
|
|
1288
1288
|
onDisconnect: Ye,
|
|
1289
|
-
onRetry:
|
|
1289
|
+
onRetry: ct,
|
|
1290
1290
|
onResumeAudio: Ge,
|
|
1291
1291
|
onToggleMute: Ee,
|
|
1292
1292
|
onToggleCamera: Ce,
|
|
@@ -1295,12 +1295,12 @@ const Sr = ({
|
|
|
1295
1295
|
onToggleSpeaker: Ne,
|
|
1296
1296
|
onSendMessage: Ae,
|
|
1297
1297
|
onMinimize: Re,
|
|
1298
|
-
onClose:
|
|
1298
|
+
onClose: $,
|
|
1299
1299
|
onClearMicError: vt
|
|
1300
1300
|
}) => {
|
|
1301
1301
|
var He;
|
|
1302
1302
|
const Ie = ((d == null ? void 0 : d.length) ?? 0) > 1, $e = E === "connecting" || E === "connected", re = E === "connected", Je = E === "idle" || E === "disconnected" || E === "error", [Te, ze] = L(!1);
|
|
1303
|
-
|
|
1303
|
+
N(() => {
|
|
1304
1304
|
if (!ne) {
|
|
1305
1305
|
ze(!1);
|
|
1306
1306
|
return;
|
|
@@ -1316,7 +1316,7 @@ const Sr = ({
|
|
|
1316
1316
|
};
|
|
1317
1317
|
}, [ne]);
|
|
1318
1318
|
const [bt, be] = L(!1);
|
|
1319
|
-
|
|
1319
|
+
N(() => {
|
|
1320
1320
|
if (!re) {
|
|
1321
1321
|
be(!1);
|
|
1322
1322
|
return;
|
|
@@ -1326,46 +1326,46 @@ const Sr = ({
|
|
|
1326
1326
|
return () => clearTimeout(m);
|
|
1327
1327
|
}, [re, Te]);
|
|
1328
1328
|
const Q = E === "connecting" || re && !!o && !Te && !bt, Ke = S(null), Me = S(null);
|
|
1329
|
-
|
|
1329
|
+
N(() => {
|
|
1330
1330
|
const m = Ke.current;
|
|
1331
1331
|
m && (m.innerHTML = "", C && (C.style.width = "100%", C.style.height = "100%", C.style.objectFit = "cover", C.style.transform = "scaleX(-1)", m.appendChild(C)));
|
|
1332
|
-
}, [C]),
|
|
1332
|
+
}, [C]), N(() => {
|
|
1333
1333
|
const m = Me.current;
|
|
1334
1334
|
m && (m.innerHTML = "", le && (le.style.width = "100%", le.style.height = "100%", le.style.objectFit = "contain", m.appendChild(le)));
|
|
1335
1335
|
}, [le]);
|
|
1336
1336
|
const [se, te] = L(!1), [pe, we] = L(!1);
|
|
1337
|
-
|
|
1338
|
-
if (!se && !pe && !
|
|
1337
|
+
N(() => {
|
|
1338
|
+
if (!se && !pe && !A && !h) return;
|
|
1339
1339
|
const m = () => {
|
|
1340
|
-
te(!1), we(!1),
|
|
1340
|
+
te(!1), we(!1), A && D(), h && a();
|
|
1341
1341
|
};
|
|
1342
1342
|
return document.addEventListener("click", m), () => document.removeEventListener("click", m);
|
|
1343
1343
|
}, [
|
|
1344
1344
|
se,
|
|
1345
1345
|
pe,
|
|
1346
|
-
|
|
1346
|
+
A,
|
|
1347
1347
|
h,
|
|
1348
1348
|
D,
|
|
1349
1349
|
a
|
|
1350
1350
|
]);
|
|
1351
|
-
const [oe, he] = L(!1), De = k(() => he((m) => !m), []), [_e,
|
|
1351
|
+
const [oe, he] = L(!1), De = k(() => he((m) => !m), []), [_e, dt] = L(""), Xe = k(
|
|
1352
1352
|
(m) => {
|
|
1353
1353
|
m.preventDefault();
|
|
1354
|
-
const
|
|
1355
|
-
|
|
1354
|
+
const V = _e.trim();
|
|
1355
|
+
V && (Ae(V), dt(""));
|
|
1356
1356
|
},
|
|
1357
1357
|
[_e, Ae]
|
|
1358
1358
|
), Qe = u.productName || "Live Layer";
|
|
1359
1359
|
let me = null, ce = null;
|
|
1360
|
-
for (let m =
|
|
1361
|
-
const
|
|
1362
|
-
if (!me &&
|
|
1360
|
+
for (let m = w.length - 1; m >= 0; m--) {
|
|
1361
|
+
const V = w[m];
|
|
1362
|
+
if (!me && V.role === "agent" ? me = V : !ce && V.role === "user" && (ce = V), me && ce) break;
|
|
1363
1363
|
}
|
|
1364
|
-
const Oe = re ? (me == null ? void 0 : me.text) || null : l || null,
|
|
1364
|
+
const Oe = re ? (me == null ? void 0 : me.text) || null : l || null, ut = re && (ce == null ? void 0 : ce.text) || null, wt = [
|
|
1365
1365
|
"ll-expanded",
|
|
1366
1366
|
t ? "ll-expanded--mobile" : "ll-expanded--desktop"
|
|
1367
1367
|
].join(" ");
|
|
1368
|
-
return /* @__PURE__ */
|
|
1368
|
+
return /* @__PURE__ */ y(
|
|
1369
1369
|
"div",
|
|
1370
1370
|
{
|
|
1371
1371
|
className: wt,
|
|
@@ -1374,7 +1374,7 @@ const Sr = ({
|
|
|
1374
1374
|
role: "dialog",
|
|
1375
1375
|
"aria-label": `${r} widget`,
|
|
1376
1376
|
children: [
|
|
1377
|
-
/* @__PURE__ */
|
|
1377
|
+
/* @__PURE__ */ y("div", { className: "ll-expanded__bg", children: [
|
|
1378
1378
|
o ? /* @__PURE__ */ n(
|
|
1379
1379
|
_r,
|
|
1380
1380
|
{
|
|
@@ -1395,12 +1395,12 @@ const Sr = ({
|
|
|
1395
1395
|
}
|
|
1396
1396
|
)
|
|
1397
1397
|
] }),
|
|
1398
|
-
/* @__PURE__ */ n("div", { ref:
|
|
1399
|
-
Q && /* @__PURE__ */
|
|
1398
|
+
/* @__PURE__ */ n("div", { ref: st, className: "ll-expanded__video" }),
|
|
1399
|
+
Q && /* @__PURE__ */ y("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
|
|
1400
1400
|
/* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
|
|
1401
1401
|
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: f ? "Switching..." : "Connecting..." })
|
|
1402
1402
|
] }),
|
|
1403
|
-
T && re && /* @__PURE__ */
|
|
1403
|
+
T && re && /* @__PURE__ */ y(
|
|
1404
1404
|
"button",
|
|
1405
1405
|
{
|
|
1406
1406
|
type: "button",
|
|
@@ -1412,7 +1412,7 @@ const Sr = ({
|
|
|
1412
1412
|
]
|
|
1413
1413
|
}
|
|
1414
1414
|
),
|
|
1415
|
-
|
|
1415
|
+
at && /* @__PURE__ */ y(
|
|
1416
1416
|
"div",
|
|
1417
1417
|
{
|
|
1418
1418
|
className: "ll-expanded__overlay ll-expanded__overlay--transforming",
|
|
@@ -1425,11 +1425,11 @@ const Sr = ({
|
|
|
1425
1425
|
]
|
|
1426
1426
|
}
|
|
1427
1427
|
),
|
|
1428
|
-
$e ? /* @__PURE__ */
|
|
1429
|
-
!X && /* @__PURE__ */
|
|
1430
|
-
!ae && /* @__PURE__ */
|
|
1431
|
-
/* @__PURE__ */
|
|
1432
|
-
/* @__PURE__ */
|
|
1428
|
+
$e ? /* @__PURE__ */ y(it, { children: [
|
|
1429
|
+
!X && /* @__PURE__ */ y("div", { className: "ll-expanded__topbar", children: [
|
|
1430
|
+
!ae && /* @__PURE__ */ y("div", { className: "ll-expanded__topbar-left", children: [
|
|
1431
|
+
/* @__PURE__ */ y("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1432
|
+
/* @__PURE__ */ y(
|
|
1433
1433
|
"button",
|
|
1434
1434
|
{
|
|
1435
1435
|
type: "button",
|
|
@@ -1451,7 +1451,7 @@ const Sr = ({
|
|
|
1451
1451
|
className: "ll-hmenu",
|
|
1452
1452
|
onClick: (m) => m.stopPropagation(),
|
|
1453
1453
|
role: "listbox",
|
|
1454
|
-
children: d == null ? void 0 : d.map((m) => /* @__PURE__ */
|
|
1454
|
+
children: d == null ? void 0 : d.map((m) => /* @__PURE__ */ y(
|
|
1455
1455
|
"button",
|
|
1456
1456
|
{
|
|
1457
1457
|
type: "button",
|
|
@@ -1477,8 +1477,8 @@ const Sr = ({
|
|
|
1477
1477
|
}
|
|
1478
1478
|
)
|
|
1479
1479
|
] }),
|
|
1480
|
-
/* @__PURE__ */
|
|
1481
|
-
/* @__PURE__ */
|
|
1480
|
+
/* @__PURE__ */ y("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1481
|
+
/* @__PURE__ */ y(
|
|
1482
1482
|
"button",
|
|
1483
1483
|
{
|
|
1484
1484
|
type: "button",
|
|
@@ -1487,7 +1487,7 @@ const Sr = ({
|
|
|
1487
1487
|
m.stopPropagation(), D();
|
|
1488
1488
|
},
|
|
1489
1489
|
"aria-haspopup": "listbox",
|
|
1490
|
-
"aria-expanded":
|
|
1490
|
+
"aria-expanded": A,
|
|
1491
1491
|
"aria-label": "Language: English",
|
|
1492
1492
|
title: "Language: English",
|
|
1493
1493
|
children: [
|
|
@@ -1496,7 +1496,7 @@ const Sr = ({
|
|
|
1496
1496
|
]
|
|
1497
1497
|
}
|
|
1498
1498
|
),
|
|
1499
|
-
|
|
1499
|
+
A && /* @__PURE__ */ n(
|
|
1500
1500
|
"div",
|
|
1501
1501
|
{
|
|
1502
1502
|
className: "ll-hmenu",
|
|
@@ -1518,12 +1518,12 @@ const Sr = ({
|
|
|
1518
1518
|
/* @__PURE__ */ n(
|
|
1519
1519
|
"span",
|
|
1520
1520
|
{
|
|
1521
|
-
className: `ll-expanded__state ll-expanded__state--${
|
|
1522
|
-
children:
|
|
1521
|
+
className: `ll-expanded__state ll-expanded__state--${b}`,
|
|
1522
|
+
children: b
|
|
1523
1523
|
}
|
|
1524
1524
|
)
|
|
1525
1525
|
] }),
|
|
1526
|
-
/* @__PURE__ */
|
|
1526
|
+
/* @__PURE__ */ y("div", { className: "ll-expanded__header-actions", children: [
|
|
1527
1527
|
fe !== !1 && /* @__PURE__ */ n(
|
|
1528
1528
|
"button",
|
|
1529
1529
|
{
|
|
@@ -1540,7 +1540,7 @@ const Sr = ({
|
|
|
1540
1540
|
{
|
|
1541
1541
|
type: "button",
|
|
1542
1542
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1543
|
-
onClick:
|
|
1543
|
+
onClick: $,
|
|
1544
1544
|
"aria-label": "End call",
|
|
1545
1545
|
title: "End call",
|
|
1546
1546
|
children: /* @__PURE__ */ n(tn, {})
|
|
@@ -1548,18 +1548,18 @@ const Sr = ({
|
|
|
1548
1548
|
)
|
|
1549
1549
|
] })
|
|
1550
1550
|
] }),
|
|
1551
|
-
X && /* @__PURE__ */
|
|
1551
|
+
X && /* @__PURE__ */ y("div", { className: "ll-compact-status", "data-state": b, children: [
|
|
1552
1552
|
/* @__PURE__ */ n("span", { className: "ll-compact-status__dot", "aria-hidden": !0 }),
|
|
1553
|
-
/* @__PURE__ */ n("span", { className: "ll-compact-status__label", children:
|
|
1553
|
+
/* @__PURE__ */ n("span", { className: "ll-compact-status__label", children: b })
|
|
1554
1554
|
] })
|
|
1555
1555
|
] }) : (
|
|
1556
1556
|
// Idle-state header with Live Layer product name + minimize/close.
|
|
1557
1557
|
// Hidden in compact mode — on a 140×210 docked slot the brand pill
|
|
1558
1558
|
// and 40px buttons crowded out the central "Start video call"
|
|
1559
1559
|
// affordance. The user can dismiss by scrolling past the slot.
|
|
1560
|
-
!X && /* @__PURE__ */
|
|
1560
|
+
!X && /* @__PURE__ */ y("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
|
|
1561
1561
|
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Qe }),
|
|
1562
|
-
/* @__PURE__ */
|
|
1562
|
+
/* @__PURE__ */ y("div", { className: "ll-expanded__header-actions", children: [
|
|
1563
1563
|
fe !== !1 && /* @__PURE__ */ n(
|
|
1564
1564
|
"button",
|
|
1565
1565
|
{
|
|
@@ -1575,7 +1575,7 @@ const Sr = ({
|
|
|
1575
1575
|
{
|
|
1576
1576
|
type: "button",
|
|
1577
1577
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1578
|
-
onClick:
|
|
1578
|
+
onClick: $,
|
|
1579
1579
|
"aria-label": "Close widget",
|
|
1580
1580
|
children: /* @__PURE__ */ n(tn, {})
|
|
1581
1581
|
}
|
|
@@ -1584,9 +1584,9 @@ const Sr = ({
|
|
|
1584
1584
|
] })
|
|
1585
1585
|
),
|
|
1586
1586
|
Je && /* @__PURE__ */ (() => {
|
|
1587
|
-
const m =
|
|
1588
|
-
return /* @__PURE__ */
|
|
1589
|
-
|
|
1587
|
+
const m = R ? "Resume session" : E === "disconnected" ? "Reconnect to agent" : "Start video call";
|
|
1588
|
+
return /* @__PURE__ */ y(it, { children: [
|
|
1589
|
+
!z && /* @__PURE__ */ y(
|
|
1590
1590
|
"button",
|
|
1591
1591
|
{
|
|
1592
1592
|
type: "button",
|
|
@@ -1595,13 +1595,12 @@ const Sr = ({
|
|
|
1595
1595
|
"aria-label": m,
|
|
1596
1596
|
children: [
|
|
1597
1597
|
/* @__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" }) }) }),
|
|
1598
|
-
/* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children: m })
|
|
1598
|
+
X && /* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children: m })
|
|
1599
1599
|
]
|
|
1600
1600
|
}
|
|
1601
1601
|
),
|
|
1602
|
-
!X && /* @__PURE__ */
|
|
1602
|
+
!X && /* @__PURE__ */ y("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
|
|
1603
1603
|
l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
|
|
1604
|
-
j && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: j }),
|
|
1605
1604
|
/* @__PURE__ */ n(
|
|
1606
1605
|
"button",
|
|
1607
1606
|
{
|
|
@@ -1615,10 +1614,10 @@ const Sr = ({
|
|
|
1615
1614
|
] })
|
|
1616
1615
|
] });
|
|
1617
1616
|
})(),
|
|
1618
|
-
/* @__PURE__ */
|
|
1617
|
+
/* @__PURE__ */ y(
|
|
1619
1618
|
"div",
|
|
1620
1619
|
{
|
|
1621
|
-
className: `ll-expanded__pip ${$e && (
|
|
1620
|
+
className: `ll-expanded__pip ${$e && (O || G) ? "is-visible" : ""}`,
|
|
1622
1621
|
children: [
|
|
1623
1622
|
/* @__PURE__ */ n(
|
|
1624
1623
|
"div",
|
|
@@ -1631,13 +1630,13 @@ const Sr = ({
|
|
|
1631
1630
|
"div",
|
|
1632
1631
|
{
|
|
1633
1632
|
ref: Ke,
|
|
1634
|
-
className: !G &&
|
|
1633
|
+
className: !G && O ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1635
1634
|
}
|
|
1636
1635
|
)
|
|
1637
1636
|
]
|
|
1638
1637
|
}
|
|
1639
1638
|
),
|
|
1640
|
-
$e ? /* @__PURE__ */
|
|
1639
|
+
$e ? /* @__PURE__ */ y("div", { className: "ll-expanded__bottom", children: [
|
|
1641
1640
|
!X && Oe && /* @__PURE__ */ n(
|
|
1642
1641
|
"div",
|
|
1643
1642
|
{
|
|
@@ -1646,15 +1645,15 @@ const Sr = ({
|
|
|
1646
1645
|
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Oe })
|
|
1647
1646
|
}
|
|
1648
1647
|
),
|
|
1649
|
-
!X &&
|
|
1648
|
+
!X && ut && /* @__PURE__ */ n(
|
|
1650
1649
|
"div",
|
|
1651
1650
|
{
|
|
1652
1651
|
className: "ll-expanded__transcript ll-expanded__transcript--user",
|
|
1653
1652
|
"data-role": "user",
|
|
1654
|
-
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children:
|
|
1653
|
+
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: ut })
|
|
1655
1654
|
}
|
|
1656
1655
|
),
|
|
1657
|
-
!ae && !X && /* @__PURE__ */
|
|
1656
|
+
!ae && !X && /* @__PURE__ */ y("div", { className: "ll-toolbar", onClick: (m) => m.stopPropagation(), children: [
|
|
1658
1657
|
ue && /* @__PURE__ */ n(
|
|
1659
1658
|
"button",
|
|
1660
1659
|
{
|
|
@@ -1666,15 +1665,15 @@ const Sr = ({
|
|
|
1666
1665
|
children: /* @__PURE__ */ n(fn, {})
|
|
1667
1666
|
}
|
|
1668
1667
|
),
|
|
1669
|
-
Le && /* @__PURE__ */
|
|
1668
|
+
Le && /* @__PURE__ */ y("div", { className: "ll-tool-split", children: [
|
|
1670
1669
|
/* @__PURE__ */ n(
|
|
1671
1670
|
"button",
|
|
1672
1671
|
{
|
|
1673
1672
|
type: "button",
|
|
1674
|
-
className: `ll-tool ll-tool--left ${
|
|
1673
|
+
className: `ll-tool ll-tool--left ${O ? "is-on" : ""}`,
|
|
1675
1674
|
onClick: Ce,
|
|
1676
|
-
"aria-label":
|
|
1677
|
-
title:
|
|
1675
|
+
"aria-label": O ? "Turn off camera" : "Turn on camera",
|
|
1676
|
+
title: O ? "Stop camera" : "Start camera",
|
|
1678
1677
|
children: /* @__PURE__ */ n(pn, {})
|
|
1679
1678
|
}
|
|
1680
1679
|
),
|
|
@@ -1682,9 +1681,9 @@ const Sr = ({
|
|
|
1682
1681
|
"button",
|
|
1683
1682
|
{
|
|
1684
1683
|
type: "button",
|
|
1685
|
-
className: `ll-tool ll-tool--right ${
|
|
1684
|
+
className: `ll-tool ll-tool--right ${O ? "is-on" : ""}`,
|
|
1686
1685
|
onClick: (m) => {
|
|
1687
|
-
m.stopPropagation(), we((
|
|
1686
|
+
m.stopPropagation(), we((V) => !V), te(!1);
|
|
1688
1687
|
},
|
|
1689
1688
|
"aria-label": "Camera devices",
|
|
1690
1689
|
"aria-haspopup": "listbox",
|
|
@@ -1704,25 +1703,25 @@ const Sr = ({
|
|
|
1704
1703
|
}
|
|
1705
1704
|
)
|
|
1706
1705
|
] }),
|
|
1707
|
-
/* @__PURE__ */
|
|
1706
|
+
/* @__PURE__ */ y("div", { className: "ll-tool-split", children: [
|
|
1708
1707
|
/* @__PURE__ */ n(
|
|
1709
1708
|
"button",
|
|
1710
1709
|
{
|
|
1711
1710
|
type: "button",
|
|
1712
|
-
className: `ll-tool ll-tool--left ${
|
|
1711
|
+
className: `ll-tool ll-tool--left ${_ ? "is-muted" : ""}`,
|
|
1713
1712
|
onClick: Ee,
|
|
1714
|
-
"aria-label":
|
|
1715
|
-
title:
|
|
1716
|
-
children: /* @__PURE__ */ n(hn, { muted:
|
|
1713
|
+
"aria-label": _ ? "Unmute microphone" : "Mute microphone",
|
|
1714
|
+
title: _ ? "Unmute" : "Mute",
|
|
1715
|
+
children: /* @__PURE__ */ n(hn, { muted: _ })
|
|
1717
1716
|
}
|
|
1718
1717
|
),
|
|
1719
1718
|
/* @__PURE__ */ n(
|
|
1720
1719
|
"button",
|
|
1721
1720
|
{
|
|
1722
1721
|
type: "button",
|
|
1723
|
-
className: `ll-tool ll-tool--right ${
|
|
1722
|
+
className: `ll-tool ll-tool--right ${_ ? "is-muted" : ""}`,
|
|
1724
1723
|
onClick: (m) => {
|
|
1725
|
-
m.stopPropagation(), te((
|
|
1724
|
+
m.stopPropagation(), te((V) => !V), we(!1);
|
|
1726
1725
|
},
|
|
1727
1726
|
"aria-label": "Microphone devices",
|
|
1728
1727
|
"aria-haspopup": "listbox",
|
|
@@ -1730,11 +1729,11 @@ const Sr = ({
|
|
|
1730
1729
|
children: /* @__PURE__ */ n(ht, {})
|
|
1731
1730
|
}
|
|
1732
1731
|
),
|
|
1733
|
-
se &&
|
|
1732
|
+
se && q.length > 0 && /* @__PURE__ */ n(
|
|
1734
1733
|
rn,
|
|
1735
1734
|
{
|
|
1736
1735
|
label: "Microphone",
|
|
1737
|
-
devices:
|
|
1736
|
+
devices: q,
|
|
1738
1737
|
activeId: "",
|
|
1739
1738
|
onPick: () => te(!1)
|
|
1740
1739
|
}
|
|
@@ -1766,9 +1765,9 @@ const Sr = ({
|
|
|
1766
1765
|
!ae && X && /* @__PURE__ */ n(
|
|
1767
1766
|
Lr,
|
|
1768
1767
|
{
|
|
1769
|
-
isMuted:
|
|
1768
|
+
isMuted: _,
|
|
1770
1769
|
onToggleMute: Ee,
|
|
1771
|
-
isCameraEnabled:
|
|
1770
|
+
isCameraEnabled: O,
|
|
1772
1771
|
onToggleCamera: Ce,
|
|
1773
1772
|
allowCamera: Le,
|
|
1774
1773
|
isScreenShareEnabled: G,
|
|
@@ -1782,7 +1781,7 @@ const Sr = ({
|
|
|
1782
1781
|
onDisconnect: Ye
|
|
1783
1782
|
}
|
|
1784
1783
|
),
|
|
1785
|
-
!ae && ve && (X ? oe : !0) && /* @__PURE__ */
|
|
1784
|
+
!ae && ve && (X ? oe : !0) && /* @__PURE__ */ y("form", { className: "ll-message-input", onSubmit: Xe, children: [
|
|
1786
1785
|
/* @__PURE__ */ n(
|
|
1787
1786
|
"input",
|
|
1788
1787
|
{
|
|
@@ -1790,7 +1789,7 @@ const Sr = ({
|
|
|
1790
1789
|
className: "ll-message-input__field",
|
|
1791
1790
|
placeholder: "Message...",
|
|
1792
1791
|
value: _e,
|
|
1793
|
-
onChange: (m) =>
|
|
1792
|
+
onChange: (m) => dt(m.target.value),
|
|
1794
1793
|
"aria-label": "Message the agent"
|
|
1795
1794
|
}
|
|
1796
1795
|
),
|
|
@@ -1807,7 +1806,7 @@ const Sr = ({
|
|
|
1807
1806
|
] }) : null,
|
|
1808
1807
|
(() => {
|
|
1809
1808
|
if (I && E !== "error")
|
|
1810
|
-
return /* @__PURE__ */
|
|
1809
|
+
return /* @__PURE__ */ y("div", { className: "ll-expanded__banner", role: "alert", children: [
|
|
1811
1810
|
/* @__PURE__ */ n("span", { children: I }),
|
|
1812
1811
|
/* @__PURE__ */ n(
|
|
1813
1812
|
"button",
|
|
@@ -1820,17 +1819,17 @@ const Sr = ({
|
|
|
1820
1819
|
}
|
|
1821
1820
|
)
|
|
1822
1821
|
] });
|
|
1823
|
-
if (
|
|
1824
|
-
let m = "Failed to connect",
|
|
1825
|
-
return
|
|
1822
|
+
if (!z || E !== "error") return null;
|
|
1823
|
+
let m = "Failed to connect", V = "Try again";
|
|
1824
|
+
return z === "MIC_PERMISSION_DENIED" ? m = "Microphone blocked. Allow access to talk." : z === "MIC_NOT_FOUND" ? m = "No microphone found. Plug one in + retry." : z === "MIC_UNAVAILABLE" ? m = "Mic unavailable. Check other apps using it." : z === "AGENT_TIMEOUT" ? m = "Agent didn't pick up. Try again." : z === "CONNECT_FAILED" ? m = "Connection failed. Check your network." : z.length < 80 && (m = z), /* @__PURE__ */ y("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
|
|
1826
1825
|
/* @__PURE__ */ n("span", { children: m }),
|
|
1827
1826
|
/* @__PURE__ */ n(
|
|
1828
1827
|
"button",
|
|
1829
1828
|
{
|
|
1830
1829
|
type: "button",
|
|
1831
1830
|
className: "ll-expanded__banner-retry",
|
|
1832
|
-
onClick:
|
|
1833
|
-
children:
|
|
1831
|
+
onClick: ct,
|
|
1832
|
+
children: V
|
|
1834
1833
|
}
|
|
1835
1834
|
)
|
|
1836
1835
|
] });
|
|
@@ -1843,7 +1842,7 @@ function ht() {
|
|
|
1843
1842
|
return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ n("polyline", { points: "6 9 12 15 18 9" }) });
|
|
1844
1843
|
}
|
|
1845
1844
|
function tn() {
|
|
1846
|
-
return /* @__PURE__ */
|
|
1845
|
+
return /* @__PURE__ */ y("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
|
|
1847
1846
|
/* @__PURE__ */ n("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1848
1847
|
/* @__PURE__ */ n("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1849
1848
|
] });
|
|
@@ -1852,20 +1851,20 @@ function nn() {
|
|
|
1852
1851
|
return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
|
|
1853
1852
|
}
|
|
1854
1853
|
function fn() {
|
|
1855
|
-
return /* @__PURE__ */
|
|
1854
|
+
return /* @__PURE__ */ y("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: [
|
|
1856
1855
|
/* @__PURE__ */ n("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
|
|
1857
1856
|
/* @__PURE__ */ n("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
|
|
1858
1857
|
/* @__PURE__ */ n("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
|
|
1859
1858
|
] });
|
|
1860
1859
|
}
|
|
1861
1860
|
function pn() {
|
|
1862
|
-
return /* @__PURE__ */
|
|
1861
|
+
return /* @__PURE__ */ y("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: [
|
|
1863
1862
|
/* @__PURE__ */ n("path", { d: "M23 7l-7 5 7 5V7z" }),
|
|
1864
1863
|
/* @__PURE__ */ n("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
|
|
1865
1864
|
] });
|
|
1866
1865
|
}
|
|
1867
1866
|
function hn({ muted: e }) {
|
|
1868
|
-
return /* @__PURE__ */
|
|
1867
|
+
return /* @__PURE__ */ y("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: [
|
|
1869
1868
|
/* @__PURE__ */ n("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
|
|
1870
1869
|
/* @__PURE__ */ n("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
|
|
1871
1870
|
/* @__PURE__ */ n("line", { x1: "12", y1: "19", x2: "12", y2: "23" }),
|
|
@@ -1873,16 +1872,16 @@ function hn({ muted: e }) {
|
|
|
1873
1872
|
] });
|
|
1874
1873
|
}
|
|
1875
1874
|
function mn({ muted: e }) {
|
|
1876
|
-
return /* @__PURE__ */
|
|
1875
|
+
return /* @__PURE__ */ y("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: [
|
|
1877
1876
|
/* @__PURE__ */ n("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
1878
|
-
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */
|
|
1877
|
+
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ y(it, { children: [
|
|
1879
1878
|
/* @__PURE__ */ n("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
|
|
1880
1879
|
/* @__PURE__ */ n("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
|
|
1881
1880
|
] })
|
|
1882
1881
|
] });
|
|
1883
1882
|
}
|
|
1884
1883
|
function Nr() {
|
|
1885
|
-
return /* @__PURE__ */
|
|
1884
|
+
return /* @__PURE__ */ y("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1886
1885
|
/* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
|
|
1887
1886
|
/* @__PURE__ */ n("polyline", { points: "12 5 19 12 12 19" })
|
|
1888
1887
|
] });
|
|
@@ -1896,7 +1895,7 @@ function gn() {
|
|
|
1896
1895
|
}
|
|
1897
1896
|
) });
|
|
1898
1897
|
}
|
|
1899
|
-
const rn = ({ label: e, devices: t, activeId: r, onPick: o }) => /* @__PURE__ */
|
|
1898
|
+
const rn = ({ label: e, devices: t, activeId: r, onPick: o }) => /* @__PURE__ */ y(
|
|
1900
1899
|
"div",
|
|
1901
1900
|
{
|
|
1902
1901
|
className: "ll-device-menu",
|
|
@@ -1906,7 +1905,7 @@ const rn = ({ label: e, devices: t, activeId: r, onPick: o }) => /* @__PURE__ */
|
|
|
1906
1905
|
/* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
|
|
1907
1906
|
t.map((i, l) => {
|
|
1908
1907
|
const u = r === i.deviceId;
|
|
1909
|
-
return /* @__PURE__ */
|
|
1908
|
+
return /* @__PURE__ */ y(
|
|
1910
1909
|
"button",
|
|
1911
1910
|
{
|
|
1912
1911
|
type: "button",
|
|
@@ -1954,7 +1953,7 @@ const mt = 4096, Rr = 20, Ir = 20, Tr = 10, Mr = 10, Dr = 30, Pr = 20, on = 500,
|
|
|
1954
1953
|
"noscript",
|
|
1955
1954
|
"iframe"
|
|
1956
1955
|
];
|
|
1957
|
-
function
|
|
1956
|
+
function rt(e) {
|
|
1958
1957
|
if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
|
|
1959
1958
|
let t = e;
|
|
1960
1959
|
for (; t; ) {
|
|
@@ -1964,7 +1963,7 @@ function ot(e) {
|
|
|
1964
1963
|
}
|
|
1965
1964
|
return !1;
|
|
1966
1965
|
}
|
|
1967
|
-
function
|
|
1966
|
+
function ot(e) {
|
|
1968
1967
|
if (typeof window > "u") return !0;
|
|
1969
1968
|
const t = e.getBoundingClientRect();
|
|
1970
1969
|
if (t.width <= 0 || t.height <= 0) return !1;
|
|
@@ -2007,62 +2006,62 @@ function zr(e, t = {}) {
|
|
|
2007
2006
|
const o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "", u = Array.from(
|
|
2008
2007
|
r.querySelectorAll("[data-ll-region]")
|
|
2009
2008
|
), d = [];
|
|
2010
|
-
for (const
|
|
2009
|
+
for (const _ of u) {
|
|
2011
2010
|
if (d.length >= Tr) break;
|
|
2012
|
-
if (
|
|
2013
|
-
const I =
|
|
2014
|
-
(
|
|
2011
|
+
if (rt(_) || !ot(_)) continue;
|
|
2012
|
+
const I = _.getAttribute("data-ll-region") ?? "", q = _.getAttribute("data-ll-intent") ?? void 0, O = ye(
|
|
2013
|
+
(_.innerText || _.textContent || "").trim(),
|
|
2015
2014
|
on * 2
|
|
2016
2015
|
);
|
|
2017
|
-
!I || !
|
|
2016
|
+
!I || !O || d.push({ id: I, intent: q, text: O });
|
|
2018
2017
|
}
|
|
2019
2018
|
const c = [], f = ["H1", "H2", "H3", "H4", "H5", "H6"], h = Array.from(
|
|
2020
2019
|
r.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
|
2021
2020
|
);
|
|
2022
|
-
for (const
|
|
2023
|
-
if (
|
|
2024
|
-
const I = (
|
|
2025
|
-
I && c.push(`${
|
|
2021
|
+
for (const _ of h) {
|
|
2022
|
+
if (rt(_) || !ot(_)) continue;
|
|
2023
|
+
const I = (_.textContent || "").trim();
|
|
2024
|
+
I && c.push(`${_.tagName}: ${ye(I, 200)}`);
|
|
2026
2025
|
}
|
|
2027
2026
|
const a = Array.from(r.querySelectorAll("p, li"));
|
|
2028
|
-
for (const
|
|
2029
|
-
if (
|
|
2030
|
-
const I = (
|
|
2027
|
+
for (const _ of a) {
|
|
2028
|
+
if (rt(_) || !ot(_) || f.includes(_.tagName)) continue;
|
|
2029
|
+
const I = (_.textContent || "").trim();
|
|
2031
2030
|
I.length > 10 && c.push(ye(I, on));
|
|
2032
2031
|
}
|
|
2033
2032
|
const s = c.join(`
|
|
2034
|
-
`),
|
|
2035
|
-
for (const
|
|
2036
|
-
if (
|
|
2037
|
-
if (
|
|
2038
|
-
const I =
|
|
2039
|
-
!I || !
|
|
2033
|
+
`), A = [], D = Array.from(r.querySelectorAll("a[href]"));
|
|
2034
|
+
for (const _ of D) {
|
|
2035
|
+
if (A.length >= Rr) break;
|
|
2036
|
+
if (rt(_) || !ot(_)) continue;
|
|
2037
|
+
const I = _.getAttribute("href") || "", q = (_.textContent || "").trim();
|
|
2038
|
+
!I || !q || A.push({ href: I, text: ye(q, 100) });
|
|
2040
2039
|
}
|
|
2041
|
-
const E = [],
|
|
2040
|
+
const E = [], b = Array.from(
|
|
2042
2041
|
r.querySelectorAll(
|
|
2043
2042
|
"input, textarea, select"
|
|
2044
2043
|
)
|
|
2045
2044
|
);
|
|
2046
|
-
for (const
|
|
2045
|
+
for (const _ of b) {
|
|
2047
2046
|
if (E.length >= Ir) break;
|
|
2048
|
-
if (
|
|
2049
|
-
const I = ln(
|
|
2050
|
-
I && E.push({ label: ye(I, 100), type:
|
|
2047
|
+
if (rt(_) || !yt(_) || !ot(_)) continue;
|
|
2048
|
+
const I = ln(_), q = _ instanceof HTMLInputElement ? _.type : _.tagName.toLowerCase();
|
|
2049
|
+
I && E.push({ label: ye(I, 100), type: q });
|
|
2051
2050
|
}
|
|
2052
|
-
const
|
|
2051
|
+
const w = Array.from(
|
|
2053
2052
|
r.querySelectorAll("[data-ll-form]")
|
|
2054
|
-
),
|
|
2055
|
-
for (const
|
|
2056
|
-
if (
|
|
2057
|
-
if (At(
|
|
2058
|
-
const I =
|
|
2053
|
+
), R = [];
|
|
2054
|
+
for (const _ of w) {
|
|
2055
|
+
if (R.length >= Mr) break;
|
|
2056
|
+
if (At(_)) continue;
|
|
2057
|
+
const I = _.getAttribute("data-ll-form") || "";
|
|
2059
2058
|
if (!I) continue;
|
|
2060
|
-
const
|
|
2061
|
-
|
|
2059
|
+
const q = _.getAttribute("data-ll-intent") || void 0, O = Array.from(
|
|
2060
|
+
_.querySelectorAll(
|
|
2062
2061
|
"[data-ll-field]"
|
|
2063
2062
|
)
|
|
2064
2063
|
), C = [];
|
|
2065
|
-
for (const P of
|
|
2064
|
+
for (const P of O) {
|
|
2066
2065
|
if (C.length >= Dr) break;
|
|
2067
2066
|
if (!yt(P)) continue;
|
|
2068
2067
|
const F = P.getAttribute("data-ll-field") || "";
|
|
@@ -2085,7 +2084,7 @@ function zr(e, t = {}) {
|
|
|
2085
2084
|
const Le = typeof P.validationMessage == "string" ? P.validationMessage : "";
|
|
2086
2085
|
Le && (ee.validationMessage = ye(Le, 200)), C.push(ee);
|
|
2087
2086
|
}
|
|
2088
|
-
|
|
2087
|
+
R.push({ id: I, intent: q, fields: C });
|
|
2089
2088
|
}
|
|
2090
2089
|
const T = {
|
|
2091
2090
|
url: o,
|
|
@@ -2093,16 +2092,16 @@ function zr(e, t = {}) {
|
|
|
2093
2092
|
pathname: i,
|
|
2094
2093
|
regions: d,
|
|
2095
2094
|
visibleText: s,
|
|
2096
|
-
visibleLinks:
|
|
2095
|
+
visibleLinks: A,
|
|
2097
2096
|
visibleFields: E,
|
|
2098
|
-
forms:
|
|
2097
|
+
forms: R,
|
|
2099
2098
|
extras: e
|
|
2100
2099
|
};
|
|
2101
|
-
let
|
|
2102
|
-
for (;
|
|
2103
|
-
T.visibleFields.pop(),
|
|
2104
|
-
for (;
|
|
2105
|
-
T.visibleLinks.pop(),
|
|
2100
|
+
let z = Be(JSON.stringify(T.regions)) + Be(T.visibleText) + Be(JSON.stringify(T.visibleLinks)) + Be(JSON.stringify(T.visibleFields));
|
|
2101
|
+
for (; z > mt && T.visibleFields.length > 0; )
|
|
2102
|
+
T.visibleFields.pop(), z = Be(JSON.stringify(T.visibleFields));
|
|
2103
|
+
for (; z > mt && T.visibleLinks.length > 0; )
|
|
2104
|
+
T.visibleLinks.pop(), z -= 80;
|
|
2106
2105
|
return Be(T.visibleText) > mt && (T.visibleText = ye(T.visibleText, mt - 100)), T;
|
|
2107
2106
|
}
|
|
2108
2107
|
let qe = null;
|
|
@@ -2250,7 +2249,7 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2250
2249
|
"focus_field",
|
|
2251
2250
|
"submit_form",
|
|
2252
2251
|
"request_routes"
|
|
2253
|
-
]), yn =
|
|
2252
|
+
]), yn = lt(
|
|
2254
2253
|
function(t, r) {
|
|
2255
2254
|
var Ot, Ht, Wt, Bt, qt, Ft, Ut;
|
|
2256
2255
|
const {
|
|
@@ -2264,18 +2263,18 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2264
2263
|
autoConnect: h = !1,
|
|
2265
2264
|
displayMode: a,
|
|
2266
2265
|
defaultDisplayMode: s = "expanded",
|
|
2267
|
-
onDisplayModeChange:
|
|
2266
|
+
onDisplayModeChange: A,
|
|
2268
2267
|
position: D = "bottom-right",
|
|
2269
2268
|
mobileBreakpoint: E = 640,
|
|
2270
|
-
persistKey:
|
|
2271
|
-
disablePersistence:
|
|
2272
|
-
teamMembers:
|
|
2269
|
+
persistKey: b = "ll-widget",
|
|
2270
|
+
disablePersistence: w = !1,
|
|
2271
|
+
teamMembers: R,
|
|
2273
2272
|
currentTeamMemberId: T,
|
|
2274
|
-
onTeamMemberChange:
|
|
2275
|
-
idleLoopUrl:
|
|
2273
|
+
onTeamMemberChange: z,
|
|
2274
|
+
idleLoopUrl: _,
|
|
2276
2275
|
greeting: I,
|
|
2277
|
-
avatarImageUrl:
|
|
2278
|
-
agentName:
|
|
2276
|
+
avatarImageUrl: q,
|
|
2277
|
+
agentName: O,
|
|
2279
2278
|
branding: C = {},
|
|
2280
2279
|
allowCamera: P = !0,
|
|
2281
2280
|
allowScreenShare: F = !0,
|
|
@@ -2288,13 +2287,13 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2288
2287
|
showOn: fe,
|
|
2289
2288
|
hideOn: ae,
|
|
2290
2289
|
pathname: X,
|
|
2291
|
-
onNavigate:
|
|
2290
|
+
onNavigate: at,
|
|
2292
2291
|
onScrollToSelector: je,
|
|
2293
|
-
getPageContext:
|
|
2292
|
+
getPageContext: st,
|
|
2294
2293
|
pageContextExtras: ne,
|
|
2295
2294
|
getRoutes: Ve,
|
|
2296
2295
|
onScrollPage: Ye,
|
|
2297
|
-
onClick:
|
|
2296
|
+
onClick: ct,
|
|
2298
2297
|
capabilities: Ge,
|
|
2299
2298
|
onConnect: Ee,
|
|
2300
2299
|
onDisconnect: Ce,
|
|
@@ -2303,45 +2302,45 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2303
2302
|
onConnectionStateChange: Ne,
|
|
2304
2303
|
onAgentEvent: Ae,
|
|
2305
2304
|
onAgentCommand: Re,
|
|
2306
|
-
controlledSession:
|
|
2305
|
+
controlledSession: $,
|
|
2307
2306
|
className: vt,
|
|
2308
2307
|
style: Ie,
|
|
2309
2308
|
zIndex: $e = 2147483647
|
|
2310
2309
|
} = t, re = rr(X), Je = dr(re, fe, ae);
|
|
2311
|
-
|
|
2310
|
+
N(() => {
|
|
2312
2311
|
Or(), Ur();
|
|
2313
2312
|
}, [re]);
|
|
2314
2313
|
const Te = T !== void 0, [ze, bt] = L(() => {
|
|
2315
|
-
var
|
|
2316
|
-
return T ?? ((
|
|
2314
|
+
var g;
|
|
2315
|
+
return T ?? ((g = R == null ? void 0 : R[0]) == null ? void 0 : g.id);
|
|
2317
2316
|
}), be = Te ? T : ze, Q = Ue(
|
|
2318
|
-
() => (
|
|
2319
|
-
[
|
|
2317
|
+
() => (R == null ? void 0 : R.find((g) => g.id === be)) ?? null,
|
|
2318
|
+
[R, be]
|
|
2320
2319
|
), Ke = (Q == null ? void 0 : Q.agentId) ?? o, Me = f === "EMBEDDED", [se, te] = Zn({
|
|
2321
2320
|
value: Me ? "expanded" : a,
|
|
2322
2321
|
defaultValue: Me ? "expanded" : s,
|
|
2323
|
-
onChange:
|
|
2324
|
-
persistKey:
|
|
2325
|
-
disablePersistence: Me ||
|
|
2326
|
-
}), pe = tr(E), we = Bn(), oe = qn(), he = Un(), De = jn(), _e = Vn(), [
|
|
2327
|
-
|
|
2328
|
-
const _t = S(
|
|
2329
|
-
_t.current =
|
|
2330
|
-
function xe(
|
|
2322
|
+
onChange: A,
|
|
2323
|
+
persistKey: b,
|
|
2324
|
+
disablePersistence: Me || w
|
|
2325
|
+
}), pe = tr(E), we = Bn(), oe = qn(), he = Un(), De = jn(), _e = Vn(), [dt, Xe] = L(!1), [Qe, me] = L(!1), [ce, Oe] = L(!1), [ut, wt] = L(!1), [He, m] = L(!1), V = fr({ baseUrl: l, config: c }), ft = S(V);
|
|
2326
|
+
ft.current = V;
|
|
2327
|
+
const _t = S(at), xt = S(je), kt = S(Ye), Lt = S(ct), Rt = S(st), It = S(ne), Tt = S(Ve), Et = S(Ge), de = S(null);
|
|
2328
|
+
_t.current = at, xt.current = je, kt.current = Ye, Lt.current = ct, Rt.current = st, It.current = ne, Tt.current = Ve, Et.current = Ge;
|
|
2329
|
+
function xe(g) {
|
|
2331
2330
|
const p = Et.current;
|
|
2332
|
-
return p ? p.includes(
|
|
2331
|
+
return p ? p.includes(g) : !0;
|
|
2333
2332
|
}
|
|
2334
|
-
function ke(
|
|
2333
|
+
function ke(g, p) {
|
|
2335
2334
|
console.warn(
|
|
2336
|
-
`[LiveLayer] Agent command "${
|
|
2335
|
+
`[LiveLayer] Agent command "${g}" blocked — capability "${p}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
|
|
2337
2336
|
);
|
|
2338
2337
|
}
|
|
2339
|
-
const
|
|
2340
|
-
(
|
|
2341
|
-
var Y, ie, ge,
|
|
2342
|
-
const p =
|
|
2338
|
+
const Ze = k(
|
|
2339
|
+
(g) => {
|
|
2340
|
+
var Y, ie, ge, nt;
|
|
2341
|
+
const p = g;
|
|
2343
2342
|
if (!(!p.type || typeof p.type != "string")) {
|
|
2344
|
-
if (Ae == null || Ae({ eventName: p.type, data:
|
|
2343
|
+
if (Ae == null || Ae({ eventName: p.type, data: g }), p.type === "navigate") {
|
|
2345
2344
|
if (!xe("navigate")) {
|
|
2346
2345
|
ke("navigate", "navigate");
|
|
2347
2346
|
return;
|
|
@@ -2353,7 +2352,7 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2353
2352
|
);
|
|
2354
2353
|
return;
|
|
2355
2354
|
}
|
|
2356
|
-
if (
|
|
2355
|
+
if (ft.current.playPageChange(), _t.current) {
|
|
2357
2356
|
try {
|
|
2358
2357
|
_t.current(x);
|
|
2359
2358
|
} catch (M) {
|
|
@@ -2398,28 +2397,28 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2398
2397
|
x,
|
|
2399
2398
|
M
|
|
2400
2399
|
);
|
|
2401
|
-
} catch (
|
|
2402
|
-
console.warn("[LiveLayer] onScrollToSelector threw.",
|
|
2400
|
+
} catch (B) {
|
|
2401
|
+
console.warn("[LiveLayer] onScrollToSelector threw.", B);
|
|
2403
2402
|
}
|
|
2404
2403
|
return;
|
|
2405
2404
|
}
|
|
2406
2405
|
if (typeof document < "u") {
|
|
2407
|
-
let
|
|
2406
|
+
let B = null;
|
|
2408
2407
|
try {
|
|
2409
|
-
|
|
2408
|
+
B = document.querySelector(x);
|
|
2410
2409
|
} catch {
|
|
2411
2410
|
console.warn(
|
|
2412
2411
|
`[LiveLayer] scroll_to: invalid selector "${x}".`
|
|
2413
2412
|
);
|
|
2414
2413
|
return;
|
|
2415
2414
|
}
|
|
2416
|
-
if (!
|
|
2415
|
+
if (!B) {
|
|
2417
2416
|
console.warn(
|
|
2418
2417
|
`[LiveLayer] scroll_to: no element matched "${x}". The user may be on a different page. See https://livelayer.studio/docs/errors/scroll-no-match`
|
|
2419
2418
|
);
|
|
2420
2419
|
return;
|
|
2421
2420
|
}
|
|
2422
|
-
|
|
2421
|
+
B.scrollIntoView({
|
|
2423
2422
|
behavior: M,
|
|
2424
2423
|
block: "start"
|
|
2425
2424
|
});
|
|
@@ -2431,45 +2430,45 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2431
2430
|
ke("request_page_context", "read_page");
|
|
2432
2431
|
return;
|
|
2433
2432
|
}
|
|
2434
|
-
const x = typeof p.requestId == "string" ? p.requestId : void 0, M = (Y = de.current) == null ? void 0 : Y.call(de),
|
|
2435
|
-
const
|
|
2433
|
+
const x = typeof p.requestId == "string" ? p.requestId : void 0, M = (Y = de.current) == null ? void 0 : Y.call(de), B = (j) => {
|
|
2434
|
+
const H = M, K = H == null ? void 0 : H.localParticipant;
|
|
2436
2435
|
if (K != null && K.publishData)
|
|
2437
2436
|
try {
|
|
2438
|
-
const Z = x ? { ...
|
|
2437
|
+
const Z = x ? { ...j, requestId: x } : j, We = new TextEncoder().encode(JSON.stringify(Z));
|
|
2439
2438
|
K.publishData(We, { reliable: !0 });
|
|
2440
2439
|
} catch (Z) {
|
|
2441
2440
|
console.warn("[LiveLayer] publishData failed.", Z);
|
|
2442
2441
|
}
|
|
2443
|
-
},
|
|
2442
|
+
}, W = It.current, U = Rt.current;
|
|
2444
2443
|
try {
|
|
2445
2444
|
if (U) {
|
|
2446
|
-
const
|
|
2447
|
-
if (
|
|
2448
|
-
|
|
2445
|
+
const j = U(W);
|
|
2446
|
+
if (j instanceof Promise) {
|
|
2447
|
+
B({ type: "page_context_pending" }), j.then((H) => B({ type: "page_context", context: H })).catch((H) => {
|
|
2449
2448
|
console.warn(
|
|
2450
2449
|
"[LiveLayer] getPageContext rejected; falling back to default walker.",
|
|
2451
|
-
|
|
2452
|
-
),
|
|
2450
|
+
H
|
|
2451
|
+
), B({
|
|
2453
2452
|
type: "page_context",
|
|
2454
|
-
context: an(
|
|
2453
|
+
context: an(W)
|
|
2455
2454
|
});
|
|
2456
2455
|
});
|
|
2457
2456
|
return;
|
|
2458
2457
|
}
|
|
2459
|
-
|
|
2458
|
+
B({ type: "page_context", context: j });
|
|
2460
2459
|
return;
|
|
2461
2460
|
}
|
|
2462
|
-
|
|
2461
|
+
B({
|
|
2463
2462
|
type: "page_context",
|
|
2464
|
-
context: an(
|
|
2463
|
+
context: an(W)
|
|
2465
2464
|
});
|
|
2466
|
-
} catch (
|
|
2465
|
+
} catch (j) {
|
|
2467
2466
|
console.warn(
|
|
2468
2467
|
"[LiveLayer] page-context extraction threw. Sending empty context.",
|
|
2469
|
-
|
|
2470
|
-
),
|
|
2468
|
+
j
|
|
2469
|
+
), B({
|
|
2471
2470
|
type: "page_context",
|
|
2472
|
-
context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras:
|
|
2471
|
+
context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: W }
|
|
2473
2472
|
});
|
|
2474
2473
|
}
|
|
2475
2474
|
return;
|
|
@@ -2493,18 +2492,18 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2493
2492
|
x,
|
|
2494
2493
|
M
|
|
2495
2494
|
);
|
|
2496
|
-
} catch (
|
|
2497
|
-
console.warn("[LiveLayer] onScrollPage threw.",
|
|
2495
|
+
} catch (H) {
|
|
2496
|
+
console.warn("[LiveLayer] onScrollPage threw.", H);
|
|
2498
2497
|
}
|
|
2499
2498
|
return;
|
|
2500
2499
|
}
|
|
2501
2500
|
if (typeof window > "u") return;
|
|
2502
|
-
const
|
|
2503
|
-
|
|
2504
|
-
},
|
|
2505
|
-
|
|
2501
|
+
const B = { behavior: M }, W = Kr(), U = (H) => {
|
|
2502
|
+
W instanceof Window ? W.scrollBy({ top: H, ...B }) : W.scrollBy({ top: H, ...B });
|
|
2503
|
+
}, j = (H) => {
|
|
2504
|
+
W instanceof Window ? W.scrollTo({ top: H, ...B }) : W.scrollTo({ top: H, ...B });
|
|
2506
2505
|
};
|
|
2507
|
-
x === "up" ? U(-sn(
|
|
2506
|
+
x === "up" ? U(-sn(W)) : x === "down" ? U(sn(W)) : j(x === "top" ? 0 : Xr(W));
|
|
2508
2507
|
return;
|
|
2509
2508
|
}
|
|
2510
2509
|
if (p.type === "click") {
|
|
@@ -2520,8 +2519,8 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2520
2519
|
if (Lt.current) {
|
|
2521
2520
|
try {
|
|
2522
2521
|
Lt.current(x);
|
|
2523
|
-
} catch (
|
|
2524
|
-
console.warn("[LiveLayer] onClick threw.",
|
|
2522
|
+
} catch (B) {
|
|
2523
|
+
console.warn("[LiveLayer] onClick threw.", B);
|
|
2525
2524
|
}
|
|
2526
2525
|
return;
|
|
2527
2526
|
}
|
|
@@ -2556,7 +2555,7 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2556
2555
|
return;
|
|
2557
2556
|
}
|
|
2558
2557
|
if (typeof document > "u") return;
|
|
2559
|
-
p.type === "fill_form" &&
|
|
2558
|
+
p.type === "fill_form" && ft.current.playConfirmation();
|
|
2560
2559
|
const x = typeof p.formId == "string" ? p.formId : null;
|
|
2561
2560
|
if (!x) {
|
|
2562
2561
|
console.warn(`[LiveLayer] ${p.type}: missing formId.`);
|
|
@@ -2578,53 +2577,53 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2578
2577
|
return;
|
|
2579
2578
|
}
|
|
2580
2579
|
if (p.type === "focus_field") {
|
|
2581
|
-
const
|
|
2582
|
-
if (!
|
|
2580
|
+
const W = typeof p.fieldName == "string" ? p.fieldName : null;
|
|
2581
|
+
if (!W) {
|
|
2583
2582
|
console.warn("[LiveLayer] focus_field: missing fieldName.");
|
|
2584
2583
|
return;
|
|
2585
2584
|
}
|
|
2586
|
-
const U = M.querySelector(`[data-ll-field="${
|
|
2585
|
+
const U = M.querySelector(`[data-ll-field="${W.replace(/"/g, '\\"')}"]`);
|
|
2587
2586
|
if (!U) {
|
|
2588
2587
|
console.warn(
|
|
2589
|
-
`[LiveLayer] focus_field: no field "${
|
|
2588
|
+
`[LiveLayer] focus_field: no field "${W}" in form "${x}".`
|
|
2590
2589
|
);
|
|
2591
2590
|
return;
|
|
2592
2591
|
}
|
|
2593
2592
|
if (!yt(U)) {
|
|
2594
2593
|
console.warn(
|
|
2595
|
-
`[LiveLayer] focus_field: field "${
|
|
2594
|
+
`[LiveLayer] focus_field: field "${W}" is privacy-protected and not focusable.`
|
|
2596
2595
|
);
|
|
2597
2596
|
return;
|
|
2598
2597
|
}
|
|
2599
2598
|
U.focus();
|
|
2600
2599
|
return;
|
|
2601
2600
|
}
|
|
2602
|
-
const
|
|
2603
|
-
if (!
|
|
2601
|
+
const B = p.values && typeof p.values == "object" ? p.values : null;
|
|
2602
|
+
if (!B) {
|
|
2604
2603
|
console.warn("[LiveLayer] fill_form: missing or invalid values.");
|
|
2605
2604
|
return;
|
|
2606
2605
|
}
|
|
2607
|
-
for (const [
|
|
2606
|
+
for (const [W, U] of Object.entries(B)) {
|
|
2608
2607
|
if (typeof U != "string") continue;
|
|
2609
|
-
const
|
|
2610
|
-
if (!
|
|
2608
|
+
const j = M.querySelector(`[data-ll-field="${W.replace(/"/g, '\\"')}"]`);
|
|
2609
|
+
if (!j) {
|
|
2611
2610
|
console.warn(
|
|
2612
|
-
`[LiveLayer] fill_form: no field "${
|
|
2611
|
+
`[LiveLayer] fill_form: no field "${W}" in form "${x}". Skipping.`
|
|
2613
2612
|
);
|
|
2614
2613
|
continue;
|
|
2615
2614
|
}
|
|
2616
|
-
if (!yt(
|
|
2615
|
+
if (!yt(j)) {
|
|
2617
2616
|
console.warn(
|
|
2618
|
-
`[LiveLayer] fill_form: field "${
|
|
2617
|
+
`[LiveLayer] fill_form: field "${W}" is privacy-protected (password / cc-* / private). Skipping.`
|
|
2619
2618
|
);
|
|
2620
2619
|
continue;
|
|
2621
2620
|
}
|
|
2622
2621
|
try {
|
|
2623
|
-
Vr(
|
|
2624
|
-
} catch (
|
|
2622
|
+
Vr(j, U);
|
|
2623
|
+
} catch (H) {
|
|
2625
2624
|
console.warn(
|
|
2626
|
-
`[LiveLayer] fill_form: failed to set "${
|
|
2627
|
-
|
|
2625
|
+
`[LiveLayer] fill_form: failed to set "${W}".`,
|
|
2626
|
+
H
|
|
2628
2627
|
);
|
|
2629
2628
|
}
|
|
2630
2629
|
}
|
|
@@ -2641,7 +2640,7 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2641
2640
|
console.warn("[LiveLayer] submit_form: missing formId.");
|
|
2642
2641
|
return;
|
|
2643
2642
|
}
|
|
2644
|
-
|
|
2643
|
+
ft.current.playConfirmation();
|
|
2645
2644
|
const M = document.querySelector(
|
|
2646
2645
|
`[data-ll-form="${x.replace(/"/g, '\\"')}"]`
|
|
2647
2646
|
);
|
|
@@ -2657,24 +2656,24 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2657
2656
|
);
|
|
2658
2657
|
return;
|
|
2659
2658
|
}
|
|
2660
|
-
const
|
|
2661
|
-
const Z =
|
|
2659
|
+
const B = typeof p.requestId == "string" ? p.requestId : void 0, W = (ge = de.current) == null ? void 0 : ge.call(de), U = (K) => {
|
|
2660
|
+
const Z = W, We = Z == null ? void 0 : Z.localParticipant;
|
|
2662
2661
|
if (We != null && We.publishData)
|
|
2663
2662
|
try {
|
|
2664
|
-
const An =
|
|
2663
|
+
const An = B ? { ...K, requestId: B } : K, Rn = new TextEncoder().encode(JSON.stringify(An));
|
|
2665
2664
|
We.publishData(Rn, { reliable: !0 });
|
|
2666
2665
|
} catch {
|
|
2667
2666
|
}
|
|
2668
2667
|
};
|
|
2669
|
-
let
|
|
2670
|
-
const
|
|
2671
|
-
|
|
2668
|
+
let j = !1;
|
|
2669
|
+
const H = () => {
|
|
2670
|
+
j = !0, U({ type: "form_submitted", formId: x });
|
|
2672
2671
|
};
|
|
2673
|
-
M.addEventListener("submit",
|
|
2672
|
+
M.addEventListener("submit", H, { once: !0 });
|
|
2674
2673
|
try {
|
|
2675
2674
|
typeof M.requestSubmit == "function" ? M.requestSubmit() : M.submit();
|
|
2676
2675
|
} catch (K) {
|
|
2677
|
-
console.warn("[LiveLayer] submit_form: requestSubmit threw.", K), M.removeEventListener("submit",
|
|
2676
|
+
console.warn("[LiveLayer] submit_form: requestSubmit threw.", K), M.removeEventListener("submit", H), U({
|
|
2678
2677
|
type: "form_submit_blocked",
|
|
2679
2678
|
formId: x,
|
|
2680
2679
|
reason: "exception"
|
|
@@ -2682,7 +2681,7 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2682
2681
|
return;
|
|
2683
2682
|
}
|
|
2684
2683
|
setTimeout(() => {
|
|
2685
|
-
|
|
2684
|
+
j || (M.removeEventListener("submit", H), U({
|
|
2686
2685
|
type: "form_submit_blocked",
|
|
2687
2686
|
formId: x,
|
|
2688
2687
|
reason: "validation"
|
|
@@ -2695,43 +2694,43 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2695
2694
|
ke("request_routes", "read_page");
|
|
2696
2695
|
return;
|
|
2697
2696
|
}
|
|
2698
|
-
const x = typeof p.requestId == "string" ? p.requestId : void 0,
|
|
2699
|
-
if (!(
|
|
2700
|
-
const U = (
|
|
2697
|
+
const x = typeof p.requestId == "string" ? p.requestId : void 0, B = (nt = de.current) == null ? void 0 : nt.call(de), W = B == null ? void 0 : B.localParticipant;
|
|
2698
|
+
if (!(W != null && W.publishData)) return;
|
|
2699
|
+
const U = (H) => {
|
|
2701
2700
|
try {
|
|
2702
|
-
const K = x ? { type: "routes", routes:
|
|
2703
|
-
|
|
2701
|
+
const K = x ? { type: "routes", routes: H, requestId: x } : { type: "routes", routes: H }, Z = new TextEncoder().encode(JSON.stringify(K));
|
|
2702
|
+
W.publishData(Z, { reliable: !0 });
|
|
2704
2703
|
} catch (K) {
|
|
2705
2704
|
console.warn("[LiveLayer] request_routes: publishData failed.", K);
|
|
2706
2705
|
}
|
|
2707
|
-
},
|
|
2708
|
-
if (
|
|
2706
|
+
}, j = Tt.current;
|
|
2707
|
+
if (j) {
|
|
2709
2708
|
try {
|
|
2710
|
-
const
|
|
2709
|
+
const H = j(), K = (Z) => {
|
|
2711
2710
|
if (!Array.isArray(Z)) {
|
|
2712
2711
|
U([]);
|
|
2713
2712
|
return;
|
|
2714
2713
|
}
|
|
2715
2714
|
U(Z.map(Wr).slice(0, 200));
|
|
2716
2715
|
};
|
|
2717
|
-
|
|
2716
|
+
H instanceof Promise ? H.then(K).catch((Z) => {
|
|
2718
2717
|
console.warn(
|
|
2719
2718
|
"[LiveLayer] getRoutes rejected; falling back to DOM walker.",
|
|
2720
2719
|
Z
|
|
2721
2720
|
), U(St());
|
|
2722
|
-
}) : K(
|
|
2723
|
-
} catch (
|
|
2721
|
+
}) : K(H);
|
|
2722
|
+
} catch (H) {
|
|
2724
2723
|
console.warn(
|
|
2725
2724
|
"[LiveLayer] getRoutes threw; falling back to DOM walker.",
|
|
2726
|
-
|
|
2725
|
+
H
|
|
2727
2726
|
), U(St());
|
|
2728
2727
|
}
|
|
2729
2728
|
return;
|
|
2730
2729
|
}
|
|
2731
2730
|
try {
|
|
2732
2731
|
U(St());
|
|
2733
|
-
} catch (
|
|
2734
|
-
console.warn("[LiveLayer] request_routes: extractRoutes threw.",
|
|
2732
|
+
} catch (H) {
|
|
2733
|
+
console.warn("[LiveLayer] request_routes: extractRoutes threw.", H);
|
|
2735
2734
|
}
|
|
2736
2735
|
return;
|
|
2737
2736
|
}
|
|
@@ -2740,47 +2739,47 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2740
2739
|
},
|
|
2741
2740
|
[Re, Ae]
|
|
2742
2741
|
), J = Wn({
|
|
2743
|
-
agentId:
|
|
2742
|
+
agentId: $ ? "__controlled__" : Ke,
|
|
2744
2743
|
baseUrl: l,
|
|
2745
2744
|
apiKey: i,
|
|
2746
2745
|
sessionEndpoint: u,
|
|
2747
2746
|
sessionBody: d,
|
|
2748
|
-
onDataMessage:
|
|
2747
|
+
onDataMessage: $ ? void 0 : Ze
|
|
2749
2748
|
});
|
|
2750
|
-
|
|
2751
|
-
if (
|
|
2752
|
-
return
|
|
2753
|
-
}, [
|
|
2754
|
-
var
|
|
2755
|
-
return (
|
|
2756
|
-
},
|
|
2749
|
+
N(() => {
|
|
2750
|
+
if ($ != null && $.subscribeToDataMessages)
|
|
2751
|
+
return $.subscribeToDataMessages(Ze);
|
|
2752
|
+
}, [$, Ze]), de.current = () => {
|
|
2753
|
+
var g;
|
|
2754
|
+
return (g = J.getRoom) == null ? void 0 : g.call(J);
|
|
2755
|
+
}, N(() => {
|
|
2757
2756
|
var Y;
|
|
2758
2757
|
if (typeof window > "u") return;
|
|
2759
|
-
const
|
|
2760
|
-
if (
|
|
2758
|
+
const g = ((Y = window.location) == null ? void 0 : Y.hostname) || "";
|
|
2759
|
+
if (g === "localhost" || g === "127.0.0.1" || g === "0.0.0.0" || g.endsWith(".local") || g.endsWith(".test"))
|
|
2761
2760
|
return window.__livelayerSimulateCommand = (ie) => {
|
|
2762
2761
|
try {
|
|
2763
|
-
|
|
2762
|
+
Ze(ie);
|
|
2764
2763
|
} catch (ge) {
|
|
2765
2764
|
console.warn("[LiveLayer] simulate-command threw:", ge);
|
|
2766
2765
|
}
|
|
2767
2766
|
}, () => {
|
|
2768
2767
|
delete window.__livelayerSimulateCommand;
|
|
2769
2768
|
};
|
|
2770
|
-
}, [
|
|
2771
|
-
const
|
|
2772
|
-
connectionState:
|
|
2773
|
-
agentState:
|
|
2774
|
-
transcript:
|
|
2775
|
-
videoElement:
|
|
2776
|
-
audioElement:
|
|
2777
|
-
canResume:
|
|
2778
|
-
error:
|
|
2769
|
+
}, [Ze]);
|
|
2770
|
+
const v = Ue(() => $ ? {
|
|
2771
|
+
connectionState: $.connectionState,
|
|
2772
|
+
agentState: $.agentState,
|
|
2773
|
+
transcript: $.transcript,
|
|
2774
|
+
videoElement: $.videoElement,
|
|
2775
|
+
audioElement: $.audioElement,
|
|
2776
|
+
canResume: $.canResume,
|
|
2777
|
+
error: $.error,
|
|
2779
2778
|
agentConfig: null,
|
|
2780
2779
|
connect: async () => {
|
|
2781
|
-
await
|
|
2780
|
+
await $.onConnect();
|
|
2782
2781
|
},
|
|
2783
|
-
disconnect: () =>
|
|
2782
|
+
disconnect: () => $.onDisconnect(),
|
|
2784
2783
|
// Dummy getRoom for shape compatibility — controlled consumers own the Room.
|
|
2785
2784
|
// Internal session's getRoom returns null when no real connect has happened,
|
|
2786
2785
|
// so we reuse its reference for type consistency.
|
|
@@ -2799,27 +2798,27 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2799
2798
|
disconnect: J.disconnect,
|
|
2800
2799
|
getRoom: J.getRoom,
|
|
2801
2800
|
isControlled: !1
|
|
2802
|
-
}, [
|
|
2803
|
-
Mt.current =
|
|
2804
|
-
const Dt = S(
|
|
2805
|
-
Dt.current =
|
|
2801
|
+
}, [$, J]), Mt = S(v);
|
|
2802
|
+
Mt.current = v;
|
|
2803
|
+
const Dt = S($);
|
|
2804
|
+
Dt.current = $, Mn(
|
|
2806
2805
|
r,
|
|
2807
2806
|
() => ({
|
|
2808
|
-
sendData: async (
|
|
2809
|
-
var ge,
|
|
2807
|
+
sendData: async (g) => {
|
|
2808
|
+
var ge, nt;
|
|
2810
2809
|
const p = Dt.current;
|
|
2811
2810
|
if (p != null && p.publishData) {
|
|
2812
2811
|
try {
|
|
2813
|
-
await p.publishData(
|
|
2812
|
+
await p.publishData(g);
|
|
2814
2813
|
} catch (x) {
|
|
2815
2814
|
console.warn("[AvatarWidget] sendData (controlled) failed:", x);
|
|
2816
2815
|
}
|
|
2817
2816
|
return;
|
|
2818
2817
|
}
|
|
2819
|
-
const Y = (
|
|
2818
|
+
const Y = (nt = (ge = Mt.current) == null ? void 0 : ge.getRoom) == null ? void 0 : nt.call(ge), ie = Y == null ? void 0 : Y.localParticipant;
|
|
2820
2819
|
if (ie != null && ie.publishData)
|
|
2821
2820
|
try {
|
|
2822
|
-
const x = new TextEncoder().encode(JSON.stringify(
|
|
2821
|
+
const x = new TextEncoder().encode(JSON.stringify(g));
|
|
2823
2822
|
await ie.publishData(x, { reliable: !0 });
|
|
2824
2823
|
} catch (x) {
|
|
2825
2824
|
console.warn("[AvatarWidget] sendData failed:", x);
|
|
@@ -2829,117 +2828,125 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2829
2828
|
[]
|
|
2830
2829
|
);
|
|
2831
2830
|
const Pt = S(null);
|
|
2832
|
-
|
|
2833
|
-
const
|
|
2834
|
-
if (!(!
|
|
2835
|
-
return p.appendChild(
|
|
2836
|
-
|
|
2831
|
+
N(() => {
|
|
2832
|
+
const g = v.videoElement, p = Pt.current;
|
|
2833
|
+
if (!(!g || !p))
|
|
2834
|
+
return p.appendChild(g), () => {
|
|
2835
|
+
g.parentNode === p && p.removeChild(g);
|
|
2837
2836
|
};
|
|
2838
|
-
}, [
|
|
2839
|
-
const
|
|
2840
|
-
if (!
|
|
2841
|
-
we.attach(
|
|
2842
|
-
const p =
|
|
2837
|
+
}, [v.videoElement]), N(() => {
|
|
2838
|
+
const g = v.audioElement;
|
|
2839
|
+
if (!g) return;
|
|
2840
|
+
we.attach(g);
|
|
2841
|
+
const p = g.play();
|
|
2843
2842
|
return p && typeof p.catch == "function" && p.catch((Y) => {
|
|
2844
2843
|
(Y == null ? void 0 : Y.name) === "NotAllowedError" && Xe(!0);
|
|
2845
2844
|
}), () => {
|
|
2846
2845
|
we.detach();
|
|
2847
2846
|
};
|
|
2848
|
-
}, [
|
|
2849
|
-
if (
|
|
2850
|
-
const
|
|
2851
|
-
if (
|
|
2852
|
-
return oe.setupMic(
|
|
2853
|
-
}),
|
|
2854
|
-
oe.teardownMic()
|
|
2847
|
+
}, [v.audioElement]), N(() => {
|
|
2848
|
+
if (v.isControlled || v.connectionState !== "connected") return;
|
|
2849
|
+
const g = v.getRoom();
|
|
2850
|
+
if (g)
|
|
2851
|
+
return oe.setupMic(g).catch(() => {
|
|
2852
|
+
}), () => {
|
|
2853
|
+
oe.teardownMic();
|
|
2854
|
+
};
|
|
2855
|
+
}, [v.isControlled, v.connectionState]), N(() => {
|
|
2856
|
+
var p;
|
|
2857
|
+
if (v.connectionState !== "connected") return;
|
|
2858
|
+
const g = v.isControlled ? (p = $ == null ? void 0 : $.getRoom) == null ? void 0 : p.call($) : v.getRoom();
|
|
2859
|
+
if (g)
|
|
2860
|
+
return he.attachRoom(g), De.attachRoom(g), _e.refresh(), () => {
|
|
2861
|
+
he.teardown(), De.teardown();
|
|
2855
2862
|
};
|
|
2856
|
-
}, [
|
|
2857
|
-
const
|
|
2858
|
-
|
|
2859
|
-
}, [
|
|
2860
|
-
const vn = k((
|
|
2861
|
-
const p = { type: "user_message", text:
|
|
2862
|
-
if (
|
|
2863
|
+
}, [v.isControlled, v.connectionState, $]), N(() => {
|
|
2864
|
+
const g = v.audioElement;
|
|
2865
|
+
g && (g.muted = He);
|
|
2866
|
+
}, [v.audioElement, He]);
|
|
2867
|
+
const vn = k((g) => {
|
|
2868
|
+
const p = { type: "user_message", text: g };
|
|
2869
|
+
if ($ != null && $.publishData) {
|
|
2863
2870
|
try {
|
|
2864
|
-
|
|
2871
|
+
$.publishData(p);
|
|
2865
2872
|
} catch {
|
|
2866
2873
|
}
|
|
2867
2874
|
return;
|
|
2868
2875
|
}
|
|
2869
|
-
const Y =
|
|
2876
|
+
const Y = v.getRoom();
|
|
2870
2877
|
if (Y)
|
|
2871
2878
|
try {
|
|
2872
2879
|
const ie = new TextEncoder().encode(JSON.stringify(p));
|
|
2873
2880
|
Y.localParticipant.publishData(ie, { reliable: !0 });
|
|
2874
2881
|
} catch {
|
|
2875
2882
|
}
|
|
2876
|
-
}, [
|
|
2877
|
-
m((
|
|
2883
|
+
}, [v, $]), bn = k(() => {
|
|
2884
|
+
m((g) => !g);
|
|
2878
2885
|
}, []);
|
|
2879
|
-
|
|
2880
|
-
Ne == null || Ne(
|
|
2881
|
-
}, [
|
|
2882
|
-
Pe == null || Pe(
|
|
2883
|
-
}, [
|
|
2884
|
-
Se == null || Se(
|
|
2885
|
-
}, [
|
|
2886
|
-
|
|
2887
|
-
}, [
|
|
2886
|
+
N(() => {
|
|
2887
|
+
Ne == null || Ne(v.connectionState), v.connectionState === "connected" ? Ee == null || Ee() : v.connectionState === "disconnected" && (Ce == null || Ce());
|
|
2888
|
+
}, [v.connectionState, Ee, Ce, Ne]), N(() => {
|
|
2889
|
+
Pe == null || Pe(v.transcript);
|
|
2890
|
+
}, [v.transcript, Pe]), N(() => {
|
|
2891
|
+
Se == null || Se(v.agentState);
|
|
2892
|
+
}, [v.agentState, Se]), N(() => {
|
|
2893
|
+
V.setThinking(v.agentState === "thinking");
|
|
2894
|
+
}, [v.agentState, V]);
|
|
2888
2895
|
const $t = S(!1);
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
}, [h,
|
|
2896
|
+
N(() => {
|
|
2897
|
+
v.isControlled || !h || $t.current || Je && v.connectionState === "idle" && ($t.current = !0, v.connect());
|
|
2898
|
+
}, [h, v.connectionState, v, Je]);
|
|
2892
2899
|
const wn = k(
|
|
2893
|
-
(
|
|
2894
|
-
const p =
|
|
2895
|
-
p && (Oe(!1),
|
|
2900
|
+
(g) => {
|
|
2901
|
+
const p = R == null ? void 0 : R.find((Y) => Y.id === g);
|
|
2902
|
+
p && (Oe(!1), g !== be && (me(!0), v.disconnect(), Te || bt(g), z == null || z(p)));
|
|
2896
2903
|
},
|
|
2897
2904
|
[
|
|
2898
|
-
|
|
2905
|
+
R,
|
|
2899
2906
|
be,
|
|
2900
|
-
|
|
2907
|
+
v,
|
|
2901
2908
|
Te,
|
|
2902
|
-
|
|
2909
|
+
z
|
|
2903
2910
|
]
|
|
2904
2911
|
);
|
|
2905
|
-
|
|
2906
|
-
Qe &&
|
|
2907
|
-
}, [
|
|
2912
|
+
N(() => {
|
|
2913
|
+
Qe && v.connectionState === "connected" && me(!1);
|
|
2914
|
+
}, [v.connectionState, Qe]), N(() => {
|
|
2908
2915
|
if (!ce) return;
|
|
2909
|
-
const
|
|
2916
|
+
const g = (p) => {
|
|
2910
2917
|
p.key === "Escape" && Oe(!1);
|
|
2911
2918
|
};
|
|
2912
|
-
return window.addEventListener("keydown",
|
|
2919
|
+
return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
|
|
2913
2920
|
}, [ce]);
|
|
2914
|
-
const _n = !!
|
|
2915
|
-
Ge === void 0 && ((Ot =
|
|
2916
|
-
const pt = (Q == null ? void 0 : Q.name) ??
|
|
2921
|
+
const _n = !!q || !!(Q != null && Q.avatarImageUrl) || v.isControlled, et = Yn(Ke, l, _n);
|
|
2922
|
+
Ge === void 0 && ((Ot = et.info) != null && Ot.capabilities) && (Et.current = et.info.capabilities);
|
|
2923
|
+
const pt = (Q == null ? void 0 : Q.name) ?? O ?? ((Ht = v.agentConfig) == null ? void 0 : Ht.name) ?? ((Wt = et.info) == null ? void 0 : Wt.name) ?? "Live Layer", Ct = (Q == null ? void 0 : Q.avatarImageUrl) ?? q ?? ((Bt = v.agentConfig) == null ? void 0 : Bt.avatarImageUrl) ?? ((qt = et.info) == null ? void 0 : qt.avatarImageUrl) ?? null, xn = _ ?? ((Ft = v.agentConfig) == null ? void 0 : Ft.idleLoopUrl) ?? ((Ut = et.info) == null ? void 0 : Ut.idleLoopUrl) ?? null, kn = I ?? null, Ln = k(() => te("expanded"), [te]), En = k(
|
|
2917
2924
|
() => te("minimized"),
|
|
2918
2925
|
[te]
|
|
2919
2926
|
), zt = k(() => {
|
|
2920
|
-
|
|
2921
|
-
}, [
|
|
2922
|
-
const
|
|
2923
|
-
|
|
2927
|
+
v.disconnect(), te("hidden");
|
|
2928
|
+
}, [v, te]), Cn = k(() => {
|
|
2929
|
+
const g = v.audioElement;
|
|
2930
|
+
g && g.play().then(() => Xe(!1)).catch(() => {
|
|
2924
2931
|
});
|
|
2925
|
-
}, [
|
|
2926
|
-
Xe(!1),
|
|
2927
|
-
}, [
|
|
2932
|
+
}, [v.audioElement]), Sn = k(() => {
|
|
2933
|
+
Xe(!1), v.connect();
|
|
2934
|
+
}, [v]), tt = {
|
|
2928
2935
|
...Ie,
|
|
2929
2936
|
...Me ? {} : { zIndex: $e }
|
|
2930
2937
|
};
|
|
2931
|
-
C.primaryColor && (
|
|
2938
|
+
C.primaryColor && (tt["--ll-color-primary"] = C.primaryColor), C.accentColor && (tt["--ll-color-accent"] = C.accentColor), C.backgroundColor && (tt["--ll-color-bg"] = C.backgroundColor), C.textColor && (tt["--ll-color-fg"] = C.textColor);
|
|
2932
2939
|
const Nn = [
|
|
2933
2940
|
"ll-widget",
|
|
2934
2941
|
`ll-widget--${se}`,
|
|
2935
2942
|
`ll-widget--${pe ? "mobile" : "desktop"}`,
|
|
2936
2943
|
vt
|
|
2937
2944
|
].filter(Boolean).join(" ");
|
|
2938
|
-
return Je ? /* @__PURE__ */
|
|
2945
|
+
return Je ? /* @__PURE__ */ y(
|
|
2939
2946
|
"div",
|
|
2940
2947
|
{
|
|
2941
2948
|
className: Nn,
|
|
2942
|
-
style:
|
|
2949
|
+
style: tt,
|
|
2943
2950
|
"data-display-mode": se,
|
|
2944
2951
|
"data-position": D,
|
|
2945
2952
|
"data-experience-mode": f === "EMBEDDED" ? "embedded" : "widget",
|
|
@@ -2949,7 +2956,7 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2949
2956
|
{
|
|
2950
2957
|
position: D,
|
|
2951
2958
|
isMobile: pe,
|
|
2952
|
-
isSpeaking:
|
|
2959
|
+
isSpeaking: v.agentState === "speaking",
|
|
2953
2960
|
onExpand: () => te("expanded"),
|
|
2954
2961
|
label: `Open ${pt} widget`,
|
|
2955
2962
|
avatarImageUrl: Ct,
|
|
@@ -2963,7 +2970,7 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2963
2970
|
isMobile: pe,
|
|
2964
2971
|
agentName: pt,
|
|
2965
2972
|
avatarImageUrl: Ct,
|
|
2966
|
-
agentState:
|
|
2973
|
+
agentState: v.agentState,
|
|
2967
2974
|
isMuted: oe.isMuted,
|
|
2968
2975
|
audioLevel: we,
|
|
2969
2976
|
onExpand: Ln,
|
|
@@ -2981,15 +2988,15 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2981
2988
|
idleLoopUrl: xn,
|
|
2982
2989
|
greeting: kn,
|
|
2983
2990
|
branding: C,
|
|
2984
|
-
teamMembers:
|
|
2991
|
+
teamMembers: R,
|
|
2985
2992
|
currentTeamMemberId: be,
|
|
2986
2993
|
isSwitchingTeamMember: Qe,
|
|
2987
2994
|
teamSwitcherOpen: ce,
|
|
2988
|
-
onToggleTeamSwitcher: () => Oe((
|
|
2995
|
+
onToggleTeamSwitcher: () => Oe((g) => !g),
|
|
2989
2996
|
onSelectTeamMember: wn,
|
|
2990
|
-
connectionState:
|
|
2991
|
-
agentState:
|
|
2992
|
-
transcript:
|
|
2997
|
+
connectionState: v.connectionState,
|
|
2998
|
+
agentState: v.agentState,
|
|
2999
|
+
transcript: v.transcript,
|
|
2993
3000
|
isMuted: oe.isMuted,
|
|
2994
3001
|
micDevices: _e.mics,
|
|
2995
3002
|
isCameraEnabled: he.isEnabled,
|
|
@@ -3007,21 +3014,21 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
3007
3014
|
compactControls: Le,
|
|
3008
3015
|
transforming: ue,
|
|
3009
3016
|
transformingLabel: ve,
|
|
3010
|
-
languageMenuOpen:
|
|
3011
|
-
onToggleLanguageMenu: () => wt((
|
|
3012
|
-
needsUserGesture:
|
|
3013
|
-
canResume:
|
|
3017
|
+
languageMenuOpen: ut,
|
|
3018
|
+
onToggleLanguageMenu: () => wt((g) => !g),
|
|
3019
|
+
needsUserGesture: dt,
|
|
3020
|
+
canResume: v.canResume,
|
|
3014
3021
|
micError: oe.micError,
|
|
3015
|
-
error:
|
|
3022
|
+
error: v.error,
|
|
3016
3023
|
avatarVideoContainerRef: Pt,
|
|
3017
|
-
agentVideoEl:
|
|
3018
|
-
onConnect: () => void
|
|
3019
|
-
onDisconnect: () =>
|
|
3024
|
+
agentVideoEl: v.videoElement,
|
|
3025
|
+
onConnect: () => void v.connect(),
|
|
3026
|
+
onDisconnect: () => v.disconnect(),
|
|
3020
3027
|
onRetry: Sn,
|
|
3021
3028
|
onResumeAudio: Cn,
|
|
3022
3029
|
onToggleMute: oe.toggleMute,
|
|
3023
3030
|
onToggleCamera: () => void he.toggle(),
|
|
3024
|
-
onSwitchCameraDevice: (
|
|
3031
|
+
onSwitchCameraDevice: (g) => void he.switchDevice(g),
|
|
3025
3032
|
onToggleScreenShare: () => void De.toggle(),
|
|
3026
3033
|
onToggleSpeaker: bn,
|
|
3027
3034
|
onSendMessage: vn,
|
|
@@ -3036,7 +3043,7 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
3036
3043
|
}
|
|
3037
3044
|
);
|
|
3038
3045
|
yn.displayName = "AvatarWidgetInner";
|
|
3039
|
-
const Zr =
|
|
3046
|
+
const Zr = lt(
|
|
3040
3047
|
function(t, r) {
|
|
3041
3048
|
return /* @__PURE__ */ n(Hn, { children: /* @__PURE__ */ n(yn, { ...t, ref: r }) });
|
|
3042
3049
|
}
|
|
@@ -3054,21 +3061,21 @@ const so = ({
|
|
|
3054
3061
|
const d = S(null), c = S(null), f = S(i);
|
|
3055
3062
|
f.current = i;
|
|
3056
3063
|
const h = k((a) => {
|
|
3057
|
-
var
|
|
3064
|
+
var A;
|
|
3058
3065
|
const s = a.detail;
|
|
3059
|
-
(
|
|
3066
|
+
(A = f.current) == null || A.call(f, s);
|
|
3060
3067
|
}, []);
|
|
3061
|
-
return
|
|
3068
|
+
return N(() => {
|
|
3062
3069
|
const a = d.current;
|
|
3063
3070
|
if (!a) return;
|
|
3064
3071
|
const s = document.createElement("livelayer-widget");
|
|
3065
3072
|
return s.setAttribute("agent-id", e), t && s.setAttribute("base-url", t), r && s.setAttribute("api-key", r), o && s.setAttribute("mode", o), s.addEventListener("agent-event", h), a.appendChild(s), c.current = s, () => {
|
|
3066
3073
|
s.removeEventListener("agent-event", h), a.removeChild(s), c.current = null;
|
|
3067
3074
|
};
|
|
3068
|
-
}, [e]),
|
|
3075
|
+
}, [e]), N(() => {
|
|
3069
3076
|
c.current && (o ? c.current.setAttribute("mode", o) : c.current.removeAttribute("mode"));
|
|
3070
3077
|
}, [o]), /* @__PURE__ */ n("div", { ref: d, className: l, style: u });
|
|
3071
|
-
}, co =
|
|
3078
|
+
}, co = lt(
|
|
3072
3079
|
function({ id: t, intent: r, as: o = "div", className: i, style: l, children: u }, d) {
|
|
3073
3080
|
return Dn(
|
|
3074
3081
|
o,
|
|
@@ -3082,7 +3089,7 @@ const so = ({
|
|
|
3082
3089
|
u
|
|
3083
3090
|
);
|
|
3084
3091
|
}
|
|
3085
|
-
), uo =
|
|
3092
|
+
), uo = lt(
|
|
3086
3093
|
function({ id: t, intent: r, children: o, ...i }, l) {
|
|
3087
3094
|
return /* @__PURE__ */ n(
|
|
3088
3095
|
"form",
|
|
@@ -3095,7 +3102,7 @@ const so = ({
|
|
|
3095
3102
|
}
|
|
3096
3103
|
);
|
|
3097
3104
|
}
|
|
3098
|
-
), fo =
|
|
3105
|
+
), fo = lt(
|
|
3099
3106
|
function(t, r) {
|
|
3100
3107
|
const { name: o, label: i, labelClassName: l } = t, u = { name: o, "data-ll-field": o };
|
|
3101
3108
|
let d;
|
|
@@ -3110,13 +3117,13 @@ const so = ({
|
|
|
3110
3117
|
}
|
|
3111
3118
|
);
|
|
3112
3119
|
} else if ("as" in t && t.as === "select") {
|
|
3113
|
-
const { name: c, label: f, labelClassName: h, as: a, children: s, ...
|
|
3120
|
+
const { name: c, label: f, labelClassName: h, as: a, children: s, ...A } = t;
|
|
3114
3121
|
d = /* @__PURE__ */ n(
|
|
3115
3122
|
"select",
|
|
3116
3123
|
{
|
|
3117
3124
|
ref: r,
|
|
3118
3125
|
...u,
|
|
3119
|
-
...
|
|
3126
|
+
...A,
|
|
3120
3127
|
children: s
|
|
3121
3128
|
}
|
|
3122
3129
|
);
|
|
@@ -3131,7 +3138,7 @@ const so = ({
|
|
|
3131
3138
|
}
|
|
3132
3139
|
);
|
|
3133
3140
|
}
|
|
3134
|
-
return i === void 0 ? d : /* @__PURE__ */
|
|
3141
|
+
return i === void 0 ? d : /* @__PURE__ */ y("label", { className: l, children: [
|
|
3135
3142
|
i,
|
|
3136
3143
|
d
|
|
3137
3144
|
] });
|
|
@@ -3143,61 +3150,61 @@ function po({
|
|
|
3143
3150
|
defaultOpen: t = !1,
|
|
3144
3151
|
storageKey: r = "ll-debug-open"
|
|
3145
3152
|
}) {
|
|
3146
|
-
const [o, i] = L(t), [l, u] = L([]), [d, c] = L(""), [f, h] = L(!1), a = S(/* @__PURE__ */ new Set()), s = S([]),
|
|
3147
|
-
|
|
3153
|
+
const [o, i] = L(t), [l, u] = L([]), [d, c] = L(""), [f, h] = L(!1), a = S(/* @__PURE__ */ new Set()), s = S([]), A = S(f);
|
|
3154
|
+
A.current = f, N(() => {
|
|
3148
3155
|
try {
|
|
3149
|
-
const
|
|
3150
|
-
|
|
3156
|
+
const b = localStorage.getItem(r);
|
|
3157
|
+
b === "1" && i(!0), b === "0" && i(!1);
|
|
3151
3158
|
} catch {
|
|
3152
3159
|
}
|
|
3153
|
-
}, [r]),
|
|
3160
|
+
}, [r]), N(() => {
|
|
3154
3161
|
try {
|
|
3155
3162
|
localStorage.setItem(r, o ? "1" : "0");
|
|
3156
3163
|
} catch {
|
|
3157
3164
|
}
|
|
3158
|
-
}, [o, r]),
|
|
3159
|
-
const
|
|
3160
|
-
(
|
|
3165
|
+
}, [o, r]), N(() => {
|
|
3166
|
+
const b = (w) => {
|
|
3167
|
+
(w.metaKey || w.ctrlKey) && w.shiftKey && w.key.toLowerCase() === "l" && (w.preventDefault(), i((R) => !R));
|
|
3161
3168
|
};
|
|
3162
|
-
return window.addEventListener("keydown",
|
|
3163
|
-
}, []),
|
|
3164
|
-
const
|
|
3165
|
-
if (s.current.length === 0 ||
|
|
3166
|
-
const
|
|
3169
|
+
return window.addEventListener("keydown", b), () => window.removeEventListener("keydown", b);
|
|
3170
|
+
}, []), N(() => {
|
|
3171
|
+
const b = setInterval(() => {
|
|
3172
|
+
if (s.current.length === 0 || A.current) return;
|
|
3173
|
+
const w = s.current.splice(0, s.current.length);
|
|
3167
3174
|
u(
|
|
3168
|
-
(
|
|
3175
|
+
(R) => [...w.reverse(), ...R].slice(0, 200)
|
|
3169
3176
|
);
|
|
3170
3177
|
}, 100);
|
|
3171
|
-
return () => clearInterval(
|
|
3178
|
+
return () => clearInterval(b);
|
|
3172
3179
|
}, []);
|
|
3173
3180
|
const D = S(!1);
|
|
3174
|
-
if (
|
|
3175
|
-
!e || D.current || (D.current = !0, e((
|
|
3181
|
+
if (N(() => {
|
|
3182
|
+
!e || D.current || (D.current = !0, e((b) => {
|
|
3176
3183
|
s.current.push({
|
|
3177
3184
|
id: cn++,
|
|
3178
3185
|
ts: Date.now(),
|
|
3179
3186
|
kind: "event",
|
|
3180
|
-
type:
|
|
3181
|
-
data:
|
|
3187
|
+
type: b.eventName,
|
|
3188
|
+
data: b.data
|
|
3182
3189
|
});
|
|
3183
3190
|
}));
|
|
3184
|
-
}, [e]),
|
|
3185
|
-
const
|
|
3191
|
+
}, [e]), N(() => {
|
|
3192
|
+
const b = console.warn, w = console.log, R = (T, z) => function(..._) {
|
|
3186
3193
|
try {
|
|
3187
|
-
const I = typeof
|
|
3194
|
+
const I = typeof _[0] == "string" ? _[0] : "";
|
|
3188
3195
|
I.startsWith("[LiveLayer]") && s.current.push({
|
|
3189
3196
|
id: cn++,
|
|
3190
3197
|
ts: Date.now(),
|
|
3191
3198
|
kind: T,
|
|
3192
3199
|
type: I.slice(0, 120),
|
|
3193
|
-
data: { args:
|
|
3200
|
+
data: { args: _.slice(1).map((q) => to(q)) }
|
|
3194
3201
|
});
|
|
3195
3202
|
} catch {
|
|
3196
3203
|
}
|
|
3197
|
-
return
|
|
3204
|
+
return z.apply(this, _);
|
|
3198
3205
|
};
|
|
3199
|
-
return console.warn =
|
|
3200
|
-
console.warn =
|
|
3206
|
+
return console.warn = R("warn", b), console.log = R("log", w), () => {
|
|
3207
|
+
console.warn = b, console.log = w;
|
|
3201
3208
|
};
|
|
3202
3209
|
}, []), !o)
|
|
3203
3210
|
return /* @__PURE__ */ n(
|
|
@@ -3226,12 +3233,12 @@ function po({
|
|
|
3226
3233
|
children: "🛰 LL debug"
|
|
3227
3234
|
}
|
|
3228
3235
|
);
|
|
3229
|
-
const E = l.filter((
|
|
3236
|
+
const E = l.filter((b) => {
|
|
3230
3237
|
if (!d) return !0;
|
|
3231
|
-
const
|
|
3232
|
-
return
|
|
3238
|
+
const w = d.toLowerCase();
|
|
3239
|
+
return b.type.toLowerCase().includes(w) || JSON.stringify(b.data || {}).toLowerCase().includes(w);
|
|
3233
3240
|
});
|
|
3234
|
-
return /* @__PURE__ */
|
|
3241
|
+
return /* @__PURE__ */ y(
|
|
3235
3242
|
"div",
|
|
3236
3243
|
{
|
|
3237
3244
|
style: {
|
|
@@ -3253,7 +3260,7 @@ function po({
|
|
|
3253
3260
|
overflow: "hidden"
|
|
3254
3261
|
},
|
|
3255
3262
|
children: [
|
|
3256
|
-
/* @__PURE__ */
|
|
3263
|
+
/* @__PURE__ */ y(
|
|
3257
3264
|
"div",
|
|
3258
3265
|
{
|
|
3259
3266
|
style: {
|
|
@@ -3266,7 +3273,7 @@ function po({
|
|
|
3266
3273
|
},
|
|
3267
3274
|
children: [
|
|
3268
3275
|
/* @__PURE__ */ n("span", { style: { fontWeight: 600, fontSize: 12 }, children: "LiveLayer debug" }),
|
|
3269
|
-
/* @__PURE__ */
|
|
3276
|
+
/* @__PURE__ */ y("span", { style: { fontSize: 10, color: "rgba(255,255,255,0.4)" }, children: [
|
|
3270
3277
|
l.length,
|
|
3271
3278
|
" event",
|
|
3272
3279
|
l.length === 1 ? "" : "s"
|
|
@@ -3276,7 +3283,7 @@ function po({
|
|
|
3276
3283
|
"button",
|
|
3277
3284
|
{
|
|
3278
3285
|
type: "button",
|
|
3279
|
-
onClick: () => h((
|
|
3286
|
+
onClick: () => h((b) => !b),
|
|
3280
3287
|
style: Nt(f ? "#f59e0b" : "transparent"),
|
|
3281
3288
|
title: "Pause / resume capture",
|
|
3282
3289
|
children: f ? "▶ resume" : "⏸ pause"
|
|
@@ -3313,7 +3320,7 @@ function po({
|
|
|
3313
3320
|
{
|
|
3314
3321
|
type: "text",
|
|
3315
3322
|
value: d,
|
|
3316
|
-
onChange: (
|
|
3323
|
+
onChange: (b) => c(b.target.value),
|
|
3317
3324
|
placeholder: "filter by type or data…",
|
|
3318
3325
|
style: {
|
|
3319
3326
|
margin: 8,
|
|
@@ -3335,7 +3342,7 @@ function po({
|
|
|
3335
3342
|
overflowY: "auto",
|
|
3336
3343
|
padding: "0 8px 8px"
|
|
3337
3344
|
},
|
|
3338
|
-
children: E.length === 0 ? /* @__PURE__ */
|
|
3345
|
+
children: E.length === 0 ? /* @__PURE__ */ y(
|
|
3339
3346
|
"div",
|
|
3340
3347
|
{
|
|
3341
3348
|
style: {
|
|
@@ -3365,16 +3372,16 @@ function po({
|
|
|
3365
3372
|
)
|
|
3366
3373
|
]
|
|
3367
3374
|
}
|
|
3368
|
-
) : E.map((
|
|
3375
|
+
) : E.map((b) => /* @__PURE__ */ n(
|
|
3369
3376
|
eo,
|
|
3370
3377
|
{
|
|
3371
|
-
entry:
|
|
3372
|
-
expanded: a.current.has(
|
|
3378
|
+
entry: b,
|
|
3379
|
+
expanded: a.current.has(b.id),
|
|
3373
3380
|
onToggle: () => {
|
|
3374
|
-
a.current.has(
|
|
3381
|
+
a.current.has(b.id) ? a.current.delete(b.id) : a.current.add(b.id), u((w) => [...w]);
|
|
3375
3382
|
}
|
|
3376
3383
|
},
|
|
3377
|
-
|
|
3384
|
+
b.id
|
|
3378
3385
|
))
|
|
3379
3386
|
}
|
|
3380
3387
|
)
|
|
@@ -3390,7 +3397,7 @@ function eo({
|
|
|
3390
3397
|
const o = e.kind === "warn" ? "#f59e0b" : e.type.startsWith("[LiveLayer]") ? "#94a3b8" : e.type === "navigate" || e.type === "scroll_page" || e.type === "scroll_to" || e.type === "click" ? "#22c55e" : e.type === "fill_form" || e.type === "submit_form" || e.type === "focus_field" ? "#a78bfa" : e.type === "request_page_context" || e.type === "request_routes" ? "#38bdf8" : e.type === "agent_state" ? "#facc15" : "#cbd5e1", i = new Date(e.ts).toLocaleTimeString("en-US", {
|
|
3391
3398
|
hour12: !1
|
|
3392
3399
|
});
|
|
3393
|
-
return /* @__PURE__ */
|
|
3400
|
+
return /* @__PURE__ */ y(
|
|
3394
3401
|
"button",
|
|
3395
3402
|
{
|
|
3396
3403
|
type: "button",
|
|
@@ -3408,7 +3415,7 @@ function eo({
|
|
|
3408
3415
|
lineHeight: 1.4
|
|
3409
3416
|
},
|
|
3410
3417
|
children: [
|
|
3411
|
-
/* @__PURE__ */
|
|
3418
|
+
/* @__PURE__ */ y("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
3412
3419
|
/* @__PURE__ */ n(
|
|
3413
3420
|
"span",
|
|
3414
3421
|
{
|