@livelayer/react 0.5.2 → 0.5.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 +60 -0
- package/dist/index.js +3 -3
- package/dist/index.mjs +997 -906
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as _, jsx as n, Fragment as
|
|
3
|
-
import { Component as
|
|
4
|
-
import { LiveKitSession as
|
|
5
|
-
import { createLocalAudioTrack as
|
|
6
|
-
class
|
|
2
|
+
import { jsxs as _, jsx as n, Fragment as Ft } from "react/jsx-runtime";
|
|
3
|
+
import { Component as sn, useState as N, useRef as I, useEffect as P, useCallback as S, useMemo as Qe, forwardRef as dt, createElement as dn } from "react";
|
|
4
|
+
import { LiveKitSession as un } from "@livelayer/sdk";
|
|
5
|
+
import { createLocalAudioTrack as fn, Track as Ut, createLocalVideoTrack as pn } from "livekit-client";
|
|
6
|
+
class hn extends sn {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments), this.state = { hasError: !1, error: null }, this.reset = () => {
|
|
9
9
|
this.setState({ hasError: !1, error: null });
|
|
@@ -13,8 +13,8 @@ class dn extends on {
|
|
|
13
13
|
return { hasError: !0, error: t };
|
|
14
14
|
}
|
|
15
15
|
componentDidCatch(t, r) {
|
|
16
|
-
var
|
|
17
|
-
(
|
|
16
|
+
var o, i;
|
|
17
|
+
(i = (o = this.props).onError) == null || i.call(o, t, r);
|
|
18
18
|
}
|
|
19
19
|
render() {
|
|
20
20
|
var t;
|
|
@@ -33,26 +33,26 @@ class dn extends on {
|
|
|
33
33
|
] }) : this.props.children;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const [t, r] = N("idle"), [
|
|
38
|
-
|
|
36
|
+
function mn(e) {
|
|
37
|
+
const [t, r] = N("idle"), [o, i] = N("idle"), [l, s] = N([]), [d, u] = N(null), [h, m] = N(null), [a, c] = N(null), [A, C] = N(!1), [R, b] = N(null), L = I(null), z = I(e.onDataMessage);
|
|
38
|
+
z.current = e.onDataMessage, P(() => {
|
|
39
39
|
const g = {
|
|
40
40
|
onConnectionStateChange: (x) => {
|
|
41
41
|
r(x), x === "connected" && b(null);
|
|
42
42
|
},
|
|
43
|
-
onAgentStateChange:
|
|
44
|
-
onTranscript: (x) =>
|
|
43
|
+
onAgentStateChange: i,
|
|
44
|
+
onTranscript: (x) => s([...x]),
|
|
45
45
|
onAgentConfig: u,
|
|
46
|
-
onAudioTrack: (x) =>
|
|
46
|
+
onAudioTrack: (x) => c(x),
|
|
47
47
|
onVideoTrack: (x) => m(x),
|
|
48
48
|
onVideoTrackRemoved: () => m(null),
|
|
49
49
|
onError: (x) => b(x),
|
|
50
50
|
onDataMessage: (x) => {
|
|
51
|
-
var
|
|
52
|
-
(
|
|
51
|
+
var q;
|
|
52
|
+
(q = z.current) == null || q.call(z, x);
|
|
53
53
|
},
|
|
54
54
|
onResumabilityChange: C
|
|
55
|
-
}, E = new
|
|
55
|
+
}, E = new un(
|
|
56
56
|
{
|
|
57
57
|
agentId: e.agentId,
|
|
58
58
|
baseUrl: e.baseUrl,
|
|
@@ -62,7 +62,7 @@ function un(e) {
|
|
|
62
62
|
},
|
|
63
63
|
g
|
|
64
64
|
);
|
|
65
|
-
return L.current = E, r("idle"),
|
|
65
|
+
return L.current = E, r("idle"), i("idle"), s([]), u(null), m(null), c(null), C(!1), b(null), () => {
|
|
66
66
|
var x;
|
|
67
67
|
(x = E.destroy) == null || x.call(E), L.current = null;
|
|
68
68
|
};
|
|
@@ -81,7 +81,7 @@ function un(e) {
|
|
|
81
81
|
} catch (E) {
|
|
82
82
|
throw b(E instanceof Error ? E.message : String(E)), E;
|
|
83
83
|
}
|
|
84
|
-
}, []),
|
|
84
|
+
}, []), O = S(() => {
|
|
85
85
|
const g = L.current;
|
|
86
86
|
g && g.disconnect();
|
|
87
87
|
}, []), p = S(() => {
|
|
@@ -90,7 +90,7 @@ function un(e) {
|
|
|
90
90
|
}, []);
|
|
91
91
|
return {
|
|
92
92
|
connectionState: t,
|
|
93
|
-
agentState:
|
|
93
|
+
agentState: o,
|
|
94
94
|
transcript: l,
|
|
95
95
|
agentConfig: d,
|
|
96
96
|
videoElement: h,
|
|
@@ -98,37 +98,37 @@ function un(e) {
|
|
|
98
98
|
canResume: A,
|
|
99
99
|
error: R,
|
|
100
100
|
connect: M,
|
|
101
|
-
disconnect:
|
|
101
|
+
disconnect: O,
|
|
102
102
|
getRoom: p,
|
|
103
103
|
session: L.current
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
const e = I(null), t = I(null), r = I(null),
|
|
106
|
+
function gn() {
|
|
107
|
+
const e = I(null), t = I(null), r = I(null), o = I(null), i = I(/* @__PURE__ */ new Set()), l = I(null), s = S(() => {
|
|
108
108
|
const a = t.current;
|
|
109
109
|
if (!a) {
|
|
110
|
-
|
|
110
|
+
o.current = null;
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
113
|
(!l.current || l.current.length !== a.frequencyBinCount) && (l.current = new Uint8Array(
|
|
114
114
|
new ArrayBuffer(a.frequencyBinCount)
|
|
115
115
|
));
|
|
116
|
-
const
|
|
117
|
-
a.getByteFrequencyData(
|
|
116
|
+
const c = l.current;
|
|
117
|
+
a.getByteFrequencyData(c);
|
|
118
118
|
let A = 0;
|
|
119
|
-
for (let R = 0; R <
|
|
120
|
-
const C = A /
|
|
121
|
-
for (const R of
|
|
119
|
+
for (let R = 0; R < c.length; R++) A += c[R];
|
|
120
|
+
const C = A / c.length / 255;
|
|
121
|
+
for (const R of i.current)
|
|
122
122
|
try {
|
|
123
123
|
R(C);
|
|
124
124
|
} catch (b) {
|
|
125
125
|
console.error("[useAudioLevel] subscriber threw:", b);
|
|
126
126
|
}
|
|
127
|
-
|
|
127
|
+
o.current = requestAnimationFrame(s);
|
|
128
128
|
}, []), d = S(() => {
|
|
129
129
|
if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
|
|
130
|
-
const a = new AudioContext(),
|
|
131
|
-
|
|
130
|
+
const a = new AudioContext(), c = a.createAnalyser();
|
|
131
|
+
c.fftSize = 64, c.connect(a.destination), e.current = a, t.current = c;
|
|
132
132
|
}, []), u = S(
|
|
133
133
|
(a) => {
|
|
134
134
|
if (d(), !(!e.current || !t.current)) {
|
|
@@ -140,26 +140,26 @@ function fn() {
|
|
|
140
140
|
r.current = null;
|
|
141
141
|
}
|
|
142
142
|
try {
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
} catch (
|
|
146
|
-
console.warn("[useAudioLevel] createMediaElementSource failed:",
|
|
143
|
+
const c = e.current.createMediaElementSource(a);
|
|
144
|
+
c.connect(t.current), r.current = c;
|
|
145
|
+
} catch (c) {
|
|
146
|
+
console.warn("[useAudioLevel] createMediaElementSource failed:", c);
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
|
-
|
|
149
|
+
o.current === null && (o.current = requestAnimationFrame(s));
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
|
-
[d,
|
|
152
|
+
[d, s]
|
|
153
153
|
), h = S(() => {
|
|
154
|
-
if (
|
|
154
|
+
if (o.current !== null && (cancelAnimationFrame(o.current), o.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
|
-
}, []), m = S((a) => (
|
|
162
|
-
|
|
161
|
+
}, []), m = S((a) => (i.current.add(a), () => {
|
|
162
|
+
i.current.delete(a);
|
|
163
163
|
}), []);
|
|
164
164
|
return P(() => () => {
|
|
165
165
|
if (h(), t.current) {
|
|
@@ -176,34 +176,34 @@ function fn() {
|
|
|
176
176
|
}
|
|
177
177
|
e.current = null;
|
|
178
178
|
}
|
|
179
|
-
|
|
179
|
+
i.current.clear(), l.current = null;
|
|
180
180
|
}, [h]), { attach: u, detach: h, subscribe: m };
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
const [e, t] = N(!1), [r,
|
|
184
|
-
if (
|
|
182
|
+
function yn() {
|
|
183
|
+
const [e, t] = N(!1), [r, o] = N(null), i = I(null), l = I(null), s = S(async (m) => {
|
|
184
|
+
if (i.current && l.current) {
|
|
185
185
|
try {
|
|
186
|
-
await l.current.localParticipant.unpublishTrack(
|
|
186
|
+
await l.current.localParticipant.unpublishTrack(i.current);
|
|
187
187
|
} catch {
|
|
188
188
|
}
|
|
189
|
-
|
|
189
|
+
i.current.stop(), i.current = null;
|
|
190
190
|
}
|
|
191
|
-
l.current = m,
|
|
191
|
+
l.current = m, o(null);
|
|
192
192
|
try {
|
|
193
|
-
const a = await
|
|
193
|
+
const a = await fn({
|
|
194
194
|
echoCancellation: !0,
|
|
195
195
|
noiseSuppression: !0
|
|
196
196
|
});
|
|
197
|
-
await m.localParticipant.publishTrack(a),
|
|
197
|
+
await m.localParticipant.publishTrack(a), i.current = a, t(a.isMuted);
|
|
198
198
|
} catch (a) {
|
|
199
|
-
const
|
|
200
|
-
throw
|
|
199
|
+
const c = a instanceof Error && a.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
|
|
200
|
+
throw o(c), a;
|
|
201
201
|
}
|
|
202
202
|
}, []), d = S(() => {
|
|
203
|
-
const m =
|
|
203
|
+
const m = i.current;
|
|
204
204
|
m && (m.isMuted ? (m.unmute(), t(!1)) : (m.mute(), t(!0)));
|
|
205
205
|
}, []), u = S(() => {
|
|
206
|
-
const m =
|
|
206
|
+
const m = i.current, a = l.current;
|
|
207
207
|
if (m && a) {
|
|
208
208
|
try {
|
|
209
209
|
a.localParticipant.unpublishTrack(m);
|
|
@@ -211,25 +211,25 @@ function pn() {
|
|
|
211
211
|
}
|
|
212
212
|
m.stop();
|
|
213
213
|
}
|
|
214
|
-
|
|
215
|
-
}, []), h = S(() =>
|
|
214
|
+
i.current = null, l.current = null, t(!1);
|
|
215
|
+
}, []), h = S(() => o(null), []);
|
|
216
216
|
return {
|
|
217
217
|
isMuted: e,
|
|
218
218
|
micError: r,
|
|
219
219
|
toggleMute: d,
|
|
220
|
-
setupMic:
|
|
220
|
+
setupMic: s,
|
|
221
221
|
teardownMic: u,
|
|
222
222
|
clearError: h
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
|
-
const
|
|
226
|
-
function
|
|
227
|
-
const [e, t] = N(!1), [r,
|
|
225
|
+
const vn = { resolution: { width: 640, height: 480, frameRate: 24 } };
|
|
226
|
+
function bn() {
|
|
227
|
+
const [e, t] = N(!1), [r, o] = N(null), [i, l] = N(null), [s, d] = N(""), u = I(null), h = I(null), m = S((L) => {
|
|
228
228
|
u.current = L;
|
|
229
229
|
}, []), a = S(() => {
|
|
230
|
-
const L = u.current,
|
|
231
|
-
if (
|
|
232
|
-
const M = L.localParticipant.getTrackPublication(
|
|
230
|
+
const L = u.current, z = h.current;
|
|
231
|
+
if (z && L) {
|
|
232
|
+
const M = L.localParticipant.getTrackPublication(Ut.Source.Camera);
|
|
233
233
|
if (M != null && M.track) {
|
|
234
234
|
try {
|
|
235
235
|
L.localParticipant.unpublishTrack(M.track);
|
|
@@ -237,46 +237,46 @@ function mn() {
|
|
|
237
237
|
}
|
|
238
238
|
M.track.stop();
|
|
239
239
|
} else
|
|
240
|
-
|
|
240
|
+
z.stop();
|
|
241
241
|
}
|
|
242
242
|
h.current = null, l(null), t(!1);
|
|
243
|
-
}, []),
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
246
|
-
|
|
243
|
+
}, []), c = S(async (L) => {
|
|
244
|
+
const z = u.current;
|
|
245
|
+
if (z) {
|
|
246
|
+
o(null);
|
|
247
247
|
try {
|
|
248
|
-
const M = { ...
|
|
248
|
+
const M = { ...vn };
|
|
249
249
|
L && (M.deviceId = L);
|
|
250
|
-
const
|
|
251
|
-
await
|
|
252
|
-
const p =
|
|
250
|
+
const O = await pn(M);
|
|
251
|
+
await z.localParticipant.publishTrack(O), h.current = O;
|
|
252
|
+
const p = O.attach();
|
|
253
253
|
l(p), t(!0), L && d(L);
|
|
254
254
|
try {
|
|
255
|
-
|
|
255
|
+
z.localParticipant.publishData(
|
|
256
256
|
new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
|
|
257
257
|
{ reliable: !0 }
|
|
258
258
|
);
|
|
259
259
|
} catch {
|
|
260
260
|
}
|
|
261
261
|
} catch (M) {
|
|
262
|
-
const
|
|
263
|
-
|
|
262
|
+
const O = M instanceof Error && M.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
|
|
263
|
+
o(O);
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
}, []), A = S(async () => {
|
|
267
|
-
e ? a() : await s
|
|
268
|
-
}, [e,
|
|
269
|
-
a(), await
|
|
270
|
-
}, [a,
|
|
271
|
-
a(), u.current = null,
|
|
272
|
-
}, [a]), b = S(() =>
|
|
267
|
+
e ? a() : await c(s || void 0);
|
|
268
|
+
}, [e, s, a, c]), C = S(async (L) => {
|
|
269
|
+
a(), await c(L);
|
|
270
|
+
}, [a, c]), R = S(() => {
|
|
271
|
+
a(), u.current = null, o(null), d("");
|
|
272
|
+
}, [a]), b = S(() => o(null), []);
|
|
273
273
|
return P(() => () => {
|
|
274
274
|
h.current && h.current.stop();
|
|
275
275
|
}, []), {
|
|
276
276
|
isEnabled: e,
|
|
277
277
|
error: r,
|
|
278
|
-
previewEl:
|
|
279
|
-
activeDeviceId:
|
|
278
|
+
previewEl: i,
|
|
279
|
+
activeDeviceId: s,
|
|
280
280
|
toggle: A,
|
|
281
281
|
switchDevice: C,
|
|
282
282
|
attachRoom: m,
|
|
@@ -284,31 +284,31 @@ function mn() {
|
|
|
284
284
|
clearError: b
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
|
-
function
|
|
288
|
-
const [e, t] = N(!1), [r,
|
|
289
|
-
|
|
287
|
+
function wn() {
|
|
288
|
+
const [e, t] = N(!1), [r, o] = N(null), [i, l] = N(null), s = I(null), d = S((c) => {
|
|
289
|
+
s.current = c;
|
|
290
290
|
}, []), u = S(() => l(null), []), h = S(async () => {
|
|
291
|
-
const
|
|
292
|
-
if (
|
|
291
|
+
const c = s.current;
|
|
292
|
+
if (c) {
|
|
293
293
|
if (e) {
|
|
294
294
|
try {
|
|
295
|
-
await
|
|
295
|
+
await c.localParticipant.setScreenShareEnabled(!1);
|
|
296
296
|
} catch {
|
|
297
297
|
}
|
|
298
298
|
u(), t(!1);
|
|
299
299
|
return;
|
|
300
300
|
}
|
|
301
|
-
|
|
301
|
+
o(null);
|
|
302
302
|
try {
|
|
303
|
-
await
|
|
303
|
+
await c.localParticipant.setScreenShareEnabled(!0);
|
|
304
304
|
let A = 0;
|
|
305
305
|
const C = () => {
|
|
306
|
-
const R =
|
|
306
|
+
const R = c.localParticipant.getTrackPublication(Ut.Source.ScreenShare);
|
|
307
307
|
if (R != null && R.track) {
|
|
308
308
|
const b = R.track.attach();
|
|
309
309
|
l(b), t(!0);
|
|
310
310
|
try {
|
|
311
|
-
|
|
311
|
+
c.localParticipant.publishData(
|
|
312
312
|
new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
|
|
313
313
|
{ reliable: !0 }
|
|
314
314
|
);
|
|
@@ -321,59 +321,59 @@ function gn() {
|
|
|
321
321
|
C();
|
|
322
322
|
} catch (A) {
|
|
323
323
|
const C = A instanceof Error ? A.name : "";
|
|
324
|
-
C !== "NotAllowedError" && C !== "AbortError" &&
|
|
324
|
+
C !== "NotAllowedError" && C !== "AbortError" && o("Screen share unavailable. Try again."), t(!1);
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
}, [e, u]), m = S(() => {
|
|
328
|
-
const
|
|
329
|
-
if (
|
|
328
|
+
const c = s.current;
|
|
329
|
+
if (c && e)
|
|
330
330
|
try {
|
|
331
|
-
|
|
331
|
+
c.localParticipant.setScreenShareEnabled(!1);
|
|
332
332
|
} catch {
|
|
333
333
|
}
|
|
334
|
-
u(), t(!1),
|
|
335
|
-
}, [e, u]), a = S(() =>
|
|
336
|
-
return { isEnabled: e, error: r, previewEl:
|
|
334
|
+
u(), t(!1), o(null), s.current = null;
|
|
335
|
+
}, [e, u]), a = S(() => o(null), []);
|
|
336
|
+
return { isEnabled: e, error: r, previewEl: i, toggle: h, attachRoom: d, teardown: m, clearError: a };
|
|
337
337
|
}
|
|
338
|
-
function
|
|
339
|
-
const [e, t] = N([]), [r,
|
|
338
|
+
function _n() {
|
|
339
|
+
const [e, t] = N([]), [r, o] = N([]), i = S(async () => {
|
|
340
340
|
if (!(typeof navigator > "u" || !navigator.mediaDevices))
|
|
341
341
|
try {
|
|
342
342
|
const l = await navigator.mediaDevices.enumerateDevices();
|
|
343
|
-
t(l.filter((
|
|
343
|
+
t(l.filter((s) => s.kind === "audioinput")), o(l.filter((s) => s.kind === "videoinput"));
|
|
344
344
|
} catch {
|
|
345
345
|
}
|
|
346
346
|
}, []);
|
|
347
347
|
return P(() => {
|
|
348
|
-
if (
|
|
349
|
-
const l = () => void
|
|
348
|
+
if (i(), typeof navigator > "u" || !navigator.mediaDevices) return;
|
|
349
|
+
const l = () => void i();
|
|
350
350
|
return navigator.mediaDevices.addEventListener("devicechange", l), () => navigator.mediaDevices.removeEventListener("devicechange", l);
|
|
351
|
-
}, [
|
|
351
|
+
}, [i]), { mics: e, cameras: r, refresh: i };
|
|
352
352
|
}
|
|
353
|
-
function
|
|
354
|
-
const [
|
|
353
|
+
function xn(e, t, r = !1) {
|
|
354
|
+
const [o, i] = N(null), [l, s] = N(null), [d, u] = N(!r && !!e);
|
|
355
355
|
return P(() => {
|
|
356
356
|
if (r || !e) {
|
|
357
357
|
u(!1);
|
|
358
358
|
return;
|
|
359
359
|
}
|
|
360
360
|
const h = new AbortController(), m = t || "https://app.livelayer.studio";
|
|
361
|
-
return u(!0),
|
|
361
|
+
return u(!0), s(null), fetch(`${m}/api/widget/agent/${encodeURIComponent(e)}`, {
|
|
362
362
|
signal: h.signal
|
|
363
363
|
}).then(async (a) => {
|
|
364
364
|
if (!a.ok) {
|
|
365
|
-
const
|
|
366
|
-
throw new Error(
|
|
365
|
+
const c = await a.json().catch(() => ({}));
|
|
366
|
+
throw new Error(c.error || `HTTP ${a.status}`);
|
|
367
367
|
}
|
|
368
368
|
return a.json();
|
|
369
369
|
}).then((a) => {
|
|
370
|
-
h.signal.aborted || (
|
|
370
|
+
h.signal.aborted || (i(a), u(!1));
|
|
371
371
|
}).catch((a) => {
|
|
372
|
-
h.signal.aborted || (
|
|
372
|
+
h.signal.aborted || (s(a instanceof Error ? a.message : "Agent lookup failed"), u(!1));
|
|
373
373
|
}), () => h.abort();
|
|
374
|
-
}, [e, t, r]), { info:
|
|
374
|
+
}, [e, t, r]), { info: o, error: l, loading: d };
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function kn(e) {
|
|
377
377
|
if (typeof window > "u") return null;
|
|
378
378
|
try {
|
|
379
379
|
return window.localStorage.getItem(e);
|
|
@@ -381,52 +381,52 @@ function bn(e) {
|
|
|
381
381
|
return null;
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
|
-
function
|
|
384
|
+
function Ln(e, t) {
|
|
385
385
|
if (!(typeof window > "u"))
|
|
386
386
|
try {
|
|
387
387
|
window.localStorage.setItem(e, t);
|
|
388
388
|
} catch {
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
|
-
function
|
|
391
|
+
function Sn({
|
|
392
392
|
value: e,
|
|
393
393
|
defaultValue: t = "expanded",
|
|
394
394
|
onChange: r
|
|
395
395
|
} = {}) {
|
|
396
|
-
const
|
|
396
|
+
const o = e !== void 0, [i, l] = N(t), s = o ? e : i, d = S(
|
|
397
397
|
(u) => {
|
|
398
|
-
u !==
|
|
398
|
+
u !== s && (o || l(u), r == null || r(u));
|
|
399
399
|
},
|
|
400
|
-
[
|
|
400
|
+
[s, o, r]
|
|
401
401
|
);
|
|
402
|
-
return [
|
|
402
|
+
return [s, d];
|
|
403
403
|
}
|
|
404
|
-
const
|
|
405
|
-
function
|
|
406
|
-
return e &&
|
|
404
|
+
const Cn = ["hidden", "minimized", "expanded"];
|
|
405
|
+
function En(e) {
|
|
406
|
+
return e && Cn.includes(e) ? e : null;
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function Nn({
|
|
409
409
|
value: e,
|
|
410
410
|
defaultValue: t = "expanded",
|
|
411
411
|
onChange: r,
|
|
412
|
-
persistKey:
|
|
413
|
-
disablePersistence:
|
|
412
|
+
persistKey: o = "ll-widget",
|
|
413
|
+
disablePersistence: i = !1
|
|
414
414
|
} = {}) {
|
|
415
|
-
const l = `${
|
|
415
|
+
const l = `${o}:display-mode`, s = I(!1), [d, u] = Sn({
|
|
416
416
|
value: e,
|
|
417
417
|
defaultValue: t,
|
|
418
418
|
onChange: (h) => {
|
|
419
|
-
e === void 0 && !
|
|
419
|
+
e === void 0 && !i && Ln(l, h), r == null || r(h);
|
|
420
420
|
}
|
|
421
421
|
});
|
|
422
422
|
return P(() => {
|
|
423
|
-
if (
|
|
424
|
-
const h = kn(
|
|
423
|
+
if (s.current || (s.current = !0, i || e !== void 0)) return;
|
|
424
|
+
const h = En(kn(l));
|
|
425
425
|
h && h !== d && u(h);
|
|
426
426
|
}, []), [d, u];
|
|
427
427
|
}
|
|
428
|
-
const
|
|
429
|
-
function
|
|
428
|
+
const An = 640;
|
|
429
|
+
function Rn(e = An) {
|
|
430
430
|
const [t, r] = N(!1);
|
|
431
431
|
return P(() => {
|
|
432
432
|
if (e === !1) {
|
|
@@ -435,73 +435,73 @@ function Cn(e = Sn) {
|
|
|
435
435
|
}
|
|
436
436
|
if (typeof window > "u" || typeof window.matchMedia > "u")
|
|
437
437
|
return;
|
|
438
|
-
const
|
|
439
|
-
return l(), typeof
|
|
440
|
-
|
|
438
|
+
const o = `(max-width: ${e - 1}px)`, i = window.matchMedia(o), l = () => r(i.matches);
|
|
439
|
+
return l(), typeof i.addEventListener == "function" ? (i.addEventListener("change", l), () => i.removeEventListener("change", l)) : (i.addListener(l), () => {
|
|
440
|
+
i.removeListener(l);
|
|
441
441
|
});
|
|
442
442
|
}, [e]), t;
|
|
443
443
|
}
|
|
444
|
-
const
|
|
445
|
-
function
|
|
446
|
-
if (typeof window > "u" || window.history[
|
|
444
|
+
const Et = "__llHistoryPatched", Ze = "ll:pathname";
|
|
445
|
+
function In() {
|
|
446
|
+
if (typeof window > "u" || window.history[Et]) 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(
|
|
449
|
+
const o = e.apply(this, r);
|
|
450
|
+
return window.dispatchEvent(new Event(Ze)), o;
|
|
451
451
|
}, window.history.replaceState = function(...r) {
|
|
452
|
-
const
|
|
453
|
-
return window.dispatchEvent(new Event(
|
|
454
|
-
}, window.history[
|
|
452
|
+
const o = t.apply(this, r);
|
|
453
|
+
return window.dispatchEvent(new Event(Ze)), o;
|
|
454
|
+
}, window.history[Et] = !0;
|
|
455
455
|
}
|
|
456
|
-
function
|
|
456
|
+
function Nt() {
|
|
457
457
|
return typeof window > "u" ? "/" : window.location.pathname || "/";
|
|
458
458
|
}
|
|
459
|
-
function
|
|
459
|
+
function Mn(e) {
|
|
460
460
|
const [t, r] = N(
|
|
461
|
-
() => e ??
|
|
461
|
+
() => e ?? Nt()
|
|
462
462
|
);
|
|
463
463
|
return P(() => {
|
|
464
464
|
if (e !== void 0) return;
|
|
465
|
-
|
|
466
|
-
const
|
|
467
|
-
return
|
|
468
|
-
window.removeEventListener("popstate",
|
|
465
|
+
In();
|
|
466
|
+
const o = () => r(Nt());
|
|
467
|
+
return o(), window.addEventListener("popstate", o), window.addEventListener(Ze, o), () => {
|
|
468
|
+
window.removeEventListener("popstate", o), window.removeEventListener(Ze, o);
|
|
469
469
|
};
|
|
470
470
|
}, [e]), e ?? t;
|
|
471
471
|
}
|
|
472
|
-
const
|
|
473
|
-
function
|
|
474
|
-
return e.replace(
|
|
472
|
+
const At = /* @__PURE__ */ new Map(), Tn = /[\\^$+?.()|{}[\]]/g;
|
|
473
|
+
function Pn(e) {
|
|
474
|
+
return e.replace(Tn, "\\$&");
|
|
475
475
|
}
|
|
476
|
-
function
|
|
477
|
-
const t =
|
|
476
|
+
function Dn(e) {
|
|
477
|
+
const t = At.get(e);
|
|
478
478
|
if (t) return t;
|
|
479
|
-
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e,
|
|
480
|
-
return
|
|
479
|
+
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, o = "", i = "", l = r.replace(/\*\*/g, o).replace(/\*/g, i), d = Pn(l).replace(new RegExp(`\\/${o}`, "g"), "(?:\\/.*)?").replace(new RegExp(o, "g"), ".*").replace(new RegExp(i, "g"), "[^/]+"), u = new RegExp(`^${d}\\/?$`);
|
|
480
|
+
return At.set(e, u), u;
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function $n(e, t) {
|
|
483
483
|
const r = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
|
|
484
|
-
return
|
|
484
|
+
return Dn(e).test(r);
|
|
485
485
|
}
|
|
486
|
-
function
|
|
487
|
-
return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) :
|
|
486
|
+
function zn(e, t) {
|
|
487
|
+
return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : $n(e, t);
|
|
488
488
|
}
|
|
489
|
-
function
|
|
489
|
+
function Rt(e, t) {
|
|
490
490
|
if (!e || e.length === 0) return !1;
|
|
491
491
|
for (const r of e)
|
|
492
|
-
if (
|
|
492
|
+
if (zn(r, t)) return !0;
|
|
493
493
|
return !1;
|
|
494
494
|
}
|
|
495
|
-
function
|
|
496
|
-
return e === void 0 ? !0 :
|
|
495
|
+
function Hn(e, t, r) {
|
|
496
|
+
return e === void 0 ? !0 : Rt(r, e) ? !1 : t && t.length > 0 ? Rt(t, e) : !0;
|
|
497
497
|
}
|
|
498
|
-
function
|
|
499
|
-
return
|
|
500
|
-
() =>
|
|
498
|
+
function On(e, t, r) {
|
|
499
|
+
return Qe(
|
|
500
|
+
() => Hn(e, t, r),
|
|
501
501
|
[e, t, r]
|
|
502
502
|
);
|
|
503
503
|
}
|
|
504
|
-
const
|
|
504
|
+
const It = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
|
|
505
505
|
"svg",
|
|
506
506
|
{
|
|
507
507
|
className: t,
|
|
@@ -547,7 +547,7 @@ const At = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
|
|
|
547
547
|
}
|
|
548
548
|
)
|
|
549
549
|
}
|
|
550
|
-
),
|
|
550
|
+
), Mt = ({ className: e }) => /* @__PURE__ */ n(
|
|
551
551
|
"svg",
|
|
552
552
|
{
|
|
553
553
|
className: e,
|
|
@@ -565,7 +565,7 @@ const At = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
|
|
|
565
565
|
}
|
|
566
566
|
)
|
|
567
567
|
}
|
|
568
|
-
),
|
|
568
|
+
), qn = ({ className: e }) => /* @__PURE__ */ n(
|
|
569
569
|
"svg",
|
|
570
570
|
{
|
|
571
571
|
className: e,
|
|
@@ -576,12 +576,12 @@ const At = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
|
|
|
576
576
|
"aria-hidden": "true",
|
|
577
577
|
children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
578
578
|
}
|
|
579
|
-
),
|
|
579
|
+
), Bn = {
|
|
580
580
|
left: 180,
|
|
581
581
|
right: 0,
|
|
582
582
|
up: -90,
|
|
583
583
|
down: 90
|
|
584
|
-
},
|
|
584
|
+
}, Wn = ({ direction: e = "right", className: t }) => /* @__PURE__ */ n(
|
|
585
585
|
"svg",
|
|
586
586
|
{
|
|
587
587
|
className: t,
|
|
@@ -589,19 +589,19 @@ const At = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
|
|
|
589
589
|
viewBox: "0 0 24 24",
|
|
590
590
|
stroke: "currentColor",
|
|
591
591
|
strokeWidth: 2,
|
|
592
|
-
style: { transform: `rotate(${
|
|
592
|
+
style: { transform: `rotate(${Bn[e]}deg)` },
|
|
593
593
|
"aria-hidden": "true",
|
|
594
594
|
children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" })
|
|
595
595
|
}
|
|
596
596
|
);
|
|
597
|
-
function
|
|
597
|
+
function Fn(e) {
|
|
598
598
|
return e === "top-left" || e === "bottom-left" ? "left" : "right";
|
|
599
599
|
}
|
|
600
|
-
const
|
|
601
|
-
function
|
|
600
|
+
const jt = "ll-hidden-tab-center-y", Un = 5, Tt = 16;
|
|
601
|
+
function jn() {
|
|
602
602
|
if (typeof window > "u") return null;
|
|
603
603
|
try {
|
|
604
|
-
const e = window.localStorage.getItem(
|
|
604
|
+
const e = window.localStorage.getItem(jt);
|
|
605
605
|
if (!e) return null;
|
|
606
606
|
const t = Number.parseFloat(e);
|
|
607
607
|
return Number.isFinite(t) ? t : null;
|
|
@@ -609,30 +609,30 @@ function Bn() {
|
|
|
609
609
|
return null;
|
|
610
610
|
}
|
|
611
611
|
}
|
|
612
|
-
function
|
|
612
|
+
function Pt(e) {
|
|
613
613
|
if (!(typeof window > "u"))
|
|
614
614
|
try {
|
|
615
|
-
window.localStorage.setItem(
|
|
615
|
+
window.localStorage.setItem(jt, String(e));
|
|
616
616
|
} catch {
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
-
const
|
|
619
|
+
const Vn = ({
|
|
620
620
|
position: e,
|
|
621
621
|
isMobile: t,
|
|
622
622
|
isSpeaking: r,
|
|
623
|
-
onExpand:
|
|
624
|
-
label:
|
|
623
|
+
onExpand: o,
|
|
624
|
+
label: i = "Open widget"
|
|
625
625
|
}) => {
|
|
626
|
-
const l =
|
|
626
|
+
const l = Fn(e), s = l === "right" ? "left" : "right", d = t ? 80 : 72, [u, h] = N(null), [m, a] = N(!1), c = I(null), A = I(!1), C = S(
|
|
627
627
|
(g) => {
|
|
628
628
|
if (typeof window > "u") return g;
|
|
629
|
-
const E = d / 2, x =
|
|
630
|
-
return
|
|
629
|
+
const E = d / 2, x = Tt + E, q = window.innerHeight - Tt - E;
|
|
630
|
+
return q < x ? Math.max(x, g) : Math.max(x, Math.min(q, g));
|
|
631
631
|
},
|
|
632
632
|
[d]
|
|
633
633
|
);
|
|
634
634
|
P(() => {
|
|
635
|
-
const g =
|
|
635
|
+
const g = jn();
|
|
636
636
|
h(C(g ?? window.innerHeight / 2));
|
|
637
637
|
const E = () => {
|
|
638
638
|
h((x) => x === null ? null : C(x));
|
|
@@ -646,7 +646,7 @@ const Fn = ({
|
|
|
646
646
|
g.currentTarget.setPointerCapture(g.pointerId);
|
|
647
647
|
} catch {
|
|
648
648
|
}
|
|
649
|
-
|
|
649
|
+
c.current = {
|
|
650
650
|
startClientY: g.clientY,
|
|
651
651
|
startCenterY: u,
|
|
652
652
|
moved: !1
|
|
@@ -656,44 +656,44 @@ const Fn = ({
|
|
|
656
656
|
[u]
|
|
657
657
|
), b = S(
|
|
658
658
|
(g) => {
|
|
659
|
-
const E =
|
|
659
|
+
const E = c.current;
|
|
660
660
|
if (!E) return;
|
|
661
661
|
const x = g.clientY - E.startClientY;
|
|
662
|
-
!E.moved && Math.abs(x) >
|
|
662
|
+
!E.moved && Math.abs(x) > Un && (E.moved = !0, a(!0)), E.moved && h(C(E.startCenterY + x));
|
|
663
663
|
},
|
|
664
664
|
[C]
|
|
665
665
|
), L = S(
|
|
666
666
|
(g) => {
|
|
667
|
-
const E =
|
|
667
|
+
const E = c.current;
|
|
668
668
|
if (E) {
|
|
669
669
|
try {
|
|
670
670
|
g.currentTarget.releasePointerCapture(g.pointerId);
|
|
671
671
|
} catch {
|
|
672
672
|
}
|
|
673
|
-
|
|
673
|
+
c.current = null, E.moved && (a(!1), A.current = !0, h((x) => (x !== null && Pt(x), x)));
|
|
674
674
|
}
|
|
675
675
|
},
|
|
676
676
|
[]
|
|
677
|
-
),
|
|
677
|
+
), z = S(() => {
|
|
678
678
|
if (A.current) {
|
|
679
679
|
A.current = !1;
|
|
680
680
|
return;
|
|
681
681
|
}
|
|
682
|
-
|
|
683
|
-
}, [
|
|
682
|
+
o();
|
|
683
|
+
}, [o]), M = S(
|
|
684
684
|
(g) => {
|
|
685
685
|
if (g.key === "ArrowUp" || g.key === "ArrowDown") {
|
|
686
686
|
g.preventDefault();
|
|
687
687
|
const E = g.key === "ArrowUp" ? -8 : 8;
|
|
688
688
|
h((x) => {
|
|
689
689
|
if (x === null) return x;
|
|
690
|
-
const
|
|
691
|
-
return
|
|
690
|
+
const q = C(x + E);
|
|
691
|
+
return Pt(q), q;
|
|
692
692
|
});
|
|
693
693
|
}
|
|
694
694
|
},
|
|
695
695
|
[C]
|
|
696
|
-
),
|
|
696
|
+
), O = [
|
|
697
697
|
"ll-hidden",
|
|
698
698
|
`ll-hidden--${l}`,
|
|
699
699
|
t ? "ll-hidden--mobile" : "ll-hidden--desktop",
|
|
@@ -704,59 +704,59 @@ const Fn = ({
|
|
|
704
704
|
"button",
|
|
705
705
|
{
|
|
706
706
|
type: "button",
|
|
707
|
-
className:
|
|
707
|
+
className: O,
|
|
708
708
|
onPointerDown: R,
|
|
709
709
|
onPointerMove: b,
|
|
710
710
|
onPointerUp: L,
|
|
711
711
|
onPointerCancel: L,
|
|
712
|
-
onClick:
|
|
712
|
+
onClick: z,
|
|
713
713
|
onKeyDown: M,
|
|
714
|
-
"aria-label":
|
|
714
|
+
"aria-label": i,
|
|
715
715
|
"data-position": e,
|
|
716
716
|
style: p,
|
|
717
|
-
children: /* @__PURE__ */ n(
|
|
717
|
+
children: /* @__PURE__ */ n(Wn, { direction: s, className: "ll-hidden__chevron" })
|
|
718
718
|
}
|
|
719
719
|
);
|
|
720
|
-
},
|
|
720
|
+
}, Yn = ({
|
|
721
721
|
audioLevel: e,
|
|
722
722
|
bars: t = 20,
|
|
723
723
|
maxHeight: r = 20,
|
|
724
|
-
minHeight:
|
|
725
|
-
className:
|
|
724
|
+
minHeight: o = 4,
|
|
725
|
+
className: i,
|
|
726
726
|
barClassName: l
|
|
727
727
|
}) => {
|
|
728
|
-
const
|
|
728
|
+
const s = I(null), d = I([]), u = Qe(() => {
|
|
729
729
|
const m = (Math.sqrt(5) - 1) / 2;
|
|
730
|
-
return Array.from({ length: t }, (a,
|
|
730
|
+
return Array.from({ length: t }, (a, c) => 0.5 + c * m % 1 * 0.5);
|
|
731
731
|
}, [t]);
|
|
732
732
|
P(() => e.subscribe((a) => {
|
|
733
|
-
for (let
|
|
734
|
-
const A = d.current[
|
|
733
|
+
for (let c = 0; c < t; c++) {
|
|
734
|
+
const A = d.current[c];
|
|
735
735
|
if (!A) continue;
|
|
736
|
-
const C = Math.max(
|
|
736
|
+
const C = Math.max(o, a * r * u[c]);
|
|
737
737
|
A.style.height = `${C}px`;
|
|
738
738
|
}
|
|
739
|
-
}), [e, t, r,
|
|
740
|
-
const h = ["ll-waveform",
|
|
741
|
-
return /* @__PURE__ */ n("div", { ref:
|
|
739
|
+
}), [e, t, r, o, u]);
|
|
740
|
+
const h = ["ll-waveform", i].filter(Boolean).join(" ");
|
|
741
|
+
return /* @__PURE__ */ n("div", { ref: s, className: h, "aria-hidden": "true", children: Array.from({ length: t }, (m, a) => /* @__PURE__ */ n(
|
|
742
742
|
"div",
|
|
743
743
|
{
|
|
744
|
-
ref: (
|
|
745
|
-
d.current[a] =
|
|
744
|
+
ref: (c) => {
|
|
745
|
+
d.current[a] = c;
|
|
746
746
|
},
|
|
747
747
|
className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
|
|
748
|
-
style: { height: `${
|
|
748
|
+
style: { height: `${o}px` }
|
|
749
749
|
},
|
|
750
750
|
a
|
|
751
751
|
)) });
|
|
752
|
-
},
|
|
752
|
+
}, Gn = ({
|
|
753
753
|
position: e,
|
|
754
754
|
isMobile: t,
|
|
755
755
|
agentName: r,
|
|
756
|
-
avatarImageUrl:
|
|
757
|
-
agentState:
|
|
756
|
+
avatarImageUrl: o,
|
|
757
|
+
agentState: i,
|
|
758
758
|
isMuted: l,
|
|
759
|
-
audioLevel:
|
|
759
|
+
audioLevel: s,
|
|
760
760
|
onExpand: d,
|
|
761
761
|
onToggleMute: u,
|
|
762
762
|
onClose: h
|
|
@@ -774,21 +774,21 @@ const Fn = ({
|
|
|
774
774
|
onClick: d,
|
|
775
775
|
"aria-label": `Expand ${r} widget`,
|
|
776
776
|
children: [
|
|
777
|
-
|
|
777
|
+
o ? (
|
|
778
778
|
// eslint-disable-next-line @next/next/no-img-element
|
|
779
779
|
/* @__PURE__ */ n(
|
|
780
780
|
"img",
|
|
781
781
|
{
|
|
782
|
-
src:
|
|
782
|
+
src: o,
|
|
783
783
|
alt: r,
|
|
784
784
|
className: "ll-minimized__avatar"
|
|
785
785
|
}
|
|
786
786
|
)
|
|
787
787
|
) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
|
|
788
788
|
/* @__PURE__ */ n(
|
|
789
|
-
|
|
789
|
+
Yn,
|
|
790
790
|
{
|
|
791
|
-
audioLevel:
|
|
791
|
+
audioLevel: s,
|
|
792
792
|
bars: 16,
|
|
793
793
|
maxHeight: 18,
|
|
794
794
|
className: "ll-minimized__waveform"
|
|
@@ -809,10 +809,10 @@ const Fn = ({
|
|
|
809
809
|
(m.key === "Enter" || m.key === " ") && (m.stopPropagation(), m.preventDefault(), u());
|
|
810
810
|
},
|
|
811
811
|
"aria-label": l ? "Unmute microphone" : "Mute microphone",
|
|
812
|
-
children: /* @__PURE__ */ n(
|
|
812
|
+
children: /* @__PURE__ */ n(It, { muted: l, className: "ll-minimized__icon" })
|
|
813
813
|
}
|
|
814
814
|
),
|
|
815
|
-
/* @__PURE__ */ n(
|
|
815
|
+
/* @__PURE__ */ n(Mt, { className: "ll-minimized__icon ll-minimized__icon--expand" })
|
|
816
816
|
] })
|
|
817
817
|
]
|
|
818
818
|
}
|
|
@@ -826,12 +826,12 @@ const Fn = ({
|
|
|
826
826
|
role: "region",
|
|
827
827
|
"aria-label": `${r} widget`,
|
|
828
828
|
children: /* @__PURE__ */ _("div", { className: "ll-minimized__surface", children: [
|
|
829
|
-
|
|
829
|
+
o ? (
|
|
830
830
|
// eslint-disable-next-line @next/next/no-img-element
|
|
831
831
|
/* @__PURE__ */ n(
|
|
832
832
|
"img",
|
|
833
833
|
{
|
|
834
|
-
src:
|
|
834
|
+
src: o,
|
|
835
835
|
alt: r,
|
|
836
836
|
className: "ll-minimized__avatar"
|
|
837
837
|
}
|
|
@@ -839,7 +839,7 @@ const Fn = ({
|
|
|
839
839
|
) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
|
|
840
840
|
/* @__PURE__ */ _("div", { className: "ll-minimized__meta", children: [
|
|
841
841
|
/* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
|
|
842
|
-
/* @__PURE__ */ n("span", { className: "ll-minimized__state", children:
|
|
842
|
+
/* @__PURE__ */ n("span", { className: "ll-minimized__state", children: i === "speaking" ? "Speaking" : i === "thinking" ? "Thinking" : "Listening" })
|
|
843
843
|
] }),
|
|
844
844
|
/* @__PURE__ */ _("div", { className: "ll-minimized__controls", children: [
|
|
845
845
|
/* @__PURE__ */ n(
|
|
@@ -849,7 +849,7 @@ const Fn = ({
|
|
|
849
849
|
className: "ll-minimized__btn",
|
|
850
850
|
onClick: u,
|
|
851
851
|
"aria-label": l ? "Unmute microphone" : "Mute microphone",
|
|
852
|
-
children: /* @__PURE__ */ n(
|
|
852
|
+
children: /* @__PURE__ */ n(It, { muted: l, className: "ll-minimized__icon" })
|
|
853
853
|
}
|
|
854
854
|
),
|
|
855
855
|
/* @__PURE__ */ n(
|
|
@@ -859,7 +859,7 @@ const Fn = ({
|
|
|
859
859
|
className: "ll-minimized__btn",
|
|
860
860
|
onClick: d,
|
|
861
861
|
"aria-label": `Expand ${r} widget`,
|
|
862
|
-
children: /* @__PURE__ */ n(
|
|
862
|
+
children: /* @__PURE__ */ n(Mt, { className: "ll-minimized__icon" })
|
|
863
863
|
}
|
|
864
864
|
),
|
|
865
865
|
/* @__PURE__ */ n(
|
|
@@ -869,22 +869,22 @@ const Fn = ({
|
|
|
869
869
|
className: "ll-minimized__btn ll-minimized__btn--close",
|
|
870
870
|
onClick: h,
|
|
871
871
|
"aria-label": "Close widget",
|
|
872
|
-
children: /* @__PURE__ */ n(
|
|
872
|
+
children: /* @__PURE__ */ n(qn, { className: "ll-minimized__icon" })
|
|
873
873
|
}
|
|
874
874
|
)
|
|
875
875
|
] })
|
|
876
876
|
] })
|
|
877
877
|
}
|
|
878
|
-
),
|
|
878
|
+
), Jn = ({
|
|
879
879
|
src: e,
|
|
880
880
|
alt: t,
|
|
881
881
|
preCannedPlaying: r = !1,
|
|
882
|
-
className:
|
|
883
|
-
style:
|
|
882
|
+
className: o,
|
|
883
|
+
style: i
|
|
884
884
|
}) => {
|
|
885
|
-
const [l,
|
|
885
|
+
const [l, s] = N(!1), d = I(e);
|
|
886
886
|
if (P(() => {
|
|
887
|
-
d.current !== e && (d.current = e,
|
|
887
|
+
d.current !== e && (d.current = e, s(!1));
|
|
888
888
|
}, [e]), !e) return null;
|
|
889
889
|
const u = {
|
|
890
890
|
position: "absolute",
|
|
@@ -896,7 +896,7 @@ const Fn = ({
|
|
|
896
896
|
transition: "opacity 500ms ease, transform 500ms ease",
|
|
897
897
|
transform: r ? "scale(1.02)" : "scale(1)",
|
|
898
898
|
opacity: l ? 1 : 0,
|
|
899
|
-
...
|
|
899
|
+
...i
|
|
900
900
|
};
|
|
901
901
|
return (
|
|
902
902
|
// eslint-disable-next-line @next/next/no-img-element
|
|
@@ -905,122 +905,122 @@ const Fn = ({
|
|
|
905
905
|
{
|
|
906
906
|
src: e,
|
|
907
907
|
alt: t,
|
|
908
|
-
className:
|
|
908
|
+
className: o,
|
|
909
909
|
style: u,
|
|
910
910
|
loading: "eager",
|
|
911
911
|
fetchpriority: "high",
|
|
912
|
-
onLoad: () =>
|
|
912
|
+
onLoad: () => s(!0)
|
|
913
913
|
}
|
|
914
914
|
)
|
|
915
915
|
);
|
|
916
|
-
},
|
|
916
|
+
}, Kn = ({
|
|
917
917
|
position: e,
|
|
918
918
|
isMobile: t,
|
|
919
919
|
agentName: r,
|
|
920
|
-
avatarImageUrl:
|
|
921
|
-
idleLoopUrl:
|
|
920
|
+
avatarImageUrl: o,
|
|
921
|
+
idleLoopUrl: i,
|
|
922
922
|
greeting: l,
|
|
923
|
-
branding:
|
|
923
|
+
branding: s,
|
|
924
924
|
teamMembers: d,
|
|
925
925
|
currentTeamMemberId: u,
|
|
926
926
|
isSwitchingTeamMember: h,
|
|
927
927
|
teamSwitcherOpen: m,
|
|
928
928
|
onToggleTeamSwitcher: a,
|
|
929
|
-
onSelectTeamMember:
|
|
929
|
+
onSelectTeamMember: c,
|
|
930
930
|
languageMenuOpen: A,
|
|
931
931
|
onToggleLanguageMenu: C,
|
|
932
932
|
connectionState: R,
|
|
933
933
|
agentState: b,
|
|
934
934
|
transcript: L,
|
|
935
|
-
canResume:
|
|
935
|
+
canResume: z,
|
|
936
936
|
needsUserGesture: M,
|
|
937
|
-
error:
|
|
937
|
+
error: O,
|
|
938
938
|
isMuted: p,
|
|
939
939
|
micError: g,
|
|
940
940
|
micDevices: E,
|
|
941
941
|
isCameraEnabled: x,
|
|
942
|
-
cameraPreviewEl:
|
|
943
|
-
cameraDevices:
|
|
942
|
+
cameraPreviewEl: q,
|
|
943
|
+
cameraDevices: Q,
|
|
944
944
|
activeCameraId: de,
|
|
945
|
-
isScreenShareEnabled:
|
|
946
|
-
screenPreviewEl:
|
|
945
|
+
isScreenShareEnabled: Z,
|
|
946
|
+
screenPreviewEl: ee,
|
|
947
947
|
isSpeakerMuted: ue,
|
|
948
|
-
allowCamera:
|
|
949
|
-
allowScreenShare:
|
|
950
|
-
allowTyping:
|
|
951
|
-
avatarVideoContainerRef:
|
|
952
|
-
onConnect:
|
|
948
|
+
allowCamera: He,
|
|
949
|
+
allowScreenShare: Oe,
|
|
950
|
+
allowTyping: qe,
|
|
951
|
+
avatarVideoContainerRef: Be,
|
|
952
|
+
onConnect: me,
|
|
953
953
|
onDisconnect: ge,
|
|
954
954
|
onRetry: ye,
|
|
955
955
|
onResumeAudio: ve,
|
|
956
956
|
onToggleMute: be,
|
|
957
957
|
onToggleCamera: we,
|
|
958
958
|
onSwitchCameraDevice: _e,
|
|
959
|
-
onToggleScreenShare:
|
|
960
|
-
onToggleSpeaker:
|
|
961
|
-
onSendMessage:
|
|
962
|
-
onMinimize:
|
|
963
|
-
onClose:
|
|
964
|
-
onClearMicError:
|
|
959
|
+
onToggleScreenShare: xe,
|
|
960
|
+
onToggleSpeaker: F,
|
|
961
|
+
onSendMessage: We,
|
|
962
|
+
onMinimize: Fe,
|
|
963
|
+
onClose: Ue,
|
|
964
|
+
onClearMicError: je
|
|
965
965
|
}) => {
|
|
966
|
-
var
|
|
967
|
-
const
|
|
966
|
+
var Se;
|
|
967
|
+
const le = L.length > 0 ? L[L.length - 1] : null, oe = ((d == null ? void 0 : d.length) ?? 0) > 1, ke = R === "connecting" || R === "connected", Le = R === "connected", fe = R === "idle" || R === "disconnected" || R === "error", V = I(null), Re = I(null);
|
|
968
968
|
P(() => {
|
|
969
|
-
const
|
|
970
|
-
|
|
971
|
-
}, [
|
|
972
|
-
const
|
|
973
|
-
|
|
974
|
-
}, [
|
|
975
|
-
const [
|
|
969
|
+
const v = V.current;
|
|
970
|
+
v && (v.innerHTML = "", q && (q.style.width = "100%", q.style.height = "100%", q.style.objectFit = "cover", q.style.transform = "scaleX(-1)", v.appendChild(q)));
|
|
971
|
+
}, [q]), P(() => {
|
|
972
|
+
const v = Re.current;
|
|
973
|
+
v && (v.innerHTML = "", ee && (ee.style.width = "100%", ee.style.height = "100%", ee.style.objectFit = "contain", v.appendChild(ee)));
|
|
974
|
+
}, [ee]);
|
|
975
|
+
const [te, X] = N(!1), [ie, ae] = N(!1);
|
|
976
976
|
P(() => {
|
|
977
|
-
if (!
|
|
978
|
-
const
|
|
979
|
-
|
|
977
|
+
if (!te && !ie && !A && !m) return;
|
|
978
|
+
const v = () => {
|
|
979
|
+
X(!1), ae(!1), A && C(), m && a();
|
|
980
980
|
};
|
|
981
|
-
return document.addEventListener("click",
|
|
981
|
+
return document.addEventListener("click", v), () => document.removeEventListener("click", v);
|
|
982
982
|
}, [
|
|
983
|
-
|
|
984
|
-
|
|
983
|
+
te,
|
|
984
|
+
ie,
|
|
985
985
|
A,
|
|
986
986
|
m,
|
|
987
987
|
C,
|
|
988
988
|
a
|
|
989
989
|
]);
|
|
990
|
-
const [
|
|
991
|
-
(
|
|
992
|
-
|
|
993
|
-
const
|
|
994
|
-
|
|
990
|
+
const [J, ne] = N(""), pe = S(
|
|
991
|
+
(v) => {
|
|
992
|
+
v.preventDefault();
|
|
993
|
+
const Y = J.trim();
|
|
994
|
+
Y && (We(Y), ne(""));
|
|
995
995
|
},
|
|
996
|
-
[
|
|
997
|
-
),
|
|
996
|
+
[J, We]
|
|
997
|
+
), Ie = s.productName || "Live Layer", Ve = Le && (le != null && le.text) ? le.text : l || "", Me = [
|
|
998
998
|
"ll-expanded",
|
|
999
999
|
t ? "ll-expanded--mobile" : "ll-expanded--desktop"
|
|
1000
1000
|
].join(" ");
|
|
1001
1001
|
return /* @__PURE__ */ _(
|
|
1002
1002
|
"div",
|
|
1003
1003
|
{
|
|
1004
|
-
className:
|
|
1004
|
+
className: Me,
|
|
1005
1005
|
"data-position": e,
|
|
1006
|
-
"data-state":
|
|
1006
|
+
"data-state": Le ? "connected" : ke ? "connecting" : "idle",
|
|
1007
1007
|
role: "dialog",
|
|
1008
1008
|
"aria-label": `${r} widget`,
|
|
1009
1009
|
children: [
|
|
1010
1010
|
/* @__PURE__ */ _("div", { className: "ll-expanded__bg", children: [
|
|
1011
|
-
|
|
1012
|
-
|
|
1011
|
+
o ? /* @__PURE__ */ n(
|
|
1012
|
+
Jn,
|
|
1013
1013
|
{
|
|
1014
|
-
src:
|
|
1014
|
+
src: o,
|
|
1015
1015
|
alt: r,
|
|
1016
1016
|
className: "ll-expanded__bg-img"
|
|
1017
1017
|
}
|
|
1018
|
-
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((
|
|
1019
|
-
|
|
1018
|
+
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Se = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Se.toUpperCase()) || "A" }) }),
|
|
1019
|
+
i && !Le && /* @__PURE__ */ n(
|
|
1020
1020
|
"video",
|
|
1021
1021
|
{
|
|
1022
1022
|
className: "ll-expanded__bg-idle",
|
|
1023
|
-
src:
|
|
1023
|
+
src: i,
|
|
1024
1024
|
autoPlay: !0,
|
|
1025
1025
|
loop: !0,
|
|
1026
1026
|
muted: !0,
|
|
@@ -1028,12 +1028,12 @@ const Fn = ({
|
|
|
1028
1028
|
}
|
|
1029
1029
|
)
|
|
1030
1030
|
] }),
|
|
1031
|
-
/* @__PURE__ */ n("div", { ref:
|
|
1031
|
+
/* @__PURE__ */ n("div", { ref: Be, className: "ll-expanded__video" }),
|
|
1032
1032
|
R === "connecting" && /* @__PURE__ */ _("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
|
|
1033
1033
|
/* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
|
|
1034
1034
|
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: h ? "Switching..." : "Connecting..." })
|
|
1035
1035
|
] }),
|
|
1036
|
-
M &&
|
|
1036
|
+
M && Le && /* @__PURE__ */ _(
|
|
1037
1037
|
"button",
|
|
1038
1038
|
{
|
|
1039
1039
|
type: "button",
|
|
@@ -1045,7 +1045,7 @@ const Fn = ({
|
|
|
1045
1045
|
]
|
|
1046
1046
|
}
|
|
1047
1047
|
),
|
|
1048
|
-
|
|
1048
|
+
ke ? /* @__PURE__ */ _("div", { className: "ll-expanded__topbar", children: [
|
|
1049
1049
|
/* @__PURE__ */ _("div", { className: "ll-expanded__topbar-left", children: [
|
|
1050
1050
|
/* @__PURE__ */ _("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1051
1051
|
/* @__PURE__ */ _(
|
|
@@ -1053,45 +1053,45 @@ const Fn = ({
|
|
|
1053
1053
|
{
|
|
1054
1054
|
type: "button",
|
|
1055
1055
|
className: "ll-hpill",
|
|
1056
|
-
onClick: (
|
|
1057
|
-
|
|
1056
|
+
onClick: (v) => {
|
|
1057
|
+
oe && (v.stopPropagation(), a());
|
|
1058
1058
|
},
|
|
1059
|
-
"aria-haspopup":
|
|
1060
|
-
"aria-expanded":
|
|
1059
|
+
"aria-haspopup": oe ? "listbox" : void 0,
|
|
1060
|
+
"aria-expanded": oe ? m : void 0,
|
|
1061
1061
|
children: [
|
|
1062
1062
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
|
|
1063
|
-
|
|
1063
|
+
oe && /* @__PURE__ */ n(Ke, {})
|
|
1064
1064
|
]
|
|
1065
1065
|
}
|
|
1066
1066
|
),
|
|
1067
|
-
|
|
1067
|
+
oe && m && /* @__PURE__ */ n(
|
|
1068
1068
|
"div",
|
|
1069
1069
|
{
|
|
1070
1070
|
className: "ll-hmenu",
|
|
1071
|
-
onClick: (
|
|
1071
|
+
onClick: (v) => v.stopPropagation(),
|
|
1072
1072
|
role: "listbox",
|
|
1073
|
-
children: d == null ? void 0 : d.map((
|
|
1073
|
+
children: d == null ? void 0 : d.map((v) => /* @__PURE__ */ _(
|
|
1074
1074
|
"button",
|
|
1075
1075
|
{
|
|
1076
1076
|
type: "button",
|
|
1077
|
-
className: `ll-hmenu__item ${
|
|
1078
|
-
onClick: () =>
|
|
1077
|
+
className: `ll-hmenu__item ${v.id === u ? "is-active" : ""}`,
|
|
1078
|
+
onClick: () => c(v.id),
|
|
1079
1079
|
role: "option",
|
|
1080
|
-
"aria-selected":
|
|
1080
|
+
"aria-selected": v.id === u,
|
|
1081
1081
|
children: [
|
|
1082
|
-
|
|
1082
|
+
v.avatarImageUrl && /* @__PURE__ */ n(
|
|
1083
1083
|
"img",
|
|
1084
1084
|
{
|
|
1085
|
-
src:
|
|
1085
|
+
src: v.avatarImageUrl,
|
|
1086
1086
|
alt: "",
|
|
1087
1087
|
className: "ll-hmenu__avatar"
|
|
1088
1088
|
}
|
|
1089
1089
|
),
|
|
1090
|
-
/* @__PURE__ */ n("span", { className: "ll-hmenu__name", children:
|
|
1091
|
-
|
|
1090
|
+
/* @__PURE__ */ n("span", { className: "ll-hmenu__name", children: v.name }),
|
|
1091
|
+
v.role && /* @__PURE__ */ n("span", { className: "ll-hmenu__role", children: v.role })
|
|
1092
1092
|
]
|
|
1093
1093
|
},
|
|
1094
|
-
|
|
1094
|
+
v.id
|
|
1095
1095
|
))
|
|
1096
1096
|
}
|
|
1097
1097
|
)
|
|
@@ -1102,8 +1102,8 @@ const Fn = ({
|
|
|
1102
1102
|
{
|
|
1103
1103
|
type: "button",
|
|
1104
1104
|
className: "ll-hpill ll-hpill--compact",
|
|
1105
|
-
onClick: (
|
|
1106
|
-
|
|
1105
|
+
onClick: (v) => {
|
|
1106
|
+
v.stopPropagation(), C();
|
|
1107
1107
|
},
|
|
1108
1108
|
"aria-haspopup": "listbox",
|
|
1109
1109
|
"aria-expanded": A,
|
|
@@ -1111,7 +1111,7 @@ const Fn = ({
|
|
|
1111
1111
|
title: "Language: English",
|
|
1112
1112
|
children: [
|
|
1113
1113
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: "EN" }),
|
|
1114
|
-
/* @__PURE__ */ n(
|
|
1114
|
+
/* @__PURE__ */ n(Ke, {})
|
|
1115
1115
|
]
|
|
1116
1116
|
}
|
|
1117
1117
|
),
|
|
@@ -1119,7 +1119,7 @@ const Fn = ({
|
|
|
1119
1119
|
"div",
|
|
1120
1120
|
{
|
|
1121
1121
|
className: "ll-hmenu",
|
|
1122
|
-
onClick: (
|
|
1122
|
+
onClick: (v) => v.stopPropagation(),
|
|
1123
1123
|
role: "listbox",
|
|
1124
1124
|
children: /* @__PURE__ */ n(
|
|
1125
1125
|
"button",
|
|
@@ -1148,10 +1148,10 @@ const Fn = ({
|
|
|
1148
1148
|
{
|
|
1149
1149
|
type: "button",
|
|
1150
1150
|
className: "ll-hbtn",
|
|
1151
|
-
onClick:
|
|
1151
|
+
onClick: Fe,
|
|
1152
1152
|
"aria-label": "Minimize widget",
|
|
1153
1153
|
title: "Minimize",
|
|
1154
|
-
children: /* @__PURE__ */ n(
|
|
1154
|
+
children: /* @__PURE__ */ n($t, {})
|
|
1155
1155
|
}
|
|
1156
1156
|
),
|
|
1157
1157
|
/* @__PURE__ */ n(
|
|
@@ -1159,26 +1159,26 @@ const Fn = ({
|
|
|
1159
1159
|
{
|
|
1160
1160
|
type: "button",
|
|
1161
1161
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1162
|
-
onClick:
|
|
1162
|
+
onClick: Ue,
|
|
1163
1163
|
"aria-label": "End call",
|
|
1164
1164
|
title: "End call",
|
|
1165
|
-
children: /* @__PURE__ */ n(
|
|
1165
|
+
children: /* @__PURE__ */ n(Dt, {})
|
|
1166
1166
|
}
|
|
1167
1167
|
)
|
|
1168
1168
|
] })
|
|
1169
1169
|
] }) : (
|
|
1170
1170
|
// Idle-state header with Live Layer product name + minimize/close
|
|
1171
1171
|
/* @__PURE__ */ _("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
|
|
1172
|
-
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children:
|
|
1172
|
+
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Ie }),
|
|
1173
1173
|
/* @__PURE__ */ _("div", { className: "ll-expanded__header-actions", children: [
|
|
1174
1174
|
/* @__PURE__ */ n(
|
|
1175
1175
|
"button",
|
|
1176
1176
|
{
|
|
1177
1177
|
type: "button",
|
|
1178
1178
|
className: "ll-hbtn ll-hbtn--ghost",
|
|
1179
|
-
onClick:
|
|
1179
|
+
onClick: Fe,
|
|
1180
1180
|
"aria-label": "Minimize widget",
|
|
1181
|
-
children: /* @__PURE__ */ n(
|
|
1181
|
+
children: /* @__PURE__ */ n($t, {})
|
|
1182
1182
|
}
|
|
1183
1183
|
),
|
|
1184
1184
|
/* @__PURE__ */ n(
|
|
@@ -1186,41 +1186,41 @@ const Fn = ({
|
|
|
1186
1186
|
{
|
|
1187
1187
|
type: "button",
|
|
1188
1188
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1189
|
-
onClick:
|
|
1189
|
+
onClick: Ue,
|
|
1190
1190
|
"aria-label": "Close widget",
|
|
1191
|
-
children: /* @__PURE__ */ n(
|
|
1191
|
+
children: /* @__PURE__ */ n(Dt, {})
|
|
1192
1192
|
}
|
|
1193
1193
|
)
|
|
1194
1194
|
] })
|
|
1195
1195
|
] })
|
|
1196
1196
|
),
|
|
1197
|
-
|
|
1198
|
-
const
|
|
1199
|
-
return /* @__PURE__ */ _(
|
|
1200
|
-
R === "idle" && !
|
|
1197
|
+
fe && /* @__PURE__ */ (() => {
|
|
1198
|
+
const v = z ? "Restart paused session" : R === "disconnected" ? "Reconnect to agent" : "Start video call", Y = z ? "Pick up where you left off" : null;
|
|
1199
|
+
return /* @__PURE__ */ _(Ft, { children: [
|
|
1200
|
+
R === "idle" && !z && !O && /* @__PURE__ */ _(
|
|
1201
1201
|
"button",
|
|
1202
1202
|
{
|
|
1203
1203
|
type: "button",
|
|
1204
1204
|
className: "ll-expanded__play",
|
|
1205
|
-
onClick:
|
|
1206
|
-
"aria-label":
|
|
1205
|
+
onClick: me,
|
|
1206
|
+
"aria-label": v,
|
|
1207
1207
|
children: [
|
|
1208
1208
|
/* @__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" }) }) }),
|
|
1209
|
-
/* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children:
|
|
1209
|
+
/* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children: v })
|
|
1210
1210
|
]
|
|
1211
1211
|
}
|
|
1212
1212
|
),
|
|
1213
1213
|
/* @__PURE__ */ _("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
|
|
1214
1214
|
l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
|
|
1215
|
-
|
|
1215
|
+
Y && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: Y }),
|
|
1216
1216
|
/* @__PURE__ */ n(
|
|
1217
1217
|
"button",
|
|
1218
1218
|
{
|
|
1219
1219
|
type: "button",
|
|
1220
1220
|
className: "ll-expanded__cta",
|
|
1221
|
-
onClick:
|
|
1222
|
-
"aria-label":
|
|
1223
|
-
children:
|
|
1221
|
+
onClick: me,
|
|
1222
|
+
"aria-label": v,
|
|
1223
|
+
children: v
|
|
1224
1224
|
}
|
|
1225
1225
|
)
|
|
1226
1226
|
] })
|
|
@@ -1229,40 +1229,40 @@ const Fn = ({
|
|
|
1229
1229
|
/* @__PURE__ */ _(
|
|
1230
1230
|
"div",
|
|
1231
1231
|
{
|
|
1232
|
-
className: `ll-expanded__pip ${
|
|
1232
|
+
className: `ll-expanded__pip ${ke && (x || Z) ? "is-visible" : ""}`,
|
|
1233
1233
|
children: [
|
|
1234
1234
|
/* @__PURE__ */ n(
|
|
1235
1235
|
"div",
|
|
1236
1236
|
{
|
|
1237
|
-
ref:
|
|
1238
|
-
className:
|
|
1237
|
+
ref: Re,
|
|
1238
|
+
className: Z ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1239
1239
|
}
|
|
1240
1240
|
),
|
|
1241
1241
|
/* @__PURE__ */ n(
|
|
1242
1242
|
"div",
|
|
1243
1243
|
{
|
|
1244
|
-
ref:
|
|
1245
|
-
className: !
|
|
1244
|
+
ref: V,
|
|
1245
|
+
className: !Z && x ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1246
1246
|
}
|
|
1247
1247
|
)
|
|
1248
1248
|
]
|
|
1249
1249
|
}
|
|
1250
1250
|
),
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
/* @__PURE__ */ _("div", { className: "ll-toolbar", onClick: (
|
|
1254
|
-
|
|
1251
|
+
ke ? /* @__PURE__ */ _("div", { className: "ll-expanded__bottom", children: [
|
|
1252
|
+
Ve && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Ve }) }),
|
|
1253
|
+
/* @__PURE__ */ _("div", { className: "ll-toolbar", onClick: (v) => v.stopPropagation(), children: [
|
|
1254
|
+
Oe && /* @__PURE__ */ n(
|
|
1255
1255
|
"button",
|
|
1256
1256
|
{
|
|
1257
1257
|
type: "button",
|
|
1258
|
-
className: `ll-tool ${
|
|
1259
|
-
onClick:
|
|
1260
|
-
"aria-label":
|
|
1261
|
-
title:
|
|
1262
|
-
children: /* @__PURE__ */ n(
|
|
1258
|
+
className: `ll-tool ${Z ? "is-on" : ""}`,
|
|
1259
|
+
onClick: xe,
|
|
1260
|
+
"aria-label": Z ? "Stop sharing screen" : "Share screen",
|
|
1261
|
+
title: Z ? "Stop sharing" : "Share screen",
|
|
1262
|
+
children: /* @__PURE__ */ n(Xn, {})
|
|
1263
1263
|
}
|
|
1264
1264
|
),
|
|
1265
|
-
|
|
1265
|
+
He && /* @__PURE__ */ _("div", { className: "ll-tool-split", children: [
|
|
1266
1266
|
/* @__PURE__ */ n(
|
|
1267
1267
|
"button",
|
|
1268
1268
|
{
|
|
@@ -1271,7 +1271,7 @@ const Fn = ({
|
|
|
1271
1271
|
onClick: we,
|
|
1272
1272
|
"aria-label": x ? "Turn off camera" : "Turn on camera",
|
|
1273
1273
|
title: x ? "Stop camera" : "Start camera",
|
|
1274
|
-
children: /* @__PURE__ */ n(
|
|
1274
|
+
children: /* @__PURE__ */ n(Qn, {})
|
|
1275
1275
|
}
|
|
1276
1276
|
),
|
|
1277
1277
|
/* @__PURE__ */ n(
|
|
@@ -1279,23 +1279,23 @@ const Fn = ({
|
|
|
1279
1279
|
{
|
|
1280
1280
|
type: "button",
|
|
1281
1281
|
className: `ll-tool ll-tool--right ${x ? "is-on" : ""}`,
|
|
1282
|
-
onClick: (
|
|
1283
|
-
|
|
1282
|
+
onClick: (v) => {
|
|
1283
|
+
v.stopPropagation(), ae((Y) => !Y), X(!1);
|
|
1284
1284
|
},
|
|
1285
1285
|
"aria-label": "Camera devices",
|
|
1286
1286
|
"aria-haspopup": "listbox",
|
|
1287
|
-
"aria-expanded":
|
|
1288
|
-
children: /* @__PURE__ */ n(
|
|
1287
|
+
"aria-expanded": ie,
|
|
1288
|
+
children: /* @__PURE__ */ n(Ke, {})
|
|
1289
1289
|
}
|
|
1290
1290
|
),
|
|
1291
|
-
|
|
1292
|
-
|
|
1291
|
+
ie && Q.length > 0 && /* @__PURE__ */ n(
|
|
1292
|
+
zt,
|
|
1293
1293
|
{
|
|
1294
1294
|
label: "Camera",
|
|
1295
|
-
devices:
|
|
1295
|
+
devices: Q,
|
|
1296
1296
|
activeId: de,
|
|
1297
|
-
onPick: (
|
|
1298
|
-
|
|
1297
|
+
onPick: (v) => {
|
|
1298
|
+
ae(!1), _e(v);
|
|
1299
1299
|
}
|
|
1300
1300
|
}
|
|
1301
1301
|
)
|
|
@@ -1309,7 +1309,7 @@ const Fn = ({
|
|
|
1309
1309
|
onClick: be,
|
|
1310
1310
|
"aria-label": p ? "Unmute microphone" : "Mute microphone",
|
|
1311
1311
|
title: p ? "Unmute" : "Mute",
|
|
1312
|
-
children: /* @__PURE__ */ n(
|
|
1312
|
+
children: /* @__PURE__ */ n(Zn, { muted: p })
|
|
1313
1313
|
}
|
|
1314
1314
|
),
|
|
1315
1315
|
/* @__PURE__ */ n(
|
|
@@ -1317,22 +1317,22 @@ const Fn = ({
|
|
|
1317
1317
|
{
|
|
1318
1318
|
type: "button",
|
|
1319
1319
|
className: `ll-tool ll-tool--right ${p ? "is-muted" : ""}`,
|
|
1320
|
-
onClick: (
|
|
1321
|
-
|
|
1320
|
+
onClick: (v) => {
|
|
1321
|
+
v.stopPropagation(), X((Y) => !Y), ae(!1);
|
|
1322
1322
|
},
|
|
1323
1323
|
"aria-label": "Microphone devices",
|
|
1324
1324
|
"aria-haspopup": "listbox",
|
|
1325
|
-
"aria-expanded":
|
|
1326
|
-
children: /* @__PURE__ */ n(
|
|
1325
|
+
"aria-expanded": te,
|
|
1326
|
+
children: /* @__PURE__ */ n(Ke, {})
|
|
1327
1327
|
}
|
|
1328
1328
|
),
|
|
1329
|
-
|
|
1330
|
-
|
|
1329
|
+
te && E.length > 0 && /* @__PURE__ */ n(
|
|
1330
|
+
zt,
|
|
1331
1331
|
{
|
|
1332
1332
|
label: "Microphone",
|
|
1333
1333
|
devices: E,
|
|
1334
1334
|
activeId: "",
|
|
1335
|
-
onPick: () =>
|
|
1335
|
+
onPick: () => X(!1)
|
|
1336
1336
|
}
|
|
1337
1337
|
)
|
|
1338
1338
|
] }),
|
|
@@ -1341,32 +1341,32 @@ const Fn = ({
|
|
|
1341
1341
|
{
|
|
1342
1342
|
type: "button",
|
|
1343
1343
|
className: `ll-tool ${ue ? "is-muted" : ""}`,
|
|
1344
|
-
onClick:
|
|
1344
|
+
onClick: F,
|
|
1345
1345
|
"aria-label": ue ? "Unmute speaker" : "Mute speaker",
|
|
1346
1346
|
title: ue ? "Unmute speaker" : "Mute speaker",
|
|
1347
|
-
children: /* @__PURE__ */ n(
|
|
1347
|
+
children: /* @__PURE__ */ n(er, { muted: ue })
|
|
1348
1348
|
}
|
|
1349
1349
|
)
|
|
1350
1350
|
] }),
|
|
1351
|
-
|
|
1351
|
+
qe && /* @__PURE__ */ _("form", { className: "ll-message-input", onSubmit: pe, children: [
|
|
1352
1352
|
/* @__PURE__ */ n(
|
|
1353
1353
|
"input",
|
|
1354
1354
|
{
|
|
1355
1355
|
type: "text",
|
|
1356
1356
|
className: "ll-message-input__field",
|
|
1357
1357
|
placeholder: "Message...",
|
|
1358
|
-
value:
|
|
1359
|
-
onChange: (
|
|
1358
|
+
value: J,
|
|
1359
|
+
onChange: (v) => ne(v.target.value),
|
|
1360
1360
|
"aria-label": "Message the agent"
|
|
1361
1361
|
}
|
|
1362
1362
|
),
|
|
1363
|
-
|
|
1363
|
+
J.trim() && /* @__PURE__ */ n(
|
|
1364
1364
|
"button",
|
|
1365
1365
|
{
|
|
1366
1366
|
type: "submit",
|
|
1367
1367
|
className: "ll-message-input__send",
|
|
1368
1368
|
"aria-label": "Send message",
|
|
1369
|
-
children: /* @__PURE__ */ n(
|
|
1369
|
+
children: /* @__PURE__ */ n(tr, {})
|
|
1370
1370
|
}
|
|
1371
1371
|
)
|
|
1372
1372
|
] }),
|
|
@@ -1389,23 +1389,23 @@ const Fn = ({
|
|
|
1389
1389
|
{
|
|
1390
1390
|
type: "button",
|
|
1391
1391
|
className: "ll-expanded__banner-x",
|
|
1392
|
-
onClick:
|
|
1392
|
+
onClick: je,
|
|
1393
1393
|
"aria-label": "Dismiss",
|
|
1394
1394
|
children: "×"
|
|
1395
1395
|
}
|
|
1396
1396
|
)
|
|
1397
1397
|
] });
|
|
1398
|
-
if (!
|
|
1399
|
-
let
|
|
1400
|
-
return
|
|
1401
|
-
/* @__PURE__ */ n("span", { children:
|
|
1398
|
+
if (!O || R !== "error") return null;
|
|
1399
|
+
let v = "Failed to connect", Y = "Try again";
|
|
1400
|
+
return O === "MIC_PERMISSION_DENIED" ? v = "Microphone blocked. Allow access to talk." : O === "MIC_NOT_FOUND" ? v = "No microphone found. Plug one in + retry." : O === "MIC_UNAVAILABLE" ? v = "Mic unavailable. Check other apps using it." : O === "AGENT_TIMEOUT" ? v = "Agent didn't pick up. Try again." : O === "CONNECT_FAILED" ? v = "Connection failed. Check your network." : O.length < 80 && (v = O), /* @__PURE__ */ _("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
|
|
1401
|
+
/* @__PURE__ */ n("span", { children: v }),
|
|
1402
1402
|
/* @__PURE__ */ n(
|
|
1403
1403
|
"button",
|
|
1404
1404
|
{
|
|
1405
1405
|
type: "button",
|
|
1406
1406
|
className: "ll-expanded__banner-retry",
|
|
1407
1407
|
onClick: ye,
|
|
1408
|
-
children:
|
|
1408
|
+
children: Y
|
|
1409
1409
|
}
|
|
1410
1410
|
)
|
|
1411
1411
|
] });
|
|
@@ -1414,32 +1414,32 @@ const Fn = ({
|
|
|
1414
1414
|
}
|
|
1415
1415
|
);
|
|
1416
1416
|
};
|
|
1417
|
-
function
|
|
1417
|
+
function Ke() {
|
|
1418
1418
|
return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ n("polyline", { points: "6 9 12 15 18 9" }) });
|
|
1419
1419
|
}
|
|
1420
|
-
function
|
|
1420
|
+
function Dt() {
|
|
1421
1421
|
return /* @__PURE__ */ _("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
|
|
1422
1422
|
/* @__PURE__ */ n("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1423
1423
|
/* @__PURE__ */ n("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1424
1424
|
] });
|
|
1425
1425
|
}
|
|
1426
|
-
function
|
|
1426
|
+
function $t() {
|
|
1427
1427
|
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" }) });
|
|
1428
1428
|
}
|
|
1429
|
-
function
|
|
1429
|
+
function Xn() {
|
|
1430
1430
|
return /* @__PURE__ */ _("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: [
|
|
1431
1431
|
/* @__PURE__ */ n("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
|
|
1432
1432
|
/* @__PURE__ */ n("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
|
|
1433
1433
|
/* @__PURE__ */ n("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
|
|
1434
1434
|
] });
|
|
1435
1435
|
}
|
|
1436
|
-
function
|
|
1436
|
+
function Qn() {
|
|
1437
1437
|
return /* @__PURE__ */ _("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: [
|
|
1438
1438
|
/* @__PURE__ */ n("path", { d: "M23 7l-7 5 7 5V7z" }),
|
|
1439
1439
|
/* @__PURE__ */ n("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
|
|
1440
1440
|
] });
|
|
1441
1441
|
}
|
|
1442
|
-
function
|
|
1442
|
+
function Zn({ muted: e }) {
|
|
1443
1443
|
return /* @__PURE__ */ _("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: [
|
|
1444
1444
|
/* @__PURE__ */ n("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
|
|
1445
1445
|
/* @__PURE__ */ n("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
|
|
@@ -1447,64 +1447,64 @@ function Jn({ muted: e }) {
|
|
|
1447
1447
|
e && /* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
1448
1448
|
] });
|
|
1449
1449
|
}
|
|
1450
|
-
function
|
|
1450
|
+
function er({ muted: e }) {
|
|
1451
1451
|
return /* @__PURE__ */ _("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: [
|
|
1452
1452
|
/* @__PURE__ */ n("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
1453
|
-
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ _(
|
|
1453
|
+
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ _(Ft, { children: [
|
|
1454
1454
|
/* @__PURE__ */ n("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
|
|
1455
1455
|
/* @__PURE__ */ n("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
|
|
1456
1456
|
] })
|
|
1457
1457
|
] });
|
|
1458
1458
|
}
|
|
1459
|
-
function
|
|
1459
|
+
function tr() {
|
|
1460
1460
|
return /* @__PURE__ */ _("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1461
1461
|
/* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
|
|
1462
1462
|
/* @__PURE__ */ n("polyline", { points: "12 5 19 12 12 19" })
|
|
1463
1463
|
] });
|
|
1464
1464
|
}
|
|
1465
|
-
const
|
|
1465
|
+
const zt = ({ label: e, devices: t, activeId: r, onPick: o }) => /* @__PURE__ */ _(
|
|
1466
1466
|
"div",
|
|
1467
1467
|
{
|
|
1468
1468
|
className: "ll-device-menu",
|
|
1469
|
-
onClick: (
|
|
1469
|
+
onClick: (i) => i.stopPropagation(),
|
|
1470
1470
|
role: "listbox",
|
|
1471
1471
|
children: [
|
|
1472
1472
|
/* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
|
|
1473
|
-
t.map((
|
|
1474
|
-
const
|
|
1473
|
+
t.map((i, l) => {
|
|
1474
|
+
const s = r === i.deviceId;
|
|
1475
1475
|
return /* @__PURE__ */ _(
|
|
1476
1476
|
"button",
|
|
1477
1477
|
{
|
|
1478
1478
|
type: "button",
|
|
1479
|
-
className: `ll-device-menu__item ${
|
|
1480
|
-
onClick: () => i
|
|
1479
|
+
className: `ll-device-menu__item ${s ? "is-active" : ""}`,
|
|
1480
|
+
onClick: () => o(i.deviceId),
|
|
1481
1481
|
role: "option",
|
|
1482
|
-
"aria-selected":
|
|
1482
|
+
"aria-selected": s,
|
|
1483
1483
|
children: [
|
|
1484
|
-
|
|
1485
|
-
/* @__PURE__ */ n("span", { className: "ll-device-menu__name", children:
|
|
1484
|
+
s && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
|
|
1485
|
+
/* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: i.label || `${e} ${l + 1}` })
|
|
1486
1486
|
]
|
|
1487
1487
|
},
|
|
1488
|
-
|
|
1488
|
+
i.deviceId || l
|
|
1489
1489
|
);
|
|
1490
1490
|
})
|
|
1491
1491
|
]
|
|
1492
1492
|
}
|
|
1493
|
-
),
|
|
1493
|
+
), nr = [
|
|
1494
1494
|
'[data-ll-private="true"]',
|
|
1495
1495
|
".ll-widget"
|
|
1496
1496
|
];
|
|
1497
|
-
function
|
|
1497
|
+
function ut(e) {
|
|
1498
1498
|
let t = e;
|
|
1499
1499
|
for (; t; ) {
|
|
1500
|
-
for (const r of
|
|
1500
|
+
for (const r of nr)
|
|
1501
1501
|
if (t.matches(r)) return !0;
|
|
1502
1502
|
t = t.parentElement;
|
|
1503
1503
|
}
|
|
1504
1504
|
return !1;
|
|
1505
1505
|
}
|
|
1506
|
-
function
|
|
1507
|
-
if (
|
|
1506
|
+
function et(e) {
|
|
1507
|
+
if (ut(e)) return !1;
|
|
1508
1508
|
if (e instanceof HTMLInputElement) {
|
|
1509
1509
|
if (e.type === "password") return !1;
|
|
1510
1510
|
const t = (e.getAttribute("autocomplete") || "").toLowerCase();
|
|
@@ -1512,7 +1512,7 @@ function Xe(e) {
|
|
|
1512
1512
|
}
|
|
1513
1513
|
return !0;
|
|
1514
1514
|
}
|
|
1515
|
-
const
|
|
1515
|
+
const Xe = 4096, rr = 20, or = 20, ir = 10, lr = 10, ar = 30, Ht = 500, cr = [
|
|
1516
1516
|
'[data-ll-private="true"]',
|
|
1517
1517
|
".ll-widget",
|
|
1518
1518
|
"script",
|
|
@@ -1520,24 +1520,24 @@ const Ge = 4096, Zn = 20, er = 20, tr = 10, nr = 10, rr = 30, $t = 500, ir = [
|
|
|
1520
1520
|
"noscript",
|
|
1521
1521
|
"iframe"
|
|
1522
1522
|
];
|
|
1523
|
-
function
|
|
1523
|
+
function $e(e) {
|
|
1524
1524
|
if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
|
|
1525
1525
|
let t = e;
|
|
1526
1526
|
for (; t; ) {
|
|
1527
|
-
for (const r of
|
|
1527
|
+
for (const r of cr)
|
|
1528
1528
|
if (t.matches(r)) return !0;
|
|
1529
1529
|
t = t.parentElement;
|
|
1530
1530
|
}
|
|
1531
1531
|
return !1;
|
|
1532
1532
|
}
|
|
1533
|
-
function
|
|
1533
|
+
function ze(e) {
|
|
1534
1534
|
if (typeof window > "u") return !0;
|
|
1535
1535
|
const t = e.getBoundingClientRect();
|
|
1536
1536
|
if (t.width <= 0 || t.height <= 0) return !1;
|
|
1537
|
-
const r = window.innerHeight || document.documentElement.clientHeight,
|
|
1538
|
-
return t.bottom > 0 && t.right > 0 && t.top < r && t.left <
|
|
1537
|
+
const r = window.innerHeight || document.documentElement.clientHeight, o = window.innerWidth || document.documentElement.clientWidth;
|
|
1538
|
+
return t.bottom > 0 && t.right > 0 && t.top < r && t.left < o;
|
|
1539
1539
|
}
|
|
1540
|
-
function
|
|
1540
|
+
function Ot(e) {
|
|
1541
1541
|
const t = e.getAttribute("id");
|
|
1542
1542
|
if (t) {
|
|
1543
1543
|
const l = document.querySelector(`label[for="${CSS.escape(t)}"]`);
|
|
@@ -1545,18 +1545,18 @@ function zt(e) {
|
|
|
1545
1545
|
}
|
|
1546
1546
|
const r = e.getAttribute("aria-label");
|
|
1547
1547
|
if (r) return r.trim();
|
|
1548
|
-
const
|
|
1549
|
-
if (
|
|
1550
|
-
const
|
|
1551
|
-
return
|
|
1548
|
+
const o = e.getAttribute("placeholder");
|
|
1549
|
+
if (o) return o.trim();
|
|
1550
|
+
const i = e.closest("label");
|
|
1551
|
+
return i != null && i.textContent ? i.textContent.trim() : "";
|
|
1552
1552
|
}
|
|
1553
|
-
function
|
|
1553
|
+
function he(e, t) {
|
|
1554
1554
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
1555
1555
|
}
|
|
1556
|
-
function
|
|
1556
|
+
function Ee(e) {
|
|
1557
1557
|
return e.length;
|
|
1558
1558
|
}
|
|
1559
|
-
function
|
|
1559
|
+
function sr(e, t = {}) {
|
|
1560
1560
|
const r = t.doc ?? (typeof document < "u" ? document : null);
|
|
1561
1561
|
if (!r)
|
|
1562
1562
|
return {
|
|
@@ -1570,15 +1570,15 @@ function or(e, t = {}) {
|
|
|
1570
1570
|
forms: [],
|
|
1571
1571
|
extras: e
|
|
1572
1572
|
};
|
|
1573
|
-
const
|
|
1573
|
+
const o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "", s = Array.from(
|
|
1574
1574
|
r.querySelectorAll("[data-ll-region]")
|
|
1575
1575
|
), d = [];
|
|
1576
|
-
for (const p of
|
|
1577
|
-
if (d.length >=
|
|
1578
|
-
if (
|
|
1579
|
-
const g = p.getAttribute("data-ll-region") ?? "", E = p.getAttribute("data-ll-intent") ?? void 0, x =
|
|
1576
|
+
for (const p of s) {
|
|
1577
|
+
if (d.length >= ir) break;
|
|
1578
|
+
if ($e(p) || !ze(p)) continue;
|
|
1579
|
+
const g = p.getAttribute("data-ll-region") ?? "", E = p.getAttribute("data-ll-intent") ?? void 0, x = he(
|
|
1580
1580
|
(p.innerText || p.textContent || "").trim(),
|
|
1581
|
-
|
|
1581
|
+
Ht * 2
|
|
1582
1582
|
);
|
|
1583
1583
|
!g || !x || d.push({ id: g, intent: E, text: x });
|
|
1584
1584
|
}
|
|
@@ -1586,23 +1586,23 @@ function or(e, t = {}) {
|
|
|
1586
1586
|
r.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
|
1587
1587
|
);
|
|
1588
1588
|
for (const p of m) {
|
|
1589
|
-
if (
|
|
1589
|
+
if ($e(p) || !ze(p)) continue;
|
|
1590
1590
|
const g = (p.textContent || "").trim();
|
|
1591
|
-
g && u.push(`${p.tagName}: ${
|
|
1591
|
+
g && u.push(`${p.tagName}: ${he(g, 200)}`);
|
|
1592
1592
|
}
|
|
1593
1593
|
const a = Array.from(r.querySelectorAll("p, li"));
|
|
1594
1594
|
for (const p of a) {
|
|
1595
|
-
if (
|
|
1595
|
+
if ($e(p) || !ze(p) || h.includes(p.tagName)) continue;
|
|
1596
1596
|
const g = (p.textContent || "").trim();
|
|
1597
|
-
g.length > 10 && u.push(
|
|
1597
|
+
g.length > 10 && u.push(he(g, Ht));
|
|
1598
1598
|
}
|
|
1599
|
-
const
|
|
1599
|
+
const c = u.join(`
|
|
1600
1600
|
`), A = [], C = Array.from(r.querySelectorAll("a[href]"));
|
|
1601
1601
|
for (const p of C) {
|
|
1602
|
-
if (A.length >=
|
|
1603
|
-
if (
|
|
1602
|
+
if (A.length >= rr) break;
|
|
1603
|
+
if ($e(p) || !ze(p)) continue;
|
|
1604
1604
|
const g = p.getAttribute("href") || "", E = (p.textContent || "").trim();
|
|
1605
|
-
!g || !E || A.push({ href: g, text:
|
|
1605
|
+
!g || !E || A.push({ href: g, text: he(E, 100) });
|
|
1606
1606
|
}
|
|
1607
1607
|
const R = [], b = Array.from(
|
|
1608
1608
|
r.querySelectorAll(
|
|
@@ -1610,76 +1610,86 @@ function or(e, t = {}) {
|
|
|
1610
1610
|
)
|
|
1611
1611
|
);
|
|
1612
1612
|
for (const p of b) {
|
|
1613
|
-
if (R.length >=
|
|
1614
|
-
if (
|
|
1615
|
-
const g =
|
|
1616
|
-
g && R.push({ label:
|
|
1613
|
+
if (R.length >= or) break;
|
|
1614
|
+
if ($e(p) || !et(p) || !ze(p)) continue;
|
|
1615
|
+
const g = Ot(p), E = p instanceof HTMLInputElement ? p.type : p.tagName.toLowerCase();
|
|
1616
|
+
g && R.push({ label: he(g, 100), type: E });
|
|
1617
1617
|
}
|
|
1618
1618
|
const L = Array.from(
|
|
1619
1619
|
r.querySelectorAll("[data-ll-form]")
|
|
1620
|
-
),
|
|
1620
|
+
), z = [];
|
|
1621
1621
|
for (const p of L) {
|
|
1622
|
-
if (
|
|
1623
|
-
if (
|
|
1622
|
+
if (z.length >= lr) break;
|
|
1623
|
+
if (ut(p)) continue;
|
|
1624
1624
|
const g = p.getAttribute("data-ll-form") || "";
|
|
1625
1625
|
if (!g) continue;
|
|
1626
1626
|
const E = p.getAttribute("data-ll-intent") || void 0, x = Array.from(
|
|
1627
1627
|
p.querySelectorAll(
|
|
1628
1628
|
"[data-ll-field]"
|
|
1629
1629
|
)
|
|
1630
|
-
),
|
|
1631
|
-
for (const
|
|
1632
|
-
if (
|
|
1633
|
-
if (!
|
|
1634
|
-
const de =
|
|
1630
|
+
), q = [];
|
|
1631
|
+
for (const Q of x) {
|
|
1632
|
+
if (q.length >= ar) break;
|
|
1633
|
+
if (!et(Q)) continue;
|
|
1634
|
+
const de = Q.getAttribute("data-ll-field") || "";
|
|
1635
1635
|
if (!de) continue;
|
|
1636
|
-
const
|
|
1637
|
-
|
|
1636
|
+
const Z = Ot(Q) || de, ee = Q instanceof HTMLInputElement ? Q.type : Q.tagName.toLowerCase();
|
|
1637
|
+
q.push({ name: de, label: he(Z, 100), type: ee });
|
|
1638
1638
|
}
|
|
1639
|
-
|
|
1639
|
+
z.push({ id: g, intent: E, fields: q });
|
|
1640
1640
|
}
|
|
1641
1641
|
const M = {
|
|
1642
|
-
url:
|
|
1642
|
+
url: o,
|
|
1643
1643
|
title: l,
|
|
1644
|
-
pathname:
|
|
1644
|
+
pathname: i,
|
|
1645
1645
|
regions: d,
|
|
1646
|
-
visibleText:
|
|
1646
|
+
visibleText: c,
|
|
1647
1647
|
visibleLinks: A,
|
|
1648
1648
|
visibleFields: R,
|
|
1649
|
-
forms:
|
|
1649
|
+
forms: z,
|
|
1650
1650
|
extras: e
|
|
1651
1651
|
};
|
|
1652
|
-
let
|
|
1653
|
-
for (;
|
|
1654
|
-
M.visibleFields.pop(),
|
|
1655
|
-
for (;
|
|
1656
|
-
M.visibleLinks.pop(),
|
|
1657
|
-
return
|
|
1658
|
-
}
|
|
1659
|
-
let
|
|
1660
|
-
function
|
|
1661
|
-
const r = Date.now(),
|
|
1662
|
-
if (
|
|
1663
|
-
return
|
|
1664
|
-
const l =
|
|
1665
|
-
return
|
|
1666
|
-
}
|
|
1667
|
-
function
|
|
1668
|
-
|
|
1669
|
-
}
|
|
1670
|
-
const
|
|
1671
|
-
function
|
|
1652
|
+
let O = Ee(JSON.stringify(M.regions)) + Ee(M.visibleText) + Ee(JSON.stringify(M.visibleLinks)) + Ee(JSON.stringify(M.visibleFields));
|
|
1653
|
+
for (; O > Xe && M.visibleFields.length > 0; )
|
|
1654
|
+
M.visibleFields.pop(), O = Ee(JSON.stringify(M.visibleFields));
|
|
1655
|
+
for (; O > Xe && M.visibleLinks.length > 0; )
|
|
1656
|
+
M.visibleLinks.pop(), O -= 80;
|
|
1657
|
+
return Ee(M.visibleText) > Xe && (M.visibleText = he(M.visibleText, Xe - 100)), M;
|
|
1658
|
+
}
|
|
1659
|
+
let Ne = null;
|
|
1660
|
+
function qt(e, t = {}) {
|
|
1661
|
+
const r = Date.now(), i = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
|
|
1662
|
+
if (Ne && Ne.key === i && r - Ne.at < 1e3)
|
|
1663
|
+
return Ne.ctx;
|
|
1664
|
+
const l = sr(e, t);
|
|
1665
|
+
return Ne = { key: i, at: r, ctx: l }, l;
|
|
1666
|
+
}
|
|
1667
|
+
function dr() {
|
|
1668
|
+
Ne = null;
|
|
1669
|
+
}
|
|
1670
|
+
const ur = 200;
|
|
1671
|
+
function fr(e) {
|
|
1672
|
+
const t = String(e.href || "");
|
|
1673
|
+
return {
|
|
1674
|
+
href: t,
|
|
1675
|
+
text: String(e.text ?? e.title ?? t),
|
|
1676
|
+
internal: e.internal ?? !0,
|
|
1677
|
+
title: e.title,
|
|
1678
|
+
description: e.description
|
|
1679
|
+
};
|
|
1680
|
+
}
|
|
1681
|
+
function pr(e) {
|
|
1672
1682
|
return !(!e || e.startsWith("#") || e.startsWith("javascript:") || e.startsWith("mailto:") || e.startsWith("tel:"));
|
|
1673
1683
|
}
|
|
1674
|
-
function
|
|
1684
|
+
function hr(e) {
|
|
1675
1685
|
const t = e ?? (typeof document < "u" ? document : null);
|
|
1676
1686
|
if (!t) return [];
|
|
1677
|
-
const r = typeof window < "u" && window.location.origin || "",
|
|
1678
|
-
for (const
|
|
1679
|
-
if (
|
|
1680
|
-
if (
|
|
1681
|
-
const d =
|
|
1682
|
-
if (!
|
|
1687
|
+
const r = typeof window < "u" && window.location.origin || "", o = /* @__PURE__ */ new Set(), i = [], l = Array.from(t.querySelectorAll("a[href]"));
|
|
1688
|
+
for (const s of l) {
|
|
1689
|
+
if (i.length >= ur) break;
|
|
1690
|
+
if (ut(s)) continue;
|
|
1691
|
+
const d = s.getAttribute("href") || "";
|
|
1692
|
+
if (!pr(d)) continue;
|
|
1683
1693
|
let u = d, h = !0;
|
|
1684
1694
|
try {
|
|
1685
1695
|
if (typeof window < "u") {
|
|
@@ -1689,42 +1699,87 @@ function cr(e) {
|
|
|
1689
1699
|
} catch {
|
|
1690
1700
|
continue;
|
|
1691
1701
|
}
|
|
1692
|
-
if (
|
|
1693
|
-
|
|
1694
|
-
const m = (
|
|
1695
|
-
|
|
1702
|
+
if (o.has(u)) continue;
|
|
1703
|
+
o.add(u);
|
|
1704
|
+
const m = (s.textContent || "").trim().slice(0, 120);
|
|
1705
|
+
i.push({ href: u, text: m, internal: h });
|
|
1696
1706
|
}
|
|
1697
|
-
return
|
|
1707
|
+
return i;
|
|
1698
1708
|
}
|
|
1699
|
-
let
|
|
1700
|
-
const
|
|
1701
|
-
function
|
|
1709
|
+
let Ae = null;
|
|
1710
|
+
const mr = 5e3;
|
|
1711
|
+
function ct() {
|
|
1702
1712
|
const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
|
|
1703
|
-
if (
|
|
1704
|
-
return
|
|
1705
|
-
const r =
|
|
1706
|
-
return
|
|
1713
|
+
if (Ae && Ae.pathname === t && e - Ae.at < mr)
|
|
1714
|
+
return Ae.routes;
|
|
1715
|
+
const r = hr();
|
|
1716
|
+
return Ae = { at: e, pathname: t, routes: r }, r;
|
|
1707
1717
|
}
|
|
1708
|
-
function
|
|
1709
|
-
|
|
1718
|
+
function gr() {
|
|
1719
|
+
Ae = null;
|
|
1710
1720
|
}
|
|
1711
|
-
function
|
|
1712
|
-
const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype,
|
|
1713
|
-
|
|
1721
|
+
function yr(e, t) {
|
|
1722
|
+
const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, o = Object.getOwnPropertyDescriptor(r, "value"), i = o == null ? void 0 : o.set;
|
|
1723
|
+
i ? i.call(e, t) : e.value = t;
|
|
1714
1724
|
}
|
|
1715
|
-
function
|
|
1716
|
-
const
|
|
1725
|
+
function vr(e, t, r = {}) {
|
|
1726
|
+
const o = r.triggerInput ?? !0, i = r.triggerChange ?? !0;
|
|
1717
1727
|
if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
|
|
1718
1728
|
const l = Object.getOwnPropertyDescriptor(
|
|
1719
1729
|
HTMLInputElement.prototype,
|
|
1720
1730
|
"checked"
|
|
1721
|
-
),
|
|
1722
|
-
|
|
1731
|
+
), s = l == null ? void 0 : l.set, d = t === "true" || t === "1" || t === "on";
|
|
1732
|
+
s ? s.call(e, d) : e.checked = d, o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
1723
1733
|
return;
|
|
1724
1734
|
}
|
|
1725
|
-
|
|
1735
|
+
yr(e, t), o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
1736
|
+
}
|
|
1737
|
+
function br() {
|
|
1738
|
+
if (typeof window > "u" || typeof document > "u")
|
|
1739
|
+
return !1;
|
|
1740
|
+
const e = document.scrollingElement || document.documentElement;
|
|
1741
|
+
if (!e || e.scrollHeight <= e.clientHeight + 2) return !1;
|
|
1742
|
+
const t = window.getComputedStyle(e);
|
|
1743
|
+
return !(t.overflowY === "hidden" || t.overflowY === "clip");
|
|
1744
|
+
}
|
|
1745
|
+
function wr(e) {
|
|
1746
|
+
if (!(e instanceof HTMLElement)) return !1;
|
|
1747
|
+
const r = window.getComputedStyle(e).overflowY;
|
|
1748
|
+
return !(r !== "auto" && r !== "scroll" || e.scrollHeight <= e.clientHeight + 2);
|
|
1749
|
+
}
|
|
1750
|
+
function _r() {
|
|
1751
|
+
if (typeof document > "u") return null;
|
|
1752
|
+
const e = Array.from(
|
|
1753
|
+
document.querySelectorAll("body, body *")
|
|
1754
|
+
);
|
|
1755
|
+
let t = null, r = 0;
|
|
1756
|
+
for (const o of e) {
|
|
1757
|
+
if (!wr(o)) continue;
|
|
1758
|
+
const i = o.getBoundingClientRect();
|
|
1759
|
+
if (i.bottom <= 0 || i.top >= window.innerHeight || i.right <= 0 || i.left >= window.innerWidth || i.width <= 0 || i.height <= 0 || o.closest(".ll-widget")) continue;
|
|
1760
|
+
const l = i.width * i.height;
|
|
1761
|
+
l > r && (r = l, t = o);
|
|
1762
|
+
}
|
|
1763
|
+
return t;
|
|
1764
|
+
}
|
|
1765
|
+
function xr() {
|
|
1766
|
+
if (typeof window > "u")
|
|
1767
|
+
return null;
|
|
1768
|
+
if (br()) return window;
|
|
1769
|
+
const e = _r();
|
|
1770
|
+
return e || window;
|
|
1726
1771
|
}
|
|
1727
|
-
|
|
1772
|
+
function Bt(e) {
|
|
1773
|
+
return e instanceof Window ? e.innerHeight || 0 : e.clientHeight || 0;
|
|
1774
|
+
}
|
|
1775
|
+
function kr(e) {
|
|
1776
|
+
var t, r;
|
|
1777
|
+
return e instanceof Window ? typeof document > "u" ? 0 : Math.max(
|
|
1778
|
+
((t = document.body) == null ? void 0 : t.scrollHeight) ?? 0,
|
|
1779
|
+
((r = document.documentElement) == null ? void 0 : r.scrollHeight) ?? 0
|
|
1780
|
+
) : e.scrollHeight - e.clientHeight;
|
|
1781
|
+
}
|
|
1782
|
+
const Lr = /* @__PURE__ */ new Set([
|
|
1728
1783
|
"agent_state",
|
|
1729
1784
|
"avatar_stream_ready",
|
|
1730
1785
|
"avatar_active",
|
|
@@ -1747,89 +1802,90 @@ const mr = /* @__PURE__ */ new Set([
|
|
|
1747
1802
|
"submit_form",
|
|
1748
1803
|
"request_routes"
|
|
1749
1804
|
]);
|
|
1750
|
-
function
|
|
1751
|
-
var
|
|
1805
|
+
function Sr(e) {
|
|
1806
|
+
var bt, wt, _t, xt, kt, Lt, St;
|
|
1752
1807
|
const {
|
|
1753
1808
|
agentId: t,
|
|
1754
1809
|
apiKey: r,
|
|
1755
|
-
baseUrl:
|
|
1756
|
-
sessionEndpoint:
|
|
1810
|
+
baseUrl: o = "https://app.livelayer.studio",
|
|
1811
|
+
sessionEndpoint: i,
|
|
1757
1812
|
sessionBody: l,
|
|
1758
|
-
autoConnect:
|
|
1813
|
+
autoConnect: s = !1,
|
|
1759
1814
|
displayMode: d,
|
|
1760
1815
|
defaultDisplayMode: u = "expanded",
|
|
1761
1816
|
onDisplayModeChange: h,
|
|
1762
1817
|
position: m = "bottom-right",
|
|
1763
1818
|
mobileBreakpoint: a = 640,
|
|
1764
|
-
persistKey:
|
|
1819
|
+
persistKey: c = "ll-widget",
|
|
1765
1820
|
disablePersistence: A = !1,
|
|
1766
1821
|
teamMembers: C,
|
|
1767
1822
|
currentTeamMemberId: R,
|
|
1768
1823
|
onTeamMemberChange: b,
|
|
1769
1824
|
idleLoopUrl: L,
|
|
1770
|
-
greeting:
|
|
1825
|
+
greeting: z,
|
|
1771
1826
|
avatarImageUrl: M,
|
|
1772
|
-
agentName:
|
|
1827
|
+
agentName: O,
|
|
1773
1828
|
branding: p = {},
|
|
1774
1829
|
allowCamera: g = !0,
|
|
1775
1830
|
allowScreenShare: E = !0,
|
|
1776
1831
|
allowTyping: x = !0,
|
|
1777
|
-
showOn:
|
|
1778
|
-
hideOn:
|
|
1832
|
+
showOn: q,
|
|
1833
|
+
hideOn: Q,
|
|
1779
1834
|
pathname: de,
|
|
1780
|
-
onNavigate:
|
|
1781
|
-
onScrollToSelector:
|
|
1835
|
+
onNavigate: Z,
|
|
1836
|
+
onScrollToSelector: ee,
|
|
1782
1837
|
getPageContext: ue,
|
|
1783
|
-
pageContextExtras:
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1838
|
+
pageContextExtras: He,
|
|
1839
|
+
getRoutes: Oe,
|
|
1840
|
+
onScrollPage: qe,
|
|
1841
|
+
onClick: Be,
|
|
1842
|
+
capabilities: me,
|
|
1843
|
+
onConnect: ge,
|
|
1844
|
+
onDisconnect: ye,
|
|
1845
|
+
onTranscript: ve,
|
|
1846
|
+
onAgentState: be,
|
|
1847
|
+
onConnectionStateChange: we,
|
|
1848
|
+
onAgentEvent: _e,
|
|
1849
|
+
onAgentCommand: xe,
|
|
1850
|
+
controlledSession: F,
|
|
1851
|
+
className: We,
|
|
1852
|
+
style: Fe,
|
|
1853
|
+
zIndex: Ue = 2147483647
|
|
1854
|
+
} = e, je = Mn(de), le = On(je, q, Q);
|
|
1799
1855
|
P(() => {
|
|
1800
|
-
|
|
1801
|
-
}, [
|
|
1802
|
-
const
|
|
1803
|
-
var
|
|
1804
|
-
return R ?? ((
|
|
1805
|
-
}),
|
|
1806
|
-
() => (C == null ? void 0 : C.find((
|
|
1807
|
-
[C,
|
|
1808
|
-
),
|
|
1856
|
+
dr(), gr();
|
|
1857
|
+
}, [je]);
|
|
1858
|
+
const oe = R !== void 0, [ke, Le] = N(() => {
|
|
1859
|
+
var y;
|
|
1860
|
+
return R ?? ((y = C == null ? void 0 : C[0]) == null ? void 0 : y.id);
|
|
1861
|
+
}), fe = oe ? R : ke, V = Qe(
|
|
1862
|
+
() => (C == null ? void 0 : C.find((y) => y.id === fe)) ?? null,
|
|
1863
|
+
[C, fe]
|
|
1864
|
+
), Re = (V == null ? void 0 : V.agentId) ?? t, [te, X] = Nn({
|
|
1809
1865
|
value: d,
|
|
1810
1866
|
defaultValue: u,
|
|
1811
1867
|
onChange: h,
|
|
1812
|
-
persistKey:
|
|
1868
|
+
persistKey: c,
|
|
1813
1869
|
disablePersistence: A
|
|
1814
|
-
}),
|
|
1815
|
-
|
|
1816
|
-
function
|
|
1817
|
-
const f =
|
|
1818
|
-
return f ? f.includes(
|
|
1870
|
+
}), ie = Rn(a), ae = gn(), J = yn(), ne = bn(), pe = wn(), Ie = _n(), [Ve, Me] = N(!1), [Se, v] = N(!1), [Y, Ye] = N(!1), [Vt, Yt] = N(!1), [tt, Gt] = N(!1), nt = I(Z), rt = I(ee), ot = I(qe), it = I(Be), ft = I(ue), pt = I(He), ht = I(Oe), lt = I(me), re = I(null);
|
|
1871
|
+
nt.current = Z, rt.current = ee, ot.current = qe, it.current = Be, ft.current = ue, pt.current = He, ht.current = Oe, lt.current = me;
|
|
1872
|
+
function ce(y) {
|
|
1873
|
+
const f = lt.current;
|
|
1874
|
+
return f ? f.includes(y) : !0;
|
|
1819
1875
|
}
|
|
1820
|
-
function
|
|
1876
|
+
function se(y, f) {
|
|
1821
1877
|
console.warn(
|
|
1822
|
-
`[LiveLayer] Agent command "${
|
|
1878
|
+
`[LiveLayer] Agent command "${y}" blocked — capability "${f}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
|
|
1823
1879
|
);
|
|
1824
1880
|
}
|
|
1825
|
-
const
|
|
1826
|
-
(
|
|
1827
|
-
var
|
|
1828
|
-
const f =
|
|
1881
|
+
const Te = S(
|
|
1882
|
+
(y) => {
|
|
1883
|
+
var K, Ge, Je, Ct;
|
|
1884
|
+
const f = y;
|
|
1829
1885
|
if (!(!f.type || typeof f.type != "string")) {
|
|
1830
|
-
if (
|
|
1831
|
-
if (!
|
|
1832
|
-
|
|
1886
|
+
if (_e == null || _e({ eventName: f.type, data: y }), f.type === "navigate") {
|
|
1887
|
+
if (!ce("navigate")) {
|
|
1888
|
+
se("navigate", "navigate");
|
|
1833
1889
|
return;
|
|
1834
1890
|
}
|
|
1835
1891
|
const k = typeof f.href == "string" ? f.href : null;
|
|
@@ -1839,9 +1895,9 @@ function gr(e) {
|
|
|
1839
1895
|
);
|
|
1840
1896
|
return;
|
|
1841
1897
|
}
|
|
1842
|
-
if (
|
|
1898
|
+
if (nt.current) {
|
|
1843
1899
|
try {
|
|
1844
|
-
|
|
1900
|
+
nt.current(k);
|
|
1845
1901
|
} catch (T) {
|
|
1846
1902
|
console.warn(
|
|
1847
1903
|
`[LiveLayer] onNavigate threw for "${k}". Falling back. Error:`,
|
|
@@ -1871,41 +1927,41 @@ function gr(e) {
|
|
|
1871
1927
|
return;
|
|
1872
1928
|
}
|
|
1873
1929
|
if (f.type === "scroll_to") {
|
|
1874
|
-
if (!
|
|
1875
|
-
|
|
1930
|
+
if (!ce("scroll")) {
|
|
1931
|
+
se("scroll_to", "scroll");
|
|
1876
1932
|
return;
|
|
1877
1933
|
}
|
|
1878
1934
|
const k = typeof f.selector == "string" ? f.selector : null;
|
|
1879
1935
|
if (!k) return;
|
|
1880
1936
|
const T = f.behavior === "instant" ? "instant" : "smooth";
|
|
1881
|
-
if (
|
|
1937
|
+
if (rt.current) {
|
|
1882
1938
|
try {
|
|
1883
|
-
|
|
1939
|
+
rt.current(
|
|
1884
1940
|
k,
|
|
1885
1941
|
T
|
|
1886
1942
|
);
|
|
1887
|
-
} catch (
|
|
1888
|
-
console.warn("[LiveLayer] onScrollToSelector threw.",
|
|
1943
|
+
} catch (H) {
|
|
1944
|
+
console.warn("[LiveLayer] onScrollToSelector threw.", H);
|
|
1889
1945
|
}
|
|
1890
1946
|
return;
|
|
1891
1947
|
}
|
|
1892
1948
|
if (typeof document < "u") {
|
|
1893
|
-
let
|
|
1949
|
+
let H = null;
|
|
1894
1950
|
try {
|
|
1895
|
-
|
|
1951
|
+
H = document.querySelector(k);
|
|
1896
1952
|
} catch {
|
|
1897
1953
|
console.warn(
|
|
1898
1954
|
`[LiveLayer] scroll_to: invalid selector "${k}".`
|
|
1899
1955
|
);
|
|
1900
1956
|
return;
|
|
1901
1957
|
}
|
|
1902
|
-
if (
|
|
1958
|
+
if (!H) {
|
|
1903
1959
|
console.warn(
|
|
1904
1960
|
`[LiveLayer] scroll_to: no element matched "${k}". The user may be on a different page. See https://livelayer.studio/docs/errors/scroll-no-match`
|
|
1905
1961
|
);
|
|
1906
1962
|
return;
|
|
1907
1963
|
}
|
|
1908
|
-
|
|
1964
|
+
H.scrollIntoView({
|
|
1909
1965
|
behavior: T,
|
|
1910
1966
|
block: "start"
|
|
1911
1967
|
});
|
|
@@ -1913,56 +1969,56 @@ function gr(e) {
|
|
|
1913
1969
|
return;
|
|
1914
1970
|
}
|
|
1915
1971
|
if (f.type === "request_page_context") {
|
|
1916
|
-
if (!
|
|
1917
|
-
|
|
1972
|
+
if (!ce("read_page")) {
|
|
1973
|
+
se("request_page_context", "read_page");
|
|
1918
1974
|
return;
|
|
1919
1975
|
}
|
|
1920
|
-
const k = typeof f.requestId == "string" ? f.requestId : void 0, T = (
|
|
1921
|
-
const
|
|
1922
|
-
if (
|
|
1976
|
+
const k = typeof f.requestId == "string" ? f.requestId : void 0, T = (K = re.current) == null ? void 0 : K.call(re), H = (W) => {
|
|
1977
|
+
const D = T, j = D == null ? void 0 : D.localParticipant;
|
|
1978
|
+
if (j != null && j.publishData)
|
|
1923
1979
|
try {
|
|
1924
|
-
const
|
|
1925
|
-
|
|
1926
|
-
} catch (
|
|
1927
|
-
console.warn("[LiveLayer] publishData failed.",
|
|
1980
|
+
const G = k ? { ...W, requestId: k } : W, Ce = new TextEncoder().encode(JSON.stringify(G));
|
|
1981
|
+
j.publishData(Ce, { reliable: !0 });
|
|
1982
|
+
} catch (G) {
|
|
1983
|
+
console.warn("[LiveLayer] publishData failed.", G);
|
|
1928
1984
|
}
|
|
1929
|
-
},
|
|
1985
|
+
}, $ = pt.current, B = ft.current;
|
|
1930
1986
|
try {
|
|
1931
1987
|
if (B) {
|
|
1932
|
-
const
|
|
1933
|
-
if (
|
|
1934
|
-
|
|
1988
|
+
const W = B($);
|
|
1989
|
+
if (W instanceof Promise) {
|
|
1990
|
+
H({ type: "page_context_pending" }), W.then((D) => H({ type: "page_context", context: D })).catch((D) => {
|
|
1935
1991
|
console.warn(
|
|
1936
1992
|
"[LiveLayer] getPageContext rejected; falling back to default walker.",
|
|
1937
|
-
|
|
1938
|
-
),
|
|
1993
|
+
D
|
|
1994
|
+
), H({
|
|
1939
1995
|
type: "page_context",
|
|
1940
|
-
context:
|
|
1996
|
+
context: qt($)
|
|
1941
1997
|
});
|
|
1942
1998
|
});
|
|
1943
1999
|
return;
|
|
1944
2000
|
}
|
|
1945
|
-
|
|
2001
|
+
H({ type: "page_context", context: W });
|
|
1946
2002
|
return;
|
|
1947
2003
|
}
|
|
1948
|
-
|
|
2004
|
+
H({
|
|
1949
2005
|
type: "page_context",
|
|
1950
|
-
context:
|
|
2006
|
+
context: qt($)
|
|
1951
2007
|
});
|
|
1952
|
-
} catch (
|
|
2008
|
+
} catch (W) {
|
|
1953
2009
|
console.warn(
|
|
1954
2010
|
"[LiveLayer] page-context extraction threw. Sending empty context.",
|
|
1955
|
-
|
|
1956
|
-
),
|
|
2011
|
+
W
|
|
2012
|
+
), H({
|
|
1957
2013
|
type: "page_context",
|
|
1958
|
-
context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras:
|
|
2014
|
+
context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: $ }
|
|
1959
2015
|
});
|
|
1960
2016
|
}
|
|
1961
2017
|
return;
|
|
1962
2018
|
}
|
|
1963
2019
|
if (f.type === "scroll_page") {
|
|
1964
|
-
if (!
|
|
1965
|
-
|
|
2020
|
+
if (!ce("scroll")) {
|
|
2021
|
+
se("scroll_page", "scroll");
|
|
1966
2022
|
return;
|
|
1967
2023
|
}
|
|
1968
2024
|
const k = f.direction;
|
|
@@ -1973,25 +2029,29 @@ function gr(e) {
|
|
|
1973
2029
|
return;
|
|
1974
2030
|
}
|
|
1975
2031
|
const T = f.behavior === "instant" ? "instant" : "smooth";
|
|
1976
|
-
if (
|
|
2032
|
+
if (ot.current) {
|
|
1977
2033
|
try {
|
|
1978
|
-
|
|
2034
|
+
ot.current(
|
|
1979
2035
|
k,
|
|
1980
2036
|
T
|
|
1981
2037
|
);
|
|
1982
|
-
} catch (
|
|
1983
|
-
console.warn("[LiveLayer] onScrollPage threw.",
|
|
2038
|
+
} catch (D) {
|
|
2039
|
+
console.warn("[LiveLayer] onScrollPage threw.", D);
|
|
1984
2040
|
}
|
|
1985
2041
|
return;
|
|
1986
2042
|
}
|
|
1987
2043
|
if (typeof window > "u") return;
|
|
1988
|
-
const
|
|
1989
|
-
|
|
2044
|
+
const H = { behavior: T }, $ = xr(), B = (D) => {
|
|
2045
|
+
$ instanceof Window ? $.scrollBy({ top: D, ...H }) : $.scrollBy({ top: D, ...H });
|
|
2046
|
+
}, W = (D) => {
|
|
2047
|
+
$ instanceof Window ? $.scrollTo({ top: D, ...H }) : $.scrollTo({ top: D, ...H });
|
|
2048
|
+
};
|
|
2049
|
+
k === "up" ? B(-Bt($)) : k === "down" ? B(Bt($)) : W(k === "top" ? 0 : kr($));
|
|
1990
2050
|
return;
|
|
1991
2051
|
}
|
|
1992
2052
|
if (f.type === "click") {
|
|
1993
|
-
if (!
|
|
1994
|
-
|
|
2053
|
+
if (!ce("click")) {
|
|
2054
|
+
se("click", "click");
|
|
1995
2055
|
return;
|
|
1996
2056
|
}
|
|
1997
2057
|
const k = typeof f.selector == "string" ? f.selector : null;
|
|
@@ -2002,8 +2062,8 @@ function gr(e) {
|
|
|
2002
2062
|
if (it.current) {
|
|
2003
2063
|
try {
|
|
2004
2064
|
it.current(k);
|
|
2005
|
-
} catch (
|
|
2006
|
-
console.warn("[LiveLayer] onClick threw.",
|
|
2065
|
+
} catch (H) {
|
|
2066
|
+
console.warn("[LiveLayer] onClick threw.", H);
|
|
2007
2067
|
}
|
|
2008
2068
|
return;
|
|
2009
2069
|
}
|
|
@@ -2029,12 +2089,12 @@ function gr(e) {
|
|
|
2029
2089
|
);
|
|
2030
2090
|
return;
|
|
2031
2091
|
}
|
|
2032
|
-
(
|
|
2092
|
+
(Ge = T.click) == null || Ge.call(T);
|
|
2033
2093
|
return;
|
|
2034
2094
|
}
|
|
2035
2095
|
if (f.type === "fill_form" || f.type === "focus_field") {
|
|
2036
|
-
if (!
|
|
2037
|
-
|
|
2096
|
+
if (!ce("fill_forms")) {
|
|
2097
|
+
se(f.type, "fill_forms");
|
|
2038
2098
|
return;
|
|
2039
2099
|
}
|
|
2040
2100
|
if (typeof document > "u") return;
|
|
@@ -2059,61 +2119,61 @@ function gr(e) {
|
|
|
2059
2119
|
return;
|
|
2060
2120
|
}
|
|
2061
2121
|
if (f.type === "focus_field") {
|
|
2062
|
-
const
|
|
2063
|
-
if (
|
|
2122
|
+
const $ = typeof f.fieldName == "string" ? f.fieldName : null;
|
|
2123
|
+
if (!$) {
|
|
2064
2124
|
console.warn("[LiveLayer] focus_field: missing fieldName.");
|
|
2065
2125
|
return;
|
|
2066
2126
|
}
|
|
2067
|
-
const B = T.querySelector(`[data-ll-field="${
|
|
2127
|
+
const B = T.querySelector(`[data-ll-field="${$.replace(/"/g, '\\"')}"]`);
|
|
2068
2128
|
if (!B) {
|
|
2069
2129
|
console.warn(
|
|
2070
|
-
`[LiveLayer] focus_field: no field "${
|
|
2130
|
+
`[LiveLayer] focus_field: no field "${$}" in form "${k}".`
|
|
2071
2131
|
);
|
|
2072
2132
|
return;
|
|
2073
2133
|
}
|
|
2074
|
-
if (!
|
|
2134
|
+
if (!et(B)) {
|
|
2075
2135
|
console.warn(
|
|
2076
|
-
`[LiveLayer] focus_field: field "${
|
|
2136
|
+
`[LiveLayer] focus_field: field "${$}" is privacy-protected and not focusable.`
|
|
2077
2137
|
);
|
|
2078
2138
|
return;
|
|
2079
2139
|
}
|
|
2080
2140
|
B.focus();
|
|
2081
2141
|
return;
|
|
2082
2142
|
}
|
|
2083
|
-
const
|
|
2084
|
-
if (
|
|
2143
|
+
const H = f.values && typeof f.values == "object" ? f.values : null;
|
|
2144
|
+
if (!H) {
|
|
2085
2145
|
console.warn("[LiveLayer] fill_form: missing or invalid values.");
|
|
2086
2146
|
return;
|
|
2087
2147
|
}
|
|
2088
|
-
for (const [
|
|
2148
|
+
for (const [$, B] of Object.entries(H)) {
|
|
2089
2149
|
if (typeof B != "string") continue;
|
|
2090
|
-
const
|
|
2091
|
-
if (!
|
|
2150
|
+
const W = T.querySelector(`[data-ll-field="${$.replace(/"/g, '\\"')}"]`);
|
|
2151
|
+
if (!W) {
|
|
2092
2152
|
console.warn(
|
|
2093
|
-
`[LiveLayer] fill_form: no field "${
|
|
2153
|
+
`[LiveLayer] fill_form: no field "${$}" in form "${k}". Skipping.`
|
|
2094
2154
|
);
|
|
2095
2155
|
continue;
|
|
2096
2156
|
}
|
|
2097
|
-
if (!
|
|
2157
|
+
if (!et(W)) {
|
|
2098
2158
|
console.warn(
|
|
2099
|
-
`[LiveLayer] fill_form: field "${
|
|
2159
|
+
`[LiveLayer] fill_form: field "${$}" is privacy-protected (password / cc-* / private). Skipping.`
|
|
2100
2160
|
);
|
|
2101
2161
|
continue;
|
|
2102
2162
|
}
|
|
2103
2163
|
try {
|
|
2104
|
-
|
|
2105
|
-
} catch (
|
|
2164
|
+
vr(W, B);
|
|
2165
|
+
} catch (D) {
|
|
2106
2166
|
console.warn(
|
|
2107
|
-
`[LiveLayer] fill_form: failed to set "${
|
|
2108
|
-
|
|
2167
|
+
`[LiveLayer] fill_form: failed to set "${$}".`,
|
|
2168
|
+
D
|
|
2109
2169
|
);
|
|
2110
2170
|
}
|
|
2111
2171
|
}
|
|
2112
2172
|
return;
|
|
2113
2173
|
}
|
|
2114
2174
|
if (f.type === "submit_form") {
|
|
2115
|
-
if (!
|
|
2116
|
-
|
|
2175
|
+
if (!ce("submit_forms")) {
|
|
2176
|
+
se("submit_form", "submit_forms");
|
|
2117
2177
|
return;
|
|
2118
2178
|
}
|
|
2119
2179
|
if (typeof document > "u") return;
|
|
@@ -2137,24 +2197,24 @@ function gr(e) {
|
|
|
2137
2197
|
);
|
|
2138
2198
|
return;
|
|
2139
2199
|
}
|
|
2140
|
-
const
|
|
2141
|
-
const
|
|
2142
|
-
if (
|
|
2200
|
+
const H = typeof f.requestId == "string" ? f.requestId : void 0, $ = (Je = re.current) == null ? void 0 : Je.call(re), B = (j) => {
|
|
2201
|
+
const G = $, Ce = G == null ? void 0 : G.localParticipant;
|
|
2202
|
+
if (Ce != null && Ce.publishData)
|
|
2143
2203
|
try {
|
|
2144
|
-
const
|
|
2145
|
-
|
|
2204
|
+
const an = H ? { ...j, requestId: H } : j, cn = new TextEncoder().encode(JSON.stringify(an));
|
|
2205
|
+
Ce.publishData(cn, { reliable: !0 });
|
|
2146
2206
|
} catch {
|
|
2147
2207
|
}
|
|
2148
2208
|
};
|
|
2149
|
-
let
|
|
2150
|
-
const
|
|
2151
|
-
|
|
2209
|
+
let W = !1;
|
|
2210
|
+
const D = () => {
|
|
2211
|
+
W = !0, B({ type: "form_submitted", formId: k });
|
|
2152
2212
|
};
|
|
2153
|
-
T.addEventListener("submit",
|
|
2213
|
+
T.addEventListener("submit", D, { once: !0 });
|
|
2154
2214
|
try {
|
|
2155
2215
|
typeof T.requestSubmit == "function" ? T.requestSubmit() : T.submit();
|
|
2156
|
-
} catch (
|
|
2157
|
-
console.warn("[LiveLayer] submit_form: requestSubmit threw.",
|
|
2216
|
+
} catch (j) {
|
|
2217
|
+
console.warn("[LiveLayer] submit_form: requestSubmit threw.", j), T.removeEventListener("submit", D), B({
|
|
2158
2218
|
type: "form_submit_blocked",
|
|
2159
2219
|
formId: k,
|
|
2160
2220
|
reason: "exception"
|
|
@@ -2162,7 +2222,7 @@ function gr(e) {
|
|
|
2162
2222
|
return;
|
|
2163
2223
|
}
|
|
2164
2224
|
setTimeout(() => {
|
|
2165
|
-
|
|
2225
|
+
W || (T.removeEventListener("submit", D), B({
|
|
2166
2226
|
type: "form_submit_blocked",
|
|
2167
2227
|
formId: k,
|
|
2168
2228
|
reason: "validation"
|
|
@@ -2171,66 +2231,96 @@ function gr(e) {
|
|
|
2171
2231
|
return;
|
|
2172
2232
|
}
|
|
2173
2233
|
if (f.type === "request_routes") {
|
|
2174
|
-
if (!
|
|
2175
|
-
|
|
2234
|
+
if (!ce("read_page")) {
|
|
2235
|
+
se("request_routes", "read_page");
|
|
2236
|
+
return;
|
|
2237
|
+
}
|
|
2238
|
+
const k = typeof f.requestId == "string" ? f.requestId : void 0, H = (Ct = re.current) == null ? void 0 : Ct.call(re), $ = H == null ? void 0 : H.localParticipant;
|
|
2239
|
+
if (!($ != null && $.publishData)) return;
|
|
2240
|
+
const B = (D) => {
|
|
2241
|
+
try {
|
|
2242
|
+
const j = k ? { type: "routes", routes: D, requestId: k } : { type: "routes", routes: D }, G = new TextEncoder().encode(JSON.stringify(j));
|
|
2243
|
+
$.publishData(G, { reliable: !0 });
|
|
2244
|
+
} catch (j) {
|
|
2245
|
+
console.warn("[LiveLayer] request_routes: publishData failed.", j);
|
|
2246
|
+
}
|
|
2247
|
+
}, W = ht.current;
|
|
2248
|
+
if (W) {
|
|
2249
|
+
try {
|
|
2250
|
+
const D = W(), j = (G) => {
|
|
2251
|
+
if (!Array.isArray(G)) {
|
|
2252
|
+
B([]);
|
|
2253
|
+
return;
|
|
2254
|
+
}
|
|
2255
|
+
B(G.map(fr).slice(0, 200));
|
|
2256
|
+
};
|
|
2257
|
+
D instanceof Promise ? D.then(j).catch((G) => {
|
|
2258
|
+
console.warn(
|
|
2259
|
+
"[LiveLayer] getRoutes rejected; falling back to DOM walker.",
|
|
2260
|
+
G
|
|
2261
|
+
), B(ct());
|
|
2262
|
+
}) : j(D);
|
|
2263
|
+
} catch (D) {
|
|
2264
|
+
console.warn(
|
|
2265
|
+
"[LiveLayer] getRoutes threw; falling back to DOM walker.",
|
|
2266
|
+
D
|
|
2267
|
+
), B(ct());
|
|
2268
|
+
}
|
|
2176
2269
|
return;
|
|
2177
2270
|
}
|
|
2178
|
-
const k = typeof f.requestId == "string" ? f.requestId : void 0, $ = (Lt = te.current) == null ? void 0 : Lt.call(te), O = $ == null ? void 0 : $.localParticipant;
|
|
2179
|
-
if (!(O != null && O.publishData)) return;
|
|
2180
2271
|
try {
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
console.warn("[LiveLayer] request_routes: extractRoutes threw.", B);
|
|
2272
|
+
B(ct());
|
|
2273
|
+
} catch (D) {
|
|
2274
|
+
console.warn("[LiveLayer] request_routes: extractRoutes threw.", D);
|
|
2185
2275
|
}
|
|
2186
2276
|
return;
|
|
2187
2277
|
}
|
|
2188
|
-
|
|
2278
|
+
Lr.has(f.type) || xe == null || xe(f);
|
|
2189
2279
|
}
|
|
2190
2280
|
},
|
|
2191
|
-
[
|
|
2192
|
-
), U =
|
|
2193
|
-
agentId:
|
|
2194
|
-
baseUrl:
|
|
2281
|
+
[xe, _e]
|
|
2282
|
+
), U = mn({
|
|
2283
|
+
agentId: F ? "__controlled__" : Re,
|
|
2284
|
+
baseUrl: o,
|
|
2195
2285
|
apiKey: r,
|
|
2196
|
-
sessionEndpoint:
|
|
2286
|
+
sessionEndpoint: i,
|
|
2197
2287
|
sessionBody: l,
|
|
2198
|
-
onDataMessage:
|
|
2288
|
+
onDataMessage: F ? void 0 : Te
|
|
2199
2289
|
});
|
|
2200
2290
|
P(() => {
|
|
2201
|
-
if (
|
|
2202
|
-
return
|
|
2203
|
-
}, [
|
|
2204
|
-
var
|
|
2205
|
-
return (
|
|
2291
|
+
if (F != null && F.subscribeToDataMessages)
|
|
2292
|
+
return F.subscribeToDataMessages(Te);
|
|
2293
|
+
}, [F, Te]), re.current = () => {
|
|
2294
|
+
var y;
|
|
2295
|
+
return (y = U.getRoom) == null ? void 0 : y.call(U);
|
|
2206
2296
|
}, P(() => {
|
|
2207
|
-
var
|
|
2297
|
+
var K;
|
|
2208
2298
|
if (typeof window > "u") return;
|
|
2209
|
-
const
|
|
2210
|
-
if (
|
|
2211
|
-
return window.__livelayerSimulateCommand = (
|
|
2299
|
+
const y = ((K = window.location) == null ? void 0 : K.hostname) || "";
|
|
2300
|
+
if (y === "localhost" || y === "127.0.0.1" || y === "0.0.0.0" || y.endsWith(".local") || y.endsWith(".test"))
|
|
2301
|
+
return window.__livelayerSimulateCommand = (Ge) => {
|
|
2212
2302
|
try {
|
|
2213
|
-
|
|
2214
|
-
} catch (
|
|
2215
|
-
console.warn("[LiveLayer] simulate-command threw:",
|
|
2303
|
+
Te(Ge);
|
|
2304
|
+
} catch (Je) {
|
|
2305
|
+
console.warn("[LiveLayer] simulate-command threw:", Je);
|
|
2216
2306
|
}
|
|
2217
2307
|
}, () => {
|
|
2218
2308
|
delete window.__livelayerSimulateCommand;
|
|
2219
2309
|
};
|
|
2220
|
-
}, [
|
|
2221
|
-
const w =
|
|
2222
|
-
connectionState:
|
|
2223
|
-
agentState:
|
|
2224
|
-
transcript:
|
|
2225
|
-
videoElement:
|
|
2226
|
-
audioElement:
|
|
2227
|
-
canResume:
|
|
2228
|
-
error:
|
|
2310
|
+
}, [Te]);
|
|
2311
|
+
const w = Qe(() => F ? {
|
|
2312
|
+
connectionState: F.connectionState,
|
|
2313
|
+
agentState: F.agentState,
|
|
2314
|
+
transcript: F.transcript,
|
|
2315
|
+
videoElement: F.videoElement,
|
|
2316
|
+
audioElement: F.audioElement,
|
|
2317
|
+
canResume: F.canResume,
|
|
2318
|
+
error: F.error,
|
|
2229
2319
|
agentConfig: null,
|
|
2230
2320
|
connect: async () => {
|
|
2231
|
-
await
|
|
2321
|
+
await F.onConnect();
|
|
2232
2322
|
},
|
|
2233
|
-
disconnect: () =>
|
|
2323
|
+
disconnect: () => F.onDisconnect(),
|
|
2234
2324
|
// Dummy getRoom for shape compatibility — controlled consumers own the Room.
|
|
2235
2325
|
// Internal session's getRoom returns null when no real connect has happened,
|
|
2236
2326
|
// so we reuse its reference for type consistency.
|
|
@@ -2249,322 +2339,322 @@ function gr(e) {
|
|
|
2249
2339
|
disconnect: U.disconnect,
|
|
2250
2340
|
getRoom: U.getRoom,
|
|
2251
2341
|
isControlled: !1
|
|
2252
|
-
}, [
|
|
2342
|
+
}, [F, U]), mt = I(null);
|
|
2253
2343
|
P(() => {
|
|
2254
|
-
const
|
|
2255
|
-
if (!(!
|
|
2256
|
-
return f.appendChild(
|
|
2257
|
-
|
|
2344
|
+
const y = w.videoElement, f = mt.current;
|
|
2345
|
+
if (!(!y || !f))
|
|
2346
|
+
return f.appendChild(y), () => {
|
|
2347
|
+
y.parentNode === f && f.removeChild(y);
|
|
2258
2348
|
};
|
|
2259
2349
|
}, [w.videoElement]), P(() => {
|
|
2260
|
-
const
|
|
2261
|
-
if (!
|
|
2262
|
-
|
|
2263
|
-
const f =
|
|
2264
|
-
return f && typeof f.catch == "function" && f.catch((
|
|
2265
|
-
(
|
|
2350
|
+
const y = w.audioElement;
|
|
2351
|
+
if (!y) return;
|
|
2352
|
+
ae.attach(y);
|
|
2353
|
+
const f = y.play();
|
|
2354
|
+
return f && typeof f.catch == "function" && f.catch((K) => {
|
|
2355
|
+
(K == null ? void 0 : K.name) === "NotAllowedError" && Me(!0);
|
|
2266
2356
|
}), () => {
|
|
2267
|
-
|
|
2357
|
+
ae.detach();
|
|
2268
2358
|
};
|
|
2269
2359
|
}, [w.audioElement]), P(() => {
|
|
2270
2360
|
if (w.isControlled || w.connectionState !== "connected") return;
|
|
2271
|
-
const
|
|
2272
|
-
if (
|
|
2273
|
-
return
|
|
2274
|
-
}),
|
|
2275
|
-
|
|
2361
|
+
const y = w.getRoom();
|
|
2362
|
+
if (y)
|
|
2363
|
+
return J.setupMic(y).catch(() => {
|
|
2364
|
+
}), ne.attachRoom(y), pe.attachRoom(y), Ie.refresh(), () => {
|
|
2365
|
+
J.teardownMic(), ne.teardown(), pe.teardown();
|
|
2276
2366
|
};
|
|
2277
2367
|
}, [w.isControlled, w.connectionState]), P(() => {
|
|
2278
|
-
const
|
|
2279
|
-
|
|
2280
|
-
}, [w.audioElement,
|
|
2281
|
-
const
|
|
2368
|
+
const y = w.audioElement;
|
|
2369
|
+
y && (y.muted = tt);
|
|
2370
|
+
}, [w.audioElement, tt]);
|
|
2371
|
+
const Jt = S((y) => {
|
|
2282
2372
|
const f = w.getRoom();
|
|
2283
2373
|
if (f)
|
|
2284
2374
|
try {
|
|
2285
|
-
const
|
|
2286
|
-
JSON.stringify({ type: "user_message", text:
|
|
2375
|
+
const K = new TextEncoder().encode(
|
|
2376
|
+
JSON.stringify({ type: "user_message", text: y })
|
|
2287
2377
|
);
|
|
2288
|
-
f.localParticipant.publishData(
|
|
2378
|
+
f.localParticipant.publishData(K, { reliable: !0 });
|
|
2289
2379
|
} catch {
|
|
2290
2380
|
}
|
|
2291
|
-
}, [w]),
|
|
2292
|
-
|
|
2381
|
+
}, [w]), Kt = S(() => {
|
|
2382
|
+
Gt((y) => !y);
|
|
2293
2383
|
}, []);
|
|
2294
2384
|
P(() => {
|
|
2295
|
-
|
|
2296
|
-
}, [w.connectionState,
|
|
2297
|
-
|
|
2298
|
-
}, [w.transcript,
|
|
2299
|
-
|
|
2300
|
-
}, [w.agentState,
|
|
2301
|
-
const
|
|
2385
|
+
we == null || we(w.connectionState), w.connectionState === "connected" ? ge == null || ge() : w.connectionState === "disconnected" && (ye == null || ye());
|
|
2386
|
+
}, [w.connectionState, ge, ye, we]), P(() => {
|
|
2387
|
+
ve == null || ve(w.transcript);
|
|
2388
|
+
}, [w.transcript, ve]), P(() => {
|
|
2389
|
+
be == null || be(w.agentState);
|
|
2390
|
+
}, [w.agentState, be]);
|
|
2391
|
+
const gt = I(!1);
|
|
2302
2392
|
P(() => {
|
|
2303
|
-
w.isControlled || !
|
|
2304
|
-
}, [
|
|
2305
|
-
const
|
|
2306
|
-
(
|
|
2307
|
-
const f = C == null ? void 0 : C.find((
|
|
2308
|
-
f && (
|
|
2393
|
+
w.isControlled || !s || gt.current || le && w.connectionState === "idle" && (gt.current = !0, w.connect());
|
|
2394
|
+
}, [s, w.connectionState, w, le]);
|
|
2395
|
+
const Xt = S(
|
|
2396
|
+
(y) => {
|
|
2397
|
+
const f = C == null ? void 0 : C.find((K) => K.id === y);
|
|
2398
|
+
f && (Ye(!1), y !== fe && (v(!0), w.disconnect(), oe || Le(y), b == null || b(f)));
|
|
2309
2399
|
},
|
|
2310
2400
|
[
|
|
2311
2401
|
C,
|
|
2312
|
-
|
|
2402
|
+
fe,
|
|
2313
2403
|
w,
|
|
2314
|
-
|
|
2404
|
+
oe,
|
|
2315
2405
|
b
|
|
2316
2406
|
]
|
|
2317
2407
|
);
|
|
2318
2408
|
P(() => {
|
|
2319
|
-
|
|
2320
|
-
}, [w.connectionState,
|
|
2321
|
-
if (!
|
|
2322
|
-
const
|
|
2323
|
-
f.key === "Escape" &&
|
|
2409
|
+
Se && w.connectionState === "connected" && v(!1);
|
|
2410
|
+
}, [w.connectionState, Se]), P(() => {
|
|
2411
|
+
if (!Y) return;
|
|
2412
|
+
const y = (f) => {
|
|
2413
|
+
f.key === "Escape" && Ye(!1);
|
|
2324
2414
|
};
|
|
2325
|
-
return window.addEventListener("keydown",
|
|
2326
|
-
}, [
|
|
2327
|
-
const
|
|
2328
|
-
|
|
2329
|
-
const
|
|
2330
|
-
() =>
|
|
2331
|
-
[
|
|
2332
|
-
),
|
|
2333
|
-
w.disconnect(),
|
|
2334
|
-
}, [w,
|
|
2335
|
-
const
|
|
2336
|
-
|
|
2415
|
+
return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
|
|
2416
|
+
}, [Y]);
|
|
2417
|
+
const Qt = !!M || !!(V != null && V.avatarImageUrl) || w.isControlled, Pe = xn(Re, o, Qt);
|
|
2418
|
+
me === void 0 && ((bt = Pe.info) != null && bt.capabilities) && (lt.current = Pe.info.capabilities);
|
|
2419
|
+
const at = (V == null ? void 0 : V.name) ?? O ?? ((wt = w.agentConfig) == null ? void 0 : wt.name) ?? ((_t = Pe.info) == null ? void 0 : _t.name) ?? "Live Layer", yt = (V == null ? void 0 : V.avatarImageUrl) ?? M ?? ((xt = w.agentConfig) == null ? void 0 : xt.avatarImageUrl) ?? ((kt = Pe.info) == null ? void 0 : kt.avatarImageUrl) ?? null, Zt = L ?? ((Lt = w.agentConfig) == null ? void 0 : Lt.idleLoopUrl) ?? ((St = Pe.info) == null ? void 0 : St.idleLoopUrl) ?? null, en = z ?? null, tn = S(() => X("expanded"), [X]), nn = S(
|
|
2420
|
+
() => X("minimized"),
|
|
2421
|
+
[X]
|
|
2422
|
+
), vt = S(() => {
|
|
2423
|
+
w.disconnect(), X("hidden");
|
|
2424
|
+
}, [w, X]), rn = S(() => {
|
|
2425
|
+
const y = w.audioElement;
|
|
2426
|
+
y && y.play().then(() => Me(!1)).catch(() => {
|
|
2337
2427
|
});
|
|
2338
|
-
}, [w.audioElement]),
|
|
2339
|
-
|
|
2340
|
-
}, [w]),
|
|
2341
|
-
...
|
|
2342
|
-
zIndex:
|
|
2428
|
+
}, [w.audioElement]), on = S(() => {
|
|
2429
|
+
Me(!1), w.connect();
|
|
2430
|
+
}, [w]), De = {
|
|
2431
|
+
...Fe,
|
|
2432
|
+
zIndex: Ue
|
|
2343
2433
|
};
|
|
2344
|
-
p.primaryColor && (
|
|
2345
|
-
const
|
|
2434
|
+
p.primaryColor && (De["--ll-color-primary"] = p.primaryColor), p.accentColor && (De["--ll-color-accent"] = p.accentColor), p.backgroundColor && (De["--ll-color-bg"] = p.backgroundColor), p.textColor && (De["--ll-color-fg"] = p.textColor);
|
|
2435
|
+
const ln = [
|
|
2346
2436
|
"ll-widget",
|
|
2347
|
-
`ll-widget--${
|
|
2348
|
-
`ll-widget--${
|
|
2349
|
-
|
|
2437
|
+
`ll-widget--${te}`,
|
|
2438
|
+
`ll-widget--${ie ? "mobile" : "desktop"}`,
|
|
2439
|
+
We
|
|
2350
2440
|
].filter(Boolean).join(" ");
|
|
2351
|
-
return
|
|
2441
|
+
return le ? /* @__PURE__ */ _(
|
|
2352
2442
|
"div",
|
|
2353
2443
|
{
|
|
2354
|
-
className:
|
|
2355
|
-
style:
|
|
2356
|
-
"data-display-mode":
|
|
2444
|
+
className: ln,
|
|
2445
|
+
style: De,
|
|
2446
|
+
"data-display-mode": te,
|
|
2357
2447
|
"data-position": m,
|
|
2358
2448
|
children: [
|
|
2359
|
-
|
|
2360
|
-
|
|
2449
|
+
te === "hidden" && /* @__PURE__ */ n(
|
|
2450
|
+
Vn,
|
|
2361
2451
|
{
|
|
2362
2452
|
position: m,
|
|
2363
|
-
isMobile:
|
|
2453
|
+
isMobile: ie,
|
|
2364
2454
|
isSpeaking: w.agentState === "speaking",
|
|
2365
|
-
onExpand: () =>
|
|
2366
|
-
label: `Open ${
|
|
2455
|
+
onExpand: () => X("expanded"),
|
|
2456
|
+
label: `Open ${at} widget`
|
|
2367
2457
|
}
|
|
2368
2458
|
),
|
|
2369
|
-
|
|
2370
|
-
|
|
2459
|
+
te === "minimized" && /* @__PURE__ */ n(
|
|
2460
|
+
Gn,
|
|
2371
2461
|
{
|
|
2372
2462
|
position: m,
|
|
2373
|
-
isMobile:
|
|
2374
|
-
agentName:
|
|
2375
|
-
avatarImageUrl:
|
|
2463
|
+
isMobile: ie,
|
|
2464
|
+
agentName: at,
|
|
2465
|
+
avatarImageUrl: yt,
|
|
2376
2466
|
agentState: w.agentState,
|
|
2377
|
-
isMuted:
|
|
2378
|
-
audioLevel:
|
|
2379
|
-
onExpand:
|
|
2380
|
-
onToggleMute:
|
|
2381
|
-
onClose:
|
|
2467
|
+
isMuted: J.isMuted,
|
|
2468
|
+
audioLevel: ae,
|
|
2469
|
+
onExpand: tn,
|
|
2470
|
+
onToggleMute: J.toggleMute,
|
|
2471
|
+
onClose: vt
|
|
2382
2472
|
}
|
|
2383
2473
|
),
|
|
2384
|
-
|
|
2385
|
-
|
|
2474
|
+
te === "expanded" && /* @__PURE__ */ n(
|
|
2475
|
+
Kn,
|
|
2386
2476
|
{
|
|
2387
2477
|
position: m,
|
|
2388
|
-
isMobile:
|
|
2389
|
-
agentName:
|
|
2390
|
-
avatarImageUrl:
|
|
2391
|
-
idleLoopUrl:
|
|
2392
|
-
greeting:
|
|
2478
|
+
isMobile: ie,
|
|
2479
|
+
agentName: at,
|
|
2480
|
+
avatarImageUrl: yt,
|
|
2481
|
+
idleLoopUrl: Zt,
|
|
2482
|
+
greeting: en,
|
|
2393
2483
|
branding: p,
|
|
2394
2484
|
teamMembers: C,
|
|
2395
|
-
currentTeamMemberId:
|
|
2396
|
-
isSwitchingTeamMember:
|
|
2397
|
-
teamSwitcherOpen:
|
|
2398
|
-
onToggleTeamSwitcher: () =>
|
|
2399
|
-
onSelectTeamMember:
|
|
2485
|
+
currentTeamMemberId: fe,
|
|
2486
|
+
isSwitchingTeamMember: Se,
|
|
2487
|
+
teamSwitcherOpen: Y,
|
|
2488
|
+
onToggleTeamSwitcher: () => Ye((y) => !y),
|
|
2489
|
+
onSelectTeamMember: Xt,
|
|
2400
2490
|
connectionState: w.connectionState,
|
|
2401
2491
|
agentState: w.agentState,
|
|
2402
2492
|
transcript: w.transcript,
|
|
2403
|
-
isMuted:
|
|
2404
|
-
micDevices:
|
|
2405
|
-
isCameraEnabled:
|
|
2406
|
-
cameraPreviewEl:
|
|
2407
|
-
cameraDevices:
|
|
2408
|
-
activeCameraId:
|
|
2409
|
-
isScreenShareEnabled:
|
|
2410
|
-
screenPreviewEl:
|
|
2411
|
-
isSpeakerMuted:
|
|
2493
|
+
isMuted: J.isMuted,
|
|
2494
|
+
micDevices: Ie.mics,
|
|
2495
|
+
isCameraEnabled: ne.isEnabled,
|
|
2496
|
+
cameraPreviewEl: ne.previewEl,
|
|
2497
|
+
cameraDevices: Ie.cameras,
|
|
2498
|
+
activeCameraId: ne.activeDeviceId,
|
|
2499
|
+
isScreenShareEnabled: pe.isEnabled,
|
|
2500
|
+
screenPreviewEl: pe.previewEl,
|
|
2501
|
+
isSpeakerMuted: tt,
|
|
2412
2502
|
allowCamera: g,
|
|
2413
2503
|
allowScreenShare: E,
|
|
2414
2504
|
allowTyping: x,
|
|
2415
|
-
languageMenuOpen:
|
|
2416
|
-
onToggleLanguageMenu: () =>
|
|
2417
|
-
needsUserGesture:
|
|
2505
|
+
languageMenuOpen: Vt,
|
|
2506
|
+
onToggleLanguageMenu: () => Yt((y) => !y),
|
|
2507
|
+
needsUserGesture: Ve,
|
|
2418
2508
|
canResume: w.canResume,
|
|
2419
|
-
micError:
|
|
2509
|
+
micError: J.micError,
|
|
2420
2510
|
error: w.error,
|
|
2421
|
-
avatarVideoContainerRef:
|
|
2511
|
+
avatarVideoContainerRef: mt,
|
|
2422
2512
|
onConnect: () => void w.connect(),
|
|
2423
2513
|
onDisconnect: () => w.disconnect(),
|
|
2424
|
-
onRetry:
|
|
2425
|
-
onResumeAudio:
|
|
2426
|
-
onToggleMute:
|
|
2427
|
-
onToggleCamera: () => void
|
|
2428
|
-
onSwitchCameraDevice: (
|
|
2429
|
-
onToggleScreenShare: () => void
|
|
2430
|
-
onToggleSpeaker:
|
|
2431
|
-
onSendMessage:
|
|
2432
|
-
onMinimize:
|
|
2433
|
-
onClose:
|
|
2434
|
-
onClearMicError:
|
|
2514
|
+
onRetry: on,
|
|
2515
|
+
onResumeAudio: rn,
|
|
2516
|
+
onToggleMute: J.toggleMute,
|
|
2517
|
+
onToggleCamera: () => void ne.toggle(),
|
|
2518
|
+
onSwitchCameraDevice: (y) => void ne.switchDevice(y),
|
|
2519
|
+
onToggleScreenShare: () => void pe.toggle(),
|
|
2520
|
+
onToggleSpeaker: Kt,
|
|
2521
|
+
onSendMessage: Jt,
|
|
2522
|
+
onMinimize: nn,
|
|
2523
|
+
onClose: vt,
|
|
2524
|
+
onClearMicError: J.clearError
|
|
2435
2525
|
}
|
|
2436
2526
|
)
|
|
2437
2527
|
]
|
|
2438
2528
|
}
|
|
2439
2529
|
) : null;
|
|
2440
2530
|
}
|
|
2441
|
-
function
|
|
2442
|
-
return /* @__PURE__ */ n(
|
|
2531
|
+
function Tr(e) {
|
|
2532
|
+
return /* @__PURE__ */ n(hn, { children: /* @__PURE__ */ n(Sr, { ...e }) });
|
|
2443
2533
|
}
|
|
2444
|
-
const
|
|
2534
|
+
const Pr = ({
|
|
2445
2535
|
agentId: e,
|
|
2446
2536
|
baseUrl: t,
|
|
2447
2537
|
apiKey: r,
|
|
2448
|
-
mode:
|
|
2449
|
-
onAgentEvent:
|
|
2538
|
+
mode: o,
|
|
2539
|
+
onAgentEvent: i,
|
|
2450
2540
|
className: l,
|
|
2451
|
-
style:
|
|
2541
|
+
style: s
|
|
2452
2542
|
}) => {
|
|
2453
|
-
const d = I(null), u = I(null), h = I(
|
|
2454
|
-
h.current =
|
|
2543
|
+
const d = I(null), u = I(null), h = I(i);
|
|
2544
|
+
h.current = i;
|
|
2455
2545
|
const m = S((a) => {
|
|
2456
2546
|
var A;
|
|
2457
|
-
const
|
|
2458
|
-
(A = h.current) == null || A.call(h,
|
|
2547
|
+
const c = a.detail;
|
|
2548
|
+
(A = h.current) == null || A.call(h, c);
|
|
2459
2549
|
}, []);
|
|
2460
2550
|
return P(() => {
|
|
2461
2551
|
const a = d.current;
|
|
2462
2552
|
if (!a) return;
|
|
2463
|
-
const
|
|
2464
|
-
return
|
|
2465
|
-
|
|
2553
|
+
const c = document.createElement("livelayer-widget");
|
|
2554
|
+
return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), o && c.setAttribute("mode", o), c.addEventListener("agent-event", m), a.appendChild(c), u.current = c, () => {
|
|
2555
|
+
c.removeEventListener("agent-event", m), a.removeChild(c), u.current = null;
|
|
2466
2556
|
};
|
|
2467
2557
|
}, [e]), P(() => {
|
|
2468
|
-
u.current && (
|
|
2469
|
-
}, [
|
|
2470
|
-
},
|
|
2471
|
-
function({ id: t, intent: r, as:
|
|
2472
|
-
return
|
|
2473
|
-
|
|
2558
|
+
u.current && (o ? u.current.setAttribute("mode", o) : u.current.removeAttribute("mode"));
|
|
2559
|
+
}, [o]), /* @__PURE__ */ n("div", { ref: d, className: l, style: s });
|
|
2560
|
+
}, Dr = dt(
|
|
2561
|
+
function({ id: t, intent: r, as: o = "div", className: i, style: l, children: s }, d) {
|
|
2562
|
+
return dn(
|
|
2563
|
+
o,
|
|
2474
2564
|
{
|
|
2475
2565
|
ref: d,
|
|
2476
2566
|
"data-ll-region": t,
|
|
2477
2567
|
"data-ll-intent": r,
|
|
2478
|
-
className:
|
|
2568
|
+
className: i,
|
|
2479
2569
|
style: l
|
|
2480
2570
|
},
|
|
2481
|
-
|
|
2571
|
+
s
|
|
2482
2572
|
);
|
|
2483
2573
|
}
|
|
2484
|
-
),
|
|
2485
|
-
function({ id: t, intent: r, children:
|
|
2574
|
+
), $r = dt(
|
|
2575
|
+
function({ id: t, intent: r, children: o, ...i }, l) {
|
|
2486
2576
|
return /* @__PURE__ */ n(
|
|
2487
2577
|
"form",
|
|
2488
2578
|
{
|
|
2489
2579
|
ref: l,
|
|
2490
2580
|
"data-ll-form": t,
|
|
2491
2581
|
"data-ll-intent": r,
|
|
2492
|
-
...
|
|
2493
|
-
children:
|
|
2582
|
+
...i,
|
|
2583
|
+
children: o
|
|
2494
2584
|
}
|
|
2495
2585
|
);
|
|
2496
2586
|
}
|
|
2497
|
-
),
|
|
2587
|
+
), zr = dt(
|
|
2498
2588
|
function(t, r) {
|
|
2499
|
-
const { name:
|
|
2589
|
+
const { name: o, label: i, labelClassName: l } = t, s = { name: o, "data-ll-field": o };
|
|
2500
2590
|
let d;
|
|
2501
2591
|
if ("as" in t && t.as === "textarea") {
|
|
2502
|
-
const { name: u, label: h, labelClassName: m, as: a, ...
|
|
2592
|
+
const { name: u, label: h, labelClassName: m, as: a, ...c } = t;
|
|
2503
2593
|
d = /* @__PURE__ */ n(
|
|
2504
2594
|
"textarea",
|
|
2505
2595
|
{
|
|
2506
2596
|
ref: r,
|
|
2507
|
-
...
|
|
2508
|
-
...
|
|
2597
|
+
...s,
|
|
2598
|
+
...c
|
|
2509
2599
|
}
|
|
2510
2600
|
);
|
|
2511
2601
|
} else if ("as" in t && t.as === "select") {
|
|
2512
|
-
const { name: u, label: h, labelClassName: m, as: a, children:
|
|
2602
|
+
const { name: u, label: h, labelClassName: m, as: a, children: c, ...A } = t;
|
|
2513
2603
|
d = /* @__PURE__ */ n(
|
|
2514
2604
|
"select",
|
|
2515
2605
|
{
|
|
2516
2606
|
ref: r,
|
|
2517
|
-
...
|
|
2607
|
+
...s,
|
|
2518
2608
|
...A,
|
|
2519
|
-
children:
|
|
2609
|
+
children: c
|
|
2520
2610
|
}
|
|
2521
2611
|
);
|
|
2522
2612
|
} else {
|
|
2523
|
-
const { name: u, label: h, labelClassName: m, as: a, ...
|
|
2613
|
+
const { name: u, label: h, labelClassName: m, as: a, ...c } = t;
|
|
2524
2614
|
d = /* @__PURE__ */ n(
|
|
2525
2615
|
"input",
|
|
2526
2616
|
{
|
|
2527
2617
|
ref: r,
|
|
2528
|
-
...
|
|
2529
|
-
...
|
|
2618
|
+
...s,
|
|
2619
|
+
...c
|
|
2530
2620
|
}
|
|
2531
2621
|
);
|
|
2532
2622
|
}
|
|
2533
|
-
return
|
|
2534
|
-
|
|
2623
|
+
return i === void 0 ? d : /* @__PURE__ */ _("label", { className: l, children: [
|
|
2624
|
+
i,
|
|
2535
2625
|
d
|
|
2536
2626
|
] });
|
|
2537
2627
|
}
|
|
2538
2628
|
);
|
|
2539
|
-
let
|
|
2540
|
-
function
|
|
2629
|
+
let Wt = 1;
|
|
2630
|
+
function Hr({
|
|
2541
2631
|
onMount: e,
|
|
2542
2632
|
defaultOpen: t = !1,
|
|
2543
2633
|
storageKey: r = "ll-debug-open"
|
|
2544
2634
|
}) {
|
|
2545
|
-
const [
|
|
2635
|
+
const [o, i] = N(t), [l, s] = N([]), [d, u] = N(""), [h, m] = N(!1), a = I(/* @__PURE__ */ new Set()), c = I([]), A = I(h);
|
|
2546
2636
|
A.current = h, P(() => {
|
|
2547
2637
|
try {
|
|
2548
2638
|
const b = localStorage.getItem(r);
|
|
2549
|
-
b === "1" &&
|
|
2639
|
+
b === "1" && i(!0), b === "0" && i(!1);
|
|
2550
2640
|
} catch {
|
|
2551
2641
|
}
|
|
2552
2642
|
}, [r]), P(() => {
|
|
2553
2643
|
try {
|
|
2554
|
-
localStorage.setItem(r,
|
|
2644
|
+
localStorage.setItem(r, o ? "1" : "0");
|
|
2555
2645
|
} catch {
|
|
2556
2646
|
}
|
|
2557
|
-
}, [
|
|
2647
|
+
}, [o, r]), P(() => {
|
|
2558
2648
|
const b = (L) => {
|
|
2559
|
-
(L.metaKey || L.ctrlKey) && L.shiftKey && L.key.toLowerCase() === "l" && (L.preventDefault(),
|
|
2649
|
+
(L.metaKey || L.ctrlKey) && L.shiftKey && L.key.toLowerCase() === "l" && (L.preventDefault(), i((z) => !z));
|
|
2560
2650
|
};
|
|
2561
2651
|
return window.addEventListener("keydown", b), () => window.removeEventListener("keydown", b);
|
|
2562
2652
|
}, []), P(() => {
|
|
2563
2653
|
const b = setInterval(() => {
|
|
2564
|
-
if (
|
|
2565
|
-
const L =
|
|
2566
|
-
|
|
2567
|
-
(
|
|
2654
|
+
if (c.current.length === 0 || A.current) return;
|
|
2655
|
+
const L = c.current.splice(0, c.current.length);
|
|
2656
|
+
s(
|
|
2657
|
+
(z) => [...L.reverse(), ...z].slice(0, 200)
|
|
2568
2658
|
);
|
|
2569
2659
|
}, 100);
|
|
2570
2660
|
return () => clearInterval(b);
|
|
@@ -2572,8 +2662,8 @@ function Ar({
|
|
|
2572
2662
|
const C = I(!1);
|
|
2573
2663
|
if (P(() => {
|
|
2574
2664
|
!e || C.current || (C.current = !0, e((b) => {
|
|
2575
|
-
|
|
2576
|
-
id:
|
|
2665
|
+
c.current.push({
|
|
2666
|
+
id: Wt++,
|
|
2577
2667
|
ts: Date.now(),
|
|
2578
2668
|
kind: "event",
|
|
2579
2669
|
type: b.eventName,
|
|
@@ -2581,29 +2671,29 @@ function Ar({
|
|
|
2581
2671
|
});
|
|
2582
2672
|
}));
|
|
2583
2673
|
}, [e]), P(() => {
|
|
2584
|
-
const b = console.warn, L = console.log,
|
|
2674
|
+
const b = console.warn, L = console.log, z = (M, O) => function(...p) {
|
|
2585
2675
|
try {
|
|
2586
2676
|
const g = typeof p[0] == "string" ? p[0] : "";
|
|
2587
|
-
g.startsWith("[LiveLayer]") &&
|
|
2588
|
-
id:
|
|
2677
|
+
g.startsWith("[LiveLayer]") && c.current.push({
|
|
2678
|
+
id: Wt++,
|
|
2589
2679
|
ts: Date.now(),
|
|
2590
2680
|
kind: M,
|
|
2591
2681
|
type: g.slice(0, 120),
|
|
2592
|
-
data: { args: p.slice(1).map((E) =>
|
|
2682
|
+
data: { args: p.slice(1).map((E) => Er(E)) }
|
|
2593
2683
|
});
|
|
2594
2684
|
} catch {
|
|
2595
2685
|
}
|
|
2596
|
-
return
|
|
2686
|
+
return O.apply(this, p);
|
|
2597
2687
|
};
|
|
2598
|
-
return console.warn =
|
|
2688
|
+
return console.warn = z("warn", b), console.log = z("log", L), () => {
|
|
2599
2689
|
console.warn = b, console.log = L;
|
|
2600
2690
|
};
|
|
2601
|
-
}, []), !
|
|
2691
|
+
}, []), !o)
|
|
2602
2692
|
return /* @__PURE__ */ n(
|
|
2603
2693
|
"button",
|
|
2604
2694
|
{
|
|
2605
2695
|
type: "button",
|
|
2606
|
-
onClick: () =>
|
|
2696
|
+
onClick: () => i(!0),
|
|
2607
2697
|
title: "Open LiveLayer debug panel (Cmd/Ctrl + Shift + L)",
|
|
2608
2698
|
"aria-label": "Open LiveLayer debug panel",
|
|
2609
2699
|
style: {
|
|
@@ -2676,7 +2766,7 @@ function Ar({
|
|
|
2676
2766
|
{
|
|
2677
2767
|
type: "button",
|
|
2678
2768
|
onClick: () => m((b) => !b),
|
|
2679
|
-
style:
|
|
2769
|
+
style: st(h ? "#f59e0b" : "transparent"),
|
|
2680
2770
|
title: "Pause / resume capture",
|
|
2681
2771
|
children: h ? "▶ resume" : "⏸ pause"
|
|
2682
2772
|
}
|
|
@@ -2686,9 +2776,9 @@ function Ar({
|
|
|
2686
2776
|
{
|
|
2687
2777
|
type: "button",
|
|
2688
2778
|
onClick: () => {
|
|
2689
|
-
|
|
2779
|
+
s([]), c.current = [];
|
|
2690
2780
|
},
|
|
2691
|
-
style:
|
|
2781
|
+
style: st("transparent"),
|
|
2692
2782
|
title: "Clear buffer",
|
|
2693
2783
|
children: "clear"
|
|
2694
2784
|
}
|
|
@@ -2697,8 +2787,8 @@ function Ar({
|
|
|
2697
2787
|
"button",
|
|
2698
2788
|
{
|
|
2699
2789
|
type: "button",
|
|
2700
|
-
onClick: () =>
|
|
2701
|
-
style:
|
|
2790
|
+
onClick: () => i(!1),
|
|
2791
|
+
style: st("transparent"),
|
|
2702
2792
|
"aria-label": "Close",
|
|
2703
2793
|
title: "Close (Cmd/Ctrl + Shift + L)",
|
|
2704
2794
|
children: "✕"
|
|
@@ -2765,12 +2855,12 @@ function Ar({
|
|
|
2765
2855
|
]
|
|
2766
2856
|
}
|
|
2767
2857
|
) : R.map((b) => /* @__PURE__ */ n(
|
|
2768
|
-
|
|
2858
|
+
Cr,
|
|
2769
2859
|
{
|
|
2770
2860
|
entry: b,
|
|
2771
2861
|
expanded: a.current.has(b.id),
|
|
2772
2862
|
onToggle: () => {
|
|
2773
|
-
a.current.has(b.id) ? a.current.delete(b.id) : a.current.add(b.id),
|
|
2863
|
+
a.current.has(b.id) ? a.current.delete(b.id) : a.current.add(b.id), s((L) => [...L]);
|
|
2774
2864
|
}
|
|
2775
2865
|
},
|
|
2776
2866
|
b.id
|
|
@@ -2781,12 +2871,12 @@ function Ar({
|
|
|
2781
2871
|
}
|
|
2782
2872
|
);
|
|
2783
2873
|
}
|
|
2784
|
-
function
|
|
2874
|
+
function Cr({
|
|
2785
2875
|
entry: e,
|
|
2786
2876
|
expanded: t,
|
|
2787
2877
|
onToggle: r
|
|
2788
2878
|
}) {
|
|
2789
|
-
const
|
|
2879
|
+
const o = e.kind === "warn" ? "#f59e0b" : e.type.startsWith("[LiveLayer]") ? "#94a3b8" : e.type === "navigate" || e.type === "scroll_page" || e.type === "scroll_to" || e.type === "click" ? "#22c55e" : e.type === "fill_form" || e.type === "submit_form" || e.type === "focus_field" ? "#a78bfa" : e.type === "request_page_context" || e.type === "request_routes" ? "#38bdf8" : e.type === "agent_state" ? "#facc15" : "#cbd5e1", i = new Date(e.ts).toLocaleTimeString("en-US", {
|
|
2790
2880
|
hour12: !1
|
|
2791
2881
|
});
|
|
2792
2882
|
return /* @__PURE__ */ _(
|
|
@@ -2816,14 +2906,14 @@ function yr({
|
|
|
2816
2906
|
fontVariantNumeric: "tabular-nums",
|
|
2817
2907
|
fontSize: 10
|
|
2818
2908
|
},
|
|
2819
|
-
children:
|
|
2909
|
+
children: i
|
|
2820
2910
|
}
|
|
2821
2911
|
),
|
|
2822
2912
|
/* @__PURE__ */ n(
|
|
2823
2913
|
"span",
|
|
2824
2914
|
{
|
|
2825
2915
|
style: {
|
|
2826
|
-
color:
|
|
2916
|
+
color: o,
|
|
2827
2917
|
fontWeight: 600,
|
|
2828
2918
|
flexShrink: 0
|
|
2829
2919
|
},
|
|
@@ -2851,7 +2941,7 @@ function yr({
|
|
|
2851
2941
|
}
|
|
2852
2942
|
);
|
|
2853
2943
|
}
|
|
2854
|
-
function
|
|
2944
|
+
function st(e) {
|
|
2855
2945
|
return {
|
|
2856
2946
|
background: e,
|
|
2857
2947
|
color: "#fff",
|
|
@@ -2862,58 +2952,59 @@ function at(e) {
|
|
|
2862
2952
|
cursor: "pointer"
|
|
2863
2953
|
};
|
|
2864
2954
|
}
|
|
2865
|
-
function
|
|
2955
|
+
function Er(e) {
|
|
2866
2956
|
try {
|
|
2867
2957
|
return e instanceof Error ? { message: e.message, stack: e.stack } : (JSON.stringify(e), e);
|
|
2868
2958
|
} catch {
|
|
2869
2959
|
return String(e);
|
|
2870
2960
|
}
|
|
2871
2961
|
}
|
|
2872
|
-
function
|
|
2873
|
-
const [e, t] = N([]), r = S((
|
|
2962
|
+
function Or() {
|
|
2963
|
+
const [e, t] = N([]), r = S((i) => {
|
|
2874
2964
|
t((l) => {
|
|
2875
|
-
const
|
|
2876
|
-
if (
|
|
2965
|
+
const s = l.findIndex((d) => d.id === i.id);
|
|
2966
|
+
if (s >= 0) {
|
|
2877
2967
|
const d = l.slice();
|
|
2878
|
-
return d[
|
|
2968
|
+
return d[s] = i, d;
|
|
2879
2969
|
}
|
|
2880
|
-
return [...l,
|
|
2970
|
+
return [...l, i];
|
|
2881
2971
|
});
|
|
2882
|
-
}, []),
|
|
2972
|
+
}, []), o = S(() => t([]), []);
|
|
2883
2973
|
return {
|
|
2884
2974
|
entries: e,
|
|
2885
2975
|
pushSegment: r,
|
|
2886
|
-
clear:
|
|
2976
|
+
clear: o,
|
|
2887
2977
|
latest: e.length > 0 ? e[e.length - 1] : null
|
|
2888
2978
|
};
|
|
2889
2979
|
}
|
|
2890
2980
|
export {
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2981
|
+
Tr as AvatarWidget,
|
|
2982
|
+
hn as ErrorBoundary,
|
|
2983
|
+
Hr as LiveLayerDebugPanel,
|
|
2984
|
+
zr as LiveLayerField,
|
|
2985
|
+
$r as LiveLayerForm,
|
|
2986
|
+
Dr as LiveLayerRegion,
|
|
2987
|
+
Pr as LiveLayerWidget,
|
|
2988
|
+
dr as clearPageContextCache,
|
|
2989
|
+
gr as clearRoutesCache,
|
|
2990
|
+
sr as extractPageContext,
|
|
2991
|
+
hr as extractRoutes,
|
|
2992
|
+
qt as getCachedPageContext,
|
|
2993
|
+
ct as getCachedRoutes,
|
|
2994
|
+
zn as matchesPattern,
|
|
2995
|
+
fr as normalizeRouteInput,
|
|
2996
|
+
Hn as shouldRenderAtPath,
|
|
2997
|
+
xn as useAgentInfo,
|
|
2998
|
+
gn as useAudioLevel,
|
|
2999
|
+
bn as useCameraState,
|
|
3000
|
+
Sn as useDisplayMode,
|
|
3001
|
+
Nn as useDisplayModePersistence,
|
|
3002
|
+
Rn as useIsMobile,
|
|
3003
|
+
mn as useLiveKitSession,
|
|
3004
|
+
_n as useMediaDevices,
|
|
3005
|
+
yn as useMicrophoneState,
|
|
3006
|
+
Mn as usePathname,
|
|
3007
|
+
On as useRouteMatch,
|
|
3008
|
+
wn as useScreenShareState,
|
|
3009
|
+
Or as useTranscript
|
|
2919
3010
|
};
|