@livelayer/react 0.5.17 → 0.5.18
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.js +3 -3
- package/dist/index.mjs +984 -950
- 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 wt } from "react/jsx-runtime";
|
|
3
|
+
import { Component as mn, useState as L, useRef as A, useEffect as N, useCallback as k, useMemo as st, forwardRef as _t, createElement as gn } from "react";
|
|
4
|
+
import { LiveKitSession as yn } from "@livelayer/sdk";
|
|
5
|
+
import { createLocalAudioTrack as vn, Track as en, createLocalVideoTrack as bn } from "livekit-client";
|
|
6
|
+
class wn extends mn {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments), this.state = { hasError: !1, error: null }, this.reset = () => {
|
|
9
9
|
this.setState({ hasError: !1, error: null });
|
|
@@ -33,26 +33,26 @@ class vn extends pn {
|
|
|
33
33
|
] }) : this.props.children;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const [t, r] =
|
|
38
|
-
|
|
36
|
+
function _n(e) {
|
|
37
|
+
const [t, r] = L("idle"), [i, o] = L("idle"), [l, c] = L([]), [u, f] = L(null), [y, b] = L(null), [s, a] = L(null), [x, E] = L(!1), [C, v] = L(null), w = A(null), O = A(e.onDataMessage);
|
|
38
|
+
O.current = e.onDataMessage, N(() => {
|
|
39
39
|
const R = {
|
|
40
|
-
onConnectionStateChange: (
|
|
41
|
-
r(
|
|
40
|
+
onConnectionStateChange: (z) => {
|
|
41
|
+
r(z), z === "connected" && v(null);
|
|
42
42
|
},
|
|
43
43
|
onAgentStateChange: o,
|
|
44
|
-
onTranscript: (
|
|
44
|
+
onTranscript: (z) => c([...z]),
|
|
45
45
|
onAgentConfig: f,
|
|
46
|
-
onAudioTrack: (
|
|
47
|
-
onVideoTrack: (
|
|
46
|
+
onAudioTrack: (z) => a(z),
|
|
47
|
+
onVideoTrack: (z) => b(z),
|
|
48
48
|
onVideoTrackRemoved: () => b(null),
|
|
49
|
-
onError: (
|
|
50
|
-
onDataMessage: (
|
|
49
|
+
onError: (z) => v(z),
|
|
50
|
+
onDataMessage: (z) => {
|
|
51
51
|
var M;
|
|
52
|
-
(M =
|
|
52
|
+
(M = O.current) == null || M.call(O, z);
|
|
53
53
|
},
|
|
54
54
|
onResumabilityChange: E
|
|
55
|
-
},
|
|
55
|
+
}, W = new yn(
|
|
56
56
|
{
|
|
57
57
|
agentId: e.agentId,
|
|
58
58
|
baseUrl: e.baseUrl,
|
|
@@ -62,9 +62,9 @@ function bn(e) {
|
|
|
62
62
|
},
|
|
63
63
|
R
|
|
64
64
|
);
|
|
65
|
-
return w.current =
|
|
66
|
-
var
|
|
67
|
-
(
|
|
65
|
+
return w.current = W, r("idle"), o("idle"), c([]), f(null), b(null), a(null), E(!1), v(null), () => {
|
|
66
|
+
var z;
|
|
67
|
+
(z = W.destroy) == null || z.call(W), w.current = null;
|
|
68
68
|
};
|
|
69
69
|
}, [
|
|
70
70
|
e.agentId,
|
|
@@ -73,18 +73,18 @@ function bn(e) {
|
|
|
73
73
|
e.sessionEndpoint,
|
|
74
74
|
JSON.stringify(e.sessionBody ?? {})
|
|
75
75
|
]);
|
|
76
|
-
const I =
|
|
76
|
+
const I = k(async () => {
|
|
77
77
|
const R = w.current;
|
|
78
78
|
if (R)
|
|
79
79
|
try {
|
|
80
80
|
await R.connect();
|
|
81
|
-
} catch (
|
|
82
|
-
throw v(
|
|
81
|
+
} catch (W) {
|
|
82
|
+
throw v(W instanceof Error ? W.message : String(W)), W;
|
|
83
83
|
}
|
|
84
|
-
}, []),
|
|
84
|
+
}, []), q = k(() => {
|
|
85
85
|
const R = w.current;
|
|
86
86
|
R && R.disconnect();
|
|
87
|
-
}, []), m =
|
|
87
|
+
}, []), m = k(() => {
|
|
88
88
|
var R;
|
|
89
89
|
return ((R = w.current) == null ? void 0 : R.getRoom()) ?? null;
|
|
90
90
|
}, []);
|
|
@@ -92,19 +92,19 @@ function bn(e) {
|
|
|
92
92
|
connectionState: t,
|
|
93
93
|
agentState: i,
|
|
94
94
|
transcript: l,
|
|
95
|
-
agentConfig:
|
|
95
|
+
agentConfig: u,
|
|
96
96
|
videoElement: y,
|
|
97
97
|
audioElement: s,
|
|
98
|
-
canResume:
|
|
98
|
+
canResume: x,
|
|
99
99
|
error: C,
|
|
100
100
|
connect: I,
|
|
101
|
-
disconnect:
|
|
101
|
+
disconnect: q,
|
|
102
102
|
getRoom: m,
|
|
103
103
|
session: w.current
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
const e = A(null), t = A(null), r = A(null), i = A(null), o = A(/* @__PURE__ */ new Set()), l = A(null), c =
|
|
106
|
+
function xn() {
|
|
107
|
+
const e = A(null), t = A(null), r = A(null), i = A(null), o = A(/* @__PURE__ */ new Set()), l = A(null), c = k(() => {
|
|
108
108
|
const s = t.current;
|
|
109
109
|
if (!s) {
|
|
110
110
|
i.current = null;
|
|
@@ -115,9 +115,9 @@ function wn() {
|
|
|
115
115
|
));
|
|
116
116
|
const a = l.current;
|
|
117
117
|
s.getByteFrequencyData(a);
|
|
118
|
-
let
|
|
119
|
-
for (let C = 0; C < a.length; C++)
|
|
120
|
-
const E =
|
|
118
|
+
let x = 0;
|
|
119
|
+
for (let C = 0; C < a.length; C++) x += a[C];
|
|
120
|
+
const E = x / a.length / 255;
|
|
121
121
|
for (const C of o.current)
|
|
122
122
|
try {
|
|
123
123
|
C(E);
|
|
@@ -125,13 +125,13 @@ function wn() {
|
|
|
125
125
|
console.error("[useAudioLevel] subscriber threw:", v);
|
|
126
126
|
}
|
|
127
127
|
i.current = requestAnimationFrame(c);
|
|
128
|
-
}, []),
|
|
128
|
+
}, []), u = k(() => {
|
|
129
129
|
if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
|
|
130
130
|
const s = new AudioContext(), a = s.createAnalyser();
|
|
131
131
|
a.fftSize = 64, a.connect(s.destination), e.current = s, t.current = a;
|
|
132
|
-
}, []), f =
|
|
132
|
+
}, []), f = k(
|
|
133
133
|
(s) => {
|
|
134
|
-
if (
|
|
134
|
+
if (u(), !(!e.current || !t.current)) {
|
|
135
135
|
if (r.current) {
|
|
136
136
|
try {
|
|
137
137
|
r.current.disconnect();
|
|
@@ -149,8 +149,8 @@ function wn() {
|
|
|
149
149
|
i.current === null && (i.current = requestAnimationFrame(c));
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
|
-
[
|
|
153
|
-
), y =
|
|
152
|
+
[u, c]
|
|
153
|
+
), y = k(() => {
|
|
154
154
|
if (i.current !== null && (cancelAnimationFrame(i.current), i.current = null), r.current) {
|
|
155
155
|
try {
|
|
156
156
|
r.current.disconnect();
|
|
@@ -158,7 +158,7 @@ function wn() {
|
|
|
158
158
|
}
|
|
159
159
|
r.current = null;
|
|
160
160
|
}
|
|
161
|
-
}, []), b =
|
|
161
|
+
}, []), b = k((s) => (o.current.add(s), () => {
|
|
162
162
|
o.current.delete(s);
|
|
163
163
|
}), []);
|
|
164
164
|
return N(() => () => {
|
|
@@ -179,8 +179,8 @@ function wn() {
|
|
|
179
179
|
o.current.clear(), l.current = null;
|
|
180
180
|
}, [y]), { attach: f, detach: y, subscribe: b };
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
const [e, t] =
|
|
182
|
+
function kn() {
|
|
183
|
+
const [e, t] = L(!1), [r, i] = L(null), o = A(null), l = A(null), c = k(
|
|
184
184
|
async (s, a) => {
|
|
185
185
|
if (o.current && l.current) {
|
|
186
186
|
try {
|
|
@@ -191,24 +191,24 @@ function _n() {
|
|
|
191
191
|
}
|
|
192
192
|
l.current = s, i(null);
|
|
193
193
|
try {
|
|
194
|
-
const
|
|
194
|
+
const x = await vn({
|
|
195
195
|
echoCancellation: !0,
|
|
196
196
|
noiseSuppression: !0
|
|
197
197
|
});
|
|
198
|
-
a != null && a.startMuted && await
|
|
199
|
-
} catch (
|
|
200
|
-
const E =
|
|
201
|
-
throw i(E),
|
|
198
|
+
a != null && a.startMuted && await x.mute(), await s.localParticipant.publishTrack(x), o.current = x, t(x.isMuted);
|
|
199
|
+
} catch (x) {
|
|
200
|
+
const E = x instanceof Error && x.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
|
|
201
|
+
throw i(E), x;
|
|
202
202
|
}
|
|
203
203
|
},
|
|
204
204
|
[]
|
|
205
|
-
),
|
|
205
|
+
), u = k(() => {
|
|
206
206
|
const s = o.current;
|
|
207
207
|
s && (s.isMuted ? (s.unmute(), t(!1)) : (s.mute(), t(!0)));
|
|
208
|
-
}, []), f =
|
|
208
|
+
}, []), f = k((s) => {
|
|
209
209
|
const a = o.current;
|
|
210
210
|
a && (s && !a.isMuted ? (a.mute(), t(!0)) : !s && a.isMuted && (a.unmute(), t(!1)));
|
|
211
|
-
}, []), y =
|
|
211
|
+
}, []), y = k(() => {
|
|
212
212
|
const s = o.current, a = l.current;
|
|
213
213
|
if (s && a) {
|
|
214
214
|
try {
|
|
@@ -218,25 +218,25 @@ function _n() {
|
|
|
218
218
|
s.stop();
|
|
219
219
|
}
|
|
220
220
|
o.current = null, l.current = null, t(!1);
|
|
221
|
-
}, []), b =
|
|
221
|
+
}, []), b = k(() => i(null), []);
|
|
222
222
|
return {
|
|
223
223
|
isMuted: e,
|
|
224
224
|
micError: r,
|
|
225
|
-
toggleMute:
|
|
225
|
+
toggleMute: u,
|
|
226
226
|
setMuted: f,
|
|
227
227
|
setupMic: c,
|
|
228
228
|
teardownMic: y,
|
|
229
229
|
clearError: b
|
|
230
230
|
};
|
|
231
231
|
}
|
|
232
|
-
const
|
|
233
|
-
function
|
|
234
|
-
const [e, t] =
|
|
232
|
+
const Ln = { resolution: { width: 640, height: 480, frameRate: 24 } };
|
|
233
|
+
function Sn() {
|
|
234
|
+
const [e, t] = L(!1), [r, i] = L(null), [o, l] = L(null), [c, u] = L(""), f = A(null), y = A(null), b = k((w) => {
|
|
235
235
|
f.current = w;
|
|
236
|
-
}, []), s =
|
|
237
|
-
const w = f.current,
|
|
238
|
-
if (
|
|
239
|
-
const I = w.localParticipant.getTrackPublication(
|
|
236
|
+
}, []), s = k(() => {
|
|
237
|
+
const w = f.current, O = y.current;
|
|
238
|
+
if (O && w) {
|
|
239
|
+
const I = w.localParticipant.getTrackPublication(en.Source.Camera);
|
|
240
240
|
if (I != null && I.track) {
|
|
241
241
|
try {
|
|
242
242
|
w.localParticipant.unpublishTrack(I.track);
|
|
@@ -244,39 +244,39 @@ function kn() {
|
|
|
244
244
|
}
|
|
245
245
|
I.track.stop();
|
|
246
246
|
} else
|
|
247
|
-
|
|
247
|
+
O.stop();
|
|
248
248
|
}
|
|
249
249
|
y.current = null, l(null), t(!1);
|
|
250
|
-
}, []), a =
|
|
251
|
-
const
|
|
252
|
-
if (
|
|
250
|
+
}, []), a = k(async (w) => {
|
|
251
|
+
const O = f.current;
|
|
252
|
+
if (O) {
|
|
253
253
|
i(null);
|
|
254
254
|
try {
|
|
255
|
-
const I = { ...
|
|
255
|
+
const I = { ...Ln };
|
|
256
256
|
w && (I.deviceId = w);
|
|
257
|
-
const
|
|
258
|
-
await
|
|
259
|
-
const m =
|
|
260
|
-
l(m), t(!0), w &&
|
|
257
|
+
const q = await bn(I);
|
|
258
|
+
await O.localParticipant.publishTrack(q), y.current = q;
|
|
259
|
+
const m = q.attach();
|
|
260
|
+
l(m), t(!0), w && u(w);
|
|
261
261
|
try {
|
|
262
|
-
|
|
262
|
+
O.localParticipant.publishData(
|
|
263
263
|
new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
|
|
264
264
|
{ reliable: !0 }
|
|
265
265
|
);
|
|
266
266
|
} catch {
|
|
267
267
|
}
|
|
268
268
|
} catch (I) {
|
|
269
|
-
const
|
|
270
|
-
i(
|
|
269
|
+
const q = I instanceof Error && I.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
|
|
270
|
+
i(q);
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
}, []),
|
|
273
|
+
}, []), x = k(async () => {
|
|
274
274
|
e ? s() : await a(c || void 0);
|
|
275
|
-
}, [e, c, s, a]), E =
|
|
275
|
+
}, [e, c, s, a]), E = k(async (w) => {
|
|
276
276
|
s(), await a(w);
|
|
277
|
-
}, [s, a]), C =
|
|
278
|
-
s(), f.current = null, i(null),
|
|
279
|
-
}, [s]), v =
|
|
277
|
+
}, [s, a]), C = k(() => {
|
|
278
|
+
s(), f.current = null, i(null), u("");
|
|
279
|
+
}, [s]), v = k(() => i(null), []);
|
|
280
280
|
return N(() => () => {
|
|
281
281
|
y.current && y.current.stop();
|
|
282
282
|
}, []), {
|
|
@@ -284,17 +284,17 @@ function kn() {
|
|
|
284
284
|
error: r,
|
|
285
285
|
previewEl: o,
|
|
286
286
|
activeDeviceId: c,
|
|
287
|
-
toggle:
|
|
287
|
+
toggle: x,
|
|
288
288
|
switchDevice: E,
|
|
289
289
|
attachRoom: b,
|
|
290
290
|
teardown: C,
|
|
291
291
|
clearError: v
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
|
-
function
|
|
295
|
-
const [e, t] =
|
|
294
|
+
function Cn() {
|
|
295
|
+
const [e, t] = L(!1), [r, i] = L(null), [o, l] = L(null), c = A(null), u = k((a) => {
|
|
296
296
|
c.current = a;
|
|
297
|
-
}, []), f =
|
|
297
|
+
}, []), f = k(() => l(null), []), y = k(async () => {
|
|
298
298
|
const a = c.current;
|
|
299
299
|
if (a) {
|
|
300
300
|
if (e) {
|
|
@@ -308,9 +308,9 @@ function Ln() {
|
|
|
308
308
|
i(null);
|
|
309
309
|
try {
|
|
310
310
|
await a.localParticipant.setScreenShareEnabled(!0);
|
|
311
|
-
let
|
|
311
|
+
let x = 0;
|
|
312
312
|
const E = () => {
|
|
313
|
-
const C = a.localParticipant.getTrackPublication(
|
|
313
|
+
const C = a.localParticipant.getTrackPublication(en.Source.ScreenShare);
|
|
314
314
|
if (C != null && C.track) {
|
|
315
315
|
const v = C.track.attach();
|
|
316
316
|
l(v), t(!0);
|
|
@@ -323,15 +323,15 @@ function Ln() {
|
|
|
323
323
|
}
|
|
324
324
|
return;
|
|
325
325
|
}
|
|
326
|
-
|
|
326
|
+
x++ < 10 ? setTimeout(E, 100) : t(!0);
|
|
327
327
|
};
|
|
328
328
|
E();
|
|
329
|
-
} catch (
|
|
330
|
-
const E =
|
|
329
|
+
} catch (x) {
|
|
330
|
+
const E = x instanceof Error ? x.name : "";
|
|
331
331
|
E !== "NotAllowedError" && E !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
|
-
}, [e, f]), b =
|
|
334
|
+
}, [e, f]), b = k(() => {
|
|
335
335
|
const a = c.current;
|
|
336
336
|
if (a && e)
|
|
337
337
|
try {
|
|
@@ -339,11 +339,11 @@ function Ln() {
|
|
|
339
339
|
} catch {
|
|
340
340
|
}
|
|
341
341
|
f(), t(!1), i(null), c.current = null;
|
|
342
|
-
}, [e, f]), s =
|
|
343
|
-
return { isEnabled: e, error: r, previewEl: o, toggle: y, attachRoom:
|
|
342
|
+
}, [e, f]), s = k(() => i(null), []);
|
|
343
|
+
return { isEnabled: e, error: r, previewEl: o, toggle: y, attachRoom: u, teardown: b, clearError: s };
|
|
344
344
|
}
|
|
345
|
-
function
|
|
346
|
-
const [e, t] =
|
|
345
|
+
function En() {
|
|
346
|
+
const [e, t] = L([]), [r, i] = L([]), o = k(async () => {
|
|
347
347
|
if (!(typeof navigator > "u" || !navigator.mediaDevices))
|
|
348
348
|
try {
|
|
349
349
|
const l = await navigator.mediaDevices.enumerateDevices();
|
|
@@ -357,8 +357,8 @@ function Sn() {
|
|
|
357
357
|
return navigator.mediaDevices.addEventListener("devicechange", l), () => navigator.mediaDevices.removeEventListener("devicechange", l);
|
|
358
358
|
}, [o]), { mics: e, cameras: r, refresh: o };
|
|
359
359
|
}
|
|
360
|
-
function
|
|
361
|
-
const [i, o] =
|
|
360
|
+
function Nn(e, t, r = !1) {
|
|
361
|
+
const [i, o] = L(null), [l, c] = L(null), [u, f] = L(!r && !!e);
|
|
362
362
|
return N(() => {
|
|
363
363
|
if (r || !e) {
|
|
364
364
|
f(!1);
|
|
@@ -378,9 +378,9 @@ function Cn(e, t, r = !1) {
|
|
|
378
378
|
}).catch((s) => {
|
|
379
379
|
y.signal.aborted || (c(s instanceof Error ? s.message : "Agent lookup failed"), f(!1));
|
|
380
380
|
}), () => y.abort();
|
|
381
|
-
}, [e, t, r]), { info: i, error: l, loading:
|
|
381
|
+
}, [e, t, r]), { info: i, error: l, loading: u };
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function An(e) {
|
|
384
384
|
if (typeof window > "u") return null;
|
|
385
385
|
try {
|
|
386
386
|
return window.localStorage.getItem(e);
|
|
@@ -388,53 +388,53 @@ function En(e) {
|
|
|
388
388
|
return null;
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
|
-
function
|
|
391
|
+
function Rn(e, t) {
|
|
392
392
|
if (!(typeof window > "u"))
|
|
393
393
|
try {
|
|
394
394
|
window.localStorage.setItem(e, t);
|
|
395
395
|
} catch {
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function Mn({
|
|
399
399
|
value: e,
|
|
400
400
|
defaultValue: t = "expanded",
|
|
401
401
|
onChange: r
|
|
402
402
|
} = {}) {
|
|
403
|
-
const i = e !== void 0, [o, l] =
|
|
403
|
+
const i = e !== void 0, [o, l] = L(t), c = i ? e : o, u = k(
|
|
404
404
|
(f) => {
|
|
405
405
|
f !== c && (i || l(f), r == null || r(f));
|
|
406
406
|
},
|
|
407
407
|
[c, i, r]
|
|
408
408
|
);
|
|
409
|
-
return [c,
|
|
409
|
+
return [c, u];
|
|
410
410
|
}
|
|
411
|
-
const
|
|
412
|
-
function
|
|
413
|
-
return e &&
|
|
411
|
+
const In = ["hidden", "minimized", "expanded"];
|
|
412
|
+
function Tn(e) {
|
|
413
|
+
return e && In.includes(e) ? e : null;
|
|
414
414
|
}
|
|
415
|
-
function
|
|
415
|
+
function Pn({
|
|
416
416
|
value: e,
|
|
417
417
|
defaultValue: t = "expanded",
|
|
418
418
|
onChange: r,
|
|
419
419
|
persistKey: i = "ll-widget",
|
|
420
420
|
disablePersistence: o = !1
|
|
421
421
|
} = {}) {
|
|
422
|
-
const l = `${i}:display-mode`, c = A(!1), [
|
|
422
|
+
const l = `${i}:display-mode`, c = A(!1), [u, f] = Mn({
|
|
423
423
|
value: e,
|
|
424
424
|
defaultValue: t,
|
|
425
425
|
onChange: (y) => {
|
|
426
|
-
e === void 0 && !o &&
|
|
426
|
+
e === void 0 && !o && Rn(l, y), r == null || r(y);
|
|
427
427
|
}
|
|
428
428
|
});
|
|
429
429
|
return N(() => {
|
|
430
430
|
if (c.current || (c.current = !0, o || e !== void 0)) return;
|
|
431
|
-
const y =
|
|
432
|
-
y && y !==
|
|
433
|
-
}, []), [
|
|
431
|
+
const y = Tn(An(l));
|
|
432
|
+
y && y !== u && f(y);
|
|
433
|
+
}, []), [u, f];
|
|
434
434
|
}
|
|
435
|
-
const
|
|
436
|
-
function
|
|
437
|
-
const [t, r] =
|
|
435
|
+
const Dn = 640;
|
|
436
|
+
function $n(e = Dn) {
|
|
437
|
+
const [t, r] = L(!1);
|
|
438
438
|
return N(() => {
|
|
439
439
|
if (e === !1) {
|
|
440
440
|
r(!1);
|
|
@@ -448,67 +448,67 @@ function Pn(e = Tn) {
|
|
|
448
448
|
});
|
|
449
449
|
}, [e]), t;
|
|
450
450
|
}
|
|
451
|
-
const
|
|
452
|
-
function
|
|
453
|
-
if (typeof window > "u" || window.history[
|
|
451
|
+
const zt = "__llHistoryPatched", ct = "ll:pathname";
|
|
452
|
+
function zn() {
|
|
453
|
+
if (typeof window > "u" || window.history[zt]) return;
|
|
454
454
|
const e = window.history.pushState, t = window.history.replaceState;
|
|
455
455
|
window.history.pushState = function(...r) {
|
|
456
456
|
const i = e.apply(this, r);
|
|
457
|
-
return window.dispatchEvent(new Event(
|
|
457
|
+
return window.dispatchEvent(new Event(ct)), i;
|
|
458
458
|
}, window.history.replaceState = function(...r) {
|
|
459
459
|
const i = t.apply(this, r);
|
|
460
|
-
return window.dispatchEvent(new Event(
|
|
461
|
-
}, window.history[
|
|
460
|
+
return window.dispatchEvent(new Event(ct)), i;
|
|
461
|
+
}, window.history[zt] = !0;
|
|
462
462
|
}
|
|
463
|
-
function
|
|
463
|
+
function Ht() {
|
|
464
464
|
return typeof window > "u" ? "/" : window.location.pathname || "/";
|
|
465
465
|
}
|
|
466
|
-
function
|
|
467
|
-
const [t, r] =
|
|
468
|
-
() => e ??
|
|
466
|
+
function Hn(e) {
|
|
467
|
+
const [t, r] = L(
|
|
468
|
+
() => e ?? Ht()
|
|
469
469
|
);
|
|
470
470
|
return N(() => {
|
|
471
471
|
if (e !== void 0) return;
|
|
472
|
-
|
|
473
|
-
const i = () => r(
|
|
474
|
-
return i(), window.addEventListener("popstate", i), window.addEventListener(
|
|
475
|
-
window.removeEventListener("popstate", i), window.removeEventListener(
|
|
472
|
+
zn();
|
|
473
|
+
const i = () => r(Ht());
|
|
474
|
+
return i(), window.addEventListener("popstate", i), window.addEventListener(ct, i), () => {
|
|
475
|
+
window.removeEventListener("popstate", i), window.removeEventListener(ct, i);
|
|
476
476
|
};
|
|
477
477
|
}, [e]), e ?? t;
|
|
478
478
|
}
|
|
479
|
-
const
|
|
480
|
-
function
|
|
481
|
-
return e.replace(
|
|
479
|
+
const Ot = /* @__PURE__ */ new Map(), On = /[\\^$+?.()|{}[\]]/g;
|
|
480
|
+
function qn(e) {
|
|
481
|
+
return e.replace(On, "\\$&");
|
|
482
482
|
}
|
|
483
|
-
function
|
|
484
|
-
const t =
|
|
483
|
+
function Bn(e) {
|
|
484
|
+
const t = Ot.get(e);
|
|
485
485
|
if (t) return t;
|
|
486
|
-
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", o = "", l = r.replace(/\*\*/g, i).replace(/\*/g, o),
|
|
487
|
-
return
|
|
486
|
+
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", o = "", l = r.replace(/\*\*/g, i).replace(/\*/g, o), u = qn(l).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(o, "g"), "[^/]+"), f = new RegExp(`^${u}\\/?$`);
|
|
487
|
+
return Ot.set(e, f), f;
|
|
488
488
|
}
|
|
489
|
-
function
|
|
489
|
+
function Wn(e, t) {
|
|
490
490
|
const r = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
|
|
491
|
-
return
|
|
491
|
+
return Bn(e).test(r);
|
|
492
492
|
}
|
|
493
|
-
function
|
|
494
|
-
return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) :
|
|
493
|
+
function Fn(e, t) {
|
|
494
|
+
return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : Wn(e, t);
|
|
495
495
|
}
|
|
496
|
-
function
|
|
496
|
+
function qt(e, t) {
|
|
497
497
|
if (!e || e.length === 0) return !1;
|
|
498
498
|
for (const r of e)
|
|
499
|
-
if (
|
|
499
|
+
if (Fn(r, t)) return !0;
|
|
500
500
|
return !1;
|
|
501
501
|
}
|
|
502
|
-
function
|
|
503
|
-
return e === void 0 ? !0 :
|
|
502
|
+
function Un(e, t, r) {
|
|
503
|
+
return e === void 0 ? !0 : qt(r, e) ? !1 : t && t.length > 0 ? qt(t, e) : !0;
|
|
504
504
|
}
|
|
505
|
-
function
|
|
506
|
-
return
|
|
507
|
-
() =>
|
|
505
|
+
function jn(e, t, r) {
|
|
506
|
+
return st(
|
|
507
|
+
() => Un(e, t, r),
|
|
508
508
|
[e, t, r]
|
|
509
509
|
);
|
|
510
510
|
}
|
|
511
|
-
const
|
|
511
|
+
const Bt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
|
|
512
512
|
"svg",
|
|
513
513
|
{
|
|
514
514
|
className: t,
|
|
@@ -554,7 +554,7 @@ const Ht = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
|
|
|
554
554
|
}
|
|
555
555
|
)
|
|
556
556
|
}
|
|
557
|
-
),
|
|
557
|
+
), Wt = ({ className: e }) => /* @__PURE__ */ n(
|
|
558
558
|
"svg",
|
|
559
559
|
{
|
|
560
560
|
className: e,
|
|
@@ -572,7 +572,7 @@ const Ht = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
|
|
|
572
572
|
}
|
|
573
573
|
)
|
|
574
574
|
}
|
|
575
|
-
),
|
|
575
|
+
), Vn = ({ className: e }) => /* @__PURE__ */ n(
|
|
576
576
|
"svg",
|
|
577
577
|
{
|
|
578
578
|
className: e,
|
|
@@ -583,12 +583,12 @@ const Ht = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
|
|
|
583
583
|
"aria-hidden": "true",
|
|
584
584
|
children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
585
585
|
}
|
|
586
|
-
),
|
|
586
|
+
), Yn = {
|
|
587
587
|
left: 180,
|
|
588
588
|
right: 0,
|
|
589
589
|
up: -90,
|
|
590
590
|
down: 90
|
|
591
|
-
},
|
|
591
|
+
}, Ft = ({ direction: e = "right", className: t }) => /* @__PURE__ */ n(
|
|
592
592
|
"svg",
|
|
593
593
|
{
|
|
594
594
|
className: t,
|
|
@@ -596,19 +596,19 @@ const Ht = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
|
|
|
596
596
|
viewBox: "0 0 24 24",
|
|
597
597
|
stroke: "currentColor",
|
|
598
598
|
strokeWidth: 2,
|
|
599
|
-
style: { transform: `rotate(${
|
|
599
|
+
style: { transform: `rotate(${Yn[e]}deg)` },
|
|
600
600
|
"aria-hidden": "true",
|
|
601
601
|
children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" })
|
|
602
602
|
}
|
|
603
603
|
);
|
|
604
|
-
function
|
|
604
|
+
function Jn(e) {
|
|
605
605
|
return e === "top-left" || e === "bottom-left" ? "left" : "right";
|
|
606
606
|
}
|
|
607
|
-
const
|
|
608
|
-
function
|
|
607
|
+
const tn = "ll-hidden-tab-center-y", Kn = 5, Ut = 16;
|
|
608
|
+
function Xn() {
|
|
609
609
|
if (typeof window > "u") return null;
|
|
610
610
|
try {
|
|
611
|
-
const e = window.localStorage.getItem(
|
|
611
|
+
const e = window.localStorage.getItem(tn);
|
|
612
612
|
if (!e) return null;
|
|
613
613
|
const t = Number.parseFloat(e);
|
|
614
614
|
return Number.isFinite(t) ? t : null;
|
|
@@ -616,14 +616,14 @@ function Gn() {
|
|
|
616
616
|
return null;
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
-
function
|
|
619
|
+
function jt(e) {
|
|
620
620
|
if (!(typeof window > "u"))
|
|
621
621
|
try {
|
|
622
|
-
window.localStorage.setItem(
|
|
622
|
+
window.localStorage.setItem(tn, String(e));
|
|
623
623
|
} catch {
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
|
-
const
|
|
626
|
+
const Gn = ({
|
|
627
627
|
position: e,
|
|
628
628
|
isMobile: t,
|
|
629
629
|
isSpeaking: r,
|
|
@@ -632,23 +632,23 @@ const Jn = ({
|
|
|
632
632
|
avatarImageUrl: l,
|
|
633
633
|
agentName: c
|
|
634
634
|
}) => {
|
|
635
|
-
const
|
|
635
|
+
const u = Jn(e), f = u === "right" ? "left" : "right", y = t ? 80 : 72, b = !!l, [s, a] = L(null), [x, E] = L(!1), C = A(null), v = A(!1), w = k(
|
|
636
636
|
(M) => {
|
|
637
637
|
if (typeof window > "u") return M;
|
|
638
|
-
const
|
|
639
|
-
return
|
|
638
|
+
const B = y / 2, F = Ut + B, G = window.innerHeight - Ut - B;
|
|
639
|
+
return G < F ? Math.max(F, M) : Math.max(F, Math.min(G, M));
|
|
640
640
|
},
|
|
641
641
|
[y]
|
|
642
642
|
);
|
|
643
643
|
N(() => {
|
|
644
|
-
const M =
|
|
644
|
+
const M = Xn();
|
|
645
645
|
a(w(M ?? window.innerHeight / 2));
|
|
646
|
-
const
|
|
647
|
-
a((
|
|
646
|
+
const B = () => {
|
|
647
|
+
a((F) => F === null ? null : w(F));
|
|
648
648
|
};
|
|
649
|
-
return window.addEventListener("resize",
|
|
649
|
+
return window.addEventListener("resize", B), () => window.removeEventListener("resize", B);
|
|
650
650
|
}, [w]);
|
|
651
|
-
const
|
|
651
|
+
const O = k(
|
|
652
652
|
(M) => {
|
|
653
653
|
if (!(M.pointerType === "mouse" && M.button !== 0) && s !== null) {
|
|
654
654
|
try {
|
|
@@ -663,75 +663,75 @@ const Jn = ({
|
|
|
663
663
|
}
|
|
664
664
|
},
|
|
665
665
|
[s]
|
|
666
|
-
), I =
|
|
666
|
+
), I = k(
|
|
667
667
|
(M) => {
|
|
668
|
-
const
|
|
669
|
-
if (!
|
|
670
|
-
const
|
|
671
|
-
!
|
|
668
|
+
const B = C.current;
|
|
669
|
+
if (!B) return;
|
|
670
|
+
const F = M.clientY - B.startClientY;
|
|
671
|
+
!B.moved && Math.abs(F) > Kn && (B.moved = !0, E(!0)), B.moved && a(w(B.startCenterY + F));
|
|
672
672
|
},
|
|
673
673
|
[w]
|
|
674
|
-
),
|
|
674
|
+
), q = k(
|
|
675
675
|
(M) => {
|
|
676
|
-
const
|
|
677
|
-
if (
|
|
676
|
+
const B = C.current;
|
|
677
|
+
if (B) {
|
|
678
678
|
try {
|
|
679
679
|
M.currentTarget.releasePointerCapture(M.pointerId);
|
|
680
680
|
} catch {
|
|
681
681
|
}
|
|
682
|
-
C.current = null,
|
|
682
|
+
C.current = null, B.moved && (E(!1), v.current = !0, a((F) => (F !== null && jt(F), F)));
|
|
683
683
|
}
|
|
684
684
|
},
|
|
685
685
|
[]
|
|
686
|
-
), m =
|
|
686
|
+
), m = k(() => {
|
|
687
687
|
if (v.current) {
|
|
688
688
|
v.current = !1;
|
|
689
689
|
return;
|
|
690
690
|
}
|
|
691
691
|
i();
|
|
692
|
-
}, [i]), R =
|
|
692
|
+
}, [i]), R = k(
|
|
693
693
|
(M) => {
|
|
694
694
|
if (M.key === "ArrowUp" || M.key === "ArrowDown") {
|
|
695
695
|
M.preventDefault();
|
|
696
|
-
const
|
|
697
|
-
a((
|
|
698
|
-
if (
|
|
699
|
-
const
|
|
700
|
-
return
|
|
696
|
+
const B = M.key === "ArrowUp" ? -8 : 8;
|
|
697
|
+
a((F) => {
|
|
698
|
+
if (F === null) return F;
|
|
699
|
+
const G = w(F + B);
|
|
700
|
+
return jt(G), G;
|
|
701
701
|
});
|
|
702
702
|
}
|
|
703
703
|
},
|
|
704
704
|
[w]
|
|
705
|
-
),
|
|
705
|
+
), W = [
|
|
706
706
|
"ll-hidden",
|
|
707
|
-
`ll-hidden--${
|
|
707
|
+
`ll-hidden--${u}`,
|
|
708
708
|
t ? "ll-hidden--mobile" : "ll-hidden--desktop",
|
|
709
709
|
r ? "ll-hidden--speaking" : null,
|
|
710
|
-
|
|
710
|
+
x ? "is-dragging" : null,
|
|
711
711
|
b ? "ll-hidden--with-avatar" : null
|
|
712
|
-
].filter(Boolean).join(" "),
|
|
712
|
+
].filter(Boolean).join(" "), z = s === null ? void 0 : { top: `${s - y / 2}px`, transform: "none" };
|
|
713
713
|
return /* @__PURE__ */ n(
|
|
714
714
|
"button",
|
|
715
715
|
{
|
|
716
716
|
type: "button",
|
|
717
|
-
className:
|
|
718
|
-
onPointerDown:
|
|
717
|
+
className: W,
|
|
718
|
+
onPointerDown: O,
|
|
719
719
|
onPointerMove: I,
|
|
720
|
-
onPointerUp:
|
|
721
|
-
onPointerCancel:
|
|
720
|
+
onPointerUp: q,
|
|
721
|
+
onPointerCancel: q,
|
|
722
722
|
onClick: m,
|
|
723
723
|
onKeyDown: R,
|
|
724
724
|
"aria-label": o,
|
|
725
725
|
"data-position": e,
|
|
726
|
-
style:
|
|
726
|
+
style: z,
|
|
727
727
|
children: b ? (
|
|
728
728
|
// Layout: tiny chevron flush against the inward edge (peeks out
|
|
729
729
|
// as the click affordance), then the circular avatar photo
|
|
730
730
|
// taking the rest of the tab. Reinforces "this is an
|
|
731
731
|
// avatar-based experience" even when collapsed.
|
|
732
|
-
/* @__PURE__ */ _(
|
|
732
|
+
/* @__PURE__ */ _(wt, { children: [
|
|
733
733
|
/* @__PURE__ */ n(
|
|
734
|
-
|
|
734
|
+
Ft,
|
|
735
735
|
{
|
|
736
736
|
direction: f,
|
|
737
737
|
className: "ll-hidden__chevron ll-hidden__chevron--mini"
|
|
@@ -748,7 +748,7 @@ const Jn = ({
|
|
|
748
748
|
)
|
|
749
749
|
] })
|
|
750
750
|
) : /* @__PURE__ */ n(
|
|
751
|
-
|
|
751
|
+
Ft,
|
|
752
752
|
{
|
|
753
753
|
direction: f,
|
|
754
754
|
className: "ll-hidden__chevron"
|
|
@@ -756,7 +756,7 @@ const Jn = ({
|
|
|
756
756
|
)
|
|
757
757
|
}
|
|
758
758
|
);
|
|
759
|
-
},
|
|
759
|
+
}, Qn = ({
|
|
760
760
|
audioLevel: e,
|
|
761
761
|
bars: t = 20,
|
|
762
762
|
maxHeight: r = 20,
|
|
@@ -764,16 +764,16 @@ const Jn = ({
|
|
|
764
764
|
className: o,
|
|
765
765
|
barClassName: l
|
|
766
766
|
}) => {
|
|
767
|
-
const c = A(null),
|
|
767
|
+
const c = A(null), u = A([]), f = st(() => {
|
|
768
768
|
const b = (Math.sqrt(5) - 1) / 2;
|
|
769
769
|
return Array.from({ length: t }, (s, a) => 0.5 + a * b % 1 * 0.5);
|
|
770
770
|
}, [t]);
|
|
771
771
|
N(() => e.subscribe((s) => {
|
|
772
772
|
for (let a = 0; a < t; a++) {
|
|
773
|
-
const
|
|
774
|
-
if (!
|
|
773
|
+
const x = u.current[a];
|
|
774
|
+
if (!x) continue;
|
|
775
775
|
const E = Math.max(i, s * r * f[a]);
|
|
776
|
-
|
|
776
|
+
x.style.height = `${E}px`;
|
|
777
777
|
}
|
|
778
778
|
}), [e, t, r, i, f]);
|
|
779
779
|
const y = ["ll-waveform", o].filter(Boolean).join(" ");
|
|
@@ -781,14 +781,14 @@ const Jn = ({
|
|
|
781
781
|
"div",
|
|
782
782
|
{
|
|
783
783
|
ref: (a) => {
|
|
784
|
-
|
|
784
|
+
u.current[s] = a;
|
|
785
785
|
},
|
|
786
786
|
className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
|
|
787
787
|
style: { height: `${i}px` }
|
|
788
788
|
},
|
|
789
789
|
s
|
|
790
790
|
)) });
|
|
791
|
-
},
|
|
791
|
+
}, Zn = ({
|
|
792
792
|
position: e,
|
|
793
793
|
isMobile: t,
|
|
794
794
|
agentName: r,
|
|
@@ -796,7 +796,7 @@ const Jn = ({
|
|
|
796
796
|
agentState: o,
|
|
797
797
|
isMuted: l,
|
|
798
798
|
audioLevel: c,
|
|
799
|
-
onExpand:
|
|
799
|
+
onExpand: u,
|
|
800
800
|
onToggleMute: f,
|
|
801
801
|
onClose: y
|
|
802
802
|
}) => t ? /* @__PURE__ */ n(
|
|
@@ -810,7 +810,7 @@ const Jn = ({
|
|
|
810
810
|
{
|
|
811
811
|
type: "button",
|
|
812
812
|
className: "ll-minimized__surface",
|
|
813
|
-
onClick:
|
|
813
|
+
onClick: u,
|
|
814
814
|
"aria-label": `Expand ${r} widget`,
|
|
815
815
|
children: [
|
|
816
816
|
i ? (
|
|
@@ -825,7 +825,7 @@ const Jn = ({
|
|
|
825
825
|
)
|
|
826
826
|
) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
|
|
827
827
|
/* @__PURE__ */ n(
|
|
828
|
-
|
|
828
|
+
Qn,
|
|
829
829
|
{
|
|
830
830
|
audioLevel: c,
|
|
831
831
|
bars: 16,
|
|
@@ -848,10 +848,10 @@ const Jn = ({
|
|
|
848
848
|
(b.key === "Enter" || b.key === " ") && (b.stopPropagation(), b.preventDefault(), f());
|
|
849
849
|
},
|
|
850
850
|
"aria-label": l ? "Unmute microphone" : "Mute microphone",
|
|
851
|
-
children: /* @__PURE__ */ n(
|
|
851
|
+
children: /* @__PURE__ */ n(Bt, { muted: l, className: "ll-minimized__icon" })
|
|
852
852
|
}
|
|
853
853
|
),
|
|
854
|
-
/* @__PURE__ */ n(
|
|
854
|
+
/* @__PURE__ */ n(Wt, { className: "ll-minimized__icon ll-minimized__icon--expand" })
|
|
855
855
|
] })
|
|
856
856
|
]
|
|
857
857
|
}
|
|
@@ -888,7 +888,7 @@ const Jn = ({
|
|
|
888
888
|
className: "ll-minimized__btn",
|
|
889
889
|
onClick: f,
|
|
890
890
|
"aria-label": l ? "Unmute microphone" : "Mute microphone",
|
|
891
|
-
children: /* @__PURE__ */ n(
|
|
891
|
+
children: /* @__PURE__ */ n(Bt, { muted: l, className: "ll-minimized__icon" })
|
|
892
892
|
}
|
|
893
893
|
),
|
|
894
894
|
/* @__PURE__ */ n(
|
|
@@ -896,9 +896,9 @@ const Jn = ({
|
|
|
896
896
|
{
|
|
897
897
|
type: "button",
|
|
898
898
|
className: "ll-minimized__btn",
|
|
899
|
-
onClick:
|
|
899
|
+
onClick: u,
|
|
900
900
|
"aria-label": `Expand ${r} widget`,
|
|
901
|
-
children: /* @__PURE__ */ n(
|
|
901
|
+
children: /* @__PURE__ */ n(Wt, { className: "ll-minimized__icon" })
|
|
902
902
|
}
|
|
903
903
|
),
|
|
904
904
|
/* @__PURE__ */ n(
|
|
@@ -908,22 +908,22 @@ const Jn = ({
|
|
|
908
908
|
className: "ll-minimized__btn ll-minimized__btn--close",
|
|
909
909
|
onClick: y,
|
|
910
910
|
"aria-label": "Close widget",
|
|
911
|
-
children: /* @__PURE__ */ n(
|
|
911
|
+
children: /* @__PURE__ */ n(Vn, { className: "ll-minimized__icon" })
|
|
912
912
|
}
|
|
913
913
|
)
|
|
914
914
|
] })
|
|
915
915
|
] })
|
|
916
916
|
}
|
|
917
|
-
),
|
|
917
|
+
), er = ({
|
|
918
918
|
src: e,
|
|
919
919
|
alt: t,
|
|
920
920
|
preCannedPlaying: r = !1,
|
|
921
921
|
className: i,
|
|
922
922
|
style: o
|
|
923
923
|
}) => {
|
|
924
|
-
const [l, c] =
|
|
924
|
+
const [l, c] = L(!1), u = A(e);
|
|
925
925
|
if (N(() => {
|
|
926
|
-
|
|
926
|
+
u.current !== e && (u.current = e, c(!1));
|
|
927
927
|
}, [e]), !e) return null;
|
|
928
928
|
const f = {
|
|
929
929
|
position: "absolute",
|
|
@@ -952,7 +952,7 @@ const Jn = ({
|
|
|
952
952
|
}
|
|
953
953
|
)
|
|
954
954
|
);
|
|
955
|
-
},
|
|
955
|
+
}, tr = ({
|
|
956
956
|
position: e,
|
|
957
957
|
isMobile: t,
|
|
958
958
|
agentName: r,
|
|
@@ -960,136 +960,136 @@ const Jn = ({
|
|
|
960
960
|
idleLoopUrl: o,
|
|
961
961
|
greeting: l,
|
|
962
962
|
branding: c,
|
|
963
|
-
teamMembers:
|
|
963
|
+
teamMembers: u,
|
|
964
964
|
currentTeamMemberId: f,
|
|
965
965
|
isSwitchingTeamMember: y,
|
|
966
966
|
teamSwitcherOpen: b,
|
|
967
967
|
onToggleTeamSwitcher: s,
|
|
968
968
|
onSelectTeamMember: a,
|
|
969
|
-
languageMenuOpen:
|
|
969
|
+
languageMenuOpen: x,
|
|
970
970
|
onToggleLanguageMenu: E,
|
|
971
971
|
connectionState: C,
|
|
972
972
|
agentState: v,
|
|
973
973
|
transcript: w,
|
|
974
|
-
canResume:
|
|
974
|
+
canResume: O,
|
|
975
975
|
needsUserGesture: I,
|
|
976
|
-
error:
|
|
976
|
+
error: q,
|
|
977
977
|
isMuted: m,
|
|
978
978
|
micError: R,
|
|
979
|
-
micDevices:
|
|
980
|
-
isCameraEnabled:
|
|
979
|
+
micDevices: W,
|
|
980
|
+
isCameraEnabled: z,
|
|
981
981
|
cameraPreviewEl: M,
|
|
982
|
-
cameraDevices:
|
|
983
|
-
activeCameraId:
|
|
984
|
-
isScreenShareEnabled:
|
|
985
|
-
screenPreviewEl:
|
|
986
|
-
isSpeakerMuted:
|
|
987
|
-
allowCamera:
|
|
988
|
-
allowScreenShare:
|
|
989
|
-
allowTyping:
|
|
990
|
-
avatarVideoContainerRef:
|
|
991
|
-
agentVideoEl:
|
|
992
|
-
micGateOpen:
|
|
993
|
-
onConnect:
|
|
994
|
-
onDisconnect:
|
|
995
|
-
onRetry:
|
|
996
|
-
onResumeAudio:
|
|
997
|
-
onToggleMute:
|
|
998
|
-
onToggleCamera:
|
|
982
|
+
cameraDevices: B,
|
|
983
|
+
activeCameraId: F,
|
|
984
|
+
isScreenShareEnabled: G,
|
|
985
|
+
screenPreviewEl: ie,
|
|
986
|
+
isSpeakerMuted: be,
|
|
987
|
+
allowCamera: Qe,
|
|
988
|
+
allowScreenShare: Ze,
|
|
989
|
+
allowTyping: et,
|
|
990
|
+
avatarVideoContainerRef: tt,
|
|
991
|
+
agentVideoEl: re,
|
|
992
|
+
micGateOpen: ce,
|
|
993
|
+
onConnect: we,
|
|
994
|
+
onDisconnect: Se,
|
|
995
|
+
onRetry: Ce,
|
|
996
|
+
onResumeAudio: Ee,
|
|
997
|
+
onToggleMute: Ne,
|
|
998
|
+
onToggleCamera: Ae,
|
|
999
999
|
onSwitchCameraDevice: V,
|
|
1000
|
-
onToggleScreenShare:
|
|
1001
|
-
onToggleSpeaker:
|
|
1002
|
-
onSendMessage:
|
|
1003
|
-
onMinimize:
|
|
1004
|
-
onClose:
|
|
1005
|
-
onClearMicError:
|
|
1000
|
+
onToggleScreenShare: ut,
|
|
1001
|
+
onToggleSpeaker: ft,
|
|
1002
|
+
onSendMessage: nt,
|
|
1003
|
+
onMinimize: ue,
|
|
1004
|
+
onClose: Re,
|
|
1005
|
+
onClearMicError: qe
|
|
1006
1006
|
}) => {
|
|
1007
|
-
var
|
|
1008
|
-
const
|
|
1007
|
+
var De;
|
|
1008
|
+
const _e = ((u == null ? void 0 : u.length) ?? 0) > 1, Me = C === "connecting" || C === "connected", X = C === "connected", ee = C === "idle" || C === "disconnected" || C === "error", [Ie, oe] = L(!1);
|
|
1009
1009
|
N(() => {
|
|
1010
|
-
if (!
|
|
1011
|
-
|
|
1010
|
+
if (!re) {
|
|
1011
|
+
oe(!1);
|
|
1012
1012
|
return;
|
|
1013
1013
|
}
|
|
1014
|
-
if (!
|
|
1015
|
-
|
|
1014
|
+
if (!re.paused && re.readyState >= 2) {
|
|
1015
|
+
oe(!0);
|
|
1016
1016
|
return;
|
|
1017
1017
|
}
|
|
1018
|
-
|
|
1019
|
-
const p = () =>
|
|
1020
|
-
return
|
|
1021
|
-
|
|
1018
|
+
oe(!1);
|
|
1019
|
+
const p = () => oe(!0);
|
|
1020
|
+
return re.addEventListener("playing", p), re.addEventListener("loadeddata", p), () => {
|
|
1021
|
+
re.removeEventListener("playing", p), re.removeEventListener("loadeddata", p);
|
|
1022
1022
|
};
|
|
1023
|
-
}, [
|
|
1024
|
-
const [
|
|
1023
|
+
}, [re]);
|
|
1024
|
+
const [de, xe] = L(!1);
|
|
1025
1025
|
N(() => {
|
|
1026
|
-
if (!
|
|
1027
|
-
|
|
1026
|
+
if (!X) {
|
|
1027
|
+
xe(!1);
|
|
1028
1028
|
return;
|
|
1029
1029
|
}
|
|
1030
|
-
if (
|
|
1031
|
-
const p = setTimeout(() =>
|
|
1030
|
+
if (Ie) return;
|
|
1031
|
+
const p = setTimeout(() => xe(!0), 8e3);
|
|
1032
1032
|
return () => clearTimeout(p);
|
|
1033
|
-
}, [
|
|
1034
|
-
const
|
|
1033
|
+
}, [X, Ie]);
|
|
1034
|
+
const Be = C === "connecting" || X && !!i && !Ie && !de, te = A(null), le = A(null);
|
|
1035
1035
|
N(() => {
|
|
1036
|
-
const p =
|
|
1036
|
+
const p = te.current;
|
|
1037
1037
|
p && (p.innerHTML = "", M && (M.style.width = "100%", M.style.height = "100%", M.style.objectFit = "cover", M.style.transform = "scaleX(-1)", p.appendChild(M)));
|
|
1038
1038
|
}, [M]), N(() => {
|
|
1039
|
-
const p =
|
|
1040
|
-
p && (p.innerHTML = "",
|
|
1041
|
-
}, [
|
|
1042
|
-
const [
|
|
1039
|
+
const p = le.current;
|
|
1040
|
+
p && (p.innerHTML = "", ie && (ie.style.width = "100%", ie.style.height = "100%", ie.style.objectFit = "contain", p.appendChild(ie)));
|
|
1041
|
+
}, [ie]);
|
|
1042
|
+
const [ae, fe] = L(!1), [Te, pe] = L(!1);
|
|
1043
1043
|
N(() => {
|
|
1044
|
-
if (!
|
|
1044
|
+
if (!ae && !Te && !x && !b) return;
|
|
1045
1045
|
const p = () => {
|
|
1046
|
-
|
|
1046
|
+
fe(!1), pe(!1), x && E(), b && s();
|
|
1047
1047
|
};
|
|
1048
1048
|
return document.addEventListener("click", p), () => document.removeEventListener("click", p);
|
|
1049
1049
|
}, [
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1050
|
+
ae,
|
|
1051
|
+
Te,
|
|
1052
|
+
x,
|
|
1053
1053
|
b,
|
|
1054
1054
|
E,
|
|
1055
1055
|
s
|
|
1056
1056
|
]);
|
|
1057
|
-
const [
|
|
1057
|
+
const [he, We] = L(""), Fe = k(
|
|
1058
1058
|
(p) => {
|
|
1059
1059
|
p.preventDefault();
|
|
1060
|
-
const Y =
|
|
1061
|
-
Y && (
|
|
1060
|
+
const Y = he.trim();
|
|
1061
|
+
Y && (nt(Y), We(""));
|
|
1062
1062
|
},
|
|
1063
|
-
[
|
|
1064
|
-
),
|
|
1065
|
-
let
|
|
1063
|
+
[he, nt]
|
|
1064
|
+
), Ue = c.productName || "Live Layer";
|
|
1065
|
+
let me = null, ge = null;
|
|
1066
1066
|
for (let p = w.length - 1; p >= 0; p--) {
|
|
1067
1067
|
const Y = w[p];
|
|
1068
|
-
if (!
|
|
1068
|
+
if (!me && Y.role === "agent" ? me = Y : !ge && Y.role === "user" && (ge = Y), me && ge) break;
|
|
1069
1069
|
}
|
|
1070
|
-
const
|
|
1070
|
+
const Pe = X ? (me == null ? void 0 : me.text) || null : l || null, rt = X && (ge == null ? void 0 : ge.text) || null, je = [
|
|
1071
1071
|
"ll-expanded",
|
|
1072
1072
|
t ? "ll-expanded--mobile" : "ll-expanded--desktop"
|
|
1073
1073
|
].join(" ");
|
|
1074
1074
|
return /* @__PURE__ */ _(
|
|
1075
1075
|
"div",
|
|
1076
1076
|
{
|
|
1077
|
-
className:
|
|
1077
|
+
className: je,
|
|
1078
1078
|
"data-position": e,
|
|
1079
|
-
"data-state":
|
|
1079
|
+
"data-state": X ? "connected" : Me ? "connecting" : "idle",
|
|
1080
1080
|
role: "dialog",
|
|
1081
1081
|
"aria-label": `${r} widget`,
|
|
1082
1082
|
children: [
|
|
1083
1083
|
/* @__PURE__ */ _("div", { className: "ll-expanded__bg", children: [
|
|
1084
1084
|
i ? /* @__PURE__ */ n(
|
|
1085
|
-
|
|
1085
|
+
er,
|
|
1086
1086
|
{
|
|
1087
1087
|
src: i,
|
|
1088
1088
|
alt: r,
|
|
1089
1089
|
className: "ll-expanded__bg-img"
|
|
1090
1090
|
}
|
|
1091
|
-
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((
|
|
1092
|
-
o && !
|
|
1091
|
+
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((De = r == null ? void 0 : r.charAt(0)) == null ? void 0 : De.toUpperCase()) || "A" }) }),
|
|
1092
|
+
o && !X && /* @__PURE__ */ n(
|
|
1093
1093
|
"video",
|
|
1094
1094
|
{
|
|
1095
1095
|
className: "ll-expanded__bg-idle",
|
|
@@ -1101,24 +1101,24 @@ const Jn = ({
|
|
|
1101
1101
|
}
|
|
1102
1102
|
)
|
|
1103
1103
|
] }),
|
|
1104
|
-
/* @__PURE__ */ n("div", { ref:
|
|
1105
|
-
|
|
1104
|
+
/* @__PURE__ */ n("div", { ref: tt, className: "ll-expanded__video" }),
|
|
1105
|
+
Be && /* @__PURE__ */ _("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
|
|
1106
1106
|
/* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
|
|
1107
1107
|
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: y ? "Switching..." : "Connecting..." })
|
|
1108
1108
|
] }),
|
|
1109
|
-
I &&
|
|
1109
|
+
I && X && /* @__PURE__ */ _(
|
|
1110
1110
|
"button",
|
|
1111
1111
|
{
|
|
1112
1112
|
type: "button",
|
|
1113
1113
|
className: "ll-expanded__overlay ll-expanded__overlay--gesture",
|
|
1114
|
-
onClick:
|
|
1114
|
+
onClick: Ee,
|
|
1115
1115
|
children: [
|
|
1116
1116
|
/* @__PURE__ */ n("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("path", { d: "M3 9v6h4l5 5V4L7 9H3zm13.54.12a5 5 0 0 1 0 5.76l-1.41-1.41a3 3 0 0 0 0-2.94L16.54 9.12z" }) }),
|
|
1117
1117
|
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
|
|
1118
1118
|
]
|
|
1119
1119
|
}
|
|
1120
1120
|
),
|
|
1121
|
-
|
|
1121
|
+
Me ? /* @__PURE__ */ _("div", { className: "ll-expanded__topbar", children: [
|
|
1122
1122
|
/* @__PURE__ */ _("div", { className: "ll-expanded__topbar-left", children: [
|
|
1123
1123
|
/* @__PURE__ */ _("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1124
1124
|
/* @__PURE__ */ _(
|
|
@@ -1127,23 +1127,23 @@ const Jn = ({
|
|
|
1127
1127
|
type: "button",
|
|
1128
1128
|
className: "ll-hpill",
|
|
1129
1129
|
onClick: (p) => {
|
|
1130
|
-
|
|
1130
|
+
_e && (p.stopPropagation(), s());
|
|
1131
1131
|
},
|
|
1132
|
-
"aria-haspopup":
|
|
1133
|
-
"aria-expanded":
|
|
1132
|
+
"aria-haspopup": _e ? "listbox" : void 0,
|
|
1133
|
+
"aria-expanded": _e ? b : void 0,
|
|
1134
1134
|
children: [
|
|
1135
1135
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
|
|
1136
|
-
|
|
1136
|
+
_e && /* @__PURE__ */ n(lt, {})
|
|
1137
1137
|
]
|
|
1138
1138
|
}
|
|
1139
1139
|
),
|
|
1140
|
-
|
|
1140
|
+
_e && b && /* @__PURE__ */ n(
|
|
1141
1141
|
"div",
|
|
1142
1142
|
{
|
|
1143
1143
|
className: "ll-hmenu",
|
|
1144
1144
|
onClick: (p) => p.stopPropagation(),
|
|
1145
1145
|
role: "listbox",
|
|
1146
|
-
children:
|
|
1146
|
+
children: u == null ? void 0 : u.map((p) => /* @__PURE__ */ _(
|
|
1147
1147
|
"button",
|
|
1148
1148
|
{
|
|
1149
1149
|
type: "button",
|
|
@@ -1179,16 +1179,16 @@ const Jn = ({
|
|
|
1179
1179
|
p.stopPropagation(), E();
|
|
1180
1180
|
},
|
|
1181
1181
|
"aria-haspopup": "listbox",
|
|
1182
|
-
"aria-expanded":
|
|
1182
|
+
"aria-expanded": x,
|
|
1183
1183
|
"aria-label": "Language: English",
|
|
1184
1184
|
title: "Language: English",
|
|
1185
1185
|
children: [
|
|
1186
1186
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: "EN" }),
|
|
1187
|
-
/* @__PURE__ */ n(
|
|
1187
|
+
/* @__PURE__ */ n(lt, {})
|
|
1188
1188
|
]
|
|
1189
1189
|
}
|
|
1190
1190
|
),
|
|
1191
|
-
|
|
1191
|
+
x && /* @__PURE__ */ n(
|
|
1192
1192
|
"div",
|
|
1193
1193
|
{
|
|
1194
1194
|
className: "ll-hmenu",
|
|
@@ -1221,10 +1221,10 @@ const Jn = ({
|
|
|
1221
1221
|
{
|
|
1222
1222
|
type: "button",
|
|
1223
1223
|
className: "ll-hbtn",
|
|
1224
|
-
onClick:
|
|
1224
|
+
onClick: ue,
|
|
1225
1225
|
"aria-label": "Minimize widget",
|
|
1226
1226
|
title: "Minimize",
|
|
1227
|
-
children: /* @__PURE__ */ n(
|
|
1227
|
+
children: /* @__PURE__ */ n(Yt, {})
|
|
1228
1228
|
}
|
|
1229
1229
|
),
|
|
1230
1230
|
/* @__PURE__ */ n(
|
|
@@ -1232,26 +1232,26 @@ const Jn = ({
|
|
|
1232
1232
|
{
|
|
1233
1233
|
type: "button",
|
|
1234
1234
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1235
|
-
onClick:
|
|
1235
|
+
onClick: Re,
|
|
1236
1236
|
"aria-label": "End call",
|
|
1237
1237
|
title: "End call",
|
|
1238
|
-
children: /* @__PURE__ */ n(
|
|
1238
|
+
children: /* @__PURE__ */ n(Vt, {})
|
|
1239
1239
|
}
|
|
1240
1240
|
)
|
|
1241
1241
|
] })
|
|
1242
1242
|
] }) : (
|
|
1243
1243
|
// Idle-state header with Live Layer product name + minimize/close
|
|
1244
1244
|
/* @__PURE__ */ _("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
|
|
1245
|
-
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children:
|
|
1245
|
+
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Ue }),
|
|
1246
1246
|
/* @__PURE__ */ _("div", { className: "ll-expanded__header-actions", children: [
|
|
1247
1247
|
/* @__PURE__ */ n(
|
|
1248
1248
|
"button",
|
|
1249
1249
|
{
|
|
1250
1250
|
type: "button",
|
|
1251
1251
|
className: "ll-hbtn ll-hbtn--ghost",
|
|
1252
|
-
onClick:
|
|
1252
|
+
onClick: ue,
|
|
1253
1253
|
"aria-label": "Minimize widget",
|
|
1254
|
-
children: /* @__PURE__ */ n(
|
|
1254
|
+
children: /* @__PURE__ */ n(Yt, {})
|
|
1255
1255
|
}
|
|
1256
1256
|
),
|
|
1257
1257
|
/* @__PURE__ */ n(
|
|
@@ -1259,23 +1259,23 @@ const Jn = ({
|
|
|
1259
1259
|
{
|
|
1260
1260
|
type: "button",
|
|
1261
1261
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1262
|
-
onClick:
|
|
1262
|
+
onClick: Re,
|
|
1263
1263
|
"aria-label": "Close widget",
|
|
1264
|
-
children: /* @__PURE__ */ n(
|
|
1264
|
+
children: /* @__PURE__ */ n(Vt, {})
|
|
1265
1265
|
}
|
|
1266
1266
|
)
|
|
1267
1267
|
] })
|
|
1268
1268
|
] })
|
|
1269
1269
|
),
|
|
1270
|
-
|
|
1271
|
-
const p =
|
|
1272
|
-
return /* @__PURE__ */ _(
|
|
1273
|
-
C === "idle" && !
|
|
1270
|
+
ee && /* @__PURE__ */ (() => {
|
|
1271
|
+
const p = O ? "Restart paused session" : C === "disconnected" ? "Reconnect to agent" : "Start video call", Y = O ? "Pick up where you left off" : null;
|
|
1272
|
+
return /* @__PURE__ */ _(wt, { children: [
|
|
1273
|
+
C === "idle" && !O && !q && /* @__PURE__ */ _(
|
|
1274
1274
|
"button",
|
|
1275
1275
|
{
|
|
1276
1276
|
type: "button",
|
|
1277
1277
|
className: "ll-expanded__play",
|
|
1278
|
-
onClick:
|
|
1278
|
+
onClick: we,
|
|
1279
1279
|
"aria-label": p,
|
|
1280
1280
|
children: [
|
|
1281
1281
|
/* @__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" }) }) }),
|
|
@@ -1291,7 +1291,7 @@ const Jn = ({
|
|
|
1291
1291
|
{
|
|
1292
1292
|
type: "button",
|
|
1293
1293
|
className: "ll-expanded__cta",
|
|
1294
|
-
onClick:
|
|
1294
|
+
onClick: we,
|
|
1295
1295
|
"aria-label": p,
|
|
1296
1296
|
children: p
|
|
1297
1297
|
}
|
|
@@ -1302,88 +1302,88 @@ const Jn = ({
|
|
|
1302
1302
|
/* @__PURE__ */ _(
|
|
1303
1303
|
"div",
|
|
1304
1304
|
{
|
|
1305
|
-
className: `ll-expanded__pip ${
|
|
1305
|
+
className: `ll-expanded__pip ${Me && (z || G) ? "is-visible" : ""}`,
|
|
1306
1306
|
children: [
|
|
1307
1307
|
/* @__PURE__ */ n(
|
|
1308
1308
|
"div",
|
|
1309
1309
|
{
|
|
1310
|
-
ref:
|
|
1311
|
-
className:
|
|
1310
|
+
ref: le,
|
|
1311
|
+
className: G ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1312
1312
|
}
|
|
1313
1313
|
),
|
|
1314
1314
|
/* @__PURE__ */ n(
|
|
1315
1315
|
"div",
|
|
1316
1316
|
{
|
|
1317
|
-
ref:
|
|
1318
|
-
className: !
|
|
1317
|
+
ref: te,
|
|
1318
|
+
className: !G && z ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1319
1319
|
}
|
|
1320
1320
|
)
|
|
1321
1321
|
]
|
|
1322
1322
|
}
|
|
1323
1323
|
),
|
|
1324
|
-
|
|
1325
|
-
|
|
1324
|
+
Me ? /* @__PURE__ */ _("div", { className: "ll-expanded__bottom", children: [
|
|
1325
|
+
Pe && /* @__PURE__ */ n(
|
|
1326
1326
|
"div",
|
|
1327
1327
|
{
|
|
1328
1328
|
className: "ll-expanded__transcript ll-expanded__transcript--agent",
|
|
1329
1329
|
"data-role": "agent",
|
|
1330
|
-
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children:
|
|
1330
|
+
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Pe })
|
|
1331
1331
|
}
|
|
1332
1332
|
),
|
|
1333
|
-
|
|
1333
|
+
rt && /* @__PURE__ */ n(
|
|
1334
1334
|
"div",
|
|
1335
1335
|
{
|
|
1336
1336
|
className: "ll-expanded__transcript ll-expanded__transcript--user",
|
|
1337
1337
|
"data-role": "user",
|
|
1338
|
-
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children:
|
|
1338
|
+
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: rt })
|
|
1339
1339
|
}
|
|
1340
1340
|
),
|
|
1341
1341
|
/* @__PURE__ */ _("div", { className: "ll-toolbar", onClick: (p) => p.stopPropagation(), children: [
|
|
1342
|
-
|
|
1342
|
+
Ze && /* @__PURE__ */ n(
|
|
1343
1343
|
"button",
|
|
1344
1344
|
{
|
|
1345
1345
|
type: "button",
|
|
1346
|
-
className: `ll-tool ${
|
|
1347
|
-
onClick:
|
|
1348
|
-
"aria-label":
|
|
1349
|
-
title:
|
|
1350
|
-
children: /* @__PURE__ */ n(
|
|
1346
|
+
className: `ll-tool ${G ? "is-on" : ""}`,
|
|
1347
|
+
onClick: ut,
|
|
1348
|
+
"aria-label": G ? "Stop sharing screen" : "Share screen",
|
|
1349
|
+
title: G ? "Stop sharing" : "Share screen",
|
|
1350
|
+
children: /* @__PURE__ */ n(nr, {})
|
|
1351
1351
|
}
|
|
1352
1352
|
),
|
|
1353
|
-
|
|
1353
|
+
Qe && /* @__PURE__ */ _("div", { className: "ll-tool-split", children: [
|
|
1354
1354
|
/* @__PURE__ */ n(
|
|
1355
1355
|
"button",
|
|
1356
1356
|
{
|
|
1357
1357
|
type: "button",
|
|
1358
|
-
className: `ll-tool ll-tool--left ${
|
|
1359
|
-
onClick:
|
|
1360
|
-
"aria-label":
|
|
1361
|
-
title:
|
|
1362
|
-
children: /* @__PURE__ */ n(
|
|
1358
|
+
className: `ll-tool ll-tool--left ${z ? "is-on" : ""}`,
|
|
1359
|
+
onClick: Ae,
|
|
1360
|
+
"aria-label": z ? "Turn off camera" : "Turn on camera",
|
|
1361
|
+
title: z ? "Stop camera" : "Start camera",
|
|
1362
|
+
children: /* @__PURE__ */ n(rr, {})
|
|
1363
1363
|
}
|
|
1364
1364
|
),
|
|
1365
1365
|
/* @__PURE__ */ n(
|
|
1366
1366
|
"button",
|
|
1367
1367
|
{
|
|
1368
1368
|
type: "button",
|
|
1369
|
-
className: `ll-tool ll-tool--right ${
|
|
1369
|
+
className: `ll-tool ll-tool--right ${z ? "is-on" : ""}`,
|
|
1370
1370
|
onClick: (p) => {
|
|
1371
|
-
p.stopPropagation(),
|
|
1371
|
+
p.stopPropagation(), pe((Y) => !Y), fe(!1);
|
|
1372
1372
|
},
|
|
1373
1373
|
"aria-label": "Camera devices",
|
|
1374
1374
|
"aria-haspopup": "listbox",
|
|
1375
|
-
"aria-expanded":
|
|
1376
|
-
children: /* @__PURE__ */ n(
|
|
1375
|
+
"aria-expanded": Te,
|
|
1376
|
+
children: /* @__PURE__ */ n(lt, {})
|
|
1377
1377
|
}
|
|
1378
1378
|
),
|
|
1379
|
-
|
|
1380
|
-
|
|
1379
|
+
Te && B.length > 0 && /* @__PURE__ */ n(
|
|
1380
|
+
Jt,
|
|
1381
1381
|
{
|
|
1382
1382
|
label: "Camera",
|
|
1383
|
-
devices:
|
|
1384
|
-
activeId:
|
|
1383
|
+
devices: B,
|
|
1384
|
+
activeId: F,
|
|
1385
1385
|
onPick: (p) => {
|
|
1386
|
-
|
|
1386
|
+
pe(!1), V(p);
|
|
1387
1387
|
}
|
|
1388
1388
|
}
|
|
1389
1389
|
)
|
|
@@ -1391,18 +1391,18 @@ const Jn = ({
|
|
|
1391
1391
|
/* @__PURE__ */ _(
|
|
1392
1392
|
"div",
|
|
1393
1393
|
{
|
|
1394
|
-
className: `ll-tool-split${!
|
|
1394
|
+
className: `ll-tool-split${!ce && X ? " ll-tool-split--gated" : ""}`,
|
|
1395
1395
|
children: [
|
|
1396
1396
|
/* @__PURE__ */ n(
|
|
1397
1397
|
"button",
|
|
1398
1398
|
{
|
|
1399
1399
|
type: "button",
|
|
1400
1400
|
className: `ll-tool ll-tool--left ${m ? "is-muted" : ""}`,
|
|
1401
|
-
onClick:
|
|
1402
|
-
disabled: !
|
|
1403
|
-
"aria-label": !
|
|
1404
|
-
title: !
|
|
1405
|
-
children: /* @__PURE__ */ n(
|
|
1401
|
+
onClick: Ne,
|
|
1402
|
+
disabled: !ce && X,
|
|
1403
|
+
"aria-label": !ce && X ? "Microphone enables once the agent finishes its greeting" : m ? "Unmute microphone" : "Mute microphone",
|
|
1404
|
+
title: !ce && X ? "Mic enables after greeting" : m ? "Unmute" : "Mute",
|
|
1405
|
+
children: /* @__PURE__ */ n(ir, { muted: m })
|
|
1406
1406
|
}
|
|
1407
1407
|
),
|
|
1408
1408
|
/* @__PURE__ */ n(
|
|
@@ -1411,21 +1411,21 @@ const Jn = ({
|
|
|
1411
1411
|
type: "button",
|
|
1412
1412
|
className: `ll-tool ll-tool--right ${m ? "is-muted" : ""}`,
|
|
1413
1413
|
onClick: (p) => {
|
|
1414
|
-
p.stopPropagation(),
|
|
1414
|
+
p.stopPropagation(), fe((Y) => !Y), pe(!1);
|
|
1415
1415
|
},
|
|
1416
1416
|
"aria-label": "Microphone devices",
|
|
1417
1417
|
"aria-haspopup": "listbox",
|
|
1418
|
-
"aria-expanded":
|
|
1419
|
-
children: /* @__PURE__ */ n(
|
|
1418
|
+
"aria-expanded": ae,
|
|
1419
|
+
children: /* @__PURE__ */ n(lt, {})
|
|
1420
1420
|
}
|
|
1421
1421
|
),
|
|
1422
|
-
|
|
1423
|
-
|
|
1422
|
+
ae && W.length > 0 && /* @__PURE__ */ n(
|
|
1423
|
+
Jt,
|
|
1424
1424
|
{
|
|
1425
1425
|
label: "Microphone",
|
|
1426
|
-
devices:
|
|
1426
|
+
devices: W,
|
|
1427
1427
|
activeId: "",
|
|
1428
|
-
onPick: () =>
|
|
1428
|
+
onPick: () => fe(!1)
|
|
1429
1429
|
}
|
|
1430
1430
|
)
|
|
1431
1431
|
]
|
|
@@ -1435,11 +1435,11 @@ const Jn = ({
|
|
|
1435
1435
|
"button",
|
|
1436
1436
|
{
|
|
1437
1437
|
type: "button",
|
|
1438
|
-
className: `ll-tool ${
|
|
1439
|
-
onClick:
|
|
1440
|
-
"aria-label":
|
|
1441
|
-
title:
|
|
1442
|
-
children: /* @__PURE__ */ n(
|
|
1438
|
+
className: `ll-tool ${be ? "is-muted" : ""}`,
|
|
1439
|
+
onClick: ft,
|
|
1440
|
+
"aria-label": be ? "Unmute speaker" : "Mute speaker",
|
|
1441
|
+
title: be ? "Unmute speaker" : "Mute speaker",
|
|
1442
|
+
children: /* @__PURE__ */ n(or, { muted: be })
|
|
1443
1443
|
}
|
|
1444
1444
|
),
|
|
1445
1445
|
/* @__PURE__ */ n(
|
|
@@ -1447,32 +1447,32 @@ const Jn = ({
|
|
|
1447
1447
|
{
|
|
1448
1448
|
type: "button",
|
|
1449
1449
|
className: "ll-tool ll-tool--danger",
|
|
1450
|
-
onClick:
|
|
1450
|
+
onClick: Se,
|
|
1451
1451
|
"aria-label": "End conversation",
|
|
1452
1452
|
title: "End conversation",
|
|
1453
|
-
children: /* @__PURE__ */ n(
|
|
1453
|
+
children: /* @__PURE__ */ n(ar, {})
|
|
1454
1454
|
}
|
|
1455
1455
|
)
|
|
1456
1456
|
] }),
|
|
1457
|
-
|
|
1457
|
+
et && /* @__PURE__ */ _("form", { className: "ll-message-input", onSubmit: Fe, children: [
|
|
1458
1458
|
/* @__PURE__ */ n(
|
|
1459
1459
|
"input",
|
|
1460
1460
|
{
|
|
1461
1461
|
type: "text",
|
|
1462
1462
|
className: "ll-message-input__field",
|
|
1463
1463
|
placeholder: "Message...",
|
|
1464
|
-
value:
|
|
1465
|
-
onChange: (p) =>
|
|
1464
|
+
value: he,
|
|
1465
|
+
onChange: (p) => We(p.target.value),
|
|
1466
1466
|
"aria-label": "Message the agent"
|
|
1467
1467
|
}
|
|
1468
1468
|
),
|
|
1469
|
-
|
|
1469
|
+
he.trim() && /* @__PURE__ */ n(
|
|
1470
1470
|
"button",
|
|
1471
1471
|
{
|
|
1472
1472
|
type: "submit",
|
|
1473
1473
|
className: "ll-message-input__send",
|
|
1474
1474
|
"aria-label": "Send message",
|
|
1475
|
-
children: /* @__PURE__ */ n(
|
|
1475
|
+
children: /* @__PURE__ */ n(lr, {})
|
|
1476
1476
|
}
|
|
1477
1477
|
)
|
|
1478
1478
|
] })
|
|
@@ -1486,22 +1486,22 @@ const Jn = ({
|
|
|
1486
1486
|
{
|
|
1487
1487
|
type: "button",
|
|
1488
1488
|
className: "ll-expanded__banner-x",
|
|
1489
|
-
onClick:
|
|
1489
|
+
onClick: qe,
|
|
1490
1490
|
"aria-label": "Dismiss",
|
|
1491
1491
|
children: "×"
|
|
1492
1492
|
}
|
|
1493
1493
|
)
|
|
1494
1494
|
] });
|
|
1495
|
-
if (!
|
|
1495
|
+
if (!q || C !== "error") return null;
|
|
1496
1496
|
let p = "Failed to connect", Y = "Try again";
|
|
1497
|
-
return
|
|
1497
|
+
return q === "MIC_PERMISSION_DENIED" ? p = "Microphone blocked. Allow access to talk." : q === "MIC_NOT_FOUND" ? p = "No microphone found. Plug one in + retry." : q === "MIC_UNAVAILABLE" ? p = "Mic unavailable. Check other apps using it." : q === "AGENT_TIMEOUT" ? p = "Agent didn't pick up. Try again." : q === "CONNECT_FAILED" ? p = "Connection failed. Check your network." : q.length < 80 && (p = q), /* @__PURE__ */ _("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
|
|
1498
1498
|
/* @__PURE__ */ n("span", { children: p }),
|
|
1499
1499
|
/* @__PURE__ */ n(
|
|
1500
1500
|
"button",
|
|
1501
1501
|
{
|
|
1502
1502
|
type: "button",
|
|
1503
1503
|
className: "ll-expanded__banner-retry",
|
|
1504
|
-
onClick:
|
|
1504
|
+
onClick: Ce,
|
|
1505
1505
|
children: Y
|
|
1506
1506
|
}
|
|
1507
1507
|
)
|
|
@@ -1511,32 +1511,32 @@ const Jn = ({
|
|
|
1511
1511
|
}
|
|
1512
1512
|
);
|
|
1513
1513
|
};
|
|
1514
|
-
function
|
|
1514
|
+
function lt() {
|
|
1515
1515
|
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" }) });
|
|
1516
1516
|
}
|
|
1517
|
-
function
|
|
1517
|
+
function Vt() {
|
|
1518
1518
|
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: [
|
|
1519
1519
|
/* @__PURE__ */ n("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1520
1520
|
/* @__PURE__ */ n("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1521
1521
|
] });
|
|
1522
1522
|
}
|
|
1523
|
-
function
|
|
1523
|
+
function Yt() {
|
|
1524
1524
|
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" }) });
|
|
1525
1525
|
}
|
|
1526
|
-
function
|
|
1526
|
+
function nr() {
|
|
1527
1527
|
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: [
|
|
1528
1528
|
/* @__PURE__ */ n("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
|
|
1529
1529
|
/* @__PURE__ */ n("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
|
|
1530
1530
|
/* @__PURE__ */ n("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
|
|
1531
1531
|
] });
|
|
1532
1532
|
}
|
|
1533
|
-
function
|
|
1533
|
+
function rr() {
|
|
1534
1534
|
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: [
|
|
1535
1535
|
/* @__PURE__ */ n("path", { d: "M23 7l-7 5 7 5V7z" }),
|
|
1536
1536
|
/* @__PURE__ */ n("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
|
|
1537
1537
|
] });
|
|
1538
1538
|
}
|
|
1539
|
-
function
|
|
1539
|
+
function ir({ muted: e }) {
|
|
1540
1540
|
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: [
|
|
1541
1541
|
/* @__PURE__ */ n("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
|
|
1542
1542
|
/* @__PURE__ */ n("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
|
|
@@ -1544,22 +1544,22 @@ function nr({ muted: e }) {
|
|
|
1544
1544
|
e && /* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
1545
1545
|
] });
|
|
1546
1546
|
}
|
|
1547
|
-
function
|
|
1547
|
+
function or({ muted: e }) {
|
|
1548
1548
|
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: [
|
|
1549
1549
|
/* @__PURE__ */ n("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
1550
|
-
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ _(
|
|
1550
|
+
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ _(wt, { children: [
|
|
1551
1551
|
/* @__PURE__ */ n("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
|
|
1552
1552
|
/* @__PURE__ */ n("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
|
|
1553
1553
|
] })
|
|
1554
1554
|
] });
|
|
1555
1555
|
}
|
|
1556
|
-
function
|
|
1556
|
+
function lr() {
|
|
1557
1557
|
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: [
|
|
1558
1558
|
/* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
|
|
1559
1559
|
/* @__PURE__ */ n("polyline", { points: "12 5 19 12 12 19" })
|
|
1560
1560
|
] });
|
|
1561
1561
|
}
|
|
1562
|
-
function
|
|
1562
|
+
function ar() {
|
|
1563
1563
|
return /* @__PURE__ */ n("svg", { width: "16", height: "16", viewBox: "-4 -4 32 32", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: /* @__PURE__ */ n(
|
|
1564
1564
|
"path",
|
|
1565
1565
|
{
|
|
@@ -1568,7 +1568,7 @@ function or() {
|
|
|
1568
1568
|
}
|
|
1569
1569
|
) });
|
|
1570
1570
|
}
|
|
1571
|
-
const
|
|
1571
|
+
const Jt = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */ _(
|
|
1572
1572
|
"div",
|
|
1573
1573
|
{
|
|
1574
1574
|
className: "ll-device-menu",
|
|
@@ -1596,21 +1596,21 @@ const jt = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */
|
|
|
1596
1596
|
})
|
|
1597
1597
|
]
|
|
1598
1598
|
}
|
|
1599
|
-
),
|
|
1599
|
+
), sr = [
|
|
1600
1600
|
'[data-ll-private="true"]',
|
|
1601
1601
|
".ll-widget"
|
|
1602
1602
|
];
|
|
1603
|
-
function
|
|
1603
|
+
function xt(e) {
|
|
1604
1604
|
let t = e;
|
|
1605
1605
|
for (; t; ) {
|
|
1606
|
-
for (const r of
|
|
1606
|
+
for (const r of sr)
|
|
1607
1607
|
if (t.matches(r)) return !0;
|
|
1608
1608
|
t = t.parentElement;
|
|
1609
1609
|
}
|
|
1610
1610
|
return !1;
|
|
1611
1611
|
}
|
|
1612
|
-
function
|
|
1613
|
-
if (
|
|
1612
|
+
function dt(e) {
|
|
1613
|
+
if (xt(e)) return !1;
|
|
1614
1614
|
if (e instanceof HTMLInputElement) {
|
|
1615
1615
|
if (e.type === "password") return !1;
|
|
1616
1616
|
const t = (e.getAttribute("autocomplete") || "").toLowerCase();
|
|
@@ -1618,7 +1618,7 @@ function st(e) {
|
|
|
1618
1618
|
}
|
|
1619
1619
|
return !0;
|
|
1620
1620
|
}
|
|
1621
|
-
const
|
|
1621
|
+
const at = 4096, cr = 20, dr = 20, ur = 10, fr = 10, pr = 30, Kt = 500, hr = [
|
|
1622
1622
|
'[data-ll-private="true"]',
|
|
1623
1623
|
".ll-widget",
|
|
1624
1624
|
"script",
|
|
@@ -1626,24 +1626,24 @@ const ot = 4096, ar = 20, sr = 20, cr = 10, dr = 10, ur = 30, Vt = 500, fr = [
|
|
|
1626
1626
|
"noscript",
|
|
1627
1627
|
"iframe"
|
|
1628
1628
|
];
|
|
1629
|
-
function
|
|
1629
|
+
function Xe(e) {
|
|
1630
1630
|
if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
|
|
1631
1631
|
let t = e;
|
|
1632
1632
|
for (; t; ) {
|
|
1633
|
-
for (const r of
|
|
1633
|
+
for (const r of hr)
|
|
1634
1634
|
if (t.matches(r)) return !0;
|
|
1635
1635
|
t = t.parentElement;
|
|
1636
1636
|
}
|
|
1637
1637
|
return !1;
|
|
1638
1638
|
}
|
|
1639
|
-
function
|
|
1639
|
+
function Ge(e) {
|
|
1640
1640
|
if (typeof window > "u") return !0;
|
|
1641
1641
|
const t = e.getBoundingClientRect();
|
|
1642
1642
|
if (t.width <= 0 || t.height <= 0) return !1;
|
|
1643
1643
|
const r = window.innerHeight || document.documentElement.clientHeight, i = window.innerWidth || document.documentElement.clientWidth;
|
|
1644
1644
|
return t.bottom > 0 && t.right > 0 && t.top < r && t.left < i;
|
|
1645
1645
|
}
|
|
1646
|
-
function
|
|
1646
|
+
function Xt(e) {
|
|
1647
1647
|
const t = e.getAttribute("id");
|
|
1648
1648
|
if (t) {
|
|
1649
1649
|
const l = document.querySelector(`label[for="${CSS.escape(t)}"]`);
|
|
@@ -1656,13 +1656,13 @@ function Yt(e) {
|
|
|
1656
1656
|
const o = e.closest("label");
|
|
1657
1657
|
return o != null && o.textContent ? o.textContent.trim() : "";
|
|
1658
1658
|
}
|
|
1659
|
-
function
|
|
1659
|
+
function Le(e, t) {
|
|
1660
1660
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
1661
1661
|
}
|
|
1662
|
-
function
|
|
1662
|
+
function ze(e) {
|
|
1663
1663
|
return e.length;
|
|
1664
1664
|
}
|
|
1665
|
-
function
|
|
1665
|
+
function mr(e, t = {}) {
|
|
1666
1666
|
const r = t.doc ?? (typeof document < "u" ? document : null);
|
|
1667
1667
|
if (!r)
|
|
1668
1668
|
return {
|
|
@@ -1678,37 +1678,37 @@ function pr(e, t = {}) {
|
|
|
1678
1678
|
};
|
|
1679
1679
|
const i = typeof window < "u" && window.location.href || "", o = typeof window < "u" && window.location.pathname || "/", l = r.title || "", c = Array.from(
|
|
1680
1680
|
r.querySelectorAll("[data-ll-region]")
|
|
1681
|
-
),
|
|
1681
|
+
), u = [];
|
|
1682
1682
|
for (const m of c) {
|
|
1683
|
-
if (
|
|
1684
|
-
if (
|
|
1685
|
-
const R = m.getAttribute("data-ll-region") ?? "",
|
|
1683
|
+
if (u.length >= ur) break;
|
|
1684
|
+
if (Xe(m) || !Ge(m)) continue;
|
|
1685
|
+
const R = m.getAttribute("data-ll-region") ?? "", W = m.getAttribute("data-ll-intent") ?? void 0, z = Le(
|
|
1686
1686
|
(m.innerText || m.textContent || "").trim(),
|
|
1687
|
-
|
|
1687
|
+
Kt * 2
|
|
1688
1688
|
);
|
|
1689
|
-
!R || !
|
|
1689
|
+
!R || !z || u.push({ id: R, intent: W, text: z });
|
|
1690
1690
|
}
|
|
1691
1691
|
const f = [], y = ["H1", "H2", "H3", "H4", "H5", "H6"], b = Array.from(
|
|
1692
1692
|
r.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
|
1693
1693
|
);
|
|
1694
1694
|
for (const m of b) {
|
|
1695
|
-
if (
|
|
1695
|
+
if (Xe(m) || !Ge(m)) continue;
|
|
1696
1696
|
const R = (m.textContent || "").trim();
|
|
1697
|
-
R && f.push(`${m.tagName}: ${
|
|
1697
|
+
R && f.push(`${m.tagName}: ${Le(R, 200)}`);
|
|
1698
1698
|
}
|
|
1699
1699
|
const s = Array.from(r.querySelectorAll("p, li"));
|
|
1700
1700
|
for (const m of s) {
|
|
1701
|
-
if (
|
|
1701
|
+
if (Xe(m) || !Ge(m) || y.includes(m.tagName)) continue;
|
|
1702
1702
|
const R = (m.textContent || "").trim();
|
|
1703
|
-
R.length > 10 && f.push(
|
|
1703
|
+
R.length > 10 && f.push(Le(R, Kt));
|
|
1704
1704
|
}
|
|
1705
1705
|
const a = f.join(`
|
|
1706
|
-
`),
|
|
1706
|
+
`), x = [], E = Array.from(r.querySelectorAll("a[href]"));
|
|
1707
1707
|
for (const m of E) {
|
|
1708
|
-
if (
|
|
1709
|
-
if (
|
|
1710
|
-
const R = m.getAttribute("href") || "",
|
|
1711
|
-
!R || !
|
|
1708
|
+
if (x.length >= cr) break;
|
|
1709
|
+
if (Xe(m) || !Ge(m)) continue;
|
|
1710
|
+
const R = m.getAttribute("href") || "", W = (m.textContent || "").trim();
|
|
1711
|
+
!R || !W || x.push({ href: R, text: Le(W, 100) });
|
|
1712
1712
|
}
|
|
1713
1713
|
const C = [], v = Array.from(
|
|
1714
1714
|
r.querySelectorAll(
|
|
@@ -1716,65 +1716,65 @@ function pr(e, t = {}) {
|
|
|
1716
1716
|
)
|
|
1717
1717
|
);
|
|
1718
1718
|
for (const m of v) {
|
|
1719
|
-
if (C.length >=
|
|
1720
|
-
if (
|
|
1721
|
-
const R =
|
|
1722
|
-
R && C.push({ label:
|
|
1719
|
+
if (C.length >= dr) break;
|
|
1720
|
+
if (Xe(m) || !dt(m) || !Ge(m)) continue;
|
|
1721
|
+
const R = Xt(m), W = m instanceof HTMLInputElement ? m.type : m.tagName.toLowerCase();
|
|
1722
|
+
R && C.push({ label: Le(R, 100), type: W });
|
|
1723
1723
|
}
|
|
1724
1724
|
const w = Array.from(
|
|
1725
1725
|
r.querySelectorAll("[data-ll-form]")
|
|
1726
|
-
),
|
|
1726
|
+
), O = [];
|
|
1727
1727
|
for (const m of w) {
|
|
1728
|
-
if (
|
|
1729
|
-
if (
|
|
1728
|
+
if (O.length >= fr) break;
|
|
1729
|
+
if (xt(m)) continue;
|
|
1730
1730
|
const R = m.getAttribute("data-ll-form") || "";
|
|
1731
1731
|
if (!R) continue;
|
|
1732
|
-
const
|
|
1732
|
+
const W = m.getAttribute("data-ll-intent") || void 0, z = Array.from(
|
|
1733
1733
|
m.querySelectorAll(
|
|
1734
1734
|
"[data-ll-field]"
|
|
1735
1735
|
)
|
|
1736
1736
|
), M = [];
|
|
1737
|
-
for (const
|
|
1738
|
-
if (M.length >=
|
|
1739
|
-
if (!
|
|
1740
|
-
const
|
|
1741
|
-
if (!
|
|
1742
|
-
const
|
|
1743
|
-
M.push({ name:
|
|
1737
|
+
for (const B of z) {
|
|
1738
|
+
if (M.length >= pr) break;
|
|
1739
|
+
if (!dt(B)) continue;
|
|
1740
|
+
const F = B.getAttribute("data-ll-field") || "";
|
|
1741
|
+
if (!F) continue;
|
|
1742
|
+
const G = Xt(B) || F, ie = B instanceof HTMLInputElement ? B.type : B.tagName.toLowerCase();
|
|
1743
|
+
M.push({ name: F, label: Le(G, 100), type: ie });
|
|
1744
1744
|
}
|
|
1745
|
-
|
|
1745
|
+
O.push({ id: R, intent: W, fields: M });
|
|
1746
1746
|
}
|
|
1747
1747
|
const I = {
|
|
1748
1748
|
url: i,
|
|
1749
1749
|
title: l,
|
|
1750
1750
|
pathname: o,
|
|
1751
|
-
regions:
|
|
1751
|
+
regions: u,
|
|
1752
1752
|
visibleText: a,
|
|
1753
|
-
visibleLinks:
|
|
1753
|
+
visibleLinks: x,
|
|
1754
1754
|
visibleFields: C,
|
|
1755
|
-
forms:
|
|
1755
|
+
forms: O,
|
|
1756
1756
|
extras: e
|
|
1757
1757
|
};
|
|
1758
|
-
let
|
|
1759
|
-
for (;
|
|
1760
|
-
I.visibleFields.pop(),
|
|
1761
|
-
for (;
|
|
1762
|
-
I.visibleLinks.pop(),
|
|
1763
|
-
return
|
|
1764
|
-
}
|
|
1765
|
-
let
|
|
1758
|
+
let q = ze(JSON.stringify(I.regions)) + ze(I.visibleText) + ze(JSON.stringify(I.visibleLinks)) + ze(JSON.stringify(I.visibleFields));
|
|
1759
|
+
for (; q > at && I.visibleFields.length > 0; )
|
|
1760
|
+
I.visibleFields.pop(), q = ze(JSON.stringify(I.visibleFields));
|
|
1761
|
+
for (; q > at && I.visibleLinks.length > 0; )
|
|
1762
|
+
I.visibleLinks.pop(), q -= 80;
|
|
1763
|
+
return ze(I.visibleText) > at && (I.visibleText = Le(I.visibleText, at - 100)), I;
|
|
1764
|
+
}
|
|
1765
|
+
let He = null;
|
|
1766
1766
|
function Gt(e, t = {}) {
|
|
1767
1767
|
const r = Date.now(), o = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
|
|
1768
|
-
if (
|
|
1769
|
-
return
|
|
1770
|
-
const l =
|
|
1771
|
-
return
|
|
1768
|
+
if (He && He.key === o && r - He.at < 1e3)
|
|
1769
|
+
return He.ctx;
|
|
1770
|
+
const l = mr(e, t);
|
|
1771
|
+
return He = { key: o, at: r, ctx: l }, l;
|
|
1772
1772
|
}
|
|
1773
|
-
function
|
|
1774
|
-
|
|
1773
|
+
function gr() {
|
|
1774
|
+
He = null;
|
|
1775
1775
|
}
|
|
1776
|
-
const
|
|
1777
|
-
function
|
|
1776
|
+
const yr = 200;
|
|
1777
|
+
function vr(e) {
|
|
1778
1778
|
const t = String(e.href || "");
|
|
1779
1779
|
return {
|
|
1780
1780
|
href: t,
|
|
@@ -1784,23 +1784,23 @@ function gr(e) {
|
|
|
1784
1784
|
description: e.description
|
|
1785
1785
|
};
|
|
1786
1786
|
}
|
|
1787
|
-
function
|
|
1787
|
+
function br(e) {
|
|
1788
1788
|
return !(!e || e.startsWith("#") || e.startsWith("javascript:") || e.startsWith("mailto:") || e.startsWith("tel:"));
|
|
1789
1789
|
}
|
|
1790
|
-
function
|
|
1790
|
+
function wr(e) {
|
|
1791
1791
|
const t = e ?? (typeof document < "u" ? document : null);
|
|
1792
1792
|
if (!t) return [];
|
|
1793
1793
|
const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), o = [], l = Array.from(t.querySelectorAll("a[href]"));
|
|
1794
1794
|
for (const c of l) {
|
|
1795
|
-
if (o.length >=
|
|
1796
|
-
if (
|
|
1797
|
-
const
|
|
1798
|
-
if (!
|
|
1799
|
-
let f =
|
|
1795
|
+
if (o.length >= yr) break;
|
|
1796
|
+
if (xt(c)) continue;
|
|
1797
|
+
const u = c.getAttribute("href") || "";
|
|
1798
|
+
if (!br(u)) continue;
|
|
1799
|
+
let f = u, y = !0;
|
|
1800
1800
|
try {
|
|
1801
1801
|
if (typeof window < "u") {
|
|
1802
|
-
const s = new URL(
|
|
1803
|
-
y = s.origin === r, y &&
|
|
1802
|
+
const s = new URL(u, r);
|
|
1803
|
+
y = s.origin === r, y && u.startsWith("http") && (f = s.pathname + s.search + s.hash);
|
|
1804
1804
|
}
|
|
1805
1805
|
} catch {
|
|
1806
1806
|
continue;
|
|
@@ -1812,35 +1812,35 @@ function vr(e) {
|
|
|
1812
1812
|
}
|
|
1813
1813
|
return o;
|
|
1814
1814
|
}
|
|
1815
|
-
let
|
|
1816
|
-
const
|
|
1817
|
-
function
|
|
1815
|
+
let Oe = null;
|
|
1816
|
+
const _r = 5e3;
|
|
1817
|
+
function vt() {
|
|
1818
1818
|
const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
|
|
1819
|
-
if (
|
|
1820
|
-
return
|
|
1821
|
-
const r =
|
|
1822
|
-
return
|
|
1819
|
+
if (Oe && Oe.pathname === t && e - Oe.at < _r)
|
|
1820
|
+
return Oe.routes;
|
|
1821
|
+
const r = wr();
|
|
1822
|
+
return Oe = { at: e, pathname: t, routes: r }, r;
|
|
1823
1823
|
}
|
|
1824
|
-
function
|
|
1825
|
-
|
|
1824
|
+
function xr() {
|
|
1825
|
+
Oe = null;
|
|
1826
1826
|
}
|
|
1827
|
-
function
|
|
1827
|
+
function kr(e, t) {
|
|
1828
1828
|
const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, i = Object.getOwnPropertyDescriptor(r, "value"), o = i == null ? void 0 : i.set;
|
|
1829
1829
|
o ? o.call(e, t) : e.value = t;
|
|
1830
1830
|
}
|
|
1831
|
-
function
|
|
1831
|
+
function Lr(e, t, r = {}) {
|
|
1832
1832
|
const i = r.triggerInput ?? !0, o = r.triggerChange ?? !0;
|
|
1833
1833
|
if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
|
|
1834
1834
|
const l = Object.getOwnPropertyDescriptor(
|
|
1835
1835
|
HTMLInputElement.prototype,
|
|
1836
1836
|
"checked"
|
|
1837
|
-
), c = l == null ? void 0 : l.set,
|
|
1838
|
-
c ? c.call(e,
|
|
1837
|
+
), c = l == null ? void 0 : l.set, u = t === "true" || t === "1" || t === "on";
|
|
1838
|
+
c ? c.call(e, u) : e.checked = u, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
1839
1839
|
return;
|
|
1840
1840
|
}
|
|
1841
|
-
|
|
1841
|
+
kr(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
1842
1842
|
}
|
|
1843
|
-
function
|
|
1843
|
+
function Sr() {
|
|
1844
1844
|
if (typeof window > "u" || typeof document > "u")
|
|
1845
1845
|
return !1;
|
|
1846
1846
|
const e = document.scrollingElement || document.documentElement;
|
|
@@ -1848,19 +1848,19 @@ function kr() {
|
|
|
1848
1848
|
const t = window.getComputedStyle(e);
|
|
1849
1849
|
return !(t.overflowY === "hidden" || t.overflowY === "clip");
|
|
1850
1850
|
}
|
|
1851
|
-
function
|
|
1851
|
+
function Cr(e) {
|
|
1852
1852
|
if (!(e instanceof HTMLElement)) return !1;
|
|
1853
1853
|
const r = window.getComputedStyle(e).overflowY;
|
|
1854
1854
|
return !(r !== "auto" && r !== "scroll" || e.scrollHeight <= e.clientHeight + 2);
|
|
1855
1855
|
}
|
|
1856
|
-
function
|
|
1856
|
+
function Er() {
|
|
1857
1857
|
if (typeof document > "u") return null;
|
|
1858
1858
|
const e = Array.from(
|
|
1859
1859
|
document.querySelectorAll("body, body *")
|
|
1860
1860
|
);
|
|
1861
1861
|
let t = null, r = 0;
|
|
1862
1862
|
for (const i of e) {
|
|
1863
|
-
if (!
|
|
1863
|
+
if (!Cr(i)) continue;
|
|
1864
1864
|
const o = i.getBoundingClientRect();
|
|
1865
1865
|
if (o.bottom <= 0 || o.top >= window.innerHeight || o.right <= 0 || o.left >= window.innerWidth || o.width <= 0 || o.height <= 0 || i.closest(".ll-widget")) continue;
|
|
1866
1866
|
const l = o.width * o.height;
|
|
@@ -1868,24 +1868,24 @@ function Sr() {
|
|
|
1868
1868
|
}
|
|
1869
1869
|
return t;
|
|
1870
1870
|
}
|
|
1871
|
-
function
|
|
1871
|
+
function Nr() {
|
|
1872
1872
|
if (typeof window > "u")
|
|
1873
1873
|
return null;
|
|
1874
|
-
if (
|
|
1875
|
-
const e =
|
|
1874
|
+
if (Sr()) return window;
|
|
1875
|
+
const e = Er();
|
|
1876
1876
|
return e || window;
|
|
1877
1877
|
}
|
|
1878
|
-
function
|
|
1878
|
+
function Qt(e) {
|
|
1879
1879
|
return e instanceof Window ? e.innerHeight || 0 : e.clientHeight || 0;
|
|
1880
1880
|
}
|
|
1881
|
-
function
|
|
1881
|
+
function Ar(e) {
|
|
1882
1882
|
var t, r;
|
|
1883
1883
|
return e instanceof Window ? typeof document > "u" ? 0 : Math.max(
|
|
1884
1884
|
((t = document.body) == null ? void 0 : t.scrollHeight) ?? 0,
|
|
1885
1885
|
((r = document.documentElement) == null ? void 0 : r.scrollHeight) ?? 0
|
|
1886
1886
|
) : e.scrollHeight - e.clientHeight;
|
|
1887
1887
|
}
|
|
1888
|
-
const
|
|
1888
|
+
const Rr = /* @__PURE__ */ new Set([
|
|
1889
1889
|
"agent_state",
|
|
1890
1890
|
"avatar_stream_ready",
|
|
1891
1891
|
"avatar_active",
|
|
@@ -1908,8 +1908,8 @@ const Nr = /* @__PURE__ */ new Set([
|
|
|
1908
1908
|
"submit_form",
|
|
1909
1909
|
"request_routes"
|
|
1910
1910
|
]);
|
|
1911
|
-
function
|
|
1912
|
-
var
|
|
1911
|
+
function Mr(e) {
|
|
1912
|
+
var Nt, At, Rt, Mt, It, Tt, Pt;
|
|
1913
1913
|
const {
|
|
1914
1914
|
agentId: t,
|
|
1915
1915
|
apiKey: r,
|
|
@@ -1917,516 +1917,550 @@ function Ar(e) {
|
|
|
1917
1917
|
sessionEndpoint: o,
|
|
1918
1918
|
sessionBody: l,
|
|
1919
1919
|
autoConnect: c = !1,
|
|
1920
|
-
displayMode:
|
|
1920
|
+
displayMode: u,
|
|
1921
1921
|
defaultDisplayMode: f = "expanded",
|
|
1922
1922
|
onDisplayModeChange: y,
|
|
1923
1923
|
position: b = "bottom-right",
|
|
1924
1924
|
mobileBreakpoint: s = 640,
|
|
1925
1925
|
persistKey: a = "ll-widget",
|
|
1926
|
-
disablePersistence:
|
|
1926
|
+
disablePersistence: x = !1,
|
|
1927
1927
|
teamMembers: E,
|
|
1928
1928
|
currentTeamMemberId: C,
|
|
1929
1929
|
onTeamMemberChange: v,
|
|
1930
1930
|
idleLoopUrl: w,
|
|
1931
|
-
greeting:
|
|
1931
|
+
greeting: O,
|
|
1932
1932
|
avatarImageUrl: I,
|
|
1933
|
-
agentName:
|
|
1933
|
+
agentName: q,
|
|
1934
1934
|
branding: m = {},
|
|
1935
1935
|
allowCamera: R = !0,
|
|
1936
|
-
allowScreenShare:
|
|
1937
|
-
allowTyping:
|
|
1936
|
+
allowScreenShare: W = !0,
|
|
1937
|
+
allowTyping: z = !0,
|
|
1938
1938
|
showOn: M,
|
|
1939
|
-
hideOn:
|
|
1940
|
-
pathname:
|
|
1941
|
-
onNavigate:
|
|
1942
|
-
onScrollToSelector:
|
|
1943
|
-
getPageContext:
|
|
1944
|
-
pageContextExtras:
|
|
1945
|
-
getRoutes:
|
|
1946
|
-
onScrollPage:
|
|
1947
|
-
onClick:
|
|
1948
|
-
capabilities:
|
|
1949
|
-
onConnect:
|
|
1950
|
-
onDisconnect:
|
|
1951
|
-
onTranscript:
|
|
1952
|
-
onAgentState:
|
|
1953
|
-
onConnectionStateChange:
|
|
1954
|
-
onAgentEvent:
|
|
1955
|
-
onAgentCommand:
|
|
1939
|
+
hideOn: B,
|
|
1940
|
+
pathname: F,
|
|
1941
|
+
onNavigate: G,
|
|
1942
|
+
onScrollToSelector: ie,
|
|
1943
|
+
getPageContext: be,
|
|
1944
|
+
pageContextExtras: Qe,
|
|
1945
|
+
getRoutes: Ze,
|
|
1946
|
+
onScrollPage: et,
|
|
1947
|
+
onClick: tt,
|
|
1948
|
+
capabilities: re,
|
|
1949
|
+
onConnect: ce,
|
|
1950
|
+
onDisconnect: we,
|
|
1951
|
+
onTranscript: Se,
|
|
1952
|
+
onAgentState: Ce,
|
|
1953
|
+
onConnectionStateChange: Ee,
|
|
1954
|
+
onAgentEvent: Ne,
|
|
1955
|
+
onAgentCommand: Ae,
|
|
1956
1956
|
controlledSession: V,
|
|
1957
|
-
className:
|
|
1958
|
-
style:
|
|
1959
|
-
zIndex:
|
|
1960
|
-
} = e,
|
|
1957
|
+
className: ut,
|
|
1958
|
+
style: ft,
|
|
1959
|
+
zIndex: nt = 2147483647
|
|
1960
|
+
} = e, ue = Hn(F), Re = jn(ue, M, B);
|
|
1961
1961
|
N(() => {
|
|
1962
|
-
|
|
1963
|
-
}, [
|
|
1964
|
-
const
|
|
1962
|
+
gr(), xr();
|
|
1963
|
+
}, [ue]);
|
|
1964
|
+
const qe = C !== void 0, [_e, Me] = L(() => {
|
|
1965
1965
|
var h;
|
|
1966
1966
|
return C ?? ((h = E == null ? void 0 : E[0]) == null ? void 0 : h.id);
|
|
1967
|
-
}),
|
|
1968
|
-
() => (E == null ? void 0 : E.find((h) => h.id ===
|
|
1969
|
-
[E,
|
|
1970
|
-
),
|
|
1971
|
-
value:
|
|
1967
|
+
}), X = qe ? C : _e, ee = st(
|
|
1968
|
+
() => (E == null ? void 0 : E.find((h) => h.id === X)) ?? null,
|
|
1969
|
+
[E, X]
|
|
1970
|
+
), Ie = (ee == null ? void 0 : ee.agentId) ?? t, [oe, de] = Pn({
|
|
1971
|
+
value: u,
|
|
1972
1972
|
defaultValue: f,
|
|
1973
1973
|
onChange: y,
|
|
1974
1974
|
persistKey: a,
|
|
1975
|
-
disablePersistence:
|
|
1976
|
-
}),
|
|
1977
|
-
|
|
1978
|
-
function
|
|
1979
|
-
const
|
|
1980
|
-
return
|
|
1975
|
+
disablePersistence: x
|
|
1976
|
+
}), xe = $n(s), Be = xn(), te = kn(), le = Sn(), ae = Cn(), fe = En(), [Te, pe] = L(!1), [he, We] = L(!1), [Fe, Ue] = L(!1), [me, ge] = L(!1), [Pe, rt] = L(!1), je = A(G), De = A(ie), p = A(et), Y = A(tt), pt = A(be), kt = A(Qe), Lt = A(Ze), ht = A(re), ne = A(null);
|
|
1977
|
+
je.current = G, De.current = ie, p.current = et, Y.current = tt, pt.current = be, kt.current = Qe, Lt.current = Ze, ht.current = re;
|
|
1978
|
+
function ye(h) {
|
|
1979
|
+
const d = ht.current;
|
|
1980
|
+
return d ? d.includes(h) : !0;
|
|
1981
1981
|
}
|
|
1982
|
-
function
|
|
1982
|
+
function ve(h, d) {
|
|
1983
1983
|
console.warn(
|
|
1984
|
-
`[LiveLayer] Agent command "${h}" blocked — capability "${
|
|
1984
|
+
`[LiveLayer] Agent command "${h}" blocked — capability "${d}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
|
|
1985
1985
|
);
|
|
1986
1986
|
}
|
|
1987
|
-
const
|
|
1987
|
+
const Ve = k(
|
|
1988
1988
|
(h) => {
|
|
1989
|
-
var
|
|
1990
|
-
const
|
|
1991
|
-
if (!(!
|
|
1992
|
-
if (
|
|
1993
|
-
if (!
|
|
1994
|
-
|
|
1989
|
+
var Z, $e, ot, Dt, $t;
|
|
1990
|
+
const d = h;
|
|
1991
|
+
if (!(!d.type || typeof d.type != "string")) {
|
|
1992
|
+
if (Ne == null || Ne({ eventName: d.type, data: h }), d.type === "navigate") {
|
|
1993
|
+
if (!ye("navigate")) {
|
|
1994
|
+
ve("navigate", "navigate");
|
|
1995
1995
|
return;
|
|
1996
1996
|
}
|
|
1997
|
-
const
|
|
1998
|
-
if (!
|
|
1997
|
+
const S = typeof d.href == "string" ? d.href : null;
|
|
1998
|
+
if (!S) {
|
|
1999
1999
|
console.warn(
|
|
2000
2000
|
`[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
|
|
2001
2001
|
);
|
|
2002
2002
|
return;
|
|
2003
2003
|
}
|
|
2004
|
-
if (
|
|
2004
|
+
if (je.current) {
|
|
2005
2005
|
try {
|
|
2006
|
-
|
|
2007
|
-
} catch (
|
|
2006
|
+
je.current(S);
|
|
2007
|
+
} catch (P) {
|
|
2008
2008
|
console.warn(
|
|
2009
|
-
`[LiveLayer] onNavigate threw for "${
|
|
2010
|
-
|
|
2009
|
+
`[LiveLayer] onNavigate threw for "${S}". Falling back. Error:`,
|
|
2010
|
+
P
|
|
2011
2011
|
);
|
|
2012
2012
|
}
|
|
2013
2013
|
return;
|
|
2014
2014
|
}
|
|
2015
2015
|
if (typeof document < "u") {
|
|
2016
|
-
const
|
|
2017
|
-
`a[href="${
|
|
2016
|
+
const P = document.querySelector(
|
|
2017
|
+
`a[href="${S.replace(/"/g, '\\"')}"]`
|
|
2018
2018
|
);
|
|
2019
|
-
if (
|
|
2020
|
-
|
|
2019
|
+
if (P) {
|
|
2020
|
+
P.click();
|
|
2021
2021
|
return;
|
|
2022
2022
|
}
|
|
2023
2023
|
}
|
|
2024
2024
|
if (typeof window < "u" && typeof history < "u")
|
|
2025
2025
|
try {
|
|
2026
|
-
history.pushState({}, "",
|
|
2027
|
-
} catch (
|
|
2026
|
+
history.pushState({}, "", S), window.dispatchEvent(new PopStateEvent("popstate"));
|
|
2027
|
+
} catch (P) {
|
|
2028
2028
|
console.warn(
|
|
2029
|
-
`[LiveLayer] history.pushState fallback failed for "${
|
|
2030
|
-
|
|
2029
|
+
`[LiveLayer] history.pushState fallback failed for "${S}". Pass an onNavigate prop to use your router directly. See https://livelayer.studio/docs/react/navigation`,
|
|
2030
|
+
P
|
|
2031
2031
|
);
|
|
2032
2032
|
}
|
|
2033
2033
|
return;
|
|
2034
2034
|
}
|
|
2035
|
-
if (
|
|
2036
|
-
if (!
|
|
2037
|
-
|
|
2035
|
+
if (d.type === "scroll_to") {
|
|
2036
|
+
if (!ye("scroll")) {
|
|
2037
|
+
ve("scroll_to", "scroll");
|
|
2038
2038
|
return;
|
|
2039
2039
|
}
|
|
2040
|
-
const
|
|
2041
|
-
if (!
|
|
2042
|
-
const
|
|
2043
|
-
if (
|
|
2040
|
+
const S = typeof d.selector == "string" ? d.selector : null;
|
|
2041
|
+
if (!S) return;
|
|
2042
|
+
const P = d.behavior === "instant" ? "instant" : "smooth";
|
|
2043
|
+
if (De.current) {
|
|
2044
2044
|
try {
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2045
|
+
De.current(
|
|
2046
|
+
S,
|
|
2047
|
+
P
|
|
2048
2048
|
);
|
|
2049
|
-
} catch (
|
|
2050
|
-
console.warn("[LiveLayer] onScrollToSelector threw.",
|
|
2049
|
+
} catch (D) {
|
|
2050
|
+
console.warn("[LiveLayer] onScrollToSelector threw.", D);
|
|
2051
2051
|
}
|
|
2052
2052
|
return;
|
|
2053
2053
|
}
|
|
2054
2054
|
if (typeof document < "u") {
|
|
2055
|
-
let
|
|
2055
|
+
let D = null;
|
|
2056
2056
|
try {
|
|
2057
|
-
|
|
2057
|
+
D = document.querySelector(S);
|
|
2058
2058
|
} catch {
|
|
2059
2059
|
console.warn(
|
|
2060
|
-
`[LiveLayer] scroll_to: invalid selector "${
|
|
2060
|
+
`[LiveLayer] scroll_to: invalid selector "${S}".`
|
|
2061
2061
|
);
|
|
2062
2062
|
return;
|
|
2063
2063
|
}
|
|
2064
|
-
if (!
|
|
2064
|
+
if (!D) {
|
|
2065
2065
|
console.warn(
|
|
2066
|
-
`[LiveLayer] scroll_to: no element matched "${
|
|
2066
|
+
`[LiveLayer] scroll_to: no element matched "${S}". The user may be on a different page. See https://livelayer.studio/docs/errors/scroll-no-match`
|
|
2067
2067
|
);
|
|
2068
2068
|
return;
|
|
2069
2069
|
}
|
|
2070
|
-
|
|
2071
|
-
behavior:
|
|
2070
|
+
D.scrollIntoView({
|
|
2071
|
+
behavior: P,
|
|
2072
2072
|
block: "start"
|
|
2073
2073
|
});
|
|
2074
2074
|
}
|
|
2075
2075
|
return;
|
|
2076
2076
|
}
|
|
2077
|
-
if (
|
|
2078
|
-
if (!
|
|
2079
|
-
|
|
2077
|
+
if (d.type === "request_page_context") {
|
|
2078
|
+
if (!ye("read_page")) {
|
|
2079
|
+
ve("request_page_context", "read_page");
|
|
2080
2080
|
return;
|
|
2081
2081
|
}
|
|
2082
|
-
const
|
|
2083
|
-
const
|
|
2084
|
-
if (
|
|
2082
|
+
const S = typeof d.requestId == "string" ? d.requestId : void 0, P = (Z = ne.current) == null ? void 0 : Z.call(ne), D = (K) => {
|
|
2083
|
+
const T = P, U = T == null ? void 0 : T.localParticipant;
|
|
2084
|
+
if (U != null && U.publishData)
|
|
2085
2085
|
try {
|
|
2086
|
-
const
|
|
2087
|
-
|
|
2088
|
-
} catch (
|
|
2089
|
-
console.warn("[LiveLayer] publishData failed.",
|
|
2086
|
+
const H = S ? { ...K, requestId: S } : K, Q = new TextEncoder().encode(JSON.stringify(H));
|
|
2087
|
+
U.publishData(Q, { reliable: !0 });
|
|
2088
|
+
} catch (H) {
|
|
2089
|
+
console.warn("[LiveLayer] publishData failed.", H);
|
|
2090
2090
|
}
|
|
2091
|
-
}, $ =
|
|
2091
|
+
}, $ = kt.current, J = pt.current;
|
|
2092
2092
|
try {
|
|
2093
|
-
if (
|
|
2094
|
-
const
|
|
2095
|
-
if (
|
|
2096
|
-
|
|
2093
|
+
if (J) {
|
|
2094
|
+
const K = J($);
|
|
2095
|
+
if (K instanceof Promise) {
|
|
2096
|
+
D({ type: "page_context_pending" }), K.then((T) => D({ type: "page_context", context: T })).catch((T) => {
|
|
2097
2097
|
console.warn(
|
|
2098
2098
|
"[LiveLayer] getPageContext rejected; falling back to default walker.",
|
|
2099
|
-
|
|
2100
|
-
),
|
|
2099
|
+
T
|
|
2100
|
+
), D({
|
|
2101
2101
|
type: "page_context",
|
|
2102
2102
|
context: Gt($)
|
|
2103
2103
|
});
|
|
2104
2104
|
});
|
|
2105
2105
|
return;
|
|
2106
2106
|
}
|
|
2107
|
-
|
|
2107
|
+
D({ type: "page_context", context: K });
|
|
2108
2108
|
return;
|
|
2109
2109
|
}
|
|
2110
|
-
|
|
2110
|
+
D({
|
|
2111
2111
|
type: "page_context",
|
|
2112
2112
|
context: Gt($)
|
|
2113
2113
|
});
|
|
2114
|
-
} catch (
|
|
2114
|
+
} catch (K) {
|
|
2115
2115
|
console.warn(
|
|
2116
2116
|
"[LiveLayer] page-context extraction threw. Sending empty context.",
|
|
2117
|
-
|
|
2118
|
-
),
|
|
2117
|
+
K
|
|
2118
|
+
), D({
|
|
2119
2119
|
type: "page_context",
|
|
2120
2120
|
context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: $ }
|
|
2121
2121
|
});
|
|
2122
2122
|
}
|
|
2123
2123
|
return;
|
|
2124
2124
|
}
|
|
2125
|
-
if (
|
|
2126
|
-
if (!
|
|
2127
|
-
|
|
2125
|
+
if (d.type === "scroll_page") {
|
|
2126
|
+
if (!ye("scroll")) {
|
|
2127
|
+
ve("scroll_page", "scroll");
|
|
2128
2128
|
return;
|
|
2129
2129
|
}
|
|
2130
|
-
const
|
|
2131
|
-
if (
|
|
2130
|
+
const S = d.direction;
|
|
2131
|
+
if (S !== "up" && S !== "down" && S !== "top" && S !== "bottom") {
|
|
2132
2132
|
console.warn(
|
|
2133
|
-
`[LiveLayer] scroll_page: invalid direction "${String(
|
|
2133
|
+
`[LiveLayer] scroll_page: invalid direction "${String(S)}". Expected up | down | top | bottom.`
|
|
2134
2134
|
);
|
|
2135
2135
|
return;
|
|
2136
2136
|
}
|
|
2137
|
-
const
|
|
2137
|
+
const P = d.behavior === "instant" ? "instant" : "smooth";
|
|
2138
2138
|
if (p.current) {
|
|
2139
2139
|
try {
|
|
2140
2140
|
p.current(
|
|
2141
|
-
|
|
2142
|
-
|
|
2141
|
+
S,
|
|
2142
|
+
P
|
|
2143
2143
|
);
|
|
2144
|
-
} catch (
|
|
2145
|
-
console.warn("[LiveLayer] onScrollPage threw.",
|
|
2144
|
+
} catch (T) {
|
|
2145
|
+
console.warn("[LiveLayer] onScrollPage threw.", T);
|
|
2146
2146
|
}
|
|
2147
2147
|
return;
|
|
2148
2148
|
}
|
|
2149
2149
|
if (typeof window > "u") return;
|
|
2150
|
-
const
|
|
2151
|
-
$ instanceof Window ? $.scrollBy({ top:
|
|
2152
|
-
},
|
|
2153
|
-
$ instanceof Window ? $.scrollTo({ top:
|
|
2150
|
+
const D = { behavior: P }, $ = Nr(), J = (T) => {
|
|
2151
|
+
$ instanceof Window ? $.scrollBy({ top: T, ...D }) : $.scrollBy({ top: T, ...D });
|
|
2152
|
+
}, K = (T) => {
|
|
2153
|
+
$ instanceof Window ? $.scrollTo({ top: T, ...D }) : $.scrollTo({ top: T, ...D });
|
|
2154
2154
|
};
|
|
2155
|
-
|
|
2155
|
+
S === "up" ? J(-Qt($)) : S === "down" ? J(Qt($)) : K(S === "top" ? 0 : Ar($));
|
|
2156
2156
|
return;
|
|
2157
2157
|
}
|
|
2158
|
-
if (
|
|
2159
|
-
if (!
|
|
2160
|
-
|
|
2158
|
+
if (d.type === "click") {
|
|
2159
|
+
if (!ye("click")) {
|
|
2160
|
+
ve("click", "click");
|
|
2161
2161
|
return;
|
|
2162
2162
|
}
|
|
2163
|
-
const
|
|
2164
|
-
if (!
|
|
2163
|
+
const S = typeof d.selector == "string" ? d.selector : null;
|
|
2164
|
+
if (!S) {
|
|
2165
2165
|
console.warn("[LiveLayer] click: missing selector.");
|
|
2166
2166
|
return;
|
|
2167
2167
|
}
|
|
2168
2168
|
if (Y.current) {
|
|
2169
2169
|
try {
|
|
2170
|
-
Y.current(
|
|
2171
|
-
} catch (
|
|
2172
|
-
console.warn("[LiveLayer] onClick threw.",
|
|
2170
|
+
Y.current(S);
|
|
2171
|
+
} catch (D) {
|
|
2172
|
+
console.warn("[LiveLayer] onClick threw.", D);
|
|
2173
2173
|
}
|
|
2174
2174
|
return;
|
|
2175
2175
|
}
|
|
2176
2176
|
if (typeof document > "u") return;
|
|
2177
|
-
let
|
|
2177
|
+
let P = null;
|
|
2178
2178
|
try {
|
|
2179
|
-
|
|
2179
|
+
P = document.querySelector(S);
|
|
2180
2180
|
} catch {
|
|
2181
2181
|
console.warn(
|
|
2182
|
-
`[LiveLayer] click: invalid selector "${
|
|
2182
|
+
`[LiveLayer] click: invalid selector "${S}".`
|
|
2183
2183
|
);
|
|
2184
2184
|
return;
|
|
2185
2185
|
}
|
|
2186
|
-
if (!
|
|
2186
|
+
if (!P) {
|
|
2187
2187
|
console.warn(
|
|
2188
|
-
`[LiveLayer] click: no element matched "${
|
|
2188
|
+
`[LiveLayer] click: no element matched "${S}". See https://livelayer.studio/docs/errors/click-no-match`
|
|
2189
2189
|
);
|
|
2190
2190
|
return;
|
|
2191
2191
|
}
|
|
2192
|
-
if (
|
|
2192
|
+
if (P.closest('[data-ll-private="true"], .ll-widget')) {
|
|
2193
2193
|
console.warn(
|
|
2194
2194
|
"[LiveLayer] click: refusing to click element inside a private subtree."
|
|
2195
2195
|
);
|
|
2196
2196
|
return;
|
|
2197
2197
|
}
|
|
2198
|
-
(
|
|
2198
|
+
($e = P.click) == null || $e.call(P);
|
|
2199
2199
|
return;
|
|
2200
2200
|
}
|
|
2201
|
-
if (
|
|
2202
|
-
if (!
|
|
2203
|
-
|
|
2201
|
+
if (d.type === "fill_form" || d.type === "focus_field") {
|
|
2202
|
+
if (!ye("fill_forms")) {
|
|
2203
|
+
ve(d.type, "fill_forms");
|
|
2204
2204
|
return;
|
|
2205
2205
|
}
|
|
2206
2206
|
if (typeof document > "u") return;
|
|
2207
|
-
const
|
|
2208
|
-
|
|
2209
|
-
|
|
2207
|
+
const S = typeof d.requestId == "string" ? d.requestId : void 0, P = (ot = ne.current) == null ? void 0 : ot.call(ne), D = (H) => {
|
|
2208
|
+
if (d.type !== "fill_form") return;
|
|
2209
|
+
const Q = P, se = Q == null ? void 0 : Q.localParticipant;
|
|
2210
|
+
if (se != null && se.publishData)
|
|
2211
|
+
try {
|
|
2212
|
+
const ke = S ? { ...H, requestId: S } : H, hn = new TextEncoder().encode(JSON.stringify(ke));
|
|
2213
|
+
se.publishData(hn, { reliable: !0 });
|
|
2214
|
+
} catch (ke) {
|
|
2215
|
+
console.warn("[LiveLayer] publishData failed.", ke);
|
|
2216
|
+
}
|
|
2217
|
+
}, $ = typeof d.formId == "string" ? d.formId : null;
|
|
2218
|
+
if (!$) {
|
|
2219
|
+
console.warn(`[LiveLayer] ${d.type}: missing formId.`), D({ type: "fill_form_result", ok: !1, reason: "missing formId" });
|
|
2210
2220
|
return;
|
|
2211
2221
|
}
|
|
2212
|
-
const
|
|
2213
|
-
`[data-ll-form="${
|
|
2222
|
+
const J = document.querySelector(
|
|
2223
|
+
`[data-ll-form="${$.replace(/"/g, '\\"')}"]`
|
|
2214
2224
|
);
|
|
2215
|
-
if (!
|
|
2225
|
+
if (!J) {
|
|
2216
2226
|
console.warn(
|
|
2217
|
-
`[LiveLayer] ${
|
|
2218
|
-
)
|
|
2227
|
+
`[LiveLayer] ${d.type}: no form with data-ll-form="${$}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
|
|
2228
|
+
), D({
|
|
2229
|
+
type: "fill_form_result",
|
|
2230
|
+
ok: !1,
|
|
2231
|
+
reason: `no form with data-ll-form="${$}" on this page`,
|
|
2232
|
+
formId: $
|
|
2233
|
+
});
|
|
2219
2234
|
return;
|
|
2220
2235
|
}
|
|
2221
|
-
if (
|
|
2236
|
+
if (J.closest('[data-ll-private="true"], .ll-widget')) {
|
|
2222
2237
|
console.warn(
|
|
2223
|
-
`[LiveLayer] ${
|
|
2224
|
-
)
|
|
2238
|
+
`[LiveLayer] ${d.type}: refusing to touch a form in a private subtree.`
|
|
2239
|
+
), D({
|
|
2240
|
+
type: "fill_form_result",
|
|
2241
|
+
ok: !1,
|
|
2242
|
+
reason: "form is in a private subtree (data-ll-private)",
|
|
2243
|
+
formId: $
|
|
2244
|
+
});
|
|
2225
2245
|
return;
|
|
2226
2246
|
}
|
|
2227
|
-
if (
|
|
2228
|
-
const
|
|
2229
|
-
if (
|
|
2247
|
+
if (d.type === "focus_field") {
|
|
2248
|
+
const H = typeof d.fieldName == "string" ? d.fieldName : null;
|
|
2249
|
+
if (!H) {
|
|
2230
2250
|
console.warn("[LiveLayer] focus_field: missing fieldName.");
|
|
2231
2251
|
return;
|
|
2232
2252
|
}
|
|
2233
|
-
const
|
|
2234
|
-
if (!
|
|
2253
|
+
const Q = J.querySelector(`[data-ll-field="${H.replace(/"/g, '\\"')}"]`);
|
|
2254
|
+
if (!Q) {
|
|
2235
2255
|
console.warn(
|
|
2236
|
-
`[LiveLayer] focus_field: no field "${
|
|
2256
|
+
`[LiveLayer] focus_field: no field "${H}" in form "${$}".`
|
|
2237
2257
|
);
|
|
2238
2258
|
return;
|
|
2239
2259
|
}
|
|
2240
|
-
if (!
|
|
2260
|
+
if (!dt(Q)) {
|
|
2241
2261
|
console.warn(
|
|
2242
|
-
`[LiveLayer] focus_field: field "${
|
|
2262
|
+
`[LiveLayer] focus_field: field "${H}" is privacy-protected and not focusable.`
|
|
2243
2263
|
);
|
|
2244
2264
|
return;
|
|
2245
2265
|
}
|
|
2246
|
-
|
|
2266
|
+
Q.focus();
|
|
2247
2267
|
return;
|
|
2248
2268
|
}
|
|
2249
|
-
const
|
|
2250
|
-
if (!
|
|
2251
|
-
console.warn("[LiveLayer] fill_form: missing or invalid values.")
|
|
2269
|
+
const K = d.values && typeof d.values == "object" ? d.values : null;
|
|
2270
|
+
if (!K) {
|
|
2271
|
+
console.warn("[LiveLayer] fill_form: missing or invalid values."), D({
|
|
2272
|
+
type: "fill_form_result",
|
|
2273
|
+
ok: !1,
|
|
2274
|
+
reason: "missing or invalid values",
|
|
2275
|
+
formId: $
|
|
2276
|
+
});
|
|
2252
2277
|
return;
|
|
2253
2278
|
}
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2279
|
+
const T = [], U = [];
|
|
2280
|
+
for (const [H, Q] of Object.entries(K)) {
|
|
2281
|
+
if (typeof Q != "string") continue;
|
|
2282
|
+
const se = J.querySelector(`[data-ll-field="${H.replace(/"/g, '\\"')}"]`);
|
|
2283
|
+
if (!se) {
|
|
2258
2284
|
console.warn(
|
|
2259
|
-
`[LiveLayer] fill_form: no field "${
|
|
2260
|
-
);
|
|
2285
|
+
`[LiveLayer] fill_form: no field "${H}" in form "${$}". Skipping.`
|
|
2286
|
+
), U.push(H);
|
|
2261
2287
|
continue;
|
|
2262
2288
|
}
|
|
2263
|
-
if (!
|
|
2289
|
+
if (!dt(se)) {
|
|
2264
2290
|
console.warn(
|
|
2265
|
-
`[LiveLayer] fill_form: field "${
|
|
2266
|
-
);
|
|
2291
|
+
`[LiveLayer] fill_form: field "${H}" is privacy-protected (password / cc-* / private). Skipping.`
|
|
2292
|
+
), U.push(H);
|
|
2267
2293
|
continue;
|
|
2268
2294
|
}
|
|
2269
2295
|
try {
|
|
2270
|
-
|
|
2271
|
-
} catch (
|
|
2296
|
+
Lr(se, Q), T.push(H);
|
|
2297
|
+
} catch (ke) {
|
|
2272
2298
|
console.warn(
|
|
2273
|
-
`[LiveLayer] fill_form: failed to set "${
|
|
2274
|
-
|
|
2275
|
-
);
|
|
2299
|
+
`[LiveLayer] fill_form: failed to set "${H}".`,
|
|
2300
|
+
ke
|
|
2301
|
+
), U.push(H);
|
|
2276
2302
|
}
|
|
2277
2303
|
}
|
|
2304
|
+
D({
|
|
2305
|
+
type: "fill_form_result",
|
|
2306
|
+
ok: T.length > 0,
|
|
2307
|
+
formId: $,
|
|
2308
|
+
filled: T,
|
|
2309
|
+
skipped: U,
|
|
2310
|
+
reason: T.length === 0 ? `none of the requested fields exist on this form (skipped: ${U.join(", ")})` : void 0
|
|
2311
|
+
});
|
|
2278
2312
|
return;
|
|
2279
2313
|
}
|
|
2280
|
-
if (
|
|
2281
|
-
if (!
|
|
2282
|
-
|
|
2314
|
+
if (d.type === "submit_form") {
|
|
2315
|
+
if (!ye("submit_forms")) {
|
|
2316
|
+
ve("submit_form", "submit_forms");
|
|
2283
2317
|
return;
|
|
2284
2318
|
}
|
|
2285
2319
|
if (typeof document > "u") return;
|
|
2286
|
-
const
|
|
2287
|
-
if (!
|
|
2320
|
+
const S = typeof d.formId == "string" ? d.formId : null;
|
|
2321
|
+
if (!S) {
|
|
2288
2322
|
console.warn("[LiveLayer] submit_form: missing formId.");
|
|
2289
2323
|
return;
|
|
2290
2324
|
}
|
|
2291
|
-
const
|
|
2292
|
-
`[data-ll-form="${
|
|
2325
|
+
const P = document.querySelector(
|
|
2326
|
+
`[data-ll-form="${S.replace(/"/g, '\\"')}"]`
|
|
2293
2327
|
);
|
|
2294
|
-
if (!
|
|
2328
|
+
if (!P) {
|
|
2295
2329
|
console.warn(
|
|
2296
|
-
`[LiveLayer] submit_form: no form with data-ll-form="${
|
|
2330
|
+
`[LiveLayer] submit_form: no form with data-ll-form="${S}".`
|
|
2297
2331
|
);
|
|
2298
2332
|
return;
|
|
2299
2333
|
}
|
|
2300
|
-
if (
|
|
2334
|
+
if (P.closest('[data-ll-private="true"], .ll-widget')) {
|
|
2301
2335
|
console.warn(
|
|
2302
2336
|
"[LiveLayer] submit_form: refusing to submit a form in a private subtree."
|
|
2303
2337
|
);
|
|
2304
2338
|
return;
|
|
2305
2339
|
}
|
|
2306
|
-
const
|
|
2307
|
-
const
|
|
2308
|
-
if (
|
|
2340
|
+
const D = typeof d.requestId == "string" ? d.requestId : void 0, $ = (Dt = ne.current) == null ? void 0 : Dt.call(ne), J = (U) => {
|
|
2341
|
+
const H = $, Q = H == null ? void 0 : H.localParticipant;
|
|
2342
|
+
if (Q != null && Q.publishData)
|
|
2309
2343
|
try {
|
|
2310
|
-
const
|
|
2311
|
-
|
|
2344
|
+
const se = D ? { ...U, requestId: D } : U, ke = new TextEncoder().encode(JSON.stringify(se));
|
|
2345
|
+
Q.publishData(ke, { reliable: !0 });
|
|
2312
2346
|
} catch {
|
|
2313
2347
|
}
|
|
2314
2348
|
};
|
|
2315
|
-
let
|
|
2316
|
-
const
|
|
2317
|
-
|
|
2349
|
+
let K = !1;
|
|
2350
|
+
const T = () => {
|
|
2351
|
+
K = !0, J({ type: "form_submitted", formId: S });
|
|
2318
2352
|
};
|
|
2319
|
-
|
|
2353
|
+
P.addEventListener("submit", T, { once: !0 });
|
|
2320
2354
|
try {
|
|
2321
|
-
typeof
|
|
2322
|
-
} catch (
|
|
2323
|
-
console.warn("[LiveLayer] submit_form: requestSubmit threw.",
|
|
2355
|
+
typeof P.requestSubmit == "function" ? P.requestSubmit() : P.submit();
|
|
2356
|
+
} catch (U) {
|
|
2357
|
+
console.warn("[LiveLayer] submit_form: requestSubmit threw.", U), P.removeEventListener("submit", T), J({
|
|
2324
2358
|
type: "form_submit_blocked",
|
|
2325
|
-
formId:
|
|
2359
|
+
formId: S,
|
|
2326
2360
|
reason: "exception"
|
|
2327
2361
|
});
|
|
2328
2362
|
return;
|
|
2329
2363
|
}
|
|
2330
2364
|
setTimeout(() => {
|
|
2331
|
-
|
|
2365
|
+
K || (P.removeEventListener("submit", T), J({
|
|
2332
2366
|
type: "form_submit_blocked",
|
|
2333
|
-
formId:
|
|
2367
|
+
formId: S,
|
|
2334
2368
|
reason: "validation"
|
|
2335
2369
|
}));
|
|
2336
2370
|
}, 500);
|
|
2337
2371
|
return;
|
|
2338
2372
|
}
|
|
2339
|
-
if (
|
|
2340
|
-
if (!
|
|
2341
|
-
|
|
2373
|
+
if (d.type === "request_routes") {
|
|
2374
|
+
if (!ye("read_page")) {
|
|
2375
|
+
ve("request_routes", "read_page");
|
|
2342
2376
|
return;
|
|
2343
2377
|
}
|
|
2344
|
-
const
|
|
2378
|
+
const S = typeof d.requestId == "string" ? d.requestId : void 0, D = ($t = ne.current) == null ? void 0 : $t.call(ne), $ = D == null ? void 0 : D.localParticipant;
|
|
2345
2379
|
if (!($ != null && $.publishData)) return;
|
|
2346
|
-
const
|
|
2380
|
+
const J = (T) => {
|
|
2347
2381
|
try {
|
|
2348
|
-
const
|
|
2349
|
-
$.publishData(
|
|
2350
|
-
} catch (
|
|
2351
|
-
console.warn("[LiveLayer] request_routes: publishData failed.",
|
|
2382
|
+
const U = S ? { type: "routes", routes: T, requestId: S } : { type: "routes", routes: T }, H = new TextEncoder().encode(JSON.stringify(U));
|
|
2383
|
+
$.publishData(H, { reliable: !0 });
|
|
2384
|
+
} catch (U) {
|
|
2385
|
+
console.warn("[LiveLayer] request_routes: publishData failed.", U);
|
|
2352
2386
|
}
|
|
2353
|
-
},
|
|
2354
|
-
if (
|
|
2387
|
+
}, K = Lt.current;
|
|
2388
|
+
if (K) {
|
|
2355
2389
|
try {
|
|
2356
|
-
const
|
|
2357
|
-
if (!Array.isArray(
|
|
2358
|
-
|
|
2390
|
+
const T = K(), U = (H) => {
|
|
2391
|
+
if (!Array.isArray(H)) {
|
|
2392
|
+
J([]);
|
|
2359
2393
|
return;
|
|
2360
2394
|
}
|
|
2361
|
-
|
|
2395
|
+
J(H.map(vr).slice(0, 200));
|
|
2362
2396
|
};
|
|
2363
|
-
|
|
2397
|
+
T instanceof Promise ? T.then(U).catch((H) => {
|
|
2364
2398
|
console.warn(
|
|
2365
2399
|
"[LiveLayer] getRoutes rejected; falling back to DOM walker.",
|
|
2366
|
-
|
|
2367
|
-
),
|
|
2368
|
-
}) :
|
|
2369
|
-
} catch (
|
|
2400
|
+
H
|
|
2401
|
+
), J(vt());
|
|
2402
|
+
}) : U(T);
|
|
2403
|
+
} catch (T) {
|
|
2370
2404
|
console.warn(
|
|
2371
2405
|
"[LiveLayer] getRoutes threw; falling back to DOM walker.",
|
|
2372
|
-
|
|
2373
|
-
),
|
|
2406
|
+
T
|
|
2407
|
+
), J(vt());
|
|
2374
2408
|
}
|
|
2375
2409
|
return;
|
|
2376
2410
|
}
|
|
2377
2411
|
try {
|
|
2378
|
-
|
|
2379
|
-
} catch (
|
|
2380
|
-
console.warn("[LiveLayer] request_routes: extractRoutes threw.",
|
|
2412
|
+
J(vt());
|
|
2413
|
+
} catch (T) {
|
|
2414
|
+
console.warn("[LiveLayer] request_routes: extractRoutes threw.", T);
|
|
2381
2415
|
}
|
|
2382
2416
|
return;
|
|
2383
2417
|
}
|
|
2384
|
-
|
|
2418
|
+
Rr.has(d.type) || Ae == null || Ae(d);
|
|
2385
2419
|
}
|
|
2386
2420
|
},
|
|
2387
|
-
[
|
|
2388
|
-
),
|
|
2389
|
-
agentId: V ? "__controlled__" :
|
|
2421
|
+
[Ae, Ne]
|
|
2422
|
+
), j = _n({
|
|
2423
|
+
agentId: V ? "__controlled__" : Ie,
|
|
2390
2424
|
baseUrl: i,
|
|
2391
2425
|
apiKey: r,
|
|
2392
2426
|
sessionEndpoint: o,
|
|
2393
2427
|
sessionBody: l,
|
|
2394
|
-
onDataMessage: V ? void 0 :
|
|
2428
|
+
onDataMessage: V ? void 0 : Ve
|
|
2395
2429
|
});
|
|
2396
2430
|
N(() => {
|
|
2397
2431
|
if (V != null && V.subscribeToDataMessages)
|
|
2398
|
-
return V.subscribeToDataMessages(
|
|
2399
|
-
}, [V,
|
|
2432
|
+
return V.subscribeToDataMessages(Ve);
|
|
2433
|
+
}, [V, Ve]), ne.current = () => {
|
|
2400
2434
|
var h;
|
|
2401
|
-
return (h =
|
|
2435
|
+
return (h = j.getRoom) == null ? void 0 : h.call(j);
|
|
2402
2436
|
}, N(() => {
|
|
2403
|
-
var
|
|
2404
|
-
if (!
|
|
2405
|
-
const h = (
|
|
2406
|
-
if (
|
|
2437
|
+
var Z;
|
|
2438
|
+
if (!ue) return;
|
|
2439
|
+
const h = (Z = j.getRoom) == null ? void 0 : Z.call(j), d = h == null ? void 0 : h.localParticipant;
|
|
2440
|
+
if (d != null && d.publishData)
|
|
2407
2441
|
try {
|
|
2408
|
-
const
|
|
2409
|
-
JSON.stringify({ type: "pathname", pathname:
|
|
2442
|
+
const $e = new TextEncoder().encode(
|
|
2443
|
+
JSON.stringify({ type: "pathname", pathname: ue })
|
|
2410
2444
|
);
|
|
2411
|
-
|
|
2445
|
+
d.publishData($e, { reliable: !0 });
|
|
2412
2446
|
} catch {
|
|
2413
2447
|
}
|
|
2414
|
-
}, [
|
|
2415
|
-
var
|
|
2448
|
+
}, [ue, j, j.connectionState]), N(() => {
|
|
2449
|
+
var Z;
|
|
2416
2450
|
if (typeof window > "u") return;
|
|
2417
|
-
const h = ((
|
|
2451
|
+
const h = ((Z = window.location) == null ? void 0 : Z.hostname) || "";
|
|
2418
2452
|
if (h === "localhost" || h === "127.0.0.1" || h === "0.0.0.0" || h.endsWith(".local") || h.endsWith(".test"))
|
|
2419
|
-
return window.__livelayerSimulateCommand = (
|
|
2453
|
+
return window.__livelayerSimulateCommand = ($e) => {
|
|
2420
2454
|
try {
|
|
2421
|
-
|
|
2422
|
-
} catch (
|
|
2423
|
-
console.warn("[LiveLayer] simulate-command threw:",
|
|
2455
|
+
Ve($e);
|
|
2456
|
+
} catch (ot) {
|
|
2457
|
+
console.warn("[LiveLayer] simulate-command threw:", ot);
|
|
2424
2458
|
}
|
|
2425
2459
|
}, () => {
|
|
2426
2460
|
delete window.__livelayerSimulateCommand;
|
|
2427
2461
|
};
|
|
2428
|
-
}, [
|
|
2429
|
-
const g =
|
|
2462
|
+
}, [Ve]);
|
|
2463
|
+
const g = st(() => V ? {
|
|
2430
2464
|
connectionState: V.connectionState,
|
|
2431
2465
|
agentState: V.agentState,
|
|
2432
2466
|
transcript: V.transcript,
|
|
@@ -2442,232 +2476,232 @@ function Ar(e) {
|
|
|
2442
2476
|
// Dummy getRoom for shape compatibility — controlled consumers own the Room.
|
|
2443
2477
|
// Internal session's getRoom returns null when no real connect has happened,
|
|
2444
2478
|
// so we reuse its reference for type consistency.
|
|
2445
|
-
getRoom:
|
|
2479
|
+
getRoom: j.getRoom,
|
|
2446
2480
|
isControlled: !0
|
|
2447
2481
|
} : {
|
|
2448
|
-
connectionState:
|
|
2449
|
-
agentState:
|
|
2450
|
-
transcript:
|
|
2451
|
-
videoElement:
|
|
2452
|
-
audioElement:
|
|
2453
|
-
canResume:
|
|
2454
|
-
error:
|
|
2455
|
-
agentConfig:
|
|
2456
|
-
connect:
|
|
2457
|
-
disconnect:
|
|
2458
|
-
getRoom:
|
|
2482
|
+
connectionState: j.connectionState,
|
|
2483
|
+
agentState: j.agentState,
|
|
2484
|
+
transcript: j.transcript,
|
|
2485
|
+
videoElement: j.videoElement,
|
|
2486
|
+
audioElement: j.audioElement,
|
|
2487
|
+
canResume: j.canResume,
|
|
2488
|
+
error: j.error,
|
|
2489
|
+
agentConfig: j.agentConfig,
|
|
2490
|
+
connect: j.connect,
|
|
2491
|
+
disconnect: j.disconnect,
|
|
2492
|
+
getRoom: j.getRoom,
|
|
2459
2493
|
isControlled: !1
|
|
2460
|
-
}, [V,
|
|
2494
|
+
}, [V, j]), St = A(null);
|
|
2461
2495
|
N(() => {
|
|
2462
|
-
const h = g.videoElement,
|
|
2463
|
-
if (!(!h || !
|
|
2464
|
-
return
|
|
2465
|
-
h.parentNode ===
|
|
2496
|
+
const h = g.videoElement, d = St.current;
|
|
2497
|
+
if (!(!h || !d))
|
|
2498
|
+
return d.appendChild(h), () => {
|
|
2499
|
+
h.parentNode === d && d.removeChild(h);
|
|
2466
2500
|
};
|
|
2467
2501
|
}, [g.videoElement]), N(() => {
|
|
2468
2502
|
const h = g.audioElement;
|
|
2469
2503
|
if (!h) return;
|
|
2470
|
-
|
|
2471
|
-
const
|
|
2472
|
-
return
|
|
2473
|
-
(
|
|
2504
|
+
Be.attach(h);
|
|
2505
|
+
const d = h.play();
|
|
2506
|
+
return d && typeof d.catch == "function" && d.catch((Z) => {
|
|
2507
|
+
(Z == null ? void 0 : Z.name) === "NotAllowedError" && pe(!0);
|
|
2474
2508
|
}), () => {
|
|
2475
|
-
|
|
2509
|
+
Be.detach();
|
|
2476
2510
|
};
|
|
2477
2511
|
}, [g.audioElement]), N(() => {
|
|
2478
2512
|
if (g.isControlled || g.connectionState !== "connected") return;
|
|
2479
2513
|
const h = g.getRoom();
|
|
2480
2514
|
if (h)
|
|
2481
|
-
return
|
|
2482
|
-
}),
|
|
2483
|
-
|
|
2515
|
+
return te.setupMic(h, { startMuted: !0 }).catch(() => {
|
|
2516
|
+
}), le.attachRoom(h), ae.attachRoom(h), fe.refresh(), () => {
|
|
2517
|
+
te.teardownMic(), le.teardown(), ae.teardown();
|
|
2484
2518
|
};
|
|
2485
2519
|
}, [g.isControlled, g.connectionState]);
|
|
2486
|
-
const [
|
|
2520
|
+
const [Ye, mt] = L(!1), gt = A("idle");
|
|
2487
2521
|
N(() => {
|
|
2488
2522
|
if (g.connectionState === "idle" || g.connectionState === "disconnected") {
|
|
2489
|
-
|
|
2523
|
+
mt(!1), gt.current = "idle";
|
|
2490
2524
|
return;
|
|
2491
2525
|
}
|
|
2492
|
-
!
|
|
2493
|
-
}, [g.agentState, g.connectionState,
|
|
2494
|
-
if (g.connectionState !== "connected" ||
|
|
2526
|
+
!Ye && gt.current === "speaking" && g.agentState !== "speaking" && (mt(!0), te.setMuted(!1)), gt.current = g.agentState;
|
|
2527
|
+
}, [g.agentState, g.connectionState, Ye]), N(() => {
|
|
2528
|
+
if (g.connectionState !== "connected" || Ye) return;
|
|
2495
2529
|
const h = setTimeout(() => {
|
|
2496
|
-
|
|
2530
|
+
mt(!0), te.setMuted(!1);
|
|
2497
2531
|
}, 4e3);
|
|
2498
2532
|
return () => clearTimeout(h);
|
|
2499
|
-
}, [g.connectionState,
|
|
2533
|
+
}, [g.connectionState, Ye]), N(() => {
|
|
2500
2534
|
const h = g.audioElement;
|
|
2501
|
-
h && (h.muted =
|
|
2502
|
-
}, [g.audioElement,
|
|
2503
|
-
const
|
|
2504
|
-
const
|
|
2505
|
-
if (
|
|
2535
|
+
h && (h.muted = Pe);
|
|
2536
|
+
}, [g.audioElement, Pe]);
|
|
2537
|
+
const nn = k((h) => {
|
|
2538
|
+
const d = g.getRoom();
|
|
2539
|
+
if (d)
|
|
2506
2540
|
try {
|
|
2507
|
-
const
|
|
2541
|
+
const Z = new TextEncoder().encode(
|
|
2508
2542
|
JSON.stringify({ type: "user_message", text: h })
|
|
2509
2543
|
);
|
|
2510
|
-
|
|
2544
|
+
d.localParticipant.publishData(Z, { reliable: !0 });
|
|
2511
2545
|
} catch {
|
|
2512
2546
|
}
|
|
2513
|
-
}, [g]),
|
|
2514
|
-
|
|
2547
|
+
}, [g]), rn = k(() => {
|
|
2548
|
+
rt((h) => !h);
|
|
2515
2549
|
}, []);
|
|
2516
2550
|
N(() => {
|
|
2517
|
-
|
|
2518
|
-
}, [g.connectionState,
|
|
2519
|
-
|
|
2520
|
-
}, [g.transcript,
|
|
2521
|
-
|
|
2522
|
-
}, [g.agentState,
|
|
2523
|
-
const
|
|
2551
|
+
Ee == null || Ee(g.connectionState), g.connectionState === "connected" ? ce == null || ce() : g.connectionState === "disconnected" && (we == null || we());
|
|
2552
|
+
}, [g.connectionState, ce, we, Ee]), N(() => {
|
|
2553
|
+
Se == null || Se(g.transcript);
|
|
2554
|
+
}, [g.transcript, Se]), N(() => {
|
|
2555
|
+
Ce == null || Ce(g.agentState);
|
|
2556
|
+
}, [g.agentState, Ce]);
|
|
2557
|
+
const Ct = A(!1);
|
|
2524
2558
|
N(() => {
|
|
2525
|
-
g.isControlled || !c ||
|
|
2526
|
-
}, [c, g.connectionState, g,
|
|
2527
|
-
const
|
|
2559
|
+
g.isControlled || !c || Ct.current || Re && g.connectionState === "idle" && (Ct.current = !0, g.connect());
|
|
2560
|
+
}, [c, g.connectionState, g, Re]);
|
|
2561
|
+
const on = k(
|
|
2528
2562
|
(h) => {
|
|
2529
|
-
const
|
|
2530
|
-
|
|
2563
|
+
const d = E == null ? void 0 : E.find((Z) => Z.id === h);
|
|
2564
|
+
d && (Ue(!1), h !== X && (We(!0), g.disconnect(), qe || Me(h), v == null || v(d)));
|
|
2531
2565
|
},
|
|
2532
2566
|
[
|
|
2533
2567
|
E,
|
|
2534
|
-
|
|
2568
|
+
X,
|
|
2535
2569
|
g,
|
|
2536
|
-
|
|
2570
|
+
qe,
|
|
2537
2571
|
v
|
|
2538
2572
|
]
|
|
2539
2573
|
);
|
|
2540
2574
|
N(() => {
|
|
2541
|
-
|
|
2542
|
-
}, [g.connectionState,
|
|
2543
|
-
if (!
|
|
2544
|
-
const h = (
|
|
2545
|
-
|
|
2575
|
+
he && g.connectionState === "connected" && We(!1);
|
|
2576
|
+
}, [g.connectionState, he]), N(() => {
|
|
2577
|
+
if (!Fe) return;
|
|
2578
|
+
const h = (d) => {
|
|
2579
|
+
d.key === "Escape" && Ue(!1);
|
|
2546
2580
|
};
|
|
2547
2581
|
return window.addEventListener("keydown", h), () => window.removeEventListener("keydown", h);
|
|
2548
|
-
}, [
|
|
2549
|
-
const
|
|
2550
|
-
|
|
2551
|
-
const
|
|
2552
|
-
() =>
|
|
2553
|
-
[
|
|
2554
|
-
),
|
|
2555
|
-
g.disconnect(),
|
|
2556
|
-
}, [g,
|
|
2582
|
+
}, [Fe]);
|
|
2583
|
+
const ln = !!I || !!(ee != null && ee.avatarImageUrl) || g.isControlled, Je = Nn(Ie, i, ln);
|
|
2584
|
+
re === void 0 && ((Nt = Je.info) != null && Nt.capabilities) && (ht.current = Je.info.capabilities);
|
|
2585
|
+
const it = (ee == null ? void 0 : ee.name) ?? q ?? ((At = g.agentConfig) == null ? void 0 : At.name) ?? ((Rt = Je.info) == null ? void 0 : Rt.name) ?? "Live Layer", yt = (ee == null ? void 0 : ee.avatarImageUrl) ?? I ?? ((Mt = g.agentConfig) == null ? void 0 : Mt.avatarImageUrl) ?? ((It = Je.info) == null ? void 0 : It.avatarImageUrl) ?? null, an = w ?? ((Tt = g.agentConfig) == null ? void 0 : Tt.idleLoopUrl) ?? ((Pt = Je.info) == null ? void 0 : Pt.idleLoopUrl) ?? null, sn = O ?? null, cn = k(() => de("expanded"), [de]), dn = k(
|
|
2586
|
+
() => de("minimized"),
|
|
2587
|
+
[de]
|
|
2588
|
+
), Et = k(() => {
|
|
2589
|
+
g.disconnect(), de("hidden");
|
|
2590
|
+
}, [g, de]), un = k(() => {
|
|
2557
2591
|
const h = g.audioElement;
|
|
2558
|
-
h && h.play().then(() =>
|
|
2592
|
+
h && h.play().then(() => pe(!1)).catch(() => {
|
|
2559
2593
|
});
|
|
2560
|
-
}, [g.audioElement]),
|
|
2561
|
-
|
|
2562
|
-
}, [g]),
|
|
2563
|
-
...
|
|
2564
|
-
zIndex:
|
|
2594
|
+
}, [g.audioElement]), fn = k(() => {
|
|
2595
|
+
pe(!1), g.connect();
|
|
2596
|
+
}, [g]), Ke = {
|
|
2597
|
+
...ft,
|
|
2598
|
+
zIndex: nt
|
|
2565
2599
|
};
|
|
2566
|
-
m.primaryColor && (
|
|
2567
|
-
const
|
|
2600
|
+
m.primaryColor && (Ke["--ll-color-primary"] = m.primaryColor), m.accentColor && (Ke["--ll-color-accent"] = m.accentColor), m.backgroundColor && (Ke["--ll-color-bg"] = m.backgroundColor), m.textColor && (Ke["--ll-color-fg"] = m.textColor);
|
|
2601
|
+
const pn = [
|
|
2568
2602
|
"ll-widget",
|
|
2569
|
-
`ll-widget--${
|
|
2570
|
-
`ll-widget--${
|
|
2571
|
-
|
|
2603
|
+
`ll-widget--${oe}`,
|
|
2604
|
+
`ll-widget--${xe ? "mobile" : "desktop"}`,
|
|
2605
|
+
ut
|
|
2572
2606
|
].filter(Boolean).join(" ");
|
|
2573
|
-
return
|
|
2607
|
+
return Re ? /* @__PURE__ */ _(
|
|
2574
2608
|
"div",
|
|
2575
2609
|
{
|
|
2576
|
-
className:
|
|
2577
|
-
style:
|
|
2578
|
-
"data-display-mode":
|
|
2610
|
+
className: pn,
|
|
2611
|
+
style: Ke,
|
|
2612
|
+
"data-display-mode": oe,
|
|
2579
2613
|
"data-position": b,
|
|
2580
2614
|
children: [
|
|
2581
|
-
|
|
2582
|
-
|
|
2615
|
+
oe === "hidden" && /* @__PURE__ */ n(
|
|
2616
|
+
Gn,
|
|
2583
2617
|
{
|
|
2584
2618
|
position: b,
|
|
2585
|
-
isMobile:
|
|
2619
|
+
isMobile: xe,
|
|
2586
2620
|
isSpeaking: g.agentState === "speaking",
|
|
2587
|
-
onExpand: () =>
|
|
2588
|
-
label: `Open ${
|
|
2589
|
-
avatarImageUrl:
|
|
2590
|
-
agentName:
|
|
2621
|
+
onExpand: () => de("expanded"),
|
|
2622
|
+
label: `Open ${it} widget`,
|
|
2623
|
+
avatarImageUrl: yt,
|
|
2624
|
+
agentName: it
|
|
2591
2625
|
}
|
|
2592
2626
|
),
|
|
2593
|
-
|
|
2594
|
-
|
|
2627
|
+
oe === "minimized" && /* @__PURE__ */ n(
|
|
2628
|
+
Zn,
|
|
2595
2629
|
{
|
|
2596
2630
|
position: b,
|
|
2597
|
-
isMobile:
|
|
2598
|
-
agentName:
|
|
2599
|
-
avatarImageUrl:
|
|
2631
|
+
isMobile: xe,
|
|
2632
|
+
agentName: it,
|
|
2633
|
+
avatarImageUrl: yt,
|
|
2600
2634
|
agentState: g.agentState,
|
|
2601
|
-
isMuted:
|
|
2602
|
-
audioLevel:
|
|
2603
|
-
onExpand:
|
|
2604
|
-
onToggleMute:
|
|
2605
|
-
onClose:
|
|
2635
|
+
isMuted: te.isMuted,
|
|
2636
|
+
audioLevel: Be,
|
|
2637
|
+
onExpand: cn,
|
|
2638
|
+
onToggleMute: te.toggleMute,
|
|
2639
|
+
onClose: Et
|
|
2606
2640
|
}
|
|
2607
2641
|
),
|
|
2608
|
-
|
|
2609
|
-
|
|
2642
|
+
oe === "expanded" && /* @__PURE__ */ n(
|
|
2643
|
+
tr,
|
|
2610
2644
|
{
|
|
2611
2645
|
position: b,
|
|
2612
|
-
isMobile:
|
|
2613
|
-
agentName:
|
|
2614
|
-
avatarImageUrl:
|
|
2615
|
-
idleLoopUrl:
|
|
2616
|
-
greeting:
|
|
2646
|
+
isMobile: xe,
|
|
2647
|
+
agentName: it,
|
|
2648
|
+
avatarImageUrl: yt,
|
|
2649
|
+
idleLoopUrl: an,
|
|
2650
|
+
greeting: sn,
|
|
2617
2651
|
branding: m,
|
|
2618
2652
|
teamMembers: E,
|
|
2619
|
-
currentTeamMemberId:
|
|
2620
|
-
isSwitchingTeamMember:
|
|
2621
|
-
teamSwitcherOpen:
|
|
2622
|
-
onToggleTeamSwitcher: () =>
|
|
2623
|
-
onSelectTeamMember:
|
|
2653
|
+
currentTeamMemberId: X,
|
|
2654
|
+
isSwitchingTeamMember: he,
|
|
2655
|
+
teamSwitcherOpen: Fe,
|
|
2656
|
+
onToggleTeamSwitcher: () => Ue((h) => !h),
|
|
2657
|
+
onSelectTeamMember: on,
|
|
2624
2658
|
connectionState: g.connectionState,
|
|
2625
2659
|
agentState: g.agentState,
|
|
2626
2660
|
transcript: g.transcript,
|
|
2627
|
-
isMuted:
|
|
2628
|
-
micDevices:
|
|
2629
|
-
isCameraEnabled:
|
|
2630
|
-
cameraPreviewEl:
|
|
2631
|
-
cameraDevices:
|
|
2632
|
-
activeCameraId:
|
|
2633
|
-
isScreenShareEnabled:
|
|
2634
|
-
screenPreviewEl:
|
|
2635
|
-
isSpeakerMuted:
|
|
2661
|
+
isMuted: te.isMuted,
|
|
2662
|
+
micDevices: fe.mics,
|
|
2663
|
+
isCameraEnabled: le.isEnabled,
|
|
2664
|
+
cameraPreviewEl: le.previewEl,
|
|
2665
|
+
cameraDevices: fe.cameras,
|
|
2666
|
+
activeCameraId: le.activeDeviceId,
|
|
2667
|
+
isScreenShareEnabled: ae.isEnabled,
|
|
2668
|
+
screenPreviewEl: ae.previewEl,
|
|
2669
|
+
isSpeakerMuted: Pe,
|
|
2636
2670
|
allowCamera: R,
|
|
2637
|
-
allowScreenShare:
|
|
2638
|
-
allowTyping:
|
|
2639
|
-
languageMenuOpen:
|
|
2640
|
-
onToggleLanguageMenu: () =>
|
|
2641
|
-
needsUserGesture:
|
|
2671
|
+
allowScreenShare: W,
|
|
2672
|
+
allowTyping: z,
|
|
2673
|
+
languageMenuOpen: me,
|
|
2674
|
+
onToggleLanguageMenu: () => ge((h) => !h),
|
|
2675
|
+
needsUserGesture: Te,
|
|
2642
2676
|
canResume: g.canResume,
|
|
2643
|
-
micError:
|
|
2677
|
+
micError: te.micError,
|
|
2644
2678
|
error: g.error,
|
|
2645
|
-
avatarVideoContainerRef:
|
|
2679
|
+
avatarVideoContainerRef: St,
|
|
2646
2680
|
agentVideoEl: g.videoElement,
|
|
2647
|
-
micGateOpen: g.isControlled ? !0 :
|
|
2681
|
+
micGateOpen: g.isControlled ? !0 : Ye,
|
|
2648
2682
|
onConnect: () => void g.connect(),
|
|
2649
2683
|
onDisconnect: () => g.disconnect(),
|
|
2650
|
-
onRetry:
|
|
2651
|
-
onResumeAudio:
|
|
2652
|
-
onToggleMute:
|
|
2653
|
-
onToggleCamera: () => void
|
|
2654
|
-
onSwitchCameraDevice: (h) => void
|
|
2655
|
-
onToggleScreenShare: () => void
|
|
2656
|
-
onToggleSpeaker:
|
|
2657
|
-
onSendMessage:
|
|
2658
|
-
onMinimize:
|
|
2659
|
-
onClose:
|
|
2660
|
-
onClearMicError:
|
|
2684
|
+
onRetry: fn,
|
|
2685
|
+
onResumeAudio: un,
|
|
2686
|
+
onToggleMute: te.toggleMute,
|
|
2687
|
+
onToggleCamera: () => void le.toggle(),
|
|
2688
|
+
onSwitchCameraDevice: (h) => void le.switchDevice(h),
|
|
2689
|
+
onToggleScreenShare: () => void ae.toggle(),
|
|
2690
|
+
onToggleSpeaker: rn,
|
|
2691
|
+
onSendMessage: nn,
|
|
2692
|
+
onMinimize: dn,
|
|
2693
|
+
onClose: Et,
|
|
2694
|
+
onClearMicError: te.clearError
|
|
2661
2695
|
}
|
|
2662
2696
|
)
|
|
2663
2697
|
]
|
|
2664
2698
|
}
|
|
2665
2699
|
) : null;
|
|
2666
2700
|
}
|
|
2667
|
-
function
|
|
2668
|
-
return /* @__PURE__ */ n(
|
|
2701
|
+
function Or(e) {
|
|
2702
|
+
return /* @__PURE__ */ n(wn, { children: /* @__PURE__ */ n(Mr, { ...e }) });
|
|
2669
2703
|
}
|
|
2670
|
-
const
|
|
2704
|
+
const qr = ({
|
|
2671
2705
|
agentId: e,
|
|
2672
2706
|
baseUrl: t,
|
|
2673
2707
|
apiKey: r,
|
|
@@ -2676,15 +2710,15 @@ const Hr = ({
|
|
|
2676
2710
|
className: l,
|
|
2677
2711
|
style: c
|
|
2678
2712
|
}) => {
|
|
2679
|
-
const
|
|
2713
|
+
const u = A(null), f = A(null), y = A(o);
|
|
2680
2714
|
y.current = o;
|
|
2681
|
-
const b =
|
|
2682
|
-
var
|
|
2715
|
+
const b = k((s) => {
|
|
2716
|
+
var x;
|
|
2683
2717
|
const a = s.detail;
|
|
2684
|
-
(
|
|
2718
|
+
(x = y.current) == null || x.call(y, a);
|
|
2685
2719
|
}, []);
|
|
2686
2720
|
return N(() => {
|
|
2687
|
-
const s =
|
|
2721
|
+
const s = u.current;
|
|
2688
2722
|
if (!s) return;
|
|
2689
2723
|
const a = document.createElement("livelayer-widget");
|
|
2690
2724
|
return a.setAttribute("agent-id", e), t && a.setAttribute("base-url", t), r && a.setAttribute("api-key", r), i && a.setAttribute("mode", i), a.addEventListener("agent-event", b), s.appendChild(a), f.current = a, () => {
|
|
@@ -2692,13 +2726,13 @@ const Hr = ({
|
|
|
2692
2726
|
};
|
|
2693
2727
|
}, [e]), N(() => {
|
|
2694
2728
|
f.current && (i ? f.current.setAttribute("mode", i) : f.current.removeAttribute("mode"));
|
|
2695
|
-
}, [i]), /* @__PURE__ */ n("div", { ref:
|
|
2696
|
-
},
|
|
2697
|
-
function({ id: t, intent: r, as: i = "div", className: o, style: l, children: c },
|
|
2698
|
-
return
|
|
2729
|
+
}, [i]), /* @__PURE__ */ n("div", { ref: u, className: l, style: c });
|
|
2730
|
+
}, Br = _t(
|
|
2731
|
+
function({ id: t, intent: r, as: i = "div", className: o, style: l, children: c }, u) {
|
|
2732
|
+
return gn(
|
|
2699
2733
|
i,
|
|
2700
2734
|
{
|
|
2701
|
-
ref:
|
|
2735
|
+
ref: u,
|
|
2702
2736
|
"data-ll-region": t,
|
|
2703
2737
|
"data-ll-intent": r,
|
|
2704
2738
|
className: o,
|
|
@@ -2707,7 +2741,7 @@ const Hr = ({
|
|
|
2707
2741
|
c
|
|
2708
2742
|
);
|
|
2709
2743
|
}
|
|
2710
|
-
),
|
|
2744
|
+
), Wr = _t(
|
|
2711
2745
|
function({ id: t, intent: r, children: i, ...o }, l) {
|
|
2712
2746
|
return /* @__PURE__ */ n(
|
|
2713
2747
|
"form",
|
|
@@ -2720,13 +2754,13 @@ const Hr = ({
|
|
|
2720
2754
|
}
|
|
2721
2755
|
);
|
|
2722
2756
|
}
|
|
2723
|
-
),
|
|
2757
|
+
), Fr = _t(
|
|
2724
2758
|
function(t, r) {
|
|
2725
2759
|
const { name: i, label: o, labelClassName: l } = t, c = { name: i, "data-ll-field": i };
|
|
2726
|
-
let
|
|
2760
|
+
let u;
|
|
2727
2761
|
if ("as" in t && t.as === "textarea") {
|
|
2728
2762
|
const { name: f, label: y, labelClassName: b, as: s, ...a } = t;
|
|
2729
|
-
|
|
2763
|
+
u = /* @__PURE__ */ n(
|
|
2730
2764
|
"textarea",
|
|
2731
2765
|
{
|
|
2732
2766
|
ref: r,
|
|
@@ -2735,19 +2769,19 @@ const Hr = ({
|
|
|
2735
2769
|
}
|
|
2736
2770
|
);
|
|
2737
2771
|
} else if ("as" in t && t.as === "select") {
|
|
2738
|
-
const { name: f, label: y, labelClassName: b, as: s, children: a, ...
|
|
2739
|
-
|
|
2772
|
+
const { name: f, label: y, labelClassName: b, as: s, children: a, ...x } = t;
|
|
2773
|
+
u = /* @__PURE__ */ n(
|
|
2740
2774
|
"select",
|
|
2741
2775
|
{
|
|
2742
2776
|
ref: r,
|
|
2743
2777
|
...c,
|
|
2744
|
-
...
|
|
2778
|
+
...x,
|
|
2745
2779
|
children: a
|
|
2746
2780
|
}
|
|
2747
2781
|
);
|
|
2748
2782
|
} else {
|
|
2749
2783
|
const { name: f, label: y, labelClassName: b, as: s, ...a } = t;
|
|
2750
|
-
|
|
2784
|
+
u = /* @__PURE__ */ n(
|
|
2751
2785
|
"input",
|
|
2752
2786
|
{
|
|
2753
2787
|
ref: r,
|
|
@@ -2756,20 +2790,20 @@ const Hr = ({
|
|
|
2756
2790
|
}
|
|
2757
2791
|
);
|
|
2758
2792
|
}
|
|
2759
|
-
return o === void 0 ?
|
|
2793
|
+
return o === void 0 ? u : /* @__PURE__ */ _("label", { className: l, children: [
|
|
2760
2794
|
o,
|
|
2761
|
-
|
|
2795
|
+
u
|
|
2762
2796
|
] });
|
|
2763
2797
|
}
|
|
2764
2798
|
);
|
|
2765
|
-
let
|
|
2766
|
-
function
|
|
2799
|
+
let Zt = 1;
|
|
2800
|
+
function Ur({
|
|
2767
2801
|
onMount: e,
|
|
2768
2802
|
defaultOpen: t = !1,
|
|
2769
2803
|
storageKey: r = "ll-debug-open"
|
|
2770
2804
|
}) {
|
|
2771
|
-
const [i, o] =
|
|
2772
|
-
|
|
2805
|
+
const [i, o] = L(t), [l, c] = L([]), [u, f] = L(""), [y, b] = L(!1), s = A(/* @__PURE__ */ new Set()), a = A([]), x = A(y);
|
|
2806
|
+
x.current = y, N(() => {
|
|
2773
2807
|
try {
|
|
2774
2808
|
const v = localStorage.getItem(r);
|
|
2775
2809
|
v === "1" && o(!0), v === "0" && o(!1);
|
|
@@ -2782,15 +2816,15 @@ function Wr({
|
|
|
2782
2816
|
}
|
|
2783
2817
|
}, [i, r]), N(() => {
|
|
2784
2818
|
const v = (w) => {
|
|
2785
|
-
(w.metaKey || w.ctrlKey) && w.shiftKey && w.key.toLowerCase() === "l" && (w.preventDefault(), o((
|
|
2819
|
+
(w.metaKey || w.ctrlKey) && w.shiftKey && w.key.toLowerCase() === "l" && (w.preventDefault(), o((O) => !O));
|
|
2786
2820
|
};
|
|
2787
2821
|
return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
|
|
2788
2822
|
}, []), N(() => {
|
|
2789
2823
|
const v = setInterval(() => {
|
|
2790
|
-
if (a.current.length === 0 ||
|
|
2824
|
+
if (a.current.length === 0 || x.current) return;
|
|
2791
2825
|
const w = a.current.splice(0, a.current.length);
|
|
2792
2826
|
c(
|
|
2793
|
-
(
|
|
2827
|
+
(O) => [...w.reverse(), ...O].slice(0, 200)
|
|
2794
2828
|
);
|
|
2795
2829
|
}, 100);
|
|
2796
2830
|
return () => clearInterval(v);
|
|
@@ -2799,7 +2833,7 @@ function Wr({
|
|
|
2799
2833
|
if (N(() => {
|
|
2800
2834
|
!e || E.current || (E.current = !0, e((v) => {
|
|
2801
2835
|
a.current.push({
|
|
2802
|
-
id:
|
|
2836
|
+
id: Zt++,
|
|
2803
2837
|
ts: Date.now(),
|
|
2804
2838
|
kind: "event",
|
|
2805
2839
|
type: v.eventName,
|
|
@@ -2807,21 +2841,21 @@ function Wr({
|
|
|
2807
2841
|
});
|
|
2808
2842
|
}));
|
|
2809
2843
|
}, [e]), N(() => {
|
|
2810
|
-
const v = console.warn, w = console.log,
|
|
2844
|
+
const v = console.warn, w = console.log, O = (I, q) => function(...m) {
|
|
2811
2845
|
try {
|
|
2812
2846
|
const R = typeof m[0] == "string" ? m[0] : "";
|
|
2813
2847
|
R.startsWith("[LiveLayer]") && a.current.push({
|
|
2814
|
-
id:
|
|
2848
|
+
id: Zt++,
|
|
2815
2849
|
ts: Date.now(),
|
|
2816
2850
|
kind: I,
|
|
2817
2851
|
type: R.slice(0, 120),
|
|
2818
|
-
data: { args: m.slice(1).map((
|
|
2852
|
+
data: { args: m.slice(1).map((W) => Tr(W)) }
|
|
2819
2853
|
});
|
|
2820
2854
|
} catch {
|
|
2821
2855
|
}
|
|
2822
|
-
return
|
|
2856
|
+
return q.apply(this, m);
|
|
2823
2857
|
};
|
|
2824
|
-
return console.warn =
|
|
2858
|
+
return console.warn = O("warn", v), console.log = O("log", w), () => {
|
|
2825
2859
|
console.warn = v, console.log = w;
|
|
2826
2860
|
};
|
|
2827
2861
|
}, []), !i)
|
|
@@ -2852,8 +2886,8 @@ function Wr({
|
|
|
2852
2886
|
}
|
|
2853
2887
|
);
|
|
2854
2888
|
const C = l.filter((v) => {
|
|
2855
|
-
if (!
|
|
2856
|
-
const w =
|
|
2889
|
+
if (!u) return !0;
|
|
2890
|
+
const w = u.toLowerCase();
|
|
2857
2891
|
return v.type.toLowerCase().includes(w) || JSON.stringify(v.data || {}).toLowerCase().includes(w);
|
|
2858
2892
|
});
|
|
2859
2893
|
return /* @__PURE__ */ _(
|
|
@@ -2902,7 +2936,7 @@ function Wr({
|
|
|
2902
2936
|
{
|
|
2903
2937
|
type: "button",
|
|
2904
2938
|
onClick: () => b((v) => !v),
|
|
2905
|
-
style:
|
|
2939
|
+
style: bt(y ? "#f59e0b" : "transparent"),
|
|
2906
2940
|
title: "Pause / resume capture",
|
|
2907
2941
|
children: y ? "▶ resume" : "⏸ pause"
|
|
2908
2942
|
}
|
|
@@ -2914,7 +2948,7 @@ function Wr({
|
|
|
2914
2948
|
onClick: () => {
|
|
2915
2949
|
c([]), a.current = [];
|
|
2916
2950
|
},
|
|
2917
|
-
style:
|
|
2951
|
+
style: bt("transparent"),
|
|
2918
2952
|
title: "Clear buffer",
|
|
2919
2953
|
children: "clear"
|
|
2920
2954
|
}
|
|
@@ -2924,7 +2958,7 @@ function Wr({
|
|
|
2924
2958
|
{
|
|
2925
2959
|
type: "button",
|
|
2926
2960
|
onClick: () => o(!1),
|
|
2927
|
-
style:
|
|
2961
|
+
style: bt("transparent"),
|
|
2928
2962
|
"aria-label": "Close",
|
|
2929
2963
|
title: "Close (Cmd/Ctrl + Shift + L)",
|
|
2930
2964
|
children: "✕"
|
|
@@ -2937,7 +2971,7 @@ function Wr({
|
|
|
2937
2971
|
"input",
|
|
2938
2972
|
{
|
|
2939
2973
|
type: "text",
|
|
2940
|
-
value:
|
|
2974
|
+
value: u,
|
|
2941
2975
|
onChange: (v) => f(v.target.value),
|
|
2942
2976
|
placeholder: "filter by type or data…",
|
|
2943
2977
|
style: {
|
|
@@ -2991,7 +3025,7 @@ function Wr({
|
|
|
2991
3025
|
]
|
|
2992
3026
|
}
|
|
2993
3027
|
) : C.map((v) => /* @__PURE__ */ n(
|
|
2994
|
-
|
|
3028
|
+
Ir,
|
|
2995
3029
|
{
|
|
2996
3030
|
entry: v,
|
|
2997
3031
|
expanded: s.current.has(v.id),
|
|
@@ -3007,7 +3041,7 @@ function Wr({
|
|
|
3007
3041
|
}
|
|
3008
3042
|
);
|
|
3009
3043
|
}
|
|
3010
|
-
function
|
|
3044
|
+
function Ir({
|
|
3011
3045
|
entry: e,
|
|
3012
3046
|
expanded: t,
|
|
3013
3047
|
onToggle: r
|
|
@@ -3077,7 +3111,7 @@ function Rr({
|
|
|
3077
3111
|
}
|
|
3078
3112
|
);
|
|
3079
3113
|
}
|
|
3080
|
-
function
|
|
3114
|
+
function bt(e) {
|
|
3081
3115
|
return {
|
|
3082
3116
|
background: e,
|
|
3083
3117
|
color: "#fff",
|
|
@@ -3088,24 +3122,24 @@ function yt(e) {
|
|
|
3088
3122
|
cursor: "pointer"
|
|
3089
3123
|
};
|
|
3090
3124
|
}
|
|
3091
|
-
function
|
|
3125
|
+
function Tr(e) {
|
|
3092
3126
|
try {
|
|
3093
3127
|
return e instanceof Error ? { message: e.message, stack: e.stack } : (JSON.stringify(e), e);
|
|
3094
3128
|
} catch {
|
|
3095
3129
|
return String(e);
|
|
3096
3130
|
}
|
|
3097
3131
|
}
|
|
3098
|
-
function
|
|
3099
|
-
const [e, t] =
|
|
3132
|
+
function jr() {
|
|
3133
|
+
const [e, t] = L([]), r = k((o) => {
|
|
3100
3134
|
t((l) => {
|
|
3101
|
-
const c = l.findIndex((
|
|
3135
|
+
const c = l.findIndex((u) => u.id === o.id);
|
|
3102
3136
|
if (c >= 0) {
|
|
3103
|
-
const
|
|
3104
|
-
return
|
|
3137
|
+
const u = l.slice();
|
|
3138
|
+
return u[c] = o, u;
|
|
3105
3139
|
}
|
|
3106
3140
|
return [...l, o];
|
|
3107
3141
|
});
|
|
3108
|
-
}, []), i =
|
|
3142
|
+
}, []), i = k(() => t([]), []);
|
|
3109
3143
|
return {
|
|
3110
3144
|
entries: e,
|
|
3111
3145
|
pushSegment: r,
|
|
@@ -3114,33 +3148,33 @@ function Fr() {
|
|
|
3114
3148
|
};
|
|
3115
3149
|
}
|
|
3116
3150
|
export {
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3151
|
+
Or as AvatarWidget,
|
|
3152
|
+
wn as ErrorBoundary,
|
|
3153
|
+
Ur as LiveLayerDebugPanel,
|
|
3154
|
+
Fr as LiveLayerField,
|
|
3155
|
+
Wr as LiveLayerForm,
|
|
3156
|
+
Br as LiveLayerRegion,
|
|
3157
|
+
qr as LiveLayerWidget,
|
|
3158
|
+
gr as clearPageContextCache,
|
|
3159
|
+
xr as clearRoutesCache,
|
|
3160
|
+
mr as extractPageContext,
|
|
3161
|
+
wr as extractRoutes,
|
|
3128
3162
|
Gt as getCachedPageContext,
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3163
|
+
vt as getCachedRoutes,
|
|
3164
|
+
Fn as matchesPattern,
|
|
3165
|
+
vr as normalizeRouteInput,
|
|
3166
|
+
Un as shouldRenderAtPath,
|
|
3167
|
+
Nn as useAgentInfo,
|
|
3168
|
+
xn as useAudioLevel,
|
|
3169
|
+
Sn as useCameraState,
|
|
3170
|
+
Mn as useDisplayMode,
|
|
3171
|
+
Pn as useDisplayModePersistence,
|
|
3172
|
+
$n as useIsMobile,
|
|
3173
|
+
_n as useLiveKitSession,
|
|
3174
|
+
En as useMediaDevices,
|
|
3175
|
+
kn as useMicrophoneState,
|
|
3176
|
+
Hn as usePathname,
|
|
3177
|
+
jn as useRouteMatch,
|
|
3178
|
+
Cn as useScreenShareState,
|
|
3179
|
+
jr as useTranscript
|
|
3146
3180
|
};
|