@livelayer/react 0.5.5-pr66c.1 → 0.5.5-pr66c.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.d.ts +7 -0
- package/dist/index.js +3 -3
- package/dist/index.mjs +784 -781
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -34,22 +34,22 @@ class mn extends dn {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
function gn(e) {
|
|
37
|
-
const [t, r] = S("idle"), [o, i] = S("idle"), [l,
|
|
38
|
-
|
|
37
|
+
const [t, r] = S("idle"), [o, i] = S("idle"), [l, c] = S([]), [d, u] = S(null), [m, h] = S(null), [a, s] = S(null), [R, C] = S(!1), [L, v] = S(null), b = E(null), H = E(e.onDataMessage);
|
|
38
|
+
H.current = e.onDataMessage, T(() => {
|
|
39
39
|
const N = {
|
|
40
|
-
onConnectionStateChange: (
|
|
41
|
-
r(
|
|
40
|
+
onConnectionStateChange: ($) => {
|
|
41
|
+
r($), $ === "connected" && v(null);
|
|
42
42
|
},
|
|
43
43
|
onAgentStateChange: i,
|
|
44
|
-
onTranscript: (
|
|
45
|
-
onAgentConfig:
|
|
46
|
-
onAudioTrack: (
|
|
47
|
-
onVideoTrack: (
|
|
48
|
-
onVideoTrackRemoved: () =>
|
|
49
|
-
onError: (
|
|
50
|
-
onDataMessage: (
|
|
44
|
+
onTranscript: ($) => c([...$]),
|
|
45
|
+
onAgentConfig: u,
|
|
46
|
+
onAudioTrack: ($) => s($),
|
|
47
|
+
onVideoTrack: ($) => h($),
|
|
48
|
+
onVideoTrackRemoved: () => h(null),
|
|
49
|
+
onError: ($) => v($),
|
|
50
|
+
onDataMessage: ($) => {
|
|
51
51
|
var A;
|
|
52
|
-
(A =
|
|
52
|
+
(A = H.current) == null || A.call(H, $);
|
|
53
53
|
},
|
|
54
54
|
onResumabilityChange: C
|
|
55
55
|
}, B = new fn(
|
|
@@ -62,9 +62,9 @@ function gn(e) {
|
|
|
62
62
|
},
|
|
63
63
|
N
|
|
64
64
|
);
|
|
65
|
-
return b.current = B, r("idle"), i("idle"),
|
|
66
|
-
var
|
|
67
|
-
(
|
|
65
|
+
return b.current = B, r("idle"), i("idle"), c([]), u(null), h(null), s(null), C(!1), v(null), () => {
|
|
66
|
+
var $;
|
|
67
|
+
($ = B.destroy) == null || $.call(B), b.current = null;
|
|
68
68
|
};
|
|
69
69
|
}, [
|
|
70
70
|
e.agentId,
|
|
@@ -81,7 +81,7 @@ function gn(e) {
|
|
|
81
81
|
} catch (B) {
|
|
82
82
|
throw v(B instanceof Error ? B.message : String(B)), B;
|
|
83
83
|
}
|
|
84
|
-
}, []),
|
|
84
|
+
}, []), O = k(() => {
|
|
85
85
|
const N = b.current;
|
|
86
86
|
N && N.disconnect();
|
|
87
87
|
}, []), p = k(() => {
|
|
@@ -93,18 +93,18 @@ function gn(e) {
|
|
|
93
93
|
agentState: o,
|
|
94
94
|
transcript: l,
|
|
95
95
|
agentConfig: d,
|
|
96
|
-
videoElement:
|
|
96
|
+
videoElement: m,
|
|
97
97
|
audioElement: a,
|
|
98
98
|
canResume: R,
|
|
99
99
|
error: L,
|
|
100
100
|
connect: I,
|
|
101
|
-
disconnect:
|
|
101
|
+
disconnect: O,
|
|
102
102
|
getRoom: p,
|
|
103
103
|
session: b.current
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
function yn() {
|
|
107
|
-
const e = E(null), t = E(null), r = E(null), o = E(null), i = E(/* @__PURE__ */ new Set()), l = E(null),
|
|
107
|
+
const e = E(null), t = E(null), r = E(null), o = E(null), i = E(/* @__PURE__ */ new Set()), l = E(null), c = k(() => {
|
|
108
108
|
const a = t.current;
|
|
109
109
|
if (!a) {
|
|
110
110
|
o.current = null;
|
|
@@ -113,23 +113,23 @@ function yn() {
|
|
|
113
113
|
(!l.current || l.current.length !== a.frequencyBinCount) && (l.current = new Uint8Array(
|
|
114
114
|
new ArrayBuffer(a.frequencyBinCount)
|
|
115
115
|
));
|
|
116
|
-
const
|
|
117
|
-
a.getByteFrequencyData(
|
|
116
|
+
const s = l.current;
|
|
117
|
+
a.getByteFrequencyData(s);
|
|
118
118
|
let R = 0;
|
|
119
|
-
for (let L = 0; L <
|
|
120
|
-
const C = R /
|
|
119
|
+
for (let L = 0; L < s.length; L++) R += s[L];
|
|
120
|
+
const C = R / s.length / 255;
|
|
121
121
|
for (const L of i.current)
|
|
122
122
|
try {
|
|
123
123
|
L(C);
|
|
124
124
|
} catch (v) {
|
|
125
125
|
console.error("[useAudioLevel] subscriber threw:", v);
|
|
126
126
|
}
|
|
127
|
-
o.current = requestAnimationFrame(
|
|
127
|
+
o.current = requestAnimationFrame(c);
|
|
128
128
|
}, []), d = k(() => {
|
|
129
129
|
if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
|
|
130
|
-
const a = new AudioContext(),
|
|
131
|
-
|
|
132
|
-
}, []),
|
|
130
|
+
const a = new AudioContext(), s = a.createAnalyser();
|
|
131
|
+
s.fftSize = 64, s.connect(a.destination), e.current = a, t.current = s;
|
|
132
|
+
}, []), u = k(
|
|
133
133
|
(a) => {
|
|
134
134
|
if (d(), !(!e.current || !t.current)) {
|
|
135
135
|
if (r.current) {
|
|
@@ -140,17 +140,17 @@ function yn() {
|
|
|
140
140
|
r.current = null;
|
|
141
141
|
}
|
|
142
142
|
try {
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
} catch (
|
|
146
|
-
console.warn("[useAudioLevel] createMediaElementSource failed:",
|
|
143
|
+
const s = e.current.createMediaElementSource(a);
|
|
144
|
+
s.connect(t.current), r.current = s;
|
|
145
|
+
} catch (s) {
|
|
146
|
+
console.warn("[useAudioLevel] createMediaElementSource failed:", s);
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
|
-
o.current === null && (o.current = requestAnimationFrame(
|
|
149
|
+
o.current === null && (o.current = requestAnimationFrame(c));
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
|
-
[d,
|
|
153
|
-
),
|
|
152
|
+
[d, c]
|
|
153
|
+
), m = k(() => {
|
|
154
154
|
if (o.current !== null && (cancelAnimationFrame(o.current), o.current = null), r.current) {
|
|
155
155
|
try {
|
|
156
156
|
r.current.disconnect();
|
|
@@ -158,11 +158,11 @@ function yn() {
|
|
|
158
158
|
}
|
|
159
159
|
r.current = null;
|
|
160
160
|
}
|
|
161
|
-
}, []),
|
|
161
|
+
}, []), h = k((a) => (i.current.add(a), () => {
|
|
162
162
|
i.current.delete(a);
|
|
163
163
|
}), []);
|
|
164
164
|
return T(() => () => {
|
|
165
|
-
if (
|
|
165
|
+
if (m(), t.current) {
|
|
166
166
|
try {
|
|
167
167
|
t.current.disconnect();
|
|
168
168
|
} catch {
|
|
@@ -177,10 +177,10 @@ function yn() {
|
|
|
177
177
|
e.current = null;
|
|
178
178
|
}
|
|
179
179
|
i.current.clear(), l.current = null;
|
|
180
|
-
}, [
|
|
180
|
+
}, [m]), { attach: u, detach: m, subscribe: h };
|
|
181
181
|
}
|
|
182
182
|
function vn() {
|
|
183
|
-
const [e, t] = S(!1), [r, o] = S(null), i = E(null), l = E(null),
|
|
183
|
+
const [e, t] = S(!1), [r, o] = S(null), i = E(null), l = E(null), c = k(async (h) => {
|
|
184
184
|
if (i.current && l.current) {
|
|
185
185
|
try {
|
|
186
186
|
await l.current.localParticipant.unpublishTrack(i.current);
|
|
@@ -188,47 +188,47 @@ function vn() {
|
|
|
188
188
|
}
|
|
189
189
|
i.current.stop(), i.current = null;
|
|
190
190
|
}
|
|
191
|
-
l.current =
|
|
191
|
+
l.current = h, o(null);
|
|
192
192
|
try {
|
|
193
193
|
const a = await pn({
|
|
194
194
|
echoCancellation: !0,
|
|
195
195
|
noiseSuppression: !0
|
|
196
196
|
});
|
|
197
|
-
await
|
|
197
|
+
await h.localParticipant.publishTrack(a), i.current = a, t(a.isMuted);
|
|
198
198
|
} catch (a) {
|
|
199
|
-
const
|
|
200
|
-
throw o(
|
|
199
|
+
const s = a instanceof Error && a.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
|
|
200
|
+
throw o(s), a;
|
|
201
201
|
}
|
|
202
202
|
}, []), d = k(() => {
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
}, []),
|
|
206
|
-
const
|
|
207
|
-
if (
|
|
203
|
+
const h = i.current;
|
|
204
|
+
h && (h.isMuted ? (h.unmute(), t(!1)) : (h.mute(), t(!0)));
|
|
205
|
+
}, []), u = k(() => {
|
|
206
|
+
const h = i.current, a = l.current;
|
|
207
|
+
if (h && a) {
|
|
208
208
|
try {
|
|
209
|
-
a.localParticipant.unpublishTrack(
|
|
209
|
+
a.localParticipant.unpublishTrack(h);
|
|
210
210
|
} catch {
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
h.stop();
|
|
213
213
|
}
|
|
214
214
|
i.current = null, l.current = null, t(!1);
|
|
215
|
-
}, []),
|
|
215
|
+
}, []), m = k(() => o(null), []);
|
|
216
216
|
return {
|
|
217
217
|
isMuted: e,
|
|
218
218
|
micError: r,
|
|
219
219
|
toggleMute: d,
|
|
220
|
-
setupMic:
|
|
221
|
-
teardownMic:
|
|
222
|
-
clearError:
|
|
220
|
+
setupMic: c,
|
|
221
|
+
teardownMic: u,
|
|
222
|
+
clearError: m
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
225
|
const bn = { resolution: { width: 640, height: 480, frameRate: 24 } };
|
|
226
226
|
function wn() {
|
|
227
|
-
const [e, t] = S(!1), [r, o] = S(null), [i, l] = S(null), [
|
|
228
|
-
|
|
227
|
+
const [e, t] = S(!1), [r, o] = S(null), [i, l] = S(null), [c, d] = S(""), u = E(null), m = E(null), h = k((b) => {
|
|
228
|
+
u.current = b;
|
|
229
229
|
}, []), a = k(() => {
|
|
230
|
-
const b =
|
|
231
|
-
if (
|
|
230
|
+
const b = u.current, H = m.current;
|
|
231
|
+
if (H && b) {
|
|
232
232
|
const I = b.localParticipant.getTrackPublication(jt.Source.Camera);
|
|
233
233
|
if (I != null && I.track) {
|
|
234
234
|
try {
|
|
@@ -237,78 +237,78 @@ function wn() {
|
|
|
237
237
|
}
|
|
238
238
|
I.track.stop();
|
|
239
239
|
} else
|
|
240
|
-
|
|
240
|
+
H.stop();
|
|
241
241
|
}
|
|
242
|
-
|
|
243
|
-
}, []),
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
242
|
+
m.current = null, l(null), t(!1);
|
|
243
|
+
}, []), s = k(async (b) => {
|
|
244
|
+
const H = u.current;
|
|
245
|
+
if (H) {
|
|
246
246
|
o(null);
|
|
247
247
|
try {
|
|
248
248
|
const I = { ...bn };
|
|
249
249
|
b && (I.deviceId = b);
|
|
250
|
-
const
|
|
251
|
-
await
|
|
252
|
-
const p =
|
|
250
|
+
const O = await hn(I);
|
|
251
|
+
await H.localParticipant.publishTrack(O), m.current = O;
|
|
252
|
+
const p = O.attach();
|
|
253
253
|
l(p), t(!0), b && d(b);
|
|
254
254
|
try {
|
|
255
|
-
|
|
255
|
+
H.localParticipant.publishData(
|
|
256
256
|
new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
|
|
257
257
|
{ reliable: !0 }
|
|
258
258
|
);
|
|
259
259
|
} catch {
|
|
260
260
|
}
|
|
261
261
|
} catch (I) {
|
|
262
|
-
const
|
|
263
|
-
o(
|
|
262
|
+
const O = I instanceof Error && I.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
|
|
263
|
+
o(O);
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
}, []), R = k(async () => {
|
|
267
|
-
e ? a() : await c
|
|
268
|
-
}, [e,
|
|
269
|
-
a(), await
|
|
270
|
-
}, [a,
|
|
271
|
-
a(),
|
|
267
|
+
e ? a() : await s(c || void 0);
|
|
268
|
+
}, [e, c, a, s]), C = k(async (b) => {
|
|
269
|
+
a(), await s(b);
|
|
270
|
+
}, [a, s]), L = k(() => {
|
|
271
|
+
a(), u.current = null, o(null), d("");
|
|
272
272
|
}, [a]), v = k(() => o(null), []);
|
|
273
273
|
return T(() => () => {
|
|
274
|
-
|
|
274
|
+
m.current && m.current.stop();
|
|
275
275
|
}, []), {
|
|
276
276
|
isEnabled: e,
|
|
277
277
|
error: r,
|
|
278
278
|
previewEl: i,
|
|
279
|
-
activeDeviceId:
|
|
279
|
+
activeDeviceId: c,
|
|
280
280
|
toggle: R,
|
|
281
281
|
switchDevice: C,
|
|
282
|
-
attachRoom:
|
|
282
|
+
attachRoom: h,
|
|
283
283
|
teardown: L,
|
|
284
284
|
clearError: v
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
287
|
function _n() {
|
|
288
|
-
const [e, t] = S(!1), [r, o] = S(null), [i, l] = S(null),
|
|
289
|
-
|
|
290
|
-
}, []),
|
|
291
|
-
const
|
|
292
|
-
if (
|
|
288
|
+
const [e, t] = S(!1), [r, o] = S(null), [i, l] = S(null), c = E(null), d = k((s) => {
|
|
289
|
+
c.current = s;
|
|
290
|
+
}, []), u = k(() => l(null), []), m = k(async () => {
|
|
291
|
+
const s = c.current;
|
|
292
|
+
if (s) {
|
|
293
293
|
if (e) {
|
|
294
294
|
try {
|
|
295
|
-
await
|
|
295
|
+
await s.localParticipant.setScreenShareEnabled(!1);
|
|
296
296
|
} catch {
|
|
297
297
|
}
|
|
298
|
-
|
|
298
|
+
u(), t(!1);
|
|
299
299
|
return;
|
|
300
300
|
}
|
|
301
301
|
o(null);
|
|
302
302
|
try {
|
|
303
|
-
await
|
|
303
|
+
await s.localParticipant.setScreenShareEnabled(!0);
|
|
304
304
|
let R = 0;
|
|
305
305
|
const C = () => {
|
|
306
|
-
const L =
|
|
306
|
+
const L = s.localParticipant.getTrackPublication(jt.Source.ScreenShare);
|
|
307
307
|
if (L != null && L.track) {
|
|
308
308
|
const v = L.track.attach();
|
|
309
309
|
l(v), t(!0);
|
|
310
310
|
try {
|
|
311
|
-
|
|
311
|
+
s.localParticipant.publishData(
|
|
312
312
|
new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
|
|
313
313
|
{ reliable: !0 }
|
|
314
314
|
);
|
|
@@ -324,23 +324,23 @@ function _n() {
|
|
|
324
324
|
C !== "NotAllowedError" && C !== "AbortError" && o("Screen share unavailable. Try again."), t(!1);
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
|
-
}, [e,
|
|
328
|
-
const
|
|
329
|
-
if (
|
|
327
|
+
}, [e, u]), h = k(() => {
|
|
328
|
+
const s = c.current;
|
|
329
|
+
if (s && e)
|
|
330
330
|
try {
|
|
331
|
-
|
|
331
|
+
s.localParticipant.setScreenShareEnabled(!1);
|
|
332
332
|
} catch {
|
|
333
333
|
}
|
|
334
|
-
|
|
335
|
-
}, [e,
|
|
336
|
-
return { isEnabled: e, error: r, previewEl: i, toggle:
|
|
334
|
+
u(), t(!1), o(null), c.current = null;
|
|
335
|
+
}, [e, u]), a = k(() => o(null), []);
|
|
336
|
+
return { isEnabled: e, error: r, previewEl: i, toggle: m, attachRoom: d, teardown: h, clearError: a };
|
|
337
337
|
}
|
|
338
338
|
function xn() {
|
|
339
339
|
const [e, t] = S([]), [r, o] = S([]), i = k(async () => {
|
|
340
340
|
if (!(typeof navigator > "u" || !navigator.mediaDevices))
|
|
341
341
|
try {
|
|
342
342
|
const l = await navigator.mediaDevices.enumerateDevices();
|
|
343
|
-
t(l.filter((
|
|
343
|
+
t(l.filter((c) => c.kind === "audioinput")), o(l.filter((c) => c.kind === "videoinput"));
|
|
344
344
|
} catch {
|
|
345
345
|
}
|
|
346
346
|
}, []);
|
|
@@ -351,26 +351,26 @@ function xn() {
|
|
|
351
351
|
}, [i]), { mics: e, cameras: r, refresh: i };
|
|
352
352
|
}
|
|
353
353
|
function kn(e, t, r = !1) {
|
|
354
|
-
const [o, i] = S(null), [l,
|
|
354
|
+
const [o, i] = S(null), [l, c] = S(null), [d, u] = S(!r && !!e);
|
|
355
355
|
return T(() => {
|
|
356
356
|
if (r || !e) {
|
|
357
|
-
|
|
357
|
+
u(!1);
|
|
358
358
|
return;
|
|
359
359
|
}
|
|
360
|
-
const
|
|
361
|
-
return
|
|
362
|
-
signal:
|
|
360
|
+
const m = new AbortController(), h = t || "https://app.livelayer.studio";
|
|
361
|
+
return u(!0), c(null), fetch(`${h}/api/widget/agent/${encodeURIComponent(e)}`, {
|
|
362
|
+
signal: m.signal
|
|
363
363
|
}).then(async (a) => {
|
|
364
364
|
if (!a.ok) {
|
|
365
|
-
const
|
|
366
|
-
throw new Error(
|
|
365
|
+
const s = await a.json().catch(() => ({}));
|
|
366
|
+
throw new Error(s.error || `HTTP ${a.status}`);
|
|
367
367
|
}
|
|
368
368
|
return a.json();
|
|
369
369
|
}).then((a) => {
|
|
370
|
-
|
|
370
|
+
m.signal.aborted || (i(a), u(!1));
|
|
371
371
|
}).catch((a) => {
|
|
372
|
-
|
|
373
|
-
}), () =>
|
|
372
|
+
m.signal.aborted || (c(a instanceof Error ? a.message : "Agent lookup failed"), u(!1));
|
|
373
|
+
}), () => m.abort();
|
|
374
374
|
}, [e, t, r]), { info: o, error: l, loading: d };
|
|
375
375
|
}
|
|
376
376
|
function Ln(e) {
|
|
@@ -393,13 +393,13 @@ function Cn({
|
|
|
393
393
|
defaultValue: t = "expanded",
|
|
394
394
|
onChange: r
|
|
395
395
|
} = {}) {
|
|
396
|
-
const o = e !== void 0, [i, l] = S(t),
|
|
397
|
-
(
|
|
398
|
-
|
|
396
|
+
const o = e !== void 0, [i, l] = S(t), c = o ? e : i, d = k(
|
|
397
|
+
(u) => {
|
|
398
|
+
u !== c && (o || l(u), r == null || r(u));
|
|
399
399
|
},
|
|
400
|
-
[
|
|
400
|
+
[c, o, r]
|
|
401
401
|
);
|
|
402
|
-
return [
|
|
402
|
+
return [c, d];
|
|
403
403
|
}
|
|
404
404
|
const En = ["hidden", "minimized", "expanded"];
|
|
405
405
|
function Nn(e) {
|
|
@@ -412,18 +412,18 @@ function An({
|
|
|
412
412
|
persistKey: o = "ll-widget",
|
|
413
413
|
disablePersistence: i = !1
|
|
414
414
|
} = {}) {
|
|
415
|
-
const l = `${o}:display-mode`,
|
|
415
|
+
const l = `${o}:display-mode`, c = E(!1), [d, u] = Cn({
|
|
416
416
|
value: e,
|
|
417
417
|
defaultValue: t,
|
|
418
|
-
onChange: (
|
|
419
|
-
e === void 0 && !i && Sn(l,
|
|
418
|
+
onChange: (m) => {
|
|
419
|
+
e === void 0 && !i && Sn(l, m), r == null || r(m);
|
|
420
420
|
}
|
|
421
421
|
});
|
|
422
422
|
return T(() => {
|
|
423
|
-
if (
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
}, []), [d,
|
|
423
|
+
if (c.current || (c.current = !0, i || e !== void 0)) return;
|
|
424
|
+
const m = Nn(Ln(l));
|
|
425
|
+
m && m !== d && u(m);
|
|
426
|
+
}, []), [d, u];
|
|
427
427
|
}
|
|
428
428
|
const Rn = 640;
|
|
429
429
|
function In(e = Rn) {
|
|
@@ -476,8 +476,8 @@ function Dn(e) {
|
|
|
476
476
|
function $n(e) {
|
|
477
477
|
const t = Rt.get(e);
|
|
478
478
|
if (t) return t;
|
|
479
|
-
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, o = "", i = "", l = r.replace(/\*\*/g, o).replace(/\*/g, i), d = Dn(l).replace(new RegExp(`\\/${o}`, "g"), "(?:\\/.*)?").replace(new RegExp(o, "g"), ".*").replace(new RegExp(i, "g"), "[^/]+"),
|
|
480
|
-
return Rt.set(e,
|
|
479
|
+
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, o = "", i = "", l = r.replace(/\*\*/g, o).replace(/\*/g, i), d = Dn(l).replace(new RegExp(`\\/${o}`, "g"), "(?:\\/.*)?").replace(new RegExp(o, "g"), ".*").replace(new RegExp(i, "g"), "[^/]+"), u = new RegExp(`^${d}\\/?$`);
|
|
480
|
+
return Rt.set(e, u), u;
|
|
481
481
|
}
|
|
482
482
|
function zn(e, t) {
|
|
483
483
|
const r = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
|
|
@@ -623,25 +623,25 @@ const Vn = ({
|
|
|
623
623
|
onExpand: o,
|
|
624
624
|
label: i = "Open widget",
|
|
625
625
|
avatarImageUrl: l,
|
|
626
|
-
agentName:
|
|
626
|
+
agentName: c
|
|
627
627
|
}) => {
|
|
628
|
-
const d = Fn(e),
|
|
628
|
+
const d = Fn(e), u = d === "right" ? "left" : "right", m = t ? 80 : 72, h = !!l, [a, s] = S(null), [R, C] = S(!1), L = E(null), v = E(!1), b = k(
|
|
629
629
|
(A) => {
|
|
630
630
|
if (typeof window > "u") return A;
|
|
631
|
-
const
|
|
632
|
-
return
|
|
631
|
+
const P = m / 2, W = Dt + P, V = window.innerHeight - Dt - P;
|
|
632
|
+
return V < W ? Math.max(W, A) : Math.max(W, Math.min(V, A));
|
|
633
633
|
},
|
|
634
|
-
[
|
|
634
|
+
[m]
|
|
635
635
|
);
|
|
636
636
|
T(() => {
|
|
637
637
|
const A = jn();
|
|
638
|
-
|
|
639
|
-
const
|
|
640
|
-
|
|
638
|
+
s(b(A ?? window.innerHeight / 2));
|
|
639
|
+
const P = () => {
|
|
640
|
+
s((W) => W === null ? null : b(W));
|
|
641
641
|
};
|
|
642
|
-
return window.addEventListener("resize",
|
|
642
|
+
return window.addEventListener("resize", P), () => window.removeEventListener("resize", P);
|
|
643
643
|
}, [b]);
|
|
644
|
-
const
|
|
644
|
+
const H = k(
|
|
645
645
|
(A) => {
|
|
646
646
|
if (!(A.pointerType === "mouse" && A.button !== 0) && a !== null) {
|
|
647
647
|
try {
|
|
@@ -658,21 +658,21 @@ const Vn = ({
|
|
|
658
658
|
[a]
|
|
659
659
|
), I = k(
|
|
660
660
|
(A) => {
|
|
661
|
-
const
|
|
662
|
-
if (!
|
|
663
|
-
const W = A.clientY -
|
|
664
|
-
!
|
|
661
|
+
const P = L.current;
|
|
662
|
+
if (!P) return;
|
|
663
|
+
const W = A.clientY - P.startClientY;
|
|
664
|
+
!P.moved && Math.abs(W) > Un && (P.moved = !0, C(!0)), P.moved && s(b(P.startCenterY + W));
|
|
665
665
|
},
|
|
666
666
|
[b]
|
|
667
|
-
),
|
|
667
|
+
), O = k(
|
|
668
668
|
(A) => {
|
|
669
|
-
const
|
|
670
|
-
if (
|
|
669
|
+
const P = L.current;
|
|
670
|
+
if (P) {
|
|
671
671
|
try {
|
|
672
672
|
A.currentTarget.releasePointerCapture(A.pointerId);
|
|
673
673
|
} catch {
|
|
674
674
|
}
|
|
675
|
-
L.current = null,
|
|
675
|
+
L.current = null, P.moved && (C(!1), v.current = !0, s((W) => (W !== null && $t(W), W)));
|
|
676
676
|
}
|
|
677
677
|
},
|
|
678
678
|
[]
|
|
@@ -686,11 +686,11 @@ const Vn = ({
|
|
|
686
686
|
(A) => {
|
|
687
687
|
if (A.key === "ArrowUp" || A.key === "ArrowDown") {
|
|
688
688
|
A.preventDefault();
|
|
689
|
-
const
|
|
690
|
-
|
|
689
|
+
const P = A.key === "ArrowUp" ? -8 : 8;
|
|
690
|
+
s((W) => {
|
|
691
691
|
if (W === null) return W;
|
|
692
|
-
const
|
|
693
|
-
return $t(
|
|
692
|
+
const V = b(W + P);
|
|
693
|
+
return $t(V), V;
|
|
694
694
|
});
|
|
695
695
|
}
|
|
696
696
|
},
|
|
@@ -701,23 +701,23 @@ const Vn = ({
|
|
|
701
701
|
t ? "ll-hidden--mobile" : "ll-hidden--desktop",
|
|
702
702
|
r ? "ll-hidden--speaking" : null,
|
|
703
703
|
R ? "is-dragging" : null,
|
|
704
|
-
|
|
705
|
-
].filter(Boolean).join(" "),
|
|
704
|
+
h ? "ll-hidden--with-avatar" : null
|
|
705
|
+
].filter(Boolean).join(" "), $ = a === null ? void 0 : { top: `${a - m / 2}px`, transform: "none" };
|
|
706
706
|
return /* @__PURE__ */ n(
|
|
707
707
|
"button",
|
|
708
708
|
{
|
|
709
709
|
type: "button",
|
|
710
710
|
className: B,
|
|
711
|
-
onPointerDown:
|
|
711
|
+
onPointerDown: H,
|
|
712
712
|
onPointerMove: I,
|
|
713
|
-
onPointerUp:
|
|
714
|
-
onPointerCancel:
|
|
713
|
+
onPointerUp: O,
|
|
714
|
+
onPointerCancel: O,
|
|
715
715
|
onClick: p,
|
|
716
716
|
onKeyDown: N,
|
|
717
717
|
"aria-label": i,
|
|
718
718
|
"data-position": e,
|
|
719
|
-
style:
|
|
720
|
-
children:
|
|
719
|
+
style: $,
|
|
720
|
+
children: h ? (
|
|
721
721
|
// Layout: tiny chevron flush against the inward edge (peeks out
|
|
722
722
|
// as the click affordance), then the circular avatar photo
|
|
723
723
|
// taking the rest of the tab. Reinforces "this is an
|
|
@@ -726,7 +726,7 @@ const Vn = ({
|
|
|
726
726
|
/* @__PURE__ */ n(
|
|
727
727
|
Pt,
|
|
728
728
|
{
|
|
729
|
-
direction:
|
|
729
|
+
direction: u,
|
|
730
730
|
className: "ll-hidden__chevron ll-hidden__chevron--mini"
|
|
731
731
|
}
|
|
732
732
|
),
|
|
@@ -734,7 +734,7 @@ const Vn = ({
|
|
|
734
734
|
"img",
|
|
735
735
|
{
|
|
736
736
|
src: l,
|
|
737
|
-
alt:
|
|
737
|
+
alt: c ? `${c} avatar` : "Agent avatar",
|
|
738
738
|
className: "ll-hidden__avatar",
|
|
739
739
|
draggable: !1
|
|
740
740
|
}
|
|
@@ -743,7 +743,7 @@ const Vn = ({
|
|
|
743
743
|
) : /* @__PURE__ */ n(
|
|
744
744
|
Pt,
|
|
745
745
|
{
|
|
746
|
-
direction:
|
|
746
|
+
direction: u,
|
|
747
747
|
className: "ll-hidden__chevron"
|
|
748
748
|
}
|
|
749
749
|
)
|
|
@@ -757,41 +757,41 @@ const Vn = ({
|
|
|
757
757
|
className: i,
|
|
758
758
|
barClassName: l
|
|
759
759
|
}) => {
|
|
760
|
-
const
|
|
761
|
-
const
|
|
762
|
-
return Array.from({ length: t }, (a,
|
|
760
|
+
const c = E(null), d = E([]), u = Ze(() => {
|
|
761
|
+
const h = (Math.sqrt(5) - 1) / 2;
|
|
762
|
+
return Array.from({ length: t }, (a, s) => 0.5 + s * h % 1 * 0.5);
|
|
763
763
|
}, [t]);
|
|
764
764
|
T(() => e.subscribe((a) => {
|
|
765
|
-
for (let
|
|
766
|
-
const R = d.current[
|
|
765
|
+
for (let s = 0; s < t; s++) {
|
|
766
|
+
const R = d.current[s];
|
|
767
767
|
if (!R) continue;
|
|
768
|
-
const C = Math.max(o, a * r *
|
|
768
|
+
const C = Math.max(o, a * r * u[s]);
|
|
769
769
|
R.style.height = `${C}px`;
|
|
770
770
|
}
|
|
771
|
-
}), [e, t, r, o,
|
|
772
|
-
const
|
|
773
|
-
return /* @__PURE__ */ n("div", { ref:
|
|
771
|
+
}), [e, t, r, o, u]);
|
|
772
|
+
const m = ["ll-waveform", i].filter(Boolean).join(" ");
|
|
773
|
+
return /* @__PURE__ */ n("div", { ref: c, className: m, "aria-hidden": "true", children: Array.from({ length: t }, (h, a) => /* @__PURE__ */ n(
|
|
774
774
|
"div",
|
|
775
775
|
{
|
|
776
|
-
ref: (
|
|
777
|
-
d.current[a] =
|
|
776
|
+
ref: (s) => {
|
|
777
|
+
d.current[a] = s;
|
|
778
778
|
},
|
|
779
779
|
className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
|
|
780
780
|
style: { height: `${o}px` }
|
|
781
781
|
},
|
|
782
782
|
a
|
|
783
783
|
)) });
|
|
784
|
-
},
|
|
784
|
+
}, Xn = ({
|
|
785
785
|
position: e,
|
|
786
786
|
isMobile: t,
|
|
787
787
|
agentName: r,
|
|
788
788
|
avatarImageUrl: o,
|
|
789
789
|
agentState: i,
|
|
790
790
|
isMuted: l,
|
|
791
|
-
audioLevel:
|
|
791
|
+
audioLevel: c,
|
|
792
792
|
onExpand: d,
|
|
793
|
-
onToggleMute:
|
|
794
|
-
onClose:
|
|
793
|
+
onToggleMute: u,
|
|
794
|
+
onClose: m
|
|
795
795
|
}) => t ? /* @__PURE__ */ n(
|
|
796
796
|
"div",
|
|
797
797
|
{
|
|
@@ -820,7 +820,7 @@ const Vn = ({
|
|
|
820
820
|
/* @__PURE__ */ n(
|
|
821
821
|
Yn,
|
|
822
822
|
{
|
|
823
|
-
audioLevel:
|
|
823
|
+
audioLevel: c,
|
|
824
824
|
bars: 16,
|
|
825
825
|
maxHeight: 18,
|
|
826
826
|
className: "ll-minimized__waveform"
|
|
@@ -834,11 +834,11 @@ const Vn = ({
|
|
|
834
834
|
className: "ll-minimized__btn",
|
|
835
835
|
role: "button",
|
|
836
836
|
tabIndex: 0,
|
|
837
|
-
onClick: (
|
|
838
|
-
|
|
837
|
+
onClick: (h) => {
|
|
838
|
+
h.stopPropagation(), u();
|
|
839
839
|
},
|
|
840
|
-
onKeyDown: (
|
|
841
|
-
(
|
|
840
|
+
onKeyDown: (h) => {
|
|
841
|
+
(h.key === "Enter" || h.key === " ") && (h.stopPropagation(), h.preventDefault(), u());
|
|
842
842
|
},
|
|
843
843
|
"aria-label": l ? "Unmute microphone" : "Mute microphone",
|
|
844
844
|
children: /* @__PURE__ */ n(Mt, { muted: l, className: "ll-minimized__icon" })
|
|
@@ -879,7 +879,7 @@ const Vn = ({
|
|
|
879
879
|
{
|
|
880
880
|
type: "button",
|
|
881
881
|
className: "ll-minimized__btn",
|
|
882
|
-
onClick:
|
|
882
|
+
onClick: u,
|
|
883
883
|
"aria-label": l ? "Unmute microphone" : "Mute microphone",
|
|
884
884
|
children: /* @__PURE__ */ n(Mt, { muted: l, className: "ll-minimized__icon" })
|
|
885
885
|
}
|
|
@@ -899,7 +899,7 @@ const Vn = ({
|
|
|
899
899
|
{
|
|
900
900
|
type: "button",
|
|
901
901
|
className: "ll-minimized__btn ll-minimized__btn--close",
|
|
902
|
-
onClick:
|
|
902
|
+
onClick: m,
|
|
903
903
|
"aria-label": "Close widget",
|
|
904
904
|
children: /* @__PURE__ */ n(Bn, { className: "ll-minimized__icon" })
|
|
905
905
|
}
|
|
@@ -914,11 +914,11 @@ const Vn = ({
|
|
|
914
914
|
className: o,
|
|
915
915
|
style: i
|
|
916
916
|
}) => {
|
|
917
|
-
const [l,
|
|
917
|
+
const [l, c] = S(!1), d = E(e);
|
|
918
918
|
if (T(() => {
|
|
919
|
-
d.current !== e && (d.current = e,
|
|
919
|
+
d.current !== e && (d.current = e, c(!1));
|
|
920
920
|
}, [e]), !e) return null;
|
|
921
|
-
const
|
|
921
|
+
const u = {
|
|
922
922
|
position: "absolute",
|
|
923
923
|
inset: 0,
|
|
924
924
|
width: "100%",
|
|
@@ -938,104 +938,104 @@ const Vn = ({
|
|
|
938
938
|
src: e,
|
|
939
939
|
alt: t,
|
|
940
940
|
className: o,
|
|
941
|
-
style:
|
|
941
|
+
style: u,
|
|
942
942
|
loading: "eager",
|
|
943
943
|
fetchPriority: "high",
|
|
944
|
-
onLoad: () =>
|
|
944
|
+
onLoad: () => c(!0)
|
|
945
945
|
}
|
|
946
946
|
)
|
|
947
947
|
);
|
|
948
|
-
},
|
|
948
|
+
}, Jn = ({
|
|
949
949
|
position: e,
|
|
950
950
|
isMobile: t,
|
|
951
951
|
agentName: r,
|
|
952
952
|
avatarImageUrl: o,
|
|
953
953
|
idleLoopUrl: i,
|
|
954
954
|
greeting: l,
|
|
955
|
-
branding:
|
|
955
|
+
branding: c,
|
|
956
956
|
teamMembers: d,
|
|
957
|
-
currentTeamMemberId:
|
|
958
|
-
isSwitchingTeamMember:
|
|
959
|
-
teamSwitcherOpen:
|
|
957
|
+
currentTeamMemberId: u,
|
|
958
|
+
isSwitchingTeamMember: m,
|
|
959
|
+
teamSwitcherOpen: h,
|
|
960
960
|
onToggleTeamSwitcher: a,
|
|
961
|
-
onSelectTeamMember:
|
|
961
|
+
onSelectTeamMember: s,
|
|
962
962
|
languageMenuOpen: R,
|
|
963
963
|
onToggleLanguageMenu: C,
|
|
964
964
|
connectionState: L,
|
|
965
965
|
agentState: v,
|
|
966
966
|
transcript: b,
|
|
967
|
-
canResume:
|
|
967
|
+
canResume: H,
|
|
968
968
|
needsUserGesture: I,
|
|
969
|
-
error:
|
|
969
|
+
error: O,
|
|
970
970
|
isMuted: p,
|
|
971
971
|
micError: N,
|
|
972
972
|
micDevices: B,
|
|
973
|
-
isCameraEnabled:
|
|
973
|
+
isCameraEnabled: $,
|
|
974
974
|
cameraPreviewEl: A,
|
|
975
|
-
cameraDevices:
|
|
975
|
+
cameraDevices: P,
|
|
976
976
|
activeCameraId: W,
|
|
977
|
-
isScreenShareEnabled:
|
|
977
|
+
isScreenShareEnabled: V,
|
|
978
978
|
screenPreviewEl: te,
|
|
979
|
-
isSpeakerMuted:
|
|
980
|
-
allowCamera:
|
|
981
|
-
allowScreenShare:
|
|
982
|
-
allowTyping:
|
|
983
|
-
avatarVideoContainerRef:
|
|
984
|
-
onConnect:
|
|
985
|
-
onDisconnect:
|
|
986
|
-
onRetry:
|
|
987
|
-
onResumeAudio:
|
|
988
|
-
onToggleMute:
|
|
989
|
-
onToggleCamera:
|
|
990
|
-
onSwitchCameraDevice:
|
|
991
|
-
onToggleScreenShare:
|
|
992
|
-
onToggleSpeaker:
|
|
993
|
-
onSendMessage:
|
|
994
|
-
onMinimize:
|
|
995
|
-
onClose:
|
|
996
|
-
onClearMicError:
|
|
979
|
+
isSpeakerMuted: ne,
|
|
980
|
+
allowCamera: ve,
|
|
981
|
+
allowScreenShare: ae,
|
|
982
|
+
allowTyping: pe,
|
|
983
|
+
avatarVideoContainerRef: se,
|
|
984
|
+
onConnect: re,
|
|
985
|
+
onDisconnect: ce,
|
|
986
|
+
onRetry: _e,
|
|
987
|
+
onResumeAudio: xe,
|
|
988
|
+
onToggleMute: ke,
|
|
989
|
+
onToggleCamera: Le,
|
|
990
|
+
onSwitchCameraDevice: Se,
|
|
991
|
+
onToggleScreenShare: Ce,
|
|
992
|
+
onToggleSpeaker: j,
|
|
993
|
+
onSendMessage: We,
|
|
994
|
+
onMinimize: Fe,
|
|
995
|
+
onClose: Ue,
|
|
996
|
+
onClearMicError: je
|
|
997
997
|
}) => {
|
|
998
|
-
var
|
|
999
|
-
const
|
|
998
|
+
var Ae;
|
|
999
|
+
const he = b.length > 0 ? b[b.length - 1] : null, de = ((d == null ? void 0 : d.length) ?? 0) > 1, Ee = L === "connecting" || L === "connected", Ne = L === "connected", be = L === "idle" || L === "disconnected" || L === "error", G = E(null), Pe = E(null);
|
|
1000
1000
|
T(() => {
|
|
1001
|
-
const y =
|
|
1001
|
+
const y = G.current;
|
|
1002
1002
|
y && (y.innerHTML = "", A && (A.style.width = "100%", A.style.height = "100%", A.style.objectFit = "cover", A.style.transform = "scaleX(-1)", y.appendChild(A)));
|
|
1003
1003
|
}, [A]), T(() => {
|
|
1004
|
-
const y =
|
|
1004
|
+
const y = Pe.current;
|
|
1005
1005
|
y && (y.innerHTML = "", te && (te.style.width = "100%", te.style.height = "100%", te.style.objectFit = "contain", y.appendChild(te)));
|
|
1006
1006
|
}, [te]);
|
|
1007
|
-
const [
|
|
1007
|
+
const [oe, ee] = S(!1), [ue, me] = S(!1);
|
|
1008
1008
|
T(() => {
|
|
1009
|
-
if (!
|
|
1009
|
+
if (!oe && !ue && !R && !h) return;
|
|
1010
1010
|
const y = () => {
|
|
1011
|
-
ee(!1),
|
|
1011
|
+
ee(!1), me(!1), R && C(), h && a();
|
|
1012
1012
|
};
|
|
1013
1013
|
return document.addEventListener("click", y), () => document.removeEventListener("click", y);
|
|
1014
1014
|
}, [
|
|
1015
|
-
|
|
1016
|
-
|
|
1015
|
+
oe,
|
|
1016
|
+
ue,
|
|
1017
1017
|
R,
|
|
1018
|
-
|
|
1018
|
+
h,
|
|
1019
1019
|
C,
|
|
1020
1020
|
a
|
|
1021
1021
|
]);
|
|
1022
|
-
const [
|
|
1022
|
+
const [Q, ie] = S(""), we = k(
|
|
1023
1023
|
(y) => {
|
|
1024
1024
|
y.preventDefault();
|
|
1025
|
-
const
|
|
1026
|
-
|
|
1025
|
+
const J = Q.trim();
|
|
1026
|
+
J && (We(J), ie(""));
|
|
1027
1027
|
},
|
|
1028
|
-
[
|
|
1029
|
-
),
|
|
1028
|
+
[Q, We]
|
|
1029
|
+
), De = c.productName || "Live Layer", Ve = Ne && (he != null && he.text) ? he.text : l || "", $e = [
|
|
1030
1030
|
"ll-expanded",
|
|
1031
1031
|
t ? "ll-expanded--mobile" : "ll-expanded--desktop"
|
|
1032
1032
|
].join(" ");
|
|
1033
1033
|
return /* @__PURE__ */ w(
|
|
1034
1034
|
"div",
|
|
1035
1035
|
{
|
|
1036
|
-
className:
|
|
1036
|
+
className: $e,
|
|
1037
1037
|
"data-position": e,
|
|
1038
|
-
"data-state":
|
|
1038
|
+
"data-state": Ne ? "connected" : Ee ? "connecting" : "idle",
|
|
1039
1039
|
role: "dialog",
|
|
1040
1040
|
"aria-label": `${r} widget`,
|
|
1041
1041
|
children: [
|
|
@@ -1047,8 +1047,8 @@ const Vn = ({
|
|
|
1047
1047
|
alt: r,
|
|
1048
1048
|
className: "ll-expanded__bg-img"
|
|
1049
1049
|
}
|
|
1050
|
-
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((
|
|
1051
|
-
i && !
|
|
1050
|
+
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Ae = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Ae.toUpperCase()) || "A" }) }),
|
|
1051
|
+
i && !Ne && /* @__PURE__ */ n(
|
|
1052
1052
|
"video",
|
|
1053
1053
|
{
|
|
1054
1054
|
className: "ll-expanded__bg-idle",
|
|
@@ -1060,24 +1060,24 @@ const Vn = ({
|
|
|
1060
1060
|
}
|
|
1061
1061
|
)
|
|
1062
1062
|
] }),
|
|
1063
|
-
/* @__PURE__ */ n("div", { ref:
|
|
1063
|
+
/* @__PURE__ */ n("div", { ref: se, className: "ll-expanded__video" }),
|
|
1064
1064
|
L === "connecting" && /* @__PURE__ */ w("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
|
|
1065
1065
|
/* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
|
|
1066
|
-
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children:
|
|
1066
|
+
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: m ? "Switching..." : "Connecting..." })
|
|
1067
1067
|
] }),
|
|
1068
|
-
I &&
|
|
1068
|
+
I && Ne && /* @__PURE__ */ w(
|
|
1069
1069
|
"button",
|
|
1070
1070
|
{
|
|
1071
1071
|
type: "button",
|
|
1072
1072
|
className: "ll-expanded__overlay ll-expanded__overlay--gesture",
|
|
1073
|
-
onClick:
|
|
1073
|
+
onClick: xe,
|
|
1074
1074
|
children: [
|
|
1075
1075
|
/* @__PURE__ */ n("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("path", { d: "M3 9v6h4l5 5V4L7 9H3zm13.54.12a5 5 0 0 1 0 5.76l-1.41-1.41a3 3 0 0 0 0-2.94L16.54 9.12z" }) }),
|
|
1076
1076
|
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
|
|
1077
1077
|
]
|
|
1078
1078
|
}
|
|
1079
1079
|
),
|
|
1080
|
-
|
|
1080
|
+
Ee ? /* @__PURE__ */ w("div", { className: "ll-expanded__topbar", children: [
|
|
1081
1081
|
/* @__PURE__ */ w("div", { className: "ll-expanded__topbar-left", children: [
|
|
1082
1082
|
/* @__PURE__ */ w("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1083
1083
|
/* @__PURE__ */ w(
|
|
@@ -1086,17 +1086,17 @@ const Vn = ({
|
|
|
1086
1086
|
type: "button",
|
|
1087
1087
|
className: "ll-hpill",
|
|
1088
1088
|
onClick: (y) => {
|
|
1089
|
-
|
|
1089
|
+
de && (y.stopPropagation(), a());
|
|
1090
1090
|
},
|
|
1091
|
-
"aria-haspopup":
|
|
1092
|
-
"aria-expanded":
|
|
1091
|
+
"aria-haspopup": de ? "listbox" : void 0,
|
|
1092
|
+
"aria-expanded": de ? h : void 0,
|
|
1093
1093
|
children: [
|
|
1094
1094
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
|
|
1095
|
-
|
|
1095
|
+
de && /* @__PURE__ */ n(Ke, {})
|
|
1096
1096
|
]
|
|
1097
1097
|
}
|
|
1098
1098
|
),
|
|
1099
|
-
|
|
1099
|
+
de && h && /* @__PURE__ */ n(
|
|
1100
1100
|
"div",
|
|
1101
1101
|
{
|
|
1102
1102
|
className: "ll-hmenu",
|
|
@@ -1106,10 +1106,10 @@ const Vn = ({
|
|
|
1106
1106
|
"button",
|
|
1107
1107
|
{
|
|
1108
1108
|
type: "button",
|
|
1109
|
-
className: `ll-hmenu__item ${y.id ===
|
|
1110
|
-
onClick: () =>
|
|
1109
|
+
className: `ll-hmenu__item ${y.id === u ? "is-active" : ""}`,
|
|
1110
|
+
onClick: () => s(y.id),
|
|
1111
1111
|
role: "option",
|
|
1112
|
-
"aria-selected": y.id ===
|
|
1112
|
+
"aria-selected": y.id === u,
|
|
1113
1113
|
children: [
|
|
1114
1114
|
y.avatarImageUrl && /* @__PURE__ */ n(
|
|
1115
1115
|
"img",
|
|
@@ -1143,7 +1143,7 @@ const Vn = ({
|
|
|
1143
1143
|
title: "Language: English",
|
|
1144
1144
|
children: [
|
|
1145
1145
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: "EN" }),
|
|
1146
|
-
/* @__PURE__ */ n(
|
|
1146
|
+
/* @__PURE__ */ n(Ke, {})
|
|
1147
1147
|
]
|
|
1148
1148
|
}
|
|
1149
1149
|
),
|
|
@@ -1180,7 +1180,7 @@ const Vn = ({
|
|
|
1180
1180
|
{
|
|
1181
1181
|
type: "button",
|
|
1182
1182
|
className: "ll-hbtn",
|
|
1183
|
-
onClick:
|
|
1183
|
+
onClick: Fe,
|
|
1184
1184
|
"aria-label": "Minimize widget",
|
|
1185
1185
|
title: "Minimize",
|
|
1186
1186
|
children: /* @__PURE__ */ n(Ht, {})
|
|
@@ -1191,7 +1191,7 @@ const Vn = ({
|
|
|
1191
1191
|
{
|
|
1192
1192
|
type: "button",
|
|
1193
1193
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1194
|
-
onClick:
|
|
1194
|
+
onClick: Ue,
|
|
1195
1195
|
"aria-label": "End call",
|
|
1196
1196
|
title: "End call",
|
|
1197
1197
|
children: /* @__PURE__ */ n(zt, {})
|
|
@@ -1201,14 +1201,14 @@ const Vn = ({
|
|
|
1201
1201
|
] }) : (
|
|
1202
1202
|
// Idle-state header with Live Layer product name + minimize/close
|
|
1203
1203
|
/* @__PURE__ */ w("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
|
|
1204
|
-
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children:
|
|
1204
|
+
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: De }),
|
|
1205
1205
|
/* @__PURE__ */ w("div", { className: "ll-expanded__header-actions", children: [
|
|
1206
1206
|
/* @__PURE__ */ n(
|
|
1207
1207
|
"button",
|
|
1208
1208
|
{
|
|
1209
1209
|
type: "button",
|
|
1210
1210
|
className: "ll-hbtn ll-hbtn--ghost",
|
|
1211
|
-
onClick:
|
|
1211
|
+
onClick: Fe,
|
|
1212
1212
|
"aria-label": "Minimize widget",
|
|
1213
1213
|
children: /* @__PURE__ */ n(Ht, {})
|
|
1214
1214
|
}
|
|
@@ -1218,7 +1218,7 @@ const Vn = ({
|
|
|
1218
1218
|
{
|
|
1219
1219
|
type: "button",
|
|
1220
1220
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1221
|
-
onClick:
|
|
1221
|
+
onClick: Ue,
|
|
1222
1222
|
"aria-label": "Close widget",
|
|
1223
1223
|
children: /* @__PURE__ */ n(zt, {})
|
|
1224
1224
|
}
|
|
@@ -1226,15 +1226,15 @@ const Vn = ({
|
|
|
1226
1226
|
] })
|
|
1227
1227
|
] })
|
|
1228
1228
|
),
|
|
1229
|
-
|
|
1230
|
-
const y =
|
|
1229
|
+
be && /* @__PURE__ */ (() => {
|
|
1230
|
+
const y = H ? "Restart paused session" : L === "disconnected" ? "Reconnect to agent" : "Start video call", J = H ? "Pick up where you left off" : null;
|
|
1231
1231
|
return /* @__PURE__ */ w(ut, { children: [
|
|
1232
|
-
L === "idle" && !
|
|
1232
|
+
L === "idle" && !H && !O && /* @__PURE__ */ w(
|
|
1233
1233
|
"button",
|
|
1234
1234
|
{
|
|
1235
1235
|
type: "button",
|
|
1236
1236
|
className: "ll-expanded__play",
|
|
1237
|
-
onClick:
|
|
1237
|
+
onClick: re,
|
|
1238
1238
|
"aria-label": y,
|
|
1239
1239
|
children: [
|
|
1240
1240
|
/* @__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" }) }) }),
|
|
@@ -1244,13 +1244,13 @@ const Vn = ({
|
|
|
1244
1244
|
),
|
|
1245
1245
|
/* @__PURE__ */ w("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
|
|
1246
1246
|
l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
|
|
1247
|
-
|
|
1247
|
+
J && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: J }),
|
|
1248
1248
|
/* @__PURE__ */ n(
|
|
1249
1249
|
"button",
|
|
1250
1250
|
{
|
|
1251
1251
|
type: "button",
|
|
1252
1252
|
className: "ll-expanded__cta",
|
|
1253
|
-
onClick:
|
|
1253
|
+
onClick: re,
|
|
1254
1254
|
"aria-label": y,
|
|
1255
1255
|
children: y
|
|
1256
1256
|
}
|
|
@@ -1261,48 +1261,48 @@ const Vn = ({
|
|
|
1261
1261
|
/* @__PURE__ */ w(
|
|
1262
1262
|
"div",
|
|
1263
1263
|
{
|
|
1264
|
-
className: `ll-expanded__pip ${
|
|
1264
|
+
className: `ll-expanded__pip ${Ee && ($ || V) ? "is-visible" : ""}`,
|
|
1265
1265
|
children: [
|
|
1266
1266
|
/* @__PURE__ */ n(
|
|
1267
1267
|
"div",
|
|
1268
1268
|
{
|
|
1269
|
-
ref:
|
|
1270
|
-
className:
|
|
1269
|
+
ref: Pe,
|
|
1270
|
+
className: V ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1271
1271
|
}
|
|
1272
1272
|
),
|
|
1273
1273
|
/* @__PURE__ */ n(
|
|
1274
1274
|
"div",
|
|
1275
1275
|
{
|
|
1276
|
-
ref:
|
|
1277
|
-
className: !
|
|
1276
|
+
ref: G,
|
|
1277
|
+
className: !V && $ ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1278
1278
|
}
|
|
1279
1279
|
)
|
|
1280
1280
|
]
|
|
1281
1281
|
}
|
|
1282
1282
|
),
|
|
1283
|
-
|
|
1284
|
-
|
|
1283
|
+
Ee ? /* @__PURE__ */ w("div", { className: "ll-expanded__bottom", children: [
|
|
1284
|
+
Ve && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Ve }) }),
|
|
1285
1285
|
/* @__PURE__ */ w("div", { className: "ll-toolbar", onClick: (y) => y.stopPropagation(), children: [
|
|
1286
|
-
|
|
1286
|
+
ae && /* @__PURE__ */ n(
|
|
1287
1287
|
"button",
|
|
1288
1288
|
{
|
|
1289
1289
|
type: "button",
|
|
1290
|
-
className: `ll-tool ${
|
|
1291
|
-
onClick:
|
|
1292
|
-
"aria-label":
|
|
1293
|
-
title:
|
|
1294
|
-
children: /* @__PURE__ */ n(
|
|
1290
|
+
className: `ll-tool ${V ? "is-on" : ""}`,
|
|
1291
|
+
onClick: Ce,
|
|
1292
|
+
"aria-label": V ? "Stop sharing screen" : "Share screen",
|
|
1293
|
+
title: V ? "Stop sharing" : "Share screen",
|
|
1294
|
+
children: /* @__PURE__ */ n(Kn, {})
|
|
1295
1295
|
}
|
|
1296
1296
|
),
|
|
1297
|
-
|
|
1297
|
+
ve && /* @__PURE__ */ w("div", { className: "ll-tool-split", children: [
|
|
1298
1298
|
/* @__PURE__ */ n(
|
|
1299
1299
|
"button",
|
|
1300
1300
|
{
|
|
1301
1301
|
type: "button",
|
|
1302
|
-
className: `ll-tool ll-tool--left ${
|
|
1303
|
-
onClick:
|
|
1304
|
-
"aria-label":
|
|
1305
|
-
title:
|
|
1302
|
+
className: `ll-tool ll-tool--left ${$ ? "is-on" : ""}`,
|
|
1303
|
+
onClick: Le,
|
|
1304
|
+
"aria-label": $ ? "Turn off camera" : "Turn on camera",
|
|
1305
|
+
title: $ ? "Stop camera" : "Start camera",
|
|
1306
1306
|
children: /* @__PURE__ */ n(Qn, {})
|
|
1307
1307
|
}
|
|
1308
1308
|
),
|
|
@@ -1310,24 +1310,24 @@ const Vn = ({
|
|
|
1310
1310
|
"button",
|
|
1311
1311
|
{
|
|
1312
1312
|
type: "button",
|
|
1313
|
-
className: `ll-tool ll-tool--right ${
|
|
1313
|
+
className: `ll-tool ll-tool--right ${$ ? "is-on" : ""}`,
|
|
1314
1314
|
onClick: (y) => {
|
|
1315
|
-
y.stopPropagation(),
|
|
1315
|
+
y.stopPropagation(), me((J) => !J), ee(!1);
|
|
1316
1316
|
},
|
|
1317
1317
|
"aria-label": "Camera devices",
|
|
1318
1318
|
"aria-haspopup": "listbox",
|
|
1319
|
-
"aria-expanded":
|
|
1320
|
-
children: /* @__PURE__ */ n(
|
|
1319
|
+
"aria-expanded": ue,
|
|
1320
|
+
children: /* @__PURE__ */ n(Ke, {})
|
|
1321
1321
|
}
|
|
1322
1322
|
),
|
|
1323
|
-
|
|
1323
|
+
ue && P.length > 0 && /* @__PURE__ */ n(
|
|
1324
1324
|
Ot,
|
|
1325
1325
|
{
|
|
1326
1326
|
label: "Camera",
|
|
1327
|
-
devices:
|
|
1327
|
+
devices: P,
|
|
1328
1328
|
activeId: W,
|
|
1329
1329
|
onPick: (y) => {
|
|
1330
|
-
|
|
1330
|
+
me(!1), Se(y);
|
|
1331
1331
|
}
|
|
1332
1332
|
}
|
|
1333
1333
|
)
|
|
@@ -1338,7 +1338,7 @@ const Vn = ({
|
|
|
1338
1338
|
{
|
|
1339
1339
|
type: "button",
|
|
1340
1340
|
className: `ll-tool ll-tool--left ${p ? "is-muted" : ""}`,
|
|
1341
|
-
onClick:
|
|
1341
|
+
onClick: ke,
|
|
1342
1342
|
"aria-label": p ? "Unmute microphone" : "Mute microphone",
|
|
1343
1343
|
title: p ? "Unmute" : "Mute",
|
|
1344
1344
|
children: /* @__PURE__ */ n(Zn, { muted: p })
|
|
@@ -1350,15 +1350,15 @@ const Vn = ({
|
|
|
1350
1350
|
type: "button",
|
|
1351
1351
|
className: `ll-tool ll-tool--right ${p ? "is-muted" : ""}`,
|
|
1352
1352
|
onClick: (y) => {
|
|
1353
|
-
y.stopPropagation(), ee((
|
|
1353
|
+
y.stopPropagation(), ee((J) => !J), me(!1);
|
|
1354
1354
|
},
|
|
1355
1355
|
"aria-label": "Microphone devices",
|
|
1356
1356
|
"aria-haspopup": "listbox",
|
|
1357
|
-
"aria-expanded":
|
|
1358
|
-
children: /* @__PURE__ */ n(
|
|
1357
|
+
"aria-expanded": oe,
|
|
1358
|
+
children: /* @__PURE__ */ n(Ke, {})
|
|
1359
1359
|
}
|
|
1360
1360
|
),
|
|
1361
|
-
|
|
1361
|
+
oe && B.length > 0 && /* @__PURE__ */ n(
|
|
1362
1362
|
Ot,
|
|
1363
1363
|
{
|
|
1364
1364
|
label: "Microphone",
|
|
@@ -1372,27 +1372,27 @@ const Vn = ({
|
|
|
1372
1372
|
"button",
|
|
1373
1373
|
{
|
|
1374
1374
|
type: "button",
|
|
1375
|
-
className: `ll-tool ${
|
|
1376
|
-
onClick:
|
|
1377
|
-
"aria-label":
|
|
1378
|
-
title:
|
|
1379
|
-
children: /* @__PURE__ */ n(er, { muted:
|
|
1375
|
+
className: `ll-tool ${ne ? "is-muted" : ""}`,
|
|
1376
|
+
onClick: j,
|
|
1377
|
+
"aria-label": ne ? "Unmute speaker" : "Mute speaker",
|
|
1378
|
+
title: ne ? "Unmute speaker" : "Mute speaker",
|
|
1379
|
+
children: /* @__PURE__ */ n(er, { muted: ne })
|
|
1380
1380
|
}
|
|
1381
1381
|
)
|
|
1382
1382
|
] }),
|
|
1383
|
-
|
|
1383
|
+
pe && /* @__PURE__ */ w("form", { className: "ll-message-input", onSubmit: we, children: [
|
|
1384
1384
|
/* @__PURE__ */ n(
|
|
1385
1385
|
"input",
|
|
1386
1386
|
{
|
|
1387
1387
|
type: "text",
|
|
1388
1388
|
className: "ll-message-input__field",
|
|
1389
1389
|
placeholder: "Message...",
|
|
1390
|
-
value:
|
|
1391
|
-
onChange: (y) =>
|
|
1390
|
+
value: Q,
|
|
1391
|
+
onChange: (y) => ie(y.target.value),
|
|
1392
1392
|
"aria-label": "Message the agent"
|
|
1393
1393
|
}
|
|
1394
1394
|
),
|
|
1395
|
-
|
|
1395
|
+
Q.trim() && /* @__PURE__ */ n(
|
|
1396
1396
|
"button",
|
|
1397
1397
|
{
|
|
1398
1398
|
type: "submit",
|
|
@@ -1407,7 +1407,7 @@ const Vn = ({
|
|
|
1407
1407
|
{
|
|
1408
1408
|
type: "button",
|
|
1409
1409
|
className: "ll-expanded__end",
|
|
1410
|
-
onClick:
|
|
1410
|
+
onClick: ce,
|
|
1411
1411
|
children: "End conversation"
|
|
1412
1412
|
}
|
|
1413
1413
|
)
|
|
@@ -1421,23 +1421,23 @@ const Vn = ({
|
|
|
1421
1421
|
{
|
|
1422
1422
|
type: "button",
|
|
1423
1423
|
className: "ll-expanded__banner-x",
|
|
1424
|
-
onClick:
|
|
1424
|
+
onClick: je,
|
|
1425
1425
|
"aria-label": "Dismiss",
|
|
1426
1426
|
children: "×"
|
|
1427
1427
|
}
|
|
1428
1428
|
)
|
|
1429
1429
|
] });
|
|
1430
|
-
if (!
|
|
1431
|
-
let y = "Failed to connect",
|
|
1432
|
-
return
|
|
1430
|
+
if (!O || L !== "error") return null;
|
|
1431
|
+
let y = "Failed to connect", J = "Try again";
|
|
1432
|
+
return O === "MIC_PERMISSION_DENIED" ? y = "Microphone blocked. Allow access to talk." : O === "MIC_NOT_FOUND" ? y = "No microphone found. Plug one in + retry." : O === "MIC_UNAVAILABLE" ? y = "Mic unavailable. Check other apps using it." : O === "AGENT_TIMEOUT" ? y = "Agent didn't pick up. Try again." : O === "CONNECT_FAILED" ? y = "Connection failed. Check your network." : O.length < 80 && (y = O), /* @__PURE__ */ w("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
|
|
1433
1433
|
/* @__PURE__ */ n("span", { children: y }),
|
|
1434
1434
|
/* @__PURE__ */ n(
|
|
1435
1435
|
"button",
|
|
1436
1436
|
{
|
|
1437
1437
|
type: "button",
|
|
1438
1438
|
className: "ll-expanded__banner-retry",
|
|
1439
|
-
onClick:
|
|
1440
|
-
children:
|
|
1439
|
+
onClick: _e,
|
|
1440
|
+
children: J
|
|
1441
1441
|
}
|
|
1442
1442
|
)
|
|
1443
1443
|
] });
|
|
@@ -1446,7 +1446,7 @@ const Vn = ({
|
|
|
1446
1446
|
}
|
|
1447
1447
|
);
|
|
1448
1448
|
};
|
|
1449
|
-
function
|
|
1449
|
+
function Ke() {
|
|
1450
1450
|
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" }) });
|
|
1451
1451
|
}
|
|
1452
1452
|
function zt() {
|
|
@@ -1458,7 +1458,7 @@ function zt() {
|
|
|
1458
1458
|
function Ht() {
|
|
1459
1459
|
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" }) });
|
|
1460
1460
|
}
|
|
1461
|
-
function
|
|
1461
|
+
function Kn() {
|
|
1462
1462
|
return /* @__PURE__ */ w("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: [
|
|
1463
1463
|
/* @__PURE__ */ n("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
|
|
1464
1464
|
/* @__PURE__ */ n("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
|
|
@@ -1503,17 +1503,17 @@ const Ot = ({ label: e, devices: t, activeId: r, onPick: o }) => /* @__PURE__ */
|
|
|
1503
1503
|
children: [
|
|
1504
1504
|
/* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
|
|
1505
1505
|
t.map((i, l) => {
|
|
1506
|
-
const
|
|
1506
|
+
const c = r === i.deviceId;
|
|
1507
1507
|
return /* @__PURE__ */ w(
|
|
1508
1508
|
"button",
|
|
1509
1509
|
{
|
|
1510
1510
|
type: "button",
|
|
1511
|
-
className: `ll-device-menu__item ${
|
|
1511
|
+
className: `ll-device-menu__item ${c ? "is-active" : ""}`,
|
|
1512
1512
|
onClick: () => o(i.deviceId),
|
|
1513
1513
|
role: "option",
|
|
1514
|
-
"aria-selected":
|
|
1514
|
+
"aria-selected": c,
|
|
1515
1515
|
children: [
|
|
1516
|
-
|
|
1516
|
+
c && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
|
|
1517
1517
|
/* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: i.label || `${e} ${l + 1}` })
|
|
1518
1518
|
]
|
|
1519
1519
|
},
|
|
@@ -1544,7 +1544,7 @@ function tt(e) {
|
|
|
1544
1544
|
}
|
|
1545
1545
|
return !0;
|
|
1546
1546
|
}
|
|
1547
|
-
const Qe = 4096, rr = 20, or = 20, ir = 10, lr = 10, ar = 30, qt = 500, cr = [
|
|
1547
|
+
const Qe = 4096, rr = 20, or = 20, ir = 10, lr = 10, ar = 30, sr = 20, qt = 500, cr = [
|
|
1548
1548
|
'[data-ll-private="true"]',
|
|
1549
1549
|
".ll-widget",
|
|
1550
1550
|
"script",
|
|
@@ -1552,7 +1552,7 @@ const Qe = 4096, rr = 20, or = 20, ir = 10, lr = 10, ar = 30, qt = 500, cr = [
|
|
|
1552
1552
|
"noscript",
|
|
1553
1553
|
"iframe"
|
|
1554
1554
|
];
|
|
1555
|
-
function
|
|
1555
|
+
function qe(e) {
|
|
1556
1556
|
if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
|
|
1557
1557
|
let t = e;
|
|
1558
1558
|
for (; t; ) {
|
|
@@ -1562,7 +1562,7 @@ function He(e) {
|
|
|
1562
1562
|
}
|
|
1563
1563
|
return !1;
|
|
1564
1564
|
}
|
|
1565
|
-
function
|
|
1565
|
+
function Be(e) {
|
|
1566
1566
|
if (typeof window > "u") return !0;
|
|
1567
1567
|
const t = e.getBoundingClientRect();
|
|
1568
1568
|
if (t.width <= 0 || t.height <= 0) return !1;
|
|
@@ -1582,13 +1582,13 @@ function Bt(e) {
|
|
|
1582
1582
|
const i = e.closest("label");
|
|
1583
1583
|
return i != null && i.textContent ? i.textContent.trim() : "";
|
|
1584
1584
|
}
|
|
1585
|
-
function
|
|
1585
|
+
function fe(e, t) {
|
|
1586
1586
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
1587
1587
|
}
|
|
1588
|
-
function
|
|
1588
|
+
function Ie(e) {
|
|
1589
1589
|
return e.length;
|
|
1590
1590
|
}
|
|
1591
|
-
function
|
|
1591
|
+
function dr(e, t = {}) {
|
|
1592
1592
|
const r = t.doc ?? (typeof document < "u" ? document : null);
|
|
1593
1593
|
if (!r)
|
|
1594
1594
|
return {
|
|
@@ -1602,39 +1602,39 @@ function sr(e, t = {}) {
|
|
|
1602
1602
|
forms: [],
|
|
1603
1603
|
extras: e
|
|
1604
1604
|
};
|
|
1605
|
-
const o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "",
|
|
1605
|
+
const o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "", c = Array.from(
|
|
1606
1606
|
r.querySelectorAll("[data-ll-region]")
|
|
1607
1607
|
), d = [];
|
|
1608
|
-
for (const p of
|
|
1608
|
+
for (const p of c) {
|
|
1609
1609
|
if (d.length >= ir) break;
|
|
1610
|
-
if (
|
|
1611
|
-
const N = p.getAttribute("data-ll-region") ?? "", B = p.getAttribute("data-ll-intent") ?? void 0,
|
|
1610
|
+
if (qe(p) || !Be(p)) continue;
|
|
1611
|
+
const N = p.getAttribute("data-ll-region") ?? "", B = p.getAttribute("data-ll-intent") ?? void 0, $ = fe(
|
|
1612
1612
|
(p.innerText || p.textContent || "").trim(),
|
|
1613
1613
|
qt * 2
|
|
1614
1614
|
);
|
|
1615
|
-
!N ||
|
|
1615
|
+
!N || !$ || d.push({ id: N, intent: B, text: $ });
|
|
1616
1616
|
}
|
|
1617
|
-
const
|
|
1617
|
+
const u = [], m = ["H1", "H2", "H3", "H4", "H5", "H6"], h = Array.from(
|
|
1618
1618
|
r.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
|
1619
1619
|
);
|
|
1620
|
-
for (const p of
|
|
1621
|
-
if (
|
|
1620
|
+
for (const p of h) {
|
|
1621
|
+
if (qe(p) || !Be(p)) continue;
|
|
1622
1622
|
const N = (p.textContent || "").trim();
|
|
1623
|
-
N &&
|
|
1623
|
+
N && u.push(`${p.tagName}: ${fe(N, 200)}`);
|
|
1624
1624
|
}
|
|
1625
1625
|
const a = Array.from(r.querySelectorAll("p, li"));
|
|
1626
1626
|
for (const p of a) {
|
|
1627
|
-
if (
|
|
1627
|
+
if (qe(p) || !Be(p) || m.includes(p.tagName)) continue;
|
|
1628
1628
|
const N = (p.textContent || "").trim();
|
|
1629
|
-
N.length > 10 &&
|
|
1629
|
+
N.length > 10 && u.push(fe(N, qt));
|
|
1630
1630
|
}
|
|
1631
|
-
const
|
|
1631
|
+
const s = u.join(`
|
|
1632
1632
|
`), R = [], C = Array.from(r.querySelectorAll("a[href]"));
|
|
1633
1633
|
for (const p of C) {
|
|
1634
1634
|
if (R.length >= rr) break;
|
|
1635
|
-
if (
|
|
1635
|
+
if (qe(p) || !Be(p)) continue;
|
|
1636
1636
|
const N = p.getAttribute("href") || "", B = (p.textContent || "").trim();
|
|
1637
|
-
!N || !B || R.push({ href: N, text:
|
|
1637
|
+
!N || !B || R.push({ href: N, text: fe(B, 100) });
|
|
1638
1638
|
}
|
|
1639
1639
|
const L = [], v = Array.from(
|
|
1640
1640
|
r.querySelectorAll(
|
|
@@ -1643,64 +1643,79 @@ function sr(e, t = {}) {
|
|
|
1643
1643
|
);
|
|
1644
1644
|
for (const p of v) {
|
|
1645
1645
|
if (L.length >= or) break;
|
|
1646
|
-
if (
|
|
1646
|
+
if (qe(p) || !tt(p) || !Be(p)) continue;
|
|
1647
1647
|
const N = Bt(p), B = p instanceof HTMLInputElement ? p.type : p.tagName.toLowerCase();
|
|
1648
|
-
N && L.push({ label:
|
|
1648
|
+
N && L.push({ label: fe(N, 100), type: B });
|
|
1649
1649
|
}
|
|
1650
1650
|
const b = Array.from(
|
|
1651
1651
|
r.querySelectorAll("[data-ll-form]")
|
|
1652
|
-
),
|
|
1652
|
+
), H = [];
|
|
1653
1653
|
for (const p of b) {
|
|
1654
|
-
if (
|
|
1654
|
+
if (H.length >= lr) break;
|
|
1655
1655
|
if (pt(p)) continue;
|
|
1656
1656
|
const N = p.getAttribute("data-ll-form") || "";
|
|
1657
1657
|
if (!N) continue;
|
|
1658
|
-
const B = p.getAttribute("data-ll-intent") || void 0,
|
|
1658
|
+
const B = p.getAttribute("data-ll-intent") || void 0, $ = Array.from(
|
|
1659
1659
|
p.querySelectorAll(
|
|
1660
1660
|
"[data-ll-field]"
|
|
1661
1661
|
)
|
|
1662
1662
|
), A = [];
|
|
1663
|
-
for (const
|
|
1663
|
+
for (const P of $) {
|
|
1664
1664
|
if (A.length >= ar) break;
|
|
1665
|
-
if (!tt(
|
|
1666
|
-
const W =
|
|
1665
|
+
if (!tt(P)) continue;
|
|
1666
|
+
const W = P.getAttribute("data-ll-field") || "";
|
|
1667
1667
|
if (!W) continue;
|
|
1668
|
-
const
|
|
1669
|
-
|
|
1668
|
+
const V = Bt(P) || W, te = P instanceof HTMLInputElement ? P.type : P.tagName.toLowerCase(), ne = {
|
|
1669
|
+
name: W,
|
|
1670
|
+
label: fe(V, 100),
|
|
1671
|
+
type: te
|
|
1672
|
+
};
|
|
1673
|
+
if (P instanceof HTMLSelectElement) {
|
|
1674
|
+
const ae = [];
|
|
1675
|
+
for (let pe = 0; pe < P.options.length && !(ae.length >= sr); pe++) {
|
|
1676
|
+
const se = P.options[pe];
|
|
1677
|
+
if (!se || se.disabled) continue;
|
|
1678
|
+
const re = se.value || "", ce = (se.textContent || "").trim() || re;
|
|
1679
|
+
!re && !ce || ae.push({ value: re, label: fe(ce, 60) });
|
|
1680
|
+
}
|
|
1681
|
+
ae.length > 0 && (ne.options = ae);
|
|
1682
|
+
}
|
|
1683
|
+
const ve = typeof P.validationMessage == "string" ? P.validationMessage : "";
|
|
1684
|
+
ve && (ne.validationMessage = fe(ve, 200)), A.push(ne);
|
|
1670
1685
|
}
|
|
1671
|
-
|
|
1686
|
+
H.push({ id: N, intent: B, fields: A });
|
|
1672
1687
|
}
|
|
1673
1688
|
const I = {
|
|
1674
1689
|
url: o,
|
|
1675
1690
|
title: l,
|
|
1676
1691
|
pathname: i,
|
|
1677
1692
|
regions: d,
|
|
1678
|
-
visibleText:
|
|
1693
|
+
visibleText: s,
|
|
1679
1694
|
visibleLinks: R,
|
|
1680
1695
|
visibleFields: L,
|
|
1681
|
-
forms:
|
|
1696
|
+
forms: H,
|
|
1682
1697
|
extras: e
|
|
1683
1698
|
};
|
|
1684
|
-
let
|
|
1685
|
-
for (;
|
|
1686
|
-
I.visibleFields.pop(),
|
|
1687
|
-
for (;
|
|
1688
|
-
I.visibleLinks.pop(),
|
|
1689
|
-
return
|
|
1690
|
-
}
|
|
1691
|
-
let
|
|
1699
|
+
let O = Ie(JSON.stringify(I.regions)) + Ie(I.visibleText) + Ie(JSON.stringify(I.visibleLinks)) + Ie(JSON.stringify(I.visibleFields));
|
|
1700
|
+
for (; O > Qe && I.visibleFields.length > 0; )
|
|
1701
|
+
I.visibleFields.pop(), O = Ie(JSON.stringify(I.visibleFields));
|
|
1702
|
+
for (; O > Qe && I.visibleLinks.length > 0; )
|
|
1703
|
+
I.visibleLinks.pop(), O -= 80;
|
|
1704
|
+
return Ie(I.visibleText) > Qe && (I.visibleText = fe(I.visibleText, Qe - 100)), I;
|
|
1705
|
+
}
|
|
1706
|
+
let Me = null;
|
|
1692
1707
|
function Wt(e, t = {}) {
|
|
1693
1708
|
const r = Date.now(), i = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
|
|
1694
|
-
if (
|
|
1695
|
-
return
|
|
1696
|
-
const l =
|
|
1697
|
-
return
|
|
1709
|
+
if (Me && Me.key === i && r - Me.at < 1e3)
|
|
1710
|
+
return Me.ctx;
|
|
1711
|
+
const l = dr(e, t);
|
|
1712
|
+
return Me = { key: i, at: r, ctx: l }, l;
|
|
1698
1713
|
}
|
|
1699
|
-
function
|
|
1700
|
-
|
|
1714
|
+
function ur() {
|
|
1715
|
+
Me = null;
|
|
1701
1716
|
}
|
|
1702
|
-
const
|
|
1703
|
-
function
|
|
1717
|
+
const fr = 200;
|
|
1718
|
+
function pr(e) {
|
|
1704
1719
|
const t = String(e.href || "");
|
|
1705
1720
|
return {
|
|
1706
1721
|
href: t,
|
|
@@ -1710,63 +1725,63 @@ function fr(e) {
|
|
|
1710
1725
|
description: e.description
|
|
1711
1726
|
};
|
|
1712
1727
|
}
|
|
1713
|
-
function
|
|
1728
|
+
function hr(e) {
|
|
1714
1729
|
return !(!e || e.startsWith("#") || e.startsWith("javascript:") || e.startsWith("mailto:") || e.startsWith("tel:"));
|
|
1715
1730
|
}
|
|
1716
|
-
function
|
|
1731
|
+
function mr(e) {
|
|
1717
1732
|
const t = e ?? (typeof document < "u" ? document : null);
|
|
1718
1733
|
if (!t) return [];
|
|
1719
1734
|
const r = typeof window < "u" && window.location.origin || "", o = /* @__PURE__ */ new Set(), i = [], l = Array.from(t.querySelectorAll("a[href]"));
|
|
1720
|
-
for (const
|
|
1721
|
-
if (i.length >=
|
|
1722
|
-
if (pt(
|
|
1723
|
-
const d =
|
|
1724
|
-
if (!
|
|
1725
|
-
let
|
|
1735
|
+
for (const c of l) {
|
|
1736
|
+
if (i.length >= fr) break;
|
|
1737
|
+
if (pt(c)) continue;
|
|
1738
|
+
const d = c.getAttribute("href") || "";
|
|
1739
|
+
if (!hr(d)) continue;
|
|
1740
|
+
let u = d, m = !0;
|
|
1726
1741
|
try {
|
|
1727
1742
|
if (typeof window < "u") {
|
|
1728
1743
|
const a = new URL(d, r);
|
|
1729
|
-
|
|
1744
|
+
m = a.origin === r, m && d.startsWith("http") && (u = a.pathname + a.search + a.hash);
|
|
1730
1745
|
}
|
|
1731
1746
|
} catch {
|
|
1732
1747
|
continue;
|
|
1733
1748
|
}
|
|
1734
|
-
if (o.has(
|
|
1735
|
-
o.add(
|
|
1736
|
-
const
|
|
1737
|
-
i.push({ href:
|
|
1749
|
+
if (o.has(u)) continue;
|
|
1750
|
+
o.add(u);
|
|
1751
|
+
const h = (c.textContent || "").trim().slice(0, 120);
|
|
1752
|
+
i.push({ href: u, text: h, internal: m });
|
|
1738
1753
|
}
|
|
1739
1754
|
return i;
|
|
1740
1755
|
}
|
|
1741
|
-
let
|
|
1742
|
-
const
|
|
1743
|
-
function
|
|
1756
|
+
let Te = null;
|
|
1757
|
+
const gr = 5e3;
|
|
1758
|
+
function ct() {
|
|
1744
1759
|
const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
|
|
1745
|
-
if (
|
|
1746
|
-
return
|
|
1747
|
-
const r =
|
|
1748
|
-
return
|
|
1760
|
+
if (Te && Te.pathname === t && e - Te.at < gr)
|
|
1761
|
+
return Te.routes;
|
|
1762
|
+
const r = mr();
|
|
1763
|
+
return Te = { at: e, pathname: t, routes: r }, r;
|
|
1749
1764
|
}
|
|
1750
|
-
function
|
|
1751
|
-
|
|
1765
|
+
function yr() {
|
|
1766
|
+
Te = null;
|
|
1752
1767
|
}
|
|
1753
|
-
function
|
|
1768
|
+
function vr(e, t) {
|
|
1754
1769
|
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;
|
|
1755
1770
|
i ? i.call(e, t) : e.value = t;
|
|
1756
1771
|
}
|
|
1757
|
-
function
|
|
1772
|
+
function br(e, t, r = {}) {
|
|
1758
1773
|
const o = r.triggerInput ?? !0, i = r.triggerChange ?? !0;
|
|
1759
1774
|
if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
|
|
1760
1775
|
const l = Object.getOwnPropertyDescriptor(
|
|
1761
1776
|
HTMLInputElement.prototype,
|
|
1762
1777
|
"checked"
|
|
1763
|
-
),
|
|
1764
|
-
|
|
1778
|
+
), c = l == null ? void 0 : l.set, d = t === "true" || t === "1" || t === "on";
|
|
1779
|
+
c ? c.call(e, d) : e.checked = d, o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
1765
1780
|
return;
|
|
1766
1781
|
}
|
|
1767
|
-
|
|
1782
|
+
vr(e, t), o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
1768
1783
|
}
|
|
1769
|
-
function
|
|
1784
|
+
function wr() {
|
|
1770
1785
|
if (typeof window > "u" || typeof document > "u")
|
|
1771
1786
|
return !1;
|
|
1772
1787
|
const e = document.scrollingElement || document.documentElement;
|
|
@@ -1774,19 +1789,19 @@ function br() {
|
|
|
1774
1789
|
const t = window.getComputedStyle(e);
|
|
1775
1790
|
return !(t.overflowY === "hidden" || t.overflowY === "clip");
|
|
1776
1791
|
}
|
|
1777
|
-
function
|
|
1792
|
+
function _r(e) {
|
|
1778
1793
|
if (!(e instanceof HTMLElement)) return !1;
|
|
1779
1794
|
const r = window.getComputedStyle(e).overflowY;
|
|
1780
1795
|
return !(r !== "auto" && r !== "scroll" || e.scrollHeight <= e.clientHeight + 2);
|
|
1781
1796
|
}
|
|
1782
|
-
function
|
|
1797
|
+
function xr() {
|
|
1783
1798
|
if (typeof document > "u") return null;
|
|
1784
1799
|
const e = Array.from(
|
|
1785
1800
|
document.querySelectorAll("body, body *")
|
|
1786
1801
|
);
|
|
1787
1802
|
let t = null, r = 0;
|
|
1788
1803
|
for (const o of e) {
|
|
1789
|
-
if (!
|
|
1804
|
+
if (!_r(o)) continue;
|
|
1790
1805
|
const i = o.getBoundingClientRect();
|
|
1791
1806
|
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;
|
|
1792
1807
|
const l = i.width * i.height;
|
|
@@ -1794,24 +1809,24 @@ function _r() {
|
|
|
1794
1809
|
}
|
|
1795
1810
|
return t;
|
|
1796
1811
|
}
|
|
1797
|
-
function
|
|
1812
|
+
function kr() {
|
|
1798
1813
|
if (typeof window > "u")
|
|
1799
1814
|
return null;
|
|
1800
|
-
if (
|
|
1801
|
-
const e =
|
|
1815
|
+
if (wr()) return window;
|
|
1816
|
+
const e = xr();
|
|
1802
1817
|
return e || window;
|
|
1803
1818
|
}
|
|
1804
1819
|
function Ft(e) {
|
|
1805
1820
|
return e instanceof Window ? e.innerHeight || 0 : e.clientHeight || 0;
|
|
1806
1821
|
}
|
|
1807
|
-
function
|
|
1822
|
+
function Lr(e) {
|
|
1808
1823
|
var t, r;
|
|
1809
1824
|
return e instanceof Window ? typeof document > "u" ? 0 : Math.max(
|
|
1810
1825
|
((t = document.body) == null ? void 0 : t.scrollHeight) ?? 0,
|
|
1811
1826
|
((r = document.documentElement) == null ? void 0 : r.scrollHeight) ?? 0
|
|
1812
1827
|
) : e.scrollHeight - e.clientHeight;
|
|
1813
1828
|
}
|
|
1814
|
-
const
|
|
1829
|
+
const Sr = /* @__PURE__ */ new Set([
|
|
1815
1830
|
"agent_state",
|
|
1816
1831
|
"avatar_stream_ready",
|
|
1817
1832
|
"avatar_active",
|
|
@@ -1834,7 +1849,7 @@ const Lr = /* @__PURE__ */ new Set([
|
|
|
1834
1849
|
"submit_form",
|
|
1835
1850
|
"request_routes"
|
|
1836
1851
|
]);
|
|
1837
|
-
function
|
|
1852
|
+
function Cr(e) {
|
|
1838
1853
|
var wt, _t, xt, kt, Lt, St, Ct;
|
|
1839
1854
|
const {
|
|
1840
1855
|
agentId: t,
|
|
@@ -1842,85 +1857,85 @@ function Sr(e) {
|
|
|
1842
1857
|
baseUrl: o = "https://app.livelayer.studio",
|
|
1843
1858
|
sessionEndpoint: i,
|
|
1844
1859
|
sessionBody: l,
|
|
1845
|
-
autoConnect:
|
|
1860
|
+
autoConnect: c = !1,
|
|
1846
1861
|
displayMode: d,
|
|
1847
|
-
defaultDisplayMode:
|
|
1848
|
-
onDisplayModeChange:
|
|
1849
|
-
position:
|
|
1862
|
+
defaultDisplayMode: u = "expanded",
|
|
1863
|
+
onDisplayModeChange: m,
|
|
1864
|
+
position: h = "bottom-right",
|
|
1850
1865
|
mobileBreakpoint: a = 640,
|
|
1851
|
-
persistKey:
|
|
1866
|
+
persistKey: s = "ll-widget",
|
|
1852
1867
|
disablePersistence: R = !1,
|
|
1853
1868
|
teamMembers: C,
|
|
1854
1869
|
currentTeamMemberId: L,
|
|
1855
1870
|
onTeamMemberChange: v,
|
|
1856
1871
|
idleLoopUrl: b,
|
|
1857
|
-
greeting:
|
|
1872
|
+
greeting: H,
|
|
1858
1873
|
avatarImageUrl: I,
|
|
1859
|
-
agentName:
|
|
1874
|
+
agentName: O,
|
|
1860
1875
|
branding: p = {},
|
|
1861
1876
|
allowCamera: N = !0,
|
|
1862
1877
|
allowScreenShare: B = !0,
|
|
1863
|
-
allowTyping:
|
|
1878
|
+
allowTyping: $ = !0,
|
|
1864
1879
|
showOn: A,
|
|
1865
|
-
hideOn:
|
|
1880
|
+
hideOn: P,
|
|
1866
1881
|
pathname: W,
|
|
1867
|
-
onNavigate:
|
|
1882
|
+
onNavigate: V,
|
|
1868
1883
|
onScrollToSelector: te,
|
|
1869
|
-
getPageContext:
|
|
1870
|
-
pageContextExtras:
|
|
1871
|
-
getRoutes:
|
|
1872
|
-
onScrollPage:
|
|
1873
|
-
onClick:
|
|
1874
|
-
capabilities:
|
|
1875
|
-
onConnect:
|
|
1876
|
-
onDisconnect:
|
|
1877
|
-
onTranscript:
|
|
1878
|
-
onAgentState:
|
|
1879
|
-
onConnectionStateChange:
|
|
1880
|
-
onAgentEvent:
|
|
1881
|
-
onAgentCommand:
|
|
1882
|
-
controlledSession:
|
|
1883
|
-
className:
|
|
1884
|
-
style:
|
|
1885
|
-
zIndex:
|
|
1886
|
-
} = e,
|
|
1884
|
+
getPageContext: ne,
|
|
1885
|
+
pageContextExtras: ve,
|
|
1886
|
+
getRoutes: ae,
|
|
1887
|
+
onScrollPage: pe,
|
|
1888
|
+
onClick: se,
|
|
1889
|
+
capabilities: re,
|
|
1890
|
+
onConnect: ce,
|
|
1891
|
+
onDisconnect: _e,
|
|
1892
|
+
onTranscript: xe,
|
|
1893
|
+
onAgentState: ke,
|
|
1894
|
+
onConnectionStateChange: Le,
|
|
1895
|
+
onAgentEvent: Se,
|
|
1896
|
+
onAgentCommand: Ce,
|
|
1897
|
+
controlledSession: j,
|
|
1898
|
+
className: We,
|
|
1899
|
+
style: Fe,
|
|
1900
|
+
zIndex: Ue = 2147483647
|
|
1901
|
+
} = e, je = Tn(W), he = qn(je, A, P);
|
|
1887
1902
|
T(() => {
|
|
1888
|
-
|
|
1889
|
-
}, [
|
|
1890
|
-
const
|
|
1891
|
-
var
|
|
1892
|
-
return L ?? ((
|
|
1893
|
-
}),
|
|
1894
|
-
() => (C == null ? void 0 : C.find((
|
|
1895
|
-
[C,
|
|
1896
|
-
),
|
|
1903
|
+
ur(), yr();
|
|
1904
|
+
}, [je]);
|
|
1905
|
+
const de = L !== void 0, [Ee, Ne] = S(() => {
|
|
1906
|
+
var g;
|
|
1907
|
+
return L ?? ((g = C == null ? void 0 : C[0]) == null ? void 0 : g.id);
|
|
1908
|
+
}), be = de ? L : Ee, G = Ze(
|
|
1909
|
+
() => (C == null ? void 0 : C.find((g) => g.id === be)) ?? null,
|
|
1910
|
+
[C, be]
|
|
1911
|
+
), Pe = (G == null ? void 0 : G.agentId) ?? t, [oe, ee] = An({
|
|
1897
1912
|
value: d,
|
|
1898
|
-
defaultValue:
|
|
1899
|
-
onChange:
|
|
1900
|
-
persistKey:
|
|
1913
|
+
defaultValue: u,
|
|
1914
|
+
onChange: m,
|
|
1915
|
+
persistKey: s,
|
|
1901
1916
|
disablePersistence: R
|
|
1902
|
-
}),
|
|
1903
|
-
rt.current =
|
|
1904
|
-
function
|
|
1905
|
-
const
|
|
1906
|
-
return
|
|
1917
|
+
}), ue = In(a), me = yn(), Q = vn(), ie = wn(), we = _n(), De = xn(), [Ve, $e] = S(!1), [Ae, y] = S(!1), [J, Ye] = S(!1), [Yt, Xt] = S(!1), [nt, Gt] = S(!1), rt = E(V), ot = E(te), it = E(pe), lt = E(se), ht = E(ne), mt = E(ve), gt = E(ae), at = E(re), le = E(null);
|
|
1918
|
+
rt.current = V, ot.current = te, it.current = pe, lt.current = se, ht.current = ne, mt.current = ve, gt.current = ae, at.current = re;
|
|
1919
|
+
function ge(g) {
|
|
1920
|
+
const f = at.current;
|
|
1921
|
+
return f ? f.includes(g) : !0;
|
|
1907
1922
|
}
|
|
1908
|
-
function
|
|
1923
|
+
function ye(g, f) {
|
|
1909
1924
|
console.warn(
|
|
1910
|
-
`[LiveLayer] Agent command "${
|
|
1925
|
+
`[LiveLayer] Agent command "${g}" blocked — capability "${f}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
|
|
1911
1926
|
);
|
|
1912
1927
|
}
|
|
1913
|
-
const
|
|
1914
|
-
(
|
|
1915
|
-
var
|
|
1916
|
-
const
|
|
1917
|
-
if (!(!
|
|
1918
|
-
if (
|
|
1919
|
-
if (!
|
|
1920
|
-
|
|
1928
|
+
const ze = k(
|
|
1929
|
+
(g) => {
|
|
1930
|
+
var Z, Ge, Je, Et;
|
|
1931
|
+
const f = g;
|
|
1932
|
+
if (!(!f.type || typeof f.type != "string")) {
|
|
1933
|
+
if (Se == null || Se({ eventName: f.type, data: g }), f.type === "navigate") {
|
|
1934
|
+
if (!ge("navigate")) {
|
|
1935
|
+
ye("navigate", "navigate");
|
|
1921
1936
|
return;
|
|
1922
1937
|
}
|
|
1923
|
-
const x = typeof
|
|
1938
|
+
const x = typeof f.href == "string" ? f.href : null;
|
|
1924
1939
|
if (!x) {
|
|
1925
1940
|
console.warn(
|
|
1926
1941
|
`[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
|
|
@@ -1958,14 +1973,14 @@ function Sr(e) {
|
|
|
1958
1973
|
}
|
|
1959
1974
|
return;
|
|
1960
1975
|
}
|
|
1961
|
-
if (
|
|
1962
|
-
if (!
|
|
1963
|
-
|
|
1976
|
+
if (f.type === "scroll_to") {
|
|
1977
|
+
if (!ge("scroll")) {
|
|
1978
|
+
ye("scroll_to", "scroll");
|
|
1964
1979
|
return;
|
|
1965
1980
|
}
|
|
1966
|
-
const x = typeof
|
|
1981
|
+
const x = typeof f.selector == "string" ? f.selector : null;
|
|
1967
1982
|
if (!x) return;
|
|
1968
|
-
const M =
|
|
1983
|
+
const M = f.behavior === "instant" ? "instant" : "smooth";
|
|
1969
1984
|
if (ot.current) {
|
|
1970
1985
|
try {
|
|
1971
1986
|
ot.current(
|
|
@@ -2000,93 +2015,93 @@ function Sr(e) {
|
|
|
2000
2015
|
}
|
|
2001
2016
|
return;
|
|
2002
2017
|
}
|
|
2003
|
-
if (
|
|
2004
|
-
if (!
|
|
2005
|
-
|
|
2018
|
+
if (f.type === "request_page_context") {
|
|
2019
|
+
if (!ge("read_page")) {
|
|
2020
|
+
ye("request_page_context", "read_page");
|
|
2006
2021
|
return;
|
|
2007
2022
|
}
|
|
2008
|
-
const x = typeof
|
|
2009
|
-
const
|
|
2010
|
-
if (
|
|
2023
|
+
const x = typeof f.requestId == "string" ? f.requestId : void 0, M = (Z = le.current) == null ? void 0 : Z.call(le), q = (U) => {
|
|
2024
|
+
const D = M, X = D == null ? void 0 : D.localParticipant;
|
|
2025
|
+
if (X != null && X.publishData)
|
|
2011
2026
|
try {
|
|
2012
|
-
const
|
|
2013
|
-
|
|
2014
|
-
} catch (
|
|
2015
|
-
console.warn("[LiveLayer] publishData failed.",
|
|
2027
|
+
const K = x ? { ...U, requestId: x } : U, Re = new TextEncoder().encode(JSON.stringify(K));
|
|
2028
|
+
X.publishData(Re, { reliable: !0 });
|
|
2029
|
+
} catch (K) {
|
|
2030
|
+
console.warn("[LiveLayer] publishData failed.", K);
|
|
2016
2031
|
}
|
|
2017
|
-
},
|
|
2032
|
+
}, z = mt.current, F = ht.current;
|
|
2018
2033
|
try {
|
|
2019
2034
|
if (F) {
|
|
2020
|
-
const
|
|
2021
|
-
if (
|
|
2022
|
-
q({ type: "page_context_pending" }),
|
|
2035
|
+
const U = F(z);
|
|
2036
|
+
if (U instanceof Promise) {
|
|
2037
|
+
q({ type: "page_context_pending" }), U.then((D) => q({ type: "page_context", context: D })).catch((D) => {
|
|
2023
2038
|
console.warn(
|
|
2024
2039
|
"[LiveLayer] getPageContext rejected; falling back to default walker.",
|
|
2025
|
-
|
|
2040
|
+
D
|
|
2026
2041
|
), q({
|
|
2027
2042
|
type: "page_context",
|
|
2028
|
-
context: Wt(
|
|
2043
|
+
context: Wt(z)
|
|
2029
2044
|
});
|
|
2030
2045
|
});
|
|
2031
2046
|
return;
|
|
2032
2047
|
}
|
|
2033
|
-
q({ type: "page_context", context:
|
|
2048
|
+
q({ type: "page_context", context: U });
|
|
2034
2049
|
return;
|
|
2035
2050
|
}
|
|
2036
2051
|
q({
|
|
2037
2052
|
type: "page_context",
|
|
2038
|
-
context: Wt(
|
|
2053
|
+
context: Wt(z)
|
|
2039
2054
|
});
|
|
2040
|
-
} catch (
|
|
2055
|
+
} catch (U) {
|
|
2041
2056
|
console.warn(
|
|
2042
2057
|
"[LiveLayer] page-context extraction threw. Sending empty context.",
|
|
2043
|
-
|
|
2058
|
+
U
|
|
2044
2059
|
), q({
|
|
2045
2060
|
type: "page_context",
|
|
2046
|
-
context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras:
|
|
2061
|
+
context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: z }
|
|
2047
2062
|
});
|
|
2048
2063
|
}
|
|
2049
2064
|
return;
|
|
2050
2065
|
}
|
|
2051
|
-
if (
|
|
2052
|
-
if (!
|
|
2053
|
-
|
|
2066
|
+
if (f.type === "scroll_page") {
|
|
2067
|
+
if (!ge("scroll")) {
|
|
2068
|
+
ye("scroll_page", "scroll");
|
|
2054
2069
|
return;
|
|
2055
2070
|
}
|
|
2056
|
-
const x =
|
|
2071
|
+
const x = f.direction;
|
|
2057
2072
|
if (x !== "up" && x !== "down" && x !== "top" && x !== "bottom") {
|
|
2058
2073
|
console.warn(
|
|
2059
2074
|
`[LiveLayer] scroll_page: invalid direction "${String(x)}". Expected up | down | top | bottom.`
|
|
2060
2075
|
);
|
|
2061
2076
|
return;
|
|
2062
2077
|
}
|
|
2063
|
-
const M =
|
|
2078
|
+
const M = f.behavior === "instant" ? "instant" : "smooth";
|
|
2064
2079
|
if (it.current) {
|
|
2065
2080
|
try {
|
|
2066
2081
|
it.current(
|
|
2067
2082
|
x,
|
|
2068
2083
|
M
|
|
2069
2084
|
);
|
|
2070
|
-
} catch (
|
|
2071
|
-
console.warn("[LiveLayer] onScrollPage threw.",
|
|
2085
|
+
} catch (D) {
|
|
2086
|
+
console.warn("[LiveLayer] onScrollPage threw.", D);
|
|
2072
2087
|
}
|
|
2073
2088
|
return;
|
|
2074
2089
|
}
|
|
2075
2090
|
if (typeof window > "u") return;
|
|
2076
|
-
const q = { behavior: M },
|
|
2077
|
-
|
|
2078
|
-
},
|
|
2079
|
-
|
|
2091
|
+
const q = { behavior: M }, z = kr(), F = (D) => {
|
|
2092
|
+
z instanceof Window ? z.scrollBy({ top: D, ...q }) : z.scrollBy({ top: D, ...q });
|
|
2093
|
+
}, U = (D) => {
|
|
2094
|
+
z instanceof Window ? z.scrollTo({ top: D, ...q }) : z.scrollTo({ top: D, ...q });
|
|
2080
2095
|
};
|
|
2081
|
-
x === "up" ? F(-Ft(
|
|
2096
|
+
x === "up" ? F(-Ft(z)) : x === "down" ? F(Ft(z)) : U(x === "top" ? 0 : Lr(z));
|
|
2082
2097
|
return;
|
|
2083
2098
|
}
|
|
2084
|
-
if (
|
|
2085
|
-
if (!
|
|
2086
|
-
|
|
2099
|
+
if (f.type === "click") {
|
|
2100
|
+
if (!ge("click")) {
|
|
2101
|
+
ye("click", "click");
|
|
2087
2102
|
return;
|
|
2088
2103
|
}
|
|
2089
|
-
const x = typeof
|
|
2104
|
+
const x = typeof f.selector == "string" ? f.selector : null;
|
|
2090
2105
|
if (!x) {
|
|
2091
2106
|
console.warn("[LiveLayer] click: missing selector.");
|
|
2092
2107
|
return;
|
|
@@ -2121,18 +2136,18 @@ function Sr(e) {
|
|
|
2121
2136
|
);
|
|
2122
2137
|
return;
|
|
2123
2138
|
}
|
|
2124
|
-
(
|
|
2139
|
+
(Ge = M.click) == null || Ge.call(M);
|
|
2125
2140
|
return;
|
|
2126
2141
|
}
|
|
2127
|
-
if (
|
|
2128
|
-
if (!
|
|
2129
|
-
|
|
2142
|
+
if (f.type === "fill_form" || f.type === "focus_field") {
|
|
2143
|
+
if (!ge("fill_forms")) {
|
|
2144
|
+
ye(f.type, "fill_forms");
|
|
2130
2145
|
return;
|
|
2131
2146
|
}
|
|
2132
2147
|
if (typeof document > "u") return;
|
|
2133
|
-
const x = typeof
|
|
2148
|
+
const x = typeof f.formId == "string" ? f.formId : null;
|
|
2134
2149
|
if (!x) {
|
|
2135
|
-
console.warn(`[LiveLayer] ${
|
|
2150
|
+
console.warn(`[LiveLayer] ${f.type}: missing formId.`);
|
|
2136
2151
|
return;
|
|
2137
2152
|
}
|
|
2138
2153
|
const M = document.querySelector(
|
|
@@ -2140,76 +2155,76 @@ function Sr(e) {
|
|
|
2140
2155
|
);
|
|
2141
2156
|
if (!M) {
|
|
2142
2157
|
console.warn(
|
|
2143
|
-
`[LiveLayer] ${
|
|
2158
|
+
`[LiveLayer] ${f.type}: no form with data-ll-form="${x}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
|
|
2144
2159
|
);
|
|
2145
2160
|
return;
|
|
2146
2161
|
}
|
|
2147
2162
|
if (M.closest('[data-ll-private="true"], .ll-widget')) {
|
|
2148
2163
|
console.warn(
|
|
2149
|
-
`[LiveLayer] ${
|
|
2164
|
+
`[LiveLayer] ${f.type}: refusing to touch a form in a private subtree.`
|
|
2150
2165
|
);
|
|
2151
2166
|
return;
|
|
2152
2167
|
}
|
|
2153
|
-
if (
|
|
2154
|
-
const
|
|
2155
|
-
if (
|
|
2168
|
+
if (f.type === "focus_field") {
|
|
2169
|
+
const z = typeof f.fieldName == "string" ? f.fieldName : null;
|
|
2170
|
+
if (!z) {
|
|
2156
2171
|
console.warn("[LiveLayer] focus_field: missing fieldName.");
|
|
2157
2172
|
return;
|
|
2158
2173
|
}
|
|
2159
|
-
const F = M.querySelector(`[data-ll-field="${
|
|
2174
|
+
const F = M.querySelector(`[data-ll-field="${z.replace(/"/g, '\\"')}"]`);
|
|
2160
2175
|
if (!F) {
|
|
2161
2176
|
console.warn(
|
|
2162
|
-
`[LiveLayer] focus_field: no field "${
|
|
2177
|
+
`[LiveLayer] focus_field: no field "${z}" in form "${x}".`
|
|
2163
2178
|
);
|
|
2164
2179
|
return;
|
|
2165
2180
|
}
|
|
2166
2181
|
if (!tt(F)) {
|
|
2167
2182
|
console.warn(
|
|
2168
|
-
`[LiveLayer] focus_field: field "${
|
|
2183
|
+
`[LiveLayer] focus_field: field "${z}" is privacy-protected and not focusable.`
|
|
2169
2184
|
);
|
|
2170
2185
|
return;
|
|
2171
2186
|
}
|
|
2172
2187
|
F.focus();
|
|
2173
2188
|
return;
|
|
2174
2189
|
}
|
|
2175
|
-
const q =
|
|
2190
|
+
const q = f.values && typeof f.values == "object" ? f.values : null;
|
|
2176
2191
|
if (!q) {
|
|
2177
2192
|
console.warn("[LiveLayer] fill_form: missing or invalid values.");
|
|
2178
2193
|
return;
|
|
2179
2194
|
}
|
|
2180
|
-
for (const [
|
|
2195
|
+
for (const [z, F] of Object.entries(q)) {
|
|
2181
2196
|
if (typeof F != "string") continue;
|
|
2182
|
-
const
|
|
2183
|
-
if (!
|
|
2197
|
+
const U = M.querySelector(`[data-ll-field="${z.replace(/"/g, '\\"')}"]`);
|
|
2198
|
+
if (!U) {
|
|
2184
2199
|
console.warn(
|
|
2185
|
-
`[LiveLayer] fill_form: no field "${
|
|
2200
|
+
`[LiveLayer] fill_form: no field "${z}" in form "${x}". Skipping.`
|
|
2186
2201
|
);
|
|
2187
2202
|
continue;
|
|
2188
2203
|
}
|
|
2189
|
-
if (!tt(
|
|
2204
|
+
if (!tt(U)) {
|
|
2190
2205
|
console.warn(
|
|
2191
|
-
`[LiveLayer] fill_form: field "${
|
|
2206
|
+
`[LiveLayer] fill_form: field "${z}" is privacy-protected (password / cc-* / private). Skipping.`
|
|
2192
2207
|
);
|
|
2193
2208
|
continue;
|
|
2194
2209
|
}
|
|
2195
2210
|
try {
|
|
2196
|
-
|
|
2197
|
-
} catch (
|
|
2211
|
+
br(U, F);
|
|
2212
|
+
} catch (D) {
|
|
2198
2213
|
console.warn(
|
|
2199
|
-
`[LiveLayer] fill_form: failed to set "${
|
|
2200
|
-
|
|
2214
|
+
`[LiveLayer] fill_form: failed to set "${z}".`,
|
|
2215
|
+
D
|
|
2201
2216
|
);
|
|
2202
2217
|
}
|
|
2203
2218
|
}
|
|
2204
2219
|
return;
|
|
2205
2220
|
}
|
|
2206
|
-
if (
|
|
2207
|
-
if (!
|
|
2208
|
-
|
|
2221
|
+
if (f.type === "submit_form") {
|
|
2222
|
+
if (!ge("submit_forms")) {
|
|
2223
|
+
ye("submit_form", "submit_forms");
|
|
2209
2224
|
return;
|
|
2210
2225
|
}
|
|
2211
2226
|
if (typeof document > "u") return;
|
|
2212
|
-
const x = typeof
|
|
2227
|
+
const x = typeof f.formId == "string" ? f.formId : null;
|
|
2213
2228
|
if (!x) {
|
|
2214
2229
|
console.warn("[LiveLayer] submit_form: missing formId.");
|
|
2215
2230
|
return;
|
|
@@ -2229,24 +2244,24 @@ function Sr(e) {
|
|
|
2229
2244
|
);
|
|
2230
2245
|
return;
|
|
2231
2246
|
}
|
|
2232
|
-
const q = typeof
|
|
2233
|
-
const
|
|
2234
|
-
if (
|
|
2247
|
+
const q = typeof f.requestId == "string" ? f.requestId : void 0, z = (Je = le.current) == null ? void 0 : Je.call(le), F = (X) => {
|
|
2248
|
+
const K = z, Re = K == null ? void 0 : K.localParticipant;
|
|
2249
|
+
if (Re != null && Re.publishData)
|
|
2235
2250
|
try {
|
|
2236
|
-
const
|
|
2237
|
-
|
|
2251
|
+
const sn = q ? { ...X, requestId: q } : X, cn = new TextEncoder().encode(JSON.stringify(sn));
|
|
2252
|
+
Re.publishData(cn, { reliable: !0 });
|
|
2238
2253
|
} catch {
|
|
2239
2254
|
}
|
|
2240
2255
|
};
|
|
2241
|
-
let
|
|
2242
|
-
const
|
|
2243
|
-
|
|
2256
|
+
let U = !1;
|
|
2257
|
+
const D = () => {
|
|
2258
|
+
U = !0, F({ type: "form_submitted", formId: x });
|
|
2244
2259
|
};
|
|
2245
|
-
M.addEventListener("submit",
|
|
2260
|
+
M.addEventListener("submit", D, { once: !0 });
|
|
2246
2261
|
try {
|
|
2247
2262
|
typeof M.requestSubmit == "function" ? M.requestSubmit() : M.submit();
|
|
2248
|
-
} catch (
|
|
2249
|
-
console.warn("[LiveLayer] submit_form: requestSubmit threw.",
|
|
2263
|
+
} catch (X) {
|
|
2264
|
+
console.warn("[LiveLayer] submit_form: requestSubmit threw.", X), M.removeEventListener("submit", D), F({
|
|
2250
2265
|
type: "form_submit_blocked",
|
|
2251
2266
|
formId: x,
|
|
2252
2267
|
reason: "exception"
|
|
@@ -2254,7 +2269,7 @@ function Sr(e) {
|
|
|
2254
2269
|
return;
|
|
2255
2270
|
}
|
|
2256
2271
|
setTimeout(() => {
|
|
2257
|
-
|
|
2272
|
+
U || (M.removeEventListener("submit", D), F({
|
|
2258
2273
|
type: "form_submit_blocked",
|
|
2259
2274
|
formId: x,
|
|
2260
2275
|
reason: "validation"
|
|
@@ -2262,349 +2277,337 @@ function Sr(e) {
|
|
|
2262
2277
|
}, 500);
|
|
2263
2278
|
return;
|
|
2264
2279
|
}
|
|
2265
|
-
if (
|
|
2266
|
-
if (!
|
|
2267
|
-
|
|
2280
|
+
if (f.type === "request_routes") {
|
|
2281
|
+
if (!ge("read_page")) {
|
|
2282
|
+
ye("request_routes", "read_page");
|
|
2268
2283
|
return;
|
|
2269
2284
|
}
|
|
2270
|
-
const x = typeof
|
|
2271
|
-
if (!(
|
|
2272
|
-
const F = (
|
|
2285
|
+
const x = typeof f.requestId == "string" ? f.requestId : void 0, q = (Et = le.current) == null ? void 0 : Et.call(le), z = q == null ? void 0 : q.localParticipant;
|
|
2286
|
+
if (!(z != null && z.publishData)) return;
|
|
2287
|
+
const F = (D) => {
|
|
2273
2288
|
try {
|
|
2274
|
-
const
|
|
2275
|
-
|
|
2276
|
-
} catch (
|
|
2277
|
-
console.warn("[LiveLayer] request_routes: publishData failed.",
|
|
2289
|
+
const X = x ? { type: "routes", routes: D, requestId: x } : { type: "routes", routes: D }, K = new TextEncoder().encode(JSON.stringify(X));
|
|
2290
|
+
z.publishData(K, { reliable: !0 });
|
|
2291
|
+
} catch (X) {
|
|
2292
|
+
console.warn("[LiveLayer] request_routes: publishData failed.", X);
|
|
2278
2293
|
}
|
|
2279
|
-
},
|
|
2280
|
-
if (
|
|
2294
|
+
}, U = gt.current;
|
|
2295
|
+
if (U) {
|
|
2281
2296
|
try {
|
|
2282
|
-
const
|
|
2283
|
-
if (!Array.isArray(
|
|
2297
|
+
const D = U(), X = (K) => {
|
|
2298
|
+
if (!Array.isArray(K)) {
|
|
2284
2299
|
F([]);
|
|
2285
2300
|
return;
|
|
2286
2301
|
}
|
|
2287
|
-
F(
|
|
2302
|
+
F(K.map(pr).slice(0, 200));
|
|
2288
2303
|
};
|
|
2289
|
-
|
|
2304
|
+
D instanceof Promise ? D.then(X).catch((K) => {
|
|
2290
2305
|
console.warn(
|
|
2291
2306
|
"[LiveLayer] getRoutes rejected; falling back to DOM walker.",
|
|
2292
|
-
|
|
2293
|
-
), F(
|
|
2294
|
-
}) :
|
|
2295
|
-
} catch (
|
|
2307
|
+
K
|
|
2308
|
+
), F(ct());
|
|
2309
|
+
}) : X(D);
|
|
2310
|
+
} catch (D) {
|
|
2296
2311
|
console.warn(
|
|
2297
2312
|
"[LiveLayer] getRoutes threw; falling back to DOM walker.",
|
|
2298
|
-
|
|
2299
|
-
), F(
|
|
2313
|
+
D
|
|
2314
|
+
), F(ct());
|
|
2300
2315
|
}
|
|
2301
2316
|
return;
|
|
2302
2317
|
}
|
|
2303
2318
|
try {
|
|
2304
|
-
F(
|
|
2305
|
-
} catch (
|
|
2306
|
-
console.warn("[LiveLayer] request_routes: extractRoutes threw.",
|
|
2319
|
+
F(ct());
|
|
2320
|
+
} catch (D) {
|
|
2321
|
+
console.warn("[LiveLayer] request_routes: extractRoutes threw.", D);
|
|
2307
2322
|
}
|
|
2308
2323
|
return;
|
|
2309
2324
|
}
|
|
2310
|
-
|
|
2325
|
+
Sr.has(f.type) || Ce == null || Ce(f);
|
|
2311
2326
|
}
|
|
2312
2327
|
},
|
|
2313
|
-
[
|
|
2314
|
-
),
|
|
2315
|
-
agentId:
|
|
2328
|
+
[Ce, Se]
|
|
2329
|
+
), Y = gn({
|
|
2330
|
+
agentId: j ? "__controlled__" : Pe,
|
|
2316
2331
|
baseUrl: o,
|
|
2317
2332
|
apiKey: r,
|
|
2318
2333
|
sessionEndpoint: i,
|
|
2319
2334
|
sessionBody: l,
|
|
2320
|
-
onDataMessage:
|
|
2335
|
+
onDataMessage: j ? void 0 : ze
|
|
2321
2336
|
});
|
|
2322
2337
|
T(() => {
|
|
2323
|
-
if (
|
|
2324
|
-
return
|
|
2325
|
-
}, [
|
|
2326
|
-
var
|
|
2327
|
-
return (
|
|
2338
|
+
if (j != null && j.subscribeToDataMessages)
|
|
2339
|
+
return j.subscribeToDataMessages(ze);
|
|
2340
|
+
}, [j, ze]), le.current = () => {
|
|
2341
|
+
var g;
|
|
2342
|
+
return (g = Y.getRoom) == null ? void 0 : g.call(Y);
|
|
2328
2343
|
}, T(() => {
|
|
2329
|
-
var
|
|
2330
|
-
if (!fe) return;
|
|
2331
|
-
const h = (J = U.getRoom) == null ? void 0 : J.call(U), u = h == null ? void 0 : h.localParticipant;
|
|
2332
|
-
if (u != null && u.publishData)
|
|
2333
|
-
try {
|
|
2334
|
-
const Ee = new TextEncoder().encode(
|
|
2335
|
-
JSON.stringify({ type: "pathname", pathname: fe })
|
|
2336
|
-
);
|
|
2337
|
-
u.publishData(Ee, { reliable: !0 });
|
|
2338
|
-
} catch {
|
|
2339
|
-
}
|
|
2340
|
-
}, [fe, U, U.connectionState]), T(() => {
|
|
2341
|
-
var J;
|
|
2344
|
+
var Z;
|
|
2342
2345
|
if (typeof window > "u") return;
|
|
2343
|
-
const
|
|
2344
|
-
if (
|
|
2345
|
-
return window.__livelayerSimulateCommand = (
|
|
2346
|
+
const g = ((Z = window.location) == null ? void 0 : Z.hostname) || "";
|
|
2347
|
+
if (g === "localhost" || g === "127.0.0.1" || g === "0.0.0.0" || g.endsWith(".local") || g.endsWith(".test"))
|
|
2348
|
+
return window.__livelayerSimulateCommand = (Ge) => {
|
|
2346
2349
|
try {
|
|
2347
|
-
|
|
2348
|
-
} catch (
|
|
2349
|
-
console.warn("[LiveLayer] simulate-command threw:",
|
|
2350
|
+
ze(Ge);
|
|
2351
|
+
} catch (Je) {
|
|
2352
|
+
console.warn("[LiveLayer] simulate-command threw:", Je);
|
|
2350
2353
|
}
|
|
2351
2354
|
}, () => {
|
|
2352
2355
|
delete window.__livelayerSimulateCommand;
|
|
2353
2356
|
};
|
|
2354
|
-
}, [
|
|
2355
|
-
const _ = Ze(() =>
|
|
2356
|
-
connectionState:
|
|
2357
|
-
agentState:
|
|
2358
|
-
transcript:
|
|
2359
|
-
videoElement:
|
|
2360
|
-
audioElement:
|
|
2361
|
-
canResume:
|
|
2362
|
-
error:
|
|
2357
|
+
}, [ze]);
|
|
2358
|
+
const _ = Ze(() => j ? {
|
|
2359
|
+
connectionState: j.connectionState,
|
|
2360
|
+
agentState: j.agentState,
|
|
2361
|
+
transcript: j.transcript,
|
|
2362
|
+
videoElement: j.videoElement,
|
|
2363
|
+
audioElement: j.audioElement,
|
|
2364
|
+
canResume: j.canResume,
|
|
2365
|
+
error: j.error,
|
|
2363
2366
|
agentConfig: null,
|
|
2364
2367
|
connect: async () => {
|
|
2365
|
-
await
|
|
2368
|
+
await j.onConnect();
|
|
2366
2369
|
},
|
|
2367
|
-
disconnect: () =>
|
|
2370
|
+
disconnect: () => j.onDisconnect(),
|
|
2368
2371
|
// Dummy getRoom for shape compatibility — controlled consumers own the Room.
|
|
2369
2372
|
// Internal session's getRoom returns null when no real connect has happened,
|
|
2370
2373
|
// so we reuse its reference for type consistency.
|
|
2371
|
-
getRoom:
|
|
2374
|
+
getRoom: Y.getRoom,
|
|
2372
2375
|
isControlled: !0
|
|
2373
2376
|
} : {
|
|
2374
|
-
connectionState:
|
|
2375
|
-
agentState:
|
|
2376
|
-
transcript:
|
|
2377
|
-
videoElement:
|
|
2378
|
-
audioElement:
|
|
2379
|
-
canResume:
|
|
2380
|
-
error:
|
|
2381
|
-
agentConfig:
|
|
2382
|
-
connect:
|
|
2383
|
-
disconnect:
|
|
2384
|
-
getRoom:
|
|
2377
|
+
connectionState: Y.connectionState,
|
|
2378
|
+
agentState: Y.agentState,
|
|
2379
|
+
transcript: Y.transcript,
|
|
2380
|
+
videoElement: Y.videoElement,
|
|
2381
|
+
audioElement: Y.audioElement,
|
|
2382
|
+
canResume: Y.canResume,
|
|
2383
|
+
error: Y.error,
|
|
2384
|
+
agentConfig: Y.agentConfig,
|
|
2385
|
+
connect: Y.connect,
|
|
2386
|
+
disconnect: Y.disconnect,
|
|
2387
|
+
getRoom: Y.getRoom,
|
|
2385
2388
|
isControlled: !1
|
|
2386
|
-
}, [
|
|
2389
|
+
}, [j, Y]), yt = E(null);
|
|
2387
2390
|
T(() => {
|
|
2388
|
-
const
|
|
2389
|
-
if (!(!
|
|
2390
|
-
return
|
|
2391
|
-
|
|
2391
|
+
const g = _.videoElement, f = yt.current;
|
|
2392
|
+
if (!(!g || !f))
|
|
2393
|
+
return f.appendChild(g), () => {
|
|
2394
|
+
g.parentNode === f && f.removeChild(g);
|
|
2392
2395
|
};
|
|
2393
2396
|
}, [_.videoElement]), T(() => {
|
|
2394
|
-
const
|
|
2395
|
-
if (!
|
|
2396
|
-
|
|
2397
|
-
const
|
|
2398
|
-
return
|
|
2399
|
-
(
|
|
2397
|
+
const g = _.audioElement;
|
|
2398
|
+
if (!g) return;
|
|
2399
|
+
me.attach(g);
|
|
2400
|
+
const f = g.play();
|
|
2401
|
+
return f && typeof f.catch == "function" && f.catch((Z) => {
|
|
2402
|
+
(Z == null ? void 0 : Z.name) === "NotAllowedError" && $e(!0);
|
|
2400
2403
|
}), () => {
|
|
2401
|
-
|
|
2404
|
+
me.detach();
|
|
2402
2405
|
};
|
|
2403
2406
|
}, [_.audioElement]), T(() => {
|
|
2404
2407
|
if (_.isControlled || _.connectionState !== "connected") return;
|
|
2405
|
-
const
|
|
2406
|
-
if (
|
|
2407
|
-
return
|
|
2408
|
-
}),
|
|
2409
|
-
|
|
2408
|
+
const g = _.getRoom();
|
|
2409
|
+
if (g)
|
|
2410
|
+
return Q.setupMic(g).catch(() => {
|
|
2411
|
+
}), ie.attachRoom(g), we.attachRoom(g), De.refresh(), () => {
|
|
2412
|
+
Q.teardownMic(), ie.teardown(), we.teardown();
|
|
2410
2413
|
};
|
|
2411
2414
|
}, [_.isControlled, _.connectionState]), T(() => {
|
|
2412
|
-
const
|
|
2413
|
-
|
|
2415
|
+
const g = _.audioElement;
|
|
2416
|
+
g && (g.muted = nt);
|
|
2414
2417
|
}, [_.audioElement, nt]);
|
|
2415
|
-
const
|
|
2416
|
-
const
|
|
2417
|
-
if (
|
|
2418
|
+
const Jt = k((g) => {
|
|
2419
|
+
const f = _.getRoom();
|
|
2420
|
+
if (f)
|
|
2418
2421
|
try {
|
|
2419
|
-
const
|
|
2420
|
-
JSON.stringify({ type: "user_message", text:
|
|
2422
|
+
const Z = new TextEncoder().encode(
|
|
2423
|
+
JSON.stringify({ type: "user_message", text: g })
|
|
2421
2424
|
);
|
|
2422
|
-
|
|
2425
|
+
f.localParticipant.publishData(Z, { reliable: !0 });
|
|
2423
2426
|
} catch {
|
|
2424
2427
|
}
|
|
2425
|
-
}, [_]),
|
|
2426
|
-
Gt((
|
|
2428
|
+
}, [_]), Kt = k(() => {
|
|
2429
|
+
Gt((g) => !g);
|
|
2427
2430
|
}, []);
|
|
2428
2431
|
T(() => {
|
|
2429
|
-
|
|
2430
|
-
}, [_.connectionState,
|
|
2431
|
-
|
|
2432
|
-
}, [_.transcript,
|
|
2433
|
-
|
|
2434
|
-
}, [_.agentState,
|
|
2432
|
+
Le == null || Le(_.connectionState), _.connectionState === "connected" ? ce == null || ce() : _.connectionState === "disconnected" && (_e == null || _e());
|
|
2433
|
+
}, [_.connectionState, ce, _e, Le]), T(() => {
|
|
2434
|
+
xe == null || xe(_.transcript);
|
|
2435
|
+
}, [_.transcript, xe]), T(() => {
|
|
2436
|
+
ke == null || ke(_.agentState);
|
|
2437
|
+
}, [_.agentState, ke]);
|
|
2435
2438
|
const vt = E(!1);
|
|
2436
2439
|
T(() => {
|
|
2437
|
-
_.isControlled || !
|
|
2438
|
-
}, [
|
|
2440
|
+
_.isControlled || !c || vt.current || he && _.connectionState === "idle" && (vt.current = !0, _.connect());
|
|
2441
|
+
}, [c, _.connectionState, _, he]);
|
|
2439
2442
|
const Qt = k(
|
|
2440
|
-
(
|
|
2441
|
-
const
|
|
2442
|
-
|
|
2443
|
+
(g) => {
|
|
2444
|
+
const f = C == null ? void 0 : C.find((Z) => Z.id === g);
|
|
2445
|
+
f && (Ye(!1), g !== be && (y(!0), _.disconnect(), de || Ne(g), v == null || v(f)));
|
|
2443
2446
|
},
|
|
2444
2447
|
[
|
|
2445
2448
|
C,
|
|
2446
|
-
|
|
2449
|
+
be,
|
|
2447
2450
|
_,
|
|
2448
|
-
|
|
2451
|
+
de,
|
|
2449
2452
|
v
|
|
2450
2453
|
]
|
|
2451
2454
|
);
|
|
2452
2455
|
T(() => {
|
|
2453
|
-
|
|
2454
|
-
}, [_.connectionState,
|
|
2455
|
-
if (!
|
|
2456
|
-
const
|
|
2457
|
-
|
|
2456
|
+
Ae && _.connectionState === "connected" && y(!1);
|
|
2457
|
+
}, [_.connectionState, Ae]), T(() => {
|
|
2458
|
+
if (!J) return;
|
|
2459
|
+
const g = (f) => {
|
|
2460
|
+
f.key === "Escape" && Ye(!1);
|
|
2458
2461
|
};
|
|
2459
|
-
return window.addEventListener("keydown",
|
|
2460
|
-
}, [
|
|
2461
|
-
const Zt = !!I || !!(
|
|
2462
|
-
|
|
2463
|
-
const
|
|
2462
|
+
return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
|
|
2463
|
+
}, [J]);
|
|
2464
|
+
const Zt = !!I || !!(G != null && G.avatarImageUrl) || _.isControlled, He = kn(Pe, o, Zt);
|
|
2465
|
+
re === void 0 && ((wt = He.info) != null && wt.capabilities) && (at.current = He.info.capabilities);
|
|
2466
|
+
const Xe = (G == null ? void 0 : G.name) ?? O ?? ((_t = _.agentConfig) == null ? void 0 : _t.name) ?? ((xt = He.info) == null ? void 0 : xt.name) ?? "Live Layer", st = (G == null ? void 0 : G.avatarImageUrl) ?? I ?? ((kt = _.agentConfig) == null ? void 0 : kt.avatarImageUrl) ?? ((Lt = He.info) == null ? void 0 : Lt.avatarImageUrl) ?? null, en = b ?? ((St = _.agentConfig) == null ? void 0 : St.idleLoopUrl) ?? ((Ct = He.info) == null ? void 0 : Ct.idleLoopUrl) ?? null, tn = H ?? null, nn = k(() => ee("expanded"), [ee]), rn = k(
|
|
2464
2467
|
() => ee("minimized"),
|
|
2465
2468
|
[ee]
|
|
2466
2469
|
), bt = k(() => {
|
|
2467
2470
|
_.disconnect(), ee("hidden");
|
|
2468
2471
|
}, [_, ee]), on = k(() => {
|
|
2469
|
-
const
|
|
2470
|
-
|
|
2472
|
+
const g = _.audioElement;
|
|
2473
|
+
g && g.play().then(() => $e(!1)).catch(() => {
|
|
2471
2474
|
});
|
|
2472
2475
|
}, [_.audioElement]), ln = k(() => {
|
|
2473
|
-
|
|
2474
|
-
}, [_]),
|
|
2475
|
-
...
|
|
2476
|
-
zIndex:
|
|
2476
|
+
$e(!1), _.connect();
|
|
2477
|
+
}, [_]), Oe = {
|
|
2478
|
+
...Fe,
|
|
2479
|
+
zIndex: Ue
|
|
2477
2480
|
};
|
|
2478
|
-
p.primaryColor && (
|
|
2481
|
+
p.primaryColor && (Oe["--ll-color-primary"] = p.primaryColor), p.accentColor && (Oe["--ll-color-accent"] = p.accentColor), p.backgroundColor && (Oe["--ll-color-bg"] = p.backgroundColor), p.textColor && (Oe["--ll-color-fg"] = p.textColor);
|
|
2479
2482
|
const an = [
|
|
2480
2483
|
"ll-widget",
|
|
2481
|
-
`ll-widget--${
|
|
2482
|
-
`ll-widget--${
|
|
2483
|
-
|
|
2484
|
+
`ll-widget--${oe}`,
|
|
2485
|
+
`ll-widget--${ue ? "mobile" : "desktop"}`,
|
|
2486
|
+
We
|
|
2484
2487
|
].filter(Boolean).join(" ");
|
|
2485
|
-
return
|
|
2488
|
+
return he ? /* @__PURE__ */ w(
|
|
2486
2489
|
"div",
|
|
2487
2490
|
{
|
|
2488
2491
|
className: an,
|
|
2489
|
-
style:
|
|
2490
|
-
"data-display-mode":
|
|
2491
|
-
"data-position":
|
|
2492
|
+
style: Oe,
|
|
2493
|
+
"data-display-mode": oe,
|
|
2494
|
+
"data-position": h,
|
|
2492
2495
|
children: [
|
|
2493
|
-
|
|
2496
|
+
oe === "hidden" && /* @__PURE__ */ n(
|
|
2494
2497
|
Vn,
|
|
2495
2498
|
{
|
|
2496
|
-
position:
|
|
2497
|
-
isMobile:
|
|
2499
|
+
position: h,
|
|
2500
|
+
isMobile: ue,
|
|
2498
2501
|
isSpeaking: _.agentState === "speaking",
|
|
2499
2502
|
onExpand: () => ee("expanded"),
|
|
2500
|
-
label: `Open ${
|
|
2501
|
-
avatarImageUrl:
|
|
2502
|
-
agentName:
|
|
2503
|
+
label: `Open ${Xe} widget`,
|
|
2504
|
+
avatarImageUrl: st,
|
|
2505
|
+
agentName: Xe
|
|
2503
2506
|
}
|
|
2504
2507
|
),
|
|
2505
|
-
|
|
2506
|
-
|
|
2508
|
+
oe === "minimized" && /* @__PURE__ */ n(
|
|
2509
|
+
Xn,
|
|
2507
2510
|
{
|
|
2508
|
-
position:
|
|
2509
|
-
isMobile:
|
|
2510
|
-
agentName:
|
|
2511
|
-
avatarImageUrl:
|
|
2511
|
+
position: h,
|
|
2512
|
+
isMobile: ue,
|
|
2513
|
+
agentName: Xe,
|
|
2514
|
+
avatarImageUrl: st,
|
|
2512
2515
|
agentState: _.agentState,
|
|
2513
|
-
isMuted:
|
|
2514
|
-
audioLevel:
|
|
2516
|
+
isMuted: Q.isMuted,
|
|
2517
|
+
audioLevel: me,
|
|
2515
2518
|
onExpand: nn,
|
|
2516
|
-
onToggleMute:
|
|
2519
|
+
onToggleMute: Q.toggleMute,
|
|
2517
2520
|
onClose: bt
|
|
2518
2521
|
}
|
|
2519
2522
|
),
|
|
2520
|
-
|
|
2521
|
-
|
|
2523
|
+
oe === "expanded" && /* @__PURE__ */ n(
|
|
2524
|
+
Jn,
|
|
2522
2525
|
{
|
|
2523
|
-
position:
|
|
2524
|
-
isMobile:
|
|
2525
|
-
agentName:
|
|
2526
|
-
avatarImageUrl:
|
|
2526
|
+
position: h,
|
|
2527
|
+
isMobile: ue,
|
|
2528
|
+
agentName: Xe,
|
|
2529
|
+
avatarImageUrl: st,
|
|
2527
2530
|
idleLoopUrl: en,
|
|
2528
2531
|
greeting: tn,
|
|
2529
2532
|
branding: p,
|
|
2530
2533
|
teamMembers: C,
|
|
2531
|
-
currentTeamMemberId:
|
|
2532
|
-
isSwitchingTeamMember:
|
|
2533
|
-
teamSwitcherOpen:
|
|
2534
|
-
onToggleTeamSwitcher: () =>
|
|
2534
|
+
currentTeamMemberId: be,
|
|
2535
|
+
isSwitchingTeamMember: Ae,
|
|
2536
|
+
teamSwitcherOpen: J,
|
|
2537
|
+
onToggleTeamSwitcher: () => Ye((g) => !g),
|
|
2535
2538
|
onSelectTeamMember: Qt,
|
|
2536
2539
|
connectionState: _.connectionState,
|
|
2537
2540
|
agentState: _.agentState,
|
|
2538
2541
|
transcript: _.transcript,
|
|
2539
|
-
isMuted:
|
|
2540
|
-
micDevices:
|
|
2541
|
-
isCameraEnabled:
|
|
2542
|
-
cameraPreviewEl:
|
|
2543
|
-
cameraDevices:
|
|
2544
|
-
activeCameraId:
|
|
2545
|
-
isScreenShareEnabled:
|
|
2546
|
-
screenPreviewEl:
|
|
2542
|
+
isMuted: Q.isMuted,
|
|
2543
|
+
micDevices: De.mics,
|
|
2544
|
+
isCameraEnabled: ie.isEnabled,
|
|
2545
|
+
cameraPreviewEl: ie.previewEl,
|
|
2546
|
+
cameraDevices: De.cameras,
|
|
2547
|
+
activeCameraId: ie.activeDeviceId,
|
|
2548
|
+
isScreenShareEnabled: we.isEnabled,
|
|
2549
|
+
screenPreviewEl: we.previewEl,
|
|
2547
2550
|
isSpeakerMuted: nt,
|
|
2548
2551
|
allowCamera: N,
|
|
2549
2552
|
allowScreenShare: B,
|
|
2550
|
-
allowTyping:
|
|
2553
|
+
allowTyping: $,
|
|
2551
2554
|
languageMenuOpen: Yt,
|
|
2552
|
-
onToggleLanguageMenu: () =>
|
|
2553
|
-
needsUserGesture:
|
|
2555
|
+
onToggleLanguageMenu: () => Xt((g) => !g),
|
|
2556
|
+
needsUserGesture: Ve,
|
|
2554
2557
|
canResume: _.canResume,
|
|
2555
|
-
micError:
|
|
2558
|
+
micError: Q.micError,
|
|
2556
2559
|
error: _.error,
|
|
2557
2560
|
avatarVideoContainerRef: yt,
|
|
2558
2561
|
onConnect: () => void _.connect(),
|
|
2559
2562
|
onDisconnect: () => _.disconnect(),
|
|
2560
2563
|
onRetry: ln,
|
|
2561
2564
|
onResumeAudio: on,
|
|
2562
|
-
onToggleMute:
|
|
2563
|
-
onToggleCamera: () => void
|
|
2564
|
-
onSwitchCameraDevice: (
|
|
2565
|
-
onToggleScreenShare: () => void
|
|
2566
|
-
onToggleSpeaker:
|
|
2567
|
-
onSendMessage:
|
|
2565
|
+
onToggleMute: Q.toggleMute,
|
|
2566
|
+
onToggleCamera: () => void ie.toggle(),
|
|
2567
|
+
onSwitchCameraDevice: (g) => void ie.switchDevice(g),
|
|
2568
|
+
onToggleScreenShare: () => void we.toggle(),
|
|
2569
|
+
onToggleSpeaker: Kt,
|
|
2570
|
+
onSendMessage: Jt,
|
|
2568
2571
|
onMinimize: rn,
|
|
2569
2572
|
onClose: bt,
|
|
2570
|
-
onClearMicError:
|
|
2573
|
+
onClearMicError: Q.clearError
|
|
2571
2574
|
}
|
|
2572
2575
|
)
|
|
2573
2576
|
]
|
|
2574
2577
|
}
|
|
2575
2578
|
) : null;
|
|
2576
2579
|
}
|
|
2577
|
-
function
|
|
2578
|
-
return /* @__PURE__ */ n(mn, { children: /* @__PURE__ */ n(
|
|
2580
|
+
function Pr(e) {
|
|
2581
|
+
return /* @__PURE__ */ n(mn, { children: /* @__PURE__ */ n(Cr, { ...e }) });
|
|
2579
2582
|
}
|
|
2580
|
-
const
|
|
2583
|
+
const Dr = ({
|
|
2581
2584
|
agentId: e,
|
|
2582
2585
|
baseUrl: t,
|
|
2583
2586
|
apiKey: r,
|
|
2584
2587
|
mode: o,
|
|
2585
2588
|
onAgentEvent: i,
|
|
2586
2589
|
className: l,
|
|
2587
|
-
style:
|
|
2590
|
+
style: c
|
|
2588
2591
|
}) => {
|
|
2589
|
-
const d = E(null),
|
|
2590
|
-
|
|
2591
|
-
const
|
|
2592
|
+
const d = E(null), u = E(null), m = E(i);
|
|
2593
|
+
m.current = i;
|
|
2594
|
+
const h = k((a) => {
|
|
2592
2595
|
var R;
|
|
2593
|
-
const
|
|
2594
|
-
(R =
|
|
2596
|
+
const s = a.detail;
|
|
2597
|
+
(R = m.current) == null || R.call(m, s);
|
|
2595
2598
|
}, []);
|
|
2596
2599
|
return T(() => {
|
|
2597
2600
|
const a = d.current;
|
|
2598
2601
|
if (!a) return;
|
|
2599
|
-
const
|
|
2600
|
-
return
|
|
2601
|
-
|
|
2602
|
+
const s = document.createElement("livelayer-widget");
|
|
2603
|
+
return s.setAttribute("agent-id", e), t && s.setAttribute("base-url", t), r && s.setAttribute("api-key", r), o && s.setAttribute("mode", o), s.addEventListener("agent-event", h), a.appendChild(s), u.current = s, () => {
|
|
2604
|
+
s.removeEventListener("agent-event", h), a.removeChild(s), u.current = null;
|
|
2602
2605
|
};
|
|
2603
2606
|
}, [e]), T(() => {
|
|
2604
|
-
|
|
2605
|
-
}, [o]), /* @__PURE__ */ n("div", { ref: d, className: l, style:
|
|
2606
|
-
},
|
|
2607
|
-
function({ id: t, intent: r, as: o = "div", className: i, style: l, children:
|
|
2607
|
+
u.current && (o ? u.current.setAttribute("mode", o) : u.current.removeAttribute("mode"));
|
|
2608
|
+
}, [o]), /* @__PURE__ */ n("div", { ref: d, className: l, style: c });
|
|
2609
|
+
}, $r = ft(
|
|
2610
|
+
function({ id: t, intent: r, as: o = "div", className: i, style: l, children: c }, d) {
|
|
2608
2611
|
return un(
|
|
2609
2612
|
o,
|
|
2610
2613
|
{
|
|
@@ -2614,10 +2617,10 @@ const Pr = ({
|
|
|
2614
2617
|
className: i,
|
|
2615
2618
|
style: l
|
|
2616
2619
|
},
|
|
2617
|
-
|
|
2620
|
+
c
|
|
2618
2621
|
);
|
|
2619
2622
|
}
|
|
2620
|
-
),
|
|
2623
|
+
), zr = ft(
|
|
2621
2624
|
function({ id: t, intent: r, children: o, ...i }, l) {
|
|
2622
2625
|
return /* @__PURE__ */ n(
|
|
2623
2626
|
"form",
|
|
@@ -2630,39 +2633,39 @@ const Pr = ({
|
|
|
2630
2633
|
}
|
|
2631
2634
|
);
|
|
2632
2635
|
}
|
|
2633
|
-
),
|
|
2636
|
+
), Hr = ft(
|
|
2634
2637
|
function(t, r) {
|
|
2635
|
-
const { name: o, label: i, labelClassName: l } = t,
|
|
2638
|
+
const { name: o, label: i, labelClassName: l } = t, c = { name: o, "data-ll-field": o };
|
|
2636
2639
|
let d;
|
|
2637
2640
|
if ("as" in t && t.as === "textarea") {
|
|
2638
|
-
const { name:
|
|
2641
|
+
const { name: u, label: m, labelClassName: h, as: a, ...s } = t;
|
|
2639
2642
|
d = /* @__PURE__ */ n(
|
|
2640
2643
|
"textarea",
|
|
2641
2644
|
{
|
|
2642
2645
|
ref: r,
|
|
2643
|
-
...
|
|
2644
|
-
...
|
|
2646
|
+
...c,
|
|
2647
|
+
...s
|
|
2645
2648
|
}
|
|
2646
2649
|
);
|
|
2647
2650
|
} else if ("as" in t && t.as === "select") {
|
|
2648
|
-
const { name:
|
|
2651
|
+
const { name: u, label: m, labelClassName: h, as: a, children: s, ...R } = t;
|
|
2649
2652
|
d = /* @__PURE__ */ n(
|
|
2650
2653
|
"select",
|
|
2651
2654
|
{
|
|
2652
2655
|
ref: r,
|
|
2653
|
-
...
|
|
2656
|
+
...c,
|
|
2654
2657
|
...R,
|
|
2655
|
-
children:
|
|
2658
|
+
children: s
|
|
2656
2659
|
}
|
|
2657
2660
|
);
|
|
2658
2661
|
} else {
|
|
2659
|
-
const { name:
|
|
2662
|
+
const { name: u, label: m, labelClassName: h, as: a, ...s } = t;
|
|
2660
2663
|
d = /* @__PURE__ */ n(
|
|
2661
2664
|
"input",
|
|
2662
2665
|
{
|
|
2663
2666
|
ref: r,
|
|
2664
|
-
...
|
|
2665
|
-
...
|
|
2667
|
+
...c,
|
|
2668
|
+
...s
|
|
2666
2669
|
}
|
|
2667
2670
|
);
|
|
2668
2671
|
}
|
|
@@ -2673,13 +2676,13 @@ const Pr = ({
|
|
|
2673
2676
|
}
|
|
2674
2677
|
);
|
|
2675
2678
|
let Ut = 1;
|
|
2676
|
-
function
|
|
2679
|
+
function Or({
|
|
2677
2680
|
onMount: e,
|
|
2678
2681
|
defaultOpen: t = !1,
|
|
2679
2682
|
storageKey: r = "ll-debug-open"
|
|
2680
2683
|
}) {
|
|
2681
|
-
const [o, i] = S(t), [l,
|
|
2682
|
-
R.current =
|
|
2684
|
+
const [o, i] = S(t), [l, c] = S([]), [d, u] = S(""), [m, h] = S(!1), a = E(/* @__PURE__ */ new Set()), s = E([]), R = E(m);
|
|
2685
|
+
R.current = m, T(() => {
|
|
2683
2686
|
try {
|
|
2684
2687
|
const v = localStorage.getItem(r);
|
|
2685
2688
|
v === "1" && i(!0), v === "0" && i(!1);
|
|
@@ -2692,15 +2695,15 @@ function Hr({
|
|
|
2692
2695
|
}
|
|
2693
2696
|
}, [o, r]), T(() => {
|
|
2694
2697
|
const v = (b) => {
|
|
2695
|
-
(b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(), i((
|
|
2698
|
+
(b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(), i((H) => !H));
|
|
2696
2699
|
};
|
|
2697
2700
|
return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
|
|
2698
2701
|
}, []), T(() => {
|
|
2699
2702
|
const v = setInterval(() => {
|
|
2700
|
-
if (
|
|
2701
|
-
const b =
|
|
2702
|
-
|
|
2703
|
-
(
|
|
2703
|
+
if (s.current.length === 0 || R.current) return;
|
|
2704
|
+
const b = s.current.splice(0, s.current.length);
|
|
2705
|
+
c(
|
|
2706
|
+
(H) => [...b.reverse(), ...H].slice(0, 200)
|
|
2704
2707
|
);
|
|
2705
2708
|
}, 100);
|
|
2706
2709
|
return () => clearInterval(v);
|
|
@@ -2708,7 +2711,7 @@ function Hr({
|
|
|
2708
2711
|
const C = E(!1);
|
|
2709
2712
|
if (T(() => {
|
|
2710
2713
|
!e || C.current || (C.current = !0, e((v) => {
|
|
2711
|
-
|
|
2714
|
+
s.current.push({
|
|
2712
2715
|
id: Ut++,
|
|
2713
2716
|
ts: Date.now(),
|
|
2714
2717
|
kind: "event",
|
|
@@ -2717,21 +2720,21 @@ function Hr({
|
|
|
2717
2720
|
});
|
|
2718
2721
|
}));
|
|
2719
2722
|
}, [e]), T(() => {
|
|
2720
|
-
const v = console.warn, b = console.log,
|
|
2723
|
+
const v = console.warn, b = console.log, H = (I, O) => function(...p) {
|
|
2721
2724
|
try {
|
|
2722
2725
|
const N = typeof p[0] == "string" ? p[0] : "";
|
|
2723
|
-
N.startsWith("[LiveLayer]") &&
|
|
2726
|
+
N.startsWith("[LiveLayer]") && s.current.push({
|
|
2724
2727
|
id: Ut++,
|
|
2725
2728
|
ts: Date.now(),
|
|
2726
2729
|
kind: I,
|
|
2727
2730
|
type: N.slice(0, 120),
|
|
2728
|
-
data: { args: p.slice(1).map((B) =>
|
|
2731
|
+
data: { args: p.slice(1).map((B) => Nr(B)) }
|
|
2729
2732
|
});
|
|
2730
2733
|
} catch {
|
|
2731
2734
|
}
|
|
2732
|
-
return
|
|
2735
|
+
return O.apply(this, p);
|
|
2733
2736
|
};
|
|
2734
|
-
return console.warn =
|
|
2737
|
+
return console.warn = H("warn", v), console.log = H("log", b), () => {
|
|
2735
2738
|
console.warn = v, console.log = b;
|
|
2736
2739
|
};
|
|
2737
2740
|
}, []), !o)
|
|
@@ -2811,10 +2814,10 @@ function Hr({
|
|
|
2811
2814
|
"button",
|
|
2812
2815
|
{
|
|
2813
2816
|
type: "button",
|
|
2814
|
-
onClick: () =>
|
|
2815
|
-
style: dt(
|
|
2817
|
+
onClick: () => h((v) => !v),
|
|
2818
|
+
style: dt(m ? "#f59e0b" : "transparent"),
|
|
2816
2819
|
title: "Pause / resume capture",
|
|
2817
|
-
children:
|
|
2820
|
+
children: m ? "▶ resume" : "⏸ pause"
|
|
2818
2821
|
}
|
|
2819
2822
|
),
|
|
2820
2823
|
/* @__PURE__ */ n(
|
|
@@ -2822,7 +2825,7 @@ function Hr({
|
|
|
2822
2825
|
{
|
|
2823
2826
|
type: "button",
|
|
2824
2827
|
onClick: () => {
|
|
2825
|
-
|
|
2828
|
+
c([]), s.current = [];
|
|
2826
2829
|
},
|
|
2827
2830
|
style: dt("transparent"),
|
|
2828
2831
|
title: "Clear buffer",
|
|
@@ -2848,7 +2851,7 @@ function Hr({
|
|
|
2848
2851
|
{
|
|
2849
2852
|
type: "text",
|
|
2850
2853
|
value: d,
|
|
2851
|
-
onChange: (v) =>
|
|
2854
|
+
onChange: (v) => u(v.target.value),
|
|
2852
2855
|
placeholder: "filter by type or data…",
|
|
2853
2856
|
style: {
|
|
2854
2857
|
margin: 8,
|
|
@@ -2901,12 +2904,12 @@ function Hr({
|
|
|
2901
2904
|
]
|
|
2902
2905
|
}
|
|
2903
2906
|
) : L.map((v) => /* @__PURE__ */ n(
|
|
2904
|
-
|
|
2907
|
+
Er,
|
|
2905
2908
|
{
|
|
2906
2909
|
entry: v,
|
|
2907
2910
|
expanded: a.current.has(v.id),
|
|
2908
2911
|
onToggle: () => {
|
|
2909
|
-
a.current.has(v.id) ? a.current.delete(v.id) : a.current.add(v.id),
|
|
2912
|
+
a.current.has(v.id) ? a.current.delete(v.id) : a.current.add(v.id), c((b) => [...b]);
|
|
2910
2913
|
}
|
|
2911
2914
|
},
|
|
2912
2915
|
v.id
|
|
@@ -2917,7 +2920,7 @@ function Hr({
|
|
|
2917
2920
|
}
|
|
2918
2921
|
);
|
|
2919
2922
|
}
|
|
2920
|
-
function
|
|
2923
|
+
function Er({
|
|
2921
2924
|
entry: e,
|
|
2922
2925
|
expanded: t,
|
|
2923
2926
|
onToggle: r
|
|
@@ -2998,20 +3001,20 @@ function dt(e) {
|
|
|
2998
3001
|
cursor: "pointer"
|
|
2999
3002
|
};
|
|
3000
3003
|
}
|
|
3001
|
-
function
|
|
3004
|
+
function Nr(e) {
|
|
3002
3005
|
try {
|
|
3003
3006
|
return e instanceof Error ? { message: e.message, stack: e.stack } : (JSON.stringify(e), e);
|
|
3004
3007
|
} catch {
|
|
3005
3008
|
return String(e);
|
|
3006
3009
|
}
|
|
3007
3010
|
}
|
|
3008
|
-
function
|
|
3011
|
+
function qr() {
|
|
3009
3012
|
const [e, t] = S([]), r = k((i) => {
|
|
3010
3013
|
t((l) => {
|
|
3011
|
-
const
|
|
3012
|
-
if (
|
|
3014
|
+
const c = l.findIndex((d) => d.id === i.id);
|
|
3015
|
+
if (c >= 0) {
|
|
3013
3016
|
const d = l.slice();
|
|
3014
|
-
return d[
|
|
3017
|
+
return d[c] = i, d;
|
|
3015
3018
|
}
|
|
3016
3019
|
return [...l, i];
|
|
3017
3020
|
});
|
|
@@ -3024,21 +3027,21 @@ function Or() {
|
|
|
3024
3027
|
};
|
|
3025
3028
|
}
|
|
3026
3029
|
export {
|
|
3027
|
-
|
|
3030
|
+
Pr as AvatarWidget,
|
|
3028
3031
|
mn as ErrorBoundary,
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3032
|
+
Or as LiveLayerDebugPanel,
|
|
3033
|
+
Hr as LiveLayerField,
|
|
3034
|
+
zr as LiveLayerForm,
|
|
3035
|
+
$r as LiveLayerRegion,
|
|
3036
|
+
Dr as LiveLayerWidget,
|
|
3037
|
+
ur as clearPageContextCache,
|
|
3038
|
+
yr as clearRoutesCache,
|
|
3039
|
+
dr as extractPageContext,
|
|
3040
|
+
mr as extractRoutes,
|
|
3038
3041
|
Wt as getCachedPageContext,
|
|
3039
|
-
|
|
3042
|
+
ct as getCachedRoutes,
|
|
3040
3043
|
Hn as matchesPattern,
|
|
3041
|
-
|
|
3044
|
+
pr as normalizeRouteInput,
|
|
3042
3045
|
On as shouldRenderAtPath,
|
|
3043
3046
|
kn as useAgentInfo,
|
|
3044
3047
|
yn as useAudioLevel,
|
|
@@ -3052,5 +3055,5 @@ export {
|
|
|
3052
3055
|
Tn as usePathname,
|
|
3053
3056
|
qn as useRouteMatch,
|
|
3054
3057
|
_n as useScreenShareState,
|
|
3055
|
-
|
|
3058
|
+
qr as useTranscript
|
|
3056
3059
|
};
|