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