32 lines
33 KiB
JavaScript
32 lines
33 KiB
JavaScript
|
var BASIS=function(){var ae=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(ae=ae||__filename),function(x){x=x||{};var u=typeof x<"u"?x:{},xe,Ge;u.ready=new Promise(function(e,r){xe=e,readyPromiseRejectza=r});var G={},D;for(D in u)u.hasOwnProperty(D)&&(G[D]=u[D]);var z=[],ze="./this.program",Ae=function(e,r){throw r},se=!1,I=!1,$e=!1,Xe=!1;se=typeof window=="object",I=typeof importScripts=="function",$e=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",Xe=!se&&!$e&&!I;var w="";function Er(e){return u.locateFile?u.locateFile(e,w):w+e}var ue,Fe,X,Rr,Ee,Re;$e?(I?w=require("path").dirname(w)+"/":w=__dirname+"/",ue=function(r,t){return Ee||(Ee=require("fs")),Re||(Re=require("path")),r=Re.normalize(r),Ee.readFileSync(r,t?null:"utf8")},X=function(r){var t=ue(r,!0);return t.buffer||(t=new Uint8Array(t)),Se(t.buffer),t},process.argv.length>1&&(ze=process.argv[1].replace(/\\/g,"/")),z=process.argv.slice(2),process.on("uncaughtException",function(e){if(!(e instanceof On))throw e}),process.on("unhandledRejection",L),Ae=function(e){process.exit(e)},u.inspect=function(){return"[Emscripten Module object]"}):Xe?(typeof read<"u"&&(ue=function(r){return read(r)}),X=function(r){var t;return typeof readbuffer=="function"?new Uint8Array(readbuffer(r)):(t=read(r,"binary"),Se(typeof t=="object"),t)},typeof scriptArgs<"u"?z=scriptArgs:typeof arguments<"u"&&(z=arguments),typeof quit=="function"&&(Ae=function(e){quit(e)}),typeof print<"u"&&(typeof console>"u"&&(console={}),console.log=print,console.warn=console.error=typeof printErr<"u"?printErr:print)):(se||I)&&(I?w=self.location.href:typeof document<"u"&&document.currentScript&&(w=document.currentScript.src),ae&&(w=ae),w.indexOf("blob:")!==0?w=w.substr(0,w.lastIndexOf("/")+1):w="",ue=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},I&&(X=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),Fe=function(e,r,t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(){if(n.status==200||n.status==0&&n.response){r(n.response);return}t()},n.onerror=t,n.send(null)},Rr=function(e){document.title=e});var Sr=u.print||console.log.bind(console),V=u.printErr||console.warn.bind(console);for(D in G)G.hasOwnProperty(D)&&(u[D]=G[D]);G=null,u.arguments&&(z=u.arguments),u.thisProgram&&(ze=u.thisProgram),u.quit&&(Ae=u.quit);var Or=0,Wr=function(e){Or=e},Y;u.wasmBinary&&(Y=u.wasmBinary);var Dn=u.noExitRuntime||!0;typeof WebAssembly!="object"&&L("no native wasm support detected");var fe,Ye=!1,Dr;function Se(e,r){e||L("Assertion failed: "+r)}var Je=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Ke(e,r,t){for(var n=r+t,i=r;e[i]&&!(i>=n);)++i;if(i-r>16&&e.subarray&&Je)return Je.decode(e.subarray(r,i));for(var s="";r<i;){var f=e[r++];if(!(f&128)){s+=String.fromCharCode(f);continue}var o=e[r++]&63;if((f&224)==192){s+=String.fromCharCode((f&31)<<6|o);continue}var a=e[r++]&63;if((f&240)==224?f=(f&15)<<12|o<<6|a:f=(f&7)<<18|o<<12|a<<6|e[r++]&63,f<65536)s+=String.fromCharCode(f);else{var c=f-65536;s+=String.fromCharCode(55296|c>>10,56320|c&1023)}}return s}function Qe(e,r){return e?Ke(_,e,r):""}function Ur(e,r,t,n){if(!(n>0))return 0;for(var i=t,s=t+n-1,f=0;f<e.length;++f){var o=e.charCodeAt(f);if(o>=55296&&o<=57343){var a=e.charCodeAt(++f);o=65536+((o&1023)<<10)|a&1023}if(o<=127){if(t>=s)break;r[t++]=o}else if(o<=2047){if(t+1>=s)break;r[t++]=192|o>>6,r[t++]=128|o&63}else if(o<=65535){if(t+2>=s)break;r[t++]=224|o>>12,r[t++]=128|o>>6&63,r[t++]=128|o&63}else{if(t+3>=s)break;r[t++]=240|o>>18,r[t++]=128|o>>12&63,r[t++]=128|o>>6&63,r[t++]=128|o&63}}return r[t]=0,t-i}function jr(e,r,t){return Ur(e,_,r,t)}function Ir(e){for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n>=55296&&n<=57343&&(n=65536+((n&1023)<<10)|e.charCodeAt(++t)&1023),n<=127?++r:n<=2047?r+=2:n<=65535?r+=3:r+=4}return r}var Ze=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):voi
|
||
|
"use strict"; return body.apply(this, arguments);
|
||
|
};
|
||
|
`)(r)}function De(e,r){var t=he(r,function(n){this.name=r,this.message=n;var i=new Error(n).stack;i!==void 0&&(this.stack=this.toString()+`
|
||
|
`+i.replace(/^Error(:[^\n]*)?\n/,""))});return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},t}var cr=void 0;function ge(e){throw new cr(e)}function U(e,r,t){e.forEach(function(o){ve[o]=r});function n(o){var a=t(o);a.length!==e.length&&ge("Mismatched type converter count");for(var c=0;c<e.length;++c)F(e[c],a[c])}var i=new Array(r.length),s=[],f=0;r.forEach(function(o,a){M.hasOwnProperty(o)?i[a]=M[o]:(s.push(o),B.hasOwnProperty(o)||(B[o]=[]),B[o].push(function(){i[a]=M[o],++f,f===s.length&&n(i)}))}),s.length===0&&n(i)}function st(e){var r=de[e];delete de[e];var t=r.rawConstructor,n=r.rawDestructor,i=r.fields,s=i.map(function(f){return f.getterReturnType}).concat(i.map(function(f){return f.setterArgumentType}));U([e],s,function(f){var o={};return i.forEach(function(a,c){var l=a.fieldName,d=f[c],v=a.getter,y=a.getterContext,g=f[c+i.length],m=a.setter,C=a.setterContext;o[l]={read:function(E){return d.fromWireType(v(y,E))},write:function(E,oe){var W=[];m(C,E,g.toWireType(W,oe)),pe(W)}}}),[{name:r.name,fromWireType:function(a){var c={};for(var l in o)c[l]=o[l].read(a);return n(a),c},toWireType:function(a,c){for(var l in o)if(!(l in c))throw new TypeError('Missing field: "'+l+'"');var d=t();for(l in o)o[l].write(d,c[l]);return a!==null&&a.push(n,d),d},argPackAdvance:8,readValueFromPointer:Z,destructorFunction:n}]})}function _e(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}function ut(){for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);lr=e}var lr=void 0;function h(e){for(var r="",t=e;_[t];)r+=lr[_[t++]];return r}var q=void 0;function p(e){throw new q(e)}function F(e,r,t){if(t=t||{},!("argPackAdvance"in r))throw new TypeError("registerType registeredInstance requires argPackAdvance");var n=r.name;if(e||p('type "'+n+'" must have a positive integer typeid pointer'),M.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;p("Cannot register type '"+n+"' twice")}if(M[e]=r,delete ve[e],B.hasOwnProperty(e)){var i=B[e];delete B[e],i.forEach(function(s){s()})}}function ft(e,r,t,n,i){var s=_e(t);r=h(r),F(e,{name:r,fromWireType:function(f){return!!f},toWireType:function(f,o){return o?n:i},argPackAdvance:8,readValueFromPointer:function(f){var o;if(t===1)o=ce;else if(t===2)o=k;else if(t===4)o=b;else throw new TypeError("Unknown boolean type size: "+r);return this.fromWireType(o[f>>s])},destructorFunction:null})}function ct(e){if(!(this instanceof j)||!(e instanceof j))return!1;for(var r=this.$$.ptrType.registeredClass,t=this.$$.ptr,n=e.$$.ptrType.registeredClass,i=e.$$.ptr;r.baseClass;)t=r.upcast(t),r=r.baseClass;for(;n.baseClass;)i=n.upcast(i),n=n.baseClass;return r===n&&t===i}function lt(e){return{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}}function Ue(e){function r(t){return t.$$.ptrType.registeredClass.name}p(r(e)+" instance already deleted")}var je=!1;function dr(e){}function dt(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}function pr(e){e.count.value-=1;var r=e.count.value===0;r&&dt(e)}function ee(e){return typeof FinalizationGroup>"u"?(ee=function(r){return r},e):(je=new FinalizationGroup(function(r){for(var t=r.next();!t.done;t=r.next()){var n=t.value;n.ptr?pr(n):console.warn("object already deleted: "+n.ptr)}}),ee=function(r){return je.register(r,r.$$,r.$$),r},dr=function(r){je.unregister(r.$$)},ee(e))}function pt(){if(this.$$.ptr||Ue(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=ee(Object.create(Object.getPrototypeOf(this),{$$:{value:lt(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function vt(){this.$$.ptr||Ue(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&p("Object already scheduled for deletion"),dr(this),pr(this.$$),this.$$.preservePointerOnDelete||
|
||
|
if (arguments.length !== `+(s-2)+`) {
|
||
|
throwBindingError('function `+e+" called with ' + arguments.length + ' arguments, expected "+(s-2)+` args!');
|
||
|
}
|
||
|
`;o&&(v+=`var destructors = [];
|
||
|
`);var y=o?"destructors":"null",g=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],m=[p,n,i,pe,r[0],r[1]];f&&(v+="var thisWired = classParam.toWireType("+y+`, this);
|
||
|
`);for(var a=0;a<s-2;++a)v+="var arg"+a+"Wired = argType"+a+".toWireType("+y+", arg"+a+"); // "+r[a+2].name+`
|
||
|
`,g.push("argType"+a),m.push(r[a+2]);if(f&&(d="thisWired"+(d.length>0?", ":"")+d),v+=(c?"var rv = ":"")+"invoker(fn"+(d.length>0?", ":"")+d+`);
|
||
|
`,o)v+=`runDestructors(destructors);
|
||
|
`;else for(var a=f?1:2;a<r.length;++a){var C=a===1?"thisWired":"arg"+(a-2)+"Wired";r[a].destructorFunction!==null&&(v+=C+"_dtor("+C+"); // "+r[a].name+`
|
||
|
`,g.push(C+"_dtor"),m.push(r[a].destructorFunction))}c&&(v+=`var ret = retType.fromWireType(rv);
|
||
|
return ret;
|
||
|
`),v+=`}
|
||
|
`,g.push(v);var E=br(Function,g).apply(null,m);return E}function Ht(e,r,t,n,i,s,f,o){var a=Me(t,n);r=h(r),s=A(i,s),U([],[e],function(c){c=c[0];var l=c.name+"."+r;o&&c.registeredClass.pureVirtualFunctions.push(r);function d(){be("Cannot call "+l+" due to unbound types",a)}var v=c.registeredClass.instancePrototype,y=v[r];return y===void 0||y.overloadTable===void 0&&y.className!==c.name&&y.argCount===t-2?(d.argCount=t-2,d.className=c.name,v[r]=d):(yr(v,r,l),v[r].overloadTable[t-2]=d),U([],a,function(g){var m=wr(l,g,c,s,f);return v[r].overloadTable===void 0?(m.argCount=t-2,v[r]=m):v[r].overloadTable[t-2]=m,[]}),[]})}function Mt(e,r,t){e=h(e),U([],[r],function(n){return n=n[0],u[e]=n.fromWireType(t),[]})}var Ve=[],P=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Le(e){e>4&&--P[e].refcount===0&&(P[e]=void 0,Ve.push(e))}function Vt(){for(var e=0,r=5;r<P.length;++r)P[r]!==void 0&&++e;return e}function Lt(){for(var e=5;e<P.length;++e)if(P[e]!==void 0)return P[e];return null}function Bt(){u.count_emval_handles=Vt,u.get_first_emval=Lt}function S(e){switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var r=Ve.length?Ve.pop():P.length;return P[r]={refcount:1,value:e},r}}}function qt(e,r){r=h(r),F(e,{name:r,fromWireType:function(t){var n=P[t].value;return Le(t),n},toWireType:function(t,n){return S(n)},argPackAdvance:8,readValueFromPointer:Z,destructorFunction:null})}function Nt(e,r,t){switch(r){case 0:return function(n){var i=t?ce:_;return this.fromWireType(i[n])};case 1:return function(n){var i=t?k:J;return this.fromWireType(i[n>>1])};case 2:return function(n){var i=t?b:$;return this.fromWireType(i[n>>2])};default:throw new TypeError("Unknown integer type: "+e)}}function xt(e,r,t,n){var i=_e(t);r=h(r);function s(){}s.values={},F(e,{name:r,constructor:s,fromWireType:function(f){return this.constructor.values[f]},toWireType:function(f,o){return o.value},argPackAdvance:8,readValueFromPointer:Nt(r,i,n),destructorFunction:null}),ke(r,s)}function we(e,r){var t=M[e];return t===void 0&&p(r+" has unknown type "+mr(e)),t}function Gt(e,r,t){var n=we(e,"enum");r=h(r);var i=n.constructor,s=Object.create(n.constructor.prototype,{value:{value:t},constructor:{value:he(n.name+"_"+r,function(){})}});i.values[t]=s,i[r]=s}function N(e){if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e}function zt(e,r){switch(r){case 2:return function(t){return this.fromWireType(er[t>>2])};case 3:return function(t){return this.fromWireType(rr[t>>3])};default:throw new TypeError("Unknown float type: "+e)}}function Xt(e,r,t){var n=_e(t);r=h(r),F(e,{name:r,fromWireType:function(i){return i},toWireType:function(i,s){if(typeof s!="number"&&typeof s!="boolean")throw new TypeError('Cannot convert "'+N(s)+'" to '+this.name);return s},argPackAdvance:8,readValueFromPointer:zt(r,n),destructorFunction:null})}function Yt(e,r,t,n,i,s){var f=Me(r,t);e=h(e),i=A(n,i),ke(e,function(){be("Cannot call "+e+" due to unbound types",f)},r-1),U([],f,function(o){var a=[o[0],null].concat(o.slice(1));return gr(e,wr(e,a,null,i,s),r-1),[]})}function Jt(e,r,t){switch(r){case 0:return t?function(i){return ce[i]}:function(i){return _[i]};case 1:return t?function(i){return k[i>>1]}:function(i){return J[i>>1]};case 2:return t?function(i){return b[i>>2]}:function(i){return $[i>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function Kt(e,r,t,n,i){r=h(r),i===-1&&(i=4294967295);var s=_e(t),f=function(c){return c};if(n===0){var o=32-8*t;f=function(c){return c<<o>>>o}}var a=r.indexOf("unsigned")!=-1;F(e,{name:r,fromWireType:f,toWireType:function(c,l){if(typeof l!="number"&&typeof l!="boolean")throw new TypeError('Cannot convert "'+N(l)+'" to '+this.name);if(l<n||l>i)throw new TypeError('Passing a number "'+N(l)+'" from JS side to C/C++ side to an argument of type "'+r+'", which is outside the valid range ['+n+", "+i+"]!");return a?l>>>0:l|0},argPackAdvance:8,readValueFromPointer:Jt(r,s,n!==0),destructorFunction:null})}function Qt(e,r,t){var n=[Int8Array,Uint8Array,Int16Array,Uint16Arr
|
||
|
`,d=0,a=0;a<e-1;++a)l+=" var arg"+a+" = argType"+a+".readValueFromPointer(args"+(d?"+"+d:"")+`);
|
||
|
`,d+=t[a+1].argPackAdvance;l+=" var rv = handle[name]("+o+`);
|
||
|
`;for(var a=0;a<e-1;++a)t[a+1].deleteObject&&(l+=" argType"+a+".deleteObject(arg"+a+`);
|
||
|
`);n.isVoid||(l+=` return retType.toWireType(destructors, rv);
|
||
|
`),l+=`};
|
||
|
`,s.push(l);var v=br(Function,s).apply(null,f);return fn(v)}function dn(e){return e=Te(e),S(u[e])}function pn(e,r){return e=ie(e),r=ie(r),S(e[r])}function vn(e){e>4&&(P[e].refcount+=1)}function yn(e){for(var r="",t=0;t<e;++t)r+=(t!==0?", ":"")+"arg"+t;for(var n="return function emval_allocator_"+e+`(constructor, argTypes, args) {
|
||
|
`,t=0;t<e;++t)n+="var argType"+t+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+t+'], "parameter '+t+`");
|
||
|
var arg`+t+" = argType"+t+`.readValueFromPointer(args);
|
||
|
args += argType`+t+`['argPackAdvance'];
|
||
|
`;return n+="var obj = new constructor("+r+`);
|
||
|
return __emval_register(obj);
|
||
|
}
|
||
|
`,new Function("requireRegisteredType","Module","__emval_register",n)(we,u,S)}var Pr={};function hn(e,r,t,n){e=ie(e);var i=Pr[r];return i||(i=yn(r),Pr[r]=i),i(e,t,n)}function gn(e){return S(Te(e))}function _n(e){var r=P[e].value;pe(r),Le(e)}function mn(){L()}function bn(e,r,t){_.copyWithin(e,r,r+t)}function wn(e){try{return fe.grow(e-Oe.byteLength+65535>>>16),tr(fe.buffer),1}catch{}}function Tn(e){var r=_.length;e=e>>>0;var t=2147483648;if(e>t)return!1;for(var n=1;n<=4;n*=2){var i=r*(1+.2/n);i=Math.min(i,e+100663296);var s=Math.min(t,qr(Math.max(e,i),65536)),f=wn(s);if(f)return!0}return!1}var Pe={mappings:{},buffers:[null,[],[]],printChar:function(e,r){var t=Pe.buffers[e];r===0||r===10?((e===1?Sr:V)(Ke(t,0)),t.length=0):t.push(r)},varargs:void 0,get:function(){Pe.varargs+=4;var e=b[Pe.varargs-4>>2];return e},getStr:function(e){var r=Qe(e);return r},get64:function(e,r){return e}};function Pn(e){return 0}function Cn(e,r,t,n,i){}function An(e,r,t,n){for(var i=0,s=0;s<t;s++){for(var f=b[r+s*8>>2],o=b[r+(s*8+4)>>2],a=0;a<o;a++)Pe.printChar(e,_[f+a]);i+=o}return b[n>>2]=i,0}function $n(e){Wr(e|0)}cr=u.InternalError=De(Error,"InternalError"),ut(),q=u.BindingError=De(Error,"BindingError"),gt(),Wt(),Et(),_r=u.UnboundTypeError=De(Error,"UnboundTypeError"),Bt();var Fn={t:st,I:ft,x:It,w:kt,d:Ht,k:Mt,H:qt,n:xt,a:Gt,A:Xt,i:Yt,j:Kt,h:Qt,B:Zt,v:en,u:rn,c:tn,J:nn,m:on,s:sn,b:Le,y:un,p:ln,r:dn,e:pn,g:vn,q:hn,f:gn,l:_n,o:mn,E:bn,F:Tn,G:Pn,C:Cn,z:An,D:$n},jn=it(),En=u.___wasm_call_ctors=function(){return(En=u.___wasm_call_ctors=u.asm.L).apply(null,arguments)},qe=u._malloc=function(){return(qe=u._malloc=u.asm.M).apply(null,arguments)},O=u._free=function(){return(O=u._free=u.asm.N).apply(null,arguments)},Cr=u.___getTypeName=function(){return(Cr=u.___getTypeName=u.asm.P).apply(null,arguments)},Rn=u.___embind_register_native_and_builtin_types=function(){return(Rn=u.___embind_register_native_and_builtin_types=u.asm.Q).apply(null,arguments)},Sn=u.dynCall_jiji=function(){return(Sn=u.dynCall_jiji=u.asm.R).apply(null,arguments)},Ce;function On(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}Q=function e(){Ce||Ne(),Ce||(Q=e)};function Ne(e){if(e=e||z,H>0||(Gr(),H>0))return;function r(){Ce||(Ce=!0,u.calledRun=!0,!Ye&&(zr(),Xr(),xe(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),Yr()))}u.setStatus?(u.setStatus("Running..."),setTimeout(function(){setTimeout(function(){u.setStatus("")},1),r()},1)):r()}if(u.run=Ne,u.preInit)for(typeof u.preInit=="function"&&(u.preInit=[u.preInit]);u.preInit.length>0;)u.preInit.pop()();return Ne(),x.ready}}();typeof exports=="object"&&typeof module=="object"?module.exports=BASIS:typeof define=="function"&&define.amd?define([],function(){return BASIS}):typeof exports=="object"&&(exports.BASIS=BASIS);
|