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