@burdenoff/fe-libs 2026.1114.12 → 2026.1114.13
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/i18nManifest.d.ts +2 -0
- package/dist/shared/assistant/i18nManifest.js +2 -0
- package/dist/shared/assistant/index.d.ts +4 -0
- package/dist/shared/assistant/ui/AssistantChatArea.js +290 -277
- package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts +6 -0
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +425 -328
- package/dist/shared/assistant/ui/voice/AssistantPageVoiceBar.d.ts +64 -0
- package/dist/shared/assistant/ui/voice/AssistantPageVoiceBar.js +183 -0
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts +9 -1
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +233 -187
- package/dist/shared/assistant/ui/voice/LiveWaveform.d.ts +31 -0
- package/dist/shared/assistant/ui/voice/LiveWaveform.js +52 -0
- package/dist/shared/assistant/ui/voice/useLiveLevel.d.ts +21 -0
- package/dist/shared/assistant/ui/voice/useLiveLevel.js +52 -0
- package/dist/shared/assistant/voice/liveLevel.d.ts +84 -0
- package/dist/shared/assistant/voice/liveLevel.js +75 -0
- package/dist/shared-assistant.js +387 -383
- package/package.json +1 -1
|
@@ -7,152 +7,198 @@ import { VoiceMiniController as te } from "./VoiceMiniController.js";
|
|
|
7
7
|
import { useLiveAvatarHandsFreeGuard as i, useLiveAvatarTab as ne, useLiveAvatarVoiceView as re } from "../assistantLiveAvatarSeam.js";
|
|
8
8
|
import { useAvatarCopy as a } from "../../avatar/useAvatarCopy.js";
|
|
9
9
|
import { VoiceTranscriptDrawer as ie } from "./VoiceTranscriptDrawer.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
10
|
+
import { AssistantPageVoiceBar as ae } from "./AssistantPageVoiceBar.js";
|
|
11
|
+
import { useLiveLevel as o } from "./useLiveLevel.js";
|
|
12
|
+
import { HandsFreePrivacyNotice as oe } from "./HandsFreePrivacyNotice.js";
|
|
13
|
+
import { escapeBelongsToLayerAbove as se, voiceSessionEscapeAction as ce } from "./voiceSessionEscape.js";
|
|
14
|
+
import { ASSISTANT_PANEL_ATTR as le, ASSISTANT_VOICE_SESSION_ATTR as ue } from "../panelOverlays.js";
|
|
15
|
+
import { focusWasDropped as de, useReturnFocus as fe } from "../../../hooks/useReturnFocus.js";
|
|
16
|
+
import { micIsInterrupt as s, showsAssistantCaption as pe, voiceStageState as me } from "../../voice/voiceStageState.js";
|
|
17
|
+
import { VOICE_THINKING_LABEL as he, composeVoiceStatus as ge, voiceStatusSuffix as _e } from "../../voice/voiceStatus.js";
|
|
18
|
+
import { useAssistantTr as ve } from "../../i18n.js";
|
|
19
|
+
import { spokenSoFar as ye } from "../../voice/voiceSession.js";
|
|
20
|
+
import { useCallback as be, useEffect as c, useMemo as xe, useRef as l, useState as u } from "react";
|
|
21
|
+
import { Maximize2 as Se, Mic as Ce, MicOff as we, Minimize2 as Te, ScrollText as Ee, ShieldAlert as De, Square as Oe, X as d } from "lucide-react";
|
|
22
|
+
import { Fragment as ke, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
23
|
+
import { createPortal as Ae } from "react-dom";
|
|
21
24
|
// src/shared/assistant/ui/voice/AssistantVoiceSession.tsx
|
|
22
|
-
var m = ({ session: m, turns:
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
let
|
|
26
|
-
|
|
27
|
-
let
|
|
25
|
+
var m = ({ session: m, turns: Me = [], onSaveTranscript: Pe, onContinueInChat: Fe, notice: g = null, privacyNotice: _ = null, spoken: Ie, onInterrupt: v, onToggleMute: y, attachments: Le = [], onAttachFiles: b, onRemoveAttachment: Re, onRetryAttachment: ze, canAttachMore: Be = !0, preparingAttachments: Ve = 0, attachmentsLocked: x = !1, attachmentNotice: S = null, spokenChunks: He = null, onEnd: C, capturing: Ue = !0, interrupting: We = !1, awaitingEndpoint: Ge = !1, holding: w = !1, correcting: Ke = !1, onLetMeFinish: qe, onImDone: Je, proposalChip: T = null, proposalTray: E = null, renderAfterTurn: Ye, onViewChange: Xe, view: D, pageSlot: Ze = null, startedCue: O }) => {
|
|
26
|
+
let k = ve(), { muted: A, error: j } = m, M = l(null), N = l(null), [Qe, P] = u("mini"), F = D !== void 0, I = D === "compact", L = D === "page", [R, $e] = u(D);
|
|
27
|
+
R !== D && ($e(D), D === void 0 && R !== void 0 && P(R === "compact" ? "panel" : R === "page" ? "mini" : R));
|
|
28
|
+
let et = D === void 0 ? Qe : D === "compact" ? "panel" : D === "page" ? "mini" : D, z = ne().open, [tt, nt] = u(z);
|
|
29
|
+
tt !== z && (nt(z), z && Qe !== "mini" && P("mini"));
|
|
30
|
+
let B = re(et, m.phase === "ended"), rt = i();
|
|
28
31
|
c(() => {
|
|
29
|
-
|
|
30
|
-
}, [
|
|
31
|
-
let
|
|
32
|
-
e("assistant.transcript",
|
|
33
|
-
let
|
|
34
|
-
|
|
35
|
-
let
|
|
36
|
-
m.phase !== "listening" && m.phase !== "thinking" ||
|
|
37
|
-
}, [
|
|
38
|
-
|
|
39
|
-
}, []),
|
|
32
|
+
Xe?.(B);
|
|
33
|
+
}, [Xe, B]);
|
|
34
|
+
let it = a(), V = B === "full", H = B === "mini", U = B === "mini" ? "panel" : B === "panel" ? "full" : "mini", [W, G] = u(!1), at = xe(() => ({ run: () => W ? { status: "already" } : (G(!0), { status: "done" }) }), [W]);
|
|
35
|
+
e("assistant.transcript", at);
|
|
36
|
+
let K = E !== null && !H, q = l(!1), ot = l(y);
|
|
37
|
+
ot.current = y;
|
|
38
|
+
let st = be(() => {
|
|
39
|
+
m.phase !== "listening" && m.phase !== "thinking" || A || q.current || ye(m) || (q.current = !0, ot.current());
|
|
40
|
+
}, [A, m]), ct = be(() => {
|
|
41
|
+
q.current && (q.current = !1, ot.current());
|
|
42
|
+
}, []), lt = st;
|
|
40
43
|
c(() => {
|
|
41
44
|
let e = () => {
|
|
42
|
-
document.visibilityState === "hidden" ?
|
|
45
|
+
document.visibilityState === "hidden" ? st() : ct();
|
|
43
46
|
};
|
|
44
47
|
return document.addEventListener("visibilitychange", e), () => document.removeEventListener("visibilitychange", e);
|
|
45
|
-
}, [
|
|
46
|
-
let e =
|
|
48
|
+
}, [st, ct]), c(() => {
|
|
49
|
+
let e = ct;
|
|
47
50
|
return window.addEventListener("focus", e), () => {
|
|
48
|
-
window.removeEventListener("focus", e),
|
|
51
|
+
window.removeEventListener("focus", e), q.current = !1;
|
|
49
52
|
};
|
|
50
53
|
}, []), c(() => {
|
|
51
|
-
document.activeElement?.closest("[data-hands-free-notice]") ||
|
|
52
|
-
}, []),
|
|
53
|
-
let
|
|
54
|
+
document.activeElement?.closest("[data-hands-free-notice]") || M.current?.focus();
|
|
55
|
+
}, []), fe(N, { fallbackSelector: `[${le}]` });
|
|
56
|
+
let ut = l(F);
|
|
54
57
|
c(() => {
|
|
55
|
-
let e =
|
|
56
|
-
|
|
57
|
-
}, [
|
|
58
|
+
let e = ut.current;
|
|
59
|
+
ut.current = F, e && !F && de(document) && (N.current?.querySelector("[data-testid=\"assistant-voice-transcript-close\"]") ?? M.current)?.focus({ preventScroll: !0 });
|
|
60
|
+
}, [F]), c(() => {
|
|
58
61
|
let e = (e) => {
|
|
59
62
|
if (e.key === "Escape") {
|
|
60
|
-
let t =
|
|
63
|
+
let t = ce({
|
|
61
64
|
defaultPrevented: e.defaultPrevented,
|
|
62
|
-
layerAbove:
|
|
65
|
+
layerAbove: se({
|
|
63
66
|
target: e.target,
|
|
64
|
-
session:
|
|
67
|
+
session: N.current,
|
|
65
68
|
doc: document
|
|
66
69
|
}),
|
|
67
|
-
transcriptOpen:
|
|
70
|
+
transcriptOpen: W
|
|
68
71
|
});
|
|
69
72
|
if (t === "ignore") return;
|
|
70
|
-
e.preventDefault(), t === "close-transcript" ?
|
|
73
|
+
e.preventDefault(), t === "close-transcript" ? G(!1) : _ ? _.decline() : K ? E?.onClose() : C();
|
|
71
74
|
return;
|
|
72
75
|
}
|
|
73
|
-
if (e.key !== "Tab" || !
|
|
74
|
-
let t = (
|
|
76
|
+
if (e.key !== "Tab" || !V) return;
|
|
77
|
+
let t = (W ? N.current?.querySelector("[data-testid=\"assistant-voice-transcript\"]") : N.current)?.querySelectorAll("button:not([disabled])");
|
|
75
78
|
if (!t || t.length === 0) return;
|
|
76
79
|
let n = t[0], r = t[t.length - 1];
|
|
77
80
|
n && r && (e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus()));
|
|
78
81
|
};
|
|
79
82
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
80
83
|
}, [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
H,
|
|
84
|
+
C,
|
|
85
|
+
V,
|
|
84
86
|
W,
|
|
85
|
-
|
|
87
|
+
K,
|
|
88
|
+
E,
|
|
86
89
|
_
|
|
87
90
|
]);
|
|
88
|
-
let
|
|
89
|
-
letMeFinish:
|
|
90
|
-
imDone:
|
|
91
|
-
} : null,
|
|
91
|
+
let J = g !== null && j === null, Y = rt && g === null && j === null, X = ye(m), Z = qe && Je && m.phase === "listening" && !A && j === null ? {
|
|
92
|
+
letMeFinish: qe,
|
|
93
|
+
imDone: Je
|
|
94
|
+
} : null, dt = Z !== null;
|
|
92
95
|
c(() => {
|
|
93
|
-
if (
|
|
96
|
+
if (dt) return;
|
|
94
97
|
let e = document.activeElement;
|
|
95
|
-
e && e !== document.body ||
|
|
96
|
-
}, [
|
|
97
|
-
let Q =
|
|
98
|
+
e && e !== document.body || M.current?.focus();
|
|
99
|
+
}, [dt]);
|
|
100
|
+
let Q = me({
|
|
98
101
|
snapshot: m,
|
|
99
|
-
capturing:
|
|
100
|
-
interrupting:
|
|
101
|
-
awaitingEndpoint:
|
|
102
|
-
}),
|
|
102
|
+
capturing: Ue,
|
|
103
|
+
interrupting: We,
|
|
104
|
+
awaitingEndpoint: Ge
|
|
105
|
+
}), ft = (() => {
|
|
103
106
|
switch (Q) {
|
|
104
|
-
case "connecting": return
|
|
105
|
-
case "endpoint-grace": return
|
|
106
|
-
case "interrupting": return
|
|
107
|
-
case "thinking": return
|
|
108
|
-
case "speaking": return
|
|
107
|
+
case "connecting": return k("voiceSession.connecting", "Starting the microphone…");
|
|
108
|
+
case "endpoint-grace": return k("voiceSession.endpointGrace", "Still listening — take your time");
|
|
109
|
+
case "interrupting": return k("voiceSession.interrupting", "Stopped — go ahead");
|
|
110
|
+
case "thinking": return k(he.key, he.fallback);
|
|
111
|
+
case "speaking": return k("voiceSession.speaking", "Speaking — tap to stop");
|
|
109
112
|
case "mic-error":
|
|
110
113
|
case "ended": return "";
|
|
111
|
-
case "listening": return
|
|
114
|
+
case "listening": return A ? k("voiceSession.muted", "Microphone off") : k("voiceSession.listening", "Listening…");
|
|
112
115
|
default: return Q;
|
|
113
116
|
}
|
|
114
|
-
})(),
|
|
115
|
-
tr:
|
|
117
|
+
})(), pt = !A && (Q === "listening" || Q === "endpoint-grace"), mt = pt && w ? k("voiceSession.holding", "Take your time — tap “I’m done” when you finish") : pt && Ke ? k("voiceSession.correcting", "Stopped that answer — listening to your correction") : ft, $ = _e({
|
|
118
|
+
tr: k,
|
|
116
119
|
stage: Q,
|
|
117
|
-
muted:
|
|
118
|
-
label:
|
|
119
|
-
}),
|
|
120
|
+
muted: A,
|
|
121
|
+
label: mt
|
|
122
|
+
}), ht = ge(mt, $), gt = Q === "thinking", _t = !A && (Q === "listening" || Q === "endpoint-grace"), vt = o({
|
|
123
|
+
active: L && (_t || Q === "speaking"),
|
|
124
|
+
mic: L && _t,
|
|
125
|
+
pulseKey: X,
|
|
126
|
+
speaking: Q === "speaking"
|
|
127
|
+
});
|
|
128
|
+
if (L) {
|
|
129
|
+
let e = s(Q), t = e ? v : y;
|
|
130
|
+
return Ze ? Ae(/* @__PURE__ */ f(ae, {
|
|
131
|
+
rootRef: N,
|
|
132
|
+
endRef: M,
|
|
133
|
+
stage: Q,
|
|
134
|
+
muted: A,
|
|
135
|
+
status: ht,
|
|
136
|
+
statusSuffix: $,
|
|
137
|
+
rotateStatus: gt,
|
|
138
|
+
heard: _t ? X : "",
|
|
139
|
+
level: vt,
|
|
140
|
+
notice: J ? h(g, k) : null,
|
|
141
|
+
announcedNotice: J && je(g) ? h(g, k) : null,
|
|
142
|
+
attachmentNotice: S,
|
|
143
|
+
startedCue: O,
|
|
144
|
+
errorText: j === null ? null : Ne(j, k),
|
|
145
|
+
attachments: Le,
|
|
146
|
+
preparingAttachments: Ve,
|
|
147
|
+
attachmentsLocked: x,
|
|
148
|
+
canAttachMore: Be,
|
|
149
|
+
onAttachFiles: b,
|
|
150
|
+
onPickerOpen: lt,
|
|
151
|
+
onRemoveAttachment: Re,
|
|
152
|
+
onRetryAttachment: ze,
|
|
153
|
+
hold: Z ? {
|
|
154
|
+
holding: w,
|
|
155
|
+
onPress: w ? Z.imDone : Z.letMeFinish
|
|
156
|
+
} : null,
|
|
157
|
+
primary: {
|
|
158
|
+
interrupt: e,
|
|
159
|
+
onPress: t,
|
|
160
|
+
disabled: m.phase === "idle" || m.phase === "ended" || j !== null || Q === "connecting" || !t
|
|
161
|
+
},
|
|
162
|
+
onEnd: C,
|
|
163
|
+
privacyNotice: _
|
|
164
|
+
}), Ze) : null;
|
|
165
|
+
}
|
|
120
166
|
return /* @__PURE__ */ p("div", {
|
|
121
|
-
ref:
|
|
122
|
-
className: `flex flex-col ${
|
|
167
|
+
ref: N,
|
|
168
|
+
className: `flex flex-col ${I ? "items-stretch" : "items-center"} justify-between ${I ? "bg-bg-elevated" : "bg-bg-sunken"} ${I ? "absolute inset-0 z-20 px-3 pb-3 pt-2" : B === "full" ? "fixed inset-x-0 bottom-0 top-14 z-[60] px-6 py-8" : B === "panel" ? "absolute inset-0 z-20 px-4 py-6" : "absolute inset-x-0 bottom-0 z-20 min-h-[11.25rem] border-t border-border-subtle px-3 py-3 shadow-lg"}`,
|
|
123
169
|
role: "dialog",
|
|
124
|
-
"aria-modal":
|
|
125
|
-
"aria-label":
|
|
170
|
+
"aria-modal": V || void 0,
|
|
171
|
+
"aria-label": k("voiceSession.title", "Voice conversation"),
|
|
126
172
|
"data-testid": "assistant-voice-session",
|
|
127
|
-
[
|
|
173
|
+
[ue]: "",
|
|
128
174
|
children: [
|
|
129
|
-
|
|
130
|
-
ref:
|
|
175
|
+
I ? null : /* @__PURE__ */ p("button", {
|
|
176
|
+
ref: M,
|
|
131
177
|
type: "button",
|
|
132
|
-
onClick:
|
|
133
|
-
className: `absolute ${
|
|
134
|
-
title:
|
|
178
|
+
onClick: C,
|
|
179
|
+
className: `absolute ${V ? "end-6 top-6 h-14 gap-2 px-5 text-base" : H ? "end-12 top-2 h-8 gap-1.5 px-2.5 text-xs" : "end-3 top-3 h-11 gap-2 px-4 text-sm"} flex items-center justify-center rounded-full border border-border-default bg-bg-elevated text-text-secondary hover:bg-bg-sunken transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong`,
|
|
180
|
+
title: k("voiceSession.end", "End the voice conversation"),
|
|
135
181
|
"data-testid": "assistant-voice-end",
|
|
136
182
|
children: [/* @__PURE__ */ f(d, {
|
|
137
|
-
className:
|
|
183
|
+
className: V ? "size-6" : H ? "size-4" : "size-5",
|
|
138
184
|
"aria-hidden": "true"
|
|
139
185
|
}), /* @__PURE__ */ f("span", {
|
|
140
|
-
className: `truncate whitespace-nowrap font-medium ${
|
|
141
|
-
children:
|
|
186
|
+
className: `truncate whitespace-nowrap font-medium ${H ? "max-w-[3.5rem] text-xs" : "max-w-[7rem]"}`,
|
|
187
|
+
children: k("voiceSession.endShort", "End")
|
|
142
188
|
})]
|
|
143
189
|
}),
|
|
144
190
|
/* @__PURE__ */ p("div", {
|
|
145
|
-
className: `flex flex-col items-center ${
|
|
191
|
+
className: `flex flex-col items-center ${I ? "min-h-[1.5rem]" : H ? `px-3 ${J || Y || S ? "pt-9 pb-2" : ""}` : `min-h-[1.5rem] ${J || Y || S ? V ? "pt-14" : "pt-10" : ""}`}`,
|
|
146
192
|
children: [
|
|
147
|
-
|
|
193
|
+
J ? /* @__PURE__ */ f("p", {
|
|
148
194
|
className: "max-w-xs text-center text-xs text-status-warning",
|
|
149
195
|
"data-testid": "assistant-voice-notice",
|
|
150
|
-
children: h(g,
|
|
196
|
+
children: h(g, k)
|
|
151
197
|
}) : null,
|
|
152
|
-
|
|
198
|
+
Y ? /* @__PURE__ */ f("p", {
|
|
153
199
|
className: "max-w-xs text-center text-xs text-text-secondary",
|
|
154
200
|
"data-testid": "assistant-voice-avatar-hands-free",
|
|
155
|
-
children:
|
|
201
|
+
children: it.handsFreeOff
|
|
156
202
|
}) : null,
|
|
157
203
|
/* @__PURE__ */ f("span", {
|
|
158
204
|
className: "sr-only start-0 top-0",
|
|
@@ -160,225 +206,225 @@ var m = ({ session: m, turns: ke = [], onSaveTranscript: je, onContinueInChat: M
|
|
|
160
206
|
"aria-live": "polite",
|
|
161
207
|
"aria-atomic": "true",
|
|
162
208
|
"data-testid": "assistant-voice-notice-announced",
|
|
163
|
-
children:
|
|
209
|
+
children: J && je(g) ? h(g, k) : Y ? it.handsFreeOff : null
|
|
164
210
|
}),
|
|
165
|
-
|
|
211
|
+
S ? /* @__PURE__ */ f("p", {
|
|
166
212
|
className: "max-w-xs text-center text-xs text-status-warning",
|
|
167
213
|
role: "status",
|
|
168
214
|
"aria-live": "polite",
|
|
169
215
|
"data-testid": "assistant-voice-attachment-notice",
|
|
170
|
-
children:
|
|
216
|
+
children: S
|
|
171
217
|
}) : null,
|
|
172
|
-
|
|
218
|
+
O === void 0 ? null : /* @__PURE__ */ p(ke, { children: [O ? /* @__PURE__ */ f("p", {
|
|
173
219
|
className: "max-w-xs text-center text-xs text-text-secondary",
|
|
174
220
|
"data-testid": "assistant-voice-started-cue",
|
|
175
|
-
children:
|
|
221
|
+
children: O
|
|
176
222
|
}) : null, /* @__PURE__ */ f("span", {
|
|
177
223
|
className: "sr-only start-0 top-0",
|
|
178
224
|
role: "status",
|
|
179
225
|
"aria-live": "polite",
|
|
180
226
|
"aria-atomic": "true",
|
|
181
227
|
"data-testid": "assistant-voice-started-cue-announced",
|
|
182
|
-
children:
|
|
228
|
+
children: O
|
|
183
229
|
})] })
|
|
184
230
|
]
|
|
185
231
|
}),
|
|
186
232
|
(() => {
|
|
187
233
|
let e = /* @__PURE__ */ f(r, {
|
|
188
234
|
session: m,
|
|
189
|
-
compact:
|
|
235
|
+
compact: H,
|
|
190
236
|
connecting: Q === "connecting",
|
|
191
|
-
onPress: s(Q) ?
|
|
192
|
-
label: s(Q) ?
|
|
237
|
+
onPress: s(Q) ? v : y,
|
|
238
|
+
label: s(Q) ? k("voiceSession.interrupt", "Stop the assistant and speak") : A ? k("voiceSession.unmute", "Turn the microphone on") : k("voiceSession.mute", "Turn the microphone off")
|
|
193
239
|
}), t = Z ? /* @__PURE__ */ f("button", {
|
|
194
240
|
type: "button",
|
|
195
|
-
onClick:
|
|
196
|
-
className: `flex items-center justify-center rounded-full border font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${
|
|
197
|
-
title:
|
|
241
|
+
onClick: w ? Z.imDone : Z.letMeFinish,
|
|
242
|
+
className: `flex items-center justify-center rounded-full border font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${H ? "h-7 px-3 text-xs" : V ? "h-11 px-6 text-base" : "h-9 px-4 text-sm"} ${w ? "border-transparent bg-action-primary-bg text-action-primary-text hover:opacity-90" : "border-border-default bg-bg-elevated text-text-secondary hover:bg-bg-sunken"}`,
|
|
243
|
+
title: w ? k("voiceSession.imDoneHint", "Send what you said now") : k("voiceSession.letMeFinishHint", "Pause sending until you tap “I’m done”"),
|
|
198
244
|
"data-testid": "assistant-voice-hold",
|
|
199
|
-
"data-holding":
|
|
200
|
-
children:
|
|
201
|
-
}) : null, n = s(Q), i = n ?
|
|
245
|
+
"data-holding": w ? "true" : "false",
|
|
246
|
+
children: w ? k("voiceSession.imDone", "I’m done") : k("voiceSession.letMeFinish", "Let me finish")
|
|
247
|
+
}) : null, n = s(Q), i = n ? v : y, ne = m.phase === "idle" || m.phase === "ended" || j !== null || Q === "connecting" || !i, re = I ? /* @__PURE__ */ p("button", {
|
|
202
248
|
type: "button",
|
|
203
249
|
onClick: i,
|
|
204
250
|
disabled: ne,
|
|
205
251
|
className: "flex h-11 items-center justify-center gap-2 rounded-full border border-border-default bg-bg-elevated px-6 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] disabled:cursor-default disabled:text-text-muted disabled:hover:bg-bg-elevated",
|
|
206
252
|
"data-testid": "assistant-voice-primary",
|
|
207
253
|
"data-state": Q,
|
|
208
|
-
"data-muted":
|
|
209
|
-
children: [n ? /* @__PURE__ */ f(
|
|
254
|
+
"data-muted": A || void 0,
|
|
255
|
+
children: [n ? /* @__PURE__ */ f(Oe, {
|
|
210
256
|
className: "size-4 fill-current",
|
|
211
257
|
"aria-hidden": "true"
|
|
212
|
-
}) : f(
|
|
258
|
+
}) : f(A ? we : Ce, {
|
|
213
259
|
className: "size-4",
|
|
214
260
|
"aria-hidden": "true"
|
|
215
|
-
}), n ?
|
|
261
|
+
}), n ? k("window.stopSpeaking", "Stop speaking") : A ? k("window.unmute", "Unmute") : k("window.mute", "Mute")]
|
|
216
262
|
}) : null, a = t ? /* @__PURE__ */ p("div", {
|
|
217
263
|
className: "flex flex-col items-center gap-2",
|
|
218
264
|
children: [e, t]
|
|
219
|
-
}) : e, ie =
|
|
265
|
+
}) : e, ie = I ? /* @__PURE__ */ p("div", {
|
|
220
266
|
className: "flex flex-col items-center gap-2",
|
|
221
267
|
children: [t, re]
|
|
222
|
-
}) : void 0, ae =
|
|
223
|
-
return
|
|
224
|
-
spokenChunks:
|
|
268
|
+
}) : void 0, ae = pe(Q) ? Ie : X || null, o = j === null ? null : Ne(j, k);
|
|
269
|
+
return H ? /* @__PURE__ */ f(te, {
|
|
270
|
+
spokenChunks: He,
|
|
225
271
|
state: Q,
|
|
226
272
|
caption: ae,
|
|
227
|
-
statusText:
|
|
273
|
+
statusText: ht,
|
|
228
274
|
statusSuffix: $,
|
|
229
|
-
rotateStatus:
|
|
275
|
+
rotateStatus: gt,
|
|
230
276
|
errorText: o,
|
|
231
277
|
control: a
|
|
232
278
|
}) : /* @__PURE__ */ f(ee, {
|
|
233
279
|
state: Q,
|
|
234
|
-
userCaption:
|
|
235
|
-
spokenChunks:
|
|
236
|
-
assistantCaption:
|
|
237
|
-
expanded:
|
|
238
|
-
statusText:
|
|
280
|
+
userCaption: X || null,
|
|
281
|
+
spokenChunks: He,
|
|
282
|
+
assistantCaption: Ie,
|
|
283
|
+
expanded: V,
|
|
284
|
+
statusText: ht,
|
|
239
285
|
statusSuffix: $,
|
|
240
|
-
rotateStatus:
|
|
286
|
+
rotateStatus: gt,
|
|
241
287
|
errorText: o,
|
|
242
288
|
control: a,
|
|
243
|
-
compact:
|
|
289
|
+
compact: I || void 0,
|
|
244
290
|
compactControl: ie
|
|
245
291
|
});
|
|
246
292
|
})(),
|
|
247
|
-
|
|
248
|
-
className:
|
|
293
|
+
T && !K && !I ? /* @__PURE__ */ f("div", {
|
|
294
|
+
className: H ? "absolute start-20 end-36 top-2 flex justify-center" : `flex w-full justify-center ${V ? "max-w-[calc(100%-12rem)]" : "max-w-[calc(100%-8rem)]"}`,
|
|
249
295
|
children: /* @__PURE__ */ f("button", {
|
|
250
296
|
type: "button",
|
|
251
297
|
onClick: () => {
|
|
252
|
-
|
|
298
|
+
P("panel"), T.onOpen();
|
|
253
299
|
},
|
|
254
|
-
className: `max-w-full truncate rounded-full border border-border-default bg-bg-elevated font-medium text-text-primary transition-colors hover:bg-bg-raised focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${
|
|
300
|
+
className: `max-w-full truncate rounded-full border border-border-default bg-bg-elevated font-medium text-text-primary transition-colors hover:bg-bg-raised focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${H ? "h-8 px-3 text-xs" : "h-10 px-4 text-sm"}`,
|
|
255
301
|
"data-testid": "assistant-voice-proposal-chip",
|
|
256
|
-
children:
|
|
302
|
+
children: T.label
|
|
257
303
|
})
|
|
258
304
|
}) : null,
|
|
259
|
-
|
|
305
|
+
T && I ? /* @__PURE__ */ p("div", {
|
|
260
306
|
className: "flex min-h-11 w-full items-center gap-2 rounded-xl border border-status-warning bg-status-warning/10 px-3 py-1",
|
|
261
307
|
"data-testid": "assistant-voice-proposal-chip-row",
|
|
262
308
|
children: [
|
|
263
|
-
/* @__PURE__ */ f(
|
|
309
|
+
/* @__PURE__ */ f(De, {
|
|
264
310
|
className: "size-4 shrink-0 text-status-warning",
|
|
265
311
|
"aria-hidden": "true"
|
|
266
312
|
}),
|
|
267
|
-
|
|
313
|
+
T.status ? /* @__PURE__ */ f("p", {
|
|
268
314
|
role: "status",
|
|
269
315
|
"aria-live": "polite",
|
|
270
316
|
className: "min-w-0 flex-1 text-sm text-text-primary",
|
|
271
317
|
"data-testid": "assistant-voice-proposal-status",
|
|
272
|
-
children:
|
|
318
|
+
children: T.status
|
|
273
319
|
}) : /* @__PURE__ */ f("span", { className: "flex-1" }),
|
|
274
320
|
/* @__PURE__ */ f("button", {
|
|
275
321
|
type: "button",
|
|
276
|
-
onClick:
|
|
322
|
+
onClick: T.onOpen,
|
|
277
323
|
className: "min-h-9 shrink-0 rounded-button px-3 text-sm font-medium text-action-primary-bg transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
278
324
|
"data-testid": "assistant-voice-proposal-chip",
|
|
279
|
-
children:
|
|
325
|
+
children: T.label
|
|
280
326
|
})
|
|
281
327
|
]
|
|
282
328
|
}) : null,
|
|
283
|
-
|
|
284
|
-
className: `absolute z-10 flex flex-col gap-2 overflow-y-auto rounded-lg border border-border-subtle bg-bg-elevated shadow-lg ${
|
|
329
|
+
E && K ? /* @__PURE__ */ p("div", {
|
|
330
|
+
className: `absolute z-10 flex flex-col gap-2 overflow-y-auto rounded-lg border border-border-subtle bg-bg-elevated shadow-lg ${V ? "inset-x-6 bottom-24 top-24 mx-auto max-w-xl p-4" : "inset-x-3 bottom-16 top-16 p-3"}`,
|
|
285
331
|
"data-testid": "assistant-voice-proposal-tray",
|
|
286
332
|
children: [/* @__PURE__ */ f("div", {
|
|
287
333
|
className: "flex justify-end",
|
|
288
334
|
children: /* @__PURE__ */ f("button", {
|
|
289
335
|
type: "button",
|
|
290
|
-
onClick:
|
|
336
|
+
onClick: E.onClose,
|
|
291
337
|
className: "flex size-8 items-center justify-center rounded-full text-text-secondary transition-colors hover:bg-bg-raised hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong",
|
|
292
|
-
"aria-label":
|
|
338
|
+
"aria-label": E.closeLabel,
|
|
293
339
|
"data-testid": "assistant-voice-proposal-tray-close",
|
|
294
340
|
children: /* @__PURE__ */ f(d, {
|
|
295
341
|
className: "size-4",
|
|
296
342
|
"aria-hidden": "true"
|
|
297
343
|
})
|
|
298
344
|
})
|
|
299
|
-
}),
|
|
345
|
+
}), E.content]
|
|
300
346
|
}) : null,
|
|
301
|
-
_ ? /* @__PURE__ */ f(
|
|
302
|
-
view:
|
|
347
|
+
_ ? /* @__PURE__ */ f(oe, {
|
|
348
|
+
view: B,
|
|
303
349
|
onContinue: _.accept,
|
|
304
350
|
onNotNow: _.decline
|
|
305
351
|
}) : null,
|
|
306
|
-
|
|
307
|
-
turns:
|
|
308
|
-
onClose: () =>
|
|
309
|
-
onSave:
|
|
310
|
-
onContinueInChat:
|
|
311
|
-
renderAfterTurn:
|
|
352
|
+
W ? /* @__PURE__ */ f(ie, {
|
|
353
|
+
turns: Me,
|
|
354
|
+
onClose: () => G(!1),
|
|
355
|
+
onSave: Pe,
|
|
356
|
+
onContinueInChat: Fe,
|
|
357
|
+
renderAfterTurn: Ye
|
|
312
358
|
}) : null,
|
|
313
|
-
|
|
314
|
-
className: `absolute ${
|
|
359
|
+
b && !I ? /* @__PURE__ */ f("div", {
|
|
360
|
+
className: `absolute ${V ? "start-6 top-6" : H ? "start-11 top-2" : "start-3 top-3"}`,
|
|
315
361
|
children: /* @__PURE__ */ f(t, {
|
|
316
362
|
onFiles: (e) => {
|
|
317
|
-
|
|
363
|
+
b(e), F || P((e) => e === "mini" ? "panel" : e);
|
|
318
364
|
},
|
|
319
|
-
onPickerOpen:
|
|
365
|
+
onPickerOpen: lt,
|
|
320
366
|
direction: "down",
|
|
321
|
-
canAddMore:
|
|
322
|
-
disabled:
|
|
367
|
+
canAddMore: Be,
|
|
368
|
+
disabled: x
|
|
323
369
|
})
|
|
324
370
|
}) : null,
|
|
325
|
-
(
|
|
326
|
-
className:
|
|
371
|
+
(Le.length > 0 || Ve > 0) && !H ? /* @__PURE__ */ f("div", {
|
|
372
|
+
className: I ? "w-full" : `absolute ${V ? "bottom-24 start-24 end-24" : "bottom-16 start-16 end-16"}`,
|
|
327
373
|
"data-testid": "assistant-voice-attachments",
|
|
328
374
|
children: /* @__PURE__ */ f(n, {
|
|
329
|
-
attachments:
|
|
330
|
-
onRemove:
|
|
331
|
-
onRetry:
|
|
332
|
-
preparingCount:
|
|
333
|
-
disabled:
|
|
375
|
+
attachments: Le,
|
|
376
|
+
onRemove: Re ?? (() => void 0),
|
|
377
|
+
onRetry: ze ?? (() => void 0),
|
|
378
|
+
preparingCount: Ve,
|
|
379
|
+
disabled: x
|
|
334
380
|
})
|
|
335
381
|
}) : null,
|
|
336
|
-
|
|
382
|
+
I ? null : /* @__PURE__ */ f("button", {
|
|
337
383
|
type: "button",
|
|
338
|
-
onClick: () =>
|
|
339
|
-
className: `absolute ${
|
|
340
|
-
"aria-pressed":
|
|
341
|
-
"aria-label":
|
|
384
|
+
onClick: () => G((e) => !e),
|
|
385
|
+
className: `absolute ${V ? "bottom-6 end-6 size-14" : H ? "end-2 top-2 size-8" : "bottom-3 end-3 size-11"} flex items-center justify-center rounded-full bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-raised hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong`,
|
|
386
|
+
"aria-pressed": W,
|
|
387
|
+
"aria-label": k("voiceSession.transcriptTitle", "Voice transcript"),
|
|
342
388
|
"data-testid": "assistant-voice-transcript-toggle",
|
|
343
|
-
children: /* @__PURE__ */ f(
|
|
389
|
+
children: /* @__PURE__ */ f(Ee, { className: V ? "size-6" : H ? "size-4" : "size-5" })
|
|
344
390
|
}),
|
|
345
|
-
|
|
391
|
+
F ? null : /* @__PURE__ */ f("button", {
|
|
346
392
|
type: "button",
|
|
347
|
-
onClick: () =>
|
|
348
|
-
className: `absolute ${
|
|
349
|
-
"aria-label":
|
|
393
|
+
onClick: () => P(U),
|
|
394
|
+
className: `absolute ${V ? "bottom-6 start-6 size-14" : H ? "start-2 top-2 size-8" : "bottom-3 start-3 size-11"} flex items-center justify-center rounded-full bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-raised hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong`,
|
|
395
|
+
"aria-label": U === "panel" ? k("voiceSession.expandPanel", "Show the conversation in the panel") : U === "full" ? k("voiceSession.expand", "Expand the conversation to full screen") : k("voiceSession.collapse", "Shrink to the compact controller"),
|
|
350
396
|
"data-testid": "assistant-voice-expand",
|
|
351
|
-
children:
|
|
397
|
+
children: V ? /* @__PURE__ */ f(Te, { className: "size-5" }) : /* @__PURE__ */ f(Se, { className: H ? "size-4" : "size-5" })
|
|
352
398
|
}),
|
|
353
|
-
|
|
399
|
+
I ? /* @__PURE__ */ p("div", {
|
|
354
400
|
className: "flex w-full items-center gap-2 pt-2",
|
|
355
401
|
"data-testid": "assistant-voice-controls",
|
|
356
402
|
children: [
|
|
357
|
-
|
|
358
|
-
onFiles: (e) =>
|
|
359
|
-
onPickerOpen:
|
|
403
|
+
b ? /* @__PURE__ */ f(t, {
|
|
404
|
+
onFiles: (e) => b(e),
|
|
405
|
+
onPickerOpen: lt,
|
|
360
406
|
direction: "up",
|
|
361
|
-
canAddMore:
|
|
362
|
-
disabled:
|
|
407
|
+
canAddMore: Be,
|
|
408
|
+
disabled: x
|
|
363
409
|
}) : null,
|
|
364
410
|
/* @__PURE__ */ p("button", {
|
|
365
411
|
type: "button",
|
|
366
|
-
onClick: () =>
|
|
412
|
+
onClick: () => G((e) => !e),
|
|
367
413
|
className: "flex h-10 min-w-0 flex-1 items-center justify-center gap-2 rounded-full border border-border-default bg-bg-elevated px-3 text-sm text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
368
|
-
"aria-expanded":
|
|
414
|
+
"aria-expanded": W,
|
|
369
415
|
"data-testid": "assistant-voice-transcript-toggle",
|
|
370
|
-
children: [/* @__PURE__ */ f(
|
|
416
|
+
children: [/* @__PURE__ */ f(Ee, {
|
|
371
417
|
className: "size-4 shrink-0",
|
|
372
418
|
"aria-hidden": "true"
|
|
373
419
|
}), /* @__PURE__ */ f("span", {
|
|
374
420
|
className: "truncate",
|
|
375
|
-
children:
|
|
421
|
+
children: W ? k("window.hideTranscript", "Hide transcript") : k("window.showTranscript", "Show transcript")
|
|
376
422
|
})]
|
|
377
423
|
}),
|
|
378
424
|
/* @__PURE__ */ p("button", {
|
|
379
|
-
ref:
|
|
425
|
+
ref: M,
|
|
380
426
|
type: "button",
|
|
381
|
-
onClick:
|
|
427
|
+
onClick: C,
|
|
382
428
|
className: "flex h-10 min-w-0 flex-1 items-center justify-center gap-2 rounded-full border border-status-error-border bg-status-error-bg-subtle px-3 text-sm font-medium text-status-error-text transition-colors hover:opacity-90 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
383
429
|
"data-testid": "assistant-voice-end",
|
|
384
430
|
children: [/* @__PURE__ */ f(d, {
|
|
@@ -386,7 +432,7 @@ var m = ({ session: m, turns: ke = [], onSaveTranscript: je, onContinueInChat: M
|
|
|
386
432
|
"aria-hidden": "true"
|
|
387
433
|
}), /* @__PURE__ */ f("span", {
|
|
388
434
|
className: "truncate",
|
|
389
|
-
children:
|
|
435
|
+
children: k("window.endVoice", "End voice")
|
|
390
436
|
})]
|
|
391
437
|
})
|
|
392
438
|
]
|
|
@@ -395,12 +441,12 @@ var m = ({ session: m, turns: ke = [], onSaveTranscript: je, onContinueInChat: M
|
|
|
395
441
|
});
|
|
396
442
|
};
|
|
397
443
|
function h(e, t) {
|
|
398
|
-
return typeof e == "string" ?
|
|
444
|
+
return typeof e == "string" ? Me(e, t) : e.text;
|
|
399
445
|
}
|
|
400
|
-
function
|
|
446
|
+
function je(e) {
|
|
401
447
|
return e !== null && (typeof e != "string" || e === "reply-not-heard");
|
|
402
448
|
}
|
|
403
|
-
function
|
|
449
|
+
function Me(e, t) {
|
|
404
450
|
switch (e) {
|
|
405
451
|
case "network": return t("voiceSession.noticeNetwork", "Speech recognition lost its connection. Check your network — it will retry.");
|
|
406
452
|
case "not-capturing": return t("voiceSession.noticeNotCapturing", "The microphone did not start. Check that this site is allowed to use it, then try again.");
|
|
@@ -412,7 +458,7 @@ function ke(e, t) {
|
|
|
412
458
|
default: return e;
|
|
413
459
|
}
|
|
414
460
|
}
|
|
415
|
-
function
|
|
461
|
+
function Ne(e, t) {
|
|
416
462
|
switch (e) {
|
|
417
463
|
case "mic-denied": return t("voiceSession.micDenied", "Microphone access is blocked. Allow it in your browser settings to talk.");
|
|
418
464
|
case "no-speech-support": return t("voiceSession.noSpeechSupport", "This browser cannot listen. Try a different browser, or type instead.");
|