import{n as e,r as t,t as n}from"./pdf.worker.min-BImVOIwN.js";e.workerSrc=n;async function r(e,n=1,r=8,i=1.4){let a=await t({data:e.slice(0)}).promise,o=a.numPages,s=Math.min(o,n+r-1),c=[];for(let e=n;e<=s;e++){let t=await a.getPage(e),n=t.getViewport({scale:i}),r=document.createElement(`canvas`);r.width=n.width,r.height=n.height;let o=r.getContext(`2d`);await t.render({canvasContext:o,viewport:n,canvas:r}).promise,c.push(r.toDataURL(`image/jpeg`,.8))}return a.destroy?.(),{images:c,totalPages:o}}function i(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}export{r as n,i as t};