function u(r){return new Promise((a,i)=>{let t=new FileReader;t.onload=e=>{var n;a((n=e.target)==null?void 0:n.result)},t.onerror=e=>{i(Error(`Failed to read blob: ${e.type}`))},t.readAsDataURL(r)})}function b(r){return new Promise((a,i)=>{var t;try{let[e,n]=r.split(",",2),d=(t=/^data:(.+);base64$/.exec(e))==null?void 0:t[1],l=atob(n),s=l.length,c=new Uint8Array(s);for(let o=0;o<s;o++)c[o]=l.charCodeAt(o);a(new Blob([c],{type:d}))}catch(e){i(f(e))}})}function f(r){return r instanceof Error?r:Error(`${r}`)}export{u as n,b as t};
