@burdenoff/fe-libs 2026.1113.2 → 2026.1113.4

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.
@@ -8,113 +8,118 @@ import { useAssistantStore as a } from "../../store.js";
8
8
  import { useVoiceInput as te } from "../../voice/useVoiceInput.js";
9
9
  import { useAssistantAttachments as ne } from "../../useAssistantAttachments.js";
10
10
  import { getSendableAttachments as re } from "../../attachments.js";
11
- import { ATTACHMENT_COMMIT_CODES as o } from "../../attachmentCommit.js";
12
- import { AssistantAttachmentButton as ie } from "./AssistantAttachmentButton.js";
13
- import { AssistantAttachmentChips as ae } from "./AssistantAttachmentChips.js";
14
- import { AssistantFocusChip as oe } from "./AssistantFocusChip.js";
15
- import { useAskAboutStore as se } from "../../askAbout/askAboutStore.js";
11
+ import { ATTACHMENT_COMMIT_CODES as ie } from "../../attachmentCommit.js";
12
+ import { AssistantAttachmentButton as ae } from "./AssistantAttachmentButton.js";
13
+ import { AssistantAttachmentChips as oe } from "./AssistantAttachmentChips.js";
14
+ import { AssistantFocusChip as se } from "./AssistantFocusChip.js";
15
+ import { useAskAboutStore as o } from "../../askAbout/askAboutStore.js";
16
16
  import { AssistantVoiceButton as ce, ListeningDot as le } from "./AssistantVoiceButton.js";
17
17
  import { AssistantVoiceSessionButton as ue } from "../voice/AssistantVoiceSessionButton.js";
18
18
  import { AssistantModeSelector as de } from "./AssistantModeSelector.js";
19
19
  import { AssistantModeMenu as fe } from "./AssistantModeMenu.js";
20
20
  import { AssistantViewSwitchRow as pe } from "../compact/AssistantViewSwitchRow.js";
21
21
  import { compactEnterSends as me, isImeComposingEnter as he } from "./imeEnter.js";
22
- import { useCallback as s, useEffect as c, useId as l, useLayoutEffect as ge, useMemo as _e, useRef as u, useState as d } from "react";
23
- import { ArrowUp as ve, Loader2 as f, Square as ye } from "lucide-react";
24
- import { Fragment as be, jsx as p, jsxs as m } from "react/jsx-runtime";
22
+ import { useCallback as s, useEffect as c, useId as l, useLayoutEffect as u, useMemo as ge, useRef as d, useState as f } from "react";
23
+ import { ArrowUp as _e, Loader2 as p, Square as ve } from "lucide-react";
24
+ import { Fragment as ye, jsx as m, jsxs as h } from "react/jsx-runtime";
25
25
  // src/shared/assistant/ui/composer/AssistantComposer.tsx
26
- var xe = 200;
27
- function Se(e) {
26
+ var be = 200;
27
+ function xe(e) {
28
28
  if (!e) return !1;
29
29
  let t = e.ownerDocument.activeElement;
30
30
  return !t || t === e.ownerDocument.body ? !1 : e.contains(t) ? !0 : e.closest("[data-assistant-panel]")?.contains(t) ?? !1;
31
31
  }
32
- var Ce = ({ children: e }) => e(l()), h = ({ writeAccessDenied: l = !1, onSend: h, disabled: g = !1, readOnly: we = !1, placeholder: Te, mode: Ee, availableModes: _, attachmentCharsPerFile: De, onModeChange: Oe, auto: ke, onStartVoiceSession: v, onDraftStart: Ae, onDraftChange: je, suspendDictation: Me = !1, onVoiceStateChange: Ne, presentation: Pe = "classic", turnInFlight: y = !1, onStop: Fe, turnId: Ie, modeDisabledReason: Le = null, inputRef: b, aboveCard: Re, viewSwitch: ze, modeReadOnly: Be = !1, voiceSessionActive: Ve = !1 }) => {
33
- let x = r(), { locale: S } = n(), C = g || we, w = Pe === "compact", T = u(null), He = s((e) => {
34
- T.current = e, typeof b == "function" ? b(e) : b && (b.current = e);
35
- }, [b]), [E, D] = d(""), [O, k] = d(!1), [A, Ue] = d(!1), j = u(!1), [M, N] = d(null), [We, P] = d(null), [F, I] = d(null), [Ge, Ke] = d(y);
36
- Ge === y ? F !== null && y && Ie != null && Ie !== F && I(null) : (Ke(y), y ? (P(null), I(null)) : F !== null && (P(F), I(null)));
37
- let L = u(!1), R = u(null), z = u(!1), qe = u(!1), Je = u(null), B = u(!1), V = u(0), { attachments: H, isBusy: Ye, preparingCount: Xe, sendBlocker: Ze, rejection: Qe, addFiles: U, remove: $e, retry: et, clear: tt, clearRejection: nt, canAddMore: rt, commit: it, cancelCommit: at } = ne({ perFileChars: De }), W = E.trim() !== "" || H.length > 0, ot = u(!1), st = u(!1);
32
+ var Se = ({ children: e }) => e(l()), g = ({ writeAccessDenied: l = !1, onSend: g, disabled: Ce = !1, readOnly: we = !1, placeholder: Te, mode: Ee, availableModes: _, attachmentCharsPerFile: De, onModeChange: Oe, auto: ke, onStartVoiceSession: v, onDraftStart: Ae, onDraftChange: je, suspendDictation: Me = !1, onVoiceStateChange: Ne, presentation: Pe = "classic", turnInFlight: y = !1, onStop: b, turnId: Fe, modeDisabledReason: Ie = null, inputRef: x, aboveCard: Le, viewSwitch: Re, modeReadOnly: ze = !1, voiceSessionActive: S = !1 }) => {
33
+ let C = r(), { locale: w } = n(), T = Ce || we, E = Pe === "compact", D = d(null), Be = s((e) => {
34
+ D.current = e, typeof x == "function" ? x(e) : x && (x.current = e);
35
+ }, [x]), [O, k] = f(""), [A, j] = f(!1), [M, Ve] = f(!1), N = d(!1), [He, P] = f(null), [Ue, F] = f(null), [I, L] = f(null), [We, Ge] = f(y);
36
+ We === y ? I !== null && y && Fe != null && Fe !== I && L(null) : (Ge(y), y ? (F(null), L(null)) : I !== null && (F(I), L(null)));
37
+ let Ke = d(!1), R = d(null), qe = d(!1), Je = d(!1), Ye = d(null), z = d(!1), B = d(0), { attachments: V, isBusy: Xe, preparingCount: Ze, sendBlocker: Qe, rejection: $e, addFiles: H, remove: et, retry: tt, clear: nt, clearRejection: rt, canAddMore: it, commit: at, cancelCommit: ot } = ne({ perFileChars: De }), U = O.trim() !== "" || V.length > 0, st = d(!1), ct = d(!1);
38
38
  c(() => {
39
- W && !ot.current ? (ot.current = !0, Ae?.()) : W || (ot.current = !1);
40
- }, [W, Ae]), c(() => {
41
- W || (st.current = !1), je?.({
42
- text: E,
43
- hasAttachments: H.length > 0,
44
- dictated: st.current
39
+ U && !st.current ? (st.current = !0, Ae?.()) : U || (st.current = !1);
40
+ }, [U, Ae]), c(() => {
41
+ U || (ct.current = !1), je?.({
42
+ text: O,
43
+ hasAttachments: V.length > 0,
44
+ dictated: ct.current
45
45
  });
46
46
  }, [
47
- E,
48
- H.length,
49
- W,
47
+ O,
48
+ V.length,
49
+ U,
50
50
  je
51
51
  ]);
52
- let ct = s((e) => {
53
- st.current = !0, D((t) => t ? `${t.replace(/\s+$/, "")} ${e}` : e);
54
- }, []), lt = a((e) => e.assistantLanguage), ut = _e(() => ee(lt, S), [lt, S]), G = te({
55
- onFinalize: ct,
56
- language: ut.tag
57
- }), K = G.isActive, dt = G.interim, ft = G.stop;
52
+ let lt = s((e) => {
53
+ ct.current = !0, k((t) => t ? `${t.replace(/\s+$/, "")} ${e}` : e);
54
+ }, []), ut = a((e) => e.assistantLanguage), dt = ge(() => ee(ut, w), [ut, w]), W = te({
55
+ onFinalize: lt,
56
+ language: dt.tag
57
+ }), G = W.isActive, ft = W.interim, pt = W.stop;
58
58
  c(() => {
59
- Me && K && (dt.trim() !== "" && ct(dt.trim()), ft());
59
+ Me && G && (ft.trim() !== "" && lt(ft.trim()), pt());
60
60
  }, [
61
61
  Me,
62
- K,
63
- dt,
62
+ G,
64
63
  ft,
65
- ct
64
+ pt,
65
+ lt
66
66
  ]), c(() => {
67
67
  Ne?.({
68
- committing: A,
69
- dictating: K
68
+ committing: M,
69
+ dictating: G
70
70
  });
71
71
  }, [
72
72
  Ne,
73
- A,
74
- K
73
+ M,
74
+ G
75
75
  ]);
76
- let pt = se((e) => e.pending), mt = pt ? x("askAbout.placeholder", "Ask about {{name}}…", { name: pt.label }) : Te ?? x("composer.placeholder", "Ask me anything…"), ht = se((e) => e.focusRequested);
76
+ let mt = o((e) => e.pending), ht = mt ? C("askAbout.placeholder", "Ask about {{name}}…", { name: mt.label }) : Te ?? C("composer.placeholder", "Ask me anything…"), gt = o((e) => e.focusRequested), _t = (e) => {
77
+ k(e), requestAnimationFrame(() => {
78
+ let t = D.current;
79
+ t && (t.focus({ preventScroll: !0 }), t.setSelectionRange(e.length, e.length));
80
+ });
81
+ };
77
82
  c(() => {
78
- if (!ht || C) return;
79
- let e = T.current;
80
- e && (e.focus({ preventScroll: !0 }), se.getState().actions.composerFocused());
81
- }, [ht, C]);
82
- let gt = E.trim(), q = re(H), _t = H.filter((e) => e.status === "error"), J = (gt.length > 0 || q.length > 0) && !C && !A && Ze === null, vt = q.some((e) => !(e.fileId && e.downloadUrl) && !e.inlineOnly), yt = u(C);
83
- yt.current = C;
84
- let Y = u(!0);
83
+ if (!gt || T) return;
84
+ let e = D.current;
85
+ e && (e.focus({ preventScroll: !0 }), o.getState().actions.composerFocused());
86
+ }, [gt, T]);
87
+ let K = O.trim(), q = re(V), vt = V.filter((e) => e.status === "error"), J = (K.length > 0 || q.length > 0) && !T && !M && Qe === null, yt = q.some((e) => !(e.fileId && e.downloadUrl) && !e.inlineOnly), bt = d(T);
88
+ bt.current = T;
89
+ let Y = d(!0);
85
90
  c(() => (Y.current = !0, () => {
86
91
  Y.current = !1;
87
- }), []), ge(() => {
88
- let e = T.current;
89
- e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, xe)}px`);
90
- }, [E]);
92
+ }), []), u(() => {
93
+ let e = D.current;
94
+ e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, be)}px`);
95
+ }, [O]);
91
96
  let X = s(async () => {
92
- if (!J || j.current) return;
93
- G.isActive && G.stop();
94
- let e = E.trim();
95
- N(null);
96
- let t = w && Se(Je.current);
97
- if (!vt) {
98
- B.current = t, h(e, q), D(""), tt();
97
+ if (!J || N.current) return;
98
+ W.isActive && W.stop();
99
+ let e = O.trim();
100
+ P(null);
101
+ let t = E && xe(Ye.current);
102
+ if (!yt) {
103
+ z.current = t, g(e, q), k(""), nt();
99
104
  return;
100
105
  }
101
106
  let n = a.getState().activeConversationId;
102
- j.current = !0, Ue(!0);
107
+ N.current = !0, Ve(!0);
103
108
  try {
104
- let r = await it();
109
+ let r = await at();
105
110
  if (!Y.current) {
106
111
  r.ok && await r.rollback();
107
112
  return;
108
113
  }
109
114
  if (!r.ok) {
110
- r.cancelled || N({
115
+ r.cancelled || P({
111
116
  kind: "failed",
112
117
  failures: r.failures
113
118
  });
114
119
  return;
115
120
  }
116
- if (yt.current) {
117
- await r.rollback(), Y.current && N({
121
+ if (bt.current) {
122
+ await r.rollback(), Y.current && P({
118
123
  kind: "busy",
119
124
  failures: []
120
125
  });
@@ -122,292 +127,296 @@ var Ce = ({ children: e }) => e(l()), h = ({ writeAccessDenied: l = !1, onSend:
122
127
  }
123
128
  let i = a.getState();
124
129
  if (i.activeConversationId !== n || n !== null && !i.conversations.some((e) => e.id === n)) {
125
- await r.rollback(), Y.current && N({
130
+ await r.rollback(), Y.current && P({
126
131
  kind: "moved",
127
132
  failures: []
128
133
  });
129
134
  return;
130
135
  }
131
- B.current = t, h(e, re(r.attachments)), r.handedOver(), D(""), tt();
136
+ z.current = t, g(e, re(r.attachments)), r.handedOver(), k(""), nt();
132
137
  } finally {
133
- j.current = !1, Y.current && Ue(!1);
138
+ N.current = !1, Y.current && Ve(!1);
134
139
  }
135
140
  }, [
136
141
  J,
137
- vt,
138
- it,
139
- h,
140
- E,
142
+ yt,
143
+ at,
144
+ g,
145
+ O,
141
146
  q,
142
- tt,
143
- G,
144
- w
145
- ]), bt = s(() => {
146
- at(), T.current?.focus();
147
- }, [at]), Z = s(() => {
148
- yt.current ? L.current = !0 : T.current?.focus();
149
- }, []), xt = s(() => {
150
- if (qe.current) return;
151
- let e = Fe?.() ?? null;
152
- e !== null && (qe.current = !0, I(e)), Z();
153
- }, [Fe, Z]);
147
+ nt,
148
+ W,
149
+ E
150
+ ]), xt = s(() => {
151
+ ot(), D.current?.focus();
152
+ }, [ot]), Z = s(() => {
153
+ bt.current ? Ke.current = !0 : D.current?.focus();
154
+ }, []), St = s(() => {
155
+ if (Je.current) return;
156
+ let e = b?.() ?? null;
157
+ e !== null && (Je.current = !0, L(e)), Z();
158
+ }, [b, Z]);
154
159
  c(() => {
155
- !C && L.current && (L.current = !1, T.current?.focus());
156
- }, [C]);
157
- let St = s((e) => {
160
+ !T && Ke.current && (Ke.current = !1, D.current?.focus());
161
+ }, [T]);
162
+ let Ct = s((e) => {
158
163
  if (e !== null) {
159
164
  R.current = e;
160
165
  return;
161
166
  }
162
167
  let t = R.current;
163
- R.current = null, t !== null && t.ownerDocument.activeElement === t && (z.current = !0);
164
- }, []), Q = w && y && Fe !== void 0;
165
- ge(() => {
166
- !Q && z.current && (z.current = !1, Z());
168
+ R.current = null, t !== null && t.ownerDocument.activeElement === t && (qe.current = !0);
169
+ }, []), Q = E && y && b !== void 0;
170
+ u(() => {
171
+ !Q && qe.current && (qe.current = !1, Z());
167
172
  }, [Q, Z]), c(() => {
168
- F === null && (qe.current = !1);
169
- }, [F]), ge(() => {
173
+ I === null && (Je.current = !1);
174
+ }, [I]), u(() => {
170
175
  if (!Q) return;
171
- let e = B.current;
172
- if (B.current = !1, !e) return;
176
+ let e = z.current;
177
+ if (z.current = !1, !e) return;
173
178
  let t = R.current;
174
179
  if (t === null) return;
175
180
  let n = t.ownerDocument, r = n.activeElement;
176
- (r === null || r === n.body || r === T.current) && t.focus({ preventScroll: !0 });
181
+ (r === null || r === n.body || r === D.current) && t.focus({ preventScroll: !0 });
177
182
  }, [Q]);
178
- let Ct = s((e) => {
179
- D(e), P(null);
183
+ let wt = s((e) => {
184
+ k(e), F(null);
180
185
  }, []);
181
186
  c(() => {
182
- N(null);
183
- }, [H.length]);
184
- let wt = (t) => {
185
- if (t.kind === "busy") return x("attachments.saveBusy", "The assistant started another reply, so nothing was sent. Your message and files are still here.");
186
- if (t.kind === "moved") return x("attachments.saveMoved", "You switched conversations while the files were being saved, so nothing was sent. Your message and files are still here.");
187
+ P(null);
188
+ }, [V.length]);
189
+ let Tt = (t) => {
190
+ if (t.kind === "busy") return C("attachments.saveBusy", "The assistant started another reply, so nothing was sent. Your message and files are still here.");
191
+ if (t.kind === "moved") return C("attachments.saveMoved", "You switched conversations while the files were being saved, so nothing was sent. Your message and files are still here.");
187
192
  let { failures: n } = t;
188
- if (n.some((e) => e.code === o.editorAccessRequired)) return e(x, S);
189
- if (n.some((e) => e.code === o.quotaExceeded || e.code === o.quotaNotProvisioned)) return `${x("attachments.quotaFull", "File storage is full or not set up for this workspace, so the attachments couldn't be saved. Nothing was sent.")} ${x("attachments.retrySend", "Press Send to try again, or remove the file.")}`;
190
- let r = n[0], i = H.find((e) => e.id === r?.id)?.filename ?? "";
191
- return `${n.length <= 1 ? x("attachments.saveFailedOne", "{{name}} couldn't be saved, so nothing was sent.", { name: i }) : x("attachments.saveFailedMany", "{{count}} attachments couldn't be saved, so nothing was sent.", { count: n.length })} ${x("attachments.retrySend", "Press Send to try again, or remove the file.")}`;
192
- }, Tt = s((e) => {
193
+ if (n.some((e) => e.code === ie.editorAccessRequired)) return e(C, w);
194
+ if (n.some((e) => e.code === ie.quotaExceeded || e.code === ie.quotaNotProvisioned)) return `${C("attachments.quotaFull", "File storage is full or not set up for this workspace, so the attachments couldn't be saved. Nothing was sent.")} ${C("attachments.retrySend", "Press Send to try again, or remove the file.")}`;
195
+ let r = n[0], i = V.find((e) => e.id === r?.id)?.filename ?? "";
196
+ return `${n.length <= 1 ? C("attachments.saveFailedOne", "{{name}} couldn't be saved, so nothing was sent.", { name: i }) : C("attachments.saveFailedMany", "{{count}} attachments couldn't be saved, so nothing was sent.", { count: n.length })} ${C("attachments.retrySend", "Press Send to try again, or remove the file.")}`;
197
+ }, Et = s((e) => {
193
198
  e.key === "Enter" && !e.shiftKey && (e.preventDefault(), X());
194
- }, [X]), Et = s((e) => {
195
- e.key === "Escape" ? he(e) && e.stopPropagation() : me(e) && (e.preventDefault(), P(null), X());
196
199
  }, [X]), Dt = s((e) => {
200
+ e.key === "Escape" ? he(e) && e.stopPropagation() : me(e) && (e.preventDefault(), F(null), X());
201
+ }, [X]), Ot = s((e) => {
197
202
  let t = Array.from(e.clipboardData?.files ?? []);
198
- t.length !== 0 && (e.preventDefault(), U(t));
199
- }, [U]), Ot = s((e) => {
200
- Array.from(e.dataTransfer?.types ?? []).includes("Files") && (V.current += 1, k(!0));
201
- }, []), kt = s(() => {
202
- V.current = Math.max(0, V.current - 1), V.current === 0 && k(!1);
203
- }, []), At = s((e) => {
204
- Array.from(e.dataTransfer?.types ?? []).includes("Files") && e.preventDefault();
203
+ t.length !== 0 && (e.preventDefault(), H(t));
204
+ }, [H]), kt = s((e) => {
205
+ Array.from(e.dataTransfer?.types ?? []).includes("Files") && (B.current += 1, j(!0));
206
+ }, []), At = s(() => {
207
+ B.current = Math.max(0, B.current - 1), B.current === 0 && j(!1);
205
208
  }, []), jt = s((e) => {
206
- e.preventDefault(), V.current = 0, k(!1), U(e.dataTransfer?.files ?? null);
207
- }, [U]), Mt = (e) => {
209
+ Array.from(e.dataTransfer?.types ?? []).includes("Files") && e.preventDefault();
210
+ }, []), Mt = s((e) => {
211
+ e.preventDefault(), B.current = 0, j(!1), H(e.dataTransfer?.files ?? null);
212
+ }, [H]), Nt = (e) => {
208
213
  switch (e) {
209
- case "too-many": return x("attachments.tooMany", "You can attach up to {{max}} files per message.", { max: 5 });
210
- case "too-large": return x("attachments.tooLarge", "That file is larger than 10 MB.");
211
- case "empty": return x("attachments.empty", "That file is empty.");
212
- case "unreadable": return x("attachments.unreadable", "That file could not be read.");
213
- case "unsupported-image": return x("attachments.unsupportedImage", "This device can't read that image format, so it can't be resized to send. Save it as JPEG and try again.");
214
- case "too-large-to-save": return x("attachments.tooLargeToSave", "That file is over 5 MB, so it can't be saved to Files, and no text could be read from it.");
214
+ case "too-many": return C("attachments.tooMany", "You can attach up to {{max}} files per message.", { max: 5 });
215
+ case "too-large": return C("attachments.tooLarge", "That file is larger than 10 MB.");
216
+ case "empty": return C("attachments.empty", "That file is empty.");
217
+ case "unreadable": return C("attachments.unreadable", "That file could not be read.");
218
+ case "unsupported-image": return C("attachments.unsupportedImage", "This device can't read that image format, so it can't be resized to send. Save it as JPEG and try again.");
219
+ case "too-large-to-save": return C("attachments.tooLargeToSave", "That file is over 5 MB, so it can't be saved to Files, and no text could be read from it.");
215
220
  }
216
221
  }, $ = (() => {
217
- switch (G.error) {
218
- case "not-allowed": return x("voice.denied", "Microphone access is blocked. Allow it in your browser settings to dictate.");
219
- case "audio-capture": return x("voice.noMic", "No microphone was found.");
220
- case "network": return x("voice.network", "Speech recognition is offline right now.");
221
- case "language-not-supported": return x("voice.languageNotSupported", "This browser cannot recognise spoken {{language}}. Try a different browser, or type instead.", { language: i(G.language, S) });
222
- case "unknown": return x("voice.failed", "Dictation stopped unexpectedly.");
222
+ switch (W.error) {
223
+ case "not-allowed": return C("voice.denied", "Microphone access is blocked. Allow it in your browser settings to dictate.");
224
+ case "audio-capture": return C("voice.noMic", "No microphone was found.");
225
+ case "network": return C("voice.network", "Speech recognition is offline right now.");
226
+ case "language-not-supported": return C("voice.languageNotSupported", "This browser cannot recognise spoken {{language}}. Try a different browser, or type instead.", { language: i(W.language, w) });
227
+ case "unknown": return C("voice.failed", "Dictation stopped unexpectedly.");
223
228
  default: return null;
224
229
  }
225
- })(), Nt = (e, n) => A ? /* @__PURE__ */ p(t, {
226
- onDismiss: bt,
227
- children: /* @__PURE__ */ m("p", {
230
+ })(), Pt = (e, n) => M ? /* @__PURE__ */ m(t, {
231
+ onDismiss: xt,
232
+ children: /* @__PURE__ */ h("p", {
228
233
  className: "flex items-center justify-center gap-2 text-text-muted",
229
234
  "data-testid": "assistant-commit-status",
230
235
  children: [
231
- /* @__PURE__ */ p(f, {
236
+ /* @__PURE__ */ m(p, {
232
237
  className: "size-3 motion-safe:animate-spin",
233
238
  "aria-hidden": "true"
234
239
  }),
235
- /* @__PURE__ */ p("span", { children: x("attachments.saving", "Saving your attachments…") }),
236
- /* @__PURE__ */ p("button", {
240
+ /* @__PURE__ */ m("span", { children: C("attachments.saving", "Saving your attachments…") }),
241
+ /* @__PURE__ */ m("button", {
237
242
  type: "button",
238
- onClick: bt,
243
+ onClick: xt,
239
244
  className: "rounded text-text-primary underline underline-offset-2 hover:text-action-primary-bg focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong",
240
245
  "data-testid": "assistant-commit-cancel",
241
- children: x("attachments.cancelSaving", "Cancel")
246
+ children: C("attachments.cancelSaving", "Cancel")
242
247
  })
243
248
  ]
244
249
  })
245
- }) : M ? /* @__PURE__ */ p("p", {
250
+ }) : He ? /* @__PURE__ */ m("p", {
246
251
  className: "text-status-error-text",
247
252
  role: "alert",
248
253
  "data-testid": "assistant-commit-failed",
249
- children: wt(M)
250
- }) : G.isStarting && !G.isListening ? /* @__PURE__ */ p("p", {
254
+ children: Tt(He)
255
+ }) : W.isStarting && !W.isListening ? /* @__PURE__ */ m("p", {
251
256
  className: "text-text-muted",
252
257
  "data-testid": "assistant-voice-starting",
253
- children: x("voice.starting", "Starting the microphone…")
254
- }) : G.isListening ? /* @__PURE__ */ m("p", {
258
+ children: C("voice.starting", "Starting the microphone…")
259
+ }) : W.isListening ? /* @__PURE__ */ h("p", {
255
260
  className: "text-status-error-text",
256
261
  "data-testid": "assistant-voice-status",
257
- children: [/* @__PURE__ */ p(le, {}), G.interim || x("voice.listening", "Listening… speak now, tap the square to stop")]
258
- }) : $ ? /* @__PURE__ */ p("p", {
262
+ children: [/* @__PURE__ */ m(le, {}), W.interim || C("voice.listening", "Listening… speak now, tap the square to stop")]
263
+ }) : $ ? /* @__PURE__ */ m("p", {
259
264
  className: "text-status-error-text",
260
265
  "data-testid": "assistant-voice-error",
261
266
  children: $
262
- }) : Qe ? /* @__PURE__ */ p("button", {
267
+ }) : $e ? /* @__PURE__ */ m("button", {
263
268
  type: "button",
264
- onClick: nt,
269
+ onClick: rt,
265
270
  className: "text-status-error-text underline-offset-2 hover:underline",
266
271
  "data-testid": "assistant-attachment-rejection",
267
- children: Mt(Qe)
268
- }) : Ze === "failed" ? /* @__PURE__ */ p("p", {
272
+ children: Nt($e)
273
+ }) : Qe === "failed" ? /* @__PURE__ */ m("p", {
269
274
  className: "text-status-error-text",
270
275
  "data-testid": "assistant-attachment-blocked",
271
- children: _t.length === 1 ? x("attachments.blockedOne", "{{name}} didn't upload. Retry or remove it before sending.", { name: _t[0].filename }) : x("attachments.blockedMany", "{{count}} attachments didn't upload. Retry or remove them before sending.", { count: _t.length })
272
- }) : n ? /* @__PURE__ */ p("p", {
276
+ children: vt.length === 1 ? C("attachments.blockedOne", "{{name}} didn't upload. Retry or remove it before sending.", { name: vt[0].filename }) : C("attachments.blockedMany", "{{count}} attachments didn't upload. Retry or remove them before sending.", { count: vt.length })
277
+ }) : n ? /* @__PURE__ */ m("p", {
273
278
  className: "text-text-muted",
274
279
  "data-testid": "assistant-stopping-status",
275
- children: x("composer.stopping", "Stopping the reply…")
276
- }) : e ? /* @__PURE__ */ p("p", {
280
+ children: C("composer.stopping", "Stopping the reply…")
281
+ }) : e ? /* @__PURE__ */ m("p", {
277
282
  className: "text-text-muted",
278
283
  "data-testid": "assistant-stop-status",
279
- children: x("composer.stopped", "Reply stopped.")
280
- }) : /* @__PURE__ */ p("p", {
284
+ children: C("composer.stopped", "Reply stopped.")
285
+ }) : /* @__PURE__ */ m("p", {
281
286
  className: "text-text-muted",
282
- children: x("composer.hint", "Enter to send · Shift+Enter for newline · drag or paste files to attach")
287
+ children: C("composer.hint", "Enter to send · Shift+Enter for newline · drag or paste files to attach")
283
288
  });
284
- if (w) {
285
- let e = v !== void 0 && gt.length === 0 && H.length === 0 && !G.isActive, t = x("composer.hint", "Enter to send · Shift+Enter for newline · drag or paste files to attach"), n = !!(A || M || G.isStarting || G.isListening || $ || Qe || Ze === "failed" || We !== null || F !== null), r = "focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--color-bg-elevated)]";
286
- return /* @__PURE__ */ p(Ce, { children: (i) => /* @__PURE__ */ m("div", {
287
- ref: Je,
289
+ if (E) {
290
+ let e = v !== void 0 && K.length === 0 && V.length === 0 && !W.isActive, t = C("composer.hint", "Enter to send · Shift+Enter for newline · drag or paste files to attach"), n = !!(M || He || W.isStarting || W.isListening || $ || $e || Qe === "failed" || Ue !== null || I !== null), r = "focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--color-bg-elevated)]";
291
+ return /* @__PURE__ */ m(Se, { children: (i) => /* @__PURE__ */ h("div", {
292
+ ref: Ye,
288
293
  className: "flex-shrink-0 px-3 pt-1.5",
289
294
  children: [
290
- Re,
291
- ze ? /* @__PURE__ */ p(pe, {
292
- voiceLive: Ve,
293
- children: ze
295
+ Le,
296
+ Re ? /* @__PURE__ */ m(pe, {
297
+ voiceLive: S,
298
+ children: Re
294
299
  }) : null,
295
- /* @__PURE__ */ m("div", {
300
+ /* @__PURE__ */ h("div", {
296
301
  className: n || l ? "mb-1.5 px-1 text-center text-xs" : "",
297
302
  "aria-live": "polite",
298
303
  "data-testid": "assistant-composer-status",
299
- children: [l ? /* @__PURE__ */ p("p", {
304
+ children: [l ? /* @__PURE__ */ m("p", {
300
305
  className: "text-status-warning",
301
306
  "data-testid": "assistant-write-access-warning",
302
- children: x("composer.writeAccessDenied", "Changes may not save — your role in this workspace does not currently allow edits. You can still plan and review an action.")
303
- }) : null, n ? Nt(We !== null, F !== null) : null]
307
+ children: C("composer.writeAccessDenied", "Changes may not save — your role in this workspace does not currently allow edits. You can still plan and review an action.")
308
+ }) : null, n ? Pt(Ue !== null, I !== null) : null]
304
309
  }),
305
- /* @__PURE__ */ p("p", {
310
+ /* @__PURE__ */ m("p", {
306
311
  id: i,
307
312
  hidden: !0,
308
313
  "data-testid": "assistant-composer-hint",
309
314
  children: t
310
315
  }),
311
- /* @__PURE__ */ m("div", {
312
- onDragEnter: Ot,
313
- onDragLeave: kt,
314
- onDragOver: At,
315
- onDrop: jt,
316
- className: `flex flex-col rounded-3xl border transition-colors focus-within:border-[var(--color-focus-ring)] focus-within:ring-1 focus-within:ring-[var(--color-focus-ring)] ${Be ? "bg-bg-surface" : "bg-bg-elevated"} ${O ? "border-dashed border-[var(--color-focus-ring)]" : "border-[var(--color-text-muted)]"}`,
316
+ /* @__PURE__ */ h("div", {
317
+ onDragEnter: kt,
318
+ onDragLeave: At,
319
+ onDragOver: jt,
320
+ onDrop: Mt,
321
+ className: `flex flex-col rounded-3xl border transition-colors focus-within:border-[var(--color-focus-ring)] focus-within:ring-1 focus-within:ring-[var(--color-focus-ring)] ${ze ? "bg-bg-surface" : "bg-bg-elevated"} ${A ? "border-dashed border-[var(--color-focus-ring)]" : "border-[var(--color-text-muted)]"}`,
317
322
  "data-testid": "assistant-composer",
318
323
  "data-presentation": "compact",
319
324
  children: [
320
- /* @__PURE__ */ p("div", {
325
+ /* @__PURE__ */ m("div", {
321
326
  className: "px-3 pt-3 empty:hidden",
322
- children: /* @__PURE__ */ m(be, { children: [/* @__PURE__ */ p(oe, { disabled: A }), /* @__PURE__ */ p(ae, {
323
- attachments: H,
324
- onRemove: $e,
325
- onRetry: et,
326
- disabled: C || A,
327
- preparingCount: Xe
327
+ children: /* @__PURE__ */ h(ye, { children: [/* @__PURE__ */ m(se, {
328
+ disabled: M,
329
+ showSuggestions: K.length === 0,
330
+ onSuggest: _t
331
+ }), /* @__PURE__ */ m(oe, {
332
+ attachments: V,
333
+ onRemove: et,
334
+ onRetry: tt,
335
+ disabled: T || M,
336
+ preparingCount: Ze
328
337
  })] })
329
338
  }),
330
- /* @__PURE__ */ p("textarea", {
331
- ref: He,
332
- value: E,
333
- onChange: (e) => Ct(e.target.value),
334
- onKeyDown: Et,
335
- onPaste: Dt,
336
- disabled: C,
337
- readOnly: A,
338
- "aria-busy": A || void 0,
339
- placeholder: O ? x("composer.dropHere", "Drop files to attach") : mt,
339
+ /* @__PURE__ */ m("textarea", {
340
+ ref: Be,
341
+ value: O,
342
+ onChange: (e) => wt(e.target.value),
343
+ onKeyDown: Dt,
344
+ onPaste: Ot,
345
+ disabled: T,
346
+ readOnly: M,
347
+ "aria-busy": M || void 0,
348
+ placeholder: A ? C("composer.dropHere", "Drop files to attach") : ht,
340
349
  rows: 1,
341
350
  className: "min-h-10 w-full resize-none bg-transparent px-4 pb-1 pt-3 text-base leading-6 text-text-primary placeholder:text-text-muted focus:outline-none disabled:opacity-50",
342
351
  "aria-describedby": i,
343
352
  title: t,
344
- "aria-label": x("chatInput.ariaLabel", "Message input"),
353
+ "aria-label": C("chatInput.ariaLabel", "Message input"),
345
354
  "data-testid": "assistant-input"
346
355
  }),
347
- /* @__PURE__ */ m("div", {
356
+ /* @__PURE__ */ h("div", {
348
357
  className: "flex flex-nowrap items-center gap-1 px-1.5 pb-1.5 pt-1",
349
358
  "data-testid": "assistant-composer-controls",
350
359
  children: [
351
- /* @__PURE__ */ p(ie, {
352
- onFiles: U,
353
- canAddMore: rt,
354
- disabled: C || A,
360
+ /* @__PURE__ */ m(ae, {
361
+ onFiles: H,
362
+ canAddMore: it,
363
+ disabled: T || M,
355
364
  compact: !0,
356
365
  capMenuHeight: !0
357
366
  }),
358
- /* @__PURE__ */ p(fe, {
367
+ /* @__PURE__ */ m(fe, {
359
368
  chip: !0,
360
- readOnly: Be,
369
+ readOnly: ze,
361
370
  mode: Ee,
362
371
  availableModes: _,
363
372
  onModeChange: Oe,
364
373
  auto: ke,
365
- disabled: C || A,
366
- disabledReason: F === null ? y ? "replying" : Le ?? "busy" : "busy"
374
+ disabled: T || M,
375
+ disabledReason: I === null ? y ? "replying" : Ie ?? "busy" : "busy"
367
376
  }),
368
- /* @__PURE__ */ p("div", { className: "min-w-0 flex-1" }),
369
- G.isSupported && !Ve && /* @__PURE__ */ p(ce, {
377
+ /* @__PURE__ */ m("div", { className: "min-w-0 flex-1" }),
378
+ W.isSupported && !S && /* @__PURE__ */ m(ce, {
370
379
  compact: !0,
371
- isListening: G.isListening,
372
- isStarting: G.isStarting,
373
- onToggle: G.toggle,
374
- disabled: C || A
380
+ isListening: W.isListening,
381
+ isStarting: W.isStarting,
382
+ onToggle: W.toggle,
383
+ disabled: T || M
375
384
  }),
376
- Q ? /* @__PURE__ */ p("button", {
377
- ref: St,
385
+ Q ? /* @__PURE__ */ m("button", {
386
+ ref: Ct,
378
387
  type: "button",
379
- onClick: xt,
380
- className: `flex size-11 sm:size-10 flex-shrink-0 items-center justify-center rounded-full bg-action-primary-bg text-action-primary-text transition-colors hover:bg-action-primary-bg-hover ${r} ${F === null ? "" : "cursor-default opacity-60"}`,
381
- "aria-label": F === null ? x("composer.stop", "Stop the reply") : x("composer.stopping", "Stopping the reply…"),
382
- title: F === null ? x("composer.stop", "Stop the reply") : x("composer.stopping", "Stopping the reply…"),
383
- "aria-disabled": F === null ? void 0 : "true",
384
- "aria-busy": F === null ? void 0 : "true",
388
+ onClick: St,
389
+ className: `flex size-11 sm:size-10 flex-shrink-0 items-center justify-center rounded-full bg-action-primary-bg text-action-primary-text transition-colors hover:bg-action-primary-bg-hover ${r} ${I === null ? "" : "cursor-default opacity-60"}`,
390
+ "aria-label": I === null ? C("composer.stop", "Stop the reply") : C("composer.stopping", "Stopping the reply…"),
391
+ title: I === null ? C("composer.stop", "Stop the reply") : C("composer.stopping", "Stopping the reply…"),
392
+ "aria-disabled": I === null ? void 0 : "true",
393
+ "aria-busy": I === null ? void 0 : "true",
385
394
  "data-testid": "assistant-stop",
386
- children: F === null ? /* @__PURE__ */ p(ye, {
395
+ children: I === null ? /* @__PURE__ */ m(ve, {
387
396
  className: "size-4 fill-current",
388
397
  "aria-hidden": "true"
389
- }) : /* @__PURE__ */ p(f, {
398
+ }) : /* @__PURE__ */ m(p, {
390
399
  className: "size-4 motion-safe:animate-spin",
391
400
  "aria-hidden": "true"
392
401
  })
393
- }) : e ? /* @__PURE__ */ p(ue, {
402
+ }) : e ? /* @__PURE__ */ m(ue, {
394
403
  compact: !0,
395
- invisible: Ve,
404
+ invisible: S,
396
405
  onStart: v,
397
- disabled: C || A
398
- }) : /* @__PURE__ */ p("button", {
406
+ disabled: T || M
407
+ }) : /* @__PURE__ */ m("button", {
399
408
  type: "button",
400
409
  onClick: () => {
401
- P(null), X();
410
+ F(null), X();
402
411
  },
403
412
  disabled: !J,
404
413
  className: `flex size-11 sm:size-10 flex-shrink-0 items-center justify-center rounded-full transition-colors ${r} ${J ? "bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg-hover" : "bg-[var(--color-bg-disabled)] text-[var(--color-text-disabled)]"}`,
405
- "aria-label": x("chatInput.send", "Send message"),
414
+ "aria-label": C("chatInput.send", "Send message"),
406
415
  "data-testid": "assistant-send",
407
- children: g || Ye || A ? /* @__PURE__ */ p(f, {
416
+ children: Ce || Xe || M ? /* @__PURE__ */ m(p, {
408
417
  className: "size-5 motion-safe:animate-spin",
409
418
  "aria-hidden": "true"
410
- }) : /* @__PURE__ */ p(ve, {
419
+ }) : /* @__PURE__ */ m(_e, {
411
420
  className: "size-5",
412
421
  "aria-hidden": "true"
413
422
  })
@@ -419,91 +428,95 @@ var Ce = ({ children: e }) => e(l()), h = ({ writeAccessDenied: l = !1, onSend:
419
428
  ]
420
429
  }) });
421
430
  }
422
- return /* @__PURE__ */ m("div", {
431
+ return /* @__PURE__ */ h("div", {
423
432
  className: "flex-shrink-0 px-3 pb-3 pt-1.5",
424
433
  children: [
425
- /* @__PURE__ */ m("div", {
426
- onDragEnter: Ot,
427
- onDragLeave: kt,
428
- onDragOver: At,
429
- onDrop: jt,
430
- className: `rounded-2xl border p-2 shadow-sm transition-colors focus-within:border-action-primary-bg focus-within:ring-2 focus-within:ring-action-primary-bg/15 ${O ? "border-action-primary-bg border-dashed bg-action-primary-bg/5" : "border-border-default bg-bg-sunken"}`,
434
+ /* @__PURE__ */ h("div", {
435
+ onDragEnter: kt,
436
+ onDragLeave: At,
437
+ onDragOver: jt,
438
+ onDrop: Mt,
439
+ className: `rounded-2xl border p-2 shadow-sm transition-colors focus-within:border-action-primary-bg focus-within:ring-2 focus-within:ring-action-primary-bg/15 ${A ? "border-action-primary-bg border-dashed bg-action-primary-bg/5" : "border-border-default bg-bg-sunken"}`,
431
440
  "data-testid": "assistant-composer",
432
441
  children: [
433
- /* @__PURE__ */ m(be, { children: [/* @__PURE__ */ p(oe, { disabled: A }), /* @__PURE__ */ p(ae, {
434
- attachments: H,
435
- onRemove: $e,
436
- onRetry: et,
437
- disabled: C || A,
438
- preparingCount: Xe
442
+ /* @__PURE__ */ h(ye, { children: [/* @__PURE__ */ m(se, {
443
+ disabled: M,
444
+ showSuggestions: K.length === 0,
445
+ onSuggest: _t
446
+ }), /* @__PURE__ */ m(oe, {
447
+ attachments: V,
448
+ onRemove: et,
449
+ onRetry: tt,
450
+ disabled: T || M,
451
+ preparingCount: Ze
439
452
  })] }),
440
- /* @__PURE__ */ m("div", {
453
+ /* @__PURE__ */ h("div", {
441
454
  className: "flex items-end gap-2",
442
455
  children: [
443
- /* @__PURE__ */ p(ie, {
444
- onFiles: U,
445
- canAddMore: rt,
446
- disabled: C || A,
456
+ /* @__PURE__ */ m(ae, {
457
+ onFiles: H,
458
+ canAddMore: it,
459
+ disabled: T || M,
447
460
  showLabel: !0
448
461
  }),
449
- /* @__PURE__ */ p("textarea", {
450
- ref: T,
451
- value: E,
452
- onChange: (e) => D(e.target.value),
453
- onKeyDown: Tt,
454
- onPaste: Dt,
455
- disabled: C,
456
- readOnly: A,
457
- "aria-busy": A || void 0,
458
- placeholder: O ? x("composer.dropHere", "Drop files to attach") : mt,
462
+ /* @__PURE__ */ m("textarea", {
463
+ ref: D,
464
+ value: O,
465
+ onChange: (e) => k(e.target.value),
466
+ onKeyDown: Et,
467
+ onPaste: Ot,
468
+ disabled: T,
469
+ readOnly: M,
470
+ "aria-busy": M || void 0,
471
+ placeholder: A ? C("composer.dropHere", "Drop files to attach") : ht,
459
472
  rows: 1,
460
473
  className: "min-h-[36px] flex-1 resize-none self-center bg-transparent px-1 py-2 text-[15px] leading-relaxed text-text-primary placeholder:text-text-muted focus:outline-none disabled:opacity-50",
461
- "aria-label": x("chatInput.ariaLabel", "Message input"),
474
+ "aria-label": C("chatInput.ariaLabel", "Message input"),
462
475
  "data-testid": "assistant-input"
463
476
  }),
464
- G.isSupported && /* @__PURE__ */ p(ce, {
465
- isListening: G.isListening,
466
- isStarting: G.isStarting,
467
- onToggle: G.toggle,
468
- disabled: C || A
477
+ W.isSupported && /* @__PURE__ */ m(ce, {
478
+ isListening: W.isListening,
479
+ isStarting: W.isStarting,
480
+ onToggle: W.toggle,
481
+ disabled: T || M
469
482
  }),
470
- v && gt.length === 0 && H.length === 0 && !G.isActive ? /* @__PURE__ */ p(ue, {
483
+ v && K.length === 0 && V.length === 0 && !W.isActive ? /* @__PURE__ */ m(ue, {
471
484
  onStart: v,
472
- disabled: C || A
473
- }) : /* @__PURE__ */ p("button", {
485
+ disabled: T || M
486
+ }) : /* @__PURE__ */ m("button", {
474
487
  type: "button",
475
488
  onClick: () => void X(),
476
489
  disabled: !J,
477
490
  className: `flex size-9 flex-shrink-0 items-center justify-center rounded-full shadow-sm transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${J ? "bg-action-primary-bg text-action-primary-text hover:scale-105 hover:bg-action-primary-bg-hover" : "bg-bg-elevated text-text-muted"}`,
478
- "aria-label": x("chatInput.send", "Send message"),
491
+ "aria-label": C("chatInput.send", "Send message"),
479
492
  "data-testid": "assistant-send",
480
- children: g || Ye || A ? /* @__PURE__ */ p(f, { className: "size-4 motion-safe:animate-spin" }) : /* @__PURE__ */ p(ve, { className: "size-4" })
493
+ children: Ce || Xe || M ? /* @__PURE__ */ m(p, { className: "size-4 motion-safe:animate-spin" }) : /* @__PURE__ */ m(_e, { className: "size-4" })
481
494
  })
482
495
  ]
483
496
  }),
484
- (_.length > 1 || _.some((e) => e.writeCapable)) && /* @__PURE__ */ p("div", {
497
+ (_.length > 1 || _.some((e) => e.writeCapable)) && /* @__PURE__ */ m("div", {
485
498
  className: "mt-2 px-0.5",
486
- children: /* @__PURE__ */ p(de, {
499
+ children: /* @__PURE__ */ m(de, {
487
500
  mode: Ee,
488
501
  availableModes: _,
489
502
  onModeChange: Oe,
490
- disabled: C || A,
503
+ disabled: T || M,
491
504
  auto: ke
492
505
  })
493
506
  })
494
507
  ]
495
508
  }),
496
- l ? /* @__PURE__ */ p("p", {
509
+ l ? /* @__PURE__ */ m("p", {
497
510
  className: "mt-1.5 px-1 text-center text-[11px] text-status-warning",
498
511
  "data-testid": "assistant-write-access-warning",
499
- children: x("composer.writeAccessDenied", "Changes may not save — your role in this workspace does not currently allow edits. You can still plan and review an action.")
512
+ children: C("composer.writeAccessDenied", "Changes may not save — your role in this workspace does not currently allow edits. You can still plan and review an action.")
500
513
  }) : null,
501
- /* @__PURE__ */ p("div", {
514
+ /* @__PURE__ */ m("div", {
502
515
  className: "mt-1.5 px-1 text-center text-[11px]",
503
516
  "aria-live": "polite",
504
- children: Nt(!1, !1)
517
+ children: Pt(!1, !1)
505
518
  })
506
519
  ]
507
520
  });
508
521
  };
509
- export { h as AssistantComposer };
522
+ export { g as AssistantComposer };