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