@livelayer/react 0.5.5-pr66c.3 → 0.5.5-pr66c.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -2
- package/dist/index.mjs +280 -280
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as w, jsx as n, Fragment as ut } from "react/jsx-runtime";
|
|
3
|
-
import { Component as dn, useState as S, useRef as E, useEffect as
|
|
3
|
+
import { Component as dn, useState as S, useRef as E, useEffect as P, useCallback as k, useMemo as Ze, forwardRef as ft, createElement as un } from "react";
|
|
4
4
|
import { LiveKitSession as fn } from "@livelayer/sdk";
|
|
5
5
|
import { createLocalAudioTrack as pn, Track as jt, createLocalVideoTrack as hn } from "livekit-client";
|
|
6
6
|
class mn extends dn {
|
|
@@ -13,8 +13,8 @@ class mn extends dn {
|
|
|
13
13
|
return { hasError: !0, error: t };
|
|
14
14
|
}
|
|
15
15
|
componentDidCatch(t, r) {
|
|
16
|
-
var
|
|
17
|
-
(
|
|
16
|
+
var i, o;
|
|
17
|
+
(o = (i = this.props).onError) == null || o.call(i, t, r);
|
|
18
18
|
}
|
|
19
19
|
render() {
|
|
20
20
|
var t;
|
|
@@ -34,13 +34,13 @@ class mn extends dn {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
function gn(e) {
|
|
37
|
-
const [t, r] = S("idle"), [
|
|
38
|
-
H.current = e.onDataMessage,
|
|
37
|
+
const [t, r] = S("idle"), [i, o] = S("idle"), [l, c] = S([]), [d, u] = S(null), [m, h] = S(null), [a, s] = S(null), [R, C] = S(!1), [L, v] = S(null), b = E(null), H = E(e.onDataMessage);
|
|
38
|
+
H.current = e.onDataMessage, P(() => {
|
|
39
39
|
const N = {
|
|
40
40
|
onConnectionStateChange: ($) => {
|
|
41
41
|
r($), $ === "connected" && v(null);
|
|
42
42
|
},
|
|
43
|
-
onAgentStateChange:
|
|
43
|
+
onAgentStateChange: o,
|
|
44
44
|
onTranscript: ($) => c([...$]),
|
|
45
45
|
onAgentConfig: u,
|
|
46
46
|
onAudioTrack: ($) => s($),
|
|
@@ -62,7 +62,7 @@ function gn(e) {
|
|
|
62
62
|
},
|
|
63
63
|
N
|
|
64
64
|
);
|
|
65
|
-
return b.current = B, r("idle"),
|
|
65
|
+
return b.current = B, r("idle"), o("idle"), c([]), u(null), h(null), s(null), C(!1), v(null), () => {
|
|
66
66
|
var $;
|
|
67
67
|
($ = B.destroy) == null || $.call(B), b.current = null;
|
|
68
68
|
};
|
|
@@ -90,7 +90,7 @@ function gn(e) {
|
|
|
90
90
|
}, []);
|
|
91
91
|
return {
|
|
92
92
|
connectionState: t,
|
|
93
|
-
agentState:
|
|
93
|
+
agentState: i,
|
|
94
94
|
transcript: l,
|
|
95
95
|
agentConfig: d,
|
|
96
96
|
videoElement: m,
|
|
@@ -104,10 +104,10 @@ function gn(e) {
|
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
function yn() {
|
|
107
|
-
const e = E(null), t = E(null), r = E(null),
|
|
107
|
+
const e = E(null), t = E(null), r = E(null), i = E(null), o = E(/* @__PURE__ */ new Set()), l = E(null), c = k(() => {
|
|
108
108
|
const a = t.current;
|
|
109
109
|
if (!a) {
|
|
110
|
-
|
|
110
|
+
i.current = null;
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
113
|
(!l.current || l.current.length !== a.frequencyBinCount) && (l.current = new Uint8Array(
|
|
@@ -118,13 +118,13 @@ function yn() {
|
|
|
118
118
|
let R = 0;
|
|
119
119
|
for (let L = 0; L < s.length; L++) R += s[L];
|
|
120
120
|
const C = R / s.length / 255;
|
|
121
|
-
for (const L of
|
|
121
|
+
for (const L of o.current)
|
|
122
122
|
try {
|
|
123
123
|
L(C);
|
|
124
124
|
} catch (v) {
|
|
125
125
|
console.error("[useAudioLevel] subscriber threw:", v);
|
|
126
126
|
}
|
|
127
|
-
|
|
127
|
+
i.current = requestAnimationFrame(c);
|
|
128
128
|
}, []), d = k(() => {
|
|
129
129
|
if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
|
|
130
130
|
const a = new AudioContext(), s = a.createAnalyser();
|
|
@@ -146,22 +146,22 @@ function yn() {
|
|
|
146
146
|
console.warn("[useAudioLevel] createMediaElementSource failed:", s);
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
|
-
|
|
149
|
+
i.current === null && (i.current = requestAnimationFrame(c));
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
152
|
[d, c]
|
|
153
153
|
), m = k(() => {
|
|
154
|
-
if (
|
|
154
|
+
if (i.current !== null && (cancelAnimationFrame(i.current), i.current = null), r.current) {
|
|
155
155
|
try {
|
|
156
156
|
r.current.disconnect();
|
|
157
157
|
} catch {
|
|
158
158
|
}
|
|
159
159
|
r.current = null;
|
|
160
160
|
}
|
|
161
|
-
}, []), h = k((a) => (
|
|
162
|
-
|
|
161
|
+
}, []), h = k((a) => (o.current.add(a), () => {
|
|
162
|
+
o.current.delete(a);
|
|
163
163
|
}), []);
|
|
164
|
-
return
|
|
164
|
+
return P(() => () => {
|
|
165
165
|
if (m(), t.current) {
|
|
166
166
|
try {
|
|
167
167
|
t.current.disconnect();
|
|
@@ -176,34 +176,34 @@ function yn() {
|
|
|
176
176
|
}
|
|
177
177
|
e.current = null;
|
|
178
178
|
}
|
|
179
|
-
|
|
179
|
+
o.current.clear(), l.current = null;
|
|
180
180
|
}, [m]), { attach: u, detach: m, subscribe: h };
|
|
181
181
|
}
|
|
182
182
|
function vn() {
|
|
183
|
-
const [e, t] = S(!1), [r,
|
|
184
|
-
if (
|
|
183
|
+
const [e, t] = S(!1), [r, i] = S(null), o = E(null), l = E(null), c = k(async (h) => {
|
|
184
|
+
if (o.current && l.current) {
|
|
185
185
|
try {
|
|
186
|
-
await l.current.localParticipant.unpublishTrack(
|
|
186
|
+
await l.current.localParticipant.unpublishTrack(o.current);
|
|
187
187
|
} catch {
|
|
188
188
|
}
|
|
189
|
-
|
|
189
|
+
o.current.stop(), o.current = null;
|
|
190
190
|
}
|
|
191
|
-
l.current = h,
|
|
191
|
+
l.current = h, i(null);
|
|
192
192
|
try {
|
|
193
193
|
const a = await pn({
|
|
194
194
|
echoCancellation: !0,
|
|
195
195
|
noiseSuppression: !0
|
|
196
196
|
});
|
|
197
|
-
await h.localParticipant.publishTrack(a),
|
|
197
|
+
await h.localParticipant.publishTrack(a), o.current = a, t(a.isMuted);
|
|
198
198
|
} catch (a) {
|
|
199
199
|
const s = a instanceof Error && a.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
|
|
200
|
-
throw
|
|
200
|
+
throw i(s), a;
|
|
201
201
|
}
|
|
202
202
|
}, []), d = k(() => {
|
|
203
|
-
const h =
|
|
203
|
+
const h = o.current;
|
|
204
204
|
h && (h.isMuted ? (h.unmute(), t(!1)) : (h.mute(), t(!0)));
|
|
205
205
|
}, []), u = k(() => {
|
|
206
|
-
const h =
|
|
206
|
+
const h = o.current, a = l.current;
|
|
207
207
|
if (h && a) {
|
|
208
208
|
try {
|
|
209
209
|
a.localParticipant.unpublishTrack(h);
|
|
@@ -211,8 +211,8 @@ function vn() {
|
|
|
211
211
|
}
|
|
212
212
|
h.stop();
|
|
213
213
|
}
|
|
214
|
-
|
|
215
|
-
}, []), m = k(() =>
|
|
214
|
+
o.current = null, l.current = null, t(!1);
|
|
215
|
+
}, []), m = k(() => i(null), []);
|
|
216
216
|
return {
|
|
217
217
|
isMuted: e,
|
|
218
218
|
micError: r,
|
|
@@ -224,7 +224,7 @@ function vn() {
|
|
|
224
224
|
}
|
|
225
225
|
const bn = { resolution: { width: 640, height: 480, frameRate: 24 } };
|
|
226
226
|
function wn() {
|
|
227
|
-
const [e, t] = S(!1), [r,
|
|
227
|
+
const [e, t] = S(!1), [r, i] = S(null), [o, l] = S(null), [c, d] = S(""), u = E(null), m = E(null), h = k((b) => {
|
|
228
228
|
u.current = b;
|
|
229
229
|
}, []), a = k(() => {
|
|
230
230
|
const b = u.current, H = m.current;
|
|
@@ -243,7 +243,7 @@ function wn() {
|
|
|
243
243
|
}, []), s = k(async (b) => {
|
|
244
244
|
const H = u.current;
|
|
245
245
|
if (H) {
|
|
246
|
-
|
|
246
|
+
i(null);
|
|
247
247
|
try {
|
|
248
248
|
const I = { ...bn };
|
|
249
249
|
b && (I.deviceId = b);
|
|
@@ -260,7 +260,7 @@ function wn() {
|
|
|
260
260
|
}
|
|
261
261
|
} catch (I) {
|
|
262
262
|
const O = I instanceof Error && I.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
|
|
263
|
-
|
|
263
|
+
i(O);
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
}, []), R = k(async () => {
|
|
@@ -268,14 +268,14 @@ function wn() {
|
|
|
268
268
|
}, [e, c, a, s]), C = k(async (b) => {
|
|
269
269
|
a(), await s(b);
|
|
270
270
|
}, [a, s]), L = k(() => {
|
|
271
|
-
a(), u.current = null,
|
|
272
|
-
}, [a]), v = k(() =>
|
|
273
|
-
return
|
|
271
|
+
a(), u.current = null, i(null), d("");
|
|
272
|
+
}, [a]), v = k(() => i(null), []);
|
|
273
|
+
return P(() => () => {
|
|
274
274
|
m.current && m.current.stop();
|
|
275
275
|
}, []), {
|
|
276
276
|
isEnabled: e,
|
|
277
277
|
error: r,
|
|
278
|
-
previewEl:
|
|
278
|
+
previewEl: o,
|
|
279
279
|
activeDeviceId: c,
|
|
280
280
|
toggle: R,
|
|
281
281
|
switchDevice: C,
|
|
@@ -285,7 +285,7 @@ function wn() {
|
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
287
|
function _n() {
|
|
288
|
-
const [e, t] = S(!1), [r,
|
|
288
|
+
const [e, t] = S(!1), [r, i] = S(null), [o, l] = S(null), c = E(null), d = k((s) => {
|
|
289
289
|
c.current = s;
|
|
290
290
|
}, []), u = k(() => l(null), []), m = k(async () => {
|
|
291
291
|
const s = c.current;
|
|
@@ -298,7 +298,7 @@ function _n() {
|
|
|
298
298
|
u(), t(!1);
|
|
299
299
|
return;
|
|
300
300
|
}
|
|
301
|
-
|
|
301
|
+
i(null);
|
|
302
302
|
try {
|
|
303
303
|
await s.localParticipant.setScreenShareEnabled(!0);
|
|
304
304
|
let R = 0;
|
|
@@ -321,7 +321,7 @@ function _n() {
|
|
|
321
321
|
C();
|
|
322
322
|
} catch (R) {
|
|
323
323
|
const C = R instanceof Error ? R.name : "";
|
|
324
|
-
C !== "NotAllowedError" && C !== "AbortError" &&
|
|
324
|
+
C !== "NotAllowedError" && C !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
}, [e, u]), h = k(() => {
|
|
@@ -331,28 +331,28 @@ function _n() {
|
|
|
331
331
|
s.localParticipant.setScreenShareEnabled(!1);
|
|
332
332
|
} catch {
|
|
333
333
|
}
|
|
334
|
-
u(), t(!1),
|
|
335
|
-
}, [e, u]), a = k(() =>
|
|
336
|
-
return { isEnabled: e, error: r, previewEl:
|
|
334
|
+
u(), t(!1), i(null), c.current = null;
|
|
335
|
+
}, [e, u]), a = k(() => i(null), []);
|
|
336
|
+
return { isEnabled: e, error: r, previewEl: o, toggle: m, attachRoom: d, teardown: h, clearError: a };
|
|
337
337
|
}
|
|
338
338
|
function xn() {
|
|
339
|
-
const [e, t] = S([]), [r,
|
|
339
|
+
const [e, t] = S([]), [r, i] = S([]), o = k(async () => {
|
|
340
340
|
if (!(typeof navigator > "u" || !navigator.mediaDevices))
|
|
341
341
|
try {
|
|
342
342
|
const l = await navigator.mediaDevices.enumerateDevices();
|
|
343
|
-
t(l.filter((c) => c.kind === "audioinput")),
|
|
343
|
+
t(l.filter((c) => c.kind === "audioinput")), i(l.filter((c) => c.kind === "videoinput"));
|
|
344
344
|
} catch {
|
|
345
345
|
}
|
|
346
346
|
}, []);
|
|
347
|
-
return
|
|
348
|
-
if (
|
|
349
|
-
const l = () => void
|
|
347
|
+
return P(() => {
|
|
348
|
+
if (o(), typeof navigator > "u" || !navigator.mediaDevices) return;
|
|
349
|
+
const l = () => void o();
|
|
350
350
|
return navigator.mediaDevices.addEventListener("devicechange", l), () => navigator.mediaDevices.removeEventListener("devicechange", l);
|
|
351
|
-
}, [
|
|
351
|
+
}, [o]), { mics: e, cameras: r, refresh: o };
|
|
352
352
|
}
|
|
353
353
|
function kn(e, t, r = !1) {
|
|
354
|
-
const [
|
|
355
|
-
return
|
|
354
|
+
const [i, o] = S(null), [l, c] = S(null), [d, u] = S(!r && !!e);
|
|
355
|
+
return P(() => {
|
|
356
356
|
if (r || !e) {
|
|
357
357
|
u(!1);
|
|
358
358
|
return;
|
|
@@ -367,11 +367,11 @@ function kn(e, t, r = !1) {
|
|
|
367
367
|
}
|
|
368
368
|
return a.json();
|
|
369
369
|
}).then((a) => {
|
|
370
|
-
m.signal.aborted || (
|
|
370
|
+
m.signal.aborted || (o(a), u(!1));
|
|
371
371
|
}).catch((a) => {
|
|
372
372
|
m.signal.aborted || (c(a instanceof Error ? a.message : "Agent lookup failed"), u(!1));
|
|
373
373
|
}), () => m.abort();
|
|
374
|
-
}, [e, t, r]), { info:
|
|
374
|
+
}, [e, t, r]), { info: i, error: l, loading: d };
|
|
375
375
|
}
|
|
376
376
|
function Ln(e) {
|
|
377
377
|
if (typeof window > "u") return null;
|
|
@@ -393,11 +393,11 @@ function Cn({
|
|
|
393
393
|
defaultValue: t = "expanded",
|
|
394
394
|
onChange: r
|
|
395
395
|
} = {}) {
|
|
396
|
-
const
|
|
396
|
+
const i = e !== void 0, [o, l] = S(t), c = i ? e : o, d = k(
|
|
397
397
|
(u) => {
|
|
398
|
-
u !== c && (
|
|
398
|
+
u !== c && (i || l(u), r == null || r(u));
|
|
399
399
|
},
|
|
400
|
-
[c,
|
|
400
|
+
[c, i, r]
|
|
401
401
|
);
|
|
402
402
|
return [c, d];
|
|
403
403
|
}
|
|
@@ -409,18 +409,18 @@ function An({
|
|
|
409
409
|
value: e,
|
|
410
410
|
defaultValue: t = "expanded",
|
|
411
411
|
onChange: r,
|
|
412
|
-
persistKey:
|
|
413
|
-
disablePersistence:
|
|
412
|
+
persistKey: i = "ll-widget",
|
|
413
|
+
disablePersistence: o = !1
|
|
414
414
|
} = {}) {
|
|
415
|
-
const l = `${
|
|
415
|
+
const l = `${i}:display-mode`, c = E(!1), [d, u] = Cn({
|
|
416
416
|
value: e,
|
|
417
417
|
defaultValue: t,
|
|
418
418
|
onChange: (m) => {
|
|
419
|
-
e === void 0 && !
|
|
419
|
+
e === void 0 && !o && Sn(l, m), r == null || r(m);
|
|
420
420
|
}
|
|
421
421
|
});
|
|
422
|
-
return
|
|
423
|
-
if (c.current || (c.current = !0,
|
|
422
|
+
return P(() => {
|
|
423
|
+
if (c.current || (c.current = !0, o || e !== void 0)) return;
|
|
424
424
|
const m = Nn(Ln(l));
|
|
425
425
|
m && m !== d && u(m);
|
|
426
426
|
}, []), [d, u];
|
|
@@ -428,16 +428,16 @@ function An({
|
|
|
428
428
|
const Rn = 640;
|
|
429
429
|
function In(e = Rn) {
|
|
430
430
|
const [t, r] = S(!1);
|
|
431
|
-
return
|
|
431
|
+
return P(() => {
|
|
432
432
|
if (e === !1) {
|
|
433
433
|
r(!1);
|
|
434
434
|
return;
|
|
435
435
|
}
|
|
436
436
|
if (typeof window > "u" || typeof window.matchMedia > "u")
|
|
437
437
|
return;
|
|
438
|
-
const
|
|
439
|
-
return l(), typeof
|
|
440
|
-
|
|
438
|
+
const i = `(max-width: ${e - 1}px)`, o = window.matchMedia(i), l = () => r(o.matches);
|
|
439
|
+
return l(), typeof o.addEventListener == "function" ? (o.addEventListener("change", l), () => o.removeEventListener("change", l)) : (o.addListener(l), () => {
|
|
440
|
+
o.removeListener(l);
|
|
441
441
|
});
|
|
442
442
|
}, [e]), t;
|
|
443
443
|
}
|
|
@@ -446,11 +446,11 @@ function Mn() {
|
|
|
446
446
|
if (typeof window > "u" || window.history[Nt]) return;
|
|
447
447
|
const e = window.history.pushState, t = window.history.replaceState;
|
|
448
448
|
window.history.pushState = function(...r) {
|
|
449
|
-
const
|
|
450
|
-
return window.dispatchEvent(new Event(et)),
|
|
449
|
+
const i = e.apply(this, r);
|
|
450
|
+
return window.dispatchEvent(new Event(et)), i;
|
|
451
451
|
}, window.history.replaceState = function(...r) {
|
|
452
|
-
const
|
|
453
|
-
return window.dispatchEvent(new Event(et)),
|
|
452
|
+
const i = t.apply(this, r);
|
|
453
|
+
return window.dispatchEvent(new Event(et)), i;
|
|
454
454
|
}, window.history[Nt] = !0;
|
|
455
455
|
}
|
|
456
456
|
function At() {
|
|
@@ -460,12 +460,12 @@ function Tn(e) {
|
|
|
460
460
|
const [t, r] = S(
|
|
461
461
|
() => e ?? At()
|
|
462
462
|
);
|
|
463
|
-
return
|
|
463
|
+
return P(() => {
|
|
464
464
|
if (e !== void 0) return;
|
|
465
465
|
Mn();
|
|
466
|
-
const
|
|
467
|
-
return
|
|
468
|
-
window.removeEventListener("popstate",
|
|
466
|
+
const i = () => r(At());
|
|
467
|
+
return i(), window.addEventListener("popstate", i), window.addEventListener(et, i), () => {
|
|
468
|
+
window.removeEventListener("popstate", i), window.removeEventListener(et, i);
|
|
469
469
|
};
|
|
470
470
|
}, [e]), e ?? t;
|
|
471
471
|
}
|
|
@@ -476,7 +476,7 @@ function Dn(e) {
|
|
|
476
476
|
function $n(e) {
|
|
477
477
|
const t = Rt.get(e);
|
|
478
478
|
if (t) return t;
|
|
479
|
-
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e,
|
|
479
|
+
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", o = "", l = r.replace(/\*\*/g, i).replace(/\*/g, o), d = Dn(l).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(o, "g"), "[^/]+"), u = new RegExp(`^${d}\\/?$`);
|
|
480
480
|
return Rt.set(e, u), u;
|
|
481
481
|
}
|
|
482
482
|
function zn(e, t) {
|
|
@@ -620,26 +620,26 @@ const Vn = ({
|
|
|
620
620
|
position: e,
|
|
621
621
|
isMobile: t,
|
|
622
622
|
isSpeaking: r,
|
|
623
|
-
onExpand:
|
|
624
|
-
label:
|
|
623
|
+
onExpand: i,
|
|
624
|
+
label: o = "Open widget",
|
|
625
625
|
avatarImageUrl: l,
|
|
626
626
|
agentName: c
|
|
627
627
|
}) => {
|
|
628
628
|
const d = Fn(e), u = d === "right" ? "left" : "right", m = t ? 80 : 72, h = !!l, [a, s] = S(null), [R, C] = S(!1), L = E(null), v = E(!1), b = k(
|
|
629
629
|
(A) => {
|
|
630
630
|
if (typeof window > "u") return A;
|
|
631
|
-
const
|
|
631
|
+
const T = m / 2, W = Dt + T, V = window.innerHeight - Dt - T;
|
|
632
632
|
return V < W ? Math.max(W, A) : Math.max(W, Math.min(V, A));
|
|
633
633
|
},
|
|
634
634
|
[m]
|
|
635
635
|
);
|
|
636
|
-
|
|
636
|
+
P(() => {
|
|
637
637
|
const A = jn();
|
|
638
638
|
s(b(A ?? window.innerHeight / 2));
|
|
639
|
-
const
|
|
639
|
+
const T = () => {
|
|
640
640
|
s((W) => W === null ? null : b(W));
|
|
641
641
|
};
|
|
642
|
-
return window.addEventListener("resize",
|
|
642
|
+
return window.addEventListener("resize", T), () => window.removeEventListener("resize", T);
|
|
643
643
|
}, [b]);
|
|
644
644
|
const H = k(
|
|
645
645
|
(A) => {
|
|
@@ -658,21 +658,21 @@ const Vn = ({
|
|
|
658
658
|
[a]
|
|
659
659
|
), I = k(
|
|
660
660
|
(A) => {
|
|
661
|
-
const
|
|
662
|
-
if (!
|
|
663
|
-
const W = A.clientY -
|
|
664
|
-
!
|
|
661
|
+
const T = L.current;
|
|
662
|
+
if (!T) return;
|
|
663
|
+
const W = A.clientY - T.startClientY;
|
|
664
|
+
!T.moved && Math.abs(W) > Un && (T.moved = !0, C(!0)), T.moved && s(b(T.startCenterY + W));
|
|
665
665
|
},
|
|
666
666
|
[b]
|
|
667
667
|
), O = k(
|
|
668
668
|
(A) => {
|
|
669
|
-
const
|
|
670
|
-
if (
|
|
669
|
+
const T = L.current;
|
|
670
|
+
if (T) {
|
|
671
671
|
try {
|
|
672
672
|
A.currentTarget.releasePointerCapture(A.pointerId);
|
|
673
673
|
} catch {
|
|
674
674
|
}
|
|
675
|
-
L.current = null,
|
|
675
|
+
L.current = null, T.moved && (C(!1), v.current = !0, s((W) => (W !== null && $t(W), W)));
|
|
676
676
|
}
|
|
677
677
|
},
|
|
678
678
|
[]
|
|
@@ -681,15 +681,15 @@ const Vn = ({
|
|
|
681
681
|
v.current = !1;
|
|
682
682
|
return;
|
|
683
683
|
}
|
|
684
|
-
|
|
685
|
-
}, [
|
|
684
|
+
i();
|
|
685
|
+
}, [i]), N = k(
|
|
686
686
|
(A) => {
|
|
687
687
|
if (A.key === "ArrowUp" || A.key === "ArrowDown") {
|
|
688
688
|
A.preventDefault();
|
|
689
|
-
const
|
|
689
|
+
const T = A.key === "ArrowUp" ? -8 : 8;
|
|
690
690
|
s((W) => {
|
|
691
691
|
if (W === null) return W;
|
|
692
|
-
const V = b(W +
|
|
692
|
+
const V = b(W + T);
|
|
693
693
|
return $t(V), V;
|
|
694
694
|
});
|
|
695
695
|
}
|
|
@@ -714,7 +714,7 @@ const Vn = ({
|
|
|
714
714
|
onPointerCancel: O,
|
|
715
715
|
onClick: p,
|
|
716
716
|
onKeyDown: N,
|
|
717
|
-
"aria-label":
|
|
717
|
+
"aria-label": o,
|
|
718
718
|
"data-position": e,
|
|
719
719
|
style: $,
|
|
720
720
|
children: h ? (
|
|
@@ -753,23 +753,23 @@ const Vn = ({
|
|
|
753
753
|
audioLevel: e,
|
|
754
754
|
bars: t = 20,
|
|
755
755
|
maxHeight: r = 20,
|
|
756
|
-
minHeight:
|
|
757
|
-
className:
|
|
756
|
+
minHeight: i = 4,
|
|
757
|
+
className: o,
|
|
758
758
|
barClassName: l
|
|
759
759
|
}) => {
|
|
760
760
|
const c = E(null), d = E([]), u = Ze(() => {
|
|
761
761
|
const h = (Math.sqrt(5) - 1) / 2;
|
|
762
762
|
return Array.from({ length: t }, (a, s) => 0.5 + s * h % 1 * 0.5);
|
|
763
763
|
}, [t]);
|
|
764
|
-
|
|
764
|
+
P(() => e.subscribe((a) => {
|
|
765
765
|
for (let s = 0; s < t; s++) {
|
|
766
766
|
const R = d.current[s];
|
|
767
767
|
if (!R) continue;
|
|
768
|
-
const C = Math.max(
|
|
768
|
+
const C = Math.max(i, a * r * u[s]);
|
|
769
769
|
R.style.height = `${C}px`;
|
|
770
770
|
}
|
|
771
|
-
}), [e, t, r,
|
|
772
|
-
const m = ["ll-waveform",
|
|
771
|
+
}), [e, t, r, i, u]);
|
|
772
|
+
const m = ["ll-waveform", o].filter(Boolean).join(" ");
|
|
773
773
|
return /* @__PURE__ */ n("div", { ref: c, className: m, "aria-hidden": "true", children: Array.from({ length: t }, (h, a) => /* @__PURE__ */ n(
|
|
774
774
|
"div",
|
|
775
775
|
{
|
|
@@ -777,7 +777,7 @@ const Vn = ({
|
|
|
777
777
|
d.current[a] = s;
|
|
778
778
|
},
|
|
779
779
|
className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
|
|
780
|
-
style: { height: `${
|
|
780
|
+
style: { height: `${i}px` }
|
|
781
781
|
},
|
|
782
782
|
a
|
|
783
783
|
)) });
|
|
@@ -785,8 +785,8 @@ const Vn = ({
|
|
|
785
785
|
position: e,
|
|
786
786
|
isMobile: t,
|
|
787
787
|
agentName: r,
|
|
788
|
-
avatarImageUrl:
|
|
789
|
-
agentState:
|
|
788
|
+
avatarImageUrl: i,
|
|
789
|
+
agentState: o,
|
|
790
790
|
isMuted: l,
|
|
791
791
|
audioLevel: c,
|
|
792
792
|
onExpand: d,
|
|
@@ -806,12 +806,12 @@ const Vn = ({
|
|
|
806
806
|
onClick: d,
|
|
807
807
|
"aria-label": `Expand ${r} widget`,
|
|
808
808
|
children: [
|
|
809
|
-
|
|
809
|
+
i ? (
|
|
810
810
|
// eslint-disable-next-line @next/next/no-img-element
|
|
811
811
|
/* @__PURE__ */ n(
|
|
812
812
|
"img",
|
|
813
813
|
{
|
|
814
|
-
src:
|
|
814
|
+
src: i,
|
|
815
815
|
alt: r,
|
|
816
816
|
className: "ll-minimized__avatar"
|
|
817
817
|
}
|
|
@@ -858,12 +858,12 @@ const Vn = ({
|
|
|
858
858
|
role: "region",
|
|
859
859
|
"aria-label": `${r} widget`,
|
|
860
860
|
children: /* @__PURE__ */ w("div", { className: "ll-minimized__surface", children: [
|
|
861
|
-
|
|
861
|
+
i ? (
|
|
862
862
|
// eslint-disable-next-line @next/next/no-img-element
|
|
863
863
|
/* @__PURE__ */ n(
|
|
864
864
|
"img",
|
|
865
865
|
{
|
|
866
|
-
src:
|
|
866
|
+
src: i,
|
|
867
867
|
alt: r,
|
|
868
868
|
className: "ll-minimized__avatar"
|
|
869
869
|
}
|
|
@@ -871,7 +871,7 @@ const Vn = ({
|
|
|
871
871
|
) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
|
|
872
872
|
/* @__PURE__ */ w("div", { className: "ll-minimized__meta", children: [
|
|
873
873
|
/* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
|
|
874
|
-
/* @__PURE__ */ n("span", { className: "ll-minimized__state", children:
|
|
874
|
+
/* @__PURE__ */ n("span", { className: "ll-minimized__state", children: o === "speaking" ? "Speaking" : o === "thinking" ? "Thinking" : "Listening" })
|
|
875
875
|
] }),
|
|
876
876
|
/* @__PURE__ */ w("div", { className: "ll-minimized__controls", children: [
|
|
877
877
|
/* @__PURE__ */ n(
|
|
@@ -911,11 +911,11 @@ const Vn = ({
|
|
|
911
911
|
src: e,
|
|
912
912
|
alt: t,
|
|
913
913
|
preCannedPlaying: r = !1,
|
|
914
|
-
className:
|
|
915
|
-
style:
|
|
914
|
+
className: i,
|
|
915
|
+
style: o
|
|
916
916
|
}) => {
|
|
917
917
|
const [l, c] = S(!1), d = E(e);
|
|
918
|
-
if (
|
|
918
|
+
if (P(() => {
|
|
919
919
|
d.current !== e && (d.current = e, c(!1));
|
|
920
920
|
}, [e]), !e) return null;
|
|
921
921
|
const u = {
|
|
@@ -928,7 +928,7 @@ const Vn = ({
|
|
|
928
928
|
transition: "opacity 500ms ease, transform 500ms ease",
|
|
929
929
|
transform: r ? "scale(1.02)" : "scale(1)",
|
|
930
930
|
opacity: l ? 1 : 0,
|
|
931
|
-
...
|
|
931
|
+
...o
|
|
932
932
|
};
|
|
933
933
|
return (
|
|
934
934
|
// eslint-disable-next-line @next/next/no-img-element
|
|
@@ -937,7 +937,7 @@ const Vn = ({
|
|
|
937
937
|
{
|
|
938
938
|
src: e,
|
|
939
939
|
alt: t,
|
|
940
|
-
className:
|
|
940
|
+
className: i,
|
|
941
941
|
style: u,
|
|
942
942
|
loading: "eager",
|
|
943
943
|
fetchPriority: "high",
|
|
@@ -949,8 +949,8 @@ const Vn = ({
|
|
|
949
949
|
position: e,
|
|
950
950
|
isMobile: t,
|
|
951
951
|
agentName: r,
|
|
952
|
-
avatarImageUrl:
|
|
953
|
-
idleLoopUrl:
|
|
952
|
+
avatarImageUrl: i,
|
|
953
|
+
idleLoopUrl: o,
|
|
954
954
|
greeting: l,
|
|
955
955
|
branding: c,
|
|
956
956
|
teamMembers: d,
|
|
@@ -972,11 +972,11 @@ const Vn = ({
|
|
|
972
972
|
micDevices: B,
|
|
973
973
|
isCameraEnabled: $,
|
|
974
974
|
cameraPreviewEl: A,
|
|
975
|
-
cameraDevices:
|
|
975
|
+
cameraDevices: T,
|
|
976
976
|
activeCameraId: W,
|
|
977
977
|
isScreenShareEnabled: V,
|
|
978
|
-
screenPreviewEl:
|
|
979
|
-
isSpeakerMuted:
|
|
978
|
+
screenPreviewEl: ne,
|
|
979
|
+
isSpeakerMuted: ee,
|
|
980
980
|
allowCamera: ve,
|
|
981
981
|
allowScreenShare: ae,
|
|
982
982
|
allowTyping: pe,
|
|
@@ -997,33 +997,33 @@ const Vn = ({
|
|
|
997
997
|
}) => {
|
|
998
998
|
var Ae;
|
|
999
999
|
const he = b.length > 0 ? b[b.length - 1] : null, de = ((d == null ? void 0 : d.length) ?? 0) > 1, Ee = L === "connecting" || L === "connected", Ne = L === "connected", be = L === "idle" || L === "disconnected" || L === "error", G = E(null), Pe = E(null);
|
|
1000
|
-
|
|
1000
|
+
P(() => {
|
|
1001
1001
|
const y = G.current;
|
|
1002
1002
|
y && (y.innerHTML = "", A && (A.style.width = "100%", A.style.height = "100%", A.style.objectFit = "cover", A.style.transform = "scaleX(-1)", y.appendChild(A)));
|
|
1003
|
-
}, [A]),
|
|
1003
|
+
}, [A]), P(() => {
|
|
1004
1004
|
const y = Pe.current;
|
|
1005
|
-
y && (y.innerHTML = "",
|
|
1006
|
-
}, [
|
|
1007
|
-
const [
|
|
1008
|
-
|
|
1009
|
-
if (!
|
|
1005
|
+
y && (y.innerHTML = "", ne && (ne.style.width = "100%", ne.style.height = "100%", ne.style.objectFit = "contain", y.appendChild(ne)));
|
|
1006
|
+
}, [ne]);
|
|
1007
|
+
const [ie, te] = S(!1), [ue, me] = S(!1);
|
|
1008
|
+
P(() => {
|
|
1009
|
+
if (!ie && !ue && !R && !h) return;
|
|
1010
1010
|
const y = () => {
|
|
1011
|
-
|
|
1011
|
+
te(!1), me(!1), R && C(), h && a();
|
|
1012
1012
|
};
|
|
1013
1013
|
return document.addEventListener("click", y), () => document.removeEventListener("click", y);
|
|
1014
1014
|
}, [
|
|
1015
|
-
|
|
1015
|
+
ie,
|
|
1016
1016
|
ue,
|
|
1017
1017
|
R,
|
|
1018
1018
|
h,
|
|
1019
1019
|
C,
|
|
1020
1020
|
a
|
|
1021
1021
|
]);
|
|
1022
|
-
const [Q,
|
|
1022
|
+
const [Q, oe] = S(""), we = k(
|
|
1023
1023
|
(y) => {
|
|
1024
1024
|
y.preventDefault();
|
|
1025
1025
|
const J = Q.trim();
|
|
1026
|
-
J && (We(J),
|
|
1026
|
+
J && (We(J), oe(""));
|
|
1027
1027
|
},
|
|
1028
1028
|
[Q, We]
|
|
1029
1029
|
), De = c.productName || "Live Layer", Ve = Ne && (he != null && he.text) ? he.text : l || "", $e = [
|
|
@@ -1040,19 +1040,19 @@ const Vn = ({
|
|
|
1040
1040
|
"aria-label": `${r} widget`,
|
|
1041
1041
|
children: [
|
|
1042
1042
|
/* @__PURE__ */ w("div", { className: "ll-expanded__bg", children: [
|
|
1043
|
-
|
|
1043
|
+
i ? /* @__PURE__ */ n(
|
|
1044
1044
|
Gn,
|
|
1045
1045
|
{
|
|
1046
|
-
src:
|
|
1046
|
+
src: i,
|
|
1047
1047
|
alt: r,
|
|
1048
1048
|
className: "ll-expanded__bg-img"
|
|
1049
1049
|
}
|
|
1050
1050
|
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Ae = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Ae.toUpperCase()) || "A" }) }),
|
|
1051
|
-
|
|
1051
|
+
o && !Ne && /* @__PURE__ */ n(
|
|
1052
1052
|
"video",
|
|
1053
1053
|
{
|
|
1054
1054
|
className: "ll-expanded__bg-idle",
|
|
1055
|
-
src:
|
|
1055
|
+
src: o,
|
|
1056
1056
|
autoPlay: !0,
|
|
1057
1057
|
loop: !0,
|
|
1058
1058
|
muted: !0,
|
|
@@ -1312,7 +1312,7 @@ const Vn = ({
|
|
|
1312
1312
|
type: "button",
|
|
1313
1313
|
className: `ll-tool ll-tool--right ${$ ? "is-on" : ""}`,
|
|
1314
1314
|
onClick: (y) => {
|
|
1315
|
-
y.stopPropagation(), me((J) => !J),
|
|
1315
|
+
y.stopPropagation(), me((J) => !J), te(!1);
|
|
1316
1316
|
},
|
|
1317
1317
|
"aria-label": "Camera devices",
|
|
1318
1318
|
"aria-haspopup": "listbox",
|
|
@@ -1320,11 +1320,11 @@ const Vn = ({
|
|
|
1320
1320
|
children: /* @__PURE__ */ n(Ke, {})
|
|
1321
1321
|
}
|
|
1322
1322
|
),
|
|
1323
|
-
ue &&
|
|
1323
|
+
ue && T.length > 0 && /* @__PURE__ */ n(
|
|
1324
1324
|
Ot,
|
|
1325
1325
|
{
|
|
1326
1326
|
label: "Camera",
|
|
1327
|
-
devices:
|
|
1327
|
+
devices: T,
|
|
1328
1328
|
activeId: W,
|
|
1329
1329
|
onPick: (y) => {
|
|
1330
1330
|
me(!1), Se(y);
|
|
@@ -1350,21 +1350,21 @@ const Vn = ({
|
|
|
1350
1350
|
type: "button",
|
|
1351
1351
|
className: `ll-tool ll-tool--right ${p ? "is-muted" : ""}`,
|
|
1352
1352
|
onClick: (y) => {
|
|
1353
|
-
y.stopPropagation(),
|
|
1353
|
+
y.stopPropagation(), te((J) => !J), me(!1);
|
|
1354
1354
|
},
|
|
1355
1355
|
"aria-label": "Microphone devices",
|
|
1356
1356
|
"aria-haspopup": "listbox",
|
|
1357
|
-
"aria-expanded":
|
|
1357
|
+
"aria-expanded": ie,
|
|
1358
1358
|
children: /* @__PURE__ */ n(Ke, {})
|
|
1359
1359
|
}
|
|
1360
1360
|
),
|
|
1361
|
-
|
|
1361
|
+
ie && B.length > 0 && /* @__PURE__ */ n(
|
|
1362
1362
|
Ot,
|
|
1363
1363
|
{
|
|
1364
1364
|
label: "Microphone",
|
|
1365
1365
|
devices: B,
|
|
1366
1366
|
activeId: "",
|
|
1367
|
-
onPick: () =>
|
|
1367
|
+
onPick: () => te(!1)
|
|
1368
1368
|
}
|
|
1369
1369
|
)
|
|
1370
1370
|
] }),
|
|
@@ -1372,11 +1372,11 @@ const Vn = ({
|
|
|
1372
1372
|
"button",
|
|
1373
1373
|
{
|
|
1374
1374
|
type: "button",
|
|
1375
|
-
className: `ll-tool ${
|
|
1375
|
+
className: `ll-tool ${ee ? "is-muted" : ""}`,
|
|
1376
1376
|
onClick: j,
|
|
1377
|
-
"aria-label":
|
|
1378
|
-
title:
|
|
1379
|
-
children: /* @__PURE__ */ n(er, { muted:
|
|
1377
|
+
"aria-label": ee ? "Unmute speaker" : "Mute speaker",
|
|
1378
|
+
title: ee ? "Unmute speaker" : "Mute speaker",
|
|
1379
|
+
children: /* @__PURE__ */ n(er, { muted: ee })
|
|
1380
1380
|
}
|
|
1381
1381
|
)
|
|
1382
1382
|
] }),
|
|
@@ -1388,7 +1388,7 @@ const Vn = ({
|
|
|
1388
1388
|
className: "ll-message-input__field",
|
|
1389
1389
|
placeholder: "Message...",
|
|
1390
1390
|
value: Q,
|
|
1391
|
-
onChange: (y) =>
|
|
1391
|
+
onChange: (y) => oe(y.target.value),
|
|
1392
1392
|
"aria-label": "Message the agent"
|
|
1393
1393
|
}
|
|
1394
1394
|
),
|
|
@@ -1494,30 +1494,30 @@ function tr() {
|
|
|
1494
1494
|
/* @__PURE__ */ n("polyline", { points: "12 5 19 12 12 19" })
|
|
1495
1495
|
] });
|
|
1496
1496
|
}
|
|
1497
|
-
const Ot = ({ label: e, devices: t, activeId: r, onPick:
|
|
1497
|
+
const Ot = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */ w(
|
|
1498
1498
|
"div",
|
|
1499
1499
|
{
|
|
1500
1500
|
className: "ll-device-menu",
|
|
1501
|
-
onClick: (
|
|
1501
|
+
onClick: (o) => o.stopPropagation(),
|
|
1502
1502
|
role: "listbox",
|
|
1503
1503
|
children: [
|
|
1504
1504
|
/* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
|
|
1505
|
-
t.map((
|
|
1506
|
-
const c = r ===
|
|
1505
|
+
t.map((o, l) => {
|
|
1506
|
+
const c = r === o.deviceId;
|
|
1507
1507
|
return /* @__PURE__ */ w(
|
|
1508
1508
|
"button",
|
|
1509
1509
|
{
|
|
1510
1510
|
type: "button",
|
|
1511
1511
|
className: `ll-device-menu__item ${c ? "is-active" : ""}`,
|
|
1512
|
-
onClick: () => o
|
|
1512
|
+
onClick: () => i(o.deviceId),
|
|
1513
1513
|
role: "option",
|
|
1514
1514
|
"aria-selected": c,
|
|
1515
1515
|
children: [
|
|
1516
1516
|
c && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
|
|
1517
|
-
/* @__PURE__ */ n("span", { className: "ll-device-menu__name", children:
|
|
1517
|
+
/* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: o.label || `${e} ${l + 1}` })
|
|
1518
1518
|
]
|
|
1519
1519
|
},
|
|
1520
|
-
|
|
1520
|
+
o.deviceId || l
|
|
1521
1521
|
);
|
|
1522
1522
|
})
|
|
1523
1523
|
]
|
|
@@ -1544,7 +1544,7 @@ function tt(e) {
|
|
|
1544
1544
|
}
|
|
1545
1545
|
return !0;
|
|
1546
1546
|
}
|
|
1547
|
-
const Qe = 4096, rr = 20,
|
|
1547
|
+
const Qe = 4096, rr = 20, ir = 20, or = 10, lr = 10, ar = 30, sr = 20, qt = 500, cr = [
|
|
1548
1548
|
'[data-ll-private="true"]',
|
|
1549
1549
|
".ll-widget",
|
|
1550
1550
|
"script",
|
|
@@ -1566,8 +1566,8 @@ function Be(e) {
|
|
|
1566
1566
|
if (typeof window > "u") return !0;
|
|
1567
1567
|
const t = e.getBoundingClientRect();
|
|
1568
1568
|
if (t.width <= 0 || t.height <= 0) return !1;
|
|
1569
|
-
const r = window.innerHeight || document.documentElement.clientHeight,
|
|
1570
|
-
return t.bottom > 0 && t.right > 0 && t.top < r && t.left <
|
|
1569
|
+
const r = window.innerHeight || document.documentElement.clientHeight, i = window.innerWidth || document.documentElement.clientWidth;
|
|
1570
|
+
return t.bottom > 0 && t.right > 0 && t.top < r && t.left < i;
|
|
1571
1571
|
}
|
|
1572
1572
|
function Bt(e) {
|
|
1573
1573
|
const t = e.getAttribute("id");
|
|
@@ -1577,10 +1577,10 @@ function Bt(e) {
|
|
|
1577
1577
|
}
|
|
1578
1578
|
const r = e.getAttribute("aria-label");
|
|
1579
1579
|
if (r) return r.trim();
|
|
1580
|
-
const
|
|
1581
|
-
if (
|
|
1582
|
-
const
|
|
1583
|
-
return
|
|
1580
|
+
const i = e.getAttribute("placeholder");
|
|
1581
|
+
if (i) return i.trim();
|
|
1582
|
+
const o = e.closest("label");
|
|
1583
|
+
return o != null && o.textContent ? o.textContent.trim() : "";
|
|
1584
1584
|
}
|
|
1585
1585
|
function fe(e, t) {
|
|
1586
1586
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
@@ -1602,11 +1602,11 @@ function dr(e, t = {}) {
|
|
|
1602
1602
|
forms: [],
|
|
1603
1603
|
extras: e
|
|
1604
1604
|
};
|
|
1605
|
-
const
|
|
1605
|
+
const i = typeof window < "u" && window.location.href || "", o = typeof window < "u" && window.location.pathname || "/", l = r.title || "", c = Array.from(
|
|
1606
1606
|
r.querySelectorAll("[data-ll-region]")
|
|
1607
1607
|
), d = [];
|
|
1608
1608
|
for (const p of c) {
|
|
1609
|
-
if (d.length >=
|
|
1609
|
+
if (d.length >= or) break;
|
|
1610
1610
|
if (qe(p) || !Be(p)) continue;
|
|
1611
1611
|
const N = p.getAttribute("data-ll-region") ?? "", B = p.getAttribute("data-ll-intent") ?? void 0, $ = fe(
|
|
1612
1612
|
(p.innerText || p.textContent || "").trim(),
|
|
@@ -1642,7 +1642,7 @@ function dr(e, t = {}) {
|
|
|
1642
1642
|
)
|
|
1643
1643
|
);
|
|
1644
1644
|
for (const p of v) {
|
|
1645
|
-
if (L.length >=
|
|
1645
|
+
if (L.length >= ir) break;
|
|
1646
1646
|
if (qe(p) || !tt(p) || !Be(p)) continue;
|
|
1647
1647
|
const N = Bt(p), B = p instanceof HTMLInputElement ? p.type : p.tagName.toLowerCase();
|
|
1648
1648
|
N && L.push({ label: fe(N, 100), type: B });
|
|
@@ -1660,35 +1660,35 @@ function dr(e, t = {}) {
|
|
|
1660
1660
|
"[data-ll-field]"
|
|
1661
1661
|
)
|
|
1662
1662
|
), A = [];
|
|
1663
|
-
for (const
|
|
1663
|
+
for (const T of $) {
|
|
1664
1664
|
if (A.length >= ar) break;
|
|
1665
|
-
if (!tt(
|
|
1666
|
-
const W =
|
|
1665
|
+
if (!tt(T)) continue;
|
|
1666
|
+
const W = T.getAttribute("data-ll-field") || "";
|
|
1667
1667
|
if (!W) continue;
|
|
1668
|
-
const V = Bt(
|
|
1668
|
+
const V = Bt(T) || W, ne = T instanceof HTMLInputElement ? T.type : T.tagName.toLowerCase(), ee = {
|
|
1669
1669
|
name: W,
|
|
1670
1670
|
label: fe(V, 100),
|
|
1671
|
-
type:
|
|
1671
|
+
type: ne
|
|
1672
1672
|
};
|
|
1673
|
-
if (
|
|
1673
|
+
if (T.required === !0 && (ee.required = !0), T instanceof HTMLSelectElement) {
|
|
1674
1674
|
const ae = [];
|
|
1675
|
-
for (let pe = 0; pe <
|
|
1676
|
-
const se =
|
|
1675
|
+
for (let pe = 0; pe < T.options.length && !(ae.length >= sr); pe++) {
|
|
1676
|
+
const se = T.options[pe];
|
|
1677
1677
|
if (!se || se.disabled) continue;
|
|
1678
1678
|
const re = se.value || "", ce = (se.textContent || "").trim() || re;
|
|
1679
1679
|
!re && !ce || ae.push({ value: re, label: fe(ce, 60) });
|
|
1680
1680
|
}
|
|
1681
|
-
ae.length > 0 && (
|
|
1681
|
+
ae.length > 0 && (ee.options = ae);
|
|
1682
1682
|
}
|
|
1683
|
-
const ve = typeof
|
|
1684
|
-
ve && (
|
|
1683
|
+
const ve = typeof T.validationMessage == "string" ? T.validationMessage : "";
|
|
1684
|
+
ve && (ee.validationMessage = fe(ve, 200)), A.push(ee);
|
|
1685
1685
|
}
|
|
1686
1686
|
H.push({ id: N, intent: B, fields: A });
|
|
1687
1687
|
}
|
|
1688
1688
|
const I = {
|
|
1689
|
-
url:
|
|
1689
|
+
url: i,
|
|
1690
1690
|
title: l,
|
|
1691
|
-
pathname:
|
|
1691
|
+
pathname: o,
|
|
1692
1692
|
regions: d,
|
|
1693
1693
|
visibleText: s,
|
|
1694
1694
|
visibleLinks: R,
|
|
@@ -1705,11 +1705,11 @@ function dr(e, t = {}) {
|
|
|
1705
1705
|
}
|
|
1706
1706
|
let Me = null;
|
|
1707
1707
|
function Wt(e, t = {}) {
|
|
1708
|
-
const r = Date.now(),
|
|
1709
|
-
if (Me && Me.key ===
|
|
1708
|
+
const r = Date.now(), o = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
|
|
1709
|
+
if (Me && Me.key === o && r - Me.at < 1e3)
|
|
1710
1710
|
return Me.ctx;
|
|
1711
1711
|
const l = dr(e, t);
|
|
1712
|
-
return Me = { key:
|
|
1712
|
+
return Me = { key: o, at: r, ctx: l }, l;
|
|
1713
1713
|
}
|
|
1714
1714
|
function ur() {
|
|
1715
1715
|
Me = null;
|
|
@@ -1731,9 +1731,9 @@ function hr(e) {
|
|
|
1731
1731
|
function mr(e) {
|
|
1732
1732
|
const t = e ?? (typeof document < "u" ? document : null);
|
|
1733
1733
|
if (!t) return [];
|
|
1734
|
-
const r = typeof window < "u" && window.location.origin || "",
|
|
1734
|
+
const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), o = [], l = Array.from(t.querySelectorAll("a[href]"));
|
|
1735
1735
|
for (const c of l) {
|
|
1736
|
-
if (
|
|
1736
|
+
if (o.length >= fr) break;
|
|
1737
1737
|
if (pt(c)) continue;
|
|
1738
1738
|
const d = c.getAttribute("href") || "";
|
|
1739
1739
|
if (!hr(d)) continue;
|
|
@@ -1746,12 +1746,12 @@ function mr(e) {
|
|
|
1746
1746
|
} catch {
|
|
1747
1747
|
continue;
|
|
1748
1748
|
}
|
|
1749
|
-
if (
|
|
1750
|
-
|
|
1749
|
+
if (i.has(u)) continue;
|
|
1750
|
+
i.add(u);
|
|
1751
1751
|
const h = (c.textContent || "").trim().slice(0, 120);
|
|
1752
|
-
|
|
1752
|
+
o.push({ href: u, text: h, internal: m });
|
|
1753
1753
|
}
|
|
1754
|
-
return
|
|
1754
|
+
return o;
|
|
1755
1755
|
}
|
|
1756
1756
|
let Te = null;
|
|
1757
1757
|
const gr = 5e3;
|
|
@@ -1766,20 +1766,20 @@ function yr() {
|
|
|
1766
1766
|
Te = null;
|
|
1767
1767
|
}
|
|
1768
1768
|
function vr(e, t) {
|
|
1769
|
-
const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype,
|
|
1770
|
-
|
|
1769
|
+
const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, i = Object.getOwnPropertyDescriptor(r, "value"), o = i == null ? void 0 : i.set;
|
|
1770
|
+
o ? o.call(e, t) : e.value = t;
|
|
1771
1771
|
}
|
|
1772
1772
|
function br(e, t, r = {}) {
|
|
1773
|
-
const
|
|
1773
|
+
const i = r.triggerInput ?? !0, o = r.triggerChange ?? !0;
|
|
1774
1774
|
if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
|
|
1775
1775
|
const l = Object.getOwnPropertyDescriptor(
|
|
1776
1776
|
HTMLInputElement.prototype,
|
|
1777
1777
|
"checked"
|
|
1778
1778
|
), c = l == null ? void 0 : l.set, d = t === "true" || t === "1" || t === "on";
|
|
1779
|
-
c ? c.call(e, d) : e.checked = d,
|
|
1779
|
+
c ? c.call(e, d) : e.checked = d, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
1780
1780
|
return;
|
|
1781
1781
|
}
|
|
1782
|
-
vr(e, t),
|
|
1782
|
+
vr(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
1783
1783
|
}
|
|
1784
1784
|
function wr() {
|
|
1785
1785
|
if (typeof window > "u" || typeof document > "u")
|
|
@@ -1800,12 +1800,12 @@ function xr() {
|
|
|
1800
1800
|
document.querySelectorAll("body, body *")
|
|
1801
1801
|
);
|
|
1802
1802
|
let t = null, r = 0;
|
|
1803
|
-
for (const
|
|
1804
|
-
if (!_r(
|
|
1805
|
-
const
|
|
1806
|
-
if (
|
|
1807
|
-
const l =
|
|
1808
|
-
l > r && (r = l, t =
|
|
1803
|
+
for (const i of e) {
|
|
1804
|
+
if (!_r(i)) continue;
|
|
1805
|
+
const o = i.getBoundingClientRect();
|
|
1806
|
+
if (o.bottom <= 0 || o.top >= window.innerHeight || o.right <= 0 || o.left >= window.innerWidth || o.width <= 0 || o.height <= 0 || i.closest(".ll-widget")) continue;
|
|
1807
|
+
const l = o.width * o.height;
|
|
1808
|
+
l > r && (r = l, t = i);
|
|
1809
1809
|
}
|
|
1810
1810
|
return t;
|
|
1811
1811
|
}
|
|
@@ -1854,8 +1854,8 @@ function Cr(e) {
|
|
|
1854
1854
|
const {
|
|
1855
1855
|
agentId: t,
|
|
1856
1856
|
apiKey: r,
|
|
1857
|
-
baseUrl:
|
|
1858
|
-
sessionEndpoint:
|
|
1857
|
+
baseUrl: i = "https://app.livelayer.studio",
|
|
1858
|
+
sessionEndpoint: o,
|
|
1859
1859
|
sessionBody: l,
|
|
1860
1860
|
autoConnect: c = !1,
|
|
1861
1861
|
displayMode: d,
|
|
@@ -1877,11 +1877,11 @@ function Cr(e) {
|
|
|
1877
1877
|
allowScreenShare: B = !0,
|
|
1878
1878
|
allowTyping: $ = !0,
|
|
1879
1879
|
showOn: A,
|
|
1880
|
-
hideOn:
|
|
1880
|
+
hideOn: T,
|
|
1881
1881
|
pathname: W,
|
|
1882
1882
|
onNavigate: V,
|
|
1883
|
-
onScrollToSelector:
|
|
1884
|
-
getPageContext:
|
|
1883
|
+
onScrollToSelector: ne,
|
|
1884
|
+
getPageContext: ee,
|
|
1885
1885
|
pageContextExtras: ve,
|
|
1886
1886
|
getRoutes: ae,
|
|
1887
1887
|
onScrollPage: pe,
|
|
@@ -1898,8 +1898,8 @@ function Cr(e) {
|
|
|
1898
1898
|
className: We,
|
|
1899
1899
|
style: Fe,
|
|
1900
1900
|
zIndex: Ue = 2147483647
|
|
1901
|
-
} = e, je = Tn(W), he = qn(je, A,
|
|
1902
|
-
|
|
1901
|
+
} = e, je = Tn(W), he = qn(je, A, T);
|
|
1902
|
+
P(() => {
|
|
1903
1903
|
ur(), yr();
|
|
1904
1904
|
}, [je]);
|
|
1905
1905
|
const de = L !== void 0, [Ee, Ne] = S(() => {
|
|
@@ -1908,14 +1908,14 @@ function Cr(e) {
|
|
|
1908
1908
|
}), be = de ? L : Ee, G = Ze(
|
|
1909
1909
|
() => (C == null ? void 0 : C.find((g) => g.id === be)) ?? null,
|
|
1910
1910
|
[C, be]
|
|
1911
|
-
), Pe = (G == null ? void 0 : G.agentId) ?? t, [
|
|
1911
|
+
), Pe = (G == null ? void 0 : G.agentId) ?? t, [ie, te] = An({
|
|
1912
1912
|
value: d,
|
|
1913
1913
|
defaultValue: u,
|
|
1914
1914
|
onChange: m,
|
|
1915
1915
|
persistKey: s,
|
|
1916
1916
|
disablePersistence: R
|
|
1917
|
-
}), ue = In(a), me = yn(), Q = vn(),
|
|
1918
|
-
rt.current = V,
|
|
1917
|
+
}), ue = In(a), me = yn(), Q = vn(), oe = wn(), we = _n(), De = xn(), [Ve, $e] = S(!1), [Ae, y] = S(!1), [J, Ye] = S(!1), [Yt, Xt] = S(!1), [nt, Gt] = S(!1), rt = E(V), it = E(ne), ot = E(pe), lt = E(se), ht = E(ee), mt = E(ve), gt = E(ae), at = E(re), le = E(null);
|
|
1918
|
+
rt.current = V, it.current = ne, ot.current = pe, lt.current = se, ht.current = ee, mt.current = ve, gt.current = ae, at.current = re;
|
|
1919
1919
|
function ge(g) {
|
|
1920
1920
|
const f = at.current;
|
|
1921
1921
|
return f ? f.includes(g) : !0;
|
|
@@ -1981,9 +1981,9 @@ function Cr(e) {
|
|
|
1981
1981
|
const x = typeof f.selector == "string" ? f.selector : null;
|
|
1982
1982
|
if (!x) return;
|
|
1983
1983
|
const M = f.behavior === "instant" ? "instant" : "smooth";
|
|
1984
|
-
if (
|
|
1984
|
+
if (it.current) {
|
|
1985
1985
|
try {
|
|
1986
|
-
|
|
1986
|
+
it.current(
|
|
1987
1987
|
x,
|
|
1988
1988
|
M
|
|
1989
1989
|
);
|
|
@@ -2076,9 +2076,9 @@ function Cr(e) {
|
|
|
2076
2076
|
return;
|
|
2077
2077
|
}
|
|
2078
2078
|
const M = f.behavior === "instant" ? "instant" : "smooth";
|
|
2079
|
-
if (
|
|
2079
|
+
if (ot.current) {
|
|
2080
2080
|
try {
|
|
2081
|
-
|
|
2081
|
+
ot.current(
|
|
2082
2082
|
x,
|
|
2083
2083
|
M
|
|
2084
2084
|
);
|
|
@@ -2328,19 +2328,19 @@ function Cr(e) {
|
|
|
2328
2328
|
[Ce, Se]
|
|
2329
2329
|
), Y = gn({
|
|
2330
2330
|
agentId: j ? "__controlled__" : Pe,
|
|
2331
|
-
baseUrl:
|
|
2331
|
+
baseUrl: i,
|
|
2332
2332
|
apiKey: r,
|
|
2333
|
-
sessionEndpoint:
|
|
2333
|
+
sessionEndpoint: o,
|
|
2334
2334
|
sessionBody: l,
|
|
2335
2335
|
onDataMessage: j ? void 0 : ze
|
|
2336
2336
|
});
|
|
2337
|
-
|
|
2337
|
+
P(() => {
|
|
2338
2338
|
if (j != null && j.subscribeToDataMessages)
|
|
2339
2339
|
return j.subscribeToDataMessages(ze);
|
|
2340
2340
|
}, [j, ze]), le.current = () => {
|
|
2341
2341
|
var g;
|
|
2342
2342
|
return (g = Y.getRoom) == null ? void 0 : g.call(Y);
|
|
2343
|
-
},
|
|
2343
|
+
}, P(() => {
|
|
2344
2344
|
var Z;
|
|
2345
2345
|
if (typeof window > "u") return;
|
|
2346
2346
|
const g = ((Z = window.location) == null ? void 0 : Z.hostname) || "";
|
|
@@ -2387,13 +2387,13 @@ function Cr(e) {
|
|
|
2387
2387
|
getRoom: Y.getRoom,
|
|
2388
2388
|
isControlled: !1
|
|
2389
2389
|
}, [j, Y]), yt = E(null);
|
|
2390
|
-
|
|
2390
|
+
P(() => {
|
|
2391
2391
|
const g = _.videoElement, f = yt.current;
|
|
2392
2392
|
if (!(!g || !f))
|
|
2393
2393
|
return f.appendChild(g), () => {
|
|
2394
2394
|
g.parentNode === f && f.removeChild(g);
|
|
2395
2395
|
};
|
|
2396
|
-
}, [_.videoElement]),
|
|
2396
|
+
}, [_.videoElement]), P(() => {
|
|
2397
2397
|
const g = _.audioElement;
|
|
2398
2398
|
if (!g) return;
|
|
2399
2399
|
me.attach(g);
|
|
@@ -2403,15 +2403,15 @@ function Cr(e) {
|
|
|
2403
2403
|
}), () => {
|
|
2404
2404
|
me.detach();
|
|
2405
2405
|
};
|
|
2406
|
-
}, [_.audioElement]),
|
|
2406
|
+
}, [_.audioElement]), P(() => {
|
|
2407
2407
|
if (_.isControlled || _.connectionState !== "connected") return;
|
|
2408
2408
|
const g = _.getRoom();
|
|
2409
2409
|
if (g)
|
|
2410
2410
|
return Q.setupMic(g).catch(() => {
|
|
2411
|
-
}),
|
|
2412
|
-
Q.teardownMic(),
|
|
2411
|
+
}), oe.attachRoom(g), we.attachRoom(g), De.refresh(), () => {
|
|
2412
|
+
Q.teardownMic(), oe.teardown(), we.teardown();
|
|
2413
2413
|
};
|
|
2414
|
-
}, [_.isControlled, _.connectionState]),
|
|
2414
|
+
}, [_.isControlled, _.connectionState]), P(() => {
|
|
2415
2415
|
const g = _.audioElement;
|
|
2416
2416
|
g && (g.muted = nt);
|
|
2417
2417
|
}, [_.audioElement, nt]);
|
|
@@ -2428,15 +2428,15 @@ function Cr(e) {
|
|
|
2428
2428
|
}, [_]), Kt = k(() => {
|
|
2429
2429
|
Gt((g) => !g);
|
|
2430
2430
|
}, []);
|
|
2431
|
-
|
|
2431
|
+
P(() => {
|
|
2432
2432
|
Le == null || Le(_.connectionState), _.connectionState === "connected" ? ce == null || ce() : _.connectionState === "disconnected" && (_e == null || _e());
|
|
2433
|
-
}, [_.connectionState, ce, _e, Le]),
|
|
2433
|
+
}, [_.connectionState, ce, _e, Le]), P(() => {
|
|
2434
2434
|
xe == null || xe(_.transcript);
|
|
2435
|
-
}, [_.transcript, xe]),
|
|
2435
|
+
}, [_.transcript, xe]), P(() => {
|
|
2436
2436
|
ke == null || ke(_.agentState);
|
|
2437
2437
|
}, [_.agentState, ke]);
|
|
2438
2438
|
const vt = E(!1);
|
|
2439
|
-
|
|
2439
|
+
P(() => {
|
|
2440
2440
|
_.isControlled || !c || vt.current || he && _.connectionState === "idle" && (vt.current = !0, _.connect());
|
|
2441
2441
|
}, [c, _.connectionState, _, he]);
|
|
2442
2442
|
const Qt = k(
|
|
@@ -2452,23 +2452,23 @@ function Cr(e) {
|
|
|
2452
2452
|
v
|
|
2453
2453
|
]
|
|
2454
2454
|
);
|
|
2455
|
-
|
|
2455
|
+
P(() => {
|
|
2456
2456
|
Ae && _.connectionState === "connected" && y(!1);
|
|
2457
|
-
}, [_.connectionState, Ae]),
|
|
2457
|
+
}, [_.connectionState, Ae]), P(() => {
|
|
2458
2458
|
if (!J) return;
|
|
2459
2459
|
const g = (f) => {
|
|
2460
2460
|
f.key === "Escape" && Ye(!1);
|
|
2461
2461
|
};
|
|
2462
2462
|
return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
|
|
2463
2463
|
}, [J]);
|
|
2464
|
-
const Zt = !!I || !!(G != null && G.avatarImageUrl) || _.isControlled, He = kn(Pe,
|
|
2464
|
+
const Zt = !!I || !!(G != null && G.avatarImageUrl) || _.isControlled, He = kn(Pe, i, Zt);
|
|
2465
2465
|
re === void 0 && ((wt = He.info) != null && wt.capabilities) && (at.current = He.info.capabilities);
|
|
2466
|
-
const Xe = (G == null ? void 0 : G.name) ?? O ?? ((_t = _.agentConfig) == null ? void 0 : _t.name) ?? ((xt = He.info) == null ? void 0 : xt.name) ?? "Live Layer", st = (G == null ? void 0 : G.avatarImageUrl) ?? I ?? ((kt = _.agentConfig) == null ? void 0 : kt.avatarImageUrl) ?? ((Lt = He.info) == null ? void 0 : Lt.avatarImageUrl) ?? null, en = b ?? ((St = _.agentConfig) == null ? void 0 : St.idleLoopUrl) ?? ((Ct = He.info) == null ? void 0 : Ct.idleLoopUrl) ?? null, tn = H ?? null, nn = k(() =>
|
|
2467
|
-
() =>
|
|
2468
|
-
[
|
|
2466
|
+
const Xe = (G == null ? void 0 : G.name) ?? O ?? ((_t = _.agentConfig) == null ? void 0 : _t.name) ?? ((xt = He.info) == null ? void 0 : xt.name) ?? "Live Layer", st = (G == null ? void 0 : G.avatarImageUrl) ?? I ?? ((kt = _.agentConfig) == null ? void 0 : kt.avatarImageUrl) ?? ((Lt = He.info) == null ? void 0 : Lt.avatarImageUrl) ?? null, en = b ?? ((St = _.agentConfig) == null ? void 0 : St.idleLoopUrl) ?? ((Ct = He.info) == null ? void 0 : Ct.idleLoopUrl) ?? null, tn = H ?? null, nn = k(() => te("expanded"), [te]), rn = k(
|
|
2467
|
+
() => te("minimized"),
|
|
2468
|
+
[te]
|
|
2469
2469
|
), bt = k(() => {
|
|
2470
|
-
_.disconnect(),
|
|
2471
|
-
}, [_,
|
|
2470
|
+
_.disconnect(), te("hidden");
|
|
2471
|
+
}, [_, te]), on = k(() => {
|
|
2472
2472
|
const g = _.audioElement;
|
|
2473
2473
|
g && g.play().then(() => $e(!1)).catch(() => {
|
|
2474
2474
|
});
|
|
@@ -2481,7 +2481,7 @@ function Cr(e) {
|
|
|
2481
2481
|
p.primaryColor && (Oe["--ll-color-primary"] = p.primaryColor), p.accentColor && (Oe["--ll-color-accent"] = p.accentColor), p.backgroundColor && (Oe["--ll-color-bg"] = p.backgroundColor), p.textColor && (Oe["--ll-color-fg"] = p.textColor);
|
|
2482
2482
|
const an = [
|
|
2483
2483
|
"ll-widget",
|
|
2484
|
-
`ll-widget--${
|
|
2484
|
+
`ll-widget--${ie}`,
|
|
2485
2485
|
`ll-widget--${ue ? "mobile" : "desktop"}`,
|
|
2486
2486
|
We
|
|
2487
2487
|
].filter(Boolean).join(" ");
|
|
@@ -2490,22 +2490,22 @@ function Cr(e) {
|
|
|
2490
2490
|
{
|
|
2491
2491
|
className: an,
|
|
2492
2492
|
style: Oe,
|
|
2493
|
-
"data-display-mode":
|
|
2493
|
+
"data-display-mode": ie,
|
|
2494
2494
|
"data-position": h,
|
|
2495
2495
|
children: [
|
|
2496
|
-
|
|
2496
|
+
ie === "hidden" && /* @__PURE__ */ n(
|
|
2497
2497
|
Vn,
|
|
2498
2498
|
{
|
|
2499
2499
|
position: h,
|
|
2500
2500
|
isMobile: ue,
|
|
2501
2501
|
isSpeaking: _.agentState === "speaking",
|
|
2502
|
-
onExpand: () =>
|
|
2502
|
+
onExpand: () => te("expanded"),
|
|
2503
2503
|
label: `Open ${Xe} widget`,
|
|
2504
2504
|
avatarImageUrl: st,
|
|
2505
2505
|
agentName: Xe
|
|
2506
2506
|
}
|
|
2507
2507
|
),
|
|
2508
|
-
|
|
2508
|
+
ie === "minimized" && /* @__PURE__ */ n(
|
|
2509
2509
|
Xn,
|
|
2510
2510
|
{
|
|
2511
2511
|
position: h,
|
|
@@ -2520,7 +2520,7 @@ function Cr(e) {
|
|
|
2520
2520
|
onClose: bt
|
|
2521
2521
|
}
|
|
2522
2522
|
),
|
|
2523
|
-
|
|
2523
|
+
ie === "expanded" && /* @__PURE__ */ n(
|
|
2524
2524
|
Jn,
|
|
2525
2525
|
{
|
|
2526
2526
|
position: h,
|
|
@@ -2541,10 +2541,10 @@ function Cr(e) {
|
|
|
2541
2541
|
transcript: _.transcript,
|
|
2542
2542
|
isMuted: Q.isMuted,
|
|
2543
2543
|
micDevices: De.mics,
|
|
2544
|
-
isCameraEnabled:
|
|
2545
|
-
cameraPreviewEl:
|
|
2544
|
+
isCameraEnabled: oe.isEnabled,
|
|
2545
|
+
cameraPreviewEl: oe.previewEl,
|
|
2546
2546
|
cameraDevices: De.cameras,
|
|
2547
|
-
activeCameraId:
|
|
2547
|
+
activeCameraId: oe.activeDeviceId,
|
|
2548
2548
|
isScreenShareEnabled: we.isEnabled,
|
|
2549
2549
|
screenPreviewEl: we.previewEl,
|
|
2550
2550
|
isSpeakerMuted: nt,
|
|
@@ -2563,8 +2563,8 @@ function Cr(e) {
|
|
|
2563
2563
|
onRetry: ln,
|
|
2564
2564
|
onResumeAudio: on,
|
|
2565
2565
|
onToggleMute: Q.toggleMute,
|
|
2566
|
-
onToggleCamera: () => void
|
|
2567
|
-
onSwitchCameraDevice: (g) => void
|
|
2566
|
+
onToggleCamera: () => void oe.toggle(),
|
|
2567
|
+
onSwitchCameraDevice: (g) => void oe.switchDevice(g),
|
|
2568
2568
|
onToggleScreenShare: () => void we.toggle(),
|
|
2569
2569
|
onToggleSpeaker: Kt,
|
|
2570
2570
|
onSendMessage: Jt,
|
|
@@ -2584,58 +2584,58 @@ const Dr = ({
|
|
|
2584
2584
|
agentId: e,
|
|
2585
2585
|
baseUrl: t,
|
|
2586
2586
|
apiKey: r,
|
|
2587
|
-
mode:
|
|
2588
|
-
onAgentEvent:
|
|
2587
|
+
mode: i,
|
|
2588
|
+
onAgentEvent: o,
|
|
2589
2589
|
className: l,
|
|
2590
2590
|
style: c
|
|
2591
2591
|
}) => {
|
|
2592
|
-
const d = E(null), u = E(null), m = E(
|
|
2593
|
-
m.current =
|
|
2592
|
+
const d = E(null), u = E(null), m = E(o);
|
|
2593
|
+
m.current = o;
|
|
2594
2594
|
const h = k((a) => {
|
|
2595
2595
|
var R;
|
|
2596
2596
|
const s = a.detail;
|
|
2597
2597
|
(R = m.current) == null || R.call(m, s);
|
|
2598
2598
|
}, []);
|
|
2599
|
-
return
|
|
2599
|
+
return P(() => {
|
|
2600
2600
|
const a = d.current;
|
|
2601
2601
|
if (!a) return;
|
|
2602
2602
|
const s = document.createElement("livelayer-widget");
|
|
2603
|
-
return s.setAttribute("agent-id", e), t && s.setAttribute("base-url", t), r && s.setAttribute("api-key", r),
|
|
2603
|
+
return s.setAttribute("agent-id", e), t && s.setAttribute("base-url", t), r && s.setAttribute("api-key", r), i && s.setAttribute("mode", i), s.addEventListener("agent-event", h), a.appendChild(s), u.current = s, () => {
|
|
2604
2604
|
s.removeEventListener("agent-event", h), a.removeChild(s), u.current = null;
|
|
2605
2605
|
};
|
|
2606
|
-
}, [e]),
|
|
2607
|
-
u.current && (
|
|
2608
|
-
}, [
|
|
2606
|
+
}, [e]), P(() => {
|
|
2607
|
+
u.current && (i ? u.current.setAttribute("mode", i) : u.current.removeAttribute("mode"));
|
|
2608
|
+
}, [i]), /* @__PURE__ */ n("div", { ref: d, className: l, style: c });
|
|
2609
2609
|
}, $r = ft(
|
|
2610
|
-
function({ id: t, intent: r, as:
|
|
2610
|
+
function({ id: t, intent: r, as: i = "div", className: o, style: l, children: c }, d) {
|
|
2611
2611
|
return un(
|
|
2612
|
-
|
|
2612
|
+
i,
|
|
2613
2613
|
{
|
|
2614
2614
|
ref: d,
|
|
2615
2615
|
"data-ll-region": t,
|
|
2616
2616
|
"data-ll-intent": r,
|
|
2617
|
-
className:
|
|
2617
|
+
className: o,
|
|
2618
2618
|
style: l
|
|
2619
2619
|
},
|
|
2620
2620
|
c
|
|
2621
2621
|
);
|
|
2622
2622
|
}
|
|
2623
2623
|
), zr = ft(
|
|
2624
|
-
function({ id: t, intent: r, children:
|
|
2624
|
+
function({ id: t, intent: r, children: i, ...o }, l) {
|
|
2625
2625
|
return /* @__PURE__ */ n(
|
|
2626
2626
|
"form",
|
|
2627
2627
|
{
|
|
2628
2628
|
ref: l,
|
|
2629
2629
|
"data-ll-form": t,
|
|
2630
2630
|
"data-ll-intent": r,
|
|
2631
|
-
...
|
|
2632
|
-
children:
|
|
2631
|
+
...o,
|
|
2632
|
+
children: i
|
|
2633
2633
|
}
|
|
2634
2634
|
);
|
|
2635
2635
|
}
|
|
2636
2636
|
), Hr = ft(
|
|
2637
2637
|
function(t, r) {
|
|
2638
|
-
const { name:
|
|
2638
|
+
const { name: i, label: o, labelClassName: l } = t, c = { name: i, "data-ll-field": i };
|
|
2639
2639
|
let d;
|
|
2640
2640
|
if ("as" in t && t.as === "textarea") {
|
|
2641
2641
|
const { name: u, label: m, labelClassName: h, as: a, ...s } = t;
|
|
@@ -2669,8 +2669,8 @@ const Dr = ({
|
|
|
2669
2669
|
}
|
|
2670
2670
|
);
|
|
2671
2671
|
}
|
|
2672
|
-
return
|
|
2673
|
-
|
|
2672
|
+
return o === void 0 ? d : /* @__PURE__ */ w("label", { className: l, children: [
|
|
2673
|
+
o,
|
|
2674
2674
|
d
|
|
2675
2675
|
] });
|
|
2676
2676
|
}
|
|
@@ -2681,24 +2681,24 @@ function Or({
|
|
|
2681
2681
|
defaultOpen: t = !1,
|
|
2682
2682
|
storageKey: r = "ll-debug-open"
|
|
2683
2683
|
}) {
|
|
2684
|
-
const [
|
|
2685
|
-
R.current = m,
|
|
2684
|
+
const [i, o] = S(t), [l, c] = S([]), [d, u] = S(""), [m, h] = S(!1), a = E(/* @__PURE__ */ new Set()), s = E([]), R = E(m);
|
|
2685
|
+
R.current = m, P(() => {
|
|
2686
2686
|
try {
|
|
2687
2687
|
const v = localStorage.getItem(r);
|
|
2688
|
-
v === "1" &&
|
|
2688
|
+
v === "1" && o(!0), v === "0" && o(!1);
|
|
2689
2689
|
} catch {
|
|
2690
2690
|
}
|
|
2691
|
-
}, [r]),
|
|
2691
|
+
}, [r]), P(() => {
|
|
2692
2692
|
try {
|
|
2693
|
-
localStorage.setItem(r,
|
|
2693
|
+
localStorage.setItem(r, i ? "1" : "0");
|
|
2694
2694
|
} catch {
|
|
2695
2695
|
}
|
|
2696
|
-
}, [
|
|
2696
|
+
}, [i, r]), P(() => {
|
|
2697
2697
|
const v = (b) => {
|
|
2698
|
-
(b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(),
|
|
2698
|
+
(b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(), o((H) => !H));
|
|
2699
2699
|
};
|
|
2700
2700
|
return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
|
|
2701
|
-
}, []),
|
|
2701
|
+
}, []), P(() => {
|
|
2702
2702
|
const v = setInterval(() => {
|
|
2703
2703
|
if (s.current.length === 0 || R.current) return;
|
|
2704
2704
|
const b = s.current.splice(0, s.current.length);
|
|
@@ -2709,7 +2709,7 @@ function Or({
|
|
|
2709
2709
|
return () => clearInterval(v);
|
|
2710
2710
|
}, []);
|
|
2711
2711
|
const C = E(!1);
|
|
2712
|
-
if (
|
|
2712
|
+
if (P(() => {
|
|
2713
2713
|
!e || C.current || (C.current = !0, e((v) => {
|
|
2714
2714
|
s.current.push({
|
|
2715
2715
|
id: Ut++,
|
|
@@ -2719,7 +2719,7 @@ function Or({
|
|
|
2719
2719
|
data: v.data
|
|
2720
2720
|
});
|
|
2721
2721
|
}));
|
|
2722
|
-
}, [e]),
|
|
2722
|
+
}, [e]), P(() => {
|
|
2723
2723
|
const v = console.warn, b = console.log, H = (I, O) => function(...p) {
|
|
2724
2724
|
try {
|
|
2725
2725
|
const N = typeof p[0] == "string" ? p[0] : "";
|
|
@@ -2737,12 +2737,12 @@ function Or({
|
|
|
2737
2737
|
return console.warn = H("warn", v), console.log = H("log", b), () => {
|
|
2738
2738
|
console.warn = v, console.log = b;
|
|
2739
2739
|
};
|
|
2740
|
-
}, []), !
|
|
2740
|
+
}, []), !i)
|
|
2741
2741
|
return /* @__PURE__ */ n(
|
|
2742
2742
|
"button",
|
|
2743
2743
|
{
|
|
2744
2744
|
type: "button",
|
|
2745
|
-
onClick: () =>
|
|
2745
|
+
onClick: () => o(!0),
|
|
2746
2746
|
title: "Open LiveLayer debug panel (Cmd/Ctrl + Shift + L)",
|
|
2747
2747
|
"aria-label": "Open LiveLayer debug panel",
|
|
2748
2748
|
style: {
|
|
@@ -2836,7 +2836,7 @@ function Or({
|
|
|
2836
2836
|
"button",
|
|
2837
2837
|
{
|
|
2838
2838
|
type: "button",
|
|
2839
|
-
onClick: () =>
|
|
2839
|
+
onClick: () => o(!1),
|
|
2840
2840
|
style: dt("transparent"),
|
|
2841
2841
|
"aria-label": "Close",
|
|
2842
2842
|
title: "Close (Cmd/Ctrl + Shift + L)",
|
|
@@ -2925,7 +2925,7 @@ function Er({
|
|
|
2925
2925
|
expanded: t,
|
|
2926
2926
|
onToggle: r
|
|
2927
2927
|
}) {
|
|
2928
|
-
const
|
|
2928
|
+
const i = e.kind === "warn" ? "#f59e0b" : e.type.startsWith("[LiveLayer]") ? "#94a3b8" : e.type === "navigate" || e.type === "scroll_page" || e.type === "scroll_to" || e.type === "click" ? "#22c55e" : e.type === "fill_form" || e.type === "submit_form" || e.type === "focus_field" ? "#a78bfa" : e.type === "request_page_context" || e.type === "request_routes" ? "#38bdf8" : e.type === "agent_state" ? "#facc15" : "#cbd5e1", o = new Date(e.ts).toLocaleTimeString("en-US", {
|
|
2929
2929
|
hour12: !1
|
|
2930
2930
|
});
|
|
2931
2931
|
return /* @__PURE__ */ w(
|
|
@@ -2955,14 +2955,14 @@ function Er({
|
|
|
2955
2955
|
fontVariantNumeric: "tabular-nums",
|
|
2956
2956
|
fontSize: 10
|
|
2957
2957
|
},
|
|
2958
|
-
children:
|
|
2958
|
+
children: o
|
|
2959
2959
|
}
|
|
2960
2960
|
),
|
|
2961
2961
|
/* @__PURE__ */ n(
|
|
2962
2962
|
"span",
|
|
2963
2963
|
{
|
|
2964
2964
|
style: {
|
|
2965
|
-
color:
|
|
2965
|
+
color: i,
|
|
2966
2966
|
fontWeight: 600,
|
|
2967
2967
|
flexShrink: 0
|
|
2968
2968
|
},
|
|
@@ -3009,20 +3009,20 @@ function Nr(e) {
|
|
|
3009
3009
|
}
|
|
3010
3010
|
}
|
|
3011
3011
|
function qr() {
|
|
3012
|
-
const [e, t] = S([]), r = k((
|
|
3012
|
+
const [e, t] = S([]), r = k((o) => {
|
|
3013
3013
|
t((l) => {
|
|
3014
|
-
const c = l.findIndex((d) => d.id ===
|
|
3014
|
+
const c = l.findIndex((d) => d.id === o.id);
|
|
3015
3015
|
if (c >= 0) {
|
|
3016
3016
|
const d = l.slice();
|
|
3017
|
-
return d[c] =
|
|
3017
|
+
return d[c] = o, d;
|
|
3018
3018
|
}
|
|
3019
|
-
return [...l,
|
|
3019
|
+
return [...l, o];
|
|
3020
3020
|
});
|
|
3021
|
-
}, []),
|
|
3021
|
+
}, []), i = k(() => t([]), []);
|
|
3022
3022
|
return {
|
|
3023
3023
|
entries: e,
|
|
3024
3024
|
pushSegment: r,
|
|
3025
|
-
clear:
|
|
3025
|
+
clear: i,
|
|
3026
3026
|
latest: e.length > 0 ? e[e.length - 1] : null
|
|
3027
3027
|
};
|
|
3028
3028
|
}
|