@zk-email/sdk 0.0.86-2 → 0.0.86-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/localProverWorker-DkBS78Vu.js +76 -0
- package/dist/assets/localProverWorker-DkBS78Vu.js.map +1 -0
- package/dist/ccip-C1_QoADM.js +2 -0
- package/dist/ccip-C1_QoADM.js.map +1 -0
- package/dist/ccip-DnkZqQmT.mjs +147 -0
- package/dist/ccip-DnkZqQmT.mjs.map +1 -0
- package/dist/index-CfUVEXW_.js +41 -0
- package/dist/index-CfUVEXW_.js.map +1 -0
- package/dist/index-DnjJIihA.mjs +13497 -0
- package/dist/index-DnjJIihA.mjs.map +1 -0
- package/dist/types/auth.d.ts +3 -0
- package/dist/types/blueprint.d.ts +129 -0
- package/dist/types/blueprintValidation.d.ts +82 -0
- package/dist/types/chain/index.d.ts +2 -0
- package/dist/types/index.d.ts +24 -0
- package/dist/types/localProverWorker.d.ts +2 -0
- package/dist/types/proof.d.ts +52 -0
- package/dist/types/prover.d.ts +27 -0
- package/dist/types/relayerUtils.d.ts +13 -0
- package/dist/types/types/auth.d.ts +16 -0
- package/dist/types/types/blueprint.d.ts +153 -0
- package/dist/types/types/index.d.ts +6 -0
- package/dist/types/types/proof.d.ts +56 -0
- package/dist/types/types/prover.d.ts +8 -0
- package/dist/types/types/sdk.d.ts +5 -0
- package/dist/types/types/utils.d.ts +8 -0
- package/dist/types/user.d.ts +5 -0
- package/dist/types/utils.d.ts +7 -0
- package/dist/zk-email-sdk.cjs.js +2 -0
- package/dist/zk-email-sdk.cjs.js.map +1 -0
- package/dist/zk-email-sdk.es.js +18 -0
- package/dist/zk-email-sdk.es.js.map +1 -0
- package/package.json +15 -12
- package/dist/index.d.mts +0 -553
- package/dist/index.d.ts +0 -553
- package/dist/index.js +0 -84
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -84
- package/dist/index.mjs.map +0 -1
- package/dist/localProverWorker.d.mts +0 -4
- package/dist/localProverWorker.d.ts +0 -4
- package/dist/localProverWorker.js +0 -2
- package/dist/localProverWorker.js.map +0 -1
- package/dist/localProverWorker.mjs +0 -2
- package/dist/localProverWorker.mjs.map +0 -1
@@ -0,0 +1,76 @@
|
|
1
|
+
(function(){"use strict";var ka=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Uo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function od(t){if(t.__esModule)return t;var a=t.default;if(typeof a=="function"){var n=function e(){return this instanceof e?Reflect.construct(a,arguments,this.constructor):a.apply(this,arguments)};n.prototype=a.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(e){var c=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,c.get?c:{enumerable:!0,get:function(){return t[e]}})}),n}function Lo(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var No={exports:{}};/*!
|
2
|
+
localForage -- Offline Storage, Improved
|
3
|
+
Version 1.10.0
|
4
|
+
https://localforage.github.io/localForage
|
5
|
+
(c) 2013-2017 Mozilla, Apache License 2.0
|
6
|
+
*/var tc;function ed(){return tc||(tc=1,function(t,a){(function(n){t.exports=n()})(function(){return function n(e,c,i){function r(l,s){if(!c[l]){if(!e[l]){var I=typeof Lo=="function"&&Lo;if(!s&&I)return I(l,!0);if(_)return _(l,!0);var b=new Error("Cannot find module '"+l+"'");throw b.code="MODULE_NOT_FOUND",b}var f=c[l]={exports:{}};e[l][0].call(f.exports,function(w){var O=e[l][1][w];return r(O||w)},f,f.exports,n,e,c,i)}return c[l].exports}for(var _=typeof Lo=="function"&&Lo,u=0;u<i.length;u++)r(i[u]);return r}({1:[function(n,e,c){(function(i){var r=i.MutationObserver||i.WebKitMutationObserver,_;if(r){var u=0,l=new r(w),s=i.document.createTextNode("");l.observe(s,{characterData:!0}),_=function(){s.data=u=++u%2}}else if(!i.setImmediate&&typeof i.MessageChannel<"u"){var I=new i.MessageChannel;I.port1.onmessage=w,_=function(){I.port2.postMessage(0)}}else"document"in i&&"onreadystatechange"in i.document.createElement("script")?_=function(){var D=i.document.createElement("script");D.onreadystatechange=function(){w(),D.onreadystatechange=null,D.parentNode.removeChild(D),D=null},i.document.documentElement.appendChild(D)}:_=function(){setTimeout(w,0)};var b,f=[];function w(){b=!0;for(var D,G,V=f.length;V;){for(G=f,f=[],D=-1;++D<V;)G[D]();V=f.length}b=!1}e.exports=O;function O(D){f.push(D)===1&&!b&&_()}}).call(this,typeof ka<"u"?ka:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,e,c){var i=n(1);function r(){}var _={},u=["REJECTED"],l=["FULFILLED"],s=["PENDING"];e.exports=I;function I(E){if(typeof E!="function")throw new TypeError("resolver must be a function");this.state=s,this.queue=[],this.outcome=void 0,E!==r&&O(this,E)}I.prototype.catch=function(E){return this.then(null,E)},I.prototype.then=function(E,M){if(typeof E!="function"&&this.state===l||typeof M!="function"&&this.state===u)return this;var h=new this.constructor(r);if(this.state!==s){var y=this.state===l?E:M;f(h,y,this.outcome)}else this.queue.push(new b(h,E,M));return h};function b(E,M,h){this.promise=E,typeof M=="function"&&(this.onFulfilled=M,this.callFulfilled=this.otherCallFulfilled),typeof h=="function"&&(this.onRejected=h,this.callRejected=this.otherCallRejected)}b.prototype.callFulfilled=function(E){_.resolve(this.promise,E)},b.prototype.otherCallFulfilled=function(E){f(this.promise,this.onFulfilled,E)},b.prototype.callRejected=function(E){_.reject(this.promise,E)},b.prototype.otherCallRejected=function(E){f(this.promise,this.onRejected,E)};function f(E,M,h){i(function(){var y;try{y=M(h)}catch(q){return _.reject(E,q)}y===E?_.reject(E,new TypeError("Cannot resolve promise with itself")):_.resolve(E,y)})}_.resolve=function(E,M){var h=D(w,M);if(h.status==="error")return _.reject(E,h.value);var y=h.value;if(y)O(E,y);else{E.state=l,E.outcome=M;for(var q=-1,g=E.queue.length;++q<g;)E.queue[q].callFulfilled(M)}return E},_.reject=function(E,M){E.state=u,E.outcome=M;for(var h=-1,y=E.queue.length;++h<y;)E.queue[h].callRejected(M);return E};function w(E){var M=E&&E.then;if(E&&(typeof E=="object"||typeof E=="function")&&typeof M=="function")return function(){M.apply(E,arguments)}}function O(E,M){var h=!1;function y(H){h||(h=!0,_.reject(E,H))}function q(H){h||(h=!0,_.resolve(E,H))}function g(){M(q,y)}var x=D(g);x.status==="error"&&y(x.value)}function D(E,M){var h={};try{h.value=E(M),h.status="success"}catch(y){h.status="error",h.value=y}return h}I.resolve=G;function G(E){return E instanceof this?E:_.resolve(new this(r),E)}I.reject=V;function V(E){var M=new this(r);return _.reject(M,E)}I.all=it;function it(E){var M=this;if(Object.prototype.toString.call(E)!=="[object Array]")return this.reject(new TypeError("must be an array"));var h=E.length,y=!1;if(!h)return this.resolve([]);for(var q=new Array(h),g=0,x=-1,H=new this(r);++x<h;)T(E[x],x);return H;function T(N,P){M.resolve(N).then(v,function(S){y||(y=!0,_.reject(H,S))});function v(S){q[P]=S,++g===h&&!y&&(y=!0,_.resolve(H,q))}}}I.race=Z;function Z(E){var M=this;if(Object.prototype.toString.call(E)!=="[object Array]")return this.reject(new TypeError("must be an array"));var h=E.length,y=!1;if(!h)return this.resolve([]);for(var q=-1,g=new this(r);++q<h;)x(E[q]);return g;function x(H){M.resolve(H).then(function(T){y||(y=!0,_.resolve(g,T))},function(T){y||(y=!0,_.reject(g,T))})}}},{1:1}],3:[function(n,e,c){(function(i){typeof i.Promise!="function"&&(i.Promise=n(2))}).call(this,typeof ka<"u"?ka:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,e,c){var i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Y){return typeof Y}:function(Y){return Y&&typeof Symbol=="function"&&Y.constructor===Symbol&&Y!==Symbol.prototype?"symbol":typeof Y};function r(Y,ut){if(!(Y instanceof ut))throw new TypeError("Cannot call a class as a function")}function _(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var u=_();function l(){try{if(!u||!u.open)return!1;var Y=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),ut=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!Y||ut)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function s(Y,ut){Y=Y||[],ut=ut||{};try{return new Blob(Y,ut)}catch(yt){if(yt.name!=="TypeError")throw yt;for(var ot=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,It=new ot,vt=0;vt<Y.length;vt+=1)It.append(Y[vt]);return It.getBlob(ut.type)}}typeof Promise>"u"&&n(3);var I=Promise;function b(Y,ut){ut&&Y.then(function(ot){ut(null,ot)},function(ot){ut(ot)})}function f(Y,ut,ot){typeof ut=="function"&&Y.then(ut),typeof ot=="function"&&Y.catch(ot)}function w(Y){return typeof Y!="string"&&(console.warn(Y+" used as a key, but it is not a string."),Y=String(Y)),Y}function O(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var D="local-forage-detect-blob-support",G=void 0,V={},it=Object.prototype.toString,Z="readonly",E="readwrite";function M(Y){for(var ut=Y.length,ot=new ArrayBuffer(ut),It=new Uint8Array(ot),vt=0;vt<ut;vt++)It[vt]=Y.charCodeAt(vt);return ot}function h(Y){return new I(function(ut){var ot=Y.transaction(D,E),It=s([""]);ot.objectStore(D).put(It,"key"),ot.onabort=function(vt){vt.preventDefault(),vt.stopPropagation(),ut(!1)},ot.oncomplete=function(){var vt=navigator.userAgent.match(/Chrome\/(\d+)/),yt=navigator.userAgent.match(/Edge\//);ut(yt||!vt||parseInt(vt[1],10)>=43)}}).catch(function(){return!1})}function y(Y){return typeof G=="boolean"?I.resolve(G):h(Y).then(function(ut){return G=ut,G})}function q(Y){var ut=V[Y.name],ot={};ot.promise=new I(function(It,vt){ot.resolve=It,ot.reject=vt}),ut.deferredOperations.push(ot),ut.dbReady?ut.dbReady=ut.dbReady.then(function(){return ot.promise}):ut.dbReady=ot.promise}function g(Y){var ut=V[Y.name],ot=ut.deferredOperations.pop();if(ot)return ot.resolve(),ot.promise}function x(Y,ut){var ot=V[Y.name],It=ot.deferredOperations.pop();if(It)return It.reject(ut),It.promise}function H(Y,ut){return new I(function(ot,It){if(V[Y.name]=V[Y.name]||Pt(),Y.db)if(ut)q(Y),Y.db.close();else return ot(Y.db);var vt=[Y.name];ut&&vt.push(Y.version);var yt=u.open.apply(u,vt);ut&&(yt.onupgradeneeded=function(Dt){var Zt=yt.result;try{Zt.createObjectStore(Y.storeName),Dt.oldVersion<=1&&Zt.createObjectStore(D)}catch(Vt){if(Vt.name==="ConstraintError")console.warn('The database "'+Y.name+'" has been upgraded from version '+Dt.oldVersion+" to version "+Dt.newVersion+', but the storage "'+Y.storeName+'" already exists.');else throw Vt}}),yt.onerror=function(Dt){Dt.preventDefault(),It(yt.error)},yt.onsuccess=function(){var Dt=yt.result;Dt.onversionchange=function(Zt){Zt.target.close()},ot(Dt),g(Y)}})}function T(Y){return H(Y,!1)}function N(Y){return H(Y,!0)}function P(Y,ut){if(!Y.db)return!0;var ot=!Y.db.objectStoreNames.contains(Y.storeName),It=Y.version<Y.db.version,vt=Y.version>Y.db.version;if(It&&(Y.version!==ut&&console.warn('The database "'+Y.name+`" can't be downgraded from version `+Y.db.version+" to version "+Y.version+"."),Y.version=Y.db.version),vt||ot){if(ot){var yt=Y.db.version+1;yt>Y.version&&(Y.version=yt)}return!0}return!1}function v(Y){return new I(function(ut,ot){var It=new FileReader;It.onerror=ot,It.onloadend=function(vt){var yt=btoa(vt.target.result||"");ut({__local_forage_encoded_blob:!0,data:yt,type:Y.type})},It.readAsBinaryString(Y)})}function S(Y){var ut=M(atob(Y.data));return s([ut],{type:Y.type})}function et(Y){return Y&&Y.__local_forage_encoded_blob}function _t(Y){var ut=this,ot=ut._initReady().then(function(){var It=V[ut._dbInfo.name];if(It&&It.dbReady)return It.dbReady});return f(ot,Y,Y),ot}function mt(Y){q(Y);for(var ut=V[Y.name],ot=ut.forages,It=0;It<ot.length;It++){var vt=ot[It];vt._dbInfo.db&&(vt._dbInfo.db.close(),vt._dbInfo.db=null)}return Y.db=null,T(Y).then(function(yt){return Y.db=yt,P(Y)?N(Y):yt}).then(function(yt){Y.db=ut.db=yt;for(var Dt=0;Dt<ot.length;Dt++)ot[Dt]._dbInfo.db=yt}).catch(function(yt){throw x(Y,yt),yt})}function xt(Y,ut,ot,It){It===void 0&&(It=1);try{var vt=Y.db.transaction(Y.storeName,ut);ot(null,vt)}catch(yt){if(It>0&&(!Y.db||yt.name==="InvalidStateError"||yt.name==="NotFoundError"))return I.resolve().then(function(){if(!Y.db||yt.name==="NotFoundError"&&!Y.db.objectStoreNames.contains(Y.storeName)&&Y.version<=Y.db.version)return Y.db&&(Y.version=Y.db.version+1),N(Y)}).then(function(){return mt(Y).then(function(){xt(Y,ut,ot,It-1)})}).catch(ot);ot(yt)}}function Pt(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function zt(Y){var ut=this,ot={db:null};if(Y)for(var It in Y)ot[It]=Y[It];var vt=V[ot.name];vt||(vt=Pt(),V[ot.name]=vt),vt.forages.push(ut),ut._initReady||(ut._initReady=ut.ready,ut.ready=_t);var yt=[];function Dt(){return I.resolve()}for(var Zt=0;Zt<vt.forages.length;Zt++){var Vt=vt.forages[Zt];Vt!==ut&&yt.push(Vt._initReady().catch(Dt))}var Yt=vt.forages.slice(0);return I.all(yt).then(function(){return ot.db=vt.db,T(ot)}).then(function(Xt){return ot.db=Xt,P(ot,ut._defaultConfig.version)?N(ot):Xt}).then(function(Xt){ot.db=vt.db=Xt,ut._dbInfo=ot;for(var nn=0;nn<Yt.length;nn++){var ln=Yt[nn];ln!==ut&&(ln._dbInfo.db=ot.db,ln._dbInfo.version=ot.version)}})}function Rt(Y,ut){var ot=this;Y=w(Y);var It=new I(function(vt,yt){ot.ready().then(function(){xt(ot._dbInfo,Z,function(Dt,Zt){if(Dt)return yt(Dt);try{var Vt=Zt.objectStore(ot._dbInfo.storeName),Yt=Vt.get(Y);Yt.onsuccess=function(){var Xt=Yt.result;Xt===void 0&&(Xt=null),et(Xt)&&(Xt=S(Xt)),vt(Xt)},Yt.onerror=function(){yt(Yt.error)}}catch(Xt){yt(Xt)}})}).catch(yt)});return b(It,ut),It}function k(Y,ut){var ot=this,It=new I(function(vt,yt){ot.ready().then(function(){xt(ot._dbInfo,Z,function(Dt,Zt){if(Dt)return yt(Dt);try{var Vt=Zt.objectStore(ot._dbInfo.storeName),Yt=Vt.openCursor(),Xt=1;Yt.onsuccess=function(){var nn=Yt.result;if(nn){var ln=nn.value;et(ln)&&(ln=S(ln));var _n=Y(ln,nn.key,Xt++);_n!==void 0?vt(_n):nn.continue()}else vt()},Yt.onerror=function(){yt(Yt.error)}}catch(nn){yt(nn)}})}).catch(yt)});return b(It,ut),It}function Ct(Y,ut,ot){var It=this;Y=w(Y);var vt=new I(function(yt,Dt){var Zt;It.ready().then(function(){return Zt=It._dbInfo,it.call(ut)==="[object Blob]"?y(Zt.db).then(function(Vt){return Vt?ut:v(ut)}):ut}).then(function(Vt){xt(It._dbInfo,E,function(Yt,Xt){if(Yt)return Dt(Yt);try{var nn=Xt.objectStore(It._dbInfo.storeName);Vt===null&&(Vt=void 0);var ln=nn.put(Vt,Y);Xt.oncomplete=function(){Vt===void 0&&(Vt=null),yt(Vt)},Xt.onabort=Xt.onerror=function(){var _n=ln.error?ln.error:ln.transaction.error;Dt(_n)}}catch(_n){Dt(_n)}})}).catch(Dt)});return b(vt,ot),vt}function St(Y,ut){var ot=this;Y=w(Y);var It=new I(function(vt,yt){ot.ready().then(function(){xt(ot._dbInfo,E,function(Dt,Zt){if(Dt)return yt(Dt);try{var Vt=Zt.objectStore(ot._dbInfo.storeName),Yt=Vt.delete(Y);Zt.oncomplete=function(){vt()},Zt.onerror=function(){yt(Yt.error)},Zt.onabort=function(){var Xt=Yt.error?Yt.error:Yt.transaction.error;yt(Xt)}}catch(Xt){yt(Xt)}})}).catch(yt)});return b(It,ut),It}function F(Y){var ut=this,ot=new I(function(It,vt){ut.ready().then(function(){xt(ut._dbInfo,E,function(yt,Dt){if(yt)return vt(yt);try{var Zt=Dt.objectStore(ut._dbInfo.storeName),Vt=Zt.clear();Dt.oncomplete=function(){It()},Dt.onabort=Dt.onerror=function(){var Yt=Vt.error?Vt.error:Vt.transaction.error;vt(Yt)}}catch(Yt){vt(Yt)}})}).catch(vt)});return b(ot,Y),ot}function o(Y){var ut=this,ot=new I(function(It,vt){ut.ready().then(function(){xt(ut._dbInfo,Z,function(yt,Dt){if(yt)return vt(yt);try{var Zt=Dt.objectStore(ut._dbInfo.storeName),Vt=Zt.count();Vt.onsuccess=function(){It(Vt.result)},Vt.onerror=function(){vt(Vt.error)}}catch(Yt){vt(Yt)}})}).catch(vt)});return b(ot,Y),ot}function L(Y,ut){var ot=this,It=new I(function(vt,yt){if(Y<0){vt(null);return}ot.ready().then(function(){xt(ot._dbInfo,Z,function(Dt,Zt){if(Dt)return yt(Dt);try{var Vt=Zt.objectStore(ot._dbInfo.storeName),Yt=!1,Xt=Vt.openKeyCursor();Xt.onsuccess=function(){var nn=Xt.result;if(!nn){vt(null);return}Y===0||Yt?vt(nn.key):(Yt=!0,nn.advance(Y))},Xt.onerror=function(){yt(Xt.error)}}catch(nn){yt(nn)}})}).catch(yt)});return b(It,ut),It}function U(Y){var ut=this,ot=new I(function(It,vt){ut.ready().then(function(){xt(ut._dbInfo,Z,function(yt,Dt){if(yt)return vt(yt);try{var Zt=Dt.objectStore(ut._dbInfo.storeName),Vt=Zt.openKeyCursor(),Yt=[];Vt.onsuccess=function(){var Xt=Vt.result;if(!Xt){It(Yt);return}Yt.push(Xt.key),Xt.continue()},Vt.onerror=function(){vt(Vt.error)}}catch(Xt){vt(Xt)}})}).catch(vt)});return b(ot,Y),ot}function p(Y,ut){ut=O.apply(this,arguments);var ot=this.config();Y=typeof Y!="function"&&Y||{},Y.name||(Y.name=Y.name||ot.name,Y.storeName=Y.storeName||ot.storeName);var It=this,vt;if(!Y.name)vt=I.reject("Invalid arguments");else{var yt=Y.name===ot.name&&It._dbInfo.db,Dt=yt?I.resolve(It._dbInfo.db):T(Y).then(function(Zt){var Vt=V[Y.name],Yt=Vt.forages;Vt.db=Zt;for(var Xt=0;Xt<Yt.length;Xt++)Yt[Xt]._dbInfo.db=Zt;return Zt});Y.storeName?vt=Dt.then(function(Zt){if(Zt.objectStoreNames.contains(Y.storeName)){var Vt=Zt.version+1;q(Y);var Yt=V[Y.name],Xt=Yt.forages;Zt.close();for(var nn=0;nn<Xt.length;nn++){var ln=Xt[nn];ln._dbInfo.db=null,ln._dbInfo.version=Vt}var _n=new I(function(gn,An){var bn=u.open(Y.name,Vt);bn.onerror=function(Qn){var ho=bn.result;ho.close(),An(Qn)},bn.onupgradeneeded=function(){var Qn=bn.result;Qn.deleteObjectStore(Y.storeName)},bn.onsuccess=function(){var Qn=bn.result;Qn.close(),gn(Qn)}});return _n.then(function(gn){Yt.db=gn;for(var An=0;An<Xt.length;An++){var bn=Xt[An];bn._dbInfo.db=gn,g(bn._dbInfo)}}).catch(function(gn){throw(x(Y,gn)||I.resolve()).catch(function(){}),gn})}}):vt=Dt.then(function(Zt){q(Y);var Vt=V[Y.name],Yt=Vt.forages;Zt.close();for(var Xt=0;Xt<Yt.length;Xt++){var nn=Yt[Xt];nn._dbInfo.db=null}var ln=new I(function(_n,gn){var An=u.deleteDatabase(Y.name);An.onerror=function(){var bn=An.result;bn&&bn.close(),gn(An.error)},An.onblocked=function(){console.warn('dropInstance blocked for database "'+Y.name+'" until all open connections are closed')},An.onsuccess=function(){var bn=An.result;bn&&bn.close(),_n(bn)}});return ln.then(function(_n){Vt.db=_n;for(var gn=0;gn<Yt.length;gn++){var An=Yt[gn];g(An._dbInfo)}}).catch(function(_n){throw(x(Y,_n)||I.resolve()).catch(function(){}),_n})})}return b(vt,ut),vt}var st={_driver:"asyncStorage",_initStorage:zt,_support:l(),iterate:k,getItem:Rt,setItem:Ct,removeItem:St,clear:F,length:o,key:L,keys:U,dropInstance:p};function qt(){return typeof openDatabase=="function"}var wt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nt="~~local_forage_type~",Q=/^~~local_forage_type~([^~]+)~/,A="__lfsc__:",lt=A.length,Ft="arbf",Ut="blob",dt="si08",B="ui08",Lt="uic8",Gt="si16",z="si32",$="ur16",X="ui32",at="fl32",gt="fl64",ft=lt+Ft.length,Bt=Object.prototype.toString;function pt(Y){var ut=Y.length*.75,ot=Y.length,It,vt=0,yt,Dt,Zt,Vt;Y[Y.length-1]==="="&&(ut--,Y[Y.length-2]==="="&&ut--);var Yt=new ArrayBuffer(ut),Xt=new Uint8Array(Yt);for(It=0;It<ot;It+=4)yt=wt.indexOf(Y[It]),Dt=wt.indexOf(Y[It+1]),Zt=wt.indexOf(Y[It+2]),Vt=wt.indexOf(Y[It+3]),Xt[vt++]=yt<<2|Dt>>4,Xt[vt++]=(Dt&15)<<4|Zt>>2,Xt[vt++]=(Zt&3)<<6|Vt&63;return Yt}function Ot(Y){var ut=new Uint8Array(Y),ot="",It;for(It=0;It<ut.length;It+=3)ot+=wt[ut[It]>>2],ot+=wt[(ut[It]&3)<<4|ut[It+1]>>4],ot+=wt[(ut[It+1]&15)<<2|ut[It+2]>>6],ot+=wt[ut[It+2]&63];return ut.length%3===2?ot=ot.substring(0,ot.length-1)+"=":ut.length%3===1&&(ot=ot.substring(0,ot.length-2)+"=="),ot}function Ht(Y,ut){var ot="";if(Y&&(ot=Bt.call(Y)),Y&&(ot==="[object ArrayBuffer]"||Y.buffer&&Bt.call(Y.buffer)==="[object ArrayBuffer]")){var It,vt=A;Y instanceof ArrayBuffer?(It=Y,vt+=Ft):(It=Y.buffer,ot==="[object Int8Array]"?vt+=dt:ot==="[object Uint8Array]"?vt+=B:ot==="[object Uint8ClampedArray]"?vt+=Lt:ot==="[object Int16Array]"?vt+=Gt:ot==="[object Uint16Array]"?vt+=$:ot==="[object Int32Array]"?vt+=z:ot==="[object Uint32Array]"?vt+=X:ot==="[object Float32Array]"?vt+=at:ot==="[object Float64Array]"?vt+=gt:ut(new Error("Failed to get type for BinaryArray"))),ut(vt+Ot(It))}else if(ot==="[object Blob]"){var yt=new FileReader;yt.onload=function(){var Dt=nt+Y.type+"~"+Ot(this.result);ut(A+Ut+Dt)},yt.readAsArrayBuffer(Y)}else try{ut(JSON.stringify(Y))}catch(Dt){console.error("Couldn't convert value into a JSON string: ",Y),ut(null,Dt)}}function on(Y){if(Y.substring(0,lt)!==A)return JSON.parse(Y);var ut=Y.substring(ft),ot=Y.substring(lt,ft),It;if(ot===Ut&&Q.test(ut)){var vt=ut.match(Q);It=vt[1],ut=ut.substring(vt[0].length)}var yt=pt(ut);switch(ot){case Ft:return yt;case Ut:return s([yt],{type:It});case dt:return new Int8Array(yt);case B:return new Uint8Array(yt);case Lt:return new Uint8ClampedArray(yt);case Gt:return new Int16Array(yt);case $:return new Uint16Array(yt);case z:return new Int32Array(yt);case X:return new Uint32Array(yt);case at:return new Float32Array(yt);case gt:return new Float64Array(yt);default:throw new Error("Unkown type: "+ot)}}var an={serialize:Ht,deserialize:on,stringToBuffer:pt,bufferToString:Ot};function en(Y,ut,ot,It){Y.executeSql("CREATE TABLE IF NOT EXISTS "+ut.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],ot,It)}function rn(Y){var ut=this,ot={db:null};if(Y)for(var It in Y)ot[It]=typeof Y[It]!="string"?Y[It].toString():Y[It];var vt=new I(function(yt,Dt){try{ot.db=openDatabase(ot.name,String(ot.version),ot.description,ot.size)}catch(Zt){return Dt(Zt)}ot.db.transaction(function(Zt){en(Zt,ot,function(){ut._dbInfo=ot,yt()},function(Vt,Yt){Dt(Yt)})},Dt)});return ot.serializer=an,vt}function cn(Y,ut,ot,It,vt,yt){Y.executeSql(ot,It,vt,function(Dt,Zt){Zt.code===Zt.SYNTAX_ERR?Dt.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[ut.storeName],function(Vt,Yt){Yt.rows.length?yt(Vt,Zt):en(Vt,ut,function(){Vt.executeSql(ot,It,vt,yt)},yt)},yt):yt(Dt,Zt)},yt)}function fn(Y,ut){var ot=this;Y=w(Y);var It=new I(function(vt,yt){ot.ready().then(function(){var Dt=ot._dbInfo;Dt.db.transaction(function(Zt){cn(Zt,Dt,"SELECT * FROM "+Dt.storeName+" WHERE key = ? LIMIT 1",[Y],function(Vt,Yt){var Xt=Yt.rows.length?Yt.rows.item(0).value:null;Xt&&(Xt=Dt.serializer.deserialize(Xt)),vt(Xt)},function(Vt,Yt){yt(Yt)})})}).catch(yt)});return b(It,ut),It}function Ln(Y,ut){var ot=this,It=new I(function(vt,yt){ot.ready().then(function(){var Dt=ot._dbInfo;Dt.db.transaction(function(Zt){cn(Zt,Dt,"SELECT * FROM "+Dt.storeName,[],function(Vt,Yt){for(var Xt=Yt.rows,nn=Xt.length,ln=0;ln<nn;ln++){var _n=Xt.item(ln),gn=_n.value;if(gn&&(gn=Dt.serializer.deserialize(gn)),gn=Y(gn,_n.key,ln+1),gn!==void 0){vt(gn);return}}vt()},function(Vt,Yt){yt(Yt)})})}).catch(yt)});return b(It,ut),It}function In(Y,ut,ot,It){var vt=this;Y=w(Y);var yt=new I(function(Dt,Zt){vt.ready().then(function(){ut===void 0&&(ut=null);var Vt=ut,Yt=vt._dbInfo;Yt.serializer.serialize(ut,function(Xt,nn){nn?Zt(nn):Yt.db.transaction(function(ln){cn(ln,Yt,"INSERT OR REPLACE INTO "+Yt.storeName+" (key, value) VALUES (?, ?)",[Y,Xt],function(){Dt(Vt)},function(_n,gn){Zt(gn)})},function(ln){if(ln.code===ln.QUOTA_ERR){if(It>0){Dt(In.apply(vt,[Y,Vt,ot,It-1]));return}Zt(ln)}})})}).catch(Zt)});return b(yt,ot),yt}function Mt(Y,ut,ot){return In.apply(this,[Y,ut,ot,1])}function m(Y,ut){var ot=this;Y=w(Y);var It=new I(function(vt,yt){ot.ready().then(function(){var Dt=ot._dbInfo;Dt.db.transaction(function(Zt){cn(Zt,Dt,"DELETE FROM "+Dt.storeName+" WHERE key = ?",[Y],function(){vt()},function(Vt,Yt){yt(Yt)})})}).catch(yt)});return b(It,ut),It}function C(Y){var ut=this,ot=new I(function(It,vt){ut.ready().then(function(){var yt=ut._dbInfo;yt.db.transaction(function(Dt){cn(Dt,yt,"DELETE FROM "+yt.storeName,[],function(){It()},function(Zt,Vt){vt(Vt)})})}).catch(vt)});return b(ot,Y),ot}function R(Y){var ut=this,ot=new I(function(It,vt){ut.ready().then(function(){var yt=ut._dbInfo;yt.db.transaction(function(Dt){cn(Dt,yt,"SELECT COUNT(key) as c FROM "+yt.storeName,[],function(Zt,Vt){var Yt=Vt.rows.item(0).c;It(Yt)},function(Zt,Vt){vt(Vt)})})}).catch(vt)});return b(ot,Y),ot}function d(Y,ut){var ot=this,It=new I(function(vt,yt){ot.ready().then(function(){var Dt=ot._dbInfo;Dt.db.transaction(function(Zt){cn(Zt,Dt,"SELECT key FROM "+Dt.storeName+" WHERE id = ? LIMIT 1",[Y+1],function(Vt,Yt){var Xt=Yt.rows.length?Yt.rows.item(0).key:null;vt(Xt)},function(Vt,Yt){yt(Yt)})})}).catch(yt)});return b(It,ut),It}function j(Y){var ut=this,ot=new I(function(It,vt){ut.ready().then(function(){var yt=ut._dbInfo;yt.db.transaction(function(Dt){cn(Dt,yt,"SELECT key FROM "+yt.storeName,[],function(Zt,Vt){for(var Yt=[],Xt=0;Xt<Vt.rows.length;Xt++)Yt.push(Vt.rows.item(Xt).key);It(Yt)},function(Zt,Vt){vt(Vt)})})}).catch(vt)});return b(ot,Y),ot}function W(Y){return new I(function(ut,ot){Y.transaction(function(It){It.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(vt,yt){for(var Dt=[],Zt=0;Zt<yt.rows.length;Zt++)Dt.push(yt.rows.item(Zt).name);ut({db:Y,storeNames:Dt})},function(vt,yt){ot(yt)})},function(It){ot(It)})})}function K(Y,ut){ut=O.apply(this,arguments);var ot=this.config();Y=typeof Y!="function"&&Y||{},Y.name||(Y.name=Y.name||ot.name,Y.storeName=Y.storeName||ot.storeName);var It=this,vt;return Y.name?vt=new I(function(yt){var Dt;Y.name===ot.name?Dt=It._dbInfo.db:Dt=openDatabase(Y.name,"","",0),Y.storeName?yt({db:Dt,storeNames:[Y.storeName]}):yt(W(Dt))}).then(function(yt){return new I(function(Dt,Zt){yt.db.transaction(function(Vt){function Yt(_n){return new I(function(gn,An){Vt.executeSql("DROP TABLE IF EXISTS "+_n,[],function(){gn()},function(bn,Qn){An(Qn)})})}for(var Xt=[],nn=0,ln=yt.storeNames.length;nn<ln;nn++)Xt.push(Yt(yt.storeNames[nn]));I.all(Xt).then(function(){Dt()}).catch(function(_n){Zt(_n)})},function(Vt){Zt(Vt)})})}):vt=I.reject("Invalid arguments"),b(vt,ut),vt}var J={_driver:"webSQLStorage",_initStorage:rn,_support:qt(),iterate:Ln,getItem:fn,setItem:Mt,removeItem:m,clear:C,length:R,key:d,keys:j,dropInstance:K};function tt(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function rt(Y,ut){var ot=Y.name+"/";return Y.storeName!==ut.storeName&&(ot+=Y.storeName+"/"),ot}function ct(){var Y="_localforage_support_test";try{return localStorage.setItem(Y,!0),localStorage.removeItem(Y),!1}catch{return!0}}function ht(){return!ct()||localStorage.length>0}function bt(Y){var ut=this,ot={};if(Y)for(var It in Y)ot[It]=Y[It];return ot.keyPrefix=rt(Y,ut._defaultConfig),ht()?(ut._dbInfo=ot,ot.serializer=an,I.resolve()):I.reject()}function At(Y){var ut=this,ot=ut.ready().then(function(){for(var It=ut._dbInfo.keyPrefix,vt=localStorage.length-1;vt>=0;vt--){var yt=localStorage.key(vt);yt.indexOf(It)===0&&localStorage.removeItem(yt)}});return b(ot,Y),ot}function Et(Y,ut){var ot=this;Y=w(Y);var It=ot.ready().then(function(){var vt=ot._dbInfo,yt=localStorage.getItem(vt.keyPrefix+Y);return yt&&(yt=vt.serializer.deserialize(yt)),yt});return b(It,ut),It}function Nt(Y,ut){var ot=this,It=ot.ready().then(function(){for(var vt=ot._dbInfo,yt=vt.keyPrefix,Dt=yt.length,Zt=localStorage.length,Vt=1,Yt=0;Yt<Zt;Yt++){var Xt=localStorage.key(Yt);if(Xt.indexOf(yt)===0){var nn=localStorage.getItem(Xt);if(nn&&(nn=vt.serializer.deserialize(nn)),nn=Y(nn,Xt.substring(Dt),Vt++),nn!==void 0)return nn}}});return b(It,ut),It}function Tt(Y,ut){var ot=this,It=ot.ready().then(function(){var vt=ot._dbInfo,yt;try{yt=localStorage.key(Y)}catch{yt=null}return yt&&(yt=yt.substring(vt.keyPrefix.length)),yt});return b(It,ut),It}function $t(Y){var ut=this,ot=ut.ready().then(function(){for(var It=ut._dbInfo,vt=localStorage.length,yt=[],Dt=0;Dt<vt;Dt++){var Zt=localStorage.key(Dt);Zt.indexOf(It.keyPrefix)===0&&yt.push(Zt.substring(It.keyPrefix.length))}return yt});return b(ot,Y),ot}function Qt(Y){var ut=this,ot=ut.keys().then(function(It){return It.length});return b(ot,Y),ot}function jt(Y,ut){var ot=this;Y=w(Y);var It=ot.ready().then(function(){var vt=ot._dbInfo;localStorage.removeItem(vt.keyPrefix+Y)});return b(It,ut),It}function kt(Y,ut,ot){var It=this;Y=w(Y);var vt=It.ready().then(function(){ut===void 0&&(ut=null);var yt=ut;return new I(function(Dt,Zt){var Vt=It._dbInfo;Vt.serializer.serialize(ut,function(Yt,Xt){if(Xt)Zt(Xt);else try{localStorage.setItem(Vt.keyPrefix+Y,Yt),Dt(yt)}catch(nn){(nn.name==="QuotaExceededError"||nn.name==="NS_ERROR_DOM_QUOTA_REACHED")&&Zt(nn),Zt(nn)}})})});return b(vt,ot),vt}function tn(Y,ut){if(ut=O.apply(this,arguments),Y=typeof Y!="function"&&Y||{},!Y.name){var ot=this.config();Y.name=Y.name||ot.name,Y.storeName=Y.storeName||ot.storeName}var It=this,vt;return Y.name?vt=new I(function(yt){Y.storeName?yt(rt(Y,It._defaultConfig)):yt(Y.name+"/")}).then(function(yt){for(var Dt=localStorage.length-1;Dt>=0;Dt--){var Zt=localStorage.key(Dt);Zt.indexOf(yt)===0&&localStorage.removeItem(Zt)}}):vt=I.reject("Invalid arguments"),b(vt,ut),vt}var Wt={_driver:"localStorageWrapper",_initStorage:bt,_support:tt(),iterate:Nt,getItem:Et,setItem:kt,removeItem:jt,clear:At,length:Qt,key:Tt,keys:$t,dropInstance:tn},Jt=function(ut,ot){return ut===ot||typeof ut=="number"&&typeof ot=="number"&&isNaN(ut)&&isNaN(ot)},xn=function(ut,ot){for(var It=ut.length,vt=0;vt<It;){if(Jt(ut[vt],ot))return!0;vt++}return!1},Sn=Array.isArray||function(Y){return Object.prototype.toString.call(Y)==="[object Array]"},Pn={},ua={},On={INDEXEDDB:st,WEBSQL:J,LOCALSTORAGE:Wt},wa=[On.INDEXEDDB._driver,On.WEBSQL._driver,On.LOCALSTORAGE._driver],Xn=["dropInstance"],Dn=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Xn),aa={description:"",driver:wa.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function oa(Y,ut){Y[ut]=function(){var ot=arguments;return Y.ready().then(function(){return Y[ut].apply(Y,ot)})}}function ea(){for(var Y=1;Y<arguments.length;Y++){var ut=arguments[Y];if(ut)for(var ot in ut)ut.hasOwnProperty(ot)&&(Sn(ut[ot])?arguments[0][ot]=ut[ot].slice():arguments[0][ot]=ut[ot])}return arguments[0]}var ko=function(){function Y(ut){r(this,Y);for(var ot in On)if(On.hasOwnProperty(ot)){var It=On[ot],vt=It._driver;this[ot]=vt,Pn[vt]||this.defineDriver(It)}this._defaultConfig=ea({},aa),this._config=ea({},this._defaultConfig,ut),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return Y.prototype.config=function(ot){if((typeof ot>"u"?"undefined":i(ot))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var It in ot){if(It==="storeName"&&(ot[It]=ot[It].replace(/\W/g,"_")),It==="version"&&typeof ot[It]!="number")return new Error("Database version must be a number.");this._config[It]=ot[It]}return"driver"in ot&&ot.driver?this.setDriver(this._config.driver):!0}else return typeof ot=="string"?this._config[ot]:this._config},Y.prototype.defineDriver=function(ot,It,vt){var yt=new I(function(Dt,Zt){try{var Vt=ot._driver,Yt=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!ot._driver){Zt(Yt);return}for(var Xt=Dn.concat("_initStorage"),nn=0,ln=Xt.length;nn<ln;nn++){var _n=Xt[nn],gn=!xn(Xn,_n);if((gn||ot[_n])&&typeof ot[_n]!="function"){Zt(Yt);return}}var An=function(){for(var ho=function(S0){return function(){var q0=new Error("Method "+S0+" is not implemented by the current driver"),ad=I.reject(q0);return b(ad,arguments[arguments.length-1]),ad}},Xi=0,x0=Xn.length;Xi<x0;Xi++){var Wi=Xn[Xi];ot[Wi]||(ot[Wi]=ho(Wi))}};An();var bn=function(ho){Pn[Vt]&&console.info("Redefining LocalForage driver: "+Vt),Pn[Vt]=ot,ua[Vt]=ho,Dt()};"_support"in ot?ot._support&&typeof ot._support=="function"?ot._support().then(bn,Zt):bn(!!ot._support):bn(!0)}catch(Qn){Zt(Qn)}});return f(yt,It,vt),yt},Y.prototype.driver=function(){return this._driver||null},Y.prototype.getDriver=function(ot,It,vt){var yt=Pn[ot]?I.resolve(Pn[ot]):I.reject(new Error("Driver not found."));return f(yt,It,vt),yt},Y.prototype.getSerializer=function(ot){var It=I.resolve(an);return f(It,ot),It},Y.prototype.ready=function(ot){var It=this,vt=It._driverSet.then(function(){return It._ready===null&&(It._ready=It._initDriver()),It._ready});return f(vt,ot,ot),vt},Y.prototype.setDriver=function(ot,It,vt){var yt=this;Sn(ot)||(ot=[ot]);var Dt=this._getSupportedDrivers(ot);function Zt(){yt._config.driver=yt.driver()}function Vt(nn){return yt._extend(nn),Zt(),yt._ready=yt._initStorage(yt._config),yt._ready}function Yt(nn){return function(){var ln=0;function _n(){for(;ln<nn.length;){var gn=nn[ln];return ln++,yt._dbInfo=null,yt._ready=null,yt.getDriver(gn).then(Vt).catch(_n)}Zt();var An=new Error("No available storage method found.");return yt._driverSet=I.reject(An),yt._driverSet}return _n()}}var Xt=this._driverSet!==null?this._driverSet.catch(function(){return I.resolve()}):I.resolve();return this._driverSet=Xt.then(function(){var nn=Dt[0];return yt._dbInfo=null,yt._ready=null,yt.getDriver(nn).then(function(ln){yt._driver=ln._driver,Zt(),yt._wrapLibraryMethodsWithReady(),yt._initDriver=Yt(Dt)})}).catch(function(){Zt();var nn=new Error("No available storage method found.");return yt._driverSet=I.reject(nn),yt._driverSet}),f(this._driverSet,It,vt),this._driverSet},Y.prototype.supports=function(ot){return!!ua[ot]},Y.prototype._extend=function(ot){ea(this,ot)},Y.prototype._getSupportedDrivers=function(ot){for(var It=[],vt=0,yt=ot.length;vt<yt;vt++){var Dt=ot[vt];this.supports(Dt)&&It.push(Dt)}return It},Y.prototype._wrapLibraryMethodsWithReady=function(){for(var ot=0,It=Dn.length;ot<It;ot++)oa(this,Dn[ot])},Y.prototype.createInstance=function(ot){return new Y(ot)},Y}(),F0=new ko;e.exports=F0},{3:3}]},{},[4])(4)})}(No)),No.exports}var id=ed(),Do=Uo(id);const cd=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4];function po(t,a){if(!a||a==10)return BigInt(t);if(a==16)return t.slice(0,2)=="0x"?BigInt(t):BigInt("0x"+t)}const ga=po;function ld(t,a){let n=BigInt(0);a=BigInt(a);for(let e=0;e<t.length;e++)n=n*a+BigInt(t[e]);return n}function nc(t){const a=t.toString(16);return(a.length-1)*4+cd[parseInt(a[0],16)]}function sd(t){return BigInt(t)<BigInt(0)}function rd(t){return!t}function ac(t,a){return BigInt(t)<<BigInt(a)}function Qo(t,a){return BigInt(t)>>BigInt(a)}const dd=ac,_d=Qo;function ud(t){return(BigInt(t)&BigInt(1))==BigInt(1)}function gd(t){let a=BigInt(t);const n=[];for(;a;){if(a&BigInt(1)){const e=2-Number(a%BigInt(4));n.push(e),a=a-BigInt(e)}else n.push(0);a=a>>BigInt(1)}return n}function fd(t){let a=BigInt(t);const n=[];for(;a;)a&BigInt(1)?n.push(1):n.push(0),a=a>>BigInt(1);return n}function oc(t){if(t>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("Number too big");return Number(t)}function hd(t,a){const n=[];let e=BigInt(t);for(a=BigInt(a);e;)n.unshift(Number(e%a)),e=e/a;return n}function Ld(t,a){return BigInt(t)+BigInt(a)}function pd(t,a){return BigInt(t)-BigInt(a)}function bd(t){return-BigInt(t)}function yd(t,a){return BigInt(t)*BigInt(a)}function Ad(t){return BigInt(t)*BigInt(t)}function md(t,a){return BigInt(t)**BigInt(a)}function Cd(t,a){return BigInt(t)**BigInt(a)}function Id(t){return BigInt(t)>=0?BigInt(t):-BigInt(t)}function wd(t,a){return BigInt(t)/BigInt(a)}function vd(t,a){return BigInt(t)%BigInt(a)}function Bd(t,a){return BigInt(t)==BigInt(a)}function Ed(t,a){return BigInt(t)!=BigInt(a)}function Fd(t,a){return BigInt(t)<BigInt(a)}function xd(t,a){return BigInt(t)>BigInt(a)}function Sd(t,a){return BigInt(t)<=BigInt(a)}function qd(t,a){return BigInt(t)>=BigInt(a)}function ec(t,a){return BigInt(t)&BigInt(a)}function Pd(t,a){return BigInt(t)|BigInt(a)}function Od(t,a){return BigInt(t)^BigInt(a)}function Md(t,a){return BigInt(t)&&BigInt(a)}function zd(t,a){return BigInt(t)||BigInt(a)}function Rd(t){return!BigInt(t)}function ic(t,a,n,e){const c="0000000"+n.toString(16),i=new Uint32Array(t.buffer,a,e/4),r=((c.length-7)*4-1>>5)+1;for(let _=0;_<r;_++)i[_]=parseInt(c.substring(c.length-8*_-8,c.length-8*_),16);for(let _=r;_<i.length;_++)i[_]=0;for(let _=i.length*4;_<e;_++)t[_]=oc(ec(Qo(n,_*8),255))}function Td(t,a,n,e){const c="0000000"+n.toString(16),i=new DataView(t.buffer,t.byteOffset+a,e),r=((c.length-7)*4-1>>5)+1;for(let _=0;_<r;_++)i.setUint32(e-_*4-4,parseInt(c.substring(c.length-8*_-8,c.length-8*_),16),!1);for(let _=0;_<e/4-r;_++)i[_]=0}function kd(t,a,n){n=n||t.byteLength,a=a||0;const e=new Uint32Array(t.buffer,a,n/4),c=new Array(n/4);return e.forEach((i,r)=>c[c.length-r-1]=i.toString(16).padStart(8,"0")),po(c.join(""),16)}function Ud(t,a,n){n=n||t.byteLength,a=a||0;const e=new DataView(t.buffer,t.byteOffset+a,n),c=new Array(n/4);for(let i=0;i<n/4;i++)c[i]=e.getUint32(i*4,!1).toString(16).padStart(8,"0");return po(c.join(""),16)}function Nd(t,a){return t.toString(a)}function Dd(t){const a=new Uint8Array(Math.floor((nc(t)-1)/8)+1);return ic(a,0,t,a.byteLength),a}const Qd=ga(0),$d=ga(1);var Gd=Object.freeze({__proto__:null,abs:Id,add:Ld,band:ec,bitLength:nc,bits:fd,bor:Pd,bxor:Od,div:wd,e:ga,eq:Bd,exp:Cd,fromArray:ld,fromRprBE:Ud,fromRprLE:kd,fromString:po,geq:qd,gt:xd,isNegative:sd,isOdd:ud,isZero:rd,land:Md,leq:Sd,lnot:Rd,lor:zd,lt:Fd,mod:vd,mul:yd,naf:gd,neg:bd,neq:Ed,one:$d,pow:md,shiftLeft:ac,shiftRight:Qo,shl:dd,shr:_d,square:Ad,sub:pd,toArray:hd,toLEBuff:Dd,toNumber:oc,toRprBE:Td,toRprLE:ic,toString:Nd,zero:Qd}),Ua={},Zd=Object.freeze({__proto__:null,default:Ua}),Na={},Da={},cc;function Qa(){return cc||(cc=1,Da.bigInt2BytesLE=function(a,n){const e=Array(n);let c=BigInt(a);for(let i=0;i<n;i++)e[i]=Number(c&0xFFn),c=c>>8n;return e},Da.bigInt2U32LE=function(a,n){const e=Array(n);let c=BigInt(a);for(let i=0;i<n;i++)e[i]=Number(c&0xFFFFFFFFn),c=c>>32n;return e},Da.isOcamNum=function(t){return!(!Array.isArray(t)||t.length!=3||typeof t[0]!="number"||typeof t[1]!="number"||!Array.isArray(t[2]))}),Da}var $o,lc;function jd(){return lc||(lc=1,$o=function(a,n,e){const c=e||"int";if(a.modules[c])return c;a.modules[c]={};const i=n*2,r=n*8;function _(){const M=a.addFunction(c+"_copy");M.addParam("px","i32"),M.addParam("pr","i32");const h=M.getCodeBuilder();for(let y=0;y<n;y++)M.addCode(h.i64_store(h.getLocal("pr"),y*8,h.i64_load(h.getLocal("px"),y*8)))}function u(){const M=a.addFunction(c+"_zero");M.addParam("pr","i32");const h=M.getCodeBuilder();for(let y=0;y<n;y++)M.addCode(h.i64_store(h.getLocal("pr"),y*8,h.i64_const(0)))}function l(){const M=a.addFunction(c+"_one");M.addParam("pr","i32");const h=M.getCodeBuilder();M.addCode(h.i64_store(h.getLocal("pr"),0,h.i64_const(1)));for(let y=1;y<n;y++)M.addCode(h.i64_store(h.getLocal("pr"),y*8,h.i64_const(0)))}function s(){const M=a.addFunction(c+"_isZero");M.addParam("px","i32"),M.setReturnType("i32");const h=M.getCodeBuilder();function y(q){return q==0?h.ret(h.i64_eqz(h.i64_load(h.getLocal("px")))):h.if(h.i64_eqz(h.i64_load(h.getLocal("px"),q*8)),y(q-1),h.ret(h.i32_const(0)))}M.addCode(y(n-1)),M.addCode(h.ret(h.i32_const(0)))}function I(){const M=a.addFunction(c+"_eq");M.addParam("px","i32"),M.addParam("py","i32"),M.setReturnType("i32");const h=M.getCodeBuilder();function y(q){return q==0?h.ret(h.i64_eq(h.i64_load(h.getLocal("px")),h.i64_load(h.getLocal("py")))):h.if(h.i64_eq(h.i64_load(h.getLocal("px"),q*8),h.i64_load(h.getLocal("py"),q*8)),y(q-1),h.ret(h.i32_const(0)))}M.addCode(y(n-1)),M.addCode(h.ret(h.i32_const(0)))}function b(){const M=a.addFunction(c+"_gte");M.addParam("px","i32"),M.addParam("py","i32"),M.setReturnType("i32");const h=M.getCodeBuilder();function y(q){return q==0?h.ret(h.i64_ge_u(h.i64_load(h.getLocal("px")),h.i64_load(h.getLocal("py")))):h.if(h.i64_lt_u(h.i64_load(h.getLocal("px"),q*8),h.i64_load(h.getLocal("py"),q*8)),h.ret(h.i32_const(0)),h.if(h.i64_gt_u(h.i64_load(h.getLocal("px"),q*8),h.i64_load(h.getLocal("py"),q*8)),h.ret(h.i32_const(1)),y(q-1)))}M.addCode(y(n-1)),M.addCode(h.ret(h.i32_const(0)))}function f(){const M=a.addFunction(c+"_add");M.addParam("x","i32"),M.addParam("y","i32"),M.addParam("r","i32"),M.setReturnType("i32"),M.addLocal("c","i64");const h=M.getCodeBuilder();M.addCode(h.setLocal("c",h.i64_add(h.i64_load32_u(h.getLocal("x")),h.i64_load32_u(h.getLocal("y"))))),M.addCode(h.i64_store32(h.getLocal("r"),h.getLocal("c")));for(let y=1;y<i;y++)M.addCode(h.setLocal("c",h.i64_add(h.i64_add(h.i64_load32_u(h.getLocal("x"),4*y),h.i64_load32_u(h.getLocal("y"),4*y)),h.i64_shr_u(h.getLocal("c"),h.i64_const(32))))),M.addCode(h.i64_store32(h.getLocal("r"),y*4,h.getLocal("c")));M.addCode(h.i32_wrap_i64(h.i64_shr_u(h.getLocal("c"),h.i64_const(32))))}function w(){const M=a.addFunction(c+"_sub");M.addParam("x","i32"),M.addParam("y","i32"),M.addParam("r","i32"),M.setReturnType("i32"),M.addLocal("c","i64");const h=M.getCodeBuilder();M.addCode(h.setLocal("c",h.i64_sub(h.i64_load32_u(h.getLocal("x")),h.i64_load32_u(h.getLocal("y"))))),M.addCode(h.i64_store32(h.getLocal("r"),h.i64_and(h.getLocal("c"),h.i64_const("0xFFFFFFFF"))));for(let y=1;y<i;y++)M.addCode(h.setLocal("c",h.i64_add(h.i64_sub(h.i64_load32_u(h.getLocal("x"),4*y),h.i64_load32_u(h.getLocal("y"),4*y)),h.i64_shr_s(h.getLocal("c"),h.i64_const(32))))),M.addCode(h.i64_store32(h.getLocal("r"),y*4,h.i64_and(h.getLocal("c"),h.i64_const("0xFFFFFFFF"))));M.addCode(h.i32_wrap_i64(h.i64_shr_s(h.getLocal("c"),h.i64_const(32))))}function O(){const M=a.addFunction(c+"_mul");M.addParam("x","i32"),M.addParam("y","i32"),M.addParam("r","i32"),M.addLocal("c0","i64"),M.addLocal("c1","i64");for(let T=0;T<i;T++)M.addLocal("x"+T,"i64"),M.addLocal("y"+T,"i64");const h=M.getCodeBuilder(),y=[],q=[];function g(T,N){let P,v;return y[T]?P=h.getLocal("x"+T):(P=h.teeLocal("x"+T,h.i64_load32_u(h.getLocal("x"),T*4)),y[T]=!0),q[N]?v=h.getLocal("y"+N):(v=h.teeLocal("y"+N,h.i64_load32_u(h.getLocal("y"),N*4)),q[N]=!0),h.i64_mul(P,v)}let x="c0",H="c1";for(let T=0;T<i*2-1;T++){for(let N=Math.max(0,T-i+1);N<=T&&N<i;N++){const P=T-N;M.addCode(h.setLocal(x,h.i64_add(h.i64_and(h.getLocal(x),h.i64_const(4294967295)),g(N,P)))),M.addCode(h.setLocal(H,h.i64_add(h.getLocal(H),h.i64_shr_u(h.getLocal(x),h.i64_const(32)))))}M.addCode(h.i64_store32(h.getLocal("r"),T*4,h.getLocal(x))),[x,H]=[H,x],M.addCode(h.setLocal(H,h.i64_shr_u(h.getLocal(x),h.i64_const(32))))}M.addCode(h.i64_store32(h.getLocal("r"),i*4*2-4,h.getLocal(x)))}function D(){const M=a.addFunction(c+"_square");M.addParam("x","i32"),M.addParam("r","i32"),M.addLocal("c0","i64"),M.addLocal("c1","i64"),M.addLocal("c0_old","i64"),M.addLocal("c1_old","i64");for(let N=0;N<i;N++)M.addLocal("x"+N,"i64");const h=M.getCodeBuilder(),y=[];function q(N,P){let v,S;return y[N]?v=h.getLocal("x"+N):(v=h.teeLocal("x"+N,h.i64_load32_u(h.getLocal("x"),N*4)),y[N]=!0),y[P]?S=h.getLocal("x"+P):(S=h.teeLocal("x"+P,h.i64_load32_u(h.getLocal("x"),P*4)),y[P]=!0),h.i64_mul(v,S)}let g="c0",x="c1",H="c0_old",T="c1_old";for(let N=0;N<i*2-1;N++){M.addCode(h.setLocal(g,h.i64_const(0)),h.setLocal(x,h.i64_const(0)));for(let P=Math.max(0,N-i+1);P<N+1>>1&&P<i;P++){const v=N-P;M.addCode(h.setLocal(g,h.i64_add(h.i64_and(h.getLocal(g),h.i64_const(4294967295)),q(P,v)))),M.addCode(h.setLocal(x,h.i64_add(h.getLocal(x),h.i64_shr_u(h.getLocal(g),h.i64_const(32)))))}M.addCode(h.setLocal(g,h.i64_shl(h.i64_and(h.getLocal(g),h.i64_const(4294967295)),h.i64_const(1)))),M.addCode(h.setLocal(x,h.i64_add(h.i64_shl(h.getLocal(x),h.i64_const(1)),h.i64_shr_u(h.getLocal(g),h.i64_const(32))))),N%2==0&&(M.addCode(h.setLocal(g,h.i64_add(h.i64_and(h.getLocal(g),h.i64_const(4294967295)),q(N>>1,N>>1)))),M.addCode(h.setLocal(x,h.i64_add(h.getLocal(x),h.i64_shr_u(h.getLocal(g),h.i64_const(32)))))),N>0&&(M.addCode(h.setLocal(g,h.i64_add(h.i64_and(h.getLocal(g),h.i64_const(4294967295)),h.i64_and(h.getLocal(H),h.i64_const(4294967295))))),M.addCode(h.setLocal(x,h.i64_add(h.i64_add(h.getLocal(x),h.i64_shr_u(h.getLocal(g),h.i64_const(32))),h.getLocal(T))))),M.addCode(h.i64_store32(h.getLocal("r"),N*4,h.getLocal(g))),M.addCode(h.setLocal(H,h.getLocal(x)),h.setLocal(T,h.i64_shr_u(h.getLocal(H),h.i64_const(32))))}M.addCode(h.i64_store32(h.getLocal("r"),i*4*2-4,h.getLocal(H)))}function G(){const M=a.addFunction(c+"_squareOld");M.addParam("x","i32"),M.addParam("r","i32");const h=M.getCodeBuilder();M.addCode(h.call(c+"_mul",h.getLocal("x"),h.getLocal("x"),h.getLocal("r")))}function V(){const M=a.addFunction(c+"__mul1");M.addParam("px","i32"),M.addParam("y","i64"),M.addParam("pr","i32"),M.addLocal("c","i64");const h=M.getCodeBuilder();M.addCode(h.setLocal("c",h.i64_mul(h.i64_load32_u(h.getLocal("px"),0,0),h.getLocal("y")))),M.addCode(h.i64_store32(h.getLocal("pr"),0,0,h.getLocal("c")));for(let y=1;y<i;y++)M.addCode(h.setLocal("c",h.i64_add(h.i64_mul(h.i64_load32_u(h.getLocal("px"),4*y,0),h.getLocal("y")),h.i64_shr_u(h.getLocal("c"),h.i64_const(32))))),M.addCode(h.i64_store32(h.getLocal("pr"),y*4,0,h.getLocal("c")))}function it(){const M=a.addFunction(c+"__add1");M.addParam("x","i32"),M.addParam("y","i64"),M.addLocal("c","i64"),M.addLocal("px","i32");const h=M.getCodeBuilder();M.addCode(h.setLocal("px",h.getLocal("x"))),M.addCode(h.setLocal("c",h.i64_add(h.i64_load32_u(h.getLocal("px"),0,0),h.getLocal("y")))),M.addCode(h.i64_store32(h.getLocal("px"),0,0,h.getLocal("c"))),M.addCode(h.setLocal("c",h.i64_shr_u(h.getLocal("c"),h.i64_const(32)))),M.addCode(h.block(h.loop(h.br_if(1,h.i64_eqz(h.getLocal("c"))),h.setLocal("px",h.i32_add(h.getLocal("px"),h.i32_const(4))),h.setLocal("c",h.i64_add(h.i64_load32_u(h.getLocal("px"),0,0),h.getLocal("c"))),h.i64_store32(h.getLocal("px"),0,0,h.getLocal("c")),h.setLocal("c",h.i64_shr_u(h.getLocal("c"),h.i64_const(32))),h.br(0))))}function Z(){V(),it();const M=a.addFunction(c+"_div");M.addParam("x","i32"),M.addParam("y","i32"),M.addParam("c","i32"),M.addParam("r","i32"),M.addLocal("rr","i32"),M.addLocal("cc","i32"),M.addLocal("eX","i32"),M.addLocal("eY","i32"),M.addLocal("sy","i64"),M.addLocal("sx","i64"),M.addLocal("ec","i32");const h=M.getCodeBuilder(),y=h.i32_const(a.alloc(r)),q=h.i32_const(a.alloc(r)),g=h.i32_const(a.alloc(r)),x=h.getLocal("cc"),H=h.getLocal("rr"),T=a.alloc(r*2),N=h.i32_const(T),P=h.i32_const(T+r);M.addCode(h.if(h.getLocal("c"),h.setLocal("cc",h.getLocal("c")),h.setLocal("cc",q))),M.addCode(h.if(h.getLocal("r"),h.setLocal("rr",h.getLocal("r")),h.setLocal("rr",g))),M.addCode(h.call(c+"_copy",h.getLocal("x"),H)),M.addCode(h.call(c+"_copy",h.getLocal("y"),y)),M.addCode(h.call(c+"_zero",x)),M.addCode(h.call(c+"_zero",N)),M.addCode(h.setLocal("eX",h.i32_const(r-1))),M.addCode(h.setLocal("eY",h.i32_const(r-1))),M.addCode(h.block(h.loop(h.br_if(1,h.i32_or(h.i32_load8_u(h.i32_add(y,h.getLocal("eY")),0,0),h.i32_eq(h.getLocal("eY"),h.i32_const(3)))),h.setLocal("eY",h.i32_sub(h.getLocal("eY"),h.i32_const(1))),h.br(0)))),M.addCode(h.setLocal("sy",h.i64_add(h.i64_load32_u(h.i32_sub(h.i32_add(y,h.getLocal("eY")),h.i32_const(3)),0,0),h.i64_const(1)))),M.addCode(h.if(h.i64_eq(h.getLocal("sy"),h.i64_const(1)),h.drop(h.i64_div_u(h.i64_const(0),h.i64_const(0))))),M.addCode(h.block(h.loop(h.block(h.loop(h.br_if(1,h.i32_or(h.i32_load8_u(h.i32_add(H,h.getLocal("eX")),0,0),h.i32_eq(h.getLocal("eX"),h.i32_const(7)))),h.setLocal("eX",h.i32_sub(h.getLocal("eX"),h.i32_const(1))),h.br(0))),h.setLocal("sx",h.i64_load(h.i32_sub(h.i32_add(H,h.getLocal("eX")),h.i32_const(7)),0,0)),h.setLocal("sx",h.i64_div_u(h.getLocal("sx"),h.getLocal("sy"))),h.setLocal("ec",h.i32_sub(h.i32_sub(h.getLocal("eX"),h.getLocal("eY")),h.i32_const(4))),h.block(h.loop(h.br_if(1,h.i32_and(h.i64_eqz(h.i64_and(h.getLocal("sx"),h.i64_const("0xFFFFFFFF00000000"))),h.i32_ge_s(h.getLocal("ec"),h.i32_const(0)))),h.setLocal("sx",h.i64_shr_u(h.getLocal("sx"),h.i64_const(8))),h.setLocal("ec",h.i32_add(h.getLocal("ec"),h.i32_const(1))),h.br(0))),h.if(h.i64_eqz(h.getLocal("sx")),[...h.br_if(2,h.i32_eqz(h.call(c+"_gte",H,y))),...h.setLocal("sx",h.i64_const(1)),...h.setLocal("ec",h.i32_const(0))]),h.call(c+"__mul1",y,h.getLocal("sx"),P),h.drop(h.call(c+"_sub",H,h.i32_sub(P,h.getLocal("ec")),H)),h.call(c+"__add1",h.i32_add(x,h.getLocal("ec")),h.getLocal("sx")),h.br(0))))}function E(){const M=a.addFunction(c+"_inverseMod");M.addParam("px","i32"),M.addParam("pm","i32"),M.addParam("pr","i32"),M.addLocal("t","i32"),M.addLocal("newt","i32"),M.addLocal("r","i32"),M.addLocal("qq","i32"),M.addLocal("qr","i32"),M.addLocal("newr","i32"),M.addLocal("swp","i32"),M.addLocal("x","i32"),M.addLocal("signt","i32"),M.addLocal("signnewt","i32"),M.addLocal("signx","i32");const h=M.getCodeBuilder(),y=h.i32_const(a.alloc(r)),q=h.i32_const(a.alloc(r)),g=h.i32_const(a.alloc(r)),x=h.i32_const(a.alloc(r)),H=h.i32_const(a.alloc(r)),T=h.i32_const(a.alloc(r)),N=h.i32_const(a.alloc(r*2)),P=h.i32_const(a.alloc(r));M.addCode(h.setLocal("t",y),h.call(c+"_zero",y),h.setLocal("signt",h.i32_const(0))),M.addCode(h.setLocal("r",q),h.call(c+"_copy",h.getLocal("pm"),q)),M.addCode(h.setLocal("newt",g),h.call(c+"_one",g),h.setLocal("signnewt",h.i32_const(0))),M.addCode(h.setLocal("newr",x),h.call(c+"_copy",h.getLocal("px"),x)),M.addCode(h.setLocal("qq",H)),M.addCode(h.setLocal("qr",T)),M.addCode(h.setLocal("x",P)),M.addCode(h.block(h.loop(h.br_if(1,h.call(c+"_isZero",h.getLocal("newr"))),h.call(c+"_div",h.getLocal("r"),h.getLocal("newr"),h.getLocal("qq"),h.getLocal("qr")),h.call(c+"_mul",h.getLocal("qq"),h.getLocal("newt"),N),h.if(h.getLocal("signt"),h.if(h.getLocal("signnewt"),h.if(h.call(c+"_gte",N,h.getLocal("t")),[...h.drop(h.call(c+"_sub",N,h.getLocal("t"),h.getLocal("x"))),...h.setLocal("signx",h.i32_const(0))],[...h.drop(h.call(c+"_sub",h.getLocal("t"),N,h.getLocal("x"))),...h.setLocal("signx",h.i32_const(1))]),[...h.drop(h.call(c+"_add",N,h.getLocal("t"),h.getLocal("x"))),...h.setLocal("signx",h.i32_const(1))]),h.if(h.getLocal("signnewt"),[...h.drop(h.call(c+"_add",N,h.getLocal("t"),h.getLocal("x"))),...h.setLocal("signx",h.i32_const(0))],h.if(h.call(c+"_gte",h.getLocal("t"),N),[...h.drop(h.call(c+"_sub",h.getLocal("t"),N,h.getLocal("x"))),...h.setLocal("signx",h.i32_const(0))],[...h.drop(h.call(c+"_sub",N,h.getLocal("t"),h.getLocal("x"))),...h.setLocal("signx",h.i32_const(1))]))),h.setLocal("swp",h.getLocal("t")),h.setLocal("t",h.getLocal("newt")),h.setLocal("newt",h.getLocal("x")),h.setLocal("x",h.getLocal("swp")),h.setLocal("signt",h.getLocal("signnewt")),h.setLocal("signnewt",h.getLocal("signx")),h.setLocal("swp",h.getLocal("r")),h.setLocal("r",h.getLocal("newr")),h.setLocal("newr",h.getLocal("qr")),h.setLocal("qr",h.getLocal("swp")),h.br(0)))),M.addCode(h.if(h.getLocal("signt"),h.drop(h.call(c+"_sub",h.getLocal("pm"),h.getLocal("t"),h.getLocal("pr"))),h.call(c+"_copy",h.getLocal("t"),h.getLocal("pr"))))}return _(),u(),s(),l(),I(),b(),f(),w(),O(),D(),G(),Z(),E(),a.exportFunction(c+"_copy"),a.exportFunction(c+"_zero"),a.exportFunction(c+"_one"),a.exportFunction(c+"_isZero"),a.exportFunction(c+"_eq"),a.exportFunction(c+"_gte"),a.exportFunction(c+"_add"),a.exportFunction(c+"_sub"),a.exportFunction(c+"_mul"),a.exportFunction(c+"_square"),a.exportFunction(c+"_squareOld"),a.exportFunction(c+"_div"),a.exportFunction(c+"_inverseMod"),c}),$o}var Go,sc;function Zo(){return sc||(sc=1,Go=function(a,n,e,c,i,r,_){const u=a.addFunction(n);u.addParam("base","i32"),u.addParam("scalar","i32"),u.addParam("scalarLength","i32"),u.addParam("r","i32"),u.addLocal("i","i32"),u.addLocal("b","i32");const l=u.getCodeBuilder(),s=l.i32_const(a.alloc(e));u.addCode(l.if(l.i32_eqz(l.getLocal("scalarLength")),[...l.call(_,l.getLocal("r")),...l.ret([])])),u.addCode(l.call(r,l.getLocal("base"),s)),u.addCode(l.call(_,l.getLocal("r"))),u.addCode(l.setLocal("i",l.getLocal("scalarLength"))),u.addCode(l.block(l.loop(l.setLocal("i",l.i32_sub(l.getLocal("i"),l.i32_const(1))),l.setLocal("b",l.i32_load8_u(l.i32_add(l.getLocal("scalar"),l.getLocal("i")))),...I(),l.br_if(1,l.i32_eqz(l.getLocal("i"))),l.br(0))));function I(){const b=[];for(let f=0;f<8;f++)b.push(...l.call(i,l.getLocal("r"),l.getLocal("r")),...l.if(l.i32_ge_u(l.getLocal("b"),l.i32_const(128>>f)),[...l.setLocal("b",l.i32_sub(l.getLocal("b"),l.i32_const(128>>f))),...l.call(c,l.getLocal("r"),s,l.getLocal("r"))]));return b}}),Go}var jo,rc;function Ko(){if(rc)return jo;rc=1,jo=t;function t(a,n){const e=a.modules[n].n64*8,c=a.addFunction(n+"_batchInverse");c.addParam("pIn","i32"),c.addParam("inStep","i32"),c.addParam("n","i32"),c.addParam("pOut","i32"),c.addParam("outStep","i32"),c.addLocal("itAux","i32"),c.addLocal("itIn","i32"),c.addLocal("itOut","i32"),c.addLocal("i","i32");const i=c.getCodeBuilder(),r=i.i32_const(a.alloc(e));c.addCode(i.setLocal("itAux",i.i32_load(i.i32_const(0))),i.i32_store(i.i32_const(0),i.i32_add(i.getLocal("itAux"),i.i32_mul(i.i32_add(i.getLocal("n"),i.i32_const(1)),i.i32_const(e))))),c.addCode(i.call(n+"_one",i.getLocal("itAux")),i.setLocal("itIn",i.getLocal("pIn")),i.setLocal("itAux",i.i32_add(i.getLocal("itAux"),i.i32_const(e))),i.setLocal("i",i.i32_const(0)),i.block(i.loop(i.br_if(1,i.i32_eq(i.getLocal("i"),i.getLocal("n"))),i.if(i.call(n+"_isZero",i.getLocal("itIn")),i.call(n+"_copy",i.i32_sub(i.getLocal("itAux"),i.i32_const(e)),i.getLocal("itAux")),i.call(n+"_mul",i.getLocal("itIn"),i.i32_sub(i.getLocal("itAux"),i.i32_const(e)),i.getLocal("itAux"))),i.setLocal("itIn",i.i32_add(i.getLocal("itIn"),i.getLocal("inStep"))),i.setLocal("itAux",i.i32_add(i.getLocal("itAux"),i.i32_const(e))),i.setLocal("i",i.i32_add(i.getLocal("i"),i.i32_const(1))),i.br(0))),i.setLocal("itIn",i.i32_sub(i.getLocal("itIn"),i.getLocal("inStep"))),i.setLocal("itAux",i.i32_sub(i.getLocal("itAux"),i.i32_const(e))),i.setLocal("itOut",i.i32_add(i.getLocal("pOut"),i.i32_mul(i.i32_sub(i.getLocal("n"),i.i32_const(1)),i.getLocal("outStep")))),i.call(n+"_inverse",i.getLocal("itAux"),i.getLocal("itAux")),i.block(i.loop(i.br_if(1,i.i32_eqz(i.getLocal("i"))),i.if(i.call(n+"_isZero",i.getLocal("itIn")),[...i.call(n+"_copy",i.getLocal("itAux"),i.i32_sub(i.getLocal("itAux"),i.i32_const(e))),...i.call(n+"_zero",i.getLocal("itOut"))],[...i.call(n+"_copy",i.i32_sub(i.getLocal("itAux"),i.i32_const(e)),r),...i.call(n+"_mul",i.getLocal("itAux"),i.getLocal("itIn"),i.i32_sub(i.getLocal("itAux"),i.i32_const(e))),...i.call(n+"_mul",i.getLocal("itAux"),r,i.getLocal("itOut"))]),i.setLocal("itIn",i.i32_sub(i.getLocal("itIn"),i.getLocal("inStep"))),i.setLocal("itOut",i.i32_sub(i.getLocal("itOut"),i.getLocal("outStep"))),i.setLocal("itAux",i.i32_sub(i.getLocal("itAux"),i.i32_const(e))),i.setLocal("i",i.i32_sub(i.getLocal("i"),i.i32_const(1))),i.br(0)))),c.addCode(i.i32_store(i.i32_const(0),i.getLocal("itAux")))}return jo}var Ho,dc;function _c(){if(dc)return Ho;dc=1,Ho=t;function t(a,n,e,c,i,r){typeof r>"u"&&(c<i?r=!0:r=!1);const _=a.addFunction(n);_.addParam("pIn","i32"),_.addParam("n","i32"),_.addParam("pOut","i32"),_.addLocal("i","i32"),_.addLocal("itIn","i32"),_.addLocal("itOut","i32");const u=_.getCodeBuilder();r?_.addCode(u.setLocal("itIn",u.i32_add(u.getLocal("pIn"),u.i32_mul(u.i32_sub(u.getLocal("n"),u.i32_const(1)),u.i32_const(c)))),u.setLocal("itOut",u.i32_add(u.getLocal("pOut"),u.i32_mul(u.i32_sub(u.getLocal("n"),u.i32_const(1)),u.i32_const(i)))),u.setLocal("i",u.i32_const(0)),u.block(u.loop(u.br_if(1,u.i32_eq(u.getLocal("i"),u.getLocal("n"))),u.call(e,u.getLocal("itIn"),u.getLocal("itOut")),u.setLocal("itIn",u.i32_sub(u.getLocal("itIn"),u.i32_const(c))),u.setLocal("itOut",u.i32_sub(u.getLocal("itOut"),u.i32_const(i))),u.setLocal("i",u.i32_add(u.getLocal("i"),u.i32_const(1))),u.br(0)))):_.addCode(u.setLocal("itIn",u.getLocal("pIn")),u.setLocal("itOut",u.getLocal("pOut")),u.setLocal("i",u.i32_const(0)),u.block(u.loop(u.br_if(1,u.i32_eq(u.getLocal("i"),u.getLocal("n"))),u.call(e,u.getLocal("itIn"),u.getLocal("itOut")),u.setLocal("itIn",u.i32_add(u.getLocal("itIn"),u.i32_const(c))),u.setLocal("itOut",u.i32_add(u.getLocal("itOut"),u.i32_const(i))),u.setLocal("i",u.i32_add(u.getLocal("i"),u.i32_const(1))),u.br(0))))}return Ho}var Vo,uc;function Kd(){if(uc)return Vo;uc=1,Vo=t;function t(a,n,e,c,i,r){typeof r>"u"&&(c<i?r=!0:r=!1);const _=a.addFunction(n);_.addParam("pIn1","i32"),_.addParam("pIn2","i32"),_.addParam("n","i32"),_.addParam("pOut","i32"),_.addLocal("i","i32"),_.addLocal("itIn1","i32"),_.addLocal("itIn2","i32"),_.addLocal("itOut","i32");const u=_.getCodeBuilder();r?_.addCode(u.setLocal("itIn1",u.i32_add(u.getLocal("pIn1"),u.i32_mul(u.i32_sub(u.getLocal("n"),u.i32_const(1)),u.i32_const(c)))),u.setLocal("itIn2",u.i32_add(u.getLocal("pIn2"),u.i32_mul(u.i32_sub(u.getLocal("n"),u.i32_const(1)),u.i32_const(c)))),u.setLocal("itOut",u.i32_add(u.getLocal("pOut"),u.i32_mul(u.i32_sub(u.getLocal("n"),u.i32_const(1)),u.i32_const(i)))),u.setLocal("i",u.i32_const(0)),u.block(u.loop(u.br_if(1,u.i32_eq(u.getLocal("i"),u.getLocal("n"))),u.call(e,u.getLocal("itIn1"),u.getLocal("itIn2"),u.getLocal("itOut")),u.setLocal("itIn1",u.i32_sub(u.getLocal("itIn1"),u.i32_const(c))),u.setLocal("itIn2",u.i32_sub(u.getLocal("itIn2"),u.i32_const(c))),u.setLocal("itOut",u.i32_sub(u.getLocal("itOut"),u.i32_const(i))),u.setLocal("i",u.i32_add(u.getLocal("i"),u.i32_const(1))),u.br(0)))):_.addCode(u.setLocal("itIn1",u.getLocal("pIn1")),u.setLocal("itIn2",u.getLocal("pIn2")),u.setLocal("itOut",u.getLocal("pOut")),u.setLocal("i",u.i32_const(0)),u.block(u.loop(u.br_if(1,u.i32_eq(u.getLocal("i"),u.getLocal("n"))),u.call(e,u.getLocal("itIn1"),u.getLocal("itIn2"),u.getLocal("itOut")),u.setLocal("itIn1",u.i32_add(u.getLocal("itIn1"),u.i32_const(c))),u.setLocal("itIn2",u.i32_add(u.getLocal("itIn2"),u.i32_const(c))),u.setLocal("itOut",u.i32_add(u.getLocal("itOut"),u.i32_const(i))),u.setLocal("i",u.i32_add(u.getLocal("i"),u.i32_const(1))),u.br(0))))}return Vo}var Tn={},gc;function $a(){if(gc)return Tn;gc=1;function t(G,V){return G===V?0:G>V?1:-1}function a(G){return G*G}function n(G){return G%2n!==0n}function e(G){return G%2n===0n}function c(G){return G<0n}function i(G){return G>0n}function r(G){return c(G)?G.toString(2).length-1:G.toString(2).length}function _(G){return G<0n?-G:G}function u(G){return _(G)===1n}function l(G,V){for(var it=0n,Z=1n,E=V,M=_(G),h,y,q;M!==0n;)h=E/M,y=it,q=E,it=Z,E=M,Z=y-h*Z,M=q-h*M;if(!u(E))throw new Error(G.toString()+" and "+V.toString()+" are not co-prime");return t(it,0n)===-1&&(it=it+V),c(G)?-it:it}function s(G,V,it){if(it===0n)throw new Error("Cannot take modPow with modulus 0");var Z=1n,E=G%it;for(c(V)&&(V=V*-1n,E=l(E,it));i(V);){if(E===0n)return 0n;n(V)&&(Z=Z*E%it),V=V/2n,E=a(E)%it}return Z}function I(G,V){return G=G>=0n?G:-G,V=V>=0n?V:-V,G===V?0:G>V?1:-1}function b(G,V){return V===0n?!1:u(V)?!0:I(V,2n)===0?e(G):G%V===0n}function f(G){var V=_(G);if(u(V))return!1;if(V===2n||V===3n||V===5n)return!0;if(e(V)||b(V,3n)||b(V,5n))return!1;if(V<49n)return!0}function w(G){return G-1n}function O(G,V){for(var it=w(G),Z=it,E=0,M,h,y;e(Z);)Z=Z/2n,E++;t:for(h=0;h<V.length;h++)if(!(G<V[h])&&(y=s(BigInt(V[h]),Z,G),!(u(y)||y===it))){for(M=E-1;M!=0;M--){if(y=a(y)%G,u(y))return!1;if(y===it)continue t}return!1}return!0}function D(G){var V=f(G);if(V!==void 0)return V;var it=_(G),Z=r(it);if(Z<=64)return O(it,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var E=Math.log(2)*Number(Z),M=Math.ceil(E),h=[],y=0;y<M;y++)h.push(BigInt(y+2));return O(it,h)}return Tn.bitLength=r,Tn.isOdd=n,Tn.isNegative=c,Tn.abs=_,Tn.isUnit=u,Tn.compare=t,Tn.modInv=l,Tn.modPow=s,Tn.isPrime=D,Tn.square=a,Tn}var Yo,fc;function bo(){if(fc)return Yo;fc=1;const t=jd(),a=Qa(),n=Zo(),e=Ko(),c=_c(),i=Kd(),{bitLength:r,modInv:_,modPow:u,isPrime:l,isOdd:s,square:I}=$a();return Yo=function(f,w,O,D){const G=BigInt(w),V=Math.floor((r(G-1n)-1)/64)+1,it=V*2,Z=V*8,E=O||"f1m";if(f.modules[E])return E;const M=t(f,V,D),h=f.alloc(Z,a.bigInt2BytesLE(G,Z)),y=f.alloc(a.bigInt2BytesLE(I(1n<<BigInt(V*64))%G,Z)),q=f.alloc(a.bigInt2BytesLE((1n<<BigInt(V*64))%G,Z)),g=f.alloc(a.bigInt2BytesLE(0n,Z)),x=G-1n,H=x>>1n,T=f.alloc(Z,a.bigInt2BytesLE(H,Z)),N=H+1n,P=f.alloc(Z,a.bigInt2BytesLE(N,Z));f.modules[E]={pq:h,pR2:y,n64:V,q:G,pOne:q,pZero:g,pePlusOne:P};function v(){const dt=f.addFunction(E+"_one");dt.addParam("pr","i32");const B=dt.getCodeBuilder();dt.addCode(B.call(M+"_copy",B.i32_const(q),B.getLocal("pr")))}function S(){const dt=f.addFunction(E+"_add");dt.addParam("x","i32"),dt.addParam("y","i32"),dt.addParam("r","i32");const B=dt.getCodeBuilder();dt.addCode(B.if(B.call(M+"_add",B.getLocal("x"),B.getLocal("y"),B.getLocal("r")),B.drop(B.call(M+"_sub",B.getLocal("r"),B.i32_const(h),B.getLocal("r"))),B.if(B.call(M+"_gte",B.getLocal("r"),B.i32_const(h)),B.drop(B.call(M+"_sub",B.getLocal("r"),B.i32_const(h),B.getLocal("r"))))))}function et(){const dt=f.addFunction(E+"_sub");dt.addParam("x","i32"),dt.addParam("y","i32"),dt.addParam("r","i32");const B=dt.getCodeBuilder();dt.addCode(B.if(B.call(M+"_sub",B.getLocal("x"),B.getLocal("y"),B.getLocal("r")),B.drop(B.call(M+"_add",B.getLocal("r"),B.i32_const(h),B.getLocal("r")))))}function _t(){const dt=f.addFunction(E+"_neg");dt.addParam("x","i32"),dt.addParam("r","i32");const B=dt.getCodeBuilder();dt.addCode(B.call(E+"_sub",B.i32_const(g),B.getLocal("x"),B.getLocal("r")))}function mt(){const dt=f.addFunction(E+"_isNegative");dt.addParam("x","i32"),dt.setReturnType("i32");const B=dt.getCodeBuilder(),Lt=B.i32_const(f.alloc(Z));dt.addCode(B.call(E+"_fromMontgomery",B.getLocal("x"),Lt),B.call(M+"_gte",Lt,B.i32_const(P)))}function xt(){const dt=f.addFunction(E+"_sign");dt.addParam("x","i32"),dt.setReturnType("i32");const B=dt.getCodeBuilder(),Lt=B.i32_const(f.alloc(Z));dt.addCode(B.if(B.call(M+"_isZero",B.getLocal("x")),B.ret(B.i32_const(0))),B.call(E+"_fromMontgomery",B.getLocal("x"),Lt),B.if(B.call(M+"_gte",Lt,B.i32_const(P)),B.ret(B.i32_const(-1))),B.ret(B.i32_const(1)))}function Pt(){const dt=f.alloc(it*it*8),B=f.addFunction(E+"_mReduct");B.addParam("t","i32"),B.addParam("r","i32"),B.addLocal("np32","i64"),B.addLocal("c","i64"),B.addLocal("m","i64");const Lt=B.getCodeBuilder(),Gt=Number(0x100000000n-_(G,0x100000000n));B.addCode(Lt.setLocal("np32",Lt.i64_const(Gt)));for(let z=0;z<it;z++){B.addCode(Lt.setLocal("c",Lt.i64_const(0))),B.addCode(Lt.setLocal("m",Lt.i64_and(Lt.i64_mul(Lt.i64_load32_u(Lt.getLocal("t"),z*4),Lt.getLocal("np32")),Lt.i64_const("0xFFFFFFFF"))));for(let $=0;$<it;$++)B.addCode(Lt.setLocal("c",Lt.i64_add(Lt.i64_add(Lt.i64_load32_u(Lt.getLocal("t"),(z+$)*4),Lt.i64_shr_u(Lt.getLocal("c"),Lt.i64_const(32))),Lt.i64_mul(Lt.i64_load32_u(Lt.i32_const(h),$*4),Lt.getLocal("m"))))),B.addCode(Lt.i64_store32(Lt.getLocal("t"),(z+$)*4,Lt.getLocal("c")));B.addCode(Lt.i64_store32(Lt.i32_const(dt),z*4,Lt.i64_shr_u(Lt.getLocal("c"),Lt.i64_const(32))))}B.addCode(Lt.call(E+"_add",Lt.i32_const(dt),Lt.i32_add(Lt.getLocal("t"),Lt.i32_const(it*4)),Lt.getLocal("r")))}function zt(){const dt=f.addFunction(E+"_mul");dt.addParam("x","i32"),dt.addParam("y","i32"),dt.addParam("r","i32"),dt.addLocal("c0","i64"),dt.addLocal("c1","i64"),dt.addLocal("np32","i64");for(let Bt=0;Bt<it;Bt++)dt.addLocal("x"+Bt,"i64"),dt.addLocal("y"+Bt,"i64"),dt.addLocal("m"+Bt,"i64"),dt.addLocal("q"+Bt,"i64");const B=dt.getCodeBuilder(),Lt=Number(0x100000000n-_(G,0x100000000n));dt.addCode(B.setLocal("np32",B.i64_const(Lt)));const Gt=[],z=[],$=[];function X(Bt,pt){let Ot,Ht;return Gt[Bt]?Ot=B.getLocal("x"+Bt):(Ot=B.teeLocal("x"+Bt,B.i64_load32_u(B.getLocal("x"),Bt*4)),Gt[Bt]=!0),z[pt]?Ht=B.getLocal("y"+pt):(Ht=B.teeLocal("y"+pt,B.i64_load32_u(B.getLocal("y"),pt*4)),z[pt]=!0),B.i64_mul(Ot,Ht)}function at(Bt,pt){let Ot,Ht;return $[Bt]?Ot=B.getLocal("q"+Bt):(Ot=B.teeLocal("q"+Bt,B.i64_load32_u(B.i32_const(0),h+Bt*4)),$[Bt]=!0),Ht=B.getLocal("m"+pt),B.i64_mul(Ot,Ht)}let gt="c0",ft="c1";for(let Bt=0;Bt<it*2-1;Bt++){for(let pt=Math.max(0,Bt-it+1);pt<=Bt&&pt<it;pt++){const Ot=Bt-pt;dt.addCode(B.setLocal(gt,B.i64_add(B.i64_and(B.getLocal(gt),B.i64_const(4294967295)),X(pt,Ot)))),dt.addCode(B.setLocal(ft,B.i64_add(B.getLocal(ft),B.i64_shr_u(B.getLocal(gt),B.i64_const(32)))))}for(let pt=Math.max(1,Bt-it+1);pt<=Bt&&pt<it;pt++){const Ot=Bt-pt;dt.addCode(B.setLocal(gt,B.i64_add(B.i64_and(B.getLocal(gt),B.i64_const(4294967295)),at(pt,Ot)))),dt.addCode(B.setLocal(ft,B.i64_add(B.getLocal(ft),B.i64_shr_u(B.getLocal(gt),B.i64_const(32)))))}Bt<it&&(dt.addCode(B.setLocal("m"+Bt,B.i64_and(B.i64_mul(B.i64_and(B.getLocal(gt),B.i64_const(4294967295)),B.getLocal("np32")),B.i64_const("0xFFFFFFFF")))),dt.addCode(B.setLocal(gt,B.i64_add(B.i64_and(B.getLocal(gt),B.i64_const(4294967295)),at(0,Bt)))),dt.addCode(B.setLocal(ft,B.i64_add(B.getLocal(ft),B.i64_shr_u(B.getLocal(gt),B.i64_const(32)))))),Bt>=it&&dt.addCode(B.i64_store32(B.getLocal("r"),(Bt-it)*4,B.getLocal(gt))),[gt,ft]=[ft,gt],dt.addCode(B.setLocal(ft,B.i64_shr_u(B.getLocal(gt),B.i64_const(32))))}dt.addCode(B.i64_store32(B.getLocal("r"),it*4-4,B.getLocal(gt))),dt.addCode(B.if(B.i32_wrap_i64(B.getLocal(ft)),B.drop(B.call(M+"_sub",B.getLocal("r"),B.i32_const(h),B.getLocal("r"))),B.if(B.call(M+"_gte",B.getLocal("r"),B.i32_const(h)),B.drop(B.call(M+"_sub",B.getLocal("r"),B.i32_const(h),B.getLocal("r"))))))}function Rt(){const dt=f.addFunction(E+"_square");dt.addParam("x","i32"),dt.addParam("r","i32"),dt.addLocal("c0","i64"),dt.addLocal("c1","i64"),dt.addLocal("c0_old","i64"),dt.addLocal("c1_old","i64"),dt.addLocal("np32","i64");for(let pt=0;pt<it;pt++)dt.addLocal("x"+pt,"i64"),dt.addLocal("m"+pt,"i64"),dt.addLocal("q"+pt,"i64");const B=dt.getCodeBuilder(),Lt=Number(0x100000000n-_(G,0x100000000n));dt.addCode(B.setLocal("np32",B.i64_const(Lt)));const Gt=[],z=[];function $(pt,Ot){let Ht,on;return Gt[pt]?Ht=B.getLocal("x"+pt):(Ht=B.teeLocal("x"+pt,B.i64_load32_u(B.getLocal("x"),pt*4)),Gt[pt]=!0),Gt[Ot]?on=B.getLocal("x"+Ot):(on=B.teeLocal("x"+Ot,B.i64_load32_u(B.getLocal("x"),Ot*4)),Gt[Ot]=!0),B.i64_mul(Ht,on)}function X(pt,Ot){let Ht,on;return z[pt]?Ht=B.getLocal("q"+pt):(Ht=B.teeLocal("q"+pt,B.i64_load32_u(B.i32_const(0),h+pt*4)),z[pt]=!0),on=B.getLocal("m"+Ot),B.i64_mul(Ht,on)}let at="c0",gt="c1",ft="c0_old",Bt="c1_old";for(let pt=0;pt<it*2-1;pt++){dt.addCode(B.setLocal(at,B.i64_const(0)),B.setLocal(gt,B.i64_const(0)));for(let Ot=Math.max(0,pt-it+1);Ot<pt+1>>1&&Ot<it;Ot++){const Ht=pt-Ot;dt.addCode(B.setLocal(at,B.i64_add(B.i64_and(B.getLocal(at),B.i64_const(4294967295)),$(Ot,Ht)))),dt.addCode(B.setLocal(gt,B.i64_add(B.getLocal(gt),B.i64_shr_u(B.getLocal(at),B.i64_const(32)))))}dt.addCode(B.setLocal(at,B.i64_shl(B.i64_and(B.getLocal(at),B.i64_const(4294967295)),B.i64_const(1)))),dt.addCode(B.setLocal(gt,B.i64_add(B.i64_shl(B.getLocal(gt),B.i64_const(1)),B.i64_shr_u(B.getLocal(at),B.i64_const(32))))),pt%2==0&&(dt.addCode(B.setLocal(at,B.i64_add(B.i64_and(B.getLocal(at),B.i64_const(4294967295)),$(pt>>1,pt>>1)))),dt.addCode(B.setLocal(gt,B.i64_add(B.getLocal(gt),B.i64_shr_u(B.getLocal(at),B.i64_const(32)))))),pt>0&&(dt.addCode(B.setLocal(at,B.i64_add(B.i64_and(B.getLocal(at),B.i64_const(4294967295)),B.i64_and(B.getLocal(ft),B.i64_const(4294967295))))),dt.addCode(B.setLocal(gt,B.i64_add(B.i64_add(B.getLocal(gt),B.i64_shr_u(B.getLocal(at),B.i64_const(32))),B.getLocal(Bt)))));for(let Ot=Math.max(1,pt-it+1);Ot<=pt&&Ot<it;Ot++){const Ht=pt-Ot;dt.addCode(B.setLocal(at,B.i64_add(B.i64_and(B.getLocal(at),B.i64_const(4294967295)),X(Ot,Ht)))),dt.addCode(B.setLocal(gt,B.i64_add(B.getLocal(gt),B.i64_shr_u(B.getLocal(at),B.i64_const(32)))))}pt<it&&(dt.addCode(B.setLocal("m"+pt,B.i64_and(B.i64_mul(B.i64_and(B.getLocal(at),B.i64_const(4294967295)),B.getLocal("np32")),B.i64_const("0xFFFFFFFF")))),dt.addCode(B.setLocal(at,B.i64_add(B.i64_and(B.getLocal(at),B.i64_const(4294967295)),X(0,pt)))),dt.addCode(B.setLocal(gt,B.i64_add(B.getLocal(gt),B.i64_shr_u(B.getLocal(at),B.i64_const(32)))))),pt>=it&&dt.addCode(B.i64_store32(B.getLocal("r"),(pt-it)*4,B.getLocal(at))),dt.addCode(B.setLocal(ft,B.getLocal(gt)),B.setLocal(Bt,B.i64_shr_u(B.getLocal(ft),B.i64_const(32))))}dt.addCode(B.i64_store32(B.getLocal("r"),it*4-4,B.getLocal(ft))),dt.addCode(B.if(B.i32_wrap_i64(B.getLocal(Bt)),B.drop(B.call(M+"_sub",B.getLocal("r"),B.i32_const(h),B.getLocal("r"))),B.if(B.call(M+"_gte",B.getLocal("r"),B.i32_const(h)),B.drop(B.call(M+"_sub",B.getLocal("r"),B.i32_const(h),B.getLocal("r"))))))}function k(){const dt=f.addFunction(E+"_squareOld");dt.addParam("x","i32"),dt.addParam("r","i32");const B=dt.getCodeBuilder();dt.addCode(B.call(E+"_mul",B.getLocal("x"),B.getLocal("x"),B.getLocal("r")))}function Ct(){const dt=f.addFunction(E+"_toMontgomery");dt.addParam("x","i32"),dt.addParam("r","i32");const B=dt.getCodeBuilder();dt.addCode(B.call(E+"_mul",B.getLocal("x"),B.i32_const(y),B.getLocal("r")))}function St(){const dt=f.alloc(Z*2),B=f.addFunction(E+"_fromMontgomery");B.addParam("x","i32"),B.addParam("r","i32");const Lt=B.getCodeBuilder();B.addCode(Lt.call(M+"_copy",Lt.getLocal("x"),Lt.i32_const(dt))),B.addCode(Lt.call(M+"_zero",Lt.i32_const(dt+Z))),B.addCode(Lt.call(E+"_mReduct",Lt.i32_const(dt),Lt.getLocal("r")))}function F(){const dt=f.addFunction(E+"_inverse");dt.addParam("x","i32"),dt.addParam("r","i32");const B=dt.getCodeBuilder();dt.addCode(B.call(E+"_fromMontgomery",B.getLocal("x"),B.getLocal("r"))),dt.addCode(B.call(M+"_inverseMod",B.getLocal("r"),B.i32_const(h),B.getLocal("r"))),dt.addCode(B.call(E+"_toMontgomery",B.getLocal("r"),B.getLocal("r")))}let o=2n;if(l(G))for(;u(o,H,G)!==x;)o=o+1n;let L=0,U=x;for(;!s(U)&&U!==0n;)L++,U=U>>1n;const p=f.alloc(Z,a.bigInt2BytesLE(U,Z)),st=u(o,U,G),qt=f.alloc(a.bigInt2BytesLE((st<<BigInt(V*64))%G,Z)),wt=U+1n>>1n,nt=f.alloc(Z,a.bigInt2BytesLE(wt,Z));function Q(){const dt=f.addFunction(E+"_sqrt");dt.addParam("n","i32"),dt.addParam("r","i32"),dt.addLocal("m","i32"),dt.addLocal("i","i32"),dt.addLocal("j","i32");const B=dt.getCodeBuilder(),Lt=B.i32_const(q),Gt=B.i32_const(f.alloc(Z)),z=B.i32_const(f.alloc(Z)),$=B.i32_const(f.alloc(Z)),X=B.i32_const(f.alloc(Z)),at=B.i32_const(f.alloc(Z));dt.addCode(B.if(B.call(E+"_isZero",B.getLocal("n")),B.ret(B.call(E+"_zero",B.getLocal("r")))),B.setLocal("m",B.i32_const(L)),B.call(E+"_copy",B.i32_const(qt),Gt),B.call(E+"_exp",B.getLocal("n"),B.i32_const(p),B.i32_const(Z),z),B.call(E+"_exp",B.getLocal("n"),B.i32_const(nt),B.i32_const(Z),$),B.block(B.loop(B.br_if(1,B.call(E+"_eq",z,Lt)),B.call(E+"_square",z,X),B.setLocal("i",B.i32_const(1)),B.block(B.loop(B.br_if(1,B.call(E+"_eq",X,Lt)),B.call(E+"_square",X,X),B.setLocal("i",B.i32_add(B.getLocal("i"),B.i32_const(1))),B.br(0))),B.call(E+"_copy",Gt,at),B.setLocal("j",B.i32_sub(B.i32_sub(B.getLocal("m"),B.getLocal("i")),B.i32_const(1))),B.block(B.loop(B.br_if(1,B.i32_eqz(B.getLocal("j"))),B.call(E+"_square",at,at),B.setLocal("j",B.i32_sub(B.getLocal("j"),B.i32_const(1))),B.br(0))),B.setLocal("m",B.getLocal("i")),B.call(E+"_square",at,Gt),B.call(E+"_mul",z,Gt,z),B.call(E+"_mul",$,at,$),B.br(0))),B.if(B.call(E+"_isNegative",$),B.call(E+"_neg",$,B.getLocal("r")),B.call(E+"_copy",$,B.getLocal("r"))))}function A(){const dt=f.addFunction(E+"_isSquare");dt.addParam("n","i32"),dt.setReturnType("i32");const B=dt.getCodeBuilder(),Lt=B.i32_const(q),Gt=B.i32_const(f.alloc(Z));dt.addCode(B.if(B.call(E+"_isZero",B.getLocal("n")),B.ret(B.i32_const(1))),B.call(E+"_exp",B.getLocal("n"),B.i32_const(T),B.i32_const(Z),Gt),B.call(E+"_eq",Gt,Lt))}function lt(){const dt=f.addFunction(E+"_load");dt.addParam("scalar","i32"),dt.addParam("scalarLen","i32"),dt.addParam("r","i32"),dt.addLocal("p","i32"),dt.addLocal("l","i32"),dt.addLocal("i","i32"),dt.addLocal("j","i32");const B=dt.getCodeBuilder(),Lt=B.i32_const(f.alloc(Z)),Gt=f.alloc(Z),z=B.i32_const(Gt);dt.addCode(B.call(M+"_zero",B.getLocal("r")),B.setLocal("i",B.i32_const(Z)),B.setLocal("p",B.getLocal("scalar")),B.block(B.loop(B.br_if(1,B.i32_gt_u(B.getLocal("i"),B.getLocal("scalarLen"))),B.if(B.i32_eq(B.getLocal("i"),B.i32_const(Z)),B.call(E+"_one",Lt),B.call(E+"_mul",Lt,B.i32_const(y),Lt)),B.call(E+"_mul",B.getLocal("p"),Lt,z),B.call(E+"_add",B.getLocal("r"),z,B.getLocal("r")),B.setLocal("p",B.i32_add(B.getLocal("p"),B.i32_const(Z))),B.setLocal("i",B.i32_add(B.getLocal("i"),B.i32_const(Z))),B.br(0))),B.setLocal("l",B.i32_rem_u(B.getLocal("scalarLen"),B.i32_const(Z))),B.if(B.i32_eqz(B.getLocal("l")),B.ret([])),B.call(M+"_zero",z),B.setLocal("j",B.i32_const(0)),B.block(B.loop(B.br_if(1,B.i32_eq(B.getLocal("j"),B.getLocal("l"))),B.i32_store8(B.getLocal("j"),Gt,B.i32_load8_u(B.getLocal("p"))),B.setLocal("p",B.i32_add(B.getLocal("p"),B.i32_const(1))),B.setLocal("j",B.i32_add(B.getLocal("j"),B.i32_const(1))),B.br(0))),B.if(B.i32_eq(B.getLocal("i"),B.i32_const(Z)),B.call(E+"_one",Lt),B.call(E+"_mul",Lt,B.i32_const(y),Lt)),B.call(E+"_mul",z,Lt,z),B.call(E+"_add",B.getLocal("r"),z,B.getLocal("r")))}function Ft(){const dt=f.addFunction(E+"_timesScalar");dt.addParam("x","i32"),dt.addParam("scalar","i32"),dt.addParam("scalarLen","i32"),dt.addParam("r","i32");const B=dt.getCodeBuilder(),Lt=B.i32_const(f.alloc(Z));dt.addCode(B.call(E+"_load",B.getLocal("scalar"),B.getLocal("scalarLen"),Lt),B.call(E+"_toMontgomery",Lt,Lt),B.call(E+"_mul",B.getLocal("x"),Lt,B.getLocal("r")))}function Ut(){const dt=f.addFunction(E+"_isOne");dt.addParam("x","i32"),dt.setReturnType("i32");const B=dt.getCodeBuilder();dt.addCode(B.ret(B.call(M+"_eq",B.getLocal("x"),B.i32_const(q))))}return f.exportFunction(M+"_copy",E+"_copy"),f.exportFunction(M+"_zero",E+"_zero"),f.exportFunction(M+"_isZero",E+"_isZero"),f.exportFunction(M+"_eq",E+"_eq"),Ut(),S(),et(),_t(),Pt(),zt(),Rt(),k(),Ct(),St(),mt(),xt(),F(),v(),lt(),Ft(),e(f,E),c(f,E+"_batchToMontgomery",E+"_toMontgomery",Z,Z),c(f,E+"_batchFromMontgomery",E+"_fromMontgomery",Z,Z),c(f,E+"_batchNeg",E+"_neg",Z,Z),i(f,E+"_batchAdd",E+"_add",Z,Z),i(f,E+"_batchSub",E+"_sub",Z,Z),i(f,E+"_batchMul",E+"_mul",Z,Z),f.exportFunction(E+"_add"),f.exportFunction(E+"_sub"),f.exportFunction(E+"_neg"),f.exportFunction(E+"_isNegative"),f.exportFunction(E+"_isOne"),f.exportFunction(E+"_sign"),f.exportFunction(E+"_mReduct"),f.exportFunction(E+"_mul"),f.exportFunction(E+"_square"),f.exportFunction(E+"_squareOld"),f.exportFunction(E+"_fromMontgomery"),f.exportFunction(E+"_toMontgomery"),f.exportFunction(E+"_inverse"),f.exportFunction(E+"_one"),f.exportFunction(E+"_load"),f.exportFunction(E+"_timesScalar"),n(f,E+"_exp",Z,E+"_mul",E+"_square",M+"_copy",E+"_one"),f.exportFunction(E+"_exp"),f.exportFunction(E+"_batchInverse"),l(G)&&(Q(),A(),f.exportFunction(E+"_sqrt"),f.exportFunction(E+"_isSquare")),f.exportFunction(E+"_batchToMontgomery"),f.exportFunction(E+"_batchFromMontgomery"),E},Yo}var Xo,hc;function Lc(){if(hc)return Xo;hc=1;const t=bo(),{bitLength:a}=$a();return Xo=function(e,c,i,r,_){const u=BigInt(c),l=Math.floor((a(u-1n)-1)/64)+1,s=l*8,I=i||"f1";if(e.modules[I])return I;e.modules[I]={n64:l};const b=_||"int",f=t(e,u,r,b),w=e.modules[f].pR2,O=e.modules[f].pq,D=e.modules[f].pePlusOne;function G(){const E=e.alloc(s),M=e.addFunction(I+"_mul");M.addParam("x","i32"),M.addParam("y","i32"),M.addParam("r","i32");const h=M.getCodeBuilder();M.addCode(h.call(f+"_mul",h.getLocal("x"),h.getLocal("y"),h.i32_const(E))),M.addCode(h.call(f+"_mul",h.i32_const(E),h.i32_const(w),h.getLocal("r")))}function V(){const E=e.addFunction(I+"_square");E.addParam("x","i32"),E.addParam("r","i32");const M=E.getCodeBuilder();E.addCode(M.call(I+"_mul",M.getLocal("x"),M.getLocal("x"),M.getLocal("r")))}function it(){const E=e.addFunction(I+"_inverse");E.addParam("x","i32"),E.addParam("r","i32");const M=E.getCodeBuilder();E.addCode(M.call(b+"_inverseMod",M.getLocal("x"),M.i32_const(O),M.getLocal("r")))}function Z(){const E=e.addFunction(I+"_isNegative");E.addParam("x","i32"),E.setReturnType("i32");const M=E.getCodeBuilder();E.addCode(M.call(b+"_gte",M.getLocal("x"),M.i32_const(D)))}return G(),V(),it(),Z(),e.exportFunction(f+"_add",I+"_add"),e.exportFunction(f+"_sub",I+"_sub"),e.exportFunction(f+"_neg",I+"_neg"),e.exportFunction(I+"_mul"),e.exportFunction(I+"_square"),e.exportFunction(I+"_inverse"),e.exportFunction(I+"_isNegative"),e.exportFunction(f+"_copy",I+"_copy"),e.exportFunction(f+"_zero",I+"_zero"),e.exportFunction(f+"_one",I+"_one"),e.exportFunction(f+"_isZero",I+"_isZero"),e.exportFunction(f+"_eq",I+"_eq"),I},Xo}var Wo,pc;function bc(){if(pc)return Wo;pc=1;const t=Zo(),a=Ko(),n=Qa();return Wo=function(c,i,r,_){if(c.modules[r])return r;const u=c.modules[_].n64*8,l=c.modules[_].q;c.modules[r]={n64:c.modules[_].n64*2};function s(){const P=c.addFunction(r+"_add");P.addParam("x","i32"),P.addParam("y","i32"),P.addParam("r","i32");const v=P.getCodeBuilder(),S=v.getLocal("x"),et=v.i32_add(v.getLocal("x"),v.i32_const(u)),_t=v.getLocal("y"),mt=v.i32_add(v.getLocal("y"),v.i32_const(u)),xt=v.getLocal("r"),Pt=v.i32_add(v.getLocal("r"),v.i32_const(u));P.addCode(v.call(_+"_add",S,_t,xt),v.call(_+"_add",et,mt,Pt))}function I(){const P=c.addFunction(r+"_timesScalar");P.addParam("x","i32"),P.addParam("scalar","i32"),P.addParam("scalarLen","i32"),P.addParam("r","i32");const v=P.getCodeBuilder(),S=v.getLocal("x"),et=v.i32_add(v.getLocal("x"),v.i32_const(u)),_t=v.getLocal("r"),mt=v.i32_add(v.getLocal("r"),v.i32_const(u));P.addCode(v.call(_+"_timesScalar",S,v.getLocal("scalar"),v.getLocal("scalarLen"),_t),v.call(_+"_timesScalar",et,v.getLocal("scalar"),v.getLocal("scalarLen"),mt))}function b(){const P=c.addFunction(r+"_sub");P.addParam("x","i32"),P.addParam("y","i32"),P.addParam("r","i32");const v=P.getCodeBuilder(),S=v.getLocal("x"),et=v.i32_add(v.getLocal("x"),v.i32_const(u)),_t=v.getLocal("y"),mt=v.i32_add(v.getLocal("y"),v.i32_const(u)),xt=v.getLocal("r"),Pt=v.i32_add(v.getLocal("r"),v.i32_const(u));P.addCode(v.call(_+"_sub",S,_t,xt),v.call(_+"_sub",et,mt,Pt))}function f(){const P=c.addFunction(r+"_neg");P.addParam("x","i32"),P.addParam("r","i32");const v=P.getCodeBuilder(),S=v.getLocal("x"),et=v.i32_add(v.getLocal("x"),v.i32_const(u)),_t=v.getLocal("r"),mt=v.i32_add(v.getLocal("r"),v.i32_const(u));P.addCode(v.call(_+"_neg",S,_t),v.call(_+"_neg",et,mt))}function w(){const P=c.addFunction(r+"_conjugate");P.addParam("x","i32"),P.addParam("r","i32");const v=P.getCodeBuilder(),S=v.getLocal("x"),et=v.i32_add(v.getLocal("x"),v.i32_const(u)),_t=v.getLocal("r"),mt=v.i32_add(v.getLocal("r"),v.i32_const(u));P.addCode(v.call(_+"_copy",S,_t),v.call(_+"_neg",et,mt))}function O(){const P=c.addFunction(r+"_isNegative");P.addParam("x","i32"),P.setReturnType("i32");const v=P.getCodeBuilder(),S=v.getLocal("x"),et=v.i32_add(v.getLocal("x"),v.i32_const(u));P.addCode(v.if(v.call(_+"_isZero",et),v.ret(v.call(_+"_isNegative",S))),v.ret(v.call(_+"_isNegative",et)))}function D(){const P=c.addFunction(r+"_mul");P.addParam("x","i32"),P.addParam("y","i32"),P.addParam("r","i32");const v=P.getCodeBuilder(),S=v.getLocal("x"),et=v.i32_add(v.getLocal("x"),v.i32_const(u)),_t=v.getLocal("y"),mt=v.i32_add(v.getLocal("y"),v.i32_const(u)),xt=v.getLocal("r"),Pt=v.i32_add(v.getLocal("r"),v.i32_const(u)),zt=v.i32_const(c.alloc(u)),Rt=v.i32_const(c.alloc(u)),k=v.i32_const(c.alloc(u)),Ct=v.i32_const(c.alloc(u));P.addCode(v.call(_+"_mul",S,_t,zt),v.call(_+"_mul",et,mt,Rt),v.call(_+"_add",S,et,k),v.call(_+"_add",_t,mt,Ct),v.call(_+"_mul",k,Ct,k),v.call(i,Rt,xt),v.call(_+"_add",zt,xt,xt),v.call(_+"_add",zt,Rt,Pt),v.call(_+"_sub",k,Pt,Pt))}function G(){const P=c.addFunction(r+"_mul1");P.addParam("x","i32"),P.addParam("y","i32"),P.addParam("r","i32");const v=P.getCodeBuilder(),S=v.getLocal("x"),et=v.i32_add(v.getLocal("x"),v.i32_const(u)),_t=v.getLocal("y"),mt=v.getLocal("r"),xt=v.i32_add(v.getLocal("r"),v.i32_const(u));P.addCode(v.call(_+"_mul",S,_t,mt),v.call(_+"_mul",et,_t,xt))}function V(){const P=c.addFunction(r+"_square");P.addParam("x","i32"),P.addParam("r","i32");const v=P.getCodeBuilder(),S=v.getLocal("x"),et=v.i32_add(v.getLocal("x"),v.i32_const(u)),_t=v.getLocal("r"),mt=v.i32_add(v.getLocal("r"),v.i32_const(u)),xt=v.i32_const(c.alloc(u)),Pt=v.i32_const(c.alloc(u)),zt=v.i32_const(c.alloc(u)),Rt=v.i32_const(c.alloc(u));P.addCode(v.call(_+"_mul",S,et,xt),v.call(_+"_add",S,et,Pt),v.call(i,et,zt),v.call(_+"_add",S,zt,zt),v.call(i,xt,Rt),v.call(_+"_add",Rt,xt,Rt),v.call(_+"_mul",Pt,zt,_t),v.call(_+"_sub",_t,Rt,_t),v.call(_+"_add",xt,xt,mt))}function it(){const P=c.addFunction(r+"_toMontgomery");P.addParam("x","i32"),P.addParam("r","i32");const v=P.getCodeBuilder(),S=v.getLocal("x"),et=v.i32_add(v.getLocal("x"),v.i32_const(u)),_t=v.getLocal("r"),mt=v.i32_add(v.getLocal("r"),v.i32_const(u));P.addCode(v.call(_+"_toMontgomery",S,_t),v.call(_+"_toMontgomery",et,mt))}function Z(){const P=c.addFunction(r+"_fromMontgomery");P.addParam("x","i32"),P.addParam("r","i32");const v=P.getCodeBuilder(),S=v.getLocal("x"),et=v.i32_add(v.getLocal("x"),v.i32_const(u)),_t=v.getLocal("r"),mt=v.i32_add(v.getLocal("r"),v.i32_const(u));P.addCode(v.call(_+"_fromMontgomery",S,_t),v.call(_+"_fromMontgomery",et,mt))}function E(){const P=c.addFunction(r+"_copy");P.addParam("x","i32"),P.addParam("r","i32");const v=P.getCodeBuilder(),S=v.getLocal("x"),et=v.i32_add(v.getLocal("x"),v.i32_const(u)),_t=v.getLocal("r"),mt=v.i32_add(v.getLocal("r"),v.i32_const(u));P.addCode(v.call(_+"_copy",S,_t),v.call(_+"_copy",et,mt))}function M(){const P=c.addFunction(r+"_zero");P.addParam("x","i32");const v=P.getCodeBuilder(),S=v.getLocal("x"),et=v.i32_add(v.getLocal("x"),v.i32_const(u));P.addCode(v.call(_+"_zero",S),v.call(_+"_zero",et))}function h(){const P=c.addFunction(r+"_one");P.addParam("x","i32");const v=P.getCodeBuilder(),S=v.getLocal("x"),et=v.i32_add(v.getLocal("x"),v.i32_const(u));P.addCode(v.call(_+"_one",S),v.call(_+"_zero",et))}function y(){const P=c.addFunction(r+"_eq");P.addParam("x","i32"),P.addParam("y","i32"),P.setReturnType("i32");const v=P.getCodeBuilder(),S=v.getLocal("x"),et=v.i32_add(v.getLocal("x"),v.i32_const(u)),_t=v.getLocal("y"),mt=v.i32_add(v.getLocal("y"),v.i32_const(u));P.addCode(v.i32_and(v.call(_+"_eq",S,_t),v.call(_+"_eq",et,mt)))}function q(){const P=c.addFunction(r+"_isZero");P.addParam("x","i32"),P.setReturnType("i32");const v=P.getCodeBuilder(),S=v.getLocal("x"),et=v.i32_add(v.getLocal("x"),v.i32_const(u));P.addCode(v.i32_and(v.call(_+"_isZero",S),v.call(_+"_isZero",et)))}function g(){const P=c.addFunction(r+"_inverse");P.addParam("x","i32"),P.addParam("r","i32");const v=P.getCodeBuilder(),S=v.getLocal("x"),et=v.i32_add(v.getLocal("x"),v.i32_const(u)),_t=v.getLocal("r"),mt=v.i32_add(v.getLocal("r"),v.i32_const(u)),xt=v.i32_const(c.alloc(u)),Pt=v.i32_const(c.alloc(u)),zt=v.i32_const(c.alloc(u)),Rt=v.i32_const(c.alloc(u));P.addCode(v.call(_+"_square",S,xt),v.call(_+"_square",et,Pt),v.call(i,Pt,zt),v.call(_+"_sub",xt,zt,zt),v.call(_+"_inverse",zt,Rt),v.call(_+"_mul",S,Rt,_t),v.call(_+"_mul",et,Rt,mt),v.call(_+"_neg",mt,mt))}function x(){const P=c.addFunction(r+"_sign");P.addParam("x","i32"),P.addLocal("s","i32"),P.setReturnType("i32");const v=P.getCodeBuilder(),S=v.getLocal("x"),et=v.i32_add(v.getLocal("x"),v.i32_const(u));P.addCode(v.setLocal("s",v.call(_+"_sign",et)),v.if(v.getLocal("s"),v.ret(v.getLocal("s"))),v.ret(v.call(_+"_sign",S)))}function H(){const P=c.addFunction(r+"_isOne");P.addParam("x","i32"),P.setReturnType("i32");const v=P.getCodeBuilder(),S=v.getLocal("x"),et=v.i32_add(v.getLocal("x"),v.i32_const(u));P.addCode(v.ret(v.i32_and(v.call(_+"_isOne",S),v.call(_+"_isZero",et))))}function T(){const P=c.addFunction(r+"_sqrt");P.addParam("a","i32"),P.addParam("pr","i32");const v=P.getCodeBuilder(),S=v.i32_const(c.alloc(n.bigInt2BytesLE((BigInt(l||0)-3n)/4n,u))),et=v.i32_const(c.alloc(n.bigInt2BytesLE((BigInt(l||0)-1n)/2n,u))),_t=v.getLocal("a"),mt=v.i32_const(c.alloc(u*2)),xt=v.i32_const(c.alloc(u*2)),Pt=v.i32_const(c.alloc(u*2)),zt=c.alloc(u*2),Rt=v.i32_const(zt),k=v.i32_const(zt),Ct=v.i32_const(zt+u),St=v.i32_const(c.alloc(u*2)),F=v.i32_const(c.alloc(u*2));P.addCode(v.call(r+"_one",Rt),v.call(r+"_neg",Rt,Rt),v.call(r+"_exp",_t,S,v.i32_const(u),mt),v.call(r+"_square",mt,xt),v.call(r+"_mul",_t,xt,xt),v.call(r+"_conjugate",xt,Pt),v.call(r+"_mul",Pt,xt,Pt),v.if(v.call(r+"_eq",Pt,Rt),v.unreachable()),v.call(r+"_mul",mt,_t,St),v.if(v.call(r+"_eq",xt,Rt),[...v.call(_+"_zero",k),...v.call(_+"_one",Ct),...v.call(r+"_mul",Rt,St,v.getLocal("pr"))],[...v.call(r+"_one",F),...v.call(r+"_add",F,xt,F),...v.call(r+"_exp",F,et,v.i32_const(u),F),...v.call(r+"_mul",F,St,v.getLocal("pr"))]))}function N(){const P=c.addFunction(r+"_isSquare");P.addParam("a","i32"),P.setReturnType("i32");const v=P.getCodeBuilder(),S=v.i32_const(c.alloc(n.bigInt2BytesLE((BigInt(l||0)-3n)/4n,u))),et=v.getLocal("a"),_t=v.i32_const(c.alloc(u*2)),mt=v.i32_const(c.alloc(u*2)),xt=v.i32_const(c.alloc(u*2)),Pt=c.alloc(u*2),zt=v.i32_const(Pt);P.addCode(v.call(r+"_one",zt),v.call(r+"_neg",zt,zt),v.call(r+"_exp",et,S,v.i32_const(u),_t),v.call(r+"_square",_t,mt),v.call(r+"_mul",et,mt,mt),v.call(r+"_conjugate",mt,xt),v.call(r+"_mul",xt,mt,xt),v.if(v.call(r+"_eq",xt,zt),v.ret(v.i32_const(0))),v.ret(v.i32_const(1)))}return q(),H(),M(),h(),E(),D(),G(),V(),s(),b(),f(),w(),it(),Z(),y(),g(),I(),x(),O(),c.exportFunction(r+"_isZero"),c.exportFunction(r+"_isOne"),c.exportFunction(r+"_zero"),c.exportFunction(r+"_one"),c.exportFunction(r+"_copy"),c.exportFunction(r+"_mul"),c.exportFunction(r+"_mul1"),c.exportFunction(r+"_square"),c.exportFunction(r+"_add"),c.exportFunction(r+"_sub"),c.exportFunction(r+"_neg"),c.exportFunction(r+"_sign"),c.exportFunction(r+"_conjugate"),c.exportFunction(r+"_fromMontgomery"),c.exportFunction(r+"_toMontgomery"),c.exportFunction(r+"_eq"),c.exportFunction(r+"_inverse"),a(c,r),t(c,r+"_exp",u*2,r+"_mul",r+"_square",r+"_copy",r+"_one"),T(),N(),c.exportFunction(r+"_exp"),c.exportFunction(r+"_timesScalar"),c.exportFunction(r+"_batchInverse"),c.exportFunction(r+"_sqrt"),c.exportFunction(r+"_isSquare"),c.exportFunction(r+"_isNegative"),r},Wo}var Jo,yc;function Ac(){if(yc)return Jo;yc=1;const t=Zo(),a=Ko();return Jo=function(e,c,i,r){if(e.modules[i])return i;const _=e.modules[r].n64*8;e.modules[i]={n64:e.modules[r].n64*3};function u(){const q=e.addFunction(i+"_add");q.addParam("x","i32"),q.addParam("y","i32"),q.addParam("r","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("y"),P=g.i32_add(g.getLocal("y"),g.i32_const(_)),v=g.i32_add(g.getLocal("y"),g.i32_const(2*_)),S=g.getLocal("r"),et=g.i32_add(g.getLocal("r"),g.i32_const(_)),_t=g.i32_add(g.getLocal("r"),g.i32_const(2*_));q.addCode(g.call(r+"_add",x,N,S),g.call(r+"_add",H,P,et),g.call(r+"_add",T,v,_t))}function l(){const q=e.addFunction(i+"_timesScalar");q.addParam("x","i32"),q.addParam("scalar","i32"),q.addParam("scalarLen","i32"),q.addParam("r","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("r"),P=g.i32_add(g.getLocal("r"),g.i32_const(_)),v=g.i32_add(g.getLocal("r"),g.i32_const(2*_));q.addCode(g.call(r+"_timesScalar",x,g.getLocal("scalar"),g.getLocal("scalarLen"),N),g.call(r+"_timesScalar",H,g.getLocal("scalar"),g.getLocal("scalarLen"),P),g.call(r+"_timesScalar",T,g.getLocal("scalar"),g.getLocal("scalarLen"),v))}function s(){const q=e.addFunction(i+"_sub");q.addParam("x","i32"),q.addParam("y","i32"),q.addParam("r","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("y"),P=g.i32_add(g.getLocal("y"),g.i32_const(_)),v=g.i32_add(g.getLocal("y"),g.i32_const(2*_)),S=g.getLocal("r"),et=g.i32_add(g.getLocal("r"),g.i32_const(_)),_t=g.i32_add(g.getLocal("r"),g.i32_const(2*_));q.addCode(g.call(r+"_sub",x,N,S),g.call(r+"_sub",H,P,et),g.call(r+"_sub",T,v,_t))}function I(){const q=e.addFunction(i+"_neg");q.addParam("x","i32"),q.addParam("r","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("r"),P=g.i32_add(g.getLocal("r"),g.i32_const(_)),v=g.i32_add(g.getLocal("r"),g.i32_const(2*_));q.addCode(g.call(r+"_neg",x,N),g.call(r+"_neg",H,P),g.call(r+"_neg",T,v))}function b(){const q=e.addFunction(i+"_isNegative");q.addParam("x","i32"),q.setReturnType("i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_));q.addCode(g.if(g.call(r+"_isZero",T),g.if(g.call(r+"_isZero",H),g.ret(g.call(r+"_isNegative",x)),g.ret(g.call(r+"_isNegative",H)))),g.ret(g.call(r+"_isNegative",T)))}function f(){const q=e.addFunction(i+"_mul");q.addParam("x","i32"),q.addParam("y","i32"),q.addParam("r","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("y"),P=g.i32_add(g.getLocal("y"),g.i32_const(_)),v=g.i32_add(g.getLocal("y"),g.i32_const(2*_)),S=g.getLocal("r"),et=g.i32_add(g.getLocal("r"),g.i32_const(_)),_t=g.i32_add(g.getLocal("r"),g.i32_const(2*_)),mt=g.i32_const(e.alloc(_)),xt=g.i32_const(e.alloc(_)),Pt=g.i32_const(e.alloc(_)),zt=g.i32_const(e.alloc(_)),Rt=g.i32_const(e.alloc(_)),k=g.i32_const(e.alloc(_)),Ct=g.i32_const(e.alloc(_)),St=g.i32_const(e.alloc(_)),F=g.i32_const(e.alloc(_)),o=g.i32_const(e.alloc(_)),L=g.i32_const(e.alloc(_)),U=g.i32_const(e.alloc(_)),p=g.i32_const(e.alloc(_));q.addCode(g.call(r+"_mul",x,N,mt),g.call(r+"_mul",H,P,xt),g.call(r+"_mul",T,v,Pt),g.call(r+"_add",x,H,zt),g.call(r+"_add",N,P,Rt),g.call(r+"_add",x,T,k),g.call(r+"_add",N,v,Ct),g.call(r+"_add",H,T,St),g.call(r+"_add",P,v,F),g.call(r+"_add",mt,xt,o),g.call(r+"_add",mt,Pt,L),g.call(r+"_add",xt,Pt,U),g.call(r+"_mul",St,F,S),g.call(r+"_sub",S,U,S),g.call(c,S,S),g.call(r+"_add",mt,S,S),g.call(r+"_mul",zt,Rt,et),g.call(r+"_sub",et,o,et),g.call(c,Pt,p),g.call(r+"_add",et,p,et),g.call(r+"_mul",k,Ct,_t),g.call(r+"_sub",_t,L,_t),g.call(r+"_add",_t,xt,_t))}function w(){const q=e.addFunction(i+"_square");q.addParam("x","i32"),q.addParam("r","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("r"),P=g.i32_add(g.getLocal("r"),g.i32_const(_)),v=g.i32_add(g.getLocal("r"),g.i32_const(2*_)),S=g.i32_const(e.alloc(_)),et=g.i32_const(e.alloc(_)),_t=g.i32_const(e.alloc(_)),mt=g.i32_const(e.alloc(_)),xt=g.i32_const(e.alloc(_)),Pt=g.i32_const(e.alloc(_)),zt=g.i32_const(e.alloc(_));q.addCode(g.call(r+"_square",x,S),g.call(r+"_mul",x,H,et),g.call(r+"_add",et,et,_t),g.call(r+"_sub",x,H,mt),g.call(r+"_add",mt,T,mt),g.call(r+"_square",mt,mt),g.call(r+"_mul",H,T,xt),g.call(r+"_add",xt,xt,Pt),g.call(r+"_square",T,zt),g.call(c,Pt,N),g.call(r+"_add",S,N,N),g.call(c,zt,P),g.call(r+"_add",_t,P,P),g.call(r+"_add",S,zt,v),g.call(r+"_sub",Pt,v,v),g.call(r+"_add",mt,v,v),g.call(r+"_add",_t,v,v))}function O(){const q=e.addFunction(i+"_toMontgomery");q.addParam("x","i32"),q.addParam("r","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("r"),P=g.i32_add(g.getLocal("r"),g.i32_const(_)),v=g.i32_add(g.getLocal("r"),g.i32_const(2*_));q.addCode(g.call(r+"_toMontgomery",x,N),g.call(r+"_toMontgomery",H,P),g.call(r+"_toMontgomery",T,v))}function D(){const q=e.addFunction(i+"_fromMontgomery");q.addParam("x","i32"),q.addParam("r","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("r"),P=g.i32_add(g.getLocal("r"),g.i32_const(_)),v=g.i32_add(g.getLocal("r"),g.i32_const(2*_));q.addCode(g.call(r+"_fromMontgomery",x,N),g.call(r+"_fromMontgomery",H,P),g.call(r+"_fromMontgomery",T,v))}function G(){const q=e.addFunction(i+"_copy");q.addParam("x","i32"),q.addParam("r","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("r"),P=g.i32_add(g.getLocal("r"),g.i32_const(_)),v=g.i32_add(g.getLocal("r"),g.i32_const(2*_));q.addCode(g.call(r+"_copy",x,N),g.call(r+"_copy",H,P),g.call(r+"_copy",T,v))}function V(){const q=e.addFunction(i+"_zero");q.addParam("x","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_));q.addCode(g.call(r+"_zero",x),g.call(r+"_zero",H),g.call(r+"_zero",T))}function it(){const q=e.addFunction(i+"_one");q.addParam("x","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_));q.addCode(g.call(r+"_one",x),g.call(r+"_zero",H),g.call(r+"_zero",T))}function Z(){const q=e.addFunction(i+"_eq");q.addParam("x","i32"),q.addParam("y","i32"),q.setReturnType("i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("y"),P=g.i32_add(g.getLocal("y"),g.i32_const(_)),v=g.i32_add(g.getLocal("y"),g.i32_const(2*_));q.addCode(g.i32_and(g.i32_and(g.call(r+"_eq",x,N),g.call(r+"_eq",H,P)),g.call(r+"_eq",T,v)))}function E(){const q=e.addFunction(i+"_isZero");q.addParam("x","i32"),q.setReturnType("i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_));q.addCode(g.i32_and(g.i32_and(g.call(r+"_isZero",x),g.call(r+"_isZero",H)),g.call(r+"_isZero",T)))}function M(){const q=e.addFunction(i+"_inverse");q.addParam("x","i32"),q.addParam("r","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("r"),P=g.i32_add(g.getLocal("r"),g.i32_const(_)),v=g.i32_add(g.getLocal("r"),g.i32_const(2*_)),S=g.i32_const(e.alloc(_)),et=g.i32_const(e.alloc(_)),_t=g.i32_const(e.alloc(_)),mt=g.i32_const(e.alloc(_)),xt=g.i32_const(e.alloc(_)),Pt=g.i32_const(e.alloc(_)),zt=g.i32_const(e.alloc(_)),Rt=g.i32_const(e.alloc(_)),k=g.i32_const(e.alloc(_)),Ct=g.i32_const(e.alloc(_)),St=g.i32_const(e.alloc(_));q.addCode(g.call(r+"_square",x,S),g.call(r+"_square",H,et),g.call(r+"_square",T,_t),g.call(r+"_mul",x,H,mt),g.call(r+"_mul",x,T,xt),g.call(r+"_mul",H,T,Pt),g.call(c,Pt,zt),g.call(r+"_sub",S,zt,zt),g.call(c,_t,Rt),g.call(r+"_sub",Rt,mt,Rt),g.call(r+"_sub",et,xt,k),g.call(r+"_mul",T,Rt,Ct),g.call(r+"_mul",H,k,St),g.call(r+"_add",Ct,St,Ct),g.call(c,Ct,Ct),g.call(r+"_mul",x,zt,St),g.call(r+"_add",St,Ct,Ct),g.call(r+"_inverse",Ct,Ct),g.call(r+"_mul",Ct,zt,N),g.call(r+"_mul",Ct,Rt,P),g.call(r+"_mul",Ct,k,v))}function h(){const q=e.addFunction(i+"_sign");q.addParam("x","i32"),q.addLocal("s","i32"),q.setReturnType("i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_));q.addCode(g.setLocal("s",g.call(r+"_sign",T)),g.if(g.getLocal("s"),g.ret(g.getLocal("s"))),g.setLocal("s",g.call(r+"_sign",H)),g.if(g.getLocal("s"),g.ret(g.getLocal("s"))),g.ret(g.call(r+"_sign",x)))}function y(){const q=e.addFunction(i+"_isOne");q.addParam("x","i32"),q.setReturnType("i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(_*2));q.addCode(g.ret(g.i32_and(g.i32_and(g.call(r+"_isOne",x),g.call(r+"_isZero",H)),g.call(r+"_isZero",T))))}return E(),y(),V(),it(),G(),f(),w(),u(),s(),I(),h(),O(),D(),Z(),M(),l(),b(),e.exportFunction(i+"_isZero"),e.exportFunction(i+"_isOne"),e.exportFunction(i+"_zero"),e.exportFunction(i+"_one"),e.exportFunction(i+"_copy"),e.exportFunction(i+"_mul"),e.exportFunction(i+"_square"),e.exportFunction(i+"_add"),e.exportFunction(i+"_sub"),e.exportFunction(i+"_neg"),e.exportFunction(i+"_sign"),e.exportFunction(i+"_fromMontgomery"),e.exportFunction(i+"_toMontgomery"),e.exportFunction(i+"_eq"),e.exportFunction(i+"_inverse"),a(e,i),t(e,i+"_exp",_*3,i+"_mul",i+"_square",i+"_copy",i+"_one"),e.exportFunction(i+"_exp"),e.exportFunction(i+"_timesScalar"),e.exportFunction(i+"_batchInverse"),e.exportFunction(i+"_isNegative"),i},Jo}var te,mc;function Hd(){return mc||(mc=1,te=function(a,n,e,c,i,r,_,u){const l=a.addFunction(n);l.addParam("base","i32"),l.addParam("scalar","i32"),l.addParam("scalarLength","i32"),l.addParam("r","i32"),l.addLocal("old0","i32"),l.addLocal("nbits","i32"),l.addLocal("i","i32"),l.addLocal("last","i32"),l.addLocal("cur","i32"),l.addLocal("carry","i32"),l.addLocal("p","i32");const s=l.getCodeBuilder(),I=s.i32_const(a.alloc(e));function b(w){return s.i32_and(s.i32_shr_u(s.i32_load(s.i32_add(s.getLocal("scalar"),s.i32_and(s.i32_shr_u(w,s.i32_const(3)),s.i32_const(4294967292)))),s.i32_and(w,s.i32_const(31))),s.i32_const(1))}function f(w){return[...s.i32_store8(s.getLocal("p"),s.i32_const(w)),...s.setLocal("p",s.i32_add(s.getLocal("p"),s.i32_const(1)))]}l.addCode(s.if(s.i32_eqz(s.getLocal("scalarLength")),[...s.call(u,s.getLocal("r")),...s.ret([])]),s.setLocal("nbits",s.i32_shl(s.getLocal("scalarLength"),s.i32_const(3))),s.setLocal("old0",s.i32_load(s.i32_const(0))),s.setLocal("p",s.getLocal("old0")),s.i32_store(s.i32_const(0),s.i32_and(s.i32_add(s.i32_add(s.getLocal("old0"),s.i32_const(32)),s.getLocal("nbits")),s.i32_const(4294967288))),s.setLocal("i",s.i32_const(1)),s.setLocal("last",b(s.i32_const(0))),s.setLocal("carry",s.i32_const(0)),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal("i"),s.getLocal("nbits"))),s.setLocal("cur",b(s.getLocal("i"))),s.if(s.getLocal("last"),s.if(s.getLocal("cur"),s.if(s.getLocal("carry"),[...s.setLocal("last",s.i32_const(0)),...s.setLocal("carry",s.i32_const(1)),...f(1)],[...s.setLocal("last",s.i32_const(0)),...s.setLocal("carry",s.i32_const(1)),...f(255)]),s.if(s.getLocal("carry"),[...s.setLocal("last",s.i32_const(0)),...s.setLocal("carry",s.i32_const(1)),...f(255)],[...s.setLocal("last",s.i32_const(0)),...s.setLocal("carry",s.i32_const(0)),...f(1)])),s.if(s.getLocal("cur"),s.if(s.getLocal("carry"),[...s.setLocal("last",s.i32_const(0)),...s.setLocal("carry",s.i32_const(1)),...f(0)],[...s.setLocal("last",s.i32_const(1)),...s.setLocal("carry",s.i32_const(0)),...f(0)]),s.if(s.getLocal("carry"),[...s.setLocal("last",s.i32_const(1)),...s.setLocal("carry",s.i32_const(0)),...f(0)],[...s.setLocal("last",s.i32_const(0)),...s.setLocal("carry",s.i32_const(0)),...f(0)]))),s.setLocal("i",s.i32_add(s.getLocal("i"),s.i32_const(1))),s.br(0))),s.if(s.getLocal("last"),s.if(s.getLocal("carry"),[...f(255),...f(0),...f(1)],[...f(1)]),s.if(s.getLocal("carry"),[...f(0),...f(1)])),s.setLocal("p",s.i32_sub(s.getLocal("p"),s.i32_const(1))),s.call(_,s.getLocal("base"),I),s.call(u,s.getLocal("r")),s.block(s.loop(s.call(i,s.getLocal("r"),s.getLocal("r")),s.setLocal("cur",s.i32_load8_u(s.getLocal("p"))),s.if(s.getLocal("cur"),s.if(s.i32_eq(s.getLocal("cur"),s.i32_const(1)),s.call(c,s.getLocal("r"),I,s.getLocal("r")),s.call(r,s.getLocal("r"),I,s.getLocal("r")))),s.br_if(1,s.i32_eq(s.getLocal("old0"),s.getLocal("p"))),s.setLocal("p",s.i32_sub(s.getLocal("p"),s.i32_const(1))),s.br(0))),s.i32_store(s.i32_const(0),s.getLocal("old0")))}),te}var ne,Cc;function Vd(){return Cc||(Cc=1,ne=function(a,n,e,c,i){const _=a.modules[n].n64*8;function u(){const b=a.addFunction(e+"_getChunk");b.addParam("pScalar","i32"),b.addParam("scalarSize","i32"),b.addParam("startBit","i32"),b.addParam("chunkSize","i32"),b.addLocal("bitsToEnd","i32"),b.addLocal("mask","i32"),b.setReturnType("i32");const f=b.getCodeBuilder();b.addCode(f.setLocal("bitsToEnd",f.i32_sub(f.i32_mul(f.getLocal("scalarSize"),f.i32_const(8)),f.getLocal("startBit"))),f.if(f.i32_gt_s(f.getLocal("chunkSize"),f.getLocal("bitsToEnd")),f.setLocal("mask",f.i32_sub(f.i32_shl(f.i32_const(1),f.getLocal("bitsToEnd")),f.i32_const(1))),f.setLocal("mask",f.i32_sub(f.i32_shl(f.i32_const(1),f.getLocal("chunkSize")),f.i32_const(1)))),f.i32_and(f.i32_shr_u(f.i32_load(f.i32_add(f.getLocal("pScalar"),f.i32_shr_u(f.getLocal("startBit"),f.i32_const(3))),0,0),f.i32_and(f.getLocal("startBit"),f.i32_const(7))),f.getLocal("mask")))}function l(){const b=a.addFunction(e+"_chunk");b.addParam("pBases","i32"),b.addParam("pScalars","i32"),b.addParam("scalarSize","i32"),b.addParam("n","i32"),b.addParam("startBit","i32"),b.addParam("chunkSize","i32"),b.addParam("pr","i32"),b.addLocal("nChunks","i32"),b.addLocal("itScalar","i32"),b.addLocal("endScalar","i32"),b.addLocal("itBase","i32"),b.addLocal("i","i32"),b.addLocal("j","i32"),b.addLocal("nTable","i32"),b.addLocal("pTable","i32"),b.addLocal("idx","i32"),b.addLocal("pIdxTable","i32");const f=b.getCodeBuilder();b.addCode(f.if(f.i32_eqz(f.getLocal("n")),[...f.call(n+"_zero",f.getLocal("pr")),...f.ret([])]),f.setLocal("nTable",f.i32_shl(f.i32_const(1),f.getLocal("chunkSize"))),f.setLocal("pTable",f.i32_load(f.i32_const(0))),f.i32_store(f.i32_const(0),f.i32_add(f.getLocal("pTable"),f.i32_mul(f.getLocal("nTable"),f.i32_const(_)))),f.setLocal("j",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal("j"),f.getLocal("nTable"))),f.call(n+"_zero",f.i32_add(f.getLocal("pTable"),f.i32_mul(f.getLocal("j"),f.i32_const(_)))),f.setLocal("j",f.i32_add(f.getLocal("j"),f.i32_const(1))),f.br(0))),f.setLocal("itBase",f.getLocal("pBases")),f.setLocal("itScalar",f.getLocal("pScalars")),f.setLocal("endScalar",f.i32_add(f.getLocal("pScalars"),f.i32_mul(f.getLocal("n"),f.getLocal("scalarSize")))),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal("itScalar"),f.getLocal("endScalar"))),f.setLocal("idx",f.call(e+"_getChunk",f.getLocal("itScalar"),f.getLocal("scalarSize"),f.getLocal("startBit"),f.getLocal("chunkSize"))),f.if(f.getLocal("idx"),[...f.setLocal("pIdxTable",f.i32_add(f.getLocal("pTable"),f.i32_mul(f.i32_sub(f.getLocal("idx"),f.i32_const(1)),f.i32_const(_)))),...f.call(c,f.getLocal("pIdxTable"),f.getLocal("itBase"),f.getLocal("pIdxTable"))]),f.setLocal("itScalar",f.i32_add(f.getLocal("itScalar"),f.getLocal("scalarSize"))),f.setLocal("itBase",f.i32_add(f.getLocal("itBase"),f.i32_const(i))),f.br(0))),f.call(e+"_reduceTable",f.getLocal("pTable"),f.getLocal("chunkSize")),f.call(n+"_copy",f.getLocal("pTable"),f.getLocal("pr")),f.i32_store(f.i32_const(0),f.getLocal("pTable")))}function s(){const b=a.addFunction(e);b.addParam("pBases","i32"),b.addParam("pScalars","i32"),b.addParam("scalarSize","i32"),b.addParam("n","i32"),b.addParam("pr","i32"),b.addLocal("chunkSize","i32"),b.addLocal("nChunks","i32"),b.addLocal("itScalar","i32"),b.addLocal("endScalar","i32"),b.addLocal("itBase","i32"),b.addLocal("itBit","i32"),b.addLocal("i","i32"),b.addLocal("j","i32"),b.addLocal("nTable","i32"),b.addLocal("pTable","i32"),b.addLocal("idx","i32"),b.addLocal("pIdxTable","i32");const f=b.getCodeBuilder(),w=f.i32_const(a.alloc(_)),O=a.alloc([17,17,17,17,17,17,17,17,17,17,16,16,15,14,13,13,12,11,10,9,8,7,7,6,5,4,3,2,1,1,1,1]);b.addCode(f.call(n+"_zero",f.getLocal("pr")),f.if(f.i32_eqz(f.getLocal("n")),f.ret([])),f.setLocal("chunkSize",f.i32_load8_u(f.i32_clz(f.getLocal("n")),O)),f.setLocal("nChunks",f.i32_add(f.i32_div_u(f.i32_sub(f.i32_shl(f.getLocal("scalarSize"),f.i32_const(3)),f.i32_const(1)),f.getLocal("chunkSize")),f.i32_const(1))),f.setLocal("itBit",f.i32_mul(f.i32_sub(f.getLocal("nChunks"),f.i32_const(1)),f.getLocal("chunkSize"))),f.block(f.loop(f.br_if(1,f.i32_lt_s(f.getLocal("itBit"),f.i32_const(0))),f.if(f.i32_eqz(f.call(n+"_isZero",f.getLocal("pr"))),[...f.setLocal("j",f.i32_const(0)),...f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal("j"),f.getLocal("chunkSize"))),f.call(n+"_double",f.getLocal("pr"),f.getLocal("pr")),f.setLocal("j",f.i32_add(f.getLocal("j"),f.i32_const(1))),f.br(0)))]),f.call(e+"_chunk",f.getLocal("pBases"),f.getLocal("pScalars"),f.getLocal("scalarSize"),f.getLocal("n"),f.getLocal("itBit"),f.getLocal("chunkSize"),w),f.call(n+"_add",f.getLocal("pr"),w,f.getLocal("pr")),f.setLocal("itBit",f.i32_sub(f.getLocal("itBit"),f.getLocal("chunkSize"))),f.br(0))))}function I(){const b=a.addFunction(e+"_reduceTable");b.addParam("pTable","i32"),b.addParam("p","i32"),b.addLocal("half","i32"),b.addLocal("it1","i32"),b.addLocal("it2","i32"),b.addLocal("pAcc","i32");const f=b.getCodeBuilder();b.addCode(f.if(f.i32_eq(f.getLocal("p"),f.i32_const(1)),f.ret([])),f.setLocal("half",f.i32_shl(f.i32_const(1),f.i32_sub(f.getLocal("p"),f.i32_const(1)))),f.setLocal("it1",f.getLocal("pTable")),f.setLocal("it2",f.i32_add(f.getLocal("pTable"),f.i32_mul(f.getLocal("half"),f.i32_const(_)))),f.setLocal("pAcc",f.i32_sub(f.getLocal("it2"),f.i32_const(_))),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal("it1"),f.getLocal("pAcc"))),f.call(n+"_add",f.getLocal("it1"),f.getLocal("it2"),f.getLocal("it1")),f.call(n+"_add",f.getLocal("pAcc"),f.getLocal("it2"),f.getLocal("pAcc")),f.setLocal("it1",f.i32_add(f.getLocal("it1"),f.i32_const(_))),f.setLocal("it2",f.i32_add(f.getLocal("it2"),f.i32_const(_))),f.br(0))),f.call(e+"_reduceTable",f.getLocal("pTable"),f.i32_sub(f.getLocal("p"),f.i32_const(1))),f.setLocal("p",f.i32_sub(f.getLocal("p"),f.i32_const(1))),f.block(f.loop(f.br_if(1,f.i32_eqz(f.getLocal("p"))),f.call(n+"_double",f.getLocal("pAcc"),f.getLocal("pAcc")),f.setLocal("p",f.i32_sub(f.getLocal("p"),f.i32_const(1))),f.br(0))),f.call(n+"_add",f.getLocal("pTable"),f.getLocal("pAcc"),f.getLocal("pTable")))}u(),I(),l(),s(),a.exportFunction(e),a.exportFunction(e+"_chunk")}),ne}var ae,Ic;function wc(){if(Ic)return ae;Ic=1;const t=Hd(),a=_c(),n=Vd();return ae=function(c,i,r,_){const u=c.modules[r].n64,l=u*8;if(c.modules[i])return i;c.modules[i]={n64:u*3};function s(){const F=c.addFunction(i+"_isZero");F.addParam("p1","i32"),F.setReturnType("i32");const o=F.getCodeBuilder();F.addCode(o.call(r+"_isZero",o.i32_add(o.getLocal("p1"),o.i32_const(l*2))))}function I(){const F=c.addFunction(i+"_isZeroAffine");F.addParam("p1","i32"),F.setReturnType("i32");const o=F.getCodeBuilder();F.addCode(o.i32_and(o.call(r+"_isZero",o.getLocal("p1")),o.call(r+"_isZero",o.i32_add(o.getLocal("p1"),o.i32_const(l)))))}function b(){const F=c.addFunction(i+"_copy");F.addParam("ps","i32"),F.addParam("pd","i32");const o=F.getCodeBuilder();for(let L=0;L<u*3;L++)F.addCode(o.i64_store(o.getLocal("pd"),L*8,o.i64_load(o.getLocal("ps"),L*8)))}function f(){const F=c.addFunction(i+"_copyAffine");F.addParam("ps","i32"),F.addParam("pd","i32");const o=F.getCodeBuilder();for(let L=0;L<u*2;L++)F.addCode(o.i64_store(o.getLocal("pd"),L*8,o.i64_load(o.getLocal("ps"),L*8)))}function w(){const F=c.addFunction(i+"_zero");F.addParam("pr","i32");const o=F.getCodeBuilder();F.addCode(o.call(r+"_zero",o.getLocal("pr"))),F.addCode(o.call(r+"_one",o.i32_add(o.getLocal("pr"),o.i32_const(l)))),F.addCode(o.call(r+"_zero",o.i32_add(o.getLocal("pr"),o.i32_const(l*2))))}function O(){const F=c.addFunction(i+"_zeroAffine");F.addParam("pr","i32");const o=F.getCodeBuilder();F.addCode(o.call(r+"_zero",o.getLocal("pr"))),F.addCode(o.call(r+"_zero",o.i32_add(o.getLocal("pr"),o.i32_const(l))))}function D(){const F=c.addFunction(i+"_eq");F.addParam("p1","i32"),F.addParam("p2","i32"),F.setReturnType("i32"),F.addLocal("z1","i32"),F.addLocal("z2","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l));F.addCode(o.setLocal("z1",o.i32_add(o.getLocal("p1"),o.i32_const(l*2))));const p=o.getLocal("z1"),st=o.getLocal("p2"),qt=o.i32_add(o.getLocal("p2"),o.i32_const(l));F.addCode(o.setLocal("z2",o.i32_add(o.getLocal("p2"),o.i32_const(l*2))));const wt=o.getLocal("z2"),nt=o.i32_const(c.alloc(l)),Q=o.i32_const(c.alloc(l)),A=o.i32_const(c.alloc(l)),lt=o.i32_const(c.alloc(l)),Ft=o.i32_const(c.alloc(l)),Ut=o.i32_const(c.alloc(l)),dt=o.i32_const(c.alloc(l)),B=o.i32_const(c.alloc(l));F.addCode(o.if(o.call(i+"_isZero",o.getLocal("p1")),o.ret(o.call(i+"_isZero",o.getLocal("p2")))),o.if(o.call(i+"_isZero",o.getLocal("p2")),o.ret(o.i32_const(0))),o.if(o.call(r+"_isOne",p),o.ret(o.call(i+"_eqMixed",o.getLocal("p2"),o.getLocal("p1")))),o.if(o.call(r+"_isOne",wt),o.ret(o.call(i+"_eqMixed",o.getLocal("p1"),o.getLocal("p2")))),o.call(r+"_square",p,nt),o.call(r+"_square",wt,Q),o.call(r+"_mul",L,Q,A),o.call(r+"_mul",st,nt,lt),o.call(r+"_mul",p,nt,Ft),o.call(r+"_mul",wt,Q,Ut),o.call(r+"_mul",U,Ut,dt),o.call(r+"_mul",qt,Ft,B),o.if(o.call(r+"_eq",A,lt),o.if(o.call(r+"_eq",dt,B),o.ret(o.i32_const(1)))),o.ret(o.i32_const(0)))}function G(){const F=c.addFunction(i+"_eqMixed");F.addParam("p1","i32"),F.addParam("p2","i32"),F.setReturnType("i32"),F.addLocal("z1","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l));F.addCode(o.setLocal("z1",o.i32_add(o.getLocal("p1"),o.i32_const(l*2))));const p=o.getLocal("z1"),st=o.getLocal("p2"),qt=o.i32_add(o.getLocal("p2"),o.i32_const(l)),wt=o.i32_const(c.alloc(l)),nt=o.i32_const(c.alloc(l)),Q=o.i32_const(c.alloc(l)),A=o.i32_const(c.alloc(l));F.addCode(o.if(o.call(i+"_isZero",o.getLocal("p1")),o.ret(o.call(i+"_isZeroAffine",o.getLocal("p2")))),o.if(o.call(i+"_isZeroAffine",o.getLocal("p2")),o.ret(o.i32_const(0))),o.if(o.call(r+"_isOne",p),o.ret(o.call(i+"_eqAffine",o.getLocal("p1"),o.getLocal("p2")))),o.call(r+"_square",p,wt),o.call(r+"_mul",st,wt,nt),o.call(r+"_mul",p,wt,Q),o.call(r+"_mul",qt,Q,A),o.if(o.call(r+"_eq",L,nt),o.if(o.call(r+"_eq",U,A),o.ret(o.i32_const(1)))),o.ret(o.i32_const(0)))}function V(){const F=c.addFunction(i+"_double");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l)),p=o.i32_add(o.getLocal("p1"),o.i32_const(l*2)),st=o.getLocal("pr"),qt=o.i32_add(o.getLocal("pr"),o.i32_const(l)),wt=o.i32_add(o.getLocal("pr"),o.i32_const(l*2)),nt=o.i32_const(c.alloc(l)),Q=o.i32_const(c.alloc(l)),A=o.i32_const(c.alloc(l)),lt=o.i32_const(c.alloc(l)),Ft=o.i32_const(c.alloc(l)),Ut=o.i32_const(c.alloc(l)),dt=o.i32_const(c.alloc(l)),B=o.i32_const(c.alloc(l));F.addCode(o.if(o.call(i+"_isZero",o.getLocal("p1")),[...o.call(i+"_copy",o.getLocal("p1"),o.getLocal("pr")),...o.ret([])]),o.if(o.call(r+"_isOne",p),[...o.ret(o.call(i+"_doubleAffine",o.getLocal("p1"),o.getLocal("pr"))),...o.ret([])]),o.call(r+"_square",L,nt),o.call(r+"_square",U,Q),o.call(r+"_square",Q,A),o.call(r+"_add",L,Q,lt),o.call(r+"_square",lt,lt),o.call(r+"_sub",lt,nt,lt),o.call(r+"_sub",lt,A,lt),o.call(r+"_add",lt,lt,lt),o.call(r+"_add",nt,nt,Ft),o.call(r+"_add",Ft,nt,Ft),o.call(r+"_square",Ft,Ut),o.call(r+"_mul",U,p,dt),o.call(r+"_add",lt,lt,st),o.call(r+"_sub",Ut,st,st),o.call(r+"_add",A,A,B),o.call(r+"_add",B,B,B),o.call(r+"_add",B,B,B),o.call(r+"_sub",lt,st,qt),o.call(r+"_mul",qt,Ft,qt),o.call(r+"_sub",qt,B,qt),o.call(r+"_add",dt,dt,wt))}function it(){const F=c.addFunction(i+"_doubleAffine");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l)),p=o.getLocal("pr"),st=o.i32_add(o.getLocal("pr"),o.i32_const(l)),qt=o.i32_add(o.getLocal("pr"),o.i32_const(l*2)),wt=o.i32_const(c.alloc(l)),nt=o.i32_const(c.alloc(l)),Q=o.i32_const(c.alloc(l)),A=o.i32_const(c.alloc(l)),lt=o.i32_const(c.alloc(l)),Ft=o.i32_const(c.alloc(l));F.addCode(o.if(o.call(i+"_isZeroAffine",o.getLocal("p1")),[...o.call(i+"_toJacobian",o.getLocal("p1"),o.getLocal("pr")),...o.ret([])]),o.call(r+"_square",L,wt),o.call(r+"_square",U,nt),o.call(r+"_square",nt,Q),o.call(r+"_add",L,nt,A),o.call(r+"_square",A,A),o.call(r+"_sub",A,wt,A),o.call(r+"_sub",A,Q,A),o.call(r+"_add",A,A,A),o.call(r+"_add",wt,wt,lt),o.call(r+"_add",lt,wt,lt),o.call(r+"_add",U,U,qt),o.call(r+"_square",lt,p),o.call(r+"_sub",p,A,p),o.call(r+"_sub",p,A,p),o.call(r+"_add",Q,Q,Ft),o.call(r+"_add",Ft,Ft,Ft),o.call(r+"_add",Ft,Ft,Ft),o.call(r+"_sub",A,p,st),o.call(r+"_mul",st,lt,st),o.call(r+"_sub",st,Ft,st))}function Z(){const F=c.addFunction(i+"_eqAffine");F.addParam("p1","i32"),F.addParam("p2","i32"),F.setReturnType("i32"),F.addLocal("z1","i32");const o=F.getCodeBuilder();F.addCode(o.ret(o.i32_and(o.call(r+"_eq",o.getLocal("p1"),o.getLocal("p2")),o.call(r+"_eq",o.i32_add(o.getLocal("p1"),o.i32_const(l)),o.i32_add(o.getLocal("p2"),o.i32_const(l))))))}function E(){const F=c.addFunction(i+"_toMontgomery");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder();F.addCode(o.call(r+"_toMontgomery",o.getLocal("p1"),o.getLocal("pr")));for(let L=1;L<3;L++)F.addCode(o.call(r+"_toMontgomery",o.i32_add(o.getLocal("p1"),o.i32_const(L*l)),o.i32_add(o.getLocal("pr"),o.i32_const(L*l))))}function M(){const F=c.addFunction(i+"_toMontgomeryAffine");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder();F.addCode(o.call(r+"_toMontgomery",o.getLocal("p1"),o.getLocal("pr")));for(let L=1;L<2;L++)F.addCode(o.call(r+"_toMontgomery",o.i32_add(o.getLocal("p1"),o.i32_const(L*l)),o.i32_add(o.getLocal("pr"),o.i32_const(L*l))))}function h(){const F=c.addFunction(i+"_fromMontgomery");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder();F.addCode(o.call(r+"_fromMontgomery",o.getLocal("p1"),o.getLocal("pr")));for(let L=1;L<3;L++)F.addCode(o.call(r+"_fromMontgomery",o.i32_add(o.getLocal("p1"),o.i32_const(L*l)),o.i32_add(o.getLocal("pr"),o.i32_const(L*l))))}function y(){const F=c.addFunction(i+"_fromMontgomeryAffine");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder();F.addCode(o.call(r+"_fromMontgomery",o.getLocal("p1"),o.getLocal("pr")));for(let L=1;L<2;L++)F.addCode(o.call(r+"_fromMontgomery",o.i32_add(o.getLocal("p1"),o.i32_const(L*l)),o.i32_add(o.getLocal("pr"),o.i32_const(L*l))))}function q(){const F=c.addFunction(i+"_add");F.addParam("p1","i32"),F.addParam("p2","i32"),F.addParam("pr","i32"),F.addLocal("z1","i32"),F.addLocal("z2","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l));F.addCode(o.setLocal("z1",o.i32_add(o.getLocal("p1"),o.i32_const(l*2))));const p=o.getLocal("z1"),st=o.getLocal("p2"),qt=o.i32_add(o.getLocal("p2"),o.i32_const(l));F.addCode(o.setLocal("z2",o.i32_add(o.getLocal("p2"),o.i32_const(l*2))));const wt=o.getLocal("z2"),nt=o.getLocal("pr"),Q=o.i32_add(o.getLocal("pr"),o.i32_const(l)),A=o.i32_add(o.getLocal("pr"),o.i32_const(l*2)),lt=o.i32_const(c.alloc(l)),Ft=o.i32_const(c.alloc(l)),Ut=o.i32_const(c.alloc(l)),dt=o.i32_const(c.alloc(l)),B=o.i32_const(c.alloc(l)),Lt=o.i32_const(c.alloc(l)),Gt=o.i32_const(c.alloc(l)),z=o.i32_const(c.alloc(l)),$=o.i32_const(c.alloc(l)),X=o.i32_const(c.alloc(l)),at=o.i32_const(c.alloc(l)),gt=o.i32_const(c.alloc(l)),ft=o.i32_const(c.alloc(l)),Bt=o.i32_const(c.alloc(l)),pt=o.i32_const(c.alloc(l)),Ot=o.i32_const(c.alloc(l)),Ht=o.i32_const(c.alloc(l));F.addCode(o.if(o.call(i+"_isZero",o.getLocal("p1")),[...o.call(i+"_copy",o.getLocal("p2"),o.getLocal("pr")),...o.ret([])]),o.if(o.call(i+"_isZero",o.getLocal("p2")),[...o.call(i+"_copy",o.getLocal("p1"),o.getLocal("pr")),...o.ret([])]),o.if(o.call(r+"_isOne",p),[...o.call(i+"_addMixed",st,L,nt),...o.ret([])]),o.if(o.call(r+"_isOne",wt),[...o.call(i+"_addMixed",L,st,nt),...o.ret([])]),o.call(r+"_square",p,lt),o.call(r+"_square",wt,Ft),o.call(r+"_mul",L,Ft,Ut),o.call(r+"_mul",st,lt,dt),o.call(r+"_mul",p,lt,B),o.call(r+"_mul",wt,Ft,Lt),o.call(r+"_mul",U,Lt,Gt),o.call(r+"_mul",qt,B,z),o.if(o.call(r+"_eq",Ut,dt),o.if(o.call(r+"_eq",Gt,z),[...o.call(i+"_double",o.getLocal("p1"),o.getLocal("pr")),...o.ret([])])),o.call(r+"_sub",dt,Ut,$),o.call(r+"_sub",z,Gt,X),o.call(r+"_add",$,$,at),o.call(r+"_square",at,at),o.call(r+"_mul",$,at,gt),o.call(r+"_add",X,X,ft),o.call(r+"_mul",Ut,at,pt),o.call(r+"_square",ft,Bt),o.call(r+"_add",pt,pt,Ot),o.call(r+"_sub",Bt,gt,nt),o.call(r+"_sub",nt,Ot,nt),o.call(r+"_mul",Gt,gt,Ht),o.call(r+"_add",Ht,Ht,Ht),o.call(r+"_sub",pt,nt,Q),o.call(r+"_mul",Q,ft,Q),o.call(r+"_sub",Q,Ht,Q),o.call(r+"_add",p,wt,A),o.call(r+"_square",A,A),o.call(r+"_sub",A,lt,A),o.call(r+"_sub",A,Ft,A),o.call(r+"_mul",A,$,A))}function g(){const F=c.addFunction(i+"_addMixed");F.addParam("p1","i32"),F.addParam("p2","i32"),F.addParam("pr","i32"),F.addLocal("z1","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l));F.addCode(o.setLocal("z1",o.i32_add(o.getLocal("p1"),o.i32_const(l*2))));const p=o.getLocal("z1"),st=o.getLocal("p2"),qt=o.i32_add(o.getLocal("p2"),o.i32_const(l)),wt=o.getLocal("pr"),nt=o.i32_add(o.getLocal("pr"),o.i32_const(l)),Q=o.i32_add(o.getLocal("pr"),o.i32_const(l*2)),A=o.i32_const(c.alloc(l)),lt=o.i32_const(c.alloc(l)),Ft=o.i32_const(c.alloc(l)),Ut=o.i32_const(c.alloc(l)),dt=o.i32_const(c.alloc(l)),B=o.i32_const(c.alloc(l)),Lt=o.i32_const(c.alloc(l)),Gt=o.i32_const(c.alloc(l)),z=o.i32_const(c.alloc(l)),$=o.i32_const(c.alloc(l)),X=o.i32_const(c.alloc(l)),at=o.i32_const(c.alloc(l)),gt=o.i32_const(c.alloc(l)),ft=o.i32_const(c.alloc(l));F.addCode(o.if(o.call(i+"_isZero",o.getLocal("p1")),[...o.call(i+"_copyAffine",o.getLocal("p2"),o.getLocal("pr")),...o.call(r+"_one",o.i32_add(o.getLocal("pr"),o.i32_const(l*2))),...o.ret([])]),o.if(o.call(i+"_isZeroAffine",o.getLocal("p2")),[...o.call(i+"_copy",o.getLocal("p1"),o.getLocal("pr")),...o.ret([])]),o.if(o.call(r+"_isOne",p),[...o.call(i+"_addAffine",L,st,wt),...o.ret([])]),o.call(r+"_square",p,A),o.call(r+"_mul",st,A,lt),o.call(r+"_mul",p,A,Ft),o.call(r+"_mul",qt,Ft,Ut),o.if(o.call(r+"_eq",L,lt),o.if(o.call(r+"_eq",U,Ut),[...o.call(i+"_doubleAffine",o.getLocal("p2"),o.getLocal("pr")),...o.ret([])])),o.call(r+"_sub",lt,L,dt),o.call(r+"_sub",Ut,U,Lt),o.call(r+"_square",dt,B),o.call(r+"_add",B,B,Gt),o.call(r+"_add",Gt,Gt,Gt),o.call(r+"_mul",dt,Gt,z),o.call(r+"_add",Lt,Lt,$),o.call(r+"_mul",L,Gt,at),o.call(r+"_square",$,X),o.call(r+"_add",at,at,gt),o.call(r+"_sub",X,z,wt),o.call(r+"_sub",wt,gt,wt),o.call(r+"_mul",U,z,ft),o.call(r+"_add",ft,ft,ft),o.call(r+"_sub",at,wt,nt),o.call(r+"_mul",nt,$,nt),o.call(r+"_sub",nt,ft,nt),o.call(r+"_add",p,dt,Q),o.call(r+"_square",Q,Q),o.call(r+"_sub",Q,A,Q),o.call(r+"_sub",Q,B,Q))}function x(){const F=c.addFunction(i+"_addAffine");F.addParam("p1","i32"),F.addParam("p2","i32"),F.addParam("pr","i32"),F.addLocal("z1","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l));F.addCode(o.setLocal("z1",o.i32_add(o.getLocal("p1"),o.i32_const(l*2))));const p=o.getLocal("p2"),st=o.i32_add(o.getLocal("p2"),o.i32_const(l)),qt=o.getLocal("pr"),wt=o.i32_add(o.getLocal("pr"),o.i32_const(l)),nt=o.i32_add(o.getLocal("pr"),o.i32_const(l*2)),Q=o.i32_const(c.alloc(l)),A=o.i32_const(c.alloc(l)),lt=o.i32_const(c.alloc(l)),Ft=o.i32_const(c.alloc(l)),Ut=o.i32_const(c.alloc(l)),dt=o.i32_const(c.alloc(l)),B=o.i32_const(c.alloc(l)),Lt=o.i32_const(c.alloc(l)),Gt=o.i32_const(c.alloc(l)),z=o.i32_const(c.alloc(l));F.addCode(o.if(o.call(i+"_isZeroAffine",o.getLocal("p1")),[...o.call(i+"_copyAffine",o.getLocal("p2"),o.getLocal("pr")),...o.call(r+"_one",o.i32_add(o.getLocal("pr"),o.i32_const(l*2))),...o.ret([])]),o.if(o.call(i+"_isZeroAffine",o.getLocal("p2")),[...o.call(i+"_copyAffine",o.getLocal("p1"),o.getLocal("pr")),...o.call(r+"_one",o.i32_add(o.getLocal("pr"),o.i32_const(l*2))),...o.ret([])]),o.if(o.call(r+"_eq",L,p),o.if(o.call(r+"_eq",U,st),[...o.call(i+"_doubleAffine",o.getLocal("p2"),o.getLocal("pr")),...o.ret([])])),o.call(r+"_sub",p,L,Q),o.call(r+"_sub",st,U,lt),o.call(r+"_square",Q,A),o.call(r+"_add",A,A,Ft),o.call(r+"_add",Ft,Ft,Ft),o.call(r+"_mul",Q,Ft,Ut),o.call(r+"_add",lt,lt,dt),o.call(r+"_mul",L,Ft,Lt),o.call(r+"_square",dt,B),o.call(r+"_add",Lt,Lt,Gt),o.call(r+"_sub",B,Ut,qt),o.call(r+"_sub",qt,Gt,qt),o.call(r+"_mul",U,Ut,z),o.call(r+"_add",z,z,z),o.call(r+"_sub",Lt,qt,wt),o.call(r+"_mul",wt,dt,wt),o.call(r+"_sub",wt,z,wt),o.call(r+"_add",Q,Q,nt))}function H(){const F=c.addFunction(i+"_neg");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l)),p=o.i32_add(o.getLocal("p1"),o.i32_const(l*2)),st=o.getLocal("pr"),qt=o.i32_add(o.getLocal("pr"),o.i32_const(l)),wt=o.i32_add(o.getLocal("pr"),o.i32_const(l*2));F.addCode(o.call(r+"_copy",L,st),o.call(r+"_neg",U,qt),o.call(r+"_copy",p,wt))}function T(){const F=c.addFunction(i+"_negAffine");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l)),p=o.getLocal("pr"),st=o.i32_add(o.getLocal("pr"),o.i32_const(l));F.addCode(o.call(r+"_copy",L,p),o.call(r+"_neg",U,st))}function N(){const F=c.addFunction(i+"_sub");F.addParam("p1","i32"),F.addParam("p2","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder(),L=o.i32_const(c.alloc(l*3));F.addCode(o.call(i+"_neg",o.getLocal("p2"),L),o.call(i+"_add",o.getLocal("p1"),L,o.getLocal("pr")))}function P(){const F=c.addFunction(i+"_subMixed");F.addParam("p1","i32"),F.addParam("p2","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder(),L=o.i32_const(c.alloc(l*3));F.addCode(o.call(i+"_negAffine",o.getLocal("p2"),L),o.call(i+"_addMixed",o.getLocal("p1"),L,o.getLocal("pr")))}function v(){const F=c.addFunction(i+"_subAffine");F.addParam("p1","i32"),F.addParam("p2","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder(),L=o.i32_const(c.alloc(l*3));F.addCode(o.call(i+"_negAffine",o.getLocal("p2"),L),o.call(i+"_addAffine",o.getLocal("p1"),L,o.getLocal("pr")))}function S(){const F=c.addFunction(i+"_normalize");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l)),p=o.i32_add(o.getLocal("p1"),o.i32_const(l*2)),st=o.getLocal("pr"),qt=o.i32_add(o.getLocal("pr"),o.i32_const(l)),wt=o.i32_add(o.getLocal("pr"),o.i32_const(l*2)),nt=o.i32_const(c.alloc(l)),Q=o.i32_const(c.alloc(l)),A=o.i32_const(c.alloc(l));F.addCode(o.if(o.call(i+"_isZero",o.getLocal("p1")),o.call(i+"_zero",o.getLocal("pr")),[...o.call(r+"_inverse",p,nt),...o.call(r+"_square",nt,Q),...o.call(r+"_mul",nt,Q,A),...o.call(r+"_mul",L,Q,st),...o.call(r+"_mul",U,A,qt),...o.call(r+"_one",wt)]))}function et(){const F=c.addFunction(i+"_toAffine");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l)),p=o.i32_add(o.getLocal("p1"),o.i32_const(l*2)),st=o.getLocal("pr"),qt=o.i32_add(o.getLocal("pr"),o.i32_const(l)),wt=o.i32_const(c.alloc(l)),nt=o.i32_const(c.alloc(l)),Q=o.i32_const(c.alloc(l));F.addCode(o.if(o.call(i+"_isZero",o.getLocal("p1")),[...o.call(r+"_zero",st),...o.call(r+"_zero",qt)],[...o.call(r+"_inverse",p,wt),...o.call(r+"_square",wt,nt),...o.call(r+"_mul",wt,nt,Q),...o.call(r+"_mul",L,nt,st),...o.call(r+"_mul",U,Q,qt)]))}function _t(){const F=c.addFunction(i+"_toJacobian");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l)),p=o.getLocal("pr"),st=o.i32_add(o.getLocal("pr"),o.i32_const(l)),qt=o.i32_add(o.getLocal("pr"),o.i32_const(l*2));F.addCode(o.if(o.call(i+"_isZeroAffine",o.getLocal("p1")),o.call(i+"_zero",o.getLocal("pr")),[...o.call(r+"_one",qt),...o.call(r+"_copy",U,st),...o.call(r+"_copy",L,p)]))}function mt(){const F=c.addFunction(i+"_batchToAffine");F.addParam("pIn","i32"),F.addParam("n","i32"),F.addParam("pOut","i32"),F.addLocal("pAux","i32"),F.addLocal("itIn","i32"),F.addLocal("itAux","i32"),F.addLocal("itOut","i32"),F.addLocal("i","i32");const o=F.getCodeBuilder(),L=o.i32_const(c.alloc(l));F.addCode(o.setLocal("pAux",o.i32_load(o.i32_const(0))),o.i32_store(o.i32_const(0),o.i32_add(o.getLocal("pAux"),o.i32_mul(o.getLocal("n"),o.i32_const(l)))),o.call(r+"_batchInverse",o.i32_add(o.getLocal("pIn"),o.i32_const(l*2)),o.i32_const(l*3),o.getLocal("n"),o.getLocal("pAux"),o.i32_const(l)),o.setLocal("itIn",o.getLocal("pIn")),o.setLocal("itAux",o.getLocal("pAux")),o.setLocal("itOut",o.getLocal("pOut")),o.setLocal("i",o.i32_const(0)),o.block(o.loop(o.br_if(1,o.i32_eq(o.getLocal("i"),o.getLocal("n"))),o.if(o.call(r+"_isZero",o.getLocal("itAux")),[...o.call(r+"_zero",o.getLocal("itOut")),...o.call(r+"_zero",o.i32_add(o.getLocal("itOut"),o.i32_const(l)))],[...o.call(r+"_mul",o.getLocal("itAux"),o.i32_add(o.getLocal("itIn"),o.i32_const(l)),L),...o.call(r+"_square",o.getLocal("itAux"),o.getLocal("itAux")),...o.call(r+"_mul",o.getLocal("itAux"),o.getLocal("itIn"),o.getLocal("itOut")),...o.call(r+"_mul",o.getLocal("itAux"),L,o.i32_add(o.getLocal("itOut"),o.i32_const(l)))]),o.setLocal("itIn",o.i32_add(o.getLocal("itIn"),o.i32_const(l*3))),o.setLocal("itOut",o.i32_add(o.getLocal("itOut"),o.i32_const(l*2))),o.setLocal("itAux",o.i32_add(o.getLocal("itAux"),o.i32_const(l))),o.setLocal("i",o.i32_add(o.getLocal("i"),o.i32_const(1))),o.br(0))),o.i32_store(o.i32_const(0),o.getLocal("pAux")))}function xt(){const F=c.addFunction(i+"__reverseBytes");F.addParam("pIn","i32"),F.addParam("n","i32"),F.addParam("pOut","i32"),F.addLocal("itOut","i32"),F.addLocal("itIn","i32");const o=F.getCodeBuilder();F.addCode(o.setLocal("itOut",o.i32_sub(o.i32_add(o.getLocal("pOut"),o.getLocal("n")),o.i32_const(1))),o.setLocal("itIn",o.getLocal("pIn")),o.block(o.loop(o.br_if(1,o.i32_lt_s(o.getLocal("itOut"),o.getLocal("pOut"))),o.i32_store8(o.getLocal("itOut"),o.i32_load8_u(o.getLocal("itIn"))),o.setLocal("itOut",o.i32_sub(o.getLocal("itOut"),o.i32_const(1))),o.setLocal("itIn",o.i32_add(o.getLocal("itIn"),o.i32_const(1))),o.br(0))))}function Pt(){const F=c.addFunction(i+"_LEMtoC");F.addParam("pIn","i32"),F.addParam("pOut","i32");const o=F.getCodeBuilder(),L=o.i32_const(c.alloc(l));F.addCode(o.if(o.call(i+"_isZero",o.getLocal("pIn")),[...o.call(r+"_zero",o.getLocal("pOut")),...o.i32_store8(o.getLocal("pOut"),o.i32_const(64)),...o.ret([])]),o.call(r+"_fromMontgomery",o.getLocal("pIn"),L),o.call(i+"__reverseBytes",L,o.i32_const(l),o.getLocal("pOut")),o.if(o.i32_eq(o.call(r+"_sign",o.i32_add(o.getLocal("pIn"),o.i32_const(l))),o.i32_const(-1)),o.i32_store8(o.getLocal("pOut"),o.i32_or(o.i32_load8_u(o.getLocal("pOut")),o.i32_const(128)))))}function zt(){const F=c.addFunction(i+"_LEMtoU");F.addParam("pIn","i32"),F.addParam("pOut","i32");const o=F.getCodeBuilder(),L=c.alloc(l*2),U=o.i32_const(L),p=o.i32_const(L),st=o.i32_const(L+l);F.addCode(o.if(o.call(i+"_isZeroAffine",o.getLocal("pIn")),[...o.call(i+"_zeroAffine",o.getLocal("pOut")),...o.i32_store8(o.getLocal("pOut"),o.i32_const(64)),...o.ret([])]),o.call(i+"_fromMontgomeryAffine",o.getLocal("pIn"),U),o.call(i+"__reverseBytes",p,o.i32_const(l),o.getLocal("pOut")),o.call(i+"__reverseBytes",st,o.i32_const(l),o.i32_add(o.getLocal("pOut"),o.i32_const(l))))}function Rt(){const F=c.addFunction(i+"_UtoLEM");F.addParam("pIn","i32"),F.addParam("pOut","i32");const o=F.getCodeBuilder(),L=c.alloc(l*2),U=o.i32_const(L),p=o.i32_const(L),st=o.i32_const(L+l);F.addCode(o.if(o.i32_and(o.i32_load8_u(o.getLocal("pIn")),o.i32_const(64)),[...o.call(i+"_zeroAffine",o.getLocal("pOut")),...o.ret([])]),o.call(i+"__reverseBytes",o.getLocal("pIn"),o.i32_const(l),p),o.call(i+"__reverseBytes",o.i32_add(o.getLocal("pIn"),o.i32_const(l)),o.i32_const(l),st),o.call(i+"_toMontgomeryAffine",U,o.getLocal("pOut")))}function k(){const F=c.addFunction(i+"_CtoLEM");F.addParam("pIn","i32"),F.addParam("pOut","i32"),F.addLocal("firstByte","i32"),F.addLocal("greatest","i32");const o=F.getCodeBuilder(),L=c.alloc(l*2),U=o.i32_const(L),p=o.i32_const(L+l);F.addCode(o.setLocal("firstByte",o.i32_load8_u(o.getLocal("pIn"))),o.if(o.i32_and(o.getLocal("firstByte"),o.i32_const(64)),[...o.call(i+"_zeroAffine",o.getLocal("pOut")),...o.ret([])]),o.setLocal("greatest",o.i32_and(o.getLocal("firstByte"),o.i32_const(128))),o.call(r+"_copy",o.getLocal("pIn"),p),o.i32_store8(p,o.i32_and(o.getLocal("firstByte"),o.i32_const(63))),o.call(i+"__reverseBytes",p,o.i32_const(l),U),o.call(r+"_toMontgomery",U,o.getLocal("pOut")),o.call(r+"_square",o.getLocal("pOut"),p),o.call(r+"_mul",o.getLocal("pOut"),p,p),o.call(r+"_add",p,o.i32_const(_),p),o.call(r+"_sqrt",p,p),o.call(r+"_neg",p,U),o.if(o.i32_eq(o.call(r+"_sign",p),o.i32_const(-1)),o.if(o.getLocal("greatest"),o.call(r+"_copy",p,o.i32_add(o.getLocal("pOut"),o.i32_const(l))),o.call(r+"_neg",p,o.i32_add(o.getLocal("pOut"),o.i32_const(l)))),o.if(o.getLocal("greatest"),o.call(r+"_neg",p,o.i32_add(o.getLocal("pOut"),o.i32_const(l))),o.call(r+"_copy",p,o.i32_add(o.getLocal("pOut"),o.i32_const(l))))))}function Ct(){const F=c.addFunction(i+"_inCurveAffine");F.addParam("pIn","i32"),F.setReturnType("i32");const o=F.getCodeBuilder(),L=o.getLocal("pIn"),U=o.i32_add(o.getLocal("pIn"),o.i32_const(l)),p=o.i32_const(c.alloc(l)),st=o.i32_const(c.alloc(l));F.addCode(o.call(r+"_square",U,p),o.call(r+"_square",L,st),o.call(r+"_mul",L,st,st),o.call(r+"_add",st,o.i32_const(_),st),o.ret(o.call(r+"_eq",p,st)))}function St(){const F=c.addFunction(i+"_inCurve");F.addParam("pIn","i32"),F.setReturnType("i32");const o=F.getCodeBuilder(),L=o.i32_const(c.alloc(l*2));F.addCode(o.call(i+"_toAffine",o.getLocal("pIn"),L),o.ret(o.call(i+"_inCurveAffine",L)))}return I(),s(),O(),w(),f(),b(),_t(),Z(),G(),D(),it(),V(),x(),g(),q(),T(),H(),v(),P(),N(),y(),h(),M(),E(),et(),Ct(),St(),mt(),S(),xt(),zt(),Pt(),Rt(),k(),a(c,i+"_batchLEMtoU",i+"_LEMtoU",l*2,l*2),a(c,i+"_batchLEMtoC",i+"_LEMtoC",l*2,l),a(c,i+"_batchUtoLEM",i+"_UtoLEM",l*2,l*2),a(c,i+"_batchCtoLEM",i+"_CtoLEM",l,l*2,!0),a(c,i+"_batchToJacobian",i+"_toJacobian",l*2,l*3,!0),n(c,i,i+"_multiexp",i+"_add",l*3),n(c,i,i+"_multiexpAffine",i+"_addMixed",l*2),t(c,i+"_timesScalar",l*3,i+"_add",i+"_double",i+"_sub",i+"_copy",i+"_zero"),t(c,i+"_timesScalarAffine",l*2,i+"_addMixed",i+"_double",i+"_subMixed",i+"_copyAffine",i+"_zero"),c.exportFunction(i+"_isZero"),c.exportFunction(i+"_isZeroAffine"),c.exportFunction(i+"_eq"),c.exportFunction(i+"_eqMixed"),c.exportFunction(i+"_eqAffine"),c.exportFunction(i+"_copy"),c.exportFunction(i+"_copyAffine"),c.exportFunction(i+"_zero"),c.exportFunction(i+"_zeroAffine"),c.exportFunction(i+"_double"),c.exportFunction(i+"_doubleAffine"),c.exportFunction(i+"_add"),c.exportFunction(i+"_addMixed"),c.exportFunction(i+"_addAffine"),c.exportFunction(i+"_neg"),c.exportFunction(i+"_negAffine"),c.exportFunction(i+"_sub"),c.exportFunction(i+"_subMixed"),c.exportFunction(i+"_subAffine"),c.exportFunction(i+"_fromMontgomery"),c.exportFunction(i+"_fromMontgomeryAffine"),c.exportFunction(i+"_toMontgomery"),c.exportFunction(i+"_toMontgomeryAffine"),c.exportFunction(i+"_timesScalar"),c.exportFunction(i+"_timesScalarAffine"),c.exportFunction(i+"_normalize"),c.exportFunction(i+"_LEMtoU"),c.exportFunction(i+"_LEMtoC"),c.exportFunction(i+"_UtoLEM"),c.exportFunction(i+"_CtoLEM"),c.exportFunction(i+"_batchLEMtoU"),c.exportFunction(i+"_batchLEMtoC"),c.exportFunction(i+"_batchUtoLEM"),c.exportFunction(i+"_batchCtoLEM"),c.exportFunction(i+"_toAffine"),c.exportFunction(i+"_toJacobian"),c.exportFunction(i+"_batchToAffine"),c.exportFunction(i+"_batchToJacobian"),c.exportFunction(i+"_inCurve"),c.exportFunction(i+"_inCurveAffine"),i},ae}var oe,vc;function Bc(){if(vc)return oe;vc=1;const{isOdd:t,modInv:a,modPow:n}=$a(),e=Qa();return oe=function(i,r,_,u,l){const I=i.modules[u].n64*8,f=i.modules[_].n64*8,w=i.modules[u].q;let O=w-1n,D=0;for(;!t(O);)D++,O=O>>1n;let G=2n;for(;n(G,w>>1n,w)===1n;)G=G+1n;const V=new Array(D+1);V[D]=n(G,O,w);let it=D-1;for(;it>=0;)V[it]=n(V[it+1],2n,w),it--;const Z=[],E=(1n<<BigInt(I*8))%w;for(let U=0;U<V.length;U++){const p=V[U]*E%w;Z.push(...e.bigInt2BytesLE(p,I))}const M=i.alloc(Z),h=new Array(D+1);h[0]=1n;for(let U=1;U<=D;U++)h[U]=h[U-1]*2n;const y=[];for(let U=0;U<=D;U++){const p=a(h[U],w)*E%w;y.push(...e.bigInt2BytesLE(p,I))}const q=i.alloc(y),g=n(G,2n,w),x=[],H=[];for(let U=0;U<=D;U++){const p=n(g,2n**BigInt(U),w),st=a(w+1n-p,w);x.push(...e.bigInt2BytesLE(p*E%w,I)),H.push(...e.bigInt2BytesLE(st*E%w,I))}const T=i.alloc(x),N=i.alloc(H);function P(U){let p=0;for(let st=0;st<8;st++)U&1<<st&&(p=p|128>>st);return p}const v=Array(256);for(let U=0;U<256;U++)v[U]=P(U);const S=i.alloc(v);function et(){const U=i.addFunction(r+"__log2");U.addParam("n","i32"),U.setReturnType("i32"),U.addLocal("bits","i32"),U.addLocal("aux","i32");const p=U.getCodeBuilder();U.addCode(p.setLocal("aux",p.i32_shr_u(p.getLocal("n"),p.i32_const(1)))),U.addCode(p.setLocal("bits",p.i32_const(0))),U.addCode(p.block(p.loop(p.br_if(1,p.i32_eqz(p.getLocal("aux"))),p.setLocal("aux",p.i32_shr_u(p.getLocal("aux"),p.i32_const(1))),p.setLocal("bits",p.i32_add(p.getLocal("bits"),p.i32_const(1))),p.br(0)))),U.addCode(p.if(p.i32_ne(p.getLocal("n"),p.i32_shl(p.i32_const(1),p.getLocal("bits"))),p.unreachable())),U.addCode(p.if(p.i32_gt_u(p.getLocal("bits"),p.i32_const(D)),p.unreachable())),U.addCode(p.getLocal("bits"))}function _t(){const U=i.addFunction(r+"_fft");U.addParam("px","i32"),U.addParam("n","i32"),U.addLocal("bits","i32");const p=U.getCodeBuilder(),st=p.i32_const(i.alloc(I));U.addCode(p.setLocal("bits",p.call(r+"__log2",p.getLocal("n"))),p.call(u+"_one",st),p.call(r+"_rawfft",p.getLocal("px"),p.getLocal("bits"),p.i32_const(0),st))}function mt(){const U=i.addFunction(r+"_ifft");U.addParam("px","i32"),U.addParam("n","i32"),U.addLocal("bits","i32"),U.addLocal("pInv2","i32");const p=U.getCodeBuilder();U.addCode(p.setLocal("bits",p.call(r+"__log2",p.getLocal("n"))),p.setLocal("pInv2",p.i32_add(p.i32_const(q),p.i32_mul(p.getLocal("bits"),p.i32_const(I)))),p.call(r+"_rawfft",p.getLocal("px"),p.getLocal("bits"),p.i32_const(1),p.getLocal("pInv2")))}function xt(){const U=i.addFunction(r+"_rawfft");U.addParam("px","i32"),U.addParam("bits","i32"),U.addParam("reverse","i32"),U.addParam("mulFactor","i32"),U.addLocal("s","i32"),U.addLocal("k","i32"),U.addLocal("j","i32"),U.addLocal("m","i32"),U.addLocal("mdiv2","i32"),U.addLocal("n","i32"),U.addLocal("pwm","i32"),U.addLocal("idx1","i32"),U.addLocal("idx2","i32");const p=U.getCodeBuilder(),st=p.i32_const(i.alloc(I)),qt=p.i32_const(i.alloc(f)),wt=p.i32_const(i.alloc(f));U.addCode(p.call(r+"__reversePermutation",p.getLocal("px"),p.getLocal("bits")),p.setLocal("n",p.i32_shl(p.i32_const(1),p.getLocal("bits"))),p.setLocal("s",p.i32_const(1)),p.block(p.loop(p.br_if(1,p.i32_gt_u(p.getLocal("s"),p.getLocal("bits"))),p.setLocal("m",p.i32_shl(p.i32_const(1),p.getLocal("s"))),p.setLocal("pwm",p.i32_add(p.i32_const(M),p.i32_mul(p.getLocal("s"),p.i32_const(I)))),p.setLocal("k",p.i32_const(0)),p.block(p.loop(p.br_if(1,p.i32_ge_u(p.getLocal("k"),p.getLocal("n"))),p.call(u+"_one",st),p.setLocal("mdiv2",p.i32_shr_u(p.getLocal("m"),p.i32_const(1))),p.setLocal("j",p.i32_const(0)),p.block(p.loop(p.br_if(1,p.i32_ge_u(p.getLocal("j"),p.getLocal("mdiv2"))),p.setLocal("idx1",p.i32_add(p.getLocal("px"),p.i32_mul(p.i32_add(p.getLocal("k"),p.getLocal("j")),p.i32_const(f)))),p.setLocal("idx2",p.i32_add(p.getLocal("idx1"),p.i32_mul(p.getLocal("mdiv2"),p.i32_const(f)))),p.call(l,p.getLocal("idx2"),st,qt),p.call(_+"_copy",p.getLocal("idx1"),wt),p.call(_+"_add",wt,qt,p.getLocal("idx1")),p.call(_+"_sub",wt,qt,p.getLocal("idx2")),p.call(u+"_mul",st,p.getLocal("pwm"),st),p.setLocal("j",p.i32_add(p.getLocal("j"),p.i32_const(1))),p.br(0))),p.setLocal("k",p.i32_add(p.getLocal("k"),p.getLocal("m"))),p.br(0))),p.setLocal("s",p.i32_add(p.getLocal("s"),p.i32_const(1))),p.br(0))),p.call(r+"__fftFinal",p.getLocal("px"),p.getLocal("bits"),p.getLocal("reverse"),p.getLocal("mulFactor")))}function Pt(){const U=i.addFunction(r+"__fftFinal");U.addParam("px","i32"),U.addParam("bits","i32"),U.addParam("reverse","i32"),U.addParam("mulFactor","i32"),U.addLocal("n","i32"),U.addLocal("ndiv2","i32"),U.addLocal("pInv2","i32"),U.addLocal("i","i32"),U.addLocal("mask","i32"),U.addLocal("idx1","i32"),U.addLocal("idx2","i32");const p=U.getCodeBuilder(),st=p.i32_const(i.alloc(f));U.addCode(p.if(p.i32_and(p.i32_eqz(p.getLocal("reverse")),p.call(u+"_isOne",p.getLocal("mulFactor"))),p.ret([])),p.setLocal("n",p.i32_shl(p.i32_const(1),p.getLocal("bits"))),p.setLocal("mask",p.i32_sub(p.getLocal("n"),p.i32_const(1))),p.setLocal("i",p.i32_const(1)),p.setLocal("ndiv2",p.i32_shr_u(p.getLocal("n"),p.i32_const(1))),p.block(p.loop(p.br_if(1,p.i32_ge_u(p.getLocal("i"),p.getLocal("ndiv2"))),p.setLocal("idx1",p.i32_add(p.getLocal("px"),p.i32_mul(p.getLocal("i"),p.i32_const(f)))),p.setLocal("idx2",p.i32_add(p.getLocal("px"),p.i32_mul(p.i32_sub(p.getLocal("n"),p.getLocal("i")),p.i32_const(f)))),p.if(p.getLocal("reverse"),p.if(p.call(u+"_isOne",p.getLocal("mulFactor")),[...p.call(_+"_copy",p.getLocal("idx1"),st),...p.call(_+"_copy",p.getLocal("idx2"),p.getLocal("idx1")),...p.call(_+"_copy",st,p.getLocal("idx2"))],[...p.call(_+"_copy",p.getLocal("idx1"),st),...p.call(l,p.getLocal("idx2"),p.getLocal("mulFactor"),p.getLocal("idx1")),...p.call(l,st,p.getLocal("mulFactor"),p.getLocal("idx2"))]),p.if(p.call(u+"_isOne",p.getLocal("mulFactor")),[],[...p.call(l,p.getLocal("idx1"),p.getLocal("mulFactor"),p.getLocal("idx1")),...p.call(l,p.getLocal("idx2"),p.getLocal("mulFactor"),p.getLocal("idx2"))])),p.setLocal("i",p.i32_add(p.getLocal("i"),p.i32_const(1))),p.br(0))),p.if(p.call(u+"_isOne",p.getLocal("mulFactor")),[],[...p.call(l,p.getLocal("px"),p.getLocal("mulFactor"),p.getLocal("px")),...p.setLocal("idx2",p.i32_add(p.getLocal("px"),p.i32_mul(p.getLocal("ndiv2"),p.i32_const(f)))),...p.call(l,p.getLocal("idx2"),p.getLocal("mulFactor"),p.getLocal("idx2"))]))}function zt(){const U=i.addFunction(r+"__reversePermutation");U.addParam("px","i32"),U.addParam("bits","i32"),U.addLocal("n","i32"),U.addLocal("i","i32"),U.addLocal("ri","i32"),U.addLocal("idx1","i32"),U.addLocal("idx2","i32");const p=U.getCodeBuilder(),st=p.i32_const(i.alloc(f));U.addCode(p.setLocal("n",p.i32_shl(p.i32_const(1),p.getLocal("bits"))),p.setLocal("i",p.i32_const(0)),p.block(p.loop(p.br_if(1,p.i32_eq(p.getLocal("i"),p.getLocal("n"))),p.setLocal("idx1",p.i32_add(p.getLocal("px"),p.i32_mul(p.getLocal("i"),p.i32_const(f)))),p.setLocal("ri",p.call(r+"__rev",p.getLocal("i"),p.getLocal("bits"))),p.setLocal("idx2",p.i32_add(p.getLocal("px"),p.i32_mul(p.getLocal("ri"),p.i32_const(f)))),p.if(p.i32_lt_u(p.getLocal("i"),p.getLocal("ri")),[...p.call(_+"_copy",p.getLocal("idx1"),st),...p.call(_+"_copy",p.getLocal("idx2"),p.getLocal("idx1")),...p.call(_+"_copy",st,p.getLocal("idx2"))]),p.setLocal("i",p.i32_add(p.getLocal("i"),p.i32_const(1))),p.br(0))))}function Rt(){const U=i.addFunction(r+"__rev");U.addParam("x","i32"),U.addParam("bits","i32"),U.setReturnType("i32");const p=U.getCodeBuilder();U.addCode(p.i32_rotl(p.i32_add(p.i32_add(p.i32_shl(p.i32_load8_u(p.i32_and(p.getLocal("x"),p.i32_const(255)),S,0),p.i32_const(24)),p.i32_shl(p.i32_load8_u(p.i32_and(p.i32_shr_u(p.getLocal("x"),p.i32_const(8)),p.i32_const(255)),S,0),p.i32_const(16))),p.i32_add(p.i32_shl(p.i32_load8_u(p.i32_and(p.i32_shr_u(p.getLocal("x"),p.i32_const(16)),p.i32_const(255)),S,0),p.i32_const(8)),p.i32_load8_u(p.i32_and(p.i32_shr_u(p.getLocal("x"),p.i32_const(24)),p.i32_const(255)),S,0))),p.getLocal("bits")))}function k(){const U=i.addFunction(r+"_fftJoin");U.addParam("pBuff1","i32"),U.addParam("pBuff2","i32"),U.addParam("n","i32"),U.addParam("first","i32"),U.addParam("inc","i32"),U.addLocal("idx1","i32"),U.addLocal("idx2","i32"),U.addLocal("i","i32");const p=U.getCodeBuilder(),st=p.i32_const(i.alloc(I)),qt=p.i32_const(i.alloc(f)),wt=p.i32_const(i.alloc(f));U.addCode(p.call(u+"_copy",p.getLocal("first"),st),p.setLocal("i",p.i32_const(0)),p.block(p.loop(p.br_if(1,p.i32_eq(p.getLocal("i"),p.getLocal("n"))),p.setLocal("idx1",p.i32_add(p.getLocal("pBuff1"),p.i32_mul(p.getLocal("i"),p.i32_const(f)))),p.setLocal("idx2",p.i32_add(p.getLocal("pBuff2"),p.i32_mul(p.getLocal("i"),p.i32_const(f)))),p.call(l,p.getLocal("idx2"),st,qt),p.call(_+"_copy",p.getLocal("idx1"),wt),p.call(_+"_add",wt,qt,p.getLocal("idx1")),p.call(_+"_sub",wt,qt,p.getLocal("idx2")),p.call(u+"_mul",st,p.getLocal("inc"),st),p.setLocal("i",p.i32_add(p.getLocal("i"),p.i32_const(1))),p.br(0))))}function Ct(){const U=i.addFunction(r+"_fftJoinExt");U.addParam("pBuff1","i32"),U.addParam("pBuff2","i32"),U.addParam("n","i32"),U.addParam("first","i32"),U.addParam("inc","i32"),U.addParam("totalBits","i32"),U.addLocal("idx1","i32"),U.addLocal("idx2","i32"),U.addLocal("i","i32"),U.addLocal("pShiftToM","i32");const p=U.getCodeBuilder(),st=p.i32_const(i.alloc(I)),qt=p.i32_const(i.alloc(f));U.addCode(p.setLocal("pShiftToM",p.i32_add(p.i32_const(T),p.i32_mul(p.getLocal("totalBits"),p.i32_const(I)))),p.call(u+"_copy",p.getLocal("first"),st),p.setLocal("i",p.i32_const(0)),p.block(p.loop(p.br_if(1,p.i32_eq(p.getLocal("i"),p.getLocal("n"))),p.setLocal("idx1",p.i32_add(p.getLocal("pBuff1"),p.i32_mul(p.getLocal("i"),p.i32_const(f)))),p.setLocal("idx2",p.i32_add(p.getLocal("pBuff2"),p.i32_mul(p.getLocal("i"),p.i32_const(f)))),p.call(_+"_add",p.getLocal("idx1"),p.getLocal("idx2"),qt),p.call(l,p.getLocal("idx2"),p.getLocal("pShiftToM"),p.getLocal("idx2")),p.call(_+"_add",p.getLocal("idx1"),p.getLocal("idx2"),p.getLocal("idx2")),p.call(l,p.getLocal("idx2"),st,p.getLocal("idx2")),p.call(_+"_copy",qt,p.getLocal("idx1")),p.call(u+"_mul",st,p.getLocal("inc"),st),p.setLocal("i",p.i32_add(p.getLocal("i"),p.i32_const(1))),p.br(0))))}function St(){const U=i.addFunction(r+"_fftJoinExtInv");U.addParam("pBuff1","i32"),U.addParam("pBuff2","i32"),U.addParam("n","i32"),U.addParam("first","i32"),U.addParam("inc","i32"),U.addParam("totalBits","i32"),U.addLocal("idx1","i32"),U.addLocal("idx2","i32"),U.addLocal("i","i32"),U.addLocal("pShiftToM","i32"),U.addLocal("pSConst","i32");const p=U.getCodeBuilder(),st=p.i32_const(i.alloc(I)),qt=p.i32_const(i.alloc(f));U.addCode(p.setLocal("pShiftToM",p.i32_add(p.i32_const(T),p.i32_mul(p.getLocal("totalBits"),p.i32_const(I)))),p.setLocal("pSConst",p.i32_add(p.i32_const(N),p.i32_mul(p.getLocal("totalBits"),p.i32_const(I)))),p.call(u+"_copy",p.getLocal("first"),st),p.setLocal("i",p.i32_const(0)),p.block(p.loop(p.br_if(1,p.i32_eq(p.getLocal("i"),p.getLocal("n"))),p.setLocal("idx1",p.i32_add(p.getLocal("pBuff1"),p.i32_mul(p.getLocal("i"),p.i32_const(f)))),p.setLocal("idx2",p.i32_add(p.getLocal("pBuff2"),p.i32_mul(p.getLocal("i"),p.i32_const(f)))),p.call(l,p.getLocal("idx2"),st,qt),p.call(_+"_sub",p.getLocal("idx1"),qt,p.getLocal("idx2")),p.call(l,p.getLocal("idx2"),p.getLocal("pSConst"),p.getLocal("idx2")),p.call(l,p.getLocal("idx1"),p.getLocal("pShiftToM"),p.getLocal("idx1")),p.call(_+"_sub",qt,p.getLocal("idx1"),p.getLocal("idx1")),p.call(l,p.getLocal("idx1"),p.getLocal("pSConst"),p.getLocal("idx1")),p.call(u+"_mul",st,p.getLocal("inc"),st),p.setLocal("i",p.i32_add(p.getLocal("i"),p.i32_const(1))),p.br(0))))}function F(){const U=i.addFunction(r+"_prepareLagrangeEvaluation");U.addParam("pBuff1","i32"),U.addParam("pBuff2","i32"),U.addParam("n","i32"),U.addParam("first","i32"),U.addParam("inc","i32"),U.addParam("totalBits","i32"),U.addLocal("idx1","i32"),U.addLocal("idx2","i32"),U.addLocal("i","i32"),U.addLocal("pShiftToM","i32"),U.addLocal("pSConst","i32");const p=U.getCodeBuilder(),st=p.i32_const(i.alloc(I)),qt=p.i32_const(i.alloc(f));U.addCode(p.setLocal("pShiftToM",p.i32_add(p.i32_const(T),p.i32_mul(p.getLocal("totalBits"),p.i32_const(I)))),p.setLocal("pSConst",p.i32_add(p.i32_const(N),p.i32_mul(p.getLocal("totalBits"),p.i32_const(I)))),p.call(u+"_copy",p.getLocal("first"),st),p.setLocal("i",p.i32_const(0)),p.block(p.loop(p.br_if(1,p.i32_eq(p.getLocal("i"),p.getLocal("n"))),p.setLocal("idx1",p.i32_add(p.getLocal("pBuff1"),p.i32_mul(p.getLocal("i"),p.i32_const(f)))),p.setLocal("idx2",p.i32_add(p.getLocal("pBuff2"),p.i32_mul(p.getLocal("i"),p.i32_const(f)))),p.call(l,p.getLocal("idx1"),p.getLocal("pShiftToM"),qt),p.call(_+"_sub",p.getLocal("idx2"),qt,qt),p.call(_+"_sub",p.getLocal("idx1"),p.getLocal("idx2"),p.getLocal("idx2")),p.call(l,qt,p.getLocal("pSConst"),p.getLocal("idx1")),p.call(l,p.getLocal("idx2"),st,p.getLocal("idx2")),p.call(u+"_mul",st,p.getLocal("inc"),st),p.setLocal("i",p.i32_add(p.getLocal("i"),p.i32_const(1))),p.br(0))))}function o(){const U=i.addFunction(r+"_fftMix");U.addParam("pBuff","i32"),U.addParam("n","i32"),U.addParam("exp","i32"),U.addLocal("nGroups","i32"),U.addLocal("nPerGroup","i32"),U.addLocal("nPerGroupDiv2","i32"),U.addLocal("pairOffset","i32"),U.addLocal("idx1","i32"),U.addLocal("idx2","i32"),U.addLocal("i","i32"),U.addLocal("j","i32"),U.addLocal("pwm","i32");const p=U.getCodeBuilder(),st=p.i32_const(i.alloc(I)),qt=p.i32_const(i.alloc(f)),wt=p.i32_const(i.alloc(f));U.addCode(p.setLocal("nPerGroup",p.i32_shl(p.i32_const(1),p.getLocal("exp"))),p.setLocal("nPerGroupDiv2",p.i32_shr_u(p.getLocal("nPerGroup"),p.i32_const(1))),p.setLocal("nGroups",p.i32_shr_u(p.getLocal("n"),p.getLocal("exp"))),p.setLocal("pairOffset",p.i32_mul(p.getLocal("nPerGroupDiv2"),p.i32_const(f))),p.setLocal("pwm",p.i32_add(p.i32_const(M),p.i32_mul(p.getLocal("exp"),p.i32_const(I)))),p.setLocal("i",p.i32_const(0)),p.block(p.loop(p.br_if(1,p.i32_eq(p.getLocal("i"),p.getLocal("nGroups"))),p.call(u+"_one",st),p.setLocal("j",p.i32_const(0)),p.block(p.loop(p.br_if(1,p.i32_eq(p.getLocal("j"),p.getLocal("nPerGroupDiv2"))),p.setLocal("idx1",p.i32_add(p.getLocal("pBuff"),p.i32_mul(p.i32_add(p.i32_mul(p.getLocal("i"),p.getLocal("nPerGroup")),p.getLocal("j")),p.i32_const(f)))),p.setLocal("idx2",p.i32_add(p.getLocal("idx1"),p.getLocal("pairOffset"))),p.call(l,p.getLocal("idx2"),st,qt),p.call(_+"_copy",p.getLocal("idx1"),wt),p.call(_+"_add",wt,qt,p.getLocal("idx1")),p.call(_+"_sub",wt,qt,p.getLocal("idx2")),p.call(u+"_mul",st,p.getLocal("pwm"),st),p.setLocal("j",p.i32_add(p.getLocal("j"),p.i32_const(1))),p.br(0))),p.setLocal("i",p.i32_add(p.getLocal("i"),p.i32_const(1))),p.br(0))))}function L(){const U=i.addFunction(r+"_fftFinal");U.addParam("pBuff","i32"),U.addParam("n","i32"),U.addParam("factor","i32"),U.addLocal("idx1","i32"),U.addLocal("idx2","i32"),U.addLocal("i","i32"),U.addLocal("ndiv2","i32");const p=U.getCodeBuilder(),st=p.i32_const(i.alloc(f));U.addCode(p.setLocal("ndiv2",p.i32_shr_u(p.getLocal("n"),p.i32_const(1))),p.if(p.i32_and(p.getLocal("n"),p.i32_const(1)),p.call(l,p.i32_add(p.getLocal("pBuff"),p.i32_mul(p.getLocal("ndiv2"),p.i32_const(f))),p.getLocal("factor"),p.i32_add(p.getLocal("pBuff"),p.i32_mul(p.getLocal("ndiv2"),p.i32_const(f))))),p.setLocal("i",p.i32_const(0)),p.block(p.loop(p.br_if(1,p.i32_ge_u(p.getLocal("i"),p.getLocal("ndiv2"))),p.setLocal("idx1",p.i32_add(p.getLocal("pBuff"),p.i32_mul(p.getLocal("i"),p.i32_const(f)))),p.setLocal("idx2",p.i32_add(p.getLocal("pBuff"),p.i32_mul(p.i32_sub(p.i32_sub(p.getLocal("n"),p.i32_const(1)),p.getLocal("i")),p.i32_const(f)))),p.call(l,p.getLocal("idx2"),p.getLocal("factor"),st),p.call(l,p.getLocal("idx1"),p.getLocal("factor"),p.getLocal("idx2")),p.call(_+"_copy",st,p.getLocal("idx1")),p.setLocal("i",p.i32_add(p.getLocal("i"),p.i32_const(1))),p.br(0))))}Rt(),zt(),Pt(),xt(),et(),_t(),mt(),k(),Ct(),St(),o(),L(),F(),i.exportFunction(r+"_fft"),i.exportFunction(r+"_ifft"),i.exportFunction(r+"_rawfft"),i.exportFunction(r+"_fftJoin"),i.exportFunction(r+"_fftJoinExt"),i.exportFunction(r+"_fftJoinExtInv"),i.exportFunction(r+"_fftMix"),i.exportFunction(r+"_fftFinal"),i.exportFunction(r+"_prepareLagrangeEvaluation")},oe}var ee,Ec;function Fc(){return Ec||(Ec=1,ee=function(a,n,e){const i=a.modules[e].n64*8;function r(){const u=a.addFunction(n+"_zero");u.addParam("px","i32"),u.addParam("n","i32"),u.addLocal("lastp","i32"),u.addLocal("p","i32");const l=u.getCodeBuilder();u.addCode(l.setLocal("p",l.getLocal("px")),l.setLocal("lastp",l.i32_add(l.getLocal("px"),l.i32_mul(l.getLocal("n"),l.i32_const(i)))),l.block(l.loop(l.br_if(1,l.i32_eq(l.getLocal("p"),l.getLocal("lastp"))),l.call(e+"_zero",l.getLocal("p")),l.setLocal("p",l.i32_add(l.getLocal("p"),l.i32_const(i))),l.br(0))))}function _(){const u=a.addFunction(n+"_constructLC");u.addParam("ppolynomials","i32"),u.addParam("psignals","i32"),u.addParam("nSignals","i32"),u.addParam("pres","i32"),u.addLocal("i","i32"),u.addLocal("j","i32"),u.addLocal("pp","i32"),u.addLocal("ps","i32"),u.addLocal("pd","i32"),u.addLocal("ncoefs","i32");const l=u.getCodeBuilder(),s=l.i32_const(a.alloc(i));u.addCode(l.setLocal("i",l.i32_const(0)),l.setLocal("pp",l.getLocal("ppolynomials")),l.setLocal("ps",l.getLocal("psignals")),l.block(l.loop(l.br_if(1,l.i32_eq(l.getLocal("i"),l.getLocal("nSignals"))),l.setLocal("ncoefs",l.i32_load(l.getLocal("pp"))),l.setLocal("pp",l.i32_add(l.getLocal("pp"),l.i32_const(4))),l.setLocal("j",l.i32_const(0)),l.block(l.loop(l.br_if(1,l.i32_eq(l.getLocal("j"),l.getLocal("ncoefs"))),l.setLocal("pd",l.i32_add(l.getLocal("pres"),l.i32_mul(l.i32_load(l.getLocal("pp")),l.i32_const(i)))),l.setLocal("pp",l.i32_add(l.getLocal("pp"),l.i32_const(4))),l.call(e+"_mul",l.getLocal("ps"),l.getLocal("pp"),s),l.call(e+"_add",s,l.getLocal("pd"),l.getLocal("pd")),l.setLocal("pp",l.i32_add(l.getLocal("pp"),l.i32_const(i))),l.setLocal("j",l.i32_add(l.getLocal("j"),l.i32_const(1))),l.br(0))),l.setLocal("ps",l.i32_add(l.getLocal("ps"),l.i32_const(i))),l.setLocal("i",l.i32_add(l.getLocal("i"),l.i32_const(1))),l.br(0))))}return r(),_(),a.exportFunction(n+"_zero"),a.exportFunction(n+"_constructLC"),n}),ee}var ie,xc;function Sc(){return xc||(xc=1,ie=function(a,n,e){const i=a.modules[e].n64*8;function r(){const l=a.addFunction(n+"_buildABC");l.addParam("pCoefs","i32"),l.addParam("nCoefs","i32"),l.addParam("pWitness","i32"),l.addParam("pA","i32"),l.addParam("pB","i32"),l.addParam("pC","i32"),l.addParam("offsetOut","i32"),l.addParam("nOut","i32"),l.addParam("offsetWitness","i32"),l.addParam("nWitness","i32"),l.addLocal("it","i32"),l.addLocal("ita","i32"),l.addLocal("itb","i32"),l.addLocal("last","i32"),l.addLocal("m","i32"),l.addLocal("c","i32"),l.addLocal("s","i32"),l.addLocal("pOut","i32");const s=l.getCodeBuilder(),I=s.i32_const(a.alloc(i));l.addCode(s.setLocal("ita",s.getLocal("pA")),s.setLocal("itb",s.getLocal("pB")),s.setLocal("last",s.i32_add(s.getLocal("pA"),s.i32_mul(s.getLocal("nOut"),s.i32_const(i)))),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal("ita"),s.getLocal("last"))),s.call(e+"_zero",s.getLocal("ita")),s.call(e+"_zero",s.getLocal("itb")),s.setLocal("ita",s.i32_add(s.getLocal("ita"),s.i32_const(i))),s.setLocal("itb",s.i32_add(s.getLocal("itb"),s.i32_const(i))),s.br(0))),s.setLocal("it",s.getLocal("pCoefs")),s.setLocal("last",s.i32_add(s.getLocal("pCoefs"),s.i32_mul(s.getLocal("nCoefs"),s.i32_const(i+12)))),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal("it"),s.getLocal("last"))),s.setLocal("s",s.i32_load(s.getLocal("it"),8)),s.if(s.i32_or(s.i32_lt_u(s.getLocal("s"),s.getLocal("offsetWitness")),s.i32_ge_u(s.getLocal("s"),s.i32_add(s.getLocal("offsetWitness"),s.getLocal("nWitness")))),[...s.setLocal("it",s.i32_add(s.getLocal("it"),s.i32_const(i+12))),...s.br(1)]),s.setLocal("m",s.i32_load(s.getLocal("it"))),s.if(s.i32_eq(s.getLocal("m"),s.i32_const(0)),s.setLocal("pOut",s.getLocal("pA")),s.if(s.i32_eq(s.getLocal("m"),s.i32_const(1)),s.setLocal("pOut",s.getLocal("pB")),[...s.setLocal("it",s.i32_add(s.getLocal("it"),s.i32_const(i+12))),...s.br(1)])),s.setLocal("c",s.i32_load(s.getLocal("it"),4)),s.if(s.i32_or(s.i32_lt_u(s.getLocal("c"),s.getLocal("offsetOut")),s.i32_ge_u(s.getLocal("c"),s.i32_add(s.getLocal("offsetOut"),s.getLocal("nOut")))),[...s.setLocal("it",s.i32_add(s.getLocal("it"),s.i32_const(i+12))),...s.br(1)]),s.setLocal("pOut",s.i32_add(s.getLocal("pOut"),s.i32_mul(s.i32_sub(s.getLocal("c"),s.getLocal("offsetOut")),s.i32_const(i)))),s.call(e+"_mul",s.i32_add(s.getLocal("pWitness"),s.i32_mul(s.i32_sub(s.getLocal("s"),s.getLocal("offsetWitness")),s.i32_const(i))),s.i32_add(s.getLocal("it"),s.i32_const(12)),I),s.call(e+"_add",s.getLocal("pOut"),I,s.getLocal("pOut")),s.setLocal("it",s.i32_add(s.getLocal("it"),s.i32_const(i+12))),s.br(0))),s.setLocal("ita",s.getLocal("pA")),s.setLocal("itb",s.getLocal("pB")),s.setLocal("it",s.getLocal("pC")),s.setLocal("last",s.i32_add(s.getLocal("pA"),s.i32_mul(s.getLocal("nOut"),s.i32_const(i)))),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal("ita"),s.getLocal("last"))),s.call(e+"_mul",s.getLocal("ita"),s.getLocal("itb"),s.getLocal("it")),s.setLocal("ita",s.i32_add(s.getLocal("ita"),s.i32_const(i))),s.setLocal("itb",s.i32_add(s.getLocal("itb"),s.i32_const(i))),s.setLocal("it",s.i32_add(s.getLocal("it"),s.i32_const(i))),s.br(0))))}function _(){const l=a.addFunction(n+"_joinABC");l.addParam("pA","i32"),l.addParam("pB","i32"),l.addParam("pC","i32"),l.addParam("n","i32"),l.addParam("pP","i32"),l.addLocal("ita","i32"),l.addLocal("itb","i32"),l.addLocal("itc","i32"),l.addLocal("itp","i32"),l.addLocal("last","i32");const s=l.getCodeBuilder(),I=s.i32_const(a.alloc(i));l.addCode(s.setLocal("ita",s.getLocal("pA")),s.setLocal("itb",s.getLocal("pB")),s.setLocal("itc",s.getLocal("pC")),s.setLocal("itp",s.getLocal("pP")),s.setLocal("last",s.i32_add(s.getLocal("pA"),s.i32_mul(s.getLocal("n"),s.i32_const(i)))),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal("ita"),s.getLocal("last"))),s.call(e+"_mul",s.getLocal("ita"),s.getLocal("itb"),I),s.call(e+"_sub",I,s.getLocal("itc"),s.getLocal("itp")),s.setLocal("ita",s.i32_add(s.getLocal("ita"),s.i32_const(i))),s.setLocal("itb",s.i32_add(s.getLocal("itb"),s.i32_const(i))),s.setLocal("itc",s.i32_add(s.getLocal("itc"),s.i32_const(i))),s.setLocal("itp",s.i32_add(s.getLocal("itp"),s.i32_const(i))),s.br(0))))}function u(){const l=a.addFunction(n+"_batchAdd");l.addParam("pa","i32"),l.addParam("pb","i32"),l.addParam("n","i32"),l.addParam("pr","i32"),l.addLocal("ita","i32"),l.addLocal("itb","i32"),l.addLocal("itr","i32"),l.addLocal("last","i32");const s=l.getCodeBuilder();l.addCode(s.setLocal("ita",s.getLocal("pa")),s.setLocal("itb",s.getLocal("pb")),s.setLocal("itr",s.getLocal("pr")),s.setLocal("last",s.i32_add(s.getLocal("pa"),s.i32_mul(s.getLocal("n"),s.i32_const(i)))),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal("ita"),s.getLocal("last"))),s.call(e+"_add",s.getLocal("ita"),s.getLocal("itb"),s.getLocal("itr")),s.setLocal("ita",s.i32_add(s.getLocal("ita"),s.i32_const(i))),s.setLocal("itb",s.i32_add(s.getLocal("itb"),s.i32_const(i))),s.setLocal("itr",s.i32_add(s.getLocal("itr"),s.i32_const(i))),s.br(0))))}return r(),_(),u(),a.exportFunction(n+"_buildABC"),a.exportFunction(n+"_joinABC"),a.exportFunction(n+"_batchAdd"),n}),ie}var ce,qc;function Pc(){return qc||(qc=1,ce=function(a,n,e,c,i,r,_,u){const l=a.addFunction(n);l.addParam("pIn","i32"),l.addParam("n","i32"),l.addParam("pFirst","i32"),l.addParam("pInc","i32"),l.addParam("pOut","i32"),l.addLocal("pOldFree","i32"),l.addLocal("i","i32"),l.addLocal("pFrom","i32"),l.addLocal("pTo","i32");const s=l.getCodeBuilder(),I=s.i32_const(a.alloc(_));l.addCode(s.setLocal("pFrom",s.getLocal("pIn")),s.setLocal("pTo",s.getLocal("pOut"))),l.addCode(s.call(c+"_copy",s.getLocal("pFirst"),I)),l.addCode(s.setLocal("i",s.i32_const(0)),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal("i"),s.getLocal("n"))),s.call(u,s.getLocal("pFrom"),I,s.getLocal("pTo")),s.setLocal("pFrom",s.i32_add(s.getLocal("pFrom"),s.i32_const(i))),s.setLocal("pTo",s.i32_add(s.getLocal("pTo"),s.i32_const(r))),s.call(c+"_mul",I,s.getLocal("pInc"),I),s.setLocal("i",s.i32_add(s.getLocal("i"),s.i32_const(1))),s.br(0)))),a.exportFunction(n)}),ce}var le,Oc;function Yd(){if(Oc)return le;Oc=1;const t=Qa(),a=bo(),n=Lc(),e=bc(),c=Ac(),i=wc(),r=Bc(),_=Fc(),u=Sc(),l=Pc(),{bitLength:s,modInv:I,isOdd:b,isNegative:f}=$a();return le=function(O,D){const G=D||"bn128";if(O.modules[G])return G;const V=21888242871839275222246405745257275088696311157297823662689037894645226208583n,it=21888242871839275222246405745257275088548364400416034343698204186575808495617n,Z=Math.floor((s(V-1n)-1)/64)+1,E=Z*8,M=E,h=E,y=h*2,q=h*12,g=O.alloc(t.bigInt2BytesLE(it,M)),x=a(O,V,"f1m");n(O,it,"fr","frm");const H=O.alloc(t.bigInt2BytesLE(et(3n),h)),T=i(O,"g1m","f1m",H);r(O,"frm","frm","frm","frm_mul"),_(O,"pol","frm"),u(O,"qap","frm");const N=e(O,"f1m_neg","f2m","f1m"),P=O.alloc([...t.bigInt2BytesLE(et(19485874751759354771024239261021720505790618469301721065564631296452457478373n),h),...t.bigInt2BytesLE(et(266929791119991161246907387137283842545076965332900288569378510910307636690n),h)]),v=i(O,"g2m","f2m",P);function S(R,d){const j=O.addFunction(R);j.addParam("pG","i32"),j.addParam("pFr","i32"),j.addParam("pr","i32");const W=j.getCodeBuilder(),K=W.i32_const(O.alloc(E));j.addCode(W.call("frm_fromMontgomery",W.getLocal("pFr"),K),W.call(d,W.getLocal("pG"),K,W.i32_const(E),W.getLocal("pr"))),O.exportFunction(R)}S("g1m_timesFr","g1m_timesScalar"),r(O,"g1m","g1m","frm","g1m_timesFr"),S("g2m_timesFr","g2m_timesScalar"),r(O,"g2m","g2m","frm","g2m_timesFr"),S("g1m_timesFrAffine","g1m_timesScalarAffine"),S("g2m_timesFrAffine","g2m_timesScalarAffine"),l(O,"frm_batchApplyKey","fmr","frm",E,E,E,"frm_mul"),l(O,"g1m_batchApplyKey","g1m","frm",E*3,E*3,E,"g1m_timesFr"),l(O,"g1m_batchApplyKeyMixed","g1m","frm",E*2,E*3,E,"g1m_timesFrAffine"),l(O,"g2m_batchApplyKey","g2m","frm",E*2*3,E*3*2,E,"g2m_timesFr"),l(O,"g2m_batchApplyKeyMixed","g2m","frm",E*2*2,E*3*2,E,"g2m_timesFrAffine");function et(R){return BigInt(R)*(1n<<BigInt(h*8))%V}const _t=[1n,2n,1n],mt=O.alloc([...t.bigInt2BytesLE(et(_t[0]),h),...t.bigInt2BytesLE(et(_t[1]),h),...t.bigInt2BytesLE(et(_t[2]),h)]),xt=[0n,1n,0n],Pt=O.alloc([...t.bigInt2BytesLE(et(xt[0]),h),...t.bigInt2BytesLE(et(xt[1]),h),...t.bigInt2BytesLE(et(xt[2]),h)]),zt=[[10857046999023057135944570762232829481370756359578518086990519993285655852781n,11559732032986387107991004021392285783925812861821192530917403151452391805634n],[8495653923123431417604973247489272438418190587263600148770280649306958101930n,4082367875863433681332203403145435568316851327593401208105741076214120093531n],[1n,0n]],Rt=O.alloc([...t.bigInt2BytesLE(et(zt[0][0]),h),...t.bigInt2BytesLE(et(zt[0][1]),h),...t.bigInt2BytesLE(et(zt[1][0]),h),...t.bigInt2BytesLE(et(zt[1][1]),h),...t.bigInt2BytesLE(et(zt[2][0]),h),...t.bigInt2BytesLE(et(zt[2][1]),h)]),k=[[0n,0n],[1n,0n],[0n,0n]],Ct=O.alloc([...t.bigInt2BytesLE(et(k[0][0]),h),...t.bigInt2BytesLE(et(k[0][1]),h),...t.bigInt2BytesLE(et(k[1][0]),h),...t.bigInt2BytesLE(et(k[1][1]),h),...t.bigInt2BytesLE(et(k[2][0]),h),...t.bigInt2BytesLE(et(k[2][1]),h)]),St=O.alloc([...t.bigInt2BytesLE(et(1),h),...t.bigInt2BytesLE(et(0),h),...t.bigInt2BytesLE(et(0),h),...t.bigInt2BytesLE(et(0),h),...t.bigInt2BytesLE(et(0),h),...t.bigInt2BytesLE(et(0),h),...t.bigInt2BytesLE(et(0),h),...t.bigInt2BytesLE(et(0),h),...t.bigInt2BytesLE(et(0),h),...t.bigInt2BytesLE(et(0),h),...t.bigInt2BytesLE(et(0),h),...t.bigInt2BytesLE(et(0),h)]),F=O.alloc([...t.bigInt2BytesLE(et(9),h),...t.bigInt2BytesLE(et(1),h)]),o=O.alloc([...t.bigInt2BytesLE(et(I(2n,V)),h),...t.bigInt2BytesLE(0n,h)]),L=F,U=O.alloc([...t.bigInt2BytesLE(et(19485874751759354771024239261021720505790618469301721065564631296452457478373n),h),...t.bigInt2BytesLE(et(266929791119991161246907387137283842545076965332900288569378510910307636690n),h)]);function p(){const R=O.addFunction(G+"_mulNR6");R.addParam("x","i32"),R.addParam("pr","i32");const d=R.getCodeBuilder();R.addCode(d.call(N+"_mul",d.i32_const(F),d.getLocal("x"),d.getLocal("pr")))}p();const st=c(O,G+"_mulNR6","f6m","f2m");function qt(){const R=O.addFunction(G+"_mulNR12");R.addParam("x","i32"),R.addParam("pr","i32");const d=R.getCodeBuilder();R.addCode(d.call(N+"_mul",d.i32_const(F),d.i32_add(d.getLocal("x"),d.i32_const(E*4)),d.getLocal("pr")),d.call(N+"_copy",d.getLocal("x"),d.i32_add(d.getLocal("pr"),d.i32_const(E*2))),d.call(N+"_copy",d.i32_add(d.getLocal("x"),d.i32_const(E*2)),d.i32_add(d.getLocal("pr"),d.i32_const(E*4))))}qt();const wt=e(O,G+"_mulNR12","ftm",st),Q=$(29793968203157093288n),A=O.alloc(Q),lt=3*y,Ft=Q.length-1,dt=Q.reduce((R,d)=>R+(d!=0?1:0),0)+Ft+1,B=3*2*E,Lt=3*E*2+dt*lt;O.modules[G]={n64:Z,pG1gen:mt,pG1zero:Pt,pG1b:H,pG2gen:Rt,pG2zero:Ct,pG2b:P,pq:O.modules.f1m.pq,pr:g,pOneT:St,prePSize:B,preQSize:Lt,r:it.toString(),q:V.toString()};const Gt=4965661367192848881n;function z(R){let d=R;const j=[];for(;d>0n;){if(b(d)){const W=2-Number(d%4n);j.push(W),d=d-BigInt(W)}else j.push(0);d=d>>1n}return j}function $(R){let d=R;const j=[];for(;d>0n;)b(d)?j.push(1):j.push(0),d=d>>1n;return j}function X(){const R=O.addFunction(G+"_prepareG1");R.addParam("pP","i32"),R.addParam("ppreP","i32");const d=R.getCodeBuilder();R.addCode(d.call(T+"_normalize",d.getLocal("pP"),d.getLocal("ppreP")))}function at(){const R=O.addFunction(G+"_prepAddStep");R.addParam("pQ","i32"),R.addParam("pR","i32"),R.addParam("pCoef","i32");const d=R.getCodeBuilder(),j=d.getLocal("pQ"),W=d.i32_add(d.getLocal("pQ"),d.i32_const(y)),K=d.getLocal("pR"),J=d.i32_add(d.getLocal("pR"),d.i32_const(y)),tt=d.i32_add(d.getLocal("pR"),d.i32_const(2*y)),rt=d.getLocal("pCoef"),ct=d.i32_add(d.getLocal("pCoef"),d.i32_const(y)),ht=d.i32_add(d.getLocal("pCoef"),d.i32_const(2*y)),bt=ct,At=d.i32_const(O.alloc(y)),Et=d.i32_const(O.alloc(y)),Nt=d.i32_const(O.alloc(y)),Tt=d.i32_const(O.alloc(y)),$t=d.i32_const(O.alloc(y)),Qt=d.i32_const(O.alloc(y)),jt=d.i32_const(O.alloc(y));R.addCode(d.call(N+"_mul",j,tt,bt),d.call(N+"_sub",K,bt,bt),d.call(N+"_mul",W,tt,At),d.call(N+"_sub",J,At,At),d.call(N+"_square",bt,Et),d.call(N+"_square",At,Nt),d.call(N+"_mul",bt,Et,Tt),d.call(N+"_mul",K,Et,$t),d.call(N+"_add",$t,$t,jt),d.call(N+"_mul",tt,Nt,Qt),d.call(N+"_add",Tt,Qt,Qt),d.call(N+"_sub",Qt,jt,Qt),d.call(N+"_mul",bt,Qt,K),d.call(N+"_mul",Tt,J,J),d.call(N+"_sub",$t,Qt,jt),d.call(N+"_mul",At,jt,jt),d.call(N+"_sub",jt,J,J),d.call(N+"_mul",tt,Tt,tt),d.call(N+"_mul",bt,W,jt),d.call(N+"_mul",At,j,rt),d.call(N+"_sub",rt,jt,rt),d.call(N+"_mul",rt,d.i32_const(L),rt),d.call(N+"_neg",At,ht))}function gt(){const R=O.addFunction(G+"_prepDblStep");R.addParam("pR","i32"),R.addParam("pCoef","i32");const d=R.getCodeBuilder(),j=d.getLocal("pR"),W=d.i32_add(d.getLocal("pR"),d.i32_const(y)),K=d.i32_add(d.getLocal("pR"),d.i32_const(2*y)),J=d.getLocal("pCoef"),tt=d.i32_add(d.getLocal("pCoef"),d.i32_const(y)),rt=d.i32_add(d.getLocal("pCoef"),d.i32_const(2*y)),ct=d.i32_const(O.alloc(y)),ht=d.i32_const(O.alloc(y)),bt=d.i32_const(O.alloc(y)),At=d.i32_const(O.alloc(y)),Et=d.i32_const(O.alloc(y)),Nt=d.i32_const(O.alloc(y)),Tt=d.i32_const(O.alloc(y)),$t=d.i32_const(O.alloc(y)),Qt=d.i32_const(O.alloc(y)),jt=d.i32_const(O.alloc(y)),kt=d.i32_const(O.alloc(y)),tn=d.i32_const(O.alloc(y));R.addCode(d.call(N+"_mul",W,d.i32_const(o),ct),d.call(N+"_mul",j,ct,ct),d.call(N+"_square",W,ht),d.call(N+"_square",K,bt),d.call(N+"_add",bt,bt,At),d.call(N+"_add",At,bt,At),d.call(N+"_mul",d.i32_const(U),At,Et),d.call(N+"_add",Et,Et,Nt),d.call(N+"_add",Et,Nt,Nt),d.call(N+"_add",ht,Nt,Tt),d.call(N+"_mul",Tt,d.i32_const(o),Tt),d.call(N+"_add",ht,bt,tn),d.call(N+"_add",W,K,$t),d.call(N+"_square",$t,$t),d.call(N+"_sub",$t,tn,$t),d.call(N+"_sub",Et,ht,Qt),d.call(N+"_square",j,jt),d.call(N+"_square",Et,kt),d.call(N+"_sub",ht,Nt,tn),d.call(N+"_mul",ct,tn,j),d.call(N+"_add",kt,kt,tn),d.call(N+"_add",kt,tn,tn),d.call(N+"_square",Tt,W),d.call(N+"_sub",W,tn,W),d.call(N+"_mul",ht,$t,K),d.call(N+"_mul",d.i32_const(L),Qt,J),d.call(N+"_neg",$t,tt),d.call(N+"_add",jt,jt,rt),d.call(N+"_add",jt,rt,rt))}function ft(){const R=O.addFunction(G+"_mulByQ");R.addParam("p1","i32"),R.addParam("pr","i32");const d=R.getCodeBuilder(),j=d.getLocal("p1"),W=d.i32_add(d.getLocal("p1"),d.i32_const(y)),K=d.i32_add(d.getLocal("p1"),d.i32_const(y*2)),J=d.getLocal("pr"),tt=d.i32_add(d.getLocal("pr"),d.i32_const(y)),rt=d.i32_add(d.getLocal("pr"),d.i32_const(y*2)),ct=d.i32_const(O.alloc([...t.bigInt2BytesLE(et("21575463638280843010398324269430826099269044274347216827212613867836435027261"),h),...t.bigInt2BytesLE(et("10307601595873709700152284273816112264069230130616436755625194854815875713954"),h)])),ht=d.i32_const(O.alloc([...t.bigInt2BytesLE(et("2821565182194536844548159561693502659359617185244120367078079554186484126554"),h),...t.bigInt2BytesLE(et("3505843767911556378687030309984248845540243509899259641013678093033130930403"),h)]));R.addCode(d.call(N+"_conjugate",j,J),d.call(N+"_mul",ct,J,J),d.call(N+"_conjugate",W,tt),d.call(N+"_mul",ht,tt,tt),d.call(N+"_conjugate",K,rt))}function Bt(){ft();const R=O.addFunction(G+"_prepareG2");R.addParam("pQ","i32"),R.addParam("ppreQ","i32"),R.addLocal("pCoef","i32"),R.addLocal("i","i32");const d=R.getCodeBuilder(),j=d.getLocal("pQ"),W=O.alloc(y*3),K=d.i32_const(W),J=d.i32_const(W),tt=d.i32_const(W+y),rt=d.i32_const(W+2*y),ct=d.i32_add(d.getLocal("ppreQ"),d.i32_const(0)),ht=d.i32_add(d.getLocal("ppreQ"),d.i32_const(y)),bt=O.alloc(y*3),At=d.i32_const(bt),Et=O.alloc(y*3),Nt=d.i32_const(Et),Tt=d.i32_const(Et+y);R.addCode(d.call(v+"_normalize",j,ct),d.call(N+"_copy",ct,J),d.call(N+"_copy",ht,tt),d.call(N+"_one",rt)),R.addCode(d.setLocal("pCoef",d.i32_add(d.getLocal("ppreQ"),d.i32_const(y*3))),d.setLocal("i",d.i32_const(Q.length-2)),d.block(d.loop(d.call(G+"_prepDblStep",K,d.getLocal("pCoef")),d.setLocal("pCoef",d.i32_add(d.getLocal("pCoef"),d.i32_const(lt))),d.if(d.i32_load8_s(d.getLocal("i"),A),[...d.call(G+"_prepAddStep",ct,K,d.getLocal("pCoef")),...d.setLocal("pCoef",d.i32_add(d.getLocal("pCoef"),d.i32_const(lt)))]),d.br_if(1,d.i32_eqz(d.getLocal("i"))),d.setLocal("i",d.i32_sub(d.getLocal("i"),d.i32_const(1))),d.br(0)))),R.addCode(d.call(G+"_mulByQ",ct,At),d.call(G+"_mulByQ",At,Nt)),R.addCode(d.call(N+"_neg",Tt,Tt),d.call(G+"_prepAddStep",At,K,d.getLocal("pCoef")),d.setLocal("pCoef",d.i32_add(d.getLocal("pCoef"),d.i32_const(lt))),d.call(G+"_prepAddStep",Nt,K,d.getLocal("pCoef")),d.setLocal("pCoef",d.i32_add(d.getLocal("pCoef"),d.i32_const(lt))))}function pt(){const R=O.addFunction(G+"__mulBy024Old");R.addParam("pEll0","i32"),R.addParam("pEllVW","i32"),R.addParam("pEllVV","i32"),R.addParam("pR","i32");const d=R.getCodeBuilder(),j=d.getLocal("pEll0"),W=d.getLocal("pEllVV"),K=d.getLocal("pEllVW"),J=d.getLocal("pR"),tt=O.alloc(q),rt=d.i32_const(tt),ct=d.i32_const(tt),ht=d.i32_const(tt+y),bt=d.i32_const(tt+y*2),At=d.i32_const(tt+y*3),Et=d.i32_const(tt+y*4),Nt=d.i32_const(tt+y*5);R.addCode(d.call(N+"_copy",j,ct),d.call(N+"_zero",ht),d.call(N+"_copy",W,bt),d.call(N+"_zero",At),d.call(N+"_copy",K,Et),d.call(N+"_zero",Nt),d.call(wt+"_mul",rt,J,J))}function Ot(){const R=O.addFunction(G+"__mulBy024");R.addParam("pEll0","i32"),R.addParam("pEllVW","i32"),R.addParam("pEllVV","i32"),R.addParam("pR","i32");const d=R.getCodeBuilder(),j=d.getLocal("pEll0"),W=d.getLocal("pEllVV"),K=d.getLocal("pEllVW"),J=d.getLocal("pR"),tt=d.i32_add(d.getLocal("pR"),d.i32_const(2*E)),rt=d.i32_add(d.getLocal("pR"),d.i32_const(4*E)),ct=d.i32_add(d.getLocal("pR"),d.i32_const(6*E)),ht=d.i32_add(d.getLocal("pR"),d.i32_const(8*E)),bt=d.i32_add(d.getLocal("pR"),d.i32_const(10*E)),At=d.i32_const(O.alloc(y)),Et=d.i32_const(O.alloc(y)),Nt=d.i32_const(O.alloc(y)),Tt=d.i32_const(O.alloc(y)),$t=d.i32_const(O.alloc(y)),Qt=d.i32_const(O.alloc(y)),jt=d.i32_const(O.alloc(y)),kt=d.i32_const(O.alloc(y)),tn=d.i32_const(O.alloc(y)),Wt=d.i32_const(O.alloc(y)),Jt=d.i32_const(O.alloc(y));R.addCode(d.call(N+"_mul",J,j,jt),d.call(N+"_mul",rt,W,kt),d.call(N+"_mul",ht,K,tn),d.call(N+"_add",J,ht,Nt),d.call(N+"_add",J,rt,Et),d.call(N+"_add",tt,ct,Tt),d.call(N+"_add",Tt,bt,Tt),d.call(N+"_mul",tt,W,Wt),d.call(N+"_add",Wt,tn,$t),d.call(N+"_mul",d.i32_const(F),$t,Qt),d.call(N+"_add",Qt,jt,J),d.call(N+"_mul",bt,K,$t),d.call(N+"_add",Wt,$t,Wt),d.call(N+"_add",$t,kt,$t),d.call(N+"_mul",d.i32_const(F),$t,Qt),d.call(N+"_mul",tt,j,$t),d.call(N+"_add",Wt,$t,Wt),d.call(N+"_add",Qt,$t,tt),d.call(N+"_add",j,W,At),d.call(N+"_mul",Et,At,$t),d.call(N+"_add",jt,kt,Jt),d.call(N+"_sub",$t,Jt,$t),d.call(N+"_mul",ct,K,Qt),d.call(N+"_add",Wt,Qt,Wt),d.call(N+"_add",rt,ht,At),d.call(N+"_add",$t,Qt,rt),d.call(N+"_add",W,K,Et),d.call(N+"_mul",Et,At,$t),d.call(N+"_add",kt,tn,Jt),d.call(N+"_sub",$t,Jt,$t),d.call(N+"_mul",d.i32_const(F),$t,Qt),d.call(N+"_mul",ct,j,$t),d.call(N+"_add",Wt,$t,Wt),d.call(N+"_add",Qt,$t,ct),d.call(N+"_mul",bt,W,$t),d.call(N+"_add",Wt,$t,Wt),d.call(N+"_mul",d.i32_const(F),$t,Qt),d.call(N+"_add",j,K,At),d.call(N+"_mul",Nt,At,$t),d.call(N+"_add",jt,tn,Jt),d.call(N+"_sub",$t,Jt,$t),d.call(N+"_add",Qt,$t,ht),d.call(N+"_add",j,W,At),d.call(N+"_add",At,K,At),d.call(N+"_mul",Tt,At,$t),d.call(N+"_sub",$t,Wt,bt))}function Ht(){const R=O.addFunction(G+"_millerLoop");R.addParam("ppreP","i32"),R.addParam("ppreQ","i32"),R.addParam("r","i32"),R.addLocal("pCoef","i32"),R.addLocal("i","i32");const d=R.getCodeBuilder(),j=d.getLocal("ppreP"),W=d.i32_add(d.getLocal("ppreP"),d.i32_const(h)),K=d.getLocal("pCoef"),J=d.i32_add(d.getLocal("pCoef"),d.i32_const(y)),tt=d.i32_add(d.getLocal("pCoef"),d.i32_const(2*y)),rt=O.alloc(y),ct=d.i32_const(rt),ht=O.alloc(y),bt=d.i32_const(ht),At=d.getLocal("r");R.addCode(d.call(wt+"_one",At),d.setLocal("pCoef",d.i32_add(d.getLocal("ppreQ"),d.i32_const(y*3))),d.setLocal("i",d.i32_const(Q.length-2)),d.block(d.loop(d.call(wt+"_square",At,At),d.call(N+"_mul1",J,W,ct),d.call(N+"_mul1",tt,j,bt),d.call(G+"__mulBy024",K,ct,bt,At),d.setLocal("pCoef",d.i32_add(d.getLocal("pCoef"),d.i32_const(lt))),d.if(d.i32_load8_s(d.getLocal("i"),A),[...d.call(N+"_mul1",J,W,ct),...d.call(N+"_mul1",tt,j,bt),...d.call(G+"__mulBy024",K,ct,bt,At),...d.setLocal("pCoef",d.i32_add(d.getLocal("pCoef"),d.i32_const(lt)))]),d.br_if(1,d.i32_eqz(d.getLocal("i"))),d.setLocal("i",d.i32_sub(d.getLocal("i"),d.i32_const(1))),d.br(0)))),R.addCode(d.call(N+"_mul1",J,W,ct),d.call(N+"_mul1",tt,j,bt),d.call(G+"__mulBy024",K,ct,bt,At),d.setLocal("pCoef",d.i32_add(d.getLocal("pCoef"),d.i32_const(lt))),d.call(N+"_mul1",J,W,ct),d.call(N+"_mul1",tt,j,bt),d.call(G+"__mulBy024",K,ct,bt,At),d.setLocal("pCoef",d.i32_add(d.getLocal("pCoef"),d.i32_const(lt))))}function on(R){const d=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[8376118865763821496583973867626364092589906065868298776909617916018768340080n,16469823323077808223889137241176536799009286646108169935659301613961712198316n],[21888242871839275220042445260109153167277707414472061641714758635765020556617n,0n],[11697423496358154304825782922584725312912383441159505038794027105778954184319n,303847389135065887422783454877609941456349188919719272345083954437860409601n],[21888242871839275220042445260109153167277707414472061641714758635765020556616n,0n],[3321304630594332808241809054958361220322477375291206261884409189760185844239n,5722266937896532885780051958958348231143373700109372999374820235121374419868n],[21888242871839275222246405745257275088696311157297823662689037894645226208582n,0n],[13512124006075453725662431877630910996106405091429524885779419978626457868503n,5418419548761466998357268504080738289687024511189653727029736280683514010267n],[2203960485148121921418603742825762020974279258880205651966n,0n],[10190819375481120917420622822672549775783927716138318623895010788866272024264n,21584395482704209334823622290379665147239961968378104390343953940207365798982n],[2203960485148121921418603742825762020974279258880205651967n,0n],[18566938241244942414004596690298913868373833782006617400804628704885040364344n,16165975933942742336466353786298926857552937457188450663314217659523851788715n]]],j=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[21575463638280843010398324269430826099269044274347216827212613867836435027261n,10307601595873709700152284273816112264069230130616436755625194854815875713954n],[21888242871839275220042445260109153167277707414472061641714758635765020556616n,0n],[3772000881919853776433695186713858239009073593817195771773381919316419345261n,2236595495967245188281701248203181795121068902605861227855261137820944008926n],[2203960485148121921418603742825762020974279258880205651966n,0n],[18429021223477853657660792034369865839114504446431234726392080002137598044644n,9344045779998320333812420223237981029506012124075525679208581902008406485703n]],[[1n,0n],[2581911344467009335267311115468803099551665605076196740867805258568234346338n,19937756971775647987995932169929341994314640652964949448313374472400716661030n],[2203960485148121921418603742825762020974279258880205651966n,0n],[5324479202449903542726783395506214481928257762400643279780343368557297135718n,16208900380737693084919495127334387981393726419856888799917914180988844123039n],[21888242871839275220042445260109153167277707414472061641714758635765020556616n,0n],[13981852324922362344252311234282257507216387789820983642040889267519694726527n,7629828391165209371577384193250820201684255241773809077146787135900891633097n]]],W=O.addFunction(G+"__frobeniusMap"+R);W.addParam("x","i32"),W.addParam("r","i32");const K=W.getCodeBuilder();for(let tt=0;tt<6;tt++){const rt=tt==0?K.getLocal("x"):K.i32_add(K.getLocal("x"),K.i32_const(tt*y)),ct=rt,ht=K.i32_add(K.getLocal("x"),K.i32_const(tt*y+h)),bt=tt==0?K.getLocal("r"):K.i32_add(K.getLocal("r"),K.i32_const(tt*y)),At=bt,Et=K.i32_add(K.getLocal("r"),K.i32_const(tt*y+h)),Nt=J(d[Math.floor(tt/3)][R%12],j[tt%3][R%6]),Tt=O.alloc([...t.bigInt2BytesLE(et(Nt[0]),32),...t.bigInt2BytesLE(et(Nt[1]),32)]);R%2==1?W.addCode(K.call(x+"_copy",ct,At),K.call(x+"_neg",ht,Et),K.call(N+"_mul",bt,K.i32_const(Tt),bt)):W.addCode(K.call(N+"_mul",rt,K.i32_const(Tt),bt))}function J(tt,rt){const ct=BigInt(tt[0]),ht=BigInt(tt[1]),bt=BigInt(rt[0]),At=BigInt(rt[1]),Et=[(ct*bt-ht*At)%V,(ct*At+ht*bt)%V];return f(Et[0])&&(Et[0]=Et[0]+V),Et}}function an(){const R=O.addFunction(G+"__finalExponentiationFirstChunk");R.addParam("x","i32"),R.addParam("r","i32");const d=R.getCodeBuilder(),j=d.getLocal("x"),W=j,K=d.i32_add(j,d.i32_const(E*6)),J=d.getLocal("r"),tt=O.alloc(q),rt=d.i32_const(tt),ct=rt,ht=d.i32_const(tt+E*6),bt=d.i32_const(O.alloc(q)),At=d.i32_const(O.alloc(q)),Et=d.i32_const(O.alloc(q));R.addCode(d.call(st+"_copy",W,ct),d.call(st+"_neg",K,ht),d.call(wt+"_inverse",j,bt),d.call(wt+"_mul",rt,bt,At),d.call(G+"__frobeniusMap2",At,Et),d.call(wt+"_mul",At,Et,J))}function en(){const R=O.addFunction(G+"__cyclotomicSquare");R.addParam("x","i32"),R.addParam("r","i32");const d=R.getCodeBuilder(),j=d.getLocal("x"),W=d.i32_add(d.getLocal("x"),d.i32_const(y)),K=d.i32_add(d.getLocal("x"),d.i32_const(2*y)),J=d.i32_add(d.getLocal("x"),d.i32_const(3*y)),tt=d.i32_add(d.getLocal("x"),d.i32_const(4*y)),rt=d.i32_add(d.getLocal("x"),d.i32_const(5*y)),ct=d.getLocal("r"),ht=d.i32_add(d.getLocal("r"),d.i32_const(y)),bt=d.i32_add(d.getLocal("r"),d.i32_const(2*y)),At=d.i32_add(d.getLocal("r"),d.i32_const(3*y)),Et=d.i32_add(d.getLocal("r"),d.i32_const(4*y)),Nt=d.i32_add(d.getLocal("r"),d.i32_const(5*y)),Tt=d.i32_const(O.alloc(y)),$t=d.i32_const(O.alloc(y)),Qt=d.i32_const(O.alloc(y)),jt=d.i32_const(O.alloc(y)),kt=d.i32_const(O.alloc(y)),tn=d.i32_const(O.alloc(y)),Wt=d.i32_const(O.alloc(y)),Jt=d.i32_const(O.alloc(y));R.addCode(d.call(N+"_mul",j,tt,Wt),d.call(N+"_mul",tt,d.i32_const(F),Tt),d.call(N+"_add",j,Tt,Tt),d.call(N+"_add",j,tt,Jt),d.call(N+"_mul",Jt,Tt,Tt),d.call(N+"_mul",d.i32_const(F),Wt,Jt),d.call(N+"_add",Wt,Jt,Jt),d.call(N+"_sub",Tt,Jt,Tt),d.call(N+"_add",Wt,Wt,$t),d.call(N+"_mul",J,K,Wt),d.call(N+"_mul",K,d.i32_const(F),Qt),d.call(N+"_add",J,Qt,Qt),d.call(N+"_add",J,K,Jt),d.call(N+"_mul",Jt,Qt,Qt),d.call(N+"_mul",d.i32_const(F),Wt,Jt),d.call(N+"_add",Wt,Jt,Jt),d.call(N+"_sub",Qt,Jt,Qt),d.call(N+"_add",Wt,Wt,jt),d.call(N+"_mul",W,rt,Wt),d.call(N+"_mul",rt,d.i32_const(F),kt),d.call(N+"_add",W,kt,kt),d.call(N+"_add",W,rt,Jt),d.call(N+"_mul",Jt,kt,kt),d.call(N+"_mul",d.i32_const(F),Wt,Jt),d.call(N+"_add",Wt,Jt,Jt),d.call(N+"_sub",kt,Jt,kt),d.call(N+"_add",Wt,Wt,tn),d.call(N+"_sub",Tt,j,ct),d.call(N+"_add",ct,ct,ct),d.call(N+"_add",Tt,ct,ct),d.call(N+"_add",$t,tt,Et),d.call(N+"_add",Et,Et,Et),d.call(N+"_add",$t,Et,Et),d.call(N+"_mul",tn,d.i32_const(L),Jt),d.call(N+"_add",Jt,J,At),d.call(N+"_add",At,At,At),d.call(N+"_add",Jt,At,At),d.call(N+"_sub",kt,K,bt),d.call(N+"_add",bt,bt,bt),d.call(N+"_add",kt,bt,bt),d.call(N+"_sub",Qt,W,ht),d.call(N+"_add",ht,ht,ht),d.call(N+"_add",Qt,ht,ht),d.call(N+"_add",jt,rt,Nt),d.call(N+"_add",Nt,Nt,Nt),d.call(N+"_add",jt,Nt,Nt))}function rn(R,d){const j=z(R).map(ht=>ht==-1?255:ht),W=O.alloc(j),K=O.addFunction(G+"__cyclotomicExp_"+d);K.addParam("x","i32"),K.addParam("r","i32"),K.addLocal("bit","i32"),K.addLocal("i","i32");const J=K.getCodeBuilder(),tt=J.getLocal("x"),rt=J.getLocal("r"),ct=J.i32_const(O.alloc(q));K.addCode(J.call(wt+"_conjugate",tt,ct),J.call(wt+"_one",rt),J.if(J.teeLocal("bit",J.i32_load8_s(J.i32_const(j.length-1),W)),J.if(J.i32_eq(J.getLocal("bit"),J.i32_const(1)),J.call(wt+"_mul",rt,tt,rt),J.call(wt+"_mul",rt,ct,rt))),J.setLocal("i",J.i32_const(j.length-2)),J.block(J.loop(J.call(G+"__cyclotomicSquare",rt,rt),J.if(J.teeLocal("bit",J.i32_load8_s(J.getLocal("i"),W)),J.if(J.i32_eq(J.getLocal("bit"),J.i32_const(1)),J.call(wt+"_mul",rt,tt,rt),J.call(wt+"_mul",rt,ct,rt))),J.br_if(1,J.i32_eqz(J.getLocal("i"))),J.setLocal("i",J.i32_sub(J.getLocal("i"),J.i32_const(1))),J.br(0))))}function cn(){en(),rn(Gt,"w0");const R=O.addFunction(G+"__finalExponentiationLastChunk");R.addParam("x","i32"),R.addParam("r","i32");const d=R.getCodeBuilder(),j=d.getLocal("x"),W=d.getLocal("r"),K=d.i32_const(O.alloc(q)),J=d.i32_const(O.alloc(q)),tt=d.i32_const(O.alloc(q)),rt=d.i32_const(O.alloc(q)),ct=d.i32_const(O.alloc(q)),ht=d.i32_const(O.alloc(q)),bt=d.i32_const(O.alloc(q)),At=d.i32_const(O.alloc(q)),Et=d.i32_const(O.alloc(q)),Nt=d.i32_const(O.alloc(q)),Tt=d.i32_const(O.alloc(q)),$t=d.i32_const(O.alloc(q)),Qt=d.i32_const(O.alloc(q)),jt=d.i32_const(O.alloc(q)),kt=d.i32_const(O.alloc(q)),tn=d.i32_const(O.alloc(q)),Wt=d.i32_const(O.alloc(q)),Jt=d.i32_const(O.alloc(q)),xn=d.i32_const(O.alloc(q)),Sn=d.i32_const(O.alloc(q)),Pn=d.i32_const(O.alloc(q));R.addCode(d.call(G+"__cyclotomicExp_w0",j,K),d.call(wt+"_conjugate",K,K),d.call(G+"__cyclotomicSquare",K,J),d.call(G+"__cyclotomicSquare",J,tt),d.call(wt+"_mul",tt,J,rt),d.call(G+"__cyclotomicExp_w0",rt,ct),d.call(wt+"_conjugate",ct,ct),d.call(G+"__cyclotomicSquare",ct,ht),d.call(G+"__cyclotomicExp_w0",ht,bt),d.call(wt+"_conjugate",bt,bt),d.call(wt+"_conjugate",rt,At),d.call(wt+"_conjugate",bt,Et),d.call(wt+"_mul",Et,ct,Nt),d.call(wt+"_mul",Nt,At,Tt),d.call(wt+"_mul",Tt,J,$t),d.call(wt+"_mul",Tt,ct,Qt),d.call(wt+"_mul",Qt,j,jt),d.call(G+"__frobeniusMap1",$t,kt),d.call(wt+"_mul",kt,jt,tn),d.call(G+"__frobeniusMap2",Tt,Wt),d.call(wt+"_mul",Wt,tn,Jt),d.call(wt+"_conjugate",j,xn),d.call(wt+"_mul",xn,$t,Sn),d.call(G+"__frobeniusMap3",Sn,Pn),d.call(wt+"_mul",Pn,Jt,W))}function fn(){an(),cn();const R=O.addFunction(G+"_finalExponentiation");R.addParam("x","i32"),R.addParam("r","i32");const d=R.getCodeBuilder(),j=d.getLocal("x"),W=d.getLocal("r"),K=d.i32_const(O.alloc(q));R.addCode(d.call(G+"__finalExponentiationFirstChunk",j,K),d.call(G+"__finalExponentiationLastChunk",K,W))}function Ln(){const R=O.addFunction(G+"_finalExponentiationOld");R.addParam("x","i32"),R.addParam("r","i32");const j=O.alloc(t.bigInt2BytesLE(552484233613224096312617126783173147097382103762957654188882734314196910839907541213974502761540629817009608548654680343627701153829446747810907373256841551006201639677726139946029199968412598804882391702273019083653272047566316584365559776493027495458238373902875937659943504873220554161550525926302303331747463515644711876653177129578303191095900909191624817826566688241804408081892785725967931714097716709526092261278071952560171111444072049229123565057483750161460024353346284167282452756217662335528813519139808291170539072125381230815729071544861602750936964829313608137325426383735122175229541155376346436093930287402089517426973178917569713384748081827255472576937471496195752727188261435633271238710131736096299798168852925540549342330775279877006784354801422249722573783561685179618816480037695005515426162362431072245638324744480n,352)),W=R.getCodeBuilder();R.addCode(W.call(wt+"_exp",W.getLocal("x"),W.i32_const(j),W.i32_const(352),W.getLocal("r")))}const In=O.alloc(B),Mt=O.alloc(Lt);function m(R){const d=O.addFunction(G+"_pairingEq"+R);for(let J=0;J<R;J++)d.addParam("p_"+J,"i32"),d.addParam("q_"+J,"i32");d.addParam("c","i32"),d.setReturnType("i32");const j=d.getCodeBuilder(),W=j.i32_const(O.alloc(q)),K=j.i32_const(O.alloc(q));d.addCode(j.call(wt+"_one",W));for(let J=0;J<R;J++)d.addCode(j.call(G+"_prepareG1",j.getLocal("p_"+J),j.i32_const(In))),d.addCode(j.call(G+"_prepareG2",j.getLocal("q_"+J),j.i32_const(Mt))),d.addCode(j.call(G+"_millerLoop",j.i32_const(In),j.i32_const(Mt),K)),d.addCode(j.call(wt+"_mul",W,K,W));d.addCode(j.call(G+"_finalExponentiation",W,W)),d.addCode(j.call(wt+"_eq",W,j.getLocal("c")))}function C(){const R=O.addFunction(G+"_pairing");R.addParam("p","i32"),R.addParam("q","i32"),R.addParam("r","i32");const d=R.getCodeBuilder(),j=d.i32_const(O.alloc(q));R.addCode(d.call(G+"_prepareG1",d.getLocal("p"),d.i32_const(In))),R.addCode(d.call(G+"_prepareG2",d.getLocal("q"),d.i32_const(Mt))),R.addCode(d.call(G+"_millerLoop",d.i32_const(In),d.i32_const(Mt),j)),R.addCode(d.call(G+"_finalExponentiation",j,d.getLocal("r")))}at(),gt(),X(),Bt(),Ot(),pt(),Ht();for(let R=0;R<10;R++)on(R),O.exportFunction(G+"__frobeniusMap"+R);Ln(),fn();for(let R=1;R<=5;R++)m(R),O.exportFunction(G+"_pairingEq"+R);C(),O.exportFunction(G+"_pairing"),O.exportFunction(G+"_prepareG1"),O.exportFunction(G+"_prepareG2"),O.exportFunction(G+"_millerLoop"),O.exportFunction(G+"_finalExponentiation"),O.exportFunction(G+"_finalExponentiationOld"),O.exportFunction(G+"__mulBy024"),O.exportFunction(G+"__mulBy024Old"),O.exportFunction(G+"__cyclotomicSquare"),O.exportFunction(G+"__cyclotomicExp_w0")},le}var se,Mc;function Xd(){if(Mc)return se;Mc=1;const t=Qa(),a=bo(),n=Lc(),e=bc(),c=Ac(),i=wc(),r=Bc(),_=Fc(),u=Sc(),l=Pc(),{bitLength:s,isOdd:I,isNegative:b}=$a();return se=function(w,O){const D=O||"bls12381";if(w.modules[D])return D;const G=0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn,V=0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001n,it=Math.floor((s(G-1n)-1)/64)+1,Z=it*8,E=Z,M=E*2,h=E*12,y=Math.floor((s(V-1n)-1)/64)+1,q=y*8,g=q,x=w.alloc(t.bigInt2BytesLE(V,g)),H=a(w,G,"f1m","intq");n(w,V,"fr","frm","intr");const T=w.alloc(t.bigInt2BytesLE(_t(4n),E)),N=i(w,"g1m","f1m",T);r(w,"frm","frm","frm","frm_mul"),_(w,"pol","frm"),u(w,"qap","frm");const P=e(w,"f1m_neg","f2m","f1m"),v=w.alloc([...t.bigInt2BytesLE(_t(4n),E),...t.bigInt2BytesLE(_t(4n),E)]),S=i(w,"g2m","f2m",v);function et(R,d){const j=w.addFunction(R);j.addParam("pG","i32"),j.addParam("pFr","i32"),j.addParam("pr","i32");const W=j.getCodeBuilder(),K=W.i32_const(w.alloc(q));j.addCode(W.call("frm_fromMontgomery",W.getLocal("pFr"),K),W.call(d,W.getLocal("pG"),K,W.i32_const(q),W.getLocal("pr"))),w.exportFunction(R)}et("g1m_timesFr","g1m_timesScalar"),r(w,"g1m","g1m","frm","g1m_timesFr"),et("g2m_timesFr","g2m_timesScalar"),r(w,"g2m","g2m","frm","g2m_timesFr"),et("g1m_timesFrAffine","g1m_timesScalarAffine"),et("g2m_timesFrAffine","g2m_timesScalarAffine"),l(w,"frm_batchApplyKey","fmr","frm",q,q,q,"frm_mul"),l(w,"g1m_batchApplyKey","g1m","frm",Z*3,Z*3,q,"g1m_timesFr"),l(w,"g1m_batchApplyKeyMixed","g1m","frm",Z*2,Z*3,q,"g1m_timesFrAffine"),l(w,"g2m_batchApplyKey","g2m","frm",Z*2*3,Z*3*2,q,"g2m_timesFr"),l(w,"g2m_batchApplyKeyMixed","g2m","frm",Z*2*2,Z*3*2,q,"g2m_timesFrAffine");function _t(R){return BigInt(R)*(1n<<BigInt(E*8))%G}const mt=[3685416753713387016781088315183077757961620795782546409894578378688607592378376318836054947676345821548104185464507n,1339506544944476473020471379941921221584933875938349620426543736416511423956333506472724655353366534992391756441569n,1n],xt=w.alloc([...t.bigInt2BytesLE(_t(mt[0]),E),...t.bigInt2BytesLE(_t(mt[1]),E),...t.bigInt2BytesLE(_t(mt[2]),E)]),Pt=[0n,1n,0n],zt=w.alloc([...t.bigInt2BytesLE(_t(Pt[0]),E),...t.bigInt2BytesLE(_t(Pt[1]),E),...t.bigInt2BytesLE(_t(Pt[2]),E)]),Rt=[[352701069587466618187139116011060144890029952792775240219908644239793785735715026873347600343865175952761926303160n,3059144344244213709971259814753781636986470325476647558659373206291635324768958432433509563104347017837885763365758n],[1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905n,927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582n],[1n,0n]],k=w.alloc([...t.bigInt2BytesLE(_t(Rt[0][0]),E),...t.bigInt2BytesLE(_t(Rt[0][1]),E),...t.bigInt2BytesLE(_t(Rt[1][0]),E),...t.bigInt2BytesLE(_t(Rt[1][1]),E),...t.bigInt2BytesLE(_t(Rt[2][0]),E),...t.bigInt2BytesLE(_t(Rt[2][1]),E)]),Ct=[[0n,0n],[1n,0n],[0n,0n]],St=w.alloc([...t.bigInt2BytesLE(_t(Ct[0][0]),E),...t.bigInt2BytesLE(_t(Ct[0][1]),E),...t.bigInt2BytesLE(_t(Ct[1][0]),E),...t.bigInt2BytesLE(_t(Ct[1][1]),E),...t.bigInt2BytesLE(_t(Ct[2][0]),E),...t.bigInt2BytesLE(_t(Ct[2][1]),E)]),F=w.alloc([...t.bigInt2BytesLE(_t(1n),E),...t.bigInt2BytesLE(_t(0n),E),...t.bigInt2BytesLE(_t(0n),E),...t.bigInt2BytesLE(_t(0n),E),...t.bigInt2BytesLE(_t(0n),E),...t.bigInt2BytesLE(_t(0n),E),...t.bigInt2BytesLE(_t(0n),E),...t.bigInt2BytesLE(_t(0n),E),...t.bigInt2BytesLE(_t(0n),E),...t.bigInt2BytesLE(_t(0n),E),...t.bigInt2BytesLE(_t(0n),E),...t.bigInt2BytesLE(_t(0n),E)]),o=w.alloc([...t.bigInt2BytesLE(_t(1n),E),...t.bigInt2BytesLE(_t(1n),E)]);function L(){const R=w.addFunction(P+"_mulNR");R.addParam("x","i32"),R.addParam("pr","i32");const d=R.getCodeBuilder(),j=d.i32_const(w.alloc(E)),W=d.getLocal("x"),K=d.i32_add(d.getLocal("x"),d.i32_const(E)),J=d.getLocal("pr"),tt=d.i32_add(d.getLocal("pr"),d.i32_const(E));R.addCode(d.call(H+"_copy",W,j),d.call(H+"_sub",W,K,J),d.call(H+"_add",j,K,tt))}L();const U=c(w,P+"_mulNR","f6m","f2m");function p(){const R=w.addFunction(U+"_mulNR");R.addParam("x","i32"),R.addParam("pr","i32");const d=R.getCodeBuilder(),j=d.i32_const(w.alloc(E*2));R.addCode(d.call(P+"_copy",d.getLocal("x"),j),d.call(P+"_mulNR",d.i32_add(d.getLocal("x"),d.i32_const(Z*4)),d.getLocal("pr")),d.call(P+"_copy",d.i32_add(d.getLocal("x"),d.i32_const(Z*2)),d.i32_add(d.getLocal("pr"),d.i32_const(Z*4))),d.call(P+"_copy",j,d.i32_add(d.getLocal("pr"),d.i32_const(Z*2))))}p();const st=e(w,U+"_mulNR","ftm",U),wt=z(0xd201000000010000n),nt=w.alloc(wt),Q=3*M,A=wt.length-1,Ft=wt.reduce((R,d)=>R+(d!=0?1:0),0)+A+1,Ut=3*2*Z,dt=3*Z*2+Ft*Q,B=!0,Lt=15132376222941642752n;w.modules[D]={n64q:it,n64r:y,n8q:Z,n8r:q,pG1gen:xt,pG1zero:zt,pG1b:T,pG2gen:k,pG2zero:St,pG2b:v,pq:w.modules.f1m.pq,pr:x,pOneT:F,r:V,q:G,prePSize:Ut,preQSize:dt};function Gt(R){let d=R;const j=[];for(;d>0n;){if(I(d)){const W=2-Number(d%4n);j.push(W),d=d-BigInt(W)}else j.push(0);d=d>>1n}return j}function z(R){let d=R;const j=[];for(;d>0n;)I(d)?j.push(1):j.push(0),d=d>>1n;return j}function $(){const R=w.addFunction(D+"_prepareG1");R.addParam("pP","i32"),R.addParam("ppreP","i32");const d=R.getCodeBuilder();R.addCode(d.call(N+"_normalize",d.getLocal("pP"),d.getLocal("ppreP")))}function X(){const R=w.addFunction(D+"_prepDblStep");R.addParam("R","i32"),R.addParam("r","i32");const d=R.getCodeBuilder(),j=d.getLocal("R"),W=d.i32_add(d.getLocal("R"),d.i32_const(2*Z)),K=d.i32_add(d.getLocal("R"),d.i32_const(4*Z)),J=d.getLocal("r"),tt=d.i32_add(d.getLocal("r"),d.i32_const(2*Z)),rt=d.i32_add(d.getLocal("r"),d.i32_const(4*Z)),ct=d.i32_const(w.alloc(M)),ht=d.i32_const(w.alloc(M)),bt=d.i32_const(w.alloc(M)),At=d.i32_const(w.alloc(M)),Et=d.i32_const(w.alloc(M));R.addCode(d.call(P+"_square",j,J),d.call(P+"_square",W,ht),d.call(P+"_square",ht,bt),d.call(P+"_add",ht,j,tt),d.call(P+"_square",tt,tt),d.call(P+"_sub",tt,J,tt),d.call(P+"_sub",tt,bt,tt),d.call(P+"_add",tt,tt,tt),d.call(P+"_add",J,J,At),d.call(P+"_add",At,J,At),d.call(P+"_add",j,At,rt),d.call(P+"_square",At,Et),d.call(P+"_square",K,ct),d.call(P+"_sub",Et,tt,j),d.call(P+"_sub",j,tt,j),d.call(P+"_add",K,W,K),d.call(P+"_square",K,K),d.call(P+"_sub",K,ht,K),d.call(P+"_sub",K,ct,K),d.call(P+"_sub",tt,j,W),d.call(P+"_mul",W,At,W),d.call(P+"_add",bt,bt,bt),d.call(P+"_add",bt,bt,bt),d.call(P+"_add",bt,bt,bt),d.call(P+"_sub",W,bt,W),d.call(P+"_mul",At,ct,tt),d.call(P+"_add",tt,tt,tt),d.call(P+"_neg",tt,tt),d.call(P+"_square",rt,rt),d.call(P+"_sub",rt,J,rt),d.call(P+"_sub",rt,Et,rt),d.call(P+"_add",ht,ht,ht),d.call(P+"_add",ht,ht,ht),d.call(P+"_sub",rt,ht,rt),d.call(P+"_mul",K,ct,J),d.call(P+"_add",J,J,J))}function at(){const R=w.addFunction(D+"_prepAddStep");R.addParam("R","i32"),R.addParam("Q","i32"),R.addParam("r","i32");const d=R.getCodeBuilder(),j=d.getLocal("R"),W=d.i32_add(d.getLocal("R"),d.i32_const(2*Z)),K=d.i32_add(d.getLocal("R"),d.i32_const(4*Z)),J=d.getLocal("Q"),tt=d.i32_add(d.getLocal("Q"),d.i32_const(2*Z)),rt=d.getLocal("r"),ct=d.i32_add(d.getLocal("r"),d.i32_const(2*Z)),ht=d.i32_add(d.getLocal("r"),d.i32_const(4*Z)),bt=d.i32_const(w.alloc(M)),At=d.i32_const(w.alloc(M)),Et=d.i32_const(w.alloc(M)),Nt=d.i32_const(w.alloc(M)),Tt=d.i32_const(w.alloc(M)),$t=d.i32_const(w.alloc(M)),Qt=d.i32_const(w.alloc(M)),jt=d.i32_const(w.alloc(M)),kt=d.i32_const(w.alloc(M)),tn=d.i32_const(w.alloc(M)),Wt=d.i32_const(w.alloc(M));R.addCode(d.call(P+"_square",K,bt),d.call(P+"_square",tt,At),d.call(P+"_mul",bt,J,Nt),d.call(P+"_add",tt,K,ct),d.call(P+"_square",ct,ct),d.call(P+"_sub",ct,At,ct),d.call(P+"_sub",ct,bt,ct),d.call(P+"_mul",ct,bt,ct),d.call(P+"_sub",Nt,j,Tt),d.call(P+"_square",Tt,$t),d.call(P+"_add",$t,$t,Qt),d.call(P+"_add",Qt,Qt,Qt),d.call(P+"_mul",Qt,Tt,jt),d.call(P+"_sub",ct,W,kt),d.call(P+"_sub",kt,W,kt),d.call(P+"_mul",kt,J,ht),d.call(P+"_mul",Qt,j,tn),d.call(P+"_square",kt,j),d.call(P+"_sub",j,jt,j),d.call(P+"_sub",j,tn,j),d.call(P+"_sub",j,tn,j),d.call(P+"_add",K,Tt,K),d.call(P+"_square",K,K),d.call(P+"_sub",K,bt,K),d.call(P+"_sub",K,$t,K),d.call(P+"_add",tt,K,rt),d.call(P+"_sub",tn,j,Wt),d.call(P+"_mul",Wt,kt,Wt),d.call(P+"_mul",W,jt,Nt),d.call(P+"_add",Nt,Nt,Nt),d.call(P+"_sub",Wt,Nt,W),d.call(P+"_square",rt,rt),d.call(P+"_sub",rt,At,rt),d.call(P+"_square",K,Et),d.call(P+"_sub",rt,Et,rt),d.call(P+"_add",ht,ht,ht),d.call(P+"_sub",ht,rt,ht),d.call(P+"_add",K,K,rt),d.call(P+"_neg",kt,kt),d.call(P+"_add",kt,kt,ct))}function gt(){const R=w.addFunction(D+"_prepareG2");R.addParam("pQ","i32"),R.addParam("ppreQ","i32"),R.addLocal("pCoef","i32"),R.addLocal("i","i32");const d=R.getCodeBuilder(),j=d.getLocal("pQ"),W=w.alloc(M*3),K=d.i32_const(W),J=d.getLocal("ppreQ");R.addCode(d.call(S+"_normalize",j,J),d.if(d.call(S+"_isZero",J),d.ret([])),d.call(S+"_copy",J,K),d.setLocal("pCoef",d.i32_add(d.getLocal("ppreQ"),d.i32_const(M*3)))),R.addCode(d.setLocal("i",d.i32_const(wt.length-2)),d.block(d.loop(d.call(D+"_prepDblStep",K,d.getLocal("pCoef")),d.setLocal("pCoef",d.i32_add(d.getLocal("pCoef"),d.i32_const(Q))),d.if(d.i32_load8_s(d.getLocal("i"),nt),[...d.call(D+"_prepAddStep",K,J,d.getLocal("pCoef")),...d.setLocal("pCoef",d.i32_add(d.getLocal("pCoef"),d.i32_const(Q)))]),d.br_if(1,d.i32_eqz(d.getLocal("i"))),d.setLocal("i",d.i32_sub(d.getLocal("i"),d.i32_const(1))),d.br(0))))}function ft(){const R=w.addFunction(U+"_mul1");R.addParam("pA","i32"),R.addParam("pC1","i32"),R.addParam("pR","i32");const d=R.getCodeBuilder(),j=d.getLocal("pA"),W=d.i32_add(d.getLocal("pA"),d.i32_const(E*2)),K=d.i32_add(d.getLocal("pA"),d.i32_const(E*4)),J=d.getLocal("pC1"),tt=d.getLocal("pR"),rt=d.i32_add(d.getLocal("pR"),d.i32_const(E*2)),ct=d.i32_add(d.getLocal("pR"),d.i32_const(E*4)),ht=d.i32_const(w.alloc(E*2)),bt=d.i32_const(w.alloc(E*2));R.addCode(d.call(P+"_add",j,W,ht),d.call(P+"_add",W,K,bt),d.call(P+"_mul",W,J,ct),d.call(P+"_mul",bt,J,tt),d.call(P+"_sub",tt,ct,tt),d.call(P+"_mulNR",tt,tt),d.call(P+"_mul",ht,J,rt),d.call(P+"_sub",rt,ct,rt))}ft();function Bt(){const R=w.addFunction(U+"_mul01");R.addParam("pA","i32"),R.addParam("pC0","i32"),R.addParam("pC1","i32"),R.addParam("pR","i32");const d=R.getCodeBuilder(),j=d.getLocal("pA"),W=d.i32_add(d.getLocal("pA"),d.i32_const(E*2)),K=d.i32_add(d.getLocal("pA"),d.i32_const(E*4)),J=d.getLocal("pC0"),tt=d.getLocal("pC1"),rt=d.getLocal("pR"),ct=d.i32_add(d.getLocal("pR"),d.i32_const(E*2)),ht=d.i32_add(d.getLocal("pR"),d.i32_const(E*4)),bt=d.i32_const(w.alloc(E*2)),At=d.i32_const(w.alloc(E*2)),Et=d.i32_const(w.alloc(E*2)),Nt=d.i32_const(w.alloc(E*2));R.addCode(d.call(P+"_mul",j,J,bt),d.call(P+"_mul",W,tt,At),d.call(P+"_add",j,W,Et),d.call(P+"_add",j,K,Nt),d.call(P+"_add",W,K,rt),d.call(P+"_mul",rt,tt,rt),d.call(P+"_sub",rt,At,rt),d.call(P+"_mulNR",rt,rt),d.call(P+"_add",rt,bt,rt),d.call(P+"_add",J,tt,ct),d.call(P+"_mul",ct,Et,ct),d.call(P+"_sub",ct,bt,ct),d.call(P+"_sub",ct,At,ct),d.call(P+"_mul",Nt,J,ht),d.call(P+"_sub",ht,bt,ht),d.call(P+"_add",ht,At,ht))}Bt();function pt(){const R=w.addFunction(st+"_mul014");R.addParam("pA","i32"),R.addParam("pC0","i32"),R.addParam("pC1","i32"),R.addParam("pC4","i32"),R.addParam("pR","i32");const d=R.getCodeBuilder(),j=d.getLocal("pA"),W=d.i32_add(d.getLocal("pA"),d.i32_const(E*6)),K=d.getLocal("pC0"),J=d.getLocal("pC1"),tt=d.getLocal("pC4"),rt=d.i32_const(w.alloc(E*6)),ct=d.i32_const(w.alloc(E*6)),ht=d.i32_const(w.alloc(E*2)),bt=d.getLocal("pR"),At=d.i32_add(d.getLocal("pR"),d.i32_const(E*6));R.addCode(d.call(U+"_mul01",j,K,J,rt),d.call(U+"_mul1",W,tt,ct),d.call(P+"_add",J,tt,ht),d.call(U+"_add",W,j,At),d.call(U+"_mul01",At,K,ht,At),d.call(U+"_sub",At,rt,At),d.call(U+"_sub",At,ct,At),d.call(U+"_copy",ct,bt),d.call(U+"_mulNR",bt,bt),d.call(U+"_add",bt,rt,bt))}pt();function Ot(){const R=w.addFunction(D+"_ell");R.addParam("pP","i32"),R.addParam("pCoefs","i32"),R.addParam("pF","i32");const d=R.getCodeBuilder(),j=d.getLocal("pP"),W=d.i32_add(d.getLocal("pP"),d.i32_const(Z)),K=d.getLocal("pF"),J=d.getLocal("pCoefs"),tt=d.i32_add(d.getLocal("pCoefs"),d.i32_const(E)),rt=d.i32_add(d.getLocal("pCoefs"),d.i32_const(E*2)),ct=d.i32_add(d.getLocal("pCoefs"),d.i32_const(E*3)),ht=d.i32_add(d.getLocal("pCoefs"),d.i32_const(E*4)),bt=w.alloc(E*2),At=d.i32_const(bt),Et=d.i32_const(bt),Nt=d.i32_const(bt+E),Tt=w.alloc(E*2),$t=d.i32_const(Tt),Qt=d.i32_const(Tt),jt=d.i32_const(Tt+E);R.addCode(d.call(H+"_mul",J,W,Et),d.call(H+"_mul",tt,W,Nt),d.call(H+"_mul",rt,j,Qt),d.call(H+"_mul",ct,j,jt),d.call(st+"_mul014",K,ht,$t,At,K))}Ot();function Ht(){const R=w.addFunction(D+"_millerLoop");R.addParam("ppreP","i32"),R.addParam("ppreQ","i32"),R.addParam("r","i32"),R.addLocal("pCoef","i32"),R.addLocal("i","i32");const d=R.getCodeBuilder(),j=d.getLocal("ppreP"),W=d.getLocal("pCoef"),K=d.getLocal("r");R.addCode(d.call(st+"_one",K),d.if(d.call(N+"_isZero",j),d.ret([])),d.if(d.call(N+"_isZero",d.getLocal("ppreQ")),d.ret([])),d.setLocal("pCoef",d.i32_add(d.getLocal("ppreQ"),d.i32_const(M*3))),d.setLocal("i",d.i32_const(wt.length-2)),d.block(d.loop(d.call(D+"_ell",j,W,K),d.setLocal("pCoef",d.i32_add(d.getLocal("pCoef"),d.i32_const(Q))),d.if(d.i32_load8_s(d.getLocal("i"),nt),[...d.call(D+"_ell",j,W,K),...d.setLocal("pCoef",d.i32_add(d.getLocal("pCoef"),d.i32_const(Q)))]),d.call(st+"_square",K,K),d.br_if(1,d.i32_eq(d.getLocal("i"),d.i32_const(1))),d.setLocal("i",d.i32_sub(d.getLocal("i"),d.i32_const(1))),d.br(0))),d.call(D+"_ell",j,W,K)),R.addCode(d.call(st+"_conjugate",K,K))}function on(R){const d=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760n,151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351n,0n],[2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n,1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,0n],[3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557n,877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230n],[4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786n,0n],[151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027n,3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,0n],[1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257n,2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437n,0n],[877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230n,3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557n]]],j=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[0n,4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,0n],[0n,1n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,0n],[0n,793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n]],[[1n,0n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437n,0n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,0n],[4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786n,0n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,0n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351n,0n]]],W=w.addFunction(st+"_frobeniusMap"+R);W.addParam("x","i32"),W.addParam("r","i32");const K=W.getCodeBuilder();for(let tt=0;tt<6;tt++){const rt=tt==0?K.getLocal("x"):K.i32_add(K.getLocal("x"),K.i32_const(tt*M)),ct=rt,ht=K.i32_add(K.getLocal("x"),K.i32_const(tt*M+E)),bt=tt==0?K.getLocal("r"):K.i32_add(K.getLocal("r"),K.i32_const(tt*M)),At=bt,Et=K.i32_add(K.getLocal("r"),K.i32_const(tt*M+E)),Nt=J(d[Math.floor(tt/3)][R%12],j[tt%3][R%6]),Tt=w.alloc([...t.bigInt2BytesLE(_t(Nt[0]),Z),...t.bigInt2BytesLE(_t(Nt[1]),Z)]);R%2==1?W.addCode(K.call(H+"_copy",ct,At),K.call(H+"_neg",ht,Et),K.call(P+"_mul",bt,K.i32_const(Tt),bt)):W.addCode(K.call(P+"_mul",rt,K.i32_const(Tt),bt))}function J(tt,rt){const ct=tt[0],ht=tt[1],bt=rt[0],At=rt[1],Et=[(ct*bt-ht*At)%G,(ct*At+ht*bt)%G];return b(Et[0])&&(Et[0]=Et[0]+G),Et}}function an(){const R=w.addFunction(D+"__cyclotomicSquare");R.addParam("x","i32"),R.addParam("r","i32");const d=R.getCodeBuilder(),j=d.getLocal("x"),W=d.i32_add(d.getLocal("x"),d.i32_const(M)),K=d.i32_add(d.getLocal("x"),d.i32_const(2*M)),J=d.i32_add(d.getLocal("x"),d.i32_const(3*M)),tt=d.i32_add(d.getLocal("x"),d.i32_const(4*M)),rt=d.i32_add(d.getLocal("x"),d.i32_const(5*M)),ct=d.getLocal("r"),ht=d.i32_add(d.getLocal("r"),d.i32_const(M)),bt=d.i32_add(d.getLocal("r"),d.i32_const(2*M)),At=d.i32_add(d.getLocal("r"),d.i32_const(3*M)),Et=d.i32_add(d.getLocal("r"),d.i32_const(4*M)),Nt=d.i32_add(d.getLocal("r"),d.i32_const(5*M)),Tt=d.i32_const(w.alloc(M)),$t=d.i32_const(w.alloc(M)),Qt=d.i32_const(w.alloc(M)),jt=d.i32_const(w.alloc(M)),kt=d.i32_const(w.alloc(M)),tn=d.i32_const(w.alloc(M)),Wt=d.i32_const(w.alloc(M)),Jt=d.i32_const(w.alloc(M));R.addCode(d.call(P+"_mul",j,tt,Wt),d.call(P+"_mulNR",tt,Tt),d.call(P+"_add",j,Tt,Tt),d.call(P+"_add",j,tt,Jt),d.call(P+"_mul",Jt,Tt,Tt),d.call(P+"_mulNR",Wt,Jt),d.call(P+"_add",Wt,Jt,Jt),d.call(P+"_sub",Tt,Jt,Tt),d.call(P+"_add",Wt,Wt,$t),d.call(P+"_mul",J,K,Wt),d.call(P+"_mulNR",K,Qt),d.call(P+"_add",J,Qt,Qt),d.call(P+"_add",J,K,Jt),d.call(P+"_mul",Jt,Qt,Qt),d.call(P+"_mulNR",Wt,Jt),d.call(P+"_add",Wt,Jt,Jt),d.call(P+"_sub",Qt,Jt,Qt),d.call(P+"_add",Wt,Wt,jt),d.call(P+"_mul",W,rt,Wt),d.call(P+"_mulNR",rt,kt),d.call(P+"_add",W,kt,kt),d.call(P+"_add",W,rt,Jt),d.call(P+"_mul",Jt,kt,kt),d.call(P+"_mulNR",Wt,Jt),d.call(P+"_add",Wt,Jt,Jt),d.call(P+"_sub",kt,Jt,kt),d.call(P+"_add",Wt,Wt,tn),d.call(P+"_sub",Tt,j,ct),d.call(P+"_add",ct,ct,ct),d.call(P+"_add",Tt,ct,ct),d.call(P+"_add",$t,tt,Et),d.call(P+"_add",Et,Et,Et),d.call(P+"_add",$t,Et,Et),d.call(P+"_mul",tn,d.i32_const(o),Jt),d.call(P+"_add",Jt,J,At),d.call(P+"_add",At,At,At),d.call(P+"_add",Jt,At,At),d.call(P+"_sub",kt,K,bt),d.call(P+"_add",bt,bt,bt),d.call(P+"_add",kt,bt,bt),d.call(P+"_sub",Qt,W,ht),d.call(P+"_add",ht,ht,ht),d.call(P+"_add",Qt,ht,ht),d.call(P+"_add",jt,rt,Nt),d.call(P+"_add",Nt,Nt,Nt),d.call(P+"_add",jt,Nt,Nt))}function en(R,d,j){const W=Gt(R).map(bt=>bt==-1?255:bt),K=w.alloc(W),J=w.addFunction(D+"__cyclotomicExp_"+j);J.addParam("x","i32"),J.addParam("r","i32"),J.addLocal("bit","i32"),J.addLocal("i","i32");const tt=J.getCodeBuilder(),rt=tt.getLocal("x"),ct=tt.getLocal("r"),ht=tt.i32_const(w.alloc(h));J.addCode(tt.call(st+"_conjugate",rt,ht),tt.call(st+"_one",ct),tt.if(tt.teeLocal("bit",tt.i32_load8_s(tt.i32_const(W.length-1),K)),tt.if(tt.i32_eq(tt.getLocal("bit"),tt.i32_const(1)),tt.call(st+"_mul",ct,rt,ct),tt.call(st+"_mul",ct,ht,ct))),tt.setLocal("i",tt.i32_const(W.length-2)),tt.block(tt.loop(tt.call(D+"__cyclotomicSquare",ct,ct),tt.if(tt.teeLocal("bit",tt.i32_load8_s(tt.getLocal("i"),K)),tt.if(tt.i32_eq(tt.getLocal("bit"),tt.i32_const(1)),tt.call(st+"_mul",ct,rt,ct),tt.call(st+"_mul",ct,ht,ct))),tt.br_if(1,tt.i32_eqz(tt.getLocal("i"))),tt.setLocal("i",tt.i32_sub(tt.getLocal("i"),tt.i32_const(1))),tt.br(0)))),J.addCode(tt.call(st+"_conjugate",ct,ct))}function rn(){an(),en(Lt,B,"w0");const R=w.addFunction(D+"_finalExponentiation");R.addParam("x","i32"),R.addParam("r","i32");const d=R.getCodeBuilder(),j=d.getLocal("x"),W=d.getLocal("r"),K=d.i32_const(w.alloc(h)),J=d.i32_const(w.alloc(h)),tt=d.i32_const(w.alloc(h)),rt=d.i32_const(w.alloc(h)),ct=d.i32_const(w.alloc(h)),ht=d.i32_const(w.alloc(h)),bt=d.i32_const(w.alloc(h));R.addCode(d.call(st+"_frobeniusMap6",j,K),d.call(st+"_inverse",j,J),d.call(st+"_mul",K,J,tt),d.call(st+"_copy",tt,J),d.call(st+"_frobeniusMap2",tt,tt),d.call(st+"_mul",tt,J,tt),d.call(D+"__cyclotomicSquare",tt,J),d.call(st+"_conjugate",J,J),d.call(D+"__cyclotomicExp_w0",tt,rt),d.call(D+"__cyclotomicSquare",rt,ct),d.call(st+"_mul",J,rt,ht),d.call(D+"__cyclotomicExp_w0",ht,J),d.call(D+"__cyclotomicExp_w0",J,K),d.call(D+"__cyclotomicExp_w0",K,bt),d.call(st+"_mul",bt,ct,bt),d.call(D+"__cyclotomicExp_w0",bt,ct),d.call(st+"_conjugate",ht,ht),d.call(st+"_mul",ct,ht,ct),d.call(st+"_mul",ct,tt,ct),d.call(st+"_conjugate",tt,ht),d.call(st+"_mul",J,tt,J),d.call(st+"_frobeniusMap3",J,J),d.call(st+"_mul",bt,ht,bt),d.call(st+"_frobeniusMap1",bt,bt),d.call(st+"_mul",rt,K,rt),d.call(st+"_frobeniusMap2",rt,rt),d.call(st+"_mul",rt,J,rt),d.call(st+"_mul",rt,bt,rt),d.call(st+"_mul",rt,ct,W))}function cn(){const R=w.addFunction(D+"_finalExponentiationOld");R.addParam("x","i32"),R.addParam("r","i32");const j=w.alloc(t.bigInt2BytesLE(322277361516934140462891564586510139908379969514828494218366688025288661041104682794998680497580008899973249814104447692778988208376779573819485263026159588510513834876303014016798809919343532899164848730280942609956670917565618115867287399623286813270357901731510188149934363360381614501334086825442271920079363289954510565375378443704372994881406797882676971082200626541916413184642520269678897559532260949334760604962086348898118982248842634379637598665468817769075878555493752214492790122785850202957575200176084204422751485957336465472324810982833638490904279282696134323072515220044451592646885410572234451732790590013479358343841220074174848221722017083597872017638514103174122784843925578370430843522959600095676285723737049438346544753168912974976791528535276317256904336520179281145394686565050419250614107803233314658825463117900250701199181529205942363159325765991819433914303908860460720581408201373164047773794825411011922305820065611121544561808414055302212057471395719432072209245600258134364584636810093520285711072578721435517884103526483832733289802426157301542744476740008494780363354305116978805620671467071400711358839553375340724899735460480144599782014906586543813292157922220645089192130209334926661588737007768565838519456601560804957985667880395221049249803753582637708560n,544)),W=R.getCodeBuilder();R.addCode(W.call(st+"_exp",W.getLocal("x"),W.i32_const(j),W.i32_const(544),W.getLocal("r")))}const fn=w.alloc(Ut),Ln=w.alloc(dt);function In(R){const d=w.addFunction(D+"_pairingEq"+R);for(let J=0;J<R;J++)d.addParam("p_"+J,"i32"),d.addParam("q_"+J,"i32");d.addParam("c","i32"),d.setReturnType("i32");const j=d.getCodeBuilder(),W=j.i32_const(w.alloc(h)),K=j.i32_const(w.alloc(h));d.addCode(j.call(st+"_one",W));for(let J=0;J<R;J++)d.addCode(j.call(D+"_prepareG1",j.getLocal("p_"+J),j.i32_const(fn))),d.addCode(j.call(D+"_prepareG2",j.getLocal("q_"+J),j.i32_const(Ln))),d.addCode(j.if(j.i32_eqz(j.call(N+"_inGroupAffine",j.i32_const(fn))),j.ret(j.i32_const(0))),j.if(j.i32_eqz(j.call(S+"_inGroupAffine",j.i32_const(Ln))),j.ret(j.i32_const(0)))),d.addCode(j.call(D+"_millerLoop",j.i32_const(fn),j.i32_const(Ln),K)),d.addCode(j.call(st+"_mul",W,K,W));d.addCode(j.call(D+"_finalExponentiation",W,W)),d.addCode(j.call(st+"_eq",W,j.getLocal("c")))}function Mt(){const R=w.addFunction(D+"_pairing");R.addParam("p","i32"),R.addParam("q","i32"),R.addParam("r","i32");const d=R.getCodeBuilder(),j=d.i32_const(w.alloc(h));R.addCode(d.call(D+"_prepareG1",d.getLocal("p"),d.i32_const(fn))),R.addCode(d.call(D+"_prepareG2",d.getLocal("q"),d.i32_const(Ln))),R.addCode(d.call(D+"_millerLoop",d.i32_const(fn),d.i32_const(Ln),j)),R.addCode(d.call(D+"_finalExponentiation",j,d.getLocal("r")))}function m(){const R=w.addFunction(S+"_inGroupAffine");R.addParam("p","i32"),R.setReturnType("i32");const d=R.getCodeBuilder(),j=[2001204777610833696708894912867952078278441409969503942666029068062015825245418932221343814564507832018947136279894n,2001204777610833696708894912867952078278441409969503942666029068062015825245418932221343814564507832018947136279893n],W=4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,K=[2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n,2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n],J=d.i32_const(w.alloc([...t.bigInt2BytesLE(_t(j[0]),Z),...t.bigInt2BytesLE(_t(j[1]),Z)])),tt=d.i32_const(w.alloc(t.bigInt2BytesLE(_t(W),Z))),rt=d.i32_const(w.alloc([...t.bigInt2BytesLE(_t(K[0]),Z),...t.bigInt2BytesLE(_t(K[1]),Z)])),ct=d.i32_const(w.alloc(t.bigInt2BytesLE(Lt,8))),ht=d.getLocal("p"),bt=d.i32_add(d.getLocal("p"),d.i32_const(M)),At=d.i32_const(w.alloc(E)),Et=d.i32_const(w.alloc(M)),Nt=d.i32_const(w.alloc(M)),Tt=w.alloc(M*2),$t=d.i32_const(Tt),Qt=d.i32_const(Tt),jt=d.i32_const(Tt),kt=d.i32_const(Tt+E),tn=d.i32_const(Tt+M),Wt=d.i32_const(Tt+M),Jt=d.i32_const(Tt+M+E),xn=w.alloc(M*3),Sn=d.i32_const(xn),Pn=d.i32_const(xn),ua=d.i32_const(xn),On=d.i32_const(xn+E),wa=d.i32_const(xn+M),Xn=d.i32_const(xn+M),Dn=d.i32_const(xn+M+E),aa=d.i32_const(xn+M*2);R.addCode(d.if(d.call(S+"_isZeroAffine",d.getLocal("p")),d.ret(d.i32_const(1))),d.if(d.i32_eqz(d.call(S+"_inCurveAffine",d.getLocal("p"))),d.ret(d.i32_const(0))),d.call(P+"_mul",ht,J,Et),d.call(P+"_mul",bt,J,Nt),d.call(P+"_mul1",Et,tt,Qt),d.call(P+"_neg",Nt,tn),d.call(P+"_neg",Et,Pn),d.call(P+"_mul",Nt,rt,wa),d.call(H+"_sub",jt,kt,At),d.call(H+"_add",jt,kt,kt),d.call(H+"_copy",At,jt),d.call(H+"_sub",Wt,Jt,At),d.call(H+"_add",Wt,Jt,Jt),d.call(H+"_copy",At,Wt),d.call(H+"_add",ua,On,At),d.call(H+"_sub",ua,On,On),d.call(H+"_copy",At,ua),d.call(H+"_sub",Dn,Xn,At),d.call(H+"_add",Xn,Dn,Dn),d.call(H+"_copy",At,Xn),d.call(P+"_one",aa),d.call(S+"_timesScalar",Sn,ct,d.i32_const(8),Sn),d.call(S+"_addMixed",Sn,$t,Sn),d.ret(d.call(S+"_eqMixed",Sn,d.getLocal("p"))));const oa=w.addFunction(S+"_inGroup");oa.addParam("pIn","i32"),oa.setReturnType("i32");const ea=oa.getCodeBuilder(),ko=ea.i32_const(w.alloc(M*2));oa.addCode(ea.call(S+"_toAffine",ea.getLocal("pIn"),ko),ea.ret(ea.call(S+"_inGroupAffine",ko)))}function C(){const R=w.addFunction(N+"_inGroupAffine");R.addParam("p","i32"),R.setReturnType("i32");const d=R.getCodeBuilder(),j=4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,W=793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,K=(Lt*Lt-1n)/3n,J=d.i32_const(w.alloc(t.bigInt2BytesLE(_t(j),Z))),tt=d.i32_const(w.alloc(t.bigInt2BytesLE(_t(W),Z))),rt=d.i32_const(w.alloc(t.bigInt2BytesLE(K,16))),ct=d.getLocal("p"),ht=d.i32_add(d.getLocal("p"),d.i32_const(E)),bt=w.alloc(E*3),At=d.i32_const(bt),Et=d.i32_const(bt),Nt=d.i32_const(bt+E),Tt=w.alloc(E*2),$t=d.i32_const(Tt),Qt=d.i32_const(Tt),jt=d.i32_const(Tt+E);R.addCode(d.if(d.call(N+"_isZeroAffine",d.getLocal("p")),d.ret(d.i32_const(1))),d.if(d.i32_eqz(d.call(N+"_inCurveAffine",d.getLocal("p"))),d.ret(d.i32_const(0))),d.call(H+"_mul",ct,J,Et),d.call(H+"_copy",ht,Nt),d.call(H+"_mul",ct,tt,Qt),d.call(H+"_copy",ht,jt),d.call(N+"_doubleAffine",At,At),d.call(N+"_subMixed",At,d.getLocal("p"),At),d.call(N+"_subMixed",At,$t,At),d.call(N+"_timesScalar",At,rt,d.i32_const(16),At),d.ret(d.call(N+"_eqMixed",At,$t)));const kt=w.addFunction(N+"_inGroup");kt.addParam("pIn","i32"),kt.setReturnType("i32");const tn=kt.getCodeBuilder(),Wt=tn.i32_const(w.alloc(E*2));kt.addCode(tn.call(N+"_toAffine",tn.getLocal("pIn"),Wt),tn.ret(tn.call(N+"_inGroupAffine",Wt)))}for(let R=0;R<10;R++)on(R),w.exportFunction(st+"_frobeniusMap"+R);C(),m(),at(),X(),$(),gt(),Ht(),cn(),rn();for(let R=1;R<=5;R++)In(R),w.exportFunction(D+"_pairingEq"+R);Mt(),w.exportFunction(D+"_pairing"),w.exportFunction(D+"_prepareG1"),w.exportFunction(D+"_prepareG2"),w.exportFunction(D+"_millerLoop"),w.exportFunction(D+"_finalExponentiation"),w.exportFunction(D+"_finalExponentiationOld"),w.exportFunction(D+"__cyclotomicSquare"),w.exportFunction(D+"__cyclotomicExp_w0"),w.exportFunction(U+"_mul1"),w.exportFunction(U+"_mul01"),w.exportFunction(st+"_mul014"),w.exportFunction(N+"_inGroupAffine"),w.exportFunction(N+"_inGroup"),w.exportFunction(S+"_inGroupAffine"),w.exportFunction(S+"_inGroup")},se}var zc;function Wd(){return zc||(zc=1,Na.buildBn128=Yd(),Na.buildBls12381=Xd(),Na.buildF1m=bo()),Na}Wd();const wn=1<<30;let Jd=class Ji{constructor(a){this.buffers=[],this.byteLength=a;for(let n=0;n<a;n+=wn){const e=Math.min(a-n,wn);this.buffers.push(new Uint8Array(e))}}slice(a,n){n===void 0&&(n=this.byteLength),a===void 0&&(a=0);const e=n-a,c=Math.floor(a/wn),i=Math.floor((a+e-1)/wn);if(c==i||e==0)return this.buffers[c].slice(a%wn,a%wn+e);let r,_=c,u=a%wn,l=e;for(;l>0;){const s=u+l>wn?wn-u:l,I=new Uint8Array(this.buffers[_].buffer,this.buffers[_].byteOffset+u,s);if(s==e)return I.slice();r||(e<=wn?r=new Uint8Array(e):r=new Ji(e)),r.set(I,e-l),l=l-s,_++,u=0}return r}set(a,n){n===void 0&&(n=0);const e=a.byteLength;if(e==0)return;const c=Math.floor(n/wn),i=Math.floor((n+e-1)/wn);if(c==i)return a instanceof Ji&&a.buffers.length==1?this.buffers[c].set(a.buffers[0],n%wn):this.buffers[c].set(a,n%wn);let r=c,_=n%wn,u=e;for(;u>0;){const l=_+u>wn?wn-_:u,s=a.slice(e-u,e-u+l);new Uint8Array(this.buffers[r].buffer,this.buffers[r].byteOffset+_,l).set(s),u=u-l,r++,_=0}}};function t2(t){let n,e;t&&(t.onmessage=function(s){let I;if(s.data?I=s.data:I=s,I[0].cmd=="INIT")c(I[0]).then(function(){t.postMessage(I.result)});else if(I[0].cmd=="TERMINATE")t.close();else{const b=l(I);t.postMessage(b)}});async function c(s){const I=new Uint8Array(s.code),b=await WebAssembly.compile(I);e=new WebAssembly.Memory({initial:s.init,maximum:32767}),n=await WebAssembly.instantiate(b,{env:{memory:e}})}function i(s){const I=new Uint32Array(e.buffer,0,1);for(;I[0]&3;)I[0]++;const b=I[0];if(I[0]+=s,I[0]+s>e.buffer.byteLength){const f=e.buffer.byteLength/65536;let w=Math.floor((I[0]+s)/65536)+1;w>32767&&(w=32767),e.grow(w-f)}return b}function r(s){const I=i(s.byteLength);return u(I,s),I}function _(s,I){const b=new Uint8Array(e.buffer);return new Uint8Array(b.buffer,b.byteOffset+s,I)}function u(s,I){new Uint8Array(e.buffer).set(new Uint8Array(I),s)}function l(s){if(s[0].cmd=="INIT")return c(s[0]);const I={vars:[],out:[]},f=new Uint32Array(e.buffer,0,1)[0];for(let O=0;O<s.length;O++)switch(s[O].cmd){case"ALLOCSET":I.vars[s[O].var]=r(s[O].buff);break;case"ALLOC":I.vars[s[O].var]=i(s[O].len);break;case"SET":u(I.vars[s[O].var],s[O].buff);break;case"CALL":{const D=[];for(let G=0;G<s[O].params.length;G++){const V=s[O].params[G];typeof V.var<"u"?D.push(I.vars[V.var]+(V.offset||0)):typeof V.val<"u"&&D.push(V.val)}n.exports[s[O].fnName](...D);break}case"GET":I.out[s[O].out]=_(I.vars[s[O].var],s[O].len).slice();break;default:throw new Error("Invalid cmd")}const w=new Uint32Array(e.buffer,0,1);return w[0]=f,I.out}return l}var re,Rc;function n2(){return Rc||(Rc=1,re=Worker),re}var a2=n2(),o2=Uo(a2);function e2(t){return process.browser?globalThis.btoa(t):Buffer.from(t).toString("base64")}e2("("+t2.toString()+")(self)"),globalThis.curve_bn128=null,globalThis.curve_bls12381=null,ga("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001",16),ga("21888242871839275222246405745257275088548364400416034343698204186575808495617"),ga("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab",16),ga("21888242871839275222246405745257275088696311157297823662689037894645226208583");const Tc=Gd;async function kc(t,a,n,e){if(n=n||4096*64,["w+","wx+","r","ax+","a+"].indexOf(a)<0)throw new Error("Invalid open option");const c=await Ua.promises.open(t,a),i=await c.stat();return new i2(c,i,n,e,t)}class i2{constructor(a,n,e,c,i){for(this.fileName=i,this.fd=a,this.pos=0,this.pageSize=c||256;this.pageSize<n.blksize;)this.pageSize*=2;this.totalSize=n.size,this.totalPages=Math.floor((n.size-1)/this.pageSize)+1,this.maxPagesLoaded=Math.floor(e/this.pageSize)+1,this.pages={},this.pendingLoads=[],this.writing=!1,this.reading=!1,this.avBuffs=[],this.history={}}_loadPage(a){const n=this,e=new Promise((c,i)=>{n.pendingLoads.push({page:a,resolve:c,reject:i})});return n.__statusPage("After Load request: ",a),e}__statusPage(a,n){const e=[],c=this;if(!c.logHistory)return;e.push("=="+a+" "+n);let i="";for(let r=0;r<c.pendingLoads.length;r++)c.pendingLoads[r].page==n&&(i=i+" "+r);if(i&&e.push("Pending loads:"+i),typeof c.pages[n]<"u"){const r=c.pages[n];e.push("Loaded"),e.push("pendingOps: "+r.pendingOps),r.loading&&e.push("loading: "+r.loading),r.writing&&e.push("writing"),r.dirty&&e.push("dirty")}e.push("=="),c.history[n]||(c.history[n]=[]),c.history[n].push(e)}__printHistory(a){const n=this;n.history[a]||console.log("Empty History ",a),console.log("History "+a);for(let e=0;e<n.history[a].length;e++)for(let c=0;c<n.history[a][e].length;c++)console.log("-> "+n.history[a][e][c])}_triggerLoad(){const a=this;if(a.reading||a.pendingLoads.length==0)return;const n=Object.keys(a.pages),e=[];for(let _=0;_<n.length;_++){const u=a.pages[parseInt(n[_])];u.dirty==!1&&u.pendingOps==0&&!u.writing&&!u.loading&&e.push(parseInt(n[_]))}let c=a.maxPagesLoaded-n.length;const i=[];for(;a.pendingLoads.length>0&&(typeof a.pages[a.pendingLoads[0].page]<"u"||c>0||e.length>0);){const _=a.pendingLoads.shift();if(typeof a.pages[_.page]<"u"){a.pages[_.page].pendingOps++;const u=e.indexOf(_.page);u>=0&&e.splice(u,1),a.pages[_.page].loading?a.pages[_.page].loading.push(_):_.resolve(),a.__statusPage("After Load (cached): ",_.page)}else{if(c)c--;else{const u=e.shift();a.__statusPage("Before Unload: ",u),a.avBuffs.unshift(a.pages[u]),delete a.pages[u],a.__statusPage("After Unload: ",u)}_.page>=a.totalPages?(a.pages[_.page]=r(),_.resolve(),a.__statusPage("After Load (new): ",_.page)):(a.reading=!0,a.pages[_.page]=r(),a.pages[_.page].loading=[_],i.push(a.fd.read(a.pages[_.page].buff,0,a.pageSize,_.page*a.pageSize).then(u=>{a.pages[_.page].size=u.bytesRead;const l=a.pages[_.page].loading;delete a.pages[_.page].loading;for(let s=0;s<l.length;s++)l[s].resolve();return a.__statusPage("After Load (loaded): ",_.page),u},u=>{_.reject(u)})),a.__statusPage("After Load (loading): ",_.page))}}Promise.all(i).then(()=>{a.reading=!1,a.pendingLoads.length>0&&setImmediate(a._triggerLoad.bind(a)),a._tryClose()});function r(){if(a.avBuffs.length>0){const _=a.avBuffs.shift();return _.dirty=!1,_.pendingOps=1,_.size=0,_}else return{dirty:!1,buff:new Uint8Array(a.pageSize),pendingOps:1,size:0}}}_triggerWrite(){const a=this;if(a.writing)return;const n=Object.keys(a.pages),e=[];for(let c=0;c<n.length;c++){const i=a.pages[parseInt(n[c])];i.dirty&&(i.dirty=!1,i.writing=!0,a.writing=!0,e.push(a.fd.write(i.buff,0,i.size,parseInt(n[c])*a.pageSize).then(()=>{i.writing=!1},r=>{console.log("ERROR Writing: "+r),a.error=r,a._tryClose()})))}a.writing&&Promise.all(e).then(()=>{a.writing=!1,setImmediate(a._triggerWrite.bind(a)),a._tryClose(),a.pendingLoads.length>0&&setImmediate(a._triggerLoad.bind(a))})}_getDirtyPage(){for(let a in this.pages)if(this.pages[a].dirty)return a;return-1}async write(a,n){if(a.byteLength==0)return;const e=this;if(typeof n>"u"&&(n=e.pos),e.pos=n+a.byteLength,e.totalSize<n+a.byteLength&&(e.totalSize=n+a.byteLength),e.pendingClose)throw new Error("Writing a closing file");const c=Math.floor(n/e.pageSize),i=Math.floor((n+a.byteLength-1)/e.pageSize),r=[];for(let s=c;s<=i;s++)r.push(e._loadPage(s));e._triggerLoad();let _=c,u=n%e.pageSize,l=a.byteLength;for(;l>0;){await r[_-c];const s=u+l>e.pageSize?e.pageSize-u:l,I=a.slice(a.byteLength-l,a.byteLength-l+s);new Uint8Array(e.pages[_].buff.buffer,u,s).set(I),e.pages[_].dirty=!0,e.pages[_].pendingOps--,e.pages[_].size=Math.max(u+s,e.pages[_].size),_>=e.totalPages&&(e.totalPages=_+1),l=l-s,_++,u=0,e.writing||setImmediate(e._triggerWrite.bind(e))}}async read(a,n){const e=this;let c=new Uint8Array(a);return await e.readToBuffer(c,0,a,n),c}async readToBuffer(a,n,e,c){if(e==0)return;const i=this;if(e>i.pageSize*i.maxPagesLoaded*.8){const b=Math.floor(e*1.1);this.maxPagesLoaded=Math.floor(b/i.pageSize)+1}if(typeof c>"u"&&(c=i.pos),i.pos=c+e,i.pendingClose)throw new Error("Reading a closing file");const r=Math.floor(c/i.pageSize),_=Math.floor((c+e-1)/i.pageSize),u=[];for(let b=r;b<=_;b++)u.push(i._loadPage(b));i._triggerLoad();let l=r,s=c%i.pageSize,I=c+e>i.totalSize?e-(c+e-i.totalSize):e;for(;I>0;){await u[l-r],i.__statusPage("After Await (read): ",l);const b=s+I>i.pageSize?i.pageSize-s:I,f=new Uint8Array(i.pages[l].buff.buffer,i.pages[l].buff.byteOffset+s,b);a.set(f,n+e-I),i.pages[l].pendingOps--,i.__statusPage("After Op done: ",l),I=I-b,l++,s=0,i.pendingLoads.length>0&&setImmediate(i._triggerLoad.bind(i))}this.pos=c+e}_tryClose(){const a=this;!a.pendingClose||(a.error&&a.pendingCloseReject(a.error),a._getDirtyPage()>=0||a.writing||a.reading||a.pendingLoads.length>0)||a.pendingClose()}close(){const a=this;if(a.pendingClose)throw new Error("Closing the file twice");return new Promise((n,e)=>{a.pendingClose=n,a.pendingCloseReject=e,a._tryClose()}).then(()=>{a.fd.close()},n=>{throw a.fd.close(),n})}async discard(){await this.close(),await Ua.promises.unlink(this.fileName)}async writeULE32(a,n){const e=this,c=new Uint8Array(4);new DataView(c.buffer).setUint32(0,a,!0),await e.write(c,n)}async writeUBE32(a,n){const e=this,c=new Uint8Array(4);new DataView(c.buffer).setUint32(0,a,!1),await e.write(c,n)}async writeULE64(a,n){const e=this,c=new Uint8Array(8),i=new DataView(c.buffer);i.setUint32(0,a&4294967295,!0),i.setUint32(4,Math.floor(a/4294967296),!0),await e.write(c,n)}async readULE32(a){const e=await this.read(4,a);return new Uint32Array(e.buffer)[0]}async readUBE32(a){const e=await this.read(4,a);return new DataView(e.buffer).getUint32(0,!1)}async readULE64(a){const e=await this.read(8,a),c=new Uint32Array(e.buffer);return c[1]*4294967296+c[0]}}function c2(t){const a=t.initialSize||1048576,n=new Qc;return n.o=t,n.o.data=new Uint8Array(a),n.allocSize=a,n.totalSize=0,n.readOnly=!1,n.pos=0,n}function l2(t){const a=new Qc;return a.o=t,a.allocSize=t.data.byteLength,a.totalSize=t.data.byteLength,a.readOnly=!0,a.pos=0,a}const de=new Uint8Array(4),Uc=new DataView(de.buffer),Nc=new Uint8Array(8),Dc=new DataView(Nc.buffer);class Qc{constructor(){this.pageSize=16384}_resizeIfNeeded(a){if(a>this.allocSize){const n=Math.max(this.allocSize+1048576,Math.floor(this.allocSize*1.1),a),e=new Uint8Array(n);e.set(this.o.data),this.o.data=e,this.allocSize=n}}async write(a,n){if(typeof n>"u"&&(n=this.pos),this.readOnly)throw new Error("Writing a read only file");this._resizeIfNeeded(n+a.byteLength),this.o.data.set(a.slice(),n),n+a.byteLength>this.totalSize&&(this.totalSize=n+a.byteLength),this.pos=n+a.byteLength}async readToBuffer(a,n,e,c){if(typeof c>"u"&&(c=this.pos),this.readOnly&&c+e>this.totalSize)throw new Error("Reading out of bounds");this._resizeIfNeeded(c+e);const r=new Uint8Array(this.o.data.buffer,this.o.data.byteOffset+c,e);a.set(r,n),this.pos=c+e}async read(a,n){const e=this,c=new Uint8Array(a);return await e.readToBuffer(c,0,a,n),c}close(){this.o.data.byteLength!=this.totalSize&&(this.o.data=this.o.data.slice(0,this.totalSize))}async discard(){}async writeULE32(a,n){const e=this;Uc.setUint32(0,a,!0),await e.write(de,n)}async writeUBE32(a,n){const e=this;Uc.setUint32(0,a,!1),await e.write(de,n)}async writeULE64(a,n){const e=this;Dc.setUint32(0,a&4294967295,!0),Dc.setUint32(4,Math.floor(a/4294967296),!0),await e.write(Nc,n)}async readULE32(a){const e=await this.read(4,a);return new Uint32Array(e.buffer)[0]}async readUBE32(a){const e=await this.read(4,a);return new DataView(e.buffer).getUint32(0,!1)}async readULE64(a){const e=await this.read(8,a),c=new Uint32Array(e.buffer);return c[1]*4294967296+c[0]}}const En=1<<22;function s2(t){const a=t.initialSize||0,n=new jc;n.o=t;const e=a?Math.floor((a-1)/En)+1:0;n.o.data=[];for(let c=0;c<e-1;c++)n.o.data.push(new Uint8Array(En));return e&&n.o.data.push(new Uint8Array(a-En*(e-1))),n.totalSize=0,n.readOnly=!1,n.pos=0,n}function r2(t){const a=new jc;return a.o=t,a.totalSize=(t.data.length-1)*En+t.data[t.data.length-1].byteLength,a.readOnly=!0,a.pos=0,a}const _e=new Uint8Array(4),$c=new DataView(_e.buffer),Gc=new Uint8Array(8),Zc=new DataView(Gc.buffer);class jc{constructor(){this.pageSize=16384}_resizeIfNeeded(a){if(a<=this.totalSize)return;if(this.readOnly)throw new Error("Reading out of file bounds");const n=Math.floor((a-1)/En)+1;for(let e=Math.max(this.o.data.length-1,0);e<n;e++){const c=e<n-1?En:a-(n-1)*En,i=new Uint8Array(c);e==this.o.data.length-1&&i.set(this.o.data[e]),this.o.data[e]=i}this.totalSize=a}async write(a,n){const e=this;if(typeof n>"u"&&(n=e.pos),this.readOnly)throw new Error("Writing a read only file");this._resizeIfNeeded(n+a.byteLength);let i=Math.floor(n/En),r=n%En,_=a.byteLength;for(;_>0;){const u=r+_>En?En-r:_,l=a.slice(a.byteLength-_,a.byteLength-_+u);new Uint8Array(e.o.data[i].buffer,r,u).set(l),_=_-u,i++,r=0}this.pos=n+a.byteLength}async readToBuffer(a,n,e,c){const i=this;if(typeof c>"u"&&(c=i.pos),this.readOnly&&c+e>this.totalSize)throw new Error("Reading out of bounds");this._resizeIfNeeded(c+e);let _=Math.floor(c/En),u=c%En,l=e;for(;l>0;){const s=u+l>En?En-u:l,I=new Uint8Array(i.o.data[_].buffer,u,s);a.set(I,n+e-l),l=l-s,_++,u=0}this.pos=c+e}async read(a,n){const e=this,c=new Uint8Array(a);return await e.readToBuffer(c,0,a,n),c}close(){}async discard(){}async writeULE32(a,n){const e=this;$c.setUint32(0,a,!0),await e.write(_e,n)}async writeUBE32(a,n){const e=this;$c.setUint32(0,a,!1),await e.write(_e,n)}async writeULE64(a,n){const e=this;Zc.setUint32(0,a&4294967295,!0),Zc.setUint32(4,Math.floor(a/4294967296),!0),await e.write(Gc,n)}async readULE32(a){const e=await this.read(4,a);return new Uint32Array(e.buffer)[0]}async readUBE32(a){const e=await this.read(4,a);return new DataView(e.buffer).getUint32(0,!1)}async readULE64(a){const e=await this.read(8,a),c=new Uint32Array(e.buffer);return c[1]*4294967296+c[0]}}const Kc=65536,Hc=8192;async function Vc(t,a,n){if(typeof t=="string"&&(t={type:"file",fileName:t,cacheSize:Kc,pageSize:Hc}),t.type=="file")return await kc(t.fileName,"w+",t.cacheSize,t.pageSize);if(t.type=="mem")return c2(t);if(t.type=="bigMem")return s2(t);throw new Error("Invalid FastFile type: "+t.type)}async function ue(t,a,n){if(t instanceof Uint8Array&&(t={type:"mem",data:t}),process.browser?typeof t=="string"&&(t={type:"mem",data:await fetch(t).then(function(c){return c.arrayBuffer()}).then(function(c){return new Uint8Array(c)})}):typeof t=="string"&&(t={type:"file",fileName:t,cacheSize:a||Kc,pageSize:n||Hc}),t.type=="file")return await kc(t.fileName,"r",t.cacheSize,t.pageSize);if(t.type=="mem")return await l2(t);if(t.type=="bigMem")return await r2(t);throw new Error("Invalid FastFile type: "+t.type)}async function d2(t,a,n,e,c){const i=await ue(t,e,c),r=await i.read(4);let _="";for(let I=0;I<4;I++)_+=String.fromCharCode(r[I]);if(_!=a)throw new Error(t+": Invalid File format");if(await i.readULE32()>n)throw new Error("Version not supported");const l=await i.readULE32();let s=[];for(let I=0;I<l;I++){let b=await i.readULE32(),f=await i.readULE64();typeof s[b]>"u"&&(s[b]=[]),s[b].push({p:i.pos,size:f}),i.pos+=f}return{fd:i,sections:s}}async function _2(t,a,n,e,c,i){const r=await Vc(t),_=new Uint8Array(4);for(let u=0;u<4;u++)_[u]=a.charCodeAt(u);return await r.write(_,0),await r.writeULE32(n),await r.writeULE32(e),r}async function Yc(t,a){if(typeof t.writingSection<"u")throw new Error("Already writing a section");await t.writeULE32(a),t.writingSection={pSectionSize:t.pos},await t.writeULE64(0)}async function Xc(t){if(typeof t.writingSection>"u")throw new Error("Not writing a section");const a=t.pos-t.writingSection.pSectionSize-8,n=t.pos;t.pos=t.writingSection.pSectionSize,await t.writeULE64(a),t.pos=n,delete t.writingSection}async function u2(t,a,n){if(typeof t.readingSection<"u")throw new Error("Already reading a section");if(!a[n])throw new Error(t.fileName+": Missing section "+n);if(a[n].length>1)throw new Error(t.fileName+": Section Duplicated "+n);t.pos=a[n][0].p,t.readingSection=a[n][0]}async function g2(t,a){if(typeof t.readingSection>"u")throw new Error("Not reading a section");if(t.pos-t.readingSection.p!=t.readingSection.size)throw new Error("Invalid section size reading");delete t.readingSection}async function f2(t,a,n,e){const c=new Uint8Array(n);Tc.toRprLE(c,0,a,n),await t.write(c,e)}async function ge(t,a,n){const e=await t.read(a,n);return Tc.fromRprLE(e,0,a)}async function h2(t,a,n,e,c){if(e=typeof e>"u"?0:e,c=typeof c>"u"?a[n][0].size-e:c,e+c>a[n][0].size)throw new Error("Reading out of the range of the section");let i;return c<1<<30?i=new Uint8Array(c):i=new Jd(c),await t.readToBuffer(i,0,c,a[n][0].p+e),i}const L2=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4];function Wc(t,a){if(!a||a==10)return BigInt(t);if(a==16)return t.slice(0,2)=="0x"?BigInt(t):BigInt("0x"+t)}const p2=Wc;function b2(t,a){let n=BigInt(0);a=BigInt(a);for(let e=0;e<t.length;e++)n=n*a+BigInt(t[e]);return n}function y2(t){const a=t.toString(16);return(a.length-1)*4+L2[parseInt(a[0],16)]}function A2(t){return BigInt(t)<BigInt(0)}function m2(t){return!t}function Jc(t,a){return BigInt(t)<<BigInt(a)}function tl(t,a){return BigInt(t)>>BigInt(a)}const C2=Jc,I2=tl;function w2(t){return(BigInt(t)&BigInt(1))==BigInt(1)}function v2(t){let a=BigInt(t);const n=[];for(;a;){if(a&BigInt(1)){const e=2-Number(a%BigInt(4));n.push(e),a=a-BigInt(e)}else n.push(0);a=a>>BigInt(1)}return n}function B2(t){let a=BigInt(t);const n=[];for(;a;)a&BigInt(1)?n.push(1):n.push(0),a=a>>BigInt(1);return n}function E2(t){if(t>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("Number too big");return Number(t)}function F2(t,a){const n=[];let e=BigInt(t);for(a=BigInt(a);e;)n.unshift(Number(e%a)),e=e/a;return n}function x2(t,a){return BigInt(t)+BigInt(a)}function S2(t,a){return BigInt(t)-BigInt(a)}function q2(t){return-BigInt(t)}function P2(t,a){return BigInt(t)*BigInt(a)}function O2(t){return BigInt(t)*BigInt(t)}function M2(t,a){return BigInt(t)**BigInt(a)}function z2(t,a){return BigInt(t)**BigInt(a)}function R2(t){return BigInt(t)>=0?BigInt(t):-BigInt(t)}function T2(t,a){return BigInt(t)/BigInt(a)}function k2(t,a){return BigInt(t)%BigInt(a)}function U2(t,a){return BigInt(t)==BigInt(a)}function N2(t,a){return BigInt(t)!=BigInt(a)}function D2(t,a){return BigInt(t)<BigInt(a)}function Q2(t,a){return BigInt(t)>BigInt(a)}function $2(t,a){return BigInt(t)<=BigInt(a)}function G2(t,a){return BigInt(t)>=BigInt(a)}function Z2(t,a){return BigInt(t)&BigInt(a)}function j2(t,a){return BigInt(t)|BigInt(a)}function K2(t,a){return BigInt(t)^BigInt(a)}function H2(t,a){return BigInt(t)&&BigInt(a)}function V2(t,a){return BigInt(t)||BigInt(a)}function Y2(t){return!BigInt(t)}var X2=Object.freeze({__proto__:null,abs:R2,add:x2,band:Z2,bitLength:y2,bits:B2,bor:j2,bxor:K2,div:T2,e:p2,eq:U2,exp:z2,fromArray:b2,fromString:Wc,geq:G2,gt:Q2,isNegative:A2,isOdd:w2,isZero:m2,land:H2,leq:$2,lnot:Y2,lor:V2,lt:D2,mod:k2,mul:P2,naf:v2,neg:q2,neq:N2,pow:M2,shiftLeft:Jc,shiftRight:tl,shl:C2,shr:I2,square:O2,sub:S2,toArray:F2,toNumber:E2}),fe={exports:{}},nl;function Gn(){return nl||(nl=1,function(t){var a=function(n){var e=1e7,c=7,i=9007199254740992,r=w(i),_="0123456789abcdefghijklmnopqrstuvwxyz",u=typeof BigInt=="function";function l(z,$,X,at){return typeof z>"u"?l[0]:typeof $<"u"?+$==10&&!X?Lt(z):Q(z,$,X,at):Lt(z)}function s(z,$){this.value=z,this.sign=$,this.isSmall=!1}s.prototype=Object.create(l.prototype);function I(z){this.value=z,this.sign=z<0,this.isSmall=!0}I.prototype=Object.create(l.prototype);function b(z){this.value=z}b.prototype=Object.create(l.prototype);function f(z){return-9007199254740992<z&&z<i}function w(z){return z<1e7?[z]:z<1e14?[z%1e7,Math.floor(z/1e7)]:[z%1e7,Math.floor(z/1e7)%1e7,Math.floor(z/1e14)]}function O(z){D(z);var $=z.length;if($<4&&mt(z,r)<0)switch($){case 0:return 0;case 1:return z[0];case 2:return z[0]+z[1]*e;default:return z[0]+(z[1]+z[2]*e)*e}return z}function D(z){for(var $=z.length;z[--$]===0;);z.length=$+1}function G(z){for(var $=new Array(z),X=-1;++X<z;)$[X]=0;return $}function V(z){return z>0?Math.floor(z):Math.ceil(z)}function it(z,$){var X=z.length,at=$.length,gt=new Array(X),ft=0,Bt=e,pt,Ot;for(Ot=0;Ot<at;Ot++)pt=z[Ot]+$[Ot]+ft,ft=pt>=Bt?1:0,gt[Ot]=pt-ft*Bt;for(;Ot<X;)pt=z[Ot]+ft,ft=pt===Bt?1:0,gt[Ot++]=pt-ft*Bt;return ft>0&>.push(ft),gt}function Z(z,$){return z.length>=$.length?it(z,$):it($,z)}function E(z,$){var X=z.length,at=new Array(X),gt=e,ft,Bt;for(Bt=0;Bt<X;Bt++)ft=z[Bt]-gt+$,$=Math.floor(ft/gt),at[Bt]=ft-$*gt,$+=1;for(;$>0;)at[Bt++]=$%gt,$=Math.floor($/gt);return at}s.prototype.add=function(z){var $=Lt(z);if(this.sign!==$.sign)return this.subtract($.negate());var X=this.value,at=$.value;return $.isSmall?new s(E(X,Math.abs(at)),this.sign):new s(Z(X,at),this.sign)},s.prototype.plus=s.prototype.add,I.prototype.add=function(z){var $=Lt(z),X=this.value;if(X<0!==$.sign)return this.subtract($.negate());var at=$.value;if($.isSmall){if(f(X+at))return new I(X+at);at=w(Math.abs(at))}return new s(E(at,Math.abs(X)),X<0)},I.prototype.plus=I.prototype.add,b.prototype.add=function(z){return new b(this.value+Lt(z).value)},b.prototype.plus=b.prototype.add;function M(z,$){var X=z.length,at=$.length,gt=new Array(X),ft=0,Bt=e,pt,Ot;for(pt=0;pt<at;pt++)Ot=z[pt]-ft-$[pt],Ot<0?(Ot+=Bt,ft=1):ft=0,gt[pt]=Ot;for(pt=at;pt<X;pt++){if(Ot=z[pt]-ft,Ot<0)Ot+=Bt;else{gt[pt++]=Ot;break}gt[pt]=Ot}for(;pt<X;pt++)gt[pt]=z[pt];return D(gt),gt}function h(z,$,X){var at;return mt(z,$)>=0?at=M(z,$):(at=M($,z),X=!X),at=O(at),typeof at=="number"?(X&&(at=-at),new I(at)):new s(at,X)}function y(z,$,X){var at=z.length,gt=new Array(at),ft=-$,Bt=e,pt,Ot;for(pt=0;pt<at;pt++)Ot=z[pt]+ft,ft=Math.floor(Ot/Bt),Ot%=Bt,gt[pt]=Ot<0?Ot+Bt:Ot;return gt=O(gt),typeof gt=="number"?(X&&(gt=-gt),new I(gt)):new s(gt,X)}s.prototype.subtract=function(z){var $=Lt(z);if(this.sign!==$.sign)return this.add($.negate());var X=this.value,at=$.value;return $.isSmall?y(X,Math.abs(at),this.sign):h(X,at,this.sign)},s.prototype.minus=s.prototype.subtract,I.prototype.subtract=function(z){var $=Lt(z),X=this.value;if(X<0!==$.sign)return this.add($.negate());var at=$.value;return $.isSmall?new I(X-at):y(at,Math.abs(X),X>=0)},I.prototype.minus=I.prototype.subtract,b.prototype.subtract=function(z){return new b(this.value-Lt(z).value)},b.prototype.minus=b.prototype.subtract,s.prototype.negate=function(){return new s(this.value,!this.sign)},I.prototype.negate=function(){var z=this.sign,$=new I(-this.value);return $.sign=!z,$},b.prototype.negate=function(){return new b(-this.value)},s.prototype.abs=function(){return new s(this.value,!1)},I.prototype.abs=function(){return new I(Math.abs(this.value))},b.prototype.abs=function(){return new b(this.value>=0?this.value:-this.value)};function q(z,$){var X=z.length,at=$.length,gt=X+at,ft=G(gt),Bt=e,pt,Ot,Ht,on,an;for(Ht=0;Ht<X;++Ht){on=z[Ht];for(var en=0;en<at;++en)an=$[en],pt=on*an+ft[Ht+en],Ot=Math.floor(pt/Bt),ft[Ht+en]=pt-Ot*Bt,ft[Ht+en+1]+=Ot}return D(ft),ft}function g(z,$){var X=z.length,at=new Array(X),gt=e,ft=0,Bt,pt;for(pt=0;pt<X;pt++)Bt=z[pt]*$+ft,ft=Math.floor(Bt/gt),at[pt]=Bt-ft*gt;for(;ft>0;)at[pt++]=ft%gt,ft=Math.floor(ft/gt);return at}function x(z,$){for(var X=[];$-- >0;)X.push(0);return X.concat(z)}function H(z,$){var X=Math.max(z.length,$.length);if(X<=30)return q(z,$);X=Math.ceil(X/2);var at=z.slice(X),gt=z.slice(0,X),ft=$.slice(X),Bt=$.slice(0,X),pt=H(gt,Bt),Ot=H(at,ft),Ht=H(Z(gt,at),Z(Bt,ft)),on=Z(Z(pt,x(M(M(Ht,pt),Ot),X)),x(Ot,2*X));return D(on),on}function T(z,$){return-.012*z-.012*$+15e-6*z*$>0}s.prototype.multiply=function(z){var $=Lt(z),X=this.value,at=$.value,gt=this.sign!==$.sign,ft;if($.isSmall){if(at===0)return l[0];if(at===1)return this;if(at===-1)return this.negate();if(ft=Math.abs(at),ft<e)return new s(g(X,ft),gt);at=w(ft)}return T(X.length,at.length)?new s(H(X,at),gt):new s(q(X,at),gt)},s.prototype.times=s.prototype.multiply;function N(z,$,X){return z<e?new s(g($,z),X):new s(q($,w(z)),X)}I.prototype._multiplyBySmall=function(z){return f(z.value*this.value)?new I(z.value*this.value):N(Math.abs(z.value),w(Math.abs(this.value)),this.sign!==z.sign)},s.prototype._multiplyBySmall=function(z){return z.value===0?l[0]:z.value===1?this:z.value===-1?this.negate():N(Math.abs(z.value),this.value,this.sign!==z.sign)},I.prototype.multiply=function(z){return Lt(z)._multiplyBySmall(this)},I.prototype.times=I.prototype.multiply,b.prototype.multiply=function(z){return new b(this.value*Lt(z).value)},b.prototype.times=b.prototype.multiply;function P(z){var $=z.length,X=G($+$),at=e,gt,ft,Bt,pt,Ot;for(Bt=0;Bt<$;Bt++){pt=z[Bt],ft=0-pt*pt;for(var Ht=Bt;Ht<$;Ht++)Ot=z[Ht],gt=2*(pt*Ot)+X[Bt+Ht]+ft,ft=Math.floor(gt/at),X[Bt+Ht]=gt-ft*at;X[Bt+$]=ft}return D(X),X}s.prototype.square=function(){return new s(P(this.value),!1)},I.prototype.square=function(){var z=this.value*this.value;return f(z)?new I(z):new s(P(w(Math.abs(this.value))),!1)},b.prototype.square=function(z){return new b(this.value*this.value)};function v(z,$){var X=z.length,at=$.length,gt=e,ft=G($.length),Bt=$[at-1],pt=Math.ceil(gt/(2*Bt)),Ot=g(z,pt),Ht=g($,pt),on,an,en,rn,cn,fn,Ln;for(Ot.length<=X&&Ot.push(0),Ht.push(0),Bt=Ht[at-1],an=X-at;an>=0;an--){for(on=gt-1,Ot[an+at]!==Bt&&(on=Math.floor((Ot[an+at]*gt+Ot[an+at-1])/Bt)),en=0,rn=0,fn=Ht.length,cn=0;cn<fn;cn++)en+=on*Ht[cn],Ln=Math.floor(en/gt),rn+=Ot[an+cn]-(en-Ln*gt),en=Ln,rn<0?(Ot[an+cn]=rn+gt,rn=-1):(Ot[an+cn]=rn,rn=0);for(;rn!==0;){for(on-=1,en=0,cn=0;cn<fn;cn++)en+=Ot[an+cn]-gt+Ht[cn],en<0?(Ot[an+cn]=en+gt,en=0):(Ot[an+cn]=en,en=1);rn+=en}ft[an]=on}return Ot=et(Ot,pt)[0],[O(ft),O(Ot)]}function S(z,$){for(var X=z.length,at=$.length,gt=[],ft=[],Bt=e,pt,Ot,Ht,on,an;X;){if(ft.unshift(z[--X]),D(ft),mt(ft,$)<0){gt.push(0);continue}Ot=ft.length,Ht=ft[Ot-1]*Bt+ft[Ot-2],on=$[at-1]*Bt+$[at-2],Ot>at&&(Ht=(Ht+1)*Bt),pt=Math.ceil(Ht/on);do{if(an=g($,pt),mt(an,ft)<=0)break;pt--}while(pt);gt.push(pt),ft=M(ft,an)}return gt.reverse(),[O(gt),O(ft)]}function et(z,$){var X=z.length,at=G(X),gt=e,ft,Bt,pt,Ot;for(pt=0,ft=X-1;ft>=0;--ft)Ot=pt*gt+z[ft],Bt=V(Ot/$),pt=Ot-Bt*$,at[ft]=Bt|0;return[at,pt|0]}function _t(z,$){var X,at=Lt($);if(u)return[new b(z.value/at.value),new b(z.value%at.value)];var gt=z.value,ft=at.value,Bt;if(ft===0)throw new Error("Cannot divide by zero");if(z.isSmall)return at.isSmall?[new I(V(gt/ft)),new I(gt%ft)]:[l[0],z];if(at.isSmall){if(ft===1)return[z,l[0]];if(ft==-1)return[z.negate(),l[0]];var pt=Math.abs(ft);if(pt<e){X=et(gt,pt),Bt=O(X[0]);var Ot=X[1];return z.sign&&(Ot=-Ot),typeof Bt=="number"?(z.sign!==at.sign&&(Bt=-Bt),[new I(Bt),new I(Ot)]):[new s(Bt,z.sign!==at.sign),new I(Ot)]}ft=w(pt)}var Ht=mt(gt,ft);if(Ht===-1)return[l[0],z];if(Ht===0)return[l[z.sign===at.sign?1:-1],l[0]];gt.length+ft.length<=200?X=v(gt,ft):X=S(gt,ft),Bt=X[0];var on=z.sign!==at.sign,an=X[1],en=z.sign;return typeof Bt=="number"?(on&&(Bt=-Bt),Bt=new I(Bt)):Bt=new s(Bt,on),typeof an=="number"?(en&&(an=-an),an=new I(an)):an=new s(an,en),[Bt,an]}s.prototype.divmod=function(z){var $=_t(this,z);return{quotient:$[0],remainder:$[1]}},b.prototype.divmod=I.prototype.divmod=s.prototype.divmod,s.prototype.divide=function(z){return _t(this,z)[0]},b.prototype.over=b.prototype.divide=function(z){return new b(this.value/Lt(z).value)},I.prototype.over=I.prototype.divide=s.prototype.over=s.prototype.divide,s.prototype.mod=function(z){return _t(this,z)[1]},b.prototype.mod=b.prototype.remainder=function(z){return new b(this.value%Lt(z).value)},I.prototype.remainder=I.prototype.mod=s.prototype.remainder=s.prototype.mod,s.prototype.pow=function(z){var $=Lt(z),X=this.value,at=$.value,gt,ft,Bt;if(at===0)return l[1];if(X===0)return l[0];if(X===1)return l[1];if(X===-1)return $.isEven()?l[1]:l[-1];if($.sign)return l[0];if(!$.isSmall)throw new Error("The exponent "+$.toString()+" is too large.");if(this.isSmall&&f(gt=Math.pow(X,at)))return new I(V(gt));for(ft=this,Bt=l[1];at&!0&&(Bt=Bt.times(ft),--at),at!==0;)at/=2,ft=ft.square();return Bt},I.prototype.pow=s.prototype.pow,b.prototype.pow=function(z){var $=Lt(z),X=this.value,at=$.value,gt=BigInt(0),ft=BigInt(1),Bt=BigInt(2);if(at===gt)return l[1];if(X===gt)return l[0];if(X===ft)return l[1];if(X===BigInt(-1))return $.isEven()?l[1]:l[-1];if($.isNegative())return new b(gt);for(var pt=this,Ot=l[1];(at&ft)===ft&&(Ot=Ot.times(pt),--at),at!==gt;)at/=Bt,pt=pt.square();return Ot},s.prototype.modPow=function(z,$){if(z=Lt(z),$=Lt($),$.isZero())throw new Error("Cannot take modPow with modulus 0");var X=l[1],at=this.mod($);for(z.isNegative()&&(z=z.multiply(l[-1]),at=at.modInv($));z.isPositive();){if(at.isZero())return l[0];z.isOdd()&&(X=X.multiply(at).mod($)),z=z.divide(2),at=at.square().mod($)}return X},b.prototype.modPow=I.prototype.modPow=s.prototype.modPow;function mt(z,$){if(z.length!==$.length)return z.length>$.length?1:-1;for(var X=z.length-1;X>=0;X--)if(z[X]!==$[X])return z[X]>$[X]?1:-1;return 0}s.prototype.compareAbs=function(z){var $=Lt(z),X=this.value,at=$.value;return $.isSmall?1:mt(X,at)},I.prototype.compareAbs=function(z){var $=Lt(z),X=Math.abs(this.value),at=$.value;return $.isSmall?(at=Math.abs(at),X===at?0:X>at?1:-1):-1},b.prototype.compareAbs=function(z){var $=this.value,X=Lt(z).value;return $=$>=0?$:-$,X=X>=0?X:-X,$===X?0:$>X?1:-1},s.prototype.compare=function(z){if(z===1/0)return-1;if(z===-1/0)return 1;var $=Lt(z),X=this.value,at=$.value;return this.sign!==$.sign?$.sign?1:-1:$.isSmall?this.sign?-1:1:mt(X,at)*(this.sign?-1:1)},s.prototype.compareTo=s.prototype.compare,I.prototype.compare=function(z){if(z===1/0)return-1;if(z===-1/0)return 1;var $=Lt(z),X=this.value,at=$.value;return $.isSmall?X==at?0:X>at?1:-1:X<0!==$.sign?X<0?-1:1:X<0?1:-1},I.prototype.compareTo=I.prototype.compare,b.prototype.compare=function(z){if(z===1/0)return-1;if(z===-1/0)return 1;var $=this.value,X=Lt(z).value;return $===X?0:$>X?1:-1},b.prototype.compareTo=b.prototype.compare,s.prototype.equals=function(z){return this.compare(z)===0},b.prototype.eq=b.prototype.equals=I.prototype.eq=I.prototype.equals=s.prototype.eq=s.prototype.equals,s.prototype.notEquals=function(z){return this.compare(z)!==0},b.prototype.neq=b.prototype.notEquals=I.prototype.neq=I.prototype.notEquals=s.prototype.neq=s.prototype.notEquals,s.prototype.greater=function(z){return this.compare(z)>0},b.prototype.gt=b.prototype.greater=I.prototype.gt=I.prototype.greater=s.prototype.gt=s.prototype.greater,s.prototype.lesser=function(z){return this.compare(z)<0},b.prototype.lt=b.prototype.lesser=I.prototype.lt=I.prototype.lesser=s.prototype.lt=s.prototype.lesser,s.prototype.greaterOrEquals=function(z){return this.compare(z)>=0},b.prototype.geq=b.prototype.greaterOrEquals=I.prototype.geq=I.prototype.greaterOrEquals=s.prototype.geq=s.prototype.greaterOrEquals,s.prototype.lesserOrEquals=function(z){return this.compare(z)<=0},b.prototype.leq=b.prototype.lesserOrEquals=I.prototype.leq=I.prototype.lesserOrEquals=s.prototype.leq=s.prototype.lesserOrEquals,s.prototype.isEven=function(){return(this.value[0]&1)===0},I.prototype.isEven=function(){return(this.value&1)===0},b.prototype.isEven=function(){return(this.value&BigInt(1))===BigInt(0)},s.prototype.isOdd=function(){return(this.value[0]&1)===1},I.prototype.isOdd=function(){return(this.value&1)===1},b.prototype.isOdd=function(){return(this.value&BigInt(1))===BigInt(1)},s.prototype.isPositive=function(){return!this.sign},I.prototype.isPositive=function(){return this.value>0},b.prototype.isPositive=I.prototype.isPositive,s.prototype.isNegative=function(){return this.sign},I.prototype.isNegative=function(){return this.value<0},b.prototype.isNegative=I.prototype.isNegative,s.prototype.isUnit=function(){return!1},I.prototype.isUnit=function(){return Math.abs(this.value)===1},b.prototype.isUnit=function(){return this.abs().value===BigInt(1)},s.prototype.isZero=function(){return!1},I.prototype.isZero=function(){return this.value===0},b.prototype.isZero=function(){return this.value===BigInt(0)},s.prototype.isDivisibleBy=function(z){var $=Lt(z);return $.isZero()?!1:$.isUnit()?!0:$.compareAbs(2)===0?this.isEven():this.mod($).isZero()},b.prototype.isDivisibleBy=I.prototype.isDivisibleBy=s.prototype.isDivisibleBy;function xt(z){var $=z.abs();if($.isUnit())return!1;if($.equals(2)||$.equals(3)||$.equals(5))return!0;if($.isEven()||$.isDivisibleBy(3)||$.isDivisibleBy(5))return!1;if($.lesser(49))return!0}function Pt(z,$){for(var X=z.prev(),at=X,gt=0,ft,Bt,pt;at.isEven();)at=at.divide(2),gt++;t:for(Bt=0;Bt<$.length;Bt++)if(!z.lesser($[Bt])&&(pt=a($[Bt]).modPow(at,z),!(pt.isUnit()||pt.equals(X)))){for(ft=gt-1;ft!=0;ft--){if(pt=pt.square().mod(z),pt.isUnit())return!1;if(pt.equals(X))continue t}return!1}return!0}s.prototype.isPrime=function(z){var $=xt(this);if($!==n)return $;var X=this.abs(),at=X.bitLength();if(at<=64)return Pt(X,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var gt=Math.log(2)*at.toJSNumber(),ft=Math.ceil(z===!0?2*Math.pow(gt,2):gt),Bt=[],pt=0;pt<ft;pt++)Bt.push(a(pt+2));return Pt(X,Bt)},b.prototype.isPrime=I.prototype.isPrime=s.prototype.isPrime,s.prototype.isProbablePrime=function(z,$){var X=xt(this);if(X!==n)return X;for(var at=this.abs(),gt=z===n?5:z,ft=[],Bt=0;Bt<gt;Bt++)ft.push(a.randBetween(2,at.minus(2),$));return Pt(at,ft)},b.prototype.isProbablePrime=I.prototype.isProbablePrime=s.prototype.isProbablePrime,s.prototype.modInv=function(z){for(var $=a.zero,X=a.one,at=Lt(z),gt=this.abs(),ft,Bt,pt;!gt.isZero();)ft=at.divide(gt),Bt=$,pt=at,$=X,at=gt,X=Bt.subtract(ft.multiply(X)),gt=pt.subtract(ft.multiply(gt));if(!at.isUnit())throw new Error(this.toString()+" and "+z.toString()+" are not co-prime");return $.compare(0)===-1&&($=$.add(z)),this.isNegative()?$.negate():$},b.prototype.modInv=I.prototype.modInv=s.prototype.modInv,s.prototype.next=function(){var z=this.value;return this.sign?y(z,1,this.sign):new s(E(z,1),this.sign)},I.prototype.next=function(){var z=this.value;return z+1<i?new I(z+1):new s(r,!1)},b.prototype.next=function(){return new b(this.value+BigInt(1))},s.prototype.prev=function(){var z=this.value;return this.sign?new s(E(z,1),!0):y(z,1,this.sign)},I.prototype.prev=function(){var z=this.value;return z-1>-9007199254740992?new I(z-1):new s(r,!0)},b.prototype.prev=function(){return new b(this.value-BigInt(1))};for(var zt=[1];2*zt[zt.length-1]<=e;)zt.push(2*zt[zt.length-1]);var Rt=zt.length,k=zt[Rt-1];function Ct(z){return Math.abs(z)<=e}s.prototype.shiftLeft=function(z){var $=Lt(z).toJSNumber();if(!Ct($))throw new Error(String($)+" is too large for shifting.");if($<0)return this.shiftRight(-$);var X=this;if(X.isZero())return X;for(;$>=Rt;)X=X.multiply(k),$-=Rt-1;return X.multiply(zt[$])},b.prototype.shiftLeft=I.prototype.shiftLeft=s.prototype.shiftLeft,s.prototype.shiftRight=function(z){var $,X=Lt(z).toJSNumber();if(!Ct(X))throw new Error(String(X)+" is too large for shifting.");if(X<0)return this.shiftLeft(-X);for(var at=this;X>=Rt;){if(at.isZero()||at.isNegative()&&at.isUnit())return at;$=_t(at,k),at=$[1].isNegative()?$[0].prev():$[0],X-=Rt-1}return $=_t(at,zt[X]),$[1].isNegative()?$[0].prev():$[0]},b.prototype.shiftRight=I.prototype.shiftRight=s.prototype.shiftRight;function St(z,$,X){$=Lt($);for(var at=z.isNegative(),gt=$.isNegative(),ft=at?z.not():z,Bt=gt?$.not():$,pt=0,Ot=0,Ht=null,on=null,an=[];!ft.isZero()||!Bt.isZero();)Ht=_t(ft,k),pt=Ht[1].toJSNumber(),at&&(pt=k-1-pt),on=_t(Bt,k),Ot=on[1].toJSNumber(),gt&&(Ot=k-1-Ot),ft=Ht[0],Bt=on[0],an.push(X(pt,Ot));for(var en=X(at?1:0,gt?1:0)!==0?a(-1):a(0),rn=an.length-1;rn>=0;rn-=1)en=en.multiply(k).add(a(an[rn]));return en}s.prototype.not=function(){return this.negate().prev()},b.prototype.not=I.prototype.not=s.prototype.not,s.prototype.and=function(z){return St(this,z,function($,X){return $&X})},b.prototype.and=I.prototype.and=s.prototype.and,s.prototype.or=function(z){return St(this,z,function($,X){return $|X})},b.prototype.or=I.prototype.or=s.prototype.or,s.prototype.xor=function(z){return St(this,z,function($,X){return $^X})},b.prototype.xor=I.prototype.xor=s.prototype.xor;var F=1<<30,o=(e&-1e7)*(e&-1e7)|F;function L(z){var $=z.value,X=typeof $=="number"?$|F:typeof $=="bigint"?$|BigInt(F):$[0]+$[1]*e|o;return X&-X}function U(z,$){if($.compareTo(z)<=0){var X=U(z,$.square($)),at=X.p,gt=X.e,ft=at.multiply($);return ft.compareTo(z)<=0?{p:ft,e:gt*2+1}:{p:at,e:gt*2}}return{p:a(1),e:0}}s.prototype.bitLength=function(){var z=this;return z.compareTo(a(0))<0&&(z=z.negate().subtract(a(1))),z.compareTo(a(0))===0?a(0):a(U(z,a(2)).e).add(a(1))},b.prototype.bitLength=I.prototype.bitLength=s.prototype.bitLength;function p(z,$){return z=Lt(z),$=Lt($),z.greater($)?z:$}function st(z,$){return z=Lt(z),$=Lt($),z.lesser($)?z:$}function qt(z,$){if(z=Lt(z).abs(),$=Lt($).abs(),z.equals($))return z;if(z.isZero())return $;if($.isZero())return z;for(var X=l[1],at,gt;z.isEven()&&$.isEven();)at=st(L(z),L($)),z=z.divide(at),$=$.divide(at),X=X.multiply(at);for(;z.isEven();)z=z.divide(L(z));do{for(;$.isEven();)$=$.divide(L($));z.greater($)&&(gt=$,$=z,z=gt),$=$.subtract(z)}while(!$.isZero());return X.isUnit()?z:z.multiply(X)}function wt(z,$){return z=Lt(z).abs(),$=Lt($).abs(),z.divide(qt(z,$)).multiply($)}function nt(z,$,X){z=Lt(z),$=Lt($);var at=X||Math.random,gt=st(z,$),ft=p(z,$),Bt=ft.subtract(gt).add(1);if(Bt.isSmall)return gt.add(Math.floor(at()*Bt));for(var pt=Ft(Bt,e).value,Ot=[],Ht=!0,on=0;on<pt.length;on++){var an=Ht?pt[on]+(on+1<pt.length?pt[on+1]/e:0):e,en=V(at()*an);Ot.push(en),en<pt[on]&&(Ht=!1)}return gt.add(l.fromArray(Ot,e,!1))}var Q=function(z,$,X,at){X=X||_,z=String(z),at||(z=z.toLowerCase(),X=X.toLowerCase());var gt=z.length,ft,Bt=Math.abs($),pt={};for(ft=0;ft<X.length;ft++)pt[X[ft]]=ft;for(ft=0;ft<gt;ft++){var Ot=z[ft];if(Ot!=="-"&&Ot in pt&&pt[Ot]>=Bt){if(Ot==="1"&&Bt===1)continue;throw new Error(Ot+" is not a valid digit in base "+$+".")}}$=Lt($);var Ht=[],on=z[0]==="-";for(ft=on?1:0;ft<z.length;ft++){var Ot=z[ft];if(Ot in pt)Ht.push(Lt(pt[Ot]));else if(Ot==="<"){var an=ft;do ft++;while(z[ft]!==">"&&ft<z.length);Ht.push(Lt(z.slice(an+1,ft)))}else throw new Error(Ot+" is not a valid character")}return A(Ht,$,on)};function A(z,$,X){var at=l[0],gt=l[1],ft;for(ft=z.length-1;ft>=0;ft--)at=at.add(z[ft].times(gt)),gt=gt.times($);return X?at.negate():at}function lt(z,$){return $=$||_,z<$.length?$[z]:"<"+z+">"}function Ft(z,$){if($=a($),$.isZero()){if(z.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if($.equals(-1)){if(z.isZero())return{value:[0],isNegative:!1};if(z.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-z.toJSNumber())).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var X=Array.apply(null,Array(z.toJSNumber()-1)).map(Array.prototype.valueOf,[0,1]);return X.unshift([1]),{value:[].concat.apply([],X),isNegative:!1}}var at=!1;if(z.isNegative()&&$.isPositive()&&(at=!0,z=z.abs()),$.isUnit())return z.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(z.toJSNumber())).map(Number.prototype.valueOf,1),isNegative:at};for(var gt=[],ft=z,Bt;ft.isNegative()||ft.compareAbs($)>=0;){Bt=ft.divmod($),ft=Bt.quotient;var pt=Bt.remainder;pt.isNegative()&&(pt=$.minus(pt).abs(),ft=ft.next()),gt.push(pt.toJSNumber())}return gt.push(ft.toJSNumber()),{value:gt.reverse(),isNegative:at}}function Ut(z,$,X){var at=Ft(z,$);return(at.isNegative?"-":"")+at.value.map(function(gt){return lt(gt,X)}).join("")}s.prototype.toArray=function(z){return Ft(this,z)},I.prototype.toArray=function(z){return Ft(this,z)},b.prototype.toArray=function(z){return Ft(this,z)},s.prototype.toString=function(z,$){if(z===n&&(z=10),z!==10||$)return Ut(this,z,$);for(var X=this.value,at=X.length,gt=String(X[--at]),ft="0000000",Bt;--at>=0;)Bt=String(X[at]),gt+=ft.slice(Bt.length)+Bt;var pt=this.sign?"-":"";return pt+gt},I.prototype.toString=function(z,$){return z===n&&(z=10),z!=10||$?Ut(this,z,$):String(this.value)},b.prototype.toString=I.prototype.toString,b.prototype.toJSON=s.prototype.toJSON=I.prototype.toJSON=function(){return this.toString()},s.prototype.valueOf=function(){return parseInt(this.toString(),10)},s.prototype.toJSNumber=s.prototype.valueOf,I.prototype.valueOf=function(){return this.value},I.prototype.toJSNumber=I.prototype.valueOf,b.prototype.valueOf=b.prototype.toJSNumber=function(){return parseInt(this.toString(),10)};function dt(z){if(f(+z)){var $=+z;if($===V($))return u?new b(BigInt($)):new I($);throw new Error("Invalid integer: "+z)}var X=z[0]==="-";X&&(z=z.slice(1));var at=z.split(/e/i);if(at.length>2)throw new Error("Invalid integer: "+at.join("e"));if(at.length===2){var gt=at[1];if(gt[0]==="+"&&(gt=gt.slice(1)),gt=+gt,gt!==V(gt)||!f(gt))throw new Error("Invalid integer: "+gt+" is not a valid exponent.");var ft=at[0],Bt=ft.indexOf(".");if(Bt>=0&&(gt-=ft.length-Bt-1,ft=ft.slice(0,Bt)+ft.slice(Bt+1)),gt<0)throw new Error("Cannot include negative exponent part for integers");ft+=new Array(gt+1).join("0"),z=ft}var pt=/^([0-9][0-9]*)$/.test(z);if(!pt)throw new Error("Invalid integer: "+z);if(u)return new b(BigInt(X?"-"+z:z));for(var Ot=[],Ht=z.length,on=c,an=Ht-on;Ht>0;)Ot.push(+z.slice(an,Ht)),an-=on,an<0&&(an=0),Ht-=on;return D(Ot),new s(Ot,X)}function B(z){if(u)return new b(BigInt(z));if(f(z)){if(z!==V(z))throw new Error(z+" is not an integer.");return new I(z)}return dt(z.toString())}function Lt(z){return typeof z=="number"?B(z):typeof z=="string"?dt(z):typeof z=="bigint"?new b(z):z}for(var Gt=0;Gt<1e3;Gt++)l[Gt]=Lt(Gt),Gt>0&&(l[-Gt]=Lt(-Gt));return l.one=l[1],l.zero=l[0],l.minusOne=l[-1],l.max=p,l.min=st,l.gcd=qt,l.lcm=wt,l.isInstance=function(z){return z instanceof s||z instanceof I||z instanceof b},l.randBetween=nt,l.fromArray=function(z,$,X){return A(z.map(Lt),Lt($||10),X)},l}();t.hasOwnProperty("exports")&&(t.exports=a)}(fe)),fe.exports}var W2=Gn(),Kt=Uo(W2);function al(t,a){return typeof t=="string"&&t.slice(0,2)=="0x"?Kt(t.slice(2),16):Kt(t,a)}const J2=al;function t_(t,a){return Kt.fromArray(t,a)}function n_(t){return Kt(t).bitLength()}function a_(t){return Kt(t).isNegative()}function o_(t){return Kt(t).isZero()}function ol(t,a){return Kt(t).shiftLeft(a)}function el(t,a){return Kt(t).shiftRight(a)}const e_=ol,i_=el;function c_(t){return Kt(t).isOdd()}function l_(t){let a=Kt(t);const n=[];for(;a.gt(Kt.zero);){if(a.isOdd()){const e=2-a.mod(4).toJSNumber();n.push(e),a=a.minus(e)}else n.push(0);a=a.shiftRight(1)}return n}function s_(t){let a=Kt(t);const n=[];for(;a.gt(Kt.zero);)a.isOdd()?n.push(1):n.push(0),a=a.shiftRight(1);return n}function r_(t){if(!t.lt(Kt("9007199254740992",10)))throw new Error("Number too big");return t.toJSNumber()}function d_(t,a){return Kt(t).toArray(a)}function __(t,a){return Kt(t).add(Kt(a))}function u_(t,a){return Kt(t).minus(Kt(a))}function g_(t){return Kt.zero.minus(Kt(t))}function f_(t,a){return Kt(t).times(Kt(a))}function h_(t){return Kt(t).square()}function L_(t,a){return Kt(t).pow(Kt(a))}function p_(t,a){return Kt(t).pow(Kt(a))}function b_(t){return Kt(t).abs()}function y_(t,a){return Kt(t).divide(Kt(a))}function A_(t,a){return Kt(t).mod(Kt(a))}function m_(t,a){return Kt(t).eq(Kt(a))}function C_(t,a){return Kt(t).neq(Kt(a))}function I_(t,a){return Kt(t).lt(Kt(a))}function w_(t,a){return Kt(t).gt(Kt(a))}function v_(t,a){return Kt(t).leq(Kt(a))}function B_(t,a){return Kt(t).geq(Kt(a))}function E_(t,a){return Kt(t).and(Kt(a))}function F_(t,a){return Kt(t).or(Kt(a))}function x_(t,a){return Kt(t).xor(Kt(a))}function S_(t,a){return!Kt(t).isZero()&&!Kt(a).isZero()}function q_(t,a){return!Kt(t).isZero()||!Kt(a).isZero()}function P_(t){return Kt(t).isZero()}var O_=Object.freeze({__proto__:null,abs:b_,add:__,band:E_,bitLength:n_,bits:s_,bor:F_,bxor:x_,div:y_,e:J2,eq:m_,exp:p_,fromArray:t_,fromString:al,geq:B_,gt:w_,isNegative:a_,isOdd:c_,isZero:o_,land:S_,leq:v_,lnot:P_,lor:q_,lt:I_,mod:A_,mul:f_,naf:l_,neg:g_,neq:C_,pow:L_,shiftLeft:ol,shiftRight:el,shl:e_,shr:i_,square:h_,sub:u_,toArray:d_,toNumber:r_});const M_=typeof BigInt=="function";let yn={};M_?Object.assign(yn,X2):Object.assign(yn,O_),yn.toRprLE=function(a,n,e,c){const i="0000000"+e.toString(16),r=new Uint32Array(a.buffer,n,c/4),_=((i.length-7)*4-1>>5)+1;for(let u=0;u<_;u++)r[u]=parseInt(i.substring(i.length-8*u-8,i.length-8*u),16);for(let u=_;u<r.length;u++)r[u]=0;for(let u=r.length*4;u<c;u++)a[u]=yn.toNumber(yn.band(yn.shiftRight(e,u*8),255))},yn.toRprBE=function(a,n,e,c){const i="0000000"+e.toString(16),r=new DataView(a.buffer,a.byteOffset+n,c),_=((i.length-7)*4-1>>5)+1;for(let u=0;u<_;u++)r.setUint32(c-u*4-4,parseInt(i.substring(i.length-8*u-8,i.length-8*u),16),!1);for(let u=0;u<c/4-_;u++)r[u]=0},yn.fromRprLE=function(a,n,e){e=e||a.byteLength,n=n||0;const c=new Uint32Array(a.buffer,n,e/4),i=new Array(e/4);return c.forEach((r,_)=>i[i.length-_-1]=r.toString(16).padStart(8,"0")),yn.fromString(i.join(""),16)},yn.fromRprBE=function(a,n,e){e=e||a.byteLength,n=n||0;const c=new DataView(a.buffer,a.byteOffset+n,e),i=new Array(e/4);for(let r=0;r<e/4;r++)i[r]=c.getUint32(r*4,!1).toString(16).padStart(8,"0");return yn.fromString(i.join(""),16)},yn.toString=function(a,n){return a.toString(n)},yn.toLEBuff=function(a){const n=new Uint8Array(Math.floor((yn.bitLength(a)-1)/8)+1);return yn.toRprLE(n,0,a,n.byteLength),n},yn.zero=yn.e(0),yn.one=yn.e(1);let{toRprLE:yo,toRprBE:il,fromRprLE:Ga,fromRprBE:cl,toString:ll,toLEBuff:va,zero:sl,one:fa,fromString:z_,e:mn,fromArray:R_,bitLength:Ao,isNegative:rl,isZero:dl,shiftLeft:he,shiftRight:mo,shl:T_,shr:k_,isOdd:Le,naf:U_,bits:_l,toNumber:N_,toArray:D_,add:pe,sub:Wn,neg:ul,mul:gl,square:Q_,pow:Za,exp:$_,abs:G_,div:Ba,mod:Zn,eq:ha,neq:Z_,lt:j_,gt:be,leq:K_,geq:fl,band:hl,bor:H_,bxor:V_,land:Y_,lor:X_,lnot:W_}=yn;var J_=Object.freeze({__proto__:null,abs:G_,add:pe,band:hl,bitLength:Ao,bits:_l,bor:H_,bxor:V_,div:Ba,e:mn,eq:ha,exp:$_,fromArray:R_,fromRprBE:cl,fromRprLE:Ga,fromString:z_,geq:fl,gt:be,isNegative:rl,isOdd:Le,isZero:dl,land:Y_,leq:K_,lnot:W_,lor:X_,lt:j_,mod:Zn,mul:gl,naf:U_,neg:ul,neq:Z_,one:fa,pow:Za,shiftLeft:he,shiftRight:mo,shl:T_,shr:k_,square:Q_,sub:Wn,toArray:D_,toLEBuff:va,toNumber:N_,toRprBE:il,toRprLE:yo,toString:ll,zero:sl});function Ll(t,a,n){if(dl(n))return t.one;const e=_l(n);if(e.legth==0)return t.one;let c=a;for(let i=e.length-2;i>=0;i--)c=t.square(c),e[i]&&(c=t.mul(c,a));return c}function pl(t){if(t.m%2==1)if(ha(Zn(t.p,4),1))if(ha(Zn(t.p,8),1))if(ha(Zn(t.p,16),1))tu(t);else if(ha(Zn(t.p,16),9))nu(t);else throw new Error("Field withot sqrt");else if(ha(Zn(t.p,8),5))au(t);else throw new Error("Field withot sqrt");else ha(Zn(t.p,4),3)&&ou(t);else{const a=Zn(Za(t.p,t.m/2),4);a==1?eu(t):a==3?iu(t):cu(t)}}function tu(t){for(t.sqrt_q=Za(t.p,t.m),t.sqrt_s=0,t.sqrt_t=Wn(t.sqrt_q,1);!Le(t.sqrt_t);)t.sqrt_s=t.sqrt_s+1,t.sqrt_t=Ba(t.sqrt_t,2);let a=t.one;for(;t.eq(a,t.one);){const n=t.random();t.sqrt_z=t.pow(n,t.sqrt_t),a=t.pow(t.sqrt_z,2**(t.sqrt_s-1))}t.sqrt_tm1d2=Ba(Wn(t.sqrt_t,1),2),t.sqrt=function(n){const e=this;if(e.isZero(n))return e.zero;let c=e.pow(n,e.sqrt_tm1d2);const i=e.pow(e.mul(e.square(c),n),2**(e.sqrt_s-1));if(e.eq(i,e.negone))return null;let r=e.sqrt_s,_=e.mul(n,c),u=e.mul(_,c),l=e.sqrt_z;for(;!e.eq(u,e.one);){let s=e.square(u),I=1;for(;!e.eq(s,e.one);)s=e.square(s),I++;c=l;for(let b=0;b<r-I-1;b++)c=e.square(c);l=e.square(c),u=e.mul(u,l),_=e.mul(_,c),r=I}return e.geq(_,e.zero)?_:e.neg(_)}}function nu(t){t.sqrt=function(){throw new Error("Sqrt alg 4 not implemented")}}function au(t){t.sqrt=function(){throw new Error("Sqrt alg 3 not implemented")}}function ou(t){t.sqrt_q=Za(t.p,t.m),t.sqrt_e1=Ba(Wn(t.sqrt_q,3),4),t.sqrt=function(a){if(this.isZero(a))return this.zero;const n=this.pow(a,this.sqrt_e1),e=this.mul(this.square(n),a);if(this.eq(e,this.negone))return null;const c=this.mul(n,a);return t.geq(c,t.zero)?c:t.neg(c)}}function eu(t){t.sqrt=function(){throw new Error("Sqrt alg 10 not implemented")}}function iu(t){t.sqrt_q=Za(t.p,t.m/2),t.sqrt_e34=Ba(Wn(t.sqrt_q,3),4),t.sqrt_e12=Ba(Wn(t.sqrt_q,1),2),t.frobenius=function(a,n){return a%2==1?t.conjugate(n):n},t.sqrt=function(a){const n=this,e=n.pow(a,n.sqrt_e34),c=n.mul(n.square(e),a),i=n.mul(n.frobenius(1,c),c);if(n.eq(i,n.negone))return null;const r=n.mul(e,a);let _;if(n.eq(c,n.negone))_=n.mul(r,[n.F.zero,n.F.one]);else{const u=n.pow(n.add(n.one,c),n.sqrt_e12);_=n.mul(u,r)}return n.geq(_,n.zero)?_:n.neg(_)}}function cu(t){t.sqrt=function(){throw new Error("Sqrt alg 8 not implemented")}}function ia(t,a,n,e,c){t[a]=t[a]+t[n]>>>0,t[c]=(t[c]^t[a])>>>0,t[c]=(t[c]<<16|t[c]>>>16&65535)>>>0,t[e]=t[e]+t[c]>>>0,t[n]=(t[n]^t[e])>>>0,t[n]=(t[n]<<12|t[n]>>>20&4095)>>>0,t[a]=t[a]+t[n]>>>0,t[c]=(t[c]^t[a])>>>0,t[c]=(t[c]<<8|t[c]>>>24&255)>>>0,t[e]=t[e]+t[c]>>>0,t[n]=(t[n]^t[e])>>>0,t[n]=(t[n]<<7|t[n]>>>25&127)>>>0}function lu(t){ia(t,0,4,8,12),ia(t,1,5,9,13),ia(t,2,6,10,14),ia(t,3,7,11,15),ia(t,0,5,10,15),ia(t,1,6,11,12),ia(t,2,7,8,13),ia(t,3,4,9,14)}class su{constructor(a){a=a||[0,0,0,0,0,0,0,0],this.state=[1634760805,857760878,2036477234,1797285236,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],0,0,0,0],this.idx=16,this.buff=new Array(16)}nextU32(){return this.idx==16&&this.update(),this.buff[this.idx++]}nextU64(){return pe(gl(this.nextU32(),4294967296),this.nextU32())}nextBool(){return(this.nextU32()&1)==1}update(){for(let a=0;a<16;a++)this.buff[a]=this.state[a];for(let a=0;a<10;a++)lu(this.buff);for(let a=0;a<16;a++)this.buff[a]=this.buff[a]+this.state[a]>>>0;this.idx=0,this.state[12]=this.state[12]+1>>>0,this.state[12]==0&&(this.state[13]=this.state[13]+1>>>0,this.state[13]==0&&(this.state[14]=this.state[14]+1>>>0,this.state[14]==0&&(this.state[15]=this.state[15]+1>>>0)))}}function ye(t){let a=new Uint8Array(t);if(process.browser)if(typeof globalThis.crypto<"u")globalThis.crypto.getRandomValues(a);else for(let n=0;n<t;n++)a[n]=Math.random()*4294967296>>>0;else Ua.randomFillSync(a);return a}function ru(){const t=ye(32),a=new Uint32Array(t.buffer),n=[];for(let e=0;e<8;e++)n.push(a[e]);return n}let Co=null;function Ae(){return Co||(Co=new su(ru()),Co)}let du=class{constructor(a){this.type="F1",this.one=BigInt(1),this.zero=BigInt(0),this.p=BigInt(a),this.m=1,this.negone=this.p-this.one,this.two=BigInt(2),this.half=this.p>>this.one,this.bitLength=Ao(this.p),this.mask=(this.one<<BigInt(this.bitLength))-this.one,this.n64=Math.floor((this.bitLength-1)/64)+1,this.n32=this.n64*2,this.n8=this.n64*8,this.R=this.e(this.one<<BigInt(this.n64*64)),this.Ri=this.inv(this.R);const n=this.negone>>this.one;this.nqr=this.two;let e=this.pow(this.nqr,n);for(;!this.eq(e,this.negone);)this.nqr=this.nqr+this.one,e=this.pow(this.nqr,n);for(this.s=0,this.t=this.negone;(this.t&this.one)==this.zero;)this.s=this.s+1,this.t=this.t>>this.one;this.nqr_to_t=this.pow(this.nqr,this.t),pl(this)}e(a,n){let e;if(n?n==16&&(e=BigInt("0x"+a)):e=BigInt(a),e<0){let c=-e;return c>=this.p&&(c=c%this.p),this.p-c}else return e>=this.p?e%this.p:e}add(a,n){const e=a+n;return e>=this.p?e-this.p:e}sub(a,n){return a>=n?a-n:this.p-n+a}neg(a){return a&&this.p-a}mul(a,n){return a*n%this.p}mulScalar(a,n){return a*this.e(n)%this.p}square(a){return a*a%this.p}eq(a,n){return a==n}neq(a,n){return a!=n}lt(a,n){const e=a>this.half?a-this.p:a,c=n>this.half?n-this.p:n;return e<c}gt(a,n){const e=a>this.half?a-this.p:a,c=n>this.half?n-this.p:n;return e>c}leq(a,n){const e=a>this.half?a-this.p:a,c=n>this.half?n-this.p:n;return e<=c}geq(a,n){const e=a>this.half?a-this.p:a,c=n>this.half?n-this.p:n;return e>=c}div(a,n){return this.mul(a,this.inv(n))}idiv(a,n){if(!n)throw new Error("Division by zero");return a/n}inv(a){if(!a)throw new Error("Division by zero");let n=this.zero,e=this.p,c=this.one,i=a%this.p;for(;i;){let r=e/i;[n,c]=[c,n-r*c],[e,i]=[i,e-r*i]}return n<this.zero&&(n+=this.p),n}mod(a,n){return a%n}pow(a,n){return Ll(this,a,n)}exp(a,n){return Ll(this,a,n)}band(a,n){const e=a&n&this.mask;return e>=this.p?e-this.p:e}bor(a,n){const e=(a|n)&this.mask;return e>=this.p?e-this.p:e}bxor(a,n){const e=(a^n)&this.mask;return e>=this.p?e-this.p:e}bnot(a){const n=a^this.mask;return n>=this.p?n-this.p:n}shl(a,n){if(Number(n)<this.bitLength){const e=a<<n&this.mask;return e>=this.p?e-this.p:e}else{const e=this.p-n;return Number(e)<this.bitLength?a>>e:this.zero}}shr(a,n){if(Number(n)<this.bitLength)return a>>n;{const e=this.p-n;if(Number(e)<this.bitLength){const c=a<<e&this.mask;return c>=this.p?c-this.p:c}else return 0}}land(a,n){return a&&n?this.one:this.zero}lor(a,n){return a||n?this.one:this.zero}lnot(a){return a?this.zero:this.one}sqrt_old(a){if(a==this.zero)return this.zero;if(this.pow(a,this.negone>>this.one)!=this.one)return null;let e=this.s,c=this.nqr_to_t,i=this.pow(a,this.t),r=this.pow(a,this.add(this.t,this.one)>>this.one);for(;i!=this.one;){let _=this.square(i),u=1;for(;_!=this.one;)u++,_=this.square(_);let l=c;for(let s=0;s<e-u-1;s++)l=this.square(l);e=u,c=this.square(l),i=this.mul(i,c),r=this.mul(r,l)}return r>this.p>>this.one&&(r=this.neg(r)),r}normalize(a,n){if(a=BigInt(a,n),a<0){let e=-a;return e>=this.p&&(e=e%this.p),this.p-e}else return a>=this.p?a%this.p:a}random(){const a=this.bitLength*2/8;let n=this.zero;for(let e=0;e<a;e++)n=(n<<BigInt(8))+BigInt(ye(1)[0]);return n%this.p}toString(a,n){let e;return a>this.half?e="-"+(this.p-a).toString(n):e=a.toString(n),e}isZero(a){return a==this.zero}fromRng(a){let n;do{n=this.zero;for(let e=0;e<this.n64;e++)n+=a.nextU64()<<BigInt(64*e);n&=this.mask}while(n>=this.p);return n=n*this.Ri%this.p,n}};class _u{constructor(a){this.type="F1",this.one=Kt.one,this.zero=Kt.zero,this.p=Kt(a),this.m=1,this.negone=this.p.minus(Kt.one),this.two=Kt(2),this.half=this.p.shiftRight(1),this.bitLength=this.p.bitLength(),this.mask=Kt.one.shiftLeft(this.bitLength).minus(Kt.one),this.n64=Math.floor((this.bitLength-1)/64)+1,this.n32=this.n64*2,this.n8=this.n64*8,this.R=Kt.one.shiftLeft(this.n64*64),this.Ri=this.inv(this.R);const n=this.negone.shiftRight(this.one);this.nqr=this.two;let e=this.pow(this.nqr,n);for(;!e.equals(this.negone);)this.nqr=this.nqr.add(this.one),e=this.pow(this.nqr,n);for(this.s=this.zero,this.t=this.negone;!this.t.isOdd();)this.s=this.s.add(this.one),this.t=this.t.shiftRight(this.one);this.nqr_to_t=this.pow(this.nqr,this.t),pl(this)}e(a,n){const e=Kt(a,n);return this.normalize(e)}add(a,n){let e=a.add(n);return e.geq(this.p)&&(e=e.minus(this.p)),e}sub(a,n){return a.geq(n)?a.minus(n):this.p.minus(n.minus(a))}neg(a){return a.isZero()?a:this.p.minus(a)}mul(a,n){return a.times(n).mod(this.p)}mulScalar(a,n){return a.times(Kt(n)).mod(this.p)}square(a){return a.square().mod(this.p)}eq(a,n){return a.eq(n)}neq(a,n){return a.neq(n)}lt(a,n){const e=a.gt(this.half)?a.minus(this.p):a,c=n.gt(this.half)?n.minus(this.p):n;return e.lt(c)}gt(a,n){const e=a.gt(this.half)?a.minus(this.p):a,c=n.gt(this.half)?n.minus(this.p):n;return e.gt(c)}leq(a,n){const e=a.gt(this.half)?a.minus(this.p):a,c=n.gt(this.half)?n.minus(this.p):n;return e.leq(c)}geq(a,n){const e=a.gt(this.half)?a.minus(this.p):a,c=n.gt(this.half)?n.minus(this.p):n;return e.geq(c)}div(a,n){if(n.isZero())throw new Error("Division by zero");return a.times(n.modInv(this.p)).mod(this.p)}idiv(a,n){if(n.isZero())throw new Error("Division by zero");return a.divide(n)}inv(a){if(a.isZero())throw new Error("Division by zero");return a.modInv(this.p)}mod(a,n){return a.mod(n)}pow(a,n){return a.modPow(n,this.p)}exp(a,n){return a.modPow(n,this.p)}band(a,n){return a.and(n).and(this.mask).mod(this.p)}bor(a,n){return a.or(n).and(this.mask).mod(this.p)}bxor(a,n){return a.xor(n).and(this.mask).mod(this.p)}bnot(a){return a.xor(this.mask).mod(this.p)}shl(a,n){if(n.lt(this.bitLength))return a.shiftLeft(n).and(this.mask).mod(this.p);{const e=this.p.minus(n);return e.lt(this.bitLength)?this.shr(a,e):Kt.zero}}shr(a,n){if(n.lt(this.bitLength))return a.shiftRight(n);{const e=this.p.minus(n);return e.lt(this.bitLength)?this.shl(a,e):Kt.zero}}land(a,n){return a.isZero()||n.isZero()?Kt.zero:Kt.one}lor(a,n){return a.isZero()&&n.isZero()?Kt.zero:Kt.one}lnot(a){return a.isZero()?Kt.one:Kt.zero}sqrt_old(a){if(a.equals(this.zero))return this.zero;if(!this.pow(a,this.negone.shiftRight(this.one)).equals(this.one))return null;let e=parseInt(this.s),c=this.nqr_to_t,i=this.pow(a,this.t),r=this.pow(a,this.add(this.t,this.one).shiftRight(this.one));for(;!i.equals(this.one);){let _=this.square(i),u=1;for(;!_.equals(this.one);)u++,_=this.square(_);let l=c;for(let s=0;s<e-u-1;s++)l=this.square(l);e=u,c=this.square(l),i=this.mul(i,c),r=this.mul(r,l)}return r.greater(this.p.shiftRight(this.one))&&(r=this.neg(r)),r}normalize(a){return a=Kt(a),a.isNegative()?this.p.minus(a.abs().mod(this.p)):a.mod(this.p)}random(){let a=Kt(0),n=Kt(this.p.square());for(;!n.isZero();)a=a.shiftLeft(8).add(Kt(ye(1)[0])),n=n.shiftRight(8);return a.mod(this.p)}toString(a,n){let e;return a.lesserOrEquals(this.p.shiftRight(Kt(1)))?e=a.toString(n):e="-"+this.p.minus(a).toString(n),e}isZero(a){return a.isZero()}fromRng(a){let n;do{n=Kt(0);for(let e=0;e<this.n64;e++)n=n.add(n,a.nextU64().shiftLeft(64*e));n=n.and(this.mask)}while(n.geq(this.p));return n=n.times(this.Ri).mod(this.q),n}}const uu=typeof BigInt=="function";let me;uu?me=du:me=_u;class gu extends me{toRprLE(a,n,e){yo(a,n,e,this.n64*8)}toRprBE(a,n,e){il(a,n,e,this.n64*8)}toRprBEM(a,n,e){return this.toRprBE(a,n,this.mul(this.R,e))}toRprLEM(a,n,e){return this.toRprLE(a,n,this.mul(this.R,e))}fromRprLE(a,n){return Ga(a,n,this.n8)}fromRprBE(a,n){return cl(a,n,this.n8)}fromRprLEM(a,n){return this.mul(this.fromRprLE(a,n),this.Ri)}fromRprBEM(a,n){return this.mul(this.fromRprBE(a,n),this.Ri)}}var Io={},ja={},bl;function Ea(){if(bl)return ja;bl=1;const t=Gn();return ja.bigInt2BytesLE=function(n,e){const c=Array(e);let i=t(n);for(let r=0;r<e;r++)c[r]=i.and(255).toJSNumber(),i=i.shiftRight(8);return c},ja.bigInt2U32LE=function(n,e){const c=Array(e);let i=t(n);for(let r=0;r<e;r++)c[r]=i.and(4294967295).toJSNumber(),i=i.shiftRight(32);return c},ja.isOcamNum=function(a){return!(!Array.isArray(a)||a.length!=3||typeof a[0]!="number"||typeof a[1]!="number"||!Array.isArray(a[2]))},ja}var Ce,yl;function fu(){if(yl)return Ce;yl=1;const t=Ea();return Ce=function(n,e,c){const i=c||"int";if(n.modules[i])return i;n.modules[i]={};const r=e*2,_=e*8;n.alloc(_,t.bigInt2BytesLE(1,_));function u(){const h=n.addFunction(i+"_copy");h.addParam("px","i32"),h.addParam("pr","i32");const y=h.getCodeBuilder();for(let q=0;q<e;q++)h.addCode(y.i64_store(y.getLocal("pr"),q*8,y.i64_load(y.getLocal("px"),q*8)))}function l(){const h=n.addFunction(i+"_zero");h.addParam("pr","i32");const y=h.getCodeBuilder();for(let q=0;q<e;q++)h.addCode(y.i64_store(y.getLocal("pr"),q*8,y.i64_const(0)))}function s(){const h=n.addFunction(i+"_one");h.addParam("pr","i32");const y=h.getCodeBuilder();h.addCode(y.i64_store(y.getLocal("pr"),0,y.i64_const(1)));for(let q=1;q<e;q++)h.addCode(y.i64_store(y.getLocal("pr"),q*8,y.i64_const(0)))}function I(){const h=n.addFunction(i+"_isZero");h.addParam("px","i32"),h.setReturnType("i32");const y=h.getCodeBuilder();function q(g){return g==0?y.ret(y.i64_eqz(y.i64_load(y.getLocal("px")))):y.if(y.i64_eqz(y.i64_load(y.getLocal("px"),g*8)),q(g-1),y.ret(y.i32_const(0)))}h.addCode(q(e-1)),h.addCode(y.ret(y.i32_const(0)))}function b(){const h=n.addFunction(i+"_eq");h.addParam("px","i32"),h.addParam("py","i32"),h.setReturnType("i32");const y=h.getCodeBuilder();function q(g){return g==0?y.ret(y.i64_eq(y.i64_load(y.getLocal("px")),y.i64_load(y.getLocal("py")))):y.if(y.i64_eq(y.i64_load(y.getLocal("px"),g*8),y.i64_load(y.getLocal("py"),g*8)),q(g-1),y.ret(y.i32_const(0)))}h.addCode(q(e-1)),h.addCode(y.ret(y.i32_const(0)))}function f(){const h=n.addFunction(i+"_gte");h.addParam("px","i32"),h.addParam("py","i32"),h.setReturnType("i32");const y=h.getCodeBuilder();function q(g){return g==0?y.ret(y.i64_ge_u(y.i64_load(y.getLocal("px")),y.i64_load(y.getLocal("py")))):y.if(y.i64_lt_u(y.i64_load(y.getLocal("px"),g*8),y.i64_load(y.getLocal("py"),g*8)),y.ret(y.i32_const(0)),y.if(y.i64_gt_u(y.i64_load(y.getLocal("px"),g*8),y.i64_load(y.getLocal("py"),g*8)),y.ret(y.i32_const(1)),q(g-1)))}h.addCode(q(e-1)),h.addCode(y.ret(y.i32_const(0)))}function w(){const h=n.addFunction(i+"_add");h.addParam("x","i32"),h.addParam("y","i32"),h.addParam("r","i32"),h.setReturnType("i32"),h.addLocal("c","i64");const y=h.getCodeBuilder();h.addCode(y.setLocal("c",y.i64_add(y.i64_load32_u(y.getLocal("x")),y.i64_load32_u(y.getLocal("y"))))),h.addCode(y.i64_store32(y.getLocal("r"),y.getLocal("c")));for(let q=1;q<r;q++)h.addCode(y.setLocal("c",y.i64_add(y.i64_add(y.i64_load32_u(y.getLocal("x"),4*q),y.i64_load32_u(y.getLocal("y"),4*q)),y.i64_shr_u(y.getLocal("c"),y.i64_const(32))))),h.addCode(y.i64_store32(y.getLocal("r"),q*4,y.getLocal("c")));h.addCode(y.i32_wrap_i64(y.i64_shr_u(y.getLocal("c"),y.i64_const(32))))}function O(){const h=n.addFunction(i+"_sub");h.addParam("x","i32"),h.addParam("y","i32"),h.addParam("r","i32"),h.setReturnType("i32"),h.addLocal("c","i64");const y=h.getCodeBuilder();h.addCode(y.setLocal("c",y.i64_sub(y.i64_load32_u(y.getLocal("x")),y.i64_load32_u(y.getLocal("y"))))),h.addCode(y.i64_store32(y.getLocal("r"),y.i64_and(y.getLocal("c"),y.i64_const("0xFFFFFFFF"))));for(let q=1;q<r;q++)h.addCode(y.setLocal("c",y.i64_add(y.i64_sub(y.i64_load32_u(y.getLocal("x"),4*q),y.i64_load32_u(y.getLocal("y"),4*q)),y.i64_shr_s(y.getLocal("c"),y.i64_const(32))))),h.addCode(y.i64_store32(y.getLocal("r"),q*4,y.i64_and(y.getLocal("c"),y.i64_const("0xFFFFFFFF"))));h.addCode(y.i32_wrap_i64(y.i64_shr_s(y.getLocal("c"),y.i64_const(32))))}function D(){const h=n.addFunction(i+"_mul");h.addParam("x","i32"),h.addParam("y","i32"),h.addParam("r","i32"),h.addLocal("c0","i64"),h.addLocal("c1","i64");for(let N=0;N<r;N++)h.addLocal("x"+N,"i64"),h.addLocal("y"+N,"i64");const y=h.getCodeBuilder(),q=[],g=[];function x(N,P){let v,S;return q[N]?v=y.getLocal("x"+N):(v=y.teeLocal("x"+N,y.i64_load32_u(y.getLocal("x"),N*4)),q[N]=!0),g[P]?S=y.getLocal("y"+P):(S=y.teeLocal("y"+P,y.i64_load32_u(y.getLocal("y"),P*4)),g[P]=!0),y.i64_mul(v,S)}let H="c0",T="c1";for(let N=0;N<r*2-1;N++){for(let P=Math.max(0,N-r+1);P<=N&&P<r;P++){const v=N-P;h.addCode(y.setLocal(H,y.i64_add(y.i64_and(y.getLocal(H),y.i64_const(4294967295)),x(P,v)))),h.addCode(y.setLocal(T,y.i64_add(y.getLocal(T),y.i64_shr_u(y.getLocal(H),y.i64_const(32)))))}h.addCode(y.i64_store32(y.getLocal("r"),N*4,y.getLocal(H))),[H,T]=[T,H],h.addCode(y.setLocal(T,y.i64_shr_u(y.getLocal(H),y.i64_const(32))))}h.addCode(y.i64_store32(y.getLocal("r"),r*4*2-4,y.getLocal(H)))}function G(){const h=n.addFunction(i+"_square");h.addParam("x","i32"),h.addParam("r","i32"),h.addLocal("c0","i64"),h.addLocal("c1","i64"),h.addLocal("c0_old","i64"),h.addLocal("c1_old","i64");for(let P=0;P<r;P++)h.addLocal("x"+P,"i64");const y=h.getCodeBuilder(),q=[];function g(P,v){let S,et;return q[P]?S=y.getLocal("x"+P):(S=y.teeLocal("x"+P,y.i64_load32_u(y.getLocal("x"),P*4)),q[P]=!0),q[v]?et=y.getLocal("x"+v):(et=y.teeLocal("x"+v,y.i64_load32_u(y.getLocal("x"),v*4)),q[v]=!0),y.i64_mul(S,et)}let x="c0",H="c1",T="c0_old",N="c1_old";for(let P=0;P<r*2-1;P++){h.addCode(y.setLocal(x,y.i64_const(0)),y.setLocal(H,y.i64_const(0)));for(let v=Math.max(0,P-r+1);v<P+1>>1&&v<r;v++){const S=P-v;h.addCode(y.setLocal(x,y.i64_add(y.i64_and(y.getLocal(x),y.i64_const(4294967295)),g(v,S)))),h.addCode(y.setLocal(H,y.i64_add(y.getLocal(H),y.i64_shr_u(y.getLocal(x),y.i64_const(32)))))}h.addCode(y.setLocal(x,y.i64_shl(y.i64_and(y.getLocal(x),y.i64_const(4294967295)),y.i64_const(1)))),h.addCode(y.setLocal(H,y.i64_add(y.i64_shl(y.getLocal(H),y.i64_const(1)),y.i64_shr_u(y.getLocal(x),y.i64_const(32))))),P%2==0&&(h.addCode(y.setLocal(x,y.i64_add(y.i64_and(y.getLocal(x),y.i64_const(4294967295)),g(P>>1,P>>1)))),h.addCode(y.setLocal(H,y.i64_add(y.getLocal(H),y.i64_shr_u(y.getLocal(x),y.i64_const(32)))))),P>0&&(h.addCode(y.setLocal(x,y.i64_add(y.i64_and(y.getLocal(x),y.i64_const(4294967295)),y.i64_and(y.getLocal(T),y.i64_const(4294967295))))),h.addCode(y.setLocal(H,y.i64_add(y.i64_add(y.getLocal(H),y.i64_shr_u(y.getLocal(x),y.i64_const(32))),y.getLocal(N))))),h.addCode(y.i64_store32(y.getLocal("r"),P*4,y.getLocal(x))),h.addCode(y.setLocal(T,y.getLocal(H)),y.setLocal(N,y.i64_shr_u(y.getLocal(T),y.i64_const(32))))}h.addCode(y.i64_store32(y.getLocal("r"),r*4*2-4,y.getLocal(T)))}function V(){const h=n.addFunction(i+"_squareOld");h.addParam("x","i32"),h.addParam("r","i32");const y=h.getCodeBuilder();h.addCode(y.call(i+"_mul",y.getLocal("x"),y.getLocal("x"),y.getLocal("r")))}function it(){const h=n.addFunction(i+"__mul1");h.addParam("px","i32"),h.addParam("y","i64"),h.addParam("pr","i32"),h.addLocal("c","i64");const y=h.getCodeBuilder();h.addCode(y.setLocal("c",y.i64_mul(y.i64_load32_u(y.getLocal("px"),0,0),y.getLocal("y")))),h.addCode(y.i64_store32(y.getLocal("pr"),0,0,y.getLocal("c")));for(let q=1;q<r;q++)h.addCode(y.setLocal("c",y.i64_add(y.i64_mul(y.i64_load32_u(y.getLocal("px"),4*q,0),y.getLocal("y")),y.i64_shr_u(y.getLocal("c"),y.i64_const(32))))),h.addCode(y.i64_store32(y.getLocal("pr"),q*4,0,y.getLocal("c")))}function Z(){const h=n.addFunction(i+"__add1");h.addParam("x","i32"),h.addParam("y","i64"),h.addLocal("c","i64"),h.addLocal("px","i32");const y=h.getCodeBuilder();h.addCode(y.setLocal("px",y.getLocal("x"))),h.addCode(y.setLocal("c",y.i64_add(y.i64_load32_u(y.getLocal("px"),0,0),y.getLocal("y")))),h.addCode(y.i64_store32(y.getLocal("px"),0,0,y.getLocal("c"))),h.addCode(y.setLocal("c",y.i64_shr_u(y.getLocal("c"),y.i64_const(32)))),h.addCode(y.block(y.loop(y.br_if(1,y.i64_eqz(y.getLocal("c"))),y.setLocal("px",y.i32_add(y.getLocal("px"),y.i32_const(4))),y.setLocal("c",y.i64_add(y.i64_load32_u(y.getLocal("px"),0,0),y.getLocal("c"))),y.i64_store32(y.getLocal("px"),0,0,y.getLocal("c")),y.setLocal("c",y.i64_shr_u(y.getLocal("c"),y.i64_const(32))),y.br(0))))}function E(){it(),Z();const h=n.addFunction(i+"_div");h.addParam("x","i32"),h.addParam("y","i32"),h.addParam("c","i32"),h.addParam("r","i32"),h.addLocal("rr","i32"),h.addLocal("cc","i32"),h.addLocal("eX","i32"),h.addLocal("eY","i32"),h.addLocal("sy","i64"),h.addLocal("sx","i64"),h.addLocal("ec","i32");const y=h.getCodeBuilder(),q=y.i32_const(n.alloc(_)),g=y.i32_const(n.alloc(_)),x=y.i32_const(n.alloc(_)),H=y.getLocal("cc"),T=y.getLocal("rr"),N=n.alloc(_*2),P=y.i32_const(N),v=y.i32_const(N+_);h.addCode(y.if(y.getLocal("c"),y.setLocal("cc",y.getLocal("c")),y.setLocal("cc",g))),h.addCode(y.if(y.getLocal("r"),y.setLocal("rr",y.getLocal("r")),y.setLocal("rr",x))),h.addCode(y.call(i+"_copy",y.getLocal("x"),T)),h.addCode(y.call(i+"_copy",y.getLocal("y"),q)),h.addCode(y.call(i+"_zero",H)),h.addCode(y.call(i+"_zero",P)),h.addCode(y.setLocal("eX",y.i32_const(_-1))),h.addCode(y.setLocal("eY",y.i32_const(_-1))),h.addCode(y.block(y.loop(y.br_if(1,y.i32_or(y.i32_load8_u(y.i32_add(q,y.getLocal("eY")),0,0),y.i32_eq(y.getLocal("eY"),y.i32_const(3)))),y.setLocal("eY",y.i32_sub(y.getLocal("eY"),y.i32_const(1))),y.br(0)))),h.addCode(y.setLocal("sy",y.i64_add(y.i64_load32_u(y.i32_sub(y.i32_add(q,y.getLocal("eY")),y.i32_const(3)),0,0),y.i64_const(1)))),h.addCode(y.if(y.i64_eq(y.getLocal("sy"),y.i64_const(1)),y.drop(y.i64_div_u(y.i64_const(0),y.i64_const(0))))),h.addCode(y.block(y.loop(y.block(y.loop(y.br_if(1,y.i32_or(y.i32_load8_u(y.i32_add(T,y.getLocal("eX")),0,0),y.i32_eq(y.getLocal("eX"),y.i32_const(7)))),y.setLocal("eX",y.i32_sub(y.getLocal("eX"),y.i32_const(1))),y.br(0))),y.setLocal("sx",y.i64_load(y.i32_sub(y.i32_add(T,y.getLocal("eX")),y.i32_const(7)),0,0)),y.setLocal("sx",y.i64_div_u(y.getLocal("sx"),y.getLocal("sy"))),y.setLocal("ec",y.i32_sub(y.i32_sub(y.getLocal("eX"),y.getLocal("eY")),y.i32_const(4))),y.block(y.loop(y.br_if(1,y.i32_and(y.i64_eqz(y.i64_and(y.getLocal("sx"),y.i64_const("0xFFFFFFFF00000000"))),y.i32_ge_s(y.getLocal("ec"),y.i32_const(0)))),y.setLocal("sx",y.i64_shr_u(y.getLocal("sx"),y.i64_const(8))),y.setLocal("ec",y.i32_add(y.getLocal("ec"),y.i32_const(1))),y.br(0))),y.if(y.i64_eqz(y.getLocal("sx")),[...y.br_if(2,y.i32_eqz(y.call(i+"_gte",T,q))),...y.setLocal("sx",y.i64_const(1)),...y.setLocal("ec",y.i32_const(0))]),y.call(i+"__mul1",q,y.getLocal("sx"),v),y.drop(y.call(i+"_sub",T,y.i32_sub(v,y.getLocal("ec")),T)),y.call(i+"__add1",y.i32_add(H,y.getLocal("ec")),y.getLocal("sx")),y.br(0))))}function M(){const h=n.addFunction(i+"_inverseMod");h.addParam("px","i32"),h.addParam("pm","i32"),h.addParam("pr","i32"),h.addLocal("t","i32"),h.addLocal("newt","i32"),h.addLocal("r","i32"),h.addLocal("qq","i32"),h.addLocal("qr","i32"),h.addLocal("newr","i32"),h.addLocal("swp","i32"),h.addLocal("x","i32"),h.addLocal("signt","i32"),h.addLocal("signnewt","i32"),h.addLocal("signx","i32");const y=h.getCodeBuilder(),q=y.i32_const(n.alloc(_)),g=y.i32_const(n.alloc(_)),x=y.i32_const(n.alloc(_)),H=y.i32_const(n.alloc(_)),T=y.i32_const(n.alloc(_)),N=y.i32_const(n.alloc(_)),P=y.i32_const(n.alloc(_*2)),v=y.i32_const(n.alloc(_));h.addCode(y.setLocal("t",q),y.call(i+"_zero",q),y.setLocal("signt",y.i32_const(0))),h.addCode(y.setLocal("r",g),y.call(i+"_copy",y.getLocal("pm"),g)),h.addCode(y.setLocal("newt",x),y.call(i+"_one",x),y.setLocal("signnewt",y.i32_const(0))),h.addCode(y.setLocal("newr",H),y.call(i+"_copy",y.getLocal("px"),H)),h.addCode(y.setLocal("qq",T)),h.addCode(y.setLocal("qr",N)),h.addCode(y.setLocal("x",v)),h.addCode(y.block(y.loop(y.br_if(1,y.call(i+"_isZero",y.getLocal("newr"))),y.call(i+"_div",y.getLocal("r"),y.getLocal("newr"),y.getLocal("qq"),y.getLocal("qr")),y.call(i+"_mul",y.getLocal("qq"),y.getLocal("newt"),P),y.if(y.getLocal("signt"),y.if(y.getLocal("signnewt"),y.if(y.call(i+"_gte",P,y.getLocal("t")),[...y.drop(y.call(i+"_sub",P,y.getLocal("t"),y.getLocal("x"))),...y.setLocal("signx",y.i32_const(0))],[...y.drop(y.call(i+"_sub",y.getLocal("t"),P,y.getLocal("x"))),...y.setLocal("signx",y.i32_const(1))]),[...y.drop(y.call(i+"_add",P,y.getLocal("t"),y.getLocal("x"))),...y.setLocal("signx",y.i32_const(1))]),y.if(y.getLocal("signnewt"),[...y.drop(y.call(i+"_add",P,y.getLocal("t"),y.getLocal("x"))),...y.setLocal("signx",y.i32_const(0))],y.if(y.call(i+"_gte",y.getLocal("t"),P),[...y.drop(y.call(i+"_sub",y.getLocal("t"),P,y.getLocal("x"))),...y.setLocal("signx",y.i32_const(0))],[...y.drop(y.call(i+"_sub",P,y.getLocal("t"),y.getLocal("x"))),...y.setLocal("signx",y.i32_const(1))]))),y.setLocal("swp",y.getLocal("t")),y.setLocal("t",y.getLocal("newt")),y.setLocal("newt",y.getLocal("x")),y.setLocal("x",y.getLocal("swp")),y.setLocal("signt",y.getLocal("signnewt")),y.setLocal("signnewt",y.getLocal("signx")),y.setLocal("swp",y.getLocal("r")),y.setLocal("r",y.getLocal("newr")),y.setLocal("newr",y.getLocal("qr")),y.setLocal("qr",y.getLocal("swp")),y.br(0)))),h.addCode(y.if(y.getLocal("signt"),y.drop(y.call(i+"_sub",y.getLocal("pm"),y.getLocal("t"),y.getLocal("pr"))),y.call(i+"_copy",y.getLocal("t"),y.getLocal("pr"))))}return u(),l(),I(),s(),b(),f(),w(),O(),D(),G(),V(),E(),M(),n.exportFunction(i+"_copy"),n.exportFunction(i+"_zero"),n.exportFunction(i+"_one"),n.exportFunction(i+"_isZero"),n.exportFunction(i+"_eq"),n.exportFunction(i+"_gte"),n.exportFunction(i+"_add"),n.exportFunction(i+"_sub"),n.exportFunction(i+"_mul"),n.exportFunction(i+"_square"),n.exportFunction(i+"_squareOld"),n.exportFunction(i+"_div"),n.exportFunction(i+"_inverseMod"),i},Ce}var Ie,Al;function we(){return Al||(Al=1,Ie=function(a,n,e,c,i,r,_){const u=a.addFunction(n);u.addParam("base","i32"),u.addParam("scalar","i32"),u.addParam("scalarLength","i32"),u.addParam("r","i32"),u.addLocal("i","i32"),u.addLocal("b","i32");const l=u.getCodeBuilder(),s=l.i32_const(a.alloc(e));u.addCode(l.if(l.i32_eqz(l.getLocal("scalarLength")),[...l.call(_,l.getLocal("r")),...l.ret([])])),u.addCode(l.call(r,l.getLocal("base"),s)),u.addCode(l.call(_,l.getLocal("r"))),u.addCode(l.setLocal("i",l.getLocal("scalarLength"))),u.addCode(l.block(l.loop(l.setLocal("i",l.i32_sub(l.getLocal("i"),l.i32_const(1))),l.setLocal("b",l.i32_load8_u(l.i32_add(l.getLocal("scalar"),l.getLocal("i")))),...I(),l.br_if(1,l.i32_eqz(l.getLocal("i"))),l.br(0))));function I(){const b=[];for(let f=0;f<8;f++)b.push(...l.call(i,l.getLocal("r"),l.getLocal("r")),...l.if(l.i32_ge_u(l.getLocal("b"),l.i32_const(128>>f)),[...l.setLocal("b",l.i32_sub(l.getLocal("b"),l.i32_const(128>>f))),...l.call(c,l.getLocal("r"),s,l.getLocal("r"))]));return b}}),Ie}var ve,ml;function Be(){if(ml)return ve;ml=1,ve=t;function t(a,n){const e=a.modules[n].n64*8,c=a.addFunction(n+"_batchInverse");c.addParam("pIn","i32"),c.addParam("inStep","i32"),c.addParam("n","i32"),c.addParam("pOut","i32"),c.addParam("outStep","i32"),c.addLocal("itAux","i32"),c.addLocal("itIn","i32"),c.addLocal("itOut","i32"),c.addLocal("i","i32");const i=c.getCodeBuilder(),r=i.i32_const(a.alloc(e));c.addCode(i.setLocal("itAux",i.i32_load(i.i32_const(0))),i.i32_store(i.i32_const(0),i.i32_add(i.getLocal("itAux"),i.i32_mul(i.i32_add(i.getLocal("n"),i.i32_const(1)),i.i32_const(e))))),c.addCode(i.call(n+"_one",i.getLocal("itAux")),i.setLocal("itIn",i.getLocal("pIn")),i.setLocal("itAux",i.i32_add(i.getLocal("itAux"),i.i32_const(e))),i.setLocal("i",i.i32_const(0)),i.block(i.loop(i.br_if(1,i.i32_eq(i.getLocal("i"),i.getLocal("n"))),i.if(i.call(n+"_isZero",i.getLocal("itIn")),i.call(n+"_copy",i.i32_sub(i.getLocal("itAux"),i.i32_const(e)),i.getLocal("itAux")),i.call(n+"_mul",i.getLocal("itIn"),i.i32_sub(i.getLocal("itAux"),i.i32_const(e)),i.getLocal("itAux"))),i.setLocal("itIn",i.i32_add(i.getLocal("itIn"),i.getLocal("inStep"))),i.setLocal("itAux",i.i32_add(i.getLocal("itAux"),i.i32_const(e))),i.setLocal("i",i.i32_add(i.getLocal("i"),i.i32_const(1))),i.br(0))),i.setLocal("itIn",i.i32_sub(i.getLocal("itIn"),i.getLocal("inStep"))),i.setLocal("itAux",i.i32_sub(i.getLocal("itAux"),i.i32_const(e))),i.setLocal("itOut",i.i32_add(i.getLocal("pOut"),i.i32_mul(i.i32_sub(i.getLocal("n"),i.i32_const(1)),i.getLocal("outStep")))),i.call(n+"_inverse",i.getLocal("itAux"),i.getLocal("itAux")),i.block(i.loop(i.br_if(1,i.i32_eqz(i.getLocal("i"))),i.if(i.call(n+"_isZero",i.getLocal("itIn")),[...i.call(n+"_copy",i.getLocal("itAux"),i.i32_sub(i.getLocal("itAux"),i.i32_const(e))),...i.call(n+"_zero",i.getLocal("itOut"))],[...i.call(n+"_copy",i.i32_sub(i.getLocal("itAux"),i.i32_const(e)),r),...i.call(n+"_mul",i.getLocal("itAux"),i.getLocal("itIn"),i.i32_sub(i.getLocal("itAux"),i.i32_const(e))),...i.call(n+"_mul",i.getLocal("itAux"),r,i.getLocal("itOut"))]),i.setLocal("itIn",i.i32_sub(i.getLocal("itIn"),i.getLocal("inStep"))),i.setLocal("itOut",i.i32_sub(i.getLocal("itOut"),i.getLocal("outStep"))),i.setLocal("itAux",i.i32_sub(i.getLocal("itAux"),i.i32_const(e))),i.setLocal("i",i.i32_sub(i.getLocal("i"),i.i32_const(1))),i.br(0)))),c.addCode(i.i32_store(i.i32_const(0),i.getLocal("itAux")))}return ve}var Ee,Cl;function Il(){if(Cl)return Ee;Cl=1,Ee=t;function t(a,n,e,c,i,r){typeof r>"u"&&(c<i?r=!0:r=!1);const _=a.addFunction(n);_.addParam("pIn","i32"),_.addParam("n","i32"),_.addParam("pOut","i32"),_.addLocal("i","i32"),_.addLocal("itIn","i32"),_.addLocal("itOut","i32");const u=_.getCodeBuilder();r?_.addCode(u.setLocal("itIn",u.i32_add(u.getLocal("pIn"),u.i32_mul(u.i32_sub(u.getLocal("n"),u.i32_const(1)),u.i32_const(c)))),u.setLocal("itOut",u.i32_add(u.getLocal("pOut"),u.i32_mul(u.i32_sub(u.getLocal("n"),u.i32_const(1)),u.i32_const(i)))),u.setLocal("i",u.i32_const(0)),u.block(u.loop(u.br_if(1,u.i32_eq(u.getLocal("i"),u.getLocal("n"))),u.call(e,u.getLocal("itIn"),u.getLocal("itOut")),u.setLocal("itIn",u.i32_sub(u.getLocal("itIn"),u.i32_const(c))),u.setLocal("itOut",u.i32_sub(u.getLocal("itOut"),u.i32_const(i))),u.setLocal("i",u.i32_add(u.getLocal("i"),u.i32_const(1))),u.br(0)))):_.addCode(u.setLocal("itIn",u.getLocal("pIn")),u.setLocal("itOut",u.getLocal("pOut")),u.setLocal("i",u.i32_const(0)),u.block(u.loop(u.br_if(1,u.i32_eq(u.getLocal("i"),u.getLocal("n"))),u.call(e,u.getLocal("itIn"),u.getLocal("itOut")),u.setLocal("itIn",u.i32_add(u.getLocal("itIn"),u.i32_const(c))),u.setLocal("itOut",u.i32_add(u.getLocal("itOut"),u.i32_const(i))),u.setLocal("i",u.i32_add(u.getLocal("i"),u.i32_const(1))),u.br(0))))}return Ee}var Fe,wl;function hu(){if(wl)return Fe;wl=1,Fe=t;function t(a,n,e,c,i,r){typeof r>"u"&&(c<i?r=!0:r=!1);const _=a.addFunction(n);_.addParam("pIn1","i32"),_.addParam("pIn2","i32"),_.addParam("n","i32"),_.addParam("pOut","i32"),_.addLocal("i","i32"),_.addLocal("itIn1","i32"),_.addLocal("itIn2","i32"),_.addLocal("itOut","i32");const u=_.getCodeBuilder();r?_.addCode(u.setLocal("itIn1",u.i32_add(u.getLocal("pIn1"),u.i32_mul(u.i32_sub(u.getLocal("n"),u.i32_const(1)),u.i32_const(c)))),u.setLocal("itIn2",u.i32_add(u.getLocal("pIn2"),u.i32_mul(u.i32_sub(u.getLocal("n"),u.i32_const(1)),u.i32_const(c)))),u.setLocal("itOut",u.i32_add(u.getLocal("pOut"),u.i32_mul(u.i32_sub(u.getLocal("n"),u.i32_const(1)),u.i32_const(i)))),u.setLocal("i",u.i32_const(0)),u.block(u.loop(u.br_if(1,u.i32_eq(u.getLocal("i"),u.getLocal("n"))),u.call(e,u.getLocal("itIn1"),u.getLocal("itIn2"),u.getLocal("itOut")),u.setLocal("itIn1",u.i32_sub(u.getLocal("itIn1"),u.i32_const(c))),u.setLocal("itIn2",u.i32_sub(u.getLocal("itIn2"),u.i32_const(c))),u.setLocal("itOut",u.i32_sub(u.getLocal("itOut"),u.i32_const(i))),u.setLocal("i",u.i32_add(u.getLocal("i"),u.i32_const(1))),u.br(0)))):_.addCode(u.setLocal("itIn1",u.getLocal("pIn1")),u.setLocal("itIn2",u.getLocal("pIn2")),u.setLocal("itOut",u.getLocal("pOut")),u.setLocal("i",u.i32_const(0)),u.block(u.loop(u.br_if(1,u.i32_eq(u.getLocal("i"),u.getLocal("n"))),u.call(e,u.getLocal("itIn1"),u.getLocal("itIn2"),u.getLocal("itOut")),u.setLocal("itIn1",u.i32_add(u.getLocal("itIn1"),u.i32_const(c))),u.setLocal("itIn2",u.i32_add(u.getLocal("itIn2"),u.i32_const(c))),u.setLocal("itOut",u.i32_add(u.getLocal("itOut"),u.i32_const(i))),u.setLocal("i",u.i32_add(u.getLocal("i"),u.i32_const(1))),u.br(0))))}return Fe}var xe,vl;function Se(){if(vl)return xe;vl=1;const t=Gn(),a=fu(),n=Ea(),e=we(),c=Be(),i=Il(),r=hu();return xe=function(u,l,s,I){const b=t(l),f=Math.floor((b.minus(1).bitLength()-1)/64)+1,w=f*2,O=f*8,D=s||"f1m";if(u.modules[D])return D;const G=a(u,f,I),V=u.alloc(O,n.bigInt2BytesLE(b,O));u.alloc(n.bigInt2BytesLE(t.one.shiftLeft(f*64).mod(b),O));const it=u.alloc(n.bigInt2BytesLE(t.one.shiftLeft(f*64).square().mod(b),O)),Z=u.alloc(n.bigInt2BytesLE(t.one.shiftLeft(f*64).mod(b),O)),E=u.alloc(n.bigInt2BytesLE(t.zero,O)),M=b.minus(t.one),h=M.shiftRight(1),y=u.alloc(O,n.bigInt2BytesLE(h,O)),q=h.add(t.one),g=u.alloc(O,n.bigInt2BytesLE(q,O));u.modules[D]={pq:V,pR2:it,n64:f,q:b,pOne:Z,pZero:E,pePlusOne:g};function x(){const Q=u.addFunction(D+"_one");Q.addParam("pr","i32");const A=Q.getCodeBuilder();Q.addCode(A.call(G+"_copy",A.i32_const(Z),A.getLocal("pr")))}function H(){const Q=u.addFunction(D+"_add");Q.addParam("x","i32"),Q.addParam("y","i32"),Q.addParam("r","i32");const A=Q.getCodeBuilder();Q.addCode(A.if(A.call(G+"_add",A.getLocal("x"),A.getLocal("y"),A.getLocal("r")),A.drop(A.call(G+"_sub",A.getLocal("r"),A.i32_const(V),A.getLocal("r"))),A.if(A.call(G+"_gte",A.getLocal("r"),A.i32_const(V)),A.drop(A.call(G+"_sub",A.getLocal("r"),A.i32_const(V),A.getLocal("r"))))))}function T(){const Q=u.addFunction(D+"_sub");Q.addParam("x","i32"),Q.addParam("y","i32"),Q.addParam("r","i32");const A=Q.getCodeBuilder();Q.addCode(A.if(A.call(G+"_sub",A.getLocal("x"),A.getLocal("y"),A.getLocal("r")),A.drop(A.call(G+"_add",A.getLocal("r"),A.i32_const(V),A.getLocal("r")))))}function N(){const Q=u.addFunction(D+"_neg");Q.addParam("x","i32"),Q.addParam("r","i32");const A=Q.getCodeBuilder();Q.addCode(A.call(D+"_sub",A.i32_const(E),A.getLocal("x"),A.getLocal("r")))}function P(){const Q=u.addFunction(D+"_isNegative");Q.addParam("x","i32"),Q.setReturnType("i32");const A=Q.getCodeBuilder(),lt=A.i32_const(u.alloc(O));Q.addCode(A.call(D+"_fromMontgomery",A.getLocal("x"),lt),A.call(G+"_gte",lt,A.i32_const(g)))}function v(){const Q=u.addFunction(D+"_sign");Q.addParam("x","i32"),Q.setReturnType("i32");const A=Q.getCodeBuilder(),lt=A.i32_const(u.alloc(O));Q.addCode(A.if(A.call(G+"_isZero",A.getLocal("x")),A.ret(A.i32_const(0))),A.call(D+"_fromMontgomery",A.getLocal("x"),lt),A.if(A.call(G+"_gte",lt,A.i32_const(g)),A.ret(A.i32_const(-1))),A.ret(A.i32_const(1)))}function S(){const Q=u.alloc(w*w*8),A=u.addFunction(D+"_mReduct");A.addParam("t","i32"),A.addParam("r","i32"),A.addLocal("np32","i64"),A.addLocal("c","i64"),A.addLocal("m","i64");const lt=A.getCodeBuilder(),Ft=t("100000000",16).minus(b.modInv(t("100000000",16))).toJSNumber();A.addCode(lt.setLocal("np32",lt.i64_const(Ft)));for(let Ut=0;Ut<w;Ut++){A.addCode(lt.setLocal("c",lt.i64_const(0))),A.addCode(lt.setLocal("m",lt.i64_and(lt.i64_mul(lt.i64_load32_u(lt.getLocal("t"),Ut*4),lt.getLocal("np32")),lt.i64_const("0xFFFFFFFF"))));for(let dt=0;dt<w;dt++)A.addCode(lt.setLocal("c",lt.i64_add(lt.i64_add(lt.i64_load32_u(lt.getLocal("t"),(Ut+dt)*4),lt.i64_shr_u(lt.getLocal("c"),lt.i64_const(32))),lt.i64_mul(lt.i64_load32_u(lt.i32_const(V),dt*4),lt.getLocal("m"))))),A.addCode(lt.i64_store32(lt.getLocal("t"),(Ut+dt)*4,lt.getLocal("c")));A.addCode(lt.i64_store32(lt.i32_const(Q),Ut*4,lt.i64_shr_u(lt.getLocal("c"),lt.i64_const(32))))}A.addCode(lt.call(D+"_add",lt.i32_const(Q),lt.i32_add(lt.getLocal("t"),lt.i32_const(w*4)),lt.getLocal("r")))}function et(){const Q=u.addFunction(D+"_mul");Q.addParam("x","i32"),Q.addParam("y","i32"),Q.addParam("r","i32"),Q.addLocal("c0","i64"),Q.addLocal("c1","i64"),Q.addLocal("np32","i64");for(let $=0;$<w;$++)Q.addLocal("x"+$,"i64"),Q.addLocal("y"+$,"i64"),Q.addLocal("m"+$,"i64"),Q.addLocal("q"+$,"i64");const A=Q.getCodeBuilder(),lt=t("100000000",16).minus(b.modInv(t("100000000",16))).toJSNumber();Q.addCode(A.setLocal("np32",A.i64_const(lt)));const Ft=[],Ut=[],dt=[];function B($,X){let at,gt;return Ft[$]?at=A.getLocal("x"+$):(at=A.teeLocal("x"+$,A.i64_load32_u(A.getLocal("x"),$*4)),Ft[$]=!0),Ut[X]?gt=A.getLocal("y"+X):(gt=A.teeLocal("y"+X,A.i64_load32_u(A.getLocal("y"),X*4)),Ut[X]=!0),A.i64_mul(at,gt)}function Lt($,X){let at,gt;return dt[$]?at=A.getLocal("q"+$):(at=A.teeLocal("q"+$,A.i64_load32_u(A.i32_const(0),V+$*4)),dt[$]=!0),gt=A.getLocal("m"+X),A.i64_mul(at,gt)}let Gt="c0",z="c1";for(let $=0;$<w*2-1;$++){for(let X=Math.max(0,$-w+1);X<=$&&X<w;X++){const at=$-X;Q.addCode(A.setLocal(Gt,A.i64_add(A.i64_and(A.getLocal(Gt),A.i64_const(4294967295)),B(X,at)))),Q.addCode(A.setLocal(z,A.i64_add(A.getLocal(z),A.i64_shr_u(A.getLocal(Gt),A.i64_const(32)))))}for(let X=Math.max(1,$-w+1);X<=$&&X<w;X++){const at=$-X;Q.addCode(A.setLocal(Gt,A.i64_add(A.i64_and(A.getLocal(Gt),A.i64_const(4294967295)),Lt(X,at)))),Q.addCode(A.setLocal(z,A.i64_add(A.getLocal(z),A.i64_shr_u(A.getLocal(Gt),A.i64_const(32)))))}$<w&&(Q.addCode(A.setLocal("m"+$,A.i64_and(A.i64_mul(A.i64_and(A.getLocal(Gt),A.i64_const(4294967295)),A.getLocal("np32")),A.i64_const("0xFFFFFFFF")))),Q.addCode(A.setLocal(Gt,A.i64_add(A.i64_and(A.getLocal(Gt),A.i64_const(4294967295)),Lt(0,$)))),Q.addCode(A.setLocal(z,A.i64_add(A.getLocal(z),A.i64_shr_u(A.getLocal(Gt),A.i64_const(32)))))),$>=w&&Q.addCode(A.i64_store32(A.getLocal("r"),($-w)*4,A.getLocal(Gt))),[Gt,z]=[z,Gt],Q.addCode(A.setLocal(z,A.i64_shr_u(A.getLocal(Gt),A.i64_const(32))))}Q.addCode(A.i64_store32(A.getLocal("r"),w*4-4,A.getLocal(Gt))),Q.addCode(A.if(A.i32_wrap_i64(A.getLocal(z)),A.drop(A.call(G+"_sub",A.getLocal("r"),A.i32_const(V),A.getLocal("r"))),A.if(A.call(G+"_gte",A.getLocal("r"),A.i32_const(V)),A.drop(A.call(G+"_sub",A.getLocal("r"),A.i32_const(V),A.getLocal("r"))))))}function _t(){const Q=u.addFunction(D+"_square");Q.addParam("x","i32"),Q.addParam("r","i32"),Q.addLocal("c0","i64"),Q.addLocal("c1","i64"),Q.addLocal("c0_old","i64"),Q.addLocal("c1_old","i64"),Q.addLocal("np32","i64");for(let X=0;X<w;X++)Q.addLocal("x"+X,"i64"),Q.addLocal("m"+X,"i64"),Q.addLocal("q"+X,"i64");const A=Q.getCodeBuilder(),lt=t("100000000",16).minus(b.modInv(t("100000000",16))).toJSNumber();Q.addCode(A.setLocal("np32",A.i64_const(lt)));const Ft=[],Ut=[];function dt(X,at){let gt,ft;return Ft[X]?gt=A.getLocal("x"+X):(gt=A.teeLocal("x"+X,A.i64_load32_u(A.getLocal("x"),X*4)),Ft[X]=!0),Ft[at]?ft=A.getLocal("x"+at):(ft=A.teeLocal("x"+at,A.i64_load32_u(A.getLocal("x"),at*4)),Ft[at]=!0),A.i64_mul(gt,ft)}function B(X,at){let gt,ft;return Ut[X]?gt=A.getLocal("q"+X):(gt=A.teeLocal("q"+X,A.i64_load32_u(A.i32_const(0),V+X*4)),Ut[X]=!0),ft=A.getLocal("m"+at),A.i64_mul(gt,ft)}let Lt="c0",Gt="c1",z="c0_old",$="c1_old";for(let X=0;X<w*2-1;X++){Q.addCode(A.setLocal(Lt,A.i64_const(0)),A.setLocal(Gt,A.i64_const(0)));for(let at=Math.max(0,X-w+1);at<X+1>>1&&at<w;at++){const gt=X-at;Q.addCode(A.setLocal(Lt,A.i64_add(A.i64_and(A.getLocal(Lt),A.i64_const(4294967295)),dt(at,gt)))),Q.addCode(A.setLocal(Gt,A.i64_add(A.getLocal(Gt),A.i64_shr_u(A.getLocal(Lt),A.i64_const(32)))))}Q.addCode(A.setLocal(Lt,A.i64_shl(A.i64_and(A.getLocal(Lt),A.i64_const(4294967295)),A.i64_const(1)))),Q.addCode(A.setLocal(Gt,A.i64_add(A.i64_shl(A.getLocal(Gt),A.i64_const(1)),A.i64_shr_u(A.getLocal(Lt),A.i64_const(32))))),X%2==0&&(Q.addCode(A.setLocal(Lt,A.i64_add(A.i64_and(A.getLocal(Lt),A.i64_const(4294967295)),dt(X>>1,X>>1)))),Q.addCode(A.setLocal(Gt,A.i64_add(A.getLocal(Gt),A.i64_shr_u(A.getLocal(Lt),A.i64_const(32)))))),X>0&&(Q.addCode(A.setLocal(Lt,A.i64_add(A.i64_and(A.getLocal(Lt),A.i64_const(4294967295)),A.i64_and(A.getLocal(z),A.i64_const(4294967295))))),Q.addCode(A.setLocal(Gt,A.i64_add(A.i64_add(A.getLocal(Gt),A.i64_shr_u(A.getLocal(Lt),A.i64_const(32))),A.getLocal($)))));for(let at=Math.max(1,X-w+1);at<=X&&at<w;at++){const gt=X-at;Q.addCode(A.setLocal(Lt,A.i64_add(A.i64_and(A.getLocal(Lt),A.i64_const(4294967295)),B(at,gt)))),Q.addCode(A.setLocal(Gt,A.i64_add(A.getLocal(Gt),A.i64_shr_u(A.getLocal(Lt),A.i64_const(32)))))}X<w&&(Q.addCode(A.setLocal("m"+X,A.i64_and(A.i64_mul(A.i64_and(A.getLocal(Lt),A.i64_const(4294967295)),A.getLocal("np32")),A.i64_const("0xFFFFFFFF")))),Q.addCode(A.setLocal(Lt,A.i64_add(A.i64_and(A.getLocal(Lt),A.i64_const(4294967295)),B(0,X)))),Q.addCode(A.setLocal(Gt,A.i64_add(A.getLocal(Gt),A.i64_shr_u(A.getLocal(Lt),A.i64_const(32)))))),X>=w&&Q.addCode(A.i64_store32(A.getLocal("r"),(X-w)*4,A.getLocal(Lt))),Q.addCode(A.setLocal(z,A.getLocal(Gt)),A.setLocal($,A.i64_shr_u(A.getLocal(z),A.i64_const(32))))}Q.addCode(A.i64_store32(A.getLocal("r"),w*4-4,A.getLocal(z))),Q.addCode(A.if(A.i32_wrap_i64(A.getLocal($)),A.drop(A.call(G+"_sub",A.getLocal("r"),A.i32_const(V),A.getLocal("r"))),A.if(A.call(G+"_gte",A.getLocal("r"),A.i32_const(V)),A.drop(A.call(G+"_sub",A.getLocal("r"),A.i32_const(V),A.getLocal("r"))))))}function mt(){const Q=u.addFunction(D+"_squareOld");Q.addParam("x","i32"),Q.addParam("r","i32");const A=Q.getCodeBuilder();Q.addCode(A.call(D+"_mul",A.getLocal("x"),A.getLocal("x"),A.getLocal("r")))}function xt(){const Q=u.addFunction(D+"_toMontgomery");Q.addParam("x","i32"),Q.addParam("r","i32");const A=Q.getCodeBuilder();Q.addCode(A.call(D+"_mul",A.getLocal("x"),A.i32_const(it),A.getLocal("r")))}function Pt(){const Q=u.alloc(O*2),A=u.addFunction(D+"_fromMontgomery");A.addParam("x","i32"),A.addParam("r","i32");const lt=A.getCodeBuilder();A.addCode(lt.call(G+"_copy",lt.getLocal("x"),lt.i32_const(Q))),A.addCode(lt.call(G+"_zero",lt.i32_const(Q+O))),A.addCode(lt.call(D+"_mReduct",lt.i32_const(Q),lt.getLocal("r")))}function zt(){const Q=u.addFunction(D+"_inverse");Q.addParam("x","i32"),Q.addParam("r","i32");const A=Q.getCodeBuilder();Q.addCode(A.call(D+"_fromMontgomery",A.getLocal("x"),A.getLocal("r"))),Q.addCode(A.call(G+"_inverseMod",A.getLocal("r"),A.i32_const(V),A.getLocal("r"))),Q.addCode(A.call(D+"_toMontgomery",A.getLocal("r"),A.getLocal("r")))}let Rt=t(2);if(b.isPrime())for(;!Rt.modPow(h,b).equals(M);)Rt=Rt.add(t.one);u.alloc(n.bigInt2BytesLE(Rt.shiftLeft(f*64).mod(b),O));let k=0,Ct=M;for(;!Ct.isOdd()&&!Ct.isZero();)k++,Ct=Ct.shiftRight(1);const St=u.alloc(O,n.bigInt2BytesLE(Ct,O)),F=Rt.modPow(Ct,b),o=u.alloc(n.bigInt2BytesLE(F.shiftLeft(f*64).mod(b),O)),L=Ct.add(1).shiftRight(1),U=u.alloc(O,n.bigInt2BytesLE(L,O));function p(){const Q=u.addFunction(D+"_sqrt");Q.addParam("n","i32"),Q.addParam("r","i32"),Q.addLocal("m","i32"),Q.addLocal("i","i32"),Q.addLocal("j","i32");const A=Q.getCodeBuilder(),lt=A.i32_const(Z),Ft=A.i32_const(u.alloc(O)),Ut=A.i32_const(u.alloc(O)),dt=A.i32_const(u.alloc(O)),B=A.i32_const(u.alloc(O)),Lt=A.i32_const(u.alloc(O));Q.addCode(A.if(A.call(D+"_isZero",A.getLocal("n")),A.ret(A.call(D+"_zero",A.getLocal("r")))),A.setLocal("m",A.i32_const(k)),A.call(D+"_copy",A.i32_const(o),Ft),A.call(D+"_exp",A.getLocal("n"),A.i32_const(St),A.i32_const(O),Ut),A.call(D+"_exp",A.getLocal("n"),A.i32_const(U),A.i32_const(O),dt),A.block(A.loop(A.br_if(1,A.call(D+"_eq",Ut,lt)),A.call(D+"_square",Ut,B),A.setLocal("i",A.i32_const(1)),A.block(A.loop(A.br_if(1,A.call(D+"_eq",B,lt)),A.call(D+"_square",B,B),A.setLocal("i",A.i32_add(A.getLocal("i"),A.i32_const(1))),A.br(0))),A.call(D+"_copy",Ft,Lt),A.setLocal("j",A.i32_sub(A.i32_sub(A.getLocal("m"),A.getLocal("i")),A.i32_const(1))),A.block(A.loop(A.br_if(1,A.i32_eqz(A.getLocal("j"))),A.call(D+"_square",Lt,Lt),A.setLocal("j",A.i32_sub(A.getLocal("j"),A.i32_const(1))),A.br(0))),A.setLocal("m",A.getLocal("i")),A.call(D+"_square",Lt,Ft),A.call(D+"_mul",Ut,Ft,Ut),A.call(D+"_mul",dt,Lt,dt),A.br(0))),A.if(A.call(D+"_isNegative",dt),A.call(D+"_neg",dt,A.getLocal("r")),A.call(D+"_copy",dt,A.getLocal("r"))))}function st(){const Q=u.addFunction(D+"_isSquare");Q.addParam("n","i32"),Q.setReturnType("i32");const A=Q.getCodeBuilder(),lt=A.i32_const(Z),Ft=A.i32_const(u.alloc(O));Q.addCode(A.if(A.call(D+"_isZero",A.getLocal("n")),A.ret(A.i32_const(1))),A.call(D+"_exp",A.getLocal("n"),A.i32_const(y),A.i32_const(O),Ft),A.call(D+"_eq",Ft,lt))}function qt(){const Q=u.addFunction(D+"_load");Q.addParam("scalar","i32"),Q.addParam("scalarLen","i32"),Q.addParam("r","i32"),Q.addLocal("p","i32"),Q.addLocal("l","i32"),Q.addLocal("i","i32"),Q.addLocal("j","i32");const A=Q.getCodeBuilder(),lt=A.i32_const(u.alloc(O)),Ft=u.alloc(O),Ut=A.i32_const(Ft);Q.addCode(A.call(G+"_zero",A.getLocal("r")),A.setLocal("i",A.i32_const(O)),A.setLocal("p",A.getLocal("scalar")),A.block(A.loop(A.br_if(1,A.i32_gt_u(A.getLocal("i"),A.getLocal("scalarLen"))),A.if(A.i32_eq(A.getLocal("i"),A.i32_const(O)),A.call(D+"_one",lt),A.call(D+"_mul",lt,A.i32_const(it),lt)),A.call(D+"_mul",A.getLocal("p"),lt,Ut),A.call(D+"_add",A.getLocal("r"),Ut,A.getLocal("r")),A.setLocal("p",A.i32_add(A.getLocal("p"),A.i32_const(O))),A.setLocal("i",A.i32_add(A.getLocal("i"),A.i32_const(O))),A.br(0))),A.setLocal("l",A.i32_rem_u(A.getLocal("scalarLen"),A.i32_const(O))),A.if(A.i32_eqz(A.getLocal("l")),A.ret([])),A.call(G+"_zero",Ut),A.setLocal("j",A.i32_const(0)),A.block(A.loop(A.br_if(1,A.i32_eq(A.getLocal("j"),A.getLocal("l"))),A.i32_store8(A.getLocal("j"),Ft,A.i32_load8_u(A.getLocal("p"))),A.setLocal("p",A.i32_add(A.getLocal("p"),A.i32_const(1))),A.setLocal("j",A.i32_add(A.getLocal("j"),A.i32_const(1))),A.br(0))),A.if(A.i32_eq(A.getLocal("i"),A.i32_const(O)),A.call(D+"_one",lt),A.call(D+"_mul",lt,A.i32_const(it),lt)),A.call(D+"_mul",Ut,lt,Ut),A.call(D+"_add",A.getLocal("r"),Ut,A.getLocal("r")))}function wt(){const Q=u.addFunction(D+"_timesScalar");Q.addParam("x","i32"),Q.addParam("scalar","i32"),Q.addParam("scalarLen","i32"),Q.addParam("r","i32");const A=Q.getCodeBuilder(),lt=A.i32_const(u.alloc(O));Q.addCode(A.call(D+"_load",A.getLocal("scalar"),A.getLocal("scalarLen"),lt),A.call(D+"_toMontgomery",lt,lt),A.call(D+"_mul",A.getLocal("x"),lt,A.getLocal("r")))}function nt(){const Q=u.addFunction(D+"_isOne");Q.addParam("x","i32"),Q.setReturnType("i32");const A=Q.getCodeBuilder();Q.addCode(A.ret(A.call(G+"_eq",A.getLocal("x"),A.i32_const(Z))))}return u.exportFunction(G+"_copy",D+"_copy"),u.exportFunction(G+"_zero",D+"_zero"),u.exportFunction(G+"_isZero",D+"_isZero"),u.exportFunction(G+"_eq",D+"_eq"),nt(),H(),T(),N(),S(),et(),_t(),mt(),xt(),Pt(),P(),v(),zt(),x(),qt(),wt(),c(u,D),i(u,D+"_batchToMontgomery",D+"_toMontgomery",O,O),i(u,D+"_batchFromMontgomery",D+"_fromMontgomery",O,O),i(u,D+"_batchNeg",D+"_neg",O,O),r(u,D+"_batchAdd",D+"_add",O,O),r(u,D+"_batchSub",D+"_sub",O,O),r(u,D+"_batchMul",D+"_mul",O,O),u.exportFunction(D+"_add"),u.exportFunction(D+"_sub"),u.exportFunction(D+"_neg"),u.exportFunction(D+"_isNegative"),u.exportFunction(D+"_isOne"),u.exportFunction(D+"_sign"),u.exportFunction(D+"_mReduct"),u.exportFunction(D+"_mul"),u.exportFunction(D+"_square"),u.exportFunction(D+"_squareOld"),u.exportFunction(D+"_fromMontgomery"),u.exportFunction(D+"_toMontgomery"),u.exportFunction(D+"_inverse"),u.exportFunction(D+"_one"),u.exportFunction(D+"_load"),u.exportFunction(D+"_timesScalar"),e(u,D+"_exp",O,D+"_mul",D+"_square",G+"_copy",D+"_one"),u.exportFunction(D+"_exp"),u.exportFunction(D+"_batchInverse"),b.isPrime()&&(p(),st(),u.exportFunction(D+"_sqrt"),u.exportFunction(D+"_isSquare")),u.exportFunction(D+"_batchToMontgomery"),u.exportFunction(D+"_batchFromMontgomery"),D},xe}var qe,Bl;function El(){if(Bl)return qe;Bl=1;const t=Gn(),a=Se();return qe=function(e,c,i,r,_){const u=t(c),l=Math.floor((u.minus(1).bitLength()-1)/64)+1,s=l*8,I=i||"f1";if(e.modules[I])return I;e.modules[I]={n64:l};const b=_||"int",f=a(e,u,r,b),w=e.modules[f].pR2,O=e.modules[f].pq,D=e.modules[f].pePlusOne;function G(){const E=e.alloc(s),M=e.addFunction(I+"_mul");M.addParam("x","i32"),M.addParam("y","i32"),M.addParam("r","i32");const h=M.getCodeBuilder();M.addCode(h.call(f+"_mul",h.getLocal("x"),h.getLocal("y"),h.i32_const(E))),M.addCode(h.call(f+"_mul",h.i32_const(E),h.i32_const(w),h.getLocal("r")))}function V(){const E=e.addFunction(I+"_square");E.addParam("x","i32"),E.addParam("r","i32");const M=E.getCodeBuilder();E.addCode(M.call(I+"_mul",M.getLocal("x"),M.getLocal("x"),M.getLocal("r")))}function it(){const E=e.addFunction(I+"_inverse");E.addParam("x","i32"),E.addParam("r","i32");const M=E.getCodeBuilder();E.addCode(M.call(b+"_inverseMod",M.getLocal("x"),M.i32_const(O),M.getLocal("r")))}function Z(){const E=e.addFunction(I+"_isNegative");E.addParam("x","i32"),E.setReturnType("i32");const M=E.getCodeBuilder();E.addCode(M.call(b+"_gte",M.getLocal("x"),M.i32_const(D)))}return G(),V(),it(),Z(),e.exportFunction(f+"_add",I+"_add"),e.exportFunction(f+"_sub",I+"_sub"),e.exportFunction(f+"_neg",I+"_neg"),e.exportFunction(I+"_mul"),e.exportFunction(I+"_square"),e.exportFunction(I+"_inverse"),e.exportFunction(I+"_isNegative"),e.exportFunction(f+"_copy",I+"_copy"),e.exportFunction(f+"_zero",I+"_zero"),e.exportFunction(f+"_one",I+"_one"),e.exportFunction(f+"_isZero",I+"_isZero"),e.exportFunction(f+"_eq",I+"_eq"),I},qe}var Pe,Fl;function xl(){if(Fl)return Pe;Fl=1;const t=we(),a=Be(),n=Gn(),e=Ea();return Pe=function(i,r,_,u){if(i.modules[_])return _;const l=i.modules[u].n64*8,s=i.modules[u].q;i.modules[_]={n64:i.modules[u].n64*2};function I(){const v=i.addFunction(_+"_add");v.addParam("x","i32"),v.addParam("y","i32"),v.addParam("r","i32");const S=v.getCodeBuilder(),et=S.getLocal("x"),_t=S.i32_add(S.getLocal("x"),S.i32_const(l)),mt=S.getLocal("y"),xt=S.i32_add(S.getLocal("y"),S.i32_const(l)),Pt=S.getLocal("r"),zt=S.i32_add(S.getLocal("r"),S.i32_const(l));v.addCode(S.call(u+"_add",et,mt,Pt),S.call(u+"_add",_t,xt,zt))}function b(){const v=i.addFunction(_+"_timesScalar");v.addParam("x","i32"),v.addParam("scalar","i32"),v.addParam("scalarLen","i32"),v.addParam("r","i32");const S=v.getCodeBuilder(),et=S.getLocal("x"),_t=S.i32_add(S.getLocal("x"),S.i32_const(l)),mt=S.getLocal("r"),xt=S.i32_add(S.getLocal("r"),S.i32_const(l));v.addCode(S.call(u+"_timesScalar",et,S.getLocal("scalar"),S.getLocal("scalarLen"),mt),S.call(u+"_timesScalar",_t,S.getLocal("scalar"),S.getLocal("scalarLen"),xt))}function f(){const v=i.addFunction(_+"_sub");v.addParam("x","i32"),v.addParam("y","i32"),v.addParam("r","i32");const S=v.getCodeBuilder(),et=S.getLocal("x"),_t=S.i32_add(S.getLocal("x"),S.i32_const(l)),mt=S.getLocal("y"),xt=S.i32_add(S.getLocal("y"),S.i32_const(l)),Pt=S.getLocal("r"),zt=S.i32_add(S.getLocal("r"),S.i32_const(l));v.addCode(S.call(u+"_sub",et,mt,Pt),S.call(u+"_sub",_t,xt,zt))}function w(){const v=i.addFunction(_+"_neg");v.addParam("x","i32"),v.addParam("r","i32");const S=v.getCodeBuilder(),et=S.getLocal("x"),_t=S.i32_add(S.getLocal("x"),S.i32_const(l)),mt=S.getLocal("r"),xt=S.i32_add(S.getLocal("r"),S.i32_const(l));v.addCode(S.call(u+"_neg",et,mt),S.call(u+"_neg",_t,xt))}function O(){const v=i.addFunction(_+"_conjugate");v.addParam("x","i32"),v.addParam("r","i32");const S=v.getCodeBuilder(),et=S.getLocal("x"),_t=S.i32_add(S.getLocal("x"),S.i32_const(l)),mt=S.getLocal("r"),xt=S.i32_add(S.getLocal("r"),S.i32_const(l));v.addCode(S.call(u+"_copy",et,mt),S.call(u+"_neg",_t,xt))}function D(){const v=i.addFunction(_+"_isNegative");v.addParam("x","i32"),v.setReturnType("i32");const S=v.getCodeBuilder(),et=S.getLocal("x"),_t=S.i32_add(S.getLocal("x"),S.i32_const(l));v.addCode(S.if(S.call(u+"_isZero",_t),S.ret(S.call(u+"_isNegative",et))),S.ret(S.call(u+"_isNegative",_t)))}function G(){const v=i.addFunction(_+"_mul");v.addParam("x","i32"),v.addParam("y","i32"),v.addParam("r","i32");const S=v.getCodeBuilder(),et=S.getLocal("x"),_t=S.i32_add(S.getLocal("x"),S.i32_const(l)),mt=S.getLocal("y"),xt=S.i32_add(S.getLocal("y"),S.i32_const(l)),Pt=S.getLocal("r"),zt=S.i32_add(S.getLocal("r"),S.i32_const(l)),Rt=S.i32_const(i.alloc(l)),k=S.i32_const(i.alloc(l)),Ct=S.i32_const(i.alloc(l)),St=S.i32_const(i.alloc(l));v.addCode(S.call(u+"_mul",et,mt,Rt),S.call(u+"_mul",_t,xt,k),S.call(u+"_add",et,_t,Ct),S.call(u+"_add",mt,xt,St),S.call(u+"_mul",Ct,St,Ct),S.call(r,k,Pt),S.call(u+"_add",Rt,Pt,Pt),S.call(u+"_add",Rt,k,zt),S.call(u+"_sub",Ct,zt,zt))}function V(){const v=i.addFunction(_+"_mul1");v.addParam("x","i32"),v.addParam("y","i32"),v.addParam("r","i32");const S=v.getCodeBuilder(),et=S.getLocal("x"),_t=S.i32_add(S.getLocal("x"),S.i32_const(l)),mt=S.getLocal("y"),xt=S.getLocal("r"),Pt=S.i32_add(S.getLocal("r"),S.i32_const(l));v.addCode(S.call(u+"_mul",et,mt,xt),S.call(u+"_mul",_t,mt,Pt))}function it(){const v=i.addFunction(_+"_square");v.addParam("x","i32"),v.addParam("r","i32");const S=v.getCodeBuilder(),et=S.getLocal("x"),_t=S.i32_add(S.getLocal("x"),S.i32_const(l)),mt=S.getLocal("r"),xt=S.i32_add(S.getLocal("r"),S.i32_const(l)),Pt=S.i32_const(i.alloc(l)),zt=S.i32_const(i.alloc(l)),Rt=S.i32_const(i.alloc(l)),k=S.i32_const(i.alloc(l));v.addCode(S.call(u+"_mul",et,_t,Pt),S.call(u+"_add",et,_t,zt),S.call(r,_t,Rt),S.call(u+"_add",et,Rt,Rt),S.call(r,Pt,k),S.call(u+"_add",k,Pt,k),S.call(u+"_mul",zt,Rt,mt),S.call(u+"_sub",mt,k,mt),S.call(u+"_add",Pt,Pt,xt))}function Z(){const v=i.addFunction(_+"_toMontgomery");v.addParam("x","i32"),v.addParam("r","i32");const S=v.getCodeBuilder(),et=S.getLocal("x"),_t=S.i32_add(S.getLocal("x"),S.i32_const(l)),mt=S.getLocal("r"),xt=S.i32_add(S.getLocal("r"),S.i32_const(l));v.addCode(S.call(u+"_toMontgomery",et,mt),S.call(u+"_toMontgomery",_t,xt))}function E(){const v=i.addFunction(_+"_fromMontgomery");v.addParam("x","i32"),v.addParam("r","i32");const S=v.getCodeBuilder(),et=S.getLocal("x"),_t=S.i32_add(S.getLocal("x"),S.i32_const(l)),mt=S.getLocal("r"),xt=S.i32_add(S.getLocal("r"),S.i32_const(l));v.addCode(S.call(u+"_fromMontgomery",et,mt),S.call(u+"_fromMontgomery",_t,xt))}function M(){const v=i.addFunction(_+"_copy");v.addParam("x","i32"),v.addParam("r","i32");const S=v.getCodeBuilder(),et=S.getLocal("x"),_t=S.i32_add(S.getLocal("x"),S.i32_const(l)),mt=S.getLocal("r"),xt=S.i32_add(S.getLocal("r"),S.i32_const(l));v.addCode(S.call(u+"_copy",et,mt),S.call(u+"_copy",_t,xt))}function h(){const v=i.addFunction(_+"_zero");v.addParam("x","i32");const S=v.getCodeBuilder(),et=S.getLocal("x"),_t=S.i32_add(S.getLocal("x"),S.i32_const(l));v.addCode(S.call(u+"_zero",et),S.call(u+"_zero",_t))}function y(){const v=i.addFunction(_+"_one");v.addParam("x","i32");const S=v.getCodeBuilder(),et=S.getLocal("x"),_t=S.i32_add(S.getLocal("x"),S.i32_const(l));v.addCode(S.call(u+"_one",et),S.call(u+"_zero",_t))}function q(){const v=i.addFunction(_+"_eq");v.addParam("x","i32"),v.addParam("y","i32"),v.setReturnType("i32");const S=v.getCodeBuilder(),et=S.getLocal("x"),_t=S.i32_add(S.getLocal("x"),S.i32_const(l)),mt=S.getLocal("y"),xt=S.i32_add(S.getLocal("y"),S.i32_const(l));v.addCode(S.i32_and(S.call(u+"_eq",et,mt),S.call(u+"_eq",_t,xt)))}function g(){const v=i.addFunction(_+"_isZero");v.addParam("x","i32"),v.setReturnType("i32");const S=v.getCodeBuilder(),et=S.getLocal("x"),_t=S.i32_add(S.getLocal("x"),S.i32_const(l));v.addCode(S.i32_and(S.call(u+"_isZero",et),S.call(u+"_isZero",_t)))}function x(){const v=i.addFunction(_+"_inverse");v.addParam("x","i32"),v.addParam("r","i32");const S=v.getCodeBuilder(),et=S.getLocal("x"),_t=S.i32_add(S.getLocal("x"),S.i32_const(l)),mt=S.getLocal("r"),xt=S.i32_add(S.getLocal("r"),S.i32_const(l)),Pt=S.i32_const(i.alloc(l)),zt=S.i32_const(i.alloc(l)),Rt=S.i32_const(i.alloc(l)),k=S.i32_const(i.alloc(l));v.addCode(S.call(u+"_square",et,Pt),S.call(u+"_square",_t,zt),S.call(r,zt,Rt),S.call(u+"_sub",Pt,Rt,Rt),S.call(u+"_inverse",Rt,k),S.call(u+"_mul",et,k,mt),S.call(u+"_mul",_t,k,xt),S.call(u+"_neg",xt,xt))}function H(){const v=i.addFunction(_+"_sign");v.addParam("x","i32"),v.addLocal("s","i32"),v.setReturnType("i32");const S=v.getCodeBuilder(),et=S.getLocal("x"),_t=S.i32_add(S.getLocal("x"),S.i32_const(l));v.addCode(S.setLocal("s",S.call(u+"_sign",_t)),S.if(S.getLocal("s"),S.ret(S.getLocal("s"))),S.ret(S.call(u+"_sign",et)))}function T(){const v=i.addFunction(_+"_isOne");v.addParam("x","i32"),v.setReturnType("i32");const S=v.getCodeBuilder(),et=S.getLocal("x"),_t=S.i32_add(S.getLocal("x"),S.i32_const(l));v.addCode(S.ret(S.i32_and(S.call(u+"_isOne",et),S.call(u+"_isZero",_t))))}function N(){const v=i.addFunction(_+"_sqrt");v.addParam("a","i32"),v.addParam("pr","i32");const S=v.getCodeBuilder(),et=S.i32_const(i.alloc(e.bigInt2BytesLE(n(s).minus(n(3)).divide(4),l))),_t=S.i32_const(i.alloc(e.bigInt2BytesLE(n(s).minus(n(1)).divide(2),l))),mt=S.getLocal("a"),xt=S.i32_const(i.alloc(l*2)),Pt=S.i32_const(i.alloc(l*2)),zt=S.i32_const(i.alloc(l*2)),Rt=i.alloc(l*2),k=S.i32_const(Rt),Ct=S.i32_const(Rt),St=S.i32_const(Rt+l),F=S.i32_const(i.alloc(l*2)),o=S.i32_const(i.alloc(l*2));v.addCode(S.call(_+"_one",k),S.call(_+"_neg",k,k),S.call(_+"_exp",mt,et,S.i32_const(l),xt),S.call(_+"_square",xt,Pt),S.call(_+"_mul",mt,Pt,Pt),S.call(_+"_conjugate",Pt,zt),S.call(_+"_mul",zt,Pt,zt),S.if(S.call(_+"_eq",zt,k),S.unreachable()),S.call(_+"_mul",xt,mt,F),S.if(S.call(_+"_eq",Pt,k),[...S.call(u+"_zero",Ct),...S.call(u+"_one",St),...S.call(_+"_mul",k,F,S.getLocal("pr"))],[...S.call(_+"_one",o),...S.call(_+"_add",o,Pt,o),...S.call(_+"_exp",o,_t,S.i32_const(l),o),...S.call(_+"_mul",o,F,S.getLocal("pr"))]))}function P(){const v=i.addFunction(_+"_isSquare");v.addParam("a","i32"),v.setReturnType("i32");const S=v.getCodeBuilder(),et=S.i32_const(i.alloc(e.bigInt2BytesLE(n(s).minus(n(3)).divide(4),l))),_t=S.getLocal("a"),mt=S.i32_const(i.alloc(l*2)),xt=S.i32_const(i.alloc(l*2)),Pt=S.i32_const(i.alloc(l*2)),zt=i.alloc(l*2),Rt=S.i32_const(zt);v.addCode(S.call(_+"_one",Rt),S.call(_+"_neg",Rt,Rt),S.call(_+"_exp",_t,et,S.i32_const(l),mt),S.call(_+"_square",mt,xt),S.call(_+"_mul",_t,xt,xt),S.call(_+"_conjugate",xt,Pt),S.call(_+"_mul",Pt,xt,Pt),S.if(S.call(_+"_eq",Pt,Rt),S.ret(S.i32_const(0))),S.ret(S.i32_const(1)))}return g(),T(),h(),y(),M(),G(),V(),it(),I(),f(),w(),O(),Z(),E(),q(),x(),b(),H(),D(),i.exportFunction(_+"_isZero"),i.exportFunction(_+"_isOne"),i.exportFunction(_+"_zero"),i.exportFunction(_+"_one"),i.exportFunction(_+"_copy"),i.exportFunction(_+"_mul"),i.exportFunction(_+"_mul1"),i.exportFunction(_+"_square"),i.exportFunction(_+"_add"),i.exportFunction(_+"_sub"),i.exportFunction(_+"_neg"),i.exportFunction(_+"_sign"),i.exportFunction(_+"_conjugate"),i.exportFunction(_+"_fromMontgomery"),i.exportFunction(_+"_toMontgomery"),i.exportFunction(_+"_eq"),i.exportFunction(_+"_inverse"),a(i,_),t(i,_+"_exp",l*2,_+"_mul",_+"_square",_+"_copy",_+"_one"),N(),P(),i.exportFunction(_+"_exp"),i.exportFunction(_+"_timesScalar"),i.exportFunction(_+"_batchInverse"),i.exportFunction(_+"_sqrt"),i.exportFunction(_+"_isSquare"),i.exportFunction(_+"_isNegative"),_},Pe}var Oe,Sl;function ql(){if(Sl)return Oe;Sl=1;const t=we(),a=Be();return Oe=function(e,c,i,r){if(e.modules[i])return i;const _=e.modules[r].n64*8;e.modules[i]={n64:e.modules[r].n64*3};function u(){const q=e.addFunction(i+"_add");q.addParam("x","i32"),q.addParam("y","i32"),q.addParam("r","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("y"),P=g.i32_add(g.getLocal("y"),g.i32_const(_)),v=g.i32_add(g.getLocal("y"),g.i32_const(2*_)),S=g.getLocal("r"),et=g.i32_add(g.getLocal("r"),g.i32_const(_)),_t=g.i32_add(g.getLocal("r"),g.i32_const(2*_));q.addCode(g.call(r+"_add",x,N,S),g.call(r+"_add",H,P,et),g.call(r+"_add",T,v,_t))}function l(){const q=e.addFunction(i+"_timesScalar");q.addParam("x","i32"),q.addParam("scalar","i32"),q.addParam("scalarLen","i32"),q.addParam("r","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("r"),P=g.i32_add(g.getLocal("r"),g.i32_const(_)),v=g.i32_add(g.getLocal("r"),g.i32_const(2*_));q.addCode(g.call(r+"_timesScalar",x,g.getLocal("scalar"),g.getLocal("scalarLen"),N),g.call(r+"_timesScalar",H,g.getLocal("scalar"),g.getLocal("scalarLen"),P),g.call(r+"_timesScalar",T,g.getLocal("scalar"),g.getLocal("scalarLen"),v))}function s(){const q=e.addFunction(i+"_sub");q.addParam("x","i32"),q.addParam("y","i32"),q.addParam("r","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("y"),P=g.i32_add(g.getLocal("y"),g.i32_const(_)),v=g.i32_add(g.getLocal("y"),g.i32_const(2*_)),S=g.getLocal("r"),et=g.i32_add(g.getLocal("r"),g.i32_const(_)),_t=g.i32_add(g.getLocal("r"),g.i32_const(2*_));q.addCode(g.call(r+"_sub",x,N,S),g.call(r+"_sub",H,P,et),g.call(r+"_sub",T,v,_t))}function I(){const q=e.addFunction(i+"_neg");q.addParam("x","i32"),q.addParam("r","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("r"),P=g.i32_add(g.getLocal("r"),g.i32_const(_)),v=g.i32_add(g.getLocal("r"),g.i32_const(2*_));q.addCode(g.call(r+"_neg",x,N),g.call(r+"_neg",H,P),g.call(r+"_neg",T,v))}function b(){const q=e.addFunction(i+"_isNegative");q.addParam("x","i32"),q.setReturnType("i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_));q.addCode(g.if(g.call(r+"_isZero",T),g.if(g.call(r+"_isZero",H),g.ret(g.call(r+"_isNegative",x)),g.ret(g.call(r+"_isNegative",H)))),g.ret(g.call(r+"_isNegative",T)))}function f(){const q=e.addFunction(i+"_mul");q.addParam("x","i32"),q.addParam("y","i32"),q.addParam("r","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("y"),P=g.i32_add(g.getLocal("y"),g.i32_const(_)),v=g.i32_add(g.getLocal("y"),g.i32_const(2*_)),S=g.getLocal("r"),et=g.i32_add(g.getLocal("r"),g.i32_const(_)),_t=g.i32_add(g.getLocal("r"),g.i32_const(2*_)),mt=g.i32_const(e.alloc(_)),xt=g.i32_const(e.alloc(_)),Pt=g.i32_const(e.alloc(_)),zt=g.i32_const(e.alloc(_)),Rt=g.i32_const(e.alloc(_)),k=g.i32_const(e.alloc(_)),Ct=g.i32_const(e.alloc(_)),St=g.i32_const(e.alloc(_)),F=g.i32_const(e.alloc(_)),o=g.i32_const(e.alloc(_)),L=g.i32_const(e.alloc(_)),U=g.i32_const(e.alloc(_)),p=g.i32_const(e.alloc(_));q.addCode(g.call(r+"_mul",x,N,mt),g.call(r+"_mul",H,P,xt),g.call(r+"_mul",T,v,Pt),g.call(r+"_add",x,H,zt),g.call(r+"_add",N,P,Rt),g.call(r+"_add",x,T,k),g.call(r+"_add",N,v,Ct),g.call(r+"_add",H,T,St),g.call(r+"_add",P,v,F),g.call(r+"_add",mt,xt,o),g.call(r+"_add",mt,Pt,L),g.call(r+"_add",xt,Pt,U),g.call(r+"_mul",St,F,S),g.call(r+"_sub",S,U,S),g.call(c,S,S),g.call(r+"_add",mt,S,S),g.call(r+"_mul",zt,Rt,et),g.call(r+"_sub",et,o,et),g.call(c,Pt,p),g.call(r+"_add",et,p,et),g.call(r+"_mul",k,Ct,_t),g.call(r+"_sub",_t,L,_t),g.call(r+"_add",_t,xt,_t))}function w(){const q=e.addFunction(i+"_square");q.addParam("x","i32"),q.addParam("r","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("r"),P=g.i32_add(g.getLocal("r"),g.i32_const(_)),v=g.i32_add(g.getLocal("r"),g.i32_const(2*_)),S=g.i32_const(e.alloc(_)),et=g.i32_const(e.alloc(_)),_t=g.i32_const(e.alloc(_)),mt=g.i32_const(e.alloc(_)),xt=g.i32_const(e.alloc(_)),Pt=g.i32_const(e.alloc(_)),zt=g.i32_const(e.alloc(_));q.addCode(g.call(r+"_square",x,S),g.call(r+"_mul",x,H,et),g.call(r+"_add",et,et,_t),g.call(r+"_sub",x,H,mt),g.call(r+"_add",mt,T,mt),g.call(r+"_square",mt,mt),g.call(r+"_mul",H,T,xt),g.call(r+"_add",xt,xt,Pt),g.call(r+"_square",T,zt),g.call(c,Pt,N),g.call(r+"_add",S,N,N),g.call(c,zt,P),g.call(r+"_add",_t,P,P),g.call(r+"_add",S,zt,v),g.call(r+"_sub",Pt,v,v),g.call(r+"_add",mt,v,v),g.call(r+"_add",_t,v,v))}function O(){const q=e.addFunction(i+"_toMontgomery");q.addParam("x","i32"),q.addParam("r","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("r"),P=g.i32_add(g.getLocal("r"),g.i32_const(_)),v=g.i32_add(g.getLocal("r"),g.i32_const(2*_));q.addCode(g.call(r+"_toMontgomery",x,N),g.call(r+"_toMontgomery",H,P),g.call(r+"_toMontgomery",T,v))}function D(){const q=e.addFunction(i+"_fromMontgomery");q.addParam("x","i32"),q.addParam("r","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("r"),P=g.i32_add(g.getLocal("r"),g.i32_const(_)),v=g.i32_add(g.getLocal("r"),g.i32_const(2*_));q.addCode(g.call(r+"_fromMontgomery",x,N),g.call(r+"_fromMontgomery",H,P),g.call(r+"_fromMontgomery",T,v))}function G(){const q=e.addFunction(i+"_copy");q.addParam("x","i32"),q.addParam("r","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("r"),P=g.i32_add(g.getLocal("r"),g.i32_const(_)),v=g.i32_add(g.getLocal("r"),g.i32_const(2*_));q.addCode(g.call(r+"_copy",x,N),g.call(r+"_copy",H,P),g.call(r+"_copy",T,v))}function V(){const q=e.addFunction(i+"_zero");q.addParam("x","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_));q.addCode(g.call(r+"_zero",x),g.call(r+"_zero",H),g.call(r+"_zero",T))}function it(){const q=e.addFunction(i+"_one");q.addParam("x","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_));q.addCode(g.call(r+"_one",x),g.call(r+"_zero",H),g.call(r+"_zero",T))}function Z(){const q=e.addFunction(i+"_eq");q.addParam("x","i32"),q.addParam("y","i32"),q.setReturnType("i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("y"),P=g.i32_add(g.getLocal("y"),g.i32_const(_)),v=g.i32_add(g.getLocal("y"),g.i32_const(2*_));q.addCode(g.i32_and(g.i32_and(g.call(r+"_eq",x,N),g.call(r+"_eq",H,P)),g.call(r+"_eq",T,v)))}function E(){const q=e.addFunction(i+"_isZero");q.addParam("x","i32"),q.setReturnType("i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_));q.addCode(g.i32_and(g.i32_and(g.call(r+"_isZero",x),g.call(r+"_isZero",H)),g.call(r+"_isZero",T)))}function M(){const q=e.addFunction(i+"_inverse");q.addParam("x","i32"),q.addParam("r","i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_)),N=g.getLocal("r"),P=g.i32_add(g.getLocal("r"),g.i32_const(_)),v=g.i32_add(g.getLocal("r"),g.i32_const(2*_)),S=g.i32_const(e.alloc(_)),et=g.i32_const(e.alloc(_)),_t=g.i32_const(e.alloc(_)),mt=g.i32_const(e.alloc(_)),xt=g.i32_const(e.alloc(_)),Pt=g.i32_const(e.alloc(_)),zt=g.i32_const(e.alloc(_)),Rt=g.i32_const(e.alloc(_)),k=g.i32_const(e.alloc(_)),Ct=g.i32_const(e.alloc(_)),St=g.i32_const(e.alloc(_));q.addCode(g.call(r+"_square",x,S),g.call(r+"_square",H,et),g.call(r+"_square",T,_t),g.call(r+"_mul",x,H,mt),g.call(r+"_mul",x,T,xt),g.call(r+"_mul",H,T,Pt),g.call(c,Pt,zt),g.call(r+"_sub",S,zt,zt),g.call(c,_t,Rt),g.call(r+"_sub",Rt,mt,Rt),g.call(r+"_sub",et,xt,k),g.call(r+"_mul",T,Rt,Ct),g.call(r+"_mul",H,k,St),g.call(r+"_add",Ct,St,Ct),g.call(c,Ct,Ct),g.call(r+"_mul",x,zt,St),g.call(r+"_add",St,Ct,Ct),g.call(r+"_inverse",Ct,Ct),g.call(r+"_mul",Ct,zt,N),g.call(r+"_mul",Ct,Rt,P),g.call(r+"_mul",Ct,k,v))}function h(){const q=e.addFunction(i+"_sign");q.addParam("x","i32"),q.addLocal("s","i32"),q.setReturnType("i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(2*_));q.addCode(g.setLocal("s",g.call(r+"_sign",T)),g.if(g.getLocal("s"),g.ret(g.getLocal("s"))),g.setLocal("s",g.call(r+"_sign",H)),g.if(g.getLocal("s"),g.ret(g.getLocal("s"))),g.ret(g.call(r+"_sign",x)))}function y(){const q=e.addFunction(i+"_isOne");q.addParam("x","i32"),q.setReturnType("i32");const g=q.getCodeBuilder(),x=g.getLocal("x"),H=g.i32_add(g.getLocal("x"),g.i32_const(_)),T=g.i32_add(g.getLocal("x"),g.i32_const(_*2));q.addCode(g.ret(g.i32_and(g.i32_and(g.call(r+"_isOne",x),g.call(r+"_isZero",H)),g.call(r+"_isZero",T))))}return E(),y(),V(),it(),G(),f(),w(),u(),s(),I(),h(),O(),D(),Z(),M(),l(),b(),e.exportFunction(i+"_isZero"),e.exportFunction(i+"_isOne"),e.exportFunction(i+"_zero"),e.exportFunction(i+"_one"),e.exportFunction(i+"_copy"),e.exportFunction(i+"_mul"),e.exportFunction(i+"_square"),e.exportFunction(i+"_add"),e.exportFunction(i+"_sub"),e.exportFunction(i+"_neg"),e.exportFunction(i+"_sign"),e.exportFunction(i+"_fromMontgomery"),e.exportFunction(i+"_toMontgomery"),e.exportFunction(i+"_eq"),e.exportFunction(i+"_inverse"),a(e,i),t(e,i+"_exp",_*3,i+"_mul",i+"_square",i+"_copy",i+"_one"),e.exportFunction(i+"_exp"),e.exportFunction(i+"_timesScalar"),e.exportFunction(i+"_batchInverse"),e.exportFunction(i+"_isNegative"),i},Oe}var Me,Pl;function Lu(){return Pl||(Pl=1,Me=function(a,n,e,c,i,r,_,u){const l=a.addFunction(n);l.addParam("base","i32"),l.addParam("scalar","i32"),l.addParam("scalarLength","i32"),l.addParam("r","i32"),l.addLocal("old0","i32"),l.addLocal("nbits","i32"),l.addLocal("i","i32"),l.addLocal("last","i32"),l.addLocal("cur","i32"),l.addLocal("carry","i32"),l.addLocal("p","i32");const s=l.getCodeBuilder(),I=s.i32_const(a.alloc(e));function b(w){return s.i32_and(s.i32_shr_u(s.i32_load(s.i32_add(s.getLocal("scalar"),s.i32_and(s.i32_shr_u(w,s.i32_const(3)),s.i32_const(4294967292)))),s.i32_and(w,s.i32_const(31))),s.i32_const(1))}function f(w){return[...s.i32_store8(s.getLocal("p"),s.i32_const(w)),...s.setLocal("p",s.i32_add(s.getLocal("p"),s.i32_const(1)))]}l.addCode(s.if(s.i32_eqz(s.getLocal("scalarLength")),[...s.call(u,s.getLocal("r")),...s.ret([])]),s.setLocal("nbits",s.i32_shl(s.getLocal("scalarLength"),s.i32_const(3))),s.setLocal("old0",s.i32_load(s.i32_const(0))),s.setLocal("p",s.getLocal("old0")),s.i32_store(s.i32_const(0),s.i32_and(s.i32_add(s.i32_add(s.getLocal("old0"),s.i32_const(32)),s.getLocal("nbits")),s.i32_const(4294967288))),s.setLocal("i",s.i32_const(1)),s.setLocal("last",b(s.i32_const(0))),s.setLocal("carry",s.i32_const(0)),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal("i"),s.getLocal("nbits"))),s.setLocal("cur",b(s.getLocal("i"))),s.if(s.getLocal("last"),s.if(s.getLocal("cur"),s.if(s.getLocal("carry"),[...s.setLocal("last",s.i32_const(0)),...s.setLocal("carry",s.i32_const(1)),...f(1)],[...s.setLocal("last",s.i32_const(0)),...s.setLocal("carry",s.i32_const(1)),...f(255)]),s.if(s.getLocal("carry"),[...s.setLocal("last",s.i32_const(0)),...s.setLocal("carry",s.i32_const(1)),...f(255)],[...s.setLocal("last",s.i32_const(0)),...s.setLocal("carry",s.i32_const(0)),...f(1)])),s.if(s.getLocal("cur"),s.if(s.getLocal("carry"),[...s.setLocal("last",s.i32_const(0)),...s.setLocal("carry",s.i32_const(1)),...f(0)],[...s.setLocal("last",s.i32_const(1)),...s.setLocal("carry",s.i32_const(0)),...f(0)]),s.if(s.getLocal("carry"),[...s.setLocal("last",s.i32_const(1)),...s.setLocal("carry",s.i32_const(0)),...f(0)],[...s.setLocal("last",s.i32_const(0)),...s.setLocal("carry",s.i32_const(0)),...f(0)]))),s.setLocal("i",s.i32_add(s.getLocal("i"),s.i32_const(1))),s.br(0))),s.if(s.getLocal("last"),s.if(s.getLocal("carry"),[...f(255),...f(0),...f(1)],[...f(1)]),s.if(s.getLocal("carry"),[...f(0),...f(1)])),s.setLocal("p",s.i32_sub(s.getLocal("p"),s.i32_const(1))),s.call(_,s.getLocal("base"),I),s.call(u,s.getLocal("r")),s.block(s.loop(s.call(i,s.getLocal("r"),s.getLocal("r")),s.setLocal("cur",s.i32_load8_u(s.getLocal("p"))),s.if(s.getLocal("cur"),s.if(s.i32_eq(s.getLocal("cur"),s.i32_const(1)),s.call(c,s.getLocal("r"),I,s.getLocal("r")),s.call(r,s.getLocal("r"),I,s.getLocal("r")))),s.br_if(1,s.i32_eq(s.getLocal("old0"),s.getLocal("p"))),s.setLocal("p",s.i32_sub(s.getLocal("p"),s.i32_const(1))),s.br(0))),s.i32_store(s.i32_const(0),s.getLocal("old0")))}),Me}var ze,Ol;function pu(){return Ol||(Ol=1,ze=function(a,n,e,c,i){const _=a.modules[n].n64*8;function u(){const b=a.addFunction(e+"_getChunk");b.addParam("pScalar","i32"),b.addParam("scalarSize","i32"),b.addParam("startBit","i32"),b.addParam("chunkSize","i32"),b.addLocal("bitsToEnd","i32"),b.addLocal("mask","i32"),b.setReturnType("i32");const f=b.getCodeBuilder();b.addCode(f.setLocal("bitsToEnd",f.i32_sub(f.i32_mul(f.getLocal("scalarSize"),f.i32_const(8)),f.getLocal("startBit"))),f.if(f.i32_gt_s(f.getLocal("chunkSize"),f.getLocal("bitsToEnd")),f.setLocal("mask",f.i32_sub(f.i32_shl(f.i32_const(1),f.getLocal("bitsToEnd")),f.i32_const(1))),f.setLocal("mask",f.i32_sub(f.i32_shl(f.i32_const(1),f.getLocal("chunkSize")),f.i32_const(1)))),f.i32_and(f.i32_shr_u(f.i32_load(f.i32_add(f.getLocal("pScalar"),f.i32_shr_u(f.getLocal("startBit"),f.i32_const(3))),0,0),f.i32_and(f.getLocal("startBit"),f.i32_const(7))),f.getLocal("mask")))}function l(){const b=a.addFunction(e+"_chunk");b.addParam("pBases","i32"),b.addParam("pScalars","i32"),b.addParam("scalarSize","i32"),b.addParam("n","i32"),b.addParam("startBit","i32"),b.addParam("chunkSize","i32"),b.addParam("pr","i32"),b.addLocal("nChunks","i32"),b.addLocal("itScalar","i32"),b.addLocal("endScalar","i32"),b.addLocal("itBase","i32"),b.addLocal("i","i32"),b.addLocal("j","i32"),b.addLocal("nTable","i32"),b.addLocal("pTable","i32"),b.addLocal("idx","i32"),b.addLocal("pIdxTable","i32");const f=b.getCodeBuilder();b.addCode(f.if(f.i32_eqz(f.getLocal("n")),[...f.call(n+"_zero",f.getLocal("pr")),...f.ret([])]),f.setLocal("nTable",f.i32_shl(f.i32_const(1),f.getLocal("chunkSize"))),f.setLocal("pTable",f.i32_load(f.i32_const(0))),f.i32_store(f.i32_const(0),f.i32_add(f.getLocal("pTable"),f.i32_mul(f.getLocal("nTable"),f.i32_const(_)))),f.setLocal("j",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal("j"),f.getLocal("nTable"))),f.call(n+"_zero",f.i32_add(f.getLocal("pTable"),f.i32_mul(f.getLocal("j"),f.i32_const(_)))),f.setLocal("j",f.i32_add(f.getLocal("j"),f.i32_const(1))),f.br(0))),f.setLocal("itBase",f.getLocal("pBases")),f.setLocal("itScalar",f.getLocal("pScalars")),f.setLocal("endScalar",f.i32_add(f.getLocal("pScalars"),f.i32_mul(f.getLocal("n"),f.getLocal("scalarSize")))),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal("itScalar"),f.getLocal("endScalar"))),f.setLocal("idx",f.call(e+"_getChunk",f.getLocal("itScalar"),f.getLocal("scalarSize"),f.getLocal("startBit"),f.getLocal("chunkSize"))),f.if(f.getLocal("idx"),[...f.setLocal("pIdxTable",f.i32_add(f.getLocal("pTable"),f.i32_mul(f.i32_sub(f.getLocal("idx"),f.i32_const(1)),f.i32_const(_)))),...f.call(c,f.getLocal("pIdxTable"),f.getLocal("itBase"),f.getLocal("pIdxTable"))]),f.setLocal("itScalar",f.i32_add(f.getLocal("itScalar"),f.getLocal("scalarSize"))),f.setLocal("itBase",f.i32_add(f.getLocal("itBase"),f.i32_const(i))),f.br(0))),f.call(e+"_reduceTable",f.getLocal("pTable"),f.getLocal("chunkSize")),f.call(n+"_copy",f.getLocal("pTable"),f.getLocal("pr")),f.i32_store(f.i32_const(0),f.getLocal("pTable")))}function s(){const b=a.addFunction(e);b.addParam("pBases","i32"),b.addParam("pScalars","i32"),b.addParam("scalarSize","i32"),b.addParam("n","i32"),b.addParam("pr","i32"),b.addLocal("chunkSize","i32"),b.addLocal("nChunks","i32"),b.addLocal("itScalar","i32"),b.addLocal("endScalar","i32"),b.addLocal("itBase","i32"),b.addLocal("itBit","i32"),b.addLocal("i","i32"),b.addLocal("j","i32"),b.addLocal("nTable","i32"),b.addLocal("pTable","i32"),b.addLocal("idx","i32"),b.addLocal("pIdxTable","i32");const f=b.getCodeBuilder(),w=f.i32_const(a.alloc(_)),O=a.alloc([17,17,17,17,17,17,17,17,17,17,16,16,15,14,13,13,12,11,10,9,8,7,7,6,5,4,3,2,1,1,1,1]);b.addCode(f.call(n+"_zero",f.getLocal("pr")),f.if(f.i32_eqz(f.getLocal("n")),f.ret([])),f.setLocal("chunkSize",f.i32_load8_u(f.i32_clz(f.getLocal("n")),O)),f.setLocal("nChunks",f.i32_add(f.i32_div_u(f.i32_sub(f.i32_shl(f.getLocal("scalarSize"),f.i32_const(3)),f.i32_const(1)),f.getLocal("chunkSize")),f.i32_const(1))),f.setLocal("itBit",f.i32_mul(f.i32_sub(f.getLocal("nChunks"),f.i32_const(1)),f.getLocal("chunkSize"))),f.block(f.loop(f.br_if(1,f.i32_lt_s(f.getLocal("itBit"),f.i32_const(0))),f.if(f.i32_eqz(f.call(n+"_isZero",f.getLocal("pr"))),[...f.setLocal("j",f.i32_const(0)),...f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal("j"),f.getLocal("chunkSize"))),f.call(n+"_double",f.getLocal("pr"),f.getLocal("pr")),f.setLocal("j",f.i32_add(f.getLocal("j"),f.i32_const(1))),f.br(0)))]),f.call(e+"_chunk",f.getLocal("pBases"),f.getLocal("pScalars"),f.getLocal("scalarSize"),f.getLocal("n"),f.getLocal("itBit"),f.getLocal("chunkSize"),w),f.call(n+"_add",f.getLocal("pr"),w,f.getLocal("pr")),f.setLocal("itBit",f.i32_sub(f.getLocal("itBit"),f.getLocal("chunkSize"))),f.br(0))))}function I(){const b=a.addFunction(e+"_reduceTable");b.addParam("pTable","i32"),b.addParam("p","i32"),b.addLocal("half","i32"),b.addLocal("it1","i32"),b.addLocal("it2","i32"),b.addLocal("pAcc","i32");const f=b.getCodeBuilder();b.addCode(f.if(f.i32_eq(f.getLocal("p"),f.i32_const(1)),f.ret([])),f.setLocal("half",f.i32_shl(f.i32_const(1),f.i32_sub(f.getLocal("p"),f.i32_const(1)))),f.setLocal("it1",f.getLocal("pTable")),f.setLocal("it2",f.i32_add(f.getLocal("pTable"),f.i32_mul(f.getLocal("half"),f.i32_const(_)))),f.setLocal("pAcc",f.i32_sub(f.getLocal("it2"),f.i32_const(_))),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal("it1"),f.getLocal("pAcc"))),f.call(n+"_add",f.getLocal("it1"),f.getLocal("it2"),f.getLocal("it1")),f.call(n+"_add",f.getLocal("pAcc"),f.getLocal("it2"),f.getLocal("pAcc")),f.setLocal("it1",f.i32_add(f.getLocal("it1"),f.i32_const(_))),f.setLocal("it2",f.i32_add(f.getLocal("it2"),f.i32_const(_))),f.br(0))),f.call(e+"_reduceTable",f.getLocal("pTable"),f.i32_sub(f.getLocal("p"),f.i32_const(1))),f.setLocal("p",f.i32_sub(f.getLocal("p"),f.i32_const(1))),f.block(f.loop(f.br_if(1,f.i32_eqz(f.getLocal("p"))),f.call(n+"_double",f.getLocal("pAcc"),f.getLocal("pAcc")),f.setLocal("p",f.i32_sub(f.getLocal("p"),f.i32_const(1))),f.br(0))),f.call(n+"_add",f.getLocal("pTable"),f.getLocal("pAcc"),f.getLocal("pTable")))}u(),I(),l(),s(),a.exportFunction(e),a.exportFunction(e+"_chunk")}),ze}var Re,Ml;function zl(){if(Ml)return Re;Ml=1;const t=Lu(),a=Il(),n=pu();return Re=function(c,i,r,_){const u=c.modules[r].n64,l=u*8;if(c.modules[i])return i;c.modules[i]={n64:u*3};function s(){const F=c.addFunction(i+"_isZero");F.addParam("p1","i32"),F.setReturnType("i32");const o=F.getCodeBuilder();F.addCode(o.call(r+"_isZero",o.i32_add(o.getLocal("p1"),o.i32_const(l*2))))}function I(){const F=c.addFunction(i+"_isZeroAffine");F.addParam("p1","i32"),F.setReturnType("i32");const o=F.getCodeBuilder();F.addCode(o.i32_and(o.call(r+"_isZero",o.getLocal("p1")),o.call(r+"_isZero",o.i32_add(o.getLocal("p1"),o.i32_const(l)))))}function b(){const F=c.addFunction(i+"_copy");F.addParam("ps","i32"),F.addParam("pd","i32");const o=F.getCodeBuilder();for(let L=0;L<u*3;L++)F.addCode(o.i64_store(o.getLocal("pd"),L*8,o.i64_load(o.getLocal("ps"),L*8)))}function f(){const F=c.addFunction(i+"_copyAffine");F.addParam("ps","i32"),F.addParam("pd","i32");const o=F.getCodeBuilder();for(let L=0;L<u*2;L++)F.addCode(o.i64_store(o.getLocal("pd"),L*8,o.i64_load(o.getLocal("ps"),L*8)))}function w(){const F=c.addFunction(i+"_zero");F.addParam("pr","i32");const o=F.getCodeBuilder();F.addCode(o.call(r+"_zero",o.getLocal("pr"))),F.addCode(o.call(r+"_one",o.i32_add(o.getLocal("pr"),o.i32_const(l)))),F.addCode(o.call(r+"_zero",o.i32_add(o.getLocal("pr"),o.i32_const(l*2))))}function O(){const F=c.addFunction(i+"_zeroAffine");F.addParam("pr","i32");const o=F.getCodeBuilder();F.addCode(o.call(r+"_zero",o.getLocal("pr"))),F.addCode(o.call(r+"_zero",o.i32_add(o.getLocal("pr"),o.i32_const(l))))}function D(){const F=c.addFunction(i+"_eq");F.addParam("p1","i32"),F.addParam("p2","i32"),F.setReturnType("i32"),F.addLocal("z1","i32"),F.addLocal("z2","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l));F.addCode(o.setLocal("z1",o.i32_add(o.getLocal("p1"),o.i32_const(l*2))));const p=o.getLocal("z1"),st=o.getLocal("p2"),qt=o.i32_add(o.getLocal("p2"),o.i32_const(l));F.addCode(o.setLocal("z2",o.i32_add(o.getLocal("p2"),o.i32_const(l*2))));const wt=o.getLocal("z2"),nt=o.i32_const(c.alloc(l)),Q=o.i32_const(c.alloc(l)),A=o.i32_const(c.alloc(l)),lt=o.i32_const(c.alloc(l)),Ft=o.i32_const(c.alloc(l)),Ut=o.i32_const(c.alloc(l)),dt=o.i32_const(c.alloc(l)),B=o.i32_const(c.alloc(l));F.addCode(o.if(o.call(i+"_isZero",o.getLocal("p1")),o.ret(o.call(i+"_isZero",o.getLocal("p2")))),o.if(o.call(i+"_isZero",o.getLocal("p2")),o.ret(o.i32_const(0))),o.if(o.call(r+"_isOne",p),o.ret(o.call(i+"_eqMixed",o.getLocal("p2"),o.getLocal("p1")))),o.if(o.call(r+"_isOne",wt),o.ret(o.call(i+"_eqMixed",o.getLocal("p1"),o.getLocal("p2")))),o.call(r+"_square",p,nt),o.call(r+"_square",wt,Q),o.call(r+"_mul",L,Q,A),o.call(r+"_mul",st,nt,lt),o.call(r+"_mul",p,nt,Ft),o.call(r+"_mul",wt,Q,Ut),o.call(r+"_mul",U,Ut,dt),o.call(r+"_mul",qt,Ft,B),o.if(o.call(r+"_eq",A,lt),o.if(o.call(r+"_eq",dt,B),o.ret(o.i32_const(1)))),o.ret(o.i32_const(0)))}function G(){const F=c.addFunction(i+"_eqMixed");F.addParam("p1","i32"),F.addParam("p2","i32"),F.setReturnType("i32"),F.addLocal("z1","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l));F.addCode(o.setLocal("z1",o.i32_add(o.getLocal("p1"),o.i32_const(l*2))));const p=o.getLocal("z1"),st=o.getLocal("p2"),qt=o.i32_add(o.getLocal("p2"),o.i32_const(l)),wt=o.i32_const(c.alloc(l)),nt=o.i32_const(c.alloc(l)),Q=o.i32_const(c.alloc(l)),A=o.i32_const(c.alloc(l));F.addCode(o.if(o.call(i+"_isZero",o.getLocal("p1")),o.ret(o.call(i+"_isZeroAffine",o.getLocal("p2")))),o.if(o.call(i+"_isZeroAffine",o.getLocal("p2")),o.ret(o.i32_const(0))),o.if(o.call(r+"_isOne",p),o.ret(o.call(i+"_eqAffine",o.getLocal("p1"),o.getLocal("p2")))),o.call(r+"_square",p,wt),o.call(r+"_mul",st,wt,nt),o.call(r+"_mul",p,wt,Q),o.call(r+"_mul",qt,Q,A),o.if(o.call(r+"_eq",L,nt),o.if(o.call(r+"_eq",U,A),o.ret(o.i32_const(1)))),o.ret(o.i32_const(0)))}function V(){const F=c.addFunction(i+"_double");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l)),p=o.i32_add(o.getLocal("p1"),o.i32_const(l*2)),st=o.getLocal("pr"),qt=o.i32_add(o.getLocal("pr"),o.i32_const(l)),wt=o.i32_add(o.getLocal("pr"),o.i32_const(l*2)),nt=o.i32_const(c.alloc(l)),Q=o.i32_const(c.alloc(l)),A=o.i32_const(c.alloc(l)),lt=o.i32_const(c.alloc(l)),Ft=o.i32_const(c.alloc(l)),Ut=o.i32_const(c.alloc(l)),dt=o.i32_const(c.alloc(l)),B=o.i32_const(c.alloc(l));F.addCode(o.if(o.call(i+"_isZero",o.getLocal("p1")),[...o.call(i+"_copy",o.getLocal("p1"),o.getLocal("pr")),...o.ret([])]),o.if(o.call(r+"_isOne",p),[...o.ret(o.call(i+"_doubleAffine",o.getLocal("p1"),o.getLocal("pr"))),...o.ret([])]),o.call(r+"_square",L,nt),o.call(r+"_square",U,Q),o.call(r+"_square",Q,A),o.call(r+"_add",L,Q,lt),o.call(r+"_square",lt,lt),o.call(r+"_sub",lt,nt,lt),o.call(r+"_sub",lt,A,lt),o.call(r+"_add",lt,lt,lt),o.call(r+"_add",nt,nt,Ft),o.call(r+"_add",Ft,nt,Ft),o.call(r+"_square",Ft,Ut),o.call(r+"_mul",U,p,dt),o.call(r+"_add",lt,lt,st),o.call(r+"_sub",Ut,st,st),o.call(r+"_add",A,A,B),o.call(r+"_add",B,B,B),o.call(r+"_add",B,B,B),o.call(r+"_sub",lt,st,qt),o.call(r+"_mul",qt,Ft,qt),o.call(r+"_sub",qt,B,qt),o.call(r+"_add",dt,dt,wt))}function it(){const F=c.addFunction(i+"_doubleAffine");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l)),p=o.getLocal("pr"),st=o.i32_add(o.getLocal("pr"),o.i32_const(l)),qt=o.i32_add(o.getLocal("pr"),o.i32_const(l*2)),wt=o.i32_const(c.alloc(l)),nt=o.i32_const(c.alloc(l)),Q=o.i32_const(c.alloc(l)),A=o.i32_const(c.alloc(l)),lt=o.i32_const(c.alloc(l)),Ft=o.i32_const(c.alloc(l));F.addCode(o.if(o.call(i+"_isZeroAffine",o.getLocal("p1")),[...o.call(i+"_toJacobian",o.getLocal("p1"),o.getLocal("pr")),...o.ret([])]),o.call(r+"_square",L,wt),o.call(r+"_square",U,nt),o.call(r+"_square",nt,Q),o.call(r+"_add",L,nt,A),o.call(r+"_square",A,A),o.call(r+"_sub",A,wt,A),o.call(r+"_sub",A,Q,A),o.call(r+"_add",A,A,A),o.call(r+"_add",wt,wt,lt),o.call(r+"_add",lt,wt,lt),o.call(r+"_add",U,U,qt),o.call(r+"_square",lt,p),o.call(r+"_sub",p,A,p),o.call(r+"_sub",p,A,p),o.call(r+"_add",Q,Q,Ft),o.call(r+"_add",Ft,Ft,Ft),o.call(r+"_add",Ft,Ft,Ft),o.call(r+"_sub",A,p,st),o.call(r+"_mul",st,lt,st),o.call(r+"_sub",st,Ft,st))}function Z(){const F=c.addFunction(i+"_eqAffine");F.addParam("p1","i32"),F.addParam("p2","i32"),F.setReturnType("i32"),F.addLocal("z1","i32");const o=F.getCodeBuilder();F.addCode(o.ret(o.i32_and(o.call(r+"_eq",o.getLocal("p1"),o.getLocal("p2")),o.call(r+"_eq",o.i32_add(o.getLocal("p1"),o.i32_const(l)),o.i32_add(o.getLocal("p2"),o.i32_const(l))))))}function E(){const F=c.addFunction(i+"_toMontgomery");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder();F.addCode(o.call(r+"_toMontgomery",o.getLocal("p1"),o.getLocal("pr")));for(let L=1;L<3;L++)F.addCode(o.call(r+"_toMontgomery",o.i32_add(o.getLocal("p1"),o.i32_const(L*l)),o.i32_add(o.getLocal("pr"),o.i32_const(L*l))))}function M(){const F=c.addFunction(i+"_toMontgomeryAffine");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder();F.addCode(o.call(r+"_toMontgomery",o.getLocal("p1"),o.getLocal("pr")));for(let L=1;L<2;L++)F.addCode(o.call(r+"_toMontgomery",o.i32_add(o.getLocal("p1"),o.i32_const(L*l)),o.i32_add(o.getLocal("pr"),o.i32_const(L*l))))}function h(){const F=c.addFunction(i+"_fromMontgomery");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder();F.addCode(o.call(r+"_fromMontgomery",o.getLocal("p1"),o.getLocal("pr")));for(let L=1;L<3;L++)F.addCode(o.call(r+"_fromMontgomery",o.i32_add(o.getLocal("p1"),o.i32_const(L*l)),o.i32_add(o.getLocal("pr"),o.i32_const(L*l))))}function y(){const F=c.addFunction(i+"_fromMontgomeryAffine");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder();F.addCode(o.call(r+"_fromMontgomery",o.getLocal("p1"),o.getLocal("pr")));for(let L=1;L<2;L++)F.addCode(o.call(r+"_fromMontgomery",o.i32_add(o.getLocal("p1"),o.i32_const(L*l)),o.i32_add(o.getLocal("pr"),o.i32_const(L*l))))}function q(){const F=c.addFunction(i+"_add");F.addParam("p1","i32"),F.addParam("p2","i32"),F.addParam("pr","i32"),F.addLocal("z1","i32"),F.addLocal("z2","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l));F.addCode(o.setLocal("z1",o.i32_add(o.getLocal("p1"),o.i32_const(l*2))));const p=o.getLocal("z1"),st=o.getLocal("p2"),qt=o.i32_add(o.getLocal("p2"),o.i32_const(l));F.addCode(o.setLocal("z2",o.i32_add(o.getLocal("p2"),o.i32_const(l*2))));const wt=o.getLocal("z2"),nt=o.getLocal("pr"),Q=o.i32_add(o.getLocal("pr"),o.i32_const(l)),A=o.i32_add(o.getLocal("pr"),o.i32_const(l*2)),lt=o.i32_const(c.alloc(l)),Ft=o.i32_const(c.alloc(l)),Ut=o.i32_const(c.alloc(l)),dt=o.i32_const(c.alloc(l)),B=o.i32_const(c.alloc(l)),Lt=o.i32_const(c.alloc(l)),Gt=o.i32_const(c.alloc(l)),z=o.i32_const(c.alloc(l)),$=o.i32_const(c.alloc(l)),X=o.i32_const(c.alloc(l)),at=o.i32_const(c.alloc(l)),gt=o.i32_const(c.alloc(l)),ft=o.i32_const(c.alloc(l)),Bt=o.i32_const(c.alloc(l)),pt=o.i32_const(c.alloc(l)),Ot=o.i32_const(c.alloc(l)),Ht=o.i32_const(c.alloc(l));F.addCode(o.if(o.call(i+"_isZero",o.getLocal("p1")),[...o.call(i+"_copy",o.getLocal("p2"),o.getLocal("pr")),...o.ret([])]),o.if(o.call(i+"_isZero",o.getLocal("p2")),[...o.call(i+"_copy",o.getLocal("p1"),o.getLocal("pr")),...o.ret([])]),o.if(o.call(r+"_isOne",p),[...o.call(i+"_addMixed",st,L,nt),...o.ret([])]),o.if(o.call(r+"_isOne",wt),[...o.call(i+"_addMixed",L,st,nt),...o.ret([])]),o.call(r+"_square",p,lt),o.call(r+"_square",wt,Ft),o.call(r+"_mul",L,Ft,Ut),o.call(r+"_mul",st,lt,dt),o.call(r+"_mul",p,lt,B),o.call(r+"_mul",wt,Ft,Lt),o.call(r+"_mul",U,Lt,Gt),o.call(r+"_mul",qt,B,z),o.if(o.call(r+"_eq",Ut,dt),o.if(o.call(r+"_eq",Gt,z),[...o.call(i+"_double",o.getLocal("p1"),o.getLocal("pr")),...o.ret([])])),o.call(r+"_sub",dt,Ut,$),o.call(r+"_sub",z,Gt,X),o.call(r+"_add",$,$,at),o.call(r+"_square",at,at),o.call(r+"_mul",$,at,gt),o.call(r+"_add",X,X,ft),o.call(r+"_mul",Ut,at,pt),o.call(r+"_square",ft,Bt),o.call(r+"_add",pt,pt,Ot),o.call(r+"_sub",Bt,gt,nt),o.call(r+"_sub",nt,Ot,nt),o.call(r+"_mul",Gt,gt,Ht),o.call(r+"_add",Ht,Ht,Ht),o.call(r+"_sub",pt,nt,Q),o.call(r+"_mul",Q,ft,Q),o.call(r+"_sub",Q,Ht,Q),o.call(r+"_add",p,wt,A),o.call(r+"_square",A,A),o.call(r+"_sub",A,lt,A),o.call(r+"_sub",A,Ft,A),o.call(r+"_mul",A,$,A))}function g(){const F=c.addFunction(i+"_addMixed");F.addParam("p1","i32"),F.addParam("p2","i32"),F.addParam("pr","i32"),F.addLocal("z1","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l));F.addCode(o.setLocal("z1",o.i32_add(o.getLocal("p1"),o.i32_const(l*2))));const p=o.getLocal("z1"),st=o.getLocal("p2"),qt=o.i32_add(o.getLocal("p2"),o.i32_const(l)),wt=o.getLocal("pr"),nt=o.i32_add(o.getLocal("pr"),o.i32_const(l)),Q=o.i32_add(o.getLocal("pr"),o.i32_const(l*2)),A=o.i32_const(c.alloc(l)),lt=o.i32_const(c.alloc(l)),Ft=o.i32_const(c.alloc(l)),Ut=o.i32_const(c.alloc(l)),dt=o.i32_const(c.alloc(l)),B=o.i32_const(c.alloc(l)),Lt=o.i32_const(c.alloc(l)),Gt=o.i32_const(c.alloc(l)),z=o.i32_const(c.alloc(l)),$=o.i32_const(c.alloc(l)),X=o.i32_const(c.alloc(l)),at=o.i32_const(c.alloc(l)),gt=o.i32_const(c.alloc(l)),ft=o.i32_const(c.alloc(l));F.addCode(o.if(o.call(i+"_isZero",o.getLocal("p1")),[...o.call(i+"_copyAffine",o.getLocal("p2"),o.getLocal("pr")),...o.call(r+"_one",o.i32_add(o.getLocal("pr"),o.i32_const(l*2))),...o.ret([])]),o.if(o.call(i+"_isZeroAffine",o.getLocal("p2")),[...o.call(i+"_copy",o.getLocal("p1"),o.getLocal("pr")),...o.ret([])]),o.if(o.call(r+"_isOne",p),[...o.call(i+"_addAffine",L,st,wt),...o.ret([])]),o.call(r+"_square",p,A),o.call(r+"_mul",st,A,lt),o.call(r+"_mul",p,A,Ft),o.call(r+"_mul",qt,Ft,Ut),o.if(o.call(r+"_eq",L,lt),o.if(o.call(r+"_eq",U,Ut),[...o.call(i+"_doubleAffine",o.getLocal("p2"),o.getLocal("pr")),...o.ret([])])),o.call(r+"_sub",lt,L,dt),o.call(r+"_sub",Ut,U,Lt),o.call(r+"_square",dt,B),o.call(r+"_add",B,B,Gt),o.call(r+"_add",Gt,Gt,Gt),o.call(r+"_mul",dt,Gt,z),o.call(r+"_add",Lt,Lt,$),o.call(r+"_mul",L,Gt,at),o.call(r+"_square",$,X),o.call(r+"_add",at,at,gt),o.call(r+"_sub",X,z,wt),o.call(r+"_sub",wt,gt,wt),o.call(r+"_mul",U,z,ft),o.call(r+"_add",ft,ft,ft),o.call(r+"_sub",at,wt,nt),o.call(r+"_mul",nt,$,nt),o.call(r+"_sub",nt,ft,nt),o.call(r+"_add",p,dt,Q),o.call(r+"_square",Q,Q),o.call(r+"_sub",Q,A,Q),o.call(r+"_sub",Q,B,Q))}function x(){const F=c.addFunction(i+"_addAffine");F.addParam("p1","i32"),F.addParam("p2","i32"),F.addParam("pr","i32"),F.addLocal("z1","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l));F.addCode(o.setLocal("z1",o.i32_add(o.getLocal("p1"),o.i32_const(l*2))));const p=o.getLocal("p2"),st=o.i32_add(o.getLocal("p2"),o.i32_const(l)),qt=o.getLocal("pr"),wt=o.i32_add(o.getLocal("pr"),o.i32_const(l)),nt=o.i32_add(o.getLocal("pr"),o.i32_const(l*2)),Q=o.i32_const(c.alloc(l)),A=o.i32_const(c.alloc(l)),lt=o.i32_const(c.alloc(l)),Ft=o.i32_const(c.alloc(l)),Ut=o.i32_const(c.alloc(l)),dt=o.i32_const(c.alloc(l)),B=o.i32_const(c.alloc(l)),Lt=o.i32_const(c.alloc(l)),Gt=o.i32_const(c.alloc(l)),z=o.i32_const(c.alloc(l));F.addCode(o.if(o.call(i+"_isZeroAffine",o.getLocal("p1")),[...o.call(i+"_copyAffine",o.getLocal("p2"),o.getLocal("pr")),...o.call(r+"_one",o.i32_add(o.getLocal("pr"),o.i32_const(l*2))),...o.ret([])]),o.if(o.call(i+"_isZeroAffine",o.getLocal("p2")),[...o.call(i+"_copyAffine",o.getLocal("p1"),o.getLocal("pr")),...o.call(r+"_one",o.i32_add(o.getLocal("pr"),o.i32_const(l*2))),...o.ret([])]),o.if(o.call(r+"_eq",L,p),o.if(o.call(r+"_eq",U,st),[...o.call(i+"_doubleAffine",o.getLocal("p2"),o.getLocal("pr")),...o.ret([])])),o.call(r+"_sub",p,L,Q),o.call(r+"_sub",st,U,lt),o.call(r+"_square",Q,A),o.call(r+"_add",A,A,Ft),o.call(r+"_add",Ft,Ft,Ft),o.call(r+"_mul",Q,Ft,Ut),o.call(r+"_add",lt,lt,dt),o.call(r+"_mul",L,Ft,Lt),o.call(r+"_square",dt,B),o.call(r+"_add",Lt,Lt,Gt),o.call(r+"_sub",B,Ut,qt),o.call(r+"_sub",qt,Gt,qt),o.call(r+"_mul",U,Ut,z),o.call(r+"_add",z,z,z),o.call(r+"_sub",Lt,qt,wt),o.call(r+"_mul",wt,dt,wt),o.call(r+"_sub",wt,z,wt),o.call(r+"_add",Q,Q,nt))}function H(){const F=c.addFunction(i+"_neg");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l)),p=o.i32_add(o.getLocal("p1"),o.i32_const(l*2)),st=o.getLocal("pr"),qt=o.i32_add(o.getLocal("pr"),o.i32_const(l)),wt=o.i32_add(o.getLocal("pr"),o.i32_const(l*2));F.addCode(o.call(r+"_copy",L,st),o.call(r+"_neg",U,qt),o.call(r+"_copy",p,wt))}function T(){const F=c.addFunction(i+"_negAffine");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l)),p=o.getLocal("pr"),st=o.i32_add(o.getLocal("pr"),o.i32_const(l));F.addCode(o.call(r+"_copy",L,p),o.call(r+"_neg",U,st))}function N(){const F=c.addFunction(i+"_sub");F.addParam("p1","i32"),F.addParam("p2","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder(),L=o.i32_const(c.alloc(l*3));F.addCode(o.call(i+"_neg",o.getLocal("p2"),L),o.call(i+"_add",o.getLocal("p1"),L,o.getLocal("pr")))}function P(){const F=c.addFunction(i+"_subMixed");F.addParam("p1","i32"),F.addParam("p2","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder(),L=o.i32_const(c.alloc(l*3));F.addCode(o.call(i+"_negAffine",o.getLocal("p2"),L),o.call(i+"_addMixed",o.getLocal("p1"),L,o.getLocal("pr")))}function v(){const F=c.addFunction(i+"_subAffine");F.addParam("p1","i32"),F.addParam("p2","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder(),L=o.i32_const(c.alloc(l*3));F.addCode(o.call(i+"_negAffine",o.getLocal("p2"),L),o.call(i+"_addAffine",o.getLocal("p1"),L,o.getLocal("pr")))}function S(){const F=c.addFunction(i+"_normalize");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l)),p=o.i32_add(o.getLocal("p1"),o.i32_const(l*2)),st=o.getLocal("pr"),qt=o.i32_add(o.getLocal("pr"),o.i32_const(l)),wt=o.i32_add(o.getLocal("pr"),o.i32_const(l*2)),nt=o.i32_const(c.alloc(l)),Q=o.i32_const(c.alloc(l)),A=o.i32_const(c.alloc(l));F.addCode(o.if(o.call(i+"_isZero",o.getLocal("p1")),o.call(i+"_zero",o.getLocal("pr")),[...o.call(r+"_inverse",p,nt),...o.call(r+"_square",nt,Q),...o.call(r+"_mul",nt,Q,A),...o.call(r+"_mul",L,Q,st),...o.call(r+"_mul",U,A,qt),...o.call(r+"_one",wt)]))}function et(){const F=c.addFunction(i+"_toAffine");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l)),p=o.i32_add(o.getLocal("p1"),o.i32_const(l*2)),st=o.getLocal("pr"),qt=o.i32_add(o.getLocal("pr"),o.i32_const(l)),wt=o.i32_const(c.alloc(l)),nt=o.i32_const(c.alloc(l)),Q=o.i32_const(c.alloc(l));F.addCode(o.if(o.call(i+"_isZero",o.getLocal("p1")),[...o.call(r+"_zero",st),...o.call(r+"_zero",qt)],[...o.call(r+"_inverse",p,wt),...o.call(r+"_square",wt,nt),...o.call(r+"_mul",wt,nt,Q),...o.call(r+"_mul",L,nt,st),...o.call(r+"_mul",U,Q,qt)]))}function _t(){const F=c.addFunction(i+"_toJacobian");F.addParam("p1","i32"),F.addParam("pr","i32");const o=F.getCodeBuilder(),L=o.getLocal("p1"),U=o.i32_add(o.getLocal("p1"),o.i32_const(l)),p=o.getLocal("pr"),st=o.i32_add(o.getLocal("pr"),o.i32_const(l)),qt=o.i32_add(o.getLocal("pr"),o.i32_const(l*2));F.addCode(o.if(o.call(i+"_isZeroAffine",o.getLocal("p1")),o.call(i+"_zero",o.getLocal("pr")),[...o.call(r+"_one",qt),...o.call(r+"_copy",U,st),...o.call(r+"_copy",L,p)]))}function mt(){const F=c.addFunction(i+"_batchToAffine");F.addParam("pIn","i32"),F.addParam("n","i32"),F.addParam("pOut","i32"),F.addLocal("pAux","i32"),F.addLocal("itIn","i32"),F.addLocal("itAux","i32"),F.addLocal("itOut","i32"),F.addLocal("i","i32");const o=F.getCodeBuilder(),L=o.i32_const(c.alloc(l));F.addCode(o.setLocal("pAux",o.i32_load(o.i32_const(0))),o.i32_store(o.i32_const(0),o.i32_add(o.getLocal("pAux"),o.i32_mul(o.getLocal("n"),o.i32_const(l)))),o.call(r+"_batchInverse",o.i32_add(o.getLocal("pIn"),o.i32_const(l*2)),o.i32_const(l*3),o.getLocal("n"),o.getLocal("pAux"),o.i32_const(l)),o.setLocal("itIn",o.getLocal("pIn")),o.setLocal("itAux",o.getLocal("pAux")),o.setLocal("itOut",o.getLocal("pOut")),o.setLocal("i",o.i32_const(0)),o.block(o.loop(o.br_if(1,o.i32_eq(o.getLocal("i"),o.getLocal("n"))),o.if(o.call(r+"_isZero",o.getLocal("itAux")),[...o.call(r+"_zero",o.getLocal("itOut")),...o.call(r+"_zero",o.i32_add(o.getLocal("itOut"),o.i32_const(l)))],[...o.call(r+"_mul",o.getLocal("itAux"),o.i32_add(o.getLocal("itIn"),o.i32_const(l)),L),...o.call(r+"_square",o.getLocal("itAux"),o.getLocal("itAux")),...o.call(r+"_mul",o.getLocal("itAux"),o.getLocal("itIn"),o.getLocal("itOut")),...o.call(r+"_mul",o.getLocal("itAux"),L,o.i32_add(o.getLocal("itOut"),o.i32_const(l)))]),o.setLocal("itIn",o.i32_add(o.getLocal("itIn"),o.i32_const(l*3))),o.setLocal("itOut",o.i32_add(o.getLocal("itOut"),o.i32_const(l*2))),o.setLocal("itAux",o.i32_add(o.getLocal("itAux"),o.i32_const(l))),o.setLocal("i",o.i32_add(o.getLocal("i"),o.i32_const(1))),o.br(0))),o.i32_store(o.i32_const(0),o.getLocal("pAux")))}function xt(){const F=c.addFunction(i+"__reverseBytes");F.addParam("pIn","i32"),F.addParam("n","i32"),F.addParam("pOut","i32"),F.addLocal("itOut","i32"),F.addLocal("itIn","i32");const o=F.getCodeBuilder();F.addCode(o.setLocal("itOut",o.i32_sub(o.i32_add(o.getLocal("pOut"),o.getLocal("n")),o.i32_const(1))),o.setLocal("itIn",o.getLocal("pIn")),o.block(o.loop(o.br_if(1,o.i32_lt_s(o.getLocal("itOut"),o.getLocal("pOut"))),o.i32_store8(o.getLocal("itOut"),o.i32_load8_u(o.getLocal("itIn"))),o.setLocal("itOut",o.i32_sub(o.getLocal("itOut"),o.i32_const(1))),o.setLocal("itIn",o.i32_add(o.getLocal("itIn"),o.i32_const(1))),o.br(0))))}function Pt(){const F=c.addFunction(i+"_LEMtoC");F.addParam("pIn","i32"),F.addParam("pOut","i32");const o=F.getCodeBuilder(),L=o.i32_const(c.alloc(l));F.addCode(o.if(o.call(i+"_isZero",o.getLocal("pIn")),[...o.call(r+"_zero",o.getLocal("pOut")),...o.i32_store8(o.getLocal("pOut"),o.i32_const(64)),...o.ret([])]),o.call(r+"_fromMontgomery",o.getLocal("pIn"),L),o.call(i+"__reverseBytes",L,o.i32_const(l),o.getLocal("pOut")),o.if(o.i32_eq(o.call(r+"_sign",o.i32_add(o.getLocal("pIn"),o.i32_const(l))),o.i32_const(-1)),o.i32_store8(o.getLocal("pOut"),o.i32_or(o.i32_load8_u(o.getLocal("pOut")),o.i32_const(128)))))}function zt(){const F=c.addFunction(i+"_LEMtoU");F.addParam("pIn","i32"),F.addParam("pOut","i32");const o=F.getCodeBuilder(),L=c.alloc(l*2),U=o.i32_const(L),p=o.i32_const(L),st=o.i32_const(L+l);F.addCode(o.if(o.call(i+"_isZeroAffine",o.getLocal("pIn")),[...o.call(i+"_zeroAffine",o.getLocal("pOut")),...o.i32_store8(o.getLocal("pOut"),o.i32_const(64)),...o.ret([])]),o.call(i+"_fromMontgomeryAffine",o.getLocal("pIn"),U),o.call(i+"__reverseBytes",p,o.i32_const(l),o.getLocal("pOut")),o.call(i+"__reverseBytes",st,o.i32_const(l),o.i32_add(o.getLocal("pOut"),o.i32_const(l))))}function Rt(){const F=c.addFunction(i+"_UtoLEM");F.addParam("pIn","i32"),F.addParam("pOut","i32");const o=F.getCodeBuilder(),L=c.alloc(l*2),U=o.i32_const(L),p=o.i32_const(L),st=o.i32_const(L+l);F.addCode(o.if(o.i32_and(o.i32_load8_u(o.getLocal("pIn")),o.i32_const(64)),[...o.call(i+"_zeroAffine",o.getLocal("pOut")),...o.ret([])]),o.call(i+"__reverseBytes",o.getLocal("pIn"),o.i32_const(l),p),o.call(i+"__reverseBytes",o.i32_add(o.getLocal("pIn"),o.i32_const(l)),o.i32_const(l),st),o.call(i+"_toMontgomeryAffine",U,o.getLocal("pOut")))}function k(){const F=c.addFunction(i+"_CtoLEM");F.addParam("pIn","i32"),F.addParam("pOut","i32"),F.addLocal("firstByte","i32"),F.addLocal("greatest","i32");const o=F.getCodeBuilder(),L=c.alloc(l*2),U=o.i32_const(L),p=o.i32_const(L+l);F.addCode(o.setLocal("firstByte",o.i32_load8_u(o.getLocal("pIn"))),o.if(o.i32_and(o.getLocal("firstByte"),o.i32_const(64)),[...o.call(i+"_zeroAffine",o.getLocal("pOut")),...o.ret([])]),o.setLocal("greatest",o.i32_and(o.getLocal("firstByte"),o.i32_const(128))),o.call(r+"_copy",o.getLocal("pIn"),p),o.i32_store8(p,o.i32_and(o.getLocal("firstByte"),o.i32_const(63))),o.call(i+"__reverseBytes",p,o.i32_const(l),U),o.call(r+"_toMontgomery",U,o.getLocal("pOut")),o.call(r+"_square",o.getLocal("pOut"),p),o.call(r+"_mul",o.getLocal("pOut"),p,p),o.call(r+"_add",p,o.i32_const(_),p),o.call(r+"_sqrt",p,p),o.call(r+"_neg",p,U),o.if(o.i32_eq(o.call(r+"_sign",p),o.i32_const(-1)),o.if(o.getLocal("greatest"),o.call(r+"_copy",p,o.i32_add(o.getLocal("pOut"),o.i32_const(l))),o.call(r+"_neg",p,o.i32_add(o.getLocal("pOut"),o.i32_const(l)))),o.if(o.getLocal("greatest"),o.call(r+"_neg",p,o.i32_add(o.getLocal("pOut"),o.i32_const(l))),o.call(r+"_copy",p,o.i32_add(o.getLocal("pOut"),o.i32_const(l))))))}function Ct(){const F=c.addFunction(i+"_inCurveAffine");F.addParam("pIn","i32"),F.setReturnType("i32");const o=F.getCodeBuilder(),L=o.getLocal("pIn"),U=o.i32_add(o.getLocal("pIn"),o.i32_const(l)),p=o.i32_const(c.alloc(l)),st=o.i32_const(c.alloc(l));F.addCode(o.call(r+"_square",U,p),o.call(r+"_square",L,st),o.call(r+"_mul",L,st,st),o.call(r+"_add",st,o.i32_const(_),st),o.ret(o.call(r+"_eq",p,st)))}function St(){const F=c.addFunction(i+"_inCurve");F.addParam("pIn","i32"),F.setReturnType("i32");const o=F.getCodeBuilder(),L=o.i32_const(c.alloc(l*2));F.addCode(o.call(i+"_toAffine",o.getLocal("pIn"),L),o.ret(o.call(i+"_inCurveAffine",L)))}return I(),s(),O(),w(),f(),b(),_t(),Z(),G(),D(),it(),V(),x(),g(),q(),T(),H(),v(),P(),N(),y(),h(),M(),E(),et(),Ct(),St(),mt(),S(),xt(),zt(),Pt(),Rt(),k(),a(c,i+"_batchLEMtoU",i+"_LEMtoU",l*2,l*2),a(c,i+"_batchLEMtoC",i+"_LEMtoC",l*2,l),a(c,i+"_batchUtoLEM",i+"_UtoLEM",l*2,l*2),a(c,i+"_batchCtoLEM",i+"_CtoLEM",l,l*2,!0),a(c,i+"_batchToJacobian",i+"_toJacobian",l*2,l*3,!0),n(c,i,i+"_multiexp",i+"_add",l*3),n(c,i,i+"_multiexpAffine",i+"_addMixed",l*2),t(c,i+"_timesScalar",l*3,i+"_add",i+"_double",i+"_sub",i+"_copy",i+"_zero"),t(c,i+"_timesScalarAffine",l*2,i+"_addMixed",i+"_double",i+"_subMixed",i+"_copyAffine",i+"_zero"),c.exportFunction(i+"_isZero"),c.exportFunction(i+"_isZeroAffine"),c.exportFunction(i+"_eq"),c.exportFunction(i+"_eqMixed"),c.exportFunction(i+"_eqAffine"),c.exportFunction(i+"_copy"),c.exportFunction(i+"_copyAffine"),c.exportFunction(i+"_zero"),c.exportFunction(i+"_zeroAffine"),c.exportFunction(i+"_double"),c.exportFunction(i+"_doubleAffine"),c.exportFunction(i+"_add"),c.exportFunction(i+"_addMixed"),c.exportFunction(i+"_addAffine"),c.exportFunction(i+"_neg"),c.exportFunction(i+"_negAffine"),c.exportFunction(i+"_sub"),c.exportFunction(i+"_subMixed"),c.exportFunction(i+"_subAffine"),c.exportFunction(i+"_fromMontgomery"),c.exportFunction(i+"_fromMontgomeryAffine"),c.exportFunction(i+"_toMontgomery"),c.exportFunction(i+"_toMontgomeryAffine"),c.exportFunction(i+"_timesScalar"),c.exportFunction(i+"_timesScalarAffine"),c.exportFunction(i+"_normalize"),c.exportFunction(i+"_LEMtoU"),c.exportFunction(i+"_LEMtoC"),c.exportFunction(i+"_UtoLEM"),c.exportFunction(i+"_CtoLEM"),c.exportFunction(i+"_batchLEMtoU"),c.exportFunction(i+"_batchLEMtoC"),c.exportFunction(i+"_batchUtoLEM"),c.exportFunction(i+"_batchCtoLEM"),c.exportFunction(i+"_toAffine"),c.exportFunction(i+"_toJacobian"),c.exportFunction(i+"_batchToAffine"),c.exportFunction(i+"_batchToJacobian"),c.exportFunction(i+"_inCurve"),c.exportFunction(i+"_inCurveAffine"),i},Re}var Te,Rl;function Tl(){if(Rl)return Te;Rl=1;const t=Gn(),a=Ea();return Te=function(e,c,i,r,_){const l=e.modules[r].n64*8,I=e.modules[i].n64*8,b=e.modules[r].q;let f=b.minus(t(1)),w=0;for(;!f.isOdd();)w++,f=f.shiftRight(1);let O=t(2);for(;O.modPow(b.shiftRight(1),b).equals(1);)O=O.add(1);const D=new Array(w+1);D[w]=O.modPow(f,b);let G=w-1;for(;G>=0;)D[G]=D[G+1].modPow(2,b),G--;const V=[],it=t(1).shiftLeft(l*8).mod(b);for(let o=0;o<D.length;o++){const L=D[o].times(it).mod(b);V.push(...a.bigInt2BytesLE(L,l))}const Z=e.alloc(V),E=new Array(w+1);E[0]=t(1);for(let o=1;o<=w;o++)E[o]=E[o-1].times(2);const M=[];for(let o=0;o<=w;o++){const L=E[o].modInv(b).times(it).mod(b);M.push(...a.bigInt2BytesLE(L,l))}const h=e.alloc(M),y=O.modPow(2,b),q=[],g=[];for(let o=0;o<=w;o++){const L=y.modPow(t(2).pow(o),b),U=b.add(t.one).minus(L).modInv(b);q.push(...a.bigInt2BytesLE(L.times(it).mod(b),l)),g.push(...a.bigInt2BytesLE(U.times(it).mod(b),l))}const x=e.alloc(q),H=e.alloc(g);function T(o){let L=0;for(let U=0;U<8;U++)o&1<<U&&(L=L|128>>U);return L}const N=Array(256);for(let o=0;o<256;o++)N[o]=T(o);const P=e.alloc(N);function v(){const o=e.addFunction(c+"__log2");o.addParam("n","i32"),o.setReturnType("i32"),o.addLocal("bits","i32"),o.addLocal("aux","i32");const L=o.getCodeBuilder();o.addCode(L.setLocal("aux",L.i32_shr_u(L.getLocal("n"),L.i32_const(1)))),o.addCode(L.setLocal("bits",L.i32_const(0))),o.addCode(L.block(L.loop(L.br_if(1,L.i32_eqz(L.getLocal("aux"))),L.setLocal("aux",L.i32_shr_u(L.getLocal("aux"),L.i32_const(1))),L.setLocal("bits",L.i32_add(L.getLocal("bits"),L.i32_const(1))),L.br(0)))),o.addCode(L.if(L.i32_ne(L.getLocal("n"),L.i32_shl(L.i32_const(1),L.getLocal("bits"))),L.unreachable())),o.addCode(L.if(L.i32_gt_u(L.getLocal("bits"),L.i32_const(w)),L.unreachable())),o.addCode(L.getLocal("bits"))}function S(){const o=e.addFunction(c+"_fft");o.addParam("px","i32"),o.addParam("n","i32"),o.addLocal("bits","i32");const L=o.getCodeBuilder(),U=L.i32_const(e.alloc(l));o.addCode(L.setLocal("bits",L.call(c+"__log2",L.getLocal("n"))),L.call(r+"_one",U),L.call(c+"_rawfft",L.getLocal("px"),L.getLocal("bits"),L.i32_const(0),U))}function et(){const o=e.addFunction(c+"_ifft");o.addParam("px","i32"),o.addParam("n","i32"),o.addLocal("bits","i32"),o.addLocal("pInv2","i32");const L=o.getCodeBuilder();o.addCode(L.setLocal("bits",L.call(c+"__log2",L.getLocal("n"))),L.setLocal("pInv2",L.i32_add(L.i32_const(h),L.i32_mul(L.getLocal("bits"),L.i32_const(l)))),L.call(c+"_rawfft",L.getLocal("px"),L.getLocal("bits"),L.i32_const(1),L.getLocal("pInv2")))}function _t(){const o=e.addFunction(c+"_rawfft");o.addParam("px","i32"),o.addParam("bits","i32"),o.addParam("reverse","i32"),o.addParam("mulFactor","i32"),o.addLocal("s","i32"),o.addLocal("k","i32"),o.addLocal("j","i32"),o.addLocal("m","i32"),o.addLocal("mdiv2","i32"),o.addLocal("n","i32"),o.addLocal("pwm","i32"),o.addLocal("idx1","i32"),o.addLocal("idx2","i32");const L=o.getCodeBuilder(),U=L.i32_const(e.alloc(l)),p=L.i32_const(e.alloc(I)),st=L.i32_const(e.alloc(I));o.addCode(L.call(c+"__reversePermutation",L.getLocal("px"),L.getLocal("bits")),L.setLocal("n",L.i32_shl(L.i32_const(1),L.getLocal("bits"))),L.setLocal("s",L.i32_const(1)),L.block(L.loop(L.br_if(1,L.i32_gt_u(L.getLocal("s"),L.getLocal("bits"))),L.setLocal("m",L.i32_shl(L.i32_const(1),L.getLocal("s"))),L.setLocal("pwm",L.i32_add(L.i32_const(Z),L.i32_mul(L.getLocal("s"),L.i32_const(l)))),L.setLocal("k",L.i32_const(0)),L.block(L.loop(L.br_if(1,L.i32_ge_u(L.getLocal("k"),L.getLocal("n"))),L.call(r+"_one",U),L.setLocal("mdiv2",L.i32_shr_u(L.getLocal("m"),L.i32_const(1))),L.setLocal("j",L.i32_const(0)),L.block(L.loop(L.br_if(1,L.i32_ge_u(L.getLocal("j"),L.getLocal("mdiv2"))),L.setLocal("idx1",L.i32_add(L.getLocal("px"),L.i32_mul(L.i32_add(L.getLocal("k"),L.getLocal("j")),L.i32_const(I)))),L.setLocal("idx2",L.i32_add(L.getLocal("idx1"),L.i32_mul(L.getLocal("mdiv2"),L.i32_const(I)))),L.call(_,L.getLocal("idx2"),U,p),L.call(i+"_copy",L.getLocal("idx1"),st),L.call(i+"_add",st,p,L.getLocal("idx1")),L.call(i+"_sub",st,p,L.getLocal("idx2")),L.call(r+"_mul",U,L.getLocal("pwm"),U),L.setLocal("j",L.i32_add(L.getLocal("j"),L.i32_const(1))),L.br(0))),L.setLocal("k",L.i32_add(L.getLocal("k"),L.getLocal("m"))),L.br(0))),L.setLocal("s",L.i32_add(L.getLocal("s"),L.i32_const(1))),L.br(0))),L.call(c+"__fftFinal",L.getLocal("px"),L.getLocal("bits"),L.getLocal("reverse"),L.getLocal("mulFactor")))}function mt(){const o=e.addFunction(c+"__fftFinal");o.addParam("px","i32"),o.addParam("bits","i32"),o.addParam("reverse","i32"),o.addParam("mulFactor","i32"),o.addLocal("n","i32"),o.addLocal("ndiv2","i32"),o.addLocal("pInv2","i32"),o.addLocal("i","i32"),o.addLocal("mask","i32"),o.addLocal("idx1","i32"),o.addLocal("idx2","i32");const L=o.getCodeBuilder(),U=L.i32_const(e.alloc(I));o.addCode(L.if(L.i32_and(L.i32_eqz(L.getLocal("reverse")),L.call(r+"_isOne",L.getLocal("mulFactor"))),L.ret([])),L.setLocal("n",L.i32_shl(L.i32_const(1),L.getLocal("bits"))),L.setLocal("mask",L.i32_sub(L.getLocal("n"),L.i32_const(1))),L.setLocal("i",L.i32_const(1)),L.setLocal("ndiv2",L.i32_shr_u(L.getLocal("n"),L.i32_const(1))),L.block(L.loop(L.br_if(1,L.i32_ge_u(L.getLocal("i"),L.getLocal("ndiv2"))),L.setLocal("idx1",L.i32_add(L.getLocal("px"),L.i32_mul(L.getLocal("i"),L.i32_const(I)))),L.setLocal("idx2",L.i32_add(L.getLocal("px"),L.i32_mul(L.i32_sub(L.getLocal("n"),L.getLocal("i")),L.i32_const(I)))),L.if(L.getLocal("reverse"),L.if(L.call(r+"_isOne",L.getLocal("mulFactor")),[...L.call(i+"_copy",L.getLocal("idx1"),U),...L.call(i+"_copy",L.getLocal("idx2"),L.getLocal("idx1")),...L.call(i+"_copy",U,L.getLocal("idx2"))],[...L.call(i+"_copy",L.getLocal("idx1"),U),...L.call(_,L.getLocal("idx2"),L.getLocal("mulFactor"),L.getLocal("idx1")),...L.call(_,U,L.getLocal("mulFactor"),L.getLocal("idx2"))]),L.if(L.call(r+"_isOne",L.getLocal("mulFactor")),[],[...L.call(_,L.getLocal("idx1"),L.getLocal("mulFactor"),L.getLocal("idx1")),...L.call(_,L.getLocal("idx2"),L.getLocal("mulFactor"),L.getLocal("idx2"))])),L.setLocal("i",L.i32_add(L.getLocal("i"),L.i32_const(1))),L.br(0))),L.if(L.call(r+"_isOne",L.getLocal("mulFactor")),[],[...L.call(_,L.getLocal("px"),L.getLocal("mulFactor"),L.getLocal("px")),...L.setLocal("idx2",L.i32_add(L.getLocal("px"),L.i32_mul(L.getLocal("ndiv2"),L.i32_const(I)))),...L.call(_,L.getLocal("idx2"),L.getLocal("mulFactor"),L.getLocal("idx2"))]))}function xt(){const o=e.addFunction(c+"__reversePermutation");o.addParam("px","i32"),o.addParam("bits","i32"),o.addLocal("n","i32"),o.addLocal("i","i32"),o.addLocal("ri","i32"),o.addLocal("idx1","i32"),o.addLocal("idx2","i32");const L=o.getCodeBuilder(),U=L.i32_const(e.alloc(I));o.addCode(L.setLocal("n",L.i32_shl(L.i32_const(1),L.getLocal("bits"))),L.setLocal("i",L.i32_const(0)),L.block(L.loop(L.br_if(1,L.i32_eq(L.getLocal("i"),L.getLocal("n"))),L.setLocal("idx1",L.i32_add(L.getLocal("px"),L.i32_mul(L.getLocal("i"),L.i32_const(I)))),L.setLocal("ri",L.call(c+"__rev",L.getLocal("i"),L.getLocal("bits"))),L.setLocal("idx2",L.i32_add(L.getLocal("px"),L.i32_mul(L.getLocal("ri"),L.i32_const(I)))),L.if(L.i32_lt_u(L.getLocal("i"),L.getLocal("ri")),[...L.call(i+"_copy",L.getLocal("idx1"),U),...L.call(i+"_copy",L.getLocal("idx2"),L.getLocal("idx1")),...L.call(i+"_copy",U,L.getLocal("idx2"))]),L.setLocal("i",L.i32_add(L.getLocal("i"),L.i32_const(1))),L.br(0))))}function Pt(){const o=e.addFunction(c+"__rev");o.addParam("x","i32"),o.addParam("bits","i32"),o.setReturnType("i32");const L=o.getCodeBuilder();o.addCode(L.i32_rotl(L.i32_add(L.i32_add(L.i32_shl(L.i32_load8_u(L.i32_and(L.getLocal("x"),L.i32_const(255)),P,0),L.i32_const(24)),L.i32_shl(L.i32_load8_u(L.i32_and(L.i32_shr_u(L.getLocal("x"),L.i32_const(8)),L.i32_const(255)),P,0),L.i32_const(16))),L.i32_add(L.i32_shl(L.i32_load8_u(L.i32_and(L.i32_shr_u(L.getLocal("x"),L.i32_const(16)),L.i32_const(255)),P,0),L.i32_const(8)),L.i32_load8_u(L.i32_and(L.i32_shr_u(L.getLocal("x"),L.i32_const(24)),L.i32_const(255)),P,0))),L.getLocal("bits")))}function zt(){const o=e.addFunction(c+"_fftJoin");o.addParam("pBuff1","i32"),o.addParam("pBuff2","i32"),o.addParam("n","i32"),o.addParam("first","i32"),o.addParam("inc","i32"),o.addLocal("idx1","i32"),o.addLocal("idx2","i32"),o.addLocal("i","i32");const L=o.getCodeBuilder(),U=L.i32_const(e.alloc(l)),p=L.i32_const(e.alloc(I)),st=L.i32_const(e.alloc(I));o.addCode(L.call(r+"_copy",L.getLocal("first"),U),L.setLocal("i",L.i32_const(0)),L.block(L.loop(L.br_if(1,L.i32_eq(L.getLocal("i"),L.getLocal("n"))),L.setLocal("idx1",L.i32_add(L.getLocal("pBuff1"),L.i32_mul(L.getLocal("i"),L.i32_const(I)))),L.setLocal("idx2",L.i32_add(L.getLocal("pBuff2"),L.i32_mul(L.getLocal("i"),L.i32_const(I)))),L.call(_,L.getLocal("idx2"),U,p),L.call(i+"_copy",L.getLocal("idx1"),st),L.call(i+"_add",st,p,L.getLocal("idx1")),L.call(i+"_sub",st,p,L.getLocal("idx2")),L.call(r+"_mul",U,L.getLocal("inc"),U),L.setLocal("i",L.i32_add(L.getLocal("i"),L.i32_const(1))),L.br(0))))}function Rt(){const o=e.addFunction(c+"_fftJoinExt");o.addParam("pBuff1","i32"),o.addParam("pBuff2","i32"),o.addParam("n","i32"),o.addParam("first","i32"),o.addParam("inc","i32"),o.addParam("totalBits","i32"),o.addLocal("idx1","i32"),o.addLocal("idx2","i32"),o.addLocal("i","i32"),o.addLocal("pShiftToM","i32");const L=o.getCodeBuilder(),U=L.i32_const(e.alloc(l)),p=L.i32_const(e.alloc(I));o.addCode(L.setLocal("pShiftToM",L.i32_add(L.i32_const(x),L.i32_mul(L.getLocal("totalBits"),L.i32_const(l)))),L.call(r+"_copy",L.getLocal("first"),U),L.setLocal("i",L.i32_const(0)),L.block(L.loop(L.br_if(1,L.i32_eq(L.getLocal("i"),L.getLocal("n"))),L.setLocal("idx1",L.i32_add(L.getLocal("pBuff1"),L.i32_mul(L.getLocal("i"),L.i32_const(I)))),L.setLocal("idx2",L.i32_add(L.getLocal("pBuff2"),L.i32_mul(L.getLocal("i"),L.i32_const(I)))),L.call(i+"_add",L.getLocal("idx1"),L.getLocal("idx2"),p),L.call(_,L.getLocal("idx2"),L.getLocal("pShiftToM"),L.getLocal("idx2")),L.call(i+"_add",L.getLocal("idx1"),L.getLocal("idx2"),L.getLocal("idx2")),L.call(_,L.getLocal("idx2"),U,L.getLocal("idx2")),L.call(i+"_copy",p,L.getLocal("idx1")),L.call(r+"_mul",U,L.getLocal("inc"),U),L.setLocal("i",L.i32_add(L.getLocal("i"),L.i32_const(1))),L.br(0))))}function k(){const o=e.addFunction(c+"_fftJoinExtInv");o.addParam("pBuff1","i32"),o.addParam("pBuff2","i32"),o.addParam("n","i32"),o.addParam("first","i32"),o.addParam("inc","i32"),o.addParam("totalBits","i32"),o.addLocal("idx1","i32"),o.addLocal("idx2","i32"),o.addLocal("i","i32"),o.addLocal("pShiftToM","i32"),o.addLocal("pSConst","i32");const L=o.getCodeBuilder(),U=L.i32_const(e.alloc(l)),p=L.i32_const(e.alloc(I));o.addCode(L.setLocal("pShiftToM",L.i32_add(L.i32_const(x),L.i32_mul(L.getLocal("totalBits"),L.i32_const(l)))),L.setLocal("pSConst",L.i32_add(L.i32_const(H),L.i32_mul(L.getLocal("totalBits"),L.i32_const(l)))),L.call(r+"_copy",L.getLocal("first"),U),L.setLocal("i",L.i32_const(0)),L.block(L.loop(L.br_if(1,L.i32_eq(L.getLocal("i"),L.getLocal("n"))),L.setLocal("idx1",L.i32_add(L.getLocal("pBuff1"),L.i32_mul(L.getLocal("i"),L.i32_const(I)))),L.setLocal("idx2",L.i32_add(L.getLocal("pBuff2"),L.i32_mul(L.getLocal("i"),L.i32_const(I)))),L.call(_,L.getLocal("idx2"),U,p),L.call(i+"_sub",L.getLocal("idx1"),p,L.getLocal("idx2")),L.call(_,L.getLocal("idx2"),L.getLocal("pSConst"),L.getLocal("idx2")),L.call(_,L.getLocal("idx1"),L.getLocal("pShiftToM"),L.getLocal("idx1")),L.call(i+"_sub",p,L.getLocal("idx1"),L.getLocal("idx1")),L.call(_,L.getLocal("idx1"),L.getLocal("pSConst"),L.getLocal("idx1")),L.call(r+"_mul",U,L.getLocal("inc"),U),L.setLocal("i",L.i32_add(L.getLocal("i"),L.i32_const(1))),L.br(0))))}function Ct(){const o=e.addFunction(c+"_prepareLagrangeEvaluation");o.addParam("pBuff1","i32"),o.addParam("pBuff2","i32"),o.addParam("n","i32"),o.addParam("first","i32"),o.addParam("inc","i32"),o.addParam("totalBits","i32"),o.addLocal("idx1","i32"),o.addLocal("idx2","i32"),o.addLocal("i","i32"),o.addLocal("pShiftToM","i32"),o.addLocal("pSConst","i32");const L=o.getCodeBuilder(),U=L.i32_const(e.alloc(l)),p=L.i32_const(e.alloc(I));o.addCode(L.setLocal("pShiftToM",L.i32_add(L.i32_const(x),L.i32_mul(L.getLocal("totalBits"),L.i32_const(l)))),L.setLocal("pSConst",L.i32_add(L.i32_const(H),L.i32_mul(L.getLocal("totalBits"),L.i32_const(l)))),L.call(r+"_copy",L.getLocal("first"),U),L.setLocal("i",L.i32_const(0)),L.block(L.loop(L.br_if(1,L.i32_eq(L.getLocal("i"),L.getLocal("n"))),L.setLocal("idx1",L.i32_add(L.getLocal("pBuff1"),L.i32_mul(L.getLocal("i"),L.i32_const(I)))),L.setLocal("idx2",L.i32_add(L.getLocal("pBuff2"),L.i32_mul(L.getLocal("i"),L.i32_const(I)))),L.call(_,L.getLocal("idx1"),L.getLocal("pShiftToM"),p),L.call(i+"_sub",L.getLocal("idx2"),p,p),L.call(i+"_sub",L.getLocal("idx1"),L.getLocal("idx2"),L.getLocal("idx2")),L.call(_,p,L.getLocal("pSConst"),L.getLocal("idx1")),L.call(_,L.getLocal("idx2"),U,L.getLocal("idx2")),L.call(r+"_mul",U,L.getLocal("inc"),U),L.setLocal("i",L.i32_add(L.getLocal("i"),L.i32_const(1))),L.br(0))))}function St(){const o=e.addFunction(c+"_fftMix");o.addParam("pBuff","i32"),o.addParam("n","i32"),o.addParam("exp","i32"),o.addLocal("nGroups","i32"),o.addLocal("nPerGroup","i32"),o.addLocal("nPerGroupDiv2","i32"),o.addLocal("pairOffset","i32"),o.addLocal("idx1","i32"),o.addLocal("idx2","i32"),o.addLocal("i","i32"),o.addLocal("j","i32"),o.addLocal("pwm","i32");const L=o.getCodeBuilder(),U=L.i32_const(e.alloc(l)),p=L.i32_const(e.alloc(I)),st=L.i32_const(e.alloc(I));o.addCode(L.setLocal("nPerGroup",L.i32_shl(L.i32_const(1),L.getLocal("exp"))),L.setLocal("nPerGroupDiv2",L.i32_shr_u(L.getLocal("nPerGroup"),L.i32_const(1))),L.setLocal("nGroups",L.i32_shr_u(L.getLocal("n"),L.getLocal("exp"))),L.setLocal("pairOffset",L.i32_mul(L.getLocal("nPerGroupDiv2"),L.i32_const(I))),L.setLocal("pwm",L.i32_add(L.i32_const(Z),L.i32_mul(L.getLocal("exp"),L.i32_const(l)))),L.setLocal("i",L.i32_const(0)),L.block(L.loop(L.br_if(1,L.i32_eq(L.getLocal("i"),L.getLocal("nGroups"))),L.call(r+"_one",U),L.setLocal("j",L.i32_const(0)),L.block(L.loop(L.br_if(1,L.i32_eq(L.getLocal("j"),L.getLocal("nPerGroupDiv2"))),L.setLocal("idx1",L.i32_add(L.getLocal("pBuff"),L.i32_mul(L.i32_add(L.i32_mul(L.getLocal("i"),L.getLocal("nPerGroup")),L.getLocal("j")),L.i32_const(I)))),L.setLocal("idx2",L.i32_add(L.getLocal("idx1"),L.getLocal("pairOffset"))),L.call(_,L.getLocal("idx2"),U,p),L.call(i+"_copy",L.getLocal("idx1"),st),L.call(i+"_add",st,p,L.getLocal("idx1")),L.call(i+"_sub",st,p,L.getLocal("idx2")),L.call(r+"_mul",U,L.getLocal("pwm"),U),L.setLocal("j",L.i32_add(L.getLocal("j"),L.i32_const(1))),L.br(0))),L.setLocal("i",L.i32_add(L.getLocal("i"),L.i32_const(1))),L.br(0))))}function F(){const o=e.addFunction(c+"_fftFinal");o.addParam("pBuff","i32"),o.addParam("n","i32"),o.addParam("factor","i32"),o.addLocal("idx1","i32"),o.addLocal("idx2","i32"),o.addLocal("i","i32"),o.addLocal("ndiv2","i32");const L=o.getCodeBuilder(),U=L.i32_const(e.alloc(I));o.addCode(L.setLocal("ndiv2",L.i32_shr_u(L.getLocal("n"),L.i32_const(1))),L.if(L.i32_and(L.getLocal("n"),L.i32_const(1)),L.call(_,L.i32_add(L.getLocal("pBuff"),L.i32_mul(L.getLocal("ndiv2"),L.i32_const(I))),L.getLocal("factor"),L.i32_add(L.getLocal("pBuff"),L.i32_mul(L.getLocal("ndiv2"),L.i32_const(I))))),L.setLocal("i",L.i32_const(0)),L.block(L.loop(L.br_if(1,L.i32_ge_u(L.getLocal("i"),L.getLocal("ndiv2"))),L.setLocal("idx1",L.i32_add(L.getLocal("pBuff"),L.i32_mul(L.getLocal("i"),L.i32_const(I)))),L.setLocal("idx2",L.i32_add(L.getLocal("pBuff"),L.i32_mul(L.i32_sub(L.i32_sub(L.getLocal("n"),L.i32_const(1)),L.getLocal("i")),L.i32_const(I)))),L.call(_,L.getLocal("idx2"),L.getLocal("factor"),U),L.call(_,L.getLocal("idx1"),L.getLocal("factor"),L.getLocal("idx2")),L.call(i+"_copy",U,L.getLocal("idx1")),L.setLocal("i",L.i32_add(L.getLocal("i"),L.i32_const(1))),L.br(0))))}Pt(),xt(),mt(),_t(),v(),S(),et(),zt(),Rt(),k(),St(),F(),Ct(),e.exportFunction(c+"_fft"),e.exportFunction(c+"_ifft"),e.exportFunction(c+"_rawfft"),e.exportFunction(c+"_fftJoin"),e.exportFunction(c+"_fftJoinExt"),e.exportFunction(c+"_fftJoinExtInv"),e.exportFunction(c+"_fftMix"),e.exportFunction(c+"_fftFinal"),e.exportFunction(c+"_prepareLagrangeEvaluation")},Te}var ke,kl;function Ul(){return kl||(kl=1,ke=function(a,n,e){const i=a.modules[e].n64*8;function r(){const u=a.addFunction(n+"_zero");u.addParam("px","i32"),u.addParam("n","i32"),u.addLocal("lastp","i32"),u.addLocal("p","i32");const l=u.getCodeBuilder();u.addCode(l.setLocal("p",l.getLocal("px")),l.setLocal("lastp",l.i32_add(l.getLocal("px"),l.i32_mul(l.getLocal("n"),l.i32_const(i)))),l.block(l.loop(l.br_if(1,l.i32_eq(l.getLocal("p"),l.getLocal("lastp"))),l.call(e+"_zero",l.getLocal("p")),l.setLocal("p",l.i32_add(l.getLocal("p"),l.i32_const(i))),l.br(0))))}function _(){const u=a.addFunction(n+"_constructLC");u.addParam("ppolynomials","i32"),u.addParam("psignals","i32"),u.addParam("nSignals","i32"),u.addParam("pres","i32"),u.addLocal("i","i32"),u.addLocal("j","i32"),u.addLocal("pp","i32"),u.addLocal("ps","i32"),u.addLocal("pd","i32"),u.addLocal("ncoefs","i32");const l=u.getCodeBuilder(),s=l.i32_const(a.alloc(i));u.addCode(l.setLocal("i",l.i32_const(0)),l.setLocal("pp",l.getLocal("ppolynomials")),l.setLocal("ps",l.getLocal("psignals")),l.block(l.loop(l.br_if(1,l.i32_eq(l.getLocal("i"),l.getLocal("nSignals"))),l.setLocal("ncoefs",l.i32_load(l.getLocal("pp"))),l.setLocal("pp",l.i32_add(l.getLocal("pp"),l.i32_const(4))),l.setLocal("j",l.i32_const(0)),l.block(l.loop(l.br_if(1,l.i32_eq(l.getLocal("j"),l.getLocal("ncoefs"))),l.setLocal("pd",l.i32_add(l.getLocal("pres"),l.i32_mul(l.i32_load(l.getLocal("pp")),l.i32_const(i)))),l.setLocal("pp",l.i32_add(l.getLocal("pp"),l.i32_const(4))),l.call(e+"_mul",l.getLocal("ps"),l.getLocal("pp"),s),l.call(e+"_add",s,l.getLocal("pd"),l.getLocal("pd")),l.setLocal("pp",l.i32_add(l.getLocal("pp"),l.i32_const(i))),l.setLocal("j",l.i32_add(l.getLocal("j"),l.i32_const(1))),l.br(0))),l.setLocal("ps",l.i32_add(l.getLocal("ps"),l.i32_const(i))),l.setLocal("i",l.i32_add(l.getLocal("i"),l.i32_const(1))),l.br(0))))}return r(),_(),a.exportFunction(n+"_zero"),a.exportFunction(n+"_constructLC"),n}),ke}var Ue,Nl;function Dl(){return Nl||(Nl=1,Ue=function(a,n,e){const i=a.modules[e].n64*8;function r(){const l=a.addFunction(n+"_buildABC");l.addParam("pCoefs","i32"),l.addParam("nCoefs","i32"),l.addParam("pWitness","i32"),l.addParam("pA","i32"),l.addParam("pB","i32"),l.addParam("pC","i32"),l.addParam("offsetOut","i32"),l.addParam("nOut","i32"),l.addParam("offsetWitness","i32"),l.addParam("nWitness","i32"),l.addLocal("it","i32"),l.addLocal("ita","i32"),l.addLocal("itb","i32"),l.addLocal("last","i32"),l.addLocal("m","i32"),l.addLocal("c","i32"),l.addLocal("s","i32"),l.addLocal("pOut","i32");const s=l.getCodeBuilder(),I=s.i32_const(a.alloc(i));l.addCode(s.setLocal("ita",s.getLocal("pA")),s.setLocal("itb",s.getLocal("pB")),s.setLocal("last",s.i32_add(s.getLocal("pA"),s.i32_mul(s.getLocal("nOut"),s.i32_const(i)))),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal("ita"),s.getLocal("last"))),s.call(e+"_zero",s.getLocal("ita")),s.call(e+"_zero",s.getLocal("itb")),s.setLocal("ita",s.i32_add(s.getLocal("ita"),s.i32_const(i))),s.setLocal("itb",s.i32_add(s.getLocal("itb"),s.i32_const(i))),s.br(0))),s.setLocal("it",s.getLocal("pCoefs")),s.setLocal("last",s.i32_add(s.getLocal("pCoefs"),s.i32_mul(s.getLocal("nCoefs"),s.i32_const(i+12)))),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal("it"),s.getLocal("last"))),s.setLocal("s",s.i32_load(s.getLocal("it"),8)),s.if(s.i32_or(s.i32_lt_u(s.getLocal("s"),s.getLocal("offsetWitness")),s.i32_ge_u(s.getLocal("s"),s.i32_add(s.getLocal("offsetWitness"),s.getLocal("nWitness")))),[...s.setLocal("it",s.i32_add(s.getLocal("it"),s.i32_const(i+12))),...s.br(1)]),s.setLocal("m",s.i32_load(s.getLocal("it"))),s.if(s.i32_eq(s.getLocal("m"),s.i32_const(0)),s.setLocal("pOut",s.getLocal("pA")),s.if(s.i32_eq(s.getLocal("m"),s.i32_const(1)),s.setLocal("pOut",s.getLocal("pB")),[...s.setLocal("it",s.i32_add(s.getLocal("it"),s.i32_const(i+12))),...s.br(1)])),s.setLocal("c",s.i32_load(s.getLocal("it"),4)),s.if(s.i32_or(s.i32_lt_u(s.getLocal("c"),s.getLocal("offsetOut")),s.i32_ge_u(s.getLocal("c"),s.i32_add(s.getLocal("offsetOut"),s.getLocal("nOut")))),[...s.setLocal("it",s.i32_add(s.getLocal("it"),s.i32_const(i+12))),...s.br(1)]),s.setLocal("pOut",s.i32_add(s.getLocal("pOut"),s.i32_mul(s.i32_sub(s.getLocal("c"),s.getLocal("offsetOut")),s.i32_const(i)))),s.call(e+"_mul",s.i32_add(s.getLocal("pWitness"),s.i32_mul(s.i32_sub(s.getLocal("s"),s.getLocal("offsetWitness")),s.i32_const(i))),s.i32_add(s.getLocal("it"),s.i32_const(12)),I),s.call(e+"_add",s.getLocal("pOut"),I,s.getLocal("pOut")),s.setLocal("it",s.i32_add(s.getLocal("it"),s.i32_const(i+12))),s.br(0))),s.setLocal("ita",s.getLocal("pA")),s.setLocal("itb",s.getLocal("pB")),s.setLocal("it",s.getLocal("pC")),s.setLocal("last",s.i32_add(s.getLocal("pA"),s.i32_mul(s.getLocal("nOut"),s.i32_const(i)))),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal("ita"),s.getLocal("last"))),s.call(e+"_mul",s.getLocal("ita"),s.getLocal("itb"),s.getLocal("it")),s.setLocal("ita",s.i32_add(s.getLocal("ita"),s.i32_const(i))),s.setLocal("itb",s.i32_add(s.getLocal("itb"),s.i32_const(i))),s.setLocal("it",s.i32_add(s.getLocal("it"),s.i32_const(i))),s.br(0))))}function _(){const l=a.addFunction(n+"_joinABC");l.addParam("pA","i32"),l.addParam("pB","i32"),l.addParam("pC","i32"),l.addParam("n","i32"),l.addParam("pP","i32"),l.addLocal("ita","i32"),l.addLocal("itb","i32"),l.addLocal("itc","i32"),l.addLocal("itp","i32"),l.addLocal("last","i32");const s=l.getCodeBuilder(),I=s.i32_const(a.alloc(i));l.addCode(s.setLocal("ita",s.getLocal("pA")),s.setLocal("itb",s.getLocal("pB")),s.setLocal("itc",s.getLocal("pC")),s.setLocal("itp",s.getLocal("pP")),s.setLocal("last",s.i32_add(s.getLocal("pA"),s.i32_mul(s.getLocal("n"),s.i32_const(i)))),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal("ita"),s.getLocal("last"))),s.call(e+"_mul",s.getLocal("ita"),s.getLocal("itb"),I),s.call(e+"_sub",I,s.getLocal("itc"),s.getLocal("itp")),s.setLocal("ita",s.i32_add(s.getLocal("ita"),s.i32_const(i))),s.setLocal("itb",s.i32_add(s.getLocal("itb"),s.i32_const(i))),s.setLocal("itc",s.i32_add(s.getLocal("itc"),s.i32_const(i))),s.setLocal("itp",s.i32_add(s.getLocal("itp"),s.i32_const(i))),s.br(0))))}function u(){const l=a.addFunction(n+"_batchAdd");l.addParam("pa","i32"),l.addParam("pb","i32"),l.addParam("n","i32"),l.addParam("pr","i32"),l.addLocal("ita","i32"),l.addLocal("itb","i32"),l.addLocal("itr","i32"),l.addLocal("last","i32");const s=l.getCodeBuilder();l.addCode(s.setLocal("ita",s.getLocal("pa")),s.setLocal("itb",s.getLocal("pb")),s.setLocal("itr",s.getLocal("pr")),s.setLocal("last",s.i32_add(s.getLocal("pa"),s.i32_mul(s.getLocal("n"),s.i32_const(i)))),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal("ita"),s.getLocal("last"))),s.call(e+"_add",s.getLocal("ita"),s.getLocal("itb"),s.getLocal("itr")),s.setLocal("ita",s.i32_add(s.getLocal("ita"),s.i32_const(i))),s.setLocal("itb",s.i32_add(s.getLocal("itb"),s.i32_const(i))),s.setLocal("itr",s.i32_add(s.getLocal("itr"),s.i32_const(i))),s.br(0))))}return r(),_(),u(),a.exportFunction(n+"_buildABC"),a.exportFunction(n+"_joinABC"),a.exportFunction(n+"_batchAdd"),n}),Ue}var Ne,Ql;function $l(){return Ql||(Ql=1,Ne=function(a,n,e,c,i,r,_,u){const l=a.addFunction(n);l.addParam("pIn","i32"),l.addParam("n","i32"),l.addParam("pFirst","i32"),l.addParam("pInc","i32"),l.addParam("pOut","i32"),l.addLocal("pOldFree","i32"),l.addLocal("i","i32"),l.addLocal("pFrom","i32"),l.addLocal("pTo","i32");const s=l.getCodeBuilder(),I=s.i32_const(a.alloc(_));l.addCode(s.setLocal("pFrom",s.getLocal("pIn")),s.setLocal("pTo",s.getLocal("pOut"))),l.addCode(s.call(c+"_copy",s.getLocal("pFirst"),I)),l.addCode(s.setLocal("i",s.i32_const(0)),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal("i"),s.getLocal("n"))),s.call(u,s.getLocal("pFrom"),I,s.getLocal("pTo")),s.setLocal("pFrom",s.i32_add(s.getLocal("pFrom"),s.i32_const(i))),s.setLocal("pTo",s.i32_add(s.getLocal("pTo"),s.i32_const(r))),s.call(c+"_mul",I,s.getLocal("pInc"),I),s.setLocal("i",s.i32_add(s.getLocal("i"),s.i32_const(1))),s.br(0)))),a.exportFunction(n)}),Ne}var De,Gl;function bu(){if(Gl)return De;Gl=1;const t=Gn(),a=Ea(),n=Se(),e=El(),c=xl(),i=ql(),r=zl(),_=Tl(),u=Ul(),l=Dl(),s=$l();return De=function(b,f){const w=f||"bn128";if(b.modules[w])return w;const O=t("21888242871839275222246405745257275088696311157297823662689037894645226208583"),D=t("21888242871839275222246405745257275088548364400416034343698204186575808495617"),G=Math.floor((O.minus(1).bitLength()-1)/64)+1,V=G*8,it=V,Z=V,E=Z*2,M=Z*12,h=b.alloc(a.bigInt2BytesLE(D,it)),y=n(b,O,"f1m");e(b,D,"fr","frm");const q=b.alloc(a.bigInt2BytesLE(P(t(3)),Z)),g=r(b,"g1m","f1m",q);_(b,"frm","frm","frm","frm_mul"),u(b,"pol","frm"),l(b,"qap","frm");const x=c(b,"f1m_neg","f2m","f1m"),H=b.alloc([...a.bigInt2BytesLE(P(t("19485874751759354771024239261021720505790618469301721065564631296452457478373")),Z),...a.bigInt2BytesLE(P(t("266929791119991161246907387137283842545076965332900288569378510910307636690")),Z)]),T=r(b,"g2m","f2m",H);function N(Mt,m){const C=b.addFunction(Mt);C.addParam("pG","i32"),C.addParam("pFr","i32"),C.addParam("pr","i32");const R=C.getCodeBuilder(),d=R.i32_const(b.alloc(V));C.addCode(R.call("frm_fromMontgomery",R.getLocal("pFr"),d),R.call(m,R.getLocal("pG"),d,R.i32_const(V),R.getLocal("pr"))),b.exportFunction(Mt)}N("g1m_timesFr","g1m_timesScalar"),_(b,"g1m","g1m","frm","g1m_timesFr"),N("g2m_timesFr","g2m_timesScalar"),_(b,"g2m","g2m","frm","g2m_timesFr"),N("g1m_timesFrAffine","g1m_timesScalarAffine"),N("g2m_timesFrAffine","g2m_timesScalarAffine"),s(b,"frm_batchApplyKey","fmr","frm",V,V,V,"frm_mul"),s(b,"g1m_batchApplyKey","g1m","frm",V*3,V*3,V,"g1m_timesFr"),s(b,"g1m_batchApplyKeyMixed","g1m","frm",V*2,V*3,V,"g1m_timesFrAffine"),s(b,"g2m_batchApplyKey","g2m","frm",V*2*3,V*3*2,V,"g2m_timesFr"),s(b,"g2m_batchApplyKeyMixed","g2m","frm",V*2*2,V*3*2,V,"g2m_timesFrAffine");function P(Mt){return t(Mt).times(t.one.shiftLeft(Z*8)).mod(O)}const v=[t("1"),t("2"),t.one],S=b.alloc([...a.bigInt2BytesLE(P(v[0]),Z),...a.bigInt2BytesLE(P(v[1]),Z),...a.bigInt2BytesLE(P(v[2]),Z)]),et=[t.zero,t.one,t.zero],_t=b.alloc([...a.bigInt2BytesLE(P(et[0]),Z),...a.bigInt2BytesLE(P(et[1]),Z),...a.bigInt2BytesLE(P(et[2]),Z)]),mt=[[t("10857046999023057135944570762232829481370756359578518086990519993285655852781"),t("11559732032986387107991004021392285783925812861821192530917403151452391805634")],[t("8495653923123431417604973247489272438418190587263600148770280649306958101930"),t("4082367875863433681332203403145435568316851327593401208105741076214120093531")],[t.one,t.zero]],xt=b.alloc([...a.bigInt2BytesLE(P(mt[0][0]),Z),...a.bigInt2BytesLE(P(mt[0][1]),Z),...a.bigInt2BytesLE(P(mt[1][0]),Z),...a.bigInt2BytesLE(P(mt[1][1]),Z),...a.bigInt2BytesLE(P(mt[2][0]),Z),...a.bigInt2BytesLE(P(mt[2][1]),Z)]),Pt=[[t.zero,t.zero],[t.one,t.zero],[t.zero,t.zero]],zt=b.alloc([...a.bigInt2BytesLE(P(Pt[0][0]),Z),...a.bigInt2BytesLE(P(Pt[0][1]),Z),...a.bigInt2BytesLE(P(Pt[1][0]),Z),...a.bigInt2BytesLE(P(Pt[1][1]),Z),...a.bigInt2BytesLE(P(Pt[2][0]),Z),...a.bigInt2BytesLE(P(Pt[2][1]),Z)]),Rt=b.alloc([...a.bigInt2BytesLE(P(1),Z),...a.bigInt2BytesLE(P(0),Z),...a.bigInt2BytesLE(P(0),Z),...a.bigInt2BytesLE(P(0),Z),...a.bigInt2BytesLE(P(0),Z),...a.bigInt2BytesLE(P(0),Z),...a.bigInt2BytesLE(P(0),Z),...a.bigInt2BytesLE(P(0),Z),...a.bigInt2BytesLE(P(0),Z),...a.bigInt2BytesLE(P(0),Z),...a.bigInt2BytesLE(P(0),Z),...a.bigInt2BytesLE(P(0),Z)]),k=b.alloc([...a.bigInt2BytesLE(P(9),Z),...a.bigInt2BytesLE(P(1),Z)]),Ct=b.alloc([...a.bigInt2BytesLE(P(t(2).modInv(O)),Z),...a.bigInt2BytesLE(t(0),Z)]),St=k,F=b.alloc([...a.bigInt2BytesLE(P("19485874751759354771024239261021720505790618469301721065564631296452457478373"),Z),...a.bigInt2BytesLE(P("266929791119991161246907387137283842545076965332900288569378510910307636690"),Z)]);function o(){const Mt=b.addFunction(w+"_mulNR6");Mt.addParam("x","i32"),Mt.addParam("pr","i32");const m=Mt.getCodeBuilder();Mt.addCode(m.call(x+"_mul",m.i32_const(k),m.getLocal("x"),m.getLocal("pr")))}o();const L=i(b,w+"_mulNR6","f6m","f2m");function U(){const Mt=b.addFunction(w+"_mulNR12");Mt.addParam("x","i32"),Mt.addParam("pr","i32");const m=Mt.getCodeBuilder();Mt.addCode(m.call(x+"_mul",m.i32_const(k),m.i32_add(m.getLocal("x"),m.i32_const(V*4)),m.getLocal("pr")),m.call(x+"_copy",m.getLocal("x"),m.i32_add(m.getLocal("pr"),m.i32_const(V*2))),m.call(x+"_copy",m.i32_add(m.getLocal("x"),m.i32_const(V*2)),m.i32_add(m.getLocal("pr"),m.i32_const(V*4))))}U();const p=c(b,w+"_mulNR12","ftm",L),st=t("29793968203157093288"),qt=Lt(st),wt=b.alloc(qt),nt=3*E,Q=qt.length-1,lt=qt.reduce((Mt,m)=>Mt+(m!=0?1:0),0)+Q+1,Ft=3*2*V,Ut=3*V*2+lt*nt;b.modules[w]={n64:G,pG1gen:S,pG1zero:_t,pG1b:q,pG2gen:xt,pG2zero:zt,pG2b:H,pq:b.modules.f1m.pq,pr:h,pOneT:Rt,prePSize:Ft,preQSize:Ut,r:D.toString(),q:O.toString()};const dt=t("4965661367192848881");function B(Mt){let m=Mt;const C=[];for(;m.gt(t.zero);){if(m.isOdd()){const R=2-m.mod(4).toJSNumber();C.push(R),m=m.minus(R)}else C.push(0);m=m.shiftRight(1)}return C}function Lt(Mt){let m=Mt;const C=[];for(;m.gt(t.zero);)m.isOdd()?C.push(1):C.push(0),m=m.shiftRight(1);return C}function Gt(){const Mt=b.addFunction(w+"_prepareG1");Mt.addParam("pP","i32"),Mt.addParam("ppreP","i32");const m=Mt.getCodeBuilder();Mt.addCode(m.call(g+"_normalize",m.getLocal("pP"),m.getLocal("ppreP")))}function z(){const Mt=b.addFunction(w+"_prepAddStep");Mt.addParam("pQ","i32"),Mt.addParam("pR","i32"),Mt.addParam("pCoef","i32");const m=Mt.getCodeBuilder(),C=m.getLocal("pQ"),R=m.i32_add(m.getLocal("pQ"),m.i32_const(E)),d=m.getLocal("pR"),j=m.i32_add(m.getLocal("pR"),m.i32_const(E)),W=m.i32_add(m.getLocal("pR"),m.i32_const(2*E)),K=m.getLocal("pCoef"),J=m.i32_add(m.getLocal("pCoef"),m.i32_const(E)),tt=m.i32_add(m.getLocal("pCoef"),m.i32_const(2*E)),rt=J,ct=m.i32_const(b.alloc(E)),ht=m.i32_const(b.alloc(E)),bt=m.i32_const(b.alloc(E)),At=m.i32_const(b.alloc(E)),Et=m.i32_const(b.alloc(E)),Nt=m.i32_const(b.alloc(E)),Tt=m.i32_const(b.alloc(E));Mt.addCode(m.call(x+"_mul",C,W,rt),m.call(x+"_sub",d,rt,rt),m.call(x+"_mul",R,W,ct),m.call(x+"_sub",j,ct,ct),m.call(x+"_square",rt,ht),m.call(x+"_square",ct,bt),m.call(x+"_mul",rt,ht,At),m.call(x+"_mul",d,ht,Et),m.call(x+"_add",Et,Et,Tt),m.call(x+"_mul",W,bt,Nt),m.call(x+"_add",At,Nt,Nt),m.call(x+"_sub",Nt,Tt,Nt),m.call(x+"_mul",rt,Nt,d),m.call(x+"_mul",At,j,j),m.call(x+"_sub",Et,Nt,Tt),m.call(x+"_mul",ct,Tt,Tt),m.call(x+"_sub",Tt,j,j),m.call(x+"_mul",W,At,W),m.call(x+"_mul",rt,R,Tt),m.call(x+"_mul",ct,C,K),m.call(x+"_sub",K,Tt,K),m.call(x+"_mul",K,m.i32_const(St),K),m.call(x+"_neg",ct,tt))}function $(){const Mt=b.addFunction(w+"_prepDblStep");Mt.addParam("pR","i32"),Mt.addParam("pCoef","i32");const m=Mt.getCodeBuilder(),C=m.getLocal("pR"),R=m.i32_add(m.getLocal("pR"),m.i32_const(E)),d=m.i32_add(m.getLocal("pR"),m.i32_const(2*E)),j=m.getLocal("pCoef"),W=m.i32_add(m.getLocal("pCoef"),m.i32_const(E)),K=m.i32_add(m.getLocal("pCoef"),m.i32_const(2*E)),J=m.i32_const(b.alloc(E)),tt=m.i32_const(b.alloc(E)),rt=m.i32_const(b.alloc(E)),ct=m.i32_const(b.alloc(E)),ht=m.i32_const(b.alloc(E)),bt=m.i32_const(b.alloc(E)),At=m.i32_const(b.alloc(E)),Et=m.i32_const(b.alloc(E)),Nt=m.i32_const(b.alloc(E)),Tt=m.i32_const(b.alloc(E)),$t=m.i32_const(b.alloc(E)),Qt=m.i32_const(b.alloc(E));Mt.addCode(m.call(x+"_mul",R,m.i32_const(Ct),J),m.call(x+"_mul",C,J,J),m.call(x+"_square",R,tt),m.call(x+"_square",d,rt),m.call(x+"_add",rt,rt,ct),m.call(x+"_add",ct,rt,ct),m.call(x+"_mul",m.i32_const(F),ct,ht),m.call(x+"_add",ht,ht,bt),m.call(x+"_add",ht,bt,bt),m.call(x+"_add",tt,bt,At),m.call(x+"_mul",At,m.i32_const(Ct),At),m.call(x+"_add",tt,rt,Qt),m.call(x+"_add",R,d,Et),m.call(x+"_square",Et,Et),m.call(x+"_sub",Et,Qt,Et),m.call(x+"_sub",ht,tt,Nt),m.call(x+"_square",C,Tt),m.call(x+"_square",ht,$t),m.call(x+"_sub",tt,bt,Qt),m.call(x+"_mul",J,Qt,C),m.call(x+"_add",$t,$t,Qt),m.call(x+"_add",$t,Qt,Qt),m.call(x+"_square",At,R),m.call(x+"_sub",R,Qt,R),m.call(x+"_mul",tt,Et,d),m.call(x+"_mul",m.i32_const(St),Nt,j),m.call(x+"_neg",Et,W),m.call(x+"_add",Tt,Tt,K),m.call(x+"_add",Tt,K,K))}function X(){const Mt=b.addFunction(w+"_mulByQ");Mt.addParam("p1","i32"),Mt.addParam("pr","i32");const m=Mt.getCodeBuilder(),C=m.getLocal("p1"),R=m.i32_add(m.getLocal("p1"),m.i32_const(E)),d=m.i32_add(m.getLocal("p1"),m.i32_const(E*2)),j=m.getLocal("pr"),W=m.i32_add(m.getLocal("pr"),m.i32_const(E)),K=m.i32_add(m.getLocal("pr"),m.i32_const(E*2)),J=m.i32_const(b.alloc([...a.bigInt2BytesLE(P("21575463638280843010398324269430826099269044274347216827212613867836435027261"),Z),...a.bigInt2BytesLE(P("10307601595873709700152284273816112264069230130616436755625194854815875713954"),Z)])),tt=m.i32_const(b.alloc([...a.bigInt2BytesLE(P("2821565182194536844548159561693502659359617185244120367078079554186484126554"),Z),...a.bigInt2BytesLE(P("3505843767911556378687030309984248845540243509899259641013678093033130930403"),Z)]));Mt.addCode(m.call(x+"_conjugate",C,j),m.call(x+"_mul",J,j,j),m.call(x+"_conjugate",R,W),m.call(x+"_mul",tt,W,W),m.call(x+"_conjugate",d,K))}function at(){X();const Mt=b.addFunction(w+"_prepareG2");Mt.addParam("pQ","i32"),Mt.addParam("ppreQ","i32"),Mt.addLocal("pCoef","i32"),Mt.addLocal("i","i32");const m=Mt.getCodeBuilder(),C=m.getLocal("pQ");m.i32_add(m.getLocal("pQ"),m.i32_const(E)),m.i32_add(m.getLocal("pQ"),m.i32_const(E*2));const R=b.alloc(E*3),d=m.i32_const(R),j=m.i32_const(R),W=m.i32_const(R+E),K=m.i32_const(R+2*E),J=m.i32_add(m.getLocal("ppreQ"),m.i32_const(0)),tt=m.i32_add(m.getLocal("ppreQ"),m.i32_const(E));m.i32_add(m.getLocal("ppreQ"),m.i32_const(E*2));const rt=b.alloc(E*3),ct=m.i32_const(rt),ht=b.alloc(E*3),bt=m.i32_const(ht);m.i32_const(ht);const At=m.i32_const(ht+E);m.i32_const(ht+E*2),Mt.addCode(m.call(T+"_normalize",C,J),m.call(x+"_copy",J,j),m.call(x+"_copy",tt,W),m.call(x+"_one",K)),Mt.addCode(m.setLocal("pCoef",m.i32_add(m.getLocal("ppreQ"),m.i32_const(E*3))),m.setLocal("i",m.i32_const(qt.length-2)),m.block(m.loop(m.call(w+"_prepDblStep",d,m.getLocal("pCoef")),m.setLocal("pCoef",m.i32_add(m.getLocal("pCoef"),m.i32_const(nt))),m.if(m.i32_load8_s(m.getLocal("i"),wt),[...m.call(w+"_prepAddStep",J,d,m.getLocal("pCoef")),...m.setLocal("pCoef",m.i32_add(m.getLocal("pCoef"),m.i32_const(nt)))]),m.br_if(1,m.i32_eqz(m.getLocal("i"))),m.setLocal("i",m.i32_sub(m.getLocal("i"),m.i32_const(1))),m.br(0)))),Mt.addCode(m.call(w+"_mulByQ",J,ct),m.call(w+"_mulByQ",ct,bt)),Mt.addCode(m.call(x+"_neg",At,At),m.call(w+"_prepAddStep",ct,d,m.getLocal("pCoef")),m.setLocal("pCoef",m.i32_add(m.getLocal("pCoef"),m.i32_const(nt))),m.call(w+"_prepAddStep",bt,d,m.getLocal("pCoef")),m.setLocal("pCoef",m.i32_add(m.getLocal("pCoef"),m.i32_const(nt))))}function gt(){const Mt=b.addFunction(w+"__mulBy024Old");Mt.addParam("pEll0","i32"),Mt.addParam("pEllVW","i32"),Mt.addParam("pEllVV","i32"),Mt.addParam("pR","i32");const m=Mt.getCodeBuilder(),C=m.getLocal("pEll0"),R=m.getLocal("pEllVV"),d=m.getLocal("pEllVW"),j=m.getLocal("pR"),W=b.alloc(M),K=m.i32_const(W),J=m.i32_const(W),tt=m.i32_const(W+E),rt=m.i32_const(W+E*2),ct=m.i32_const(W+E*3),ht=m.i32_const(W+E*4),bt=m.i32_const(W+E*5);Mt.addCode(m.call(x+"_copy",C,J),m.call(x+"_zero",tt),m.call(x+"_copy",R,rt),m.call(x+"_zero",ct),m.call(x+"_copy",d,ht),m.call(x+"_zero",bt),m.call(p+"_mul",K,j,j))}function ft(){const Mt=b.addFunction(w+"__mulBy024");Mt.addParam("pEll0","i32"),Mt.addParam("pEllVW","i32"),Mt.addParam("pEllVV","i32"),Mt.addParam("pR","i32");const m=Mt.getCodeBuilder(),C=m.getLocal("pEll0"),R=m.getLocal("pEllVV"),d=m.getLocal("pEllVW"),j=m.getLocal("pR"),W=m.i32_add(m.getLocal("pR"),m.i32_const(2*V)),K=m.i32_add(m.getLocal("pR"),m.i32_const(4*V)),J=m.i32_add(m.getLocal("pR"),m.i32_const(6*V)),tt=m.i32_add(m.getLocal("pR"),m.i32_const(8*V)),rt=m.i32_add(m.getLocal("pR"),m.i32_const(10*V)),ct=m.i32_const(b.alloc(E)),ht=m.i32_const(b.alloc(E)),bt=m.i32_const(b.alloc(E)),At=m.i32_const(b.alloc(E)),Et=m.i32_const(b.alloc(E)),Nt=m.i32_const(b.alloc(E)),Tt=m.i32_const(b.alloc(E)),$t=m.i32_const(b.alloc(E)),Qt=m.i32_const(b.alloc(E)),jt=m.i32_const(b.alloc(E)),kt=m.i32_const(b.alloc(E));Mt.addCode(m.call(x+"_mul",j,C,Tt),m.call(x+"_mul",K,R,$t),m.call(x+"_mul",tt,d,Qt),m.call(x+"_add",j,tt,bt),m.call(x+"_add",j,K,ht),m.call(x+"_add",W,J,At),m.call(x+"_add",At,rt,At),m.call(x+"_mul",W,R,jt),m.call(x+"_add",jt,Qt,Et),m.call(x+"_mul",m.i32_const(k),Et,Nt),m.call(x+"_add",Nt,Tt,j),m.call(x+"_mul",rt,d,Et),m.call(x+"_add",jt,Et,jt),m.call(x+"_add",Et,$t,Et),m.call(x+"_mul",m.i32_const(k),Et,Nt),m.call(x+"_mul",W,C,Et),m.call(x+"_add",jt,Et,jt),m.call(x+"_add",Nt,Et,W),m.call(x+"_add",C,R,ct),m.call(x+"_mul",ht,ct,Et),m.call(x+"_add",Tt,$t,kt),m.call(x+"_sub",Et,kt,Et),m.call(x+"_mul",J,d,Nt),m.call(x+"_add",jt,Nt,jt),m.call(x+"_add",K,tt,ct),m.call(x+"_add",Et,Nt,K),m.call(x+"_add",R,d,ht),m.call(x+"_mul",ht,ct,Et),m.call(x+"_add",$t,Qt,kt),m.call(x+"_sub",Et,kt,Et),m.call(x+"_mul",m.i32_const(k),Et,Nt),m.call(x+"_mul",J,C,Et),m.call(x+"_add",jt,Et,jt),m.call(x+"_add",Nt,Et,J),m.call(x+"_mul",rt,R,Et),m.call(x+"_add",jt,Et,jt),m.call(x+"_mul",m.i32_const(k),Et,Nt),m.call(x+"_add",C,d,ct),m.call(x+"_mul",bt,ct,Et),m.call(x+"_add",Tt,Qt,kt),m.call(x+"_sub",Et,kt,Et),m.call(x+"_add",Nt,Et,tt),m.call(x+"_add",C,R,ct),m.call(x+"_add",ct,d,ct),m.call(x+"_mul",At,ct,Et),m.call(x+"_sub",Et,jt,rt))}function Bt(){const Mt=b.addFunction(w+"_millerLoop");Mt.addParam("ppreP","i32"),Mt.addParam("ppreQ","i32"),Mt.addParam("r","i32"),Mt.addLocal("pCoef","i32"),Mt.addLocal("i","i32");const m=Mt.getCodeBuilder(),C=m.getLocal("ppreP"),R=m.i32_add(m.getLocal("ppreP"),m.i32_const(Z)),d=m.getLocal("pCoef"),j=m.i32_add(m.getLocal("pCoef"),m.i32_const(E)),W=m.i32_add(m.getLocal("pCoef"),m.i32_const(2*E)),K=b.alloc(E),J=m.i32_const(K),tt=b.alloc(E),rt=m.i32_const(tt),ct=m.getLocal("r");Mt.addCode(m.call(p+"_one",ct),m.setLocal("pCoef",m.i32_add(m.getLocal("ppreQ"),m.i32_const(E*3))),m.setLocal("i",m.i32_const(qt.length-2)),m.block(m.loop(m.call(p+"_square",ct,ct),m.call(x+"_mul1",j,R,J),m.call(x+"_mul1",W,C,rt),m.call(w+"__mulBy024",d,J,rt,ct),m.setLocal("pCoef",m.i32_add(m.getLocal("pCoef"),m.i32_const(nt))),m.if(m.i32_load8_s(m.getLocal("i"),wt),[...m.call(x+"_mul1",j,R,J),...m.call(x+"_mul1",W,C,rt),...m.call(w+"__mulBy024",d,J,rt,ct),...m.setLocal("pCoef",m.i32_add(m.getLocal("pCoef"),m.i32_const(nt)))]),m.br_if(1,m.i32_eqz(m.getLocal("i"))),m.setLocal("i",m.i32_sub(m.getLocal("i"),m.i32_const(1))),m.br(0)))),Mt.addCode(m.call(x+"_mul1",j,R,J),m.call(x+"_mul1",W,C,rt),m.call(w+"__mulBy024",d,J,rt,ct),m.setLocal("pCoef",m.i32_add(m.getLocal("pCoef"),m.i32_const(nt))),m.call(x+"_mul1",j,R,J),m.call(x+"_mul1",W,C,rt),m.call(w+"__mulBy024",d,J,rt,ct),m.setLocal("pCoef",m.i32_add(m.getLocal("pCoef"),m.i32_const(nt))))}function pt(Mt){const m=[[[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")]],[[t("1"),t("0")],[t("8376118865763821496583973867626364092589906065868298776909617916018768340080"),t("16469823323077808223889137241176536799009286646108169935659301613961712198316")],[t("21888242871839275220042445260109153167277707414472061641714758635765020556617"),t("0")],[t("11697423496358154304825782922584725312912383441159505038794027105778954184319"),t("303847389135065887422783454877609941456349188919719272345083954437860409601")],[t("21888242871839275220042445260109153167277707414472061641714758635765020556616"),t("0")],[t("3321304630594332808241809054958361220322477375291206261884409189760185844239"),t("5722266937896532885780051958958348231143373700109372999374820235121374419868")],[t("21888242871839275222246405745257275088696311157297823662689037894645226208582"),t("0")],[t("13512124006075453725662431877630910996106405091429524885779419978626457868503"),t("5418419548761466998357268504080738289687024511189653727029736280683514010267")],[t("2203960485148121921418603742825762020974279258880205651966"),t("0")],[t("10190819375481120917420622822672549775783927716138318623895010788866272024264"),t("21584395482704209334823622290379665147239961968378104390343953940207365798982")],[t("2203960485148121921418603742825762020974279258880205651967"),t("0")],[t("18566938241244942414004596690298913868373833782006617400804628704885040364344"),t("16165975933942742336466353786298926857552937457188450663314217659523851788715")]]],C=[[[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")]],[[t("1"),t("0")],[t("21575463638280843010398324269430826099269044274347216827212613867836435027261"),t("10307601595873709700152284273816112264069230130616436755625194854815875713954")],[t("21888242871839275220042445260109153167277707414472061641714758635765020556616"),t("0")],[t("3772000881919853776433695186713858239009073593817195771773381919316419345261"),t("2236595495967245188281701248203181795121068902605861227855261137820944008926")],[t("2203960485148121921418603742825762020974279258880205651966"),t("0")],[t("18429021223477853657660792034369865839114504446431234726392080002137598044644"),t("9344045779998320333812420223237981029506012124075525679208581902008406485703")]],[[t("1"),t("0")],[t("2581911344467009335267311115468803099551665605076196740867805258568234346338"),t("19937756971775647987995932169929341994314640652964949448313374472400716661030")],[t("2203960485148121921418603742825762020974279258880205651966"),t("0")],[t("5324479202449903542726783395506214481928257762400643279780343368557297135718"),t("16208900380737693084919495127334387981393726419856888799917914180988844123039")],[t("21888242871839275220042445260109153167277707414472061641714758635765020556616"),t("0")],[t("13981852324922362344252311234282257507216387789820983642040889267519694726527"),t("7629828391165209371577384193250820201684255241773809077146787135900891633097")]]],R=b.addFunction(w+"__frobeniusMap"+Mt);R.addParam("x","i32"),R.addParam("r","i32");const d=R.getCodeBuilder();for(let W=0;W<6;W++){const K=W==0?d.getLocal("x"):d.i32_add(d.getLocal("x"),d.i32_const(W*E)),J=K,tt=d.i32_add(d.getLocal("x"),d.i32_const(W*E+Z)),rt=W==0?d.getLocal("r"):d.i32_add(d.getLocal("r"),d.i32_const(W*E)),ct=rt,ht=d.i32_add(d.getLocal("r"),d.i32_const(W*E+Z)),bt=j(m[Math.floor(W/3)][Mt%12],C[W%3][Mt%6]),At=b.alloc([...a.bigInt2BytesLE(P(bt[0]),32),...a.bigInt2BytesLE(P(bt[1]),32)]);Mt%2==1?R.addCode(d.call(y+"_copy",J,ct),d.call(y+"_neg",tt,ht),d.call(x+"_mul",rt,d.i32_const(At),rt)):R.addCode(d.call(x+"_mul",K,d.i32_const(At),rt))}function j(W,K){const J=t(W[0]),tt=t(W[1]),rt=t(K[0]),ct=t(K[1]),ht=[J.times(rt).minus(tt.times(ct)).mod(O),J.times(ct).add(tt.times(rt)).mod(O)];return ht[0].isNegative()&&(ht[0]=ht[0].add(O)),ht}}function Ot(){const Mt=b.addFunction(w+"__finalExponentiationFirstChunk");Mt.addParam("x","i32"),Mt.addParam("r","i32");const m=Mt.getCodeBuilder(),C=m.getLocal("x"),R=C,d=m.i32_add(C,m.i32_const(V*6)),j=m.getLocal("r"),W=b.alloc(M),K=m.i32_const(W),J=K,tt=m.i32_const(W+V*6),rt=m.i32_const(b.alloc(M)),ct=m.i32_const(b.alloc(M)),ht=m.i32_const(b.alloc(M));Mt.addCode(m.call(L+"_copy",R,J),m.call(L+"_neg",d,tt),m.call(p+"_inverse",C,rt),m.call(p+"_mul",K,rt,ct),m.call(w+"__frobeniusMap2",ct,ht),m.call(p+"_mul",ct,ht,j))}function Ht(){const Mt=b.addFunction(w+"__cyclotomicSquare");Mt.addParam("x","i32"),Mt.addParam("r","i32");const m=Mt.getCodeBuilder(),C=m.getLocal("x"),R=m.i32_add(m.getLocal("x"),m.i32_const(E)),d=m.i32_add(m.getLocal("x"),m.i32_const(2*E)),j=m.i32_add(m.getLocal("x"),m.i32_const(3*E)),W=m.i32_add(m.getLocal("x"),m.i32_const(4*E)),K=m.i32_add(m.getLocal("x"),m.i32_const(5*E)),J=m.getLocal("r"),tt=m.i32_add(m.getLocal("r"),m.i32_const(E)),rt=m.i32_add(m.getLocal("r"),m.i32_const(2*E)),ct=m.i32_add(m.getLocal("r"),m.i32_const(3*E)),ht=m.i32_add(m.getLocal("r"),m.i32_const(4*E)),bt=m.i32_add(m.getLocal("r"),m.i32_const(5*E)),At=m.i32_const(b.alloc(E)),Et=m.i32_const(b.alloc(E)),Nt=m.i32_const(b.alloc(E)),Tt=m.i32_const(b.alloc(E)),$t=m.i32_const(b.alloc(E)),Qt=m.i32_const(b.alloc(E)),jt=m.i32_const(b.alloc(E)),kt=m.i32_const(b.alloc(E));Mt.addCode(m.call(x+"_mul",C,W,jt),m.call(x+"_mul",W,m.i32_const(k),At),m.call(x+"_add",C,At,At),m.call(x+"_add",C,W,kt),m.call(x+"_mul",kt,At,At),m.call(x+"_mul",m.i32_const(k),jt,kt),m.call(x+"_add",jt,kt,kt),m.call(x+"_sub",At,kt,At),m.call(x+"_add",jt,jt,Et),m.call(x+"_mul",j,d,jt),m.call(x+"_mul",d,m.i32_const(k),Nt),m.call(x+"_add",j,Nt,Nt),m.call(x+"_add",j,d,kt),m.call(x+"_mul",kt,Nt,Nt),m.call(x+"_mul",m.i32_const(k),jt,kt),m.call(x+"_add",jt,kt,kt),m.call(x+"_sub",Nt,kt,Nt),m.call(x+"_add",jt,jt,Tt),m.call(x+"_mul",R,K,jt),m.call(x+"_mul",K,m.i32_const(k),$t),m.call(x+"_add",R,$t,$t),m.call(x+"_add",R,K,kt),m.call(x+"_mul",kt,$t,$t),m.call(x+"_mul",m.i32_const(k),jt,kt),m.call(x+"_add",jt,kt,kt),m.call(x+"_sub",$t,kt,$t),m.call(x+"_add",jt,jt,Qt),m.call(x+"_sub",At,C,J),m.call(x+"_add",J,J,J),m.call(x+"_add",At,J,J),m.call(x+"_add",Et,W,ht),m.call(x+"_add",ht,ht,ht),m.call(x+"_add",Et,ht,ht),m.call(x+"_mul",Qt,m.i32_const(St),kt),m.call(x+"_add",kt,j,ct),m.call(x+"_add",ct,ct,ct),m.call(x+"_add",kt,ct,ct),m.call(x+"_sub",$t,d,rt),m.call(x+"_add",rt,rt,rt),m.call(x+"_add",$t,rt,rt),m.call(x+"_sub",Nt,R,tt),m.call(x+"_add",tt,tt,tt),m.call(x+"_add",Nt,tt,tt),m.call(x+"_add",Tt,K,bt),m.call(x+"_add",bt,bt,bt),m.call(x+"_add",Tt,bt,bt))}function on(Mt,m){const C=B(Mt).map(tt=>tt==-1?255:tt),R=b.alloc(C);b.alloc(a.bigInt2BytesLE(Mt,32));const d=b.addFunction(w+"__cyclotomicExp_"+m);d.addParam("x","i32"),d.addParam("r","i32"),d.addLocal("bit","i32"),d.addLocal("i","i32");const j=d.getCodeBuilder(),W=j.getLocal("x"),K=j.getLocal("r"),J=j.i32_const(b.alloc(M));d.addCode(j.call(p+"_conjugate",W,J),j.call(p+"_one",K),j.if(j.teeLocal("bit",j.i32_load8_s(j.i32_const(C.length-1),R)),j.if(j.i32_eq(j.getLocal("bit"),j.i32_const(1)),j.call(p+"_mul",K,W,K),j.call(p+"_mul",K,J,K))),j.setLocal("i",j.i32_const(C.length-2)),j.block(j.loop(j.call(w+"__cyclotomicSquare",K,K),j.if(j.teeLocal("bit",j.i32_load8_s(j.getLocal("i"),R)),j.if(j.i32_eq(j.getLocal("bit"),j.i32_const(1)),j.call(p+"_mul",K,W,K),j.call(p+"_mul",K,J,K))),j.br_if(1,j.i32_eqz(j.getLocal("i"))),j.setLocal("i",j.i32_sub(j.getLocal("i"),j.i32_const(1))),j.br(0))))}function an(){Ht(),on(dt,"w0");const Mt=b.addFunction(w+"__finalExponentiationLastChunk");Mt.addParam("x","i32"),Mt.addParam("r","i32");const m=Mt.getCodeBuilder(),C=m.getLocal("x"),R=m.getLocal("r"),d=m.i32_const(b.alloc(M)),j=m.i32_const(b.alloc(M)),W=m.i32_const(b.alloc(M)),K=m.i32_const(b.alloc(M)),J=m.i32_const(b.alloc(M)),tt=m.i32_const(b.alloc(M)),rt=m.i32_const(b.alloc(M)),ct=m.i32_const(b.alloc(M)),ht=m.i32_const(b.alloc(M)),bt=m.i32_const(b.alloc(M)),At=m.i32_const(b.alloc(M)),Et=m.i32_const(b.alloc(M)),Nt=m.i32_const(b.alloc(M)),Tt=m.i32_const(b.alloc(M)),$t=m.i32_const(b.alloc(M)),Qt=m.i32_const(b.alloc(M)),jt=m.i32_const(b.alloc(M)),kt=m.i32_const(b.alloc(M)),tn=m.i32_const(b.alloc(M)),Wt=m.i32_const(b.alloc(M)),Jt=m.i32_const(b.alloc(M));Mt.addCode(m.call(w+"__cyclotomicExp_w0",C,d),m.call(p+"_conjugate",d,d),m.call(w+"__cyclotomicSquare",d,j),m.call(w+"__cyclotomicSquare",j,W),m.call(p+"_mul",W,j,K),m.call(w+"__cyclotomicExp_w0",K,J),m.call(p+"_conjugate",J,J),m.call(w+"__cyclotomicSquare",J,tt),m.call(w+"__cyclotomicExp_w0",tt,rt),m.call(p+"_conjugate",rt,rt),m.call(p+"_conjugate",K,ct),m.call(p+"_conjugate",rt,ht),m.call(p+"_mul",ht,J,bt),m.call(p+"_mul",bt,ct,At),m.call(p+"_mul",At,j,Et),m.call(p+"_mul",At,J,Nt),m.call(p+"_mul",Nt,C,Tt),m.call(w+"__frobeniusMap1",Et,$t),m.call(p+"_mul",$t,Tt,Qt),m.call(w+"__frobeniusMap2",At,jt),m.call(p+"_mul",jt,Qt,kt),m.call(p+"_conjugate",C,tn),m.call(p+"_mul",tn,Et,Wt),m.call(w+"__frobeniusMap3",Wt,Jt),m.call(p+"_mul",Jt,kt,R))}function en(){Ot(),an();const Mt=b.addFunction(w+"_finalExponentiation");Mt.addParam("x","i32"),Mt.addParam("r","i32");const m=Mt.getCodeBuilder(),C=m.getLocal("x"),R=m.getLocal("r"),d=m.i32_const(b.alloc(M));Mt.addCode(m.call(w+"__finalExponentiationFirstChunk",C,d),m.call(w+"__finalExponentiationLastChunk",d,R))}function rn(){const Mt=b.addFunction(w+"_finalExponentiationOld");Mt.addParam("x","i32"),Mt.addParam("r","i32");const m=t("552484233613224096312617126783173147097382103762957654188882734314196910839907541213974502761540629817009608548654680343627701153829446747810907373256841551006201639677726139946029199968412598804882391702273019083653272047566316584365559776493027495458238373902875937659943504873220554161550525926302303331747463515644711876653177129578303191095900909191624817826566688241804408081892785725967931714097716709526092261278071952560171111444072049229123565057483750161460024353346284167282452756217662335528813519139808291170539072125381230815729071544861602750936964829313608137325426383735122175229541155376346436093930287402089517426973178917569713384748081827255472576937471496195752727188261435633271238710131736096299798168852925540549342330775279877006784354801422249722573783561685179618816480037695005515426162362431072245638324744480"),C=b.alloc(a.bigInt2BytesLE(m,352)),R=Mt.getCodeBuilder();Mt.addCode(R.call(p+"_exp",R.getLocal("x"),R.i32_const(C),R.i32_const(352),R.getLocal("r")))}const cn=b.alloc(Ft),fn=b.alloc(Ut);function Ln(Mt){const m=b.addFunction(w+"_pairingEq"+Mt);for(let j=0;j<Mt;j++)m.addParam("p_"+j,"i32"),m.addParam("q_"+j,"i32");m.addParam("c","i32"),m.setReturnType("i32");const C=m.getCodeBuilder(),R=C.i32_const(b.alloc(M)),d=C.i32_const(b.alloc(M));m.addCode(C.call(p+"_one",R));for(let j=0;j<Mt;j++)m.addCode(C.call(w+"_prepareG1",C.getLocal("p_"+j),C.i32_const(cn))),m.addCode(C.call(w+"_prepareG2",C.getLocal("q_"+j),C.i32_const(fn))),m.addCode(C.call(w+"_millerLoop",C.i32_const(cn),C.i32_const(fn),d)),m.addCode(C.call(p+"_mul",R,d,R));m.addCode(C.call(w+"_finalExponentiation",R,R)),m.addCode(C.call(p+"_eq",R,C.getLocal("c")))}function In(){const Mt=b.addFunction(w+"_pairing");Mt.addParam("p","i32"),Mt.addParam("q","i32"),Mt.addParam("r","i32");const m=Mt.getCodeBuilder(),C=m.i32_const(b.alloc(M));Mt.addCode(m.call(w+"_prepareG1",m.getLocal("p"),m.i32_const(cn))),Mt.addCode(m.call(w+"_prepareG2",m.getLocal("q"),m.i32_const(fn))),Mt.addCode(m.call(w+"_millerLoop",m.i32_const(cn),m.i32_const(fn),C)),Mt.addCode(m.call(w+"_finalExponentiation",C,m.getLocal("r")))}z(),$(),Gt(),at(),ft(),gt(),Bt();for(let Mt=0;Mt<10;Mt++)pt(Mt),b.exportFunction(w+"__frobeniusMap"+Mt);rn(),en();for(let Mt=1;Mt<=5;Mt++)Ln(Mt),b.exportFunction(w+"_pairingEq"+Mt);In(),b.exportFunction(w+"_pairing"),b.exportFunction(w+"_prepareG1"),b.exportFunction(w+"_prepareG2"),b.exportFunction(w+"_millerLoop"),b.exportFunction(w+"_finalExponentiation"),b.exportFunction(w+"_finalExponentiationOld"),b.exportFunction(w+"__mulBy024"),b.exportFunction(w+"__mulBy024Old"),b.exportFunction(w+"__cyclotomicSquare"),b.exportFunction(w+"__cyclotomicExp_w0")},De}var Qe,Zl;function yu(){if(Zl)return Qe;Zl=1;const t=Gn(),a=Ea(),n=Se(),e=El(),c=xl(),i=ql(),r=zl(),_=Tl(),u=Ul(),l=Dl(),s=$l();return Qe=function(b,f){const w=f||"bls12381";if(b.modules[w])return w;const O=t("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab",16),D=t("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001",16),G=Math.floor((O.minus(1).bitLength()-1)/64)+1,V=G*8,it=V,Z=it*2,E=it*12,M=Math.floor((D.minus(1).bitLength()-1)/64)+1,h=M*8,y=h,q=b.alloc(a.bigInt2BytesLE(D,y)),g=n(b,O,"f1m","intq");e(b,D,"fr","frm","intr");const x=b.alloc(a.bigInt2BytesLE(S(t(4)),it)),H=r(b,"g1m","f1m",x);_(b,"frm","frm","frm","frm_mul"),u(b,"pol","frm"),l(b,"qap","frm");const T=c(b,"f1m_neg","f2m","f1m"),N=b.alloc([...a.bigInt2BytesLE(S(t("4")),it),...a.bigInt2BytesLE(S(t("4")),it)]),P=r(b,"g2m","f2m",N);function v(m,C){const R=b.addFunction(m);R.addParam("pG","i32"),R.addParam("pFr","i32"),R.addParam("pr","i32");const d=R.getCodeBuilder(),j=d.i32_const(b.alloc(h));R.addCode(d.call("frm_fromMontgomery",d.getLocal("pFr"),j),d.call(C,d.getLocal("pG"),j,d.i32_const(h),d.getLocal("pr"))),b.exportFunction(m)}v("g1m_timesFr","g1m_timesScalar"),_(b,"g1m","g1m","frm","g1m_timesFr"),v("g2m_timesFr","g2m_timesScalar"),_(b,"g2m","g2m","frm","g2m_timesFr"),v("g1m_timesFrAffine","g1m_timesScalarAffine"),v("g2m_timesFrAffine","g2m_timesScalarAffine"),s(b,"frm_batchApplyKey","fmr","frm",h,h,h,"frm_mul"),s(b,"g1m_batchApplyKey","g1m","frm",V*3,V*3,h,"g1m_timesFr"),s(b,"g1m_batchApplyKeyMixed","g1m","frm",V*2,V*3,h,"g1m_timesFrAffine"),s(b,"g2m_batchApplyKey","g2m","frm",V*2*3,V*3*2,h,"g2m_timesFr"),s(b,"g2m_batchApplyKeyMixed","g2m","frm",V*2*2,V*3*2,h,"g2m_timesFrAffine");function S(m){return t(m).times(t.one.shiftLeft(it*8)).mod(O)}const et=[t("3685416753713387016781088315183077757961620795782546409894578378688607592378376318836054947676345821548104185464507"),t("1339506544944476473020471379941921221584933875938349620426543736416511423956333506472724655353366534992391756441569"),t.one],_t=b.alloc([...a.bigInt2BytesLE(S(et[0]),it),...a.bigInt2BytesLE(S(et[1]),it),...a.bigInt2BytesLE(S(et[2]),it)]),mt=[t.zero,t.one,t.zero],xt=b.alloc([...a.bigInt2BytesLE(S(mt[0]),it),...a.bigInt2BytesLE(S(mt[1]),it),...a.bigInt2BytesLE(S(mt[2]),it)]),Pt=[[t("352701069587466618187139116011060144890029952792775240219908644239793785735715026873347600343865175952761926303160"),t("3059144344244213709971259814753781636986470325476647558659373206291635324768958432433509563104347017837885763365758")],[t("1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905"),t("927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582")],[t.one,t.zero]],zt=b.alloc([...a.bigInt2BytesLE(S(Pt[0][0]),it),...a.bigInt2BytesLE(S(Pt[0][1]),it),...a.bigInt2BytesLE(S(Pt[1][0]),it),...a.bigInt2BytesLE(S(Pt[1][1]),it),...a.bigInt2BytesLE(S(Pt[2][0]),it),...a.bigInt2BytesLE(S(Pt[2][1]),it)]),Rt=[[t.zero,t.zero],[t.one,t.zero],[t.zero,t.zero]],k=b.alloc([...a.bigInt2BytesLE(S(Rt[0][0]),it),...a.bigInt2BytesLE(S(Rt[0][1]),it),...a.bigInt2BytesLE(S(Rt[1][0]),it),...a.bigInt2BytesLE(S(Rt[1][1]),it),...a.bigInt2BytesLE(S(Rt[2][0]),it),...a.bigInt2BytesLE(S(Rt[2][1]),it)]),Ct=b.alloc([...a.bigInt2BytesLE(S(1),it),...a.bigInt2BytesLE(S(0),it),...a.bigInt2BytesLE(S(0),it),...a.bigInt2BytesLE(S(0),it),...a.bigInt2BytesLE(S(0),it),...a.bigInt2BytesLE(S(0),it),...a.bigInt2BytesLE(S(0),it),...a.bigInt2BytesLE(S(0),it),...a.bigInt2BytesLE(S(0),it),...a.bigInt2BytesLE(S(0),it),...a.bigInt2BytesLE(S(0),it),...a.bigInt2BytesLE(S(0),it)]);b.alloc([...a.bigInt2BytesLE(S(t(2).modInv(O)),it),...a.bigInt2BytesLE(t(0),it)]);const St=b.alloc([...a.bigInt2BytesLE(S(1),it),...a.bigInt2BytesLE(S(1),it)]);b.alloc([...a.bigInt2BytesLE(S("4"),it),...a.bigInt2BytesLE(S("4"),it)]);function F(){const m=b.addFunction(T+"_mulNR");m.addParam("x","i32"),m.addParam("pr","i32");const C=m.getCodeBuilder(),R=C.i32_const(b.alloc(it)),d=C.getLocal("x"),j=C.i32_add(C.getLocal("x"),C.i32_const(it)),W=C.getLocal("pr"),K=C.i32_add(C.getLocal("pr"),C.i32_const(it));m.addCode(C.call(g+"_copy",d,R),C.call(g+"_sub",d,j,W),C.call(g+"_add",R,j,K))}F();const o=i(b,T+"_mulNR","f6m","f2m");function L(){const m=b.addFunction(o+"_mulNR");m.addParam("x","i32"),m.addParam("pr","i32");const C=m.getCodeBuilder(),R=C.i32_const(b.alloc(it*2));m.addCode(C.call(T+"_copy",C.getLocal("x"),R),C.call(T+"_mulNR",C.i32_add(C.getLocal("x"),C.i32_const(V*4)),C.getLocal("pr")),C.call(T+"_copy",C.i32_add(C.getLocal("x"),C.i32_const(V*2)),C.i32_add(C.getLocal("pr"),C.i32_const(V*4))),C.call(T+"_copy",R,C.i32_add(C.getLocal("pr"),C.i32_const(V*2))))}L();const U=c(b,o+"_mulNR","ftm",o),p=t("d201000000010000",16),st=Lt(p),qt=b.alloc(st),wt=3*Z,nt=st.length-1,A=st.reduce((m,C)=>m+(C!=0?1:0),0)+nt+1,lt=3*2*V,Ft=3*V*2+A*wt,Ut=!0,dt=t("15132376222941642752");b.modules[w]={n64q:G,n64r:M,n8q:V,n8r:h,pG1gen:_t,pG1zero:xt,pG1b:x,pG2gen:zt,pG2zero:k,pG2b:N,pq:b.modules.f1m.pq,pr:q,pOneT:Ct,r:D,q:O,prePSize:lt,preQSize:Ft};function B(m){let C=m;const R=[];for(;C.gt(t.zero);){if(C.isOdd()){const d=2-C.mod(4).toJSNumber();R.push(d),C=C.minus(d)}else R.push(0);C=C.shiftRight(1)}return R}function Lt(m){let C=m;const R=[];for(;C.gt(t.zero);)C.isOdd()?R.push(1):R.push(0),C=C.shiftRight(1);return R}function Gt(){const m=b.addFunction(w+"_prepareG1");m.addParam("pP","i32"),m.addParam("ppreP","i32");const C=m.getCodeBuilder();m.addCode(C.call(H+"_normalize",C.getLocal("pP"),C.getLocal("ppreP")))}function z(){const m=b.addFunction(w+"_prepDblStep");m.addParam("R","i32"),m.addParam("r","i32");const C=m.getCodeBuilder(),R=C.getLocal("R"),d=C.i32_add(C.getLocal("R"),C.i32_const(2*V)),j=C.i32_add(C.getLocal("R"),C.i32_const(4*V)),W=C.getLocal("r"),K=C.i32_add(C.getLocal("r"),C.i32_const(2*V)),J=C.i32_add(C.getLocal("r"),C.i32_const(4*V)),tt=C.i32_const(b.alloc(Z)),rt=C.i32_const(b.alloc(Z)),ct=C.i32_const(b.alloc(Z)),ht=C.i32_const(b.alloc(Z)),bt=C.i32_const(b.alloc(Z));m.addCode(C.call(T+"_square",R,W),C.call(T+"_square",d,rt),C.call(T+"_square",rt,ct),C.call(T+"_add",rt,R,K),C.call(T+"_square",K,K),C.call(T+"_sub",K,W,K),C.call(T+"_sub",K,ct,K),C.call(T+"_add",K,K,K),C.call(T+"_add",W,W,ht),C.call(T+"_add",ht,W,ht),C.call(T+"_add",R,ht,J),C.call(T+"_square",ht,bt),C.call(T+"_square",j,tt),C.call(T+"_sub",bt,K,R),C.call(T+"_sub",R,K,R),C.call(T+"_add",j,d,j),C.call(T+"_square",j,j),C.call(T+"_sub",j,rt,j),C.call(T+"_sub",j,tt,j),C.call(T+"_sub",K,R,d),C.call(T+"_mul",d,ht,d),C.call(T+"_add",ct,ct,ct),C.call(T+"_add",ct,ct,ct),C.call(T+"_add",ct,ct,ct),C.call(T+"_sub",d,ct,d),C.call(T+"_mul",ht,tt,K),C.call(T+"_add",K,K,K),C.call(T+"_neg",K,K),C.call(T+"_square",J,J),C.call(T+"_sub",J,W,J),C.call(T+"_sub",J,bt,J),C.call(T+"_add",rt,rt,rt),C.call(T+"_add",rt,rt,rt),C.call(T+"_sub",J,rt,J),C.call(T+"_mul",j,tt,W),C.call(T+"_add",W,W,W))}function $(){const m=b.addFunction(w+"_prepAddStep");m.addParam("R","i32"),m.addParam("Q","i32"),m.addParam("r","i32");const C=m.getCodeBuilder(),R=C.getLocal("R"),d=C.i32_add(C.getLocal("R"),C.i32_const(2*V)),j=C.i32_add(C.getLocal("R"),C.i32_const(4*V)),W=C.getLocal("Q"),K=C.i32_add(C.getLocal("Q"),C.i32_const(2*V)),J=C.getLocal("r"),tt=C.i32_add(C.getLocal("r"),C.i32_const(2*V)),rt=C.i32_add(C.getLocal("r"),C.i32_const(4*V)),ct=C.i32_const(b.alloc(Z)),ht=C.i32_const(b.alloc(Z)),bt=C.i32_const(b.alloc(Z)),At=C.i32_const(b.alloc(Z)),Et=C.i32_const(b.alloc(Z)),Nt=C.i32_const(b.alloc(Z)),Tt=C.i32_const(b.alloc(Z)),$t=C.i32_const(b.alloc(Z)),Qt=C.i32_const(b.alloc(Z)),jt=C.i32_const(b.alloc(Z)),kt=C.i32_const(b.alloc(Z));m.addCode(C.call(T+"_square",j,ct),C.call(T+"_square",K,ht),C.call(T+"_mul",ct,W,At),C.call(T+"_add",K,j,tt),C.call(T+"_square",tt,tt),C.call(T+"_sub",tt,ht,tt),C.call(T+"_sub",tt,ct,tt),C.call(T+"_mul",tt,ct,tt),C.call(T+"_sub",At,R,Et),C.call(T+"_square",Et,Nt),C.call(T+"_add",Nt,Nt,Tt),C.call(T+"_add",Tt,Tt,Tt),C.call(T+"_mul",Tt,Et,$t),C.call(T+"_sub",tt,d,Qt),C.call(T+"_sub",Qt,d,Qt),C.call(T+"_mul",Qt,W,rt),C.call(T+"_mul",Tt,R,jt),C.call(T+"_square",Qt,R),C.call(T+"_sub",R,$t,R),C.call(T+"_sub",R,jt,R),C.call(T+"_sub",R,jt,R),C.call(T+"_add",j,Et,j),C.call(T+"_square",j,j),C.call(T+"_sub",j,ct,j),C.call(T+"_sub",j,Nt,j),C.call(T+"_add",K,j,J),C.call(T+"_sub",jt,R,kt),C.call(T+"_mul",kt,Qt,kt),C.call(T+"_mul",d,$t,At),C.call(T+"_add",At,At,At),C.call(T+"_sub",kt,At,d),C.call(T+"_square",J,J),C.call(T+"_sub",J,ht,J),C.call(T+"_square",j,bt),C.call(T+"_sub",J,bt,J),C.call(T+"_add",rt,rt,rt),C.call(T+"_sub",rt,J,rt),C.call(T+"_add",j,j,J),C.call(T+"_neg",Qt,Qt),C.call(T+"_add",Qt,Qt,tt))}function X(){const m=b.addFunction(w+"_prepareG2");m.addParam("pQ","i32"),m.addParam("ppreQ","i32"),m.addLocal("pCoef","i32"),m.addLocal("i","i32");const C=m.getCodeBuilder(),R=C.getLocal("pQ"),d=b.alloc(Z*3),j=C.i32_const(d),W=C.getLocal("ppreQ");m.addCode(C.call(P+"_normalize",R,W),C.if(C.call(P+"_isZero",W),C.ret([])),C.call(P+"_copy",W,j),C.setLocal("pCoef",C.i32_add(C.getLocal("ppreQ"),C.i32_const(Z*3)))),m.addCode(C.setLocal("i",C.i32_const(st.length-2)),C.block(C.loop(C.call(w+"_prepDblStep",j,C.getLocal("pCoef")),C.setLocal("pCoef",C.i32_add(C.getLocal("pCoef"),C.i32_const(wt))),C.if(C.i32_load8_s(C.getLocal("i"),qt),[...C.call(w+"_prepAddStep",j,W,C.getLocal("pCoef")),...C.setLocal("pCoef",C.i32_add(C.getLocal("pCoef"),C.i32_const(wt)))]),C.br_if(1,C.i32_eqz(C.getLocal("i"))),C.setLocal("i",C.i32_sub(C.getLocal("i"),C.i32_const(1))),C.br(0))))}function at(){const m=b.addFunction(o+"_mul1");m.addParam("pA","i32"),m.addParam("pC1","i32"),m.addParam("pR","i32");const C=m.getCodeBuilder(),R=C.getLocal("pA"),d=C.i32_add(C.getLocal("pA"),C.i32_const(it*2)),j=C.i32_add(C.getLocal("pA"),C.i32_const(it*4)),W=C.getLocal("pC1"),K=C.getLocal("pR"),J=C.i32_add(C.getLocal("pR"),C.i32_const(it*2)),tt=C.i32_add(C.getLocal("pR"),C.i32_const(it*4)),rt=C.i32_const(b.alloc(it*2)),ct=C.i32_const(b.alloc(it*2));m.addCode(C.call(T+"_add",R,d,rt),C.call(T+"_add",d,j,ct),C.call(T+"_mul",d,W,tt),C.call(T+"_mul",ct,W,K),C.call(T+"_sub",K,tt,K),C.call(T+"_mulNR",K,K),C.call(T+"_mul",rt,W,J),C.call(T+"_sub",J,tt,J))}at();function gt(){const m=b.addFunction(o+"_mul01");m.addParam("pA","i32"),m.addParam("pC0","i32"),m.addParam("pC1","i32"),m.addParam("pR","i32");const C=m.getCodeBuilder(),R=C.getLocal("pA"),d=C.i32_add(C.getLocal("pA"),C.i32_const(it*2)),j=C.i32_add(C.getLocal("pA"),C.i32_const(it*4)),W=C.getLocal("pC0"),K=C.getLocal("pC1"),J=C.getLocal("pR"),tt=C.i32_add(C.getLocal("pR"),C.i32_const(it*2)),rt=C.i32_add(C.getLocal("pR"),C.i32_const(it*4)),ct=C.i32_const(b.alloc(it*2)),ht=C.i32_const(b.alloc(it*2)),bt=C.i32_const(b.alloc(it*2)),At=C.i32_const(b.alloc(it*2));m.addCode(C.call(T+"_mul",R,W,ct),C.call(T+"_mul",d,K,ht),C.call(T+"_add",R,d,bt),C.call(T+"_add",R,j,At),C.call(T+"_add",d,j,J),C.call(T+"_mul",J,K,J),C.call(T+"_sub",J,ht,J),C.call(T+"_mulNR",J,J),C.call(T+"_add",J,ct,J),C.call(T+"_add",W,K,tt),C.call(T+"_mul",tt,bt,tt),C.call(T+"_sub",tt,ct,tt),C.call(T+"_sub",tt,ht,tt),C.call(T+"_mul",At,W,rt),C.call(T+"_sub",rt,ct,rt),C.call(T+"_add",rt,ht,rt))}gt();function ft(){const m=b.addFunction(U+"_mul014");m.addParam("pA","i32"),m.addParam("pC0","i32"),m.addParam("pC1","i32"),m.addParam("pC4","i32"),m.addParam("pR","i32");const C=m.getCodeBuilder(),R=C.getLocal("pA"),d=C.i32_add(C.getLocal("pA"),C.i32_const(it*6)),j=C.getLocal("pC0"),W=C.getLocal("pC1"),K=C.getLocal("pC4"),J=C.i32_const(b.alloc(it*6)),tt=C.i32_const(b.alloc(it*6)),rt=C.i32_const(b.alloc(it*2)),ct=C.getLocal("pR"),ht=C.i32_add(C.getLocal("pR"),C.i32_const(it*6));m.addCode(C.call(o+"_mul01",R,j,W,J),C.call(o+"_mul1",d,K,tt),C.call(T+"_add",W,K,rt),C.call(o+"_add",d,R,ht),C.call(o+"_mul01",ht,j,rt,ht),C.call(o+"_sub",ht,J,ht),C.call(o+"_sub",ht,tt,ht),C.call(o+"_copy",tt,ct),C.call(o+"_mulNR",ct,ct),C.call(o+"_add",ct,J,ct))}ft();function Bt(){const m=b.addFunction(w+"_ell");m.addParam("pP","i32"),m.addParam("pCoefs","i32"),m.addParam("pF","i32");const C=m.getCodeBuilder(),R=C.getLocal("pP"),d=C.i32_add(C.getLocal("pP"),C.i32_const(V)),j=C.getLocal("pF"),W=C.getLocal("pCoefs"),K=C.i32_add(C.getLocal("pCoefs"),C.i32_const(it)),J=C.i32_add(C.getLocal("pCoefs"),C.i32_const(it*2)),tt=C.i32_add(C.getLocal("pCoefs"),C.i32_const(it*3)),rt=C.i32_add(C.getLocal("pCoefs"),C.i32_const(it*4)),ct=b.alloc(it*2),ht=C.i32_const(ct),bt=C.i32_const(ct),At=C.i32_const(ct+it),Et=b.alloc(it*2),Nt=C.i32_const(Et),Tt=C.i32_const(Et),$t=C.i32_const(Et+it);m.addCode(C.call(g+"_mul",W,d,bt),C.call(g+"_mul",K,d,At),C.call(g+"_mul",J,R,Tt),C.call(g+"_mul",tt,R,$t),C.call(U+"_mul014",j,rt,Nt,ht,j))}Bt();function pt(){const m=b.addFunction(w+"_millerLoop");m.addParam("ppreP","i32"),m.addParam("ppreQ","i32"),m.addParam("r","i32"),m.addLocal("pCoef","i32"),m.addLocal("i","i32");const C=m.getCodeBuilder(),R=C.getLocal("ppreP");C.getLocal("ppreQ");const d=C.getLocal("pCoef"),j=C.getLocal("r");m.addCode(C.call(U+"_one",j),C.if(C.call(H+"_isZero",R),C.ret([])),C.if(C.call(H+"_isZero",C.getLocal("ppreQ")),C.ret([])),C.setLocal("pCoef",C.i32_add(C.getLocal("ppreQ"),C.i32_const(Z*3))),C.setLocal("i",C.i32_const(st.length-2)),C.block(C.loop(C.call(w+"_ell",R,d,j),C.setLocal("pCoef",C.i32_add(C.getLocal("pCoef"),C.i32_const(wt))),C.if(C.i32_load8_s(C.getLocal("i"),qt),[...C.call(w+"_ell",R,d,j),...C.setLocal("pCoef",C.i32_add(C.getLocal("pCoef"),C.i32_const(wt)))]),C.call(U+"_square",j,j),C.br_if(1,C.i32_eq(C.getLocal("i"),C.i32_const(1))),C.setLocal("i",C.i32_sub(C.getLocal("i"),C.i32_const(1))),C.br(0))),C.call(w+"_ell",R,d,j)),m.addCode(C.call(U+"_conjugate",j,j))}function Ot(m){const C=[[[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")]],[[t("1"),t("0")],[t("3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760"),t("151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027")],[t("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351"),t("0")],[t("2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530"),t("1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257")],[t("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350"),t("0")],[t("3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557"),t("877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230")],[t("4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786"),t("0")],[t("151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027"),t("3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760")],[t("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436"),t("0")],[t("1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257"),t("2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530")],[t("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437"),t("0")],[t("877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230"),t("3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557")]]],R=[[[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")],[t("1"),t("0")]],[[t("1"),t("0")],[t("0"),t("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436")],[t("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350"),t("0")],[t("0"),t("1")],[t("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436"),t("0")],[t("0"),t("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350")]],[[t("1"),t("0")],[t("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437"),t("0")],[t("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436"),t("0")],[t("4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786"),t("0")],[t("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350"),t("0")],[t("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351"),t("0")]]],d=b.addFunction(U+"_frobeniusMap"+m);d.addParam("x","i32"),d.addParam("r","i32");const j=d.getCodeBuilder();for(let K=0;K<6;K++){const J=K==0?j.getLocal("x"):j.i32_add(j.getLocal("x"),j.i32_const(K*Z)),tt=J,rt=j.i32_add(j.getLocal("x"),j.i32_const(K*Z+it)),ct=K==0?j.getLocal("r"):j.i32_add(j.getLocal("r"),j.i32_const(K*Z)),ht=ct,bt=j.i32_add(j.getLocal("r"),j.i32_const(K*Z+it)),At=W(C[Math.floor(K/3)][m%12],R[K%3][m%6]),Et=b.alloc([...a.bigInt2BytesLE(S(At[0]),V),...a.bigInt2BytesLE(S(At[1]),V)]);m%2==1?d.addCode(j.call(g+"_copy",tt,ht),j.call(g+"_neg",rt,bt),j.call(T+"_mul",ct,j.i32_const(Et),ct)):d.addCode(j.call(T+"_mul",J,j.i32_const(Et),ct))}function W(K,J){const tt=t(K[0]),rt=t(K[1]),ct=t(J[0]),ht=t(J[1]),bt=[tt.times(ct).minus(rt.times(ht)).mod(O),tt.times(ht).add(rt.times(ct)).mod(O)];return bt[0].isNegative()&&(bt[0]=bt[0].add(O)),bt}}function Ht(){const m=b.addFunction(w+"__cyclotomicSquare");m.addParam("x","i32"),m.addParam("r","i32");const C=m.getCodeBuilder(),R=C.getLocal("x"),d=C.i32_add(C.getLocal("x"),C.i32_const(Z)),j=C.i32_add(C.getLocal("x"),C.i32_const(2*Z)),W=C.i32_add(C.getLocal("x"),C.i32_const(3*Z)),K=C.i32_add(C.getLocal("x"),C.i32_const(4*Z)),J=C.i32_add(C.getLocal("x"),C.i32_const(5*Z)),tt=C.getLocal("r"),rt=C.i32_add(C.getLocal("r"),C.i32_const(Z)),ct=C.i32_add(C.getLocal("r"),C.i32_const(2*Z)),ht=C.i32_add(C.getLocal("r"),C.i32_const(3*Z)),bt=C.i32_add(C.getLocal("r"),C.i32_const(4*Z)),At=C.i32_add(C.getLocal("r"),C.i32_const(5*Z)),Et=C.i32_const(b.alloc(Z)),Nt=C.i32_const(b.alloc(Z)),Tt=C.i32_const(b.alloc(Z)),$t=C.i32_const(b.alloc(Z)),Qt=C.i32_const(b.alloc(Z)),jt=C.i32_const(b.alloc(Z)),kt=C.i32_const(b.alloc(Z)),tn=C.i32_const(b.alloc(Z));m.addCode(C.call(T+"_mul",R,K,kt),C.call(T+"_mulNR",K,Et),C.call(T+"_add",R,Et,Et),C.call(T+"_add",R,K,tn),C.call(T+"_mul",tn,Et,Et),C.call(T+"_mulNR",kt,tn),C.call(T+"_add",kt,tn,tn),C.call(T+"_sub",Et,tn,Et),C.call(T+"_add",kt,kt,Nt),C.call(T+"_mul",W,j,kt),C.call(T+"_mulNR",j,Tt),C.call(T+"_add",W,Tt,Tt),C.call(T+"_add",W,j,tn),C.call(T+"_mul",tn,Tt,Tt),C.call(T+"_mulNR",kt,tn),C.call(T+"_add",kt,tn,tn),C.call(T+"_sub",Tt,tn,Tt),C.call(T+"_add",kt,kt,$t),C.call(T+"_mul",d,J,kt),C.call(T+"_mulNR",J,Qt),C.call(T+"_add",d,Qt,Qt),C.call(T+"_add",d,J,tn),C.call(T+"_mul",tn,Qt,Qt),C.call(T+"_mulNR",kt,tn),C.call(T+"_add",kt,tn,tn),C.call(T+"_sub",Qt,tn,Qt),C.call(T+"_add",kt,kt,jt),C.call(T+"_sub",Et,R,tt),C.call(T+"_add",tt,tt,tt),C.call(T+"_add",Et,tt,tt),C.call(T+"_add",Nt,K,bt),C.call(T+"_add",bt,bt,bt),C.call(T+"_add",Nt,bt,bt),C.call(T+"_mul",jt,C.i32_const(St),tn),C.call(T+"_add",tn,W,ht),C.call(T+"_add",ht,ht,ht),C.call(T+"_add",tn,ht,ht),C.call(T+"_sub",Qt,j,ct),C.call(T+"_add",ct,ct,ct),C.call(T+"_add",Qt,ct,ct),C.call(T+"_sub",Tt,d,rt),C.call(T+"_add",rt,rt,rt),C.call(T+"_add",Tt,rt,rt),C.call(T+"_add",$t,J,At),C.call(T+"_add",At,At,At),C.call(T+"_add",$t,At,At))}function on(m,C,R){const d=B(m).map(ct=>ct==-1?255:ct),j=b.alloc(d),W=b.addFunction(w+"__cyclotomicExp_"+R);W.addParam("x","i32"),W.addParam("r","i32"),W.addLocal("bit","i32"),W.addLocal("i","i32");const K=W.getCodeBuilder(),J=K.getLocal("x"),tt=K.getLocal("r"),rt=K.i32_const(b.alloc(E));W.addCode(K.call(U+"_conjugate",J,rt),K.call(U+"_one",tt),K.if(K.teeLocal("bit",K.i32_load8_s(K.i32_const(d.length-1),j)),K.if(K.i32_eq(K.getLocal("bit"),K.i32_const(1)),K.call(U+"_mul",tt,J,tt),K.call(U+"_mul",tt,rt,tt))),K.setLocal("i",K.i32_const(d.length-2)),K.block(K.loop(K.call(w+"__cyclotomicSquare",tt,tt),K.if(K.teeLocal("bit",K.i32_load8_s(K.getLocal("i"),j)),K.if(K.i32_eq(K.getLocal("bit"),K.i32_const(1)),K.call(U+"_mul",tt,J,tt),K.call(U+"_mul",tt,rt,tt))),K.br_if(1,K.i32_eqz(K.getLocal("i"))),K.setLocal("i",K.i32_sub(K.getLocal("i"),K.i32_const(1))),K.br(0)))),W.addCode(K.call(U+"_conjugate",tt,tt))}function an(){Ht(),on(dt,Ut,"w0");const m=b.addFunction(w+"_finalExponentiation");m.addParam("x","i32"),m.addParam("r","i32");const C=m.getCodeBuilder(),R=C.getLocal("x"),d=C.getLocal("r"),j=C.i32_const(b.alloc(E)),W=C.i32_const(b.alloc(E)),K=C.i32_const(b.alloc(E)),J=C.i32_const(b.alloc(E)),tt=C.i32_const(b.alloc(E)),rt=C.i32_const(b.alloc(E)),ct=C.i32_const(b.alloc(E));m.addCode(C.call(U+"_frobeniusMap6",R,j),C.call(U+"_inverse",R,W),C.call(U+"_mul",j,W,K),C.call(U+"_copy",K,W),C.call(U+"_frobeniusMap2",K,K),C.call(U+"_mul",K,W,K),C.call(w+"__cyclotomicSquare",K,W),C.call(U+"_conjugate",W,W),C.call(w+"__cyclotomicExp_w0",K,J),C.call(w+"__cyclotomicSquare",J,tt),C.call(U+"_mul",W,J,rt),C.call(w+"__cyclotomicExp_w0",rt,W),C.call(w+"__cyclotomicExp_w0",W,j),C.call(w+"__cyclotomicExp_w0",j,ct),C.call(U+"_mul",ct,tt,ct),C.call(w+"__cyclotomicExp_w0",ct,tt),C.call(U+"_conjugate",rt,rt),C.call(U+"_mul",tt,rt,tt),C.call(U+"_mul",tt,K,tt),C.call(U+"_conjugate",K,rt),C.call(U+"_mul",W,K,W),C.call(U+"_frobeniusMap3",W,W),C.call(U+"_mul",ct,rt,ct),C.call(U+"_frobeniusMap1",ct,ct),C.call(U+"_mul",J,j,J),C.call(U+"_frobeniusMap2",J,J),C.call(U+"_mul",J,W,J),C.call(U+"_mul",J,ct,J),C.call(U+"_mul",J,tt,d))}function en(){const m=b.addFunction(w+"_finalExponentiationOld");m.addParam("x","i32"),m.addParam("r","i32");const C=t("322277361516934140462891564586510139908379969514828494218366688025288661041104682794998680497580008899973249814104447692778988208376779573819485263026159588510513834876303014016798809919343532899164848730280942609956670917565618115867287399623286813270357901731510188149934363360381614501334086825442271920079363289954510565375378443704372994881406797882676971082200626541916413184642520269678897559532260949334760604962086348898118982248842634379637598665468817769075878555493752214492790122785850202957575200176084204422751485957336465472324810982833638490904279282696134323072515220044451592646885410572234451732790590013479358343841220074174848221722017083597872017638514103174122784843925578370430843522959600095676285723737049438346544753168912974976791528535276317256904336520179281145394686565050419250614107803233314658825463117900250701199181529205942363159325765991819433914303908860460720581408201373164047773794825411011922305820065611121544561808414055302212057471395719432072209245600258134364584636810093520285711072578721435517884103526483832733289802426157301542744476740008494780363354305116978805620671467071400711358839553375340724899735460480144599782014906586543813292157922220645089192130209334926661588737007768565838519456601560804957985667880395221049249803753582637708560"),R=b.alloc(a.bigInt2BytesLE(C,544)),d=m.getCodeBuilder();m.addCode(d.call(U+"_exp",d.getLocal("x"),d.i32_const(R),d.i32_const(544),d.getLocal("r")))}const rn=b.alloc(lt),cn=b.alloc(Ft);function fn(m){const C=b.addFunction(w+"_pairingEq"+m);for(let W=0;W<m;W++)C.addParam("p_"+W,"i32"),C.addParam("q_"+W,"i32");C.addParam("c","i32"),C.setReturnType("i32");const R=C.getCodeBuilder(),d=R.i32_const(b.alloc(E)),j=R.i32_const(b.alloc(E));C.addCode(R.call(U+"_one",d));for(let W=0;W<m;W++)C.addCode(R.call(w+"_prepareG1",R.getLocal("p_"+W),R.i32_const(rn))),C.addCode(R.call(w+"_prepareG2",R.getLocal("q_"+W),R.i32_const(cn))),C.addCode(R.if(R.i32_eqz(R.call(H+"_inGroupAffine",R.i32_const(rn))),R.ret(R.i32_const(0))),R.if(R.i32_eqz(R.call(P+"_inGroupAffine",R.i32_const(cn))),R.ret(R.i32_const(0)))),C.addCode(R.call(w+"_millerLoop",R.i32_const(rn),R.i32_const(cn),j)),C.addCode(R.call(U+"_mul",d,j,d));C.addCode(R.call(w+"_finalExponentiation",d,d)),C.addCode(R.call(U+"_eq",d,R.getLocal("c")))}function Ln(){const m=b.addFunction(w+"_pairing");m.addParam("p","i32"),m.addParam("q","i32"),m.addParam("r","i32");const C=m.getCodeBuilder(),R=C.i32_const(b.alloc(E));m.addCode(C.call(w+"_prepareG1",C.getLocal("p"),C.i32_const(rn))),m.addCode(C.call(w+"_prepareG2",C.getLocal("q"),C.i32_const(cn))),m.addCode(C.call(w+"_millerLoop",C.i32_const(rn),C.i32_const(cn),R)),m.addCode(C.call(w+"_finalExponentiation",R,C.getLocal("r")))}function In(){const m=b.addFunction(P+"_inGroupAffine");m.addParam("p","i32"),m.setReturnType("i32");const C=m.getCodeBuilder(),R=[t("2001204777610833696708894912867952078278441409969503942666029068062015825245418932221343814564507832018947136279894"),t("2001204777610833696708894912867952078278441409969503942666029068062015825245418932221343814564507832018947136279893")],d=t("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436"),j=[t("2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530"),t("2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530")],W=C.i32_const(b.alloc([...a.bigInt2BytesLE(S(R[0]),V),...a.bigInt2BytesLE(S(R[1]),V)])),K=C.i32_const(b.alloc(a.bigInt2BytesLE(S(d),V))),J=C.i32_const(b.alloc([...a.bigInt2BytesLE(S(j[0]),V),...a.bigInt2BytesLE(S(j[1]),V)])),tt=C.i32_const(b.alloc(a.bigInt2BytesLE(dt,8))),rt=C.getLocal("p"),ct=C.i32_add(C.getLocal("p"),C.i32_const(Z)),ht=C.i32_const(b.alloc(it)),bt=C.i32_const(b.alloc(Z)),At=C.i32_const(b.alloc(Z)),Et=b.alloc(Z*2),Nt=C.i32_const(Et),Tt=C.i32_const(Et),$t=C.i32_const(Et),Qt=C.i32_const(Et+it),jt=C.i32_const(Et+Z),kt=C.i32_const(Et+Z),tn=C.i32_const(Et+Z+it),Wt=b.alloc(Z*3),Jt=C.i32_const(Wt),xn=C.i32_const(Wt),Sn=C.i32_const(Wt),Pn=C.i32_const(Wt+it),ua=C.i32_const(Wt+Z),On=C.i32_const(Wt+Z),wa=C.i32_const(Wt+Z+it),Xn=C.i32_const(Wt+Z*2);m.addCode(C.if(C.call(P+"_isZeroAffine",C.getLocal("p")),C.ret(C.i32_const(1))),C.if(C.i32_eqz(C.call(P+"_inCurveAffine",C.getLocal("p"))),C.ret(C.i32_const(0))),C.call(T+"_mul",rt,W,bt),C.call(T+"_mul",ct,W,At),C.call(T+"_mul1",bt,K,Tt),C.call(T+"_neg",At,jt),C.call(T+"_neg",bt,xn),C.call(T+"_mul",At,J,ua),C.call(g+"_sub",$t,Qt,ht),C.call(g+"_add",$t,Qt,Qt),C.call(g+"_copy",ht,$t),C.call(g+"_sub",kt,tn,ht),C.call(g+"_add",kt,tn,tn),C.call(g+"_copy",ht,kt),C.call(g+"_add",Sn,Pn,ht),C.call(g+"_sub",Sn,Pn,Pn),C.call(g+"_copy",ht,Sn),C.call(g+"_sub",wa,On,ht),C.call(g+"_add",On,wa,wa),C.call(g+"_copy",ht,On),C.call(T+"_one",Xn),C.call(P+"_timesScalar",Jt,tt,C.i32_const(8),Jt),C.call(P+"_addMixed",Jt,Nt,Jt),C.ret(C.call(P+"_eqMixed",Jt,C.getLocal("p"))));const Dn=b.addFunction(P+"_inGroup");Dn.addParam("pIn","i32"),Dn.setReturnType("i32");const aa=Dn.getCodeBuilder(),oa=aa.i32_const(b.alloc(Z*2));Dn.addCode(aa.call(P+"_toAffine",aa.getLocal("pIn"),oa),aa.ret(aa.call(P+"_inGroupAffine",oa)))}function Mt(){const m=b.addFunction(H+"_inGroupAffine");m.addParam("p","i32"),m.setReturnType("i32");const C=m.getCodeBuilder(),R=t("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436"),d=t("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350"),j=dt.times(dt).minus(t.one).divide(t(3)),W=C.i32_const(b.alloc(a.bigInt2BytesLE(S(R),V))),K=C.i32_const(b.alloc(a.bigInt2BytesLE(S(d),V))),J=C.i32_const(b.alloc(a.bigInt2BytesLE(j,16))),tt=C.getLocal("p"),rt=C.i32_add(C.getLocal("p"),C.i32_const(it)),ct=b.alloc(it*3),ht=C.i32_const(ct),bt=C.i32_const(ct),At=C.i32_const(ct+it);C.i32_const(ct+2*it);const Et=b.alloc(it*2),Nt=C.i32_const(Et),Tt=C.i32_const(Et),$t=C.i32_const(Et+it);m.addCode(C.if(C.call(H+"_isZeroAffine",C.getLocal("p")),C.ret(C.i32_const(1))),C.if(C.i32_eqz(C.call(H+"_inCurveAffine",C.getLocal("p"))),C.ret(C.i32_const(0))),C.call(g+"_mul",tt,W,bt),C.call(g+"_copy",rt,At),C.call(g+"_mul",tt,K,Tt),C.call(g+"_copy",rt,$t),C.call(H+"_doubleAffine",ht,ht),C.call(H+"_subMixed",ht,C.getLocal("p"),ht),C.call(H+"_subMixed",ht,Nt,ht),C.call(H+"_timesScalar",ht,J,C.i32_const(16),ht),C.ret(C.call(H+"_eqMixed",ht,Nt)));const Qt=b.addFunction(H+"_inGroup");Qt.addParam("pIn","i32"),Qt.setReturnType("i32");const jt=Qt.getCodeBuilder(),kt=jt.i32_const(b.alloc(it*2));Qt.addCode(jt.call(H+"_toAffine",jt.getLocal("pIn"),kt),jt.ret(jt.call(H+"_inGroupAffine",kt)))}for(let m=0;m<10;m++)Ot(m),b.exportFunction(U+"_frobeniusMap"+m);Mt(),In(),$(),z(),Gt(),X(),pt(),en(),an();for(let m=1;m<=5;m++)fn(m),b.exportFunction(w+"_pairingEq"+m);Ln(),b.exportFunction(w+"_pairing"),b.exportFunction(w+"_prepareG1"),b.exportFunction(w+"_prepareG2"),b.exportFunction(w+"_millerLoop"),b.exportFunction(w+"_finalExponentiation"),b.exportFunction(w+"_finalExponentiationOld"),b.exportFunction(w+"__cyclotomicSquare"),b.exportFunction(w+"__cyclotomicExp_w0"),b.exportFunction(o+"_mul1"),b.exportFunction(o+"_mul01"),b.exportFunction(U+"_mul014"),b.exportFunction(H+"_inGroupAffine"),b.exportFunction(H+"_inGroup"),b.exportFunction(P+"_inGroupAffine"),b.exportFunction(P+"_inGroup")},Qe}var jl;function Au(){return jl||(jl=1,Io.buildBn128=bu(),Io.buildBls12381=yu()),Io}var Kl=Au();function $e(t){if(typeof t=="bigint"||t.eq!==void 0)return t.toString(10);if(t instanceof Uint8Array)return Ga(t,0);if(Array.isArray(t))return t.map($e);if(typeof t=="object"){const a={};return Object.keys(t).forEach(e=>{a[e]=$e(t[e])}),a}else return t}function Ge(t){if(typeof t=="string"&&/^[0-9]+$/.test(t))return BigInt(t);if(typeof t=="string"&&/^0x[0-9a-fA-F]+$/.test(t))return BigInt(t);if(Array.isArray(t))return t.map(Ge);if(typeof t=="object"){if(t===null)return null;const a={};return Object.keys(t).forEach(e=>{a[e]=Ge(t[e])}),a}else return t}function mu(t){let a=BigInt(0),n=t.length,e=0;const c=new DataView(t.buffer,t.byteOffset,t.byteLength);for(;n>0;)n>=4?(n-=4,a+=BigInt(c.getUint32(n))<<BigInt(e*8),e+=4):n>=2?(n-=2,a+=BigInt(c.getUint16(n))<<BigInt(e*8),e+=2):(n-=1,a+=BigInt(c.getUint8(n))<<BigInt(e*8),e+=1);return a}function Cu(t,a){let n=t;const e=new Uint8Array(a),c=new DataView(e.buffer);let i=a;for(;i>0;)i-4>=0?(i-=4,c.setUint32(i,Number(n&BigInt(4294967295))),n=n>>BigInt(32)):i-2>=0?(i-=2,c.setUint16(i,Number(n&BigInt(65535))),n=n>>BigInt(16)):(i-=1,c.setUint8(i,Number(n&BigInt(255))),n=n>>BigInt(8));if(n)throw new Error("Number does not fit in this length");return e}function Iu(t){let a=BigInt(0),n=0;const e=new DataView(t.buffer,t.byteOffset,t.byteLength);for(;n<t.length;)n+4<=t.length?(a+=BigInt(e.getUint32(n,!0))<<BigInt(n*8),n+=4):n+4<=t.length?(a+=BigInt(e.getUint16(n,!0))<<BigInt(n*8),n+=2):(a+=BigInt(e.getUint8(n,!0))<<BigInt(n*8),n+=1);return a}function wu(t,a){let n=t;typeof a>"u"&&(a=Math.floor((Ao(t)-1)/8)+1,a==0&&(a=1));const e=new Uint8Array(a),c=new DataView(e.buffer);let i=0;for(;i<a;)i+4<=a?(c.setUint32(i,Number(n&BigInt(4294967295)),!0),i+=4,n=n>>BigInt(32)):i+2<=a?(c.setUint16(Number(i,n&BigInt(65535)),!0),i+=2,n=n>>BigInt(16)):(c.setUint8(Number(i,n&BigInt(255)),!0),i+=1,n=n>>BigInt(8));if(n)throw new Error("Number does not fit in this length");return e}function Ze(t,a){if(typeof a=="bigint"||a.eq!==void 0)return a.toString(10);if(a instanceof Uint8Array)return t.toString(t.e(a));if(Array.isArray(a))return a.map(Ze.bind(this,t));if(typeof a=="object"){const n={};return Object.keys(a).forEach(c=>{n[c]=Ze(t,a[c])}),n}else return a}function je(t,a){if(typeof a=="string"&&/^[0-9]+$/.test(a))return t.e(a);if(typeof a=="string"&&/^0x[0-9a-fA-F]+$/.test(a))return t.e(a);if(Array.isArray(a))return a.map(je.bind(this,t));if(typeof a=="object"){if(a===null)return null;const n={};return Object.keys(a).forEach(c=>{n[c]=je(t,a[c])}),n}else return a}var vu=Object.freeze({__proto__:null,beBuff2int:mu,beInt2Buff:Cu,leBuff2int:Iu,leInt2Buff:wu,stringifyBigInts:$e,stringifyFElements:Ze,unstringifyBigInts:Ge,unstringifyFElements:je});function Ke(t){if(typeof t=="bigint"||t.eq!==void 0)return t.toString(10);if(Array.isArray(t))return t.map(Ke);if(typeof t=="object"){const a={};return Object.keys(t).forEach(e=>{a[e]=Ke(t[e])}),a}else return t}function He(t){if(typeof t=="string"&&/^[0-9]+$/.test(t))return Kt(t);if(typeof t=="string"&&/^0x[0-9a-fA-F]+$/.test(t))return Kt(t);if(Array.isArray(t))return t.map(He);if(typeof t=="object"){const a={};return Object.keys(t).forEach(e=>{a[e]=He(t[e])}),a}else return t}function Bu(t){let a=Kt.zero;for(let n=0;n<t.length;n++){const e=Kt(t[t.length-n-1]);a=a.add(e.shiftLeft(n*8))}return a}function Eu(t,a){let n=t,e=a-1;const c=new Uint8Array(a);for(;n.gt(Kt.zero)&&e>=0;){let i=Number(n.and(Kt("255")));c[e]=i,e--,n=n.shiftRight(8)}if(!n.eq(Kt.zero))throw new Error("Number does not fit in this length");return c}function Fu(t){let a=Kt.zero;for(let n=0;n<t.length;n++){const e=Kt(t[n]);a=a.add(e.shiftLeft(n*8))}return a}function xu(t,a){let n=t,e=0;const c=new Uint8Array(a);for(;n.gt(Kt.zero)&&e<c.length;){let i=Number(n.and(Kt(255)));c[e]=i,e++,n=n.shiftRight(8)}if(!n.eq(Kt.zero))throw new Error("Number does not fit in this length");return c}var Su=Object.freeze({__proto__:null,beBuff2int:Bu,beInt2Buff:Eu,leBuff2int:Fu,leInt2Buff:xu,stringifyBigInts:Ke,unstringifyBigInts:He});let jn={};typeof BigInt=="function"?Object.assign(jn,vu):Object.assign(jn,Su);const Ka=[];for(let t=0;t<256;t++)Ka[t]=qu(t,8);function qu(t,a){let n=0,e=t;for(let c=0;c<a;c++)n<<=1,n=n|e&1,e>>=1;return n}jn.bitReverse=function(a,n){return(Ka[a>>>24]|Ka[a>>>16&255]<<8|Ka[a>>>8&255]<<16|Ka[a&255]<<24)>>>32-n},jn.log2=function(a){return(a&4294901760?(a&=4294901760,16):0)|(a&4278255360?(a&=4278255360,8):0)|(a&4042322160?(a&=4042322160,4):0)|(a&3435973836?(a&=3435973836,2):0)|(a&2863311530)!==0},jn.buffReverseBits=function(a,n){const e=a.byteLength/n,c=jn.log2(e);if(e!=1<<c)throw new Error("Invalid number of pointers");for(let i=0;i<e;i++){const r=jn.bitReverse(i,c);if(i>r){const _=a.slice(i*n,(i+1)*n);a.set(a.slice(r*n,(r+1)*n),i*n),a.set(_,r*n)}}},jn.array2buffer=function(t,a){const n=new Uint8Array(a*t.length);for(let e=0;e<t.length;e++)n.set(t[e],e*a);return n},jn.buffer2array=function(t,a){const n=t.byteLength/a,e=new Array(n);for(let c=0;c<n;c++)e[c]=t.slice(c*a,c*a+a);return e};let{bitReverse:Pu,log2:Mn,buffReverseBits:Hl,stringifyBigInts:Ou,unstringifyBigInts:Mu,beBuff2int:zu,beInt2Buff:Ru,leBuff2int:Tu,leInt2Buff:Vl,array2buffer:Ve,buffer2array:wo,stringifyFElements:ku,unstringifyFElements:Uu}=jn;var Nu=Object.freeze({__proto__:null,array2buffer:Ve,beBuff2int:zu,beInt2Buff:Ru,bitReverse:Pu,buffReverseBits:Hl,buffer2array:wo,leBuff2int:Tu,leInt2Buff:Vl,log2:Mn,stringifyBigInts:Ou,stringifyFElements:ku,unstringifyBigInts:Mu,unstringifyFElements:Uu});const vn=1<<30;class un{constructor(a){this.buffers=[],this.byteLength=a;for(let n=0;n<a;n+=vn){const e=Math.min(a-n,vn);this.buffers.push(new Uint8Array(e))}}slice(a,n){n===void 0&&(n=this.byteLength),a===void 0&&(a=0);const e=n-a,c=Math.floor(a/vn),i=Math.floor((a+e-1)/vn);if(c==i||e==0)return this.buffers[c].slice(a%vn,a%vn+e);let r,_=c,u=a%vn,l=e;for(;l>0;){const s=u+l>vn?vn-u:l,I=new Uint8Array(this.buffers[_].buffer,this.buffers[_].byteOffset+u,s);if(s==e)return I.slice();r||(e<=vn?r=new Uint8Array(e):r=new un(e)),r.set(I,e-l),l=l-s,_++,u=0}return r}set(a,n){n===void 0&&(n=0);const e=a.byteLength;if(e==0)return;const c=Math.floor(n/vn),i=Math.floor((n+e-1)/vn);if(c==i)return a instanceof un&&a.buffers.length==1?this.buffers[c].set(a.buffers[0],n%vn):this.buffers[c].set(a,n%vn);let r=c,_=n%vn,u=e;for(;u>0;){const l=_+u>vn?vn-_:u,s=a.slice(e-u,e-u+l);new Uint8Array(this.buffers[r].buffer,this.buffers[r].byteOffset+_,l).set(s),u=u-l,r++,_=0}}}function ca(t,a,n,e){return async function(i){const r=Math.floor(i.byteLength/n);if(r*n!==i.byteLength)throw new Error("Invalid buffer size");const _=Math.floor(r/t.concurrency),u=[];for(let b=0;b<t.concurrency;b++){let f;if(b<t.concurrency-1?f=_:f=r-b*_,f==0)continue;const O=[{cmd:"ALLOCSET",var:0,buff:i.slice(b*_*n,b*_*n+f*n)},{cmd:"ALLOC",var:1,len:e*f},{cmd:"CALL",fnName:a,params:[{var:0},{val:f},{var:1}]},{cmd:"GET",out:0,var:1,len:e*f}];u.push(t.queueAction(O))}const l=await Promise.all(u);let s;i instanceof un?s=new un(r*e):s=new Uint8Array(r*e);let I=0;for(let b=0;b<l.length;b++)s.set(l[b][0],I),I+=l[b][0].byteLength;return s}}class Yl{constructor(a,n,e,c){if(this.tm=a,this.prefix=n,this.p=c,this.n8=e,this.type="F1",this.m=1,this.half=mo(c,fa),this.bitLength=Ao(c),this.mask=Wn(he(fa,this.bitLength),fa),this.pOp1=a.alloc(e),this.pOp2=a.alloc(e),this.pOp3=a.alloc(e),this.tm.instance.exports[n+"_zero"](this.pOp1),this.zero=this.tm.getBuff(this.pOp1,this.n8),this.tm.instance.exports[n+"_one"](this.pOp1),this.one=this.tm.getBuff(this.pOp1,this.n8),this.negone=this.neg(this.one),this.two=this.add(this.one,this.one),this.n64=Math.floor(e/8),this.n32=Math.floor(e/4),this.n64*8!=this.n8)throw new Error("n8 must be a multiple of 8");this.half=mo(this.p,fa),this.nqr=this.two;let i=this.exp(this.nqr,this.half);for(;!this.eq(i,this.negone);)this.nqr=this.add(this.nqr,this.one),i=this.exp(this.nqr,this.half);this.shift=this.mul(this.nqr,this.nqr),this.shiftInv=this.inv(this.shift),this.s=0;let r=Wn(this.p,fa);for(;!Le(r);)this.s=this.s+1,r=mo(r,fa);this.w=[],this.w[this.s]=this.exp(this.nqr,r);for(let _=this.s-1;_>=0;_--)this.w[_]=this.square(this.w[_+1]);if(!this.eq(this.w[0],this.one))throw new Error("Error calculating roots of unity");this.batchToMontgomery=ca(a,n+"_batchToMontgomery",this.n8,this.n8),this.batchFromMontgomery=ca(a,n+"_batchFromMontgomery",this.n8,this.n8)}op2(a,n,e){return this.tm.setBuff(this.pOp1,n),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[this.prefix+a](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op2Bool(a,n,e){return this.tm.setBuff(this.pOp1,n),this.tm.setBuff(this.pOp2,e),!!this.tm.instance.exports[this.prefix+a](this.pOp1,this.pOp2)}op1(a,n){return this.tm.setBuff(this.pOp1,n),this.tm.instance.exports[this.prefix+a](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op1Bool(a,n){return this.tm.setBuff(this.pOp1,n),!!this.tm.instance.exports[this.prefix+a](this.pOp1,this.pOp3)}add(a,n){return this.op2("_add",a,n)}eq(a,n){return this.op2Bool("_eq",a,n)}isZero(a){return this.op1Bool("_isZero",a)}sub(a,n){return this.op2("_sub",a,n)}neg(a){return this.op1("_neg",a)}inv(a){return this.op1("_inverse",a)}toMontgomery(a){return this.op1("_toMontgomery",a)}fromMontgomery(a){return this.op1("_fromMontgomery",a)}mul(a,n){return this.op2("_mul",a,n)}div(a,n){return this.tm.setBuff(this.pOp1,a),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[this.prefix+"_inverse"](this.pOp2,this.pOp2),this.tm.instance.exports[this.prefix+"_mul"](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}square(a){return this.op1("_square",a)}isSquare(a){return this.op1Bool("_isSquare",a)}sqrt(a){return this.op1("_sqrt",a)}exp(a,n){return n instanceof Uint8Array||(n=va(mn(n))),this.tm.setBuff(this.pOp1,a),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[this.prefix+"_exp"](this.pOp1,this.pOp2,n.byteLength,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}isNegative(a){return this.op1Bool("_isNegative",a)}e(a,n){if(a instanceof Uint8Array)return a;let e=mn(a,n);rl(e)?(e=ul(e),be(e,this.p)&&(e=Zn(e,this.p)),e=Wn(this.p,e)):be(e,this.p)&&(e=Zn(e,this.p));const c=Vl(e,this.n8);return this.toMontgomery(c)}toString(a,n){const e=this.fromMontgomery(a),c=Ga(e,0);return ll(c,n)}fromRng(a){let n;const e=new Uint8Array(this.n8);do{n=sl;for(let c=0;c<this.n64;c++)n=pe(n,he(a.nextU64(),64*c));n=hl(n,this.mask)}while(fl(n,this.p));return yo(e,0,n,this.n8),e}random(){return this.fromRng(Ae())}toObject(a){const n=this.fromMontgomery(a);return Ga(n,0)}fromObject(a){const n=new Uint8Array(this.n8);return yo(n,0,a,this.n8),this.toMontgomery(n)}toRprLE(a,n,e){a.set(this.fromMontgomery(e),n)}toRprBE(a,n,e){const c=this.fromMontgomery(e);for(let i=0;i<this.n8/2;i++){const r=c[i];c[i]=c[this.n8-1-i],c[this.n8-1-i]=r}a.set(c,n)}fromRprLE(a,n){n=n||0;const e=a.slice(n,n+this.n8);return this.toMontgomery(e)}async batchInverse(a){let n=!1;const e=this.n8,c=this.n8;Array.isArray(a)?(a=Ve(a,e),n=!0):a=a.slice(0,a.byteLength);const i=Math.floor(a.byteLength/e);if(i*e!==a.byteLength)throw new Error("Invalid buffer size");const r=Math.floor(i/this.tm.concurrency),_=[];for(let I=0;I<this.tm.concurrency;I++){let b;if(I<this.tm.concurrency-1?b=r:b=i-I*r,b==0)continue;const w=[{cmd:"ALLOCSET",var:0,buff:a.slice(I*r*e,I*r*e+b*e)},{cmd:"ALLOC",var:1,len:c*b},{cmd:"CALL",fnName:this.prefix+"_batchInverse",params:[{var:0},{val:e},{val:b},{var:1},{val:c}]},{cmd:"GET",out:0,var:1,len:c*b}];_.push(this.tm.queueAction(w))}const u=await Promise.all(_);let l;a instanceof un?l=new un(i*c):l=new Uint8Array(i*c);let s=0;for(let I=0;I<u.length;I++)l.set(u[I][0],s),s+=u[I][0].byteLength;return n?wo(l,c):l}}class Xl{constructor(a,n,e){this.tm=a,this.prefix=n,this.F=e,this.type="F2",this.m=e.m*2,this.n8=this.F.n8*2,this.n32=this.F.n32*2,this.n64=this.F.n64*2,this.pOp1=a.alloc(e.n8*2),this.pOp2=a.alloc(e.n8*2),this.pOp3=a.alloc(e.n8*2),this.tm.instance.exports[n+"_zero"](this.pOp1),this.zero=a.getBuff(this.pOp1,this.n8),this.tm.instance.exports[n+"_one"](this.pOp1),this.one=a.getBuff(this.pOp1,this.n8),this.negone=this.neg(this.one),this.two=this.add(this.one,this.one)}op2(a,n,e){return this.tm.setBuff(this.pOp1,n),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[this.prefix+a](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op2Bool(a,n,e){return this.tm.setBuff(this.pOp1,n),this.tm.setBuff(this.pOp2,e),!!this.tm.instance.exports[this.prefix+a](this.pOp1,this.pOp2)}op1(a,n){return this.tm.setBuff(this.pOp1,n),this.tm.instance.exports[this.prefix+a](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op1Bool(a,n){return this.tm.setBuff(this.pOp1,n),!!this.tm.instance.exports[this.prefix+a](this.pOp1,this.pOp3)}add(a,n){return this.op2("_add",a,n)}eq(a,n){return this.op2Bool("_eq",a,n)}isZero(a){return this.op1Bool("_isZero",a)}sub(a,n){return this.op2("_sub",a,n)}neg(a){return this.op1("_neg",a)}inv(a){return this.op1("_inverse",a)}isNegative(a){return this.op1Bool("_isNegative",a)}toMontgomery(a){return this.op1("_toMontgomery",a)}fromMontgomery(a){return this.op1("_fromMontgomery",a)}mul(a,n){return this.op2("_mul",a,n)}mul1(a,n){return this.op2("_mul1",a,n)}div(a,n){return this.tm.setBuff(this.pOp1,a),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[this.prefix+"_inverse"](this.pOp2,this.pOp2),this.tm.instance.exports[this.prefix+"_mul"](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}square(a){return this.op1("_square",a)}isSquare(a){return this.op1Bool("_isSquare",a)}sqrt(a){return this.op1("_sqrt",a)}exp(a,n){return n instanceof Uint8Array||(n=va(mn(n))),this.tm.setBuff(this.pOp1,a),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[this.prefix+"_exp"](this.pOp1,this.pOp2,n.byteLength,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}e(a,n){if(a instanceof Uint8Array)return a;if(Array.isArray(a)&&a.length==2){const e=this.F.e(a[0],n),c=this.F.e(a[1],n),i=new Uint8Array(this.F.n8*2);return i.set(e),i.set(c,this.F.n8*2),i}else throw new Error("invalid F2")}toString(a,n){const e=this.F.toString(a.slice(0,this.F.n8),n),c=this.F.toString(a.slice(this.F.n8),n);return`[${e}, ${c}]`}fromRng(a){const n=this.F.fromRng(a),e=this.F.fromRng(a),c=new Uint8Array(this.F.n8*2);return c.set(n),c.set(e,this.F.n8),c}random(){return this.fromRng(Ae())}toObject(a){const n=this.F.toObject(a.slice(0,this.F.n8)),e=this.F.toObject(a.slice(this.F.n8,this.F.n8*2));return[n,e]}fromObject(a){const n=new Uint8Array(this.F.n8*2),e=this.F.fromObject(a[0]),c=this.F.fromObject(a[1]);return n.set(e),n.set(c,this.F.n8),n}c1(a){return a.slice(0,this.F.n8)}c2(a){return a.slice(this.F.n8)}}class Du{constructor(a,n,e){this.tm=a,this.prefix=n,this.F=e,this.type="F3",this.m=e.m*3,this.n8=this.F.n8*3,this.n32=this.F.n32*3,this.n64=this.F.n64*3,this.pOp1=a.alloc(e.n8*3),this.pOp2=a.alloc(e.n8*3),this.pOp3=a.alloc(e.n8*3),this.tm.instance.exports[n+"_zero"](this.pOp1),this.zero=a.getBuff(this.pOp1,this.n8),this.tm.instance.exports[n+"_one"](this.pOp1),this.one=a.getBuff(this.pOp1,this.n8),this.negone=this.neg(this.one),this.two=this.add(this.one,this.one)}op2(a,n,e){return this.tm.setBuff(this.pOp1,n),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[this.prefix+a](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op2Bool(a,n,e){return this.tm.setBuff(this.pOp1,n),this.tm.setBuff(this.pOp2,e),!!this.tm.instance.exports[this.prefix+a](this.pOp1,this.pOp2)}op1(a,n){return this.tm.setBuff(this.pOp1,n),this.tm.instance.exports[this.prefix+a](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op1Bool(a,n){return this.tm.setBuff(this.pOp1,n),!!this.tm.instance.exports[this.prefix+a](this.pOp1,this.pOp3)}eq(a,n){return this.op2Bool("_eq",a,n)}isZero(a){return this.op1Bool("_isZero",a)}add(a,n){return this.op2("_add",a,n)}sub(a,n){return this.op2("_sub",a,n)}neg(a){return this.op1("_neg",a)}inv(a){return this.op1("_inverse",a)}isNegative(a){return this.op1Bool("_isNegative",a)}toMontgomery(a){return this.op1("_toMontgomery",a)}fromMontgomery(a){return this.op1("_fromMontgomery",a)}mul(a,n){return this.op2("_mul",a,n)}div(a,n){return this.tm.setBuff(this.pOp1,a),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[this.prefix+"_inverse"](this.pOp2,this.pOp2),this.tm.instance.exports[this.prefix+"_mul"](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}square(a){return this.op1("_square",a)}isSquare(a){return this.op1Bool("_isSquare",a)}sqrt(a){return this.op1("_sqrt",a)}exp(a,n){return n instanceof Uint8Array||(n=va(mn(n))),this.tm.setBuff(this.pOp1,a),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[this.prefix+"_exp"](this.pOp1,this.pOp2,n.byteLength,this.pOp3),this.getBuff(this.pOp3,this.n8)}e(a,n){if(a instanceof Uint8Array)return a;if(Array.isArray(a)&&a.length==3){const e=this.F.e(a[0],n),c=this.F.e(a[1],n),i=this.F.e(a[2],n),r=new Uint8Array(this.F.n8*3);return r.set(e),r.set(c,this.F.n8),r.set(i,this.F.n8*2),r}else throw new Error("invalid F3")}toString(a,n){const e=this.F.toString(a.slice(0,this.F.n8),n),c=this.F.toString(a.slice(this.F.n8,this.F.n8*2),n),i=this.F.toString(a.slice(this.F.n8*2),n);return`[${e}, ${c}, ${i}]`}fromRng(a){const n=this.F.fromRng(a),e=this.F.fromRng(a),c=this.F.fromRng(a),i=new Uint8Array(this.F.n8*3);return i.set(n),i.set(e,this.F.n8),i.set(c,this.F.n8*2),i}random(){return this.fromRng(Ae())}toObject(a){const n=this.F.toObject(a.slice(0,this.F.n8)),e=this.F.toObject(a.slice(this.F.n8,this.F.n8*2)),c=this.F.toObject(a.slice(this.F.n8*2,this.F.n8*3));return[n,e,c]}fromObject(a){const n=new Uint8Array(this.F.n8*3),e=this.F.fromObject(a[0]),c=this.F.fromObject(a[1]),i=this.F.fromObject(a[2]);return n.set(e),n.set(c,this.F.n8),n.set(i,this.F.n8*2),n}c1(a){return a.slice(0,this.F.n8)}c2(a){return a.slice(this.F.n8,this.F.n8*2)}c3(a){return a.slice(this.F.n8*2)}}class Wl{constructor(a,n,e,c,i,r){this.tm=a,this.prefix=n,this.F=e,this.pOp1=a.alloc(e.n8*3),this.pOp2=a.alloc(e.n8*3),this.pOp3=a.alloc(e.n8*3),this.tm.instance.exports[n+"_zero"](this.pOp1),this.zero=this.tm.getBuff(this.pOp1,e.n8*3),this.tm.instance.exports[n+"_zeroAffine"](this.pOp1),this.zeroAffine=this.tm.getBuff(this.pOp1,e.n8*2),this.one=this.tm.getBuff(c,e.n8*3),this.g=this.one,this.oneAffine=this.tm.getBuff(c,e.n8*2),this.gAffine=this.oneAffine,this.b=this.tm.getBuff(i,e.n8),r&&(this.cofactor=va(r)),this.negone=this.neg(this.one),this.two=this.add(this.one,this.one),this.batchLEMtoC=ca(a,n+"_batchLEMtoC",e.n8*2,e.n8),this.batchLEMtoU=ca(a,n+"_batchLEMtoU",e.n8*2,e.n8*2),this.batchCtoLEM=ca(a,n+"_batchCtoLEM",e.n8,e.n8*2),this.batchUtoLEM=ca(a,n+"_batchUtoLEM",e.n8*2,e.n8*2),this.batchToJacobian=ca(a,n+"_batchToJacobian",e.n8*2,e.n8*3),this.batchToAffine=ca(a,n+"_batchToAffine",e.n8*3,e.n8*2)}op2(a,n,e){return this.tm.setBuff(this.pOp1,n),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[this.prefix+a](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.F.n8*3)}op2bool(a,n,e){return this.tm.setBuff(this.pOp1,n),this.tm.setBuff(this.pOp2,e),!!this.tm.instance.exports[this.prefix+a](this.pOp1,this.pOp2,this.pOp3)}op1(a,n){return this.tm.setBuff(this.pOp1,n),this.tm.instance.exports[this.prefix+a](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.F.n8*3)}op1Affine(a,n){return this.tm.setBuff(this.pOp1,n),this.tm.instance.exports[this.prefix+a](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.F.n8*2)}op1Bool(a,n){return this.tm.setBuff(this.pOp1,n),!!this.tm.instance.exports[this.prefix+a](this.pOp1,this.pOp3)}add(a,n){if(a.byteLength==this.F.n8*3){if(n.byteLength==this.F.n8*3)return this.op2("_add",a,n);if(n.byteLength==this.F.n8*2)return this.op2("_addMixed",a,n);throw new Error("invalid point size")}else if(a.byteLength==this.F.n8*2){if(n.byteLength==this.F.n8*3)return this.op2("_addMixed",n,a);if(n.byteLength==this.F.n8*2)return this.op2("_addAffine",a,n);throw new Error("invalid point size")}else throw new Error("invalid point size")}sub(a,n){if(a.byteLength==this.F.n8*3){if(n.byteLength==this.F.n8*3)return this.op2("_sub",a,n);if(n.byteLength==this.F.n8*2)return this.op2("_subMixed",a,n);throw new Error("invalid point size")}else if(a.byteLength==this.F.n8*2){if(n.byteLength==this.F.n8*3)return this.op2("_subMixed",n,a);if(n.byteLength==this.F.n8*2)return this.op2("_subAffine",a,n);throw new Error("invalid point size")}else throw new Error("invalid point size")}neg(a){if(a.byteLength==this.F.n8*3)return this.op1("_neg",a);if(a.byteLength==this.F.n8*2)return this.op1Affine("_negAffine",a);throw new Error("invalid point size")}double(a){if(a.byteLength==this.F.n8*3)return this.op1("_double",a);if(a.byteLength==this.F.n8*2)return this.op1("_doubleAffine",a);throw new Error("invalid point size")}isZero(a){if(a.byteLength==this.F.n8*3)return this.op1Bool("_isZero",a);if(a.byteLength==this.F.n8*2)return this.op1Bool("_isZeroAffine",a);throw new Error("invalid point size")}timesScalar(a,n){n instanceof Uint8Array||(n=va(mn(n)));let e;if(a.byteLength==this.F.n8*3)e=this.prefix+"_timesScalar";else if(a.byteLength==this.F.n8*2)e=this.prefix+"_timesScalarAffine";else throw new Error("invalid point size");return this.tm.setBuff(this.pOp1,a),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[e](this.pOp1,this.pOp2,n.byteLength,this.pOp3),this.tm.getBuff(this.pOp3,this.F.n8*3)}timesFr(a,n){let e;if(a.byteLength==this.F.n8*3)e=this.prefix+"_timesFr";else if(a.byteLength==this.F.n8*2)e=this.prefix+"_timesFrAffine";else throw new Error("invalid point size");return this.tm.setBuff(this.pOp1,a),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[e](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.F.n8*3)}eq(a,n){if(a.byteLength==this.F.n8*3){if(n.byteLength==this.F.n8*3)return this.op2bool("_eq",a,n);if(n.byteLength==this.F.n8*2)return this.op2bool("_eqMixed",a,n);throw new Error("invalid point size")}else if(a.byteLength==this.F.n8*2){if(n.byteLength==this.F.n8*3)return this.op2bool("_eqMixed",n,a);if(n.byteLength==this.F.n8*2)return this.op2bool("_eqAffine",a,n);throw new Error("invalid point size")}else throw new Error("invalid point size")}toAffine(a){if(a.byteLength==this.F.n8*3)return this.op1Affine("_toAffine",a);if(a.byteLength==this.F.n8*2)return a;throw new Error("invalid point size")}toJacobian(a){if(a.byteLength==this.F.n8*3)return a;if(a.byteLength==this.F.n8*2)return this.op1("_toJacobian",a);throw new Error("invalid point size")}toRprUncompressed(a,n,e){if(this.tm.setBuff(this.pOp1,e),e.byteLength==this.F.n8*3)this.tm.instance.exports[this.prefix+"_toAffine"](this.pOp1,this.pOp1);else if(e.byteLength!=this.F.n8*2)throw new Error("invalid point size");this.tm.instance.exports[this.prefix+"_LEMtoU"](this.pOp1,this.pOp1);const c=this.tm.getBuff(this.pOp1,this.F.n8*2);a.set(c,n)}fromRprUncompressed(a,n){const e=a.slice(n,n+this.F.n8*2);return this.tm.setBuff(this.pOp1,e),this.tm.instance.exports[this.prefix+"_UtoLEM"](this.pOp1,this.pOp1),this.tm.getBuff(this.pOp1,this.F.n8*2)}toRprCompressed(a,n,e){if(this.tm.setBuff(this.pOp1,e),e.byteLength==this.F.n8*3)this.tm.instance.exports[this.prefix+"_toAffine"](this.pOp1,this.pOp1);else if(e.byteLength!=this.F.n8*2)throw new Error("invalid point size");this.tm.instance.exports[this.prefix+"_LEMtoC"](this.pOp1,this.pOp1);const c=this.tm.getBuff(this.pOp1,this.F.n8);a.set(c,n)}fromRprCompressed(a,n){const e=a.slice(n,n+this.F.n8);return this.tm.setBuff(this.pOp1,e),this.tm.instance.exports[this.prefix+"_CtoLEM"](this.pOp1,this.pOp2),this.tm.getBuff(this.pOp2,this.F.n8*2)}toUncompressed(a){const n=new Uint8Array(this.F.n8*2);return this.toRprUncompressed(n,0,a),n}toRprLEM(a,n,e){if(e.byteLength==this.F.n8*2){a.set(e,n);return}else if(e.byteLength==this.F.n8*3){this.tm.setBuff(this.pOp1,e),this.tm.instance.exports[this.prefix+"_toAffine"](this.pOp1,this.pOp1);const c=this.tm.getBuff(this.pOp1,this.F.n8*2);a.set(c,n)}else throw new Error("invalid point size")}fromRprLEM(a,n){return n=n||0,a.slice(n,n+this.F.n8*2)}toString(a,n){if(a.byteLength==this.F.n8*3){const e=this.F.toString(a.slice(0,this.F.n8),n),c=this.F.toString(a.slice(this.F.n8,this.F.n8*2),n),i=this.F.toString(a.slice(this.F.n8*2),n);return`[ ${e}, ${c}, ${i} ]`}else if(a.byteLength==this.F.n8*2){const e=this.F.toString(a.slice(0,this.F.n8),n),c=this.F.toString(a.slice(this.F.n8),n);return`[ ${e}, ${c} ]`}else throw new Error("invalid point size")}isValid(a){if(this.isZero(a))return!0;const n=this.F,e=this.toAffine(a),c=e.slice(0,this.F.n8),i=e.slice(this.F.n8,this.F.n8*2),r=n.add(n.mul(n.square(c),c),this.b),_=n.square(i);return n.eq(r,_)}fromRng(a){const n=this.F;let e=[],c,i;do e[0]=n.fromRng(a),c=a.nextBool(),i=n.add(n.mul(n.square(e[0]),e[0]),this.b);while(!n.isSquare(i));e[1]=n.sqrt(i);const r=n.isNegative(e[1]);c^r&&(e[1]=n.neg(e[1]));let _=new Uint8Array(this.F.n8*2);return _.set(e[0]),_.set(e[1],this.F.n8),this.cofactor&&(_=this.timesScalar(_,this.cofactor)),_}toObject(a){if(this.isZero(a))return[this.F.toObject(this.F.zero),this.F.toObject(this.F.one),this.F.toObject(this.F.zero)];const n=this.F.toObject(a.slice(0,this.F.n8)),e=this.F.toObject(a.slice(this.F.n8,this.F.n8*2));let c;return a.byteLength==this.F.n8*3?c=this.F.toObject(a.slice(this.F.n8*2,this.F.n8*3)):c=this.F.toObject(this.F.one),[n,e,c]}fromObject(a){const n=this.F.fromObject(a[0]),e=this.F.fromObject(a[1]);let c;if(a.length==3?c=this.F.fromObject(a[2]):c=this.F.one,this.F.isZero(c,this.F.one))return this.zeroAffine;if(this.F.eq(c,this.F.one)){const i=new Uint8Array(this.F.n8*2);return i.set(n),i.set(e,this.F.n8),i}else{const i=new Uint8Array(this.F.n8*3);return i.set(n),i.set(e,this.F.n8),i.set(c,this.F.n8*2),i}}e(a){return a instanceof Uint8Array?a:this.fromObject(a)}x(a){return this.toAffine(a).slice(0,this.F.n8)}y(a){return this.toAffine(a).slice(this.F.n8)}}function Jl(t){let n,e;t&&(t.onmessage=function(s){let I;if(s.data?I=s.data:I=s,I[0].cmd=="INIT")c(I[0]).then(function(){t.postMessage(I.result)});else if(I[0].cmd=="TERMINATE")t.close();else{const b=l(I);t.postMessage(b)}});async function c(s){const I=new Uint8Array(s.code),b=await WebAssembly.compile(I);e=new WebAssembly.Memory({initial:s.init,maximum:32767}),n=await WebAssembly.instantiate(b,{env:{memory:e}})}function i(s){const I=new Uint32Array(e.buffer,0,1);for(;I[0]&3;)I[0]++;const b=I[0];if(I[0]+=s,I[0]+s>e.buffer.byteLength){const f=e.buffer.byteLength/65536;let w=Math.floor((I[0]+s)/65536)+1;w>32767&&(w=32767),e.grow(w-f)}return b}function r(s){const I=i(s.byteLength);return u(I,s),I}function _(s,I){const b=new Uint8Array(e.buffer);return new Uint8Array(b.buffer,b.byteOffset+s,I)}function u(s,I){new Uint8Array(e.buffer).set(new Uint8Array(I),s)}function l(s){if(s[0].cmd=="INIT")return c(s[0]);const I={vars:[],out:[]},f=new Uint32Array(e.buffer,0,1)[0];for(let O=0;O<s.length;O++)switch(s[O].cmd){case"ALLOCSET":I.vars[s[O].var]=r(s[O].buff);break;case"ALLOC":I.vars[s[O].var]=i(s[O].len);break;case"SET":u(I.vars[s[O].var],s[O].buff);break;case"CALL":{const D=[];for(let G=0;G<s[O].params.length;G++){const V=s[O].params[G];typeof V.var<"u"?D.push(I.vars[V.var]+(V.offset||0)):typeof V.val<"u"&&D.push(V.val)}n.exports[s[O].fnName](...D);break}case"GET":I.out[s[O].out]=_(I.vars[s[O].var],s[O].len).slice();break;default:throw new Error("Invalid cmd")}const w=new Uint32Array(e.buffer,0,1);return w[0]=f,I.out}return l}const Ye=25;class ts{constructor(){this.promise=new Promise((a,n)=>{this.reject=n,this.resolve=a})}}function Qu(t){return new Promise(a=>setTimeout(a,t))}function $u(t){return process.browser?globalThis.btoa(t):Buffer.from(t).toString("base64")}const Gu="data:application/javascript;base64,"+$u("("+Jl.toString()+")(self)");async function Zu(t,a){const n=new ju;n.memory=new WebAssembly.Memory({initial:Ye}),n.u8=new Uint8Array(n.memory.buffer),n.u32=new Uint32Array(n.memory.buffer);const e=await WebAssembly.compile(t.code);if(n.instance=await WebAssembly.instantiate(e,{env:{memory:n.memory}}),n.singleThread=a,n.initalPFree=n.u32[0],n.pq=t.pq,n.pr=t.pr,n.pG1gen=t.pG1gen,n.pG1zero=t.pG1zero,n.pG2gen=t.pG2gen,n.pG2zero=t.pG2zero,n.pOneT=t.pOneT,a)n.code=t.code,n.taskManager=Jl(),await n.taskManager([{cmd:"INIT",init:Ye,code:n.code.slice()}]),n.concurrency=1;else{n.workers=[],n.pendingDeferreds=[],n.working=[];let i;typeof navigator=="object"&&navigator.hardwareConcurrency?i=navigator.hardwareConcurrency:i=Ua.cpus().length,i==0&&(i=2),i>64&&(i=64),n.concurrency=i;for(let _=0;_<i;_++)n.workers[_]=new o2(Gu),n.workers[_].addEventListener("message",c(_)),n.working[_]=!1;const r=[];for(let _=0;_<n.workers.length;_++){const u=t.code.slice();r.push(n.postAction(_,[{cmd:"INIT",init:Ye,code:u}],[u.buffer]))}await Promise.all(r)}return n;function c(i){return function(r){let _;r&&r.data?_=r.data:_=r,n.working[i]=!1,n.pendingDeferreds[i].resolve(_),n.processWorks()}}}class ju{constructor(){this.actionQueue=[],this.oldPFree=0}startSyncOp(){if(this.oldPFree!=0)throw new Error("Sync operation in progress");this.oldPFree=this.u32[0]}endSyncOp(){if(this.oldPFree==0)throw new Error("No sync operation in progress");this.u32[0]=this.oldPFree,this.oldPFree=0}postAction(a,n,e,c){if(this.working[a])throw new Error("Posting a job t a working worker");return this.working[a]=!0,this.pendingDeferreds[a]=c||new ts,this.workers[a].postMessage(n,e),this.pendingDeferreds[a].promise}processWorks(){for(let a=0;a<this.workers.length&&this.actionQueue.length>0;a++)if(this.working[a]==!1){const n=this.actionQueue.shift();this.postAction(a,n.data,n.transfers,n.deferred)}}queueAction(a,n){const e=new ts;if(this.singleThread){const c=this.taskManager(a);e.resolve(c)}else this.actionQueue.push({data:a,transfers:n,deferred:e}),this.processWorks();return e.promise}resetMemory(){this.u32[0]=this.initalPFree}allocBuff(a){const n=this.alloc(a.byteLength);return this.setBuff(n,a),n}getBuff(a,n){return this.u8.slice(a,a+n)}setBuff(a,n){this.u8.set(new Uint8Array(n),a)}alloc(a){for(;this.u32[0]&3;)this.u32[0]++;const n=this.u32[0];return this.u32[0]+=a,n}async terminate(){for(let a=0;a<this.workers.length;a++)this.workers[a].postMessage([{cmd:"TERMINATE"}]);await Qu(200)}}function Xe(t,a){const n=t[a],e=t.Fr,c=t.tm;t[a].batchApplyKey=async function(i,r,_,u,l){u=u||"affine",l=l||"affine";let s,I,b,f,w;if(a=="G1")u=="jacobian"?(b=n.F.n8*3,s="g1m_batchApplyKey"):(b=n.F.n8*2,s="g1m_batchApplyKeyMixed"),f=n.F.n8*3,l=="jacobian"?w=n.F.n8*3:(I="g1m_batchToAffine",w=n.F.n8*2);else if(a=="G2")u=="jacobian"?(b=n.F.n8*3,s="g2m_batchApplyKey"):(b=n.F.n8*2,s="g2m_batchApplyKeyMixed"),f=n.F.n8*3,l=="jacobian"?w=n.F.n8*3:(I="g2m_batchToAffine",w=n.F.n8*2);else if(a=="Fr")s="frm_batchApplyKey",b=n.n8,f=n.n8,w=n.n8;else throw new Error("Invalid group: "+a);const O=Math.floor(i.byteLength/b),D=Math.floor(O/c.concurrency),G=[];_=e.e(_);let V=e.e(r);for(let M=0;M<c.concurrency;M++){let h;if(M<c.concurrency-1?h=D:h=O-M*D,h==0)continue;const y=[];y.push({cmd:"ALLOCSET",var:0,buff:i.slice(M*D*b,M*D*b+h*b)}),y.push({cmd:"ALLOCSET",var:1,buff:V}),y.push({cmd:"ALLOCSET",var:2,buff:_}),y.push({cmd:"ALLOC",var:3,len:h*Math.max(f,w)}),y.push({cmd:"CALL",fnName:s,params:[{var:0},{val:h},{var:1},{var:2},{var:3}]}),I&&y.push({cmd:"CALL",fnName:I,params:[{var:3},{val:h},{var:3}]}),y.push({cmd:"GET",out:0,var:3,len:h*w}),G.push(c.queueAction(y)),V=e.mul(V,e.exp(_,h))}const it=await Promise.all(G);let Z;i instanceof un?Z=new un(O*w):Z=new Uint8Array(O*w);let E=0;for(let M=0;M<it.length;M++)Z.set(it[M][0],E),E+=it[M][0].byteLength;return Z}}function Ku(t){const a=t.tm;t.pairing=function(e,c){a.startSyncOp();const i=a.allocBuff(t.G1.toJacobian(e)),r=a.allocBuff(t.G2.toJacobian(c)),_=a.alloc(t.Gt.n8);a.instance.exports[t.name+"_pairing"](i,r,_);const u=a.getBuff(_,t.Gt.n8);return a.endSyncOp(),u},t.pairingEq=async function(){let e,c;arguments.length%2==1?(e=arguments[arguments.length-1],c=(arguments.length-1)/2):(e=t.Gt.one,c=arguments.length/2);const i=[];for(let s=0;s<c;s++){const I=[],b=t.G1.toJacobian(arguments[s*2]);I.push({cmd:"ALLOCSET",var:0,buff:b}),I.push({cmd:"ALLOC",var:1,len:t.prePSize});const f=t.G2.toJacobian(arguments[s*2+1]);I.push({cmd:"ALLOCSET",var:2,buff:f}),I.push({cmd:"ALLOC",var:3,len:t.preQSize}),I.push({cmd:"ALLOC",var:4,len:t.Gt.n8}),I.push({cmd:"CALL",fnName:t.name+"_prepareG1",params:[{var:0},{var:1}]}),I.push({cmd:"CALL",fnName:t.name+"_prepareG2",params:[{var:2},{var:3}]}),I.push({cmd:"CALL",fnName:t.name+"_millerLoop",params:[{var:1},{var:3},{var:4}]}),I.push({cmd:"GET",out:0,var:4,len:t.Gt.n8}),i.push(a.queueAction(I))}const r=await Promise.all(i);a.startSyncOp();const _=a.alloc(t.Gt.n8);a.instance.exports.ftm_one(_);for(let s=0;s<r.length;s++){const I=a.allocBuff(r[s][0]);a.instance.exports.ftm_mul(_,I,_)}a.instance.exports[t.name+"_finalExponentiation"](_,_);const u=a.allocBuff(e),l=!!a.instance.exports.ftm_eq(_,u);return a.endSyncOp(),l},t.prepareG1=function(n){this.tm.startSyncOp();const e=this.tm.allocBuff(n),c=this.tm.alloc(this.prePSize);this.tm.instance.exports[this.name+"_prepareG1"](e,c);const i=this.tm.getBuff(c,this.prePSize);return this.tm.endSyncOp(),i},t.prepareG2=function(n){this.tm.startSyncOp();const e=this.tm.allocBuff(n),c=this.tm.alloc(this.preQSize);this.tm.instance.exports[this.name+"_prepareG2"](e,c);const i=this.tm.getBuff(c,this.preQSize);return this.tm.endSyncOp(),i},t.millerLoop=function(n,e){this.tm.startSyncOp();const c=this.tm.allocBuff(n),i=this.tm.allocBuff(e),r=this.tm.alloc(this.Gt.n8);this.tm.instance.exports[this.name+"_millerLoop"](c,i,r);const _=this.tm.getBuff(r,this.Gt.n8);return this.tm.endSyncOp(),_},t.finalExponentiation=function(n){this.tm.startSyncOp();const e=this.tm.allocBuff(n),c=this.tm.alloc(this.Gt.n8);this.tm.instance.exports[this.name+"_finalExponentiation"](e,c);const i=this.tm.getBuff(c,this.Gt.n8);return this.tm.endSyncOp(),i}}const ns=[1,1,1,1,2,3,4,5,6,7,7,8,9,10,11,12,13,13,14,15,16,16,17,17,17,17,17,17,17,17,17,17];function as(t,a){const n=t[a],e=n.tm;async function c(r,_,u,l,s){if(!(r instanceof Uint8Array))throw l&&l.error(`${s} _multiExpChunk buffBases is not Uint8Array`),new Error(`${s} _multiExpChunk buffBases is not Uint8Array`);if(!(_ instanceof Uint8Array))throw l&&l.error(`${s} _multiExpChunk buffScalars is not Uint8Array`),new Error(`${s} _multiExpChunk buffScalars is not Uint8Array`);u=u||"affine";let I,b;if(a=="G1")u=="affine"?(b="g1m_multiexpAffine_chunk",I=n.F.n8*2):(b="g1m_multiexp_chunk",I=n.F.n8*3);else if(a=="G2")u=="affine"?(b="g2m_multiexpAffine_chunk",I=n.F.n8*2):(b="g2m_multiexp_chunk",I=n.F.n8*3);else throw new Error("Invalid group");const f=Math.floor(r.byteLength/I);if(f==0)return n.zero;const w=Math.floor(_.byteLength/f);if(w*f!=_.byteLength)throw new Error("Scalar size does not match");const O=ns[Mn(f)],D=Math.floor((w*8-1)/O)+1,G=[];for(let Z=0;Z<D;Z++){const E=[{cmd:"ALLOCSET",var:0,buff:r},{cmd:"ALLOCSET",var:1,buff:_},{cmd:"ALLOC",var:2,len:n.F.n8*3},{cmd:"CALL",fnName:b,params:[{var:0},{var:1},{val:w},{val:f},{val:Z*O},{val:Math.min(w*8-Z*O,O)},{var:2}]},{cmd:"GET",out:0,var:2,len:n.F.n8*3}];G.push(n.tm.queueAction(E))}const V=await Promise.all(G);let it=n.zero;for(let Z=V.length-1;Z>=0;Z--){if(!n.isZero(it))for(let E=0;E<O;E++)it=n.double(it);it=n.add(it,V[Z][0])}return it}async function i(r,_,u,l,s){let f;if(a=="G1")u=="affine"?f=n.F.n8*2:f=n.F.n8*3;else if(a=="G2")u=="affine"?f=n.F.n8*2:f=n.F.n8*3;else throw new Error("Invalid group");const w=Math.floor(r.byteLength/f),O=Math.floor(_.byteLength/w);if(O*w!=_.byteLength)throw new Error("Scalar size does not match");const D=ns[Mn(w)],G=Math.floor((O*8-1)/D)+1;let V;V=Math.floor(w/(e.concurrency/G)),V>4194304&&(V=4194304),V<1024&&(V=1024);const it=[];for(let M=0;M<w;M+=V){l&&l.debug(`Multiexp start: ${s}: ${M}/${w}`);const h=Math.min(w-M,V),y=r.slice(M*f,(M+h)*f),q=_.slice(M*O,(M+h)*O);it.push(c(y,q,u,l,s).then(g=>(l&&l.debug(`Multiexp end: ${s}: ${M}/${w}`),g)))}const Z=await Promise.all(it);let E=n.zero;for(let M=Z.length-1;M>=0;M--)E=n.add(E,Z[M]);return E}n.multiExp=async function(_,u,l,s){return await i(_,u,"jacobian",l,s)},n.multiExpAffine=async function(_,u,l,s){return await i(_,u,"affine",l,s)}}function We(t,a){const n=t[a],e=t.Fr,c=n.tm;async function i(l,s,I,b,f,w){I=I||"affine",b=b||"affine";const O=14;let D,G,V,it,Z,E,M,h;a=="G1"?(I=="affine"?(D=n.F.n8*2,it="g1m_batchToJacobian"):D=n.F.n8*3,G=n.F.n8*3,s&&(h="g1m_fftFinal"),M="g1m_fftJoin",E="g1m_fftMix",b=="affine"?(V=n.F.n8*2,Z="g1m_batchToAffine"):V=n.F.n8*3):a=="G2"?(I=="affine"?(D=n.F.n8*2,it="g2m_batchToJacobian"):D=n.F.n8*3,G=n.F.n8*3,s&&(h="g2m_fftFinal"),M="g2m_fftJoin",E="g2m_fftMix",b=="affine"?(V=n.F.n8*2,Z="g2m_batchToAffine"):V=n.F.n8*3):a=="Fr"&&(D=n.n8,G=n.n8,V=n.n8,s&&(h="frm_fftFinal"),E="frm_fftMix",M="frm_fftJoin");let y=!1;Array.isArray(l)?(l=Ve(l,D),y=!0):l=l.slice(0,l.byteLength);const q=l.byteLength/D,g=Mn(q);if(1<<g!=q)throw new Error("fft must be multiple of 2");if(g==e.s+1){let et;return s?et=await _(l,I,b,f,w):et=await r(l,I,b,f,w),y?wo(et,V):et}let x;s&&(x=e.inv(e.e(q)));let H;Hl(l,D);let T,N=Math.min(1<<O,q),P=q/N;for(;P<c.concurrency&&N>=16;)P*=2,N/=2;const v=Mn(N),S=[];for(let et=0;et<P;et++){f&&f.debug(`${w}: fft ${g} mix start: ${et}/${P}`);const _t=[];_t.push({cmd:"ALLOC",var:0,len:G*N});const mt=l.slice(N*et*D,N*(et+1)*D);_t.push({cmd:"SET",var:0,buff:mt}),it&&_t.push({cmd:"CALL",fnName:it,params:[{var:0},{val:N},{var:0}]});for(let xt=1;xt<=v;xt++)_t.push({cmd:"CALL",fnName:E,params:[{var:0},{val:N},{val:xt}]});v==g?(h&&(_t.push({cmd:"ALLOCSET",var:1,buff:x}),_t.push({cmd:"CALL",fnName:h,params:[{var:0},{val:N},{var:1}]})),Z&&_t.push({cmd:"CALL",fnName:Z,params:[{var:0},{val:N},{var:0}]}),_t.push({cmd:"GET",out:0,var:0,len:N*V})):_t.push({cmd:"GET",out:0,var:0,len:G*N}),S.push(c.queueAction(_t).then(xt=>(f&&f.debug(`${w}: fft ${g} mix end: ${et}/${P}`),xt)))}T=await Promise.all(S);for(let et=0;et<P;et++)T[et]=T[et][0];for(let et=v+1;et<=g;et++){f&&f.debug(`${w}: fft ${g} join: ${et}/${g}`);const _t=1<<g-et,mt=P/_t,xt=[];for(let zt=0;zt<_t;zt++)for(let Rt=0;Rt<mt/2;Rt++){const k=e.exp(e.w[et],Rt*N),Ct=e.w[et],St=zt*mt+Rt,F=zt*mt+Rt+mt/2,o=[];o.push({cmd:"ALLOCSET",var:0,buff:T[St]}),o.push({cmd:"ALLOCSET",var:1,buff:T[F]}),o.push({cmd:"ALLOCSET",var:2,buff:k}),o.push({cmd:"ALLOCSET",var:3,buff:Ct}),o.push({cmd:"CALL",fnName:M,params:[{var:0},{var:1},{val:N},{var:2},{var:3}]}),et==g?(h&&(o.push({cmd:"ALLOCSET",var:4,buff:x}),o.push({cmd:"CALL",fnName:h,params:[{var:0},{val:N},{var:4}]}),o.push({cmd:"CALL",fnName:h,params:[{var:1},{val:N},{var:4}]})),Z&&(o.push({cmd:"CALL",fnName:Z,params:[{var:0},{val:N},{var:0}]}),o.push({cmd:"CALL",fnName:Z,params:[{var:1},{val:N},{var:1}]})),o.push({cmd:"GET",out:0,var:0,len:N*V}),o.push({cmd:"GET",out:1,var:1,len:N*V})):(o.push({cmd:"GET",out:0,var:0,len:N*G}),o.push({cmd:"GET",out:1,var:1,len:N*G})),xt.push(c.queueAction(o).then(L=>(f&&f.debug(`${w}: fft ${g} join ${et}/${g} ${zt+1}/${_t} ${Rt}/${mt/2}`),L)))}const Pt=await Promise.all(xt);for(let zt=0;zt<_t;zt++)for(let Rt=0;Rt<mt/2;Rt++){const k=zt*mt+Rt,Ct=zt*mt+Rt+mt/2,St=Pt.shift();T[k]=St[0],T[Ct]=St[1]}}if(l instanceof un?H=new un(q*V):H=new Uint8Array(q*V),s){H.set(T[0].slice((N-1)*V));let et=V;for(let _t=P-1;_t>0;_t--)H.set(T[_t],et),et+=N*V,delete T[_t];H.set(T[0].slice(0,(N-1)*V),et),delete T[0]}else for(let et=0;et<P;et++)H.set(T[et],N*V*et),delete T[et];return y?wo(H,V):H}async function r(l,s,I,b,f){let w,O;w=l.slice(0,l.byteLength/2),O=l.slice(l.byteLength/2,l.byteLength);const D=[];[w,O]=await u(w,O,"fftJoinExt",e.one,e.shift,s,"jacobian",b,f),D.push(i(w,!1,"jacobian",I,b,f)),D.push(i(O,!1,"jacobian",I,b,f));const G=await Promise.all(D);let V;return G[0].byteLength>1<<28?V=new un(G[0].byteLength*2):V=new Uint8Array(G[0].byteLength*2),V.set(G[0]),V.set(G[1],G[0].byteLength),V}async function _(l,s,I,b,f){let w,O;w=l.slice(0,l.byteLength/2),O=l.slice(l.byteLength/2,l.byteLength);const D=[];D.push(i(w,!0,s,"jacobian",b,f)),D.push(i(O,!0,s,"jacobian",b,f)),[w,O]=await Promise.all(D);const G=await u(w,O,"fftJoinExtInv",e.one,e.shiftInv,"jacobian",I,b,f);let V;return G[0].byteLength>1<<28?V=new un(G[0].byteLength*2):V=new Uint8Array(G[0].byteLength*2),V.set(G[0]),V.set(G[1],G[0].byteLength),V}async function u(l,s,I,b,f,w,O,D,G){let Z,E,M,h,y,q;if(a=="G1")w=="affine"?(y=n.F.n8*2,E="g1m_batchToJacobian"):y=n.F.n8*3,q=n.F.n8*3,Z="g1m_"+I,O=="affine"?(M="g1m_batchToAffine",h=n.F.n8*2):h=n.F.n8*3;else if(a=="G2")w=="affine"?(y=n.F.n8*2,E="g2m_batchToJacobian"):y=n.F.n8*3,Z="g2m_"+I,q=n.F.n8*3,O=="affine"?(M="g2m_batchToAffine",h=n.F.n8*2):h=n.F.n8*3;else if(a=="Fr")y=e.n8,h=e.n8,q=e.n8,Z="frm_"+I;else throw new Error("Invalid group");if(l.byteLength!=s.byteLength)throw new Error("Invalid buffer size");const g=Math.floor(l.byteLength/y);if(g!=1<<Mn(g))throw new Error("Invalid number of points");let x=Math.floor(g/c.concurrency);x<16&&(x=16),x>65536&&(x=65536);const H=[];for(let S=0;S<g;S+=x){D&&D.debug(`${G}: fftJoinExt Start: ${S}/${g}`);const et=Math.min(g-S,x),_t=e.mul(b,e.exp(f,S)),mt=[],xt=l.slice(S*y,(S+et)*y),Pt=s.slice(S*y,(S+et)*y);mt.push({cmd:"ALLOC",var:0,len:q*et}),mt.push({cmd:"SET",var:0,buff:xt}),mt.push({cmd:"ALLOC",var:1,len:q*et}),mt.push({cmd:"SET",var:1,buff:Pt}),mt.push({cmd:"ALLOCSET",var:2,buff:_t}),mt.push({cmd:"ALLOCSET",var:3,buff:f}),E&&(mt.push({cmd:"CALL",fnName:E,params:[{var:0},{val:et},{var:0}]}),mt.push({cmd:"CALL",fnName:E,params:[{var:1},{val:et},{var:1}]})),mt.push({cmd:"CALL",fnName:Z,params:[{var:0},{var:1},{val:et},{var:2},{var:3},{val:e.s}]}),M&&(mt.push({cmd:"CALL",fnName:M,params:[{var:0},{val:et},{var:0}]}),mt.push({cmd:"CALL",fnName:M,params:[{var:1},{val:et},{var:1}]})),mt.push({cmd:"GET",out:0,var:0,len:et*h}),mt.push({cmd:"GET",out:1,var:1,len:et*h}),H.push(c.queueAction(mt).then(zt=>(D&&D.debug(`${G}: fftJoinExt End: ${S}/${g}`),zt)))}const T=await Promise.all(H);let N,P;g*h>1<<28?(N=new un(g*h),P=new un(g*h)):(N=new Uint8Array(g*h),P=new Uint8Array(g*h));let v=0;for(let S=0;S<T.length;S++)N.set(T[S][0],v),P.set(T[S][1],v),v+=T[S][0].byteLength;return[N,P]}n.fft=async function(l,s,I,b,f){return await i(l,!1,s,I,b,f)},n.ifft=async function(l,s,I,b,f){return await i(l,!0,s,I,b,f)},n.lagrangeEvaluations=async function(l,s,I,b,f){s=s||"affine",I=I||"affine";let w;if(a=="G1")s=="affine"?w=n.F.n8*2:w=n.F.n8*3;else if(a=="G2")s=="affine"?w=n.F.n8*2:w=n.F.n8*3;else if(a=="Fr")w=e.n8;else throw new Error("Invalid group");const O=l.byteLength/w,D=Mn(O);if(2**D*w!=l.byteLength)throw b&&b.error("lagrangeEvaluations iinvalid input size"),new Error("lagrangeEvaluations invalid Input size");if(D<=e.s)return await n.ifft(l,s,I,b,f);if(D>e.s+1)throw b&&b.error("lagrangeEvaluations input too big"),new Error("lagrangeEvaluations input too big");let G=l.slice(0,l.byteLength/2),V=l.slice(l.byteLength/2,l.byteLength);const it=e.exp(e.shift,O/2),Z=e.inv(e.sub(e.one,it));[G,V]=await u(G,V,"prepareLagrangeEvaluation",Z,e.shiftInv,s,"jacobian",b,f+" prep");const E=[];E.push(i(G,!0,"jacobian",I,b,f+" t0")),E.push(i(V,!0,"jacobian",I,b,f+" t1")),[G,V]=await Promise.all(E);let M;return G.byteLength>1<<28?M=new un(G.byteLength*2):M=new Uint8Array(G.byteLength*2),M.set(G),M.set(V,G.byteLength),M},n.fftMix=async function(s){const I=n.F.n8*3;let b,f;if(a=="G1")b="g1m_fftMix",f="g1m_fftJoin";else if(a=="G2")b="g2m_fftMix",f="g2m_fftJoin";else if(a=="Fr")b="frm_fftMix",f="frm_fftJoin";else throw new Error("Invalid group");const w=Math.floor(s.byteLength/I),O=Mn(w);let D=1<<Mn(c.concurrency);w<=D*2&&(D=1);const G=w/D,V=Mn(G),it=[];for(let y=0;y<D;y++){const q=[],g=s.slice(y*G*I,(y+1)*G*I);q.push({cmd:"ALLOCSET",var:0,buff:g});for(let x=1;x<=V;x++)q.push({cmd:"CALL",fnName:b,params:[{var:0},{val:G},{val:x}]});q.push({cmd:"GET",out:0,var:0,len:G*I}),it.push(c.queueAction(q))}const Z=await Promise.all(it),E=[];for(let y=0;y<Z.length;y++)E[y]=Z[y][0];for(let y=V+1;y<=O;y++){const q=1<<O-y,g=D/q,x=[];for(let T=0;T<q;T++)for(let N=0;N<g/2;N++){const P=e.exp(e.w[y],N*G),v=e.w[y],S=T*g+N,et=T*g+N+g/2,_t=[];_t.push({cmd:"ALLOCSET",var:0,buff:E[S]}),_t.push({cmd:"ALLOCSET",var:1,buff:E[et]}),_t.push({cmd:"ALLOCSET",var:2,buff:P}),_t.push({cmd:"ALLOCSET",var:3,buff:v}),_t.push({cmd:"CALL",fnName:f,params:[{var:0},{var:1},{val:G},{var:2},{var:3}]}),_t.push({cmd:"GET",out:0,var:0,len:G*I}),_t.push({cmd:"GET",out:1,var:1,len:G*I}),x.push(c.queueAction(_t))}const H=await Promise.all(x);for(let T=0;T<q;T++)for(let N=0;N<g/2;N++){const P=T*g+N,v=T*g+N+g/2,S=H.shift();E[P]=S[0],E[v]=S[1]}}let M;s instanceof un?M=new un(w*I):M=new Uint8Array(w*I);let h=0;for(let y=0;y<D;y++)M.set(E[y],h),h+=E[y].byteLength;return M},n.fftJoin=async function(s,I,b,f){const w=n.F.n8*3;let O;if(a=="G1")O="g1m_fftJoin";else if(a=="G2")O="g2m_fftJoin";else if(a=="Fr")O="frm_fftJoin";else throw new Error("Invalid group");if(s.byteLength!=I.byteLength)throw new Error("Invalid buffer size");const D=Math.floor(s.byteLength/w);if(D!=1<<Mn(D))throw new Error("Invalid number of points");let G=1<<Mn(c.concurrency);D<=G*2&&(G=1);const V=D/G,it=[];for(let y=0;y<G;y++){const q=[],g=e.mul(b,e.exp(f,y*V)),x=s.slice(y*V*w,(y+1)*V*w),H=I.slice(y*V*w,(y+1)*V*w);q.push({cmd:"ALLOCSET",var:0,buff:x}),q.push({cmd:"ALLOCSET",var:1,buff:H}),q.push({cmd:"ALLOCSET",var:2,buff:g}),q.push({cmd:"ALLOCSET",var:3,buff:f}),q.push({cmd:"CALL",fnName:O,params:[{var:0},{var:1},{val:V},{var:2},{var:3}]}),q.push({cmd:"GET",out:0,var:0,len:V*w}),q.push({cmd:"GET",out:1,var:1,len:V*w}),it.push(c.queueAction(q))}const Z=await Promise.all(it);let E,M;s instanceof un?(E=new un(D*w),M=new un(D*w)):(E=new Uint8Array(D*w),M=new Uint8Array(D*w));let h=0;for(let y=0;y<Z.length;y++)E.set(Z[y][0],h),M.set(Z[y][1],h),h+=Z[y][0].byteLength;return[E,M]},n.fftFinal=async function(s,I){const b=n.F.n8*3,f=n.F.n8*2;let w,O;if(a=="G1")w="g1m_fftFinal",O="g1m_batchToAffine";else if(a=="G2")w="g2m_fftFinal",O="g2m_batchToAffine";else throw new Error("Invalid group");const D=Math.floor(s.byteLength/b);if(D!=1<<Mn(D))throw new Error("Invalid number of points");const G=Math.floor(D/c.concurrency),V=[];for(let M=0;M<c.concurrency;M++){let h;if(M<c.concurrency-1?h=G:h=D-M*G,h==0)continue;const y=[],q=s.slice(M*G*b,(M*G+h)*b);y.push({cmd:"ALLOCSET",var:0,buff:q}),y.push({cmd:"ALLOCSET",var:1,buff:I}),y.push({cmd:"CALL",fnName:w,params:[{var:0},{val:h},{var:1}]}),y.push({cmd:"CALL",fnName:O,params:[{var:0},{val:h},{var:0}]}),y.push({cmd:"GET",out:0,var:0,len:h*f}),V.push(c.queueAction(y))}const it=await Promise.all(V);let Z;s instanceof un?Z=new un(D*f):Z=new Uint8Array(D*f);let E=0;for(let M=it.length-1;M>=0;M--)Z.set(it[M][0],E),E+=it[M][0].byteLength;return Z}}async function os(t){const a=await Zu(t.wasm,t.singleThread),n={};return n.q=mn(t.wasm.q),n.r=mn(t.wasm.r),n.name=t.name,n.tm=a,n.prePSize=t.wasm.prePSize,n.preQSize=t.wasm.preQSize,n.Fr=new Yl(a,"frm",t.n8r,t.r),n.F1=new Yl(a,"f1m",t.n8q,t.q),n.F2=new Xl(a,"f2m",n.F1),n.G1=new Wl(a,"g1m",n.F1,t.wasm.pG1gen,t.wasm.pG1b,t.cofactorG1),n.G2=new Wl(a,"g2m",n.F2,t.wasm.pG2gen,t.wasm.pG2b,t.cofactorG2),n.F6=new Du(a,"f6m",n.F2),n.F12=new Xl(a,"ftm",n.F6),n.Gt=n.F12,Xe(n,"G1"),Xe(n,"G2"),Xe(n,"Fr"),as(n,"G1"),as(n,"G2"),We(n,"G1"),We(n,"G2"),We(n,"Fr"),Ku(n),n.array2buffer=function(e,c){const i=new Uint8Array(c*e.length);for(let r=0;r<e.length;r++)i.set(e[r],r*c);return i},n.buffer2array=function(e,c){const i=e.byteLength/c,r=new Array(i);for(let _=0;_<i;_++)r[_]=e.slice(_*c,_*c+c);return r},n}var Ha={},kn={},es;function Fa(){if(es)return kn;es=1;const t=Gn();function a(w){let O;return typeof w=="string"&&w.slice(0,2).toLowerCase()=="0x"?O=t(w.slice(2),16):O=t(w),O}function n(w){const O=[],D=a(w);return O.push(D.and(255).toJSNumber()),O.push(D.shiftRight(8).and(255).toJSNumber()),O.push(D.shiftRight(16).and(255).toJSNumber()),O.push(D.shiftRight(24).and(255).toJSNumber()),O}function e(w){const O=[],D=a(w);return O.push(D.and(255).toJSNumber()),O.push(D.shiftRight(8).and(255).toJSNumber()),O.push(D.shiftRight(16).and(255).toJSNumber()),O.push(D.shiftRight(24).and(255).toJSNumber()),O.push(D.shiftRight(32).and(255).toJSNumber()),O.push(D.shiftRight(40).and(255).toJSNumber()),O.push(D.shiftRight(48).and(255).toJSNumber()),O.push(D.shiftRight(56).and(255).toJSNumber()),O}function c(w){for(var O=[],D=0;D<w.length;D++){var G=w.charCodeAt(D);G<128?O.push(G):G<2048?O.push(192|G>>6,128|G&63):G<55296||G>=57344?O.push(224|G>>12,128|G>>6&63,128|G&63):(D++,G=65536+((G&1023)<<10|w.charCodeAt(D)&1023),O.push(240|G>>18,128|G>>12&63,128|G>>6&63,128|G&63))}return O}function i(w){const O=c(w);return[...s(O.length),...O]}function r(w){const O=[];let D=a(w);if(D.isNegative())throw new Error("Number cannot be negative");for(;!D.isZero();)O.push(D.and(127).toJSNumber()),D=D.shiftRight(7);O.length==0&&O.push(0);for(let G=0;G<O.length-1;G++)O[G]=O[G]|128;return O}function _(w){let O,D;const G=w.bitLength().toJSNumber();w<0?(D=!0,O=t.one.shiftLeft(G).add(w)):(D=!1,O=a(w));const V=7-G%7,it=t.one.shiftLeft(V).minus(1).shiftLeft(G),Z=(1<<7-V)-1|128,E=r(O.add(it));return D||(E[E.length-1]=E[E.length-1]&Z),E}function u(w){let O=a(w);if(O.greater(t("FFFFFFFF",16)))throw new Error("Number too big");if(O.greater(t("7FFFFFFF",16))&&(O=O.minus(t("100000000",16))),O.lesser(t("-80000000",16)))throw new Error("Number too small");return _(O)}function l(w){let O=a(w);if(O.greater(t("FFFFFFFFFFFFFFFF",16)))throw new Error("Number too big");if(O.greater(t("7FFFFFFFFFFFFFFF",16))&&(O=O.minus(t("10000000000000000",16))),O.lesser(t("-8000000000000000",16)))throw new Error("Number too small");return _(O)}function s(w){let O=a(w);if(O.greater(t("FFFFFFFF",16)))throw new Error("Number too big");return r(O)}function I(w){let O=a(w);if(O.greater(t("FFFFFFFFFFFFFFFF",16)))throw new Error("Number too big");return r(O)}function b(w){return Array.from(w,function(O){return("0"+(O&255).toString(16)).slice(-2)}).join("")}function f(w){if(typeof w=="string"){let O=w.split(`
|
7
|
+
`);for(let D=0;D<O.length;D++)O[D]&&(O[D]=" "+O[D]);return O.join(`
|
8
|
+
`)}else if(Array.isArray(w)){for(let O=0;O<w.length;O++)w[O]=f(w[O]);return w}}return kn.toNumber=a,kn.u32=n,kn.u64=e,kn.varuint32=s,kn.varuint64=I,kn.varint32=u,kn.varint64=l,kn.string=i,kn.toHexString=b,kn.ident=f,kn}var Je,is;function Hu(){if(is)return Je;is=1;const t=Fa();class a{constructor(e){this.func=e,this.functionName=e.functionName,this.module=e.module}setLocal(e,c){const i=this.func.localIdxByName[e];if(i===void 0)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${e} `);return[...c,33,...t.varuint32(i)]}teeLocal(e,c){const i=this.func.localIdxByName[e];if(i===void 0)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${e} `);return[...c,34,...t.varuint32(i)]}getLocal(e){const c=this.func.localIdxByName[e];if(c===void 0)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${e} `);return[32,...t.varuint32(c)]}i64_load8_s(e,c,i){const r=c||0,_=i===void 0?0:i;return[...e,48,_,...t.varuint32(r)]}i64_load8_u(e,c,i){const r=c||0,_=i===void 0?0:i;return[...e,49,_,...t.varuint32(r)]}i64_load16_s(e,c,i){const r=c||0,_=i===void 0?1:i;return[...e,50,_,...t.varuint32(r)]}i64_load16_u(e,c,i){const r=c||0,_=i===void 0?1:i;return[...e,51,_,...t.varuint32(r)]}i64_load32_s(e,c,i){const r=c||0,_=i===void 0?2:i;return[...e,52,_,...t.varuint32(r)]}i64_load32_u(e,c,i){const r=c||0,_=i===void 0?2:i;return[...e,53,_,...t.varuint32(r)]}i64_load(e,c,i){const r=c||0,_=i===void 0?3:i;return[...e,41,_,...t.varuint32(r)]}i64_store(e,c,i,r){let _,u,l;return Array.isArray(c)?(_=0,u=3,l=c):Array.isArray(i)?(_=c,u=3,l=i):Array.isArray(r)&&(_=c,u=i,l=r),[...e,...l,55,u,...t.varuint32(_)]}i64_store32(e,c,i,r){let _,u,l;return Array.isArray(c)?(_=0,u=2,l=c):Array.isArray(i)?(_=c,u=2,l=i):Array.isArray(r)&&(_=c,u=i,l=r),[...e,...l,62,u,...t.varuint32(_)]}i64_store16(e,c,i,r){let _,u,l;return Array.isArray(c)?(_=0,u=1,l=c):Array.isArray(i)?(_=c,u=1,l=i):Array.isArray(r)&&(_=c,u=i,l=r),[...e,...l,61,u,...t.varuint32(_)]}i64_store8(e,c,i,r){let _,u,l;return Array.isArray(c)?(_=0,u=0,l=c):Array.isArray(i)?(_=c,u=0,l=i):Array.isArray(r)&&(_=c,u=i,l=r),[...e,...l,60,u,...t.varuint32(_)]}i32_load8_s(e,c,i){const r=c||0,_=i===void 0?0:i;return[...e,44,_,...t.varuint32(r)]}i32_load8_u(e,c,i){const r=c||0,_=i===void 0?0:i;return[...e,45,_,...t.varuint32(r)]}i32_load16_s(e,c,i){const r=c||0,_=i===void 0?1:i;return[...e,46,_,...t.varuint32(r)]}i32_load16_u(e,c,i){const r=c||0,_=i===void 0?1:i;return[...e,47,_,...t.varuint32(r)]}i32_load(e,c,i){const r=c||0,_=i===void 0?2:i;return[...e,40,_,...t.varuint32(r)]}i32_store(e,c,i,r){let _,u,l;return Array.isArray(c)?(_=0,u=2,l=c):Array.isArray(i)?(_=c,u=2,l=i):Array.isArray(r)&&(_=c,u=i,l=r),[...e,...l,54,u,...t.varuint32(_)]}i32_store16(e,c,i,r){let _,u,l;return Array.isArray(c)?(_=0,u=1,l=c):Array.isArray(i)?(_=c,u=1,l=i):Array.isArray(r)&&(_=c,u=i,l=r),[...e,...l,59,u,...t.varuint32(_)]}i32_store8(e,c,i,r){let _,u,l;return Array.isArray(c)?(_=0,u=0,l=c):Array.isArray(i)?(_=c,u=0,l=i):Array.isArray(r)&&(_=c,u=i,l=r),[...e,...l,58,u,...t.varuint32(_)]}call(e,...c){const i=this.module.functionIdxByName[e];if(i===void 0)throw new Error(`Function not defined: Function: ${e}`);return[...[].concat(...c),16,...t.varuint32(i)]}call_indirect(e,...c){return[...[].concat(...c),...e,17,0,0]}if(e,c,i){return i?[...e,4,64,...c,5,...i,11]:[...e,4,64,...c,11]}block(e){return[2,64,...e,11]}loop(...e){return[3,64,...[].concat(...e),11]}br_if(e,c){return[...c,13,...t.varuint32(e)]}br(e){return[12,...t.varuint32(e)]}ret(e){return[...e,15]}drop(e){return[...e,26]}i64_const(e){return[66,...t.varint64(e)]}i32_const(e){return[65,...t.varint32(e)]}i64_eqz(e){return[...e,80]}i64_eq(e,c){return[...e,...c,81]}i64_ne(e,c){return[...e,...c,82]}i64_lt_s(e,c){return[...e,...c,83]}i64_lt_u(e,c){return[...e,...c,84]}i64_gt_s(e,c){return[...e,...c,85]}i64_gt_u(e,c){return[...e,...c,86]}i64_le_s(e,c){return[...e,...c,87]}i64_le_u(e,c){return[...e,...c,88]}i64_ge_s(e,c){return[...e,...c,89]}i64_ge_u(e,c){return[...e,...c,90]}i64_add(e,c){return[...e,...c,124]}i64_sub(e,c){return[...e,...c,125]}i64_mul(e,c){return[...e,...c,126]}i64_div_s(e,c){return[...e,...c,127]}i64_div_u(e,c){return[...e,...c,128]}i64_rem_s(e,c){return[...e,...c,129]}i64_rem_u(e,c){return[...e,...c,130]}i64_and(e,c){return[...e,...c,131]}i64_or(e,c){return[...e,...c,132]}i64_xor(e,c){return[...e,...c,133]}i64_shl(e,c){return[...e,...c,134]}i64_shr_s(e,c){return[...e,...c,135]}i64_shr_u(e,c){return[...e,...c,136]}i64_extend_i32_s(e){return[...e,172]}i64_extend_i32_u(e){return[...e,173]}i64_clz(e){return[...e,121]}i64_ctz(e){return[...e,122]}i32_eqz(e){return[...e,69]}i32_eq(e,c){return[...e,...c,70]}i32_ne(e,c){return[...e,...c,71]}i32_lt_s(e,c){return[...e,...c,72]}i32_lt_u(e,c){return[...e,...c,73]}i32_gt_s(e,c){return[...e,...c,74]}i32_gt_u(e,c){return[...e,...c,75]}i32_le_s(e,c){return[...e,...c,76]}i32_le_u(e,c){return[...e,...c,77]}i32_ge_s(e,c){return[...e,...c,78]}i32_ge_u(e,c){return[...e,...c,79]}i32_add(e,c){return[...e,...c,106]}i32_sub(e,c){return[...e,...c,107]}i32_mul(e,c){return[...e,...c,108]}i32_div_s(e,c){return[...e,...c,109]}i32_div_u(e,c){return[...e,...c,110]}i32_rem_s(e,c){return[...e,...c,111]}i32_rem_u(e,c){return[...e,...c,112]}i32_and(e,c){return[...e,...c,113]}i32_or(e,c){return[...e,...c,114]}i32_xor(e,c){return[...e,...c,115]}i32_shl(e,c){return[...e,...c,116]}i32_shr_s(e,c){return[...e,...c,117]}i32_shr_u(e,c){return[...e,...c,118]}i32_rotl(e,c){return[...e,...c,119]}i32_rotr(e,c){return[...e,...c,120]}i32_wrap_i64(e){return[...e,167]}i32_clz(e){return[...e,103]}i32_ctz(e){return[...e,104]}unreachable(){return[0]}current_memory(){return[63,0]}comment(){return[]}}return Je=a,Je}var ti,cs;function Vu(){if(cs)return ti;cs=1;const t=Hu(),a=Fa(),n={i32:127,i64:126,f32:125,f64:124,anyfunc:112,func:96,emptyblock:64};class e{constructor(i,r,_,u,l){if(_=="import")this.fnType="import",this.moduleName=u,this.fieldName=l;else if(_=="internal")this.fnType="internal";else throw new Error("Invalid function fnType: "+_);this.module=i,this.fnName=r,this.params=[],this.locals=[],this.localIdxByName={},this.code=[],this.returnType=null,this.nextLocal=0}addParam(i,r){if(this.localIdxByName[i])throw new Error(`param already exists. Function: ${this.fnName}, Param: ${i} `);const _=this.nextLocal++;this.localIdxByName[i]=_,this.params.push({type:r})}addLocal(i,r,_){const u=_||1;if(this.localIdxByName[i])throw new Error(`local already exists. Function: ${this.fnName}, Param: ${i} `);const l=this.nextLocal++;this.localIdxByName[i]=l,this.locals.push({type:r,length:u})}setReturnType(i){if(this.returnType)throw new Error(`returnType already defined. Function: ${this.fnName}`);this.returnType=i}getSignature(){const i=[...a.varuint32(this.params.length),...this.params.map(_=>n[_.type])],r=this.returnType?[1,n[this.returnType]]:[0];return[96,...i,...r]}getBody(){const i=this.locals.map(_=>[...a.varuint32(_.length),n[_.type]]),r=[...a.varuint32(this.locals.length),...[].concat(...i),...this.code,11];return[...a.varuint32(r.length),...r]}addCode(...i){this.code.push(...[].concat(...i))}getCodeBuilder(){return new t(this)}}return ti=e,ti}var ni,ls;function ss(){if(ls)return ni;ls=1;const t=Vu(),a=Fa();class n{constructor(){this.functions=[],this.functionIdxByName={},this.nImportFunctions=0,this.nInternalFunctions=0,this.memory={pagesSize:1,moduleName:"env",fieldName:"memory"},this.free=8,this.datas=[],this.modules={},this.exports=[],this.functionsTable=[]}build(){return this._setSignatures(),new Uint8Array([...a.u32(1836278016),...a.u32(1),...this._buildType(),...this._buildImport(),...this._buildFunctionDeclarations(),...this._buildFunctionsTable(),...this._buildExports(),...this._buildElements(),...this._buildCode(),...this._buildData()])}addFunction(c){if(typeof this.functionIdxByName[c]<"u")throw new Error(`Function already defined: ${c}`);const i=this.functions.length;return this.functionIdxByName[c]=i,this.functions.push(new t(this,c,"internal")),this.nInternalFunctions++,this.functions[i]}addIimportFunction(c,i,r){if(typeof this.functionIdxByName[c]<"u")throw new Error(`Function already defined: ${c}`);if(this.functions.length>0&&this.functions[this.functions.length-1].type=="internal")throw new Error(`Import functions must be declared before internal: ${c}`);let _=r||c;const u=this.functions.length;return this.functionIdxByName[c]=u,this.functions.push(new t(this,c,"import",i,_)),this.nImportFunctions++,this.functions[u]}setMemory(c,i,r){this.memory={pagesSize:c,moduleName:i||"env",fieldName:r||"memory"}}exportFunction(c,i){const r=i||c;if(typeof this.functionIdxByName[c]>"u")throw new Error(`Function not defined: ${c}`);const _=this.functionIdxByName[c];r!=c&&(this.functionIdxByName[r]=_),this.exports.push({exportName:r,idx:_})}addFunctionToTable(c){const i=this.functionIdxByName[c];this.functionsTable.push(i)}addData(c,i){this.datas.push({offset:c,bytes:i})}alloc(c,i){let r,_;(Array.isArray(c)||ArrayBuffer.isView(c))&&typeof i>"u"?(r=c.length,_=c):(r=c,_=i),r=(r-1>>3)+1<<3;const u=this.free;return this.free+=r,_&&this.addData(u,_),u}allocString(c){const r=new globalThis.TextEncoder().encode(c);return this.alloc([...r,0])}_setSignatures(){this.signatures=[];const c={};if(this.functionsTable.length>0){const i=this.functions[this.functionsTable[0]].getSignature(),r="s_"+a.toHexString(i);c[r]=0,this.signatures.push(i)}for(let i=0;i<this.functions.length;i++){const r=this.functions[i].getSignature(),_="s_"+a.toHexString(r);typeof c[_]>"u"&&(c[_]=this.signatures.length,this.signatures.push(r)),this.functions[i].signatureIdx=c[_]}}_buildSection(c,i){return[c,...a.varuint32(i.length),...i]}_buildType(){return this._buildSection(1,[...a.varuint32(this.signatures.length),...[].concat(...this.signatures)])}_buildImport(){const c=[];c.push([...a.string(this.memory.moduleName),...a.string(this.memory.fieldName),2,0,...a.varuint32(this.memory.pagesSize)]);for(let i=0;i<this.nImportFunctions;i++)c.push([...a.string(this.functions[i].moduleName),...a.string(this.functions[i].fieldName),0,...a.varuint32(this.functions[i].signatureIdx)]);return this._buildSection(2,a.varuint32(c.length).concat(...c))}_buildFunctionDeclarations(){const c=[];for(let i=this.nImportFunctions;i<this.nImportFunctions+this.nInternalFunctions;i++)c.push(...a.varuint32(this.functions[i].signatureIdx));return this._buildSection(3,[...a.varuint32(c.length),...c])}_buildFunctionsTable(){return this.functionsTable.length==0?[]:this._buildSection(4,[...a.varuint32(1),112,0,...a.varuint32(this.functionsTable.length)])}_buildElements(){if(this.functionsTable.length==0)return[];const c=[];for(let i=0;i<this.functionsTable.length;i++)c.push(...a.varuint32(this.functionsTable[i]));return this._buildSection(9,[...a.varuint32(1),...a.varuint32(0),65,...a.varint32(0),11,...a.varuint32(this.functionsTable.length),...c])}_buildExports(){const c=[];for(let i=0;i<this.exports.length;i++)c.push([...a.string(this.exports[i].exportName),0,...a.varuint32(this.exports[i].idx)]);return this._buildSection(7,a.varuint32(c.length).concat(...c))}_buildCode(){const c=[];for(let i=this.nImportFunctions;i<this.nImportFunctions+this.nInternalFunctions;i++)c.push(this.functions[i].getBody());return this._buildSection(10,a.varuint32(c.length).concat(...c))}_buildData(){const c=[];c.push([0,65,0,11,4,...a.u32(this.free)]);for(let i=0;i<this.datas.length;i++)c.push([0,65,...a.varint32(this.datas[i].offset),11,...a.varuint32(this.datas[i].bytes.length),...this.datas[i].bytes]);return this._buildSection(11,a.varuint32(c.length).concat(...c))}}return ni=n,ni}var ai,rs;function Yu(){if(rs)return ai;rs=1;const t=Fa();class a{constructor(e){this.func=e,this.functionName=e.functionName,this.module=e.module}setLocal(e,c){if(this.func.localIdxByName[e]===void 0)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${e} `);return[c,`set_local $${e}`]}teeLocal(e,c){if(this.func.localIdxByName[e]===void 0)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${e} `);return[c,`tee_local $${e}`]}getLocal(e){if(this.func.localIdxByName[e]===void 0)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${e} `);return`get_local $${e}`}genLoad(e,c,i,r,_){let u=e;const l=r||0;l>0&&(u+=` offset=${l}`);const s=_===void 0?c:_;return s!=c&&(u+=` align=${1<<s}`),[i,u]}genStore(e,c,i,r,_,u){let l,s,I;typeof _>"u"?(l=0,s=c,I=r):typeof u>"u"?(l=r,s=c,I=_):(l=r,s=_,I=u);let b=e;return l>0&&(b+=` offset=${l}`),s!=c&&(b+=` align=${1<<s}`),[i,I,b]}i64_load8_s(e,c,i){return this.genLoad("i64.load8_s",0,e,c,i)}i64_load8_u(e,c,i){return this.genLoad("i64.load8_u",0,e,c,i)}i64_load16_s(e,c,i){return this.genLoad("i64.load16_s",1,e,c,i)}i64_load16_u(e,c,i){return this.genLoad("i64.load16_u",1,e,c,i)}i64_load32_s(e,c,i){return this.genLoad("i64.load32_s",2,e,c,i)}i64_load32_u(e,c,i){return this.genLoad("i64.load32_u",2,e,c,i)}i64_load(e,c,i){return this.genLoad("i64.load",3,e,c,i)}i64_store(e,c,i,r){return this.genStore("i64.store",3,e,c,i,r)}i64_store32(e,c,i,r){return this.genStore("i64.store32",2,e,c,i,r)}i64_store16(e,c,i,r){return this.genStore("i64.store16",1,e,c,i,r)}i64_store8(e,c,i,r){return this.genStore("i64.store8",0,e,c,i,r)}i32_load8_s(e,c,i){return this.genLoad("i32.load8_s",0,e,c,i)}i32_load8_u(e,c,i){return this.genLoad("i32.load8_u",0,e,c,i)}i32_load16_s(e,c,i){return this.genLoad("i32.load16_s",1,e,c,i)}i32_load16_u(e,c,i){return this.genLoad("i32.load16_u",1,e,c,i)}i32_load(e,c,i){return this.genLoad("i32.load",2,e,c,i)}i32_store(e,c,i,r){return this.genStore("i32.store",2,e,c,i,r)}i32_store16(e,c,i,r){return this.genStore("i32.store16",1,e,c,i,r)}i32_store8(e,c,i,r){return this.genStore("i32.store8",0,e,c,i,r)}call(e,...c){if(this.module.functionIdxByName[e]===void 0)throw new Error(`Function not defined: Function: ${e}`);return[c,`call $${e}`]}call_indirect(e,...c){return[c,e,"call_indirect (type 0)"]}if(e,c,i){return i?[e,"if",t.ident(c),"else",t.ident(i),"end"]:[e,"if",t.ident(c),"end"]}block(e){return["block",t.ident(e),"end"]}loop(...e){return["loop",t.ident(e),"end"]}br_if(e,c){return[c,`br_if ${e}`]}br(e){return`br ${e}`}ret(e){return[e,"return"]}drop(e){return[e,"drop"]}i64_const(e){return`i64.const ${e}`}i32_const(e){return`i32.const ${e}`}i64_eqz(e){return[e,"i64.eqz"]}i64_eq(e,c){return[e,c,"i64.eq"]}i64_ne(e,c){return[e,c,"i64.ne"]}i64_lt_s(e,c){return[e,c,"i64.lt_s"]}i64_lt_u(e,c){return[e,c,"i64.lt_u"]}i64_gt_s(e,c){return[e,c,"i64.gt_s"]}i64_gt_u(e,c){return[e,c,"i64.gt_u"]}i64_le_s(e,c){return[e,c,"i64.le_s"]}i64_le_u(e,c){return[e,c,"i64.le_u"]}i64_ge_s(e,c){return[e,c,"i64.ge_s"]}i64_ge_u(e,c){return[e,c,"i64.ge_u"]}i64_add(e,c){return[e,c,"i64.add"]}i64_sub(e,c){return[e,c,"i64.sub"]}i64_mul(e,c){return[e,c,"i64.mul"]}i64_div_s(e,c){return[e,c,"i64.div_s"]}i64_div_u(e,c){return[e,c,"i64.div_u"]}i64_rem_s(e,c){return[e,c,"i64.rem_s"]}i64_rem_u(e,c){return[e,c,"i64.rem_u"]}i64_and(e,c){return[e,c,"i64.and"]}i64_or(e,c){return[e,c,"i64.or"]}i64_xor(e,c){return[e,c,"i64.xor"]}i64_shl(e,c){return[e,c,"i64.shl"]}i64_shr_s(e,c){return[e,c,"i64.shr_s"]}i64_shr_u(e,c){return[e,c,"i64.shr_u"]}i64_extend_i32_s(e){return[e,"i64.extend_s/i32"]}i64_extend_i32_u(e){return[e,"i64.extend_u/i32"]}i32_eqz(e){return[e,"i32.eqz"]}i32_eq(e,c){return[e,c,"i32.eq"]}i32_ne(e,c){return[e,c,"i32.ne"]}i32_lt_s(e,c){return[e,c,"i32.lt_s"]}i32_lt_u(e,c){return[e,c,"i32.lt_u"]}i32_gt_s(e,c){return[e,c,"i32.gt_s"]}i32_gt_u(e,c){return[e,c,"i32.gt_u"]}i32_le_s(e,c){return[e,c,"i32.le_s"]}i32_le_u(e,c){return[e,c,"i32.le_u"]}i32_ge_s(e,c){return[e,c,"i32.ge_s"]}i32_ge_u(e,c){return[e,c,"i32.ge_u"]}i32_add(e,c){return[e,c,"i32.add"]}i32_sub(e,c){return[e,c,"i32.sub"]}i32_mul(e,c){return[e,c,"i32.mul"]}i32_div_s(e,c){return[e,c,"i32.div_s"]}i32_div_u(e,c){return[e,c,"i32.div_u"]}i32_rem_s(e,c){return[e,c,"i32.rem_s"]}i32_rem_u(e,c){return[e,c,"i32.rem_u"]}i32_and(e,c){return[e,c,"i32.and"]}i32_or(e,c){return[e,c,"i32.or"]}i32_xor(e,c){return[e,c,"i32.xor"]}i32_shl(e,c){return[e,c,"i32.shl"]}i32_shr_s(e,c){return[e,c,"i32.shr_s"]}i32_shr_u(e,c){return[e,c,"i32.shr_u"]}i32_rotl(e,c){return[e,c,"i32.rotl"]}i32_rotr(e,c){return[e,c,"i32.rotr"]}i32_wrap_i64(e){return[e,"i32.wrap/i64"]}ureachable(){return"unreachable"}current_memory(){return"current_memory"}comment(e){return";; "+e}}return ai=a,ai}var oi,ds;function Xu(){if(ds)return oi;ds=1;const t=Yu(),a=Fa();class n{constructor(c,i,r,_,u){if(r=="import")this.fnType="import",this.moduleName=_,this.fieldName=u;else if(r=="internal")this.fnType="internal",this.comment=_;else throw new Error("Invalid function fnType: "+r);this.module=c,this.fnName=i,this.params=[],this.locals=[],this.localIdxByName={},this.code=[],this.returnType=null,this.nextLocal=0}addParam(c,i){if(this.localIdxByName[c])throw new Error(`param already exists. Function: ${this.fnName}, Param: ${c} `);const r=this.nextLocal++;this.localIdxByName[c]=r,this.params.push({type:i,name:c})}addLocal(c,i,r){if(typeof r<"u"&&r!=1)throw new Error("Locals greater than 1 not implemented");if(this.localIdxByName[c])throw new Error(`local already exists. Function: ${this.fnName}, Param: ${c} `);const _=this.nextLocal++;this.localIdxByName[c]=_,this.locals.push({type:i,name:c})}setReturnType(c){if(this.returnType)throw new Error(`returnType already defined. Function: ${this.fnName}`);this.returnType=c}getSignature(){let c="";for(let r=0;r<this.params.length;r++)r==0&&(c+=" (param"),c+=" "+this.params[r].type;c!=""&&(c+=")");let i="";return this.returnType&&(i+=` (result ${this.returnType})`),`(type $${this.getSignatureName()} (func ${c}${i}))`}getSignatureName(){let c="_sig_";for(let i=0;i<this.params.length;i++)c+=this.params[i].type;return this.returnType&&(c+="r"+this.returnType),c}getBody(){const c=[];for(let r=0;r<this.params.length;r++)c.push(` (param $${this.params[r].name} ${this.params[r].type})`);this.returnType&&c.push(`(result ${this.returnType})`);for(let r=0;r<this.locals.length;r++)c.push(` (local $${this.locals[r].name} ${this.locals[r].type})`);c.push(this.code);let i;if(this.comment){i=this.comment.split(`
|
9
|
+
`);for(let r=0;r<i.length;r++)i[r]=";; "+i[r]}else i=[];return[...i,`(func $${this.fnName} (type $${this.getSignatureName()})`,a.ident(c),")"]}addCode(...c){this.code.push(c)}getCodeBuilder(){return new t(this)}}return oi=n,oi}var ei,_s;function Wu(){if(_s)return ei;_s=1;const t=Xu(),a=Fa();class n{constructor(){this.functions=[],this.functionIdxByName={},this.nImportFunctions=0,this.nInternalFunctions=0,this.memory={pagesSize:1,moduleName:"env",fieldName:"memory"},this.free=8,this.datas=[],this.modules={},this.exports=[],this.functionsTable=[]}build(){const c=[];return this._setSignatures(),c.push(this._buildType()),c.push(this._buildImport()),this.functionsTable.length>0&&c.push(this._buildFunctionsTable()),this.exports.length>0&&c.push(this._buildExports()),this.functionsTable.length>0&&c.push(this._buildElements()),this.nInternalFunctions>0&&c.push(this._buildFunctions()),c.push(this._buildData()),["(module",a.ident(c),")"]}addFunction(c,i){if(typeof this.functionIdxByName[c]<"u")throw new Error(`Function already defined: ${c}`);const r=this.functions.length;return this.functionIdxByName[c]=r,this.functions.push(new t(this,c,"internal",i)),this.nInternalFunctions++,this.functions[r]}addIimportFunction(c,i,r){if(typeof this.functionIdxByName[c]<"u")throw new Error(`Function already defined: ${c}`);if(this.functions.length>0&&this.functions[this.functions.length-1].type=="internal")throw new Error(`Import functions must be declared before internal: ${c}`);let _=r||c;const u=this.functions.length;return this.functionIdxByName[c]=u,this.functions.push(new t(this,c,"import",i,_)),this.nImportFunctions++,this.functions[u]}setMemory(c,i,r){this.memory={pagesSize:c,moduleName:i||"env",fieldName:r||"memory"}}exportFunction(c,i){const r=i||c;if(typeof this.functionIdxByName[c]>"u")throw new Error(`Function not defined: ${c}`);const _=this.functionIdxByName[c];r!=c&&(this.functionIdxByName[r]=_),this.exports.push({exportName:r,idx:_})}addFunctionToTable(c){const i=this.functionIdxByName[c];this.functionsTable.push(i)}addData(c,i){this.datas.push({offset:c,bytes:i})}alloc(c,i){let r,_;(Array.isArray(c)||ArrayBuffer.isView(c))&&typeof i>"u"?(r=c.length,_=c):(r=c,_=i),r=(r-1>>3)+1<<3;const u=this.free;return this.free+=r,_&&this.addData(u,_),u}allocString(c){const r=new TextEncoder().encode(c);return this.alloc([...r,0])}_setSignatures(){this.signatures=[];const c={};if(this.functionsTable.length>0){const i=this.functions[this.functionsTable[0]].getSignature(),r=this.functions[this.functionsTable[0]].getSignatureName();c[r]=0,this.signatures.push(i)}for(let i=0;i<this.functions.length;i++){const r=this.functions[i].getSignature(),_=this.functions[i].getSignatureName();typeof c[_]>"u"&&(c[_]=this.signatures.length,this.signatures.push(r)),this.functions[i].signatureIdx=c[_],this.functions[i].signatureName=_}}_buildType(){return this.signatures}_buildImport(){const c=[];c.push(`(import "${this.memory.moduleName}" "${this.memory.fieldName}" (memory ${this.memory.pagesSize}))`);for(let i=0;i<this.nImportFunctions;i++)c.push(`(import "${this.functions[i].moduleName}" "${this.functions[i].fieldName}" (func $${this.functions[i].fnName} (type $${this.functions[i].getSignatureName()})))`);return c}_buildFunctionsTable(){return`(table ${this.functionsTable.length} anyfunc)`}_buildElements(){let c="";for(let i=0;i<this.functionsTable.length;i++)c+=" $"+this.functions[this.functionsTable[i]].fnName;return`(elem (i32.const 0) ${c})`}_buildExports(){const c=[];for(let i=0;i<this.exports.length;i++)c.push(`(export "${this.exports[i].exportName}" (func $${this.functions[this.exports[i].idx].fnName}))`);return c}_buildFunctions(){const c=[];for(let i=this.nImportFunctions;i<this.nImportFunctions+this.nInternalFunctions;i++)c.push(this.functions[i].getBody());return c}_buildData(){const c=[],i=Buffer.alloc(4);i.writeUInt32LE(this.free,0),c.push(`(data (i32.const 0) ${r(i)})`);for(let _=0;_<this.datas.length;_++)c.push(`(data (i32.const ${this.datas[_].offset}) ${r(this.datas[_].bytes)})`);return c;function r(_){let u='"';for(let l=0;l<_.length;l++)if(_[l]<32||_[l]>126||_[l]==34||_[l]==92){let s=_[l].toString(16);for(;s.length<2;)s="0"+s;u+="\\"+s}else u+=String.fromCharCode(_[l]);return u+='"',u}}}return ei=n,ei}var ii,us;function Ju(){if(us)return ii;us=1;const t=Gn(),a=ss();async function n(c,i,r){const _=new e;_.defBytes=i,_.bitsPerBytes=r||32,_.memory=new WebAssembly.Memory({initial:2e4}),_.i32=new Uint32Array(_.memory.buffer),_.i8=new Uint8Array(_.memory.buffer);const u=new a;u.addIimportFunction("debug_log32","debug","log32").addParam("x","i32");const s=u.addIimportFunction("debug_log64","debug","log64");s.addParam("x","i32"),s.addParam("y","i32"),f(u),w(u),c(u,_);const I=u.build(),b=await WebAssembly.compile(I);return _.log=console.log,_.instance=await WebAssembly.instantiate(b,{env:{memory:_.memory},debug:{log32:function(O){O<0&&(O=4294967296+O);let D=O.toString(16);for(;D.length<8;)D="0"+D;_.log(D+": "+O.toString())},log64:function(O,D){O<0&&(O=4294967296+O),D<0&&(D=4294967296+D);const G=t(O)+t(D).shiftLeft(32);let V=G.toString(16);for(;V.length<16;)V="0"+V;_.log(V+": "+G.toString())}}}),Object.assign(_,_.instance.exports),Object.assign(_,u.modules),_;function f(O){const D=O.addFunction("log32");D.addParam("x","i32");const G=D.getCodeBuilder();D.addCode(G.call("debug_log32",G.getLocal("x")))}function w(O){const D=O.addFunction("log64");D.addParam("x","i64");const G=D.getCodeBuilder();D.addCode(G.call("debug_log64",G.i32_wrap_i64(G.getLocal("x")),G.i32_wrap_i64(G.i64_shr_u(G.getLocal("x"),G.i64_const(32)))))}}class e{constructor(){}alloc(i){typeof i>"u"&&(i=this.defBytes),i=(i-1>>3)+1<<3;const r=this.i32[0];return this.i32[0]+=i,r}set(i,r,_){Array.isArray(r)||(r=[r]),typeof _>"u"&&(_=this.defBytes);const u=Math.floor((_-1)/4)+1;let l=i;const s=t.one.shiftLeft(this.bitsPerBytes);for(let I=0;I<r.length;I++){let b=t(r[I]);for(let f=0;f<u;f++){const w=b.divmod(s);this.i32[l>>2]=w.remainder.toJSNumber(),b=w.quotient,l+=4}if(!b.isZero())throw new Error("Expected v to be 0")}return i}get(i,r,_){typeof _>"u"&&(typeof r>"u"?(r=1,_=this.defBytes):(r=_,_=this.defBytes));const u=Math.floor((_-1)/4)+1,l=t.one.shiftLeft(this.bitsPerBytes),s=[];for(let I=0;I<r;I++){let b=t.zero;for(let f=u-1;f>=0;f--){b=b.times(l);let w=this.i32[(i>>2)+f];this.bitsPerBytes<32&&w&2147483648&&(w=w-4294967296),b=b.add(w)}s.push(b),i+=u*4}return s.length==1?s[0]:s}}return ii=n,ii}var gs;function t3(){return gs||(gs=1,Ha.ModuleBuilder=ss(),Ha.ModuleBuilderWat=Wu(),Ha.buildProtoboard=Ju()),Ha}var fs=t3();globalThis.curve_bn128=null;async function n3(t,a){const n=new fs.ModuleBuilder;n.setMemory(25),Kl.buildBn128(n);const e={};if(e.code=n.build(),e.pq=n.modules.f1m.pq,e.pr=n.modules.frm.pq,e.pG1gen=n.modules.bn128.pG1gen,e.pG1zero=n.modules.bn128.pG1zero,e.pG1b=n.modules.bn128.pG1b,e.pG2gen=n.modules.bn128.pG2gen,e.pG2zero=n.modules.bn128.pG2zero,e.pG2b=n.modules.bn128.pG2b,e.pOneT=n.modules.bn128.pOneT,e.prePSize=n.modules.bn128.prePSize,e.preQSize=n.modules.bn128.preQSize,e.n8q=32,e.n8r=32,e.q=n.modules.bn128.q,e.r=n.modules.bn128.r,globalThis.curve_bn128)return globalThis.curve_bn128;const c={name:"bn128",wasm:e,q:mn("21888242871839275222246405745257275088696311157297823662689037894645226208583"),r:mn("21888242871839275222246405745257275088548364400416034343698204186575808495617"),n8q:32,n8r:32,cofactorG2:mn("30644e72e131a029b85045b68181585e06ceecda572a2489345f2299c0f9fa8d",16),singleThread:!1},i=await os(c);return i.terminate=async function(){c.singleThread||(globalThis.curve_bn128=null,await this.tm.terminate())},globalThis.curve_bn128=i,i}globalThis.curve_bls12381=null;async function a3(t,a){const n=new fs.ModuleBuilder;n.setMemory(25),Kl.buildBls12381(n);const e={};if(e.code=n.build(),e.pq=n.modules.f1m.pq,e.pr=n.modules.frm.pq,e.pG1gen=n.modules.bls12381.pG1gen,e.pG1zero=n.modules.bls12381.pG1zero,e.pG1b=n.modules.bls12381.pG1b,e.pG2gen=n.modules.bls12381.pG2gen,e.pG2zero=n.modules.bls12381.pG2zero,e.pG2b=n.modules.bls12381.pG2b,e.pOneT=n.modules.bls12381.pOneT,e.prePSize=n.modules.bls12381.prePSize,e.preQSize=n.modules.bls12381.preQSize,e.n8q=48,e.n8r=32,e.q=n.modules.bn128.q,e.r=n.modules.bn128.r,globalThis.curve_bls12381)return globalThis.curve_bls12381;const c={name:"bls12381",wasm:e,q:mn("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab",16),r:mn("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001",16),n8q:48,n8r:32,cofactorG1:mn("0x396c8c005555e1568c00aaab0000aaab",16),cofactorG2:mn("0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5",16),singleThread:!1},i=await os(c);return i.terminate=async function(){c.singleThread||(globalThis.curve_bls12381=null,await this.tm.terminate())},globalThis.curve_bls12381=i,i}mn("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001",16),mn("21888242871839275222246405745257275088548364400416034343698204186575808495617"),mn("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab",16),mn("21888242871839275222246405745257275088696311157297823662689037894645226208583");const pn=J_,o3=Nu;function hs(t){return String.fromCharCode(97+t)}async function ci(t,a,n){const e=t+hs(a),c="zky"+hs(a),i=await ue(e),r=await i.read(4);let _="";for(let I=0;I<4;I++)_+=String.fromCharCode(r[I]);if(_!=c)throw new Error(e+": Invalid File format");if(await i.readULE32()>n)throw new Error("Version not supported");if(await i.readULE32()!=1)throw new Error("More than one section found");let s=await i.readULE64();return i.readingSection={size:s,p:i.pos},i}async function li(t,a){if(typeof t.readingSection>"u")throw new Error("Not reading a section");if(t.pos-t.readingSection.p!=t.readingSection.size)throw new Error("Invalid section size reading");await t.close(),delete t.readingSection}async function xa(t,a,n){const e=await ci(t,a,n);let c;return e.readingSection.size<1<<30?c=new Uint8Array(e.readingSection.size):c=new un(e.readingSection.size),await e.readToBuffer(c,0,e.readingSection.size,e.pos),await li(e),c}pn.e("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001",16),pn.e("21888242871839275222246405745257275088548364400416034343698204186575808495617");const e3=pn.e("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab",16),i3=pn.e("21888242871839275222246405745257275088696311157297823662689037894645226208583");async function Ls(t){let a;if(pn.eq(t,i3))a=await n3();else if(pn.eq(t,e3))a=await a3();else throw new Error(`Curve not supported: ${pn.toString(t)}`);return a}var $n={exports:{}},si,ps;function c3(){if(ps)return si;ps=1,si=a;class t extends Error{}t.prototype.name="AssertionError";function a(n,e){if(!n){var c=new t(e);throw Error.captureStackTrace&&Error.captureStackTrace(c,a),c}}return si}var vo={exports:{}},ri,bs;function l3(){if(bs)return ri;bs=1;function t(e){return e.length}function a(e){const c=e.byteLength;let i="";for(let r=0;r<c;r++)i+=String.fromCharCode(e[r]);return i}function n(e,c,i=0,r=t(c)){const _=Math.min(r,e.byteLength-i);for(let u=0;u<_;u++)e[i+u]=c.charCodeAt(u);return _}return ri={byteLength:t,toString:a,write:n},ri}var di,ys;function s3(){if(ys)return di;ys=1;const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=new Uint8Array(256);for(let i=0;i<t.length;i++)a[t.charCodeAt(i)]=i;a[45]=62,a[95]=63;function n(i){let r=i.length;return i.charCodeAt(r-1)===61&&r--,r>1&&i.charCodeAt(r-1)===61&&r--,r*3>>>2}function e(i){const r=i.byteLength;let _="";for(let u=0;u<r;u+=3)_+=t[i[u]>>2]+t[(i[u]&3)<<4|i[u+1]>>4]+t[(i[u+1]&15)<<2|i[u+2]>>6]+t[i[u+2]&63];return r%3===2?_=_.substring(0,_.length-1)+"=":r%3===1&&(_=_.substring(0,_.length-2)+"=="),_}function c(i,r,_=0,u=n(r)){const l=Math.min(u,i.byteLength-_);for(let s=0,I=0;I<l;s+=4){const b=a[r.charCodeAt(s)],f=a[r.charCodeAt(s+1)],w=a[r.charCodeAt(s+2)],O=a[r.charCodeAt(s+3)];i[I++]=b<<2|f>>4,i[I++]=(f&15)<<4|w>>2,i[I++]=(w&3)<<6|O&63}return l}return di={byteLength:n,toString:e,write:c},di}var _i,As;function r3(){if(As)return _i;As=1;function t(c){return c.length>>>1}function a(c){const i=c.byteLength;c=new DataView(c.buffer,c.byteOffset,i);let r="",_=0;for(let u=i-i%4;_<u;_+=4)r+=c.getUint32(_).toString(16).padStart(8,"0");for(;_<i;_++)r+=c.getUint8(_).toString(16).padStart(2,"0");return r}function n(c,i,r=0,_=t(i)){const u=Math.min(_,c.byteLength-r);for(let l=0;l<u;l++){const s=e(i.charCodeAt(l*2)),I=e(i.charCodeAt(l*2+1));if(s===void 0||I===void 0)return c.subarray(0,l);c[r+l]=s<<4|I}return u}_i={byteLength:t,toString:a,write:n};function e(c){if(c>=48&&c<=57)return c-48;if(c>=65&&c<=70)return c-65+10;if(c>=97&&c<=102)return c-97+10}return _i}var ui,ms;function d3(){if(ms)return ui;ms=1;function t(e){let c=0;for(let i=0,r=e.length;i<r;i++){const _=e.charCodeAt(i);if(_>=55296&&_<=56319&&i+1<r){const u=e.charCodeAt(i+1);if(u>=56320&&u<=57343){c+=4,i++;continue}}_<=127?c+=1:_<=2047?c+=2:c+=3}return c}let a;if(typeof TextDecoder<"u"){const e=new TextDecoder;a=function(i){return e.decode(i)}}else a=function(c){const i=c.byteLength;let r="",_=0;for(;_<i;){let u=c[_];if(u<=127){r+=String.fromCharCode(u),_++;continue}let l=0,s=0;if(u<=223?(l=1,s=u&31):u<=239?(l=2,s=u&15):u<=244&&(l=3,s=u&7),i-_-l>0){let I=0;for(;I<l;)u=c[_+I+1],s=s<<6|u&63,I+=1}else s=65533,l=i-_;r+=String.fromCodePoint(s),_+=l+1}return r};let n;if(typeof TextEncoder<"u"){const e=new TextEncoder;n=function(i,r,_=0,u=t(r)){const l=Math.min(u,i.byteLength-_);return e.encodeInto(r,i.subarray(_,_+l)),l}}else n=function(c,i,r=0,_=t(i)){const u=Math.min(_,c.byteLength-r);c=c.subarray(r,r+u);let l=0,s=0;for(;l<i.length;){const I=i.codePointAt(l);if(I<=127){c[s++]=I,l++;continue}let b=0,f=0;for(I<=2047?(b=6,f=192):I<=65535?(b=12,f=224):I<=2097151&&(b=18,f=240),c[s++]=f|I>>b,b-=6;b>=0;)c[s++]=128|I>>b&63,b-=6;l+=I>=65536?2:1}return u};return ui={byteLength:t,toString:a,write:n},ui}var gi,Cs;function _3(){if(Cs)return gi;Cs=1;function t(e){return e.length*2}function a(e){const c=e.byteLength;let i="";for(let r=0;r<c-1;r+=2)i+=String.fromCharCode(e[r]+e[r+1]*256);return i}function n(e,c,i=0,r=t(c)){const _=Math.min(r,e.byteLength-i);let u=_;for(let l=0;l<c.length&&!((u-=2)<0);++l){const s=c.charCodeAt(l),I=s>>8,b=s%256;e[i+l*2]=b,e[i+l*2+1]=I}return _}return gi={byteLength:t,toString:a,write:n},gi}var Is;function u3(){return Is||(Is=1,function(t,a){const n=l3(),e=s3(),c=r3(),i=d3(),r=_3(),_=new Uint8Array(Uint16Array.of(255).buffer)[0]===255;function u(nt){switch(nt){case"ascii":return n;case"base64":return e;case"hex":return c;case"utf8":case"utf-8":case void 0:case null:return i;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r;default:throw new Error(`Unknown encoding: ${nt}`)}}function l(nt){return nt instanceof Uint8Array}function s(nt){try{return u(nt),!0}catch{return!1}}function I(nt,Q,A){const lt=new Uint8Array(nt);return Q!==void 0&&a.fill(lt,Q,0,lt.byteLength,A),lt}function b(nt){return new Uint8Array(nt)}function f(nt){return new Uint8Array(nt)}function w(nt,Q){return u(Q).byteLength(nt)}function O(nt,Q){if(nt===Q)return 0;const A=Math.min(nt.byteLength,Q.byteLength);nt=new DataView(nt.buffer,nt.byteOffset,nt.byteLength),Q=new DataView(Q.buffer,Q.byteOffset,Q.byteLength);let lt=0;for(let Ft=A-A%4;lt<Ft;lt+=4){const Ut=nt.getUint32(lt,_),dt=Q.getUint32(lt,_);if(Ut!==dt)break}for(;lt<A;lt++){const Ft=nt.getUint8(lt),Ut=Q.getUint8(lt);if(Ft<Ut)return-1;if(Ft>Ut)return 1}return nt.byteLength>Q.byteLength?1:nt.byteLength<Q.byteLength?-1:0}function D(nt,Q){Q===void 0&&(Q=nt.reduce((Ft,Ut)=>Ft+Ut.byteLength,0));const A=new Uint8Array(Q);let lt=0;for(const Ft of nt){if(lt+Ft.byteLength>A.byteLength){const Ut=Ft.subarray(0,A.byteLength-lt);return A.set(Ut,lt),A}A.set(Ft,lt),lt+=Ft.byteLength}return A}function G(nt,Q,A=0,lt=0,Ft=nt.byteLength){if(Ft>0&&Ft<lt||Ft===lt||nt.byteLength===0||Q.byteLength===0)return 0;if(A<0)throw new RangeError("targetStart is out of range");if(lt<0||lt>=nt.byteLength)throw new RangeError("sourceStart is out of range");if(Ft<0)throw new RangeError("sourceEnd is out of range");A>=Q.byteLength&&(A=Q.byteLength),Ft>nt.byteLength&&(Ft=nt.byteLength),Q.byteLength-A<Ft-lt&&(Ft=Q.length-A+lt);const Ut=Ft-lt;return nt===Q?Q.copyWithin(A,lt,Ft):Q.set(nt.subarray(lt,Ft),A),Ut}function V(nt,Q){if(nt===Q)return!0;if(nt.byteLength!==Q.byteLength)return!1;const A=nt.byteLength;nt=new DataView(nt.buffer,nt.byteOffset,nt.byteLength),Q=new DataView(Q.buffer,Q.byteOffset,Q.byteLength);let lt=0;for(let Ft=A-A%4;lt<Ft;lt+=4)if(nt.getUint32(lt,_)!==Q.getUint32(lt,_))return!1;for(;lt<A;lt++)if(nt.getUint8(lt)!==Q.getUint8(lt))return!1;return!0}function it(nt,Q,A,lt,Ft){if(typeof Q=="string"?typeof A=="string"?(Ft=A,A=0,lt=nt.byteLength):typeof lt=="string"&&(Ft=lt,lt=nt.byteLength):typeof Q=="number"?Q=Q&255:typeof Q=="boolean"&&(Q=+Q),A<0||nt.byteLength<A||nt.byteLength<lt)throw new RangeError("Out of range index");if(A===void 0&&(A=0),lt===void 0&&(lt=nt.byteLength),lt<=A)return nt;if(Q||(Q=0),typeof Q=="number")for(let Ut=A;Ut<lt;++Ut)nt[Ut]=Q;else{Q=l(Q)?Q:Z(Q,Ft);const Ut=Q.byteLength;for(let dt=0;dt<lt-A;++dt)nt[dt+A]=Q[dt%Ut]}return nt}function Z(nt,Q,A){return typeof nt=="string"?E(nt,Q):Array.isArray(nt)?M(nt):ArrayBuffer.isView(nt)?h(nt):y(nt,Q,A)}function E(nt,Q){const A=u(Q),lt=new Uint8Array(A.byteLength(nt));return A.write(lt,nt,0,lt.byteLength),lt}function M(nt){const Q=new Uint8Array(nt.length);return Q.set(nt),Q}function h(nt){const Q=new Uint8Array(nt.byteLength);return Q.set(nt),Q}function y(nt,Q,A){return new Uint8Array(nt,Q,A)}function q(nt,Q,A,lt){return x(nt,Q,A,lt)!==-1}function g(nt,Q,A,lt,Ft){if(nt.byteLength===0)return-1;if(typeof A=="string"?(lt=A,A=0):A===void 0?A=Ft?0:nt.length-1:A<0&&(A+=nt.byteLength),A>=nt.byteLength){if(Ft)return-1;A=nt.byteLength-1}else if(A<0)if(Ft)A=0;else return-1;if(typeof Q=="string")Q=Z(Q,lt);else if(typeof Q=="number")return Q=Q&255,Ft?nt.indexOf(Q,A):nt.lastIndexOf(Q,A);if(Q.byteLength===0)return-1;if(Ft){let Ut=-1;for(let dt=A;dt<nt.byteLength;dt++)if(nt[dt]===Q[Ut===-1?0:dt-Ut]){if(Ut===-1&&(Ut=dt),dt-Ut+1===Q.byteLength)return Ut}else Ut!==-1&&(dt-=dt-Ut),Ut=-1}else{A+Q.byteLength>nt.byteLength&&(A=nt.byteLength-Q.byteLength);for(let Ut=A;Ut>=0;Ut--){let dt=!0;for(let B=0;B<Q.byteLength;B++)if(nt[Ut+B]!==Q[B]){dt=!1;break}if(dt)return Ut}}return-1}function x(nt,Q,A,lt){return g(nt,Q,A,lt,!0)}function H(nt,Q,A,lt){return g(nt,Q,A,lt,!1)}function T(nt,Q,A){const lt=nt[Q];nt[Q]=nt[A],nt[A]=lt}function N(nt){const Q=nt.byteLength;if(Q%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let A=0;A<Q;A+=2)T(nt,A,A+1);return nt}function P(nt){const Q=nt.byteLength;if(Q%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let A=0;A<Q;A+=4)T(nt,A,A+3),T(nt,A+1,A+2);return nt}function v(nt){const Q=nt.byteLength;if(Q%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let A=0;A<Q;A+=8)T(nt,A,A+7),T(nt,A+1,A+6),T(nt,A+2,A+5),T(nt,A+3,A+4);return nt}function S(nt){return nt}function et(nt,Q,A=0,lt=nt.byteLength){const Ft=nt.byteLength;return A>=Ft||lt<=A?"":(A<0&&(A=0),lt>Ft&&(lt=Ft),(A!==0||lt<Ft)&&(nt=nt.subarray(A,lt)),u(Q).toString(nt))}function _t(nt,Q,A,lt,Ft){return A===void 0?Ft="utf8":lt===void 0&&typeof A=="string"?(Ft=A,A=void 0):Ft===void 0&&typeof lt=="string"&&(Ft=lt,lt=void 0),u(Ft).write(nt,Q,A,lt)}function mt(nt,Q,A){return A===void 0&&(A=0),new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setFloat64(A,Q,!0),A+8}function xt(nt,Q,A){return A===void 0&&(A=0),new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setFloat32(A,Q,!0),A+4}function Pt(nt,Q,A){return A===void 0&&(A=0),new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setUint32(A,Q,!0),A+4}function zt(nt,Q,A){return A===void 0&&(A=0),new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setInt32(A,Q,!0),A+4}function Rt(nt,Q){return Q===void 0&&(Q=0),new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getFloat64(Q,!0)}function k(nt,Q){return Q===void 0&&(Q=0),new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getFloat32(Q,!0)}function Ct(nt,Q){return Q===void 0&&(Q=0),new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getUint32(Q,!0)}function St(nt,Q){return Q===void 0&&(Q=0),new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getInt32(Q,!0)}function F(nt,Q,A){return A===void 0&&(A=0),new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setFloat64(A,Q,!1),A+8}function o(nt,Q,A){return A===void 0&&(A=0),new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setFloat32(A,Q,!1),A+4}function L(nt,Q,A){return A===void 0&&(A=0),new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setUint32(A,Q,!1),A+4}function U(nt,Q,A){return A===void 0&&(A=0),new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setInt32(A,Q,!1),A+4}function p(nt,Q){return Q===void 0&&(Q=0),new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getFloat64(Q,!1)}function st(nt,Q){return Q===void 0&&(Q=0),new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getFloat32(Q,!1)}function qt(nt,Q){return Q===void 0&&(Q=0),new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getUint32(Q,!1)}function wt(nt,Q){return Q===void 0&&(Q=0),new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getInt32(Q,!1)}t.exports=a={isBuffer:l,isEncoding:s,alloc:I,allocUnsafe:b,allocUnsafeSlow:f,byteLength:w,compare:O,concat:D,copy:G,equals:V,fill:it,from:Z,includes:q,indexOf:x,lastIndexOf:H,swap16:N,swap32:P,swap64:v,toBuffer:S,toString:et,write:_t,writeDoubleLE:mt,writeFloatLE:xt,writeUInt32LE:Pt,writeInt32LE:zt,readDoubleLE:Rt,readFloatLE:k,readUInt32LE:Ct,readInt32LE:St,writeDoubleBE:F,writeFloatBE:o,writeUInt32BE:L,writeInt32BE:U,readDoubleBE:p,readFloatBE:st,readUInt32BE:qt,readInt32BE:wt}}(vo,vo.exports)),vo.exports}var fi,ws;function g3(){if(ws)return fi;ws=1;var t=(i,r)=>function(){return r||(0,i[Object.keys(i)[0]])((r={exports:{}}).exports,r),r.exports},a=(()=>{for(var i=new Uint8Array(128),r=0;r<64;r++)i[r<26?r+65:r<52?r+71:r<62?r-4:r*4-205]=r;return _=>{for(var u=_.length,l=new Uint8Array((u-(_[u-1]=="=")-(_[u-2]=="="))*3/4|0),s=0,I=0;s<u;){var b=i[_.charCodeAt(s++)],f=i[_.charCodeAt(s++)],w=i[_.charCodeAt(s++)],O=i[_.charCodeAt(s++)];l[I++]=b<<2|f>>4,l[I++]=f<<4|w>>2,l[I++]=w<<6|O}return l}})(),n=t({"wasm-binary:./blake2b.wat"(i,r){r.exports=a("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMKvz8EwAIAIABCADcDACAAQgA3AwggAEIANwMQIABCADcDGCAAQgA3AyAgAEIANwMoIABCADcDMCAAQgA3AzggAEIANwNAIABCADcDSCAAQgA3A1AgAEIANwNYIABCADcDYCAAQgA3A2ggAEIANwNwIABCADcDeCAAQoiS853/zPmE6gBBACkDAIU3A4ABIABCu86qptjQ67O7f0EIKQMAhTcDiAEgAEKr8NP0r+68tzxBECkDAIU3A5ABIABC8e30+KWn/aelf0EYKQMAhTcDmAEgAELRhZrv+s+Uh9EAQSApAwCFNwOgASAAQp/Y+dnCkdqCm39BKCkDAIU3A6gBIABC6/qG2r+19sEfQTApAwCFNwOwASAAQvnC+JuRo7Pw2wBBOCkDAIU3A7gBIABCADcDwAEgAEIANwPIASAAQgA3A9ABC20BA38gAEHAAWohAyAAQcgBaiEEIAQpAwCnIQUCQANAIAEgAkYNASAFQYABRgRAIAMgAykDACAFrXw3AwBBACEFIAAQAwsgACAFaiABLQAAOgAAIAVBAWohBSABQQFqIQEMAAsLIAQgBa03AwALYQEDfyAAQcABaiEBIABByAFqIQIgASABKQMAIAIpAwB8NwMAIABCfzcD0AEgAikDAKchAwJAA0AgA0GAAUYNASAAIANqQQA6AAAgA0EBaiEDDAALCyACIAOtNwMAIAAQAwuqOwIgfgl/IABBgAFqISEgAEGIAWohIiAAQZABaiEjIABBmAFqISQgAEGgAWohJSAAQagBaiEmIABBsAFqIScgAEG4AWohKCAhKQMAIQEgIikDACECICMpAwAhAyAkKQMAIQQgJSkDACEFICYpAwAhBiAnKQMAIQcgKCkDACEIQoiS853/zPmE6gAhCUK7zqqm2NDrs7t/IQpCq/DT9K/uvLc8IQtC8e30+KWn/aelfyEMQtGFmu/6z5SH0QAhDUKf2PnZwpHagpt/IQ5C6/qG2r+19sEfIQ9C+cL4m5Gjs/DbACEQIAApAwAhESAAKQMIIRIgACkDECETIAApAxghFCAAKQMgIRUgACkDKCEWIAApAzAhFyAAKQM4IRggACkDQCEZIAApA0ghGiAAKQNQIRsgACkDWCEcIAApA2AhHSAAKQNoIR4gACkDcCEfIAApA3ghICANIAApA8ABhSENIA8gACkD0AGFIQ8gASAFIBF8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSASfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgE3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBR8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAVfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgFnx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBd8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAYfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgGXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBp8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAbfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgHHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIB18fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAefHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgH3x8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFICB8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAffHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgG3x8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBV8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAZfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgGnx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHICB8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAefHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggF3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBJ8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAdfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgEXx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBN8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAcfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggGHx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBZ8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAUfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgHHx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBl8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAdfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgEXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBZ8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByATfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggIHx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIB58fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAbfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgH3x8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBR8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAXfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggGHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBJ8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAafHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFXx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBh8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAafHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFHx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBJ8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAefHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHXx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBx8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAffHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgE3x8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBd8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAWfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgG3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBV8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCARfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgIHx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBl8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAafHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEXx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBZ8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAYfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgE3x8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBV8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAbfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggIHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIB98fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiASfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgHHx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIB18fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAXfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggGXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBR8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAefHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgE3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIB18fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAXfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgG3x8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBF8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAcfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggGXx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBR8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAVfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBh8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAWfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggIHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIB98fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSASfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgGnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIB18fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAWfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgEnx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGICB8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAffHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHnx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBV8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAbfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBh8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAXfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgFHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBp8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCATfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgGXx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBx8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAefHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgHHx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBh8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAffHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgHXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBJ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAUfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGnx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBZ8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiARfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgIHx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBV8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAZfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggF3x8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBN8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAbfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgF3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFICB8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAffHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGnx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBx8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAUfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggEXx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBl8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAdfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgE3x8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIB58fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAYfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggEnx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBV8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAbfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBt8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSATfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgGXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBV8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAYfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgF3x8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBJ8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAWfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgIHx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBx8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAafHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgH3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBR8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAdfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgHnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBF8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBN8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAUfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgFXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBZ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAXfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBl8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAafHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgG3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBx8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAdfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHnx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB98fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAgfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgH3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBt8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAVfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBp8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgISAhKQMAIAEgCYWFNwMAICIgIikDACACIAqFhTcDACAjICMpAwAgAyALhYU3AwAgJCAkKQMAIAQgDIWFNwMAICUgJSkDACAFIA2FhTcDACAmICYpAwAgBiAOhYU3AwAgJyAnKQMAIAcgD4WFNwMAICggKCkDACAIIBCFhTcDAAs=")}}),e=n(),c=WebAssembly.compile(e);return fi=async i=>(await WebAssembly.instantiate(await c,i)).exports,fi}var vs;function f3(){if(vs)return $n.exports;vs=1;var t=c3(),a=u3(),n=null,e=typeof WebAssembly<"u"&&g3()().then(w=>{n=w}),c=64,i=[];$n.exports=b;var r=$n.exports.BYTES_MIN=16,_=$n.exports.BYTES_MAX=64;$n.exports.BYTES=32;var u=$n.exports.KEYBYTES_MIN=16,l=$n.exports.KEYBYTES_MAX=64;$n.exports.KEYBYTES=32;var s=$n.exports.SALTBYTES=16,I=$n.exports.PERSONALBYTES=16;function b(w,O,D,G,V){if(!(this instanceof b))return new b(w,O,D,G,V);if(!n)throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");w||(w=32),V!==!0&&(t(w>=r,"digestLength must be at least "+r+", was given "+w),t(w<=_,"digestLength must be at most "+_+", was given "+w),O!=null&&(t(O instanceof Uint8Array,"key must be Uint8Array or Buffer"),t(O.length>=u,"key must be at least "+u+", was given "+O.length),t(O.length<=l,"key must be at least "+l+", was given "+O.length)),D!=null&&(t(D instanceof Uint8Array,"salt must be Uint8Array or Buffer"),t(D.length===s,"salt must be exactly "+s+", was given "+D.length)),G!=null&&(t(G instanceof Uint8Array,"personal must be Uint8Array or Buffer"),t(G.length===I,"personal must be exactly "+I+", was given "+G.length))),i.length||(i.push(c),c+=216),this.digestLength=w,this.finalized=!1,this.pointer=i.pop(),this._memory=new Uint8Array(n.memory.buffer),this._memory.fill(0,0,64),this._memory[0]=this.digestLength,this._memory[1]=O?O.length:0,this._memory[2]=1,this._memory[3]=1,D&&this._memory.set(D,32),G&&this._memory.set(G,48),this.pointer+216>this._memory.length&&this._realloc(this.pointer+216),n.blake2b_init(this.pointer,this.digestLength),O&&(this.update(O),this._memory.fill(0,c,c+O.length),this._memory[this.pointer+200]=128)}b.prototype._realloc=function(w){n.memory.grow(Math.max(0,Math.ceil(Math.abs(w-this._memory.length)/65536))),this._memory=new Uint8Array(n.memory.buffer)},b.prototype.update=function(w){return t(this.finalized===!1,"Hash instance finalized"),t(w instanceof Uint8Array,"input must be Uint8Array or Buffer"),c+w.length>this._memory.length&&this._realloc(c+w.length),this._memory.set(w,c),n.blake2b_update(this.pointer,c,c+w.length),this},b.prototype.digest=function(w){if(t(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,i.push(this.pointer),n.blake2b_final(this.pointer),!w||w==="binary")return this._memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(typeof w=="string")return a.toString(this._memory,w,this.pointer+128,this.pointer+128+this.digestLength);t(w instanceof Uint8Array&&w.length>=this.digestLength,"input must be Uint8Array or Buffer");for(var O=0;O<this.digestLength;O++)w[O]=this._memory[this.pointer+128+O];return w},b.prototype.final=b.prototype.digest,b.WASM=n,b.SUPPORTED=typeof WebAssembly<"u",b.ready=function(w){return w||(w=f),e?e.then(()=>w(),w):w(new Error("WebAssembly not supported"))},b.prototype.ready=b.ready,b.prototype.getPartialHash=function(){return this._memory.slice(this.pointer,this.pointer+216)},b.prototype.setPartialHash=function(w){this._memory.set(w,this.pointer)};function f(){}return $n.exports}f3();var hi={exports:{}},Va=od(Zd),Bs;function h3(){if(Bs)return hi.exports;Bs=1;var t=Va,a=Va.EventEmitter,n=Va,e=hi.exports=function(c,i){if(!(this instanceof e))return new e(c,i);a.call(this),i=i||{},i.maxLineLength=i.maxLineLength||4096,i.retainBuffer=!!i.retainBuffer;var r=this,_=new Buffer(i.maxLineLength),u=0,l=0,s=0,I=function(b,f){try{var w=_.slice(0,u);r.emit("line",i.retainBuffer?w:w.toString(),b,f)}catch(O){r.emit("error",O)}finally{u=0}};this.input=typeof c=="string"?t.createReadStream(c,i):c,this.input.on("open",function(b){r.emit("open",b)}).on("data",function(b){for(var f=0;f<b.length;f++)b[f]==10||b[f]==13?b[f]==10&&(l++,I(l,s)):(_[u]=b[f],u++),s++}).on("error",function(b){r.emit("error",b)}).on("end",function(){u&&(l++,I(l,s)),r.emit("end")}).on("close",function(){r.emit("close")})};return n.inherits(e,a),hi.exports}h3();function Es(t){return(t&4294901760?(t&=4294901760,16):0)|(t&4278255360?(t&=4278255360,8):0)|(t&4042322160?(t&=4042322160,4):0)|(t&3435973836?(t&=3435973836,2):0)|(t&2863311530)!==0}async function Li(t,a,n){const e=await t.read(a.G1.F.n8*2),c=a.G1.fromRprLEM(e,0);return n?a.G1.toObject(c):c}async function pi(t,a,n){const e=await t.read(a.G2.F.n8*2),c=a.G2.fromRprLEM(e,0);return n?a.G2.toObject(c):c}async function L3(t,a){const n=await ci(t,1,a),e=await n.readULE32();if(await li(n),e==1)return await p3(t,a);throw new Error("Protocol not supported: ")}async function p3(t,a,n){const e={};e.protocol="groth16";const c=await ci(t,2,a),i=await c.readULE32();e.n8q=i,e.q=await ge(c,i);const r=await c.readULE32();e.n8r=r,e.r=await ge(c,r);let _=await Ls(e.q);return e.nVars=await c.readULE32(),e.nPublic=await c.readULE32(),e.domainSize=await c.readULE32(),e.power=Es(e.domainSize),e.vk_alpha_1=await Li(c,_,n),e.vk_beta_1=await Li(c,_,n),e.vk_beta_2=await pi(c,_,n),e.vk_gamma_2=await pi(c,_,n),e.vk_delta_1=await Li(c,_,n),e.vk_delta_2=await pi(c,_,n),await li(c),e}async function b3(t,a,n){await Yc(t,1);const e=(Math.floor((pn.bitLength(n)-1)/64)+1)*8;if(await t.writeULE32(e),await f2(t,n,e),a.byteLength%e!=0)throw new Error("Invalid witness length");await t.writeULE32(a.byteLength/e),await Xc(t),await Yc(t,2),await t.write(a),await Xc(t)}async function y3(t,a){await u2(t,a,1);const n=await t.readULE32(),e=await ge(t,n),c=await t.readULE32();return await g2(t),{n8:n,q:e,nWitness:c}}const{stringifyBigInts:Fs}=o3;async function A3(t,a,n){const{fd:e,sections:c}=await d2(a,"wtns",2,33554432,8388608),i=await y3(e,c),r=2,_=await L3(t,r);if(_.protocol!="groth16")throw new Error("zkey file is not groth16");if(!pn.eq(_.r,i.q))throw new Error("Curve of the witness does not match the curve of the proving key");if(i.nWitness!=_.nVars)throw new Error(`Invalid witness length. Circuit: ${_.nVars}, witness: ${i.nWitness}`);const u=await Ls(_.q),l=u.Fr,s=u.G1,I=u.G2,b=Es(_.domainSize),f=await h2(e,c,2),w=await xa(t,4,r),[O,D,G]=await m3(u,_,f,w),V=b==l.s?u.Fr.shift:u.Fr.w[b+1],it=await l.ifft(O,"","",n,"IFFT_A"),Z=await l.batchApplyKey(it,l.e(1),V),E=await l.fft(Z,"","",n,"FFT_A"),M=await l.ifft(D,"","",n,"IFFT_B"),h=await l.batchApplyKey(M,l.e(1),V),y=await l.fft(h,"","",n,"FFT_B"),q=await l.ifft(G,"","",n,"IFFT_C"),g=await l.batchApplyKey(q,l.e(1),V),x=await l.fft(g,"","",n,"FFT_C"),H=await C3(u,_,E,y,x);let T={};const N=await xa(t,5,r);T.pi_a=await u.G1.multiExpAffine(N,f,n,"multiexp A");const P=await xa(t,6,r);let v=await u.G1.multiExpAffine(P,f,n,"multiexp B1");const S=await xa(t,7,r);T.pi_b=await u.G2.multiExpAffine(S,f,n,"multiexp B2");const et=await xa(t,8,r);T.pi_c=await u.G1.multiExpAffine(et,f.slice((_.nPublic+1)*u.Fr.n8),n,"multiexp C");const _t=await xa(t,9,r),mt=await u.G1.multiExpAffine(_t,H,n,"multiexp H"),xt=u.Fr.random(),Pt=u.Fr.random();T.pi_a=s.add(T.pi_a,_.vk_alpha_1),T.pi_a=s.add(T.pi_a,s.timesFr(_.vk_delta_1,xt)),T.pi_b=I.add(T.pi_b,_.vk_beta_2),T.pi_b=I.add(T.pi_b,I.timesFr(_.vk_delta_2,Pt)),v=s.add(v,_.vk_beta_1),v=s.add(v,s.timesFr(_.vk_delta_1,Pt)),T.pi_c=s.add(T.pi_c,mt),T.pi_c=s.add(T.pi_c,s.timesFr(T.pi_a,Pt)),T.pi_c=s.add(T.pi_c,s.timesFr(v,xt)),T.pi_c=s.add(T.pi_c,s.timesFr(_.vk_delta_1,l.neg(l.mul(xt,Pt))));let zt=[];for(let Rt=1;Rt<=_.nPublic;Rt++){const k=f.slice(Rt*l.n8,Rt*l.n8+l.n8);zt.push(pn.fromRprLE(k))}return T.pi_a=s.toObject(s.toAffine(T.pi_a)),T.pi_b=I.toObject(I.toAffine(T.pi_b)),T.pi_c=s.toObject(s.toAffine(T.pi_c)),T.protocol="groth16",T.curve=u.name,await e.close(),T=Fs(T),zt=Fs(zt),{proof:T,publicSignals:zt}}async function m3(t,a,n,e,c){const i=t.Fr.n8,r=4*3+a.n8r,_=(e.byteLength-4)/r,u=new un(a.domainSize*i),l=new un(a.domainSize*i),s=new un(a.domainSize*i),I=[u,l];for(let b=0;b<_;b++){const f=e.slice(4+b*r,4+b*r+r),w=new DataView(f.buffer),O=w.getUint32(0,!0),D=w.getUint32(4,!0),G=w.getUint32(8,!0),V=f.slice(12,12+i);I[O].set(t.Fr.add(I[O].slice(D*i,D*i+i),t.Fr.mul(V,n.slice(G*i,G*i+i))),D*i)}for(let b=0;b<a.domainSize;b++)s.set(t.Fr.mul(u.slice(b*i,b*i+i),l.slice(b*i,b*i+i)),b*i);return[u,l,s]}async function C3(t,a,n,e,c,i){const _=t.Fr.n8,u=Math.floor(n.byteLength/t.Fr.n8),l=[];for(let f=0;f<u;f+=4194304){const w=Math.min(u-f,4194304),O=[],D=n.slice(f*_,(f+w)*_),G=e.slice(f*_,(f+w)*_),V=c.slice(f*_,(f+w)*_);O.push({cmd:"ALLOCSET",var:0,buff:D}),O.push({cmd:"ALLOCSET",var:1,buff:G}),O.push({cmd:"ALLOCSET",var:2,buff:V}),O.push({cmd:"ALLOC",var:3,len:w*_}),O.push({cmd:"CALL",fnName:"qap_joinABC",params:[{var:0},{var:1},{var:2},{val:w},{var:3}]}),O.push({cmd:"CALL",fnName:"frm_batchFromMontgomery",params:[{var:3},{val:w},{var:3}]}),O.push({cmd:"GET",out:0,var:3,len:w*_}),l.push(t.tm.queueAction(O))}const s=await Promise.all(l);let I;n instanceof un?I=new un(n.byteLength):I=new Uint8Array(n.byteLength);let b=0;for(let f=0;f<s.length;f++)I.set(s[f][0],b),b+=s[f][0].byteLength;return I}function xs(t){var a=[];return n(a,t),a;function n(e,c){if(Array.isArray(c))for(let i=0;i<c.length;i++)n(e,c[i]);else e.push(c)}}function Ss(t){const a=BigInt(2)**BigInt(64);let n=BigInt("0xCBF29CE484222325");for(var e=0;e<t.length;e++)n^=BigInt(t[e].charCodeAt()),n*=BigInt(1099511628211),n%=a;let c=n.toString(16),i=16-c.length;return c="0".repeat(i).concat(c),c}function I3(t,a){const n=[];let e=BigInt(t);const c=BigInt(4294967296);for(;e;)n.unshift(Number(e%c)),e=e/c;if(a)for(var i=a-n.length;i>0;)n.unshift(0),i--;return n}async function w3(t,a){a=a||{};let n=32767,e,c=!1;for(;!c;)try{e=new WebAssembly.Memory({initial:n}),c=!0}catch(s){if(n===1)throw s;console.warn("Could not allocate "+n*1024*64+" bytes. This may cause severe instability. Trying with "+n*1024*64/2+" bytes"),n=Math.floor(n/2)}const i=await WebAssembly.compile(t);let r;const _=await WebAssembly.instantiate(i,{env:{memory:e},runtime:{exceptionHandler:function(s){let I;throw s==1?I="Signal not found. ":s==2?I="Too many signals set. ":s==3?I="Signal already set. ":s==4?I="Assert Failed. ":s==5?I="Not enough memory. ":I="Unknown error.",console.log("ERROR: ",s,I),new Error(I)},showSharedRWMemory:function(){const s=_.exports.getFieldNumLen32(),I=new Uint32Array(s);for(let b=0;b<s;b++)I[s-1-b]=_.exports.readSharedRWMemory(b);console.log(pn.fromArray(I,4294967296))},error:function(s,I,b,f,w,O){let D;throw s==7?D=l(I)+" "+r.getFr(f).toString()+" != "+r.getFr(w).toString()+" "+l(O):s==9?D=l(I)+" "+r.getFr(f).toString()+" "+l(w):s==5&&a.sym?D=l(I)+" "+a.sym.labelIdx2Name[w]:D=l(I)+" "+b+" "+f+" "+w+" "+O,console.log("ERROR: ",s,D),new Error(D)},log:function(s){console.log(r.getFr(s).toString())},logGetSignal:function(s,I){a.logGetSignal&&a.logGetSignal(s,r.getFr(I))},logSetSignal:function(s,I){a.logSetSignal&&a.logSetSignal(s,r.getFr(I))},logStartComponent:function(s){a.logStartComponent&&a.logStartComponent(s)},logFinishComponent:function(s){a.logFinishComponent&&a.logFinishComponent(s)}}}),u=a&&(a.sanityCheck||a.logGetSignal||a.logSetSignal||a.logStartComponent||a.logFinishComponent);return typeof _.exports.getVersion=="function"?r=new B3(_,u):r=new v3(e,_,u),r;function l(s){const I=new Uint8Array(e.buffer),b=[];for(let f=0;I[s+f]>0;f++)b.push(I[s+f]);return String.fromCharCode.apply(null,b)}}class v3{constructor(a,n,e){this.memory=a,this.i32=new Uint32Array(a.buffer),this.instance=n,this.n32=(this.instance.exports.getFrLen()>>2)-2;const c=this.instance.exports.getPRawPrime(),i=new Array(this.n32);for(let r=0;r<this.n32;r++)i[this.n32-1-r]=this.i32[(c>>2)+r];this.prime=pn.fromArray(i,4294967296),this.Fr=new gu(this.prime),this.mask32=pn.fromString("FFFFFFFF",16),this.NVars=this.instance.exports.getNVars(),this.n64=Math.floor((this.Fr.bitLength-1)/64)+1,this.R=this.Fr.e(pn.shiftLeft(1,this.n64*64)),this.RInv=this.Fr.inv(this.R),this.sanityCheck=e}circom_version(){return 1}async _doCalculateWitness(a,n){this.instance.exports.init(this.sanityCheck||n?1:0);const e=this.allocInt(),c=this.allocFr();Object.keys(a).forEach(r=>{const _=Ss(r),u=parseInt(_.slice(0,8),16),l=parseInt(_.slice(8,16),16);try{this.instance.exports.getSignalOffset32(e,0,u,l)}catch{throw new Error(`Signal ${r} is not an input of the circuit.`)}const s=this.getInt(e),I=xs(a[r]);for(let b=0;b<I.length;b++)this.setFr(c,I[b]),this.instance.exports.setSignal(0,0,s+b,c)})}async calculateWitness(a,n){const e=this,c=e.i32[0],i=[];await e._doCalculateWitness(a,n);for(let r=0;r<e.NVars;r++){const _=e.instance.exports.getPWitness(r);i.push(e.getFr(_))}return e.i32[0]=c,i}async calculateBinWitness(a,n){const e=this,c=e.i32[0];await e._doCalculateWitness(a,n);const i=e.instance.exports.getWitnessBuffer();e.i32[0]=c;const r=e.memory.buffer.slice(i,i+e.NVars*e.n64*8);return new Uint8Array(r)}allocInt(){const a=this.i32[0];return this.i32[0]=a+8,a}allocFr(){const a=this.i32[0];return this.i32[0]=a+this.n32*4+8,a}getInt(a){return this.i32[a>>2]}setInt(a,n){this.i32[a>>2]=n}getFr(a){const n=this,e=a>>2;if(n.i32[e+1]&2147483648){const i=new Array(n.n32);for(let _=0;_<n.n32;_++)i[n.n32-1-_]=n.i32[e+2+_];const r=n.Fr.e(pn.fromArray(i,4294967296));return n.i32[e+1]&1073741824?c(r):r}else return n.i32[e]&2147483648?n.Fr.e(n.i32[e]-4294967296):n.Fr.e(n.i32[e]);function c(i){return n.Fr.mul(n.RInv,i)}}setFr(a,n){const e=this;n=e.Fr.e(n);const c=e.Fr.neg(e.Fr.e("80000000",16)),i=e.Fr.e("7FFFFFFF",16);if(e.Fr.geq(n,c)&&e.Fr.leq(n,i)){let _;e.Fr.geq(n,e.Fr.zero)?_=pn.toNumber(n):(_=pn.toNumber(e.Fr.sub(n,c)),_=_-2147483648,_=4294967296+_),e.i32[a>>2]=_,e.i32[(a>>2)+1]=0;return}e.i32[a>>2]=0,e.i32[(a>>2)+1]=2147483648;const r=pn.toArray(n,4294967296);for(let _=0;_<e.n32;_++){const u=r.length-1-_;u>=0?e.i32[(a>>2)+2+_]=r[u]:e.i32[(a>>2)+2+_]=0}}}class B3{constructor(a,n){this.instance=a,this.version=this.instance.exports.getVersion(),this.n32=this.instance.exports.getFieldNumLen32(),this.instance.exports.getRawPrime();const e=new Array(this.n32);for(let c=0;c<this.n32;c++)e[this.n32-1-c]=this.instance.exports.readSharedRWMemory(c);this.prime=pn.fromArray(e,4294967296),this.witnessSize=this.instance.exports.getWitnessSize(),this.sanityCheck=n}circom_version(){return this.instance.exports.getVersion()}async _doCalculateWitness(a,n){this.instance.exports.init(this.sanityCheck||n?1:0);const e=Object.keys(a);var c=0;if(e.forEach(i=>{const r=Ss(i),_=parseInt(r.slice(0,8),16),u=parseInt(r.slice(8,16),16),l=xs(a[i]);for(let s=0;s<l.length;s++){const I=I3(l[s],this.n32);for(let b=0;b<this.n32;b++)this.instance.exports.writeSharedRWMemory(b,I[this.n32-1-b]);try{this.instance.exports.setInputSignal(_,u,s),c++}catch(b){throw new Error(b)}}}),c<this.instance.exports.getInputSize())throw new Error(`Not all inputs have been set. Only ${c} out of ${this.instance.exports.getInputSize()}`)}async calculateWitness(a,n){const e=[];await this._doCalculateWitness(a,n);for(let c=0;c<this.witnessSize;c++){this.instance.exports.getWitness(c);const i=new Uint32Array(this.n32);for(let r=0;r<this.n32;r++)i[this.n32-1-r]=this.instance.exports.readSharedRWMemory(r);e.push(fromArray32(i))}return e}async calculateWTNSBin(a,n){const e=new Uint32Array(this.witnessSize*this.n32+this.n32+11),c=new Uint8Array(e.buffer);await this._doCalculateWitness(a,n),c[0]=119,c[1]=116,c[2]=110,c[3]=115,e[1]=2,e[2]=2,e[3]=1;const i=this.n32*4,_=(8+i).toString(16);e[4]=parseInt(_.slice(0,8),16),e[5]=parseInt(_.slice(8,16),16),e[6]=i,this.instance.exports.getRawPrime();var u=7;for(let I=0;I<this.n32;I++)e[u+I]=this.instance.exports.readSharedRWMemory(I);u+=this.n32,e[u]=this.witnessSize,u++,e[u]=2,u++;const s=(i*this.witnessSize).toString(16);e[u]=parseInt(s.slice(0,8),16),e[u+1]=parseInt(s.slice(8,16),16),u+=2;for(let I=0;I<this.witnessSize;I++){this.instance.exports.getWitness(I);for(let b=0;b<this.n32;b++)e[u+b]=this.instance.exports.readSharedRWMemory(b);u+=this.n32}return c}}async function E3(t,a,n,e){const c=await ue(a),i=await c.read(c.totalSize);await c.close();const r=await w3(i);if(r.circom_version()==1){const _=await r.calculateBinWitness(t),u=await _2(n,"wtns",2,2);await b3(u,_,r.prime),await u.close()}else{const _=await Vc(n),u=await r.calculateWTNSBin(t);await _.write(u),await _.close()}}async function F3(t,a,n,e){const c={type:"mem"};return await E3(t,a,c),await A3(n,c,e)}pn.e("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001",16),pn.e("21888242871839275222246405745257275088548364400416034343698204186575808495617");var bi={},yi={},qs;function x3(){return qs||(qs=1,function(t){var a=/[|\\{}()[\]^$+*?.]/g,n=Object.prototype.hasOwnProperty,e=function(l,s){return n.apply(l,[s])};t.escapeRegExpChars=function(l){return l?String(l).replace(a,"\\$&"):""};var c={"&":"&","<":"<",">":">",'"':""","'":"'"},i=/[&<>'"]/g;function r(l){return c[l]||l}var _=`var _ENCODE_HTML_RULES = {
|
10
|
+
"&": "&"
|
11
|
+
, "<": "<"
|
12
|
+
, ">": ">"
|
13
|
+
, '"': """
|
14
|
+
, "'": "'"
|
15
|
+
}
|
16
|
+
, _MATCH_HTML = /[&<>'"]/g;
|
17
|
+
function encode_char(c) {
|
18
|
+
return _ENCODE_HTML_RULES[c] || c;
|
19
|
+
};
|
20
|
+
`;t.escapeXML=function(l){return l==null?"":String(l).replace(i,r)};function u(){return Function.prototype.toString.call(this)+`;
|
21
|
+
`+_}try{typeof Object.defineProperty=="function"?Object.defineProperty(t.escapeXML,"toString",{value:u}):t.escapeXML.toString=u}catch{console.warn("Unable to set escapeXML.toString (is the Function prototype frozen?)")}t.shallowCopy=function(l,s){if(s=s||{},l!=null)for(var I in s)e(s,I)&&(I==="__proto__"||I==="constructor"||(l[I]=s[I]));return l},t.shallowCopyFromList=function(l,s,I){if(I=I||[],s=s||{},l!=null)for(var b=0;b<I.length;b++){var f=I[b];if(typeof s[f]<"u"){if(!e(s,f)||f==="__proto__"||f==="constructor")continue;l[f]=s[f]}}return l},t.cache={_data:{},set:function(l,s){this._data[l]=s},get:function(l){return this._data[l]},remove:function(l){delete this._data[l]},reset:function(){this._data={}}},t.hyphenToCamel=function(l){return l.replace(/-[a-z]/g,function(s){return s[1].toUpperCase()})},t.createNullProtoObjWherePossible=function(){return typeof Object.create=="function"?function(){return Object.create(null)}:{__proto__:null}instanceof Object?function(){return{}}:function(){return{__proto__:null}}}(),t.hasOwnOnlyObject=function(l){var s=t.createNullProtoObjWherePossible();for(var I in l)e(l,I)&&(s[I]=l[I]);return s}}(yi)),yi}var S3={name:"ejs",description:"Embedded JavaScript templates",keywords:["template","engine","ejs"],version:"3.1.10",author:"Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)",license:"Apache-2.0",bin:{ejs:"./bin/cli.js"},main:"./lib/ejs.js",jsdelivr:"ejs.min.js",unpkg:"ejs.min.js",repository:{type:"git",url:"git://github.com/mde/ejs.git"},bugs:"https://github.com/mde/ejs/issues",homepage:"https://github.com/mde/ejs",dependencies:{jake:"^10.8.5"},devDependencies:{browserify:"^16.5.1",eslint:"^6.8.0","git-directory-deploy":"^1.5.1",jsdoc:"^4.0.2","lru-cache":"^4.0.1",mocha:"^10.2.0","uglify-js":"^3.3.16"},engines:{node:">=0.10.0"},scripts:{test:"npx jake test"}},Ps;function q3(){return Ps||(Ps=1,function(t){/**
|
22
|
+
* @file Embedded JavaScript templating engine. {@link http://ejs.co}
|
23
|
+
* @author Matthew Eernisse <mde@fleegix.org>
|
24
|
+
* @author Tiancheng "Timothy" Gu <timothygu99@gmail.com>
|
25
|
+
* @project EJS
|
26
|
+
* @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0}
|
27
|
+
*/var a=Va,n=Va,e=x3(),c=!1,i=S3.version,r="<",_=">",u="%",l="locals",s="ejs",I="(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)",b=["delimiter","scope","context","debug","compileDebug","client","_with","rmWhitespace","strict","filename","async"],f=b.concat("cache"),w=/^\uFEFF/,O=/^[a-zA-Z_$][0-9a-zA-Z_$]*$/;t.cache=e.cache,t.fileLoader=a.readFileSync,t.localsName=l,t.promiseImpl=new Function("return this;")().Promise,t.resolveInclude=function(q,g,x){var H=n.dirname,T=n.extname,N=n.resolve,P=N(x?g:H(g),q),v=T(q);return v||(P+=".ejs"),P};function D(q,g){var x;if(g.some(function(H){return x=t.resolveInclude(q,H,!0),a.existsSync(x)}))return x}function G(q,g){var x,H,T=g.views,N=/^[A-Za-z]+:\\|^\//.exec(q);if(N&&N.length)q=q.replace(/^\/*/,""),Array.isArray(g.root)?x=D(q,g.root):x=t.resolveInclude(q,g.root||"/",!0);else if(g.filename&&(H=t.resolveInclude(q,g.filename),a.existsSync(H)&&(x=H)),!x&&Array.isArray(T)&&(x=D(q,T)),!x&&typeof g.includer!="function")throw new Error('Could not find the include file "'+g.escapeFunction(q)+'"');return x}function V(q,g){var x,H=q.filename,T=arguments.length>1;if(q.cache){if(!H)throw new Error("cache option requires a filename");if(x=t.cache.get(H),x)return x;T||(g=Z(H).toString().replace(w,""))}else if(!T){if(!H)throw new Error("Internal EJS error: no file name or template provided");g=Z(H).toString().replace(w,"")}return x=t.compile(g,q),q.cache&&t.cache.set(H,x),x}function it(q,g,x){var H;if(x){try{H=V(q)(g)}catch(T){return x(T)}x(null,H)}else{if(typeof t.promiseImpl=="function")return new t.promiseImpl(function(T,N){try{H=V(q)(g),T(H)}catch(P){N(P)}});throw new Error("Please provide a callback function")}}function Z(q){return t.fileLoader(q)}function E(q,g){var x=e.shallowCopy(e.createNullProtoObjWherePossible(),g);if(x.filename=G(q,x),typeof g.includer=="function"){var H=g.includer(q,x.filename);if(H&&(H.filename&&(x.filename=H.filename),H.template))return V(x,H.template)}return V(x)}function M(q,g,x,H,T){var N=g.split(`
|
28
|
+
`),P=Math.max(H-3,0),v=Math.min(N.length,H+3),S=T(x),et=N.slice(P,v).map(function(_t,mt){var xt=mt+P+1;return(xt==H?" >> ":" ")+xt+"| "+_t}).join(`
|
29
|
+
`);throw q.path=S,q.message=(S||"ejs")+":"+H+`
|
30
|
+
`+et+`
|
31
|
+
|
32
|
+
`+q.message,q}function h(q){return q.replace(/;(\s*$)/,"$1")}t.compile=function(g,x){var H;return x&&x.scope&&(c||(console.warn("`scope` option is deprecated and will be removed in EJS 3"),c=!0),x.context||(x.context=x.scope),delete x.scope),H=new y(g,x),H.compile()},t.render=function(q,g,x){var H=g||e.createNullProtoObjWherePossible(),T=x||e.createNullProtoObjWherePossible();return arguments.length==2&&e.shallowCopyFromList(T,H,b),V(T,q)(H)},t.renderFile=function(){var q=Array.prototype.slice.call(arguments),g=q.shift(),x,H={filename:g},T,N;return typeof arguments[arguments.length-1]=="function"&&(x=q.pop()),q.length?(T=q.shift(),q.length?e.shallowCopy(H,q.pop()):(T.settings&&(T.settings.views&&(H.views=T.settings.views),T.settings["view cache"]&&(H.cache=!0),N=T.settings["view options"],N&&e.shallowCopy(H,N)),e.shallowCopyFromList(H,T,f)),H.filename=g):T=e.createNullProtoObjWherePossible(),it(H,T,x)},t.Template=y,t.clearCache=function(){t.cache.reset()};function y(q,g){var x=e.hasOwnOnlyObject(g),H=e.createNullProtoObjWherePossible();this.templateText=q,this.mode=null,this.truncate=!1,this.currentLine=1,this.source="",H.client=x.client||!1,H.escapeFunction=x.escape||x.escapeFunction||e.escapeXML,H.compileDebug=x.compileDebug!==!1,H.debug=!!x.debug,H.filename=x.filename,H.openDelimiter=x.openDelimiter||t.openDelimiter||r,H.closeDelimiter=x.closeDelimiter||t.closeDelimiter||_,H.delimiter=x.delimiter||t.delimiter||u,H.strict=x.strict||!1,H.context=x.context,H.cache=x.cache||!1,H.rmWhitespace=x.rmWhitespace,H.root=x.root,H.includer=x.includer,H.outputFunctionName=x.outputFunctionName,H.localsName=x.localsName||t.localsName||l,H.views=x.views,H.async=x.async,H.destructuredLocals=x.destructuredLocals,H.legacyInclude=typeof x.legacyInclude<"u"?!!x.legacyInclude:!0,H.strict?H._with=!1:H._with=typeof x._with<"u"?x._with:!0,this.opts=H,this.regex=this.createRegex()}y.modes={EVAL:"eval",ESCAPED:"escaped",RAW:"raw",COMMENT:"comment",LITERAL:"literal"},y.prototype={createRegex:function(){var q=I,g=e.escapeRegExpChars(this.opts.delimiter),x=e.escapeRegExpChars(this.opts.openDelimiter),H=e.escapeRegExpChars(this.opts.closeDelimiter);return q=q.replace(/%/g,g).replace(/</g,x).replace(/>/g,H),new RegExp(q)},compile:function(){var q,g,x=this.opts,H="",T="",N=x.escapeFunction,P,v=x.filename?JSON.stringify(x.filename):"undefined";if(!this.source){if(this.generateSource(),H+=` var __output = "";
|
33
|
+
function __append(s) { if (s !== undefined && s !== null) __output += s }
|
34
|
+
`,x.outputFunctionName){if(!O.test(x.outputFunctionName))throw new Error("outputFunctionName is not a valid JS identifier.");H+=" var "+x.outputFunctionName+` = __append;
|
35
|
+
`}if(x.localsName&&!O.test(x.localsName))throw new Error("localsName is not a valid JS identifier.");if(x.destructuredLocals&&x.destructuredLocals.length){for(var S=" var __locals = ("+x.localsName+` || {}),
|
36
|
+
`,et=0;et<x.destructuredLocals.length;et++){var _t=x.destructuredLocals[et];if(!O.test(_t))throw new Error("destructuredLocals["+et+"] is not a valid JS identifier.");et>0&&(S+=`,
|
37
|
+
`),S+=_t+" = __locals."+_t}H+=S+`;
|
38
|
+
`}x._with!==!1&&(H+=" with ("+x.localsName+` || {}) {
|
39
|
+
`,T+=` }
|
40
|
+
`),T+=` return __output;
|
41
|
+
`,this.source=H+this.source+T}x.compileDebug?q=`var __line = 1
|
42
|
+
, __lines = `+JSON.stringify(this.templateText)+`
|
43
|
+
, __filename = `+v+`;
|
44
|
+
try {
|
45
|
+
`+this.source+`} catch (e) {
|
46
|
+
rethrow(e, __lines, __filename, __line, escapeFn);
|
47
|
+
}
|
48
|
+
`:q=this.source,x.client&&(q="escapeFn = escapeFn || "+N.toString()+`;
|
49
|
+
`+q,x.compileDebug&&(q="rethrow = rethrow || "+M.toString()+`;
|
50
|
+
`+q)),x.strict&&(q=`"use strict";
|
51
|
+
`+q),x.debug&&console.log(q),x.compileDebug&&x.filename&&(q=q+`
|
52
|
+
//# sourceURL=`+v+`
|
53
|
+
`);try{if(x.async)try{P=new Function("return (async function(){}).constructor;")()}catch(zt){throw zt instanceof SyntaxError?new Error("This environment does not support async/await"):zt}else P=Function;g=new P(x.localsName+", escapeFn, include, rethrow",q)}catch(zt){throw zt instanceof SyntaxError&&(x.filename&&(zt.message+=" in "+x.filename),zt.message+=` while compiling ejs
|
54
|
+
|
55
|
+
`,zt.message+=`If the above error is not helpful, you may want to try EJS-Lint:
|
56
|
+
`,zt.message+="https://github.com/RyanZim/EJS-Lint",x.async||(zt.message+=`
|
57
|
+
`,zt.message+="Or, if you meant to create an async function, pass `async: true` as an option.")),zt}var mt=x.client?g:function(Rt){var k=function(Ct,St){var F=e.shallowCopy(e.createNullProtoObjWherePossible(),Rt);return St&&(F=e.shallowCopy(F,St)),E(Ct,x)(F)};return g.apply(x.context,[Rt||e.createNullProtoObjWherePossible(),N,k,M])};if(x.filename&&typeof Object.defineProperty=="function"){var xt=x.filename,Pt=n.basename(xt,n.extname(xt));try{Object.defineProperty(mt,"name",{value:Pt,writable:!1,enumerable:!1,configurable:!0})}catch{}}return mt},generateSource:function(){var q=this.opts;q.rmWhitespace&&(this.templateText=this.templateText.replace(/[\r\n]+/g,`
|
58
|
+
`).replace(/^\s+|\s+$/gm,"")),this.templateText=this.templateText.replace(/[ \t]*<%_/gm,"<%_").replace(/_%>[ \t]*/gm,"_%>");var g=this,x=this.parseTemplateText(),H=this.opts.delimiter,T=this.opts.openDelimiter,N=this.opts.closeDelimiter;x&&x.length&&x.forEach(function(P,v){var S;if(P.indexOf(T+H)===0&&P.indexOf(T+H+H)!==0&&(S=x[v+2],!(S==H+N||S=="-"+H+N||S=="_"+H+N)))throw new Error('Could not find matching close tag for "'+P+'".');g.scanLine(P)})},parseTemplateText:function(){for(var q=this.templateText,g=this.regex,x=g.exec(q),H=[],T;x;)T=x.index,T!==0&&(H.push(q.substring(0,T)),q=q.slice(T)),H.push(x[0]),q=q.slice(x[0].length),x=g.exec(q);return q&&H.push(q),H},_addOutput:function(q){if(this.truncate&&(q=q.replace(/^(?:\r\n|\r|\n)/,""),this.truncate=!1),!q)return q;q=q.replace(/\\/g,"\\\\"),q=q.replace(/\n/g,"\\n"),q=q.replace(/\r/g,"\\r"),q=q.replace(/"/g,'\\"'),this.source+=' ; __append("'+q+`")
|
59
|
+
`},scanLine:function(q){var g=this,x=this.opts.delimiter,H=this.opts.openDelimiter,T=this.opts.closeDelimiter,N=0;switch(N=q.split(`
|
60
|
+
`).length-1,q){case H+x:case H+x+"_":this.mode=y.modes.EVAL;break;case H+x+"=":this.mode=y.modes.ESCAPED;break;case H+x+"-":this.mode=y.modes.RAW;break;case H+x+"#":this.mode=y.modes.COMMENT;break;case H+x+x:this.mode=y.modes.LITERAL,this.source+=' ; __append("'+q.replace(H+x+x,H+x)+`")
|
61
|
+
`;break;case x+x+T:this.mode=y.modes.LITERAL,this.source+=' ; __append("'+q.replace(x+x+T,x+T)+`")
|
62
|
+
`;break;case x+T:case"-"+x+T:case"_"+x+T:this.mode==y.modes.LITERAL&&this._addOutput(q),this.mode=null,this.truncate=q.indexOf("-")===0||q.indexOf("_")===0;break;default:if(this.mode){switch(this.mode){case y.modes.EVAL:case y.modes.ESCAPED:case y.modes.RAW:q.lastIndexOf("//")>q.lastIndexOf(`
|
63
|
+
`)&&(q+=`
|
64
|
+
`)}switch(this.mode){case y.modes.EVAL:this.source+=" ; "+q+`
|
65
|
+
`;break;case y.modes.ESCAPED:this.source+=" ; __append(escapeFn("+h(q)+`))
|
66
|
+
`;break;case y.modes.RAW:this.source+=" ; __append("+h(q)+`)
|
67
|
+
`;break;case y.modes.COMMENT:break;case y.modes.LITERAL:this._addOutput(q);break}}else this._addOutput(q)}g.opts.compileDebug&&N&&(this.currentLine+=N,this.source+=" ; __line = "+this.currentLine+`
|
68
|
+
`)}},t.escapeXML=e.escapeXML,t.__express=t.renderFile,t.VERSION=i,t.name=s,typeof window<"u"&&(window.ejs=t)}(bi)),bi}q3();var Ai={exports:{}};/**
|
69
|
+
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
70
|
+
*
|
71
|
+
* @version 0.8.0
|
72
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
73
|
+
* @copyright Chen, Yi-Cyuan 2015-2018
|
74
|
+
* @license MIT
|
75
|
+
*/var Os;function P3(){return Os||(Os=1,function(t){(function(){var a="input is invalid type",n="finalize already called",e=typeof window=="object",c=e?window:{};c.JS_SHA3_NO_WINDOW&&(e=!1);var i=!e&&typeof self=="object",r=!c.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;r?c=ka:i&&(c=self);var _=!c.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,u=!c.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),s=[31,7936,2031616,520093696],I=[4,1024,262144,67108864],b=[1,256,65536,16777216],f=[6,1536,393216,100663296],w=[0,8,16,24],O=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],D=[224,256,384,512],G=[128,256],V=["hex","buffer","arrayBuffer","array","digest"],it={128:168,256:136};(c.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(k){return Object.prototype.toString.call(k)==="[object Array]"}),u&&(c.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(k){return typeof k=="object"&&k.buffer&&k.buffer.constructor===ArrayBuffer});for(var Z=function(k,Ct,St){return function(F){return new Pt(k,Ct,k).update(F)[St]()}},E=function(k,Ct,St){return function(F,o){return new Pt(k,Ct,o).update(F)[St]()}},M=function(k,Ct,St){return function(F,o,L,U){return N["cshake"+k].update(F,o,L,U)[St]()}},h=function(k,Ct,St){return function(F,o,L,U){return N["kmac"+k].update(F,o,L,U)[St]()}},y=function(k,Ct,St,F){for(var o=0;o<V.length;++o){var L=V[o];k[L]=Ct(St,F,L)}return k},q=function(k,Ct){var St=Z(k,Ct,"hex");return St.create=function(){return new Pt(k,Ct,k)},St.update=function(F){return St.create().update(F)},y(St,Z,k,Ct)},g=function(k,Ct){var St=E(k,Ct,"hex");return St.create=function(F){return new Pt(k,Ct,F)},St.update=function(F,o){return St.create(o).update(F)},y(St,E,k,Ct)},x=function(k,Ct){var St=it[k],F=M(k,Ct,"hex");return F.create=function(o,L,U){return!L&&!U?N["shake"+k].create(o):new Pt(k,Ct,o).bytepad([L,U],St)},F.update=function(o,L,U,p){return F.create(L,U,p).update(o)},y(F,M,k,Ct)},H=function(k,Ct){var St=it[k],F=h(k,Ct,"hex");return F.create=function(o,L,U){return new zt(k,Ct,L).bytepad(["KMAC",U],St).bytepad([o],St)},F.update=function(o,L,U,p){return F.create(o,U,p).update(L)},y(F,h,k,Ct)},T=[{name:"keccak",padding:b,bits:D,createMethod:q},{name:"sha3",padding:f,bits:D,createMethod:q},{name:"shake",padding:s,bits:G,createMethod:g},{name:"cshake",padding:I,bits:G,createMethod:x},{name:"kmac",padding:I,bits:G,createMethod:H}],N={},P=[],v=0;v<T.length;++v)for(var S=T[v],et=S.bits,_t=0;_t<et.length;++_t){var mt=S.name+"_"+et[_t];if(P.push(mt),N[mt]=S.createMethod(et[_t],S.padding),S.name!=="sha3"){var xt=S.name+et[_t];P.push(xt),N[xt]=N[mt]}}function Pt(k,Ct,St){this.blocks=[],this.s=[],this.padding=Ct,this.outputBits=St,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(k<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=St>>5,this.extraBytes=(St&31)>>3;for(var F=0;F<50;++F)this.s[F]=0}Pt.prototype.update=function(k){if(this.finalized)throw new Error(n);var Ct,St=typeof k;if(St!=="string"){if(St==="object"){if(k===null)throw new Error(a);if(u&&k.constructor===ArrayBuffer)k=new Uint8Array(k);else if(!Array.isArray(k)&&(!u||!ArrayBuffer.isView(k)))throw new Error(a)}else throw new Error(a);Ct=!0}for(var F=this.blocks,o=this.byteCount,L=k.length,U=this.blockCount,p=0,st=this.s,qt,wt;p<L;){if(this.reset)for(this.reset=!1,F[0]=this.block,qt=1;qt<U+1;++qt)F[qt]=0;if(Ct)for(qt=this.start;p<L&&qt<o;++p)F[qt>>2]|=k[p]<<w[qt++&3];else for(qt=this.start;p<L&&qt<o;++p)wt=k.charCodeAt(p),wt<128?F[qt>>2]|=wt<<w[qt++&3]:wt<2048?(F[qt>>2]|=(192|wt>>6)<<w[qt++&3],F[qt>>2]|=(128|wt&63)<<w[qt++&3]):wt<55296||wt>=57344?(F[qt>>2]|=(224|wt>>12)<<w[qt++&3],F[qt>>2]|=(128|wt>>6&63)<<w[qt++&3],F[qt>>2]|=(128|wt&63)<<w[qt++&3]):(wt=65536+((wt&1023)<<10|k.charCodeAt(++p)&1023),F[qt>>2]|=(240|wt>>18)<<w[qt++&3],F[qt>>2]|=(128|wt>>12&63)<<w[qt++&3],F[qt>>2]|=(128|wt>>6&63)<<w[qt++&3],F[qt>>2]|=(128|wt&63)<<w[qt++&3]);if(this.lastByteIndex=qt,qt>=o){for(this.start=qt-o,this.block=F[U],qt=0;qt<U;++qt)st[qt]^=F[qt];Rt(st),this.reset=!0}else this.start=qt}return this},Pt.prototype.encode=function(k,Ct){var St=k&255,F=1,o=[St];for(k=k>>8,St=k&255;St>0;)o.unshift(St),k=k>>8,St=k&255,++F;return Ct?o.push(F):o.unshift(F),this.update(o),o.length},Pt.prototype.encodeString=function(k){var Ct,St=typeof k;if(St!=="string"){if(St==="object"){if(k===null)throw new Error(a);if(u&&k.constructor===ArrayBuffer)k=new Uint8Array(k);else if(!Array.isArray(k)&&(!u||!ArrayBuffer.isView(k)))throw new Error(a)}else throw new Error(a);Ct=!0}var F=0,o=k.length;if(Ct)F=o;else for(var L=0;L<k.length;++L){var U=k.charCodeAt(L);U<128?F+=1:U<2048?F+=2:U<55296||U>=57344?F+=3:(U=65536+((U&1023)<<10|k.charCodeAt(++L)&1023),F+=4)}return F+=this.encode(F*8),this.update(k),F},Pt.prototype.bytepad=function(k,Ct){for(var St=this.encode(Ct),F=0;F<k.length;++F)St+=this.encodeString(k[F]);var o=Ct-St%Ct,L=[];return L.length=o,this.update(L),this},Pt.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var k=this.blocks,Ct=this.lastByteIndex,St=this.blockCount,F=this.s;if(k[Ct>>2]|=this.padding[Ct&3],this.lastByteIndex===this.byteCount)for(k[0]=k[St],Ct=1;Ct<St+1;++Ct)k[Ct]=0;for(k[St-1]|=2147483648,Ct=0;Ct<St;++Ct)F[Ct]^=k[Ct];Rt(F)}},Pt.prototype.toString=Pt.prototype.hex=function(){this.finalize();for(var k=this.blockCount,Ct=this.s,St=this.outputBlocks,F=this.extraBytes,o=0,L=0,U="",p;L<St;){for(o=0;o<k&&L<St;++o,++L)p=Ct[o],U+=l[p>>4&15]+l[p&15]+l[p>>12&15]+l[p>>8&15]+l[p>>20&15]+l[p>>16&15]+l[p>>28&15]+l[p>>24&15];L%k===0&&(Rt(Ct),o=0)}return F&&(p=Ct[o],U+=l[p>>4&15]+l[p&15],F>1&&(U+=l[p>>12&15]+l[p>>8&15]),F>2&&(U+=l[p>>20&15]+l[p>>16&15])),U},Pt.prototype.arrayBuffer=function(){this.finalize();var k=this.blockCount,Ct=this.s,St=this.outputBlocks,F=this.extraBytes,o=0,L=0,U=this.outputBits>>3,p;F?p=new ArrayBuffer(St+1<<2):p=new ArrayBuffer(U);for(var st=new Uint32Array(p);L<St;){for(o=0;o<k&&L<St;++o,++L)st[L]=Ct[o];L%k===0&&Rt(Ct)}return F&&(st[o]=Ct[o],p=p.slice(0,U)),p},Pt.prototype.buffer=Pt.prototype.arrayBuffer,Pt.prototype.digest=Pt.prototype.array=function(){this.finalize();for(var k=this.blockCount,Ct=this.s,St=this.outputBlocks,F=this.extraBytes,o=0,L=0,U=[],p,st;L<St;){for(o=0;o<k&&L<St;++o,++L)p=L<<2,st=Ct[o],U[p]=st&255,U[p+1]=st>>8&255,U[p+2]=st>>16&255,U[p+3]=st>>24&255;L%k===0&&Rt(Ct)}return F&&(p=L<<2,st=Ct[o],U[p]=st&255,F>1&&(U[p+1]=st>>8&255),F>2&&(U[p+2]=st>>16&255)),U};function zt(k,Ct,St){Pt.call(this,k,Ct,St)}zt.prototype=new Pt,zt.prototype.finalize=function(){return this.encode(this.outputBits,!0),Pt.prototype.finalize.call(this)};var Rt=function(k){var Ct,St,F,o,L,U,p,st,qt,wt,nt,Q,A,lt,Ft,Ut,dt,B,Lt,Gt,z,$,X,at,gt,ft,Bt,pt,Ot,Ht,on,an,en,rn,cn,fn,Ln,In,Mt,m,C,R,d,j,W,K,J,tt,rt,ct,ht,bt,At,Et,Nt,Tt,$t,Qt,jt,kt,tn,Wt,Jt;for(F=0;F<48;F+=2)o=k[0]^k[10]^k[20]^k[30]^k[40],L=k[1]^k[11]^k[21]^k[31]^k[41],U=k[2]^k[12]^k[22]^k[32]^k[42],p=k[3]^k[13]^k[23]^k[33]^k[43],st=k[4]^k[14]^k[24]^k[34]^k[44],qt=k[5]^k[15]^k[25]^k[35]^k[45],wt=k[6]^k[16]^k[26]^k[36]^k[46],nt=k[7]^k[17]^k[27]^k[37]^k[47],Q=k[8]^k[18]^k[28]^k[38]^k[48],A=k[9]^k[19]^k[29]^k[39]^k[49],Ct=Q^(U<<1|p>>>31),St=A^(p<<1|U>>>31),k[0]^=Ct,k[1]^=St,k[10]^=Ct,k[11]^=St,k[20]^=Ct,k[21]^=St,k[30]^=Ct,k[31]^=St,k[40]^=Ct,k[41]^=St,Ct=o^(st<<1|qt>>>31),St=L^(qt<<1|st>>>31),k[2]^=Ct,k[3]^=St,k[12]^=Ct,k[13]^=St,k[22]^=Ct,k[23]^=St,k[32]^=Ct,k[33]^=St,k[42]^=Ct,k[43]^=St,Ct=U^(wt<<1|nt>>>31),St=p^(nt<<1|wt>>>31),k[4]^=Ct,k[5]^=St,k[14]^=Ct,k[15]^=St,k[24]^=Ct,k[25]^=St,k[34]^=Ct,k[35]^=St,k[44]^=Ct,k[45]^=St,Ct=st^(Q<<1|A>>>31),St=qt^(A<<1|Q>>>31),k[6]^=Ct,k[7]^=St,k[16]^=Ct,k[17]^=St,k[26]^=Ct,k[27]^=St,k[36]^=Ct,k[37]^=St,k[46]^=Ct,k[47]^=St,Ct=wt^(o<<1|L>>>31),St=nt^(L<<1|o>>>31),k[8]^=Ct,k[9]^=St,k[18]^=Ct,k[19]^=St,k[28]^=Ct,k[29]^=St,k[38]^=Ct,k[39]^=St,k[48]^=Ct,k[49]^=St,lt=k[0],Ft=k[1],K=k[11]<<4|k[10]>>>28,J=k[10]<<4|k[11]>>>28,pt=k[20]<<3|k[21]>>>29,Ot=k[21]<<3|k[20]>>>29,kt=k[31]<<9|k[30]>>>23,tn=k[30]<<9|k[31]>>>23,R=k[40]<<18|k[41]>>>14,d=k[41]<<18|k[40]>>>14,rn=k[2]<<1|k[3]>>>31,cn=k[3]<<1|k[2]>>>31,Ut=k[13]<<12|k[12]>>>20,dt=k[12]<<12|k[13]>>>20,tt=k[22]<<10|k[23]>>>22,rt=k[23]<<10|k[22]>>>22,Ht=k[33]<<13|k[32]>>>19,on=k[32]<<13|k[33]>>>19,Wt=k[42]<<2|k[43]>>>30,Jt=k[43]<<2|k[42]>>>30,Et=k[5]<<30|k[4]>>>2,Nt=k[4]<<30|k[5]>>>2,fn=k[14]<<6|k[15]>>>26,Ln=k[15]<<6|k[14]>>>26,B=k[25]<<11|k[24]>>>21,Lt=k[24]<<11|k[25]>>>21,ct=k[34]<<15|k[35]>>>17,ht=k[35]<<15|k[34]>>>17,an=k[45]<<29|k[44]>>>3,en=k[44]<<29|k[45]>>>3,at=k[6]<<28|k[7]>>>4,gt=k[7]<<28|k[6]>>>4,Tt=k[17]<<23|k[16]>>>9,$t=k[16]<<23|k[17]>>>9,In=k[26]<<25|k[27]>>>7,Mt=k[27]<<25|k[26]>>>7,Gt=k[36]<<21|k[37]>>>11,z=k[37]<<21|k[36]>>>11,bt=k[47]<<24|k[46]>>>8,At=k[46]<<24|k[47]>>>8,j=k[8]<<27|k[9]>>>5,W=k[9]<<27|k[8]>>>5,ft=k[18]<<20|k[19]>>>12,Bt=k[19]<<20|k[18]>>>12,Qt=k[29]<<7|k[28]>>>25,jt=k[28]<<7|k[29]>>>25,m=k[38]<<8|k[39]>>>24,C=k[39]<<8|k[38]>>>24,$=k[48]<<14|k[49]>>>18,X=k[49]<<14|k[48]>>>18,k[0]=lt^~Ut&B,k[1]=Ft^~dt&Lt,k[10]=at^~ft&pt,k[11]=gt^~Bt&Ot,k[20]=rn^~fn&In,k[21]=cn^~Ln&Mt,k[30]=j^~K&tt,k[31]=W^~J&rt,k[40]=Et^~Tt&Qt,k[41]=Nt^~$t&jt,k[2]=Ut^~B&Gt,k[3]=dt^~Lt&z,k[12]=ft^~pt&Ht,k[13]=Bt^~Ot&on,k[22]=fn^~In&m,k[23]=Ln^~Mt&C,k[32]=K^~tt&ct,k[33]=J^~rt&ht,k[42]=Tt^~Qt&kt,k[43]=$t^~jt&tn,k[4]=B^~Gt&$,k[5]=Lt^~z&X,k[14]=pt^~Ht&an,k[15]=Ot^~on&en,k[24]=In^~m&R,k[25]=Mt^~C&d,k[34]=tt^~ct&bt,k[35]=rt^~ht&At,k[44]=Qt^~kt&Wt,k[45]=jt^~tn&Jt,k[6]=Gt^~$<,k[7]=z^~X&Ft,k[16]=Ht^~an&at,k[17]=on^~en>,k[26]=m^~R&rn,k[27]=C^~d&cn,k[36]=ct^~bt&j,k[37]=ht^~At&W,k[46]=kt^~Wt&Et,k[47]=tn^~Jt&Nt,k[8]=$^~lt&Ut,k[9]=X^~Ft&dt,k[18]=an^~at&ft,k[19]=en^~gt&Bt,k[28]=R^~rn&fn,k[29]=d^~cn&Ln,k[38]=bt^~j&K,k[39]=At^~W&J,k[48]=Wt^~Et&Tt,k[49]=Jt^~Nt&$t,k[0]^=O[F],k[1]^=O[F+1]};if(_)t.exports=N;else for(v=0;v<P.length;++v)c[P[v]]=N[P[v]]})()}(Ai)),Ai.exports}P3();/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const O3=4,Ms=0,zs=1,M3=2;function Sa(t){let a=t.length;for(;--a>=0;)t[a]=0}const z3=0,Rs=1,R3=2,T3=3,k3=258,mi=29,Ya=256,Xa=Ya+1+mi,qa=30,Ci=19,Ts=2*Xa+1,La=15,Ii=16,U3=7,wi=256,ks=16,Us=17,Ns=18,vi=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Bo=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),N3=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Ds=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),D3=512,Jn=new Array((Xa+2)*2);Sa(Jn);const Wa=new Array(qa*2);Sa(Wa);const Ja=new Array(D3);Sa(Ja);const to=new Array(k3-T3+1);Sa(to);const Bi=new Array(mi);Sa(Bi);const Eo=new Array(qa);Sa(Eo);function Ei(t,a,n,e,c){this.static_tree=t,this.extra_bits=a,this.extra_base=n,this.elems=e,this.max_length=c,this.has_stree=t&&t.length}let Qs,$s,Gs;function Fi(t,a){this.dyn_tree=t,this.max_code=0,this.stat_desc=a}const Zs=t=>t<256?Ja[t]:Ja[256+(t>>>7)],no=(t,a)=>{t.pending_buf[t.pending++]=a&255,t.pending_buf[t.pending++]=a>>>8&255},qn=(t,a,n)=>{t.bi_valid>Ii-n?(t.bi_buf|=a<<t.bi_valid&65535,no(t,t.bi_buf),t.bi_buf=a>>Ii-t.bi_valid,t.bi_valid+=n-Ii):(t.bi_buf|=a<<t.bi_valid&65535,t.bi_valid+=n)},Kn=(t,a,n)=>{qn(t,n[a*2],n[a*2+1])},js=(t,a)=>{let n=0;do n|=t&1,t>>>=1,n<<=1;while(--a>0);return n>>>1},Q3=t=>{t.bi_valid===16?(no(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)},$3=(t,a)=>{const n=a.dyn_tree,e=a.max_code,c=a.stat_desc.static_tree,i=a.stat_desc.has_stree,r=a.stat_desc.extra_bits,_=a.stat_desc.extra_base,u=a.stat_desc.max_length;let l,s,I,b,f,w,O=0;for(b=0;b<=La;b++)t.bl_count[b]=0;for(n[t.heap[t.heap_max]*2+1]=0,l=t.heap_max+1;l<Ts;l++)s=t.heap[l],b=n[n[s*2+1]*2+1]+1,b>u&&(b=u,O++),n[s*2+1]=b,!(s>e)&&(t.bl_count[b]++,f=0,s>=_&&(f=r[s-_]),w=n[s*2],t.opt_len+=w*(b+f),i&&(t.static_len+=w*(c[s*2+1]+f)));if(O!==0){do{for(b=u-1;t.bl_count[b]===0;)b--;t.bl_count[b]--,t.bl_count[b+1]+=2,t.bl_count[u]--,O-=2}while(O>0);for(b=u;b!==0;b--)for(s=t.bl_count[b];s!==0;)I=t.heap[--l],!(I>e)&&(n[I*2+1]!==b&&(t.opt_len+=(b-n[I*2+1])*n[I*2],n[I*2+1]=b),s--)}},Ks=(t,a,n)=>{const e=new Array(La+1);let c=0,i,r;for(i=1;i<=La;i++)c=c+n[i-1]<<1,e[i]=c;for(r=0;r<=a;r++){let _=t[r*2+1];_!==0&&(t[r*2]=js(e[_]++,_))}},G3=()=>{let t,a,n,e,c;const i=new Array(La+1);for(n=0,e=0;e<mi-1;e++)for(Bi[e]=n,t=0;t<1<<vi[e];t++)to[n++]=e;for(to[n-1]=e,c=0,e=0;e<16;e++)for(Eo[e]=c,t=0;t<1<<Bo[e];t++)Ja[c++]=e;for(c>>=7;e<qa;e++)for(Eo[e]=c<<7,t=0;t<1<<Bo[e]-7;t++)Ja[256+c++]=e;for(a=0;a<=La;a++)i[a]=0;for(t=0;t<=143;)Jn[t*2+1]=8,t++,i[8]++;for(;t<=255;)Jn[t*2+1]=9,t++,i[9]++;for(;t<=279;)Jn[t*2+1]=7,t++,i[7]++;for(;t<=287;)Jn[t*2+1]=8,t++,i[8]++;for(Ks(Jn,Xa+1,i),t=0;t<qa;t++)Wa[t*2+1]=5,Wa[t*2]=js(t,5);Qs=new Ei(Jn,vi,Ya+1,Xa,La),$s=new Ei(Wa,Bo,0,qa,La),Gs=new Ei(new Array(0),N3,0,Ci,U3)},Hs=t=>{let a;for(a=0;a<Xa;a++)t.dyn_ltree[a*2]=0;for(a=0;a<qa;a++)t.dyn_dtree[a*2]=0;for(a=0;a<Ci;a++)t.bl_tree[a*2]=0;t.dyn_ltree[wi*2]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},Vs=t=>{t.bi_valid>8?no(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Ys=(t,a,n,e)=>{const c=a*2,i=n*2;return t[c]<t[i]||t[c]===t[i]&&e[a]<=e[n]},xi=(t,a,n)=>{const e=t.heap[n];let c=n<<1;for(;c<=t.heap_len&&(c<t.heap_len&&Ys(a,t.heap[c+1],t.heap[c],t.depth)&&c++,!Ys(a,e,t.heap[c],t.depth));)t.heap[n]=t.heap[c],n=c,c<<=1;t.heap[n]=e},Xs=(t,a,n)=>{let e,c,i=0,r,_;if(t.sym_next!==0)do e=t.pending_buf[t.sym_buf+i++]&255,e+=(t.pending_buf[t.sym_buf+i++]&255)<<8,c=t.pending_buf[t.sym_buf+i++],e===0?Kn(t,c,a):(r=to[c],Kn(t,r+Ya+1,a),_=vi[r],_!==0&&(c-=Bi[r],qn(t,c,_)),e--,r=Zs(e),Kn(t,r,n),_=Bo[r],_!==0&&(e-=Eo[r],qn(t,e,_)));while(i<t.sym_next);Kn(t,wi,a)},Si=(t,a)=>{const n=a.dyn_tree,e=a.stat_desc.static_tree,c=a.stat_desc.has_stree,i=a.stat_desc.elems;let r,_,u=-1,l;for(t.heap_len=0,t.heap_max=Ts,r=0;r<i;r++)n[r*2]!==0?(t.heap[++t.heap_len]=u=r,t.depth[r]=0):n[r*2+1]=0;for(;t.heap_len<2;)l=t.heap[++t.heap_len]=u<2?++u:0,n[l*2]=1,t.depth[l]=0,t.opt_len--,c&&(t.static_len-=e[l*2+1]);for(a.max_code=u,r=t.heap_len>>1;r>=1;r--)xi(t,n,r);l=i;do r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],xi(t,n,1),_=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=_,n[l*2]=n[r*2]+n[_*2],t.depth[l]=(t.depth[r]>=t.depth[_]?t.depth[r]:t.depth[_])+1,n[r*2+1]=n[_*2+1]=l,t.heap[1]=l++,xi(t,n,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],$3(t,a),Ks(n,u,t.bl_count)},Ws=(t,a,n)=>{let e,c=-1,i,r=a[0*2+1],_=0,u=7,l=4;for(r===0&&(u=138,l=3),a[(n+1)*2+1]=65535,e=0;e<=n;e++)i=r,r=a[(e+1)*2+1],!(++_<u&&i===r)&&(_<l?t.bl_tree[i*2]+=_:i!==0?(i!==c&&t.bl_tree[i*2]++,t.bl_tree[ks*2]++):_<=10?t.bl_tree[Us*2]++:t.bl_tree[Ns*2]++,_=0,c=i,r===0?(u=138,l=3):i===r?(u=6,l=3):(u=7,l=4))},Js=(t,a,n)=>{let e,c=-1,i,r=a[0*2+1],_=0,u=7,l=4;for(r===0&&(u=138,l=3),e=0;e<=n;e++)if(i=r,r=a[(e+1)*2+1],!(++_<u&&i===r)){if(_<l)do Kn(t,i,t.bl_tree);while(--_!==0);else i!==0?(i!==c&&(Kn(t,i,t.bl_tree),_--),Kn(t,ks,t.bl_tree),qn(t,_-3,2)):_<=10?(Kn(t,Us,t.bl_tree),qn(t,_-3,3)):(Kn(t,Ns,t.bl_tree),qn(t,_-11,7));_=0,c=i,r===0?(u=138,l=3):i===r?(u=6,l=3):(u=7,l=4)}},Z3=t=>{let a;for(Ws(t,t.dyn_ltree,t.l_desc.max_code),Ws(t,t.dyn_dtree,t.d_desc.max_code),Si(t,t.bl_desc),a=Ci-1;a>=3&&t.bl_tree[Ds[a]*2+1]===0;a--);return t.opt_len+=3*(a+1)+5+5+4,a},j3=(t,a,n,e)=>{let c;for(qn(t,a-257,5),qn(t,n-1,5),qn(t,e-4,4),c=0;c<e;c++)qn(t,t.bl_tree[Ds[c]*2+1],3);Js(t,t.dyn_ltree,a-1),Js(t,t.dyn_dtree,n-1)},K3=t=>{let a=4093624447,n;for(n=0;n<=31;n++,a>>>=1)if(a&1&&t.dyn_ltree[n*2]!==0)return Ms;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return zs;for(n=32;n<Ya;n++)if(t.dyn_ltree[n*2]!==0)return zs;return Ms};let tr=!1;const H3=t=>{tr||(G3(),tr=!0),t.l_desc=new Fi(t.dyn_ltree,Qs),t.d_desc=new Fi(t.dyn_dtree,$s),t.bl_desc=new Fi(t.bl_tree,Gs),t.bi_buf=0,t.bi_valid=0,Hs(t)},nr=(t,a,n,e)=>{qn(t,(z3<<1)+(e?1:0),3),Vs(t),no(t,n),no(t,~n),n&&t.pending_buf.set(t.window.subarray(a,a+n),t.pending),t.pending+=n},V3=t=>{qn(t,Rs<<1,3),Kn(t,wi,Jn),Q3(t)},Y3=(t,a,n,e)=>{let c,i,r=0;t.level>0?(t.strm.data_type===M3&&(t.strm.data_type=K3(t)),Si(t,t.l_desc),Si(t,t.d_desc),r=Z3(t),c=t.opt_len+3+7>>>3,i=t.static_len+3+7>>>3,i<=c&&(c=i)):c=i=n+5,n+4<=c&&a!==-1?nr(t,a,n,e):t.strategy===O3||i===c?(qn(t,(Rs<<1)+(e?1:0),3),Xs(t,Jn,Wa)):(qn(t,(R3<<1)+(e?1:0),3),j3(t,t.l_desc.max_code+1,t.d_desc.max_code+1,r+1),Xs(t,t.dyn_ltree,t.dyn_dtree)),Hs(t),e&&Vs(t)},X3=(t,a,n)=>(t.pending_buf[t.sym_buf+t.sym_next++]=a,t.pending_buf[t.sym_buf+t.sym_next++]=a>>8,t.pending_buf[t.sym_buf+t.sym_next++]=n,a===0?t.dyn_ltree[n*2]++:(t.matches++,a--,t.dyn_ltree[(to[n]+Ya+1)*2]++,t.dyn_dtree[Zs(a)*2]++),t.sym_next===t.sym_end);var W3=H3,J3=nr,tg=Y3,ng=X3,ag=V3,og={_tr_init:W3,_tr_stored_block:J3,_tr_flush_block:tg,_tr_tally:ng,_tr_align:ag},ao=(t,a,n,e)=>{let c=t&65535|0,i=t>>>16&65535|0,r=0;for(;n!==0;){r=n>2e3?2e3:n,n-=r;do c=c+a[e++]|0,i=i+c|0;while(--r);c%=65521,i%=65521}return c|i<<16|0};const eg=()=>{let t,a=[];for(var n=0;n<256;n++){t=n;for(var e=0;e<8;e++)t=t&1?3988292384^t>>>1:t>>>1;a[n]=t}return a},ig=new Uint32Array(eg());var Cn=(t,a,n,e)=>{const c=ig,i=e+n;t^=-1;for(let r=e;r<i;r++)t=t>>>8^c[(t^a[r])&255];return t^-1},pa={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ba={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:cg,_tr_stored_block:qi,_tr_flush_block:lg,_tr_tally:la,_tr_align:sg}=og,{Z_NO_FLUSH:sa,Z_PARTIAL_FLUSH:rg,Z_FULL_FLUSH:dg,Z_FINISH:Un,Z_BLOCK:ar,Z_OK:Bn,Z_STREAM_END:or,Z_STREAM_ERROR:Hn,Z_DATA_ERROR:_g,Z_BUF_ERROR:Pi,Z_DEFAULT_COMPRESSION:ug,Z_FILTERED:gg,Z_HUFFMAN_ONLY:Fo,Z_RLE:fg,Z_FIXED:hg,Z_DEFAULT_STRATEGY:Lg,Z_UNKNOWN:pg,Z_DEFLATED:xo}=ba,bg=9,yg=15,Ag=8,Oi=256+1+29,mg=30,Cg=19,Ig=2*Oi+1,wg=15,sn=3,ra=258,Vn=ra+sn+1,vg=32,Pa=42,Mi=57,zi=69,Ri=73,Ti=91,ki=103,ya=113,oo=666,Fn=1,Oa=2,Aa=3,Ma=4,Bg=3,ma=(t,a)=>(t.msg=pa[a],a),er=t=>t*2-(t>4?9:0),da=t=>{let a=t.length;for(;--a>=0;)t[a]=0},Eg=t=>{let a,n,e,c=t.w_size;a=t.hash_size,e=a;do n=t.head[--e],t.head[e]=n>=c?n-c:0;while(--a);a=c,e=a;do n=t.prev[--e],t.prev[e]=n>=c?n-c:0;while(--a)};let _a=(t,a,n)=>(a<<t.hash_shift^n)&t.hash_mask;const zn=t=>{const a=t.state;let n=a.pending;n>t.avail_out&&(n=t.avail_out),n!==0&&(t.output.set(a.pending_buf.subarray(a.pending_out,a.pending_out+n),t.next_out),t.next_out+=n,a.pending_out+=n,t.total_out+=n,t.avail_out-=n,a.pending-=n,a.pending===0&&(a.pending_out=0))},Rn=(t,a)=>{lg(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,a),t.block_start=t.strstart,zn(t.strm)},dn=(t,a)=>{t.pending_buf[t.pending++]=a},eo=(t,a)=>{t.pending_buf[t.pending++]=a>>>8&255,t.pending_buf[t.pending++]=a&255},Ui=(t,a,n,e)=>{let c=t.avail_in;return c>e&&(c=e),c===0?0:(t.avail_in-=c,a.set(t.input.subarray(t.next_in,t.next_in+c),n),t.state.wrap===1?t.adler=ao(t.adler,a,c,n):t.state.wrap===2&&(t.adler=Cn(t.adler,a,c,n)),t.next_in+=c,t.total_in+=c,c)},ir=(t,a)=>{let n=t.max_chain_length,e=t.strstart,c,i,r=t.prev_length,_=t.nice_match;const u=t.strstart>t.w_size-Vn?t.strstart-(t.w_size-Vn):0,l=t.window,s=t.w_mask,I=t.prev,b=t.strstart+ra;let f=l[e+r-1],w=l[e+r];t.prev_length>=t.good_match&&(n>>=2),_>t.lookahead&&(_=t.lookahead);do if(c=a,!(l[c+r]!==w||l[c+r-1]!==f||l[c]!==l[e]||l[++c]!==l[e+1])){e+=2,c++;do;while(l[++e]===l[++c]&&l[++e]===l[++c]&&l[++e]===l[++c]&&l[++e]===l[++c]&&l[++e]===l[++c]&&l[++e]===l[++c]&&l[++e]===l[++c]&&l[++e]===l[++c]&&e<b);if(i=ra-(b-e),e=b-ra,i>r){if(t.match_start=a,r=i,i>=_)break;f=l[e+r-1],w=l[e+r]}}while((a=I[a&s])>u&&--n!==0);return r<=t.lookahead?r:t.lookahead},za=t=>{const a=t.w_size;let n,e,c;do{if(e=t.window_size-t.lookahead-t.strstart,t.strstart>=a+(a-Vn)&&(t.window.set(t.window.subarray(a,a+a-e),0),t.match_start-=a,t.strstart-=a,t.block_start-=a,t.insert>t.strstart&&(t.insert=t.strstart),Eg(t),e+=a),t.strm.avail_in===0)break;if(n=Ui(t.strm,t.window,t.strstart+t.lookahead,e),t.lookahead+=n,t.lookahead+t.insert>=sn)for(c=t.strstart-t.insert,t.ins_h=t.window[c],t.ins_h=_a(t,t.ins_h,t.window[c+1]);t.insert&&(t.ins_h=_a(t,t.ins_h,t.window[c+sn-1]),t.prev[c&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=c,c++,t.insert--,!(t.lookahead+t.insert<sn)););}while(t.lookahead<Vn&&t.strm.avail_in!==0)},cr=(t,a)=>{let n=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,e,c,i,r=0,_=t.strm.avail_in;do{if(e=65535,i=t.bi_valid+42>>3,t.strm.avail_out<i||(i=t.strm.avail_out-i,c=t.strstart-t.block_start,e>c+t.strm.avail_in&&(e=c+t.strm.avail_in),e>i&&(e=i),e<n&&(e===0&&a!==Un||a===sa||e!==c+t.strm.avail_in)))break;r=a===Un&&e===c+t.strm.avail_in?1:0,qi(t,0,0,r),t.pending_buf[t.pending-4]=e,t.pending_buf[t.pending-3]=e>>8,t.pending_buf[t.pending-2]=~e,t.pending_buf[t.pending-1]=~e>>8,zn(t.strm),c&&(c>e&&(c=e),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+c),t.strm.next_out),t.strm.next_out+=c,t.strm.avail_out-=c,t.strm.total_out+=c,t.block_start+=c,e-=c),e&&(Ui(t.strm,t.strm.output,t.strm.next_out,e),t.strm.next_out+=e,t.strm.avail_out-=e,t.strm.total_out+=e)}while(r===0);return _-=t.strm.avail_in,_&&(_>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=_&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-_,t.strm.next_in),t.strstart),t.strstart+=_,t.insert+=_>t.w_size-t.insert?t.w_size-t.insert:_),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),r?Ma:a!==sa&&a!==Un&&t.strm.avail_in===0&&t.strstart===t.block_start?Oa:(i=t.window_size-t.strstart,t.strm.avail_in>i&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,i+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),i>t.strm.avail_in&&(i=t.strm.avail_in),i&&(Ui(t.strm,t.window,t.strstart,i),t.strstart+=i,t.insert+=i>t.w_size-t.insert?t.w_size-t.insert:i),t.high_water<t.strstart&&(t.high_water=t.strstart),i=t.bi_valid+42>>3,i=t.pending_buf_size-i>65535?65535:t.pending_buf_size-i,n=i>t.w_size?t.w_size:i,c=t.strstart-t.block_start,(c>=n||(c||a===Un)&&a!==sa&&t.strm.avail_in===0&&c<=i)&&(e=c>i?i:c,r=a===Un&&t.strm.avail_in===0&&e===c?1:0,qi(t,t.block_start,e,r),t.block_start+=e,zn(t.strm)),r?Aa:Fn)},Ni=(t,a)=>{let n,e;for(;;){if(t.lookahead<Vn){if(za(t),t.lookahead<Vn&&a===sa)return Fn;if(t.lookahead===0)break}if(n=0,t.lookahead>=sn&&(t.ins_h=_a(t,t.ins_h,t.window[t.strstart+sn-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),n!==0&&t.strstart-n<=t.w_size-Vn&&(t.match_length=ir(t,n)),t.match_length>=sn)if(e=la(t,t.strstart-t.match_start,t.match_length-sn),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=sn){t.match_length--;do t.strstart++,t.ins_h=_a(t,t.ins_h,t.window[t.strstart+sn-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(--t.match_length!==0);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=_a(t,t.ins_h,t.window[t.strstart+1]);else e=la(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(e&&(Rn(t,!1),t.strm.avail_out===0))return Fn}return t.insert=t.strstart<sn-1?t.strstart:sn-1,a===Un?(Rn(t,!0),t.strm.avail_out===0?Aa:Ma):t.sym_next&&(Rn(t,!1),t.strm.avail_out===0)?Fn:Oa},Ra=(t,a)=>{let n,e,c;for(;;){if(t.lookahead<Vn){if(za(t),t.lookahead<Vn&&a===sa)return Fn;if(t.lookahead===0)break}if(n=0,t.lookahead>=sn&&(t.ins_h=_a(t,t.ins_h,t.window[t.strstart+sn-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=sn-1,n!==0&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-Vn&&(t.match_length=ir(t,n),t.match_length<=5&&(t.strategy===gg||t.match_length===sn&&t.strstart-t.match_start>4096)&&(t.match_length=sn-1)),t.prev_length>=sn&&t.match_length<=t.prev_length){c=t.strstart+t.lookahead-sn,e=la(t,t.strstart-1-t.prev_match,t.prev_length-sn),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=c&&(t.ins_h=_a(t,t.ins_h,t.window[t.strstart+sn-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(--t.prev_length!==0);if(t.match_available=0,t.match_length=sn-1,t.strstart++,e&&(Rn(t,!1),t.strm.avail_out===0))return Fn}else if(t.match_available){if(e=la(t,0,t.window[t.strstart-1]),e&&Rn(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return Fn}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(e=la(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<sn-1?t.strstart:sn-1,a===Un?(Rn(t,!0),t.strm.avail_out===0?Aa:Ma):t.sym_next&&(Rn(t,!1),t.strm.avail_out===0)?Fn:Oa},Fg=(t,a)=>{let n,e,c,i;const r=t.window;for(;;){if(t.lookahead<=ra){if(za(t),t.lookahead<=ra&&a===sa)return Fn;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=sn&&t.strstart>0&&(c=t.strstart-1,e=r[c],e===r[++c]&&e===r[++c]&&e===r[++c])){i=t.strstart+ra;do;while(e===r[++c]&&e===r[++c]&&e===r[++c]&&e===r[++c]&&e===r[++c]&&e===r[++c]&&e===r[++c]&&e===r[++c]&&c<i);t.match_length=ra-(i-c),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=sn?(n=la(t,1,t.match_length-sn),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=la(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(Rn(t,!1),t.strm.avail_out===0))return Fn}return t.insert=0,a===Un?(Rn(t,!0),t.strm.avail_out===0?Aa:Ma):t.sym_next&&(Rn(t,!1),t.strm.avail_out===0)?Fn:Oa},xg=(t,a)=>{let n;for(;;){if(t.lookahead===0&&(za(t),t.lookahead===0)){if(a===sa)return Fn;break}if(t.match_length=0,n=la(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(Rn(t,!1),t.strm.avail_out===0))return Fn}return t.insert=0,a===Un?(Rn(t,!0),t.strm.avail_out===0?Aa:Ma):t.sym_next&&(Rn(t,!1),t.strm.avail_out===0)?Fn:Oa};function Yn(t,a,n,e,c){this.good_length=t,this.max_lazy=a,this.nice_length=n,this.max_chain=e,this.func=c}const io=[new Yn(0,0,0,0,cr),new Yn(4,4,8,4,Ni),new Yn(4,5,16,8,Ni),new Yn(4,6,32,32,Ni),new Yn(4,4,16,16,Ra),new Yn(8,16,32,32,Ra),new Yn(8,16,128,128,Ra),new Yn(8,32,128,256,Ra),new Yn(32,128,258,1024,Ra),new Yn(32,258,258,4096,Ra)],Sg=t=>{t.window_size=2*t.w_size,da(t.head),t.max_lazy_match=io[t.level].max_lazy,t.good_match=io[t.level].good_length,t.nice_match=io[t.level].nice_length,t.max_chain_length=io[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=sn-1,t.match_available=0,t.ins_h=0};function qg(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=xo,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Ig*2),this.dyn_dtree=new Uint16Array((2*mg+1)*2),this.bl_tree=new Uint16Array((2*Cg+1)*2),da(this.dyn_ltree),da(this.dyn_dtree),da(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(wg+1),this.heap=new Uint16Array(2*Oi+1),da(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Oi+1),da(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const co=t=>{if(!t)return 1;const a=t.state;return!a||a.strm!==t||a.status!==Pa&&a.status!==Mi&&a.status!==zi&&a.status!==Ri&&a.status!==Ti&&a.status!==ki&&a.status!==ya&&a.status!==oo?1:0},lr=t=>{if(co(t))return ma(t,Hn);t.total_in=t.total_out=0,t.data_type=pg;const a=t.state;return a.pending=0,a.pending_out=0,a.wrap<0&&(a.wrap=-a.wrap),a.status=a.wrap===2?Mi:a.wrap?Pa:ya,t.adler=a.wrap===2?0:1,a.last_flush=-2,cg(a),Bn},sr=t=>{const a=lr(t);return a===Bn&&Sg(t.state),a},Pg=(t,a)=>co(t)||t.state.wrap!==2?Hn:(t.state.gzhead=a,Bn),rr=(t,a,n,e,c,i)=>{if(!t)return Hn;let r=1;if(a===ug&&(a=6),e<0?(r=0,e=-e):e>15&&(r=2,e-=16),c<1||c>bg||n!==xo||e<8||e>15||a<0||a>9||i<0||i>hg||e===8&&r!==1)return ma(t,Hn);e===8&&(e=9);const _=new qg;return t.state=_,_.strm=t,_.status=Pa,_.wrap=r,_.gzhead=null,_.w_bits=e,_.w_size=1<<_.w_bits,_.w_mask=_.w_size-1,_.hash_bits=c+7,_.hash_size=1<<_.hash_bits,_.hash_mask=_.hash_size-1,_.hash_shift=~~((_.hash_bits+sn-1)/sn),_.window=new Uint8Array(_.w_size*2),_.head=new Uint16Array(_.hash_size),_.prev=new Uint16Array(_.w_size),_.lit_bufsize=1<<c+6,_.pending_buf_size=_.lit_bufsize*4,_.pending_buf=new Uint8Array(_.pending_buf_size),_.sym_buf=_.lit_bufsize,_.sym_end=(_.lit_bufsize-1)*3,_.level=a,_.strategy=i,_.method=n,sr(t)},Og=(t,a)=>rr(t,a,xo,yg,Ag,Lg),Mg=(t,a)=>{if(co(t)||a>ar||a<0)return t?ma(t,Hn):Hn;const n=t.state;if(!t.output||t.avail_in!==0&&!t.input||n.status===oo&&a!==Un)return ma(t,t.avail_out===0?Pi:Hn);const e=n.last_flush;if(n.last_flush=a,n.pending!==0){if(zn(t),t.avail_out===0)return n.last_flush=-1,Bn}else if(t.avail_in===0&&er(a)<=er(e)&&a!==Un)return ma(t,Pi);if(n.status===oo&&t.avail_in!==0)return ma(t,Pi);if(n.status===Pa&&n.wrap===0&&(n.status=ya),n.status===Pa){let c=xo+(n.w_bits-8<<4)<<8,i=-1;if(n.strategy>=Fo||n.level<2?i=0:n.level<6?i=1:n.level===6?i=2:i=3,c|=i<<6,n.strstart!==0&&(c|=vg),c+=31-c%31,eo(n,c),n.strstart!==0&&(eo(n,t.adler>>>16),eo(n,t.adler&65535)),t.adler=1,n.status=ya,zn(t),n.pending!==0)return n.last_flush=-1,Bn}if(n.status===Mi){if(t.adler=0,dn(n,31),dn(n,139),dn(n,8),n.gzhead)dn(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),dn(n,n.gzhead.time&255),dn(n,n.gzhead.time>>8&255),dn(n,n.gzhead.time>>16&255),dn(n,n.gzhead.time>>24&255),dn(n,n.level===9?2:n.strategy>=Fo||n.level<2?4:0),dn(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(dn(n,n.gzhead.extra.length&255),dn(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=Cn(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=zi;else if(dn(n,0),dn(n,0),dn(n,0),dn(n,0),dn(n,0),dn(n,n.level===9?2:n.strategy>=Fo||n.level<2?4:0),dn(n,Bg),n.status=ya,zn(t),n.pending!==0)return n.last_flush=-1,Bn}if(n.status===zi){if(n.gzhead.extra){let c=n.pending,i=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+i>n.pending_buf_size;){let _=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+_),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>c&&(t.adler=Cn(t.adler,n.pending_buf,n.pending-c,c)),n.gzindex+=_,zn(t),n.pending!==0)return n.last_flush=-1,Bn;c=0,i-=_}let r=new Uint8Array(n.gzhead.extra);n.pending_buf.set(r.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending+=i,n.gzhead.hcrc&&n.pending>c&&(t.adler=Cn(t.adler,n.pending_buf,n.pending-c,c)),n.gzindex=0}n.status=Ri}if(n.status===Ri){if(n.gzhead.name){let c=n.pending,i;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>c&&(t.adler=Cn(t.adler,n.pending_buf,n.pending-c,c)),zn(t),n.pending!==0)return n.last_flush=-1,Bn;c=0}n.gzindex<n.gzhead.name.length?i=n.gzhead.name.charCodeAt(n.gzindex++)&255:i=0,dn(n,i)}while(i!==0);n.gzhead.hcrc&&n.pending>c&&(t.adler=Cn(t.adler,n.pending_buf,n.pending-c,c)),n.gzindex=0}n.status=Ti}if(n.status===Ti){if(n.gzhead.comment){let c=n.pending,i;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>c&&(t.adler=Cn(t.adler,n.pending_buf,n.pending-c,c)),zn(t),n.pending!==0)return n.last_flush=-1,Bn;c=0}n.gzindex<n.gzhead.comment.length?i=n.gzhead.comment.charCodeAt(n.gzindex++)&255:i=0,dn(n,i)}while(i!==0);n.gzhead.hcrc&&n.pending>c&&(t.adler=Cn(t.adler,n.pending_buf,n.pending-c,c))}n.status=ki}if(n.status===ki){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(zn(t),n.pending!==0))return n.last_flush=-1,Bn;dn(n,t.adler&255),dn(n,t.adler>>8&255),t.adler=0}if(n.status=ya,zn(t),n.pending!==0)return n.last_flush=-1,Bn}if(t.avail_in!==0||n.lookahead!==0||a!==sa&&n.status!==oo){let c=n.level===0?cr(n,a):n.strategy===Fo?xg(n,a):n.strategy===fg?Fg(n,a):io[n.level].func(n,a);if((c===Aa||c===Ma)&&(n.status=oo),c===Fn||c===Aa)return t.avail_out===0&&(n.last_flush=-1),Bn;if(c===Oa&&(a===rg?sg(n):a!==ar&&(qi(n,0,0,!1),a===dg&&(da(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),zn(t),t.avail_out===0))return n.last_flush=-1,Bn}return a!==Un?Bn:n.wrap<=0?or:(n.wrap===2?(dn(n,t.adler&255),dn(n,t.adler>>8&255),dn(n,t.adler>>16&255),dn(n,t.adler>>24&255),dn(n,t.total_in&255),dn(n,t.total_in>>8&255),dn(n,t.total_in>>16&255),dn(n,t.total_in>>24&255)):(eo(n,t.adler>>>16),eo(n,t.adler&65535)),zn(t),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Bn:or)},zg=t=>{if(co(t))return Hn;const a=t.state.status;return t.state=null,a===ya?ma(t,_g):Bn},Rg=(t,a)=>{let n=a.length;if(co(t))return Hn;const e=t.state,c=e.wrap;if(c===2||c===1&&e.status!==Pa||e.lookahead)return Hn;if(c===1&&(t.adler=ao(t.adler,a,n,0)),e.wrap=0,n>=e.w_size){c===0&&(da(e.head),e.strstart=0,e.block_start=0,e.insert=0);let u=new Uint8Array(e.w_size);u.set(a.subarray(n-e.w_size,n),0),a=u,n=e.w_size}const i=t.avail_in,r=t.next_in,_=t.input;for(t.avail_in=n,t.next_in=0,t.input=a,za(e);e.lookahead>=sn;){let u=e.strstart,l=e.lookahead-(sn-1);do e.ins_h=_a(e,e.ins_h,e.window[u+sn-1]),e.prev[u&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=u,u++;while(--l);e.strstart=u,e.lookahead=sn-1,za(e)}return e.strstart+=e.lookahead,e.block_start=e.strstart,e.insert=e.lookahead,e.lookahead=0,e.match_length=e.prev_length=sn-1,e.match_available=0,t.next_in=r,t.input=_,t.avail_in=i,e.wrap=c,Bn};var Tg=Og,kg=rr,Ug=sr,Ng=lr,Dg=Pg,Qg=Mg,$g=zg,Gg=Rg,Zg="pako deflate (from Nodeca project)",lo={deflateInit:Tg,deflateInit2:kg,deflateReset:Ug,deflateResetKeep:Ng,deflateSetHeader:Dg,deflate:Qg,deflateEnd:$g,deflateSetDictionary:Gg,deflateInfo:Zg};const jg=(t,a)=>Object.prototype.hasOwnProperty.call(t,a);var Kg=function(t){const a=Array.prototype.slice.call(arguments,1);for(;a.length;){const n=a.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const e in n)jg(n,e)&&(t[e]=n[e])}}return t},Hg=t=>{let a=0;for(let e=0,c=t.length;e<c;e++)a+=t[e].length;const n=new Uint8Array(a);for(let e=0,c=0,i=t.length;e<i;e++){let r=t[e];n.set(r,c),c+=r.length}return n},So={assign:Kg,flattenChunks:Hg};let dr=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{dr=!1}const so=new Uint8Array(256);for(let t=0;t<256;t++)so[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;so[254]=so[254]=1;var Vg=t=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);let a,n,e,c,i,r=t.length,_=0;for(c=0;c<r;c++)n=t.charCodeAt(c),(n&64512)===55296&&c+1<r&&(e=t.charCodeAt(c+1),(e&64512)===56320&&(n=65536+(n-55296<<10)+(e-56320),c++)),_+=n<128?1:n<2048?2:n<65536?3:4;for(a=new Uint8Array(_),i=0,c=0;i<_;c++)n=t.charCodeAt(c),(n&64512)===55296&&c+1<r&&(e=t.charCodeAt(c+1),(e&64512)===56320&&(n=65536+(n-55296<<10)+(e-56320),c++)),n<128?a[i++]=n:n<2048?(a[i++]=192|n>>>6,a[i++]=128|n&63):n<65536?(a[i++]=224|n>>>12,a[i++]=128|n>>>6&63,a[i++]=128|n&63):(a[i++]=240|n>>>18,a[i++]=128|n>>>12&63,a[i++]=128|n>>>6&63,a[i++]=128|n&63);return a};const Yg=(t,a)=>{if(a<65534&&t.subarray&&dr)return String.fromCharCode.apply(null,t.length===a?t:t.subarray(0,a));let n="";for(let e=0;e<a;e++)n+=String.fromCharCode(t[e]);return n};var Xg=(t,a)=>{const n=a||t.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,a));let e,c;const i=new Array(n*2);for(c=0,e=0;e<n;){let r=t[e++];if(r<128){i[c++]=r;continue}let _=so[r];if(_>4){i[c++]=65533,e+=_-1;continue}for(r&=_===2?31:_===3?15:7;_>1&&e<n;)r=r<<6|t[e++]&63,_--;if(_>1){i[c++]=65533;continue}r<65536?i[c++]=r:(r-=65536,i[c++]=55296|r>>10&1023,i[c++]=56320|r&1023)}return Yg(i,c)},Wg=(t,a)=>{a=a||t.length,a>t.length&&(a=t.length);let n=a-1;for(;n>=0&&(t[n]&192)===128;)n--;return n<0||n===0?a:n+so[t[n]]>a?n:a},ro={string2buf:Vg,buf2string:Xg,utf8border:Wg};function Jg(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var _r=Jg;const ur=Object.prototype.toString,{Z_NO_FLUSH:tf,Z_SYNC_FLUSH:nf,Z_FULL_FLUSH:af,Z_FINISH:of,Z_OK:qo,Z_STREAM_END:ef,Z_DEFAULT_COMPRESSION:cf,Z_DEFAULT_STRATEGY:lf,Z_DEFLATED:sf}=ba;function _o(t){this.options=So.assign({level:cf,method:sf,chunkSize:16384,windowBits:15,memLevel:8,strategy:lf},t||{});let a=this.options;a.raw&&a.windowBits>0?a.windowBits=-a.windowBits:a.gzip&&a.windowBits>0&&a.windowBits<16&&(a.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new _r,this.strm.avail_out=0;let n=lo.deflateInit2(this.strm,a.level,a.method,a.windowBits,a.memLevel,a.strategy);if(n!==qo)throw new Error(pa[n]);if(a.header&&lo.deflateSetHeader(this.strm,a.header),a.dictionary){let e;if(typeof a.dictionary=="string"?e=ro.string2buf(a.dictionary):ur.call(a.dictionary)==="[object ArrayBuffer]"?e=new Uint8Array(a.dictionary):e=a.dictionary,n=lo.deflateSetDictionary(this.strm,e),n!==qo)throw new Error(pa[n]);this._dict_set=!0}}_o.prototype.push=function(t,a){const n=this.strm,e=this.options.chunkSize;let c,i;if(this.ended)return!1;for(a===~~a?i=a:i=a===!0?of:tf,typeof t=="string"?n.input=ro.string2buf(t):ur.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(e),n.next_out=0,n.avail_out=e),(i===nf||i===af)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(c=lo.deflate(n,i),c===ef)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),c=lo.deflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===qo;if(n.avail_out===0){this.onData(n.output);continue}if(i>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0},_o.prototype.onData=function(t){this.chunks.push(t)},_o.prototype.onEnd=function(t){t===qo&&(this.result=So.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Di(t,a){const n=new _o(a);if(n.push(t,!0),n.err)throw n.msg||pa[n.err];return n.result}function rf(t,a){return a=a||{},a.raw=!0,Di(t,a)}function df(t,a){return a=a||{},a.gzip=!0,Di(t,a)}var _f=_o,uf=Di,gf=rf,ff=df,hf=ba,Lf={Deflate:_f,deflate:uf,deflateRaw:gf,gzip:ff,constants:hf};const Po=16209,pf=16191;var bf=function(a,n){let e,c,i,r,_,u,l,s,I,b,f,w,O,D,G,V,it,Z,E,M,h,y,q,g;const x=a.state;e=a.next_in,q=a.input,c=e+(a.avail_in-5),i=a.next_out,g=a.output,r=i-(n-a.avail_out),_=i+(a.avail_out-257),u=x.dmax,l=x.wsize,s=x.whave,I=x.wnext,b=x.window,f=x.hold,w=x.bits,O=x.lencode,D=x.distcode,G=(1<<x.lenbits)-1,V=(1<<x.distbits)-1;t:do{w<15&&(f+=q[e++]<<w,w+=8,f+=q[e++]<<w,w+=8),it=O[f&G];n:for(;;){if(Z=it>>>24,f>>>=Z,w-=Z,Z=it>>>16&255,Z===0)g[i++]=it&65535;else if(Z&16){E=it&65535,Z&=15,Z&&(w<Z&&(f+=q[e++]<<w,w+=8),E+=f&(1<<Z)-1,f>>>=Z,w-=Z),w<15&&(f+=q[e++]<<w,w+=8,f+=q[e++]<<w,w+=8),it=D[f&V];a:for(;;){if(Z=it>>>24,f>>>=Z,w-=Z,Z=it>>>16&255,Z&16){if(M=it&65535,Z&=15,w<Z&&(f+=q[e++]<<w,w+=8,w<Z&&(f+=q[e++]<<w,w+=8)),M+=f&(1<<Z)-1,M>u){a.msg="invalid distance too far back",x.mode=Po;break t}if(f>>>=Z,w-=Z,Z=i-r,M>Z){if(Z=M-Z,Z>s&&x.sane){a.msg="invalid distance too far back",x.mode=Po;break t}if(h=0,y=b,I===0){if(h+=l-Z,Z<E){E-=Z;do g[i++]=b[h++];while(--Z);h=i-M,y=g}}else if(I<Z){if(h+=l+I-Z,Z-=I,Z<E){E-=Z;do g[i++]=b[h++];while(--Z);if(h=0,I<E){Z=I,E-=Z;do g[i++]=b[h++];while(--Z);h=i-M,y=g}}}else if(h+=I-Z,Z<E){E-=Z;do g[i++]=b[h++];while(--Z);h=i-M,y=g}for(;E>2;)g[i++]=y[h++],g[i++]=y[h++],g[i++]=y[h++],E-=3;E&&(g[i++]=y[h++],E>1&&(g[i++]=y[h++]))}else{h=i-M;do g[i++]=g[h++],g[i++]=g[h++],g[i++]=g[h++],E-=3;while(E>2);E&&(g[i++]=g[h++],E>1&&(g[i++]=g[h++]))}}else if(Z&64){a.msg="invalid distance code",x.mode=Po;break t}else{it=D[(it&65535)+(f&(1<<Z)-1)];continue a}break}}else if(Z&64)if(Z&32){x.mode=pf;break t}else{a.msg="invalid literal/length code",x.mode=Po;break t}else{it=O[(it&65535)+(f&(1<<Z)-1)];continue n}break}}while(e<c&&i<_);E=w>>3,e-=E,w-=E<<3,f&=(1<<w)-1,a.next_in=e,a.next_out=i,a.avail_in=e<c?5+(c-e):5-(e-c),a.avail_out=i<_?257+(_-i):257-(i-_),x.hold=f,x.bits=w};const Ta=15,gr=852,fr=592,hr=0,Qi=1,Lr=2,yf=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Af=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),mf=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Cf=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var uo=(t,a,n,e,c,i,r,_)=>{const u=_.bits;let l=0,s=0,I=0,b=0,f=0,w=0,O=0,D=0,G=0,V=0,it,Z,E,M,h,y=null,q;const g=new Uint16Array(Ta+1),x=new Uint16Array(Ta+1);let H=null,T,N,P;for(l=0;l<=Ta;l++)g[l]=0;for(s=0;s<e;s++)g[a[n+s]]++;for(f=u,b=Ta;b>=1&&g[b]===0;b--);if(f>b&&(f=b),b===0)return c[i++]=1<<24|64<<16|0,c[i++]=1<<24|64<<16|0,_.bits=1,0;for(I=1;I<b&&g[I]===0;I++);for(f<I&&(f=I),D=1,l=1;l<=Ta;l++)if(D<<=1,D-=g[l],D<0)return-1;if(D>0&&(t===hr||b!==1))return-1;for(x[1]=0,l=1;l<Ta;l++)x[l+1]=x[l]+g[l];for(s=0;s<e;s++)a[n+s]!==0&&(r[x[a[n+s]]++]=s);if(t===hr?(y=H=r,q=20):t===Qi?(y=yf,H=Af,q=257):(y=mf,H=Cf,q=0),V=0,s=0,l=I,h=i,w=f,O=0,E=-1,G=1<<f,M=G-1,t===Qi&&G>gr||t===Lr&&G>fr)return 1;for(;;){T=l-O,r[s]+1<q?(N=0,P=r[s]):r[s]>=q?(N=H[r[s]-q],P=y[r[s]-q]):(N=96,P=0),it=1<<l-O,Z=1<<w,I=Z;do Z-=it,c[h+(V>>O)+Z]=T<<24|N<<16|P|0;while(Z!==0);for(it=1<<l-1;V⁢)it>>=1;if(it!==0?(V&=it-1,V+=it):V=0,s++,--g[l]===0){if(l===b)break;l=a[n+r[s]]}if(l>f&&(V&M)!==E){for(O===0&&(O=f),h+=I,w=l-O,D=1<<w;w+O<b&&(D-=g[w+O],!(D<=0));)w++,D<<=1;if(G+=1<<w,t===Qi&&G>gr||t===Lr&&G>fr)return 1;E=V&M,c[E]=f<<24|w<<16|h-i|0}}return V!==0&&(c[h+V]=l-O<<24|64<<16|0),_.bits=f,0};const If=0,pr=1,br=2,{Z_FINISH:yr,Z_BLOCK:wf,Z_TREES:Oo,Z_OK:Ca,Z_STREAM_END:vf,Z_NEED_DICT:Bf,Z_STREAM_ERROR:Nn,Z_DATA_ERROR:Ar,Z_MEM_ERROR:mr,Z_BUF_ERROR:Ef,Z_DEFLATED:Cr}=ba,Mo=16180,Ir=16181,wr=16182,vr=16183,Br=16184,Er=16185,Fr=16186,xr=16187,Sr=16188,qr=16189,zo=16190,ta=16191,$i=16192,Pr=16193,Gi=16194,Or=16195,Mr=16196,zr=16197,Rr=16198,Ro=16199,To=16200,Tr=16201,kr=16202,Ur=16203,Nr=16204,Dr=16205,Zi=16206,Qr=16207,$r=16208,hn=16209,Gr=16210,Zr=16211,Ff=852,xf=592,Sf=15,jr=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function qf(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Ia=t=>{if(!t)return 1;const a=t.state;return!a||a.strm!==t||a.mode<Mo||a.mode>Zr?1:0},Kr=t=>{if(Ia(t))return Nn;const a=t.state;return t.total_in=t.total_out=a.total=0,t.msg="",a.wrap&&(t.adler=a.wrap&1),a.mode=Mo,a.last=0,a.havedict=0,a.flags=-1,a.dmax=32768,a.head=null,a.hold=0,a.bits=0,a.lencode=a.lendyn=new Int32Array(Ff),a.distcode=a.distdyn=new Int32Array(xf),a.sane=1,a.back=-1,Ca},Hr=t=>{if(Ia(t))return Nn;const a=t.state;return a.wsize=0,a.whave=0,a.wnext=0,Kr(t)},Vr=(t,a)=>{let n;if(Ia(t))return Nn;const e=t.state;return a<0?(n=0,a=-a):(n=(a>>4)+5,a<48&&(a&=15)),a&&(a<8||a>15)?Nn:(e.window!==null&&e.wbits!==a&&(e.window=null),e.wrap=n,e.wbits=a,Hr(t))},Yr=(t,a)=>{if(!t)return Nn;const n=new qf;t.state=n,n.strm=t,n.window=null,n.mode=Mo;const e=Vr(t,a);return e!==Ca&&(t.state=null),e},Pf=t=>Yr(t,Sf);let Xr=!0,ji,Ki;const Of=t=>{if(Xr){ji=new Int32Array(512),Ki=new Int32Array(32);let a=0;for(;a<144;)t.lens[a++]=8;for(;a<256;)t.lens[a++]=9;for(;a<280;)t.lens[a++]=7;for(;a<288;)t.lens[a++]=8;for(uo(pr,t.lens,0,288,ji,0,t.work,{bits:9}),a=0;a<32;)t.lens[a++]=5;uo(br,t.lens,0,32,Ki,0,t.work,{bits:5}),Xr=!1}t.lencode=ji,t.lenbits=9,t.distcode=Ki,t.distbits=5},Wr=(t,a,n,e)=>{let c;const i=t.state;return i.window===null&&(i.wsize=1<<i.wbits,i.wnext=0,i.whave=0,i.window=new Uint8Array(i.wsize)),e>=i.wsize?(i.window.set(a.subarray(n-i.wsize,n),0),i.wnext=0,i.whave=i.wsize):(c=i.wsize-i.wnext,c>e&&(c=e),i.window.set(a.subarray(n-e,n-e+c),i.wnext),e-=c,e?(i.window.set(a.subarray(n-e,n),0),i.wnext=e,i.whave=i.wsize):(i.wnext+=c,i.wnext===i.wsize&&(i.wnext=0),i.whave<i.wsize&&(i.whave+=c))),0},Mf=(t,a)=>{let n,e,c,i,r,_,u,l,s,I,b,f,w,O,D=0,G,V,it,Z,E,M,h,y;const q=new Uint8Array(4);let g,x;const H=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ia(t)||!t.output||!t.input&&t.avail_in!==0)return Nn;n=t.state,n.mode===ta&&(n.mode=$i),r=t.next_out,c=t.output,u=t.avail_out,i=t.next_in,e=t.input,_=t.avail_in,l=n.hold,s=n.bits,I=_,b=u,y=Ca;t:for(;;)switch(n.mode){case Mo:if(n.wrap===0){n.mode=$i;break}for(;s<16;){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}if(n.wrap&2&&l===35615){n.wbits===0&&(n.wbits=15),n.check=0,q[0]=l&255,q[1]=l>>>8&255,n.check=Cn(n.check,q,2,0),l=0,s=0,n.mode=Ir;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((l&255)<<8)+(l>>8))%31){t.msg="incorrect header check",n.mode=hn;break}if((l&15)!==Cr){t.msg="unknown compression method",n.mode=hn;break}if(l>>>=4,s-=4,h=(l&15)+8,n.wbits===0&&(n.wbits=h),h>15||h>n.wbits){t.msg="invalid window size",n.mode=hn;break}n.dmax=1<<n.wbits,n.flags=0,t.adler=n.check=1,n.mode=l&512?qr:ta,l=0,s=0;break;case Ir:for(;s<16;){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}if(n.flags=l,(n.flags&255)!==Cr){t.msg="unknown compression method",n.mode=hn;break}if(n.flags&57344){t.msg="unknown header flags set",n.mode=hn;break}n.head&&(n.head.text=l>>8&1),n.flags&512&&n.wrap&4&&(q[0]=l&255,q[1]=l>>>8&255,n.check=Cn(n.check,q,2,0)),l=0,s=0,n.mode=wr;case wr:for(;s<32;){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}n.head&&(n.head.time=l),n.flags&512&&n.wrap&4&&(q[0]=l&255,q[1]=l>>>8&255,q[2]=l>>>16&255,q[3]=l>>>24&255,n.check=Cn(n.check,q,4,0)),l=0,s=0,n.mode=vr;case vr:for(;s<16;){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}n.head&&(n.head.xflags=l&255,n.head.os=l>>8),n.flags&512&&n.wrap&4&&(q[0]=l&255,q[1]=l>>>8&255,n.check=Cn(n.check,q,2,0)),l=0,s=0,n.mode=Br;case Br:if(n.flags&1024){for(;s<16;){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}n.length=l,n.head&&(n.head.extra_len=l),n.flags&512&&n.wrap&4&&(q[0]=l&255,q[1]=l>>>8&255,n.check=Cn(n.check,q,2,0)),l=0,s=0}else n.head&&(n.head.extra=null);n.mode=Er;case Er:if(n.flags&1024&&(f=n.length,f>_&&(f=_),f&&(n.head&&(h=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(e.subarray(i,i+f),h)),n.flags&512&&n.wrap&4&&(n.check=Cn(n.check,e,f,i)),_-=f,i+=f,n.length-=f),n.length))break t;n.length=0,n.mode=Fr;case Fr:if(n.flags&2048){if(_===0)break t;f=0;do h=e[i+f++],n.head&&h&&n.length<65536&&(n.head.name+=String.fromCharCode(h));while(h&&f<_);if(n.flags&512&&n.wrap&4&&(n.check=Cn(n.check,e,f,i)),_-=f,i+=f,h)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=xr;case xr:if(n.flags&4096){if(_===0)break t;f=0;do h=e[i+f++],n.head&&h&&n.length<65536&&(n.head.comment+=String.fromCharCode(h));while(h&&f<_);if(n.flags&512&&n.wrap&4&&(n.check=Cn(n.check,e,f,i)),_-=f,i+=f,h)break t}else n.head&&(n.head.comment=null);n.mode=Sr;case Sr:if(n.flags&512){for(;s<16;){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}if(n.wrap&4&&l!==(n.check&65535)){t.msg="header crc mismatch",n.mode=hn;break}l=0,s=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=ta;break;case qr:for(;s<32;){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}t.adler=n.check=jr(l),l=0,s=0,n.mode=zo;case zo:if(n.havedict===0)return t.next_out=r,t.avail_out=u,t.next_in=i,t.avail_in=_,n.hold=l,n.bits=s,Bf;t.adler=n.check=1,n.mode=ta;case ta:if(a===wf||a===Oo)break t;case $i:if(n.last){l>>>=s&7,s-=s&7,n.mode=Zi;break}for(;s<3;){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}switch(n.last=l&1,l>>>=1,s-=1,l&3){case 0:n.mode=Pr;break;case 1:if(Of(n),n.mode=Ro,a===Oo){l>>>=2,s-=2;break t}break;case 2:n.mode=Mr;break;case 3:t.msg="invalid block type",n.mode=hn}l>>>=2,s-=2;break;case Pr:for(l>>>=s&7,s-=s&7;s<32;){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}if((l&65535)!==(l>>>16^65535)){t.msg="invalid stored block lengths",n.mode=hn;break}if(n.length=l&65535,l=0,s=0,n.mode=Gi,a===Oo)break t;case Gi:n.mode=Or;case Or:if(f=n.length,f){if(f>_&&(f=_),f>u&&(f=u),f===0)break t;c.set(e.subarray(i,i+f),r),_-=f,i+=f,u-=f,r+=f,n.length-=f;break}n.mode=ta;break;case Mr:for(;s<14;){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}if(n.nlen=(l&31)+257,l>>>=5,s-=5,n.ndist=(l&31)+1,l>>>=5,s-=5,n.ncode=(l&15)+4,l>>>=4,s-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=hn;break}n.have=0,n.mode=zr;case zr:for(;n.have<n.ncode;){for(;s<3;){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}n.lens[H[n.have++]]=l&7,l>>>=3,s-=3}for(;n.have<19;)n.lens[H[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,g={bits:n.lenbits},y=uo(If,n.lens,0,19,n.lencode,0,n.work,g),n.lenbits=g.bits,y){t.msg="invalid code lengths set",n.mode=hn;break}n.have=0,n.mode=Rr;case Rr:for(;n.have<n.nlen+n.ndist;){for(;D=n.lencode[l&(1<<n.lenbits)-1],G=D>>>24,V=D>>>16&255,it=D&65535,!(G<=s);){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}if(it<16)l>>>=G,s-=G,n.lens[n.have++]=it;else{if(it===16){for(x=G+2;s<x;){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}if(l>>>=G,s-=G,n.have===0){t.msg="invalid bit length repeat",n.mode=hn;break}h=n.lens[n.have-1],f=3+(l&3),l>>>=2,s-=2}else if(it===17){for(x=G+3;s<x;){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}l>>>=G,s-=G,h=0,f=3+(l&7),l>>>=3,s-=3}else{for(x=G+7;s<x;){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}l>>>=G,s-=G,h=0,f=11+(l&127),l>>>=7,s-=7}if(n.have+f>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=hn;break}for(;f--;)n.lens[n.have++]=h}}if(n.mode===hn)break;if(n.lens[256]===0){t.msg="invalid code -- missing end-of-block",n.mode=hn;break}if(n.lenbits=9,g={bits:n.lenbits},y=uo(pr,n.lens,0,n.nlen,n.lencode,0,n.work,g),n.lenbits=g.bits,y){t.msg="invalid literal/lengths set",n.mode=hn;break}if(n.distbits=6,n.distcode=n.distdyn,g={bits:n.distbits},y=uo(br,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,g),n.distbits=g.bits,y){t.msg="invalid distances set",n.mode=hn;break}if(n.mode=Ro,a===Oo)break t;case Ro:n.mode=To;case To:if(_>=6&&u>=258){t.next_out=r,t.avail_out=u,t.next_in=i,t.avail_in=_,n.hold=l,n.bits=s,bf(t,b),r=t.next_out,c=t.output,u=t.avail_out,i=t.next_in,e=t.input,_=t.avail_in,l=n.hold,s=n.bits,n.mode===ta&&(n.back=-1);break}for(n.back=0;D=n.lencode[l&(1<<n.lenbits)-1],G=D>>>24,V=D>>>16&255,it=D&65535,!(G<=s);){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}if(V&&!(V&240)){for(Z=G,E=V,M=it;D=n.lencode[M+((l&(1<<Z+E)-1)>>Z)],G=D>>>24,V=D>>>16&255,it=D&65535,!(Z+G<=s);){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}l>>>=Z,s-=Z,n.back+=Z}if(l>>>=G,s-=G,n.back+=G,n.length=it,V===0){n.mode=Dr;break}if(V&32){n.back=-1,n.mode=ta;break}if(V&64){t.msg="invalid literal/length code",n.mode=hn;break}n.extra=V&15,n.mode=Tr;case Tr:if(n.extra){for(x=n.extra;s<x;){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}n.length+=l&(1<<n.extra)-1,l>>>=n.extra,s-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=kr;case kr:for(;D=n.distcode[l&(1<<n.distbits)-1],G=D>>>24,V=D>>>16&255,it=D&65535,!(G<=s);){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}if(!(V&240)){for(Z=G,E=V,M=it;D=n.distcode[M+((l&(1<<Z+E)-1)>>Z)],G=D>>>24,V=D>>>16&255,it=D&65535,!(Z+G<=s);){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}l>>>=Z,s-=Z,n.back+=Z}if(l>>>=G,s-=G,n.back+=G,V&64){t.msg="invalid distance code",n.mode=hn;break}n.offset=it,n.extra=V&15,n.mode=Ur;case Ur:if(n.extra){for(x=n.extra;s<x;){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}n.offset+=l&(1<<n.extra)-1,l>>>=n.extra,s-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=hn;break}n.mode=Nr;case Nr:if(u===0)break t;if(f=b-u,n.offset>f){if(f=n.offset-f,f>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=hn;break}f>n.wnext?(f-=n.wnext,w=n.wsize-f):w=n.wnext-f,f>n.length&&(f=n.length),O=n.window}else O=c,w=r-n.offset,f=n.length;f>u&&(f=u),u-=f,n.length-=f;do c[r++]=O[w++];while(--f);n.length===0&&(n.mode=To);break;case Dr:if(u===0)break t;c[r++]=n.length,u--,n.mode=To;break;case Zi:if(n.wrap){for(;s<32;){if(_===0)break t;_--,l|=e[i++]<<s,s+=8}if(b-=u,t.total_out+=b,n.total+=b,n.wrap&4&&b&&(t.adler=n.check=n.flags?Cn(n.check,c,b,r-b):ao(n.check,c,b,r-b)),b=u,n.wrap&4&&(n.flags?l:jr(l))!==n.check){t.msg="incorrect data check",n.mode=hn;break}l=0,s=0}n.mode=Qr;case Qr:if(n.wrap&&n.flags){for(;s<32;){if(_===0)break t;_--,l+=e[i++]<<s,s+=8}if(n.wrap&4&&l!==(n.total&4294967295)){t.msg="incorrect length check",n.mode=hn;break}l=0,s=0}n.mode=$r;case $r:y=vf;break t;case hn:y=Ar;break t;case Gr:return mr;case Zr:default:return Nn}return t.next_out=r,t.avail_out=u,t.next_in=i,t.avail_in=_,n.hold=l,n.bits=s,(n.wsize||b!==t.avail_out&&n.mode<hn&&(n.mode<Zi||a!==yr))&&Wr(t,t.output,t.next_out,b-t.avail_out),I-=t.avail_in,b-=t.avail_out,t.total_in+=I,t.total_out+=b,n.total+=b,n.wrap&4&&b&&(t.adler=n.check=n.flags?Cn(n.check,c,b,t.next_out-b):ao(n.check,c,b,t.next_out-b)),t.data_type=n.bits+(n.last?64:0)+(n.mode===ta?128:0)+(n.mode===Ro||n.mode===Gi?256:0),(I===0&&b===0||a===yr)&&y===Ca&&(y=Ef),y},zf=t=>{if(Ia(t))return Nn;let a=t.state;return a.window&&(a.window=null),t.state=null,Ca},Rf=(t,a)=>{if(Ia(t))return Nn;const n=t.state;return n.wrap&2?(n.head=a,a.done=!1,Ca):Nn},Tf=(t,a)=>{const n=a.length;let e,c,i;return Ia(t)||(e=t.state,e.wrap!==0&&e.mode!==zo)?Nn:e.mode===zo&&(c=1,c=ao(c,a,n,0),c!==e.check)?Ar:(i=Wr(t,a,n,n),i?(e.mode=Gr,mr):(e.havedict=1,Ca))};var kf=Hr,Uf=Vr,Nf=Kr,Df=Pf,Qf=Yr,$f=Mf,Gf=zf,Zf=Rf,jf=Tf,Kf="pako inflate (from Nodeca project)",na={inflateReset:kf,inflateReset2:Uf,inflateResetKeep:Nf,inflateInit:Df,inflateInit2:Qf,inflate:$f,inflateEnd:Gf,inflateGetHeader:Zf,inflateSetDictionary:jf,inflateInfo:Kf};function Hf(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var Vf=Hf;const Jr=Object.prototype.toString,{Z_NO_FLUSH:Yf,Z_FINISH:Xf,Z_OK:go,Z_STREAM_END:Hi,Z_NEED_DICT:Vi,Z_STREAM_ERROR:Wf,Z_DATA_ERROR:td,Z_MEM_ERROR:Jf}=ba;function fo(t){this.options=So.assign({chunkSize:1024*64,windowBits:15,to:""},t||{});const a=this.options;a.raw&&a.windowBits>=0&&a.windowBits<16&&(a.windowBits=-a.windowBits,a.windowBits===0&&(a.windowBits=-15)),a.windowBits>=0&&a.windowBits<16&&!(t&&t.windowBits)&&(a.windowBits+=32),a.windowBits>15&&a.windowBits<48&&(a.windowBits&15||(a.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new _r,this.strm.avail_out=0;let n=na.inflateInit2(this.strm,a.windowBits);if(n!==go)throw new Error(pa[n]);if(this.header=new Vf,na.inflateGetHeader(this.strm,this.header),a.dictionary&&(typeof a.dictionary=="string"?a.dictionary=ro.string2buf(a.dictionary):Jr.call(a.dictionary)==="[object ArrayBuffer]"&&(a.dictionary=new Uint8Array(a.dictionary)),a.raw&&(n=na.inflateSetDictionary(this.strm,a.dictionary),n!==go)))throw new Error(pa[n])}fo.prototype.push=function(t,a){const n=this.strm,e=this.options.chunkSize,c=this.options.dictionary;let i,r,_;if(this.ended)return!1;for(a===~~a?r=a:r=a===!0?Xf:Yf,Jr.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(e),n.next_out=0,n.avail_out=e),i=na.inflate(n,r),i===Vi&&c&&(i=na.inflateSetDictionary(n,c),i===go?i=na.inflate(n,r):i===td&&(i=Vi));n.avail_in>0&&i===Hi&&n.state.wrap>0&&t[n.next_in]!==0;)na.inflateReset(n),i=na.inflate(n,r);switch(i){case Wf:case td:case Vi:case Jf:return this.onEnd(i),this.ended=!0,!1}if(_=n.avail_out,n.next_out&&(n.avail_out===0||i===Hi))if(this.options.to==="string"){let u=ro.utf8border(n.output,n.next_out),l=n.next_out-u,s=ro.buf2string(n.output,u);n.next_out=l,n.avail_out=e-l,l&&n.output.set(n.output.subarray(u,u+l),0),this.onData(s)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(i===go&&_===0)){if(i===Hi)return i=na.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(n.avail_in===0)break}}return!0},fo.prototype.onData=function(t){this.chunks.push(t)},fo.prototype.onEnd=function(t){t===go&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=So.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Yi(t,a){const n=new fo(a);if(n.push(t),n.err)throw n.msg||pa[n.err];return n.result}function t0(t,a){return a=a||{},a.raw=!0,Yi(t,a)}var n0=fo,a0=Yi,o0=t0,e0=Yi,i0=ba,c0={Inflate:n0,inflate:a0,inflateRaw:o0,ungzip:e0,constants:i0};const{Deflate:l0,deflate:s0,deflateRaw:r0,gzip:d0}=Lf,{Inflate:_0,inflate:u0,inflateRaw:g0,ungzip:f0}=c0;var h0=l0,L0=s0,p0=r0,b0=d0,y0=_0,A0=u0,m0=g0,C0=f0,I0=ba,w0={Deflate:h0,deflate:L0,deflateRaw:p0,gzip:b0,Inflate:y0,inflate:A0,inflateRaw:m0,ungzip:C0,constants:I0};const nd="circuit";async function v0(t,a){for(let n=1;n<=a;n++){console.log(`download attempt ${n} for ${t}`);const e=await fetch(t,{method:"GET"});if(e.status===200)return e}throw new Error(`Error downloading ${t} after ${a} retries`)}const B0=async t=>w0.ungzip(t).buffer;async function E0(t,a,n=!1){const c=await(await v0(t,3)).arrayBuffer();if(!n)await Do.setItem(a,c);else{const i=await B0(c);await Do.setItem(a,i),console.log("stored file in localforage",a)}console.log(`Storage of ${a} successful!`)}self.onmessage=async function(t){const{chunkedZkeyUrls:a,inputs:n,wasmUrl:e}=t.data;self.postMessage({type:"message",message:"Worker started"}),await Promise.all(a.map(async({suffix:c,url:i})=>{await E0(i,`${nd}.zkey${c}`,!0)})),self.postMessage({type:"message",message:"Download complete"});try{const{proof:c,publicSignals:i}=await F3(JSON.parse(n),e,`${nd}.zkey`);await Do.clear(),self.postMessage({type:"result",message:c}),self.close()}catch(c){self.postMessage({type:"error",error:c.message}),self.close()}}})();
|
76
|
+
//# sourceMappingURL=localProverWorker-DkBS78Vu.js.map
|