@livelayer/react 0.5.23 → 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 +1389 -1291
- 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 });
|
|
@@ -13,12 +13,12 @@ class wn extends mn {
|
|
|
13
13
|
return { hasError: !0, error: t };
|
|
14
14
|
}
|
|
15
15
|
componentDidCatch(t, r) {
|
|
16
|
-
var
|
|
17
|
-
(
|
|
16
|
+
var o, i;
|
|
17
|
+
(i = (o = this.props).onError) == null || i.call(o, t, r);
|
|
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
|
-
|
|
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
|
-
onAgentStateChange:
|
|
44
|
-
onTranscript: (
|
|
43
|
+
onAgentStateChange: i,
|
|
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,41 +73,41 @@ 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
|
-
}, []),
|
|
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,
|
|
93
|
-
agentState:
|
|
93
|
+
agentState: o,
|
|
94
94
|
transcript: l,
|
|
95
95
|
agentConfig: u,
|
|
96
96
|
videoElement: y,
|
|
97
97
|
audioElement: s,
|
|
98
|
-
canResume:
|
|
98
|
+
canResume: L,
|
|
99
99
|
error: C,
|
|
100
|
-
connect:
|
|
101
|
-
disconnect:
|
|
100
|
+
connect: $,
|
|
101
|
+
disconnect: U,
|
|
102
102
|
getRoom: m,
|
|
103
|
-
session:
|
|
103
|
+
session: _.current
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
const e = A(null), t = A(null), r = A(null),
|
|
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;
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
113
|
(!l.current || l.current.length !== s.frequencyBinCount) && (l.current = new Uint8Array(
|
|
@@ -115,21 +115,21 @@ function xn() {
|
|
|
115
115
|
));
|
|
116
116
|
const a = l.current;
|
|
117
117
|
s.getByteFrequencyData(a);
|
|
118
|
-
let
|
|
119
|
-
for (let C = 0; C < a.length; C++)
|
|
120
|
-
const
|
|
121
|
-
for (const C of
|
|
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
|
-
C(
|
|
123
|
+
C(D);
|
|
124
124
|
} catch (v) {
|
|
125
125
|
console.error("[useAudioLevel] subscriber threw:", v);
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
}, []), u =
|
|
127
|
+
o.current = requestAnimationFrame(d);
|
|
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) {
|
|
@@ -146,22 +146,22 @@ function xn() {
|
|
|
146
146
|
console.warn("[useAudioLevel] createMediaElementSource failed:", a);
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
|
-
|
|
149
|
+
o.current === null && (o.current = requestAnimationFrame(d));
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
|
-
[u,
|
|
153
|
-
), y =
|
|
154
|
-
if (
|
|
152
|
+
[u, d]
|
|
153
|
+
), y = S(() => {
|
|
154
|
+
if (o.current !== null && (cancelAnimationFrame(o.current), o.current = null), r.current) {
|
|
155
155
|
try {
|
|
156
156
|
r.current.disconnect();
|
|
157
157
|
} catch {
|
|
158
158
|
}
|
|
159
159
|
r.current = null;
|
|
160
160
|
}
|
|
161
|
-
}, []),
|
|
162
|
-
|
|
161
|
+
}, []), w = S((s) => (i.current.add(s), () => {
|
|
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();
|
|
@@ -176,40 +176,40 @@ function xn() {
|
|
|
176
176
|
}
|
|
177
177
|
e.current = null;
|
|
178
178
|
}
|
|
179
|
-
|
|
180
|
-
}, [y]), { attach: f, detach: y, subscribe:
|
|
179
|
+
i.current.clear(), l.current = null;
|
|
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
|
-
if (
|
|
185
|
+
if (i.current && l.current) {
|
|
186
186
|
try {
|
|
187
|
-
await l.current.localParticipant.unpublishTrack(
|
|
187
|
+
await l.current.localParticipant.unpublishTrack(i.current);
|
|
188
188
|
} catch {
|
|
189
189
|
}
|
|
190
|
-
|
|
190
|
+
i.current.stop(), i.current = null;
|
|
191
191
|
}
|
|
192
|
-
l.current = s,
|
|
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
|
|
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 =
|
|
206
|
-
const s =
|
|
205
|
+
), u = S(() => {
|
|
206
|
+
const s = i.current;
|
|
207
207
|
s && (s.isMuted ? (s.unmute(), t(!1)) : (s.mute(), t(!0)));
|
|
208
|
-
}, []), f =
|
|
209
|
-
const a =
|
|
208
|
+
}, []), f = S((s) => {
|
|
209
|
+
const a = i.current;
|
|
210
210
|
a && (s && !a.isMuted ? (a.mute(), t(!0)) : !s && a.isMuted && (a.unmute(), t(!1)));
|
|
211
|
-
}, []), y =
|
|
212
|
-
const s =
|
|
211
|
+
}, []), y = S(() => {
|
|
212
|
+
const s = i.current, a = l.current;
|
|
213
213
|
if (s && a) {
|
|
214
214
|
try {
|
|
215
215
|
a.localParticipant.unpublishTrack(s);
|
|
@@ -217,85 +217,85 @@ function kn() {
|
|
|
217
217
|
}
|
|
218
218
|
s.stop();
|
|
219
219
|
}
|
|
220
|
-
|
|
221
|
-
}, []),
|
|
220
|
+
i.current = null, l.current = null, t(!1);
|
|
221
|
+
}, []), w = S(() => o(null), []);
|
|
222
222
|
return {
|
|
223
223
|
isMuted: e,
|
|
224
224
|
micError: r,
|
|
225
225
|
toggleMute: u,
|
|
226
226
|
setMuted: f,
|
|
227
|
-
setupMic:
|
|
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 (
|
|
239
|
-
const
|
|
240
|
-
if (
|
|
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
|
+
if ($ != null && $.track) {
|
|
241
241
|
try {
|
|
242
|
-
|
|
242
|
+
_.localParticipant.unpublishTrack($.track);
|
|
243
243
|
} catch {
|
|
244
244
|
}
|
|
245
|
-
|
|
245
|
+
$.track.stop();
|
|
246
246
|
} else
|
|
247
|
-
|
|
247
|
+
O.stop();
|
|
248
248
|
}
|
|
249
249
|
y.current = null, l(null), t(!1);
|
|
250
|
-
}, []), a =
|
|
251
|
-
const
|
|
252
|
-
if (
|
|
253
|
-
|
|
250
|
+
}, []), a = S(async (_) => {
|
|
251
|
+
const O = f.current;
|
|
252
|
+
if (O) {
|
|
253
|
+
o(null);
|
|
254
254
|
try {
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
const
|
|
258
|
-
await
|
|
259
|
-
const m =
|
|
260
|
-
l(m), t(!0),
|
|
255
|
+
const $ = { ...Cn };
|
|
256
|
+
_ && ($.deviceId = _);
|
|
257
|
+
const U = await xn($);
|
|
258
|
+
await O.localParticipant.publishTrack(U), y.current = U;
|
|
259
|
+
const m = U.attach();
|
|
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" })),
|
|
264
264
|
{ reliable: !0 }
|
|
265
265
|
);
|
|
266
266
|
} catch {
|
|
267
267
|
}
|
|
268
|
-
} catch (
|
|
269
|
-
const
|
|
270
|
-
|
|
268
|
+
} catch ($) {
|
|
269
|
+
const U = $ instanceof Error && $.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
|
|
270
|
+
o(U);
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
}, []),
|
|
274
|
-
e ? s() : await a(
|
|
275
|
-
}, [e,
|
|
276
|
-
s(), await a(
|
|
277
|
-
}, [s, a]), C =
|
|
278
|
-
s(), f.current = null,
|
|
279
|
-
}, [s]), v =
|
|
280
|
-
return
|
|
273
|
+
}, []), L = S(async () => {
|
|
274
|
+
e ? s() : await a(d || void 0);
|
|
275
|
+
}, [e, d, s, a]), D = S(async (_) => {
|
|
276
|
+
s(), await a(_);
|
|
277
|
+
}, [s, a]), C = S(() => {
|
|
278
|
+
s(), f.current = null, o(null), u("");
|
|
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
|
-
previewEl:
|
|
286
|
-
activeDeviceId:
|
|
287
|
-
toggle:
|
|
288
|
-
switchDevice:
|
|
289
|
-
attachRoom:
|
|
285
|
+
previewEl: i,
|
|
286
|
+
activeDeviceId: d,
|
|
287
|
+
toggle: L,
|
|
288
|
+
switchDevice: D,
|
|
289
|
+
attachRoom: w,
|
|
290
290
|
teardown: C,
|
|
291
291
|
clearError: v
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
|
-
function
|
|
295
|
-
const [e, t] =
|
|
296
|
-
|
|
297
|
-
}, []), f =
|
|
298
|
-
const a =
|
|
294
|
+
function An() {
|
|
295
|
+
const [e, t] = E(!1), [r, o] = E(null), [i, l] = E(null), d = A(null), u = S((a) => {
|
|
296
|
+
d.current = a;
|
|
297
|
+
}, []), f = S(() => l(null), []), y = S(async () => {
|
|
298
|
+
const a = d.current;
|
|
299
299
|
if (a) {
|
|
300
300
|
if (e) {
|
|
301
301
|
try {
|
|
@@ -305,12 +305,12 @@ function Cn() {
|
|
|
305
305
|
f(), t(!1);
|
|
306
306
|
return;
|
|
307
307
|
}
|
|
308
|
-
|
|
308
|
+
o(null);
|
|
309
309
|
try {
|
|
310
310
|
await a.localParticipant.setScreenShareEnabled(!0);
|
|
311
|
-
let
|
|
312
|
-
const
|
|
313
|
-
const C = a.localParticipant.getTrackPublication(
|
|
311
|
+
let L = 0;
|
|
312
|
+
const D = () => {
|
|
313
|
+
const C = a.localParticipant.getTrackPublication(rn.Source.ScreenShare);
|
|
314
314
|
if (C != null && C.track) {
|
|
315
315
|
const v = C.track.attach();
|
|
316
316
|
l(v), t(!0);
|
|
@@ -323,49 +323,49 @@ function Cn() {
|
|
|
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]),
|
|
335
|
-
const a =
|
|
334
|
+
}, [e, f]), w = S(() => {
|
|
335
|
+
const a = d.current;
|
|
336
336
|
if (a && e)
|
|
337
337
|
try {
|
|
338
338
|
a.localParticipant.setScreenShareEnabled(!1);
|
|
339
339
|
} catch {
|
|
340
340
|
}
|
|
341
|
-
f(), t(!1),
|
|
342
|
-
}, [e, f]), s =
|
|
343
|
-
return { isEnabled: e, error: r, previewEl:
|
|
341
|
+
f(), t(!1), o(null), d.current = null;
|
|
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();
|
|
350
|
-
t(l.filter((
|
|
350
|
+
t(l.filter((d) => d.kind === "audioinput")), o(l.filter((d) => d.kind === "videoinput"));
|
|
351
351
|
} catch {
|
|
352
352
|
}
|
|
353
353
|
}, []);
|
|
354
|
-
return
|
|
355
|
-
if (
|
|
356
|
-
const l = () => void
|
|
354
|
+
return M(() => {
|
|
355
|
+
if (i(), typeof navigator > "u" || !navigator.mediaDevices) return;
|
|
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 [
|
|
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),
|
|
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) {
|
|
@@ -374,13 +374,13 @@ function Nn(e, t, r = !1) {
|
|
|
374
374
|
}
|
|
375
375
|
return s.json();
|
|
376
376
|
}).then((s) => {
|
|
377
|
-
y.signal.aborted || (
|
|
377
|
+
y.signal.aborted || (i(s), f(!1));
|
|
378
378
|
}).catch((s) => {
|
|
379
|
-
y.signal.aborted || (
|
|
379
|
+
y.signal.aborted || (d(s instanceof Error ? s.message : "Agent lookup failed"), f(!1));
|
|
380
380
|
}), () => y.abort();
|
|
381
|
-
}, [e, t, r]), { info:
|
|
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,127 +388,127 @@ 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
|
|
403
|
+
const o = e !== void 0, [i, l] = E(t), d = o ? e : i, u = S(
|
|
404
404
|
(f) => {
|
|
405
|
-
f !==
|
|
405
|
+
f !== d && (o || l(f), r == null || r(f));
|
|
406
406
|
},
|
|
407
|
-
[
|
|
407
|
+
[d, o, r]
|
|
408
408
|
);
|
|
409
|
-
return [
|
|
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
|
-
persistKey:
|
|
420
|
-
disablePersistence:
|
|
419
|
+
persistKey: o = "ll-widget",
|
|
420
|
+
disablePersistence: i = !1
|
|
421
421
|
} = {}) {
|
|
422
|
-
const l = `${
|
|
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 && !
|
|
426
|
+
e === void 0 && !i && Tn(l, y), r == null || r(y);
|
|
427
427
|
}
|
|
428
428
|
});
|
|
429
|
-
return
|
|
430
|
-
if (
|
|
431
|
-
const y =
|
|
429
|
+
return M(() => {
|
|
430
|
+
if (d.current || (d.current = !0, i || e !== void 0)) return;
|
|
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;
|
|
442
442
|
}
|
|
443
443
|
if (typeof window > "u" || typeof window.matchMedia > "u")
|
|
444
444
|
return;
|
|
445
|
-
const
|
|
446
|
-
return l(), typeof
|
|
447
|
-
|
|
445
|
+
const o = `(max-width: ${e - 1}px)`, i = window.matchMedia(o), l = () => r(i.matches);
|
|
446
|
+
return l(), typeof i.addEventListener == "function" ? (i.addEventListener("change", l), () => i.removeEventListener("change", l)) : (i.addListener(l), () => {
|
|
447
|
+
i.removeListener(l);
|
|
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
|
-
const
|
|
457
|
-
return window.dispatchEvent(new Event(
|
|
456
|
+
const o = e.apply(this, r);
|
|
457
|
+
return window.dispatchEvent(new Event(yt)), o;
|
|
458
458
|
}, window.history.replaceState = function(...r) {
|
|
459
|
-
const
|
|
460
|
-
return window.dispatchEvent(new Event(
|
|
461
|
-
}, window.history[
|
|
459
|
+
const o = t.apply(this, r);
|
|
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
|
|
474
|
-
return
|
|
475
|
-
window.removeEventListener("popstate",
|
|
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 qt = /* @__PURE__ */ new Map(),
|
|
479
|
+
const qt = /* @__PURE__ */ new Map(), Vn = /[\\^$+?.()|{}[\]]/g;
|
|
480
480
|
function qn(e) {
|
|
481
|
-
return e.replace(
|
|
481
|
+
return e.replace(Vn, "\\$&");
|
|
482
482
|
}
|
|
483
|
-
function
|
|
483
|
+
function Wn(e) {
|
|
484
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,
|
|
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
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
493
|
function Fn(e, t) {
|
|
494
|
-
return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(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
499
|
if (Fn(r, t)) return !0;
|
|
500
500
|
return !1;
|
|
501
501
|
}
|
|
502
|
-
function Un(e, t, r) {
|
|
503
|
-
return e === void 0 ? !0 : Bt(r, e) ? !1 : t && t.length > 0 ? Bt(t, e) : !0;
|
|
504
|
-
}
|
|
505
502
|
function jn(e, t, r) {
|
|
506
|
-
return
|
|
507
|
-
|
|
503
|
+
return e === void 0 ? !0 : Wt(r, e) ? !1 : t && t.length > 0 ? Wt(t, e) : !0;
|
|
504
|
+
}
|
|
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,
|
|
@@ -572,7 +572,7 @@ const Wt = ({ 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 Wt = ({ 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 Wt = ({ 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,122 +616,122 @@ function Xn() {
|
|
|
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,
|
|
630
|
-
onExpand:
|
|
631
|
-
label:
|
|
630
|
+
onExpand: o,
|
|
631
|
+
label: i = "Open widget",
|
|
632
632
|
avatarImageUrl: l,
|
|
633
|
-
agentName:
|
|
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
|
|
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
658
|
C.current = {
|
|
659
|
-
startClientY:
|
|
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
|
-
),
|
|
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
|
-
C.current = null,
|
|
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
|
-
|
|
692
|
-
}, [
|
|
693
|
-
(
|
|
694
|
-
if (
|
|
695
|
-
|
|
696
|
-
const
|
|
697
|
-
a((
|
|
698
|
-
if (
|
|
699
|
-
const
|
|
700
|
-
return
|
|
691
|
+
o();
|
|
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:
|
|
718
|
-
onPointerDown:
|
|
719
|
-
onPointerMove:
|
|
720
|
-
onPointerUp:
|
|
721
|
-
onPointerCancel:
|
|
717
|
+
className: q,
|
|
718
|
+
onPointerDown: O,
|
|
719
|
+
onPointerMove: $,
|
|
720
|
+
onPointerUp: U,
|
|
721
|
+
onPointerCancel: U,
|
|
722
722
|
onClick: m,
|
|
723
|
-
onKeyDown:
|
|
724
|
-
"aria-label":
|
|
723
|
+
onKeyDown: I,
|
|
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"
|
|
@@ -741,14 +741,14 @@ const Gn = ({
|
|
|
741
741
|
"img",
|
|
742
742
|
{
|
|
743
743
|
src: l,
|
|
744
|
-
alt:
|
|
744
|
+
alt: d ? `${d} avatar` : "Agent avatar",
|
|
745
745
|
className: "ll-hidden__avatar",
|
|
746
746
|
draggable: !1
|
|
747
747
|
}
|
|
748
748
|
)
|
|
749
749
|
] })
|
|
750
750
|
) : /* @__PURE__ */ n(
|
|
751
|
-
|
|
751
|
+
jt,
|
|
752
752
|
{
|
|
753
753
|
direction: f,
|
|
754
754
|
className: "ll-hidden__chevron"
|
|
@@ -756,46 +756,46 @@ const Gn = ({
|
|
|
756
756
|
)
|
|
757
757
|
}
|
|
758
758
|
);
|
|
759
|
-
},
|
|
759
|
+
}, tr = ({
|
|
760
760
|
audioLevel: e,
|
|
761
761
|
bars: t = 20,
|
|
762
762
|
maxHeight: r = 20,
|
|
763
|
-
minHeight:
|
|
764
|
-
className:
|
|
763
|
+
minHeight: o = 4,
|
|
764
|
+
className: i,
|
|
765
765
|
barClassName: l
|
|
766
766
|
}) => {
|
|
767
|
-
const
|
|
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
|
-
}), [e, t, r,
|
|
779
|
-
const y = ["ll-waveform",
|
|
780
|
-
return /* @__PURE__ */ n("div", { ref:
|
|
778
|
+
}), [e, t, r, o, f]);
|
|
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 }, (w, s) => /* @__PURE__ */ n(
|
|
781
781
|
"div",
|
|
782
782
|
{
|
|
783
783
|
ref: (a) => {
|
|
784
784
|
u.current[s] = a;
|
|
785
785
|
},
|
|
786
786
|
className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
|
|
787
|
-
style: { height: `${
|
|
787
|
+
style: { height: `${o}px` }
|
|
788
788
|
},
|
|
789
789
|
s
|
|
790
790
|
)) });
|
|
791
|
-
},
|
|
791
|
+
}, nr = ({
|
|
792
792
|
position: e,
|
|
793
793
|
isMobile: t,
|
|
794
794
|
agentName: r,
|
|
795
|
-
avatarImageUrl:
|
|
796
|
-
agentState:
|
|
795
|
+
avatarImageUrl: o,
|
|
796
|
+
agentState: i,
|
|
797
797
|
isMuted: l,
|
|
798
|
-
audioLevel:
|
|
798
|
+
audioLevel: d,
|
|
799
799
|
onExpand: u,
|
|
800
800
|
onToggleMute: f,
|
|
801
801
|
onClose: y
|
|
@@ -805,7 +805,7 @@ const Gn = ({
|
|
|
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",
|
|
@@ -813,42 +813,42 @@ const Gn = ({
|
|
|
813
813
|
onClick: u,
|
|
814
814
|
"aria-label": `Expand ${r} widget`,
|
|
815
815
|
children: [
|
|
816
|
-
|
|
816
|
+
o ? (
|
|
817
817
|
// eslint-disable-next-line @next/next/no-img-element
|
|
818
818
|
/* @__PURE__ */ n(
|
|
819
819
|
"img",
|
|
820
820
|
{
|
|
821
|
-
src:
|
|
821
|
+
src: o,
|
|
822
822
|
alt: r,
|
|
823
823
|
className: "ll-minimized__avatar"
|
|
824
824
|
}
|
|
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
|
-
audioLevel:
|
|
830
|
+
audioLevel: d,
|
|
831
831
|
bars: 16,
|
|
832
832
|
maxHeight: 18,
|
|
833
833
|
className: "ll-minimized__waveform"
|
|
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
854
|
/* @__PURE__ */ n(Ft, { className: "ll-minimized__icon ll-minimized__icon--expand" })
|
|
@@ -864,23 +864,23 @@ const Gn = ({
|
|
|
864
864
|
"data-position": e,
|
|
865
865
|
role: "region",
|
|
866
866
|
"aria-label": `${r} widget`,
|
|
867
|
-
children: /* @__PURE__ */
|
|
868
|
-
|
|
867
|
+
children: /* @__PURE__ */ x("div", { className: "ll-minimized__surface", children: [
|
|
868
|
+
o ? (
|
|
869
869
|
// eslint-disable-next-line @next/next/no-img-element
|
|
870
870
|
/* @__PURE__ */ n(
|
|
871
871
|
"img",
|
|
872
872
|
{
|
|
873
|
-
src:
|
|
873
|
+
src: o,
|
|
874
874
|
alt: r,
|
|
875
875
|
className: "ll-minimized__avatar"
|
|
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
|
-
/* @__PURE__ */ n("span", { className: "ll-minimized__state", children:
|
|
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 Gn = ({
|
|
|
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(
|
|
@@ -908,22 +908,22 @@ const Gn = ({
|
|
|
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
|
-
className:
|
|
922
|
-
style:
|
|
921
|
+
className: o,
|
|
922
|
+
style: i
|
|
923
923
|
}) => {
|
|
924
|
-
const [l,
|
|
925
|
-
if (
|
|
926
|
-
u.current !== e && (u.current = e,
|
|
924
|
+
const [l, d] = E(!1), u = A(e);
|
|
925
|
+
if (M(() => {
|
|
926
|
+
u.current !== e && (u.current = e, d(!1));
|
|
927
927
|
}, [e]), !e) return null;
|
|
928
928
|
const f = {
|
|
929
929
|
position: "absolute",
|
|
@@ -935,7 +935,7 @@ const Gn = ({
|
|
|
935
935
|
transition: "opacity 500ms ease, transform 500ms ease",
|
|
936
936
|
transform: r ? "scale(1.02)" : "scale(1)",
|
|
937
937
|
opacity: l ? 1 : 0,
|
|
938
|
-
...
|
|
938
|
+
...i
|
|
939
939
|
};
|
|
940
940
|
return (
|
|
941
941
|
// eslint-disable-next-line @next/next/no-img-element
|
|
@@ -944,156 +944,156 @@ const Gn = ({
|
|
|
944
944
|
{
|
|
945
945
|
src: e,
|
|
946
946
|
alt: t,
|
|
947
|
-
className:
|
|
947
|
+
className: o,
|
|
948
948
|
style: f,
|
|
949
949
|
loading: "eager",
|
|
950
950
|
fetchPriority: "high",
|
|
951
|
-
onLoad: () =>
|
|
951
|
+
onLoad: () => d(!0)
|
|
952
952
|
}
|
|
953
953
|
)
|
|
954
954
|
);
|
|
955
|
-
},
|
|
955
|
+
}, or = ({
|
|
956
956
|
position: e,
|
|
957
957
|
isMobile: t,
|
|
958
958
|
agentName: r,
|
|
959
|
-
avatarImageUrl:
|
|
960
|
-
idleLoopUrl:
|
|
959
|
+
avatarImageUrl: o,
|
|
960
|
+
idleLoopUrl: i,
|
|
961
961
|
greeting: l,
|
|
962
|
-
branding:
|
|
962
|
+
branding: d,
|
|
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:
|
|
969
|
+
languageMenuOpen: L,
|
|
970
|
+
onToggleLanguageMenu: D,
|
|
971
971
|
connectionState: C,
|
|
972
972
|
agentState: v,
|
|
973
|
-
transcript:
|
|
974
|
-
canResume:
|
|
975
|
-
needsUserGesture:
|
|
976
|
-
error:
|
|
973
|
+
transcript: _,
|
|
974
|
+
canResume: O,
|
|
975
|
+
needsUserGesture: $,
|
|
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:
|
|
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
998
|
onToggleCamera: Ie,
|
|
999
|
-
onSwitchCameraDevice:
|
|
1000
|
-
onToggleScreenShare:
|
|
1001
|
-
onToggleSpeaker:
|
|
1002
|
-
onSendMessage:
|
|
1003
|
-
onMinimize:
|
|
1004
|
-
onClose:
|
|
1005
|
-
onClearMicError:
|
|
999
|
+
onSwitchCameraDevice: Y,
|
|
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 K =
|
|
1061
|
-
K && (
|
|
1060
|
+
const K = ye.trim();
|
|
1061
|
+
K && (at(K), Fe(""));
|
|
1062
1062
|
},
|
|
1063
|
-
[
|
|
1064
|
-
),
|
|
1065
|
-
let
|
|
1066
|
-
for (let p =
|
|
1067
|
-
const K =
|
|
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__ */
|
|
1084
|
-
|
|
1085
|
-
|
|
1083
|
+
/* @__PURE__ */ x("div", { className: "ll-expanded__bg", children: [
|
|
1084
|
+
o ? /* @__PURE__ */ n(
|
|
1085
|
+
rr,
|
|
1086
1086
|
{
|
|
1087
|
-
src:
|
|
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
|
-
|
|
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",
|
|
1096
|
-
src:
|
|
1096
|
+
src: i,
|
|
1097
1097
|
autoPlay: !0,
|
|
1098
1098
|
loop: !0,
|
|
1099
1099
|
muted: !0,
|
|
@@ -1101,49 +1101,49 @@ const Gn = ({
|
|
|
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 Gn = ({
|
|
|
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 Gn = ({
|
|
|
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 Gn = ({
|
|
|
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 Gn = ({
|
|
|
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 =
|
|
1272
|
-
return /* @__PURE__ */
|
|
1273
|
-
C === "idle" && !
|
|
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,7 +1283,7 @@ const Gn = ({
|
|
|
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(
|
|
@@ -1291,7 +1291,7 @@ const Gn = ({
|
|
|
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 Gn = ({
|
|
|
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 ${
|
|
1358
|
+
className: `ll-tool ll-tool--left ${B ? "is-on" : ""}`,
|
|
1359
1359
|
onClick: Ie,
|
|
1360
|
-
"aria-label":
|
|
1361
|
-
title:
|
|
1362
|
-
children: /* @__PURE__ */ n(
|
|
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 Gn = ({
|
|
|
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 Gn = ({
|
|
|
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,61 +1447,61 @@ const Gn = ({
|
|
|
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 (!
|
|
1495
|
+
if (!U || C !== "error") return null;
|
|
1496
1496
|
let p = "Failed to connect", K = "Try again";
|
|
1497
|
-
return
|
|
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:
|
|
1504
|
+
onClick: Re,
|
|
1505
1505
|
children: K
|
|
1506
1506
|
}
|
|
1507
1507
|
)
|
|
@@ -1511,55 +1511,55 @@ const Gn = ({
|
|
|
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,49 +1568,49 @@ 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",
|
|
1575
|
-
onClick: (
|
|
1575
|
+
onClick: (i) => i.stopPropagation(),
|
|
1576
1576
|
role: "listbox",
|
|
1577
1577
|
children: [
|
|
1578
1578
|
/* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
|
|
1579
|
-
t.map((
|
|
1580
|
-
const
|
|
1581
|
-
return /* @__PURE__ */
|
|
1579
|
+
t.map((i, l) => {
|
|
1580
|
+
const d = r === i.deviceId;
|
|
1581
|
+
return /* @__PURE__ */ x(
|
|
1582
1582
|
"button",
|
|
1583
1583
|
{
|
|
1584
1584
|
type: "button",
|
|
1585
|
-
className: `ll-device-menu__item ${
|
|
1586
|
-
onClick: () => i
|
|
1585
|
+
className: `ll-device-menu__item ${d ? "is-active" : ""}`,
|
|
1586
|
+
onClick: () => o(i.deviceId),
|
|
1587
1587
|
role: "option",
|
|
1588
|
-
"aria-selected":
|
|
1588
|
+
"aria-selected": d,
|
|
1589
1589
|
children: [
|
|
1590
|
-
|
|
1591
|
-
/* @__PURE__ */ n("span", { className: "ll-device-menu__name", children:
|
|
1590
|
+
d && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
|
|
1591
|
+
/* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: i.label || `${e} ${l + 1}` })
|
|
1592
1592
|
]
|
|
1593
1593
|
},
|
|
1594
|
-
|
|
1594
|
+
i.deviceId || l
|
|
1595
1595
|
);
|
|
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, Xt = 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
|
-
const r = window.innerHeight || document.documentElement.clientHeight,
|
|
1644
|
-
return t.bottom > 0 && t.right > 0 && t.top < r && t.left <
|
|
1643
|
+
const r = window.innerHeight || document.documentElement.clientHeight, o = window.innerWidth || document.documentElement.clientWidth;
|
|
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)}"]`);
|
|
@@ -1651,18 +1651,18 @@ function Gt(e) {
|
|
|
1651
1651
|
}
|
|
1652
1652
|
const r = e.getAttribute("aria-label");
|
|
1653
1653
|
if (r) return r.trim();
|
|
1654
|
-
const
|
|
1655
|
-
if (
|
|
1656
|
-
const
|
|
1657
|
-
return
|
|
1654
|
+
const o = e.getAttribute("placeholder");
|
|
1655
|
+
if (o) return o.trim();
|
|
1656
|
+
const i = e.closest("label");
|
|
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 {
|
|
@@ -1676,39 +1676,39 @@ function mr(e, t = {}) {
|
|
|
1676
1676
|
forms: [],
|
|
1677
1677
|
extras: e
|
|
1678
1678
|
};
|
|
1679
|
-
const
|
|
1679
|
+
const o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "", d = Array.from(
|
|
1680
1680
|
r.querySelectorAll("[data-ll-region]")
|
|
1681
1681
|
), u = [];
|
|
1682
|
-
for (const m of
|
|
1683
|
-
if (u.length >=
|
|
1684
|
-
if (
|
|
1685
|
-
const
|
|
1682
|
+
for (const m of d) {
|
|
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
1713
|
const C = [], v = Array.from(
|
|
1714
1714
|
r.querySelectorAll(
|
|
@@ -1716,65 +1716,65 @@ function mr(e, t = {}) {
|
|
|
1716
1716
|
)
|
|
1717
1717
|
);
|
|
1718
1718
|
for (const m of v) {
|
|
1719
|
-
if (C.length >=
|
|
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
|
-
),
|
|
1727
|
-
for (const m of
|
|
1728
|
-
if (
|
|
1729
|
-
if (
|
|
1730
|
-
const
|
|
1731
|
-
if (!
|
|
1732
|
-
const
|
|
1726
|
+
), O = [];
|
|
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
|
-
|
|
1745
|
+
O.push({ id: I, intent: q, fields: P });
|
|
1746
1746
|
}
|
|
1747
|
-
const
|
|
1748
|
-
url:
|
|
1747
|
+
const $ = {
|
|
1748
|
+
url: o,
|
|
1749
1749
|
title: l,
|
|
1750
|
-
pathname:
|
|
1750
|
+
pathname: i,
|
|
1751
1751
|
regions: u,
|
|
1752
1752
|
visibleText: a,
|
|
1753
|
-
visibleLinks:
|
|
1753
|
+
visibleLinks: L,
|
|
1754
1754
|
visibleFields: C,
|
|
1755
|
-
forms:
|
|
1755
|
+
forms: O,
|
|
1756
1756
|
extras: e
|
|
1757
1757
|
};
|
|
1758
|
-
let
|
|
1759
|
-
for (;
|
|
1760
|
-
|
|
1761
|
-
for (;
|
|
1762
|
-
|
|
1763
|
-
return
|
|
1764
|
-
}
|
|
1765
|
-
let
|
|
1766
|
-
function
|
|
1767
|
-
const r = Date.now(),
|
|
1768
|
-
if (
|
|
1769
|
-
return
|
|
1770
|
-
const l =
|
|
1771
|
-
return
|
|
1772
|
-
}
|
|
1773
|
-
function
|
|
1774
|
-
|
|
1775
|
-
}
|
|
1776
|
-
const
|
|
1777
|
-
function
|
|
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
|
+
$.visibleLinks.pop(), U -= 80;
|
|
1763
|
+
return He($.visibleText) > ht && ($.visibleText = Ae($.visibleText, ht - 100)), $;
|
|
1764
|
+
}
|
|
1765
|
+
let Ve = null;
|
|
1766
|
+
function mt(e, t = {}) {
|
|
1767
|
+
const r = Date.now(), i = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
|
|
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
|
+
}
|
|
1773
|
+
function vr() {
|
|
1774
|
+
Ve = null;
|
|
1775
|
+
}
|
|
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
|
-
const r = typeof window < "u" && window.location.origin || "",
|
|
1794
|
-
for (const
|
|
1795
|
-
if (
|
|
1796
|
-
if (
|
|
1797
|
-
const u =
|
|
1798
|
-
if (!
|
|
1793
|
+
const r = typeof window < "u" && window.location.origin || "", o = /* @__PURE__ */ new Set(), i = [], l = Array.from(t.querySelectorAll("a[href]"));
|
|
1794
|
+
for (const d of l) {
|
|
1795
|
+
if (i.length >= wr) break;
|
|
1796
|
+
if (At(d)) continue;
|
|
1797
|
+
const u = d.getAttribute("href") || "";
|
|
1798
|
+
if (!xr(u)) continue;
|
|
1799
1799
|
let f = u, y = !0;
|
|
1800
1800
|
try {
|
|
1801
1801
|
if (typeof window < "u") {
|
|
@@ -1805,42 +1805,42 @@ function wr(e) {
|
|
|
1805
1805
|
} catch {
|
|
1806
1806
|
continue;
|
|
1807
1807
|
}
|
|
1808
|
-
if (
|
|
1809
|
-
|
|
1810
|
-
const
|
|
1811
|
-
|
|
1808
|
+
if (o.has(f)) continue;
|
|
1809
|
+
o.add(f);
|
|
1810
|
+
const w = (d.textContent || "").trim().slice(0, 120);
|
|
1811
|
+
i.push({ href: f, text: w, internal: y });
|
|
1812
1812
|
}
|
|
1813
|
-
return
|
|
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
|
|
1828
|
-
const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype,
|
|
1829
|
-
|
|
1827
|
+
function Er(e, t) {
|
|
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
|
+
i ? i.call(e, t) : e.value = t;
|
|
1830
1830
|
}
|
|
1831
|
-
function
|
|
1832
|
-
const
|
|
1831
|
+
function Cr(e, t, r = {}) {
|
|
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(
|
|
1835
1835
|
HTMLInputElement.prototype,
|
|
1836
1836
|
"checked"
|
|
1837
|
-
),
|
|
1838
|
-
|
|
1837
|
+
), d = l == null ? void 0 : l.set, u = t === "true" || t === "1" || t === "on";
|
|
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,44 +1848,44 @@ 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
|
-
for (const
|
|
1863
|
-
if (!
|
|
1864
|
-
const
|
|
1865
|
-
if (
|
|
1866
|
-
const l =
|
|
1867
|
-
l > r && (r = l, t =
|
|
1862
|
+
for (const o of e) {
|
|
1863
|
+
if (!Ar(o)) continue;
|
|
1864
|
+
const i = o.getBoundingClientRect();
|
|
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
|
+
const l = i.width * i.height;
|
|
1867
|
+
l > r && (r = l, t = o);
|
|
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,995 +1906,1093 @@ 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,
|
|
1916
|
-
baseUrl:
|
|
1917
|
-
sessionEndpoint:
|
|
1920
|
+
baseUrl: o = "https://app.livelayer.studio",
|
|
1921
|
+
sessionEndpoint: i,
|
|
1918
1922
|
sessionBody: l,
|
|
1919
|
-
autoConnect:
|
|
1923
|
+
autoConnect: d = !1,
|
|
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:
|
|
1930
|
+
disablePersistence: L = !1,
|
|
1931
|
+
teamMembers: D,
|
|
1928
1932
|
currentTeamMemberId: C,
|
|
1929
1933
|
onTeamMemberChange: v,
|
|
1930
|
-
idleLoopUrl:
|
|
1931
|
-
greeting:
|
|
1932
|
-
avatarImageUrl:
|
|
1933
|
-
agentName:
|
|
1934
|
+
idleLoopUrl: _,
|
|
1935
|
+
greeting: O,
|
|
1936
|
+
avatarImageUrl: $,
|
|
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:
|
|
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,
|
|
1955
1959
|
onAgentCommand: Ie,
|
|
1956
|
-
controlledSession:
|
|
1957
|
-
className:
|
|
1958
|
-
style:
|
|
1959
|
-
zIndex:
|
|
1960
|
-
} = e,
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
}, [
|
|
1964
|
-
const
|
|
1960
|
+
controlledSession: Y,
|
|
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 C ?? ((h =
|
|
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
|
|
1980
|
-
return
|
|
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;
|
|
1984
|
+
return c ? c.includes(h) : !0;
|
|
1981
1985
|
}
|
|
1982
|
-
function
|
|
1986
|
+
function _e(h, c) {
|
|
1983
1987
|
console.warn(
|
|
1984
|
-
`[LiveLayer] Agent command "${h}" blocked — capability "${
|
|
1988
|
+
`[LiveLayer] Agent command "${h}" blocked — capability "${c}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
|
|
1985
1989
|
);
|
|
1986
1990
|
}
|
|
1987
|
-
const Ke =
|
|
1991
|
+
const Ke = S(
|
|
1988
1992
|
(h) => {
|
|
1989
|
-
var
|
|
1990
|
-
const
|
|
1991
|
-
if (!(!
|
|
1992
|
-
if (
|
|
1993
|
-
|
|
1994
|
-
|
|
1993
|
+
var J, ue, te, xe, ke, X;
|
|
1994
|
+
const c = h;
|
|
1995
|
+
if (!(!c.type || typeof c.type != "string")) {
|
|
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
|
-
if (
|
|
2036
|
-
if (!
|
|
2037
|
-
|
|
2049
|
+
if (c.type === "scroll_to") {
|
|
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
|
-
if (
|
|
2078
|
-
if (!
|
|
2079
|
-
|
|
2091
|
+
if (c.type === "request_page_context") {
|
|
2092
|
+
if (!we("read_page")) {
|
|
2093
|
+
_e("request_page_context", "read_page");
|
|
2080
2094
|
return;
|
|
2081
2095
|
}
|
|
2082
|
-
const
|
|
2083
|
-
const
|
|
2084
|
-
if (
|
|
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;
|
|
2098
|
+
if (F != null && F.publishData)
|
|
2085
2099
|
try {
|
|
2086
|
-
const
|
|
2087
|
-
|
|
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
|
-
if (
|
|
2126
|
-
if (!
|
|
2127
|
-
|
|
2139
|
+
if (c.type === "scroll_page") {
|
|
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
|
-
if (
|
|
2159
|
-
if (!
|
|
2160
|
-
|
|
2172
|
+
if (c.type === "click") {
|
|
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
2182
|
if (K.current) {
|
|
2169
2183
|
try {
|
|
2170
|
-
K.current(
|
|
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
|
-
if (
|
|
2202
|
-
if (!
|
|
2203
|
-
|
|
2215
|
+
if (c.type === "fill_form" || c.type === "focus_field") {
|
|
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
|
|
2208
|
-
if (
|
|
2209
|
-
const
|
|
2210
|
-
if (
|
|
2221
|
+
const b = typeof c.requestId == "string" ? c.requestId : void 0, k = (xe = oe.current) == null ? void 0 : xe.call(oe), R = (z) => {
|
|
2222
|
+
if (c.type !== "fill_form") return;
|
|
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] ${
|
|
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] ${
|
|
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
|
-
`[LiveLayer] ${
|
|
2239
|
-
),
|
|
2252
|
+
`[LiveLayer] ${c.type}: refusing to touch a form in a private subtree.`
|
|
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
|
-
if (
|
|
2248
|
-
const
|
|
2249
|
-
if (!
|
|
2261
|
+
if (c.type === "focus_field") {
|
|
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
|
-
),
|
|
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
|
-
),
|
|
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
|
-
),
|
|
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:
|
|
2309
|
-
skipped:
|
|
2310
|
-
reason:
|
|
2320
|
+
ok: T.length > 0,
|
|
2321
|
+
formId: N,
|
|
2322
|
+
filled: T,
|
|
2323
|
+
skipped: F,
|
|
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
|
-
if (
|
|
2315
|
-
if (!
|
|
2316
|
-
|
|
2328
|
+
if (c.type === "submit_form") {
|
|
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
|
|
2356
|
-
} catch (
|
|
2357
|
-
console.warn("[LiveLayer] submit_form: requestSubmit threw.",
|
|
2369
|
+
typeof k.requestSubmit == "function" ? k.requestSubmit() : k.submit();
|
|
2370
|
+
} catch (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
|
-
if (
|
|
2374
|
-
if (!
|
|
2375
|
-
|
|
2387
|
+
if (c.type === "request_routes") {
|
|
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
|
|
2383
|
-
|
|
2384
|
-
} catch (
|
|
2385
|
-
console.warn("[LiveLayer] request_routes: publishData failed.",
|
|
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 });
|
|
2398
|
+
} catch (F) {
|
|
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
|
-
}) :
|
|
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
|
-
[Ie,
|
|
2422
|
-
),
|
|
2423
|
-
agentId:
|
|
2424
|
-
baseUrl:
|
|
2435
|
+
[Ie, Te]
|
|
2436
|
+
), V = Ln({
|
|
2437
|
+
agentId: Y ? "__controlled__" : Be,
|
|
2438
|
+
baseUrl: o,
|
|
2425
2439
|
apiKey: r,
|
|
2426
|
-
sessionEndpoint:
|
|
2440
|
+
sessionEndpoint: i,
|
|
2427
2441
|
sessionBody: l,
|
|
2428
|
-
onDataMessage:
|
|
2442
|
+
onDataMessage: Y ? void 0 : Ke
|
|
2429
2443
|
});
|
|
2430
|
-
|
|
2431
|
-
if (
|
|
2432
|
-
return
|
|
2433
|
-
}, [
|
|
2444
|
+
M(() => {
|
|
2445
|
+
if (Y != null && Y.subscribeToDataMessages)
|
|
2446
|
+
return Y.subscribeToDataMessages(Ke);
|
|
2447
|
+
}, [Y, Ke]), oe.current = () => {
|
|
2434
2448
|
var h;
|
|
2435
|
-
return (h =
|
|
2436
|
-
},
|
|
2437
|
-
var
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
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
|
+
}
|
|
2441
2464
|
try {
|
|
2442
|
-
|
|
2443
|
-
JSON.stringify({ type: "pathname", pathname:
|
|
2465
|
+
J.publishData(
|
|
2466
|
+
new TextEncoder().encode(JSON.stringify({ type: "pathname", pathname: h })),
|
|
2467
|
+
{ reliable: !0 }
|
|
2444
2468
|
);
|
|
2445
|
-
|
|
2446
|
-
|
|
2469
|
+
} catch (X) {
|
|
2470
|
+
console.warn("[NAV-DEBUG][widget] pushSnapshot pathname threw:", X);
|
|
2447
2471
|
}
|
|
2448
|
-
|
|
2449
|
-
|
|
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 () => {
|
|
2450
2486
|
try {
|
|
2451
|
-
const
|
|
2452
|
-
|
|
2453
|
-
|
|
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;
|
|
2506
|
+
if (console.log(
|
|
2507
|
+
`[NAV-DEBUG][widget] pathname-effect fired pathname=${ae} connState=${V.connectionState} t=${Date.now()}`
|
|
2508
|
+
), !ae) {
|
|
2509
|
+
console.log("[NAV-DEBUG][widget] effect bailed: no pathname");
|
|
2510
|
+
return;
|
|
2511
|
+
}
|
|
2512
|
+
const h = (ue = V.getRoom) == null ? void 0 : ue.call(V), c = h == null ? void 0 : h.localParticipant;
|
|
2513
|
+
if (console.log(
|
|
2514
|
+
`[NAV-DEBUG][widget] immediate-push state: room=${!!h} lp=${!!c} publishData=${!!(c != null && c.publishData)}`
|
|
2515
|
+
), !(c != null && c.publishData)) {
|
|
2516
|
+
console.log("[NAV-DEBUG][widget] effect bailed: no publishData (not connected yet)");
|
|
2517
|
+
return;
|
|
2518
|
+
}
|
|
2519
|
+
try {
|
|
2520
|
+
const te = new TextEncoder().encode(
|
|
2521
|
+
JSON.stringify({ type: "pathname", pathname: ae })
|
|
2522
|
+
);
|
|
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);
|
|
2526
|
+
}
|
|
2527
|
+
const J = setTimeout(async () => {
|
|
2528
|
+
var te, xe, ke, X;
|
|
2529
|
+
console.log("[NAV-DEBUG][widget] settle timer fired (250ms after pathname-effect)");
|
|
2530
|
+
try {
|
|
2531
|
+
const b = (te = V.getRoom) == null ? void 0 : te.call(V), k = b == null ? void 0 : b.localParticipant;
|
|
2532
|
+
if (console.log(
|
|
2533
|
+
`[NAV-DEBUG][widget] settle-time state: room=${!!b} lp=${!!k} publishData=${!!(k != null && k.publishData)}`
|
|
2534
|
+
), !(k != null && k.publishData)) {
|
|
2535
|
+
console.log("[NAV-DEBUG][widget] settle bailed: no publishData");
|
|
2536
|
+
return;
|
|
2537
|
+
}
|
|
2538
|
+
const R = mt(ct.current);
|
|
2539
|
+
console.log(
|
|
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}`
|
|
2541
|
+
);
|
|
2454
2542
|
try {
|
|
2455
|
-
const
|
|
2456
|
-
JSON.stringify({ type: "page_context_push", pathname:
|
|
2543
|
+
const N = new TextEncoder().encode(
|
|
2544
|
+
JSON.stringify({ type: "page_context_push", pathname: ae, context: R })
|
|
2457
2545
|
);
|
|
2458
|
-
|
|
2459
|
-
|
|
2546
|
+
k.publishData(N, { reliable: !0 }), console.log(
|
|
2547
|
+
`[NAV-DEBUG][widget] page_context_push SENT (${N.byteLength} bytes)`
|
|
2548
|
+
);
|
|
2549
|
+
} catch (N) {
|
|
2550
|
+
console.warn("[NAV-DEBUG][widget] page_context_push threw:", N);
|
|
2460
2551
|
}
|
|
2461
2552
|
try {
|
|
2462
|
-
const
|
|
2463
|
-
let
|
|
2464
|
-
if (
|
|
2465
|
-
|
|
2466
|
-
|
|
2553
|
+
const N = dt.current;
|
|
2554
|
+
let W = [];
|
|
2555
|
+
if (N) {
|
|
2556
|
+
console.log("[NAV-DEBUG][widget] routes: calling custom getRoutes()");
|
|
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}`);
|
|
2467
2559
|
} else
|
|
2468
|
-
|
|
2469
|
-
const
|
|
2470
|
-
JSON.stringify({ type: "routes_push", routes:
|
|
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(
|
|
2562
|
+
JSON.stringify({ type: "routes_push", routes: W })
|
|
2471
2563
|
);
|
|
2472
|
-
|
|
2473
|
-
|
|
2564
|
+
k.publishData(j, { reliable: !0 }), console.log(
|
|
2565
|
+
`[NAV-DEBUG][widget] routes_push SENT (${j.byteLength} bytes, ${W.length} routes)`
|
|
2566
|
+
);
|
|
2567
|
+
} catch (N) {
|
|
2568
|
+
console.warn("[NAV-DEBUG][widget] routes_push threw:", N);
|
|
2474
2569
|
}
|
|
2475
|
-
} catch {
|
|
2570
|
+
} catch (b) {
|
|
2571
|
+
console.warn("[NAV-DEBUG][widget] settle outer threw:", b);
|
|
2476
2572
|
}
|
|
2477
2573
|
}, 250);
|
|
2478
|
-
return () =>
|
|
2479
|
-
|
|
2480
|
-
|
|
2574
|
+
return () => {
|
|
2575
|
+
clearTimeout(J);
|
|
2576
|
+
};
|
|
2577
|
+
}, [ae, V, V.connectionState]), M(() => {
|
|
2578
|
+
var J;
|
|
2481
2579
|
if (typeof window > "u") return;
|
|
2482
|
-
const h = ((
|
|
2580
|
+
const h = ((J = window.location) == null ? void 0 : J.hostname) || "";
|
|
2483
2581
|
if (h === "localhost" || h === "127.0.0.1" || h === "0.0.0.0" || h.endsWith(".local") || h.endsWith(".test"))
|
|
2484
|
-
return window.__livelayerSimulateCommand = (
|
|
2582
|
+
return window.__livelayerSimulateCommand = (ue) => {
|
|
2485
2583
|
try {
|
|
2486
|
-
Ke(
|
|
2487
|
-
} catch (
|
|
2488
|
-
console.warn("[LiveLayer] simulate-command threw:",
|
|
2584
|
+
Ke(ue);
|
|
2585
|
+
} catch (te) {
|
|
2586
|
+
console.warn("[LiveLayer] simulate-command threw:", te);
|
|
2489
2587
|
}
|
|
2490
2588
|
}, () => {
|
|
2491
2589
|
delete window.__livelayerSimulateCommand;
|
|
2492
2590
|
};
|
|
2493
2591
|
}, [Ke]);
|
|
2494
|
-
const g =
|
|
2495
|
-
connectionState:
|
|
2496
|
-
agentState:
|
|
2497
|
-
transcript:
|
|
2498
|
-
videoElement:
|
|
2499
|
-
audioElement:
|
|
2500
|
-
canResume:
|
|
2501
|
-
error:
|
|
2592
|
+
const g = gt(() => Y ? {
|
|
2593
|
+
connectionState: Y.connectionState,
|
|
2594
|
+
agentState: Y.agentState,
|
|
2595
|
+
transcript: Y.transcript,
|
|
2596
|
+
videoElement: Y.videoElement,
|
|
2597
|
+
audioElement: Y.audioElement,
|
|
2598
|
+
canResume: Y.canResume,
|
|
2599
|
+
error: Y.error,
|
|
2502
2600
|
agentConfig: null,
|
|
2503
2601
|
connect: async () => {
|
|
2504
|
-
await
|
|
2602
|
+
await Y.onConnect();
|
|
2505
2603
|
},
|
|
2506
|
-
disconnect: () =>
|
|
2604
|
+
disconnect: () => Y.onDisconnect(),
|
|
2507
2605
|
// Dummy getRoom for shape compatibility — controlled consumers own the Room.
|
|
2508
2606
|
// Internal session's getRoom returns null when no real connect has happened,
|
|
2509
2607
|
// so we reuse its reference for type consistency.
|
|
2510
|
-
getRoom:
|
|
2608
|
+
getRoom: V.getRoom,
|
|
2511
2609
|
isControlled: !0
|
|
2512
2610
|
} : {
|
|
2513
|
-
connectionState:
|
|
2514
|
-
agentState:
|
|
2515
|
-
transcript:
|
|
2516
|
-
videoElement:
|
|
2517
|
-
audioElement:
|
|
2518
|
-
canResume:
|
|
2519
|
-
error:
|
|
2520
|
-
agentConfig:
|
|
2521
|
-
connect:
|
|
2522
|
-
disconnect:
|
|
2523
|
-
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,
|
|
2524
2622
|
isControlled: !1
|
|
2525
|
-
}, [
|
|
2526
|
-
|
|
2527
|
-
const h = g.videoElement,
|
|
2528
|
-
if (!(!h || !
|
|
2529
|
-
return
|
|
2530
|
-
h.parentNode ===
|
|
2623
|
+
}, [Y, V]), Rt = A(null);
|
|
2624
|
+
M(() => {
|
|
2625
|
+
const h = g.videoElement, c = Rt.current;
|
|
2626
|
+
if (!(!h || !c))
|
|
2627
|
+
return c.appendChild(h), () => {
|
|
2628
|
+
h.parentNode === c && c.removeChild(h);
|
|
2531
2629
|
};
|
|
2532
|
-
}, [g.videoElement]),
|
|
2630
|
+
}, [g.videoElement]), M(() => {
|
|
2533
2631
|
const h = g.audioElement;
|
|
2534
2632
|
if (!h) return;
|
|
2535
|
-
|
|
2536
|
-
const
|
|
2537
|
-
return
|
|
2538
|
-
(
|
|
2633
|
+
Ge.attach(h);
|
|
2634
|
+
const c = h.play();
|
|
2635
|
+
return c && typeof c.catch == "function" && c.catch((J) => {
|
|
2636
|
+
(J == null ? void 0 : J.name) === "NotAllowedError" && ge(!0);
|
|
2539
2637
|
}), () => {
|
|
2540
|
-
|
|
2638
|
+
Ge.detach();
|
|
2541
2639
|
};
|
|
2542
|
-
}, [g.audioElement]),
|
|
2640
|
+
}, [g.audioElement]), M(() => {
|
|
2543
2641
|
if (g.isControlled || g.connectionState !== "connected") return;
|
|
2544
2642
|
const h = g.getRoom();
|
|
2545
2643
|
if (h)
|
|
2546
|
-
return
|
|
2547
|
-
}),
|
|
2548
|
-
|
|
2644
|
+
return re.setupMic(h, { startMuted: !0 }).catch(() => {
|
|
2645
|
+
}), ce.attachRoom(h), de.attachRoom(h), me.refresh(), () => {
|
|
2646
|
+
re.teardownMic(), ce.teardown(), de.teardown();
|
|
2549
2647
|
};
|
|
2550
2648
|
}, [g.isControlled, g.connectionState]);
|
|
2551
|
-
const [Xe,
|
|
2552
|
-
|
|
2649
|
+
const [Xe, kt] = E(!1), Lt = A("idle");
|
|
2650
|
+
M(() => {
|
|
2553
2651
|
if (g.connectionState === "idle" || g.connectionState === "disconnected") {
|
|
2554
|
-
|
|
2652
|
+
kt(!1), Lt.current = "idle";
|
|
2555
2653
|
return;
|
|
2556
2654
|
}
|
|
2557
|
-
!Xe &&
|
|
2558
|
-
}, [g.agentState, g.connectionState, Xe]),
|
|
2655
|
+
!Xe && Lt.current === "speaking" && g.agentState !== "speaking" && (kt(!0), re.setMuted(!1)), Lt.current = g.agentState;
|
|
2656
|
+
}, [g.agentState, g.connectionState, Xe]), M(() => {
|
|
2559
2657
|
if (g.connectionState !== "connected" || Xe) return;
|
|
2560
2658
|
const h = setTimeout(() => {
|
|
2561
|
-
|
|
2659
|
+
kt(!0), re.setMuted(!1);
|
|
2562
2660
|
}, 4e3);
|
|
2563
2661
|
return () => clearTimeout(h);
|
|
2564
|
-
}, [g.connectionState, Xe]),
|
|
2662
|
+
}, [g.connectionState, Xe]), M(() => {
|
|
2565
2663
|
const h = g.audioElement;
|
|
2566
|
-
h && (h.muted =
|
|
2567
|
-
}, [g.audioElement,
|
|
2568
|
-
const
|
|
2569
|
-
const
|
|
2570
|
-
if (
|
|
2664
|
+
h && (h.muted = Oe);
|
|
2665
|
+
}, [g.audioElement, Oe]);
|
|
2666
|
+
const ln = S((h) => {
|
|
2667
|
+
const c = g.getRoom();
|
|
2668
|
+
if (c)
|
|
2571
2669
|
try {
|
|
2572
|
-
const
|
|
2670
|
+
const J = new TextEncoder().encode(
|
|
2573
2671
|
JSON.stringify({ type: "user_message", text: h })
|
|
2574
2672
|
);
|
|
2575
|
-
|
|
2673
|
+
c.localParticipant.publishData(J, { reliable: !0 });
|
|
2576
2674
|
} catch {
|
|
2577
2675
|
}
|
|
2578
|
-
}, [g]),
|
|
2579
|
-
|
|
2676
|
+
}, [g]), an = S(() => {
|
|
2677
|
+
st((h) => !h);
|
|
2580
2678
|
}, []);
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
}, [g.connectionState,
|
|
2584
|
-
|
|
2585
|
-
}, [g.transcript,
|
|
2586
|
-
|
|
2587
|
-
}, [g.agentState,
|
|
2588
|
-
const
|
|
2589
|
-
|
|
2590
|
-
g.isControlled || !
|
|
2591
|
-
}, [
|
|
2592
|
-
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(
|
|
2593
2691
|
(h) => {
|
|
2594
|
-
const
|
|
2595
|
-
|
|
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)));
|
|
2596
2694
|
},
|
|
2597
2695
|
[
|
|
2598
|
-
|
|
2599
|
-
|
|
2696
|
+
D,
|
|
2697
|
+
Q,
|
|
2600
2698
|
g,
|
|
2601
|
-
|
|
2699
|
+
We,
|
|
2602
2700
|
v
|
|
2603
2701
|
]
|
|
2604
2702
|
);
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
}, [g.connectionState,
|
|
2608
|
-
if (!
|
|
2609
|
-
const h = (
|
|
2610
|
-
|
|
2703
|
+
M(() => {
|
|
2704
|
+
ye && g.connectionState === "connected" && Fe(!1);
|
|
2705
|
+
}, [g.connectionState, ye]), M(() => {
|
|
2706
|
+
if (!je) return;
|
|
2707
|
+
const h = (c) => {
|
|
2708
|
+
c.key === "Escape" && Je(!1);
|
|
2611
2709
|
};
|
|
2612
2710
|
return window.addEventListener("keydown", h), () => window.removeEventListener("keydown", h);
|
|
2613
|
-
}, [
|
|
2614
|
-
const
|
|
2615
|
-
|
|
2616
|
-
const
|
|
2617
|
-
() =>
|
|
2618
|
-
[
|
|
2619
|
-
),
|
|
2620
|
-
g.disconnect(),
|
|
2621
|
-
}, [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(() => {
|
|
2622
2720
|
const h = g.audioElement;
|
|
2623
|
-
h && h.play().then(() =>
|
|
2721
|
+
h && h.play().then(() => ge(!1)).catch(() => {
|
|
2624
2722
|
});
|
|
2625
|
-
}, [g.audioElement]),
|
|
2626
|
-
|
|
2627
|
-
}, [g]),
|
|
2628
|
-
...
|
|
2629
|
-
zIndex:
|
|
2723
|
+
}, [g.audioElement]), mn = S(() => {
|
|
2724
|
+
ge(!1), g.connect();
|
|
2725
|
+
}, [g]), Ze = {
|
|
2726
|
+
...wt,
|
|
2727
|
+
zIndex: at
|
|
2630
2728
|
};
|
|
2631
|
-
m.primaryColor && (
|
|
2632
|
-
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 = [
|
|
2633
2731
|
"ll-widget",
|
|
2634
|
-
`ll-widget--${
|
|
2635
|
-
`ll-widget--${
|
|
2636
|
-
|
|
2732
|
+
`ll-widget--${se}`,
|
|
2733
|
+
`ll-widget--${Ce ? "mobile" : "desktop"}`,
|
|
2734
|
+
vt
|
|
2637
2735
|
].filter(Boolean).join(" ");
|
|
2638
|
-
return
|
|
2736
|
+
return Pe ? /* @__PURE__ */ x(
|
|
2639
2737
|
"div",
|
|
2640
2738
|
{
|
|
2641
|
-
className:
|
|
2642
|
-
style:
|
|
2643
|
-
"data-display-mode":
|
|
2644
|
-
"data-position":
|
|
2739
|
+
className: gn,
|
|
2740
|
+
style: Ze,
|
|
2741
|
+
"data-display-mode": se,
|
|
2742
|
+
"data-position": w,
|
|
2645
2743
|
children: [
|
|
2646
|
-
|
|
2647
|
-
|
|
2744
|
+
se === "hidden" && /* @__PURE__ */ n(
|
|
2745
|
+
er,
|
|
2648
2746
|
{
|
|
2649
|
-
position:
|
|
2650
|
-
isMobile:
|
|
2747
|
+
position: w,
|
|
2748
|
+
isMobile: Ce,
|
|
2651
2749
|
isSpeaking: g.agentState === "speaking",
|
|
2652
|
-
onExpand: () =>
|
|
2653
|
-
label: `Open ${
|
|
2654
|
-
avatarImageUrl:
|
|
2655
|
-
agentName:
|
|
2750
|
+
onExpand: () => he("expanded"),
|
|
2751
|
+
label: `Open ${ft} widget`,
|
|
2752
|
+
avatarImageUrl: St,
|
|
2753
|
+
agentName: ft
|
|
2656
2754
|
}
|
|
2657
2755
|
),
|
|
2658
|
-
|
|
2659
|
-
|
|
2756
|
+
se === "minimized" && /* @__PURE__ */ n(
|
|
2757
|
+
nr,
|
|
2660
2758
|
{
|
|
2661
|
-
position:
|
|
2662
|
-
isMobile:
|
|
2663
|
-
agentName:
|
|
2664
|
-
avatarImageUrl:
|
|
2759
|
+
position: w,
|
|
2760
|
+
isMobile: Ce,
|
|
2761
|
+
agentName: ft,
|
|
2762
|
+
avatarImageUrl: St,
|
|
2665
2763
|
agentState: g.agentState,
|
|
2666
|
-
isMuted:
|
|
2667
|
-
audioLevel:
|
|
2668
|
-
onExpand:
|
|
2669
|
-
onToggleMute:
|
|
2670
|
-
onClose:
|
|
2764
|
+
isMuted: re.isMuted,
|
|
2765
|
+
audioLevel: Ge,
|
|
2766
|
+
onExpand: fn,
|
|
2767
|
+
onToggleMute: re.toggleMute,
|
|
2768
|
+
onClose: Tt
|
|
2671
2769
|
}
|
|
2672
2770
|
),
|
|
2673
|
-
|
|
2674
|
-
|
|
2771
|
+
se === "expanded" && /* @__PURE__ */ n(
|
|
2772
|
+
or,
|
|
2675
2773
|
{
|
|
2676
|
-
position:
|
|
2677
|
-
isMobile:
|
|
2678
|
-
agentName:
|
|
2679
|
-
avatarImageUrl:
|
|
2680
|
-
idleLoopUrl:
|
|
2681
|
-
greeting:
|
|
2774
|
+
position: w,
|
|
2775
|
+
isMobile: Ce,
|
|
2776
|
+
agentName: ft,
|
|
2777
|
+
avatarImageUrl: St,
|
|
2778
|
+
idleLoopUrl: dn,
|
|
2779
|
+
greeting: un,
|
|
2682
2780
|
branding: m,
|
|
2683
|
-
teamMembers:
|
|
2684
|
-
currentTeamMemberId:
|
|
2685
|
-
isSwitchingTeamMember:
|
|
2686
|
-
teamSwitcherOpen:
|
|
2687
|
-
onToggleTeamSwitcher: () =>
|
|
2688
|
-
onSelectTeamMember:
|
|
2781
|
+
teamMembers: D,
|
|
2782
|
+
currentTeamMemberId: Q,
|
|
2783
|
+
isSwitchingTeamMember: ye,
|
|
2784
|
+
teamSwitcherOpen: je,
|
|
2785
|
+
onToggleTeamSwitcher: () => Je((h) => !h),
|
|
2786
|
+
onSelectTeamMember: sn,
|
|
2689
2787
|
connectionState: g.connectionState,
|
|
2690
2788
|
agentState: g.agentState,
|
|
2691
2789
|
transcript: g.transcript,
|
|
2692
|
-
isMuted:
|
|
2693
|
-
micDevices:
|
|
2694
|
-
isCameraEnabled:
|
|
2695
|
-
cameraPreviewEl:
|
|
2696
|
-
cameraDevices:
|
|
2697
|
-
activeCameraId:
|
|
2698
|
-
isScreenShareEnabled:
|
|
2699
|
-
screenPreviewEl:
|
|
2700
|
-
isSpeakerMuted:
|
|
2701
|
-
allowCamera:
|
|
2702
|
-
allowScreenShare:
|
|
2703
|
-
allowTyping:
|
|
2704
|
-
languageMenuOpen:
|
|
2705
|
-
onToggleLanguageMenu: () =>
|
|
2706
|
-
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,
|
|
2707
2805
|
canResume: g.canResume,
|
|
2708
|
-
micError:
|
|
2806
|
+
micError: re.micError,
|
|
2709
2807
|
error: g.error,
|
|
2710
|
-
avatarVideoContainerRef:
|
|
2808
|
+
avatarVideoContainerRef: Rt,
|
|
2711
2809
|
agentVideoEl: g.videoElement,
|
|
2712
2810
|
micGateOpen: g.isControlled ? !0 : Xe,
|
|
2713
2811
|
onConnect: () => void g.connect(),
|
|
2714
2812
|
onDisconnect: () => g.disconnect(),
|
|
2715
|
-
onRetry:
|
|
2716
|
-
onResumeAudio:
|
|
2717
|
-
onToggleMute:
|
|
2718
|
-
onToggleCamera: () => void
|
|
2719
|
-
onSwitchCameraDevice: (h) => void
|
|
2720
|
-
onToggleScreenShare: () => void
|
|
2721
|
-
onToggleSpeaker:
|
|
2722
|
-
onSendMessage:
|
|
2723
|
-
onMinimize:
|
|
2724
|
-
onClose:
|
|
2725
|
-
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
|
|
2726
2824
|
}
|
|
2727
2825
|
)
|
|
2728
2826
|
]
|
|
2729
2827
|
}
|
|
2730
2828
|
) : null;
|
|
2731
2829
|
}
|
|
2732
|
-
function
|
|
2733
|
-
return /* @__PURE__ */ n(
|
|
2830
|
+
function Vr(e) {
|
|
2831
|
+
return /* @__PURE__ */ n(kn, { children: /* @__PURE__ */ n(Ir, { ...e }) });
|
|
2734
2832
|
}
|
|
2735
2833
|
const qr = ({
|
|
2736
2834
|
agentId: e,
|
|
2737
2835
|
baseUrl: t,
|
|
2738
2836
|
apiKey: r,
|
|
2739
|
-
mode:
|
|
2740
|
-
onAgentEvent:
|
|
2837
|
+
mode: o,
|
|
2838
|
+
onAgentEvent: i,
|
|
2741
2839
|
className: l,
|
|
2742
|
-
style:
|
|
2840
|
+
style: d
|
|
2743
2841
|
}) => {
|
|
2744
|
-
const u = A(null), f = A(null), y = A(
|
|
2745
|
-
y.current =
|
|
2746
|
-
const
|
|
2747
|
-
var
|
|
2842
|
+
const u = A(null), f = A(null), y = A(i);
|
|
2843
|
+
y.current = i;
|
|
2844
|
+
const w = S((s) => {
|
|
2845
|
+
var L;
|
|
2748
2846
|
const a = s.detail;
|
|
2749
|
-
(
|
|
2847
|
+
(L = y.current) == null || L.call(y, a);
|
|
2750
2848
|
}, []);
|
|
2751
|
-
return
|
|
2849
|
+
return M(() => {
|
|
2752
2850
|
const s = u.current;
|
|
2753
2851
|
if (!s) return;
|
|
2754
2852
|
const a = document.createElement("livelayer-widget");
|
|
2755
|
-
return a.setAttribute("agent-id", e), t && a.setAttribute("base-url", t), r && a.setAttribute("api-key", r),
|
|
2756
|
-
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;
|
|
2757
2855
|
};
|
|
2758
|
-
}, [e]),
|
|
2759
|
-
f.current && (
|
|
2760
|
-
}, [
|
|
2761
|
-
},
|
|
2762
|
-
function({ id: t, intent: r, as:
|
|
2763
|
-
return
|
|
2764
|
-
|
|
2856
|
+
}, [e]), M(() => {
|
|
2857
|
+
f.current && (o ? f.current.setAttribute("mode", o) : f.current.removeAttribute("mode"));
|
|
2858
|
+
}, [o]), /* @__PURE__ */ n("div", { ref: u, className: l, style: d });
|
|
2859
|
+
}, Wr = Nt(
|
|
2860
|
+
function({ id: t, intent: r, as: o = "div", className: i, style: l, children: d }, u) {
|
|
2861
|
+
return vn(
|
|
2862
|
+
o,
|
|
2765
2863
|
{
|
|
2766
2864
|
ref: u,
|
|
2767
2865
|
"data-ll-region": t,
|
|
2768
2866
|
"data-ll-intent": r,
|
|
2769
|
-
className:
|
|
2867
|
+
className: i,
|
|
2770
2868
|
style: l
|
|
2771
2869
|
},
|
|
2772
|
-
|
|
2870
|
+
d
|
|
2773
2871
|
);
|
|
2774
2872
|
}
|
|
2775
|
-
),
|
|
2776
|
-
function({ id: t, intent: r, children:
|
|
2873
|
+
), Gr = Nt(
|
|
2874
|
+
function({ id: t, intent: r, children: o, ...i }, l) {
|
|
2777
2875
|
return /* @__PURE__ */ n(
|
|
2778
2876
|
"form",
|
|
2779
2877
|
{
|
|
2780
2878
|
ref: l,
|
|
2781
2879
|
"data-ll-form": t,
|
|
2782
2880
|
"data-ll-intent": r,
|
|
2783
|
-
...
|
|
2784
|
-
children:
|
|
2881
|
+
...i,
|
|
2882
|
+
children: o
|
|
2785
2883
|
}
|
|
2786
2884
|
);
|
|
2787
2885
|
}
|
|
2788
|
-
), Fr =
|
|
2886
|
+
), Fr = Nt(
|
|
2789
2887
|
function(t, r) {
|
|
2790
|
-
const { name:
|
|
2888
|
+
const { name: o, label: i, labelClassName: l } = t, d = { name: o, "data-ll-field": o };
|
|
2791
2889
|
let u;
|
|
2792
2890
|
if ("as" in t && t.as === "textarea") {
|
|
2793
|
-
const { name: f, label: y, labelClassName:
|
|
2891
|
+
const { name: f, label: y, labelClassName: w, as: s, ...a } = t;
|
|
2794
2892
|
u = /* @__PURE__ */ n(
|
|
2795
2893
|
"textarea",
|
|
2796
2894
|
{
|
|
2797
2895
|
ref: r,
|
|
2798
|
-
...
|
|
2896
|
+
...d,
|
|
2799
2897
|
...a
|
|
2800
2898
|
}
|
|
2801
2899
|
);
|
|
2802
2900
|
} else if ("as" in t && t.as === "select") {
|
|
2803
|
-
const { name: f, label: y, labelClassName:
|
|
2901
|
+
const { name: f, label: y, labelClassName: w, as: s, children: a, ...L } = t;
|
|
2804
2902
|
u = /* @__PURE__ */ n(
|
|
2805
2903
|
"select",
|
|
2806
2904
|
{
|
|
2807
2905
|
ref: r,
|
|
2808
|
-
...
|
|
2809
|
-
...
|
|
2906
|
+
...d,
|
|
2907
|
+
...L,
|
|
2810
2908
|
children: a
|
|
2811
2909
|
}
|
|
2812
2910
|
);
|
|
2813
2911
|
} else {
|
|
2814
|
-
const { name: f, label: y, labelClassName:
|
|
2912
|
+
const { name: f, label: y, labelClassName: w, as: s, ...a } = t;
|
|
2815
2913
|
u = /* @__PURE__ */ n(
|
|
2816
2914
|
"input",
|
|
2817
2915
|
{
|
|
2818
2916
|
ref: r,
|
|
2819
|
-
...
|
|
2917
|
+
...d,
|
|
2820
2918
|
...a
|
|
2821
2919
|
}
|
|
2822
2920
|
);
|
|
2823
2921
|
}
|
|
2824
|
-
return
|
|
2825
|
-
|
|
2922
|
+
return i === void 0 ? u : /* @__PURE__ */ x("label", { className: l, children: [
|
|
2923
|
+
i,
|
|
2826
2924
|
u
|
|
2827
2925
|
] });
|
|
2828
2926
|
}
|
|
2829
2927
|
);
|
|
2830
|
-
let
|
|
2831
|
-
function
|
|
2928
|
+
let nn = 1;
|
|
2929
|
+
function jr({
|
|
2832
2930
|
onMount: e,
|
|
2833
2931
|
defaultOpen: t = !1,
|
|
2834
2932
|
storageKey: r = "ll-debug-open"
|
|
2835
2933
|
}) {
|
|
2836
|
-
const [
|
|
2837
|
-
|
|
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(() => {
|
|
2838
2936
|
try {
|
|
2839
2937
|
const v = localStorage.getItem(r);
|
|
2840
|
-
v === "1" &&
|
|
2938
|
+
v === "1" && i(!0), v === "0" && i(!1);
|
|
2841
2939
|
} catch {
|
|
2842
2940
|
}
|
|
2843
|
-
}, [r]),
|
|
2941
|
+
}, [r]), M(() => {
|
|
2844
2942
|
try {
|
|
2845
|
-
localStorage.setItem(r,
|
|
2943
|
+
localStorage.setItem(r, o ? "1" : "0");
|
|
2846
2944
|
} catch {
|
|
2847
2945
|
}
|
|
2848
|
-
}, [
|
|
2849
|
-
const v = (
|
|
2850
|
-
(
|
|
2946
|
+
}, [o, r]), M(() => {
|
|
2947
|
+
const v = (_) => {
|
|
2948
|
+
(_.metaKey || _.ctrlKey) && _.shiftKey && _.key.toLowerCase() === "l" && (_.preventDefault(), i((O) => !O));
|
|
2851
2949
|
};
|
|
2852
2950
|
return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
|
|
2853
|
-
}, []),
|
|
2951
|
+
}, []), M(() => {
|
|
2854
2952
|
const v = setInterval(() => {
|
|
2855
|
-
if (a.current.length === 0 ||
|
|
2856
|
-
const
|
|
2857
|
-
|
|
2858
|
-
(
|
|
2953
|
+
if (a.current.length === 0 || L.current) return;
|
|
2954
|
+
const _ = a.current.splice(0, a.current.length);
|
|
2955
|
+
d(
|
|
2956
|
+
(O) => [..._.reverse(), ...O].slice(0, 200)
|
|
2859
2957
|
);
|
|
2860
2958
|
}, 100);
|
|
2861
2959
|
return () => clearInterval(v);
|
|
2862
2960
|
}, []);
|
|
2863
|
-
const
|
|
2864
|
-
if (
|
|
2865
|
-
!e ||
|
|
2961
|
+
const D = A(!1);
|
|
2962
|
+
if (M(() => {
|
|
2963
|
+
!e || D.current || (D.current = !0, e((v) => {
|
|
2866
2964
|
a.current.push({
|
|
2867
|
-
id:
|
|
2965
|
+
id: nn++,
|
|
2868
2966
|
ts: Date.now(),
|
|
2869
2967
|
kind: "event",
|
|
2870
2968
|
type: v.eventName,
|
|
2871
2969
|
data: v.data
|
|
2872
2970
|
});
|
|
2873
2971
|
}));
|
|
2874
|
-
}, [e]),
|
|
2875
|
-
const v = console.warn,
|
|
2972
|
+
}, [e]), M(() => {
|
|
2973
|
+
const v = console.warn, _ = console.log, O = ($, U) => function(...m) {
|
|
2876
2974
|
try {
|
|
2877
|
-
const
|
|
2878
|
-
|
|
2879
|
-
id:
|
|
2975
|
+
const I = typeof m[0] == "string" ? m[0] : "";
|
|
2976
|
+
I.startsWith("[LiveLayer]") && a.current.push({
|
|
2977
|
+
id: nn++,
|
|
2880
2978
|
ts: Date.now(),
|
|
2881
|
-
kind:
|
|
2882
|
-
type:
|
|
2883
|
-
data: { args: m.slice(1).map((
|
|
2979
|
+
kind: $,
|
|
2980
|
+
type: I.slice(0, 120),
|
|
2981
|
+
data: { args: m.slice(1).map((q) => $r(q)) }
|
|
2884
2982
|
});
|
|
2885
2983
|
} catch {
|
|
2886
2984
|
}
|
|
2887
|
-
return
|
|
2985
|
+
return U.apply(this, m);
|
|
2888
2986
|
};
|
|
2889
|
-
return console.warn =
|
|
2890
|
-
console.warn = v, console.log =
|
|
2987
|
+
return console.warn = O("warn", v), console.log = O("log", _), () => {
|
|
2988
|
+
console.warn = v, console.log = _;
|
|
2891
2989
|
};
|
|
2892
|
-
}, []), !
|
|
2990
|
+
}, []), !o)
|
|
2893
2991
|
return /* @__PURE__ */ n(
|
|
2894
2992
|
"button",
|
|
2895
2993
|
{
|
|
2896
2994
|
type: "button",
|
|
2897
|
-
onClick: () =>
|
|
2995
|
+
onClick: () => i(!0),
|
|
2898
2996
|
title: "Open LiveLayer debug panel (Cmd/Ctrl + Shift + L)",
|
|
2899
2997
|
"aria-label": "Open LiveLayer debug panel",
|
|
2900
2998
|
style: {
|
|
@@ -2918,10 +3016,10 @@ function Ur({
|
|
|
2918
3016
|
);
|
|
2919
3017
|
const C = l.filter((v) => {
|
|
2920
3018
|
if (!u) return !0;
|
|
2921
|
-
const
|
|
2922
|
-
return v.type.toLowerCase().includes(
|
|
3019
|
+
const _ = u.toLowerCase();
|
|
3020
|
+
return v.type.toLowerCase().includes(_) || JSON.stringify(v.data || {}).toLowerCase().includes(_);
|
|
2923
3021
|
});
|
|
2924
|
-
return /* @__PURE__ */
|
|
3022
|
+
return /* @__PURE__ */ x(
|
|
2925
3023
|
"div",
|
|
2926
3024
|
{
|
|
2927
3025
|
style: {
|
|
@@ -2943,7 +3041,7 @@ function Ur({
|
|
|
2943
3041
|
overflow: "hidden"
|
|
2944
3042
|
},
|
|
2945
3043
|
children: [
|
|
2946
|
-
/* @__PURE__ */
|
|
3044
|
+
/* @__PURE__ */ x(
|
|
2947
3045
|
"div",
|
|
2948
3046
|
{
|
|
2949
3047
|
style: {
|
|
@@ -2956,7 +3054,7 @@ function Ur({
|
|
|
2956
3054
|
},
|
|
2957
3055
|
children: [
|
|
2958
3056
|
/* @__PURE__ */ n("span", { style: { fontWeight: 600, fontSize: 12 }, children: "LiveLayer debug" }),
|
|
2959
|
-
/* @__PURE__ */
|
|
3057
|
+
/* @__PURE__ */ x("span", { style: { fontSize: 10, color: "rgba(255,255,255,0.4)" }, children: [
|
|
2960
3058
|
l.length,
|
|
2961
3059
|
" event",
|
|
2962
3060
|
l.length === 1 ? "" : "s"
|
|
@@ -2966,8 +3064,8 @@ function Ur({
|
|
|
2966
3064
|
"button",
|
|
2967
3065
|
{
|
|
2968
3066
|
type: "button",
|
|
2969
|
-
onClick: () =>
|
|
2970
|
-
style:
|
|
3067
|
+
onClick: () => w((v) => !v),
|
|
3068
|
+
style: Et(y ? "#f59e0b" : "transparent"),
|
|
2971
3069
|
title: "Pause / resume capture",
|
|
2972
3070
|
children: y ? "▶ resume" : "⏸ pause"
|
|
2973
3071
|
}
|
|
@@ -2977,9 +3075,9 @@ function Ur({
|
|
|
2977
3075
|
{
|
|
2978
3076
|
type: "button",
|
|
2979
3077
|
onClick: () => {
|
|
2980
|
-
|
|
3078
|
+
d([]), a.current = [];
|
|
2981
3079
|
},
|
|
2982
|
-
style:
|
|
3080
|
+
style: Et("transparent"),
|
|
2983
3081
|
title: "Clear buffer",
|
|
2984
3082
|
children: "clear"
|
|
2985
3083
|
}
|
|
@@ -2988,8 +3086,8 @@ function Ur({
|
|
|
2988
3086
|
"button",
|
|
2989
3087
|
{
|
|
2990
3088
|
type: "button",
|
|
2991
|
-
onClick: () =>
|
|
2992
|
-
style:
|
|
3089
|
+
onClick: () => i(!1),
|
|
3090
|
+
style: Et("transparent"),
|
|
2993
3091
|
"aria-label": "Close",
|
|
2994
3092
|
title: "Close (Cmd/Ctrl + Shift + L)",
|
|
2995
3093
|
children: "✕"
|
|
@@ -3025,7 +3123,7 @@ function Ur({
|
|
|
3025
3123
|
overflowY: "auto",
|
|
3026
3124
|
padding: "0 8px 8px"
|
|
3027
3125
|
},
|
|
3028
|
-
children: C.length === 0 ? /* @__PURE__ */
|
|
3126
|
+
children: C.length === 0 ? /* @__PURE__ */ x(
|
|
3029
3127
|
"div",
|
|
3030
3128
|
{
|
|
3031
3129
|
style: {
|
|
@@ -3056,12 +3154,12 @@ function Ur({
|
|
|
3056
3154
|
]
|
|
3057
3155
|
}
|
|
3058
3156
|
) : C.map((v) => /* @__PURE__ */ n(
|
|
3059
|
-
|
|
3157
|
+
Pr,
|
|
3060
3158
|
{
|
|
3061
3159
|
entry: v,
|
|
3062
3160
|
expanded: s.current.has(v.id),
|
|
3063
3161
|
onToggle: () => {
|
|
3064
|
-
s.current.has(v.id) ? s.current.delete(v.id) : s.current.add(v.id),
|
|
3162
|
+
s.current.has(v.id) ? s.current.delete(v.id) : s.current.add(v.id), d((_) => [..._]);
|
|
3065
3163
|
}
|
|
3066
3164
|
},
|
|
3067
3165
|
v.id
|
|
@@ -3072,15 +3170,15 @@ function Ur({
|
|
|
3072
3170
|
}
|
|
3073
3171
|
);
|
|
3074
3172
|
}
|
|
3075
|
-
function
|
|
3173
|
+
function Pr({
|
|
3076
3174
|
entry: e,
|
|
3077
3175
|
expanded: t,
|
|
3078
3176
|
onToggle: r
|
|
3079
3177
|
}) {
|
|
3080
|
-
const
|
|
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", {
|
|
3081
3179
|
hour12: !1
|
|
3082
3180
|
});
|
|
3083
|
-
return /* @__PURE__ */
|
|
3181
|
+
return /* @__PURE__ */ x(
|
|
3084
3182
|
"button",
|
|
3085
3183
|
{
|
|
3086
3184
|
type: "button",
|
|
@@ -3098,7 +3196,7 @@ function Ir({
|
|
|
3098
3196
|
lineHeight: 1.4
|
|
3099
3197
|
},
|
|
3100
3198
|
children: [
|
|
3101
|
-
/* @__PURE__ */
|
|
3199
|
+
/* @__PURE__ */ x("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
3102
3200
|
/* @__PURE__ */ n(
|
|
3103
3201
|
"span",
|
|
3104
3202
|
{
|
|
@@ -3107,14 +3205,14 @@ function Ir({
|
|
|
3107
3205
|
fontVariantNumeric: "tabular-nums",
|
|
3108
3206
|
fontSize: 10
|
|
3109
3207
|
},
|
|
3110
|
-
children:
|
|
3208
|
+
children: i
|
|
3111
3209
|
}
|
|
3112
3210
|
),
|
|
3113
3211
|
/* @__PURE__ */ n(
|
|
3114
3212
|
"span",
|
|
3115
3213
|
{
|
|
3116
3214
|
style: {
|
|
3117
|
-
color:
|
|
3215
|
+
color: o,
|
|
3118
3216
|
fontWeight: 600,
|
|
3119
3217
|
flexShrink: 0
|
|
3120
3218
|
},
|
|
@@ -3142,7 +3240,7 @@ function Ir({
|
|
|
3142
3240
|
}
|
|
3143
3241
|
);
|
|
3144
3242
|
}
|
|
3145
|
-
function
|
|
3243
|
+
function Et(e) {
|
|
3146
3244
|
return {
|
|
3147
3245
|
background: e,
|
|
3148
3246
|
color: "#fff",
|
|
@@ -3153,59 +3251,59 @@ function Lt(e) {
|
|
|
3153
3251
|
cursor: "pointer"
|
|
3154
3252
|
};
|
|
3155
3253
|
}
|
|
3156
|
-
function
|
|
3254
|
+
function $r(e) {
|
|
3157
3255
|
try {
|
|
3158
3256
|
return e instanceof Error ? { message: e.message, stack: e.stack } : (JSON.stringify(e), e);
|
|
3159
3257
|
} catch {
|
|
3160
3258
|
return String(e);
|
|
3161
3259
|
}
|
|
3162
3260
|
}
|
|
3163
|
-
function
|
|
3164
|
-
const [e, t] =
|
|
3261
|
+
function Jr() {
|
|
3262
|
+
const [e, t] = E([]), r = S((i) => {
|
|
3165
3263
|
t((l) => {
|
|
3166
|
-
const
|
|
3167
|
-
if (
|
|
3264
|
+
const d = l.findIndex((u) => u.id === i.id);
|
|
3265
|
+
if (d >= 0) {
|
|
3168
3266
|
const u = l.slice();
|
|
3169
|
-
return u[
|
|
3267
|
+
return u[d] = i, u;
|
|
3170
3268
|
}
|
|
3171
|
-
return [...l,
|
|
3269
|
+
return [...l, i];
|
|
3172
3270
|
});
|
|
3173
|
-
}, []),
|
|
3271
|
+
}, []), o = S(() => t([]), []);
|
|
3174
3272
|
return {
|
|
3175
3273
|
entries: e,
|
|
3176
3274
|
pushSegment: r,
|
|
3177
|
-
clear:
|
|
3275
|
+
clear: o,
|
|
3178
3276
|
latest: e.length > 0 ? e[e.length - 1] : null
|
|
3179
3277
|
};
|
|
3180
3278
|
}
|
|
3181
3279
|
export {
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3280
|
+
Vr as AvatarWidget,
|
|
3281
|
+
kn as ErrorBoundary,
|
|
3282
|
+
jr as LiveLayerDebugPanel,
|
|
3185
3283
|
Fr as LiveLayerField,
|
|
3186
|
-
|
|
3187
|
-
|
|
3284
|
+
Gr as LiveLayerForm,
|
|
3285
|
+
Wr as LiveLayerRegion,
|
|
3188
3286
|
qr as LiveLayerWidget,
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3287
|
+
vr as clearPageContextCache,
|
|
3288
|
+
Sr as clearRoutesCache,
|
|
3289
|
+
br as extractPageContext,
|
|
3290
|
+
kr as extractRoutes,
|
|
3291
|
+
mt as getCachedPageContext,
|
|
3292
|
+
nt as getCachedRoutes,
|
|
3195
3293
|
Fn as matchesPattern,
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
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
|
|
3211
3309
|
};
|