@epam/ai-dial-attachment-input 1.1.0-dev.9 → 1.1.0-dev.91
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/components/AttachmentCard/AttachmentCard.d.ts.map +1 -1
- package/components/AttachmentCard/Attachments/Actions.d.ts +1 -1
- package/components/AttachmentCard/Attachments/Actions.d.ts.map +1 -1
- package/components/AttachmentCard/Attachments/Audio.d.ts +8 -2
- package/components/AttachmentCard/Attachments/Audio.d.ts.map +1 -1
- package/components/AttachmentCard/Attachments/File.d.ts +1 -8
- package/components/AttachmentCard/Attachments/File.d.ts.map +1 -1
- package/components/AttachmentCard/Attachments/Image.d.ts +2 -0
- package/components/AttachmentCard/Attachments/Image.d.ts.map +1 -1
- package/components/AttachmentGroup/AttachmentGroup.d.ts +1 -8
- package/components/AttachmentGroup/AttachmentGroup.d.ts.map +1 -1
- package/constants/attachment-group.d.ts +1 -3
- package/constants/attachment-group.d.ts.map +1 -1
- package/index.css +1 -1
- package/index.d.ts +3 -5
- package/index.d.ts.map +1 -1
- package/index.js +340 -375
- package/models/attachment-card.d.ts +8 -2
- package/models/attachment-card.d.ts.map +1 -1
- package/models/attachment-file-row.d.ts +2 -0
- package/models/attachment-file-row.d.ts.map +1 -1
- package/models/attachment-group.d.ts +2 -24
- package/models/attachment-group.d.ts.map +1 -1
- package/package.json +4 -4
- package/utils/attachment.d.ts +4 -27
- package/utils/attachment.d.ts.map +1 -1
- package/components/AttachmentMoreTile/AttachmentMoreTile.d.ts +0 -9
- package/components/AttachmentMoreTile/AttachmentMoreTile.d.ts.map +0 -1
- package/models/attachment-more-tile.d.ts +0 -54
- package/models/attachment-more-tile.d.ts.map +0 -1
package/index.js
CHANGED
|
@@ -1,286 +1,290 @@
|
|
|
1
|
-
import { AttachmentErrorReason as e, AttachmentType as t,
|
|
2
|
-
import { useCallback as
|
|
3
|
-
import {
|
|
4
|
-
import { DIAL_ICON_SIZE as
|
|
5
|
-
import { Fragment as
|
|
6
|
-
//#region src/
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
}({}), pe = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, me = (e) => {
|
|
1
|
+
import { AttachmentErrorReason as e, AttachmentType as t, MIME_TYPE_EXT_MAP as n, RequestStatus as r, buildCssVars as i, mergeClasses as a } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
import { useCallback as o, useEffect as s, useId as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
3
|
+
import { IconClipboard as f, IconDownload as p, IconExternalLink as m, IconFile as h, IconFileDescription as g, IconFileTypeBmp as _, IconFileTypeCss as v, IconFileTypeCsv as y, IconFileTypeDoc as b, IconFileTypeDocx as x, IconFileTypeHtml as S, IconFileTypeJpg as C, IconFileTypeJs as w, IconFileTypeJsx as T, IconFileTypePdf as E, IconFileTypePhp as D, IconFileTypePng as O, IconFileTypePpt as k, IconFileTypeRs as A, IconFileTypeSql as j, IconFileTypeSvg as M, IconFileTypeTs as N, IconFileTypeTsx as P, IconFileTypeTxt as F, IconFileTypeVue as I, IconFileTypeXls as L, IconFileTypeXml as R, IconFileTypeZip as z, IconFileX as B, IconMusic as ee, IconPaperclip as V, IconPhoto as H, IconReload as te, IconTerminal2 as U, IconVideo as W, IconX as ne } from "@tabler/icons-react";
|
|
4
|
+
import { DIAL_ICON_SIZE as G, DialSkeleton as re, DialSkeletonVariant as ie, DialSpinner as ae, ElementSize as oe, GhostIconButton as se, Highlight as ce } from "@epam/ai-dial-ui-kit";
|
|
5
|
+
import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
|
|
6
|
+
//#region src/utils/attachment.ts
|
|
7
|
+
var Y = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, le = (e) => {
|
|
8
|
+
if (e == null) return "";
|
|
10
9
|
let t = e.lastIndexOf(".");
|
|
11
10
|
return t > 0 ? e.slice(0, t) : e;
|
|
12
|
-
},
|
|
11
|
+
}, ue = {
|
|
13
12
|
image: "Image files",
|
|
14
13
|
audio: "Audio files",
|
|
15
14
|
video: "Video files",
|
|
16
15
|
text: "Text files"
|
|
17
|
-
},
|
|
16
|
+
}, de = (e, t = ue) => e.map((e) => {
|
|
18
17
|
if (e.endsWith("/*")) {
|
|
19
18
|
let n = e.slice(0, -2);
|
|
20
19
|
return t[n] ?? `${n} files`;
|
|
21
20
|
}
|
|
22
21
|
let n = e.split("/")[1];
|
|
23
22
|
return n == null ? e.toUpperCase() : n.toUpperCase();
|
|
24
|
-
}).join(", "),
|
|
23
|
+
}).join(", "), fe = (e, t) => t.length === 0 ? !1 : t.some((t) => {
|
|
25
24
|
if (t === "*" || t === "*/*") return !0;
|
|
26
25
|
if (t.endsWith("/*")) {
|
|
27
26
|
let n = t.slice(0, -2);
|
|
28
27
|
return e.startsWith(`${n}/`);
|
|
29
28
|
}
|
|
30
29
|
return e === t;
|
|
31
|
-
}),
|
|
32
|
-
if (!e) return
|
|
30
|
+
}), pe = (e) => {
|
|
31
|
+
if (!e) return h;
|
|
33
32
|
if (e.startsWith("image/")) switch (e) {
|
|
34
33
|
case "image/jpeg":
|
|
35
|
-
case "image/jpg": return
|
|
36
|
-
case "image/png": return
|
|
37
|
-
case "image/svg+xml": return
|
|
38
|
-
case "image/bmp": return
|
|
39
|
-
default: return
|
|
34
|
+
case "image/jpg": return C;
|
|
35
|
+
case "image/png": return O;
|
|
36
|
+
case "image/svg+xml": return M;
|
|
37
|
+
case "image/bmp": return _;
|
|
38
|
+
default: return H;
|
|
40
39
|
}
|
|
41
|
-
if (e.startsWith("video/")) return
|
|
42
|
-
if (e.startsWith("audio/")) return
|
|
40
|
+
if (e.startsWith("video/")) return W;
|
|
41
|
+
if (e.startsWith("audio/")) return ee;
|
|
43
42
|
switch (e) {
|
|
44
|
-
case "application/pdf": return
|
|
43
|
+
case "application/pdf": return E;
|
|
45
44
|
case "application/msword":
|
|
46
|
-
case "application/vnd.ms-word": return
|
|
47
|
-
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return
|
|
48
|
-
case "application/vnd.ms-powerpoint": return
|
|
49
|
-
case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return
|
|
50
|
-
case "application/vnd.ms-excel": return
|
|
51
|
-
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return
|
|
45
|
+
case "application/vnd.ms-word": return b;
|
|
46
|
+
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return x;
|
|
47
|
+
case "application/vnd.ms-powerpoint": return k;
|
|
48
|
+
case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return k;
|
|
49
|
+
case "application/vnd.ms-excel": return L;
|
|
50
|
+
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return L;
|
|
52
51
|
case "application/zip":
|
|
53
52
|
case "application/x-zip-compressed":
|
|
54
53
|
case "application/x-rar-compressed":
|
|
55
54
|
case "application/x-7z-compressed":
|
|
56
55
|
case "application/gzip":
|
|
57
|
-
case "application/x-tar": return
|
|
58
|
-
case "text/csv": return
|
|
59
|
-
case "text/plain": return
|
|
56
|
+
case "application/x-tar": return z;
|
|
57
|
+
case "text/csv": return y;
|
|
58
|
+
case "text/plain": return F;
|
|
60
59
|
case "text/html":
|
|
61
|
-
case "application/xhtml+xml": return
|
|
60
|
+
case "application/xhtml+xml": return S;
|
|
62
61
|
case "text/xml":
|
|
63
|
-
case "application/xml": return
|
|
62
|
+
case "application/xml": return R;
|
|
64
63
|
case "application/sql":
|
|
65
|
-
case "text/x-sql": return
|
|
64
|
+
case "text/x-sql": return j;
|
|
66
65
|
case "text/javascript":
|
|
67
|
-
case "application/javascript": return
|
|
68
|
-
case "text/jsx": return
|
|
66
|
+
case "application/javascript": return w;
|
|
67
|
+
case "text/jsx": return T;
|
|
69
68
|
case "application/typescript":
|
|
70
|
-
case "text/typescript": return
|
|
71
|
-
case "text/tsx": return
|
|
72
|
-
case "text/css": return
|
|
69
|
+
case "text/typescript": return N;
|
|
70
|
+
case "text/tsx": return P;
|
|
71
|
+
case "text/css": return v;
|
|
73
72
|
case "text/x-php":
|
|
74
|
-
case "application/x-php": return
|
|
73
|
+
case "application/x-php": return D;
|
|
75
74
|
case "text/x-rustsrc":
|
|
76
|
-
case "application/x-rust": return
|
|
77
|
-
case "text/x-vue": return
|
|
78
|
-
default: return
|
|
75
|
+
case "application/x-rust": return A;
|
|
76
|
+
case "text/x-vue": return I;
|
|
77
|
+
default: return h;
|
|
79
78
|
}
|
|
80
|
-
},
|
|
79
|
+
}, me = (e) => {
|
|
81
80
|
let { type: n, contentType: r } = e;
|
|
82
|
-
return n === t.Prompt ?
|
|
83
|
-
},
|
|
84
|
-
let t = e.toLowerCase().split(";")[0].trim(),
|
|
85
|
-
if (
|
|
81
|
+
return n === t.Prompt ? U : n === t.Pasted ? f : n === t.Image ? H : pe(r ?? "");
|
|
82
|
+
}, he = (e) => {
|
|
83
|
+
let t = e.toLowerCase().split(";")[0].trim(), r = n[t];
|
|
84
|
+
if (r) return r;
|
|
86
85
|
let i = t.split("/")[1];
|
|
87
86
|
if (i && !i.startsWith("vnd.") && !i.includes("+")) return i;
|
|
88
|
-
},
|
|
87
|
+
}, ge = (e, n) => {
|
|
89
88
|
let { type: r, name: i, contentType: a } = e;
|
|
90
89
|
if (r === t.Prompt) return n.promptLabel ?? "Prompt";
|
|
91
90
|
if (r === t.Pasted) return n.pastedLabel ?? "Pasted";
|
|
92
91
|
if (r === t.Image) return n.imageLabel ?? "Image";
|
|
93
92
|
if (a) {
|
|
94
|
-
let e =
|
|
93
|
+
let e = he(a);
|
|
95
94
|
if (e) return `.${e}`;
|
|
96
95
|
}
|
|
97
96
|
let o = i.lastIndexOf(".");
|
|
98
97
|
return o > 0 && o < i.length - 1 ? `.${i.slice(o + 1).toLowerCase()}` : i;
|
|
99
|
-
},
|
|
100
|
-
let { type:
|
|
98
|
+
}, X = (e, n = {}) => {
|
|
99
|
+
let { type: i, status: a, previewUrl: o, url: s } = e, c = a === r.Loading, l = a === r.Error, u = i === t.Image && !!(o ?? s) && !l, d = i === t.Audio && !l, f = i === t.Link && !l;
|
|
101
100
|
return {
|
|
102
101
|
isLoading: c,
|
|
103
102
|
isError: l,
|
|
104
103
|
isImage: u,
|
|
105
104
|
isAudio: d,
|
|
106
105
|
isLink: f,
|
|
107
|
-
BottomIcon: f ? null :
|
|
108
|
-
typeLabel: f ? null :
|
|
106
|
+
BottomIcon: f ? null : me(e),
|
|
107
|
+
typeLabel: f ? null : ge(e, n)
|
|
109
108
|
};
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
tile: "
|
|
124
|
-
tileLight: "_tileLight_3x6ks_12",
|
|
125
|
-
tileError: "_tileError_3x6ks_16",
|
|
126
|
-
nameText: "_nameText_3x6ks_23",
|
|
127
|
-
typeText: "_typeText_3x6ks_24",
|
|
128
|
-
retryIcon: "_retryIcon_3x6ks_36",
|
|
129
|
-
hoverIcon: "_hoverIcon_3x6ks_40",
|
|
130
|
-
track: "_track_3x6ks_48",
|
|
131
|
-
indeterminateFill: "_indeterminateFill_3x6ks_52",
|
|
132
|
-
"attachment-tile-indeterminate": "_attachment-tile-indeterminate_3x6ks_1"
|
|
133
|
-
}, Z = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: a, className: s }) => /* @__PURE__ */ K(oe, {
|
|
134
|
-
icon: a,
|
|
135
|
-
size: le.Small,
|
|
136
|
-
className: o("absolute end-1 top-1 h-6 w-6 rounded-lg", s ?? X.hoverIcon),
|
|
109
|
+
}, Z = {
|
|
110
|
+
tile: "_tile_1x4ax_1",
|
|
111
|
+
hovered: "_hovered_1x4ax_5",
|
|
112
|
+
selected: "_selected_1x4ax_12",
|
|
113
|
+
tileError: "_tileError_1x4ax_17",
|
|
114
|
+
nameText: "_nameText_1x4ax_22",
|
|
115
|
+
typeText: "_typeText_1x4ax_26",
|
|
116
|
+
retryIcon: "_retryIcon_1x4ax_30",
|
|
117
|
+
track: "_track_1x4ax_34",
|
|
118
|
+
imageActionButton: "_imageActionButton_1x4ax_38"
|
|
119
|
+
}, Q = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: o, className: s }) => /* @__PURE__ */ q(se, {
|
|
120
|
+
icon: o,
|
|
121
|
+
size: oe.Small,
|
|
122
|
+
className: a("absolute end-1 top-1 opacity-0 focus-visible:opacity-100 group-focus-within/attachment-tile:opacity-100 group-hover/attachment-tile:opacity-100", s),
|
|
137
123
|
"aria-label": e,
|
|
138
124
|
"aria-describedby": t ? n : void 0,
|
|
139
125
|
onClick: (e) => {
|
|
140
126
|
e.stopPropagation(), r(i);
|
|
141
127
|
}
|
|
142
|
-
}),
|
|
143
|
-
icon: /* @__PURE__ */
|
|
144
|
-
size:
|
|
128
|
+
}), _e = ({ ...e }) => /* @__PURE__ */ q(Q, {
|
|
129
|
+
icon: /* @__PURE__ */ q(te, {
|
|
130
|
+
size: G.SM,
|
|
145
131
|
"aria-hidden": !0
|
|
146
132
|
}),
|
|
147
|
-
className:
|
|
133
|
+
className: Z.retryIcon,
|
|
148
134
|
...e
|
|
149
|
-
}),
|
|
150
|
-
icon: /* @__PURE__ */
|
|
151
|
-
size:
|
|
135
|
+
}), ve = ({ ...e }) => /* @__PURE__ */ q(Q, {
|
|
136
|
+
icon: /* @__PURE__ */ q(p, {
|
|
137
|
+
size: G.SM,
|
|
152
138
|
"aria-hidden": !0
|
|
153
139
|
}),
|
|
154
140
|
...e
|
|
155
|
-
}),
|
|
156
|
-
icon: /* @__PURE__ */
|
|
157
|
-
size:
|
|
141
|
+
}), ye = ({ ...e }) => /* @__PURE__ */ q(Q, {
|
|
142
|
+
icon: /* @__PURE__ */ q(m, {
|
|
143
|
+
size: G.SM,
|
|
158
144
|
"aria-hidden": !0
|
|
159
145
|
}),
|
|
160
146
|
...e
|
|
161
|
-
}),
|
|
162
|
-
icon: /* @__PURE__ */
|
|
163
|
-
size:
|
|
147
|
+
}), be = ({ ...e }) => /* @__PURE__ */ q(Q, {
|
|
148
|
+
icon: /* @__PURE__ */ q(ne, {
|
|
149
|
+
size: G.SM,
|
|
164
150
|
"aria-hidden": !0
|
|
165
151
|
}),
|
|
166
|
-
className:
|
|
152
|
+
className: Z.hoverIcon,
|
|
167
153
|
...e
|
|
168
|
-
}),
|
|
169
|
-
let { clickLabel:
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
154
|
+
}), xe = ({ attachment: e, searchQuery: t = "", onClick: n, onDownload: r, onRemove: i, labels: o, styles: s, cssVars: c, isSelected: l }) => {
|
|
155
|
+
let { clickLabel: u = "Open attachment", downloadLabel: d = "Download attachment", removeLabel: f = "Remove attachment" } = o ?? {}, { typography: p, className: m } = s ?? {}, h = () => {
|
|
156
|
+
n?.(e.id);
|
|
157
|
+
};
|
|
158
|
+
return /* @__PURE__ */ J("div", {
|
|
159
|
+
style: c,
|
|
160
|
+
...n == null ? {} : {
|
|
161
|
+
role: "button",
|
|
162
|
+
tabIndex: 0,
|
|
163
|
+
"aria-label": u,
|
|
164
|
+
onClick: h,
|
|
165
|
+
onKeyDown: (e) => {
|
|
166
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), h());
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
className: a("group/attachment-tile relative flex w-full min-w-[280px] max-w-[300px] flex-col gap-2 rounded-xl border p-3", n && "cursor-pointer", (r || i) && "pe-8", l && Z.selected, m),
|
|
170
|
+
children: [
|
|
171
|
+
/* @__PURE__ */ q("span", {
|
|
176
172
|
title: e.name,
|
|
177
|
-
className:
|
|
178
|
-
children: t ? /* @__PURE__ */
|
|
173
|
+
className: a(p?.fontClassName ?? "dial-tiny-text", "min-w-0 truncate", Z.nameText),
|
|
174
|
+
children: t ? /* @__PURE__ */ q(ce, {
|
|
179
175
|
text: e.name,
|
|
180
176
|
query: t,
|
|
181
177
|
maxLines: 1
|
|
182
178
|
}) : e.name
|
|
183
|
-
}),
|
|
184
|
-
|
|
179
|
+
}),
|
|
180
|
+
e.playUrl && /* @__PURE__ */ q("audio", {
|
|
181
|
+
controls: !0,
|
|
182
|
+
src: e.playUrl,
|
|
183
|
+
"aria-label": e.name,
|
|
184
|
+
className: "w-full",
|
|
185
|
+
preload: "metadata",
|
|
186
|
+
onClick: (e) => e.stopPropagation()
|
|
187
|
+
}),
|
|
188
|
+
r && /* @__PURE__ */ q(ve, {
|
|
189
|
+
ariaLabel: d,
|
|
185
190
|
onClick: r,
|
|
186
191
|
id: e.id
|
|
187
|
-
})
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
})]
|
|
192
|
+
}),
|
|
193
|
+
i && /* @__PURE__ */ q(be, {
|
|
194
|
+
ariaLabel: f,
|
|
195
|
+
onClick: i,
|
|
196
|
+
id: e.id
|
|
197
|
+
})
|
|
198
|
+
]
|
|
195
199
|
});
|
|
196
|
-
},
|
|
200
|
+
}, Se = 5, Ce = "flex size-[84px] items-center justify-center rounded-xl border", we = {
|
|
197
201
|
[e.Network]: "Upload failed · network error",
|
|
198
202
|
[e.UnsupportedType]: "Upload failed · unsupported file type"
|
|
199
|
-
},
|
|
200
|
-
let { clickLabel:
|
|
201
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
202
|
-
}, V =
|
|
203
|
-
window.open(
|
|
204
|
-
}, [
|
|
203
|
+
}, Te = ({ attachment: n, onClick: i, onRetry: s, labels: u, styles: d, onDownload: f, isPasted: p, isLink: m, cssVars: h, onExpand: g, isExpandable: _, onRemove: v, isSelected: y }) => {
|
|
204
|
+
let { clickLabel: b = "Download attachment", retryLabel: x = "Retry upload", sizeLabel: S, uploadingLabel: C = "Uploading", errorReasonLabels: w, genericErrorLabel: T = "Upload failed" } = u ?? {}, { typography: E, className: D } = d ?? {}, { id: O, name: k, status: A, errorReason: j } = n, M = A === r.Loading, N = A === r.Error, P = c(), F = N ? j && (w?.[j] ?? we[j]) || T : "", { BottomIcon: I, typeLabel: L } = X(n), R = !N && !M && f && !m, z = N && !!s && j !== e.UnsupportedType, B = R || z ? "pe-5" : void 0, ee = (e) => {
|
|
205
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), i?.(n.id));
|
|
206
|
+
}, V = l(() => p ? k : le(k), [p, k]), H = o(() => {
|
|
207
|
+
window.open(n.referenceUrl, "_blank", "noopener,noreferrer");
|
|
208
|
+
}, [n]), te = a(Ce, "group/attachment-tile relative flex-col justify-between items-start gap-1 overflow-hidden p-1.5", Z.tile, (n.type === t.Prompt || n.type === t.Pasted) && "hovered", y && Z.selected, N && Z.tileError), U = /* @__PURE__ */ q("div", {
|
|
205
209
|
title: V,
|
|
206
|
-
className:
|
|
210
|
+
className: a(E?.nameClassName ?? "dial-caption-text", "line-clamp-2 min-w-0 break-all", Z.nameText, !N && B),
|
|
207
211
|
children: V
|
|
208
|
-
}),
|
|
209
|
-
className:
|
|
210
|
-
children: [/* @__PURE__ */
|
|
212
|
+
}), W = I && /* @__PURE__ */ J("div", {
|
|
213
|
+
className: a("flex w-full items-center gap-1", N && B),
|
|
214
|
+
children: [/* @__PURE__ */ q(I, {
|
|
211
215
|
size: 16,
|
|
212
|
-
className:
|
|
216
|
+
className: Z.typeText,
|
|
213
217
|
"aria-hidden": !0
|
|
214
|
-
}), /* @__PURE__ */
|
|
215
|
-
className:
|
|
216
|
-
children:
|
|
218
|
+
}), /* @__PURE__ */ q("span", {
|
|
219
|
+
className: a(E?.metaClassName ?? "dial-caption-text", "min-w-0 flex-1 truncate", Z.typeText),
|
|
220
|
+
children: S ? `${L} · ${S}` : L
|
|
217
221
|
})]
|
|
218
222
|
}), ne = () => {
|
|
219
|
-
|
|
220
|
-
},
|
|
221
|
-
|
|
222
|
-
|
|
223
|
+
_ && g ? g(O) : i && i(O);
|
|
224
|
+
}, G = /* @__PURE__ */ J(K, { children: [
|
|
225
|
+
N ? /* @__PURE__ */ J(K, { children: [W, U] }) : /* @__PURE__ */ J(K, { children: [U, W] }),
|
|
226
|
+
M && /* @__PURE__ */ q("div", {
|
|
223
227
|
role: "progressbar",
|
|
224
|
-
"aria-label":
|
|
225
|
-
className:
|
|
226
|
-
children: /* @__PURE__ */
|
|
228
|
+
"aria-label": C,
|
|
229
|
+
className: a("absolute inset-x-2 bottom-2 h-[3px] overflow-hidden rounded-full", Z.track),
|
|
230
|
+
children: /* @__PURE__ */ q(ae, { size: 32 })
|
|
227
231
|
}),
|
|
228
|
-
|
|
229
|
-
ariaLabel:
|
|
230
|
-
errorTitle:
|
|
231
|
-
errorDescId:
|
|
232
|
-
onClick:
|
|
233
|
-
id:
|
|
232
|
+
R && /* @__PURE__ */ q(ve, {
|
|
233
|
+
ariaLabel: b,
|
|
234
|
+
errorTitle: F,
|
|
235
|
+
errorDescId: P,
|
|
236
|
+
onClick: f,
|
|
237
|
+
id: O
|
|
234
238
|
}),
|
|
235
|
-
|
|
236
|
-
ariaLabel:
|
|
237
|
-
errorTitle:
|
|
238
|
-
errorDescId:
|
|
239
|
-
onClick:
|
|
240
|
-
id:
|
|
239
|
+
z && /* @__PURE__ */ q(_e, {
|
|
240
|
+
ariaLabel: x,
|
|
241
|
+
errorTitle: F,
|
|
242
|
+
errorDescId: P,
|
|
243
|
+
onClick: s,
|
|
244
|
+
id: O
|
|
241
245
|
}),
|
|
242
|
-
|
|
243
|
-
ariaLabel:
|
|
244
|
-
errorTitle:
|
|
245
|
-
errorDescId:
|
|
246
|
-
onClick:
|
|
246
|
+
m && /* @__PURE__ */ q(ye, {
|
|
247
|
+
ariaLabel: x,
|
|
248
|
+
errorTitle: F,
|
|
249
|
+
errorDescId: P,
|
|
250
|
+
onClick: H
|
|
247
251
|
}),
|
|
248
|
-
|
|
249
|
-
ariaLabel:
|
|
250
|
-
errorTitle:
|
|
251
|
-
errorDescId:
|
|
252
|
-
onClick:
|
|
253
|
-
id:
|
|
252
|
+
v && /* @__PURE__ */ q(be, {
|
|
253
|
+
ariaLabel: x,
|
|
254
|
+
errorTitle: F,
|
|
255
|
+
errorDescId: P,
|
|
256
|
+
onClick: v,
|
|
257
|
+
id: O
|
|
254
258
|
}),
|
|
255
|
-
|
|
256
|
-
id:
|
|
259
|
+
N && /* @__PURE__ */ q("span", {
|
|
260
|
+
id: P,
|
|
257
261
|
role: "status",
|
|
258
262
|
"aria-live": "polite",
|
|
259
263
|
className: "sr-only",
|
|
260
|
-
children:
|
|
264
|
+
children: F
|
|
261
265
|
})
|
|
262
266
|
] });
|
|
263
|
-
return /* @__PURE__ */
|
|
264
|
-
style:
|
|
265
|
-
className:
|
|
266
|
-
children: /* @__PURE__ */
|
|
267
|
+
return /* @__PURE__ */ q("div", {
|
|
268
|
+
style: h,
|
|
269
|
+
className: a("inline-flex", D),
|
|
270
|
+
children: /* @__PURE__ */ q("div", {
|
|
267
271
|
role: "button",
|
|
268
272
|
tabIndex: 0,
|
|
269
|
-
"aria-label":
|
|
273
|
+
"aria-label": b,
|
|
270
274
|
onClick: ne,
|
|
271
|
-
onKeyDown:
|
|
272
|
-
style:
|
|
273
|
-
className:
|
|
274
|
-
children:
|
|
275
|
+
onKeyDown: ee,
|
|
276
|
+
style: h,
|
|
277
|
+
className: a(te, "cursor-pointer focus-within:outline focus-within:outline-1 focus-within:outline-offset-1"),
|
|
278
|
+
children: G
|
|
275
279
|
})
|
|
276
280
|
});
|
|
277
|
-
},
|
|
281
|
+
}, $ = /* @__PURE__ */ function(e) {
|
|
278
282
|
return e.Idle = "idle", e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e;
|
|
279
|
-
}({}),
|
|
280
|
-
let n =
|
|
281
|
-
return
|
|
283
|
+
}({}), Ee = ({ enabled: e, src: t }) => {
|
|
284
|
+
let n = u(null), [r, i] = d("idle");
|
|
285
|
+
return s(() => {
|
|
282
286
|
i(e && t ? "loading" : "idle");
|
|
283
|
-
}, [e, t]),
|
|
287
|
+
}, [e, t]), s(() => {
|
|
284
288
|
let r = n.current;
|
|
285
289
|
if (!r || !e || !t) return;
|
|
286
290
|
let a = () => i("loaded"), o = () => i("error");
|
|
@@ -291,15 +295,15 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
|
|
|
291
295
|
imageRef: n,
|
|
292
296
|
imageLoadStatus: r
|
|
293
297
|
};
|
|
294
|
-
},
|
|
295
|
-
let { clickLabel:
|
|
298
|
+
}, De = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: o, cssVars: s, onDownload: c, styles: u, isSelected: d }) => {
|
|
299
|
+
let { clickLabel: f = "Open attachment", expandLabel: p = "Expand pasted text" } = i ?? {}, { className: m } = u ?? {}, { id: h, name: g } = e, _ = e.previewUrl ?? e.url, v = e.type === t.Pasted && n !== void 0, { isLoading: y, isError: b, isImage: x } = l(() => X(e), [e]), S = r !== void 0 && !v && !y && !b, { imageRef: C, imageLoadStatus: w } = Ee({
|
|
296
300
|
enabled: x,
|
|
297
301
|
src: _
|
|
298
302
|
}), T = () => {
|
|
299
303
|
v && n ? n(h) : S && r && r(h);
|
|
300
304
|
};
|
|
301
|
-
return /* @__PURE__ */
|
|
302
|
-
className:
|
|
305
|
+
return /* @__PURE__ */ q("div", {
|
|
306
|
+
className: a(Ce, "group/attachment-tile", S && "cursor-pointer", Z.tile, d && Z.selected, m),
|
|
303
307
|
onClick: T,
|
|
304
308
|
onKeyDown: (e) => {
|
|
305
309
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), T());
|
|
@@ -307,96 +311,106 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
|
|
|
307
311
|
tabIndex: 0,
|
|
308
312
|
role: "button",
|
|
309
313
|
style: s,
|
|
310
|
-
"aria-label": S ?
|
|
311
|
-
children: /* @__PURE__ */
|
|
314
|
+
"aria-label": S ? f : v ? p : void 0,
|
|
315
|
+
children: /* @__PURE__ */ J("div", {
|
|
312
316
|
className: "relative h-full w-full overflow-hidden",
|
|
313
317
|
children: [
|
|
314
|
-
|
|
315
|
-
onClick:
|
|
316
|
-
id: h
|
|
318
|
+
o && /* @__PURE__ */ q(be, {
|
|
319
|
+
onClick: o,
|
|
320
|
+
id: h,
|
|
321
|
+
className: Z.imageActionButton
|
|
317
322
|
}),
|
|
318
|
-
c && /* @__PURE__ */
|
|
323
|
+
c && /* @__PURE__ */ q(ve, {
|
|
319
324
|
onClick: c,
|
|
320
|
-
id: h
|
|
325
|
+
id: h,
|
|
326
|
+
className: Z.imageActionButton
|
|
321
327
|
}),
|
|
322
|
-
w !==
|
|
323
|
-
variant:
|
|
328
|
+
w !== $.Loaded && /* @__PURE__ */ q(re, {
|
|
329
|
+
variant: ie.Rectangular,
|
|
324
330
|
width: "100%",
|
|
325
331
|
height: "100%",
|
|
326
|
-
active: w ===
|
|
327
|
-
overlay: /* @__PURE__ */
|
|
328
|
-
size:
|
|
329
|
-
className:
|
|
332
|
+
active: w === $.Loading,
|
|
333
|
+
overlay: /* @__PURE__ */ q(H, {
|
|
334
|
+
size: G.LG,
|
|
335
|
+
className: Z.typeText,
|
|
330
336
|
"aria-hidden": !0
|
|
331
337
|
}),
|
|
332
338
|
className: "absolute inset-0 rounded-xl"
|
|
333
339
|
}),
|
|
334
|
-
/* @__PURE__ */
|
|
340
|
+
/* @__PURE__ */ q("img", {
|
|
335
341
|
ref: C,
|
|
336
342
|
src: _,
|
|
337
343
|
alt: g,
|
|
338
344
|
loading: "lazy",
|
|
339
345
|
decoding: "async",
|
|
340
|
-
className:
|
|
346
|
+
className: a("h-full w-full rounded-xl object-cover transition-opacity duration-200", w === $.Loaded ? "opacity-100" : "opacity-0")
|
|
341
347
|
})
|
|
342
348
|
]
|
|
343
349
|
})
|
|
344
350
|
});
|
|
345
|
-
},
|
|
346
|
-
let { colors:
|
|
347
|
-
"--
|
|
348
|
-
"--
|
|
349
|
-
"--
|
|
350
|
-
"--
|
|
351
|
-
"--
|
|
352
|
-
"--
|
|
353
|
-
"--
|
|
354
|
-
"--
|
|
355
|
-
"--
|
|
356
|
-
"--
|
|
357
|
-
"--
|
|
358
|
-
"--
|
|
359
|
-
"--
|
|
360
|
-
|
|
361
|
-
|
|
351
|
+
}, Oe = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: a, onExpand: o, onClick: s, onDownload: c, labels: u, styles: d, isSelected: f }) => {
|
|
352
|
+
let { colors: p } = d ?? {}, m = e.type === t.Pasted, h = m && o !== void 0, g = i({
|
|
353
|
+
"--ai-tile-bg": p?.background,
|
|
354
|
+
"--ai-tile-border": p?.border,
|
|
355
|
+
"--ai-tile-bg-hover": p?.backgroundHover,
|
|
356
|
+
"--ai-tile-border-hover": p?.borderHover,
|
|
357
|
+
"--ai-tile-bg-selected": p?.backgroundSelected,
|
|
358
|
+
"--ai-tile-border-selected": p?.borderSelected,
|
|
359
|
+
"--ai-tile-focus-outline": p?.focusOutline,
|
|
360
|
+
"--ai-tile-bg-error": p?.backgroundError,
|
|
361
|
+
"--ai-tile-border-error": p?.borderError,
|
|
362
|
+
"--ai-tile-error-text": p?.errorText,
|
|
363
|
+
"--ai-tile-name-text": p?.nameText,
|
|
364
|
+
"--ai-tile-type-text": p?.typeText,
|
|
365
|
+
"--ai-tile-hover-icon-bg": p?.hoverIconBackground,
|
|
366
|
+
"--ai-tile-hover-icon-color": p?.hoverIconColor,
|
|
367
|
+
"--ai-tile-progress-track": p?.trackBackground,
|
|
368
|
+
"--ai-tile-fill-bg": p?.fillBackground
|
|
369
|
+
}), { isImage: _, isAudio: v, isLink: y } = l(() => X(e), [e]);
|
|
370
|
+
return v ? /* @__PURE__ */ q(xe, {
|
|
362
371
|
attachment: e,
|
|
363
|
-
labels:
|
|
372
|
+
labels: u,
|
|
364
373
|
onClick: s,
|
|
374
|
+
onDownload: c,
|
|
375
|
+
onRemove: r,
|
|
365
376
|
searchQuery: n,
|
|
366
377
|
styles: d,
|
|
367
|
-
cssVars:
|
|
368
|
-
|
|
378
|
+
cssVars: g,
|
|
379
|
+
isSelected: f
|
|
380
|
+
}) : _ ? /* @__PURE__ */ q(De, {
|
|
369
381
|
attachment: e,
|
|
370
|
-
labels:
|
|
382
|
+
labels: u,
|
|
371
383
|
onClick: s,
|
|
372
384
|
onExpand: o,
|
|
373
385
|
styles: d,
|
|
374
386
|
onRemove: r,
|
|
375
|
-
cssVars:
|
|
376
|
-
onDownload: c
|
|
377
|
-
|
|
387
|
+
cssVars: g,
|
|
388
|
+
onDownload: c,
|
|
389
|
+
isSelected: f
|
|
390
|
+
}) : /* @__PURE__ */ q(Te, {
|
|
378
391
|
attachment: e,
|
|
379
392
|
onClick: s,
|
|
380
|
-
onRetry:
|
|
393
|
+
onRetry: a,
|
|
381
394
|
onRemove: r,
|
|
382
395
|
onDownload: c,
|
|
383
|
-
isLink:
|
|
384
|
-
isPasted:
|
|
396
|
+
isLink: y,
|
|
397
|
+
isPasted: m,
|
|
385
398
|
styles: d,
|
|
386
|
-
labels:
|
|
399
|
+
labels: u,
|
|
387
400
|
onExpand: o,
|
|
388
|
-
cssVars:
|
|
389
|
-
isExpandable:
|
|
401
|
+
cssVars: g,
|
|
402
|
+
isExpandable: h,
|
|
403
|
+
isSelected: f
|
|
390
404
|
});
|
|
391
|
-
},
|
|
392
|
-
let { ariaLabel: c = "Attached files", removeLabel: l, retryLabel: u, clickLabel: d } =
|
|
393
|
-
return e.length === 0 ? null : /* @__PURE__ */
|
|
405
|
+
}, ke = ({ attachments: e, onRemove: t, onRetry: n, onExpand: r, onAttachmentClick: i, labels: o, styles: s }) => {
|
|
406
|
+
let { ariaLabel: c = "Attached files", removeLabel: l, retryLabel: u, clickLabel: d } = o ?? {}, { className: f } = s ?? {};
|
|
407
|
+
return e.length === 0 ? null : /* @__PURE__ */ q("div", {
|
|
394
408
|
role: "list",
|
|
395
409
|
"aria-label": c,
|
|
396
|
-
className:
|
|
397
|
-
children: e.map((e) => /* @__PURE__ */
|
|
410
|
+
className: a("flex w-full min-w-0 gap-2 overflow-x-auto", f),
|
|
411
|
+
children: e.map((e) => /* @__PURE__ */ q("div", {
|
|
398
412
|
role: "listitem",
|
|
399
|
-
children: /* @__PURE__ */
|
|
413
|
+
children: /* @__PURE__ */ q(Oe, {
|
|
400
414
|
attachment: e,
|
|
401
415
|
onRemove: t,
|
|
402
416
|
onRetry: n,
|
|
@@ -410,200 +424,151 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
|
|
|
410
424
|
})
|
|
411
425
|
}, e.id))
|
|
412
426
|
});
|
|
413
|
-
},
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
"--ci-more-tile-bg-hover": u?.backgroundHover,
|
|
419
|
-
"--ci-more-tile-color-hover": u?.colorHover,
|
|
420
|
-
"--ci-more-tile-border-hover": u?.borderHover,
|
|
421
|
-
"--ci-more-tile-focus-outline": u?.focusOutline
|
|
422
|
-
});
|
|
423
|
-
return /* @__PURE__ */ K("button", {
|
|
424
|
-
type: "button",
|
|
425
|
-
onClick: t,
|
|
426
|
-
"aria-label": s ?? `Show ${e} more attachments`,
|
|
427
|
-
style: d,
|
|
428
|
-
className: o(fe, c, Pe.tile, l),
|
|
429
|
-
children: r ?? /* @__PURE__ */ K("bdi", {
|
|
430
|
-
dir: "ltr",
|
|
431
|
-
children: `+${e}`
|
|
432
|
-
})
|
|
433
|
-
});
|
|
434
|
-
}, $ = {
|
|
435
|
-
container: "_container_7fktb_1",
|
|
436
|
-
headerIcon: "_headerIcon_7fktb_6",
|
|
437
|
-
headerLabel: "_headerLabel_7fktb_7",
|
|
438
|
-
downloadAllButton: "_downloadAllButton_7fktb_8",
|
|
439
|
-
imageTile: "_imageTile_7fktb_12"
|
|
440
|
-
}, Ie = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Le = ({ attachments: e, onAttachmentClick: n, onDownloadAll: r, onRetry: s, labels: c, styles: l }) => {
|
|
441
|
-
let { ariaLabel: d = "Attachments", clickLabel: m = "Download attachment", retryLabel: g = "Retry upload", showLessLabel: v = "Show less", downloadAllLabel: y = "Download all", openInNewTabLabel: b, getHeaderLabel: x = (e) => Ie(e, "attachment"), promptLabel: S, pastedLabel: C, imageLabel: w } = c ?? {}, { typography: { headerLabelClassName: T = "dial-tiny-semi-text" } = {}, colors: E, className: D } = l ?? {}, O = a({
|
|
442
|
-
"--ci-group-bg": E?.background,
|
|
443
|
-
"--ci-group-border": E?.border,
|
|
444
|
-
"--ci-group-text": E?.text
|
|
445
|
-
}), [k, A] = f(!1), j = u(() => Se(e.length, k), [e.length, k]);
|
|
427
|
+
}, Ae = {
|
|
428
|
+
headerIcon: "_headerIcon_1sgtq_1",
|
|
429
|
+
headerLabel: "_headerLabel_1sgtq_2"
|
|
430
|
+
}, je = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Me = ({ attachments: e, onAttachmentClick: n, onDownloadAll: o, onRetry: s, labels: c, styles: l, selectedAttachmentId: u }) => {
|
|
431
|
+
let { ariaLabel: d = "Attachments", clickLabel: f = "Download attachment", retryLabel: m = "Retry upload", downloadAllLabel: g = "Download all", openInNewTabLabel: _, getHeaderLabel: v = (e) => je(e, "attachment"), promptLabel: y, pastedLabel: b, imageLabel: x } = c ?? {}, { typography: S, colors: C, className: w } = l ?? {}, T = i({ "--ai-group-text": C?.text });
|
|
446
432
|
if (e.length === 0) return null;
|
|
447
|
-
let
|
|
448
|
-
let t = e.filter((e) => e.status ===
|
|
449
|
-
|
|
450
|
-
},
|
|
433
|
+
let E = e.some((e) => e.type === t.Image), D = e.some((e) => e.type !== t.Image), O = E && D, k = e.length >= 5, A = O ? V : E ? H : h, j = v(e.length), M = () => {
|
|
434
|
+
let t = e.filter((e) => e.status === r.Idle);
|
|
435
|
+
o ? o(t) : t.forEach((e) => n?.(e.id));
|
|
436
|
+
}, N = (t) => {
|
|
451
437
|
let n = e.find((e) => e.id === t);
|
|
452
|
-
n &&
|
|
438
|
+
n && o?.([n]);
|
|
453
439
|
};
|
|
454
|
-
return /* @__PURE__ */
|
|
440
|
+
return /* @__PURE__ */ J("div", {
|
|
455
441
|
role: "group",
|
|
456
442
|
"aria-label": d,
|
|
457
|
-
style:
|
|
458
|
-
className:
|
|
459
|
-
children: [/* @__PURE__ */
|
|
460
|
-
className: "
|
|
461
|
-
children: [
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
443
|
+
style: T,
|
|
444
|
+
className: a("flex flex-col gap-1", k ? "w-full min-w-0 max-w-[492px]" : "max-w-[420px]", Ae.container, w),
|
|
445
|
+
children: [/* @__PURE__ */ J("div", {
|
|
446
|
+
className: "flex items-center justify-between",
|
|
447
|
+
children: [/* @__PURE__ */ J("div", {
|
|
448
|
+
className: "flex items-center gap-1",
|
|
449
|
+
children: [/* @__PURE__ */ q(A, {
|
|
450
|
+
size: G.SM,
|
|
451
|
+
className: a("shrink-0", Ae.headerIcon),
|
|
452
|
+
"aria-hidden": !0
|
|
453
|
+
}), /* @__PURE__ */ q("span", {
|
|
454
|
+
className: a(S?.headerLabelClassName ?? "dial-tiny-semi-text", Ae.headerLabel),
|
|
455
|
+
children: j
|
|
456
|
+
})]
|
|
457
|
+
}), e.length >= 2 && (o || n) && /* @__PURE__ */ q(se, {
|
|
458
|
+
icon: /* @__PURE__ */ q(p, {
|
|
459
|
+
size: G.SM,
|
|
465
460
|
"aria-hidden": !0
|
|
466
461
|
}),
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
e.length >= 2 && (r || n) && /* @__PURE__ */ K(oe, {
|
|
472
|
-
icon: /* @__PURE__ */ K(h, {
|
|
473
|
-
size: W.SM,
|
|
474
|
-
"aria-hidden": !0
|
|
475
|
-
}),
|
|
476
|
-
className: o("ms-auto h-6 w-6 rounded-lg", $.downloadAllButton),
|
|
477
|
-
"aria-label": y,
|
|
478
|
-
onClick: z
|
|
479
|
-
})
|
|
480
|
-
]
|
|
462
|
+
size: oe.Small,
|
|
463
|
+
"aria-label": g,
|
|
464
|
+
onClick: M
|
|
465
|
+
})]
|
|
481
466
|
}), /* @__PURE__ */ q("div", {
|
|
482
467
|
role: "list",
|
|
483
|
-
"aria-label":
|
|
484
|
-
className:
|
|
485
|
-
children:
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
})
|
|
502
|
-
}, e.id)),
|
|
503
|
-
j.layout === J.Collapsed && /* @__PURE__ */ K("div", {
|
|
504
|
-
role: "listitem",
|
|
505
|
-
children: /* @__PURE__ */ K(Fe, {
|
|
506
|
-
count: j.hiddenCount,
|
|
507
|
-
onClick: () => A(!0)
|
|
508
|
-
})
|
|
509
|
-
}),
|
|
510
|
-
F && k && /* @__PURE__ */ K("div", {
|
|
511
|
-
role: "listitem",
|
|
512
|
-
children: /* @__PURE__ */ K(Fe, {
|
|
513
|
-
count: 0,
|
|
514
|
-
onClick: () => A(!1),
|
|
515
|
-
labels: { ariaLabel: v },
|
|
516
|
-
children: /* @__PURE__ */ K(p, {
|
|
517
|
-
size: W.MD,
|
|
518
|
-
"aria-hidden": !0
|
|
519
|
-
})
|
|
520
|
-
})
|
|
468
|
+
"aria-label": j,
|
|
469
|
+
className: a("gap-3", k ? "grid grid-cols-[repeat(5,83px)]" : "flex flex-wrap"),
|
|
470
|
+
children: e.map((e, t) => /* @__PURE__ */ q("div", {
|
|
471
|
+
role: "listitem",
|
|
472
|
+
children: /* @__PURE__ */ q(Oe, {
|
|
473
|
+
attachment: e,
|
|
474
|
+
onClick: n,
|
|
475
|
+
onDownload: N,
|
|
476
|
+
onRetry: s,
|
|
477
|
+
labels: {
|
|
478
|
+
clickLabel: f,
|
|
479
|
+
retryLabel: m,
|
|
480
|
+
promptLabel: y,
|
|
481
|
+
pastedLabel: b,
|
|
482
|
+
imageLabel: x,
|
|
483
|
+
openInNewTabLabel: _
|
|
484
|
+
},
|
|
485
|
+
isSelected: e.id === u
|
|
521
486
|
})
|
|
522
|
-
|
|
487
|
+
}, `${e.id}-${t}`))
|
|
523
488
|
})]
|
|
524
489
|
});
|
|
525
|
-
},
|
|
526
|
-
overlay: "
|
|
527
|
-
icon: "
|
|
528
|
-
deniedIcon: "
|
|
529
|
-
},
|
|
530
|
-
let { title:
|
|
490
|
+
}, Ne = {
|
|
491
|
+
overlay: "_overlay_liq1c_1",
|
|
492
|
+
icon: "_icon_liq1c_5",
|
|
493
|
+
deniedIcon: "_deniedIcon_liq1c_9"
|
|
494
|
+
}, Pe = ({ isVisible: e, isAttachmentsAllowed: t = !0, labels: n, styles: r }) => {
|
|
495
|
+
let { title: o, subtitle: s } = n ?? {}, { colors: c, typography: l } = r ?? {};
|
|
531
496
|
if (!e) return null;
|
|
532
|
-
let u =
|
|
533
|
-
"--fd-bg": c?.background,
|
|
534
|
-
"--fd-icon": c?.icon,
|
|
535
|
-
"--fd-denied-icon": c?.deniedIcon
|
|
536
|
-
}), d =
|
|
497
|
+
let u = i({
|
|
498
|
+
"--ai-fd-bg": c?.background,
|
|
499
|
+
"--ai-fd-icon": c?.icon,
|
|
500
|
+
"--ai-fd-denied-icon": c?.deniedIcon
|
|
501
|
+
}), d = o ?? (t ? "Attach files" : "No attachments allowed"), f = s ?? (t ? "Drop files here to attach them to message" : "Attachments can't be added to message"), p = t ? Ne.icon : Ne.deniedIcon, m = (e) => {
|
|
537
502
|
e.preventDefault();
|
|
538
|
-
}, h = t ?
|
|
539
|
-
return /* @__PURE__ */
|
|
503
|
+
}, h = t ? g : B;
|
|
504
|
+
return /* @__PURE__ */ q("div", {
|
|
540
505
|
role: "status",
|
|
541
506
|
"aria-live": "polite",
|
|
542
|
-
className:
|
|
507
|
+
className: a("fixed inset-0 z-[9999] flex items-center justify-center backdrop-blur-sm", Ne.overlay, t ? "pointer-events-none" : "pointer-events-auto cursor-not-allowed"),
|
|
543
508
|
onDragOver: t ? void 0 : m,
|
|
544
509
|
onDrop: t ? void 0 : m,
|
|
545
510
|
style: u,
|
|
546
|
-
children: /* @__PURE__ */
|
|
511
|
+
children: /* @__PURE__ */ J("div", {
|
|
547
512
|
className: "flex flex-col items-center text-center",
|
|
548
513
|
children: [
|
|
549
|
-
/* @__PURE__ */
|
|
514
|
+
/* @__PURE__ */ q(h, {
|
|
550
515
|
size: 100,
|
|
551
516
|
className: p,
|
|
552
517
|
"aria-hidden": !0
|
|
553
518
|
}),
|
|
554
|
-
/* @__PURE__ */
|
|
555
|
-
className:
|
|
519
|
+
/* @__PURE__ */ q("span", {
|
|
520
|
+
className: a("mt-5", l?.titleClassName ?? "dial-h3-text"),
|
|
556
521
|
children: d
|
|
557
522
|
}),
|
|
558
|
-
/* @__PURE__ */
|
|
559
|
-
className:
|
|
523
|
+
/* @__PURE__ */ q("span", {
|
|
524
|
+
className: a("mt-4", l?.subtitleClassName ?? "dial-small-text"),
|
|
560
525
|
children: f
|
|
561
526
|
})
|
|
562
527
|
]
|
|
563
528
|
})
|
|
564
529
|
});
|
|
565
|
-
},
|
|
566
|
-
let { screenshotName: a = "Screenshot.png", pastedTextName:
|
|
567
|
-
return { handlePaste:
|
|
568
|
-
if (!
|
|
569
|
-
let
|
|
570
|
-
if (
|
|
530
|
+
}, Fe = (e, n, i = {}) => {
|
|
531
|
+
let { screenshotName: a = "Screenshot.png", pastedTextName: s = "Pasted text" } = i;
|
|
532
|
+
return { handlePaste: o((i) => {
|
|
533
|
+
if (!i.clipboardData) return;
|
|
534
|
+
let o = Array.from(i.clipboardData.items).filter((e) => e.kind === "file" && e.type.startsWith("image/")), c = i.clipboardData.getData("text/plain").length > 0;
|
|
535
|
+
if (o.length > 0 && !c) {
|
|
571
536
|
let n = [];
|
|
572
|
-
for (let e of
|
|
573
|
-
let
|
|
574
|
-
if (!
|
|
575
|
-
let o = new File([
|
|
576
|
-
id:
|
|
537
|
+
for (let e of o) {
|
|
538
|
+
let i = e.getAsFile();
|
|
539
|
+
if (!i) continue;
|
|
540
|
+
let o = new File([i], a, { type: i.type }), s = {
|
|
541
|
+
id: Y(),
|
|
577
542
|
name: a,
|
|
578
|
-
contentType:
|
|
543
|
+
contentType: i.type,
|
|
579
544
|
file: o,
|
|
580
545
|
type: t.Image,
|
|
581
|
-
status:
|
|
546
|
+
status: r.Idle,
|
|
582
547
|
previewUrl: URL.createObjectURL(o)
|
|
583
548
|
};
|
|
584
549
|
n.push(s);
|
|
585
550
|
}
|
|
586
|
-
|
|
551
|
+
i.preventDefault(), e(n);
|
|
587
552
|
return;
|
|
588
553
|
}
|
|
589
|
-
let l =
|
|
554
|
+
let l = i.clipboardData.getData("text/plain");
|
|
590
555
|
if (l.length > n) {
|
|
591
|
-
let n = l.trim(), a = (n.length > 80 ? `${n.slice(0, 80).trimEnd()}…` : n) ||
|
|
592
|
-
id:
|
|
556
|
+
let n = l.trim(), a = (n.length > 80 ? `${n.slice(0, 80).trimEnd()}…` : n) || s, o = new File([l], a, { type: "text/plain" }), c = {
|
|
557
|
+
id: Y(),
|
|
593
558
|
name: a,
|
|
594
559
|
contentType: "text/plain",
|
|
595
|
-
file:
|
|
560
|
+
file: o,
|
|
596
561
|
type: t.Pasted,
|
|
597
|
-
status:
|
|
562
|
+
status: r.Idle
|
|
598
563
|
};
|
|
599
|
-
|
|
564
|
+
i.preventDefault(), e([c]);
|
|
600
565
|
}
|
|
601
566
|
}, [
|
|
602
567
|
e,
|
|
603
568
|
n,
|
|
604
569
|
a,
|
|
605
|
-
|
|
570
|
+
s
|
|
606
571
|
]) };
|
|
607
|
-
},
|
|
572
|
+
}, Ie = 100;
|
|
608
573
|
//#endregion
|
|
609
|
-
export {
|
|
574
|
+
export { Se as ATTACHMENT_COLLAPSE_THRESHOLD, Oe as AttachmentCard, Me as AttachmentGroup, ke as AttachmentTray, Pe as FileDndOverlay, $ as LazyImageLoadStatus, Ie as MAX_UPLOADS_PER_MINUTE, Y as generateAttachmentId, X as getAttachmentCardState, pe as getAttachmentIcon, he as getExtFromContentType, le as getNameWithoutExtension, fe as isMimeTypeAllowed, de as mimeTypesToExtensionLabels, Fe as useClipboardPaste, Ee as useLazyImageLoad };
|