@livelayer/react 0.13.0 → 0.14.1
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 +37 -0
- package/dist/index.js +3 -3
- package/dist/index.mjs +1362 -1289
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as w, jsx as n, Fragment as
|
|
3
|
-
import { Component as
|
|
2
|
+
import { jsxs as w, jsx as n, Fragment as $e } from "react/jsx-runtime";
|
|
3
|
+
import { Component as Vn, useState as S, useRef as A, useEffect as T, useCallback as C, useMemo as Xe, useLayoutEffect as xn, forwardRef as Dt, useImperativeHandle as Yn, createElement as Gn } from "react";
|
|
4
4
|
import { createPortal as Pt } from "react-dom";
|
|
5
|
-
import { LiveKitSession as
|
|
6
|
-
import { clearFieldRegistry as
|
|
7
|
-
import { createLocalAudioTrack as
|
|
8
|
-
class
|
|
5
|
+
import { LiveKitSession as Kn, registerFields as Jn } from "@livelayer/sdk";
|
|
6
|
+
import { clearFieldRegistry as zi, getRegisteredFields as Hi, registerFields as Oi, setFieldValue as Bi } from "@livelayer/sdk";
|
|
7
|
+
import { createLocalAudioTrack as Xn, Track as kn, createLocalVideoTrack as Qn } from "livekit-client";
|
|
8
|
+
class Zn extends Vn {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments), this.state = { hasError: !1, error: null }, this.reset = () => {
|
|
11
11
|
this.setState({ hasError: !1, error: null });
|
|
@@ -15,8 +15,8 @@ class Xn extends Un {
|
|
|
15
15
|
return { hasError: !0, error: t };
|
|
16
16
|
}
|
|
17
17
|
componentDidCatch(t, r) {
|
|
18
|
-
var
|
|
19
|
-
(
|
|
18
|
+
var i, a;
|
|
19
|
+
(a = (i = this.props).onError) == null || a.call(i, t, r);
|
|
20
20
|
}
|
|
21
21
|
render() {
|
|
22
22
|
var t;
|
|
@@ -35,26 +35,26 @@ class Xn extends Un {
|
|
|
35
35
|
] }) : this.props.children;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
const [t, r] =
|
|
40
|
-
|
|
38
|
+
function er(e) {
|
|
39
|
+
const [t, r] = S("idle"), [i, a] = S("idle"), [o, s] = S([]), [l, c] = S(null), [p, v] = S(null), [f, d] = S(null), [R, L] = S(!1), [_, h] = S(null), b = A(null), N = A(e.onDataMessage);
|
|
40
|
+
N.current = e.onDataMessage, T(() => {
|
|
41
41
|
const g = {
|
|
42
|
-
onConnectionStateChange: (
|
|
43
|
-
r(
|
|
42
|
+
onConnectionStateChange: (O) => {
|
|
43
|
+
r(O), O === "connected" && h(null);
|
|
44
44
|
},
|
|
45
|
-
onAgentStateChange:
|
|
46
|
-
onTranscript: (
|
|
45
|
+
onAgentStateChange: a,
|
|
46
|
+
onTranscript: (O) => s([...O]),
|
|
47
47
|
onAgentConfig: c,
|
|
48
|
-
onAudioTrack: (
|
|
49
|
-
onVideoTrack: (
|
|
48
|
+
onAudioTrack: (O) => d(O),
|
|
49
|
+
onVideoTrack: (O) => v(O),
|
|
50
50
|
onVideoTrackRemoved: () => v(null),
|
|
51
|
-
onError: (
|
|
52
|
-
onDataMessage: (
|
|
51
|
+
onError: (O) => h(O),
|
|
52
|
+
onDataMessage: (O) => {
|
|
53
53
|
var q;
|
|
54
|
-
(q =
|
|
54
|
+
(q = N.current) == null || q.call(N, O);
|
|
55
55
|
},
|
|
56
56
|
onResumabilityChange: L
|
|
57
|
-
}, P = new
|
|
57
|
+
}, P = new Kn(
|
|
58
58
|
{
|
|
59
59
|
agentId: e.agentId,
|
|
60
60
|
baseUrl: e.baseUrl,
|
|
@@ -64,9 +64,9 @@ function Qn(e) {
|
|
|
64
64
|
},
|
|
65
65
|
g
|
|
66
66
|
);
|
|
67
|
-
return b.current = P, r("idle"),
|
|
68
|
-
var
|
|
69
|
-
(
|
|
67
|
+
return b.current = P, r("idle"), a("idle"), s([]), c(null), v(null), d(null), L(!1), h(null), () => {
|
|
68
|
+
var O;
|
|
69
|
+
(O = P.destroy) == null || O.call(P), b.current = null;
|
|
70
70
|
};
|
|
71
71
|
}, [
|
|
72
72
|
e.agentId,
|
|
@@ -75,7 +75,7 @@ function Qn(e) {
|
|
|
75
75
|
e.sessionEndpoint,
|
|
76
76
|
JSON.stringify(e.sessionBody ?? {})
|
|
77
77
|
]);
|
|
78
|
-
const
|
|
78
|
+
const M = C(async () => {
|
|
79
79
|
const g = b.current;
|
|
80
80
|
if (g)
|
|
81
81
|
try {
|
|
@@ -83,57 +83,57 @@ function Qn(e) {
|
|
|
83
83
|
} catch (P) {
|
|
84
84
|
throw h(P instanceof Error ? P.message : String(P)), P;
|
|
85
85
|
}
|
|
86
|
-
}, []),
|
|
86
|
+
}, []), I = C(() => {
|
|
87
87
|
const g = b.current;
|
|
88
88
|
g && g.disconnect();
|
|
89
|
-
}, []),
|
|
89
|
+
}, []), U = C(() => {
|
|
90
90
|
var g;
|
|
91
91
|
return ((g = b.current) == null ? void 0 : g.getRoom()) ?? null;
|
|
92
92
|
}, []);
|
|
93
93
|
return {
|
|
94
94
|
connectionState: t,
|
|
95
|
-
agentState:
|
|
96
|
-
transcript:
|
|
97
|
-
agentConfig:
|
|
95
|
+
agentState: i,
|
|
96
|
+
transcript: o,
|
|
97
|
+
agentConfig: l,
|
|
98
98
|
videoElement: p,
|
|
99
99
|
audioElement: f,
|
|
100
100
|
canResume: R,
|
|
101
101
|
error: _,
|
|
102
|
-
connect:
|
|
103
|
-
disconnect:
|
|
104
|
-
getRoom:
|
|
102
|
+
connect: M,
|
|
103
|
+
disconnect: I,
|
|
104
|
+
getRoom: U,
|
|
105
105
|
session: b.current
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
const e =
|
|
108
|
+
function tr() {
|
|
109
|
+
const e = A(null), t = A(null), r = A(null), i = A(null), a = A(/* @__PURE__ */ new Set()), o = A(null), s = C(() => {
|
|
110
110
|
const f = t.current;
|
|
111
111
|
if (!f) {
|
|
112
|
-
|
|
112
|
+
i.current = null;
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
(!
|
|
115
|
+
(!o.current || o.current.length !== f.frequencyBinCount) && (o.current = new Uint8Array(
|
|
116
116
|
new ArrayBuffer(f.frequencyBinCount)
|
|
117
117
|
));
|
|
118
|
-
const
|
|
119
|
-
f.getByteFrequencyData(
|
|
118
|
+
const d = o.current;
|
|
119
|
+
f.getByteFrequencyData(d);
|
|
120
120
|
let R = 0;
|
|
121
|
-
for (let _ = 0; _ <
|
|
122
|
-
const L = R /
|
|
123
|
-
for (const _ of
|
|
121
|
+
for (let _ = 0; _ < d.length; _++) R += d[_];
|
|
122
|
+
const L = R / d.length / 255;
|
|
123
|
+
for (const _ of a.current)
|
|
124
124
|
try {
|
|
125
125
|
_(L);
|
|
126
126
|
} catch (h) {
|
|
127
127
|
console.error("[useAudioLevel] subscriber threw:", h);
|
|
128
128
|
}
|
|
129
|
-
|
|
130
|
-
}, []),
|
|
129
|
+
i.current = requestAnimationFrame(s);
|
|
130
|
+
}, []), l = C(() => {
|
|
131
131
|
if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
|
|
132
|
-
const f = new AudioContext(),
|
|
133
|
-
|
|
132
|
+
const f = new AudioContext(), d = f.createAnalyser();
|
|
133
|
+
d.fftSize = 64, d.connect(f.destination), e.current = f, t.current = d;
|
|
134
134
|
}, []), c = C(
|
|
135
135
|
(f) => {
|
|
136
|
-
if (
|
|
136
|
+
if (l(), !(!e.current || !t.current)) {
|
|
137
137
|
if (r.current) {
|
|
138
138
|
try {
|
|
139
139
|
r.current.disconnect();
|
|
@@ -142,28 +142,28 @@ function Zn() {
|
|
|
142
142
|
r.current = null;
|
|
143
143
|
}
|
|
144
144
|
try {
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
} catch (
|
|
148
|
-
console.warn("[useAudioLevel] createMediaElementSource failed:",
|
|
145
|
+
const d = e.current.createMediaElementSource(f);
|
|
146
|
+
d.connect(t.current), r.current = d;
|
|
147
|
+
} catch (d) {
|
|
148
|
+
console.warn("[useAudioLevel] createMediaElementSource failed:", d);
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
i.current === null && (i.current = requestAnimationFrame(s));
|
|
152
152
|
}
|
|
153
153
|
},
|
|
154
|
-
[
|
|
154
|
+
[l, s]
|
|
155
155
|
), p = C(() => {
|
|
156
|
-
if (
|
|
156
|
+
if (i.current !== null && (cancelAnimationFrame(i.current), i.current = null), r.current) {
|
|
157
157
|
try {
|
|
158
158
|
r.current.disconnect();
|
|
159
159
|
} catch {
|
|
160
160
|
}
|
|
161
161
|
r.current = null;
|
|
162
162
|
}
|
|
163
|
-
}, []), v = C((f) => (
|
|
164
|
-
|
|
163
|
+
}, []), v = C((f) => (a.current.add(f), () => {
|
|
164
|
+
a.current.delete(f);
|
|
165
165
|
}), []);
|
|
166
|
-
return
|
|
166
|
+
return T(() => () => {
|
|
167
167
|
if (p(), t.current) {
|
|
168
168
|
try {
|
|
169
169
|
t.current.disconnect();
|
|
@@ -178,52 +178,52 @@ function Zn() {
|
|
|
178
178
|
}
|
|
179
179
|
e.current = null;
|
|
180
180
|
}
|
|
181
|
-
|
|
181
|
+
a.current.clear(), o.current = null;
|
|
182
182
|
}, [p]), { attach: c, detach: p, subscribe: v };
|
|
183
183
|
}
|
|
184
|
-
function
|
|
185
|
-
const [e, t] =
|
|
184
|
+
function nr() {
|
|
185
|
+
const [e, t] = S(!1), [r, i] = S(""), [a, o] = S(null), s = A(null), l = A(null), c = C(async (L) => {
|
|
186
186
|
var _, h;
|
|
187
|
-
if (s.current &&
|
|
187
|
+
if (s.current && l.current) {
|
|
188
188
|
try {
|
|
189
|
-
await
|
|
189
|
+
await l.current.localParticipant.unpublishTrack(s.current);
|
|
190
190
|
} catch {
|
|
191
191
|
}
|
|
192
192
|
s.current.stop(), s.current = null;
|
|
193
193
|
}
|
|
194
|
-
|
|
194
|
+
l.current = L, o(null);
|
|
195
195
|
try {
|
|
196
|
-
const b = await
|
|
196
|
+
const b = await Xn({
|
|
197
197
|
echoCancellation: !0,
|
|
198
198
|
noiseSuppression: !0
|
|
199
199
|
});
|
|
200
200
|
await L.localParticipant.publishTrack(b), s.current = b, t(b.isMuted);
|
|
201
|
-
const
|
|
202
|
-
|
|
201
|
+
const N = (h = (_ = b.mediaStreamTrack) == null ? void 0 : _.getSettings) == null ? void 0 : h.call(_);
|
|
202
|
+
N != null && N.deviceId && i(N.deviceId);
|
|
203
203
|
} catch (b) {
|
|
204
|
-
const
|
|
205
|
-
throw
|
|
204
|
+
const N = b instanceof Error && b.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
|
|
205
|
+
throw o(N), b;
|
|
206
206
|
}
|
|
207
207
|
}, []), p = C((L) => {
|
|
208
|
-
|
|
208
|
+
l.current = L;
|
|
209
209
|
}, []), v = C(async (L) => {
|
|
210
|
-
const _ =
|
|
210
|
+
const _ = l.current;
|
|
211
211
|
if (_)
|
|
212
212
|
try {
|
|
213
|
-
await _.switchActiveDevice("audioinput", L),
|
|
213
|
+
await _.switchActiveDevice("audioinput", L), i(L);
|
|
214
214
|
} catch (h) {
|
|
215
215
|
console.warn("[useMicrophoneState] switchDevice failed:", h);
|
|
216
216
|
}
|
|
217
217
|
}, []), f = C(async () => {
|
|
218
|
-
const L =
|
|
218
|
+
const L = l.current, _ = !e;
|
|
219
219
|
if (t(_), !!L)
|
|
220
220
|
try {
|
|
221
221
|
await L.localParticipant.setMicrophoneEnabled(!_);
|
|
222
222
|
} catch (h) {
|
|
223
223
|
console.warn("[useMicrophoneState] setMicrophoneEnabled failed:", h), t(!_);
|
|
224
224
|
}
|
|
225
|
-
}, [e]),
|
|
226
|
-
const L = s.current, _ =
|
|
225
|
+
}, [e]), d = C(() => {
|
|
226
|
+
const L = s.current, _ = l.current;
|
|
227
227
|
if (L && _) {
|
|
228
228
|
try {
|
|
229
229
|
_.localParticipant.unpublishTrack(L);
|
|
@@ -231,75 +231,75 @@ function er() {
|
|
|
231
231
|
}
|
|
232
232
|
L.stop();
|
|
233
233
|
}
|
|
234
|
-
s.current = null,
|
|
235
|
-
}, []), R = C(() =>
|
|
234
|
+
s.current = null, l.current = null, t(!1), i("");
|
|
235
|
+
}, []), R = C(() => o(null), []);
|
|
236
236
|
return {
|
|
237
237
|
isMuted: e,
|
|
238
238
|
activeDeviceId: r,
|
|
239
|
-
micError:
|
|
239
|
+
micError: a,
|
|
240
240
|
toggleMute: f,
|
|
241
241
|
setupMic: c,
|
|
242
242
|
attachRoom: p,
|
|
243
243
|
switchDevice: v,
|
|
244
|
-
teardownMic:
|
|
244
|
+
teardownMic: d,
|
|
245
245
|
clearError: R
|
|
246
246
|
};
|
|
247
247
|
}
|
|
248
|
-
const
|
|
249
|
-
function
|
|
250
|
-
const [e, t] =
|
|
248
|
+
const rr = { resolution: { width: 640, height: 480, frameRate: 24 } };
|
|
249
|
+
function ir() {
|
|
250
|
+
const [e, t] = S(!1), [r, i] = S(null), [a, o] = S(null), [s, l] = S(""), c = A(null), p = A(null), v = C((b) => {
|
|
251
251
|
c.current = b;
|
|
252
252
|
}, []), f = C(() => {
|
|
253
|
-
var
|
|
254
|
-
const b = c.current,
|
|
255
|
-
if (
|
|
256
|
-
const
|
|
253
|
+
var M;
|
|
254
|
+
const b = c.current, N = p.current;
|
|
255
|
+
if (N && b) {
|
|
256
|
+
const I = b.localParticipant.getTrackPublication(kn.Source.Camera), g = (I == null ? void 0 : I.track) ?? N;
|
|
257
257
|
try {
|
|
258
258
|
b.localParticipant.unpublishTrack(g);
|
|
259
259
|
} catch {
|
|
260
260
|
}
|
|
261
261
|
try {
|
|
262
|
-
(
|
|
262
|
+
(M = g.stop) == null || M.call(g);
|
|
263
263
|
} catch {
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
-
p.current = null,
|
|
267
|
-
}, []),
|
|
268
|
-
const
|
|
269
|
-
if (
|
|
270
|
-
|
|
266
|
+
p.current = null, o(null), t(!1);
|
|
267
|
+
}, []), d = C(async (b) => {
|
|
268
|
+
const N = c.current;
|
|
269
|
+
if (N) {
|
|
270
|
+
i(null);
|
|
271
271
|
try {
|
|
272
|
-
const
|
|
273
|
-
b && (
|
|
274
|
-
const
|
|
275
|
-
await
|
|
276
|
-
const
|
|
277
|
-
|
|
272
|
+
const M = { ...rr };
|
|
273
|
+
b && (M.deviceId = b);
|
|
274
|
+
const I = await Qn(M);
|
|
275
|
+
await N.localParticipant.publishTrack(I), p.current = I;
|
|
276
|
+
const U = I.attach();
|
|
277
|
+
o(U), t(!0), b && l(b);
|
|
278
278
|
try {
|
|
279
|
-
|
|
279
|
+
N.localParticipant.publishData(
|
|
280
280
|
new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
|
|
281
281
|
{ reliable: !0 }
|
|
282
282
|
);
|
|
283
283
|
} catch {
|
|
284
284
|
}
|
|
285
|
-
} catch (
|
|
286
|
-
const
|
|
287
|
-
|
|
285
|
+
} catch (M) {
|
|
286
|
+
const I = M instanceof Error && M.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
|
|
287
|
+
i(I);
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
}, []), R = C(async () => {
|
|
291
|
-
e ? f() : await
|
|
292
|
-
}, [e, s, f,
|
|
293
|
-
f(), await
|
|
294
|
-
}, [f,
|
|
295
|
-
f(), c.current = null,
|
|
296
|
-
}, [f]), h = C(() =>
|
|
297
|
-
return
|
|
291
|
+
e ? f() : await d(s || void 0);
|
|
292
|
+
}, [e, s, f, d]), L = C(async (b) => {
|
|
293
|
+
f(), await d(b);
|
|
294
|
+
}, [f, d]), _ = C(() => {
|
|
295
|
+
f(), c.current = null, i(null), l("");
|
|
296
|
+
}, [f]), h = C(() => i(null), []);
|
|
297
|
+
return T(() => () => {
|
|
298
298
|
p.current && p.current.stop();
|
|
299
299
|
}, []), {
|
|
300
300
|
isEnabled: e,
|
|
301
301
|
error: r,
|
|
302
|
-
previewEl:
|
|
302
|
+
previewEl: a,
|
|
303
303
|
activeDeviceId: s,
|
|
304
304
|
toggle: R,
|
|
305
305
|
switchDevice: L,
|
|
@@ -308,31 +308,31 @@ function nr() {
|
|
|
308
308
|
clearError: h
|
|
309
309
|
};
|
|
310
310
|
}
|
|
311
|
-
function
|
|
312
|
-
const [e, t] =
|
|
313
|
-
s.current =
|
|
314
|
-
}, []), c = C(() =>
|
|
315
|
-
const
|
|
316
|
-
if (
|
|
311
|
+
function or() {
|
|
312
|
+
const [e, t] = S(!1), [r, i] = S(null), [a, o] = S(null), s = A(null), l = C((d) => {
|
|
313
|
+
s.current = d;
|
|
314
|
+
}, []), c = C(() => o(null), []), p = C(async () => {
|
|
315
|
+
const d = s.current;
|
|
316
|
+
if (d) {
|
|
317
317
|
if (e) {
|
|
318
318
|
try {
|
|
319
|
-
await
|
|
319
|
+
await d.localParticipant.setScreenShareEnabled(!1);
|
|
320
320
|
} catch {
|
|
321
321
|
}
|
|
322
322
|
c(), t(!1);
|
|
323
323
|
return;
|
|
324
324
|
}
|
|
325
|
-
|
|
325
|
+
i(null);
|
|
326
326
|
try {
|
|
327
|
-
await
|
|
327
|
+
await d.localParticipant.setScreenShareEnabled(!0);
|
|
328
328
|
let R = 0;
|
|
329
329
|
const L = () => {
|
|
330
|
-
const _ =
|
|
330
|
+
const _ = d.localParticipant.getTrackPublication(kn.Source.ScreenShare);
|
|
331
331
|
if (_ != null && _.track) {
|
|
332
332
|
const h = _.track.attach();
|
|
333
|
-
|
|
333
|
+
o(h), t(!0);
|
|
334
334
|
try {
|
|
335
|
-
|
|
335
|
+
d.localParticipant.publishData(
|
|
336
336
|
new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
|
|
337
337
|
{ reliable: !0 }
|
|
338
338
|
);
|
|
@@ -345,38 +345,38 @@ function rr() {
|
|
|
345
345
|
L();
|
|
346
346
|
} catch (R) {
|
|
347
347
|
const L = R instanceof Error ? R.name : "";
|
|
348
|
-
L !== "NotAllowedError" && L !== "AbortError" &&
|
|
348
|
+
L !== "NotAllowedError" && L !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
351
|
}, [e, c]), v = C(() => {
|
|
352
|
-
const
|
|
353
|
-
if (
|
|
352
|
+
const d = s.current;
|
|
353
|
+
if (d && e)
|
|
354
354
|
try {
|
|
355
|
-
|
|
355
|
+
d.localParticipant.setScreenShareEnabled(!1);
|
|
356
356
|
} catch {
|
|
357
357
|
}
|
|
358
|
-
c(), t(!1),
|
|
359
|
-
}, [e, c]), f = C(() =>
|
|
360
|
-
return { isEnabled: e, error: r, previewEl:
|
|
358
|
+
c(), t(!1), i(null), s.current = null;
|
|
359
|
+
}, [e, c]), f = C(() => i(null), []);
|
|
360
|
+
return { isEnabled: e, error: r, previewEl: a, toggle: p, attachRoom: l, teardown: v, clearError: f };
|
|
361
361
|
}
|
|
362
|
-
function
|
|
363
|
-
const [e, t] =
|
|
362
|
+
function lr() {
|
|
363
|
+
const [e, t] = S([]), [r, i] = S([]), a = C(async () => {
|
|
364
364
|
if (!(typeof navigator > "u" || !navigator.mediaDevices))
|
|
365
365
|
try {
|
|
366
|
-
const
|
|
367
|
-
t(
|
|
366
|
+
const o = await navigator.mediaDevices.enumerateDevices();
|
|
367
|
+
t(o.filter((s) => s.kind === "audioinput")), i(o.filter((s) => s.kind === "videoinput"));
|
|
368
368
|
} catch {
|
|
369
369
|
}
|
|
370
370
|
}, []);
|
|
371
|
-
return
|
|
372
|
-
if (
|
|
373
|
-
const
|
|
374
|
-
return navigator.mediaDevices.addEventListener("devicechange",
|
|
375
|
-
}, [
|
|
376
|
-
}
|
|
377
|
-
function
|
|
378
|
-
const [
|
|
379
|
-
return
|
|
371
|
+
return T(() => {
|
|
372
|
+
if (a(), typeof navigator > "u" || !navigator.mediaDevices) return;
|
|
373
|
+
const o = () => void a();
|
|
374
|
+
return navigator.mediaDevices.addEventListener("devicechange", o), () => navigator.mediaDevices.removeEventListener("devicechange", o);
|
|
375
|
+
}, [a]), { mics: e, cameras: r, refresh: a };
|
|
376
|
+
}
|
|
377
|
+
function ar(e, t, r = !1) {
|
|
378
|
+
const [i, a] = S(null), [o, s] = S(null), [l, c] = S(!r && !!e);
|
|
379
|
+
return T(() => {
|
|
380
380
|
if (r || !e) {
|
|
381
381
|
c(!1);
|
|
382
382
|
return;
|
|
@@ -386,18 +386,18 @@ function ir(e, t, r = !1) {
|
|
|
386
386
|
signal: p.signal
|
|
387
387
|
}).then(async (f) => {
|
|
388
388
|
if (!f.ok) {
|
|
389
|
-
const
|
|
390
|
-
throw new Error(
|
|
389
|
+
const d = await f.json().catch(() => ({}));
|
|
390
|
+
throw new Error(d.error || `HTTP ${f.status}`);
|
|
391
391
|
}
|
|
392
392
|
return f.json();
|
|
393
393
|
}).then((f) => {
|
|
394
|
-
p.signal.aborted || (
|
|
394
|
+
p.signal.aborted || (a(f), c(!1));
|
|
395
395
|
}).catch((f) => {
|
|
396
396
|
p.signal.aborted || (s(f instanceof Error ? f.message : "Agent lookup failed"), c(!1));
|
|
397
397
|
}), () => p.abort();
|
|
398
|
-
}, [e, t, r]), { info:
|
|
398
|
+
}, [e, t, r]), { info: i, error: o, loading: l };
|
|
399
399
|
}
|
|
400
|
-
function
|
|
400
|
+
function sr(e) {
|
|
401
401
|
if (typeof window > "u") return null;
|
|
402
402
|
try {
|
|
403
403
|
return window.localStorage.getItem(e);
|
|
@@ -405,135 +405,135 @@ function lr(e) {
|
|
|
405
405
|
return null;
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function cr(e, t) {
|
|
409
409
|
if (!(typeof window > "u"))
|
|
410
410
|
try {
|
|
411
411
|
window.localStorage.setItem(e, t);
|
|
412
412
|
} catch {
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
|
-
function
|
|
415
|
+
function ur({
|
|
416
416
|
value: e,
|
|
417
417
|
defaultValue: t = "expanded",
|
|
418
418
|
onChange: r
|
|
419
419
|
} = {}) {
|
|
420
|
-
const
|
|
420
|
+
const i = e !== void 0, [a, o] = S(t), s = i ? e : a, l = C(
|
|
421
421
|
(c) => {
|
|
422
|
-
c !== s && (
|
|
422
|
+
c !== s && (i || o(c), r == null || r(c));
|
|
423
423
|
},
|
|
424
|
-
[s,
|
|
424
|
+
[s, i, r]
|
|
425
425
|
);
|
|
426
|
-
return [s,
|
|
426
|
+
return [s, l];
|
|
427
427
|
}
|
|
428
|
-
const
|
|
429
|
-
function
|
|
430
|
-
return e &&
|
|
428
|
+
const dr = ["hidden", "minimized", "expanded"];
|
|
429
|
+
function fr(e) {
|
|
430
|
+
return e && dr.includes(e) ? e : null;
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function pr({
|
|
433
433
|
value: e,
|
|
434
434
|
defaultValue: t = "expanded",
|
|
435
435
|
onChange: r,
|
|
436
|
-
persistKey:
|
|
437
|
-
disablePersistence:
|
|
436
|
+
persistKey: i = "ll-widget",
|
|
437
|
+
disablePersistence: a = !1
|
|
438
438
|
} = {}) {
|
|
439
|
-
const
|
|
439
|
+
const o = `${i}:display-mode`, s = A(!1), [l, c] = ur({
|
|
440
440
|
value: e,
|
|
441
441
|
defaultValue: t,
|
|
442
442
|
onChange: (p) => {
|
|
443
|
-
e === void 0 && !
|
|
443
|
+
e === void 0 && !a && cr(o, p), r == null || r(p);
|
|
444
444
|
}
|
|
445
445
|
});
|
|
446
|
-
return
|
|
447
|
-
if (s.current || (s.current = !0,
|
|
448
|
-
const p =
|
|
449
|
-
p && p !==
|
|
450
|
-
}, []), [
|
|
451
|
-
}
|
|
452
|
-
const
|
|
453
|
-
function
|
|
454
|
-
const [t, r] =
|
|
455
|
-
return
|
|
446
|
+
return T(() => {
|
|
447
|
+
if (s.current || (s.current = !0, a || e !== void 0)) return;
|
|
448
|
+
const p = fr(sr(o));
|
|
449
|
+
p && p !== l && c(p);
|
|
450
|
+
}, []), [l, c];
|
|
451
|
+
}
|
|
452
|
+
const hr = 640;
|
|
453
|
+
function mr(e = hr) {
|
|
454
|
+
const [t, r] = S(!1);
|
|
455
|
+
return T(() => {
|
|
456
456
|
if (e === !1) {
|
|
457
457
|
r(!1);
|
|
458
458
|
return;
|
|
459
459
|
}
|
|
460
460
|
if (typeof window > "u" || typeof window.matchMedia > "u")
|
|
461
461
|
return;
|
|
462
|
-
const
|
|
463
|
-
return
|
|
464
|
-
|
|
462
|
+
const i = `(max-width: ${e - 1}px)`, a = window.matchMedia(i), o = () => r(a.matches);
|
|
463
|
+
return o(), typeof a.addEventListener == "function" ? (a.addEventListener("change", o), () => a.removeEventListener("change", o)) : (a.addListener(o), () => {
|
|
464
|
+
a.removeListener(o);
|
|
465
465
|
});
|
|
466
466
|
}, [e]), t;
|
|
467
467
|
}
|
|
468
468
|
const en = "__llHistoryPatched", _t = "ll:pathname";
|
|
469
|
-
function
|
|
469
|
+
function gr() {
|
|
470
470
|
if (typeof window > "u" || window.history[en]) return;
|
|
471
471
|
const e = window.history.pushState, t = window.history.replaceState;
|
|
472
472
|
window.history.pushState = function(...r) {
|
|
473
|
-
const
|
|
474
|
-
return window.dispatchEvent(new Event(_t)),
|
|
473
|
+
const i = e.apply(this, r);
|
|
474
|
+
return window.dispatchEvent(new Event(_t)), i;
|
|
475
475
|
}, window.history.replaceState = function(...r) {
|
|
476
|
-
const
|
|
477
|
-
return window.dispatchEvent(new Event(_t)),
|
|
476
|
+
const i = t.apply(this, r);
|
|
477
|
+
return window.dispatchEvent(new Event(_t)), i;
|
|
478
478
|
}, window.history[en] = !0;
|
|
479
479
|
}
|
|
480
480
|
function tn() {
|
|
481
481
|
return typeof window > "u" ? "/" : window.location.pathname || "/";
|
|
482
482
|
}
|
|
483
|
-
function
|
|
484
|
-
const [t, r] =
|
|
483
|
+
function yr(e) {
|
|
484
|
+
const [t, r] = S(
|
|
485
485
|
() => e ?? tn()
|
|
486
486
|
);
|
|
487
|
-
return
|
|
487
|
+
return T(() => {
|
|
488
488
|
if (e !== void 0) return;
|
|
489
|
-
|
|
490
|
-
const
|
|
491
|
-
return
|
|
492
|
-
window.removeEventListener("popstate",
|
|
489
|
+
gr();
|
|
490
|
+
const i = () => r(tn());
|
|
491
|
+
return i(), window.addEventListener("popstate", i), window.addEventListener(_t, i), () => {
|
|
492
|
+
window.removeEventListener("popstate", i), window.removeEventListener(_t, i);
|
|
493
493
|
};
|
|
494
494
|
}, [e]), e ?? t;
|
|
495
495
|
}
|
|
496
|
-
const nn = /* @__PURE__ */ new Map(),
|
|
497
|
-
function
|
|
498
|
-
return e.replace(
|
|
496
|
+
const nn = /* @__PURE__ */ new Map(), vr = /[\\^$+?.()|{}[\]]/g;
|
|
497
|
+
function br(e) {
|
|
498
|
+
return e.replace(vr, "\\$&");
|
|
499
499
|
}
|
|
500
|
-
function
|
|
500
|
+
function wr(e) {
|
|
501
501
|
const t = nn.get(e);
|
|
502
502
|
if (t) return t;
|
|
503
|
-
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e,
|
|
503
|
+
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", a = "", o = r.replace(/\*\*/g, i).replace(/\*/g, a), l = br(o).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(a, "g"), "[^/]+"), c = new RegExp(`^${l}\\/?$`);
|
|
504
504
|
return nn.set(e, c), c;
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function _r(e, t) {
|
|
507
507
|
const r = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
|
|
508
|
-
return
|
|
508
|
+
return wr(e).test(r);
|
|
509
509
|
}
|
|
510
|
-
function
|
|
511
|
-
return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) :
|
|
510
|
+
function xr(e, t) {
|
|
511
|
+
return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : _r(e, t);
|
|
512
512
|
}
|
|
513
513
|
function rn(e, t) {
|
|
514
514
|
if (!e || e.length === 0) return !1;
|
|
515
515
|
for (const r of e)
|
|
516
|
-
if (
|
|
516
|
+
if (xr(r, t)) return !0;
|
|
517
517
|
return !1;
|
|
518
518
|
}
|
|
519
|
-
function
|
|
519
|
+
function kr(e, t, r) {
|
|
520
520
|
return e === void 0 ? !0 : rn(r, e) ? !1 : t && t.length > 0 ? rn(t, e) : !0;
|
|
521
521
|
}
|
|
522
|
-
function
|
|
523
|
-
return
|
|
524
|
-
() =>
|
|
522
|
+
function Lr(e, t, r) {
|
|
523
|
+
return Xe(
|
|
524
|
+
() => kr(e, t, r),
|
|
525
525
|
[e, t, r]
|
|
526
526
|
);
|
|
527
527
|
}
|
|
528
|
-
function
|
|
528
|
+
function Er(e) {
|
|
529
529
|
return e === !1 ? { navigate: !1, thinking: !1, action: !1 } : e === void 0 || e === !0 ? { navigate: !0, thinking: !0, action: !0 } : {
|
|
530
530
|
navigate: e.navigate !== !1,
|
|
531
531
|
thinking: e.thinking !== !1,
|
|
532
532
|
action: e.action !== !1
|
|
533
533
|
};
|
|
534
534
|
}
|
|
535
|
-
function
|
|
536
|
-
const t =
|
|
535
|
+
function Cr(e) {
|
|
536
|
+
const t = Xe(() => Er(e.config), [e.config]), r = e.baseUrl.replace(/\/+$/, ""), i = A(null), a = C(
|
|
537
537
|
(c) => {
|
|
538
538
|
try {
|
|
539
539
|
new Audio(`${r}${c}`).play().catch(() => {
|
|
@@ -542,52 +542,52 @@ function Lr(e) {
|
|
|
542
542
|
}
|
|
543
543
|
},
|
|
544
544
|
[r]
|
|
545
|
-
),
|
|
546
|
-
t.navigate &&
|
|
547
|
-
}, [t.navigate,
|
|
548
|
-
t.action &&
|
|
549
|
-
}, [t.action,
|
|
545
|
+
), o = C(() => {
|
|
546
|
+
t.navigate && a("/audio/page-change-sound.mp3");
|
|
547
|
+
}, [t.navigate, a]), s = C(() => {
|
|
548
|
+
t.action && a("/audio/confirmation-sound.mp3");
|
|
549
|
+
}, [t.action, a]), l = C(
|
|
550
550
|
(c) => {
|
|
551
551
|
if (!t.thinking) {
|
|
552
|
-
if (
|
|
552
|
+
if (i.current) {
|
|
553
553
|
try {
|
|
554
|
-
|
|
554
|
+
i.current.pause();
|
|
555
555
|
} catch {
|
|
556
556
|
}
|
|
557
|
-
|
|
557
|
+
i.current = null;
|
|
558
558
|
}
|
|
559
559
|
return;
|
|
560
560
|
}
|
|
561
561
|
if (c) {
|
|
562
|
-
if (
|
|
562
|
+
if (i.current) return;
|
|
563
563
|
try {
|
|
564
564
|
const p = new Audio(`${r}/audio/thinking-sound.mp3`);
|
|
565
565
|
p.loop = !0, p.volume = 0.3, p.play().catch(() => {
|
|
566
|
-
|
|
567
|
-
}),
|
|
566
|
+
i.current = null;
|
|
567
|
+
}), i.current = p;
|
|
568
568
|
} catch {
|
|
569
569
|
}
|
|
570
|
-
} else if (
|
|
570
|
+
} else if (i.current) {
|
|
571
571
|
try {
|
|
572
|
-
|
|
572
|
+
i.current.pause();
|
|
573
573
|
} catch {
|
|
574
574
|
}
|
|
575
|
-
|
|
575
|
+
i.current = null;
|
|
576
576
|
}
|
|
577
577
|
},
|
|
578
578
|
[r, t.thinking]
|
|
579
579
|
);
|
|
580
|
-
return
|
|
581
|
-
if (
|
|
580
|
+
return T(() => () => {
|
|
581
|
+
if (i.current) {
|
|
582
582
|
try {
|
|
583
|
-
|
|
583
|
+
i.current.pause();
|
|
584
584
|
} catch {
|
|
585
585
|
}
|
|
586
|
-
|
|
586
|
+
i.current = null;
|
|
587
587
|
}
|
|
588
|
-
}, []),
|
|
589
|
-
() => ({ playPageChange:
|
|
590
|
-
[
|
|
588
|
+
}, []), Xe(
|
|
589
|
+
() => ({ playPageChange: o, playConfirmation: s, setThinking: l }),
|
|
590
|
+
[o, s, l]
|
|
591
591
|
);
|
|
592
592
|
}
|
|
593
593
|
const on = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ w(
|
|
@@ -654,7 +654,7 @@ const on = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ w(
|
|
|
654
654
|
}
|
|
655
655
|
)
|
|
656
656
|
}
|
|
657
|
-
),
|
|
657
|
+
), Sr = ({ className: e }) => /* @__PURE__ */ n(
|
|
658
658
|
"svg",
|
|
659
659
|
{
|
|
660
660
|
className: e,
|
|
@@ -665,7 +665,7 @@ const on = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ w(
|
|
|
665
665
|
"aria-hidden": "true",
|
|
666
666
|
children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
667
667
|
}
|
|
668
|
-
),
|
|
668
|
+
), Nr = {
|
|
669
669
|
left: 180,
|
|
670
670
|
right: 0,
|
|
671
671
|
up: -90,
|
|
@@ -678,19 +678,19 @@ const on = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ w(
|
|
|
678
678
|
viewBox: "0 0 24 24",
|
|
679
679
|
stroke: "currentColor",
|
|
680
680
|
strokeWidth: 2,
|
|
681
|
-
style: { transform: `rotate(${
|
|
681
|
+
style: { transform: `rotate(${Nr[e]}deg)` },
|
|
682
682
|
"aria-hidden": "true",
|
|
683
683
|
children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" })
|
|
684
684
|
}
|
|
685
685
|
);
|
|
686
|
-
function
|
|
686
|
+
function Ar(e) {
|
|
687
687
|
return e === "top-left" || e === "bottom-left" ? "left" : "right";
|
|
688
688
|
}
|
|
689
|
-
const
|
|
690
|
-
function
|
|
689
|
+
const Ln = "ll-hidden-tab-center-y", Ir = 5, sn = 16;
|
|
690
|
+
function Rr() {
|
|
691
691
|
if (typeof window > "u") return null;
|
|
692
692
|
try {
|
|
693
|
-
const e = window.localStorage.getItem(
|
|
693
|
+
const e = window.localStorage.getItem(Ln);
|
|
694
694
|
if (!e) return null;
|
|
695
695
|
const t = Number.parseFloat(e);
|
|
696
696
|
return Number.isFinite(t) ? t : null;
|
|
@@ -701,94 +701,94 @@ function Ar() {
|
|
|
701
701
|
function cn(e) {
|
|
702
702
|
if (!(typeof window > "u"))
|
|
703
703
|
try {
|
|
704
|
-
window.localStorage.setItem(
|
|
704
|
+
window.localStorage.setItem(Ln, String(e));
|
|
705
705
|
} catch {
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
|
-
const
|
|
708
|
+
const Tr = ({
|
|
709
709
|
position: e,
|
|
710
710
|
isMobile: t,
|
|
711
711
|
isSpeaking: r,
|
|
712
|
-
onExpand:
|
|
713
|
-
label:
|
|
714
|
-
avatarImageUrl:
|
|
712
|
+
onExpand: i,
|
|
713
|
+
label: a = "Open widget",
|
|
714
|
+
avatarImageUrl: o,
|
|
715
715
|
agentName: s,
|
|
716
|
-
containerEl:
|
|
716
|
+
containerEl: l
|
|
717
717
|
}) => {
|
|
718
|
-
const c =
|
|
719
|
-
(
|
|
720
|
-
if (typeof window > "u") return
|
|
721
|
-
const
|
|
722
|
-
return
|
|
718
|
+
const c = Ar(e), p = c === "right" ? "left" : "right", v = t ? 80 : 72, f = !!o, d = !!l, [R, L] = S(null), [_, h] = S(!1), b = A(null), N = A(!1), M = C(
|
|
719
|
+
(B) => {
|
|
720
|
+
if (typeof window > "u") return B;
|
|
721
|
+
const j = v / 2, E = sn + j, Z = window.innerHeight - sn - j;
|
|
722
|
+
return Z < E ? Math.max(E, B) : Math.max(E, Math.min(Z, B));
|
|
723
723
|
},
|
|
724
724
|
[v]
|
|
725
725
|
);
|
|
726
|
-
|
|
727
|
-
if (
|
|
726
|
+
T(() => {
|
|
727
|
+
if (d) {
|
|
728
728
|
L(null);
|
|
729
729
|
return;
|
|
730
730
|
}
|
|
731
|
-
const
|
|
732
|
-
L(
|
|
733
|
-
const
|
|
734
|
-
L((
|
|
731
|
+
const B = Rr();
|
|
732
|
+
L(M(B ?? window.innerHeight / 2));
|
|
733
|
+
const j = () => {
|
|
734
|
+
L((E) => E === null ? null : M(E));
|
|
735
735
|
};
|
|
736
|
-
return window.addEventListener("resize",
|
|
737
|
-
}, [
|
|
738
|
-
const
|
|
739
|
-
(
|
|
740
|
-
if (!
|
|
736
|
+
return window.addEventListener("resize", j), () => window.removeEventListener("resize", j);
|
|
737
|
+
}, [M, d]);
|
|
738
|
+
const I = C(
|
|
739
|
+
(B) => {
|
|
740
|
+
if (!d && !(B.pointerType === "mouse" && B.button !== 0) && R !== null) {
|
|
741
741
|
try {
|
|
742
|
-
|
|
742
|
+
B.currentTarget.setPointerCapture(B.pointerId);
|
|
743
743
|
} catch {
|
|
744
744
|
}
|
|
745
745
|
b.current = {
|
|
746
|
-
startClientY:
|
|
746
|
+
startClientY: B.clientY,
|
|
747
747
|
startCenterY: R,
|
|
748
748
|
moved: !1
|
|
749
749
|
};
|
|
750
750
|
}
|
|
751
751
|
},
|
|
752
|
-
[R,
|
|
753
|
-
),
|
|
754
|
-
(
|
|
755
|
-
const
|
|
756
|
-
if (!
|
|
757
|
-
const
|
|
758
|
-
!
|
|
752
|
+
[R, d]
|
|
753
|
+
), U = C(
|
|
754
|
+
(B) => {
|
|
755
|
+
const j = b.current;
|
|
756
|
+
if (!j) return;
|
|
757
|
+
const E = B.clientY - j.startClientY;
|
|
758
|
+
!j.moved && Math.abs(E) > Ir && (j.moved = !0, h(!0)), j.moved && L(M(j.startCenterY + E));
|
|
759
759
|
},
|
|
760
|
-
[
|
|
760
|
+
[M]
|
|
761
761
|
), g = C(
|
|
762
|
-
(
|
|
763
|
-
const
|
|
764
|
-
if (
|
|
762
|
+
(B) => {
|
|
763
|
+
const j = b.current;
|
|
764
|
+
if (j) {
|
|
765
765
|
try {
|
|
766
|
-
|
|
766
|
+
B.currentTarget.releasePointerCapture(B.pointerId);
|
|
767
767
|
} catch {
|
|
768
768
|
}
|
|
769
|
-
b.current = null,
|
|
769
|
+
b.current = null, j.moved && (h(!1), N.current = !0, L((E) => (E !== null && cn(E), E)));
|
|
770
770
|
}
|
|
771
771
|
},
|
|
772
772
|
[]
|
|
773
773
|
), P = C(() => {
|
|
774
|
-
if (
|
|
775
|
-
|
|
774
|
+
if (N.current) {
|
|
775
|
+
N.current = !1;
|
|
776
776
|
return;
|
|
777
777
|
}
|
|
778
|
-
|
|
779
|
-
}, [
|
|
780
|
-
(
|
|
781
|
-
if (
|
|
782
|
-
|
|
783
|
-
const
|
|
784
|
-
L((
|
|
785
|
-
if (
|
|
786
|
-
const
|
|
787
|
-
return cn(
|
|
778
|
+
i();
|
|
779
|
+
}, [i]), O = C(
|
|
780
|
+
(B) => {
|
|
781
|
+
if (B.key === "ArrowUp" || B.key === "ArrowDown") {
|
|
782
|
+
B.preventDefault();
|
|
783
|
+
const j = B.key === "ArrowUp" ? -8 : 8;
|
|
784
|
+
L((E) => {
|
|
785
|
+
if (E === null) return E;
|
|
786
|
+
const Z = M(E + j);
|
|
787
|
+
return cn(Z), Z;
|
|
788
788
|
});
|
|
789
789
|
}
|
|
790
790
|
},
|
|
791
|
-
[
|
|
791
|
+
[M]
|
|
792
792
|
), q = [
|
|
793
793
|
"ll-hidden",
|
|
794
794
|
`ll-hidden--${c}`,
|
|
@@ -796,28 +796,28 @@ const Rr = ({
|
|
|
796
796
|
r ? "ll-hidden--speaking" : null,
|
|
797
797
|
_ ? "is-dragging" : null,
|
|
798
798
|
f ? "ll-hidden--with-avatar" : null,
|
|
799
|
-
|
|
800
|
-
].filter(Boolean).join(" "),
|
|
799
|
+
d ? "ll-hidden--scoped" : null
|
|
800
|
+
].filter(Boolean).join(" "), ne = R === null ? void 0 : { top: `${R - v / 2}px`, transform: "none" };
|
|
801
801
|
return /* @__PURE__ */ n(
|
|
802
802
|
"button",
|
|
803
803
|
{
|
|
804
804
|
type: "button",
|
|
805
805
|
className: q,
|
|
806
|
-
onPointerDown:
|
|
807
|
-
onPointerMove:
|
|
806
|
+
onPointerDown: I,
|
|
807
|
+
onPointerMove: U,
|
|
808
808
|
onPointerUp: g,
|
|
809
809
|
onPointerCancel: g,
|
|
810
810
|
onClick: P,
|
|
811
|
-
onKeyDown:
|
|
812
|
-
"aria-label":
|
|
811
|
+
onKeyDown: O,
|
|
812
|
+
"aria-label": a,
|
|
813
813
|
"data-position": e,
|
|
814
|
-
style:
|
|
814
|
+
style: ne,
|
|
815
815
|
children: f ? (
|
|
816
816
|
// Layout: tiny chevron flush against the inward edge (peeks out
|
|
817
817
|
// as the click affordance), then the circular avatar photo
|
|
818
818
|
// taking the rest of the tab. Reinforces "this is an
|
|
819
819
|
// avatar-based experience" even when collapsed.
|
|
820
|
-
/* @__PURE__ */ w(
|
|
820
|
+
/* @__PURE__ */ w($e, { children: [
|
|
821
821
|
/* @__PURE__ */ n(
|
|
822
822
|
an,
|
|
823
823
|
{
|
|
@@ -828,7 +828,7 @@ const Rr = ({
|
|
|
828
828
|
/* @__PURE__ */ n(
|
|
829
829
|
"img",
|
|
830
830
|
{
|
|
831
|
-
src:
|
|
831
|
+
src: o,
|
|
832
832
|
alt: s ? `${s} avatar` : "Agent avatar",
|
|
833
833
|
className: "ll-hidden__avatar",
|
|
834
834
|
draggable: !1
|
|
@@ -844,47 +844,47 @@ const Rr = ({
|
|
|
844
844
|
)
|
|
845
845
|
}
|
|
846
846
|
);
|
|
847
|
-
},
|
|
847
|
+
}, Mr = ({
|
|
848
848
|
audioLevel: e,
|
|
849
849
|
bars: t = 20,
|
|
850
850
|
maxHeight: r = 20,
|
|
851
|
-
minHeight:
|
|
852
|
-
className:
|
|
853
|
-
barClassName:
|
|
851
|
+
minHeight: i = 4,
|
|
852
|
+
className: a,
|
|
853
|
+
barClassName: o
|
|
854
854
|
}) => {
|
|
855
|
-
const s =
|
|
855
|
+
const s = A(null), l = A([]), c = Xe(() => {
|
|
856
856
|
const v = (Math.sqrt(5) - 1) / 2;
|
|
857
|
-
return Array.from({ length: t }, (f,
|
|
857
|
+
return Array.from({ length: t }, (f, d) => 0.5 + d * v % 1 * 0.5);
|
|
858
858
|
}, [t]);
|
|
859
|
-
|
|
860
|
-
for (let
|
|
861
|
-
const R =
|
|
859
|
+
T(() => e.subscribe((f) => {
|
|
860
|
+
for (let d = 0; d < t; d++) {
|
|
861
|
+
const R = l.current[d];
|
|
862
862
|
if (!R) continue;
|
|
863
|
-
const L = Math.max(
|
|
863
|
+
const L = Math.max(i, f * r * c[d]);
|
|
864
864
|
R.style.height = `${L}px`;
|
|
865
865
|
}
|
|
866
|
-
}), [e, t, r,
|
|
867
|
-
const p = ["ll-waveform",
|
|
866
|
+
}), [e, t, r, i, c]);
|
|
867
|
+
const p = ["ll-waveform", a].filter(Boolean).join(" ");
|
|
868
868
|
return /* @__PURE__ */ n("div", { ref: s, className: p, "aria-hidden": "true", children: Array.from({ length: t }, (v, f) => /* @__PURE__ */ n(
|
|
869
869
|
"div",
|
|
870
870
|
{
|
|
871
|
-
ref: (
|
|
872
|
-
|
|
871
|
+
ref: (d) => {
|
|
872
|
+
l.current[f] = d;
|
|
873
873
|
},
|
|
874
|
-
className: ["ll-waveform__bar",
|
|
875
|
-
style: { height: `${
|
|
874
|
+
className: ["ll-waveform__bar", o].filter(Boolean).join(" "),
|
|
875
|
+
style: { height: `${i}px` }
|
|
876
876
|
},
|
|
877
877
|
f
|
|
878
878
|
)) });
|
|
879
|
-
},
|
|
879
|
+
}, Dr = ({
|
|
880
880
|
position: e,
|
|
881
881
|
isMobile: t,
|
|
882
882
|
agentName: r,
|
|
883
|
-
avatarImageUrl:
|
|
884
|
-
agentState:
|
|
885
|
-
isMuted:
|
|
883
|
+
avatarImageUrl: i,
|
|
884
|
+
agentState: a,
|
|
885
|
+
isMuted: o,
|
|
886
886
|
audioLevel: s,
|
|
887
|
-
onExpand:
|
|
887
|
+
onExpand: l,
|
|
888
888
|
onToggleMute: c,
|
|
889
889
|
onClose: p
|
|
890
890
|
}) => t ? /* @__PURE__ */ n(
|
|
@@ -898,22 +898,22 @@ const Rr = ({
|
|
|
898
898
|
{
|
|
899
899
|
type: "button",
|
|
900
900
|
className: "ll-minimized__surface",
|
|
901
|
-
onClick:
|
|
901
|
+
onClick: l,
|
|
902
902
|
"aria-label": `Expand ${r} widget`,
|
|
903
903
|
children: [
|
|
904
|
-
|
|
904
|
+
i ? (
|
|
905
905
|
// eslint-disable-next-line @next/next/no-img-element
|
|
906
906
|
/* @__PURE__ */ n(
|
|
907
907
|
"img",
|
|
908
908
|
{
|
|
909
|
-
src:
|
|
909
|
+
src: i,
|
|
910
910
|
alt: r,
|
|
911
911
|
className: "ll-minimized__avatar"
|
|
912
912
|
}
|
|
913
913
|
)
|
|
914
914
|
) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
|
|
915
915
|
/* @__PURE__ */ n(
|
|
916
|
-
|
|
916
|
+
Mr,
|
|
917
917
|
{
|
|
918
918
|
audioLevel: s,
|
|
919
919
|
bars: 16,
|
|
@@ -935,8 +935,8 @@ const Rr = ({
|
|
|
935
935
|
onKeyDown: (v) => {
|
|
936
936
|
(v.key === "Enter" || v.key === " ") && (v.stopPropagation(), v.preventDefault(), c());
|
|
937
937
|
},
|
|
938
|
-
"aria-label":
|
|
939
|
-
children: /* @__PURE__ */ n(on, { muted:
|
|
938
|
+
"aria-label": o ? "Unmute microphone" : "Mute microphone",
|
|
939
|
+
children: /* @__PURE__ */ n(on, { muted: o, className: "ll-minimized__icon" })
|
|
940
940
|
}
|
|
941
941
|
),
|
|
942
942
|
/* @__PURE__ */ n(ln, { className: "ll-minimized__icon ll-minimized__icon--expand" })
|
|
@@ -953,12 +953,12 @@ const Rr = ({
|
|
|
953
953
|
role: "region",
|
|
954
954
|
"aria-label": `${r} widget`,
|
|
955
955
|
children: /* @__PURE__ */ w("div", { className: "ll-minimized__surface", children: [
|
|
956
|
-
|
|
956
|
+
i ? (
|
|
957
957
|
// eslint-disable-next-line @next/next/no-img-element
|
|
958
958
|
/* @__PURE__ */ n(
|
|
959
959
|
"img",
|
|
960
960
|
{
|
|
961
|
-
src:
|
|
961
|
+
src: i,
|
|
962
962
|
alt: r,
|
|
963
963
|
className: "ll-minimized__avatar"
|
|
964
964
|
}
|
|
@@ -966,7 +966,7 @@ const Rr = ({
|
|
|
966
966
|
) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
|
|
967
967
|
/* @__PURE__ */ w("div", { className: "ll-minimized__meta", children: [
|
|
968
968
|
/* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
|
|
969
|
-
/* @__PURE__ */ n("span", { className: "ll-minimized__state", children:
|
|
969
|
+
/* @__PURE__ */ n("span", { className: "ll-minimized__state", children: a === "speaking" ? "Speaking" : a === "thinking" ? "Thinking" : "Listening" })
|
|
970
970
|
] }),
|
|
971
971
|
/* @__PURE__ */ w("div", { className: "ll-minimized__controls", children: [
|
|
972
972
|
/* @__PURE__ */ n(
|
|
@@ -975,8 +975,8 @@ const Rr = ({
|
|
|
975
975
|
type: "button",
|
|
976
976
|
className: "ll-minimized__btn",
|
|
977
977
|
onClick: c,
|
|
978
|
-
"aria-label":
|
|
979
|
-
children: /* @__PURE__ */ n(on, { muted:
|
|
978
|
+
"aria-label": o ? "Unmute microphone" : "Mute microphone",
|
|
979
|
+
children: /* @__PURE__ */ n(on, { muted: o, className: "ll-minimized__icon" })
|
|
980
980
|
}
|
|
981
981
|
),
|
|
982
982
|
/* @__PURE__ */ n(
|
|
@@ -984,7 +984,7 @@ const Rr = ({
|
|
|
984
984
|
{
|
|
985
985
|
type: "button",
|
|
986
986
|
className: "ll-minimized__btn",
|
|
987
|
-
onClick:
|
|
987
|
+
onClick: l,
|
|
988
988
|
"aria-label": `Expand ${r} widget`,
|
|
989
989
|
children: /* @__PURE__ */ n(ln, { className: "ll-minimized__icon" })
|
|
990
990
|
}
|
|
@@ -996,22 +996,22 @@ const Rr = ({
|
|
|
996
996
|
className: "ll-minimized__btn ll-minimized__btn--close",
|
|
997
997
|
onClick: p,
|
|
998
998
|
"aria-label": "Close widget",
|
|
999
|
-
children: /* @__PURE__ */ n(
|
|
999
|
+
children: /* @__PURE__ */ n(Sr, { className: "ll-minimized__icon" })
|
|
1000
1000
|
}
|
|
1001
1001
|
)
|
|
1002
1002
|
] })
|
|
1003
1003
|
] })
|
|
1004
1004
|
}
|
|
1005
|
-
),
|
|
1005
|
+
), Pr = ({
|
|
1006
1006
|
src: e,
|
|
1007
1007
|
alt: t,
|
|
1008
1008
|
preCannedPlaying: r = !1,
|
|
1009
|
-
className:
|
|
1010
|
-
style:
|
|
1009
|
+
className: i,
|
|
1010
|
+
style: a
|
|
1011
1011
|
}) => {
|
|
1012
|
-
const [
|
|
1013
|
-
if (
|
|
1014
|
-
|
|
1012
|
+
const [o, s] = S(!1), l = A(e);
|
|
1013
|
+
if (T(() => {
|
|
1014
|
+
l.current !== e && (l.current = e, s(!1));
|
|
1015
1015
|
}, [e]), !e) return null;
|
|
1016
1016
|
const c = {
|
|
1017
1017
|
position: "absolute",
|
|
@@ -1022,8 +1022,8 @@ const Rr = ({
|
|
|
1022
1022
|
objectPosition: "top",
|
|
1023
1023
|
transition: "opacity 500ms ease, transform 500ms ease",
|
|
1024
1024
|
transform: r ? "scale(1.02)" : "scale(1)",
|
|
1025
|
-
opacity:
|
|
1026
|
-
...
|
|
1025
|
+
opacity: o ? 1 : 0,
|
|
1026
|
+
...a
|
|
1027
1027
|
};
|
|
1028
1028
|
return (
|
|
1029
1029
|
// eslint-disable-next-line @next/next/no-img-element
|
|
@@ -1032,7 +1032,7 @@ const Rr = ({
|
|
|
1032
1032
|
{
|
|
1033
1033
|
src: e,
|
|
1034
1034
|
alt: t,
|
|
1035
|
-
className:
|
|
1035
|
+
className: i,
|
|
1036
1036
|
style: c,
|
|
1037
1037
|
loading: "eager",
|
|
1038
1038
|
fetchPriority: "high",
|
|
@@ -1040,79 +1040,79 @@ const Rr = ({
|
|
|
1040
1040
|
}
|
|
1041
1041
|
)
|
|
1042
1042
|
);
|
|
1043
|
-
},
|
|
1043
|
+
}, $r = 8, un = 8, zr = ({
|
|
1044
1044
|
open: e,
|
|
1045
1045
|
onClose: t,
|
|
1046
1046
|
anchorRef: r,
|
|
1047
|
-
children:
|
|
1047
|
+
children: i
|
|
1048
1048
|
}) => {
|
|
1049
|
-
const
|
|
1050
|
-
return
|
|
1049
|
+
const a = A(null), [o, s] = S(null);
|
|
1050
|
+
return xn(() => {
|
|
1051
1051
|
if (!e) {
|
|
1052
1052
|
s(null);
|
|
1053
1053
|
return;
|
|
1054
1054
|
}
|
|
1055
|
-
const
|
|
1056
|
-
if (!
|
|
1055
|
+
const l = r.current;
|
|
1056
|
+
if (!l) return;
|
|
1057
1057
|
const c = () => {
|
|
1058
|
-
const p =
|
|
1059
|
-
top: p.top -
|
|
1058
|
+
const p = l.getBoundingClientRect(), v = {
|
|
1059
|
+
top: p.top - $r,
|
|
1060
1060
|
left: p.left + p.width / 2
|
|
1061
|
-
}, f =
|
|
1062
|
-
v.left < f && (v.left = f), v.left >
|
|
1061
|
+
}, f = un + 90, d = window.innerWidth - un - 90;
|
|
1062
|
+
v.left < f && (v.left = f), v.left > d && (v.left = d), s(v);
|
|
1063
1063
|
};
|
|
1064
1064
|
return c(), window.addEventListener("scroll", c, !0), window.addEventListener("resize", c), () => {
|
|
1065
1065
|
window.removeEventListener("scroll", c, !0), window.removeEventListener("resize", c);
|
|
1066
1066
|
};
|
|
1067
|
-
}, [e, r]),
|
|
1067
|
+
}, [e, r]), T(() => {
|
|
1068
1068
|
if (!e) return;
|
|
1069
|
-
const
|
|
1070
|
-
const v = p.target, f =
|
|
1071
|
-
f && f.contains(v) ||
|
|
1069
|
+
const l = (p) => {
|
|
1070
|
+
const v = p.target, f = a.current, d = r.current;
|
|
1071
|
+
f && f.contains(v) || d && d.contains(v) || t();
|
|
1072
1072
|
}, c = (p) => {
|
|
1073
1073
|
p.key === "Escape" && (p.stopPropagation(), t());
|
|
1074
1074
|
};
|
|
1075
|
-
return document.addEventListener("mousedown",
|
|
1076
|
-
document.removeEventListener("mousedown",
|
|
1075
|
+
return document.addEventListener("mousedown", l), document.addEventListener("keydown", c), () => {
|
|
1076
|
+
document.removeEventListener("mousedown", l), document.removeEventListener("keydown", c);
|
|
1077
1077
|
};
|
|
1078
|
-
}, [e, t, r]), !e ||
|
|
1078
|
+
}, [e, t, r]), !e || o === null || typeof document > "u" ? null : Pt(
|
|
1079
1079
|
/* @__PURE__ */ n(
|
|
1080
1080
|
"div",
|
|
1081
1081
|
{
|
|
1082
|
-
ref:
|
|
1082
|
+
ref: a,
|
|
1083
1083
|
className: "ll-overflow-popover",
|
|
1084
1084
|
role: "menu",
|
|
1085
1085
|
style: {
|
|
1086
1086
|
position: "fixed",
|
|
1087
1087
|
// Lift the popover above the anchor via translateY(-100%).
|
|
1088
1088
|
// top points to (anchorTop - GAP); transform pulls bottom up to there.
|
|
1089
|
-
top:
|
|
1090
|
-
left:
|
|
1089
|
+
top: o.top,
|
|
1090
|
+
left: o.left,
|
|
1091
1091
|
transform: "translate(-50%, -100%)"
|
|
1092
1092
|
},
|
|
1093
|
-
children:
|
|
1093
|
+
children: i
|
|
1094
1094
|
}
|
|
1095
1095
|
),
|
|
1096
1096
|
document.body
|
|
1097
1097
|
);
|
|
1098
|
-
},
|
|
1098
|
+
}, Hr = ({
|
|
1099
1099
|
isMuted: e,
|
|
1100
1100
|
onToggleMute: t,
|
|
1101
1101
|
isCameraEnabled: r,
|
|
1102
|
-
onToggleCamera:
|
|
1103
|
-
allowCamera:
|
|
1104
|
-
isScreenShareEnabled:
|
|
1102
|
+
onToggleCamera: i,
|
|
1103
|
+
allowCamera: a,
|
|
1104
|
+
isScreenShareEnabled: o,
|
|
1105
1105
|
onToggleScreenShare: s,
|
|
1106
|
-
allowScreenShare:
|
|
1106
|
+
allowScreenShare: l,
|
|
1107
1107
|
isSpeakerMuted: c,
|
|
1108
1108
|
onToggleSpeaker: p,
|
|
1109
1109
|
allowTyping: v,
|
|
1110
1110
|
isTypingOpen: f,
|
|
1111
|
-
onToggleTyping:
|
|
1111
|
+
onToggleTyping: d,
|
|
1112
1112
|
onDisconnect: R
|
|
1113
1113
|
}) => {
|
|
1114
|
-
const [L, _] =
|
|
1115
|
-
return /* @__PURE__ */ w(
|
|
1114
|
+
const [L, _] = S(!1), h = A(null);
|
|
1115
|
+
return /* @__PURE__ */ w($e, { children: [
|
|
1116
1116
|
/* @__PURE__ */ w(
|
|
1117
1117
|
"div",
|
|
1118
1118
|
{
|
|
@@ -1127,7 +1127,7 @@ const Rr = ({
|
|
|
1127
1127
|
className: `ll-tool ${e ? "is-muted" : ""}`,
|
|
1128
1128
|
onClick: t,
|
|
1129
1129
|
"aria-label": e ? "Unmute microphone" : "Mute microphone",
|
|
1130
|
-
children: /* @__PURE__ */ n(
|
|
1130
|
+
children: /* @__PURE__ */ n(Sn, { muted: e })
|
|
1131
1131
|
}
|
|
1132
1132
|
),
|
|
1133
1133
|
/* @__PURE__ */ n(
|
|
@@ -1140,7 +1140,7 @@ const Rr = ({
|
|
|
1140
1140
|
"aria-label": "More controls",
|
|
1141
1141
|
"aria-haspopup": "menu",
|
|
1142
1142
|
"aria-expanded": L,
|
|
1143
|
-
children: /* @__PURE__ */ n(
|
|
1143
|
+
children: /* @__PURE__ */ n(Or, {})
|
|
1144
1144
|
}
|
|
1145
1145
|
),
|
|
1146
1146
|
/* @__PURE__ */ n(
|
|
@@ -1150,44 +1150,44 @@ const Rr = ({
|
|
|
1150
1150
|
className: "ll-tool ll-tool--danger",
|
|
1151
1151
|
onClick: R,
|
|
1152
1152
|
"aria-label": "End conversation",
|
|
1153
|
-
children: /* @__PURE__ */ n(
|
|
1153
|
+
children: /* @__PURE__ */ n(An, {})
|
|
1154
1154
|
}
|
|
1155
1155
|
)
|
|
1156
1156
|
]
|
|
1157
1157
|
}
|
|
1158
1158
|
),
|
|
1159
1159
|
/* @__PURE__ */ w(
|
|
1160
|
-
|
|
1160
|
+
zr,
|
|
1161
1161
|
{
|
|
1162
1162
|
open: L,
|
|
1163
1163
|
onClose: () => _(!1),
|
|
1164
1164
|
anchorRef: h,
|
|
1165
1165
|
children: [
|
|
1166
|
-
|
|
1166
|
+
a && /* @__PURE__ */ w(
|
|
1167
1167
|
"button",
|
|
1168
1168
|
{
|
|
1169
1169
|
type: "button",
|
|
1170
1170
|
className: `ll-overflow-popover__item ${r ? "is-on" : ""}`,
|
|
1171
1171
|
onClick: () => {
|
|
1172
|
-
|
|
1172
|
+
i(), _(!1);
|
|
1173
1173
|
},
|
|
1174
1174
|
children: [
|
|
1175
|
-
/* @__PURE__ */ n(
|
|
1175
|
+
/* @__PURE__ */ n(Cn, {}),
|
|
1176
1176
|
/* @__PURE__ */ n("span", { children: r ? "Stop camera" : "Start camera" })
|
|
1177
1177
|
]
|
|
1178
1178
|
}
|
|
1179
1179
|
),
|
|
1180
|
-
|
|
1180
|
+
l && /* @__PURE__ */ w(
|
|
1181
1181
|
"button",
|
|
1182
1182
|
{
|
|
1183
1183
|
type: "button",
|
|
1184
|
-
className: `ll-overflow-popover__item ${
|
|
1184
|
+
className: `ll-overflow-popover__item ${o ? "is-on" : ""}`,
|
|
1185
1185
|
onClick: () => {
|
|
1186
1186
|
s(), _(!1);
|
|
1187
1187
|
},
|
|
1188
1188
|
children: [
|
|
1189
|
-
/* @__PURE__ */ n(
|
|
1190
|
-
/* @__PURE__ */ n("span", { children:
|
|
1189
|
+
/* @__PURE__ */ n(En, {}),
|
|
1190
|
+
/* @__PURE__ */ n("span", { children: o ? "Stop sharing" : "Share screen" })
|
|
1191
1191
|
]
|
|
1192
1192
|
}
|
|
1193
1193
|
),
|
|
@@ -1200,7 +1200,7 @@ const Rr = ({
|
|
|
1200
1200
|
p(), _(!1);
|
|
1201
1201
|
},
|
|
1202
1202
|
children: [
|
|
1203
|
-
/* @__PURE__ */ n(
|
|
1203
|
+
/* @__PURE__ */ n(Nn, { muted: c }),
|
|
1204
1204
|
/* @__PURE__ */ n("span", { children: c ? "Unmute speaker" : "Mute speaker" })
|
|
1205
1205
|
]
|
|
1206
1206
|
}
|
|
@@ -1211,10 +1211,10 @@ const Rr = ({
|
|
|
1211
1211
|
type: "button",
|
|
1212
1212
|
className: `ll-overflow-popover__item ${f ? "is-on" : ""}`,
|
|
1213
1213
|
onClick: () => {
|
|
1214
|
-
|
|
1214
|
+
d(), _(!1);
|
|
1215
1215
|
},
|
|
1216
1216
|
children: [
|
|
1217
|
-
/* @__PURE__ */ n(
|
|
1217
|
+
/* @__PURE__ */ n(Br, {}),
|
|
1218
1218
|
/* @__PURE__ */ n("span", { children: f ? "Hide typing" : "Type a message" })
|
|
1219
1219
|
]
|
|
1220
1220
|
}
|
|
@@ -1237,7 +1237,7 @@ const Rr = ({
|
|
|
1237
1237
|
)
|
|
1238
1238
|
] });
|
|
1239
1239
|
};
|
|
1240
|
-
function
|
|
1240
|
+
function Or() {
|
|
1241
1241
|
return /* @__PURE__ */ w(
|
|
1242
1242
|
"svg",
|
|
1243
1243
|
{
|
|
@@ -1254,7 +1254,7 @@ function zr() {
|
|
|
1254
1254
|
}
|
|
1255
1255
|
);
|
|
1256
1256
|
}
|
|
1257
|
-
function
|
|
1257
|
+
function Br() {
|
|
1258
1258
|
return /* @__PURE__ */ n(
|
|
1259
1259
|
"svg",
|
|
1260
1260
|
{
|
|
@@ -1271,155 +1271,155 @@ function Or() {
|
|
|
1271
1271
|
}
|
|
1272
1272
|
);
|
|
1273
1273
|
}
|
|
1274
|
-
const
|
|
1274
|
+
const Wr = ({
|
|
1275
1275
|
position: e,
|
|
1276
1276
|
isMobile: t,
|
|
1277
1277
|
agentName: r,
|
|
1278
|
-
avatarImageUrl:
|
|
1279
|
-
idleLoopUrl:
|
|
1280
|
-
greeting:
|
|
1278
|
+
avatarImageUrl: i,
|
|
1279
|
+
idleLoopUrl: a,
|
|
1280
|
+
greeting: o,
|
|
1281
1281
|
branding: s,
|
|
1282
|
-
teamMembers:
|
|
1282
|
+
teamMembers: l,
|
|
1283
1283
|
currentTeamMemberId: c,
|
|
1284
1284
|
isSwitchingTeamMember: p,
|
|
1285
1285
|
teamSwitcherOpen: v,
|
|
1286
1286
|
onToggleTeamSwitcher: f,
|
|
1287
|
-
onSelectTeamMember:
|
|
1287
|
+
onSelectTeamMember: d,
|
|
1288
1288
|
languageMenuOpen: R,
|
|
1289
1289
|
onToggleLanguageMenu: L,
|
|
1290
1290
|
connectionState: _,
|
|
1291
1291
|
agentState: h,
|
|
1292
1292
|
transcript: b,
|
|
1293
|
-
canResume:
|
|
1294
|
-
needsUserGesture:
|
|
1295
|
-
error:
|
|
1296
|
-
isMuted:
|
|
1293
|
+
canResume: N,
|
|
1294
|
+
needsUserGesture: M,
|
|
1295
|
+
error: I,
|
|
1296
|
+
isMuted: U,
|
|
1297
1297
|
micError: g,
|
|
1298
1298
|
micDevices: P,
|
|
1299
|
-
activeMicId:
|
|
1299
|
+
activeMicId: O,
|
|
1300
1300
|
isCameraEnabled: q,
|
|
1301
|
-
cameraPreviewEl:
|
|
1302
|
-
cameraDevices:
|
|
1303
|
-
activeCameraId:
|
|
1304
|
-
isScreenShareEnabled:
|
|
1305
|
-
screenPreviewEl:
|
|
1306
|
-
isSpeakerMuted:
|
|
1307
|
-
allowCamera:
|
|
1308
|
-
allowScreenShare:
|
|
1309
|
-
allowTyping:
|
|
1310
|
-
showMinimize:
|
|
1311
|
-
showClose:
|
|
1312
|
-
chromeless:
|
|
1313
|
-
compactControls:
|
|
1314
|
-
transforming:
|
|
1315
|
-
transformingLabel:
|
|
1316
|
-
avatarVideoContainerRef:
|
|
1317
|
-
agentVideoEl:
|
|
1318
|
-
onConnect:
|
|
1319
|
-
onDisconnect:
|
|
1301
|
+
cameraPreviewEl: ne,
|
|
1302
|
+
cameraDevices: B,
|
|
1303
|
+
activeCameraId: j,
|
|
1304
|
+
isScreenShareEnabled: E,
|
|
1305
|
+
screenPreviewEl: Z,
|
|
1306
|
+
isSpeakerMuted: _e,
|
|
1307
|
+
allowCamera: ce,
|
|
1308
|
+
allowScreenShare: ze,
|
|
1309
|
+
allowTyping: He,
|
|
1310
|
+
showMinimize: Q = !0,
|
|
1311
|
+
showClose: Se = !0,
|
|
1312
|
+
chromeless: xe = !1,
|
|
1313
|
+
compactControls: W = !1,
|
|
1314
|
+
transforming: ie,
|
|
1315
|
+
transformingLabel: Y,
|
|
1316
|
+
avatarVideoContainerRef: fe,
|
|
1317
|
+
agentVideoEl: K,
|
|
1318
|
+
onConnect: Qe,
|
|
1319
|
+
onDisconnect: Ze,
|
|
1320
1320
|
onRetry: ft,
|
|
1321
|
-
onResumeAudio:
|
|
1322
|
-
onToggleMute:
|
|
1323
|
-
onSwitchMicDevice:
|
|
1324
|
-
onToggleCamera:
|
|
1325
|
-
onSwitchCameraDevice:
|
|
1326
|
-
onToggleScreenShare:
|
|
1321
|
+
onResumeAudio: et,
|
|
1322
|
+
onToggleMute: Ne,
|
|
1323
|
+
onSwitchMicDevice: Oe,
|
|
1324
|
+
onToggleCamera: Ae,
|
|
1325
|
+
onSwitchCameraDevice: Be,
|
|
1326
|
+
onToggleScreenShare: Ie,
|
|
1327
1327
|
onToggleSpeaker: Re,
|
|
1328
|
-
onSendMessage:
|
|
1328
|
+
onSendMessage: Te,
|
|
1329
1329
|
onMinimize: Me,
|
|
1330
1330
|
onClose: $,
|
|
1331
|
-
onClearMicError:
|
|
1331
|
+
onClearMicError: xt
|
|
1332
1332
|
}) => {
|
|
1333
1333
|
var mt;
|
|
1334
|
-
const
|
|
1335
|
-
|
|
1336
|
-
if (!
|
|
1337
|
-
|
|
1334
|
+
const De = ((l == null ? void 0 : l.length) ?? 0) > 1, We = _ === "connecting" || _ === "connected", pe = _ === "connected", tt = _ === "idle" || _ === "disconnected" || _ === "error", [Pe, Fe] = S(!1);
|
|
1335
|
+
T(() => {
|
|
1336
|
+
if (!K) {
|
|
1337
|
+
Fe(!1);
|
|
1338
1338
|
return;
|
|
1339
1339
|
}
|
|
1340
|
-
if (!
|
|
1341
|
-
|
|
1340
|
+
if (!K.paused && K.readyState >= 2) {
|
|
1341
|
+
Fe(!0);
|
|
1342
1342
|
return;
|
|
1343
1343
|
}
|
|
1344
|
-
|
|
1345
|
-
const m = () =>
|
|
1346
|
-
return
|
|
1347
|
-
|
|
1344
|
+
Fe(!1);
|
|
1345
|
+
const m = () => Fe(!0);
|
|
1346
|
+
return K.addEventListener("playing", m), K.addEventListener("loadeddata", m), () => {
|
|
1347
|
+
K.removeEventListener("playing", m), K.removeEventListener("loadeddata", m);
|
|
1348
1348
|
};
|
|
1349
|
-
}, [
|
|
1350
|
-
const [
|
|
1351
|
-
|
|
1352
|
-
if (!
|
|
1349
|
+
}, [K]);
|
|
1350
|
+
const [kt, Le] = S(!1);
|
|
1351
|
+
T(() => {
|
|
1352
|
+
if (!pe) {
|
|
1353
1353
|
Le(!1);
|
|
1354
1354
|
return;
|
|
1355
1355
|
}
|
|
1356
|
-
if (
|
|
1356
|
+
if (Pe) return;
|
|
1357
1357
|
const m = setTimeout(() => Le(!0), 8e3);
|
|
1358
1358
|
return () => clearTimeout(m);
|
|
1359
|
-
}, [
|
|
1360
|
-
const
|
|
1361
|
-
|
|
1362
|
-
const m =
|
|
1363
|
-
m && (m.innerHTML = "",
|
|
1364
|
-
}, [
|
|
1365
|
-
const m =
|
|
1366
|
-
m && (m.innerHTML = "",
|
|
1367
|
-
}, [
|
|
1368
|
-
const [
|
|
1369
|
-
|
|
1370
|
-
if (!
|
|
1359
|
+
}, [pe, Pe]);
|
|
1360
|
+
const oe = _ === "connecting" || pe && !!i && !Pe && !kt, nt = A(null), me = A(null);
|
|
1361
|
+
T(() => {
|
|
1362
|
+
const m = nt.current;
|
|
1363
|
+
m && (m.innerHTML = "", ne && (ne.style.width = "100%", ne.style.height = "100%", ne.style.objectFit = "cover", ne.style.transform = "scaleX(-1)", m.appendChild(ne)));
|
|
1364
|
+
}, [ne]), T(() => {
|
|
1365
|
+
const m = me.current;
|
|
1366
|
+
m && (m.innerHTML = "", Z && (Z.style.width = "100%", Z.style.height = "100%", Z.style.objectFit = "contain", m.appendChild(Z)));
|
|
1367
|
+
}, [Z]);
|
|
1368
|
+
const [qe, Ue] = S(!1), [le, ue] = S(!1), pt = A(null), ht = A(null);
|
|
1369
|
+
T(() => {
|
|
1370
|
+
if (!qe && !le && !R && !v) return;
|
|
1371
1371
|
const m = () => {
|
|
1372
|
-
|
|
1372
|
+
Ue(!1), ue(!1), R && L(), v && f();
|
|
1373
1373
|
};
|
|
1374
1374
|
return document.addEventListener("click", m), () => document.removeEventListener("click", m);
|
|
1375
1375
|
}, [
|
|
1376
|
-
|
|
1377
|
-
|
|
1376
|
+
qe,
|
|
1377
|
+
le,
|
|
1378
1378
|
R,
|
|
1379
1379
|
v,
|
|
1380
1380
|
L,
|
|
1381
1381
|
f
|
|
1382
1382
|
]);
|
|
1383
|
-
const [
|
|
1383
|
+
const [Ee, rt] = S(!1), se = C(() => rt((m) => !m), []), [de, Ce] = S(""), it = C(
|
|
1384
1384
|
(m) => {
|
|
1385
1385
|
m.preventDefault();
|
|
1386
|
-
const
|
|
1387
|
-
|
|
1386
|
+
const J = de.trim();
|
|
1387
|
+
J && (Te(J), Ce(""));
|
|
1388
1388
|
},
|
|
1389
|
-
[
|
|
1390
|
-
),
|
|
1391
|
-
let
|
|
1389
|
+
[de, Te]
|
|
1390
|
+
), Lt = s.productName || "Live Layer";
|
|
1391
|
+
let ge = null, ye = null;
|
|
1392
1392
|
for (let m = b.length - 1; m >= 0; m--) {
|
|
1393
|
-
const
|
|
1394
|
-
if (!
|
|
1393
|
+
const J = b[m];
|
|
1394
|
+
if (!ge && J.role === "agent" ? ge = J : !ye && J.role === "user" && (ye = J), ge && ye) break;
|
|
1395
1395
|
}
|
|
1396
|
-
const
|
|
1396
|
+
const ot = pe ? (ge == null ? void 0 : ge.text) || null : o || null, je = pe && (ye == null ? void 0 : ye.text) || null, lt = [
|
|
1397
1397
|
"ll-expanded",
|
|
1398
1398
|
t ? "ll-expanded--mobile" : "ll-expanded--desktop"
|
|
1399
1399
|
].join(" ");
|
|
1400
1400
|
return /* @__PURE__ */ w(
|
|
1401
1401
|
"div",
|
|
1402
1402
|
{
|
|
1403
|
-
className:
|
|
1403
|
+
className: lt,
|
|
1404
1404
|
"data-position": e,
|
|
1405
|
-
"data-state":
|
|
1405
|
+
"data-state": pe ? "connected" : We ? "connecting" : "idle",
|
|
1406
1406
|
role: "dialog",
|
|
1407
1407
|
"aria-label": `${r} widget`,
|
|
1408
1408
|
children: [
|
|
1409
1409
|
/* @__PURE__ */ w("div", { className: "ll-expanded__bg", children: [
|
|
1410
|
-
|
|
1411
|
-
|
|
1410
|
+
i ? /* @__PURE__ */ n(
|
|
1411
|
+
Pr,
|
|
1412
1412
|
{
|
|
1413
|
-
src:
|
|
1413
|
+
src: i,
|
|
1414
1414
|
alt: r,
|
|
1415
1415
|
className: "ll-expanded__bg-img"
|
|
1416
1416
|
}
|
|
1417
1417
|
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((mt = r == null ? void 0 : r.charAt(0)) == null ? void 0 : mt.toUpperCase()) || "A" }) }),
|
|
1418
|
-
|
|
1418
|
+
a && !pe && /* @__PURE__ */ n(
|
|
1419
1419
|
"video",
|
|
1420
1420
|
{
|
|
1421
1421
|
className: "ll-expanded__bg-idle",
|
|
1422
|
-
src:
|
|
1422
|
+
src: a,
|
|
1423
1423
|
autoPlay: !0,
|
|
1424
1424
|
loop: !0,
|
|
1425
1425
|
muted: !0,
|
|
@@ -1427,39 +1427,39 @@ const Hr = ({
|
|
|
1427
1427
|
}
|
|
1428
1428
|
)
|
|
1429
1429
|
] }),
|
|
1430
|
-
/* @__PURE__ */ n("div", { ref:
|
|
1431
|
-
|
|
1430
|
+
/* @__PURE__ */ n("div", { ref: fe, className: "ll-expanded__video" }),
|
|
1431
|
+
oe && /* @__PURE__ */ w("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
|
|
1432
1432
|
/* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
|
|
1433
1433
|
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: p ? "Switching..." : "Connecting..." })
|
|
1434
1434
|
] }),
|
|
1435
|
-
|
|
1435
|
+
M && pe && /* @__PURE__ */ w(
|
|
1436
1436
|
"button",
|
|
1437
1437
|
{
|
|
1438
1438
|
type: "button",
|
|
1439
1439
|
className: "ll-expanded__overlay ll-expanded__overlay--gesture",
|
|
1440
|
-
onClick:
|
|
1440
|
+
onClick: et,
|
|
1441
1441
|
children: [
|
|
1442
1442
|
/* @__PURE__ */ n("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("path", { d: "M3 9v6h4l5 5V4L7 9H3zm13.54.12a5 5 0 0 1 0 5.76l-1.41-1.41a3 3 0 0 0 0-2.94L16.54 9.12z" }) }),
|
|
1443
1443
|
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
|
|
1444
1444
|
]
|
|
1445
1445
|
}
|
|
1446
1446
|
),
|
|
1447
|
-
|
|
1447
|
+
ie && /* @__PURE__ */ w(
|
|
1448
1448
|
"div",
|
|
1449
1449
|
{
|
|
1450
1450
|
className: "ll-expanded__overlay ll-expanded__overlay--transforming",
|
|
1451
1451
|
role: "status",
|
|
1452
1452
|
"aria-live": "polite",
|
|
1453
|
-
"aria-label":
|
|
1453
|
+
"aria-label": Y,
|
|
1454
1454
|
children: [
|
|
1455
1455
|
/* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
|
|
1456
|
-
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children:
|
|
1456
|
+
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: Y })
|
|
1457
1457
|
]
|
|
1458
1458
|
}
|
|
1459
1459
|
),
|
|
1460
|
-
|
|
1461
|
-
!
|
|
1462
|
-
!
|
|
1460
|
+
We ? /* @__PURE__ */ w($e, { children: [
|
|
1461
|
+
!W && /* @__PURE__ */ w("div", { className: "ll-expanded__topbar", children: [
|
|
1462
|
+
!xe && /* @__PURE__ */ w("div", { className: "ll-expanded__topbar-left", children: [
|
|
1463
1463
|
/* @__PURE__ */ w("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1464
1464
|
/* @__PURE__ */ w(
|
|
1465
1465
|
"button",
|
|
@@ -1467,28 +1467,28 @@ const Hr = ({
|
|
|
1467
1467
|
type: "button",
|
|
1468
1468
|
className: "ll-hpill",
|
|
1469
1469
|
onClick: (m) => {
|
|
1470
|
-
|
|
1470
|
+
De && (m.stopPropagation(), f());
|
|
1471
1471
|
},
|
|
1472
|
-
"aria-haspopup":
|
|
1473
|
-
"aria-expanded":
|
|
1472
|
+
"aria-haspopup": De ? "listbox" : void 0,
|
|
1473
|
+
"aria-expanded": De ? v : void 0,
|
|
1474
1474
|
children: [
|
|
1475
1475
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
|
|
1476
|
-
|
|
1476
|
+
De && /* @__PURE__ */ n(bt, {})
|
|
1477
1477
|
]
|
|
1478
1478
|
}
|
|
1479
1479
|
),
|
|
1480
|
-
|
|
1480
|
+
De && v && /* @__PURE__ */ n(
|
|
1481
1481
|
"div",
|
|
1482
1482
|
{
|
|
1483
1483
|
className: "ll-hmenu",
|
|
1484
1484
|
onClick: (m) => m.stopPropagation(),
|
|
1485
1485
|
role: "listbox",
|
|
1486
|
-
children:
|
|
1486
|
+
children: l == null ? void 0 : l.map((m) => /* @__PURE__ */ w(
|
|
1487
1487
|
"button",
|
|
1488
1488
|
{
|
|
1489
1489
|
type: "button",
|
|
1490
1490
|
className: `ll-hmenu__item ${m.id === c ? "is-active" : ""}`,
|
|
1491
|
-
onClick: () =>
|
|
1491
|
+
onClick: () => d(m.id),
|
|
1492
1492
|
role: "option",
|
|
1493
1493
|
"aria-selected": m.id === c,
|
|
1494
1494
|
children: [
|
|
@@ -1556,7 +1556,7 @@ const Hr = ({
|
|
|
1556
1556
|
)
|
|
1557
1557
|
] }),
|
|
1558
1558
|
/* @__PURE__ */ w("div", { className: "ll-expanded__header-actions", children: [
|
|
1559
|
-
|
|
1559
|
+
Q !== !1 && /* @__PURE__ */ n(
|
|
1560
1560
|
"button",
|
|
1561
1561
|
{
|
|
1562
1562
|
type: "button",
|
|
@@ -1567,7 +1567,7 @@ const Hr = ({
|
|
|
1567
1567
|
children: /* @__PURE__ */ n(fn, {})
|
|
1568
1568
|
}
|
|
1569
1569
|
),
|
|
1570
|
-
|
|
1570
|
+
Se !== !1 && /* @__PURE__ */ n(
|
|
1571
1571
|
"button",
|
|
1572
1572
|
{
|
|
1573
1573
|
type: "button",
|
|
@@ -1575,12 +1575,12 @@ const Hr = ({
|
|
|
1575
1575
|
onClick: $,
|
|
1576
1576
|
"aria-label": "End call",
|
|
1577
1577
|
title: "End call",
|
|
1578
|
-
children: /* @__PURE__ */ n(
|
|
1578
|
+
children: /* @__PURE__ */ n(dn, {})
|
|
1579
1579
|
}
|
|
1580
1580
|
)
|
|
1581
1581
|
] })
|
|
1582
1582
|
] }),
|
|
1583
|
-
|
|
1583
|
+
W && /* @__PURE__ */ w("div", { className: "ll-compact-status", "data-state": h, children: [
|
|
1584
1584
|
/* @__PURE__ */ n("span", { className: "ll-compact-status__dot", "aria-hidden": !0 }),
|
|
1585
1585
|
/* @__PURE__ */ n("span", { className: "ll-compact-status__label", children: h })
|
|
1586
1586
|
] })
|
|
@@ -1589,10 +1589,10 @@ const Hr = ({
|
|
|
1589
1589
|
// Hidden in compact mode — on a 140×210 docked slot the brand pill
|
|
1590
1590
|
// and 40px buttons crowded out the central "Start video call"
|
|
1591
1591
|
// affordance. The user can dismiss by scrolling past the slot.
|
|
1592
|
-
!
|
|
1593
|
-
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children:
|
|
1592
|
+
!W && /* @__PURE__ */ w("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
|
|
1593
|
+
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Lt }),
|
|
1594
1594
|
/* @__PURE__ */ w("div", { className: "ll-expanded__header-actions", children: [
|
|
1595
|
-
|
|
1595
|
+
Q !== !1 && /* @__PURE__ */ n(
|
|
1596
1596
|
"button",
|
|
1597
1597
|
{
|
|
1598
1598
|
type: "button",
|
|
@@ -1602,43 +1602,43 @@ const Hr = ({
|
|
|
1602
1602
|
children: /* @__PURE__ */ n(fn, {})
|
|
1603
1603
|
}
|
|
1604
1604
|
),
|
|
1605
|
-
|
|
1605
|
+
Se !== !1 && /* @__PURE__ */ n(
|
|
1606
1606
|
"button",
|
|
1607
1607
|
{
|
|
1608
1608
|
type: "button",
|
|
1609
1609
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1610
1610
|
onClick: $,
|
|
1611
1611
|
"aria-label": "Close widget",
|
|
1612
|
-
children: /* @__PURE__ */ n(
|
|
1612
|
+
children: /* @__PURE__ */ n(dn, {})
|
|
1613
1613
|
}
|
|
1614
1614
|
)
|
|
1615
1615
|
] })
|
|
1616
1616
|
] })
|
|
1617
1617
|
),
|
|
1618
|
-
|
|
1619
|
-
const m =
|
|
1620
|
-
return /* @__PURE__ */ w(
|
|
1621
|
-
!
|
|
1618
|
+
tt && /* @__PURE__ */ (() => {
|
|
1619
|
+
const m = N ? "Resume session" : _ === "disconnected" ? "Reconnect to agent" : "Start video call";
|
|
1620
|
+
return /* @__PURE__ */ w($e, { children: [
|
|
1621
|
+
!I && /* @__PURE__ */ w(
|
|
1622
1622
|
"button",
|
|
1623
1623
|
{
|
|
1624
1624
|
type: "button",
|
|
1625
1625
|
className: "ll-expanded__play",
|
|
1626
|
-
onClick:
|
|
1626
|
+
onClick: Qe,
|
|
1627
1627
|
"aria-label": m,
|
|
1628
1628
|
children: [
|
|
1629
1629
|
/* @__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" }) }) }),
|
|
1630
|
-
|
|
1630
|
+
W && /* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children: m })
|
|
1631
1631
|
]
|
|
1632
1632
|
}
|
|
1633
1633
|
),
|
|
1634
|
-
!
|
|
1635
|
-
|
|
1634
|
+
!W && /* @__PURE__ */ w("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
|
|
1635
|
+
o && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: o }) }),
|
|
1636
1636
|
/* @__PURE__ */ n(
|
|
1637
1637
|
"button",
|
|
1638
1638
|
{
|
|
1639
1639
|
type: "button",
|
|
1640
1640
|
className: "ll-expanded__cta",
|
|
1641
|
-
onClick:
|
|
1641
|
+
onClick: Qe,
|
|
1642
1642
|
"aria-label": m,
|
|
1643
1643
|
children: m
|
|
1644
1644
|
}
|
|
@@ -1649,64 +1649,64 @@ const Hr = ({
|
|
|
1649
1649
|
/* @__PURE__ */ w(
|
|
1650
1650
|
"div",
|
|
1651
1651
|
{
|
|
1652
|
-
className: `ll-expanded__pip ${
|
|
1652
|
+
className: `ll-expanded__pip ${We && (q || E) ? "is-visible" : ""}`,
|
|
1653
1653
|
children: [
|
|
1654
1654
|
/* @__PURE__ */ n(
|
|
1655
1655
|
"div",
|
|
1656
1656
|
{
|
|
1657
|
-
ref:
|
|
1658
|
-
className:
|
|
1657
|
+
ref: me,
|
|
1658
|
+
className: E ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1659
1659
|
}
|
|
1660
1660
|
),
|
|
1661
1661
|
/* @__PURE__ */ n(
|
|
1662
1662
|
"div",
|
|
1663
1663
|
{
|
|
1664
|
-
ref:
|
|
1665
|
-
className: !
|
|
1664
|
+
ref: nt,
|
|
1665
|
+
className: !E && q ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1666
1666
|
}
|
|
1667
1667
|
)
|
|
1668
1668
|
]
|
|
1669
1669
|
}
|
|
1670
1670
|
),
|
|
1671
|
-
|
|
1672
|
-
!
|
|
1671
|
+
We ? /* @__PURE__ */ w("div", { className: "ll-expanded__bottom", children: [
|
|
1672
|
+
!W && ot && /* @__PURE__ */ n(
|
|
1673
1673
|
"div",
|
|
1674
1674
|
{
|
|
1675
1675
|
className: "ll-expanded__transcript ll-expanded__transcript--agent",
|
|
1676
1676
|
"data-role": "agent",
|
|
1677
|
-
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children:
|
|
1677
|
+
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: ot })
|
|
1678
1678
|
}
|
|
1679
1679
|
),
|
|
1680
|
-
!
|
|
1680
|
+
!W && je && /* @__PURE__ */ n(
|
|
1681
1681
|
"div",
|
|
1682
1682
|
{
|
|
1683
1683
|
className: "ll-expanded__transcript ll-expanded__transcript--user",
|
|
1684
1684
|
"data-role": "user",
|
|
1685
|
-
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children:
|
|
1685
|
+
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: je })
|
|
1686
1686
|
}
|
|
1687
1687
|
),
|
|
1688
|
-
!
|
|
1689
|
-
|
|
1688
|
+
!xe && !W && /* @__PURE__ */ w("div", { className: "ll-toolbar", onClick: (m) => m.stopPropagation(), children: [
|
|
1689
|
+
ze && /* @__PURE__ */ n(
|
|
1690
1690
|
"button",
|
|
1691
1691
|
{
|
|
1692
1692
|
type: "button",
|
|
1693
|
-
className: `ll-tool ${
|
|
1694
|
-
onClick:
|
|
1695
|
-
"aria-label":
|
|
1696
|
-
title:
|
|
1697
|
-
children: /* @__PURE__ */ n(
|
|
1693
|
+
className: `ll-tool ${E ? "is-on" : ""}`,
|
|
1694
|
+
onClick: Ie,
|
|
1695
|
+
"aria-label": E ? "Stop sharing screen" : "Share screen",
|
|
1696
|
+
title: E ? "Stop sharing" : "Share screen",
|
|
1697
|
+
children: /* @__PURE__ */ n(En, {})
|
|
1698
1698
|
}
|
|
1699
1699
|
),
|
|
1700
|
-
|
|
1700
|
+
ce && /* @__PURE__ */ w("div", { className: "ll-tool-split", children: [
|
|
1701
1701
|
/* @__PURE__ */ n(
|
|
1702
1702
|
"button",
|
|
1703
1703
|
{
|
|
1704
1704
|
type: "button",
|
|
1705
1705
|
className: `ll-tool ll-tool--left ${q ? "is-on" : ""}`,
|
|
1706
|
-
onClick:
|
|
1706
|
+
onClick: Ae,
|
|
1707
1707
|
"aria-label": q ? "Turn off camera" : "Turn on camera",
|
|
1708
1708
|
title: q ? "Stop camera" : "Start camera",
|
|
1709
|
-
children: /* @__PURE__ */ n(
|
|
1709
|
+
children: /* @__PURE__ */ n(Cn, {})
|
|
1710
1710
|
}
|
|
1711
1711
|
),
|
|
1712
1712
|
/* @__PURE__ */ n(
|
|
@@ -1716,23 +1716,23 @@ const Hr = ({
|
|
|
1716
1716
|
type: "button",
|
|
1717
1717
|
className: `ll-tool ll-tool--right ${q ? "is-on" : ""}`,
|
|
1718
1718
|
onClick: (m) => {
|
|
1719
|
-
m.stopPropagation(),
|
|
1719
|
+
m.stopPropagation(), ue((J) => !J), Ue(!1);
|
|
1720
1720
|
},
|
|
1721
1721
|
"aria-label": "Camera devices",
|
|
1722
1722
|
"aria-haspopup": "listbox",
|
|
1723
|
-
"aria-expanded":
|
|
1723
|
+
"aria-expanded": le,
|
|
1724
1724
|
children: /* @__PURE__ */ n(bt, {})
|
|
1725
1725
|
}
|
|
1726
1726
|
),
|
|
1727
|
-
|
|
1727
|
+
le && B.length > 0 && /* @__PURE__ */ n(
|
|
1728
1728
|
pn,
|
|
1729
1729
|
{
|
|
1730
1730
|
label: "Camera",
|
|
1731
|
-
devices:
|
|
1732
|
-
activeId:
|
|
1731
|
+
devices: B,
|
|
1732
|
+
activeId: j,
|
|
1733
1733
|
anchorRef: ht,
|
|
1734
1734
|
onPick: (m) => {
|
|
1735
|
-
|
|
1735
|
+
ue(!1), Be(m);
|
|
1736
1736
|
}
|
|
1737
1737
|
}
|
|
1738
1738
|
)
|
|
@@ -1742,11 +1742,11 @@ const Hr = ({
|
|
|
1742
1742
|
"button",
|
|
1743
1743
|
{
|
|
1744
1744
|
type: "button",
|
|
1745
|
-
className: `ll-tool ll-tool--left ${
|
|
1746
|
-
onClick:
|
|
1747
|
-
"aria-label":
|
|
1748
|
-
title:
|
|
1749
|
-
children: /* @__PURE__ */ n(
|
|
1745
|
+
className: `ll-tool ll-tool--left ${U ? "is-muted" : ""}`,
|
|
1746
|
+
onClick: Ne,
|
|
1747
|
+
"aria-label": U ? "Unmute microphone" : "Mute microphone",
|
|
1748
|
+
title: U ? "Unmute" : "Mute",
|
|
1749
|
+
children: /* @__PURE__ */ n(Sn, { muted: U })
|
|
1750
1750
|
}
|
|
1751
1751
|
),
|
|
1752
1752
|
/* @__PURE__ */ n(
|
|
@@ -1754,25 +1754,25 @@ const Hr = ({
|
|
|
1754
1754
|
{
|
|
1755
1755
|
ref: pt,
|
|
1756
1756
|
type: "button",
|
|
1757
|
-
className: `ll-tool ll-tool--right ${
|
|
1757
|
+
className: `ll-tool ll-tool--right ${U ? "is-muted" : ""}`,
|
|
1758
1758
|
onClick: (m) => {
|
|
1759
|
-
m.stopPropagation(),
|
|
1759
|
+
m.stopPropagation(), Ue((J) => !J), ue(!1);
|
|
1760
1760
|
},
|
|
1761
1761
|
"aria-label": "Microphone devices",
|
|
1762
1762
|
"aria-haspopup": "listbox",
|
|
1763
|
-
"aria-expanded":
|
|
1763
|
+
"aria-expanded": qe,
|
|
1764
1764
|
children: /* @__PURE__ */ n(bt, {})
|
|
1765
1765
|
}
|
|
1766
1766
|
),
|
|
1767
|
-
|
|
1767
|
+
qe && P.length > 0 && /* @__PURE__ */ n(
|
|
1768
1768
|
pn,
|
|
1769
1769
|
{
|
|
1770
1770
|
label: "Microphone",
|
|
1771
1771
|
devices: P,
|
|
1772
|
-
activeId:
|
|
1772
|
+
activeId: O,
|
|
1773
1773
|
anchorRef: pt,
|
|
1774
1774
|
onPick: (m) => {
|
|
1775
|
-
|
|
1775
|
+
Ue(!1), Oe(m);
|
|
1776
1776
|
}
|
|
1777
1777
|
}
|
|
1778
1778
|
)
|
|
@@ -1781,11 +1781,11 @@ const Hr = ({
|
|
|
1781
1781
|
"button",
|
|
1782
1782
|
{
|
|
1783
1783
|
type: "button",
|
|
1784
|
-
className: `ll-tool ${
|
|
1784
|
+
className: `ll-tool ${_e ? "is-muted" : ""}`,
|
|
1785
1785
|
onClick: Re,
|
|
1786
|
-
"aria-label":
|
|
1787
|
-
title:
|
|
1788
|
-
children: /* @__PURE__ */ n(
|
|
1786
|
+
"aria-label": _e ? "Unmute speaker" : "Mute speaker",
|
|
1787
|
+
title: _e ? "Unmute speaker" : "Mute speaker",
|
|
1788
|
+
children: /* @__PURE__ */ n(Nn, { muted: _e })
|
|
1789
1789
|
}
|
|
1790
1790
|
),
|
|
1791
1791
|
/* @__PURE__ */ n(
|
|
@@ -1793,51 +1793,51 @@ const Hr = ({
|
|
|
1793
1793
|
{
|
|
1794
1794
|
type: "button",
|
|
1795
1795
|
className: "ll-tool ll-tool--danger",
|
|
1796
|
-
onClick:
|
|
1796
|
+
onClick: Ze,
|
|
1797
1797
|
"aria-label": "End conversation",
|
|
1798
1798
|
title: "End conversation",
|
|
1799
|
-
children: /* @__PURE__ */ n(
|
|
1799
|
+
children: /* @__PURE__ */ n(An, {})
|
|
1800
1800
|
}
|
|
1801
1801
|
)
|
|
1802
1802
|
] }),
|
|
1803
|
-
!
|
|
1804
|
-
|
|
1803
|
+
!xe && W && /* @__PURE__ */ n(
|
|
1804
|
+
Hr,
|
|
1805
1805
|
{
|
|
1806
|
-
isMuted:
|
|
1807
|
-
onToggleMute:
|
|
1806
|
+
isMuted: U,
|
|
1807
|
+
onToggleMute: Ne,
|
|
1808
1808
|
isCameraEnabled: q,
|
|
1809
|
-
onToggleCamera:
|
|
1810
|
-
allowCamera:
|
|
1811
|
-
isScreenShareEnabled:
|
|
1812
|
-
onToggleScreenShare:
|
|
1813
|
-
allowScreenShare:
|
|
1814
|
-
isSpeakerMuted:
|
|
1809
|
+
onToggleCamera: Ae,
|
|
1810
|
+
allowCamera: ce,
|
|
1811
|
+
isScreenShareEnabled: E,
|
|
1812
|
+
onToggleScreenShare: Ie,
|
|
1813
|
+
allowScreenShare: ze,
|
|
1814
|
+
isSpeakerMuted: _e,
|
|
1815
1815
|
onToggleSpeaker: Re,
|
|
1816
|
-
allowTyping:
|
|
1817
|
-
isTypingOpen:
|
|
1818
|
-
onToggleTyping:
|
|
1819
|
-
onDisconnect:
|
|
1816
|
+
allowTyping: He,
|
|
1817
|
+
isTypingOpen: Ee,
|
|
1818
|
+
onToggleTyping: se,
|
|
1819
|
+
onDisconnect: Ze
|
|
1820
1820
|
}
|
|
1821
1821
|
),
|
|
1822
|
-
!
|
|
1822
|
+
!xe && He && (W ? Ee : !0) && /* @__PURE__ */ w("form", { className: "ll-message-input", onSubmit: it, children: [
|
|
1823
1823
|
/* @__PURE__ */ n(
|
|
1824
1824
|
"input",
|
|
1825
1825
|
{
|
|
1826
1826
|
type: "text",
|
|
1827
1827
|
className: "ll-message-input__field",
|
|
1828
1828
|
placeholder: "Message...",
|
|
1829
|
-
value:
|
|
1830
|
-
onChange: (m) =>
|
|
1829
|
+
value: de,
|
|
1830
|
+
onChange: (m) => Ce(m.target.value),
|
|
1831
1831
|
"aria-label": "Message the agent"
|
|
1832
1832
|
}
|
|
1833
1833
|
),
|
|
1834
|
-
|
|
1834
|
+
de.trim() && /* @__PURE__ */ n(
|
|
1835
1835
|
"button",
|
|
1836
1836
|
{
|
|
1837
1837
|
type: "submit",
|
|
1838
1838
|
className: "ll-message-input__send",
|
|
1839
1839
|
"aria-label": "Send message",
|
|
1840
|
-
children: /* @__PURE__ */ n(
|
|
1840
|
+
children: /* @__PURE__ */ n(Fr, {})
|
|
1841
1841
|
}
|
|
1842
1842
|
)
|
|
1843
1843
|
] })
|
|
@@ -1851,15 +1851,15 @@ const Hr = ({
|
|
|
1851
1851
|
{
|
|
1852
1852
|
type: "button",
|
|
1853
1853
|
className: "ll-expanded__banner-x",
|
|
1854
|
-
onClick:
|
|
1854
|
+
onClick: xt,
|
|
1855
1855
|
"aria-label": "Dismiss",
|
|
1856
1856
|
children: "×"
|
|
1857
1857
|
}
|
|
1858
1858
|
)
|
|
1859
1859
|
] });
|
|
1860
|
-
if (!
|
|
1861
|
-
let m = "Failed to connect",
|
|
1862
|
-
return
|
|
1860
|
+
if (!I || _ !== "error") return null;
|
|
1861
|
+
let m = "Failed to connect", J = "Try again";
|
|
1862
|
+
return I === "MIC_PERMISSION_DENIED" ? m = "Microphone blocked. Allow access to talk." : I === "MIC_NOT_FOUND" ? m = "No microphone found. Plug one in + retry." : I === "MIC_UNAVAILABLE" ? m = "Mic unavailable. Check other apps using it." : I === "AGENT_TIMEOUT" ? m = "Agent didn't pick up. Try again." : I === "CONNECT_FAILED" ? m = "Connection failed. Check your network." : I.length < 80 && (m = I), /* @__PURE__ */ w("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
|
|
1863
1863
|
/* @__PURE__ */ n("span", { children: m }),
|
|
1864
1864
|
/* @__PURE__ */ n(
|
|
1865
1865
|
"button",
|
|
@@ -1867,7 +1867,7 @@ const Hr = ({
|
|
|
1867
1867
|
type: "button",
|
|
1868
1868
|
className: "ll-expanded__banner-retry",
|
|
1869
1869
|
onClick: ft,
|
|
1870
|
-
children:
|
|
1870
|
+
children: J
|
|
1871
1871
|
}
|
|
1872
1872
|
)
|
|
1873
1873
|
] });
|
|
@@ -1879,7 +1879,7 @@ const Hr = ({
|
|
|
1879
1879
|
function bt() {
|
|
1880
1880
|
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" }) });
|
|
1881
1881
|
}
|
|
1882
|
-
function
|
|
1882
|
+
function dn() {
|
|
1883
1883
|
return /* @__PURE__ */ w("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
|
|
1884
1884
|
/* @__PURE__ */ n("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1885
1885
|
/* @__PURE__ */ n("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
@@ -1888,20 +1888,20 @@ function un() {
|
|
|
1888
1888
|
function fn() {
|
|
1889
1889
|
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" }) });
|
|
1890
1890
|
}
|
|
1891
|
-
function
|
|
1891
|
+
function En() {
|
|
1892
1892
|
return /* @__PURE__ */ w("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: [
|
|
1893
1893
|
/* @__PURE__ */ n("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
|
|
1894
1894
|
/* @__PURE__ */ n("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
|
|
1895
1895
|
/* @__PURE__ */ n("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
|
|
1896
1896
|
] });
|
|
1897
1897
|
}
|
|
1898
|
-
function
|
|
1898
|
+
function Cn() {
|
|
1899
1899
|
return /* @__PURE__ */ w("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: [
|
|
1900
1900
|
/* @__PURE__ */ n("path", { d: "M23 7l-7 5 7 5V7z" }),
|
|
1901
1901
|
/* @__PURE__ */ n("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
|
|
1902
1902
|
] });
|
|
1903
1903
|
}
|
|
1904
|
-
function
|
|
1904
|
+
function Sn({ muted: e }) {
|
|
1905
1905
|
return /* @__PURE__ */ w("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: [
|
|
1906
1906
|
/* @__PURE__ */ n("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
|
|
1907
1907
|
/* @__PURE__ */ n("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
|
|
@@ -1909,22 +1909,22 @@ function Cn({ muted: e }) {
|
|
|
1909
1909
|
e && /* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
1910
1910
|
] });
|
|
1911
1911
|
}
|
|
1912
|
-
function
|
|
1912
|
+
function Nn({ muted: e }) {
|
|
1913
1913
|
return /* @__PURE__ */ w("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: [
|
|
1914
1914
|
/* @__PURE__ */ n("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
1915
|
-
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ w(
|
|
1915
|
+
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ w($e, { children: [
|
|
1916
1916
|
/* @__PURE__ */ n("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
|
|
1917
1917
|
/* @__PURE__ */ n("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
|
|
1918
1918
|
] })
|
|
1919
1919
|
] });
|
|
1920
1920
|
}
|
|
1921
|
-
function
|
|
1921
|
+
function Fr() {
|
|
1922
1922
|
return /* @__PURE__ */ w("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1923
1923
|
/* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
|
|
1924
1924
|
/* @__PURE__ */ n("polyline", { points: "12 5 19 12 12 19" })
|
|
1925
1925
|
] });
|
|
1926
1926
|
}
|
|
1927
|
-
function
|
|
1927
|
+
function An() {
|
|
1928
1928
|
return /* @__PURE__ */ n("svg", { width: "16", height: "16", viewBox: "-4 -4 32 32", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: /* @__PURE__ */ n(
|
|
1929
1929
|
"path",
|
|
1930
1930
|
{
|
|
@@ -1937,55 +1937,55 @@ const pn = ({
|
|
|
1937
1937
|
label: e,
|
|
1938
1938
|
devices: t,
|
|
1939
1939
|
activeId: r,
|
|
1940
|
-
onPick:
|
|
1941
|
-
anchorRef:
|
|
1940
|
+
onPick: i,
|
|
1941
|
+
anchorRef: a
|
|
1942
1942
|
}) => {
|
|
1943
|
-
const [
|
|
1944
|
-
return
|
|
1945
|
-
const
|
|
1946
|
-
const c =
|
|
1943
|
+
const [o, s] = S(null);
|
|
1944
|
+
return xn(() => {
|
|
1945
|
+
const l = () => {
|
|
1946
|
+
const c = a.current;
|
|
1947
1947
|
if (!c) return;
|
|
1948
|
-
const p = c.getBoundingClientRect(), v = 126, f = window.innerWidth - 16 - 110,
|
|
1948
|
+
const p = c.getBoundingClientRect(), v = 126, f = window.innerWidth - 16 - 110, d = p.left + p.width / 2;
|
|
1949
1949
|
s({
|
|
1950
1950
|
top: p.top - 8,
|
|
1951
|
-
left: Math.max(v, Math.min(f,
|
|
1951
|
+
left: Math.max(v, Math.min(f, d))
|
|
1952
1952
|
});
|
|
1953
1953
|
};
|
|
1954
|
-
return
|
|
1955
|
-
window.removeEventListener("scroll",
|
|
1954
|
+
return l(), window.addEventListener("scroll", l, !0), window.addEventListener("resize", l), () => {
|
|
1955
|
+
window.removeEventListener("scroll", l, !0), window.removeEventListener("resize", l);
|
|
1956
1956
|
};
|
|
1957
|
-
}, [
|
|
1957
|
+
}, [a]), o === null || typeof document > "u" ? null : Pt(
|
|
1958
1958
|
/* @__PURE__ */ w(
|
|
1959
1959
|
"div",
|
|
1960
1960
|
{
|
|
1961
1961
|
className: "ll-device-menu ll-device-menu--floating",
|
|
1962
|
-
onClick: (
|
|
1962
|
+
onClick: (l) => l.stopPropagation(),
|
|
1963
1963
|
role: "listbox",
|
|
1964
1964
|
style: {
|
|
1965
1965
|
position: "fixed",
|
|
1966
|
-
top:
|
|
1967
|
-
left:
|
|
1966
|
+
top: o.top,
|
|
1967
|
+
left: o.left,
|
|
1968
1968
|
// translate up by 100% so its BOTTOM edge sits at pos.top.
|
|
1969
1969
|
transform: "translate(-50%, -100%)"
|
|
1970
1970
|
},
|
|
1971
1971
|
children: [
|
|
1972
1972
|
/* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
|
|
1973
|
-
t.map((
|
|
1974
|
-
const p = r ===
|
|
1973
|
+
t.map((l, c) => {
|
|
1974
|
+
const p = r === l.deviceId;
|
|
1975
1975
|
return /* @__PURE__ */ w(
|
|
1976
1976
|
"button",
|
|
1977
1977
|
{
|
|
1978
1978
|
type: "button",
|
|
1979
1979
|
className: `ll-device-menu__item ${p ? "is-active" : ""}`,
|
|
1980
|
-
onClick: () =>
|
|
1980
|
+
onClick: () => i(l.deviceId),
|
|
1981
1981
|
role: "option",
|
|
1982
1982
|
"aria-selected": p,
|
|
1983
1983
|
children: [
|
|
1984
1984
|
p && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
|
|
1985
|
-
/* @__PURE__ */ n("span", { className: "ll-device-menu__name", children:
|
|
1985
|
+
/* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: l.label || `${e} ${c + 1}` })
|
|
1986
1986
|
]
|
|
1987
1987
|
},
|
|
1988
|
-
|
|
1988
|
+
l.deviceId || c
|
|
1989
1989
|
);
|
|
1990
1990
|
})
|
|
1991
1991
|
]
|
|
@@ -1993,7 +1993,7 @@ const pn = ({
|
|
|
1993
1993
|
),
|
|
1994
1994
|
document.body
|
|
1995
1995
|
);
|
|
1996
|
-
},
|
|
1996
|
+
}, qr = [
|
|
1997
1997
|
// Accept any value (or empty) — `<input data-ll-private />` and
|
|
1998
1998
|
// `<input data-ll-private="true" />` both opt out. The bare attribute
|
|
1999
1999
|
// is the recommended spelling; "true" is preserved for back-compat.
|
|
@@ -2004,13 +2004,13 @@ const pn = ({
|
|
|
2004
2004
|
function $t(e) {
|
|
2005
2005
|
let t = e;
|
|
2006
2006
|
for (; t; ) {
|
|
2007
|
-
for (const r of
|
|
2007
|
+
for (const r of qr)
|
|
2008
2008
|
if (t.matches(r)) return !0;
|
|
2009
2009
|
t = t.parentElement;
|
|
2010
2010
|
}
|
|
2011
2011
|
return !1;
|
|
2012
2012
|
}
|
|
2013
|
-
function
|
|
2013
|
+
function Mt(e) {
|
|
2014
2014
|
if ($t(e)) return !1;
|
|
2015
2015
|
if (e instanceof HTMLInputElement) {
|
|
2016
2016
|
if (e.type === "password") return !1;
|
|
@@ -2019,7 +2019,7 @@ function xt(e) {
|
|
|
2019
2019
|
}
|
|
2020
2020
|
return !0;
|
|
2021
2021
|
}
|
|
2022
|
-
const wt = 4096,
|
|
2022
|
+
const wt = 4096, Ur = 20, jr = 20, Vr = 10, Yr = 10, Gr = 30, Kr = 20, hn = 500, Jr = [
|
|
2023
2023
|
'[data-ll-private="true"]',
|
|
2024
2024
|
".ll-widget",
|
|
2025
2025
|
"script",
|
|
@@ -2027,72 +2027,86 @@ const wt = 4096, qr = 20, Fr = 20, Ur = 10, jr = 10, Vr = 30, Yr = 20, hn = 500,
|
|
|
2027
2027
|
"noscript",
|
|
2028
2028
|
"iframe"
|
|
2029
2029
|
];
|
|
2030
|
-
function
|
|
2030
|
+
function ut(e) {
|
|
2031
2031
|
if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
|
|
2032
2032
|
let t = e;
|
|
2033
2033
|
for (; t; ) {
|
|
2034
|
-
for (const r of
|
|
2034
|
+
for (const r of Jr)
|
|
2035
2035
|
if (t.matches(r)) return !0;
|
|
2036
2036
|
t = t.parentElement;
|
|
2037
2037
|
}
|
|
2038
2038
|
return !1;
|
|
2039
2039
|
}
|
|
2040
|
-
function
|
|
2040
|
+
function dt(e) {
|
|
2041
2041
|
if (typeof window > "u") return !0;
|
|
2042
2042
|
const t = e.getBoundingClientRect();
|
|
2043
2043
|
if (t.width <= 0 || t.height <= 0) return !1;
|
|
2044
|
-
const r = window.innerHeight || document.documentElement.clientHeight,
|
|
2045
|
-
return t.bottom > 0 && t.right > 0 && t.top < r && t.left <
|
|
2044
|
+
const r = window.innerHeight || document.documentElement.clientHeight, i = window.innerWidth || document.documentElement.clientWidth;
|
|
2045
|
+
return t.bottom > 0 && t.right > 0 && t.top < r && t.left < i;
|
|
2046
2046
|
}
|
|
2047
2047
|
function mn(e) {
|
|
2048
2048
|
const t = e.getAttribute("id");
|
|
2049
2049
|
if (t) {
|
|
2050
|
-
const
|
|
2050
|
+
const o = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(t) : t.replace(/"/g, '\\"'), s = document.querySelector(`label[for="${o}"]`);
|
|
2051
2051
|
if (s != null && s.textContent) return s.textContent.trim();
|
|
2052
2052
|
}
|
|
2053
2053
|
const r = e.getAttribute("aria-label");
|
|
2054
2054
|
if (r) return r.trim();
|
|
2055
|
-
const o = e.getAttribute("placeholder");
|
|
2056
|
-
if (o) return o.trim();
|
|
2057
2055
|
const i = e.closest("label");
|
|
2058
|
-
|
|
2056
|
+
if (i) {
|
|
2057
|
+
const o = [];
|
|
2058
|
+
for (const l of Array.from(i.childNodes))
|
|
2059
|
+
if (l.nodeType === Node.TEXT_NODE) {
|
|
2060
|
+
const c = (l.textContent || "").trim();
|
|
2061
|
+
c && o.push(c);
|
|
2062
|
+
} else if (l instanceof HTMLElement) {
|
|
2063
|
+
if (l instanceof HTMLInputElement || l instanceof HTMLTextAreaElement || l instanceof HTMLSelectElement || l instanceof HTMLButtonElement)
|
|
2064
|
+
continue;
|
|
2065
|
+
const c = (l.textContent || "").trim();
|
|
2066
|
+
c && o.push(c);
|
|
2067
|
+
}
|
|
2068
|
+
const s = o.join(" ").trim();
|
|
2069
|
+
if (s) return s;
|
|
2070
|
+
}
|
|
2071
|
+
const a = e.getAttribute("placeholder");
|
|
2072
|
+
return a ? a.trim() : "";
|
|
2059
2073
|
}
|
|
2060
|
-
function
|
|
2074
|
+
function re(e, t) {
|
|
2061
2075
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
2062
2076
|
}
|
|
2063
|
-
function
|
|
2077
|
+
function Xr(e) {
|
|
2064
2078
|
return e && e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || null;
|
|
2065
2079
|
}
|
|
2066
|
-
function
|
|
2080
|
+
function Qr(e) {
|
|
2067
2081
|
const t = e.getAttribute("aria-label");
|
|
2068
2082
|
if (t) return t.trim().slice(0, 80);
|
|
2069
2083
|
const r = e.getAttribute("aria-labelledby");
|
|
2070
2084
|
if (r) {
|
|
2071
|
-
const
|
|
2072
|
-
if (
|
|
2085
|
+
const o = document.getElementById(r);
|
|
2086
|
+
if (o != null && o.textContent) return o.textContent.trim().slice(0, 80);
|
|
2073
2087
|
}
|
|
2074
|
-
const
|
|
2088
|
+
const i = e.querySelector(
|
|
2075
2089
|
'button[type="submit"], input[type="submit"], button:not([type])'
|
|
2076
2090
|
);
|
|
2077
|
-
if (
|
|
2078
|
-
const
|
|
2079
|
-
if (
|
|
2080
|
-
return
|
|
2091
|
+
if (i) {
|
|
2092
|
+
const o = i instanceof HTMLInputElement ? i.value : (i.textContent ?? "").trim();
|
|
2093
|
+
if (o && o.length < 60 && !/^(submit|ok|continue)$/i.test(o))
|
|
2094
|
+
return o;
|
|
2081
2095
|
}
|
|
2082
|
-
let
|
|
2083
|
-
for (let
|
|
2084
|
-
const s =
|
|
2096
|
+
let a = e.parentElement;
|
|
2097
|
+
for (let o = 0; a && o < 4; o++, a = a.parentElement) {
|
|
2098
|
+
const s = a.querySelector("h1, h2, h3, h4");
|
|
2085
2099
|
if (s != null && s.textContent) {
|
|
2086
|
-
const
|
|
2087
|
-
if (
|
|
2100
|
+
const l = s.textContent.trim();
|
|
2101
|
+
if (l && l.length < 80) return l;
|
|
2088
2102
|
}
|
|
2089
2103
|
}
|
|
2090
2104
|
return null;
|
|
2091
2105
|
}
|
|
2092
|
-
function
|
|
2106
|
+
function Ge(e) {
|
|
2093
2107
|
return e.length;
|
|
2094
2108
|
}
|
|
2095
|
-
function
|
|
2109
|
+
function Zr(e, t = {}) {
|
|
2096
2110
|
const r = t.doc ?? (typeof document < "u" ? document : null);
|
|
2097
2111
|
if (!r)
|
|
2098
2112
|
return {
|
|
@@ -2106,39 +2120,39 @@ function Xr(e, t = {}) {
|
|
|
2106
2120
|
forms: [],
|
|
2107
2121
|
extras: e
|
|
2108
2122
|
};
|
|
2109
|
-
const
|
|
2123
|
+
const i = typeof window < "u" && window.location.href || "", a = typeof window < "u" && window.location.pathname || "/", o = r.title || "", s = Array.from(
|
|
2110
2124
|
r.querySelectorAll("[data-ll-region]")
|
|
2111
|
-
),
|
|
2125
|
+
), l = [];
|
|
2112
2126
|
for (const g of s) {
|
|
2113
|
-
if (
|
|
2114
|
-
if (
|
|
2115
|
-
const P = g.getAttribute("data-ll-region") ?? "",
|
|
2127
|
+
if (l.length >= Vr) break;
|
|
2128
|
+
if (ut(g) || !dt(g)) continue;
|
|
2129
|
+
const P = g.getAttribute("data-ll-region") ?? "", O = g.getAttribute("data-ll-intent") ?? void 0, q = re(
|
|
2116
2130
|
(g.innerText || g.textContent || "").trim(),
|
|
2117
2131
|
hn * 2
|
|
2118
2132
|
);
|
|
2119
|
-
!P || !q ||
|
|
2133
|
+
!P || !q || l.push({ id: P, intent: O, text: q });
|
|
2120
2134
|
}
|
|
2121
2135
|
const c = [], p = ["H1", "H2", "H3", "H4", "H5", "H6"], v = Array.from(
|
|
2122
2136
|
r.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
|
2123
2137
|
);
|
|
2124
2138
|
for (const g of v) {
|
|
2125
|
-
if (
|
|
2139
|
+
if (ut(g) || !dt(g)) continue;
|
|
2126
2140
|
const P = (g.textContent || "").trim();
|
|
2127
|
-
P && c.push(`${g.tagName}: ${
|
|
2141
|
+
P && c.push(`${g.tagName}: ${re(P, 200)}`);
|
|
2128
2142
|
}
|
|
2129
2143
|
const f = Array.from(r.querySelectorAll("p, li"));
|
|
2130
2144
|
for (const g of f) {
|
|
2131
|
-
if (
|
|
2145
|
+
if (ut(g) || !dt(g) || p.includes(g.tagName)) continue;
|
|
2132
2146
|
const P = (g.textContent || "").trim();
|
|
2133
|
-
P.length > 10 && c.push(
|
|
2147
|
+
P.length > 10 && c.push(re(P, hn));
|
|
2134
2148
|
}
|
|
2135
|
-
const
|
|
2149
|
+
const d = c.join(`
|
|
2136
2150
|
`), R = [], L = Array.from(r.querySelectorAll("a[href]"));
|
|
2137
2151
|
for (const g of L) {
|
|
2138
|
-
if (R.length >=
|
|
2139
|
-
if (
|
|
2140
|
-
const P = g.getAttribute("href") || "",
|
|
2141
|
-
!P || !
|
|
2152
|
+
if (R.length >= Ur) break;
|
|
2153
|
+
if (ut(g) || !dt(g)) continue;
|
|
2154
|
+
const P = g.getAttribute("href") || "", O = (g.textContent || "").trim();
|
|
2155
|
+
!P || !O || R.push({ href: P, text: re(O, 100) });
|
|
2142
2156
|
}
|
|
2143
2157
|
const _ = [], h = Array.from(
|
|
2144
2158
|
r.querySelectorAll(
|
|
@@ -2146,81 +2160,110 @@ function Xr(e, t = {}) {
|
|
|
2146
2160
|
)
|
|
2147
2161
|
);
|
|
2148
2162
|
for (const g of h) {
|
|
2149
|
-
if (_.length >=
|
|
2150
|
-
if (
|
|
2151
|
-
const P = mn(g),
|
|
2152
|
-
P && _.push({ label:
|
|
2163
|
+
if (_.length >= jr) break;
|
|
2164
|
+
if (ut(g) || !Mt(g) || !dt(g)) continue;
|
|
2165
|
+
const P = mn(g), O = g instanceof HTMLInputElement ? g.type : g.tagName.toLowerCase();
|
|
2166
|
+
P && _.push({ label: re(P, 100), type: O });
|
|
2153
2167
|
}
|
|
2154
|
-
const b = Array.from(r.querySelectorAll("form")),
|
|
2155
|
-
let
|
|
2168
|
+
const b = Array.from(r.querySelectorAll("form")), N = [];
|
|
2169
|
+
let M = 0;
|
|
2156
2170
|
for (const g of b) {
|
|
2157
|
-
if (
|
|
2171
|
+
if (N.length >= Yr) break;
|
|
2158
2172
|
if ($t(g) || g.matches(".ll-widget *, .ll-widget")) continue;
|
|
2159
|
-
const P = g.getAttribute("id") || g.getAttribute("name") ||
|
|
2173
|
+
const P = g.getAttribute("id") || g.getAttribute("name") || Xr(g.getAttribute("data-ll-intent")) || `form_${M++}`, O = g.getAttribute("data-ll-intent") || Qr(g) || void 0, q = Array.from(
|
|
2160
2174
|
g.querySelectorAll(
|
|
2161
|
-
"input
|
|
2175
|
+
"input, textarea, select"
|
|
2162
2176
|
)
|
|
2163
|
-
),
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
if (
|
|
2168
|
-
|
|
2169
|
-
|
|
2177
|
+
), ne = [];
|
|
2178
|
+
let B = 0;
|
|
2179
|
+
const j = /* @__PURE__ */ new Set();
|
|
2180
|
+
for (const E of q) {
|
|
2181
|
+
if (ne.length >= Gr) break;
|
|
2182
|
+
if (!Mt(E)) continue;
|
|
2183
|
+
if (E instanceof HTMLInputElement) {
|
|
2184
|
+
const W = E.type;
|
|
2185
|
+
if (W === "submit" || W === "button" || W === "reset" || W === "hidden" || W === "image" || W === "file") continue;
|
|
2170
2186
|
}
|
|
2171
|
-
const
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2187
|
+
const Z = E.getAttribute("name") || "", _e = E.getAttribute("id") || "";
|
|
2188
|
+
let ce = Z || _e || `field_${B}`;
|
|
2189
|
+
j.has(ce) && (ce = `${ce}__${B}`), j.add(ce), B++;
|
|
2190
|
+
const ze = mn(E) || ce, He = E instanceof HTMLInputElement ? E.type : E.tagName.toLowerCase(), Q = {
|
|
2191
|
+
name: ce,
|
|
2192
|
+
label: re(ze, 100),
|
|
2193
|
+
type: He
|
|
2177
2194
|
};
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
const
|
|
2184
|
-
!
|
|
2195
|
+
E.required === !0 && (Q.required = !0);
|
|
2196
|
+
const Se = E.getAttribute("placeholder");
|
|
2197
|
+
if (Se && (Q.placeholder = re(Se.trim(), 100)), E instanceof HTMLInputElement || E instanceof HTMLTextAreaElement) {
|
|
2198
|
+
const W = E.getAttribute("minlength");
|
|
2199
|
+
if (W !== null) {
|
|
2200
|
+
const Y = parseInt(W, 10);
|
|
2201
|
+
!Number.isNaN(Y) && Y >= 0 && (Q.minLength = Y);
|
|
2202
|
+
}
|
|
2203
|
+
const ie = E.getAttribute("maxlength");
|
|
2204
|
+
if (ie !== null) {
|
|
2205
|
+
const Y = parseInt(ie, 10);
|
|
2206
|
+
!Number.isNaN(Y) && Y >= 0 && (Q.maxLength = Y);
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
if (E instanceof HTMLInputElement) {
|
|
2210
|
+
const W = E.getAttribute("min");
|
|
2211
|
+
W !== null && (Q.min = re(W, 50));
|
|
2212
|
+
const ie = E.getAttribute("max");
|
|
2213
|
+
ie !== null && (Q.max = re(ie, 50));
|
|
2214
|
+
const Y = E.getAttribute("step");
|
|
2215
|
+
Y !== null && (Q.step = re(Y, 20));
|
|
2216
|
+
const fe = E.getAttribute("pattern");
|
|
2217
|
+
fe !== null && (Q.pattern = re(fe, 200));
|
|
2218
|
+
const K = (E.getAttribute("autocomplete") || "").toLowerCase();
|
|
2219
|
+
K && K !== "off" && !K.startsWith("cc-") && (Q.autocomplete = re(K, 50));
|
|
2220
|
+
}
|
|
2221
|
+
if (E instanceof HTMLSelectElement) {
|
|
2222
|
+
const W = [];
|
|
2223
|
+
for (let ie = 0; ie < E.options.length && !(W.length >= Kr); ie++) {
|
|
2224
|
+
const Y = E.options[ie];
|
|
2225
|
+
if (!Y || Y.disabled) continue;
|
|
2226
|
+
const fe = Y.value || "", K = (Y.textContent || "").trim() || fe;
|
|
2227
|
+
!fe && !K || W.push({ value: fe, label: re(K, 60) });
|
|
2185
2228
|
}
|
|
2186
|
-
|
|
2229
|
+
W.length > 0 && (Q.options = W);
|
|
2187
2230
|
}
|
|
2188
|
-
const
|
|
2189
|
-
|
|
2231
|
+
const xe = typeof E.validationMessage == "string" ? E.validationMessage : "";
|
|
2232
|
+
xe && (Q.validationMessage = re(xe, 200)), ne.push(Q);
|
|
2190
2233
|
}
|
|
2191
|
-
|
|
2234
|
+
N.push({ id: P, intent: O, fields: ne });
|
|
2192
2235
|
}
|
|
2193
|
-
const
|
|
2194
|
-
url:
|
|
2195
|
-
title:
|
|
2196
|
-
pathname:
|
|
2197
|
-
regions:
|
|
2198
|
-
visibleText:
|
|
2236
|
+
const I = {
|
|
2237
|
+
url: i,
|
|
2238
|
+
title: o,
|
|
2239
|
+
pathname: a,
|
|
2240
|
+
regions: l,
|
|
2241
|
+
visibleText: d,
|
|
2199
2242
|
visibleLinks: R,
|
|
2200
2243
|
visibleFields: _,
|
|
2201
|
-
forms:
|
|
2244
|
+
forms: N,
|
|
2202
2245
|
extras: e
|
|
2203
2246
|
};
|
|
2204
|
-
let
|
|
2205
|
-
for (;
|
|
2206
|
-
|
|
2207
|
-
for (;
|
|
2208
|
-
|
|
2209
|
-
return
|
|
2210
|
-
}
|
|
2211
|
-
let
|
|
2247
|
+
let U = Ge(JSON.stringify(I.regions)) + Ge(I.visibleText) + Ge(JSON.stringify(I.visibleLinks)) + Ge(JSON.stringify(I.visibleFields));
|
|
2248
|
+
for (; U > wt && I.visibleFields.length > 0; )
|
|
2249
|
+
I.visibleFields.pop(), U = Ge(JSON.stringify(I.visibleFields));
|
|
2250
|
+
for (; U > wt && I.visibleLinks.length > 0; )
|
|
2251
|
+
I.visibleLinks.pop(), U -= 80;
|
|
2252
|
+
return Ge(I.visibleText) > wt && (I.visibleText = re(I.visibleText, wt - 100)), I;
|
|
2253
|
+
}
|
|
2254
|
+
let Ke = null;
|
|
2212
2255
|
function gn(e, t = {}) {
|
|
2213
|
-
const r = Date.now(),
|
|
2214
|
-
if (
|
|
2215
|
-
return
|
|
2216
|
-
const
|
|
2217
|
-
return
|
|
2256
|
+
const r = Date.now(), a = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
|
|
2257
|
+
if (Ke && Ke.key === a && r - Ke.at < 1e3)
|
|
2258
|
+
return Ke.ctx;
|
|
2259
|
+
const o = Zr(e, t);
|
|
2260
|
+
return Ke = { key: a, at: r, ctx: o }, o;
|
|
2218
2261
|
}
|
|
2219
|
-
function
|
|
2220
|
-
|
|
2262
|
+
function ei() {
|
|
2263
|
+
Ke = null;
|
|
2221
2264
|
}
|
|
2222
|
-
const
|
|
2223
|
-
function
|
|
2265
|
+
const ti = 200;
|
|
2266
|
+
function ni(e) {
|
|
2224
2267
|
const t = String(e.href || "");
|
|
2225
2268
|
return {
|
|
2226
2269
|
href: t,
|
|
@@ -2230,63 +2273,101 @@ function eo(e) {
|
|
|
2230
2273
|
description: e.description
|
|
2231
2274
|
};
|
|
2232
2275
|
}
|
|
2233
|
-
function
|
|
2276
|
+
function ri(e) {
|
|
2234
2277
|
return !(!e || e.startsWith("#") || e.startsWith("javascript:") || e.startsWith("mailto:") || e.startsWith("tel:"));
|
|
2235
2278
|
}
|
|
2236
|
-
function
|
|
2279
|
+
function ii(e) {
|
|
2237
2280
|
const t = e ?? (typeof document < "u" ? document : null);
|
|
2238
2281
|
if (!t) return [];
|
|
2239
|
-
const r = typeof window < "u" && window.location.origin || "",
|
|
2240
|
-
for (const s of
|
|
2241
|
-
if (
|
|
2282
|
+
const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), a = [], o = Array.from(t.querySelectorAll("a[href]"));
|
|
2283
|
+
for (const s of o) {
|
|
2284
|
+
if (a.length >= ti) break;
|
|
2242
2285
|
if ($t(s)) continue;
|
|
2243
|
-
const
|
|
2244
|
-
if (!
|
|
2245
|
-
let c =
|
|
2286
|
+
const l = s.getAttribute("href") || "";
|
|
2287
|
+
if (!ri(l)) continue;
|
|
2288
|
+
let c = l, p = !0;
|
|
2246
2289
|
try {
|
|
2247
2290
|
if (typeof window < "u") {
|
|
2248
|
-
const f = new URL(
|
|
2249
|
-
p = f.origin === r, p &&
|
|
2291
|
+
const f = new URL(l, r);
|
|
2292
|
+
p = f.origin === r, p && l.startsWith("http") && (c = f.pathname + f.search + f.hash);
|
|
2250
2293
|
}
|
|
2251
2294
|
} catch {
|
|
2252
2295
|
continue;
|
|
2253
2296
|
}
|
|
2254
|
-
if (
|
|
2255
|
-
|
|
2297
|
+
if (i.has(c)) continue;
|
|
2298
|
+
i.add(c);
|
|
2256
2299
|
const v = (s.textContent || "").trim().slice(0, 120);
|
|
2257
|
-
|
|
2300
|
+
a.push({ href: c, text: v, internal: p });
|
|
2258
2301
|
}
|
|
2259
|
-
return
|
|
2302
|
+
return a;
|
|
2260
2303
|
}
|
|
2261
|
-
let
|
|
2262
|
-
const
|
|
2263
|
-
function
|
|
2304
|
+
let Je = null;
|
|
2305
|
+
const oi = 5e3;
|
|
2306
|
+
function Rt() {
|
|
2264
2307
|
const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
|
|
2265
|
-
if (
|
|
2266
|
-
return
|
|
2267
|
-
const r =
|
|
2268
|
-
return
|
|
2308
|
+
if (Je && Je.pathname === t && e - Je.at < oi)
|
|
2309
|
+
return Je.routes;
|
|
2310
|
+
const r = ii();
|
|
2311
|
+
return Je = { at: e, pathname: t, routes: r }, r;
|
|
2269
2312
|
}
|
|
2270
|
-
function
|
|
2271
|
-
|
|
2313
|
+
function li() {
|
|
2314
|
+
Je = null;
|
|
2272
2315
|
}
|
|
2273
|
-
function
|
|
2274
|
-
|
|
2275
|
-
|
|
2316
|
+
function yn(e) {
|
|
2317
|
+
if (e instanceof HTMLInputElement) {
|
|
2318
|
+
const t = e.type;
|
|
2319
|
+
if (t === "submit" || t === "button" || t === "reset" || t === "hidden" || t === "image" || t === "file")
|
|
2320
|
+
return !1;
|
|
2321
|
+
}
|
|
2322
|
+
return !0;
|
|
2323
|
+
}
|
|
2324
|
+
function ai(e, t) {
|
|
2325
|
+
return e.getAttribute("name") || e.getAttribute("id") || `field_${t}`;
|
|
2326
|
+
}
|
|
2327
|
+
function si(e, t) {
|
|
2328
|
+
if (!t) return null;
|
|
2329
|
+
try {
|
|
2330
|
+
const o = e.querySelector(
|
|
2331
|
+
`[name="${t.replace(/"/g, '\\"')}"]`
|
|
2332
|
+
);
|
|
2333
|
+
if (o && yn(o)) return o;
|
|
2334
|
+
} catch {
|
|
2335
|
+
}
|
|
2336
|
+
const r = Array.from(
|
|
2337
|
+
e.querySelectorAll("input, textarea, select")
|
|
2338
|
+
);
|
|
2339
|
+
let i = 0;
|
|
2340
|
+
const a = /* @__PURE__ */ new Map();
|
|
2341
|
+
for (const o of r) {
|
|
2342
|
+
if (!yn(o)) continue;
|
|
2343
|
+
const s = ai(o, i);
|
|
2344
|
+
let l = s;
|
|
2345
|
+
if (a.has(s) && (l = `${s}__${i}`), l === t) return o;
|
|
2346
|
+
a.set(s, o), i++;
|
|
2347
|
+
}
|
|
2348
|
+
return null;
|
|
2349
|
+
}
|
|
2350
|
+
function vn(e, t) {
|
|
2351
|
+
const r = si(e, t);
|
|
2352
|
+
return r ? Mt(r) ? { el: r } : { el: null, reason: "private" } : { el: null, reason: "not_found" };
|
|
2353
|
+
}
|
|
2354
|
+
function ci(e, t) {
|
|
2355
|
+
const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, i = Object.getOwnPropertyDescriptor(r, "value"), a = i == null ? void 0 : i.set;
|
|
2356
|
+
a ? a.call(e, t) : e.value = t;
|
|
2276
2357
|
}
|
|
2277
|
-
function
|
|
2278
|
-
const
|
|
2358
|
+
function ui(e, t, r = {}) {
|
|
2359
|
+
const i = r.triggerInput ?? !0, a = r.triggerChange ?? !0;
|
|
2279
2360
|
if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
|
|
2280
|
-
const
|
|
2361
|
+
const o = Object.getOwnPropertyDescriptor(
|
|
2281
2362
|
HTMLInputElement.prototype,
|
|
2282
2363
|
"checked"
|
|
2283
|
-
), s =
|
|
2284
|
-
s ? s.call(e,
|
|
2364
|
+
), s = o == null ? void 0 : o.set, l = t === "true" || t === "1" || t === "on";
|
|
2365
|
+
s ? s.call(e, l) : e.checked = l, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), a && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
2285
2366
|
return;
|
|
2286
2367
|
}
|
|
2287
|
-
|
|
2368
|
+
ci(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), a && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
2288
2369
|
}
|
|
2289
|
-
function
|
|
2370
|
+
function bn(e, t) {
|
|
2290
2371
|
if (!t) return null;
|
|
2291
2372
|
const r = t.replace(/"/g, '\\"');
|
|
2292
2373
|
try {
|
|
@@ -2296,34 +2377,34 @@ function yn(e, t) {
|
|
|
2296
2377
|
if (s) return s;
|
|
2297
2378
|
} catch {
|
|
2298
2379
|
}
|
|
2299
|
-
const
|
|
2380
|
+
const i = e.querySelector(
|
|
2300
2381
|
`form[name="${r}"]`
|
|
2301
2382
|
);
|
|
2302
|
-
if (
|
|
2303
|
-
const
|
|
2383
|
+
if (i) return i;
|
|
2384
|
+
const a = e.querySelector(
|
|
2304
2385
|
`form[data-ll-intent="${r}"]`
|
|
2305
2386
|
);
|
|
2306
|
-
if (
|
|
2307
|
-
const
|
|
2308
|
-
for (const s of
|
|
2309
|
-
const
|
|
2310
|
-
if (
|
|
2387
|
+
if (a) return a;
|
|
2388
|
+
const o = Array.from(e.querySelectorAll("form"));
|
|
2389
|
+
for (const s of o) {
|
|
2390
|
+
const l = s.getAttribute("data-ll-intent");
|
|
2391
|
+
if (l && di(l) === t) return s;
|
|
2311
2392
|
}
|
|
2312
2393
|
if (/^form_\d+$/.test(t)) {
|
|
2313
2394
|
const s = parseInt(t.slice(5), 10);
|
|
2314
|
-
let
|
|
2315
|
-
for (const c of
|
|
2395
|
+
let l = 0;
|
|
2396
|
+
for (const c of o)
|
|
2316
2397
|
if (!(c.id || c.getAttribute("name") || c.getAttribute("data-ll-intent"))) {
|
|
2317
|
-
if (
|
|
2318
|
-
|
|
2398
|
+
if (l === s) return c;
|
|
2399
|
+
l++;
|
|
2319
2400
|
}
|
|
2320
2401
|
}
|
|
2321
2402
|
return null;
|
|
2322
2403
|
}
|
|
2323
|
-
function
|
|
2404
|
+
function di(e) {
|
|
2324
2405
|
return e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || null;
|
|
2325
2406
|
}
|
|
2326
|
-
function
|
|
2407
|
+
function fi() {
|
|
2327
2408
|
if (typeof window > "u" || typeof document > "u")
|
|
2328
2409
|
return !1;
|
|
2329
2410
|
const e = document.scrollingElement || document.documentElement;
|
|
@@ -2331,44 +2412,44 @@ function so() {
|
|
|
2331
2412
|
const t = window.getComputedStyle(e);
|
|
2332
2413
|
return !(t.overflowY === "hidden" || t.overflowY === "clip");
|
|
2333
2414
|
}
|
|
2334
|
-
function
|
|
2415
|
+
function pi(e) {
|
|
2335
2416
|
if (!(e instanceof HTMLElement)) return !1;
|
|
2336
2417
|
const r = window.getComputedStyle(e).overflowY;
|
|
2337
2418
|
return !(r !== "auto" && r !== "scroll" || e.scrollHeight <= e.clientHeight + 2);
|
|
2338
2419
|
}
|
|
2339
|
-
function
|
|
2420
|
+
function hi() {
|
|
2340
2421
|
if (typeof document > "u") return null;
|
|
2341
2422
|
const e = Array.from(
|
|
2342
2423
|
document.querySelectorAll("body, body *")
|
|
2343
2424
|
);
|
|
2344
2425
|
let t = null, r = 0;
|
|
2345
|
-
for (const
|
|
2346
|
-
if (!
|
|
2347
|
-
const
|
|
2348
|
-
if (
|
|
2349
|
-
const
|
|
2350
|
-
|
|
2426
|
+
for (const i of e) {
|
|
2427
|
+
if (!pi(i)) continue;
|
|
2428
|
+
const a = i.getBoundingClientRect();
|
|
2429
|
+
if (a.bottom <= 0 || a.top >= window.innerHeight || a.right <= 0 || a.left >= window.innerWidth || a.width <= 0 || a.height <= 0 || i.closest(".ll-widget")) continue;
|
|
2430
|
+
const o = a.width * a.height;
|
|
2431
|
+
o > r && (r = o, t = i);
|
|
2351
2432
|
}
|
|
2352
2433
|
return t;
|
|
2353
2434
|
}
|
|
2354
|
-
function
|
|
2435
|
+
function mi() {
|
|
2355
2436
|
if (typeof window > "u")
|
|
2356
2437
|
return null;
|
|
2357
|
-
if (
|
|
2358
|
-
const e =
|
|
2438
|
+
if (fi()) return window;
|
|
2439
|
+
const e = hi();
|
|
2359
2440
|
return e || window;
|
|
2360
2441
|
}
|
|
2361
|
-
function
|
|
2442
|
+
function wn(e) {
|
|
2362
2443
|
return e instanceof Window ? e.innerHeight || 0 : e.clientHeight || 0;
|
|
2363
2444
|
}
|
|
2364
|
-
function
|
|
2445
|
+
function gi(e) {
|
|
2365
2446
|
var t, r;
|
|
2366
2447
|
return e instanceof Window ? typeof document > "u" ? 0 : Math.max(
|
|
2367
2448
|
((t = document.body) == null ? void 0 : t.scrollHeight) ?? 0,
|
|
2368
2449
|
((r = document.documentElement) == null ? void 0 : r.scrollHeight) ?? 0
|
|
2369
2450
|
) : e.scrollHeight - e.clientHeight;
|
|
2370
2451
|
}
|
|
2371
|
-
const
|
|
2452
|
+
const yi = /* @__PURE__ */ new Set([
|
|
2372
2453
|
"agent_state",
|
|
2373
2454
|
"avatar_stream_ready",
|
|
2374
2455
|
"avatar_active",
|
|
@@ -2398,107 +2479,107 @@ const ho = /* @__PURE__ */ new Set([
|
|
|
2398
2479
|
// to onAgentCommand.
|
|
2399
2480
|
"task_field_updated",
|
|
2400
2481
|
"task_completed"
|
|
2401
|
-
]),
|
|
2482
|
+
]), In = Dt(
|
|
2402
2483
|
function(t, r) {
|
|
2403
|
-
var Yt, Gt,
|
|
2484
|
+
var Yt, Gt, Kt, Jt, Xt, Qt, Zt;
|
|
2404
2485
|
const {
|
|
2405
|
-
agentId:
|
|
2406
|
-
apiKey:
|
|
2407
|
-
baseUrl:
|
|
2486
|
+
agentId: i,
|
|
2487
|
+
apiKey: a,
|
|
2488
|
+
baseUrl: o = "https://app.livelayer.studio",
|
|
2408
2489
|
sessionEndpoint: s,
|
|
2409
|
-
sessionBody:
|
|
2490
|
+
sessionBody: l,
|
|
2410
2491
|
soundEffects: c,
|
|
2411
2492
|
experienceMode: p = "WIDGET",
|
|
2412
2493
|
autoConnect: v = !1,
|
|
2413
2494
|
displayMode: f,
|
|
2414
|
-
defaultDisplayMode:
|
|
2495
|
+
defaultDisplayMode: d = "expanded",
|
|
2415
2496
|
onDisplayModeChange: R,
|
|
2416
2497
|
position: L = "bottom-right",
|
|
2417
2498
|
mobileBreakpoint: _ = 640,
|
|
2418
2499
|
persistKey: h = "ll-widget",
|
|
2419
2500
|
disablePersistence: b = !1,
|
|
2420
|
-
teamMembers:
|
|
2421
|
-
currentTeamMemberId:
|
|
2422
|
-
onTeamMemberChange:
|
|
2423
|
-
idleLoopUrl:
|
|
2501
|
+
teamMembers: N,
|
|
2502
|
+
currentTeamMemberId: M,
|
|
2503
|
+
onTeamMemberChange: I,
|
|
2504
|
+
idleLoopUrl: U,
|
|
2424
2505
|
greeting: g,
|
|
2425
2506
|
avatarImageUrl: P,
|
|
2426
|
-
agentName:
|
|
2507
|
+
agentName: O,
|
|
2427
2508
|
branding: q = {},
|
|
2428
|
-
allowCamera:
|
|
2429
|
-
allowScreenShare:
|
|
2430
|
-
allowTyping:
|
|
2431
|
-
showMinimize:
|
|
2432
|
-
showClose:
|
|
2433
|
-
chromeless:
|
|
2434
|
-
floatingChromeContainer:
|
|
2435
|
-
compactControls:
|
|
2436
|
-
transforming:
|
|
2437
|
-
transformingLabel:
|
|
2438
|
-
showOn:
|
|
2439
|
-
hideOn:
|
|
2440
|
-
pathname:
|
|
2441
|
-
onNavigate:
|
|
2442
|
-
onScrollToSelector:
|
|
2443
|
-
getPageContext:
|
|
2444
|
-
pageContextExtras:
|
|
2445
|
-
getRoutes:
|
|
2446
|
-
onScrollPage:
|
|
2509
|
+
allowCamera: ne = !0,
|
|
2510
|
+
allowScreenShare: B = !0,
|
|
2511
|
+
allowTyping: j = !0,
|
|
2512
|
+
showMinimize: E,
|
|
2513
|
+
showClose: Z,
|
|
2514
|
+
chromeless: _e = !1,
|
|
2515
|
+
floatingChromeContainer: ce = null,
|
|
2516
|
+
compactControls: ze = !1,
|
|
2517
|
+
transforming: He = !1,
|
|
2518
|
+
transformingLabel: Q = "Transforming…",
|
|
2519
|
+
showOn: Se,
|
|
2520
|
+
hideOn: xe,
|
|
2521
|
+
pathname: W,
|
|
2522
|
+
onNavigate: ie,
|
|
2523
|
+
onScrollToSelector: Y,
|
|
2524
|
+
getPageContext: fe,
|
|
2525
|
+
pageContextExtras: K,
|
|
2526
|
+
getRoutes: Qe,
|
|
2527
|
+
onScrollPage: Ze,
|
|
2447
2528
|
onClick: ft,
|
|
2448
|
-
capabilities:
|
|
2449
|
-
onConnect:
|
|
2450
|
-
onDisconnect:
|
|
2451
|
-
onTranscript:
|
|
2452
|
-
onAgentState:
|
|
2453
|
-
onConnectionStateChange:
|
|
2529
|
+
capabilities: et,
|
|
2530
|
+
onConnect: Ne,
|
|
2531
|
+
onDisconnect: Oe,
|
|
2532
|
+
onTranscript: Ae,
|
|
2533
|
+
onAgentState: Be,
|
|
2534
|
+
onConnectionStateChange: Ie,
|
|
2454
2535
|
onAgentEvent: Re,
|
|
2455
|
-
onAgentCommand:
|
|
2536
|
+
onAgentCommand: Te,
|
|
2456
2537
|
onCollect: Me,
|
|
2457
2538
|
controlledSession: $,
|
|
2458
|
-
className:
|
|
2459
|
-
style:
|
|
2460
|
-
zIndex:
|
|
2461
|
-
} = t,
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
}, [
|
|
2465
|
-
const
|
|
2539
|
+
className: xt,
|
|
2540
|
+
style: De,
|
|
2541
|
+
zIndex: We = 2147483647
|
|
2542
|
+
} = t, pe = yr(W), tt = Lr(pe, Se, xe);
|
|
2543
|
+
T(() => {
|
|
2544
|
+
ei(), li();
|
|
2545
|
+
}, [pe]);
|
|
2546
|
+
const Pe = M !== void 0, [Fe, kt] = S(() => {
|
|
2466
2547
|
var y;
|
|
2467
|
-
return
|
|
2468
|
-
}), Le =
|
|
2469
|
-
() => (
|
|
2470
|
-
[
|
|
2471
|
-
),
|
|
2548
|
+
return M ?? ((y = N == null ? void 0 : N[0]) == null ? void 0 : y.id);
|
|
2549
|
+
}), Le = Pe ? M : Fe, oe = Xe(
|
|
2550
|
+
() => (N == null ? void 0 : N.find((y) => y.id === Le)) ?? null,
|
|
2551
|
+
[N, Le]
|
|
2552
|
+
), nt = (oe == null ? void 0 : oe.agentId) ?? i, me = p === "EMBEDDED", [qe, Ue] = pr({
|
|
2472
2553
|
value: f,
|
|
2473
|
-
defaultValue:
|
|
2554
|
+
defaultValue: d,
|
|
2474
2555
|
onChange: R,
|
|
2475
2556
|
persistKey: h,
|
|
2476
|
-
disablePersistence:
|
|
2477
|
-
}),
|
|
2478
|
-
} :
|
|
2557
|
+
disablePersistence: me || b
|
|
2558
|
+
}), le = me ? "expanded" : qe, ue = me ? () => {
|
|
2559
|
+
} : Ue, pt = E ?? !me, ht = Z ?? !me, Ee = mr(_), rt = tr(), se = nr(), de = ir(), Ce = or(), it = lr(), [Lt, ge] = S(!1), [ye, ot] = S(!1), [je, lt] = S(!1), [mt, m] = S(!1), [J, Rn] = S(!1), gt = Cr({ baseUrl: o, config: c }), yt = A(gt);
|
|
2479
2560
|
yt.current = gt;
|
|
2480
|
-
const Et =
|
|
2481
|
-
Et.current =
|
|
2482
|
-
function
|
|
2483
|
-
const
|
|
2484
|
-
return
|
|
2561
|
+
const Et = A(ie), Ct = A(Y), St = A(Ze), Nt = A(ft), zt = A(fe), Ht = A(K), Ot = A(Qe), At = A(et), ve = A(null);
|
|
2562
|
+
Et.current = ie, Ct.current = Y, St.current = Ze, Nt.current = ft, zt.current = fe, Ht.current = K, Ot.current = Qe, At.current = et;
|
|
2563
|
+
function be(y) {
|
|
2564
|
+
const u = At.current;
|
|
2565
|
+
return u ? u.includes(y) : !0;
|
|
2485
2566
|
}
|
|
2486
|
-
function
|
|
2567
|
+
function we(y, u) {
|
|
2487
2568
|
console.warn(
|
|
2488
|
-
`[LiveLayer] Agent command "${y}" blocked — capability "${
|
|
2569
|
+
`[LiveLayer] Agent command "${y}" blocked — capability "${u}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
|
|
2489
2570
|
);
|
|
2490
2571
|
}
|
|
2491
|
-
const
|
|
2572
|
+
const at = C(
|
|
2492
2573
|
(y) => {
|
|
2493
|
-
var
|
|
2494
|
-
const
|
|
2495
|
-
if (!(!
|
|
2496
|
-
if (Re == null || Re({ eventName:
|
|
2497
|
-
if (!
|
|
2498
|
-
|
|
2574
|
+
var X, he, ke, ct;
|
|
2575
|
+
const u = y;
|
|
2576
|
+
if (!(!u.type || typeof u.type != "string")) {
|
|
2577
|
+
if (Re == null || Re({ eventName: u.type, data: y }), u.type === "navigate") {
|
|
2578
|
+
if (!be("navigate")) {
|
|
2579
|
+
we("navigate", "navigate");
|
|
2499
2580
|
return;
|
|
2500
2581
|
}
|
|
2501
|
-
const x = typeof
|
|
2582
|
+
const x = typeof u.href == "string" ? u.href : null;
|
|
2502
2583
|
if (!x) {
|
|
2503
2584
|
console.warn(
|
|
2504
2585
|
`[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
|
|
@@ -2536,112 +2617,112 @@ const ho = /* @__PURE__ */ new Set([
|
|
|
2536
2617
|
}
|
|
2537
2618
|
return;
|
|
2538
2619
|
}
|
|
2539
|
-
if (
|
|
2540
|
-
if (!
|
|
2541
|
-
|
|
2620
|
+
if (u.type === "scroll_to") {
|
|
2621
|
+
if (!be("scroll")) {
|
|
2622
|
+
we("scroll_to", "scroll");
|
|
2542
2623
|
return;
|
|
2543
2624
|
}
|
|
2544
|
-
const x = typeof
|
|
2625
|
+
const x = typeof u.selector == "string" ? u.selector : null;
|
|
2545
2626
|
if (!x) return;
|
|
2546
|
-
const D =
|
|
2547
|
-
if (
|
|
2627
|
+
const D = u.behavior === "instant" ? "instant" : "smooth";
|
|
2628
|
+
if (Ct.current) {
|
|
2548
2629
|
try {
|
|
2549
|
-
|
|
2630
|
+
Ct.current(
|
|
2550
2631
|
x,
|
|
2551
2632
|
D
|
|
2552
2633
|
);
|
|
2553
|
-
} catch (
|
|
2554
|
-
console.warn("[LiveLayer] onScrollToSelector threw.",
|
|
2634
|
+
} catch (F) {
|
|
2635
|
+
console.warn("[LiveLayer] onScrollToSelector threw.", F);
|
|
2555
2636
|
}
|
|
2556
2637
|
return;
|
|
2557
2638
|
}
|
|
2558
2639
|
if (typeof document < "u") {
|
|
2559
|
-
let
|
|
2640
|
+
let F = null;
|
|
2560
2641
|
try {
|
|
2561
|
-
|
|
2642
|
+
F = document.querySelector(x);
|
|
2562
2643
|
} catch {
|
|
2563
2644
|
console.warn(
|
|
2564
2645
|
`[LiveLayer] scroll_to: invalid selector "${x}".`
|
|
2565
2646
|
);
|
|
2566
2647
|
return;
|
|
2567
2648
|
}
|
|
2568
|
-
if (!
|
|
2649
|
+
if (!F) {
|
|
2569
2650
|
console.warn(
|
|
2570
2651
|
`[LiveLayer] scroll_to: no element matched "${x}". The user may be on a different page. See https://livelayer.studio/docs/errors/scroll-no-match`
|
|
2571
2652
|
);
|
|
2572
2653
|
return;
|
|
2573
2654
|
}
|
|
2574
|
-
|
|
2655
|
+
F.scrollIntoView({
|
|
2575
2656
|
behavior: D,
|
|
2576
2657
|
block: "start"
|
|
2577
2658
|
});
|
|
2578
2659
|
}
|
|
2579
2660
|
return;
|
|
2580
2661
|
}
|
|
2581
|
-
if (
|
|
2582
|
-
if (!
|
|
2583
|
-
|
|
2662
|
+
if (u.type === "request_page_context") {
|
|
2663
|
+
if (!be("read_page")) {
|
|
2664
|
+
we("request_page_context", "read_page");
|
|
2584
2665
|
return;
|
|
2585
2666
|
}
|
|
2586
|
-
const x = typeof
|
|
2587
|
-
const z = D,
|
|
2588
|
-
if (
|
|
2667
|
+
const x = typeof u.requestId == "string" ? u.requestId : void 0, D = (X = ve.current) == null ? void 0 : X.call(ve), F = (G) => {
|
|
2668
|
+
const z = D, te = z == null ? void 0 : z.localParticipant;
|
|
2669
|
+
if (te != null && te.publishData)
|
|
2589
2670
|
try {
|
|
2590
|
-
const
|
|
2591
|
-
|
|
2592
|
-
} catch (
|
|
2593
|
-
console.warn("[LiveLayer] publishData failed.",
|
|
2671
|
+
const ae = x ? { ...G, requestId: x } : G, Ye = new TextEncoder().encode(JSON.stringify(ae));
|
|
2672
|
+
te.publishData(Ye, { reliable: !0 });
|
|
2673
|
+
} catch (ae) {
|
|
2674
|
+
console.warn("[LiveLayer] publishData failed.", ae);
|
|
2594
2675
|
}
|
|
2595
|
-
},
|
|
2676
|
+
}, H = Ht.current, V = zt.current;
|
|
2596
2677
|
try {
|
|
2597
|
-
if (
|
|
2598
|
-
const
|
|
2599
|
-
if (
|
|
2600
|
-
|
|
2678
|
+
if (V) {
|
|
2679
|
+
const G = V(H);
|
|
2680
|
+
if (G instanceof Promise) {
|
|
2681
|
+
F({ type: "page_context_pending" }), G.then((z) => F({ type: "page_context", context: z })).catch((z) => {
|
|
2601
2682
|
console.warn(
|
|
2602
2683
|
"[LiveLayer] getPageContext rejected; falling back to default walker.",
|
|
2603
2684
|
z
|
|
2604
|
-
),
|
|
2685
|
+
), F({
|
|
2605
2686
|
type: "page_context",
|
|
2606
|
-
context: gn(
|
|
2687
|
+
context: gn(H)
|
|
2607
2688
|
});
|
|
2608
2689
|
});
|
|
2609
2690
|
return;
|
|
2610
2691
|
}
|
|
2611
|
-
|
|
2692
|
+
F({ type: "page_context", context: G });
|
|
2612
2693
|
return;
|
|
2613
2694
|
}
|
|
2614
|
-
|
|
2695
|
+
F({
|
|
2615
2696
|
type: "page_context",
|
|
2616
|
-
context: gn(
|
|
2697
|
+
context: gn(H)
|
|
2617
2698
|
});
|
|
2618
|
-
} catch (
|
|
2699
|
+
} catch (G) {
|
|
2619
2700
|
console.warn(
|
|
2620
2701
|
"[LiveLayer] page-context extraction threw. Sending empty context.",
|
|
2621
|
-
|
|
2622
|
-
),
|
|
2702
|
+
G
|
|
2703
|
+
), F({
|
|
2623
2704
|
type: "page_context",
|
|
2624
|
-
context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras:
|
|
2705
|
+
context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: H }
|
|
2625
2706
|
});
|
|
2626
2707
|
}
|
|
2627
2708
|
return;
|
|
2628
2709
|
}
|
|
2629
|
-
if (
|
|
2630
|
-
if (!
|
|
2631
|
-
|
|
2710
|
+
if (u.type === "scroll_page") {
|
|
2711
|
+
if (!be("scroll")) {
|
|
2712
|
+
we("scroll_page", "scroll");
|
|
2632
2713
|
return;
|
|
2633
2714
|
}
|
|
2634
|
-
const x =
|
|
2715
|
+
const x = u.direction;
|
|
2635
2716
|
if (x !== "up" && x !== "down" && x !== "top" && x !== "bottom") {
|
|
2636
2717
|
console.warn(
|
|
2637
2718
|
`[LiveLayer] scroll_page: invalid direction "${String(x)}". Expected up | down | top | bottom.`
|
|
2638
2719
|
);
|
|
2639
2720
|
return;
|
|
2640
2721
|
}
|
|
2641
|
-
const D =
|
|
2642
|
-
if (
|
|
2722
|
+
const D = u.behavior === "instant" ? "instant" : "smooth";
|
|
2723
|
+
if (St.current) {
|
|
2643
2724
|
try {
|
|
2644
|
-
|
|
2725
|
+
St.current(
|
|
2645
2726
|
x,
|
|
2646
2727
|
D
|
|
2647
2728
|
);
|
|
@@ -2651,29 +2732,29 @@ const ho = /* @__PURE__ */ new Set([
|
|
|
2651
2732
|
return;
|
|
2652
2733
|
}
|
|
2653
2734
|
if (typeof window > "u") return;
|
|
2654
|
-
const
|
|
2655
|
-
|
|
2656
|
-
},
|
|
2657
|
-
|
|
2735
|
+
const F = { behavior: D }, H = mi(), V = (z) => {
|
|
2736
|
+
H instanceof Window ? H.scrollBy({ top: z, ...F }) : H.scrollBy({ top: z, ...F });
|
|
2737
|
+
}, G = (z) => {
|
|
2738
|
+
H instanceof Window ? H.scrollTo({ top: z, ...F }) : H.scrollTo({ top: z, ...F });
|
|
2658
2739
|
};
|
|
2659
|
-
x === "up" ?
|
|
2740
|
+
x === "up" ? V(-wn(H)) : x === "down" ? V(wn(H)) : G(x === "top" ? 0 : gi(H));
|
|
2660
2741
|
return;
|
|
2661
2742
|
}
|
|
2662
|
-
if (
|
|
2663
|
-
if (!
|
|
2664
|
-
|
|
2743
|
+
if (u.type === "click") {
|
|
2744
|
+
if (!be("click")) {
|
|
2745
|
+
we("click", "click");
|
|
2665
2746
|
return;
|
|
2666
2747
|
}
|
|
2667
|
-
const x = typeof
|
|
2748
|
+
const x = typeof u.selector == "string" ? u.selector : null;
|
|
2668
2749
|
if (!x) {
|
|
2669
2750
|
console.warn("[LiveLayer] click: missing selector.");
|
|
2670
2751
|
return;
|
|
2671
2752
|
}
|
|
2672
|
-
if (
|
|
2753
|
+
if (Nt.current) {
|
|
2673
2754
|
try {
|
|
2674
|
-
|
|
2675
|
-
} catch (
|
|
2676
|
-
console.warn("[LiveLayer] onClick threw.",
|
|
2755
|
+
Nt.current(x);
|
|
2756
|
+
} catch (F) {
|
|
2757
|
+
console.warn("[LiveLayer] onClick threw.", F);
|
|
2677
2758
|
}
|
|
2678
2759
|
return;
|
|
2679
2760
|
}
|
|
@@ -2699,100 +2780,92 @@ const ho = /* @__PURE__ */ new Set([
|
|
|
2699
2780
|
);
|
|
2700
2781
|
return;
|
|
2701
2782
|
}
|
|
2702
|
-
(
|
|
2783
|
+
(he = D.click) == null || he.call(D);
|
|
2703
2784
|
return;
|
|
2704
2785
|
}
|
|
2705
|
-
if (
|
|
2706
|
-
if (!
|
|
2707
|
-
|
|
2786
|
+
if (u.type === "fill_form" || u.type === "focus_field") {
|
|
2787
|
+
if (!be("fill_forms")) {
|
|
2788
|
+
we(u.type, "fill_forms");
|
|
2708
2789
|
return;
|
|
2709
2790
|
}
|
|
2710
2791
|
if (typeof document > "u") return;
|
|
2711
|
-
|
|
2712
|
-
const x = typeof
|
|
2792
|
+
u.type === "fill_form" && yt.current.playConfirmation();
|
|
2793
|
+
const x = typeof u.formId == "string" ? u.formId : null;
|
|
2713
2794
|
if (!x) {
|
|
2714
|
-
console.warn(`[LiveLayer] ${
|
|
2795
|
+
console.warn(`[LiveLayer] ${u.type}: missing formId.`);
|
|
2715
2796
|
return;
|
|
2716
2797
|
}
|
|
2717
|
-
const D =
|
|
2798
|
+
const D = bn(document, x);
|
|
2718
2799
|
if (!D) {
|
|
2719
2800
|
console.warn(
|
|
2720
|
-
`[LiveLayer] ${
|
|
2801
|
+
`[LiveLayer] ${u.type}: no <form> matched id="${x}" (or matching name / data-ll-intent slug). Forms are auto-discovered — make sure the form has an \`id\`, \`name\`, or \`data-ll-intent\` attribute the agent observed in PageContext.forms.`
|
|
2721
2802
|
);
|
|
2722
2803
|
return;
|
|
2723
2804
|
}
|
|
2724
2805
|
if (D.closest('[data-ll-private="true"], [data-ll-skip], .ll-widget')) {
|
|
2725
2806
|
console.warn(
|
|
2726
|
-
`[LiveLayer] ${
|
|
2807
|
+
`[LiveLayer] ${u.type}: refusing to touch a form in a private / opted-out subtree.`
|
|
2727
2808
|
);
|
|
2728
2809
|
return;
|
|
2729
2810
|
}
|
|
2730
|
-
if (
|
|
2731
|
-
const
|
|
2732
|
-
if (!
|
|
2811
|
+
if (u.type === "focus_field") {
|
|
2812
|
+
const H = typeof u.fieldName == "string" ? u.fieldName : null;
|
|
2813
|
+
if (!H) {
|
|
2733
2814
|
console.warn("[LiveLayer] focus_field: missing fieldName.");
|
|
2734
2815
|
return;
|
|
2735
2816
|
}
|
|
2736
|
-
const
|
|
2737
|
-
if (
|
|
2738
|
-
console.warn(
|
|
2739
|
-
`[LiveLayer] focus_field:
|
|
2740
|
-
)
|
|
2741
|
-
|
|
2742
|
-
}
|
|
2743
|
-
if (!xt(j)) {
|
|
2744
|
-
console.warn(
|
|
2745
|
-
`[LiveLayer] focus_field: field "${O}" is privacy-protected and not focusable.`
|
|
2817
|
+
const V = vn(D, H);
|
|
2818
|
+
if (V.el === null) {
|
|
2819
|
+
V.reason === "private" ? console.warn(
|
|
2820
|
+
`[LiveLayer] focus_field: field "${H}" is privacy-protected and not focusable.`
|
|
2821
|
+
) : console.warn(
|
|
2822
|
+
`[LiveLayer] focus_field: no input matching key="${H}" in form "${x}". The agent should use the field.name it observed in PageContext.forms[].fields[].`
|
|
2746
2823
|
);
|
|
2747
2824
|
return;
|
|
2748
2825
|
}
|
|
2749
|
-
|
|
2826
|
+
V.el.focus();
|
|
2750
2827
|
return;
|
|
2751
2828
|
}
|
|
2752
|
-
const
|
|
2753
|
-
if (!
|
|
2829
|
+
const F = u.values && typeof u.values == "object" ? u.values : null;
|
|
2830
|
+
if (!F) {
|
|
2754
2831
|
console.warn("[LiveLayer] fill_form: missing or invalid values.");
|
|
2755
2832
|
return;
|
|
2756
2833
|
}
|
|
2757
|
-
for (const [
|
|
2758
|
-
if (typeof
|
|
2759
|
-
const
|
|
2760
|
-
if (
|
|
2761
|
-
console.warn(
|
|
2762
|
-
`[LiveLayer] fill_form:
|
|
2763
|
-
)
|
|
2764
|
-
|
|
2765
|
-
}
|
|
2766
|
-
if (!xt(V)) {
|
|
2767
|
-
console.warn(
|
|
2768
|
-
`[LiveLayer] fill_form: field "${O}" is privacy-protected (password / cc-* / private). Skipping.`
|
|
2834
|
+
for (const [H, V] of Object.entries(F)) {
|
|
2835
|
+
if (typeof V != "string") continue;
|
|
2836
|
+
const G = vn(D, H);
|
|
2837
|
+
if (G.el === null) {
|
|
2838
|
+
G.reason === "private" ? console.warn(
|
|
2839
|
+
`[LiveLayer] fill_form: field "${H}" is privacy-protected (password / cc-* / data-ll-private). Skipping.`
|
|
2840
|
+
) : console.warn(
|
|
2841
|
+
`[LiveLayer] fill_form: no input matching key="${H}" in form "${x}". The agent should use the field.name it observed in PageContext.forms[].fields[]. Skipping.`
|
|
2769
2842
|
);
|
|
2770
2843
|
continue;
|
|
2771
2844
|
}
|
|
2772
2845
|
try {
|
|
2773
|
-
|
|
2846
|
+
ui(G.el, V);
|
|
2774
2847
|
} catch (z) {
|
|
2775
2848
|
console.warn(
|
|
2776
|
-
`[LiveLayer] fill_form: failed to set "${
|
|
2849
|
+
`[LiveLayer] fill_form: failed to set "${H}".`,
|
|
2777
2850
|
z
|
|
2778
2851
|
);
|
|
2779
2852
|
}
|
|
2780
2853
|
}
|
|
2781
2854
|
return;
|
|
2782
2855
|
}
|
|
2783
|
-
if (
|
|
2784
|
-
if (!
|
|
2785
|
-
|
|
2856
|
+
if (u.type === "submit_form") {
|
|
2857
|
+
if (!be("submit_forms")) {
|
|
2858
|
+
we("submit_form", "submit_forms");
|
|
2786
2859
|
return;
|
|
2787
2860
|
}
|
|
2788
2861
|
if (typeof document > "u") return;
|
|
2789
|
-
const x = typeof
|
|
2862
|
+
const x = typeof u.formId == "string" ? u.formId : null;
|
|
2790
2863
|
if (!x) {
|
|
2791
2864
|
console.warn("[LiveLayer] submit_form: missing formId.");
|
|
2792
2865
|
return;
|
|
2793
2866
|
}
|
|
2794
2867
|
yt.current.playConfirmation();
|
|
2795
|
-
const D =
|
|
2868
|
+
const D = bn(document, x);
|
|
2796
2869
|
if (!D) {
|
|
2797
2870
|
console.warn(
|
|
2798
2871
|
`[LiveLayer] submit_form: no <form> matched id="${x}" (or matching name / data-ll-intent slug).`
|
|
@@ -2805,24 +2878,24 @@ const ho = /* @__PURE__ */ new Set([
|
|
|
2805
2878
|
);
|
|
2806
2879
|
return;
|
|
2807
2880
|
}
|
|
2808
|
-
const
|
|
2809
|
-
const
|
|
2810
|
-
if (
|
|
2881
|
+
const F = typeof u.requestId == "string" ? u.requestId : void 0, H = (ke = ve.current) == null ? void 0 : ke.call(ve), V = (te) => {
|
|
2882
|
+
const ae = H, Ye = ae == null ? void 0 : ae.localParticipant;
|
|
2883
|
+
if (Ye != null && Ye.publishData)
|
|
2811
2884
|
try {
|
|
2812
|
-
const
|
|
2813
|
-
|
|
2885
|
+
const Un = F ? { ...te, requestId: F } : te, jn = new TextEncoder().encode(JSON.stringify(Un));
|
|
2886
|
+
Ye.publishData(jn, { reliable: !0 });
|
|
2814
2887
|
} catch {
|
|
2815
2888
|
}
|
|
2816
2889
|
};
|
|
2817
|
-
let
|
|
2890
|
+
let G = !1;
|
|
2818
2891
|
const z = () => {
|
|
2819
|
-
|
|
2892
|
+
G = !0, V({ type: "form_submitted", formId: x });
|
|
2820
2893
|
};
|
|
2821
2894
|
D.addEventListener("submit", z, { once: !0 });
|
|
2822
2895
|
try {
|
|
2823
2896
|
typeof D.requestSubmit == "function" ? D.requestSubmit() : D.submit();
|
|
2824
|
-
} catch (
|
|
2825
|
-
console.warn("[LiveLayer] submit_form: requestSubmit threw.",
|
|
2897
|
+
} catch (te) {
|
|
2898
|
+
console.warn("[LiveLayer] submit_form: requestSubmit threw.", te), D.removeEventListener("submit", z), V({
|
|
2826
2899
|
type: "form_submit_blocked",
|
|
2827
2900
|
formId: x,
|
|
2828
2901
|
reason: "exception"
|
|
@@ -2830,7 +2903,7 @@ const ho = /* @__PURE__ */ new Set([
|
|
|
2830
2903
|
return;
|
|
2831
2904
|
}
|
|
2832
2905
|
setTimeout(() => {
|
|
2833
|
-
|
|
2906
|
+
G || (D.removeEventListener("submit", z), V({
|
|
2834
2907
|
type: "form_submit_blocked",
|
|
2835
2908
|
formId: x,
|
|
2836
2909
|
reason: "validation"
|
|
@@ -2838,65 +2911,65 @@ const ho = /* @__PURE__ */ new Set([
|
|
|
2838
2911
|
}, 500);
|
|
2839
2912
|
return;
|
|
2840
2913
|
}
|
|
2841
|
-
if (
|
|
2842
|
-
if (!
|
|
2843
|
-
|
|
2914
|
+
if (u.type === "request_routes") {
|
|
2915
|
+
if (!be("read_page")) {
|
|
2916
|
+
we("request_routes", "read_page");
|
|
2844
2917
|
return;
|
|
2845
2918
|
}
|
|
2846
|
-
const x = typeof
|
|
2847
|
-
if (!(
|
|
2848
|
-
const
|
|
2919
|
+
const x = typeof u.requestId == "string" ? u.requestId : void 0, F = (ct = ve.current) == null ? void 0 : ct.call(ve), H = F == null ? void 0 : F.localParticipant;
|
|
2920
|
+
if (!(H != null && H.publishData)) return;
|
|
2921
|
+
const V = (z) => {
|
|
2849
2922
|
try {
|
|
2850
|
-
const
|
|
2851
|
-
|
|
2852
|
-
} catch (
|
|
2853
|
-
console.warn("[LiveLayer] request_routes: publishData failed.",
|
|
2923
|
+
const te = x ? { type: "routes", routes: z, requestId: x } : { type: "routes", routes: z }, ae = new TextEncoder().encode(JSON.stringify(te));
|
|
2924
|
+
H.publishData(ae, { reliable: !0 });
|
|
2925
|
+
} catch (te) {
|
|
2926
|
+
console.warn("[LiveLayer] request_routes: publishData failed.", te);
|
|
2854
2927
|
}
|
|
2855
|
-
},
|
|
2856
|
-
if (
|
|
2928
|
+
}, G = Ot.current;
|
|
2929
|
+
if (G) {
|
|
2857
2930
|
try {
|
|
2858
|
-
const z =
|
|
2859
|
-
if (!Array.isArray(
|
|
2860
|
-
|
|
2931
|
+
const z = G(), te = (ae) => {
|
|
2932
|
+
if (!Array.isArray(ae)) {
|
|
2933
|
+
V([]);
|
|
2861
2934
|
return;
|
|
2862
2935
|
}
|
|
2863
|
-
|
|
2936
|
+
V(ae.map(ni).slice(0, 200));
|
|
2864
2937
|
};
|
|
2865
|
-
z instanceof Promise ? z.then(
|
|
2938
|
+
z instanceof Promise ? z.then(te).catch((ae) => {
|
|
2866
2939
|
console.warn(
|
|
2867
2940
|
"[LiveLayer] getRoutes rejected; falling back to DOM walker.",
|
|
2868
|
-
|
|
2869
|
-
),
|
|
2870
|
-
}) :
|
|
2941
|
+
ae
|
|
2942
|
+
), V(Rt());
|
|
2943
|
+
}) : te(z);
|
|
2871
2944
|
} catch (z) {
|
|
2872
2945
|
console.warn(
|
|
2873
2946
|
"[LiveLayer] getRoutes threw; falling back to DOM walker.",
|
|
2874
2947
|
z
|
|
2875
|
-
),
|
|
2948
|
+
), V(Rt());
|
|
2876
2949
|
}
|
|
2877
2950
|
return;
|
|
2878
2951
|
}
|
|
2879
2952
|
try {
|
|
2880
|
-
|
|
2953
|
+
V(Rt());
|
|
2881
2954
|
} catch (z) {
|
|
2882
2955
|
console.warn("[LiveLayer] request_routes: extractRoutes threw.", z);
|
|
2883
2956
|
}
|
|
2884
2957
|
return;
|
|
2885
2958
|
}
|
|
2886
|
-
if (
|
|
2887
|
-
if (!
|
|
2888
|
-
|
|
2959
|
+
if (u.type === "task_field_updated") {
|
|
2960
|
+
if (!be("collect_data")) {
|
|
2961
|
+
we("task_field_updated", "collect_data");
|
|
2889
2962
|
return;
|
|
2890
2963
|
}
|
|
2891
2964
|
const x = {
|
|
2892
2965
|
phase: "field",
|
|
2893
|
-
fieldId: typeof
|
|
2894
|
-
fieldName: typeof
|
|
2895
|
-
value: typeof
|
|
2896
|
-
kind: typeof
|
|
2897
|
-
source:
|
|
2898
|
-
...typeof
|
|
2899
|
-
...typeof
|
|
2966
|
+
fieldId: typeof u.fieldId == "string" ? u.fieldId : "",
|
|
2967
|
+
fieldName: typeof u.fieldName == "string" ? u.fieldName : typeof u.fieldId == "string" ? u.fieldId : "",
|
|
2968
|
+
value: typeof u.value == "string" ? u.value : "",
|
|
2969
|
+
kind: typeof u.kind == "string" ? u.kind : "text",
|
|
2970
|
+
source: u.source === "slide" ? "slide" : u.source === "page" ? "page" : "agent",
|
|
2971
|
+
...typeof u.slideId == "string" ? { slideId: u.slideId } : {},
|
|
2972
|
+
...typeof u.formId == "string" ? { formId: u.formId } : {}
|
|
2900
2973
|
};
|
|
2901
2974
|
if (typeof document < "u")
|
|
2902
2975
|
try {
|
|
@@ -2907,12 +2980,12 @@ const ho = /* @__PURE__ */ new Set([
|
|
|
2907
2980
|
}
|
|
2908
2981
|
return;
|
|
2909
2982
|
}
|
|
2910
|
-
if (
|
|
2911
|
-
if (!
|
|
2912
|
-
|
|
2983
|
+
if (u.type === "task_completed") {
|
|
2984
|
+
if (!be("collect_data")) {
|
|
2985
|
+
we("task_completed", "collect_data");
|
|
2913
2986
|
return;
|
|
2914
2987
|
}
|
|
2915
|
-
const x =
|
|
2988
|
+
const x = u.result;
|
|
2916
2989
|
if (!x || typeof x != "object") {
|
|
2917
2990
|
console.warn(
|
|
2918
2991
|
"[LiveLayer] task_completed missing `result` payload."
|
|
@@ -2937,40 +3010,40 @@ const ho = /* @__PURE__ */ new Set([
|
|
|
2937
3010
|
}
|
|
2938
3011
|
return;
|
|
2939
3012
|
}
|
|
2940
|
-
|
|
3013
|
+
yi.has(u.type) || Te == null || Te(u);
|
|
2941
3014
|
}
|
|
2942
3015
|
},
|
|
2943
|
-
[
|
|
2944
|
-
),
|
|
2945
|
-
agentId: $ ? "__controlled__" :
|
|
2946
|
-
baseUrl:
|
|
2947
|
-
apiKey:
|
|
3016
|
+
[Te, Re, Me]
|
|
3017
|
+
), ee = er({
|
|
3018
|
+
agentId: $ ? "__controlled__" : nt,
|
|
3019
|
+
baseUrl: o,
|
|
3020
|
+
apiKey: a,
|
|
2948
3021
|
sessionEndpoint: s,
|
|
2949
|
-
sessionBody:
|
|
2950
|
-
onDataMessage: $ ? void 0 :
|
|
3022
|
+
sessionBody: l,
|
|
3023
|
+
onDataMessage: $ ? void 0 : at
|
|
2951
3024
|
});
|
|
2952
|
-
|
|
3025
|
+
T(() => {
|
|
2953
3026
|
if ($ != null && $.subscribeToDataMessages)
|
|
2954
|
-
return $.subscribeToDataMessages(
|
|
2955
|
-
}, [$,
|
|
3027
|
+
return $.subscribeToDataMessages(at);
|
|
3028
|
+
}, [$, at]), ve.current = () => {
|
|
2956
3029
|
var y;
|
|
2957
|
-
return (y =
|
|
2958
|
-
},
|
|
2959
|
-
var
|
|
3030
|
+
return (y = ee.getRoom) == null ? void 0 : y.call(ee);
|
|
3031
|
+
}, T(() => {
|
|
3032
|
+
var X;
|
|
2960
3033
|
if (typeof window > "u") return;
|
|
2961
|
-
const y = ((
|
|
3034
|
+
const y = ((X = window.location) == null ? void 0 : X.hostname) || "";
|
|
2962
3035
|
if (y === "localhost" || y === "127.0.0.1" || y === "0.0.0.0" || y.endsWith(".local") || y.endsWith(".test"))
|
|
2963
|
-
return window.__livelayerSimulateCommand = (
|
|
3036
|
+
return window.__livelayerSimulateCommand = (he) => {
|
|
2964
3037
|
try {
|
|
2965
|
-
|
|
2966
|
-
} catch (
|
|
2967
|
-
console.warn("[LiveLayer] simulate-command threw:",
|
|
3038
|
+
at(he);
|
|
3039
|
+
} catch (ke) {
|
|
3040
|
+
console.warn("[LiveLayer] simulate-command threw:", ke);
|
|
2968
3041
|
}
|
|
2969
3042
|
}, () => {
|
|
2970
3043
|
delete window.__livelayerSimulateCommand;
|
|
2971
3044
|
};
|
|
2972
|
-
}, [
|
|
2973
|
-
const k =
|
|
3045
|
+
}, [at]);
|
|
3046
|
+
const k = Xe(() => $ ? {
|
|
2974
3047
|
connectionState: $.connectionState,
|
|
2975
3048
|
agentState: $.agentState,
|
|
2976
3049
|
transcript: $.transcript,
|
|
@@ -2986,43 +3059,43 @@ const ho = /* @__PURE__ */ new Set([
|
|
|
2986
3059
|
// Dummy getRoom for shape compatibility — controlled consumers own the Room.
|
|
2987
3060
|
// Internal session's getRoom returns null when no real connect has happened,
|
|
2988
3061
|
// so we reuse its reference for type consistency.
|
|
2989
|
-
getRoom:
|
|
3062
|
+
getRoom: ee.getRoom,
|
|
2990
3063
|
isControlled: !0
|
|
2991
3064
|
} : {
|
|
2992
|
-
connectionState:
|
|
2993
|
-
agentState:
|
|
2994
|
-
transcript:
|
|
2995
|
-
videoElement:
|
|
2996
|
-
audioElement:
|
|
2997
|
-
canResume:
|
|
2998
|
-
error:
|
|
2999
|
-
agentConfig:
|
|
3000
|
-
connect:
|
|
3001
|
-
disconnect:
|
|
3002
|
-
getRoom:
|
|
3065
|
+
connectionState: ee.connectionState,
|
|
3066
|
+
agentState: ee.agentState,
|
|
3067
|
+
transcript: ee.transcript,
|
|
3068
|
+
videoElement: ee.videoElement,
|
|
3069
|
+
audioElement: ee.audioElement,
|
|
3070
|
+
canResume: ee.canResume,
|
|
3071
|
+
error: ee.error,
|
|
3072
|
+
agentConfig: ee.agentConfig,
|
|
3073
|
+
connect: ee.connect,
|
|
3074
|
+
disconnect: ee.disconnect,
|
|
3075
|
+
getRoom: ee.getRoom,
|
|
3003
3076
|
isControlled: !1
|
|
3004
|
-
}, [$,
|
|
3077
|
+
}, [$, ee]), Bt = A(k);
|
|
3005
3078
|
Bt.current = k;
|
|
3006
|
-
const Wt =
|
|
3007
|
-
Wt.current = $,
|
|
3079
|
+
const Wt = A($);
|
|
3080
|
+
Wt.current = $, Yn(
|
|
3008
3081
|
r,
|
|
3009
3082
|
() => ({
|
|
3010
3083
|
sendData: async (y) => {
|
|
3011
|
-
var
|
|
3012
|
-
const
|
|
3013
|
-
if (
|
|
3084
|
+
var ke, ct;
|
|
3085
|
+
const u = Wt.current;
|
|
3086
|
+
if (u != null && u.publishData) {
|
|
3014
3087
|
try {
|
|
3015
|
-
await
|
|
3088
|
+
await u.publishData(y);
|
|
3016
3089
|
} catch (x) {
|
|
3017
3090
|
console.warn("[AvatarWidget] sendData (controlled) failed:", x);
|
|
3018
3091
|
}
|
|
3019
3092
|
return;
|
|
3020
3093
|
}
|
|
3021
|
-
const
|
|
3022
|
-
if (
|
|
3094
|
+
const X = (ct = (ke = Bt.current) == null ? void 0 : ke.getRoom) == null ? void 0 : ct.call(ke), he = X == null ? void 0 : X.localParticipant;
|
|
3095
|
+
if (he != null && he.publishData)
|
|
3023
3096
|
try {
|
|
3024
3097
|
const x = new TextEncoder().encode(JSON.stringify(y));
|
|
3025
|
-
await
|
|
3098
|
+
await he.publishData(x, { reliable: !0 });
|
|
3026
3099
|
} catch (x) {
|
|
3027
3100
|
console.warn("[AvatarWidget] sendData failed:", x);
|
|
3028
3101
|
}
|
|
@@ -3030,402 +3103,402 @@ const ho = /* @__PURE__ */ new Set([
|
|
|
3030
3103
|
}),
|
|
3031
3104
|
[]
|
|
3032
3105
|
);
|
|
3033
|
-
const
|
|
3034
|
-
|
|
3035
|
-
const y = k.videoElement,
|
|
3036
|
-
if (!(!y || !
|
|
3037
|
-
return
|
|
3038
|
-
y.parentNode ===
|
|
3106
|
+
const Ft = A(null);
|
|
3107
|
+
T(() => {
|
|
3108
|
+
const y = k.videoElement, u = Ft.current;
|
|
3109
|
+
if (!(!y || !u))
|
|
3110
|
+
return u.appendChild(y), () => {
|
|
3111
|
+
y.parentNode === u && u.removeChild(y);
|
|
3039
3112
|
};
|
|
3040
|
-
}, [k.videoElement]),
|
|
3113
|
+
}, [k.videoElement]), T(() => {
|
|
3041
3114
|
const y = k.audioElement;
|
|
3042
3115
|
if (!y) return;
|
|
3043
|
-
|
|
3044
|
-
const
|
|
3045
|
-
return
|
|
3046
|
-
(
|
|
3116
|
+
rt.attach(y);
|
|
3117
|
+
const u = y.play();
|
|
3118
|
+
return u && typeof u.catch == "function" && u.catch((X) => {
|
|
3119
|
+
(X == null ? void 0 : X.name) === "NotAllowedError" && ge(!0);
|
|
3047
3120
|
}), () => {
|
|
3048
|
-
|
|
3121
|
+
rt.detach();
|
|
3049
3122
|
};
|
|
3050
|
-
}, [k.audioElement]),
|
|
3123
|
+
}, [k.audioElement]), T(() => {
|
|
3051
3124
|
if (k.isControlled || k.connectionState !== "connected") return;
|
|
3052
3125
|
const y = k.getRoom();
|
|
3053
3126
|
if (y)
|
|
3054
|
-
return
|
|
3127
|
+
return se.setupMic(y).catch(() => {
|
|
3055
3128
|
}), () => {
|
|
3056
|
-
|
|
3129
|
+
se.teardownMic();
|
|
3057
3130
|
};
|
|
3058
|
-
}, [k.isControlled, k.connectionState]),
|
|
3059
|
-
var
|
|
3131
|
+
}, [k.isControlled, k.connectionState]), T(() => {
|
|
3132
|
+
var u;
|
|
3060
3133
|
if (k.connectionState !== "connected") return;
|
|
3061
|
-
const y = k.isControlled ? (
|
|
3134
|
+
const y = k.isControlled ? (u = $ == null ? void 0 : $.getRoom) == null ? void 0 : u.call($) : k.getRoom();
|
|
3062
3135
|
if (y)
|
|
3063
|
-
return
|
|
3064
|
-
|
|
3136
|
+
return de.attachRoom(y), Ce.attachRoom(y), k.isControlled && se.attachRoom(y), it.refresh(), () => {
|
|
3137
|
+
de.teardown(), Ce.teardown();
|
|
3065
3138
|
};
|
|
3066
|
-
}, [k.isControlled, k.connectionState, $]),
|
|
3139
|
+
}, [k.isControlled, k.connectionState, $]), T(() => {
|
|
3067
3140
|
const y = k.audioElement;
|
|
3068
|
-
y && (y.muted =
|
|
3069
|
-
}, [k.audioElement,
|
|
3070
|
-
const
|
|
3071
|
-
const
|
|
3141
|
+
y && (y.muted = J);
|
|
3142
|
+
}, [k.audioElement, J]);
|
|
3143
|
+
const Tn = C((y) => {
|
|
3144
|
+
const u = { type: "user_message", text: y };
|
|
3072
3145
|
if ($ != null && $.publishData) {
|
|
3073
3146
|
try {
|
|
3074
|
-
$.publishData(
|
|
3147
|
+
$.publishData(u);
|
|
3075
3148
|
} catch {
|
|
3076
3149
|
}
|
|
3077
3150
|
return;
|
|
3078
3151
|
}
|
|
3079
|
-
const
|
|
3080
|
-
if (
|
|
3152
|
+
const X = k.getRoom();
|
|
3153
|
+
if (X)
|
|
3081
3154
|
try {
|
|
3082
|
-
const
|
|
3083
|
-
|
|
3155
|
+
const he = new TextEncoder().encode(JSON.stringify(u));
|
|
3156
|
+
X.localParticipant.publishData(he, { reliable: !0 });
|
|
3084
3157
|
} catch {
|
|
3085
3158
|
}
|
|
3086
|
-
}, [k, $]),
|
|
3087
|
-
|
|
3159
|
+
}, [k, $]), Mn = C(() => {
|
|
3160
|
+
Rn((y) => !y);
|
|
3088
3161
|
}, []);
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
}, [k.connectionState,
|
|
3092
|
-
|
|
3093
|
-
}, [k.transcript,
|
|
3094
|
-
|
|
3095
|
-
}, [k.agentState,
|
|
3162
|
+
T(() => {
|
|
3163
|
+
Ie == null || Ie(k.connectionState), k.connectionState === "connected" ? Ne == null || Ne() : k.connectionState === "disconnected" && (Oe == null || Oe());
|
|
3164
|
+
}, [k.connectionState, Ne, Oe, Ie]), T(() => {
|
|
3165
|
+
Ae == null || Ae(k.transcript);
|
|
3166
|
+
}, [k.transcript, Ae]), T(() => {
|
|
3167
|
+
Be == null || Be(k.agentState);
|
|
3168
|
+
}, [k.agentState, Be]), T(() => {
|
|
3096
3169
|
gt.setThinking(k.agentState === "thinking");
|
|
3097
3170
|
}, [k.agentState, gt]);
|
|
3098
|
-
const
|
|
3099
|
-
|
|
3100
|
-
!v ||
|
|
3101
|
-
}, [v, k.connectionState, k,
|
|
3102
|
-
const
|
|
3171
|
+
const qt = A(!1);
|
|
3172
|
+
T(() => {
|
|
3173
|
+
!v || qt.current || tt && k.connectionState === "idle" && (qt.current = !0, k.connect());
|
|
3174
|
+
}, [v, k.connectionState, k, tt]);
|
|
3175
|
+
const Dn = C(
|
|
3103
3176
|
(y) => {
|
|
3104
|
-
const
|
|
3105
|
-
|
|
3177
|
+
const u = N == null ? void 0 : N.find((X) => X.id === y);
|
|
3178
|
+
u && (lt(!1), y !== Le && (ot(!0), k.disconnect(), Pe || kt(y), I == null || I(u)));
|
|
3106
3179
|
},
|
|
3107
3180
|
[
|
|
3108
|
-
|
|
3181
|
+
N,
|
|
3109
3182
|
Le,
|
|
3110
3183
|
k,
|
|
3111
|
-
|
|
3112
|
-
|
|
3184
|
+
Pe,
|
|
3185
|
+
I
|
|
3113
3186
|
]
|
|
3114
3187
|
);
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
}, [k.connectionState,
|
|
3118
|
-
if (!
|
|
3119
|
-
const y = (
|
|
3120
|
-
|
|
3188
|
+
T(() => {
|
|
3189
|
+
ye && k.connectionState === "connected" && ot(!1);
|
|
3190
|
+
}, [k.connectionState, ye]), T(() => {
|
|
3191
|
+
if (!je) return;
|
|
3192
|
+
const y = (u) => {
|
|
3193
|
+
u.key === "Escape" && lt(!1);
|
|
3121
3194
|
};
|
|
3122
3195
|
return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
|
|
3123
|
-
}, [
|
|
3124
|
-
const
|
|
3125
|
-
|
|
3126
|
-
const vt = (
|
|
3127
|
-
() =>
|
|
3128
|
-
[
|
|
3196
|
+
}, [je]);
|
|
3197
|
+
const Pn = !!P || !!(oe != null && oe.avatarImageUrl) || k.isControlled, st = ar(nt, o, Pn);
|
|
3198
|
+
et === void 0 && ((Yt = st.info) != null && Yt.capabilities) && (At.current = st.info.capabilities);
|
|
3199
|
+
const vt = (oe == null ? void 0 : oe.name) ?? O ?? ((Gt = k.agentConfig) == null ? void 0 : Gt.name) ?? ((Kt = st.info) == null ? void 0 : Kt.name) ?? "Live Layer", It = (oe == null ? void 0 : oe.avatarImageUrl) ?? P ?? ((Jt = k.agentConfig) == null ? void 0 : Jt.avatarImageUrl) ?? ((Xt = st.info) == null ? void 0 : Xt.avatarImageUrl) ?? null, $n = U ?? ((Qt = k.agentConfig) == null ? void 0 : Qt.idleLoopUrl) ?? ((Zt = st.info) == null ? void 0 : Zt.idleLoopUrl) ?? null, zn = g ?? null, Hn = C(() => ue("expanded"), [ue]), On = C(
|
|
3200
|
+
() => ue("minimized"),
|
|
3201
|
+
[ue]
|
|
3129
3202
|
), Ut = C(() => {
|
|
3130
|
-
k.disconnect(),
|
|
3131
|
-
}, [k,
|
|
3203
|
+
k.disconnect(), ue("hidden");
|
|
3204
|
+
}, [k, ue]), Bn = C(() => {
|
|
3132
3205
|
const y = k.audioElement;
|
|
3133
|
-
y && y.play().then(() =>
|
|
3206
|
+
y && y.play().then(() => ge(!1)).catch(() => {
|
|
3134
3207
|
});
|
|
3135
|
-
}, [k.audioElement]),
|
|
3136
|
-
|
|
3137
|
-
}, [k]),
|
|
3138
|
-
...
|
|
3139
|
-
...
|
|
3208
|
+
}, [k.audioElement]), Wn = C(() => {
|
|
3209
|
+
ge(!1), k.connect();
|
|
3210
|
+
}, [k]), Ve = {
|
|
3211
|
+
...De,
|
|
3212
|
+
...me ? {} : { zIndex: We }
|
|
3140
3213
|
};
|
|
3141
|
-
q.primaryColor && (
|
|
3142
|
-
const
|
|
3214
|
+
q.primaryColor && (Ve["--ll-color-primary"] = q.primaryColor), q.accentColor && (Ve["--ll-color-accent"] = q.accentColor), q.backgroundColor && (Ve["--ll-color-bg"] = q.backgroundColor), q.textColor && (Ve["--ll-color-fg"] = q.textColor);
|
|
3215
|
+
const Fn = [
|
|
3143
3216
|
"ll-widget",
|
|
3144
|
-
`ll-widget--${
|
|
3145
|
-
`ll-widget--${
|
|
3146
|
-
|
|
3217
|
+
`ll-widget--${le}`,
|
|
3218
|
+
`ll-widget--${Ee ? "mobile" : "desktop"}`,
|
|
3219
|
+
xt
|
|
3147
3220
|
].filter(Boolean).join(" ");
|
|
3148
|
-
if (!
|
|
3149
|
-
const
|
|
3221
|
+
if (!tt) return null;
|
|
3222
|
+
const qn = /* @__PURE__ */ n(
|
|
3150
3223
|
"div",
|
|
3151
3224
|
{
|
|
3152
|
-
className:
|
|
3153
|
-
style:
|
|
3154
|
-
"data-display-mode":
|
|
3225
|
+
className: Fn,
|
|
3226
|
+
style: Ve,
|
|
3227
|
+
"data-display-mode": le,
|
|
3155
3228
|
"data-position": L,
|
|
3156
3229
|
"data-experience-mode": p === "EMBEDDED" ? "embedded" : "widget",
|
|
3157
|
-
children:
|
|
3158
|
-
|
|
3230
|
+
children: le === "expanded" && /* @__PURE__ */ n(
|
|
3231
|
+
Wr,
|
|
3159
3232
|
{
|
|
3160
3233
|
position: L,
|
|
3161
|
-
isMobile:
|
|
3234
|
+
isMobile: Ee,
|
|
3162
3235
|
agentName: vt,
|
|
3163
3236
|
avatarImageUrl: It,
|
|
3164
|
-
idleLoopUrl:
|
|
3165
|
-
greeting:
|
|
3237
|
+
idleLoopUrl: $n,
|
|
3238
|
+
greeting: zn,
|
|
3166
3239
|
branding: q,
|
|
3167
|
-
teamMembers:
|
|
3240
|
+
teamMembers: N,
|
|
3168
3241
|
currentTeamMemberId: Le,
|
|
3169
|
-
isSwitchingTeamMember:
|
|
3170
|
-
teamSwitcherOpen:
|
|
3171
|
-
onToggleTeamSwitcher: () =>
|
|
3172
|
-
onSelectTeamMember:
|
|
3242
|
+
isSwitchingTeamMember: ye,
|
|
3243
|
+
teamSwitcherOpen: je,
|
|
3244
|
+
onToggleTeamSwitcher: () => lt((y) => !y),
|
|
3245
|
+
onSelectTeamMember: Dn,
|
|
3173
3246
|
connectionState: k.connectionState,
|
|
3174
3247
|
agentState: k.agentState,
|
|
3175
3248
|
transcript: k.transcript,
|
|
3176
|
-
isMuted:
|
|
3177
|
-
micDevices:
|
|
3178
|
-
activeMicId:
|
|
3179
|
-
isCameraEnabled:
|
|
3180
|
-
cameraPreviewEl:
|
|
3181
|
-
cameraDevices:
|
|
3182
|
-
activeCameraId:
|
|
3183
|
-
isScreenShareEnabled:
|
|
3184
|
-
screenPreviewEl:
|
|
3185
|
-
isSpeakerMuted:
|
|
3186
|
-
allowCamera:
|
|
3187
|
-
allowScreenShare:
|
|
3188
|
-
allowTyping:
|
|
3249
|
+
isMuted: se.isMuted,
|
|
3250
|
+
micDevices: it.mics,
|
|
3251
|
+
activeMicId: se.activeDeviceId,
|
|
3252
|
+
isCameraEnabled: de.isEnabled,
|
|
3253
|
+
cameraPreviewEl: de.previewEl,
|
|
3254
|
+
cameraDevices: it.cameras,
|
|
3255
|
+
activeCameraId: de.activeDeviceId,
|
|
3256
|
+
isScreenShareEnabled: Ce.isEnabled,
|
|
3257
|
+
screenPreviewEl: Ce.previewEl,
|
|
3258
|
+
isSpeakerMuted: J,
|
|
3259
|
+
allowCamera: ne,
|
|
3260
|
+
allowScreenShare: B,
|
|
3261
|
+
allowTyping: j,
|
|
3189
3262
|
showMinimize: pt,
|
|
3190
3263
|
showClose: ht,
|
|
3191
|
-
chromeless:
|
|
3192
|
-
compactControls:
|
|
3193
|
-
transforming:
|
|
3194
|
-
transformingLabel:
|
|
3264
|
+
chromeless: _e,
|
|
3265
|
+
compactControls: ze,
|
|
3266
|
+
transforming: He,
|
|
3267
|
+
transformingLabel: Q,
|
|
3195
3268
|
languageMenuOpen: mt,
|
|
3196
3269
|
onToggleLanguageMenu: () => m((y) => !y),
|
|
3197
|
-
needsUserGesture:
|
|
3270
|
+
needsUserGesture: Lt,
|
|
3198
3271
|
canResume: k.canResume,
|
|
3199
|
-
micError:
|
|
3272
|
+
micError: se.micError,
|
|
3200
3273
|
error: k.error,
|
|
3201
|
-
avatarVideoContainerRef:
|
|
3274
|
+
avatarVideoContainerRef: Ft,
|
|
3202
3275
|
agentVideoEl: k.videoElement,
|
|
3203
3276
|
onConnect: () => void k.connect(),
|
|
3204
3277
|
onDisconnect: () => k.disconnect(),
|
|
3205
|
-
onRetry:
|
|
3206
|
-
onResumeAudio:
|
|
3207
|
-
onToggleMute:
|
|
3208
|
-
onSwitchMicDevice: (y) => void
|
|
3209
|
-
onToggleCamera: () => void
|
|
3210
|
-
onSwitchCameraDevice: (y) => void
|
|
3211
|
-
onToggleScreenShare: () => void
|
|
3212
|
-
onToggleSpeaker:
|
|
3213
|
-
onSendMessage:
|
|
3214
|
-
onMinimize:
|
|
3278
|
+
onRetry: Wn,
|
|
3279
|
+
onResumeAudio: Bn,
|
|
3280
|
+
onToggleMute: se.toggleMute,
|
|
3281
|
+
onSwitchMicDevice: (y) => void se.switchDevice(y),
|
|
3282
|
+
onToggleCamera: () => void de.toggle(),
|
|
3283
|
+
onSwitchCameraDevice: (y) => void de.switchDevice(y),
|
|
3284
|
+
onToggleScreenShare: () => void Ce.toggle(),
|
|
3285
|
+
onToggleSpeaker: Mn,
|
|
3286
|
+
onSendMessage: Tn,
|
|
3287
|
+
onMinimize: On,
|
|
3215
3288
|
onClose: Ut,
|
|
3216
|
-
onClearMicError:
|
|
3289
|
+
onClearMicError: se.clearError
|
|
3217
3290
|
}
|
|
3218
3291
|
)
|
|
3219
3292
|
}
|
|
3220
|
-
), jt = !
|
|
3293
|
+
), jt = !me && (le === "hidden" || le === "minimized") ? /* @__PURE__ */ w(
|
|
3221
3294
|
"div",
|
|
3222
3295
|
{
|
|
3223
3296
|
className: [
|
|
3224
3297
|
"ll-widget",
|
|
3225
3298
|
"ll-widget--floating",
|
|
3226
|
-
`ll-widget--${
|
|
3227
|
-
`ll-widget--${
|
|
3299
|
+
`ll-widget--${le}`,
|
|
3300
|
+
`ll-widget--${Ee ? "mobile" : "desktop"}`
|
|
3228
3301
|
].join(" "),
|
|
3229
|
-
style:
|
|
3230
|
-
"data-display-mode":
|
|
3302
|
+
style: Ve,
|
|
3303
|
+
"data-display-mode": le,
|
|
3231
3304
|
"data-position": L,
|
|
3232
3305
|
children: [
|
|
3233
|
-
|
|
3234
|
-
|
|
3306
|
+
le === "hidden" && /* @__PURE__ */ n(
|
|
3307
|
+
Tr,
|
|
3235
3308
|
{
|
|
3236
3309
|
position: L,
|
|
3237
|
-
isMobile:
|
|
3310
|
+
isMobile: Ee,
|
|
3238
3311
|
isSpeaking: k.agentState === "speaking",
|
|
3239
|
-
onExpand: () =>
|
|
3312
|
+
onExpand: () => ue("expanded"),
|
|
3240
3313
|
label: `Open ${vt} widget`,
|
|
3241
3314
|
avatarImageUrl: It,
|
|
3242
3315
|
agentName: vt,
|
|
3243
|
-
containerEl:
|
|
3316
|
+
containerEl: ce
|
|
3244
3317
|
}
|
|
3245
3318
|
),
|
|
3246
|
-
|
|
3247
|
-
|
|
3319
|
+
le === "minimized" && /* @__PURE__ */ n(
|
|
3320
|
+
Dr,
|
|
3248
3321
|
{
|
|
3249
3322
|
position: L,
|
|
3250
|
-
isMobile:
|
|
3323
|
+
isMobile: Ee,
|
|
3251
3324
|
agentName: vt,
|
|
3252
3325
|
avatarImageUrl: It,
|
|
3253
3326
|
agentState: k.agentState,
|
|
3254
|
-
isMuted:
|
|
3255
|
-
audioLevel:
|
|
3256
|
-
onExpand:
|
|
3257
|
-
onToggleMute:
|
|
3327
|
+
isMuted: se.isMuted,
|
|
3328
|
+
audioLevel: rt,
|
|
3329
|
+
onExpand: Hn,
|
|
3330
|
+
onToggleMute: se.toggleMute,
|
|
3258
3331
|
onClose: Ut
|
|
3259
3332
|
}
|
|
3260
3333
|
)
|
|
3261
3334
|
]
|
|
3262
3335
|
}
|
|
3263
|
-
) : null, Vt =
|
|
3264
|
-
return /* @__PURE__ */ w(
|
|
3265
|
-
|
|
3336
|
+
) : null, Vt = ce ?? (typeof document < "u" ? document.body : null);
|
|
3337
|
+
return /* @__PURE__ */ w($e, { children: [
|
|
3338
|
+
qn,
|
|
3266
3339
|
jt && Vt && Pt(jt, Vt)
|
|
3267
3340
|
] });
|
|
3268
3341
|
}
|
|
3269
3342
|
);
|
|
3270
|
-
|
|
3271
|
-
const
|
|
3343
|
+
In.displayName = "AvatarWidgetInner";
|
|
3344
|
+
const vi = Dt(
|
|
3272
3345
|
function(t, r) {
|
|
3273
|
-
return /* @__PURE__ */ n(
|
|
3346
|
+
return /* @__PURE__ */ n(Zn, { children: /* @__PURE__ */ n(In, { ...t, ref: r }) });
|
|
3274
3347
|
}
|
|
3275
3348
|
);
|
|
3276
|
-
|
|
3277
|
-
const
|
|
3349
|
+
vi.displayName = "AvatarWidget";
|
|
3350
|
+
const Ai = ({
|
|
3278
3351
|
agentId: e,
|
|
3279
3352
|
baseUrl: t,
|
|
3280
3353
|
apiKey: r,
|
|
3281
|
-
mode:
|
|
3282
|
-
onAgentEvent:
|
|
3283
|
-
className:
|
|
3354
|
+
mode: i,
|
|
3355
|
+
onAgentEvent: a,
|
|
3356
|
+
className: o,
|
|
3284
3357
|
style: s
|
|
3285
3358
|
}) => {
|
|
3286
|
-
const
|
|
3287
|
-
p.current =
|
|
3359
|
+
const l = A(null), c = A(null), p = A(a);
|
|
3360
|
+
p.current = a;
|
|
3288
3361
|
const v = C((f) => {
|
|
3289
3362
|
var R;
|
|
3290
|
-
const
|
|
3291
|
-
(R = p.current) == null || R.call(p,
|
|
3363
|
+
const d = f.detail;
|
|
3364
|
+
(R = p.current) == null || R.call(p, d);
|
|
3292
3365
|
}, []);
|
|
3293
|
-
return
|
|
3294
|
-
const f =
|
|
3366
|
+
return T(() => {
|
|
3367
|
+
const f = l.current;
|
|
3295
3368
|
if (!f) return;
|
|
3296
|
-
const
|
|
3297
|
-
return
|
|
3298
|
-
|
|
3369
|
+
const d = document.createElement("livelayer-widget");
|
|
3370
|
+
return d.setAttribute("agent-id", e), t && d.setAttribute("base-url", t), r && d.setAttribute("api-key", r), i && d.setAttribute("mode", i), d.addEventListener("agent-event", v), f.appendChild(d), c.current = d, () => {
|
|
3371
|
+
d.removeEventListener("agent-event", v), f.removeChild(d), c.current = null;
|
|
3299
3372
|
};
|
|
3300
|
-
}, [e]),
|
|
3301
|
-
c.current && (
|
|
3302
|
-
}, [
|
|
3303
|
-
},
|
|
3304
|
-
function({ id: t, intent: r, as:
|
|
3305
|
-
return
|
|
3306
|
-
|
|
3373
|
+
}, [e]), T(() => {
|
|
3374
|
+
c.current && (i ? c.current.setAttribute("mode", i) : c.current.removeAttribute("mode"));
|
|
3375
|
+
}, [i]), /* @__PURE__ */ n("div", { ref: l, className: o, style: s });
|
|
3376
|
+
}, Ii = Dt(
|
|
3377
|
+
function({ id: t, intent: r, as: i = "div", className: a, style: o, children: s }, l) {
|
|
3378
|
+
return Gn(
|
|
3379
|
+
i,
|
|
3307
3380
|
{
|
|
3308
|
-
ref:
|
|
3381
|
+
ref: l,
|
|
3309
3382
|
"data-ll-region": t,
|
|
3310
3383
|
"data-ll-intent": r,
|
|
3311
|
-
className:
|
|
3312
|
-
style:
|
|
3384
|
+
className: a,
|
|
3385
|
+
style: o
|
|
3313
3386
|
},
|
|
3314
3387
|
s
|
|
3315
3388
|
);
|
|
3316
3389
|
}
|
|
3317
3390
|
);
|
|
3318
|
-
function
|
|
3319
|
-
const { onFieldUpdate: t, onComplete: r, source:
|
|
3320
|
-
|
|
3321
|
-
v.current = t, f.current = r,
|
|
3322
|
-
}, [t, r,
|
|
3391
|
+
function Ri(e = {}) {
|
|
3392
|
+
const { onFieldUpdate: t, onComplete: r, source: i = "all" } = e, [a, o] = S({}), [s, l] = S(!1), [c, p] = S(null), v = A(t), f = A(r), d = A(i);
|
|
3393
|
+
T(() => {
|
|
3394
|
+
v.current = t, f.current = r, d.current = i;
|
|
3395
|
+
}, [t, r, i]);
|
|
3323
3396
|
const R = C(() => {
|
|
3324
|
-
|
|
3397
|
+
o({}), l(!1);
|
|
3325
3398
|
}, []);
|
|
3326
|
-
return
|
|
3399
|
+
return T(() => {
|
|
3327
3400
|
if (typeof window > "u") return;
|
|
3328
3401
|
const L = (_) => {
|
|
3329
|
-
var b,
|
|
3402
|
+
var b, N;
|
|
3330
3403
|
const h = _.detail;
|
|
3331
3404
|
if (h) {
|
|
3332
3405
|
if (h.phase === "field") {
|
|
3333
|
-
if (
|
|
3406
|
+
if (d.current !== "all" && h.source !== d.current)
|
|
3334
3407
|
return;
|
|
3335
|
-
|
|
3336
|
-
(
|
|
3408
|
+
l(!0), o(
|
|
3409
|
+
(M) => M[h.fieldName] === h.value ? M : { ...M, [h.fieldName]: h.value }
|
|
3337
3410
|
);
|
|
3338
3411
|
try {
|
|
3339
3412
|
(b = v.current) == null || b.call(v, h);
|
|
3340
|
-
} catch (
|
|
3341
|
-
console.warn("[LiveLayer] useCollect onFieldUpdate threw.",
|
|
3413
|
+
} catch (M) {
|
|
3414
|
+
console.warn("[LiveLayer] useCollect onFieldUpdate threw.", M);
|
|
3342
3415
|
}
|
|
3343
3416
|
return;
|
|
3344
3417
|
}
|
|
3345
3418
|
if (h.phase === "complete") {
|
|
3346
|
-
const
|
|
3347
|
-
if (
|
|
3419
|
+
const M = h.result;
|
|
3420
|
+
if (d.current !== "all" && M.source !== d.current)
|
|
3348
3421
|
return;
|
|
3349
|
-
p(
|
|
3422
|
+
p(M), l(!1);
|
|
3350
3423
|
try {
|
|
3351
|
-
(
|
|
3352
|
-
} catch (
|
|
3353
|
-
console.warn("[LiveLayer] useCollect onComplete threw.",
|
|
3424
|
+
(N = f.current) == null || N.call(f, M);
|
|
3425
|
+
} catch (I) {
|
|
3426
|
+
console.warn("[LiveLayer] useCollect onComplete threw.", I);
|
|
3354
3427
|
}
|
|
3355
3428
|
}
|
|
3356
3429
|
}
|
|
3357
3430
|
};
|
|
3358
3431
|
return document.addEventListener("ll-collected", L), () => document.removeEventListener("ll-collected", L);
|
|
3359
|
-
}, []), { fields:
|
|
3432
|
+
}, []), { fields: a, isCollecting: s, lastResult: c, reset: R };
|
|
3360
3433
|
}
|
|
3361
|
-
let
|
|
3362
|
-
function
|
|
3434
|
+
let _n = 1;
|
|
3435
|
+
function Ti({
|
|
3363
3436
|
onMount: e,
|
|
3364
3437
|
defaultOpen: t = !1,
|
|
3365
3438
|
storageKey: r = "ll-debug-open"
|
|
3366
3439
|
}) {
|
|
3367
|
-
const [
|
|
3368
|
-
R.current = p,
|
|
3440
|
+
const [i, a] = S(t), [o, s] = S([]), [l, c] = S(""), [p, v] = S(!1), f = A(/* @__PURE__ */ new Set()), d = A([]), R = A(p);
|
|
3441
|
+
R.current = p, T(() => {
|
|
3369
3442
|
try {
|
|
3370
3443
|
const h = localStorage.getItem(r);
|
|
3371
|
-
h === "1" &&
|
|
3444
|
+
h === "1" && a(!0), h === "0" && a(!1);
|
|
3372
3445
|
} catch {
|
|
3373
3446
|
}
|
|
3374
|
-
}, [r]),
|
|
3447
|
+
}, [r]), T(() => {
|
|
3375
3448
|
try {
|
|
3376
|
-
localStorage.setItem(r,
|
|
3449
|
+
localStorage.setItem(r, i ? "1" : "0");
|
|
3377
3450
|
} catch {
|
|
3378
3451
|
}
|
|
3379
|
-
}, [
|
|
3452
|
+
}, [i, r]), T(() => {
|
|
3380
3453
|
const h = (b) => {
|
|
3381
|
-
(b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(),
|
|
3454
|
+
(b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(), a((N) => !N));
|
|
3382
3455
|
};
|
|
3383
3456
|
return window.addEventListener("keydown", h), () => window.removeEventListener("keydown", h);
|
|
3384
|
-
}, []),
|
|
3457
|
+
}, []), T(() => {
|
|
3385
3458
|
const h = setInterval(() => {
|
|
3386
|
-
if (
|
|
3387
|
-
const b =
|
|
3459
|
+
if (d.current.length === 0 || R.current) return;
|
|
3460
|
+
const b = d.current.splice(0, d.current.length);
|
|
3388
3461
|
s(
|
|
3389
|
-
(
|
|
3462
|
+
(N) => [...b.reverse(), ...N].slice(0, 200)
|
|
3390
3463
|
);
|
|
3391
3464
|
}, 100);
|
|
3392
3465
|
return () => clearInterval(h);
|
|
3393
3466
|
}, []);
|
|
3394
|
-
const L =
|
|
3395
|
-
if (
|
|
3467
|
+
const L = A(!1);
|
|
3468
|
+
if (T(() => {
|
|
3396
3469
|
!e || L.current || (L.current = !0, e((h) => {
|
|
3397
|
-
|
|
3398
|
-
id:
|
|
3470
|
+
d.current.push({
|
|
3471
|
+
id: _n++,
|
|
3399
3472
|
ts: Date.now(),
|
|
3400
3473
|
kind: "event",
|
|
3401
3474
|
type: h.eventName,
|
|
3402
3475
|
data: h.data
|
|
3403
3476
|
});
|
|
3404
3477
|
}));
|
|
3405
|
-
}, [e]),
|
|
3406
|
-
const h = console.warn, b = console.log,
|
|
3478
|
+
}, [e]), T(() => {
|
|
3479
|
+
const h = console.warn, b = console.log, N = (M, I) => function(...U) {
|
|
3407
3480
|
try {
|
|
3408
|
-
const g = typeof
|
|
3409
|
-
g.startsWith("[LiveLayer]") &&
|
|
3410
|
-
id:
|
|
3481
|
+
const g = typeof U[0] == "string" ? U[0] : "";
|
|
3482
|
+
g.startsWith("[LiveLayer]") && d.current.push({
|
|
3483
|
+
id: _n++,
|
|
3411
3484
|
ts: Date.now(),
|
|
3412
|
-
kind:
|
|
3485
|
+
kind: M,
|
|
3413
3486
|
type: g.slice(0, 120),
|
|
3414
|
-
data: { args:
|
|
3487
|
+
data: { args: U.slice(1).map((P) => wi(P)) }
|
|
3415
3488
|
});
|
|
3416
3489
|
} catch {
|
|
3417
3490
|
}
|
|
3418
|
-
return
|
|
3491
|
+
return I.apply(this, U);
|
|
3419
3492
|
};
|
|
3420
|
-
return console.warn =
|
|
3493
|
+
return console.warn = N("warn", h), console.log = N("log", b), () => {
|
|
3421
3494
|
console.warn = h, console.log = b;
|
|
3422
3495
|
};
|
|
3423
|
-
}, []), !
|
|
3496
|
+
}, []), !i)
|
|
3424
3497
|
return /* @__PURE__ */ n(
|
|
3425
3498
|
"button",
|
|
3426
3499
|
{
|
|
3427
3500
|
type: "button",
|
|
3428
|
-
onClick: () =>
|
|
3501
|
+
onClick: () => a(!0),
|
|
3429
3502
|
title: "Open LiveLayer debug panel (Cmd/Ctrl + Shift + L)",
|
|
3430
3503
|
"aria-label": "Open LiveLayer debug panel",
|
|
3431
3504
|
style: {
|
|
@@ -3447,9 +3520,9 @@ function Ao({
|
|
|
3447
3520
|
children: "🛰 LL debug"
|
|
3448
3521
|
}
|
|
3449
3522
|
);
|
|
3450
|
-
const _ =
|
|
3451
|
-
if (!
|
|
3452
|
-
const b =
|
|
3523
|
+
const _ = o.filter((h) => {
|
|
3524
|
+
if (!l) return !0;
|
|
3525
|
+
const b = l.toLowerCase();
|
|
3453
3526
|
return h.type.toLowerCase().includes(b) || JSON.stringify(h.data || {}).toLowerCase().includes(b);
|
|
3454
3527
|
});
|
|
3455
3528
|
return /* @__PURE__ */ w(
|
|
@@ -3488,9 +3561,9 @@ function Ao({
|
|
|
3488
3561
|
children: [
|
|
3489
3562
|
/* @__PURE__ */ n("span", { style: { fontWeight: 600, fontSize: 12 }, children: "LiveLayer debug" }),
|
|
3490
3563
|
/* @__PURE__ */ w("span", { style: { fontSize: 10, color: "rgba(255,255,255,0.4)" }, children: [
|
|
3491
|
-
|
|
3564
|
+
o.length,
|
|
3492
3565
|
" event",
|
|
3493
|
-
|
|
3566
|
+
o.length === 1 ? "" : "s"
|
|
3494
3567
|
] }),
|
|
3495
3568
|
/* @__PURE__ */ n("span", { style: { flex: 1 } }),
|
|
3496
3569
|
/* @__PURE__ */ n(
|
|
@@ -3508,7 +3581,7 @@ function Ao({
|
|
|
3508
3581
|
{
|
|
3509
3582
|
type: "button",
|
|
3510
3583
|
onClick: () => {
|
|
3511
|
-
s([]),
|
|
3584
|
+
s([]), d.current = [];
|
|
3512
3585
|
},
|
|
3513
3586
|
style: Tt("transparent"),
|
|
3514
3587
|
title: "Clear buffer",
|
|
@@ -3519,7 +3592,7 @@ function Ao({
|
|
|
3519
3592
|
"button",
|
|
3520
3593
|
{
|
|
3521
3594
|
type: "button",
|
|
3522
|
-
onClick: () =>
|
|
3595
|
+
onClick: () => a(!1),
|
|
3523
3596
|
style: Tt("transparent"),
|
|
3524
3597
|
"aria-label": "Close",
|
|
3525
3598
|
title: "Close (Cmd/Ctrl + Shift + L)",
|
|
@@ -3533,7 +3606,7 @@ function Ao({
|
|
|
3533
3606
|
"input",
|
|
3534
3607
|
{
|
|
3535
3608
|
type: "text",
|
|
3536
|
-
value:
|
|
3609
|
+
value: l,
|
|
3537
3610
|
onChange: (h) => c(h.target.value),
|
|
3538
3611
|
placeholder: "filter by type or data…",
|
|
3539
3612
|
style: {
|
|
@@ -3587,7 +3660,7 @@ function Ao({
|
|
|
3587
3660
|
]
|
|
3588
3661
|
}
|
|
3589
3662
|
) : _.map((h) => /* @__PURE__ */ n(
|
|
3590
|
-
|
|
3663
|
+
bi,
|
|
3591
3664
|
{
|
|
3592
3665
|
entry: h,
|
|
3593
3666
|
expanded: f.current.has(h.id),
|
|
@@ -3603,12 +3676,12 @@ function Ao({
|
|
|
3603
3676
|
}
|
|
3604
3677
|
);
|
|
3605
3678
|
}
|
|
3606
|
-
function
|
|
3679
|
+
function bi({
|
|
3607
3680
|
entry: e,
|
|
3608
3681
|
expanded: t,
|
|
3609
3682
|
onToggle: r
|
|
3610
3683
|
}) {
|
|
3611
|
-
const
|
|
3684
|
+
const i = e.kind === "warn" ? "#f59e0b" : e.type.startsWith("[LiveLayer]") ? "#94a3b8" : e.type === "navigate" || e.type === "scroll_page" || e.type === "scroll_to" || e.type === "click" ? "#22c55e" : e.type === "fill_form" || e.type === "submit_form" || e.type === "focus_field" ? "#a78bfa" : e.type === "request_page_context" || e.type === "request_routes" ? "#38bdf8" : e.type === "agent_state" ? "#facc15" : "#cbd5e1", a = new Date(e.ts).toLocaleTimeString("en-US", {
|
|
3612
3685
|
hour12: !1
|
|
3613
3686
|
});
|
|
3614
3687
|
return /* @__PURE__ */ w(
|
|
@@ -3638,14 +3711,14 @@ function go({
|
|
|
3638
3711
|
fontVariantNumeric: "tabular-nums",
|
|
3639
3712
|
fontSize: 10
|
|
3640
3713
|
},
|
|
3641
|
-
children:
|
|
3714
|
+
children: a
|
|
3642
3715
|
}
|
|
3643
3716
|
),
|
|
3644
3717
|
/* @__PURE__ */ n(
|
|
3645
3718
|
"span",
|
|
3646
3719
|
{
|
|
3647
3720
|
style: {
|
|
3648
|
-
color:
|
|
3721
|
+
color: i,
|
|
3649
3722
|
fontWeight: 600,
|
|
3650
3723
|
flexShrink: 0
|
|
3651
3724
|
},
|
|
@@ -3684,71 +3757,71 @@ function Tt(e) {
|
|
|
3684
3757
|
cursor: "pointer"
|
|
3685
3758
|
};
|
|
3686
3759
|
}
|
|
3687
|
-
function
|
|
3760
|
+
function wi(e) {
|
|
3688
3761
|
try {
|
|
3689
3762
|
return e instanceof Error ? { message: e.message, stack: e.stack } : (JSON.stringify(e), e);
|
|
3690
3763
|
} catch {
|
|
3691
3764
|
return String(e);
|
|
3692
3765
|
}
|
|
3693
3766
|
}
|
|
3694
|
-
function
|
|
3767
|
+
function _i(e) {
|
|
3695
3768
|
const t = JSON.stringify(e);
|
|
3696
|
-
|
|
3769
|
+
T(() => Jn(e), [t]);
|
|
3697
3770
|
}
|
|
3698
|
-
function
|
|
3699
|
-
return
|
|
3771
|
+
function Mi({ fields: e, children: t }) {
|
|
3772
|
+
return _i(e), /* @__PURE__ */ n($e, { children: t });
|
|
3700
3773
|
}
|
|
3701
|
-
function
|
|
3702
|
-
const [e, t] =
|
|
3703
|
-
t((
|
|
3704
|
-
const s =
|
|
3774
|
+
function Di() {
|
|
3775
|
+
const [e, t] = S([]), r = C((a) => {
|
|
3776
|
+
t((o) => {
|
|
3777
|
+
const s = o.findIndex((l) => l.id === a.id);
|
|
3705
3778
|
if (s >= 0) {
|
|
3706
|
-
const
|
|
3707
|
-
return
|
|
3779
|
+
const l = o.slice();
|
|
3780
|
+
return l[s] = a, l;
|
|
3708
3781
|
}
|
|
3709
|
-
return [...
|
|
3782
|
+
return [...o, a];
|
|
3710
3783
|
});
|
|
3711
|
-
}, []),
|
|
3784
|
+
}, []), i = C(() => t([]), []);
|
|
3712
3785
|
return {
|
|
3713
3786
|
entries: e,
|
|
3714
3787
|
pushSegment: r,
|
|
3715
|
-
clear:
|
|
3788
|
+
clear: i,
|
|
3716
3789
|
latest: e.length > 0 ? e[e.length - 1] : null
|
|
3717
3790
|
};
|
|
3718
3791
|
}
|
|
3719
3792
|
export {
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3793
|
+
vi as AvatarWidget,
|
|
3794
|
+
Zn as ErrorBoundary,
|
|
3795
|
+
Mi as FieldProvider,
|
|
3796
|
+
Ti as LiveLayerDebugPanel,
|
|
3797
|
+
Ii as LiveLayerRegion,
|
|
3798
|
+
Ai as LiveLayerWidget,
|
|
3799
|
+
zi as clearFieldRegistry,
|
|
3800
|
+
ei as clearPageContextCache,
|
|
3801
|
+
li as clearRoutesCache,
|
|
3802
|
+
Zr as extractPageContext,
|
|
3803
|
+
ii as extractRoutes,
|
|
3731
3804
|
gn as getCachedPageContext,
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3805
|
+
Rt as getCachedRoutes,
|
|
3806
|
+
Hi as getRegisteredFields,
|
|
3807
|
+
xr as matchesPattern,
|
|
3808
|
+
ni as normalizeRouteInput,
|
|
3809
|
+
Oi as registerFields,
|
|
3810
|
+
Bi as setFieldValue,
|
|
3811
|
+
kr as shouldRenderAtPath,
|
|
3812
|
+
ar as useAgentInfo,
|
|
3813
|
+
tr as useAudioLevel,
|
|
3814
|
+
ir as useCameraState,
|
|
3815
|
+
Ri as useCollect,
|
|
3816
|
+
ur as useDisplayMode,
|
|
3817
|
+
pr as useDisplayModePersistence,
|
|
3818
|
+
mr as useIsMobile,
|
|
3819
|
+
er as useLiveKitSession,
|
|
3820
|
+
lr as useMediaDevices,
|
|
3821
|
+
nr as useMicrophoneState,
|
|
3822
|
+
yr as usePathname,
|
|
3823
|
+
_i as useRegisterFields,
|
|
3824
|
+
Lr as useRouteMatch,
|
|
3825
|
+
or as useScreenShareState,
|
|
3826
|
+
Di as useTranscript
|
|
3754
3827
|
};
|