inkyboo/lzma.min.js

3 lines
34 KiB
JavaScript
Raw Normal View History

2020-02-13 15:02:17 +00:00
/** Copied from https://cdn.jsdelivr.net/npm/lzma@2.3.2/src/lzma_worker.min.js *//
var LzmaMin=function(){"use strict";function e(e, r){postMessage({action:De,cbn:r,result:e})}function r(e){var r=[];return r[e-1]=void 0,r}function t(e, r){return s(e[0]+r[0],e[1]+r[1])}function o(e, r){return function(e, r){var t,o;t=e*we,o=r,r<0&&(o+=we);return[o,t]}(~~Math.max(Math.min(e[1]/we,2147483647),-2147483648)&~~Math.max(Math.min(r[1]/we,2147483647),-2147483648),a(e)&a(r))}function n(e, r){var t,o;return e[0]==r[0]&&e[1]==r[1]?0:(t=e[1]<0,o=r[1]<0,t&&!o?-1:!t&&o?1:m(e,r)[1]<0?-1:1)}function s(e, r){var t,o;for(e%=0x10000000000000000,r=(r%=0x10000000000000000)-(t=r%we)+(o=Math.floor(e/we)*we),e=e-o+t; e<0;)e+=we,r-=we;for(; e>4294967295;)e-=we,r+=we;for(r%=0x10000000000000000; r>0x7fffffff00000000;)r-=0x10000000000000000;for(; r<-0x8000000000000000;)r+=0x10000000000000000;return[e,r]}function i(e, r){return e[0]==r[0]&&e[1]==r[1]}function _(e){return e>=0?[e,0]:[e+we,-we]}function a(e){return e[0]>=2147483648?~~Math.max(Math.min(e[0]-we,2147483647),-2147483648):~~Math.max(Math.min(e[0],2147483647),-2147483648)}function c(e){return e<=30?1<<e:c(30)*c(e-30)}function u(e, r){var t,o,n,s;if(r&=63,i(e,Le))return r?ye:e;if(e[1]<0)throw new Error("Neg");return s=c(r),o=e[1]*s%0x10000000000000000,n=e[0]*s,t=n-n%we,o+=t,n-=t,o>=0x8000000000000000&&(o-=0x10000000000000000),[n,o]}function f(e, r){var t;return r&=63,t=c(r),s(Math.floor(e[0]/t),e[1]/t)}function m(e, r){return s(e[0]-r[0],e[1]-r[1])}function d(e, r){return e.buf=r,e.pos=0,e.count=r.length,e}function p(e){return e.pos>=e.count?-1:255&e.buf[e.pos++]}function h(e, r, t, o){return e.pos>=e.count?-1:(o=Math.min(o,e.count-e.pos),S(e.buf,e.pos,r,t,o),e.pos+=o,o)}function P(e){return e.buf=r(32),e.count=0,e}function l(e){var r=e.buf;return r.length=e.count,r}function v(e, r){e.buf[e.count++]=r<<24>>24}function B(e, r, t, o){S(r,t,e.buf,e.count,o),e.count+=o}function S(e, r, t, o, n){for(var s=0; s<n; ++s)t[o+s]=e[r+s]}function g(e, t, o, s, i){var _,c;if(n(s,Ee)<0)throw new Error("invalid length "+s);for(e.length_0=s,function(e, r){!function(e, r){e._dictionarySize=r;for(var t=0; r>1<<t; ++t);e._distTableSize=2*t}(r,1<<e.s),r._numFastBytes=e.f,function(e, r){var t=e._matchFinderType;e._matchFinderType=r,e._matchFinder&&t!=e._matchFinderType&&(e._dictionarySizePrev=-1,e._matchFinder=null)}(r,e.m),r._numLiteralPosStateBits=0,r._numLiteralContextBits=3,r._posStateBits=2,r._posStateMask=3}(i,_=function(e){var t;for(e._repDistances=r(4),e._optimum=[],e._rangeEncoder={},e._isMatch=r(192),e._isRep=r(12),e._isRepG0=r(12),e._isRepG1=r(12),e._isRepG2=r(12),e._isRep0Long=r(192),e._posSlotEncoder=[],e._posEncoders=r(114),e._posAlignEncoder=ue({},4),e._lenEncoder=re({}),e._repMatchLenEncoder=re({}),e._literalEncoder={},e._matchDistances=[],e._posSlotPrices=[],e._distancesPrices=[],e._alignPrices=r(16),e.reps=r(4),e.repLens=r(4),e.processedInSize=[ye],e.processedOutSize=[ye],e.finished=[0],e.properties=r(5),e.tempPrices=r(128),e._longestMatchLength=0,e._matchFinderType=1,e._numDistancePairs=0,e._numFastBytesPrev=-1,e.backRes=0,t=0; t<4096; ++t)e._optimum[t]={};for(t=0; t<4; ++t)e._posSlotEncoder[t]=ue({},6);return e}({})),_._writeEndMark=void 0===LzmaMin.disableEndMark,function(e, r){e.properties[0]=9*(5*e._posStateBits+e._numLiteralPosStateBits)+e._numLiteralContextBits<<24>>24;for(var t=0; t<4; ++t)e.properties[1+t]=e._dictionarySize>>8*t<<24>>24;B(r,e.properties,0,5)}(_,o),c=0; c<64; c+=8)v(o,255&a(f(s,c)));e.chunker=(_._needReleaseMFStream=0,_._inStream=t,_._finished=0,function(e){var t,o;e._matchFinder||(t={},o=4,e._matchFinderType||(o=2),function(e, r){e.HASH_ARRAY=r>2,e.HASH_ARRAY?(e.kNumHashDirectBytes=0,e.kMinMatchCheck=4,e.kFixHashSize=66560):(e.kNumHashDirectBytes=2,e.kMinMatchCheck=3,e.kFixHashSize=0)}(t,o),e._matchFinder=t);if(function(e, t, o){var n,s;if(null==e.m_Coders||e.m_NumPrevBits!=o||e.m_NumPosBits!=t)for(e.m_NumPosBits=t,e.m_PosMask=(1<<t)-1,e.m_NumPrevBits=o,s=1<<e.m_NumPrevBits+e.m_NumPosBits,e.m_Coders=r(s),n=0; n<s; ++n)e.m_Coders[n]=function(e){return e.m_Encoders=r(768),e}({})}(e._literalEncoder,e._numLiteralPosStateBits,e._numLiteralContextBits),e._