@livelayer/react 0.9.3 → 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 +577 -567
- 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,37 +1256,37 @@ 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,
|
|
1274
1274
|
isScreenShareEnabled: G,
|
|
1275
1275
|
screenPreviewEl: le,
|
|
1276
|
-
isSpeakerMuted:
|
|
1276
|
+
isSpeakerMuted: ee,
|
|
1277
1277
|
allowCamera: Le,
|
|
1278
1278
|
allowScreenShare: ue,
|
|
1279
1279
|
allowTyping: ve,
|
|
1280
1280
|
showMinimize: fe = !0,
|
|
1281
1281
|
chromeless: ae = !1,
|
|
1282
|
-
compactControls:
|
|
1283
|
-
transforming:
|
|
1282
|
+
compactControls: X = !1,
|
|
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;
|
|
@@ -1325,47 +1325,47 @@ const Sr = ({
|
|
|
1325
1325
|
const m = setTimeout(() => be(!0), 8e3);
|
|
1326
1326
|
return () => clearTimeout(m);
|
|
1327
1327
|
}, [re, Te]);
|
|
1328
|
-
const
|
|
1329
|
-
|
|
1328
|
+
const Q = E === "connecting" || re && !!o && !Te && !bt, Ke = S(null), Me = S(null);
|
|
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
|
-
|
|
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
|
-
!
|
|
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,15 +1548,18 @@ const Sr = ({
|
|
|
1548
1548
|
)
|
|
1549
1549
|
] })
|
|
1550
1550
|
] }),
|
|
1551
|
-
|
|
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
|
-
// Idle-state header with Live Layer product name + minimize/close
|
|
1557
|
-
|
|
1556
|
+
// Idle-state header with Live Layer product name + minimize/close.
|
|
1557
|
+
// Hidden in compact mode — on a 140×210 docked slot the brand pill
|
|
1558
|
+
// and 40px buttons crowded out the central "Start video call"
|
|
1559
|
+
// affordance. The user can dismiss by scrolling past the slot.
|
|
1560
|
+
!X && /* @__PURE__ */ y("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
|
|
1558
1561
|
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Qe }),
|
|
1559
|
-
/* @__PURE__ */
|
|
1562
|
+
/* @__PURE__ */ y("div", { className: "ll-expanded__header-actions", children: [
|
|
1560
1563
|
fe !== !1 && /* @__PURE__ */ n(
|
|
1561
1564
|
"button",
|
|
1562
1565
|
{
|
|
@@ -1572,7 +1575,7 @@ const Sr = ({
|
|
|
1572
1575
|
{
|
|
1573
1576
|
type: "button",
|
|
1574
1577
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1575
|
-
onClick:
|
|
1578
|
+
onClick: $,
|
|
1576
1579
|
"aria-label": "Close widget",
|
|
1577
1580
|
children: /* @__PURE__ */ n(tn, {})
|
|
1578
1581
|
}
|
|
@@ -1581,9 +1584,9 @@ const Sr = ({
|
|
|
1581
1584
|
] })
|
|
1582
1585
|
),
|
|
1583
1586
|
Je && /* @__PURE__ */ (() => {
|
|
1584
|
-
const m =
|
|
1585
|
-
return /* @__PURE__ */
|
|
1586
|
-
|
|
1587
|
+
const m = R ? "Resume session" : E === "disconnected" ? "Reconnect to agent" : "Start video call";
|
|
1588
|
+
return /* @__PURE__ */ y(it, { children: [
|
|
1589
|
+
!z && /* @__PURE__ */ y(
|
|
1587
1590
|
"button",
|
|
1588
1591
|
{
|
|
1589
1592
|
type: "button",
|
|
@@ -1592,13 +1595,12 @@ const Sr = ({
|
|
|
1592
1595
|
"aria-label": m,
|
|
1593
1596
|
children: [
|
|
1594
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" }) }) }),
|
|
1595
|
-
/* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children: m })
|
|
1598
|
+
X && /* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children: m })
|
|
1596
1599
|
]
|
|
1597
1600
|
}
|
|
1598
1601
|
),
|
|
1599
|
-
/* @__PURE__ */
|
|
1602
|
+
!X && /* @__PURE__ */ y("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
|
|
1600
1603
|
l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
|
|
1601
|
-
j && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: j }),
|
|
1602
1604
|
/* @__PURE__ */ n(
|
|
1603
1605
|
"button",
|
|
1604
1606
|
{
|
|
@@ -1612,10 +1614,10 @@ const Sr = ({
|
|
|
1612
1614
|
] })
|
|
1613
1615
|
] });
|
|
1614
1616
|
})(),
|
|
1615
|
-
/* @__PURE__ */
|
|
1617
|
+
/* @__PURE__ */ y(
|
|
1616
1618
|
"div",
|
|
1617
1619
|
{
|
|
1618
|
-
className: `ll-expanded__pip ${$e && (
|
|
1620
|
+
className: `ll-expanded__pip ${$e && (O || G) ? "is-visible" : ""}`,
|
|
1619
1621
|
children: [
|
|
1620
1622
|
/* @__PURE__ */ n(
|
|
1621
1623
|
"div",
|
|
@@ -1628,14 +1630,14 @@ const Sr = ({
|
|
|
1628
1630
|
"div",
|
|
1629
1631
|
{
|
|
1630
1632
|
ref: Ke,
|
|
1631
|
-
className: !G &&
|
|
1633
|
+
className: !G && O ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1632
1634
|
}
|
|
1633
1635
|
)
|
|
1634
1636
|
]
|
|
1635
1637
|
}
|
|
1636
1638
|
),
|
|
1637
|
-
$e ? /* @__PURE__ */
|
|
1638
|
-
!
|
|
1639
|
+
$e ? /* @__PURE__ */ y("div", { className: "ll-expanded__bottom", children: [
|
|
1640
|
+
!X && Oe && /* @__PURE__ */ n(
|
|
1639
1641
|
"div",
|
|
1640
1642
|
{
|
|
1641
1643
|
className: "ll-expanded__transcript ll-expanded__transcript--agent",
|
|
@@ -1643,15 +1645,15 @@ const Sr = ({
|
|
|
1643
1645
|
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Oe })
|
|
1644
1646
|
}
|
|
1645
1647
|
),
|
|
1646
|
-
!
|
|
1648
|
+
!X && ut && /* @__PURE__ */ n(
|
|
1647
1649
|
"div",
|
|
1648
1650
|
{
|
|
1649
1651
|
className: "ll-expanded__transcript ll-expanded__transcript--user",
|
|
1650
1652
|
"data-role": "user",
|
|
1651
|
-
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children:
|
|
1653
|
+
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: ut })
|
|
1652
1654
|
}
|
|
1653
1655
|
),
|
|
1654
|
-
!ae && !
|
|
1656
|
+
!ae && !X && /* @__PURE__ */ y("div", { className: "ll-toolbar", onClick: (m) => m.stopPropagation(), children: [
|
|
1655
1657
|
ue && /* @__PURE__ */ n(
|
|
1656
1658
|
"button",
|
|
1657
1659
|
{
|
|
@@ -1663,15 +1665,15 @@ const Sr = ({
|
|
|
1663
1665
|
children: /* @__PURE__ */ n(fn, {})
|
|
1664
1666
|
}
|
|
1665
1667
|
),
|
|
1666
|
-
Le && /* @__PURE__ */
|
|
1668
|
+
Le && /* @__PURE__ */ y("div", { className: "ll-tool-split", children: [
|
|
1667
1669
|
/* @__PURE__ */ n(
|
|
1668
1670
|
"button",
|
|
1669
1671
|
{
|
|
1670
1672
|
type: "button",
|
|
1671
|
-
className: `ll-tool ll-tool--left ${
|
|
1673
|
+
className: `ll-tool ll-tool--left ${O ? "is-on" : ""}`,
|
|
1672
1674
|
onClick: Ce,
|
|
1673
|
-
"aria-label":
|
|
1674
|
-
title:
|
|
1675
|
+
"aria-label": O ? "Turn off camera" : "Turn on camera",
|
|
1676
|
+
title: O ? "Stop camera" : "Start camera",
|
|
1675
1677
|
children: /* @__PURE__ */ n(pn, {})
|
|
1676
1678
|
}
|
|
1677
1679
|
),
|
|
@@ -1679,9 +1681,9 @@ const Sr = ({
|
|
|
1679
1681
|
"button",
|
|
1680
1682
|
{
|
|
1681
1683
|
type: "button",
|
|
1682
|
-
className: `ll-tool ll-tool--right ${
|
|
1684
|
+
className: `ll-tool ll-tool--right ${O ? "is-on" : ""}`,
|
|
1683
1685
|
onClick: (m) => {
|
|
1684
|
-
m.stopPropagation(), we((
|
|
1686
|
+
m.stopPropagation(), we((V) => !V), te(!1);
|
|
1685
1687
|
},
|
|
1686
1688
|
"aria-label": "Camera devices",
|
|
1687
1689
|
"aria-haspopup": "listbox",
|
|
@@ -1701,25 +1703,25 @@ const Sr = ({
|
|
|
1701
1703
|
}
|
|
1702
1704
|
)
|
|
1703
1705
|
] }),
|
|
1704
|
-
/* @__PURE__ */
|
|
1706
|
+
/* @__PURE__ */ y("div", { className: "ll-tool-split", children: [
|
|
1705
1707
|
/* @__PURE__ */ n(
|
|
1706
1708
|
"button",
|
|
1707
1709
|
{
|
|
1708
1710
|
type: "button",
|
|
1709
|
-
className: `ll-tool ll-tool--left ${
|
|
1711
|
+
className: `ll-tool ll-tool--left ${_ ? "is-muted" : ""}`,
|
|
1710
1712
|
onClick: Ee,
|
|
1711
|
-
"aria-label":
|
|
1712
|
-
title:
|
|
1713
|
-
children: /* @__PURE__ */ n(hn, { muted:
|
|
1713
|
+
"aria-label": _ ? "Unmute microphone" : "Mute microphone",
|
|
1714
|
+
title: _ ? "Unmute" : "Mute",
|
|
1715
|
+
children: /* @__PURE__ */ n(hn, { muted: _ })
|
|
1714
1716
|
}
|
|
1715
1717
|
),
|
|
1716
1718
|
/* @__PURE__ */ n(
|
|
1717
1719
|
"button",
|
|
1718
1720
|
{
|
|
1719
1721
|
type: "button",
|
|
1720
|
-
className: `ll-tool ll-tool--right ${
|
|
1722
|
+
className: `ll-tool ll-tool--right ${_ ? "is-muted" : ""}`,
|
|
1721
1723
|
onClick: (m) => {
|
|
1722
|
-
m.stopPropagation(), te((
|
|
1724
|
+
m.stopPropagation(), te((V) => !V), we(!1);
|
|
1723
1725
|
},
|
|
1724
1726
|
"aria-label": "Microphone devices",
|
|
1725
1727
|
"aria-haspopup": "listbox",
|
|
@@ -1727,11 +1729,11 @@ const Sr = ({
|
|
|
1727
1729
|
children: /* @__PURE__ */ n(ht, {})
|
|
1728
1730
|
}
|
|
1729
1731
|
),
|
|
1730
|
-
se &&
|
|
1732
|
+
se && q.length > 0 && /* @__PURE__ */ n(
|
|
1731
1733
|
rn,
|
|
1732
1734
|
{
|
|
1733
1735
|
label: "Microphone",
|
|
1734
|
-
devices:
|
|
1736
|
+
devices: q,
|
|
1735
1737
|
activeId: "",
|
|
1736
1738
|
onPick: () => te(!1)
|
|
1737
1739
|
}
|
|
@@ -1741,11 +1743,11 @@ const Sr = ({
|
|
|
1741
1743
|
"button",
|
|
1742
1744
|
{
|
|
1743
1745
|
type: "button",
|
|
1744
|
-
className: `ll-tool ${
|
|
1746
|
+
className: `ll-tool ${ee ? "is-muted" : ""}`,
|
|
1745
1747
|
onClick: Ne,
|
|
1746
|
-
"aria-label":
|
|
1747
|
-
title:
|
|
1748
|
-
children: /* @__PURE__ */ n(mn, { muted:
|
|
1748
|
+
"aria-label": ee ? "Unmute speaker" : "Mute speaker",
|
|
1749
|
+
title: ee ? "Unmute speaker" : "Mute speaker",
|
|
1750
|
+
children: /* @__PURE__ */ n(mn, { muted: ee })
|
|
1749
1751
|
}
|
|
1750
1752
|
),
|
|
1751
1753
|
/* @__PURE__ */ n(
|
|
@@ -1760,18 +1762,18 @@ const Sr = ({
|
|
|
1760
1762
|
}
|
|
1761
1763
|
)
|
|
1762
1764
|
] }),
|
|
1763
|
-
!ae &&
|
|
1765
|
+
!ae && X && /* @__PURE__ */ n(
|
|
1764
1766
|
Lr,
|
|
1765
1767
|
{
|
|
1766
|
-
isMuted:
|
|
1768
|
+
isMuted: _,
|
|
1767
1769
|
onToggleMute: Ee,
|
|
1768
|
-
isCameraEnabled:
|
|
1770
|
+
isCameraEnabled: O,
|
|
1769
1771
|
onToggleCamera: Ce,
|
|
1770
1772
|
allowCamera: Le,
|
|
1771
1773
|
isScreenShareEnabled: G,
|
|
1772
1774
|
onToggleScreenShare: Se,
|
|
1773
1775
|
allowScreenShare: ue,
|
|
1774
|
-
isSpeakerMuted:
|
|
1776
|
+
isSpeakerMuted: ee,
|
|
1775
1777
|
onToggleSpeaker: Ne,
|
|
1776
1778
|
allowTyping: ve,
|
|
1777
1779
|
isTypingOpen: oe,
|
|
@@ -1779,7 +1781,7 @@ const Sr = ({
|
|
|
1779
1781
|
onDisconnect: Ye
|
|
1780
1782
|
}
|
|
1781
1783
|
),
|
|
1782
|
-
!ae && ve && (
|
|
1784
|
+
!ae && ve && (X ? oe : !0) && /* @__PURE__ */ y("form", { className: "ll-message-input", onSubmit: Xe, children: [
|
|
1783
1785
|
/* @__PURE__ */ n(
|
|
1784
1786
|
"input",
|
|
1785
1787
|
{
|
|
@@ -1787,7 +1789,7 @@ const Sr = ({
|
|
|
1787
1789
|
className: "ll-message-input__field",
|
|
1788
1790
|
placeholder: "Message...",
|
|
1789
1791
|
value: _e,
|
|
1790
|
-
onChange: (m) =>
|
|
1792
|
+
onChange: (m) => dt(m.target.value),
|
|
1791
1793
|
"aria-label": "Message the agent"
|
|
1792
1794
|
}
|
|
1793
1795
|
),
|
|
@@ -1804,7 +1806,7 @@ const Sr = ({
|
|
|
1804
1806
|
] }) : null,
|
|
1805
1807
|
(() => {
|
|
1806
1808
|
if (I && E !== "error")
|
|
1807
|
-
return /* @__PURE__ */
|
|
1809
|
+
return /* @__PURE__ */ y("div", { className: "ll-expanded__banner", role: "alert", children: [
|
|
1808
1810
|
/* @__PURE__ */ n("span", { children: I }),
|
|
1809
1811
|
/* @__PURE__ */ n(
|
|
1810
1812
|
"button",
|
|
@@ -1817,17 +1819,17 @@ const Sr = ({
|
|
|
1817
1819
|
}
|
|
1818
1820
|
)
|
|
1819
1821
|
] });
|
|
1820
|
-
if (
|
|
1821
|
-
let m = "Failed to connect",
|
|
1822
|
-
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: [
|
|
1823
1825
|
/* @__PURE__ */ n("span", { children: m }),
|
|
1824
1826
|
/* @__PURE__ */ n(
|
|
1825
1827
|
"button",
|
|
1826
1828
|
{
|
|
1827
1829
|
type: "button",
|
|
1828
1830
|
className: "ll-expanded__banner-retry",
|
|
1829
|
-
onClick:
|
|
1830
|
-
children:
|
|
1831
|
+
onClick: ct,
|
|
1832
|
+
children: V
|
|
1831
1833
|
}
|
|
1832
1834
|
)
|
|
1833
1835
|
] });
|
|
@@ -1840,7 +1842,7 @@ function ht() {
|
|
|
1840
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" }) });
|
|
1841
1843
|
}
|
|
1842
1844
|
function tn() {
|
|
1843
|
-
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: [
|
|
1844
1846
|
/* @__PURE__ */ n("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1845
1847
|
/* @__PURE__ */ n("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1846
1848
|
] });
|
|
@@ -1849,20 +1851,20 @@ function nn() {
|
|
|
1849
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" }) });
|
|
1850
1852
|
}
|
|
1851
1853
|
function fn() {
|
|
1852
|
-
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: [
|
|
1853
1855
|
/* @__PURE__ */ n("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
|
|
1854
1856
|
/* @__PURE__ */ n("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
|
|
1855
1857
|
/* @__PURE__ */ n("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
|
|
1856
1858
|
] });
|
|
1857
1859
|
}
|
|
1858
1860
|
function pn() {
|
|
1859
|
-
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: [
|
|
1860
1862
|
/* @__PURE__ */ n("path", { d: "M23 7l-7 5 7 5V7z" }),
|
|
1861
1863
|
/* @__PURE__ */ n("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
|
|
1862
1864
|
] });
|
|
1863
1865
|
}
|
|
1864
1866
|
function hn({ muted: e }) {
|
|
1865
|
-
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: [
|
|
1866
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" }),
|
|
1867
1869
|
/* @__PURE__ */ n("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
|
|
1868
1870
|
/* @__PURE__ */ n("line", { x1: "12", y1: "19", x2: "12", y2: "23" }),
|
|
@@ -1870,16 +1872,16 @@ function hn({ muted: e }) {
|
|
|
1870
1872
|
] });
|
|
1871
1873
|
}
|
|
1872
1874
|
function mn({ muted: e }) {
|
|
1873
|
-
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: [
|
|
1874
1876
|
/* @__PURE__ */ n("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
1875
|
-
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: [
|
|
1876
1878
|
/* @__PURE__ */ n("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
|
|
1877
1879
|
/* @__PURE__ */ n("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
|
|
1878
1880
|
] })
|
|
1879
1881
|
] });
|
|
1880
1882
|
}
|
|
1881
1883
|
function Nr() {
|
|
1882
|
-
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: [
|
|
1883
1885
|
/* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
|
|
1884
1886
|
/* @__PURE__ */ n("polyline", { points: "12 5 19 12 12 19" })
|
|
1885
1887
|
] });
|
|
@@ -1893,7 +1895,7 @@ function gn() {
|
|
|
1893
1895
|
}
|
|
1894
1896
|
) });
|
|
1895
1897
|
}
|
|
1896
|
-
const rn = ({ label: e, devices: t, activeId: r, onPick: o }) => /* @__PURE__ */
|
|
1898
|
+
const rn = ({ label: e, devices: t, activeId: r, onPick: o }) => /* @__PURE__ */ y(
|
|
1897
1899
|
"div",
|
|
1898
1900
|
{
|
|
1899
1901
|
className: "ll-device-menu",
|
|
@@ -1903,7 +1905,7 @@ const rn = ({ label: e, devices: t, activeId: r, onPick: o }) => /* @__PURE__ */
|
|
|
1903
1905
|
/* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
|
|
1904
1906
|
t.map((i, l) => {
|
|
1905
1907
|
const u = r === i.deviceId;
|
|
1906
|
-
return /* @__PURE__ */
|
|
1908
|
+
return /* @__PURE__ */ y(
|
|
1907
1909
|
"button",
|
|
1908
1910
|
{
|
|
1909
1911
|
type: "button",
|
|
@@ -1951,7 +1953,7 @@ const mt = 4096, Rr = 20, Ir = 20, Tr = 10, Mr = 10, Dr = 30, Pr = 20, on = 500,
|
|
|
1951
1953
|
"noscript",
|
|
1952
1954
|
"iframe"
|
|
1953
1955
|
];
|
|
1954
|
-
function
|
|
1956
|
+
function rt(e) {
|
|
1955
1957
|
if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
|
|
1956
1958
|
let t = e;
|
|
1957
1959
|
for (; t; ) {
|
|
@@ -1961,7 +1963,7 @@ function ot(e) {
|
|
|
1961
1963
|
}
|
|
1962
1964
|
return !1;
|
|
1963
1965
|
}
|
|
1964
|
-
function
|
|
1966
|
+
function ot(e) {
|
|
1965
1967
|
if (typeof window > "u") return !0;
|
|
1966
1968
|
const t = e.getBoundingClientRect();
|
|
1967
1969
|
if (t.width <= 0 || t.height <= 0) return !1;
|
|
@@ -2004,85 +2006,85 @@ function zr(e, t = {}) {
|
|
|
2004
2006
|
const o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "", u = Array.from(
|
|
2005
2007
|
r.querySelectorAll("[data-ll-region]")
|
|
2006
2008
|
), d = [];
|
|
2007
|
-
for (const
|
|
2009
|
+
for (const _ of u) {
|
|
2008
2010
|
if (d.length >= Tr) break;
|
|
2009
|
-
if (
|
|
2010
|
-
const I =
|
|
2011
|
-
(
|
|
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(),
|
|
2012
2014
|
on * 2
|
|
2013
2015
|
);
|
|
2014
|
-
!I || !
|
|
2016
|
+
!I || !O || d.push({ id: I, intent: q, text: O });
|
|
2015
2017
|
}
|
|
2016
2018
|
const c = [], f = ["H1", "H2", "H3", "H4", "H5", "H6"], h = Array.from(
|
|
2017
2019
|
r.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
|
2018
2020
|
);
|
|
2019
|
-
for (const
|
|
2020
|
-
if (
|
|
2021
|
-
const I = (
|
|
2022
|
-
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)}`);
|
|
2023
2025
|
}
|
|
2024
2026
|
const a = Array.from(r.querySelectorAll("p, li"));
|
|
2025
|
-
for (const
|
|
2026
|
-
if (
|
|
2027
|
-
const I = (
|
|
2027
|
+
for (const _ of a) {
|
|
2028
|
+
if (rt(_) || !ot(_) || f.includes(_.tagName)) continue;
|
|
2029
|
+
const I = (_.textContent || "").trim();
|
|
2028
2030
|
I.length > 10 && c.push(ye(I, on));
|
|
2029
2031
|
}
|
|
2030
2032
|
const s = c.join(`
|
|
2031
|
-
`),
|
|
2032
|
-
for (const
|
|
2033
|
-
if (
|
|
2034
|
-
if (
|
|
2035
|
-
const I =
|
|
2036
|
-
!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) });
|
|
2037
2039
|
}
|
|
2038
|
-
const E = [],
|
|
2040
|
+
const E = [], b = Array.from(
|
|
2039
2041
|
r.querySelectorAll(
|
|
2040
2042
|
"input, textarea, select"
|
|
2041
2043
|
)
|
|
2042
2044
|
);
|
|
2043
|
-
for (const
|
|
2045
|
+
for (const _ of b) {
|
|
2044
2046
|
if (E.length >= Ir) break;
|
|
2045
|
-
if (
|
|
2046
|
-
const I = ln(
|
|
2047
|
-
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 });
|
|
2048
2050
|
}
|
|
2049
|
-
const
|
|
2051
|
+
const w = Array.from(
|
|
2050
2052
|
r.querySelectorAll("[data-ll-form]")
|
|
2051
|
-
),
|
|
2052
|
-
for (const
|
|
2053
|
-
if (
|
|
2054
|
-
if (At(
|
|
2055
|
-
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") || "";
|
|
2056
2058
|
if (!I) continue;
|
|
2057
|
-
const
|
|
2058
|
-
|
|
2059
|
+
const q = _.getAttribute("data-ll-intent") || void 0, O = Array.from(
|
|
2060
|
+
_.querySelectorAll(
|
|
2059
2061
|
"[data-ll-field]"
|
|
2060
2062
|
)
|
|
2061
2063
|
), C = [];
|
|
2062
|
-
for (const P of
|
|
2064
|
+
for (const P of O) {
|
|
2063
2065
|
if (C.length >= Dr) break;
|
|
2064
2066
|
if (!yt(P)) continue;
|
|
2065
2067
|
const F = P.getAttribute("data-ll-field") || "";
|
|
2066
2068
|
if (!F) continue;
|
|
2067
|
-
const G = ln(P) || F, le = P instanceof HTMLInputElement ? P.type : P.tagName.toLowerCase(),
|
|
2069
|
+
const G = ln(P) || F, le = P instanceof HTMLInputElement ? P.type : P.tagName.toLowerCase(), ee = {
|
|
2068
2070
|
name: F,
|
|
2069
2071
|
label: ye(G, 100),
|
|
2070
2072
|
type: le
|
|
2071
2073
|
};
|
|
2072
|
-
if (P.required === !0 && (
|
|
2074
|
+
if (P.required === !0 && (ee.required = !0), P instanceof HTMLSelectElement) {
|
|
2073
2075
|
const ue = [];
|
|
2074
2076
|
for (let ve = 0; ve < P.options.length && !(ue.length >= Pr); ve++) {
|
|
2075
2077
|
const fe = P.options[ve];
|
|
2076
2078
|
if (!fe || fe.disabled) continue;
|
|
2077
|
-
const ae = fe.value || "",
|
|
2078
|
-
!ae && !
|
|
2079
|
+
const ae = fe.value || "", X = (fe.textContent || "").trim() || ae;
|
|
2080
|
+
!ae && !X || ue.push({ value: ae, label: ye(X, 60) });
|
|
2079
2081
|
}
|
|
2080
|
-
ue.length > 0 && (
|
|
2082
|
+
ue.length > 0 && (ee.options = ue);
|
|
2081
2083
|
}
|
|
2082
2084
|
const Le = typeof P.validationMessage == "string" ? P.validationMessage : "";
|
|
2083
|
-
Le && (
|
|
2085
|
+
Le && (ee.validationMessage = ye(Le, 200)), C.push(ee);
|
|
2084
2086
|
}
|
|
2085
|
-
|
|
2087
|
+
R.push({ id: I, intent: q, fields: C });
|
|
2086
2088
|
}
|
|
2087
2089
|
const T = {
|
|
2088
2090
|
url: o,
|
|
@@ -2090,16 +2092,16 @@ function zr(e, t = {}) {
|
|
|
2090
2092
|
pathname: i,
|
|
2091
2093
|
regions: d,
|
|
2092
2094
|
visibleText: s,
|
|
2093
|
-
visibleLinks:
|
|
2095
|
+
visibleLinks: A,
|
|
2094
2096
|
visibleFields: E,
|
|
2095
|
-
forms:
|
|
2097
|
+
forms: R,
|
|
2096
2098
|
extras: e
|
|
2097
2099
|
};
|
|
2098
|
-
let
|
|
2099
|
-
for (;
|
|
2100
|
-
T.visibleFields.pop(),
|
|
2101
|
-
for (;
|
|
2102
|
-
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;
|
|
2103
2105
|
return Be(T.visibleText) > mt && (T.visibleText = ye(T.visibleText, mt - 100)), T;
|
|
2104
2106
|
}
|
|
2105
2107
|
let qe = null;
|
|
@@ -2247,7 +2249,7 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2247
2249
|
"focus_field",
|
|
2248
2250
|
"submit_form",
|
|
2249
2251
|
"request_routes"
|
|
2250
|
-
]), yn =
|
|
2252
|
+
]), yn = lt(
|
|
2251
2253
|
function(t, r) {
|
|
2252
2254
|
var Ot, Ht, Wt, Bt, qt, Ft, Ut;
|
|
2253
2255
|
const {
|
|
@@ -2261,37 +2263,37 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2261
2263
|
autoConnect: h = !1,
|
|
2262
2264
|
displayMode: a,
|
|
2263
2265
|
defaultDisplayMode: s = "expanded",
|
|
2264
|
-
onDisplayModeChange:
|
|
2266
|
+
onDisplayModeChange: A,
|
|
2265
2267
|
position: D = "bottom-right",
|
|
2266
2268
|
mobileBreakpoint: E = 640,
|
|
2267
|
-
persistKey:
|
|
2268
|
-
disablePersistence:
|
|
2269
|
-
teamMembers:
|
|
2269
|
+
persistKey: b = "ll-widget",
|
|
2270
|
+
disablePersistence: w = !1,
|
|
2271
|
+
teamMembers: R,
|
|
2270
2272
|
currentTeamMemberId: T,
|
|
2271
|
-
onTeamMemberChange:
|
|
2272
|
-
idleLoopUrl:
|
|
2273
|
+
onTeamMemberChange: z,
|
|
2274
|
+
idleLoopUrl: _,
|
|
2273
2275
|
greeting: I,
|
|
2274
|
-
avatarImageUrl:
|
|
2275
|
-
agentName:
|
|
2276
|
+
avatarImageUrl: q,
|
|
2277
|
+
agentName: O,
|
|
2276
2278
|
branding: C = {},
|
|
2277
2279
|
allowCamera: P = !0,
|
|
2278
2280
|
allowScreenShare: F = !0,
|
|
2279
2281
|
allowTyping: G = !0,
|
|
2280
2282
|
showMinimize: le = !0,
|
|
2281
|
-
chromeless:
|
|
2283
|
+
chromeless: ee = !1,
|
|
2282
2284
|
compactControls: Le = !1,
|
|
2283
2285
|
transforming: ue = !1,
|
|
2284
2286
|
transformingLabel: ve = "Transforming…",
|
|
2285
2287
|
showOn: fe,
|
|
2286
2288
|
hideOn: ae,
|
|
2287
|
-
pathname:
|
|
2288
|
-
onNavigate:
|
|
2289
|
+
pathname: X,
|
|
2290
|
+
onNavigate: at,
|
|
2289
2291
|
onScrollToSelector: je,
|
|
2290
|
-
getPageContext:
|
|
2292
|
+
getPageContext: st,
|
|
2291
2293
|
pageContextExtras: ne,
|
|
2292
2294
|
getRoutes: Ve,
|
|
2293
2295
|
onScrollPage: Ye,
|
|
2294
|
-
onClick:
|
|
2296
|
+
onClick: ct,
|
|
2295
2297
|
capabilities: Ge,
|
|
2296
2298
|
onConnect: Ee,
|
|
2297
2299
|
onDisconnect: Ce,
|
|
@@ -2300,45 +2302,45 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2300
2302
|
onConnectionStateChange: Ne,
|
|
2301
2303
|
onAgentEvent: Ae,
|
|
2302
2304
|
onAgentCommand: Re,
|
|
2303
|
-
controlledSession:
|
|
2305
|
+
controlledSession: $,
|
|
2304
2306
|
className: vt,
|
|
2305
2307
|
style: Ie,
|
|
2306
2308
|
zIndex: $e = 2147483647
|
|
2307
|
-
} = t, re = rr(
|
|
2308
|
-
|
|
2309
|
+
} = t, re = rr(X), Je = dr(re, fe, ae);
|
|
2310
|
+
N(() => {
|
|
2309
2311
|
Or(), Ur();
|
|
2310
2312
|
}, [re]);
|
|
2311
2313
|
const Te = T !== void 0, [ze, bt] = L(() => {
|
|
2312
|
-
var
|
|
2313
|
-
return T ?? ((
|
|
2314
|
-
}), be = Te ? T : ze,
|
|
2315
|
-
() => (
|
|
2316
|
-
[
|
|
2317
|
-
), Ke = (
|
|
2314
|
+
var g;
|
|
2315
|
+
return T ?? ((g = R == null ? void 0 : R[0]) == null ? void 0 : g.id);
|
|
2316
|
+
}), be = Te ? T : ze, Q = Ue(
|
|
2317
|
+
() => (R == null ? void 0 : R.find((g) => g.id === be)) ?? null,
|
|
2318
|
+
[R, be]
|
|
2319
|
+
), Ke = (Q == null ? void 0 : Q.agentId) ?? o, Me = f === "EMBEDDED", [se, te] = Zn({
|
|
2318
2320
|
value: Me ? "expanded" : a,
|
|
2319
2321
|
defaultValue: Me ? "expanded" : s,
|
|
2320
|
-
onChange:
|
|
2321
|
-
persistKey:
|
|
2322
|
-
disablePersistence: Me ||
|
|
2323
|
-
}), pe = tr(E), we = Bn(), oe = qn(), he = Un(), De = jn(), _e = Vn(), [
|
|
2324
|
-
|
|
2325
|
-
const _t = S(
|
|
2326
|
-
_t.current =
|
|
2327
|
-
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) {
|
|
2328
2330
|
const p = Et.current;
|
|
2329
|
-
return p ? p.includes(
|
|
2331
|
+
return p ? p.includes(g) : !0;
|
|
2330
2332
|
}
|
|
2331
|
-
function ke(
|
|
2333
|
+
function ke(g, p) {
|
|
2332
2334
|
console.warn(
|
|
2333
|
-
`[LiveLayer] Agent command "${
|
|
2335
|
+
`[LiveLayer] Agent command "${g}" blocked — capability "${p}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
|
|
2334
2336
|
);
|
|
2335
2337
|
}
|
|
2336
|
-
const
|
|
2337
|
-
(
|
|
2338
|
-
var Y, ie, ge,
|
|
2339
|
-
const p =
|
|
2338
|
+
const Ze = k(
|
|
2339
|
+
(g) => {
|
|
2340
|
+
var Y, ie, ge, nt;
|
|
2341
|
+
const p = g;
|
|
2340
2342
|
if (!(!p.type || typeof p.type != "string")) {
|
|
2341
|
-
if (Ae == null || Ae({ eventName: p.type, data:
|
|
2343
|
+
if (Ae == null || Ae({ eventName: p.type, data: g }), p.type === "navigate") {
|
|
2342
2344
|
if (!xe("navigate")) {
|
|
2343
2345
|
ke("navigate", "navigate");
|
|
2344
2346
|
return;
|
|
@@ -2350,7 +2352,7 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2350
2352
|
);
|
|
2351
2353
|
return;
|
|
2352
2354
|
}
|
|
2353
|
-
if (
|
|
2355
|
+
if (ft.current.playPageChange(), _t.current) {
|
|
2354
2356
|
try {
|
|
2355
2357
|
_t.current(x);
|
|
2356
2358
|
} catch (M) {
|
|
@@ -2395,28 +2397,28 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2395
2397
|
x,
|
|
2396
2398
|
M
|
|
2397
2399
|
);
|
|
2398
|
-
} catch (
|
|
2399
|
-
console.warn("[LiveLayer] onScrollToSelector threw.",
|
|
2400
|
+
} catch (B) {
|
|
2401
|
+
console.warn("[LiveLayer] onScrollToSelector threw.", B);
|
|
2400
2402
|
}
|
|
2401
2403
|
return;
|
|
2402
2404
|
}
|
|
2403
2405
|
if (typeof document < "u") {
|
|
2404
|
-
let
|
|
2406
|
+
let B = null;
|
|
2405
2407
|
try {
|
|
2406
|
-
|
|
2408
|
+
B = document.querySelector(x);
|
|
2407
2409
|
} catch {
|
|
2408
2410
|
console.warn(
|
|
2409
2411
|
`[LiveLayer] scroll_to: invalid selector "${x}".`
|
|
2410
2412
|
);
|
|
2411
2413
|
return;
|
|
2412
2414
|
}
|
|
2413
|
-
if (!
|
|
2415
|
+
if (!B) {
|
|
2414
2416
|
console.warn(
|
|
2415
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`
|
|
2416
2418
|
);
|
|
2417
2419
|
return;
|
|
2418
2420
|
}
|
|
2419
|
-
|
|
2421
|
+
B.scrollIntoView({
|
|
2420
2422
|
behavior: M,
|
|
2421
2423
|
block: "start"
|
|
2422
2424
|
});
|
|
@@ -2428,45 +2430,45 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2428
2430
|
ke("request_page_context", "read_page");
|
|
2429
2431
|
return;
|
|
2430
2432
|
}
|
|
2431
|
-
const x = typeof p.requestId == "string" ? p.requestId : void 0, M = (Y = de.current) == null ? void 0 : Y.call(de),
|
|
2432
|
-
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;
|
|
2433
2435
|
if (K != null && K.publishData)
|
|
2434
2436
|
try {
|
|
2435
|
-
const
|
|
2437
|
+
const Z = x ? { ...j, requestId: x } : j, We = new TextEncoder().encode(JSON.stringify(Z));
|
|
2436
2438
|
K.publishData(We, { reliable: !0 });
|
|
2437
|
-
} catch (
|
|
2438
|
-
console.warn("[LiveLayer] publishData failed.",
|
|
2439
|
+
} catch (Z) {
|
|
2440
|
+
console.warn("[LiveLayer] publishData failed.", Z);
|
|
2439
2441
|
}
|
|
2440
|
-
},
|
|
2442
|
+
}, W = It.current, U = Rt.current;
|
|
2441
2443
|
try {
|
|
2442
2444
|
if (U) {
|
|
2443
|
-
const
|
|
2444
|
-
if (
|
|
2445
|
-
|
|
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) => {
|
|
2446
2448
|
console.warn(
|
|
2447
2449
|
"[LiveLayer] getPageContext rejected; falling back to default walker.",
|
|
2448
|
-
|
|
2449
|
-
),
|
|
2450
|
+
H
|
|
2451
|
+
), B({
|
|
2450
2452
|
type: "page_context",
|
|
2451
|
-
context: an(
|
|
2453
|
+
context: an(W)
|
|
2452
2454
|
});
|
|
2453
2455
|
});
|
|
2454
2456
|
return;
|
|
2455
2457
|
}
|
|
2456
|
-
|
|
2458
|
+
B({ type: "page_context", context: j });
|
|
2457
2459
|
return;
|
|
2458
2460
|
}
|
|
2459
|
-
|
|
2461
|
+
B({
|
|
2460
2462
|
type: "page_context",
|
|
2461
|
-
context: an(
|
|
2463
|
+
context: an(W)
|
|
2462
2464
|
});
|
|
2463
|
-
} catch (
|
|
2465
|
+
} catch (j) {
|
|
2464
2466
|
console.warn(
|
|
2465
2467
|
"[LiveLayer] page-context extraction threw. Sending empty context.",
|
|
2466
|
-
|
|
2467
|
-
),
|
|
2468
|
+
j
|
|
2469
|
+
), B({
|
|
2468
2470
|
type: "page_context",
|
|
2469
|
-
context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras:
|
|
2471
|
+
context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: W }
|
|
2470
2472
|
});
|
|
2471
2473
|
}
|
|
2472
2474
|
return;
|
|
@@ -2490,18 +2492,18 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2490
2492
|
x,
|
|
2491
2493
|
M
|
|
2492
2494
|
);
|
|
2493
|
-
} catch (
|
|
2494
|
-
console.warn("[LiveLayer] onScrollPage threw.",
|
|
2495
|
+
} catch (H) {
|
|
2496
|
+
console.warn("[LiveLayer] onScrollPage threw.", H);
|
|
2495
2497
|
}
|
|
2496
2498
|
return;
|
|
2497
2499
|
}
|
|
2498
2500
|
if (typeof window > "u") return;
|
|
2499
|
-
const
|
|
2500
|
-
|
|
2501
|
-
},
|
|
2502
|
-
|
|
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 });
|
|
2503
2505
|
};
|
|
2504
|
-
x === "up" ? U(-sn(
|
|
2506
|
+
x === "up" ? U(-sn(W)) : x === "down" ? U(sn(W)) : j(x === "top" ? 0 : Xr(W));
|
|
2505
2507
|
return;
|
|
2506
2508
|
}
|
|
2507
2509
|
if (p.type === "click") {
|
|
@@ -2517,8 +2519,8 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2517
2519
|
if (Lt.current) {
|
|
2518
2520
|
try {
|
|
2519
2521
|
Lt.current(x);
|
|
2520
|
-
} catch (
|
|
2521
|
-
console.warn("[LiveLayer] onClick threw.",
|
|
2522
|
+
} catch (B) {
|
|
2523
|
+
console.warn("[LiveLayer] onClick threw.", B);
|
|
2522
2524
|
}
|
|
2523
2525
|
return;
|
|
2524
2526
|
}
|
|
@@ -2553,7 +2555,7 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2553
2555
|
return;
|
|
2554
2556
|
}
|
|
2555
2557
|
if (typeof document > "u") return;
|
|
2556
|
-
p.type === "fill_form" &&
|
|
2558
|
+
p.type === "fill_form" && ft.current.playConfirmation();
|
|
2557
2559
|
const x = typeof p.formId == "string" ? p.formId : null;
|
|
2558
2560
|
if (!x) {
|
|
2559
2561
|
console.warn(`[LiveLayer] ${p.type}: missing formId.`);
|
|
@@ -2575,53 +2577,53 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2575
2577
|
return;
|
|
2576
2578
|
}
|
|
2577
2579
|
if (p.type === "focus_field") {
|
|
2578
|
-
const
|
|
2579
|
-
if (!
|
|
2580
|
+
const W = typeof p.fieldName == "string" ? p.fieldName : null;
|
|
2581
|
+
if (!W) {
|
|
2580
2582
|
console.warn("[LiveLayer] focus_field: missing fieldName.");
|
|
2581
2583
|
return;
|
|
2582
2584
|
}
|
|
2583
|
-
const U = M.querySelector(`[data-ll-field="${
|
|
2585
|
+
const U = M.querySelector(`[data-ll-field="${W.replace(/"/g, '\\"')}"]`);
|
|
2584
2586
|
if (!U) {
|
|
2585
2587
|
console.warn(
|
|
2586
|
-
`[LiveLayer] focus_field: no field "${
|
|
2588
|
+
`[LiveLayer] focus_field: no field "${W}" in form "${x}".`
|
|
2587
2589
|
);
|
|
2588
2590
|
return;
|
|
2589
2591
|
}
|
|
2590
2592
|
if (!yt(U)) {
|
|
2591
2593
|
console.warn(
|
|
2592
|
-
`[LiveLayer] focus_field: field "${
|
|
2594
|
+
`[LiveLayer] focus_field: field "${W}" is privacy-protected and not focusable.`
|
|
2593
2595
|
);
|
|
2594
2596
|
return;
|
|
2595
2597
|
}
|
|
2596
2598
|
U.focus();
|
|
2597
2599
|
return;
|
|
2598
2600
|
}
|
|
2599
|
-
const
|
|
2600
|
-
if (!
|
|
2601
|
+
const B = p.values && typeof p.values == "object" ? p.values : null;
|
|
2602
|
+
if (!B) {
|
|
2601
2603
|
console.warn("[LiveLayer] fill_form: missing or invalid values.");
|
|
2602
2604
|
return;
|
|
2603
2605
|
}
|
|
2604
|
-
for (const [
|
|
2606
|
+
for (const [W, U] of Object.entries(B)) {
|
|
2605
2607
|
if (typeof U != "string") continue;
|
|
2606
|
-
const
|
|
2607
|
-
if (!
|
|
2608
|
+
const j = M.querySelector(`[data-ll-field="${W.replace(/"/g, '\\"')}"]`);
|
|
2609
|
+
if (!j) {
|
|
2608
2610
|
console.warn(
|
|
2609
|
-
`[LiveLayer] fill_form: no field "${
|
|
2611
|
+
`[LiveLayer] fill_form: no field "${W}" in form "${x}". Skipping.`
|
|
2610
2612
|
);
|
|
2611
2613
|
continue;
|
|
2612
2614
|
}
|
|
2613
|
-
if (!yt(
|
|
2615
|
+
if (!yt(j)) {
|
|
2614
2616
|
console.warn(
|
|
2615
|
-
`[LiveLayer] fill_form: field "${
|
|
2617
|
+
`[LiveLayer] fill_form: field "${W}" is privacy-protected (password / cc-* / private). Skipping.`
|
|
2616
2618
|
);
|
|
2617
2619
|
continue;
|
|
2618
2620
|
}
|
|
2619
2621
|
try {
|
|
2620
|
-
Vr(
|
|
2621
|
-
} catch (
|
|
2622
|
+
Vr(j, U);
|
|
2623
|
+
} catch (H) {
|
|
2622
2624
|
console.warn(
|
|
2623
|
-
`[LiveLayer] fill_form: failed to set "${
|
|
2624
|
-
|
|
2625
|
+
`[LiveLayer] fill_form: failed to set "${W}".`,
|
|
2626
|
+
H
|
|
2625
2627
|
);
|
|
2626
2628
|
}
|
|
2627
2629
|
}
|
|
@@ -2638,7 +2640,7 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2638
2640
|
console.warn("[LiveLayer] submit_form: missing formId.");
|
|
2639
2641
|
return;
|
|
2640
2642
|
}
|
|
2641
|
-
|
|
2643
|
+
ft.current.playConfirmation();
|
|
2642
2644
|
const M = document.querySelector(
|
|
2643
2645
|
`[data-ll-form="${x.replace(/"/g, '\\"')}"]`
|
|
2644
2646
|
);
|
|
@@ -2654,24 +2656,24 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2654
2656
|
);
|
|
2655
2657
|
return;
|
|
2656
2658
|
}
|
|
2657
|
-
const
|
|
2658
|
-
const
|
|
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;
|
|
2659
2661
|
if (We != null && We.publishData)
|
|
2660
2662
|
try {
|
|
2661
|
-
const An =
|
|
2663
|
+
const An = B ? { ...K, requestId: B } : K, Rn = new TextEncoder().encode(JSON.stringify(An));
|
|
2662
2664
|
We.publishData(Rn, { reliable: !0 });
|
|
2663
2665
|
} catch {
|
|
2664
2666
|
}
|
|
2665
2667
|
};
|
|
2666
|
-
let
|
|
2667
|
-
const
|
|
2668
|
-
|
|
2668
|
+
let j = !1;
|
|
2669
|
+
const H = () => {
|
|
2670
|
+
j = !0, U({ type: "form_submitted", formId: x });
|
|
2669
2671
|
};
|
|
2670
|
-
M.addEventListener("submit",
|
|
2672
|
+
M.addEventListener("submit", H, { once: !0 });
|
|
2671
2673
|
try {
|
|
2672
2674
|
typeof M.requestSubmit == "function" ? M.requestSubmit() : M.submit();
|
|
2673
2675
|
} catch (K) {
|
|
2674
|
-
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({
|
|
2675
2677
|
type: "form_submit_blocked",
|
|
2676
2678
|
formId: x,
|
|
2677
2679
|
reason: "exception"
|
|
@@ -2679,7 +2681,7 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2679
2681
|
return;
|
|
2680
2682
|
}
|
|
2681
2683
|
setTimeout(() => {
|
|
2682
|
-
|
|
2684
|
+
j || (M.removeEventListener("submit", H), U({
|
|
2683
2685
|
type: "form_submit_blocked",
|
|
2684
2686
|
formId: x,
|
|
2685
2687
|
reason: "validation"
|
|
@@ -2692,43 +2694,43 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2692
2694
|
ke("request_routes", "read_page");
|
|
2693
2695
|
return;
|
|
2694
2696
|
}
|
|
2695
|
-
const x = typeof p.requestId == "string" ? p.requestId : void 0,
|
|
2696
|
-
if (!(
|
|
2697
|
-
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) => {
|
|
2698
2700
|
try {
|
|
2699
|
-
const K = x ? { type: "routes", routes:
|
|
2700
|
-
|
|
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 });
|
|
2701
2703
|
} catch (K) {
|
|
2702
2704
|
console.warn("[LiveLayer] request_routes: publishData failed.", K);
|
|
2703
2705
|
}
|
|
2704
|
-
},
|
|
2705
|
-
if (
|
|
2706
|
+
}, j = Tt.current;
|
|
2707
|
+
if (j) {
|
|
2706
2708
|
try {
|
|
2707
|
-
const
|
|
2708
|
-
if (!Array.isArray(
|
|
2709
|
+
const H = j(), K = (Z) => {
|
|
2710
|
+
if (!Array.isArray(Z)) {
|
|
2709
2711
|
U([]);
|
|
2710
2712
|
return;
|
|
2711
2713
|
}
|
|
2712
|
-
U(
|
|
2714
|
+
U(Z.map(Wr).slice(0, 200));
|
|
2713
2715
|
};
|
|
2714
|
-
|
|
2716
|
+
H instanceof Promise ? H.then(K).catch((Z) => {
|
|
2715
2717
|
console.warn(
|
|
2716
2718
|
"[LiveLayer] getRoutes rejected; falling back to DOM walker.",
|
|
2717
|
-
|
|
2719
|
+
Z
|
|
2718
2720
|
), U(St());
|
|
2719
|
-
}) : K(
|
|
2720
|
-
} catch (
|
|
2721
|
+
}) : K(H);
|
|
2722
|
+
} catch (H) {
|
|
2721
2723
|
console.warn(
|
|
2722
2724
|
"[LiveLayer] getRoutes threw; falling back to DOM walker.",
|
|
2723
|
-
|
|
2725
|
+
H
|
|
2724
2726
|
), U(St());
|
|
2725
2727
|
}
|
|
2726
2728
|
return;
|
|
2727
2729
|
}
|
|
2728
2730
|
try {
|
|
2729
2731
|
U(St());
|
|
2730
|
-
} catch (
|
|
2731
|
-
console.warn("[LiveLayer] request_routes: extractRoutes threw.",
|
|
2732
|
+
} catch (H) {
|
|
2733
|
+
console.warn("[LiveLayer] request_routes: extractRoutes threw.", H);
|
|
2732
2734
|
}
|
|
2733
2735
|
return;
|
|
2734
2736
|
}
|
|
@@ -2737,47 +2739,47 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2737
2739
|
},
|
|
2738
2740
|
[Re, Ae]
|
|
2739
2741
|
), J = Wn({
|
|
2740
|
-
agentId:
|
|
2742
|
+
agentId: $ ? "__controlled__" : Ke,
|
|
2741
2743
|
baseUrl: l,
|
|
2742
2744
|
apiKey: i,
|
|
2743
2745
|
sessionEndpoint: u,
|
|
2744
2746
|
sessionBody: d,
|
|
2745
|
-
onDataMessage:
|
|
2747
|
+
onDataMessage: $ ? void 0 : Ze
|
|
2746
2748
|
});
|
|
2747
|
-
|
|
2748
|
-
if (
|
|
2749
|
-
return
|
|
2750
|
-
}, [
|
|
2751
|
-
var
|
|
2752
|
-
return (
|
|
2753
|
-
},
|
|
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(() => {
|
|
2754
2756
|
var Y;
|
|
2755
2757
|
if (typeof window > "u") return;
|
|
2756
|
-
const
|
|
2757
|
-
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"))
|
|
2758
2760
|
return window.__livelayerSimulateCommand = (ie) => {
|
|
2759
2761
|
try {
|
|
2760
|
-
|
|
2762
|
+
Ze(ie);
|
|
2761
2763
|
} catch (ge) {
|
|
2762
2764
|
console.warn("[LiveLayer] simulate-command threw:", ge);
|
|
2763
2765
|
}
|
|
2764
2766
|
}, () => {
|
|
2765
2767
|
delete window.__livelayerSimulateCommand;
|
|
2766
2768
|
};
|
|
2767
|
-
}, [
|
|
2768
|
-
const
|
|
2769
|
-
connectionState:
|
|
2770
|
-
agentState:
|
|
2771
|
-
transcript:
|
|
2772
|
-
videoElement:
|
|
2773
|
-
audioElement:
|
|
2774
|
-
canResume:
|
|
2775
|
-
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,
|
|
2776
2778
|
agentConfig: null,
|
|
2777
2779
|
connect: async () => {
|
|
2778
|
-
await
|
|
2780
|
+
await $.onConnect();
|
|
2779
2781
|
},
|
|
2780
|
-
disconnect: () =>
|
|
2782
|
+
disconnect: () => $.onDisconnect(),
|
|
2781
2783
|
// Dummy getRoom for shape compatibility — controlled consumers own the Room.
|
|
2782
2784
|
// Internal session's getRoom returns null when no real connect has happened,
|
|
2783
2785
|
// so we reuse its reference for type consistency.
|
|
@@ -2796,27 +2798,27 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2796
2798
|
disconnect: J.disconnect,
|
|
2797
2799
|
getRoom: J.getRoom,
|
|
2798
2800
|
isControlled: !1
|
|
2799
|
-
}, [
|
|
2800
|
-
Mt.current =
|
|
2801
|
-
const Dt = S(
|
|
2802
|
-
Dt.current =
|
|
2801
|
+
}, [$, J]), Mt = S(v);
|
|
2802
|
+
Mt.current = v;
|
|
2803
|
+
const Dt = S($);
|
|
2804
|
+
Dt.current = $, Mn(
|
|
2803
2805
|
r,
|
|
2804
2806
|
() => ({
|
|
2805
|
-
sendData: async (
|
|
2806
|
-
var ge,
|
|
2807
|
+
sendData: async (g) => {
|
|
2808
|
+
var ge, nt;
|
|
2807
2809
|
const p = Dt.current;
|
|
2808
2810
|
if (p != null && p.publishData) {
|
|
2809
2811
|
try {
|
|
2810
|
-
await p.publishData(
|
|
2812
|
+
await p.publishData(g);
|
|
2811
2813
|
} catch (x) {
|
|
2812
2814
|
console.warn("[AvatarWidget] sendData (controlled) failed:", x);
|
|
2813
2815
|
}
|
|
2814
2816
|
return;
|
|
2815
2817
|
}
|
|
2816
|
-
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;
|
|
2817
2819
|
if (ie != null && ie.publishData)
|
|
2818
2820
|
try {
|
|
2819
|
-
const x = new TextEncoder().encode(JSON.stringify(
|
|
2821
|
+
const x = new TextEncoder().encode(JSON.stringify(g));
|
|
2820
2822
|
await ie.publishData(x, { reliable: !0 });
|
|
2821
2823
|
} catch (x) {
|
|
2822
2824
|
console.warn("[AvatarWidget] sendData failed:", x);
|
|
@@ -2826,117 +2828,125 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2826
2828
|
[]
|
|
2827
2829
|
);
|
|
2828
2830
|
const Pt = S(null);
|
|
2829
|
-
|
|
2830
|
-
const
|
|
2831
|
-
if (!(!
|
|
2832
|
-
return p.appendChild(
|
|
2833
|
-
|
|
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);
|
|
2834
2836
|
};
|
|
2835
|
-
}, [
|
|
2836
|
-
const
|
|
2837
|
-
if (!
|
|
2838
|
-
we.attach(
|
|
2839
|
-
const p =
|
|
2837
|
+
}, [v.videoElement]), N(() => {
|
|
2838
|
+
const g = v.audioElement;
|
|
2839
|
+
if (!g) return;
|
|
2840
|
+
we.attach(g);
|
|
2841
|
+
const p = g.play();
|
|
2840
2842
|
return p && typeof p.catch == "function" && p.catch((Y) => {
|
|
2841
2843
|
(Y == null ? void 0 : Y.name) === "NotAllowedError" && Xe(!0);
|
|
2842
2844
|
}), () => {
|
|
2843
2845
|
we.detach();
|
|
2844
2846
|
};
|
|
2845
|
-
}, [
|
|
2846
|
-
if (
|
|
2847
|
-
const
|
|
2848
|
-
if (
|
|
2849
|
-
return oe.setupMic(
|
|
2850
|
-
}),
|
|
2851
|
-
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();
|
|
2852
2862
|
};
|
|
2853
|
-
}, [
|
|
2854
|
-
const
|
|
2855
|
-
|
|
2856
|
-
}, [
|
|
2857
|
-
const vn = k((
|
|
2858
|
-
const p = { type: "user_message", text:
|
|
2859
|
-
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) {
|
|
2860
2870
|
try {
|
|
2861
|
-
|
|
2871
|
+
$.publishData(p);
|
|
2862
2872
|
} catch {
|
|
2863
2873
|
}
|
|
2864
2874
|
return;
|
|
2865
2875
|
}
|
|
2866
|
-
const Y =
|
|
2876
|
+
const Y = v.getRoom();
|
|
2867
2877
|
if (Y)
|
|
2868
2878
|
try {
|
|
2869
2879
|
const ie = new TextEncoder().encode(JSON.stringify(p));
|
|
2870
2880
|
Y.localParticipant.publishData(ie, { reliable: !0 });
|
|
2871
2881
|
} catch {
|
|
2872
2882
|
}
|
|
2873
|
-
}, [
|
|
2874
|
-
m((
|
|
2883
|
+
}, [v, $]), bn = k(() => {
|
|
2884
|
+
m((g) => !g);
|
|
2875
2885
|
}, []);
|
|
2876
|
-
|
|
2877
|
-
Ne == null || Ne(
|
|
2878
|
-
}, [
|
|
2879
|
-
Pe == null || Pe(
|
|
2880
|
-
}, [
|
|
2881
|
-
Se == null || Se(
|
|
2882
|
-
}, [
|
|
2883
|
-
|
|
2884
|
-
}, [
|
|
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]);
|
|
2885
2895
|
const $t = S(!1);
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
}, [h,
|
|
2896
|
+
N(() => {
|
|
2897
|
+
v.isControlled || !h || $t.current || Je && v.connectionState === "idle" && ($t.current = !0, v.connect());
|
|
2898
|
+
}, [h, v.connectionState, v, Je]);
|
|
2889
2899
|
const wn = k(
|
|
2890
|
-
(
|
|
2891
|
-
const p =
|
|
2892
|
-
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)));
|
|
2893
2903
|
},
|
|
2894
2904
|
[
|
|
2895
|
-
|
|
2905
|
+
R,
|
|
2896
2906
|
be,
|
|
2897
|
-
|
|
2907
|
+
v,
|
|
2898
2908
|
Te,
|
|
2899
|
-
|
|
2909
|
+
z
|
|
2900
2910
|
]
|
|
2901
2911
|
);
|
|
2902
|
-
|
|
2903
|
-
Qe &&
|
|
2904
|
-
}, [
|
|
2912
|
+
N(() => {
|
|
2913
|
+
Qe && v.connectionState === "connected" && me(!1);
|
|
2914
|
+
}, [v.connectionState, Qe]), N(() => {
|
|
2905
2915
|
if (!ce) return;
|
|
2906
|
-
const
|
|
2916
|
+
const g = (p) => {
|
|
2907
2917
|
p.key === "Escape" && Oe(!1);
|
|
2908
2918
|
};
|
|
2909
|
-
return window.addEventListener("keydown",
|
|
2919
|
+
return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
|
|
2910
2920
|
}, [ce]);
|
|
2911
|
-
const _n = !!
|
|
2912
|
-
Ge === void 0 && ((Ot =
|
|
2913
|
-
const pt = (
|
|
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(
|
|
2914
2924
|
() => te("minimized"),
|
|
2915
2925
|
[te]
|
|
2916
2926
|
), zt = k(() => {
|
|
2917
|
-
|
|
2918
|
-
}, [
|
|
2919
|
-
const
|
|
2920
|
-
|
|
2927
|
+
v.disconnect(), te("hidden");
|
|
2928
|
+
}, [v, te]), Cn = k(() => {
|
|
2929
|
+
const g = v.audioElement;
|
|
2930
|
+
g && g.play().then(() => Xe(!1)).catch(() => {
|
|
2921
2931
|
});
|
|
2922
|
-
}, [
|
|
2923
|
-
Xe(!1),
|
|
2924
|
-
}, [
|
|
2932
|
+
}, [v.audioElement]), Sn = k(() => {
|
|
2933
|
+
Xe(!1), v.connect();
|
|
2934
|
+
}, [v]), tt = {
|
|
2925
2935
|
...Ie,
|
|
2926
2936
|
...Me ? {} : { zIndex: $e }
|
|
2927
2937
|
};
|
|
2928
|
-
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);
|
|
2929
2939
|
const Nn = [
|
|
2930
2940
|
"ll-widget",
|
|
2931
2941
|
`ll-widget--${se}`,
|
|
2932
2942
|
`ll-widget--${pe ? "mobile" : "desktop"}`,
|
|
2933
2943
|
vt
|
|
2934
2944
|
].filter(Boolean).join(" ");
|
|
2935
|
-
return Je ? /* @__PURE__ */
|
|
2945
|
+
return Je ? /* @__PURE__ */ y(
|
|
2936
2946
|
"div",
|
|
2937
2947
|
{
|
|
2938
2948
|
className: Nn,
|
|
2939
|
-
style:
|
|
2949
|
+
style: tt,
|
|
2940
2950
|
"data-display-mode": se,
|
|
2941
2951
|
"data-position": D,
|
|
2942
2952
|
"data-experience-mode": f === "EMBEDDED" ? "embedded" : "widget",
|
|
@@ -2946,7 +2956,7 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2946
2956
|
{
|
|
2947
2957
|
position: D,
|
|
2948
2958
|
isMobile: pe,
|
|
2949
|
-
isSpeaking:
|
|
2959
|
+
isSpeaking: v.agentState === "speaking",
|
|
2950
2960
|
onExpand: () => te("expanded"),
|
|
2951
2961
|
label: `Open ${pt} widget`,
|
|
2952
2962
|
avatarImageUrl: Ct,
|
|
@@ -2960,7 +2970,7 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2960
2970
|
isMobile: pe,
|
|
2961
2971
|
agentName: pt,
|
|
2962
2972
|
avatarImageUrl: Ct,
|
|
2963
|
-
agentState:
|
|
2973
|
+
agentState: v.agentState,
|
|
2964
2974
|
isMuted: oe.isMuted,
|
|
2965
2975
|
audioLevel: we,
|
|
2966
2976
|
onExpand: Ln,
|
|
@@ -2978,15 +2988,15 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2978
2988
|
idleLoopUrl: xn,
|
|
2979
2989
|
greeting: kn,
|
|
2980
2990
|
branding: C,
|
|
2981
|
-
teamMembers:
|
|
2991
|
+
teamMembers: R,
|
|
2982
2992
|
currentTeamMemberId: be,
|
|
2983
2993
|
isSwitchingTeamMember: Qe,
|
|
2984
2994
|
teamSwitcherOpen: ce,
|
|
2985
|
-
onToggleTeamSwitcher: () => Oe((
|
|
2995
|
+
onToggleTeamSwitcher: () => Oe((g) => !g),
|
|
2986
2996
|
onSelectTeamMember: wn,
|
|
2987
|
-
connectionState:
|
|
2988
|
-
agentState:
|
|
2989
|
-
transcript:
|
|
2997
|
+
connectionState: v.connectionState,
|
|
2998
|
+
agentState: v.agentState,
|
|
2999
|
+
transcript: v.transcript,
|
|
2990
3000
|
isMuted: oe.isMuted,
|
|
2991
3001
|
micDevices: _e.mics,
|
|
2992
3002
|
isCameraEnabled: he.isEnabled,
|
|
@@ -3000,25 +3010,25 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
3000
3010
|
allowScreenShare: F,
|
|
3001
3011
|
allowTyping: G,
|
|
3002
3012
|
showMinimize: le,
|
|
3003
|
-
chromeless:
|
|
3013
|
+
chromeless: ee,
|
|
3004
3014
|
compactControls: Le,
|
|
3005
3015
|
transforming: ue,
|
|
3006
3016
|
transformingLabel: ve,
|
|
3007
|
-
languageMenuOpen:
|
|
3008
|
-
onToggleLanguageMenu: () => wt((
|
|
3009
|
-
needsUserGesture:
|
|
3010
|
-
canResume:
|
|
3017
|
+
languageMenuOpen: ut,
|
|
3018
|
+
onToggleLanguageMenu: () => wt((g) => !g),
|
|
3019
|
+
needsUserGesture: dt,
|
|
3020
|
+
canResume: v.canResume,
|
|
3011
3021
|
micError: oe.micError,
|
|
3012
|
-
error:
|
|
3022
|
+
error: v.error,
|
|
3013
3023
|
avatarVideoContainerRef: Pt,
|
|
3014
|
-
agentVideoEl:
|
|
3015
|
-
onConnect: () => void
|
|
3016
|
-
onDisconnect: () =>
|
|
3024
|
+
agentVideoEl: v.videoElement,
|
|
3025
|
+
onConnect: () => void v.connect(),
|
|
3026
|
+
onDisconnect: () => v.disconnect(),
|
|
3017
3027
|
onRetry: Sn,
|
|
3018
3028
|
onResumeAudio: Cn,
|
|
3019
3029
|
onToggleMute: oe.toggleMute,
|
|
3020
3030
|
onToggleCamera: () => void he.toggle(),
|
|
3021
|
-
onSwitchCameraDevice: (
|
|
3031
|
+
onSwitchCameraDevice: (g) => void he.switchDevice(g),
|
|
3022
3032
|
onToggleScreenShare: () => void De.toggle(),
|
|
3023
3033
|
onToggleSpeaker: bn,
|
|
3024
3034
|
onSendMessage: vn,
|
|
@@ -3033,7 +3043,7 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
3033
3043
|
}
|
|
3034
3044
|
);
|
|
3035
3045
|
yn.displayName = "AvatarWidgetInner";
|
|
3036
|
-
const Zr =
|
|
3046
|
+
const Zr = lt(
|
|
3037
3047
|
function(t, r) {
|
|
3038
3048
|
return /* @__PURE__ */ n(Hn, { children: /* @__PURE__ */ n(yn, { ...t, ref: r }) });
|
|
3039
3049
|
}
|
|
@@ -3051,21 +3061,21 @@ const so = ({
|
|
|
3051
3061
|
const d = S(null), c = S(null), f = S(i);
|
|
3052
3062
|
f.current = i;
|
|
3053
3063
|
const h = k((a) => {
|
|
3054
|
-
var
|
|
3064
|
+
var A;
|
|
3055
3065
|
const s = a.detail;
|
|
3056
|
-
(
|
|
3066
|
+
(A = f.current) == null || A.call(f, s);
|
|
3057
3067
|
}, []);
|
|
3058
|
-
return
|
|
3068
|
+
return N(() => {
|
|
3059
3069
|
const a = d.current;
|
|
3060
3070
|
if (!a) return;
|
|
3061
3071
|
const s = document.createElement("livelayer-widget");
|
|
3062
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, () => {
|
|
3063
3073
|
s.removeEventListener("agent-event", h), a.removeChild(s), c.current = null;
|
|
3064
3074
|
};
|
|
3065
|
-
}, [e]),
|
|
3075
|
+
}, [e]), N(() => {
|
|
3066
3076
|
c.current && (o ? c.current.setAttribute("mode", o) : c.current.removeAttribute("mode"));
|
|
3067
3077
|
}, [o]), /* @__PURE__ */ n("div", { ref: d, className: l, style: u });
|
|
3068
|
-
}, co =
|
|
3078
|
+
}, co = lt(
|
|
3069
3079
|
function({ id: t, intent: r, as: o = "div", className: i, style: l, children: u }, d) {
|
|
3070
3080
|
return Dn(
|
|
3071
3081
|
o,
|
|
@@ -3079,7 +3089,7 @@ const so = ({
|
|
|
3079
3089
|
u
|
|
3080
3090
|
);
|
|
3081
3091
|
}
|
|
3082
|
-
), uo =
|
|
3092
|
+
), uo = lt(
|
|
3083
3093
|
function({ id: t, intent: r, children: o, ...i }, l) {
|
|
3084
3094
|
return /* @__PURE__ */ n(
|
|
3085
3095
|
"form",
|
|
@@ -3092,7 +3102,7 @@ const so = ({
|
|
|
3092
3102
|
}
|
|
3093
3103
|
);
|
|
3094
3104
|
}
|
|
3095
|
-
), fo =
|
|
3105
|
+
), fo = lt(
|
|
3096
3106
|
function(t, r) {
|
|
3097
3107
|
const { name: o, label: i, labelClassName: l } = t, u = { name: o, "data-ll-field": o };
|
|
3098
3108
|
let d;
|
|
@@ -3107,13 +3117,13 @@ const so = ({
|
|
|
3107
3117
|
}
|
|
3108
3118
|
);
|
|
3109
3119
|
} else if ("as" in t && t.as === "select") {
|
|
3110
|
-
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;
|
|
3111
3121
|
d = /* @__PURE__ */ n(
|
|
3112
3122
|
"select",
|
|
3113
3123
|
{
|
|
3114
3124
|
ref: r,
|
|
3115
3125
|
...u,
|
|
3116
|
-
...
|
|
3126
|
+
...A,
|
|
3117
3127
|
children: s
|
|
3118
3128
|
}
|
|
3119
3129
|
);
|
|
@@ -3128,7 +3138,7 @@ const so = ({
|
|
|
3128
3138
|
}
|
|
3129
3139
|
);
|
|
3130
3140
|
}
|
|
3131
|
-
return i === void 0 ? d : /* @__PURE__ */
|
|
3141
|
+
return i === void 0 ? d : /* @__PURE__ */ y("label", { className: l, children: [
|
|
3132
3142
|
i,
|
|
3133
3143
|
d
|
|
3134
3144
|
] });
|
|
@@ -3140,61 +3150,61 @@ function po({
|
|
|
3140
3150
|
defaultOpen: t = !1,
|
|
3141
3151
|
storageKey: r = "ll-debug-open"
|
|
3142
3152
|
}) {
|
|
3143
|
-
const [o, i] = L(t), [l, u] = L([]), [d, c] = L(""), [f, h] = L(!1), a = S(/* @__PURE__ */ new Set()), s = S([]),
|
|
3144
|
-
|
|
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(() => {
|
|
3145
3155
|
try {
|
|
3146
|
-
const
|
|
3147
|
-
|
|
3156
|
+
const b = localStorage.getItem(r);
|
|
3157
|
+
b === "1" && i(!0), b === "0" && i(!1);
|
|
3148
3158
|
} catch {
|
|
3149
3159
|
}
|
|
3150
|
-
}, [r]),
|
|
3160
|
+
}, [r]), N(() => {
|
|
3151
3161
|
try {
|
|
3152
3162
|
localStorage.setItem(r, o ? "1" : "0");
|
|
3153
3163
|
} catch {
|
|
3154
3164
|
}
|
|
3155
|
-
}, [o, r]),
|
|
3156
|
-
const
|
|
3157
|
-
(
|
|
3165
|
+
}, [o, r]), N(() => {
|
|
3166
|
+
const b = (w) => {
|
|
3167
|
+
(w.metaKey || w.ctrlKey) && w.shiftKey && w.key.toLowerCase() === "l" && (w.preventDefault(), i((R) => !R));
|
|
3158
3168
|
};
|
|
3159
|
-
return window.addEventListener("keydown",
|
|
3160
|
-
}, []),
|
|
3161
|
-
const
|
|
3162
|
-
if (s.current.length === 0 ||
|
|
3163
|
-
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);
|
|
3164
3174
|
u(
|
|
3165
|
-
(
|
|
3175
|
+
(R) => [...w.reverse(), ...R].slice(0, 200)
|
|
3166
3176
|
);
|
|
3167
3177
|
}, 100);
|
|
3168
|
-
return () => clearInterval(
|
|
3178
|
+
return () => clearInterval(b);
|
|
3169
3179
|
}, []);
|
|
3170
3180
|
const D = S(!1);
|
|
3171
|
-
if (
|
|
3172
|
-
!e || D.current || (D.current = !0, e((
|
|
3181
|
+
if (N(() => {
|
|
3182
|
+
!e || D.current || (D.current = !0, e((b) => {
|
|
3173
3183
|
s.current.push({
|
|
3174
3184
|
id: cn++,
|
|
3175
3185
|
ts: Date.now(),
|
|
3176
3186
|
kind: "event",
|
|
3177
|
-
type:
|
|
3178
|
-
data:
|
|
3187
|
+
type: b.eventName,
|
|
3188
|
+
data: b.data
|
|
3179
3189
|
});
|
|
3180
3190
|
}));
|
|
3181
|
-
}, [e]),
|
|
3182
|
-
const
|
|
3191
|
+
}, [e]), N(() => {
|
|
3192
|
+
const b = console.warn, w = console.log, R = (T, z) => function(..._) {
|
|
3183
3193
|
try {
|
|
3184
|
-
const I = typeof
|
|
3194
|
+
const I = typeof _[0] == "string" ? _[0] : "";
|
|
3185
3195
|
I.startsWith("[LiveLayer]") && s.current.push({
|
|
3186
3196
|
id: cn++,
|
|
3187
3197
|
ts: Date.now(),
|
|
3188
3198
|
kind: T,
|
|
3189
3199
|
type: I.slice(0, 120),
|
|
3190
|
-
data: { args:
|
|
3200
|
+
data: { args: _.slice(1).map((q) => to(q)) }
|
|
3191
3201
|
});
|
|
3192
3202
|
} catch {
|
|
3193
3203
|
}
|
|
3194
|
-
return
|
|
3204
|
+
return z.apply(this, _);
|
|
3195
3205
|
};
|
|
3196
|
-
return console.warn =
|
|
3197
|
-
console.warn =
|
|
3206
|
+
return console.warn = R("warn", b), console.log = R("log", w), () => {
|
|
3207
|
+
console.warn = b, console.log = w;
|
|
3198
3208
|
};
|
|
3199
3209
|
}, []), !o)
|
|
3200
3210
|
return /* @__PURE__ */ n(
|
|
@@ -3223,12 +3233,12 @@ function po({
|
|
|
3223
3233
|
children: "🛰 LL debug"
|
|
3224
3234
|
}
|
|
3225
3235
|
);
|
|
3226
|
-
const E = l.filter((
|
|
3236
|
+
const E = l.filter((b) => {
|
|
3227
3237
|
if (!d) return !0;
|
|
3228
|
-
const
|
|
3229
|
-
return
|
|
3238
|
+
const w = d.toLowerCase();
|
|
3239
|
+
return b.type.toLowerCase().includes(w) || JSON.stringify(b.data || {}).toLowerCase().includes(w);
|
|
3230
3240
|
});
|
|
3231
|
-
return /* @__PURE__ */
|
|
3241
|
+
return /* @__PURE__ */ y(
|
|
3232
3242
|
"div",
|
|
3233
3243
|
{
|
|
3234
3244
|
style: {
|
|
@@ -3250,7 +3260,7 @@ function po({
|
|
|
3250
3260
|
overflow: "hidden"
|
|
3251
3261
|
},
|
|
3252
3262
|
children: [
|
|
3253
|
-
/* @__PURE__ */
|
|
3263
|
+
/* @__PURE__ */ y(
|
|
3254
3264
|
"div",
|
|
3255
3265
|
{
|
|
3256
3266
|
style: {
|
|
@@ -3263,7 +3273,7 @@ function po({
|
|
|
3263
3273
|
},
|
|
3264
3274
|
children: [
|
|
3265
3275
|
/* @__PURE__ */ n("span", { style: { fontWeight: 600, fontSize: 12 }, children: "LiveLayer debug" }),
|
|
3266
|
-
/* @__PURE__ */
|
|
3276
|
+
/* @__PURE__ */ y("span", { style: { fontSize: 10, color: "rgba(255,255,255,0.4)" }, children: [
|
|
3267
3277
|
l.length,
|
|
3268
3278
|
" event",
|
|
3269
3279
|
l.length === 1 ? "" : "s"
|
|
@@ -3273,7 +3283,7 @@ function po({
|
|
|
3273
3283
|
"button",
|
|
3274
3284
|
{
|
|
3275
3285
|
type: "button",
|
|
3276
|
-
onClick: () => h((
|
|
3286
|
+
onClick: () => h((b) => !b),
|
|
3277
3287
|
style: Nt(f ? "#f59e0b" : "transparent"),
|
|
3278
3288
|
title: "Pause / resume capture",
|
|
3279
3289
|
children: f ? "▶ resume" : "⏸ pause"
|
|
@@ -3310,7 +3320,7 @@ function po({
|
|
|
3310
3320
|
{
|
|
3311
3321
|
type: "text",
|
|
3312
3322
|
value: d,
|
|
3313
|
-
onChange: (
|
|
3323
|
+
onChange: (b) => c(b.target.value),
|
|
3314
3324
|
placeholder: "filter by type or data…",
|
|
3315
3325
|
style: {
|
|
3316
3326
|
margin: 8,
|
|
@@ -3332,7 +3342,7 @@ function po({
|
|
|
3332
3342
|
overflowY: "auto",
|
|
3333
3343
|
padding: "0 8px 8px"
|
|
3334
3344
|
},
|
|
3335
|
-
children: E.length === 0 ? /* @__PURE__ */
|
|
3345
|
+
children: E.length === 0 ? /* @__PURE__ */ y(
|
|
3336
3346
|
"div",
|
|
3337
3347
|
{
|
|
3338
3348
|
style: {
|
|
@@ -3362,16 +3372,16 @@ function po({
|
|
|
3362
3372
|
)
|
|
3363
3373
|
]
|
|
3364
3374
|
}
|
|
3365
|
-
) : E.map((
|
|
3375
|
+
) : E.map((b) => /* @__PURE__ */ n(
|
|
3366
3376
|
eo,
|
|
3367
3377
|
{
|
|
3368
|
-
entry:
|
|
3369
|
-
expanded: a.current.has(
|
|
3378
|
+
entry: b,
|
|
3379
|
+
expanded: a.current.has(b.id),
|
|
3370
3380
|
onToggle: () => {
|
|
3371
|
-
a.current.has(
|
|
3381
|
+
a.current.has(b.id) ? a.current.delete(b.id) : a.current.add(b.id), u((w) => [...w]);
|
|
3372
3382
|
}
|
|
3373
3383
|
},
|
|
3374
|
-
|
|
3384
|
+
b.id
|
|
3375
3385
|
))
|
|
3376
3386
|
}
|
|
3377
3387
|
)
|
|
@@ -3387,7 +3397,7 @@ function eo({
|
|
|
3387
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", {
|
|
3388
3398
|
hour12: !1
|
|
3389
3399
|
});
|
|
3390
|
-
return /* @__PURE__ */
|
|
3400
|
+
return /* @__PURE__ */ y(
|
|
3391
3401
|
"button",
|
|
3392
3402
|
{
|
|
3393
3403
|
type: "button",
|
|
@@ -3405,7 +3415,7 @@ function eo({
|
|
|
3405
3415
|
lineHeight: 1.4
|
|
3406
3416
|
},
|
|
3407
3417
|
children: [
|
|
3408
|
-
/* @__PURE__ */
|
|
3418
|
+
/* @__PURE__ */ y("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
3409
3419
|
/* @__PURE__ */ n(
|
|
3410
3420
|
"span",
|
|
3411
3421
|
{
|