@epam/ai-dial-attachment-input 1.0.0-dev.484 → 1.0.0-dev.489

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