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