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