@fairmint/ui 0.3.0 → 0.3.2

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 (32) hide show
  1. package/dist/components/generic/Banner/Banner.cjs +200 -0
  2. package/dist/components/generic/Banner/Banner.cjs.map +1 -0
  3. package/dist/components/generic/Banner/Banner.d.ts +36 -0
  4. package/dist/components/generic/Banner/Banner.d.ts.map +1 -0
  5. package/dist/components/generic/Banner/Banner.js +200 -0
  6. package/dist/components/generic/Banner/Banner.js.map +1 -0
  7. package/dist/components/generic/DocumentRow/DocumentRow.cjs +297 -0
  8. package/dist/components/generic/DocumentRow/DocumentRow.cjs.map +1 -0
  9. package/dist/components/generic/DocumentRow/DocumentRow.d.ts +49 -0
  10. package/dist/components/generic/DocumentRow/DocumentRow.d.ts.map +1 -0
  11. package/dist/components/generic/DocumentRow/DocumentRow.js +297 -0
  12. package/dist/components/generic/DocumentRow/DocumentRow.js.map +1 -0
  13. package/dist/components/generic/FileDropzone/FileDropzone.cjs +396 -0
  14. package/dist/components/generic/FileDropzone/FileDropzone.cjs.map +1 -0
  15. package/dist/components/generic/FileDropzone/FileDropzone.d.ts +91 -0
  16. package/dist/components/generic/FileDropzone/FileDropzone.d.ts.map +1 -0
  17. package/dist/components/generic/FileDropzone/FileDropzone.js +396 -0
  18. package/dist/components/generic/FileDropzone/FileDropzone.js.map +1 -0
  19. package/dist/fairmint-ui.cjs +9 -0
  20. package/dist/fairmint-ui.cjs.map +1 -1
  21. package/dist/fairmint-ui.js +11 -2
  22. package/dist/fairmint-ui.js.map +1 -1
  23. package/dist/index.d.ts +8 -2
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/styles.css +73 -0
  26. package/dist/theme/index.cjs +4 -0
  27. package/dist/theme/index.cjs.map +1 -1
  28. package/dist/theme/index.d.ts +2 -0
  29. package/dist/theme/index.d.ts.map +1 -1
  30. package/dist/theme/index.js +4 -0
  31. package/dist/theme/index.js.map +1 -1
  32. package/package.json +1 -1
@@ -0,0 +1,396 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const React = require("react");
5
+ const index = require("../../../theme/index.cjs");
6
+ const colors = require("../../../theme/colors.cjs");
7
+ const Button = require("../../primitives/Button/Button.cjs");
8
+ const Loader = require("../../primitives/Loader/Loader.cjs");
9
+ const layout = require("../../primitives/layout.cjs");
10
+ const Banner = require("../Banner/Banner.cjs");
11
+ const Group = require("../../../node_modules/@mantine/core/esm/components/Group/Group.cjs");
12
+ const Text = require("../../../node_modules/@mantine/core/esm/components/Text/Text.cjs");
13
+ const ThemeIcon = require("../../../node_modules/@mantine/core/esm/components/ThemeIcon/ThemeIcon.cjs");
14
+ const errorTextProps = {
15
+ size: "xs",
16
+ c: colors.colors.error,
17
+ style: { lineHeight: 1.4 }
18
+ };
19
+ const rejectionTextProps = {
20
+ size: "sm",
21
+ c: index.neutralColors[500],
22
+ style: { lineHeight: 1.4 }
23
+ };
24
+ const FILE_DROPZONE_DEFAULT_SUPPORTED_TYPES = [
25
+ "SAFE",
26
+ "Convertible note",
27
+ "Purchase agreement",
28
+ "Token warrant",
29
+ "Other agreement"
30
+ ];
31
+ const FILE_DROPZONE_DEFAULT_MAX_FILES = 50;
32
+ const DRAG_GRADIENT_BORDER = `linear-gradient(${index.neutralColors[50]}, ${index.neutralColors[50]}) padding-box, linear-gradient(135deg, ${index.brandColors.indigo}, ${index.brandColors.purple}) border-box`;
33
+ function DefaultUploadIcon() {
34
+ return /* @__PURE__ */ jsxRuntime.jsxs(
35
+ "svg",
36
+ {
37
+ "aria-hidden": "true",
38
+ width: "28",
39
+ height: "28",
40
+ viewBox: "0 0 24 24",
41
+ fill: "none",
42
+ stroke: "currentColor",
43
+ strokeWidth: "1.75",
44
+ strokeLinecap: "round",
45
+ strokeLinejoin: "round",
46
+ children: [
47
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 13v8" }),
48
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" }),
49
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m8 17 4-4 4 4" })
50
+ ]
51
+ }
52
+ );
53
+ }
54
+ function DefaultBrowseIcon() {
55
+ return /* @__PURE__ */ jsxRuntime.jsxs(
56
+ "svg",
57
+ {
58
+ "aria-hidden": "true",
59
+ width: "16",
60
+ height: "16",
61
+ viewBox: "0 0 24 24",
62
+ fill: "none",
63
+ stroke: "currentColor",
64
+ strokeWidth: "1.75",
65
+ strokeLinecap: "round",
66
+ strokeLinejoin: "round",
67
+ children: [
68
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z" }),
69
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M14 2v6h6" }),
70
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 13H8" }),
71
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16 13h-2" }),
72
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 17H8" }),
73
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M13 17h2" })
74
+ ]
75
+ }
76
+ );
77
+ }
78
+ function DefaultCompactAddIcon() {
79
+ return /* @__PURE__ */ jsxRuntime.jsxs(
80
+ "svg",
81
+ {
82
+ "aria-hidden": "true",
83
+ width: "16",
84
+ height: "16",
85
+ viewBox: "0 0 24 24",
86
+ fill: "none",
87
+ stroke: "currentColor",
88
+ strokeWidth: "1.75",
89
+ strokeLinecap: "round",
90
+ strokeLinejoin: "round",
91
+ children: [
92
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 19V5" }),
93
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m5 12 7-7 7 7" })
94
+ ]
95
+ }
96
+ );
97
+ }
98
+ function pluralizeFiles(count) {
99
+ return count === 1 ? "file" : "files";
100
+ }
101
+ function DropzoneUploadingLabel({ label }) {
102
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
103
+ /* @__PURE__ */ jsxRuntime.jsx(Text.Text, { component: "span", size: "sm", className: "file-dropzone-status--active", role: "status", children: label }),
104
+ /* @__PURE__ */ jsxRuntime.jsx(DropzoneStatusStyles, {})
105
+ ] });
106
+ }
107
+ function DropzoneStatusStyles() {
108
+ return /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
109
+ .file-dropzone-status--active {
110
+ display: inline-block;
111
+ background-image: linear-gradient(90deg, ${index.brandColors.indigo}, ${index.brandColors.purple}, ${index.brandColors.indigo});
112
+ background-size: 200% auto;
113
+ -webkit-background-clip: text;
114
+ background-clip: text;
115
+ color: transparent;
116
+ font-weight: 500;
117
+ animation: gradientFlow 2.2s linear infinite;
118
+ }
119
+ @media (prefers-reduced-motion: reduce) {
120
+ .file-dropzone-status--active {
121
+ animation: none;
122
+ background-image: none;
123
+ color: ${index.neutralColors[600]};
124
+ }
125
+ }
126
+ ` });
127
+ }
128
+ function FileDropzone({
129
+ onFilesSelected,
130
+ variant = "default",
131
+ errorMessage,
132
+ fileRejections = [],
133
+ uploading = false,
134
+ uploadingLabel = "Uploading…",
135
+ disabled = false,
136
+ dragging,
137
+ title = "Drop your PDFs here, or browse",
138
+ helperCopy,
139
+ supportedTypes = FILE_DROPZONE_DEFAULT_SUPPORTED_TYPES,
140
+ browseLabel = "Browse",
141
+ maxFiles = FILE_DROPZONE_DEFAULT_MAX_FILES,
142
+ maxFileSizeLabel = "50MB each",
143
+ accept = "application/pdf,.pdf",
144
+ fileCount = 0,
145
+ analyzedCount = 0,
146
+ compactProgressText,
147
+ compactAddLabel = "Add more PDFs",
148
+ uploadIcon,
149
+ browseIcon,
150
+ compactAddIcon
151
+ }) {
152
+ const inputRef = React.useRef(null);
153
+ const dragCounterRef = React.useRef(0);
154
+ const [internalDragging, setInternalDragging] = React.useState(false);
155
+ const isDragging = dragging ?? internalDragging;
156
+ const isCompact = variant === "compact";
157
+ const showUploadingChrome = uploading && !isCompact;
158
+ const resolvedUploadIcon = uploadIcon ?? /* @__PURE__ */ jsxRuntime.jsx(DefaultUploadIcon, {});
159
+ const resolvedBrowseIcon = browseIcon ?? /* @__PURE__ */ jsxRuntime.jsx(DefaultBrowseIcon, {});
160
+ const resolvedCompactAddIcon = compactAddIcon ?? /* @__PURE__ */ jsxRuntime.jsx(DefaultCompactAddIcon, {});
161
+ const resolvedHelperCopy = helperCopy ?? (showUploadingChrome ? "You can add more PDFs while we upload" : `PDF · up to ${maxFiles} files · ${maxFileSizeLabel}`);
162
+ const safeFileCount = Math.max(0, fileCount);
163
+ const clampedAnalyzed = Math.min(Math.max(0, analyzedCount), safeFileCount);
164
+ const pct = safeFileCount > 0 ? Math.round(clampedAnalyzed / safeFileCount * 100) : 0;
165
+ const defaultCompactProgress = safeFileCount > 0 ? `${safeFileCount} ${pluralizeFiles(safeFileCount)} · ${clampedAnalyzed} of ${safeFileCount} analyzed (${pct}%)` : null;
166
+ const resolvedCompactProgress = compactProgressText ?? defaultCompactProgress;
167
+ const compactAriaLabel = `${compactAddLabel}. Drop files here or activate to browse.`;
168
+ const handleFiles = (fileList) => {
169
+ if (disabled) return;
170
+ if (!fileList || fileList.length === 0) return;
171
+ onFilesSelected([...fileList]);
172
+ };
173
+ const openPicker = () => {
174
+ if (disabled) return;
175
+ inputRef.current?.click();
176
+ };
177
+ const setDragging = (next) => {
178
+ if (dragging === void 0) {
179
+ setInternalDragging(next);
180
+ }
181
+ };
182
+ const handleDragEnter = (event) => {
183
+ event.preventDefault();
184
+ if (disabled) return;
185
+ dragCounterRef.current += 1;
186
+ setDragging(true);
187
+ };
188
+ const handleDragLeave = () => {
189
+ dragCounterRef.current = Math.max(0, dragCounterRef.current - 1);
190
+ if (dragCounterRef.current === 0) {
191
+ setDragging(false);
192
+ }
193
+ };
194
+ const handleDragOver = (event) => {
195
+ event.preventDefault();
196
+ if (disabled) return;
197
+ setDragging(true);
198
+ };
199
+ const handleDrop = (event) => {
200
+ event.preventDefault();
201
+ dragCounterRef.current = 0;
202
+ setDragging(false);
203
+ if (disabled) return;
204
+ handleFiles(event.dataTransfer.files);
205
+ };
206
+ const fileInput = /* @__PURE__ */ jsxRuntime.jsx(
207
+ "input",
208
+ {
209
+ ref: inputRef,
210
+ type: "file",
211
+ accept,
212
+ multiple: true,
213
+ hidden: true,
214
+ disabled,
215
+ "aria-hidden": "true",
216
+ tabIndex: -1,
217
+ onClick: (event) => event.stopPropagation(),
218
+ onChange: (event) => {
219
+ handleFiles(event.target.files);
220
+ event.target.value = "";
221
+ }
222
+ }
223
+ );
224
+ return /* @__PURE__ */ jsxRuntime.jsxs(layout.Stack, { gap: "xs", "data-testid": "file-dropzone", className: "file-dropzone-root", w: "100%", miw: 0, children: [
225
+ isCompact ? /* @__PURE__ */ jsxRuntime.jsxs(
226
+ layout.Box,
227
+ {
228
+ role: "button",
229
+ tabIndex: disabled ? -1 : 0,
230
+ "aria-label": compactAriaLabel,
231
+ "aria-disabled": disabled,
232
+ "data-testid": "file-dropzone-surface",
233
+ "data-dragging": isDragging || void 0,
234
+ className: "file-dropzone-surface file-dropzone-surface--compact",
235
+ onClick: openPicker,
236
+ onKeyDown: (event) => {
237
+ if (event.key === "Enter" || event.key === " ") {
238
+ event.preventDefault();
239
+ openPicker();
240
+ }
241
+ },
242
+ onDragEnter: handleDragEnter,
243
+ onDragOver: handleDragOver,
244
+ onDragLeave: handleDragLeave,
245
+ onDrop: handleDrop,
246
+ style: {
247
+ cursor: disabled ? "not-allowed" : "pointer",
248
+ borderRadius: 12,
249
+ padding: "10px 16px",
250
+ border: `1px dashed ${isDragging ? index.neutralColors[500] : index.neutralColors[300]}`,
251
+ background: isDragging ? index.neutralColors[100] : index.neutralColors[50],
252
+ transition: "background 0.15s ease, border-color 0.15s ease",
253
+ opacity: disabled ? 0.6 : 1
254
+ },
255
+ children: [
256
+ /* @__PURE__ */ jsxRuntime.jsxs(
257
+ Group.Group,
258
+ {
259
+ justify: "space-between",
260
+ wrap: "nowrap",
261
+ gap: "sm",
262
+ className: "file-dropzone-compact-row",
263
+ align: "flex-start",
264
+ children: [
265
+ /* @__PURE__ */ jsxRuntime.jsxs(Group.Group, { gap: 6, wrap: "nowrap", className: "file-dropzone-compact-leading", miw: 0, children: [
266
+ /* @__PURE__ */ jsxRuntime.jsx(layout.Box, { c: index.neutralColors[600], style: { display: "flex" }, "aria-hidden": true, children: resolvedCompactAddIcon }),
267
+ /* @__PURE__ */ jsxRuntime.jsx(Text.Text, { size: "sm", fw: 500, c: index.neutralColors[800], children: compactAddLabel })
268
+ ] }),
269
+ /* @__PURE__ */ jsxRuntime.jsx(
270
+ Text.Text,
271
+ {
272
+ size: "sm",
273
+ c: index.neutralColors[600],
274
+ className: "file-dropzone-compact-progress",
275
+ style: { fontVariantNumeric: "tabular-nums" },
276
+ children: resolvedCompactProgress
277
+ }
278
+ )
279
+ ]
280
+ }
281
+ ),
282
+ fileInput
283
+ ]
284
+ }
285
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
286
+ layout.Box,
287
+ {
288
+ "aria-disabled": disabled || void 0,
289
+ "aria-busy": showUploadingChrome || void 0,
290
+ "data-testid": "file-dropzone-surface",
291
+ "data-uploading": showUploadingChrome || void 0,
292
+ "data-dragging": isDragging || void 0,
293
+ className: "file-dropzone-surface file-dropzone-surface--default",
294
+ onClick: openPicker,
295
+ onDragEnter: handleDragEnter,
296
+ onDragOver: handleDragOver,
297
+ onDragLeave: handleDragLeave,
298
+ onDrop: handleDrop,
299
+ style: {
300
+ cursor: disabled ? "not-allowed" : "pointer",
301
+ opacity: disabled ? 0.6 : 1,
302
+ borderRadius: 16,
303
+ padding: "40px 24px",
304
+ textAlign: "center",
305
+ border: "2px solid transparent",
306
+ background: isDragging ? DRAG_GRADIENT_BORDER : index.neutralColors[50],
307
+ borderStyle: isDragging ? "solid" : "dashed",
308
+ borderColor: isDragging ? "transparent" : index.neutralColors[300],
309
+ boxShadow: isDragging ? `0 0 0 4px ${index.brandColors.indigo}1f` : "none",
310
+ transition: "box-shadow 0.2s ease, border-color 0.2s ease"
311
+ },
312
+ children: [
313
+ /* @__PURE__ */ jsxRuntime.jsxs(layout.Stack, { gap: "sm", align: "center", children: [
314
+ /* @__PURE__ */ jsxRuntime.jsx(
315
+ ThemeIcon.ThemeIcon,
316
+ {
317
+ size: 56,
318
+ radius: "xl",
319
+ variant: "light",
320
+ color: colors.colors.primary,
321
+ className: `file-dropzone-icon-wrap${isDragging ? " file-dropzone-icon--dragging" : showUploadingChrome ? " file-dropzone-icon--uploading" : ""}`,
322
+ "data-dragging": isDragging || void 0,
323
+ "data-uploading": showUploadingChrome || void 0,
324
+ children: showUploadingChrome ? /* @__PURE__ */ jsxRuntime.jsx(Loader.Loader, { size: "sm", color: colors.colors.primary, "aria-hidden": true }) : resolvedUploadIcon
325
+ }
326
+ ),
327
+ /* @__PURE__ */ jsxRuntime.jsxs(layout.Stack, { gap: "xs", align: "center", className: "file-dropzone-copy", w: "100%", children: [
328
+ /* @__PURE__ */ jsxRuntime.jsx(Text.Text, { fw: 600, c: index.neutralColors[900], className: "file-dropzone-title", ta: "center", children: title }),
329
+ showUploadingChrome && /* @__PURE__ */ jsxRuntime.jsx(DropzoneUploadingLabel, { label: uploadingLabel }),
330
+ supportedTypes.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
331
+ Group.Group,
332
+ {
333
+ gap: 6,
334
+ justify: "center",
335
+ wrap: "wrap",
336
+ w: "100%",
337
+ className: "file-dropzone-chips",
338
+ children: supportedTypes.map((type) => /* @__PURE__ */ jsxRuntime.jsx(
339
+ Text.Text,
340
+ {
341
+ component: "span",
342
+ size: "xs",
343
+ fw: 500,
344
+ c: index.neutralColors[600],
345
+ px: 8,
346
+ py: 2,
347
+ style: {
348
+ background: index.neutralColors[100],
349
+ borderRadius: 999,
350
+ whiteSpace: "nowrap"
351
+ },
352
+ children: type
353
+ },
354
+ type
355
+ ))
356
+ }
357
+ ),
358
+ /* @__PURE__ */ jsxRuntime.jsx(Text.Text, { size: "xs", c: index.neutralColors[500], ta: "center", className: "file-dropzone-helper", children: resolvedHelperCopy })
359
+ ] }),
360
+ /* @__PURE__ */ jsxRuntime.jsx(
361
+ Button.Button,
362
+ {
363
+ variant: "light",
364
+ radius: "md",
365
+ disabled,
366
+ className: "file-dropzone-browse",
367
+ mih: 44,
368
+ leftSection: resolvedBrowseIcon,
369
+ onClick: (event) => {
370
+ event.stopPropagation();
371
+ openPicker();
372
+ },
373
+ children: browseLabel
374
+ }
375
+ )
376
+ ] }),
377
+ fileInput
378
+ ]
379
+ }
380
+ ),
381
+ fileRejections.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
382
+ Banner.Banner,
383
+ {
384
+ tone: "error",
385
+ icon: null,
386
+ title: "Some files weren't added",
387
+ description: /* @__PURE__ */ jsxRuntime.jsx(layout.Stack, { gap: 2, children: fileRejections.map((rejection) => /* @__PURE__ */ jsxRuntime.jsx(Text.Text, { ...rejectionTextProps, children: rejection.error }, `${rejection.name}:${rejection.error}`)) })
388
+ }
389
+ ),
390
+ errorMessage && /* @__PURE__ */ jsxRuntime.jsx(Text.Text, { ...errorTextProps, role: "alert", children: errorMessage })
391
+ ] });
392
+ }
393
+ exports.FILE_DROPZONE_DEFAULT_MAX_FILES = FILE_DROPZONE_DEFAULT_MAX_FILES;
394
+ exports.FILE_DROPZONE_DEFAULT_SUPPORTED_TYPES = FILE_DROPZONE_DEFAULT_SUPPORTED_TYPES;
395
+ exports.FileDropzone = FileDropzone;
396
+ //# sourceMappingURL=FileDropzone.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileDropzone.cjs","sources":["../../../../src/components/generic/FileDropzone/FileDropzone.tsx"],"sourcesContent":["import { type DragEvent, type KeyboardEvent, type ReactNode, useRef, useState } from \"react\";\nimport { brandColors, neutralColors } from \"../../../theme\";\nimport { colors } from \"../../../theme/colors\";\nimport { Button } from \"../../primitives/Button/Button\";\nimport { Loader } from \"../../primitives/Loader/Loader\";\nimport { Box, Group, Stack, Text, ThemeIcon } from \"../../primitives/layout\";\nimport { Banner } from \"../Banner/Banner\";\n\nconst errorTextProps = {\n size: \"xs\" as const,\n c: colors.error,\n style: { lineHeight: 1.4 },\n};\n\nconst rejectionTextProps = {\n size: \"sm\" as const,\n c: neutralColors[500],\n style: { lineHeight: 1.4 },\n};\n\n/** Default supported document-type chips shown beneath the dropzone title. */\nexport const FILE_DROPZONE_DEFAULT_SUPPORTED_TYPES = [\n \"SAFE\",\n \"Convertible note\",\n \"Purchase agreement\",\n \"Token warrant\",\n \"Other agreement\",\n] as const;\n\n/** Default batch cap surfaced in the dropzone helper copy. */\nexport const FILE_DROPZONE_DEFAULT_MAX_FILES = 50;\n\nexport interface FileDropzoneRejection {\n name: string;\n error: string;\n}\n\nexport interface FileDropzoneProps {\n /**\n * Called with the files the user selected or dropped. Per-file validation,\n * dedup, and batch caps are the caller's responsibility.\n */\n onFilesSelected: (files: File[]) => void;\n /** Full dropzone (Stage A) or collapsed header (Stages B/C). @default \"default\" */\n variant?: \"default\" | \"compact\";\n /** External error (e.g. upload failure) shown beneath the dropzone. */\n errorMessage?: string | null;\n /** Per-file validation rejections (wrong type, oversize, batch cap, etc.). */\n fileRejections?: FileDropzoneRejection[];\n /**\n * Default variant only: shows the live upload animation (loader + gradient\n * status). The dropzone stays interactive so callers can queue more files\n * while an upload batch is in flight (ENG-854).\n *\n * Ignored by `variant=\"compact\"` — keep the add-more bar calm and put\n * processing copy on parent-owned file rows instead (Slack design review).\n */\n uploading?: boolean;\n /**\n * Default variant only: gradient status copy while `uploading` is true.\n * @default \"Uploading…\"\n */\n uploadingLabel?: string;\n /** Disables all interaction (e.g. final import). Does not apply to `uploading`. */\n disabled?: boolean;\n /**\n * Visual override for drag-active styling (Storybook / visual tests). Omit for\n * normal drag-and-drop behavior.\n */\n dragging?: boolean;\n /** Primary heading in the default variant. */\n title?: string;\n /** Override the helper line beneath the title/chips. */\n helperCopy?: string;\n /** Supported document-type chips. Pass `[]` to hide chips (e.g. cap table uses prose above). */\n supportedTypes?: readonly string[];\n /** Label on the Browse / Choose files button. @default \"Browse\" */\n browseLabel?: string;\n /** Maximum files copy-deck number. @default 50 */\n maxFiles?: number;\n /** Size constraint copy shown in the helper line. @default \"50MB each\" */\n maxFileSizeLabel?: string;\n /** `input[type=file]` accept attribute. @default \"application/pdf,.pdf\" */\n accept?: string;\n /** Compact variant: staged file count (investor: total staged files). */\n fileCount?: number;\n /** Compact variant: completed count (investor: analyzed files). */\n analyzedCount?: number;\n /**\n * Compact variant: custom progress copy. When set, replaces the default\n * investor string (`9 files · 3 of 9 analyzed (33%)`). Use for cap table\n * (`6 files · 4 classified`) or pipeline states (`Processing 2 documents`).\n */\n compactProgressText?: string;\n /** Compact variant: leading action label. @default \"Add more PDFs\" */\n compactAddLabel?: string;\n /** Icon in the default variant upload circle. */\n uploadIcon?: ReactNode;\n /** Icon beside the Browse button. */\n browseIcon?: ReactNode;\n /** Icon beside the compact add label. */\n compactAddIcon?: ReactNode;\n}\n\nconst DRAG_GRADIENT_BORDER = `linear-gradient(${neutralColors[50]}, ${neutralColors[50]}) padding-box, linear-gradient(135deg, ${brandColors.indigo}, ${brandColors.purple}) border-box`;\n\nfunction DefaultUploadIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n width=\"28\"\n height=\"28\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.75\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M12 13v8\" />\n <path d=\"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242\" />\n <path d=\"m8 17 4-4 4 4\" />\n </svg>\n );\n}\n\nfunction DefaultBrowseIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.75\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z\" />\n <path d=\"M14 2v6h6\" />\n <path d=\"M10 13H8\" />\n <path d=\"M16 13h-2\" />\n <path d=\"M10 17H8\" />\n <path d=\"M13 17h2\" />\n </svg>\n );\n}\n\nfunction DefaultCompactAddIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.75\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M12 19V5\" />\n <path d=\"m5 12 7-7 7 7\" />\n </svg>\n );\n}\n\nfunction pluralizeFiles(count: number): string {\n return count === 1 ? \"file\" : \"files\";\n}\n\nfunction DropzoneUploadingLabel({ label }: { label: string }) {\n return (\n <>\n <Text component=\"span\" size=\"sm\" className=\"file-dropzone-status--active\" role=\"status\">\n {label}\n </Text>\n <DropzoneStatusStyles />\n </>\n );\n}\n\nfunction DropzoneStatusStyles() {\n return (\n <style>{`\n .file-dropzone-status--active {\n display: inline-block;\n background-image: linear-gradient(90deg, ${brandColors.indigo}, ${brandColors.purple}, ${brandColors.indigo});\n background-size: 200% auto;\n -webkit-background-clip: text;\n background-clip: text;\n color: transparent;\n font-weight: 500;\n animation: gradientFlow 2.2s linear infinite;\n }\n @media (prefers-reduced-motion: reduce) {\n .file-dropzone-status--active {\n animation: none;\n background-image: none;\n color: ${neutralColors[600]};\n }\n }\n `}</style>\n );\n}\n\n/**\n * Multi-file document dropzone for investor import and similar flows.\n *\n * Keyboard-operable: the visible Browse button is the sole focusable control;\n * clicking the drop surface also opens the file picker. Drag state adds a\n * `breathe` glow. Set `uploading` on the **default** variant for the ENG-854\n * gradient status + loader while keeping the dropzone open for more files;\n * reserve `disabled` for hard blocks. Compact stays a calm add-more control —\n * put flashy processing copy on parent-owned file rows, not the header.\n *\n * Responsive: uses CSS container queries on `.file-dropzone-root` so the layout\n * adapts inside narrow right panels (cap table drawer ~360px, investor aside\n * ~420px) without callers passing breakpoint props.\n */\nexport function FileDropzone({\n onFilesSelected,\n variant = \"default\",\n errorMessage,\n fileRejections = [],\n uploading = false,\n uploadingLabel = \"Uploading…\",\n disabled = false,\n dragging,\n title = \"Drop your PDFs here, or browse\",\n helperCopy,\n supportedTypes = FILE_DROPZONE_DEFAULT_SUPPORTED_TYPES,\n browseLabel = \"Browse\",\n maxFiles = FILE_DROPZONE_DEFAULT_MAX_FILES,\n maxFileSizeLabel = \"50MB each\",\n accept = \"application/pdf,.pdf\",\n fileCount = 0,\n analyzedCount = 0,\n compactProgressText,\n compactAddLabel = \"Add more PDFs\",\n uploadIcon,\n browseIcon,\n compactAddIcon,\n}: FileDropzoneProps) {\n const inputRef = useRef<HTMLInputElement>(null);\n const dragCounterRef = useRef(0);\n const [internalDragging, setInternalDragging] = useState(false);\n const isDragging = dragging ?? internalDragging;\n const isCompact = variant === \"compact\";\n /** Compact never shows upload chrome — processing belongs on file rows. */\n const showUploadingChrome = uploading && !isCompact;\n const resolvedUploadIcon = uploadIcon ?? <DefaultUploadIcon />;\n const resolvedBrowseIcon = browseIcon ?? <DefaultBrowseIcon />;\n const resolvedCompactAddIcon = compactAddIcon ?? <DefaultCompactAddIcon />;\n const resolvedHelperCopy =\n helperCopy ??\n (showUploadingChrome\n ? \"You can add more PDFs while we upload\"\n : `PDF · up to ${maxFiles} files · ${maxFileSizeLabel}`);\n const safeFileCount = Math.max(0, fileCount);\n const clampedAnalyzed = Math.min(Math.max(0, analyzedCount), safeFileCount);\n const pct = safeFileCount > 0 ? Math.round((clampedAnalyzed / safeFileCount) * 100) : 0;\n const defaultCompactProgress =\n safeFileCount > 0\n ? `${safeFileCount} ${pluralizeFiles(safeFileCount)} · ${clampedAnalyzed} of ${safeFileCount} analyzed (${pct}%)`\n : null;\n const resolvedCompactProgress = compactProgressText ?? defaultCompactProgress;\n const compactAriaLabel = `${compactAddLabel}. Drop files here or activate to browse.`;\n\n const handleFiles = (fileList: FileList | null | undefined) => {\n if (disabled) return;\n if (!fileList || fileList.length === 0) return;\n onFilesSelected([...fileList]);\n };\n\n const openPicker = () => {\n if (disabled) return;\n inputRef.current?.click();\n };\n\n const setDragging = (next: boolean) => {\n if (dragging === undefined) {\n setInternalDragging(next);\n }\n };\n\n const handleDragEnter = (event: DragEvent<HTMLDivElement>) => {\n event.preventDefault();\n if (disabled) return;\n dragCounterRef.current += 1;\n setDragging(true);\n };\n\n const handleDragLeave = () => {\n // Counter-only: each enter/leave (including child targets) must balance.\n // Do not also filter with relatedTarget containment — that skips decrements\n // while enters still increment, leaving drag state stuck above zero.\n dragCounterRef.current = Math.max(0, dragCounterRef.current - 1);\n if (dragCounterRef.current === 0) {\n setDragging(false);\n }\n };\n\n const handleDragOver = (event: DragEvent<HTMLDivElement>) => {\n // Always cancel default so the browser does not navigate/open the file on\n // drop — including when the dropzone is disabled.\n event.preventDefault();\n if (disabled) return;\n setDragging(true);\n };\n\n const handleDrop = (event: DragEvent<HTMLDivElement>) => {\n event.preventDefault();\n dragCounterRef.current = 0;\n setDragging(false);\n if (disabled) return;\n handleFiles(event.dataTransfer.files);\n };\n\n const fileInput = (\n <input\n ref={inputRef}\n type=\"file\"\n accept={accept}\n multiple\n hidden\n disabled={disabled}\n aria-hidden=\"true\"\n tabIndex={-1}\n onClick={(event) => event.stopPropagation()}\n onChange={(event) => {\n handleFiles(event.target.files);\n event.target.value = \"\";\n }}\n />\n );\n\n return (\n <Stack gap=\"xs\" data-testid=\"file-dropzone\" className=\"file-dropzone-root\" w=\"100%\" miw={0}>\n {isCompact ? (\n <Box\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n aria-label={compactAriaLabel}\n aria-disabled={disabled}\n data-testid=\"file-dropzone-surface\"\n data-dragging={isDragging || undefined}\n className=\"file-dropzone-surface file-dropzone-surface--compact\"\n onClick={openPicker}\n onKeyDown={(event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n openPicker();\n }\n }}\n onDragEnter={handleDragEnter}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n style={{\n cursor: disabled ? \"not-allowed\" : \"pointer\",\n borderRadius: 12,\n padding: \"10px 16px\",\n border: `1px dashed ${isDragging ? neutralColors[500] : neutralColors[300]}`,\n background: isDragging ? neutralColors[100] : neutralColors[50],\n transition: \"background 0.15s ease, border-color 0.15s ease\",\n opacity: disabled ? 0.6 : 1,\n }}\n >\n <Group\n justify=\"space-between\"\n wrap=\"nowrap\"\n gap=\"sm\"\n className=\"file-dropzone-compact-row\"\n align=\"flex-start\"\n >\n <Group gap={6} wrap=\"nowrap\" className=\"file-dropzone-compact-leading\" miw={0}>\n <Box c={neutralColors[600]} style={{ display: \"flex\" }} aria-hidden>\n {resolvedCompactAddIcon}\n </Box>\n <Text size=\"sm\" fw={500} c={neutralColors[800]}>\n {compactAddLabel}\n </Text>\n </Group>\n <Text\n size=\"sm\"\n c={neutralColors[600]}\n className=\"file-dropzone-compact-progress\"\n style={{ fontVariantNumeric: \"tabular-nums\" }}\n >\n {resolvedCompactProgress}\n </Text>\n </Group>\n {fileInput}\n </Box>\n ) : (\n <Box\n aria-disabled={disabled || undefined}\n aria-busy={showUploadingChrome || undefined}\n data-testid=\"file-dropzone-surface\"\n data-uploading={showUploadingChrome || undefined}\n data-dragging={isDragging || undefined}\n className=\"file-dropzone-surface file-dropzone-surface--default\"\n onClick={openPicker}\n onDragEnter={handleDragEnter}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n style={{\n cursor: disabled ? \"not-allowed\" : \"pointer\",\n opacity: disabled ? 0.6 : 1,\n borderRadius: 16,\n padding: \"40px 24px\",\n textAlign: \"center\",\n border: \"2px solid transparent\",\n background: isDragging ? DRAG_GRADIENT_BORDER : neutralColors[50],\n borderStyle: isDragging ? \"solid\" : \"dashed\",\n borderColor: isDragging ? \"transparent\" : neutralColors[300],\n boxShadow: isDragging ? `0 0 0 4px ${brandColors.indigo}1f` : \"none\",\n transition: \"box-shadow 0.2s ease, border-color 0.2s ease\",\n }}\n >\n <Stack gap=\"sm\" align=\"center\">\n <ThemeIcon\n size={56}\n radius=\"xl\"\n variant=\"light\"\n color={colors.primary}\n className={`file-dropzone-icon-wrap${\n isDragging\n ? \" file-dropzone-icon--dragging\"\n : showUploadingChrome\n ? \" file-dropzone-icon--uploading\"\n : \"\"\n }`}\n data-dragging={isDragging || undefined}\n data-uploading={showUploadingChrome || undefined}\n >\n {showUploadingChrome ? (\n <Loader size=\"sm\" color={colors.primary} aria-hidden />\n ) : (\n resolvedUploadIcon\n )}\n </ThemeIcon>\n <Stack gap=\"xs\" align=\"center\" className=\"file-dropzone-copy\" w=\"100%\">\n <Text fw={600} c={neutralColors[900]} className=\"file-dropzone-title\" ta=\"center\">\n {title}\n </Text>\n {showUploadingChrome && <DropzoneUploadingLabel label={uploadingLabel} />}\n {supportedTypes.length > 0 && (\n <Group\n gap={6}\n justify=\"center\"\n wrap=\"wrap\"\n w=\"100%\"\n className=\"file-dropzone-chips\"\n >\n {supportedTypes.map((type) => (\n <Text\n key={type}\n component=\"span\"\n size=\"xs\"\n fw={500}\n c={neutralColors[600]}\n px={8}\n py={2}\n style={{\n background: neutralColors[100],\n borderRadius: 999,\n whiteSpace: \"nowrap\",\n }}\n >\n {type}\n </Text>\n ))}\n </Group>\n )}\n <Text size=\"xs\" c={neutralColors[500]} ta=\"center\" className=\"file-dropzone-helper\">\n {resolvedHelperCopy}\n </Text>\n </Stack>\n <Button\n variant=\"light\"\n radius=\"md\"\n disabled={disabled}\n className=\"file-dropzone-browse\"\n mih={44}\n leftSection={resolvedBrowseIcon}\n onClick={(event) => {\n event.stopPropagation();\n openPicker();\n }}\n >\n {browseLabel}\n </Button>\n </Stack>\n {fileInput}\n </Box>\n )}\n\n {fileRejections.length > 0 && (\n <Banner\n tone=\"error\"\n icon={null}\n title=\"Some files weren't added\"\n description={\n <Stack gap={2}>\n {fileRejections.map((rejection) => (\n <Text key={`${rejection.name}:${rejection.error}`} {...rejectionTextProps}>\n {rejection.error}\n </Text>\n ))}\n </Stack>\n }\n />\n )}\n\n {errorMessage && (\n <Text {...errorTextProps} role=\"alert\">\n {errorMessage}\n </Text>\n )}\n </Stack>\n );\n}\n"],"names":["colors","neutralColors","brandColors","jsxs","jsx","Fragment","Text","useRef","useState","Stack","Box","Group","ThemeIcon","Loader","Button","Banner"],"mappings":";;;;;;;;;;;;;AAQA,MAAM,iBAAiB;AAAA,EACrB,MAAM;AAAA,EACN,GAAGA,OAAAA,OAAO;AAAA,EACV,OAAO,EAAE,YAAY,IAAA;AACvB;AAEA,MAAM,qBAAqB;AAAA,EACzB,MAAM;AAAA,EACN,GAAGC,MAAAA,cAAc,GAAG;AAAA,EACpB,OAAO,EAAE,YAAY,IAAA;AACvB;AAGO,MAAM,wCAAwC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,MAAM,kCAAkC;AA0E/C,MAAM,uBAAuB,mBAAmBA,MAAAA,cAAc,EAAE,CAAC,KAAKA,oBAAc,EAAE,CAAC,0CAA0CC,MAAAA,YAAY,MAAM,KAAKA,MAAAA,YAAY,MAAM;AAE1K,SAAS,oBAAoB;AAC3B,SACEC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAY;AAAA,MACZ,OAAM;AAAA,MACN,QAAO;AAAA,MACP,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA,MAEf,UAAA;AAAA,QAAAC,2BAAAA,IAAC,QAAA,EAAK,GAAE,WAAA,CAAW;AAAA,QACnBA,2BAAAA,IAAC,QA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2BAAAA,IAACE,KAAAA,MAAA,EAAmD,GAAG,oBACpD,UAAA,UAAU,MAAA,GADF,GAAG,UAAU,IAAI,IAAI,UAAU,KAAK,EAE/C,CACD,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,IAKL,gBACCF,2BAAAA,IAACE,KAAAA,MAAA,EAAM,GAAG,gBAAgB,MAAK,SAC5B,UAAA,aAAA,CACH;AAAA,EAAA,GAEJ;AAEJ;;;;"}
@@ -0,0 +1,91 @@
1
+ import { ReactNode } from 'react';
2
+ /** Default supported document-type chips shown beneath the dropzone title. */
3
+ export declare const FILE_DROPZONE_DEFAULT_SUPPORTED_TYPES: readonly ["SAFE", "Convertible note", "Purchase agreement", "Token warrant", "Other agreement"];
4
+ /** Default batch cap surfaced in the dropzone helper copy. */
5
+ export declare const FILE_DROPZONE_DEFAULT_MAX_FILES = 50;
6
+ export interface FileDropzoneRejection {
7
+ name: string;
8
+ error: string;
9
+ }
10
+ export interface FileDropzoneProps {
11
+ /**
12
+ * Called with the files the user selected or dropped. Per-file validation,
13
+ * dedup, and batch caps are the caller's responsibility.
14
+ */
15
+ onFilesSelected: (files: File[]) => void;
16
+ /** Full dropzone (Stage A) or collapsed header (Stages B/C). @default "default" */
17
+ variant?: "default" | "compact";
18
+ /** External error (e.g. upload failure) shown beneath the dropzone. */
19
+ errorMessage?: string | null;
20
+ /** Per-file validation rejections (wrong type, oversize, batch cap, etc.). */
21
+ fileRejections?: FileDropzoneRejection[];
22
+ /**
23
+ * Default variant only: shows the live upload animation (loader + gradient
24
+ * status). The dropzone stays interactive so callers can queue more files
25
+ * while an upload batch is in flight (ENG-854).
26
+ *
27
+ * Ignored by `variant="compact"` — keep the add-more bar calm and put
28
+ * processing copy on parent-owned file rows instead (Slack design review).
29
+ */
30
+ uploading?: boolean;
31
+ /**
32
+ * Default variant only: gradient status copy while `uploading` is true.
33
+ * @default "Uploading…"
34
+ */
35
+ uploadingLabel?: string;
36
+ /** Disables all interaction (e.g. final import). Does not apply to `uploading`. */
37
+ disabled?: boolean;
38
+ /**
39
+ * Visual override for drag-active styling (Storybook / visual tests). Omit for
40
+ * normal drag-and-drop behavior.
41
+ */
42
+ dragging?: boolean;
43
+ /** Primary heading in the default variant. */
44
+ title?: string;
45
+ /** Override the helper line beneath the title/chips. */
46
+ helperCopy?: string;
47
+ /** Supported document-type chips. Pass `[]` to hide chips (e.g. cap table uses prose above). */
48
+ supportedTypes?: readonly string[];
49
+ /** Label on the Browse / Choose files button. @default "Browse" */
50
+ browseLabel?: string;
51
+ /** Maximum files copy-deck number. @default 50 */
52
+ maxFiles?: number;
53
+ /** Size constraint copy shown in the helper line. @default "50MB each" */
54
+ maxFileSizeLabel?: string;
55
+ /** `input[type=file]` accept attribute. @default "application/pdf,.pdf" */
56
+ accept?: string;
57
+ /** Compact variant: staged file count (investor: total staged files). */
58
+ fileCount?: number;
59
+ /** Compact variant: completed count (investor: analyzed files). */
60
+ analyzedCount?: number;
61
+ /**
62
+ * Compact variant: custom progress copy. When set, replaces the default
63
+ * investor string (`9 files · 3 of 9 analyzed (33%)`). Use for cap table
64
+ * (`6 files · 4 classified`) or pipeline states (`Processing 2 documents`).
65
+ */
66
+ compactProgressText?: string;
67
+ /** Compact variant: leading action label. @default "Add more PDFs" */
68
+ compactAddLabel?: string;
69
+ /** Icon in the default variant upload circle. */
70
+ uploadIcon?: ReactNode;
71
+ /** Icon beside the Browse button. */
72
+ browseIcon?: ReactNode;
73
+ /** Icon beside the compact add label. */
74
+ compactAddIcon?: ReactNode;
75
+ }
76
+ /**
77
+ * Multi-file document dropzone for investor import and similar flows.
78
+ *
79
+ * Keyboard-operable: the visible Browse button is the sole focusable control;
80
+ * clicking the drop surface also opens the file picker. Drag state adds a
81
+ * `breathe` glow. Set `uploading` on the **default** variant for the ENG-854
82
+ * gradient status + loader while keeping the dropzone open for more files;
83
+ * reserve `disabled` for hard blocks. Compact stays a calm add-more control —
84
+ * put flashy processing copy on parent-owned file rows, not the header.
85
+ *
86
+ * Responsive: uses CSS container queries on `.file-dropzone-root` so the layout
87
+ * adapts inside narrow right panels (cap table drawer ~360px, investor aside
88
+ * ~420px) without callers passing breakpoint props.
89
+ */
90
+ export declare function FileDropzone({ onFilesSelected, variant, errorMessage, fileRejections, uploading, uploadingLabel, disabled, dragging, title, helperCopy, supportedTypes, browseLabel, maxFiles, maxFileSizeLabel, accept, fileCount, analyzedCount, compactProgressText, compactAddLabel, uploadIcon, browseIcon, compactAddIcon, }: FileDropzoneProps): import("react/jsx-runtime").JSX.Element;
91
+ //# sourceMappingURL=FileDropzone.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileDropzone.d.ts","sourceRoot":"","sources":["../../../../src/components/generic/FileDropzone/FileDropzone.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,SAAS,EAAoB,MAAM,OAAO,CAAC;AAoB7F,8EAA8E;AAC9E,eAAO,MAAM,qCAAqC,iGAMxC,CAAC;AAEX,8DAA8D;AAC9D,eAAO,MAAM,+BAA+B,KAAK,CAAC;AAElD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,eAAe,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IACzC,mFAAmF;IACnF,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,8EAA8E;IAC9E,cAAc,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACzC;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;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