formik-form-components 0.2.14 → 0.2.15

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/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  import { useFormikContext, Formik, Form as Form$1, ErrorMessage } from 'formik';
2
- import { forwardRef, createElement, useState, useEffect, useCallback } from 'react';
3
- import { Box, useTheme, FormControl, Typography, FormHelperText, TextField, InputLabel, FormLabel, RadioGroup, FormControlLabel, Radio, Stack, Rating, Autocomplete, MenuItem, Chip, Switch, InputAdornment, IconButton, Checkbox, Tooltip, Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress, Paper, Avatar } from '@mui/material';
2
+ import { forwardRef, memo, createElement, useState, useEffect } from 'react';
3
+ import { Box, useTheme, FormControl, Typography, FormHelperText, TextField, InputLabel, FormLabel, RadioGroup, FormControlLabel, Radio, Stack, Rating, Autocomplete, MenuItem, Chip, Switch, InputAdornment, IconButton, Checkbox, Tooltip, Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress, Paper, Menu } from '@mui/material';
4
4
  import { DatePicker } from '@mui/x-date-pickers/DatePicker';
5
5
  import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
6
6
  import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
7
7
  import { Dayjs } from 'dayjs';
8
- import _, { get } from 'lodash';
8
+ import _19, { get } from 'lodash';
9
9
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
10
10
  import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
11
11
  import Autocomplete3 from '@mui/material/Autocomplete';
@@ -32,8 +32,11 @@ import UndoIcon from '@mui/icons-material/Undo';
32
32
  import RedoIcon from '@mui/icons-material/Redo';
33
33
  import CloudUploadIcon from '@mui/icons-material/CloudUpload';
34
34
  import CloseIcon from '@mui/icons-material/Close';
35
- import { Image, InsertDriveFile, Delete as Delete$1 } from '@mui/icons-material';
35
+ import { styled, alpha, useTheme as useTheme$1 } from '@mui/material/styles';
36
+ import { LazyLoadImage } from 'react-lazy-load-image-component';
37
+ import { AnimatePresence, m } from 'framer-motion';
36
38
  import { useDropzone } from 'react-dropzone';
39
+ import { useTranslation } from 'react-i18next';
37
40
 
38
41
  // src/Form/index.tsx
39
42
  var AppDatePicker = forwardRef(
@@ -57,9 +60,9 @@ var AppDatePicker = forwardRef(
57
60
  ...otherProps
58
61
  }, ref) => {
59
62
  const { values, setFieldValue, touched, errors, setFieldTouched } = useFormikContext();
60
- const fieldValue = _.get(values, name);
61
- const fieldError = _.get(errors, name);
62
- const isTouched = _.get(touched, name);
63
+ const fieldValue = _19.get(values, name);
64
+ const fieldError = _19.get(errors, name);
65
+ const isTouched = _19.get(touched, name);
63
66
  const handleChange = (newValue, context) => {
64
67
  setFieldValue(name, newValue);
65
68
  if (externalOnChange) {
@@ -375,8 +378,8 @@ function AppFormErrorMessage({
375
378
  textSx
376
379
  }) {
377
380
  const { errors, touched } = useFormikContext();
378
- const fieldError = _.get(errors, name);
379
- const isTouched = _.get(touched, name);
381
+ const fieldError = _19.get(errors, name);
382
+ const isTouched = _19.get(touched, name);
380
383
  const showError = fieldError && typeof fieldError === "string";
381
384
  if (alwaysShow) {
382
385
  return showError ? /* @__PURE__ */ jsx(
@@ -453,9 +456,9 @@ var AppTextArea = forwardRef(({
453
456
  }, ref) => {
454
457
  var _a, _b, _c, _d;
455
458
  const { errors, getFieldProps, touched, setFieldValue } = useFormikContext();
456
- const fieldError = _.get(errors, name);
457
- const isTouched = _.get(touched, name);
458
- const value = _.get(getFieldProps(name), "value", "");
459
+ const fieldError = _19.get(errors, name);
460
+ const isTouched = _19.get(touched, name);
461
+ const value = _19.get(getFieldProps(name), "value", "");
459
462
  const handleChange = (e) => {
460
463
  const newValue = e.target.value;
461
464
  if (maxLength && newValue.length > maxLength)
@@ -609,9 +612,9 @@ function AppTagsCreator({
609
612
  inputSx
610
613
  }) {
611
614
  const { errors, touched, getFieldProps, values, setFieldValue, setTouched } = useFormikContext();
612
- const fieldError = _.get(errors, name);
613
- const isTouched = _.get(touched, name);
614
- const val = _.get(values, name);
615
+ const fieldError = _19.get(errors, name);
616
+ const isTouched = _19.get(touched, name);
617
+ const val = _19.get(values, name);
615
618
  return /* @__PURE__ */ jsxs(
616
619
  FormControl,
617
620
  {
@@ -734,8 +737,8 @@ function AppSwitchInput({
734
737
  ...otherProps
735
738
  }) {
736
739
  const { errors, touched, setFieldValue, values } = useFormikContext();
737
- const fieldError = _.get(errors, name);
738
- const isTouched = _.get(touched, name);
740
+ const fieldError = _19.get(errors, name);
741
+ const isTouched = _19.get(touched, name);
739
742
  return /* @__PURE__ */ jsxs(
740
743
  Box,
741
744
  {
@@ -824,9 +827,9 @@ function AppSwitch({
824
827
  ...otherProps
825
828
  }) {
826
829
  const { errors, touched, setFieldValue, values } = useFormikContext();
827
- const fieldValue = _.get(values, name);
828
- const fieldError = _.get(errors, name);
829
- const isTouched = _.get(touched, name);
830
+ const fieldValue = _19.get(values, name);
831
+ const fieldError = _19.get(errors, name);
832
+ const isTouched = _19.get(touched, name);
830
833
  return /* @__PURE__ */ jsxs(
831
834
  Stack,
832
835
  {
@@ -923,9 +926,9 @@ function AppAutoComplete({
923
926
  errorSx
924
927
  }) {
925
928
  const { errors, touched, getFieldProps, values, setFieldValue } = useFormikContext();
926
- const fieldError = _.get(errors, name);
927
- const isTouched = _.get(touched, name);
928
- const formikValue = _.get(values, name);
929
+ const fieldError = _19.get(errors, name);
930
+ const isTouched = _19.get(touched, name);
931
+ const formikValue = _19.get(values, name);
929
932
  const val = propValue !== void 0 ? propValue : formikValue || [];
930
933
  return /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, variant: "filled", sx: formControlSx, children: [
931
934
  /* @__PURE__ */ jsx(
@@ -997,9 +1000,9 @@ function AppAutoCompleter({
997
1000
  errorSx
998
1001
  }) {
999
1002
  const { errors, touched, values, setFieldValue } = useFormikContext();
1000
- const fieldError = _.get(errors, name);
1001
- const isTouched = _.get(touched, name);
1002
- const value = _.get(values, name);
1003
+ const fieldError = _19.get(errors, name);
1004
+ const isTouched = _19.get(touched, name);
1005
+ const value = _19.get(values, name);
1003
1006
  const selectedOption = options.find((opt) => opt.value === value) || null;
1004
1007
  return /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, variant: "filled", sx: formControlSx, children: [
1005
1008
  /* @__PURE__ */ jsx(
@@ -1062,8 +1065,8 @@ var AppCheckBox = ({
1062
1065
  ...rest
1063
1066
  }) => {
1064
1067
  const { getFieldProps, setFieldValue, touched, errors } = useFormikContext();
1065
- const fieldError = _.get(errors, name);
1066
- const isTouched = _.get(touched, name);
1068
+ const fieldError = _19.get(errors, name);
1069
+ const isTouched = _19.get(touched, name);
1067
1070
  useTheme();
1068
1071
  const value = getFieldProps(name).value;
1069
1072
  const checkedValues = (() => {
@@ -1226,8 +1229,8 @@ function AppInputField({
1226
1229
  ...otherProps
1227
1230
  }) {
1228
1231
  const { errors, getFieldProps, touched } = useFormikContext();
1229
- const fieldError = _.get(errors, name);
1230
- const isTouched = _.get(touched, name);
1232
+ const fieldError = _19.get(errors, name);
1233
+ const isTouched = _19.get(touched, name);
1231
1234
  const [showPassword, setShowPassword] = useState(false);
1232
1235
  const handleShowPassword = () => {
1233
1236
  setShowPassword(!showPassword);
@@ -1318,9 +1321,9 @@ var AppMultiSelector = forwardRef(
1318
1321
  }, ref) => {
1319
1322
  const theme = useTheme();
1320
1323
  const { errors, touched, values, setFieldValue, setFieldTouched } = useFormikContext();
1321
- const fieldError = _.get(errors, name);
1322
- const isTouched = _.get(touched, name);
1323
- const val = _.get(values, name);
1324
+ const fieldError = _19.get(errors, name);
1325
+ const isTouched = _19.get(touched, name);
1326
+ const val = _19.get(values, name);
1324
1327
  const selectedValues = Array.isArray(val) ? val : [];
1325
1328
  const handleChange = (event, child) => {
1326
1329
  const newValue = event.target.value;
@@ -1578,8 +1581,8 @@ var AppPhoneNoInput = ({
1578
1581
  ...otherProps
1579
1582
  }) => {
1580
1583
  const { values, errors, touched, setFieldValue, getFieldProps } = useFormikContext();
1581
- const fieldError = _.get(errors, name);
1582
- const isTouched = _.get(touched, name);
1584
+ const fieldError = _19.get(errors, name);
1585
+ const isTouched = _19.get(touched, name);
1583
1586
  return /* @__PURE__ */ jsxs(Box, { sx: [{ mb: 2 }, containerSx, sx], children: [
1584
1587
  label && /* @__PURE__ */ jsxs(
1585
1588
  Typography,
@@ -1663,9 +1666,9 @@ var AppRadioGroup = forwardRef(({
1663
1666
  ...rest
1664
1667
  }, ref) => {
1665
1668
  const { errors, touched, getFieldProps, setFieldValue } = useFormikContext();
1666
- const fieldError = _.get(errors, name);
1667
- const isTouched = _.get(touched, name);
1668
- const value = _.get(getFieldProps(name), "value");
1669
+ const fieldError = _19.get(errors, name);
1670
+ const isTouched = _19.get(touched, name);
1671
+ const value = _19.get(getFieldProps(name), "value");
1669
1672
  const handleChange = (event) => {
1670
1673
  const newValue = event.target.value;
1671
1674
  setFieldValue(name, newValue);
@@ -1843,9 +1846,9 @@ var AppRating = forwardRef(({
1843
1846
  }, ref) => {
1844
1847
  useTheme();
1845
1848
  const { errors, touched, setFieldValue, values, setFieldTouched } = useFormikContext();
1846
- const val = _.get(values, name);
1847
- const fieldError = _.get(errors, name);
1848
- const isTouched = _.get(touched, name);
1849
+ const val = _19.get(values, name);
1850
+ const fieldError = _19.get(errors, name);
1851
+ const isTouched = _19.get(touched, name);
1849
1852
  const hasError = Boolean(fieldError) && isTouched;
1850
1853
  const handleChange = (event, newValue) => {
1851
1854
  setFieldValue(name, newValue);
@@ -3526,7 +3529,7 @@ var Node = class {
3526
3529
  copy2 = mark.addToSet(copy2);
3527
3530
  }
3528
3531
  if (!Mark.sameSet(copy2, this.marks))
3529
- throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m) => m.type.name)}`);
3532
+ throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m2) => m2.type.name)}`);
3530
3533
  this.content.forEach((node) => node.check());
3531
3534
  }
3532
3535
  /**
@@ -3775,17 +3778,17 @@ var ContentMatch = class {
3775
3778
  */
3776
3779
  toString() {
3777
3780
  let seen = [];
3778
- function scan(m) {
3779
- seen.push(m);
3780
- for (let i = 0; i < m.next.length; i++)
3781
- if (seen.indexOf(m.next[i].next) == -1)
3782
- scan(m.next[i].next);
3781
+ function scan(m2) {
3782
+ seen.push(m2);
3783
+ for (let i = 0; i < m2.next.length; i++)
3784
+ if (seen.indexOf(m2.next[i].next) == -1)
3785
+ scan(m2.next[i].next);
3783
3786
  }
3784
3787
  scan(this);
3785
- return seen.map((m, i) => {
3786
- let out = i + (m.validEnd ? "*" : " ") + " ";
3787
- for (let i2 = 0; i2 < m.next.length; i2++)
3788
- out += (i2 ? ", " : "") + m.next[i2].type.name + "->" + seen.indexOf(m.next[i2].next);
3788
+ return seen.map((m2, i) => {
3789
+ let out = i + (m2.validEnd ? "*" : " ") + " ";
3790
+ for (let i2 = 0; i2 < m2.next.length; i2++)
3791
+ out += (i2 ? ", " : "") + m2.next[i2].type.name + "->" + seen.indexOf(m2.next[i2].next);
3789
3792
  return out;
3790
3793
  }).join("\n");
3791
3794
  }
@@ -4666,13 +4669,13 @@ var NodeContext = class {
4666
4669
  }
4667
4670
  finish(openEnd) {
4668
4671
  if (!(this.options & OPT_PRESERVE_WS)) {
4669
- let last = this.content[this.content.length - 1], m;
4670
- if (last && last.isText && (m = /[ \t\r\n\u000c]+$/.exec(last.text))) {
4672
+ let last = this.content[this.content.length - 1], m2;
4673
+ if (last && last.isText && (m2 = /[ \t\r\n\u000c]+$/.exec(last.text))) {
4671
4674
  let text = last;
4672
- if (last.text.length == m[0].length)
4675
+ if (last.text.length == m2[0].length)
4673
4676
  this.content.pop();
4674
4677
  else
4675
- this.content[this.content.length - 1] = text.withText(text.text.slice(0, text.text.length - m[0].length));
4678
+ this.content[this.content.length - 1] = text.withText(text.text.slice(0, text.text.length - m2[0].length));
4676
4679
  }
4677
4680
  }
4678
4681
  let content = Fragment2.from(this.content);
@@ -4824,7 +4827,7 @@ var ParseContext = class {
4824
4827
  if (rule.ignore)
4825
4828
  return null;
4826
4829
  if (rule.clearMark)
4827
- marks = marks.filter((m) => !rule.clearMark(m));
4830
+ marks = marks.filter((m2) => !rule.clearMark(m2));
4828
4831
  else
4829
4832
  marks = marks.concat(this.parser.schema.marks[rule.mark].create(rule.attrs));
4830
4833
  if (rule.consuming === false)
@@ -4930,9 +4933,9 @@ var ParseContext = class {
4930
4933
  if (top.match)
4931
4934
  top.match = top.match.matchType(node.type);
4932
4935
  let nodeMarks = Mark.none;
4933
- for (let m of innerMarks.concat(node.marks))
4934
- if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, node.type))
4935
- nodeMarks = m.addToSet(nodeMarks);
4936
+ for (let m2 of innerMarks.concat(node.marks))
4937
+ if (top.type ? top.type.allowsMarkType(m2.type) : markMayApply(m2.type, node.type))
4938
+ nodeMarks = m2.addToSet(nodeMarks);
4936
4939
  top.content.push(node.mark(nodeMarks));
4937
4940
  return true;
4938
4941
  }
@@ -4955,9 +4958,9 @@ var ParseContext = class {
4955
4958
  if (top.options & OPT_OPEN_LEFT && top.content.length == 0)
4956
4959
  options |= OPT_OPEN_LEFT;
4957
4960
  let applyMarks = Mark.none;
4958
- marks = marks.filter((m) => {
4959
- if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, type)) {
4960
- applyMarks = m.addToSet(applyMarks);
4961
+ marks = marks.filter((m2) => {
4962
+ if (top.type ? top.type.allowsMarkType(m2.type) : markMayApply(m2.type, type)) {
4963
+ applyMarks = m2.addToSet(applyMarks);
4961
4964
  return false;
4962
4965
  }
4963
4966
  return true;
@@ -5345,10 +5348,10 @@ var Mapping = class {
5345
5348
  /**
5346
5349
  @internal
5347
5350
  */
5348
- setMirror(n, m) {
5351
+ setMirror(n, m2) {
5349
5352
  if (!this.mirror)
5350
5353
  this.mirror = [];
5351
- this.mirror.push(n, m);
5354
+ this.mirror.push(n, m2);
5352
5355
  }
5353
5356
  /**
5354
5357
  Append the inverse of the given mapping to this one.
@@ -5890,9 +5893,9 @@ function removeMark(tr, from, to, mark) {
5890
5893
  for (let i = 0; i < toRemove.length; i++) {
5891
5894
  let style = toRemove[i], found2;
5892
5895
  for (let j = 0; j < matched.length; j++) {
5893
- let m = matched[j];
5894
- if (m.step == step - 1 && style.eq(matched[j].style))
5895
- found2 = m;
5896
+ let m2 = matched[j];
5897
+ if (m2.step == step - 1 && style.eq(matched[j].style))
5898
+ found2 = m2;
5896
5899
  }
5897
5900
  if (found2) {
5898
5901
  found2.to = end;
@@ -5903,7 +5906,7 @@ function removeMark(tr, from, to, mark) {
5903
5906
  }
5904
5907
  }
5905
5908
  });
5906
- matched.forEach((m) => tr.step(new RemoveMarkStep(m.from, m.to, m.style)));
5909
+ matched.forEach((m2) => tr.step(new RemoveMarkStep(m2.from, m2.to, m2.style)));
5907
5910
  }
5908
5911
  function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch, clearNewlines = true) {
5909
5912
  let node = tr.doc.nodeAt(pos);
@@ -5919,11 +5922,11 @@ function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch,
5919
5922
  if (!parentType.allowsMarkType(child.marks[j].type))
5920
5923
  tr.step(new RemoveMarkStep(cur, end, child.marks[j]));
5921
5924
  if (clearNewlines && child.isText && parentType.whitespace != "pre") {
5922
- let m, newline = /\r?\n|\r/g, slice;
5923
- while (m = newline.exec(child.text)) {
5925
+ let m2, newline = /\r?\n|\r/g, slice;
5926
+ while (m2 = newline.exec(child.text)) {
5924
5927
  if (!slice)
5925
5928
  slice = new Slice(Fragment2.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0);
5926
- replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length, slice));
5929
+ replSteps.push(new ReplaceStep(cur + m2.index, cur + m2.index + m2[0].length, slice));
5927
5930
  }
5928
5931
  }
5929
5932
  }
@@ -6055,9 +6058,9 @@ function setBlockType(tr, from, to, type, attrs) {
6055
6058
  function replaceNewlines(tr, node, pos, mapFrom) {
6056
6059
  node.forEach((child, offset) => {
6057
6060
  if (child.isText) {
6058
- let m, newline = /\r?\n|\r/g;
6059
- while (m = newline.exec(child.text)) {
6060
- let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m.index);
6061
+ let m2, newline = /\r?\n|\r/g;
6062
+ while (m2 = newline.exec(child.text)) {
6063
+ let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m2.index);
6061
6064
  tr.replaceWith(start, start + 1, node.type.schema.linebreakReplacement.create());
6062
6065
  }
6063
6066
  }
@@ -10123,11 +10126,11 @@ var Mark2 = class _Mark extends Extendable {
10123
10126
  const isAtEnd = currentPos.pos === currentPos.end();
10124
10127
  if (isAtEnd) {
10125
10128
  const currentMarks = currentPos.marks();
10126
- const isInMark = !!currentMarks.find((m) => (m == null ? void 0 : m.type.name) === mark.name);
10129
+ const isInMark = !!currentMarks.find((m2) => (m2 == null ? void 0 : m2.type.name) === mark.name);
10127
10130
  if (!isInMark) {
10128
10131
  return false;
10129
10132
  }
10130
- const removeMark2 = currentMarks.find((m) => (m == null ? void 0 : m.type.name) === mark.name);
10133
+ const removeMark2 = currentMarks.find((m2) => (m2 == null ? void 0 : m2.type.name) === mark.name);
10131
10134
  if (removeMark2) {
10132
10135
  tr.removeStoredMark(removeMark2);
10133
10136
  }
@@ -11531,10 +11534,10 @@ var AppSearchableMultiSelector = forwardRef(
11531
11534
  }, ref) => {
11532
11535
  useTheme();
11533
11536
  const { values, setFieldValue, errors, touched, setFieldTouched } = useFormikContext();
11534
- const fieldError = _.get(errors, name);
11535
- const isTouched = Boolean(_.get(touched, name));
11537
+ const fieldError = _19.get(errors, name);
11538
+ const isTouched = Boolean(_19.get(touched, name));
11536
11539
  const hasError = Boolean(fieldError) && isTouched;
11537
- const val = _.get(values, name);
11540
+ const val = _19.get(values, name);
11538
11541
  const selectedValues = Array.isArray(val) ? val : [];
11539
11542
  const selectedCount = selectedValues.length;
11540
11543
  const handleChange = (event, value, reason, details) => {
@@ -11910,9 +11913,9 @@ function AppSearchableSelectInput({
11910
11913
  ...otherProps
11911
11914
  }) {
11912
11915
  const { errors, touched, setFieldValue, values } = useFormikContext();
11913
- const fieldError = _.get(errors, name);
11914
- const isTouched = _.get(touched, name);
11915
- const val = _.get(values, name);
11916
+ const fieldError = _19.get(errors, name);
11917
+ const isTouched = _19.get(touched, name);
11918
+ const val = _19.get(values, name);
11916
11919
  const selectedOption = options.find((option) => option.value === val) || null;
11917
11920
  const handleChange = (event, newValue) => {
11918
11921
  setFieldValue(name, newValue ? newValue.value : "");
@@ -12038,10 +12041,10 @@ var AppSelectInput = forwardRef(
12038
12041
  }, ref) => {
12039
12042
  const theme = useTheme();
12040
12043
  const { errors, touched, values, setFieldValue, setFieldTouched } = useFormikContext();
12041
- const fieldError = _.get(errors, name);
12042
- const isTouched = _.get(touched, name);
12044
+ const fieldError = _19.get(errors, name);
12045
+ const isTouched = _19.get(touched, name);
12043
12046
  const hasError = Boolean(fieldError) && isTouched;
12044
- const value = _.get(values, name);
12047
+ const value = _19.get(values, name);
12045
12048
  const handleChange = (event, child) => {
12046
12049
  setFieldValue(name, event.target.value, true);
12047
12050
  if (externalOnChange) {
@@ -12283,8 +12286,8 @@ var AppSimpleUploadFile = ({
12283
12286
  onError
12284
12287
  }) => {
12285
12288
  const { setFieldValue, values, errors, touched } = useFormikContext();
12286
- const fieldValue = _.get(values, name);
12287
- const fieldError = _.get(touched, name) ? _.get(errors, name) : void 0;
12289
+ const fieldValue = _19.get(values, name);
12290
+ const fieldError = _19.get(touched, name) ? _19.get(errors, name) : void 0;
12288
12291
  const handleChange = (event) => {
12289
12292
  const files = event.target.files;
12290
12293
  if (!files || files.length === 0)
@@ -12405,244 +12408,1527 @@ var AppSimpleUploadFile = ({
12405
12408
  ] });
12406
12409
  };
12407
12410
  var AppSimpleUploadFile_default = AppSimpleUploadFile;
12408
- var AppUploadFile = ({
12409
- name,
12410
- label,
12411
+
12412
+ // src/file-thumbnail/utils.ts
12413
+ var FORMAT_PDF = ["pdf"];
12414
+ var FORMAT_TEXT = ["txt"];
12415
+ var FORMAT_PHOTOSHOP = ["psd"];
12416
+ var FORMAT_WORD = ["doc", "docx"];
12417
+ var FORMAT_EXCEL = ["xls", "xlsx"];
12418
+ var FORMAT_ZIP = ["zip", "rar", "iso"];
12419
+ var FORMAT_ILLUSTRATOR = ["ai", "esp"];
12420
+ var FORMAT_POWERPOINT = ["ppt", "pptx"];
12421
+ var FORMAT_AUDIO = ["wav", "aif", "mp3", "aac"];
12422
+ var FORMAT_IMG = ["jpg", "jpeg", "gif", "bmp", "png", "svg"];
12423
+ var FORMAT_VIDEO = ["m4v", "avi", "mpg", "mp4", "webm"];
12424
+ var iconUrl = (icon) => `/assets/icons/files/${icon}.svg`;
12425
+ function fileFormat(fileUrl) {
12426
+ let format;
12427
+ switch (fileUrl == null ? void 0 : fileUrl.includes(fileTypeByUrl(fileUrl))) {
12428
+ case FORMAT_TEXT.includes(fileTypeByUrl(fileUrl)):
12429
+ format = "txt";
12430
+ break;
12431
+ case FORMAT_ZIP.includes(fileTypeByUrl(fileUrl)):
12432
+ format = "zip";
12433
+ break;
12434
+ case FORMAT_AUDIO.includes(fileTypeByUrl(fileUrl)):
12435
+ format = "audio";
12436
+ break;
12437
+ case FORMAT_IMG.includes(fileTypeByUrl(fileUrl)):
12438
+ format = "image";
12439
+ break;
12440
+ case FORMAT_VIDEO.includes(fileTypeByUrl(fileUrl)):
12441
+ format = "video";
12442
+ break;
12443
+ case FORMAT_WORD.includes(fileTypeByUrl(fileUrl)):
12444
+ format = "word";
12445
+ break;
12446
+ case FORMAT_EXCEL.includes(fileTypeByUrl(fileUrl)):
12447
+ format = "excel";
12448
+ break;
12449
+ case FORMAT_POWERPOINT.includes(fileTypeByUrl(fileUrl)):
12450
+ format = "powerpoint";
12451
+ break;
12452
+ case FORMAT_PDF.includes(fileTypeByUrl(fileUrl)):
12453
+ format = "pdf";
12454
+ break;
12455
+ case FORMAT_PHOTOSHOP.includes(fileTypeByUrl(fileUrl)):
12456
+ format = "photoshop";
12457
+ break;
12458
+ case FORMAT_ILLUSTRATOR.includes(fileTypeByUrl(fileUrl)):
12459
+ format = "illustrator";
12460
+ break;
12461
+ default:
12462
+ format = fileTypeByUrl(fileUrl);
12463
+ }
12464
+ return format;
12465
+ }
12466
+ function fileThumb(fileUrl) {
12467
+ let thumb;
12468
+ switch (fileFormat(fileUrl)) {
12469
+ case "folder":
12470
+ thumb = iconUrl("ic_folder");
12471
+ break;
12472
+ case "txt":
12473
+ thumb = iconUrl("ic_txt");
12474
+ break;
12475
+ case "zip":
12476
+ thumb = iconUrl("ic_zip");
12477
+ break;
12478
+ case "audio":
12479
+ thumb = iconUrl("ic_audio");
12480
+ break;
12481
+ case "video":
12482
+ thumb = iconUrl("ic_video");
12483
+ break;
12484
+ case "word":
12485
+ thumb = iconUrl("ic_word");
12486
+ break;
12487
+ case "excel":
12488
+ thumb = iconUrl("ic_excel");
12489
+ break;
12490
+ case "powerpoint":
12491
+ thumb = iconUrl("ic_power_point");
12492
+ break;
12493
+ case "pdf":
12494
+ thumb = iconUrl("ic_pdf");
12495
+ break;
12496
+ case "photoshop":
12497
+ thumb = iconUrl("ic_pts");
12498
+ break;
12499
+ case "illustrator":
12500
+ thumb = iconUrl("ic_ai");
12501
+ break;
12502
+ case "image":
12503
+ thumb = iconUrl("ic_img");
12504
+ break;
12505
+ default:
12506
+ thumb = iconUrl("ic_file");
12507
+ }
12508
+ return thumb;
12509
+ }
12510
+ function fileTypeByUrl(fileUrl = "") {
12511
+ return fileUrl && fileUrl.split(".").pop() || "";
12512
+ }
12513
+ function fileNameByUrl(fileUrl) {
12514
+ return fileUrl.split("/").pop();
12515
+ }
12516
+ function fileData(file) {
12517
+ if (typeof file === "string") {
12518
+ return {
12519
+ key: file,
12520
+ preview: file,
12521
+ name: fileNameByUrl(file),
12522
+ type: fileTypeByUrl(file)
12523
+ };
12524
+ }
12525
+ return {
12526
+ key: file == null ? void 0 : file.preview,
12527
+ name: file == null ? void 0 : file.name,
12528
+ size: file == null ? void 0 : file.size,
12529
+ path: file == null ? void 0 : file.path,
12530
+ type: file == null ? void 0 : file.type,
12531
+ preview: file == null ? void 0 : file.preview,
12532
+ lastModified: file == null ? void 0 : file.lastModified,
12533
+ lastModifiedDate: file == null ? void 0 : file.lastModifiedDate
12534
+ };
12535
+ }
12536
+ function DownloadButton({ onDownload }) {
12537
+ const theme = useTheme$1();
12538
+ return /* @__PURE__ */ jsx(
12539
+ IconButton,
12540
+ {
12541
+ onClick: onDownload,
12542
+ sx: {
12543
+ p: 0,
12544
+ top: 0,
12545
+ right: 0,
12546
+ width: 1,
12547
+ height: 1,
12548
+ zIndex: 9,
12549
+ opacity: 0,
12550
+ position: "absolute",
12551
+ borderRadius: "unset",
12552
+ // color: 'common.white',
12553
+ justifyContent: "center",
12554
+ bgcolor: "grey.800",
12555
+ color: "common.white",
12556
+ transition: theme.transitions.create("opacity"),
12557
+ "&:hover": {
12558
+ opacity: 1,
12559
+ backgroundColor: alpha(theme.palette.grey[900], 0.64),
12560
+ backdropFilter: "blur(6px)"
12561
+ }
12562
+ },
12563
+ children: /* @__PURE__ */ jsx(Iconify_default, { icon: "eva:arrow-circle-down-fill", width: 24 })
12564
+ }
12565
+ );
12566
+ }
12567
+ function FileThumbnail({
12568
+ file,
12569
+ tooltip,
12570
+ imageView,
12571
+ onDownload,
12572
+ sx,
12573
+ imgSx
12574
+ }) {
12575
+ const { name = "", path = "", preview = "" } = fileData(file);
12576
+ const format = fileFormat(path || preview);
12577
+ const renderContent = format === "image" && imageView === true ? /* @__PURE__ */ jsx(
12578
+ Box,
12579
+ {
12580
+ component: "img",
12581
+ src: preview,
12582
+ sx: {
12583
+ width: 1,
12584
+ height: 1,
12585
+ flexShrink: 0,
12586
+ objectFit: "cover",
12587
+ ...imgSx
12588
+ }
12589
+ }
12590
+ ) : /* @__PURE__ */ jsx(
12591
+ Box,
12592
+ {
12593
+ component: "img",
12594
+ src: fileThumb(format),
12595
+ sx: {
12596
+ width: 32,
12597
+ height: 32,
12598
+ flexShrink: 0,
12599
+ ...sx
12600
+ }
12601
+ }
12602
+ );
12603
+ if (tooltip === true) {
12604
+ return /* @__PURE__ */ jsx(Tooltip, { title: name, children: /* @__PURE__ */ jsxs(
12605
+ Stack,
12606
+ {
12607
+ flexShrink: 0,
12608
+ component: "span",
12609
+ alignItems: "center",
12610
+ justifyContent: "center",
12611
+ sx: {
12612
+ width: "fit-content",
12613
+ height: "inherit"
12614
+ },
12615
+ children: [
12616
+ renderContent,
12617
+ onDownload && /* @__PURE__ */ jsx(DownloadButton, { onDownload })
12618
+ ]
12619
+ }
12620
+ ) });
12621
+ }
12622
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
12623
+ renderContent,
12624
+ onDownload && /* @__PURE__ */ jsx(DownloadButton, { onDownload })
12625
+ ] });
12626
+ }
12627
+ function RejectionFiles({ fileRejections }) {
12628
+ if (!fileRejections.length) {
12629
+ return null;
12630
+ }
12631
+ function formatBytes2(bytes) {
12632
+ const b = bytes != null ? bytes : 0;
12633
+ if (b === 0)
12634
+ return "0 Bytes";
12635
+ const k = 1024;
12636
+ const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
12637
+ const i = Math.floor(Math.log(b) / Math.log(k));
12638
+ return `${parseFloat((b / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
12639
+ }
12640
+ return /* @__PURE__ */ jsx(
12641
+ Paper,
12642
+ {
12643
+ variant: "outlined",
12644
+ sx: {
12645
+ py: 1,
12646
+ px: 2,
12647
+ mt: 3,
12648
+ bgcolor: (theme) => alpha(theme.palette.error.main, 0.08),
12649
+ borderColor: (theme) => alpha(theme.palette.error.main, 0.24)
12650
+ },
12651
+ children: fileRejections.map(({ file, errors }) => {
12652
+ const { path, size } = fileData(file);
12653
+ return /* @__PURE__ */ jsxs(Box, { sx: { my: 1 }, children: [
12654
+ /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", noWrap: true, children: [
12655
+ path,
12656
+ " - ",
12657
+ size != null ? formatBytes2(size) : ""
12658
+ ] }),
12659
+ errors.map((error) => /* @__PURE__ */ jsxs(Box, { component: "span", sx: { typography: "caption" }, children: [
12660
+ "- ",
12661
+ error.message
12662
+ ] }, error.code))
12663
+ ] }, path);
12664
+ })
12665
+ }
12666
+ );
12667
+ }
12668
+
12669
+ // src/image/getRatio.ts
12670
+ function getRatio(ratio = "1/1") {
12671
+ return {
12672
+ "4/3": "calc(100% / 4 * 3)",
12673
+ "3/4": "calc(100% / 3 * 4)",
12674
+ "6/4": "calc(100% / 6 * 4)",
12675
+ "4/6": "calc(100% / 4 * 6)",
12676
+ "16/9": "calc(100% / 16 * 9)",
12677
+ "9/16": "calc(100% / 9 * 16)",
12678
+ "21/9": "calc(100% / 21 * 9)",
12679
+ "9/21": "calc(100% / 9 * 21)",
12680
+ "1/1": "100%"
12681
+ }[ratio];
12682
+ }
12683
+ var TRANSPARENT_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8Xw8AApIBgX6cJqkAAAAASUVORK5CYII=";
12684
+ var Image = forwardRef(
12685
+ ({
12686
+ ratio,
12687
+ disabledEffect = false,
12688
+ effect = "blur",
12689
+ src,
12690
+ wrapperProps,
12691
+ style,
12692
+ sx,
12693
+ ...other
12694
+ }, ref) => {
12695
+ const content = /* @__PURE__ */ jsx(
12696
+ Box,
12697
+ {
12698
+ component: LazyLoadImage,
12699
+ wrapperClassName: "wrapper",
12700
+ effect: disabledEffect ? void 0 : effect,
12701
+ placeholderSrc: disabledEffect ? TRANSPARENT_PNG : TRANSPARENT_PNG,
12702
+ src,
12703
+ wrapperProps,
12704
+ style,
12705
+ sx: {
12706
+ width: 1,
12707
+ height: 1,
12708
+ objectFit: "cover",
12709
+ ...sx
12710
+ },
12711
+ ...other
12712
+ }
12713
+ );
12714
+ if (ratio) {
12715
+ return /* @__PURE__ */ jsx(
12716
+ Box,
12717
+ {
12718
+ ref,
12719
+ component: "span",
12720
+ sx: {
12721
+ width: 1,
12722
+ lineHeight: 1,
12723
+ display: "block",
12724
+ overflow: "hidden",
12725
+ position: "relative",
12726
+ pt: getRatio(ratio),
12727
+ "& .wrapper": {
12728
+ top: 0,
12729
+ left: 0,
12730
+ width: 1,
12731
+ height: 1,
12732
+ position: "absolute",
12733
+ backgroundSize: "cover !important"
12734
+ },
12735
+ ...sx
12736
+ },
12737
+ children: content
12738
+ }
12739
+ );
12740
+ }
12741
+ return /* @__PURE__ */ jsx(
12742
+ Box,
12743
+ {
12744
+ ref,
12745
+ component: "span",
12746
+ sx: {
12747
+ lineHeight: 1,
12748
+ display: "block",
12749
+ overflow: "hidden",
12750
+ position: "relative",
12751
+ "& .wrapper": {
12752
+ width: 1,
12753
+ height: 1,
12754
+ backgroundSize: "cover !important"
12755
+ },
12756
+ ...sx
12757
+ },
12758
+ children: content
12759
+ }
12760
+ );
12761
+ }
12762
+ );
12763
+ Image.displayName = "Image";
12764
+ var Image_default = Image;
12765
+
12766
+ // src/animate/variants/transition.ts
12767
+ var varTranEnter = (props) => {
12768
+ const duration = (props == null ? void 0 : props.durationIn) != null ? props == null ? void 0 : props.durationIn : 0.64;
12769
+ const ease = (props == null ? void 0 : props.easeIn) != null ? props == null ? void 0 : props.easeIn : [0.43, 0.13, 0.23, 0.96];
12770
+ return { duration, ease };
12771
+ };
12772
+ var varTranExit = (props) => {
12773
+ const duration = (props == null ? void 0 : props.durationOut) != null ? props == null ? void 0 : props.durationOut : 0.48;
12774
+ const ease = (props == null ? void 0 : props.easeOut) != null ? props == null ? void 0 : props.easeOut : [0.43, 0.13, 0.23, 0.96];
12775
+ return { duration, ease };
12776
+ };
12777
+
12778
+ // src/animate/variants/fade.ts
12779
+ var varFade = (props) => {
12780
+ const distance = (props == null ? void 0 : props.distance) != null ? props == null ? void 0 : props.distance : 120;
12781
+ const durationIn = props == null ? void 0 : props.durationIn;
12782
+ const durationOut = props == null ? void 0 : props.durationOut;
12783
+ const easeIn = props == null ? void 0 : props.easeIn;
12784
+ const easeOut = props == null ? void 0 : props.easeOut;
12785
+ return {
12786
+ // IN
12787
+ in: {
12788
+ initial: { opacity: 0 },
12789
+ animate: { opacity: 1, transition: varTranEnter },
12790
+ exit: { opacity: 0, transition: varTranExit }
12791
+ },
12792
+ inUp: {
12793
+ initial: { y: distance, opacity: 0 },
12794
+ animate: { y: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
12795
+ exit: { y: distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
12796
+ },
12797
+ inDown: {
12798
+ initial: { y: -distance, opacity: 0 },
12799
+ animate: { y: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
12800
+ exit: { y: -distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
12801
+ },
12802
+ inLeft: {
12803
+ initial: { x: -distance, opacity: 0 },
12804
+ animate: { x: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
12805
+ exit: { x: -distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
12806
+ },
12807
+ inRight: {
12808
+ initial: { x: distance, opacity: 0 },
12809
+ animate: { x: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
12810
+ exit: { x: distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
12811
+ },
12812
+ // OUT
12813
+ out: {
12814
+ initial: { opacity: 1 },
12815
+ animate: { opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12816
+ exit: { opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12817
+ },
12818
+ outUp: {
12819
+ initial: { y: 0, opacity: 1 },
12820
+ animate: { y: -distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12821
+ exit: { y: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12822
+ },
12823
+ outDown: {
12824
+ initial: { y: 0, opacity: 1 },
12825
+ animate: { y: distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12826
+ exit: { y: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12827
+ },
12828
+ outLeft: {
12829
+ initial: { x: 0, opacity: 1 },
12830
+ animate: { x: -distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12831
+ exit: { x: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12832
+ },
12833
+ outRight: {
12834
+ initial: { x: 0, opacity: 1 },
12835
+ animate: { x: distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12836
+ exit: { x: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12837
+ }
12838
+ };
12839
+ };
12840
+ function formatBytes(bytes) {
12841
+ const b = bytes != null ? bytes : 0;
12842
+ if (b === 0)
12843
+ return "0 Bytes";
12844
+ const k = 1024;
12845
+ const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
12846
+ const i = Math.floor(Math.log(b) / Math.log(k));
12847
+ return `${parseFloat((b / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
12848
+ }
12849
+ function MultiFilePreview({
12850
+ thumbnail,
12851
+ files,
12852
+ onRemove,
12853
+ sx,
12854
+ isClickable,
12855
+ isEditable,
12856
+ onDeleteButtonClick,
12857
+ onPrivacyUpdateClick
12858
+ }) {
12859
+ if ((files == null ? void 0 : files.length) == null) {
12860
+ return null;
12861
+ }
12862
+ const [anchorEl, setAnchorEl] = useState(null);
12863
+ const [selectedFile, setSelectedFile] = useState(null);
12864
+ const canViewPrivate = true;
12865
+ return /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: files.map((file) => {
12866
+ const typedFile = file;
12867
+ const { key, name = "", size = 0 } = fileData(typedFile);
12868
+ const isStringFile = typeof file === "string";
12869
+ if (thumbnail === true) {
12870
+ return (
12871
+ // @ts-ignore
12872
+ /* @__PURE__ */ jsxs(
12873
+ Stack,
12874
+ {
12875
+ component: m.div,
12876
+ ...varFade().inUp,
12877
+ alignItems: "center",
12878
+ display: "inline-flex",
12879
+ justifyContent: "center",
12880
+ sx: {
12881
+ m: 0.5,
12882
+ width: 80,
12883
+ height: 80,
12884
+ borderRadius: 1.25,
12885
+ overflow: "hidden",
12886
+ position: "relative",
12887
+ border: (theme) => `solid 1px ${theme.palette.divider}`,
12888
+ ...sx
12889
+ },
12890
+ children: [
12891
+ /* @__PURE__ */ jsx(
12892
+ FileThumbnail,
12893
+ {
12894
+ tooltip: true,
12895
+ imageView: true,
12896
+ file: typedFile,
12897
+ sx: { position: "absolute" },
12898
+ imgSx: { position: "absolute" }
12899
+ }
12900
+ ),
12901
+ onRemove && /* @__PURE__ */ jsx(
12902
+ IconButton,
12903
+ {
12904
+ size: "small",
12905
+ onClick: () => onRemove(typedFile),
12906
+ sx: {
12907
+ top: 4,
12908
+ right: 4,
12909
+ p: "1px",
12910
+ position: "absolute",
12911
+ color: (theme) => alpha(theme.palette.common.white, 0.72),
12912
+ bgcolor: (theme) => alpha(theme.palette.grey[900], 0.48),
12913
+ "&:hover": {
12914
+ bgcolor: (theme) => alpha(theme.palette.grey[900], 0.72)
12915
+ }
12916
+ },
12917
+ children: /* @__PURE__ */ jsx(Iconify_default, { icon: "eva:close-fill", width: 16 })
12918
+ }
12919
+ )
12920
+ ]
12921
+ },
12922
+ key
12923
+ )
12924
+ );
12925
+ }
12926
+ return (
12927
+ // @ts-ignore
12928
+ /* @__PURE__ */ jsxs(
12929
+ Stack,
12930
+ {
12931
+ component: m.div,
12932
+ ...varFade().inUp,
12933
+ spacing: 2,
12934
+ direction: "row",
12935
+ alignItems: "center",
12936
+ sx: {
12937
+ my: 1,
12938
+ px: 1,
12939
+ py: 0.75,
12940
+ borderRadius: 0.75,
12941
+ border: (theme) => `solid 1px ${theme.palette.divider}`,
12942
+ ...sx,
12943
+ opacity: "1 !important",
12944
+ transform: "none !important"
12945
+ },
12946
+ children: [
12947
+ (typedFile == null ? void 0 : typedFile.preview) != null ? /* @__PURE__ */ jsx(Fragment, { children: (typedFile == null ? void 0 : typedFile.is_private) === true && !canViewPrivate ? /* @__PURE__ */ jsx(Iconify_default, { icon: "garden:lock-locked-fill-12", sx: { width: "26px", height: "26px" } }) : (
12948
+ // eslint-disable-next-line @next/next/no-img-element
12949
+ /* @__PURE__ */ jsx(
12950
+ "img",
12951
+ {
12952
+ src: `${typedFile == null ? void 0 : typedFile.preview}`,
12953
+ alt: (typedFile == null ? void 0 : typedFile.name) != null ? typedFile == null ? void 0 : typedFile.name : "",
12954
+ style: { width: "40px", height: "40px" }
12955
+ }
12956
+ )
12957
+ ) }) : /* @__PURE__ */ jsx(FileThumbnail, { file: typedFile }),
12958
+ /* @__PURE__ */ jsxs(
12959
+ Stack,
12960
+ {
12961
+ flexGrow: 1,
12962
+ sx: { minWidth: 0, cursor: "pointer" },
12963
+ onClick: () => {
12964
+ if (isClickable === true && typedFile.url != null) {
12965
+ window.open(`${typedFile == null ? void 0 : typedFile.url}`, "_blank");
12966
+ }
12967
+ },
12968
+ children: [
12969
+ /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", sx: { wordBreak: "break-all", whiteSpace: "break-spaces" }, noWrap: true, children: isStringFile ? file : name }),
12970
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", sx: { color: "text.secondary" }, children: isStringFile ? "" : formatBytes(size) })
12971
+ ]
12972
+ }
12973
+ ),
12974
+ onRemove && /* @__PURE__ */ jsx(IconButton, { edge: "end", size: "small", onClick: () => onRemove(typedFile), children: /* @__PURE__ */ jsx(Iconify_default, { icon: "eva:close-fill" }) }),
12975
+ isEditable === true && /* @__PURE__ */ jsxs(Fragment, { children: [
12976
+ /* @__PURE__ */ jsx(
12977
+ IconButton,
12978
+ {
12979
+ edge: "end",
12980
+ size: "small",
12981
+ onClick: (event) => {
12982
+ event.stopPropagation();
12983
+ setAnchorEl(event.currentTarget);
12984
+ setSelectedFile(typedFile);
12985
+ },
12986
+ children: /* @__PURE__ */ jsx(Iconify_default, { icon: "eva:more-horizontal-fill" })
12987
+ }
12988
+ ),
12989
+ /* @__PURE__ */ jsxs(
12990
+ Menu,
12991
+ {
12992
+ anchorEl,
12993
+ open: Boolean(anchorEl) && selectedFile === file,
12994
+ onClose: () => setAnchorEl(null),
12995
+ children: [
12996
+ /* @__PURE__ */ jsxs(
12997
+ MenuItem,
12998
+ {
12999
+ onClick: (e) => {
13000
+ e.stopPropagation();
13001
+ setAnchorEl(null);
13002
+ if (onDeleteButtonClick) {
13003
+ onDeleteButtonClick(typedFile);
13004
+ }
13005
+ },
13006
+ children: [
13007
+ /* @__PURE__ */ jsx(Iconify_default, { icon: "eva:trash-2-outline", width: 20 }),
13008
+ "Delete"
13009
+ ]
13010
+ }
13011
+ ),
13012
+ /* @__PURE__ */ jsxs(
13013
+ MenuItem,
13014
+ {
13015
+ onClick: (e) => {
13016
+ e.stopPropagation();
13017
+ if (onPrivacyUpdateClick) {
13018
+ onPrivacyUpdateClick(typedFile);
13019
+ }
13020
+ },
13021
+ children: [
13022
+ /* @__PURE__ */ jsx(
13023
+ Iconify_default,
13024
+ {
13025
+ icon: (typedFile == null ? void 0 : typedFile.is_private) === true ? "eva:unlock-outline" : "eva:lock-outline",
13026
+ width: 20
13027
+ }
13028
+ ),
13029
+ (typedFile == null ? void 0 : typedFile.is_private) === true ? "Public" : "Private"
13030
+ ]
13031
+ }
13032
+ )
13033
+ ]
13034
+ }
13035
+ )
13036
+ ] })
13037
+ ]
13038
+ },
13039
+ key
13040
+ )
13041
+ );
13042
+ }) });
13043
+ }
13044
+ function SingleFilePreview({
13045
+ file
13046
+ }) {
13047
+ if (!file) {
13048
+ return null;
13049
+ }
13050
+ const imgUrl = (typeof file === "string" ? file : file.preview) || "";
13051
+ return /* @__PURE__ */ jsx(
13052
+ Box,
13053
+ {
13054
+ sx: {
13055
+ position: "relative",
13056
+ width: "100%",
13057
+ height: "100%",
13058
+ "& .wrapper": {
13059
+ width: "100%",
13060
+ height: "100%",
13061
+ position: "relative"
13062
+ }
13063
+ },
13064
+ children: /* @__PURE__ */ jsx(
13065
+ Image_default,
13066
+ {
13067
+ src: imgUrl,
13068
+ effect: "opacity",
13069
+ wrapperProps: {
13070
+ style: {
13071
+ width: "100%",
13072
+ height: "100%",
13073
+ position: "relative"
13074
+ }
13075
+ },
13076
+ style: {
13077
+ top: 8,
13078
+ left: 8,
13079
+ zIndex: 8,
13080
+ borderRadius: 1,
13081
+ position: "absolute",
13082
+ width: "calc(100% - 16px)",
13083
+ height: "calc(100% - 16px)",
13084
+ objectFit: "cover"
13085
+ }
13086
+ }
13087
+ )
13088
+ }
13089
+ );
13090
+ }
13091
+ function BackgroundIllustration() {
13092
+ const theme = useTheme$1();
13093
+ const PRIMARY_MAIN = theme.palette.primary.main;
13094
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
13095
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: "BG", x1: "19.496%", x2: "77.479%", y1: "71.822%", y2: "16.69%", children: [
13096
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: PRIMARY_MAIN }),
13097
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: PRIMARY_MAIN, stopOpacity: "0" })
13098
+ ] }) }),
13099
+ /* @__PURE__ */ jsx(
13100
+ "path",
13101
+ {
13102
+ fill: "url(#BG)",
13103
+ fillRule: "nonzero",
13104
+ d: "M0 198.78c0 41.458 14.945 79.236 39.539 107.786 28.214 32.765 69.128 53.365 114.734 53.434a148.44 148.44 0 0056.495-11.036c9.051-3.699 19.182-3.274 27.948 1.107a75.779 75.779 0 0033.957 8.01c5.023 0 9.942-.494 14.7-1.433 13.58-2.67 25.94-8.99 36.09-17.94 6.378-5.627 14.547-8.456 22.897-8.446h.142c27.589 0 53.215-8.732 74.492-23.696 19.021-13.36 34.554-31.696 44.904-53.224C474.92 234.58 480 213.388 480 190.958c0-76.93-59.774-139.305-133.498-139.305-7.516 0-14.88.663-22.063 1.899C305.418 21.42 271.355 0 232.499 0a103.651 103.651 0 00-45.88 10.661c-13.24 6.487-25.011 15.705-34.64 26.939-32.698.544-62.931 11.69-87.676 30.291C25.351 97.155 0 144.882 0 198.781z",
13105
+ opacity: "0.2"
13106
+ }
13107
+ )
13108
+ ] });
13109
+ }
13110
+ var BackgroundIllustration_default = memo(BackgroundIllustration);
13111
+ function UploadIllustration({ ...other }) {
13112
+ const theme = useTheme$1();
13113
+ const PRIMARY_MAIN = theme.palette.primary.main;
13114
+ const PRIMARY_DARK = theme.palette.primary.dark;
13115
+ const PRIMARY_DARKER = theme.palette.primary.dark;
13116
+ return /* @__PURE__ */ jsx(Box, { ...other, children: /* @__PURE__ */ jsxs("svg", { width: "100%", height: "100%", viewBox: "0 0 480 360", xmlns: "http://www.w3.org/2000/svg", children: [
13117
+ /* @__PURE__ */ jsx(BackgroundIllustration_default, {}),
13118
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: "linearGradient-2", x1: "30.113%", x2: "30.113%", y1: "0%", y2: "100%", children: [
13119
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopOpacity: "0" }),
13120
+ /* @__PURE__ */ jsx("stop", { offset: "100%" })
13121
+ ] }) }),
13122
+ /* @__PURE__ */ jsx(
13123
+ "path",
13124
+ {
13125
+ fill: "#FF4842",
13126
+ fillRule: "nonzero",
13127
+ d: "M293.006 206.192c-2.248 2.672-4.676 2.628-6.123 2.251l.054-1.384s5.979-2.733 5.827-2.159c-.057.215.057.733.242 1.292zM309.393 209.217c-3.818 2.206-6.058-.38-6.578-1.112.32-.84.801-2.204.703-2.592-.144-.577 5.827 2.155 5.827 2.155l.048 1.549zM305.303 187.204s3.632-2.093 4.425-1.151c.792.942-4.425 1.151-4.425 1.151zM307.497 188.355s-.598.299.721.681c1.318.383-.721-.681-.721-.681zM285.532 182.599c-.123.036 3.022 2.123 5.862.395-.012 0-5.154-.61-5.862-.395zM291.239 186.591s-.861 1.692-2.625 1.943c-1.764.251 2.625-1.943 2.625-1.943zM302.785 190.262s4.138 6.578 3.346 8.129c-.793 1.552-3.346-8.129-3.346-8.129zM294.62 216.416c0 .368 0 .712-.036.996-.107 1.33-3.381.828-3.381.828-2.99.416-4.066-1.019-4.422-2.392a5.444 5.444 0 01-.164-1.363 5.606 5.606 0 01.054-.819v-.272a1.998 1.998 0 011.859.379c1.331 1.08 3.095.252 3.095.252s1.294.107 1.793.538c.281.242.745-.341 1.098-.897.021.359.054 1.007.074 1.701.024.356.03.714.03 1.049z",
13128
+ opacity: "0.05"
13129
+ }
13130
+ ),
13131
+ /* @__PURE__ */ jsx(
13132
+ "path",
13133
+ {
13134
+ fill: "#FF4842",
13135
+ fillRule: "nonzero",
13136
+ d: "M289.37 216.339s-.897.879-2.589-.479a5.444 5.444 0 01-.164-1.363c.864.658 2.466 1.842 2.753 1.842zM294.62 216.416a.67.67 0 01-.519.132.672.672 0 01-.452-.287c.348-.266.669-.566.956-.897.009.359.015.717.015 1.052zM301.637 217.032c0 .371 0 .715.033.996.108 1.333 3.382.828 3.382.828 2.989.419 4.066-1.017 4.421-2.392a5.728 5.728 0 00.111-2.182v-.272a2.024 2.024 0 00-1.862.379c-1.331 1.08-3.092.251-3.092.251s-1.294.111-1.794.542c-.281.242-.744-.341-1.094-.897a61.426 61.426 0 00-.078 1.701c-.024.35-.03.708-.027 1.046z",
13137
+ opacity: "0.05"
13138
+ }
13139
+ ),
13140
+ /* @__PURE__ */ jsx(
13141
+ "path",
13142
+ {
13143
+ fill: "#FF4842",
13144
+ fillRule: "nonzero",
13145
+ d: "M306.887 216.949s.897.879 2.587-.479c.112-.444.169-.901.167-1.36-.867.655-2.47 1.839-2.754 1.839zM301.637 217.032a.67.67 0 00.969-.155 6.35 6.35 0 01-.957-.897c-.009.356-.014.714-.012 1.052zM319.614 106.269c.063-.138.123-.275.18-.41.057-.134.077-.209.11-.317-.11.237-.206.48-.29.727z",
13146
+ opacity: "0.05"
13147
+ }
13148
+ ),
13149
+ /* @__PURE__ */ jsx(
13150
+ "path",
13151
+ {
13152
+ fill: PRIMARY_DARKER,
13153
+ fillRule: "nonzero",
13154
+ d: "M157.592 279.461a4.114 4.114 0 01-.917-3.131l13.196-107.979 1.094-8.97a4.142 4.142 0 014.078-3.635l38.654-.257a4.135 4.135 0 004.108-4.249l-.015-.409a4.14 4.14 0 014.135-4.279h40.619a4.134 4.134 0 014.098 4.682 4.137 4.137 0 003.995 4.682l39.01.996a4.13 4.13 0 013.97 4.831l-19.502 113.909-.368 2.152a4.042 4.042 0 01-.598 1.543l-135.557.114z"
13155
+ }
13156
+ ),
13157
+ /* @__PURE__ */ jsx(
13158
+ "path",
13159
+ {
13160
+ fill: "#FFF",
13161
+ fillRule: "nonzero",
13162
+ d: "M251.256817 123.296578L274.098317 123.296578 274.098317 200.823078 251.256817 200.823078z",
13163
+ transform: "rotate(34.64 262.678 162.06)"
13164
+ }
13165
+ ),
13166
+ /* @__PURE__ */ jsx(
13167
+ "path",
13168
+ {
13169
+ fill: "#FFC107",
13170
+ fillRule: "nonzero",
13171
+ d: "M270.624591 129.857671L286.750291 129.857671 286.750291 145.983371 270.624591 145.983371z",
13172
+ transform: "rotate(34.804 278.687 137.92)"
13173
+ }
13174
+ ),
13175
+ /* @__PURE__ */ jsx(
13176
+ "path",
13177
+ {
13178
+ fill: "#FFC107",
13179
+ fillRule: "nonzero",
13180
+ d: "M260.275579 145.813111L276.423079 145.813111 276.423079 161.960611 260.275579 161.960611z",
13181
+ opacity: "0.5",
13182
+ transform: "rotate(34.64 268.35 153.887)"
13183
+ }
13184
+ ),
13185
+ /* @__PURE__ */ jsx(
13186
+ "path",
13187
+ {
13188
+ fill: "#FFC107",
13189
+ fillRule: "nonzero",
13190
+ d: "M249.191579 161.852111L265.339079 161.852111 265.339079 177.999611 249.191579 177.999611z",
13191
+ opacity: "0.3",
13192
+ transform: "rotate(34.64 257.265 169.926)"
13193
+ }
13194
+ ),
13195
+ /* @__PURE__ */ jsx(
13196
+ "path",
13197
+ {
13198
+ fill: "#FFF",
13199
+ fillRule: "nonzero",
13200
+ d: "M237.472537 121.334214L260.314037 121.334214 260.314037 198.567714 237.472537 198.567714z",
13201
+ transform: "rotate(16.29 248.893 159.951)"
13202
+ }
13203
+ ),
13204
+ /* @__PURE__ */ jsx(
13205
+ "path",
13206
+ {
13207
+ fill: "#FF4842",
13208
+ fillRule: "nonzero",
13209
+ d: "M249.053192 123.761554L265.200692 123.761554 265.200692 139.909054 249.053192 139.909054z",
13210
+ transform: "rotate(16.29 257.127 131.835)"
13211
+ }
13212
+ ),
13213
+ /* @__PURE__ */ jsx(
13214
+ "path",
13215
+ {
13216
+ fill: "#FF4842",
13217
+ fillRule: "nonzero",
13218
+ d: "M243.584192 142.473554L259.731692 142.473554 259.731692 158.621053 243.584192 158.621053z",
13219
+ opacity: "0.5",
13220
+ transform: "rotate(16.29 251.658 150.547)"
13221
+ }
13222
+ ),
13223
+ /* @__PURE__ */ jsx(
13224
+ "path",
13225
+ {
13226
+ fill: "#FF4842",
13227
+ fillRule: "nonzero",
13228
+ d: "M238.116192 161.182554L254.263692 161.182554 254.263692 177.330054 238.116192 177.330054z",
13229
+ opacity: "0.3",
13230
+ transform: "rotate(16.29 246.19 169.256)"
13231
+ }
13232
+ ),
13233
+ /* @__PURE__ */ jsx(
13234
+ "path",
13235
+ {
13236
+ fill: "#FFF",
13237
+ fillRule: "nonzero",
13238
+ d: "M230.099192 121.641542L252.940692 121.641542 252.940692 198.875042 230.099192 198.875042z",
13239
+ transform: "rotate(4.6 241.52 160.258)"
13240
+ }
13241
+ ),
13242
+ /* @__PURE__ */ jsx(
13243
+ "path",
13244
+ {
13245
+ fill: "#1890FF",
13246
+ fillRule: "nonzero",
13247
+ d: "M235.800489 122.985499L251.947989 122.985499 251.947989 139.132999 235.800489 139.132999z",
13248
+ transform: "rotate(4.6 243.874 131.06)"
13249
+ }
13250
+ ),
13251
+ /* @__PURE__ */ jsx(
13252
+ "path",
13253
+ {
13254
+ fill: "#1890FF",
13255
+ fillRule: "nonzero",
13256
+ d: "M234.234488 142.413498L250.381988 142.413498 250.381988 158.560998 234.234488 158.560998z",
13257
+ opacity: "0.5",
13258
+ transform: "rotate(4.6 242.308 150.487)"
13259
+ }
13260
+ ),
13261
+ /* @__PURE__ */ jsx(
13262
+ "path",
13263
+ {
13264
+ fill: "#1890FF",
13265
+ fillRule: "nonzero",
13266
+ d: "M232.672488 161.846499L248.819988 161.846499 248.819988 177.993999 232.672488 177.993999z",
13267
+ opacity: "0.3",
13268
+ transform: "rotate(4.6 240.746 169.92)"
13269
+ }
13270
+ ),
13271
+ /* @__PURE__ */ jsx(
13272
+ "path",
13273
+ {
13274
+ fill: "#FFF",
13275
+ fillRule: "nonzero",
13276
+ d: "M224.736657 123.384871L247.578157 123.384871 247.578157 200.618371 224.736657 200.618371z",
13277
+ transform: "rotate(-2.61 236.157 162.002)"
13278
+ }
13279
+ ),
13280
+ /* @__PURE__ */ jsx(
13281
+ "path",
13282
+ {
13283
+ fill: PRIMARY_MAIN,
13284
+ fillRule: "nonzero",
13285
+ d: "M226.751283 124.659968L242.898783 124.659968 242.898783 140.807468 226.751283 140.807468z",
13286
+ transform: "rotate(-2.61 234.825 132.734)"
13287
+ }
13288
+ ),
13289
+ /* @__PURE__ */ jsx(
13290
+ "path",
13291
+ {
13292
+ fill: PRIMARY_MAIN,
13293
+ fillRule: "nonzero",
13294
+ d: "M228.305601 143.479224L244.473301 143.479224 244.473301 159.646924 228.305601 159.646924z",
13295
+ opacity: "0.5",
13296
+ transform: "rotate(-2.862 236.39 151.563)"
13297
+ }
13298
+ ),
13299
+ /* @__PURE__ */ jsx(
13300
+ "path",
13301
+ {
13302
+ fill: PRIMARY_MAIN,
13303
+ fillRule: "nonzero",
13304
+ d: "M228.525282 163.608968L244.672782 163.608968 244.672782 179.756468 228.525282 179.756468z",
13305
+ opacity: "0.3",
13306
+ transform: "rotate(-2.61 236.599 171.683)"
13307
+ }
13308
+ ),
13309
+ /* @__PURE__ */ jsx(
13310
+ "path",
13311
+ {
13312
+ fill: "#F4F6F8",
13313
+ fillRule: "nonzero",
13314
+ d: "M232.679 225.726l-20.294 7.851-29.661 11.466c-1.121-2.093-2.771-4.921-4.813-8.297-7.026-11.642-18.65-29.75-29.001-45.665-11.66-17.938-21.696-33.075-21.696-33.075l7.265-2.093 59.346-17.23 38.854 87.043z"
13315
+ }
13316
+ ),
13317
+ /* @__PURE__ */ jsx(
13318
+ "path",
13319
+ {
13320
+ fill: "#000",
13321
+ fillRule: "nonzero",
13322
+ d: "M232.679 225.726l-20.294 7.851a152.535 152.535 0 01-34.484 3.169c-7.026-11.642-18.65-29.75-29-45.665l-14.42-35.18 59.343-17.218 38.855 87.043z",
13323
+ opacity: "0.1"
13324
+ }
13325
+ ),
13326
+ /* @__PURE__ */ jsx(
13327
+ "path",
13328
+ {
13329
+ fill: PRIMARY_MAIN,
13330
+ fillRule: "nonzero",
13331
+ d: "M247.777 220.841s-31.526 18.65-78.596 14.432l-37.525-91.486 17.984-3.091 62.168-10.677 35.279 89.043.69 1.779z"
13332
+ }
13333
+ ),
13334
+ /* @__PURE__ */ jsx(
13335
+ "path",
13336
+ {
13337
+ fill: "#FF4842",
13338
+ fillRule: "nonzero",
13339
+ d: "M247.075 219.074c-7.424.365-16.013.329-24.654-.702-9.351-1.101-18.757-3.367-26.82-7.523-6.742-3.471-12.506-7.247-17.532-11.776-13.074-11.759-21.164-28.579-28.429-58.365l62.168-10.677 35.267 89.043z",
13340
+ opacity: "0.1"
13341
+ }
13342
+ ),
13343
+ /* @__PURE__ */ jsx(
13344
+ "path",
13345
+ {
13346
+ fill: "#FFF",
13347
+ fillRule: "nonzero",
13348
+ d: "M270.203 213.959s-23.239 4.55-46.894 1.749c-9.351-1.1-18.757-3.367-26.82-7.522-6.742-3.471-12.503-7.247-17.532-11.777-16.181-14.557-24.725-36.866-33.536-81.918 0 0 38.633 9.325 76.836-11.101-.012.015 12.865 80.373 47.946 110.569z"
13349
+ }
13350
+ ),
13351
+ /* @__PURE__ */ jsx(
13352
+ "path",
13353
+ {
13354
+ fill: PRIMARY_MAIN,
13355
+ fillRule: "nonzero",
13356
+ d: "M165.405 131.03s31.416-1.776 40.187-8.548l1.331 4.276s-20.758 9.157-41.518 9.268v-4.996zM165.405 152.137s30.417-1.665 53.399-12.766l.777 1.776s-18.237 10.647-54.176 13.433v-2.443zM167.853 160.362s30.418-1.665 53.397-12.766l.777 1.776s-18.237 10.643-54.174 13.433v-2.443zM170.299 168.599s30.417-1.666 53.399-12.766l.774 1.775s-18.237 10.647-54.173 13.433v-2.442zM172.748 176.835s30.417-1.665 53.396-12.766l.777 1.776s-18.237 10.647-54.173 13.433v-2.443zM175.193 185.075s30.417-1.665 53.399-12.766l.774 1.776s-18.237 10.643-54.173 13.433v-2.443z",
13357
+ opacity: "0.3"
13358
+ }
13359
+ ),
13360
+ /* @__PURE__ */ jsx(
13361
+ "path",
13362
+ {
13363
+ fill: PRIMARY_MAIN,
13364
+ fillRule: "nonzero",
13365
+ d: "M389.069 287.344s-12.641-.762-11.152 8.097c0 0-.299 1.563 1.124 2.275 0 0 .021-.658 1.295-.434.454.077.916.099 1.375.066a2.832 2.832 0 001.677-.694c.468-.409 3.555-1.468 4.936-7.274 0 0 1.023-1.267.981-1.593l-2.132.897s.73 1.54.156 2.816c0 0-.069-2.759-.479-2.691-.083 0-1.109.533-1.109.533s1.253 2.69.299 4.628c0 0 .359-3.304-.699-4.434l-1.495.876s1.465 2.768.472 5.029c0 0 .254-3.465-.789-4.817l-1.361 1.062s1.379 2.729.539 4.604c0 0-.111-4.036-.835-4.341 0 0-1.195 1.049-1.369 1.494 0 0 .942 1.98.356 3.026 0 0-.359-2.691-.652-2.691 0 0-1.196 1.794-1.309 2.99 0 0 .051-1.818 1.022-3.172a3.593 3.593 0 00-1.818.942s.186-1.262 2.111-1.37c0 0 .981-1.351 1.241-1.435 0 0-1.914-.158-3.074.356 0 0 1.023-1.196 3.427-.649l1.342-1.094s-2.52-.347-3.588.036c0 0 1.229-1.052 3.95-.299l1.462-.873s-2.147-.463-3.426-.299c0 0 1.348-.729 3.856.06l1.044-.47s-1.573-.299-2.033-.358c-.461-.06-.488-.174-.488-.174a5.426 5.426 0 012.957.329s2.222-.813 2.186-.954z"
13366
+ }
13367
+ ),
13368
+ /* @__PURE__ */ jsx("ellipse", { cx: "380.363", cy: "298.487", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "8.945", ry: "1.513" }),
13369
+ /* @__PURE__ */ jsx(
13370
+ "path",
13371
+ {
13372
+ fill: PRIMARY_MAIN,
13373
+ fillRule: "nonzero",
13374
+ d: "M394.956 258.102s-7.125-.43-6.279 4.565a1.218 1.218 0 00.631 1.283s.015-.371.733-.245c.255.042.515.054.774.036.349-.023.681-.159.945-.389.264-.23 2.003-.828 2.783-4.102 0 0 .577-.714.553-.897l-1.196.511s.41.87.087 1.591c0 0-.039-1.558-.269-1.522-.048 0-.625.299-.625.299s.706 1.495.173 2.61c0 0 .204-1.862-.394-2.502l-.846.496s.825 1.561.266 2.834c0 0 .143-1.955-.446-2.714l-.765.598s.774 1.539.299 2.595c0 0-.063-2.275-.469-2.446a4.75 4.75 0 00-.775.834s.532 1.118.204 1.707c0 0-.204-1.515-.368-1.521 0 0-.67 1.001-.739 1.689a3.671 3.671 0 01.577-1.794 2.007 2.007 0 00-1.025.532s.104-.711 1.196-.771c0 0 .553-.763.699-.81 0 0-1.079-.09-1.734.2 0 0 .577-.67 1.932-.365l.759-.619s-1.423-.194-2.024.021c0 0 .694-.598 2.227-.161l.826-.494a7.445 7.445 0 00-1.935-.164s.763-.413 2.174.033l.598-.263s-.897-.177-1.148-.203c-.252-.027-.275-.099-.275-.099a3.078 3.078 0 011.668.185s1.232-.46 1.208-.538z"
13375
+ }
13376
+ ),
13377
+ /* @__PURE__ */ jsx("ellipse", { cx: "390.052", cy: "264.383", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "5.044", ry: "1" }),
13378
+ /* @__PURE__ */ jsx(
13379
+ "path",
13380
+ {
13381
+ fill: PRIMARY_MAIN,
13382
+ fillRule: "nonzero",
13383
+ d: "M352.896 262.437s-8.604-.52-7.588 5.51a1.47 1.47 0 00.763 1.549s0-.449.897-.299c.309.052.623.067.935.045a1.923 1.923 0 001.142-.473c.318-.279 2.419-.998 3.361-4.951 0 0 .697-.861.667-1.085l-1.468.622s.496 1.046.104 1.916c0 0-.048-1.877-.326-1.835-.056 0-.753.364-.753.364s.852 1.824.209 3.152c0 0 .245-2.249-.475-3.02l-1.023.598s.996 1.886.32 3.423c0 0 .174-2.359-.535-3.289l-.927.724s.939 1.857.365 3.133c0 0-.072-2.747-.565-2.954 0 0-.81.715-.933 1.008 0 0 .64 1.348.242 2.06 0 0-.245-1.83-.445-1.839 0 0-.804 1.214-.897 2.042.04-.768.28-1.512.697-2.159a2.427 2.427 0 00-1.235.643s.125-.858 1.435-.933c0 0 .667-.92.846-.974 0 0-1.303-.111-2.093.239 0 0 .694-.807 2.329-.44l.915-.747s-1.713-.233-2.442.024c0 0 .837-.715 2.69-.191l.996-.598s-1.462-.314-2.335-.201c0 0 .921-.496 2.625.042l.711-.32s-1.07-.209-1.384-.242c-.314-.033-.329-.119-.329-.119a3.69 3.69 0 012.012.221s1.519-.553 1.492-.646z"
13384
+ }
13385
+ ),
13386
+ /* @__PURE__ */ jsx("ellipse", { cx: "346.97", cy: "270.022", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "6.09", ry: "1.028" }),
13387
+ /* @__PURE__ */ jsx(
13388
+ "rect",
13389
+ {
13390
+ width: "51.026",
13391
+ height: "91.312",
13392
+ x: "303.926",
13393
+ y: "69.211",
13394
+ fill: "#FFF",
13395
+ fillRule: "nonzero",
13396
+ rx: "4.737",
13397
+ transform: "rotate(-71.99 329.44 114.867)"
13398
+ }
13399
+ ),
13400
+ /* @__PURE__ */ jsx("circle", { cx: "303.613", cy: "103.507", r: "9.376", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.2" }),
13401
+ /* @__PURE__ */ jsx(
13402
+ "path",
13403
+ {
13404
+ fill: PRIMARY_MAIN,
13405
+ fillRule: "nonzero",
13406
+ d: "M344.582495 86.4883769L347.150665 86.4883769 347.150665 127.336977 344.582495 127.336977z",
13407
+ opacity: "0.2",
13408
+ transform: "rotate(-71.99 345.867 106.913)"
13409
+ }
13410
+ ),
13411
+ /* @__PURE__ */ jsx(
13412
+ "path",
13413
+ {
13414
+ fill: PRIMARY_MAIN,
13415
+ fillRule: "nonzero",
13416
+ d: "M333.028401 99.6373982L335.596571 99.6373982 335.596571 120.445898 333.028401 120.445898z",
13417
+ opacity: "0.2",
13418
+ transform: "rotate(-71.99 334.312 110.042)"
13419
+ }
13420
+ ),
13421
+ /* @__PURE__ */ jsx(
13422
+ "path",
13423
+ {
13424
+ fill: PRIMARY_MAIN,
13425
+ fillRule: "nonzero",
13426
+ d: "M337.109071 101.431004L339.677241 101.431004 339.677241 135.086304 337.109071 135.086304z",
13427
+ opacity: "0.2",
13428
+ transform: "rotate(-71.99 338.393 118.259)"
13429
+ }
13430
+ ),
13431
+ /* @__PURE__ */ jsx(
13432
+ "path",
13433
+ {
13434
+ fill: PRIMARY_MAIN,
13435
+ fillRule: "nonzero",
13436
+ d: "M338.505494 105.174377L341.073664 105.174377 341.073664 146.022978 338.505494 146.022978z",
13437
+ opacity: "0.2",
13438
+ transform: "rotate(-71.99 339.79 125.599)"
13439
+ }
13440
+ ),
13441
+ /* @__PURE__ */ jsx(
13442
+ "path",
13443
+ {
13444
+ fill: PRIMARY_MAIN,
13445
+ fillRule: "nonzero",
13446
+ d: "M348.060839 134.648161L353.026769 134.648161 353.026769 145.952261 348.060839 145.952261z",
13447
+ opacity: "0.5",
13448
+ transform: "rotate(-71.99 350.544 140.3)"
13449
+ }
13450
+ ),
13451
+ /* @__PURE__ */ jsx(
13452
+ "rect",
13453
+ {
13454
+ width: "50.3",
13455
+ height: "78.305",
13456
+ x: "291.549",
13457
+ y: "174.486",
13458
+ fill: "#FFF",
13459
+ fillRule: "nonzero",
13460
+ rx: "4",
13461
+ transform: "rotate(-57.265 316.7 213.638)"
13462
+ }
13463
+ ),
13464
+ /* @__PURE__ */ jsx(
13465
+ "path",
13466
+ {
13467
+ fill: "#DFE3E8",
13468
+ fillRule: "nonzero",
13469
+ d: "M278.038439 203.88874L292.269539 203.88874 292.269539 207.23723 278.038439 207.23723z",
13470
+ transform: "rotate(-57.57 285.154 205.563)"
13471
+ }
13472
+ ),
13473
+ /* @__PURE__ */ jsx(
13474
+ "path",
13475
+ {
13476
+ fill: "#DFE3E8",
13477
+ fillRule: "nonzero",
13478
+ d: "M283.007935 199.201889L314.262535 199.201889 314.262535 202.272339 283.007935 202.272339z",
13479
+ transform: "rotate(-57.57 298.635 200.737)"
13480
+ }
13481
+ ),
13482
+ /* @__PURE__ */ jsx(
13483
+ "path",
13484
+ {
13485
+ fill: "#DFE3E8",
13486
+ fillRule: "nonzero",
13487
+ d: "M288.543935 202.715889L319.798535 202.715889 319.798535 205.786339 288.543935 205.786339z",
13488
+ transform: "rotate(-57.57 304.171 204.251)"
13489
+ }
13490
+ ),
13491
+ /* @__PURE__ */ jsx(
13492
+ "path",
13493
+ {
13494
+ fill: "#DFE3E8",
13495
+ fillRule: "nonzero",
13496
+ d: "M294.078936 206.235889L325.333536 206.235889 325.333536 209.306339 294.078936 209.306339z",
13497
+ transform: "rotate(-57.57 309.706 207.771)"
13498
+ }
13499
+ ),
13500
+ /* @__PURE__ */ jsx(
13501
+ "path",
13502
+ {
13503
+ fill: "#DFE3E8",
13504
+ fillRule: "nonzero",
13505
+ d: "M299.879919 211.40702L331.090719 211.40702 331.090719 214.47316 299.879919 214.47316z",
13506
+ transform: "rotate(-57.265 315.485 212.94)"
13507
+ }
13508
+ ),
13509
+ /* @__PURE__ */ jsx(
13510
+ "path",
13511
+ {
13512
+ fill: "#F4F6F8",
13513
+ fillRule: "nonzero",
13514
+ d: "M305.149936 213.268889L336.404536 213.268889 336.404536 216.339339 305.149936 216.339339z",
13515
+ transform: "rotate(-57.57 320.777 214.804)"
13516
+ }
13517
+ ),
13518
+ /* @__PURE__ */ jsx(
13519
+ "path",
13520
+ {
13521
+ fill: "#F4F6F8",
13522
+ fillRule: "nonzero",
13523
+ d: "M310.685935 216.782889L341.940535 216.782889 341.940535 219.853339 310.685935 219.853339z",
13524
+ transform: "rotate(-57.57 326.313 218.318)"
13525
+ }
13526
+ ),
13527
+ /* @__PURE__ */ jsx(
13528
+ "path",
13529
+ {
13530
+ fill: "#DFE3E8",
13531
+ fillRule: "nonzero",
13532
+ d: "M341.417983 210.406958L349.511163 210.406958 349.511163 218.500138 341.417983 218.500138z",
13533
+ transform: "rotate(-57.57 345.465 214.454)"
13534
+ }
13535
+ ),
13536
+ /* @__PURE__ */ jsx(
13537
+ "path",
13538
+ {
13539
+ fill: PRIMARY_MAIN,
13540
+ fillRule: "nonzero",
13541
+ d: "M269.277 168.76l-45.767.493a3.127 3.127 0 00-3.094 3.125v3.782a3.127 3.127 0 01-3.05 3.124l-33.024.792a3.124 3.124 0 01-3.095-2.308l-1.551-5.701a3.124 3.124 0 00-3.053-2.308l-44.113.475a3.125 3.125 0 00-3.05 3.648l17.747 104.449a3.129 3.129 0 003.071 2.604l139.363.598a3.129 3.129 0 003.082-3.714l-20.366-106.521a3.125 3.125 0 00-3.1-2.538z"
13542
+ }
13543
+ ),
13544
+ /* @__PURE__ */ jsx(
13545
+ "path",
13546
+ {
13547
+ fill: PRIMARY_DARK,
13548
+ fillRule: "nonzero",
13549
+ d: "M269.277 168.76l-45.767.493a3.127 3.127 0 00-3.094 3.125v3.782a3.127 3.127 0 01-3.05 3.124l-33.024.792a3.124 3.124 0 01-3.095-2.308l-1.551-5.701a3.124 3.124 0 00-3.053-2.308l-44.113.475a3.125 3.125 0 00-3.05 3.648l17.747 104.449a3.129 3.129 0 003.071 2.604l139.363.598a3.129 3.129 0 003.082-3.714l-20.366-106.521a3.125 3.125 0 00-3.1-2.538z",
13550
+ opacity: "0.243"
13551
+ }
13552
+ ),
13553
+ /* @__PURE__ */ jsx(
13554
+ "path",
13555
+ {
13556
+ fill: "url(#linearGradient-2)",
13557
+ fillRule: "nonzero",
13558
+ d: "M269.277 168.76l-45.767.493a3.127 3.127 0 00-3.094 3.125v3.782a3.127 3.127 0 01-3.05 3.124l-33.024.792a3.124 3.124 0 01-3.095-2.308l-1.551-5.701a3.124 3.124 0 00-3.053-2.308l-44.113.475a3.125 3.125 0 00-3.05 3.648l17.747 104.449a3.129 3.129 0 003.071 2.604l139.363.598a3.129 3.129 0 003.082-3.714l-20.366-106.521a3.125 3.125 0 00-3.1-2.538z",
13559
+ opacity: "0.32"
13560
+ }
13561
+ ),
13562
+ /* @__PURE__ */ jsx("ellipse", { cx: "119.593", cy: "258.664", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "4.846", ry: "1" }),
13563
+ /* @__PURE__ */ jsx("ellipse", { cx: "101.03", cy: "260.545", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "4.846", ry: "1" }),
13564
+ /* @__PURE__ */ jsx("ellipse", { cx: "108.459", cy: "265.905", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "3.444", ry: "1" }),
13565
+ /* @__PURE__ */ jsx("ellipse", { cx: "89.193", cy: "265.433", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "3.444", ry: "1" }),
13566
+ /* @__PURE__ */ jsx(
13567
+ "path",
13568
+ {
13569
+ fill: PRIMARY_MAIN,
13570
+ fillRule: "nonzero",
13571
+ d: "M100.925 260.398s6.796-22.279-1.064-31.204c-5.881-6.676-12.557-5.877-15.547-5.052a5.528 5.528 0 00-3.564 2.963c-1.046 2.254-.858 5.913 6.521 10.186 12.35 7.151 13.119 16.96 13.119 16.96l.535 6.147z"
13572
+ }
13573
+ ),
13574
+ /* @__PURE__ */ jsx(
13575
+ "path",
13576
+ {
13577
+ stroke: PRIMARY_DARKER,
13578
+ strokeLinecap: "round",
13579
+ strokeWidth: "0.5",
13580
+ d: "M85.382 227.302s20.031 6.278 15.546 33.096M97.083 229.547s-2.76 1.86-1.88 4.655M87.39 231.203s1.687-1.716 3.741-.768M95.31 239.832s2.963-1.495 3.728.379M102.638 242.962s-2.224-.176-2.263.897"
13581
+ }
13582
+ ),
13583
+ /* @__PURE__ */ jsx(
13584
+ "path",
13585
+ {
13586
+ fill: PRIMARY_MAIN,
13587
+ fillRule: "nonzero",
13588
+ d: "M101.2 260.575s-7.961-16.193-10.147-15.846c-1.037.17-1.516 1.196-1.734 2.218a6.516 6.516 0 00.434 3.941c1.13 2.601 4.165 7.519 11.447 9.687z"
13589
+ }
13590
+ ),
13591
+ /* @__PURE__ */ jsx(
13592
+ "path",
13593
+ {
13594
+ stroke: PRIMARY_DARKER,
13595
+ strokeLinecap: "round",
13596
+ strokeWidth: "0.5",
13597
+ d: "M91.113 247.808s8.353 12.115 9.968 12.647"
13598
+ }
13599
+ ),
13600
+ /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M90.344 249.701L92.293 249.701" }),
13601
+ /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M92.68 254.132L95.738 254.263" }),
13602
+ /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M94.542 250.586L94.21 252.179" }),
13603
+ /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M97.792 255.432L97.732 256.879" }),
13604
+ /* @__PURE__ */ jsx(
13605
+ "path",
13606
+ {
13607
+ fill: PRIMARY_MAIN,
13608
+ fillRule: "nonzero",
13609
+ d: "M100.964 260.575s7.959-16.193 10.144-15.846c1.041.17 1.519 1.196 1.734 2.218a6.514 6.514 0 01-.433 3.941c-1.13 2.601-4.168 7.519-11.445 9.687z"
13610
+ }
13611
+ ),
13612
+ /* @__PURE__ */ jsx(
13613
+ "path",
13614
+ {
13615
+ stroke: PRIMARY_DARKER,
13616
+ strokeLinecap: "round",
13617
+ strokeWidth: "0.5",
13618
+ d: "M111.051 247.808s-8.371 12.115-9.97 12.647"
13619
+ }
13620
+ ),
13621
+ /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M111.82 249.701L109.871 249.701" }),
13622
+ /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M109.485 254.132L106.426 254.263" }),
13623
+ /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M107.622 250.586L107.954 252.179" }),
13624
+ /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M104.372 255.432L104.432 256.879" }),
13625
+ /* @__PURE__ */ jsx(
13626
+ "path",
13627
+ {
13628
+ fill: PRIMARY_MAIN,
13629
+ fillRule: "nonzero",
13630
+ d: "M87.295 264.357a1.375 1.375 0 01-.452-.685.599.599 0 01.317-.697c.3-.11.598.09.837.299.24.21.512.431.81.38a1.237 1.237 0 01-.382-1.16.47.47 0 01.105-.236c.161-.174.454-.099.648.039.598.43.787 1.264.79 2.018.03-.277.03-.555 0-.831a.853.853 0 01.334-.727.938.938 0 01.476-.114.988.988 0 01.774.222.767.767 0 01-.03.947c-.229.257-.5.474-.801.64a1.805 1.805 0 00-.571.547.399.399 0 00-.042.096h-1.74a4.826 4.826 0 01-1.073-.738zM117.626 257.833a1.355 1.355 0 01-.452-.682.599.599 0 01.314-.696c.299-.111.598.089.837.299.239.209.509.436.817.391a1.236 1.236 0 01-.386-1.157.472.472 0 01.107-.236c.162-.173.455-.099.649.036.613.433.787 1.268.79 2.021a4.008 4.008 0 000-.834.852.852 0 01.299-.736.955.955 0 01.475-.11.998.998 0 01.774.218.768.768 0 01-.033.951 2.996 2.996 0 01-.798.64 1.767 1.767 0 00-.571.544.499.499 0 00-.042.098h-1.701a4.78 4.78 0 01-1.079-.747zM107.518 264.357a1.406 1.406 0 01-.455-.685.6.6 0 01.317-.697c.299-.11.598.09.837.299.239.21.505.437.816.395a1.247 1.247 0 01-.385-1.16.472.472 0 01.107-.236c.162-.174.455-.099.649.039.613.43.783 1.264.789 2.018.03-.277.03-.555 0-.832a.855.855 0 01.314-.735.93.93 0 01.476-.114.988.988 0 01.774.222.764.764 0 01-.033.947 3.028 3.028 0 01-.798.64 1.798 1.798 0 00-.571.547.411.411 0 00-.042.096h-1.734c-.385-.2-.742-.45-1.061-.744z"
13631
+ }
13632
+ ),
13633
+ /* @__PURE__ */ jsx("circle", { cx: "84.467", cy: "87.003", r: "6.467", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1" }),
13634
+ /* @__PURE__ */ jsx("circle", { cx: "395.425", cy: "138.681", r: "6.467", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1" }),
13635
+ /* @__PURE__ */ jsx("circle", { cx: "279.178", cy: "66.467", r: "6.467", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1" }),
13636
+ /* @__PURE__ */ jsx("circle", { cx: "97.4", cy: "122.68", r: "10.838", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1" }),
13637
+ /* @__PURE__ */ jsx(
13638
+ "path",
13639
+ {
13640
+ fill: PRIMARY_DARK,
13641
+ fillRule: "nonzero",
13642
+ d: "M206.029 209.911c-7.975 0-14.44 6.465-14.44 14.44s6.465 14.44 14.44 14.44 14.44-6.465 14.44-14.44-6.465-14.44-14.44-14.44z"
13643
+ }
13644
+ ),
13645
+ /* @__PURE__ */ jsx(
13646
+ "path",
13647
+ {
13648
+ fill: PRIMARY_MAIN,
13649
+ fillRule: "nonzero",
13650
+ d: "M206.029 211.59c7.047 0 12.761 5.714 12.761 12.761 0 7.048-5.714 12.761-12.761 12.761-7.048 0-12.761-5.713-12.761-12.761.006-7.045 5.716-12.754 12.761-12.761",
13651
+ opacity: "0.72"
13652
+ }
13653
+ ),
13654
+ /* @__PURE__ */ jsx(
13655
+ "path",
13656
+ {
13657
+ fill: PRIMARY_DARK,
13658
+ fillRule: "nonzero",
13659
+ d: "M200.058 225.406l-.699-.681a.721.721 0 010-1.065l6.127-5.984a.753.753 0 01.546-.231c.206 0 .404.083.545.231l6.127 5.978a.733.733 0 010 1.065l-.699.682a.768.768 0 01-1.091 0l-3.622-3.727v8.843a.725.725 0 01-.219.523.76.76 0 01-.534.217h-1.009a.75.75 0 01-.759-.74v-8.832l-3.622 3.726a.768.768 0 01-1.091-.005z"
13660
+ }
13661
+ )
13662
+ ] }) });
13663
+ }
13664
+ var UploadIllustration_default = memo(UploadIllustration);
13665
+ var StyledDropZone = styled("div")(({ theme }) => ({
13666
+ outline: "none",
13667
+ cursor: "pointer",
13668
+ overflow: "hidden",
13669
+ position: "relative",
13670
+ padding: theme.spacing(5),
13671
+ borderRadius: theme.shape.borderRadius,
13672
+ transition: theme.transitions.create("padding"),
13673
+ backgroundColor: theme.palette.background.default,
13674
+ border: `1px dashed ${alpha(theme.palette.grey[500], 0.32)}`,
13675
+ "&:hover": {
13676
+ opacity: 0.72
13677
+ }
13678
+ }));
13679
+ function Upload({
13680
+ disabled,
12411
13681
  multiple = false,
12412
- accept = "image/*",
12413
- maxFiles = 5,
12414
- maxSize = 5 * 1024 * 1024,
12415
- // 5MB
12416
- disabled = false,
13682
+ error,
13683
+ helperText,
13684
+ //
13685
+ file,
13686
+ onDelete,
13687
+ //
13688
+ files,
13689
+ thumbnail,
13690
+ onUpload,
13691
+ onRemove,
13692
+ onRemoveAll,
12417
13693
  sx,
12418
- dropZoneSx,
12419
- previewSx,
12420
- errorSx,
12421
- helperTextSx,
12422
- onDrop: externalOnDrop,
12423
- onDelete: externalOnDelete,
12424
- ...rest
12425
- }) => {
12426
- var _a;
12427
- const { errors, touched, setFieldValue, values } = useFormikContext();
12428
- const fieldError = _.get(errors, name);
12429
- const isTouched = _.get(touched, name);
12430
- const [isDragging, setIsDragging] = useState(false);
12431
- const currentFiles = _.get(values, name, multiple ? [] : []) || [];
12432
- const isMaxFilesReached = multiple && currentFiles && currentFiles.length >= maxFiles;
12433
- const processFile = async (file) => {
12434
- if (file.type.startsWith("image/")) {
12435
- const preview = await new Promise((resolve) => {
12436
- const reader = new FileReader();
12437
- reader.onload = () => resolve(reader.result);
12438
- reader.readAsDataURL(file);
12439
- });
12440
- return { file, preview, name: file.name, type: file.type };
12441
- }
12442
- return { file, name: file.name, type: file.type };
12443
- };
12444
- const handleDrop = useCallback(
12445
- async (acceptedFiles) => {
12446
- if (disabled || isMaxFilesReached)
12447
- return;
12448
- try {
12449
- const newFiles = await Promise.all(acceptedFiles.map(processFile));
12450
- if (multiple) {
12451
- const updatedFiles = [...currentFiles || [], ...newFiles].slice(
12452
- 0,
12453
- maxFiles
12454
- );
12455
- setFieldValue(name, updatedFiles, true);
12456
- } else {
12457
- setFieldValue(name, newFiles[0] || null, true);
12458
- }
12459
- externalOnDrop == null ? void 0 : externalOnDrop(acceptedFiles);
12460
- } catch (error) {
12461
- console.error("Error processing files:", error);
12462
- }
12463
- },
12464
- [
12465
- currentFiles,
12466
- disabled,
12467
- isMaxFilesReached,
12468
- multiple,
12469
- name,
12470
- setFieldValue,
12471
- maxFiles,
12472
- externalOnDrop
12473
- ]
12474
- );
12475
- const handleRemove = (index) => {
12476
- if (disabled)
12477
- return;
12478
- if (multiple) {
12479
- const updatedFiles = [...currentFiles || []];
12480
- updatedFiles.splice(index, 1);
12481
- setFieldValue(name, updatedFiles, true);
12482
- } else {
12483
- setFieldValue(name, null, true);
12484
- }
12485
- externalOnDelete == null ? void 0 : externalOnDelete();
12486
- };
12487
- const { getRootProps, getInputProps, isDragActive } = useDropzone({
12488
- onDrop: handleDrop,
12489
- accept: accept ? { [accept]: [] } : void 0,
12490
- maxFiles: multiple ? maxFiles - ((currentFiles == null ? void 0 : currentFiles.length) || 0) : 1,
12491
- maxSize,
13694
+ ...other
13695
+ }) {
13696
+ const {
13697
+ getRootProps,
13698
+ getInputProps,
13699
+ isDragActive,
13700
+ isDragReject,
13701
+ fileRejections
13702
+ } = useDropzone({
12492
13703
  multiple,
12493
- disabled: disabled || isMaxFilesReached,
12494
- onDragEnter: () => setIsDragging(true),
12495
- onDragLeave: () => setIsDragging(false),
12496
- onDropAccepted: () => setIsDragging(false)
13704
+ disabled,
13705
+ ...other
12497
13706
  });
12498
- const renderPreview = (file, index) => {
12499
- var _a2;
12500
- const isImage = (_a2 = file.type) == null ? void 0 : _a2.startsWith("image/");
12501
- const previewUrl = file.preview || (typeof file.file === "string" ? file.file : "");
12502
- const fileName = file.name || (typeof file.file === "string" ? file.file.split("/").pop() : file.file.name);
12503
- return /* @__PURE__ */ jsx(
12504
- Paper,
12505
- {
12506
- sx: [
12507
- {
12508
- position: "relative",
12509
- p: 1,
12510
- borderRadius: 1,
12511
- overflow: "hidden",
12512
- border: "1px solid",
12513
- borderColor: "divider",
12514
- "&:hover .file-actions": {
12515
- opacity: 1
12516
- }
12517
- },
12518
- ...Array.isArray(previewSx) ? previewSx : [previewSx]
12519
- ],
12520
- children: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
12521
- isImage && previewUrl ? /* @__PURE__ */ jsx(
12522
- Avatar,
12523
- {
12524
- variant: "rounded",
12525
- src: previewUrl,
12526
- sx: { width: 48, height: 48, bgcolor: "background.paper" },
12527
- children: /* @__PURE__ */ jsx(Image, {})
12528
- }
12529
- ) : /* @__PURE__ */ jsx(
12530
- Avatar,
12531
- {
12532
- variant: "rounded",
12533
- sx: { width: 48, height: 48, bgcolor: "action.hover" },
12534
- children: /* @__PURE__ */ jsx(InsertDriveFile, {})
12535
- }
12536
- ),
12537
- /* @__PURE__ */ jsx(Typography, { variant: "body2", noWrap: true, sx: { flex: 1, maxWidth: 200 }, children: fileName }),
12538
- /* @__PURE__ */ jsx(
12539
- Box,
12540
- {
12541
- className: "file-actions",
12542
- sx: { opacity: 0, transition: "opacity 0.2s" },
12543
- children: /* @__PURE__ */ jsx(Tooltip, { title: "Remove", children: /* @__PURE__ */ jsx(
12544
- IconButton,
12545
- {
12546
- size: "small",
12547
- color: "error",
12548
- onClick: (e) => {
12549
- e.stopPropagation();
12550
- handleRemove(index);
12551
- },
12552
- disabled,
12553
- children: /* @__PURE__ */ jsx(Delete$1, { fontSize: "small" })
12554
- }
12555
- ) })
12556
- }
12557
- )
12558
- ] })
12559
- },
12560
- index
12561
- );
12562
- };
12563
- return /* @__PURE__ */ jsxs(Box, { sx, children: [
13707
+ const { t } = useTranslation();
13708
+ const hasFile = !!file && !multiple;
13709
+ const hasFiles = files && multiple && files.length > 0;
13710
+ const isError = isDragReject || !!error;
13711
+ return /* @__PURE__ */ jsxs(Box, { sx: { width: 1, position: "relative", ...sx }, children: [
12564
13712
  /* @__PURE__ */ jsxs(
12565
- Box,
13713
+ StyledDropZone,
12566
13714
  {
12567
13715
  ...getRootProps(),
12568
- sx: [
12569
- {
12570
- p: 3,
12571
- border: "2px dashed",
12572
- borderRadius: 1,
12573
- bgcolor: isDragging ? "action.hover" : "background.paper",
12574
- borderColor: isDragging ? "primary.main" : "divider",
12575
- cursor: disabled ? "not-allowed" : "pointer",
12576
- opacity: disabled ? 0.7 : 1,
12577
- transition: "all 0.2s ease-in-out",
12578
- "&:hover": !disabled && {
12579
- borderColor: "primary.main",
12580
- bgcolor: "action.hover"
12581
- }
13716
+ sx: {
13717
+ ...isDragActive && {
13718
+ opacity: 0.72
12582
13719
  },
12583
- ...Array.isArray(dropZoneSx) ? dropZoneSx : [dropZoneSx]
12584
- ],
13720
+ ...isError && {
13721
+ color: "error.main",
13722
+ bgcolor: "error.lighter",
13723
+ borderColor: "error.light"
13724
+ },
13725
+ ...disabled && {
13726
+ opacity: 0.48,
13727
+ pointerEvents: "none"
13728
+ },
13729
+ ...hasFile && {
13730
+ padding: "12% 0"
13731
+ }
13732
+ },
12585
13733
  children: [
12586
13734
  /* @__PURE__ */ jsx("input", { ...getInputProps() }),
12587
- /* @__PURE__ */ jsxs(
12588
- Stack,
13735
+ /* @__PURE__ */ jsx(
13736
+ Placeholder,
12589
13737
  {
12590
- spacing: 1,
12591
- alignItems: "center",
12592
- justifyContent: "center",
12593
- textAlign: "center",
12594
- children: [
12595
- /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "text.secondary", children: isDragActive ? "Drop the files here..." : `Drag & drop ${multiple ? "files" : "a file"} here, or click to select ${multiple ? "files" : "a file"}` }),
12596
- /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "text.secondary", children: [
12597
- accept,
12598
- " \u2022 Max ",
12599
- maxSize / (1024 * 1024),
12600
- "MB per file \u2022",
12601
- " ",
12602
- multiple ? `Max ${maxFiles} files` : "Single file only"
12603
- ] })
12604
- ]
13738
+ sx: {
13739
+ ...hasFile && {
13740
+ opacity: 0
13741
+ }
13742
+ }
12605
13743
  }
12606
- )
13744
+ ),
13745
+ hasFile && /* @__PURE__ */ jsx(SingleFilePreview, { file })
12607
13746
  ]
12608
13747
  }
12609
13748
  ),
12610
- ((_a = currentFiles == null ? void 0 : currentFiles.length) != null ? _a : 0) > 0 && /* @__PURE__ */ jsx(Stack, { spacing: 1, sx: { mt: 2 }, children: currentFiles == null ? void 0 : currentFiles.map((file, index) => renderPreview(file, index)) }),
12611
- Boolean(fieldError) && isTouched && /* @__PURE__ */ jsx(
12612
- Typography,
13749
+ helperText && helperText,
13750
+ /* @__PURE__ */ jsx(RejectionFiles, { fileRejections }),
13751
+ hasFile && onDelete && /* @__PURE__ */ jsx(
13752
+ IconButton,
12613
13753
  {
12614
- variant: "caption",
12615
- sx: [
13754
+ size: "small",
13755
+ onClick: onDelete,
13756
+ sx: {
13757
+ top: 16,
13758
+ right: 16,
13759
+ zIndex: 9,
13760
+ position: "absolute",
13761
+ color: (theme) => alpha(theme.palette.common.white, 0.8),
13762
+ bgcolor: (theme) => alpha(theme.palette.grey[900], 0.72),
13763
+ "&:hover": {
13764
+ bgcolor: (theme) => alpha(theme.palette.grey[900], 0.48)
13765
+ }
13766
+ },
13767
+ children: /* @__PURE__ */ jsx(Iconify_default, { icon: "eva:close-fill", width: 18 })
13768
+ }
13769
+ ),
13770
+ hasFiles === true && /* @__PURE__ */ jsxs(Fragment, { children: [
13771
+ /* @__PURE__ */ jsx(Box, { sx: { my: 3 }, children: /* @__PURE__ */ jsx(
13772
+ MultiFilePreview,
13773
+ {
13774
+ files,
13775
+ thumbnail,
13776
+ onRemove
13777
+ }
13778
+ ) }),
13779
+ /* @__PURE__ */ jsxs(Stack, { direction: "row", justifyContent: "flex-end", spacing: 1.5, children: [
13780
+ onRemoveAll && /* @__PURE__ */ jsx(
13781
+ Button,
12616
13782
  {
12617
- display: "block",
12618
- color: "error.main",
12619
- mt: 1
12620
- },
12621
- ...Array.isArray(errorSx) ? errorSx : [errorSx]
12622
- ],
12623
- children: fieldError
13783
+ color: "inherit",
13784
+ variant: "outlined",
13785
+ size: "small",
13786
+ onClick: onRemoveAll,
13787
+ children: t("Remove all")
13788
+ }
13789
+ ),
13790
+ onUpload && /* @__PURE__ */ jsx(Button, { size: "small", variant: "contained", onClick: onUpload, children: t("Upload files") })
13791
+ ] })
13792
+ ] })
13793
+ ] });
13794
+ }
13795
+ function Placeholder({ sx, ...other }) {
13796
+ const { t } = useTranslation();
13797
+ return /* @__PURE__ */ jsxs(
13798
+ Stack,
13799
+ {
13800
+ spacing: 5,
13801
+ alignItems: "center",
13802
+ justifyContent: "center",
13803
+ direction: {
13804
+ xs: "column",
13805
+ md: "row"
13806
+ },
13807
+ sx: {
13808
+ width: 1,
13809
+ textAlign: {
13810
+ xs: "center",
13811
+ md: "left"
13812
+ },
13813
+ ...sx
13814
+ },
13815
+ ...other,
13816
+ children: [
13817
+ /* @__PURE__ */ jsx(UploadIllustration_default, { sx: { width: 220 } }),
13818
+ /* @__PURE__ */ jsxs("div", { children: [
13819
+ /* @__PURE__ */ jsx(Typography, { gutterBottom: true, variant: "h5", children: t("Drop or Select file") }),
13820
+ /* @__PURE__ */ jsxs(Typography, { variant: "body2", sx: { color: "text.secondary" }, children: [
13821
+ t("Drop files here or click"),
13822
+ /* @__PURE__ */ jsx(
13823
+ Typography,
13824
+ {
13825
+ variant: "body2",
13826
+ component: "span",
13827
+ sx: {
13828
+ mx: 0.5,
13829
+ textDecoration: "underline"
13830
+ },
13831
+ children: t("browse")
13832
+ }
13833
+ ),
13834
+ t("thorough your machine")
13835
+ ] })
13836
+ ] })
13837
+ ]
13838
+ }
13839
+ );
13840
+ }
13841
+ async function blobToBase64(file) {
13842
+ return new Promise((resolve, reject) => {
13843
+ const reader = new FileReader();
13844
+ reader.readAsDataURL(file);
13845
+ reader.onloadend = function() {
13846
+ const base64data = reader.result;
13847
+ resolve(base64data);
13848
+ };
13849
+ reader.onerror = function(err) {
13850
+ reject(err);
13851
+ };
13852
+ });
13853
+ }
13854
+ var AppUploadFile = ({ name, ...rest }) => {
13855
+ var _a, _b, _c, _d, _e;
13856
+ const { errors, touched, setFieldValue, values } = useFormikContext();
13857
+ const fieldError = _19.get(errors, name);
13858
+ const isTouched = _19.get(touched, name);
13859
+ let val = _19.get(values, name);
13860
+ if (((_a = rest.multiple) != null ? _a : false) && typeof val === "string") {
13861
+ val = val ? [val] : [];
13862
+ } else if (!((_b = rest.multiple) != null ? _b : false) && _19.isArray(val)) {
13863
+ val = val[0];
13864
+ }
13865
+ const value = ((_c = rest.multiple) != null ? _c : false) ? (val != null ? val : []).map((__) => (__ == null ? void 0 : __.file) ? __ == null ? void 0 : __.file : __) : val;
13866
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
13867
+ /* @__PURE__ */ jsx(
13868
+ Upload,
13869
+ {
13870
+ ...rest,
13871
+ file: ((_d = rest.multiple) != null ? _d : false) ? void 0 : value,
13872
+ files: ((_e = rest.multiple) != null ? _e : false) ? value : void 0,
13873
+ error: Boolean(fieldError) && isTouched,
13874
+ disabled: (rest == null ? void 0 : rest.maxFiles) !== null && (rest == null ? void 0 : rest.maxFiles) !== void 0 && (value == null ? void 0 : value.length) >= (rest == null ? void 0 : rest.maxFiles),
13875
+ onDrop: (fileVal) => {
13876
+ (async () => {
13877
+ var _a2;
13878
+ const images = await Promise.all(
13879
+ fileVal.map(async (single) => {
13880
+ var _a3;
13881
+ return {
13882
+ preview: ((_a3 = single == null ? void 0 : single.type) == null ? void 0 : _a3.includes("image")) ? await blobToBase64(single) : void 0,
13883
+ file: single
13884
+ };
13885
+ })
13886
+ );
13887
+ const currentValue = Array.isArray(value) ? value : [];
13888
+ if (rest.multiple === true) {
13889
+ if (currentValue.length >= ((_a2 = rest.maxFiles) != null ? _a2 : Infinity))
13890
+ return;
13891
+ setFieldValue(name, [...currentValue, ...images], true);
13892
+ } else {
13893
+ setFieldValue(name, images[0], true);
13894
+ }
13895
+ })();
13896
+ },
13897
+ onDelete: () => {
13898
+ var _a2;
13899
+ if ((_a2 = rest.multiple) != null ? _a2 : false) {
13900
+ setFieldValue(name, [], true);
13901
+ } else {
13902
+ setFieldValue(name, "", true);
13903
+ }
13904
+ },
13905
+ onRemove: (e) => {
13906
+ const afterFilter = val.filter((file) => {
13907
+ var _a2;
13908
+ if ((_a2 = file.file) != null ? _a2 : false) {
13909
+ return !_19.isEqual(e, file.file);
13910
+ }
13911
+ return !_19.isEqual(e, file);
13912
+ });
13913
+ setFieldValue(name, afterFilter, true);
13914
+ }
12624
13915
  }
12625
13916
  ),
12626
- /* @__PURE__ */ jsxs(
13917
+ Boolean(fieldError) && Boolean(isTouched) && /* @__PURE__ */ jsx(
12627
13918
  Typography,
12628
13919
  {
13920
+ color: "#FF5630",
12629
13921
  variant: "caption",
12630
- sx: [
12631
- {
12632
- display: "block",
12633
- color: "text.secondary",
12634
- mt: 0.5
12635
- },
12636
- ...Array.isArray(helperTextSx) ? helperTextSx : [helperTextSx]
12637
- ],
12638
- children: [
12639
- (currentFiles == null ? void 0 : currentFiles.length) || 0,
12640
- " of ",
12641
- maxFiles,
12642
- " files selected"
12643
- ]
13922
+ display: "block",
13923
+ gutterBottom: true,
13924
+ children: fieldError
12644
13925
  }
12645
- )
13926
+ ),
13927
+ rest.maxFiles != null && /* @__PURE__ */ jsxs(Typography, { variant: "caption", display: "block", gutterBottom: true, children: [
13928
+ "Maximum ",
13929
+ rest.maxFiles,
13930
+ " file allowed"
13931
+ ] })
12646
13932
  ] });
12647
13933
  };
12648
13934
  var AppUploadFile_default = AppUploadFile;