@zydon/common 2.5.17 → 2.5.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-COTMNI3C.js → chunk-4GES2XPG.js} +1 -1
- package/dist/chunk-7AZX7L27.js +9 -0
- package/dist/chunk-GFJT57TO.js +6 -0
- package/dist/chunk-U6T4WE7C.js +34 -0
- package/dist/components/EasyCrop/index.js +1 -1
- package/dist/components/EasyCropModal/index.js +2 -2
- package/dist/components/FileUpload/index.d.ts +363 -21
- package/dist/components/FileUpload/index.js +20 -19
- package/dist/components/form/UploadAvatarWithCrop/index.js +1 -1
- package/dist/components/form/UploadWithCrop/index.js +2 -2
- package/dist/components/upload/index.js +2 -2
- package/dist/hooks/useApiMessage.js +1 -1
- package/package.json +4 -2
- package/dist/chunk-7TFD7ZIP.js +0 -9
- package/dist/chunk-EUL6EPCK.js +0 -11
- package/dist/chunk-ONZBWH3C.js +0 -5
- package/dist/chunk-XAJTYCRG.js +0 -34
- package/dist/components/FileThumbnail/index.d.ts +0 -23
- package/dist/components/FileThumbnail/index.js +0 -3
- package/dist/types-ba102ece.d.ts +0 -356
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
import { a as a$
|
|
2
|
-
import { a as a$3 } from '../../chunk-2FXBVVBD.js';
|
|
3
|
-
import { a as a$5 } from '../../chunk-COTMNI3C.js';
|
|
4
|
-
import '../../chunk-7TFD7ZIP.js';
|
|
5
|
-
import '../../chunk-5NOG7L7I.js';
|
|
1
|
+
import { a as a$5 } from '../../chunk-H5L4ARDB.js';
|
|
6
2
|
import { e } from '../../chunk-ANAHA3L6.js';
|
|
3
|
+
import { a as a$3 } from '../../chunk-2FXBVVBD.js';
|
|
7
4
|
import { a } from '../../chunk-FZ4WZF6K.js';
|
|
8
|
-
import {
|
|
5
|
+
import { a as a$6 } from '../../chunk-4GES2XPG.js';
|
|
6
|
+
import '../../chunk-7AZX7L27.js';
|
|
7
|
+
import '../../chunk-5NOG7L7I.js';
|
|
9
8
|
import { a as a$2 } from '../../chunk-JEBRSFLS.js';
|
|
10
9
|
import { x } from '../../chunk-2P4CXK3O.js';
|
|
11
10
|
import { a as a$7 } from '../../chunk-FK7DDO5L.js';
|
|
12
|
-
import { j
|
|
13
|
-
import { a as a$
|
|
11
|
+
import { j } from '../../chunk-DMQW3LDF.js';
|
|
12
|
+
import { a as a$4 } from '../../chunk-MAK4JF5M.js';
|
|
14
13
|
import '../../chunk-FUB7WQS5.js';
|
|
15
14
|
import '../../chunk-ILHUUK4X.js';
|
|
16
15
|
import { a as a$1 } from '../../chunk-S7QQBC4I.js';
|
|
17
|
-
import { a as a$8 } from '../../chunk-
|
|
16
|
+
import { a as a$8 } from '../../chunk-GFJT57TO.js';
|
|
18
17
|
import { memo, forwardRef, useMemo, useLayoutEffect, useCallback, useRef, useState, useEffect } from 'react';
|
|
19
|
-
import
|
|
18
|
+
import No from '@mui/material/FormHelperText';
|
|
20
19
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
21
20
|
import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter } from '@dnd-kit/core';
|
|
22
21
|
import { restrictToHorizontalAxis, restrictToParentElement, restrictToWindowEdges } from '@dnd-kit/modifiers';
|
|
23
22
|
import { useSortable, sortableKeyboardCoordinates, SortableContext, horizontalListSortingStrategy } from '@dnd-kit/sortable';
|
|
24
23
|
import { m, AnimatePresence } from 'framer-motion';
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
24
|
+
import ge from '@mui/material/Stack';
|
|
25
|
+
import qe from '@mui/material/Typography';
|
|
26
|
+
import Ee from '@mui/material/Box';
|
|
27
|
+
import Go from '@mui/material/IconButton';
|
|
28
|
+
import jo from '@mui/material/Paper';
|
|
30
29
|
import { styled, alpha } from '@mui/material/styles';
|
|
31
|
-
import
|
|
30
|
+
import $o from '@mui/material/Badge';
|
|
31
|
+
import Lr from '@mui/material/ButtonBase';
|
|
32
|
+
import kr from '@mui/material/Tooltip';
|
|
32
33
|
import { useDropzone } from 'react-dropzone';
|
|
33
|
-
import
|
|
34
|
+
import yt from '@mui/material/CircularProgress';
|
|
34
35
|
|
|
35
|
-
var Ro=({helperText:e,disabled:o,isError:r})=>e?jsx(So,{error:r,sx:i=>({mx:"14px",color:o?i.palette.grey[500]:void 0}),children:e}):null,j=memo(Ro);var Se=styled(le)({position:"relative",width:"100%",borderRadius:8,overflow:"hidden","&:hover .actions":{display:"flex"}}),Re=styled(le)({position:"absolute",top:4,right:4,gap:.5,"& svg":{width:16,height:16}}),Xe=styled(Pe,{shouldForwardProp:e=>!["isDragActive","isError","disabled"].includes(e)})(({theme:e,isDragActive:o,isError:r,disabled:i})=>({outline:"none",cursor:"pointer",overflow:"hidden",position:"relative",padding:e.spacing(5),borderRadius:e.shape.borderRadius,transition:e.transitions.create("padding"),backgroundColor:e.palette.background.neutral,border:`1px dashed ${alpha(e.palette.grey[500],.32)}`,...o&&{opacity:.72},...r&&{color:e.palette.error.main,backgroundColor:e.palette.error.lighter,borderColor:e.palette.error.light},...i&&{opacity:.48,pointerEvents:"none"},"&:hover":{opacity:.72}}));styled(le)(({theme:e})=>({display:"none",position:"absolute",alignItems:"center",justifyContent:"center",flexDirection:"row",gap:12,width:"100%",height:"100%",backgroundColor:alpha(e.palette.primary.main,.9),zIndex:999,button:{"&, &:hover, &:focus":{backgroundColor:"#fff"}}}));var qe=styled(_o)(({theme:e})=>({position:"relative",zIndex:999,pointerEvents:"auto",color:e.palette.grey[700],backgroundColor:e.palette.grey[100],"&:hover":{color:e.palette.grey[900],backgroundColor:e.palette.grey[300]}})),Me=styled("div")({position:"relative",zIndex:1,userSelect:"none","&:hover":{zIndex:2}}),Ve=styled(le,{shouldForwardProp:e=>!["isDragging"].includes(e)})(({theme:e,width:o,isDragging:r})=>({width:o,height:100,alignItems:"center",display:"inline-flex",justifyContent:"center",margin:e.spacing(.5),padding:e.spacing(2,1,2,1),gap:e.spacing(1),borderRadius:e.spacing(1.25),overflow:"hidden",position:"relative",border:`solid 1px ${e.palette.divider}`,backgroundColor:e.palette.common.white,zIndex:1,transition:"box-shadow 150ms ease-in-out",boxShadow:r?`0 0 0 2px ${e.palette.primary.main}, ${e.customShadows.z8}, inset 0 0 0 1000px ${alpha(e.palette.primary.main,.06)}`:"0px 0px 0px 0px rgba(0, 0, 0, 0)"})),Ke=styled(m.div)(({theme:e,width:o,isDragging:r})=>({width:o,height:60,alignItems:"center",display:"inline-flex",justifyContent:"center",margin:e.spacing(.5),padding:e.spacing(2),borderRadius:e.spacing(1.25),overflow:"hidden",position:"relative",border:`solid 1px ${e.palette.divider}`,backgroundColor:e.palette.common.white,zIndex:1,transition:"box-shadow 150ms ease-in-out",boxShadow:r?`0 0 0 2px ${e.palette.primary.main}, ${e.customShadows.z8}, inset 0 0 0 1000px ${alpha(e.palette.primary.main,.06)}`:"0px 0px 0px 0px rgba(0, 0, 0, 0)"})),Je=styled(a)(({theme:e})=>({top:16,right:16,zIndex:9,position:"absolute",color:e.palette.common.white,backgroundColor:alpha(e.palette.grey[900],.72),"&:hover":{backgroundColor:alpha(e.palette.grey[900],.48)}})),Qe=styled(Pe,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="disabled"&&e!=="hasError"})(({theme:e,isDragActive:o,disabled:r,hasError:i})=>({width:64,height:64,flexShrink:0,display:"flex",borderRadius:1,cursor:"pointer",alignItems:"center",color:e.palette.text.disabled,justifyContent:"center",backgroundColor:alpha(e.palette.grey[500],.08),border:`dashed 1px ${alpha(e.palette.grey[500],.16)}`,...o&&{opacity:.72},...r&&{opacity:.48,pointerEvents:"none"},...i&&{color:e.palette.error.main,borderColor:e.palette.error.main,backgroundColor:alpha(e.palette.error.main,.08)},"&:hover":{opacity:.72}})),Ye=styled(Pe)(({theme:e})=>({padding:e.spacing(1),top:0,left:0,width:"100%",height:"100%",position:"absolute",display:"flex",justifyContent:"center",alignItems:"center",transition:"all 0.3s ease-in-out",filter:"blur(0)","&:hover":{filter:"blur(3px)"}})),eo=styled("img",{shouldForwardProp:e=>e!=="aspectRatio"&&e!=="isLoading"&&e!=="isUploading"&&e!=="maxWidth"&&e!=="maxHeight"&&e!=="cropSize"})(({theme:e,aspectRatio:o,maxWidth:r,maxHeight:i,isLoading:t,isUploading:m})=>({borderRadius:e.shape.borderRadius,objectFit:"cover",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%) scale(1)",filter:"blur(0)",zIndex:1,maxWidth:r,maxHeight:i,backgroundColor:e.palette.background.paper,width:o>1?"calc(100% - 16px)":void 0,height:o>1?void 0:"calc(100% - 16px)",aspectRatio:o,transition:"all 0.5s ease-in-out",...t||m?{opacity:0,filter:"blur(1.5rem)",transform:"translate(-50%, -50%) scale(0.7)"}:{},"&:hover":{transition:"all 0.2s ease-in-out"}})),oo=styled("img",{shouldForwardProp:e=>e!=="isLoading"&&e!=="isUploading"})(({isLoading:e,isUploading:o})=>({width:"100%",height:"100%",objectFit:"cover",top:0,left:0,filter:"blur(1.5rem)",transform:"scale(1.1)",position:"absolute",zIndex:0,transition:"opacity 0.3s ease-in-out",...e&&{opacity:0},...o&&{opacity:.7,filter:"blur(2rem)"}})),ro=styled(le)({width:"100%",height:"100%",position:"relative",overflow:"hidden",borderRadius:"50%",justifyContent:"center",alignItems:"center"});styled(Oo)(({theme:e})=>({py:1,px:2,mt:3,textAlign:"left",borderStyle:"dashed",borderColor:"error.main",backgroundColor:alpha(e.palette.error.main,.08)}));var Te=styled(Pe,{shouldForwardProp:e=>e!=="isError"&&e!=="hasFile"})(({theme:e,isError:o,hasFile:r})=>({top:0,gap:e.spacing(1),left:0,width:"100%",height:"100%",zIndex:9,display:"flex",borderRadius:"50%",position:"absolute",alignItems:"center",color:e.palette.text.disabled,flexDirection:"column",justifyContent:"center",backgroundColor:alpha(e.palette.grey[500],.08),transition:e.transitions.create(["opacity"],{duration:e.transitions.duration.shorter}),"&:hover":{opacity:.92},...o&&{color:e.palette.error.main},...r&&{zIndex:9,opacity:0,color:e.palette.common.white,backgroundColor:alpha(e.palette.common.black,.54)}})),to=styled(le)({top:0,left:0,right:0,bottom:0,position:"absolute",zIndex:10,alignItems:"center",justifyContent:"center",opacity:.8});styled(le)(({theme:e})=>({padding:20,justifyContent:"center",alignItems:"center",gap:4,alignSelf:"stretch",borderRadius:12,background:e.palette.grey[200],color:e.palette.text.disabled,height:160}));var io=styled(Pe,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="isError"&&e!=="hasFile"})(({theme:e,isDragActive:o,disabled:r,isError:i,hasFile:t})=>({padding:e.spacing(1),margin:"auto",width:144,height:144,cursor:"pointer",overflow:"hidden",borderRadius:"50%",border:`1px dashed ${alpha(e.palette.grey[500],.2)}`,...o&&{opacity:.72},...r&&{opacity:.48,pointerEvents:"none"},...i&&{borderColor:"error.main"},...t&&{...i&&{bgcolor:alpha(e.palette.error.main,.08)},"&:hover .upload-placeholder":{opacity:1},"& img":{filter:"blur(0)"},"&:hover img":{filter:"blur(3px)"}}})),ao=styled("img")({width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover",transition:"all 0.3s ease-in-out"}),no=styled(a)(({theme:e})=>({backgroundColor:alpha(e.palette.grey[900],.72),color:e.palette.common.white,"&:hover":{backgroundColor:alpha(e.palette.grey[600],.64),color:e.palette.common.white},"& svg":{width:14,height:14}}));var To=({onRemove:e,sx:o,file:r,disableDrag:i,attributes:t,listeners:m,innerWidth:s,isDragging:l})=>{let p=r?.id||r?.url;return p?jsx(Mo,{anchorOrigin:{vertical:"top",horizontal:"left"},children:jsxs(Ke,{width:s,isDragging:l,"data-testid":`preview-multi-img-${p}`,...j$1().inUp,sx:o,children:[jsx(a$2,{disableDrag:i,...t,...m}),jsx(f,{tooltip:!0,imageView:!0,file:r}),jsx(Re,{sx:{position:"absolute",right:3,top:3,zIndex:1},children:e&&jsx(no,{size:"small",label:"Remover arquivo",onClick:()=>e(r),icon:"DELETE_MARK_BUTTON_02"})})]})},`badge-${p}`):null},so=memo(To);var Bo=({file:e$1,thumbnail:o,onRemove:r,sx:i,disableDrag:t=!1})=>{let m=e$1?.size||0,s=e$1?.name||e$1?.id||e$1?.url,l=e$1?.id||e$1?.url||e$1?.name||e$1?.index?.toString()||"",p=typeof e$1=="string",n=t?70:80,{attributes:g,listeners:x$1,setNodeRef:A,transform:u,transition:h,isDragging:L}=useSortable({id:l,disabled:t}),b={transform:x.Transform.toString(u),transition:h,display:"inline-block",alignItems:"center",justifyContent:"center",width:`${n+8}px`,height:"68px"};return o&&e$1?jsx(Me,{ref:A,style:b,children:jsx(so,{innerWidth:n,isDragging:L,sx:i,file:e$1,disableDrag:t,attributes:g,listeners:x$1,onRemove:r})}):jsx(Me,{ref:A,style:{...b,height:"80px",width:`${n+38}px`},children:jsxs(Ve,{width:n+30,isDragging:L,"data-testid":`preview-multi-img-${l}`,...j$1().inUp,sx:i,children:[jsx(a$2,{disableDrag:t,...g,...x$1}),e$1&&jsx(f,{file:e$1}),jsxs(le,{flexGrow:1,sx:{width:"100%"},children:[jsx(a$3,{title:s,children:jsx(ke,{variant:"subtitle2",noWrap:!0,children:s})}),jsx(ke,{variant:"caption",sx:{color:"text.secondary"},children:p?"":e(m)})]}),jsx(Re,{children:r&&jsx(a,{size:"small",label:"Remover arquivo",onClick:()=>r(e$1),icon:"DELETE_MARK_BUTTON_02"})})]})})},mo=memo(Bo);var or=({thumbnail:e,files:o,onRemove:r,onReorder:i,sx:t})=>{let m=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),s=useCallback(p=>{let{active:n,over:g}=p;if(!(!n||!g||n.id===g.id)&&i){let x=o.findIndex(({id:u})=>u===n.id),A=o.findIndex(({id:u})=>u===g.id);x!==-1&&A!==-1&&i(x,A,o);}},[o,i]),l=jsx(AnimatePresence,{initial:!1,children:o.map(p=>jsx(mo,{sx:t,id:`preview-file-${p.id}`,file:p,onRemove:r,thumbnail:e,disableDrag:!i},`preview-file-${p.id}`))});return i?jsx(DndContext,{sensors:m,collisionDetection:closestCenter,onDragEnd:s,modifiers:[restrictToHorizontalAxis,restrictToParentElement,restrictToWindowEdges],children:jsx(SortableContext,{items:o.map(p=>p.id),strategy:horizontalListSortingStrategy,children:l})}):l},Ie=memo(or);var go=forwardRef(({onLoading:e,aspectRatio:o,cropSize:r,...i},t)=>{let{maxWidth:m,maxHeight:s}=useMemo(()=>r&&typeof r=="object"?{maxWidth:r.width,maxHeight:r.height}:r&&typeof r=="number"?{maxWidth:r,maxHeight:r}:{maxWidth:"100%",maxHeight:"100%"},[r]);a$1(()=>{e?.(!0);}),useLayoutEffect(()=>{typeof t=="object"&&t?.current?e?.(!t.current.complete):e?.(!1);},[t,e]);function l(){e?.(!1);}return jsx(eo,{...i,maxWidth:m,maxHeight:s,ref:t,aspectRatio:o,onLoad:l,onError:l})});go.displayName="LoadingPreviewImage";var uo=go;var lr=({file:e,aspectRatio:o=1,isUploading:r,isLoading:i,onLoading:t,cropSize:m,maxWidth:s,maxHeight:l})=>{let p=useRef(null),n=e?.id||e?.url||e?.name,g=e?.name||e?.url||e?.id,x=URL.createObjectURL(e)||e?.url;return n?jsxs(Ye,{className:"single-file-preview-box",children:[jsx(uo,{className:"single-file-preview-img",aspectRatio:o,cropSize:m,isLoading:i,isUploading:r,alt:g,src:x,ref:p,loading:"lazy",onLoading:t,onLoad:()=>t?.(!1),onError:()=>t?.(!1),maxWidth:s,maxHeight:l},`image-preview-${n}`),jsx(oo,{className:"single-file-preview-bg",alt:g,src:x,isLoading:i,isUploading:r})]}):null},Ce=memo(lr);var hi=e=>e.startsWith("image/"),xo=(e,o=.8)=>new Promise((r,i)=>{let t=document.createElement("canvas"),m=t.getContext("2d"),s=new Image;s.onload=()=>{t.width=s.width,t.height=s.height,m?(m.drawImage(s,0,0),t.toBlob(l=>{if(l){let p=new File([l],e.name.replace(/\.[^/.]+$/,".webp"),{type:"image/webp",lastModified:Date.now()});r(p);}else i(new Error("Falha ao converter para WebP"));},"image/webp",o)):i(new Error("N\xE3o foi poss\xEDvel obter contexto do canvas"));},s.onerror=()=>i(new Error("Falha ao carregar imagem")),s.src=URL.createObjectURL(e);});var gr=({onFilesSelect:e$1,onFileSelect:o,onReorder:r,onRemove:i,filesPreview:t,dropzoneOptions:m,enableCrop:s=!1,customAspectRatio:l,convertToWebp:p=!0,cropSize:n,maxFiles:g})=>{let{showErrorMessage:x}=a$8(),A=useMemo(()=>l||(n&&typeof n!="number"?n.width/n.height:1),[l,n]),[u,h]=useState([]),[L,b]=useState(!1),[v,S]=useState(null),[P,R]=useState(null),[d,D]=useState(""),[_,f]=useState(!1),[I,y]=useState([]),[T,F]=useState(0),[z,q]=useState(0),Y=c=>{if(c.length<1)return;let E=c[0];S(E),F(O=>O+1);let U=new FileReader;U.onload=()=>{D(U.result),b(!0);},U.readAsDataURL(E);},ie=(c,E)=>{R(E);},ae=async()=>!v||!P?null:new Promise(c=>{let E=document.createElement("canvas"),U=E.getContext("2d"),O=new Image;O.onload=async()=>{let{width:C,height:he,x:Ao,y:wo}=P,ve=C,Ee=he;n&&(typeof n=="number"?(ve=n,Ee=n/A):(ve=n.width,Ee=n.height)),E.width=ve,E.height=Ee,U?(U.drawImage(O,Ao,wo,C,he,0,0,ve,Ee),E.toBlob(async je=>{if(je){let Ue=new File([je],v.name,{type:v.type,lastModified:Date.now()});if(p)try{Ue=await xo(Ue);}catch(Do){x(Do,"Erro ao converter para WebP");}c(Ue);}else c(null);},"image/png")):c(null);},O.src=d;}),ne=async()=>{if(!(!v||!P)){f(!0);try{let c=await ae();c&&e$1?e$1([c],h):c&&o&&o(c,h),b(!1),f(!1),D(""),S(null);let E=I.slice(1);y(E),Y(E);}catch(c){x(c,"Erro ao processar imagem");}}},N=()=>{b(!1),f(!1),D(""),S(null),y([]),F(0),q(0);},$=c=>{if(c.length===0)return;let E=Object.keys(m?.accept||{}).some(O=>O.includes("image/")),U=u.length+c.length;if(g&&U>g){x(new Error(`M\xE1ximo de ${g} arquivos`),"Erro ao fazer upload");return}if(E&&s){let O=c.filter(C=>C.type.startsWith("image/"));q(O.length),F(0),y(O),Y(O);}else if(e$1)e$1(c,h);else if(o){let O=c[0];o(O,h);}},k=c=>{if(!c.length)return;let E=c[0]?.errors[0]?.code,U=m?.maxSize||3145728;x(E==="file-too-large"?new Error(`O arquivo excede o tamanho m\xE1ximo de ${e(U)}`):E==="file-invalid-type"?new Error("Formato de arquivo n\xE3o suportado"):c[0]?.errors[0]||new Error("Erro ao enviar arquivo"),"Erro ao fazer upload");},{getRootProps:B,getInputProps:V,isDragActive:ee,isDragReject:G,fileRejections:W}=useDropzone({onDrop:$,onDropRejected:k,...m}),K=c=>{if(!c){h([]),i?.(void 0);return}if(e$1){let E=u.filter(U=>U.id!==c.id);h(E),i?.(c);}else h([]),i?.(c);},a=(c,E,U)=>{h(O=>{let C=[...O],[he]=C.splice(c,1);return C.splice(E,0,he),r?.(c,E,U),C});};return useEffect(()=>{let c=t||[];h(E=>{let U=JSON.stringify(E?.map(C=>C.id||C.name)),O=JSON.stringify(c?.map(C=>C.id||C.name));return U===O?E:c});},[t]),{file:u?.[0],files:u,aspectRatio:A,dropzoneProps:{getRootProps:B,getInputProps:V,isDragActive:ee,isDragReject:G,fileRejections:W},cropState:{cropModalOpen:L,imagePreview:d,cropLoading:_,setCropModalOpen:b,onCropInitialized:ie,handleCropSave:ne,handleCropCancel:N,currentImageIndex:T,totalPendingImages:z},setInitialFiles:h,handleRemove:K,handleReorder:a}},Z=gr;var ze=(a=>(a.APPLICATION_OCTET_STREAM="application/octet-stream",a.IMAGE_JPEG="image/jpeg",a.IMAGE_JPG="image/jpg",a.IMAGE_PNG="image/png",a.IMAGE_GIF="image/gif",a.IMAGE_WEBP="image/webp",a.IMAGE_SVG="image/svg+xml",a.IMAGE_BMP="image/bmp",a.IMAGE_TIFF="image/tiff",a.IMAGE_ICO="image/x-icon",a.IMAGE_AVIF="image/avif",a.APPLICATION_PDF="application/pdf",a.TEXT_PLAIN="text/plain",a.TEXT_CSV="text/csv",a.APPLICATION_RTF="application/rtf",a.APPLICATION_MSWORD="application/msword",a.APPLICATION_DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",a.APPLICATION_MSEXCEL="application/vnd.ms-excel",a.APPLICATION_XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",a.APPLICATION_MSPOWERPOINT="application/vnd.ms-powerpoint",a.APPLICATION_PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",a.APPLICATION_ODT="application/vnd.oasis.opendocument.text",a.APPLICATION_ODS="application/vnd.oasis.opendocument.spreadsheet",a.APPLICATION_ODP="application/vnd.oasis.opendocument.presentation",a.APPLICATION_XML="application/xml",a.TEXT_XML="text/xml",a.TEXT_HTML="text/html",a.TEXT_CSS="text/css",a.APPLICATION_JSON="application/json",a.TEXT_JAVASCRIPT="text/javascript",a.APPLICATION_ZIP="application/zip",a.APPLICATION_GZIP="application/gzip",a.APPLICATION_RAR="application/vnd.rar",a.APPLICATION_7Z="application/x-7z-compressed",a.AUDIO_MPEG="audio/mpeg",a.AUDIO_WAV="audio/wav",a.AUDIO_OGG="audio/ogg",a.AUDIO_WEBM="audio/webm",a.AUDIO_AAC="audio/aac",a.VIDEO_MP4="video/mp4",a.VIDEO_MPEG="video/mpeg",a.VIDEO_OGG="video/ogg",a.VIDEO_WEBM="video/webm",a.VIDEO_QUICKTIME="video/quicktime",a))(ze||{}),_e=(e=>(e["application/octet-stream"]="APPLICATION_OCTET_STREAM",e["image/jpeg"]="IMAGE_JPEG",e["image/jpg"]="IMAGE_JPG",e["image/png"]="IMAGE_PNG",e["image/gif"]="IMAGE_GIF",e["image/webp"]="IMAGE_WEBP",e["image/svg+xml"]="IMAGE_SVG",e["image/bmp"]="IMAGE_BMP",e["image/tiff"]="IMAGE_TIFF",e["image/x-icon"]="IMAGE_ICO",e["image/avif"]="IMAGE_AVIF",e["application/pdf"]="APPLICATION_PDF",e["text/plain"]="TEXT_PLAIN",e["text/csv"]="TEXT_CSV",e["application/rtf"]="APPLICATION_RTF",e["application/msword"]="APPLICATION_MSWORD",e["application/vnd.openxmlformats-officedocument.wordprocessingml.document"]="APPLICATION_DOCX",e["application/vnd.ms-excel"]="APPLICATION_MSEXCEL",e["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"]="APPLICATION_XLSX",e["application/vnd.ms-powerpoint"]="APPLICATION_MSPOWERPOINT",e["application/vnd.openxmlformats-officedocument.presentationml.presentation"]="APPLICATION_PPTX",e["application/vnd.oasis.opendocument.text"]="APPLICATION_ODT",e["application/vnd.oasis.opendocument.spreadsheet"]="APPLICATION_ODS",e["application/vnd.oasis.opendocument.presentation"]="APPLICATION_ODP",e["application/xml"]="APPLICATION_XML",e["text/xml"]="TEXT_XML",e["text/html"]="TEXT_HTML",e["text/css"]="TEXT_CSS",e["application/json"]="APPLICATION_JSON",e["text/javascript"]="TEXT_JAVASCRIPT",e["application/zip"]="APPLICATION_ZIP",e["application/gzip"]="APPLICATION_GZIP",e["application/vnd.rar"]="APPLICATION_RAR",e["application/x-7z-compressed"]="APPLICATION_7Z",e["audio/mpeg"]="AUDIO_MPEG",e["audio/wav"]="AUDIO_WAV",e["audio/ogg"]="AUDIO_OGG",e["audio/webm"]="AUDIO_WEBM",e["audio/aac"]="AUDIO_AAC",e["video/mp4"]="VIDEO_MP4",e["video/mpeg"]="VIDEO_MPEG",e["video/ogg"]="VIDEO_OGG",e["video/webm"]="VIDEO_WEBM",e["video/quicktime"]="VIDEO_QUICKTIME",e))(_e||{});var br=({createFilesMutation:e,filesUrl:o})=>{let{showErrorMessage:r}=a$8(),[i,t]=useState(!1),[m,s]=useState(!1),[l,p]=useState(null),[n,g]=useState(),x=useMemo(()=>n?.[0],[n]),A=m||i,u=useCallback(async b=>{if(!b?.length){g(void 0),s(!1);return}s(!0);try{let S=(await Promise.all(b.map(async(P,R)=>{try{if(!o[R])return null;let d=await fetch(o[R]);if(!d.ok)throw new Error(d.statusText);let D=await d.blob(),_=d.headers.get("etag"),f=d.headers.get("content-disposition")||void 0,I=null;if(f){let F=f.match(/filename\*=UTF-8''([^;]+)|filename="?([^";]+)"?/i),z=F?.[1]||F?.[2];if(z)try{I=decodeURIComponent(z);}catch{I=z;}}let y=I||_,T=new File([D],y,{type:D.type});return T.id=_,T.url=o[R],T.index=R,T}catch{return null}}))).filter(P=>P!==null);g(S);}catch(v){r(v,"Erro ao carregar preview dos arquivos"),g(void 0);}finally{s(!1);}},[o,r]),h=useRef("");return useEffect(()=>{let b=JSON.stringify(o||[]);if(b===h.current)return;h.current=b;let v=!1;return (async()=>{if(o.length){let P=o.filter(Boolean);if(await u(P),v)return}else g(void 0),s(!1);})(),()=>{v=!0;}},[o,u]),{filesPreview:n,filePreview:x,uploadFiles:async(b,v)=>{let S=b.filter(P=>P instanceof File);if(S?.length){t(!0);try{let P=S.map(f=>{let I=f.type||"application/octet-stream",y=_e[I];if(!y)throw new Error(`Tipo de arquivo n\xE3o suportado: ${I}`);return {file:f,mimeType:I,contentTypeEnum:y}}),R=await e({files:P.map(({file:f,contentTypeEnum:I})=>({content_type:I,name:f.name}))}).unwrap(),d=R.files.map(f=>f.id),D=[];return (await Promise.all(R.files.map((f,I)=>{let{file:y,mimeType:T}=P[I],F=y;return F.id=f.id,F.url=URL.createObjectURL(F),D.push(F),fetch(f.url,{method:"PUT",headers:{"Content-Type":T,"Content-Disposition":`inline; filename="${F.name}"`},body:F})}))).forEach(f=>{if(!f.ok)throw new Error(`Erro no upload: ${f.statusText}`)}),v?.(D),d}catch(P){throw p(P),r(P,"Erro no upload"),P}finally{t(!1);}}},setFilesPreview:g,isUploadingFiles:i,isLoadingPreview:m,isUploadOrLoadingFiles:A,uploadFilesError:l}},Ir=br;var vr=({sx:e,id:o,name:r,tabIndex:i,uploading:t,getRootProps:m,getInputProps:s,isDragActive:l,isError:p,disabled:n,dropZoneSxProps:g,dropZoneContent:x,children:A,...u})=>jsxs(Se,{children:[t&&jsx(a$7,{"data-testid":"uploading-progress-bar",sx:{zIndex:1}}),jsxs(Pe,{sx:{width:1,position:"relative",...e},children:[jsxs(Xe,{...m(),"data-testid":"drop-zone-styled-area",isError:p,isDragActive:l,disabled:!!n,sx:g,...u,children:[jsx("input",{...s(),id:o,tabIndex:i,name:r}),x]}),A]})]}),oe=vr;var wr=({header:e,description:o,sx:r,...i})=>jsxs(le,{spacing:5,alignItems:"center",justifyContent:"center",direction:{xs:"column",md:"row"},sx:{width:1,textAlign:{xs:"center",md:"left"},...r},...i,children:[jsx(a$4,{sx:{width:220}}),jsxs("div",{children:[jsx(ke,{gutterBottom:!0,variant:"h5",children:e||"Soltar ou selecionar arquivos"}),jsx(ke,{variant:"body2",sx:{color:"text.secondary"},children:o||jsxs(Fragment,{children:["Solte os arquivos aqui ou clique",jsx(ke,{variant:"body2",component:"span",sx:{mx:.5,color:"primary.main",textDecoration:"underline"},children:"procurar"}),"na sua m\xE1quina"]})})]})]}),re=memo(wr);var yr=({onRemove:e,onReorder:o,onFilesSelect:r,id:i,disabled:t,error:m,helperText:s,files:l,thumbnail:p,dropZoneSxProps:n,uploading:g,tabIndex:x,maxFiles:A,placeholderAlt:u,placeholderProps:h,...L})=>{let{files:b,dropzoneProps:v,handleRemove:S,handleReorder:P}=Z({onFilesSelect:r,onReorder:o,onRemove:e,filesPreview:l,dropzoneOptions:{multiple:!0,disabled:t,...L},maxFiles:A}),{getRootProps:R,getInputProps:d,isDragActive:D,isDragReject:_}=v,f=!!b?.filter(y=>!!y.id).length,I=_||!!m;return jsxs(oe,{id:i,uploading:g,disabled:t,dropZoneSxProps:n,tabIndex:x,getRootProps:R,getInputProps:d,isDragActive:D,isError:I,dropZoneContent:jsx(Fragment,{children:u?jsx(le,{children:u}):jsx(re,{header:h?.header,description:h?.description})}),children:[jsx(j,{disabled:t,helperText:s,isError:I}),f&&jsx(Pe,{sx:{my:3},children:jsx(Ie,{files:b,thumbnail:!!p,onRemove:e?S:void 0,onReorder:o?P:void 0})})]})},_r=memo(yr);var zr=({onFilesSelect:e,onRemove:o,onReorder:r,id:i,disabled:t,error:m,helperText:s,files:l,dropZoneSxProps:p,placeholderProps:n,placeholderAlt:g,uploading:x,tabIndex:A,maxFiles:u,aspectRatio:h,enableCrop:L=!0,convertToWebp:b=!0,cropSize:v,name:S,label:P,...R})=>{let{files:d,dropzoneProps:D,cropState:_,aspectRatio:f,handleRemove:I,handleReorder:y}=Z({onFilesSelect:e,onReorder:r,onRemove:o,filesPreview:l,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!0,disabled:t,...R},enableCrop:L,customAspectRatio:h,convertToWebp:b,maxFiles:u,cropSize:v,uploading:x}),{getRootProps:T,getInputProps:F,isDragActive:z,isDragReject:q}=D,{cropModalOpen:Y,imagePreview:ie,cropLoading:ae,onCropInitialized:ne,handleCropSave:N,handleCropCancel:$,currentImageIndex:k,totalPendingImages:B}=_,V=!!d?.filter(W=>!!W.id).length,ee=q||!!m,G=useMemo(()=>{let W=P??"Ajustar Imagem",K=B>1||k>1?` (${k} de ${B})`:"";return `${W}${K}`},[P,B,k]);return jsxs(oe,{id:i,name:S,uploading:x,disabled:t,dropZoneSxProps:p,tabIndex:A,getRootProps:T,getInputProps:F,isDragActive:z,isError:ee,dropZoneContent:jsx(Fragment,{children:g?jsx(le,{children:g}):jsx(re,{header:n?.header,description:n?.description})}),children:[jsx(j,{disabled:t,helperText:s,isError:ee}),V&&jsx(Pe,{sx:{my:3,ml:.5},children:jsx(Ie,{files:d,thumbnail:!0,onRemove:I,onReorder:r?y:void 0})}),jsx(a$5,{open:Y,onClose:$,label:G,imageSrc:ie,aspectRatio:f,onInitialized:ne,onSave:N,loading:ae,cropSize:v})]})},Nr=memo(zr);var Zr=({onFileSelect:e$1,onRemove:o,file:r,id:i,disabled:t,error:m$1,helperText:s,sx:l,dropZoneSxProps:p,uploading:n,tabIndex:g,...x})=>{let A=r?[r]:[],{file:u,dropzoneProps:h,handleRemove:L}=Z({onFileSelect:e$1,onRemove:o,filesPreview:A,dropzoneOptions:{multiple:!1,disabled:t,...x}}),{getRootProps:b,getInputProps:v,isDragActive:S,isDragReject:P}=h,R=useCallback(f=>{f.stopPropagation(),L(u||void 0);},[u,L]),d=!!u,D=typeof u=="string",_=P||!!m$1;return jsx(oe,{id:i,uploading:n,disabled:t,dropZoneSxProps:p,tabIndex:g,getRootProps:b,getInputProps:v,isDragActive:S,isError:_,dropZoneContent:jsxs(Fragment,{children:[!d&&jsx(re,{}),d&&jsxs(le,{component:m.div,...j$1().inUp,spacing:2,direction:"row",alignItems:"center",sx:{my:1,px:1,py:.75,borderRadius:.75,border:f=>`solid 1px ${f.palette.divider}`,...l},children:[jsx(f,{file:u}),jsxs(le,{flexGrow:1,sx:{minWidth:0},children:[jsx(ke,{variant:"subtitle2",noWrap:!0,children:D?u:u.name}),jsx(ke,{variant:"caption",sx:{color:"text.secondary"},children:D?"":e(u.size)})]}),o&&jsx(a$3,{title:"Remover arquivo",children:jsx(qe,{edge:"end",size:"small",disabled:t,"aria-label":"Remover arquivo",onClick:R,children:jsx(a$6,{icon:"DELETE_MARK_BUTTON_02",width:16})})})]})]}),children:jsx(j,{disabled:t,helperText:s,isError:_})})},Hr=memo(Zr);var Qr=({onRemove:e,onFileSelect:o,file:r,id:i,disabled:t,error:m,helperText:s,dropZoneSxProps:l,placeholderProps:p,placeholderAlt:n,uploading:g,tabIndex:x,aspectRatio:A,enableCrop:u=!0,convertToWebp:h=!0,name:L,label:b,cropSize:v,sx:S,maxWidth:P,maxHeight:R,...d})=>{let D=r?[r]:[],[_,f]=useState(!1),{file:I,dropzoneProps:y,cropState:T,handleRemove:F,aspectRatio:z}=Z({onFileSelect:o,onRemove:e,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:t,...d},filesPreview:D,enableCrop:u,customAspectRatio:A,convertToWebp:h,cropSize:v}),{getRootProps:q,getInputProps:Y,isDragActive:ie,isDragReject:ae}=y,{cropModalOpen:ne,imagePreview:N,cropLoading:$,onCropInitialized:k,handleCropSave:B,handleCropCancel:V}=T,ee=useCallback(()=>{F(I||void 0);},[I,F]),G=!!I,W=ae||!!m,K=G?{opacity:0}:{opacity:1},a=l?.width;return useEffect(()=>{G||f(!1);},[G]),jsxs(Se,{sx:{...S,...a&&{width:a}},children:[(g||_)&&jsx(a$7,{}),jsxs(oe,{id:i,uploading:g,disabled:t,dropZoneSxProps:l,tabIndex:x,getRootProps:q,getInputProps:Y,isDragActive:ie,isError:W,name:L,dropZoneContent:jsxs(Fragment,{children:[n?jsx(le,{sx:K,children:n}):jsx(re,{sx:K,header:p?.title,description:p?.description}),G&&jsx(Ce,{file:I,cropSize:v,isLoading:_,isUploading:g,onLoading:f,aspectRatio:z,maxWidth:P,maxHeight:R})]}),children:[jsx(j,{disabled:t,helperText:s,isError:W}),G&&e&&jsx(Je,{size:"small",onClick:ee,disabled:t,label:"Remover arquivo",children:jsx(a$6,{icon:"DELETE_MARK_BUTTON_02",width:16})}),jsx(a$5,{open:ne,onClose:V,label:b??"Ajustar Imagem",imageSrc:N,aspectRatio:z,onInitialized:k,onSave:B,loading:$,cropSize:v})]})]})},Yr=memo(Qr);var nt=({onFileSelect:e,onRemove:o,file:r,disabled:i,label:t,id:m,tabIndex:s,error:l,helperText:p,sx:n,name:g,maxSize:x,uploading:A,aspectRatio:u=1,enableCrop:h=!0,convertToWebp:L=!0,cropSize:b,...v})=>{let[S,P]=useState(!1),R=r?[r]:[],{file:d,dropzoneProps:D,cropState:_,handleRemove:f}=Z({filesPreview:R,onFileSelect:e,onRemove:o,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:i,maxSize:x,...v},enableCrop:h,customAspectRatio:u,convertToWebp:L,cropSize:b}),{getRootProps:I,getInputProps:y,isDragActive:T,isDragReject:F}=D,{cropModalOpen:z,imagePreview:q,cropLoading:Y,onCropInitialized:ie,handleCropSave:ae,handleCropCancel:ne}=_,N=F||!!l,$=S||A,k=!!o,B=useRef(""),V=useRef();useEffect(()=>{if(!d){B.current="",V.current=void 0;return}let W=d.id??`${d.name}-${d.size}-${d.lastModified}`;if(V.current===W)return;V.current=W,P(!0);let K=URL.createObjectURL(d);return B.current=K,()=>{URL.revokeObjectURL(K);}},[d]);let ee=()=>{P(!1);},G=useCallback(()=>k&&d?()=>f(d):I().onClick,[k,d,I,f]);return jsxs(Fragment,{children:[jsxs(le,{sx:{alignItems:"center"},children:[jsxs(io,{sx:n,isError:N,isDragActive:T,hasFile:!!d,...I(),onClick:G(),children:[jsxs(ro,{children:[$&&jsx(to,{children:jsx(at,{size:135,thickness:2,color:"primary"})}),d&&jsx(ao,{alt:"Avatar Preview",src:B.current,onLoad:ee,...$&&{sx:{filter:"blur(5px) !important",scale:1.2,opacity:.7}}}),!d&&!$&&jsxs(Te,{isError:N,hasFile:!1,children:[jsx(a$6,{icon:"ADD_IMAGE",width:32}),jsx(ke,{variant:"caption",textAlign:"center",sx:{color:N?"error.main":"text.disabled"},children:"Adicionar foto"})]}),d&&!$&&jsxs(Te,{isError:N,hasFile:!0,children:[jsx(a$6,{icon:k?"DELETE_MARK_BUTTON_02":"ADD_IMAGE",width:32}),jsx(ke,{variant:"caption",textAlign:"center",sx:{color:N?"error.main":"common.white"},children:k?"Remover foto":"Alterar foto"})]})]}),jsx("input",{name:g,id:m,tabIndex:s,...y()})]}),jsx(le,{sx:{alignItems:"center",mt:-.5},children:jsx(j,{helperText:p,disabled:i,isError:N})})]}),z&&q&&jsx(a$5,{open:z,onClose:ne,label:t??"Ajustar Imagem",imageSrc:q,aspectRatio:u,onInitialized:ie,onSave:ae,loading:Y,cropSize:b,cropShape:"round"})]})},st=memo(nt);var mt=({error:e,name:o,disabled:r,sx:i,...t})=>{let{getRootProps:m,getInputProps:s,isDragActive:l,isDragReject:p}=useDropzone({disabled:r,...t}),n=p||e;return jsxs(Qe,{...m(),isDragActive:l,hasError:!!n,disabled:!!r,sx:i,"data-testid":"upload-box",children:[jsx("input",{name:o,...s()}),"Selecionar arquivo"]})},ct=memo(mt);
|
|
36
|
+
var Bo=({helperText:e,disabled:o,isError:r})=>e?jsx(No,{error:r,sx:t=>({mx:"14px",color:o?t.palette.grey[500]:void 0}),children:e}):null,_=memo(Bo);var ye=styled(ge)({position:"relative",width:"100%",borderRadius:8,overflow:"hidden","&:hover .actions":{display:"flex"}}),Le=styled(ge)({position:"absolute",top:4,right:4,gap:.5,"& svg":{width:16,height:16}}),ro=styled(Ee,{shouldForwardProp:e=>!["isDragActive","isError","disabled"].includes(e)})(({theme:e,isDragActive:o,isError:r,disabled:t})=>({outline:"none",cursor:"pointer",overflow:"hidden",position:"relative",padding:e.spacing(5),borderRadius:e.shape.borderRadius,transition:e.transitions.create("padding"),backgroundColor:e.palette.background.neutral,border:`1px dashed ${alpha(e.palette.grey[500],.32)}`,...o&&{opacity:.72},...r&&{color:e.palette.error.main,backgroundColor:e.palette.error.lighter,borderColor:e.palette.error.light},...t&&{opacity:.48,pointerEvents:"none"},"&:hover":{opacity:.72}}));styled(ge)(({theme:e})=>({display:"none",position:"absolute",alignItems:"center",justifyContent:"center",flexDirection:"row",gap:12,width:"100%",height:"100%",backgroundColor:alpha(e.palette.primary.main,.9),zIndex:999,button:{"&, &:hover, &:focus":{backgroundColor:"#fff"}}}));var to=styled(Go)(({theme:e})=>({position:"relative",zIndex:999,pointerEvents:"auto",color:e.palette.grey[700],backgroundColor:e.palette.grey[100],"&:hover":{color:e.palette.grey[900],backgroundColor:e.palette.grey[300]}})),Ge=styled("div")({position:"relative",zIndex:1,userSelect:"none","&:hover":{zIndex:2}}),io=styled(ge,{shouldForwardProp:e=>!["isDragging"].includes(e)})(({theme:e,width:o,isDragging:r})=>({width:o,height:100,alignItems:"center",display:"inline-flex",justifyContent:"center",margin:e.spacing(.5),padding:e.spacing(2,1,2,1),gap:e.spacing(1),borderRadius:e.spacing(1.25),overflow:"hidden",position:"relative",border:`solid 1px ${e.palette.divider}`,backgroundColor:e.palette.common.white,zIndex:1,transition:"box-shadow 150ms ease-in-out",boxShadow:r?`0 0 0 2px ${e.palette.primary.main}, ${e.customShadows.z8}, inset 0 0 0 1000px ${alpha(e.palette.primary.main,.06)}`:"0px 0px 0px 0px rgba(0, 0, 0, 0)"})),ao=styled(m.div)(({theme:e,width:o,isDragging:r})=>({width:o,height:60,alignItems:"center",display:"inline-flex",justifyContent:"center",margin:e.spacing(.5),padding:e.spacing(2),borderRadius:e.spacing(1.25),overflow:"hidden",position:"relative",border:`solid 1px ${e.palette.divider}`,backgroundColor:e.palette.common.white,zIndex:1,transition:"box-shadow 150ms ease-in-out",boxShadow:r?`0 0 0 2px ${e.palette.primary.main}, ${e.customShadows.z8}, inset 0 0 0 1000px ${alpha(e.palette.primary.main,.06)}`:"0px 0px 0px 0px rgba(0, 0, 0, 0)"})),no=styled(a)(({theme:e})=>({top:16,right:16,zIndex:9,position:"absolute",color:e.palette.common.white,backgroundColor:alpha(e.palette.grey[900],.72),"&:hover":{backgroundColor:alpha(e.palette.grey[900],.48)}})),so=styled(Ee,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="disabled"&&e!=="hasError"})(({theme:e,isDragActive:o,disabled:r,hasError:t})=>({width:64,height:64,flexShrink:0,display:"flex",borderRadius:1,cursor:"pointer",alignItems:"center",color:e.palette.text.disabled,justifyContent:"center",backgroundColor:alpha(e.palette.grey[500],.08),border:`dashed 1px ${alpha(e.palette.grey[500],.16)}`,...o&&{opacity:.72},...r&&{opacity:.48,pointerEvents:"none"},...t&&{color:e.palette.error.main,borderColor:e.palette.error.main,backgroundColor:alpha(e.palette.error.main,.08)},"&:hover":{opacity:.72}})),lo=styled(Ee)(({theme:e})=>({padding:e.spacing(1),top:0,left:0,width:"100%",height:"100%",position:"absolute",display:"flex",justifyContent:"center",alignItems:"center",transition:"all 0.3s ease-in-out",filter:"blur(0)","&:hover":{filter:"blur(3px)"}})),po=styled("img",{shouldForwardProp:e=>e!=="aspectRatio"&&e!=="isLoading"&&e!=="isUploading"&&e!=="maxWidth"&&e!=="maxHeight"&&e!=="cropSize"})(({theme:e,aspectRatio:o,maxWidth:r,maxHeight:t,isLoading:a,isUploading:s})=>({borderRadius:e.shape.borderRadius,objectFit:"cover",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%) scale(1)",filter:"blur(0)",zIndex:1,maxWidth:r,maxHeight:t,backgroundColor:e.palette.background.paper,aspectRatio:Math.abs(o),...Math.abs(o)>1?{width:"calc(100% - 16px)",height:void 0}:{width:void 0,height:"calc(100% - 16px)"},transition:"all 0.5s ease-in-out",...a||s?{opacity:0,filter:"blur(1.5rem)",transform:"translate(-50%, -50%) scale(0.7)"}:{},"&:hover":{transition:"all 0.2s ease-in-out"}})),mo=styled("img",{shouldForwardProp:e=>e!=="isLoading"&&e!=="isUploading"})(({isLoading:e,isUploading:o})=>({width:"100%",height:"100%",objectFit:"cover",top:0,left:0,filter:"blur(1.5rem)",transform:"scale(1.1)",position:"absolute",zIndex:0,transition:"opacity 0.3s ease-in-out",...e&&{opacity:0},...o&&{opacity:.7,filter:"blur(2rem)"}})),co=styled(ge)({width:"100%",height:"100%",position:"relative",overflow:"hidden",borderRadius:"50%",justifyContent:"center",alignItems:"center"});styled(jo)(({theme:e})=>({py:1,px:2,mt:3,textAlign:"left",borderStyle:"dashed",borderColor:"error.main",backgroundColor:alpha(e.palette.error.main,.08)}));var je=styled(Ee,{shouldForwardProp:e=>e!=="isError"&&e!=="hasFile"})(({theme:e,isError:o,hasFile:r})=>({top:0,gap:e.spacing(1),left:0,width:"100%",height:"100%",zIndex:9,display:"flex",borderRadius:"50%",position:"absolute",alignItems:"center",color:e.palette.text.disabled,flexDirection:"column",justifyContent:"center",backgroundColor:alpha(e.palette.grey[500],.08),transition:e.transitions.create(["opacity"],{duration:e.transitions.duration.shorter}),"&:hover":{opacity:.92},...o&&{color:e.palette.error.main},...r&&{zIndex:9,opacity:0,color:e.palette.common.white,backgroundColor:alpha(e.palette.common.black,.54)}})),go=styled(ge)({top:0,left:0,right:0,bottom:0,position:"absolute",zIndex:10,alignItems:"center",justifyContent:"center",opacity:.8});styled(ge)(({theme:e})=>({padding:20,justifyContent:"center",alignItems:"center",gap:4,alignSelf:"stretch",borderRadius:12,background:e.palette.grey[200],color:e.palette.text.disabled,height:160}));var uo=styled(Ee,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="isError"&&e!=="hasFile"})(({theme:e,isDragActive:o,disabled:r,isError:t,hasFile:a})=>({padding:e.spacing(1),margin:"auto",width:144,height:144,cursor:"pointer",overflow:"hidden",borderRadius:"50%",border:`1px dashed ${alpha(e.palette.grey[500],.2)}`,...o&&{opacity:.72},...r&&{opacity:.48,pointerEvents:"none"},...t&&{borderColor:"error.main"},...a&&{...t&&{bgcolor:alpha(e.palette.error.main,.08)},"&:hover .upload-placeholder":{opacity:1},"& img":{filter:"blur(0)"},"&:hover img":{filter:"blur(3px)"}}})),fo=styled("img")({width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover",transition:"all 0.3s ease-in-out"}),xo=styled(a)(({theme:e})=>({backgroundColor:alpha(e.palette.grey[900],.72),color:e.palette.common.white,"&:hover":{backgroundColor:alpha(e.palette.grey[600],.64),color:e.palette.common.white},"& svg":{width:14,height:14}}));var Xo=({onRemove:e,sx:o,file:r,disableDrag:t,attributes:a,listeners:s,innerWidth:n,isDragging:p})=>{let l=r?.id;return l?jsx($o,{anchorOrigin:{vertical:"top",horizontal:"left"},children:jsxs(ao,{width:n,isDragging:p,"data-testid":`preview-multi-img-${l}`,...j().inUp,sx:o,children:[jsx(a$2,{disableDrag:t,...a,...s}),jsx(Pe,{imageView:!0,file:r}),jsx(Le,{sx:{position:"absolute",right:3,top:3,zIndex:1},children:e&&jsx(xo,{size:"small",label:"Remover arquivo",onClick:()=>e(r),icon:"DELETE_MARK_BUTTON_02"})})]})},`badge-${l}`):null},ho=memo(Xo);var Qo=({file:e$1,thumbnail:o,onRemove:r,sx:t,disableDrag:a$1=!1})=>{let s=e$1.size||0,n=e$1.name||e$1.id,p=e$1.id,l=typeof e$1=="string",x$1=a$1?70:80,{attributes:d,listeners:g,setNodeRef:I,transform:E,transition:A,isDragging:b}=useSortable({id:p,disabled:a$1}),C={transform:x.Transform.toString(E),transition:A,display:"inline-block",alignItems:"center",justifyContent:"center",width:`${x$1+8}px`,height:"68px"};return o&&e$1?jsx(Ge,{ref:I,style:C,children:jsx(ho,{innerWidth:x$1,isDragging:b,sx:t,file:e$1,disableDrag:a$1,attributes:d,listeners:g,onRemove:r})}):jsx(Ge,{ref:I,style:{...C,height:"80px",width:`${x$1+38}px`},children:jsxs(io,{width:x$1+30,isDragging:b,"data-testid":`preview-multi-img-${p}`,...j().inUp,sx:t,children:[jsx(a$2,{disableDrag:a$1,...d,...g}),e$1&&jsx(Pe,{file:e$1}),jsxs(ge,{flexGrow:1,sx:{width:"100%"},children:[jsx(a$3,{title:n,children:jsx(qe,{variant:"subtitle2",noWrap:!0,children:n})}),jsx(qe,{variant:"caption",sx:{color:"text.secondary"},children:l?"":e(s)})]}),jsx(Le,{children:r&&jsx(a,{size:"small",label:"Remover arquivo",onClick:()=>r(e$1),icon:"DELETE_MARK_BUTTON_02"})})]})})},bo=memo(Qo);var gr=({thumbnail:e,files:o,onRemove:r,onReorder:t,sx:a})=>{let s=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),n=useCallback(l=>{let{active:x,over:d}=l;if(!(!x||!d||x.id===d.id)&&t){let g=o.findIndex(({id:E})=>E===x.id),I=o.findIndex(({id:E})=>E===d.id);g!==-1&&I!==-1&&t(g,I,o);}},[o,t]),p=jsx(AnimatePresence,{initial:!1,children:o.map(l=>jsx(bo,{sx:a,id:`preview-file-${l.id}`,file:l,onRemove:r,thumbnail:e,disableDrag:!t},`preview-file-${l.id}`))});return t?jsx(DndContext,{sensors:s,collisionDetection:closestCenter,onDragEnd:n,modifiers:[restrictToHorizontalAxis,restrictToParentElement,restrictToWindowEdges],children:jsx(SortableContext,{items:o.map(l=>l.id),strategy:horizontalListSortingStrategy,children:p})}):p},Fe=memo(gr);var Eo=forwardRef(({onLoading:e,aspectRatio:o,cropSize:r,...t},a)=>{let{maxWidth:s,maxHeight:n}=useMemo(()=>r&&typeof r=="object"?{maxWidth:r.width,maxHeight:r.height}:r&&typeof r=="number"?{maxWidth:r,maxHeight:r}:{maxWidth:"100%",maxHeight:"100%"},[r]);a$1(()=>{e?.(!0);}),useLayoutEffect(()=>{typeof a=="object"&&a?.current?e?.(!a.current.complete):e?.(!1);},[a,e]);function p(){e?.(!1);}return jsx(po,{...t,maxWidth:s,maxHeight:n,ref:a,aspectRatio:o,onLoad:p,onError:p})});Eo.displayName="LoadingPreviewImage";var Ao=Eo;var br=({file:e,aspectRatio:o=1,isUploading:r,isLoading:t,onLoading:a,cropSize:s,maxWidth:n,maxHeight:p})=>{let l=useRef(null),x=e?.name||"",d=e?.name||"",g=URL.createObjectURL(e);return x?jsxs(lo,{className:"single-file-preview-box",children:[jsx(Ao,{className:"single-file-preview-img",aspectRatio:o,cropSize:s,isLoading:t,isUploading:r,alt:d,src:g,ref:l,loading:"lazy",onLoading:a,onLoad:()=>a?.(!1),onError:()=>a?.(!1),maxWidth:n,maxHeight:p},`image-preview-${x}`),jsx(mo,{className:"single-file-preview-bg",alt:d,src:g,isLoading:t,isUploading:r})]}):null},Ze=memo(br);var Er=["pdf"],Ar=["txt"],Fr=["psd"],wr=["doc","docx"],Dr=["xls","xlsx"],Rr=["zip","rar","iso"],_r=["ai","eps"],Sr=["ppt","pptx"],Tr=["wav","aif","mp3","aac"],Or=["jpg","jpeg","gif","bmp","png","svg","webp"],Ur=["m4v","avi","mpg","mp4","webm"];function He(e){let o,r=wo(e);return Ar.includes(r)?o="txt":Rr.includes(r)?o="zip":Tr.includes(r)?o="audio":Or.includes(r)?o="image":Ur.includes(r)?o="video":wr.includes(r)?o="word":Dr.includes(r)?o="excel":Sr.includes(r)?o="powerpoint":Er.includes(r)?o="pdf":Fr.includes(r)?o="photoshop":_r.includes(r)?o="illustrator":e?.startsWith("http")?o="image":o=wo(e),o}function Do(e){let o;switch(He(e)){case"folder":o="IC_FOLDER";break;case"txt":o="IC_TXT";break;case"zip":o="IC_ZIP";break;case"audio":o="IC_AUDIO";break;case"video":o="IC_VIDEO";break;case"word":o="IC_WORD";break;case"excel":o="IC_EXCEL";break;case"powerpoint":o="IC_POWER_POINT";break;case"pdf":o="IC_PDF";break;case"photoshop":o="IC_PTS";break;case"illustrator":o="IC_AI";break;case"image":o="IC_IMG";break;default:o="IC_FILE";}return o}function wo(e){return e&&e.split(".").pop()||""}function qi(e){return e.split("/").pop()}var Ce={root:"mnl__file__thumbnail__root",img:"mnl__file__thumbnail__img",icon:"mnl__file__thumbnail__icon",removeBtn:"mnl__file__thumbnail__remove__button",downloadBtn:"mnl__file__thumbnail__download__button"},Pe=({sx:e,file:o,tooltip:r,onRemove:t,imageView:a,slotProps:s,onDownload:n,...p})=>{let l=URL.createObjectURL(o),x=o?.name||"",g=o.type.startsWith("image/")?"image":He(l),I=jsx(Ee,{component:"img",src:l,className:Ce.img,sx:{width:1,height:1,objectFit:"cover",borderRadius:"inherit",...s?.img}}),E=jsx(a$4,{icon:Do(g),sx:{width:32,height:32,flexShrink:0,...e}}),A=jsxs(ge,{component:"span",className:Ce.root,sx:{width:36,height:36,flexShrink:0,borderRadius:1.25,alignItems:"center",position:"relative",display:"inline-flex",justifyContent:"center",...e},...p,children:[g==="image"&&a?I:E,t&&jsx(Lr,{onClick:t,className:Ce.removeBtn,sx:s?.removeBtn,children:jsx(a$4,{icon:"CLOSE_MARK_BUTTON",width:24})}),n&&jsx(Go,{onClick:n,className:Ce.downloadBtn,sx:s?.downloadBtn,size:"small",children:jsx(a$4,{icon:"ARROW_DOWN_CICLE",width:12})})]});return r?jsx(kr,{arrow:!0,title:x,slotProps:{popper:{modifiers:[{name:"offset",options:{offset:[0,-12]}}]}},children:A}):A};var aa=e=>e.startsWith("image/"),Ro=(e,o=.8)=>new Promise((r,t)=>{let a=document.createElement("canvas"),s=a.getContext("2d"),n=new Image;n.onload=()=>{a.width=n.width,a.height=n.height,s?(s.drawImage(n,0,0),a.toBlob(p=>{if(p){let l=new File([p],e.name.replace(/\.[^/.]+$/,".webp"),{type:"image/webp",lastModified:Date.now()});r(l);}else t(new Error("Falha ao converter para WebP"));},"image/webp",o)):t(new Error("N\xE3o foi poss\xEDvel obter contexto do canvas"));},n.onerror=()=>t(new Error("Falha ao carregar imagem")),n.src=URL.createObjectURL(e);});var jr=({onFilesSelect:e$1,onFileSelect:o,onReorder:r,onRemove:t,uploadFiles:a,filesPreview:s,dropzoneOptions:n,enableCrop:p=!1,customAspectRatio:l,convertToWebp:x=!0,cropSize:d,maxFiles:g})=>{let{showErrorMessage:I}=a$8(),E=useMemo(()=>l||(d&&typeof d!="number"?d.width/d.height:1),[l,d]),[A,b]=useState([]),[C,M]=useState(!1),[c,F]=useState(null),[P,T]=useState(null),[U,O]=useState(""),[u,m]=useState(!1),[w,v]=useState([]),[y,R]=useState(0),[N,z]=useState(0),ee=f=>{if(f.length<1)return;let h=f[0];F(h),R(L=>L+1);let D=new FileReader;D.onload=()=>{O(D.result),M(!0);},D.readAsDataURL(h);},oe=(f,h)=>{T(h);},ae=async f=>!c||!P?null:new Promise(h=>{let D=document.createElement("canvas"),L=D.getContext("2d"),H=new Image;H.onload=async()=>{let{width:fe,height:we,x:De,y:Mo}=P,Co=Math.abs(E),Re=fe,_e=we;d&&typeof d=="object"?(Re=d.width,_e=d.height):d&&typeof d=="number"&&(Re=d,_e=d/Co),D.width=Re,D.height=_e,L?(L.drawImage(H,De,Mo,fe,we,0,0,Re,_e),D.toBlob(async Je=>{if(Je){let We=new File([Je],c.name,{type:c.type,lastModified:Date.now()});if(x)try{We=await Ro(We);}catch(ko){I(ko,"Erro ao converter para WebP");}let Qe=We;Qe.id=f,h(Qe);}else h(null);},"image/png")):h(null);},H.src=U;}),pe=async()=>{if(!(!c||!P||w.length===0)){m(!0);try{let f=w[0],h=await ae(f.id);if(h){let L=await a([h]);L&&(!e$1&&!o&&b(H=>[...H,...L]),e$1?.([...s||[],...L]),o?.(h));}M(!1),m(!1),O(""),F(null);let D=w.slice(1);v(D),ee(D);}catch(f){I(f,"Erro ao processar imagem"),m(!1);}}},de=()=>{M(!1),m(!1),O(""),F(null),v([]),R(0),z(0);},me=async f=>{if(f.length===0)return;let h=Object.keys(n?.accept||{}).some(L=>L.includes("image/")),D=A.length+f.length;if(g&&D>g){I(new Error(`M\xE1ximo de ${g} arquivos`),"Erro ao fazer upload");return}try{if(h&&p){let H=f.filter(fe=>fe.type.startsWith("image/")).map((fe,we)=>{let De=fe;return De.id=`temp-crop-${Date.now()}-${we}`,De});z(H.length),R(0),v(H),ee(H);}else {let L=await a(f);L&&(!e$1&&!o&&b(H=>[...H,...L]),e$1?.([...s||[],...L]),o?.(L[0]));}}catch(L){I(L,"Erro ao processar arquivos");}},ce=f=>{if(!f.length)return;let h=f[0]?.errors[0]?.code,D=n?.maxSize||3145728;I(h==="file-too-large"?new Error(`O arquivo excede o tamanho m\xE1ximo de ${e(D)}`):h==="file-invalid-type"?new Error("Formato de arquivo n\xE3o suportado"):f[0]?.errors[0]||new Error("Erro ao enviar arquivo"),"Erro ao fazer upload");},{getRootProps:W,getInputProps:V,isDragActive:K,isDragReject:re,fileRejections:G}=useDropzone({onDrop:me,onDropRejected:ce,...n}),i=f=>{if(!f){t||b([]),t?.(void 0);return}let h=A.filter(D=>D.id!==f.id);t||b(h),t?.(f);},j=(f,h,D)=>{r?.(f,h,D);},Z=useRef("");return useEffect(()=>{let f=s?.map(h=>h.id).join(",")||"";f!==Z.current&&(Z.current=f,b(s||[]));},[s]),{file:A?.[0],files:A,aspectRatio:E,dropzoneProps:{getRootProps:W,getInputProps:V,isDragActive:K,isDragReject:re,fileRejections:G},cropState:{cropModalOpen:C,imagePreview:U,cropLoading:u,setCropModalOpen:M,onCropInitialized:oe,handleCropSave:pe,handleCropCancel:de,currentImageIndex:y,totalPendingImages:N},setInitialFiles:b,handleRemove:i,handleReorder:j}},X=jr;var $e=(i=>(i.APPLICATION_OCTET_STREAM="application/octet-stream",i.IMAGE_JPEG="image/jpeg",i.IMAGE_JPG="image/jpg",i.IMAGE_PNG="image/png",i.IMAGE_GIF="image/gif",i.IMAGE_WEBP="image/webp",i.IMAGE_SVG="image/svg+xml",i.IMAGE_BMP="image/bmp",i.IMAGE_TIFF="image/tiff",i.IMAGE_ICO="image/x-icon",i.IMAGE_AVIF="image/avif",i.APPLICATION_PDF="application/pdf",i.TEXT_PLAIN="text/plain",i.TEXT_CSV="text/csv",i.APPLICATION_RTF="application/rtf",i.APPLICATION_MSWORD="application/msword",i.APPLICATION_DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",i.APPLICATION_MSEXCEL="application/vnd.ms-excel",i.APPLICATION_XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",i.APPLICATION_MSPOWERPOINT="application/vnd.ms-powerpoint",i.APPLICATION_PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",i.APPLICATION_ODT="application/vnd.oasis.opendocument.text",i.APPLICATION_ODS="application/vnd.oasis.opendocument.spreadsheet",i.APPLICATION_ODP="application/vnd.oasis.opendocument.presentation",i.APPLICATION_XML="application/xml",i.TEXT_XML="text/xml",i.TEXT_HTML="text/html",i.TEXT_CSS="text/css",i.APPLICATION_JSON="application/json",i.TEXT_JAVASCRIPT="text/javascript",i.APPLICATION_ZIP="application/zip",i.APPLICATION_GZIP="application/gzip",i.APPLICATION_RAR="application/vnd.rar",i.APPLICATION_7Z="application/x-7z-compressed",i.AUDIO_MPEG="audio/mpeg",i.AUDIO_WAV="audio/wav",i.AUDIO_OGG="audio/ogg",i.AUDIO_WEBM="audio/webm",i.AUDIO_AAC="audio/aac",i.VIDEO_MP4="video/mp4",i.VIDEO_MPEG="video/mpeg",i.VIDEO_OGG="video/ogg",i.VIDEO_WEBM="video/webm",i.VIDEO_QUICKTIME="video/quicktime",i))($e||{}),ke=(e=>(e["application/octet-stream"]="APPLICATION_OCTET_STREAM",e["image/jpeg"]="IMAGE_JPEG",e["image/jpg"]="IMAGE_JPG",e["image/png"]="IMAGE_PNG",e["image/gif"]="IMAGE_GIF",e["image/webp"]="IMAGE_WEBP",e["image/svg+xml"]="IMAGE_SVG",e["image/bmp"]="IMAGE_BMP",e["image/tiff"]="IMAGE_TIFF",e["image/x-icon"]="IMAGE_ICO",e["image/avif"]="IMAGE_AVIF",e["application/pdf"]="APPLICATION_PDF",e["text/plain"]="TEXT_PLAIN",e["text/csv"]="TEXT_CSV",e["application/rtf"]="APPLICATION_RTF",e["application/msword"]="APPLICATION_MSWORD",e["application/vnd.openxmlformats-officedocument.wordprocessingml.document"]="APPLICATION_DOCX",e["application/vnd.ms-excel"]="APPLICATION_MSEXCEL",e["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"]="APPLICATION_XLSX",e["application/vnd.ms-powerpoint"]="APPLICATION_MSPOWERPOINT",e["application/vnd.openxmlformats-officedocument.presentationml.presentation"]="APPLICATION_PPTX",e["application/vnd.oasis.opendocument.text"]="APPLICATION_ODT",e["application/vnd.oasis.opendocument.spreadsheet"]="APPLICATION_ODS",e["application/vnd.oasis.opendocument.presentation"]="APPLICATION_ODP",e["application/xml"]="APPLICATION_XML",e["text/xml"]="TEXT_XML",e["text/html"]="TEXT_HTML",e["text/css"]="TEXT_CSS",e["application/json"]="APPLICATION_JSON",e["text/javascript"]="TEXT_JAVASCRIPT",e["application/zip"]="APPLICATION_ZIP",e["application/gzip"]="APPLICATION_GZIP",e["application/vnd.rar"]="APPLICATION_RAR",e["application/x-7z-compressed"]="APPLICATION_7Z",e["audio/mpeg"]="AUDIO_MPEG",e["audio/wav"]="AUDIO_WAV",e["audio/ogg"]="AUDIO_OGG",e["audio/webm"]="AUDIO_WEBM",e["audio/aac"]="AUDIO_AAC",e["video/mp4"]="VIDEO_MP4",e["video/mpeg"]="VIDEO_MPEG",e["video/ogg"]="VIDEO_OGG",e["video/webm"]="VIDEO_WEBM",e["video/quicktime"]="VIDEO_QUICKTIME",e))(ke||{});var Xr=({createFilesMutation:e,filesDetails:o})=>{let{showErrorMessage:r,showSuccessMessage:t}=a$8(),[a,s]=useState(!1),[n,p]=useState(!1),[l,x]=useState(null),[d,g]=useState([]),I=useMemo(()=>d?.[0],[d]),E=n||a,A=useCallback(async c=>{if(!c.length){g([]),p(!1);return}p(!0);try{let P=(await Promise.all(c.map(async({url:T,id:U,name:O})=>{try{if(!T)return null;let u=await fetch(T);if(!u.ok)throw new Error(u.statusText);let m=await u.blob(),w=null;if(!O){let R=u.headers.get("content-disposition")||void 0;if(R){let N=R.match(/filename\*=UTF-8''([^;]+)|filename="?([^";]+)"?/i),z=N?.[1]||N?.[2];if(z)try{w=decodeURIComponent(z);}catch{w=z;}}}let v=w||O||U,y=new File([m],v,{type:m.type});return y.id=U,y.url=T,y}catch{return null}}))).filter(Boolean);g(P),p(!1);}catch(F){r(F,"Erro ao carregar arquivos"),g([]),p(!1);}},[r]),b=useRef("");useEffect(()=>{let c=o?.map(({id:F})=>F).join(",")||"";c!==b.current&&o?.length&&(async()=>(b.current=c,await A(o)))();},[o,A]);let C=async c=>{if(!c||!Array.isArray(c))throw new Error("Arquivos inv\xE1lidos");let F=c.filter(P=>P instanceof File);if(F?.length){s(!0);try{let P=F.map(u=>{let m=u.type||"application/octet-stream",w=ke[m];if(!w)throw new Error(`Tipo de arquivo n\xE3o suportado: ${m}`);return {file:u,mimeType:m,contentTypeEnum:w}}),T=await e({files:P.map(({file:u,contentTypeEnum:m})=>({content_type:m,name:u.name}))}).unwrap(),U=T.files.map((u,m)=>{let v=P[m].file;return v.id=u.id,v.url=u.url,v});return (await Promise.all(T.files.map((u,m)=>{let{mimeType:w}=P[m],v=U[m];return fetch(u.url,{method:"PUT",headers:{"Content-Type":w,"Content-Disposition":`inline; filename="${v.name}"`,"X-File-Id":u.id},body:v})}))).forEach(u=>{if(!u.ok)throw new Error(`Erro no upload: ${u.statusText}`)}),t("Imagem adicionada com sucesso"),U}catch(P){throw x(P),r(P,"Erro no upload"),P}finally{s(!1);}}},M=useMemo(()=>l&&l instanceof Error?l.message:l,[l]);return {setFilesPreview:g,uploadFiles:C,filesPreview:d,filePreview:I,isLoadingPreview:n,isUploadingFiles:a,isUploadOrLoadingFiles:E,uploadErrorText:M}},q=Xr;var Vr=({sx:e,id:o,name:r,tabIndex:t,uploading:a,getRootProps:s,getInputProps:n,isDragActive:p,isError:l,disabled:x,dropZoneSxProps:d,dropZoneContent:g,children:I,...E})=>jsxs(ye,{children:[a&&jsx(a$7,{"data-testid":"uploading-progress-bar",sx:{zIndex:1}}),jsxs(Ee,{sx:{width:1,position:"relative",...e},children:[jsxs(ro,{...s(),"data-testid":"drop-zone-styled-area",isError:l,isDragActive:p,disabled:!!x,sx:d,...E,children:[jsx("input",{...n(),id:o,tabIndex:t,name:r}),g]}),I]})]}),ne=Vr;var Qr=({header:e,description:o,sx:r,...t})=>jsxs(ge,{spacing:5,alignItems:"center",justifyContent:"center",direction:{xs:"column",md:"row"},sx:{width:1,textAlign:{xs:"center",md:"left"},...r},...t,children:[jsx(a$5,{sx:{width:220}}),jsxs("div",{children:[jsx(qe,{gutterBottom:!0,variant:"h5",children:e||"Soltar ou selecionar arquivos"}),jsx(qe,{variant:"body2",sx:{color:"text.secondary"},children:o||jsxs(Fragment,{children:["Solte os arquivos aqui ou clique",jsx(qe,{variant:"body2",component:"span",sx:{mx:.5,color:"primary.main",textDecoration:"underline"},children:"procurar"}),"na sua m\xE1quina"]})})]})]}),se=memo(Qr);var tt=({onRemove:e,onReorder:o,onFilesSelect:r,createFilesMutation:t,filesDetails:a=[],id:s,disabled:n,error:p,helperText:l,thumbnail:x,dropZoneSxProps:d,uploading:g,tabIndex:I,maxFiles:E,placeholderAlt:A,placeholderProps:b,...C})=>{let{filesPreview:M,isUploadOrLoadingFiles:c,uploadErrorText:F,uploadFiles:P}=q({createFilesMutation:t,filesDetails:a}),{files:T,dropzoneProps:U,handleRemove:O,handleReorder:u}=X({onFilesSelect:r,onReorder:o,onRemove:e,filesPreview:M,dropzoneOptions:{multiple:!0,disabled:n,...C},maxFiles:E,uploadFiles:P}),{getRootProps:m,getInputProps:w,isDragActive:v,isDragReject:y}=U,R=!!T?.filter(z=>!!z.id).length,N=y||!!p||!!F;return jsxs(ne,{id:s,uploading:g||c,disabled:n,dropZoneSxProps:d,tabIndex:I,getRootProps:m,getInputProps:w,isDragActive:v,isError:N,dropZoneContent:jsx(Fragment,{children:A?jsx(ge,{children:A}):jsx(se,{header:b?.header,description:b?.description})}),children:[jsx(_,{disabled:n,helperText:l,isError:N}),p?jsx(_,{helperText:p,isError:!0}):null,F?jsx(_,{helperText:F,isError:!0}):null,R&&jsx(Ee,{sx:{my:3},children:jsx(Fe,{files:T,thumbnail:!!x,onRemove:e?O:void 0,onReorder:o?u:void 0})})]})},it=memo(tt);var mt=({onRemove:e,onReorder:o,onFilesSelect:r,createFilesMutation:t,filesDetails:a=[],id:s,disabled:n,error:p,helperText:l,dropZoneSxProps:x,placeholderProps:d,placeholderAlt:g,uploading:I,tabIndex:E,maxFiles:A,aspectRatio:b,enableCrop:C=!0,convertToWebp:M=!0,cropSize:c,name:F,label:P,...T})=>{let{filesPreview:U,isUploadOrLoadingFiles:O,uploadErrorText:u,uploadFiles:m}=q({createFilesMutation:t,filesDetails:a}),w=I||O,{files:v,dropzoneProps:y,cropState:R,aspectRatio:N,handleRemove:z,handleReorder:ee}=X({onFilesSelect:r,onReorder:o,onRemove:e,filesPreview:U,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!0,disabled:n,...T},enableCrop:C,customAspectRatio:b,convertToWebp:M,maxFiles:A,cropSize:c,uploadFiles:m}),{getRootProps:oe,getInputProps:ae,isDragActive:pe,isDragReject:de}=y,{cropModalOpen:me,imagePreview:ce,cropLoading:W,onCropInitialized:V,handleCropSave:K,handleCropCancel:re,currentImageIndex:G,totalPendingImages:i}=R,j=!!v?.filter(h=>!!h.id).length,Z=de||!!p||!!u,f=useMemo(()=>{let h=P??"Ajustar Imagem",D=i>1||G>1?` (${G} de ${i})`:"";return `${h}${D}`},[P,i,G]);return jsxs(ne,{id:s,name:F,uploading:w,disabled:n,dropZoneSxProps:x,tabIndex:E,getRootProps:oe,getInputProps:ae,isDragActive:pe,isError:Z,dropZoneContent:jsx(Fragment,{children:g?jsx(ge,{children:g}):jsx(se,{header:d?.header,description:d?.description})}),children:[jsx(_,{disabled:n,helperText:l,isError:Z}),p?jsx(_,{helperText:p,isError:!0}):null,u?jsx(_,{helperText:u,isError:!0}):null,j&&jsx(Ee,{sx:{my:3,ml:.5},children:jsx(Fe,{files:v,thumbnail:!0,onRemove:z,onReorder:o?ee:void 0})}),jsx(a$6,{open:me,onClose:re,label:f,imageSrc:ce,aspectRatio:N,onInitialized:V,onSave:K,loading:W,cropSize:c})]})},ct=memo(mt);var It=({onFileSelect:e$1,onRemove:o,createFilesMutation:r,fileDetails:t,id:a,disabled:s,error:n,helperText:p,sx:l,dropZoneSxProps:x,uploading:d,tabIndex:g,...I})=>{let{filesPreview:E,isUploadOrLoadingFiles:A,uploadErrorText:b,uploadFiles:C}=q({createFilesMutation:r,filesDetails:t?[t]:[]}),M=A||d,{file:c,dropzoneProps:F,handleRemove:P}=X({uploadFiles:C,onFileSelect:e$1,onRemove:o,filesPreview:E,dropzoneOptions:{multiple:!1,disabled:s,...I}}),{getRootProps:T,getInputProps:U,isDragActive:O,isDragReject:u}=F,m$1=useCallback(R=>{R.stopPropagation(),P(c||void 0);},[c,P]),w=!!c,v=typeof c=="string",y=u||!!n||!!b;return jsxs(ne,{id:a,uploading:M,disabled:s,dropZoneSxProps:x,tabIndex:g,getRootProps:T,getInputProps:U,isDragActive:O,isError:y,dropZoneContent:jsxs(Fragment,{children:[!w&&jsx(se,{}),w&&jsxs(ge,{component:m.div,...j().inUp,spacing:2,direction:"row",alignItems:"center",sx:{my:1,px:1,py:.75,borderRadius:.75,border:R=>`solid 1px ${R.palette.divider}`,...l},children:[jsx(Pe,{file:c}),jsxs(ge,{flexGrow:1,sx:{minWidth:0},children:[jsx(qe,{variant:"subtitle2",noWrap:!0,children:v?c:c.name}),jsx(qe,{variant:"caption",sx:{color:"text.secondary"},children:v?"":e(c.size)})]}),o&&jsx(a$3,{title:"Remover arquivo",children:jsx(to,{edge:"end",size:"small",disabled:s,"aria-label":"Remover arquivo",onClick:m$1,children:jsx(a$4,{icon:"DELETE_MARK_BUTTON_02",width:16})})})]})]}),children:[jsx(_,{disabled:s,helperText:p,isError:y}),n?jsx(_,{helperText:n,isError:!0}):null,b?jsx(_,{helperText:b,isError:!0}):null]})},Pt=memo(It);var Dt=({onRemove:e,onFileSelect:o,createFilesMutation:r,fileDetails:t,id:a,disabled:s,error:n,helperText:p,dropZoneSxProps:l,placeholderProps:x,placeholderAlt:d,uploading:g,tabIndex:I,aspectRatio:E,enableCrop:A=!0,convertToWebp:b=!0,name:C,label:M,cropSize:c,sx:F,maxWidth:P,maxHeight:T,...U})=>{let{filesPreview:O,isUploadOrLoadingFiles:u,uploadErrorText:m,uploadFiles:w}=q({createFilesMutation:r,filesDetails:t?[t]:[]}),[v,y]=useState(!1),{file:R,dropzoneProps:N,cropState:z,handleRemove:ee,aspectRatio:oe}=X({onFileSelect:o,onRemove:e,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:s,...U},filesPreview:O,enableCrop:A,customAspectRatio:E,convertToWebp:b,cropSize:c,uploadFiles:w}),{getRootProps:ae,getInputProps:pe,isDragActive:de,isDragReject:me}=N,{cropModalOpen:ce,imagePreview:W,cropLoading:V,onCropInitialized:K,handleCropSave:re,handleCropCancel:G}=z,i=useCallback(()=>{ee(R||void 0);},[R,ee]),j=!!R,Z=me||!!n||!!m,f=g||u,h=j?{opacity:0}:{opacity:1},D=l?.width;return useEffect(()=>{j||y(!1);},[j]),jsxs(ye,{sx:{...F,...D&&{width:D}},children:[(f||v)&&jsx(a$7,{}),jsxs(ne,{id:a,uploading:f,disabled:s,dropZoneSxProps:l,tabIndex:I,getRootProps:ae,getInputProps:pe,isDragActive:de,isError:Z,name:C,dropZoneContent:jsxs(Fragment,{children:[d?jsx(ge,{sx:h,children:d}):jsx(se,{sx:h,header:x?.title,description:x?.description}),j&&jsx(Ze,{file:R,cropSize:c,isLoading:v,isUploading:f,onLoading:y,aspectRatio:oe,maxWidth:P,maxHeight:T})]}),children:[jsx(_,{disabled:s,helperText:p,isError:Z}),n?jsx(_,{helperText:n,isError:!0}):null,m?jsx(_,{helperText:m,isError:!0}):null,j&&e&&jsx(no,{size:"small",onClick:i,disabled:s,label:"Remover arquivo",children:jsx(a$4,{icon:"DELETE_MARK_BUTTON_02",width:16})}),jsx(a$6,{open:ce,onClose:G,label:M??"Ajustar Imagem",imageSrc:W,aspectRatio:oe,onInitialized:K,onSave:re,loading:V,cropSize:c})]})]})},Rt=memo(Dt);var Lt=({onRemove:e,onFileSelect:o,createFilesMutation:r,fileDetails:t,disabled:a,label:s,id:n,tabIndex:p,error:l,helperText:x,sx:d,name:g,maxSize:I,uploading:E,aspectRatio:A=1,enableCrop:b=!0,convertToWebp:C=!0,cropSize:M,...c})=>{let[F,P]=useState(!1),{filesPreview:T,isUploadOrLoadingFiles:U,uploadErrorText:O,uploadFiles:u}=q({createFilesMutation:r,filesDetails:t?[t]:[]}),{file:m,dropzoneProps:w,cropState:v,handleRemove:y}=X({filesPreview:T,onFileSelect:o,onRemove:e,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:a,maxSize:I,...c},enableCrop:b,customAspectRatio:A,convertToWebp:C,cropSize:M,uploadFiles:u}),{getRootProps:R,getInputProps:N,isDragActive:z,isDragReject:ee}=w,{cropModalOpen:oe,imagePreview:ae,cropLoading:pe,onCropInitialized:de,handleCropSave:me,handleCropCancel:ce}=v,W=ee||!!l||!!O,V=F||U||E,K=!!e,re=useRef(t?.url||""),G=useRef();useEffect(()=>{if(!m){re.current="",G.current=void 0;return}if(G.current===m.id)return;G.current=m.id,P(!0);let Z=URL.createObjectURL(m);return re.current=Z,()=>{URL.revokeObjectURL(Z);}},[m]);let i=()=>{P(!1);},j=useCallback(()=>K&&m?()=>y(m):R().onClick,[K,m,R,y]);return jsxs(Fragment,{children:[jsxs(ge,{sx:{alignItems:"center"},children:[jsxs(uo,{sx:d,isError:W,isDragActive:z,hasFile:!!m,...R(),onClick:j(),children:[jsxs(co,{children:[V&&jsx(go,{children:jsx(yt,{size:135,thickness:2,color:"primary"})}),m&&jsx(fo,{alt:"Avatar Preview",src:re.current,onLoad:i,...V&&{sx:{filter:"blur(5px) !important",scale:1.2,opacity:.7}}}),!m&&!V&&jsxs(je,{isError:W,hasFile:!1,children:[jsx(a$4,{icon:"ADD_IMAGE",width:32}),jsx(qe,{variant:"caption",textAlign:"center",sx:{color:W?"error.main":"text.disabled"},children:"Adicionar foto"})]}),m&&!V&&jsxs(je,{isError:W,hasFile:!0,children:[jsx(a$4,{icon:K?"DELETE_MARK_BUTTON_02":"ADD_IMAGE",width:32}),jsx(qe,{variant:"caption",textAlign:"center",sx:{color:W?"error.main":"common.white"},children:K?"Remover foto":"Alterar foto"})]})]}),jsx("input",{name:g,id:n,tabIndex:p,...N()})]}),jsx(ge,{sx:{alignItems:"center",mt:-.5},children:jsx(_,{helperText:x,disabled:a,isError:W})}),O?jsx(_,{helperText:O,isError:!0}):null,l?jsx(_,{helperText:l,isError:!0}):null]}),oe&&ae&&jsx(a$6,{open:oe,onClose:ce,label:s??"Ajustar Imagem",imageSrc:ae,aspectRatio:A,onInitialized:de,onSave:me,loading:pe,cropSize:M,cropShape:"round"})]})},Mt=memo(Lt);var Nt=({error:e,name:o,disabled:r,sx:t,...a})=>{let{getRootProps:s,getInputProps:n,isDragActive:p,isDragReject:l}=useDropzone({disabled:r,...a}),x=l||e;return jsxs(so,{...s(),isDragActive:p,hasError:!!x,disabled:!!r,sx:t,"data-testid":"upload-box",children:[jsx("input",{name:o,...n()}),"Selecionar arquivo"]})},Bt=memo(Nt);
|
|
36
37
|
|
|
37
|
-
export {
|
|
38
|
+
export { $e as ContentType, ke as FileContentType, Pe as FileThumbnail, _ as HelperText, Fe as MultiFilePreview, it as MultipleFileUpload, ct as MultipleImageUpload, Ze as SingleFilePreview, Pt as SingleFileUpload, Rt as SingleImageUpload, Mt as UploadAvatar, Bt as UploadSimpleBox, Ro as convertToWebP, He as fileFormat, qi as fileNameByUrl, Do as fileThumb, Ce as fileThumbnailClasses, wo as fileTypeByUrl, aa as isImageFile, X as useDropzoneUploader, q as useFileUploadService };
|
|
@@ -2,8 +2,8 @@ import { b } from '../../../chunk-RBHRP2UE.js';
|
|
|
2
2
|
import '../../../chunk-ISYQXE75.js';
|
|
3
3
|
import '../../../chunk-2E4HVMRH.js';
|
|
4
4
|
import '../../../chunk-T7I256S6.js';
|
|
5
|
-
import '../../../chunk-5NOG7L7I.js';
|
|
6
5
|
import '../../../chunk-ANAHA3L6.js';
|
|
6
|
+
import '../../../chunk-5NOG7L7I.js';
|
|
7
7
|
import '../../../chunk-D27ND54J.js';
|
|
8
8
|
import '../../../chunk-X24QANPC.js';
|
|
9
9
|
import '../../../chunk-MAK4JF5M.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { e } from '../../../chunk-
|
|
1
|
+
import { e } from '../../../chunk-U6T4WE7C.js';
|
|
2
2
|
import '../../../chunk-ISYQXE75.js';
|
|
3
3
|
import '../../../chunk-2E4HVMRH.js';
|
|
4
4
|
import '../../../chunk-T7I256S6.js';
|
|
5
5
|
import '../../../chunk-H5L4ARDB.js';
|
|
6
|
-
import '../../../chunk-5NOG7L7I.js';
|
|
7
6
|
import '../../../chunk-ANAHA3L6.js';
|
|
7
|
+
import '../../../chunk-5NOG7L7I.js';
|
|
8
8
|
import '../../../chunk-JEBRSFLS.js';
|
|
9
9
|
import '../../../chunk-2P4CXK3O.js';
|
|
10
10
|
import '../../../chunk-FK7DDO5L.js';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { a as UploadAvatar, b as UploadAvatarWithCrop } from '../../chunk-RBHRP2UE.js';
|
|
2
|
-
export { c as DeleteButton, a as MultiFilePreview, b as SingleFilePreview, d as Upload, e as UploadWithCrop } from '../../chunk-
|
|
2
|
+
export { c as DeleteButton, a as MultiFilePreview, b as SingleFilePreview, d as Upload, e as UploadWithCrop } from '../../chunk-U6T4WE7C.js';
|
|
3
3
|
import { o } from '../../chunk-ISYQXE75.js';
|
|
4
4
|
export { p as RejectionFiles } from '../../chunk-ISYQXE75.js';
|
|
5
5
|
import '../../chunk-2E4HVMRH.js';
|
|
6
6
|
import '../../chunk-T7I256S6.js';
|
|
7
7
|
import '../../chunk-H5L4ARDB.js';
|
|
8
|
-
import '../../chunk-5NOG7L7I.js';
|
|
9
8
|
import '../../chunk-ANAHA3L6.js';
|
|
9
|
+
import '../../chunk-5NOG7L7I.js';
|
|
10
10
|
import '../../chunk-JEBRSFLS.js';
|
|
11
11
|
import '../../chunk-2P4CXK3O.js';
|
|
12
12
|
import '../../chunk-FK7DDO5L.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as default } from '../chunk-
|
|
1
|
+
export { a as default } from '../chunk-GFJT57TO.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zydon/common",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.19",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"test:coverage": "jest --coverage",
|
|
22
22
|
"test:watch": "jest --watch --collectCoverage=false",
|
|
23
23
|
"build": "tsup",
|
|
24
|
+
"build:watch": "tsup --watch",
|
|
24
25
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
25
26
|
"lint:fix": "eslint --fix src/**/*.{jsx,ts,tsx}",
|
|
26
27
|
"format": "prettier --write \"**/*.*\""
|
|
@@ -89,7 +90,7 @@
|
|
|
89
90
|
"@testing-library/react": "^16.1.0",
|
|
90
91
|
"@testing-library/user-event": "14.5.2",
|
|
91
92
|
"@types/color": "^3.0.6",
|
|
92
|
-
"@types/jest": "^
|
|
93
|
+
"@types/jest": "^30.0.0",
|
|
93
94
|
"@types/lodash": "^4.17.7",
|
|
94
95
|
"@types/react": "^18.3.4",
|
|
95
96
|
"@types/react-color": "^3.0.13",
|
|
@@ -110,6 +111,7 @@
|
|
|
110
111
|
"jest": "^29.7.0",
|
|
111
112
|
"jest-environment-jsdom": "^29.7.0",
|
|
112
113
|
"jest-junit": "^16.0.0",
|
|
114
|
+
"jest-util": "^30.0.5",
|
|
113
115
|
"postcss": "^8.4.41",
|
|
114
116
|
"postcss-import": "^16.1.0",
|
|
115
117
|
"prettier": "^3.0.2",
|
package/dist/chunk-7TFD7ZIP.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { useRef, useState, useEffect, useMemo } from 'react';
|
|
2
|
-
import P from 'react-easy-crop';
|
|
3
|
-
import v from '@mui/material/Stack';
|
|
4
|
-
import { styled, alpha } from '@mui/material/styles';
|
|
5
|
-
import { jsx } from 'react/jsx-runtime';
|
|
6
|
-
|
|
7
|
-
var l=styled(v)(({theme:n})=>({"& .reactEasyCrop_Container":{position:"relative"},"& .reactEasyCrop_CropArea":{border:`2px solid ${n.palette.primary.main}`,borderColor:alpha(n.palette.primary.main,.75)},"& .reactEasyCrop_CropAreaRound":{border:`2px solid ${n.palette.primary.main}`,borderColor:alpha(n.palette.primary.main,.75)}}));var W=({onInitialized:n,aspectRatio:i=1,imageSrc:C="",zoom:f=1,crop:c,cropShape:h="rect",cropSize:o,rotation:u=0,onZoomChange:a,onCropChange:y,onRotationChange:g})=>{let b=r=>{if(r>4){a(4);return}if(r<.1){a(.1);return}a(r);},p=useRef(null),[e,w]=useState(550);useEffect(()=>{let r=()=>{let t=p.current?.clientWidth||550;w(Math.min(t,550));};return r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]);let E=useMemo(()=>{let r=typeof o=="number"?o:o?.width,t=typeof o=="number"?o:o?.height;if(r=r||e,t=t||e,r<=e&&t<=e)return {width:r,height:t};let m=i>1;return r=m?e:e*i,t=m?e/i:e,{width:r,height:t}},[i,e,o]);return jsx(l,{ref:p,children:jsx(P,{image:C,crop:c,zoom:f,aspect:i,onCropChange:y,onZoomChange:b,onCropComplete:n,restrictPosition:!1,cropSize:E,cropShape:h,zoomWithScroll:!1,objectFit:"contain",minZoom:.1,maxZoom:4,style:{containerStyle:{width:e,height:e,position:"relative"}},rotation:u,onRotationChange:g})})},D=W;
|
|
8
|
-
|
|
9
|
-
export { D as a };
|
package/dist/chunk-EUL6EPCK.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { a } from './chunk-MAK4JF5M.js';
|
|
2
|
-
import y from '@mui/material/Box';
|
|
3
|
-
import v from '@mui/material/ButtonBase';
|
|
4
|
-
import P from '@mui/material/IconButton';
|
|
5
|
-
import L from '@mui/material/Stack';
|
|
6
|
-
import D from '@mui/material/Tooltip';
|
|
7
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
|
-
|
|
9
|
-
var g=["pdf"],x=["txt"],R=["psd"],C=["doc","docx"],F=["xls","xlsx"],k=["zip","rar","iso"],w=["ai","eps"],A=["ppt","pptx"],B=["wav","aif","mp3","aac"],E=["jpg","jpeg","gif","bmp","png","svg","webp"],M=["m4v","avi","mpg","mp4","webm"];function l(t){let e,o=u(t);return x.includes(o)?e="txt":k.includes(o)?e="zip":B.includes(o)?e="audio":E.includes(o)?e="image":M.includes(o)?e="video":C.includes(o)?e="word":F.includes(o)?e="excel":A.includes(o)?e="powerpoint":g.includes(o)?e="pdf":R.includes(o)?e="photoshop":w.includes(o)?e="illustrator":t?.startsWith("http")?e="image":e=u(t),e}function d(t){let e;switch(l(t)){case"folder":e="IC_FOLDER";break;case"txt":e="IC_TXT";break;case"zip":e="IC_ZIP";break;case"audio":e="IC_AUDIO";break;case"video":e="IC_VIDEO";break;case"word":e="IC_WORD";break;case"excel":e="IC_EXCEL";break;case"powerpoint":e="IC_POWER_POINT";break;case"pdf":e="IC_PDF";break;case"photoshop":e="IC_PTS";break;case"illustrator":e="IC_AI";break;case"image":e="IC_IMG";break;default:e="IC_FILE";}return e}function u(t){return t&&t.split(".").pop()||""}function W(t){return t.split("/").pop()}var r={root:"mnl__file__thumbnail__root",img:"mnl__file__thumbnail__img",icon:"mnl__file__thumbnail__icon",removeBtn:"mnl__file__thumbnail__remove__button",downloadBtn:"mnl__file__thumbnail__download__button"},K=({sx:t,file:e,tooltip:o,onRemove:c,imageView:I,slotProps:a$1,onDownload:m,...h})=>{let n=e?.url,p=n||URL.createObjectURL(e),b=e?.name||n?.split("/").pop()||"",_=e.type.startsWith("image/")?"image":l(n||p),T=jsx(y,{component:"img",src:p,className:r.img,sx:{width:1,height:1,objectFit:"cover",borderRadius:"inherit",...a$1?.img}}),O=jsx(a,{icon:d(_),sx:{width:32,height:32,flexShrink:0,...t}}),f=jsxs(L,{component:"span",className:r.root,sx:{width:36,height:36,flexShrink:0,borderRadius:1.25,alignItems:"center",position:"relative",display:"inline-flex",justifyContent:"center",...t},...h,children:[_==="image"&&I?T:O,c&&jsx(v,{onClick:c,className:r.removeBtn,sx:a$1?.removeBtn,children:jsx(a,{icon:"CLOSE_MARK_BUTTON",width:24})}),m&&jsx(P,{onClick:m,className:r.downloadBtn,sx:a$1?.downloadBtn,size:"small",children:jsx(a,{icon:"ARROW_DOWN_CICLE",width:12})})]});return o?jsx(D,{arrow:!0,title:b,slotProps:{popper:{modifiers:[{name:"offset",options:{offset:[0,-12]}}]}},children:f}):f};
|
|
10
|
-
|
|
11
|
-
export { l as a, d as b, u as c, W as d, r as e, K as f };
|
package/dist/chunk-ONZBWH3C.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { toast } from 'sonner';
|
|
2
|
-
|
|
3
|
-
var c=()=>({showSuccessMessage:a=>{toast.success(a);},showErrorMessage:(a,n)=>{toast.error(i(a,n));}}),o=c,i=(s,t)=>{try{return "message"in s?s.message||t:"data"in s&&s.data&&typeof s.data=="object"&&"message"in s.data&&typeof s.data.message=="string"?s.data.message:t}catch{return t}};
|
|
4
|
-
|
|
5
|
-
export { o as a };
|
package/dist/chunk-XAJTYCRG.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { c, g, p, n, d, e as e$1, a as a$6, b, h, i as i$1, l, m as m$1, j as j$1, k } from './chunk-ISYQXE75.js';
|
|
2
|
-
import { a as a$5 } from './chunk-2E4HVMRH.js';
|
|
3
|
-
import { a as a$1 } from './chunk-H5L4ARDB.js';
|
|
4
|
-
import { e } from './chunk-ANAHA3L6.js';
|
|
5
|
-
import { a as a$7 } from './chunk-JEBRSFLS.js';
|
|
6
|
-
import { x } from './chunk-2P4CXK3O.js';
|
|
7
|
-
import { a as a$4 } from './chunk-FK7DDO5L.js';
|
|
8
|
-
import { i, o } from './chunk-D27ND54J.js';
|
|
9
|
-
import { a as a$2 } from './chunk-X24QANPC.js';
|
|
10
|
-
import { j } from './chunk-DMQW3LDF.js';
|
|
11
|
-
import { a } from './chunk-MAK4JF5M.js';
|
|
12
|
-
import { a as a$3 } from './chunk-KFZEM7KS.js';
|
|
13
|
-
import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter } from '@dnd-kit/core';
|
|
14
|
-
import { restrictToHorizontalAxis, restrictToParentElement, restrictToWindowEdges } from '@dnd-kit/modifiers';
|
|
15
|
-
import { sortableKeyboardCoordinates, SortableContext, horizontalListSortingStrategy, useSortable } from '@dnd-kit/sortable';
|
|
16
|
-
import { AnimatePresence, m } from 'framer-motion';
|
|
17
|
-
import Ho from '@mui/material/ButtonBase';
|
|
18
|
-
import Go from '@mui/material/IconButton';
|
|
19
|
-
import { styled, alpha, useTheme } from '@mui/material/styles';
|
|
20
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
21
|
-
import No from '@mui/material/Box';
|
|
22
|
-
import G from '@mui/material/Stack';
|
|
23
|
-
import Qo from '@mui/material/Tooltip';
|
|
24
|
-
import ro from '@mui/material/Typography';
|
|
25
|
-
import Yo from '@mui/material/Badge';
|
|
26
|
-
import { useDropzone } from 'react-dropzone';
|
|
27
|
-
import Wo from '@mui/material/Button';
|
|
28
|
-
import _t from '@mui/material/FormHelperText';
|
|
29
|
-
import { memo } from 'react';
|
|
30
|
-
import Et from '@mui/material/Dialog';
|
|
31
|
-
|
|
32
|
-
function To({sx:o$1,...t}){let r=useTheme();return jsx(Ho,{sx:{p:0,top:0,right:0,width:1,height:1,zIndex:9,opacity:0,position:"absolute",color:"common.white",borderRadius:"inherit",transition:r.transitions.create(["opacity"]),"&:hover":{...o({color:i(r.vars.palette.grey["900Channel"],.64)}),opacity:1},...o$1},...t,children:jsx(a,{icon:"ARROW_DOWN_CICLE",width:24})})}function Eo({sx:o,...t}){return jsx(Go,{size:"small",sx:{p:.35,top:4,right:4,position:"absolute",color:"common.white",bgcolor:r=>i(r.vars.palette.grey["900Channel"],.48),"&:hover":{bgcolor:r=>i(r.vars.palette.grey["900Channel"],.72)},...o},...t,children:jsx(a,{icon:"CLOSE_MARK_BUTTON",width:12})})}var A={root:"mnl__file__thumbnail__root",img:"mnl__file__thumbnail__img",icon:"mnl__file__thumbnail__icon",removeBtn:"mnl__file__thumbnail__remove__button",downloadBtn:"mnl__file__thumbnail__download__button"};function F({sx:o,file:t,tooltip:r,onRemove:i,imageView:m,slotProps:e,onDownload:p,...l}){let u=typeof t=="string"?t:URL.createObjectURL(t),{name:d,path:a$1}=c(t),n=a$6(a$1||u),g=jsx(No,{component:"img",src:u,className:A.img,sx:{width:1,height:1,objectFit:"cover",borderRadius:"inherit",...e?.img}}),h=jsx(a,{icon:b(n),sx:{width:32,height:32,flexShrink:0,...o}}),f=jsxs(G,{component:"span",className:A.root,sx:{width:36,height:36,flexShrink:0,borderRadius:1.25,alignItems:"center",position:"relative",display:"inline-flex",justifyContent:"center",...o},...l,children:[n==="image"&&m?g:h,i&&jsx(Eo,{onClick:i,className:A.removeBtn,sx:e?.removeBtn}),p&&jsx(To,{onClick:p,className:A.downloadBtn,sx:e?.downloadBtn})]});return r?jsx(Qo,{arrow:!0,title:d,slotProps:{popper:{modifiers:[{name:"offset",options:{offset:[0,-12]}}]}},children:f}):f}var ot=({onRemove:o,onHandleMainImage:t,key:r,sx:i,file:m,disableDrag:e,attributes:p,listeners:l,mainUrl:u,innerWidth:d,isDragging:a$1})=>{let n=m===u;return jsx(Yo,{anchorOrigin:{vertical:"top",horizontal:"left"},badgeContent:t&&jsx(m$1,{isMainImage:n,size:"small",onClick:()=>t(m),"aria-label":n?"Remover imagem principal":"Definir como imagem principal",children:jsx(a,{icon:n?"STAR_02":"STAR",width:12})}),children:jsxs(j$1,{width:d,isDragging:a$1,"data-testid":`preview-multi-img-${r}`,...j().inUp,sx:i,children:[jsx(a$7,{disableDrag:e,...p,...l}),jsx(F,{tooltip:!0,imageView:!0,file:m,sx:{position:"absolute",right:10,top:10}}),o&&jsx(k,{size:"small","aria-label":"Remover imagem",onClick:()=>o(m),children:jsx(a,{icon:"DELETE_MARK_BUTTON_02",width:16})})]})},`badge-${r}`)},Fo=ot;var it=({file:o,thumbnail:t,onRemove:r,onHandleMainImage:i,mainUrl:m,sx:e$1,disableDrag:p=!1})=>{let{key:l$1,name:u="",size:d=0}=c(o),a$1=typeof o=="string",n=p?60:80,{attributes:g,listeners:h$1,setNodeRef:f,transform:b,transition:v,isDragging:R}=useSortable({id:l$1,disabled:p}),S={transform:x.Transform.toString(b),transition:v,display:"inline-block",alignItems:"center",justifyContent:"center",width:`${n+8}px`,height:"68px"};return t?jsx(h,{ref:f,style:S,children:jsx(Fo,{innerWidth:n,isDragging:R,sx:e$1,file:o,disableDrag:p,attributes:g,listeners:h$1,mainUrl:m,onRemove:r,onHandleMainImage:i},l$1)}):jsx(h,{ref:f,style:{...S,height:"80px",width:`${n+38}px`},children:jsxs(i$1,{width:n+30,isDragging:R,"data-testid":`preview-multi-img-${l$1}`,...j().inUp,sx:e$1,children:[jsx(a$7,{disableDrag:p,...g,...h$1}),jsx(F,{file:o}),jsxs(G,{flexGrow:1,sx:{minWidth:0,width:"100%"},children:[jsx(ro,{variant:"subtitle2",noWrap:!0,children:a$1?o:u}),jsx(ro,{variant:"caption",sx:{color:"text.secondary"},children:a$1?"":e(d)})]}),r&&jsx(l,{size:"small","aria-label":"Remover arquivo",onClick:()=>r(o),children:jsx(a,{icon:"DELETE_MARK_BUTTON_02",width:16})})]})})},Ao=it;var to=({thumbnail:o,files:t,onRemove:r,onReorder:i,onHandleMainImage:m,mainUrl:e,sx:p})=>{let l=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates}));if(!t?.length)return null;let u=a=>{let{active:n,over:g}=a;if(!(!n||!g||n.id===g.id)&&i){let h=t.findIndex(b=>{let{key:v}=c(b);return v===n.id}),f=t.findIndex(b=>{let{key:v}=c(b);return v===g.id});h!==-1&&f!==-1&&i(h,f);}},d=jsx(AnimatePresence,{initial:!1,children:t.map(a=>jsx(Ao,{file:a,thumbnail:o,onRemove:r,onHandleMainImage:m,mainUrl:e,sx:p,disableDrag:!i},c(a).key))});return i?jsx(DndContext,{sensors:l,collisionDetection:closestCenter,onDragEnd:u,modifiers:[restrictToHorizontalAxis,restrictToParentElement,restrictToWindowEdges],children:jsx(SortableContext,{items:t.map(a=>c(a).key),strategy:horizontalListSortingStrategy,children:d})}):d};function Lo({file:o}){let t=typeof o=="string"?o:o.name,r=typeof o=="string"?o:URL.createObjectURL(o);return jsx(No,{sx:{p:1,top:0,left:0,width:1,height:1,position:"absolute"},children:jsx(No,{component:"img",alt:t,src:r,sx:{width:1,height:1,borderRadius:1,objectFit:"cover"}})})}function Er({sx:o,...t}){return jsx(Go,{size:"small",sx:{top:16,right:16,zIndex:9,position:"absolute",color:r=>i(r.vars.palette.common.whiteChannel,.8),bgcolor:r=>i(r.vars.palette.grey["900Channel"],.72),"&:hover":{bgcolor:r=>i(r.vars.palette.grey["900Channel"],.48)},...o},...t,"aria-label":"Remover arquivo",children:jsx(a,{icon:"DELETE_MARK_BUTTON_02",width:18})})}var xt=({header:o,description:t,sx:r,...i})=>jsxs(G,{spacing:5,alignItems:"center",justifyContent:"center",direction:{xs:"column",md:"row"},sx:{width:1,textAlign:{xs:"center",md:"left"},...r},...i,children:[jsx(a$1,{sx:{width:220}}),jsxs("div",{children:[jsx(ro,{gutterBottom:!0,variant:"h5",children:o||"Soltar ou selecionar arquivos"}),jsx(ro,{variant:"body2",sx:{color:"text.secondary"},children:t||jsxs(Fragment,{children:["Solte os arquivos aqui ou clique",jsx(ro,{variant:"body2",component:"span",sx:{mx:.5,color:"primary.main",textDecoration:"underline"},children:"procurar"}),"na sua m\xE1quina"]})})]})]}),io=memo(xt);var Mo=styled(No,{shouldForwardProp:o=>!["isDragActive","isError","disabled"].includes(o)})(({theme:o,isDragActive:t,isError:r,disabled:i})=>({outline:"none",cursor:"pointer",overflow:"hidden",position:"relative",padding:o.spacing(5),borderRadius:o.shape.borderRadius,transition:o.transitions.create("padding"),backgroundColor:o.palette.background.neutral,border:`1px dashed ${alpha(o.palette.grey[500],.32)}`,...t&&{opacity:.72},...r&&{color:o.palette.error.main,backgroundColor:o.palette.error.lighter,borderColor:o.palette.error.light},...i&&{opacity:.48,pointerEvents:"none"},"&:hover":{opacity:.72}}));var Rt=({sx:o,id:t,tabIndex:r,uploading:i,getRootProps:m,getInputProps:e,isDragActive:p,isError:l,disabled:u,dropZoneSxProps:d$1,dropZoneContent:a,children:n,...g})=>jsxs(d,{children:[i&&jsx(a$4,{"data-testid":"uploading-progress-bar"}),jsxs(No,{sx:{width:1,position:"relative",...o},children:[jsxs(Mo,{...m(),"data-testid":"drop-zone-styled-area",isError:l,isDragActive:p,disabled:!!u,sx:d$1,...g,children:[jsx("input",{...e(),id:t,tabIndex:r}),a]}),n]})]}),ao=Rt;var Tt=({id:o,disabled:t,multiple:r=!1,error:i,helperText:m$1,file:e$1,onDelete:p$1,files:l,thumbnail:u,onRemove:d,onHandleMainImage:a$1,mainUrl:n$1,sx:g$1,dropZoneProps:h,placeholderProps:f,placeholderAlt:b,uploading:v,image:R,tabIndex:S,preview:V="image",onRemoveAll:N,onUpload:w,onReorder:L,...J})=>{let{getRootProps:M,getInputProps:B,isDragActive:P,isDragReject:k,fileRejections:po}=useDropzone({multiple:r,disabled:t,...J}),Q=!!e$1&&!r,X=Q||R,mo=l&&r&&l.length>0,lo=typeof e$1=="string",co=k||!!i;if(V==="file")return jsxs(ao,{id:o,uploading:v,disabled:t,dropZoneSxProps:h,tabIndex:S,getRootProps:M,getInputProps:B,isDragActive:P,isError:co,dropZoneContent:jsxs(Fragment,{children:[!Q&&jsx(io,{}),Q&&jsxs(G,{component:m.div,...j().inUp,spacing:2,direction:"row",alignItems:"center",sx:{my:1,px:1,py:.75,borderRadius:.75,border:U=>`solid 1px ${U.palette.divider}`,...g$1},children:[jsx(F,{file:e$1}),jsxs(G,{flexGrow:1,sx:{minWidth:0},children:[jsx(ro,{variant:"subtitle2",noWrap:!0,children:lo?e$1:e$1.name}),jsx(ro,{variant:"caption",sx:{color:"text.secondary"},children:lo?"":e(e$1.size)})]}),p$1&&jsx(g,{edge:"end",size:"small",disabled:t,"aria-label":"Remover arquivo",onClick:U=>{U.stopPropagation(),p$1();},children:jsx(a,{icon:"DELETE_MARK_BUTTON_02",width:16})})]})]}),children:[m$1&&m$1,jsx(p,{files:po}),mo&&jsxs(Fragment,{children:[jsx(No,{sx:{my:3},children:jsx(to,{files:l,thumbnail:u,onRemove:d,onHandleMainImage:a$1,mainUrl:n$1,onReorder:L})}),jsxs(G,{direction:"row",justifyContent:"flex-end",spacing:1.5,children:[N&&jsx(Wo,{color:"inherit",variant:"outlined",size:"small",onClick:N,children:"Remover todos"}),w&&jsx(Wo,{size:"small",variant:"contained",onClick:w,children:"Enviar arquivos"})]})]})]});let go=X?{opacity:0}:void 0;return jsxs(ao,{id:o,uploading:v,disabled:t,dropZoneSxProps:h,tabIndex:S,getRootProps:M,getInputProps:B,isDragActive:P,isError:co,dropZoneContent:jsxs(Fragment,{children:[b?jsx(G,{sx:go,children:b}):jsx(io,{sx:go,header:f?.title,description:f?.description}),X&&jsx(Lo,{file:e$1||R||""})]}),children:[m$1&&jsx(_t,{error:!!i,sx:U=>({mx:"14px",color:t?U.palette.grey[500]:void 0}),children:m$1}),jsx(p,{files:po}),X&&p$1&&jsx(n,{size:"small",onClick:p$1,disabled:t,"aria-label":"Remover arquivo",children:jsx(a,{icon:"DELETE_MARK_BUTTON_02",width:16})}),mo&&jsx(Fragment,{children:jsx(No,{sx:{my:3,ml:.5},children:jsx(to,{files:l,thumbnail:u,onRemove:d,onHandleMainImage:a$1,mainUrl:n$1,onReorder:L})})})]})},Ko=Tt;var Ft=({onFileCropped:o,onImageUploaded:t,onCancel:r,aspect:i,label:m,image:e$2="",uploading:p,file:l,tabIndex:u,maxSize:d$1,onDropRejected:a$1,...n})=>{let{id:g,setCropModalOpen:h,handleRemove:f,toggleCropModalOpen:b,cropModalOpen:v,cancelChanges:R,saveChanges:S,previewImage:V,setCropper:N,preview:w,closePreviewImage:L,saving:J}=a$2({onFileCropped:o,onImageUploaded:t,onCancel:r}),{error:M}=a$3();return jsxs(Fragment,{children:[jsxs(d,{children:[p&&jsx(a$4,{}),jsx(Ko,{...n,maxSize:d$1,id:g,file:l,onDrop:B=>{if(B.length>0){h(!0);let P=new FileReader;P.addEventListener("load",()=>{let k=P.result?.toString()||"";t(k),o(void 0);}),P.readAsDataURL(B[0]);}},image:e$2,tabIndex:u,onDropRejected:(B,P)=>{let k=B[0]?.errors[0]?.code;t(void 0),o(void 0),M(k==="file-too-large"?`Imagem n\xE3o pode ser maior que ${e(d$1)}`:"Erro ao enviar imagem"),a$1&&a$1(B,P);}}),(l||e$2)&&jsxs(e$1,{className:"actions",children:[jsx(Wo,{color:"inherit",startIcon:jsx(a,{icon:"DELETE_MARK_BUTTON_02",color:"error.main"}),onClick:f,children:"Remover"}),jsx(Wo,{color:"inherit",startIcon:jsx(a,{icon:"SEARCH_IMAGE",color:"primary.maon"}),onClick:b,children:"Editar"})]})]}),jsx(a$5,{id:g,open:v,onClose:R,label:m,aspectRatio:i,imageSrc:e$2,onRemove:f,onSave:S,onPreview:V,onInitialized:N,loading:J}),jsx(Et,{open:!!w,onClose:L,scroll:"body",PaperProps:{sx:{p:2}},children:w&&jsx("img",{src:w,alt:"Preview"})})]})},Se=Ft;
|
|
33
|
-
|
|
34
|
-
export { to as a, Lo as b, Er as c, Ko as d, Se as e };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { F as FileThumbnailProps } from '../../types-ba102ece.js';
|
|
3
|
-
import '@mui/material/Stack';
|
|
4
|
-
import '@mui/material/styles';
|
|
5
|
-
import 'react-dropzone';
|
|
6
|
-
import 'react-easy-crop';
|
|
7
|
-
import '@dnd-kit/core';
|
|
8
|
-
|
|
9
|
-
declare const fileThumbnailClasses: {
|
|
10
|
-
root: string;
|
|
11
|
-
img: string;
|
|
12
|
-
icon: string;
|
|
13
|
-
removeBtn: string;
|
|
14
|
-
downloadBtn: string;
|
|
15
|
-
};
|
|
16
|
-
declare const FileThumbnail: ({ sx, file, tooltip, onRemove, imageView, slotProps, onDownload, ...other }: FileThumbnailProps) => react_jsx_runtime.JSX.Element;
|
|
17
|
-
|
|
18
|
-
declare function fileFormat(fileUrl: string): string;
|
|
19
|
-
declare function fileThumb(fileUrl: string): string;
|
|
20
|
-
declare function fileTypeByUrl(fileUrl: string): string;
|
|
21
|
-
declare function fileNameByUrl(fileUrl: string): string | undefined;
|
|
22
|
-
|
|
23
|
-
export { FileThumbnail, FileThumbnailProps, fileFormat, fileNameByUrl, fileThumb, fileThumbnailClasses, fileTypeByUrl };
|