@burdenoff/fe-libs 2026.1114.13 → 2026.1114.14

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