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