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