diff --git a/package-lock.json b/package-lock.json index b286bd9..675fa24 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4765,9 +4765,9 @@ } }, "node_modules/micromatch": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz", - "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, "dependencies": { "braces": "^3.0.3", diff --git a/public/engines/stockfish-16.1/nn-b1a57edbea57.nnue b/public/engines/stockfish-16.1/nn-b1a57edbea57.nnue new file mode 100644 index 0000000..bac8c2c Binary files /dev/null and b/public/engines/stockfish-16.1/nn-b1a57edbea57.nnue differ diff --git a/public/engines/stockfish-16.1/nn-baff1ede1f90.nnue b/public/engines/stockfish-16.1/nn-baff1ede1f90.nnue new file mode 100644 index 0000000..6469b88 Binary files /dev/null and b/public/engines/stockfish-16.1/nn-baff1ede1f90.nnue differ diff --git a/public/engines/stockfish-16.1/stockfish-16.1-lite-single.js b/public/engines/stockfish-16.1/stockfish-16.1-lite-single.js new file mode 100644 index 0000000..84fe733 --- /dev/null +++ b/public/engines/stockfish-16.1/stockfish-16.1-lite-single.js @@ -0,0 +1,11 @@ +/*! + * Stockfish.js 16.1 (c) 2024, Chess.com, LLC + * https://github.com/nmrugg/stockfish.js + * License: GPLv3 + * + * Based on Stockfish (c) T. Romstad, M. Costalba, J. Kiiski, G. Linscott and other contributors. + * https://github.com/official-stockfish/Stockfish + * + * Nets by Linmiao Xu (linrock) + * https://tests.stockfishchess.org/nns?network_name=nn-9067e33176e + */!function(){var a,u,s,e,t,r;function o(){function e(e){e=e||{},(f=f||(void 0!==e?e:{})).ready=new Promise(function(e,n){T=e,i=n}),"undefined"!=typeof global&&"[object process]"===Object.prototype.toString.call(global.process)&&"undefined"!=typeof fetch&&("undefined"==typeof XMLHttpRequest&&(global.XMLHttpRequest=function(){var t,r={open:function(e,n){t=n},send:function(){require("fs").readFile(t,function(e,n){r.readyState=4,e?(console.error(e),r.status=404,r.onerror(e)):(r.status=200,r.response=n,r.onreadystatechange(),r.onload())})}};return r}),fetch=null),f.print=function(e){f.listener?f.listener(e):console.log(e)},f.printErr=function(e){f.listener?f.listener(e):console.error(e)},f.terminate=function(){"undefined"!=typeof PThread&&PThread.Y()};var f,T,i,n,t,U,r,H,a,o=Object.assign({},f),u=[],s="./this.program",c=(e,n)=>{throw n},k="object"==typeof window,l="function"==typeof importScripts,q="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,p="",L=(q?(p=l?require("path").dirname(p)+"/":__dirname+"/",H=()=>{r||(U=require("fs"),r=require("path"))},n=function(e,n){return H(),e=r.normalize(e),U.readFileSync(e,n?void 0:"utf8")},t=e=>e=(e=n(e,!0)).buffer?e:new Uint8Array(e),1{if(m||0<_)throw process.exitCode=e,n;n instanceof j||d("exiting due to exception: "+n),process.exit(e)},f.inspect=function(){return"[Emscripten Module object]"}):(k||l)&&(l?p=self.location.href:"undefined"!=typeof document&&document.currentScript&&(p=document.currentScript.src),p=0!==(p=Pe?Pe:p).indexOf("blob:")?p.substr(0,p.replace(/[?#].*/,"").lastIndexOf("/")+1):"",n=e=>{var n=new XMLHttpRequest;return n.open("GET",e,!1),n.send(null),n.responseText},l)&&(t=e=>{var n=new XMLHttpRequest;return n.open("GET",e,!1),n.responseType="arraybuffer",n.send(null),new Uint8Array(n.response)}),f.print||console.log.bind(console)),d=f.printErr||console.warn.bind(console),m=(Object.assign(f,o),f.arguments&&(u=f.arguments),f.thisProgram&&(s=f.thisProgram),f.quit&&(c=f.quit),f.wasmBinary&&(a=f.wasmBinary),f.noExitRuntime||!0);"object"!=typeof WebAssembly&&C("no native wasm support detected");var W,B,y,h,g,v=!1,N="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function J(e,n,t){var r=n+t;for(t=n;e[t]&&!(r<=t);)++t;if(16>10,56320|1023&a)))):r+=String.fromCharCode(a)}return r}function X(e){return e?J(h,e,void 0):""}function z(e,n,t,r){if(0>6}else{if(i<=65535){if(r<=t+2)break;n[t++]=224|i>>12}else{if(r<=t+3)break;n[t++]=240|i>>18,n[t++]=128|i>>12&63}n[t++]=128|i>>6&63}n[t++]=128|63&i}}n[t]=0}}function G(e){for(var n=0,t=0;t{var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:()=>performance.now(),fe={};function pe(){if(!ce){var e,n={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:s||"./this.program"};for(e in fe)void 0===fe[e]?delete n[e]:n[e]=fe[e];var t=[];for(e in n)t.push(e+"="+n[e]);ce=t}return ce}function A(e){return 0==e%4&&(0!=e%100||0==e%400)}function de(e,n){for(var t=0,r=0;r<=n;t+=e[r++]);return t}var I=[31,29,31,30,31,30,31,31,30,31,30,31],R=[31,28,31,30,31,30,31,31,30,31,30,31];function M(e,n){for(e=new Date(e.getTime());0r-e.getDate())){e.setDate(e.getDate()+n);break}n-=r-e.getDate()+1,e.setDate(1),t<11?e.setMonth(t+1):(e.setMonth(0),e.setFullYear(e.getFullYear()+1))}return e}function me(e,n,t,r){function o(e,n,t){for(e="number"==typeof e?e.toString():e||"";e.length>2];for(c in r={U:g[r>>2],T:g[r+4>>2],L:g[r+8>>2],K:g[r+12>>2],J:g[r+16>>2],I:g[r+20>>2],M:g[r+24>>2],N:g[r+28>>2],Z:g[r+32>>2],S:g[r+36>>2],V:l?X(l):""},t=X(t),l={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})t=t.replace(new RegExp(c,"g"),l[c]);var f,p,d="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),m="January February March April May June July August September October November December".split(" "),l={"%a":function(e){return d[e.M].substring(0,3)},"%A":function(e){return d[e.M]},"%b":function(e){return m[e.J].substring(0,3)},"%B":function(e){return m[e.J]},"%C":function(e){return i((e.I+1900)/100|0,2)},"%d":function(e){return i(e.K,2)},"%e":function(e){return o(e.K,2," ")},"%g":function(e){return s(e).toString().substring(2)},"%G":s,"%H":function(e){return i(e.L,2)},"%I":function(e){return 0==(e=e.L)?e=12:12n?0:(y.set(c,e),c.length-1)}function x(e){try{e()}catch(e){C(e)}}var F=0,E=null,O=[],ye={},he={},ge=0,ve=null,we=[];function _e(t){var e,r={};for(e in t)!function(e){var n=t[e];r[e]="function"==typeof n?function(){O.push(e);try{return n.apply(null,arguments)}finally{v||(O.pop()!==e&&C(void 0),E&&1===F&&0===O.length&&(F=0,x(f._asyncify_stop_unwind),"undefined"!=typeof Fibers)&&Fibers.$())}}:n}(e);return r}function be(e){var o,i,n,t;v||(0===F?(i=o=!1,e(()=>{if(!v&&(o=!0,i)){F=2,x(()=>f._asyncify_start_rewind(E)),"undefined"!=typeof Browser&&Browser.P.R&&Browser.P.resume();var n=!1;try{var t=(0,f.asm[he[g[E+8>>2]]])()}catch(e){t=e,n=!0}var e,r=!1;if(E||(e=ve)&&(ve=null,(n?e.reject:e.resolve)(t),r=!0),n&&!r)throw t}}),i=!0,o||(F=1,e=Ae(10485772),n=e+12,g[e>>2]=n,g[e+4>>2]=n+10485760,n=O[0],void 0===(t=ye[n])&&(t=ge++,ye[n]=t,he[t]=n),g[e+8>>2]=t,E=e,x(()=>f._asyncify_start_unwind(E)),"undefined"!=typeof Browser&&Browser.P.R&&Browser.P.pause())):2===F?(F=0,x(f._asyncify_stop_rewind),Ce(E),E=null,we.forEach(e=>se(e))):C("invalid state: "+F))}var P,Se={c:function(){return 0},j:function(){},f:function(){return 0},g:function(){},a:function(){C("")},h:function(e,n){if(0===e)e=Date.now();else{if(1!==e&&4!==e)return g[De()>>2]=28,-1;e=le()}return g[n>>2]=e/1e3|0,g[n+4>>2]=e%1e3*1e6|0,0},i:function(e,n,t){h.copyWithin(e,n,n+t)},b:function(e){var n=h.length;if(!(2147483648<(e>>>=0)))for(var t=1;t<=4;t*=2){var r=n*(1+.2/t),r=Math.min(r,e+100663296),o=Math;r=Math.max(e,r),o=o.min.call(o,2147483648,r+(65536-r%65536)%65536);e:{try{W.grow(o-B.byteLength+65535>>>16),V();var i=1;break e}catch(e){}i=void 0}if(i)return!0}return!1},k:function(t){be(e=>{return n=e,setTimeout(function(){se(n)},t);var n})},n:function(r,o){var i=0;return pe().forEach(function(e,n){var t=o+i;for(n=g[r+4*n>>2]=t,t=0;t>0]=e.charCodeAt(t);y[n>>0]=0,i+=e.length+1}),0},o:function(e,n){var t=pe(),r=(g[e>>2]=t.length,0);return t.forEach(function(e){r+=e.length+1}),g[n>>2]=r,0},e:function(e){Ee(e)},d:function(){return 0},q:function(e,n,t,r){return e=ue.X(e),n=ue.W(e,n,t),g[r>>2]=n,0},l:function(){},p:function(e,n,t,r){for(var o=0,i=0;i>2],u=g[n+4>>2];n+=8;for(var s=0;s>2]=o,0},m:me},Ce=(!function(){function n(e){e=_e(e=e.exports),f.asm=e,W=f.asm.r,V(),$.unshift(f.asm.s),b--,f.monitorRunDependencies&&f.monitorRunDependencies(b),0==b&&(null!==te&&(clearInterval(te),te=null),S)&&(e=S,S=null,e())}function t(e){n(e.instance)}function r(e){return(a||!k&&!l||"function"!=typeof fetch?Promise.resolve().then(oe):fetch(w,{credentials:"same-origin"}).then(function(e){if(e.ok)return e.arrayBuffer();throw"failed to load wasm binary file at '"+w+"'"}).catch(oe)).then(function(e){return WebAssembly.instantiate(e,o)}).then(function(e){return e}).then(e,function(e){d("failed to asynchronously prepare wasm: "+e),C(e)})}var o={a:Se};if(b++,f.monitorRunDependencies&&f.monitorRunDependencies(b),f.instantiateWasm)try{var e=f.instantiateWasm(o,n);return _e(e)}catch(e){return d("Module.instantiateWasm callback failed with error: "+e)}(a||"function"!=typeof WebAssembly.instantiateStreaming||re()||"function"!=typeof fetch?r(t):fetch(w,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,o).then(t,function(e){return d("wasm streaming compile failed: "+e),d("falling back to ArrayBuffer instantiation"),r(t)})})).catch(i)}(),f.___wasm_call_ctors=function(){return(f.___wasm_call_ctors=f.asm.s).apply(null,arguments)},f._main=function(){return(f._main=f.asm.t).apply(null,arguments)},f._command=function(){return(f._command=f.asm.u).apply(null,arguments)},f._free=function(){return(Ce=f._free=f.asm.v).apply(null,arguments)}),De=f.___errno_location=function(){return(De=f.___errno_location=f.asm.w).apply(null,arguments)},Ae=f._malloc=function(){return(Ae=f._malloc=f.asm.x).apply(null,arguments)},Ie=f.stackSave=function(){return(Ie=f.stackSave=f.asm.z).apply(null,arguments)},Re=f.stackRestore=function(){return(Re=f.stackRestore=f.asm.A).apply(null,arguments)},Y=f.stackAlloc=function(){return(Y=f.stackAlloc=f.asm.B).apply(null,arguments)},Me=f.dynCall_vi=function(){return(Me=f.dynCall_vi=f.asm.C).apply(null,arguments)},xe=f.dynCall_v=function(){return(xe=f.dynCall_v=f.asm.D).apply(null,arguments)};function j(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function Fe(i){function e(){if(!P&&(P=!0,f.calledRun=!0,!v)){if(D($),D(Q),T(f),f.onRuntimeInitialized&&f.onRuntimeInitialized(),Oe){var e=i,n=f._main,t=(e=e||[]).length+1,r=Y(4*(t+1));g[r>>2]=K(s);for(var o=1;o>2)+o]=K(e[o-1]);g[(r>>2)+t]=0;try{Ee(n(t,r))}catch(e){ie(e)}}if(f.postRun)for("function"==typeof f.postRun&&(f.postRun=[f.postRun]);f.postRun.length;)e=f.postRun.shift(),ee.unshift(e);D(ee)}}if(i=i||u,!(0{ve={resolve:e,reject:n}}).then(i):(r=i(r),o?Promise.resolve(r):r)},S=function e(){P||Fe(),P||(S=e)},f.run=Fe,f.preInit)for("function"==typeof f.preInit&&(f.preInit=[f.preInit]);0>>0)),i=a.slice(0,-n.length);for(e=0;e{throw t},N="object"==typeof window,o="function"==typeof importScripts,u="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,d=c.ENVIRONMENT_IS_PTHREAD||!1,a="";function V(e){return c.locateFile?c.locateFile(e,a):a+e}if(u){a=o?require("path").dirname(a)+"/":__dirname+"/",U=()=>{L||(n=require("fs"),L=require("path"))},B=function(e,t){return U(),e=L.normalize(e),n.readFileSync(e,t?void 0:"utf8")},t=e=>e=(e=B(e,!0)).buffer?e:new Uint8Array(e),1{if(b())throw process.exitCode=e,t;t instanceof q||m("exiting due to exception: "+t),process.exit(e)},c.inspect=function(){return"[Emscripten Module object]"};let e;try{e=require("worker_threads")}catch(e){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),e}global.Worker=e.Worker}else(N||o)&&(o?a=self.location.href:"undefined"!=typeof document&&document.currentScript&&(a=document.currentScript.src),a=0!==(a=ht?ht:a).indexOf("blob:")?a.substr(0,a.replace(/[?#].*/,"").lastIndexOf("/")+1):"",u||(B=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},o&&(t=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)})));u&&"undefined"==typeof performance&&(global.performance=require("perf_hooks").performance);var G,f,p=console.log.bind(console),$=console.warn.bind(console),X=(u&&(U(),p=e=>n.writeSync(1,e+"\n"),$=e=>n.writeSync(2,e+"\n")),c.print||p),m=c.printErr||$,z=(Object.assign(c,Y),c.arguments&&(H=c.arguments),c.thisProgram&&(s=c.thisProgram),c.quit&&(r=c.quit),c.wasmBinary&&(f=c.wasmBinary),c.noExitRuntime||!0);"object"!=typeof WebAssembly&&A("no native wasm support detected");var _,Q,J=!1;function K(e){var t=new TextDecoder(e);this.decode=e=>(e.buffer instanceof SharedArrayBuffer&&(e=new Uint8Array(e)),t.decode.call(t,e))}var g,Z,ee,te,ne,re="undefined"!=typeof TextDecoder?new K("utf8"):void 0;function ae(e,t,n){var r=t+n;for(n=t;e[n]&&!(r<=n);)++n;if(16>10,56320|1023&i)))):r+=String.fromCharCode(i)}return r}function y(e){return e?ae(l(),e,void 0):""}function w(e,t,n,r){if(0>6}else{if(o<=65535){if(r<=n+2)break;t[n++]=224|o>>12}else{if(r<=n+3)break;t[n++]=240|o>>18,t[n++]=128|o>>12&63}t[n++]=128|o>>6&63}t[n++]=128|63&o}}t[n]=0}}function oe(e){for(var t=0,n=0;n>2]=0,E.wa(t.worker))}var E={ba:[],ha:[],ma:[],Ca:function(){d&&E.Ea()},Xa:function(){},Ea:function(){E.receiveObjectTransfer=E.Ha,E.threadInit=E.xa,E.setExitStatus=E.Ja,z=!1},aa:{},Ja:function(){},ra:function(){for(var e in E.aa){var t=E.aa[e];t&&t.worker&&E.wa(t.worker)}for(e=0;e>2]=0;try{e()}finally{h()[lt>>2]=1}},Ha:function(){},xa:function(){for(var e in E.ma)E.ma.hasOwnProperty(e)&&E.ma[e]()},Fa:function(r,a){r.onmessage=e=>{var t,n=(e=e.data).cmd;r.da&&(E.za=r.da.sa),e.targetThread&&e.targetThread!=it()?(t=E.aa[e.bb])?t.worker.postMessage(e,e.transferList):m('Internal error! Worker sent a message "'+n+'" to target pthread '+e.targetThread+", but that thread no longer exists!"):"processQueuedMainThreadWork"===n?nt():"spawnThread"===n?xe(e):"cleanupThread"===n?we(e.thread):"killThread"===n?(e=e.thread,h()[e>>2]=0,n=E.aa[e],delete E.aa[e],n.worker.terminate(),ot(e),E.ha.splice(E.ha.indexOf(n.worker),1),n.worker.da=void 0):"cancelThread"===n?E.aa[e.thread].worker.postMessage({cmd:"cancel"}):"loaded"===n?(r.loaded=!0,a&&a(r),r.ga&&(r.ga(),delete r.ga)):"print"===n?X("Thread "+e.threadId+": "+e.text):"printErr"===n?m("Thread "+e.threadId+": "+e.text):"alert"===n?alert("Thread "+e.threadId+": "+e.text):"setimmediate"===e.target?r.postMessage(e):"onAbort"===n?c.onAbort&&c.onAbort(e.arg):m("worker sent an unknown command "+n),E.za=void 0},r.onerror=e=>{throw m("worker sent an error! "+e.filename+":"+e.lineno+": "+e.message),e},u&&(r.on("message",function(e){r.onmessage({data:e})}),r.on("error",function(e){r.onerror(e)}),r.on("detachedExit",function(){})),r.postMessage({cmd:"load",urlOrBlob:c.mainScriptUrlOrBlob||ht,wasmMemory:_,wasmModule:Q})},ya:function(){var e=V("stockfish.worker.js");E.ba.push(new Worker(e))},Ba:function(){return 0==E.ba.length&&(E.ya(),E.Fa(E.ba[0])),E.ba.pop()}};function ve(e){if(d)return I(1,0,e);try{pt(e)}catch(e){e instanceof q||"unwind"==e||r(1,e)}}c.establishStackSpace=function(){var e=it(),t=h()[e+44>>2],e=h()[e+48>>2];ut(t,t-e),ft(t)};var D=[];function be(e){var t=D[e];return t||(e>=D.length&&(D.length=e+1),D[e]=t=ue.get(e)),t}function xe(e){var t=E.Ba();if(!t)return 6;E.ha.push(t);var n=E.aa[e.qa]={worker:t,sa:e.qa},r=(t.da=n,{cmd:"run",start_routine:e.Ka,arg:e.fa,threadInfoStruct:e.qa});return t.ga=()=>{r.time=performance.now(),t.postMessage(r,e.Pa)},t.loaded&&(t.ga(),delete t.ga),0}c.invokeEntryPoint=function(e,t){return be(e)(t)};var Se=u?()=>{var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:d?()=>performance.now()-c.__performance_now_clock_drift:()=>performance.now(),Me=[null,[],[]],Ae={};function ke(e,t,n){return d?I(2,1,e,t,n):0}function Ee(e,t){if(d)return I(3,1,e,t)}function De(e,t,n){return d?I(4,1,e,t,n):0}function Ie(e,t,n){if(d)return I(5,1,e,t,n)}function I(a,o){var i=arguments.length-2,s=arguments;return ye(function(){for(var e=j(8*i),t=e>>3,n=0;n>2]=t,h()[s.la+4>>2]=n),!s.va&&s.Ra?s.la?(s=h()[s.la+8>>2],e=e?y(e):"",r=s,a=e,o=t,i=n,ye(function(){var e,t=j(12),n=0;a&&(n=oe(a)+1,e=st(n),w(a,l(),e,n),n=e),h()[t>>2]=n,h()[t+4>>2]=o,h()[t+8>>2]=i,at(r,657457152,0,n,t)}),1):-4:(e=!1,(s=s.va?s.va:s).ka&&s.ka.ja&&(e=0===(e=s.ka.ja.getParameter(2978))[0]&&0===e[1]&&e[2]===s.width&&e[3]===s.height),s.width=t,s.height=n,e&&s.ka.ja.viewport(0,0,t,n),0)):-4}function je(e,t,n){return d?I(6,1,e,t,n):Ce(e,t,n)}function qe(n,e){n.ta||(n.ta=n.getContext,n.getContext=function(e,t){return"webgl"==e==(t=n.ta(e,t))instanceof WebGLRenderingContext?t:null});var t,r,a,o=n.getContext("webgl",e);{if(o){if(o=o,e=e,r=st(8),h()[r+4>>2]=it(),a={Wa:r,attributes:e,version:e.Ga,ja:o},o.canvas&&(o.canvas.ka=a),(void 0===e.ua||e.ua)&&!(o=(o=a)||Pe).Da){o.Da=!0;var i=t=o.ja,s=i.getExtension("ANGLE_instanced_arrays"),u=(s&&(i.vertexAttribDivisor=function(e,t){s.vertexAttribDivisorANGLE(e,t)},i.drawArraysInstanced=function(e,t,n,r){s.drawArraysInstancedANGLE(e,t,n,r)},i.drawElementsInstanced=function(e,t,n,r,a){s.drawElementsInstancedANGLE(e,t,n,r,a)}),t),c=u.getExtension("OES_vertex_array_object"),f=(c&&(u.createVertexArray=function(){return c.createVertexArrayOES()},u.deleteVertexArray=function(e){c.deleteVertexArrayOES(e)},u.bindVertexArray=function(e){c.bindVertexArrayOES(e)},u.isVertexArray=function(e){return c.isVertexArrayOES(e)}),t),l=f.getExtension("WEBGL_draw_buffers");l&&(f.drawBuffers=function(e,t){l.drawBuffersWEBGL(e,t)}),t.Sa=t.getExtension("EXT_disjoint_timer_query"),t.Za=t.getExtension("WEBGL_multi_draw"),(t.getSupportedExtensions()||[]).forEach(function(e){e.includes("lose_context")||e.includes("debug")||t.getExtension(e)})}return r}return 0}}var Pe,Fe,We=["default","low-power","high-performance"],Be={};function Le(){if(!Fe){var e,t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:s||"./this.program"};for(e in Be)void 0===Be[e]?delete t[e]:t[e]=Be[e];var n=[];for(e in t)n.push(e+"="+t[e]);Fe=n}return Fe}function Ue(r,a){var o;return d?I(7,1,r,a):(o=0,Le().forEach(function(e,t){var n=a+o;for(t=h()[r+4*t>>2]=n,n=0;n>0]=e.charCodeAt(n);i()[t>>0]=0,o+=e.length+1}),0)}function Ye(e,t){var n,r;return d?I(8,1,e,t):(n=Le(),h()[e>>2]=n.length,r=0,n.forEach(function(e){r+=e.length+1}),h()[t>>2]=r,0)}function He(e){return d?I(9,1,e):0}function Ne(e,t,n,r){return d?I(10,1,e,t,n,r):(e=Ae.Va(e),t=Ae.Ta(e,t,n),h()[r>>2]=t,0)}function Ve(e,t,n,r,a){if(d)return I(11,1,e,t,n,r,a)}function Ge(e,t,n,r){if(d)return I(12,1,e,t,n,r);for(var a=0,o=0;o>2],s=h()[t+4>>2];t+=8;for(var u=0;u>2]=a,0}function R(e){return 0==e%4&&(0!=e%100||0==e%400)}function $e(e,t){for(var n=0,r=0;r<=t;n+=e[r++]);return n}var O=[31,29,31,30,31,30,31,31,30,31,30,31],T=[31,28,31,30,31,30,31,31,30,31,30,31];function C(e,t){for(e=new Date(e.getTime());0r-e.getDate())){e.setDate(e.getDate()+t);break}t-=r-e.getDate()+1,e.setDate(1),n<11?e.setMonth(n+1):(e.setMonth(0),e.setFullYear(e.getFullYear()+1))}return e}function Xe(e,t,n,r){function a(e,t,n){for(e="number"==typeof e?e.toString():e||"";e.length>2];for(c in r={Na:h()[r>>2],Ma:h()[r+4>>2],na:h()[r+8>>2],ia:h()[r+12>>2],ea:h()[r+16>>2],$:h()[r+20>>2],oa:h()[r+24>>2],pa:h()[r+28>>2],cb:h()[r+32>>2],La:h()[r+36>>2],Oa:f?y(f):""},n=y(n),f={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(new RegExp(c,"g"),f[c]);var l,d,p="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),m="January February March April May June July August September October November December".split(" "),f={"%a":function(e){return p[e.oa].substring(0,3)},"%A":function(e){return p[e.oa]},"%b":function(e){return m[e.ea].substring(0,3)},"%B":function(e){return m[e.ea]},"%C":function(e){return o((e.$+1900)/100|0,2)},"%d":function(e){return o(e.ia,2)},"%e":function(e){return a(e.ia,2," ")},"%g":function(e){return u(e).toString().substring(2)},"%G":u,"%H":function(e){return o(e.na,2)},"%I":function(e){return 0==(e=e.na)?e=12:12t?0:(se(c,e),c.length-1)}E.Ca();var ze,Qe=[null,ve,ke,Ee,De,Ie,je,Ue,Ye,He,Ne,Ve,Ge],Je={p:function(e,t){Ke(e,t)},l:function(e){et(e,!o,1,!N),E.xa()},i:function(e){d?postMessage({cmd:"cleanupThread",thread:e}):we(e)},e:function(e,t,n,r){var a;return"undefined"==typeof SharedArrayBuffer?(m("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6):(a=[],d&&0===a.length?tt(687865856,e,t,n,r):(e={Ka:n,qa:e,fa:r,Pa:a},d?(e.Qa="spawnThread",postMessage(e,a),0):xe(e)))},g:ke,v:Ee,u:De,w:Ie,B:function(){return 2097152},m:function(e,t){if(e==t)postMessage({cmd:"processQueuedMainThreadWork"});else if(d)postMessage({targetThread:e,cmd:"processThreadQueue"});else{if(!(e=(e=E.aa[e])&&e.worker))return;e.postMessage({cmd:"processThreadQueue"})}return 1},b:function(){A("")},x:function(e,t){if(0===e)e=Date.now();else{if(1!==e&&4!==e)return h()[Ze()>>2]=28,-1;e=Se()}return h()[t>>2]=e/1e3|0,h()[t+4>>2]=e%1e3*1e6|0,0},h:function(){u||o||(G=G||{})["Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread"]||(G["Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread"]=1,m("Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread"))},c:Se,A:function(e,t,n){l().copyWithin(e,t,t+n)},C:function(e,t,n){Re.length=t,n>>=3;for(var r=0;r>>=0)<=t||2147483648>>16),v(_.buffer);var o=1;break e}catch(e){}o=void 0}if(o)return!0}return!1},j:function(e,t,n){return(Te(e)?Ce:je)(e,t,n)},n:function(){throw"unwind"},k:function(e,t){t>>=2;var n=h()[t+6];return t={alpha:!!h()[t],depth:!!h()[t+1],stencil:!!h()[t+2],antialias:!!h()[t+3],premultipliedAlpha:!!h()[t+4],preserveDrawingBuffer:!!h()[t+5],powerPreference:We[n],failIfMajorPerformanceCaveat:!!h()[t+7],Ga:h()[t+8],Ya:h()[t+9],ua:h()[t+10],Aa:h()[t+11],$a:h()[t+12],ab:h()[t+13]},!(e=Te(e))||t.Aa?0:qe(e,t)},r:Ue,s:Ye,d:function(e){pt(e)},f:He,t:Ne,o:Ve,y:Ge,a:_||c.wasmMemory,q:Xe},Ke=(!function(){function t(e,t){c.asm=e.exports,E.ma.push(c.asm.I),ue=c.asm.W,fe.unshift(c.asm.D),Q=t,d||(S--,c.monitorRunDependencies&&c.monitorRunDependencies(S),0==S&&(null!==me&&(clearInterval(me),me=null),M)&&(e=M,M=null,e()))}function n(e){t(e.instance,e.module)}function r(e){return(f||!N&&!o||"function"!=typeof fetch?Promise.resolve().then(_e):fetch(x,{credentials:"same-origin"}).then(function(e){if(e.ok)return e.arrayBuffer();throw"failed to load wasm binary file at '"+x+"'"}).catch(_e)).then(function(e){return WebAssembly.instantiate(e,a)}).then(function(e){return e}).then(e,function(e){m("failed to asynchronously prepare wasm: "+e),A(e)})}var a={a:Je};if(d||(S++,c.monitorRunDependencies&&c.monitorRunDependencies(S)),c.instantiateWasm)try{return c.instantiateWasm(a,t)}catch(e){return m("Module.instantiateWasm callback failed with error: "+e)}(f||"function"!=typeof WebAssembly.instantiateStreaming||he()||"function"!=typeof fetch?r(n):fetch(x,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,a).then(n,function(e){return m("wasm streaming compile failed: "+e),m("falling back to ArrayBuffer instantiation"),r(n)})})).catch(W)}(),c.___wasm_call_ctors=function(){return(c.___wasm_call_ctors=c.asm.D).apply(null,arguments)},c._main=function(){return(Ke=c._main=c.asm.E).apply(null,arguments)}),Ze=(c._command=function(){return(c._command=c.asm.F).apply(null,arguments)},c._isReady=function(){return(c._isReady=c.asm.G).apply(null,arguments)},c._free=function(){return(c._free=c.asm.H).apply(null,arguments)},c._emscripten_tls_init=function(){return(c._emscripten_tls_init=c.asm.I).apply(null,arguments)},c.___errno_location=function(){return(Ze=c.___errno_location=c.asm.J).apply(null,arguments)}),et=(c.__emscripten_thread_crashed=function(){return(c.__emscripten_thread_crashed=c.asm.K).apply(null,arguments)},c._emscripten_proxy_main=function(){return(c._emscripten_proxy_main=c.asm.L).apply(null,arguments)},c.__emscripten_thread_init=function(){return(et=c.__emscripten_thread_init=c.asm.M).apply(null,arguments)}),tt=(c._emscripten_current_thread_process_queued_calls=function(){return(c._emscripten_current_thread_process_queued_calls=c.asm.N).apply(null,arguments)},c._emscripten_sync_run_in_main_thread_4=function(){return(tt=c._emscripten_sync_run_in_main_thread_4=c.asm.O).apply(null,arguments)}),nt=c._emscripten_main_thread_process_queued_calls=function(){return(nt=c._emscripten_main_thread_process_queued_calls=c.asm.P).apply(null,arguments)},rt=c._emscripten_run_in_main_runtime_thread_js=function(){return(rt=c._emscripten_run_in_main_runtime_thread_js=c.asm.Q).apply(null,arguments)},at=c._emscripten_dispatch_to_thread_=function(){return(at=c._emscripten_dispatch_to_thread_=c.asm.R).apply(null,arguments)},ot=c.__emscripten_thread_free_data=function(){return(ot=c.__emscripten_thread_free_data=c.asm.S).apply(null,arguments)},it=(c.__emscripten_thread_exit=function(){return(c.__emscripten_thread_exit=c.asm.T).apply(null,arguments)},c._pthread_self=function(){return(it=c._pthread_self=c.asm.U).apply(null,arguments)}),st=c._malloc=function(){return(st=c._malloc=c.asm.V).apply(null,arguments)},ut=c._emscripten_stack_set_limits=function(){return(ut=c._emscripten_stack_set_limits=c.asm.X).apply(null,arguments)},ct=c.stackSave=function(){return(ct=c.stackSave=c.asm.Y).apply(null,arguments)},ft=c.stackRestore=function(){return(ft=c.stackRestore=c.asm.Z).apply(null,arguments)},j=c.stackAlloc=function(){return(j=c.stackAlloc=c.asm._).apply(null,arguments)},lt=c.__emscripten_allow_main_runtime_queued_calls=6652224;function q(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function dt(o){function e(){if(!ze&&(ze=!0,c.calledRun=!0,!J)){if(d||k(fe),d||k(le),F(c),c.onRuntimeInitialized&&c.onRuntimeInitialized(),mt){var e=o,t=c._emscripten_proxy_main,n=(e=e||[]).length+1,r=j(4*(n+1));h()[r>>2]=ie(s);for(var a=1;a>2)+a]=ie(e[a-1]);h()[(r>>2)+n]=0,t(n,r)}if(!d){if(c.postRun)for("function"==typeof c.postRun&&(c.postRun=[c.postRun]);c.postRun.length;)e=c.postRun.shift(),de.unshift(e);k(de)}}}if(o=o||H,!(0>>0)),o=s.slice(0,-t.length);for(e=0;e{e=new WebAssembly.Instance(r.wasmModule,e);return t(e),r.wasmModule=null,e.exports},self.onmessage=e=>{try{var t;if("load"===e.data.cmd)r.wasmModule=e.data.wasmModule,r.wasmMemory=e.data.wasmMemory,r.buffer=r.wasmMemory.buffer,r.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof e.data.urlOrBlob?importScripts(e.data.urlOrBlob):(t=URL.createObjectURL(e.data.urlOrBlob),importScripts(t),URL.revokeObjectURL(t)),i(r).then(function(e){r=e});else if("run"===e.data.cmd){r.__performance_now_clock_drift=performance.now()-e.data.time,r.__emscripten_thread_init(e.data.threadInfoStruct,0,0,1),r.establishStackSpace(),r.PThread.receiveObjectTransfer(e.data),r.PThread.threadInit();try{var n=r.invokeEntryPoint(e.data.start_routine,e.data.arg);r.keepRuntimeAlive()?r.PThread.setExitStatus(n):r.__emscripten_thread_exit(n)}catch(e){if("unwind"!=e){if(!(e instanceof r.ExitStatus))throw e;r.keepRuntimeAlive()||r.__emscripten_thread_exit(e.status)}}}else"cancel"===e.data.cmd?r._pthread_self()&&r.__emscripten_thread_exit(-1):"setimmediate"!==e.data.target&&("processThreadQueue"===e.data.cmd?r._pthread_self()&&r._emscripten_current_thread_process_queued_calls():"processProxyingQueue"===e.data.cmd?r._pthread_self()&&r._emscripten_proxy_execute_queue(e.data.queue):(o("worker.js received unknown command "+e.data.cmd),o(e.data)))}catch(e){throw o("worker.js onmessage() captured an uncaught exception: "+e),e&&e.stack&&o(e.stack),r.__emscripten_thread_crashed&&r.__emscripten_thread_crashed(),e}},self._origOnmessage=self.onmessage,self.onmessage=function(e){"load"===e.data.cmd?(r.wasmModule=e.data.wasmModule,r.wasmMemory=e.data.wasmMemory,r.buffer=r.wasmMemory.buffer,r.ENVIRONMENT_IS_PTHREAD=!0,e.data.workerID&&(r.workerID=e.data.workerID),e.data.wasmSourceMap&&(r.wasmSourceMapData=e.data.wasmSourceMap),e.data.wasmOffsetConverter&&(r.wasmOffsetData=e.data.wasmOffsetConverter),(i=f())(r).then(function(e){r=e})):self._origOnmessage(e)}}():"undefined"!=typeof onmessage&&("undefined"==typeof window||void 0===window.document)||"undefined"!=typeof global&&"[object process]"===Object.prototype.toString.call(global.process)?(e="undefined"!=typeof global&&"[object process]"===Object.prototype.toString.call(global.process),n={},r=[],e?require.main===module?(c=require("path"),s=c.join(__dirname,c.basename(__filename,c.extname(__filename))+".wasm"),n={locateFile:function(e){return-1{throw n},k="object"==typeof window,l="function"==typeof importScripts,q="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,p="",L=(q?(p=l?require("path").dirname(p)+"/":__dirname+"/",H=()=>{r||(U=require("fs"),r=require("path"))},n=function(e,n){return H(),e=r.normalize(e),U.readFileSync(e,n?void 0:"utf8")},t=e=>e=(e=n(e,!0)).buffer?e:new Uint8Array(e),1{if(m||0<_)throw process.exitCode=e,n;n instanceof j||d("exiting due to exception: "+n),process.exit(e)},f.inspect=function(){return"[Emscripten Module object]"}):(k||l)&&(l?p=self.location.href:"undefined"!=typeof document&&document.currentScript&&(p=document.currentScript.src),p=0!==(p=Pe?Pe:p).indexOf("blob:")?p.substr(0,p.replace(/[?#].*/,"").lastIndexOf("/")+1):"",n=e=>{var n=new XMLHttpRequest;return n.open("GET",e,!1),n.send(null),n.responseText},l)&&(t=e=>{var n=new XMLHttpRequest;return n.open("GET",e,!1),n.responseType="arraybuffer",n.send(null),new Uint8Array(n.response)}),f.print||console.log.bind(console)),d=f.printErr||console.warn.bind(console),m=(Object.assign(f,o),f.arguments&&(u=f.arguments),f.thisProgram&&(s=f.thisProgram),f.quit&&(c=f.quit),f.wasmBinary&&(a=f.wasmBinary),f.noExitRuntime||!0);"object"!=typeof WebAssembly&&C("no native wasm support detected");var W,B,y,h,g,v=!1,N="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function J(e,n,t){var r=n+t;for(t=n;e[t]&&!(r<=t);)++t;if(16>10,56320|1023&a)))):r+=String.fromCharCode(a)}return r}function X(e){return e?J(h,e,void 0):""}function z(e,n,t,r){if(0>6}else{if(i<=65535){if(r<=t+2)break;n[t++]=224|i>>12}else{if(r<=t+3)break;n[t++]=240|i>>18,n[t++]=128|i>>12&63}n[t++]=128|i>>6&63}n[t++]=128|63&i}}n[t]=0}}function G(e){for(var n=0,t=0;t{var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:()=>performance.now(),fe={};function pe(){if(!ce){var e,n={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:s||"./this.program"};for(e in fe)void 0===fe[e]?delete n[e]:n[e]=fe[e];var t=[];for(e in n)t.push(e+"="+n[e]);ce=t}return ce}function A(e){return 0==e%4&&(0!=e%100||0==e%400)}function de(e,n){for(var t=0,r=0;r<=n;t+=e[r++]);return t}var I=[31,29,31,30,31,30,31,31,30,31,30,31],R=[31,28,31,30,31,30,31,31,30,31,30,31];function M(e,n){for(e=new Date(e.getTime());0r-e.getDate())){e.setDate(e.getDate()+n);break}n-=r-e.getDate()+1,e.setDate(1),t<11?e.setMonth(t+1):(e.setMonth(0),e.setFullYear(e.getFullYear()+1))}return e}function me(e,n,t,r){function o(e,n,t){for(e="number"==typeof e?e.toString():e||"";e.length>2];for(c in r={U:g[r>>2],T:g[r+4>>2],L:g[r+8>>2],K:g[r+12>>2],J:g[r+16>>2],I:g[r+20>>2],M:g[r+24>>2],N:g[r+28>>2],Z:g[r+32>>2],S:g[r+36>>2],V:l?X(l):""},t=X(t),l={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})t=t.replace(new RegExp(c,"g"),l[c]);var f,p,d="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),m="January February March April May June July August September October November December".split(" "),l={"%a":function(e){return d[e.M].substring(0,3)},"%A":function(e){return d[e.M]},"%b":function(e){return m[e.J].substring(0,3)},"%B":function(e){return m[e.J]},"%C":function(e){return i((e.I+1900)/100|0,2)},"%d":function(e){return i(e.K,2)},"%e":function(e){return o(e.K,2," ")},"%g":function(e){return s(e).toString().substring(2)},"%G":s,"%H":function(e){return i(e.L,2)},"%I":function(e){return 0==(e=e.L)?e=12:12n?0:(y.set(c,e),c.length-1)}function x(e){try{e()}catch(e){C(e)}}var F=0,E=null,O=[],ye={},he={},ge=0,ve=null,we=[];function _e(t){var e,r={};for(e in t)!function(e){var n=t[e];r[e]="function"==typeof n?function(){O.push(e);try{return n.apply(null,arguments)}finally{v||(O.pop()!==e&&C(void 0),E&&1===F&&0===O.length&&(F=0,x(f._asyncify_stop_unwind),"undefined"!=typeof Fibers)&&Fibers.$())}}:n}(e);return r}function be(e){var o,i,n,t;v||(0===F?(i=o=!1,e(()=>{if(!v&&(o=!0,i)){F=2,x(()=>f._asyncify_start_rewind(E)),"undefined"!=typeof Browser&&Browser.P.R&&Browser.P.resume();var n=!1;try{var t=(0,f.asm[he[g[E+8>>2]]])()}catch(e){t=e,n=!0}var e,r=!1;if(E||(e=ve)&&(ve=null,(n?e.reject:e.resolve)(t),r=!0),n&&!r)throw t}}),i=!0,o||(F=1,e=Ae(10485772),n=e+12,g[e>>2]=n,g[e+4>>2]=n+10485760,n=O[0],void 0===(t=ye[n])&&(t=ge++,ye[n]=t,he[t]=n),g[e+8>>2]=t,E=e,x(()=>f._asyncify_start_unwind(E)),"undefined"!=typeof Browser&&Browser.P.R&&Browser.P.pause())):2===F?(F=0,x(f._asyncify_stop_rewind),Ce(E),E=null,we.forEach(e=>se(e))):C("invalid state: "+F))}var P,Se={c:function(){return 0},j:function(){},f:function(){return 0},g:function(){},a:function(){C("")},h:function(e,n){if(0===e)e=Date.now();else{if(1!==e&&4!==e)return g[De()>>2]=28,-1;e=le()}return g[n>>2]=e/1e3|0,g[n+4>>2]=e%1e3*1e6|0,0},i:function(e,n,t){h.copyWithin(e,n,n+t)},b:function(e){var n=h.length;if(!(2147483648<(e>>>=0)))for(var t=1;t<=4;t*=2){var r=n*(1+.2/t),r=Math.min(r,e+100663296),o=Math;r=Math.max(e,r),o=o.min.call(o,2147483648,r+(65536-r%65536)%65536);e:{try{W.grow(o-B.byteLength+65535>>>16),V();var i=1;break e}catch(e){}i=void 0}if(i)return!0}return!1},k:function(t){be(e=>{return n=e,setTimeout(function(){se(n)},t);var n})},n:function(r,o){var i=0;return pe().forEach(function(e,n){var t=o+i;for(n=g[r+4*n>>2]=t,t=0;t>0]=e.charCodeAt(t);y[n>>0]=0,i+=e.length+1}),0},o:function(e,n){var t=pe(),r=(g[e>>2]=t.length,0);return t.forEach(function(e){r+=e.length+1}),g[n>>2]=r,0},e:function(e){Ee(e)},d:function(){return 0},q:function(e,n,t,r){return e=ue.X(e),n=ue.W(e,n,t),g[r>>2]=n,0},l:function(){},p:function(e,n,t,r){for(var o=0,i=0;i>2],u=g[n+4>>2];n+=8;for(var s=0;s>2]=o,0},m:me},Ce=(!function(){function n(e){e=_e(e=e.exports),f.asm=e,W=f.asm.r,V(),$.unshift(f.asm.s),b--,f.monitorRunDependencies&&f.monitorRunDependencies(b),0==b&&(null!==te&&(clearInterval(te),te=null),S)&&(e=S,S=null,e())}function t(e){n(e.instance)}function r(e){return(a||!k&&!l||"function"!=typeof fetch?Promise.resolve().then(oe):fetch(w,{credentials:"same-origin"}).then(function(e){if(e.ok)return e.arrayBuffer();throw"failed to load wasm binary file at '"+w+"'"}).catch(oe)).then(function(e){return WebAssembly.instantiate(e,o)}).then(function(e){return e}).then(e,function(e){d("failed to asynchronously prepare wasm: "+e),C(e)})}var o={a:Se};if(b++,f.monitorRunDependencies&&f.monitorRunDependencies(b),f.instantiateWasm)try{var e=f.instantiateWasm(o,n);return _e(e)}catch(e){return d("Module.instantiateWasm callback failed with error: "+e)}(a||"function"!=typeof WebAssembly.instantiateStreaming||re()||"function"!=typeof fetch?r(t):fetch(w,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,o).then(t,function(e){return d("wasm streaming compile failed: "+e),d("falling back to ArrayBuffer instantiation"),r(t)})})).catch(i)}(),f.___wasm_call_ctors=function(){return(f.___wasm_call_ctors=f.asm.s).apply(null,arguments)},f._main=function(){return(f._main=f.asm.t).apply(null,arguments)},f._command=function(){return(f._command=f.asm.u).apply(null,arguments)},f._free=function(){return(Ce=f._free=f.asm.v).apply(null,arguments)}),De=f.___errno_location=function(){return(De=f.___errno_location=f.asm.w).apply(null,arguments)},Ae=f._malloc=function(){return(Ae=f._malloc=f.asm.x).apply(null,arguments)},Ie=f.stackSave=function(){return(Ie=f.stackSave=f.asm.z).apply(null,arguments)},Re=f.stackRestore=function(){return(Re=f.stackRestore=f.asm.A).apply(null,arguments)},Y=f.stackAlloc=function(){return(Y=f.stackAlloc=f.asm.B).apply(null,arguments)},Me=f.dynCall_vi=function(){return(Me=f.dynCall_vi=f.asm.C).apply(null,arguments)},xe=f.dynCall_v=function(){return(xe=f.dynCall_v=f.asm.D).apply(null,arguments)};function j(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function Fe(i){function e(){if(!P&&(P=!0,f.calledRun=!0,!v)){if(D($),D(Q),T(f),f.onRuntimeInitialized&&f.onRuntimeInitialized(),Oe){var e=i,n=f._main,t=(e=e||[]).length+1,r=Y(4*(t+1));g[r>>2]=K(s);for(var o=1;o>2)+o]=K(e[o-1]);g[(r>>2)+t]=0;try{Ee(n(t,r))}catch(e){ie(e)}}if(f.postRun)for("function"==typeof f.postRun&&(f.postRun=[f.postRun]);f.postRun.length;)e=f.postRun.shift(),ee.unshift(e);D(ee)}}if(i=i||u,!(0{ve={resolve:e,reject:n}}).then(i):(r=i(r),o?Promise.resolve(r):r)},S=function e(){P||Fe(),P||(S=e)},f.run=Fe,f.preInit)for("function"==typeof f.preInit&&(f.preInit=[f.preInit]);0>>0)),i=a.slice(0,-n.length);for(e=0;e{throw t},N="object"==typeof window,o="function"==typeof importScripts,u="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,d=c.ENVIRONMENT_IS_PTHREAD||!1,a="";function V(e){return c.locateFile?c.locateFile(e,a):a+e}if(u){a=o?require("path").dirname(a)+"/":__dirname+"/",U=()=>{L||(n=require("fs"),L=require("path"))},B=function(e,t){return U(),e=L.normalize(e),n.readFileSync(e,t?void 0:"utf8")},t=e=>e=(e=B(e,!0)).buffer?e:new Uint8Array(e),1{if(b())throw process.exitCode=e,t;t instanceof q||m("exiting due to exception: "+t),process.exit(e)},c.inspect=function(){return"[Emscripten Module object]"};let e;try{e=require("worker_threads")}catch(e){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),e}global.Worker=e.Worker}else(N||o)&&(o?a=self.location.href:"undefined"!=typeof document&&document.currentScript&&(a=document.currentScript.src),a=0!==(a=ht?ht:a).indexOf("blob:")?a.substr(0,a.replace(/[?#].*/,"").lastIndexOf("/")+1):"",u||(B=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},o&&(t=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)})));u&&"undefined"==typeof performance&&(global.performance=require("perf_hooks").performance);var G,f,p=console.log.bind(console),$=console.warn.bind(console),X=(u&&(U(),p=e=>n.writeSync(1,e+"\n"),$=e=>n.writeSync(2,e+"\n")),c.print||p),m=c.printErr||$,z=(Object.assign(c,Y),c.arguments&&(H=c.arguments),c.thisProgram&&(s=c.thisProgram),c.quit&&(r=c.quit),c.wasmBinary&&(f=c.wasmBinary),c.noExitRuntime||!0);"object"!=typeof WebAssembly&&A("no native wasm support detected");var _,Q,J=!1;function K(e){var t=new TextDecoder(e);this.decode=e=>(e.buffer instanceof SharedArrayBuffer&&(e=new Uint8Array(e)),t.decode.call(t,e))}var g,Z,ee,te,ne,re="undefined"!=typeof TextDecoder?new K("utf8"):void 0;function ae(e,t,n){var r=t+n;for(n=t;e[n]&&!(r<=n);)++n;if(16>10,56320|1023&i)))):r+=String.fromCharCode(i)}return r}function y(e){return e?ae(l(),e,void 0):""}function w(e,t,n,r){if(0>6}else{if(o<=65535){if(r<=n+2)break;t[n++]=224|o>>12}else{if(r<=n+3)break;t[n++]=240|o>>18,t[n++]=128|o>>12&63}t[n++]=128|o>>6&63}t[n++]=128|63&o}}t[n]=0}}function oe(e){for(var t=0,n=0;n>2]=0,E.wa(t.worker))}var E={ba:[],ha:[],ma:[],Ca:function(){d&&E.Ea()},Xa:function(){},Ea:function(){E.receiveObjectTransfer=E.Ha,E.threadInit=E.xa,E.setExitStatus=E.Ja,z=!1},aa:{},Ja:function(){},ra:function(){for(var e in E.aa){var t=E.aa[e];t&&t.worker&&E.wa(t.worker)}for(e=0;e>2]=0;try{e()}finally{h()[lt>>2]=1}},Ha:function(){},xa:function(){for(var e in E.ma)E.ma.hasOwnProperty(e)&&E.ma[e]()},Fa:function(r,a){r.onmessage=e=>{var t,n=(e=e.data).cmd;r.da&&(E.za=r.da.sa),e.targetThread&&e.targetThread!=it()?(t=E.aa[e.bb])?t.worker.postMessage(e,e.transferList):m('Internal error! Worker sent a message "'+n+'" to target pthread '+e.targetThread+", but that thread no longer exists!"):"processQueuedMainThreadWork"===n?nt():"spawnThread"===n?xe(e):"cleanupThread"===n?we(e.thread):"killThread"===n?(e=e.thread,h()[e>>2]=0,n=E.aa[e],delete E.aa[e],n.worker.terminate(),ot(e),E.ha.splice(E.ha.indexOf(n.worker),1),n.worker.da=void 0):"cancelThread"===n?E.aa[e.thread].worker.postMessage({cmd:"cancel"}):"loaded"===n?(r.loaded=!0,a&&a(r),r.ga&&(r.ga(),delete r.ga)):"print"===n?X("Thread "+e.threadId+": "+e.text):"printErr"===n?m("Thread "+e.threadId+": "+e.text):"alert"===n?alert("Thread "+e.threadId+": "+e.text):"setimmediate"===e.target?r.postMessage(e):"onAbort"===n?c.onAbort&&c.onAbort(e.arg):m("worker sent an unknown command "+n),E.za=void 0},r.onerror=e=>{throw m("worker sent an error! "+e.filename+":"+e.lineno+": "+e.message),e},u&&(r.on("message",function(e){r.onmessage({data:e})}),r.on("error",function(e){r.onerror(e)}),r.on("detachedExit",function(){})),r.postMessage({cmd:"load",urlOrBlob:c.mainScriptUrlOrBlob||ht,wasmMemory:_,wasmModule:Q})},ya:function(){var e=V("stockfish.worker.js");E.ba.push(new Worker(e))},Ba:function(){return 0==E.ba.length&&(E.ya(),E.Fa(E.ba[0])),E.ba.pop()}};function ve(e){if(d)return I(1,0,e);try{pt(e)}catch(e){e instanceof q||"unwind"==e||r(1,e)}}c.establishStackSpace=function(){var e=it(),t=h()[e+44>>2],e=h()[e+48>>2];ut(t,t-e),ft(t)};var D=[];function be(e){var t=D[e];return t||(e>=D.length&&(D.length=e+1),D[e]=t=ue.get(e)),t}function xe(e){var t=E.Ba();if(!t)return 6;E.ha.push(t);var n=E.aa[e.qa]={worker:t,sa:e.qa},r=(t.da=n,{cmd:"run",start_routine:e.Ka,arg:e.fa,threadInfoStruct:e.qa});return t.ga=()=>{r.time=performance.now(),t.postMessage(r,e.Pa)},t.loaded&&(t.ga(),delete t.ga),0}c.invokeEntryPoint=function(e,t){return be(e)(t)};var Se=u?()=>{var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:d?()=>performance.now()-c.__performance_now_clock_drift:()=>performance.now(),Me=[null,[],[]],Ae={};function ke(e,t,n){return d?I(2,1,e,t,n):0}function Ee(e,t){if(d)return I(3,1,e,t)}function De(e,t,n){return d?I(4,1,e,t,n):0}function Ie(e,t,n){if(d)return I(5,1,e,t,n)}function I(a,o){var i=arguments.length-2,s=arguments;return ye(function(){for(var e=j(8*i),t=e>>3,n=0;n>2]=t,h()[s.la+4>>2]=n),!s.va&&s.Ra?s.la?(s=h()[s.la+8>>2],e=e?y(e):"",r=s,a=e,o=t,i=n,ye(function(){var e,t=j(12),n=0;a&&(n=oe(a)+1,e=st(n),w(a,l(),e,n),n=e),h()[t>>2]=n,h()[t+4>>2]=o,h()[t+8>>2]=i,at(r,657457152,0,n,t)}),1):-4:(e=!1,(s=s.va?s.va:s).ka&&s.ka.ja&&(e=0===(e=s.ka.ja.getParameter(2978))[0]&&0===e[1]&&e[2]===s.width&&e[3]===s.height),s.width=t,s.height=n,e&&s.ka.ja.viewport(0,0,t,n),0)):-4}function je(e,t,n){return d?I(6,1,e,t,n):Ce(e,t,n)}function qe(n,e){n.ta||(n.ta=n.getContext,n.getContext=function(e,t){return"webgl"==e==(t=n.ta(e,t))instanceof WebGLRenderingContext?t:null});var t,r,a,o=n.getContext("webgl",e);{if(o){if(o=o,e=e,r=st(8),h()[r+4>>2]=it(),a={Wa:r,attributes:e,version:e.Ga,ja:o},o.canvas&&(o.canvas.ka=a),(void 0===e.ua||e.ua)&&!(o=(o=a)||Pe).Da){o.Da=!0;var i=t=o.ja,s=i.getExtension("ANGLE_instanced_arrays"),u=(s&&(i.vertexAttribDivisor=function(e,t){s.vertexAttribDivisorANGLE(e,t)},i.drawArraysInstanced=function(e,t,n,r){s.drawArraysInstancedANGLE(e,t,n,r)},i.drawElementsInstanced=function(e,t,n,r,a){s.drawElementsInstancedANGLE(e,t,n,r,a)}),t),c=u.getExtension("OES_vertex_array_object"),f=(c&&(u.createVertexArray=function(){return c.createVertexArrayOES()},u.deleteVertexArray=function(e){c.deleteVertexArrayOES(e)},u.bindVertexArray=function(e){c.bindVertexArrayOES(e)},u.isVertexArray=function(e){return c.isVertexArrayOES(e)}),t),l=f.getExtension("WEBGL_draw_buffers");l&&(f.drawBuffers=function(e,t){l.drawBuffersWEBGL(e,t)}),t.Sa=t.getExtension("EXT_disjoint_timer_query"),t.Za=t.getExtension("WEBGL_multi_draw"),(t.getSupportedExtensions()||[]).forEach(function(e){e.includes("lose_context")||e.includes("debug")||t.getExtension(e)})}return r}return 0}}var Pe,Fe,We=["default","low-power","high-performance"],Be={};function Le(){if(!Fe){var e,t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:s||"./this.program"};for(e in Be)void 0===Be[e]?delete t[e]:t[e]=Be[e];var n=[];for(e in t)n.push(e+"="+t[e]);Fe=n}return Fe}function Ue(r,a){var o;return d?I(7,1,r,a):(o=0,Le().forEach(function(e,t){var n=a+o;for(t=h()[r+4*t>>2]=n,n=0;n>0]=e.charCodeAt(n);i()[t>>0]=0,o+=e.length+1}),0)}function Ye(e,t){var n,r;return d?I(8,1,e,t):(n=Le(),h()[e>>2]=n.length,r=0,n.forEach(function(e){r+=e.length+1}),h()[t>>2]=r,0)}function He(e){return d?I(9,1,e):0}function Ne(e,t,n,r){return d?I(10,1,e,t,n,r):(e=Ae.Va(e),t=Ae.Ta(e,t,n),h()[r>>2]=t,0)}function Ve(e,t,n,r,a){if(d)return I(11,1,e,t,n,r,a)}function Ge(e,t,n,r){if(d)return I(12,1,e,t,n,r);for(var a=0,o=0;o>2],s=h()[t+4>>2];t+=8;for(var u=0;u>2]=a,0}function R(e){return 0==e%4&&(0!=e%100||0==e%400)}function $e(e,t){for(var n=0,r=0;r<=t;n+=e[r++]);return n}var O=[31,29,31,30,31,30,31,31,30,31,30,31],T=[31,28,31,30,31,30,31,31,30,31,30,31];function C(e,t){for(e=new Date(e.getTime());0r-e.getDate())){e.setDate(e.getDate()+t);break}t-=r-e.getDate()+1,e.setDate(1),n<11?e.setMonth(n+1):(e.setMonth(0),e.setFullYear(e.getFullYear()+1))}return e}function Xe(e,t,n,r){function a(e,t,n){for(e="number"==typeof e?e.toString():e||"";e.length>2];for(c in r={Na:h()[r>>2],Ma:h()[r+4>>2],na:h()[r+8>>2],ia:h()[r+12>>2],ea:h()[r+16>>2],$:h()[r+20>>2],oa:h()[r+24>>2],pa:h()[r+28>>2],cb:h()[r+32>>2],La:h()[r+36>>2],Oa:f?y(f):""},n=y(n),f={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(new RegExp(c,"g"),f[c]);var l,d,p="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),m="January February March April May June July August September October November December".split(" "),f={"%a":function(e){return p[e.oa].substring(0,3)},"%A":function(e){return p[e.oa]},"%b":function(e){return m[e.ea].substring(0,3)},"%B":function(e){return m[e.ea]},"%C":function(e){return o((e.$+1900)/100|0,2)},"%d":function(e){return o(e.ia,2)},"%e":function(e){return a(e.ia,2," ")},"%g":function(e){return u(e).toString().substring(2)},"%G":u,"%H":function(e){return o(e.na,2)},"%I":function(e){return 0==(e=e.na)?e=12:12t?0:(se(c,e),c.length-1)}E.Ca();var ze,Qe=[null,ve,ke,Ee,De,Ie,je,Ue,Ye,He,Ne,Ve,Ge],Je={p:function(e,t){Ke(e,t)},l:function(e){et(e,!o,1,!N),E.xa()},i:function(e){d?postMessage({cmd:"cleanupThread",thread:e}):we(e)},e:function(e,t,n,r){var a;return"undefined"==typeof SharedArrayBuffer?(m("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6):(a=[],d&&0===a.length?tt(687865856,e,t,n,r):(e={Ka:n,qa:e,fa:r,Pa:a},d?(e.Qa="spawnThread",postMessage(e,a),0):xe(e)))},g:ke,v:Ee,u:De,w:Ie,B:function(){return 2097152},m:function(e,t){if(e==t)postMessage({cmd:"processQueuedMainThreadWork"});else if(d)postMessage({targetThread:e,cmd:"processThreadQueue"});else{if(!(e=(e=E.aa[e])&&e.worker))return;e.postMessage({cmd:"processThreadQueue"})}return 1},b:function(){A("")},x:function(e,t){if(0===e)e=Date.now();else{if(1!==e&&4!==e)return h()[Ze()>>2]=28,-1;e=Se()}return h()[t>>2]=e/1e3|0,h()[t+4>>2]=e%1e3*1e6|0,0},h:function(){u||o||(G=G||{})["Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread"]||(G["Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread"]=1,m("Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread"))},c:Se,A:function(e,t,n){l().copyWithin(e,t,t+n)},C:function(e,t,n){Re.length=t,n>>=3;for(var r=0;r>>=0)<=t||2147483648>>16),v(_.buffer);var o=1;break e}catch(e){}o=void 0}if(o)return!0}return!1},j:function(e,t,n){return(Te(e)?Ce:je)(e,t,n)},n:function(){throw"unwind"},k:function(e,t){t>>=2;var n=h()[t+6];return t={alpha:!!h()[t],depth:!!h()[t+1],stencil:!!h()[t+2],antialias:!!h()[t+3],premultipliedAlpha:!!h()[t+4],preserveDrawingBuffer:!!h()[t+5],powerPreference:We[n],failIfMajorPerformanceCaveat:!!h()[t+7],Ga:h()[t+8],Ya:h()[t+9],ua:h()[t+10],Aa:h()[t+11],$a:h()[t+12],ab:h()[t+13]},!(e=Te(e))||t.Aa?0:qe(e,t)},r:Ue,s:Ye,d:function(e){pt(e)},f:He,t:Ne,o:Ve,y:Ge,a:_||c.wasmMemory,q:Xe},Ke=(!function(){function t(e,t){c.asm=e.exports,E.ma.push(c.asm.I),ue=c.asm.W,fe.unshift(c.asm.D),Q=t,d||(S--,c.monitorRunDependencies&&c.monitorRunDependencies(S),0==S&&(null!==me&&(clearInterval(me),me=null),M)&&(e=M,M=null,e()))}function n(e){t(e.instance,e.module)}function r(e){return(f||!N&&!o||"function"!=typeof fetch?Promise.resolve().then(_e):fetch(x,{credentials:"same-origin"}).then(function(e){if(e.ok)return e.arrayBuffer();throw"failed to load wasm binary file at '"+x+"'"}).catch(_e)).then(function(e){return WebAssembly.instantiate(e,a)}).then(function(e){return e}).then(e,function(e){m("failed to asynchronously prepare wasm: "+e),A(e)})}var a={a:Je};if(d||(S++,c.monitorRunDependencies&&c.monitorRunDependencies(S)),c.instantiateWasm)try{return c.instantiateWasm(a,t)}catch(e){return m("Module.instantiateWasm callback failed with error: "+e)}(f||"function"!=typeof WebAssembly.instantiateStreaming||he()||"function"!=typeof fetch?r(n):fetch(x,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,a).then(n,function(e){return m("wasm streaming compile failed: "+e),m("falling back to ArrayBuffer instantiation"),r(n)})})).catch(W)}(),c.___wasm_call_ctors=function(){return(c.___wasm_call_ctors=c.asm.D).apply(null,arguments)},c._main=function(){return(Ke=c._main=c.asm.E).apply(null,arguments)}),Ze=(c._command=function(){return(c._command=c.asm.F).apply(null,arguments)},c._isReady=function(){return(c._isReady=c.asm.G).apply(null,arguments)},c._free=function(){return(c._free=c.asm.H).apply(null,arguments)},c._emscripten_tls_init=function(){return(c._emscripten_tls_init=c.asm.I).apply(null,arguments)},c.___errno_location=function(){return(Ze=c.___errno_location=c.asm.J).apply(null,arguments)}),et=(c.__emscripten_thread_crashed=function(){return(c.__emscripten_thread_crashed=c.asm.K).apply(null,arguments)},c._emscripten_proxy_main=function(){return(c._emscripten_proxy_main=c.asm.L).apply(null,arguments)},c.__emscripten_thread_init=function(){return(et=c.__emscripten_thread_init=c.asm.M).apply(null,arguments)}),tt=(c._emscripten_current_thread_process_queued_calls=function(){return(c._emscripten_current_thread_process_queued_calls=c.asm.N).apply(null,arguments)},c._emscripten_sync_run_in_main_thread_4=function(){return(tt=c._emscripten_sync_run_in_main_thread_4=c.asm.O).apply(null,arguments)}),nt=c._emscripten_main_thread_process_queued_calls=function(){return(nt=c._emscripten_main_thread_process_queued_calls=c.asm.P).apply(null,arguments)},rt=c._emscripten_run_in_main_runtime_thread_js=function(){return(rt=c._emscripten_run_in_main_runtime_thread_js=c.asm.Q).apply(null,arguments)},at=c._emscripten_dispatch_to_thread_=function(){return(at=c._emscripten_dispatch_to_thread_=c.asm.R).apply(null,arguments)},ot=c.__emscripten_thread_free_data=function(){return(ot=c.__emscripten_thread_free_data=c.asm.S).apply(null,arguments)},it=(c.__emscripten_thread_exit=function(){return(c.__emscripten_thread_exit=c.asm.T).apply(null,arguments)},c._pthread_self=function(){return(it=c._pthread_self=c.asm.U).apply(null,arguments)}),st=c._malloc=function(){return(st=c._malloc=c.asm.V).apply(null,arguments)},ut=c._emscripten_stack_set_limits=function(){return(ut=c._emscripten_stack_set_limits=c.asm.X).apply(null,arguments)},ct=c.stackSave=function(){return(ct=c.stackSave=c.asm.Y).apply(null,arguments)},ft=c.stackRestore=function(){return(ft=c.stackRestore=c.asm.Z).apply(null,arguments)},j=c.stackAlloc=function(){return(j=c.stackAlloc=c.asm._).apply(null,arguments)},lt=c.__emscripten_allow_main_runtime_queued_calls=68944992;function q(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function dt(o){function e(){if(!ze&&(ze=!0,c.calledRun=!0,!J)){if(d||k(fe),d||k(le),F(c),c.onRuntimeInitialized&&c.onRuntimeInitialized(),mt){var e=o,t=c._emscripten_proxy_main,n=(e=e||[]).length+1,r=j(4*(n+1));h()[r>>2]=ie(s);for(var a=1;a>2)+a]=ie(e[a-1]);h()[(r>>2)+n]=0,t(n,r)}if(!d){if(c.postRun)for("function"==typeof c.postRun&&(c.postRun=[c.postRun]);c.postRun.length;)e=c.postRun.shift(),de.unshift(e);k(de)}}}if(o=o||H,!(0>>0)),o=s.slice(0,-t.length);for(e=0;e{e=new WebAssembly.Instance(r.wasmModule,e);return t(e),r.wasmModule=null,e.exports},self.onmessage=e=>{try{var t;if("load"===e.data.cmd)r.wasmModule=e.data.wasmModule,r.wasmMemory=e.data.wasmMemory,r.buffer=r.wasmMemory.buffer,r.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof e.data.urlOrBlob?importScripts(e.data.urlOrBlob):(t=URL.createObjectURL(e.data.urlOrBlob),importScripts(t),URL.revokeObjectURL(t)),i(r).then(function(e){r=e});else if("run"===e.data.cmd){r.__performance_now_clock_drift=performance.now()-e.data.time,r.__emscripten_thread_init(e.data.threadInfoStruct,0,0,1),r.establishStackSpace(),r.PThread.receiveObjectTransfer(e.data),r.PThread.threadInit();try{var n=r.invokeEntryPoint(e.data.start_routine,e.data.arg);r.keepRuntimeAlive()?r.PThread.setExitStatus(n):r.__emscripten_thread_exit(n)}catch(e){if("unwind"!=e){if(!(e instanceof r.ExitStatus))throw e;r.keepRuntimeAlive()||r.__emscripten_thread_exit(e.status)}}}else"cancel"===e.data.cmd?r._pthread_self()&&r.__emscripten_thread_exit(-1):"setimmediate"!==e.data.target&&("processThreadQueue"===e.data.cmd?r._pthread_self()&&r._emscripten_current_thread_process_queued_calls():"processProxyingQueue"===e.data.cmd?r._pthread_self()&&r._emscripten_proxy_execute_queue(e.data.queue):(o("worker.js received unknown command "+e.data.cmd),o(e.data)))}catch(e){throw o("worker.js onmessage() captured an uncaught exception: "+e),e&&e.stack&&o(e.stack),r.__emscripten_thread_crashed&&r.__emscripten_thread_crashed(),e}},self._origOnmessage=self.onmessage,self.onmessage=function(e){"load"===e.data.cmd?(r.wasmModule=e.data.wasmModule,r.wasmMemory=e.data.wasmMemory,r.buffer=r.wasmMemory.buffer,r.ENVIRONMENT_IS_PTHREAD=!0,e.data.workerID&&(r.workerID=e.data.workerID),e.data.wasmSourceMap&&(r.wasmSourceMapData=e.data.wasmSourceMap),e.data.wasmOffsetConverter&&(r.wasmOffsetData=e.data.wasmOffsetConverter),(i=f())(r).then(function(e){r=e})):self._origOnmessage(e)}}():"undefined"!=typeof onmessage&&("undefined"==typeof window||void 0===window.document)||"undefined"!=typeof global&&"[object process]"===Object.prototype.toString.call(global.process)?(e="undefined"!=typeof global&&"[object process]"===Object.prototype.toString.call(global.process),n={},r=[],e?require.main===module?(c=require("path"),s=c.join(__dirname,c.basename(__filename,c.extname(__filename))+".wasm"),n={locateFile:function(e){return-1 { useEffect(() => { if (!engineName) return; - if (engineName.includes("stockfish_16") && !Stockfish16.isSupported()) { + if (engineName !== EngineName.Stockfish11 && !isWasmSupported()) { return; } @@ -29,13 +31,15 @@ export const useEngine = (engineName: EngineName | undefined) => { const pickEngine = (engine: EngineName): UciEngine => { switch (engine) { + case EngineName.Stockfish16_1: + return new Stockfish16_1(false); + case EngineName.Stockfish16_1Lite: + return new Stockfish16_1(true); case EngineName.Stockfish16: return new Stockfish16(false); case EngineName.Stockfish16NNUE: return new Stockfish16(true); case EngineName.Stockfish11: return new Stockfish11(); - default: - throw new Error(`Engine ${engine} does not exist ?!`); } }; diff --git a/src/lib/engine/shared.ts b/src/lib/engine/shared.ts new file mode 100644 index 0000000..e238322 --- /dev/null +++ b/src/lib/engine/shared.ts @@ -0,0 +1,7 @@ +export const isWasmSupported = () => + typeof WebAssembly === "object" && + WebAssembly.validate( + Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00) + ); + +export const isMultiThreadSupported = () => SharedArrayBuffer !== undefined; diff --git a/src/lib/engine/stockfish16.ts b/src/lib/engine/stockfish16.ts index ee6318f..541c55c 100644 --- a/src/lib/engine/stockfish16.ts +++ b/src/lib/engine/stockfish16.ts @@ -1,18 +1,19 @@ import { EngineName } from "@/types/enums"; import { UciEngine } from "./uciEngine"; +import { isMultiThreadSupported, isWasmSupported } from "./shared"; export class Stockfish16 extends UciEngine { constructor(nnue?: boolean) { - if (!Stockfish16.isSupported()) { + if (!isWasmSupported()) { throw new Error("Stockfish 16 is not supported"); } - const isMultiThreadSupported = Stockfish16.isMultiThreadSupported(); - if (!isMultiThreadSupported) console.log("Single thread mode"); + const multiThreadIsSupported = isMultiThreadSupported(); + if (!multiThreadIsSupported) console.log("Single thread mode"); - const enginePath = isMultiThreadSupported - ? "engines/stockfish-16-wasm/stockfish-nnue-16.js" - : "engines/stockfish-16-wasm/stockfish-nnue-16-single.js"; + const enginePath = multiThreadIsSupported + ? "engines/stockfish-16/stockfish-nnue-16.js" + : "engines/stockfish-16/stockfish-nnue-16-single.js"; const customEngineInit = async () => { await this.sendCommands( @@ -23,17 +24,4 @@ export class Stockfish16 extends UciEngine { super(EngineName.Stockfish16, enginePath, customEngineInit); } - - public static isSupported() { - return ( - typeof WebAssembly === "object" && - WebAssembly.validate( - Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00) - ) - ); - } - - public static isMultiThreadSupported() { - return SharedArrayBuffer !== undefined; - } } diff --git a/src/lib/engine/stockfish16_1.ts b/src/lib/engine/stockfish16_1.ts new file mode 100644 index 0000000..7dbd451 --- /dev/null +++ b/src/lib/engine/stockfish16_1.ts @@ -0,0 +1,23 @@ +import { EngineName } from "@/types/enums"; +import { UciEngine } from "./uciEngine"; +import { isMultiThreadSupported, isWasmSupported } from "./shared"; + +export class Stockfish16_1 extends UciEngine { + constructor(lite?: boolean) { + if (!isWasmSupported()) { + throw new Error("Stockfish 16.1 is not supported"); + } + + const multiThreadIsSupported = isMultiThreadSupported(); + if (!multiThreadIsSupported) console.log("Single thread mode"); + + const enginePath = `engines/stockfish-16.1/stockfish-16.1${ + lite ? "-lite" : "" + }${multiThreadIsSupported ? "" : "-single"}.js`; + + super( + lite ? EngineName.Stockfish16_1Lite : EngineName.Stockfish16_1, + enginePath + ); + } +} diff --git a/src/sections/analysis/states.ts b/src/sections/analysis/states.ts index cb56306..68d57ba 100644 --- a/src/sections/analysis/states.ts +++ b/src/sections/analysis/states.ts @@ -12,7 +12,7 @@ export const boardOrientationAtom = atom(true); export const showBestMoveArrowAtom = atom(true); export const showPlayerMoveIconAtom = atom(true); -export const engineNameAtom = atom(EngineName.Stockfish16); +export const engineNameAtom = atom(EngineName.Stockfish16_1Lite); export const engineDepthAtom = atom(16); export const engineMultiPvAtom = atom(3); export const evaluationProgressAtom = atom(0); diff --git a/src/sections/engineSettings/engineSettingsDialog.tsx b/src/sections/engineSettings/engineSettingsDialog.tsx index 437ec00..6e6d780 100644 --- a/src/sections/engineSettings/engineSettingsDialog.tsx +++ b/src/sections/engineSettings/engineSettingsDialog.tsx @@ -21,8 +21,8 @@ import { } from "../analysis/states"; import ArrowOptions from "./arrowOptions"; import { useAtomLocalStorage } from "@/hooks/useAtomLocalStorage"; -import { Stockfish16 } from "@/lib/engine/stockfish16"; import { useEffect } from "react"; +import { isWasmSupported } from "@/lib/engine/shared"; interface Props { open: boolean; @@ -44,7 +44,7 @@ export default function EngineSettingsDialog({ open, onClose }: Props) { ); useEffect(() => { - if (!Stockfish16.isSupported()) { + if (!isWasmSupported()) { setEngineName(EngineName.Stockfish11); } }, [setEngineName]); @@ -56,9 +56,9 @@ export default function EngineSettingsDialog({ open, onClose }: Props) { - Stockfish 16 Lite (HCE) is the default engine. It offers the best - balance between speed and strength. Stockfish 16 is the strongest - engine available, note that it requires a one time download of 40MB. + Stockfish 16.1 Lite is the default engine. It offers the best balance + between speed and strength. Stockfish 16.1 is the strongest engine + available, note that it requires a one time download of 64MB. {engineLabel[engine]} @@ -129,7 +127,9 @@ export default function EngineSettingsDialog({ open, onClose }: Props) { } const engineLabel: Record = { + [EngineName.Stockfish16_1]: "Stockfish 16.1 (64MB)", + [EngineName.Stockfish16_1Lite]: "Stockfish 16.1 Lite (6MB)", + [EngineName.Stockfish16NNUE]: "Stockfish 16 (40MB)", [EngineName.Stockfish16]: "Stockfish 16 Lite (HCE)", - [EngineName.Stockfish16NNUE]: "Stockfish 16 (40MB download)", [EngineName.Stockfish11]: "Stockfish 11", }; diff --git a/src/sections/play/gameSettings/gameSettingsDialog.tsx b/src/sections/play/gameSettings/gameSettingsDialog.tsx index 2c59fa4..2314345 100644 --- a/src/sections/play/gameSettings/gameSettingsDialog.tsx +++ b/src/sections/play/gameSettings/gameSettingsDialog.tsx @@ -29,8 +29,8 @@ import { import { useChessActions } from "@/hooks/useChessActions"; import { playGameStartSound } from "@/lib/sounds"; import { logAnalyticsEvent } from "@/lib/firebase"; -import { Stockfish16 } from "@/lib/engine/stockfish16"; import { useEffect } from "react"; +import { isWasmSupported } from "@/lib/engine/shared"; interface Props { open: boolean; @@ -69,7 +69,7 @@ export default function GameSettingsDialog({ open, onClose }: Props) { }; useEffect(() => { - if (!Stockfish16.isSupported()) { + if (!isWasmSupported()) { setEngineName(EngineName.Stockfish11); } }, [setEngineName]); @@ -81,10 +81,9 @@ export default function GameSettingsDialog({ open, onClose }: Props) { - Stockfish 16 Lite (HCE) is the default engine. It offers the best - balance between speed and strength. Stockfish 16 is the strongest - engine available, but please note that it requires a one time download - of 40MB. + Stockfish 16.1 Lite is the default engine. It offers the best balance + between speed and strength. Stockfish 16.1 is the strongest engine + available, note that it requires a one time download of 64MB. {engineLabel[engine]} @@ -168,7 +165,9 @@ export default function GameSettingsDialog({ open, onClose }: Props) { } const engineLabel: Record = { + [EngineName.Stockfish16_1]: "Stockfish 16.1 (64MB)", + [EngineName.Stockfish16_1Lite]: "Stockfish 16.1 Lite (6MB)", + [EngineName.Stockfish16NNUE]: "Stockfish 16 (40MB)", [EngineName.Stockfish16]: "Stockfish 16 Lite (HCE)", - [EngineName.Stockfish16NNUE]: "Stockfish 16 (40MB download)", [EngineName.Stockfish11]: "Stockfish 11", }; diff --git a/src/sections/play/states.ts b/src/sections/play/states.ts index 290a914..a43a00a 100644 --- a/src/sections/play/states.ts +++ b/src/sections/play/states.ts @@ -6,6 +6,8 @@ import { atom } from "jotai"; export const gameAtom = atom(new Chess()); export const gameDataAtom = atom({}); export const playerColorAtom = atom(Color.White); -export const enginePlayNameAtom = atom(EngineName.Stockfish16); +export const enginePlayNameAtom = atom( + EngineName.Stockfish16_1Lite +); export const engineSkillLevelAtom = atom(1); export const isGameInProgressAtom = atom(false); diff --git a/src/types/enums.ts b/src/types/enums.ts index 9af50c9..de3329b 100644 --- a/src/types/enums.ts +++ b/src/types/enums.ts @@ -5,8 +5,10 @@ export enum GameOrigin { } export enum EngineName { - Stockfish16 = "stockfish_16", + Stockfish16_1 = "stockfish_16_1", + Stockfish16_1Lite = "stockfish_16_1_lite", Stockfish16NNUE = "stockfish_16_nnue", + Stockfish16 = "stockfish_16", Stockfish11 = "stockfish_11", }