2 lines
154 KiB
JavaScript
2 lines
154 KiB
JavaScript
|
|
const e=4294967295,t=65535,A=255,r=67324752,s=134695760,n=s,a=33639248,i=101010256,o=101075792,g=117853008,c=22,d=21589,l=2048,B=16384,p=2048,m=1024,h=512,u="/",E=30,f=new Date(2107,11,31),w=new Date(1980,0,1),I=void 0,C=1/0,Q="undefined",y="function";let x=2;try{typeof navigator!=Q&&navigator.hardwareConcurrency&&(x=navigator.hardwareConcurrency)}catch{}const D={workerURI:"./core/web-worker-wasm.js",wasmURI:"./core/streams/zlib-wasm/zlib-streams.wasm",chunkSize:65536,maxWorkers:x,terminateWorkerTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,CompressionStream:typeof CompressionStream!=Q&&CompressionStream,DecompressionStream:typeof DecompressionStream!=Q&&DecompressionStream},b=Object.assign({},D);function v(){return b}function F(e){return Math.max(e.chunkSize,64)}function S(e){const{baseURI:t,chunkSize:A,maxWorkers:r,terminateWorkerTimeout:s,useCompressionStream:n,useWebWorkers:a,CompressionStream:i,DecompressionStream:o,CompressionStreamZlib:g,DecompressionStreamZlib:c,workerURI:d,wasmURI:l}=e;Y("baseURI",t),Y("wasmURI",l),Y("workerURI",d),Y("chunkSize",A),Y("maxWorkers",r),Y("terminateWorkerTimeout",s),Y("useCompressionStream",n),Y("useWebWorkers",a),Y("CompressionStream",i),Y("DecompressionStream",o),Y("CompressionStreamZlib",g),Y("DecompressionStreamZlib",c)}function Y(e,t){t!==I&&(b[e]=t)}const G=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)1&t?t=t>>>1^3988292384:t>>>=1;G[e]=t}class k{constructor(e){this.crc=e||-1}append(e){let t=0|this.crc;for(let A=0,r=0|e.length;r>A;A++)t=t>>>8^G[255&(t^e[A])];this.crc=t}get(){return~this.crc}}class M extends TransformStream{constructor(){let e;const t=new k;super({transform(e,A){t.append(e),A.enqueue(e)},flush(){const A=new Uint8Array(4);new DataView(A.buffer).setUint32(0,t.get()),e.value=A}}),e=this}}function U(e){if(typeof TextEncoder==Q){e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let A=0;A<t.length;A++)t[A]=e.charCodeAt(A);return t}return(new TextEncoder).encode(e)}const R={concat(e,t){if(0===e.length||0===t.length)return e.concat(t);const A=e[e.length-1],r=R.getPartial(A);return 32===r?e.concat(t):R._shiftRight(t,r,0|A,e.slice(0,e.length-1))},bitLength(e){const t=e.length;if(0===t)return 0;const A=e[t-1];return 32*(t-1)+R.getPartial(A)},clamp(e,t){if(32*e.length<t)return e;const A=(e=e.slice(0,Math.ceil(t/32))).length;return t&=31,A>0&&t&&(e[A-1]=R.partial(t,e[A-1]&2147483648>>t-1,1)),e},partial:(e,t,A)=>32===e?t:(A?0|t:t<<32-e)+1099511627776*e,getPartial:e=>Math.round(e/1099511627776)||32,_shiftRight(e,t,A,r){for(void 0===r&&(r=[]);t>=32;t-=32)r.push(A),A=0;if(0===t)return r.concat(e);for(let s=0;s<e.length;s++)r.push(A|e[s]>>>t),A=e[s]<<32-t;const s=e.length?e[e.length-1]:0,n=R.getPartial(s);return r.push(R.partial(t+n&31,t+n>32?A:r.pop(),1)),r}},z={bytes:{fromBits(e){const t=R.bitLength(e)/8,A=new Uint8Array(t);let r;for(let s=0;t>s;s++)3&s||(r=e[s/4]),A[s]=r>>>24,r<<=8;return A},toBits(e){const t=[];let A,r=0;for(A=0;A<e.length;A++)r=r<<8|e[A],3&~A||(t.push(r),r=0);return 3&A&&t.push(R.partial(8*(3&A),r)),t}}},H=class{constructor(e){const t=this;t.blockSize=512,t._init=[1732584193,4023233417,2562383102,271733878,3285377520],t._key=[1518500249,1859775393,2400959708,3395469782],e?(t._h=e._h.slice(0),t._buffer=e._buffer.slice(0),t._length=e._length):t.reset()}reset(){const e=this;return e._h=e._init.slice(0),e._buffer=[],e._length=0,e}update(e){const t=this;"string"==typeof e&&(e=z.utf8String.toBits(e));const A=t._buffer=R.concat(t._buffer,e),r=t._length,s=t._length=r+R.bitLength(e);if(s>9007199254740991)throw Error("Cannot hash more than 2^53 - 1 bits");const n=new Uint32Array(A);let a=0;for(let e=t.blockSize+r-(t.blockSize+r&t.blockSize-1);s>=e;e+=t.blockSize)t._block(n.subarray(16*a,16*(a+1))),a+=1;return A.splice(0,16*a),t}finalize(){const e=this;let t=e._buffer;const A=e._h;t=R.concat(t,[R.partial(1,1)]);for(let e=t.length+2;15&e;e++)t.push(0);for(t.push(Math.floor(e._length/4294967296)),t.push(0|e._length);t.length;)e._block(t.splice(0,16));return e.reset(),A}_f(e,t,A,r){return e>19?e>39?e>59?e>79?void 0:t^A^r:t&A|t&r|A&r:t
|