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