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