diff --git a/assets/index-CRman348.js b/assets/index-GL9GhlXX.js similarity index 93% rename from assets/index-CRman348.js rename to assets/index-GL9GhlXX.js index 1b9f32f..6b5d900 100644 --- a/assets/index-CRman348.js +++ b/assets/index-GL9GhlXX.js @@ -13,7 +13,7 @@ async function loadImage(offset, size, index) { const blob = new Blob([view], {}); const imageBitmap = await createImageBitmap(blob); postMessage({msg: 'done', imageBitmap, index}, [imageBitmap]); -}`;class L{constructor(e,t={}){o(this,"fileInfo",[]);o(this,"buffer");o(this,"options");o(this,"worker");o(this,"resolve",[]);o(this,"defaultOptions",{useWorker:!0});this.buffer=e,this.options={...this.defaultOptions,...t};let i=0;for(;it.name==e)}getImage(e,t){return this.options.useWorker?(this.worker||(this.worker=this.createWorker()),new Promise((i,a)=>{const s=this.getInfo(e);s&&!this.resolve[t]?(this.resolve[t]=i,this.worker.postMessage({cmd:"load",offset:s.header_offset+512,size:s.size,index:t})):a()})):new Promise((i,a)=>{const s=this.getBlob(e,"image");s!==void 0?createImageBitmap(s).then(r=>{i(r)}).catch(()=>{a()}):a()})}readFileName(e){const t=new Uint8Array(this.buffer,e,100),i=t.indexOf(0);return new TextDecoder().decode(t.slice(0,i))}readFileSize(e){const t=new Uint8Array(this.buffer,e+124,12);let i="";for(let a=0;a<11;a++)i+=String.fromCharCode(t[a]);return parseInt(i,8)}getBlob(e,t=""){const i=this.getInfo(e);if(i){const a=new Uint8Array(this.buffer,i.header_offset+512,i.size);return new Blob([a],{type:t})}}createWorker(){const e=new Blob([y],{type:"application/javascript"}),t=new Worker(URL.createObjectURL(e));return t.addEventListener("message",i=>{const a=this.resolve[i.data.index];this.resolve[i.data.index]=void 0,a?a(i.data.imageBitmap):i.data.imageBitmap.close()}),t.postMessage({cmd:"init",buffer:this.buffer},[this.buffer]),t}}const x=`self.onmessage = async (e) => { +}`;class L{constructor(e,t={}){o(this,"fileInfo",[]);o(this,"buffer");o(this,"options");o(this,"worker");o(this,"resolve",[]);o(this,"defaultOptions",{useWorker:!0});this.buffer=e,this.options={...this.defaultOptions,...t};let i=0;for(;it.name.includes(e))}getImage(e,t){return this.options.useWorker?(this.worker||(this.worker=this.createWorker()),new Promise((i,a)=>{const s=this.getInfo(e);s&&!this.resolve[t]?(this.resolve[t]=i,this.worker.postMessage({cmd:"load",offset:s.header_offset+512,size:s.size,index:t})):a()})):new Promise((i,a)=>{const s=this.getBlob(e,"image");s!==void 0?createImageBitmap(s).then(r=>{i(r)}).catch(()=>{a()}):a()})}readFileName(e){const t=new Uint8Array(this.buffer,e,100),i=t.indexOf(0);return new TextDecoder().decode(t.slice(0,i))}readFileSize(e){const t=new Uint8Array(this.buffer,e+124,12);let i="";for(let a=0;a<11;a++)i+=String.fromCharCode(t[a]);return parseInt(i,8)}getBlob(e,t=""){const i=this.getInfo(e);if(i){const a=new Uint8Array(this.buffer,i.header_offset+512,i.size);return new Blob([a],{type:t})}}createWorker(){const e=new Blob([y],{type:"application/javascript"}),t=new Worker(URL.createObjectURL(e));return t.addEventListener("message",i=>{const a=this.resolve[i.data.index];this.resolve[i.data.index]=void 0,a?a(i.data.imageBitmap):i.data.imageBitmap.close()}),t.postMessage({cmd:"init",buffer:this.buffer},[this.buffer]),t}}const x=`self.onmessage = async (e) => { if (e.data.cmd === 'load') { await loadImage(e.data.url, e.data.index); } diff --git a/index.html b/index.html index 291411c..0d12b22 100644 --- a/index.html +++ b/index.html @@ -52,7 +52,7 @@ margin: 0; } - +