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