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)returnNaN;lete=0n,r=1n,i=1n,o=0n;for(;0n!==n;){consts=t/n,a=t%n,c=e-i*s,u=r-o*s;t=n,n=a,e=i,r=o,i=c,o=u}return{b: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}functioni(t,e){returnt=BigInt(t),e=BigInt(e),0n===t&&0n===e?0n:n(t*e)/r(t,e)}functiono(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);return1n!==r.b?NaN:u(r.x,t)}functionc(t,e,r){if(0n===(r=BigInt(r)))returnNaN;if(1n===r)return0n;if(t=u(t,r),(e=BigInt(e))<0n)returna(c(t,n(e),r),r);leti=1n;for(;e>0;)e%2n===1n&&(i=i*t%r),e/=2n,t=t**2n%r;returni}functionu(n,t){return(t=BigInt(t))<=0?NaN:(n=BigInt(n)%t)<0?n+t:n}functionf(n,t=16){return"number"==typeofn&&(n=BigInt(n)),newPromise((e,r)=>{consti=newWorker(B());i.onmessage=n=>{i.terminate(),e(n.data.isPrime)},i.onmessageerror=n=>{r(n)},i.postMessage({rnd:n,iterations:t,id:0})})}functiong(n,t=16){if(n<1)thrownewRangeError(`bitLength MUST be > 0 and it is ${n}`);if(!S){lete=0n;do{e=b(h(n,!0))}while(!I(e,t));returnnewPromise(n=>{n(e)})}returnnewPromise(e=>{constr=[],i=(i,o)=>{if(i.isPrime){for(letn=0;n<r.length;n++)r[n].terminate();for(;r.length;)r.pop();e(i.value)}else{conste=b(h(n,!0));try{o.postMessage({rnd:e,iterations:t,id:i.id})}catch(n){}}};{constn=B();for(lett=0;t<self.navigator.hardwareConcurrency-1;t++){constt=newWorker(n);t.onmessage=n=>i(n.data,t),r.push(t)}}for(lete=0;e<r.length;e++){consti=b(h(n,!0));r[e].postMessage({rnd:i,iterations:t,id:e})}})}functionl(n,t=16){if(n<1)thrownewRangeError(`bitLength MUST be > 0 and it is ${n}`);lete=0n;do{e=b(h(n,!0))}while(!I(e,t));returne}functionw(n,e=1n){if(n<=e)thrownewError("max must be > min");constr=n-e,i=t(r);leto;do{o=b(h(i))}while(o>r);returno+e}asyncfunctiond(n,t=!1){if(n<1)thrownewRangeError(`bitLength MUST be > 0 and it is ${n}`);conste=Math.ceil(n/8),r=n%8,i=awaitm(e,!1);if(r&&(i[0]=i[0]&2**r-1),t){constn=r?2**(r-1):128;i[0]=i[0]|n}returni}functionh(n,t=!1){if(n<1)thrownewRangeError(`bitLength MUST be > 0 and it is ${n}`);conste=$(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}functionm(n,t=!1){if(n<1)thrownewRangeError(`byteLength MUST be > 0 and it is ${n}`);returnnewPromise((function(e){constr=newUint8Array(n);crypto.getRandomValues(r),t&&(r[0]=128|r[0]),e(r)}))}function$(n,t=!1){if(n<1)thrownewRangeError(`byteLength MUST be > 0 and it is ${n}`);{conste=newUint8Array(n);returncrypto.getRandomValues(e),t&&(e[0]=128|e[0]),e}}functionb(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 ${c.name}=${c.toString()};const ${u.name}=${u.toString()};const ${h.name}=${h.toString()};const ${$.name}=${$.toString()};const ${w.name}=${w.toString()};const ${f.name}=${I.toString()};${t.toString()}${b.toString()}`;returnn+=`onmessage = ${asyncfunction(n){constt=awaitf(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)}functionI(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,199n,211n,223n,227n,229n,233n,239n,241n,251n,257n,263n,269n,271n,277n,281n,283n,293n,307n,311n,313n,317n,331n,337n,347n,349n,353n,359n,367n,373n,379n,383n,389n,397n,401n,409n,419n,421n,431n,433n,439n,443n,449n,457n,461n,463n,467n,