forked from fengdh/mdict-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
minilzo-decompress.min.js
1 lines (1 loc) · 2.08 KB
/
minilzo-decompress.min.js
1
!function(e,i){function t(){return{require:function(e){var i=this.c-this.l+e;if(i>0){var t=new Uint8Array(this.l+=this.blockSize*Math.ceil(i/this.blockSize));t.set(this.buf),this.buf=t}return this.c+=e,this.buf},alloc:function(e,i){return this.blockSize=this.roundUp(i||4096),this.c=0,this.l=0|this.roundUp(e),this.l+=this.blockSize-this.l%this.blockSize,this.buf=new Uint8Array(this.l),this.buf},roundUp:function(e){var i=e%4;return 0===i?e:e+4-i},reset:function(){this.c=0,this.l=this.buf.length},pack:function(e){return this.buf.subarray(0,e)}}}i(function(){return r});var r=function(){function e(e,i){{var t=1,r=2,n=3,u=4,o=5,f=6,c=i.buf,s=0,h=0,l=e[h],a=t,b=0;e.length}if(l>17)if(h++,l-=17,4>l)a=f;else{c=i.require(l);do c[s++]=e[h++];while(--l>0);a=r}e:for(;;){var d=!1;switch(a){case t:if(l=e[h++],l>=16){a=n;continue e}if(0===l){for(;0===e[h];)l+=255,h++;l+=15+e[h++]}l+=3,c=i.require(l);do c[s++]=e[h++];while(--l>0);case r:if(l=e[h++],l>=16){a=n;continue e}b=s-2049-(l>>2)-(e[h++]<<2),c=i.require(3),c[s++]=c[b++],c[s++]=c[b++],c[s++]=c[b],a=o;continue e;case n:if(l>=64){b=s-1-(l>>2&7)-(e[h++]<<3),l=(l>>5)-1,a=u;continue e}if(l<32){if(16>l){b=s-1-(l>>2)-(e[h++]<<2),c=i.require(2),c[s++]=c[b++],c[s++]=c[b],a=o;continue e}if(b=s-((8&l)<<11),l&=7,0===l){for(;0===e[h];)l+=255,h++;l+=7+e[h++]}if(b-=e[h]+(e[h+1]<<8)>>2,h+=2,b===s)break e;b-=16384}else{if(l&=31,0===l){for(;0===e[h];)l+=255,h++;l+=31+e[h++]}b=s-1-(e[h]+(e[h+1]<<8)>>2),h+=2}if(l>=6&&s-b>=4){d=!0,l+=2,c=i.require(l);do c[s++]=c[b++];while(--l>0)}case u:if(!d){l+=2,c=i.require(l);do c[s++]=c[b++];while(--l>0)}case o:if(l=3&e[h-2],0===l){a=t;continue e}case f:c=i.require(1),c[s++]=e[h++],l>1&&(c=i.require(1),c[s++]=e[h++],l>2&&(c=i.require(1),c[s++]=e[h++])),l=e[h++],a=n;continue e}}return i.pack(s)}return{decompress:function(i,t){var r;return t.require instanceof Function?(r=t,r.reset()):r=this.createFlexBuffer(t.initSize||i.length,t.blockSize||8192),e(i,r)},createFlexBuffer:function(e,i){var r=t();return r.alloc(e,i),r}}}()}(this,"object"==typeof module&&"function"!=typeof define?function(e){module.exports=e(require,exports,module)}:define);