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