@livelayer/react 0.5.11 → 0.5.13
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 +590 -576
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -13,8 +13,8 @@ class mn extends dn {
|
|
|
13
13
|
return { hasError: !0, error: t };
|
|
14
14
|
}
|
|
15
15
|
componentDidCatch(t, r) {
|
|
16
|
-
var
|
|
17
|
-
(
|
|
16
|
+
var i, o;
|
|
17
|
+
(o = (i = this.props).onError) == null || o.call(i, t, r);
|
|
18
18
|
}
|
|
19
19
|
render() {
|
|
20
20
|
var t;
|
|
@@ -34,16 +34,16 @@ class mn extends dn {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
function gn(e) {
|
|
37
|
-
const [t, r] = L("idle"), [
|
|
37
|
+
const [t, r] = L("idle"), [i, o] = L("idle"), [l, c] = L([]), [d, f] = L(null), [y, g] = L(null), [a, s] = L(null), [I, C] = L(!1), [S, v] = L(null), b = E(null), z = E(e.onDataMessage);
|
|
38
38
|
z.current = e.onDataMessage, R(() => {
|
|
39
39
|
const N = {
|
|
40
40
|
onConnectionStateChange: (D) => {
|
|
41
41
|
r(D), D === "connected" && v(null);
|
|
42
42
|
},
|
|
43
|
-
onAgentStateChange:
|
|
44
|
-
onTranscript: (D) =>
|
|
43
|
+
onAgentStateChange: o,
|
|
44
|
+
onTranscript: (D) => c([...D]),
|
|
45
45
|
onAgentConfig: f,
|
|
46
|
-
onAudioTrack: (D) =>
|
|
46
|
+
onAudioTrack: (D) => s(D),
|
|
47
47
|
onVideoTrack: (D) => g(D),
|
|
48
48
|
onVideoTrackRemoved: () => g(null),
|
|
49
49
|
onError: (D) => v(D),
|
|
@@ -62,7 +62,7 @@ function gn(e) {
|
|
|
62
62
|
},
|
|
63
63
|
N
|
|
64
64
|
);
|
|
65
|
-
return b.current = q, r("idle"),
|
|
65
|
+
return b.current = q, r("idle"), o("idle"), c([]), f(null), g(null), s(null), C(!1), v(null), () => {
|
|
66
66
|
var D;
|
|
67
67
|
(D = q.destroy) == null || D.call(q), b.current = null;
|
|
68
68
|
};
|
|
@@ -90,7 +90,7 @@ function gn(e) {
|
|
|
90
90
|
}, []);
|
|
91
91
|
return {
|
|
92
92
|
connectionState: t,
|
|
93
|
-
agentState:
|
|
93
|
+
agentState: i,
|
|
94
94
|
transcript: l,
|
|
95
95
|
agentConfig: d,
|
|
96
96
|
videoElement: y,
|
|
@@ -104,31 +104,31 @@ function gn(e) {
|
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
function yn() {
|
|
107
|
-
const e = E(null), t = E(null), r = E(null),
|
|
107
|
+
const e = E(null), t = E(null), r = E(null), i = E(null), o = E(/* @__PURE__ */ new Set()), l = E(null), c = k(() => {
|
|
108
108
|
const a = t.current;
|
|
109
109
|
if (!a) {
|
|
110
|
-
|
|
110
|
+
i.current = null;
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
113
|
(!l.current || l.current.length !== a.frequencyBinCount) && (l.current = new Uint8Array(
|
|
114
114
|
new ArrayBuffer(a.frequencyBinCount)
|
|
115
115
|
));
|
|
116
|
-
const
|
|
117
|
-
a.getByteFrequencyData(
|
|
116
|
+
const s = l.current;
|
|
117
|
+
a.getByteFrequencyData(s);
|
|
118
118
|
let I = 0;
|
|
119
|
-
for (let S = 0; S <
|
|
120
|
-
const C = I /
|
|
121
|
-
for (const S of
|
|
119
|
+
for (let S = 0; S < s.length; S++) I += s[S];
|
|
120
|
+
const C = I / s.length / 255;
|
|
121
|
+
for (const S of o.current)
|
|
122
122
|
try {
|
|
123
123
|
S(C);
|
|
124
124
|
} catch (v) {
|
|
125
125
|
console.error("[useAudioLevel] subscriber threw:", v);
|
|
126
126
|
}
|
|
127
|
-
|
|
127
|
+
i.current = requestAnimationFrame(c);
|
|
128
128
|
}, []), d = k(() => {
|
|
129
129
|
if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
|
|
130
|
-
const a = new AudioContext(),
|
|
131
|
-
|
|
130
|
+
const a = new AudioContext(), s = a.createAnalyser();
|
|
131
|
+
s.fftSize = 64, s.connect(a.destination), e.current = a, t.current = s;
|
|
132
132
|
}, []), f = k(
|
|
133
133
|
(a) => {
|
|
134
134
|
if (d(), !(!e.current || !t.current)) {
|
|
@@ -140,26 +140,26 @@ function yn() {
|
|
|
140
140
|
r.current = null;
|
|
141
141
|
}
|
|
142
142
|
try {
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
} catch (
|
|
146
|
-
console.warn("[useAudioLevel] createMediaElementSource failed:",
|
|
143
|
+
const s = e.current.createMediaElementSource(a);
|
|
144
|
+
s.connect(t.current), r.current = s;
|
|
145
|
+
} catch (s) {
|
|
146
|
+
console.warn("[useAudioLevel] createMediaElementSource failed:", s);
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
|
-
|
|
149
|
+
i.current === null && (i.current = requestAnimationFrame(c));
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
|
-
[d,
|
|
152
|
+
[d, c]
|
|
153
153
|
), y = k(() => {
|
|
154
|
-
if (
|
|
154
|
+
if (i.current !== null && (cancelAnimationFrame(i.current), i.current = null), r.current) {
|
|
155
155
|
try {
|
|
156
156
|
r.current.disconnect();
|
|
157
157
|
} catch {
|
|
158
158
|
}
|
|
159
159
|
r.current = null;
|
|
160
160
|
}
|
|
161
|
-
}, []), g = k((a) => (
|
|
162
|
-
|
|
161
|
+
}, []), g = k((a) => (o.current.add(a), () => {
|
|
162
|
+
o.current.delete(a);
|
|
163
163
|
}), []);
|
|
164
164
|
return R(() => () => {
|
|
165
165
|
if (y(), t.current) {
|
|
@@ -176,34 +176,34 @@ function yn() {
|
|
|
176
176
|
}
|
|
177
177
|
e.current = null;
|
|
178
178
|
}
|
|
179
|
-
|
|
179
|
+
o.current.clear(), l.current = null;
|
|
180
180
|
}, [y]), { attach: f, detach: y, subscribe: g };
|
|
181
181
|
}
|
|
182
182
|
function vn() {
|
|
183
|
-
const [e, t] = L(!1), [r,
|
|
184
|
-
if (
|
|
183
|
+
const [e, t] = L(!1), [r, i] = L(null), o = E(null), l = E(null), c = k(async (g) => {
|
|
184
|
+
if (o.current && l.current) {
|
|
185
185
|
try {
|
|
186
|
-
await l.current.localParticipant.unpublishTrack(
|
|
186
|
+
await l.current.localParticipant.unpublishTrack(o.current);
|
|
187
187
|
} catch {
|
|
188
188
|
}
|
|
189
|
-
|
|
189
|
+
o.current.stop(), o.current = null;
|
|
190
190
|
}
|
|
191
|
-
l.current = g,
|
|
191
|
+
l.current = g, i(null);
|
|
192
192
|
try {
|
|
193
193
|
const a = await pn({
|
|
194
194
|
echoCancellation: !0,
|
|
195
195
|
noiseSuppression: !0
|
|
196
196
|
});
|
|
197
|
-
await g.localParticipant.publishTrack(a),
|
|
197
|
+
await g.localParticipant.publishTrack(a), o.current = a, t(a.isMuted);
|
|
198
198
|
} catch (a) {
|
|
199
|
-
const
|
|
200
|
-
throw
|
|
199
|
+
const s = a instanceof Error && a.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
|
|
200
|
+
throw i(s), a;
|
|
201
201
|
}
|
|
202
202
|
}, []), d = k(() => {
|
|
203
|
-
const g =
|
|
203
|
+
const g = o.current;
|
|
204
204
|
g && (g.isMuted ? (g.unmute(), t(!1)) : (g.mute(), t(!0)));
|
|
205
205
|
}, []), f = k(() => {
|
|
206
|
-
const g =
|
|
206
|
+
const g = o.current, a = l.current;
|
|
207
207
|
if (g && a) {
|
|
208
208
|
try {
|
|
209
209
|
a.localParticipant.unpublishTrack(g);
|
|
@@ -211,20 +211,20 @@ function vn() {
|
|
|
211
211
|
}
|
|
212
212
|
g.stop();
|
|
213
213
|
}
|
|
214
|
-
|
|
215
|
-
}, []), y = k(() =>
|
|
214
|
+
o.current = null, l.current = null, t(!1);
|
|
215
|
+
}, []), y = k(() => i(null), []);
|
|
216
216
|
return {
|
|
217
217
|
isMuted: e,
|
|
218
218
|
micError: r,
|
|
219
219
|
toggleMute: d,
|
|
220
|
-
setupMic:
|
|
220
|
+
setupMic: c,
|
|
221
221
|
teardownMic: f,
|
|
222
222
|
clearError: y
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
225
|
const bn = { resolution: { width: 640, height: 480, frameRate: 24 } };
|
|
226
226
|
function wn() {
|
|
227
|
-
const [e, t] = L(!1), [r,
|
|
227
|
+
const [e, t] = L(!1), [r, i] = L(null), [o, l] = L(null), [c, d] = L(""), f = E(null), y = E(null), g = k((b) => {
|
|
228
228
|
f.current = b;
|
|
229
229
|
}, []), a = k(() => {
|
|
230
230
|
const b = f.current, z = y.current;
|
|
@@ -240,10 +240,10 @@ function wn() {
|
|
|
240
240
|
z.stop();
|
|
241
241
|
}
|
|
242
242
|
y.current = null, l(null), t(!1);
|
|
243
|
-
}, []),
|
|
243
|
+
}, []), s = k(async (b) => {
|
|
244
244
|
const z = f.current;
|
|
245
245
|
if (z) {
|
|
246
|
-
|
|
246
|
+
i(null);
|
|
247
247
|
try {
|
|
248
248
|
const M = { ...bn };
|
|
249
249
|
b && (M.deviceId = b);
|
|
@@ -260,23 +260,23 @@ function wn() {
|
|
|
260
260
|
}
|
|
261
261
|
} catch (M) {
|
|
262
262
|
const H = M instanceof Error && M.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
|
|
263
|
-
|
|
263
|
+
i(H);
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
}, []), I = k(async () => {
|
|
267
|
-
e ? a() : await c
|
|
268
|
-
}, [e,
|
|
269
|
-
a(), await
|
|
270
|
-
}, [a,
|
|
271
|
-
a(), f.current = null,
|
|
272
|
-
}, [a]), v = k(() =>
|
|
267
|
+
e ? a() : await s(c || void 0);
|
|
268
|
+
}, [e, c, a, s]), C = k(async (b) => {
|
|
269
|
+
a(), await s(b);
|
|
270
|
+
}, [a, s]), S = k(() => {
|
|
271
|
+
a(), f.current = null, i(null), d("");
|
|
272
|
+
}, [a]), v = k(() => i(null), []);
|
|
273
273
|
return R(() => () => {
|
|
274
274
|
y.current && y.current.stop();
|
|
275
275
|
}, []), {
|
|
276
276
|
isEnabled: e,
|
|
277
277
|
error: r,
|
|
278
|
-
previewEl:
|
|
279
|
-
activeDeviceId:
|
|
278
|
+
previewEl: o,
|
|
279
|
+
activeDeviceId: c,
|
|
280
280
|
toggle: I,
|
|
281
281
|
switchDevice: C,
|
|
282
282
|
attachRoom: g,
|
|
@@ -285,30 +285,30 @@ function wn() {
|
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
287
|
function _n() {
|
|
288
|
-
const [e, t] = L(!1), [r,
|
|
289
|
-
|
|
288
|
+
const [e, t] = L(!1), [r, i] = L(null), [o, l] = L(null), c = E(null), d = k((s) => {
|
|
289
|
+
c.current = s;
|
|
290
290
|
}, []), f = k(() => l(null), []), y = k(async () => {
|
|
291
|
-
const
|
|
292
|
-
if (
|
|
291
|
+
const s = c.current;
|
|
292
|
+
if (s) {
|
|
293
293
|
if (e) {
|
|
294
294
|
try {
|
|
295
|
-
await
|
|
295
|
+
await s.localParticipant.setScreenShareEnabled(!1);
|
|
296
296
|
} catch {
|
|
297
297
|
}
|
|
298
298
|
f(), t(!1);
|
|
299
299
|
return;
|
|
300
300
|
}
|
|
301
|
-
|
|
301
|
+
i(null);
|
|
302
302
|
try {
|
|
303
|
-
await
|
|
303
|
+
await s.localParticipant.setScreenShareEnabled(!0);
|
|
304
304
|
let I = 0;
|
|
305
305
|
const C = () => {
|
|
306
|
-
const S =
|
|
306
|
+
const S = s.localParticipant.getTrackPublication(Gt.Source.ScreenShare);
|
|
307
307
|
if (S != null && S.track) {
|
|
308
308
|
const v = S.track.attach();
|
|
309
309
|
l(v), t(!0);
|
|
310
310
|
try {
|
|
311
|
-
|
|
311
|
+
s.localParticipant.publishData(
|
|
312
312
|
new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
|
|
313
313
|
{ reliable: !0 }
|
|
314
314
|
);
|
|
@@ -321,57 +321,57 @@ function _n() {
|
|
|
321
321
|
C();
|
|
322
322
|
} catch (I) {
|
|
323
323
|
const C = I instanceof Error ? I.name : "";
|
|
324
|
-
C !== "NotAllowedError" && C !== "AbortError" &&
|
|
324
|
+
C !== "NotAllowedError" && C !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
}, [e, f]), g = k(() => {
|
|
328
|
-
const
|
|
329
|
-
if (
|
|
328
|
+
const s = c.current;
|
|
329
|
+
if (s && e)
|
|
330
330
|
try {
|
|
331
|
-
|
|
331
|
+
s.localParticipant.setScreenShareEnabled(!1);
|
|
332
332
|
} catch {
|
|
333
333
|
}
|
|
334
|
-
f(), t(!1),
|
|
335
|
-
}, [e, f]), a = k(() =>
|
|
336
|
-
return { isEnabled: e, error: r, previewEl:
|
|
334
|
+
f(), t(!1), i(null), c.current = null;
|
|
335
|
+
}, [e, f]), a = k(() => i(null), []);
|
|
336
|
+
return { isEnabled: e, error: r, previewEl: o, toggle: y, attachRoom: d, teardown: g, clearError: a };
|
|
337
337
|
}
|
|
338
338
|
function xn() {
|
|
339
|
-
const [e, t] = L([]), [r,
|
|
339
|
+
const [e, t] = L([]), [r, i] = L([]), o = k(async () => {
|
|
340
340
|
if (!(typeof navigator > "u" || !navigator.mediaDevices))
|
|
341
341
|
try {
|
|
342
342
|
const l = await navigator.mediaDevices.enumerateDevices();
|
|
343
|
-
t(l.filter((
|
|
343
|
+
t(l.filter((c) => c.kind === "audioinput")), i(l.filter((c) => c.kind === "videoinput"));
|
|
344
344
|
} catch {
|
|
345
345
|
}
|
|
346
346
|
}, []);
|
|
347
347
|
return R(() => {
|
|
348
|
-
if (
|
|
349
|
-
const l = () => void
|
|
348
|
+
if (o(), typeof navigator > "u" || !navigator.mediaDevices) return;
|
|
349
|
+
const l = () => void o();
|
|
350
350
|
return navigator.mediaDevices.addEventListener("devicechange", l), () => navigator.mediaDevices.removeEventListener("devicechange", l);
|
|
351
|
-
}, [
|
|
351
|
+
}, [o]), { mics: e, cameras: r, refresh: o };
|
|
352
352
|
}
|
|
353
353
|
function kn(e, t, r = !1) {
|
|
354
|
-
const [
|
|
354
|
+
const [i, o] = L(null), [l, c] = L(null), [d, f] = L(!r && !!e);
|
|
355
355
|
return R(() => {
|
|
356
356
|
if (r || !e) {
|
|
357
357
|
f(!1);
|
|
358
358
|
return;
|
|
359
359
|
}
|
|
360
360
|
const y = new AbortController(), g = t || "https://app.livelayer.studio";
|
|
361
|
-
return f(!0),
|
|
361
|
+
return f(!0), c(null), fetch(`${g}/api/widget/agent/${encodeURIComponent(e)}`, {
|
|
362
362
|
signal: y.signal
|
|
363
363
|
}).then(async (a) => {
|
|
364
364
|
if (!a.ok) {
|
|
365
|
-
const
|
|
366
|
-
throw new Error(
|
|
365
|
+
const s = await a.json().catch(() => ({}));
|
|
366
|
+
throw new Error(s.error || `HTTP ${a.status}`);
|
|
367
367
|
}
|
|
368
368
|
return a.json();
|
|
369
369
|
}).then((a) => {
|
|
370
|
-
y.signal.aborted || (
|
|
370
|
+
y.signal.aborted || (o(a), f(!1));
|
|
371
371
|
}).catch((a) => {
|
|
372
|
-
y.signal.aborted || (
|
|
372
|
+
y.signal.aborted || (c(a instanceof Error ? a.message : "Agent lookup failed"), f(!1));
|
|
373
373
|
}), () => y.abort();
|
|
374
|
-
}, [e, t, r]), { info:
|
|
374
|
+
}, [e, t, r]), { info: i, error: l, loading: d };
|
|
375
375
|
}
|
|
376
376
|
function Ln(e) {
|
|
377
377
|
if (typeof window > "u") return null;
|
|
@@ -393,13 +393,13 @@ function Cn({
|
|
|
393
393
|
defaultValue: t = "expanded",
|
|
394
394
|
onChange: r
|
|
395
395
|
} = {}) {
|
|
396
|
-
const
|
|
396
|
+
const i = e !== void 0, [o, l] = L(t), c = i ? e : o, d = k(
|
|
397
397
|
(f) => {
|
|
398
|
-
f !==
|
|
398
|
+
f !== c && (i || l(f), r == null || r(f));
|
|
399
399
|
},
|
|
400
|
-
[
|
|
400
|
+
[c, i, r]
|
|
401
401
|
);
|
|
402
|
-
return [
|
|
402
|
+
return [c, d];
|
|
403
403
|
}
|
|
404
404
|
const En = ["hidden", "minimized", "expanded"];
|
|
405
405
|
function Nn(e) {
|
|
@@ -409,18 +409,18 @@ function An({
|
|
|
409
409
|
value: e,
|
|
410
410
|
defaultValue: t = "expanded",
|
|
411
411
|
onChange: r,
|
|
412
|
-
persistKey:
|
|
413
|
-
disablePersistence:
|
|
412
|
+
persistKey: i = "ll-widget",
|
|
413
|
+
disablePersistence: o = !1
|
|
414
414
|
} = {}) {
|
|
415
|
-
const l = `${
|
|
415
|
+
const l = `${i}:display-mode`, c = E(!1), [d, f] = Cn({
|
|
416
416
|
value: e,
|
|
417
417
|
defaultValue: t,
|
|
418
418
|
onChange: (y) => {
|
|
419
|
-
e === void 0 && !
|
|
419
|
+
e === void 0 && !o && Sn(l, y), r == null || r(y);
|
|
420
420
|
}
|
|
421
421
|
});
|
|
422
422
|
return R(() => {
|
|
423
|
-
if (
|
|
423
|
+
if (c.current || (c.current = !0, o || e !== void 0)) return;
|
|
424
424
|
const y = Nn(Ln(l));
|
|
425
425
|
y && y !== d && f(y);
|
|
426
426
|
}, []), [d, f];
|
|
@@ -435,22 +435,22 @@ function In(e = Rn) {
|
|
|
435
435
|
}
|
|
436
436
|
if (typeof window > "u" || typeof window.matchMedia > "u")
|
|
437
437
|
return;
|
|
438
|
-
const
|
|
439
|
-
return l(), typeof
|
|
440
|
-
|
|
438
|
+
const i = `(max-width: ${e - 1}px)`, o = window.matchMedia(i), l = () => r(o.matches);
|
|
439
|
+
return l(), typeof o.addEventListener == "function" ? (o.addEventListener("change", l), () => o.removeEventListener("change", l)) : (o.addListener(l), () => {
|
|
440
|
+
o.removeListener(l);
|
|
441
441
|
});
|
|
442
442
|
}, [e]), t;
|
|
443
443
|
}
|
|
444
|
-
const It = "__llHistoryPatched",
|
|
444
|
+
const It = "__llHistoryPatched", lt = "ll:pathname";
|
|
445
445
|
function Mn() {
|
|
446
446
|
if (typeof window > "u" || window.history[It]) return;
|
|
447
447
|
const e = window.history.pushState, t = window.history.replaceState;
|
|
448
448
|
window.history.pushState = function(...r) {
|
|
449
|
-
const
|
|
450
|
-
return window.dispatchEvent(new Event(
|
|
449
|
+
const i = e.apply(this, r);
|
|
450
|
+
return window.dispatchEvent(new Event(lt)), i;
|
|
451
451
|
}, window.history.replaceState = function(...r) {
|
|
452
|
-
const
|
|
453
|
-
return window.dispatchEvent(new Event(
|
|
452
|
+
const i = t.apply(this, r);
|
|
453
|
+
return window.dispatchEvent(new Event(lt)), i;
|
|
454
454
|
}, window.history[It] = !0;
|
|
455
455
|
}
|
|
456
456
|
function Mt() {
|
|
@@ -463,9 +463,9 @@ function Tn(e) {
|
|
|
463
463
|
return R(() => {
|
|
464
464
|
if (e !== void 0) return;
|
|
465
465
|
Mn();
|
|
466
|
-
const
|
|
467
|
-
return
|
|
468
|
-
window.removeEventListener("popstate",
|
|
466
|
+
const i = () => r(Mt());
|
|
467
|
+
return i(), window.addEventListener("popstate", i), window.addEventListener(lt, i), () => {
|
|
468
|
+
window.removeEventListener("popstate", i), window.removeEventListener(lt, i);
|
|
469
469
|
};
|
|
470
470
|
}, [e]), e ?? t;
|
|
471
471
|
}
|
|
@@ -476,7 +476,7 @@ function Dn(e) {
|
|
|
476
476
|
function $n(e) {
|
|
477
477
|
const t = Tt.get(e);
|
|
478
478
|
if (t) return t;
|
|
479
|
-
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e,
|
|
479
|
+
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", o = "", l = r.replace(/\*\*/g, i).replace(/\*/g, o), d = Dn(l).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(o, "g"), "[^/]+"), f = new RegExp(`^${d}\\/?$`);
|
|
480
480
|
return Tt.set(e, f), f;
|
|
481
481
|
}
|
|
482
482
|
function zn(e, t) {
|
|
@@ -620,24 +620,24 @@ const Vn = ({
|
|
|
620
620
|
position: e,
|
|
621
621
|
isMobile: t,
|
|
622
622
|
isSpeaking: r,
|
|
623
|
-
onExpand:
|
|
624
|
-
label:
|
|
623
|
+
onExpand: i,
|
|
624
|
+
label: o = "Open widget",
|
|
625
625
|
avatarImageUrl: l,
|
|
626
|
-
agentName:
|
|
626
|
+
agentName: c
|
|
627
627
|
}) => {
|
|
628
|
-
const d = Fn(e), f = d === "right" ? "left" : "right", y = t ? 80 : 72, g = !!l, [a,
|
|
628
|
+
const d = Fn(e), f = d === "right" ? "left" : "right", y = t ? 80 : 72, g = !!l, [a, s] = L(null), [I, C] = L(!1), S = E(null), v = E(!1), b = k(
|
|
629
629
|
(A) => {
|
|
630
630
|
if (typeof window > "u") return A;
|
|
631
|
-
const O = y / 2, W = Ht + O,
|
|
632
|
-
return
|
|
631
|
+
const O = y / 2, W = Ht + O, G = window.innerHeight - Ht - O;
|
|
632
|
+
return G < W ? Math.max(W, A) : Math.max(W, Math.min(G, A));
|
|
633
633
|
},
|
|
634
634
|
[y]
|
|
635
635
|
);
|
|
636
636
|
R(() => {
|
|
637
637
|
const A = jn();
|
|
638
|
-
|
|
638
|
+
s(b(A ?? window.innerHeight / 2));
|
|
639
639
|
const O = () => {
|
|
640
|
-
|
|
640
|
+
s((W) => W === null ? null : b(W));
|
|
641
641
|
};
|
|
642
642
|
return window.addEventListener("resize", O), () => window.removeEventListener("resize", O);
|
|
643
643
|
}, [b]);
|
|
@@ -661,7 +661,7 @@ const Vn = ({
|
|
|
661
661
|
const O = S.current;
|
|
662
662
|
if (!O) return;
|
|
663
663
|
const W = A.clientY - O.startClientY;
|
|
664
|
-
!O.moved && Math.abs(W) > Un && (O.moved = !0, C(!0)), O.moved &&
|
|
664
|
+
!O.moved && Math.abs(W) > Un && (O.moved = !0, C(!0)), O.moved && s(b(O.startCenterY + W));
|
|
665
665
|
},
|
|
666
666
|
[b]
|
|
667
667
|
), H = k(
|
|
@@ -672,7 +672,7 @@ const Vn = ({
|
|
|
672
672
|
A.currentTarget.releasePointerCapture(A.pointerId);
|
|
673
673
|
} catch {
|
|
674
674
|
}
|
|
675
|
-
S.current = null, O.moved && (C(!1), v.current = !0,
|
|
675
|
+
S.current = null, O.moved && (C(!1), v.current = !0, s((W) => (W !== null && Ot(W), W)));
|
|
676
676
|
}
|
|
677
677
|
},
|
|
678
678
|
[]
|
|
@@ -681,16 +681,16 @@ const Vn = ({
|
|
|
681
681
|
v.current = !1;
|
|
682
682
|
return;
|
|
683
683
|
}
|
|
684
|
-
|
|
685
|
-
}, [
|
|
684
|
+
i();
|
|
685
|
+
}, [i]), N = k(
|
|
686
686
|
(A) => {
|
|
687
687
|
if (A.key === "ArrowUp" || A.key === "ArrowDown") {
|
|
688
688
|
A.preventDefault();
|
|
689
689
|
const O = A.key === "ArrowUp" ? -8 : 8;
|
|
690
|
-
|
|
690
|
+
s((W) => {
|
|
691
691
|
if (W === null) return W;
|
|
692
|
-
const
|
|
693
|
-
return Ot(
|
|
692
|
+
const G = b(W + O);
|
|
693
|
+
return Ot(G), G;
|
|
694
694
|
});
|
|
695
695
|
}
|
|
696
696
|
},
|
|
@@ -714,7 +714,7 @@ const Vn = ({
|
|
|
714
714
|
onPointerCancel: H,
|
|
715
715
|
onClick: h,
|
|
716
716
|
onKeyDown: N,
|
|
717
|
-
"aria-label":
|
|
717
|
+
"aria-label": o,
|
|
718
718
|
"data-position": e,
|
|
719
719
|
style: D,
|
|
720
720
|
children: g ? (
|
|
@@ -734,7 +734,7 @@ const Vn = ({
|
|
|
734
734
|
"img",
|
|
735
735
|
{
|
|
736
736
|
src: l,
|
|
737
|
-
alt:
|
|
737
|
+
alt: c ? `${c} avatar` : "Agent avatar",
|
|
738
738
|
className: "ll-hidden__avatar",
|
|
739
739
|
draggable: !1
|
|
740
740
|
}
|
|
@@ -753,31 +753,31 @@ const Vn = ({
|
|
|
753
753
|
audioLevel: e,
|
|
754
754
|
bars: t = 20,
|
|
755
755
|
maxHeight: r = 20,
|
|
756
|
-
minHeight:
|
|
757
|
-
className:
|
|
756
|
+
minHeight: i = 4,
|
|
757
|
+
className: o,
|
|
758
758
|
barClassName: l
|
|
759
759
|
}) => {
|
|
760
|
-
const
|
|
760
|
+
const c = E(null), d = E([]), f = ot(() => {
|
|
761
761
|
const g = (Math.sqrt(5) - 1) / 2;
|
|
762
|
-
return Array.from({ length: t }, (a,
|
|
762
|
+
return Array.from({ length: t }, (a, s) => 0.5 + s * g % 1 * 0.5);
|
|
763
763
|
}, [t]);
|
|
764
764
|
R(() => e.subscribe((a) => {
|
|
765
|
-
for (let
|
|
766
|
-
const I = d.current[
|
|
765
|
+
for (let s = 0; s < t; s++) {
|
|
766
|
+
const I = d.current[s];
|
|
767
767
|
if (!I) continue;
|
|
768
|
-
const C = Math.max(
|
|
768
|
+
const C = Math.max(i, a * r * f[s]);
|
|
769
769
|
I.style.height = `${C}px`;
|
|
770
770
|
}
|
|
771
|
-
}), [e, t, r,
|
|
772
|
-
const y = ["ll-waveform",
|
|
773
|
-
return /* @__PURE__ */ n("div", { ref:
|
|
771
|
+
}), [e, t, r, i, f]);
|
|
772
|
+
const y = ["ll-waveform", o].filter(Boolean).join(" ");
|
|
773
|
+
return /* @__PURE__ */ n("div", { ref: c, className: y, "aria-hidden": "true", children: Array.from({ length: t }, (g, a) => /* @__PURE__ */ n(
|
|
774
774
|
"div",
|
|
775
775
|
{
|
|
776
|
-
ref: (
|
|
777
|
-
d.current[a] =
|
|
776
|
+
ref: (s) => {
|
|
777
|
+
d.current[a] = s;
|
|
778
778
|
},
|
|
779
779
|
className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
|
|
780
|
-
style: { height: `${
|
|
780
|
+
style: { height: `${i}px` }
|
|
781
781
|
},
|
|
782
782
|
a
|
|
783
783
|
)) });
|
|
@@ -785,10 +785,10 @@ const Vn = ({
|
|
|
785
785
|
position: e,
|
|
786
786
|
isMobile: t,
|
|
787
787
|
agentName: r,
|
|
788
|
-
avatarImageUrl:
|
|
789
|
-
agentState:
|
|
788
|
+
avatarImageUrl: i,
|
|
789
|
+
agentState: o,
|
|
790
790
|
isMuted: l,
|
|
791
|
-
audioLevel:
|
|
791
|
+
audioLevel: c,
|
|
792
792
|
onExpand: d,
|
|
793
793
|
onToggleMute: f,
|
|
794
794
|
onClose: y
|
|
@@ -806,12 +806,12 @@ const Vn = ({
|
|
|
806
806
|
onClick: d,
|
|
807
807
|
"aria-label": `Expand ${r} widget`,
|
|
808
808
|
children: [
|
|
809
|
-
|
|
809
|
+
i ? (
|
|
810
810
|
// eslint-disable-next-line @next/next/no-img-element
|
|
811
811
|
/* @__PURE__ */ n(
|
|
812
812
|
"img",
|
|
813
813
|
{
|
|
814
|
-
src:
|
|
814
|
+
src: i,
|
|
815
815
|
alt: r,
|
|
816
816
|
className: "ll-minimized__avatar"
|
|
817
817
|
}
|
|
@@ -820,7 +820,7 @@ const Vn = ({
|
|
|
820
820
|
/* @__PURE__ */ n(
|
|
821
821
|
Yn,
|
|
822
822
|
{
|
|
823
|
-
audioLevel:
|
|
823
|
+
audioLevel: c,
|
|
824
824
|
bars: 16,
|
|
825
825
|
maxHeight: 18,
|
|
826
826
|
className: "ll-minimized__waveform"
|
|
@@ -858,12 +858,12 @@ const Vn = ({
|
|
|
858
858
|
role: "region",
|
|
859
859
|
"aria-label": `${r} widget`,
|
|
860
860
|
children: /* @__PURE__ */ _("div", { className: "ll-minimized__surface", children: [
|
|
861
|
-
|
|
861
|
+
i ? (
|
|
862
862
|
// eslint-disable-next-line @next/next/no-img-element
|
|
863
863
|
/* @__PURE__ */ n(
|
|
864
864
|
"img",
|
|
865
865
|
{
|
|
866
|
-
src:
|
|
866
|
+
src: i,
|
|
867
867
|
alt: r,
|
|
868
868
|
className: "ll-minimized__avatar"
|
|
869
869
|
}
|
|
@@ -871,7 +871,7 @@ const Vn = ({
|
|
|
871
871
|
) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
|
|
872
872
|
/* @__PURE__ */ _("div", { className: "ll-minimized__meta", children: [
|
|
873
873
|
/* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
|
|
874
|
-
/* @__PURE__ */ n("span", { className: "ll-minimized__state", children:
|
|
874
|
+
/* @__PURE__ */ n("span", { className: "ll-minimized__state", children: o === "speaking" ? "Speaking" : o === "thinking" ? "Thinking" : "Listening" })
|
|
875
875
|
] }),
|
|
876
876
|
/* @__PURE__ */ _("div", { className: "ll-minimized__controls", children: [
|
|
877
877
|
/* @__PURE__ */ n(
|
|
@@ -911,12 +911,12 @@ const Vn = ({
|
|
|
911
911
|
src: e,
|
|
912
912
|
alt: t,
|
|
913
913
|
preCannedPlaying: r = !1,
|
|
914
|
-
className:
|
|
915
|
-
style:
|
|
914
|
+
className: i,
|
|
915
|
+
style: o
|
|
916
916
|
}) => {
|
|
917
|
-
const [l,
|
|
917
|
+
const [l, c] = L(!1), d = E(e);
|
|
918
918
|
if (R(() => {
|
|
919
|
-
d.current !== e && (d.current = e,
|
|
919
|
+
d.current !== e && (d.current = e, c(!1));
|
|
920
920
|
}, [e]), !e) return null;
|
|
921
921
|
const f = {
|
|
922
922
|
position: "absolute",
|
|
@@ -928,7 +928,7 @@ const Vn = ({
|
|
|
928
928
|
transition: "opacity 500ms ease, transform 500ms ease",
|
|
929
929
|
transform: r ? "scale(1.02)" : "scale(1)",
|
|
930
930
|
opacity: l ? 1 : 0,
|
|
931
|
-
...
|
|
931
|
+
...o
|
|
932
932
|
};
|
|
933
933
|
return (
|
|
934
934
|
// eslint-disable-next-line @next/next/no-img-element
|
|
@@ -937,11 +937,11 @@ const Vn = ({
|
|
|
937
937
|
{
|
|
938
938
|
src: e,
|
|
939
939
|
alt: t,
|
|
940
|
-
className:
|
|
940
|
+
className: i,
|
|
941
941
|
style: f,
|
|
942
942
|
loading: "eager",
|
|
943
943
|
fetchPriority: "high",
|
|
944
|
-
onLoad: () =>
|
|
944
|
+
onLoad: () => c(!0)
|
|
945
945
|
}
|
|
946
946
|
)
|
|
947
947
|
);
|
|
@@ -949,16 +949,16 @@ const Vn = ({
|
|
|
949
949
|
position: e,
|
|
950
950
|
isMobile: t,
|
|
951
951
|
agentName: r,
|
|
952
|
-
avatarImageUrl:
|
|
953
|
-
idleLoopUrl:
|
|
952
|
+
avatarImageUrl: i,
|
|
953
|
+
idleLoopUrl: o,
|
|
954
954
|
greeting: l,
|
|
955
|
-
branding:
|
|
955
|
+
branding: c,
|
|
956
956
|
teamMembers: d,
|
|
957
957
|
currentTeamMemberId: f,
|
|
958
958
|
isSwitchingTeamMember: y,
|
|
959
959
|
teamSwitcherOpen: g,
|
|
960
960
|
onToggleTeamSwitcher: a,
|
|
961
|
-
onSelectTeamMember:
|
|
961
|
+
onSelectTeamMember: s,
|
|
962
962
|
languageMenuOpen: I,
|
|
963
963
|
onToggleLanguageMenu: C,
|
|
964
964
|
connectionState: S,
|
|
@@ -974,112 +974,118 @@ const Vn = ({
|
|
|
974
974
|
cameraPreviewEl: A,
|
|
975
975
|
cameraDevices: O,
|
|
976
976
|
activeCameraId: W,
|
|
977
|
-
isScreenShareEnabled:
|
|
978
|
-
screenPreviewEl:
|
|
977
|
+
isScreenShareEnabled: G,
|
|
978
|
+
screenPreviewEl: te,
|
|
979
979
|
isSpeakerMuted: me,
|
|
980
|
-
allowCamera:
|
|
981
|
-
allowScreenShare:
|
|
982
|
-
allowTyping:
|
|
983
|
-
avatarVideoContainerRef:
|
|
984
|
-
agentVideoEl:
|
|
980
|
+
allowCamera: Ve,
|
|
981
|
+
allowScreenShare: Ye,
|
|
982
|
+
allowTyping: Ge,
|
|
983
|
+
avatarVideoContainerRef: Je,
|
|
984
|
+
agentVideoEl: Z,
|
|
985
985
|
onConnect: ge,
|
|
986
|
-
onDisconnect:
|
|
987
|
-
onRetry:
|
|
988
|
-
onResumeAudio:
|
|
989
|
-
onToggleMute:
|
|
990
|
-
onToggleCamera:
|
|
991
|
-
onSwitchCameraDevice:
|
|
986
|
+
onDisconnect: _e,
|
|
987
|
+
onRetry: xe,
|
|
988
|
+
onResumeAudio: ke,
|
|
989
|
+
onToggleMute: Le,
|
|
990
|
+
onToggleCamera: Se,
|
|
991
|
+
onSwitchCameraDevice: Ce,
|
|
992
992
|
onToggleScreenShare: V,
|
|
993
|
-
onToggleSpeaker:
|
|
994
|
-
onSendMessage:
|
|
995
|
-
onMinimize:
|
|
996
|
-
onClose:
|
|
997
|
-
onClearMicError:
|
|
993
|
+
onToggleSpeaker: st,
|
|
994
|
+
onSendMessage: Ke,
|
|
995
|
+
onMinimize: Xe,
|
|
996
|
+
onClose: ce,
|
|
997
|
+
onClearMicError: Oe
|
|
998
998
|
}) => {
|
|
999
|
-
var
|
|
1000
|
-
const
|
|
999
|
+
var Te;
|
|
1000
|
+
const se = ((d == null ? void 0 : d.length) ?? 0) > 1, Ee = S === "connecting" || S === "connected", re = S === "connected", ye = S === "idle" || S === "disconnected" || S === "error", [J, ve] = L(!1);
|
|
1001
1001
|
R(() => {
|
|
1002
|
-
if (!
|
|
1003
|
-
|
|
1002
|
+
if (!Z) {
|
|
1003
|
+
ve(!1);
|
|
1004
1004
|
return;
|
|
1005
1005
|
}
|
|
1006
|
-
if (!
|
|
1007
|
-
|
|
1006
|
+
if (!Z.paused && Z.readyState >= 2) {
|
|
1007
|
+
ve(!0);
|
|
1008
1008
|
return;
|
|
1009
1009
|
}
|
|
1010
|
-
|
|
1011
|
-
const p = () =>
|
|
1012
|
-
return
|
|
1013
|
-
|
|
1010
|
+
ve(!1);
|
|
1011
|
+
const p = () => ve(!0);
|
|
1012
|
+
return Z.addEventListener("playing", p), Z.addEventListener("loadeddata", p), () => {
|
|
1013
|
+
Z.removeEventListener("playing", p), Z.removeEventListener("loadeddata", p);
|
|
1014
1014
|
};
|
|
1015
|
-
}, [
|
|
1016
|
-
const [
|
|
1015
|
+
}, [Z]);
|
|
1016
|
+
const [be, ie] = L(!1);
|
|
1017
1017
|
R(() => {
|
|
1018
|
-
if (!
|
|
1019
|
-
|
|
1018
|
+
if (!re) {
|
|
1019
|
+
ie(!1);
|
|
1020
1020
|
return;
|
|
1021
1021
|
}
|
|
1022
|
-
if (
|
|
1023
|
-
const p = setTimeout(() =>
|
|
1022
|
+
if (J) return;
|
|
1023
|
+
const p = setTimeout(() => ie(!0), 8e3);
|
|
1024
1024
|
return () => clearTimeout(p);
|
|
1025
|
-
}, [
|
|
1026
|
-
const
|
|
1025
|
+
}, [re, J]);
|
|
1026
|
+
const Ne = S === "connecting" || re && !!i && !J && !be, Ae = E(null), ne = E(null);
|
|
1027
1027
|
R(() => {
|
|
1028
|
-
const p =
|
|
1028
|
+
const p = Ae.current;
|
|
1029
1029
|
p && (p.innerHTML = "", A && (A.style.width = "100%", A.style.height = "100%", A.style.objectFit = "cover", A.style.transform = "scaleX(-1)", p.appendChild(A)));
|
|
1030
1030
|
}, [A]), R(() => {
|
|
1031
|
-
const p =
|
|
1032
|
-
p && (p.innerHTML = "",
|
|
1033
|
-
}, [
|
|
1034
|
-
const [
|
|
1031
|
+
const p = ne.current;
|
|
1032
|
+
p && (p.innerHTML = "", te && (te.style.width = "100%", te.style.height = "100%", te.style.objectFit = "contain", p.appendChild(te)));
|
|
1033
|
+
}, [te]);
|
|
1034
|
+
const [ee, oe] = L(!1), [de, Re] = L(!1);
|
|
1035
1035
|
R(() => {
|
|
1036
|
-
if (!
|
|
1036
|
+
if (!ee && !de && !I && !g) return;
|
|
1037
1037
|
const p = () => {
|
|
1038
|
-
|
|
1038
|
+
oe(!1), Re(!1), I && C(), g && a();
|
|
1039
1039
|
};
|
|
1040
1040
|
return document.addEventListener("click", p), () => document.removeEventListener("click", p);
|
|
1041
1041
|
}, [
|
|
1042
|
-
|
|
1043
|
-
|
|
1042
|
+
ee,
|
|
1043
|
+
de,
|
|
1044
1044
|
I,
|
|
1045
1045
|
g,
|
|
1046
1046
|
C,
|
|
1047
1047
|
a
|
|
1048
1048
|
]);
|
|
1049
|
-
const [
|
|
1049
|
+
const [ue, Ie] = L(""), Qe = k(
|
|
1050
1050
|
(p) => {
|
|
1051
1051
|
p.preventDefault();
|
|
1052
|
-
const
|
|
1053
|
-
|
|
1052
|
+
const Y = ue.trim();
|
|
1053
|
+
Y && (Ke(Y), Ie(""));
|
|
1054
1054
|
},
|
|
1055
|
-
[
|
|
1056
|
-
),
|
|
1055
|
+
[ue, Ke]
|
|
1056
|
+
), Be = c.productName || "Live Layer";
|
|
1057
|
+
let le = null, fe = null;
|
|
1058
|
+
for (let p = b.length - 1; p >= 0; p--) {
|
|
1059
|
+
const Y = b[p];
|
|
1060
|
+
if (!le && Y.role === "agent" ? le = Y : !fe && Y.role === "user" && (fe = Y), le && fe) break;
|
|
1061
|
+
}
|
|
1062
|
+
const Ze = re ? (le == null ? void 0 : le.text) || null : l || null, Me = re && (fe == null ? void 0 : fe.text) || null, ct = [
|
|
1057
1063
|
"ll-expanded",
|
|
1058
1064
|
t ? "ll-expanded--mobile" : "ll-expanded--desktop"
|
|
1059
1065
|
].join(" ");
|
|
1060
1066
|
return /* @__PURE__ */ _(
|
|
1061
1067
|
"div",
|
|
1062
1068
|
{
|
|
1063
|
-
className:
|
|
1069
|
+
className: ct,
|
|
1064
1070
|
"data-position": e,
|
|
1065
|
-
"data-state":
|
|
1071
|
+
"data-state": re ? "connected" : Ee ? "connecting" : "idle",
|
|
1066
1072
|
role: "dialog",
|
|
1067
1073
|
"aria-label": `${r} widget`,
|
|
1068
1074
|
children: [
|
|
1069
1075
|
/* @__PURE__ */ _("div", { className: "ll-expanded__bg", children: [
|
|
1070
|
-
|
|
1076
|
+
i ? /* @__PURE__ */ n(
|
|
1071
1077
|
Jn,
|
|
1072
1078
|
{
|
|
1073
|
-
src:
|
|
1079
|
+
src: i,
|
|
1074
1080
|
alt: r,
|
|
1075
1081
|
className: "ll-expanded__bg-img"
|
|
1076
1082
|
}
|
|
1077
|
-
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((
|
|
1078
|
-
|
|
1083
|
+
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Te = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Te.toUpperCase()) || "A" }) }),
|
|
1084
|
+
o && !re && /* @__PURE__ */ n(
|
|
1079
1085
|
"video",
|
|
1080
1086
|
{
|
|
1081
1087
|
className: "ll-expanded__bg-idle",
|
|
1082
|
-
src:
|
|
1088
|
+
src: o,
|
|
1083
1089
|
autoPlay: !0,
|
|
1084
1090
|
loop: !0,
|
|
1085
1091
|
muted: !0,
|
|
@@ -1087,24 +1093,24 @@ const Vn = ({
|
|
|
1087
1093
|
}
|
|
1088
1094
|
)
|
|
1089
1095
|
] }),
|
|
1090
|
-
/* @__PURE__ */ n("div", { ref:
|
|
1091
|
-
|
|
1096
|
+
/* @__PURE__ */ n("div", { ref: Je, className: "ll-expanded__video" }),
|
|
1097
|
+
Ne && /* @__PURE__ */ _("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
|
|
1092
1098
|
/* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
|
|
1093
1099
|
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: y ? "Switching..." : "Connecting..." })
|
|
1094
1100
|
] }),
|
|
1095
|
-
M &&
|
|
1101
|
+
M && re && /* @__PURE__ */ _(
|
|
1096
1102
|
"button",
|
|
1097
1103
|
{
|
|
1098
1104
|
type: "button",
|
|
1099
1105
|
className: "ll-expanded__overlay ll-expanded__overlay--gesture",
|
|
1100
|
-
onClick:
|
|
1106
|
+
onClick: ke,
|
|
1101
1107
|
children: [
|
|
1102
1108
|
/* @__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" }) }),
|
|
1103
1109
|
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
|
|
1104
1110
|
]
|
|
1105
1111
|
}
|
|
1106
1112
|
),
|
|
1107
|
-
|
|
1113
|
+
Ee ? /* @__PURE__ */ _("div", { className: "ll-expanded__topbar", children: [
|
|
1108
1114
|
/* @__PURE__ */ _("div", { className: "ll-expanded__topbar-left", children: [
|
|
1109
1115
|
/* @__PURE__ */ _("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1110
1116
|
/* @__PURE__ */ _(
|
|
@@ -1113,17 +1119,17 @@ const Vn = ({
|
|
|
1113
1119
|
type: "button",
|
|
1114
1120
|
className: "ll-hpill",
|
|
1115
1121
|
onClick: (p) => {
|
|
1116
|
-
|
|
1122
|
+
se && (p.stopPropagation(), a());
|
|
1117
1123
|
},
|
|
1118
|
-
"aria-haspopup":
|
|
1119
|
-
"aria-expanded":
|
|
1124
|
+
"aria-haspopup": se ? "listbox" : void 0,
|
|
1125
|
+
"aria-expanded": se ? g : void 0,
|
|
1120
1126
|
children: [
|
|
1121
1127
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
|
|
1122
|
-
|
|
1128
|
+
se && /* @__PURE__ */ n(rt, {})
|
|
1123
1129
|
]
|
|
1124
1130
|
}
|
|
1125
1131
|
),
|
|
1126
|
-
|
|
1132
|
+
se && g && /* @__PURE__ */ n(
|
|
1127
1133
|
"div",
|
|
1128
1134
|
{
|
|
1129
1135
|
className: "ll-hmenu",
|
|
@@ -1134,7 +1140,7 @@ const Vn = ({
|
|
|
1134
1140
|
{
|
|
1135
1141
|
type: "button",
|
|
1136
1142
|
className: `ll-hmenu__item ${p.id === f ? "is-active" : ""}`,
|
|
1137
|
-
onClick: () =>
|
|
1143
|
+
onClick: () => s(p.id),
|
|
1138
1144
|
role: "option",
|
|
1139
1145
|
"aria-selected": p.id === f,
|
|
1140
1146
|
children: [
|
|
@@ -1170,7 +1176,7 @@ const Vn = ({
|
|
|
1170
1176
|
title: "Language: English",
|
|
1171
1177
|
children: [
|
|
1172
1178
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: "EN" }),
|
|
1173
|
-
/* @__PURE__ */ n(
|
|
1179
|
+
/* @__PURE__ */ n(rt, {})
|
|
1174
1180
|
]
|
|
1175
1181
|
}
|
|
1176
1182
|
),
|
|
@@ -1207,7 +1213,7 @@ const Vn = ({
|
|
|
1207
1213
|
{
|
|
1208
1214
|
type: "button",
|
|
1209
1215
|
className: "ll-hbtn",
|
|
1210
|
-
onClick:
|
|
1216
|
+
onClick: Xe,
|
|
1211
1217
|
"aria-label": "Minimize widget",
|
|
1212
1218
|
title: "Minimize",
|
|
1213
1219
|
children: /* @__PURE__ */ n(qt, {})
|
|
@@ -1218,7 +1224,7 @@ const Vn = ({
|
|
|
1218
1224
|
{
|
|
1219
1225
|
type: "button",
|
|
1220
1226
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1221
|
-
onClick:
|
|
1227
|
+
onClick: ce,
|
|
1222
1228
|
"aria-label": "End call",
|
|
1223
1229
|
title: "End call",
|
|
1224
1230
|
children: /* @__PURE__ */ n(Bt, {})
|
|
@@ -1228,14 +1234,14 @@ const Vn = ({
|
|
|
1228
1234
|
] }) : (
|
|
1229
1235
|
// Idle-state header with Live Layer product name + minimize/close
|
|
1230
1236
|
/* @__PURE__ */ _("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
|
|
1231
|
-
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children:
|
|
1237
|
+
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Be }),
|
|
1232
1238
|
/* @__PURE__ */ _("div", { className: "ll-expanded__header-actions", children: [
|
|
1233
1239
|
/* @__PURE__ */ n(
|
|
1234
1240
|
"button",
|
|
1235
1241
|
{
|
|
1236
1242
|
type: "button",
|
|
1237
1243
|
className: "ll-hbtn ll-hbtn--ghost",
|
|
1238
|
-
onClick:
|
|
1244
|
+
onClick: Xe,
|
|
1239
1245
|
"aria-label": "Minimize widget",
|
|
1240
1246
|
children: /* @__PURE__ */ n(qt, {})
|
|
1241
1247
|
}
|
|
@@ -1245,7 +1251,7 @@ const Vn = ({
|
|
|
1245
1251
|
{
|
|
1246
1252
|
type: "button",
|
|
1247
1253
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1248
|
-
onClick:
|
|
1254
|
+
onClick: ce,
|
|
1249
1255
|
"aria-label": "Close widget",
|
|
1250
1256
|
children: /* @__PURE__ */ n(Bt, {})
|
|
1251
1257
|
}
|
|
@@ -1253,8 +1259,8 @@ const Vn = ({
|
|
|
1253
1259
|
] })
|
|
1254
1260
|
] })
|
|
1255
1261
|
),
|
|
1256
|
-
|
|
1257
|
-
const p = z ? "Restart paused session" : S === "disconnected" ? "Reconnect to agent" : "Start video call",
|
|
1262
|
+
ye && /* @__PURE__ */ (() => {
|
|
1263
|
+
const p = z ? "Restart paused session" : S === "disconnected" ? "Reconnect to agent" : "Start video call", Y = z ? "Pick up where you left off" : null;
|
|
1258
1264
|
return /* @__PURE__ */ _(ht, { children: [
|
|
1259
1265
|
S === "idle" && !z && !H && /* @__PURE__ */ _(
|
|
1260
1266
|
"button",
|
|
@@ -1271,7 +1277,7 @@ const Vn = ({
|
|
|
1271
1277
|
),
|
|
1272
1278
|
/* @__PURE__ */ _("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
|
|
1273
1279
|
l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
|
|
1274
|
-
|
|
1280
|
+
Y && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: Y }),
|
|
1275
1281
|
/* @__PURE__ */ n(
|
|
1276
1282
|
"button",
|
|
1277
1283
|
{
|
|
@@ -1288,53 +1294,61 @@ const Vn = ({
|
|
|
1288
1294
|
/* @__PURE__ */ _(
|
|
1289
1295
|
"div",
|
|
1290
1296
|
{
|
|
1291
|
-
className: `ll-expanded__pip ${
|
|
1297
|
+
className: `ll-expanded__pip ${Ee && (D || G) ? "is-visible" : ""}`,
|
|
1292
1298
|
children: [
|
|
1293
1299
|
/* @__PURE__ */ n(
|
|
1294
1300
|
"div",
|
|
1295
1301
|
{
|
|
1296
|
-
ref:
|
|
1297
|
-
className:
|
|
1302
|
+
ref: ne,
|
|
1303
|
+
className: G ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1298
1304
|
}
|
|
1299
1305
|
),
|
|
1300
1306
|
/* @__PURE__ */ n(
|
|
1301
1307
|
"div",
|
|
1302
1308
|
{
|
|
1303
|
-
ref:
|
|
1304
|
-
className: !
|
|
1309
|
+
ref: Ae,
|
|
1310
|
+
className: !G && D ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1305
1311
|
}
|
|
1306
1312
|
)
|
|
1307
1313
|
]
|
|
1308
1314
|
}
|
|
1309
1315
|
),
|
|
1310
|
-
|
|
1311
|
-
|
|
1316
|
+
Ee ? /* @__PURE__ */ _("div", { className: "ll-expanded__bottom", children: [
|
|
1317
|
+
Ze && /* @__PURE__ */ n(
|
|
1312
1318
|
"div",
|
|
1313
1319
|
{
|
|
1314
|
-
className:
|
|
1315
|
-
"data-role":
|
|
1316
|
-
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children:
|
|
1320
|
+
className: "ll-expanded__transcript ll-expanded__transcript--agent",
|
|
1321
|
+
"data-role": "agent",
|
|
1322
|
+
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Ze })
|
|
1323
|
+
}
|
|
1324
|
+
),
|
|
1325
|
+
Me && /* @__PURE__ */ n(
|
|
1326
|
+
"div",
|
|
1327
|
+
{
|
|
1328
|
+
className: "ll-expanded__transcript ll-expanded__transcript--user",
|
|
1329
|
+
"data-role": "user",
|
|
1330
|
+
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Me })
|
|
1317
1331
|
}
|
|
1318
1332
|
),
|
|
1319
1333
|
/* @__PURE__ */ _("div", { className: "ll-toolbar", onClick: (p) => p.stopPropagation(), children: [
|
|
1320
|
-
|
|
1334
|
+
Ye && /* @__PURE__ */ n(
|
|
1321
1335
|
"button",
|
|
1322
1336
|
{
|
|
1323
1337
|
type: "button",
|
|
1324
|
-
className: `ll-tool ${
|
|
1338
|
+
className: `ll-tool ${G ? "is-on" : ""}`,
|
|
1325
1339
|
onClick: V,
|
|
1326
|
-
"aria-label":
|
|
1327
|
-
title:
|
|
1340
|
+
"aria-label": G ? "Stop sharing screen" : "Share screen",
|
|
1341
|
+
title: G ? "Stop sharing" : "Share screen",
|
|
1328
1342
|
children: /* @__PURE__ */ n(Xn, {})
|
|
1329
1343
|
}
|
|
1330
1344
|
),
|
|
1331
|
-
|
|
1345
|
+
Ve && /* @__PURE__ */ _("div", { className: "ll-tool-split", children: [
|
|
1332
1346
|
/* @__PURE__ */ n(
|
|
1333
1347
|
"button",
|
|
1334
1348
|
{
|
|
1335
1349
|
type: "button",
|
|
1336
1350
|
className: `ll-tool ll-tool--left ${D ? "is-on" : ""}`,
|
|
1337
|
-
onClick:
|
|
1351
|
+
onClick: Se,
|
|
1338
1352
|
"aria-label": D ? "Turn off camera" : "Turn on camera",
|
|
1339
1353
|
title: D ? "Stop camera" : "Start camera",
|
|
1340
1354
|
children: /* @__PURE__ */ n(Qn, {})
|
|
@@ -1346,22 +1360,22 @@ const Vn = ({
|
|
|
1346
1360
|
type: "button",
|
|
1347
1361
|
className: `ll-tool ll-tool--right ${D ? "is-on" : ""}`,
|
|
1348
1362
|
onClick: (p) => {
|
|
1349
|
-
p.stopPropagation(),
|
|
1363
|
+
p.stopPropagation(), Re((Y) => !Y), oe(!1);
|
|
1350
1364
|
},
|
|
1351
1365
|
"aria-label": "Camera devices",
|
|
1352
1366
|
"aria-haspopup": "listbox",
|
|
1353
|
-
"aria-expanded":
|
|
1354
|
-
children: /* @__PURE__ */ n(
|
|
1367
|
+
"aria-expanded": de,
|
|
1368
|
+
children: /* @__PURE__ */ n(rt, {})
|
|
1355
1369
|
}
|
|
1356
1370
|
),
|
|
1357
|
-
|
|
1371
|
+
de && O.length > 0 && /* @__PURE__ */ n(
|
|
1358
1372
|
Wt,
|
|
1359
1373
|
{
|
|
1360
1374
|
label: "Camera",
|
|
1361
1375
|
devices: O,
|
|
1362
1376
|
activeId: W,
|
|
1363
1377
|
onPick: (p) => {
|
|
1364
|
-
|
|
1378
|
+
Re(!1), Ce(p);
|
|
1365
1379
|
}
|
|
1366
1380
|
}
|
|
1367
1381
|
)
|
|
@@ -1372,7 +1386,7 @@ const Vn = ({
|
|
|
1372
1386
|
{
|
|
1373
1387
|
type: "button",
|
|
1374
1388
|
className: `ll-tool ll-tool--left ${h ? "is-muted" : ""}`,
|
|
1375
|
-
onClick:
|
|
1389
|
+
onClick: Le,
|
|
1376
1390
|
"aria-label": h ? "Unmute microphone" : "Mute microphone",
|
|
1377
1391
|
title: h ? "Unmute" : "Mute",
|
|
1378
1392
|
children: /* @__PURE__ */ n(Zn, { muted: h })
|
|
@@ -1384,21 +1398,21 @@ const Vn = ({
|
|
|
1384
1398
|
type: "button",
|
|
1385
1399
|
className: `ll-tool ll-tool--right ${h ? "is-muted" : ""}`,
|
|
1386
1400
|
onClick: (p) => {
|
|
1387
|
-
p.stopPropagation(),
|
|
1401
|
+
p.stopPropagation(), oe((Y) => !Y), Re(!1);
|
|
1388
1402
|
},
|
|
1389
1403
|
"aria-label": "Microphone devices",
|
|
1390
1404
|
"aria-haspopup": "listbox",
|
|
1391
|
-
"aria-expanded":
|
|
1392
|
-
children: /* @__PURE__ */ n(
|
|
1405
|
+
"aria-expanded": ee,
|
|
1406
|
+
children: /* @__PURE__ */ n(rt, {})
|
|
1393
1407
|
}
|
|
1394
1408
|
),
|
|
1395
|
-
|
|
1409
|
+
ee && q.length > 0 && /* @__PURE__ */ n(
|
|
1396
1410
|
Wt,
|
|
1397
1411
|
{
|
|
1398
1412
|
label: "Microphone",
|
|
1399
1413
|
devices: q,
|
|
1400
1414
|
activeId: "",
|
|
1401
|
-
onPick: () =>
|
|
1415
|
+
onPick: () => oe(!1)
|
|
1402
1416
|
}
|
|
1403
1417
|
)
|
|
1404
1418
|
] }),
|
|
@@ -1407,7 +1421,7 @@ const Vn = ({
|
|
|
1407
1421
|
{
|
|
1408
1422
|
type: "button",
|
|
1409
1423
|
className: `ll-tool ${me ? "is-muted" : ""}`,
|
|
1410
|
-
onClick:
|
|
1424
|
+
onClick: st,
|
|
1411
1425
|
"aria-label": me ? "Unmute speaker" : "Mute speaker",
|
|
1412
1426
|
title: me ? "Unmute speaker" : "Mute speaker",
|
|
1413
1427
|
children: /* @__PURE__ */ n(er, { muted: me })
|
|
@@ -1418,26 +1432,26 @@ const Vn = ({
|
|
|
1418
1432
|
{
|
|
1419
1433
|
type: "button",
|
|
1420
1434
|
className: "ll-tool ll-tool--danger",
|
|
1421
|
-
onClick:
|
|
1435
|
+
onClick: _e,
|
|
1422
1436
|
"aria-label": "End conversation",
|
|
1423
1437
|
title: "End conversation",
|
|
1424
1438
|
children: /* @__PURE__ */ n(nr, {})
|
|
1425
1439
|
}
|
|
1426
1440
|
)
|
|
1427
1441
|
] }),
|
|
1428
|
-
|
|
1442
|
+
Ge && /* @__PURE__ */ _("form", { className: "ll-message-input", onSubmit: Qe, children: [
|
|
1429
1443
|
/* @__PURE__ */ n(
|
|
1430
1444
|
"input",
|
|
1431
1445
|
{
|
|
1432
1446
|
type: "text",
|
|
1433
1447
|
className: "ll-message-input__field",
|
|
1434
1448
|
placeholder: "Message...",
|
|
1435
|
-
value:
|
|
1436
|
-
onChange: (p) =>
|
|
1449
|
+
value: ue,
|
|
1450
|
+
onChange: (p) => Ie(p.target.value),
|
|
1437
1451
|
"aria-label": "Message the agent"
|
|
1438
1452
|
}
|
|
1439
1453
|
),
|
|
1440
|
-
|
|
1454
|
+
ue.trim() && /* @__PURE__ */ n(
|
|
1441
1455
|
"button",
|
|
1442
1456
|
{
|
|
1443
1457
|
type: "submit",
|
|
@@ -1457,14 +1471,14 @@ const Vn = ({
|
|
|
1457
1471
|
{
|
|
1458
1472
|
type: "button",
|
|
1459
1473
|
className: "ll-expanded__banner-x",
|
|
1460
|
-
onClick:
|
|
1474
|
+
onClick: Oe,
|
|
1461
1475
|
"aria-label": "Dismiss",
|
|
1462
1476
|
children: "×"
|
|
1463
1477
|
}
|
|
1464
1478
|
)
|
|
1465
1479
|
] });
|
|
1466
1480
|
if (!H || S !== "error") return null;
|
|
1467
|
-
let p = "Failed to connect",
|
|
1481
|
+
let p = "Failed to connect", Y = "Try again";
|
|
1468
1482
|
return H === "MIC_PERMISSION_DENIED" ? p = "Microphone blocked. Allow access to talk." : H === "MIC_NOT_FOUND" ? p = "No microphone found. Plug one in + retry." : H === "MIC_UNAVAILABLE" ? p = "Mic unavailable. Check other apps using it." : H === "AGENT_TIMEOUT" ? p = "Agent didn't pick up. Try again." : H === "CONNECT_FAILED" ? p = "Connection failed. Check your network." : H.length < 80 && (p = H), /* @__PURE__ */ _("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
|
|
1469
1483
|
/* @__PURE__ */ n("span", { children: p }),
|
|
1470
1484
|
/* @__PURE__ */ n(
|
|
@@ -1472,8 +1486,8 @@ const Vn = ({
|
|
|
1472
1486
|
{
|
|
1473
1487
|
type: "button",
|
|
1474
1488
|
className: "ll-expanded__banner-retry",
|
|
1475
|
-
onClick:
|
|
1476
|
-
children:
|
|
1489
|
+
onClick: xe,
|
|
1490
|
+
children: Y
|
|
1477
1491
|
}
|
|
1478
1492
|
)
|
|
1479
1493
|
] });
|
|
@@ -1482,7 +1496,7 @@ const Vn = ({
|
|
|
1482
1496
|
}
|
|
1483
1497
|
);
|
|
1484
1498
|
};
|
|
1485
|
-
function
|
|
1499
|
+
function rt() {
|
|
1486
1500
|
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" }) });
|
|
1487
1501
|
}
|
|
1488
1502
|
function Bt() {
|
|
@@ -1539,30 +1553,30 @@ function nr() {
|
|
|
1539
1553
|
}
|
|
1540
1554
|
) });
|
|
1541
1555
|
}
|
|
1542
|
-
const Wt = ({ label: e, devices: t, activeId: r, onPick:
|
|
1556
|
+
const Wt = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */ _(
|
|
1543
1557
|
"div",
|
|
1544
1558
|
{
|
|
1545
1559
|
className: "ll-device-menu",
|
|
1546
|
-
onClick: (
|
|
1560
|
+
onClick: (o) => o.stopPropagation(),
|
|
1547
1561
|
role: "listbox",
|
|
1548
1562
|
children: [
|
|
1549
1563
|
/* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
|
|
1550
|
-
t.map((
|
|
1551
|
-
const
|
|
1564
|
+
t.map((o, l) => {
|
|
1565
|
+
const c = r === o.deviceId;
|
|
1552
1566
|
return /* @__PURE__ */ _(
|
|
1553
1567
|
"button",
|
|
1554
1568
|
{
|
|
1555
1569
|
type: "button",
|
|
1556
|
-
className: `ll-device-menu__item ${
|
|
1557
|
-
onClick: () => o
|
|
1570
|
+
className: `ll-device-menu__item ${c ? "is-active" : ""}`,
|
|
1571
|
+
onClick: () => i(o.deviceId),
|
|
1558
1572
|
role: "option",
|
|
1559
|
-
"aria-selected":
|
|
1573
|
+
"aria-selected": c,
|
|
1560
1574
|
children: [
|
|
1561
|
-
|
|
1562
|
-
/* @__PURE__ */ n("span", { className: "ll-device-menu__name", children:
|
|
1575
|
+
c && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
|
|
1576
|
+
/* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: o.label || `${e} ${l + 1}` })
|
|
1563
1577
|
]
|
|
1564
1578
|
},
|
|
1565
|
-
|
|
1579
|
+
o.deviceId || l
|
|
1566
1580
|
);
|
|
1567
1581
|
})
|
|
1568
1582
|
]
|
|
@@ -1580,7 +1594,7 @@ function gt(e) {
|
|
|
1580
1594
|
}
|
|
1581
1595
|
return !1;
|
|
1582
1596
|
}
|
|
1583
|
-
function
|
|
1597
|
+
function at(e) {
|
|
1584
1598
|
if (gt(e)) return !1;
|
|
1585
1599
|
if (e instanceof HTMLInputElement) {
|
|
1586
1600
|
if (e.type === "password") return !1;
|
|
@@ -1589,7 +1603,7 @@ function lt(e) {
|
|
|
1589
1603
|
}
|
|
1590
1604
|
return !0;
|
|
1591
1605
|
}
|
|
1592
|
-
const
|
|
1606
|
+
const it = 4096, ir = 20, or = 20, lr = 10, ar = 10, sr = 30, Ft = 500, cr = [
|
|
1593
1607
|
'[data-ll-private="true"]',
|
|
1594
1608
|
".ll-widget",
|
|
1595
1609
|
"script",
|
|
@@ -1597,22 +1611,22 @@ const rt = 4096, or = 20, ir = 20, lr = 10, ar = 10, cr = 30, Ft = 500, sr = [
|
|
|
1597
1611
|
"noscript",
|
|
1598
1612
|
"iframe"
|
|
1599
1613
|
];
|
|
1600
|
-
function
|
|
1614
|
+
function Ue(e) {
|
|
1601
1615
|
if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
|
|
1602
1616
|
let t = e;
|
|
1603
1617
|
for (; t; ) {
|
|
1604
|
-
for (const r of
|
|
1618
|
+
for (const r of cr)
|
|
1605
1619
|
if (t.matches(r)) return !0;
|
|
1606
1620
|
t = t.parentElement;
|
|
1607
1621
|
}
|
|
1608
1622
|
return !1;
|
|
1609
1623
|
}
|
|
1610
|
-
function
|
|
1624
|
+
function je(e) {
|
|
1611
1625
|
if (typeof window > "u") return !0;
|
|
1612
1626
|
const t = e.getBoundingClientRect();
|
|
1613
1627
|
if (t.width <= 0 || t.height <= 0) return !1;
|
|
1614
|
-
const r = window.innerHeight || document.documentElement.clientHeight,
|
|
1615
|
-
return t.bottom > 0 && t.right > 0 && t.top < r && t.left <
|
|
1628
|
+
const r = window.innerHeight || document.documentElement.clientHeight, i = window.innerWidth || document.documentElement.clientWidth;
|
|
1629
|
+
return t.bottom > 0 && t.right > 0 && t.top < r && t.left < i;
|
|
1616
1630
|
}
|
|
1617
1631
|
function Ut(e) {
|
|
1618
1632
|
const t = e.getAttribute("id");
|
|
@@ -1622,15 +1636,15 @@ function Ut(e) {
|
|
|
1622
1636
|
}
|
|
1623
1637
|
const r = e.getAttribute("aria-label");
|
|
1624
1638
|
if (r) return r.trim();
|
|
1625
|
-
const
|
|
1626
|
-
if (
|
|
1627
|
-
const
|
|
1628
|
-
return
|
|
1639
|
+
const i = e.getAttribute("placeholder");
|
|
1640
|
+
if (i) return i.trim();
|
|
1641
|
+
const o = e.closest("label");
|
|
1642
|
+
return o != null && o.textContent ? o.textContent.trim() : "";
|
|
1629
1643
|
}
|
|
1630
|
-
function
|
|
1644
|
+
function we(e, t) {
|
|
1631
1645
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
1632
1646
|
}
|
|
1633
|
-
function
|
|
1647
|
+
function $e(e) {
|
|
1634
1648
|
return e.length;
|
|
1635
1649
|
}
|
|
1636
1650
|
function dr(e, t = {}) {
|
|
@@ -1647,13 +1661,13 @@ function dr(e, t = {}) {
|
|
|
1647
1661
|
forms: [],
|
|
1648
1662
|
extras: e
|
|
1649
1663
|
};
|
|
1650
|
-
const
|
|
1664
|
+
const i = typeof window < "u" && window.location.href || "", o = typeof window < "u" && window.location.pathname || "/", l = r.title || "", c = Array.from(
|
|
1651
1665
|
r.querySelectorAll("[data-ll-region]")
|
|
1652
1666
|
), d = [];
|
|
1653
|
-
for (const h of
|
|
1667
|
+
for (const h of c) {
|
|
1654
1668
|
if (d.length >= lr) break;
|
|
1655
|
-
if (
|
|
1656
|
-
const N = h.getAttribute("data-ll-region") ?? "", q = h.getAttribute("data-ll-intent") ?? void 0, D =
|
|
1669
|
+
if (Ue(h) || !je(h)) continue;
|
|
1670
|
+
const N = h.getAttribute("data-ll-region") ?? "", q = h.getAttribute("data-ll-intent") ?? void 0, D = we(
|
|
1657
1671
|
(h.innerText || h.textContent || "").trim(),
|
|
1658
1672
|
Ft * 2
|
|
1659
1673
|
);
|
|
@@ -1663,23 +1677,23 @@ function dr(e, t = {}) {
|
|
|
1663
1677
|
r.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
|
1664
1678
|
);
|
|
1665
1679
|
for (const h of g) {
|
|
1666
|
-
if (
|
|
1680
|
+
if (Ue(h) || !je(h)) continue;
|
|
1667
1681
|
const N = (h.textContent || "").trim();
|
|
1668
|
-
N && f.push(`${h.tagName}: ${
|
|
1682
|
+
N && f.push(`${h.tagName}: ${we(N, 200)}`);
|
|
1669
1683
|
}
|
|
1670
1684
|
const a = Array.from(r.querySelectorAll("p, li"));
|
|
1671
1685
|
for (const h of a) {
|
|
1672
|
-
if (
|
|
1686
|
+
if (Ue(h) || !je(h) || y.includes(h.tagName)) continue;
|
|
1673
1687
|
const N = (h.textContent || "").trim();
|
|
1674
|
-
N.length > 10 && f.push(
|
|
1688
|
+
N.length > 10 && f.push(we(N, Ft));
|
|
1675
1689
|
}
|
|
1676
|
-
const
|
|
1690
|
+
const s = f.join(`
|
|
1677
1691
|
`), I = [], C = Array.from(r.querySelectorAll("a[href]"));
|
|
1678
1692
|
for (const h of C) {
|
|
1679
|
-
if (I.length >=
|
|
1680
|
-
if (
|
|
1693
|
+
if (I.length >= ir) break;
|
|
1694
|
+
if (Ue(h) || !je(h)) continue;
|
|
1681
1695
|
const N = h.getAttribute("href") || "", q = (h.textContent || "").trim();
|
|
1682
|
-
!N || !q || I.push({ href: N, text:
|
|
1696
|
+
!N || !q || I.push({ href: N, text: we(q, 100) });
|
|
1683
1697
|
}
|
|
1684
1698
|
const S = [], v = Array.from(
|
|
1685
1699
|
r.querySelectorAll(
|
|
@@ -1687,10 +1701,10 @@ function dr(e, t = {}) {
|
|
|
1687
1701
|
)
|
|
1688
1702
|
);
|
|
1689
1703
|
for (const h of v) {
|
|
1690
|
-
if (S.length >=
|
|
1691
|
-
if (
|
|
1704
|
+
if (S.length >= or) break;
|
|
1705
|
+
if (Ue(h) || !at(h) || !je(h)) continue;
|
|
1692
1706
|
const N = Ut(h), q = h instanceof HTMLInputElement ? h.type : h.tagName.toLowerCase();
|
|
1693
|
-
N && S.push({ label:
|
|
1707
|
+
N && S.push({ label: we(N, 100), type: q });
|
|
1694
1708
|
}
|
|
1695
1709
|
const b = Array.from(
|
|
1696
1710
|
r.querySelectorAll("[data-ll-form]")
|
|
@@ -1706,43 +1720,43 @@ function dr(e, t = {}) {
|
|
|
1706
1720
|
)
|
|
1707
1721
|
), A = [];
|
|
1708
1722
|
for (const O of D) {
|
|
1709
|
-
if (A.length >=
|
|
1710
|
-
if (!
|
|
1723
|
+
if (A.length >= sr) break;
|
|
1724
|
+
if (!at(O)) continue;
|
|
1711
1725
|
const W = O.getAttribute("data-ll-field") || "";
|
|
1712
1726
|
if (!W) continue;
|
|
1713
|
-
const
|
|
1714
|
-
A.push({ name: W, label:
|
|
1727
|
+
const G = Ut(O) || W, te = O instanceof HTMLInputElement ? O.type : O.tagName.toLowerCase();
|
|
1728
|
+
A.push({ name: W, label: we(G, 100), type: te });
|
|
1715
1729
|
}
|
|
1716
1730
|
z.push({ id: N, intent: q, fields: A });
|
|
1717
1731
|
}
|
|
1718
1732
|
const M = {
|
|
1719
|
-
url:
|
|
1733
|
+
url: i,
|
|
1720
1734
|
title: l,
|
|
1721
|
-
pathname:
|
|
1735
|
+
pathname: o,
|
|
1722
1736
|
regions: d,
|
|
1723
|
-
visibleText:
|
|
1737
|
+
visibleText: s,
|
|
1724
1738
|
visibleLinks: I,
|
|
1725
1739
|
visibleFields: S,
|
|
1726
1740
|
forms: z,
|
|
1727
1741
|
extras: e
|
|
1728
1742
|
};
|
|
1729
|
-
let H =
|
|
1730
|
-
for (; H >
|
|
1731
|
-
M.visibleFields.pop(), H =
|
|
1732
|
-
for (; H >
|
|
1743
|
+
let H = $e(JSON.stringify(M.regions)) + $e(M.visibleText) + $e(JSON.stringify(M.visibleLinks)) + $e(JSON.stringify(M.visibleFields));
|
|
1744
|
+
for (; H > it && M.visibleFields.length > 0; )
|
|
1745
|
+
M.visibleFields.pop(), H = $e(JSON.stringify(M.visibleFields));
|
|
1746
|
+
for (; H > it && M.visibleLinks.length > 0; )
|
|
1733
1747
|
M.visibleLinks.pop(), H -= 80;
|
|
1734
|
-
return
|
|
1748
|
+
return $e(M.visibleText) > it && (M.visibleText = we(M.visibleText, it - 100)), M;
|
|
1735
1749
|
}
|
|
1736
|
-
let
|
|
1750
|
+
let ze = null;
|
|
1737
1751
|
function jt(e, t = {}) {
|
|
1738
|
-
const r = Date.now(),
|
|
1739
|
-
if (
|
|
1740
|
-
return
|
|
1752
|
+
const r = Date.now(), o = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
|
|
1753
|
+
if (ze && ze.key === o && r - ze.at < 1e3)
|
|
1754
|
+
return ze.ctx;
|
|
1741
1755
|
const l = dr(e, t);
|
|
1742
|
-
return
|
|
1756
|
+
return ze = { key: o, at: r, ctx: l }, l;
|
|
1743
1757
|
}
|
|
1744
1758
|
function ur() {
|
|
1745
|
-
|
|
1759
|
+
ze = null;
|
|
1746
1760
|
}
|
|
1747
1761
|
const fr = 200;
|
|
1748
1762
|
function pr(e) {
|
|
@@ -1761,11 +1775,11 @@ function hr(e) {
|
|
|
1761
1775
|
function mr(e) {
|
|
1762
1776
|
const t = e ?? (typeof document < "u" ? document : null);
|
|
1763
1777
|
if (!t) return [];
|
|
1764
|
-
const r = typeof window < "u" && window.location.origin || "",
|
|
1765
|
-
for (const
|
|
1766
|
-
if (
|
|
1767
|
-
if (gt(
|
|
1768
|
-
const d =
|
|
1778
|
+
const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), o = [], l = Array.from(t.querySelectorAll("a[href]"));
|
|
1779
|
+
for (const c of l) {
|
|
1780
|
+
if (o.length >= fr) break;
|
|
1781
|
+
if (gt(c)) continue;
|
|
1782
|
+
const d = c.getAttribute("href") || "";
|
|
1769
1783
|
if (!hr(d)) continue;
|
|
1770
1784
|
let f = d, y = !0;
|
|
1771
1785
|
try {
|
|
@@ -1776,40 +1790,40 @@ function mr(e) {
|
|
|
1776
1790
|
} catch {
|
|
1777
1791
|
continue;
|
|
1778
1792
|
}
|
|
1779
|
-
if (
|
|
1780
|
-
|
|
1781
|
-
const g = (
|
|
1782
|
-
|
|
1793
|
+
if (i.has(f)) continue;
|
|
1794
|
+
i.add(f);
|
|
1795
|
+
const g = (c.textContent || "").trim().slice(0, 120);
|
|
1796
|
+
o.push({ href: f, text: g, internal: y });
|
|
1783
1797
|
}
|
|
1784
|
-
return
|
|
1798
|
+
return o;
|
|
1785
1799
|
}
|
|
1786
|
-
let
|
|
1800
|
+
let He = null;
|
|
1787
1801
|
const gr = 5e3;
|
|
1788
1802
|
function ft() {
|
|
1789
1803
|
const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
|
|
1790
|
-
if (
|
|
1791
|
-
return
|
|
1804
|
+
if (He && He.pathname === t && e - He.at < gr)
|
|
1805
|
+
return He.routes;
|
|
1792
1806
|
const r = mr();
|
|
1793
|
-
return
|
|
1807
|
+
return He = { at: e, pathname: t, routes: r }, r;
|
|
1794
1808
|
}
|
|
1795
1809
|
function yr() {
|
|
1796
|
-
|
|
1810
|
+
He = null;
|
|
1797
1811
|
}
|
|
1798
1812
|
function vr(e, t) {
|
|
1799
|
-
const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype,
|
|
1800
|
-
|
|
1813
|
+
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;
|
|
1814
|
+
o ? o.call(e, t) : e.value = t;
|
|
1801
1815
|
}
|
|
1802
1816
|
function br(e, t, r = {}) {
|
|
1803
|
-
const
|
|
1817
|
+
const i = r.triggerInput ?? !0, o = r.triggerChange ?? !0;
|
|
1804
1818
|
if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
|
|
1805
1819
|
const l = Object.getOwnPropertyDescriptor(
|
|
1806
1820
|
HTMLInputElement.prototype,
|
|
1807
1821
|
"checked"
|
|
1808
|
-
),
|
|
1809
|
-
|
|
1822
|
+
), c = l == null ? void 0 : l.set, d = t === "true" || t === "1" || t === "on";
|
|
1823
|
+
c ? c.call(e, d) : e.checked = d, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
1810
1824
|
return;
|
|
1811
1825
|
}
|
|
1812
|
-
vr(e, t),
|
|
1826
|
+
vr(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
1813
1827
|
}
|
|
1814
1828
|
function wr() {
|
|
1815
1829
|
if (typeof window > "u" || typeof document > "u")
|
|
@@ -1830,12 +1844,12 @@ function xr() {
|
|
|
1830
1844
|
document.querySelectorAll("body, body *")
|
|
1831
1845
|
);
|
|
1832
1846
|
let t = null, r = 0;
|
|
1833
|
-
for (const
|
|
1834
|
-
if (!_r(
|
|
1835
|
-
const
|
|
1836
|
-
if (
|
|
1837
|
-
const l =
|
|
1838
|
-
l > r && (r = l, t =
|
|
1847
|
+
for (const i of e) {
|
|
1848
|
+
if (!_r(i)) continue;
|
|
1849
|
+
const o = i.getBoundingClientRect();
|
|
1850
|
+
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;
|
|
1851
|
+
const l = o.width * o.height;
|
|
1852
|
+
l > r && (r = l, t = i);
|
|
1839
1853
|
}
|
|
1840
1854
|
return t;
|
|
1841
1855
|
}
|
|
@@ -1884,16 +1898,16 @@ function Cr(e) {
|
|
|
1884
1898
|
const {
|
|
1885
1899
|
agentId: t,
|
|
1886
1900
|
apiKey: r,
|
|
1887
|
-
baseUrl:
|
|
1888
|
-
sessionEndpoint:
|
|
1901
|
+
baseUrl: i = "https://app.livelayer.studio",
|
|
1902
|
+
sessionEndpoint: o,
|
|
1889
1903
|
sessionBody: l,
|
|
1890
|
-
autoConnect:
|
|
1904
|
+
autoConnect: c = !1,
|
|
1891
1905
|
displayMode: d,
|
|
1892
1906
|
defaultDisplayMode: f = "expanded",
|
|
1893
1907
|
onDisplayModeChange: y,
|
|
1894
1908
|
position: g = "bottom-right",
|
|
1895
1909
|
mobileBreakpoint: a = 640,
|
|
1896
|
-
persistKey:
|
|
1910
|
+
persistKey: s = "ll-widget",
|
|
1897
1911
|
disablePersistence: I = !1,
|
|
1898
1912
|
teamMembers: C,
|
|
1899
1913
|
currentTeamMemberId: S,
|
|
@@ -1909,43 +1923,43 @@ function Cr(e) {
|
|
|
1909
1923
|
showOn: A,
|
|
1910
1924
|
hideOn: O,
|
|
1911
1925
|
pathname: W,
|
|
1912
|
-
onNavigate:
|
|
1913
|
-
onScrollToSelector:
|
|
1926
|
+
onNavigate: G,
|
|
1927
|
+
onScrollToSelector: te,
|
|
1914
1928
|
getPageContext: me,
|
|
1915
|
-
pageContextExtras:
|
|
1916
|
-
getRoutes:
|
|
1917
|
-
onScrollPage:
|
|
1918
|
-
onClick:
|
|
1919
|
-
capabilities:
|
|
1929
|
+
pageContextExtras: Ve,
|
|
1930
|
+
getRoutes: Ye,
|
|
1931
|
+
onScrollPage: Ge,
|
|
1932
|
+
onClick: Je,
|
|
1933
|
+
capabilities: Z,
|
|
1920
1934
|
onConnect: ge,
|
|
1921
|
-
onDisconnect:
|
|
1922
|
-
onTranscript:
|
|
1923
|
-
onAgentState:
|
|
1924
|
-
onConnectionStateChange:
|
|
1925
|
-
onAgentEvent:
|
|
1926
|
-
onAgentCommand:
|
|
1935
|
+
onDisconnect: _e,
|
|
1936
|
+
onTranscript: xe,
|
|
1937
|
+
onAgentState: ke,
|
|
1938
|
+
onConnectionStateChange: Le,
|
|
1939
|
+
onAgentEvent: Se,
|
|
1940
|
+
onAgentCommand: Ce,
|
|
1927
1941
|
controlledSession: V,
|
|
1928
|
-
className:
|
|
1929
|
-
style:
|
|
1930
|
-
zIndex:
|
|
1931
|
-
} = e,
|
|
1942
|
+
className: st,
|
|
1943
|
+
style: Ke,
|
|
1944
|
+
zIndex: Xe = 2147483647
|
|
1945
|
+
} = e, ce = Tn(W), Oe = Bn(ce, A, O);
|
|
1932
1946
|
R(() => {
|
|
1933
1947
|
ur(), yr();
|
|
1934
|
-
}, [
|
|
1935
|
-
const
|
|
1948
|
+
}, [ce]);
|
|
1949
|
+
const se = S !== void 0, [Ee, re] = L(() => {
|
|
1936
1950
|
var m;
|
|
1937
1951
|
return S ?? ((m = C == null ? void 0 : C[0]) == null ? void 0 : m.id);
|
|
1938
|
-
}),
|
|
1939
|
-
() => (C == null ? void 0 : C.find((m) => m.id ===
|
|
1940
|
-
[C,
|
|
1941
|
-
),
|
|
1952
|
+
}), ye = se ? S : Ee, J = ot(
|
|
1953
|
+
() => (C == null ? void 0 : C.find((m) => m.id === ye)) ?? null,
|
|
1954
|
+
[C, ye]
|
|
1955
|
+
), ve = (J == null ? void 0 : J.agentId) ?? t, [be, ie] = An({
|
|
1942
1956
|
value: d,
|
|
1943
1957
|
defaultValue: f,
|
|
1944
1958
|
onChange: y,
|
|
1945
|
-
persistKey:
|
|
1959
|
+
persistKey: s,
|
|
1946
1960
|
disablePersistence: I
|
|
1947
|
-
}),
|
|
1948
|
-
|
|
1961
|
+
}), Ne = In(a), Ae = yn(), ne = vn(), ee = wn(), oe = _n(), de = xn(), [Re, ue] = L(!1), [Ie, Qe] = L(!1), [Be, le] = L(!1), [fe, Ze] = L(!1), [Me, ct] = L(!1), Te = E(G), p = E(te), Y = E(Ge), et = E(Je), yt = E(me), vt = E(Ve), bt = E(Ye), dt = E(Z), ae = E(null);
|
|
1962
|
+
Te.current = G, p.current = te, Y.current = Ge, et.current = Je, yt.current = me, vt.current = Ve, bt.current = Ye, dt.current = Z;
|
|
1949
1963
|
function pe(m) {
|
|
1950
1964
|
const u = dt.current;
|
|
1951
1965
|
return u ? u.includes(m) : !0;
|
|
@@ -1955,12 +1969,12 @@ function Cr(e) {
|
|
|
1955
1969
|
`[LiveLayer] Agent command "${m}" blocked — capability "${u}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
|
|
1956
1970
|
);
|
|
1957
1971
|
}
|
|
1958
|
-
const
|
|
1972
|
+
const qe = k(
|
|
1959
1973
|
(m) => {
|
|
1960
|
-
var
|
|
1974
|
+
var K, Pe, nt, Rt;
|
|
1961
1975
|
const u = m;
|
|
1962
1976
|
if (!(!u.type || typeof u.type != "string")) {
|
|
1963
|
-
if (
|
|
1977
|
+
if (Se == null || Se({ eventName: u.type, data: m }), u.type === "navigate") {
|
|
1964
1978
|
if (!pe("navigate")) {
|
|
1965
1979
|
he("navigate", "navigate");
|
|
1966
1980
|
return;
|
|
@@ -1972,9 +1986,9 @@ function Cr(e) {
|
|
|
1972
1986
|
);
|
|
1973
1987
|
return;
|
|
1974
1988
|
}
|
|
1975
|
-
if (
|
|
1989
|
+
if (Te.current) {
|
|
1976
1990
|
try {
|
|
1977
|
-
|
|
1991
|
+
Te.current(x);
|
|
1978
1992
|
} catch (T) {
|
|
1979
1993
|
console.warn(
|
|
1980
1994
|
`[LiveLayer] onNavigate threw for "${x}". Falling back. Error:`,
|
|
@@ -2011,9 +2025,9 @@ function Cr(e) {
|
|
|
2011
2025
|
const x = typeof u.selector == "string" ? u.selector : null;
|
|
2012
2026
|
if (!x) return;
|
|
2013
2027
|
const T = u.behavior === "instant" ? "instant" : "smooth";
|
|
2014
|
-
if (
|
|
2028
|
+
if (p.current) {
|
|
2015
2029
|
try {
|
|
2016
|
-
|
|
2030
|
+
p.current(
|
|
2017
2031
|
x,
|
|
2018
2032
|
T
|
|
2019
2033
|
);
|
|
@@ -2050,14 +2064,14 @@ function Cr(e) {
|
|
|
2050
2064
|
he("request_page_context", "read_page");
|
|
2051
2065
|
return;
|
|
2052
2066
|
}
|
|
2053
|
-
const x = typeof u.requestId == "string" ? u.requestId : void 0, T = (
|
|
2054
|
-
const P = T,
|
|
2055
|
-
if (
|
|
2067
|
+
const x = typeof u.requestId == "string" ? u.requestId : void 0, T = (K = ae.current) == null ? void 0 : K.call(ae), B = (j) => {
|
|
2068
|
+
const P = T, X = P == null ? void 0 : P.localParticipant;
|
|
2069
|
+
if (X != null && X.publishData)
|
|
2056
2070
|
try {
|
|
2057
|
-
const
|
|
2058
|
-
|
|
2059
|
-
} catch (
|
|
2060
|
-
console.warn("[LiveLayer] publishData failed.",
|
|
2071
|
+
const Q = x ? { ...j, requestId: x } : j, De = new TextEncoder().encode(JSON.stringify(Q));
|
|
2072
|
+
X.publishData(De, { reliable: !0 });
|
|
2073
|
+
} catch (Q) {
|
|
2074
|
+
console.warn("[LiveLayer] publishData failed.", Q);
|
|
2061
2075
|
}
|
|
2062
2076
|
}, $ = vt.current, F = yt.current;
|
|
2063
2077
|
try {
|
|
@@ -2106,9 +2120,9 @@ function Cr(e) {
|
|
|
2106
2120
|
return;
|
|
2107
2121
|
}
|
|
2108
2122
|
const T = u.behavior === "instant" ? "instant" : "smooth";
|
|
2109
|
-
if (
|
|
2123
|
+
if (Y.current) {
|
|
2110
2124
|
try {
|
|
2111
|
-
|
|
2125
|
+
Y.current(
|
|
2112
2126
|
x,
|
|
2113
2127
|
T
|
|
2114
2128
|
);
|
|
@@ -2136,9 +2150,9 @@ function Cr(e) {
|
|
|
2136
2150
|
console.warn("[LiveLayer] click: missing selector.");
|
|
2137
2151
|
return;
|
|
2138
2152
|
}
|
|
2139
|
-
if (
|
|
2153
|
+
if (et.current) {
|
|
2140
2154
|
try {
|
|
2141
|
-
|
|
2155
|
+
et.current(x);
|
|
2142
2156
|
} catch (B) {
|
|
2143
2157
|
console.warn("[LiveLayer] onClick threw.", B);
|
|
2144
2158
|
}
|
|
@@ -2166,7 +2180,7 @@ function Cr(e) {
|
|
|
2166
2180
|
);
|
|
2167
2181
|
return;
|
|
2168
2182
|
}
|
|
2169
|
-
(
|
|
2183
|
+
(Pe = T.click) == null || Pe.call(T);
|
|
2170
2184
|
return;
|
|
2171
2185
|
}
|
|
2172
2186
|
if (u.type === "fill_form" || u.type === "focus_field") {
|
|
@@ -2208,7 +2222,7 @@ function Cr(e) {
|
|
|
2208
2222
|
);
|
|
2209
2223
|
return;
|
|
2210
2224
|
}
|
|
2211
|
-
if (!
|
|
2225
|
+
if (!at(F)) {
|
|
2212
2226
|
console.warn(
|
|
2213
2227
|
`[LiveLayer] focus_field: field "${$}" is privacy-protected and not focusable.`
|
|
2214
2228
|
);
|
|
@@ -2231,7 +2245,7 @@ function Cr(e) {
|
|
|
2231
2245
|
);
|
|
2232
2246
|
continue;
|
|
2233
2247
|
}
|
|
2234
|
-
if (!
|
|
2248
|
+
if (!at(j)) {
|
|
2235
2249
|
console.warn(
|
|
2236
2250
|
`[LiveLayer] fill_form: field "${$}" is privacy-protected (password / cc-* / private). Skipping.`
|
|
2237
2251
|
);
|
|
@@ -2274,12 +2288,12 @@ function Cr(e) {
|
|
|
2274
2288
|
);
|
|
2275
2289
|
return;
|
|
2276
2290
|
}
|
|
2277
|
-
const B = typeof u.requestId == "string" ? u.requestId : void 0, $ = (
|
|
2278
|
-
const
|
|
2279
|
-
if (
|
|
2291
|
+
const B = typeof u.requestId == "string" ? u.requestId : void 0, $ = (nt = ae.current) == null ? void 0 : nt.call(ae), F = (X) => {
|
|
2292
|
+
const Q = $, De = Q == null ? void 0 : Q.localParticipant;
|
|
2293
|
+
if (De != null && De.publishData)
|
|
2280
2294
|
try {
|
|
2281
|
-
const
|
|
2282
|
-
|
|
2295
|
+
const sn = B ? { ...X, requestId: B } : X, cn = new TextEncoder().encode(JSON.stringify(sn));
|
|
2296
|
+
De.publishData(cn, { reliable: !0 });
|
|
2283
2297
|
} catch {
|
|
2284
2298
|
}
|
|
2285
2299
|
};
|
|
@@ -2290,8 +2304,8 @@ function Cr(e) {
|
|
|
2290
2304
|
T.addEventListener("submit", P, { once: !0 });
|
|
2291
2305
|
try {
|
|
2292
2306
|
typeof T.requestSubmit == "function" ? T.requestSubmit() : T.submit();
|
|
2293
|
-
} catch (
|
|
2294
|
-
console.warn("[LiveLayer] submit_form: requestSubmit threw.",
|
|
2307
|
+
} catch (X) {
|
|
2308
|
+
console.warn("[LiveLayer] submit_form: requestSubmit threw.", X), T.removeEventListener("submit", P), F({
|
|
2295
2309
|
type: "form_submit_blocked",
|
|
2296
2310
|
formId: x,
|
|
2297
2311
|
reason: "exception"
|
|
@@ -2316,27 +2330,27 @@ function Cr(e) {
|
|
|
2316
2330
|
if (!($ != null && $.publishData)) return;
|
|
2317
2331
|
const F = (P) => {
|
|
2318
2332
|
try {
|
|
2319
|
-
const
|
|
2320
|
-
$.publishData(
|
|
2321
|
-
} catch (
|
|
2322
|
-
console.warn("[LiveLayer] request_routes: publishData failed.",
|
|
2333
|
+
const X = x ? { type: "routes", routes: P, requestId: x } : { type: "routes", routes: P }, Q = new TextEncoder().encode(JSON.stringify(X));
|
|
2334
|
+
$.publishData(Q, { reliable: !0 });
|
|
2335
|
+
} catch (X) {
|
|
2336
|
+
console.warn("[LiveLayer] request_routes: publishData failed.", X);
|
|
2323
2337
|
}
|
|
2324
2338
|
}, j = bt.current;
|
|
2325
2339
|
if (j) {
|
|
2326
2340
|
try {
|
|
2327
|
-
const P = j(),
|
|
2328
|
-
if (!Array.isArray(
|
|
2341
|
+
const P = j(), X = (Q) => {
|
|
2342
|
+
if (!Array.isArray(Q)) {
|
|
2329
2343
|
F([]);
|
|
2330
2344
|
return;
|
|
2331
2345
|
}
|
|
2332
|
-
F(
|
|
2346
|
+
F(Q.map(pr).slice(0, 200));
|
|
2333
2347
|
};
|
|
2334
|
-
P instanceof Promise ? P.then(
|
|
2348
|
+
P instanceof Promise ? P.then(X).catch((Q) => {
|
|
2335
2349
|
console.warn(
|
|
2336
2350
|
"[LiveLayer] getRoutes rejected; falling back to DOM walker.",
|
|
2337
|
-
|
|
2351
|
+
Q
|
|
2338
2352
|
), F(ft());
|
|
2339
|
-
}) :
|
|
2353
|
+
}) : X(P);
|
|
2340
2354
|
} catch (P) {
|
|
2341
2355
|
console.warn(
|
|
2342
2356
|
"[LiveLayer] getRoutes threw; falling back to DOM walker.",
|
|
@@ -2352,51 +2366,51 @@ function Cr(e) {
|
|
|
2352
2366
|
}
|
|
2353
2367
|
return;
|
|
2354
2368
|
}
|
|
2355
|
-
Sr.has(u.type) ||
|
|
2369
|
+
Sr.has(u.type) || Ce == null || Ce(u);
|
|
2356
2370
|
}
|
|
2357
2371
|
},
|
|
2358
|
-
[
|
|
2372
|
+
[Ce, Se]
|
|
2359
2373
|
), U = gn({
|
|
2360
|
-
agentId: V ? "__controlled__" :
|
|
2361
|
-
baseUrl:
|
|
2374
|
+
agentId: V ? "__controlled__" : ve,
|
|
2375
|
+
baseUrl: i,
|
|
2362
2376
|
apiKey: r,
|
|
2363
|
-
sessionEndpoint:
|
|
2377
|
+
sessionEndpoint: o,
|
|
2364
2378
|
sessionBody: l,
|
|
2365
|
-
onDataMessage: V ? void 0 :
|
|
2379
|
+
onDataMessage: V ? void 0 : qe
|
|
2366
2380
|
});
|
|
2367
2381
|
R(() => {
|
|
2368
2382
|
if (V != null && V.subscribeToDataMessages)
|
|
2369
|
-
return V.subscribeToDataMessages(
|
|
2370
|
-
}, [V,
|
|
2383
|
+
return V.subscribeToDataMessages(qe);
|
|
2384
|
+
}, [V, qe]), ae.current = () => {
|
|
2371
2385
|
var m;
|
|
2372
2386
|
return (m = U.getRoom) == null ? void 0 : m.call(U);
|
|
2373
2387
|
}, R(() => {
|
|
2374
|
-
var
|
|
2375
|
-
if (!
|
|
2376
|
-
const m = (
|
|
2388
|
+
var K;
|
|
2389
|
+
if (!ce) return;
|
|
2390
|
+
const m = (K = U.getRoom) == null ? void 0 : K.call(U), u = m == null ? void 0 : m.localParticipant;
|
|
2377
2391
|
if (u != null && u.publishData)
|
|
2378
2392
|
try {
|
|
2379
|
-
const
|
|
2380
|
-
JSON.stringify({ type: "pathname", pathname:
|
|
2393
|
+
const Pe = new TextEncoder().encode(
|
|
2394
|
+
JSON.stringify({ type: "pathname", pathname: ce })
|
|
2381
2395
|
);
|
|
2382
|
-
u.publishData(
|
|
2396
|
+
u.publishData(Pe, { reliable: !0 });
|
|
2383
2397
|
} catch {
|
|
2384
2398
|
}
|
|
2385
|
-
}, [
|
|
2386
|
-
var
|
|
2399
|
+
}, [ce, U, U.connectionState]), R(() => {
|
|
2400
|
+
var K;
|
|
2387
2401
|
if (typeof window > "u") return;
|
|
2388
|
-
const m = ((
|
|
2402
|
+
const m = ((K = window.location) == null ? void 0 : K.hostname) || "";
|
|
2389
2403
|
if (m === "localhost" || m === "127.0.0.1" || m === "0.0.0.0" || m.endsWith(".local") || m.endsWith(".test"))
|
|
2390
|
-
return window.__livelayerSimulateCommand = (
|
|
2404
|
+
return window.__livelayerSimulateCommand = (Pe) => {
|
|
2391
2405
|
try {
|
|
2392
|
-
|
|
2393
|
-
} catch (
|
|
2394
|
-
console.warn("[LiveLayer] simulate-command threw:",
|
|
2406
|
+
qe(Pe);
|
|
2407
|
+
} catch (nt) {
|
|
2408
|
+
console.warn("[LiveLayer] simulate-command threw:", nt);
|
|
2395
2409
|
}
|
|
2396
2410
|
}, () => {
|
|
2397
2411
|
delete window.__livelayerSimulateCommand;
|
|
2398
2412
|
};
|
|
2399
|
-
}, [
|
|
2413
|
+
}, [qe]);
|
|
2400
2414
|
const w = ot(() => V ? {
|
|
2401
2415
|
connectionState: V.connectionState,
|
|
2402
2416
|
agentState: V.agentState,
|
|
@@ -2438,166 +2452,166 @@ function Cr(e) {
|
|
|
2438
2452
|
}, [w.videoElement]), R(() => {
|
|
2439
2453
|
const m = w.audioElement;
|
|
2440
2454
|
if (!m) return;
|
|
2441
|
-
|
|
2455
|
+
Ae.attach(m);
|
|
2442
2456
|
const u = m.play();
|
|
2443
|
-
return u && typeof u.catch == "function" && u.catch((
|
|
2444
|
-
(
|
|
2457
|
+
return u && typeof u.catch == "function" && u.catch((K) => {
|
|
2458
|
+
(K == null ? void 0 : K.name) === "NotAllowedError" && ue(!0);
|
|
2445
2459
|
}), () => {
|
|
2446
|
-
|
|
2460
|
+
Ae.detach();
|
|
2447
2461
|
};
|
|
2448
2462
|
}, [w.audioElement]), R(() => {
|
|
2449
2463
|
if (w.isControlled || w.connectionState !== "connected") return;
|
|
2450
2464
|
const m = w.getRoom();
|
|
2451
2465
|
if (m)
|
|
2452
|
-
return
|
|
2453
|
-
}),
|
|
2454
|
-
|
|
2466
|
+
return ne.setupMic(m).catch(() => {
|
|
2467
|
+
}), ee.attachRoom(m), oe.attachRoom(m), de.refresh(), () => {
|
|
2468
|
+
ne.teardownMic(), ee.teardown(), oe.teardown();
|
|
2455
2469
|
};
|
|
2456
2470
|
}, [w.isControlled, w.connectionState]), R(() => {
|
|
2457
2471
|
const m = w.audioElement;
|
|
2458
|
-
m && (m.muted =
|
|
2459
|
-
}, [w.audioElement,
|
|
2472
|
+
m && (m.muted = Me);
|
|
2473
|
+
}, [w.audioElement, Me]);
|
|
2460
2474
|
const Kt = k((m) => {
|
|
2461
2475
|
const u = w.getRoom();
|
|
2462
2476
|
if (u)
|
|
2463
2477
|
try {
|
|
2464
|
-
const
|
|
2478
|
+
const K = new TextEncoder().encode(
|
|
2465
2479
|
JSON.stringify({ type: "user_message", text: m })
|
|
2466
2480
|
);
|
|
2467
|
-
u.localParticipant.publishData(
|
|
2481
|
+
u.localParticipant.publishData(K, { reliable: !0 });
|
|
2468
2482
|
} catch {
|
|
2469
2483
|
}
|
|
2470
2484
|
}, [w]), Xt = k(() => {
|
|
2471
|
-
|
|
2485
|
+
ct((m) => !m);
|
|
2472
2486
|
}, []);
|
|
2473
2487
|
R(() => {
|
|
2474
|
-
|
|
2475
|
-
}, [w.connectionState, ge,
|
|
2476
|
-
|
|
2477
|
-
}, [w.transcript,
|
|
2478
|
-
|
|
2479
|
-
}, [w.agentState,
|
|
2488
|
+
Le == null || Le(w.connectionState), w.connectionState === "connected" ? ge == null || ge() : w.connectionState === "disconnected" && (_e == null || _e());
|
|
2489
|
+
}, [w.connectionState, ge, _e, Le]), R(() => {
|
|
2490
|
+
xe == null || xe(w.transcript);
|
|
2491
|
+
}, [w.transcript, xe]), R(() => {
|
|
2492
|
+
ke == null || ke(w.agentState);
|
|
2493
|
+
}, [w.agentState, ke]);
|
|
2480
2494
|
const _t = E(!1);
|
|
2481
2495
|
R(() => {
|
|
2482
|
-
w.isControlled || !
|
|
2483
|
-
}, [
|
|
2496
|
+
w.isControlled || !c || _t.current || Oe && w.connectionState === "idle" && (_t.current = !0, w.connect());
|
|
2497
|
+
}, [c, w.connectionState, w, Oe]);
|
|
2484
2498
|
const Qt = k(
|
|
2485
2499
|
(m) => {
|
|
2486
|
-
const u = C == null ? void 0 : C.find((
|
|
2487
|
-
u && (
|
|
2500
|
+
const u = C == null ? void 0 : C.find((K) => K.id === m);
|
|
2501
|
+
u && (le(!1), m !== ye && (Qe(!0), w.disconnect(), se || re(m), v == null || v(u)));
|
|
2488
2502
|
},
|
|
2489
2503
|
[
|
|
2490
2504
|
C,
|
|
2491
|
-
|
|
2505
|
+
ye,
|
|
2492
2506
|
w,
|
|
2493
|
-
|
|
2507
|
+
se,
|
|
2494
2508
|
v
|
|
2495
2509
|
]
|
|
2496
2510
|
);
|
|
2497
2511
|
R(() => {
|
|
2498
|
-
|
|
2499
|
-
}, [w.connectionState,
|
|
2500
|
-
if (!
|
|
2512
|
+
Ie && w.connectionState === "connected" && Qe(!1);
|
|
2513
|
+
}, [w.connectionState, Ie]), R(() => {
|
|
2514
|
+
if (!Be) return;
|
|
2501
2515
|
const m = (u) => {
|
|
2502
|
-
u.key === "Escape" &&
|
|
2516
|
+
u.key === "Escape" && le(!1);
|
|
2503
2517
|
};
|
|
2504
2518
|
return window.addEventListener("keydown", m), () => window.removeEventListener("keydown", m);
|
|
2505
|
-
}, [
|
|
2506
|
-
const Zt = !!M || !!(
|
|
2507
|
-
|
|
2508
|
-
const
|
|
2509
|
-
() =>
|
|
2510
|
-
[
|
|
2519
|
+
}, [Be]);
|
|
2520
|
+
const Zt = !!M || !!(J != null && J.avatarImageUrl) || w.isControlled, We = kn(ve, i, Zt);
|
|
2521
|
+
Z === void 0 && ((kt = We.info) != null && kt.capabilities) && (dt.current = We.info.capabilities);
|
|
2522
|
+
const tt = (J == null ? void 0 : J.name) ?? H ?? ((Lt = w.agentConfig) == null ? void 0 : Lt.name) ?? ((St = We.info) == null ? void 0 : St.name) ?? "Live Layer", ut = (J == null ? void 0 : J.avatarImageUrl) ?? M ?? ((Ct = w.agentConfig) == null ? void 0 : Ct.avatarImageUrl) ?? ((Et = We.info) == null ? void 0 : Et.avatarImageUrl) ?? null, en = b ?? ((Nt = w.agentConfig) == null ? void 0 : Nt.idleLoopUrl) ?? ((At = We.info) == null ? void 0 : At.idleLoopUrl) ?? null, tn = z ?? null, nn = k(() => ie("expanded"), [ie]), rn = k(
|
|
2523
|
+
() => ie("minimized"),
|
|
2524
|
+
[ie]
|
|
2511
2525
|
), xt = k(() => {
|
|
2512
|
-
w.disconnect(),
|
|
2513
|
-
}, [w,
|
|
2526
|
+
w.disconnect(), ie("hidden");
|
|
2527
|
+
}, [w, ie]), on = k(() => {
|
|
2514
2528
|
const m = w.audioElement;
|
|
2515
2529
|
m && m.play().then(() => ue(!1)).catch(() => {
|
|
2516
2530
|
});
|
|
2517
2531
|
}, [w.audioElement]), ln = k(() => {
|
|
2518
2532
|
ue(!1), w.connect();
|
|
2519
|
-
}, [w]),
|
|
2520
|
-
...
|
|
2521
|
-
zIndex:
|
|
2533
|
+
}, [w]), Fe = {
|
|
2534
|
+
...Ke,
|
|
2535
|
+
zIndex: Xe
|
|
2522
2536
|
};
|
|
2523
|
-
h.primaryColor && (
|
|
2537
|
+
h.primaryColor && (Fe["--ll-color-primary"] = h.primaryColor), h.accentColor && (Fe["--ll-color-accent"] = h.accentColor), h.backgroundColor && (Fe["--ll-color-bg"] = h.backgroundColor), h.textColor && (Fe["--ll-color-fg"] = h.textColor);
|
|
2524
2538
|
const an = [
|
|
2525
2539
|
"ll-widget",
|
|
2526
|
-
`ll-widget--${
|
|
2527
|
-
`ll-widget--${
|
|
2528
|
-
|
|
2540
|
+
`ll-widget--${be}`,
|
|
2541
|
+
`ll-widget--${Ne ? "mobile" : "desktop"}`,
|
|
2542
|
+
st
|
|
2529
2543
|
].filter(Boolean).join(" ");
|
|
2530
|
-
return
|
|
2544
|
+
return Oe ? /* @__PURE__ */ _(
|
|
2531
2545
|
"div",
|
|
2532
2546
|
{
|
|
2533
2547
|
className: an,
|
|
2534
|
-
style:
|
|
2535
|
-
"data-display-mode":
|
|
2548
|
+
style: Fe,
|
|
2549
|
+
"data-display-mode": be,
|
|
2536
2550
|
"data-position": g,
|
|
2537
2551
|
children: [
|
|
2538
|
-
|
|
2552
|
+
be === "hidden" && /* @__PURE__ */ n(
|
|
2539
2553
|
Vn,
|
|
2540
2554
|
{
|
|
2541
2555
|
position: g,
|
|
2542
|
-
isMobile:
|
|
2556
|
+
isMobile: Ne,
|
|
2543
2557
|
isSpeaking: w.agentState === "speaking",
|
|
2544
|
-
onExpand: () =>
|
|
2545
|
-
label: `Open ${
|
|
2558
|
+
onExpand: () => ie("expanded"),
|
|
2559
|
+
label: `Open ${tt} widget`,
|
|
2546
2560
|
avatarImageUrl: ut,
|
|
2547
|
-
agentName:
|
|
2561
|
+
agentName: tt
|
|
2548
2562
|
}
|
|
2549
2563
|
),
|
|
2550
|
-
|
|
2564
|
+
be === "minimized" && /* @__PURE__ */ n(
|
|
2551
2565
|
Gn,
|
|
2552
2566
|
{
|
|
2553
2567
|
position: g,
|
|
2554
|
-
isMobile:
|
|
2555
|
-
agentName:
|
|
2568
|
+
isMobile: Ne,
|
|
2569
|
+
agentName: tt,
|
|
2556
2570
|
avatarImageUrl: ut,
|
|
2557
2571
|
agentState: w.agentState,
|
|
2558
|
-
isMuted:
|
|
2559
|
-
audioLevel:
|
|
2572
|
+
isMuted: ne.isMuted,
|
|
2573
|
+
audioLevel: Ae,
|
|
2560
2574
|
onExpand: nn,
|
|
2561
|
-
onToggleMute:
|
|
2575
|
+
onToggleMute: ne.toggleMute,
|
|
2562
2576
|
onClose: xt
|
|
2563
2577
|
}
|
|
2564
2578
|
),
|
|
2565
|
-
|
|
2579
|
+
be === "expanded" && /* @__PURE__ */ n(
|
|
2566
2580
|
Kn,
|
|
2567
2581
|
{
|
|
2568
2582
|
position: g,
|
|
2569
|
-
isMobile:
|
|
2570
|
-
agentName:
|
|
2583
|
+
isMobile: Ne,
|
|
2584
|
+
agentName: tt,
|
|
2571
2585
|
avatarImageUrl: ut,
|
|
2572
2586
|
idleLoopUrl: en,
|
|
2573
2587
|
greeting: tn,
|
|
2574
2588
|
branding: h,
|
|
2575
2589
|
teamMembers: C,
|
|
2576
|
-
currentTeamMemberId:
|
|
2577
|
-
isSwitchingTeamMember:
|
|
2578
|
-
teamSwitcherOpen:
|
|
2579
|
-
onToggleTeamSwitcher: () =>
|
|
2590
|
+
currentTeamMemberId: ye,
|
|
2591
|
+
isSwitchingTeamMember: Ie,
|
|
2592
|
+
teamSwitcherOpen: Be,
|
|
2593
|
+
onToggleTeamSwitcher: () => le((m) => !m),
|
|
2580
2594
|
onSelectTeamMember: Qt,
|
|
2581
2595
|
connectionState: w.connectionState,
|
|
2582
2596
|
agentState: w.agentState,
|
|
2583
2597
|
transcript: w.transcript,
|
|
2584
|
-
isMuted:
|
|
2598
|
+
isMuted: ne.isMuted,
|
|
2585
2599
|
micDevices: de.mics,
|
|
2586
|
-
isCameraEnabled:
|
|
2587
|
-
cameraPreviewEl:
|
|
2600
|
+
isCameraEnabled: ee.isEnabled,
|
|
2601
|
+
cameraPreviewEl: ee.previewEl,
|
|
2588
2602
|
cameraDevices: de.cameras,
|
|
2589
|
-
activeCameraId:
|
|
2590
|
-
isScreenShareEnabled:
|
|
2591
|
-
screenPreviewEl:
|
|
2592
|
-
isSpeakerMuted:
|
|
2603
|
+
activeCameraId: ee.activeDeviceId,
|
|
2604
|
+
isScreenShareEnabled: oe.isEnabled,
|
|
2605
|
+
screenPreviewEl: oe.previewEl,
|
|
2606
|
+
isSpeakerMuted: Me,
|
|
2593
2607
|
allowCamera: N,
|
|
2594
2608
|
allowScreenShare: q,
|
|
2595
2609
|
allowTyping: D,
|
|
2596
|
-
languageMenuOpen:
|
|
2597
|
-
onToggleLanguageMenu: () =>
|
|
2598
|
-
needsUserGesture:
|
|
2610
|
+
languageMenuOpen: fe,
|
|
2611
|
+
onToggleLanguageMenu: () => Ze((m) => !m),
|
|
2612
|
+
needsUserGesture: Re,
|
|
2599
2613
|
canResume: w.canResume,
|
|
2600
|
-
micError:
|
|
2614
|
+
micError: ne.micError,
|
|
2601
2615
|
error: w.error,
|
|
2602
2616
|
avatarVideoContainerRef: wt,
|
|
2603
2617
|
agentVideoEl: w.videoElement,
|
|
@@ -2605,15 +2619,15 @@ function Cr(e) {
|
|
|
2605
2619
|
onDisconnect: () => w.disconnect(),
|
|
2606
2620
|
onRetry: ln,
|
|
2607
2621
|
onResumeAudio: on,
|
|
2608
|
-
onToggleMute:
|
|
2609
|
-
onToggleCamera: () => void
|
|
2610
|
-
onSwitchCameraDevice: (m) => void
|
|
2611
|
-
onToggleScreenShare: () => void
|
|
2622
|
+
onToggleMute: ne.toggleMute,
|
|
2623
|
+
onToggleCamera: () => void ee.toggle(),
|
|
2624
|
+
onSwitchCameraDevice: (m) => void ee.switchDevice(m),
|
|
2625
|
+
onToggleScreenShare: () => void oe.toggle(),
|
|
2612
2626
|
onToggleSpeaker: Xt,
|
|
2613
2627
|
onSendMessage: Kt,
|
|
2614
2628
|
onMinimize: rn,
|
|
2615
2629
|
onClose: xt,
|
|
2616
|
-
onClearMicError:
|
|
2630
|
+
onClearMicError: ne.clearError
|
|
2617
2631
|
}
|
|
2618
2632
|
)
|
|
2619
2633
|
]
|
|
@@ -2627,93 +2641,93 @@ const Dr = ({
|
|
|
2627
2641
|
agentId: e,
|
|
2628
2642
|
baseUrl: t,
|
|
2629
2643
|
apiKey: r,
|
|
2630
|
-
mode:
|
|
2631
|
-
onAgentEvent:
|
|
2644
|
+
mode: i,
|
|
2645
|
+
onAgentEvent: o,
|
|
2632
2646
|
className: l,
|
|
2633
|
-
style:
|
|
2647
|
+
style: c
|
|
2634
2648
|
}) => {
|
|
2635
|
-
const d = E(null), f = E(null), y = E(
|
|
2636
|
-
y.current =
|
|
2649
|
+
const d = E(null), f = E(null), y = E(o);
|
|
2650
|
+
y.current = o;
|
|
2637
2651
|
const g = k((a) => {
|
|
2638
2652
|
var I;
|
|
2639
|
-
const
|
|
2640
|
-
(I = y.current) == null || I.call(y,
|
|
2653
|
+
const s = a.detail;
|
|
2654
|
+
(I = y.current) == null || I.call(y, s);
|
|
2641
2655
|
}, []);
|
|
2642
2656
|
return R(() => {
|
|
2643
2657
|
const a = d.current;
|
|
2644
2658
|
if (!a) return;
|
|
2645
|
-
const
|
|
2646
|
-
return
|
|
2647
|
-
|
|
2659
|
+
const s = document.createElement("livelayer-widget");
|
|
2660
|
+
return s.setAttribute("agent-id", e), t && s.setAttribute("base-url", t), r && s.setAttribute("api-key", r), i && s.setAttribute("mode", i), s.addEventListener("agent-event", g), a.appendChild(s), f.current = s, () => {
|
|
2661
|
+
s.removeEventListener("agent-event", g), a.removeChild(s), f.current = null;
|
|
2648
2662
|
};
|
|
2649
2663
|
}, [e]), R(() => {
|
|
2650
|
-
f.current && (
|
|
2651
|
-
}, [
|
|
2664
|
+
f.current && (i ? f.current.setAttribute("mode", i) : f.current.removeAttribute("mode"));
|
|
2665
|
+
}, [i]), /* @__PURE__ */ n("div", { ref: d, className: l, style: c });
|
|
2652
2666
|
}, $r = mt(
|
|
2653
|
-
function({ id: t, intent: r, as:
|
|
2667
|
+
function({ id: t, intent: r, as: i = "div", className: o, style: l, children: c }, d) {
|
|
2654
2668
|
return un(
|
|
2655
|
-
|
|
2669
|
+
i,
|
|
2656
2670
|
{
|
|
2657
2671
|
ref: d,
|
|
2658
2672
|
"data-ll-region": t,
|
|
2659
2673
|
"data-ll-intent": r,
|
|
2660
|
-
className:
|
|
2674
|
+
className: o,
|
|
2661
2675
|
style: l
|
|
2662
2676
|
},
|
|
2663
|
-
|
|
2677
|
+
c
|
|
2664
2678
|
);
|
|
2665
2679
|
}
|
|
2666
2680
|
), zr = mt(
|
|
2667
|
-
function({ id: t, intent: r, children:
|
|
2681
|
+
function({ id: t, intent: r, children: i, ...o }, l) {
|
|
2668
2682
|
return /* @__PURE__ */ n(
|
|
2669
2683
|
"form",
|
|
2670
2684
|
{
|
|
2671
2685
|
ref: l,
|
|
2672
2686
|
"data-ll-form": t,
|
|
2673
2687
|
"data-ll-intent": r,
|
|
2674
|
-
...
|
|
2675
|
-
children:
|
|
2688
|
+
...o,
|
|
2689
|
+
children: i
|
|
2676
2690
|
}
|
|
2677
2691
|
);
|
|
2678
2692
|
}
|
|
2679
2693
|
), Hr = mt(
|
|
2680
2694
|
function(t, r) {
|
|
2681
|
-
const { name:
|
|
2695
|
+
const { name: i, label: o, labelClassName: l } = t, c = { name: i, "data-ll-field": i };
|
|
2682
2696
|
let d;
|
|
2683
2697
|
if ("as" in t && t.as === "textarea") {
|
|
2684
|
-
const { name: f, label: y, labelClassName: g, as: a, ...
|
|
2698
|
+
const { name: f, label: y, labelClassName: g, as: a, ...s } = t;
|
|
2685
2699
|
d = /* @__PURE__ */ n(
|
|
2686
2700
|
"textarea",
|
|
2687
2701
|
{
|
|
2688
2702
|
ref: r,
|
|
2689
|
-
...
|
|
2690
|
-
...
|
|
2703
|
+
...c,
|
|
2704
|
+
...s
|
|
2691
2705
|
}
|
|
2692
2706
|
);
|
|
2693
2707
|
} else if ("as" in t && t.as === "select") {
|
|
2694
|
-
const { name: f, label: y, labelClassName: g, as: a, children:
|
|
2708
|
+
const { name: f, label: y, labelClassName: g, as: a, children: s, ...I } = t;
|
|
2695
2709
|
d = /* @__PURE__ */ n(
|
|
2696
2710
|
"select",
|
|
2697
2711
|
{
|
|
2698
2712
|
ref: r,
|
|
2699
|
-
...
|
|
2713
|
+
...c,
|
|
2700
2714
|
...I,
|
|
2701
|
-
children:
|
|
2715
|
+
children: s
|
|
2702
2716
|
}
|
|
2703
2717
|
);
|
|
2704
2718
|
} else {
|
|
2705
|
-
const { name: f, label: y, labelClassName: g, as: a, ...
|
|
2719
|
+
const { name: f, label: y, labelClassName: g, as: a, ...s } = t;
|
|
2706
2720
|
d = /* @__PURE__ */ n(
|
|
2707
2721
|
"input",
|
|
2708
2722
|
{
|
|
2709
2723
|
ref: r,
|
|
2710
|
-
...
|
|
2711
|
-
...
|
|
2724
|
+
...c,
|
|
2725
|
+
...s
|
|
2712
2726
|
}
|
|
2713
2727
|
);
|
|
2714
2728
|
}
|
|
2715
|
-
return
|
|
2716
|
-
|
|
2729
|
+
return o === void 0 ? d : /* @__PURE__ */ _("label", { className: l, children: [
|
|
2730
|
+
o,
|
|
2717
2731
|
d
|
|
2718
2732
|
] });
|
|
2719
2733
|
}
|
|
@@ -2724,28 +2738,28 @@ function Or({
|
|
|
2724
2738
|
defaultOpen: t = !1,
|
|
2725
2739
|
storageKey: r = "ll-debug-open"
|
|
2726
2740
|
}) {
|
|
2727
|
-
const [
|
|
2741
|
+
const [i, o] = L(t), [l, c] = L([]), [d, f] = L(""), [y, g] = L(!1), a = E(/* @__PURE__ */ new Set()), s = E([]), I = E(y);
|
|
2728
2742
|
I.current = y, R(() => {
|
|
2729
2743
|
try {
|
|
2730
2744
|
const v = localStorage.getItem(r);
|
|
2731
|
-
v === "1" &&
|
|
2745
|
+
v === "1" && o(!0), v === "0" && o(!1);
|
|
2732
2746
|
} catch {
|
|
2733
2747
|
}
|
|
2734
2748
|
}, [r]), R(() => {
|
|
2735
2749
|
try {
|
|
2736
|
-
localStorage.setItem(r,
|
|
2750
|
+
localStorage.setItem(r, i ? "1" : "0");
|
|
2737
2751
|
} catch {
|
|
2738
2752
|
}
|
|
2739
|
-
}, [
|
|
2753
|
+
}, [i, r]), R(() => {
|
|
2740
2754
|
const v = (b) => {
|
|
2741
|
-
(b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(),
|
|
2755
|
+
(b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(), o((z) => !z));
|
|
2742
2756
|
};
|
|
2743
2757
|
return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
|
|
2744
2758
|
}, []), R(() => {
|
|
2745
2759
|
const v = setInterval(() => {
|
|
2746
|
-
if (
|
|
2747
|
-
const b =
|
|
2748
|
-
|
|
2760
|
+
if (s.current.length === 0 || I.current) return;
|
|
2761
|
+
const b = s.current.splice(0, s.current.length);
|
|
2762
|
+
c(
|
|
2749
2763
|
(z) => [...b.reverse(), ...z].slice(0, 200)
|
|
2750
2764
|
);
|
|
2751
2765
|
}, 100);
|
|
@@ -2754,7 +2768,7 @@ function Or({
|
|
|
2754
2768
|
const C = E(!1);
|
|
2755
2769
|
if (R(() => {
|
|
2756
2770
|
!e || C.current || (C.current = !0, e((v) => {
|
|
2757
|
-
|
|
2771
|
+
s.current.push({
|
|
2758
2772
|
id: Yt++,
|
|
2759
2773
|
ts: Date.now(),
|
|
2760
2774
|
kind: "event",
|
|
@@ -2766,7 +2780,7 @@ function Or({
|
|
|
2766
2780
|
const v = console.warn, b = console.log, z = (M, H) => function(...h) {
|
|
2767
2781
|
try {
|
|
2768
2782
|
const N = typeof h[0] == "string" ? h[0] : "";
|
|
2769
|
-
N.startsWith("[LiveLayer]") &&
|
|
2783
|
+
N.startsWith("[LiveLayer]") && s.current.push({
|
|
2770
2784
|
id: Yt++,
|
|
2771
2785
|
ts: Date.now(),
|
|
2772
2786
|
kind: M,
|
|
@@ -2780,12 +2794,12 @@ function Or({
|
|
|
2780
2794
|
return console.warn = z("warn", v), console.log = z("log", b), () => {
|
|
2781
2795
|
console.warn = v, console.log = b;
|
|
2782
2796
|
};
|
|
2783
|
-
}, []), !
|
|
2797
|
+
}, []), !i)
|
|
2784
2798
|
return /* @__PURE__ */ n(
|
|
2785
2799
|
"button",
|
|
2786
2800
|
{
|
|
2787
2801
|
type: "button",
|
|
2788
|
-
onClick: () =>
|
|
2802
|
+
onClick: () => o(!0),
|
|
2789
2803
|
title: "Open LiveLayer debug panel (Cmd/Ctrl + Shift + L)",
|
|
2790
2804
|
"aria-label": "Open LiveLayer debug panel",
|
|
2791
2805
|
style: {
|
|
@@ -2868,7 +2882,7 @@ function Or({
|
|
|
2868
2882
|
{
|
|
2869
2883
|
type: "button",
|
|
2870
2884
|
onClick: () => {
|
|
2871
|
-
|
|
2885
|
+
c([]), s.current = [];
|
|
2872
2886
|
},
|
|
2873
2887
|
style: pt("transparent"),
|
|
2874
2888
|
title: "Clear buffer",
|
|
@@ -2879,7 +2893,7 @@ function Or({
|
|
|
2879
2893
|
"button",
|
|
2880
2894
|
{
|
|
2881
2895
|
type: "button",
|
|
2882
|
-
onClick: () =>
|
|
2896
|
+
onClick: () => o(!1),
|
|
2883
2897
|
style: pt("transparent"),
|
|
2884
2898
|
"aria-label": "Close",
|
|
2885
2899
|
title: "Close (Cmd/Ctrl + Shift + L)",
|
|
@@ -2952,7 +2966,7 @@ function Or({
|
|
|
2952
2966
|
entry: v,
|
|
2953
2967
|
expanded: a.current.has(v.id),
|
|
2954
2968
|
onToggle: () => {
|
|
2955
|
-
a.current.has(v.id) ? a.current.delete(v.id) : a.current.add(v.id),
|
|
2969
|
+
a.current.has(v.id) ? a.current.delete(v.id) : a.current.add(v.id), c((b) => [...b]);
|
|
2956
2970
|
}
|
|
2957
2971
|
},
|
|
2958
2972
|
v.id
|
|
@@ -2968,7 +2982,7 @@ function Er({
|
|
|
2968
2982
|
expanded: t,
|
|
2969
2983
|
onToggle: r
|
|
2970
2984
|
}) {
|
|
2971
|
-
const
|
|
2985
|
+
const i = e.kind === "warn" ? "#f59e0b" : e.type.startsWith("[LiveLayer]") ? "#94a3b8" : e.type === "navigate" || e.type === "scroll_page" || e.type === "scroll_to" || e.type === "click" ? "#22c55e" : e.type === "fill_form" || e.type === "submit_form" || e.type === "focus_field" ? "#a78bfa" : e.type === "request_page_context" || e.type === "request_routes" ? "#38bdf8" : e.type === "agent_state" ? "#facc15" : "#cbd5e1", o = new Date(e.ts).toLocaleTimeString("en-US", {
|
|
2972
2986
|
hour12: !1
|
|
2973
2987
|
});
|
|
2974
2988
|
return /* @__PURE__ */ _(
|
|
@@ -2998,14 +3012,14 @@ function Er({
|
|
|
2998
3012
|
fontVariantNumeric: "tabular-nums",
|
|
2999
3013
|
fontSize: 10
|
|
3000
3014
|
},
|
|
3001
|
-
children:
|
|
3015
|
+
children: o
|
|
3002
3016
|
}
|
|
3003
3017
|
),
|
|
3004
3018
|
/* @__PURE__ */ n(
|
|
3005
3019
|
"span",
|
|
3006
3020
|
{
|
|
3007
3021
|
style: {
|
|
3008
|
-
color:
|
|
3022
|
+
color: i,
|
|
3009
3023
|
fontWeight: 600,
|
|
3010
3024
|
flexShrink: 0
|
|
3011
3025
|
},
|
|
@@ -3052,20 +3066,20 @@ function Nr(e) {
|
|
|
3052
3066
|
}
|
|
3053
3067
|
}
|
|
3054
3068
|
function Br() {
|
|
3055
|
-
const [e, t] = L([]), r = k((
|
|
3069
|
+
const [e, t] = L([]), r = k((o) => {
|
|
3056
3070
|
t((l) => {
|
|
3057
|
-
const
|
|
3058
|
-
if (
|
|
3071
|
+
const c = l.findIndex((d) => d.id === o.id);
|
|
3072
|
+
if (c >= 0) {
|
|
3059
3073
|
const d = l.slice();
|
|
3060
|
-
return d[
|
|
3074
|
+
return d[c] = o, d;
|
|
3061
3075
|
}
|
|
3062
|
-
return [...l,
|
|
3076
|
+
return [...l, o];
|
|
3063
3077
|
});
|
|
3064
|
-
}, []),
|
|
3078
|
+
}, []), i = k(() => t([]), []);
|
|
3065
3079
|
return {
|
|
3066
3080
|
entries: e,
|
|
3067
3081
|
pushSegment: r,
|
|
3068
|
-
clear:
|
|
3082
|
+
clear: i,
|
|
3069
3083
|
latest: e.length > 0 ? e[e.length - 1] : null
|
|
3070
3084
|
};
|
|
3071
3085
|
}
|