@opengeni/react 6.1.0-canary.2 → 6.1.0-canary.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/{browser-viewer-NTD6UIPR.js → browser-viewer-LGH4IP47.js} +3 -3
- package/dist/chunk-BRM6FVZA.js +302 -0
- package/dist/chunk-BRM6FVZA.js.map +1 -0
- package/dist/{chunk-UWVY3OXF.js → chunk-EQEIQSRJ.js} +276 -454
- package/dist/chunk-EQEIQSRJ.js.map +1 -0
- package/dist/{chunk-NLTS7JHI.js → chunk-JPHDWKZE.js} +5 -5
- package/dist/{chunk-KZ4QDBGM.js → chunk-LVHCZABQ.js} +924 -1264
- package/dist/chunk-LVHCZABQ.js.map +1 -0
- package/dist/{chunk-L5VJYZIW.js → chunk-O53CQZ6T.js} +7 -7
- package/dist/{chunk-24M4YBCL.js → chunk-PNAVEK2U.js} +4 -4
- package/dist/{chunk-G5JFM6ZE.js → chunk-URNTAVGX.js} +429 -84
- package/dist/chunk-URNTAVGX.js.map +1 -0
- package/dist/composer.js +3 -3
- package/dist/connect.js +4 -3
- package/dist/connect.js.map +1 -1
- package/dist/index.js +26 -26
- package/dist/interaction.js +2 -2
- package/dist/machines.js +2 -2
- package/dist/plugin-discovery.d.ts +2 -0
- package/dist/session-ui.js +6 -6
- package/dist/session.js +2 -2
- package/package.json +3 -3
- package/src/components/markdown.tsx +10 -23
- package/src/plugin-discovery.tsx +10 -6
- package/styles/compiled.css +0 -8
- package/dist/chunk-G5JFM6ZE.js.map +0 -1
- package/dist/chunk-HQV2I5HV.js +0 -124
- package/dist/chunk-HQV2I5HV.js.map +0 -1
- package/dist/chunk-KZ4QDBGM.js.map +0 -1
- package/dist/chunk-UWVY3OXF.js.map +0 -1
- /package/dist/{browser-viewer-NTD6UIPR.js.map → browser-viewer-LGH4IP47.js.map} +0 -0
- /package/dist/{chunk-NLTS7JHI.js.map → chunk-JPHDWKZE.js.map} +0 -0
- /package/dist/{chunk-L5VJYZIW.js.map → chunk-O53CQZ6T.js.map} +0 -0
- /package/dist/{chunk-24M4YBCL.js.map → chunk-PNAVEK2U.js.map} +0 -0
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
Tooltip,
|
|
3
3
|
TooltipContent,
|
|
4
4
|
TooltipProvider,
|
|
5
|
-
TooltipTrigger
|
|
6
|
-
|
|
5
|
+
TooltipTrigger,
|
|
6
|
+
useLightboxOptional
|
|
7
|
+
} from "./chunk-BRM6FVZA.js";
|
|
7
8
|
import {
|
|
8
|
-
ComposerResponsiveContext
|
|
9
|
-
usePortalTokenStyle
|
|
9
|
+
ComposerResponsiveContext
|
|
10
10
|
} from "./chunk-VZTQ73XT.js";
|
|
11
11
|
import {
|
|
12
12
|
shouldSteerOnKey,
|
|
@@ -24,181 +24,6 @@ import {
|
|
|
24
24
|
cn
|
|
25
25
|
} from "./chunk-22KP6LR5.js";
|
|
26
26
|
|
|
27
|
-
// src/timeline/screenshot-lightbox.tsx
|
|
28
|
-
import { DownloadIcon, XIcon } from "lucide-react";
|
|
29
|
-
import { AnimatePresence, motion } from "motion/react";
|
|
30
|
-
import {
|
|
31
|
-
createContext,
|
|
32
|
-
useCallback,
|
|
33
|
-
useContext,
|
|
34
|
-
useEffect,
|
|
35
|
-
useMemo,
|
|
36
|
-
useState
|
|
37
|
-
} from "react";
|
|
38
|
-
import { Dialog } from "radix-ui";
|
|
39
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
40
|
-
var LightboxContext = createContext(null);
|
|
41
|
-
function useLightbox() {
|
|
42
|
-
return useContext(LightboxContext) ?? NOOP;
|
|
43
|
-
}
|
|
44
|
-
function useLightboxOptional() {
|
|
45
|
-
return useContext(LightboxContext);
|
|
46
|
-
}
|
|
47
|
-
var NOOP = { open: () => {
|
|
48
|
-
} };
|
|
49
|
-
function createLightboxSourceOwner() {
|
|
50
|
-
let releaseCurrent = null;
|
|
51
|
-
return {
|
|
52
|
-
replace(release) {
|
|
53
|
-
const previous = releaseCurrent;
|
|
54
|
-
releaseCurrent = release ?? null;
|
|
55
|
-
previous?.();
|
|
56
|
-
},
|
|
57
|
-
release() {
|
|
58
|
-
const release = releaseCurrent;
|
|
59
|
-
releaseCurrent = null;
|
|
60
|
-
release?.();
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function LightboxProvider({ children }) {
|
|
65
|
-
const ancestor = useContext(LightboxContext);
|
|
66
|
-
if (ancestor) {
|
|
67
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
68
|
-
}
|
|
69
|
-
return /* @__PURE__ */ jsx(LightboxRoot, { children });
|
|
70
|
-
}
|
|
71
|
-
function LightboxRoot({ children }) {
|
|
72
|
-
const [state, setState] = useState(null);
|
|
73
|
-
const [tokenSource, setTokenSource] = useState(null);
|
|
74
|
-
const sourceOwner = useMemo(() => createLightboxSourceOwner(), []);
|
|
75
|
-
const portalStyle = usePortalTokenStyle(tokenSource);
|
|
76
|
-
const releaseCurrentSource = useCallback(() => {
|
|
77
|
-
sourceOwner.release();
|
|
78
|
-
}, [sourceOwner]);
|
|
79
|
-
useEffect(() => releaseCurrentSource, [releaseCurrentSource]);
|
|
80
|
-
const open = useCallback(
|
|
81
|
-
(src, caption, source, label = "Screenshot", downloadFilename, controlLabels, releaseSource) => {
|
|
82
|
-
sourceOwner.replace(releaseSource);
|
|
83
|
-
setTokenSource(source ?? null);
|
|
84
|
-
setState({
|
|
85
|
-
src,
|
|
86
|
-
label,
|
|
87
|
-
...caption ? { caption } : {},
|
|
88
|
-
...downloadFilename ? { downloadFilename } : {},
|
|
89
|
-
...controlLabels ? { controlLabels } : {}
|
|
90
|
-
});
|
|
91
|
-
},
|
|
92
|
-
[sourceOwner]
|
|
93
|
-
);
|
|
94
|
-
const close = useCallback(() => {
|
|
95
|
-
releaseCurrentSource();
|
|
96
|
-
setState(null);
|
|
97
|
-
setTokenSource(null);
|
|
98
|
-
}, [releaseCurrentSource]);
|
|
99
|
-
const controller = useMemo(() => ({ open }), [open]);
|
|
100
|
-
return /* @__PURE__ */ jsxs(LightboxContext.Provider, { value: controller, children: [
|
|
101
|
-
children,
|
|
102
|
-
/* @__PURE__ */ jsx(Dialog.Root, { open: state !== null, onOpenChange: (next) => !next && close(), children: /* @__PURE__ */ jsx(AnimatePresence, { children: state !== null ? /* @__PURE__ */ jsxs(Dialog.Portal, { forceMount: true, children: [
|
|
103
|
-
/* @__PURE__ */ jsx(Dialog.Overlay, { asChild: true, forceMount: true, children: /* @__PURE__ */ jsx(
|
|
104
|
-
motion.div,
|
|
105
|
-
{
|
|
106
|
-
initial: { opacity: 0 },
|
|
107
|
-
animate: { opacity: 1 },
|
|
108
|
-
exit: { opacity: 0 },
|
|
109
|
-
transition: { duration: 0.15 },
|
|
110
|
-
className: "og-root fixed inset-0 z-50 bg-black/90 backdrop-blur-md",
|
|
111
|
-
style: portalStyle
|
|
112
|
-
}
|
|
113
|
-
) }),
|
|
114
|
-
/* @__PURE__ */ jsx(
|
|
115
|
-
Dialog.Content,
|
|
116
|
-
{
|
|
117
|
-
asChild: true,
|
|
118
|
-
forceMount: true,
|
|
119
|
-
"aria-label": state.label,
|
|
120
|
-
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
121
|
-
children: /* @__PURE__ */ jsxs(
|
|
122
|
-
motion.div,
|
|
123
|
-
{
|
|
124
|
-
initial: { opacity: 0, scale: 0.98 },
|
|
125
|
-
animate: { opacity: 1, scale: 1 },
|
|
126
|
-
exit: { opacity: 0, scale: 0.98 },
|
|
127
|
-
transition: { duration: 0.18, ease: [0.16, 1, 0.3, 1] },
|
|
128
|
-
onClick: (event) => {
|
|
129
|
-
if (event.target === event.currentTarget) {
|
|
130
|
-
close();
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
className: "og-root fixed inset-0 z-50 flex items-center justify-center p-6 sm:p-12",
|
|
134
|
-
style: portalStyle,
|
|
135
|
-
children: [
|
|
136
|
-
/* @__PURE__ */ jsx(Dialog.Title, { className: "sr-only", children: state.label }),
|
|
137
|
-
/* @__PURE__ */ jsx(Dialog.Description, { className: "sr-only", children: state.caption ?? `Expanded ${state.label.toLowerCase()}` }),
|
|
138
|
-
/* @__PURE__ */ jsxs("figure", { className: "m-0 flex max-h-full max-w-5xl flex-col items-center gap-3", children: [
|
|
139
|
-
/* @__PURE__ */ jsxs("div", { className: "relative flex min-h-0 w-fit max-w-full", children: [
|
|
140
|
-
/* @__PURE__ */ jsx(
|
|
141
|
-
"img",
|
|
142
|
-
{
|
|
143
|
-
src: state.src,
|
|
144
|
-
alt: state.caption ?? state.label,
|
|
145
|
-
className: "min-h-0 max-h-[82vh] w-auto max-w-full rounded-og-md border border-white/10 object-contain shadow-og-lg"
|
|
146
|
-
}
|
|
147
|
-
),
|
|
148
|
-
/* @__PURE__ */ jsx(
|
|
149
|
-
ScreenshotLightboxControls,
|
|
150
|
-
{
|
|
151
|
-
src: state.src,
|
|
152
|
-
downloadFilename: state.downloadFilename,
|
|
153
|
-
controlLabels: state.controlLabels
|
|
154
|
-
}
|
|
155
|
-
)
|
|
156
|
-
] }),
|
|
157
|
-
state.caption ? /* @__PURE__ */ jsx("figcaption", { className: "max-w-2xl text-center font-og-mono text-og-xs text-white/55", children: state.caption }) : /* @__PURE__ */ jsx("figcaption", { className: "font-og-mono text-og-xs uppercase tracking-[0.1em] text-white/35", children: "Esc or click outside to close" })
|
|
158
|
-
] })
|
|
159
|
-
]
|
|
160
|
-
}
|
|
161
|
-
)
|
|
162
|
-
}
|
|
163
|
-
)
|
|
164
|
-
] }) : null }) })
|
|
165
|
-
] });
|
|
166
|
-
}
|
|
167
|
-
function ScreenshotLightboxControls({
|
|
168
|
-
src,
|
|
169
|
-
downloadFilename,
|
|
170
|
-
controlLabels
|
|
171
|
-
}) {
|
|
172
|
-
return /* @__PURE__ */ jsxs("div", { className: "absolute -right-3 -top-3 flex items-center gap-2", children: [
|
|
173
|
-
downloadFilename ? /* @__PURE__ */ jsx(
|
|
174
|
-
"a",
|
|
175
|
-
{
|
|
176
|
-
href: src,
|
|
177
|
-
download: downloadFilename,
|
|
178
|
-
className: cn(
|
|
179
|
-
"inline-flex size-9 items-center justify-center rounded-full",
|
|
180
|
-
"border border-white/15 bg-black/60 text-white/70 backdrop-blur",
|
|
181
|
-
"transition-colors hover:border-white/30 hover:text-white"
|
|
182
|
-
),
|
|
183
|
-
"aria-label": controlLabels?.download ?? `Download ${downloadFilename}`,
|
|
184
|
-
children: /* @__PURE__ */ jsx(DownloadIcon, { className: "size-4" })
|
|
185
|
-
}
|
|
186
|
-
) : null,
|
|
187
|
-
/* @__PURE__ */ jsx(
|
|
188
|
-
Dialog.Close,
|
|
189
|
-
{
|
|
190
|
-
className: cn(
|
|
191
|
-
"inline-flex size-9 items-center justify-center rounded-full",
|
|
192
|
-
"border border-white/15 bg-black/60 text-white/70 backdrop-blur",
|
|
193
|
-
"transition-colors hover:border-white/30 hover:text-white"
|
|
194
|
-
),
|
|
195
|
-
"aria-label": controlLabels?.close ?? "Close",
|
|
196
|
-
children: /* @__PURE__ */ jsx(XIcon, { className: "size-4" })
|
|
197
|
-
}
|
|
198
|
-
)
|
|
199
|
-
] });
|
|
200
|
-
}
|
|
201
|
-
|
|
202
27
|
// src/workstream-control-event.ts
|
|
203
28
|
var OPEN_WORKSTREAM_CONTROL_EVENT = "opengeni:open-workstream-control";
|
|
204
29
|
|
|
@@ -391,11 +216,11 @@ function clearErrorMessage(cause) {
|
|
|
391
216
|
}
|
|
392
217
|
|
|
393
218
|
// src/hooks/use-slash-commands.ts
|
|
394
|
-
import { useCallback
|
|
219
|
+
import { useCallback, useMemo, useRef, useState } from "react";
|
|
395
220
|
function useSlashCommands(options) {
|
|
396
221
|
const { commands, context, handlers, value, setValue } = options;
|
|
397
|
-
const [highlight, setHighlight] =
|
|
398
|
-
const [dismissedValue, setDismissedValue] =
|
|
222
|
+
const [highlight, setHighlight] = useState(0);
|
|
223
|
+
const [dismissedValue, setDismissedValue] = useState(null);
|
|
399
224
|
const dismissed = dismissedValue !== null && dismissedValue === value;
|
|
400
225
|
const navigatedRef = useRef(false);
|
|
401
226
|
const navTokenRef = useRef(value);
|
|
@@ -403,8 +228,8 @@ function useSlashCommands(options) {
|
|
|
403
228
|
navTokenRef.current = value;
|
|
404
229
|
navigatedRef.current = false;
|
|
405
230
|
}
|
|
406
|
-
const parsed =
|
|
407
|
-
const filterCtx =
|
|
231
|
+
const parsed = useMemo(() => parseCommandLine(value), [value]);
|
|
232
|
+
const filterCtx = useMemo(
|
|
408
233
|
() => ({
|
|
409
234
|
sessionId: context?.sessionId ?? null,
|
|
410
235
|
status: context?.status ?? null,
|
|
@@ -412,13 +237,13 @@ function useSlashCommands(options) {
|
|
|
412
237
|
}),
|
|
413
238
|
[context?.sessionId, context?.status, context?.permissions]
|
|
414
239
|
);
|
|
415
|
-
const activeCommand =
|
|
240
|
+
const activeCommand = useMemo(() => {
|
|
416
241
|
if (!parsed || !parsed.hasTrailingSpace) {
|
|
417
242
|
return null;
|
|
418
243
|
}
|
|
419
244
|
return matchCommand(commands, value);
|
|
420
245
|
}, [commands, value, parsed]);
|
|
421
|
-
const items =
|
|
246
|
+
const items = useMemo(() => {
|
|
422
247
|
if (!parsed) {
|
|
423
248
|
return [];
|
|
424
249
|
}
|
|
@@ -431,7 +256,7 @@ function useSlashCommands(options) {
|
|
|
431
256
|
const isCommandDraft = parsed !== null && items.length > 0;
|
|
432
257
|
const clampedHighlight = items.length === 0 ? 0 : Math.min(highlight, items.length - 1);
|
|
433
258
|
const activeArgHint = activeCommand ? argHint(activeCommand.args) : "";
|
|
434
|
-
const buildContext =
|
|
259
|
+
const buildContext = useCallback(
|
|
435
260
|
(command) => {
|
|
436
261
|
if (!context) {
|
|
437
262
|
return null;
|
|
@@ -440,7 +265,7 @@ function useSlashCommands(options) {
|
|
|
440
265
|
},
|
|
441
266
|
[context, handlers]
|
|
442
267
|
);
|
|
443
|
-
const execute =
|
|
268
|
+
const execute = useCallback(
|
|
444
269
|
async (command, args) => {
|
|
445
270
|
const ctx = buildContext(command);
|
|
446
271
|
if (!ctx) {
|
|
@@ -460,21 +285,21 @@ function useSlashCommands(options) {
|
|
|
460
285
|
},
|
|
461
286
|
[buildContext, setValue]
|
|
462
287
|
);
|
|
463
|
-
const autocomplete =
|
|
288
|
+
const autocomplete = useCallback(
|
|
464
289
|
(command) => {
|
|
465
290
|
setValue(`/${command.name} `);
|
|
466
291
|
setHighlight(0);
|
|
467
292
|
},
|
|
468
293
|
[setValue]
|
|
469
294
|
);
|
|
470
|
-
const autocompleteHighlighted =
|
|
295
|
+
const autocompleteHighlighted = useCallback(() => {
|
|
471
296
|
const command = items[clampedHighlight];
|
|
472
297
|
if (command) {
|
|
473
298
|
autocomplete(command);
|
|
474
299
|
}
|
|
475
300
|
}, [items, clampedHighlight, autocomplete]);
|
|
476
301
|
const runningRef = useRef(false);
|
|
477
|
-
const runResolved =
|
|
302
|
+
const runResolved = useCallback(
|
|
478
303
|
async (command, executionOptions) => {
|
|
479
304
|
if (!parsed || runningRef.current) {
|
|
480
305
|
return;
|
|
@@ -502,7 +327,7 @@ function useSlashCommands(options) {
|
|
|
502
327
|
},
|
|
503
328
|
[parsed, activeCommand, autocomplete, execute]
|
|
504
329
|
);
|
|
505
|
-
const runHighlighted =
|
|
330
|
+
const runHighlighted = useCallback(async () => {
|
|
506
331
|
if (!parsed) {
|
|
507
332
|
return;
|
|
508
333
|
}
|
|
@@ -521,7 +346,7 @@ function useSlashCommands(options) {
|
|
|
521
346
|
}
|
|
522
347
|
await runResolved(command);
|
|
523
348
|
}, [parsed, activeCommand, items, clampedHighlight, runResolved]);
|
|
524
|
-
const runAt =
|
|
349
|
+
const runAt = useCallback(
|
|
525
350
|
async (index) => {
|
|
526
351
|
const command = items[index];
|
|
527
352
|
if (!command) {
|
|
@@ -531,7 +356,7 @@ function useSlashCommands(options) {
|
|
|
531
356
|
},
|
|
532
357
|
[items, runResolved]
|
|
533
358
|
);
|
|
534
|
-
const onKeyDown =
|
|
359
|
+
const onKeyDown = useCallback(
|
|
535
360
|
(event) => {
|
|
536
361
|
if (!open) {
|
|
537
362
|
return false;
|
|
@@ -600,8 +425,8 @@ function errorMessage2(cause) {
|
|
|
600
425
|
}
|
|
601
426
|
|
|
602
427
|
// src/components/command-palette.tsx
|
|
603
|
-
import { AnimatePresence
|
|
604
|
-
import { jsx
|
|
428
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
429
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
605
430
|
function CommandPalette({
|
|
606
431
|
open,
|
|
607
432
|
items,
|
|
@@ -613,8 +438,8 @@ function CommandPalette({
|
|
|
613
438
|
label = "Slash commands",
|
|
614
439
|
dangerLabel = "danger"
|
|
615
440
|
}) {
|
|
616
|
-
return /* @__PURE__ */
|
|
617
|
-
|
|
441
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: open ? /* @__PURE__ */ jsxs(
|
|
442
|
+
motion.div,
|
|
618
443
|
{
|
|
619
444
|
initial: { opacity: 0, y: 6, scale: 0.99 },
|
|
620
445
|
animate: { opacity: 1, y: 0, scale: 1 },
|
|
@@ -625,7 +450,7 @@ function CommandPalette({
|
|
|
625
450
|
"rounded-og-lg border border-og-border bg-og-surface-2 shadow-og-sm"
|
|
626
451
|
),
|
|
627
452
|
children: [
|
|
628
|
-
/* @__PURE__ */
|
|
453
|
+
/* @__PURE__ */ jsx(
|
|
629
454
|
"ul",
|
|
630
455
|
{
|
|
631
456
|
id: listboxId,
|
|
@@ -635,7 +460,7 @@ function CommandPalette({
|
|
|
635
460
|
children: items.map((command, index) => {
|
|
636
461
|
const selected = index === highlight;
|
|
637
462
|
const hint = argHint(command.args);
|
|
638
|
-
return /* @__PURE__ */
|
|
463
|
+
return /* @__PURE__ */ jsxs(
|
|
639
464
|
"li",
|
|
640
465
|
{
|
|
641
466
|
id: `${listboxId}-option-${index}`,
|
|
@@ -652,8 +477,8 @@ function CommandPalette({
|
|
|
652
477
|
selected ? "bg-og-accent/15 text-og-fg" : "text-og-fg-muted hover:bg-og-surface-3"
|
|
653
478
|
),
|
|
654
479
|
children: [
|
|
655
|
-
/* @__PURE__ */
|
|
656
|
-
/* @__PURE__ */
|
|
480
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-baseline gap-1.5", children: [
|
|
481
|
+
/* @__PURE__ */ jsxs(
|
|
657
482
|
"span",
|
|
658
483
|
{
|
|
659
484
|
className: cn(
|
|
@@ -666,11 +491,11 @@ function CommandPalette({
|
|
|
666
491
|
]
|
|
667
492
|
}
|
|
668
493
|
),
|
|
669
|
-
hint ? /* @__PURE__ */
|
|
494
|
+
hint ? /* @__PURE__ */ jsx("span", { className: "truncate font-mono text-[11px] text-og-fg-subtle", children: hint }) : null
|
|
670
495
|
] }),
|
|
671
|
-
/* @__PURE__ */
|
|
672
|
-
command.danger ? /* @__PURE__ */
|
|
673
|
-
/* @__PURE__ */
|
|
496
|
+
/* @__PURE__ */ jsxs("span", { className: "ml-auto flex items-center gap-1.5", children: [
|
|
497
|
+
command.danger ? /* @__PURE__ */ jsx("span", { className: "rounded-og-xs bg-og-status-failed/15 px-1 text-[10px] uppercase tracking-wide text-og-status-failed", children: dangerLabel }) : null,
|
|
498
|
+
/* @__PURE__ */ jsx("span", { className: "og-command-description truncate text-[12px] text-og-fg-subtle max-sm:hidden", children: command.description })
|
|
674
499
|
] })
|
|
675
500
|
]
|
|
676
501
|
},
|
|
@@ -679,7 +504,7 @@ function CommandPalette({
|
|
|
679
504
|
})
|
|
680
505
|
}
|
|
681
506
|
),
|
|
682
|
-
argHintText ? /* @__PURE__ */
|
|
507
|
+
argHintText ? /* @__PURE__ */ jsx("div", { className: "border-t border-og-border px-3 py-1.5 font-mono text-[11px] text-og-fg-subtle", children: argHintText }) : null
|
|
683
508
|
]
|
|
684
509
|
}
|
|
685
510
|
) : null });
|
|
@@ -687,8 +512,8 @@ function CommandPalette({
|
|
|
687
512
|
|
|
688
513
|
// src/components/model-picker.tsx
|
|
689
514
|
import { ChevronDownIcon } from "lucide-react";
|
|
690
|
-
import { useId, useMemo as
|
|
691
|
-
import { jsx as
|
|
515
|
+
import { useId, useMemo as useMemo2 } from "react";
|
|
516
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
692
517
|
var EMPTY_CLIENT_MODELS = [];
|
|
693
518
|
function isCodexClientModel(model) {
|
|
694
519
|
return model.id.startsWith("codex/") || model.source === "codex";
|
|
@@ -740,22 +565,22 @@ function ModelPicker({
|
|
|
740
565
|
codexOnly = false
|
|
741
566
|
}) {
|
|
742
567
|
const selectId = useId();
|
|
743
|
-
const effectiveRows =
|
|
568
|
+
const effectiveRows = useMemo2(
|
|
744
569
|
() => rows && rows.length > 0 ? applyCodexOnlyRows(rows, codexOnly) : [],
|
|
745
570
|
[rows, codexOnly]
|
|
746
571
|
);
|
|
747
|
-
const billingGroups =
|
|
572
|
+
const billingGroups = useMemo2(
|
|
748
573
|
() => effectiveRows.length > 0 ? groupPickerRowsByBillingClass(effectiveRows, { codexOnly }) : [],
|
|
749
574
|
[effectiveRows, codexOnly]
|
|
750
575
|
);
|
|
751
|
-
const providerGroupList =
|
|
576
|
+
const providerGroupList = useMemo2(() => providerGroups(models, codexOnly), [models, codexOnly]);
|
|
752
577
|
const useBillingGroups = Boolean(effectiveRows.length);
|
|
753
578
|
if (models.length === 0 && effectiveRows.length === 0) {
|
|
754
579
|
return null;
|
|
755
580
|
}
|
|
756
|
-
return /* @__PURE__ */
|
|
757
|
-
/* @__PURE__ */
|
|
758
|
-
/* @__PURE__ */
|
|
581
|
+
return /* @__PURE__ */ jsxs2("span", { className: cn("relative inline-flex items-center", className), children: [
|
|
582
|
+
/* @__PURE__ */ jsx2("label", { htmlFor: selectId, className: "sr-only", children: label }),
|
|
583
|
+
/* @__PURE__ */ jsx2(
|
|
759
584
|
"select",
|
|
760
585
|
{
|
|
761
586
|
id: selectId,
|
|
@@ -770,10 +595,10 @@ function ModelPicker({
|
|
|
770
595
|
"focus:outline-hidden focus-visible:outline-hidden",
|
|
771
596
|
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
772
597
|
),
|
|
773
|
-
children: useBillingGroups ? billingGroups.map((group) => /* @__PURE__ */
|
|
598
|
+
children: useBillingGroups ? billingGroups.map((group) => /* @__PURE__ */ jsx2("optgroup", { label: group.label, children: group.rows.map((row) => /* @__PURE__ */ jsx2("option", { value: row.id, disabled: !row.selectable, children: row.unavailableReason ? `${row.label} (${row.unavailableReason})` : row.label }, row.id)) }, group.billingClass)) : providerGroupList.map((group) => /* @__PURE__ */ jsx2("optgroup", { label: group.label, children: group.models.map((model) => /* @__PURE__ */ jsx2("option", { value: model.id, disabled: model.optionDisabled, children: model.label }, model.id)) }, group.label))
|
|
774
599
|
}
|
|
775
600
|
),
|
|
776
|
-
/* @__PURE__ */
|
|
601
|
+
/* @__PURE__ */ jsx2(
|
|
777
602
|
ChevronDownIcon,
|
|
778
603
|
{
|
|
779
604
|
"aria-hidden": true,
|
|
@@ -794,23 +619,23 @@ import {
|
|
|
794
619
|
PauseIcon,
|
|
795
620
|
PlayIcon,
|
|
796
621
|
RotateCwIcon,
|
|
797
|
-
XIcon
|
|
622
|
+
XIcon
|
|
798
623
|
} from "lucide-react";
|
|
799
|
-
import { AnimatePresence as
|
|
624
|
+
import { AnimatePresence as AnimatePresence2, motion as motion2 } from "motion/react";
|
|
800
625
|
import {
|
|
801
626
|
cloneElement,
|
|
802
|
-
createContext
|
|
627
|
+
createContext,
|
|
803
628
|
forwardRef,
|
|
804
|
-
useCallback as
|
|
805
|
-
useContext
|
|
806
|
-
useEffect
|
|
629
|
+
useCallback as useCallback2,
|
|
630
|
+
useContext,
|
|
631
|
+
useEffect,
|
|
807
632
|
useId as useId2,
|
|
808
633
|
useLayoutEffect,
|
|
809
|
-
useMemo as
|
|
634
|
+
useMemo as useMemo3,
|
|
810
635
|
useRef as useRef2,
|
|
811
|
-
useState as
|
|
636
|
+
useState as useState2
|
|
812
637
|
} from "react";
|
|
813
|
-
import { Fragment
|
|
638
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
814
639
|
function ComposerTip({
|
|
815
640
|
tip,
|
|
816
641
|
children
|
|
@@ -959,7 +784,7 @@ function useChatComposerController({
|
|
|
959
784
|
onPaste,
|
|
960
785
|
messages: messageOverrides
|
|
961
786
|
}) {
|
|
962
|
-
const messages =
|
|
787
|
+
const messages = useMemo3(
|
|
963
788
|
() => ({ ...defaultChatComposerMessages, ...messageOverrides }),
|
|
964
789
|
[messageOverrides]
|
|
965
790
|
);
|
|
@@ -970,9 +795,9 @@ function useChatComposerController({
|
|
|
970
795
|
const fileInputRef = useRef2(null);
|
|
971
796
|
const listboxId = useId2();
|
|
972
797
|
const paused = effectiveControl?.state === "paused";
|
|
973
|
-
const [controlDetailsOpen, setControlDetailsOpen] =
|
|
974
|
-
const [paletteMounted, setPaletteMounted] =
|
|
975
|
-
const [submitting, setSubmitting] =
|
|
798
|
+
const [controlDetailsOpen, setControlDetailsOpen] = useState2(false);
|
|
799
|
+
const [paletteMounted, setPaletteMounted] = useState2(false);
|
|
800
|
+
const [submitting, setSubmitting] = useState2(false);
|
|
976
801
|
const submittingRef = useRef2(false);
|
|
977
802
|
const controlOperationRef = useRef2(false);
|
|
978
803
|
const deliveryValue = delivery.value;
|
|
@@ -980,13 +805,13 @@ function useChatComposerController({
|
|
|
980
805
|
const mountedRef = useRef2(true);
|
|
981
806
|
const deliveredValueRef = useRef2(deliveryValue);
|
|
982
807
|
const liveValueRef = useRef2(deliveryValue);
|
|
983
|
-
const [renderedValue, setRenderedValue] =
|
|
808
|
+
const [renderedValue, setRenderedValue] = useState2(deliveryValue);
|
|
984
809
|
const deliveryChanged = deliveryValue !== deliveredValueRef.current;
|
|
985
810
|
if (deliveryChanged) {
|
|
986
811
|
deliveredValueRef.current = deliveryValue;
|
|
987
812
|
liveValueRef.current = deliveryValue;
|
|
988
813
|
}
|
|
989
|
-
const setComposerValue =
|
|
814
|
+
const setComposerValue = useCallback2(
|
|
990
815
|
(next) => {
|
|
991
816
|
liveValueRef.current = next;
|
|
992
817
|
setRenderedValue(next);
|
|
@@ -1000,13 +825,13 @@ function useChatComposerController({
|
|
|
1000
825
|
setRenderedValue(liveValueRef.current);
|
|
1001
826
|
}
|
|
1002
827
|
}, [deliveryValue, renderedValue]);
|
|
1003
|
-
|
|
828
|
+
useEffect(() => {
|
|
1004
829
|
mountedRef.current = true;
|
|
1005
830
|
return () => {
|
|
1006
831
|
mountedRef.current = false;
|
|
1007
832
|
};
|
|
1008
833
|
}, []);
|
|
1009
|
-
|
|
834
|
+
useEffect(() => {
|
|
1010
835
|
const openControl = (event) => {
|
|
1011
836
|
const requestedId = event instanceof CustomEvent && isRecord(event.detail) && typeof event.detail.composerId === "string" ? event.detail.composerId : null;
|
|
1012
837
|
if (requestedId && requestedId !== id) return;
|
|
@@ -1026,9 +851,9 @@ function useChatComposerController({
|
|
|
1026
851
|
}, [id, paused]);
|
|
1027
852
|
const blockedByAttachment = attachments?.hasUnresolved === true;
|
|
1028
853
|
const hasReadyAttachment = (attachments?.readyResources.length ?? 0) > 0;
|
|
1029
|
-
const [dragging, setDragging] =
|
|
854
|
+
const [dragging, setDragging] = useState2(false);
|
|
1030
855
|
const dragCarriesFiles = (event) => event.dataTransfer !== null && [...event.dataTransfer.types].includes("Files");
|
|
1031
|
-
const handleDragOver =
|
|
856
|
+
const handleDragOver = useCallback2(
|
|
1032
857
|
(event) => {
|
|
1033
858
|
if (!attachments || !dragCarriesFiles(event)) return;
|
|
1034
859
|
event.preventDefault();
|
|
@@ -1036,7 +861,7 @@ function useChatComposerController({
|
|
|
1036
861
|
},
|
|
1037
862
|
[attachments]
|
|
1038
863
|
);
|
|
1039
|
-
const handleDragLeave =
|
|
864
|
+
const handleDragLeave = useCallback2(
|
|
1040
865
|
(event) => {
|
|
1041
866
|
if (!attachments) return;
|
|
1042
867
|
if (event.currentTarget.contains(event.relatedTarget)) return;
|
|
@@ -1044,7 +869,7 @@ function useChatComposerController({
|
|
|
1044
869
|
},
|
|
1045
870
|
[attachments]
|
|
1046
871
|
);
|
|
1047
|
-
const handleDrop =
|
|
872
|
+
const handleDrop = useCallback2(
|
|
1048
873
|
(event) => {
|
|
1049
874
|
if (!attachments || !dragCarriesFiles(event)) return;
|
|
1050
875
|
event.preventDefault();
|
|
@@ -1053,17 +878,17 @@ function useChatComposerController({
|
|
|
1053
878
|
},
|
|
1054
879
|
[attachments]
|
|
1055
880
|
);
|
|
1056
|
-
const [notice, setNotice] =
|
|
1057
|
-
const [helpOpen, setHelpOpen] =
|
|
1058
|
-
const [confirmState, setConfirmState] =
|
|
881
|
+
const [notice, setNotice] = useState2(null);
|
|
882
|
+
const [helpOpen, setHelpOpen] = useState2(false);
|
|
883
|
+
const [confirmState, setConfirmState] = useState2(null);
|
|
1059
884
|
const pendingConfirm = useRef2(null);
|
|
1060
|
-
const settleConfirmation =
|
|
885
|
+
const settleConfirmation = useCallback2((confirmed) => {
|
|
1061
886
|
const resolve = pendingConfirm.current;
|
|
1062
887
|
pendingConfirm.current = null;
|
|
1063
888
|
setConfirmState(null);
|
|
1064
889
|
resolve?.(confirmed);
|
|
1065
890
|
}, []);
|
|
1066
|
-
|
|
891
|
+
useEffect(
|
|
1067
892
|
() => () => {
|
|
1068
893
|
pendingConfirm.current?.(false);
|
|
1069
894
|
pendingConfirm.current = null;
|
|
@@ -1071,7 +896,7 @@ function useChatComposerController({
|
|
|
1071
896
|
[]
|
|
1072
897
|
);
|
|
1073
898
|
const resizeInputRafRef = useRef2(null);
|
|
1074
|
-
const resizeInput =
|
|
899
|
+
const resizeInput = useCallback2(() => {
|
|
1075
900
|
if (resizeInputRafRef.current !== null) {
|
|
1076
901
|
return;
|
|
1077
902
|
}
|
|
@@ -1084,8 +909,8 @@ function useChatComposerController({
|
|
|
1084
909
|
applyComposerTextareaHeight(textarea, 220);
|
|
1085
910
|
});
|
|
1086
911
|
}, []);
|
|
1087
|
-
|
|
1088
|
-
|
|
912
|
+
useEffect(() => resizeInput(), [resizeInput, visibleValue]);
|
|
913
|
+
useEffect(
|
|
1089
914
|
() => () => {
|
|
1090
915
|
if (resizeInputRafRef.current !== null) {
|
|
1091
916
|
cancelAnimationFrame(resizeInputRafRef.current);
|
|
@@ -1094,7 +919,7 @@ function useChatComposerController({
|
|
|
1094
919
|
},
|
|
1095
920
|
[]
|
|
1096
921
|
);
|
|
1097
|
-
const handlers =
|
|
922
|
+
const handlers = useMemo3(
|
|
1098
923
|
() => ({
|
|
1099
924
|
notice: (next) => {
|
|
1100
925
|
setNotice(next);
|
|
@@ -1128,7 +953,7 @@ function useChatComposerController({
|
|
|
1128
953
|
);
|
|
1129
954
|
const submitBlocker = disabled ? "disabled" : blockedByAttachment ? "attachment" : delivery.sending || submitting ? "sending" : commandDraftBlocked ? "command" : annotationsIncomplete ? "annotations" : delivery.canSend || hasReadyAttachment ? null : "empty";
|
|
1130
955
|
const canSubmit = submitBlocker === null;
|
|
1131
|
-
const submit =
|
|
956
|
+
const submit = useCallback2(
|
|
1132
957
|
async (mode) => {
|
|
1133
958
|
if (commandDraftBlocked) {
|
|
1134
959
|
setNotice({ tone: "error", message: messages.slashCommandBlocked });
|
|
@@ -1164,7 +989,7 @@ function useChatComposerController({
|
|
|
1164
989
|
messages.slashCommandBlocked
|
|
1165
990
|
]
|
|
1166
991
|
);
|
|
1167
|
-
const handleKeyDown =
|
|
992
|
+
const handleKeyDown = useCallback2(
|
|
1168
993
|
(event) => {
|
|
1169
994
|
if (paletteEnabled && paletteMounted && palette.onKeyDown(event)) return;
|
|
1170
995
|
if (!shouldSubmitOnKey(event)) return;
|
|
@@ -1173,21 +998,21 @@ function useChatComposerController({
|
|
|
1173
998
|
},
|
|
1174
999
|
[palette, paletteEnabled, paletteMounted, submit]
|
|
1175
1000
|
);
|
|
1176
|
-
const handlePaste =
|
|
1001
|
+
const handlePaste = useCallback2(
|
|
1177
1002
|
(event) => {
|
|
1178
1003
|
onPaste?.(event);
|
|
1179
1004
|
attachments?.addFromPaste(event);
|
|
1180
1005
|
},
|
|
1181
1006
|
[attachments, onPaste]
|
|
1182
1007
|
);
|
|
1183
|
-
const handleFileChange =
|
|
1008
|
+
const handleFileChange = useCallback2(
|
|
1184
1009
|
(event) => {
|
|
1185
1010
|
if (event.target.files) attachments?.addFiles(event.target.files);
|
|
1186
1011
|
event.target.value = "";
|
|
1187
1012
|
},
|
|
1188
1013
|
[attachments]
|
|
1189
1014
|
);
|
|
1190
|
-
const helpCommands =
|
|
1015
|
+
const helpCommands = useMemo3(
|
|
1191
1016
|
() => commands.filter((command) => {
|
|
1192
1017
|
if (command.permission && commandContext) {
|
|
1193
1018
|
const permissions = commandContext.permissions;
|
|
@@ -1201,7 +1026,7 @@ function useChatComposerController({
|
|
|
1201
1026
|
tone: "error",
|
|
1202
1027
|
message: /control changed|paused while/i.test(delivery.error.message) ? messages.controlChangedError : composerSubmissionErrorMessage(delivery.error) || messages.sendFailedError
|
|
1203
1028
|
} : null);
|
|
1204
|
-
|
|
1029
|
+
useEffect(() => {
|
|
1205
1030
|
if (notice?.tone !== "ok") return;
|
|
1206
1031
|
const timer = window.setTimeout(
|
|
1207
1032
|
() => setNotice((current) => current === notice ? null : current),
|
|
@@ -1209,13 +1034,13 @@ function useChatComposerController({
|
|
|
1209
1034
|
);
|
|
1210
1035
|
return () => window.clearTimeout(timer);
|
|
1211
1036
|
}, [notice]);
|
|
1212
|
-
|
|
1037
|
+
useEffect(() => {
|
|
1213
1038
|
if (annotationsIncomplete) return;
|
|
1214
1039
|
setNotice(
|
|
1215
1040
|
(current) => current?.message === messages.annotationNotesRequired ? null : current
|
|
1216
1041
|
);
|
|
1217
1042
|
}, [annotationsIncomplete, messages.annotationNotesRequired]);
|
|
1218
|
-
const runControlOperation =
|
|
1043
|
+
const runControlOperation = useCallback2(async (operation) => {
|
|
1219
1044
|
if (controlOperationRef.current) return false;
|
|
1220
1045
|
controlOperationRef.current = true;
|
|
1221
1046
|
try {
|
|
@@ -1225,21 +1050,21 @@ function useChatComposerController({
|
|
|
1225
1050
|
controlOperationRef.current = false;
|
|
1226
1051
|
}
|
|
1227
1052
|
}, []);
|
|
1228
|
-
const pause =
|
|
1053
|
+
const pause = useCallback2(
|
|
1229
1054
|
async (reason) => {
|
|
1230
1055
|
if (!control || control.pausing || control.resuming) return false;
|
|
1231
1056
|
return await runControlOperation(() => control.pause(reason));
|
|
1232
1057
|
},
|
|
1233
1058
|
[control, runControlOperation]
|
|
1234
1059
|
);
|
|
1235
|
-
const resume =
|
|
1060
|
+
const resume = useCallback2(
|
|
1236
1061
|
async (reason) => {
|
|
1237
1062
|
if (!control || control.pausing || control.resuming) return false;
|
|
1238
1063
|
return await runControlOperation(() => control.resume(reason));
|
|
1239
1064
|
},
|
|
1240
1065
|
[control, runControlOperation]
|
|
1241
1066
|
);
|
|
1242
|
-
const resumeScope =
|
|
1067
|
+
const resumeScope = useCallback2(
|
|
1243
1068
|
async (option) => {
|
|
1244
1069
|
if (!control || control.pausing || control.resuming) return false;
|
|
1245
1070
|
return await runControlOperation(() => control.resumeScope(option));
|
|
@@ -1304,9 +1129,9 @@ function useChatComposerController({
|
|
|
1304
1129
|
value: visibleValue
|
|
1305
1130
|
};
|
|
1306
1131
|
}
|
|
1307
|
-
var ComposerContext =
|
|
1132
|
+
var ComposerContext = createContext(null);
|
|
1308
1133
|
function useComposerController() {
|
|
1309
|
-
const controller =
|
|
1134
|
+
const controller = useContext(ComposerContext);
|
|
1310
1135
|
if (!controller) throw new Error("useChatComposer must be used inside <Composer.Root>");
|
|
1311
1136
|
return controller;
|
|
1312
1137
|
}
|
|
@@ -1318,11 +1143,11 @@ function isRecord(value) {
|
|
|
1318
1143
|
}
|
|
1319
1144
|
var Root = forwardRef(function ComposerRoot({ controller, children, className, style, responsiveBasis = "viewport", ...props }, forwardedRef) {
|
|
1320
1145
|
const responsiveRootRef = useRef2(null);
|
|
1321
|
-
const responsiveContext =
|
|
1146
|
+
const responsiveContext = useMemo3(
|
|
1322
1147
|
() => ({ responsiveBasis, rootRef: responsiveRootRef }),
|
|
1323
1148
|
[responsiveBasis]
|
|
1324
1149
|
);
|
|
1325
|
-
return /* @__PURE__ */
|
|
1150
|
+
return /* @__PURE__ */ jsx3(ComposerContext.Provider, { value: controller, children: /* @__PURE__ */ jsx3(ComposerResponsiveContext.Provider, { value: responsiveContext, children: /* @__PURE__ */ jsx3(TooltipProvider, { delayDuration: 300, children: /* @__PURE__ */ jsxs3(
|
|
1326
1151
|
"div",
|
|
1327
1152
|
{
|
|
1328
1153
|
...props,
|
|
@@ -1333,23 +1158,23 @@ var Root = forwardRef(function ComposerRoot({ controller, children, className, s
|
|
|
1333
1158
|
style: { paddingBottom: "env(safe-area-inset-bottom)", ...style },
|
|
1334
1159
|
children: [
|
|
1335
1160
|
children,
|
|
1336
|
-
/* @__PURE__ */
|
|
1161
|
+
/* @__PURE__ */ jsx3(ComposerAnnouncements, {})
|
|
1337
1162
|
]
|
|
1338
1163
|
}
|
|
1339
1164
|
) }) }) });
|
|
1340
1165
|
});
|
|
1341
1166
|
var Frame = forwardRef(function ComposerFrame({ className, ...props }, ref) {
|
|
1342
|
-
return /* @__PURE__ */
|
|
1167
|
+
return /* @__PURE__ */ jsx3("div", { ...props, ref, className: cn("relative", className) });
|
|
1343
1168
|
});
|
|
1344
1169
|
function CommandPalette2({ className }) {
|
|
1345
1170
|
const controller = useComposerController();
|
|
1346
1171
|
const setPaletteMounted = controller.setPaletteMounted;
|
|
1347
|
-
|
|
1172
|
+
useEffect(() => {
|
|
1348
1173
|
setPaletteMounted(true);
|
|
1349
1174
|
return () => setPaletteMounted(false);
|
|
1350
1175
|
}, [setPaletteMounted]);
|
|
1351
1176
|
if (!controller.paletteEnabled) return null;
|
|
1352
|
-
return /* @__PURE__ */
|
|
1177
|
+
return /* @__PURE__ */ jsx3("div", { className, children: /* @__PURE__ */ jsx3(
|
|
1353
1178
|
CommandPalette,
|
|
1354
1179
|
{
|
|
1355
1180
|
open: controller.palette.open && controller.confirmState === null,
|
|
@@ -1369,7 +1194,7 @@ function CommandPalette2({ className }) {
|
|
|
1369
1194
|
}
|
|
1370
1195
|
var Surface = forwardRef(function ComposerSurface({ className, children, ...props }, ref) {
|
|
1371
1196
|
const controller = useComposerController();
|
|
1372
|
-
return /* @__PURE__ */
|
|
1197
|
+
return /* @__PURE__ */ jsxs3(
|
|
1373
1198
|
"div",
|
|
1374
1199
|
{
|
|
1375
1200
|
...props,
|
|
@@ -1385,7 +1210,7 @@ var Surface = forwardRef(function ComposerSurface({ className, children, ...prop
|
|
|
1385
1210
|
className
|
|
1386
1211
|
),
|
|
1387
1212
|
children: [
|
|
1388
|
-
controller.dragging ? /* @__PURE__ */
|
|
1213
|
+
controller.dragging ? /* @__PURE__ */ jsx3(
|
|
1389
1214
|
"div",
|
|
1390
1215
|
{
|
|
1391
1216
|
"aria-hidden": true,
|
|
@@ -1393,8 +1218,8 @@ var Surface = forwardRef(function ComposerSurface({ className, children, ...prop
|
|
|
1393
1218
|
"pointer-events-none absolute inset-0 z-10 flex items-center justify-center",
|
|
1394
1219
|
"rounded-og-lg bg-og-surface-1/85 text-og-menu font-medium text-og-accent backdrop-blur-[1px]"
|
|
1395
1220
|
),
|
|
1396
|
-
children: /* @__PURE__ */
|
|
1397
|
-
/* @__PURE__ */
|
|
1221
|
+
children: /* @__PURE__ */ jsxs3("span", { className: "inline-flex items-center gap-2", children: [
|
|
1222
|
+
/* @__PURE__ */ jsx3(PaperclipIcon, { className: "size-4" }),
|
|
1398
1223
|
controller.messages.dropFiles
|
|
1399
1224
|
] })
|
|
1400
1225
|
}
|
|
@@ -1407,7 +1232,7 @@ var Surface = forwardRef(function ComposerSurface({ className, children, ...prop
|
|
|
1407
1232
|
function PausedState() {
|
|
1408
1233
|
const controller = useComposerController();
|
|
1409
1234
|
if (!controller.paused || !controller.effectiveControl || !controller.hasControl) return null;
|
|
1410
|
-
return /* @__PURE__ */
|
|
1235
|
+
return /* @__PURE__ */ jsx3(
|
|
1411
1236
|
WorkstreamPausedStrip,
|
|
1412
1237
|
{
|
|
1413
1238
|
control: controller.effectiveControl,
|
|
@@ -1427,7 +1252,7 @@ function PausedState() {
|
|
|
1427
1252
|
function RestoredResources() {
|
|
1428
1253
|
const controller = useComposerController();
|
|
1429
1254
|
if (controller.restoredResources.length === 0 || !controller.removeRestoredResource) return null;
|
|
1430
|
-
return /* @__PURE__ */
|
|
1255
|
+
return /* @__PURE__ */ jsx3(
|
|
1431
1256
|
RestoredResourceChips,
|
|
1432
1257
|
{
|
|
1433
1258
|
resources: controller.restoredResources,
|
|
@@ -1439,7 +1264,7 @@ function RestoredResources() {
|
|
|
1439
1264
|
function Attachments() {
|
|
1440
1265
|
const controller = useComposerController();
|
|
1441
1266
|
if (!controller.attachments || controller.attachments.attachments.length === 0) return null;
|
|
1442
|
-
return /* @__PURE__ */
|
|
1267
|
+
return /* @__PURE__ */ jsx3(
|
|
1443
1268
|
AttachmentChips,
|
|
1444
1269
|
{
|
|
1445
1270
|
attachments: controller.attachments.attachments,
|
|
@@ -1455,7 +1280,7 @@ var Input = forwardRef(function ComposerInput({ rows = 1, placeholder, className
|
|
|
1455
1280
|
const controller = useComposerController();
|
|
1456
1281
|
const autoFocusedRef = useRef2(false);
|
|
1457
1282
|
const paletteOpen = controller.paletteEnabled && controller.paletteMounted && controller.palette.open;
|
|
1458
|
-
|
|
1283
|
+
useEffect(() => {
|
|
1459
1284
|
if (!autoFocus || controller.disabled || autoFocusedRef.current) return;
|
|
1460
1285
|
const frame = window.requestAnimationFrame(() => {
|
|
1461
1286
|
const textarea = controller.textareaRef.current;
|
|
@@ -1465,7 +1290,7 @@ var Input = forwardRef(function ComposerInput({ rows = 1, placeholder, className
|
|
|
1465
1290
|
});
|
|
1466
1291
|
return () => window.cancelAnimationFrame(frame);
|
|
1467
1292
|
}, [autoFocus, controller.disabled, controller.textareaRef]);
|
|
1468
|
-
return /* @__PURE__ */
|
|
1293
|
+
return /* @__PURE__ */ jsx3(
|
|
1469
1294
|
"textarea",
|
|
1470
1295
|
{
|
|
1471
1296
|
...props,
|
|
@@ -1496,7 +1321,7 @@ function Confirmation() {
|
|
|
1496
1321
|
const controller = useComposerController();
|
|
1497
1322
|
const command = controller.confirmState?.command;
|
|
1498
1323
|
if (!command || !controller.confirmState) return null;
|
|
1499
|
-
return /* @__PURE__ */
|
|
1324
|
+
return /* @__PURE__ */ jsx3(
|
|
1500
1325
|
ConfirmBar,
|
|
1501
1326
|
{
|
|
1502
1327
|
command,
|
|
@@ -1508,7 +1333,7 @@ function Confirmation() {
|
|
|
1508
1333
|
);
|
|
1509
1334
|
}
|
|
1510
1335
|
var Footer = forwardRef(function ComposerFooter({ className, ...props }, ref) {
|
|
1511
|
-
return /* @__PURE__ */
|
|
1336
|
+
return /* @__PURE__ */ jsx3(
|
|
1512
1337
|
"div",
|
|
1513
1338
|
{
|
|
1514
1339
|
...props,
|
|
@@ -1524,7 +1349,7 @@ var Footer = forwardRef(function ComposerFooter({ className, ...props }, ref) {
|
|
|
1524
1349
|
});
|
|
1525
1350
|
var Controls = forwardRef(
|
|
1526
1351
|
function ComposerControls({ className, ...props }, ref) {
|
|
1527
|
-
return /* @__PURE__ */
|
|
1352
|
+
return /* @__PURE__ */ jsx3(
|
|
1528
1353
|
"span",
|
|
1529
1354
|
{
|
|
1530
1355
|
...props,
|
|
@@ -1540,7 +1365,7 @@ var Controls = forwardRef(
|
|
|
1540
1365
|
);
|
|
1541
1366
|
var Hint = forwardRef(function ComposerHint({ className, children, ...props }, ref) {
|
|
1542
1367
|
const controller = useComposerController();
|
|
1543
|
-
return /* @__PURE__ */
|
|
1368
|
+
return /* @__PURE__ */ jsx3(
|
|
1544
1369
|
"span",
|
|
1545
1370
|
{
|
|
1546
1371
|
...props,
|
|
@@ -1554,7 +1379,7 @@ var Hint = forwardRef(function ComposerHint({ className, children, ...props }, r
|
|
|
1554
1379
|
);
|
|
1555
1380
|
});
|
|
1556
1381
|
var Actions = forwardRef(function ComposerActions({ className, ...props }, ref) {
|
|
1557
|
-
return /* @__PURE__ */
|
|
1382
|
+
return /* @__PURE__ */ jsx3(
|
|
1558
1383
|
"span",
|
|
1559
1384
|
{
|
|
1560
1385
|
...props,
|
|
@@ -1572,8 +1397,8 @@ var AttachButton = forwardRef(
|
|
|
1572
1397
|
const controller = useComposerController();
|
|
1573
1398
|
if (!controller.attachments) return null;
|
|
1574
1399
|
const tip = title ?? controller.messages.attachFiles;
|
|
1575
|
-
return /* @__PURE__ */
|
|
1576
|
-
/* @__PURE__ */
|
|
1400
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1401
|
+
/* @__PURE__ */ jsx3(
|
|
1577
1402
|
"input",
|
|
1578
1403
|
{
|
|
1579
1404
|
ref: controller.fileInputRef,
|
|
@@ -1585,7 +1410,7 @@ var AttachButton = forwardRef(
|
|
|
1585
1410
|
onChange: controller.handleFileChange
|
|
1586
1411
|
}
|
|
1587
1412
|
),
|
|
1588
|
-
/* @__PURE__ */
|
|
1413
|
+
/* @__PURE__ */ jsx3(ComposerTip, { tip, children: /* @__PURE__ */ jsx3(
|
|
1589
1414
|
"button",
|
|
1590
1415
|
{
|
|
1591
1416
|
...props,
|
|
@@ -1600,7 +1425,7 @@ var AttachButton = forwardRef(
|
|
|
1600
1425
|
"disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:size-11",
|
|
1601
1426
|
className
|
|
1602
1427
|
),
|
|
1603
|
-
children: children ?? /* @__PURE__ */
|
|
1428
|
+
children: children ?? /* @__PURE__ */ jsx3(PaperclipIcon, { className: "size-4" })
|
|
1604
1429
|
}
|
|
1605
1430
|
) })
|
|
1606
1431
|
] });
|
|
@@ -1616,7 +1441,7 @@ function ModelPicker2({
|
|
|
1616
1441
|
codexOnly
|
|
1617
1442
|
}) {
|
|
1618
1443
|
const controller = useComposerController();
|
|
1619
|
-
return /* @__PURE__ */
|
|
1444
|
+
return /* @__PURE__ */ jsx3(
|
|
1620
1445
|
ModelPicker,
|
|
1621
1446
|
{
|
|
1622
1447
|
models,
|
|
@@ -1636,7 +1461,7 @@ var PauseButton = forwardRef(
|
|
|
1636
1461
|
if (!controller.effectiveControl || controller.paused || !controller.hasControl) return null;
|
|
1637
1462
|
const busy = controller.pausing || controller.resuming;
|
|
1638
1463
|
const tip = title ?? controller.messages.pauseTitle;
|
|
1639
|
-
return /* @__PURE__ */
|
|
1464
|
+
return /* @__PURE__ */ jsx3(ComposerTip, { tip, children: /* @__PURE__ */ jsx3(
|
|
1640
1465
|
"button",
|
|
1641
1466
|
{
|
|
1642
1467
|
...props,
|
|
@@ -1652,7 +1477,7 @@ var PauseButton = forwardRef(
|
|
|
1652
1477
|
"disabled:opacity-50",
|
|
1653
1478
|
className
|
|
1654
1479
|
),
|
|
1655
|
-
children: children ?? (busy ? /* @__PURE__ */
|
|
1480
|
+
children: children ?? (busy ? /* @__PURE__ */ jsx3(LoaderCircleIcon, { className: "size-3.5 animate-og-spin" }) : /* @__PURE__ */ jsx3(PauseIcon, { className: "size-3.5 fill-current" }))
|
|
1656
1481
|
}
|
|
1657
1482
|
) });
|
|
1658
1483
|
}
|
|
@@ -1661,7 +1486,7 @@ var SendButton = forwardRef(
|
|
|
1661
1486
|
function ComposerSendButton({ className, "aria-label": ariaLabel, title, children, ...props }, ref) {
|
|
1662
1487
|
const controller = useComposerController();
|
|
1663
1488
|
const tip = title ?? (controller.submitBlocker === "annotations" ? controller.messages.annotationNotesRequired : controller.paused ? controller.messages.sendAndResumeTitle : controller.messages.sendTitle);
|
|
1664
|
-
return /* @__PURE__ */
|
|
1489
|
+
return /* @__PURE__ */ jsx3(ComposerTip, { tip, children: /* @__PURE__ */ jsx3(
|
|
1665
1490
|
"button",
|
|
1666
1491
|
{
|
|
1667
1492
|
...props,
|
|
@@ -1679,14 +1504,14 @@ var SendButton = forwardRef(
|
|
|
1679
1504
|
"disabled:cursor-not-allowed disabled:bg-og-surface-3 disabled:text-og-fg-subtle disabled:shadow-none",
|
|
1680
1505
|
className
|
|
1681
1506
|
),
|
|
1682
|
-
children: children ?? (controller.sending ? /* @__PURE__ */
|
|
1507
|
+
children: children ?? (controller.sending ? /* @__PURE__ */ jsx3(LoaderCircleIcon, { className: "size-4 animate-og-spin" }) : /* @__PURE__ */ jsx3(ArrowUpIcon, { className: "size-4" }))
|
|
1683
1508
|
}
|
|
1684
1509
|
) });
|
|
1685
1510
|
}
|
|
1686
1511
|
);
|
|
1687
1512
|
function Help() {
|
|
1688
1513
|
const controller = useComposerController();
|
|
1689
|
-
return /* @__PURE__ */
|
|
1514
|
+
return /* @__PURE__ */ jsx3(AnimatePresence2, { children: controller.helpOpen ? /* @__PURE__ */ jsx3(
|
|
1690
1515
|
HelpPanel,
|
|
1691
1516
|
{
|
|
1692
1517
|
commands: controller.helpCommands,
|
|
@@ -1697,9 +1522,9 @@ function Help() {
|
|
|
1697
1522
|
}
|
|
1698
1523
|
function Status() {
|
|
1699
1524
|
const controller = useComposerController();
|
|
1700
|
-
return /* @__PURE__ */
|
|
1701
|
-
/* @__PURE__ */
|
|
1702
|
-
|
|
1525
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1526
|
+
/* @__PURE__ */ jsx3(AnimatePresence2, { children: controller.activeNotice ? /* @__PURE__ */ jsx3(
|
|
1527
|
+
motion2.p,
|
|
1703
1528
|
{
|
|
1704
1529
|
initial: { opacity: 0, height: 0 },
|
|
1705
1530
|
animate: { opacity: 1, height: "auto" },
|
|
@@ -1711,9 +1536,9 @@ function Status() {
|
|
|
1711
1536
|
children: controller.activeNotice.message
|
|
1712
1537
|
}
|
|
1713
1538
|
) : null }),
|
|
1714
|
-
controller.draftConflict ? /* @__PURE__ */
|
|
1715
|
-
/* @__PURE__ */
|
|
1716
|
-
/* @__PURE__ */
|
|
1539
|
+
controller.draftConflict ? /* @__PURE__ */ jsxs3("div", { className: "mt-1.5 flex flex-wrap items-center gap-2 px-1 text-og-xs text-og-status-failed", children: [
|
|
1540
|
+
/* @__PURE__ */ jsx3("span", { className: "min-w-0 flex-1", children: controller.messages.draftConflict }),
|
|
1541
|
+
/* @__PURE__ */ jsx3(
|
|
1717
1542
|
"button",
|
|
1718
1543
|
{
|
|
1719
1544
|
type: "button",
|
|
@@ -1722,7 +1547,7 @@ function Status() {
|
|
|
1722
1547
|
children: controller.messages.useOtherDraft
|
|
1723
1548
|
}
|
|
1724
1549
|
),
|
|
1725
|
-
/* @__PURE__ */
|
|
1550
|
+
/* @__PURE__ */ jsx3(
|
|
1726
1551
|
"button",
|
|
1727
1552
|
{
|
|
1728
1553
|
type: "button",
|
|
@@ -1736,9 +1561,9 @@ function Status() {
|
|
|
1736
1561
|
}
|
|
1737
1562
|
function ComposerAnnouncements() {
|
|
1738
1563
|
const controller = useComposerController();
|
|
1739
|
-
return /* @__PURE__ */
|
|
1740
|
-
controller.activeNotice ? /* @__PURE__ */
|
|
1741
|
-
controller.draftConflict ? /* @__PURE__ */
|
|
1564
|
+
return /* @__PURE__ */ jsxs3("div", { className: "sr-only", children: [
|
|
1565
|
+
controller.activeNotice ? /* @__PURE__ */ jsx3("p", { role: controller.activeNotice.tone === "error" ? "alert" : "status", children: controller.activeNotice.message }) : null,
|
|
1566
|
+
controller.draftConflict ? /* @__PURE__ */ jsx3("p", { role: "alert", children: controller.messages.draftConflict }) : null
|
|
1742
1567
|
] });
|
|
1743
1568
|
}
|
|
1744
1569
|
function mergeRefs(...refs) {
|
|
@@ -1768,10 +1593,10 @@ function WorkstreamPausedStrip({
|
|
|
1768
1593
|
const broaderOptions = control.resumeOptions.filter(
|
|
1769
1594
|
(option) => option !== primary && option.scope !== "selected" && (option.scope !== "workspace" || canControlWorkspace)
|
|
1770
1595
|
);
|
|
1771
|
-
return /* @__PURE__ */
|
|
1772
|
-
/* @__PURE__ */
|
|
1773
|
-
/* @__PURE__ */
|
|
1774
|
-
/* @__PURE__ */
|
|
1596
|
+
return /* @__PURE__ */ jsxs3("div", { className: "border-b border-og-status-waiting/25 bg-og-status-waiting/[0.07]", children: [
|
|
1597
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 items-center gap-2 px-3 py-2", children: [
|
|
1598
|
+
/* @__PURE__ */ jsx3(PauseIcon, { className: "size-3.5 shrink-0 text-og-status-waiting" }),
|
|
1599
|
+
/* @__PURE__ */ jsxs3(
|
|
1775
1600
|
"button",
|
|
1776
1601
|
{
|
|
1777
1602
|
type: "button",
|
|
@@ -1779,12 +1604,12 @@ function WorkstreamPausedStrip({
|
|
|
1779
1604
|
onClick: () => onOpenChange(!open),
|
|
1780
1605
|
"aria-expanded": open,
|
|
1781
1606
|
children: [
|
|
1782
|
-
/* @__PURE__ */
|
|
1783
|
-
/* @__PURE__ */
|
|
1607
|
+
/* @__PURE__ */ jsx3("span", { className: "block truncate text-og-xs font-medium text-og-fg", children: cause }),
|
|
1608
|
+
/* @__PURE__ */ jsx3("span", { className: "block truncate text-[11px] text-og-fg-muted", children: queuedAheadCount > 0 ? messages.queuedAhead(queuedAheadCount) : sending ? messages.resumingAndSending : messages.nextMessageResumes })
|
|
1784
1609
|
]
|
|
1785
1610
|
}
|
|
1786
1611
|
),
|
|
1787
|
-
/* @__PURE__ */
|
|
1612
|
+
/* @__PURE__ */ jsxs3(
|
|
1788
1613
|
"button",
|
|
1789
1614
|
{
|
|
1790
1615
|
type: "button",
|
|
@@ -1793,47 +1618,47 @@ function WorkstreamPausedStrip({
|
|
|
1793
1618
|
disabled: busy,
|
|
1794
1619
|
onClick: onResume,
|
|
1795
1620
|
children: [
|
|
1796
|
-
busy ? /* @__PURE__ */
|
|
1797
|
-
/* @__PURE__ */
|
|
1798
|
-
/* @__PURE__ */
|
|
1621
|
+
busy ? /* @__PURE__ */ jsx3(LoaderCircleIcon, { className: "size-3.5 animate-og-spin" }) : /* @__PURE__ */ jsx3(PlayIcon, { className: "size-3.5 fill-current" }),
|
|
1622
|
+
/* @__PURE__ */ jsx3("span", { className: "og-composer-resume-label-long hidden min-[400px]:inline", children: messages.resumeThisWorkstream }),
|
|
1623
|
+
/* @__PURE__ */ jsx3("span", { className: "og-composer-resume-label-short min-[400px]:hidden", children: messages.resumeShort })
|
|
1799
1624
|
]
|
|
1800
1625
|
}
|
|
1801
1626
|
),
|
|
1802
|
-
/* @__PURE__ */
|
|
1627
|
+
/* @__PURE__ */ jsx3(
|
|
1803
1628
|
"button",
|
|
1804
1629
|
{
|
|
1805
1630
|
type: "button",
|
|
1806
1631
|
className: "inline-flex size-8 shrink-0 items-center justify-center rounded-og-md text-og-fg-muted hover:bg-og-surface-2 pointer-coarse:size-11",
|
|
1807
1632
|
onClick: () => onOpenChange(!open),
|
|
1808
1633
|
"aria-label": open ? messages.hidePauseDetails : messages.showPauseDetails,
|
|
1809
|
-
children: /* @__PURE__ */
|
|
1634
|
+
children: /* @__PURE__ */ jsx3(ChevronDownIcon2, { className: cn("size-3.5 transition-transform", open && "rotate-180") })
|
|
1810
1635
|
}
|
|
1811
1636
|
)
|
|
1812
1637
|
] }),
|
|
1813
|
-
open ? /* @__PURE__ */
|
|
1814
|
-
/* @__PURE__ */
|
|
1638
|
+
open ? /* @__PURE__ */ jsxs3("div", { className: "border-t border-og-status-waiting/20 px-3 pb-3 pt-2", children: [
|
|
1639
|
+
/* @__PURE__ */ jsx3("ul", { className: "grid gap-2", "aria-label": messages.pauseReasonsLabel, children: control.blockers.map((entry, index) => /* @__PURE__ */ jsxs3(
|
|
1815
1640
|
"li",
|
|
1816
1641
|
{
|
|
1817
1642
|
className: "text-og-xs",
|
|
1818
1643
|
children: [
|
|
1819
|
-
/* @__PURE__ */
|
|
1820
|
-
blockerHref(entry, controlLinks) ? /* @__PURE__ */
|
|
1644
|
+
/* @__PURE__ */ jsx3("span", { className: "font-medium text-og-fg", children: index === 0 ? messages.pausedByLabel : messages.alsoPausedByLabel }),
|
|
1645
|
+
blockerHref(entry, controlLinks) ? /* @__PURE__ */ jsx3(
|
|
1821
1646
|
"a",
|
|
1822
1647
|
{
|
|
1823
1648
|
href: blockerHref(entry, controlLinks),
|
|
1824
1649
|
className: "font-medium text-og-fg underline decoration-og-border-strong underline-offset-2 hover:text-og-accent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-ring/40",
|
|
1825
1650
|
children: entry.displayName
|
|
1826
1651
|
}
|
|
1827
|
-
) : /* @__PURE__ */
|
|
1828
|
-
entry.reason ? /* @__PURE__ */
|
|
1652
|
+
) : /* @__PURE__ */ jsx3("span", { className: "font-medium text-og-fg", children: entry.displayName }),
|
|
1653
|
+
entry.reason ? /* @__PURE__ */ jsxs3("span", { className: "text-og-fg-muted", children: [
|
|
1829
1654
|
" \xB7 ",
|
|
1830
1655
|
entry.reason
|
|
1831
1656
|
] }) : null,
|
|
1832
|
-
entry.actor ? /* @__PURE__ */
|
|
1657
|
+
entry.actor ? /* @__PURE__ */ jsxs3("span", { className: "text-og-fg-subtle", children: [
|
|
1833
1658
|
" \xB7 ",
|
|
1834
1659
|
entry.actor
|
|
1835
1660
|
] }) : null,
|
|
1836
|
-
entry.changedAt ? /* @__PURE__ */
|
|
1661
|
+
entry.changedAt ? /* @__PURE__ */ jsxs3("span", { className: "text-og-fg-subtle", children: [
|
|
1837
1662
|
" ",
|
|
1838
1663
|
"\xB7 ",
|
|
1839
1664
|
messages.formatRelativeTime(entry.changedAt)
|
|
@@ -1842,11 +1667,11 @@ function WorkstreamPausedStrip({
|
|
|
1842
1667
|
},
|
|
1843
1668
|
`${entry.kind}-${entry.sessionId ?? "workspace"}-${entry.revision}`
|
|
1844
1669
|
)) }),
|
|
1845
|
-
broaderOptions.length > 0 ? /* @__PURE__ */
|
|
1670
|
+
broaderOptions.length > 0 ? /* @__PURE__ */ jsx3("div", { className: "mt-2 flex flex-wrap gap-1.5", children: broaderOptions.map((option) => /* @__PURE__ */ jsx3(
|
|
1846
1671
|
ComposerTip,
|
|
1847
1672
|
{
|
|
1848
1673
|
tip: option.impactCopy,
|
|
1849
|
-
children: /* @__PURE__ */
|
|
1674
|
+
children: /* @__PURE__ */ jsxs3(
|
|
1850
1675
|
"button",
|
|
1851
1676
|
{
|
|
1852
1677
|
type: "button",
|
|
@@ -1854,8 +1679,8 @@ function WorkstreamPausedStrip({
|
|
|
1854
1679
|
onClick: () => onResumeOption(option),
|
|
1855
1680
|
className: "rounded-og-md border border-og-border bg-og-surface-1 px-2 py-1 text-og-xs text-og-fg-muted hover:bg-og-surface-2 hover:text-og-fg pointer-coarse:min-h-10",
|
|
1856
1681
|
children: [
|
|
1857
|
-
/* @__PURE__ */
|
|
1858
|
-
/* @__PURE__ */
|
|
1682
|
+
/* @__PURE__ */ jsx3("span", { className: "block font-medium", children: option.scope === "workspace" ? messages.resumeWorkspace : messages.resumeFromSession }),
|
|
1683
|
+
/* @__PURE__ */ jsx3("span", { className: "block text-[10px] text-og-fg-subtle", children: option.selectedStateAfter === "active" ? messages.sessionCanRun : messages.stillPausedBy(
|
|
1859
1684
|
option.remainingPrimaryBlocker?.displayName ?? messages.narrowerPause
|
|
1860
1685
|
) })
|
|
1861
1686
|
]
|
|
@@ -1876,26 +1701,26 @@ function RestoredResourceChips({
|
|
|
1876
1701
|
messages,
|
|
1877
1702
|
onRemove
|
|
1878
1703
|
}) {
|
|
1879
|
-
return /* @__PURE__ */
|
|
1704
|
+
return /* @__PURE__ */ jsx3(
|
|
1880
1705
|
"div",
|
|
1881
1706
|
{
|
|
1882
1707
|
className: "flex flex-wrap gap-1.5 border-b border-og-border px-3 py-2",
|
|
1883
1708
|
"aria-label": messages.restoredResourcesLabel,
|
|
1884
|
-
children: resources.map((resource, index) => /* @__PURE__ */
|
|
1709
|
+
children: resources.map((resource, index) => /* @__PURE__ */ jsxs3(
|
|
1885
1710
|
"span",
|
|
1886
1711
|
{
|
|
1887
1712
|
className: "inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-og-md border border-og-border bg-og-surface-2 px-2 py-1 text-og-xs text-og-fg-muted",
|
|
1888
1713
|
children: [
|
|
1889
|
-
/* @__PURE__ */
|
|
1890
|
-
/* @__PURE__ */
|
|
1891
|
-
/* @__PURE__ */
|
|
1714
|
+
/* @__PURE__ */ jsx3(FileIcon, { className: "size-3 shrink-0" }),
|
|
1715
|
+
/* @__PURE__ */ jsx3("span", { className: "truncate", children: resource.kind === "file" ? messages.restoredFile(resource.fileId) : resource.uri }),
|
|
1716
|
+
/* @__PURE__ */ jsx3(
|
|
1892
1717
|
"button",
|
|
1893
1718
|
{
|
|
1894
1719
|
type: "button",
|
|
1895
1720
|
className: "shrink-0 hover:text-og-fg",
|
|
1896
1721
|
onClick: () => onRemove(index),
|
|
1897
1722
|
"aria-label": messages.removeRestoredResource(index),
|
|
1898
|
-
children: /* @__PURE__ */
|
|
1723
|
+
children: /* @__PURE__ */ jsx3(XIcon, { className: "size-3" })
|
|
1899
1724
|
}
|
|
1900
1725
|
)
|
|
1901
1726
|
]
|
|
@@ -1914,12 +1739,12 @@ function ConfirmBar({
|
|
|
1914
1739
|
}) {
|
|
1915
1740
|
const confirmRef = useRef2(null);
|
|
1916
1741
|
const descriptionId = useId2();
|
|
1917
|
-
|
|
1742
|
+
useEffect(() => {
|
|
1918
1743
|
const returnTo = returnFocusRef?.current ?? null;
|
|
1919
1744
|
confirmRef.current?.focus();
|
|
1920
1745
|
return () => returnTo?.focus();
|
|
1921
1746
|
}, [returnFocusRef]);
|
|
1922
|
-
return /* @__PURE__ */
|
|
1747
|
+
return /* @__PURE__ */ jsxs3(
|
|
1923
1748
|
"div",
|
|
1924
1749
|
{
|
|
1925
1750
|
role: "alertdialog",
|
|
@@ -1935,9 +1760,9 @@ function ConfirmBar({
|
|
|
1935
1760
|
},
|
|
1936
1761
|
className: "flex items-end justify-between gap-2 px-2.5 pb-2.5 pt-1",
|
|
1937
1762
|
children: [
|
|
1938
|
-
/* @__PURE__ */
|
|
1939
|
-
/* @__PURE__ */
|
|
1940
|
-
/* @__PURE__ */
|
|
1763
|
+
/* @__PURE__ */ jsx3("span", { id: descriptionId, className: "min-w-0 flex-1 px-1.5 text-og-sm text-og-status-failed", children: messages.confirmDescription(command) }),
|
|
1764
|
+
/* @__PURE__ */ jsxs3("span", { className: "flex shrink-0 items-center gap-1.5", children: [
|
|
1765
|
+
/* @__PURE__ */ jsx3(
|
|
1941
1766
|
"button",
|
|
1942
1767
|
{
|
|
1943
1768
|
type: "button",
|
|
@@ -1946,7 +1771,7 @@ function ConfirmBar({
|
|
|
1946
1771
|
children: messages.cancel
|
|
1947
1772
|
}
|
|
1948
1773
|
),
|
|
1949
|
-
/* @__PURE__ */
|
|
1774
|
+
/* @__PURE__ */ jsx3(
|
|
1950
1775
|
"button",
|
|
1951
1776
|
{
|
|
1952
1777
|
ref: confirmRef,
|
|
@@ -1971,9 +1796,9 @@ function AttachmentChips({
|
|
|
1971
1796
|
}) {
|
|
1972
1797
|
const lightbox = useLightboxOptional();
|
|
1973
1798
|
const previewRequest = useRef2(null);
|
|
1974
|
-
const [previewLoadingId, setPreviewLoadingId] =
|
|
1975
|
-
const [previewErrorId, setPreviewErrorId] =
|
|
1976
|
-
|
|
1799
|
+
const [previewLoadingId, setPreviewLoadingId] = useState2(null);
|
|
1800
|
+
const [previewErrorId, setPreviewErrorId] = useState2(null);
|
|
1801
|
+
useEffect(() => () => previewRequest.current?.abort(), [onLoadPreview]);
|
|
1977
1802
|
async function openPreview(attachment, source, canLoadPreview) {
|
|
1978
1803
|
previewRequest.current?.abort();
|
|
1979
1804
|
const attachmentId = attachment.id;
|
|
@@ -2013,7 +1838,7 @@ function AttachmentChips({
|
|
|
2013
1838
|
releaseSource
|
|
2014
1839
|
);
|
|
2015
1840
|
}
|
|
2016
|
-
return /* @__PURE__ */
|
|
1841
|
+
return /* @__PURE__ */ jsx3("div", { className: "flex flex-wrap gap-2 px-3 py-2", children: attachments.map((attachment) => {
|
|
2017
1842
|
const failed = attachment.status === "failed";
|
|
2018
1843
|
const secureContextRequired = attachment.errorCode === "secure_context_required";
|
|
2019
1844
|
const previewFailed = previewErrorId === attachment.id;
|
|
@@ -2022,7 +1847,7 @@ function AttachmentChips({
|
|
|
2022
1847
|
lightbox && onLoadPreview && attachment.status === "ready" && attachment.file && attachment.contentType.startsWith("image/")
|
|
2023
1848
|
);
|
|
2024
1849
|
const statusText = previewFailed ? messages.previewUnavailable ?? "Preview unavailable" : attachment.status === "uploading" ? messages.uploading : failed ? attachment.error || messages.uploadFailed : messages.formatBytes(attachment.sizeBytes);
|
|
2025
|
-
return /* @__PURE__ */
|
|
1850
|
+
return /* @__PURE__ */ jsxs3(
|
|
2026
1851
|
"div",
|
|
2027
1852
|
{
|
|
2028
1853
|
className: cn(
|
|
@@ -2033,7 +1858,7 @@ function AttachmentChips({
|
|
|
2033
1858
|
) : "max-w-[240px] border-og-border bg-og-surface-2"
|
|
2034
1859
|
),
|
|
2035
1860
|
children: [
|
|
2036
|
-
lightbox && (attachment.previewUrl || canLoadPreview) ? /* @__PURE__ */
|
|
1861
|
+
lightbox && (attachment.previewUrl || canLoadPreview) ? /* @__PURE__ */ jsx3(
|
|
2037
1862
|
"button",
|
|
2038
1863
|
{
|
|
2039
1864
|
type: "button",
|
|
@@ -2045,46 +1870,46 @@ function AttachmentChips({
|
|
|
2045
1870
|
"aria-busy": previewLoading || void 0,
|
|
2046
1871
|
disabled: previewLoading,
|
|
2047
1872
|
onClick: (event) => void openPreview(attachment, event.currentTarget, canLoadPreview),
|
|
2048
|
-
children: attachment.previewUrl ? /* @__PURE__ */
|
|
1873
|
+
children: attachment.previewUrl ? /* @__PURE__ */ jsx3(
|
|
2049
1874
|
"img",
|
|
2050
1875
|
{
|
|
2051
1876
|
src: attachment.previewUrl,
|
|
2052
1877
|
alt: "",
|
|
2053
1878
|
className: "h-full w-full object-cover transition-opacity hover:opacity-80"
|
|
2054
1879
|
}
|
|
2055
|
-
) : previewLoading ? /* @__PURE__ */
|
|
1880
|
+
) : previewLoading ? /* @__PURE__ */ jsx3(LoaderCircleIcon, { className: "size-4 animate-og-spin text-og-fg-muted" }) : /* @__PURE__ */ jsx3(ImageIcon, { className: "size-4 text-og-fg-muted" })
|
|
2056
1881
|
}
|
|
2057
|
-
) : attachment.previewUrl ? /* @__PURE__ */
|
|
1882
|
+
) : attachment.previewUrl ? /* @__PURE__ */ jsx3(
|
|
2058
1883
|
"img",
|
|
2059
1884
|
{
|
|
2060
1885
|
src: attachment.previewUrl,
|
|
2061
1886
|
alt: "",
|
|
2062
1887
|
className: "size-8 shrink-0 rounded object-cover"
|
|
2063
1888
|
}
|
|
2064
|
-
) : attachment.contentType.startsWith("image/") ? /* @__PURE__ */
|
|
2065
|
-
/* @__PURE__ */
|
|
2066
|
-
/* @__PURE__ */
|
|
2067
|
-
secureContextRequired ? /* @__PURE__ */
|
|
1889
|
+
) : attachment.contentType.startsWith("image/") ? /* @__PURE__ */ jsx3(ImageIcon, { className: "size-4 shrink-0 text-og-fg-muted" }) : /* @__PURE__ */ jsx3(FileIcon, { className: "size-4 shrink-0 text-og-fg-muted" }),
|
|
1890
|
+
/* @__PURE__ */ jsxs3("div", { className: "min-w-0 flex-1", children: [
|
|
1891
|
+
/* @__PURE__ */ jsx3("div", { className: "truncate font-medium text-og-fg", children: attachment.name }),
|
|
1892
|
+
secureContextRequired ? /* @__PURE__ */ jsx3("div", { className: "break-words text-og-xs leading-4 text-og-status-failed", children: statusText }) : failed || previewFailed ? /* @__PURE__ */ jsx3(ComposerTip, { tip: statusText, children: /* @__PURE__ */ jsx3("div", { className: "truncate text-og-xs text-og-status-failed", children: statusText }) }) : /* @__PURE__ */ jsx3("div", { className: "truncate text-og-xs text-og-fg-subtle", children: statusText })
|
|
2068
1893
|
] }),
|
|
2069
|
-
attachment.status === "uploading" ? /* @__PURE__ */
|
|
2070
|
-
failed && !secureContextRequired && onRetry ? /* @__PURE__ */
|
|
1894
|
+
attachment.status === "uploading" ? /* @__PURE__ */ jsx3(LoaderCircleIcon, { className: "size-3.5 shrink-0 animate-og-spin" }) : null,
|
|
1895
|
+
failed && !secureContextRequired && onRetry ? /* @__PURE__ */ jsx3(ComposerTip, { tip: messages.retryUpload, children: /* @__PURE__ */ jsx3(
|
|
2071
1896
|
"button",
|
|
2072
1897
|
{
|
|
2073
1898
|
type: "button",
|
|
2074
1899
|
onClick: () => onRetry(attachment.id),
|
|
2075
1900
|
className: "shrink-0 rounded-og-xs p-1 text-og-fg-muted hover:bg-og-surface-1 hover:text-og-fg pointer-coarse:size-10",
|
|
2076
1901
|
"aria-label": messages.retryAttachment(attachment.name),
|
|
2077
|
-
children: /* @__PURE__ */
|
|
1902
|
+
children: /* @__PURE__ */ jsx3(RotateCwIcon, { className: "size-3.5" })
|
|
2078
1903
|
}
|
|
2079
1904
|
) }) : null,
|
|
2080
|
-
/* @__PURE__ */
|
|
1905
|
+
/* @__PURE__ */ jsx3(
|
|
2081
1906
|
"button",
|
|
2082
1907
|
{
|
|
2083
1908
|
type: "button",
|
|
2084
1909
|
onClick: () => onRemove(attachment.id),
|
|
2085
1910
|
className: "shrink-0 rounded-og-xs p-1 text-og-fg-muted hover:bg-og-surface-1 hover:text-og-fg pointer-coarse:size-10",
|
|
2086
1911
|
"aria-label": messages.removeAttachment(attachment.name),
|
|
2087
|
-
children: /* @__PURE__ */
|
|
1912
|
+
children: /* @__PURE__ */ jsx3(XIcon, { className: "size-3.5" })
|
|
2088
1913
|
}
|
|
2089
1914
|
)
|
|
2090
1915
|
]
|
|
@@ -2098,17 +1923,17 @@ function HelpPanel({
|
|
|
2098
1923
|
messages,
|
|
2099
1924
|
onClose
|
|
2100
1925
|
}) {
|
|
2101
|
-
return /* @__PURE__ */
|
|
2102
|
-
|
|
1926
|
+
return /* @__PURE__ */ jsxs3(
|
|
1927
|
+
motion2.div,
|
|
2103
1928
|
{
|
|
2104
1929
|
initial: { opacity: 0, height: 0 },
|
|
2105
1930
|
animate: { opacity: 1, height: "auto" },
|
|
2106
1931
|
exit: { opacity: 0, height: 0 },
|
|
2107
1932
|
className: "mt-2 overflow-hidden rounded-og-lg border border-og-border bg-og-surface-2",
|
|
2108
1933
|
children: [
|
|
2109
|
-
/* @__PURE__ */
|
|
2110
|
-
/* @__PURE__ */
|
|
2111
|
-
/* @__PURE__ */
|
|
1934
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between border-b border-og-border px-3 py-1.5", children: [
|
|
1935
|
+
/* @__PURE__ */ jsx3("span", { className: "text-og-sm font-medium text-og-fg", children: messages.commands }),
|
|
1936
|
+
/* @__PURE__ */ jsx3(
|
|
2112
1937
|
"button",
|
|
2113
1938
|
{
|
|
2114
1939
|
type: "button",
|
|
@@ -2118,16 +1943,16 @@ function HelpPanel({
|
|
|
2118
1943
|
}
|
|
2119
1944
|
)
|
|
2120
1945
|
] }),
|
|
2121
|
-
/* @__PURE__ */
|
|
1946
|
+
/* @__PURE__ */ jsx3("ul", { className: "py-1", children: commands.map((command) => {
|
|
2122
1947
|
const hint = argHint(command.args);
|
|
2123
|
-
return /* @__PURE__ */
|
|
2124
|
-
/* @__PURE__ */
|
|
1948
|
+
return /* @__PURE__ */ jsxs3("li", { className: "flex items-baseline gap-2 px-3 py-1", children: [
|
|
1949
|
+
/* @__PURE__ */ jsxs3("span", { className: "font-mono text-og-sm text-og-accent", children: [
|
|
2125
1950
|
"/",
|
|
2126
1951
|
command.name,
|
|
2127
|
-
hint ? /* @__PURE__ */
|
|
1952
|
+
hint ? /* @__PURE__ */ jsx3("span", { className: "ml-1 text-og-fg-subtle", children: hint }) : null
|
|
2128
1953
|
] }),
|
|
2129
|
-
/* @__PURE__ */
|
|
2130
|
-
command.danger ? /* @__PURE__ */
|
|
1954
|
+
/* @__PURE__ */ jsx3("span", { className: "text-og-sm text-og-fg-muted", children: command.description }),
|
|
1955
|
+
command.danger ? /* @__PURE__ */ jsx3("span", { className: "ml-auto rounded-og-xs bg-og-status-failed/15 px-1 text-og-xs uppercase tracking-wide text-og-status-failed", children: messages.danger }) : null
|
|
2131
1956
|
] }, command.name);
|
|
2132
1957
|
}) })
|
|
2133
1958
|
]
|
|
@@ -2485,7 +2310,7 @@ import {
|
|
|
2485
2310
|
authorizeTranscriptionAdapter,
|
|
2486
2311
|
createTranscriptionSessionRequest
|
|
2487
2312
|
} from "@opengeni/sdk";
|
|
2488
|
-
import { useCallback as
|
|
2313
|
+
import { useCallback as useCallback3, useEffect as useEffect2, useMemo as useMemo4, useRef as useRef3, useState as useState3 } from "react";
|
|
2489
2314
|
var INITIAL_TRANSCRIPTION_CONTROL_STATE = {
|
|
2490
2315
|
status: "idle",
|
|
2491
2316
|
generation: 0,
|
|
@@ -2647,7 +2472,7 @@ function useTranscription({
|
|
|
2647
2472
|
lifecycleTimeouts,
|
|
2648
2473
|
onDiagnostic
|
|
2649
2474
|
}) {
|
|
2650
|
-
const [state, setState] =
|
|
2475
|
+
const [state, setState] = useState3(INITIAL_TRANSCRIPTION_CONTROL_STATE);
|
|
2651
2476
|
const stateRef = useRef3(state);
|
|
2652
2477
|
const valueRef = useRef3(value);
|
|
2653
2478
|
const sessionRef = useRef3(null);
|
|
@@ -2662,7 +2487,7 @@ function useTranscription({
|
|
|
2662
2487
|
lifecycleTimeouts?.cleanupMs,
|
|
2663
2488
|
DEFAULT_TRANSCRIPTION_LIFECYCLE_TIMEOUTS.cleanupMs
|
|
2664
2489
|
);
|
|
2665
|
-
const reportDiagnostic =
|
|
2490
|
+
const reportDiagnostic = useCallback3(
|
|
2666
2491
|
(diagnostic) => {
|
|
2667
2492
|
if (!onDiagnostic) return;
|
|
2668
2493
|
try {
|
|
@@ -2673,19 +2498,19 @@ function useTranscription({
|
|
|
2673
2498
|
[onDiagnostic]
|
|
2674
2499
|
);
|
|
2675
2500
|
const cleanupRuntimeRef = useRef3({ cleanupTimeoutMs, reportDiagnostic });
|
|
2676
|
-
|
|
2501
|
+
useEffect2(() => {
|
|
2677
2502
|
cleanupRuntimeRef.current = { cleanupTimeoutMs, reportDiagnostic };
|
|
2678
2503
|
}, [cleanupTimeoutMs, reportDiagnostic]);
|
|
2679
|
-
const policyRevision =
|
|
2504
|
+
const policyRevision = useMemo4(
|
|
2680
2505
|
() => transcriptionPolicyRevision(policy, selection),
|
|
2681
2506
|
[policy, selection]
|
|
2682
2507
|
);
|
|
2683
|
-
const authorization =
|
|
2508
|
+
const authorization = useMemo4(
|
|
2684
2509
|
() => adapter ? authorizeTranscriptionAdapter(policy, adapter.descriptor, selection) : null,
|
|
2685
2510
|
[adapter, policy, selection]
|
|
2686
2511
|
);
|
|
2687
2512
|
const unavailableReason = disabled ? "composer_disabled" : !policy.enabled ? "disabled" : !policy.acceptanceId ? "unaccepted" : !policy.primary ? "target_missing" : !adapter ? "adapter_missing" : authorization?.authorized ? null : authorization?.reason ?? "unaccepted";
|
|
2688
|
-
const apply =
|
|
2513
|
+
const apply = useCallback3(
|
|
2689
2514
|
(action) => {
|
|
2690
2515
|
const transition = transitionTranscriptionControl(stateRef.current, action);
|
|
2691
2516
|
if (transition.state !== stateRef.current) {
|
|
@@ -2702,7 +2527,7 @@ function useTranscription({
|
|
|
2702
2527
|
},
|
|
2703
2528
|
[focusInput, setValue]
|
|
2704
2529
|
);
|
|
2705
|
-
const releaseTerminalSession =
|
|
2530
|
+
const releaseTerminalSession = useCallback3(
|
|
2706
2531
|
(generation) => {
|
|
2707
2532
|
const active = sessionRef.current;
|
|
2708
2533
|
if (!active || active.generation !== generation) return;
|
|
@@ -2715,7 +2540,7 @@ function useTranscription({
|
|
|
2715
2540
|
},
|
|
2716
2541
|
[cleanupTimeoutMs, reportDiagnostic]
|
|
2717
2542
|
);
|
|
2718
|
-
const start =
|
|
2543
|
+
const start = useCallback3(async () => {
|
|
2719
2544
|
if (!adapter || unavailableReason !== null || isActiveTranscriptionStatus(stateRef.current.status)) {
|
|
2720
2545
|
return false;
|
|
2721
2546
|
}
|
|
@@ -2849,7 +2674,7 @@ function useTranscription({
|
|
|
2849
2674
|
startTimeoutMs,
|
|
2850
2675
|
unavailableReason
|
|
2851
2676
|
]);
|
|
2852
|
-
const cancel =
|
|
2677
|
+
const cancel = useCallback3(async () => {
|
|
2853
2678
|
const current = stateRef.current;
|
|
2854
2679
|
if (!isActiveTranscriptionStatus(current.status)) return false;
|
|
2855
2680
|
const generation = current.generation;
|
|
@@ -2873,8 +2698,8 @@ function useTranscription({
|
|
|
2873
2698
|
}
|
|
2874
2699
|
return true;
|
|
2875
2700
|
}, [apply, cleanupTimeoutMs, focusInput, reportDiagnostic]);
|
|
2876
|
-
const reset =
|
|
2877
|
-
|
|
2701
|
+
const reset = useCallback3(() => apply({ type: "reset" }), [apply]);
|
|
2702
|
+
useEffect2(() => {
|
|
2878
2703
|
if (!isActiveTranscriptionStatus(state.status)) return;
|
|
2879
2704
|
const onKeyDown = (event) => {
|
|
2880
2705
|
if (event.key !== "Escape") return;
|
|
@@ -2884,7 +2709,7 @@ function useTranscription({
|
|
|
2884
2709
|
document.addEventListener("keydown", onKeyDown);
|
|
2885
2710
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
2886
2711
|
}, [cancel, state.status]);
|
|
2887
|
-
|
|
2712
|
+
useEffect2(() => {
|
|
2888
2713
|
if (!isActiveTranscriptionStatus(state.status)) return;
|
|
2889
2714
|
const activePolicy = activePolicyRef.current;
|
|
2890
2715
|
if (unavailableReason === null && activePolicy?.generation === state.generation && activePolicy.revision === policyRevision) {
|
|
@@ -2892,7 +2717,7 @@ function useTranscription({
|
|
|
2892
2717
|
}
|
|
2893
2718
|
void cancel();
|
|
2894
2719
|
}, [cancel, policyRevision, state.generation, state.status, unavailableReason]);
|
|
2895
|
-
|
|
2720
|
+
useEffect2(
|
|
2896
2721
|
() => () => {
|
|
2897
2722
|
const pending = pendingStartRef.current;
|
|
2898
2723
|
pendingStartRef.current = null;
|
|
@@ -3046,7 +2871,7 @@ function transcriptionPolicyRevision(policy, selection) {
|
|
|
3046
2871
|
|
|
3047
2872
|
// src/hooks/use-voice-input.ts
|
|
3048
2873
|
import { OpenGeniApiError } from "@opengeni/sdk";
|
|
3049
|
-
import { useCallback as
|
|
2874
|
+
import { useCallback as useCallback4, useEffect as useEffect3, useRef as useRef4, useState as useState4 } from "react";
|
|
3050
2875
|
|
|
3051
2876
|
// src/voice-recording-owner.ts
|
|
3052
2877
|
var VOICE_RECORDING_OWNER_SESSION_KEY = "opengeni.voice-recording-owner.v1";
|
|
@@ -3270,20 +3095,20 @@ function useVoiceInput({
|
|
|
3270
3095
|
now = currentDate,
|
|
3271
3096
|
automaticRetryDelayMilliseconds
|
|
3272
3097
|
}) {
|
|
3273
|
-
const [status, setStatus] =
|
|
3274
|
-
const [error, setError] =
|
|
3275
|
-
const [stream, setStream] =
|
|
3276
|
-
const [recordingId, setRecordingId] =
|
|
3277
|
-
const [durationSeconds, setDurationSeconds] =
|
|
3278
|
-
const [locallySaved, setLocallySaved] =
|
|
3279
|
-
const [storageAvailable, setStorageAvailable] =
|
|
3098
|
+
const [status, setStatus] = useState4("idle");
|
|
3099
|
+
const [error, setError] = useState4(null);
|
|
3100
|
+
const [stream, setStream] = useState4(null);
|
|
3101
|
+
const [recordingId, setRecordingId] = useState4(null);
|
|
3102
|
+
const [durationSeconds, setDurationSeconds] = useState4(0);
|
|
3103
|
+
const [locallySaved, setLocallySaved] = useState4(false);
|
|
3104
|
+
const [storageAvailable, setStorageAvailable] = useState4(
|
|
3280
3105
|
() => Boolean(createRecordingStore) || typeof globalThis.indexedDB !== "undefined"
|
|
3281
3106
|
);
|
|
3282
3107
|
const createRecordingStoreRef = useRef4(createRecordingStore);
|
|
3283
3108
|
createRecordingStoreRef.current = createRecordingStore;
|
|
3284
3109
|
const nowRef = useRef4(now);
|
|
3285
3110
|
nowRef.current = now;
|
|
3286
|
-
const readNow =
|
|
3111
|
+
const readNow = useCallback4(() => nowRef.current(), []);
|
|
3287
3112
|
const generationRef = useRef4(0);
|
|
3288
3113
|
const workspaceIdRef = useRef4(workspaceId);
|
|
3289
3114
|
const ownerIdRef = useRef4(null);
|
|
@@ -3311,7 +3136,7 @@ function useVoiceInput({
|
|
|
3311
3136
|
valueRef.current = value;
|
|
3312
3137
|
statusRef.current = status;
|
|
3313
3138
|
workspaceIdRef.current = workspaceId;
|
|
3314
|
-
const ensureOwnerId =
|
|
3139
|
+
const ensureOwnerId = useCallback4(async () => {
|
|
3315
3140
|
if (ownerIdRef.current) return ownerIdRef.current;
|
|
3316
3141
|
ownerIdPromiseRef.current ??= (async () => {
|
|
3317
3142
|
const injectedOwnerId = createOwnerIdRef.current?.();
|
|
@@ -3326,11 +3151,11 @@ function useVoiceInput({
|
|
|
3326
3151
|
})();
|
|
3327
3152
|
return await ownerIdPromiseRef.current;
|
|
3328
3153
|
}, []);
|
|
3329
|
-
const stopOwnerHeartbeat =
|
|
3154
|
+
const stopOwnerHeartbeat = useCallback4(() => {
|
|
3330
3155
|
if (ownerHeartbeatTimerRef.current) clearInterval(ownerHeartbeatTimerRef.current);
|
|
3331
3156
|
ownerHeartbeatTimerRef.current = null;
|
|
3332
3157
|
}, []);
|
|
3333
|
-
const clearCaptureRuntime =
|
|
3158
|
+
const clearCaptureRuntime = useCallback4((expectedStream) => {
|
|
3334
3159
|
const captureStream = expectedStream ?? streamRef.current;
|
|
3335
3160
|
captureStream?.getTracks().forEach((track) => track.stop());
|
|
3336
3161
|
if (expectedStream && streamRef.current !== expectedStream) return;
|
|
@@ -3340,7 +3165,7 @@ function useVoiceInput({
|
|
|
3340
3165
|
recorderRef.current = null;
|
|
3341
3166
|
setStream(null);
|
|
3342
3167
|
}, []);
|
|
3343
|
-
const clearVisibleRecording =
|
|
3168
|
+
const clearVisibleRecording = useCallback4(() => {
|
|
3344
3169
|
stopOwnerHeartbeat();
|
|
3345
3170
|
manifestRef.current = null;
|
|
3346
3171
|
setRecordingId(null);
|
|
@@ -3348,7 +3173,7 @@ function useVoiceInput({
|
|
|
3348
3173
|
setLocallySaved(false);
|
|
3349
3174
|
automaticRetryAttemptRef.current = 0;
|
|
3350
3175
|
}, [stopOwnerHeartbeat]);
|
|
3351
|
-
const ensureStore =
|
|
3176
|
+
const ensureStore = useCallback4(async () => {
|
|
3352
3177
|
if (storeRef.current) return storeRef.current;
|
|
3353
3178
|
if (!storePromiseRef.current) {
|
|
3354
3179
|
storePromiseRef.current = Promise.resolve().then(() => {
|
|
@@ -3368,13 +3193,13 @@ function useVoiceInput({
|
|
|
3368
3193
|
throw reason;
|
|
3369
3194
|
}
|
|
3370
3195
|
}, []);
|
|
3371
|
-
const rememberManifest =
|
|
3196
|
+
const rememberManifest = useCallback4((manifest) => {
|
|
3372
3197
|
manifestRef.current = manifest;
|
|
3373
3198
|
setRecordingId(manifest.recordingId);
|
|
3374
3199
|
setDurationSeconds(manifest.totalDurationMilliseconds / 1e3);
|
|
3375
3200
|
setLocallySaved(manifest.chunkCount > 0);
|
|
3376
3201
|
}, []);
|
|
3377
|
-
const beginOwnerHeartbeat =
|
|
3202
|
+
const beginOwnerHeartbeat = useCallback4(
|
|
3378
3203
|
(manifest) => {
|
|
3379
3204
|
stopOwnerHeartbeat();
|
|
3380
3205
|
ownerHeartbeatTimerRef.current = setInterval(() => {
|
|
@@ -3399,7 +3224,7 @@ function useVoiceInput({
|
|
|
3399
3224
|
},
|
|
3400
3225
|
[ensureStore, readNow, stopOwnerHeartbeat]
|
|
3401
3226
|
);
|
|
3402
|
-
const preserveForRetry =
|
|
3227
|
+
const preserveForRetry = useCallback4(
|
|
3403
3228
|
async (manifest, code, generation) => {
|
|
3404
3229
|
if (generation !== generationRef.current) return;
|
|
3405
3230
|
rememberManifest(manifest);
|
|
@@ -3410,7 +3235,7 @@ function useVoiceInput({
|
|
|
3410
3235
|
},
|
|
3411
3236
|
[focusInput, rememberManifest]
|
|
3412
3237
|
);
|
|
3413
|
-
const updateManifestBestEffort =
|
|
3238
|
+
const updateManifestBestEffort = useCallback4(
|
|
3414
3239
|
async (manifest, update) => {
|
|
3415
3240
|
try {
|
|
3416
3241
|
return await (await ensureStore()).updateManifest(
|
|
@@ -3425,7 +3250,7 @@ function useVoiceInput({
|
|
|
3425
3250
|
},
|
|
3426
3251
|
[ensureStore, readNow]
|
|
3427
3252
|
);
|
|
3428
|
-
const loadNextRecoverable =
|
|
3253
|
+
const loadNextRecoverable = useCallback4(
|
|
3429
3254
|
async (generation) => {
|
|
3430
3255
|
const active = () => generation === generationRef.current && workspaceIdRef.current === workspaceId;
|
|
3431
3256
|
const [store, ownerId] = await Promise.all([ensureStore(), ensureOwnerId()]);
|
|
@@ -3477,7 +3302,7 @@ function useVoiceInput({
|
|
|
3477
3302
|
},
|
|
3478
3303
|
[beginOwnerHeartbeat, ensureOwnerId, ensureStore, readNow, rememberManifest, workspaceId]
|
|
3479
3304
|
);
|
|
3480
|
-
const finalizePersistedRecording =
|
|
3305
|
+
const finalizePersistedRecording = useCallback4(
|
|
3481
3306
|
async (generation) => {
|
|
3482
3307
|
const manifest = manifestRef.current;
|
|
3483
3308
|
const resumable = capability?.resumable && isResumableVoiceInputClient(client) ? capability.resumable : null;
|
|
@@ -3634,7 +3459,7 @@ function useVoiceInput({
|
|
|
3634
3459
|
const finalizePersistedRecordingRef = useRef4(finalizePersistedRecording);
|
|
3635
3460
|
finalizePersistedRecordingRef.current = finalizePersistedRecording;
|
|
3636
3461
|
const clientAvailable = client !== null && client !== void 0;
|
|
3637
|
-
|
|
3462
|
+
useEffect3(() => {
|
|
3638
3463
|
if (status !== "retrying" || !manifestRef.current || manifestRef.current.recoveryMode !== "automatic" || manifestRef.current.workspaceId !== workspaceId || !clientAvailable || disabled || !enabled) {
|
|
3639
3464
|
return;
|
|
3640
3465
|
}
|
|
@@ -3669,7 +3494,7 @@ function useVoiceInput({
|
|
|
3669
3494
|
automaticRetryTimerRef.current = null;
|
|
3670
3495
|
};
|
|
3671
3496
|
}, [automaticRetryDelayMilliseconds, clientAvailable, disabled, enabled, status, workspaceId]);
|
|
3672
|
-
const stop =
|
|
3497
|
+
const stop = useCallback4(() => {
|
|
3673
3498
|
const recorder = recorderRef.current;
|
|
3674
3499
|
if (!recorder || recorder.state === "inactive") return;
|
|
3675
3500
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
@@ -3677,7 +3502,7 @@ function useVoiceInput({
|
|
|
3677
3502
|
setStatus("saving");
|
|
3678
3503
|
recorder.stop();
|
|
3679
3504
|
}, []);
|
|
3680
|
-
const start =
|
|
3505
|
+
const start = useCallback4(async () => {
|
|
3681
3506
|
if (disabled || !client || !enabled || !capability?.available || manifestRef.current !== null || status === "requesting-permission" || status === "recording" || status === "saving" || status === "transcribing" || status === "retrying" || !navigator.mediaDevices?.getUserMedia || typeof MediaRecorder === "undefined") {
|
|
3682
3507
|
return false;
|
|
3683
3508
|
}
|
|
@@ -3902,7 +3727,7 @@ function useVoiceInput({
|
|
|
3902
3727
|
updateManifestBestEffort,
|
|
3903
3728
|
workspaceId
|
|
3904
3729
|
]);
|
|
3905
|
-
const retry =
|
|
3730
|
+
const retry = useCallback4(() => {
|
|
3906
3731
|
if (!manifestRef.current || manifestRef.current.finalizationState === "transcript-ready" || manifestRef.current.workspaceId !== workspaceId || !client || disabled || !enabled || status === "saving" || status === "transcribing") {
|
|
3907
3732
|
return;
|
|
3908
3733
|
}
|
|
@@ -3931,7 +3756,7 @@ function useVoiceInput({
|
|
|
3931
3756
|
updateManifestBestEffort,
|
|
3932
3757
|
workspaceId
|
|
3933
3758
|
]);
|
|
3934
|
-
const insertSavedTranscript =
|
|
3759
|
+
const insertSavedTranscript = useCallback4(async () => {
|
|
3935
3760
|
const manifest = manifestRef.current;
|
|
3936
3761
|
if (!manifest || manifest.workspaceId !== workspaceId || manifest.finalizationState !== "transcript-ready" || manifest.transcriptText === null) {
|
|
3937
3762
|
return;
|
|
@@ -3986,7 +3811,7 @@ function useVoiceInput({
|
|
|
3986
3811
|
setValue,
|
|
3987
3812
|
workspaceId
|
|
3988
3813
|
]);
|
|
3989
|
-
const discard =
|
|
3814
|
+
const discard = useCallback4(async () => {
|
|
3990
3815
|
const manifest = manifestRef.current;
|
|
3991
3816
|
const generation = ++generationRef.current;
|
|
3992
3817
|
controllerRef.current?.abort();
|
|
@@ -4034,7 +3859,7 @@ function useVoiceInput({
|
|
|
4034
3859
|
rememberManifest,
|
|
4035
3860
|
workspaceId
|
|
4036
3861
|
]);
|
|
4037
|
-
const cancel =
|
|
3862
|
+
const cancel = useCallback4(() => {
|
|
4038
3863
|
if (status === "recording" || status === "requesting-permission") {
|
|
4039
3864
|
void discard();
|
|
4040
3865
|
return;
|
|
@@ -4060,7 +3885,7 @@ function useVoiceInput({
|
|
|
4060
3885
|
});
|
|
4061
3886
|
}
|
|
4062
3887
|
}, [discard, preserveForRetry, status, updateManifestBestEffort]);
|
|
4063
|
-
|
|
3888
|
+
useEffect3(() => {
|
|
4064
3889
|
const current = manifestRef.current;
|
|
4065
3890
|
const generation = ++generationRef.current;
|
|
4066
3891
|
if (current && current.workspaceId !== workspaceId) {
|
|
@@ -4110,7 +3935,7 @@ function useVoiceInput({
|
|
|
4110
3935
|
readNow,
|
|
4111
3936
|
workspaceId
|
|
4112
3937
|
]);
|
|
4113
|
-
|
|
3938
|
+
useEffect3(() => {
|
|
4114
3939
|
const onKeyDown = (event) => {
|
|
4115
3940
|
if (event.key === "Escape" && (status === "requesting-permission" || status === "recording" || status === "saving" || status === "transcribing" || status === "retrying")) {
|
|
4116
3941
|
event.preventDefault();
|
|
@@ -4120,7 +3945,7 @@ function useVoiceInput({
|
|
|
4120
3945
|
document.addEventListener("keydown", onKeyDown);
|
|
4121
3946
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
4122
3947
|
}, [cancel, status]);
|
|
4123
|
-
|
|
3948
|
+
useEffect3(
|
|
4124
3949
|
() => () => {
|
|
4125
3950
|
generationRef.current += 1;
|
|
4126
3951
|
controllerRef.current?.abort();
|
|
@@ -4404,15 +4229,15 @@ import {
|
|
|
4404
4229
|
RefreshCwIcon,
|
|
4405
4230
|
SquareIcon,
|
|
4406
4231
|
Trash2Icon,
|
|
4407
|
-
XIcon as
|
|
4232
|
+
XIcon as XIcon2
|
|
4408
4233
|
} from "lucide-react";
|
|
4409
|
-
import { AnimatePresence as
|
|
4410
|
-
import { useEffect as
|
|
4411
|
-
import { Fragment as
|
|
4234
|
+
import { AnimatePresence as AnimatePresence3, motion as motion3 } from "motion/react";
|
|
4235
|
+
import { useEffect as useEffect4, useState as useState5 } from "react";
|
|
4236
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
4412
4237
|
function Tip({ tip, children }) {
|
|
4413
|
-
return /* @__PURE__ */
|
|
4414
|
-
/* @__PURE__ */
|
|
4415
|
-
/* @__PURE__ */
|
|
4238
|
+
return /* @__PURE__ */ jsxs4(Tooltip, { children: [
|
|
4239
|
+
/* @__PURE__ */ jsx4(TooltipTrigger, { asChild: true, children }),
|
|
4240
|
+
/* @__PURE__ */ jsx4(TooltipContent, { side: "top", children: tip })
|
|
4416
4241
|
] });
|
|
4417
4242
|
}
|
|
4418
4243
|
var defaultMessages = {
|
|
@@ -4476,7 +4301,7 @@ function ComposerTranscriptionControl({
|
|
|
4476
4301
|
const retrying = status === "retrying";
|
|
4477
4302
|
const capturing = status === "requesting-permission" || status === "recording";
|
|
4478
4303
|
const cancelTranscription = transcription.cancel;
|
|
4479
|
-
|
|
4304
|
+
useEffect4(() => {
|
|
4480
4305
|
if (!suppressed) return;
|
|
4481
4306
|
if (status === "recording" || status === "requesting-permission") {
|
|
4482
4307
|
cancelTranscription();
|
|
@@ -4496,8 +4321,8 @@ function ComposerTranscriptionControl({
|
|
|
4496
4321
|
}
|
|
4497
4322
|
void transcription.start();
|
|
4498
4323
|
}
|
|
4499
|
-
return /* @__PURE__ */
|
|
4500
|
-
|
|
4324
|
+
return /* @__PURE__ */ jsx4(AnimatePresence3, { initial: false, children: suppressed ? null : /* @__PURE__ */ jsx4(
|
|
4325
|
+
motion3.span,
|
|
4501
4326
|
{
|
|
4502
4327
|
initial: { opacity: 0, width: 0 },
|
|
4503
4328
|
animate: { opacity: 1, width: "auto" },
|
|
@@ -4512,9 +4337,9 @@ function ComposerTranscriptionControl({
|
|
|
4512
4337
|
),
|
|
4513
4338
|
"data-transcription-status": status,
|
|
4514
4339
|
"data-transcription-capturing": capturing ? "" : void 0,
|
|
4515
|
-
children: /* @__PURE__ */
|
|
4516
|
-
/* @__PURE__ */
|
|
4517
|
-
|
|
4340
|
+
children: /* @__PURE__ */ jsxs4("span", { className: "inline-flex min-w-0 items-center gap-1.5", children: [
|
|
4341
|
+
/* @__PURE__ */ jsx4(AnimatePresence3, { mode: "popLayout", initial: false, children: recoverable ? /* @__PURE__ */ jsxs4(
|
|
4342
|
+
motion3.span,
|
|
4518
4343
|
{
|
|
4519
4344
|
initial: { opacity: 0, scale: 0.96 },
|
|
4520
4345
|
animate: { opacity: 1, scale: 1 },
|
|
@@ -4525,12 +4350,12 @@ function ComposerTranscriptionControl({
|
|
|
4525
4350
|
"bg-og-surface-2/70 pl-2 pr-1 pointer-coarse:h-11"
|
|
4526
4351
|
),
|
|
4527
4352
|
children: [
|
|
4528
|
-
/* @__PURE__ */
|
|
4529
|
-
/* @__PURE__ */
|
|
4353
|
+
/* @__PURE__ */ jsx4("span", { className: "og-transcription-recovered-label max-w-44 truncate text-og-xs text-og-fg-muted max-sm:max-w-28", children: savedTranscript ? errorMessage3 ?? messages.recoveredTranscript : retrying ? messages.retrying : status === "error" ? errorMessage3 ?? messages.errorRetryable : messages.recovered }),
|
|
4354
|
+
/* @__PURE__ */ jsx4(
|
|
4530
4355
|
Tip,
|
|
4531
4356
|
{
|
|
4532
4357
|
tip: savedTranscript ? messages.insertRecoveredTranscript : retrying ? messages.pauseRetrying : messages.retry,
|
|
4533
|
-
children: /* @__PURE__ */
|
|
4358
|
+
children: /* @__PURE__ */ jsx4(
|
|
4534
4359
|
"button",
|
|
4535
4360
|
{
|
|
4536
4361
|
type: "button",
|
|
@@ -4541,12 +4366,12 @@ function ComposerTranscriptionControl({
|
|
|
4541
4366
|
"bg-og-fg text-og-bg transition-colors duration-150 motion-reduce:transition-none",
|
|
4542
4367
|
"hover:bg-og-fg-muted pointer-coarse:size-11"
|
|
4543
4368
|
),
|
|
4544
|
-
children: savedTranscript ? /* @__PURE__ */
|
|
4369
|
+
children: savedTranscript ? /* @__PURE__ */ jsx4(ClipboardPasteIcon, { className: "size-3.5" }) : retrying ? /* @__PURE__ */ jsx4(SquareIcon, { className: "size-3.5" }) : /* @__PURE__ */ jsx4(RefreshCwIcon, { className: "size-3.5" })
|
|
4545
4370
|
}
|
|
4546
4371
|
)
|
|
4547
4372
|
}
|
|
4548
4373
|
),
|
|
4549
|
-
/* @__PURE__ */
|
|
4374
|
+
/* @__PURE__ */ jsx4(Tip, { tip: messages.discardRecovered, children: /* @__PURE__ */ jsx4(
|
|
4550
4375
|
"button",
|
|
4551
4376
|
{
|
|
4552
4377
|
type: "button",
|
|
@@ -4557,14 +4382,14 @@ function ComposerTranscriptionControl({
|
|
|
4557
4382
|
"text-og-fg-muted transition-colors duration-150 motion-reduce:transition-none",
|
|
4558
4383
|
"hover:bg-og-surface-3 hover:text-og-status-failed pointer-coarse:size-11"
|
|
4559
4384
|
),
|
|
4560
|
-
children: /* @__PURE__ */
|
|
4385
|
+
children: /* @__PURE__ */ jsx4(Trash2Icon, { className: "size-3.5" })
|
|
4561
4386
|
}
|
|
4562
4387
|
) })
|
|
4563
4388
|
]
|
|
4564
4389
|
},
|
|
4565
4390
|
"recovered"
|
|
4566
|
-
) : active ? /* @__PURE__ */
|
|
4567
|
-
|
|
4391
|
+
) : active ? /* @__PURE__ */ jsxs4(
|
|
4392
|
+
motion3.span,
|
|
4568
4393
|
{
|
|
4569
4394
|
initial: { opacity: 0, scale: 0.96 },
|
|
4570
4395
|
animate: { opacity: 1, scale: 1 },
|
|
@@ -4575,21 +4400,21 @@ function ComposerTranscriptionControl({
|
|
|
4575
4400
|
"bg-og-surface-2/70 pl-2 pr-1 pointer-coarse:h-11"
|
|
4576
4401
|
),
|
|
4577
4402
|
children: [
|
|
4578
|
-
status === "requesting-permission" ? /* @__PURE__ */
|
|
4403
|
+
status === "requesting-permission" ? /* @__PURE__ */ jsx4(
|
|
4579
4404
|
LoaderCircleIcon2,
|
|
4580
4405
|
{
|
|
4581
4406
|
className: "size-3.5 shrink-0 text-og-fg-muted animate-og-spin motion-reduce:animate-none",
|
|
4582
4407
|
"aria-hidden": true
|
|
4583
4408
|
}
|
|
4584
|
-
) : /* @__PURE__ */
|
|
4585
|
-
status === "recording" ? /* @__PURE__ */
|
|
4409
|
+
) : /* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-1.5", children: [
|
|
4410
|
+
status === "recording" ? /* @__PURE__ */ jsx4(
|
|
4586
4411
|
"span",
|
|
4587
4412
|
{
|
|
4588
4413
|
"aria-hidden": true,
|
|
4589
4414
|
className: "size-1.5 shrink-0 rounded-full bg-og-status-failed animate-og-pulse motion-reduce:animate-none"
|
|
4590
4415
|
}
|
|
4591
4416
|
) : null,
|
|
4592
|
-
/* @__PURE__ */
|
|
4417
|
+
/* @__PURE__ */ jsx4(
|
|
4593
4418
|
VoiceWaveform,
|
|
4594
4419
|
{
|
|
4595
4420
|
stream: status === "recording" ? transcription.stream : null,
|
|
@@ -4597,8 +4422,8 @@ function ComposerTranscriptionControl({
|
|
|
4597
4422
|
}
|
|
4598
4423
|
)
|
|
4599
4424
|
] }),
|
|
4600
|
-
status === "recording" ? /* @__PURE__ */
|
|
4601
|
-
/* @__PURE__ */
|
|
4425
|
+
status === "recording" ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
4426
|
+
/* @__PURE__ */ jsx4(Tip, { tip: messages.cancel, children: /* @__PURE__ */ jsx4(
|
|
4602
4427
|
"button",
|
|
4603
4428
|
{
|
|
4604
4429
|
type: "button",
|
|
@@ -4610,10 +4435,10 @@ function ComposerTranscriptionControl({
|
|
|
4610
4435
|
"text-og-fg-muted transition-colors duration-150 motion-reduce:transition-none",
|
|
4611
4436
|
"hover:bg-og-surface-3 hover:text-og-fg pointer-coarse:size-11"
|
|
4612
4437
|
),
|
|
4613
|
-
children: /* @__PURE__ */
|
|
4438
|
+
children: /* @__PURE__ */ jsx4(XIcon2, { className: "size-3.5" })
|
|
4614
4439
|
}
|
|
4615
4440
|
) }),
|
|
4616
|
-
/* @__PURE__ */
|
|
4441
|
+
/* @__PURE__ */ jsx4(Tip, { tip: messages.stop, children: /* @__PURE__ */ jsx4(
|
|
4617
4442
|
"button",
|
|
4618
4443
|
{
|
|
4619
4444
|
type: "button",
|
|
@@ -4624,15 +4449,15 @@ function ComposerTranscriptionControl({
|
|
|
4624
4449
|
"bg-og-fg text-og-bg transition-colors duration-150 motion-reduce:transition-none",
|
|
4625
4450
|
"hover:bg-og-fg-muted pointer-coarse:size-11"
|
|
4626
4451
|
),
|
|
4627
|
-
children: /* @__PURE__ */
|
|
4452
|
+
children: /* @__PURE__ */ jsx4(SquareIcon, { className: "size-2.5 fill-current" })
|
|
4628
4453
|
}
|
|
4629
4454
|
) })
|
|
4630
|
-
] }) : status === "transcribing" || status === "saving" ? /* @__PURE__ */
|
|
4455
|
+
] }) : status === "transcribing" || status === "saving" ? /* @__PURE__ */ jsx4("span", { className: "og-shimmer-text px-1.5 text-og-xs font-medium whitespace-nowrap", children: status === "saving" ? messages.saving : messages.transcribing }) : /* @__PURE__ */ jsx4("span", { className: "px-1.5 text-og-xs text-og-fg-muted whitespace-nowrap", children: messages.requestingPermission })
|
|
4631
4456
|
]
|
|
4632
4457
|
},
|
|
4633
4458
|
status === "transcribing" || status === "saving" ? "processing" : "capture"
|
|
4634
|
-
) : /* @__PURE__ */
|
|
4635
|
-
|
|
4459
|
+
) : /* @__PURE__ */ jsx4(Tip, { tip: idleLabel, children: /* @__PURE__ */ jsx4(
|
|
4460
|
+
motion3.button,
|
|
4636
4461
|
{
|
|
4637
4462
|
type: "button",
|
|
4638
4463
|
"data-og-composer-dictate": true,
|
|
@@ -4649,10 +4474,10 @@ function ComposerTranscriptionControl({
|
|
|
4649
4474
|
"text-og-fg-muted transition-colors duration-150 motion-reduce:transition-none",
|
|
4650
4475
|
unavailableMessage ? "cursor-not-allowed opacity-45" : "hover:bg-og-surface-2 hover:text-og-fg"
|
|
4651
4476
|
),
|
|
4652
|
-
children: /* @__PURE__ */
|
|
4477
|
+
children: /* @__PURE__ */ jsx4(MicIcon, { className: "size-4" })
|
|
4653
4478
|
}
|
|
4654
4479
|
) }, "idle") }),
|
|
4655
|
-
status === "error" && errorMessage3 && !recoverable ? /* @__PURE__ */
|
|
4480
|
+
status === "error" && errorMessage3 && !recoverable ? /* @__PURE__ */ jsx4(Tip, { tip: errorMessage3, children: /* @__PURE__ */ jsx4(
|
|
4656
4481
|
"span",
|
|
4657
4482
|
{
|
|
4658
4483
|
"aria-hidden": "true",
|
|
@@ -4660,7 +4485,7 @@ function ComposerTranscriptionControl({
|
|
|
4660
4485
|
children: errorMessage3
|
|
4661
4486
|
}
|
|
4662
4487
|
) }) : null,
|
|
4663
|
-
/* @__PURE__ */
|
|
4488
|
+
/* @__PURE__ */ jsx4(
|
|
4664
4489
|
"span",
|
|
4665
4490
|
{
|
|
4666
4491
|
className: "sr-only",
|
|
@@ -4678,9 +4503,9 @@ function VoiceWaveform({
|
|
|
4678
4503
|
stream,
|
|
4679
4504
|
mode
|
|
4680
4505
|
}) {
|
|
4681
|
-
const [levels, setLevels] =
|
|
4682
|
-
const [live, setLive] =
|
|
4683
|
-
|
|
4506
|
+
const [levels, setLevels] = useState5(() => restingLevels(WAVEFORM_BARS));
|
|
4507
|
+
const [live, setLive] = useState5(false);
|
|
4508
|
+
useEffect4(() => {
|
|
4684
4509
|
if (!stream || mode !== "recording") {
|
|
4685
4510
|
setLive(false);
|
|
4686
4511
|
setLevels(restingLevels(WAVEFORM_BARS));
|
|
@@ -4728,7 +4553,7 @@ function VoiceWaveform({
|
|
|
4728
4553
|
void context?.close();
|
|
4729
4554
|
};
|
|
4730
4555
|
}, [stream, mode]);
|
|
4731
|
-
return /* @__PURE__ */
|
|
4556
|
+
return /* @__PURE__ */ jsx4(
|
|
4732
4557
|
"span",
|
|
4733
4558
|
{
|
|
4734
4559
|
"aria-hidden": true,
|
|
@@ -4736,7 +4561,7 @@ function VoiceWaveform({
|
|
|
4736
4561
|
className: "flex h-4 w-[3.75rem] items-center justify-center gap-px",
|
|
4737
4562
|
children: WAVEFORM_BAR_KEYS.map((key, index) => {
|
|
4738
4563
|
const level = levels[index] ?? 0;
|
|
4739
|
-
return /* @__PURE__ */
|
|
4564
|
+
return /* @__PURE__ */ jsx4(
|
|
4740
4565
|
"span",
|
|
4741
4566
|
{
|
|
4742
4567
|
className: cn(
|
|
@@ -4787,9 +4612,6 @@ function transcriptionErrorMessage(code, messages) {
|
|
|
4787
4612
|
}
|
|
4788
4613
|
|
|
4789
4614
|
export {
|
|
4790
|
-
useLightbox,
|
|
4791
|
-
useLightboxOptional,
|
|
4792
|
-
LightboxProvider,
|
|
4793
4615
|
OPEN_WORKSTREAM_CONTROL_EVENT,
|
|
4794
4616
|
parseCommandLine,
|
|
4795
4617
|
hasPermission,
|
|
@@ -4843,4 +4665,4 @@ export {
|
|
|
4843
4665
|
useVoiceInput,
|
|
4844
4666
|
ComposerTranscriptionControl
|
|
4845
4667
|
};
|
|
4846
|
-
//# sourceMappingURL=chunk-
|
|
4668
|
+
//# sourceMappingURL=chunk-EQEIQSRJ.js.map
|