@zydon/common 2.6.93 → 2.6.95
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/dist/{chunk-DRX7TS3H.js → chunk-4UVACODQ.js} +1 -1
- package/dist/{chunk-HXTQLRC7.js → chunk-BFAYY2AM.js} +3 -3
- package/dist/{chunk-QVL5T4PN.js → chunk-BPY2UXIB.js} +1 -1
- package/dist/{chunk-LD5W4ZDM.js → chunk-C6LHLY2U.js} +1 -1
- package/dist/{chunk-Q7HVEJDQ.js → chunk-C6ZLQ63H.js} +1 -1
- package/dist/{chunk-OYOJISUL.js → chunk-DQ2CSCVM.js} +1 -1
- package/dist/{chunk-XCHEW25D.js → chunk-DSFPGTNS.js} +1 -1
- package/dist/{chunk-P4XNAVGD.js → chunk-F5HXBPOO.js} +3 -3
- package/dist/{chunk-WBV2ICI7.js → chunk-FHOVYGSG.js} +2 -2
- package/dist/{chunk-GKN6LHRV.js → chunk-GMZ3FKHN.js} +1 -1
- package/dist/{chunk-F2P2THKV.js → chunk-IMVMHVIE.js} +2 -2
- package/dist/{chunk-W3NEQX4G.js → chunk-JJM24URR.js} +1 -1
- package/dist/{chunk-OW6VKO4B.js → chunk-JJQI4255.js} +3 -3
- package/dist/chunk-ORQNUG2V.js +6 -0
- package/dist/{chunk-G2EXNBOF.js → chunk-PF7OFL6X.js} +1 -1
- package/dist/{chunk-77BEMYBO.js → chunk-QAB3RH43.js} +1 -1
- package/dist/{chunk-2BMLGBKG.js → chunk-RQ4T6IDM.js} +1 -1
- package/dist/{chunk-4RL2DRZP.js → chunk-TLQJLUU3.js} +1 -1
- package/dist/{chunk-EPSIFEA7.js → chunk-VGB7HPN6.js} +1 -1
- package/dist/{chunk-LPCRCRDX.js → chunk-YSWCCN64.js} +2 -2
- package/dist/{chunk-DO6XPZ3V.js → chunk-ZQDQI4FF.js} +1 -1
- package/dist/components/ActionButton/index.d.ts +1 -1
- package/dist/components/ActionButton/index.js +3 -3
- package/dist/components/Autocomplete/index.js +3 -3
- package/dist/components/AvatarButton/index.js +6 -6
- package/dist/components/BuilderLayout/index.js +3 -3
- package/dist/components/BuilderSidebar/index.js +2 -2
- package/dist/components/Common/index.js +4 -4
- package/dist/components/DataView/index.js +4 -4
- package/dist/components/DragButton/index.js +3 -3
- package/dist/components/Drawer/index.js +2 -2
- package/dist/components/EasyCropModal/index.js +4 -4
- package/dist/components/Error/index.js +2 -2
- package/dist/components/ExpandableGroup/index.js +2 -2
- package/dist/components/FileUpload/hooks/useFileUploadService.d.ts +7 -0
- package/dist/components/FileUpload/hooks/useFileUploadService.js +2 -0
- package/dist/components/FileUpload/index.d.ts +8 -356
- package/dist/components/FileUpload/index.js +19 -17
- package/dist/components/FrameSkeleton/index.js +2 -2
- package/dist/components/HelpButton/index.js +3 -3
- package/dist/components/Icon/index.js +2 -2
- package/dist/components/IconButton/index.js +3 -3
- package/dist/components/ImageCropModal/index.js +4 -4
- package/dist/components/Incrementer/index.js +3 -3
- package/dist/components/InfoCircle/index.js +2 -2
- package/dist/components/ListBundles/index.js +3 -3
- package/dist/components/MenuItem/index.js +2 -2
- package/dist/components/Modal/index.js +3 -3
- package/dist/components/MoreMenu/index.js +2 -2
- package/dist/components/PasswordRules/index.js +2 -2
- package/dist/components/PopoverSelect/index.js +2 -2
- package/dist/components/SearchInput/index.js +3 -3
- package/dist/components/SelectableCards/index.js +4 -4
- package/dist/components/SeoPreview/index.js +2 -2
- package/dist/components/StateDisplay/index.js +3 -3
- package/dist/components/Steps/index.js +2 -2
- package/dist/components/StyledTab/index.js +2 -2
- package/dist/components/SwapList/index.js +3 -3
- package/dist/components/ToggleTheme/index.js +4 -4
- package/dist/components/WebhookCard/index.js +2 -2
- package/dist/components/carousel/index.js +3 -3
- package/dist/components/form/Address/index.js +5 -5
- package/dist/components/form/Autocomplete/index.js +4 -4
- package/dist/components/form/Incrementer/index.js +3 -3
- package/dist/components/form/Password/index.js +2 -2
- package/dist/components/form/SelectableCards/index.js +4 -4
- package/dist/components/form/UploadAvatarWithCrop/index.js +5 -5
- package/dist/components/form/UploadWithCrop/index.js +6 -6
- package/dist/components/form/Webhook/index.js +5 -5
- package/dist/components/lightbox/index.js +2 -2
- package/dist/components/table/index.js +3 -3
- package/dist/components/upload/index.js +7 -7
- package/dist/hooks/useThemeToggle.js +3 -3
- package/dist/index.js +3 -3
- package/dist/theme/theme-provider.js +2 -2
- package/dist/types/icon.d.ts +2 -0
- package/dist/types/icon.js +1 -1
- package/dist/useFileUploadService-1a2d0cf5.d.ts +358 -0
- package/package.json +1 -1
- package/dist/{chunk-CASOITDH.js → chunk-L4KD6JF2.js} +1 -1
|
@@ -1,334 +1,12 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
id: string;
|
|
11
|
-
url: string;
|
|
12
|
-
}
|
|
13
|
-
interface FileDetails {
|
|
14
|
-
id: string;
|
|
15
|
-
url: string;
|
|
16
|
-
name?: string;
|
|
17
|
-
}
|
|
18
|
-
interface FileUpload {
|
|
19
|
-
url: string;
|
|
20
|
-
file: ExtendFile;
|
|
21
|
-
contentType: string;
|
|
22
|
-
resourceIds: string[];
|
|
23
|
-
}
|
|
24
|
-
type CropSize = {
|
|
25
|
-
width: number;
|
|
26
|
-
height: number;
|
|
27
|
-
} | number;
|
|
28
|
-
type CreateFilesMutation = (files: ExtendFile[]) => Promise<string[] | undefined>;
|
|
29
|
-
interface FileCreateRequest {
|
|
30
|
-
files: Array<{
|
|
31
|
-
content_type: keyof typeof ContentType;
|
|
32
|
-
name: string;
|
|
33
|
-
}>;
|
|
34
|
-
}
|
|
35
|
-
interface FileGetResponse {
|
|
36
|
-
id: string;
|
|
37
|
-
name: string;
|
|
38
|
-
organization_id: string;
|
|
39
|
-
url: string;
|
|
40
|
-
status: 'PENDING' | 'COMPLETED' | 'FAILED';
|
|
41
|
-
content_type: string;
|
|
42
|
-
content_length: number;
|
|
43
|
-
created_by: string;
|
|
44
|
-
created_at: string;
|
|
45
|
-
updated_by: string;
|
|
46
|
-
updated_at: string;
|
|
47
|
-
}
|
|
48
|
-
interface FileCreateResponse {
|
|
49
|
-
files: FileGetResponse[];
|
|
50
|
-
}
|
|
51
|
-
interface FileQueryRequest {
|
|
52
|
-
ids: string[];
|
|
53
|
-
}
|
|
54
|
-
interface FileQueryResponse {
|
|
55
|
-
files: FileGetResponse[];
|
|
56
|
-
}
|
|
57
|
-
interface SingleFilePreviewProps extends StackProps {
|
|
58
|
-
file: ExtendFile;
|
|
59
|
-
aspectRatio?: number;
|
|
60
|
-
isLoading?: boolean;
|
|
61
|
-
cropSize?: CropSize;
|
|
62
|
-
onLoading?: (isLoading: boolean) => void;
|
|
63
|
-
isUploading?: boolean;
|
|
64
|
-
maxWidth?: number;
|
|
65
|
-
maxHeight?: number;
|
|
66
|
-
}
|
|
67
|
-
interface LoadingPreviewImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
|
|
68
|
-
aspectRatio: number;
|
|
69
|
-
maxWidth?: number | string;
|
|
70
|
-
maxHeight?: number | string;
|
|
71
|
-
isLoading?: boolean;
|
|
72
|
-
isUploading?: boolean;
|
|
73
|
-
cropSize?: CropSize;
|
|
74
|
-
onLoading?: (isLoading: boolean) => void;
|
|
75
|
-
alt?: string;
|
|
76
|
-
src?: string;
|
|
77
|
-
loading: 'lazy';
|
|
78
|
-
}
|
|
79
|
-
interface PlaceholderProps extends StackProps {
|
|
80
|
-
header?: React.ReactNode;
|
|
81
|
-
description?: React.ReactNode;
|
|
82
|
-
}
|
|
83
|
-
interface FileUploadProps {
|
|
84
|
-
createFilesMutation: (params: FileCreateRequest) => {
|
|
85
|
-
unwrap: () => Promise<FileCreateResponse>;
|
|
86
|
-
};
|
|
87
|
-
filesDetails: FileDetails[];
|
|
88
|
-
}
|
|
89
|
-
interface SingleFileUploadProps extends DropzoneOptions {
|
|
90
|
-
onRemove?: (file?: ExtendFile) => void;
|
|
91
|
-
onFileSelect?: (file: ExtendFile) => void;
|
|
92
|
-
createFilesMutation: FileUploadProps['createFilesMutation'];
|
|
93
|
-
fileDetails?: FileDetails;
|
|
94
|
-
placeholderProps?: PlaceholderProps;
|
|
95
|
-
placeholderAlt?: React.ReactNode;
|
|
96
|
-
name?: string;
|
|
97
|
-
label?: string;
|
|
98
|
-
id?: string;
|
|
99
|
-
disabled?: boolean;
|
|
100
|
-
error?: string;
|
|
101
|
-
helperText?: string | React.ReactNode;
|
|
102
|
-
sx?: SxProps<Theme>;
|
|
103
|
-
dropZoneSxProps?: SxProps<Theme>;
|
|
104
|
-
uploading?: boolean;
|
|
105
|
-
tabIndex?: number;
|
|
106
|
-
maxSize?: number;
|
|
107
|
-
}
|
|
108
|
-
interface SingleImageUploadProps extends SingleFileUploadProps {
|
|
109
|
-
aspectRatio?: number;
|
|
110
|
-
enableCrop?: boolean;
|
|
111
|
-
convertToWebp?: boolean;
|
|
112
|
-
cropSize?: CropSize;
|
|
113
|
-
maxWidth?: number;
|
|
114
|
-
maxHeight?: number;
|
|
115
|
-
compressionQuality?: number;
|
|
116
|
-
maxCompressedWidth?: number;
|
|
117
|
-
maxCompressedHeight?: number;
|
|
118
|
-
}
|
|
119
|
-
interface MultiFileUploadProps extends Omit<SingleFileUploadProps, 'filesDetails' | 'onFileSelect'> {
|
|
120
|
-
onFilesSelect?: (files: ExtendFile[]) => void;
|
|
121
|
-
onRemoveAll?: (files?: ExtendFile[]) => void;
|
|
122
|
-
onReorder?: (oldIndex: number, newIndex: number, files: ExtendFile[]) => void;
|
|
123
|
-
filesDetails?: FileDetails[];
|
|
124
|
-
maxFiles?: number;
|
|
125
|
-
thumbnail?: boolean;
|
|
126
|
-
}
|
|
127
|
-
interface MultiImageUploadProps extends MultiFileUploadProps {
|
|
128
|
-
aspectRatio?: number;
|
|
129
|
-
enableCrop?: boolean;
|
|
130
|
-
convertToWebp?: boolean;
|
|
131
|
-
cropSize?: CropSize;
|
|
132
|
-
maxWidth?: number;
|
|
133
|
-
maxHeight?: number;
|
|
134
|
-
compressionQuality?: number;
|
|
135
|
-
maxCompressedWidth?: number;
|
|
136
|
-
maxCompressedHeight?: number;
|
|
137
|
-
}
|
|
138
|
-
interface SortableItemProps extends StackProps {
|
|
139
|
-
onRemove?: (file?: ExtendFile) => void;
|
|
140
|
-
file: ExtendFile;
|
|
141
|
-
thumbnail?: boolean;
|
|
142
|
-
disableDrag?: boolean;
|
|
143
|
-
}
|
|
144
|
-
interface MultiFilePreviewProps extends StackProps {
|
|
145
|
-
onReorder?: (oldIndex: number, newIndex: number, files: ExtendFile[]) => void;
|
|
146
|
-
onRemove?: (file?: ExtendFile) => void;
|
|
147
|
-
files: ExtendFile[];
|
|
148
|
-
lastNode?: React.ReactNode;
|
|
149
|
-
firstNode?: React.ReactNode;
|
|
150
|
-
thumbnail: boolean;
|
|
151
|
-
slotProps?: {
|
|
152
|
-
thumbnail?: Omit<FileThumbnailProps, 'file'>;
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
interface StyledDropZoneProps extends StackProps {
|
|
156
|
-
isDragActive: boolean;
|
|
157
|
-
isError: boolean;
|
|
158
|
-
disabled: boolean;
|
|
159
|
-
}
|
|
160
|
-
type StyledDropZonePropsType = Omit<DropzoneRootProps, 'children' | 'onDrop' | 'onError'> & StyledDropZoneProps;
|
|
161
|
-
interface RejectionFilesProps extends StackProps {
|
|
162
|
-
files: FileRejection[];
|
|
163
|
-
}
|
|
164
|
-
interface ThumbnailBadgeProps {
|
|
165
|
-
onRemove?: (file?: ExtendFile) => void;
|
|
166
|
-
file: ExtendFile;
|
|
167
|
-
attributes: DraggableAttributes;
|
|
168
|
-
listeners: DraggableSyntheticListeners;
|
|
169
|
-
innerWidth: number;
|
|
170
|
-
isDragging: boolean;
|
|
171
|
-
disableDrag?: boolean;
|
|
172
|
-
sx?: SxProps<Theme>;
|
|
173
|
-
}
|
|
174
|
-
interface DropZoneProps {
|
|
175
|
-
sx?: SxProps;
|
|
176
|
-
uploading?: boolean;
|
|
177
|
-
id?: string;
|
|
178
|
-
tabIndex?: number;
|
|
179
|
-
getRootProps: () => DropzoneRootProps;
|
|
180
|
-
getInputProps: () => DropzoneInputProps;
|
|
181
|
-
isDragActive: boolean;
|
|
182
|
-
isError: boolean;
|
|
183
|
-
disabled?: boolean;
|
|
184
|
-
dropZoneSxProps?: SxProps<Theme>;
|
|
185
|
-
dropZoneContent?: React.ReactNode;
|
|
186
|
-
children?: React.ReactNode;
|
|
187
|
-
name?: string;
|
|
188
|
-
}
|
|
189
|
-
interface HelperTextProps {
|
|
190
|
-
helperText?: string | React.ReactNode;
|
|
191
|
-
disabled?: boolean;
|
|
192
|
-
isError?: boolean;
|
|
193
|
-
}
|
|
194
|
-
interface UseDropzoneUploaderProps {
|
|
195
|
-
onReorder?: (oldIndex: number, newIndex: number, files: ExtendFile[]) => void;
|
|
196
|
-
onFileSelect?: (file: ExtendFile) => void;
|
|
197
|
-
onFilesSelect?: (files: ExtendFile[]) => void;
|
|
198
|
-
onRemove?: (file?: ExtendFile) => void;
|
|
199
|
-
uploadFiles: (files: File[]) => Promise<ExtendFile[] | undefined>;
|
|
200
|
-
filesPreview?: ExtendFile[];
|
|
201
|
-
dropzoneOptions?: Omit<DropzoneOptions, 'onDrop' | 'onDropRejected'>;
|
|
202
|
-
enableCrop?: boolean;
|
|
203
|
-
customAspectRatio?: number;
|
|
204
|
-
convertToWebp?: boolean;
|
|
205
|
-
maxFiles?: number;
|
|
206
|
-
cropSize?: {
|
|
207
|
-
width: number;
|
|
208
|
-
height: number;
|
|
209
|
-
} | number;
|
|
210
|
-
compressionQuality?: number;
|
|
211
|
-
maxCompressedWidth?: number;
|
|
212
|
-
maxCompressedHeight?: number;
|
|
213
|
-
}
|
|
214
|
-
interface UseDropzoneUploaderReturn {
|
|
215
|
-
file: ExtendFile | null;
|
|
216
|
-
files: ExtendFile[];
|
|
217
|
-
aspectRatio: number;
|
|
218
|
-
dropzoneProps: {
|
|
219
|
-
getRootProps: ReturnType<typeof useDropzone>['getRootProps'];
|
|
220
|
-
getInputProps: ReturnType<typeof useDropzone>['getInputProps'];
|
|
221
|
-
isDragActive: boolean;
|
|
222
|
-
isDragReject: boolean;
|
|
223
|
-
fileRejections: readonly FileRejection[];
|
|
224
|
-
};
|
|
225
|
-
cropState: {
|
|
226
|
-
cropModalOpen: boolean;
|
|
227
|
-
imagePreview: string;
|
|
228
|
-
cropLoading: boolean;
|
|
229
|
-
setCropModalOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
230
|
-
onCropInitialized: (croppedArea: Area, croppedAreaPixels: Area) => void;
|
|
231
|
-
handleCropSave: () => Promise<void>;
|
|
232
|
-
handleCropCancel: () => void;
|
|
233
|
-
currentImageIndex: number;
|
|
234
|
-
totalPendingImages: number;
|
|
235
|
-
};
|
|
236
|
-
setInitialFiles?: (files: ExtendFile[]) => void;
|
|
237
|
-
handleRemove: (fileToRemove?: ExtendFile) => void;
|
|
238
|
-
handleReorder: (oldIndex: number, newIndex: number, files: ExtendFile[]) => void;
|
|
239
|
-
}
|
|
240
|
-
declare enum ContentType {
|
|
241
|
-
APPLICATION_OCTET_STREAM = "application/octet-stream",
|
|
242
|
-
IMAGE_JPEG = "image/jpeg",
|
|
243
|
-
IMAGE_JPG = "image/jpg",
|
|
244
|
-
IMAGE_PNG = "image/png",
|
|
245
|
-
IMAGE_GIF = "image/gif",
|
|
246
|
-
IMAGE_WEBP = "image/webp",
|
|
247
|
-
IMAGE_SVG = "image/svg+xml",
|
|
248
|
-
IMAGE_BMP = "image/bmp",
|
|
249
|
-
IMAGE_TIFF = "image/tiff",
|
|
250
|
-
IMAGE_ICO = "image/x-icon",
|
|
251
|
-
IMAGE_AVIF = "image/avif",
|
|
252
|
-
APPLICATION_PDF = "application/pdf",
|
|
253
|
-
TEXT_PLAIN = "text/plain",
|
|
254
|
-
TEXT_CSV = "text/csv",
|
|
255
|
-
APPLICATION_RTF = "application/rtf",
|
|
256
|
-
APPLICATION_MSWORD = "application/msword",
|
|
257
|
-
APPLICATION_DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
258
|
-
APPLICATION_MSEXCEL = "application/vnd.ms-excel",
|
|
259
|
-
APPLICATION_XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
260
|
-
APPLICATION_MSPOWERPOINT = "application/vnd.ms-powerpoint",
|
|
261
|
-
APPLICATION_PPTX = "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
262
|
-
APPLICATION_ODT = "application/vnd.oasis.opendocument.text",
|
|
263
|
-
APPLICATION_ODS = "application/vnd.oasis.opendocument.spreadsheet",
|
|
264
|
-
APPLICATION_ODP = "application/vnd.oasis.opendocument.presentation",
|
|
265
|
-
APPLICATION_XML = "application/xml",
|
|
266
|
-
TEXT_XML = "text/xml",
|
|
267
|
-
TEXT_HTML = "text/html",
|
|
268
|
-
TEXT_CSS = "text/css",
|
|
269
|
-
APPLICATION_JSON = "application/json",
|
|
270
|
-
TEXT_JAVASCRIPT = "text/javascript",
|
|
271
|
-
APPLICATION_ZIP = "application/zip",
|
|
272
|
-
APPLICATION_GZIP = "application/gzip",
|
|
273
|
-
APPLICATION_RAR = "application/vnd.rar",
|
|
274
|
-
APPLICATION_7Z = "application/x-7z-compressed",
|
|
275
|
-
AUDIO_MPEG = "audio/mpeg",
|
|
276
|
-
AUDIO_WAV = "audio/wav",
|
|
277
|
-
AUDIO_OGG = "audio/ogg",
|
|
278
|
-
AUDIO_WEBM = "audio/webm",
|
|
279
|
-
AUDIO_AAC = "audio/aac",
|
|
280
|
-
VIDEO_MP4 = "video/mp4",
|
|
281
|
-
VIDEO_MPEG = "video/mpeg",
|
|
282
|
-
VIDEO_OGG = "video/ogg",
|
|
283
|
-
VIDEO_WEBM = "video/webm",
|
|
284
|
-
VIDEO_QUICKTIME = "video/quicktime"
|
|
285
|
-
}
|
|
286
|
-
declare enum FileContentType {
|
|
287
|
-
'application/octet-stream' = "APPLICATION_OCTET_STREAM",
|
|
288
|
-
'image/jpeg' = "IMAGE_JPEG",
|
|
289
|
-
'image/jpg' = "IMAGE_JPG",
|
|
290
|
-
'image/png' = "IMAGE_PNG",
|
|
291
|
-
'image/gif' = "IMAGE_GIF",
|
|
292
|
-
'image/webp' = "IMAGE_WEBP",
|
|
293
|
-
'image/svg+xml' = "IMAGE_SVG",
|
|
294
|
-
'image/bmp' = "IMAGE_BMP",
|
|
295
|
-
'image/tiff' = "IMAGE_TIFF",
|
|
296
|
-
'image/x-icon' = "IMAGE_ICO",
|
|
297
|
-
'image/avif' = "IMAGE_AVIF",
|
|
298
|
-
'application/pdf' = "APPLICATION_PDF",
|
|
299
|
-
'text/plain' = "TEXT_PLAIN",
|
|
300
|
-
'text/csv' = "TEXT_CSV",
|
|
301
|
-
'application/rtf' = "APPLICATION_RTF",
|
|
302
|
-
'application/msword' = "APPLICATION_MSWORD",
|
|
303
|
-
'application/vnd.openxmlformats-officedocument.wordprocessingml.document' = "APPLICATION_DOCX",
|
|
304
|
-
'application/vnd.ms-excel' = "APPLICATION_MSEXCEL",
|
|
305
|
-
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' = "APPLICATION_XLSX",
|
|
306
|
-
'application/vnd.ms-powerpoint' = "APPLICATION_MSPOWERPOINT",
|
|
307
|
-
'application/vnd.openxmlformats-officedocument.presentationml.presentation' = "APPLICATION_PPTX",
|
|
308
|
-
'application/vnd.oasis.opendocument.text' = "APPLICATION_ODT",
|
|
309
|
-
'application/vnd.oasis.opendocument.spreadsheet' = "APPLICATION_ODS",
|
|
310
|
-
'application/vnd.oasis.opendocument.presentation' = "APPLICATION_ODP",
|
|
311
|
-
'application/xml' = "APPLICATION_XML",
|
|
312
|
-
'text/xml' = "TEXT_XML",
|
|
313
|
-
'text/html' = "TEXT_HTML",
|
|
314
|
-
'text/css' = "TEXT_CSS",
|
|
315
|
-
'application/json' = "APPLICATION_JSON",
|
|
316
|
-
'text/javascript' = "TEXT_JAVASCRIPT",
|
|
317
|
-
'application/zip' = "APPLICATION_ZIP",
|
|
318
|
-
'application/gzip' = "APPLICATION_GZIP",
|
|
319
|
-
'application/vnd.rar' = "APPLICATION_RAR",
|
|
320
|
-
'application/x-7z-compressed' = "APPLICATION_7Z",
|
|
321
|
-
'audio/mpeg' = "AUDIO_MPEG",
|
|
322
|
-
'audio/wav' = "AUDIO_WAV",
|
|
323
|
-
'audio/ogg' = "AUDIO_OGG",
|
|
324
|
-
'audio/webm' = "AUDIO_WEBM",
|
|
325
|
-
'audio/aac' = "AUDIO_AAC",
|
|
326
|
-
'video/mp4' = "VIDEO_MP4",
|
|
327
|
-
'video/mpeg' = "VIDEO_MPEG",
|
|
328
|
-
'video/ogg' = "VIDEO_OGG",
|
|
329
|
-
'video/webm' = "VIDEO_WEBM",
|
|
330
|
-
'video/quicktime' = "VIDEO_QUICKTIME"
|
|
331
|
-
}
|
|
3
|
+
import { H as HelperTextProps, M as MultiFilePreviewProps, S as SingleFilePreviewProps, F as FileThumbnailProps, U as UseDropzoneUploaderProps, a as UseDropzoneUploaderReturn, b as MultiFileUploadProps, c as MultiImageUploadProps, d as SingleFileUploadProps, e as SingleImageUploadProps } from '../../useFileUploadService-1a2d0cf5.js';
|
|
4
|
+
export { C as ContentType, j as CreateFilesMutation, i as CropSize, D as DropZoneProps, E as ExtendFile, f as FileContentType, k as FileCreateRequest, m as FileCreateResponse, g as FileDetails, l as FileGetResponse, n as FileQueryRequest, o as FileQueryResponse, h as FileUpload, p as FileUploadProps, L as LoadingPreviewImageProps, P as PlaceholderProps, R as RejectionFilesProps, q as SortableItemProps, r as StyledDropZoneProps, s as StyledDropZonePropsType, T as ThumbnailBadgeProps, u as useFileUploadService } from '../../useFileUploadService-1a2d0cf5.js';
|
|
5
|
+
import 'react-dropzone';
|
|
6
|
+
import 'react-easy-crop';
|
|
7
|
+
import '@dnd-kit/core';
|
|
8
|
+
import '@mui/material/Stack';
|
|
9
|
+
import '@mui/material/styles';
|
|
332
10
|
|
|
333
11
|
declare const _default$8: react.MemoExoticComponent<({ helperText, disabled, isError }: HelperTextProps) => react_jsx_runtime.JSX.Element | null>;
|
|
334
12
|
|
|
@@ -336,21 +14,6 @@ declare const _default$7: react.MemoExoticComponent<({ thumbnail, files, onRemov
|
|
|
336
14
|
|
|
337
15
|
declare const _default$6: react.MemoExoticComponent<({ file, aspectRatio, isUploading, isLoading, onLoading, cropSize, maxWidth, maxHeight, }: SingleFilePreviewProps) => react_jsx_runtime.JSX.Element | null>;
|
|
338
16
|
|
|
339
|
-
type FileThumbnailProps = StackProps & {
|
|
340
|
-
tooltip?: boolean;
|
|
341
|
-
file: ExtendFile;
|
|
342
|
-
imageView?: boolean;
|
|
343
|
-
sx?: SxProps<Theme>;
|
|
344
|
-
onDownload?: () => void;
|
|
345
|
-
onRemove?: () => void;
|
|
346
|
-
slotProps?: {
|
|
347
|
-
img?: SxProps<Theme>;
|
|
348
|
-
icon?: SxProps<Theme>;
|
|
349
|
-
removeBtn?: SxProps<Theme>;
|
|
350
|
-
downloadBtn?: SxProps<Theme>;
|
|
351
|
-
};
|
|
352
|
-
};
|
|
353
|
-
|
|
354
17
|
declare const fileThumbnailClasses: {
|
|
355
18
|
root: string;
|
|
356
19
|
img: string;
|
|
@@ -367,17 +30,6 @@ declare function fileNameByUrl(fileUrl: string): string | undefined;
|
|
|
367
30
|
|
|
368
31
|
declare const useDropzoneUploader: ({ onFilesSelect, onFileSelect, onReorder, onRemove, uploadFiles, filesPreview, dropzoneOptions, enableCrop, customAspectRatio, convertToWebp, cropSize, maxFiles, compressionQuality, maxCompressedWidth, maxCompressedHeight, }: UseDropzoneUploaderProps) => UseDropzoneUploaderReturn;
|
|
369
32
|
|
|
370
|
-
declare const useFileUploadService: ({ createFilesMutation, filesDetails, }: FileUploadProps) => {
|
|
371
|
-
setFilesPreview: react.Dispatch<react.SetStateAction<ExtendFile[]>>;
|
|
372
|
-
uploadFiles: (files: File[]) => Promise<ExtendFile[] | undefined>;
|
|
373
|
-
filesPreview: ExtendFile[];
|
|
374
|
-
filePreview: ExtendFile;
|
|
375
|
-
isLoadingPreview: boolean;
|
|
376
|
-
isUploadingFiles: boolean;
|
|
377
|
-
isUploadOrLoadingFiles: boolean;
|
|
378
|
-
uploadErrorText: string;
|
|
379
|
-
};
|
|
380
|
-
|
|
381
33
|
declare const _default$5: react.MemoExoticComponent<({ onRemove, onReorder, onFilesSelect, createFilesMutation, filesDetails, id, disabled, error, helperText, thumbnail, dropZoneSxProps, uploading, tabIndex, maxFiles, placeholderAlt, placeholderProps, ...other }: MultiFileUploadProps) => react_jsx_runtime.JSX.Element>;
|
|
382
34
|
|
|
383
35
|
declare const _default$4: react.MemoExoticComponent<({ onRemove, onReorder, onFilesSelect, createFilesMutation, filesDetails, id, disabled, error, helperText, dropZoneSxProps, placeholderProps, placeholderAlt, uploading, tabIndex, maxFiles, aspectRatio: customAspectRatio, enableCrop, convertToWebp, cropSize, name, label: customLabel, ...other }: MultiImageUploadProps) => react_jsx_runtime.JSX.Element>;
|
|
@@ -396,4 +48,4 @@ declare const compressImageWithoutCrop: (file: File, quality?: number, maxWidth?
|
|
|
396
48
|
declare const getFileNameFromContentDisposition: (contentDisposition: string) => string;
|
|
397
49
|
declare const encodeFilenameForHeader: (filename: string) => string;
|
|
398
50
|
|
|
399
|
-
export {
|
|
51
|
+
export { FileThumbnail, FileThumbnailProps, _default$8 as HelperText, HelperTextProps, _default$7 as MultiFilePreview, MultiFilePreviewProps, MultiFileUploadProps, MultiImageUploadProps, _default$5 as MultipleFileUpload, _default$4 as MultipleImageUpload, _default$6 as SingleFilePreview, SingleFilePreviewProps, _default$3 as SingleFileUpload, SingleFileUploadProps, _default$2 as SingleImageUpload, SingleImageUploadProps, _default$1 as UploadAvatar, _default as UploadSimpleBox, UseDropzoneUploaderProps, UseDropzoneUploaderReturn, compressImageWithoutCrop, convertToWebP, encodeFilenameForHeader, fileFormat, fileNameByUrl, fileThumb, fileThumbnailClasses, fileTypeByUrl, getFileNameFromContentDisposition, isImageFile, useDropzoneUploader };
|
|
@@ -1,39 +1,41 @@
|
|
|
1
1
|
import { a as a$5 } from '../../chunk-H5L4ARDB.js';
|
|
2
|
-
import { a } from '../../chunk-
|
|
2
|
+
import { a } from '../../chunk-4UVACODQ.js';
|
|
3
3
|
import { e } from '../../chunk-ANAHA3L6.js';
|
|
4
4
|
import { a as a$3 } from '../../chunk-2FXBVVBD.js';
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import { h, c, b } from '../../chunk-ORQNUG2V.js';
|
|
6
|
+
export { f as ContentType, g as FileContentType, c as compressImageWithoutCrop, b as convertToWebP, e as encodeFilenameForHeader, d as getFileNameFromContentDisposition, a as isImageFile, h as useFileUploadService } from '../../chunk-ORQNUG2V.js';
|
|
7
|
+
import { a as a$6 } from '../../chunk-RQ4T6IDM.js';
|
|
8
|
+
import '../../chunk-BPY2UXIB.js';
|
|
7
9
|
import '../../chunk-7AZX7L27.js';
|
|
8
|
-
import { a as a$2 } from '../../chunk-
|
|
10
|
+
import { a as a$2 } from '../../chunk-ZQDQI4FF.js';
|
|
9
11
|
import { x } from '../../chunk-2P4CXK3O.js';
|
|
10
12
|
import { a as a$7 } from '../../chunk-FK7DDO5L.js';
|
|
11
13
|
import { j } from '../../chunk-DMQW3LDF.js';
|
|
12
|
-
import { a as a$4 } from '../../chunk-
|
|
13
|
-
import '../../chunk-W3NEQX4G.js';
|
|
14
|
+
import { a as a$4 } from '../../chunk-BFAYY2AM.js';
|
|
14
15
|
import '../../chunk-FO7JCJ76.js';
|
|
16
|
+
import '../../chunk-JJM24URR.js';
|
|
15
17
|
import '../../chunk-ILHUUK4X.js';
|
|
16
18
|
import { a as a$8 } from '../../chunk-GFJT57TO.js';
|
|
17
19
|
import { a as a$1 } from '../../chunk-S7QQBC4I.js';
|
|
18
20
|
import { memo, forwardRef, useMemo, useLayoutEffect, useCallback, useRef, useState, useEffect } from 'react';
|
|
19
|
-
import
|
|
21
|
+
import jo from '@mui/material/FormHelperText';
|
|
20
22
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
21
23
|
import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter } from '@dnd-kit/core';
|
|
22
24
|
import { restrictToHorizontalAxis, restrictToParentElement, restrictToWindowEdges } from '@dnd-kit/modifiers';
|
|
23
25
|
import { useSortable, sortableKeyboardCoordinates, SortableContext, horizontalListSortingStrategy } from '@dnd-kit/sortable';
|
|
24
26
|
import { m, AnimatePresence } from 'framer-motion';
|
|
25
27
|
import he from '@mui/material/Stack';
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
28
|
+
import Ke from '@mui/material/Typography';
|
|
29
|
+
import Ee from '@mui/material/Box';
|
|
30
|
+
import Ho from '@mui/material/IconButton';
|
|
31
|
+
import No from '@mui/material/Paper';
|
|
30
32
|
import { styled, alpha } from '@mui/material/styles';
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
33
|
+
import Go from '@mui/material/Badge';
|
|
34
|
+
import Lr from '@mui/material/ButtonBase';
|
|
35
|
+
import zr from '@mui/material/Tooltip';
|
|
34
36
|
import { useDropzone } from 'react-dropzone';
|
|
35
|
-
import
|
|
37
|
+
import St from '@mui/material/CircularProgress';
|
|
36
38
|
|
|
37
|
-
var $o=({helperText:e,disabled:o,isError:r})=>e?jsx(Ho,{error:r,sx:t=>({mx:"14px",color:o?t.palette.grey[500]:void 0}),children:e}):null,O=memo($o);var Me=styled(he)({position:"relative",width:"100%",borderRadius:8,overflow:"hidden","&:hover .actions":{display:"flex"}}),ke=styled(he)({position:"absolute",top:4,right:4,gap:.5,"& svg":{width:16,height:16}}),ao=styled(De,{shouldForwardProp:e=>!["isDragActive","isError","disabled"].includes(e)})(({theme:e,isDragActive:o,isError:r,disabled:t})=>({outline:"none",cursor:"pointer",overflow:"hidden",position:"relative",padding:e.spacing(5),borderRadius:e.shape.borderRadius,transition:e.transitions.create("padding"),backgroundColor:e.palette.background.neutral,border:`dashed 1px ${e.palette.divider}`,...o&&{opacity:.72},...r&&{color:e.palette.error.main,backgroundColor:e.palette.error.lighter,borderColor:e.palette.error.light},...t&&{opacity:.48,pointerEvents:"none"},"&:hover":{opacity:.72}}));styled(he)(({theme:e})=>({display:"none",position:"absolute",alignItems:"center",justifyContent:"center",flexDirection:"row",gap:12,width:"100%",height:"100%",backgroundColor:alpha(e.palette.primary.main,.9),zIndex:999,button:{"&, &:hover, &:focus":{backgroundColor:e.palette.background.paper}}}));var no=styled(qo)(({theme:e})=>({position:"relative",zIndex:999,pointerEvents:"auto",color:e.palette.grey[700],backgroundColor:e.palette.grey[100],"&:hover":{color:e.palette.grey[900],backgroundColor:e.palette.grey[300]}})),He=styled("div")({position:"relative",zIndex:1,userSelect:"none","&:hover":{zIndex:2}}),so=styled(he,{shouldForwardProp:e=>!["isDragging"].includes(e)})(({theme:e,width:o,isDragging:r})=>({width:o,height:100,alignItems:"center",display:"inline-flex",justifyContent:"center",margin:e.spacing(.5),padding:e.spacing(2,1,2,1),gap:e.spacing(1),borderRadius:e.spacing(1.25),overflow:"hidden",position:"relative",border:`solid 1px ${e.palette.divider}`,backgroundColor:e.palette.common.white,zIndex:1,transition:"box-shadow 150ms ease-in-out",boxShadow:r?`0 0 0 2px ${e.palette.primary.main}, ${e.customShadows.z8}, inset 0 0 0 1000px ${alpha(e.palette.primary.main,.06)}`:"0px 0px 0px 0px rgba(0, 0, 0, 0)"})),lo=styled(m.div)(({theme:e,width:o,isDragging:r})=>({width:o,height:60,alignItems:"center",display:"inline-flex",justifyContent:"center",margin:e.spacing(.5),padding:e.spacing(2),borderRadius:e.spacing(1.25),overflow:"hidden",position:"relative",border:`solid 1px ${e.palette.divider}`,backgroundColor:e.palette.common.white,zIndex:1,transition:"box-shadow 150ms ease-in-out",boxShadow:r?`0 0 0 2px ${e.palette.primary.main}, ${e.customShadows.z8}, inset 0 0 0 1000px ${alpha(e.palette.primary.main,.06)}`:"0px 0px 0px 0px rgba(0, 0, 0, 0)"})),po=styled(a)(({theme:e})=>({top:16,right:16,zIndex:9,position:"absolute",color:e.palette.common.white,backgroundColor:alpha(e.palette.grey[900],.72),"&:hover":{backgroundColor:alpha(e.palette.grey[900],.48)}})),mo=styled(De,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="disabled"&&e!=="hasError"})(({theme:e,isDragActive:o,disabled:r,hasError:t})=>({width:64,height:64,flexShrink:0,display:"flex",borderRadius:1,cursor:"pointer",alignItems:"center",color:e.palette.text.disabled,justifyContent:"center",backgroundColor:alpha(e.palette.grey[500],.08),border:`dashed 1px ${alpha(e.palette.grey[500],.16)}`,...o&&{opacity:.72},...r&&{opacity:.48,pointerEvents:"none"},...t&&{color:e.palette.error.main,borderColor:e.palette.error.main,backgroundColor:alpha(e.palette.error.main,.08)},"&:hover":{opacity:.72}})),co=styled(De)(({theme:e})=>({padding:e.spacing(1),top:0,left:0,width:"100%",height:"100%",position:"absolute",display:"flex",justifyContent:"center",alignItems:"center",transition:"all 0.3s ease-in-out",filter:"blur(0)","&:hover":{filter:"blur(3px)"}})),go=styled("img",{shouldForwardProp:e=>e!=="aspectRatio"&&e!=="isLoading"&&e!=="isUploading"&&e!=="maxWidth"&&e!=="maxHeight"&&e!=="cropSize"})(({theme:e,aspectRatio:o,maxWidth:r,maxHeight:t,isLoading:n,isUploading:s})=>({borderRadius:e.shape.borderRadius,objectFit:"cover",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%) scale(1)",filter:"blur(0)",zIndex:1,maxWidth:r,maxHeight:t,backgroundColor:e.palette.background.paper,aspectRatio:Math.abs(o),...Math.abs(o)>1?{width:"calc(100% - 16px)",height:void 0}:{width:void 0,height:"calc(100% - 16px)"},transition:"all 0.5s ease-in-out",...n||s?{opacity:0,filter:"blur(1.5rem)",transform:"translate(-50%, -50%) scale(0.7)"}:{},"&:hover":{transition:"all 0.2s ease-in-out"}})),uo=styled("img",{shouldForwardProp:e=>e!=="isLoading"&&e!=="isUploading"})(({isLoading:e,isUploading:o})=>({width:"100%",height:"100%",objectFit:"cover",top:0,left:0,filter:"blur(1.5rem)",transform:"scale(1.1)",position:"absolute",zIndex:0,transition:"opacity 0.3s ease-in-out",...e&&{opacity:0},...o&&{opacity:.7,filter:"blur(2rem)"}})),fo=styled(he)({width:"100%",height:"100%",position:"relative",overflow:"hidden",borderRadius:"50%",justifyContent:"center",alignItems:"center"});styled(Vo)(({theme:e})=>({py:1,px:2,mt:3,textAlign:"left",borderStyle:"dashed",borderColor:"error.main",backgroundColor:alpha(e.palette.error.main,.08)}));var $e=styled(De,{shouldForwardProp:e=>e!=="isError"&&e!=="hasFile"})(({theme:e,isError:o,hasFile:r})=>({top:0,gap:e.spacing(1),left:0,width:"100%",height:"100%",zIndex:9,display:"flex",borderRadius:"50%",position:"absolute",alignItems:"center",color:e.palette.text.disabled,flexDirection:"column",justifyContent:"center",backgroundColor:alpha(e.palette.grey[500],.08),transition:e.transitions.create(["opacity"],{duration:e.transitions.duration.shorter}),"&:hover":{opacity:.92},...o&&{color:e.palette.error.main},...r&&{zIndex:9,opacity:0,color:e.palette.common.white,backgroundColor:alpha(e.palette.common.black,.54)}})),xo=styled(he)({top:0,left:0,right:0,bottom:0,position:"absolute",zIndex:10,alignItems:"center",justifyContent:"center",opacity:.8});styled(he)(({theme:e})=>({padding:20,justifyContent:"center",alignItems:"center",gap:4,alignSelf:"stretch",borderRadius:12,background:e.palette.divider,color:e.palette.text.disabled,height:160}));var ho=styled(De,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="isError"&&e!=="hasFile"})(({theme:e,isDragActive:o,disabled:r,isError:t,hasFile:n})=>({padding:e.spacing(1),margin:"auto",width:144,height:144,cursor:"pointer",overflow:"hidden",borderRadius:"50%",border:`1px dashed ${e.palette.divider}`,...o&&{opacity:.72},...r&&{opacity:.48,pointerEvents:"none"},...t&&{borderColor:"error.main"},...n&&{...t&&{bgcolor:alpha(e.palette.error.main,.08)},"&:hover .upload-placeholder":{opacity:1},"& img":{filter:"blur(0)"},"&:hover img":{filter:"blur(3px)"}}})),bo=styled("img")({width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover",transition:"all 0.3s ease-in-out"}),Io=styled(a)(({theme:e})=>({backgroundColor:alpha(e.palette.grey[900],.72),color:e.palette.common.white,"&:hover":{backgroundColor:alpha(e.palette.grey[600],.64),color:e.palette.common.white},"& svg":{width:14,height:14}}));var Yo=({onRemove:e,sx:o,file:r,disableDrag:t,attributes:n,listeners:s,innerWidth:i,isDragging:d})=>{let p=r?.id;return p?jsx(Qo,{anchorOrigin:{vertical:"top",horizontal:"left"},children:jsxs(lo,{width:i,isDragging:d,"data-testid":`preview-multi-img-${p}`,...j().inUp,sx:o,children:[jsx(a$2,{disableDrag:t,...n,...s}),jsx(Ee,{imageView:!0,file:r}),jsx(ke,{sx:{position:"absolute",right:3,top:3,zIndex:1},children:e&&jsx(Io,{size:"small",label:"Remover arquivo",onClick:()=>e(r),icon:"DELETE_MARK_BUTTON_02"})})]})},`badge-${p}`):null},Po=memo(Yo);var ir=({file:e$1,thumbnail:o,onRemove:r,sx:t,disableDrag:n=!1})=>{let s=e$1.size||0,i=e$1.name||e$1.id,d=e$1.id,p=typeof e$1=="string",m=n?70:80,{attributes:l,listeners:u,setNodeRef:b,transform:F,transition:R,isDragging:I}=useSortable({id:d,disabled:n}),C={transform:x.Transform.toString(F),transition:R,display:"inline-block",alignItems:"center",justifyContent:"center",width:`${m+8}px`,height:"68px"};return o&&e$1?jsx(He,{ref:b,style:C,children:jsx(Po,{innerWidth:m,isDragging:I,sx:t,file:e$1,disableDrag:n,attributes:l,listeners:u,onRemove:r})}):jsx(He,{ref:b,style:{...C,height:"80px",width:`${m+38}px`},children:jsxs(so,{width:m+30,isDragging:I,"data-testid":`preview-multi-img-${d}`,...j().inUp,sx:t,children:[jsx(a$2,{disableDrag:n,...l,...u}),e$1&&jsx(Ee,{file:e$1}),jsxs(he,{flexGrow:1,sx:{width:"100%"},children:[jsx(a$3,{title:i,children:jsx(Je,{variant:"subtitle2",noWrap:!0,children:i})}),jsx(Je,{variant:"caption",sx:{color:"text.secondary"},children:p?"":e(s)})]}),jsx(ke,{children:r&&jsx(a,{size:"small",label:"Remover arquivo",onClick:()=>r(e$1),icon:"DELETE_MARK_BUTTON_02"})})]})})},Fo=memo(ir);var Ir=({thumbnail:e,files:o,onRemove:r,onReorder:t,sx:n})=>{let s=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),i=useCallback(p=>{let{active:m,over:l}=p;if(!(!m||!l||m.id===l.id)&&t){let u=o.findIndex(({id:F})=>F===m.id),b=o.findIndex(({id:F})=>F===l.id);u!==-1&&b!==-1&&t(u,b,o);}},[o,t]),d=jsx(AnimatePresence,{initial:!1,children:o.map(p=>jsx(Fo,{sx:n,id:`preview-file-${p.id}`,file:p,onRemove:r,thumbnail:e,disableDrag:!t},`preview-file-${p.id}`))});return t?jsx(DndContext,{sensors:s,collisionDetection:closestCenter,onDragEnd:i,modifiers:[restrictToHorizontalAxis,restrictToParentElement,restrictToWindowEdges],children:jsx(SortableContext,{items:o.map(p=>p.id),strategy:horizontalListSortingStrategy,children:d})}):d},_e=memo(Ir);var Ao=forwardRef(({onLoading:e,aspectRatio:o,cropSize:r,...t},n)=>{let{maxWidth:s,maxHeight:i}=useMemo(()=>r&&typeof r=="object"?{maxWidth:r.width,maxHeight:r.height}:r&&typeof r=="number"?{maxWidth:r,maxHeight:r}:{maxWidth:"100%",maxHeight:"100%"},[r]);a$1(()=>{e?.(!0);}),useLayoutEffect(()=>{typeof n=="object"&&n?.current?e?.(!n.current.complete):e?.(!1);},[n,e]);function d(){e?.(!1);}return jsx(go,{...t,maxWidth:s,maxHeight:i,ref:n,aspectRatio:o,onLoad:d,onError:d})});Ao.displayName="LoadingPreviewImage";var Do=Ao;var Dr=({file:e,aspectRatio:o=1,isUploading:r,isLoading:t,onLoading:n,cropSize:s,maxWidth:i,maxHeight:d})=>{let p=useRef(null),m=e?.id||"",l=e?.name||"",u=URL.createObjectURL(e);return m?jsxs(co,{className:"single-file-preview-box",children:[jsx(Do,{className:"single-file-preview-img",aspectRatio:o,cropSize:s,isLoading:t,isUploading:r,alt:l,src:u,ref:p,loading:"lazy",onLoading:n,onLoad:()=>n?.(!1),onError:()=>n?.(!1),maxWidth:i,maxHeight:d},`image-preview-${m}`),jsx(uo,{className:"single-file-preview-bg",alt:l,src:u,isLoading:t,isUploading:r})]}):null},Xe=memo(Dr);var _r=["pdf"],Sr=["txt"],Tr=["psd"],Or=["doc","docx"],Ur=["xls","xlsx"],yr=["zip","rar","iso"],Cr=["ai","eps"],Lr=["ppt","pptx"],Mr=["wav","aif","mp3","aac"],kr=["jpg","jpeg","gif","bmp","png","svg","webp"],zr=["m4v","avi","mpg","mp4","webm"];function qe(e){let o,r=_o(e);return Sr.includes(r)?o="txt":yr.includes(r)?o="zip":Mr.includes(r)?o="audio":kr.includes(r)?o="image":zr.includes(r)?o="video":Or.includes(r)?o="word":Ur.includes(r)?o="excel":Lr.includes(r)?o="powerpoint":_r.includes(r)?o="pdf":Tr.includes(r)?o="photoshop":Cr.includes(r)?o="illustrator":e?.startsWith("http")?o="image":o=_o(e),o}function So(e){let o;switch(qe(e)){case"folder":o="IC_FOLDER";break;case"txt":o="IC_TXT";break;case"zip":o="IC_ZIP";break;case"audio":o="IC_AUDIO";break;case"video":o="IC_VIDEO";break;case"word":o="IC_WORD";break;case"excel":o="IC_EXCEL";break;case"powerpoint":o="IC_POWER_POINT";break;case"pdf":o="IC_PDF";break;case"photoshop":o="IC_PTS";break;case"illustrator":o="IC_AI";break;case"image":o="IC_IMG";break;default:o="IC_FILE";}return o}function _o(e){return e&&e.split(".").pop()||""}function ea(e){return e.split("/").pop()}var Ne={root:"mnl__file__thumbnail__root",img:"mnl__file__thumbnail__img",icon:"mnl__file__thumbnail__icon",removeBtn:"mnl__file__thumbnail__remove__button",downloadBtn:"mnl__file__thumbnail__download__button"},Ee=({sx:e,file:o,tooltip:r,onRemove:t,imageView:n,slotProps:s,onDownload:i,...d})=>{let p=URL.createObjectURL(o),m=o?.name||"",u=o.type.startsWith("image/")?"image":qe(p),b=jsx(De,{component:"img",src:p,className:Ne.img,sx:{width:1,height:1,objectFit:"cover",borderRadius:"inherit",...s?.img}}),F=jsx(a$4,{icon:So(u),sx:{width:32,height:32,flexShrink:0,...e}}),R=jsxs(he,{component:"span",className:Ne.root,sx:{width:36,height:36,flexShrink:0,borderRadius:1.25,alignItems:"center",position:"relative",display:"inline-flex",justifyContent:"center",...e},...d,children:[u==="image"&&n?b:F,t&&jsx(Br,{onClick:t,className:Ne.removeBtn,sx:s?.removeBtn,children:jsx(a$4,{icon:"CLOSE_MARK_BUTTON",width:24})}),i&&jsx(qo,{onClick:i,className:Ne.downloadBtn,sx:s?.downloadBtn,size:"small",children:jsx(a$4,{icon:"ARROW_DOWN_CICLE",width:12})})]});return r?jsx(jr,{arrow:!0,title:m,slotProps:{popper:{modifiers:[{name:"offset",options:{offset:[0,-12]}}]}},children:R}):R};var ma=e=>e.startsWith("image/"),To=(e,o=.8)=>new Promise((r,t)=>{let n=document.createElement("canvas"),s=n.getContext("2d"),i=new Image;i.onload=()=>{n.width=i.width,n.height=i.height,s?(s.drawImage(i,0,0),n.toBlob(d=>{if(d){let p=new File([d],e.name.replace(/\.[^/.]+$/,".webp"),{type:"image/webp",lastModified:Date.now()});r(p);}else t(new Error("Falha ao converter para WebP"));},"image/webp",o)):t(new Error("N\xE3o foi poss\xEDvel obter contexto do canvas"));},i.onerror=()=>t(new Error("Falha ao carregar imagem")),i.src=URL.createObjectURL(e);}),Oo=(e,o=.8,r,t)=>new Promise((n,s)=>{let i=document.createElement("canvas"),d=i.getContext("2d"),p=new Image;p.onload=()=>{let{width:m,height:l}=p;r&&m>r&&(l=l*r/m,m=r),t&&l>t&&(m=m*t/l,l=t),i.width=m,i.height=l,d?(d.imageSmoothingEnabled=!0,d.imageSmoothingQuality="high",d.drawImage(p,0,0,m,l),i.toBlob(u=>{if(u){let b=new File([u],e.name.replace(/\.[^/.]+$/,".webp"),{type:"image/webp",lastModified:Date.now()});n(b);}else s(new Error("Falha ao comprimir imagem"));},"image/webp",o)):s(new Error("N\xE3o foi poss\xEDvel obter contexto do canvas"));},p.onerror=()=>s(new Error("Falha ao carregar imagem")),p.src=URL.createObjectURL(e);}),Uo=e=>{let o=e.match(/filename\*=UTF-8''([^;]+)|filename="?([^";]+)"?/i);return o?.[1]||o?.[2]||""},yo=e=>`UTF-8''${encodeURIComponent(e)}`;var Vr=({onFilesSelect:e$1,onFileSelect:o,onReorder:r,onRemove:t,uploadFiles:n,filesPreview:s,dropzoneOptions:i,enableCrop:d=!1,customAspectRatio:p,convertToWebp:m=!0,cropSize:l,maxFiles:u,compressionQuality:b=.8,maxCompressedWidth:F,maxCompressedHeight:R})=>{let{showErrorMessage:I}=a$8(),C=useMemo(()=>p||(l&&typeof l!="number"?l.width/l.height:1),[p,l]),[v,c]=useState([]),[E,w]=useState(!1),[_,L]=useState(null),[f,h]=useState(null),[g,A]=useState(""),[M,S]=useState(!1),[T,N]=useState([]),[V,G]=useState(0),[se,oe]=useState(0),re=x=>{if(x.length<1)return;let P=x[0];L(P),G(y=>y+1);let D=new FileReader;D.onload=()=>{A(D.result),w(!0);},D.readAsDataURL(P);},le=(x,P)=>{h(P);},ge=async x=>!_||!f?null:new Promise(P=>{let D=document.createElement("canvas"),y=D.getContext("2d"),k=new Image;k.onload=async()=>{let{width:B,height:pe,x:Se,y:Wo}=f,Go=Math.abs(C),Te=B,Oe=pe;l&&typeof l=="object"?(Te=l.width,Oe=l.height):l&&typeof l=="number"&&(Te=l,Oe=l/Go),D.width=Te,D.height=Oe,y?(y.drawImage(k,Se,Wo,B,pe,0,0,Te,Oe),D.toBlob(async eo=>{if(eo){let Ze=new File([eo],_.name,{type:_.type,lastModified:Date.now()});if(m)try{Ze=await To(Ze,b);}catch(jo){I(jo,"Erro ao converter para WebP");}let oo=Ze;oo.id=x,P(oo);}else P(null);},"image/png")):P(null);},k.src=g;}),ue=async()=>{if(!(!_||!f||T.length===0)){S(!0);try{let x=T[0],P=await ge(x.id);if(P){let y=await n([P]);y&&(!e$1&&!o&&c(k=>[...k,...y]),e$1?.([...s||[],...y]),o?.(P));}w(!1),S(!1),A(""),L(null);let D=T.slice(1);N(D),re(D);}catch(x){I(x,"Erro ao processar imagem"),S(!1);}}},j=()=>{w(!1),S(!1),A(""),L(null),N([]),G(0),oe(0);},K=async x=>{if(x.length===0)return;let P=Object.keys(i?.accept||{}).some(y=>y.includes("image/")),D=v.length+x.length;if(u&&D>u){I(new Error(`M\xE1ximo de ${u} arquivos`),"Erro ao fazer upload");return}try{if(P&&d){let k=x.filter(B=>B.type.startsWith("image/")).map((B,pe)=>{let Se=B;return Se.id=`temp-crop-${Date.now()}-${pe}`,Se});oe(k.length),G(0),N(k),re(k);}else {let y=[];for(let B of x)if(B.type.startsWith("image/")&&m)try{let pe=await Oo(B,b,F,R);y.push(pe);}catch(pe){I(pe,"Erro ao comprimir imagem"),y.push(B);}else y.push(B);let k=await n(y);k&&(!e$1&&!o&&c(B=>[...B,...k]),e$1?.([...s||[],...k]),o?.(k[0]));}}catch(y){I(y,"Erro ao processar arquivos");}},J=x=>{if(!x.length)return;let P=x[0]?.errors[0]?.code,D=i?.maxSize||3145728;I(P==="file-too-large"?new Error(`O arquivo excede o tamanho m\xE1ximo de ${e(D)}`):P==="file-invalid-type"?new Error("Formato de arquivo n\xE3o suportado"):x[0]?.errors[0]||new Error("Erro ao enviar arquivo"),"Erro ao fazer upload");},{getRootProps:te,getInputProps:Z,isDragActive:a,isDragReject:fe,fileRejections:ie}=useDropzone({onDrop:K,onDropRejected:J,...i}),we=x=>{if(!x){t||c([]),t?.(void 0);return}let P=v.filter(D=>D.id!==x.id);t||c(P),t?.(x);},H=(x,P,D)=>{r?.(x,P,D);},xe=useRef("");return useEffect(()=>{let x=s?.map(P=>P.id).join(",")||"";x!==xe.current&&(xe.current=x,c(s||[]));},[s]),{file:v?.[0],files:v,aspectRatio:C,dropzoneProps:{getRootProps:te,getInputProps:Z,isDragActive:a,isDragReject:fe,fileRejections:ie},cropState:{cropModalOpen:E,imagePreview:g,cropLoading:M,setCropModalOpen:w,onCropInitialized:le,handleCropSave:ue,handleCropCancel:j,currentImageIndex:V,totalPendingImages:se},setInitialFiles:c,handleRemove:we,handleReorder:H}},X=Vr;var Ve=(a=>(a.APPLICATION_OCTET_STREAM="application/octet-stream",a.IMAGE_JPEG="image/jpeg",a.IMAGE_JPG="image/jpg",a.IMAGE_PNG="image/png",a.IMAGE_GIF="image/gif",a.IMAGE_WEBP="image/webp",a.IMAGE_SVG="image/svg+xml",a.IMAGE_BMP="image/bmp",a.IMAGE_TIFF="image/tiff",a.IMAGE_ICO="image/x-icon",a.IMAGE_AVIF="image/avif",a.APPLICATION_PDF="application/pdf",a.TEXT_PLAIN="text/plain",a.TEXT_CSV="text/csv",a.APPLICATION_RTF="application/rtf",a.APPLICATION_MSWORD="application/msword",a.APPLICATION_DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",a.APPLICATION_MSEXCEL="application/vnd.ms-excel",a.APPLICATION_XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",a.APPLICATION_MSPOWERPOINT="application/vnd.ms-powerpoint",a.APPLICATION_PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",a.APPLICATION_ODT="application/vnd.oasis.opendocument.text",a.APPLICATION_ODS="application/vnd.oasis.opendocument.spreadsheet",a.APPLICATION_ODP="application/vnd.oasis.opendocument.presentation",a.APPLICATION_XML="application/xml",a.TEXT_XML="text/xml",a.TEXT_HTML="text/html",a.TEXT_CSS="text/css",a.APPLICATION_JSON="application/json",a.TEXT_JAVASCRIPT="text/javascript",a.APPLICATION_ZIP="application/zip",a.APPLICATION_GZIP="application/gzip",a.APPLICATION_RAR="application/vnd.rar",a.APPLICATION_7Z="application/x-7z-compressed",a.AUDIO_MPEG="audio/mpeg",a.AUDIO_WAV="audio/wav",a.AUDIO_OGG="audio/ogg",a.AUDIO_WEBM="audio/webm",a.AUDIO_AAC="audio/aac",a.VIDEO_MP4="video/mp4",a.VIDEO_MPEG="video/mpeg",a.VIDEO_OGG="video/ogg",a.VIDEO_WEBM="video/webm",a.VIDEO_QUICKTIME="video/quicktime",a))(Ve||{}),Be=(e=>(e["application/octet-stream"]="APPLICATION_OCTET_STREAM",e["image/jpeg"]="IMAGE_JPEG",e["image/jpg"]="IMAGE_JPG",e["image/png"]="IMAGE_PNG",e["image/gif"]="IMAGE_GIF",e["image/webp"]="IMAGE_WEBP",e["image/svg+xml"]="IMAGE_SVG",e["image/bmp"]="IMAGE_BMP",e["image/tiff"]="IMAGE_TIFF",e["image/x-icon"]="IMAGE_ICO",e["image/avif"]="IMAGE_AVIF",e["application/pdf"]="APPLICATION_PDF",e["text/plain"]="TEXT_PLAIN",e["text/csv"]="TEXT_CSV",e["application/rtf"]="APPLICATION_RTF",e["application/msword"]="APPLICATION_MSWORD",e["application/vnd.openxmlformats-officedocument.wordprocessingml.document"]="APPLICATION_DOCX",e["application/vnd.ms-excel"]="APPLICATION_MSEXCEL",e["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"]="APPLICATION_XLSX",e["application/vnd.ms-powerpoint"]="APPLICATION_MSPOWERPOINT",e["application/vnd.openxmlformats-officedocument.presentationml.presentation"]="APPLICATION_PPTX",e["application/vnd.oasis.opendocument.text"]="APPLICATION_ODT",e["application/vnd.oasis.opendocument.spreadsheet"]="APPLICATION_ODS",e["application/vnd.oasis.opendocument.presentation"]="APPLICATION_ODP",e["application/xml"]="APPLICATION_XML",e["text/xml"]="TEXT_XML",e["text/html"]="TEXT_HTML",e["text/css"]="TEXT_CSS",e["application/json"]="APPLICATION_JSON",e["text/javascript"]="TEXT_JAVASCRIPT",e["application/zip"]="APPLICATION_ZIP",e["application/gzip"]="APPLICATION_GZIP",e["application/vnd.rar"]="APPLICATION_RAR",e["application/x-7z-compressed"]="APPLICATION_7Z",e["audio/mpeg"]="AUDIO_MPEG",e["audio/wav"]="AUDIO_WAV",e["audio/ogg"]="AUDIO_OGG",e["audio/webm"]="AUDIO_WEBM",e["audio/aac"]="AUDIO_AAC",e["video/mp4"]="VIDEO_MP4",e["video/mpeg"]="VIDEO_MPEG",e["video/ogg"]="VIDEO_OGG",e["video/webm"]="VIDEO_WEBM",e["video/quicktime"]="VIDEO_QUICKTIME",e))(Be||{});var Yr=({createFilesMutation:e,filesDetails:o})=>{let{showErrorMessage:r}=a$8(),[t,n]=useState(!1),[s,i]=useState(!1),[d,p]=useState(null),[m,l]=useState([]),u=useMemo(()=>m?.[0],[m]),b=s||t,F=useCallback(async v=>{if(!v.length){l([]),i(!1);return}i(!0);try{let E=(await Promise.all(v.map(async({url:w,id:_,name:L})=>{try{if(!w)return null;let f=await fetch(w);if(!f.ok)throw new Error(f.statusText);let h=await f.blob(),g=null;if(!L){let S=f.headers.get("content-disposition")||void 0;if(S){let T=Uo(S);if(T)try{g=decodeURIComponent(T);}catch{g=T;}}}let A=g||L||_,M=new File([h],A,{type:h.type});return M.id=_,M.url=w,M}catch{return null}}))).filter(Boolean);l(E),i(!1);}catch(c){r(c,"Erro ao carregar arquivos"),l([]),i(!1);}},[r]),R=useRef("");useEffect(()=>{let v=o?.map(({id:c})=>c).join(",")||"";v!==R.current&&(async()=>(R.current=v,await F(o)))();},[o,F]);let I=async v=>{if(!v||!Array.isArray(v))throw new Error("Arquivos inv\xE1lidos");let c=v.filter(E=>E instanceof File);if(c?.length){n(!0);try{let E=c.map(f=>{let h=f.type||"application/octet-stream",g=Be[h];if(!g)throw new Error(`Tipo de arquivo n\xE3o suportado: ${h}`);return {file:f,mimeType:h,contentTypeEnum:g}}),w=await e({files:E.map(({file:f,contentTypeEnum:h})=>({content_type:h,name:f.name}))}).unwrap(),_=w.files.map((f,h)=>{let g=E[h].file,A=g;return A.id=f.id,A.url=URL.createObjectURL(g),A});return await(await Promise.all(w.files.map((f,h)=>{let{mimeType:g}=E[h],A=_[h];return fetch(f.url,{method:"PUT",headers:{"Content-Type":g,"Content-Disposition":`inline; filename*=${yo(A.name)}`,"X-File-Id":f.id},body:A})}))).forEach(async f=>{if(!f.ok)throw new Error("Erro no upload do arquivo.")}),_}catch(E){throw p(E),r(E,"Erro no upload"),E}finally{n(!1);}}},C=useMemo(()=>d&&d instanceof Error?d.message:d,[d]);return {setFilesPreview:l,uploadFiles:I,filesPreview:m,filePreview:u,isLoadingPreview:s,isUploadingFiles:t,isUploadOrLoadingFiles:b,uploadErrorText:C}},q=Yr;var ot=({sx:e,id:o,name:r,tabIndex:t,uploading:n,getRootProps:s,getInputProps:i,isDragActive:d,isError:p,disabled:m,dropZoneSxProps:l,dropZoneContent:u,children:b,...F})=>jsxs(Me,{children:[n&&jsx(a$7,{"data-testid":"uploading-progress-bar",sx:{zIndex:1}}),jsxs(De,{sx:{width:1,position:"relative",...e},children:[jsxs(ao,{...s(),"data-testid":"drop-zone-styled-area",isError:p,isDragActive:d,disabled:!!m,sx:l,...F,children:[jsx("input",{...i(),id:o,tabIndex:t,name:r}),u]}),b]})]}),de=ot;var it=({header:e,description:o,sx:r,...t})=>jsxs(he,{spacing:5,alignItems:"center",justifyContent:"center",direction:{xs:"column",md:"row"},sx:{width:1,textAlign:{xs:"center",md:"left"},...r},...t,children:[jsx(a$5,{sx:{width:220}}),jsxs("div",{children:[jsx(Je,{gutterBottom:!0,variant:"h5",children:e||"Soltar ou selecionar arquivos"}),jsx(Je,{variant:"body2",sx:{color:"text.secondary"},children:o||jsxs(Fragment,{children:["Solte os arquivos aqui ou clique",jsx(Je,{variant:"body2",component:"span",sx:{mx:.5,color:"primary.main",textDecoration:"underline"},children:"procurar"}),"na sua m\xE1quina"]})})]})]}),me=memo(it);var pt=({onRemove:e,onReorder:o,onFilesSelect:r,createFilesMutation:t,filesDetails:n=[],id:s,disabled:i,error:d,helperText:p,thumbnail:m,dropZoneSxProps:l,uploading:u,tabIndex:b,maxFiles:F,placeholderAlt:R,placeholderProps:I,...C})=>{let{filesPreview:v,isUploadOrLoadingFiles:c,uploadErrorText:E,uploadFiles:w}=q({createFilesMutation:t,filesDetails:n}),{files:_,dropzoneProps:L,handleRemove:f,handleReorder:h}=X({onFilesSelect:r,onReorder:o,onRemove:e,filesPreview:v,dropzoneOptions:{multiple:!0,disabled:i,...C},maxFiles:F,uploadFiles:w}),{getRootProps:g,getInputProps:A,isDragActive:M,isDragReject:S}=L,T=!!_?.filter(V=>!!V.id).length,N=S||!!d||!!E;return jsxs(de,{id:s,uploading:u||c,disabled:i,dropZoneSxProps:l,tabIndex:b,getRootProps:g,getInputProps:A,isDragActive:M,isError:N,dropZoneContent:jsx(Fragment,{children:R?jsx(he,{children:R}):jsx(me,{header:I?.header,description:I?.description})}),children:[jsx(O,{disabled:i,helperText:p,isError:N}),d?jsx(O,{helperText:d,isError:!0}):null,E?jsx(O,{helperText:E,isError:!0}):null,T&&jsx(De,{sx:{my:3},children:jsx(_e,{files:_,thumbnail:!!m,onRemove:e?f:void 0,onReorder:o?h:void 0})})]})},dt=memo(pt);var ht=({onRemove:e,onReorder:o,onFilesSelect:r,createFilesMutation:t,filesDetails:n=[],id:s,disabled:i,error:d,helperText:p,dropZoneSxProps:m,placeholderProps:l,placeholderAlt:u,uploading:b,tabIndex:F,maxFiles:R,aspectRatio:I,enableCrop:C=!0,convertToWebp:v=!0,cropSize:c,name:E,label:w,..._})=>{let{filesPreview:L,isUploadOrLoadingFiles:f,uploadErrorText:h,uploadFiles:g}=q({createFilesMutation:t,filesDetails:n}),A=b||f,{files:M,dropzoneProps:S,cropState:T,aspectRatio:N,handleRemove:V,handleReorder:G}=X({onFilesSelect:r,onReorder:o,onRemove:e,filesPreview:L,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!0,disabled:i,..._},enableCrop:C,customAspectRatio:I,convertToWebp:v,maxFiles:R,cropSize:c,uploadFiles:g}),{getRootProps:se,getInputProps:oe,isDragActive:re,isDragReject:le}=S,{cropModalOpen:ge,imagePreview:ue,cropLoading:j,onCropInitialized:K,handleCropSave:J,handleCropCancel:te,currentImageIndex:Z,totalPendingImages:a}=T,fe=!!M?.filter(H=>!!H.id).length,ie=le||!!d||!!h,we=useMemo(()=>{let H=w??"Ajustar Imagem",xe=a>1||Z>1?` (${Z} de ${a})`:"";return `${H}${xe}`},[w,a,Z]);return jsxs(de,{id:s,name:E,uploading:A,disabled:i,dropZoneSxProps:m,tabIndex:F,getRootProps:se,getInputProps:oe,isDragActive:re,isError:ie,dropZoneContent:jsx(Fragment,{children:u?jsx(he,{children:u}):jsx(me,{header:l?.header,description:l?.description})}),children:[jsx(O,{disabled:i,helperText:p,isError:ie}),d?jsx(O,{helperText:d,isError:!0}):null,h?jsx(O,{helperText:h,isError:!0}):null,fe&&jsx(De,{sx:{my:3,ml:.5},children:jsx(_e,{files:M,thumbnail:!0,onRemove:V,onReorder:o?G:void 0})}),jsx(a$6,{open:ge,onClose:te,label:we,imageSrc:ue,aspectRatio:N,onInitialized:K,onSave:J,loading:j,cropSize:c})]})},bt=memo(ht);var wt=({onFileSelect:e$1,onRemove:o,createFilesMutation:r,fileDetails:t,id:n,disabled:s,error:i,helperText:d,sx:p,dropZoneSxProps:m$1,uploading:l,tabIndex:u,...b})=>{let{filesPreview:F,isUploadOrLoadingFiles:R,uploadErrorText:I,uploadFiles:C}=q({createFilesMutation:r,filesDetails:t?[t]:[]}),v=R||l,{file:c,dropzoneProps:E,handleRemove:w}=X({uploadFiles:C,onFileSelect:e$1,onRemove:o,filesPreview:F,dropzoneOptions:{multiple:!1,disabled:s,...b}}),{getRootProps:_,getInputProps:L,isDragActive:f,isDragReject:h}=E,g=useCallback(T=>{T.stopPropagation(),w(c||void 0);},[c,w]),A=!!c,M=typeof c=="string",S=h||!!i||!!I;return jsxs(de,{id:n,uploading:v,disabled:s,dropZoneSxProps:m$1,tabIndex:u,getRootProps:_,getInputProps:L,isDragActive:f,isError:S,dropZoneContent:jsxs(Fragment,{children:[!A&&jsx(me,{}),A&&jsxs(he,{component:m.div,...j().inUp,spacing:2,direction:"row",alignItems:"center",sx:{my:1,px:1,py:.75,borderRadius:.75,border:T=>`solid 1px ${T.palette.divider}`,...p},children:[jsx(Ee,{file:c}),jsxs(he,{flexGrow:1,sx:{minWidth:0},children:[jsx(Je,{variant:"subtitle2",noWrap:!0,children:M?c:c.name}),jsx(Je,{variant:"caption",sx:{color:"text.secondary"},children:M?"":e(c.size)})]}),o&&jsx(a$3,{title:"Remover arquivo",children:jsx(no,{edge:"end",size:"small",disabled:s,"aria-label":"Remover arquivo",onClick:g,children:jsx(a$4,{icon:"DELETE_MARK_BUTTON_02",width:16})})})]})]}),children:[jsx(O,{disabled:s,helperText:d,isError:S}),i?jsx(O,{helperText:i,isError:!0}):null,I?jsx(O,{helperText:I,isError:!0}):null]})},At=memo(wt);var Ut=({onRemove:e,onFileSelect:o,createFilesMutation:r,fileDetails:t,id:n,disabled:s,error:i,helperText:d,dropZoneSxProps:p,placeholderProps:m,placeholderAlt:l,uploading:u,tabIndex:b,aspectRatio:F,enableCrop:R=!0,convertToWebp:I=!0,name:C,label:v,cropSize:c,sx:E,maxWidth:w,maxHeight:_,compressionQuality:L=.8,maxCompressedWidth:f,maxCompressedHeight:h,...g})=>{let{filesPreview:A,isUploadOrLoadingFiles:M,uploadErrorText:S,uploadFiles:T}=q({createFilesMutation:r,filesDetails:t?[t]:[]}),[N,V]=useState(!1),{file:G,dropzoneProps:se,cropState:oe,handleRemove:re,aspectRatio:le}=X({onFileSelect:o,onRemove:e,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:s,...g},filesPreview:A,enableCrop:R,customAspectRatio:F,convertToWebp:I,cropSize:c,uploadFiles:T,compressionQuality:L,maxCompressedWidth:f,maxCompressedHeight:h}),{getRootProps:ge,getInputProps:ue,isDragActive:j,isDragReject:K}=se,{cropModalOpen:J,imagePreview:te,cropLoading:Z,onCropInitialized:a,handleCropSave:fe,handleCropCancel:ie}=oe,we=useCallback(()=>{re(G||void 0);},[G,re]),H=!!G,xe=K||!!i||!!S,x=u||M,P=H?{opacity:0}:{opacity:1},D=p?.width;return useEffect(()=>{H||V(!1);},[H]),jsxs(Me,{sx:{...E,...D&&{width:D}},children:[(x||N)&&jsx(a$7,{}),jsxs(de,{id:n,uploading:x,disabled:s,dropZoneSxProps:p,tabIndex:b,getRootProps:ge,getInputProps:ue,isDragActive:j,isError:xe,name:C,dropZoneContent:jsxs(Fragment,{children:[l?jsx(he,{sx:P,children:l}):jsx(me,{sx:P,header:m?.title,description:m?.description}),H&&jsx(Xe,{file:G,cropSize:c,isLoading:N,isUploading:x,onLoading:V,aspectRatio:le,maxWidth:w,maxHeight:_})]}),children:[jsx(O,{disabled:s,helperText:d,isError:xe}),i?jsx(O,{helperText:i,isError:!0}):null,S?jsx(O,{helperText:S,isError:!0}):null,H&&e&&jsx(po,{size:"small",onClick:we,disabled:s,label:"Remover arquivo",children:jsx(a$4,{icon:"DELETE_MARK_BUTTON_02",width:16})}),jsx(a$6,{open:J,onClose:ie,label:v??"Ajustar Imagem",imageSrc:te,aspectRatio:le,onInitialized:a,onSave:fe,loading:Z,cropSize:c})]})]})},yt=memo(Ut);var Bt=({onRemove:e,onFileSelect:o,createFilesMutation:r,fileDetails:t,disabled:n,label:s,id:i,tabIndex:d,error:p,helperText:m,sx:l,name:u,maxSize:b,uploading:F,aspectRatio:R=1,enableCrop:I=!0,convertToWebp:C=!0,cropSize:v,...c})=>{let[E,w]=useState(!1),{filesPreview:_,isUploadOrLoadingFiles:L,uploadErrorText:f,uploadFiles:h}=q({createFilesMutation:r,filesDetails:t?[t]:[]}),{file:g,dropzoneProps:A,cropState:M,handleRemove:S}=X({filesPreview:_,onFileSelect:o,onRemove:e,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:n,maxSize:b,...c},enableCrop:I,customAspectRatio:R,convertToWebp:C,cropSize:v,uploadFiles:h}),{getRootProps:T,getInputProps:N,isDragActive:V,isDragReject:G}=A,{cropModalOpen:se,imagePreview:oe,cropLoading:re,onCropInitialized:le,handleCropSave:ge,handleCropCancel:ue}=M,j=G||!!p||!!f,K=E||L||F,J=!!e,te=useRef(t?.url||""),Z=useRef();useEffect(()=>{if(!g){te.current="",Z.current=void 0;return}if(Z.current===g.id)return;Z.current=g.id,w(!0);let ie=URL.createObjectURL(g);return te.current=ie,()=>{URL.revokeObjectURL(ie);}},[g]);let a=()=>{w(!1);},fe=useCallback(()=>J&&g?()=>S(g):T().onClick,[J,g,T,S]);return jsxs(Fragment,{children:[jsxs(he,{sx:{alignItems:"center"},children:[jsxs(ho,{sx:l,isError:j,isDragActive:V,hasFile:!!g,...T(),onClick:fe(),children:[jsxs(fo,{children:[K&&jsx(xo,{children:jsx(Nt,{size:135,thickness:2,color:"primary"})}),g&&jsx(bo,{alt:"Avatar Preview",src:te.current,onLoad:a,...K&&{sx:{filter:"blur(5px) !important",scale:1.2,opacity:.7}}}),!g&&!K&&jsxs($e,{isError:j,hasFile:!1,children:[jsx(a$4,{icon:"ADD_IMAGE",width:32}),jsx(Je,{variant:"caption",textAlign:"center",sx:{color:j?"error.main":"text.disabled"},children:"Adicionar foto"})]}),g&&!K&&jsxs($e,{isError:j,hasFile:!0,children:[jsx(a$4,{icon:J?"DELETE_MARK_BUTTON_02":"ADD_IMAGE",width:32}),jsx(Je,{variant:"caption",textAlign:"center",sx:{color:j?"error.main":"common.white"},children:J?"Remover foto":"Alterar foto"})]})]}),jsx("input",{name:u,id:i,tabIndex:d,...N()})]}),jsx(he,{sx:{alignItems:"center",mt:-.5},children:jsx(O,{helperText:m,disabled:n,isError:j})}),f?jsx(O,{helperText:f,isError:!0}):null,p?jsx(O,{helperText:p,isError:!0}):null]}),se&&oe&&jsx(a$6,{open:se,onClose:ue,label:s??"Ajustar Imagem",imageSrc:oe,aspectRatio:R,onInitialized:le,onSave:ge,loading:re,cropSize:v,cropShape:"round"})]})},Wt=memo(Bt);var Ht=({error:e,name:o,disabled:r,sx:t,...n})=>{let{getRootProps:s,getInputProps:i,isDragActive:d,isDragReject:p}=useDropzone({disabled:r,...n}),m=p||e;return jsxs(mo,{...s(),isDragActive:d,hasError:!!m,disabled:!!r,sx:t,"data-testid":"upload-box",children:[jsx("input",{name:o,...i()}),"Selecionar arquivo"]})},$t=memo(Ht);
|
|
39
|
+
var Zo=({helperText:e,disabled:o,isError:r})=>e?jsx(jo,{error:r,sx:t=>({mx:"14px",color:o?t.palette.grey[500]:void 0}),children:e}):null,I=memo(Zo);var Be=styled(he)({position:"relative",width:"100%",borderRadius:8,overflow:"hidden","&:hover .actions":{display:"flex"}}),Le=styled(he)({position:"absolute",top:4,right:4,gap:.5,"& svg":{width:16,height:16}}),io=styled(Ee,{shouldForwardProp:e=>!["isDragActive","isError","disabled"].includes(e)})(({theme:e,isDragActive:o,isError:r,disabled:t})=>({outline:"none",cursor:"pointer",overflow:"hidden",position:"relative",padding:e.spacing(5),borderRadius:e.shape.borderRadius,transition:e.transitions.create("padding"),backgroundColor:e.palette.background.neutral,border:`dashed 1px ${e.palette.divider}`,...o&&{opacity:.72},...r&&{color:e.palette.error.main,backgroundColor:e.palette.error.lighter,borderColor:e.palette.error.light},...t&&{opacity:.48,pointerEvents:"none"},"&:hover":{opacity:.72}}));styled(he)(({theme:e})=>({display:"none",position:"absolute",alignItems:"center",justifyContent:"center",flexDirection:"row",gap:12,width:"100%",height:"100%",backgroundColor:alpha(e.palette.primary.main,.9),zIndex:999,button:{"&, &:hover, &:focus":{backgroundColor:e.palette.background.paper}}}));var ao=styled(Ho)(({theme:e})=>({position:"relative",zIndex:999,pointerEvents:"auto",color:e.palette.grey[700],backgroundColor:e.palette.grey[100],"&:hover":{color:e.palette.grey[900],backgroundColor:e.palette.grey[300]}})),Ze=styled("div")({position:"relative",zIndex:1,userSelect:"none","&:hover":{zIndex:2}}),no=styled(he,{shouldForwardProp:e=>!["isDragging"].includes(e)})(({theme:e,width:o,isDragging:r})=>({width:o,height:100,alignItems:"center",display:"inline-flex",justifyContent:"center",margin:e.spacing(.5),padding:e.spacing(2,1,2,1),gap:e.spacing(1),borderRadius:e.spacing(1.25),overflow:"hidden",position:"relative",border:`solid 1px ${e.palette.divider}`,backgroundColor:e.palette.common.white,zIndex:1,transition:"box-shadow 150ms ease-in-out",boxShadow:r?`0 0 0 2px ${e.palette.primary.main}, ${e.customShadows.z8}, inset 0 0 0 1000px ${alpha(e.palette.primary.main,.06)}`:"0px 0px 0px 0px rgba(0, 0, 0, 0)"})),so=styled(m.div)(({theme:e,width:o,isDragging:r})=>({width:o,height:60,alignItems:"center",display:"inline-flex",justifyContent:"center",margin:e.spacing(.5),padding:e.spacing(2),borderRadius:e.spacing(1.25),overflow:"hidden",position:"relative",border:`solid 1px ${e.palette.divider}`,backgroundColor:e.palette.common.white,zIndex:1,transition:"box-shadow 150ms ease-in-out",boxShadow:r?`0 0 0 2px ${e.palette.primary.main}, ${e.customShadows.z8}, inset 0 0 0 1000px ${alpha(e.palette.primary.main,.06)}`:"0px 0px 0px 0px rgba(0, 0, 0, 0)"})),lo=styled(a)(({theme:e})=>({top:16,right:16,zIndex:9,position:"absolute",color:e.palette.common.white,backgroundColor:alpha(e.palette.grey[900],.72),"&:hover":{backgroundColor:alpha(e.palette.grey[900],.48)}})),po=styled(Ee,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="disabled"&&e!=="hasError"})(({theme:e,isDragActive:o,disabled:r,hasError:t})=>({width:64,height:64,flexShrink:0,display:"flex",borderRadius:1,cursor:"pointer",alignItems:"center",color:e.palette.text.disabled,justifyContent:"center",backgroundColor:alpha(e.palette.grey[500],.08),border:`dashed 1px ${alpha(e.palette.grey[500],.16)}`,...o&&{opacity:.72},...r&&{opacity:.48,pointerEvents:"none"},...t&&{color:e.palette.error.main,borderColor:e.palette.error.main,backgroundColor:alpha(e.palette.error.main,.08)},"&:hover":{opacity:.72}})),mo=styled(Ee)(({theme:e})=>({padding:e.spacing(1),top:0,left:0,width:"100%",height:"100%",position:"absolute",display:"flex",justifyContent:"center",alignItems:"center",transition:"all 0.3s ease-in-out",filter:"blur(0)","&:hover":{filter:"blur(3px)"}})),co=styled("img",{shouldForwardProp:e=>e!=="aspectRatio"&&e!=="isLoading"&&e!=="isUploading"&&e!=="maxWidth"&&e!=="maxHeight"&&e!=="cropSize"})(({theme:e,aspectRatio:o,maxWidth:r,maxHeight:t,isLoading:i,isUploading:a})=>({borderRadius:e.shape.borderRadius,objectFit:"cover",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%) scale(1)",filter:"blur(0)",zIndex:1,maxWidth:r,maxHeight:t,backgroundColor:e.palette.background.paper,aspectRatio:Math.abs(o),...Math.abs(o)>1?{width:"calc(100% - 16px)",height:void 0}:{width:void 0,height:"calc(100% - 16px)"},transition:"all 0.5s ease-in-out",...i||a?{opacity:0,filter:"blur(1.5rem)",transform:"translate(-50%, -50%) scale(0.7)"}:{},"&:hover":{transition:"all 0.2s ease-in-out"}})),go=styled("img",{shouldForwardProp:e=>e!=="isLoading"&&e!=="isUploading"})(({isLoading:e,isUploading:o})=>({width:"100%",height:"100%",objectFit:"cover",top:0,left:0,filter:"blur(1.5rem)",transform:"scale(1.1)",position:"absolute",zIndex:0,transition:"opacity 0.3s ease-in-out",...e&&{opacity:0},...o&&{opacity:.7,filter:"blur(2rem)"}})),uo=styled(he)({width:"100%",height:"100%",position:"relative",overflow:"hidden",borderRadius:"50%",justifyContent:"center",alignItems:"center"});styled(No)(({theme:e})=>({py:1,px:2,mt:3,textAlign:"left",borderStyle:"dashed",borderColor:"error.main",backgroundColor:alpha(e.palette.error.main,.08)}));var $e=styled(Ee,{shouldForwardProp:e=>e!=="isError"&&e!=="hasFile"})(({theme:e,isError:o,hasFile:r})=>({top:0,gap:e.spacing(1),left:0,width:"100%",height:"100%",zIndex:9,display:"flex",borderRadius:"50%",position:"absolute",alignItems:"center",color:e.palette.text.disabled,flexDirection:"column",justifyContent:"center",backgroundColor:alpha(e.palette.grey[500],.08),transition:e.transitions.create(["opacity"],{duration:e.transitions.duration.shorter}),"&:hover":{opacity:.92},...o&&{color:e.palette.error.main},...r&&{zIndex:9,opacity:0,color:e.palette.common.white,backgroundColor:alpha(e.palette.common.black,.54)}})),fo=styled(he)({top:0,left:0,right:0,bottom:0,position:"absolute",zIndex:10,alignItems:"center",justifyContent:"center",opacity:.8});styled(he)(({theme:e})=>({padding:20,justifyContent:"center",alignItems:"center",gap:4,alignSelf:"stretch",borderRadius:12,background:e.palette.divider,color:e.palette.text.disabled,height:160}));var xo=styled(Ee,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="isError"&&e!=="hasFile"})(({theme:e,isDragActive:o,disabled:r,isError:t,hasFile:i})=>({padding:e.spacing(1),margin:"auto",width:144,height:144,cursor:"pointer",overflow:"hidden",borderRadius:"50%",border:`1px dashed ${e.palette.divider}`,...o&&{opacity:.72},...r&&{opacity:.48,pointerEvents:"none"},...t&&{borderColor:"error.main"},...i&&{...t&&{bgcolor:alpha(e.palette.error.main,.08)},"&:hover .upload-placeholder":{opacity:1},"& img":{filter:"blur(0)"},"&:hover img":{filter:"blur(3px)"}}})),ho=styled("img")({width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover",transition:"all 0.3s ease-in-out"}),bo=styled(a)(({theme:e})=>({backgroundColor:alpha(e.palette.grey[900],.72),color:e.palette.common.white,"&:hover":{backgroundColor:alpha(e.palette.grey[600],.64),color:e.palette.common.white},"& svg":{width:14,height:14}}));var Xo=({onRemove:e,sx:o,file:r,disableDrag:t,attributes:i,listeners:a,innerWidth:n,isDragging:p})=>{let s=r?.id;return s?jsx(Go,{anchorOrigin:{vertical:"top",horizontal:"left"},children:jsxs(so,{width:n,isDragging:p,"data-testid":`preview-multi-img-${s}`,...j().inUp,sx:o,children:[jsx(a$2,{disableDrag:t,...i,...a}),jsx(Pe,{imageView:!0,file:r}),jsx(Le,{sx:{position:"absolute",right:3,top:3,zIndex:1},children:e&&jsx(bo,{size:"small",label:"Remover arquivo",onClick:()=>e(r),icon:"DELETE_MARK_BUTTON_02"})})]})},`badge-${s}`):null},vo=memo(Xo);var er=({file:e$1,thumbnail:o,onRemove:r,sx:t,disableDrag:i=!1})=>{let a$1=e$1.size||0,n=e$1.name||e$1.id,p=e$1.id,s=typeof e$1=="string",d=i?70:80,{attributes:l,listeners:c,setNodeRef:h,transform:v,transition:P,isDragging:f}=useSortable({id:p,disabled:i}),T={transform:x.Transform.toString(v),transition:P,display:"inline-block",alignItems:"center",justifyContent:"center",width:`${d+8}px`,height:"68px"};return o&&e$1?jsx(Ze,{ref:h,style:T,children:jsx(vo,{innerWidth:d,isDragging:f,sx:t,file:e$1,disableDrag:i,attributes:l,listeners:c,onRemove:r})}):jsx(Ze,{ref:h,style:{...T,height:"80px",width:`${d+38}px`},children:jsxs(no,{width:d+30,isDragging:f,"data-testid":`preview-multi-img-${p}`,...j().inUp,sx:t,children:[jsx(a$2,{disableDrag:i,...l,...c}),e$1&&jsx(Pe,{file:e$1}),jsxs(he,{flexGrow:1,sx:{width:"100%"},children:[jsx(a$3,{title:n,children:jsx(Ke,{variant:"subtitle2",noWrap:!0,children:n})}),jsx(Ke,{variant:"caption",sx:{color:"text.secondary"},children:s?"":e(a$1)})]}),jsx(Le,{children:r&&jsx(a,{size:"small",label:"Remover arquivo",onClick:()=>r(e$1),icon:"DELETE_MARK_BUTTON_02"})})]})})},Po=memo(er);var fr=({thumbnail:e,files:o,onRemove:r,onReorder:t,sx:i})=>{let a=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),n=useCallback(s=>{let{active:d,over:l}=s;if(!(!d||!l||d.id===l.id)&&t){let c=o.findIndex(({id:v})=>v===d.id),h=o.findIndex(({id:v})=>v===l.id);c!==-1&&h!==-1&&t(c,h,o);}},[o,t]),p=jsx(AnimatePresence,{initial:!1,children:o.map(s=>jsx(Po,{sx:i,id:`preview-file-${s.id}`,file:s,onRemove:r,thumbnail:e,disableDrag:!t},`preview-file-${s.id}`))});return t?jsx(DndContext,{sensors:a,collisionDetection:closestCenter,onDragEnd:n,modifiers:[restrictToHorizontalAxis,restrictToParentElement,restrictToWindowEdges],children:jsx(SortableContext,{items:o.map(s=>s.id),strategy:horizontalListSortingStrategy,children:p})}):p},De=memo(fr);var Fo=forwardRef(({onLoading:e,aspectRatio:o,cropSize:r,...t},i)=>{let{maxWidth:a,maxHeight:n}=useMemo(()=>r&&typeof r=="object"?{maxWidth:r.width,maxHeight:r.height}:r&&typeof r=="number"?{maxWidth:r,maxHeight:r}:{maxWidth:"100%",maxHeight:"100%"},[r]);a$1(()=>{e?.(!0);}),useLayoutEffect(()=>{typeof i=="object"&&i?.current?e?.(!i.current.complete):e?.(!1);},[i,e]);function p(){e?.(!1);}return jsx(co,{...t,maxWidth:a,maxHeight:n,ref:i,aspectRatio:o,onLoad:p,onError:p})});Fo.displayName="LoadingPreviewImage";var Co=Fo;var Pr=({file:e,aspectRatio:o=1,isUploading:r,isLoading:t,onLoading:i,cropSize:a,maxWidth:n,maxHeight:p})=>{let s=useRef(null),d=e?.id||"",l=e?.name||"",c=URL.createObjectURL(e);return d?jsxs(mo,{className:"single-file-preview-box",children:[jsx(Co,{className:"single-file-preview-img",aspectRatio:o,cropSize:a,isLoading:t,isUploading:r,alt:l,src:c,ref:s,loading:"lazy",onLoading:i,onLoad:()=>i?.(!1),onError:()=>i?.(!1),maxWidth:n,maxHeight:p},`image-preview-${d}`),jsx(go,{className:"single-file-preview-bg",alt:l,src:c,isLoading:t,isUploading:r})]}):null},He=memo(Pr);var Fr=["pdf"],Cr=["txt"],Er=["psd"],Tr=["doc","docx"],Dr=["xls","xlsx"],Rr=["zip","rar","iso"],Ur=["ai","eps"],Sr=["ppt","pptx"],Ar=["wav","aif","mp3","aac"],_r=["jpg","jpeg","gif","bmp","png","svg","webp"],kr=["m4v","avi","mpg","mp4","webm"];function Ne(e){let o,r=To(e);return Cr.includes(r)?o="txt":Rr.includes(r)?o="zip":Ar.includes(r)?o="audio":_r.includes(r)?o="image":kr.includes(r)?o="video":Tr.includes(r)?o="word":Dr.includes(r)?o="excel":Sr.includes(r)?o="powerpoint":Fr.includes(r)?o="pdf":Er.includes(r)?o="photoshop":Ur.includes(r)?o="illustrator":e?.startsWith("http")?o="image":o=To(e),o}function Do(e){let o;switch(Ne(e)){case"folder":o="IC_FOLDER";break;case"txt":o="IC_TXT";break;case"zip":o="IC_ZIP";break;case"audio":o="IC_AUDIO";break;case"video":o="IC_VIDEO";break;case"word":o="IC_WORD";break;case"excel":o="IC_EXCEL";break;case"powerpoint":o="IC_POWER_POINT";break;case"pdf":o="IC_PDF";break;case"photoshop":o="IC_PTS";break;case"illustrator":o="IC_AI";break;case"image":o="IC_IMG";break;default:o="IC_FILE";}return o}function To(e){return e&&e.split(".").pop()||""}function Xi(e){return e.split("/").pop()}var Oe={root:"mnl__file__thumbnail__root",img:"mnl__file__thumbnail__img",icon:"mnl__file__thumbnail__icon",removeBtn:"mnl__file__thumbnail__remove__button",downloadBtn:"mnl__file__thumbnail__download__button"},Pe=({sx:e,file:o,tooltip:r,onRemove:t,imageView:i,slotProps:a,onDownload:n,...p})=>{let s=URL.createObjectURL(o),d=o?.name||"",c=o.type.startsWith("image/")?"image":Ne(s),h=jsx(Ee,{component:"img",src:s,className:Oe.img,sx:{width:1,height:1,objectFit:"cover",borderRadius:"inherit",...a?.img}}),v=jsx(a$4,{icon:Do(c),sx:{width:32,height:32,flexShrink:0,...e}}),P=jsxs(he,{component:"span",className:Oe.root,sx:{width:36,height:36,flexShrink:0,borderRadius:1.25,alignItems:"center",position:"relative",display:"inline-flex",justifyContent:"center",...e},...p,children:[c==="image"&&i?h:v,t&&jsx(Lr,{onClick:t,className:Oe.removeBtn,sx:a?.removeBtn,children:jsx(a$4,{icon:"CLOSE_MARK_BUTTON",width:24})}),n&&jsx(Ho,{onClick:n,className:Oe.downloadBtn,sx:a?.downloadBtn,size:"small",children:jsx(a$4,{icon:"ARROW_DOWN_CICLE",width:12})})]});return r?jsx(zr,{arrow:!0,title:d,slotProps:{popper:{modifiers:[{name:"offset",options:{offset:[0,-12]}}]}},children:P}):P};var Nr=({onFilesSelect:e$1,onFileSelect:o,onReorder:r,onRemove:t,uploadFiles:i,filesPreview:a,dropzoneOptions:n,enableCrop:p=!1,customAspectRatio:s,convertToWebp:d=!0,cropSize:l,maxFiles:c$1,compressionQuality:h=.8,maxCompressedWidth:v,maxCompressedHeight:P})=>{let{showErrorMessage:f}=a$8(),T=useMemo(()=>s||(l&&typeof l!="number"?l.width/l.height:1),[s,l]),[D,g]=useState([]),[k,C]=useState(!1),[R,B]=useState(null),[U,L]=useState(null),[x,S]=useState(""),[M,w]=useState(!1),[E,O]=useState([]),[G,j]=useState(0),[se,ee]=useState(0),oe=m=>{if(m.length<1)return;let u=m[0];B(u),j(F=>F+1);let b=new FileReader;b.onload=()=>{S(b.result),C(!0);},b.readAsDataURL(u);},le=(m,u)=>{L(u);},ge=async m=>!R||!U?null:new Promise(u=>{let b$1=document.createElement("canvas"),F=b$1.getContext("2d"),A=new Image;A.onload=async()=>{let{width:z,height:pe,x:Re,y:Bo}=U,Lo=Math.abs(T),Ue=z,Se=pe;l&&typeof l=="object"?(Ue=l.width,Se=l.height):l&&typeof l=="number"&&(Ue=l,Se=l/Lo),b$1.width=Ue,b$1.height=Se,F?(F.drawImage(A,Re,Bo,z,pe,0,0,Ue,Se),b$1.toBlob(async Ve=>{if(Ve){let je=new File([Ve],R.name,{type:R.type,lastModified:Date.now()});if(d)try{je=await b(je,h);}catch(Mo){f(Mo,"Erro ao converter para WebP");}let Je=je;Je.id=m,u(Je);}else u(null);},"image/png")):u(null);},A.src=x;}),ue=async()=>{if(!(!R||!U||E.length===0)){w(!0);try{let m=E[0],u=await ge(m.id);if(u){let F=await i([u]);F&&(!e$1&&!o&&g(A=>[...A,...F]),e$1?.([...a||[],...F]),o?.(u));}C(!1),w(!1),S(""),B(null);let b=E.slice(1);O(b),oe(b);}catch(m){f(m,"Erro ao processar imagem"),w(!1);}}},Z=()=>{C(!1),w(!1),S(""),B(null),O([]),j(0),ee(0);},X=async m=>{if(m.length===0)return;let u=Object.keys(n?.accept||{}).some(F=>F.includes("image/")),b=D.length+m.length;if(c$1&&b>c$1){f(new Error(`M\xE1ximo de ${c$1} arquivos`),"Erro ao fazer upload");return}try{if(u&&p){let A=m.filter(z=>z.type.startsWith("image/")).map((z,pe)=>{let Re=z;return Re.id=`temp-crop-${Date.now()}-${pe}`,Re});ee(A.length),j(0),O(A),oe(A);}else {let F=[];for(let z of m)if(z.type.startsWith("image/")&&d)try{let pe=await c(z,h,v,P);F.push(pe);}catch(pe){f(pe,"Erro ao comprimir imagem"),F.push(z);}else F.push(z);let A=await i(F);A&&(!e$1&&!o&&g(z=>[...z,...A]),e$1?.([...a||[],...A]),o?.(A[0]));}}catch(F){f(F,"Erro ao processar arquivos");}},V=m=>{if(!m.length)return;let u=m[0]?.errors[0]?.code,b=n?.maxSize||3145728;f(u==="file-too-large"?new Error(`O arquivo excede o tamanho m\xE1ximo de ${e(b)}`):u==="file-invalid-type"?new Error("Formato de arquivo n\xE3o suportado"):m[0]?.errors[0]||new Error("Erro ao enviar arquivo"),"Erro ao fazer upload");},{getRootProps:re,getInputProps:$,isDragActive:te,isDragReject:fe,fileRejections:ie}=useDropzone({onDrop:X,onDropRejected:V,...n}),Fe=m=>{if(!m){t||g([]),t?.(void 0);return}let u=D.filter(b=>b.id!==m.id);t||g(u),t?.(m);},H=(m,u,b)=>{r?.(m,u,b);},xe=useRef("");return useEffect(()=>{let m=a?.map(u=>u.id).join(",")||"";m!==xe.current&&(xe.current=m,g(a||[]));},[a]),{file:D?.[0],files:D,aspectRatio:T,dropzoneProps:{getRootProps:re,getInputProps:$,isDragActive:te,isDragReject:fe,fileRejections:ie},cropState:{cropModalOpen:k,imagePreview:x,cropLoading:M,setCropModalOpen:C,onCropInitialized:le,handleCropSave:ue,handleCropCancel:Z,currentImageIndex:G,totalPendingImages:se},setInitialFiles:g,handleRemove:Fe,handleReorder:H}},K=Nr;var Kr=({sx:e,id:o,name:r,tabIndex:t,uploading:i,getRootProps:a,getInputProps:n,isDragActive:p,isError:s,disabled:d,dropZoneSxProps:l,dropZoneContent:c,children:h,...v})=>jsxs(Be,{children:[i&&jsx(a$7,{"data-testid":"uploading-progress-bar",sx:{zIndex:1}}),jsxs(Ee,{sx:{width:1,position:"relative",...e},children:[jsxs(io,{...a(),"data-testid":"drop-zone-styled-area",isError:s,isDragActive:p,disabled:!!d,sx:l,...v,children:[jsx("input",{...n(),id:o,tabIndex:t,name:r}),c]}),h]})]}),de=Kr;var Vr=({header:e,description:o,sx:r,...t})=>jsxs(he,{spacing:5,alignItems:"center",justifyContent:"center",direction:{xs:"column",md:"row"},sx:{width:1,textAlign:{xs:"center",md:"left"},...r},...t,children:[jsx(a$5,{sx:{width:220}}),jsxs("div",{children:[jsx(Ke,{gutterBottom:!0,variant:"h5",children:e||"Soltar ou selecionar arquivos"}),jsx(Ke,{variant:"body2",sx:{color:"text.secondary"},children:o||jsxs(Fragment,{children:["Solte os arquivos aqui ou clique",jsx(Ke,{variant:"body2",component:"span",sx:{mx:.5,color:"primary.main",textDecoration:"underline"},children:"procurar"}),"na sua m\xE1quina"]})})]})]}),me=memo(Vr);var ot=({onRemove:e,onReorder:o,onFilesSelect:r,createFilesMutation:t,filesDetails:i=[],id:a,disabled:n,error:p,helperText:s,thumbnail:d,dropZoneSxProps:l,uploading:c,tabIndex:h$1,maxFiles:v,placeholderAlt:P,placeholderProps:f,...T})=>{let{filesPreview:D,isUploadOrLoadingFiles:g,uploadErrorText:k,uploadFiles:C}=h({createFilesMutation:t,filesDetails:i}),{files:R,dropzoneProps:B,handleRemove:U,handleReorder:L}=K({onFilesSelect:r,onReorder:o,onRemove:e,filesPreview:D,dropzoneOptions:{multiple:!0,disabled:n,...T},maxFiles:v,uploadFiles:C}),{getRootProps:x,getInputProps:S,isDragActive:M,isDragReject:w}=B,E=!!R?.filter(G=>!!G.id).length,O=w||!!p||!!k;return jsxs(de,{id:a,uploading:c||g,disabled:n,dropZoneSxProps:l,tabIndex:h$1,getRootProps:x,getInputProps:S,isDragActive:M,isError:O,dropZoneContent:jsx(Fragment,{children:P?jsx(he,{children:P}):jsx(me,{header:f?.header,description:f?.description})}),children:[jsx(I,{disabled:n,helperText:s,isError:O}),p?jsx(I,{helperText:p,isError:!0}):null,k?jsx(I,{helperText:k,isError:!0}):null,E&&jsx(Ee,{sx:{my:3},children:jsx(De,{files:R,thumbnail:!!d,onRemove:e?U:void 0,onReorder:o?L:void 0})})]})},rt=memo(ot);var pt=({onRemove:e,onReorder:o,onFilesSelect:r,createFilesMutation:t,filesDetails:i=[],id:a,disabled:n,error:p,helperText:s,dropZoneSxProps:d,placeholderProps:l,placeholderAlt:c,uploading:h$1,tabIndex:v,maxFiles:P,aspectRatio:f,enableCrop:T=!0,convertToWebp:D=!0,cropSize:g,name:k,label:C,...R})=>{let{filesPreview:B,isUploadOrLoadingFiles:U,uploadErrorText:L,uploadFiles:x}=h({createFilesMutation:t,filesDetails:i}),S=h$1||U,{files:M,dropzoneProps:w,cropState:E,aspectRatio:O,handleRemove:G,handleReorder:j}=K({onFilesSelect:r,onReorder:o,onRemove:e,filesPreview:B,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!0,disabled:n,...R},enableCrop:T,customAspectRatio:f,convertToWebp:D,maxFiles:P,cropSize:g,uploadFiles:x}),{getRootProps:se,getInputProps:ee,isDragActive:oe,isDragReject:le}=w,{cropModalOpen:ge,imagePreview:ue,cropLoading:Z,onCropInitialized:X,handleCropSave:V,handleCropCancel:re,currentImageIndex:$,totalPendingImages:te}=E,fe=!!M?.filter(H=>!!H.id).length,ie=le||!!p||!!L,Fe=useMemo(()=>{let H=C??"Ajustar Imagem",xe=te>1||$>1?` (${$} de ${te})`:"";return `${H}${xe}`},[C,te,$]);return jsxs(de,{id:a,name:k,uploading:S,disabled:n,dropZoneSxProps:d,tabIndex:v,getRootProps:se,getInputProps:ee,isDragActive:oe,isError:ie,dropZoneContent:jsx(Fragment,{children:c?jsx(he,{children:c}):jsx(me,{header:l?.header,description:l?.description})}),children:[jsx(I,{disabled:n,helperText:s,isError:ie}),p?jsx(I,{helperText:p,isError:!0}):null,L?jsx(I,{helperText:L,isError:!0}):null,fe&&jsx(Ee,{sx:{my:3,ml:.5},children:jsx(De,{files:M,thumbnail:!0,onRemove:G,onReorder:o?j:void 0})}),jsx(a$6,{open:ge,onClose:re,label:Fe,imageSrc:ue,aspectRatio:O,onInitialized:X,onSave:V,loading:Z,cropSize:g})]})},dt=memo(pt);var xt=({onFileSelect:e$1,onRemove:o,createFilesMutation:r,fileDetails:t,id:i,disabled:a,error:n,helperText:p,sx:s,dropZoneSxProps:d,uploading:l,tabIndex:c,...h$1})=>{let{filesPreview:v,isUploadOrLoadingFiles:P,uploadErrorText:f,uploadFiles:T}=h({createFilesMutation:r,filesDetails:t?[t]:[]}),D=P||l,{file:g,dropzoneProps:k,handleRemove:C}=K({uploadFiles:T,onFileSelect:e$1,onRemove:o,filesPreview:v,dropzoneOptions:{multiple:!1,disabled:a,...h$1}}),{getRootProps:R,getInputProps:B,isDragActive:U,isDragReject:L}=k,x=useCallback(E=>{E.stopPropagation(),C(g||void 0);},[g,C]),S=!!g,M=typeof g=="string",w=L||!!n||!!f;return jsxs(de,{id:i,uploading:D,disabled:a,dropZoneSxProps:d,tabIndex:c,getRootProps:R,getInputProps:B,isDragActive:U,isError:w,dropZoneContent:jsxs(Fragment,{children:[!S&&jsx(me,{}),S&&jsxs(he,{component:m.div,...j().inUp,spacing:2,direction:"row",alignItems:"center",sx:{my:1,px:1,py:.75,borderRadius:.75,border:E=>`solid 1px ${E.palette.divider}`,...s},children:[jsx(Pe,{file:g}),jsxs(he,{flexGrow:1,sx:{minWidth:0},children:[jsx(Ke,{variant:"subtitle2",noWrap:!0,children:M?g:g.name}),jsx(Ke,{variant:"caption",sx:{color:"text.secondary"},children:M?"":e(g.size)})]}),o&&jsx(a$3,{title:"Remover arquivo",children:jsx(ao,{edge:"end",size:"small",disabled:a,"aria-label":"Remover arquivo",onClick:x,children:jsx(a$4,{icon:"DELETE_MARK_BUTTON_02",width:16})})})]})]}),children:[jsx(I,{disabled:a,helperText:p,isError:w}),n?jsx(I,{helperText:n,isError:!0}):null,f?jsx(I,{helperText:f,isError:!0}):null]})},ht=memo(xt);var Ft=({onRemove:e,onFileSelect:o,createFilesMutation:r,fileDetails:t,id:i,disabled:a,error:n,helperText:p,dropZoneSxProps:s,placeholderProps:d,placeholderAlt:l,uploading:c,tabIndex:h$1,aspectRatio:v,enableCrop:P=!0,convertToWebp:f=!0,name:T,label:D,cropSize:g,sx:k,maxWidth:C,maxHeight:R,compressionQuality:B=.8,maxCompressedWidth:U,maxCompressedHeight:L,...x})=>{let{filesPreview:S,isUploadOrLoadingFiles:M,uploadErrorText:w,uploadFiles:E}=h({createFilesMutation:r,filesDetails:t?[t]:[]}),[O,G]=useState(!1),{file:j,dropzoneProps:se,cropState:ee,handleRemove:oe,aspectRatio:le}=K({onFileSelect:o,onRemove:e,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:a,...x},filesPreview:S,enableCrop:P,customAspectRatio:v,convertToWebp:f,cropSize:g,uploadFiles:E,compressionQuality:B,maxCompressedWidth:U,maxCompressedHeight:L}),{getRootProps:ge,getInputProps:ue,isDragActive:Z,isDragReject:X}=se,{cropModalOpen:V,imagePreview:re,cropLoading:$,onCropInitialized:te,handleCropSave:fe,handleCropCancel:ie}=ee,Fe=useCallback(()=>{oe(j||void 0);},[j,oe]),H=!!j,xe=X||!!n||!!w,m=c||M,u=H?{opacity:0}:{opacity:1},b=s?.width;return useEffect(()=>{H||G(!1);},[H]),jsxs(Be,{sx:{...k,...b&&{width:b}},children:[(m||O)&&jsx(a$7,{}),jsxs(de,{id:i,uploading:m,disabled:a,dropZoneSxProps:s,tabIndex:h$1,getRootProps:ge,getInputProps:ue,isDragActive:Z,isError:xe,name:T,dropZoneContent:jsxs(Fragment,{children:[l?jsx(he,{sx:u,children:l}):jsx(me,{sx:u,header:d?.title,description:d?.description}),H&&jsx(He,{file:j,cropSize:g,isLoading:O,isUploading:m,onLoading:G,aspectRatio:le,maxWidth:C,maxHeight:R})]}),children:[jsx(I,{disabled:a,helperText:p,isError:xe}),n?jsx(I,{helperText:n,isError:!0}):null,w?jsx(I,{helperText:w,isError:!0}):null,H&&e&&jsx(lo,{size:"small",onClick:Fe,disabled:a,label:"Remover arquivo",children:jsx(a$4,{icon:"DELETE_MARK_BUTTON_02",width:16})}),jsx(a$6,{open:V,onClose:ie,label:D??"Ajustar Imagem",imageSrc:re,aspectRatio:le,onInitialized:te,onSave:fe,loading:$,cropSize:g})]})]})},Ct=memo(Ft);var At=({onRemove:e,onFileSelect:o,createFilesMutation:r,fileDetails:t,disabled:i,label:a,id:n,tabIndex:p,error:s,helperText:d,sx:l,name:c,maxSize:h$1,uploading:v,aspectRatio:P=1,enableCrop:f=!0,convertToWebp:T=!0,cropSize:D,...g})=>{let[k,C]=useState(!1),{filesPreview:R,isUploadOrLoadingFiles:B,uploadErrorText:U,uploadFiles:L}=h({createFilesMutation:r,filesDetails:t?[t]:[]}),{file:x,dropzoneProps:S,cropState:M,handleRemove:w}=K({filesPreview:R,onFileSelect:o,onRemove:e,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:i,maxSize:h$1,...g},enableCrop:f,customAspectRatio:P,convertToWebp:T,cropSize:D,uploadFiles:L}),{getRootProps:E,getInputProps:O,isDragActive:G,isDragReject:j}=S,{cropModalOpen:se,imagePreview:ee,cropLoading:oe,onCropInitialized:le,handleCropSave:ge,handleCropCancel:ue}=M,Z=j||!!s||!!U,X=k||B||v,V=!!e,re=useRef(t?.url||""),$=useRef();useEffect(()=>{if(!x){re.current="",$.current=void 0;return}if($.current===x.id)return;$.current=x.id,C(!0);let ie=URL.createObjectURL(x);return re.current=ie,()=>{URL.revokeObjectURL(ie);}},[x]);let te=()=>{C(!1);},fe=useCallback(()=>V&&x?()=>w(x):E().onClick,[V,x,E,w]);return jsxs(Fragment,{children:[jsxs(he,{sx:{alignItems:"center"},children:[jsxs(xo,{sx:l,isError:Z,isDragActive:G,hasFile:!!x,...E(),onClick:fe(),children:[jsxs(uo,{children:[X&&jsx(fo,{children:jsx(St,{size:135,thickness:2,color:"primary"})}),x&&jsx(ho,{alt:"Avatar Preview",src:re.current,onLoad:te,...X&&{sx:{filter:"blur(5px) !important",scale:1.2,opacity:.7}}}),!x&&!X&&jsxs($e,{isError:Z,hasFile:!1,children:[jsx(a$4,{icon:"ADD_IMAGE",width:32}),jsx(Ke,{variant:"caption",textAlign:"center",sx:{color:Z?"error.main":"text.disabled"},children:"Adicionar foto"})]}),x&&!X&&jsxs($e,{isError:Z,hasFile:!0,children:[jsx(a$4,{icon:V?"DELETE_MARK_BUTTON_02":"ADD_IMAGE",width:32}),jsx(Ke,{variant:"caption",textAlign:"center",sx:{color:Z?"error.main":"common.white"},children:V?"Remover foto":"Alterar foto"})]})]}),jsx("input",{name:c,id:n,tabIndex:p,...O()})]}),jsx(he,{sx:{alignItems:"center",mt:-.5},children:jsx(I,{helperText:d,disabled:i,isError:Z})}),U?jsx(I,{helperText:U,isError:!0}):null,s?jsx(I,{helperText:s,isError:!0}):null]}),se&&ee&&jsx(a$6,{open:se,onClose:ue,label:a??"Ajustar Imagem",imageSrc:ee,aspectRatio:P,onInitialized:le,onSave:ge,loading:oe,cropSize:D,cropShape:"round"})]})},_t=memo(At);var Mt=({error:e,name:o,disabled:r,sx:t,...i})=>{let{getRootProps:a,getInputProps:n,isDragActive:p,isDragReject:s}=useDropzone({disabled:r,...i}),d=s||e;return jsxs(po,{...a(),isDragActive:p,hasError:!!d,disabled:!!r,sx:t,"data-testid":"upload-box",children:[jsx("input",{name:o,...n()}),"Selecionar arquivo"]})},Ot=memo(Mt);
|
|
38
40
|
|
|
39
|
-
export {
|
|
41
|
+
export { Pe as FileThumbnail, I as HelperText, De as MultiFilePreview, rt as MultipleFileUpload, dt as MultipleImageUpload, He as SingleFilePreview, ht as SingleFileUpload, Ct as SingleImageUpload, _t as UploadAvatar, Ot as UploadSimpleBox, Ne as fileFormat, Xi as fileNameByUrl, Do as fileThumb, Oe as fileThumbnailClasses, To as fileTypeByUrl, K as useDropzoneUploader };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a } from '../../chunk-NPXVOPB2.js';
|
|
2
2
|
import { a as a$2 } from '../../chunk-26GV7WKC.js';
|
|
3
|
-
import { a as a$3 } from '../../chunk-
|
|
4
|
-
import '../../chunk-W3NEQX4G.js';
|
|
3
|
+
import { a as a$3 } from '../../chunk-BFAYY2AM.js';
|
|
5
4
|
import '../../chunk-FO7JCJ76.js';
|
|
5
|
+
import '../../chunk-JJM24URR.js';
|
|
6
6
|
import { a as a$1 } from '../../chunk-KXEOEE4L.js';
|
|
7
7
|
import '../../chunk-S7QQBC4I.js';
|
|
8
8
|
import '../../chunk-QQDMA4TE.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as default } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
import '../../chunk-W3NEQX4G.js';
|
|
1
|
+
export { a as default } from '../../chunk-DSFPGTNS.js';
|
|
2
|
+
import '../../chunk-BFAYY2AM.js';
|
|
4
3
|
import '../../chunk-FO7JCJ76.js';
|
|
4
|
+
import '../../chunk-JJM24URR.js';
|