formik-form-components 0.2.12 → 0.2.14

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,12 +1,11 @@
1
1
  import { useFormikContext, Formik, Form as Form$1, ErrorMessage } from 'formik';
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';
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';
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 { DemoContainer } from '@mui/x-date-pickers/internals/demo';
9
- import _19, { get } from 'lodash';
8
+ import _, { get } from 'lodash';
10
9
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
11
10
  import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
12
11
  import Autocomplete3 from '@mui/material/Autocomplete';
@@ -33,11 +32,8 @@ import UndoIcon from '@mui/icons-material/Undo';
33
32
  import RedoIcon from '@mui/icons-material/Redo';
34
33
  import CloudUploadIcon from '@mui/icons-material/CloudUpload';
35
34
  import CloseIcon from '@mui/icons-material/Close';
36
- import { styled, alpha, useTheme as useTheme$1 } from '@mui/material/styles';
37
- import { LazyLoadImage } from 'react-lazy-load-image-component';
38
- import { AnimatePresence, m } from 'framer-motion';
35
+ import { Image, InsertDriveFile, Delete as Delete$1 } from '@mui/icons-material';
39
36
  import { useDropzone } from 'react-dropzone';
40
- import { useTranslation } from 'react-i18next';
41
37
 
42
38
  // src/Form/index.tsx
43
39
  var AppDatePicker = forwardRef(
@@ -61,9 +57,9 @@ var AppDatePicker = forwardRef(
61
57
  ...otherProps
62
58
  }, ref) => {
63
59
  const { values, setFieldValue, touched, errors, setFieldTouched } = useFormikContext();
64
- const fieldValue = _19.get(values, name);
65
- const fieldError = _19.get(errors, name);
66
- const isTouched = _19.get(touched, name);
60
+ const fieldValue = _.get(values, name);
61
+ const fieldError = _.get(errors, name);
62
+ const isTouched = _.get(touched, name);
67
63
  const handleChange = (newValue, context) => {
68
64
  setFieldValue(name, newValue);
69
65
  if (externalOnChange) {
@@ -76,7 +72,7 @@ var AppDatePicker = forwardRef(
76
72
  externalOnBlur(event);
77
73
  }
78
74
  };
79
- return /* @__PURE__ */ jsx(LocalizationProvider, { dateAdapter: AdapterDayjs, children: /* @__PURE__ */ jsx(Box, { sx, ref, children: /* @__PURE__ */ jsx(DemoContainer, { components: ["DatePicker"], children: /* @__PURE__ */ jsx(
75
+ return /* @__PURE__ */ jsx(LocalizationProvider, { dateAdapter: AdapterDayjs, children: /* @__PURE__ */ jsx(Box, { sx, ref, children: /* @__PURE__ */ jsx(
80
76
  DatePicker,
81
77
  {
82
78
  label,
@@ -171,7 +167,7 @@ var AppDatePicker = forwardRef(
171
167
  },
172
168
  ...otherProps
173
169
  }
174
- ) }) }) });
170
+ ) }) });
175
171
  }
176
172
  );
177
173
  AppDatePicker.displayName = "AppDatePicker";
@@ -379,8 +375,8 @@ function AppFormErrorMessage({
379
375
  textSx
380
376
  }) {
381
377
  const { errors, touched } = useFormikContext();
382
- const fieldError = _19.get(errors, name);
383
- const isTouched = _19.get(touched, name);
378
+ const fieldError = _.get(errors, name);
379
+ const isTouched = _.get(touched, name);
384
380
  const showError = fieldError && typeof fieldError === "string";
385
381
  if (alwaysShow) {
386
382
  return showError ? /* @__PURE__ */ jsx(
@@ -457,9 +453,9 @@ var AppTextArea = forwardRef(({
457
453
  }, ref) => {
458
454
  var _a, _b, _c, _d;
459
455
  const { errors, getFieldProps, touched, setFieldValue } = useFormikContext();
460
- const fieldError = _19.get(errors, name);
461
- const isTouched = _19.get(touched, name);
462
- const value = _19.get(getFieldProps(name), "value", "");
456
+ const fieldError = _.get(errors, name);
457
+ const isTouched = _.get(touched, name);
458
+ const value = _.get(getFieldProps(name), "value", "");
463
459
  const handleChange = (e) => {
464
460
  const newValue = e.target.value;
465
461
  if (maxLength && newValue.length > maxLength)
@@ -613,9 +609,9 @@ function AppTagsCreator({
613
609
  inputSx
614
610
  }) {
615
611
  const { errors, touched, getFieldProps, values, setFieldValue, setTouched } = useFormikContext();
616
- const fieldError = _19.get(errors, name);
617
- const isTouched = _19.get(touched, name);
618
- const val = _19.get(values, name);
612
+ const fieldError = _.get(errors, name);
613
+ const isTouched = _.get(touched, name);
614
+ const val = _.get(values, name);
619
615
  return /* @__PURE__ */ jsxs(
620
616
  FormControl,
621
617
  {
@@ -738,8 +734,8 @@ function AppSwitchInput({
738
734
  ...otherProps
739
735
  }) {
740
736
  const { errors, touched, setFieldValue, values } = useFormikContext();
741
- const fieldError = _19.get(errors, name);
742
- const isTouched = _19.get(touched, name);
737
+ const fieldError = _.get(errors, name);
738
+ const isTouched = _.get(touched, name);
743
739
  return /* @__PURE__ */ jsxs(
744
740
  Box,
745
741
  {
@@ -828,9 +824,9 @@ function AppSwitch({
828
824
  ...otherProps
829
825
  }) {
830
826
  const { errors, touched, setFieldValue, values } = useFormikContext();
831
- const fieldValue = _19.get(values, name);
832
- const fieldError = _19.get(errors, name);
833
- const isTouched = _19.get(touched, name);
827
+ const fieldValue = _.get(values, name);
828
+ const fieldError = _.get(errors, name);
829
+ const isTouched = _.get(touched, name);
834
830
  return /* @__PURE__ */ jsxs(
835
831
  Stack,
836
832
  {
@@ -918,6 +914,8 @@ function AppAutoComplete({
918
914
  variant = "outlined",
919
915
  label,
920
916
  options = [],
917
+ value: propValue,
918
+ onChange: propOnChange,
921
919
  sx,
922
920
  formControlSx,
923
921
  textFieldSx,
@@ -925,9 +923,10 @@ function AppAutoComplete({
925
923
  errorSx
926
924
  }) {
927
925
  const { errors, touched, getFieldProps, values, setFieldValue } = useFormikContext();
928
- const fieldError = _19.get(errors, name);
929
- const isTouched = _19.get(touched, name);
930
- const val = _19.get(values, name);
926
+ const fieldError = _.get(errors, name);
927
+ const isTouched = _.get(touched, name);
928
+ const formikValue = _.get(values, name);
929
+ const val = propValue !== void 0 ? propValue : formikValue || [];
931
930
  return /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, variant: "filled", sx: formControlSx, children: [
932
931
  /* @__PURE__ */ jsx(
933
932
  Autocomplete,
@@ -937,10 +936,23 @@ function AppAutoComplete({
937
936
  id: "tags-filled",
938
937
  options,
939
938
  freeSolo: true,
940
- renderTags: (value, getTagProps) => value.map((option, index) => /* @__PURE__ */ createElement(Chip, { variant: "outlined", label: option, ...getTagProps({ index }), key: index, sx: chipSx })),
939
+ renderTags: (value, getTagProps) => value.map((option, index) => /* @__PURE__ */ createElement(
940
+ Chip,
941
+ {
942
+ variant: "outlined",
943
+ label: option,
944
+ ...getTagProps({ index }),
945
+ key: index,
946
+ sx: chipSx
947
+ }
948
+ )),
941
949
  value: val,
942
- onChange: (event, newValue) => {
943
- setFieldValue(name, newValue, true);
950
+ onChange: (event, newValue, reason, details) => {
951
+ if (propOnChange) {
952
+ propOnChange(event, newValue, reason, details);
953
+ } else {
954
+ setFieldValue(name, newValue, true);
955
+ }
944
956
  },
945
957
  renderInput: (params) => /* @__PURE__ */ jsx(
946
958
  TextField,
@@ -985,9 +997,9 @@ function AppAutoCompleter({
985
997
  errorSx
986
998
  }) {
987
999
  const { errors, touched, values, setFieldValue } = useFormikContext();
988
- const fieldError = _19.get(errors, name);
989
- const isTouched = _19.get(touched, name);
990
- const value = _19.get(values, name);
1000
+ const fieldError = _.get(errors, name);
1001
+ const isTouched = _.get(touched, name);
1002
+ const value = _.get(values, name);
991
1003
  const selectedOption = options.find((opt) => opt.value === value) || null;
992
1004
  return /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, variant: "filled", sx: formControlSx, children: [
993
1005
  /* @__PURE__ */ jsx(
@@ -1050,14 +1062,23 @@ var AppCheckBox = ({
1050
1062
  ...rest
1051
1063
  }) => {
1052
1064
  const { getFieldProps, setFieldValue, touched, errors } = useFormikContext();
1053
- const fieldError = _19.get(errors, name);
1054
- const isTouched = _19.get(touched, name);
1065
+ const fieldError = _.get(errors, name);
1066
+ const isTouched = _.get(touched, name);
1055
1067
  useTheme();
1056
1068
  const value = getFieldProps(name).value;
1057
- const checkedNames = Array.isArray(value) ? value : value ? [value] : [];
1058
- const handleChange = (itemName, isChecked) => {
1059
- const newValue = isChecked ? [...checkedNames, itemName] : checkedNames.filter((n) => n !== itemName);
1060
- setFieldValue(name, option.length === 1 ? isChecked : newValue);
1069
+ const checkedValues = (() => {
1070
+ if (Array.isArray(value)) {
1071
+ return value.map(String);
1072
+ }
1073
+ return value ? [String(value)] : [];
1074
+ })();
1075
+ const handleChange = (itemValue, isChecked) => {
1076
+ if (option.length === 1) {
1077
+ setFieldValue(name, isChecked ? itemValue : false);
1078
+ } else {
1079
+ const newValue = isChecked ? [...checkedValues, String(itemValue)] : checkedValues.filter((v) => v !== String(itemValue));
1080
+ setFieldValue(name, newValue);
1081
+ }
1061
1082
  };
1062
1083
  return /* @__PURE__ */ jsxs(
1063
1084
  Box,
@@ -1126,11 +1147,9 @@ var AppCheckBox = ({
1126
1147
  /* @__PURE__ */ jsx(
1127
1148
  Checkbox,
1128
1149
  {
1129
- ...getFieldProps(name),
1130
- name,
1131
- value: item.name,
1132
- checked: checkedNames.includes(item.name),
1133
- onChange: (e) => handleChange(item.name, e.target.checked),
1150
+ name: `${name}.${item.name}`,
1151
+ checked: option.length === 1 ? getFieldProps(name).value === item.value : checkedValues.includes(String(item.value)),
1152
+ onChange: (e) => handleChange(item.value, e.target.checked),
1134
1153
  disabled: disabled || item.disabled,
1135
1154
  sx: [{
1136
1155
  color: "primary.main",
@@ -1207,8 +1226,8 @@ function AppInputField({
1207
1226
  ...otherProps
1208
1227
  }) {
1209
1228
  const { errors, getFieldProps, touched } = useFormikContext();
1210
- const fieldError = _19.get(errors, name);
1211
- const isTouched = _19.get(touched, name);
1229
+ const fieldError = _.get(errors, name);
1230
+ const isTouched = _.get(touched, name);
1212
1231
  const [showPassword, setShowPassword] = useState(false);
1213
1232
  const handleShowPassword = () => {
1214
1233
  setShowPassword(!showPassword);
@@ -1299,9 +1318,9 @@ var AppMultiSelector = forwardRef(
1299
1318
  }, ref) => {
1300
1319
  const theme = useTheme();
1301
1320
  const { errors, touched, values, setFieldValue, setFieldTouched } = useFormikContext();
1302
- const fieldError = _19.get(errors, name);
1303
- const isTouched = _19.get(touched, name);
1304
- const val = _19.get(values, name);
1321
+ const fieldError = _.get(errors, name);
1322
+ const isTouched = _.get(touched, name);
1323
+ const val = _.get(values, name);
1305
1324
  const selectedValues = Array.isArray(val) ? val : [];
1306
1325
  const handleChange = (event, child) => {
1307
1326
  const newValue = event.target.value;
@@ -1559,8 +1578,8 @@ var AppPhoneNoInput = ({
1559
1578
  ...otherProps
1560
1579
  }) => {
1561
1580
  const { values, errors, touched, setFieldValue, getFieldProps } = useFormikContext();
1562
- const fieldError = _19.get(errors, name);
1563
- const isTouched = _19.get(touched, name);
1581
+ const fieldError = _.get(errors, name);
1582
+ const isTouched = _.get(touched, name);
1564
1583
  return /* @__PURE__ */ jsxs(Box, { sx: [{ mb: 2 }, containerSx, sx], children: [
1565
1584
  label && /* @__PURE__ */ jsxs(
1566
1585
  Typography,
@@ -1644,9 +1663,9 @@ var AppRadioGroup = forwardRef(({
1644
1663
  ...rest
1645
1664
  }, ref) => {
1646
1665
  const { errors, touched, getFieldProps, setFieldValue } = useFormikContext();
1647
- const fieldError = _19.get(errors, name);
1648
- const isTouched = _19.get(touched, name);
1649
- const value = _19.get(getFieldProps(name), "value");
1666
+ const fieldError = _.get(errors, name);
1667
+ const isTouched = _.get(touched, name);
1668
+ const value = _.get(getFieldProps(name), "value");
1650
1669
  const handleChange = (event) => {
1651
1670
  const newValue = event.target.value;
1652
1671
  setFieldValue(name, newValue);
@@ -1824,9 +1843,9 @@ var AppRating = forwardRef(({
1824
1843
  }, ref) => {
1825
1844
  useTheme();
1826
1845
  const { errors, touched, setFieldValue, values, setFieldTouched } = useFormikContext();
1827
- const val = _19.get(values, name);
1828
- const fieldError = _19.get(errors, name);
1829
- const isTouched = _19.get(touched, name);
1846
+ const val = _.get(values, name);
1847
+ const fieldError = _.get(errors, name);
1848
+ const isTouched = _.get(touched, name);
1830
1849
  const hasError = Boolean(fieldError) && isTouched;
1831
1850
  const handleChange = (event, newValue) => {
1832
1851
  setFieldValue(name, newValue);
@@ -3507,7 +3526,7 @@ var Node = class {
3507
3526
  copy2 = mark.addToSet(copy2);
3508
3527
  }
3509
3528
  if (!Mark.sameSet(copy2, this.marks))
3510
- throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m2) => m2.type.name)}`);
3529
+ throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m) => m.type.name)}`);
3511
3530
  this.content.forEach((node) => node.check());
3512
3531
  }
3513
3532
  /**
@@ -3756,17 +3775,17 @@ var ContentMatch = class {
3756
3775
  */
3757
3776
  toString() {
3758
3777
  let seen = [];
3759
- function scan(m2) {
3760
- seen.push(m2);
3761
- for (let i = 0; i < m2.next.length; i++)
3762
- if (seen.indexOf(m2.next[i].next) == -1)
3763
- scan(m2.next[i].next);
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);
3764
3783
  }
3765
3784
  scan(this);
3766
- return seen.map((m2, i) => {
3767
- let out = i + (m2.validEnd ? "*" : " ") + " ";
3768
- for (let i2 = 0; i2 < m2.next.length; i2++)
3769
- out += (i2 ? ", " : "") + m2.next[i2].type.name + "->" + seen.indexOf(m2.next[i2].next);
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);
3770
3789
  return out;
3771
3790
  }).join("\n");
3772
3791
  }
@@ -4647,13 +4666,13 @@ var NodeContext = class {
4647
4666
  }
4648
4667
  finish(openEnd) {
4649
4668
  if (!(this.options & OPT_PRESERVE_WS)) {
4650
- let last = this.content[this.content.length - 1], m2;
4651
- if (last && last.isText && (m2 = /[ \t\r\n\u000c]+$/.exec(last.text))) {
4669
+ let last = this.content[this.content.length - 1], m;
4670
+ if (last && last.isText && (m = /[ \t\r\n\u000c]+$/.exec(last.text))) {
4652
4671
  let text = last;
4653
- if (last.text.length == m2[0].length)
4672
+ if (last.text.length == m[0].length)
4654
4673
  this.content.pop();
4655
4674
  else
4656
- this.content[this.content.length - 1] = text.withText(text.text.slice(0, text.text.length - m2[0].length));
4675
+ this.content[this.content.length - 1] = text.withText(text.text.slice(0, text.text.length - m[0].length));
4657
4676
  }
4658
4677
  }
4659
4678
  let content = Fragment2.from(this.content);
@@ -4805,7 +4824,7 @@ var ParseContext = class {
4805
4824
  if (rule.ignore)
4806
4825
  return null;
4807
4826
  if (rule.clearMark)
4808
- marks = marks.filter((m2) => !rule.clearMark(m2));
4827
+ marks = marks.filter((m) => !rule.clearMark(m));
4809
4828
  else
4810
4829
  marks = marks.concat(this.parser.schema.marks[rule.mark].create(rule.attrs));
4811
4830
  if (rule.consuming === false)
@@ -4911,9 +4930,9 @@ var ParseContext = class {
4911
4930
  if (top.match)
4912
4931
  top.match = top.match.matchType(node.type);
4913
4932
  let nodeMarks = Mark.none;
4914
- for (let m2 of innerMarks.concat(node.marks))
4915
- if (top.type ? top.type.allowsMarkType(m2.type) : markMayApply(m2.type, node.type))
4916
- nodeMarks = m2.addToSet(nodeMarks);
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);
4917
4936
  top.content.push(node.mark(nodeMarks));
4918
4937
  return true;
4919
4938
  }
@@ -4936,9 +4955,9 @@ var ParseContext = class {
4936
4955
  if (top.options & OPT_OPEN_LEFT && top.content.length == 0)
4937
4956
  options |= OPT_OPEN_LEFT;
4938
4957
  let applyMarks = Mark.none;
4939
- marks = marks.filter((m2) => {
4940
- if (top.type ? top.type.allowsMarkType(m2.type) : markMayApply(m2.type, type)) {
4941
- applyMarks = m2.addToSet(applyMarks);
4958
+ marks = marks.filter((m) => {
4959
+ if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, type)) {
4960
+ applyMarks = m.addToSet(applyMarks);
4942
4961
  return false;
4943
4962
  }
4944
4963
  return true;
@@ -5326,10 +5345,10 @@ var Mapping = class {
5326
5345
  /**
5327
5346
  @internal
5328
5347
  */
5329
- setMirror(n, m2) {
5348
+ setMirror(n, m) {
5330
5349
  if (!this.mirror)
5331
5350
  this.mirror = [];
5332
- this.mirror.push(n, m2);
5351
+ this.mirror.push(n, m);
5333
5352
  }
5334
5353
  /**
5335
5354
  Append the inverse of the given mapping to this one.
@@ -5871,9 +5890,9 @@ function removeMark(tr, from, to, mark) {
5871
5890
  for (let i = 0; i < toRemove.length; i++) {
5872
5891
  let style = toRemove[i], found2;
5873
5892
  for (let j = 0; j < matched.length; j++) {
5874
- let m2 = matched[j];
5875
- if (m2.step == step - 1 && style.eq(matched[j].style))
5876
- found2 = m2;
5893
+ let m = matched[j];
5894
+ if (m.step == step - 1 && style.eq(matched[j].style))
5895
+ found2 = m;
5877
5896
  }
5878
5897
  if (found2) {
5879
5898
  found2.to = end;
@@ -5884,7 +5903,7 @@ function removeMark(tr, from, to, mark) {
5884
5903
  }
5885
5904
  }
5886
5905
  });
5887
- matched.forEach((m2) => tr.step(new RemoveMarkStep(m2.from, m2.to, m2.style)));
5906
+ matched.forEach((m) => tr.step(new RemoveMarkStep(m.from, m.to, m.style)));
5888
5907
  }
5889
5908
  function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch, clearNewlines = true) {
5890
5909
  let node = tr.doc.nodeAt(pos);
@@ -5900,11 +5919,11 @@ function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch,
5900
5919
  if (!parentType.allowsMarkType(child.marks[j].type))
5901
5920
  tr.step(new RemoveMarkStep(cur, end, child.marks[j]));
5902
5921
  if (clearNewlines && child.isText && parentType.whitespace != "pre") {
5903
- let m2, newline = /\r?\n|\r/g, slice;
5904
- while (m2 = newline.exec(child.text)) {
5922
+ let m, newline = /\r?\n|\r/g, slice;
5923
+ while (m = newline.exec(child.text)) {
5905
5924
  if (!slice)
5906
5925
  slice = new Slice(Fragment2.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0);
5907
- replSteps.push(new ReplaceStep(cur + m2.index, cur + m2.index + m2[0].length, slice));
5926
+ replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length, slice));
5908
5927
  }
5909
5928
  }
5910
5929
  }
@@ -6036,9 +6055,9 @@ function setBlockType(tr, from, to, type, attrs) {
6036
6055
  function replaceNewlines(tr, node, pos, mapFrom) {
6037
6056
  node.forEach((child, offset) => {
6038
6057
  if (child.isText) {
6039
- let m2, newline = /\r?\n|\r/g;
6040
- while (m2 = newline.exec(child.text)) {
6041
- let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m2.index);
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);
6042
6061
  tr.replaceWith(start, start + 1, node.type.schema.linebreakReplacement.create());
6043
6062
  }
6044
6063
  }
@@ -10104,11 +10123,11 @@ var Mark2 = class _Mark extends Extendable {
10104
10123
  const isAtEnd = currentPos.pos === currentPos.end();
10105
10124
  if (isAtEnd) {
10106
10125
  const currentMarks = currentPos.marks();
10107
- const isInMark = !!currentMarks.find((m2) => (m2 == null ? void 0 : m2.type.name) === mark.name);
10126
+ const isInMark = !!currentMarks.find((m) => (m == null ? void 0 : m.type.name) === mark.name);
10108
10127
  if (!isInMark) {
10109
10128
  return false;
10110
10129
  }
10111
- const removeMark2 = currentMarks.find((m2) => (m2 == null ? void 0 : m2.type.name) === mark.name);
10130
+ const removeMark2 = currentMarks.find((m) => (m == null ? void 0 : m.type.name) === mark.name);
10112
10131
  if (removeMark2) {
10113
10132
  tr.removeStoredMark(removeMark2);
10114
10133
  }
@@ -11136,12 +11155,14 @@ var AppRichTextEditor = ({
11136
11155
  Typography,
11137
11156
  {
11138
11157
  variant: "caption",
11139
- sx: [{
11140
- color: "error.main",
11141
- display: "block",
11142
- mt: 0.5,
11143
- ...errorSx
11144
- }],
11158
+ sx: [
11159
+ {
11160
+ color: "error.main",
11161
+ display: "block",
11162
+ mt: 0.5,
11163
+ ...errorSx
11164
+ }
11165
+ ],
11145
11166
  children: msg
11146
11167
  }
11147
11168
  )
@@ -11151,167 +11172,173 @@ var AppRichTextEditor = ({
11151
11172
  Typography,
11152
11173
  {
11153
11174
  variant: "button",
11154
- sx: [{
11155
- color: "text.primary",
11156
- mb: 1,
11157
- display: "block",
11158
- ...labelSx
11159
- }],
11175
+ sx: [
11176
+ {
11177
+ color: "text.primary",
11178
+ mb: 1,
11179
+ display: "block",
11180
+ ...labelSx
11181
+ }
11182
+ ],
11160
11183
  children: [
11161
11184
  label,
11162
11185
  required && /* @__PURE__ */ jsx(Typography, { component: "span", sx: { color: "error.main", ml: 0.5 }, children: "*" })
11163
11186
  ]
11164
11187
  }
11165
11188
  ),
11166
- /* @__PURE__ */ jsxs(Box, { sx: {
11167
- mb: 1,
11168
- display: "flex",
11169
- gap: 1,
11170
- flexWrap: "wrap",
11171
- p: 1,
11172
- bgcolor: "background.paper",
11173
- borderRadius: 1,
11174
- border: "1px solid",
11175
- borderColor: "divider",
11176
- ...toolbarSx
11177
- }, children: [
11178
- /* @__PURE__ */ jsx(Tooltip, { title: "Bold", children: /* @__PURE__ */ jsx(
11179
- IconButton,
11180
- {
11181
- onClick: () => editor.chain().focus().toggleBold().run(),
11182
- color: editor.isActive("bold") ? "primary" : "default",
11183
- sx: {
11184
- ...buttonSx,
11185
- ...editor.isActive("bold") ? activeButtonSx : {}
11186
- },
11187
- children: /* @__PURE__ */ jsx(FormatBoldIcon, {})
11188
- }
11189
- ) }),
11190
- /* @__PURE__ */ jsx(Tooltip, { title: "Italic", children: /* @__PURE__ */ jsx(
11191
- IconButton,
11192
- {
11193
- onClick: () => editor.chain().focus().toggleItalic().run(),
11194
- color: editor.isActive("italic") ? "primary" : "default",
11195
- sx: {
11196
- ...buttonSx,
11197
- ...editor.isActive("italic") ? activeButtonSx : {}
11198
- },
11199
- children: /* @__PURE__ */ jsx(FormatItalicIcon, {})
11200
- }
11201
- ) }),
11202
- /* @__PURE__ */ jsx(Tooltip, { title: "Underline", children: /* @__PURE__ */ jsx(
11203
- IconButton,
11204
- {
11205
- onClick: () => editor.chain().focus().toggleUnderline().run(),
11206
- color: editor.isActive("underline") ? "primary" : "default",
11207
- sx: {
11208
- ...buttonSx,
11209
- ...editor.isActive("underline") ? activeButtonSx : {}
11210
- },
11211
- children: /* @__PURE__ */ jsx(FormatUnderlinedIcon, {})
11212
- }
11213
- ) }),
11214
- /* @__PURE__ */ jsx(Tooltip, { title: "Strike", children: /* @__PURE__ */ jsx(
11215
- IconButton,
11216
- {
11217
- onClick: () => editor.chain().focus().toggleStrike().run(),
11218
- color: editor.isActive("strike") ? "primary" : "default",
11219
- sx: {
11220
- ...buttonSx,
11221
- ...editor.isActive("strike") ? activeButtonSx : {}
11222
- },
11223
- children: /* @__PURE__ */ jsx(StrikethroughSIcon, {})
11224
- }
11225
- ) }),
11226
- /* @__PURE__ */ jsx(Tooltip, { title: "Bullet List", children: /* @__PURE__ */ jsx(
11227
- IconButton,
11228
- {
11229
- onClick: () => editor.chain().focus().toggleBulletList().run(),
11230
- color: editor.isActive("bulletList") ? "primary" : "default",
11231
- sx: {
11232
- ...buttonSx,
11233
- ...editor.isActive("bulletList") ? activeButtonSx : {}
11234
- },
11235
- children: /* @__PURE__ */ jsx(FormatListBulletedIcon, {})
11236
- }
11237
- ) }),
11238
- /* @__PURE__ */ jsx(Tooltip, { title: "Numbered List", children: /* @__PURE__ */ jsx(
11239
- IconButton,
11240
- {
11241
- onClick: () => editor.chain().focus().toggleOrderedList().run(),
11242
- color: editor.isActive("orderedList") ? "primary" : "default",
11243
- sx: {
11244
- ...buttonSx,
11245
- ...editor.isActive("orderedList") ? activeButtonSx : {}
11246
- },
11247
- children: /* @__PURE__ */ jsx(FormatListNumberedIcon, {})
11248
- }
11249
- ) }),
11250
- /* @__PURE__ */ jsx(Tooltip, { title: "Align Left", children: /* @__PURE__ */ jsx(
11251
- IconButton,
11252
- {
11253
- onClick: () => editor.chain().focus().setTextAlign("left").run(),
11254
- color: editor.isActive({ textAlign: "left" }) ? "primary" : "default",
11255
- sx: {
11256
- ...buttonSx,
11257
- ...editor.isActive({ textAlign: "left" }) ? activeButtonSx : {}
11258
- },
11259
- children: /* @__PURE__ */ jsx(FormatAlignLeftIcon, {})
11260
- }
11261
- ) }),
11262
- /* @__PURE__ */ jsx(Tooltip, { title: "Align Center", children: /* @__PURE__ */ jsx(
11263
- IconButton,
11264
- {
11265
- onClick: () => editor.chain().focus().setTextAlign("center").run(),
11266
- color: editor.isActive({ textAlign: "center" }) ? "primary" : "default",
11267
- sx: {
11268
- ...buttonSx,
11269
- ...editor.isActive({ textAlign: "center" }) ? activeButtonSx : {}
11270
- },
11271
- children: /* @__PURE__ */ jsx(FormatAlignCenterIcon, {})
11272
- }
11273
- ) }),
11274
- /* @__PURE__ */ jsx(Tooltip, { title: "Align Right", children: /* @__PURE__ */ jsx(
11275
- IconButton,
11276
- {
11277
- onClick: () => editor.chain().focus().setTextAlign("right").run(),
11278
- color: editor.isActive({ textAlign: "right" }) ? "primary" : "default",
11279
- sx: {
11280
- ...buttonSx,
11281
- ...editor.isActive({ textAlign: "right" }) ? activeButtonSx : {}
11282
- },
11283
- children: /* @__PURE__ */ jsx(FormatAlignRightIcon, {})
11284
- }
11285
- ) }),
11286
- /* @__PURE__ */ jsx(Tooltip, { title: "Heading 1", children: /* @__PURE__ */ jsx(
11287
- IconButton,
11288
- {
11289
- onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
11290
- color: editor.isActive("heading", { level: 1 }) ? "primary" : "default",
11291
- sx: {
11292
- ...buttonSx,
11293
- ...editor.isActive("heading", { level: 1 }) ? activeButtonSx : {}
11294
- },
11295
- children: /* @__PURE__ */ jsx(TitleIcon, { sx: { fontSize: "1rem" } })
11296
- }
11297
- ) }),
11298
- /* @__PURE__ */ jsx(Tooltip, { title: "Heading 2", children: /* @__PURE__ */ jsxs(
11299
- IconButton,
11300
- {
11301
- onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
11302
- color: editor.isActive("heading", { level: 2 }) ? "primary" : "default",
11303
- sx: {
11304
- ...buttonSx,
11305
- ...editor.isActive("heading", { level: 2 }) ? activeButtonSx : {}
11306
- },
11307
- children: [
11308
- /* @__PURE__ */ jsx(TitleIcon, { sx: { fontSize: "0.85rem" } }),
11309
- /* @__PURE__ */ jsx(UndoIcon, {})
11310
- ]
11311
- }
11312
- ) }),
11313
- /* @__PURE__ */ jsx(Tooltip, { title: "Redo", children: /* @__PURE__ */ jsx(IconButton, { onClick: () => editor.chain().focus().redo().run(), children: /* @__PURE__ */ jsx(RedoIcon, {}) }) })
11314
- ] }),
11189
+ /* @__PURE__ */ jsxs(
11190
+ Box,
11191
+ {
11192
+ sx: {
11193
+ mb: 1,
11194
+ display: "flex",
11195
+ gap: 1,
11196
+ flexWrap: "wrap",
11197
+ p: 1,
11198
+ bgcolor: "background.paper",
11199
+ borderRadius: 1,
11200
+ border: "1px solid",
11201
+ borderColor: "divider",
11202
+ ...toolbarSx
11203
+ },
11204
+ children: [
11205
+ /* @__PURE__ */ jsx(Tooltip, { title: "Bold", children: /* @__PURE__ */ jsx(
11206
+ IconButton,
11207
+ {
11208
+ onClick: () => editor.chain().focus().toggleBold().run(),
11209
+ color: editor.isActive("bold") ? "primary" : "default",
11210
+ sx: {
11211
+ ...buttonSx,
11212
+ ...editor.isActive("bold") ? activeButtonSx : {}
11213
+ },
11214
+ children: /* @__PURE__ */ jsx(FormatBoldIcon, {})
11215
+ }
11216
+ ) }),
11217
+ /* @__PURE__ */ jsx(Tooltip, { title: "Italic", children: /* @__PURE__ */ jsx(
11218
+ IconButton,
11219
+ {
11220
+ onClick: () => editor.chain().focus().toggleItalic().run(),
11221
+ color: editor.isActive("italic") ? "primary" : "default",
11222
+ sx: {
11223
+ ...buttonSx,
11224
+ ...editor.isActive("italic") ? activeButtonSx : {}
11225
+ },
11226
+ children: /* @__PURE__ */ jsx(FormatItalicIcon, {})
11227
+ }
11228
+ ) }),
11229
+ /* @__PURE__ */ jsx(Tooltip, { title: "Underline", children: /* @__PURE__ */ jsx(
11230
+ IconButton,
11231
+ {
11232
+ onClick: () => editor.chain().focus().toggleUnderline().run(),
11233
+ color: editor.isActive("underline") ? "primary" : "default",
11234
+ sx: {
11235
+ ...buttonSx,
11236
+ ...editor.isActive("underline") ? activeButtonSx : {}
11237
+ },
11238
+ children: /* @__PURE__ */ jsx(FormatUnderlinedIcon, {})
11239
+ }
11240
+ ) }),
11241
+ /* @__PURE__ */ jsx(Tooltip, { title: "Strike", children: /* @__PURE__ */ jsx(
11242
+ IconButton,
11243
+ {
11244
+ onClick: () => editor.chain().focus().toggleStrike().run(),
11245
+ color: editor.isActive("strike") ? "primary" : "default",
11246
+ sx: {
11247
+ ...buttonSx,
11248
+ ...editor.isActive("strike") ? activeButtonSx : {}
11249
+ },
11250
+ children: /* @__PURE__ */ jsx(StrikethroughSIcon, {})
11251
+ }
11252
+ ) }),
11253
+ /* @__PURE__ */ jsx(Tooltip, { title: "Bullet List", children: /* @__PURE__ */ jsx(
11254
+ IconButton,
11255
+ {
11256
+ onClick: () => editor.chain().focus().toggleBulletList().run(),
11257
+ color: editor.isActive("bulletList") ? "primary" : "default",
11258
+ sx: {
11259
+ ...buttonSx,
11260
+ ...editor.isActive("bulletList") ? activeButtonSx : {}
11261
+ },
11262
+ children: /* @__PURE__ */ jsx(FormatListBulletedIcon, {})
11263
+ }
11264
+ ) }),
11265
+ /* @__PURE__ */ jsx(Tooltip, { title: "Numbered List", children: /* @__PURE__ */ jsx(
11266
+ IconButton,
11267
+ {
11268
+ onClick: () => editor.chain().focus().toggleOrderedList().run(),
11269
+ color: editor.isActive("orderedList") ? "primary" : "default",
11270
+ sx: {
11271
+ ...buttonSx,
11272
+ ...editor.isActive("orderedList") ? activeButtonSx : {}
11273
+ },
11274
+ children: /* @__PURE__ */ jsx(FormatListNumberedIcon, {})
11275
+ }
11276
+ ) }),
11277
+ /* @__PURE__ */ jsx(Tooltip, { title: "Align Left", children: /* @__PURE__ */ jsx(
11278
+ IconButton,
11279
+ {
11280
+ onClick: () => editor.chain().focus().setTextAlign("left").run(),
11281
+ color: editor.isActive({ textAlign: "left" }) ? "primary" : "default",
11282
+ sx: {
11283
+ ...buttonSx,
11284
+ ...editor.isActive({ textAlign: "left" }) ? activeButtonSx : {}
11285
+ },
11286
+ children: /* @__PURE__ */ jsx(FormatAlignLeftIcon, {})
11287
+ }
11288
+ ) }),
11289
+ /* @__PURE__ */ jsx(Tooltip, { title: "Align Center", children: /* @__PURE__ */ jsx(
11290
+ IconButton,
11291
+ {
11292
+ onClick: () => editor.chain().focus().setTextAlign("center").run(),
11293
+ color: editor.isActive({ textAlign: "center" }) ? "primary" : "default",
11294
+ sx: {
11295
+ ...buttonSx,
11296
+ ...editor.isActive({ textAlign: "center" }) ? activeButtonSx : {}
11297
+ },
11298
+ children: /* @__PURE__ */ jsx(FormatAlignCenterIcon, {})
11299
+ }
11300
+ ) }),
11301
+ /* @__PURE__ */ jsx(Tooltip, { title: "Align Right", children: /* @__PURE__ */ jsx(
11302
+ IconButton,
11303
+ {
11304
+ onClick: () => editor.chain().focus().setTextAlign("right").run(),
11305
+ color: editor.isActive({ textAlign: "right" }) ? "primary" : "default",
11306
+ sx: {
11307
+ ...buttonSx,
11308
+ ...editor.isActive({ textAlign: "right" }) ? activeButtonSx : {}
11309
+ },
11310
+ children: /* @__PURE__ */ jsx(FormatAlignRightIcon, {})
11311
+ }
11312
+ ) }),
11313
+ /* @__PURE__ */ jsx(Tooltip, { title: "Heading 1", children: /* @__PURE__ */ jsx(
11314
+ IconButton,
11315
+ {
11316
+ onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
11317
+ color: editor.isActive("heading", { level: 1 }) ? "primary" : "default",
11318
+ sx: {
11319
+ ...buttonSx,
11320
+ ...editor.isActive("heading", { level: 1 }) ? activeButtonSx : {}
11321
+ },
11322
+ children: /* @__PURE__ */ jsx(TitleIcon, { sx: { fontSize: "1rem" } })
11323
+ }
11324
+ ) }),
11325
+ /* @__PURE__ */ jsx(Tooltip, { title: "Heading 2", children: /* @__PURE__ */ jsx(
11326
+ IconButton,
11327
+ {
11328
+ onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
11329
+ color: editor.isActive("heading", { level: 2 }) ? "primary" : "default",
11330
+ sx: {
11331
+ ...buttonSx,
11332
+ ...editor.isActive("heading", { level: 2 }) ? activeButtonSx : {}
11333
+ },
11334
+ children: /* @__PURE__ */ jsx(TitleIcon, { sx: { fontSize: "0.85rem" } })
11335
+ }
11336
+ ) }),
11337
+ /* @__PURE__ */ jsx(Tooltip, { title: "Undo", children: /* @__PURE__ */ jsx(IconButton, { onClick: () => editor.chain().focus().undo().run(), children: /* @__PURE__ */ jsx(UndoIcon, {}) }) }),
11338
+ /* @__PURE__ */ jsx(Tooltip, { title: "Redo", children: /* @__PURE__ */ jsx(IconButton, { onClick: () => editor.chain().focus().redo().run(), children: /* @__PURE__ */ jsx(RedoIcon, {}) }) })
11339
+ ]
11340
+ }
11341
+ ),
11315
11342
  /* @__PURE__ */ jsx(
11316
11343
  Box,
11317
11344
  {
@@ -11504,10 +11531,10 @@ var AppSearchableMultiSelector = forwardRef(
11504
11531
  }, ref) => {
11505
11532
  useTheme();
11506
11533
  const { values, setFieldValue, errors, touched, setFieldTouched } = useFormikContext();
11507
- const fieldError = _19.get(errors, name);
11508
- const isTouched = Boolean(_19.get(touched, name));
11534
+ const fieldError = _.get(errors, name);
11535
+ const isTouched = Boolean(_.get(touched, name));
11509
11536
  const hasError = Boolean(fieldError) && isTouched;
11510
- const val = _19.get(values, name);
11537
+ const val = _.get(values, name);
11511
11538
  const selectedValues = Array.isArray(val) ? val : [];
11512
11539
  const selectedCount = selectedValues.length;
11513
11540
  const handleChange = (event, value, reason, details) => {
@@ -11883,9 +11910,9 @@ function AppSearchableSelectInput({
11883
11910
  ...otherProps
11884
11911
  }) {
11885
11912
  const { errors, touched, setFieldValue, values } = useFormikContext();
11886
- const fieldError = _19.get(errors, name);
11887
- const isTouched = _19.get(touched, name);
11888
- const val = _19.get(values, name);
11913
+ const fieldError = _.get(errors, name);
11914
+ const isTouched = _.get(touched, name);
11915
+ const val = _.get(values, name);
11889
11916
  const selectedOption = options.find((option) => option.value === val) || null;
11890
11917
  const handleChange = (event, newValue) => {
11891
11918
  setFieldValue(name, newValue ? newValue.value : "");
@@ -12011,10 +12038,10 @@ var AppSelectInput = forwardRef(
12011
12038
  }, ref) => {
12012
12039
  const theme = useTheme();
12013
12040
  const { errors, touched, values, setFieldValue, setFieldTouched } = useFormikContext();
12014
- const fieldError = _19.get(errors, name);
12015
- const isTouched = _19.get(touched, name);
12041
+ const fieldError = _.get(errors, name);
12042
+ const isTouched = _.get(touched, name);
12016
12043
  const hasError = Boolean(fieldError) && isTouched;
12017
- const value = _19.get(values, name);
12044
+ const value = _.get(values, name);
12018
12045
  const handleChange = (event, child) => {
12019
12046
  setFieldValue(name, event.target.value, true);
12020
12047
  if (externalOnChange) {
@@ -12256,8 +12283,8 @@ var AppSimpleUploadFile = ({
12256
12283
  onError
12257
12284
  }) => {
12258
12285
  const { setFieldValue, values, errors, touched } = useFormikContext();
12259
- const fieldValue = _19.get(values, name);
12260
- const fieldError = _19.get(touched, name) ? _19.get(errors, name) : void 0;
12286
+ const fieldValue = _.get(values, name);
12287
+ const fieldError = _.get(touched, name) ? _.get(errors, name) : void 0;
12261
12288
  const handleChange = (event) => {
12262
12289
  const files = event.target.files;
12263
12290
  if (!files || files.length === 0)
@@ -12378,1545 +12405,241 @@ var AppSimpleUploadFile = ({
12378
12405
  ] });
12379
12406
  };
12380
12407
  var AppSimpleUploadFile_default = AppSimpleUploadFile;
12381
-
12382
- // src/file-thumbnail/utils.ts
12383
- var FORMAT_PDF = ["pdf"];
12384
- var FORMAT_TEXT = ["txt"];
12385
- var FORMAT_PHOTOSHOP = ["psd"];
12386
- var FORMAT_WORD = ["doc", "docx"];
12387
- var FORMAT_EXCEL = ["xls", "xlsx"];
12388
- var FORMAT_ZIP = ["zip", "rar", "iso"];
12389
- var FORMAT_ILLUSTRATOR = ["ai", "esp"];
12390
- var FORMAT_POWERPOINT = ["ppt", "pptx"];
12391
- var FORMAT_AUDIO = ["wav", "aif", "mp3", "aac"];
12392
- var FORMAT_IMG = ["jpg", "jpeg", "gif", "bmp", "png", "svg"];
12393
- var FORMAT_VIDEO = ["m4v", "avi", "mpg", "mp4", "webm"];
12394
- var iconUrl = (icon) => `/assets/icons/files/${icon}.svg`;
12395
- function fileFormat(fileUrl) {
12396
- let format;
12397
- switch (fileUrl == null ? void 0 : fileUrl.includes(fileTypeByUrl(fileUrl))) {
12398
- case FORMAT_TEXT.includes(fileTypeByUrl(fileUrl)):
12399
- format = "txt";
12400
- break;
12401
- case FORMAT_ZIP.includes(fileTypeByUrl(fileUrl)):
12402
- format = "zip";
12403
- break;
12404
- case FORMAT_AUDIO.includes(fileTypeByUrl(fileUrl)):
12405
- format = "audio";
12406
- break;
12407
- case FORMAT_IMG.includes(fileTypeByUrl(fileUrl)):
12408
- format = "image";
12409
- break;
12410
- case FORMAT_VIDEO.includes(fileTypeByUrl(fileUrl)):
12411
- format = "video";
12412
- break;
12413
- case FORMAT_WORD.includes(fileTypeByUrl(fileUrl)):
12414
- format = "word";
12415
- break;
12416
- case FORMAT_EXCEL.includes(fileTypeByUrl(fileUrl)):
12417
- format = "excel";
12418
- break;
12419
- case FORMAT_POWERPOINT.includes(fileTypeByUrl(fileUrl)):
12420
- format = "powerpoint";
12421
- break;
12422
- case FORMAT_PDF.includes(fileTypeByUrl(fileUrl)):
12423
- format = "pdf";
12424
- break;
12425
- case FORMAT_PHOTOSHOP.includes(fileTypeByUrl(fileUrl)):
12426
- format = "photoshop";
12427
- break;
12428
- case FORMAT_ILLUSTRATOR.includes(fileTypeByUrl(fileUrl)):
12429
- format = "illustrator";
12430
- break;
12431
- default:
12432
- format = fileTypeByUrl(fileUrl);
12433
- }
12434
- return format;
12435
- }
12436
- function fileThumb(fileUrl) {
12437
- let thumb;
12438
- switch (fileFormat(fileUrl)) {
12439
- case "folder":
12440
- thumb = iconUrl("ic_folder");
12441
- break;
12442
- case "txt":
12443
- thumb = iconUrl("ic_txt");
12444
- break;
12445
- case "zip":
12446
- thumb = iconUrl("ic_zip");
12447
- break;
12448
- case "audio":
12449
- thumb = iconUrl("ic_audio");
12450
- break;
12451
- case "video":
12452
- thumb = iconUrl("ic_video");
12453
- break;
12454
- case "word":
12455
- thumb = iconUrl("ic_word");
12456
- break;
12457
- case "excel":
12458
- thumb = iconUrl("ic_excel");
12459
- break;
12460
- case "powerpoint":
12461
- thumb = iconUrl("ic_power_point");
12462
- break;
12463
- case "pdf":
12464
- thumb = iconUrl("ic_pdf");
12465
- break;
12466
- case "photoshop":
12467
- thumb = iconUrl("ic_pts");
12468
- break;
12469
- case "illustrator":
12470
- thumb = iconUrl("ic_ai");
12471
- break;
12472
- case "image":
12473
- thumb = iconUrl("ic_img");
12474
- break;
12475
- default:
12476
- thumb = iconUrl("ic_file");
12477
- }
12478
- return thumb;
12479
- }
12480
- function fileTypeByUrl(fileUrl = "") {
12481
- return fileUrl && fileUrl.split(".").pop() || "";
12482
- }
12483
- function fileNameByUrl(fileUrl) {
12484
- return fileUrl.split("/").pop();
12485
- }
12486
- function fileData(file) {
12487
- if (typeof file === "string") {
12488
- return {
12489
- key: file,
12490
- preview: file,
12491
- name: fileNameByUrl(file),
12492
- type: fileTypeByUrl(file)
12493
- };
12494
- }
12495
- return {
12496
- key: file == null ? void 0 : file.preview,
12497
- name: file == null ? void 0 : file.name,
12498
- size: file == null ? void 0 : file.size,
12499
- path: file == null ? void 0 : file.path,
12500
- type: file == null ? void 0 : file.type,
12501
- preview: file == null ? void 0 : file.preview,
12502
- lastModified: file == null ? void 0 : file.lastModified,
12503
- lastModifiedDate: file == null ? void 0 : file.lastModifiedDate
12504
- };
12505
- }
12506
- function DownloadButton({ onDownload }) {
12507
- const theme = useTheme$1();
12508
- return /* @__PURE__ */ jsx(
12509
- IconButton,
12510
- {
12511
- onClick: onDownload,
12512
- sx: {
12513
- p: 0,
12514
- top: 0,
12515
- right: 0,
12516
- width: 1,
12517
- height: 1,
12518
- zIndex: 9,
12519
- opacity: 0,
12520
- position: "absolute",
12521
- borderRadius: "unset",
12522
- // color: 'common.white',
12523
- justifyContent: "center",
12524
- bgcolor: "grey.800",
12525
- color: "common.white",
12526
- transition: theme.transitions.create("opacity"),
12527
- "&:hover": {
12528
- opacity: 1,
12529
- backgroundColor: alpha(theme.palette.grey[900], 0.64),
12530
- backdropFilter: "blur(6px)"
12531
- }
12532
- },
12533
- children: /* @__PURE__ */ jsx(Iconify_default, { icon: "eva:arrow-circle-down-fill", width: 24 })
12534
- }
12535
- );
12536
- }
12537
- function FileThumbnail({
12538
- file,
12539
- tooltip,
12540
- imageView,
12541
- onDownload,
12408
+ var AppUploadFile = ({
12409
+ name,
12410
+ label,
12411
+ multiple = false,
12412
+ accept = "image/*",
12413
+ maxFiles = 5,
12414
+ maxSize = 5 * 1024 * 1024,
12415
+ // 5MB
12416
+ disabled = false,
12542
12417
  sx,
12543
- imgSx
12544
- }) {
12545
- const { name = "", path = "", preview = "" } = fileData(file);
12546
- const format = fileFormat(path || preview);
12547
- const renderContent = format === "image" && imageView === true ? /* @__PURE__ */ jsx(
12548
- Box,
12549
- {
12550
- component: "img",
12551
- src: preview,
12552
- sx: {
12553
- width: 1,
12554
- height: 1,
12555
- flexShrink: 0,
12556
- objectFit: "cover",
12557
- ...imgSx
12558
- }
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 };
12559
12441
  }
12560
- ) : /* @__PURE__ */ jsx(
12561
- Box,
12562
- {
12563
- component: "img",
12564
- src: fileThumb(format),
12565
- sx: {
12566
- width: 32,
12567
- height: 32,
12568
- flexShrink: 0,
12569
- ...sx
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);
12570
12462
  }
12571
- }
12463
+ },
12464
+ [
12465
+ currentFiles,
12466
+ disabled,
12467
+ isMaxFilesReached,
12468
+ multiple,
12469
+ name,
12470
+ setFieldValue,
12471
+ maxFiles,
12472
+ externalOnDrop
12473
+ ]
12572
12474
  );
12573
- if (tooltip === true) {
12574
- return /* @__PURE__ */ jsx(Tooltip, { title: name, children: /* @__PURE__ */ jsxs(
12575
- Stack,
12576
- {
12577
- flexShrink: 0,
12578
- component: "span",
12579
- alignItems: "center",
12580
- justifyContent: "center",
12581
- sx: {
12582
- width: "fit-content",
12583
- height: "inherit"
12584
- },
12585
- children: [
12586
- renderContent,
12587
- onDownload && /* @__PURE__ */ jsx(DownloadButton, { onDownload })
12588
- ]
12589
- }
12590
- ) });
12591
- }
12592
- return /* @__PURE__ */ jsxs(Fragment, { children: [
12593
- renderContent,
12594
- onDownload && /* @__PURE__ */ jsx(DownloadButton, { onDownload })
12595
- ] });
12596
- }
12597
- function RejectionFiles({ fileRejections }) {
12598
- if (!fileRejections.length) {
12599
- return null;
12600
- }
12601
- function formatBytes2(bytes) {
12602
- const b = bytes != null ? bytes : 0;
12603
- if (b === 0)
12604
- return "0 Bytes";
12605
- const k = 1024;
12606
- const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
12607
- const i = Math.floor(Math.log(b) / Math.log(k));
12608
- return `${parseFloat((b / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
12609
- }
12610
- return /* @__PURE__ */ jsx(
12611
- Paper,
12612
- {
12613
- variant: "outlined",
12614
- sx: {
12615
- py: 1,
12616
- px: 2,
12617
- mt: 3,
12618
- bgcolor: (theme) => alpha(theme.palette.error.main, 0.08),
12619
- borderColor: (theme) => alpha(theme.palette.error.main, 0.24)
12620
- },
12621
- children: fileRejections.map(({ file, errors }) => {
12622
- const { path, size } = fileData(file);
12623
- return /* @__PURE__ */ jsxs(Box, { sx: { my: 1 }, children: [
12624
- /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", noWrap: true, children: [
12625
- path,
12626
- " - ",
12627
- size != null ? formatBytes2(size) : ""
12628
- ] }),
12629
- errors.map((error) => /* @__PURE__ */ jsxs(Box, { component: "span", sx: { typography: "caption" }, children: [
12630
- "- ",
12631
- error.message
12632
- ] }, error.code))
12633
- ] }, path);
12634
- })
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);
12635
12484
  }
12636
- );
12637
- }
12638
-
12639
- // src/image/getRatio.ts
12640
- function getRatio(ratio = "1/1") {
12641
- return {
12642
- "4/3": "calc(100% / 4 * 3)",
12643
- "3/4": "calc(100% / 3 * 4)",
12644
- "6/4": "calc(100% / 6 * 4)",
12645
- "4/6": "calc(100% / 4 * 6)",
12646
- "16/9": "calc(100% / 16 * 9)",
12647
- "9/16": "calc(100% / 9 * 16)",
12648
- "21/9": "calc(100% / 21 * 9)",
12649
- "9/21": "calc(100% / 9 * 21)",
12650
- "1/1": "100%"
12651
- }[ratio];
12652
- }
12653
- var TRANSPARENT_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8Xw8AApIBgX6cJqkAAAAASUVORK5CYII=";
12654
- var Image = forwardRef(
12655
- ({
12656
- ratio,
12657
- disabledEffect = false,
12658
- effect = "blur",
12659
- src,
12660
- wrapperProps,
12661
- style,
12662
- sx,
12663
- ...other
12664
- }, ref) => {
12665
- const content = /* @__PURE__ */ jsx(
12666
- Box,
12667
- {
12668
- component: LazyLoadImage,
12669
- wrapperClassName: "wrapper",
12670
- effect: disabledEffect ? void 0 : effect,
12671
- placeholderSrc: disabledEffect ? TRANSPARENT_PNG : TRANSPARENT_PNG,
12672
- src,
12673
- wrapperProps,
12674
- style,
12675
- sx: {
12676
- width: 1,
12677
- height: 1,
12678
- objectFit: "cover",
12679
- ...sx
12680
- },
12681
- ...other
12682
- }
12683
- );
12684
- if (ratio) {
12685
- return /* @__PURE__ */ jsx(
12686
- Box,
12687
- {
12688
- ref,
12689
- component: "span",
12690
- sx: {
12691
- width: 1,
12692
- lineHeight: 1,
12693
- display: "block",
12694
- overflow: "hidden",
12695
- position: "relative",
12696
- pt: getRatio(ratio),
12697
- "& .wrapper": {
12698
- top: 0,
12699
- left: 0,
12700
- width: 1,
12701
- height: 1,
12702
- position: "absolute",
12703
- backgroundSize: "cover !important"
12704
- },
12705
- ...sx
12706
- },
12707
- children: content
12708
- }
12709
- );
12710
- }
12711
- return /* @__PURE__ */ jsx(
12712
- Box,
12713
- {
12714
- ref,
12715
- component: "span",
12716
- sx: {
12717
- lineHeight: 1,
12718
- display: "block",
12719
- overflow: "hidden",
12720
- position: "relative",
12721
- "& .wrapper": {
12722
- width: 1,
12723
- height: 1,
12724
- backgroundSize: "cover !important"
12725
- },
12726
- ...sx
12727
- },
12728
- children: content
12729
- }
12730
- );
12731
- }
12732
- );
12733
- Image.displayName = "Image";
12734
- var Image_default = Image;
12735
-
12736
- // src/animate/variants/transition.ts
12737
- var varTranEnter = (props) => {
12738
- const duration = (props == null ? void 0 : props.durationIn) != null ? props == null ? void 0 : props.durationIn : 0.64;
12739
- const ease = (props == null ? void 0 : props.easeIn) != null ? props == null ? void 0 : props.easeIn : [0.43, 0.13, 0.23, 0.96];
12740
- return { duration, ease };
12741
- };
12742
- var varTranExit = (props) => {
12743
- const duration = (props == null ? void 0 : props.durationOut) != null ? props == null ? void 0 : props.durationOut : 0.48;
12744
- const ease = (props == null ? void 0 : props.easeOut) != null ? props == null ? void 0 : props.easeOut : [0.43, 0.13, 0.23, 0.96];
12745
- return { duration, ease };
12746
- };
12747
-
12748
- // src/animate/variants/fade.ts
12749
- var varFade = (props) => {
12750
- const distance = (props == null ? void 0 : props.distance) != null ? props == null ? void 0 : props.distance : 120;
12751
- const durationIn = props == null ? void 0 : props.durationIn;
12752
- const durationOut = props == null ? void 0 : props.durationOut;
12753
- const easeIn = props == null ? void 0 : props.easeIn;
12754
- const easeOut = props == null ? void 0 : props.easeOut;
12755
- return {
12756
- // IN
12757
- in: {
12758
- initial: { opacity: 0 },
12759
- animate: { opacity: 1, transition: varTranEnter },
12760
- exit: { opacity: 0, transition: varTranExit }
12761
- },
12762
- inUp: {
12763
- initial: { y: distance, opacity: 0 },
12764
- animate: { y: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
12765
- exit: { y: distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
12766
- },
12767
- inDown: {
12768
- initial: { y: -distance, opacity: 0 },
12769
- animate: { y: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
12770
- exit: { y: -distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
12771
- },
12772
- inLeft: {
12773
- initial: { x: -distance, opacity: 0 },
12774
- animate: { x: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
12775
- exit: { x: -distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
12776
- },
12777
- inRight: {
12778
- initial: { x: distance, opacity: 0 },
12779
- animate: { x: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
12780
- exit: { x: distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
12781
- },
12782
- // OUT
12783
- out: {
12784
- initial: { opacity: 1 },
12785
- animate: { opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12786
- exit: { opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12787
- },
12788
- outUp: {
12789
- initial: { y: 0, opacity: 1 },
12790
- animate: { y: -distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12791
- exit: { y: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12792
- },
12793
- outDown: {
12794
- initial: { y: 0, opacity: 1 },
12795
- animate: { y: distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12796
- exit: { y: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12797
- },
12798
- outLeft: {
12799
- initial: { x: 0, opacity: 1 },
12800
- animate: { x: -distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12801
- exit: { x: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12802
- },
12803
- outRight: {
12804
- initial: { x: 0, opacity: 1 },
12805
- animate: { x: distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12806
- exit: { x: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12807
- }
12808
- };
12809
- };
12810
- function formatBytes(bytes) {
12811
- const b = bytes != null ? bytes : 0;
12812
- if (b === 0)
12813
- return "0 Bytes";
12814
- const k = 1024;
12815
- const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
12816
- const i = Math.floor(Math.log(b) / Math.log(k));
12817
- return `${parseFloat((b / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
12818
- }
12819
- function MultiFilePreview({
12820
- thumbnail,
12821
- files,
12822
- onRemove,
12823
- sx,
12824
- isClickable,
12825
- isEditable,
12826
- onDeleteButtonClick,
12827
- onPrivacyUpdateClick
12828
- }) {
12829
- if ((files == null ? void 0 : files.length) == null) {
12830
- return null;
12831
- }
12832
- const [anchorEl, setAnchorEl] = useState(null);
12833
- const [selectedFile, setSelectedFile] = useState(null);
12834
- const canViewPrivate = true;
12835
- return /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: files.map((file) => {
12836
- const typedFile = file;
12837
- const { key, name = "", size = 0 } = fileData(typedFile);
12838
- const isStringFile = typeof file === "string";
12839
- if (thumbnail === true) {
12840
- return (
12841
- // @ts-ignore
12842
- /* @__PURE__ */ jsxs(
12843
- Stack,
12844
- {
12845
- component: m.div,
12846
- ...varFade().inUp,
12847
- alignItems: "center",
12848
- display: "inline-flex",
12849
- justifyContent: "center",
12850
- sx: {
12851
- m: 0.5,
12852
- width: 80,
12853
- height: 80,
12854
- borderRadius: 1.25,
12855
- overflow: "hidden",
12856
- position: "relative",
12857
- border: (theme) => `solid 1px ${theme.palette.divider}`,
12858
- ...sx
12859
- },
12860
- children: [
12861
- /* @__PURE__ */ jsx(
12862
- FileThumbnail,
12863
- {
12864
- tooltip: true,
12865
- imageView: true,
12866
- file: typedFile,
12867
- sx: { position: "absolute" },
12868
- imgSx: { position: "absolute" }
12869
- }
12870
- ),
12871
- onRemove && /* @__PURE__ */ jsx(
12872
- IconButton,
12873
- {
12874
- size: "small",
12875
- onClick: () => onRemove(typedFile),
12876
- sx: {
12877
- top: 4,
12878
- right: 4,
12879
- p: "1px",
12880
- position: "absolute",
12881
- color: (theme) => alpha(theme.palette.common.white, 0.72),
12882
- bgcolor: (theme) => alpha(theme.palette.grey[900], 0.48),
12883
- "&:hover": {
12884
- bgcolor: (theme) => alpha(theme.palette.grey[900], 0.72)
12885
- }
12886
- },
12887
- children: /* @__PURE__ */ jsx(Iconify_default, { icon: "eva:close-fill", width: 16 })
12888
- }
12889
- )
12890
- ]
12891
- },
12892
- key
12893
- )
12894
- );
12895
- }
12896
- return (
12897
- // @ts-ignore
12898
- /* @__PURE__ */ jsxs(
12899
- Stack,
12900
- {
12901
- component: m.div,
12902
- ...varFade().inUp,
12903
- spacing: 2,
12904
- direction: "row",
12905
- alignItems: "center",
12906
- sx: {
12907
- my: 1,
12908
- px: 1,
12909
- py: 0.75,
12910
- borderRadius: 0.75,
12911
- border: (theme) => `solid 1px ${theme.palette.divider}`,
12912
- ...sx,
12913
- opacity: "1 !important",
12914
- transform: "none !important"
12915
- },
12916
- children: [
12917
- (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" } }) : (
12918
- // eslint-disable-next-line @next/next/no-img-element
12919
- /* @__PURE__ */ jsx(
12920
- "img",
12921
- {
12922
- src: `${typedFile == null ? void 0 : typedFile.preview}`,
12923
- alt: (typedFile == null ? void 0 : typedFile.name) != null ? typedFile == null ? void 0 : typedFile.name : "",
12924
- style: { width: "40px", height: "40px" }
12925
- }
12926
- )
12927
- ) }) : /* @__PURE__ */ jsx(FileThumbnail, { file: typedFile }),
12928
- /* @__PURE__ */ jsxs(
12929
- Stack,
12930
- {
12931
- flexGrow: 1,
12932
- sx: { minWidth: 0, cursor: "pointer" },
12933
- onClick: () => {
12934
- if (isClickable === true && typedFile.url != null) {
12935
- window.open(`${typedFile == null ? void 0 : typedFile.url}`, "_blank");
12936
- }
12937
- },
12938
- children: [
12939
- /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", sx: { wordBreak: "break-all", whiteSpace: "break-spaces" }, noWrap: true, children: isStringFile ? file : name }),
12940
- /* @__PURE__ */ jsx(Typography, { variant: "caption", sx: { color: "text.secondary" }, children: isStringFile ? "" : formatBytes(size) })
12941
- ]
12942
- }
12943
- ),
12944
- onRemove && /* @__PURE__ */ jsx(IconButton, { edge: "end", size: "small", onClick: () => onRemove(typedFile), children: /* @__PURE__ */ jsx(Iconify_default, { icon: "eva:close-fill" }) }),
12945
- isEditable === true && /* @__PURE__ */ jsxs(Fragment, { children: [
12946
- /* @__PURE__ */ jsx(
12947
- IconButton,
12948
- {
12949
- edge: "end",
12950
- size: "small",
12951
- onClick: (event) => {
12952
- event.stopPropagation();
12953
- setAnchorEl(event.currentTarget);
12954
- setSelectedFile(typedFile);
12955
- },
12956
- children: /* @__PURE__ */ jsx(Iconify_default, { icon: "eva:more-horizontal-fill" })
12957
- }
12958
- ),
12959
- /* @__PURE__ */ jsxs(
12960
- Menu,
12961
- {
12962
- anchorEl,
12963
- open: Boolean(anchorEl) && selectedFile === file,
12964
- onClose: () => setAnchorEl(null),
12965
- children: [
12966
- /* @__PURE__ */ jsxs(
12967
- MenuItem,
12968
- {
12969
- onClick: (e) => {
12970
- e.stopPropagation();
12971
- setAnchorEl(null);
12972
- if (onDeleteButtonClick) {
12973
- onDeleteButtonClick(typedFile);
12974
- }
12975
- },
12976
- children: [
12977
- /* @__PURE__ */ jsx(Iconify_default, { icon: "eva:trash-2-outline", width: 20 }),
12978
- "Delete"
12979
- ]
12980
- }
12981
- ),
12982
- /* @__PURE__ */ jsxs(
12983
- MenuItem,
12984
- {
12985
- onClick: (e) => {
12986
- e.stopPropagation();
12987
- if (onPrivacyUpdateClick) {
12988
- onPrivacyUpdateClick(typedFile);
12989
- }
12990
- },
12991
- children: [
12992
- /* @__PURE__ */ jsx(
12993
- Iconify_default,
12994
- {
12995
- icon: (typedFile == null ? void 0 : typedFile.is_private) === true ? "eva:unlock-outline" : "eva:lock-outline",
12996
- width: 20
12997
- }
12998
- ),
12999
- (typedFile == null ? void 0 : typedFile.is_private) === true ? "Public" : "Private"
13000
- ]
13001
- }
13002
- )
13003
- ]
13004
- }
13005
- )
13006
- ] })
13007
- ]
13008
- },
13009
- key
13010
- )
13011
- );
13012
- }) });
13013
- }
13014
- function SingleFilePreview({ file }) {
13015
- if (!file) {
13016
- return null;
13017
- }
13018
- const imgUrl = (typeof file === "string" ? file : file.preview) || "";
13019
- return /* @__PURE__ */ jsx(
13020
- Box,
13021
- {
13022
- sx: {
13023
- position: "relative",
13024
- width: "100%",
13025
- height: "100%",
13026
- "& .wrapper": {
13027
- width: "100%",
13028
- height: "100%",
13029
- position: "relative"
13030
- }
13031
- },
13032
- children: /* @__PURE__ */ jsx(
13033
- Image_default,
13034
- {
13035
- src: imgUrl,
13036
- effect: "opacity",
13037
- wrapperProps: {
13038
- style: {
13039
- width: "100%",
13040
- height: "100%",
13041
- position: "relative"
13042
- }
13043
- },
13044
- style: {
13045
- top: 8,
13046
- left: 8,
13047
- zIndex: 8,
13048
- borderRadius: 1,
13049
- position: "absolute",
13050
- width: "calc(100% - 16px)",
13051
- height: "calc(100% - 16px)",
13052
- objectFit: "cover"
13053
- }
13054
- }
13055
- )
13056
- }
13057
- );
13058
- }
13059
- function BackgroundIllustration() {
13060
- const theme = useTheme$1();
13061
- const PRIMARY_MAIN = theme.palette.primary.main;
13062
- return /* @__PURE__ */ jsxs(Fragment, { children: [
13063
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: "BG", x1: "19.496%", x2: "77.479%", y1: "71.822%", y2: "16.69%", children: [
13064
- /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: PRIMARY_MAIN }),
13065
- /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: PRIMARY_MAIN, stopOpacity: "0" })
13066
- ] }) }),
13067
- /* @__PURE__ */ jsx(
13068
- "path",
13069
- {
13070
- fill: "url(#BG)",
13071
- fillRule: "nonzero",
13072
- 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",
13073
- opacity: "0.2"
13074
- }
13075
- )
13076
- ] });
13077
- }
13078
- var BackgroundIllustration_default = memo(BackgroundIllustration);
13079
- function UploadIllustration({ ...other }) {
13080
- const theme = useTheme$1();
13081
- const PRIMARY_MAIN = theme.palette.primary.main;
13082
- const PRIMARY_DARK = theme.palette.primary.dark;
13083
- const PRIMARY_DARKER = theme.palette.primary.dark;
13084
- 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: [
13085
- /* @__PURE__ */ jsx(BackgroundIllustration_default, {}),
13086
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: "linearGradient-2", x1: "30.113%", x2: "30.113%", y1: "0%", y2: "100%", children: [
13087
- /* @__PURE__ */ jsx("stop", { offset: "0%", stopOpacity: "0" }),
13088
- /* @__PURE__ */ jsx("stop", { offset: "100%" })
13089
- ] }) }),
13090
- /* @__PURE__ */ jsx(
13091
- "path",
13092
- {
13093
- fill: "#FF4842",
13094
- fillRule: "nonzero",
13095
- 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",
13096
- opacity: "0.05"
13097
- }
13098
- ),
13099
- /* @__PURE__ */ jsx(
13100
- "path",
13101
- {
13102
- fill: "#FF4842",
13103
- fillRule: "nonzero",
13104
- 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",
13105
- opacity: "0.05"
13106
- }
13107
- ),
13108
- /* @__PURE__ */ jsx(
13109
- "path",
13110
- {
13111
- fill: "#FF4842",
13112
- fillRule: "nonzero",
13113
- 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",
13114
- opacity: "0.05"
13115
- }
13116
- ),
13117
- /* @__PURE__ */ jsx(
13118
- "path",
13119
- {
13120
- fill: PRIMARY_DARKER,
13121
- fillRule: "nonzero",
13122
- 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"
13123
- }
13124
- ),
13125
- /* @__PURE__ */ jsx(
13126
- "path",
13127
- {
13128
- fill: "#FFF",
13129
- fillRule: "nonzero",
13130
- d: "M251.256817 123.296578L274.098317 123.296578 274.098317 200.823078 251.256817 200.823078z",
13131
- transform: "rotate(34.64 262.678 162.06)"
13132
- }
13133
- ),
13134
- /* @__PURE__ */ jsx(
13135
- "path",
13136
- {
13137
- fill: "#FFC107",
13138
- fillRule: "nonzero",
13139
- d: "M270.624591 129.857671L286.750291 129.857671 286.750291 145.983371 270.624591 145.983371z",
13140
- transform: "rotate(34.804 278.687 137.92)"
13141
- }
13142
- ),
13143
- /* @__PURE__ */ jsx(
13144
- "path",
13145
- {
13146
- fill: "#FFC107",
13147
- fillRule: "nonzero",
13148
- d: "M260.275579 145.813111L276.423079 145.813111 276.423079 161.960611 260.275579 161.960611z",
13149
- opacity: "0.5",
13150
- transform: "rotate(34.64 268.35 153.887)"
13151
- }
13152
- ),
13153
- /* @__PURE__ */ jsx(
13154
- "path",
13155
- {
13156
- fill: "#FFC107",
13157
- fillRule: "nonzero",
13158
- d: "M249.191579 161.852111L265.339079 161.852111 265.339079 177.999611 249.191579 177.999611z",
13159
- opacity: "0.3",
13160
- transform: "rotate(34.64 257.265 169.926)"
13161
- }
13162
- ),
13163
- /* @__PURE__ */ jsx(
13164
- "path",
13165
- {
13166
- fill: "#FFF",
13167
- fillRule: "nonzero",
13168
- d: "M237.472537 121.334214L260.314037 121.334214 260.314037 198.567714 237.472537 198.567714z",
13169
- transform: "rotate(16.29 248.893 159.951)"
13170
- }
13171
- ),
13172
- /* @__PURE__ */ jsx(
13173
- "path",
13174
- {
13175
- fill: "#FF4842",
13176
- fillRule: "nonzero",
13177
- d: "M249.053192 123.761554L265.200692 123.761554 265.200692 139.909054 249.053192 139.909054z",
13178
- transform: "rotate(16.29 257.127 131.835)"
13179
- }
13180
- ),
13181
- /* @__PURE__ */ jsx(
13182
- "path",
13183
- {
13184
- fill: "#FF4842",
13185
- fillRule: "nonzero",
13186
- d: "M243.584192 142.473554L259.731692 142.473554 259.731692 158.621053 243.584192 158.621053z",
13187
- opacity: "0.5",
13188
- transform: "rotate(16.29 251.658 150.547)"
13189
- }
13190
- ),
13191
- /* @__PURE__ */ jsx(
13192
- "path",
13193
- {
13194
- fill: "#FF4842",
13195
- fillRule: "nonzero",
13196
- d: "M238.116192 161.182554L254.263692 161.182554 254.263692 177.330054 238.116192 177.330054z",
13197
- opacity: "0.3",
13198
- transform: "rotate(16.29 246.19 169.256)"
13199
- }
13200
- ),
13201
- /* @__PURE__ */ jsx(
13202
- "path",
13203
- {
13204
- fill: "#FFF",
13205
- fillRule: "nonzero",
13206
- d: "M230.099192 121.641542L252.940692 121.641542 252.940692 198.875042 230.099192 198.875042z",
13207
- transform: "rotate(4.6 241.52 160.258)"
13208
- }
13209
- ),
13210
- /* @__PURE__ */ jsx(
13211
- "path",
13212
- {
13213
- fill: "#1890FF",
13214
- fillRule: "nonzero",
13215
- d: "M235.800489 122.985499L251.947989 122.985499 251.947989 139.132999 235.800489 139.132999z",
13216
- transform: "rotate(4.6 243.874 131.06)"
13217
- }
13218
- ),
13219
- /* @__PURE__ */ jsx(
13220
- "path",
13221
- {
13222
- fill: "#1890FF",
13223
- fillRule: "nonzero",
13224
- d: "M234.234488 142.413498L250.381988 142.413498 250.381988 158.560998 234.234488 158.560998z",
13225
- opacity: "0.5",
13226
- transform: "rotate(4.6 242.308 150.487)"
13227
- }
13228
- ),
13229
- /* @__PURE__ */ jsx(
13230
- "path",
13231
- {
13232
- fill: "#1890FF",
13233
- fillRule: "nonzero",
13234
- d: "M232.672488 161.846499L248.819988 161.846499 248.819988 177.993999 232.672488 177.993999z",
13235
- opacity: "0.3",
13236
- transform: "rotate(4.6 240.746 169.92)"
13237
- }
13238
- ),
13239
- /* @__PURE__ */ jsx(
13240
- "path",
13241
- {
13242
- fill: "#FFF",
13243
- fillRule: "nonzero",
13244
- d: "M224.736657 123.384871L247.578157 123.384871 247.578157 200.618371 224.736657 200.618371z",
13245
- transform: "rotate(-2.61 236.157 162.002)"
13246
- }
13247
- ),
13248
- /* @__PURE__ */ jsx(
13249
- "path",
13250
- {
13251
- fill: PRIMARY_MAIN,
13252
- fillRule: "nonzero",
13253
- d: "M226.751283 124.659968L242.898783 124.659968 242.898783 140.807468 226.751283 140.807468z",
13254
- transform: "rotate(-2.61 234.825 132.734)"
13255
- }
13256
- ),
13257
- /* @__PURE__ */ jsx(
13258
- "path",
13259
- {
13260
- fill: PRIMARY_MAIN,
13261
- fillRule: "nonzero",
13262
- d: "M228.305601 143.479224L244.473301 143.479224 244.473301 159.646924 228.305601 159.646924z",
13263
- opacity: "0.5",
13264
- transform: "rotate(-2.862 236.39 151.563)"
13265
- }
13266
- ),
13267
- /* @__PURE__ */ jsx(
13268
- "path",
13269
- {
13270
- fill: PRIMARY_MAIN,
13271
- fillRule: "nonzero",
13272
- d: "M228.525282 163.608968L244.672782 163.608968 244.672782 179.756468 228.525282 179.756468z",
13273
- opacity: "0.3",
13274
- transform: "rotate(-2.61 236.599 171.683)"
13275
- }
13276
- ),
13277
- /* @__PURE__ */ jsx(
13278
- "path",
13279
- {
13280
- fill: "#F4F6F8",
13281
- fillRule: "nonzero",
13282
- 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"
13283
- }
13284
- ),
13285
- /* @__PURE__ */ jsx(
13286
- "path",
13287
- {
13288
- fill: "#000",
13289
- fillRule: "nonzero",
13290
- 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",
13291
- opacity: "0.1"
13292
- }
13293
- ),
13294
- /* @__PURE__ */ jsx(
13295
- "path",
13296
- {
13297
- fill: PRIMARY_MAIN,
13298
- fillRule: "nonzero",
13299
- 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"
13300
- }
13301
- ),
13302
- /* @__PURE__ */ jsx(
13303
- "path",
13304
- {
13305
- fill: "#FF4842",
13306
- fillRule: "nonzero",
13307
- 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",
13308
- opacity: "0.1"
13309
- }
13310
- ),
13311
- /* @__PURE__ */ jsx(
13312
- "path",
13313
- {
13314
- fill: "#FFF",
13315
- fillRule: "nonzero",
13316
- 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"
13317
- }
13318
- ),
13319
- /* @__PURE__ */ jsx(
13320
- "path",
13321
- {
13322
- fill: PRIMARY_MAIN,
13323
- fillRule: "nonzero",
13324
- 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",
13325
- opacity: "0.3"
13326
- }
13327
- ),
13328
- /* @__PURE__ */ jsx(
13329
- "path",
13330
- {
13331
- fill: PRIMARY_MAIN,
13332
- fillRule: "nonzero",
13333
- 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"
13334
- }
13335
- ),
13336
- /* @__PURE__ */ jsx("ellipse", { cx: "380.363", cy: "298.487", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "8.945", ry: "1.513" }),
13337
- /* @__PURE__ */ jsx(
13338
- "path",
13339
- {
13340
- fill: PRIMARY_MAIN,
13341
- fillRule: "nonzero",
13342
- 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"
13343
- }
13344
- ),
13345
- /* @__PURE__ */ jsx("ellipse", { cx: "390.052", cy: "264.383", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "5.044", ry: "1" }),
13346
- /* @__PURE__ */ jsx(
13347
- "path",
13348
- {
13349
- fill: PRIMARY_MAIN,
13350
- fillRule: "nonzero",
13351
- 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"
13352
- }
13353
- ),
13354
- /* @__PURE__ */ jsx("ellipse", { cx: "346.97", cy: "270.022", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "6.09", ry: "1.028" }),
13355
- /* @__PURE__ */ jsx(
13356
- "rect",
13357
- {
13358
- width: "51.026",
13359
- height: "91.312",
13360
- x: "303.926",
13361
- y: "69.211",
13362
- fill: "#FFF",
13363
- fillRule: "nonzero",
13364
- rx: "4.737",
13365
- transform: "rotate(-71.99 329.44 114.867)"
13366
- }
13367
- ),
13368
- /* @__PURE__ */ jsx("circle", { cx: "303.613", cy: "103.507", r: "9.376", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.2" }),
13369
- /* @__PURE__ */ jsx(
13370
- "path",
13371
- {
13372
- fill: PRIMARY_MAIN,
13373
- fillRule: "nonzero",
13374
- d: "M344.582495 86.4883769L347.150665 86.4883769 347.150665 127.336977 344.582495 127.336977z",
13375
- opacity: "0.2",
13376
- transform: "rotate(-71.99 345.867 106.913)"
13377
- }
13378
- ),
13379
- /* @__PURE__ */ jsx(
13380
- "path",
13381
- {
13382
- fill: PRIMARY_MAIN,
13383
- fillRule: "nonzero",
13384
- d: "M333.028401 99.6373982L335.596571 99.6373982 335.596571 120.445898 333.028401 120.445898z",
13385
- opacity: "0.2",
13386
- transform: "rotate(-71.99 334.312 110.042)"
13387
- }
13388
- ),
13389
- /* @__PURE__ */ jsx(
13390
- "path",
13391
- {
13392
- fill: PRIMARY_MAIN,
13393
- fillRule: "nonzero",
13394
- d: "M337.109071 101.431004L339.677241 101.431004 339.677241 135.086304 337.109071 135.086304z",
13395
- opacity: "0.2",
13396
- transform: "rotate(-71.99 338.393 118.259)"
13397
- }
13398
- ),
13399
- /* @__PURE__ */ jsx(
13400
- "path",
13401
- {
13402
- fill: PRIMARY_MAIN,
13403
- fillRule: "nonzero",
13404
- d: "M338.505494 105.174377L341.073664 105.174377 341.073664 146.022978 338.505494 146.022978z",
13405
- opacity: "0.2",
13406
- transform: "rotate(-71.99 339.79 125.599)"
13407
- }
13408
- ),
13409
- /* @__PURE__ */ jsx(
13410
- "path",
13411
- {
13412
- fill: PRIMARY_MAIN,
13413
- fillRule: "nonzero",
13414
- d: "M348.060839 134.648161L353.026769 134.648161 353.026769 145.952261 348.060839 145.952261z",
13415
- opacity: "0.5",
13416
- transform: "rotate(-71.99 350.544 140.3)"
13417
- }
13418
- ),
13419
- /* @__PURE__ */ jsx(
13420
- "rect",
13421
- {
13422
- width: "50.3",
13423
- height: "78.305",
13424
- x: "291.549",
13425
- y: "174.486",
13426
- fill: "#FFF",
13427
- fillRule: "nonzero",
13428
- rx: "4",
13429
- transform: "rotate(-57.265 316.7 213.638)"
13430
- }
13431
- ),
13432
- /* @__PURE__ */ jsx(
13433
- "path",
13434
- {
13435
- fill: "#DFE3E8",
13436
- fillRule: "nonzero",
13437
- d: "M278.038439 203.88874L292.269539 203.88874 292.269539 207.23723 278.038439 207.23723z",
13438
- transform: "rotate(-57.57 285.154 205.563)"
13439
- }
13440
- ),
13441
- /* @__PURE__ */ jsx(
13442
- "path",
13443
- {
13444
- fill: "#DFE3E8",
13445
- fillRule: "nonzero",
13446
- d: "M283.007935 199.201889L314.262535 199.201889 314.262535 202.272339 283.007935 202.272339z",
13447
- transform: "rotate(-57.57 298.635 200.737)"
13448
- }
13449
- ),
13450
- /* @__PURE__ */ jsx(
13451
- "path",
13452
- {
13453
- fill: "#DFE3E8",
13454
- fillRule: "nonzero",
13455
- d: "M288.543935 202.715889L319.798535 202.715889 319.798535 205.786339 288.543935 205.786339z",
13456
- transform: "rotate(-57.57 304.171 204.251)"
13457
- }
13458
- ),
13459
- /* @__PURE__ */ jsx(
13460
- "path",
13461
- {
13462
- fill: "#DFE3E8",
13463
- fillRule: "nonzero",
13464
- d: "M294.078936 206.235889L325.333536 206.235889 325.333536 209.306339 294.078936 209.306339z",
13465
- transform: "rotate(-57.57 309.706 207.771)"
13466
- }
13467
- ),
13468
- /* @__PURE__ */ jsx(
13469
- "path",
13470
- {
13471
- fill: "#DFE3E8",
13472
- fillRule: "nonzero",
13473
- d: "M299.879919 211.40702L331.090719 211.40702 331.090719 214.47316 299.879919 214.47316z",
13474
- transform: "rotate(-57.265 315.485 212.94)"
13475
- }
13476
- ),
13477
- /* @__PURE__ */ jsx(
13478
- "path",
13479
- {
13480
- fill: "#F4F6F8",
13481
- fillRule: "nonzero",
13482
- d: "M305.149936 213.268889L336.404536 213.268889 336.404536 216.339339 305.149936 216.339339z",
13483
- transform: "rotate(-57.57 320.777 214.804)"
13484
- }
13485
- ),
13486
- /* @__PURE__ */ jsx(
13487
- "path",
13488
- {
13489
- fill: "#F4F6F8",
13490
- fillRule: "nonzero",
13491
- d: "M310.685935 216.782889L341.940535 216.782889 341.940535 219.853339 310.685935 219.853339z",
13492
- transform: "rotate(-57.57 326.313 218.318)"
13493
- }
13494
- ),
13495
- /* @__PURE__ */ jsx(
13496
- "path",
13497
- {
13498
- fill: "#DFE3E8",
13499
- fillRule: "nonzero",
13500
- d: "M341.417983 210.406958L349.511163 210.406958 349.511163 218.500138 341.417983 218.500138z",
13501
- transform: "rotate(-57.57 345.465 214.454)"
13502
- }
13503
- ),
13504
- /* @__PURE__ */ jsx(
13505
- "path",
13506
- {
13507
- fill: PRIMARY_MAIN,
13508
- fillRule: "nonzero",
13509
- 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"
13510
- }
13511
- ),
13512
- /* @__PURE__ */ jsx(
13513
- "path",
13514
- {
13515
- fill: PRIMARY_DARK,
13516
- fillRule: "nonzero",
13517
- 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",
13518
- opacity: "0.243"
13519
- }
13520
- ),
13521
- /* @__PURE__ */ jsx(
13522
- "path",
13523
- {
13524
- fill: "url(#linearGradient-2)",
13525
- fillRule: "nonzero",
13526
- 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",
13527
- opacity: "0.32"
13528
- }
13529
- ),
13530
- /* @__PURE__ */ jsx("ellipse", { cx: "119.593", cy: "258.664", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "4.846", ry: "1" }),
13531
- /* @__PURE__ */ jsx("ellipse", { cx: "101.03", cy: "260.545", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "4.846", ry: "1" }),
13532
- /* @__PURE__ */ jsx("ellipse", { cx: "108.459", cy: "265.905", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "3.444", ry: "1" }),
13533
- /* @__PURE__ */ jsx("ellipse", { cx: "89.193", cy: "265.433", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "3.444", ry: "1" }),
13534
- /* @__PURE__ */ jsx(
13535
- "path",
13536
- {
13537
- fill: PRIMARY_MAIN,
13538
- fillRule: "nonzero",
13539
- 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"
13540
- }
13541
- ),
13542
- /* @__PURE__ */ jsx(
13543
- "path",
13544
- {
13545
- stroke: PRIMARY_DARKER,
13546
- strokeLinecap: "round",
13547
- strokeWidth: "0.5",
13548
- 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"
13549
- }
13550
- ),
13551
- /* @__PURE__ */ jsx(
13552
- "path",
13553
- {
13554
- fill: PRIMARY_MAIN,
13555
- fillRule: "nonzero",
13556
- 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"
13557
- }
13558
- ),
13559
- /* @__PURE__ */ jsx(
13560
- "path",
13561
- {
13562
- stroke: PRIMARY_DARKER,
13563
- strokeLinecap: "round",
13564
- strokeWidth: "0.5",
13565
- d: "M91.113 247.808s8.353 12.115 9.968 12.647"
13566
- }
13567
- ),
13568
- /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M90.344 249.701L92.293 249.701" }),
13569
- /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M92.68 254.132L95.738 254.263" }),
13570
- /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M94.542 250.586L94.21 252.179" }),
13571
- /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M97.792 255.432L97.732 256.879" }),
13572
- /* @__PURE__ */ jsx(
13573
- "path",
13574
- {
13575
- fill: PRIMARY_MAIN,
13576
- fillRule: "nonzero",
13577
- 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"
13578
- }
13579
- ),
13580
- /* @__PURE__ */ jsx(
13581
- "path",
13582
- {
13583
- stroke: PRIMARY_DARKER,
13584
- strokeLinecap: "round",
13585
- strokeWidth: "0.5",
13586
- d: "M111.051 247.808s-8.371 12.115-9.97 12.647"
13587
- }
13588
- ),
13589
- /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M111.82 249.701L109.871 249.701" }),
13590
- /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M109.485 254.132L106.426 254.263" }),
13591
- /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M107.622 250.586L107.954 252.179" }),
13592
- /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M104.372 255.432L104.432 256.879" }),
13593
- /* @__PURE__ */ jsx(
13594
- "path",
13595
- {
13596
- fill: PRIMARY_MAIN,
13597
- fillRule: "nonzero",
13598
- 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"
13599
- }
13600
- ),
13601
- /* @__PURE__ */ jsx("circle", { cx: "84.467", cy: "87.003", r: "6.467", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1" }),
13602
- /* @__PURE__ */ jsx("circle", { cx: "395.425", cy: "138.681", r: "6.467", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1" }),
13603
- /* @__PURE__ */ jsx("circle", { cx: "279.178", cy: "66.467", r: "6.467", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1" }),
13604
- /* @__PURE__ */ jsx("circle", { cx: "97.4", cy: "122.68", r: "10.838", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1" }),
13605
- /* @__PURE__ */ jsx(
13606
- "path",
13607
- {
13608
- fill: PRIMARY_DARK,
13609
- fillRule: "nonzero",
13610
- 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"
13611
- }
13612
- ),
13613
- /* @__PURE__ */ jsx(
13614
- "path",
13615
- {
13616
- fill: PRIMARY_MAIN,
13617
- fillRule: "nonzero",
13618
- 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",
13619
- opacity: "0.72"
13620
- }
13621
- ),
13622
- /* @__PURE__ */ jsx(
13623
- "path",
13624
- {
13625
- fill: PRIMARY_DARK,
13626
- fillRule: "nonzero",
13627
- 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"
13628
- }
13629
- )
13630
- ] }) });
13631
- }
13632
- var UploadIllustration_default = memo(UploadIllustration);
13633
- var StyledDropZone = styled("div")(({ theme }) => ({
13634
- outline: "none",
13635
- cursor: "pointer",
13636
- overflow: "hidden",
13637
- position: "relative",
13638
- padding: theme.spacing(5),
13639
- borderRadius: theme.shape.borderRadius,
13640
- transition: theme.transitions.create("padding"),
13641
- backgroundColor: theme.palette.background.default,
13642
- border: `1px dashed ${alpha(theme.palette.grey[500], 0.32)}`,
13643
- "&:hover": {
13644
- opacity: 0.72
13645
- }
13646
- }));
13647
- function Upload({
13648
- disabled,
13649
- multiple = false,
13650
- error,
13651
- helperText,
13652
- //
13653
- file,
13654
- onDelete,
13655
- //
13656
- files,
13657
- thumbnail,
13658
- onUpload,
13659
- onRemove,
13660
- onRemoveAll,
13661
- sx,
13662
- ...other
13663
- }) {
13664
- const { getRootProps, getInputProps, isDragActive, isDragReject, fileRejections } = useDropzone({
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,
13665
12492
  multiple,
13666
- disabled,
13667
- ...other
12493
+ disabled: disabled || isMaxFilesReached,
12494
+ onDragEnter: () => setIsDragging(true),
12495
+ onDragLeave: () => setIsDragging(false),
12496
+ onDropAccepted: () => setIsDragging(false)
13668
12497
  });
13669
- const { t } = useTranslation();
13670
- const hasFile = !!file && !multiple;
13671
- const hasFiles = files && multiple && files.length > 0;
13672
- const isError = isDragReject || !!error;
13673
- return /* @__PURE__ */ jsxs(Box, { sx: { width: 1, position: "relative", ...sx }, children: [
13674
- /* @__PURE__ */ jsxs(
13675
- StyledDropZone,
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,
13676
12505
  {
13677
- ...getRootProps(),
13678
- sx: {
13679
- ...isDragActive && {
13680
- opacity: 0.72
13681
- },
13682
- ...isError && {
13683
- color: "error.main",
13684
- bgcolor: "error.lighter",
13685
- borderColor: "error.light"
13686
- },
13687
- ...disabled && {
13688
- opacity: 0.48,
13689
- pointerEvents: "none"
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
+ }
13690
12517
  },
13691
- ...hasFile && {
13692
- padding: "12% 0"
13693
- }
13694
- },
13695
- children: [
13696
- /* @__PURE__ */ jsx("input", { ...getInputProps() }),
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 }),
13697
12538
  /* @__PURE__ */ jsx(
13698
- Placeholder,
12539
+ Box,
13699
12540
  {
13700
- sx: {
13701
- ...hasFile && {
13702
- opacity: 0
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" })
13703
12554
  }
13704
- }
12555
+ ) })
13705
12556
  }
13706
- ),
13707
- hasFile && /* @__PURE__ */ jsx(SingleFilePreview, { file })
13708
- ]
13709
- }
13710
- ),
13711
- helperText && helperText,
13712
- /* @__PURE__ */ jsx(RejectionFiles, { fileRejections }),
13713
- hasFile && onDelete && /* @__PURE__ */ jsx(
13714
- IconButton,
13715
- {
13716
- size: "small",
13717
- onClick: onDelete,
13718
- sx: {
13719
- top: 16,
13720
- right: 16,
13721
- zIndex: 9,
13722
- position: "absolute",
13723
- color: (theme) => alpha(theme.palette.common.white, 0.8),
13724
- bgcolor: (theme) => alpha(theme.palette.grey[900], 0.72),
13725
- "&:hover": {
13726
- bgcolor: (theme) => alpha(theme.palette.grey[900], 0.48)
13727
- }
13728
- },
13729
- children: /* @__PURE__ */ jsx(Iconify_default, { icon: "eva:close-fill", width: 18 })
13730
- }
13731
- ),
13732
- hasFiles === true && /* @__PURE__ */ jsxs(Fragment, { children: [
13733
- /* @__PURE__ */ jsx(Box, { sx: { my: 3 }, children: /* @__PURE__ */ jsx(MultiFilePreview, { files, thumbnail, onRemove }) }),
13734
- /* @__PURE__ */ jsxs(Stack, { direction: "row", justifyContent: "flex-end", spacing: 1.5, children: [
13735
- onRemoveAll && /* @__PURE__ */ jsx(Button, { color: "inherit", variant: "outlined", size: "small", onClick: onRemoveAll, children: t("Remove all") }),
13736
- onUpload && /* @__PURE__ */ jsx(Button, { size: "small", variant: "contained", onClick: onUpload, children: t("Upload files") })
13737
- ] })
13738
- ] })
13739
- ] });
13740
- }
13741
- function Placeholder({ sx, ...other }) {
13742
- const { t } = useTranslation();
13743
- return /* @__PURE__ */ jsxs(
13744
- Stack,
13745
- {
13746
- spacing: 5,
13747
- alignItems: "center",
13748
- justifyContent: "center",
13749
- direction: {
13750
- xs: "column",
13751
- md: "row"
13752
- },
13753
- sx: {
13754
- width: 1,
13755
- textAlign: {
13756
- xs: "center",
13757
- md: "left"
13758
- },
13759
- ...sx
13760
- },
13761
- ...other,
13762
- children: [
13763
- /* @__PURE__ */ jsx(UploadIllustration_default, { sx: { width: 220 } }),
13764
- /* @__PURE__ */ jsxs("div", { children: [
13765
- /* @__PURE__ */ jsx(Typography, { gutterBottom: true, variant: "h5", children: t("Drop or Select file") }),
13766
- /* @__PURE__ */ jsxs(Typography, { variant: "body2", sx: { color: "text.secondary" }, children: [
13767
- t("Drop files here or click"),
13768
- /* @__PURE__ */ jsx(
13769
- Typography,
13770
- {
13771
- variant: "body2",
13772
- component: "span",
13773
- sx: {
13774
- mx: 0.5,
13775
- textDecoration: "underline"
13776
- },
13777
- children: t("browse")
13778
- }
13779
- ),
13780
- t("thorough your machine")
13781
- ] })
12557
+ )
13782
12558
  ] })
13783
- ]
13784
- }
13785
- );
13786
- }
13787
- async function blobToBase64(file) {
13788
- return new Promise((resolve, reject) => {
13789
- const reader = new FileReader();
13790
- reader.readAsDataURL(file);
13791
- reader.onloadend = function() {
13792
- const base64data = reader.result;
13793
- resolve(base64data);
13794
- };
13795
- reader.onerror = function(err) {
13796
- reject(err);
13797
- };
13798
- });
13799
- }
13800
- var AppUploadFile = ({
13801
- name,
13802
- sx,
13803
- uploadSx,
13804
- errorSx,
13805
- helperTextSx,
13806
- previewSx,
13807
- dropZoneSx,
13808
- ...rest
13809
- }) => {
13810
- var _a, _b, _c, _d, _e;
13811
- const { errors, touched, setFieldValue, values } = useFormikContext();
13812
- const fieldError = _19.get(errors, name);
13813
- const isTouched = _19.get(touched, name);
13814
- let val = _19.get(values, name);
13815
- if (((_a = rest.multiple) != null ? _a : false) && typeof val === "string") {
13816
- val = val ? [val] : [];
13817
- } else if (!((_b = rest.multiple) != null ? _b : false) && _19.isArray(val)) {
13818
- val = val[0];
13819
- }
13820
- const value = ((_c = rest.multiple) != null ? _c : false) ? (val != null ? val : []).map((__) => (__ == null ? void 0 : __.file) ? __ == null ? void 0 : __.file : __) : val;
12559
+ },
12560
+ index
12561
+ );
12562
+ };
13821
12563
  return /* @__PURE__ */ jsxs(Box, { sx, children: [
13822
- /* @__PURE__ */ jsx(
13823
- Upload,
12564
+ /* @__PURE__ */ jsxs(
12565
+ Box,
13824
12566
  {
13825
- ...rest,
13826
- file: ((_d = rest.multiple) != null ? _d : false) ? void 0 : value,
13827
- files: ((_e = rest.multiple) != null ? _e : false) ? value : void 0,
13828
- error: Boolean(fieldError) && isTouched,
13829
- 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),
13830
- sx: [{
13831
- "& .MuiDropzoneArea-root": {
13832
- minHeight: 200,
12567
+ ...getRootProps(),
12568
+ sx: [
12569
+ {
12570
+ p: 3,
13833
12571
  border: "2px dashed",
13834
- borderColor: "divider",
13835
12572
  borderRadius: 1,
13836
- "&:hover": {
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 && {
13837
12579
  borderColor: "primary.main",
13838
- backgroundColor: "action.hover"
13839
- },
13840
- ...dropZoneSx
13841
- },
13842
- "& .MuiDropzonePreviewList-root": {
13843
- ...previewSx
13844
- },
13845
- ...uploadSx
13846
- }],
13847
- onDrop: (fileVal) => {
13848
- (async () => {
13849
- var _a2;
13850
- const images = await Promise.all(
13851
- fileVal.map(async (single) => {
13852
- var _a3;
13853
- return {
13854
- preview: ((_a3 = single == null ? void 0 : single.type) == null ? void 0 : _a3.includes("image")) ? await blobToBase64(single) : void 0,
13855
- file: single
13856
- };
13857
- })
13858
- );
13859
- const currentValue = Array.isArray(value) ? value : [];
13860
- if (rest.multiple === true) {
13861
- if (currentValue.length >= ((_a2 = rest.maxFiles) != null ? _a2 : Infinity))
13862
- return;
13863
- setFieldValue(name, [...currentValue, ...images], true);
13864
- } else {
13865
- setFieldValue(name, images[0], true);
12580
+ bgcolor: "action.hover"
13866
12581
  }
13867
- })();
13868
- },
13869
- onDelete: () => {
13870
- var _a2;
13871
- if ((_a2 = rest.multiple) != null ? _a2 : false) {
13872
- setFieldValue(name, [], true);
13873
- } else {
13874
- setFieldValue(name, "", true);
13875
- }
13876
- },
13877
- onRemove: (e) => {
13878
- const afterFilter = val.filter((file) => {
13879
- var _a2;
13880
- if ((_a2 = file.file) != null ? _a2 : false) {
13881
- return !_19.isEqual(e, file.file);
12582
+ },
12583
+ ...Array.isArray(dropZoneSx) ? dropZoneSx : [dropZoneSx]
12584
+ ],
12585
+ children: [
12586
+ /* @__PURE__ */ jsx("input", { ...getInputProps() }),
12587
+ /* @__PURE__ */ jsxs(
12588
+ Stack,
12589
+ {
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
+ ]
13882
12605
  }
13883
- return !_19.isEqual(e, file);
13884
- });
13885
- setFieldValue(name, afterFilter, true);
13886
- }
12606
+ )
12607
+ ]
13887
12608
  }
13888
12609
  ),
13889
- Boolean(fieldError) && Boolean(isTouched) && /* @__PURE__ */ jsx(
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(
13890
12612
  Typography,
13891
12613
  {
13892
12614
  variant: "caption",
13893
- sx: [{
13894
- color: "error.main",
13895
- display: "block",
13896
- mt: 0.5,
13897
- ...errorSx
13898
- }],
13899
- gutterBottom: true,
12615
+ sx: [
12616
+ {
12617
+ display: "block",
12618
+ color: "error.main",
12619
+ mt: 1
12620
+ },
12621
+ ...Array.isArray(errorSx) ? errorSx : [errorSx]
12622
+ ],
13900
12623
  children: fieldError
13901
12624
  }
13902
12625
  ),
13903
- rest.maxFiles != null && /* @__PURE__ */ jsxs(
12626
+ /* @__PURE__ */ jsxs(
13904
12627
  Typography,
13905
12628
  {
13906
12629
  variant: "caption",
13907
- sx: [{
13908
- display: "block",
13909
- color: "text.secondary",
13910
- mt: 0.5,
13911
- ...helperTextSx
13912
- }],
13913
- gutterBottom: true,
12630
+ sx: [
12631
+ {
12632
+ display: "block",
12633
+ color: "text.secondary",
12634
+ mt: 0.5
12635
+ },
12636
+ ...Array.isArray(helperTextSx) ? helperTextSx : [helperTextSx]
12637
+ ],
13914
12638
  children: [
13915
- "Maximum ",
13916
- rest.maxFiles,
13917
- " file",
13918
- rest.maxFiles !== 1 ? "s" : "",
13919
- " allowed"
12639
+ (currentFiles == null ? void 0 : currentFiles.length) || 0,
12640
+ " of ",
12641
+ maxFiles,
12642
+ " files selected"
13920
12643
  ]
13921
12644
  }
13922
12645
  )