@burdenoff/fe-libs 2026.1029.2 → 2026.1029.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/shared/assistant/turnTimeline.js +1 -1
- package/dist/shared/assistant/turnTimingReporter.d.ts +11 -0
- package/dist/shared/assistant/turnTimingReporter.js +73 -56
- package/dist/shared/assistant/ui/AssistantChatArea.js +129 -129
- package/dist/shared/assistant/ui/AssistantSpeechProvider.js +134 -129
- package/dist/shared/assistant/ui/useVoiceSession.js +201 -177
- package/dist/shared/assistant/voice/voiceSession.d.ts +7 -0
- package/dist/shared/assistant/voice/voiceSession.js +10 -1
- package/dist/shared-assistant.js +210 -210
- package/package.json +1 -1
|
@@ -19,10 +19,11 @@ import { isTurnInFlight as fe } from "../turnState.js";
|
|
|
19
19
|
import { parseToolActivity as pe } from "./AssistantToolActivity.js";
|
|
20
20
|
import "../speech/index.js";
|
|
21
21
|
import { beginListenTurn as me, finishListenTurn as b, markTurn as he } from "../turnTimeline.js";
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
22
|
+
import { registerTurnTimingPageExit as ge } from "../turnTimingReporter.js";
|
|
23
|
+
import { createContext as _e, useCallback as x, useContext as ve, useEffect as S, useMemo as C, useReducer as ye, useRef as w, useState as T, useSyncExternalStore as be } from "react";
|
|
24
|
+
import { jsx as xe } from "react/jsx-runtime";
|
|
24
25
|
//#region src/shared/assistant/ui/AssistantSpeechProvider.tsx
|
|
25
|
-
var
|
|
26
|
+
var Se = {
|
|
26
27
|
codeBlock: "",
|
|
27
28
|
image: "",
|
|
28
29
|
link: "",
|
|
@@ -31,20 +32,20 @@ var xe = {
|
|
|
31
32
|
emailAt: "at",
|
|
32
33
|
emailDot: "dot",
|
|
33
34
|
nestedItem: ""
|
|
34
|
-
},
|
|
35
|
+
}, Ce = 4e3, E = () => {}, we = {
|
|
35
36
|
subscribe: () => E,
|
|
36
37
|
getSnapshot: () => !1
|
|
37
|
-
},
|
|
38
|
+
}, Te = {
|
|
38
39
|
subscribe: h,
|
|
39
40
|
getSnapshot: f
|
|
40
41
|
};
|
|
41
|
-
function
|
|
42
|
+
function Ee(e, t) {
|
|
42
43
|
return re(t) ? {
|
|
43
44
|
...e,
|
|
44
45
|
autoSpeakEnabled: !0
|
|
45
46
|
} : e;
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
+
function De(e, t) {
|
|
48
49
|
let n = e.activeConversationId;
|
|
49
50
|
if (!n || n !== t.activeConversationId) return null;
|
|
50
51
|
let r = e.processingByConversationId[n], i = t.processingByConversationId[n];
|
|
@@ -54,7 +55,7 @@ function Ee(e, t) {
|
|
|
54
55
|
let o = e.conversations.find((e) => e.id === n)?.messages.find((e) => e.id === a);
|
|
55
56
|
return o && o.role === "assistant" ? o : null;
|
|
56
57
|
}
|
|
57
|
-
var
|
|
58
|
+
var Oe = _e({
|
|
58
59
|
isSupported: !1,
|
|
59
60
|
availability: "unsupported",
|
|
60
61
|
isBlocked: !0,
|
|
@@ -80,18 +81,18 @@ var De = ge({
|
|
|
80
81
|
previewVoice: () => {}
|
|
81
82
|
});
|
|
82
83
|
function D() {
|
|
83
|
-
return
|
|
84
|
+
return ve(Oe);
|
|
84
85
|
}
|
|
85
|
-
var O = ({ children: f, visible: h = !0, engine:
|
|
86
|
-
let
|
|
86
|
+
var O = ({ children: f, visible: h = !0, engine: _e }) => {
|
|
87
|
+
let ve = be(ne, u, u), E = _e ?? ve, D = t(), { locale: O } = e(), [k, A] = ye(de, ce), [j, M] = T(() => E.listVoices()), [N, ke] = T(!1), [Ae, P] = T(() => /* @__PURE__ */ new Map()), [je, F] = T(() => /* @__PURE__ */ new Set()), [Me, Ne] = T(null), I = w(0), L = w(null), R = w(null), z = w(void 0), B = w(null), V = w(null);
|
|
87
88
|
S(() => () => {
|
|
88
89
|
V.current !== null && clearTimeout(V.current);
|
|
89
90
|
}, []);
|
|
90
|
-
let [
|
|
91
|
+
let [Pe, Fe] = T(null), H = w(null), Ie = w(() => {}), U = x(() => {
|
|
91
92
|
H.current?.(), H.current = null;
|
|
92
|
-
}, []), W = n((e) => e.autoSpeakEnabled),
|
|
93
|
-
|
|
94
|
-
}, []),
|
|
93
|
+
}, []), W = n((e) => e.autoSpeakEnabled), Le = n((e) => e.setAutoSpeak), [G, Re] = T(!1), ze = w(!1), Be = x((e) => {
|
|
94
|
+
ze.current = e;
|
|
95
|
+
}, []), Ve = n((e) => e.activeConversationId), K = C(() => E.isSupported(), [E]), He = E.wouldSpeakOnAvatar === void 0 ? we : Te, Ue = be(He.subscribe, He.getSnapshot, He.getSnapshot);
|
|
95
96
|
S(() => {
|
|
96
97
|
if (!K) return;
|
|
97
98
|
let e = () => {
|
|
@@ -99,16 +100,16 @@ var O = ({ children: f, visible: h = !0, engine: ge }) => {
|
|
|
99
100
|
};
|
|
100
101
|
return e(), E.subscribeVoices(e);
|
|
101
102
|
}, [E, K]);
|
|
102
|
-
let
|
|
103
|
-
Ue,
|
|
103
|
+
let We = n((e) => e.assistantLanguage), Ge = n((e) => e.replyLanguage), q = n((e) => e.preferredVoices), Ke = n((e) => e.setPreferredVoice), J = C(() => y(We, Ge, O).reply, [
|
|
104
104
|
We,
|
|
105
|
+
Ge,
|
|
105
106
|
O
|
|
106
|
-
]), Y = J.code,
|
|
107
|
+
]), Y = J.code, qe = x((e) => ae(e)?.tag ?? c(e), []), Je = x((e) => ae(e)?.rate ?? .9, []), Ye = C(() => te(K, j, J.tag, N), [
|
|
107
108
|
K,
|
|
108
109
|
j,
|
|
109
110
|
J,
|
|
110
111
|
N
|
|
111
|
-
]),
|
|
112
|
+
]), Xe = C(() => ({
|
|
112
113
|
codeBlock: D("speech.codeBlock", "Code block"),
|
|
113
114
|
image: D("speech.image", "image"),
|
|
114
115
|
link: D("speech.link", "link"),
|
|
@@ -117,16 +118,16 @@ var O = ({ children: f, visible: h = !0, engine: ge }) => {
|
|
|
117
118
|
nestedItem: D("speech.nestedItem", "Sub-item {{ordinal}}"),
|
|
118
119
|
emailAt: D("speech.emailAt", "at"),
|
|
119
120
|
emailDot: D("speech.emailDot", "dot")
|
|
120
|
-
}), [D]),
|
|
121
|
+
}), [D]), X = x(() => {
|
|
121
122
|
U(), R.current = null, b(z.current, "stopped"), z.current = void 0, E.cancel(), m(L.current, "stopped"), A({ type: "stop" });
|
|
122
|
-
}, [U, E]),
|
|
123
|
+
}, [U, E]), Ze = x((e) => {
|
|
123
124
|
let t = E.listVoices().find((t) => t.name === e) ?? null;
|
|
124
125
|
if (t) {
|
|
125
|
-
|
|
126
|
+
X();
|
|
126
127
|
try {
|
|
127
128
|
E.speak([v(Y)], {
|
|
128
129
|
voice: t,
|
|
129
|
-
lang:
|
|
130
|
+
lang: qe(Y),
|
|
130
131
|
fallback: !1
|
|
131
132
|
});
|
|
132
133
|
} catch {}
|
|
@@ -134,43 +135,43 @@ var O = ({ children: f, visible: h = !0, engine: ge }) => {
|
|
|
134
135
|
}, [
|
|
135
136
|
E,
|
|
136
137
|
Y,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
]),
|
|
138
|
+
X,
|
|
139
|
+
qe
|
|
140
|
+
]), Qe = x((e) => Ae.get(e) ?? null, [Ae]), $e = x((e) => je.has(e) ? D("speech.deviceFallback", "Device voice used: the selected voice was unavailable.") : null, [je, D]), et = x((e, t, n, r, i) => {
|
|
140
141
|
U();
|
|
141
142
|
let o = !1, s = () => {}, ee = (a) => {
|
|
142
143
|
if (!o) {
|
|
143
144
|
if (o = !0, H.current = null, clearTimeout(c), s(), a.length === 0) {
|
|
144
|
-
|
|
145
|
+
ke(!0), m(e, "declined");
|
|
145
146
|
return;
|
|
146
147
|
}
|
|
147
|
-
M(a),
|
|
148
|
+
M(a), Ie.current(e, t, a, n, r, i);
|
|
148
149
|
}
|
|
149
150
|
}, c = setTimeout(() => ee(E.listVoices()), a);
|
|
150
151
|
s = E.subscribeVoices(() => ee(E.listVoices())), H.current = () => {
|
|
151
152
|
o || (o = !0, clearTimeout(c), s(), H.current = null, m(e, "stopped"));
|
|
152
153
|
};
|
|
153
|
-
}, [U, E]),
|
|
154
|
+
}, [U, E]), tt = x((e, t, n, r, a = !1, c) => {
|
|
154
155
|
let l = n;
|
|
155
156
|
if (l.length === 0) {
|
|
156
157
|
let e = E.listVoices();
|
|
157
158
|
e.length > 0 && (l = e, M(e));
|
|
158
159
|
}
|
|
159
|
-
let u =
|
|
160
|
+
let u = qe(r), ne = ee(te(!0, l, r, N));
|
|
160
161
|
if (ne === "block") {
|
|
161
162
|
let t = D("speech.noVoiceForReply", "This reply is in {{language}}, and no {{language}} voice is installed on this device.", { language: o(u, O) });
|
|
162
163
|
P((n) => new Map(n).set(e, t)), m(e, "declined");
|
|
163
164
|
return;
|
|
164
165
|
}
|
|
165
166
|
if (ne === "wait-for-voices") {
|
|
166
|
-
|
|
167
|
+
et(e, t, r, a, c);
|
|
167
168
|
return;
|
|
168
169
|
}
|
|
169
170
|
let d = {
|
|
170
171
|
voice: s(l, u, q[r]),
|
|
171
172
|
lang: u,
|
|
172
|
-
rate:
|
|
173
|
-
}, f =
|
|
173
|
+
rate: Je(r)
|
|
174
|
+
}, f = rt.current;
|
|
174
175
|
if (a && !f.autoSpeakEnabled && !f.sessionSpeaking && re(e)) {
|
|
175
176
|
if (E.wouldSpeakOnAvatar?.(d) !== !0) {
|
|
176
177
|
m(e, "declined");
|
|
@@ -198,13 +199,13 @@ var O = ({ children: f, visible: h = !0, engine: ge }) => {
|
|
|
198
199
|
let _ = a ? void 0 : me(e);
|
|
199
200
|
z.current = _;
|
|
200
201
|
let v = c === void 0 ? ie(t) : ie(t, void 0, void 0, { firstChunkMaxChars: c });
|
|
201
|
-
|
|
202
|
+
Fe({
|
|
202
203
|
requestId: g,
|
|
203
204
|
chunks: v,
|
|
204
205
|
index: -1
|
|
205
206
|
}), V.current !== null && clearTimeout(V.current), V.current = setTimeout(() => {
|
|
206
|
-
|
|
207
|
-
},
|
|
207
|
+
Fe((e) => e?.requestId === g && e.index < 0 ? null : e);
|
|
208
|
+
}, Ce);
|
|
208
209
|
let ae = () => {
|
|
209
210
|
b(_, "failed"), I.current === g && V.current !== null && (clearTimeout(V.current), V.current = null), m(e, "failed"), A({
|
|
210
211
|
type: "failed",
|
|
@@ -217,7 +218,7 @@ var O = ({ children: f, visible: h = !0, engine: ge }) => {
|
|
|
217
218
|
I.current === g && b(_, "answered"), I.current === g && R.current === g && he(e, "firstAudio");
|
|
218
219
|
},
|
|
219
220
|
onChunkStart: (e) => {
|
|
220
|
-
y = !0, I.current === g && V.current !== null && (clearTimeout(V.current), V.current = null),
|
|
221
|
+
y = !0, I.current === g && V.current !== null && (clearTimeout(V.current), V.current = null), Fe((t) => t?.requestId === g ? {
|
|
221
222
|
...t,
|
|
222
223
|
index: e
|
|
223
224
|
} : I.current === g ? {
|
|
@@ -240,7 +241,7 @@ var O = ({ children: f, visible: h = !0, engine: ge }) => {
|
|
|
240
241
|
if (!t.has(e)) return t;
|
|
241
242
|
let n = new Set(t);
|
|
242
243
|
return n.delete(e), n;
|
|
243
|
-
}), t === "output-not-cleared" && I.current === g &&
|
|
244
|
+
}), t === "output-not-cleared" && I.current === g && Ne({ messageId: e }), m(e, t === "output-not-cleared" ? "not-cleared" : t === "output-left" ? y ? "cut" : "declined" : t === "cancelled" ? "stopped" : "failed"), A({
|
|
244
245
|
type: "failed",
|
|
245
246
|
requestId: g
|
|
246
247
|
});
|
|
@@ -254,47 +255,47 @@ var O = ({ children: f, visible: h = !0, engine: ge }) => {
|
|
|
254
255
|
E,
|
|
255
256
|
O,
|
|
256
257
|
q,
|
|
258
|
+
Je,
|
|
257
259
|
qe,
|
|
258
|
-
Ke,
|
|
259
260
|
D,
|
|
260
261
|
N,
|
|
261
|
-
|
|
262
|
+
et
|
|
262
263
|
]);
|
|
263
264
|
S(() => {
|
|
264
|
-
|
|
265
|
-
}, [
|
|
266
|
-
let
|
|
265
|
+
Ie.current = tt;
|
|
266
|
+
}, [tt]);
|
|
267
|
+
let Z = x((e, t, n, r) => {
|
|
267
268
|
if (!K) return;
|
|
268
|
-
let i = se(_(t, { labels:
|
|
269
|
-
a &&
|
|
269
|
+
let i = se(_(t, { labels: Se }), n ?? Y), a = _(t, { labels: oe(i, Xe) });
|
|
270
|
+
a && tt(e, a, j, i, r?.auto === !0, r?.firstChunkMaxChars);
|
|
270
271
|
}, [
|
|
271
272
|
K,
|
|
272
|
-
|
|
273
|
+
Xe,
|
|
273
274
|
Y,
|
|
274
|
-
|
|
275
|
+
tt,
|
|
275
276
|
j
|
|
276
|
-
]),
|
|
277
|
+
]), nt = x((e, t, n) => {
|
|
277
278
|
if (le(k, e)) {
|
|
278
|
-
|
|
279
|
+
X();
|
|
279
280
|
return;
|
|
280
281
|
}
|
|
281
|
-
|
|
282
|
+
Z(e, t, n);
|
|
282
283
|
}, [
|
|
283
284
|
k,
|
|
284
|
-
|
|
285
|
-
|
|
285
|
+
Z,
|
|
286
|
+
X
|
|
286
287
|
]);
|
|
287
288
|
S(() => {
|
|
288
|
-
h ||
|
|
289
|
-
}, [h,
|
|
290
|
-
let
|
|
289
|
+
h || X();
|
|
290
|
+
}, [h, X]);
|
|
291
|
+
let rt = w({
|
|
291
292
|
autoSpeakEnabled: W,
|
|
292
293
|
sessionSpeaking: G,
|
|
293
294
|
visible: h,
|
|
294
295
|
isSupported: K
|
|
295
296
|
});
|
|
296
297
|
S(() => {
|
|
297
|
-
|
|
298
|
+
rt.current = {
|
|
298
299
|
autoSpeakEnabled: W,
|
|
299
300
|
sessionSpeaking: G,
|
|
300
301
|
visible: h,
|
|
@@ -306,25 +307,29 @@ var O = ({ children: f, visible: h = !0, engine: ge }) => {
|
|
|
306
307
|
h,
|
|
307
308
|
K
|
|
308
309
|
]);
|
|
309
|
-
let
|
|
310
|
+
let it = w(null), at = w(null), ot = w(() => {});
|
|
310
311
|
S(() => {
|
|
311
|
-
|
|
312
|
-
let e =
|
|
313
|
-
|
|
314
|
-
}, [
|
|
315
|
-
P((e) => e.size === 0 ? e : /* @__PURE__ */ new Map()),
|
|
316
|
-
}, [Y,
|
|
317
|
-
H.current?.(), H.current = null, E.cancel();
|
|
312
|
+
X(), P(/* @__PURE__ */ new Map()), F(/* @__PURE__ */ new Set()), p(n.getState().activeConversationId), it.current = Ve;
|
|
313
|
+
let e = at.current;
|
|
314
|
+
at.current = null, e && e.conversationId === Ve && ot.current(e.conversationId, e.messageId);
|
|
315
|
+
}, [Ve, X]), S(() => {
|
|
316
|
+
P((e) => e.size === 0 ? e : /* @__PURE__ */ new Map()), X();
|
|
317
|
+
}, [Y, X]), S(() => () => {
|
|
318
|
+
H.current?.(), H.current = null, b(z.current, "stopped"), z.current = void 0, E.cancel();
|
|
318
319
|
}, [E]), S(() => {
|
|
319
320
|
if (typeof window > "u") return;
|
|
320
|
-
let e = () =>
|
|
321
|
-
|
|
321
|
+
let { settle: e, unregister: t } = ge(() => (b(z.current, "stopped"), z.current)), n = () => {
|
|
322
|
+
e(), z.current = void 0, E.cancel();
|
|
323
|
+
};
|
|
324
|
+
return window.addEventListener("pagehide", n), () => {
|
|
325
|
+
t(), window.removeEventListener("pagehide", n);
|
|
326
|
+
};
|
|
322
327
|
}, [E]), S(() => {
|
|
323
328
|
if (typeof document > "u" || !K) return;
|
|
324
329
|
let e = () => {
|
|
325
330
|
if (document.visibilityState !== "visible") return;
|
|
326
331
|
let e = E.listVoices();
|
|
327
|
-
e.length > 0 && U(), M(e),
|
|
332
|
+
e.length > 0 && U(), M(e), ke(!1), P((e) => e.size === 0 ? e : /* @__PURE__ */ new Map());
|
|
328
333
|
};
|
|
329
334
|
return document.addEventListener("visibilitychange", e), window.addEventListener("focus", e), () => {
|
|
330
335
|
document.removeEventListener("visibilitychange", e), window.removeEventListener("focus", e);
|
|
@@ -334,34 +339,34 @@ var O = ({ children: f, visible: h = !0, engine: ge }) => {
|
|
|
334
339
|
E,
|
|
335
340
|
K
|
|
336
341
|
]);
|
|
337
|
-
let
|
|
342
|
+
let st = w(Z);
|
|
338
343
|
S(() => {
|
|
339
|
-
|
|
340
|
-
}, [
|
|
341
|
-
let
|
|
342
|
-
if (r(e) !== t || g(e.id) || B.current?.messageId === e.id ||
|
|
344
|
+
st.current = Z;
|
|
345
|
+
}, [Z]);
|
|
346
|
+
let Q = x((e, t) => {
|
|
347
|
+
if (r(e) !== t || g(e.id) || B.current?.messageId === e.id || ze.current) return;
|
|
343
348
|
let { text: n } = pe(e.content);
|
|
344
349
|
if (n.trim()) try {
|
|
345
|
-
|
|
350
|
+
st.current(e.id, n, e.metadata?.lang, { auto: !0 });
|
|
346
351
|
} catch {}
|
|
347
|
-
}, []),
|
|
348
|
-
if (e !==
|
|
349
|
-
n.getState().activeConversationId === e && (
|
|
352
|
+
}, []), $ = x((e, t) => {
|
|
353
|
+
if (e !== it.current) {
|
|
354
|
+
n.getState().activeConversationId === e && (at.current = {
|
|
350
355
|
conversationId: e,
|
|
351
356
|
messageId: t
|
|
352
357
|
});
|
|
353
358
|
return;
|
|
354
359
|
}
|
|
355
|
-
let r =
|
|
360
|
+
let r = Ee(rt.current, t);
|
|
356
361
|
if (!r.autoSpeakEnabled && !r.sessionSpeaking || !r.visible || !r.isSupported) return;
|
|
357
362
|
let i = n.getState();
|
|
358
363
|
if (i.activeConversationId !== e) return;
|
|
359
364
|
let a = i.conversations.find((t) => t.id === e)?.messages.find((e) => e.id === t);
|
|
360
|
-
!a || a.role !== "assistant" ||
|
|
361
|
-
}, [
|
|
365
|
+
!a || a.role !== "assistant" || Q(a, r.sessionSpeaking);
|
|
366
|
+
}, [Q]);
|
|
362
367
|
S(() => {
|
|
363
|
-
|
|
364
|
-
}, [
|
|
368
|
+
ot.current = $;
|
|
369
|
+
}, [$]), S(() => {
|
|
365
370
|
if (!(!W && !G || !h || !K)) return n.subscribe((e, t) => {
|
|
366
371
|
let n = e.activeConversationId;
|
|
367
372
|
if (!n || n !== t.activeConversationId) return;
|
|
@@ -370,41 +375,41 @@ var O = ({ children: f, visible: h = !0, engine: ge }) => {
|
|
|
370
375
|
let a = r.messageId ?? i?.messageId ?? null;
|
|
371
376
|
if (!a) return;
|
|
372
377
|
let o = e.conversations.find((e) => e.id === n)?.messages.find((e) => e.id === a);
|
|
373
|
-
!o || o.role !== "assistant" ||
|
|
378
|
+
!o || o.role !== "assistant" || Q(o, G);
|
|
374
379
|
});
|
|
375
380
|
}, [
|
|
376
381
|
W,
|
|
377
382
|
G,
|
|
378
383
|
K,
|
|
379
384
|
h,
|
|
380
|
-
|
|
385
|
+
Q
|
|
381
386
|
]), S(() => {
|
|
382
|
-
if (!(W || G || !
|
|
383
|
-
let n =
|
|
384
|
-
!n || !re(n.id) ||
|
|
387
|
+
if (!(W || G || !Ue || !h || !K)) return n.subscribe((e, t) => {
|
|
388
|
+
let n = De(e, t);
|
|
389
|
+
!n || !re(n.id) || Q(n, !1);
|
|
385
390
|
});
|
|
386
391
|
}, [
|
|
387
392
|
W,
|
|
388
393
|
G,
|
|
389
|
-
|
|
394
|
+
Ue,
|
|
390
395
|
K,
|
|
391
396
|
h,
|
|
392
|
-
|
|
397
|
+
Q
|
|
393
398
|
]);
|
|
394
|
-
let
|
|
399
|
+
let ct = x((e) => {
|
|
395
400
|
if (e.type === "abort") {
|
|
396
401
|
let t = B.current;
|
|
397
402
|
if (!t || t.messageId !== e.messageId) return;
|
|
398
|
-
B.current = null, (t.requestId === null ? t.waiting && H.current !== null : I.current === t.requestId) &&
|
|
403
|
+
B.current = null, (t.requestId === null ? t.waiting && H.current !== null : I.current === t.requestId) && X();
|
|
399
404
|
return;
|
|
400
405
|
}
|
|
401
|
-
let { messageId: t, item: r } = e, i =
|
|
402
|
-
if (!i.autoSpeakEnabled && !i.sessionSpeaking || !i.visible || !i.isSupported || r.channel === "voice" !== i.sessionSpeaking || g(t) ||
|
|
406
|
+
let { messageId: t, item: r } = e, i = Ee(rt.current, t);
|
|
407
|
+
if (!i.autoSpeakEnabled && !i.sessionSpeaking || !i.visible || !i.isSupported || r.channel === "voice" !== i.sessionSpeaking || g(t) || ze.current || B.current?.messageId === t || n.getState().activeConversationId !== r.conversationId || it.current !== r.conversationId) return;
|
|
403
408
|
let { text: a } = pe(r.text);
|
|
404
409
|
if (!a.trim()) return;
|
|
405
410
|
let o = I.current;
|
|
406
411
|
try {
|
|
407
|
-
|
|
412
|
+
st.current(t, a, r.lang, {
|
|
408
413
|
auto: !0,
|
|
409
414
|
firstChunkMaxChars: 110
|
|
410
415
|
});
|
|
@@ -415,62 +420,62 @@ var O = ({ children: f, visible: h = !0, engine: ge }) => {
|
|
|
415
420
|
requestId: s ? I.current : null,
|
|
416
421
|
waiting: !s && H.current !== null
|
|
417
422
|
};
|
|
418
|
-
}, [
|
|
419
|
-
S(() => d.subscribe(
|
|
420
|
-
let
|
|
423
|
+
}, [X]);
|
|
424
|
+
S(() => d.subscribe(ct), [ct]);
|
|
425
|
+
let lt = C(() => l(j, J.tag), [j, J]), ut = C(() => s(j, J.tag, q[Y]), [
|
|
421
426
|
j,
|
|
422
427
|
J,
|
|
423
428
|
q,
|
|
424
429
|
Y
|
|
425
|
-
]),
|
|
430
|
+
]), dt = C(() => ({
|
|
426
431
|
isSupported: K,
|
|
427
|
-
availability:
|
|
428
|
-
isBlocked:
|
|
429
|
-
disabledReason:
|
|
430
|
-
blockedFor:
|
|
431
|
-
deviceFallbackFor:
|
|
432
|
-
voiceChoices:
|
|
433
|
-
spokenChunks: ue(k,
|
|
434
|
-
activeVoiceName:
|
|
432
|
+
availability: Ye,
|
|
433
|
+
isBlocked: Ye === "no-voices",
|
|
434
|
+
disabledReason: Ye === "no-voices" ? D("speech.noVoicesOnDevice", "This device has no speech voices installed. Add one in your device speech or accessibility settings.") : null,
|
|
435
|
+
blockedFor: Qe,
|
|
436
|
+
deviceFallbackFor: $e,
|
|
437
|
+
voiceChoices: lt,
|
|
438
|
+
spokenChunks: ue(k, Pe),
|
|
439
|
+
activeVoiceName: ut?.name ?? null,
|
|
435
440
|
preferredVoiceName: q[Y] ?? null,
|
|
436
|
-
setVoice: (e) =>
|
|
441
|
+
setVoice: (e) => Ke(Y, e),
|
|
437
442
|
speakingMessageId: k.status === "speaking" ? k.messageId : null,
|
|
438
|
-
outputNotCleared:
|
|
443
|
+
outputNotCleared: Me,
|
|
439
444
|
isSpeaking: (e) => le(k, e),
|
|
440
|
-
toggle:
|
|
441
|
-
stop:
|
|
445
|
+
toggle: nt,
|
|
446
|
+
stop: X,
|
|
442
447
|
autoSpeakEnabled: W,
|
|
443
|
-
setAutoSpeak:
|
|
448
|
+
setAutoSpeak: Le,
|
|
444
449
|
sessionSpeaking: G,
|
|
445
|
-
setSessionSpeaking:
|
|
446
|
-
setSessionMicOpen:
|
|
447
|
-
speakFinishedReply:
|
|
448
|
-
previewVoice:
|
|
450
|
+
setSessionSpeaking: Re,
|
|
451
|
+
setSessionMicOpen: Be,
|
|
452
|
+
speakFinishedReply: $,
|
|
453
|
+
previewVoice: Ze
|
|
449
454
|
}), [
|
|
450
455
|
K,
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
ct,
|
|
456
|
+
Ye,
|
|
457
|
+
Qe,
|
|
458
|
+
$e,
|
|
455
459
|
lt,
|
|
460
|
+
ut,
|
|
456
461
|
q,
|
|
457
|
-
|
|
462
|
+
Ke,
|
|
458
463
|
Y,
|
|
459
464
|
k,
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
465
|
+
Me,
|
|
466
|
+
nt,
|
|
467
|
+
X,
|
|
463
468
|
W,
|
|
464
|
-
|
|
469
|
+
Le,
|
|
465
470
|
G,
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
471
|
+
Be,
|
|
472
|
+
$,
|
|
473
|
+
Ze,
|
|
469
474
|
D,
|
|
470
|
-
|
|
475
|
+
Pe
|
|
471
476
|
]);
|
|
472
|
-
return /* @__PURE__ */
|
|
473
|
-
value:
|
|
477
|
+
return /* @__PURE__ */ xe(Oe.Provider, {
|
|
478
|
+
value: dt,
|
|
474
479
|
children: f
|
|
475
480
|
});
|
|
476
481
|
};
|