@zydon/common 2.4.42 → 2.4.43

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.
@@ -32,6 +32,6 @@ import To from '@mui/material/Badge';
32
32
  import { useDropzone } from 'react-dropzone';
33
33
  import Yr from '@mui/material/CircularProgress';
34
34
 
35
- var Lo=({helperText:e,disabled:t,isError:r})=>e?jsx(Oo,{error:r,sx:a=>({mx:"14px",color:t?a.palette.grey[500]:void 0}),children:e}):null,U=memo(Lo);var Ae=styled(ie)({position:"relative",width:"100%",borderRadius:8,overflow:"hidden","&:hover .actions":{display:"flex"}}),we=styled(ie)({position:"absolute",top:4,right:4,gap:.5,"& svg":{width:16,height:16}}),Xe=styled(me,{shouldForwardProp:e=>!["isDragActive","isError","disabled"].includes(e)})(({theme:e,isDragActive:t,isError:r,disabled:a})=>({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)}`,...t&&{opacity:.72},...r&&{color:e.palette.error.main,backgroundColor:e.palette.error.lighter,borderColor:e.palette.error.light},...a&&{opacity:.48,pointerEvents:"none"},"&:hover":{opacity:.72}}));styled(ie)(({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 Ve=styled(Co)(({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,"&:hover":{zIndex:2}}),Ke=styled(ie,{shouldForwardProp:e=>!["isDragging"].includes(e)})(({theme:e,width:t,isDragging:r})=>({width:t,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)"})),Je=styled(m.div)(({theme:e,width:t,isDragging:r})=>({width:t,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)"})),Qe=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)}})),Ye=styled(me,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="disabled"&&e!=="hasError"})(({theme:e,isDragActive:t,disabled:r,hasError:a})=>({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)}`,...t&&{opacity:.72},...r&&{opacity:.48,pointerEvents:"none"},...a&&{color:e.palette.error.main,borderColor:e.palette.error.main,backgroundColor:alpha(e.palette.error.main,.08)},"&:hover":{opacity:.72}})),eo=styled(me)(({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)"}})),oo=styled("img",{shouldForwardProp:e=>e!=="aspectRatio"&&e!=="isLoading"&&e!=="isUploading"&&e!=="maxWidth"&&e!=="maxHeight"})(({theme:e,aspectRatio:t,height:r=1,width:a=1,maxWidth:i,maxHeight:l,isLoading:p,isUploading:c})=>({borderRadius:e.shape.borderRadius,objectFit:"cover",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%) scale(1)",filter:"blur(0)",zIndex:1,aspectRatio:t,maxWidth:i,maxHeight:l,backgroundColor:e.palette.background.paper,height:r>=a?"100%":`calc(100% * ${t})`,width:r>a?`calc(${t} * 100%)`:"100%",transition:"all 0.5s ease-in-out",...p||c?{opacity:0,filter:"blur(1.5rem)",transform:"translate(-50%, -50%) scale(0.7)"}:{},"&:hover":{transition:"all 0.2s ease-in-out"}})),ro=styled("img",{shouldForwardProp:e=>e!=="isLoading"&&e!=="isUploading"})(({isLoading:e,isUploading:t})=>({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},...t&&{opacity:.7,filter:"blur(2rem)"}})),to=styled(ie)({width:"100%",height:"100%",position:"relative",overflow:"hidden",borderRadius:"50%",justifyContent:"center",alignItems:"center"});styled(zo)(({theme:e})=>({py:1,px:2,mt:3,textAlign:"left",borderStyle:"dashed",borderColor:"error.main",backgroundColor:alpha(e.palette.error.main,.08)}));var Ce=styled(me,{shouldForwardProp:e=>e!=="isError"&&e!=="hasFile"})(({theme:e,isError:t,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},...t&&{color:e.palette.error.main},...r&&{zIndex:9,opacity:0,color:e.palette.common.white,backgroundColor:alpha(e.palette.common.black,.54)}})),io=styled(ie)({top:0,left:0,right:0,bottom:0,position:"absolute",zIndex:10,alignItems:"center",justifyContent:"center"});styled(ie)(({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 ao=styled(me,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="isError"&&e!=="hasFile"})(({theme:e,isDragActive:t,disabled:r,isError:a,hasFile:i})=>({padding:1,margin:"auto",width:144,height:144,cursor:"pointer",overflow:"hidden",borderRadius:"50%",border:`1px dashed ${alpha(e.palette.grey[500],.2)}`,...t&&{opacity:.72},...r&&{opacity:.48,pointerEvents:"none"},...a&&{borderColor:"error.main"},...i&&{...a&&{bgcolor:alpha(e.palette.error.main,.08)},"&:hover .upload-placeholder":{opacity:1},"& img":{filter:"blur(0)"},"&:hover img":{filter:"blur(3px)"}}})),no=styled("img")({width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover",transition:"all 0.3s ease-in-out"}),so=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 ko=({onRemove:e,sx:t,file:r,disableDrag:a,attributes:i,listeners:l,innerWidth:p,isDragging:c})=>{let s=r?.id||r?.url;return s?jsx(To,{anchorOrigin:{vertical:"top",horizontal:"left"},children:jsxs(Je,{width:p,isDragging:c,"data-testid":`preview-multi-img-${s}`,...j().inUp,sx:t,children:[jsx(a$2,{disableDrag:a,...i,...l}),jsx(f,{tooltip:!0,imageView:!0,file:r}),jsx(we,{sx:{position:"absolute",right:3,top:3,zIndex:1},children:e&&jsx(so,{size:"small",label:"Remover arquivo",onClick:()=>e(r),icon:"DELETE_MARK_BUTTON_02"})})]})},`badge-${s}`):null},lo=memo(ko);var Wo=({file:e$1,thumbnail:t,onRemove:r,sx:a$1,disableDrag:i=!1})=>{let l=e$1?.size||0,p=e$1?.name||e$1?.url||e$1?.id,c=e$1?.id||e$1?.url||"",s=typeof e$1=="string",n=i?70:80,{attributes:m,listeners:f$1,setNodeRef:d,transform:g,transition:D,isDragging:b}=useSortable({id:c,disabled:i}),w={transform:x.Transform.toString(g),transition:D,display:"inline-block",alignItems:"center",justifyContent:"center",width:`${n+8}px`,height:"68px"};return t&&e$1?jsx(Me,{ref:d,style:w,children:jsx(lo,{innerWidth:n,isDragging:b,sx:a$1,file:e$1,disableDrag:i,attributes:m,listeners:f$1,onRemove:r})}):jsx(Me,{ref:d,style:{...w,height:"80px",width:`${n+38}px`},children:jsxs(Ke,{width:n+30,isDragging:b,"data-testid":`preview-multi-img-${c}`,...j().inUp,sx:a$1,children:[jsx(a$2,{disableDrag:i,...m,...f$1}),e$1&&jsx(f,{file:e$1}),jsxs(ie,{flexGrow:1,sx:{width:"100%"},children:[jsx(a$3,{title:p,children:jsx(ke,{variant:"subtitle2",noWrap:!0,children:p})}),jsx(ke,{variant:"caption",sx:{color:"text.secondary"},children:s?"":e(l)})]}),jsx(we,{children:r&&jsx(a,{size:"small",label:"Remover arquivo",onClick:()=>r(e$1),icon:"DELETE_MARK_BUTTON_02"})})]})})},mo=memo(Wo);var ir=({thumbnail:e,files:t,onRemove:r,onReorder:a,sx:i})=>{let l=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates}));if(!t?.length)return null;let p=s=>{let{active:n,over:m}=s;if(!(!n||!m||n.id===m.id)&&a){let f=t.findIndex(({id:g})=>g===n.id),d=t.findIndex(({id:g})=>g===m.id);f!==-1&&d!==-1&&a(f,d);}},c=jsx(AnimatePresence,{initial:!1,children:t.map(s=>jsx(mo,{sx:i,file:s,onRemove:r,thumbnail:e,disableDrag:!a},s.id))});return a?jsx(DndContext,{sensors:l,collisionDetection:closestCenter,onDragEnd:p,modifiers:[restrictToHorizontalAxis,restrictToParentElement,restrictToWindowEdges],children:jsx(SortableContext,{items:t.map(s=>s.id),strategy:horizontalListSortingStrategy,children:c})}):c},ue=memo(ir);var fo=forwardRef(({onLoading:e,width:t=1,height:r=1,...a},i)=>{let[l,p]=useState("calc(100% - 16px)"),[c,s]=useState("calc(100% - 16px)");a$1(()=>{e?.(!0);}),useLayoutEffect(()=>{typeof i=="object"&&i?.current?e?.(!i.current.complete):e?.(!1);},[i,e]);function n(){if(typeof i=="object"&&i?.current){let{width:m,height:f}=i.current.getBoundingClientRect(),d=Number(t)<m?t:m,g=Number(r)<f?r:f;p(`calc(${d}px - 16px)`),s(`calc(${g}px - 16px)`);}e?.(!1);}return jsx(oo,{...a,ref:i,maxWidth:l,maxHeight:c,onLoad:n,onError:n})});fo.displayName="LoadingPreviewImage";var xo=fo;var cr=({file:e,aspectRatio:t=1,isUploading:r,isLoading:a,onLoading:i,cropSize:l})=>{let p=useRef(null),c=e?.id||e?.url||e?.name,s=e?.name||e?.url||e?.id,n=e?.url||URL.createObjectURL(e),m=typeof l=="number"?l*t:l?.width,f=typeof l=="number"?l:l?.height,d=useMemo(()=>`image-preview-${c}-${r}`,[c,r]);return c?jsxs(eo,{children:[jsx(xo,{aspectRatio:t,isLoading:a,isUploading:r,height:f,width:m,alt:s,src:n,ref:p,loading:"lazy",onLoading:i},d),jsx(ro,{alt:s,src:n,isLoading:a,isUploading:r})]}):null},ze=memo(cr);var ui=e=>e.startsWith("image/"),Io=(e,t=.8)=>new Promise((r,a)=>{let i=document.createElement("canvas"),l=i.getContext("2d"),p=new Image;p.onload=()=>{i.width=p.width,i.height=p.height,l?(l.drawImage(p,0,0),i.toBlob(c=>{if(c){let s=new File([c],e.name.replace(/\.[^/.]+$/,".webp"),{type:"image/webp",lastModified:Date.now()});r(s);}else a(new Error("Falha ao converter para WebP"));},"image/webp",t)):a(new Error("N\xE3o foi poss\xEDvel obter contexto do canvas"));},p.onerror=()=>a(new Error("Falha ao carregar imagem")),p.src=URL.createObjectURL(e);});var ur=({filesToUpload:e$1,onFileSelect:t,onFilesSelect:r,onRemove:a,dropzoneOptions:i,enableCrop:l=!1,customAspectRatio:p,convertToWebp:c=!0,maxFiles:s,cropSize:n})=>{let{showErrorMessage:m}=a$8(),f=useMemo(()=>p||(n&&typeof n!="number"?n.width/n.height:1),[p,n]),[d,g]=useState([]),[D,b]=useState(!1),[w,F]=useState(null),[h,x]=useState(null),[u,P]=useState(""),[R,S]=useState(!1),[v,L]=useState([]),[G,_]=useState(0),O=useMemo(()=>e$1&&Array.isArray(e$1)?e$1.filter(o=>o instanceof File):e$1&&e$1 instanceof File?[e$1]:d,[e$1,d]),H=useMemo(()=>e$1&&Array.isArray(e$1)?null:e$1&&e$1 instanceof File?e$1:d[0]||null,[e$1,d]);useEffect(()=>{e$1&&(Array.isArray(e$1)?g(e$1.filter(o=>o instanceof File)):e$1 instanceof File?g([e$1]):e$1===null&&g([]));},[e$1]);let Z=useCallback(()=>{if(v.length>0&&l){let o=v[0];F(o),_(I=>I+1);let E=new FileReader;E.onload=()=>{P(E.result),b(!0);},E.readAsDataURL(o);}},[v,l]);useEffect(()=>{Z();},[Z]);let ee=useCallback((o,E)=>{x(E);},[]),oe=async()=>!w||!h?null:new Promise(o=>{let E=document.createElement("canvas"),I=E.getContext("2d"),W=new Image;W.onload=async()=>{let{width:de,height:X,x:Ro,y:So}=h,xe=de,Pe=X;n&&(typeof n=="number"?(xe=n,Pe=n/f):(xe=n.width,Pe=n.height)),E.width=xe,E.height=Pe,I?(I.drawImage(W,Ro,So,de,X,0,0,xe,Pe),E.toBlob(async We=>{if(We){let Le=new File([We],w.name,{type:w.type,lastModified:Date.now()});if(c)try{Le=await Io(Le);}catch(yo){m(yo,"Erro ao converter para WebP");}o(Le);}else o(null);},"image/png")):o(null);},W.src=u;}),re=async()=>{if(!(!w||!h)){S(!0);try{let o=await oe();if(o)if(Array.isArray(e$1)||e$1===void 0&&r){let I=s?[...O,o].slice(0,s):[...O,o];g(I),r?.(I);}else g([o]),t?.(o);let E=v.slice(1);L(E),b(!1),P(""),F(null),E.length>0&&setTimeout(()=>Z(),100);}catch(o){m(o,"Erro ao processar imagem");}finally{S(!1);}}},C=()=>{b(!1),P(""),F(null),L([]),_(0);},z=useCallback(o=>{if(o.length===0)return;if(i?.accept&&Object.keys(i.accept).some(I=>I.includes("image/"))&&l)if(Array.isArray(e$1)||e$1===void 0&&r){let I=o.filter(X=>X.type.startsWith("image/")),W=O.map(X=>X.name),de=I.filter(X=>!W.includes(X.name));if(de.length===0){m("Todos os arquivos selecionados j\xE1 foram adicionados","Arquivos duplicados");return}L(de),_(0);}else {let I=o[0];F(I);let W=new FileReader;W.onload=()=>{P(W.result),b(!0);},W.readAsDataURL(I);}else if(Array.isArray(e$1)||e$1===void 0&&r){let I=s?[...O,...o].slice(0,s):[...O,...o];g(I),r?.(I);}else {let I=o[0];g([I]),t?.(I);}},[e$1,O,t,r,l,s,i,m]),k=useCallback(o=>{if(!o.length)return;let E=o[0]?.errors[0]?.code,I=i?.maxSize||3145728;m(E==="file-too-large"?new Error(`O arquivo excede o tamanho m\xE1ximo de ${e(I)}`):E==="file-invalid-type"?new Error("Formato de arquivo n\xE3o suportado"):o[0]?.errors[0]||new Error("Erro ao enviar arquivo"),"Erro ao fazer upload");},[i?.maxSize,m]),{getRootProps:N,getInputProps:q,isDragActive:j,isDragReject:ye,fileRejections:_e}=useDropzone({onDrop:z,onDropRejected:k,...i}),Oe=useCallback(o=>{if(!o){g([]),a?.(void 0);return}if(Array.isArray(e$1)||e$1===void 0&&r){let E=d.filter(I=>I.name!==o.name);g(E),a?.(o),r&&r(E);}else g([]),a?.(o);},[e$1,d,r,a]),Fo=useCallback(()=>{g([]),Array.isArray(e$1)&&r?r([]):!Array.isArray(e$1)&&t&&t?.(null);},[e$1,r,t]);return {file:H,files:O,aspectRatio:f,dropzoneProps:{getRootProps:N,getInputProps:q,isDragActive:j,isDragReject:ye,fileRejections:_e},cropState:{cropModalOpen:D,imagePreview:u,cropLoading:R,setCropModalOpen:b,onCropInitialized:ee,handleCropSave:re,handleCropCancel:C,currentImageIndex:G,totalPendingImages:v.length},handleRemove:Oe,clearFiles:Fo,setFiles:g}},T=ur;var Ue=(o=>(o.APPLICATION_OCTET_STREAM="application/octet-stream",o.IMAGE_JPEG="image/jpeg",o.IMAGE_JPG="image/jpg",o.IMAGE_PNG="image/png",o.IMAGE_GIF="image/gif",o.IMAGE_WEBP="image/webp",o.IMAGE_SVG="image/svg+xml",o.IMAGE_BMP="image/bmp",o.IMAGE_TIFF="image/tiff",o.IMAGE_ICO="image/x-icon",o.IMAGE_AVIF="image/avif",o.APPLICATION_PDF="application/pdf",o.TEXT_PLAIN="text/plain",o.TEXT_CSV="text/csv",o.APPLICATION_RTF="application/rtf",o.APPLICATION_MSWORD="application/msword",o.APPLICATION_DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",o.APPLICATION_MSEXCEL="application/vnd.ms-excel",o.APPLICATION_XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",o.APPLICATION_MSPOWERPOINT="application/vnd.ms-powerpoint",o.APPLICATION_PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",o.APPLICATION_ODT="application/vnd.oasis.opendocument.text",o.APPLICATION_ODS="application/vnd.oasis.opendocument.spreadsheet",o.APPLICATION_ODP="application/vnd.oasis.opendocument.presentation",o.APPLICATION_XML="application/xml",o.TEXT_XML="text/xml",o.TEXT_HTML="text/html",o.TEXT_CSS="text/css",o.APPLICATION_JSON="application/json",o.TEXT_JAVASCRIPT="text/javascript",o.APPLICATION_ZIP="application/zip",o.APPLICATION_GZIP="application/gzip",o.APPLICATION_RAR="application/vnd.rar",o.APPLICATION_7Z="application/x-7z-compressed",o.AUDIO_MPEG="audio/mpeg",o.AUDIO_WAV="audio/wav",o.AUDIO_OGG="audio/ogg",o.AUDIO_WEBM="audio/webm",o.AUDIO_AAC="audio/aac",o.VIDEO_MP4="video/mp4",o.VIDEO_MPEG="video/mpeg",o.VIDEO_OGG="video/ogg",o.VIDEO_WEBM="video/webm",o.VIDEO_QUICKTIME="video/quicktime",o))(Ue||{}),De=(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))(De||{});var Pr=({createFilesMutation:e,files:t,file:r,skip:a})=>{let{showErrorMessage:i}=a$8(),[l,p]=useState(!1),[c,s]=useState(!1),[n,m]=useState(null),[f,d]=useState(void 0),g=useMemo(()=>f?.[0],[f]),D=useMemo(()=>{if(!a)return r?[r]:t},[r,t,a]),b=useCallback(async h=>{if(!h?.length){d(void 0);return}try{s(!0);let x=await Promise.all(h.map(async({url:u,name:P,id:R},S)=>{let L=await(await fetch(u)).blob(),G=P||u.split("/").pop()||"image",_=new File([L],G,{type:L.type});return _.id=R,_.url=u,_.index=S,_}));d(x);}catch(x){console.error("Erro ao carregar preview dos arquivos:",x),d(void 0);}finally{s(!1);}},[]),w=c||l;return useEffect(()=>{b(D);},[D,b]),{filesPreview:f,filePreview:g,uploadFiles:async h=>{if(h?.length){p(!0);try{let x=h[0].type||"application/octet-stream",u=De[x];if(!u)throw new Error(`Tipo de arquivo n\xE3o suportado: ${x}`);let P=await e({files:[{content_type:u,name:h[0].name}]}).unwrap(),R=P.files.map(v=>v.id);return (await Promise.all(h.map(v=>fetch(P.files[0].url,{method:"PUT",headers:{"Content-Type":x},body:v})))).forEach(v=>{if(!v.ok)throw new Error(`Erro no upload: ${v.statusText}`)}),b(P.files),R}catch(x){throw m(x),i(x,"Erro no upload"),x}finally{p(!1);}}},isUploadingFiles:l,isLoadingPreview:c,isUploadOrLoadingFiles:w,uploadFilesError:n}},Ir=Pr;var hr=({sx:e,id:t,name:r,tabIndex:a,uploading:i,getRootProps:l,getInputProps:p,isDragActive:c,isError:s,disabled:n,dropZoneSxProps:m,dropZoneContent:f,children:d,...g})=>jsxs(Ae,{children:[i&&jsx(a$7,{"data-testid":"uploading-progress-bar"}),jsxs(me,{sx:{width:1,position:"relative",...e},children:[jsxs(Xe,{...l(),"data-testid":"drop-zone-styled-area",isError:s,isDragActive:c,disabled:!!n,sx:m,...g,children:[jsx("input",{...p(),id:t,tabIndex:a,name:r}),f]}),d]})]}),K=hr;var wr=({header:e,description:t,sx:r,...a})=>jsxs(ie,{spacing:5,alignItems:"center",justifyContent:"center",direction:{xs:"column",md:"row"},sx:{width:1,textAlign:{xs:"center",md:"left"},...r},...a,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:t||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"]})})]})]}),J=memo(wr);var Rr=({onRemove:e,onReorder:t,onFilesSelect:r,id:a,disabled:i,error:l,helperText:p,files:c,thumbnail:s,dropZoneSxProps:n,uploading:m,tabIndex:f,maxFiles:d,...g})=>{let{files:D,dropzoneProps:b,handleRemove:w}=T({filesToUpload:c,onFilesSelect:r,onRemove:e,dropzoneOptions:{multiple:!0,disabled:i,...g},maxFiles:d}),{getRootProps:F,getInputProps:h,isDragActive:x,isDragReject:u}=b,P=!!D?.length,R=u||!!l;return jsxs(K,{id:a,uploading:m,disabled:i,dropZoneSxProps:n,tabIndex:f,getRootProps:F,getInputProps:h,isDragActive:x,isError:R,dropZoneContent:jsx(J,{}),children:[jsx(U,{disabled:i,helperText:p,isError:R}),P&&jsx(me,{sx:{my:3},children:jsx(ue,{files:D,thumbnail:!!s,onRemove:e?w:void 0,onReorder:t})})]})},Sr=memo(Rr);var Cr=({onFilesSelect:e,onRemove:t,onReorder:r,id:a,disabled:i,error:l,helperText:p,files:c,dropZoneSxProps:s,placeholderProps:n,placeholderAlt:m,uploading:f,tabIndex:d,maxFiles:g,aspectRatio:D,enableCrop:b=!0,convertToWebp:w=!0,cropSize:F,name:h,label:x,...u})=>{let{files:P,dropzoneProps:R,cropState:S,handleRemove:v,aspectRatio:L}=T({filesToUpload:c,onFilesSelect:e,onRemove:t,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!0,disabled:i,...u},enableCrop:b,customAspectRatio:D,convertToWebp:w,maxFiles:g,cropSize:F}),{getRootProps:G,getInputProps:_,isDragActive:O,isDragReject:H}=R,{cropModalOpen:Z,imagePreview:ee,cropLoading:oe,onCropInitialized:re,handleCropSave:C,handleCropCancel:z,currentImageIndex:k,totalPendingImages:N}=S,q=!!P?.length,j=H||!!l,ye=useMemo(()=>{let _e=x??"Ajustar Imagem",Oe=N>1?` (${k} de ${N})`:"";return `${_e}${Oe}`},[x,N,k]);return jsxs(K,{id:a,name:h,uploading:f,disabled:i,dropZoneSxProps:s,tabIndex:d,getRootProps:G,getInputProps:_,isDragActive:O,isError:j,dropZoneContent:jsx(Fragment,{children:m?jsx(ie,{children:m}):jsx(J,{header:n?.header,description:n?.description})}),children:[jsx(U,{disabled:i,helperText:p,isError:j}),q&&jsx(Fragment,{children:jsx(me,{sx:{my:3,ml:.5},children:jsx(ue,{files:P,thumbnail:!0,onRemove:v,onReorder:r})})}),jsx(a$5,{open:Z,onClose:z,label:ye,imageSrc:ee,aspectRatio:L,onInitialized:re,onSave:C,loading:oe,cropSize:F})]})},zr=memo(Cr);var Br=({onFileSelect:e$1,onRemove:t,file:r,id:a,disabled:i,error:l,helperText:p,sx:c,dropZoneSxProps:s,uploading:n,tabIndex:m$1,...f$1})=>{let{file:d,dropzoneProps:g,handleRemove:D}=T({filesToUpload:r,onFileSelect:e$1,onRemove:t,dropzoneOptions:{multiple:!1,disabled:i,...f$1}}),{getRootProps:b,getInputProps:w,isDragActive:F,isDragReject:h}=g,x=useCallback(S=>{S.stopPropagation(),D(d||void 0);},[d,D]),u=!!d,P=typeof d=="string",R=h||!!l;return jsx(K,{id:a,uploading:n,disabled:i,dropZoneSxProps:s,tabIndex:m$1,getRootProps:b,getInputProps:w,isDragActive:F,isError:R,dropZoneContent:jsxs(Fragment,{children:[!u&&jsx(J,{}),u&&jsxs(ie,{component:m.div,...j().inUp,spacing:2,direction:"row",alignItems:"center",sx:{my:1,px:1,py:.75,borderRadius:.75,border:S=>`solid 1px ${S.palette.divider}`,...c},children:[jsx(f,{file:d}),jsxs(ie,{flexGrow:1,sx:{minWidth:0},children:[jsx(ke,{variant:"subtitle2",noWrap:!0,children:P?d:d.name}),jsx(ke,{variant:"caption",sx:{color:"text.secondary"},children:P?"":e(d.size)})]}),t&&jsx(a$3,{title:"Remover arquivo",children:jsx(Ve,{edge:"end",size:"small",disabled:i,"aria-label":"Remover arquivo",onClick:x,children:jsx(a$6,{icon:"DELETE_MARK_BUTTON_02",width:16})})})]})]}),children:jsx(U,{disabled:i,helperText:p,isError:R})})},Gr=memo(Br);var qr=({onRemove:e,onFileSelect:t,file:r,id:a,disabled:i,error:l,helperText:p,dropZoneSxProps:c,placeholderProps:s,placeholderAlt:n,uploading:m,tabIndex:f,aspectRatio:d,enableCrop:g=!0,convertToWebp:D=!0,name:b,label:w,cropSize:F,...h})=>{let[x,u]=useState(!1),{file:P,dropzoneProps:R,cropState:S,handleRemove:v,aspectRatio:L}=T({filesToUpload:r,onFileSelect:t,onRemove:e,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:i,...h},enableCrop:g,customAspectRatio:d,convertToWebp:D,cropSize:F}),{getRootProps:G,getInputProps:_,isDragActive:O,isDragReject:H}=R,{cropModalOpen:Z,imagePreview:ee,cropLoading:oe,onCropInitialized:re,handleCropSave:C,handleCropCancel:z}=S,k=useCallback(()=>{v(P||void 0);},[P,v]),N=!!P,q=H||!!l,j=N?{opacity:0}:{opacity:1};return jsxs(Ae,{children:[(m||x)&&jsx(a$7,{}),jsxs(K,{id:a,uploading:m,disabled:i,dropZoneSxProps:c,tabIndex:f,getRootProps:G,getInputProps:_,isDragActive:O,isError:q,name:b,dropZoneContent:jsxs(Fragment,{children:[n?jsx(ie,{sx:j,children:n}):jsx(J,{sx:j,header:s?.title,description:s?.description}),N&&jsx(ze,{file:P,cropSize:F,isLoading:x,isUploading:m,onLoading:u,aspectRatio:L})]}),children:[jsx(U,{disabled:i,helperText:p,isError:q}),N&&e&&jsx(Qe,{size:"small",onClick:k,disabled:i,label:"Remover arquivo",children:jsx(a$6,{icon:"DELETE_MARK_BUTTON_02",width:16})}),jsx(a$5,{open:Z,onClose:z,label:w??"Ajustar Imagem",imageSrc:ee,aspectRatio:L,onInitialized:re,onSave:C,loading:oe,cropSize:F})]})]})},Xr=memo(qr);var et=({onFileSelect:e,onRemove:t,file:r,disabled:a,label:i,id:l,tabIndex:p,error:c,helperText:s,sx:n,name:m,maxSize:f,uploading:d,aspectRatio:g=1,enableCrop:D=!0,convertToWebp:b=!0,cropSize:w,...F})=>{let[h,x]=useState(!1),{file:u,dropzoneProps:P,cropState:R,handleRemove:S}=T({filesToUpload:r,onFileSelect:e,onRemove:t,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:a,maxSize:f,...F},enableCrop:D,customAspectRatio:g,convertToWebp:b,cropSize:w}),{getRootProps:v,getInputProps:L,isDragActive:G,isDragReject:_}=P,{cropModalOpen:O,imagePreview:H,cropLoading:Z,onCropInitialized:ee,handleCropSave:oe,handleCropCancel:re}=R,C=_||!!c,z=h||d,k=!!t,N=useMemo(()=>u?(x(!0),URL.createObjectURL(u)):"",[u]),q=()=>{x(!1);},j=()=>k&&u?()=>S(u):v().onClick;return jsxs(Fragment,{children:[jsxs(ao,{sx:n,isError:C,isDragActive:G,hasFile:!!u,...v(),onClick:j(),children:[jsxs(to,{children:[u&&jsx(no,{alt:"Avatar Preview",src:N,onLoad:q,...z&&{sx:{filter:"blur(5px) !important",scale:1.2,opacity:.7}}}),u&&z&&jsx(io,{children:jsx(Yr,{size:135,thickness:1,color:"primary"})}),!u&&!z&&jsxs(Ce,{isError:C,hasFile:!1,children:[jsx(a$6,{icon:"ADD_IMAGE",width:32}),jsx(ke,{variant:"caption",textAlign:"center",sx:{color:C?"error.main":"text.disabled"},children:"Adicionar foto"})]}),u&&!z&&jsxs(Ce,{isError:C,hasFile:!0,children:[jsx(a$6,{icon:k?"DELETE_MARK_BUTTON_02":"ADD_IMAGE",width:32}),jsx(ke,{variant:"caption",textAlign:"center",sx:{color:C?"error.main":"common.white"},children:k?"Remover foto":"Alterar foto"})]})]}),jsx("input",{name:m,id:l,tabIndex:p,...L()}),jsx(ie,{spacing:.5,sx:{pt:1},children:jsx(U,{helperText:s,disabled:a,isError:C})}),u&&!z&&jsx(ie,{direction:"row",justifyContent:"center",spacing:1,sx:{pt:1,mb:-1},children:jsx(ke,{variant:"caption",component:"span",sx:{px:.75,cursor:"pointer",borderRadius:.75,color:"error.main","&:hover":{color:"error.dark",bgcolor:"background.default"}},onClick:()=>S(u),children:"Remover"})})]}),O&&H&&jsx(a$5,{open:O,onClose:re,label:i??"Ajustar Imagem",imageSrc:H,aspectRatio:g,onInitialized:ee,onSave:oe,loading:Z,cropSize:w,cropShape:"round"})]})},ot=memo(et);var at=({error:e,name:t,disabled:r,sx:a,...i})=>{let{getRootProps:l,getInputProps:p,isDragActive:c,isDragReject:s}=useDropzone({disabled:r,...i}),n=s||e;return jsxs(Ye,{...l(),isDragActive:c,hasError:!!n,disabled:!!r,sx:a,"data-testid":"upload-box",children:[jsx("input",{name:t,...p()}),"Selecionar arquivo"]})},nt=memo(at);
35
+ var Lo=({helperText:e,disabled:t,isError:r})=>e?jsx(Oo,{error:r,sx:a=>({mx:"14px",color:t?a.palette.grey[500]:void 0}),children:e}):null,U=memo(Lo);var Ae=styled(ie)({position:"relative",width:"100%",borderRadius:8,overflow:"hidden","&:hover .actions":{display:"flex"}}),Ee=styled(ie)({position:"absolute",top:4,right:4,gap:.5,"& svg":{width:16,height:16}}),Xe=styled(me,{shouldForwardProp:e=>!["isDragActive","isError","disabled"].includes(e)})(({theme:e,isDragActive:t,isError:r,disabled:a})=>({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)}`,...t&&{opacity:.72},...r&&{color:e.palette.error.main,backgroundColor:e.palette.error.lighter,borderColor:e.palette.error.light},...a&&{opacity:.48,pointerEvents:"none"},"&:hover":{opacity:.72}}));styled(ie)(({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 Ve=styled(Co)(({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,"&:hover":{zIndex:2}}),Ke=styled(ie,{shouldForwardProp:e=>!["isDragging"].includes(e)})(({theme:e,width:t,isDragging:r})=>({width:t,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)"})),Je=styled(m.div)(({theme:e,width:t,isDragging:r})=>({width:t,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)"})),Qe=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)}})),Ye=styled(me,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="disabled"&&e!=="hasError"})(({theme:e,isDragActive:t,disabled:r,hasError:a})=>({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)}`,...t&&{opacity:.72},...r&&{opacity:.48,pointerEvents:"none"},...a&&{color:e.palette.error.main,borderColor:e.palette.error.main,backgroundColor:alpha(e.palette.error.main,.08)},"&:hover":{opacity:.72}})),eo=styled(me)(({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)"}})),oo=styled("img",{shouldForwardProp:e=>e!=="aspectRatio"&&e!=="isLoading"&&e!=="isUploading"&&e!=="maxWidth"&&e!=="maxHeight"})(({theme:e,aspectRatio:t,height:r=1,width:a=1,maxWidth:i,maxHeight:l,isLoading:p,isUploading:c})=>({borderRadius:e.shape.borderRadius,objectFit:"cover",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%) scale(1)",filter:"blur(0)",zIndex:1,aspectRatio:t,maxWidth:i,maxHeight:l,backgroundColor:e.palette.background.paper,height:r>=a?"100%":`calc(100% * ${t})`,width:r>a?`calc(${t} * 100%)`:"100%",transition:"all 0.5s ease-in-out",...p||c?{opacity:0,filter:"blur(1.5rem)",transform:"translate(-50%, -50%) scale(0.7)"}:{},"&:hover":{transition:"all 0.2s ease-in-out"}})),ro=styled("img",{shouldForwardProp:e=>e!=="isLoading"&&e!=="isUploading"})(({isLoading:e,isUploading:t})=>({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},...t&&{opacity:.7,filter:"blur(2rem)"}})),to=styled(ie)({width:"100%",height:"100%",position:"relative",overflow:"hidden",borderRadius:"50%",justifyContent:"center",alignItems:"center"});styled(zo)(({theme:e})=>({py:1,px:2,mt:3,textAlign:"left",borderStyle:"dashed",borderColor:"error.main",backgroundColor:alpha(e.palette.error.main,.08)}));var Ce=styled(me,{shouldForwardProp:e=>e!=="isError"&&e!=="hasFile"})(({theme:e,isError:t,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},...t&&{color:e.palette.error.main},...r&&{zIndex:9,opacity:0,color:e.palette.common.white,backgroundColor:alpha(e.palette.common.black,.54)}})),io=styled(ie)({top:0,left:0,right:0,bottom:0,position:"absolute",zIndex:10,alignItems:"center",justifyContent:"center"});styled(ie)(({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 ao=styled(me,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="isError"&&e!=="hasFile"})(({theme:e,isDragActive:t,disabled:r,isError:a,hasFile:i})=>({padding:1,margin:"auto",width:144,height:144,cursor:"pointer",overflow:"hidden",borderRadius:"50%",border:`1px dashed ${alpha(e.palette.grey[500],.2)}`,...t&&{opacity:.72},...r&&{opacity:.48,pointerEvents:"none"},...a&&{borderColor:"error.main"},...i&&{...a&&{bgcolor:alpha(e.palette.error.main,.08)},"&:hover .upload-placeholder":{opacity:1},"& img":{filter:"blur(0)"},"&:hover img":{filter:"blur(3px)"}}})),no=styled("img")({width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover",transition:"all 0.3s ease-in-out"}),so=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 ko=({onRemove:e,sx:t,file:r,disableDrag:a,attributes:i,listeners:l,innerWidth:p,isDragging:c})=>{let s=r?.id||r?.url;return s?jsx(To,{anchorOrigin:{vertical:"top",horizontal:"left"},children:jsxs(Je,{width:p,isDragging:c,"data-testid":`preview-multi-img-${s}`,...j().inUp,sx:t,children:[jsx(a$2,{disableDrag:a,...i,...l}),jsx(f,{tooltip:!0,imageView:!0,file:r}),jsx(Ee,{sx:{position:"absolute",right:3,top:3,zIndex:1},children:e&&jsx(so,{size:"small",label:"Remover arquivo",onClick:()=>e(r),icon:"DELETE_MARK_BUTTON_02"})})]})},`badge-${s}`):null},lo=memo(ko);var Wo=({file:e$1,thumbnail:t,onRemove:r,sx:a$1,disableDrag:i=!1})=>{let l=e$1?.size||0,p=e$1?.name||e$1?.url||e$1?.id,c=e$1?.id||e$1?.url||"",s=typeof e$1=="string",n=i?70:80,{attributes:m,listeners:f$1,setNodeRef:d,transform:g,transition:D,isDragging:b}=useSortable({id:c,disabled:i}),E={transform:x.Transform.toString(g),transition:D,display:"inline-block",alignItems:"center",justifyContent:"center",width:`${n+8}px`,height:"68px"};return t&&e$1?jsx(Me,{ref:d,style:E,children:jsx(lo,{innerWidth:n,isDragging:b,sx:a$1,file:e$1,disableDrag:i,attributes:m,listeners:f$1,onRemove:r})}):jsx(Me,{ref:d,style:{...E,height:"80px",width:`${n+38}px`},children:jsxs(Ke,{width:n+30,isDragging:b,"data-testid":`preview-multi-img-${c}`,...j().inUp,sx:a$1,children:[jsx(a$2,{disableDrag:i,...m,...f$1}),e$1&&jsx(f,{file:e$1}),jsxs(ie,{flexGrow:1,sx:{width:"100%"},children:[jsx(a$3,{title:p,children:jsx(ke,{variant:"subtitle2",noWrap:!0,children:p})}),jsx(ke,{variant:"caption",sx:{color:"text.secondary"},children:s?"":e(l)})]}),jsx(Ee,{children:r&&jsx(a,{size:"small",label:"Remover arquivo",onClick:()=>r(e$1),icon:"DELETE_MARK_BUTTON_02"})})]})})},mo=memo(Wo);var ir=({thumbnail:e,files:t,onRemove:r,onReorder:a,sx:i})=>{let l=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates}));if(!t?.length)return null;let p=s=>{let{active:n,over:m}=s;if(!(!n||!m||n.id===m.id)&&a){let f=t.findIndex(({id:g})=>g===n.id),d=t.findIndex(({id:g})=>g===m.id);f!==-1&&d!==-1&&a(f,d);}},c=jsx(AnimatePresence,{initial:!1,children:t.map(s=>jsx(mo,{sx:i,file:s,onRemove:r,thumbnail:e,disableDrag:!a},s.id))});return a?jsx(DndContext,{sensors:l,collisionDetection:closestCenter,onDragEnd:p,modifiers:[restrictToHorizontalAxis,restrictToParentElement,restrictToWindowEdges],children:jsx(SortableContext,{items:t.map(s=>s.id),strategy:horizontalListSortingStrategy,children:c})}):c},ue=memo(ir);var fo=forwardRef(({onLoading:e,width:t,height:r,...a},i)=>{let[l,p]=useState("calc(100% - 16px)"),[c,s]=useState("calc(100% - 16px)");a$1(()=>{e?.(!0);}),useLayoutEffect(()=>{typeof i=="object"&&i?.current?e?.(!i.current.complete):e?.(!1);},[i,e]);function n(){if(typeof i=="object"&&i?.current&&t&&r){let{width:m,height:f}=i.current.getBoundingClientRect(),d=Number(t)<m?t:m,g=Number(r)<f?r:f;p(`calc(${d}px - 16px)`),s(`calc(${g}px - 16px)`);}e?.(!1);}return jsx(oo,{...a,ref:i,maxWidth:l,maxHeight:c,onLoad:n,onError:n})});fo.displayName="LoadingPreviewImage";var xo=fo;var cr=({file:e,aspectRatio:t=1,isUploading:r,isLoading:a,onLoading:i,cropSize:l})=>{let p=useRef(null),c=e?.id||e?.url||e?.name,s=e?.name||e?.url||e?.id,n=e?.url||URL.createObjectURL(e),m=typeof l=="number"?l*t:l?.width,f=typeof l=="number"?l:l?.height,d=useMemo(()=>`image-preview-${c}-${r}`,[c,r]);return c?jsxs(eo,{children:[jsx(xo,{aspectRatio:t,isLoading:a,isUploading:r,height:f,width:m,alt:s,src:n,ref:p,loading:"lazy",onLoading:i},d),jsx(ro,{alt:s,src:n,isLoading:a,isUploading:r})]}):null},ze=memo(cr);var ui=e=>e.startsWith("image/"),Io=(e,t=.8)=>new Promise((r,a)=>{let i=document.createElement("canvas"),l=i.getContext("2d"),p=new Image;p.onload=()=>{i.width=p.width,i.height=p.height,l?(l.drawImage(p,0,0),i.toBlob(c=>{if(c){let s=new File([c],e.name.replace(/\.[^/.]+$/,".webp"),{type:"image/webp",lastModified:Date.now()});r(s);}else a(new Error("Falha ao converter para WebP"));},"image/webp",t)):a(new Error("N\xE3o foi poss\xEDvel obter contexto do canvas"));},p.onerror=()=>a(new Error("Falha ao carregar imagem")),p.src=URL.createObjectURL(e);});var ur=({filesToUpload:e$1,onFileSelect:t,onFilesSelect:r,onRemove:a,dropzoneOptions:i,enableCrop:l=!1,customAspectRatio:p,convertToWebp:c=!0,maxFiles:s,cropSize:n})=>{let{showErrorMessage:m}=a$8(),f=useMemo(()=>p||(n&&typeof n!="number"?n.width/n.height:1),[p,n]),[d,g]=useState([]),[D,b]=useState(!1),[E,F]=useState(null),[h,x]=useState(null),[u,P]=useState(""),[R,S]=useState(!1),[v,L]=useState([]),[G,_]=useState(0),O=useMemo(()=>e$1&&Array.isArray(e$1)?e$1.filter(o=>o instanceof File):e$1&&e$1 instanceof File?[e$1]:d,[e$1,d]),H=useMemo(()=>e$1&&Array.isArray(e$1)?null:e$1&&e$1 instanceof File?e$1:d[0]||null,[e$1,d]);useEffect(()=>{e$1&&(Array.isArray(e$1)?g(e$1.filter(o=>o instanceof File)):e$1 instanceof File?g([e$1]):e$1===null&&g([]));},[e$1]);let Z=useCallback(()=>{if(v.length>0&&l){let o=v[0];F(o),_(I=>I+1);let w=new FileReader;w.onload=()=>{P(w.result),b(!0);},w.readAsDataURL(o);}},[v,l]);useEffect(()=>{Z();},[Z]);let ee=useCallback((o,w)=>{x(w);},[]),oe=async()=>!E||!h?null:new Promise(o=>{let w=document.createElement("canvas"),I=w.getContext("2d"),W=new Image;W.onload=async()=>{let{width:de,height:X,x:Ro,y:So}=h,xe=de,Pe=X;n&&(typeof n=="number"?(xe=n,Pe=n/f):(xe=n.width,Pe=n.height)),w.width=xe,w.height=Pe,I?(I.drawImage(W,Ro,So,de,X,0,0,xe,Pe),w.toBlob(async We=>{if(We){let Le=new File([We],E.name,{type:E.type,lastModified:Date.now()});if(c)try{Le=await Io(Le);}catch(yo){m(yo,"Erro ao converter para WebP");}o(Le);}else o(null);},"image/png")):o(null);},W.src=u;}),re=async()=>{if(!(!E||!h)){S(!0);try{let o=await oe();if(o)if(Array.isArray(e$1)||e$1===void 0&&r){let I=s?[...O,o].slice(0,s):[...O,o];g(I),r?.(I);}else g([o]),t?.(o);let w=v.slice(1);L(w),b(!1),P(""),F(null),w.length>0&&setTimeout(()=>Z(),100);}catch(o){m(o,"Erro ao processar imagem");}finally{S(!1);}}},C=()=>{b(!1),P(""),F(null),L([]),_(0);},z=useCallback(o=>{if(o.length===0)return;if(i?.accept&&Object.keys(i.accept).some(I=>I.includes("image/"))&&l)if(Array.isArray(e$1)||e$1===void 0&&r){let I=o.filter(X=>X.type.startsWith("image/")),W=O.map(X=>X.name),de=I.filter(X=>!W.includes(X.name));if(de.length===0){m("Todos os arquivos selecionados j\xE1 foram adicionados","Arquivos duplicados");return}L(de),_(0);}else {let I=o[0];F(I);let W=new FileReader;W.onload=()=>{P(W.result),b(!0);},W.readAsDataURL(I);}else if(Array.isArray(e$1)||e$1===void 0&&r){let I=s?[...O,...o].slice(0,s):[...O,...o];g(I),r?.(I);}else {let I=o[0];g([I]),t?.(I);}},[e$1,O,t,r,l,s,i,m]),k=useCallback(o=>{if(!o.length)return;let w=o[0]?.errors[0]?.code,I=i?.maxSize||3145728;m(w==="file-too-large"?new Error(`O arquivo excede o tamanho m\xE1ximo de ${e(I)}`):w==="file-invalid-type"?new Error("Formato de arquivo n\xE3o suportado"):o[0]?.errors[0]||new Error("Erro ao enviar arquivo"),"Erro ao fazer upload");},[i?.maxSize,m]),{getRootProps:N,getInputProps:q,isDragActive:j,isDragReject:ye,fileRejections:_e}=useDropzone({onDrop:z,onDropRejected:k,...i}),Oe=useCallback(o=>{if(!o){g([]),a?.(void 0);return}if(Array.isArray(e$1)||e$1===void 0&&r){let w=d.filter(I=>I.name!==o.name);g(w),a?.(o),r&&r(w);}else g([]),a?.(o);},[e$1,d,r,a]),Fo=useCallback(()=>{g([]),Array.isArray(e$1)&&r?r([]):!Array.isArray(e$1)&&t&&t?.(null);},[e$1,r,t]);return {file:H,files:O,aspectRatio:f,dropzoneProps:{getRootProps:N,getInputProps:q,isDragActive:j,isDragReject:ye,fileRejections:_e},cropState:{cropModalOpen:D,imagePreview:u,cropLoading:R,setCropModalOpen:b,onCropInitialized:ee,handleCropSave:re,handleCropCancel:C,currentImageIndex:G,totalPendingImages:v.length},handleRemove:Oe,clearFiles:Fo,setFiles:g}},T=ur;var Ue=(o=>(o.APPLICATION_OCTET_STREAM="application/octet-stream",o.IMAGE_JPEG="image/jpeg",o.IMAGE_JPG="image/jpg",o.IMAGE_PNG="image/png",o.IMAGE_GIF="image/gif",o.IMAGE_WEBP="image/webp",o.IMAGE_SVG="image/svg+xml",o.IMAGE_BMP="image/bmp",o.IMAGE_TIFF="image/tiff",o.IMAGE_ICO="image/x-icon",o.IMAGE_AVIF="image/avif",o.APPLICATION_PDF="application/pdf",o.TEXT_PLAIN="text/plain",o.TEXT_CSV="text/csv",o.APPLICATION_RTF="application/rtf",o.APPLICATION_MSWORD="application/msword",o.APPLICATION_DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",o.APPLICATION_MSEXCEL="application/vnd.ms-excel",o.APPLICATION_XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",o.APPLICATION_MSPOWERPOINT="application/vnd.ms-powerpoint",o.APPLICATION_PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",o.APPLICATION_ODT="application/vnd.oasis.opendocument.text",o.APPLICATION_ODS="application/vnd.oasis.opendocument.spreadsheet",o.APPLICATION_ODP="application/vnd.oasis.opendocument.presentation",o.APPLICATION_XML="application/xml",o.TEXT_XML="text/xml",o.TEXT_HTML="text/html",o.TEXT_CSS="text/css",o.APPLICATION_JSON="application/json",o.TEXT_JAVASCRIPT="text/javascript",o.APPLICATION_ZIP="application/zip",o.APPLICATION_GZIP="application/gzip",o.APPLICATION_RAR="application/vnd.rar",o.APPLICATION_7Z="application/x-7z-compressed",o.AUDIO_MPEG="audio/mpeg",o.AUDIO_WAV="audio/wav",o.AUDIO_OGG="audio/ogg",o.AUDIO_WEBM="audio/webm",o.AUDIO_AAC="audio/aac",o.VIDEO_MP4="video/mp4",o.VIDEO_MPEG="video/mpeg",o.VIDEO_OGG="video/ogg",o.VIDEO_WEBM="video/webm",o.VIDEO_QUICKTIME="video/quicktime",o))(Ue||{}),De=(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))(De||{});var Pr=({createFilesMutation:e,files:t,file:r,skip:a})=>{let{showErrorMessage:i}=a$8(),[l,p]=useState(!1),[c,s]=useState(!1),[n,m]=useState(null),[f,d]=useState(void 0),g=useMemo(()=>f?.[0],[f]),D=useMemo(()=>{if(!a)return r?[r]:t},[r,t,a]),b=useCallback(async h=>{if(!h?.length){d(void 0);return}try{s(!0);let x=await Promise.all(h.map(async({url:u,name:P,id:R},S)=>{let L=await(await fetch(u)).blob(),G=P||u.split("/").pop()||"image",_=new File([L],G,{type:L.type});return _.id=R,_.url=u,_.index=S,_}));d(x);}catch(x){console.error("Erro ao carregar preview dos arquivos:",x),d(void 0);}finally{s(!1);}},[]),E=c||l;return useEffect(()=>{b(D);},[D,b]),{filesPreview:f,filePreview:g,uploadFiles:async h=>{if(h?.length){p(!0);try{let x=h[0].type||"application/octet-stream",u=De[x];if(!u)throw new Error(`Tipo de arquivo n\xE3o suportado: ${x}`);let P=await e({files:[{content_type:u,name:h[0].name}]}).unwrap(),R=P.files.map(v=>v.id);return (await Promise.all(h.map(v=>fetch(P.files[0].url,{method:"PUT",headers:{"Content-Type":x},body:v})))).forEach(v=>{if(!v.ok)throw new Error(`Erro no upload: ${v.statusText}`)}),b(P.files),R}catch(x){throw m(x),i(x,"Erro no upload"),x}finally{p(!1);}}},isUploadingFiles:l,isLoadingPreview:c,isUploadOrLoadingFiles:E,uploadFilesError:n}},Ir=Pr;var hr=({sx:e,id:t,name:r,tabIndex:a,uploading:i,getRootProps:l,getInputProps:p,isDragActive:c,isError:s,disabled:n,dropZoneSxProps:m,dropZoneContent:f,children:d,...g})=>jsxs(Ae,{children:[i&&jsx(a$7,{"data-testid":"uploading-progress-bar"}),jsxs(me,{sx:{width:1,position:"relative",...e},children:[jsxs(Xe,{...l(),"data-testid":"drop-zone-styled-area",isError:s,isDragActive:c,disabled:!!n,sx:m,...g,children:[jsx("input",{...p(),id:t,tabIndex:a,name:r}),f]}),d]})]}),K=hr;var Er=({header:e,description:t,sx:r,...a})=>jsxs(ie,{spacing:5,alignItems:"center",justifyContent:"center",direction:{xs:"column",md:"row"},sx:{width:1,textAlign:{xs:"center",md:"left"},...r},...a,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:t||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"]})})]})]}),J=memo(Er);var Rr=({onRemove:e,onReorder:t,onFilesSelect:r,id:a,disabled:i,error:l,helperText:p,files:c,thumbnail:s,dropZoneSxProps:n,uploading:m,tabIndex:f,maxFiles:d,...g})=>{let{files:D,dropzoneProps:b,handleRemove:E}=T({filesToUpload:c,onFilesSelect:r,onRemove:e,dropzoneOptions:{multiple:!0,disabled:i,...g},maxFiles:d}),{getRootProps:F,getInputProps:h,isDragActive:x,isDragReject:u}=b,P=!!D?.length,R=u||!!l;return jsxs(K,{id:a,uploading:m,disabled:i,dropZoneSxProps:n,tabIndex:f,getRootProps:F,getInputProps:h,isDragActive:x,isError:R,dropZoneContent:jsx(J,{}),children:[jsx(U,{disabled:i,helperText:p,isError:R}),P&&jsx(me,{sx:{my:3},children:jsx(ue,{files:D,thumbnail:!!s,onRemove:e?E:void 0,onReorder:t})})]})},Sr=memo(Rr);var Cr=({onFilesSelect:e,onRemove:t,onReorder:r,id:a,disabled:i,error:l,helperText:p,files:c,dropZoneSxProps:s,placeholderProps:n,placeholderAlt:m,uploading:f,tabIndex:d,maxFiles:g,aspectRatio:D,enableCrop:b=!0,convertToWebp:E=!0,cropSize:F,name:h,label:x,...u})=>{let{files:P,dropzoneProps:R,cropState:S,handleRemove:v,aspectRatio:L}=T({filesToUpload:c,onFilesSelect:e,onRemove:t,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!0,disabled:i,...u},enableCrop:b,customAspectRatio:D,convertToWebp:E,maxFiles:g,cropSize:F}),{getRootProps:G,getInputProps:_,isDragActive:O,isDragReject:H}=R,{cropModalOpen:Z,imagePreview:ee,cropLoading:oe,onCropInitialized:re,handleCropSave:C,handleCropCancel:z,currentImageIndex:k,totalPendingImages:N}=S,q=!!P?.length,j=H||!!l,ye=useMemo(()=>{let _e=x??"Ajustar Imagem",Oe=N>1?` (${k} de ${N})`:"";return `${_e}${Oe}`},[x,N,k]);return jsxs(K,{id:a,name:h,uploading:f,disabled:i,dropZoneSxProps:s,tabIndex:d,getRootProps:G,getInputProps:_,isDragActive:O,isError:j,dropZoneContent:jsx(Fragment,{children:m?jsx(ie,{children:m}):jsx(J,{header:n?.header,description:n?.description})}),children:[jsx(U,{disabled:i,helperText:p,isError:j}),q&&jsx(Fragment,{children:jsx(me,{sx:{my:3,ml:.5},children:jsx(ue,{files:P,thumbnail:!0,onRemove:v,onReorder:r})})}),jsx(a$5,{open:Z,onClose:z,label:ye,imageSrc:ee,aspectRatio:L,onInitialized:re,onSave:C,loading:oe,cropSize:F})]})},zr=memo(Cr);var Br=({onFileSelect:e$1,onRemove:t,file:r,id:a,disabled:i,error:l,helperText:p,sx:c,dropZoneSxProps:s,uploading:n,tabIndex:m$1,...f$1})=>{let{file:d,dropzoneProps:g,handleRemove:D}=T({filesToUpload:r,onFileSelect:e$1,onRemove:t,dropzoneOptions:{multiple:!1,disabled:i,...f$1}}),{getRootProps:b,getInputProps:E,isDragActive:F,isDragReject:h}=g,x=useCallback(S=>{S.stopPropagation(),D(d||void 0);},[d,D]),u=!!d,P=typeof d=="string",R=h||!!l;return jsx(K,{id:a,uploading:n,disabled:i,dropZoneSxProps:s,tabIndex:m$1,getRootProps:b,getInputProps:E,isDragActive:F,isError:R,dropZoneContent:jsxs(Fragment,{children:[!u&&jsx(J,{}),u&&jsxs(ie,{component:m.div,...j().inUp,spacing:2,direction:"row",alignItems:"center",sx:{my:1,px:1,py:.75,borderRadius:.75,border:S=>`solid 1px ${S.palette.divider}`,...c},children:[jsx(f,{file:d}),jsxs(ie,{flexGrow:1,sx:{minWidth:0},children:[jsx(ke,{variant:"subtitle2",noWrap:!0,children:P?d:d.name}),jsx(ke,{variant:"caption",sx:{color:"text.secondary"},children:P?"":e(d.size)})]}),t&&jsx(a$3,{title:"Remover arquivo",children:jsx(Ve,{edge:"end",size:"small",disabled:i,"aria-label":"Remover arquivo",onClick:x,children:jsx(a$6,{icon:"DELETE_MARK_BUTTON_02",width:16})})})]})]}),children:jsx(U,{disabled:i,helperText:p,isError:R})})},Gr=memo(Br);var qr=({onRemove:e,onFileSelect:t,file:r,id:a,disabled:i,error:l,helperText:p,dropZoneSxProps:c,placeholderProps:s,placeholderAlt:n,uploading:m,tabIndex:f,aspectRatio:d,enableCrop:g=!0,convertToWebp:D=!0,name:b,label:E,cropSize:F,...h})=>{let[x,u]=useState(!1),{file:P,dropzoneProps:R,cropState:S,handleRemove:v,aspectRatio:L}=T({filesToUpload:r,onFileSelect:t,onRemove:e,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:i,...h},enableCrop:g,customAspectRatio:d,convertToWebp:D,cropSize:F}),{getRootProps:G,getInputProps:_,isDragActive:O,isDragReject:H}=R,{cropModalOpen:Z,imagePreview:ee,cropLoading:oe,onCropInitialized:re,handleCropSave:C,handleCropCancel:z}=S,k=useCallback(()=>{v(P||void 0);},[P,v]),N=!!P,q=H||!!l,j=N?{opacity:0}:{opacity:1};return jsxs(Ae,{children:[(m||x)&&jsx(a$7,{}),jsxs(K,{id:a,uploading:m,disabled:i,dropZoneSxProps:c,tabIndex:f,getRootProps:G,getInputProps:_,isDragActive:O,isError:q,name:b,dropZoneContent:jsxs(Fragment,{children:[n?jsx(ie,{sx:j,children:n}):jsx(J,{sx:j,header:s?.title,description:s?.description}),N&&jsx(ze,{file:P,cropSize:F,isLoading:x,isUploading:m,onLoading:u,aspectRatio:L})]}),children:[jsx(U,{disabled:i,helperText:p,isError:q}),N&&e&&jsx(Qe,{size:"small",onClick:k,disabled:i,label:"Remover arquivo",children:jsx(a$6,{icon:"DELETE_MARK_BUTTON_02",width:16})}),jsx(a$5,{open:Z,onClose:z,label:E??"Ajustar Imagem",imageSrc:ee,aspectRatio:L,onInitialized:re,onSave:C,loading:oe,cropSize:F})]})]})},Xr=memo(qr);var et=({onFileSelect:e,onRemove:t,file:r,disabled:a,label:i,id:l,tabIndex:p,error:c,helperText:s,sx:n,name:m,maxSize:f,uploading:d,aspectRatio:g=1,enableCrop:D=!0,convertToWebp:b=!0,cropSize:E,...F})=>{let[h,x]=useState(!1),{file:u,dropzoneProps:P,cropState:R,handleRemove:S}=T({filesToUpload:r,onFileSelect:e,onRemove:t,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:a,maxSize:f,...F},enableCrop:D,customAspectRatio:g,convertToWebp:b,cropSize:E}),{getRootProps:v,getInputProps:L,isDragActive:G,isDragReject:_}=P,{cropModalOpen:O,imagePreview:H,cropLoading:Z,onCropInitialized:ee,handleCropSave:oe,handleCropCancel:re}=R,C=_||!!c,z=h||d,k=!!t,N=useMemo(()=>u?(x(!0),URL.createObjectURL(u)):"",[u]),q=()=>{x(!1);},j=()=>k&&u?()=>S(u):v().onClick;return jsxs(Fragment,{children:[jsxs(ao,{sx:n,isError:C,isDragActive:G,hasFile:!!u,...v(),onClick:j(),children:[jsxs(to,{children:[u&&jsx(no,{alt:"Avatar Preview",src:N,onLoad:q,...z&&{sx:{filter:"blur(5px) !important",scale:1.2,opacity:.7}}}),u&&z&&jsx(io,{children:jsx(Yr,{size:135,thickness:1,color:"primary"})}),!u&&!z&&jsxs(Ce,{isError:C,hasFile:!1,children:[jsx(a$6,{icon:"ADD_IMAGE",width:32}),jsx(ke,{variant:"caption",textAlign:"center",sx:{color:C?"error.main":"text.disabled"},children:"Adicionar foto"})]}),u&&!z&&jsxs(Ce,{isError:C,hasFile:!0,children:[jsx(a$6,{icon:k?"DELETE_MARK_BUTTON_02":"ADD_IMAGE",width:32}),jsx(ke,{variant:"caption",textAlign:"center",sx:{color:C?"error.main":"common.white"},children:k?"Remover foto":"Alterar foto"})]})]}),jsx("input",{name:m,id:l,tabIndex:p,...L()}),jsx(ie,{spacing:.5,sx:{pt:1},children:jsx(U,{helperText:s,disabled:a,isError:C})}),u&&!z&&jsx(ie,{direction:"row",justifyContent:"center",spacing:1,sx:{pt:1,mb:-1},children:jsx(ke,{variant:"caption",component:"span",sx:{px:.75,cursor:"pointer",borderRadius:.75,color:"error.main","&:hover":{color:"error.dark",bgcolor:"background.default"}},onClick:()=>S(u),children:"Remover"})})]}),O&&H&&jsx(a$5,{open:O,onClose:re,label:i??"Ajustar Imagem",imageSrc:H,aspectRatio:g,onInitialized:ee,onSave:oe,loading:Z,cropSize:E,cropShape:"round"})]})},ot=memo(et);var at=({error:e,name:t,disabled:r,sx:a,...i})=>{let{getRootProps:l,getInputProps:p,isDragActive:c,isDragReject:s}=useDropzone({disabled:r,...i}),n=s||e;return jsxs(Ye,{...l(),isDragActive:c,hasError:!!n,disabled:!!r,sx:a,"data-testid":"upload-box",children:[jsx("input",{name:t,...p()}),"Selecionar arquivo"]})},nt=memo(at);
36
36
 
37
37
  export { Ue as ContentType, De as FileContentType, U as HelperText, ue as MultiFilePreview, Sr as MultipleFileUpload, zr as MultipleImageUpload, ze as SingleFilePreview, Gr as SingleFileUpload, Xr as SingleImageUpload, ot as UploadAvatar, nt as UploadSimpleBox, Io as convertToWebP, ui as isImageFile, T as useDropzoneUploader, Ir as useFileUploadService };
@@ -443,7 +443,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
443
443
  wordWrap?: csstype.Property.WordWrap | readonly NonNullable<csstype.Property.WordWrap | undefined>[] | readonly csstype.Property.WordWrap[] | undefined;
444
444
  writingMode?: csstype.Property.WritingMode | readonly NonNullable<csstype.Property.WritingMode | undefined>[] | readonly csstype.Property.WritingMode[] | undefined;
445
445
  zIndex?: csstype.Property.ZIndex | readonly NonNullable<csstype.Property.ZIndex | undefined>[] | readonly ((string & {}) | csstype.Globals | "auto")[] | undefined;
446
- zoom?: csstype.Property.Zoom | readonly NonNullable<csstype.Property.Zoom | undefined>[] | readonly ("reset" | (string & {}) | csstype.Globals | "normal")[] | undefined;
446
+ zoom?: csstype.Property.Zoom | readonly NonNullable<csstype.Property.Zoom | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reset")[] | undefined;
447
447
  all?: csstype.Globals | readonly NonNullable<csstype.Globals | undefined>[] | readonly csstype.Globals[] | undefined;
448
448
  animation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reverse" | "auto" | "none" | "both" | "alternate" | "alternate-reverse" | "backwards" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
449
449
  animationRange?: csstype.Property.AnimationRange<string | number> | readonly NonNullable<csstype.Property.AnimationRange<string | number> | undefined>[] | readonly (string | (string & {}))[] | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zydon/common",
3
- "version": "2.4.42",
3
+ "version": "2.4.43",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",