@epam/ai-dial-attachment-input 1.2.0-rc.4 → 1.2.0-rc.6
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/File.d.ts.map +1 -1
- package/constants/attachment-group.d.ts +2 -2
- package/constants/attachment-group.d.ts.map +1 -1
- package/index.css +2 -2
- package/index.js +177 -163
- package/models/attachment-card.d.ts +3 -1
- package/models/attachment-card.d.ts.map +1 -1
- package/models/attachment-file-row.d.ts +2 -2
- package/models/attachment-file-row.d.ts.map +1 -1
- package/package.json +2 -2
- package/utils/attachment.d.ts +4 -0
- package/utils/attachment.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentCard.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCard/AttachmentCard.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,EAAW,MAAM,OAAO,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAKxE,8GAA8G;AAC9G,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"AttachmentCard.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCard/AttachmentCard.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,EAAW,MAAM,OAAO,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAKxE,8GAA8G;AAC9G,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAyElD,CAAC"}
|
|
@@ -21,7 +21,7 @@ export declare const ReloadAction: FC<Omit<ActionProps, 'icon'>>;
|
|
|
21
21
|
export declare const DownloadAction: FC<Omit<ActionProps, 'icon'>>;
|
|
22
22
|
/** Open-in-new-tab button for link attachments. */
|
|
23
23
|
export declare const OpenLinkAction: FC<Omit<ActionProps, 'icon'>>;
|
|
24
|
-
/** Remove button for attachments. */
|
|
24
|
+
/** Remove button for attachments; always visible below the desktop breakpoint, where there is no hover to reveal it. */
|
|
25
25
|
export declare const RemoveAction: FC<Omit<ActionProps, 'icon'>>;
|
|
26
26
|
export {};
|
|
27
27
|
//# sourceMappingURL=Actions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Actions.d.ts","sourceRoot":"","sources":["../../../../src/components/AttachmentCard/Attachments/Actions.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAmB,MAAM,OAAO,CAAC;AAI5D,UAAU,WAAW;IACnB,wCAAwC;IACxC,IAAI,EAAE,SAAS,CAAC;IAChB,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,kDAAkD;IAClD,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAgCD,uCAAuC;AACvC,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CActD,CAAC;AAEF,6CAA6C;AAC7C,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAaxD,CAAC;AAEF,mDAAmD;AACnD,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAaxD,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"Actions.d.ts","sourceRoot":"","sources":["../../../../src/components/AttachmentCard/Attachments/Actions.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAmB,MAAM,OAAO,CAAC;AAI5D,UAAU,WAAW;IACnB,wCAAwC;IACxC,IAAI,EAAE,SAAS,CAAC;IAChB,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,kDAAkD;IAClD,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAgCD,uCAAuC;AACvC,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CActD,CAAC;AAEF,6CAA6C;AAC7C,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAaxD,CAAC;AAEF,mDAAmD;AACnD,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAaxD,CAAC;AAEF,wHAAwH;AACxH,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAiBtD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"File.d.ts","sourceRoot":"","sources":["../../../../src/components/AttachmentCard/Attachments/File.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"File.d.ts","sourceRoot":"","sources":["../../../../src/components/AttachmentCard/Attachments/File.tsx"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,EAAE,EAMR,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAsB/E,2HAA2H;AAC3H,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAyRlD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Total attachment count at/above which the tile list switches from a wrapping flex row to a fixed 5-column grid. */
|
|
2
2
|
export declare const ATTACHMENT_COLLAPSE_THRESHOLD = 5;
|
|
3
|
-
/** Base Tailwind classes shared by every square attachment tile (
|
|
4
|
-
export declare const ATTACHMENT_TILE_BASE_CLASS = "flex size-[
|
|
3
|
+
/** Base Tailwind classes shared by every square attachment tile (100 × 100 px). */
|
|
4
|
+
export declare const ATTACHMENT_TILE_BASE_CLASS = "flex size-[100px] items-center justify-center rounded-xl border";
|
|
5
5
|
//# sourceMappingURL=attachment-group.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-group.d.ts","sourceRoot":"","sources":["../../src/constants/attachment-group.ts"],"names":[],"mappings":"AAAA,sHAAsH;AACtH,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAC/C,
|
|
1
|
+
{"version":3,"file":"attachment-group.d.ts","sourceRoot":"","sources":["../../src/constants/attachment-group.ts"],"names":[],"mappings":"AAAA,sHAAsH;AACtH,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAC/C,mFAAmF;AACnF,eAAO,MAAM,0BAA0B,oEAC4B,CAAC"}
|
package/index.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.
|
|
2
|
-
/*$vite$:1*/.sr-only{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.collapse{visibility:collapse}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.end-1{inset-inline-end:.25rem}.start-\[-1px\]{inset-inline-start:-1px}.top-1{top:.25rem}.top-\[-1px\]{top:-1px}.z-10{z-index:10}.z-\[9999\]{z-index:9999}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.line-clamp-2{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:2}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.size-\[
|
|
1
|
+
._tile_1wxo2_12{box-sizing:border-box;background:var(--ai-tile-bg,var(--bg-layer-raised,#fcfcfc));border-style:solid;border-color:var(--ai-tile-border,var(--stroke-secondary,#d1dbea))}._tile_1wxo2_12._hovered_1wxo2_18:hover{background:var(--ai-tile-bg-hover,var(--bg-control-neutral-hover-muted,#e0e6f0));border-color:var(--ai-tile-border-hover,var(--ai-tile-border,var(--stroke-secondary,#d1dbea)))}._tile_1wxo2_12:focus-visible{outline-color:var(--ai-tile-focus-outline,var(--stroke-focus,#161b2d))}._selected_1wxo2_28{background:var(--ai-tile-bg-selected,var(--bg-control-accent-alpha,#2764d90f));border-color:var(--ai-tile-border-selected,var(--stroke-accent-alpha,#2764d933))}._tileError_1wxo2_33{background:var(--ai-tile-bg-error,var(--bg-error,#f3d6d8));border-color:var(--ai-tile-border-error,var(--stroke-error,#ae2f2f))}._nameText_1wxo2_38{color:var(--ai-tile-name-text,var(--text-primary,#161b2d))}._typeText_1wxo2_42{color:var(--ai-tile-type-text,var(--text-primary,#161b2d))}._placeholderIcon_1wxo2_46{color:var(--ai-tile-placeholder-icon,var(--text-secondary,#57647a))}._retryIcon_1wxo2_50{color:var(--ai-tile-error-text,var(--text-error,#ae2f2f))}._track_1wxo2_54{background:var(--ai-tile-progress-track,var(--bg-backdrop,#161b2d4d))}._actionButton_1wxo2_60{background:var(--ai-tile-hover-icon-bg,var(--bg-control-neutral-hover-muted,#e0e6f0))}._imageActionButton_1wxo2_64{background:var(--ai-tile-hover-icon-bg,var(--bg-layer-base,#f5f7fa));color:var(--ai-tile-hover-icon-color,var(--text-secondary,#57647a))}._headerIcon_1dmgi_1,._headerLabel_1dmgi_2{color:var(--ai-group-text,var(--text-secondary,#57647a))}._overlay_mzpdp_1{background:var(--ai-fd-bg,var(--bg-backdrop,#161b2d4d))}._icon_mzpdp_5{color:var(--ai-fd-icon,var(--text-accent,#1d4ed8))}._deniedIcon_mzpdp_9{color:var(--ai-fd-denied-icon,var(--text-error,#ae2f2f))}
|
|
2
|
+
/*$vite$:1*/.sr-only{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.collapse{visibility:collapse}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.end-1{inset-inline-end:.25rem}.start-\[-1px\]{inset-inline-start:-1px}.top-1{top:.25rem}.top-\[-1px\]{top:-1px}.z-10{z-index:10}.z-\[9999\]{z-index:9999}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.line-clamp-2{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:2}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.size-\[100px\]{height:100px;width:100px}.size-full{width:100%}.h-full,.size-full{height:100%}.w-full{width:100%}.min-w-0{min-width:0}.max-w-\[424px\]{max-width:424px}.max-w-\[532px\]{max-width:532px}.flex-1{flex:1 1 0%}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.grid-cols-\[repeat\(5\2c 100px\)\]{grid-template-columns:repeat(5,100px)}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:4px}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.object-cover{-o-object-fit:cover;object-fit:cover}.p-3{padding:.75rem}.pe-11{padding-inline-end:2.75rem}.pe-5{padding-inline-end:1.25rem}.text-center{text-align:center}.opacity-0{opacity:0}.opacity-100{opacity:1}.outline{outline-style:solid;outline-width:1px}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur:blur(4px);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-200{transition-duration:.2s}.focus-within\:outline:focus-within{outline-style:solid;outline-width:1px}.focus-within\:outline-1:focus-within{outline-width:1px}.focus-within\:outline-offset-1:focus-within{outline-offset:1px}.focus-visible\:opacity-100:focus-visible{opacity:1}.group\/attachment-tile:focus-within .group-focus-within\/attachment-tile\:opacity-100{opacity:1}.group\/attachment-tile:hover .group-hover\/attachment-tile\:opacity-100{opacity:1}@media (max-width:1279px){.mobile\:opacity-100{opacity:1}}
|
package/index.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { AttachmentErrorReason as e, AttachmentType as t, MIME_TYPE_EXT_MAP as n, RequestStatus as r, buildCssVars as i, getBaseMimeType as a, mergeClasses as o, normalizeMimeType as s } from "@epam/ai-dial-chat-shared";
|
|
2
2
|
import { useCallback as c, useEffect as l, useId as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
3
|
-
import { IconClipboard as m, IconDownload as h, IconExternalLink 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
|
|
4
|
-
import { DIAL_ICON_SIZE as
|
|
5
|
-
import { Fragment as
|
|
3
|
+
import { IconClipboard as m, IconDownload as h, IconExternalLink 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 ee, IconFileTypeZip as te, IconFileX as ne, IconMusic as re, IconPaperclip as ie, IconPhoto as B, IconReload as V, IconTerminal2 as ae, IconVideo as oe, IconX as se } from "@tabler/icons-react";
|
|
4
|
+
import { DIAL_ICON_SIZE as H, DIAL_KIT_ICON_STROKE as U, DialItemType as ce, ElementSize as W, FileIcon as le, GhostIconButton as ue, Highlight as de, Skeleton as fe, SkeletonVariant as pe, Spinner as me, StaticIconButton as he } from "@epam/ai-dial-ui-kit";
|
|
5
|
+
import { Fragment as ge, jsx as G, jsxs as K } from "react/jsx-runtime";
|
|
6
6
|
//#region src/utils/attachment.ts
|
|
7
|
-
var
|
|
7
|
+
var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, _e = (e) => {
|
|
8
8
|
if (e == null) return "";
|
|
9
9
|
let t = e.lastIndexOf(".");
|
|
10
10
|
return t > 0 ? e.slice(0, t) : e;
|
|
11
|
-
},
|
|
11
|
+
}, ve = {
|
|
12
12
|
image: "Image files",
|
|
13
13
|
audio: "Audio files",
|
|
14
14
|
video: "Video files",
|
|
15
15
|
text: "Text files",
|
|
16
16
|
"*": "All files"
|
|
17
|
-
},
|
|
17
|
+
}, ye = { "image/jpeg": "JPEG" }, be = (e, t = ve) => e.map((e) => {
|
|
18
18
|
let r = a(e);
|
|
19
19
|
if (r.endsWith("/*")) {
|
|
20
20
|
let e = r.slice(0, -2);
|
|
21
21
|
return t[e] ?? `${e} files`;
|
|
22
22
|
}
|
|
23
|
-
let i = s(r), o =
|
|
23
|
+
let i = s(r), o = ye[i];
|
|
24
24
|
if (o) return o;
|
|
25
25
|
let c = n[i];
|
|
26
26
|
if (c) return c.toUpperCase();
|
|
27
27
|
let l = i.split("/")[1];
|
|
28
28
|
return l == null ? e.toUpperCase() : l.toUpperCase();
|
|
29
|
-
}).join(", "),
|
|
29
|
+
}).join(", "), xe = (e, t) => {
|
|
30
30
|
if (t.length === 0) return !1;
|
|
31
31
|
let n = a(e), r = s(n);
|
|
32
32
|
return t.some((e) => {
|
|
@@ -38,7 +38,7 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
|
|
|
38
38
|
}
|
|
39
39
|
return r === s(t);
|
|
40
40
|
});
|
|
41
|
-
},
|
|
41
|
+
}, Se = (e) => {
|
|
42
42
|
if (!e) return _;
|
|
43
43
|
let t = s(e);
|
|
44
44
|
if (t.startsWith("image/")) switch (t) {
|
|
@@ -46,10 +46,10 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
|
|
|
46
46
|
case "image/png": return A;
|
|
47
47
|
case "image/svg+xml": return P;
|
|
48
48
|
case "image/bmp": return y;
|
|
49
|
-
default: return
|
|
49
|
+
default: return B;
|
|
50
50
|
}
|
|
51
|
-
if (t.startsWith("video/")) return
|
|
52
|
-
if (t.startsWith("audio/")) return
|
|
51
|
+
if (t.startsWith("video/")) return oe;
|
|
52
|
+
if (t.startsWith("audio/")) return re;
|
|
53
53
|
switch (t) {
|
|
54
54
|
case "application/pdf": return O;
|
|
55
55
|
case "application/msword": return S;
|
|
@@ -62,12 +62,12 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
|
|
|
62
62
|
case "application/vnd.rar":
|
|
63
63
|
case "application/x-7z-compressed":
|
|
64
64
|
case "application/gzip":
|
|
65
|
-
case "application/x-tar": return
|
|
65
|
+
case "application/x-tar": return te;
|
|
66
66
|
case "text/csv": return x;
|
|
67
67
|
case "text/plain": return L;
|
|
68
68
|
case "text/html":
|
|
69
69
|
case "application/xhtml+xml": return w;
|
|
70
|
-
case "application/xml": return
|
|
70
|
+
case "application/xml": return ee;
|
|
71
71
|
case "application/sql": return N;
|
|
72
72
|
case "text/javascript": return E;
|
|
73
73
|
case "text/jsx": return D;
|
|
@@ -79,26 +79,30 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
|
|
|
79
79
|
case "text/x-vue": return R;
|
|
80
80
|
default: return _;
|
|
81
81
|
}
|
|
82
|
-
},
|
|
82
|
+
}, Ce = (e) => {
|
|
83
83
|
let { type: n, contentType: r } = e;
|
|
84
|
-
return n === t.Prompt ?
|
|
85
|
-
},
|
|
84
|
+
return n === t.Prompt ? ae : n === t.Pasted ? m : n === t.Image ? B : Se(r ?? "");
|
|
85
|
+
}, we = (e) => {
|
|
86
86
|
let t = s(e), r = n[t];
|
|
87
87
|
if (r) return r;
|
|
88
88
|
let i = t.split("/")[1];
|
|
89
89
|
if (i && !i.startsWith("vnd.") && !i.includes("+")) return i;
|
|
90
|
-
},
|
|
91
|
-
let {
|
|
90
|
+
}, Te = (e) => {
|
|
91
|
+
let { name: t, contentType: n } = e;
|
|
92
|
+
if (n) {
|
|
93
|
+
let e = we(n);
|
|
94
|
+
if (e) return e;
|
|
95
|
+
}
|
|
96
|
+
if (t == null) return;
|
|
97
|
+
let r = t.lastIndexOf(".");
|
|
98
|
+
if (r > 0 && r < t.length - 1) return t.slice(r + 1).toLowerCase();
|
|
99
|
+
}, Ee = (e) => e.type !== t.Prompt && e.type !== t.Pasted, De = (e, n) => {
|
|
100
|
+
let { type: r, name: i } = e;
|
|
92
101
|
if (r === t.Prompt) return n.promptLabel ?? "Prompt";
|
|
93
102
|
if (r === t.Pasted) return n.pastedLabel ?? "Pasted";
|
|
94
103
|
if (r === t.Image) return n.imageLabel ?? "Image";
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (e) return `.${e}`;
|
|
98
|
-
}
|
|
99
|
-
if (i == null) return "";
|
|
100
|
-
let o = i.lastIndexOf(".");
|
|
101
|
-
return o > 0 && o < i.length - 1 ? `.${i.slice(o + 1).toLowerCase()}` : i;
|
|
104
|
+
let a = Te(e);
|
|
105
|
+
return a ? `.${a}` : i ?? "";
|
|
102
106
|
}, J = (e, n = {}) => {
|
|
103
107
|
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.Link && !l;
|
|
104
108
|
return {
|
|
@@ -106,10 +110,10 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
|
|
|
106
110
|
isError: l,
|
|
107
111
|
isImage: u,
|
|
108
112
|
isLink: d,
|
|
109
|
-
BottomIcon: d ? null :
|
|
110
|
-
typeLabel: d ? null :
|
|
113
|
+
BottomIcon: d ? null : Ce(e),
|
|
114
|
+
typeLabel: d ? null : De(e, n)
|
|
111
115
|
};
|
|
112
|
-
},
|
|
116
|
+
}, Oe = 5, ke = "flex size-[100px] items-center justify-center rounded-xl border", Y = {
|
|
113
117
|
tray: "dial-ai-attachment-tray",
|
|
114
118
|
trayItem: "dial-ai-attachment-tray-item",
|
|
115
119
|
tile: "dial-ai-attachment-tile",
|
|
@@ -118,122 +122,131 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
|
|
|
118
122
|
tileType: "dial-ai-attachment-tile-type",
|
|
119
123
|
tileAction: "dial-ai-attachment-tile-action"
|
|
120
124
|
}, X = {
|
|
121
|
-
tile: "
|
|
122
|
-
hovered: "
|
|
123
|
-
selected: "
|
|
124
|
-
tileError: "
|
|
125
|
-
nameText: "
|
|
126
|
-
typeText: "
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
125
|
+
tile: "_tile_1wxo2_12",
|
|
126
|
+
hovered: "_hovered_1wxo2_18",
|
|
127
|
+
selected: "_selected_1wxo2_28",
|
|
128
|
+
tileError: "_tileError_1wxo2_33",
|
|
129
|
+
nameText: "_nameText_1wxo2_38",
|
|
130
|
+
typeText: "_typeText_1wxo2_42",
|
|
131
|
+
placeholderIcon: "_placeholderIcon_1wxo2_46",
|
|
132
|
+
retryIcon: "_retryIcon_1wxo2_50",
|
|
133
|
+
track: "_track_1wxo2_54",
|
|
134
|
+
actionButton: "_actionButton_1wxo2_60",
|
|
135
|
+
imageActionButton: "_imageActionButton_1wxo2_64"
|
|
136
|
+
}, Z = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: a, className: s }) => /* @__PURE__ */ G(he, {
|
|
132
137
|
icon: a,
|
|
133
|
-
size:
|
|
138
|
+
size: W.Small,
|
|
134
139
|
className: o("opacity-0 focus-visible:opacity-100 group-focus-within/attachment-tile:opacity-100 group-hover/attachment-tile:opacity-100", X.actionButton, s, Y.tileAction),
|
|
135
140
|
"aria-label": e,
|
|
136
141
|
"aria-describedby": t ? n : void 0,
|
|
137
142
|
onClick: (e) => {
|
|
138
143
|
e.stopPropagation(), r(i);
|
|
139
144
|
}
|
|
140
|
-
}),
|
|
141
|
-
icon: /* @__PURE__ */
|
|
142
|
-
size:
|
|
145
|
+
}), Ae = ({ ...e }) => /* @__PURE__ */ G(Z, {
|
|
146
|
+
icon: /* @__PURE__ */ G(V, {
|
|
147
|
+
size: H.SM,
|
|
143
148
|
"aria-hidden": !0,
|
|
144
|
-
stroke:
|
|
149
|
+
stroke: U
|
|
145
150
|
}),
|
|
146
151
|
className: X.retryIcon,
|
|
147
152
|
...e
|
|
148
|
-
}),
|
|
149
|
-
icon: /* @__PURE__ */
|
|
150
|
-
size:
|
|
153
|
+
}), je = ({ ...e }) => /* @__PURE__ */ G(Z, {
|
|
154
|
+
icon: /* @__PURE__ */ G(h, {
|
|
155
|
+
size: H.SM,
|
|
151
156
|
"aria-hidden": !0,
|
|
152
|
-
stroke:
|
|
157
|
+
stroke: U
|
|
153
158
|
}),
|
|
154
159
|
...e
|
|
155
|
-
}),
|
|
156
|
-
icon: /* @__PURE__ */
|
|
157
|
-
size:
|
|
160
|
+
}), Me = ({ ...e }) => /* @__PURE__ */ G(Z, {
|
|
161
|
+
icon: /* @__PURE__ */ G(g, {
|
|
162
|
+
size: H.SM,
|
|
158
163
|
"aria-hidden": !0,
|
|
159
|
-
stroke:
|
|
164
|
+
stroke: U
|
|
160
165
|
}),
|
|
161
166
|
...e
|
|
162
|
-
}),
|
|
163
|
-
icon: /* @__PURE__ */
|
|
164
|
-
size:
|
|
167
|
+
}), Ne = ({ className: e, ...t }) => /* @__PURE__ */ G(Z, {
|
|
168
|
+
icon: /* @__PURE__ */ G(se, {
|
|
169
|
+
size: H.SM,
|
|
165
170
|
"aria-hidden": !0,
|
|
166
|
-
stroke:
|
|
171
|
+
stroke: U
|
|
167
172
|
}),
|
|
168
|
-
|
|
169
|
-
|
|
173
|
+
className: o("mobile:opacity-100", e),
|
|
174
|
+
...t
|
|
175
|
+
}), Pe = {
|
|
170
176
|
[e.Network]: "Upload failed · network error",
|
|
171
177
|
[e.UnsupportedType]: "Upload failed · unsupported file type",
|
|
172
178
|
[e.FileTooLarge]: "Upload failed · file too large"
|
|
173
|
-
},
|
|
174
|
-
let { clickLabel: y = "Download attachment", expandLabel: b = "Expand pasted text", downloadLabel: x = "Download attachment", retryLabel: S = "Retry upload", removeLabel: C = "Remove attachment", openInNewTabLabel: w = "Open in new tab", sizeLabel: T, uploadingLabel: E = "Uploading", errorReasonLabels: D, genericErrorLabel: O = "Upload failed" } = s ?? {}, { typography: k, className: A } = l ?? {}, { id: j, name: M, status: N, errorReason: P } = t, F = N === r.Loading, I = N === r.Error, L = u(), R = I ? P && (D?.[P] ??
|
|
175
|
-
|
|
176
|
-
},
|
|
177
|
-
e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
178
|
-
},
|
|
179
|
+
}, Fe = ({ attachment: t, searchQuery: n = "", onClick: i, onRetry: a, labels: s, styles: l, onDownload: f, isLink: p, cssVars: m, onExpand: h, isExpandable: g, onRemove: _, isSelected: v }) => {
|
|
180
|
+
let { clickLabel: y = "Download attachment", expandLabel: b = "Expand pasted text", downloadLabel: x = "Download attachment", retryLabel: S = "Retry upload", removeLabel: C = "Remove attachment", openInNewTabLabel: w = "Open in new tab", sizeLabel: T, uploadingLabel: E = "Uploading", errorReasonLabels: D, genericErrorLabel: O = "Upload failed" } = s ?? {}, { typography: k, className: A } = l ?? {}, { id: j, name: M, status: N, errorReason: P } = t, F = N === r.Loading, I = N === r.Error, L = u(), R = I ? P && (D?.[P] ?? Pe[P]) || O : "", { BottomIcon: z, typeLabel: ee } = J(t), te = Ee(t), ne = !I && !F && f && !p, re = I && !!a && P !== e.UnsupportedType && P !== e.FileTooLarge, ie = Number(!!ne) + Number(!!re) + Number(!!p) + Number(!!_), B = ie > 1 ? "pe-11" : ie === 1 ? "pe-5" : void 0, V = !!g && h !== void 0, ae = V || i !== void 0, oe = () => {
|
|
181
|
+
V ? h(j) : i?.(j);
|
|
182
|
+
}, se = (e) => {
|
|
183
|
+
e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), oe());
|
|
184
|
+
}, W = d(() => _e(M), [M]), ue = c(() => {
|
|
179
185
|
window.open(t.referenceUrl, "_blank", "noopener,noreferrer");
|
|
180
|
-
}, [t]),
|
|
181
|
-
title:
|
|
182
|
-
className: o(k?.nameClassName ?? "dial-
|
|
183
|
-
children: n ? /* @__PURE__ */
|
|
184
|
-
text:
|
|
186
|
+
}, [t]), fe = o(ke, "group/attachment-tile relative flex-col justify-between items-start gap-1 overflow-hidden p-3", X.tile, !I && X.hovered, v && X.selected, I && X.tileError, Y.tile, v && Y.tileSelected), pe = /* @__PURE__ */ G("div", {
|
|
187
|
+
title: W,
|
|
188
|
+
className: o(k?.nameClassName ?? "dial-tiny-text", "line-clamp-2 w-full min-w-0 break-words", X.nameText, !I && B, Y.tileName),
|
|
189
|
+
children: n ? /* @__PURE__ */ G(de, {
|
|
190
|
+
text: W,
|
|
185
191
|
query: n,
|
|
186
192
|
maxLines: 2
|
|
187
|
-
}) :
|
|
188
|
-
}),
|
|
189
|
-
className: o("flex w-full items-center gap-1", I &&
|
|
190
|
-
children: [/* @__PURE__ */
|
|
191
|
-
|
|
193
|
+
}) : W
|
|
194
|
+
}), he = z && /* @__PURE__ */ K("div", {
|
|
195
|
+
className: o("flex w-full items-center gap-1", I && B, Y.tileType),
|
|
196
|
+
children: [te ? /* @__PURE__ */ G(le, {
|
|
197
|
+
type: ce.File,
|
|
198
|
+
name: M ?? "",
|
|
199
|
+
fileExtension: Te(t),
|
|
200
|
+
size: H.SM,
|
|
201
|
+
decorative: !0
|
|
202
|
+
}) : /* @__PURE__ */ G(z, {
|
|
203
|
+
size: H.SM,
|
|
192
204
|
className: X.typeText,
|
|
205
|
+
stroke: U,
|
|
193
206
|
"aria-hidden": !0
|
|
194
|
-
}), /* @__PURE__ */
|
|
195
|
-
className: o(k?.metaClassName ?? "dial-
|
|
196
|
-
children: T ? `${
|
|
207
|
+
}), /* @__PURE__ */ G("span", {
|
|
208
|
+
className: o(k?.metaClassName ?? "dial-tiny-text", "min-w-0 flex-1 truncate", X.typeText),
|
|
209
|
+
children: T ? `${ee} · ${T}` : ee
|
|
197
210
|
})]
|
|
198
|
-
}),
|
|
211
|
+
}), q = ae ? {
|
|
199
212
|
role: "button",
|
|
200
213
|
tabIndex: 0,
|
|
201
|
-
"aria-label":
|
|
202
|
-
onClick:
|
|
203
|
-
onKeyDown:
|
|
204
|
-
} : {},
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
F && /* @__PURE__ */
|
|
214
|
+
"aria-label": V ? b : y,
|
|
215
|
+
onClick: oe,
|
|
216
|
+
onKeyDown: se
|
|
217
|
+
} : {}, ve = /* @__PURE__ */ K(ge, { children: [
|
|
218
|
+
pe,
|
|
219
|
+
he,
|
|
220
|
+
F && /* @__PURE__ */ G("div", {
|
|
208
221
|
role: "progressbar",
|
|
209
222
|
"aria-label": E,
|
|
210
223
|
className: o("absolute start-[-1px] top-[-1px] flex size-full items-center justify-center rounded", X.track),
|
|
211
|
-
children: /* @__PURE__ */
|
|
224
|
+
children: /* @__PURE__ */ G(me, { size: 32 })
|
|
212
225
|
}),
|
|
213
|
-
/* @__PURE__ */
|
|
226
|
+
/* @__PURE__ */ K("div", {
|
|
214
227
|
className: "absolute end-1 top-1 flex gap-1",
|
|
215
228
|
children: [
|
|
216
|
-
|
|
229
|
+
ne && /* @__PURE__ */ G(je, {
|
|
217
230
|
ariaLabel: x,
|
|
218
231
|
errorTitle: R,
|
|
219
232
|
errorDescId: L,
|
|
220
233
|
onClick: f,
|
|
221
234
|
id: j
|
|
222
235
|
}),
|
|
223
|
-
|
|
236
|
+
re && /* @__PURE__ */ G(Ae, {
|
|
224
237
|
ariaLabel: S,
|
|
225
238
|
errorTitle: R,
|
|
226
239
|
errorDescId: L,
|
|
227
240
|
onClick: a,
|
|
228
241
|
id: j
|
|
229
242
|
}),
|
|
230
|
-
p && /* @__PURE__ */
|
|
243
|
+
p && /* @__PURE__ */ G(Me, {
|
|
231
244
|
ariaLabel: w,
|
|
232
245
|
errorTitle: R,
|
|
233
246
|
errorDescId: L,
|
|
234
|
-
onClick:
|
|
247
|
+
onClick: ue
|
|
235
248
|
}),
|
|
236
|
-
_ && /* @__PURE__ */
|
|
249
|
+
_ && /* @__PURE__ */ G(Ne, {
|
|
237
250
|
ariaLabel: C,
|
|
238
251
|
errorTitle: R,
|
|
239
252
|
errorDescId: L,
|
|
@@ -242,7 +255,7 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
|
|
|
242
255
|
})
|
|
243
256
|
]
|
|
244
257
|
}),
|
|
245
|
-
I && /* @__PURE__ */
|
|
258
|
+
I && /* @__PURE__ */ G("span", {
|
|
246
259
|
id: L,
|
|
247
260
|
role: "status",
|
|
248
261
|
"aria-live": "polite",
|
|
@@ -250,20 +263,20 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
|
|
|
250
263
|
children: R
|
|
251
264
|
})
|
|
252
265
|
] });
|
|
253
|
-
return /* @__PURE__ */
|
|
266
|
+
return /* @__PURE__ */ G("div", {
|
|
254
267
|
style: m,
|
|
255
268
|
className: o("inline-flex", A),
|
|
256
|
-
children: /* @__PURE__ */
|
|
257
|
-
...
|
|
269
|
+
children: /* @__PURE__ */ G("div", {
|
|
270
|
+
...q,
|
|
258
271
|
"aria-busy": F,
|
|
259
272
|
style: m,
|
|
260
|
-
className: o(
|
|
261
|
-
children:
|
|
273
|
+
className: o(fe, ae && "cursor-pointer", "focus-within:outline focus-within:outline-1 focus-within:outline-offset-1"),
|
|
274
|
+
children: ve
|
|
262
275
|
})
|
|
263
276
|
});
|
|
264
277
|
}, Q = /* @__PURE__ */ function(e) {
|
|
265
278
|
return e.Idle = "idle", e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e;
|
|
266
|
-
}({}),
|
|
279
|
+
}({}), Ie = ({ enabled: e, src: t }) => {
|
|
267
280
|
let n = f(null), [r, i] = p("idle");
|
|
268
281
|
return l(() => {
|
|
269
282
|
i(e && t ? "loading" : "idle");
|
|
@@ -278,8 +291,8 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
|
|
|
278
291
|
imageRef: n,
|
|
279
292
|
imageLoadStatus: r
|
|
280
293
|
};
|
|
281
|
-
},
|
|
282
|
-
let { clickLabel: f = "Open attachment", expandLabel: p = "Expand pasted text", removeLabel: m = "Remove attachment", downloadLabel: h = "Download attachment" } = i ?? {}, { className: g } = l ?? {}, { id: _, name: v } = e, y = e.previewUrl ?? e.url, b = e.type === t.Pasted && n !== void 0, { isLoading: x, isError: S, isImage: C } = d(() => J(e), [e]), w = r !== void 0 && !b && !x && !S, T = b || w, { imageRef: E, imageLoadStatus: D } =
|
|
294
|
+
}, Le = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: a, cssVars: s, onDownload: c, styles: l, isSelected: u }) => {
|
|
295
|
+
let { clickLabel: f = "Open attachment", expandLabel: p = "Expand pasted text", removeLabel: m = "Remove attachment", downloadLabel: h = "Download attachment" } = i ?? {}, { className: g } = l ?? {}, { id: _, name: v } = e, y = e.previewUrl ?? e.url, b = e.type === t.Pasted && n !== void 0, { isLoading: x, isError: S, isImage: C } = d(() => J(e), [e]), w = r !== void 0 && !b && !x && !S, T = b || w, { imageRef: E, imageLoadStatus: D } = Ie({
|
|
283
296
|
enabled: C,
|
|
284
297
|
src: y
|
|
285
298
|
}), O = () => {
|
|
@@ -293,41 +306,41 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
|
|
|
293
306
|
e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), O());
|
|
294
307
|
}
|
|
295
308
|
} : {};
|
|
296
|
-
return /* @__PURE__ */
|
|
297
|
-
className: o(
|
|
309
|
+
return /* @__PURE__ */ G("div", {
|
|
310
|
+
className: o(ke, "group/attachment-tile", T && "cursor-pointer", X.tile, u && X.selected, g, Y.tile, u && Y.tileSelected),
|
|
298
311
|
...k,
|
|
299
312
|
style: s,
|
|
300
|
-
children: /* @__PURE__ */
|
|
313
|
+
children: /* @__PURE__ */ K("div", {
|
|
301
314
|
className: "relative h-full w-full overflow-hidden",
|
|
302
315
|
children: [
|
|
303
|
-
/* @__PURE__ */
|
|
316
|
+
/* @__PURE__ */ K("div", {
|
|
304
317
|
className: "absolute end-1 top-1 z-10 flex gap-1",
|
|
305
|
-
children: [a && /* @__PURE__ */
|
|
318
|
+
children: [a && /* @__PURE__ */ G(Ne, {
|
|
306
319
|
ariaLabel: m,
|
|
307
320
|
onClick: a,
|
|
308
321
|
id: _,
|
|
309
322
|
className: X.imageActionButton
|
|
310
|
-
}), c && /* @__PURE__ */
|
|
323
|
+
}), c && /* @__PURE__ */ G(je, {
|
|
311
324
|
ariaLabel: h,
|
|
312
325
|
onClick: c,
|
|
313
326
|
id: _,
|
|
314
327
|
className: X.imageActionButton
|
|
315
328
|
})]
|
|
316
329
|
}),
|
|
317
|
-
D !== Q.Loaded && /* @__PURE__ */
|
|
318
|
-
variant:
|
|
330
|
+
D !== Q.Loaded && /* @__PURE__ */ G(fe, {
|
|
331
|
+
variant: pe.Rectangular,
|
|
319
332
|
width: "100%",
|
|
320
333
|
height: "100%",
|
|
321
334
|
active: D === Q.Loading,
|
|
322
|
-
overlay: /* @__PURE__ */
|
|
323
|
-
size:
|
|
324
|
-
className: X.
|
|
335
|
+
overlay: /* @__PURE__ */ G(B, {
|
|
336
|
+
size: H.LG,
|
|
337
|
+
className: X.placeholderIcon,
|
|
325
338
|
"aria-hidden": !0,
|
|
326
|
-
stroke:
|
|
339
|
+
stroke: U
|
|
327
340
|
}),
|
|
328
341
|
className: "absolute inset-0 rounded-xl"
|
|
329
342
|
}),
|
|
330
|
-
/* @__PURE__ */
|
|
343
|
+
/* @__PURE__ */ G("img", {
|
|
331
344
|
ref: E,
|
|
332
345
|
src: y,
|
|
333
346
|
alt: v,
|
|
@@ -338,7 +351,7 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
|
|
|
338
351
|
]
|
|
339
352
|
})
|
|
340
353
|
});
|
|
341
|
-
},
|
|
354
|
+
}, Re = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: a, onExpand: o, onClick: s, onDownload: c, labels: l, styles: u, isSelected: f }) => {
|
|
342
355
|
let { colors: p } = u ?? {}, m = e.type === t.Pasted && o !== void 0, h = i({
|
|
343
356
|
"--ai-tile-bg": p?.background,
|
|
344
357
|
"--ai-tile-border": p?.border,
|
|
@@ -352,11 +365,12 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
|
|
|
352
365
|
"--ai-tile-error-text": p?.errorText,
|
|
353
366
|
"--ai-tile-name-text": p?.nameText,
|
|
354
367
|
"--ai-tile-type-text": p?.typeText,
|
|
368
|
+
"--ai-tile-placeholder-icon": p?.placeholderIcon,
|
|
355
369
|
"--ai-tile-hover-icon-bg": p?.hoverIconBackground,
|
|
356
370
|
"--ai-tile-hover-icon-color": p?.hoverIconColor,
|
|
357
371
|
"--ai-tile-progress-track": p?.trackBackground
|
|
358
372
|
}), { isImage: g, isLink: _ } = d(() => J(e), [e]);
|
|
359
|
-
return g ? /* @__PURE__ */
|
|
373
|
+
return g ? /* @__PURE__ */ G(Le, {
|
|
360
374
|
attachment: e,
|
|
361
375
|
labels: l,
|
|
362
376
|
onClick: s,
|
|
@@ -366,7 +380,7 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
|
|
|
366
380
|
cssVars: h,
|
|
367
381
|
onDownload: c,
|
|
368
382
|
isSelected: f
|
|
369
|
-
}) : /* @__PURE__ */
|
|
383
|
+
}) : /* @__PURE__ */ G(Fe, {
|
|
370
384
|
attachment: e,
|
|
371
385
|
searchQuery: n,
|
|
372
386
|
onClick: s,
|
|
@@ -381,16 +395,16 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
|
|
|
381
395
|
isExpandable: m,
|
|
382
396
|
isSelected: f
|
|
383
397
|
});
|
|
384
|
-
},
|
|
398
|
+
}, ze = ({ attachments: e, onRemove: t, onRetry: n, onExpand: r, onAttachmentClick: i, labels: a, styles: s }) => {
|
|
385
399
|
let { ariaLabel: c = "Attached files", removeLabel: l, retryLabel: u, clickLabel: d, expandLabel: f, uploadingLabel: p } = a ?? {}, { className: m, card: h } = s ?? {};
|
|
386
|
-
return e.length === 0 ? null : /* @__PURE__ */
|
|
400
|
+
return e.length === 0 ? null : /* @__PURE__ */ G("div", {
|
|
387
401
|
role: "list",
|
|
388
402
|
"aria-label": c,
|
|
389
403
|
className: o("flex w-full min-w-0 gap-2 overflow-x-auto", m, Y.tray),
|
|
390
|
-
children: e.map((e) => /* @__PURE__ */
|
|
404
|
+
children: e.map((e) => /* @__PURE__ */ G("div", {
|
|
391
405
|
role: "listitem",
|
|
392
406
|
className: Y.trayItem,
|
|
393
|
-
children: /* @__PURE__ */
|
|
407
|
+
children: /* @__PURE__ */ G(Re, {
|
|
394
408
|
attachment: e,
|
|
395
409
|
onRemove: t,
|
|
396
410
|
onRetry: n,
|
|
@@ -407,53 +421,53 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
|
|
|
407
421
|
})
|
|
408
422
|
}, e.id))
|
|
409
423
|
});
|
|
410
|
-
},
|
|
424
|
+
}, Be = {
|
|
411
425
|
headerIcon: "_headerIcon_1dmgi_1",
|
|
412
426
|
headerLabel: "_headerLabel_1dmgi_2"
|
|
413
|
-
},
|
|
414
|
-
let { ariaLabel: d = "Attachments", clickLabel: f = "Download attachment", downloadLabel: p = "Download attachment", retryLabel: m = "Retry upload", downloadAllLabel: g = "Download all", openInNewTabLabel: v, getHeaderLabel: y = (e) =>
|
|
427
|
+
}, Ve = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, He = ({ attachments: e, onAttachmentClick: n, onDownloadAll: a, onRetry: s, labels: c, styles: l, selectedAttachmentId: u }) => {
|
|
428
|
+
let { ariaLabel: d = "Attachments", clickLabel: f = "Download attachment", downloadLabel: p = "Download attachment", retryLabel: m = "Retry upload", downloadAllLabel: g = "Download all", openInNewTabLabel: v, getHeaderLabel: y = (e) => Ve(e, "attachment"), promptLabel: b, pastedLabel: x, imageLabel: S } = c ?? {}, { typography: C, colors: w, className: T } = l ?? {}, E = i({ "--ai-group-text": w?.text });
|
|
415
429
|
if (e.length === 0) return null;
|
|
416
|
-
let D = e.some((e) => e.type === t.Image), O = e.some((e) => e.type !== t.Image), k = D && O, A = e.length >= 5, j = k ?
|
|
430
|
+
let D = e.some((e) => e.type === t.Image), O = e.some((e) => e.type !== t.Image), k = D && O, A = e.length >= 5, j = k ? ie : D ? B : _, M = y(e.length), N = () => {
|
|
417
431
|
let t = e.filter((e) => e.status === r.Idle);
|
|
418
432
|
a ? a(t) : t.forEach((e) => n?.(e.id));
|
|
419
433
|
}, P = (t) => {
|
|
420
434
|
let n = e.find((e) => e.id === t);
|
|
421
435
|
n && a?.([n]);
|
|
422
436
|
};
|
|
423
|
-
return /* @__PURE__ */
|
|
437
|
+
return /* @__PURE__ */ K("div", {
|
|
424
438
|
role: "group",
|
|
425
439
|
"aria-label": d,
|
|
426
440
|
style: E,
|
|
427
|
-
className: o("flex flex-col gap-
|
|
428
|
-
children: [/* @__PURE__ */
|
|
441
|
+
className: o("flex flex-col gap-2", A ? "w-full min-w-0 max-w-[532px]" : "max-w-[424px]", Be.container, T),
|
|
442
|
+
children: [/* @__PURE__ */ K("div", {
|
|
429
443
|
className: "flex items-center justify-between",
|
|
430
|
-
children: [/* @__PURE__ */
|
|
444
|
+
children: [/* @__PURE__ */ K("div", {
|
|
431
445
|
className: "flex items-center gap-1",
|
|
432
|
-
children: [/* @__PURE__ */
|
|
433
|
-
size:
|
|
434
|
-
className: o("shrink-0",
|
|
446
|
+
children: [/* @__PURE__ */ G(j, {
|
|
447
|
+
size: H.SM,
|
|
448
|
+
className: o("shrink-0", Be.headerIcon),
|
|
435
449
|
"aria-hidden": !0
|
|
436
|
-
}), /* @__PURE__ */
|
|
437
|
-
className: o(C?.headerLabelClassName ?? "dial-tiny-semi-text",
|
|
450
|
+
}), /* @__PURE__ */ G("span", {
|
|
451
|
+
className: o(C?.headerLabelClassName ?? "dial-tiny-semi-text", Be.headerLabel),
|
|
438
452
|
children: M
|
|
439
453
|
})]
|
|
440
|
-
}), e.length >= 2 && (a || n) && /* @__PURE__ */
|
|
441
|
-
icon: /* @__PURE__ */
|
|
442
|
-
size:
|
|
454
|
+
}), e.length >= 2 && (a || n) && /* @__PURE__ */ G(ue, {
|
|
455
|
+
icon: /* @__PURE__ */ G(h, {
|
|
456
|
+
size: H.SM,
|
|
443
457
|
"aria-hidden": !0,
|
|
444
|
-
stroke:
|
|
458
|
+
stroke: U
|
|
445
459
|
}),
|
|
446
|
-
size:
|
|
460
|
+
size: W.Small,
|
|
447
461
|
"aria-label": g,
|
|
448
462
|
onClick: N
|
|
449
463
|
})]
|
|
450
|
-
}), /* @__PURE__ */
|
|
464
|
+
}), /* @__PURE__ */ G("div", {
|
|
451
465
|
role: "list",
|
|
452
466
|
"aria-label": M,
|
|
453
|
-
className: o("gap-
|
|
454
|
-
children: e.map((e, t) => /* @__PURE__ */
|
|
467
|
+
className: o("gap-2", A ? "grid grid-cols-[repeat(5,100px)]" : "flex flex-wrap"),
|
|
468
|
+
children: e.map((e, t) => /* @__PURE__ */ G("div", {
|
|
455
469
|
role: "listitem",
|
|
456
|
-
children: /* @__PURE__ */
|
|
470
|
+
children: /* @__PURE__ */ G(Re, {
|
|
457
471
|
attachment: e,
|
|
458
472
|
onClick: n,
|
|
459
473
|
onDownload: a ? P : void 0,
|
|
@@ -472,51 +486,51 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
|
|
|
472
486
|
}, `${e.id}-${t}`))
|
|
473
487
|
})]
|
|
474
488
|
});
|
|
475
|
-
},
|
|
489
|
+
}, Ue = {
|
|
476
490
|
overlay: "_overlay_mzpdp_1",
|
|
477
491
|
icon: "_icon_mzpdp_5",
|
|
478
492
|
deniedIcon: "_deniedIcon_mzpdp_9"
|
|
479
|
-
},
|
|
493
|
+
}, We = ({ isVisible: e, isAttachmentsAllowed: t = !0, labels: n, styles: r }) => {
|
|
480
494
|
let { title: a, subtitle: s } = n ?? {}, { colors: c, typography: l } = r ?? {};
|
|
481
495
|
if (!e) return null;
|
|
482
496
|
let u = i({
|
|
483
497
|
"--ai-fd-bg": c?.background,
|
|
484
498
|
"--ai-fd-icon": c?.icon,
|
|
485
499
|
"--ai-fd-denied-icon": c?.deniedIcon
|
|
486
|
-
}), d = a ?? (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 ?
|
|
500
|
+
}), d = a ?? (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 ? Ue.icon : Ue.deniedIcon, m = (e) => {
|
|
487
501
|
e.preventDefault();
|
|
488
|
-
}, h = t ? v :
|
|
489
|
-
return /* @__PURE__ */
|
|
502
|
+
}, h = t ? v : ne;
|
|
503
|
+
return /* @__PURE__ */ G("div", {
|
|
490
504
|
role: "status",
|
|
491
505
|
"aria-live": "polite",
|
|
492
|
-
className: o("fixed inset-0 z-[9999] flex items-center justify-center backdrop-blur-sm",
|
|
506
|
+
className: o("fixed inset-0 z-[9999] flex items-center justify-center backdrop-blur-sm", Ue.overlay, t ? "pointer-events-none" : "pointer-events-auto cursor-not-allowed"),
|
|
493
507
|
onDragOver: t ? void 0 : m,
|
|
494
508
|
onDrop: t ? void 0 : m,
|
|
495
509
|
style: u,
|
|
496
|
-
children: /* @__PURE__ */
|
|
510
|
+
children: /* @__PURE__ */ K("div", {
|
|
497
511
|
className: "flex flex-col items-center text-center",
|
|
498
512
|
children: [
|
|
499
|
-
/* @__PURE__ */
|
|
513
|
+
/* @__PURE__ */ G(h, {
|
|
500
514
|
size: 100,
|
|
501
515
|
stroke: 1,
|
|
502
516
|
className: p,
|
|
503
517
|
"aria-hidden": !0
|
|
504
518
|
}),
|
|
505
|
-
/* @__PURE__ */
|
|
519
|
+
/* @__PURE__ */ G("span", {
|
|
506
520
|
className: o("mt-5", l?.titleClassName ?? "dial-h3-text"),
|
|
507
521
|
children: d
|
|
508
522
|
}),
|
|
509
|
-
/* @__PURE__ */
|
|
523
|
+
/* @__PURE__ */ G("span", {
|
|
510
524
|
className: o("mt-4", l?.subtitleClassName ?? "dial-small-text"),
|
|
511
525
|
children: f
|
|
512
526
|
})
|
|
513
527
|
]
|
|
514
528
|
})
|
|
515
529
|
});
|
|
516
|
-
}, $ = (e) => String(e).padStart(2, "0"),
|
|
530
|
+
}, $ = (e) => String(e).padStart(2, "0"), Ge = (e) => `${e.getFullYear()}-${$(e.getMonth() + 1)}-${$(e.getDate())} ${$(e.getHours())}-${$(e.getMinutes())}-${$(e.getSeconds())}`, Ke = (e, t, n) => {
|
|
517
531
|
let r = e.lastIndexOf("."), i = r > 0, a = i ? e.slice(0, r) : e, o = i ? e.slice(r) : "", s = n === 0 ? "" : ` (${n + 1})`;
|
|
518
|
-
return `${a} ${
|
|
519
|
-
},
|
|
532
|
+
return `${a} ${Ge(t)}${s}${o}`;
|
|
533
|
+
}, qe = (e, n, i = {}) => {
|
|
520
534
|
let { screenshotName: a = "Screenshot.png", pastedTextName: o = "Pasted text" } = i;
|
|
521
535
|
return { handlePaste: c((i) => {
|
|
522
536
|
if (!i.clipboardData) return;
|
|
@@ -526,8 +540,8 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
|
|
|
526
540
|
for (let e of s) {
|
|
527
541
|
let i = e.getAsFile();
|
|
528
542
|
if (!i) continue;
|
|
529
|
-
let s =
|
|
530
|
-
id:
|
|
543
|
+
let s = Ke(a, o, n.length), c = new File([i], s, { type: i.type }), l = {
|
|
544
|
+
id: q(),
|
|
531
545
|
name: s,
|
|
532
546
|
contentType: i.type,
|
|
533
547
|
file: c,
|
|
@@ -542,8 +556,8 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
|
|
|
542
556
|
}
|
|
543
557
|
let l = i.clipboardData.getData("text/plain");
|
|
544
558
|
if (l.length > n) {
|
|
545
|
-
let n = `${o} ${
|
|
546
|
-
id:
|
|
559
|
+
let n = `${o} ${Ge(/* @__PURE__ */ new Date())}.txt`, a = new File([l], n, { type: "text/plain" }), s = {
|
|
560
|
+
id: q(),
|
|
547
561
|
name: n,
|
|
548
562
|
contentType: "text/plain",
|
|
549
563
|
file: a,
|
|
@@ -558,6 +572,6 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
|
|
|
558
572
|
a,
|
|
559
573
|
o
|
|
560
574
|
]) };
|
|
561
|
-
},
|
|
575
|
+
}, Je = 100;
|
|
562
576
|
//#endregion
|
|
563
|
-
export {
|
|
577
|
+
export { Oe as ATTACHMENT_COLLAPSE_THRESHOLD, Y as ATTACHMENT_INPUT_CLASS, Re as AttachmentCard, He as AttachmentGroup, ze as AttachmentTray, We as FileDndOverlay, Q as LazyImageLoadStatus, Je as MAX_UPLOADS_PER_MINUTE, q as generateAttachmentId, J as getAttachmentCardState, Se as getAttachmentIcon, we as getExtFromContentType, _e as getNameWithoutExtension, xe as isMimeTypeAllowed, be as mimeTypesToExtensionLabels, qe as useClipboardPaste, Ie as useLazyImageLoad };
|
|
@@ -50,6 +50,8 @@ export interface AttachmentCardColors {
|
|
|
50
50
|
nameText?: string;
|
|
51
51
|
/** Type/meta text color. */
|
|
52
52
|
typeText?: string;
|
|
53
|
+
/** Image placeholder icon color while the preview loads. Defaults to `--text-secondary`. */
|
|
54
|
+
placeholderIcon?: string;
|
|
53
55
|
/** Hover download icon background color. */
|
|
54
56
|
hoverIconBackground?: string;
|
|
55
57
|
/** Hover download icon color. */
|
|
@@ -61,7 +63,7 @@ export interface AttachmentCardColors {
|
|
|
61
63
|
export interface AttachmentCardTypography {
|
|
62
64
|
/** Utility class applied to the file name text. Defaults to `'dial-tiny-text'`. */
|
|
63
65
|
fontClassName?: string;
|
|
64
|
-
/** Utility class applied to the bottom meta label (file type / status). Defaults to `'dial-
|
|
66
|
+
/** Utility class applied to the bottom meta label (file type / status). Defaults to `'dial-tiny-text'`. */
|
|
65
67
|
metaClassName?: string;
|
|
66
68
|
}
|
|
67
69
|
/** Combined style overrides (colors, typography, and shape) for the `AttachmentCard` component. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-card.d.ts","sourceRoot":"","sources":["../../src/models/attachment-card.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEhD,wGAAwG;AACxG,MAAM,WAAW,oBAAoB;IACnC,wEAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,kFAAkF;AAClF,MAAM,WAAW,mBAAmB;IAClC,qDAAqD;IACrD,SAAS,EAAE,OAAO,CAAC;IACnB,8CAA8C;IAC9C,OAAO,EAAE,OAAO,CAAC;IACjB,wEAAwE;IACxE,OAAO,EAAE,OAAO,CAAC;IACjB,2DAA2D;IAC3D,MAAM,EAAE,OAAO,CAAC;IAChB,yDAAyD;IACzD,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,sEAAsE;IACtE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,wEAAwE;AACxE,MAAM,WAAW,oBAAoB;IACnC,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,kBAAkB,CAAC,EA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EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,uHAAuH;IACvH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -26,9 +26,9 @@ export interface FileAttachmentLabels extends AttachmentTypeLabels {
|
|
|
26
26
|
}
|
|
27
27
|
/** Typography overrides for the `FileAttachment` component. */
|
|
28
28
|
export interface FileAttachmentTypography {
|
|
29
|
-
/** Typography class applied to the file name text. Defaults to `'dial-
|
|
29
|
+
/** Typography class applied to the file name text. Defaults to `'dial-tiny-text'`. */
|
|
30
30
|
nameClassName?: string;
|
|
31
|
-
/** Typography class applied to the bottom meta label (file type / status). Defaults to `'dial-
|
|
31
|
+
/** Typography class applied to the bottom meta label (file type / status). Defaults to `'dial-tiny-text'`. */
|
|
32
32
|
metaClassName?: string;
|
|
33
33
|
}
|
|
34
34
|
/** Style overrides for the `FileAttachment` component. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-file-row.d.ts","sourceRoot":"","sources":["../../src/models/attachment-file-row.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,2DAA2D;AAC3D,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;IAChE,6GAA6G;IAC7G,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oNAAoN;IACpN,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uHAAuH;IACvH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iFAAiF;IACjF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4GAA4G;IAC5G,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,2KAA2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-attachment-input",
|
|
3
3
|
"description": "File attachment input components with upload validation, drag-and-drop, and progress tracking",
|
|
4
|
-
"version": "1.2.0-rc.
|
|
4
|
+
"version": "1.2.0-rc.6",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@tabler/icons-react": "^3.44.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@epam/ai-dial-chat-shared": "1.2.0-rc.
|
|
23
|
+
"@epam/ai-dial-chat-shared": "1.2.0-rc.6",
|
|
24
24
|
"react": "^19.2.8",
|
|
25
25
|
"@epam/ai-dial-ui-kit": "^0.15.3"
|
|
26
26
|
},
|
package/utils/attachment.d.ts
CHANGED
|
@@ -24,6 +24,10 @@ export declare const isMimeTypeAllowed: (mimeType: string, allowedTypes: string[
|
|
|
24
24
|
export declare const getAttachmentIcon: (rawContentType: string) => Icon;
|
|
25
25
|
/** Derives a bare file extension (no leading dot) from a MIME type, e.g. `'application/pdf'` -> `'pdf'`. */
|
|
26
26
|
export declare const getExtFromContentType: (contentType: string) => string | undefined;
|
|
27
|
+
/** Returns the attachment's bare file extension (no leading dot), from its content type first and its name second, or `undefined` when neither yields one. */
|
|
28
|
+
export declare const getAttachmentExtension: (attachment: DisplayAttachment) => string | undefined;
|
|
29
|
+
/** Returns `true` when the attachment's type glyph is a file-type icon rather than a prompt or pasted-text glyph. */
|
|
30
|
+
export declare const hasFileTypeGlyph: (attachment: DisplayAttachment) => boolean;
|
|
27
31
|
/** Derives the display state (icons, labels, color classes) an AttachmentCard needs to render a given attachment. */
|
|
28
32
|
export declare const getAttachmentCardState: (attachment: DisplayAttachment, typeLabels?: AttachmentTypeLabels) => AttachmentCardState;
|
|
29
33
|
//# sourceMappingURL=attachment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../../src/utils/attachment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAQnE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAgChD,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AAEnC,uDAAuD;AACvD,eAAO,MAAM,oBAAoB,QAAO,MACgB,CAAC;AAEzD,4GAA4G;AAC5G,eAAO,MAAM,uBAAuB,GAAI,MAAM,MAAM,KAAG,MAItD,CAAC;AAcF,uHAAuH;AACvH,eAAO,MAAM,0BAA0B,GACrC,OAAO,MAAM,EAAE,EACf,iBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAwB,KAC5D,MAoBF,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAU,MAAM,EAChB,cAAc,MAAM,EAAE,KACrB,OAsBF,CAAC;AAEF,uJAAuJ;AACvJ,eAAO,MAAM,iBAAiB,GAAI,gBAAgB,MAAM,KAAG,IAkF1D,CAAC;AAUF,4GAA4G;AAC5G,eAAO,MAAM,qBAAqB,GAChC,aAAa,MAAM,KAClB,MAAM,GAAG,SAUX,CAAC;
|
|
1
|
+
{"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../../src/utils/attachment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAQnE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAgChD,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AAEnC,uDAAuD;AACvD,eAAO,MAAM,oBAAoB,QAAO,MACgB,CAAC;AAEzD,4GAA4G;AAC5G,eAAO,MAAM,uBAAuB,GAAI,MAAM,MAAM,KAAG,MAItD,CAAC;AAcF,uHAAuH;AACvH,eAAO,MAAM,0BAA0B,GACr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