| 1 |
- function c(o){const r=o.split(","),a=r[0].match(/:(.*?);/)[1],t=window.atob(r[1]);let e=t.length;const n=new Uint8Array(e);for(;e--;)n[e]=t.charCodeAt(e);return new Blob([n],{type:a})}function l(o,r){return new Promise((s,a)=>{let t=document.createElement("CANVAS");const e=t.getContext("2d"),n=new Image;n.crossOrigin="",n.onload=function(){if(!t||!e)return a();t.height=n.height,t.width=n.width,e.drawImage(n,0,0);const i=t.toDataURL("image/png");t=null,s(i)},n.src=o})}function u(o){return new Promise((r,s)=>{o||s();const a=new FileReader;a.readAsDataURL(o),a.onload=function(t){const e=t.target.result;r(e)}})}export{c as d,u as f,l as u};
|