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