functionn(n){return(n=BigInt(n))>=0n?n:-n}functiont(n){if(1n===(n=BigInt(n)))return1;lett=1;do{t++}while((n>>=1n)>1n);returnt}functione(n,t){if((n=BigInt(n))<=0n|(t=BigInt(t))<=0n)thrownewRangeError("a and b MUST be > 0");lete=0n,r=1n,o=1n,i=0n;for(;0n!==n;){consts=t/n,a=t%n,f=e-o*s,u=r-i*s;t=n,n=a,e=o,r=i,o=f,i=u}return{g:t,x:e,y:r}}functionr(t,e){if(t=n(t),e=n(e),0n===t)returne;if(0n===e)returnt;letr=0n;for(;!(1n&(t|e));)t>>=1n,e>>=1n,r++;for(;!(1n&t);)t>>=1n;do{for(;!(1n&e);)e>>=1n;if(t>e){constn=t;t=e,e=n}e-=t}while(e);returnt<<r}functiono(t,e){returnt=BigInt(t),e=BigInt(e),0n===t&&0n===e?BigInt(0):n(t*e)/r(t,e)}functioni(n,t){return(n=BigInt(n))>=(t=BigInt(t))?n:t}functions(n,t){return(n=BigInt(n))>=(t=BigInt(t))?t:n}functiona(n,t){constr=e(u(n,t),t);if(1n!==r.g)thrownewRangeError(`${n.toString()} does not have inverse modulo ${t.toString()}`);returnu(r.x,t)}functionf(t,e,r){if(0n===(r=BigInt(r)))thrownewRangeError("n must be > 0");if(1n===r)returnBigInt(0);if(t=u(t,r),(e=BigInt(e))<0n)returna(f(t,n(e),r),r);leto=1n;for(;e>0;)e%2n===1n&&(o=o*t%r),e/=2n,t=t**2n%r;returno}functionu(n,t){return(t=BigInt(t))<=0?NaN:(n=BigInt(n)%t)<0?n+t:n}functionc(n,t=16,e=!1){if("number"==typeofn&&(n=BigInt(n)),n<0)throwRangeError("w MUST be >= 0");returnnewPromise((e,r)=>{consto=newWorker(b());o.onmessage=n=>{o.terminate(),e(n.data.isPrime)},o.onmessageerror=n=>{r(n)},o.postMessage({rnd:n,iterations:t,id:0})})}functiong(n,t=16){if(n<1)thrownewRangeError("bitLength MUST be > 0");if(!I){lete=0n;do{e=$(m(n,!0))}while(!B(e,t));returnnewPromise(n=>{n(e)})}returnnewPromise(e=>{constr=[],o=(o,i)=>{if(o.isPrime){for(letn=0;n<r.length;n++)r[n].terminate();for(;r.length;)r.pop();e(o.value)}else{conste=$(m(n,!0));try{i.postMessage({rnd:e,iterations:t,id:o.id})}catch(n){}}};{constn=b();for(lett=0;t<self.navigator.hardwareConcurrency-1;t++){constt=newWorker(n);t.onmessage=n=>o(n.data,t),r.push(t)}}for(lete=0;e<r.length;e++)h(n,!0).then((function(n){consto=$(n);r[e].postMessage({rnd:o,iterations:t,id:e})}))})}functionl(n,t=16){if(n<1)thrownewRangeError("bitLength MUST be > 0");lete=0n;do{e=$(m(n,!0))}while(!B(e,t));returne}functionw(n,e=1n){if(n<=0n||e<0n||n<=e)thrownewRangeError("Arguments MUST be: max > 0 && min >=0 && max > min");constr=n-e,o=t(r);leti;do{i=$(m(o))}while(i>r);returni+e}functionh(n,t=!1){if(n<1)thrownewRangeError("bitLength MUST be > 0");conste=Math.ceil(n/8),r=n%8;returnnewPromise(n=>{d(e,!1).then((function(e){if(r&&(e[0]=e[0]&2**r-1),t){constn=r?2**(r-1):128;e[0]=e[0]|n}n(e)}))})}functionm(n,t=!1){if(n<1)thrownewRangeError("bitLength MUST be > 0");conste=S(Math.ceil(n/8),!1),r=n%8;if(r&&(e[0]=e[0]&2**r-1),t){constn=r?2**(r-1):128;e[0]=e[0]|n}returne}functiond(n,t=!1){if(n<1)thrownewRangeError("byteLength MUST be > 0");returnnewPromise((function(e,r){{constr=newUint8Array(n);self.crypto.getRandomValues(r),t&&(r[0]=128|r[0]),e(r)}}))}functionS(n,t=!1){if(n<1)thrownewRangeError("byteLength MUST be > 0");{conste=newUint8Array(n);returnself.crypto.getRandomValues(e),t&&(e[0]=128|e[0]),e}}function$(n){lett=0n;for(consteofn.values()){constn=BigInt(e);t=(t<<BigInt(8))+n}returnt}functionb(){letn=`'use strict';const ${e.name}=${e.toString()};const ${a.name}=${a.toString()};const ${f.name}=${f.toString()};const ${u.name}=${u.toString()};const ${m.name}=${m.toString()};const ${S.name}=${S.toString()};const ${w.name}=${w.toString()};const ${c.name}=${B.toString()};${t.toString()}${$.toString()}`;returnn+=`onmessage = ${asyncfunction(n){constt=awaitc(n.data.rnd,n.data.iterations);postMessage({isPrime:t,value:n.data.rnd,id:n.data.id})}.toString()};`,function(n){n=`(() => {${n}})()`;constt=newBlob([n],{type:"text/javascript"});returnwindow.URL.createObjectURL(t)}(n)}functionB(n,t=16){if(2n===n)return!0;if(0n===(1n&n)||1n===n)return!1;conste=[3n,5n,7n,11n,13n,17n,19n,23n,29n,31n,37n,41n,43n,47n,53n,59n,61n,67n,71n,73n,79n,83n,89n,97n,101n,103n,107n,109n,113n,127n,131n,137n,139n,149n,151n,157n,163n,167n,173n,179n,181n,191n,193n,197n,