Loading
function(e,t,n){"use strict";n.d(t,{Ay:()=>p,UD:()=>d}),n(321073);var l=n(627968),i=n(64700),s=n(192308),r=n(780777),a=n(946274),o=n(73621),u=n(693591);async function c(e){try{let t=await new Promise((t,n)=>{if(null!=e){let l=new FileReader;l.onload=e=>{"string"==typeof e.target?.result?t(e.target.result):n(Error("Failed to read file"))},l.readAsDataURL(e)}}),n=new Image;return n.src=t,await n.decode(),{image:n,dataURI:t}}catch{throw o.o.WRONG_TYPE}}async function d(e,t){let n=[];for(let l=0;l<e.length;l++){let i=e[l];try{let{image:e,dataURI:l}=await c(i),s=i.type===u.a.MP4?await t(l,i):await t(l,i,e);null!=s&&n.push({type:s,filename:i.name})}catch(e){n.push({type:e,filename:i.name})}}n.length>0&&m(n)}let m=e=>{(0,s.openModalLazy)(async()=>{let{default:t}=await Promise.all([n.e("80620"),n.e("84981")]).then(n.bind(n,940372));return n=>(0,l.jsx)(t,{errors:e,...n})})},h=i.forwardRef((e,t)=>{let{onChange:o,multiple:u=!0,disabled:c,className:m,tabIndex:h=-1,"aria-label":p,filters:f,setLoading:g,title:E}=e,A=i.useRef(null),[C,x]=i.useState(!1);i.useEffect(()=>{C&&I()},[C]);let I=()=>{null!==A.current&&((0,s.closeModal)(A.current),A.current=null)},_=async e=>{g?.(!0),await d(e,o),x(!0),g?.(!1)},S=async e=>{if(e.stopPropagation(),e.preventDefault(),e.currentTarget?.files==null||e.currentTarget?.files?.length===0)return;let t=e.currentTarget.files;A.current=await (0,s.openModalLazy)(async()=>{let{default:e}=await Promise.all([n.e("54368"),n.e("17259")]).then(n.bind(n,897126));return n=>(0,l.jsx)(e,{processFiles:()=>_(t),...n})})};return(0,l.jsx)(r.A,{ref:t,onChange:S,filters:f??(0,a.gA)(),multiple:u,disabled:c,className:m,tabIndex:h,"aria-label":p,title:E})});h.displayName="ImageInputWithModals";let p=h}