1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-10 03:50:01 +00:00
calibre-web/cps/static/js/compress/libunrar.js

435 lines
807 KiB
JavaScript
Raw Normal View History

// Copyright (c) 2015-2017 Matthew Brennan Jones <matthew.brennan.jones@gmail.com>
// Copyright (c) 2015 wcchoi
// Copyright (c) 1993-2013 Alexander L. Roshal
// This software is licensed under a MIT License
// UnRAR is licensed as freeware. See license_UnRAR.txt
// https://github.com/workhorsy/uncompress.js
// Forked from:
// https://github.com/wcchoi/libunrar-js
// UnRAR C++ source code from
// https://www.rarlab.com/rar_add.htm
var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function";var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=nodeFS["readFileSync"](filename);if(!ret&&filename!=nodePath["resolve"](filename)){filename=path.join(__dirname,"..","src",filename);ret=nodeFS["readFileSync"](filename)}if(ret&&!binary)ret=ret.toString();return ret};Module["readBinary"]=function readBinary(filename){return Module["read"](filename,true)};Module["load"]=function load(f){globalEval(read(f))};if(!Module["thisProgram"]){if(process["argv"].length>1){Module["thisProgram"]=process["argv"][1].replace(/\\/g,"/")}else{Module["thisProgram"]="unknown-program"}}Module["arguments"]=process["argv"].slice(2);if(typeof module!=="undefined"){module["exports"]=Module}process["on"]("uncaughtException",(function(ex){if(!(ex instanceof ExitStatus)){throw ex}}))}else if(ENVIRONMENT_IS_SHELL){if(!Module["print"])Module["print"]=print;if(typeof printErr!="undefined")Module["printErr"]=printErr;if(typeof read!="undefined"){Module["read"]=read}else{Module["read"]=function read(){throw"no read() available (jsc?)"}}Module["readBinary"]=function readBinary(f){if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}var data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){Module["arguments"]=scriptArgs}else if(typeof arguments!="undefined"){Module["arguments"]=arguments}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){Module["read"]=function read(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof console!=="undefined"){if(!Module["print"])Module["print"]=function print(x){console.log(x)};if(!Module["printErr"])Module["printErr"]=function printErr(x){console.log(x)}}else{var TRY_USE_DUMP=false;if(!Module["print"])Module["print"]=TRY_USE_DUMP&&typeof dump!=="undefined"?(function(x){dump(x)}):(function(x){})}if(ENVIRONMENT_IS_WORKER){Module["load"]=importScripts}if(typeof Module["setWindowTitle"]==="undefined"){Module["setWindowTitle"]=(function(title){document.title=title})}}else{throw"Unknown runtime environment. Where are we?"}function globalEval(x){eval.call(null,x)}if(!Module["load"]&&Module["read"]){Module["load"]=function load(f){globalEval(Module["read"](f))}}if(!Module["print"]){Module["print"]=(function(){})}if(!Module["printErr"]){Module["printErr"]=Module["print"]}if(!Module["arguments"]){Module["arguments"]=[]}if(!Module["thisProgram"]){Module["thisProgram"]="./this.program"}Module.print=Module["print"];Module.printErr=Module["printErr"];Module["preRun"]=[];Module["postRun"]=[];for(var key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}var Runtime={setTempRet0:(function(value){tempRet0=value}),getTempRet0:(function(){return tempRet0}),stackSave:(function(){return STACKTOP}),stackRestore:(function(stackTop){STACKTOP=stackTop}),getNativeTypeSize:(function(type){switch(type){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(type[type.length-1]==="*"){return Runtime.QUANTUM_SIZE}else if(type[0]==="i"){var bits=parseInt(type.substr(1));assert(bits%8===0);return bits/8}else{return 0}}}}),getNativeFieldSize:(function(type){return Math.max(Runtime.getNativeType
var asm=(function(global,env,buffer) {
"use asm";var a=global.Int8Array;var b=global.Int16Array;var c=global.Int32Array;var d=global.Uint8Array;var e=global.Uint16Array;var f=global.Uint32Array;var g=global.Float32Array;var h=global.Float64Array;var i=new a(buffer);var j=new b(buffer);var k=new c(buffer);var l=new d(buffer);var m=new e(buffer);var n=new f(buffer);var o=new g(buffer);var p=new h(buffer);var q=global.byteLength;var r=env.STACKTOP|0;var s=env.STACK_MAX|0;var t=env.tempDoublePtr|0;var u=env.ABORT|0;var v=env.cttz_i8|0;var w=env.___dso_handle|0;var x=env._stderr|0;var y=env._stdin|0;var z=0;var A=0;var B=0;var C=0;var D=global.NaN,E=global.Infinity;var F=0,G=0,H=0,I=0,J=0.0,K=0,L=0,M=0,N=0.0;var O=0;var P=0;var Q=0;var R=0;var S=0;var T=0;var U=0;var V=0;var W=0;var X=0;var Y=global.Math.floor;var Z=global.Math.abs;var _=global.Math.sqrt;var $=global.Math.pow;var aa=global.Math.cos;var ba=global.Math.sin;var ca=global.Math.tan;var da=global.Math.acos;var ea=global.Math.asin;var fa=global.Math.atan;var ga=global.Math.atan2;var ha=global.Math.exp;var ia=global.Math.log;var ja=global.Math.ceil;var ka=global.Math.imul;var la=global.Math.min;var ma=global.Math.clz32;var na=env.abort;var oa=env.assert;var pa=env.jsCall;var qa=env.invoke_iiii;var ra=env.invoke_viiiii;var sa=env.invoke_vi;var ta=env.invoke_ii;var ua=env.invoke_v;var va=env.invoke_iiiii;var wa=env.invoke_viiiiii;var xa=env.invoke_iii;var ya=env.invoke_viiii;var za=env._flock;var Aa=env._fread;var Ba=env._lchown;var Ca=env.___assert_fail;var Da=env.__ZSt18uncaught_exceptionv;var Ea=env._ftell;var Fa=env._emscripten_set_main_loop_timing;var Ga=env._sbrk;var Ha=env.___cxa_begin_catch;var Ia=env._emscripten_memcpy_big;var Ja=env._sysconf;var Ka=env._utime;var La=env._close;var Ma=env._ferror;var Na=env._rewind;var Oa=env._isatty;var Pa=env._umask;var Qa=env.___resumeException;var Ra=env._write;var Sa=env._fsync;var Ta=env.___cxa_atexit;var Ua=env._pthread_cond_destroy;var Va=env._mknod;var Wa=env._mkdir;var Xa=env._send;var Ya=env._chmod;var Za=env._chown;var _a=env._fcntl;var $a=env.___cxa_find_matching_catch;var ab=env._pthread_cond_init;var bb=env._lstat;var cb=env._strerror_r;var db=env.___setErrNo;var eb=env._getpid;var fb=env._unlink;var gb=env._mktime;var hb=env._pthread_once;var ib=env._fopen;var jb=env._stat;var kb=env._getpwnam;var lb=env._read;var mb=env._fwrite;var nb=env._time;var ob=env._fprintf;var pb=env._pthread_join;var qb=env._getgrnam;var rb=env._getcwd;var sb=env._lseek;var tb=env._link;var ub=env._access;var vb=env._vfprintf;var wb=env._rmdir;var xb=env.___cxa_allocate_exception;var yb=env._pwrite;var zb=env._localtime_r;var Ab=env._tzset;var Bb=env._dup;var Cb=env._remove;var Db=env._pthread_getspecific;var Eb=env._fdopen;var Fb=env._pthread_cond_signal;var Gb=env._fseek;var Hb=env._pthread_mutex_destroy;var Ib=env._fclose;var Jb=env._pthread_key_create;var Kb=env._pthread_cond_broadcast;var Lb=env._recv;var Mb=env._ftello;var Nb=env._symlink;var Ob=env._abort;var Pb=env._localtime;var Qb=env._pthread_cond_wait;var Rb=env._open;var Sb=env._fflush;var Tb=env._pthread_mutex_lock;var Ub=env.__reallyNegative;var Vb=env._fileno;var Wb=env._fseeko;var Xb=env._pthread_mutex_unlock;var Yb=env._pread;var Zb=env._mkport;var _b=env._pthread_create;var $b=env._emscripten_set_main_loop;var ac=env.___errno_location;var bc=env._pthread_setspecific;var cc=env._clearerr;var dc=env._fputc;var ec=env.___cxa_throw;var fc=env._strerror;var gc=env.__formatString;var hc=env._atexit;var ic=env._pthread_mutex_init;var jc=0.0;function _emscripten_replace_memory(newBuffer){if(q(newBuffer)&16777215||q(newBuffer)<=16777215||q(newBuffer)>2147483648)return false;i=new a(newBuffer);j=new b(newBuffer);k=new c(newBuffer);l=new d(newBuffer);m=new e(newBuffer);n=new f(newBuffer);o=new g(newBuffer);p=new h(newBuffer);buffer=newBuffer;return true}
// EMSCRIPTEN_START_FUNCS
function tc(a){a=a|0;var b=0;b=r;r=r+a|0;r=r+15&-16;return b|0}function uc(){return r|0}function vc(a){a=a|0;r=a}function wc(a,b){a=a|0;b=b|0;if(!z){z=a;A=b}}function xc(a){a=a|0;i[t>>0]=i[a>>0];i[t+1>>0]=i[a+1>>0];i[t+2>>0]=i[a+2>>0];i[t+3>>0]=i[a+3>>0]}function yc(a){a=a|0;i[t>>0]=i[a>>0];i[t+1>>0]=i[a+1>>0];i[t+2>>0]=i[a+2>>0];i[t+3>>0]=i[a+3>>0];i[t+4>>0]=i[a+4>>0];i[t+5>>0]=i[a+5>>0];i[t+6>>0]=i[a+6>>0];i[t+7>>0]=i[a+7>>0]}function zc(a){a=a|0;O=a}function Ac(){return O|0}function Bc(a){a=a|0;k[a+0>>2]=0;k[a+4>>2]=0;k[a+8>>2]=0;k[a+12>>2]=0;k[a+16>>2]=0;k[a+4>>2]=0;k[a+8>>2]=0;k[a+20>>2]=0;k[a+88>>2]=0;return}function Cc(a){a=a|0;var b=0;k[a+16>>2]=0;b=k[a>>2]|0;if(b){ym(b);k[a>>2]=0}k[a+4>>2]=0;k[a+8>>2]=0;k[a+20>>2]=0;k[a+88>>2]=0;return}function Dc(a){a=a|0;k[a+16>>2]=0;return}function Ec(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;j=r;r=r+16|0;f=j;g=(b|0)==0?8:b;e=a+4|0;h=k[e>>2]|0;b=(kk(g)|0)+1|0;b=b+(k[e>>2]|0)|0;k[e>>2]=b;i=a+8|0;c=k[i>>2]|0;if(b>>>0<=c>>>0){f=k[a>>2]|0;h=f+(h<<2)|0;ik(h,g)|0;h=a+20|0;f=k[h>>2]|0;f=f+1|0;k[h>>2]=f;r=j;return}d=k[a+12>>2]|0;if((d|0)!=0&b>>>0>d>>>0){k[f>>2]=d;Jf(32944,53104,f);Af(32944);c=k[i>>2]|0;b=k[e>>2]|0}c=c+32+(c>>>2)|0;b=b>>>0>c>>>0?b:c;c=zm(k[a>>2]|0,b<<2)|0;if(!c)Af(32944);k[a>>2]=c;k[i>>2]=b;f=c;h=f+(h<<2)|0;ik(h,g)|0;h=a+20|0;f=k[h>>2]|0;f=f+1|0;k[h>>2]=f;r=j;return}function Fc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=a+16|0;e=k[d>>2]|0;if(e>>>0>=(k[a+4>>2]|0)>>>0){a=0;return a|0}a=(k[a>>2]|0)+(e<<2)|0;e=(kk(a)|0)+1|0;k[d>>2]=e+(k[d>>2]|0);Lc(b,a,c)|0;a=1;return a|0}function Gc(a){a=a|0;var b=0,c=0;b=a+16|0;c=k[b>>2]|0;if(c>>>0>=(k[a+4>>2]|0)>>>0){a=0;return a|0}a=(k[a>>2]|0)+(c<<2)|0;c=(kk(a)|0)+1|0;k[b>>2]=c+(k[b>>2]|0);return a|0}function Hc(a,b,c){a=a|0;b=b|0;c=c|0;if((b|0)==(a|0)|(c|0)==0)return;c=c+-1|0;Wm(b|0,a|0,c|0)|0;i[b+c>>0]=0;return}function Ic(a,b,c){a=a|0;b=b|0;c=c|0;if(!c)return a|0;c=c+-1|0;Wm(a|0,b|0,c|0)|0;i[a+c>>0]=0;return a|0}function Jc(a){a=a|0;return (a+-48|0)>>>0<10|0}function Kc(a,b){a=a|0;b=b|0;return hk(a,b)|0}function Lc(a,b,c){a=a|0;b=b|0;c=c|0;if(!c)return a|0;c=c+-1|0;nk(a,b,c)|0;k[a+(c<<2)>>2]=0;return a|0}function Mc(a,b,c){a=a|0;b=b|0;c=c|0;c=c-(kk(a)|0)+-1|0;if((c|0)<=0)return a|0;lk(a,b,c)|0;return a|0}function Nc(a){a=a|0;var b=0,c=0;c=(k[8196]|0)+1|0;c=c>>>0>3?0:c;k[8196]=c;b=16+(c<<13)|0;ne(a,b,2048)|0;k[8204+(c<<13)>>2]=0;return b|0}function Oc(a){a=a|0;var b=0,c=0,d=0;b=kk(a)|0;while(1){c=b+-1|0;if((b|0)<=0){d=5;break}if((k[a+(c<<2)>>2]|0)==47)break;else b=c}if((d|0)==5)return a|0;c=a+(b<<2)|0;return c|0}function Pc(a){a=a|0;return (a|0)==47|0}function Qc(a){a=a|0;return 0}function Rc(a){a=a|0;var b=0;b=kk(a)|0;if(!b)return a|0;a=a+(b+-1<<2)|0;return a|0}function Sc(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0;i=r;r=r+8192|0;g=i;c=a;a:while(1){d=a;while(1){a=k[d>>2]|0;if(!a)break a;else if((a|0)!=47){d=d+4|0;continue}a=d+4|0;if((k[a>>2]|0)!=46){d=a;continue}if((k[d+8>>2]|0)==46)break;else d=a}c=(k[d+12>>2]|0)==47?d+16|0:c}while(1){a=k[c>>2]|0;if((a|0)==92)if((k[c+4>>2]|0)==92?(f=gk(c+8|0,92)|0,(f|0)!=0):0){a=gk(f+4|0,92)|0;a=(a|0)==0?c:a+4|0}else a=c;else if(!a)break;else a=c;b:while(1){e=a;while(1){d=k[e>>2]|0;if((d|0)==47){a=e;break}else if((d|0)!=46)break b;e=e+4|0}a=a+4|0}if((a|0)==(c|0)){h=17;break}else c=a}if((h|0)==17)if((k[c>>2]|0)==46?(k[c+4>>2]|0)==46:0){f=c+8|0;c=(k[f>>2]|0)==0?f:c}if(!b){r=i;return c|0}Lc(g,c,2048)|0;ik(b,g)|0;r=i;return c|0}function Tc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0;if(!a)return;if(!(k[a>>2]|0))return;d=kk(a)|0;while(1){e=d+-1|0;if((d|0)<=0){d=a;break}if((k[a+(e<<2)>>2]|0)==47){f=6;break}else d=e}if((f|0)==6)d=a+(d<<2)|0;d=pk(d,46)|0;if(d)k[d>>2]=0;if(!b)return;Mc(a,32792,c)|0;Mc(a,b,c)|0;return}function Uc(a){a=a|0;if(!a){a=0;return a|0}a=(ok(a,41640)|0)!=0;return a|0}function Vc(a,b){a=a|0;b=b|0;var c=0;c=kk(a)|0;if(!c)return;if(!((c+1|0)>>>0<b>>>0?(k[a+(c+-1<<2)>>2]|0)!=47:0))return;fk(a,32816)|0;return}function Wc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0;if(!c)return;c=c+-1|0;d=kk(a)|0;while(1){e=d+-1|0;if((d|0)<=0){d=a;break}if((k[a+(e<<2)>>2]|0)==47){f=5;break}else d
function Dh(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,m=0,n=0,o=0,p=0,q=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;D=r;r=r+1056|0;m=D+1028|0;C=D;A=a+4|0;c=k[A>>2]|0;B=a+120|0;d=k[B>>2]|0;if((c|0)>(d+-25|0)){b=d-c|0;if((b|0)<0){a=0;r=D;return a|0}h=a+136|0;g=a+128|0;k[g>>2]=(k[h>>2]|0)-c+(k[g>>2]|0);if((c|0)>16384){if((b|0)>0){z=k[a+16>>2]|0;an(z|0,z+c|0,b|0)|0}k[A>>2]=0;k[B>>2]=b}else b=d;if((b|0)!=32768){c=pf(k[a>>2]|0,(k[a+16>>2]|0)+b|0,32768-b|0)|0;b=k[B>>2]|0;if((c|0)>0){b=b+c|0;k[B>>2]=b;f=c}else f=c}else{b=32768;f=0}d=b+-30|0;e=a+124|0;k[e>>2]=d;c=k[A>>2]|0;k[h>>2]=c;b=k[g>>2]|0;if((b|0)!=-1){z=c+-1+b|0;k[e>>2]=(d|0)<(z|0)?d:z}if((f|0)==-1){a=0;r=D;return a|0}}x=a+16|0;g=k[x>>2]|0;y=a+8|0;f=k[y>>2]|0;e=((l[g+(c+1)>>0]|0)<<8|(l[g+c>>0]|0)<<16|(l[g+(c+2)>>0]|0))>>>(8-f|0);d=e&32768;z=a+38728|0;k[z>>2]=d;if(!(e&16384))Ym(a+37700|0,0,1028)|0;w=f+2|0;b=(w>>>3)+c|0;k[A>>2]=b;c=w&7;k[y>>2]=c;if(!d)w=374;else{d=(e>>>12&3)+1|0;k[a+38732>>2]=d;e=a+38736|0;if((k[e>>2]|0)>=(d|0))k[e>>2]=0;b=((c+2|0)>>>3)+b|0;k[A>>2]=b;c=f+4&7;k[y>>2]=c;w=d*257|0}e=0;do{i[m+e>>0]=((l[g+(b+1)>>0]|0)<<8|(l[g+b>>0]|0)<<16|(l[g+(b+2)>>0]|0))>>>(8-c|0)>>>12&15;v=c+4|0;b=(v>>>3)+b|0;k[A>>2]=b;c=v&7;k[y>>2]=c;e=e+1|0}while((e|0)!=19);v=a+15428|0;Gh(0,m,v,19);q=a+136|0;s=a+128|0;t=a+124|0;u=a+15560|0;b=k[A>>2]|0;d=k[B>>2]|0;e=0;a:while(1){o=(e|0)<(w|0);p=(e|0)>0;f=d;c=d;while(1){if(!o){m=51;break a}if((b|0)>(c+-5|0)){g=c-b|0;if((g|0)<0){b=0;m=57;break a}k[s>>2]=(k[q>>2]|0)-b+(k[s>>2]|0);if((b|0)>16384){if((g|0)>0){h=k[x>>2]|0;an(h|0,h+b|0,g|0)|0}k[A>>2]=0;k[B>>2]=g;d=g;c=g}else d=f;if((c|0)!=32768){g=pf(k[a>>2]|0,(k[x>>2]|0)+c|0,32768-c|0)|0;b=k[B>>2]|0;if((g|0)>0){c=b+g|0;k[B>>2]=c;d=c}else{d=b;c=b}}else{c=32768;g=0}f=c+-30|0;k[t>>2]=f;b=k[A>>2]|0;k[q>>2]=b;h=k[s>>2]|0;if((h|0)!=-1){h=b+-1+h|0;k[t>>2]=(f|0)<(h|0)?f:h}if((g|0)==-1){b=0;m=57;break a}}else d=f;n=k[x>>2]|0;f=k[y>>2]|0;h=((l[n+(b+1)>>0]|0)<<8|(l[n+b>>0]|0)<<16|(l[n+(b+2)>>0]|0))>>>(8-f|0)&65534;g=k[u>>2]|0;if(h>>>0<(k[a+(g<<2)+15432>>2]|0)>>>0){g=h>>>(16-g|0);h=(l[a+g+15564>>0]|0)+f|0;b=(h>>>3)+b|0;k[A>>2]=b;h=h&7;k[y>>2]=h;g=a+(g<<1)+16588|0}else{do{g=g+1|0;if(g>>>0>=15){g=15;break}}while(h>>>0>=(k[a+(g<<2)+15432>>2]|0)>>>0);f=g+f|0;b=(f>>>3)+b|0;k[A>>2]=b;f=f&7;k[y>>2]=f;g=((h-(k[a+(g+-1<<2)+15432>>2]|0)|0)>>>(16-g|0))+(k[a+(g<<2)+15496>>2]|0)|0;g=a+((g>>>0>=(k[v>>2]|0)>>>0?0:g)<<1)+18636|0;h=f}m=j[g>>1]|0;if((m&65535)<16){c=m;m=43;break}if(m<<16>>16!=16){g=h;c=n;f=d;d=m;m=48;break}f=i[n+b>>0]|0;g=i[n+(b+1)>>0]|0;m=i[n+(b+2)>>0]|0;n=h+2|0;b=(n>>>3)+b|0;k[A>>2]=b;k[y>>2]=n&7;if(p){c=m;m=46;break}else f=d}if((m|0)==43){i[C+e>>0]=(l[a+e+37700>>0]|0)+(c&65535)&15;e=e+1|0;continue}else if((m|0)==46){p=((g&255)<<8|(f&255)<<16|c&255)>>>(8-h|0)>>>14&3;c=-3-p|0;p=((c|0)>-1?-4-c|0:-3)-p|0;c=e-w|0;c=e-(p>>>0>c>>>0?p:c)|0;while(1){i[C+e>>0]=i[C+(e+-1)>>0]|0;e=e+1|0;if((e|0)==(c|0)){e=c;continue a}}}else if((m|0)==48){c=((l[c+(b+1)>>0]|0)<<8|(l[c+b>>0]|0)<<16|(l[c+(b+2)>>0]|0))>>>(8-g|0)&65535;if(d<<16>>16==17){d=g+3|0;c=(c>>>13)+3|0}else{d=g+7|0;c=(c>>>9)+11|0}b=(d>>>3)+b|0;k[A>>2]=b;k[y>>2]=d&7;d=e-w|0;p=0-c|0;p=~(c+((p|0)>-1?p:-1));p=d>>>0>p>>>0?d:p;Ym(C+e|0,0,0-p|0)|0;d=f;e=e-p|0;continue}}if((m|0)==51){if((c|0)<(b|0)){a=1;r=D;return a|0}if(k[z>>2]|0){b=a+38732|0;if((k[b>>2]|0)>0){c=0;do{Gh(0,C+(c*257|0)|0,a+(c*3820|0)+22420|0,257);c=c+1|0}while((c|0)<(k[b>>2]|0))}}else{Gh(0,C,a+148|0,298);Gh(0,C+298|0,a+3968|0,48);Gh(0,C+346|0,a+11608|0,28)}_m(a+37700|0,C|0,1028)|0;a=1;r=D;return a|0}else if((m|0)==57){r=D;return b|0}return 0}function Eh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;y=k[a+38736>>2]|0;t=a+(y*92|0)+38828|0;k[t>>2]=(k[t>>2]|0)+1;w=a+(y*92|0)+38772|0;j=k[w>>2]|0;l=a+(y*92|0)+38776|0;k[l>>2]=j;n=a+(y*92|0)+38768|0;i=k[n>>2]|0;k[w>>2]=i;w=a+(y*92|0)+38780|0;e=k[w>>2]|0;u=a+(y*92|0)+38764|0;g=e-(k[u>>2]|0)|0;k[n>>2]=g;k[u>>2]=e;u=a+(y*92|0)+38832|0;n=a+(y*92|0)+38744|0;s=(ka(k[n>>2]|0,e)|0)+(k[u>>2]<<3)|0;o=a+(y*92|0)+38748|0;s=s+(ka(g,k[o>>2]|0)|0)|0;p=a+(y*92|0)+38752|0;s=s+(ka(i,k[p>>2]|0)|0)|0;q=a+(y*92|0)+38756|
function sm(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,j=0,l=0,m=0,n=0,o=0,p=0,q=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0;da=r;r=r+1136|0;ca=da+1104|0;q=da+1080|0;s=da+1056|0;y=da+1032|0;H=da+1008|0;Y=da+984|0;aa=da+960|0;ba=da+936|0;n=da+912|0;P=da+888|0;p=da+864|0;t=da+840|0;u=da+816|0;Q=da+792|0;R=da+768|0;S=da+744|0;T=da+720|0;U=da+696|0;v=da+672|0;w=da+648|0;x=da+624|0;h=da+600|0;z=da+576|0;A=da+552|0;B=da+240|0;C=da+216|0;D=da+192|0;E=da+168|0;j=da+144|0;F=da+120|0;G=da+72|0;I=da+48|0;l=da+24|0;V=da;W=da+96|0;X=da+264|0;m=da+288|0;J=da+312|0;K=da+336|0;L=da+360|0;M=da+384|0;N=da+408|0;O=da+432|0;Z=da+456|0;_=da+480|0;$=da+504|0;o=da+528|0;a:do if((b-a|0)>1)do switch(i[a>>0]|0){case 112:switch(i[a+1>>0]|0){case 109:{em(m,59432);e=c+4|0;d=k[e>>2]|0;b=k[c+8>>2]|0;if(d>>>0<b>>>0){if(!d)d=0;else{k[d+0>>2]=k[m+0>>2];k[d+4>>2]=k[m+4>>2];k[d+8>>2]=k[m+8>>2];k[m+0>>2]=0;k[m+4>>2]=0;k[m+8>>2]=0;$=d+12|0;d=m+12|0;k[$+0>>2]=k[d+0>>2];k[$+4>>2]=k[d+4>>2];k[$+8>>2]=k[d+8>>2];k[d+0>>2]=0;k[d+4>>2]=0;k[d+8>>2]=0;d=k[e>>2]|0}k[e>>2]=d+24}else{e=k[c>>2]|0;g=(d-e|0)/24|0;f=g+1|0;if((f|0)<0)Fl(c);d=(b-e|0)/24|0;if(d>>>0<1073741823){d=d<<1;d=d>>>0<f>>>0?f:d}else d=2147483647;Kl(ca,d,g,c+12|0);d=ca+8|0;e=k[d>>2]|0;if(e){k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;v=v<<30|v>>>2;D=b+12|0;p=bn(k[D>>2]|0)|0;k[D>>2]=p;p=B+1518500249+p+(q&(v^z)^z)+(u<<5|u>>>27)|0;q=q<<30|q>>>2;B=b+16|0;g=bn(k[B>>2]|0)|0;k[B>>2]=g;g=z+1518500249+g+(u&(q^v)^v)+(p<<5|p>>>27)|0;u=u<<30|u>>>2;z=b+20|0;j=bn(k[z>>2]|0)|0;k[z>>2]=j;j=v+1518500249+j+(p&(u^q)^q)+(g<<5|g>>>27)|0;p=p<<30|p>>>2;v=b+24|0;r=bn(k[v>>2]|0)|0;k[v>>2]=r;r=q+1518500249+r+(g&(p^u)^u)+(j<<5|j>>>27)|0;g=g<<30|g>>>2;q=b+28|0;w=bn(k[q>>2]|0)|0;k[q>>2]=w;w=u+1518500249+w+(j&(g^p)^p)+(r<<5|r>>>27)|0;j=j<<30|j>>>2;u=b+32|0;s=bn(k[u>>2]|0)|0;k[u>>2]=s;s=p+1518500249+s+(r&(j^g)^g)+(w<<5|w>>>27)|0;r=r<<30|r>>>2;p=b+36|0;m=bn(k[p>>2]|0)|0;k[p>>2]=m;m=g+1518500249+m+(w&(r^j)^j)+(s<<5|s>>>27)|0;w=w<<30|w>>>2;g=b+40|0;e=bn(k[g>>2]|0)|0;k[g>>2]=e;e=j+1518500249+e+(s&(w^r)^r)+(m<<5|m>>>27)|0;s=s<<30|s>>>2;j=b+44|0;l=bn(k[j>>2]|0)|0;k[j>>2]=l;r=l+1518500249+r+(m&(s^w)^w)+(e<<5|e>>>27)|0;m=m<<30|m>>>2;l=b+48|0;x=bn(k[l>>2]|0)|0;k[l>>2]=x;w=x+1518500249+w+(e&(m^s)^s)+(r<<5|r>>>27)|0;e=e<<30|e>>>2;x=b+52|0;G=bn(k[x>>2]|0)|0;k[x>>2]=G;s=G+1518500249+s+(r&(e^m)^m)+(w<<5|w>>>27)|0;r=r<<30|r>>>2;t=b+56|0;E=bn(k[t>>2]|0)|0;k[t>>2]=E;m=E+1518500249+m+(w&(r^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c+2116|0;_b=pc+2104|0;pb=pc+2092|0;qb=pc+2080|0;rb=pc+2068|0;ib=pc+2056|0;Ya=pc+2032|0;Za=pc+2020|0;_a=pc+2008|0;$a=pc+1996|0;Ea=pc+1984|0;Fa=pc+1972|0;Mb=pc+1960|0;dc=pc+1948|0;Yb=pc+1936|0;Sb=pc+1912|0;Tb=pc+1900|0;Ub=pc+1888|0;Vb=pc+1876|0;Wb=pc+1864|0;Xb=pc+1852|0;hb=pc+1840|0;Ga=pc+1816|0;Ha=pc+1800|0;Ia=pc+1788|0;Ja=pc+1776|0;Ka=pc+1764|0;La=pc+1752|0;Ba=pc+1740|0;za=pc+1728|0;Ca=pc+1716|0;Aa=pc+1704|0;mc=pc+1692|0;ob=pc+1680|0;nc=pc+1668|0;lc=pc+1656|0;Kb=pc+1644|0;kc=pc+1632|0;Pb=pc+1620|0;Qb=pc+1608|0;$b=pc+1596|0;ac=pc+1584|0;ic=pc+1560|0;jc=pc+1544|0;Da=pc+1532|0;gb=pc+1520|0;Ma=pc+1496|0;Na=pc+1484|0;Oa=pc+1472|0;Pa=pc+1460|0;Qa=pc+1448|0;Ra=pc+1436|0;fb=pc+1424|0;Sa=pc+1400|0;Ta=pc+1384|0;Ua=pc+1372|0;Va=pc+1360|0;Wa=pc+1348|0;Xa=pc+1336|0;X=pc+1312|0;Y=pc+1296|0;Z=pc+1284|0;_=pc+1272|0;$=pc+1248|0;aa=pc+1232|0;ba=pc+1220|0;ca=pc+1208|0;ua=pc+1184|0;va=pc+1168|0;wa=pc+1156|0;xa=pc+1144|0;la=pc+1120|0;ma=pc+1108|0;na=pc+1096|0;pa=pc+1072|0;qa=pc+1060|0;ra=pc+1048|0;sa=pc+1036|0;gc=pc+1024|0;nb=pc+472|0;Nb=pc+460|0;Ob=pc+448|0;ec=pc+424|0;fc=pc+408|0;x=pc+396|0;y=pc+384|0;z=pc+372|0;A=pc+360|0;B=pc+348|0;C=pc+336|0;D=pc+324|0;Cb=pc+312|0;Db=pc+300|0;Eb=pc+288|0;Fb=pc+276|0;E=pc+264|0;Gb=pc+252|0;Hb=pc+240|0;Ib=pc+228|0;Jb=pc+84|0;F=pc;G=pc+12|0;Q=pc+24|0;R=pc+36|0;S=pc+48|0;T=pc+60|0;U=pc+72|0;kb=pc+96|0;jb=pc+108|0;ab=pc+120|0;bb=pc+144|0;cb=pc+156|0;db=pc+168|0;eb=pc+180|0;V=pc+192|0;I=pc+204|0;J=pc+216|0;K=pc+484|0;d=pc+496|0;g=pc+508|0;e=pc+520|0;f=pc+532|0;L=pc+544|0;da=pc+560|0;ea=pc+584|0;fa=pc+596|0;ga=pc+608|0;n=pc+620|0;j=pc+632|0;h=pc+644|0;M=pc+656|0;N=pc+668|0;O=pc+680|0;l=pc+692|0;o=pc+704|0;p=pc+716|0;P=pc+728|0;ha=pc+744|0;ia=pc+768|0;ja=pc+780|0;ka=pc+792|0;q=pc+804|0;Bb=pc+816|0;Ab=pc+828|0;zb=pc+840|0;sb=pc+856|0;tb=pc+880|0;ub=pc+892|0;vb=pc+904|0;wb=pc+916|0;xb=pc+928|0;yb=pc+940|0;s=pc+952|0;t=pc+964|0;u=pc+976|0;v=pc+988|0;mb=pc+1e3|0;lb=b;W=lb-a|0;a:do if((W|0)>1){w=(W|0)>3;if(w?(i[a>>0]|0)==103:0){H=(i[a+1>>0]|0)==115;ya=H;H=H?a+2|0:a}else{ya=0;H=a}do switch(i[H>>0]|0){case 115:switch(i[H+1>>0]|0){case 99:{if((W|0)<=2){d=a;break a}if((i[a>>0]|0)!=115){d=a;break a}if((i[a+1>>0]|0)!=99){d=a;break a}nc=a+2|0;g=ul(nc,b,c)|0;if((g|0)==(nc|0)){d=a;break a}d=Ql(g,b,c)|0;if((d|0)==(g|0)){d=a;break a}j=c+4|0;g=k[j>>2]|0;if(((g-(k[c>>2]|0)|0)/24|0)>>>0<2){d=a;break a}Al(fb,g+-24|0);g=k[j>>2]|0;e=g+-24|0;f=g;do{a=f+-24|0;k[j>>2]=a;hl(a);f=k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=k[B>>2]|0;w=C+1|0;k[B>>2]=w;D=c+61|0;A=i[D>>0]|0;if(w>>>0>1)i[D>>0]=1;f=i[a>>0]|0;b:do if((f|0)==84|(f|0)==71)if((b-a|0)>2){if((f|0)==71){d=i[a+1>>0]|0;if((d|0)==82){z=a+2|0;b=Bl(z,b,c)|0;if((b|0)==(z|0)){b=a;break}d=k[c+4>>2]|0;if((k[c>>2]|0)==(d|0)){b=a;break}rl(d+-24|0,0,61072)|0;break}else if((d|0)==86){z=a+2|0;b=Bl(z,b,c)|0;if((b|0)==(z|0)){b=a;break}d=k[c+4>>2]|0;if((k[c>>2]|0)==(d|0)){b=a;break}rl(d+-24|0,0,61048)|0;break}else{b=a;break}}else if((f|0)!=84){b=a;break}e=a+1|0;switch(i[e>>0]|0){case 83:{z=a+2|0;b=ul(z,b,c)|0;if((b|0)==(z|0)){b=a;break b}d=k[c+4>>2]|0;if((k[c>>2]|0)==(d|0)){b=a;break b}rl(d+-24|0,0,60904)|0;break b}case 73:{z=a+2|0;b=ul(z,b,c)|0;if((b|0)==(z|0)){b=a;break b}d=k[c+4>>2]|0;if((k[c>>2]|0)==(d|0)){b=a;break b}rl(d+-24|0,0,60888)|0;break b}case 99:{z=a+2|0;d=yl(z,b)|0;if((d|0)==(z|0)){b=a;break b}e=yl(d,b)|0;if((e|0)==(d|0)){b=a;break b}b=pl(e,b,c)|0;if((b|0)==(e|0)){b=a;break b}d=k[c+4>>2]|0;if((k[c>>2]|0)==(d|0)){b=a;break b}rl(d+-24|0,0,60928)|0;break b}case 86:{z=a+2|0;b=ul(z,b,c)|0;if((b|0)==(z|0)){b=a;break b}d=k[c+4>>2]|0;if((k[c>>2]|0)==(d|0)){b=a;break b}rl(d+-24|0,0,60856)|0;break b}case 84:{z=a+2|0;b=ul(z,b,c)|0;if((b|0)==(z|0)){b=a;break b}d=k[c+4>>2]|0;if((k[c>>2]|0)==(d|0)){b=a;break b}rl(d+-24|0,0,60872)|0;break b}case 67:{z=a+2|0;d=ul(z,b,c)|0;if((d|0)==(z|0)){b=a;break b}e=zl(d,b)|0;if((e|0)==(d|0)|(e|0)==(b|0)){b=a;break b}if((i[e>>0]|0)!=95){b=a;break b}z=e+1|0;b=ul(z,b,c)|0;if((b|0)==(z|0)){b=a;break b}f=c+4|0;d=k[f>>2]|0;if(((d-(k[c>>2]|0)|0)/24|0)>>>0<2){b=a;break b}Al(u,d+-24|0);g=k[f>>2]|0;d=g+-24|0;e=g;do{a=e+-24|0;k[f>>2]=a;hl(a);e=k[f>>2]|0}while((e|0)!=(d|0));o=g+-48|0;d=rl(u,0,60960)|0;k[s+0>>2]=k[d+0>>2];k[s+4>>2]=k[d+4>>2];k[s+8>>2]=k[d+8>>2];k[d+0>>2]=0;k[d+4>>2]=0;k[d+8>>2]=0;d=sl(s,60992)|0;k[q+0>>2]=k[d+0>>2];k[q+4>>2]=k[d+4>>2];k[q+8>>2]=k[d+8>>2];k[d+0>>2]=0;k[d+4>>2]=0;k[d+8>>2]=0;Al(t,(k[f>>2]|0)+-24|0);d=i[t>>0]|0;if(!(d&1)){e=t+1|0;d=(d&255)>>>1}else{e=k[t+8>>2]|0;d=k[t+4>>2]|0}a=jl(q,e,d)|0;k[p+0>>2]=k[a+0>>2];k[p+4>>2]=k[a+4>>2];k[p+8>>2]=k[a+8>>2];k[a+0>>2]=0;k[a+4>>2]=0;k[a+8>>2]=0;do if(i[o>>0]&1){n=g+-40|0;i[k[n>>2]>>0]=0;j=g+-44|0;k[j>>2]=0;d=i[o>>0]|0;if(!(d&1))h=10;else{h=k[o>>2]|0;d=h&255;h=(h&-2)+-1|0}if(!(d&1)){e=(d&255)>>>1;if((d&255)<22){g=10;l=e;m=1}else{g=(e+16&240)+-1|0;l=e;m=1}}else{g=10;l=0;m=0}if((g|0)!=(h|0)){if((g|0)==10){f=o+1|0;e=k[n>>2]|0;if(m){_m(f|0,e|0,((d&255)>>>1)+1|0)|0;ym(e)}else{i[f>>0]=i[e>>0]|0;ym(e)}i[o>>0]=l<<1;break}f=g+1|0;e=xm(f)|0;if(!(g>>>0<=h>>>0&(e|0)==0)){if(m)_m(e|0,o+1|0,((d&255)>>>1)+1|0)|0;else{a=k[n>>2]|0;i[e>>0]=i[a>>0]|0;ym(a)}k[o>>2]=f|1;k[j>>2]=l;k[n>>2]=e}}}else{i[o+1>>0]=0;i[o>>0]=0}while(0);k[o+0>>2]=k[p+0>>2];k[o+4>>2]=k[p+4>>2];k[o+8>>2]=k[p+8>>2];k[p+0>>2]=0;k[p+4>>2]=0;k[p+8>>2]=0;tl(p);tl(t);tl(q);tl(s);tl(u);break b}default:{d=yl(e,b)|0;if((d|0)==(e|0)){b=a;break b}b=pl(d,b,c)|0;if((b|0)==(d|0)){b=a;break b}d=k[c+4>>2]|0;if((k[c>>2]|0)==(d|0)){b=a;break b}d=d+-24|0;if((i[a+2>>0]|0)==118){rl(d,0,61e3)|0;break b}else{rl(d,0,61024)|0;break b}}}}else b=a;else{g=Bl(a,b,c)|0;t=k[c+48>>2]|0;u=k[c+52>>2]|0;if((g|0)!=(a|0)){if((g|0)!=(b|0)){w=i[g>>0]|0;if(w<<24>>24==46|w<<24>>24==69)b=g;else{v=i[D>>0]|0;i[D>>0]=0;k[z+0>>2]=0;k[z+4>>2]=0;k[z+8>>2]=0;w=c+4|0;f=k[w>>2]|0;c:do if((k[c>>2]|0)!=(f|0)){h=f+-24|0;e=i[h>>0]|0;m=(e&1)==0;if(m)l=(e&255)>>>1;else l=k[f+-20>>2]|0;if(l){if(!(i[c+60>>0]|0)){if(m){l=(e&255)>>>1;d=h+1|0}else{l=k[f+-20>>2]|0;d=k[f+-16>>2]|0}if((i[d+(l+-1)>>0]|0)==62){if(m){l=(e&255)>>>1;d=h+1|0}else{l=k[f+-20>>2]|0;d=k[f+-16>>2]|0}if((i[d+(l+-2)>>0]|0)!=45){if(m){e=(e&255)>>>1;d=h+1|0}else{e=k[f+-20>>2]|0;d=k[f+-16>>2]|0}if((i[d+(e+-2)>>0]|0)!=62){e=ul(g,b,c)|0;if((e|0)==(g|0))break;f=k[w>>2]|0;if(((f-(k[c>>2]|0)|0)/24|0)>>>0<2)break;f=f+-24|0;k[j+0>>2]=k[f+0>>2];k[j+4>>2]=k[f+4>>2];k[j+8>>2]=k[f+8>>2];k[f+0>>2]=
// EMSCRIPTEN_END_FUNCS
var kc=[oo,oo,on,oo,pn,oo,qn,oo,rn,oo,sn,oo,nd,rd,Xd,Yd,Sk,Rk,Sm,oo,oo,oo,oo,oo,oo,oo,oo,oo,oo,oo,oo,oo];var lc=[po,po,un,po,vn,po,wn,po,xn,po,yn,po,Zk,Yk,po,po];var mc=[qo,qo,An,qo,Bn,qo,Cn,qo,Dn,qo,En,qo,kd,md,Rd,Sd,Dk,Ek,Lk,Pk,Mk,Nk,Ok,Qk,wg,lh,ri,xl,qo,qo,qo,qo];var nc=[ro,ro,Gn,ro,Hn,ro,In,ro,Jn,ro,Kn,ro,vd,_d,Fk,mi];var oc=[so,so,Mn,so,Nn,so,On,so,Pn,so,Qn,so,cl,ll,so,so];var pc=[to,to,Sn,to,Tn,to,Un,to,Vn,to,Wn,to,to,to,to,to];var qc=[uo,uo,Yn,uo,Zn,uo,_n,uo,$n,uo,ao,uo,$k,_k,uo,uo];var rc=[vo,vo,co,vo,eo,vo,fo,vo,go,vo,ho,vo,vo,vo,vo,vo];var sc=[wo,wo,jo,wo,ko,wo,lo,wo,mo,wo,no,wo,sd,Zd,Uk,Vk];return{_strlen:Zm,_emscripten_bind_RAROpenArchiveDataEx_set_OpenMode_1:$i,_emscripten_bind_RAROpenArchiveDataEx_get_OpenMode_0:_i,_emscripten_bind_RAROpenArchiveDataEx_get_OpenResult_0:aj,_emscripten_bind_RARHeaderDataEx_get_ArcName_1:qj,___cxa_can_catch:al,_memset:Ym,_emscripten_bind_RARHeaderDataEx_get_FileAttr_0:Ej,_emscripten_bind_RAROpenArchiveDataEx_get_Reserved_1:mj,_RAROpenArchiveEx:Ci,_bitshift64Lshr:Xm,_emscripten_bind_RARHeaderDataEx_get_Reserved_1:Oj,_emscripten_bind_RARHeaderDataEx_get_UnpVer_0:Cj,_i64Subtract:Um,_emscripten_bind_RAROpenArchiveDataEx_RAROpenArchiveDataEx_0:Vi,_bitshift64Shl:$m,_emscripten_bind_RARHeaderDataEx_get_CmtState_0:Kj,___cxa_demangle:wk,_emscripten_bind_RARHeaderDataEx_get_FileCRC_0:Aj,_malloc:xm,_emscripten_bind_RARHeaderDataEx_get_PackSizeHigh_0:wj,_strncpy:Wm,_RARReadHeaderEx:Ei,_emscripten_bind_VoidPtr___destroy___0:Rj,_emscripten_bind_RAROpenArchiveDataEx_set_Callback_1:jj,_emscripten_bind_RARHeaderDataEx_get_CmtBuf_0:Fj,_emscripten_bind_RARHeaderDataEx_get_HostOS_0:zj,_emscripten_bind_RAROpenArchiveDataEx_set_ArcNameW_1:Zi,_emscripten_bind_RARHeaderDataEx_get_DictSize_0:Lj,_memcpy:_m,_emscripten_bind_RARHeaderDataEx_get_UnpSizeHigh_0:yj,_RARProcessFileW:Gi,_emscripten_bind_RAROpenArchiveDataEx_get_Callback_0:ij,_emscripten_bind_RAROpenArchiveDataEx_get_CmtBuf_0:bj,_emscripten_bind_RAROpenArchiveDataEx_get_ArcNameW_0:Yi,_RARSetCallback:Hi,_emscripten_bind_RARHeaderDataEx_get_ArcNameW_1:rj,_emscripten_bind_RAROpenArchiveDataEx_set_Reserved_2:nj,_emscripten_bind_RAROpenArchiveDataEx_get_Flags_0:hj,_emscripten_bind_RARHeaderDataEx_get_FileTime_0:Bj,_realloc:zm,_i64Add:Vm,_emscripten_bind_RAROpenArchiveDataEx_set_CmtBuf_1:cj,_emscripten_bind_RARHeaderDataEx_get_CmtSize_0:Jj,_emscripten_bind_RARHeaderDataEx_get_FileName_1:sj,_emscripten_bind_RARHeaderDataEx_get_PackSize_0:vj,_emscripten_bind_RARHeaderDataEx_get_CmtBufSize_0:Hj,_emscripten_bind_RARHeaderDataEx_get_HashType_0:Mj,_RARGetDllVersion:Ji,_strcpy:cn,_emscripten_bind_RARHeaderDataEx_get_Method_0:Dj,_emscripten_bind_RARHeaderDataEx___destroy___0:Qj,_llvm_bswap_i32:bn,_emscripten_bind_RAROpenArchiveDataEx_get_CmtBufSize_0:dj,_emscripten_bind_RARHeaderDataEx_get_FileNameW_1:tj,_emscripten_bind_RAROpenArchiveDataEx_get_CmtState_0:gj,_RARSetPassword:Ii,_free:ym,_emscripten_bind_RAROpenArchiveDataEx_set_ArcName_1:Xi,_emscripten_bind_RAROpenArchiveDataEx_get_UserData_0:kj,_memmove:an,_emscripten_bind_RARHeaderDataEx_RARHeaderDataEx_0:pj,_emscripten_bind_RAROpenArchiveDataEx_get_ArcName_0:Wi,_emscripten_bind_RARHeaderDataEx_set_CmtBufSize_1:Ij,_emscripten_bind_RARHeaderDataEx_set_Reserved_2:Pj,_emscripten_bind_RARHeaderDataEx_get_Hash_1:Nj,_emscripten_bind_RAROpenArchiveDataEx_set_UserData_1:lj,_emscripten_bind_RARHeaderDataEx_get_UnpSize_0:xj,_emscripten_bind_RAROpenArchiveDataEx_get_CmtSize_0:fj,_emscripten_bind_RARHeaderDataEx_get_Flags_0:uj,_RARCloseArchive:Di,_emscripten_bind_RAROpenArchiveDataEx___destroy___0:oj,_emscripten_bind_RAROpenArchiveDataEx_set_CmtBufSize_1:ej,_emscripten_bind_RARHeaderDataEx_set_CmtBuf_1:Gj,___cxa_is_pointer_type:bl,__GLOBAL__sub_I_global_cpp:id,__GLOBAL__sub_I_crc_cpp:Oe,__GLOBAL__sub_I_threadpool_cpp:qi,runPostSets:Tm,_emscripten_replace_memory:_emscripten_replace_memory,stackAlloc:tc,stackSave:uc,stackRestore:vc,setThrew:wc,setTempRet0:zc,getTempRet0:Ac,dynCall_iiii:nn,dynCall_viiiii:tn,dynCall_vi:zn,dynCall_ii:Fn,dynCall_v:Ln,dynCall_iiiii:Rn,dynCall_viiiiii:Xn,dynCall_iii:bo,dynCall_viiii:io}})
// EMSCRIPTEN_END_ASM
(Module.asmGlobalArg,Module.asmLibraryArg,buffer);var _strlen=Module["_strlen"]=asm["_strlen"];var _emscripten_bind_RAROpenArchiveDataEx_set_OpenMode_1=Module["_emscripten_bind_RAROpenArchiveDataEx_set_OpenMode_1"]=asm["_emscripten_bind_RAROpenArchiveDataEx_set_OpenMode_1"];var _emscripten_bind_RAROpenArchiveDataEx_get_OpenMode_0=Module["_emscripten_bind_RAROpenArchiveDataEx_get_OpenMode_0"]=asm["_emscripten_bind_RAROpenArchiveDataEx_get_OpenMode_0"];var _emscripten_bind_RAROpenArchiveDataEx_get_OpenResult_0=Module["_emscripten_bind_RAROpenArchiveDataEx_get_OpenResult_0"]=asm["_emscripten_bind_RAROpenArchiveDataEx_get_OpenResult_0"];var _emscripten_bind_RARHeaderDataEx_get_ArcName_1=Module["_emscripten_bind_RARHeaderDataEx_get_ArcName_1"]=asm["_emscripten_bind_RARHeaderDataEx_get_ArcName_1"];var ___cxa_can_catch=Module["___cxa_can_catch"]=asm["___cxa_can_catch"];var _memset=Module["_memset"]=asm["_memset"];var _emscripten_bind_RARHeaderDataEx_get_FileAttr_0=Module["_emscripten_bind_RARHeaderDataEx_get_FileAttr_0"]=asm["_emscripten_bind_RARHeaderDataEx_get_FileAttr_0"];var _emscripten_bind_RAROpenArchiveDataEx_get_Reserved_1=Module["_emscripten_bind_RAROpenArchiveDataEx_get_Reserved_1"]=asm["_emscripten_bind_RAROpenArchiveDataEx_get_Reserved_1"];var _RAROpenArchiveEx=Module["_RAROpenArchiveEx"]=asm["_RAROpenArchiveEx"];var _bitshift64Lshr=Module["_bitshift64Lshr"]=asm["_bitshift64Lshr"];var _emscripten_bind_RARHeaderDataEx_get_Reserved_1=Module["_emscripten_bind_RARHeaderDataEx_get_Reserved_1"]=asm["_emscripten_bind_RARHeaderDataEx_get_Reserved_1"];var _emscripten_bind_RARHeaderDataEx_get_UnpVer_0=Module["_emscripten_bind_RARHeaderDataEx_get_UnpVer_0"]=asm["_emscripten_bind_RARHeaderDataEx_get_UnpVer_0"];var _i64Subtract=Module["_i64Subtract"]=asm["_i64Subtract"];var _emscripten_bind_RAROpenArchiveDataEx_RAROpenArchiveDataEx_0=Module["_emscripten_bind_RAROpenArchiveDataEx_RAROpenArchiveDataEx_0"]=asm["_emscripten_bind_RAROpenArchiveDataEx_RAROpenArchiveDataEx_0"];var _bitshift64Shl=Module["_bitshift64Shl"]=asm["_bitshift64Shl"];var _emscripten_bind_RARHeaderDataEx_get_CmtState_0=Module["_emscripten_bind_RARHeaderDataEx_get_CmtState_0"]=asm["_emscripten_bind_RARHeaderDataEx_get_CmtState_0"];var ___cxa_demangle=Module["___cxa_demangle"]=asm["___cxa_demangle"];var _emscripten_bind_RARHeaderDataEx_get_FileCRC_0=Module["_emscripten_bind_RARHeaderDataEx_get_FileCRC_0"]=asm["_emscripten_bind_RARHeaderDataEx_get_FileCRC_0"];var _malloc=Module["_malloc"]=asm["_malloc"];var _emscripten_bind_RARHeaderDataEx_get_PackSizeHigh_0=Module["_emscripten_bind_RARHeaderDataEx_get_PackSizeHigh_0"]=asm["_emscripten_bind_RARHeaderDataEx_get_PackSizeHigh_0"];var _strncpy=Module["_strncpy"]=asm["_strncpy"];var _RARReadHeaderEx=Module["_RARReadHeaderEx"]=asm["_RARReadHeaderEx"];var _emscripten_bind_VoidPtr___destroy___0=Module["_emscripten_bind_VoidPtr___destroy___0"]=asm["_emscripten_bind_VoidPtr___destroy___0"];var _emscripten_bind_RAROpenArchiveDataEx_set_Callback_1=Module["_emscripten_bind_RAROpenArchiveDataEx_set_Callback_1"]=asm["_emscripten_bind_RAROpenArchiveDataEx_set_Callback_1"];var _emscripten_bind_RARHeaderDataEx_get_CmtBuf_0=Module["_emscripten_bind_RARHeaderDataEx_get_CmtBuf_0"]=asm["_emscripten_bind_RARHeaderDataEx_get_CmtBuf_0"];var _emscripten_bind_RARHeaderDataEx_get_HostOS_0=Module["_emscripten_bind_RARHeaderDataEx_get_HostOS_0"]=asm["_emscripten_bind_RARHeaderDataEx_get_HostOS_0"];var _emscripten_bind_RAROpenArchiveDataEx_set_ArcNameW_1=Module["_emscripten_bind_RAROpenArchiveDataEx_set_ArcNameW_1"]=asm["_emscripten_bind_RAROpenArchiveDataEx_set_ArcNameW_1"];var _emscripten_bind_RARHeaderDataEx_get_DictSize_0=Module["_emscripten_bind_RARHeaderDataEx_get_DictSize_0"]=asm["_emscripten_bind_RARHeaderDataEx_get_DictSize_0"];var _memcpy=Module["_memcpy"]=asm["_memcpy"];var _emscripten_bind_RARHeaderDataEx_get_UnpSizeHigh_0=Module["_emscripten_bind_RARHeaderDataEx_get_UnpSizeHigh_0"]=asm["_emscripten_bind_RARHeaderDataEx_get_UnpSizeHigh_0"];var _RARProcessFileW=Module["_RARProcessFileW"]=asm["_RARProcessFileW"];var _emscripten_bind_R
//My Code:
/* ----------------
* CONSTANTS (from dll.hpp)
* --------------*/
"use strict";
var ERAR_SUCCESS = 0
var ERAR_END_ARCHIVE = 10
var ERAR_NO_MEMORY = 11
var ERAR_BAD_DATA = 12
var ERAR_BAD_ARCHIVE = 13
var ERAR_UNKNOWN_FORMAT = 14
var ERAR_EOPEN = 15
var ERAR_ECREATE = 16
var ERAR_ECLOSE = 17
var ERAR_EREAD = 18
var ERAR_EWRITE = 19
var ERAR_SMALL_BUF = 20
var ERAR_UNKNOWN = 21
var ERAR_MISSING_PASSWORD = 22
var ERAR_EREFERENCE = 23
var ERAR_BAD_PASSWORD = 24
var RAR_OM_LIST = 0
var RAR_OM_EXTRACT = 1
var RAR_OM_LIST_INCSPLIT = 2
var RAR_SKIP = 0
var RAR_TEST = 1
var RAR_EXTRACT = 2
var RAR_VOL_ASK = 0
var RAR_VOL_NOTIFY = 1
var RAR_DLL_VERSION = 6
var RAR_HASH_NONE = 0
var RAR_HASH_CRC32 = 1
var RAR_HASH_BLAKE2 = 2
var RHDF_SPLITBEFORE = 0x01
var RHDF_SPLITAFTER = 0x02
var RHDF_ENCRYPTED = 0x04
var RHDF_SOLID = 0x10
var RHDF_DIRECTORY = 0x20
var UCM_CHANGEVOLUME = 0
var UCM_PROCESSDATA = 1
var UCM_NEEDPASSWORD = 2
var UCM_CHANGEVOLUMEW = 3
var UCM_NEEDPASSWORDW = 4
/* -----------------
* Error Reporting
* ----------------*/
var reportOpenError = function(code){
switch(code) {
case ERAR_NO_MEMORY:
throw "Not enough memory to initialize data structures"
break
case ERAR_BAD_DATA:
throw "Archive header broken"
break
case ERAR_UNKNOWN_FORMAT:
throw "Unknown encryption used for archive headers"
break
case ERAR_EOPEN:
throw "File open error"
break
case ERAR_BAD_PASSWORD:
throw "Entered password is invalid. This code is returned only for archives in RAR 5.0 format"
break
case ERAR_BAD_ARCHIVE:
throw "Bad archive"
break
default:
throw "Unknown open error code"
break
}
}
var reportReadHeaderError = function(code){
switch(code) {
case ERAR_BAD_DATA:
throw "File header broken"
break
case ERAR_MISSING_PASSWORD:
throw "Password was not provided for encrypted file header"
break
case ERAR_BAD_PASSWORD:
throw "Bad password"
break
default:
throw "Unknown read header error code"
break
}
}
var reportProcessFileError = function(code){
switch(code) {
case ERAR_BAD_DATA:
throw "File CRC error"
break
case ERAR_UNKNOWN_FORMAT:
throw "Unknown archive format"
break
case ERAR_EOPEN:
throw "Volume open error"
break
case ERAR_ECREATE:
throw "File create error"
break
case ERAR_ECLOSE:
throw "File close error"
break
case ERAR_EREAD:
throw "Read error"
break
case ERAR_EWRITE:
throw "Write error"
break
case ERAR_NO_MEMORY:
throw "Not enough memory"
break
case ERAR_EREFERENCE:
throw "When attempting to unpack a reference record (see RAR -oi switch), source file for this reference was not found. Entire archive needs to be unpacked to properly create file references. This error is returned when attempting to unpack the reference record without its source file."
break
case ERAR_BAD_PASSWORD:
throw "Entered password is invalid. This code is returned only for archives in RAR 5.0 format"
break
case ERAR_MISSING_PASSWORD:
throw "Missing password"
break
default:
throw "Unknown Process File error code"
break
}
}
/*--------------------------
* Actual extraction code
*-------------------------*/
var ShowArcInfo = function(Flags) {
// console.log("\nArchive %s\n",ArcName);
/*
console.log("Volume:\t\t%s",(Flags & 1) ? "yes":"no");
console.log("Comment:\t%s",(Flags & 2) ? "yes":"no");
console.log("Locked:\t\t%s",(Flags & 4) ? "yes":"no");
console.log("Solid:\t\t%s",(Flags & 8) ? "yes":"no");
console.log("New naming:\t%s",(Flags & 16) ? "yes":"no");
console.log("Recovery:\t%s",(Flags & 64) ? "yes":"no");
console.log("Encr.headers:\t%s",(Flags & 128) ? "yes":"no");
console.log("First volume:\t%s",(Flags & 256) ? "yes":"no or older than 3.0");
console.log("---------------------------\n");
*/
}
var getFileName = function(header) {
//assume UTF-16, base on the C code
//actually not sure because the use of wchar_t depends on the compiler(emscripten) setting
// console.log(arcData.get_Flags())
// get entry name
var filenameBytes = [];
var i = 0;
while (i < 2048) {
var oneByte = header.get_FileNameW(i);
if (oneByte === 0) break; //null terminated
filenameBytes.push(oneByte);
i++;
}
//this part assume filenameBytes are array of 16bit char
var filenameStr = String.fromCharCode.apply(null, filenameBytes);
// console.info(filenameStr);
// console.info(header);
// console.log(filenameStr, filenameStr.length);
return filenameStr;
// var filenamestr = intArrayToString(filenameBytes);
}
var cleanup = function(handle, data, cb) {
// clean up
_RARCloseArchive(handle);
for (var i = 0; i < data.length; ++i) {
FS.unlink(data[i].name);
}
Runtime.removeFunction(cb);
}
var openArchive = function(arcData, password, data, cb) {
var handle = _RAROpenArchiveEx(getPointer(arcData))
var or = arcData.get_OpenResult();
if (or !== ERAR_SUCCESS || ! handle) {
cleanup(handle, data, cb);
reportOpenError(or);
return null;
}
//ShowArcInfo(arcData.get_Flags());
// open success
if (password) {
_RARSetPassword(handle, ensureString(password));
}
var header = new Module.RARHeaderDataEx();
var res = _RARReadHeaderEx(handle, getPointer(header));
if (res !== ERAR_SUCCESS) {
return null;
}
return {
handle: handle,
header: header
};
}
// FIXME: Rename this, because it no longer just returns the file names.
var readRARFileNames = function(data, password) {
// console.log("Current working directory: ",FS.cwd())
// write the byte arrays to a file first
// because the library operates on files
// the canOwn flag reduces the memory usage
for (var i = 0; i < data.length; ++i) {
FS.writeFile(data[i].name, data[i].content, {encoding: "binary", canOwn: true, flags: 'w+'});
}
var arcData = new Module.RAROpenArchiveDataEx();
arcData.set_ArcName(data[0].name);
arcData.set_OpenMode(RAR_OM_EXTRACT);
// Open the archive
var cb = function() {
};
var status = openArchive(arcData, password, data, cb);
if (! status)
return null;
var handle = status.handle;
var header = status.header;
// Get all the file names
var entries = [];
var res = ERAR_SUCCESS;
while (res === ERAR_SUCCESS) {
var flags = header.get_Flags();
var is_file = (flags & RHDF_DIRECTORY) === 0;
var size_uncompressed = header.get_UnpSize();
var size_compressed = header.get_PackSize();
entries.push({
name: getFileName(header),
is_file: is_file,
size_uncompressed: size_uncompressed,
size_compressed: size_compressed
});
var PFCode = _RARProcessFileW(handle, RAR_SKIP, 0, 0);
if (PFCode !== ERAR_SUCCESS) {
cleanup(handle, data, cb);
reportProcessFileError(PFCode);
return null;
}
res = _RARReadHeaderEx(handle, getPointer(header));
}
_RARCloseArchive(handle);
handle = null;
/*
for (var i=0; i<entries.length; ++i) {
console.info('!!!!!!!!!! ' + entries[i].name);
}
*/
return entries;
}
var readRARContent = function(data, password, fileName, callbackEach) {
// console.log("Current working directory: ",FS.cwd())
var currFileName;
var currFileSize;
var currFileBuffer;
var currFileBufferEnd;
var currFileFlags;
// write the byte arrays to a file first
// because the library operates on files
// the canOwn flag reduces the memory usage
for (var i = 0; i < data.length; ++i) {
FS.writeFile(data[i].name, data[i].content, {encoding: "binary", canOwn: true, flags: 'w+'});
}
var cb = Runtime.addFunction(function(msg, UserData, P1, P2) {
// volume change event
if (msg === UCM_CHANGEVOLUMEW) return 0;
if (msg === UCM_CHANGEVOLUME) {
if (P2 === RAR_VOL_ASK) {
return -1;
} else if (P2 === RAR_VOL_NOTIFY) {
console.log('... volume is :', Pointer_stringify(P1));
return 1;
}
throw "Unknown P2 value in volume change event";
}
if (msg === UCM_NEEDPASSWORDW) return 0;
if (msg === UCM_NEEDPASSWORD) {
if (password) {
writeStringToMemory(password, P1);
return 1;
} else {
return -1;
}
}
if (msg !== UCM_PROCESSDATA) {
return -1; //abort operation
}
//additional callback function
// if(callbackEach){callbackEach(currFileName, currFileSize, currFileBufferEnd)}
// directly access the HEAP
var block = HEAPU8.subarray(P1, P1+P2);
var view = new Uint8Array(currFileBuffer, currFileBufferEnd, P2);
view.set(block);
//console.info(view);
currFileBufferEnd += P2;
if (currFileSize === currFileBufferEnd) {
callbackEach(view.buffer, null);
}
return 1
});
var arcData = new Module.RAROpenArchiveDataEx();
arcData.set_ArcName(data[0].name);
arcData.set_OpenMode(RAR_OM_EXTRACT);
arcData.set_Callback(cb);
var handle = null;
var header = null;
var status = openArchive(arcData, password, data, cb);
if (! status)
return null;
handle = status.handle;
header = status.header;
var res = ERAR_SUCCESS;
var is_done = false;
while (res === ERAR_SUCCESS) {
currFileName = getFileName(header);
// Read the file only if it matches the file name
var PFCode = null;
if (! is_done && fileName === currFileName) {
is_done = true;
// console.log(' !!!!!!!!! match: ' + currFileName);
currFileSize = header.get_UnpSize();
currFileBuffer = new ArrayBuffer(currFileSize);
currFileBufferEnd = 0;
currFileFlags = header.get_Flags();
PFCode = _RARProcessFileW(handle, RAR_TEST, 0, 0);
} else {
PFCode = _RARProcessFileW(handle, RAR_SKIP, 0, 0);
}
if (PFCode !== ERAR_SUCCESS) {
cleanup(handle, data, cb);
reportProcessFileError(PFCode);
return null;
}
res = _RARReadHeaderEx(handle, getPointer(header));
}
if (res !== ERAR_END_ARCHIVE) {
// console.log('!!!!!!!!! exiting: ' + tempFileNames.length);
cleanup(handle, data, cb);
reportReadHeaderError(res);
return null;
}
cleanup(handle, data, cb);
var rootDir = {type: 'dir', ls: {}}
return rootDir
}
// export
if (typeof process === 'object' && typeof require === 'function') { // NODE
module.exports = readRARContent;
} else if (typeof define === "function" && define.amd) { // AMD
define('readRARContent', [], function () { return readRARContent; });
} else if (typeof window === 'object') { // WEB
window['readRARContent'] = readRARContent;
} else if (typeof importScripts === 'function') { // WORKER
this['readRARContent'] = readRARContent;
}