@devalok/shilp-sutra 0.55.1 → 0.56.0
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/BREAKING.json +13 -0
- package/MIGRATION.md +56 -0
- package/README.md +16 -1
- package/dist/_chunks/badge-group.js +45 -45
- package/dist/_chunks/emoji-suggestion.js +32 -30
- package/dist/_chunks/emoji-suggestion.js.map +1 -1
- package/dist/_chunks/mention-suggestion.js +35 -34
- package/dist/_chunks/mention-suggestion.js.map +1 -1
- package/dist/_chunks/primitives-internal.js +437 -537
- package/dist/_chunks/primitives-internal.js.map +1 -1
- package/dist/composed/content-card.js +18 -18
- package/dist/composed/extensions/emoji-node.js +8 -7
- package/dist/composed/extensions/emoji-node.js.map +1 -1
- package/dist/composed/rich-chat-input.js +535 -526
- package/dist/composed/rich-chat-input.js.map +1 -1
- package/dist/composed/rich-text-editor.js +201 -193
- package/dist/composed/rich-text-editor.js.map +1 -1
- package/dist/ui/alert.js +29 -29
- package/dist/ui/avatar.js +42 -42
- package/dist/ui/banner.js +25 -25
- package/dist/ui/button.js +31 -31
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/card.js +39 -39
- package/dist/ui/combobox.js +135 -135
- package/dist/ui/combobox.js.map +1 -1
- package/dist/ui/dot.js +13 -13
- package/dist/ui/input.js +25 -25
- package/dist/ui/lib/utils.js +2 -1
- package/dist/ui/lib/utils.js.map +1 -1
- package/dist/ui/number-input.js +36 -36
- package/dist/ui/progress.js +55 -55
- package/dist/ui/select.js +58 -58
- package/dist/ui/sheet.js +46 -46
- package/dist/ui/sidebar.js +128 -128
- package/dist/ui/sidebar.js.map +1 -1
- package/dist/ui/skeleton.js +39 -39
- package/dist/ui/slider.js +18 -18
- package/dist/ui/surface.js +9 -9
- package/dist/ui/tabs.js +47 -47
- package/dist/ui/text.js +8 -8
- package/dist/ui/textarea.js +12 -12
- package/dist/ui/toggle.js +12 -12
- package/docs/recipes/install-astro.md +2 -2
- package/docs/recipes/install-next-app-router.md +2 -2
- package/docs/recipes/install-remix.md +2 -2
- package/docs/recipes/install-tanstack-start.md +2 -2
- package/docs/recipes/install-vite.md +2 -2
- package/docs/recipes/troubleshoot.md +26 -5
- package/llms.txt +1 -1
- package/mcp-manifest.json +24 -3
- package/package.json +38 -11
- package/skill/SKILL.md +1 -1
- package/skill/references/components.md +1 -1
- package/skill/references/setup-astro.md +2 -2
- package/skill/references/setup-next-app-router.md +2 -2
- package/skill/references/setup-remix.md +2 -2
- package/skill/references/setup-tanstack-start.md +2 -2
- package/skill/references/setup-vite.md +2 -2
- package/skill/references/troubleshoot.md +26 -5
- package/dist/_chunks/tiptap.js +0 -18809
- package/dist/_chunks/tiptap.js.map +0 -1
- package/dist/_chunks/vendor-utils.js +0 -1766
- package/dist/_chunks/vendor-utils.js.map +0 -1
- package/scripts/welcome.mjs +0 -312
|
@@ -11,21 +11,30 @@ import { SplitButton as h } from "../ui/split-button.js";
|
|
|
11
11
|
import { ToggleGroup as g, ToggleGroupItem as _ } from "../ui/toggle-group.js";
|
|
12
12
|
import { TruncatedText as v } from "../ui/truncated-text.js";
|
|
13
13
|
import { MENTION_TOKEN_CLASS as y } from "../_chunks/mention.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import {
|
|
24
|
-
import
|
|
25
|
-
import
|
|
14
|
+
import { EmojiNode as b } from "./extensions/emoji-node.js";
|
|
15
|
+
import { createEmojiSuggestion as x } from "../_chunks/emoji-suggestion.js";
|
|
16
|
+
import { FileAttachment as ee, createSuggestionRenderer as S } from "../_chunks/mention-suggestion.js";
|
|
17
|
+
import { CalendarGrid as C, useCalendar as w } from "../_chunks/use-calendar.js";
|
|
18
|
+
import * as T from "react";
|
|
19
|
+
import { useCallback as E, useEffect as D, useRef as O, useState as k } from "react";
|
|
20
|
+
import { Fragment as te, jsx as A, jsxs as j } from "react/jsx-runtime";
|
|
21
|
+
import * as ne from "react-dom";
|
|
22
|
+
import { IconAt as M, IconBlockquote as re, IconBold as ie, IconCalendarEvent as N, IconChevronDown as ae, IconClock as oe, IconCode as se, IconFile as ce, IconHighlight as le, IconItalic as ue, IconLink as de, IconList as P, IconListNumbers as fe, IconMicrophone as pe, IconMoodSmile as me, IconPencil as he, IconPlayerPause as ge, IconPlayerPlay as _e, IconPlus as ve, IconSend as ye, IconSlash as be, IconSquare as xe, IconStrikethrough as F, IconTextSize as Se, IconTrash as Ce, IconUnderline as I, IconX as L } from "@tabler/icons-react";
|
|
23
|
+
import { AnimatePresence as R, motion as z, useReducedMotion as we } from "framer-motion";
|
|
24
|
+
import Te from "@tiptap/extension-highlight";
|
|
25
|
+
import Ee from "@tiptap/extension-image";
|
|
26
|
+
import De from "@tiptap/extension-mention";
|
|
27
|
+
import { CharacterCount as Oe, Placeholder as ke } from "@tiptap/extensions";
|
|
28
|
+
import { EditorContent as Ae, Extension as je, useEditor as Me, useEditorState as B } from "@tiptap/react";
|
|
29
|
+
import { BubbleMenu as Ne } from "@tiptap/react/menus";
|
|
30
|
+
import Pe from "@tiptap/starter-kit";
|
|
31
|
+
import { Extension as Fe } from "@tiptap/core";
|
|
32
|
+
import V from "@tiptap/suggestion";
|
|
33
|
+
import { PluginKey as Ie } from "@tiptap/pm/state";
|
|
34
|
+
import { createRoot as Le } from "react-dom/client";
|
|
26
35
|
//#region src/composed/extensions/slash-command.tsx
|
|
27
|
-
var
|
|
28
|
-
let [i, o] =
|
|
36
|
+
var H = T.forwardRef(({ groups: e, query: t, command: n }, r) => {
|
|
37
|
+
let [i, o] = T.useState(0), s = T.useMemo(() => {
|
|
29
38
|
let n = t.toLowerCase(), r = [];
|
|
30
39
|
return e.forEach((e, t) => {
|
|
31
40
|
e.commands.forEach((e) => {
|
|
@@ -36,7 +45,7 @@ var Ie = O.forwardRef(({ groups: e, query: t, command: n }, r) => {
|
|
|
36
45
|
});
|
|
37
46
|
}), r;
|
|
38
47
|
}, [e, t]);
|
|
39
|
-
if (
|
|
48
|
+
if (T.useEffect(() => o(0), [s]), T.useImperativeHandle(r, () => ({ onKeyDown: ({ event: e }) => e.key === "ArrowUp" ? (o((e) => (e + s.length - 1) % s.length), !0) : e.key === "ArrowDown" ? (o((e) => (e + 1) % s.length), !0) : e.key === "Enter" ? (s[i] && n(s[i].command), !0) : !1 })), !s.length) return null;
|
|
40
49
|
let c = [], l = 0;
|
|
41
50
|
for (let t of s) {
|
|
42
51
|
let n = e[t.groupIndex].label, r = c[c.length - 1];
|
|
@@ -48,36 +57,36 @@ var Ie = O.forwardRef(({ groups: e, query: t, command: n }, r) => {
|
|
|
48
57
|
flatIndex: l
|
|
49
58
|
}), l++;
|
|
50
59
|
}
|
|
51
|
-
return /* @__PURE__ */
|
|
60
|
+
return /* @__PURE__ */ A("div", {
|
|
52
61
|
role: "listbox",
|
|
53
62
|
"aria-label": "Slash commands",
|
|
54
63
|
className: "z-popover max-h-[320px] min-w-[220px] overflow-x-hidden overflow-y-auto rounded-surface bg-surface-overlay p-ds-02 shadow-floating",
|
|
55
|
-
children: c.map((e, t) => /* @__PURE__ */
|
|
64
|
+
children: c.map((e, t) => /* @__PURE__ */ j("div", {
|
|
56
65
|
role: "group",
|
|
57
66
|
"aria-label": e.label,
|
|
58
67
|
children: [
|
|
59
|
-
t > 0 && /* @__PURE__ */
|
|
60
|
-
/* @__PURE__ */
|
|
68
|
+
t > 0 && /* @__PURE__ */ A("div", { className: "my-ds-01 border-t border-surface-border" }),
|
|
69
|
+
/* @__PURE__ */ A("div", {
|
|
61
70
|
className: "px-ds-03 py-ds-01 text-caption font-medium text-surface-fg-subtle",
|
|
62
71
|
children: e.label
|
|
63
72
|
}),
|
|
64
73
|
e.items.map(({ command: e, flatIndex: t }) => {
|
|
65
74
|
let r = e.icon;
|
|
66
|
-
return /* @__PURE__ */
|
|
75
|
+
return /* @__PURE__ */ j("button", {
|
|
67
76
|
type: "button",
|
|
68
77
|
role: "option",
|
|
69
78
|
"aria-selected": t === i,
|
|
70
79
|
onClick: () => n(e),
|
|
71
80
|
className: a("flex w-full items-center gap-ds-03 rounded-control px-ds-03 py-ds-02 text-left cursor-pointer", t === i ? "bg-surface-raised-hover" : "hover:bg-surface-raised-hover"),
|
|
72
|
-
children: [r && /* @__PURE__ */
|
|
81
|
+
children: [r && /* @__PURE__ */ A("span", {
|
|
73
82
|
className: "flex h-4 w-4 shrink-0 items-center justify-center text-surface-fg-muted",
|
|
74
|
-
children: /* @__PURE__ */
|
|
75
|
-
}), /* @__PURE__ */
|
|
83
|
+
children: /* @__PURE__ */ A(r, { className: "h-4 w-4" })
|
|
84
|
+
}), /* @__PURE__ */ j("div", {
|
|
76
85
|
className: "flex flex-col",
|
|
77
|
-
children: [/* @__PURE__ */
|
|
86
|
+
children: [/* @__PURE__ */ A("span", {
|
|
78
87
|
className: "text-body-sm text-surface-fg",
|
|
79
88
|
children: e.label
|
|
80
|
-
}), e.description && /* @__PURE__ */
|
|
89
|
+
}), e.description && /* @__PURE__ */ A("span", {
|
|
81
90
|
className: "text-caption text-surface-fg-subtle",
|
|
82
91
|
children: e.description
|
|
83
92
|
})]
|
|
@@ -88,15 +97,15 @@ var Ie = O.forwardRef(({ groups: e, query: t, command: n }, r) => {
|
|
|
88
97
|
}, e.label))
|
|
89
98
|
});
|
|
90
99
|
});
|
|
91
|
-
|
|
92
|
-
function
|
|
100
|
+
H.displayName = "SlashCommandList";
|
|
101
|
+
function Re(e) {
|
|
93
102
|
return () => {
|
|
94
103
|
let t = null, n = null, r = null;
|
|
95
104
|
return {
|
|
96
105
|
onStart: (i) => {
|
|
97
106
|
n = document.createElement("div"), n.style.position = "absolute", n.style.zIndex = "1400";
|
|
98
107
|
let a = i.clientRect?.();
|
|
99
|
-
a && (n.style.left = `${a.left}px`, n.style.top = `${a.bottom + 4}px`), document.body.appendChild(n), t =
|
|
108
|
+
a && (n.style.left = `${a.left}px`, n.style.top = `${a.bottom + 4}px`), document.body.appendChild(n), t = Le(n), t.render(/* @__PURE__ */ A(H, {
|
|
100
109
|
ref: (e) => {
|
|
101
110
|
r = e;
|
|
102
111
|
},
|
|
@@ -108,7 +117,7 @@ function Le(e) {
|
|
|
108
117
|
onUpdate: (i) => {
|
|
109
118
|
if (!t || !n) return;
|
|
110
119
|
let a = i.clientRect?.();
|
|
111
|
-
a && (n.style.left = `${a.left}px`, n.style.top = `${a.bottom + 4}px`), t.render(/* @__PURE__ */
|
|
120
|
+
a && (n.style.left = `${a.left}px`, n.style.top = `${a.bottom + 4}px`), t.render(/* @__PURE__ */ A(H, {
|
|
112
121
|
ref: (e) => {
|
|
113
122
|
r = e;
|
|
114
123
|
},
|
|
@@ -124,13 +133,13 @@ function Le(e) {
|
|
|
124
133
|
};
|
|
125
134
|
};
|
|
126
135
|
}
|
|
127
|
-
function
|
|
136
|
+
function ze(e) {
|
|
128
137
|
let t = e.flatMap((e) => e.commands);
|
|
129
|
-
return
|
|
138
|
+
return Fe.create({
|
|
130
139
|
name: "slashCommand",
|
|
131
140
|
addProseMirrorPlugins() {
|
|
132
|
-
return [
|
|
133
|
-
pluginKey: new
|
|
141
|
+
return [V({
|
|
142
|
+
pluginKey: new Ie("slashCommand"),
|
|
134
143
|
editor: this.editor,
|
|
135
144
|
char: "/",
|
|
136
145
|
startOfLine: !0,
|
|
@@ -143,18 +152,18 @@ function Re(e) {
|
|
|
143
152
|
command: ({ editor: e, range: t, props: n }) => {
|
|
144
153
|
e.chain().focus().deleteRange(t).run(), n.action(e);
|
|
145
154
|
},
|
|
146
|
-
render:
|
|
155
|
+
render: Re(e)
|
|
147
156
|
})];
|
|
148
157
|
}
|
|
149
158
|
});
|
|
150
159
|
}
|
|
151
160
|
//#endregion
|
|
152
161
|
//#region src/composed/rich-chat-input/attachment-strip.tsx
|
|
153
|
-
function
|
|
162
|
+
function Be(e) {
|
|
154
163
|
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
155
164
|
}
|
|
156
|
-
function
|
|
157
|
-
return /* @__PURE__ */
|
|
165
|
+
function Ve({ attachments: e, onRemoveAttachment: t }) {
|
|
166
|
+
return /* @__PURE__ */ A(z.div, {
|
|
158
167
|
initial: {
|
|
159
168
|
height: 0,
|
|
160
169
|
opacity: 0
|
|
@@ -177,13 +186,13 @@ function Be({ attachments: e, onRemoveAttachment: t }) {
|
|
|
177
186
|
]
|
|
178
187
|
},
|
|
179
188
|
className: "overflow-hidden",
|
|
180
|
-
children: /* @__PURE__ */
|
|
189
|
+
children: /* @__PURE__ */ A("div", {
|
|
181
190
|
role: "list",
|
|
182
191
|
"aria-label": "Attachments",
|
|
183
192
|
className: "flex gap-ds-02 overflow-x-auto px-ds-04 py-ds-02b border-b border-surface-border",
|
|
184
|
-
children: /* @__PURE__ */
|
|
193
|
+
children: /* @__PURE__ */ A(R, {
|
|
185
194
|
initial: !1,
|
|
186
|
-
children: e.map((e) => e.type === "image" ? /* @__PURE__ */
|
|
195
|
+
children: e.map((e) => e.type === "image" ? /* @__PURE__ */ j(z.div, {
|
|
187
196
|
role: "listitem",
|
|
188
197
|
"aria-label": `Image: ${e.name}`,
|
|
189
198
|
layout: !0,
|
|
@@ -214,29 +223,29 @@ function Be({ attachments: e, onRemoveAttachment: t }) {
|
|
|
214
223
|
},
|
|
215
224
|
className: "relative h-12 w-12 shrink-0 group",
|
|
216
225
|
children: [
|
|
217
|
-
/* @__PURE__ */
|
|
226
|
+
/* @__PURE__ */ A("img", {
|
|
218
227
|
src: e.url,
|
|
219
228
|
alt: e.name,
|
|
220
229
|
className: "h-full w-full rounded-control object-cover"
|
|
221
230
|
}),
|
|
222
|
-
/* @__PURE__ */
|
|
231
|
+
/* @__PURE__ */ A("button", {
|
|
223
232
|
onClick: () => t(e.id),
|
|
224
233
|
className: "absolute -top-1 -right-1 h-ico-sm w-ico-sm rounded-pill bg-error-9 text-error-fg flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-fast-02",
|
|
225
234
|
"aria-label": `Remove ${e.name}`,
|
|
226
235
|
title: "Remove",
|
|
227
|
-
children: /* @__PURE__ */
|
|
228
|
-
icon:
|
|
236
|
+
children: /* @__PURE__ */ A(s, {
|
|
237
|
+
icon: L,
|
|
229
238
|
size: "xs"
|
|
230
239
|
})
|
|
231
240
|
}),
|
|
232
|
-
e.uploading && /* @__PURE__ */
|
|
241
|
+
e.uploading && /* @__PURE__ */ A("div", {
|
|
233
242
|
className: "absolute inset-0 rounded-control bg-surface-overlay/50 flex items-center justify-center",
|
|
234
|
-
children: /* @__PURE__ */
|
|
243
|
+
children: /* @__PURE__ */ A(o, { size: "sm" })
|
|
235
244
|
})
|
|
236
245
|
]
|
|
237
|
-
}, e.id) : /* @__PURE__ */
|
|
246
|
+
}, e.id) : /* @__PURE__ */ j(z.div, {
|
|
238
247
|
role: "listitem",
|
|
239
|
-
"aria-label": `File: ${e.name}, ${
|
|
248
|
+
"aria-label": `File: ${e.name}, ${Be(e.size)}`,
|
|
240
249
|
layout: !0,
|
|
241
250
|
initial: {
|
|
242
251
|
scale: 0,
|
|
@@ -265,27 +274,27 @@ function Be({ attachments: e, onRemoveAttachment: t }) {
|
|
|
265
274
|
},
|
|
266
275
|
className: "flex items-center gap-ds-02 shrink-0 rounded-control bg-surface-raised px-ds-03 py-ds-01 group",
|
|
267
276
|
children: [
|
|
268
|
-
/* @__PURE__ */
|
|
269
|
-
icon:
|
|
277
|
+
/* @__PURE__ */ A(s, {
|
|
278
|
+
icon: ce,
|
|
270
279
|
size: "xs",
|
|
271
280
|
className: "text-surface-fg-muted"
|
|
272
281
|
}),
|
|
273
|
-
/* @__PURE__ */
|
|
282
|
+
/* @__PURE__ */ A(v, {
|
|
274
283
|
mode: "middle",
|
|
275
284
|
className: "max-w-[120px] text-caption text-surface-fg-muted",
|
|
276
285
|
children: e.name
|
|
277
286
|
}),
|
|
278
|
-
/* @__PURE__ */
|
|
287
|
+
/* @__PURE__ */ A("span", {
|
|
279
288
|
className: "text-caption text-surface-fg-subtle",
|
|
280
|
-
children:
|
|
289
|
+
children: Be(e.size)
|
|
281
290
|
}),
|
|
282
|
-
/* @__PURE__ */
|
|
291
|
+
/* @__PURE__ */ A("button", {
|
|
283
292
|
onClick: () => t(e.id),
|
|
284
293
|
className: "text-surface-fg-subtle hover:text-error-11 opacity-0 group-hover:opacity-100 transition-opacity duration-fast-02",
|
|
285
294
|
"aria-label": `Remove ${e.name}`,
|
|
286
295
|
title: "Remove",
|
|
287
|
-
children: /* @__PURE__ */
|
|
288
|
-
icon:
|
|
296
|
+
children: /* @__PURE__ */ A(s, {
|
|
297
|
+
icon: L,
|
|
289
298
|
size: "xs"
|
|
290
299
|
})
|
|
291
300
|
})
|
|
@@ -297,9 +306,9 @@ function Be({ attachments: e, onRemoveAttachment: t }) {
|
|
|
297
306
|
}
|
|
298
307
|
//#endregion
|
|
299
308
|
//#region src/composed/rich-chat-input/audio-waveform.tsx
|
|
300
|
-
var U =
|
|
301
|
-
let [f, p] =
|
|
302
|
-
|
|
309
|
+
var U = T.forwardRef(function({ mode: e, analyserNode: t, data: n, progress: r = 0, barWidth: i = 3, barGap: o = 2, barCount: s = 40, height: c = 32, className: l, ...u }, d) {
|
|
310
|
+
let [f, p] = T.useState(() => Array(s).fill(.05)), m = T.useRef(0), h = T.useRef(f);
|
|
311
|
+
T.useEffect(() => {
|
|
303
312
|
if (e !== "live" || !t) return;
|
|
304
313
|
let n = new Uint8Array(t.frequencyBinCount), r = () => {
|
|
305
314
|
t.getByteFrequencyData(n);
|
|
@@ -317,7 +326,7 @@ var U = O.forwardRef(function({ mode: e, analyserNode: t, data: n, progress: r =
|
|
|
317
326
|
e,
|
|
318
327
|
t,
|
|
319
328
|
s
|
|
320
|
-
]),
|
|
329
|
+
]), T.useEffect(() => {
|
|
321
330
|
if (!(e !== "static" || !n)) if (n.length === s) p(n);
|
|
322
331
|
else {
|
|
323
332
|
let e = Array(s), t = n.length / s;
|
|
@@ -332,9 +341,9 @@ var U = O.forwardRef(function({ mode: e, analyserNode: t, data: n, progress: r =
|
|
|
332
341
|
n,
|
|
333
342
|
s
|
|
334
343
|
]);
|
|
335
|
-
let g = s * (i + o) - o, _ =
|
|
344
|
+
let g = s * (i + o) - o, _ = T.useMemo(() => f.map((t, n) => {
|
|
336
345
|
let a = Math.max(2, t * c), l = n * (i + o), u = (c - a) / 2, d = e === "static" && r > 0 && n / s <= r;
|
|
337
|
-
return /* @__PURE__ */
|
|
346
|
+
return /* @__PURE__ */ A("rect", {
|
|
338
347
|
x: l,
|
|
339
348
|
y: u,
|
|
340
349
|
width: i,
|
|
@@ -351,7 +360,7 @@ var U = O.forwardRef(function({ mode: e, analyserNode: t, data: n, progress: r =
|
|
|
351
360
|
s,
|
|
352
361
|
c
|
|
353
362
|
]);
|
|
354
|
-
return /* @__PURE__ */
|
|
363
|
+
return /* @__PURE__ */ A("svg", {
|
|
355
364
|
ref: d,
|
|
356
365
|
height: c,
|
|
357
366
|
viewBox: `0 0 ${g} ${c}`,
|
|
@@ -365,23 +374,23 @@ var U = O.forwardRef(function({ mode: e, analyserNode: t, data: n, progress: r =
|
|
|
365
374
|
U.displayName = "AudioWaveform";
|
|
366
375
|
//#endregion
|
|
367
376
|
//#region src/composed/rich-chat-input/audio-player.tsx
|
|
368
|
-
var
|
|
377
|
+
var He = [
|
|
369
378
|
1,
|
|
370
379
|
1.5,
|
|
371
380
|
2
|
|
372
381
|
];
|
|
373
|
-
function
|
|
382
|
+
function Ue(e) {
|
|
374
383
|
return `${Math.floor(e / 60)}:${Math.floor(e % 60).toString().padStart(2, "0")}`;
|
|
375
384
|
}
|
|
376
|
-
var
|
|
377
|
-
let s =
|
|
385
|
+
var We = T.forwardRef(function({ src: e, duration: t, waveformData: n, className: r, ...i }, o) {
|
|
386
|
+
let s = T.useRef(null), c = T.useRef(null), [u, d] = T.useState(!1), [f, p] = T.useState(0), [m, h] = T.useState(0), [g, _] = T.useState(null), v = T.useMemo(() => {
|
|
378
387
|
if (typeof e == "string") return e;
|
|
379
388
|
let t = URL.createObjectURL(e);
|
|
380
389
|
return _(t), t;
|
|
381
390
|
}, [e]);
|
|
382
|
-
|
|
391
|
+
T.useEffect(() => () => {
|
|
383
392
|
g && URL.revokeObjectURL(g);
|
|
384
|
-
}, [g]),
|
|
393
|
+
}, [g]), T.useEffect(() => {
|
|
385
394
|
let e = s.current;
|
|
386
395
|
if (!e) return;
|
|
387
396
|
let t = () => p(e.currentTime), n = () => {
|
|
@@ -391,33 +400,33 @@ var Ue = O.forwardRef(function({ src: e, duration: t, waveformData: n, className
|
|
|
391
400
|
e.removeEventListener("timeupdate", t), e.removeEventListener("ended", n);
|
|
392
401
|
};
|
|
393
402
|
}, []);
|
|
394
|
-
let y =
|
|
403
|
+
let y = T.useCallback(() => {
|
|
395
404
|
let e = s.current;
|
|
396
405
|
e && (u ? (e.pause(), d(!1)) : (e.play(), d(!0)));
|
|
397
|
-
}, [u]), b =
|
|
406
|
+
}, [u]), b = T.useCallback((e) => {
|
|
398
407
|
(e.key === " " || e.key === "Enter") && (e.preventDefault(), y());
|
|
399
|
-
}, [y]), x =
|
|
408
|
+
}, [y]), x = T.useCallback((e) => {
|
|
400
409
|
let n = s.current, r = c.current;
|
|
401
410
|
if (!n || !r || t <= 0) return;
|
|
402
411
|
let i = r.getBoundingClientRect(), a = e.clientX - i.left;
|
|
403
412
|
n.currentTime = Math.max(0, Math.min(1, a / i.width)) * t, p(n.currentTime);
|
|
404
|
-
}, [t]), ee =
|
|
405
|
-
let e = (m + 1) %
|
|
406
|
-
h(e), s.current && (s.current.playbackRate =
|
|
407
|
-
}, [m]), S = t > 0 ? f / t : 0, C =
|
|
408
|
-
return /* @__PURE__ */
|
|
413
|
+
}, [t]), ee = T.useCallback(() => {
|
|
414
|
+
let e = (m + 1) % He.length;
|
|
415
|
+
h(e), s.current && (s.current.playbackRate = He[e]);
|
|
416
|
+
}, [m]), S = t > 0 ? f / t : 0, C = He[m];
|
|
417
|
+
return /* @__PURE__ */ j("div", {
|
|
409
418
|
ref: o,
|
|
410
419
|
role: "group",
|
|
411
420
|
"aria-label": "Voice message player",
|
|
412
421
|
className: a("flex items-center gap-ds-03", r),
|
|
413
422
|
...i,
|
|
414
423
|
children: [
|
|
415
|
-
/* @__PURE__ */
|
|
424
|
+
/* @__PURE__ */ A("audio", {
|
|
416
425
|
ref: s,
|
|
417
426
|
src: v,
|
|
418
427
|
preload: "metadata"
|
|
419
428
|
}),
|
|
420
|
-
/* @__PURE__ */
|
|
429
|
+
/* @__PURE__ */ A(l, {
|
|
421
430
|
type: "button",
|
|
422
431
|
variant: "solid",
|
|
423
432
|
shape: "pill",
|
|
@@ -426,13 +435,13 @@ var Ue = O.forwardRef(function({ src: e, duration: t, waveformData: n, className
|
|
|
426
435
|
onKeyDown: b,
|
|
427
436
|
"aria-label": u ? "Pause voice message" : "Play voice message",
|
|
428
437
|
className: "shrink-0 active:scale-95",
|
|
429
|
-
children:
|
|
438
|
+
children: A(u ? ge : _e, {
|
|
430
439
|
size: 16,
|
|
431
440
|
stroke: 2,
|
|
432
441
|
"aria-hidden": "true"
|
|
433
442
|
})
|
|
434
443
|
}),
|
|
435
|
-
/* @__PURE__ */
|
|
444
|
+
/* @__PURE__ */ A(U, {
|
|
436
445
|
ref: c,
|
|
437
446
|
mode: "static",
|
|
438
447
|
data: n,
|
|
@@ -440,15 +449,15 @@ var Ue = O.forwardRef(function({ src: e, duration: t, waveformData: n, className
|
|
|
440
449
|
className: "cursor-pointer",
|
|
441
450
|
onClick: x
|
|
442
451
|
}),
|
|
443
|
-
/* @__PURE__ */
|
|
452
|
+
/* @__PURE__ */ j("span", {
|
|
444
453
|
className: "text-caption tabular-nums text-surface-fg-subtle whitespace-nowrap",
|
|
445
454
|
children: [
|
|
446
|
-
|
|
455
|
+
Ue(f),
|
|
447
456
|
" / ",
|
|
448
|
-
|
|
457
|
+
Ue(t)
|
|
449
458
|
]
|
|
450
459
|
}),
|
|
451
|
-
/* @__PURE__ */
|
|
460
|
+
/* @__PURE__ */ j("button", {
|
|
452
461
|
type: "button",
|
|
453
462
|
onClick: ee,
|
|
454
463
|
"aria-label": `Playback speed ${C}x`,
|
|
@@ -458,18 +467,18 @@ var Ue = O.forwardRef(function({ src: e, duration: t, waveformData: n, className
|
|
|
458
467
|
]
|
|
459
468
|
});
|
|
460
469
|
});
|
|
461
|
-
|
|
470
|
+
We.displayName = "AudioPlayer";
|
|
462
471
|
//#endregion
|
|
463
472
|
//#region src/composed/rich-chat-input/chat-toolbar.tsx
|
|
464
|
-
var
|
|
473
|
+
var Ge = T.createContext(null);
|
|
465
474
|
function W() {
|
|
466
|
-
let e =
|
|
475
|
+
let e = T.useContext(Ge);
|
|
467
476
|
if (!e) throw Error("Toolbar primitives must be used inside <ChatToolbar>");
|
|
468
477
|
return e;
|
|
469
478
|
}
|
|
470
479
|
function G({ onClick: e, isActive: t, disabled: n, title: r, children: i, className: o }) {
|
|
471
480
|
let { disabled: s } = W();
|
|
472
|
-
return /* @__PURE__ */
|
|
481
|
+
return /* @__PURE__ */ A("button", {
|
|
473
482
|
type: "button",
|
|
474
483
|
onClick: e,
|
|
475
484
|
disabled: n ?? s,
|
|
@@ -481,239 +490,239 @@ function G({ onClick: e, isActive: t, disabled: n, title: r, children: i, classN
|
|
|
481
490
|
});
|
|
482
491
|
}
|
|
483
492
|
function K() {
|
|
484
|
-
return /* @__PURE__ */
|
|
493
|
+
return /* @__PURE__ */ A("div", { className: "h-4 w-px bg-surface-border-subtle mx-ds-01" });
|
|
485
494
|
}
|
|
486
495
|
function q({ children: e, className: t }) {
|
|
487
|
-
return /* @__PURE__ */
|
|
496
|
+
return /* @__PURE__ */ A("div", {
|
|
488
497
|
className: a("flex items-center gap-ds-01", t),
|
|
489
498
|
children: e
|
|
490
499
|
});
|
|
491
500
|
}
|
|
492
|
-
function
|
|
493
|
-
let { editor: e } = W(), { isActive: t } =
|
|
501
|
+
function Ke() {
|
|
502
|
+
let { editor: e } = W(), { isActive: t } = B({
|
|
494
503
|
editor: e,
|
|
495
504
|
selector: ({ editor: e }) => ({ isActive: e.isActive("bold") })
|
|
496
505
|
});
|
|
497
|
-
return /* @__PURE__ */
|
|
506
|
+
return /* @__PURE__ */ A(G, {
|
|
498
507
|
onClick: () => e.chain().focus().toggleBold().run(),
|
|
499
508
|
isActive: t,
|
|
500
509
|
title: "Bold",
|
|
501
|
-
children: /* @__PURE__ */
|
|
502
|
-
icon:
|
|
510
|
+
children: /* @__PURE__ */ A(s, {
|
|
511
|
+
icon: ie,
|
|
503
512
|
size: "xs"
|
|
504
513
|
})
|
|
505
514
|
});
|
|
506
515
|
}
|
|
507
|
-
function
|
|
508
|
-
let { editor: e } = W(), { isActive: t } =
|
|
516
|
+
function qe() {
|
|
517
|
+
let { editor: e } = W(), { isActive: t } = B({
|
|
509
518
|
editor: e,
|
|
510
519
|
selector: ({ editor: e }) => ({ isActive: e.isActive("italic") })
|
|
511
520
|
});
|
|
512
|
-
return /* @__PURE__ */
|
|
521
|
+
return /* @__PURE__ */ A(G, {
|
|
513
522
|
onClick: () => e.chain().focus().toggleItalic().run(),
|
|
514
523
|
isActive: t,
|
|
515
524
|
title: "Italic",
|
|
516
|
-
children: /* @__PURE__ */
|
|
517
|
-
icon:
|
|
525
|
+
children: /* @__PURE__ */ A(s, {
|
|
526
|
+
icon: ue,
|
|
518
527
|
size: "xs"
|
|
519
528
|
})
|
|
520
529
|
});
|
|
521
530
|
}
|
|
522
|
-
function
|
|
523
|
-
let { editor: e } = W(), { isActive: t } =
|
|
531
|
+
function Je() {
|
|
532
|
+
let { editor: e } = W(), { isActive: t } = B({
|
|
524
533
|
editor: e,
|
|
525
534
|
selector: ({ editor: e }) => ({ isActive: e.isActive("underline") })
|
|
526
535
|
});
|
|
527
|
-
return /* @__PURE__ */
|
|
536
|
+
return /* @__PURE__ */ A(G, {
|
|
528
537
|
onClick: () => e.chain().focus().toggleUnderline().run(),
|
|
529
538
|
isActive: t,
|
|
530
539
|
title: "Underline",
|
|
531
|
-
children: /* @__PURE__ */
|
|
532
|
-
icon:
|
|
540
|
+
children: /* @__PURE__ */ A(s, {
|
|
541
|
+
icon: I,
|
|
533
542
|
size: "xs"
|
|
534
543
|
})
|
|
535
544
|
});
|
|
536
545
|
}
|
|
537
|
-
function
|
|
538
|
-
let { editor: e } = W(), { isActive: t } =
|
|
546
|
+
function Ye() {
|
|
547
|
+
let { editor: e } = W(), { isActive: t } = B({
|
|
539
548
|
editor: e,
|
|
540
549
|
selector: ({ editor: e }) => ({ isActive: e.isActive("strike") })
|
|
541
550
|
});
|
|
542
|
-
return /* @__PURE__ */
|
|
551
|
+
return /* @__PURE__ */ A(G, {
|
|
543
552
|
onClick: () => e.chain().focus().toggleStrike().run(),
|
|
544
553
|
isActive: t,
|
|
545
554
|
title: "Strikethrough",
|
|
546
|
-
children: /* @__PURE__ */
|
|
547
|
-
icon:
|
|
555
|
+
children: /* @__PURE__ */ A(s, {
|
|
556
|
+
icon: F,
|
|
548
557
|
size: "xs"
|
|
549
558
|
})
|
|
550
559
|
});
|
|
551
560
|
}
|
|
552
|
-
function
|
|
553
|
-
let { editor: e } = W(), { isActive: t } =
|
|
561
|
+
function Xe() {
|
|
562
|
+
let { editor: e } = W(), { isActive: t } = B({
|
|
554
563
|
editor: e,
|
|
555
564
|
selector: ({ editor: e }) => ({ isActive: e.isActive("highlight") })
|
|
556
565
|
});
|
|
557
|
-
return /* @__PURE__ */
|
|
566
|
+
return /* @__PURE__ */ A(G, {
|
|
558
567
|
onClick: () => e.chain().focus().toggleHighlight().run(),
|
|
559
568
|
isActive: t,
|
|
560
569
|
title: "Highlight",
|
|
561
|
-
children: /* @__PURE__ */
|
|
562
|
-
icon:
|
|
570
|
+
children: /* @__PURE__ */ A(s, {
|
|
571
|
+
icon: le,
|
|
563
572
|
size: "xs"
|
|
564
573
|
})
|
|
565
574
|
});
|
|
566
575
|
}
|
|
567
|
-
function
|
|
568
|
-
let { editor: e } = W(), { isActive: t } =
|
|
576
|
+
function Ze() {
|
|
577
|
+
let { editor: e } = W(), { isActive: t } = B({
|
|
569
578
|
editor: e,
|
|
570
579
|
selector: ({ editor: e }) => ({ isActive: e.isActive("code") })
|
|
571
580
|
});
|
|
572
|
-
return /* @__PURE__ */
|
|
581
|
+
return /* @__PURE__ */ A(G, {
|
|
573
582
|
onClick: () => e.chain().focus().toggleCode().run(),
|
|
574
583
|
isActive: t,
|
|
575
584
|
title: "Inline code",
|
|
576
|
-
children: /* @__PURE__ */
|
|
577
|
-
icon:
|
|
585
|
+
children: /* @__PURE__ */ A(s, {
|
|
586
|
+
icon: se,
|
|
578
587
|
size: "xs"
|
|
579
588
|
})
|
|
580
589
|
});
|
|
581
590
|
}
|
|
582
|
-
function
|
|
583
|
-
let { editor: e } = W(), { isActive: t } =
|
|
591
|
+
function Qe() {
|
|
592
|
+
let { editor: e } = W(), { isActive: t } = B({
|
|
584
593
|
editor: e,
|
|
585
594
|
selector: ({ editor: e }) => ({ isActive: e.isActive("bulletList") })
|
|
586
595
|
});
|
|
587
|
-
return /* @__PURE__ */
|
|
596
|
+
return /* @__PURE__ */ A(G, {
|
|
588
597
|
onClick: () => e.chain().focus().toggleBulletList().run(),
|
|
589
598
|
isActive: t,
|
|
590
599
|
title: "Bullet list",
|
|
591
|
-
children: /* @__PURE__ */
|
|
592
|
-
icon:
|
|
600
|
+
children: /* @__PURE__ */ A(s, {
|
|
601
|
+
icon: P,
|
|
593
602
|
size: "xs"
|
|
594
603
|
})
|
|
595
604
|
});
|
|
596
605
|
}
|
|
597
|
-
function
|
|
598
|
-
let { editor: e } = W(), { isActive: t } =
|
|
606
|
+
function $e() {
|
|
607
|
+
let { editor: e } = W(), { isActive: t } = B({
|
|
599
608
|
editor: e,
|
|
600
609
|
selector: ({ editor: e }) => ({ isActive: e.isActive("orderedList") })
|
|
601
610
|
});
|
|
602
|
-
return /* @__PURE__ */
|
|
611
|
+
return /* @__PURE__ */ A(G, {
|
|
603
612
|
onClick: () => e.chain().focus().toggleOrderedList().run(),
|
|
604
613
|
isActive: t,
|
|
605
614
|
title: "Ordered list",
|
|
606
|
-
children: /* @__PURE__ */
|
|
607
|
-
icon:
|
|
615
|
+
children: /* @__PURE__ */ A(s, {
|
|
616
|
+
icon: fe,
|
|
608
617
|
size: "xs"
|
|
609
618
|
})
|
|
610
619
|
});
|
|
611
620
|
}
|
|
612
|
-
function
|
|
613
|
-
let { editor: e } = W(), { isActive: t } =
|
|
621
|
+
function et() {
|
|
622
|
+
let { editor: e } = W(), { isActive: t } = B({
|
|
614
623
|
editor: e,
|
|
615
624
|
selector: ({ editor: e }) => ({ isActive: e.isActive("blockquote") })
|
|
616
625
|
});
|
|
617
|
-
return /* @__PURE__ */
|
|
626
|
+
return /* @__PURE__ */ A(G, {
|
|
618
627
|
onClick: () => e.chain().focus().toggleBlockquote().run(),
|
|
619
628
|
isActive: t,
|
|
620
629
|
title: "Quote",
|
|
621
|
-
children: /* @__PURE__ */
|
|
622
|
-
icon:
|
|
630
|
+
children: /* @__PURE__ */ A(s, {
|
|
631
|
+
icon: re,
|
|
623
632
|
size: "xs"
|
|
624
633
|
})
|
|
625
634
|
});
|
|
626
635
|
}
|
|
627
|
-
function
|
|
628
|
-
let { editor: e } = W(), { isActive: t } =
|
|
636
|
+
function tt() {
|
|
637
|
+
let { editor: e } = W(), { isActive: t } = B({
|
|
629
638
|
editor: e,
|
|
630
639
|
selector: ({ editor: e }) => ({ isActive: e.isActive("link") })
|
|
631
640
|
});
|
|
632
|
-
return /* @__PURE__ */
|
|
641
|
+
return /* @__PURE__ */ A(G, {
|
|
633
642
|
onClick: () => {
|
|
634
643
|
let t = window.prompt("URL");
|
|
635
644
|
t && e.chain().focus().setLink({ href: t }).run();
|
|
636
645
|
},
|
|
637
646
|
isActive: t,
|
|
638
647
|
title: "Link",
|
|
639
|
-
children: /* @__PURE__ */
|
|
640
|
-
icon:
|
|
648
|
+
children: /* @__PURE__ */ A(s, {
|
|
649
|
+
icon: de,
|
|
641
650
|
size: "xs"
|
|
642
651
|
})
|
|
643
652
|
});
|
|
644
653
|
}
|
|
645
|
-
function
|
|
654
|
+
function nt() {
|
|
646
655
|
let { editor: e } = W();
|
|
647
|
-
return /* @__PURE__ */
|
|
656
|
+
return /* @__PURE__ */ A(G, {
|
|
648
657
|
onClick: () => e.chain().focus().insertContent("@").run(),
|
|
649
658
|
title: "Mention",
|
|
650
|
-
children: /* @__PURE__ */
|
|
651
|
-
icon:
|
|
659
|
+
children: /* @__PURE__ */ A(s, {
|
|
660
|
+
icon: M,
|
|
652
661
|
size: "xs"
|
|
653
662
|
})
|
|
654
663
|
});
|
|
655
664
|
}
|
|
656
|
-
function
|
|
665
|
+
function J() {
|
|
657
666
|
let { editor: e } = W();
|
|
658
|
-
return /* @__PURE__ */
|
|
667
|
+
return /* @__PURE__ */ A(G, {
|
|
659
668
|
onClick: () => e.chain().focus().insertContent(":").run(),
|
|
660
669
|
title: "Emoji",
|
|
661
|
-
children: /* @__PURE__ */
|
|
662
|
-
icon:
|
|
670
|
+
children: /* @__PURE__ */ A(s, {
|
|
671
|
+
icon: me,
|
|
663
672
|
size: "xs"
|
|
664
673
|
})
|
|
665
674
|
});
|
|
666
675
|
}
|
|
667
|
-
function
|
|
676
|
+
function rt() {
|
|
668
677
|
let { editor: e } = W();
|
|
669
|
-
return /* @__PURE__ */
|
|
678
|
+
return /* @__PURE__ */ A(G, {
|
|
670
679
|
onClick: () => e.chain().focus().insertContent("/").run(),
|
|
671
680
|
title: "Slash command",
|
|
672
|
-
children: /* @__PURE__ */
|
|
673
|
-
icon:
|
|
681
|
+
children: /* @__PURE__ */ A(s, {
|
|
682
|
+
icon: be,
|
|
674
683
|
size: "xs"
|
|
675
684
|
})
|
|
676
685
|
});
|
|
677
686
|
}
|
|
678
|
-
function
|
|
687
|
+
function Y({ items: e, isMobile: t, hasMentions: n, hasSlashCommands: r }) {
|
|
679
688
|
let i = (t) => !e || e.includes(t);
|
|
680
|
-
return /* @__PURE__ */
|
|
681
|
-
!t && /* @__PURE__ */
|
|
682
|
-
i("bold") && /* @__PURE__ */
|
|
683
|
-
i("italic") && /* @__PURE__ */
|
|
684
|
-
i("underline") && /* @__PURE__ */
|
|
685
|
-
i("strike") && /* @__PURE__ */
|
|
686
|
-
i("highlight") && /* @__PURE__ */
|
|
689
|
+
return /* @__PURE__ */ j(te, { children: [
|
|
690
|
+
!t && /* @__PURE__ */ j(q, { children: [
|
|
691
|
+
i("bold") && /* @__PURE__ */ A(Ke, {}),
|
|
692
|
+
i("italic") && /* @__PURE__ */ A(qe, {}),
|
|
693
|
+
i("underline") && /* @__PURE__ */ A(Je, {}),
|
|
694
|
+
i("strike") && /* @__PURE__ */ A(Ye, {}),
|
|
695
|
+
i("highlight") && /* @__PURE__ */ A(Xe, {})
|
|
687
696
|
] }),
|
|
688
|
-
!t && /* @__PURE__ */
|
|
689
|
-
!t && /* @__PURE__ */
|
|
690
|
-
!t && (i("blockquote") || i("link") || i("code")) && /* @__PURE__ */
|
|
691
|
-
!t && /* @__PURE__ */
|
|
692
|
-
i("blockquote") && /* @__PURE__ */
|
|
693
|
-
i("link") && /* @__PURE__ */
|
|
694
|
-
i("code") && /* @__PURE__ */
|
|
697
|
+
!t && /* @__PURE__ */ A(K, {}),
|
|
698
|
+
!t && /* @__PURE__ */ j(q, { children: [i("bulletList") && /* @__PURE__ */ A(Qe, {}), i("orderedList") && /* @__PURE__ */ A($e, {})] }),
|
|
699
|
+
!t && (i("blockquote") || i("link") || i("code")) && /* @__PURE__ */ A(K, {}),
|
|
700
|
+
!t && /* @__PURE__ */ j(q, { children: [
|
|
701
|
+
i("blockquote") && /* @__PURE__ */ A(et, {}),
|
|
702
|
+
i("link") && /* @__PURE__ */ A(tt, {}),
|
|
703
|
+
i("code") && /* @__PURE__ */ A(Ze, {})
|
|
695
704
|
] }),
|
|
696
|
-
!t && (n || r) && /* @__PURE__ */
|
|
697
|
-
/* @__PURE__ */
|
|
698
|
-
n && i("mention") && /* @__PURE__ */
|
|
699
|
-
i("emoji") && /* @__PURE__ */
|
|
700
|
-
r && i("slash") && /* @__PURE__ */
|
|
705
|
+
!t && (n || r) && /* @__PURE__ */ A(K, {}),
|
|
706
|
+
/* @__PURE__ */ j(q, { children: [
|
|
707
|
+
n && i("mention") && /* @__PURE__ */ A(nt, {}),
|
|
708
|
+
i("emoji") && /* @__PURE__ */ A(J, {}),
|
|
709
|
+
r && i("slash") && /* @__PURE__ */ A(rt, {})
|
|
701
710
|
] })
|
|
702
711
|
] });
|
|
703
712
|
}
|
|
704
713
|
function it({ editor: e, toolbar: t, isMobile: n, hasMentions: r, hasSlashCommands: i, disabled: a }) {
|
|
705
714
|
if (t === !1) return null;
|
|
706
715
|
let o = typeof t != "boolean" && !Array.isArray(t), s = Array.isArray(t) ? t : null;
|
|
707
|
-
return /* @__PURE__ */
|
|
716
|
+
return /* @__PURE__ */ A(Ge.Provider, {
|
|
708
717
|
value: {
|
|
709
718
|
editor: e,
|
|
710
719
|
disabled: a
|
|
711
720
|
},
|
|
712
|
-
children: /* @__PURE__ */
|
|
721
|
+
children: /* @__PURE__ */ A("div", {
|
|
713
722
|
role: "toolbar",
|
|
714
723
|
"aria-label": "Text formatting",
|
|
715
724
|
className: "flex flex-wrap items-center gap-ds-01 border-t border-surface-border px-ds-04 py-ds-02b",
|
|
716
|
-
children: o ? t : /* @__PURE__ */
|
|
725
|
+
children: o ? t : /* @__PURE__ */ A(Y, {
|
|
717
726
|
items: s,
|
|
718
727
|
isMobile: n,
|
|
719
728
|
hasMentions: r,
|
|
@@ -724,7 +733,7 @@ function it({ editor: e, toolbar: t, isMobile: n, hasMentions: r, hasSlashComman
|
|
|
724
733
|
}
|
|
725
734
|
//#endregion
|
|
726
735
|
//#region src/composed/rich-chat-input/recording-overlay.tsx
|
|
727
|
-
function
|
|
736
|
+
function at(e) {
|
|
728
737
|
let t = Math.floor(e / 60), n = Math.floor(e % 60);
|
|
729
738
|
return {
|
|
730
739
|
minutes: String(t),
|
|
@@ -732,31 +741,31 @@ function Y(e) {
|
|
|
732
741
|
secs: n.toString().padStart(2, "0")
|
|
733
742
|
};
|
|
734
743
|
}
|
|
735
|
-
function
|
|
736
|
-
let i =
|
|
737
|
-
|
|
744
|
+
function ot({ duration: e, analyserNode: t, maxDuration: n, onCancel: r }) {
|
|
745
|
+
let i = we();
|
|
746
|
+
T.useEffect(() => {
|
|
738
747
|
let e = (e) => {
|
|
739
748
|
e.key === "Escape" && r();
|
|
740
749
|
};
|
|
741
750
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
742
751
|
}, [r]);
|
|
743
|
-
let o = n != null && n > 0 && e >= n - 10, s = n != null && n > 0 && e >= n - 5, c = s ? "animate-[pulse_500ms_ease-in-out_infinite]" : "animate-[pulse_1s_ease-in-out_infinite]", l =
|
|
744
|
-
return /* @__PURE__ */
|
|
752
|
+
let o = n != null && n > 0 && e >= n - 10, s = n != null && n > 0 && e >= n - 5, c = s ? "animate-[pulse_500ms_ease-in-out_infinite]" : "animate-[pulse_1s_ease-in-out_infinite]", l = at(e), u = s ? "text-error-11" : o ? "text-warning-11" : "text-surface-fg";
|
|
753
|
+
return /* @__PURE__ */ j("div", {
|
|
745
754
|
role: "status",
|
|
746
755
|
"aria-live": "polite",
|
|
747
756
|
"aria-label": "Recording voice message",
|
|
748
757
|
className: "absolute inset-0 flex items-center gap-ds-03 px-ds-04 py-ds-03 bg-surface-raised-hover rounded-surface z-10",
|
|
749
758
|
children: [
|
|
750
|
-
/* @__PURE__ */
|
|
759
|
+
/* @__PURE__ */ A("span", {
|
|
751
760
|
className: a("w-ds-02b h-ds-02b shrink-0 rounded-pill bg-error-9", i ? "opacity-100" : c),
|
|
752
761
|
"aria-hidden": "true"
|
|
753
762
|
}),
|
|
754
|
-
/* @__PURE__ */
|
|
763
|
+
/* @__PURE__ */ j("span", {
|
|
755
764
|
className: a("text-body-sm font-mono tabular-nums whitespace-nowrap", u),
|
|
756
765
|
"aria-label": `${l.minutes} minutes ${l.secs} seconds`,
|
|
757
766
|
children: [
|
|
758
767
|
l.minutes,
|
|
759
|
-
/* @__PURE__ */
|
|
768
|
+
/* @__PURE__ */ A("span", {
|
|
760
769
|
className: i ? void 0 : "animate-[blink_1s_step-end_infinite]",
|
|
761
770
|
"aria-hidden": "true",
|
|
762
771
|
children: l.separator
|
|
@@ -764,9 +773,9 @@ function at({ duration: e, analyserNode: t, maxDuration: n, onCancel: r }) {
|
|
|
764
773
|
l.secs
|
|
765
774
|
]
|
|
766
775
|
}),
|
|
767
|
-
/* @__PURE__ */
|
|
776
|
+
/* @__PURE__ */ A("div", {
|
|
768
777
|
className: "flex-1 min-w-0 overflow-hidden",
|
|
769
|
-
children: /* @__PURE__ */
|
|
778
|
+
children: /* @__PURE__ */ A(U, {
|
|
770
779
|
mode: "live",
|
|
771
780
|
analyserNode: t,
|
|
772
781
|
height: 24,
|
|
@@ -777,11 +786,11 @@ function at({ duration: e, analyserNode: t, maxDuration: n, onCancel: r }) {
|
|
|
777
786
|
]
|
|
778
787
|
});
|
|
779
788
|
}
|
|
780
|
-
|
|
789
|
+
ot.displayName = "RecordingOverlay";
|
|
781
790
|
//#endregion
|
|
782
791
|
//#region src/composed/rich-chat-input/reply-banner.tsx
|
|
783
|
-
function
|
|
784
|
-
return /* @__PURE__ */
|
|
792
|
+
function st({ author: e, preview: t, onDismiss: n }) {
|
|
793
|
+
return /* @__PURE__ */ A(z.div, {
|
|
785
794
|
initial: {
|
|
786
795
|
height: 0,
|
|
787
796
|
opacity: 0
|
|
@@ -804,34 +813,34 @@ function ot({ author: e, preview: t, onDismiss: n }) {
|
|
|
804
813
|
]
|
|
805
814
|
},
|
|
806
815
|
className: "overflow-hidden",
|
|
807
|
-
children: /* @__PURE__ */
|
|
816
|
+
children: /* @__PURE__ */ j("div", {
|
|
808
817
|
role: "status",
|
|
809
818
|
"aria-label": `Replying to ${e}`,
|
|
810
819
|
className: "flex items-center gap-ds-03 border-b border-surface-border px-ds-04 py-ds-02b",
|
|
811
|
-
children: [/* @__PURE__ */
|
|
820
|
+
children: [/* @__PURE__ */ j("div", {
|
|
812
821
|
className: "flex-1 min-w-0",
|
|
813
822
|
children: [
|
|
814
|
-
/* @__PURE__ */
|
|
823
|
+
/* @__PURE__ */ j("span", {
|
|
815
824
|
className: "text-body-sm font-semibold text-surface-fg",
|
|
816
825
|
children: ["Replying to ", e]
|
|
817
826
|
}),
|
|
818
|
-
/* @__PURE__ */
|
|
827
|
+
/* @__PURE__ */ A("span", {
|
|
819
828
|
className: "mx-ds-02 text-surface-fg-subtle",
|
|
820
829
|
children: "·"
|
|
821
830
|
}),
|
|
822
|
-
/* @__PURE__ */
|
|
831
|
+
/* @__PURE__ */ A("span", {
|
|
823
832
|
className: "text-body-sm text-surface-fg-muted truncate",
|
|
824
833
|
children: t
|
|
825
834
|
})
|
|
826
835
|
]
|
|
827
|
-
}), /* @__PURE__ */
|
|
836
|
+
}), /* @__PURE__ */ A("button", {
|
|
828
837
|
type: "button",
|
|
829
838
|
onClick: n,
|
|
830
839
|
className: a("inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-control touch-target", "text-surface-fg-subtle hover:text-surface-fg hover:bg-surface-raised-hover", "transition-colors duration-fast-01 ease-productive-standard", "active:scale-95"),
|
|
831
840
|
"aria-label": "Cancel reply",
|
|
832
841
|
title: "Cancel reply",
|
|
833
|
-
children: /* @__PURE__ */
|
|
834
|
-
icon:
|
|
842
|
+
children: /* @__PURE__ */ A(s, {
|
|
843
|
+
icon: L,
|
|
835
844
|
size: "xs"
|
|
836
845
|
})
|
|
837
846
|
})]
|
|
@@ -840,7 +849,7 @@ function ot({ author: e, preview: t, onDismiss: n }) {
|
|
|
840
849
|
}
|
|
841
850
|
//#endregion
|
|
842
851
|
//#region src/composed/rich-chat-input/schedule-send.tsx
|
|
843
|
-
function
|
|
852
|
+
function ct() {
|
|
844
853
|
let e = /* @__PURE__ */ new Date(), t = e.getHours(), n = [], r = (t, n = 0) => {
|
|
845
854
|
let r = new Date(e);
|
|
846
855
|
return r.setDate(r.getDate() + n), r.setHours(t, 0, 0, 0), r;
|
|
@@ -888,7 +897,7 @@ function st() {
|
|
|
888
897
|
date: a
|
|
889
898
|
}), n;
|
|
890
899
|
}
|
|
891
|
-
function
|
|
900
|
+
function lt({ value: e, onChange: t }) {
|
|
892
901
|
let n = e.getHours() % 12 || 12, r = e.getMinutes(), i = e.getHours() >= 12, a = (n) => {
|
|
893
902
|
let r = new Date(e);
|
|
894
903
|
r.setHours(i ? n % 12 + 12 : n % 12), t(r);
|
|
@@ -899,44 +908,44 @@ function ct({ value: e, onChange: t }) {
|
|
|
899
908
|
let r = new Date(e), i = r.getHours();
|
|
900
909
|
n && i < 12 ? r.setHours(i + 12) : !n && i >= 12 && r.setHours(i - 12), t(r);
|
|
901
910
|
};
|
|
902
|
-
return /* @__PURE__ */
|
|
911
|
+
return /* @__PURE__ */ j("div", {
|
|
903
912
|
className: "flex items-center gap-ds-02",
|
|
904
913
|
children: [
|
|
905
|
-
/* @__PURE__ */
|
|
914
|
+
/* @__PURE__ */ A("select", {
|
|
906
915
|
value: n,
|
|
907
916
|
onChange: (e) => a(Number(e.target.value)),
|
|
908
917
|
className: "h-ds-sm rounded-control border border-surface-border-strong bg-surface-raised px-ds-02 text-body-sm text-surface-fg focus:outline-hidden focus:ring-2 focus:ring-accent-9",
|
|
909
918
|
"aria-label": "Hour",
|
|
910
|
-
children: Array.from({ length: 12 }, (e, t) => t + 1).map((e) => /* @__PURE__ */
|
|
919
|
+
children: Array.from({ length: 12 }, (e, t) => t + 1).map((e) => /* @__PURE__ */ A("option", {
|
|
911
920
|
value: e,
|
|
912
921
|
children: e
|
|
913
922
|
}, e))
|
|
914
923
|
}),
|
|
915
|
-
/* @__PURE__ */
|
|
924
|
+
/* @__PURE__ */ A("span", {
|
|
916
925
|
className: "text-body-sm text-surface-fg-subtle font-medium",
|
|
917
926
|
children: ":"
|
|
918
927
|
}),
|
|
919
|
-
/* @__PURE__ */
|
|
928
|
+
/* @__PURE__ */ A("select", {
|
|
920
929
|
value: r - r % 5,
|
|
921
930
|
onChange: (e) => o(Number(e.target.value)),
|
|
922
931
|
className: "h-ds-sm rounded-control border border-surface-border-strong bg-surface-raised px-ds-02 text-body-sm text-surface-fg focus:outline-hidden focus:ring-2 focus:ring-accent-9",
|
|
923
932
|
"aria-label": "Minute",
|
|
924
|
-
children: Array.from({ length: 12 }, (e, t) => t * 5).map((e) => /* @__PURE__ */
|
|
933
|
+
children: Array.from({ length: 12 }, (e, t) => t * 5).map((e) => /* @__PURE__ */ A("option", {
|
|
925
934
|
value: e,
|
|
926
935
|
children: String(e).padStart(2, "0")
|
|
927
936
|
}, e))
|
|
928
937
|
}),
|
|
929
|
-
/* @__PURE__ */
|
|
938
|
+
/* @__PURE__ */ j(g, {
|
|
930
939
|
type: "single",
|
|
931
940
|
value: i ? "PM" : "AM",
|
|
932
941
|
onValueChange: (e) => {
|
|
933
942
|
e === "AM" ? s(!1) : e === "PM" && s(!0);
|
|
934
943
|
},
|
|
935
944
|
size: "sm",
|
|
936
|
-
children: [/* @__PURE__ */
|
|
945
|
+
children: [/* @__PURE__ */ A(_, {
|
|
937
946
|
value: "AM",
|
|
938
947
|
children: "AM"
|
|
939
|
-
}), /* @__PURE__ */
|
|
948
|
+
}), /* @__PURE__ */ A(_, {
|
|
940
949
|
value: "PM",
|
|
941
950
|
children: "PM"
|
|
942
951
|
})]
|
|
@@ -944,7 +953,7 @@ function ct({ value: e, onChange: t }) {
|
|
|
944
953
|
]
|
|
945
954
|
});
|
|
946
955
|
}
|
|
947
|
-
function
|
|
956
|
+
function X({ value: e, onChange: t, minDate: n }) {
|
|
948
957
|
let r = /* @__PURE__ */ new Date(), i = e ?? (() => {
|
|
949
958
|
let e = new Date(r);
|
|
950
959
|
return e.setHours(e.getHours() + 1, 0, 0, 0), e;
|
|
@@ -954,40 +963,40 @@ function lt({ value: e, onChange: t, minDate: n }) {
|
|
|
954
963
|
let r = new Date(i);
|
|
955
964
|
r.setFullYear(Number(n[0]), Number(n[1]) - 1, Number(n[2])), t(r);
|
|
956
965
|
}, s = n ? `${n.getFullYear()}-${String(n.getMonth() + 1).padStart(2, "0")}-${String(n.getDate()).padStart(2, "0")}` : void 0;
|
|
957
|
-
return /* @__PURE__ */
|
|
966
|
+
return /* @__PURE__ */ j("div", {
|
|
958
967
|
className: "space-y-ds-03",
|
|
959
|
-
children: [/* @__PURE__ */
|
|
968
|
+
children: [/* @__PURE__ */ j("div", {
|
|
960
969
|
className: "flex items-center justify-between",
|
|
961
|
-
children: [/* @__PURE__ */
|
|
970
|
+
children: [/* @__PURE__ */ A("span", {
|
|
962
971
|
className: "text-caption font-medium text-surface-fg-subtle",
|
|
963
972
|
children: "Date"
|
|
964
|
-
}), /* @__PURE__ */
|
|
973
|
+
}), /* @__PURE__ */ A("input", {
|
|
965
974
|
type: "date",
|
|
966
975
|
value: a,
|
|
967
976
|
min: s,
|
|
968
977
|
onChange: o,
|
|
969
978
|
className: "h-ds-sm rounded-control border border-surface-border-strong bg-surface-raised px-ds-03 text-body-sm text-surface-fg focus:outline-hidden focus:ring-2 focus:ring-accent-9"
|
|
970
979
|
})]
|
|
971
|
-
}), /* @__PURE__ */
|
|
980
|
+
}), /* @__PURE__ */ j("div", {
|
|
972
981
|
className: "flex items-center justify-between",
|
|
973
|
-
children: [/* @__PURE__ */
|
|
982
|
+
children: [/* @__PURE__ */ A("span", {
|
|
974
983
|
className: "text-caption font-medium text-surface-fg-subtle",
|
|
975
984
|
children: "Time"
|
|
976
|
-
}), /* @__PURE__ */
|
|
985
|
+
}), /* @__PURE__ */ A(lt, {
|
|
977
986
|
value: i,
|
|
978
987
|
onChange: t
|
|
979
988
|
})]
|
|
980
989
|
})]
|
|
981
990
|
});
|
|
982
991
|
}
|
|
983
|
-
function
|
|
992
|
+
function ut({ value: e, onChange: t, minDate: n }) {
|
|
984
993
|
let r = /* @__PURE__ */ new Date(), i = e ?? (() => {
|
|
985
994
|
let e = new Date(r);
|
|
986
995
|
return e.setHours(e.getHours() + 1, 0, 0, 0), e;
|
|
987
|
-
})(), { currentMonth: a, goToPreviousMonth: o, goToNextMonth: s } =
|
|
988
|
-
return /* @__PURE__ */
|
|
996
|
+
})(), { currentMonth: a, goToPreviousMonth: o, goToNextMonth: s } = w(i);
|
|
997
|
+
return /* @__PURE__ */ j("div", {
|
|
989
998
|
className: "space-y-ds-03",
|
|
990
|
-
children: [/* @__PURE__ */
|
|
999
|
+
children: [/* @__PURE__ */ A(C, {
|
|
991
1000
|
currentMonth: a,
|
|
992
1001
|
selected: i,
|
|
993
1002
|
onSelect: (e) => {
|
|
@@ -999,50 +1008,50 @@ function X({ value: e, onChange: t, minDate: n }) {
|
|
|
999
1008
|
},
|
|
1000
1009
|
minDate: n,
|
|
1001
1010
|
className: "w-full"
|
|
1002
|
-
}), /* @__PURE__ */
|
|
1011
|
+
}), /* @__PURE__ */ j("div", {
|
|
1003
1012
|
className: "flex items-center justify-between border-t border-surface-border pt-ds-03",
|
|
1004
|
-
children: [/* @__PURE__ */
|
|
1013
|
+
children: [/* @__PURE__ */ A("span", {
|
|
1005
1014
|
className: "text-caption font-medium text-surface-fg-subtle",
|
|
1006
1015
|
children: "Time"
|
|
1007
|
-
}), /* @__PURE__ */
|
|
1016
|
+
}), /* @__PURE__ */ A(lt, {
|
|
1008
1017
|
value: i,
|
|
1009
1018
|
onChange: t
|
|
1010
1019
|
})]
|
|
1011
1020
|
})]
|
|
1012
1021
|
});
|
|
1013
1022
|
}
|
|
1014
|
-
function
|
|
1015
|
-
let [r, i] =
|
|
1023
|
+
function dt({ onSchedule: e, onClose: t, onOpenDialog: n }) {
|
|
1024
|
+
let [r, i] = T.useState(!1), [a, o] = T.useState(null), c = T.useMemo(() => ct(), []), u = (n) => {
|
|
1016
1025
|
e(n), t();
|
|
1017
1026
|
};
|
|
1018
|
-
return r ? /* @__PURE__ */
|
|
1027
|
+
return r ? /* @__PURE__ */ j("div", {
|
|
1019
1028
|
className: "p-ds-04",
|
|
1020
1029
|
style: { minWidth: 270 },
|
|
1021
1030
|
children: [
|
|
1022
|
-
/* @__PURE__ */
|
|
1031
|
+
/* @__PURE__ */ j("div", {
|
|
1023
1032
|
className: "mb-ds-03 flex items-center justify-between",
|
|
1024
|
-
children: [/* @__PURE__ */
|
|
1033
|
+
children: [/* @__PURE__ */ A("p", {
|
|
1025
1034
|
className: "text-body-sm font-medium text-surface-fg",
|
|
1026
1035
|
children: "Pick date & time"
|
|
1027
|
-
}), /* @__PURE__ */
|
|
1036
|
+
}), /* @__PURE__ */ A(l, {
|
|
1028
1037
|
variant: "ghost",
|
|
1029
1038
|
size: "icon-xs",
|
|
1030
1039
|
onClick: () => i(!1),
|
|
1031
1040
|
"aria-label": "Back to presets",
|
|
1032
|
-
children: /* @__PURE__ */
|
|
1033
|
-
icon:
|
|
1041
|
+
children: /* @__PURE__ */ A(s, {
|
|
1042
|
+
icon: L,
|
|
1034
1043
|
size: "sm"
|
|
1035
1044
|
})
|
|
1036
1045
|
})]
|
|
1037
1046
|
}),
|
|
1038
|
-
/* @__PURE__ */
|
|
1047
|
+
/* @__PURE__ */ A(X, {
|
|
1039
1048
|
value: a,
|
|
1040
1049
|
onChange: o,
|
|
1041
1050
|
minDate: /* @__PURE__ */ new Date()
|
|
1042
1051
|
}),
|
|
1043
|
-
/* @__PURE__ */
|
|
1052
|
+
/* @__PURE__ */ A("div", {
|
|
1044
1053
|
className: "mt-ds-03 flex justify-end",
|
|
1045
|
-
children: /* @__PURE__ */
|
|
1054
|
+
children: /* @__PURE__ */ A(l, {
|
|
1046
1055
|
variant: "solid",
|
|
1047
1056
|
size: "sm",
|
|
1048
1057
|
onClick: () => {
|
|
@@ -1053,43 +1062,43 @@ function ut({ onSchedule: e, onClose: t, onOpenDialog: n }) {
|
|
|
1053
1062
|
})
|
|
1054
1063
|
})
|
|
1055
1064
|
]
|
|
1056
|
-
}) : /* @__PURE__ */
|
|
1065
|
+
}) : /* @__PURE__ */ j("div", {
|
|
1057
1066
|
className: "p-ds-02",
|
|
1058
1067
|
style: { minWidth: 260 },
|
|
1059
1068
|
children: [
|
|
1060
|
-
/* @__PURE__ */
|
|
1069
|
+
/* @__PURE__ */ A("p", {
|
|
1061
1070
|
className: "px-ds-03 py-ds-01 text-caption font-medium text-surface-fg-subtle",
|
|
1062
1071
|
children: "Schedule send"
|
|
1063
1072
|
}),
|
|
1064
|
-
c.map((e, t) => /* @__PURE__ */
|
|
1073
|
+
c.map((e, t) => /* @__PURE__ */ j(l, {
|
|
1065
1074
|
variant: "ghost",
|
|
1066
1075
|
fullWidth: !0,
|
|
1067
1076
|
onClick: () => u(e.date),
|
|
1068
|
-
children: [/* @__PURE__ */
|
|
1069
|
-
icon:
|
|
1077
|
+
children: [/* @__PURE__ */ A(s, {
|
|
1078
|
+
icon: oe,
|
|
1070
1079
|
size: "sm",
|
|
1071
1080
|
className: "shrink-0 text-surface-fg-muted"
|
|
1072
1081
|
}), e.label]
|
|
1073
1082
|
}, t)),
|
|
1074
|
-
/* @__PURE__ */
|
|
1075
|
-
/* @__PURE__ */
|
|
1083
|
+
/* @__PURE__ */ A("div", { className: "mx-ds-02 my-ds-02 h-px bg-surface-border" }),
|
|
1084
|
+
/* @__PURE__ */ j(l, {
|
|
1076
1085
|
variant: "ghost",
|
|
1077
1086
|
fullWidth: !0,
|
|
1078
1087
|
onClick: () => i(!0),
|
|
1079
|
-
children: [/* @__PURE__ */
|
|
1080
|
-
icon:
|
|
1088
|
+
children: [/* @__PURE__ */ A(s, {
|
|
1089
|
+
icon: N,
|
|
1081
1090
|
size: "sm",
|
|
1082
1091
|
className: "shrink-0 text-accent-11"
|
|
1083
1092
|
}), "Pick date & time..."]
|
|
1084
1093
|
}),
|
|
1085
|
-
n && /* @__PURE__ */
|
|
1094
|
+
n && /* @__PURE__ */ j(l, {
|
|
1086
1095
|
variant: "ghost",
|
|
1087
1096
|
fullWidth: !0,
|
|
1088
1097
|
onClick: () => {
|
|
1089
1098
|
n(), t();
|
|
1090
1099
|
},
|
|
1091
|
-
children: [/* @__PURE__ */
|
|
1092
|
-
icon:
|
|
1100
|
+
children: [/* @__PURE__ */ A(s, {
|
|
1101
|
+
icon: N,
|
|
1093
1102
|
size: "sm",
|
|
1094
1103
|
className: "shrink-0 text-surface-fg-muted"
|
|
1095
1104
|
}), "Open full picker..."]
|
|
@@ -1097,29 +1106,29 @@ function ut({ onSchedule: e, onClose: t, onOpenDialog: n }) {
|
|
|
1097
1106
|
]
|
|
1098
1107
|
});
|
|
1099
1108
|
}
|
|
1100
|
-
function
|
|
1101
|
-
let [i, a] =
|
|
1102
|
-
return
|
|
1109
|
+
function ft({ open: e, onOpenChange: t, onSchedule: n, initialDate: r }) {
|
|
1110
|
+
let [i, a] = T.useState(r ?? null);
|
|
1111
|
+
return T.useEffect(() => {
|
|
1103
1112
|
e && a(r ?? null);
|
|
1104
|
-
}, [e, r]), /* @__PURE__ */
|
|
1113
|
+
}, [e, r]), /* @__PURE__ */ A(u, {
|
|
1105
1114
|
open: e,
|
|
1106
1115
|
onOpenChange: t,
|
|
1107
|
-
children: /* @__PURE__ */
|
|
1116
|
+
children: /* @__PURE__ */ j(d, {
|
|
1108
1117
|
className: "sm:max-w-[380px]",
|
|
1109
1118
|
children: [
|
|
1110
|
-
/* @__PURE__ */
|
|
1111
|
-
/* @__PURE__ */
|
|
1119
|
+
/* @__PURE__ */ A(p, { children: /* @__PURE__ */ A(m, { children: r ? "Reschedule message" : "Schedule send" }) }),
|
|
1120
|
+
/* @__PURE__ */ A(ut, {
|
|
1112
1121
|
value: i,
|
|
1113
1122
|
onChange: a,
|
|
1114
1123
|
minDate: /* @__PURE__ */ new Date()
|
|
1115
1124
|
}),
|
|
1116
|
-
/* @__PURE__ */
|
|
1125
|
+
/* @__PURE__ */ j(f, {
|
|
1117
1126
|
className: "gap-ds-02",
|
|
1118
|
-
children: [/* @__PURE__ */
|
|
1127
|
+
children: [/* @__PURE__ */ A(l, {
|
|
1119
1128
|
variant: "soft",
|
|
1120
1129
|
onClick: () => t(!1),
|
|
1121
1130
|
children: "Cancel"
|
|
1122
|
-
}), /* @__PURE__ */
|
|
1131
|
+
}), /* @__PURE__ */ A(l, {
|
|
1123
1132
|
variant: "solid",
|
|
1124
1133
|
onClick: () => {
|
|
1125
1134
|
i && i > /* @__PURE__ */ new Date() && (n(i), t(!1));
|
|
@@ -1132,7 +1141,7 @@ function dt({ open: e, onOpenChange: t, onSchedule: n, initialDate: r }) {
|
|
|
1132
1141
|
})
|
|
1133
1142
|
});
|
|
1134
1143
|
}
|
|
1135
|
-
function
|
|
1144
|
+
function Z(e) {
|
|
1136
1145
|
let t = /* @__PURE__ */ new Date(), n = new Date(t);
|
|
1137
1146
|
n.setDate(n.getDate() + 1);
|
|
1138
1147
|
let r = e.toDateString() === t.toDateString(), i = e.toDateString() === n.toDateString(), a = e.toLocaleTimeString(void 0, {
|
|
@@ -1146,7 +1155,7 @@ function ft(e) {
|
|
|
1146
1155
|
})} at ${a}`;
|
|
1147
1156
|
}
|
|
1148
1157
|
function pt({ date: e, onClear: t, onEdit: n }) {
|
|
1149
|
-
return /* @__PURE__ */
|
|
1158
|
+
return /* @__PURE__ */ A(z.div, {
|
|
1150
1159
|
initial: {
|
|
1151
1160
|
height: 0,
|
|
1152
1161
|
opacity: 0
|
|
@@ -1161,37 +1170,37 @@ function pt({ date: e, onClear: t, onEdit: n }) {
|
|
|
1161
1170
|
},
|
|
1162
1171
|
transition: { duration: i.moderate01 },
|
|
1163
1172
|
className: "overflow-hidden",
|
|
1164
|
-
children: /* @__PURE__ */
|
|
1173
|
+
children: /* @__PURE__ */ j("div", {
|
|
1165
1174
|
className: "flex items-center gap-ds-03 px-ds-04 py-ds-02b text-body-xs text-accent-11 bg-accent-2 border-b border-accent-4",
|
|
1166
1175
|
children: [
|
|
1167
|
-
/* @__PURE__ */
|
|
1168
|
-
icon:
|
|
1176
|
+
/* @__PURE__ */ A(s, {
|
|
1177
|
+
icon: oe,
|
|
1169
1178
|
size: "xs",
|
|
1170
1179
|
className: "shrink-0"
|
|
1171
1180
|
}),
|
|
1172
|
-
/* @__PURE__ */
|
|
1181
|
+
/* @__PURE__ */ j("span", {
|
|
1173
1182
|
className: "min-w-0 flex-1 truncate",
|
|
1174
|
-
children: ["Scheduled for ",
|
|
1183
|
+
children: ["Scheduled for ", Z(e)]
|
|
1175
1184
|
}),
|
|
1176
|
-
n && /* @__PURE__ */
|
|
1185
|
+
n && /* @__PURE__ */ A(l, {
|
|
1177
1186
|
variant: "soft",
|
|
1178
1187
|
size: "icon-xs",
|
|
1179
1188
|
className: "shrink-0",
|
|
1180
1189
|
onClick: n,
|
|
1181
1190
|
"aria-label": "Edit schedule",
|
|
1182
|
-
children: /* @__PURE__ */
|
|
1183
|
-
icon:
|
|
1191
|
+
children: /* @__PURE__ */ A(s, {
|
|
1192
|
+
icon: he,
|
|
1184
1193
|
size: "xs"
|
|
1185
1194
|
})
|
|
1186
1195
|
}),
|
|
1187
|
-
/* @__PURE__ */
|
|
1196
|
+
/* @__PURE__ */ A(l, {
|
|
1188
1197
|
variant: "soft",
|
|
1189
1198
|
size: "icon-xs",
|
|
1190
1199
|
className: "shrink-0",
|
|
1191
1200
|
onClick: t,
|
|
1192
1201
|
"aria-label": "Cancel schedule",
|
|
1193
|
-
children: /* @__PURE__ */
|
|
1194
|
-
icon:
|
|
1202
|
+
children: /* @__PURE__ */ A(s, {
|
|
1203
|
+
icon: L,
|
|
1195
1204
|
size: "xs"
|
|
1196
1205
|
})
|
|
1197
1206
|
})
|
|
@@ -1201,19 +1210,19 @@ function pt({ date: e, onClear: t, onEdit: n }) {
|
|
|
1201
1210
|
}
|
|
1202
1211
|
//#endregion
|
|
1203
1212
|
//#region src/composed/rich-chat-input/use-voice-recorder.ts
|
|
1204
|
-
function
|
|
1213
|
+
function mt() {
|
|
1205
1214
|
return typeof MediaRecorder < "u" && MediaRecorder.isTypeSupported("audio/webm;codecs=opus") ? "audio/webm;codecs=opus" : typeof MediaRecorder < "u" && MediaRecorder.isTypeSupported("audio/mp4") ? "audio/mp4" : "";
|
|
1206
1215
|
}
|
|
1207
|
-
function
|
|
1208
|
-
let { maxDuration: t, onComplete: n } = e, [r, i] =
|
|
1216
|
+
function ht(e) {
|
|
1217
|
+
let { maxDuration: t, onComplete: n } = e, [r, i] = k("idle"), [a, o] = k(0), [s, c] = k(null), [l, u] = k([]), d = O(null), f = O(null), p = O(null), m = O([]), h = O(null), g = O(null), _ = O(null), v = O(null), y = O(0), b = O([]), x = O(!1), ee = O(n);
|
|
1209
1218
|
ee.current = n;
|
|
1210
|
-
let S =
|
|
1219
|
+
let S = E(() => {
|
|
1211
1220
|
h.current !== null && (clearInterval(h.current), h.current = null), g.current !== null && (clearInterval(g.current), g.current = null), _.current !== null && (clearTimeout(_.current), _.current = null), p.current &&= (p.current.getTracks().forEach((e) => e.stop()), null), f.current &&= (f.current.close().catch(() => {}), null), v.current = null, c(null), d.current = null, m.current = [];
|
|
1212
|
-
}, []), C =
|
|
1221
|
+
}, []), C = E(async () => {
|
|
1213
1222
|
if (typeof MediaRecorder > "u") throw Error("MediaRecorder is not supported in this browser. Voice recording requires a modern browser with MediaRecorder support.");
|
|
1214
1223
|
let e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
1215
1224
|
p.current = e;
|
|
1216
|
-
let n =
|
|
1225
|
+
let n = mt(), r = n ? new MediaRecorder(e, { mimeType: n }) : new MediaRecorder(e);
|
|
1217
1226
|
d.current = r, m.current = [], x.current = !1;
|
|
1218
1227
|
let a = new AudioContext();
|
|
1219
1228
|
f.current = a;
|
|
@@ -1241,13 +1250,13 @@ function mt(e) {
|
|
|
1241
1250
|
}, 100), t !== void 0 && t > 0 && (_.current = setTimeout(() => {
|
|
1242
1251
|
d.current && d.current.state !== "inactive" && d.current.stop();
|
|
1243
1252
|
}, t * 1e3)), i("recording");
|
|
1244
|
-
}, [t, S]), w =
|
|
1253
|
+
}, [t, S]), w = E(() => {
|
|
1245
1254
|
d.current && d.current.state !== "inactive" && (x.current = !1, d.current.stop());
|
|
1246
|
-
}, []),
|
|
1255
|
+
}, []), T = E(() => {
|
|
1247
1256
|
d.current && d.current.state !== "inactive" ? (x.current = !0, d.current.stop()) : (S(), i("idle"), o(0), u([]));
|
|
1248
|
-
}, [S]),
|
|
1257
|
+
}, [S]), te = E(() => {
|
|
1249
1258
|
d.current && d.current.state === "recording" && (d.current.pause(), h.current !== null && (clearInterval(h.current), h.current = null), g.current !== null && (clearInterval(g.current), g.current = null), i("paused"));
|
|
1250
|
-
}, []),
|
|
1259
|
+
}, []), A = E(() => {
|
|
1251
1260
|
if (d.current && d.current.state === "paused") {
|
|
1252
1261
|
d.current.resume(), h.current = setInterval(() => {
|
|
1253
1262
|
y.current += 1, o((e) => e + 1);
|
|
@@ -1264,7 +1273,7 @@ function mt(e) {
|
|
|
1264
1273
|
}, 100), i("recording");
|
|
1265
1274
|
}
|
|
1266
1275
|
}, []);
|
|
1267
|
-
return
|
|
1276
|
+
return D(() => () => {
|
|
1268
1277
|
h.current !== null && clearInterval(h.current), g.current !== null && clearInterval(g.current), _.current !== null && clearTimeout(_.current), d.current && d.current.state !== "inactive" && d.current.stop(), p.current && p.current.getTracks().forEach((e) => e.stop()), f.current && f.current.close().catch(() => {});
|
|
1269
1278
|
}, []), {
|
|
1270
1279
|
state: r,
|
|
@@ -1273,14 +1282,14 @@ function mt(e) {
|
|
|
1273
1282
|
waveformData: l,
|
|
1274
1283
|
start: C,
|
|
1275
1284
|
stop: w,
|
|
1276
|
-
cancel:
|
|
1277
|
-
pause:
|
|
1278
|
-
resume:
|
|
1285
|
+
cancel: T,
|
|
1286
|
+
pause: te,
|
|
1287
|
+
resume: A
|
|
1279
1288
|
};
|
|
1280
1289
|
}
|
|
1281
1290
|
//#endregion
|
|
1282
1291
|
//#region src/composed/rich-chat-input.tsx
|
|
1283
|
-
var
|
|
1292
|
+
var gt = {
|
|
1284
1293
|
compact: {
|
|
1285
1294
|
minHeight: 44,
|
|
1286
1295
|
maxHeight: 256,
|
|
@@ -1305,7 +1314,7 @@ var ht = {
|
|
|
1305
1314
|
showToolbar: !1,
|
|
1306
1315
|
toolbarPosition: "top"
|
|
1307
1316
|
}
|
|
1308
|
-
},
|
|
1317
|
+
}, _t = [
|
|
1309
1318
|
"prose prose-sm max-w-none focus:outline-hidden",
|
|
1310
1319
|
"font-body text-body-md leading-relaxed text-surface-fg",
|
|
1311
1320
|
"[&_p.is-editor-empty:first-child]:relative",
|
|
@@ -1320,75 +1329,75 @@ var ht = {
|
|
|
1320
1329
|
"[&_a]:text-accent-11 [&_a]:underline",
|
|
1321
1330
|
y
|
|
1322
1331
|
].join(" ");
|
|
1323
|
-
function
|
|
1324
|
-
let [t, n] =
|
|
1325
|
-
return
|
|
1332
|
+
function vt({ options: e }) {
|
|
1333
|
+
let [t, n] = T.useState(!1), r = T.useRef(null);
|
|
1334
|
+
return T.useEffect(() => {
|
|
1326
1335
|
if (!t) return;
|
|
1327
1336
|
let e = (e) => {
|
|
1328
1337
|
r.current && !r.current.contains(e.target) && n(!1);
|
|
1329
1338
|
};
|
|
1330
1339
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
1331
|
-
}, [t]), /* @__PURE__ */
|
|
1340
|
+
}, [t]), /* @__PURE__ */ j("div", {
|
|
1332
1341
|
ref: r,
|
|
1333
1342
|
className: "relative",
|
|
1334
|
-
children: [/* @__PURE__ */
|
|
1343
|
+
children: [/* @__PURE__ */ A("button", {
|
|
1335
1344
|
type: "button",
|
|
1336
1345
|
onClick: () => n((e) => !e),
|
|
1337
1346
|
title: "More send options",
|
|
1338
1347
|
"aria-label": "More send options",
|
|
1339
1348
|
"aria-expanded": t,
|
|
1340
1349
|
className: a("inline-flex h-ds-xs-plus w-5 items-center justify-center rounded-control touch-target", "text-surface-fg-subtle hover:bg-surface-raised-hover hover:text-surface-fg", "transition-colors duration-fast-01 ease-productive-standard", t && "bg-surface-raised-hover text-surface-fg"),
|
|
1341
|
-
children: /* @__PURE__ */
|
|
1342
|
-
icon:
|
|
1350
|
+
children: /* @__PURE__ */ A(s, {
|
|
1351
|
+
icon: ae,
|
|
1343
1352
|
size: "xs"
|
|
1344
1353
|
})
|
|
1345
|
-
}), t && /* @__PURE__ */
|
|
1354
|
+
}), t && /* @__PURE__ */ j("div", {
|
|
1346
1355
|
className: "absolute bottom-full right-0 mb-ds-02 min-w-[200px] rounded-surface bg-surface-overlay p-ds-02 shadow-floating z-popover",
|
|
1347
|
-
children: [/* @__PURE__ */
|
|
1356
|
+
children: [/* @__PURE__ */ A("p", {
|
|
1348
1357
|
className: "px-ds-03 py-ds-01 text-caption font-medium text-surface-fg-subtle",
|
|
1349
1358
|
children: "Send options"
|
|
1350
|
-
}), e.map((e, t) => /* @__PURE__ */
|
|
1359
|
+
}), e.map((e, t) => /* @__PURE__ */ j("button", {
|
|
1351
1360
|
type: "button",
|
|
1352
1361
|
onClick: () => {
|
|
1353
1362
|
e.onSelect(), n(!1);
|
|
1354
1363
|
},
|
|
1355
1364
|
className: "flex w-full items-center gap-ds-03 rounded-control px-ds-03 py-ds-02 text-body-sm text-surface-fg hover:bg-surface-raised-hover transition-colors duration-fast-01",
|
|
1356
|
-
children: [e.icon && /* @__PURE__ */
|
|
1365
|
+
children: [e.icon && /* @__PURE__ */ A(e.icon, { className: "h-ico-sm w-ico-sm text-surface-fg-muted" }), e.label]
|
|
1357
1366
|
}, t))]
|
|
1358
1367
|
})]
|
|
1359
1368
|
});
|
|
1360
1369
|
}
|
|
1361
|
-
var
|
|
1362
|
-
function
|
|
1363
|
-
let n =
|
|
1364
|
-
|
|
1370
|
+
var yt = T.lazy(() => import("./emoji-picker.js").then((e) => ({ default: e.EmojiPicker })));
|
|
1371
|
+
function bt({ onSelect: e, onClose: t }) {
|
|
1372
|
+
let n = T.useRef(null);
|
|
1373
|
+
T.useEffect(() => {
|
|
1365
1374
|
let e = (e) => {
|
|
1366
1375
|
n.current && !n.current.contains(e.target) && t();
|
|
1367
1376
|
};
|
|
1368
1377
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
1369
|
-
}, [t]),
|
|
1378
|
+
}, [t]), T.useEffect(() => {
|
|
1370
1379
|
let e = (e) => {
|
|
1371
1380
|
e.key === "Escape" && t();
|
|
1372
1381
|
};
|
|
1373
1382
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
1374
1383
|
}, [t]);
|
|
1375
|
-
let r = /* @__PURE__ */
|
|
1384
|
+
let r = /* @__PURE__ */ A("div", {
|
|
1376
1385
|
className: "flex h-[435px] w-[352px] items-center justify-center rounded-surface bg-surface-overlay shadow-floating",
|
|
1377
|
-
children: /* @__PURE__ */
|
|
1386
|
+
children: /* @__PURE__ */ A("span", {
|
|
1378
1387
|
className: "text-body-sm text-surface-fg-subtle",
|
|
1379
1388
|
children: "Loading…"
|
|
1380
1389
|
})
|
|
1381
1390
|
});
|
|
1382
|
-
return /* @__PURE__ */
|
|
1391
|
+
return /* @__PURE__ */ A("div", {
|
|
1383
1392
|
ref: n,
|
|
1384
|
-
children: /* @__PURE__ */
|
|
1393
|
+
children: /* @__PURE__ */ A(T.Suspense, {
|
|
1385
1394
|
fallback: r,
|
|
1386
|
-
children: /* @__PURE__ */
|
|
1395
|
+
children: /* @__PURE__ */ A(yt, { onSelect: e })
|
|
1387
1396
|
})
|
|
1388
1397
|
});
|
|
1389
1398
|
}
|
|
1390
1399
|
function Q({ onClick: e, isActive: t = !1, title: n, children: r }) {
|
|
1391
|
-
return /* @__PURE__ */
|
|
1400
|
+
return /* @__PURE__ */ A("button", {
|
|
1392
1401
|
type: "button",
|
|
1393
1402
|
onClick: e,
|
|
1394
1403
|
title: n,
|
|
@@ -1398,8 +1407,8 @@ function Q({ onClick: e, isActive: t = !1, title: n, children: r }) {
|
|
|
1398
1407
|
children: r
|
|
1399
1408
|
});
|
|
1400
1409
|
}
|
|
1401
|
-
function
|
|
1402
|
-
let t =
|
|
1410
|
+
function xt({ editor: e }) {
|
|
1411
|
+
let t = B({
|
|
1403
1412
|
editor: e,
|
|
1404
1413
|
selector: ({ editor: e }) => ({
|
|
1405
1414
|
isBold: e.isActive("bold"),
|
|
@@ -1410,72 +1419,72 @@ function bt({ editor: e }) {
|
|
|
1410
1419
|
isCode: e.isActive("code")
|
|
1411
1420
|
})
|
|
1412
1421
|
});
|
|
1413
|
-
return /* @__PURE__ */
|
|
1422
|
+
return /* @__PURE__ */ j(Ne, {
|
|
1414
1423
|
editor: e,
|
|
1415
1424
|
className: "flex gap-ds-01 rounded-surface bg-surface-overlay p-ds-02 shadow-floating",
|
|
1416
1425
|
children: [
|
|
1417
|
-
/* @__PURE__ */
|
|
1426
|
+
/* @__PURE__ */ A(Q, {
|
|
1418
1427
|
onClick: () => e.chain().focus().toggleBold().run(),
|
|
1419
1428
|
isActive: t.isBold,
|
|
1420
1429
|
title: "Bold",
|
|
1421
|
-
children: /* @__PURE__ */
|
|
1422
|
-
icon:
|
|
1430
|
+
children: /* @__PURE__ */ A(s, {
|
|
1431
|
+
icon: ie,
|
|
1423
1432
|
size: "xs"
|
|
1424
1433
|
})
|
|
1425
1434
|
}),
|
|
1426
|
-
/* @__PURE__ */
|
|
1435
|
+
/* @__PURE__ */ A(Q, {
|
|
1427
1436
|
onClick: () => e.chain().focus().toggleItalic().run(),
|
|
1428
1437
|
isActive: t.isItalic,
|
|
1429
1438
|
title: "Italic",
|
|
1430
|
-
children: /* @__PURE__ */
|
|
1431
|
-
icon:
|
|
1439
|
+
children: /* @__PURE__ */ A(s, {
|
|
1440
|
+
icon: ue,
|
|
1432
1441
|
size: "xs"
|
|
1433
1442
|
})
|
|
1434
1443
|
}),
|
|
1435
|
-
/* @__PURE__ */
|
|
1444
|
+
/* @__PURE__ */ A(Q, {
|
|
1436
1445
|
onClick: () => e.chain().focus().toggleUnderline().run(),
|
|
1437
1446
|
isActive: t.isUnderline,
|
|
1438
1447
|
title: "Underline",
|
|
1439
|
-
children: /* @__PURE__ */
|
|
1440
|
-
icon:
|
|
1448
|
+
children: /* @__PURE__ */ A(s, {
|
|
1449
|
+
icon: I,
|
|
1441
1450
|
size: "xs"
|
|
1442
1451
|
})
|
|
1443
1452
|
}),
|
|
1444
|
-
/* @__PURE__ */
|
|
1453
|
+
/* @__PURE__ */ A(Q, {
|
|
1445
1454
|
onClick: () => e.chain().focus().toggleStrike().run(),
|
|
1446
1455
|
isActive: t.isStrike,
|
|
1447
1456
|
title: "Strikethrough",
|
|
1448
|
-
children: /* @__PURE__ */
|
|
1449
|
-
icon:
|
|
1457
|
+
children: /* @__PURE__ */ A(s, {
|
|
1458
|
+
icon: F,
|
|
1450
1459
|
size: "xs"
|
|
1451
1460
|
})
|
|
1452
1461
|
}),
|
|
1453
|
-
/* @__PURE__ */
|
|
1462
|
+
/* @__PURE__ */ A(Q, {
|
|
1454
1463
|
onClick: () => e.chain().focus().toggleHighlight().run(),
|
|
1455
1464
|
isActive: t.isHighlight,
|
|
1456
1465
|
title: "Highlight",
|
|
1457
|
-
children: /* @__PURE__ */
|
|
1458
|
-
icon:
|
|
1466
|
+
children: /* @__PURE__ */ A(s, {
|
|
1467
|
+
icon: le,
|
|
1459
1468
|
size: "xs"
|
|
1460
1469
|
})
|
|
1461
1470
|
}),
|
|
1462
|
-
/* @__PURE__ */
|
|
1471
|
+
/* @__PURE__ */ A(Q, {
|
|
1463
1472
|
onClick: () => e.chain().focus().toggleCode().run(),
|
|
1464
1473
|
isActive: t.isCode,
|
|
1465
1474
|
title: "Code",
|
|
1466
|
-
children: /* @__PURE__ */
|
|
1467
|
-
icon:
|
|
1475
|
+
children: /* @__PURE__ */ A(s, {
|
|
1476
|
+
icon: se,
|
|
1468
1477
|
size: "xs"
|
|
1469
1478
|
})
|
|
1470
1479
|
})
|
|
1471
1480
|
]
|
|
1472
1481
|
});
|
|
1473
1482
|
}
|
|
1474
|
-
var
|
|
1475
|
-
let [
|
|
1476
|
-
|
|
1477
|
-
if (!
|
|
1478
|
-
let i =
|
|
1483
|
+
var St = T.forwardRef(function({ onSubmit: o, placeholder: u = "Type a message...", disabled: d = !1, content: f = "", variant: p = "compact", enterBehavior: m = "send", maxLength: g, charCountDisplay: _ = "near-limit", mentions: v, onMentionSearch: y, onMentionSelect: C, onFileUpload: w, onImageUpload: E, slashCommands: D, onVoiceRecord: O, onTranscribe: k, maxDuration: te, replyTo: M, onTyping: re, onEmpty: ie, isStreaming: N = !1, onCancel: ae, leadingSlot: se, trailingSlot: ce, disclaimer: le, toolbar: ue = !0, sendOptions: de, onSchedule: P, actionButton: fe, emojiSet: he = "native", className: ge, ..._e }, be) {
|
|
1484
|
+
let [F, I] = T.useState("idle"), [L, we] = T.useState(!1), [Ne, Fe] = T.useState(!1), [V, Ie] = T.useState(null), [Le, H] = T.useState(!1), [Re, Be] = T.useState(!1), [U, He] = T.useState(0), Ue = T.useRef(null), Ge = T.useRef(null);
|
|
1485
|
+
T.useEffect(() => {
|
|
1486
|
+
if (!Ne || !Ue.current || !Ge.current) return;
|
|
1487
|
+
let i = Ue.current, a = Ge.current, o = () => {
|
|
1479
1488
|
e(i, a, {
|
|
1480
1489
|
placement: "top-end",
|
|
1481
1490
|
middleware: [
|
|
@@ -1493,42 +1502,42 @@ var xt = O.forwardRef(function({ onSubmit: o, placeholder: u = "Type a message..
|
|
|
1493
1502
|
return o(), window.addEventListener("scroll", o, !0), window.addEventListener("resize", o), () => {
|
|
1494
1503
|
window.removeEventListener("scroll", o, !0), window.removeEventListener("resize", o);
|
|
1495
1504
|
};
|
|
1496
|
-
}, [
|
|
1497
|
-
let [
|
|
1505
|
+
}, [Ne]);
|
|
1506
|
+
let [W, G] = T.useState([]), [K, q] = T.useState(null), [Ke, qe] = T.useState(!1), Je = T.useRef(null), Ye = T.useRef(null), Xe = T.useRef(void 0), Ze = T.useRef(void 0), Qe = T.useRef(m);
|
|
1498
1507
|
Qe.current = m;
|
|
1499
|
-
let $e =
|
|
1500
|
-
$e.current =
|
|
1501
|
-
let et =
|
|
1508
|
+
let $e = T.useRef(C);
|
|
1509
|
+
$e.current = C;
|
|
1510
|
+
let et = T.useRef(v);
|
|
1502
1511
|
et.current = v;
|
|
1503
|
-
let tt =
|
|
1512
|
+
let tt = T.useRef(y);
|
|
1504
1513
|
tt.current = y;
|
|
1505
|
-
let nt = c(), J =
|
|
1506
|
-
maxDuration:
|
|
1514
|
+
let nt = c(), J = gt[p], rt = J.maxHeight, Y = ht({
|
|
1515
|
+
maxDuration: te,
|
|
1507
1516
|
onComplete: async (e, t, n) => {
|
|
1508
|
-
if (
|
|
1517
|
+
if (O?.(e, t), k) {
|
|
1509
1518
|
let n = await k(e, t);
|
|
1510
1519
|
if (n != null) {
|
|
1511
|
-
X?.chain().focus().insertContent(n).run(),
|
|
1520
|
+
X?.chain().focus().insertContent(n).run(), I("idle");
|
|
1512
1521
|
return;
|
|
1513
1522
|
}
|
|
1514
1523
|
}
|
|
1515
|
-
|
|
1524
|
+
q({
|
|
1516
1525
|
blob: e,
|
|
1517
1526
|
duration: t,
|
|
1518
1527
|
waveformData: n
|
|
1519
|
-
}),
|
|
1528
|
+
}), I("review");
|
|
1520
1529
|
}
|
|
1521
|
-
}),
|
|
1522
|
-
Y.start(),
|
|
1523
|
-
}, [Y]), ct =
|
|
1530
|
+
}), at = T.useCallback(() => {
|
|
1531
|
+
Y.start(), I("recording");
|
|
1532
|
+
}, [Y]), ct = T.useCallback(() => {
|
|
1524
1533
|
Y.stop();
|
|
1525
|
-
}, [Y]), lt =
|
|
1526
|
-
Y.cancel(),
|
|
1527
|
-
}, [Y]), X =
|
|
1534
|
+
}, [Y]), lt = T.useCallback(() => {
|
|
1535
|
+
Y.cancel(), I("idle");
|
|
1536
|
+
}, [Y]), X = Me({
|
|
1528
1537
|
immediatelyRender: !1,
|
|
1529
|
-
extensions:
|
|
1538
|
+
extensions: T.useMemo(() => {
|
|
1530
1539
|
let e = [
|
|
1531
|
-
|
|
1540
|
+
Pe.configure({
|
|
1532
1541
|
heading: !1,
|
|
1533
1542
|
horizontalRule: !1,
|
|
1534
1543
|
codeBlock: !1,
|
|
@@ -1538,14 +1547,14 @@ var xt = O.forwardRef(function({ onSubmit: o, placeholder: u = "Type a message..
|
|
|
1538
1547
|
HTMLAttributes: { class: "text-accent-11 underline" }
|
|
1539
1548
|
}
|
|
1540
1549
|
}),
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1550
|
+
ke.configure({ placeholder: u }),
|
|
1551
|
+
Te.configure({ multicolor: !1 }),
|
|
1552
|
+
Ee,
|
|
1553
|
+
Oe.configure({ limit: g || void 0 }),
|
|
1554
|
+
ee,
|
|
1555
|
+
b,
|
|
1556
|
+
x(),
|
|
1557
|
+
je.create({
|
|
1549
1558
|
name: "enterToSend",
|
|
1550
1559
|
addKeyboardShortcuts() {
|
|
1551
1560
|
return {
|
|
@@ -1556,7 +1565,7 @@ var xt = O.forwardRef(function({ onSubmit: o, placeholder: u = "Type a message..
|
|
|
1556
1565
|
}
|
|
1557
1566
|
})
|
|
1558
1567
|
];
|
|
1559
|
-
return (v || y) && e.push(
|
|
1568
|
+
return (v || y) && e.push(De.configure({
|
|
1560
1569
|
HTMLAttributes: { class: "mention" },
|
|
1561
1570
|
suggestion: {
|
|
1562
1571
|
items: async ({ query: e }) => {
|
|
@@ -1564,13 +1573,13 @@ var xt = O.forwardRef(function({ onSubmit: o, placeholder: u = "Type a message..
|
|
|
1564
1573
|
let t = et.current;
|
|
1565
1574
|
return t ? t.filter((t) => t.label.toLowerCase().includes(e.toLowerCase())).slice(0, 8) : [];
|
|
1566
1575
|
},
|
|
1567
|
-
render:
|
|
1576
|
+
render: S((e) => $e.current?.(e))
|
|
1568
1577
|
}
|
|
1569
|
-
})), D && e.push(
|
|
1578
|
+
})), D && e.push(ze(D)), e;
|
|
1570
1579
|
}, [
|
|
1571
1580
|
u,
|
|
1572
1581
|
g,
|
|
1573
|
-
|
|
1582
|
+
he,
|
|
1574
1583
|
!!v,
|
|
1575
1584
|
!!y,
|
|
1576
1585
|
!!D
|
|
@@ -1578,58 +1587,58 @@ var xt = O.forwardRef(function({ onSubmit: o, placeholder: u = "Type a message..
|
|
|
1578
1587
|
content: f || void 0,
|
|
1579
1588
|
editable: !d,
|
|
1580
1589
|
editorProps: {
|
|
1581
|
-
attributes: { class:
|
|
1590
|
+
attributes: { class: _t },
|
|
1582
1591
|
handlePaste: (e, t) => {
|
|
1583
1592
|
let n = Array.from(t.clipboardData?.files ?? []);
|
|
1584
1593
|
return n.length > 0 ? (n.forEach(Z), !0) : !1;
|
|
1585
1594
|
}
|
|
1586
1595
|
}
|
|
1587
|
-
}),
|
|
1596
|
+
}), ut = T.useCallback(() => {
|
|
1588
1597
|
if (!X) return;
|
|
1589
|
-
let e = !X.isEmpty, t =
|
|
1590
|
-
if (!e && !t && !n ||
|
|
1598
|
+
let e = !X.isEmpty, t = W.length > 0, n = !!K;
|
|
1599
|
+
if (!e && !t && !n || N) return;
|
|
1591
1600
|
let r = {
|
|
1592
1601
|
html: e ? X.getHTML() : "",
|
|
1593
1602
|
plainText: e ? X.getText() : ""
|
|
1594
1603
|
};
|
|
1595
|
-
t && (r.attachments =
|
|
1604
|
+
t && (r.attachments = W.filter((e) => !e.uploading && e.url).map((e) => ({
|
|
1596
1605
|
url: e.url,
|
|
1597
1606
|
name: e.name,
|
|
1598
1607
|
size: e.size,
|
|
1599
1608
|
type: e.type
|
|
1600
1609
|
}))), n && (r.voiceNote = {
|
|
1601
|
-
blob:
|
|
1602
|
-
duration:
|
|
1603
|
-
}),
|
|
1610
|
+
blob: K.blob,
|
|
1611
|
+
duration: K.duration
|
|
1612
|
+
}), V && P ? P(r, V) : o(r), X.commands.clearContent(), G([]), q(null), Ie(null), I("idle");
|
|
1604
1613
|
}, [
|
|
1605
1614
|
X,
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1615
|
+
W,
|
|
1616
|
+
K,
|
|
1617
|
+
N,
|
|
1609
1618
|
o,
|
|
1610
|
-
|
|
1611
|
-
|
|
1619
|
+
P,
|
|
1620
|
+
V
|
|
1612
1621
|
]);
|
|
1613
|
-
Ze.current =
|
|
1614
|
-
if (!X || !
|
|
1622
|
+
Ze.current = ut, T.useEffect(() => {
|
|
1623
|
+
if (!X || !re) return;
|
|
1615
1624
|
let e = () => {
|
|
1616
|
-
|
|
1625
|
+
re(!0), clearTimeout(Xe.current), Xe.current = setTimeout(() => re(!1), 2e3);
|
|
1617
1626
|
};
|
|
1618
1627
|
return X.on("update", e), () => {
|
|
1619
1628
|
X.off("update", e), clearTimeout(Xe.current);
|
|
1620
1629
|
};
|
|
1621
|
-
}, [X,
|
|
1622
|
-
if (!X || !
|
|
1630
|
+
}, [X, re]), T.useEffect(() => {
|
|
1631
|
+
if (!X || !ie) return;
|
|
1623
1632
|
let e = () => {
|
|
1624
|
-
|
|
1633
|
+
ie(X.isEmpty);
|
|
1625
1634
|
};
|
|
1626
1635
|
return X.on("update", e), e(), () => {
|
|
1627
1636
|
X.off("update", e);
|
|
1628
1637
|
};
|
|
1629
|
-
}, [X,
|
|
1630
|
-
let Z =
|
|
1638
|
+
}, [X, ie]);
|
|
1639
|
+
let Z = T.useCallback(async (e) => {
|
|
1631
1640
|
let t = Math.random().toString(36).slice(2), n = e.type.startsWith("image/");
|
|
1632
|
-
|
|
1641
|
+
G((r) => [...r, {
|
|
1633
1642
|
id: t,
|
|
1634
1643
|
name: e.name,
|
|
1635
1644
|
size: e.size,
|
|
@@ -1637,16 +1646,16 @@ var xt = O.forwardRef(function({ onSubmit: o, placeholder: u = "Type a message..
|
|
|
1637
1646
|
uploading: !0
|
|
1638
1647
|
}]);
|
|
1639
1648
|
try {
|
|
1640
|
-
if (n &&
|
|
1641
|
-
let n = await
|
|
1642
|
-
|
|
1649
|
+
if (n && E) {
|
|
1650
|
+
let n = await E(e);
|
|
1651
|
+
G((e) => e.map((e) => e.id === t ? {
|
|
1643
1652
|
...e,
|
|
1644
1653
|
url: n,
|
|
1645
1654
|
uploading: !1
|
|
1646
1655
|
} : e));
|
|
1647
1656
|
} else if (w) {
|
|
1648
1657
|
let n = await w(e);
|
|
1649
|
-
|
|
1658
|
+
G((e) => e.map((e) => e.id === t ? {
|
|
1650
1659
|
...e,
|
|
1651
1660
|
url: n.url,
|
|
1652
1661
|
name: n.name,
|
|
@@ -1655,28 +1664,28 @@ var xt = O.forwardRef(function({ onSubmit: o, placeholder: u = "Type a message..
|
|
|
1655
1664
|
} : e));
|
|
1656
1665
|
} else if (n) {
|
|
1657
1666
|
let n = URL.createObjectURL(e);
|
|
1658
|
-
|
|
1667
|
+
G((e) => e.map((e) => e.id === t ? {
|
|
1659
1668
|
...e,
|
|
1660
1669
|
url: n,
|
|
1661
1670
|
uploading: !1
|
|
1662
1671
|
} : e));
|
|
1663
|
-
} else
|
|
1672
|
+
} else G((e) => e.filter((e) => e.id !== t));
|
|
1664
1673
|
} catch {
|
|
1665
|
-
|
|
1674
|
+
G((e) => e.filter((e) => e.id !== t));
|
|
1666
1675
|
}
|
|
1667
|
-
}, [w,
|
|
1668
|
-
|
|
1669
|
-
}, []),
|
|
1676
|
+
}, [w, E]), mt = T.useCallback((e) => {
|
|
1677
|
+
G((t) => t.filter((t) => t.id !== e));
|
|
1678
|
+
}, []), yt = T.useCallback((e) => {
|
|
1670
1679
|
e.preventDefault(), qe(!1), Array.from(e.dataTransfer.files).forEach(Z);
|
|
1671
|
-
}, [Z]),
|
|
1680
|
+
}, [Z]), Q = T.useCallback((e) => {
|
|
1672
1681
|
Array.from(e.target.files || []).forEach(Z), e.target.value = "";
|
|
1673
|
-
}, [Z]), St =
|
|
1674
|
-
|
|
1675
|
-
}, []), Ct =
|
|
1682
|
+
}, [Z]), St = T.useCallback(() => {
|
|
1683
|
+
q(null), I("idle");
|
|
1684
|
+
}, []), Ct = B({
|
|
1676
1685
|
editor: X,
|
|
1677
1686
|
selector: ({ editor: e }) => e ? { editorIsEmpty: e.isEmpty } : null
|
|
1678
1687
|
})?.editorIsEmpty ?? !0;
|
|
1679
|
-
|
|
1688
|
+
T.useEffect(() => {
|
|
1680
1689
|
if (!X) return;
|
|
1681
1690
|
let e = () => {
|
|
1682
1691
|
let e = X.state.doc.textBetween(0, X.state.doc.content.size, void 0, " ");
|
|
@@ -1686,60 +1695,60 @@ var xt = O.forwardRef(function({ onSubmit: o, placeholder: u = "Type a message..
|
|
|
1686
1695
|
X.off("update", e);
|
|
1687
1696
|
};
|
|
1688
1697
|
}, [X]);
|
|
1689
|
-
let wt = !Ct ||
|
|
1690
|
-
return /* @__PURE__ */
|
|
1691
|
-
ref:
|
|
1692
|
-
className: a("border-t border-surface-border-subtle px-ds-05 py-ds-04", "flex items-center gap-ds-03",
|
|
1693
|
-
...
|
|
1698
|
+
let wt = !Ct || W.length > 0 || !!K, Tt = L || F === "review" || p === "expanded", $ = "icon-md";
|
|
1699
|
+
return /* @__PURE__ */ j("div", {
|
|
1700
|
+
ref: be,
|
|
1701
|
+
className: a("border-t border-surface-border-subtle px-ds-05 py-ds-04", "flex items-center gap-ds-03", ge),
|
|
1702
|
+
..._e,
|
|
1694
1703
|
children: [
|
|
1695
|
-
|
|
1704
|
+
fe !== !1 && (fe ?? (w || E ? /* @__PURE__ */ A(l, {
|
|
1696
1705
|
variant: "solid",
|
|
1697
1706
|
size: "icon-md",
|
|
1698
1707
|
onClick: () => Je.current?.click(),
|
|
1699
1708
|
title: "Attach",
|
|
1700
1709
|
"aria-label": "Attach file",
|
|
1701
1710
|
className: "shrink-0",
|
|
1702
|
-
children: /* @__PURE__ */
|
|
1703
|
-
icon:
|
|
1711
|
+
children: /* @__PURE__ */ A(s, {
|
|
1712
|
+
icon: ve,
|
|
1704
1713
|
size: "md"
|
|
1705
1714
|
})
|
|
1706
1715
|
}) : null)),
|
|
1707
|
-
/* @__PURE__ */
|
|
1716
|
+
/* @__PURE__ */ j("div", {
|
|
1708
1717
|
role: "region",
|
|
1709
1718
|
"aria-label": "Message composer",
|
|
1710
|
-
className: a("flex-1 min-w-0 overflow-hidden rounded-surface border border-surface-border-strong bg-surface-raised-hover", "transition-[color,background-color,border-color,box-shadow] duration-fast-02 ease-productive-standard", "hover:bg-surface-raised-active", "focus-within:ring-2 focus-within:ring-accent-9 focus-within:ring-offset-2 focus-within:border-accent-9",
|
|
1711
|
-
onFocus: () =>
|
|
1719
|
+
className: a("flex-1 min-w-0 overflow-hidden rounded-surface border border-surface-border-strong bg-surface-raised-hover", "transition-[color,background-color,border-color,box-shadow] duration-fast-02 ease-productive-standard", "hover:bg-surface-raised-active", "focus-within:ring-2 focus-within:ring-accent-9 focus-within:ring-offset-2 focus-within:border-accent-9", F === "recording" && "border-error-7/30", Ke && "border-dashed border-accent-7 bg-accent-2", d && "opacity-action-disabled cursor-not-allowed"),
|
|
1720
|
+
onFocus: () => Be(!0),
|
|
1712
1721
|
onBlur: (e) => {
|
|
1713
|
-
e.currentTarget.contains(e.relatedTarget) ||
|
|
1722
|
+
e.currentTarget.contains(e.relatedTarget) || Be(!1);
|
|
1714
1723
|
},
|
|
1715
1724
|
onDragOver: (e) => {
|
|
1716
1725
|
e.preventDefault(), qe(!0);
|
|
1717
1726
|
},
|
|
1718
1727
|
onDragLeave: () => qe(!1),
|
|
1719
|
-
onDrop:
|
|
1728
|
+
onDrop: yt,
|
|
1720
1729
|
children: [
|
|
1721
|
-
|
|
1722
|
-
/* @__PURE__ */
|
|
1723
|
-
author:
|
|
1724
|
-
preview:
|
|
1725
|
-
onDismiss:
|
|
1730
|
+
se,
|
|
1731
|
+
/* @__PURE__ */ A(R, { children: M && /* @__PURE__ */ A(st, {
|
|
1732
|
+
author: M.author,
|
|
1733
|
+
preview: M.preview,
|
|
1734
|
+
onDismiss: M.onDismiss
|
|
1726
1735
|
}, "reply") }),
|
|
1727
|
-
/* @__PURE__ */
|
|
1728
|
-
date:
|
|
1729
|
-
onEdit: () =>
|
|
1730
|
-
onClear: () =>
|
|
1736
|
+
/* @__PURE__ */ A(R, { children: V && /* @__PURE__ */ A(pt, {
|
|
1737
|
+
date: V,
|
|
1738
|
+
onEdit: () => H(!0),
|
|
1739
|
+
onClear: () => Ie(null)
|
|
1731
1740
|
}, "schedule") }),
|
|
1732
|
-
/* @__PURE__ */
|
|
1733
|
-
attachments:
|
|
1734
|
-
onRemoveAttachment:
|
|
1741
|
+
/* @__PURE__ */ A(R, { children: W.length > 0 && /* @__PURE__ */ A(Ve, {
|
|
1742
|
+
attachments: W,
|
|
1743
|
+
onRemoveAttachment: mt
|
|
1735
1744
|
}, "attachments") }),
|
|
1736
|
-
J.toolbarPosition === "top" && X && /* @__PURE__ */
|
|
1737
|
-
className: a("grid transition-[grid-template-rows,opacity] duration-moderate-01 ease-productive-standard",
|
|
1738
|
-
children: /* @__PURE__ */
|
|
1745
|
+
J.toolbarPosition === "top" && X && /* @__PURE__ */ A("div", {
|
|
1746
|
+
className: a("grid transition-[grid-template-rows,opacity] duration-moderate-01 ease-productive-standard", L ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0 pointer-events-none"),
|
|
1747
|
+
children: /* @__PURE__ */ A("div", {
|
|
1739
1748
|
className: "overflow-hidden",
|
|
1740
|
-
children: /* @__PURE__ */
|
|
1749
|
+
children: /* @__PURE__ */ A(it, {
|
|
1741
1750
|
editor: X,
|
|
1742
|
-
toolbar:
|
|
1751
|
+
toolbar: ue,
|
|
1743
1752
|
isMobile: !1,
|
|
1744
1753
|
hasMentions: !!(v || y),
|
|
1745
1754
|
hasSlashCommands: !!D,
|
|
@@ -1747,59 +1756,59 @@ var xt = O.forwardRef(function({ onSubmit: o, placeholder: u = "Type a message..
|
|
|
1747
1756
|
})
|
|
1748
1757
|
})
|
|
1749
1758
|
}),
|
|
1750
|
-
/* @__PURE__ */
|
|
1759
|
+
/* @__PURE__ */ j("div", {
|
|
1751
1760
|
className: "relative",
|
|
1752
|
-
children: [
|
|
1761
|
+
children: [F === "recording" && /* @__PURE__ */ A(ot, {
|
|
1753
1762
|
duration: Y.duration,
|
|
1754
1763
|
analyserNode: Y.analyserNode,
|
|
1755
|
-
maxDuration:
|
|
1764
|
+
maxDuration: te,
|
|
1756
1765
|
onCancel: lt
|
|
1757
|
-
}), /* @__PURE__ */
|
|
1766
|
+
}), /* @__PURE__ */ j("div", {
|
|
1758
1767
|
ref: Ye,
|
|
1759
|
-
className: a("flex items-center px-ds-04 py-ds-03 cursor-text [&_.tiptap]:w-full [&_.tiptap]:outline-hidden",
|
|
1768
|
+
className: a("flex items-center px-ds-04 py-ds-03 cursor-text [&_.tiptap]:w-full [&_.tiptap]:outline-hidden", F === "recording" && "invisible"),
|
|
1760
1769
|
style: {
|
|
1761
1770
|
minHeight: J.minHeight,
|
|
1762
1771
|
maxHeight: rt,
|
|
1763
1772
|
overflowY: "auto"
|
|
1764
1773
|
},
|
|
1765
1774
|
onClick: () => X?.commands.focus(),
|
|
1766
|
-
children: [/* @__PURE__ */
|
|
1775
|
+
children: [/* @__PURE__ */ A("div", {
|
|
1767
1776
|
className: "flex-1 min-w-0",
|
|
1768
|
-
children: /* @__PURE__ */
|
|
1769
|
-
}), X &&
|
|
1777
|
+
children: /* @__PURE__ */ A(Ae, { editor: X })
|
|
1778
|
+
}), X && F !== "recording" && /* @__PURE__ */ j("div", {
|
|
1770
1779
|
className: "flex items-center gap-ds-01 shrink-0 ml-ds-03",
|
|
1771
|
-
children: [/* @__PURE__ */
|
|
1780
|
+
children: [/* @__PURE__ */ A("button", {
|
|
1772
1781
|
type: "button",
|
|
1773
|
-
onClick: () =>
|
|
1774
|
-
title:
|
|
1775
|
-
"aria-label":
|
|
1776
|
-
"aria-pressed":
|
|
1777
|
-
className: a("inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-control touch-target", "transition-colors duration-fast-01 ease-productive-standard", "hover:bg-surface-raised-hover",
|
|
1778
|
-
children: /* @__PURE__ */
|
|
1779
|
-
icon:
|
|
1782
|
+
onClick: () => we((e) => !e),
|
|
1783
|
+
title: L ? "Hide formatting" : "Show formatting",
|
|
1784
|
+
"aria-label": L ? "Hide formatting" : "Show formatting",
|
|
1785
|
+
"aria-pressed": L,
|
|
1786
|
+
className: a("inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-control touch-target", "transition-colors duration-fast-01 ease-productive-standard", "hover:bg-surface-raised-hover", L ? "bg-surface-raised-hover text-accent-11" : "text-surface-fg-subtle"),
|
|
1787
|
+
children: /* @__PURE__ */ A(s, {
|
|
1788
|
+
icon: Se,
|
|
1780
1789
|
size: "xs"
|
|
1781
1790
|
})
|
|
1782
|
-
}), /* @__PURE__ */
|
|
1791
|
+
}), /* @__PURE__ */ j("div", {
|
|
1783
1792
|
className: "relative",
|
|
1784
|
-
children: [/* @__PURE__ */
|
|
1785
|
-
ref:
|
|
1793
|
+
children: [/* @__PURE__ */ A("button", {
|
|
1794
|
+
ref: Ue,
|
|
1786
1795
|
type: "button",
|
|
1787
|
-
onClick: () =>
|
|
1796
|
+
onClick: () => Fe((e) => !e),
|
|
1788
1797
|
title: "Emoji",
|
|
1789
1798
|
"aria-label": "Emoji",
|
|
1790
|
-
className: a("inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-control touch-target transition-colors duration-fast-01",
|
|
1791
|
-
children: /* @__PURE__ */
|
|
1792
|
-
icon:
|
|
1799
|
+
className: a("inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-control touch-target transition-colors duration-fast-01", Ne ? "bg-surface-raised-hover text-accent-11" : "text-surface-fg-subtle hover:bg-surface-raised-hover hover:text-surface-fg"),
|
|
1800
|
+
children: /* @__PURE__ */ A(s, {
|
|
1801
|
+
icon: me,
|
|
1793
1802
|
size: "xs"
|
|
1794
1803
|
})
|
|
1795
|
-
}),
|
|
1796
|
-
ref:
|
|
1804
|
+
}), Ne && ne.createPortal(/* @__PURE__ */ A("div", {
|
|
1805
|
+
ref: Ge,
|
|
1797
1806
|
className: "absolute z-popover",
|
|
1798
1807
|
style: {
|
|
1799
1808
|
top: 0,
|
|
1800
1809
|
left: 0
|
|
1801
1810
|
},
|
|
1802
|
-
children: /* @__PURE__ */
|
|
1811
|
+
children: /* @__PURE__ */ A(bt, {
|
|
1803
1812
|
onSelect: ({ id: e, native: t }) => {
|
|
1804
1813
|
X.chain().focus().insertContent({
|
|
1805
1814
|
type: "emojiNode",
|
|
@@ -1807,43 +1816,43 @@ var xt = O.forwardRef(function({ onSubmit: o, placeholder: u = "Type a message..
|
|
|
1807
1816
|
id: e,
|
|
1808
1817
|
native: t
|
|
1809
1818
|
}
|
|
1810
|
-
}).run(),
|
|
1819
|
+
}).run(), Fe(!1);
|
|
1811
1820
|
},
|
|
1812
|
-
onClose: () =>
|
|
1821
|
+
onClose: () => Fe(!1)
|
|
1813
1822
|
})
|
|
1814
1823
|
}), document.body)]
|
|
1815
1824
|
})]
|
|
1816
1825
|
})]
|
|
1817
1826
|
})]
|
|
1818
1827
|
}),
|
|
1819
|
-
|
|
1828
|
+
F === "review" && K && /* @__PURE__ */ j("div", {
|
|
1820
1829
|
className: "flex items-center gap-ds-03 px-ds-04 py-ds-02b border-b border-surface-border",
|
|
1821
|
-
children: [/* @__PURE__ */
|
|
1822
|
-
src:
|
|
1823
|
-
duration:
|
|
1824
|
-
waveformData:
|
|
1830
|
+
children: [/* @__PURE__ */ A(We, {
|
|
1831
|
+
src: K.blob,
|
|
1832
|
+
duration: K.duration,
|
|
1833
|
+
waveformData: K.waveformData,
|
|
1825
1834
|
className: "flex-1"
|
|
1826
|
-
}), /* @__PURE__ */
|
|
1835
|
+
}), /* @__PURE__ */ A(l, {
|
|
1827
1836
|
variant: "ghost",
|
|
1828
1837
|
size: "icon-sm",
|
|
1829
1838
|
onClick: St,
|
|
1830
1839
|
"aria-label": "Discard voice note",
|
|
1831
1840
|
title: "Discard voice note",
|
|
1832
1841
|
className: "text-surface-fg-subtle hover:text-error-11",
|
|
1833
|
-
children: /* @__PURE__ */
|
|
1834
|
-
icon:
|
|
1842
|
+
children: /* @__PURE__ */ A(s, {
|
|
1843
|
+
icon: Ce,
|
|
1835
1844
|
size: "sm"
|
|
1836
1845
|
})
|
|
1837
1846
|
})]
|
|
1838
1847
|
}),
|
|
1839
|
-
nt && X && !Ct && /* @__PURE__ */
|
|
1840
|
-
J.toolbarPosition === "bottom" && X && /* @__PURE__ */
|
|
1848
|
+
nt && X && !Ct && /* @__PURE__ */ A(xt, { editor: X }),
|
|
1849
|
+
J.toolbarPosition === "bottom" && X && /* @__PURE__ */ A("div", {
|
|
1841
1850
|
className: a("grid transition-[grid-template-rows,opacity] duration-moderate-01 ease-productive-standard", Tt ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0 pointer-events-none"),
|
|
1842
|
-
children: /* @__PURE__ */
|
|
1851
|
+
children: /* @__PURE__ */ A("div", {
|
|
1843
1852
|
className: "overflow-hidden",
|
|
1844
|
-
children: /* @__PURE__ */
|
|
1853
|
+
children: /* @__PURE__ */ A(it, {
|
|
1845
1854
|
editor: X,
|
|
1846
|
-
toolbar:
|
|
1855
|
+
toolbar: ue,
|
|
1847
1856
|
isMobile: nt,
|
|
1848
1857
|
hasMentions: !!(v || y),
|
|
1849
1858
|
hasSlashCommands: !!D,
|
|
@@ -1852,33 +1861,33 @@ var xt = O.forwardRef(function({ onSubmit: o, placeholder: u = "Type a message..
|
|
|
1852
1861
|
})
|
|
1853
1862
|
}),
|
|
1854
1863
|
g && _ !== "hidden" && (() => {
|
|
1855
|
-
let e =
|
|
1856
|
-
return _ === "always" || _ === "focus" &&
|
|
1864
|
+
let e = U / g;
|
|
1865
|
+
return _ === "always" || _ === "focus" && Re || (_ === "near-limit" || !_) && e >= .8 || e >= 1 ? /* @__PURE__ */ j("div", {
|
|
1857
1866
|
className: a("flex justify-end px-ds-04 pb-ds-02 text-body-xs tabular-nums transition-opacity duration-fast-01", e >= 1 ? "text-error-11 font-medium" : e >= .9 ? "text-warning-11" : "text-surface-fg-subtle"),
|
|
1858
1867
|
children: [
|
|
1859
|
-
|
|
1868
|
+
U,
|
|
1860
1869
|
"/",
|
|
1861
1870
|
g
|
|
1862
1871
|
]
|
|
1863
1872
|
}) : null;
|
|
1864
1873
|
})(),
|
|
1865
|
-
|
|
1866
|
-
/* @__PURE__ */
|
|
1874
|
+
ce,
|
|
1875
|
+
/* @__PURE__ */ A("input", {
|
|
1867
1876
|
ref: Je,
|
|
1868
1877
|
type: "file",
|
|
1869
1878
|
multiple: !0,
|
|
1870
1879
|
className: "hidden",
|
|
1871
|
-
onChange:
|
|
1880
|
+
onChange: Q
|
|
1872
1881
|
})
|
|
1873
1882
|
]
|
|
1874
1883
|
}),
|
|
1875
|
-
/* @__PURE__ */
|
|
1884
|
+
/* @__PURE__ */ j("div", {
|
|
1876
1885
|
className: "flex items-center gap-ds-02 shrink-0",
|
|
1877
|
-
children: [
|
|
1886
|
+
children: [de && de.length > 0 && F !== "recording" && /* @__PURE__ */ A(vt, { options: de }), /* @__PURE__ */ j(R, {
|
|
1878
1887
|
mode: "popLayout",
|
|
1879
1888
|
initial: !1,
|
|
1880
1889
|
children: [
|
|
1881
|
-
|
|
1890
|
+
F === "recording" && /* @__PURE__ */ j(z.div, {
|
|
1882
1891
|
initial: {
|
|
1883
1892
|
scale: .8,
|
|
1884
1893
|
opacity: 0
|
|
@@ -1893,31 +1902,31 @@ var xt = O.forwardRef(function({ onSubmit: o, placeholder: u = "Type a message..
|
|
|
1893
1902
|
},
|
|
1894
1903
|
transition: { duration: i.moderate01 },
|
|
1895
1904
|
className: "flex items-center gap-ds-02",
|
|
1896
|
-
children: [/* @__PURE__ */
|
|
1905
|
+
children: [/* @__PURE__ */ A(l, {
|
|
1897
1906
|
variant: "soft",
|
|
1898
1907
|
size: $,
|
|
1899
1908
|
onClick: lt,
|
|
1900
1909
|
"aria-label": "Cancel recording",
|
|
1901
1910
|
title: "Cancel recording",
|
|
1902
1911
|
className: "text-surface-fg-subtle hover:text-error-11",
|
|
1903
|
-
children: /* @__PURE__ */
|
|
1904
|
-
icon:
|
|
1912
|
+
children: /* @__PURE__ */ A(s, {
|
|
1913
|
+
icon: Ce,
|
|
1905
1914
|
size: "md"
|
|
1906
1915
|
})
|
|
1907
|
-
}), /* @__PURE__ */
|
|
1916
|
+
}), /* @__PURE__ */ A(l, {
|
|
1908
1917
|
variant: "solid",
|
|
1909
1918
|
size: $,
|
|
1910
1919
|
color: "error",
|
|
1911
1920
|
onClick: ct,
|
|
1912
1921
|
"aria-label": "Stop recording",
|
|
1913
1922
|
title: "Stop recording",
|
|
1914
|
-
children: /* @__PURE__ */
|
|
1915
|
-
icon:
|
|
1923
|
+
children: /* @__PURE__ */ A(s, {
|
|
1924
|
+
icon: xe,
|
|
1916
1925
|
size: "md"
|
|
1917
1926
|
})
|
|
1918
1927
|
})]
|
|
1919
1928
|
}, "recording"),
|
|
1920
|
-
|
|
1929
|
+
N && F !== "recording" && /* @__PURE__ */ A(z.div, {
|
|
1921
1930
|
initial: {
|
|
1922
1931
|
scale: .8,
|
|
1923
1932
|
opacity: 0
|
|
@@ -1931,20 +1940,20 @@ var xt = O.forwardRef(function({ onSubmit: o, placeholder: u = "Type a message..
|
|
|
1931
1940
|
opacity: 0
|
|
1932
1941
|
},
|
|
1933
1942
|
transition: { duration: i.moderate01 },
|
|
1934
|
-
children: /* @__PURE__ */
|
|
1943
|
+
children: /* @__PURE__ */ A(l, {
|
|
1935
1944
|
variant: "solid",
|
|
1936
1945
|
size: $,
|
|
1937
1946
|
color: "error",
|
|
1938
|
-
onClick:
|
|
1947
|
+
onClick: ae,
|
|
1939
1948
|
"aria-label": "Stop",
|
|
1940
1949
|
title: "Stop",
|
|
1941
|
-
children: /* @__PURE__ */
|
|
1942
|
-
icon:
|
|
1950
|
+
children: /* @__PURE__ */ A(s, {
|
|
1951
|
+
icon: xe,
|
|
1943
1952
|
size: "md"
|
|
1944
1953
|
})
|
|
1945
1954
|
})
|
|
1946
1955
|
}, "streaming"),
|
|
1947
|
-
!
|
|
1956
|
+
!N && F !== "recording" && wt && P && /* @__PURE__ */ A(z.div, {
|
|
1948
1957
|
initial: {
|
|
1949
1958
|
scale: .8,
|
|
1950
1959
|
opacity: 0
|
|
@@ -1958,23 +1967,23 @@ var xt = O.forwardRef(function({ onSubmit: o, placeholder: u = "Type a message..
|
|
|
1958
1967
|
opacity: 0
|
|
1959
1968
|
},
|
|
1960
1969
|
transition: { duration: i.moderate01 },
|
|
1961
|
-
children: /* @__PURE__ */
|
|
1962
|
-
onClick:
|
|
1970
|
+
children: /* @__PURE__ */ A(h, {
|
|
1971
|
+
onClick: ut,
|
|
1963
1972
|
disabled: d,
|
|
1964
|
-
"aria-label":
|
|
1973
|
+
"aria-label": V ? "Schedule send" : "Send",
|
|
1965
1974
|
size: $,
|
|
1966
|
-
dropdownContent: /* @__PURE__ */
|
|
1967
|
-
onSchedule: (e) =>
|
|
1975
|
+
dropdownContent: /* @__PURE__ */ A(dt, {
|
|
1976
|
+
onSchedule: (e) => Ie(e),
|
|
1968
1977
|
onClose: () => {},
|
|
1969
|
-
onOpenDialog: () =>
|
|
1978
|
+
onOpenDialog: () => H(!0)
|
|
1970
1979
|
}),
|
|
1971
|
-
children: /* @__PURE__ */
|
|
1972
|
-
icon:
|
|
1980
|
+
children: /* @__PURE__ */ A(s, {
|
|
1981
|
+
icon: V ? oe : ye,
|
|
1973
1982
|
size: "md"
|
|
1974
1983
|
})
|
|
1975
1984
|
})
|
|
1976
1985
|
}, "split-send"),
|
|
1977
|
-
!
|
|
1986
|
+
!N && F !== "recording" && wt && !P && /* @__PURE__ */ A(z.div, {
|
|
1978
1987
|
initial: {
|
|
1979
1988
|
scale: .8,
|
|
1980
1989
|
opacity: 0
|
|
@@ -1988,20 +1997,20 @@ var xt = O.forwardRef(function({ onSubmit: o, placeholder: u = "Type a message..
|
|
|
1988
1997
|
opacity: 0
|
|
1989
1998
|
},
|
|
1990
1999
|
transition: { duration: i.moderate01 },
|
|
1991
|
-
children: /* @__PURE__ */
|
|
2000
|
+
children: /* @__PURE__ */ A(l, {
|
|
1992
2001
|
variant: "solid",
|
|
1993
2002
|
size: $,
|
|
1994
|
-
onClick:
|
|
2003
|
+
onClick: ut,
|
|
1995
2004
|
disabled: d,
|
|
1996
2005
|
"aria-label": "Send",
|
|
1997
2006
|
title: "Send",
|
|
1998
|
-
children: /* @__PURE__ */
|
|
1999
|
-
icon:
|
|
2007
|
+
children: /* @__PURE__ */ A(s, {
|
|
2008
|
+
icon: ye,
|
|
2000
2009
|
size: "md"
|
|
2001
2010
|
})
|
|
2002
2011
|
})
|
|
2003
2012
|
}, "send"),
|
|
2004
|
-
!
|
|
2013
|
+
!N && F !== "recording" && !wt && O && /* @__PURE__ */ A(z.div, {
|
|
2005
2014
|
initial: {
|
|
2006
2015
|
scale: .8,
|
|
2007
2016
|
opacity: 0
|
|
@@ -2015,19 +2024,19 @@ var xt = O.forwardRef(function({ onSubmit: o, placeholder: u = "Type a message..
|
|
|
2015
2024
|
opacity: 0
|
|
2016
2025
|
},
|
|
2017
2026
|
transition: { duration: i.moderate01 },
|
|
2018
|
-
children: /* @__PURE__ */
|
|
2027
|
+
children: /* @__PURE__ */ A(l, {
|
|
2019
2028
|
variant: "soft",
|
|
2020
2029
|
size: $,
|
|
2021
|
-
onClick:
|
|
2030
|
+
onClick: at,
|
|
2022
2031
|
"aria-label": "Record voice message",
|
|
2023
2032
|
title: "Record voice message",
|
|
2024
|
-
children: /* @__PURE__ */
|
|
2025
|
-
icon:
|
|
2033
|
+
children: /* @__PURE__ */ A(s, {
|
|
2034
|
+
icon: pe,
|
|
2026
2035
|
size: "md"
|
|
2027
2036
|
})
|
|
2028
2037
|
})
|
|
2029
2038
|
}, "mic"),
|
|
2030
|
-
!
|
|
2039
|
+
!N && F !== "recording" && !wt && !O && /* @__PURE__ */ A(z.div, {
|
|
2031
2040
|
initial: {
|
|
2032
2041
|
scale: .8,
|
|
2033
2042
|
opacity: 0
|
|
@@ -2041,14 +2050,14 @@ var xt = O.forwardRef(function({ onSubmit: o, placeholder: u = "Type a message..
|
|
|
2041
2050
|
opacity: 0
|
|
2042
2051
|
},
|
|
2043
2052
|
transition: { duration: i.moderate01 },
|
|
2044
|
-
children: /* @__PURE__ */
|
|
2053
|
+
children: /* @__PURE__ */ A(l, {
|
|
2045
2054
|
variant: "solid",
|
|
2046
2055
|
size: $,
|
|
2047
2056
|
disabled: !0,
|
|
2048
2057
|
"aria-label": "Send",
|
|
2049
2058
|
title: "Send",
|
|
2050
|
-
children: /* @__PURE__ */
|
|
2051
|
-
icon:
|
|
2059
|
+
children: /* @__PURE__ */ A(s, {
|
|
2060
|
+
icon: ye,
|
|
2052
2061
|
size: "md"
|
|
2053
2062
|
})
|
|
2054
2063
|
})
|
|
@@ -2056,19 +2065,19 @@ var xt = O.forwardRef(function({ onSubmit: o, placeholder: u = "Type a message..
|
|
|
2056
2065
|
]
|
|
2057
2066
|
})]
|
|
2058
2067
|
}),
|
|
2059
|
-
|
|
2068
|
+
le && /* @__PURE__ */ A("p", {
|
|
2060
2069
|
className: "mt-ds-02 text-center text-caption text-surface-fg-subtle/50",
|
|
2061
|
-
children:
|
|
2070
|
+
children: le
|
|
2062
2071
|
}),
|
|
2063
|
-
|
|
2064
|
-
open:
|
|
2065
|
-
onOpenChange:
|
|
2066
|
-
onSchedule: (e) =>
|
|
2067
|
-
initialDate:
|
|
2072
|
+
P && /* @__PURE__ */ A(ft, {
|
|
2073
|
+
open: Le,
|
|
2074
|
+
onOpenChange: H,
|
|
2075
|
+
onSchedule: (e) => Ie(e),
|
|
2076
|
+
initialDate: V
|
|
2068
2077
|
})
|
|
2069
2078
|
]
|
|
2070
2079
|
});
|
|
2071
2080
|
});
|
|
2072
|
-
|
|
2081
|
+
St.displayName = "RichChatInput";
|
|
2073
2082
|
//#endregion
|
|
2074
|
-
export {
|
|
2083
|
+
export { We as AudioPlayer, U as AudioWaveform, et as BlockquoteButton, Ke as BoldButton, Qe as BulletListButton, Ze as CodeButton, J as EmojiButton, Xe as HighlightButton, qe as ItalicButton, tt as LinkButton, nt as MentionButton, $e as OrderedListButton, St as RichChatInput, rt as SlashCommandButton, Ye as StrikeButton, G as ToolbarButton, K as ToolbarDivider, q as ToolbarGroup, Je as UnderlineButton, ht as useVoiceRecorder };
|