1const h=new Error("failed to get response body reader"),u=new Error("failed to complete download"),R="Content-Length",g=e=>new Promise((t,n)=>{const a=new FileReader;a.onload=()=>{const{result:r}=a;r instanceof ArrayBuffer?t(new Uint8Array(r)):t(new Uint8Array)},a.onerror=r=>{var o,c;n(Error(`File could not be read! Code=${((c=(o=r==null?void 0:r.target)==null?void 0:o.error)==null?void 0:c.code)||-1}`))},a.readAsArrayBuffer(e)}),p=async e=>{let t;if(typeof e=="string")/data:_data\/([a-zA-Z]*);base64,([^"]*)/.test(e)?t=atob(e.split(",")[1]).split("").map(n=>n.charCodeAt(0)):t=await(await fetch(e)).arrayBuffer();else if(e instanceof URL)t=await(await fetch(e)).arrayBuffer();else if(e instanceof File||e instanceof Blob)t=await g(e);else return new Uint8Array;return new Uint8Array(t)},b=async(e,t)=>{var r;const n=await fetch(e);let a;try{const o=parseInt(n.headers.get(R)||"-1"),c=(r=n.body)==null?void 0:r.getReader();if(!c)throw h;const l=[];let d=0;for(;;){const{done:s,value:i}=await c.read(),f=i?i.length:0;if(s){if(o!=-1&&o!==d)throw u;t&&t({url:e,total:o,received:d,delta:f,done:s});break}l.push(i),d+=f,t&&t({url:e,total:o,received:d,delta:f,done:s})}const w=new Uint8Array(d);let y=0;for(const s of l)w.set(s,y),y+=s.length;a=w.buffer}catch(o){console.log("failed to send download progress event: ",o),a=await n.arrayBuffer(),t&&t({url:e,total:a.byteLength,received:a.byteLength,delta:0,done:!0})}return a},A=async(e,t,n=!1,a)=>{const r=n?await b(e,a):await(await fetch(e)).arrayBuffer(),o=new Blob([r],{type:t});return URL.createObjectURL(o)};export{b as downloadWithProgress,p as fetchFile,A as toBlobURL};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.