@zk-email/sdk 0.0.86-2 → 0.0.86-4
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/ccip-Ct5W3b12.mjs +147 -0
- package/dist/ccip-Ct5W3b12.mjs.map +1 -0
- package/dist/ccip-D3VwZL7U.js +2 -0
- package/dist/ccip-D3VwZL7U.js.map +1 -0
- package/dist/index-D_J-wv2i.mjs +13490 -0
- package/dist/index-D_J-wv2i.mjs.map +1 -0
- package/dist/index-Djar-1JI.js +41 -0
- package/dist/index-Djar-1JI.js.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/localProverWorkerString.d.ts +1 -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 @@
|
|
1
|
+
export declare const localProverWorkerCode = "var f_=Object.create;var rs=Object.defineProperty;var __=Object.getOwnPropertyDescriptor;var h_=Object.getOwnPropertyNames;var g_=Object.getPrototypeOf,p_=Object.prototype.hasOwnProperty;var An=(i=>typeof require<\"u\"?require:typeof Proxy<\"u\"?new Proxy(i,{get:(t,e)=>(typeof require<\"u\"?require:t)[e]}):i)(function(i){if(typeof require<\"u\")return require.apply(this,arguments);throw Error('Dynamic require of \"'+i+'\" is not supported')});var Yt=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Kn=(i,t)=>{for(var e in t)rs(i,e,{get:t[e],enumerable:!0})},L_=(i,t,e,n)=>{if(t&&typeof t==\"object\"||typeof t==\"function\")for(let o of h_(t))!p_.call(i,o)&&o!==e&&rs(i,o,{get:()=>t[o],enumerable:!(n=__(t,o))||n.enumerable});return i};var fe=(i,t,e)=>(e=i!=null?f_(g_(i)):{},L_(t||!i||!i.__esModule?rs(e,\"default\",{value:i,enumerable:!0}):e,i));var Wr=Yt((Vr,ls)=>{(function(i){if(typeof Vr==\"object\"&&typeof ls<\"u\")ls.exports=i();else if(typeof define==\"function\"&&define.amd)define([],i);else{var t;typeof window<\"u\"?t=window:typeof global<\"u\"?t=global:typeof self<\"u\"?t=self:t=this,t.localforage=i()}})(function(){var i,t,e;return function n(o,d,h){function f(s,x){if(!d[s]){if(!o[s]){var C=typeof An==\"function\"&&An;if(!x&&C)return C(s,!0);if(L)return L(s,!0);var g=new Error(\"Cannot find module '\"+s+\"'\");throw g.code=\"MODULE_NOT_FOUND\",g}var $=d[s]={exports:{}};o[s][0].call($.exports,function(it){var q=o[s][1][it];return f(q||it)},$,$.exports,n,o,d,h)}return d[s].exports}for(var L=typeof An==\"function\"&&An,l=0;l<h.length;l++)f(h[l]);return f}({1:[function(n,o,d){(function(h){\"use strict\";var f=h.MutationObserver||h.WebKitMutationObserver,L;if(f){var l=0,s=new f(it),x=h.document.createTextNode(\"\");s.observe(x,{characterData:!0}),L=function(){x.data=l=++l%2}}else if(!h.setImmediate&&typeof h.MessageChannel<\"u\"){var C=new h.MessageChannel;C.port1.onmessage=it,L=function(){C.port2.postMessage(0)}}else\"document\"in h&&\"onreadystatechange\"in h.document.createElement(\"script\")?L=function(){var S=h.document.createElement(\"script\");S.onreadystatechange=function(){it(),S.onreadystatechange=null,S.parentNode.removeChild(S),S=null},h.document.documentElement.appendChild(S)}:L=function(){setTimeout(it,0)};var g,$=[];function it(){g=!0;for(var S,O,M=$.length;M;){for(O=$,$=[],S=-1;++S<M;)O[S]();M=$.length}g=!1}o.exports=q;function q(S){$.push(S)===1&&!g&&L()}}).call(this,typeof global<\"u\"?global:typeof self<\"u\"?self:typeof window<\"u\"?window:{})},{}],2:[function(n,o,d){\"use strict\";var h=n(1);function f(){}var L={},l=[\"REJECTED\"],s=[\"FULFILLED\"],x=[\"PENDING\"];o.exports=C;function C(E){if(typeof E!=\"function\")throw new TypeError(\"resolver must be a function\");this.state=x,this.queue=[],this.outcome=void 0,E!==f&&q(this,E)}C.prototype.catch=function(E){return this.then(null,E)},C.prototype.then=function(E,_){if(typeof E!=\"function\"&&this.state===s||typeof _!=\"function\"&&this.state===l)return this;var r=new this.constructor(f);if(this.state!==x){var Z=this.state===s?E:_;$(r,Z,this.outcome)}else this.queue.push(new g(r,E,_));return r};function g(E,_,r){this.promise=E,typeof _==\"function\"&&(this.onFulfilled=_,this.callFulfilled=this.otherCallFulfilled),typeof r==\"function\"&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}g.prototype.callFulfilled=function(E){L.resolve(this.promise,E)},g.prototype.otherCallFulfilled=function(E){$(this.promise,this.onFulfilled,E)},g.prototype.callRejected=function(E){L.reject(this.promise,E)},g.prototype.otherCallRejected=function(E){$(this.promise,this.onRejected,E)};function $(E,_,r){h(function(){var Z;try{Z=_(r)}catch(j){return L.reject(E,j)}Z===E?L.reject(E,new TypeError(\"Cannot resolve promise with itself\")):L.resolve(E,Z)})}L.resolve=function(E,_){var r=S(it,_);if(r.status===\"error\")return L.reject(E,r.value);var Z=r.value;if(Z)q(E,Z);else{E.state=s,E.outcome=_;for(var j=-1,nt=E.queue.length;++j<nt;)E.queue[j].callFulfilled(_)}return E},L.reject=function(E,_){E.state=l,E.outcome=_;for(var r=-1,Z=E.queue.length;++r<Z;)E.queue[r].callRejected(_);return E};function it(E){var _=E&&E.then;if(E&&(typeof E==\"object\"||typeof E==\"function\")&&typeof _==\"function\")return function(){_.apply(E,arguments)}}function q(E,_){var r=!1;function Z(y){r||(r=!0,L.reject(E,y))}function j(y){r||(r=!0,L.resolve(E,y))}function nt(){_(j,Z)}var v=S(nt);v.status===\"error\"&&Z(v.value)}function S(E,_){var r={};try{r.value=E(_),r.status=\"success\"}catch(Z){r.status=\"error\",r.value=Z}return r}C.resolve=O;function O(E){return E instanceof this?E:L.resolve(new this(f),E)}C.reject=M;function M(E){var _=new this(f);return L.reject(_,E)}C.all=W;function W(E){var _=this;if(Object.prototype.toString.call(E)!==\"[object Array]\")return this.reject(new TypeError(\"must be an array\"));var r=E.length,Z=!1;if(!r)return this.resolve([]);for(var j=new Array(r),nt=0,v=-1,y=new this(f);++v<r;)T(E[v],v);return y;function T(V,rt){_.resolve(V).then(dt,function(ot){Z||(Z=!0,L.reject(y,ot))});function dt(ot){j[rt]=ot,++nt===r&&!Z&&(Z=!0,L.resolve(y,j))}}}C.race=ct;function ct(E){var _=this;if(Object.prototype.toString.call(E)!==\"[object Array]\")return this.reject(new TypeError(\"must be an array\"));var r=E.length,Z=!1;if(!r)return this.resolve([]);for(var j=-1,nt=new this(f);++j<r;)v(E[j]);return nt;function v(y){_.resolve(y).then(function(T){Z||(Z=!0,L.resolve(nt,T))},function(T){Z||(Z=!0,L.reject(nt,T))})}}},{1:1}],3:[function(n,o,d){(function(h){\"use strict\";typeof h.Promise!=\"function\"&&(h.Promise=n(2))}).call(this,typeof global<\"u\"?global:typeof self<\"u\"?self:typeof window<\"u\"?window:{})},{2:2}],4:[function(n,o,d){\"use strict\";var h=typeof Symbol==\"function\"&&typeof Symbol.iterator==\"symbol\"?function(N){return typeof N}:function(N){return N&&typeof Symbol==\"function\"&&N.constructor===Symbol&&N!==Symbol.prototype?\"symbol\":typeof N};function f(N,at){if(!(N instanceof at))throw new TypeError(\"Cannot call a class as a function\")}function L(){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 l=L();function s(){try{if(!l||!l.open)return!1;var N=typeof openDatabase<\"u\"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),at=typeof fetch==\"function\"&&fetch.toString().indexOf(\"[native code\")!==-1;return(!N||at)&&typeof indexedDB<\"u\"&&typeof IDBKeyRange<\"u\"}catch{return!1}}function x(N,at){N=N||[],at=at||{};try{return new Blob(N,at)}catch(ut){if(ut.name!==\"TypeError\")throw ut;for(var K=typeof BlobBuilder<\"u\"?BlobBuilder:typeof MSBlobBuilder<\"u\"?MSBlobBuilder:typeof MozBlobBuilder<\"u\"?MozBlobBuilder:WebKitBlobBuilder,ft=new K,gt=0;gt<N.length;gt+=1)ft.append(N[gt]);return ft.getBlob(at.type)}}typeof Promise>\"u\"&&n(3);var C=Promise;function g(N,at){at&&N.then(function(K){at(null,K)},function(K){at(K)})}function $(N,at,K){typeof at==\"function\"&&N.then(at),typeof K==\"function\"&&N.catch(K)}function it(N){return typeof N!=\"string\"&&(console.warn(N+\" used as a key, but it is not a string.\"),N=String(N)),N}function q(){if(arguments.length&&typeof arguments[arguments.length-1]==\"function\")return arguments[arguments.length-1]}var S=\"local-forage-detect-blob-support\",O=void 0,M={},W=Object.prototype.toString,ct=\"readonly\",E=\"readwrite\";function _(N){for(var at=N.length,K=new ArrayBuffer(at),ft=new Uint8Array(K),gt=0;gt<at;gt++)ft[gt]=N.charCodeAt(gt);return K}function r(N){return new C(function(at){var K=N.transaction(S,E),ft=x([\"\"]);K.objectStore(S).put(ft,\"key\"),K.onabort=function(gt){gt.preventDefault(),gt.stopPropagation(),at(!1)},K.oncomplete=function(){var gt=navigator.userAgent.match(/Chrome\\/(\\d+)/),ut=navigator.userAgent.match(/Edge\\//);at(ut||!gt||parseInt(gt[1],10)>=43)}}).catch(function(){return!1})}function Z(N){return typeof O==\"boolean\"?C.resolve(O):r(N).then(function(at){return O=at,O})}function j(N){var at=M[N.name],K={};K.promise=new C(function(ft,gt){K.resolve=ft,K.reject=gt}),at.deferredOperations.push(K),at.dbReady?at.dbReady=at.dbReady.then(function(){return K.promise}):at.dbReady=K.promise}function nt(N){var at=M[N.name],K=at.deferredOperations.pop();if(K)return K.resolve(),K.promise}function v(N,at){var K=M[N.name],ft=K.deferredOperations.pop();if(ft)return ft.reject(at),ft.promise}function y(N,at){return new C(function(K,ft){if(M[N.name]=M[N.name]||Pt(),N.db)if(at)j(N),N.db.close();else return K(N.db);var gt=[N.name];at&>.push(N.version);var ut=l.open.apply(l,gt);at&&(ut.onupgradeneeded=function(Gt){var Zt=ut.result;try{Zt.createObjectStore(N.storeName),Gt.oldVersion<=1&&Zt.createObjectStore(S)}catch(Kt){if(Kt.name===\"ConstraintError\")console.warn('The database \"'+N.name+'\" has been upgraded from version '+Gt.oldVersion+\" to version \"+Gt.newVersion+', but the storage \"'+N.storeName+'\" already exists.');else throw Kt}}),ut.onerror=function(Gt){Gt.preventDefault(),ft(ut.error)},ut.onsuccess=function(){var Gt=ut.result;Gt.onversionchange=function(Zt){Zt.target.close()},K(Gt),nt(N)}})}function T(N){return y(N,!1)}function V(N){return y(N,!0)}function rt(N,at){if(!N.db)return!0;var K=!N.db.objectStoreNames.contains(N.storeName),ft=N.version<N.db.version,gt=N.version>N.db.version;if(ft&&(N.version!==at&&console.warn('The database \"'+N.name+`\" can't be downgraded from version `+N.db.version+\" to version \"+N.version+\".\"),N.version=N.db.version),gt||K){if(K){var ut=N.db.version+1;ut>N.version&&(N.version=ut)}return!0}return!1}function dt(N){return new C(function(at,K){var ft=new FileReader;ft.onerror=K,ft.onloadend=function(gt){var ut=btoa(gt.target.result||\"\");at({__local_forage_encoded_blob:!0,data:ut,type:N.type})},ft.readAsBinaryString(N)})}function ot(N){var at=_(atob(N.data));return x([at],{type:N.type})}function xt(N){return N&&N.__local_forage_encoded_blob}function pt(N){var at=this,K=at._initReady().then(function(){var ft=M[at._dbInfo.name];if(ft&&ft.dbReady)return ft.dbReady});return $(K,N,N),K}function bt(N){j(N);for(var at=M[N.name],K=at.forages,ft=0;ft<K.length;ft++){var gt=K[ft];gt._dbInfo.db&&(gt._dbInfo.db.close(),gt._dbInfo.db=null)}return N.db=null,T(N).then(function(ut){return N.db=ut,rt(N)?V(N):ut}).then(function(ut){N.db=at.db=ut;for(var Gt=0;Gt<K.length;Gt++)K[Gt]._dbInfo.db=ut}).catch(function(ut){throw v(N,ut),ut})}function vt(N,at,K,ft){ft===void 0&&(ft=1);try{var gt=N.db.transaction(N.storeName,at);K(null,gt)}catch(ut){if(ft>0&&(!N.db||ut.name===\"InvalidStateError\"||ut.name===\"NotFoundError\"))return C.resolve().then(function(){if(!N.db||ut.name===\"NotFoundError\"&&!N.db.objectStoreNames.contains(N.storeName)&&N.version<=N.db.version)return N.db&&(N.version=N.db.version+1),V(N)}).then(function(){return bt(N).then(function(){vt(N,at,K,ft-1)})}).catch(K);K(ut)}}function Pt(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Ht(N){var at=this,K={db:null};if(N)for(var ft in N)K[ft]=N[ft];var gt=M[K.name];gt||(gt=Pt(),M[K.name]=gt),gt.forages.push(at),at._initReady||(at._initReady=at.ready,at.ready=pt);var ut=[];function Gt(){return C.resolve()}for(var Zt=0;Zt<gt.forages.length;Zt++){var Kt=gt.forages[Zt];Kt!==at&&ut.push(Kt._initReady().catch(Gt))}var jt=gt.forages.slice(0);return C.all(ut).then(function(){return K.db=gt.db,T(K)}).then(function(Vt){return K.db=Vt,rt(K,at._defaultConfig.version)?V(K):Vt}).then(function(Vt){K.db=gt.db=Vt,at._dbInfo=K;for(var Jt=0;Jt<jt.length;Jt++){var le=jt[Jt];le!==at&&(le._dbInfo.db=K.db,le._dbInfo.version=K.version)}})}function m(N,at){var K=this;N=it(N);var ft=new C(function(gt,ut){K.ready().then(function(){vt(K._dbInfo,ct,function(Gt,Zt){if(Gt)return ut(Gt);try{var Kt=Zt.objectStore(K._dbInfo.storeName),jt=Kt.get(N);jt.onsuccess=function(){var Vt=jt.result;Vt===void 0&&(Vt=null),xt(Vt)&&(Vt=ot(Vt)),gt(Vt)},jt.onerror=function(){ut(jt.error)}}catch(Vt){ut(Vt)}})}).catch(ut)});return g(ft,at),ft}function a(N,at){var K=this,ft=new C(function(gt,ut){K.ready().then(function(){vt(K._dbInfo,ct,function(Gt,Zt){if(Gt)return ut(Gt);try{var Kt=Zt.objectStore(K._dbInfo.storeName),jt=Kt.openCursor(),Vt=1;jt.onsuccess=function(){var Jt=jt.result;if(Jt){var le=Jt.value;xt(le)&&(le=ot(le));var ge=N(le,Jt.key,Vt++);ge!==void 0?gt(ge):Jt.continue()}else gt()},jt.onerror=function(){ut(jt.error)}}catch(Jt){ut(Jt)}})}).catch(ut)});return g(ft,at),ft}function w(N,at,K){var ft=this;N=it(N);var gt=new C(function(ut,Gt){var Zt;ft.ready().then(function(){return Zt=ft._dbInfo,W.call(at)===\"[object Blob]\"?Z(Zt.db).then(function(Kt){return Kt?at:dt(at)}):at}).then(function(Kt){vt(ft._dbInfo,E,function(jt,Vt){if(jt)return Gt(jt);try{var Jt=Vt.objectStore(ft._dbInfo.storeName);Kt===null&&(Kt=void 0);var le=Jt.put(Kt,N);Vt.oncomplete=function(){Kt===void 0&&(Kt=null),ut(Kt)},Vt.onabort=Vt.onerror=function(){var ge=le.error?le.error:le.transaction.error;Gt(ge)}}catch(ge){Gt(ge)}})}).catch(Gt)});return g(gt,K),gt}function c(N,at){var K=this;N=it(N);var ft=new C(function(gt,ut){K.ready().then(function(){vt(K._dbInfo,E,function(Gt,Zt){if(Gt)return ut(Gt);try{var Kt=Zt.objectStore(K._dbInfo.storeName),jt=Kt.delete(N);Zt.oncomplete=function(){gt()},Zt.onerror=function(){ut(jt.error)},Zt.onabort=function(){var Vt=jt.error?jt.error:jt.transaction.error;ut(Vt)}}catch(Vt){ut(Vt)}})}).catch(ut)});return g(ft,at),ft}function G(N){var at=this,K=new C(function(ft,gt){at.ready().then(function(){vt(at._dbInfo,E,function(ut,Gt){if(ut)return gt(ut);try{var Zt=Gt.objectStore(at._dbInfo.storeName),Kt=Zt.clear();Gt.oncomplete=function(){ft()},Gt.onabort=Gt.onerror=function(){var jt=Kt.error?Kt.error:Kt.transaction.error;gt(jt)}}catch(jt){gt(jt)}})}).catch(gt)});return g(K,N),K}function R(N){var at=this,K=new C(function(ft,gt){at.ready().then(function(){vt(at._dbInfo,ct,function(ut,Gt){if(ut)return gt(ut);try{var Zt=Gt.objectStore(at._dbInfo.storeName),Kt=Zt.count();Kt.onsuccess=function(){ft(Kt.result)},Kt.onerror=function(){gt(Kt.error)}}catch(jt){gt(jt)}})}).catch(gt)});return g(K,N),K}function F(N,at){var K=this,ft=new C(function(gt,ut){if(N<0){gt(null);return}K.ready().then(function(){vt(K._dbInfo,ct,function(Gt,Zt){if(Gt)return ut(Gt);try{var Kt=Zt.objectStore(K._dbInfo.storeName),jt=!1,Vt=Kt.openKeyCursor();Vt.onsuccess=function(){var Jt=Vt.result;if(!Jt){gt(null);return}N===0||jt?gt(Jt.key):(jt=!0,Jt.advance(N))},Vt.onerror=function(){ut(Vt.error)}}catch(Jt){ut(Jt)}})}).catch(ut)});return g(ft,at),ft}function U(N){var at=this,K=new C(function(ft,gt){at.ready().then(function(){vt(at._dbInfo,ct,function(ut,Gt){if(ut)return gt(ut);try{var Zt=Gt.objectStore(at._dbInfo.storeName),Kt=Zt.openKeyCursor(),jt=[];Kt.onsuccess=function(){var Vt=Kt.result;if(!Vt){ft(jt);return}jt.push(Vt.key),Vt.continue()},Kt.onerror=function(){gt(Kt.error)}}catch(Vt){gt(Vt)}})}).catch(gt)});return g(K,N),K}function A(N,at){at=q.apply(this,arguments);var K=this.config();N=typeof N!=\"function\"&&N||{},N.name||(N.name=N.name||K.name,N.storeName=N.storeName||K.storeName);var ft=this,gt;if(!N.name)gt=C.reject(\"Invalid arguments\");else{var ut=N.name===K.name&&ft._dbInfo.db,Gt=ut?C.resolve(ft._dbInfo.db):T(N).then(function(Zt){var Kt=M[N.name],jt=Kt.forages;Kt.db=Zt;for(var Vt=0;Vt<jt.length;Vt++)jt[Vt]._dbInfo.db=Zt;return Zt});N.storeName?gt=Gt.then(function(Zt){if(Zt.objectStoreNames.contains(N.storeName)){var Kt=Zt.version+1;j(N);var jt=M[N.name],Vt=jt.forages;Zt.close();for(var Jt=0;Jt<Vt.length;Jt++){var le=Vt[Jt];le._dbInfo.db=null,le._dbInfo.version=Kt}var ge=new C(function(Le,Ie){var Ce=l.open(N.name,Kt);Ce.onerror=function(nn){var aa=Ce.result;aa.close(),Ie(nn)},Ce.onupgradeneeded=function(){var nn=Ce.result;nn.deleteObjectStore(N.storeName)},Ce.onsuccess=function(){var nn=Ce.result;nn.close(),Le(nn)}});return ge.then(function(Le){jt.db=Le;for(var Ie=0;Ie<Vt.length;Ie++){var Ce=Vt[Ie];Ce._dbInfo.db=Le,nt(Ce._dbInfo)}}).catch(function(Le){throw(v(N,Le)||C.resolve()).catch(function(){}),Le})}}):gt=Gt.then(function(Zt){j(N);var Kt=M[N.name],jt=Kt.forages;Zt.close();for(var Vt=0;Vt<jt.length;Vt++){var Jt=jt[Vt];Jt._dbInfo.db=null}var le=new C(function(ge,Le){var Ie=l.deleteDatabase(N.name);Ie.onerror=function(){var Ce=Ie.result;Ce&&Ce.close(),Le(Ie.error)},Ie.onblocked=function(){console.warn('dropInstance blocked for database \"'+N.name+'\" until all open connections are closed')},Ie.onsuccess=function(){var Ce=Ie.result;Ce&&Ce.close(),ge(Ce)}});return le.then(function(ge){Kt.db=ge;for(var Le=0;Le<jt.length;Le++){var Ie=jt[Le];nt(Ie._dbInfo)}}).catch(function(ge){throw(v(N,ge)||C.resolve()).catch(function(){}),ge})})}return g(gt,at),gt}var et={_driver:\"asyncStorage\",_initStorage:Ht,_support:s(),iterate:a,getItem:m,setItem:w,removeItem:c,clear:G,length:R,key:F,keys:U,dropInstance:A};function Lt(){return typeof openDatabase==\"function\"}var St=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",qt=\"~~local_forage_type~\",Dt=/^~~local_forage_type~([^~]+)~/,kt=\"__lfsc__:\",Bt=kt.length,Tt=\"arbf\",wt=\"blob\",Rt=\"si08\",I=\"ui08\",z=\"uic8\",J=\"si16\",st=\"si32\",mt=\"ur16\",_t=\"ui32\",It=\"fl32\",Et=\"fl64\",Ct=Bt+Tt.length,Wt=Object.prototype.toString;function ne(N){var at=N.length*.75,K=N.length,ft,gt=0,ut,Gt,Zt,Kt;N[N.length-1]===\"=\"&&(at--,N[N.length-2]===\"=\"&&at--);var jt=new ArrayBuffer(at),Vt=new Uint8Array(jt);for(ft=0;ft<K;ft+=4)ut=St.indexOf(N[ft]),Gt=St.indexOf(N[ft+1]),Zt=St.indexOf(N[ft+2]),Kt=St.indexOf(N[ft+3]),Vt[gt++]=ut<<2|Gt>>4,Vt[gt++]=(Gt&15)<<4|Zt>>2,Vt[gt++]=(Zt&3)<<6|Kt&63;return jt}function D(N){var at=new Uint8Array(N),K=\"\",ft;for(ft=0;ft<at.length;ft+=3)K+=St[at[ft]>>2],K+=St[(at[ft]&3)<<4|at[ft+1]>>4],K+=St[(at[ft+1]&15)<<2|at[ft+2]>>6],K+=St[at[ft+2]&63];return at.length%3===2?K=K.substring(0,K.length-1)+\"=\":at.length%3===1&&(K=K.substring(0,K.length-2)+\"==\"),K}function u(N,at){var K=\"\";if(N&&(K=Wt.call(N)),N&&(K===\"[object ArrayBuffer]\"||N.buffer&&Wt.call(N.buffer)===\"[object ArrayBuffer]\")){var ft,gt=kt;N instanceof ArrayBuffer?(ft=N,gt+=Tt):(ft=N.buffer,K===\"[object Int8Array]\"?gt+=Rt:K===\"[object Uint8Array]\"?gt+=I:K===\"[object Uint8ClampedArray]\"?gt+=z:K===\"[object Int16Array]\"?gt+=J:K===\"[object Uint16Array]\"?gt+=mt:K===\"[object Int32Array]\"?gt+=st:K===\"[object Uint32Array]\"?gt+=_t:K===\"[object Float32Array]\"?gt+=It:K===\"[object Float64Array]\"?gt+=Et:at(new Error(\"Failed to get type for BinaryArray\"))),at(gt+D(ft))}else if(K===\"[object Blob]\"){var ut=new FileReader;ut.onload=function(){var Gt=qt+N.type+\"~\"+D(this.result);at(kt+wt+Gt)},ut.readAsArrayBuffer(N)}else try{at(JSON.stringify(N))}catch(Gt){console.error(\"Couldn't convert value into a JSON string: \",N),at(null,Gt)}}function b(N){if(N.substring(0,Bt)!==kt)return JSON.parse(N);var at=N.substring(Ct),K=N.substring(Bt,Ct),ft;if(K===wt&&Dt.test(at)){var gt=at.match(Dt);ft=gt[1],at=at.substring(gt[0].length)}var ut=ne(at);switch(K){case Tt:return ut;case wt:return x([ut],{type:ft});case Rt:return new Int8Array(ut);case I:return new Uint8Array(ut);case z:return new Uint8ClampedArray(ut);case J:return new Int16Array(ut);case mt:return new Uint16Array(ut);case st:return new Int32Array(ut);case _t:return new Uint32Array(ut);case It:return new Float32Array(ut);case Et:return new Float64Array(ut);default:throw new Error(\"Unkown type: \"+K)}}var B={serialize:u,deserialize:b,stringToBuffer:ne,bufferToString:D};function p(N,at,K,ft){N.executeSql(\"CREATE TABLE IF NOT EXISTS \"+at.storeName+\" (id INTEGER PRIMARY KEY, key unique, value)\",[],K,ft)}function P(N){var at=this,K={db:null};if(N)for(var ft in N)K[ft]=typeof N[ft]!=\"string\"?N[ft].toString():N[ft];var gt=new C(function(ut,Gt){try{K.db=openDatabase(K.name,String(K.version),K.description,K.size)}catch(Zt){return Gt(Zt)}K.db.transaction(function(Zt){p(Zt,K,function(){at._dbInfo=K,ut()},function(Kt,jt){Gt(jt)})},Gt)});return K.serializer=B,gt}function k(N,at,K,ft,gt,ut){N.executeSql(K,ft,gt,function(Gt,Zt){Zt.code===Zt.SYNTAX_ERR?Gt.executeSql(\"SELECT name FROM sqlite_master WHERE type='table' AND name = ?\",[at.storeName],function(Kt,jt){jt.rows.length?ut(Kt,Zt):p(Kt,at,function(){Kt.executeSql(K,ft,gt,ut)},ut)},ut):ut(Gt,Zt)},ut)}function Q(N,at){var K=this;N=it(N);var ft=new C(function(gt,ut){K.ready().then(function(){var Gt=K._dbInfo;Gt.db.transaction(function(Zt){k(Zt,Gt,\"SELECT * FROM \"+Gt.storeName+\" WHERE key = ? LIMIT 1\",[N],function(Kt,jt){var Vt=jt.rows.length?jt.rows.item(0).value:null;Vt&&(Vt=Gt.serializer.deserialize(Vt)),gt(Vt)},function(Kt,jt){ut(jt)})})}).catch(ut)});return g(ft,at),ft}function Y(N,at){var K=this,ft=new C(function(gt,ut){K.ready().then(function(){var Gt=K._dbInfo;Gt.db.transaction(function(Zt){k(Zt,Gt,\"SELECT * FROM \"+Gt.storeName,[],function(Kt,jt){for(var Vt=jt.rows,Jt=Vt.length,le=0;le<Jt;le++){var ge=Vt.item(le),Le=ge.value;if(Le&&(Le=Gt.serializer.deserialize(Le)),Le=N(Le,ge.key,le+1),Le!==void 0){gt(Le);return}}gt()},function(Kt,jt){ut(jt)})})}).catch(ut)});return g(ft,at),ft}function H(N,at,K,ft){var gt=this;N=it(N);var ut=new C(function(Gt,Zt){gt.ready().then(function(){at===void 0&&(at=null);var Kt=at,jt=gt._dbInfo;jt.serializer.serialize(at,function(Vt,Jt){Jt?Zt(Jt):jt.db.transaction(function(le){k(le,jt,\"INSERT OR REPLACE INTO \"+jt.storeName+\" (key, value) VALUES (?, ?)\",[N,Vt],function(){Gt(Kt)},function(ge,Le){Zt(Le)})},function(le){if(le.code===le.QUOTA_ERR){if(ft>0){Gt(H.apply(gt,[N,Kt,K,ft-1]));return}Zt(le)}})})}).catch(Zt)});return g(ut,K),ut}function tt(N,at,K){return H.apply(this,[N,at,K,1])}function X(N,at){var K=this;N=it(N);var ft=new C(function(gt,ut){K.ready().then(function(){var Gt=K._dbInfo;Gt.db.transaction(function(Zt){k(Zt,Gt,\"DELETE FROM \"+Gt.storeName+\" WHERE key = ?\",[N],function(){gt()},function(Kt,jt){ut(jt)})})}).catch(ut)});return g(ft,at),ft}function lt(N){var at=this,K=new C(function(ft,gt){at.ready().then(function(){var ut=at._dbInfo;ut.db.transaction(function(Gt){k(Gt,ut,\"DELETE FROM \"+ut.storeName,[],function(){ft()},function(Zt,Kt){gt(Kt)})})}).catch(gt)});return g(K,N),K}function ht(N){var at=this,K=new C(function(ft,gt){at.ready().then(function(){var ut=at._dbInfo;ut.db.transaction(function(Gt){k(Gt,ut,\"SELECT COUNT(key) as c FROM \"+ut.storeName,[],function(Zt,Kt){var jt=Kt.rows.item(0).c;ft(jt)},function(Zt,Kt){gt(Kt)})})}).catch(gt)});return g(K,N),K}function yt(N,at){var K=this,ft=new C(function(gt,ut){K.ready().then(function(){var Gt=K._dbInfo;Gt.db.transaction(function(Zt){k(Zt,Gt,\"SELECT key FROM \"+Gt.storeName+\" WHERE id = ? LIMIT 1\",[N+1],function(Kt,jt){var Vt=jt.rows.length?jt.rows.item(0).key:null;gt(Vt)},function(Kt,jt){ut(jt)})})}).catch(ut)});return g(ft,at),ft}function At(N){var at=this,K=new C(function(ft,gt){at.ready().then(function(){var ut=at._dbInfo;ut.db.transaction(function(Gt){k(Gt,ut,\"SELECT key FROM \"+ut.storeName,[],function(Zt,Kt){for(var jt=[],Vt=0;Vt<Kt.rows.length;Vt++)jt.push(Kt.rows.item(Vt).key);ft(jt)},function(Zt,Kt){gt(Kt)})})}).catch(gt)});return g(K,N),K}function Ft(N){return new C(function(at,K){N.transaction(function(ft){ft.executeSql(\"SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'\",[],function(gt,ut){for(var Gt=[],Zt=0;Zt<ut.rows.length;Zt++)Gt.push(ut.rows.item(Zt).name);at({db:N,storeNames:Gt})},function(gt,ut){K(ut)})},function(ft){K(ft)})})}function Mt(N,at){at=q.apply(this,arguments);var K=this.config();N=typeof N!=\"function\"&&N||{},N.name||(N.name=N.name||K.name,N.storeName=N.storeName||K.storeName);var ft=this,gt;return N.name?gt=new C(function(ut){var Gt;N.name===K.name?Gt=ft._dbInfo.db:Gt=openDatabase(N.name,\"\",\"\",0),N.storeName?ut({db:Gt,storeNames:[N.storeName]}):ut(Ft(Gt))}).then(function(ut){return new C(function(Gt,Zt){ut.db.transaction(function(Kt){function jt(ge){return new C(function(Le,Ie){Kt.executeSql(\"DROP TABLE IF EXISTS \"+ge,[],function(){Le()},function(Ce,nn){Ie(nn)})})}for(var Vt=[],Jt=0,le=ut.storeNames.length;Jt<le;Jt++)Vt.push(jt(ut.storeNames[Jt]));C.all(Vt).then(function(){Gt()}).catch(function(ge){Zt(ge)})},function(Kt){Zt(Kt)})})}):gt=C.reject(\"Invalid arguments\"),g(gt,at),gt}var Qt={_driver:\"webSQLStorage\",_initStorage:P,_support:Lt(),iterate:Y,getItem:Q,setItem:tt,removeItem:X,clear:lt,length:ht,key:yt,keys:At,dropInstance:Mt};function $t(){try{return typeof localStorage<\"u\"&&\"setItem\"in localStorage&&!!localStorage.setItem}catch{return!1}}function Nt(N,at){var K=N.name+\"/\";return N.storeName!==at.storeName&&(K+=N.storeName+\"/\"),K}function Ot(){var N=\"_localforage_support_test\";try{return localStorage.setItem(N,!0),localStorage.removeItem(N),!1}catch{return!0}}function Xt(){return!Ot()||localStorage.length>0}function ie(N){var at=this,K={};if(N)for(var ft in N)K[ft]=N[ft];return K.keyPrefix=Nt(N,at._defaultConfig),Xt()?(at._dbInfo=K,K.serializer=B,C.resolve()):C.reject()}function ce(N){var at=this,K=at.ready().then(function(){for(var ft=at._dbInfo.keyPrefix,gt=localStorage.length-1;gt>=0;gt--){var ut=localStorage.key(gt);ut.indexOf(ft)===0&&localStorage.removeItem(ut)}});return g(K,N),K}function Ae(N,at){var K=this;N=it(N);var ft=K.ready().then(function(){var gt=K._dbInfo,ut=localStorage.getItem(gt.keyPrefix+N);return ut&&(ut=gt.serializer.deserialize(ut)),ut});return g(ft,at),ft}function ze(N,at){var K=this,ft=K.ready().then(function(){for(var gt=K._dbInfo,ut=gt.keyPrefix,Gt=ut.length,Zt=localStorage.length,Kt=1,jt=0;jt<Zt;jt++){var Vt=localStorage.key(jt);if(Vt.indexOf(ut)===0){var Jt=localStorage.getItem(Vt);if(Jt&&(Jt=gt.serializer.deserialize(Jt)),Jt=N(Jt,Vt.substring(Gt),Kt++),Jt!==void 0)return Jt}}});return g(ft,at),ft}function wn(N,at){var K=this,ft=K.ready().then(function(){var gt=K._dbInfo,ut;try{ut=localStorage.key(N)}catch{ut=null}return ut&&(ut=ut.substring(gt.keyPrefix.length)),ut});return g(ft,at),ft}function $e(N){var at=this,K=at.ready().then(function(){for(var ft=at._dbInfo,gt=localStorage.length,ut=[],Gt=0;Gt<gt;Gt++){var Zt=localStorage.key(Gt);Zt.indexOf(ft.keyPrefix)===0&&ut.push(Zt.substring(ft.keyPrefix.length))}return ut});return g(K,N),K}function Ke(N){var at=this,K=at.keys().then(function(ft){return ft.length});return g(K,N),K}function Fn(N,at){var K=this;N=it(N);var ft=K.ready().then(function(){var gt=K._dbInfo;localStorage.removeItem(gt.keyPrefix+N)});return g(ft,at),ft}function Te(N,at,K){var ft=this;N=it(N);var gt=ft.ready().then(function(){at===void 0&&(at=null);var ut=at;return new C(function(Gt,Zt){var Kt=ft._dbInfo;Kt.serializer.serialize(at,function(jt,Vt){if(Vt)Zt(Vt);else try{localStorage.setItem(Kt.keyPrefix+N,jt),Gt(ut)}catch(Jt){(Jt.name===\"QuotaExceededError\"||Jt.name===\"NS_ERROR_DOM_QUOTA_REACHED\")&&Zt(Jt),Zt(Jt)}})})});return g(gt,K),gt}function Me(N,at){if(at=q.apply(this,arguments),N=typeof N!=\"function\"&&N||{},!N.name){var K=this.config();N.name=N.name||K.name,N.storeName=N.storeName||K.storeName}var ft=this,gt;return N.name?gt=new C(function(ut){N.storeName?ut(Nt(N,ft._defaultConfig)):ut(N.name+\"/\")}).then(function(ut){for(var Gt=localStorage.length-1;Gt>=0;Gt--){var Zt=localStorage.key(Gt);Zt.indexOf(ut)===0&&localStorage.removeItem(Zt)}}):gt=C.reject(\"Invalid arguments\"),g(gt,at),gt}var fn={_driver:\"localStorageWrapper\",_initStorage:ie,_support:$t(),iterate:ze,getItem:Ae,setItem:Te,removeItem:Fn,clear:ce,length:Ke,key:wn,keys:$e,dropInstance:Me},Ci=function(at,K){return at===K||typeof at==\"number\"&&typeof K==\"number\"&&isNaN(at)&&isNaN(K)},ai=function(at,K){for(var ft=at.length,gt=0;gt<ft;){if(Ci(at[gt],K))return!0;gt++}return!1},na=Array.isArray||function(N){return Object.prototype.toString.call(N)===\"[object Array]\"},ia={},Kr={},xi={INDEXEDDB:et,WEBSQL:Qt,LOCALSTORAGE:fn},a_=[xi.INDEXEDDB._driver,xi.WEBSQL._driver,xi.LOCALSTORAGE._driver],io=[\"dropInstance\"],as=[\"clear\",\"getItem\",\"iterate\",\"key\",\"keys\",\"length\",\"removeItem\",\"setItem\"].concat(io),o_={description:\"\",driver:a_.slice(),name:\"localforage\",size:4980736,storeName:\"keyvaluepairs\",version:1};function s_(N,at){N[at]=function(){var K=arguments;return N.ready().then(function(){return N[at].apply(N,K)})}}function os(){for(var N=1;N<arguments.length;N++){var at=arguments[N];if(at)for(var K in at)at.hasOwnProperty(K)&&(na(at[K])?arguments[0][K]=at[K].slice():arguments[0][K]=at[K])}return arguments[0]}var c_=function(){function N(at){f(this,N);for(var K in xi)if(xi.hasOwnProperty(K)){var ft=xi[K],gt=ft._driver;this[K]=gt,ia[gt]||this.defineDriver(ft)}this._defaultConfig=os({},o_),this._config=os({},this._defaultConfig,at),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return N.prototype.config=function(K){if((typeof K>\"u\"?\"undefined\":h(K))===\"object\"){if(this._ready)return new Error(\"Can't call config() after localforage has been used.\");for(var ft in K){if(ft===\"storeName\"&&(K[ft]=K[ft].replace(/\\W/g,\"_\")),ft===\"version\"&&typeof K[ft]!=\"number\")return new Error(\"Database version must be a number.\");this._config[ft]=K[ft]}return\"driver\"in K&&K.driver?this.setDriver(this._config.driver):!0}else return typeof K==\"string\"?this._config[K]:this._config},N.prototype.defineDriver=function(K,ft,gt){var ut=new C(function(Gt,Zt){try{var Kt=K._driver,jt=new Error(\"Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver\");if(!K._driver){Zt(jt);return}for(var Vt=as.concat(\"_initStorage\"),Jt=0,le=Vt.length;Jt<le;Jt++){var ge=Vt[Jt],Le=!ai(io,ge);if((Le||K[ge])&&typeof K[ge]!=\"function\"){Zt(jt);return}}var Ie=function(){for(var aa=function(d_){return function(){var u_=new Error(\"Method \"+d_+\" is not implemented by the current driver\"),jr=C.reject(u_);return g(jr,arguments[arguments.length-1]),jr}},ss=0,l_=io.length;ss<l_;ss++){var cs=io[ss];K[cs]||(K[cs]=aa(cs))}};Ie();var Ce=function(aa){ia[Kt]&&console.info(\"Redefining LocalForage driver: \"+Kt),ia[Kt]=K,Kr[Kt]=aa,Gt()};\"_support\"in K?K._support&&typeof K._support==\"function\"?K._support().then(Ce,Zt):Ce(!!K._support):Ce(!0)}catch(nn){Zt(nn)}});return $(ut,ft,gt),ut},N.prototype.driver=function(){return this._driver||null},N.prototype.getDriver=function(K,ft,gt){var ut=ia[K]?C.resolve(ia[K]):C.reject(new Error(\"Driver not found.\"));return $(ut,ft,gt),ut},N.prototype.getSerializer=function(K){var ft=C.resolve(B);return $(ft,K),ft},N.prototype.ready=function(K){var ft=this,gt=ft._driverSet.then(function(){return ft._ready===null&&(ft._ready=ft._initDriver()),ft._ready});return $(gt,K,K),gt},N.prototype.setDriver=function(K,ft,gt){var ut=this;na(K)||(K=[K]);var Gt=this._getSupportedDrivers(K);function Zt(){ut._config.driver=ut.driver()}function Kt(Jt){return ut._extend(Jt),Zt(),ut._ready=ut._initStorage(ut._config),ut._ready}function jt(Jt){return function(){var le=0;function ge(){for(;le<Jt.length;){var Le=Jt[le];return le++,ut._dbInfo=null,ut._ready=null,ut.getDriver(Le).then(Kt).catch(ge)}Zt();var Ie=new Error(\"No available storage method found.\");return ut._driverSet=C.reject(Ie),ut._driverSet}return ge()}}var Vt=this._driverSet!==null?this._driverSet.catch(function(){return C.resolve()}):C.resolve();return this._driverSet=Vt.then(function(){var Jt=Gt[0];return ut._dbInfo=null,ut._ready=null,ut.getDriver(Jt).then(function(le){ut._driver=le._driver,Zt(),ut._wrapLibraryMethodsWithReady(),ut._initDriver=jt(Gt)})}).catch(function(){Zt();var Jt=new Error(\"No available storage method found.\");return ut._driverSet=C.reject(Jt),ut._driverSet}),$(this._driverSet,ft,gt),this._driverSet},N.prototype.supports=function(K){return!!Kr[K]},N.prototype._extend=function(K){os(this,K)},N.prototype._getSupportedDrivers=function(K){for(var ft=[],gt=0,ut=K.length;gt<ut;gt++){var Gt=K[gt];this.supports(Gt)&&ft.push(Gt)}return ft},N.prototype._wrapLibraryMethodsWithReady=function(){for(var K=0,ft=as.length;K<ft;K++)s_(this,as[K])},N.prototype.createInstance=function(K){return new N(K)},N}(),r_=new c_;o.exports=r_},{3:3}]},{},[4])(4)})});var Ii=Yt(lo=>{lo.bigInt2BytesLE=function(t,e){let n=Array(e),o=BigInt(t);for(let d=0;d<e;d++)n[d]=Number(o&0xFFn),o=o>>8n;return n};lo.bigInt2U32LE=function(t,e){let n=Array(e),o=BigInt(t);for(let d=0;d<e;d++)n[d]=Number(o&0xFFFFFFFFn),o=o>>32n;return n};lo.isOcamNum=function(i){return!(!Array.isArray(i)||i.length!=3||typeof i[0]!=\"number\"||typeof i[1]!=\"number\"||!Array.isArray(i[2]))}});var hl=Yt((gy,_l)=>{_l.exports=function(t,e,n){let o=n||\"int\";if(t.modules[o])return o;t.modules[o]={};let d=e*2,h=e*8;function f(){let E=t.addFunction(o+\"_copy\");E.addParam(\"px\",\"i32\"),E.addParam(\"pr\",\"i32\");let _=E.getCodeBuilder();for(let r=0;r<e;r++)E.addCode(_.i64_store(_.getLocal(\"pr\"),r*8,_.i64_load(_.getLocal(\"px\"),r*8)))}function L(){let E=t.addFunction(o+\"_zero\");E.addParam(\"pr\",\"i32\");let _=E.getCodeBuilder();for(let r=0;r<e;r++)E.addCode(_.i64_store(_.getLocal(\"pr\"),r*8,_.i64_const(0)))}function l(){let E=t.addFunction(o+\"_one\");E.addParam(\"pr\",\"i32\");let _=E.getCodeBuilder();E.addCode(_.i64_store(_.getLocal(\"pr\"),0,_.i64_const(1)));for(let r=1;r<e;r++)E.addCode(_.i64_store(_.getLocal(\"pr\"),r*8,_.i64_const(0)))}function s(){let E=t.addFunction(o+\"_isZero\");E.addParam(\"px\",\"i32\"),E.setReturnType(\"i32\");let _=E.getCodeBuilder();function r(Z){return Z==0?_.ret(_.i64_eqz(_.i64_load(_.getLocal(\"px\")))):_.if(_.i64_eqz(_.i64_load(_.getLocal(\"px\"),Z*8)),r(Z-1),_.ret(_.i32_const(0)))}E.addCode(r(e-1)),E.addCode(_.ret(_.i32_const(0)))}function x(){let E=t.addFunction(o+\"_eq\");E.addParam(\"px\",\"i32\"),E.addParam(\"py\",\"i32\"),E.setReturnType(\"i32\");let _=E.getCodeBuilder();function r(Z){return Z==0?_.ret(_.i64_eq(_.i64_load(_.getLocal(\"px\")),_.i64_load(_.getLocal(\"py\")))):_.if(_.i64_eq(_.i64_load(_.getLocal(\"px\"),Z*8),_.i64_load(_.getLocal(\"py\"),Z*8)),r(Z-1),_.ret(_.i32_const(0)))}E.addCode(r(e-1)),E.addCode(_.ret(_.i32_const(0)))}function C(){let E=t.addFunction(o+\"_gte\");E.addParam(\"px\",\"i32\"),E.addParam(\"py\",\"i32\"),E.setReturnType(\"i32\");let _=E.getCodeBuilder();function r(Z){return Z==0?_.ret(_.i64_ge_u(_.i64_load(_.getLocal(\"px\")),_.i64_load(_.getLocal(\"py\")))):_.if(_.i64_lt_u(_.i64_load(_.getLocal(\"px\"),Z*8),_.i64_load(_.getLocal(\"py\"),Z*8)),_.ret(_.i32_const(0)),_.if(_.i64_gt_u(_.i64_load(_.getLocal(\"px\"),Z*8),_.i64_load(_.getLocal(\"py\"),Z*8)),_.ret(_.i32_const(1)),r(Z-1)))}E.addCode(r(e-1)),E.addCode(_.ret(_.i32_const(0)))}function g(){let E=t.addFunction(o+\"_add\");E.addParam(\"x\",\"i32\"),E.addParam(\"y\",\"i32\"),E.addParam(\"r\",\"i32\"),E.setReturnType(\"i32\"),E.addLocal(\"c\",\"i64\");let _=E.getCodeBuilder();E.addCode(_.setLocal(\"c\",_.i64_add(_.i64_load32_u(_.getLocal(\"x\")),_.i64_load32_u(_.getLocal(\"y\"))))),E.addCode(_.i64_store32(_.getLocal(\"r\"),_.getLocal(\"c\")));for(let r=1;r<d;r++)E.addCode(_.setLocal(\"c\",_.i64_add(_.i64_add(_.i64_load32_u(_.getLocal(\"x\"),4*r),_.i64_load32_u(_.getLocal(\"y\"),4*r)),_.i64_shr_u(_.getLocal(\"c\"),_.i64_const(32))))),E.addCode(_.i64_store32(_.getLocal(\"r\"),r*4,_.getLocal(\"c\")));E.addCode(_.i32_wrap_i64(_.i64_shr_u(_.getLocal(\"c\"),_.i64_const(32))))}function $(){let E=t.addFunction(o+\"_sub\");E.addParam(\"x\",\"i32\"),E.addParam(\"y\",\"i32\"),E.addParam(\"r\",\"i32\"),E.setReturnType(\"i32\"),E.addLocal(\"c\",\"i64\");let _=E.getCodeBuilder();E.addCode(_.setLocal(\"c\",_.i64_sub(_.i64_load32_u(_.getLocal(\"x\")),_.i64_load32_u(_.getLocal(\"y\"))))),E.addCode(_.i64_store32(_.getLocal(\"r\"),_.i64_and(_.getLocal(\"c\"),_.i64_const(\"0xFFFFFFFF\"))));for(let r=1;r<d;r++)E.addCode(_.setLocal(\"c\",_.i64_add(_.i64_sub(_.i64_load32_u(_.getLocal(\"x\"),4*r),_.i64_load32_u(_.getLocal(\"y\"),4*r)),_.i64_shr_s(_.getLocal(\"c\"),_.i64_const(32))))),E.addCode(_.i64_store32(_.getLocal(\"r\"),r*4,_.i64_and(_.getLocal(\"c\"),_.i64_const(\"0xFFFFFFFF\"))));E.addCode(_.i32_wrap_i64(_.i64_shr_s(_.getLocal(\"c\"),_.i64_const(32))))}function it(){let E=t.addFunction(o+\"_mul\");E.addParam(\"x\",\"i32\"),E.addParam(\"y\",\"i32\"),E.addParam(\"r\",\"i32\"),E.addLocal(\"c0\",\"i64\"),E.addLocal(\"c1\",\"i64\");for(let y=0;y<d;y++)E.addLocal(\"x\"+y,\"i64\"),E.addLocal(\"y\"+y,\"i64\");let _=E.getCodeBuilder(),r=[],Z=[];function j(y,T){let V,rt;return r[y]?V=_.getLocal(\"x\"+y):(V=_.teeLocal(\"x\"+y,_.i64_load32_u(_.getLocal(\"x\"),y*4)),r[y]=!0),Z[T]?rt=_.getLocal(\"y\"+T):(rt=_.teeLocal(\"y\"+T,_.i64_load32_u(_.getLocal(\"y\"),T*4)),Z[T]=!0),_.i64_mul(V,rt)}let nt=\"c0\",v=\"c1\";for(let y=0;y<d*2-1;y++){for(let T=Math.max(0,y-d+1);T<=y&&T<d;T++){let V=y-T;E.addCode(_.setLocal(nt,_.i64_add(_.i64_and(_.getLocal(nt),_.i64_const(4294967295)),j(T,V)))),E.addCode(_.setLocal(v,_.i64_add(_.getLocal(v),_.i64_shr_u(_.getLocal(nt),_.i64_const(32)))))}E.addCode(_.i64_store32(_.getLocal(\"r\"),y*4,_.getLocal(nt))),[nt,v]=[v,nt],E.addCode(_.setLocal(v,_.i64_shr_u(_.getLocal(nt),_.i64_const(32))))}E.addCode(_.i64_store32(_.getLocal(\"r\"),d*4*2-4,_.getLocal(nt)))}function q(){let E=t.addFunction(o+\"_square\");E.addParam(\"x\",\"i32\"),E.addParam(\"r\",\"i32\"),E.addLocal(\"c0\",\"i64\"),E.addLocal(\"c1\",\"i64\"),E.addLocal(\"c0_old\",\"i64\"),E.addLocal(\"c1_old\",\"i64\");for(let T=0;T<d;T++)E.addLocal(\"x\"+T,\"i64\");let _=E.getCodeBuilder(),r=[];function Z(T,V){let rt,dt;return r[T]?rt=_.getLocal(\"x\"+T):(rt=_.teeLocal(\"x\"+T,_.i64_load32_u(_.getLocal(\"x\"),T*4)),r[T]=!0),r[V]?dt=_.getLocal(\"x\"+V):(dt=_.teeLocal(\"x\"+V,_.i64_load32_u(_.getLocal(\"x\"),V*4)),r[V]=!0),_.i64_mul(rt,dt)}let j=\"c0\",nt=\"c1\",v=\"c0_old\",y=\"c1_old\";for(let T=0;T<d*2-1;T++){E.addCode(_.setLocal(j,_.i64_const(0)),_.setLocal(nt,_.i64_const(0)));for(let V=Math.max(0,T-d+1);V<T+1>>1&&V<d;V++){let rt=T-V;E.addCode(_.setLocal(j,_.i64_add(_.i64_and(_.getLocal(j),_.i64_const(4294967295)),Z(V,rt)))),E.addCode(_.setLocal(nt,_.i64_add(_.getLocal(nt),_.i64_shr_u(_.getLocal(j),_.i64_const(32)))))}E.addCode(_.setLocal(j,_.i64_shl(_.i64_and(_.getLocal(j),_.i64_const(4294967295)),_.i64_const(1)))),E.addCode(_.setLocal(nt,_.i64_add(_.i64_shl(_.getLocal(nt),_.i64_const(1)),_.i64_shr_u(_.getLocal(j),_.i64_const(32))))),T%2==0&&(E.addCode(_.setLocal(j,_.i64_add(_.i64_and(_.getLocal(j),_.i64_const(4294967295)),Z(T>>1,T>>1)))),E.addCode(_.setLocal(nt,_.i64_add(_.getLocal(nt),_.i64_shr_u(_.getLocal(j),_.i64_const(32)))))),T>0&&(E.addCode(_.setLocal(j,_.i64_add(_.i64_and(_.getLocal(j),_.i64_const(4294967295)),_.i64_and(_.getLocal(v),_.i64_const(4294967295))))),E.addCode(_.setLocal(nt,_.i64_add(_.i64_add(_.getLocal(nt),_.i64_shr_u(_.getLocal(j),_.i64_const(32))),_.getLocal(y))))),E.addCode(_.i64_store32(_.getLocal(\"r\"),T*4,_.getLocal(j))),E.addCode(_.setLocal(v,_.getLocal(nt)),_.setLocal(y,_.i64_shr_u(_.getLocal(v),_.i64_const(32))))}E.addCode(_.i64_store32(_.getLocal(\"r\"),d*4*2-4,_.getLocal(v)))}function S(){let E=t.addFunction(o+\"_squareOld\");E.addParam(\"x\",\"i32\"),E.addParam(\"r\",\"i32\");let _=E.getCodeBuilder();E.addCode(_.call(o+\"_mul\",_.getLocal(\"x\"),_.getLocal(\"x\"),_.getLocal(\"r\")))}function O(){let E=t.addFunction(o+\"__mul1\");E.addParam(\"px\",\"i32\"),E.addParam(\"y\",\"i64\"),E.addParam(\"pr\",\"i32\"),E.addLocal(\"c\",\"i64\");let _=E.getCodeBuilder();E.addCode(_.setLocal(\"c\",_.i64_mul(_.i64_load32_u(_.getLocal(\"px\"),0,0),_.getLocal(\"y\")))),E.addCode(_.i64_store32(_.getLocal(\"pr\"),0,0,_.getLocal(\"c\")));for(let r=1;r<d;r++)E.addCode(_.setLocal(\"c\",_.i64_add(_.i64_mul(_.i64_load32_u(_.getLocal(\"px\"),4*r,0),_.getLocal(\"y\")),_.i64_shr_u(_.getLocal(\"c\"),_.i64_const(32))))),E.addCode(_.i64_store32(_.getLocal(\"pr\"),r*4,0,_.getLocal(\"c\")))}function M(){let E=t.addFunction(o+\"__add1\");E.addParam(\"x\",\"i32\"),E.addParam(\"y\",\"i64\"),E.addLocal(\"c\",\"i64\"),E.addLocal(\"px\",\"i32\");let _=E.getCodeBuilder();E.addCode(_.setLocal(\"px\",_.getLocal(\"x\"))),E.addCode(_.setLocal(\"c\",_.i64_add(_.i64_load32_u(_.getLocal(\"px\"),0,0),_.getLocal(\"y\")))),E.addCode(_.i64_store32(_.getLocal(\"px\"),0,0,_.getLocal(\"c\"))),E.addCode(_.setLocal(\"c\",_.i64_shr_u(_.getLocal(\"c\"),_.i64_const(32)))),E.addCode(_.block(_.loop(_.br_if(1,_.i64_eqz(_.getLocal(\"c\"))),_.setLocal(\"px\",_.i32_add(_.getLocal(\"px\"),_.i32_const(4))),_.setLocal(\"c\",_.i64_add(_.i64_load32_u(_.getLocal(\"px\"),0,0),_.getLocal(\"c\"))),_.i64_store32(_.getLocal(\"px\"),0,0,_.getLocal(\"c\")),_.setLocal(\"c\",_.i64_shr_u(_.getLocal(\"c\"),_.i64_const(32))),_.br(0))))}function W(){O(),M();let E=t.addFunction(o+\"_div\");E.addParam(\"x\",\"i32\"),E.addParam(\"y\",\"i32\"),E.addParam(\"c\",\"i32\"),E.addParam(\"r\",\"i32\"),E.addLocal(\"rr\",\"i32\"),E.addLocal(\"cc\",\"i32\"),E.addLocal(\"eX\",\"i32\"),E.addLocal(\"eY\",\"i32\"),E.addLocal(\"sy\",\"i64\"),E.addLocal(\"sx\",\"i64\"),E.addLocal(\"ec\",\"i32\");let _=E.getCodeBuilder(),r=_.i32_const(t.alloc(h)),Z=_.i32_const(t.alloc(h)),j=_.i32_const(t.alloc(h)),nt=_.getLocal(\"cc\"),v=_.getLocal(\"rr\"),y=t.alloc(h*2),T=_.i32_const(y),V=_.i32_const(y+h);E.addCode(_.if(_.getLocal(\"c\"),_.setLocal(\"cc\",_.getLocal(\"c\")),_.setLocal(\"cc\",Z))),E.addCode(_.if(_.getLocal(\"r\"),_.setLocal(\"rr\",_.getLocal(\"r\")),_.setLocal(\"rr\",j))),E.addCode(_.call(o+\"_copy\",_.getLocal(\"x\"),v)),E.addCode(_.call(o+\"_copy\",_.getLocal(\"y\"),r)),E.addCode(_.call(o+\"_zero\",nt)),E.addCode(_.call(o+\"_zero\",T)),E.addCode(_.setLocal(\"eX\",_.i32_const(h-1))),E.addCode(_.setLocal(\"eY\",_.i32_const(h-1))),E.addCode(_.block(_.loop(_.br_if(1,_.i32_or(_.i32_load8_u(_.i32_add(r,_.getLocal(\"eY\")),0,0),_.i32_eq(_.getLocal(\"eY\"),_.i32_const(3)))),_.setLocal(\"eY\",_.i32_sub(_.getLocal(\"eY\"),_.i32_const(1))),_.br(0)))),E.addCode(_.setLocal(\"sy\",_.i64_add(_.i64_load32_u(_.i32_sub(_.i32_add(r,_.getLocal(\"eY\")),_.i32_const(3)),0,0),_.i64_const(1)))),E.addCode(_.if(_.i64_eq(_.getLocal(\"sy\"),_.i64_const(1)),_.drop(_.i64_div_u(_.i64_const(0),_.i64_const(0))))),E.addCode(_.block(_.loop(_.block(_.loop(_.br_if(1,_.i32_or(_.i32_load8_u(_.i32_add(v,_.getLocal(\"eX\")),0,0),_.i32_eq(_.getLocal(\"eX\"),_.i32_const(7)))),_.setLocal(\"eX\",_.i32_sub(_.getLocal(\"eX\"),_.i32_const(1))),_.br(0))),_.setLocal(\"sx\",_.i64_load(_.i32_sub(_.i32_add(v,_.getLocal(\"eX\")),_.i32_const(7)),0,0)),_.setLocal(\"sx\",_.i64_div_u(_.getLocal(\"sx\"),_.getLocal(\"sy\"))),_.setLocal(\"ec\",_.i32_sub(_.i32_sub(_.getLocal(\"eX\"),_.getLocal(\"eY\")),_.i32_const(4))),_.block(_.loop(_.br_if(1,_.i32_and(_.i64_eqz(_.i64_and(_.getLocal(\"sx\"),_.i64_const(\"0xFFFFFFFF00000000\"))),_.i32_ge_s(_.getLocal(\"ec\"),_.i32_const(0)))),_.setLocal(\"sx\",_.i64_shr_u(_.getLocal(\"sx\"),_.i64_const(8))),_.setLocal(\"ec\",_.i32_add(_.getLocal(\"ec\"),_.i32_const(1))),_.br(0))),_.if(_.i64_eqz(_.getLocal(\"sx\")),[..._.br_if(2,_.i32_eqz(_.call(o+\"_gte\",v,r))),..._.setLocal(\"sx\",_.i64_const(1)),..._.setLocal(\"ec\",_.i32_const(0))]),_.call(o+\"__mul1\",r,_.getLocal(\"sx\"),V),_.drop(_.call(o+\"_sub\",v,_.i32_sub(V,_.getLocal(\"ec\")),v)),_.call(o+\"__add1\",_.i32_add(nt,_.getLocal(\"ec\")),_.getLocal(\"sx\")),_.br(0))))}function ct(){let E=t.addFunction(o+\"_inverseMod\");E.addParam(\"px\",\"i32\"),E.addParam(\"pm\",\"i32\"),E.addParam(\"pr\",\"i32\"),E.addLocal(\"t\",\"i32\"),E.addLocal(\"newt\",\"i32\"),E.addLocal(\"r\",\"i32\"),E.addLocal(\"qq\",\"i32\"),E.addLocal(\"qr\",\"i32\"),E.addLocal(\"newr\",\"i32\"),E.addLocal(\"swp\",\"i32\"),E.addLocal(\"x\",\"i32\"),E.addLocal(\"signt\",\"i32\"),E.addLocal(\"signnewt\",\"i32\"),E.addLocal(\"signx\",\"i32\");let _=E.getCodeBuilder(),r=_.i32_const(t.alloc(h)),Z=_.i32_const(t.alloc(h)),j=_.i32_const(t.alloc(h)),nt=_.i32_const(t.alloc(h)),v=_.i32_const(t.alloc(h)),y=_.i32_const(t.alloc(h)),T=_.i32_const(t.alloc(h*2)),V=_.i32_const(t.alloc(h));E.addCode(_.setLocal(\"t\",r),_.call(o+\"_zero\",r),_.setLocal(\"signt\",_.i32_const(0))),E.addCode(_.setLocal(\"r\",Z),_.call(o+\"_copy\",_.getLocal(\"pm\"),Z)),E.addCode(_.setLocal(\"newt\",j),_.call(o+\"_one\",j),_.setLocal(\"signnewt\",_.i32_const(0))),E.addCode(_.setLocal(\"newr\",nt),_.call(o+\"_copy\",_.getLocal(\"px\"),nt)),E.addCode(_.setLocal(\"qq\",v)),E.addCode(_.setLocal(\"qr\",y)),E.addCode(_.setLocal(\"x\",V)),E.addCode(_.block(_.loop(_.br_if(1,_.call(o+\"_isZero\",_.getLocal(\"newr\"))),_.call(o+\"_div\",_.getLocal(\"r\"),_.getLocal(\"newr\"),_.getLocal(\"qq\"),_.getLocal(\"qr\")),_.call(o+\"_mul\",_.getLocal(\"qq\"),_.getLocal(\"newt\"),T),_.if(_.getLocal(\"signt\"),_.if(_.getLocal(\"signnewt\"),_.if(_.call(o+\"_gte\",T,_.getLocal(\"t\")),[..._.drop(_.call(o+\"_sub\",T,_.getLocal(\"t\"),_.getLocal(\"x\"))),..._.setLocal(\"signx\",_.i32_const(0))],[..._.drop(_.call(o+\"_sub\",_.getLocal(\"t\"),T,_.getLocal(\"x\"))),..._.setLocal(\"signx\",_.i32_const(1))]),[..._.drop(_.call(o+\"_add\",T,_.getLocal(\"t\"),_.getLocal(\"x\"))),..._.setLocal(\"signx\",_.i32_const(1))]),_.if(_.getLocal(\"signnewt\"),[..._.drop(_.call(o+\"_add\",T,_.getLocal(\"t\"),_.getLocal(\"x\"))),..._.setLocal(\"signx\",_.i32_const(0))],_.if(_.call(o+\"_gte\",_.getLocal(\"t\"),T),[..._.drop(_.call(o+\"_sub\",_.getLocal(\"t\"),T,_.getLocal(\"x\"))),..._.setLocal(\"signx\",_.i32_const(0))],[..._.drop(_.call(o+\"_sub\",T,_.getLocal(\"t\"),_.getLocal(\"x\"))),..._.setLocal(\"signx\",_.i32_const(1))]))),_.setLocal(\"swp\",_.getLocal(\"t\")),_.setLocal(\"t\",_.getLocal(\"newt\")),_.setLocal(\"newt\",_.getLocal(\"x\")),_.setLocal(\"x\",_.getLocal(\"swp\")),_.setLocal(\"signt\",_.getLocal(\"signnewt\")),_.setLocal(\"signnewt\",_.getLocal(\"signx\")),_.setLocal(\"swp\",_.getLocal(\"r\")),_.setLocal(\"r\",_.getLocal(\"newr\")),_.setLocal(\"newr\",_.getLocal(\"qr\")),_.setLocal(\"qr\",_.getLocal(\"swp\")),_.br(0)))),E.addCode(_.if(_.getLocal(\"signt\"),_.drop(_.call(o+\"_sub\",_.getLocal(\"pm\"),_.getLocal(\"t\"),_.getLocal(\"pr\"))),_.call(o+\"_copy\",_.getLocal(\"t\"),_.getLocal(\"pr\"))))}return f(),L(),s(),l(),x(),C(),g(),$(),it(),q(),S(),W(),ct(),t.exportFunction(o+\"_copy\"),t.exportFunction(o+\"_zero\"),t.exportFunction(o+\"_one\"),t.exportFunction(o+\"_isZero\"),t.exportFunction(o+\"_eq\"),t.exportFunction(o+\"_gte\"),t.exportFunction(o+\"_add\"),t.exportFunction(o+\"_sub\"),t.exportFunction(o+\"_mul\"),t.exportFunction(o+\"_square\"),t.exportFunction(o+\"_squareOld\"),t.exportFunction(o+\"_div\"),t.exportFunction(o+\"_inverseMod\"),o}});var uo=Yt((py,gl)=>{gl.exports=function(t,e,n,o,d,h,f){let L=t.addFunction(e);L.addParam(\"base\",\"i32\"),L.addParam(\"scalar\",\"i32\"),L.addParam(\"scalarLength\",\"i32\"),L.addParam(\"r\",\"i32\"),L.addLocal(\"i\",\"i32\"),L.addLocal(\"b\",\"i32\");let l=L.getCodeBuilder(),s=l.i32_const(t.alloc(n));L.addCode(l.if(l.i32_eqz(l.getLocal(\"scalarLength\")),[...l.call(f,l.getLocal(\"r\")),...l.ret([])])),L.addCode(l.call(h,l.getLocal(\"base\"),s)),L.addCode(l.call(f,l.getLocal(\"r\"))),L.addCode(l.setLocal(\"i\",l.getLocal(\"scalarLength\"))),L.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\")))),...x(),l.br_if(1,l.i32_eqz(l.getLocal(\"i\"))),l.br(0))));function x(){let C=[];for(let g=0;g<8;g++)C.push(...l.call(d,l.getLocal(\"r\"),l.getLocal(\"r\")),...l.if(l.i32_ge_u(l.getLocal(\"b\"),l.i32_const(128>>g)),[...l.setLocal(\"b\",l.i32_sub(l.getLocal(\"b\"),l.i32_const(128>>g))),...l.call(o,l.getLocal(\"r\"),s,l.getLocal(\"r\"))]));return C}}});var fo=Yt((Ly,pl)=>{pl.exports=G_;function G_(i,t){let e=i.modules[t].n64*8,n=i.addFunction(t+\"_batchInverse\");n.addParam(\"pIn\",\"i32\"),n.addParam(\"inStep\",\"i32\"),n.addParam(\"n\",\"i32\"),n.addParam(\"pOut\",\"i32\"),n.addParam(\"outStep\",\"i32\"),n.addLocal(\"itAux\",\"i32\"),n.addLocal(\"itIn\",\"i32\"),n.addLocal(\"itOut\",\"i32\"),n.addLocal(\"i\",\"i32\");let o=n.getCodeBuilder(),d=o.i32_const(i.alloc(e));n.addCode(o.setLocal(\"itAux\",o.i32_load(o.i32_const(0))),o.i32_store(o.i32_const(0),o.i32_add(o.getLocal(\"itAux\"),o.i32_mul(o.i32_add(o.getLocal(\"n\"),o.i32_const(1)),o.i32_const(e))))),n.addCode(o.call(t+\"_one\",o.getLocal(\"itAux\")),o.setLocal(\"itIn\",o.getLocal(\"pIn\")),o.setLocal(\"itAux\",o.i32_add(o.getLocal(\"itAux\"),o.i32_const(e))),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(t+\"_isZero\",o.getLocal(\"itIn\")),o.call(t+\"_copy\",o.i32_sub(o.getLocal(\"itAux\"),o.i32_const(e)),o.getLocal(\"itAux\")),o.call(t+\"_mul\",o.getLocal(\"itIn\"),o.i32_sub(o.getLocal(\"itAux\"),o.i32_const(e)),o.getLocal(\"itAux\"))),o.setLocal(\"itIn\",o.i32_add(o.getLocal(\"itIn\"),o.getLocal(\"inStep\"))),o.setLocal(\"itAux\",o.i32_add(o.getLocal(\"itAux\"),o.i32_const(e))),o.setLocal(\"i\",o.i32_add(o.getLocal(\"i\"),o.i32_const(1))),o.br(0))),o.setLocal(\"itIn\",o.i32_sub(o.getLocal(\"itIn\"),o.getLocal(\"inStep\"))),o.setLocal(\"itAux\",o.i32_sub(o.getLocal(\"itAux\"),o.i32_const(e))),o.setLocal(\"itOut\",o.i32_add(o.getLocal(\"pOut\"),o.i32_mul(o.i32_sub(o.getLocal(\"n\"),o.i32_const(1)),o.getLocal(\"outStep\")))),o.call(t+\"_inverse\",o.getLocal(\"itAux\"),o.getLocal(\"itAux\")),o.block(o.loop(o.br_if(1,o.i32_eqz(o.getLocal(\"i\"))),o.if(o.call(t+\"_isZero\",o.getLocal(\"itIn\")),[...o.call(t+\"_copy\",o.getLocal(\"itAux\"),o.i32_sub(o.getLocal(\"itAux\"),o.i32_const(e))),...o.call(t+\"_zero\",o.getLocal(\"itOut\"))],[...o.call(t+\"_copy\",o.i32_sub(o.getLocal(\"itAux\"),o.i32_const(e)),d),...o.call(t+\"_mul\",o.getLocal(\"itAux\"),o.getLocal(\"itIn\"),o.i32_sub(o.getLocal(\"itAux\"),o.i32_const(e))),...o.call(t+\"_mul\",o.getLocal(\"itAux\"),d,o.getLocal(\"itOut\"))]),o.setLocal(\"itIn\",o.i32_sub(o.getLocal(\"itIn\"),o.getLocal(\"inStep\"))),o.setLocal(\"itOut\",o.i32_sub(o.getLocal(\"itOut\"),o.getLocal(\"outStep\"))),o.setLocal(\"itAux\",o.i32_sub(o.getLocal(\"itAux\"),o.i32_const(e))),o.setLocal(\"i\",o.i32_sub(o.getLocal(\"i\"),o.i32_const(1))),o.br(0)))),n.addCode(o.i32_store(o.i32_const(0),o.getLocal(\"itAux\")))}});var bs=Yt((my,Ll)=>{Ll.exports=T_;function T_(i,t,e,n,o,d){typeof d>\"u\"&&(n<o?d=!0:d=!1);let h=i.addFunction(t);h.addParam(\"pIn\",\"i32\"),h.addParam(\"n\",\"i32\"),h.addParam(\"pOut\",\"i32\"),h.addLocal(\"i\",\"i32\"),h.addLocal(\"itIn\",\"i32\"),h.addLocal(\"itOut\",\"i32\");let f=h.getCodeBuilder();d?h.addCode(f.setLocal(\"itIn\",f.i32_add(f.getLocal(\"pIn\"),f.i32_mul(f.i32_sub(f.getLocal(\"n\"),f.i32_const(1)),f.i32_const(n)))),f.setLocal(\"itOut\",f.i32_add(f.getLocal(\"pOut\"),f.i32_mul(f.i32_sub(f.getLocal(\"n\"),f.i32_const(1)),f.i32_const(o)))),f.setLocal(\"i\",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal(\"i\"),f.getLocal(\"n\"))),f.call(e,f.getLocal(\"itIn\"),f.getLocal(\"itOut\")),f.setLocal(\"itIn\",f.i32_sub(f.getLocal(\"itIn\"),f.i32_const(n))),f.setLocal(\"itOut\",f.i32_sub(f.getLocal(\"itOut\"),f.i32_const(o))),f.setLocal(\"i\",f.i32_add(f.getLocal(\"i\"),f.i32_const(1))),f.br(0)))):h.addCode(f.setLocal(\"itIn\",f.getLocal(\"pIn\")),f.setLocal(\"itOut\",f.getLocal(\"pOut\")),f.setLocal(\"i\",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal(\"i\"),f.getLocal(\"n\"))),f.call(e,f.getLocal(\"itIn\"),f.getLocal(\"itOut\")),f.setLocal(\"itIn\",f.i32_add(f.getLocal(\"itIn\"),f.i32_const(n))),f.setLocal(\"itOut\",f.i32_add(f.getLocal(\"itOut\"),f.i32_const(o))),f.setLocal(\"i\",f.i32_add(f.getLocal(\"i\"),f.i32_const(1))),f.br(0))))}});var bl=Yt((by,ml)=>{ml.exports=k_;function k_(i,t,e,n,o,d){typeof d>\"u\"&&(n<o?d=!0:d=!1);let h=i.addFunction(t);h.addParam(\"pIn1\",\"i32\"),h.addParam(\"pIn2\",\"i32\"),h.addParam(\"n\",\"i32\"),h.addParam(\"pOut\",\"i32\"),h.addLocal(\"i\",\"i32\"),h.addLocal(\"itIn1\",\"i32\"),h.addLocal(\"itIn2\",\"i32\"),h.addLocal(\"itOut\",\"i32\");let f=h.getCodeBuilder();d?h.addCode(f.setLocal(\"itIn1\",f.i32_add(f.getLocal(\"pIn1\"),f.i32_mul(f.i32_sub(f.getLocal(\"n\"),f.i32_const(1)),f.i32_const(n)))),f.setLocal(\"itIn2\",f.i32_add(f.getLocal(\"pIn2\"),f.i32_mul(f.i32_sub(f.getLocal(\"n\"),f.i32_const(1)),f.i32_const(n)))),f.setLocal(\"itOut\",f.i32_add(f.getLocal(\"pOut\"),f.i32_mul(f.i32_sub(f.getLocal(\"n\"),f.i32_const(1)),f.i32_const(o)))),f.setLocal(\"i\",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal(\"i\"),f.getLocal(\"n\"))),f.call(e,f.getLocal(\"itIn1\"),f.getLocal(\"itIn2\"),f.getLocal(\"itOut\")),f.setLocal(\"itIn1\",f.i32_sub(f.getLocal(\"itIn1\"),f.i32_const(n))),f.setLocal(\"itIn2\",f.i32_sub(f.getLocal(\"itIn2\"),f.i32_const(n))),f.setLocal(\"itOut\",f.i32_sub(f.getLocal(\"itOut\"),f.i32_const(o))),f.setLocal(\"i\",f.i32_add(f.getLocal(\"i\"),f.i32_const(1))),f.br(0)))):h.addCode(f.setLocal(\"itIn1\",f.getLocal(\"pIn1\")),f.setLocal(\"itIn2\",f.getLocal(\"pIn2\")),f.setLocal(\"itOut\",f.getLocal(\"pOut\")),f.setLocal(\"i\",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal(\"i\"),f.getLocal(\"n\"))),f.call(e,f.getLocal(\"itIn1\"),f.getLocal(\"itIn2\"),f.getLocal(\"itOut\")),f.setLocal(\"itIn1\",f.i32_add(f.getLocal(\"itIn1\"),f.i32_const(n))),f.setLocal(\"itIn2\",f.i32_add(f.getLocal(\"itIn2\"),f.i32_const(n))),f.setLocal(\"itOut\",f.i32_add(f.getLocal(\"itOut\"),f.i32_const(o))),f.setLocal(\"i\",f.i32_add(f.getLocal(\"i\"),f.i32_const(1))),f.br(0))))}});var Bi=Yt((yy,_n)=>{function Fl(i,t){return i===t?0:i>t?1:-1}function ys(i){return i*i}function Al(i){return i%2n!==0n}function ws(i){return i%2n===0n}function _o(i){return i<0n}function N_(i){return i>0n}function Cl(i){return _o(i)?i.toString(2).length-1:i.toString(2).length}function ca(i){return i<0n?-i:i}function Ei(i){return ca(i)===1n}function xl(i,t){for(var e=0n,n=1n,o=t,d=ca(i),h,f,L;d!==0n;)h=o/d,f=e,L=o,e=n,o=d,n=f-h*n,d=L-h*d;if(!Ei(o))throw new Error(i.toString()+\" and \"+t.toString()+\" are not co-prime\");return Fl(e,0n)===-1&&(e=e+t),_o(i)?-e:e}function Il(i,t,e){if(e===0n)throw new Error(\"Cannot take modPow with modulus 0\");var n=1n,o=i%e;for(_o(t)&&(t=t*-1n,o=xl(o,e));N_(t);){if(o===0n)return 0n;Al(t)&&(n=n*o%e),t=t/2n,o=ys(o)%e}return n}function Q_(i,t){return i=i>=0n?i:-i,t=t>=0n?t:-t,i===t?0:i>t?1:-1}function yl(i,t){return t===0n?!1:Ei(t)?!0:Q_(t,2n)===0?ws(i):i%t===0n}function D_(i){var t=ca(i);if(Ei(t))return!1;if(t===2n||t===3n||t===5n)return!0;if(ws(t)||yl(t,3n)||yl(t,5n))return!1;if(t<49n)return!0}function Z_(i){return i-1n}function wl(i,t){for(var e=Z_(i),n=e,o=0,d,h,f;ws(n);)n=n/2n,o++;t:for(h=0;h<t.length;h++)if(!(i<t[h])&&(f=Il(BigInt(t[h]),n,i),!(Ei(f)||f===e))){for(d=o-1;d!=0;d--){if(f=ys(f)%i,Ei(f))return!1;if(f===e)continue t}return!1}return!0}function H_(i){var t=D_(i);if(t!==void 0)return t;var e=ca(i),n=Cl(e);if(n<=64)return wl(e,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var o=Math.log(2)*Number(n),d=Math.ceil(o),h=[],f=0;f<d;f++)h.push(BigInt(f+2));return wl(e,h)}_n.exports.bitLength=Cl;_n.exports.isOdd=Al;_n.exports.isNegative=_o;_n.exports.abs=ca;_n.exports.isUnit=Ei;_n.exports.compare=Fl;_n.exports.modInv=xl;_n.exports.modPow=Il;_n.exports.isPrime=H_;_n.exports.square=ys});var ra=Yt((wy,vl)=>{var $_=hl(),Pn=Ii(),K_=uo(),j_=fo(),Fs=bs(),As=bl(),{bitLength:V_,modInv:Cs,modPow:El,isPrime:Bl,isOdd:W_,square:Y_}=Bi();vl.exports=function(t,e,n,o){let d=BigInt(e),h=Math.floor((V_(d-1n)-1)/64)+1,f=h*2,L=h*8,l=n||\"f1m\";if(t.modules[l])return l;let s=$_(t,h,o),x=t.alloc(L,Pn.bigInt2BytesLE(d,L)),C=t.alloc(Pn.bigInt2BytesLE(Y_(1n<<BigInt(h*64))%d,L)),g=t.alloc(Pn.bigInt2BytesLE((1n<<BigInt(h*64))%d,L)),$=t.alloc(Pn.bigInt2BytesLE(0n,L)),it=d-1n,q=it>>1n,S=t.alloc(L,Pn.bigInt2BytesLE(q,L)),O=q+1n,M=t.alloc(L,Pn.bigInt2BytesLE(O,L));t.modules[l]={pq:x,pR2:C,n64:h,q:d,pOne:g,pZero:$,pePlusOne:M};function W(){let R=t.addFunction(l+\"_one\");R.addParam(\"pr\",\"i32\");let F=R.getCodeBuilder();R.addCode(F.call(s+\"_copy\",F.i32_const(g),F.getLocal(\"pr\")))}function ct(){let R=t.addFunction(l+\"_add\");R.addParam(\"x\",\"i32\"),R.addParam(\"y\",\"i32\"),R.addParam(\"r\",\"i32\");let F=R.getCodeBuilder();R.addCode(F.if(F.call(s+\"_add\",F.getLocal(\"x\"),F.getLocal(\"y\"),F.getLocal(\"r\")),F.drop(F.call(s+\"_sub\",F.getLocal(\"r\"),F.i32_const(x),F.getLocal(\"r\"))),F.if(F.call(s+\"_gte\",F.getLocal(\"r\"),F.i32_const(x)),F.drop(F.call(s+\"_sub\",F.getLocal(\"r\"),F.i32_const(x),F.getLocal(\"r\"))))))}function E(){let R=t.addFunction(l+\"_sub\");R.addParam(\"x\",\"i32\"),R.addParam(\"y\",\"i32\"),R.addParam(\"r\",\"i32\");let F=R.getCodeBuilder();R.addCode(F.if(F.call(s+\"_sub\",F.getLocal(\"x\"),F.getLocal(\"y\"),F.getLocal(\"r\")),F.drop(F.call(s+\"_add\",F.getLocal(\"r\"),F.i32_const(x),F.getLocal(\"r\")))))}function _(){let R=t.addFunction(l+\"_neg\");R.addParam(\"x\",\"i32\"),R.addParam(\"r\",\"i32\");let F=R.getCodeBuilder();R.addCode(F.call(l+\"_sub\",F.i32_const($),F.getLocal(\"x\"),F.getLocal(\"r\")))}function r(){let R=t.addFunction(l+\"_isNegative\");R.addParam(\"x\",\"i32\"),R.setReturnType(\"i32\");let F=R.getCodeBuilder(),U=F.i32_const(t.alloc(L));R.addCode(F.call(l+\"_fromMontgomery\",F.getLocal(\"x\"),U),F.call(s+\"_gte\",U,F.i32_const(M)))}function Z(){let R=t.addFunction(l+\"_sign\");R.addParam(\"x\",\"i32\"),R.setReturnType(\"i32\");let F=R.getCodeBuilder(),U=F.i32_const(t.alloc(L));R.addCode(F.if(F.call(s+\"_isZero\",F.getLocal(\"x\")),F.ret(F.i32_const(0))),F.call(l+\"_fromMontgomery\",F.getLocal(\"x\"),U),F.if(F.call(s+\"_gte\",U,F.i32_const(M)),F.ret(F.i32_const(-1))),F.ret(F.i32_const(1)))}function j(){let R=t.alloc(f*f*8),F=t.addFunction(l+\"_mReduct\");F.addParam(\"t\",\"i32\"),F.addParam(\"r\",\"i32\"),F.addLocal(\"np32\",\"i64\"),F.addLocal(\"c\",\"i64\"),F.addLocal(\"m\",\"i64\");let U=F.getCodeBuilder(),A=Number(0x100000000n-Cs(d,0x100000000n));F.addCode(U.setLocal(\"np32\",U.i64_const(A)));for(let et=0;et<f;et++){F.addCode(U.setLocal(\"c\",U.i64_const(0))),F.addCode(U.setLocal(\"m\",U.i64_and(U.i64_mul(U.i64_load32_u(U.getLocal(\"t\"),et*4),U.getLocal(\"np32\")),U.i64_const(\"0xFFFFFFFF\"))));for(let Lt=0;Lt<f;Lt++)F.addCode(U.setLocal(\"c\",U.i64_add(U.i64_add(U.i64_load32_u(U.getLocal(\"t\"),(et+Lt)*4),U.i64_shr_u(U.getLocal(\"c\"),U.i64_const(32))),U.i64_mul(U.i64_load32_u(U.i32_const(x),Lt*4),U.getLocal(\"m\"))))),F.addCode(U.i64_store32(U.getLocal(\"t\"),(et+Lt)*4,U.getLocal(\"c\")));F.addCode(U.i64_store32(U.i32_const(R),et*4,U.i64_shr_u(U.getLocal(\"c\"),U.i64_const(32))))}F.addCode(U.call(l+\"_add\",U.i32_const(R),U.i32_add(U.getLocal(\"t\"),U.i32_const(f*4)),U.getLocal(\"r\")))}function nt(){let R=t.addFunction(l+\"_mul\");R.addParam(\"x\",\"i32\"),R.addParam(\"y\",\"i32\"),R.addParam(\"r\",\"i32\"),R.addLocal(\"c0\",\"i64\"),R.addLocal(\"c1\",\"i64\"),R.addLocal(\"np32\",\"i64\");for(let Bt=0;Bt<f;Bt++)R.addLocal(\"x\"+Bt,\"i64\"),R.addLocal(\"y\"+Bt,\"i64\"),R.addLocal(\"m\"+Bt,\"i64\"),R.addLocal(\"q\"+Bt,\"i64\");let F=R.getCodeBuilder(),U=Number(0x100000000n-Cs(d,0x100000000n));R.addCode(F.setLocal(\"np32\",F.i64_const(U)));let A=[],et=[],Lt=[];function St(Bt,Tt){let wt,Rt;return A[Bt]?wt=F.getLocal(\"x\"+Bt):(wt=F.teeLocal(\"x\"+Bt,F.i64_load32_u(F.getLocal(\"x\"),Bt*4)),A[Bt]=!0),et[Tt]?Rt=F.getLocal(\"y\"+Tt):(Rt=F.teeLocal(\"y\"+Tt,F.i64_load32_u(F.getLocal(\"y\"),Tt*4)),et[Tt]=!0),F.i64_mul(wt,Rt)}function qt(Bt,Tt){let wt,Rt;return Lt[Bt]?wt=F.getLocal(\"q\"+Bt):(wt=F.teeLocal(\"q\"+Bt,F.i64_load32_u(F.i32_const(0),x+Bt*4)),Lt[Bt]=!0),Rt=F.getLocal(\"m\"+Tt),F.i64_mul(wt,Rt)}let Dt=\"c0\",kt=\"c1\";for(let Bt=0;Bt<f*2-1;Bt++){for(let Tt=Math.max(0,Bt-f+1);Tt<=Bt&&Tt<f;Tt++){let wt=Bt-Tt;R.addCode(F.setLocal(Dt,F.i64_add(F.i64_and(F.getLocal(Dt),F.i64_const(4294967295)),St(Tt,wt)))),R.addCode(F.setLocal(kt,F.i64_add(F.getLocal(kt),F.i64_shr_u(F.getLocal(Dt),F.i64_const(32)))))}for(let Tt=Math.max(1,Bt-f+1);Tt<=Bt&&Tt<f;Tt++){let wt=Bt-Tt;R.addCode(F.setLocal(Dt,F.i64_add(F.i64_and(F.getLocal(Dt),F.i64_const(4294967295)),qt(Tt,wt)))),R.addCode(F.setLocal(kt,F.i64_add(F.getLocal(kt),F.i64_shr_u(F.getLocal(Dt),F.i64_const(32)))))}Bt<f&&(R.addCode(F.setLocal(\"m\"+Bt,F.i64_and(F.i64_mul(F.i64_and(F.getLocal(Dt),F.i64_const(4294967295)),F.getLocal(\"np32\")),F.i64_const(\"0xFFFFFFFF\")))),R.addCode(F.setLocal(Dt,F.i64_add(F.i64_and(F.getLocal(Dt),F.i64_const(4294967295)),qt(0,Bt)))),R.addCode(F.setLocal(kt,F.i64_add(F.getLocal(kt),F.i64_shr_u(F.getLocal(Dt),F.i64_const(32)))))),Bt>=f&&R.addCode(F.i64_store32(F.getLocal(\"r\"),(Bt-f)*4,F.getLocal(Dt))),[Dt,kt]=[kt,Dt],R.addCode(F.setLocal(kt,F.i64_shr_u(F.getLocal(Dt),F.i64_const(32))))}R.addCode(F.i64_store32(F.getLocal(\"r\"),f*4-4,F.getLocal(Dt))),R.addCode(F.if(F.i32_wrap_i64(F.getLocal(kt)),F.drop(F.call(s+\"_sub\",F.getLocal(\"r\"),F.i32_const(x),F.getLocal(\"r\"))),F.if(F.call(s+\"_gte\",F.getLocal(\"r\"),F.i32_const(x)),F.drop(F.call(s+\"_sub\",F.getLocal(\"r\"),F.i32_const(x),F.getLocal(\"r\"))))))}function v(){let R=t.addFunction(l+\"_square\");R.addParam(\"x\",\"i32\"),R.addParam(\"r\",\"i32\"),R.addLocal(\"c0\",\"i64\"),R.addLocal(\"c1\",\"i64\"),R.addLocal(\"c0_old\",\"i64\"),R.addLocal(\"c1_old\",\"i64\"),R.addLocal(\"np32\",\"i64\");for(let Tt=0;Tt<f;Tt++)R.addLocal(\"x\"+Tt,\"i64\"),R.addLocal(\"m\"+Tt,\"i64\"),R.addLocal(\"q\"+Tt,\"i64\");let F=R.getCodeBuilder(),U=Number(0x100000000n-Cs(d,0x100000000n));R.addCode(F.setLocal(\"np32\",F.i64_const(U)));let A=[],et=[];function Lt(Tt,wt){let Rt,I;return A[Tt]?Rt=F.getLocal(\"x\"+Tt):(Rt=F.teeLocal(\"x\"+Tt,F.i64_load32_u(F.getLocal(\"x\"),Tt*4)),A[Tt]=!0),A[wt]?I=F.getLocal(\"x\"+wt):(I=F.teeLocal(\"x\"+wt,F.i64_load32_u(F.getLocal(\"x\"),wt*4)),A[wt]=!0),F.i64_mul(Rt,I)}function St(Tt,wt){let Rt,I;return et[Tt]?Rt=F.getLocal(\"q\"+Tt):(Rt=F.teeLocal(\"q\"+Tt,F.i64_load32_u(F.i32_const(0),x+Tt*4)),et[Tt]=!0),I=F.getLocal(\"m\"+wt),F.i64_mul(Rt,I)}let qt=\"c0\",Dt=\"c1\",kt=\"c0_old\",Bt=\"c1_old\";for(let Tt=0;Tt<f*2-1;Tt++){R.addCode(F.setLocal(qt,F.i64_const(0)),F.setLocal(Dt,F.i64_const(0)));for(let wt=Math.max(0,Tt-f+1);wt<Tt+1>>1&&wt<f;wt++){let Rt=Tt-wt;R.addCode(F.setLocal(qt,F.i64_add(F.i64_and(F.getLocal(qt),F.i64_const(4294967295)),Lt(wt,Rt)))),R.addCode(F.setLocal(Dt,F.i64_add(F.getLocal(Dt),F.i64_shr_u(F.getLocal(qt),F.i64_const(32)))))}R.addCode(F.setLocal(qt,F.i64_shl(F.i64_and(F.getLocal(qt),F.i64_const(4294967295)),F.i64_const(1)))),R.addCode(F.setLocal(Dt,F.i64_add(F.i64_shl(F.getLocal(Dt),F.i64_const(1)),F.i64_shr_u(F.getLocal(qt),F.i64_const(32))))),Tt%2==0&&(R.addCode(F.setLocal(qt,F.i64_add(F.i64_and(F.getLocal(qt),F.i64_const(4294967295)),Lt(Tt>>1,Tt>>1)))),R.addCode(F.setLocal(Dt,F.i64_add(F.getLocal(Dt),F.i64_shr_u(F.getLocal(qt),F.i64_const(32)))))),Tt>0&&(R.addCode(F.setLocal(qt,F.i64_add(F.i64_and(F.getLocal(qt),F.i64_const(4294967295)),F.i64_and(F.getLocal(kt),F.i64_const(4294967295))))),R.addCode(F.setLocal(Dt,F.i64_add(F.i64_add(F.getLocal(Dt),F.i64_shr_u(F.getLocal(qt),F.i64_const(32))),F.getLocal(Bt)))));for(let wt=Math.max(1,Tt-f+1);wt<=Tt&&wt<f;wt++){let Rt=Tt-wt;R.addCode(F.setLocal(qt,F.i64_add(F.i64_and(F.getLocal(qt),F.i64_const(4294967295)),St(wt,Rt)))),R.addCode(F.setLocal(Dt,F.i64_add(F.getLocal(Dt),F.i64_shr_u(F.getLocal(qt),F.i64_const(32)))))}Tt<f&&(R.addCode(F.setLocal(\"m\"+Tt,F.i64_and(F.i64_mul(F.i64_and(F.getLocal(qt),F.i64_const(4294967295)),F.getLocal(\"np32\")),F.i64_const(\"0xFFFFFFFF\")))),R.addCode(F.setLocal(qt,F.i64_add(F.i64_and(F.getLocal(qt),F.i64_const(4294967295)),St(0,Tt)))),R.addCode(F.setLocal(Dt,F.i64_add(F.getLocal(Dt),F.i64_shr_u(F.getLocal(qt),F.i64_const(32)))))),Tt>=f&&R.addCode(F.i64_store32(F.getLocal(\"r\"),(Tt-f)*4,F.getLocal(qt))),R.addCode(F.setLocal(kt,F.getLocal(Dt)),F.setLocal(Bt,F.i64_shr_u(F.getLocal(kt),F.i64_const(32))))}R.addCode(F.i64_store32(F.getLocal(\"r\"),f*4-4,F.getLocal(kt))),R.addCode(F.if(F.i32_wrap_i64(F.getLocal(Bt)),F.drop(F.call(s+\"_sub\",F.getLocal(\"r\"),F.i32_const(x),F.getLocal(\"r\"))),F.if(F.call(s+\"_gte\",F.getLocal(\"r\"),F.i32_const(x)),F.drop(F.call(s+\"_sub\",F.getLocal(\"r\"),F.i32_const(x),F.getLocal(\"r\"))))))}function y(){let R=t.addFunction(l+\"_squareOld\");R.addParam(\"x\",\"i32\"),R.addParam(\"r\",\"i32\");let F=R.getCodeBuilder();R.addCode(F.call(l+\"_mul\",F.getLocal(\"x\"),F.getLocal(\"x\"),F.getLocal(\"r\")))}function T(){let R=t.addFunction(l+\"_toMontgomery\");R.addParam(\"x\",\"i32\"),R.addParam(\"r\",\"i32\");let F=R.getCodeBuilder();R.addCode(F.call(l+\"_mul\",F.getLocal(\"x\"),F.i32_const(C),F.getLocal(\"r\")))}function V(){let R=t.alloc(L*2),F=t.addFunction(l+\"_fromMontgomery\");F.addParam(\"x\",\"i32\"),F.addParam(\"r\",\"i32\");let U=F.getCodeBuilder();F.addCode(U.call(s+\"_copy\",U.getLocal(\"x\"),U.i32_const(R))),F.addCode(U.call(s+\"_zero\",U.i32_const(R+L))),F.addCode(U.call(l+\"_mReduct\",U.i32_const(R),U.getLocal(\"r\")))}function rt(){let R=t.addFunction(l+\"_inverse\");R.addParam(\"x\",\"i32\"),R.addParam(\"r\",\"i32\");let F=R.getCodeBuilder();R.addCode(F.call(l+\"_fromMontgomery\",F.getLocal(\"x\"),F.getLocal(\"r\"))),R.addCode(F.call(s+\"_inverseMod\",F.getLocal(\"r\"),F.i32_const(x),F.getLocal(\"r\"))),R.addCode(F.call(l+\"_toMontgomery\",F.getLocal(\"r\"),F.getLocal(\"r\")))}let dt=2n;if(Bl(d))for(;El(dt,q,d)!==it;)dt=dt+1n;let ot=0,xt=it;for(;!W_(xt)&&xt!==0n;)ot++,xt=xt>>1n;let pt=t.alloc(L,Pn.bigInt2BytesLE(xt,L)),bt=El(dt,xt,d),vt=t.alloc(Pn.bigInt2BytesLE((bt<<BigInt(h*64))%d,L)),Pt=xt+1n>>1n,Ht=t.alloc(L,Pn.bigInt2BytesLE(Pt,L));function m(){let R=t.addFunction(l+\"_sqrt\");R.addParam(\"n\",\"i32\"),R.addParam(\"r\",\"i32\"),R.addLocal(\"m\",\"i32\"),R.addLocal(\"i\",\"i32\"),R.addLocal(\"j\",\"i32\");let F=R.getCodeBuilder(),U=F.i32_const(g),A=F.i32_const(t.alloc(L)),et=F.i32_const(t.alloc(L)),Lt=F.i32_const(t.alloc(L)),St=F.i32_const(t.alloc(L)),qt=F.i32_const(t.alloc(L));R.addCode(F.if(F.call(l+\"_isZero\",F.getLocal(\"n\")),F.ret(F.call(l+\"_zero\",F.getLocal(\"r\")))),F.setLocal(\"m\",F.i32_const(ot)),F.call(l+\"_copy\",F.i32_const(vt),A),F.call(l+\"_exp\",F.getLocal(\"n\"),F.i32_const(pt),F.i32_const(L),et),F.call(l+\"_exp\",F.getLocal(\"n\"),F.i32_const(Ht),F.i32_const(L),Lt),F.block(F.loop(F.br_if(1,F.call(l+\"_eq\",et,U)),F.call(l+\"_square\",et,St),F.setLocal(\"i\",F.i32_const(1)),F.block(F.loop(F.br_if(1,F.call(l+\"_eq\",St,U)),F.call(l+\"_square\",St,St),F.setLocal(\"i\",F.i32_add(F.getLocal(\"i\"),F.i32_const(1))),F.br(0))),F.call(l+\"_copy\",A,qt),F.setLocal(\"j\",F.i32_sub(F.i32_sub(F.getLocal(\"m\"),F.getLocal(\"i\")),F.i32_const(1))),F.block(F.loop(F.br_if(1,F.i32_eqz(F.getLocal(\"j\"))),F.call(l+\"_square\",qt,qt),F.setLocal(\"j\",F.i32_sub(F.getLocal(\"j\"),F.i32_const(1))),F.br(0))),F.setLocal(\"m\",F.getLocal(\"i\")),F.call(l+\"_square\",qt,A),F.call(l+\"_mul\",et,A,et),F.call(l+\"_mul\",Lt,qt,Lt),F.br(0))),F.if(F.call(l+\"_isNegative\",Lt),F.call(l+\"_neg\",Lt,F.getLocal(\"r\")),F.call(l+\"_copy\",Lt,F.getLocal(\"r\"))))}function a(){let R=t.addFunction(l+\"_isSquare\");R.addParam(\"n\",\"i32\"),R.setReturnType(\"i32\");let F=R.getCodeBuilder(),U=F.i32_const(g),A=F.i32_const(t.alloc(L));R.addCode(F.if(F.call(l+\"_isZero\",F.getLocal(\"n\")),F.ret(F.i32_const(1))),F.call(l+\"_exp\",F.getLocal(\"n\"),F.i32_const(S),F.i32_const(L),A),F.call(l+\"_eq\",A,U))}function w(){let R=t.addFunction(l+\"_load\");R.addParam(\"scalar\",\"i32\"),R.addParam(\"scalarLen\",\"i32\"),R.addParam(\"r\",\"i32\"),R.addLocal(\"p\",\"i32\"),R.addLocal(\"l\",\"i32\"),R.addLocal(\"i\",\"i32\"),R.addLocal(\"j\",\"i32\");let F=R.getCodeBuilder(),U=F.i32_const(t.alloc(L)),A=t.alloc(L),et=F.i32_const(A);R.addCode(F.call(s+\"_zero\",F.getLocal(\"r\")),F.setLocal(\"i\",F.i32_const(L)),F.setLocal(\"p\",F.getLocal(\"scalar\")),F.block(F.loop(F.br_if(1,F.i32_gt_u(F.getLocal(\"i\"),F.getLocal(\"scalarLen\"))),F.if(F.i32_eq(F.getLocal(\"i\"),F.i32_const(L)),F.call(l+\"_one\",U),F.call(l+\"_mul\",U,F.i32_const(C),U)),F.call(l+\"_mul\",F.getLocal(\"p\"),U,et),F.call(l+\"_add\",F.getLocal(\"r\"),et,F.getLocal(\"r\")),F.setLocal(\"p\",F.i32_add(F.getLocal(\"p\"),F.i32_const(L))),F.setLocal(\"i\",F.i32_add(F.getLocal(\"i\"),F.i32_const(L))),F.br(0))),F.setLocal(\"l\",F.i32_rem_u(F.getLocal(\"scalarLen\"),F.i32_const(L))),F.if(F.i32_eqz(F.getLocal(\"l\")),F.ret([])),F.call(s+\"_zero\",et),F.setLocal(\"j\",F.i32_const(0)),F.block(F.loop(F.br_if(1,F.i32_eq(F.getLocal(\"j\"),F.getLocal(\"l\"))),F.i32_store8(F.getLocal(\"j\"),A,F.i32_load8_u(F.getLocal(\"p\"))),F.setLocal(\"p\",F.i32_add(F.getLocal(\"p\"),F.i32_const(1))),F.setLocal(\"j\",F.i32_add(F.getLocal(\"j\"),F.i32_const(1))),F.br(0))),F.if(F.i32_eq(F.getLocal(\"i\"),F.i32_const(L)),F.call(l+\"_one\",U),F.call(l+\"_mul\",U,F.i32_const(C),U)),F.call(l+\"_mul\",et,U,et),F.call(l+\"_add\",F.getLocal(\"r\"),et,F.getLocal(\"r\")))}function c(){let R=t.addFunction(l+\"_timesScalar\");R.addParam(\"x\",\"i32\"),R.addParam(\"scalar\",\"i32\"),R.addParam(\"scalarLen\",\"i32\"),R.addParam(\"r\",\"i32\");let F=R.getCodeBuilder(),U=F.i32_const(t.alloc(L));R.addCode(F.call(l+\"_load\",F.getLocal(\"scalar\"),F.getLocal(\"scalarLen\"),U),F.call(l+\"_toMontgomery\",U,U),F.call(l+\"_mul\",F.getLocal(\"x\"),U,F.getLocal(\"r\")))}function G(){let R=t.addFunction(l+\"_isOne\");R.addParam(\"x\",\"i32\"),R.setReturnType(\"i32\");let F=R.getCodeBuilder();R.addCode(F.ret(F.call(s+\"_eq\",F.getLocal(\"x\"),F.i32_const(g))))}return t.exportFunction(s+\"_copy\",l+\"_copy\"),t.exportFunction(s+\"_zero\",l+\"_zero\"),t.exportFunction(s+\"_isZero\",l+\"_isZero\"),t.exportFunction(s+\"_eq\",l+\"_eq\"),G(),ct(),E(),_(),j(),nt(),v(),y(),T(),V(),r(),Z(),rt(),W(),w(),c(),j_(t,l),Fs(t,l+\"_batchToMontgomery\",l+\"_toMontgomery\",L,L),Fs(t,l+\"_batchFromMontgomery\",l+\"_fromMontgomery\",L,L),Fs(t,l+\"_batchNeg\",l+\"_neg\",L,L),As(t,l+\"_batchAdd\",l+\"_add\",L,L),As(t,l+\"_batchSub\",l+\"_sub\",L,L),As(t,l+\"_batchMul\",l+\"_mul\",L,L),t.exportFunction(l+\"_add\"),t.exportFunction(l+\"_sub\"),t.exportFunction(l+\"_neg\"),t.exportFunction(l+\"_isNegative\"),t.exportFunction(l+\"_isOne\"),t.exportFunction(l+\"_sign\"),t.exportFunction(l+\"_mReduct\"),t.exportFunction(l+\"_mul\"),t.exportFunction(l+\"_square\"),t.exportFunction(l+\"_squareOld\"),t.exportFunction(l+\"_fromMontgomery\"),t.exportFunction(l+\"_toMontgomery\"),t.exportFunction(l+\"_inverse\"),t.exportFunction(l+\"_one\"),t.exportFunction(l+\"_load\"),t.exportFunction(l+\"_timesScalar\"),K_(t,l+\"_exp\",L,l+\"_mul\",l+\"_square\",s+\"_copy\",l+\"_one\"),t.exportFunction(l+\"_exp\"),t.exportFunction(l+\"_batchInverse\"),Bl(d)&&(m(),a(),t.exportFunction(l+\"_sqrt\"),t.exportFunction(l+\"_isSquare\")),t.exportFunction(l+\"_batchToMontgomery\"),t.exportFunction(l+\"_batchFromMontgomery\"),l}});var xs=Yt((Fy,Sl)=>{var X_=ra(),{bitLength:J_}=Bi();Sl.exports=function(t,e,n,o,d){let h=BigInt(e),f=Math.floor((J_(h-1n)-1)/64)+1,L=f*8,l=n||\"f1\";if(t.modules[l])return l;t.modules[l]={n64:f};let s=d||\"int\",x=X_(t,h,o,s),C=t.modules[x].pR2,g=t.modules[x].pq,$=t.modules[x].pePlusOne;function it(){let M=t.alloc(L),W=t.addFunction(l+\"_mul\");W.addParam(\"x\",\"i32\"),W.addParam(\"y\",\"i32\"),W.addParam(\"r\",\"i32\");let ct=W.getCodeBuilder();W.addCode(ct.call(x+\"_mul\",ct.getLocal(\"x\"),ct.getLocal(\"y\"),ct.i32_const(M))),W.addCode(ct.call(x+\"_mul\",ct.i32_const(M),ct.i32_const(C),ct.getLocal(\"r\")))}function q(){let M=t.addFunction(l+\"_square\");M.addParam(\"x\",\"i32\"),M.addParam(\"r\",\"i32\");let W=M.getCodeBuilder();M.addCode(W.call(l+\"_mul\",W.getLocal(\"x\"),W.getLocal(\"x\"),W.getLocal(\"r\")))}function S(){let M=t.addFunction(l+\"_inverse\");M.addParam(\"x\",\"i32\"),M.addParam(\"r\",\"i32\");let W=M.getCodeBuilder();M.addCode(W.call(s+\"_inverseMod\",W.getLocal(\"x\"),W.i32_const(g),W.getLocal(\"r\")))}function O(){let M=t.addFunction(l+\"_isNegative\");M.addParam(\"x\",\"i32\"),M.setReturnType(\"i32\");let W=M.getCodeBuilder();M.addCode(W.call(s+\"_gte\",W.getLocal(\"x\"),W.i32_const($)))}return it(),q(),S(),O(),t.exportFunction(x+\"_add\",l+\"_add\"),t.exportFunction(x+\"_sub\",l+\"_sub\"),t.exportFunction(x+\"_neg\",l+\"_neg\"),t.exportFunction(l+\"_mul\"),t.exportFunction(l+\"_square\"),t.exportFunction(l+\"_inverse\"),t.exportFunction(l+\"_isNegative\"),t.exportFunction(x+\"_copy\",l+\"_copy\"),t.exportFunction(x+\"_zero\",l+\"_zero\"),t.exportFunction(x+\"_one\",l+\"_one\"),t.exportFunction(x+\"_isZero\",l+\"_isZero\"),t.exportFunction(x+\"_eq\",l+\"_eq\"),l}});var Es=Yt((Ay,ql)=>{var th=uo(),eh=fo(),Is=Ii();ql.exports=function(t,e,n,o){if(t.modules[n])return n;let d=t.modules[o].n64*8,h=t.modules[o].q;t.modules[n]={n64:t.modules[o].n64*2};function f(){let v=t.addFunction(n+\"_add\");v.addParam(\"x\",\"i32\"),v.addParam(\"y\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"y\"),dt=y.i32_add(y.getLocal(\"y\"),y.i32_const(d)),ot=y.getLocal(\"r\"),xt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d));v.addCode(y.call(o+\"_add\",T,rt,ot),y.call(o+\"_add\",V,dt,xt))}function L(){let v=t.addFunction(n+\"_timesScalar\");v.addParam(\"x\",\"i32\"),v.addParam(\"scalar\",\"i32\"),v.addParam(\"scalarLen\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"r\"),dt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d));v.addCode(y.call(o+\"_timesScalar\",T,y.getLocal(\"scalar\"),y.getLocal(\"scalarLen\"),rt),y.call(o+\"_timesScalar\",V,y.getLocal(\"scalar\"),y.getLocal(\"scalarLen\"),dt))}function l(){let v=t.addFunction(n+\"_sub\");v.addParam(\"x\",\"i32\"),v.addParam(\"y\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"y\"),dt=y.i32_add(y.getLocal(\"y\"),y.i32_const(d)),ot=y.getLocal(\"r\"),xt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d));v.addCode(y.call(o+\"_sub\",T,rt,ot),y.call(o+\"_sub\",V,dt,xt))}function s(){let v=t.addFunction(n+\"_neg\");v.addParam(\"x\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"r\"),dt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d));v.addCode(y.call(o+\"_neg\",T,rt),y.call(o+\"_neg\",V,dt))}function x(){let v=t.addFunction(n+\"_conjugate\");v.addParam(\"x\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"r\"),dt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d));v.addCode(y.call(o+\"_copy\",T,rt),y.call(o+\"_neg\",V,dt))}function C(){let v=t.addFunction(n+\"_isNegative\");v.addParam(\"x\",\"i32\"),v.setReturnType(\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d));v.addCode(y.if(y.call(o+\"_isZero\",V),y.ret(y.call(o+\"_isNegative\",T))),y.ret(y.call(o+\"_isNegative\",V)))}function g(){let v=t.addFunction(n+\"_mul\");v.addParam(\"x\",\"i32\"),v.addParam(\"y\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"y\"),dt=y.i32_add(y.getLocal(\"y\"),y.i32_const(d)),ot=y.getLocal(\"r\"),xt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d)),pt=y.i32_const(t.alloc(d)),bt=y.i32_const(t.alloc(d)),vt=y.i32_const(t.alloc(d)),Pt=y.i32_const(t.alloc(d));v.addCode(y.call(o+\"_mul\",T,rt,pt),y.call(o+\"_mul\",V,dt,bt),y.call(o+\"_add\",T,V,vt),y.call(o+\"_add\",rt,dt,Pt),y.call(o+\"_mul\",vt,Pt,vt),y.call(e,bt,ot),y.call(o+\"_add\",pt,ot,ot),y.call(o+\"_add\",pt,bt,xt),y.call(o+\"_sub\",vt,xt,xt))}function $(){let v=t.addFunction(n+\"_mul1\");v.addParam(\"x\",\"i32\"),v.addParam(\"y\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"y\"),dt=y.getLocal(\"r\"),ot=y.i32_add(y.getLocal(\"r\"),y.i32_const(d));v.addCode(y.call(o+\"_mul\",T,rt,dt),y.call(o+\"_mul\",V,rt,ot))}function it(){let v=t.addFunction(n+\"_square\");v.addParam(\"x\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"r\"),dt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d)),ot=y.i32_const(t.alloc(d)),xt=y.i32_const(t.alloc(d)),pt=y.i32_const(t.alloc(d)),bt=y.i32_const(t.alloc(d));v.addCode(y.call(o+\"_mul\",T,V,ot),y.call(o+\"_add\",T,V,xt),y.call(e,V,pt),y.call(o+\"_add\",T,pt,pt),y.call(e,ot,bt),y.call(o+\"_add\",bt,ot,bt),y.call(o+\"_mul\",xt,pt,rt),y.call(o+\"_sub\",rt,bt,rt),y.call(o+\"_add\",ot,ot,dt))}function q(){let v=t.addFunction(n+\"_toMontgomery\");v.addParam(\"x\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"r\"),dt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d));v.addCode(y.call(o+\"_toMontgomery\",T,rt),y.call(o+\"_toMontgomery\",V,dt))}function S(){let v=t.addFunction(n+\"_fromMontgomery\");v.addParam(\"x\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"r\"),dt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d));v.addCode(y.call(o+\"_fromMontgomery\",T,rt),y.call(o+\"_fromMontgomery\",V,dt))}function O(){let v=t.addFunction(n+\"_copy\");v.addParam(\"x\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"r\"),dt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d));v.addCode(y.call(o+\"_copy\",T,rt),y.call(o+\"_copy\",V,dt))}function M(){let v=t.addFunction(n+\"_zero\");v.addParam(\"x\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d));v.addCode(y.call(o+\"_zero\",T),y.call(o+\"_zero\",V))}function W(){let v=t.addFunction(n+\"_one\");v.addParam(\"x\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d));v.addCode(y.call(o+\"_one\",T),y.call(o+\"_zero\",V))}function ct(){let v=t.addFunction(n+\"_eq\");v.addParam(\"x\",\"i32\"),v.addParam(\"y\",\"i32\"),v.setReturnType(\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"y\"),dt=y.i32_add(y.getLocal(\"y\"),y.i32_const(d));v.addCode(y.i32_and(y.call(o+\"_eq\",T,rt),y.call(o+\"_eq\",V,dt)))}function E(){let v=t.addFunction(n+\"_isZero\");v.addParam(\"x\",\"i32\"),v.setReturnType(\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d));v.addCode(y.i32_and(y.call(o+\"_isZero\",T),y.call(o+\"_isZero\",V)))}function _(){let v=t.addFunction(n+\"_inverse\");v.addParam(\"x\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"r\"),dt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d)),ot=y.i32_const(t.alloc(d)),xt=y.i32_const(t.alloc(d)),pt=y.i32_const(t.alloc(d)),bt=y.i32_const(t.alloc(d));v.addCode(y.call(o+\"_square\",T,ot),y.call(o+\"_square\",V,xt),y.call(e,xt,pt),y.call(o+\"_sub\",ot,pt,pt),y.call(o+\"_inverse\",pt,bt),y.call(o+\"_mul\",T,bt,rt),y.call(o+\"_mul\",V,bt,dt),y.call(o+\"_neg\",dt,dt))}function r(){let v=t.addFunction(n+\"_sign\");v.addParam(\"x\",\"i32\"),v.addLocal(\"s\",\"i32\"),v.setReturnType(\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d));v.addCode(y.setLocal(\"s\",y.call(o+\"_sign\",V)),y.if(y.getLocal(\"s\"),y.ret(y.getLocal(\"s\"))),y.ret(y.call(o+\"_sign\",T)))}function Z(){let v=t.addFunction(n+\"_isOne\");v.addParam(\"x\",\"i32\"),v.setReturnType(\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d));v.addCode(y.ret(y.i32_and(y.call(o+\"_isOne\",T),y.call(o+\"_isZero\",V))))}function j(){let v=t.addFunction(n+\"_sqrt\");v.addParam(\"a\",\"i32\"),v.addParam(\"pr\",\"i32\");let y=v.getCodeBuilder(),T=y.i32_const(t.alloc(Is.bigInt2BytesLE((BigInt(h||0)-3n)/4n,d))),V=y.i32_const(t.alloc(Is.bigInt2BytesLE((BigInt(h||0)-1n)/2n,d))),rt=y.getLocal(\"a\"),dt=y.i32_const(t.alloc(d*2)),ot=y.i32_const(t.alloc(d*2)),xt=y.i32_const(t.alloc(d*2)),pt=t.alloc(d*2),bt=y.i32_const(pt),vt=y.i32_const(pt),Pt=y.i32_const(pt+d),Ht=y.i32_const(t.alloc(d*2)),m=y.i32_const(t.alloc(d*2));v.addCode(y.call(n+\"_one\",bt),y.call(n+\"_neg\",bt,bt),y.call(n+\"_exp\",rt,T,y.i32_const(d),dt),y.call(n+\"_square\",dt,ot),y.call(n+\"_mul\",rt,ot,ot),y.call(n+\"_conjugate\",ot,xt),y.call(n+\"_mul\",xt,ot,xt),y.if(y.call(n+\"_eq\",xt,bt),y.unreachable()),y.call(n+\"_mul\",dt,rt,Ht),y.if(y.call(n+\"_eq\",ot,bt),[...y.call(o+\"_zero\",vt),...y.call(o+\"_one\",Pt),...y.call(n+\"_mul\",bt,Ht,y.getLocal(\"pr\"))],[...y.call(n+\"_one\",m),...y.call(n+\"_add\",m,ot,m),...y.call(n+\"_exp\",m,V,y.i32_const(d),m),...y.call(n+\"_mul\",m,Ht,y.getLocal(\"pr\"))]))}function nt(){let v=t.addFunction(n+\"_isSquare\");v.addParam(\"a\",\"i32\"),v.setReturnType(\"i32\");let y=v.getCodeBuilder(),T=y.i32_const(t.alloc(Is.bigInt2BytesLE((BigInt(h||0)-3n)/4n,d))),V=y.getLocal(\"a\"),rt=y.i32_const(t.alloc(d*2)),dt=y.i32_const(t.alloc(d*2)),ot=y.i32_const(t.alloc(d*2)),xt=t.alloc(d*2),pt=y.i32_const(xt);v.addCode(y.call(n+\"_one\",pt),y.call(n+\"_neg\",pt,pt),y.call(n+\"_exp\",V,T,y.i32_const(d),rt),y.call(n+\"_square\",rt,dt),y.call(n+\"_mul\",V,dt,dt),y.call(n+\"_conjugate\",dt,ot),y.call(n+\"_mul\",ot,dt,ot),y.if(y.call(n+\"_eq\",ot,pt),y.ret(y.i32_const(0))),y.ret(y.i32_const(1)))}return E(),Z(),M(),W(),O(),g(),$(),it(),f(),l(),s(),x(),q(),S(),ct(),_(),L(),r(),C(),t.exportFunction(n+\"_isZero\"),t.exportFunction(n+\"_isOne\"),t.exportFunction(n+\"_zero\"),t.exportFunction(n+\"_one\"),t.exportFunction(n+\"_copy\"),t.exportFunction(n+\"_mul\"),t.exportFunction(n+\"_mul1\"),t.exportFunction(n+\"_square\"),t.exportFunction(n+\"_add\"),t.exportFunction(n+\"_sub\"),t.exportFunction(n+\"_neg\"),t.exportFunction(n+\"_sign\"),t.exportFunction(n+\"_conjugate\"),t.exportFunction(n+\"_fromMontgomery\"),t.exportFunction(n+\"_toMontgomery\"),t.exportFunction(n+\"_eq\"),t.exportFunction(n+\"_inverse\"),eh(t,n),th(t,n+\"_exp\",d*2,n+\"_mul\",n+\"_square\",n+\"_copy\",n+\"_one\"),j(),nt(),t.exportFunction(n+\"_exp\"),t.exportFunction(n+\"_timesScalar\"),t.exportFunction(n+\"_batchInverse\"),t.exportFunction(n+\"_sqrt\"),t.exportFunction(n+\"_isSquare\"),t.exportFunction(n+\"_isNegative\"),n}});var Bs=Yt((Cy,Ul)=>{var nh=uo(),ih=fo();Ul.exports=function(t,e,n,o){if(t.modules[n])return n;let d=t.modules[o].n64*8;t.modules[n]={n64:t.modules[o].n64*3};function h(){let _=t.addFunction(n+\"_add\");_.addParam(\"x\",\"i32\"),_.addParam(\"y\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"y\"),y=r.i32_add(r.getLocal(\"y\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"y\"),r.i32_const(2*d)),V=r.getLocal(\"r\"),rt=r.i32_add(r.getLocal(\"r\"),r.i32_const(d)),dt=r.i32_add(r.getLocal(\"r\"),r.i32_const(2*d));_.addCode(r.call(o+\"_add\",Z,v,V),r.call(o+\"_add\",j,y,rt),r.call(o+\"_add\",nt,T,dt))}function f(){let _=t.addFunction(n+\"_timesScalar\");_.addParam(\"x\",\"i32\"),_.addParam(\"scalar\",\"i32\"),_.addParam(\"scalarLen\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"r\"),y=r.i32_add(r.getLocal(\"r\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"r\"),r.i32_const(2*d));_.addCode(r.call(o+\"_timesScalar\",Z,r.getLocal(\"scalar\"),r.getLocal(\"scalarLen\"),v),r.call(o+\"_timesScalar\",j,r.getLocal(\"scalar\"),r.getLocal(\"scalarLen\"),y),r.call(o+\"_timesScalar\",nt,r.getLocal(\"scalar\"),r.getLocal(\"scalarLen\"),T))}function L(){let _=t.addFunction(n+\"_sub\");_.addParam(\"x\",\"i32\"),_.addParam(\"y\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"y\"),y=r.i32_add(r.getLocal(\"y\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"y\"),r.i32_const(2*d)),V=r.getLocal(\"r\"),rt=r.i32_add(r.getLocal(\"r\"),r.i32_const(d)),dt=r.i32_add(r.getLocal(\"r\"),r.i32_const(2*d));_.addCode(r.call(o+\"_sub\",Z,v,V),r.call(o+\"_sub\",j,y,rt),r.call(o+\"_sub\",nt,T,dt))}function l(){let _=t.addFunction(n+\"_neg\");_.addParam(\"x\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"r\"),y=r.i32_add(r.getLocal(\"r\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"r\"),r.i32_const(2*d));_.addCode(r.call(o+\"_neg\",Z,v),r.call(o+\"_neg\",j,y),r.call(o+\"_neg\",nt,T))}function s(){let _=t.addFunction(n+\"_isNegative\");_.addParam(\"x\",\"i32\"),_.setReturnType(\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d));_.addCode(r.if(r.call(o+\"_isZero\",nt),r.if(r.call(o+\"_isZero\",j),r.ret(r.call(o+\"_isNegative\",Z)),r.ret(r.call(o+\"_isNegative\",j)))),r.ret(r.call(o+\"_isNegative\",nt)))}function x(){let _=t.addFunction(n+\"_mul\");_.addParam(\"x\",\"i32\"),_.addParam(\"y\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"y\"),y=r.i32_add(r.getLocal(\"y\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"y\"),r.i32_const(2*d)),V=r.getLocal(\"r\"),rt=r.i32_add(r.getLocal(\"r\"),r.i32_const(d)),dt=r.i32_add(r.getLocal(\"r\"),r.i32_const(2*d)),ot=r.i32_const(t.alloc(d)),xt=r.i32_const(t.alloc(d)),pt=r.i32_const(t.alloc(d)),bt=r.i32_const(t.alloc(d)),vt=r.i32_const(t.alloc(d)),Pt=r.i32_const(t.alloc(d)),Ht=r.i32_const(t.alloc(d)),m=r.i32_const(t.alloc(d)),a=r.i32_const(t.alloc(d)),w=r.i32_const(t.alloc(d)),c=r.i32_const(t.alloc(d)),G=r.i32_const(t.alloc(d)),R=r.i32_const(t.alloc(d));_.addCode(r.call(o+\"_mul\",Z,v,ot),r.call(o+\"_mul\",j,y,xt),r.call(o+\"_mul\",nt,T,pt),r.call(o+\"_add\",Z,j,bt),r.call(o+\"_add\",v,y,vt),r.call(o+\"_add\",Z,nt,Pt),r.call(o+\"_add\",v,T,Ht),r.call(o+\"_add\",j,nt,m),r.call(o+\"_add\",y,T,a),r.call(o+\"_add\",ot,xt,w),r.call(o+\"_add\",ot,pt,c),r.call(o+\"_add\",xt,pt,G),r.call(o+\"_mul\",m,a,V),r.call(o+\"_sub\",V,G,V),r.call(e,V,V),r.call(o+\"_add\",ot,V,V),r.call(o+\"_mul\",bt,vt,rt),r.call(o+\"_sub\",rt,w,rt),r.call(e,pt,R),r.call(o+\"_add\",rt,R,rt),r.call(o+\"_mul\",Pt,Ht,dt),r.call(o+\"_sub\",dt,c,dt),r.call(o+\"_add\",dt,xt,dt))}function C(){let _=t.addFunction(n+\"_square\");_.addParam(\"x\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"r\"),y=r.i32_add(r.getLocal(\"r\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"r\"),r.i32_const(2*d)),V=r.i32_const(t.alloc(d)),rt=r.i32_const(t.alloc(d)),dt=r.i32_const(t.alloc(d)),ot=r.i32_const(t.alloc(d)),xt=r.i32_const(t.alloc(d)),pt=r.i32_const(t.alloc(d)),bt=r.i32_const(t.alloc(d));_.addCode(r.call(o+\"_square\",Z,V),r.call(o+\"_mul\",Z,j,rt),r.call(o+\"_add\",rt,rt,dt),r.call(o+\"_sub\",Z,j,ot),r.call(o+\"_add\",ot,nt,ot),r.call(o+\"_square\",ot,ot),r.call(o+\"_mul\",j,nt,xt),r.call(o+\"_add\",xt,xt,pt),r.call(o+\"_square\",nt,bt),r.call(e,pt,v),r.call(o+\"_add\",V,v,v),r.call(e,bt,y),r.call(o+\"_add\",dt,y,y),r.call(o+\"_add\",V,bt,T),r.call(o+\"_sub\",pt,T,T),r.call(o+\"_add\",ot,T,T),r.call(o+\"_add\",dt,T,T))}function g(){let _=t.addFunction(n+\"_toMontgomery\");_.addParam(\"x\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"r\"),y=r.i32_add(r.getLocal(\"r\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"r\"),r.i32_const(2*d));_.addCode(r.call(o+\"_toMontgomery\",Z,v),r.call(o+\"_toMontgomery\",j,y),r.call(o+\"_toMontgomery\",nt,T))}function $(){let _=t.addFunction(n+\"_fromMontgomery\");_.addParam(\"x\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"r\"),y=r.i32_add(r.getLocal(\"r\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"r\"),r.i32_const(2*d));_.addCode(r.call(o+\"_fromMontgomery\",Z,v),r.call(o+\"_fromMontgomery\",j,y),r.call(o+\"_fromMontgomery\",nt,T))}function it(){let _=t.addFunction(n+\"_copy\");_.addParam(\"x\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"r\"),y=r.i32_add(r.getLocal(\"r\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"r\"),r.i32_const(2*d));_.addCode(r.call(o+\"_copy\",Z,v),r.call(o+\"_copy\",j,y),r.call(o+\"_copy\",nt,T))}function q(){let _=t.addFunction(n+\"_zero\");_.addParam(\"x\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d));_.addCode(r.call(o+\"_zero\",Z),r.call(o+\"_zero\",j),r.call(o+\"_zero\",nt))}function S(){let _=t.addFunction(n+\"_one\");_.addParam(\"x\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d));_.addCode(r.call(o+\"_one\",Z),r.call(o+\"_zero\",j),r.call(o+\"_zero\",nt))}function O(){let _=t.addFunction(n+\"_eq\");_.addParam(\"x\",\"i32\"),_.addParam(\"y\",\"i32\"),_.setReturnType(\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"y\"),y=r.i32_add(r.getLocal(\"y\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"y\"),r.i32_const(2*d));_.addCode(r.i32_and(r.i32_and(r.call(o+\"_eq\",Z,v),r.call(o+\"_eq\",j,y)),r.call(o+\"_eq\",nt,T)))}function M(){let _=t.addFunction(n+\"_isZero\");_.addParam(\"x\",\"i32\"),_.setReturnType(\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d));_.addCode(r.i32_and(r.i32_and(r.call(o+\"_isZero\",Z),r.call(o+\"_isZero\",j)),r.call(o+\"_isZero\",nt)))}function W(){let _=t.addFunction(n+\"_inverse\");_.addParam(\"x\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"r\"),y=r.i32_add(r.getLocal(\"r\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"r\"),r.i32_const(2*d)),V=r.i32_const(t.alloc(d)),rt=r.i32_const(t.alloc(d)),dt=r.i32_const(t.alloc(d)),ot=r.i32_const(t.alloc(d)),xt=r.i32_const(t.alloc(d)),pt=r.i32_const(t.alloc(d)),bt=r.i32_const(t.alloc(d)),vt=r.i32_const(t.alloc(d)),Pt=r.i32_const(t.alloc(d)),Ht=r.i32_const(t.alloc(d)),m=r.i32_const(t.alloc(d));_.addCode(r.call(o+\"_square\",Z,V),r.call(o+\"_square\",j,rt),r.call(o+\"_square\",nt,dt),r.call(o+\"_mul\",Z,j,ot),r.call(o+\"_mul\",Z,nt,xt),r.call(o+\"_mul\",j,nt,pt),r.call(e,pt,bt),r.call(o+\"_sub\",V,bt,bt),r.call(e,dt,vt),r.call(o+\"_sub\",vt,ot,vt),r.call(o+\"_sub\",rt,xt,Pt),r.call(o+\"_mul\",nt,vt,Ht),r.call(o+\"_mul\",j,Pt,m),r.call(o+\"_add\",Ht,m,Ht),r.call(e,Ht,Ht),r.call(o+\"_mul\",Z,bt,m),r.call(o+\"_add\",m,Ht,Ht),r.call(o+\"_inverse\",Ht,Ht),r.call(o+\"_mul\",Ht,bt,v),r.call(o+\"_mul\",Ht,vt,y),r.call(o+\"_mul\",Ht,Pt,T))}function ct(){let _=t.addFunction(n+\"_sign\");_.addParam(\"x\",\"i32\"),_.addLocal(\"s\",\"i32\"),_.setReturnType(\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d));_.addCode(r.setLocal(\"s\",r.call(o+\"_sign\",nt)),r.if(r.getLocal(\"s\"),r.ret(r.getLocal(\"s\"))),r.setLocal(\"s\",r.call(o+\"_sign\",j)),r.if(r.getLocal(\"s\"),r.ret(r.getLocal(\"s\"))),r.ret(r.call(o+\"_sign\",Z)))}function E(){let _=t.addFunction(n+\"_isOne\");_.addParam(\"x\",\"i32\"),_.setReturnType(\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(d*2));_.addCode(r.ret(r.i32_and(r.i32_and(r.call(o+\"_isOne\",Z),r.call(o+\"_isZero\",j)),r.call(o+\"_isZero\",nt))))}return M(),E(),q(),S(),it(),x(),C(),h(),L(),l(),ct(),g(),$(),O(),W(),f(),s(),t.exportFunction(n+\"_isZero\"),t.exportFunction(n+\"_isOne\"),t.exportFunction(n+\"_zero\"),t.exportFunction(n+\"_one\"),t.exportFunction(n+\"_copy\"),t.exportFunction(n+\"_mul\"),t.exportFunction(n+\"_square\"),t.exportFunction(n+\"_add\"),t.exportFunction(n+\"_sub\"),t.exportFunction(n+\"_neg\"),t.exportFunction(n+\"_sign\"),t.exportFunction(n+\"_fromMontgomery\"),t.exportFunction(n+\"_toMontgomery\"),t.exportFunction(n+\"_eq\"),t.exportFunction(n+\"_inverse\"),ih(t,n),nh(t,n+\"_exp\",d*3,n+\"_mul\",n+\"_square\",n+\"_copy\",n+\"_one\"),t.exportFunction(n+\"_exp\"),t.exportFunction(n+\"_timesScalar\"),t.exportFunction(n+\"_batchInverse\"),t.exportFunction(n+\"_isNegative\"),n}});var Ol=Yt((xy,Rl)=>{Rl.exports=function(t,e,n,o,d,h,f,L){let l=t.addFunction(e);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\");let s=l.getCodeBuilder(),x=s.i32_const(t.alloc(n));function C($){return s.i32_and(s.i32_shr_u(s.i32_load(s.i32_add(s.getLocal(\"scalar\"),s.i32_and(s.i32_shr_u($,s.i32_const(3)),s.i32_const(4294967292)))),s.i32_and($,s.i32_const(31))),s.i32_const(1))}function g($){return[...s.i32_store8(s.getLocal(\"p\"),s.i32_const($)),...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(L,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\",C(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\",C(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)),...g(1)],[...s.setLocal(\"last\",s.i32_const(0)),...s.setLocal(\"carry\",s.i32_const(1)),...g(255)]),s.if(s.getLocal(\"carry\"),[...s.setLocal(\"last\",s.i32_const(0)),...s.setLocal(\"carry\",s.i32_const(1)),...g(255)],[...s.setLocal(\"last\",s.i32_const(0)),...s.setLocal(\"carry\",s.i32_const(0)),...g(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)),...g(0)],[...s.setLocal(\"last\",s.i32_const(1)),...s.setLocal(\"carry\",s.i32_const(0)),...g(0)]),s.if(s.getLocal(\"carry\"),[...s.setLocal(\"last\",s.i32_const(1)),...s.setLocal(\"carry\",s.i32_const(0)),...g(0)],[...s.setLocal(\"last\",s.i32_const(0)),...s.setLocal(\"carry\",s.i32_const(0)),...g(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\"),[...g(255),...g(0),...g(1)],[...g(1)]),s.if(s.getLocal(\"carry\"),[...g(0),...g(1)])),s.setLocal(\"p\",s.i32_sub(s.getLocal(\"p\"),s.i32_const(1))),s.call(f,s.getLocal(\"base\"),x),s.call(L,s.getLocal(\"r\")),s.block(s.loop(s.call(d,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(o,s.getLocal(\"r\"),x,s.getLocal(\"r\")),s.call(h,s.getLocal(\"r\"),x,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\")))}});var zl=Yt((Iy,Pl)=>{Pl.exports=function(t,e,n,o,d){let f=t.modules[e].n64*8;function L(){let C=t.addFunction(n+\"_getChunk\");C.addParam(\"pScalar\",\"i32\"),C.addParam(\"scalarSize\",\"i32\"),C.addParam(\"startBit\",\"i32\"),C.addParam(\"chunkSize\",\"i32\"),C.addLocal(\"bitsToEnd\",\"i32\"),C.addLocal(\"mask\",\"i32\"),C.setReturnType(\"i32\");let g=C.getCodeBuilder();C.addCode(g.setLocal(\"bitsToEnd\",g.i32_sub(g.i32_mul(g.getLocal(\"scalarSize\"),g.i32_const(8)),g.getLocal(\"startBit\"))),g.if(g.i32_gt_s(g.getLocal(\"chunkSize\"),g.getLocal(\"bitsToEnd\")),g.setLocal(\"mask\",g.i32_sub(g.i32_shl(g.i32_const(1),g.getLocal(\"bitsToEnd\")),g.i32_const(1))),g.setLocal(\"mask\",g.i32_sub(g.i32_shl(g.i32_const(1),g.getLocal(\"chunkSize\")),g.i32_const(1)))),g.i32_and(g.i32_shr_u(g.i32_load(g.i32_add(g.getLocal(\"pScalar\"),g.i32_shr_u(g.getLocal(\"startBit\"),g.i32_const(3))),0,0),g.i32_and(g.getLocal(\"startBit\"),g.i32_const(7))),g.getLocal(\"mask\")))}function l(){let C=t.addFunction(n+\"_chunk\");C.addParam(\"pBases\",\"i32\"),C.addParam(\"pScalars\",\"i32\"),C.addParam(\"scalarSize\",\"i32\"),C.addParam(\"n\",\"i32\"),C.addParam(\"startBit\",\"i32\"),C.addParam(\"chunkSize\",\"i32\"),C.addParam(\"pr\",\"i32\"),C.addLocal(\"nChunks\",\"i32\"),C.addLocal(\"itScalar\",\"i32\"),C.addLocal(\"endScalar\",\"i32\"),C.addLocal(\"itBase\",\"i32\"),C.addLocal(\"i\",\"i32\"),C.addLocal(\"j\",\"i32\"),C.addLocal(\"nTable\",\"i32\"),C.addLocal(\"pTable\",\"i32\"),C.addLocal(\"idx\",\"i32\"),C.addLocal(\"pIdxTable\",\"i32\");let g=C.getCodeBuilder();C.addCode(g.if(g.i32_eqz(g.getLocal(\"n\")),[...g.call(e+\"_zero\",g.getLocal(\"pr\")),...g.ret([])]),g.setLocal(\"nTable\",g.i32_shl(g.i32_const(1),g.getLocal(\"chunkSize\"))),g.setLocal(\"pTable\",g.i32_load(g.i32_const(0))),g.i32_store(g.i32_const(0),g.i32_add(g.getLocal(\"pTable\"),g.i32_mul(g.getLocal(\"nTable\"),g.i32_const(f)))),g.setLocal(\"j\",g.i32_const(0)),g.block(g.loop(g.br_if(1,g.i32_eq(g.getLocal(\"j\"),g.getLocal(\"nTable\"))),g.call(e+\"_zero\",g.i32_add(g.getLocal(\"pTable\"),g.i32_mul(g.getLocal(\"j\"),g.i32_const(f)))),g.setLocal(\"j\",g.i32_add(g.getLocal(\"j\"),g.i32_const(1))),g.br(0))),g.setLocal(\"itBase\",g.getLocal(\"pBases\")),g.setLocal(\"itScalar\",g.getLocal(\"pScalars\")),g.setLocal(\"endScalar\",g.i32_add(g.getLocal(\"pScalars\"),g.i32_mul(g.getLocal(\"n\"),g.getLocal(\"scalarSize\")))),g.block(g.loop(g.br_if(1,g.i32_eq(g.getLocal(\"itScalar\"),g.getLocal(\"endScalar\"))),g.setLocal(\"idx\",g.call(n+\"_getChunk\",g.getLocal(\"itScalar\"),g.getLocal(\"scalarSize\"),g.getLocal(\"startBit\"),g.getLocal(\"chunkSize\"))),g.if(g.getLocal(\"idx\"),[...g.setLocal(\"pIdxTable\",g.i32_add(g.getLocal(\"pTable\"),g.i32_mul(g.i32_sub(g.getLocal(\"idx\"),g.i32_const(1)),g.i32_const(f)))),...g.call(o,g.getLocal(\"pIdxTable\"),g.getLocal(\"itBase\"),g.getLocal(\"pIdxTable\"))]),g.setLocal(\"itScalar\",g.i32_add(g.getLocal(\"itScalar\"),g.getLocal(\"scalarSize\"))),g.setLocal(\"itBase\",g.i32_add(g.getLocal(\"itBase\"),g.i32_const(d))),g.br(0))),g.call(n+\"_reduceTable\",g.getLocal(\"pTable\"),g.getLocal(\"chunkSize\")),g.call(e+\"_copy\",g.getLocal(\"pTable\"),g.getLocal(\"pr\")),g.i32_store(g.i32_const(0),g.getLocal(\"pTable\")))}function s(){let C=t.addFunction(n);C.addParam(\"pBases\",\"i32\"),C.addParam(\"pScalars\",\"i32\"),C.addParam(\"scalarSize\",\"i32\"),C.addParam(\"n\",\"i32\"),C.addParam(\"pr\",\"i32\"),C.addLocal(\"chunkSize\",\"i32\"),C.addLocal(\"nChunks\",\"i32\"),C.addLocal(\"itScalar\",\"i32\"),C.addLocal(\"endScalar\",\"i32\"),C.addLocal(\"itBase\",\"i32\"),C.addLocal(\"itBit\",\"i32\"),C.addLocal(\"i\",\"i32\"),C.addLocal(\"j\",\"i32\"),C.addLocal(\"nTable\",\"i32\"),C.addLocal(\"pTable\",\"i32\"),C.addLocal(\"idx\",\"i32\"),C.addLocal(\"pIdxTable\",\"i32\");let g=C.getCodeBuilder(),$=g.i32_const(t.alloc(f)),it=t.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]);C.addCode(g.call(e+\"_zero\",g.getLocal(\"pr\")),g.if(g.i32_eqz(g.getLocal(\"n\")),g.ret([])),g.setLocal(\"chunkSize\",g.i32_load8_u(g.i32_clz(g.getLocal(\"n\")),it)),g.setLocal(\"nChunks\",g.i32_add(g.i32_div_u(g.i32_sub(g.i32_shl(g.getLocal(\"scalarSize\"),g.i32_const(3)),g.i32_const(1)),g.getLocal(\"chunkSize\")),g.i32_const(1))),g.setLocal(\"itBit\",g.i32_mul(g.i32_sub(g.getLocal(\"nChunks\"),g.i32_const(1)),g.getLocal(\"chunkSize\"))),g.block(g.loop(g.br_if(1,g.i32_lt_s(g.getLocal(\"itBit\"),g.i32_const(0))),g.if(g.i32_eqz(g.call(e+\"_isZero\",g.getLocal(\"pr\"))),[...g.setLocal(\"j\",g.i32_const(0)),...g.block(g.loop(g.br_if(1,g.i32_eq(g.getLocal(\"j\"),g.getLocal(\"chunkSize\"))),g.call(e+\"_double\",g.getLocal(\"pr\"),g.getLocal(\"pr\")),g.setLocal(\"j\",g.i32_add(g.getLocal(\"j\"),g.i32_const(1))),g.br(0)))]),g.call(n+\"_chunk\",g.getLocal(\"pBases\"),g.getLocal(\"pScalars\"),g.getLocal(\"scalarSize\"),g.getLocal(\"n\"),g.getLocal(\"itBit\"),g.getLocal(\"chunkSize\"),$),g.call(e+\"_add\",g.getLocal(\"pr\"),$,g.getLocal(\"pr\")),g.setLocal(\"itBit\",g.i32_sub(g.getLocal(\"itBit\"),g.getLocal(\"chunkSize\"))),g.br(0))))}function x(){let C=t.addFunction(n+\"_reduceTable\");C.addParam(\"pTable\",\"i32\"),C.addParam(\"p\",\"i32\"),C.addLocal(\"half\",\"i32\"),C.addLocal(\"it1\",\"i32\"),C.addLocal(\"it2\",\"i32\"),C.addLocal(\"pAcc\",\"i32\");let g=C.getCodeBuilder();C.addCode(g.if(g.i32_eq(g.getLocal(\"p\"),g.i32_const(1)),g.ret([])),g.setLocal(\"half\",g.i32_shl(g.i32_const(1),g.i32_sub(g.getLocal(\"p\"),g.i32_const(1)))),g.setLocal(\"it1\",g.getLocal(\"pTable\")),g.setLocal(\"it2\",g.i32_add(g.getLocal(\"pTable\"),g.i32_mul(g.getLocal(\"half\"),g.i32_const(f)))),g.setLocal(\"pAcc\",g.i32_sub(g.getLocal(\"it2\"),g.i32_const(f))),g.block(g.loop(g.br_if(1,g.i32_eq(g.getLocal(\"it1\"),g.getLocal(\"pAcc\"))),g.call(e+\"_add\",g.getLocal(\"it1\"),g.getLocal(\"it2\"),g.getLocal(\"it1\")),g.call(e+\"_add\",g.getLocal(\"pAcc\"),g.getLocal(\"it2\"),g.getLocal(\"pAcc\")),g.setLocal(\"it1\",g.i32_add(g.getLocal(\"it1\"),g.i32_const(f))),g.setLocal(\"it2\",g.i32_add(g.getLocal(\"it2\"),g.i32_const(f))),g.br(0))),g.call(n+\"_reduceTable\",g.getLocal(\"pTable\"),g.i32_sub(g.getLocal(\"p\"),g.i32_const(1))),g.setLocal(\"p\",g.i32_sub(g.getLocal(\"p\"),g.i32_const(1))),g.block(g.loop(g.br_if(1,g.i32_eqz(g.getLocal(\"p\"))),g.call(e+\"_double\",g.getLocal(\"pAcc\"),g.getLocal(\"pAcc\")),g.setLocal(\"p\",g.i32_sub(g.getLocal(\"p\"),g.i32_const(1))),g.br(0))),g.call(e+\"_add\",g.getLocal(\"pTable\"),g.getLocal(\"pAcc\"),g.getLocal(\"pTable\")))}L(),x(),l(),s(),t.exportFunction(n),t.exportFunction(n+\"_chunk\")}});var vs=Yt((Ey,Tl)=>{var Ml=Ol(),la=bs(),Gl=zl();Tl.exports=function(t,e,n,o){let d=t.modules[n].n64,h=d*8;if(t.modules[e])return e;t.modules[e]={n64:d*3};function f(){let m=t.addFunction(e+\"_isZero\");m.addParam(\"p1\",\"i32\"),m.setReturnType(\"i32\");let a=m.getCodeBuilder();m.addCode(a.call(n+\"_isZero\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(h*2))))}function L(){let m=t.addFunction(e+\"_isZeroAffine\");m.addParam(\"p1\",\"i32\"),m.setReturnType(\"i32\");let a=m.getCodeBuilder();m.addCode(a.i32_and(a.call(n+\"_isZero\",a.getLocal(\"p1\")),a.call(n+\"_isZero\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(h)))))}function l(){let m=t.addFunction(e+\"_copy\");m.addParam(\"ps\",\"i32\"),m.addParam(\"pd\",\"i32\");let a=m.getCodeBuilder();for(let w=0;w<d*3;w++)m.addCode(a.i64_store(a.getLocal(\"pd\"),w*8,a.i64_load(a.getLocal(\"ps\"),w*8)))}function s(){let m=t.addFunction(e+\"_copyAffine\");m.addParam(\"ps\",\"i32\"),m.addParam(\"pd\",\"i32\");let a=m.getCodeBuilder();for(let w=0;w<d*2;w++)m.addCode(a.i64_store(a.getLocal(\"pd\"),w*8,a.i64_load(a.getLocal(\"ps\"),w*8)))}function x(){let m=t.addFunction(e+\"_zero\");m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder();m.addCode(a.call(n+\"_zero\",a.getLocal(\"pr\"))),m.addCode(a.call(n+\"_one\",a.i32_add(a.getLocal(\"pr\"),a.i32_const(h)))),m.addCode(a.call(n+\"_zero\",a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2))))}function C(){let m=t.addFunction(e+\"_zeroAffine\");m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder();m.addCode(a.call(n+\"_zero\",a.getLocal(\"pr\"))),m.addCode(a.call(n+\"_zero\",a.i32_add(a.getLocal(\"pr\"),a.i32_const(h))))}function g(){let m=t.addFunction(e+\"_eq\");m.addParam(\"p1\",\"i32\"),m.addParam(\"p2\",\"i32\"),m.setReturnType(\"i32\"),m.addLocal(\"z1\",\"i32\"),m.addLocal(\"z2\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h));m.addCode(a.setLocal(\"z1\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(h*2))));let G=a.getLocal(\"z1\"),R=a.getLocal(\"p2\"),F=a.i32_add(a.getLocal(\"p2\"),a.i32_const(h));m.addCode(a.setLocal(\"z2\",a.i32_add(a.getLocal(\"p2\"),a.i32_const(h*2))));let U=a.getLocal(\"z2\"),A=a.i32_const(t.alloc(h)),et=a.i32_const(t.alloc(h)),Lt=a.i32_const(t.alloc(h)),St=a.i32_const(t.alloc(h)),qt=a.i32_const(t.alloc(h)),Dt=a.i32_const(t.alloc(h)),kt=a.i32_const(t.alloc(h)),Bt=a.i32_const(t.alloc(h));m.addCode(a.if(a.call(e+\"_isZero\",a.getLocal(\"p1\")),a.ret(a.call(e+\"_isZero\",a.getLocal(\"p2\")))),a.if(a.call(e+\"_isZero\",a.getLocal(\"p2\")),a.ret(a.i32_const(0))),a.if(a.call(n+\"_isOne\",G),a.ret(a.call(e+\"_eqMixed\",a.getLocal(\"p2\"),a.getLocal(\"p1\")))),a.if(a.call(n+\"_isOne\",U),a.ret(a.call(e+\"_eqMixed\",a.getLocal(\"p1\"),a.getLocal(\"p2\")))),a.call(n+\"_square\",G,A),a.call(n+\"_square\",U,et),a.call(n+\"_mul\",w,et,Lt),a.call(n+\"_mul\",R,A,St),a.call(n+\"_mul\",G,A,qt),a.call(n+\"_mul\",U,et,Dt),a.call(n+\"_mul\",c,Dt,kt),a.call(n+\"_mul\",F,qt,Bt),a.if(a.call(n+\"_eq\",Lt,St),a.if(a.call(n+\"_eq\",kt,Bt),a.ret(a.i32_const(1)))),a.ret(a.i32_const(0)))}function $(){let m=t.addFunction(e+\"_eqMixed\");m.addParam(\"p1\",\"i32\"),m.addParam(\"p2\",\"i32\"),m.setReturnType(\"i32\"),m.addLocal(\"z1\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h));m.addCode(a.setLocal(\"z1\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(h*2))));let G=a.getLocal(\"z1\"),R=a.getLocal(\"p2\"),F=a.i32_add(a.getLocal(\"p2\"),a.i32_const(h)),U=a.i32_const(t.alloc(h)),A=a.i32_const(t.alloc(h)),et=a.i32_const(t.alloc(h)),Lt=a.i32_const(t.alloc(h));m.addCode(a.if(a.call(e+\"_isZero\",a.getLocal(\"p1\")),a.ret(a.call(e+\"_isZeroAffine\",a.getLocal(\"p2\")))),a.if(a.call(e+\"_isZeroAffine\",a.getLocal(\"p2\")),a.ret(a.i32_const(0))),a.if(a.call(n+\"_isOne\",G),a.ret(a.call(e+\"_eqAffine\",a.getLocal(\"p1\"),a.getLocal(\"p2\")))),a.call(n+\"_square\",G,U),a.call(n+\"_mul\",R,U,A),a.call(n+\"_mul\",G,U,et),a.call(n+\"_mul\",F,et,Lt),a.if(a.call(n+\"_eq\",w,A),a.if(a.call(n+\"_eq\",c,Lt),a.ret(a.i32_const(1)))),a.ret(a.i32_const(0)))}function it(){let m=t.addFunction(e+\"_double\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h)),G=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h*2)),R=a.getLocal(\"pr\"),F=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h)),U=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2)),A=a.i32_const(t.alloc(h)),et=a.i32_const(t.alloc(h)),Lt=a.i32_const(t.alloc(h)),St=a.i32_const(t.alloc(h)),qt=a.i32_const(t.alloc(h)),Dt=a.i32_const(t.alloc(h)),kt=a.i32_const(t.alloc(h)),Bt=a.i32_const(t.alloc(h));m.addCode(a.if(a.call(e+\"_isZero\",a.getLocal(\"p1\")),[...a.call(e+\"_copy\",a.getLocal(\"p1\"),a.getLocal(\"pr\")),...a.ret([])]),a.if(a.call(n+\"_isOne\",G),[...a.ret(a.call(e+\"_doubleAffine\",a.getLocal(\"p1\"),a.getLocal(\"pr\"))),...a.ret([])]),a.call(n+\"_square\",w,A),a.call(n+\"_square\",c,et),a.call(n+\"_square\",et,Lt),a.call(n+\"_add\",w,et,St),a.call(n+\"_square\",St,St),a.call(n+\"_sub\",St,A,St),a.call(n+\"_sub\",St,Lt,St),a.call(n+\"_add\",St,St,St),a.call(n+\"_add\",A,A,qt),a.call(n+\"_add\",qt,A,qt),a.call(n+\"_square\",qt,Dt),a.call(n+\"_mul\",c,G,kt),a.call(n+\"_add\",St,St,R),a.call(n+\"_sub\",Dt,R,R),a.call(n+\"_add\",Lt,Lt,Bt),a.call(n+\"_add\",Bt,Bt,Bt),a.call(n+\"_add\",Bt,Bt,Bt),a.call(n+\"_sub\",St,R,F),a.call(n+\"_mul\",F,qt,F),a.call(n+\"_sub\",F,Bt,F),a.call(n+\"_add\",kt,kt,U))}function q(){let m=t.addFunction(e+\"_doubleAffine\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h)),G=a.getLocal(\"pr\"),R=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h)),F=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2)),U=a.i32_const(t.alloc(h)),A=a.i32_const(t.alloc(h)),et=a.i32_const(t.alloc(h)),Lt=a.i32_const(t.alloc(h)),St=a.i32_const(t.alloc(h)),qt=a.i32_const(t.alloc(h));m.addCode(a.if(a.call(e+\"_isZeroAffine\",a.getLocal(\"p1\")),[...a.call(e+\"_toJacobian\",a.getLocal(\"p1\"),a.getLocal(\"pr\")),...a.ret([])]),a.call(n+\"_square\",w,U),a.call(n+\"_square\",c,A),a.call(n+\"_square\",A,et),a.call(n+\"_add\",w,A,Lt),a.call(n+\"_square\",Lt,Lt),a.call(n+\"_sub\",Lt,U,Lt),a.call(n+\"_sub\",Lt,et,Lt),a.call(n+\"_add\",Lt,Lt,Lt),a.call(n+\"_add\",U,U,St),a.call(n+\"_add\",St,U,St),a.call(n+\"_add\",c,c,F),a.call(n+\"_square\",St,G),a.call(n+\"_sub\",G,Lt,G),a.call(n+\"_sub\",G,Lt,G),a.call(n+\"_add\",et,et,qt),a.call(n+\"_add\",qt,qt,qt),a.call(n+\"_add\",qt,qt,qt),a.call(n+\"_sub\",Lt,G,R),a.call(n+\"_mul\",R,St,R),a.call(n+\"_sub\",R,qt,R))}function S(){let m=t.addFunction(e+\"_eqAffine\");m.addParam(\"p1\",\"i32\"),m.addParam(\"p2\",\"i32\"),m.setReturnType(\"i32\"),m.addLocal(\"z1\",\"i32\");let a=m.getCodeBuilder();m.addCode(a.ret(a.i32_and(a.call(n+\"_eq\",a.getLocal(\"p1\"),a.getLocal(\"p2\")),a.call(n+\"_eq\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(h)),a.i32_add(a.getLocal(\"p2\"),a.i32_const(h))))))}function O(){let m=t.addFunction(e+\"_toMontgomery\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder();m.addCode(a.call(n+\"_toMontgomery\",a.getLocal(\"p1\"),a.getLocal(\"pr\")));for(let w=1;w<3;w++)m.addCode(a.call(n+\"_toMontgomery\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(w*h)),a.i32_add(a.getLocal(\"pr\"),a.i32_const(w*h))))}function M(){let m=t.addFunction(e+\"_toMontgomeryAffine\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder();m.addCode(a.call(n+\"_toMontgomery\",a.getLocal(\"p1\"),a.getLocal(\"pr\")));for(let w=1;w<2;w++)m.addCode(a.call(n+\"_toMontgomery\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(w*h)),a.i32_add(a.getLocal(\"pr\"),a.i32_const(w*h))))}function W(){let m=t.addFunction(e+\"_fromMontgomery\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder();m.addCode(a.call(n+\"_fromMontgomery\",a.getLocal(\"p1\"),a.getLocal(\"pr\")));for(let w=1;w<3;w++)m.addCode(a.call(n+\"_fromMontgomery\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(w*h)),a.i32_add(a.getLocal(\"pr\"),a.i32_const(w*h))))}function ct(){let m=t.addFunction(e+\"_fromMontgomeryAffine\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder();m.addCode(a.call(n+\"_fromMontgomery\",a.getLocal(\"p1\"),a.getLocal(\"pr\")));for(let w=1;w<2;w++)m.addCode(a.call(n+\"_fromMontgomery\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(w*h)),a.i32_add(a.getLocal(\"pr\"),a.i32_const(w*h))))}function E(){let m=t.addFunction(e+\"_add\");m.addParam(\"p1\",\"i32\"),m.addParam(\"p2\",\"i32\"),m.addParam(\"pr\",\"i32\"),m.addLocal(\"z1\",\"i32\"),m.addLocal(\"z2\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h));m.addCode(a.setLocal(\"z1\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(h*2))));let G=a.getLocal(\"z1\"),R=a.getLocal(\"p2\"),F=a.i32_add(a.getLocal(\"p2\"),a.i32_const(h));m.addCode(a.setLocal(\"z2\",a.i32_add(a.getLocal(\"p2\"),a.i32_const(h*2))));let U=a.getLocal(\"z2\"),A=a.getLocal(\"pr\"),et=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h)),Lt=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2)),St=a.i32_const(t.alloc(h)),qt=a.i32_const(t.alloc(h)),Dt=a.i32_const(t.alloc(h)),kt=a.i32_const(t.alloc(h)),Bt=a.i32_const(t.alloc(h)),Tt=a.i32_const(t.alloc(h)),wt=a.i32_const(t.alloc(h)),Rt=a.i32_const(t.alloc(h)),I=a.i32_const(t.alloc(h)),z=a.i32_const(t.alloc(h)),J=a.i32_const(t.alloc(h)),st=a.i32_const(t.alloc(h)),mt=a.i32_const(t.alloc(h)),_t=a.i32_const(t.alloc(h)),It=a.i32_const(t.alloc(h)),Et=a.i32_const(t.alloc(h)),Ct=a.i32_const(t.alloc(h));m.addCode(a.if(a.call(e+\"_isZero\",a.getLocal(\"p1\")),[...a.call(e+\"_copy\",a.getLocal(\"p2\"),a.getLocal(\"pr\")),...a.ret([])]),a.if(a.call(e+\"_isZero\",a.getLocal(\"p2\")),[...a.call(e+\"_copy\",a.getLocal(\"p1\"),a.getLocal(\"pr\")),...a.ret([])]),a.if(a.call(n+\"_isOne\",G),[...a.call(e+\"_addMixed\",R,w,A),...a.ret([])]),a.if(a.call(n+\"_isOne\",U),[...a.call(e+\"_addMixed\",w,R,A),...a.ret([])]),a.call(n+\"_square\",G,St),a.call(n+\"_square\",U,qt),a.call(n+\"_mul\",w,qt,Dt),a.call(n+\"_mul\",R,St,kt),a.call(n+\"_mul\",G,St,Bt),a.call(n+\"_mul\",U,qt,Tt),a.call(n+\"_mul\",c,Tt,wt),a.call(n+\"_mul\",F,Bt,Rt),a.if(a.call(n+\"_eq\",Dt,kt),a.if(a.call(n+\"_eq\",wt,Rt),[...a.call(e+\"_double\",a.getLocal(\"p1\"),a.getLocal(\"pr\")),...a.ret([])])),a.call(n+\"_sub\",kt,Dt,I),a.call(n+\"_sub\",Rt,wt,z),a.call(n+\"_add\",I,I,J),a.call(n+\"_square\",J,J),a.call(n+\"_mul\",I,J,st),a.call(n+\"_add\",z,z,mt),a.call(n+\"_mul\",Dt,J,It),a.call(n+\"_square\",mt,_t),a.call(n+\"_add\",It,It,Et),a.call(n+\"_sub\",_t,st,A),a.call(n+\"_sub\",A,Et,A),a.call(n+\"_mul\",wt,st,Ct),a.call(n+\"_add\",Ct,Ct,Ct),a.call(n+\"_sub\",It,A,et),a.call(n+\"_mul\",et,mt,et),a.call(n+\"_sub\",et,Ct,et),a.call(n+\"_add\",G,U,Lt),a.call(n+\"_square\",Lt,Lt),a.call(n+\"_sub\",Lt,St,Lt),a.call(n+\"_sub\",Lt,qt,Lt),a.call(n+\"_mul\",Lt,I,Lt))}function _(){let m=t.addFunction(e+\"_addMixed\");m.addParam(\"p1\",\"i32\"),m.addParam(\"p2\",\"i32\"),m.addParam(\"pr\",\"i32\"),m.addLocal(\"z1\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h));m.addCode(a.setLocal(\"z1\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(h*2))));let G=a.getLocal(\"z1\"),R=a.getLocal(\"p2\"),F=a.i32_add(a.getLocal(\"p2\"),a.i32_const(h)),U=a.getLocal(\"pr\"),A=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h)),et=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2)),Lt=a.i32_const(t.alloc(h)),St=a.i32_const(t.alloc(h)),qt=a.i32_const(t.alloc(h)),Dt=a.i32_const(t.alloc(h)),kt=a.i32_const(t.alloc(h)),Bt=a.i32_const(t.alloc(h)),Tt=a.i32_const(t.alloc(h)),wt=a.i32_const(t.alloc(h)),Rt=a.i32_const(t.alloc(h)),I=a.i32_const(t.alloc(h)),z=a.i32_const(t.alloc(h)),J=a.i32_const(t.alloc(h)),st=a.i32_const(t.alloc(h)),mt=a.i32_const(t.alloc(h));m.addCode(a.if(a.call(e+\"_isZero\",a.getLocal(\"p1\")),[...a.call(e+\"_copyAffine\",a.getLocal(\"p2\"),a.getLocal(\"pr\")),...a.call(n+\"_one\",a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2))),...a.ret([])]),a.if(a.call(e+\"_isZeroAffine\",a.getLocal(\"p2\")),[...a.call(e+\"_copy\",a.getLocal(\"p1\"),a.getLocal(\"pr\")),...a.ret([])]),a.if(a.call(n+\"_isOne\",G),[...a.call(e+\"_addAffine\",w,R,U),...a.ret([])]),a.call(n+\"_square\",G,Lt),a.call(n+\"_mul\",R,Lt,St),a.call(n+\"_mul\",G,Lt,qt),a.call(n+\"_mul\",F,qt,Dt),a.if(a.call(n+\"_eq\",w,St),a.if(a.call(n+\"_eq\",c,Dt),[...a.call(e+\"_doubleAffine\",a.getLocal(\"p2\"),a.getLocal(\"pr\")),...a.ret([])])),a.call(n+\"_sub\",St,w,kt),a.call(n+\"_sub\",Dt,c,Tt),a.call(n+\"_square\",kt,Bt),a.call(n+\"_add\",Bt,Bt,wt),a.call(n+\"_add\",wt,wt,wt),a.call(n+\"_mul\",kt,wt,Rt),a.call(n+\"_add\",Tt,Tt,I),a.call(n+\"_mul\",w,wt,J),a.call(n+\"_square\",I,z),a.call(n+\"_add\",J,J,st),a.call(n+\"_sub\",z,Rt,U),a.call(n+\"_sub\",U,st,U),a.call(n+\"_mul\",c,Rt,mt),a.call(n+\"_add\",mt,mt,mt),a.call(n+\"_sub\",J,U,A),a.call(n+\"_mul\",A,I,A),a.call(n+\"_sub\",A,mt,A),a.call(n+\"_add\",G,kt,et),a.call(n+\"_square\",et,et),a.call(n+\"_sub\",et,Lt,et),a.call(n+\"_sub\",et,Bt,et))}function r(){let m=t.addFunction(e+\"_addAffine\");m.addParam(\"p1\",\"i32\"),m.addParam(\"p2\",\"i32\"),m.addParam(\"pr\",\"i32\"),m.addLocal(\"z1\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h));m.addCode(a.setLocal(\"z1\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(h*2))));let G=a.getLocal(\"p2\"),R=a.i32_add(a.getLocal(\"p2\"),a.i32_const(h)),F=a.getLocal(\"pr\"),U=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h)),A=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2)),et=a.i32_const(t.alloc(h)),Lt=a.i32_const(t.alloc(h)),St=a.i32_const(t.alloc(h)),qt=a.i32_const(t.alloc(h)),Dt=a.i32_const(t.alloc(h)),kt=a.i32_const(t.alloc(h)),Bt=a.i32_const(t.alloc(h)),Tt=a.i32_const(t.alloc(h)),wt=a.i32_const(t.alloc(h)),Rt=a.i32_const(t.alloc(h));m.addCode(a.if(a.call(e+\"_isZeroAffine\",a.getLocal(\"p1\")),[...a.call(e+\"_copyAffine\",a.getLocal(\"p2\"),a.getLocal(\"pr\")),...a.call(n+\"_one\",a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2))),...a.ret([])]),a.if(a.call(e+\"_isZeroAffine\",a.getLocal(\"p2\")),[...a.call(e+\"_copyAffine\",a.getLocal(\"p1\"),a.getLocal(\"pr\")),...a.call(n+\"_one\",a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2))),...a.ret([])]),a.if(a.call(n+\"_eq\",w,G),a.if(a.call(n+\"_eq\",c,R),[...a.call(e+\"_doubleAffine\",a.getLocal(\"p2\"),a.getLocal(\"pr\")),...a.ret([])])),a.call(n+\"_sub\",G,w,et),a.call(n+\"_sub\",R,c,St),a.call(n+\"_square\",et,Lt),a.call(n+\"_add\",Lt,Lt,qt),a.call(n+\"_add\",qt,qt,qt),a.call(n+\"_mul\",et,qt,Dt),a.call(n+\"_add\",St,St,kt),a.call(n+\"_mul\",w,qt,Tt),a.call(n+\"_square\",kt,Bt),a.call(n+\"_add\",Tt,Tt,wt),a.call(n+\"_sub\",Bt,Dt,F),a.call(n+\"_sub\",F,wt,F),a.call(n+\"_mul\",c,Dt,Rt),a.call(n+\"_add\",Rt,Rt,Rt),a.call(n+\"_sub\",Tt,F,U),a.call(n+\"_mul\",U,kt,U),a.call(n+\"_sub\",U,Rt,U),a.call(n+\"_add\",et,et,A))}function Z(){let m=t.addFunction(e+\"_neg\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h)),G=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h*2)),R=a.getLocal(\"pr\"),F=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h)),U=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2));m.addCode(a.call(n+\"_copy\",w,R),a.call(n+\"_neg\",c,F),a.call(n+\"_copy\",G,U))}function j(){let m=t.addFunction(e+\"_negAffine\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h)),G=a.getLocal(\"pr\"),R=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h));m.addCode(a.call(n+\"_copy\",w,G),a.call(n+\"_neg\",c,R))}function nt(){let m=t.addFunction(e+\"_sub\");m.addParam(\"p1\",\"i32\"),m.addParam(\"p2\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder(),w=a.i32_const(t.alloc(h*3));m.addCode(a.call(e+\"_neg\",a.getLocal(\"p2\"),w),a.call(e+\"_add\",a.getLocal(\"p1\"),w,a.getLocal(\"pr\")))}function v(){let m=t.addFunction(e+\"_subMixed\");m.addParam(\"p1\",\"i32\"),m.addParam(\"p2\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder(),w=a.i32_const(t.alloc(h*3));m.addCode(a.call(e+\"_negAffine\",a.getLocal(\"p2\"),w),a.call(e+\"_addMixed\",a.getLocal(\"p1\"),w,a.getLocal(\"pr\")))}function y(){let m=t.addFunction(e+\"_subAffine\");m.addParam(\"p1\",\"i32\"),m.addParam(\"p2\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder(),w=a.i32_const(t.alloc(h*3));m.addCode(a.call(e+\"_negAffine\",a.getLocal(\"p2\"),w),a.call(e+\"_addAffine\",a.getLocal(\"p1\"),w,a.getLocal(\"pr\")))}function T(){let m=t.addFunction(e+\"_normalize\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h)),G=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h*2)),R=a.getLocal(\"pr\"),F=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h)),U=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2)),A=a.i32_const(t.alloc(h)),et=a.i32_const(t.alloc(h)),Lt=a.i32_const(t.alloc(h));m.addCode(a.if(a.call(e+\"_isZero\",a.getLocal(\"p1\")),a.call(e+\"_zero\",a.getLocal(\"pr\")),[...a.call(n+\"_inverse\",G,A),...a.call(n+\"_square\",A,et),...a.call(n+\"_mul\",A,et,Lt),...a.call(n+\"_mul\",w,et,R),...a.call(n+\"_mul\",c,Lt,F),...a.call(n+\"_one\",U)]))}function V(){let m=t.addFunction(e+\"_toAffine\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h)),G=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h*2)),R=a.getLocal(\"pr\"),F=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h)),U=a.i32_const(t.alloc(h)),A=a.i32_const(t.alloc(h)),et=a.i32_const(t.alloc(h));m.addCode(a.if(a.call(e+\"_isZero\",a.getLocal(\"p1\")),[...a.call(n+\"_zero\",R),...a.call(n+\"_zero\",F)],[...a.call(n+\"_inverse\",G,U),...a.call(n+\"_square\",U,A),...a.call(n+\"_mul\",U,A,et),...a.call(n+\"_mul\",w,A,R),...a.call(n+\"_mul\",c,et,F)]))}function rt(){let m=t.addFunction(e+\"_toJacobian\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h)),G=a.getLocal(\"pr\"),R=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h)),F=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2));m.addCode(a.if(a.call(e+\"_isZeroAffine\",a.getLocal(\"p1\")),a.call(e+\"_zero\",a.getLocal(\"pr\")),[...a.call(n+\"_one\",F),...a.call(n+\"_copy\",c,R),...a.call(n+\"_copy\",w,G)]))}function dt(){let m=t.addFunction(e+\"_batchToAffine\");m.addParam(\"pIn\",\"i32\"),m.addParam(\"n\",\"i32\"),m.addParam(\"pOut\",\"i32\"),m.addLocal(\"pAux\",\"i32\"),m.addLocal(\"itIn\",\"i32\"),m.addLocal(\"itAux\",\"i32\"),m.addLocal(\"itOut\",\"i32\"),m.addLocal(\"i\",\"i32\");let a=m.getCodeBuilder(),w=a.i32_const(t.alloc(h));m.addCode(a.setLocal(\"pAux\",a.i32_load(a.i32_const(0))),a.i32_store(a.i32_const(0),a.i32_add(a.getLocal(\"pAux\"),a.i32_mul(a.getLocal(\"n\"),a.i32_const(h)))),a.call(n+\"_batchInverse\",a.i32_add(a.getLocal(\"pIn\"),a.i32_const(h*2)),a.i32_const(h*3),a.getLocal(\"n\"),a.getLocal(\"pAux\"),a.i32_const(h)),a.setLocal(\"itIn\",a.getLocal(\"pIn\")),a.setLocal(\"itAux\",a.getLocal(\"pAux\")),a.setLocal(\"itOut\",a.getLocal(\"pOut\")),a.setLocal(\"i\",a.i32_const(0)),a.block(a.loop(a.br_if(1,a.i32_eq(a.getLocal(\"i\"),a.getLocal(\"n\"))),a.if(a.call(n+\"_isZero\",a.getLocal(\"itAux\")),[...a.call(n+\"_zero\",a.getLocal(\"itOut\")),...a.call(n+\"_zero\",a.i32_add(a.getLocal(\"itOut\"),a.i32_const(h)))],[...a.call(n+\"_mul\",a.getLocal(\"itAux\"),a.i32_add(a.getLocal(\"itIn\"),a.i32_const(h)),w),...a.call(n+\"_square\",a.getLocal(\"itAux\"),a.getLocal(\"itAux\")),...a.call(n+\"_mul\",a.getLocal(\"itAux\"),a.getLocal(\"itIn\"),a.getLocal(\"itOut\")),...a.call(n+\"_mul\",a.getLocal(\"itAux\"),w,a.i32_add(a.getLocal(\"itOut\"),a.i32_const(h)))]),a.setLocal(\"itIn\",a.i32_add(a.getLocal(\"itIn\"),a.i32_const(h*3))),a.setLocal(\"itOut\",a.i32_add(a.getLocal(\"itOut\"),a.i32_const(h*2))),a.setLocal(\"itAux\",a.i32_add(a.getLocal(\"itAux\"),a.i32_const(h))),a.setLocal(\"i\",a.i32_add(a.getLocal(\"i\"),a.i32_const(1))),a.br(0))),a.i32_store(a.i32_const(0),a.getLocal(\"pAux\")))}function ot(){let m=t.addFunction(e+\"__reverseBytes\");m.addParam(\"pIn\",\"i32\"),m.addParam(\"n\",\"i32\"),m.addParam(\"pOut\",\"i32\"),m.addLocal(\"itOut\",\"i32\"),m.addLocal(\"itIn\",\"i32\");let a=m.getCodeBuilder();m.addCode(a.setLocal(\"itOut\",a.i32_sub(a.i32_add(a.getLocal(\"pOut\"),a.getLocal(\"n\")),a.i32_const(1))),a.setLocal(\"itIn\",a.getLocal(\"pIn\")),a.block(a.loop(a.br_if(1,a.i32_lt_s(a.getLocal(\"itOut\"),a.getLocal(\"pOut\"))),a.i32_store8(a.getLocal(\"itOut\"),a.i32_load8_u(a.getLocal(\"itIn\"))),a.setLocal(\"itOut\",a.i32_sub(a.getLocal(\"itOut\"),a.i32_const(1))),a.setLocal(\"itIn\",a.i32_add(a.getLocal(\"itIn\"),a.i32_const(1))),a.br(0))))}function xt(){let m=t.addFunction(e+\"_LEMtoC\");m.addParam(\"pIn\",\"i32\"),m.addParam(\"pOut\",\"i32\");let a=m.getCodeBuilder(),w=a.i32_const(t.alloc(h));m.addCode(a.if(a.call(e+\"_isZero\",a.getLocal(\"pIn\")),[...a.call(n+\"_zero\",a.getLocal(\"pOut\")),...a.i32_store8(a.getLocal(\"pOut\"),a.i32_const(64)),...a.ret([])]),a.call(n+\"_fromMontgomery\",a.getLocal(\"pIn\"),w),a.call(e+\"__reverseBytes\",w,a.i32_const(h),a.getLocal(\"pOut\")),a.if(a.i32_eq(a.call(n+\"_sign\",a.i32_add(a.getLocal(\"pIn\"),a.i32_const(h))),a.i32_const(-1)),a.i32_store8(a.getLocal(\"pOut\"),a.i32_or(a.i32_load8_u(a.getLocal(\"pOut\")),a.i32_const(128)))))}function pt(){let m=t.addFunction(e+\"_LEMtoU\");m.addParam(\"pIn\",\"i32\"),m.addParam(\"pOut\",\"i32\");let a=m.getCodeBuilder(),w=t.alloc(h*2),c=a.i32_const(w),G=a.i32_const(w),R=a.i32_const(w+h);m.addCode(a.if(a.call(e+\"_isZeroAffine\",a.getLocal(\"pIn\")),[...a.call(e+\"_zeroAffine\",a.getLocal(\"pOut\")),...a.i32_store8(a.getLocal(\"pOut\"),a.i32_const(64)),...a.ret([])]),a.call(e+\"_fromMontgomeryAffine\",a.getLocal(\"pIn\"),c),a.call(e+\"__reverseBytes\",G,a.i32_const(h),a.getLocal(\"pOut\")),a.call(e+\"__reverseBytes\",R,a.i32_const(h),a.i32_add(a.getLocal(\"pOut\"),a.i32_const(h))))}function bt(){let m=t.addFunction(e+\"_UtoLEM\");m.addParam(\"pIn\",\"i32\"),m.addParam(\"pOut\",\"i32\");let a=m.getCodeBuilder(),w=t.alloc(h*2),c=a.i32_const(w),G=a.i32_const(w),R=a.i32_const(w+h);m.addCode(a.if(a.i32_and(a.i32_load8_u(a.getLocal(\"pIn\")),a.i32_const(64)),[...a.call(e+\"_zeroAffine\",a.getLocal(\"pOut\")),...a.ret([])]),a.call(e+\"__reverseBytes\",a.getLocal(\"pIn\"),a.i32_const(h),G),a.call(e+\"__reverseBytes\",a.i32_add(a.getLocal(\"pIn\"),a.i32_const(h)),a.i32_const(h),R),a.call(e+\"_toMontgomeryAffine\",c,a.getLocal(\"pOut\")))}function vt(){let m=t.addFunction(e+\"_CtoLEM\");m.addParam(\"pIn\",\"i32\"),m.addParam(\"pOut\",\"i32\"),m.addLocal(\"firstByte\",\"i32\"),m.addLocal(\"greatest\",\"i32\");let a=m.getCodeBuilder(),w=t.alloc(h*2),c=a.i32_const(w),G=a.i32_const(w+h);m.addCode(a.setLocal(\"firstByte\",a.i32_load8_u(a.getLocal(\"pIn\"))),a.if(a.i32_and(a.getLocal(\"firstByte\"),a.i32_const(64)),[...a.call(e+\"_zeroAffine\",a.getLocal(\"pOut\")),...a.ret([])]),a.setLocal(\"greatest\",a.i32_and(a.getLocal(\"firstByte\"),a.i32_const(128))),a.call(n+\"_copy\",a.getLocal(\"pIn\"),G),a.i32_store8(G,a.i32_and(a.getLocal(\"firstByte\"),a.i32_const(63))),a.call(e+\"__reverseBytes\",G,a.i32_const(h),c),a.call(n+\"_toMontgomery\",c,a.getLocal(\"pOut\")),a.call(n+\"_square\",a.getLocal(\"pOut\"),G),a.call(n+\"_mul\",a.getLocal(\"pOut\"),G,G),a.call(n+\"_add\",G,a.i32_const(o),G),a.call(n+\"_sqrt\",G,G),a.call(n+\"_neg\",G,c),a.if(a.i32_eq(a.call(n+\"_sign\",G),a.i32_const(-1)),a.if(a.getLocal(\"greatest\"),a.call(n+\"_copy\",G,a.i32_add(a.getLocal(\"pOut\"),a.i32_const(h))),a.call(n+\"_neg\",G,a.i32_add(a.getLocal(\"pOut\"),a.i32_const(h)))),a.if(a.getLocal(\"greatest\"),a.call(n+\"_neg\",G,a.i32_add(a.getLocal(\"pOut\"),a.i32_const(h))),a.call(n+\"_copy\",G,a.i32_add(a.getLocal(\"pOut\"),a.i32_const(h))))))}function Pt(){let m=t.addFunction(e+\"_inCurveAffine\");m.addParam(\"pIn\",\"i32\"),m.setReturnType(\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"pIn\"),c=a.i32_add(a.getLocal(\"pIn\"),a.i32_const(h)),G=a.i32_const(t.alloc(h)),R=a.i32_const(t.alloc(h));m.addCode(a.call(n+\"_square\",c,G),a.call(n+\"_square\",w,R),a.call(n+\"_mul\",w,R,R),a.call(n+\"_add\",R,a.i32_const(o),R),a.ret(a.call(n+\"_eq\",G,R)))}function Ht(){let m=t.addFunction(e+\"_inCurve\");m.addParam(\"pIn\",\"i32\"),m.setReturnType(\"i32\");let a=m.getCodeBuilder(),w=a.i32_const(t.alloc(h*2));m.addCode(a.call(e+\"_toAffine\",a.getLocal(\"pIn\"),w),a.ret(a.call(e+\"_inCurveAffine\",w)))}return L(),f(),C(),x(),s(),l(),rt(),S(),$(),g(),q(),it(),r(),_(),E(),j(),Z(),y(),v(),nt(),ct(),W(),M(),O(),V(),Pt(),Ht(),dt(),T(),ot(),pt(),xt(),bt(),vt(),la(t,e+\"_batchLEMtoU\",e+\"_LEMtoU\",h*2,h*2),la(t,e+\"_batchLEMtoC\",e+\"_LEMtoC\",h*2,h),la(t,e+\"_batchUtoLEM\",e+\"_UtoLEM\",h*2,h*2),la(t,e+\"_batchCtoLEM\",e+\"_CtoLEM\",h,h*2,!0),la(t,e+\"_batchToJacobian\",e+\"_toJacobian\",h*2,h*3,!0),Gl(t,e,e+\"_multiexp\",e+\"_add\",h*3),Gl(t,e,e+\"_multiexpAffine\",e+\"_addMixed\",h*2),Ml(t,e+\"_timesScalar\",h*3,e+\"_add\",e+\"_double\",e+\"_sub\",e+\"_copy\",e+\"_zero\"),Ml(t,e+\"_timesScalarAffine\",h*2,e+\"_addMixed\",e+\"_double\",e+\"_subMixed\",e+\"_copyAffine\",e+\"_zero\"),t.exportFunction(e+\"_isZero\"),t.exportFunction(e+\"_isZeroAffine\"),t.exportFunction(e+\"_eq\"),t.exportFunction(e+\"_eqMixed\"),t.exportFunction(e+\"_eqAffine\"),t.exportFunction(e+\"_copy\"),t.exportFunction(e+\"_copyAffine\"),t.exportFunction(e+\"_zero\"),t.exportFunction(e+\"_zeroAffine\"),t.exportFunction(e+\"_double\"),t.exportFunction(e+\"_doubleAffine\"),t.exportFunction(e+\"_add\"),t.exportFunction(e+\"_addMixed\"),t.exportFunction(e+\"_addAffine\"),t.exportFunction(e+\"_neg\"),t.exportFunction(e+\"_negAffine\"),t.exportFunction(e+\"_sub\"),t.exportFunction(e+\"_subMixed\"),t.exportFunction(e+\"_subAffine\"),t.exportFunction(e+\"_fromMontgomery\"),t.exportFunction(e+\"_fromMontgomeryAffine\"),t.exportFunction(e+\"_toMontgomery\"),t.exportFunction(e+\"_toMontgomeryAffine\"),t.exportFunction(e+\"_timesScalar\"),t.exportFunction(e+\"_timesScalarAffine\"),t.exportFunction(e+\"_normalize\"),t.exportFunction(e+\"_LEMtoU\"),t.exportFunction(e+\"_LEMtoC\"),t.exportFunction(e+\"_UtoLEM\"),t.exportFunction(e+\"_CtoLEM\"),t.exportFunction(e+\"_batchLEMtoU\"),t.exportFunction(e+\"_batchLEMtoC\"),t.exportFunction(e+\"_batchUtoLEM\"),t.exportFunction(e+\"_batchCtoLEM\"),t.exportFunction(e+\"_toAffine\"),t.exportFunction(e+\"_toJacobian\"),t.exportFunction(e+\"_batchToAffine\"),t.exportFunction(e+\"_batchToJacobian\"),t.exportFunction(e+\"_inCurve\"),t.exportFunction(e+\"_inCurveAffine\"),e}});var Ss=Yt((By,Nl)=>{var{isOdd:ah,modInv:kl,modPow:da}=Bi(),ho=Ii();Nl.exports=function(t,e,n,o,d){let f=t.modules[o].n64*8,l=t.modules[n].n64*8,s=t.modules[o].q,x=s-1n,C=0;for(;!ah(x);)C++,x=x>>1n;let g=2n;for(;da(g,s>>1n,s)===1n;)g=g+1n;let $=new Array(C+1);$[C]=da(g,x,s);let it=C-1;for(;it>=0;)$[it]=da($[it+1],2n,s),it--;let q=[],S=(1n<<BigInt(f*8))%s;for(let w=0;w<$.length;w++){let c=$[w]*S%s;q.push(...ho.bigInt2BytesLE(c,f))}let O=t.alloc(q),M=new Array(C+1);M[0]=1n;for(let w=1;w<=C;w++)M[w]=M[w-1]*2n;let W=[];for(let w=0;w<=C;w++){let c=kl(M[w],s)*S%s;W.push(...ho.bigInt2BytesLE(c,f))}let ct=t.alloc(W),E=da(g,2n,s),_=[],r=[];for(let w=0;w<=C;w++){let c=da(E,2n**BigInt(w),s),G=kl(s+1n-c,s);_.push(...ho.bigInt2BytesLE(c*S%s,f)),r.push(...ho.bigInt2BytesLE(G*S%s,f))}let Z=t.alloc(_),j=t.alloc(r);function nt(w){let c=0;for(let G=0;G<8;G++)w&1<<G&&(c=c|128>>G);return c}let v=Array(256);for(let w=0;w<256;w++)v[w]=nt(w);let y=t.alloc(v);function T(){let w=t.addFunction(e+\"__log2\");w.addParam(\"n\",\"i32\"),w.setReturnType(\"i32\"),w.addLocal(\"bits\",\"i32\"),w.addLocal(\"aux\",\"i32\");let c=w.getCodeBuilder();w.addCode(c.setLocal(\"aux\",c.i32_shr_u(c.getLocal(\"n\"),c.i32_const(1)))),w.addCode(c.setLocal(\"bits\",c.i32_const(0))),w.addCode(c.block(c.loop(c.br_if(1,c.i32_eqz(c.getLocal(\"aux\"))),c.setLocal(\"aux\",c.i32_shr_u(c.getLocal(\"aux\"),c.i32_const(1))),c.setLocal(\"bits\",c.i32_add(c.getLocal(\"bits\"),c.i32_const(1))),c.br(0)))),w.addCode(c.if(c.i32_ne(c.getLocal(\"n\"),c.i32_shl(c.i32_const(1),c.getLocal(\"bits\"))),c.unreachable())),w.addCode(c.if(c.i32_gt_u(c.getLocal(\"bits\"),c.i32_const(C)),c.unreachable())),w.addCode(c.getLocal(\"bits\"))}function V(){let w=t.addFunction(e+\"_fft\");w.addParam(\"px\",\"i32\"),w.addParam(\"n\",\"i32\"),w.addLocal(\"bits\",\"i32\");let c=w.getCodeBuilder(),G=c.i32_const(t.alloc(f));w.addCode(c.setLocal(\"bits\",c.call(e+\"__log2\",c.getLocal(\"n\"))),c.call(o+\"_one\",G),c.call(e+\"_rawfft\",c.getLocal(\"px\"),c.getLocal(\"bits\"),c.i32_const(0),G))}function rt(){let w=t.addFunction(e+\"_ifft\");w.addParam(\"px\",\"i32\"),w.addParam(\"n\",\"i32\"),w.addLocal(\"bits\",\"i32\"),w.addLocal(\"pInv2\",\"i32\");let c=w.getCodeBuilder();w.addCode(c.setLocal(\"bits\",c.call(e+\"__log2\",c.getLocal(\"n\"))),c.setLocal(\"pInv2\",c.i32_add(c.i32_const(ct),c.i32_mul(c.getLocal(\"bits\"),c.i32_const(f)))),c.call(e+\"_rawfft\",c.getLocal(\"px\"),c.getLocal(\"bits\"),c.i32_const(1),c.getLocal(\"pInv2\")))}function dt(){let w=t.addFunction(e+\"_rawfft\");w.addParam(\"px\",\"i32\"),w.addParam(\"bits\",\"i32\"),w.addParam(\"reverse\",\"i32\"),w.addParam(\"mulFactor\",\"i32\"),w.addLocal(\"s\",\"i32\"),w.addLocal(\"k\",\"i32\"),w.addLocal(\"j\",\"i32\"),w.addLocal(\"m\",\"i32\"),w.addLocal(\"mdiv2\",\"i32\"),w.addLocal(\"n\",\"i32\"),w.addLocal(\"pwm\",\"i32\"),w.addLocal(\"idx1\",\"i32\"),w.addLocal(\"idx2\",\"i32\");let c=w.getCodeBuilder(),G=c.i32_const(t.alloc(f)),R=c.i32_const(t.alloc(l)),F=c.i32_const(t.alloc(l));w.addCode(c.call(e+\"__reversePermutation\",c.getLocal(\"px\"),c.getLocal(\"bits\")),c.setLocal(\"n\",c.i32_shl(c.i32_const(1),c.getLocal(\"bits\"))),c.setLocal(\"s\",c.i32_const(1)),c.block(c.loop(c.br_if(1,c.i32_gt_u(c.getLocal(\"s\"),c.getLocal(\"bits\"))),c.setLocal(\"m\",c.i32_shl(c.i32_const(1),c.getLocal(\"s\"))),c.setLocal(\"pwm\",c.i32_add(c.i32_const(O),c.i32_mul(c.getLocal(\"s\"),c.i32_const(f)))),c.setLocal(\"k\",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_ge_u(c.getLocal(\"k\"),c.getLocal(\"n\"))),c.call(o+\"_one\",G),c.setLocal(\"mdiv2\",c.i32_shr_u(c.getLocal(\"m\"),c.i32_const(1))),c.setLocal(\"j\",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_ge_u(c.getLocal(\"j\"),c.getLocal(\"mdiv2\"))),c.setLocal(\"idx1\",c.i32_add(c.getLocal(\"px\"),c.i32_mul(c.i32_add(c.getLocal(\"k\"),c.getLocal(\"j\")),c.i32_const(l)))),c.setLocal(\"idx2\",c.i32_add(c.getLocal(\"idx1\"),c.i32_mul(c.getLocal(\"mdiv2\"),c.i32_const(l)))),c.call(d,c.getLocal(\"idx2\"),G,R),c.call(n+\"_copy\",c.getLocal(\"idx1\"),F),c.call(n+\"_add\",F,R,c.getLocal(\"idx1\")),c.call(n+\"_sub\",F,R,c.getLocal(\"idx2\")),c.call(o+\"_mul\",G,c.getLocal(\"pwm\"),G),c.setLocal(\"j\",c.i32_add(c.getLocal(\"j\"),c.i32_const(1))),c.br(0))),c.setLocal(\"k\",c.i32_add(c.getLocal(\"k\"),c.getLocal(\"m\"))),c.br(0))),c.setLocal(\"s\",c.i32_add(c.getLocal(\"s\"),c.i32_const(1))),c.br(0))),c.call(e+\"__fftFinal\",c.getLocal(\"px\"),c.getLocal(\"bits\"),c.getLocal(\"reverse\"),c.getLocal(\"mulFactor\")))}function ot(){let w=t.addFunction(e+\"__fftFinal\");w.addParam(\"px\",\"i32\"),w.addParam(\"bits\",\"i32\"),w.addParam(\"reverse\",\"i32\"),w.addParam(\"mulFactor\",\"i32\"),w.addLocal(\"n\",\"i32\"),w.addLocal(\"ndiv2\",\"i32\"),w.addLocal(\"pInv2\",\"i32\"),w.addLocal(\"i\",\"i32\"),w.addLocal(\"mask\",\"i32\"),w.addLocal(\"idx1\",\"i32\"),w.addLocal(\"idx2\",\"i32\");let c=w.getCodeBuilder(),G=c.i32_const(t.alloc(l));w.addCode(c.if(c.i32_and(c.i32_eqz(c.getLocal(\"reverse\")),c.call(o+\"_isOne\",c.getLocal(\"mulFactor\"))),c.ret([])),c.setLocal(\"n\",c.i32_shl(c.i32_const(1),c.getLocal(\"bits\"))),c.setLocal(\"mask\",c.i32_sub(c.getLocal(\"n\"),c.i32_const(1))),c.setLocal(\"i\",c.i32_const(1)),c.setLocal(\"ndiv2\",c.i32_shr_u(c.getLocal(\"n\"),c.i32_const(1))),c.block(c.loop(c.br_if(1,c.i32_ge_u(c.getLocal(\"i\"),c.getLocal(\"ndiv2\"))),c.setLocal(\"idx1\",c.i32_add(c.getLocal(\"px\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.setLocal(\"idx2\",c.i32_add(c.getLocal(\"px\"),c.i32_mul(c.i32_sub(c.getLocal(\"n\"),c.getLocal(\"i\")),c.i32_const(l)))),c.if(c.getLocal(\"reverse\"),c.if(c.call(o+\"_isOne\",c.getLocal(\"mulFactor\")),[...c.call(n+\"_copy\",c.getLocal(\"idx1\"),G),...c.call(n+\"_copy\",c.getLocal(\"idx2\"),c.getLocal(\"idx1\")),...c.call(n+\"_copy\",G,c.getLocal(\"idx2\"))],[...c.call(n+\"_copy\",c.getLocal(\"idx1\"),G),...c.call(d,c.getLocal(\"idx2\"),c.getLocal(\"mulFactor\"),c.getLocal(\"idx1\")),...c.call(d,G,c.getLocal(\"mulFactor\"),c.getLocal(\"idx2\"))]),c.if(c.call(o+\"_isOne\",c.getLocal(\"mulFactor\")),[],[...c.call(d,c.getLocal(\"idx1\"),c.getLocal(\"mulFactor\"),c.getLocal(\"idx1\")),...c.call(d,c.getLocal(\"idx2\"),c.getLocal(\"mulFactor\"),c.getLocal(\"idx2\"))])),c.setLocal(\"i\",c.i32_add(c.getLocal(\"i\"),c.i32_const(1))),c.br(0))),c.if(c.call(o+\"_isOne\",c.getLocal(\"mulFactor\")),[],[...c.call(d,c.getLocal(\"px\"),c.getLocal(\"mulFactor\"),c.getLocal(\"px\")),...c.setLocal(\"idx2\",c.i32_add(c.getLocal(\"px\"),c.i32_mul(c.getLocal(\"ndiv2\"),c.i32_const(l)))),...c.call(d,c.getLocal(\"idx2\"),c.getLocal(\"mulFactor\"),c.getLocal(\"idx2\"))]))}function xt(){let w=t.addFunction(e+\"__reversePermutation\");w.addParam(\"px\",\"i32\"),w.addParam(\"bits\",\"i32\"),w.addLocal(\"n\",\"i32\"),w.addLocal(\"i\",\"i32\"),w.addLocal(\"ri\",\"i32\"),w.addLocal(\"idx1\",\"i32\"),w.addLocal(\"idx2\",\"i32\");let c=w.getCodeBuilder(),G=c.i32_const(t.alloc(l));w.addCode(c.setLocal(\"n\",c.i32_shl(c.i32_const(1),c.getLocal(\"bits\"))),c.setLocal(\"i\",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal(\"i\"),c.getLocal(\"n\"))),c.setLocal(\"idx1\",c.i32_add(c.getLocal(\"px\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.setLocal(\"ri\",c.call(e+\"__rev\",c.getLocal(\"i\"),c.getLocal(\"bits\"))),c.setLocal(\"idx2\",c.i32_add(c.getLocal(\"px\"),c.i32_mul(c.getLocal(\"ri\"),c.i32_const(l)))),c.if(c.i32_lt_u(c.getLocal(\"i\"),c.getLocal(\"ri\")),[...c.call(n+\"_copy\",c.getLocal(\"idx1\"),G),...c.call(n+\"_copy\",c.getLocal(\"idx2\"),c.getLocal(\"idx1\")),...c.call(n+\"_copy\",G,c.getLocal(\"idx2\"))]),c.setLocal(\"i\",c.i32_add(c.getLocal(\"i\"),c.i32_const(1))),c.br(0))))}function pt(){let w=t.addFunction(e+\"__rev\");w.addParam(\"x\",\"i32\"),w.addParam(\"bits\",\"i32\"),w.setReturnType(\"i32\");let c=w.getCodeBuilder();w.addCode(c.i32_rotl(c.i32_add(c.i32_add(c.i32_shl(c.i32_load8_u(c.i32_and(c.getLocal(\"x\"),c.i32_const(255)),y,0),c.i32_const(24)),c.i32_shl(c.i32_load8_u(c.i32_and(c.i32_shr_u(c.getLocal(\"x\"),c.i32_const(8)),c.i32_const(255)),y,0),c.i32_const(16))),c.i32_add(c.i32_shl(c.i32_load8_u(c.i32_and(c.i32_shr_u(c.getLocal(\"x\"),c.i32_const(16)),c.i32_const(255)),y,0),c.i32_const(8)),c.i32_load8_u(c.i32_and(c.i32_shr_u(c.getLocal(\"x\"),c.i32_const(24)),c.i32_const(255)),y,0))),c.getLocal(\"bits\")))}function bt(){let w=t.addFunction(e+\"_fftJoin\");w.addParam(\"pBuff1\",\"i32\"),w.addParam(\"pBuff2\",\"i32\"),w.addParam(\"n\",\"i32\"),w.addParam(\"first\",\"i32\"),w.addParam(\"inc\",\"i32\"),w.addLocal(\"idx1\",\"i32\"),w.addLocal(\"idx2\",\"i32\"),w.addLocal(\"i\",\"i32\");let c=w.getCodeBuilder(),G=c.i32_const(t.alloc(f)),R=c.i32_const(t.alloc(l)),F=c.i32_const(t.alloc(l));w.addCode(c.call(o+\"_copy\",c.getLocal(\"first\"),G),c.setLocal(\"i\",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal(\"i\"),c.getLocal(\"n\"))),c.setLocal(\"idx1\",c.i32_add(c.getLocal(\"pBuff1\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.setLocal(\"idx2\",c.i32_add(c.getLocal(\"pBuff2\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.call(d,c.getLocal(\"idx2\"),G,R),c.call(n+\"_copy\",c.getLocal(\"idx1\"),F),c.call(n+\"_add\",F,R,c.getLocal(\"idx1\")),c.call(n+\"_sub\",F,R,c.getLocal(\"idx2\")),c.call(o+\"_mul\",G,c.getLocal(\"inc\"),G),c.setLocal(\"i\",c.i32_add(c.getLocal(\"i\"),c.i32_const(1))),c.br(0))))}function vt(){let w=t.addFunction(e+\"_fftJoinExt\");w.addParam(\"pBuff1\",\"i32\"),w.addParam(\"pBuff2\",\"i32\"),w.addParam(\"n\",\"i32\"),w.addParam(\"first\",\"i32\"),w.addParam(\"inc\",\"i32\"),w.addParam(\"totalBits\",\"i32\"),w.addLocal(\"idx1\",\"i32\"),w.addLocal(\"idx2\",\"i32\"),w.addLocal(\"i\",\"i32\"),w.addLocal(\"pShiftToM\",\"i32\");let c=w.getCodeBuilder(),G=c.i32_const(t.alloc(f)),R=c.i32_const(t.alloc(l));w.addCode(c.setLocal(\"pShiftToM\",c.i32_add(c.i32_const(Z),c.i32_mul(c.getLocal(\"totalBits\"),c.i32_const(f)))),c.call(o+\"_copy\",c.getLocal(\"first\"),G),c.setLocal(\"i\",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal(\"i\"),c.getLocal(\"n\"))),c.setLocal(\"idx1\",c.i32_add(c.getLocal(\"pBuff1\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.setLocal(\"idx2\",c.i32_add(c.getLocal(\"pBuff2\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.call(n+\"_add\",c.getLocal(\"idx1\"),c.getLocal(\"idx2\"),R),c.call(d,c.getLocal(\"idx2\"),c.getLocal(\"pShiftToM\"),c.getLocal(\"idx2\")),c.call(n+\"_add\",c.getLocal(\"idx1\"),c.getLocal(\"idx2\"),c.getLocal(\"idx2\")),c.call(d,c.getLocal(\"idx2\"),G,c.getLocal(\"idx2\")),c.call(n+\"_copy\",R,c.getLocal(\"idx1\")),c.call(o+\"_mul\",G,c.getLocal(\"inc\"),G),c.setLocal(\"i\",c.i32_add(c.getLocal(\"i\"),c.i32_const(1))),c.br(0))))}function Pt(){let w=t.addFunction(e+\"_fftJoinExtInv\");w.addParam(\"pBuff1\",\"i32\"),w.addParam(\"pBuff2\",\"i32\"),w.addParam(\"n\",\"i32\"),w.addParam(\"first\",\"i32\"),w.addParam(\"inc\",\"i32\"),w.addParam(\"totalBits\",\"i32\"),w.addLocal(\"idx1\",\"i32\"),w.addLocal(\"idx2\",\"i32\"),w.addLocal(\"i\",\"i32\"),w.addLocal(\"pShiftToM\",\"i32\"),w.addLocal(\"pSConst\",\"i32\");let c=w.getCodeBuilder(),G=c.i32_const(t.alloc(f)),R=c.i32_const(t.alloc(l));w.addCode(c.setLocal(\"pShiftToM\",c.i32_add(c.i32_const(Z),c.i32_mul(c.getLocal(\"totalBits\"),c.i32_const(f)))),c.setLocal(\"pSConst\",c.i32_add(c.i32_const(j),c.i32_mul(c.getLocal(\"totalBits\"),c.i32_const(f)))),c.call(o+\"_copy\",c.getLocal(\"first\"),G),c.setLocal(\"i\",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal(\"i\"),c.getLocal(\"n\"))),c.setLocal(\"idx1\",c.i32_add(c.getLocal(\"pBuff1\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.setLocal(\"idx2\",c.i32_add(c.getLocal(\"pBuff2\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.call(d,c.getLocal(\"idx2\"),G,R),c.call(n+\"_sub\",c.getLocal(\"idx1\"),R,c.getLocal(\"idx2\")),c.call(d,c.getLocal(\"idx2\"),c.getLocal(\"pSConst\"),c.getLocal(\"idx2\")),c.call(d,c.getLocal(\"idx1\"),c.getLocal(\"pShiftToM\"),c.getLocal(\"idx1\")),c.call(n+\"_sub\",R,c.getLocal(\"idx1\"),c.getLocal(\"idx1\")),c.call(d,c.getLocal(\"idx1\"),c.getLocal(\"pSConst\"),c.getLocal(\"idx1\")),c.call(o+\"_mul\",G,c.getLocal(\"inc\"),G),c.setLocal(\"i\",c.i32_add(c.getLocal(\"i\"),c.i32_const(1))),c.br(0))))}function Ht(){let w=t.addFunction(e+\"_prepareLagrangeEvaluation\");w.addParam(\"pBuff1\",\"i32\"),w.addParam(\"pBuff2\",\"i32\"),w.addParam(\"n\",\"i32\"),w.addParam(\"first\",\"i32\"),w.addParam(\"inc\",\"i32\"),w.addParam(\"totalBits\",\"i32\"),w.addLocal(\"idx1\",\"i32\"),w.addLocal(\"idx2\",\"i32\"),w.addLocal(\"i\",\"i32\"),w.addLocal(\"pShiftToM\",\"i32\"),w.addLocal(\"pSConst\",\"i32\");let c=w.getCodeBuilder(),G=c.i32_const(t.alloc(f)),R=c.i32_const(t.alloc(l));w.addCode(c.setLocal(\"pShiftToM\",c.i32_add(c.i32_const(Z),c.i32_mul(c.getLocal(\"totalBits\"),c.i32_const(f)))),c.setLocal(\"pSConst\",c.i32_add(c.i32_const(j),c.i32_mul(c.getLocal(\"totalBits\"),c.i32_const(f)))),c.call(o+\"_copy\",c.getLocal(\"first\"),G),c.setLocal(\"i\",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal(\"i\"),c.getLocal(\"n\"))),c.setLocal(\"idx1\",c.i32_add(c.getLocal(\"pBuff1\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.setLocal(\"idx2\",c.i32_add(c.getLocal(\"pBuff2\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.call(d,c.getLocal(\"idx1\"),c.getLocal(\"pShiftToM\"),R),c.call(n+\"_sub\",c.getLocal(\"idx2\"),R,R),c.call(n+\"_sub\",c.getLocal(\"idx1\"),c.getLocal(\"idx2\"),c.getLocal(\"idx2\")),c.call(d,R,c.getLocal(\"pSConst\"),c.getLocal(\"idx1\")),c.call(d,c.getLocal(\"idx2\"),G,c.getLocal(\"idx2\")),c.call(o+\"_mul\",G,c.getLocal(\"inc\"),G),c.setLocal(\"i\",c.i32_add(c.getLocal(\"i\"),c.i32_const(1))),c.br(0))))}function m(){let w=t.addFunction(e+\"_fftMix\");w.addParam(\"pBuff\",\"i32\"),w.addParam(\"n\",\"i32\"),w.addParam(\"exp\",\"i32\"),w.addLocal(\"nGroups\",\"i32\"),w.addLocal(\"nPerGroup\",\"i32\"),w.addLocal(\"nPerGroupDiv2\",\"i32\"),w.addLocal(\"pairOffset\",\"i32\"),w.addLocal(\"idx1\",\"i32\"),w.addLocal(\"idx2\",\"i32\"),w.addLocal(\"i\",\"i32\"),w.addLocal(\"j\",\"i32\"),w.addLocal(\"pwm\",\"i32\");let c=w.getCodeBuilder(),G=c.i32_const(t.alloc(f)),R=c.i32_const(t.alloc(l)),F=c.i32_const(t.alloc(l));w.addCode(c.setLocal(\"nPerGroup\",c.i32_shl(c.i32_const(1),c.getLocal(\"exp\"))),c.setLocal(\"nPerGroupDiv2\",c.i32_shr_u(c.getLocal(\"nPerGroup\"),c.i32_const(1))),c.setLocal(\"nGroups\",c.i32_shr_u(c.getLocal(\"n\"),c.getLocal(\"exp\"))),c.setLocal(\"pairOffset\",c.i32_mul(c.getLocal(\"nPerGroupDiv2\"),c.i32_const(l))),c.setLocal(\"pwm\",c.i32_add(c.i32_const(O),c.i32_mul(c.getLocal(\"exp\"),c.i32_const(f)))),c.setLocal(\"i\",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal(\"i\"),c.getLocal(\"nGroups\"))),c.call(o+\"_one\",G),c.setLocal(\"j\",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal(\"j\"),c.getLocal(\"nPerGroupDiv2\"))),c.setLocal(\"idx1\",c.i32_add(c.getLocal(\"pBuff\"),c.i32_mul(c.i32_add(c.i32_mul(c.getLocal(\"i\"),c.getLocal(\"nPerGroup\")),c.getLocal(\"j\")),c.i32_const(l)))),c.setLocal(\"idx2\",c.i32_add(c.getLocal(\"idx1\"),c.getLocal(\"pairOffset\"))),c.call(d,c.getLocal(\"idx2\"),G,R),c.call(n+\"_copy\",c.getLocal(\"idx1\"),F),c.call(n+\"_add\",F,R,c.getLocal(\"idx1\")),c.call(n+\"_sub\",F,R,c.getLocal(\"idx2\")),c.call(o+\"_mul\",G,c.getLocal(\"pwm\"),G),c.setLocal(\"j\",c.i32_add(c.getLocal(\"j\"),c.i32_const(1))),c.br(0))),c.setLocal(\"i\",c.i32_add(c.getLocal(\"i\"),c.i32_const(1))),c.br(0))))}function a(){let w=t.addFunction(e+\"_fftFinal\");w.addParam(\"pBuff\",\"i32\"),w.addParam(\"n\",\"i32\"),w.addParam(\"factor\",\"i32\"),w.addLocal(\"idx1\",\"i32\"),w.addLocal(\"idx2\",\"i32\"),w.addLocal(\"i\",\"i32\"),w.addLocal(\"ndiv2\",\"i32\");let c=w.getCodeBuilder(),G=c.i32_const(t.alloc(l));w.addCode(c.setLocal(\"ndiv2\",c.i32_shr_u(c.getLocal(\"n\"),c.i32_const(1))),c.if(c.i32_and(c.getLocal(\"n\"),c.i32_const(1)),c.call(d,c.i32_add(c.getLocal(\"pBuff\"),c.i32_mul(c.getLocal(\"ndiv2\"),c.i32_const(l))),c.getLocal(\"factor\"),c.i32_add(c.getLocal(\"pBuff\"),c.i32_mul(c.getLocal(\"ndiv2\"),c.i32_const(l))))),c.setLocal(\"i\",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_ge_u(c.getLocal(\"i\"),c.getLocal(\"ndiv2\"))),c.setLocal(\"idx1\",c.i32_add(c.getLocal(\"pBuff\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.setLocal(\"idx2\",c.i32_add(c.getLocal(\"pBuff\"),c.i32_mul(c.i32_sub(c.i32_sub(c.getLocal(\"n\"),c.i32_const(1)),c.getLocal(\"i\")),c.i32_const(l)))),c.call(d,c.getLocal(\"idx2\"),c.getLocal(\"factor\"),G),c.call(d,c.getLocal(\"idx1\"),c.getLocal(\"factor\"),c.getLocal(\"idx2\")),c.call(n+\"_copy\",G,c.getLocal(\"idx1\")),c.setLocal(\"i\",c.i32_add(c.getLocal(\"i\"),c.i32_const(1))),c.br(0))))}pt(),xt(),ot(),dt(),T(),V(),rt(),bt(),vt(),Pt(),m(),a(),Ht(),t.exportFunction(e+\"_fft\"),t.exportFunction(e+\"_ifft\"),t.exportFunction(e+\"_rawfft\"),t.exportFunction(e+\"_fftJoin\"),t.exportFunction(e+\"_fftJoinExt\"),t.exportFunction(e+\"_fftJoinExtInv\"),t.exportFunction(e+\"_fftMix\"),t.exportFunction(e+\"_fftFinal\"),t.exportFunction(e+\"_prepareLagrangeEvaluation\")}});var qs=Yt((vy,Ql)=>{Ql.exports=function(t,e,n){let d=t.modules[n].n64*8;function h(){let L=t.addFunction(e+\"_zero\");L.addParam(\"px\",\"i32\"),L.addParam(\"n\",\"i32\"),L.addLocal(\"lastp\",\"i32\"),L.addLocal(\"p\",\"i32\");let l=L.getCodeBuilder();L.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(d)))),l.block(l.loop(l.br_if(1,l.i32_eq(l.getLocal(\"p\"),l.getLocal(\"lastp\"))),l.call(n+\"_zero\",l.getLocal(\"p\")),l.setLocal(\"p\",l.i32_add(l.getLocal(\"p\"),l.i32_const(d))),l.br(0))))}function f(){let L=t.addFunction(e+\"_constructLC\");L.addParam(\"ppolynomials\",\"i32\"),L.addParam(\"psignals\",\"i32\"),L.addParam(\"nSignals\",\"i32\"),L.addParam(\"pres\",\"i32\"),L.addLocal(\"i\",\"i32\"),L.addLocal(\"j\",\"i32\"),L.addLocal(\"pp\",\"i32\"),L.addLocal(\"ps\",\"i32\"),L.addLocal(\"pd\",\"i32\"),L.addLocal(\"ncoefs\",\"i32\");let l=L.getCodeBuilder(),s=l.i32_const(t.alloc(d));L.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(d)))),l.setLocal(\"pp\",l.i32_add(l.getLocal(\"pp\"),l.i32_const(4))),l.call(n+\"_mul\",l.getLocal(\"ps\"),l.getLocal(\"pp\"),s),l.call(n+\"_add\",s,l.getLocal(\"pd\"),l.getLocal(\"pd\")),l.setLocal(\"pp\",l.i32_add(l.getLocal(\"pp\"),l.i32_const(d))),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(d))),l.setLocal(\"i\",l.i32_add(l.getLocal(\"i\"),l.i32_const(1))),l.br(0))))}return h(),f(),t.exportFunction(e+\"_zero\"),t.exportFunction(e+\"_constructLC\"),e}});var Us=Yt((Sy,Dl)=>{Dl.exports=function(t,e,n){let d=t.modules[n].n64*8;function h(){let l=t.addFunction(e+\"_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\");let s=l.getCodeBuilder(),x=s.i32_const(t.alloc(d));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(d)))),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal(\"ita\"),s.getLocal(\"last\"))),s.call(n+\"_zero\",s.getLocal(\"ita\")),s.call(n+\"_zero\",s.getLocal(\"itb\")),s.setLocal(\"ita\",s.i32_add(s.getLocal(\"ita\"),s.i32_const(d))),s.setLocal(\"itb\",s.i32_add(s.getLocal(\"itb\"),s.i32_const(d))),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(d+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(d+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(d+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(d+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(d)))),s.call(n+\"_mul\",s.i32_add(s.getLocal(\"pWitness\"),s.i32_mul(s.i32_sub(s.getLocal(\"s\"),s.getLocal(\"offsetWitness\")),s.i32_const(d))),s.i32_add(s.getLocal(\"it\"),s.i32_const(12)),x),s.call(n+\"_add\",s.getLocal(\"pOut\"),x,s.getLocal(\"pOut\")),s.setLocal(\"it\",s.i32_add(s.getLocal(\"it\"),s.i32_const(d+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(d)))),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal(\"ita\"),s.getLocal(\"last\"))),s.call(n+\"_mul\",s.getLocal(\"ita\"),s.getLocal(\"itb\"),s.getLocal(\"it\")),s.setLocal(\"ita\",s.i32_add(s.getLocal(\"ita\"),s.i32_const(d))),s.setLocal(\"itb\",s.i32_add(s.getLocal(\"itb\"),s.i32_const(d))),s.setLocal(\"it\",s.i32_add(s.getLocal(\"it\"),s.i32_const(d))),s.br(0))))}function f(){let l=t.addFunction(e+\"_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\");let s=l.getCodeBuilder(),x=s.i32_const(t.alloc(d));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(d)))),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal(\"ita\"),s.getLocal(\"last\"))),s.call(n+\"_mul\",s.getLocal(\"ita\"),s.getLocal(\"itb\"),x),s.call(n+\"_sub\",x,s.getLocal(\"itc\"),s.getLocal(\"itp\")),s.setLocal(\"ita\",s.i32_add(s.getLocal(\"ita\"),s.i32_const(d))),s.setLocal(\"itb\",s.i32_add(s.getLocal(\"itb\"),s.i32_const(d))),s.setLocal(\"itc\",s.i32_add(s.getLocal(\"itc\"),s.i32_const(d))),s.setLocal(\"itp\",s.i32_add(s.getLocal(\"itp\"),s.i32_const(d))),s.br(0))))}function L(){let l=t.addFunction(e+\"_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\");let 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(d)))),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal(\"ita\"),s.getLocal(\"last\"))),s.call(n+\"_add\",s.getLocal(\"ita\"),s.getLocal(\"itb\"),s.getLocal(\"itr\")),s.setLocal(\"ita\",s.i32_add(s.getLocal(\"ita\"),s.i32_const(d))),s.setLocal(\"itb\",s.i32_add(s.getLocal(\"itb\"),s.i32_const(d))),s.setLocal(\"itr\",s.i32_add(s.getLocal(\"itr\"),s.i32_const(d))),s.br(0))))}return h(),f(),L(),t.exportFunction(e+\"_buildABC\"),t.exportFunction(e+\"_joinABC\"),t.exportFunction(e+\"_batchAdd\"),e}});var Rs=Yt((qy,Zl)=>{Zl.exports=function(t,e,n,o,d,h,f,L){let l=t.addFunction(e);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\");let s=l.getCodeBuilder(),x=s.i32_const(t.alloc(f));l.addCode(s.setLocal(\"pFrom\",s.getLocal(\"pIn\")),s.setLocal(\"pTo\",s.getLocal(\"pOut\"))),l.addCode(s.call(o+\"_copy\",s.getLocal(\"pFirst\"),x)),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(L,s.getLocal(\"pFrom\"),x,s.getLocal(\"pTo\")),s.setLocal(\"pFrom\",s.i32_add(s.getLocal(\"pFrom\"),s.i32_const(d))),s.setLocal(\"pTo\",s.i32_add(s.getLocal(\"pTo\"),s.i32_const(h))),s.call(o+\"_mul\",x,s.getLocal(\"pInc\"),x),s.setLocal(\"i\",s.i32_add(s.getLocal(\"i\"),s.i32_const(1))),s.br(0)))),t.exportFunction(e)}});var Vl=Yt((Uy,jl)=>{var se=Ii(),oh=ra(),sh=xs(),Hl=Es(),ch=Bs(),$l=vs(),Os=Ss(),rh=qs(),lh=Us(),ua=Rs(),{bitLength:dh,modInv:uh,isOdd:Kl,isNegative:fh}=Bi();jl.exports=function(t,e){let n=e||\"bn128\";if(t.modules[n])return n;let o=21888242871839275222246405745257275088696311157297823662689037894645226208583n,d=21888242871839275222246405745257275088548364400416034343698204186575808495617n,h=Math.floor((dh(o-1n)-1)/64)+1,f=h*8,L=f,l=f,s=l*2,x=l*12,C=t.alloc(se.bigInt2BytesLE(d,L)),g=oh(t,o,\"f1m\");sh(t,d,\"fr\",\"frm\");let $=t.alloc(se.bigInt2BytesLE(W(3n),l)),it=$l(t,\"g1m\",\"f1m\",$);Os(t,\"frm\",\"frm\",\"frm\",\"frm_mul\"),rh(t,\"pol\",\"frm\"),lh(t,\"qap\",\"frm\");let q=Hl(t,\"f1m_neg\",\"f2m\",\"f1m\"),S=t.alloc([...se.bigInt2BytesLE(W(19485874751759354771024239261021720505790618469301721065564631296452457478373n),l),...se.bigInt2BytesLE(W(266929791119991161246907387137283842545076965332900288569378510910307636690n),l)]),O=$l(t,\"g2m\",\"f2m\",S);function M(D,u){let b=t.addFunction(D);b.addParam(\"pG\",\"i32\"),b.addParam(\"pFr\",\"i32\"),b.addParam(\"pr\",\"i32\");let B=b.getCodeBuilder(),p=B.i32_const(t.alloc(f));b.addCode(B.call(\"frm_fromMontgomery\",B.getLocal(\"pFr\"),p),B.call(u,B.getLocal(\"pG\"),p,B.i32_const(f),B.getLocal(\"pr\"))),t.exportFunction(D)}M(\"g1m_timesFr\",\"g1m_timesScalar\"),Os(t,\"g1m\",\"g1m\",\"frm\",\"g1m_timesFr\"),M(\"g2m_timesFr\",\"g2m_timesScalar\"),Os(t,\"g2m\",\"g2m\",\"frm\",\"g2m_timesFr\"),M(\"g1m_timesFrAffine\",\"g1m_timesScalarAffine\"),M(\"g2m_timesFrAffine\",\"g2m_timesScalarAffine\"),ua(t,\"frm_batchApplyKey\",\"fmr\",\"frm\",f,f,f,\"frm_mul\"),ua(t,\"g1m_batchApplyKey\",\"g1m\",\"frm\",f*3,f*3,f,\"g1m_timesFr\"),ua(t,\"g1m_batchApplyKeyMixed\",\"g1m\",\"frm\",f*2,f*3,f,\"g1m_timesFrAffine\"),ua(t,\"g2m_batchApplyKey\",\"g2m\",\"frm\",f*2*3,f*3*2,f,\"g2m_timesFr\"),ua(t,\"g2m_batchApplyKeyMixed\",\"g2m\",\"frm\",f*2*2,f*3*2,f,\"g2m_timesFrAffine\");function W(D){return BigInt(D)*(1n<<BigInt(l*8))%o}let ct=[1n,2n,1n],E=t.alloc([...se.bigInt2BytesLE(W(ct[0]),l),...se.bigInt2BytesLE(W(ct[1]),l),...se.bigInt2BytesLE(W(ct[2]),l)]),_=[0n,1n,0n],r=t.alloc([...se.bigInt2BytesLE(W(_[0]),l),...se.bigInt2BytesLE(W(_[1]),l),...se.bigInt2BytesLE(W(_[2]),l)]),Z=[[10857046999023057135944570762232829481370756359578518086990519993285655852781n,11559732032986387107991004021392285783925812861821192530917403151452391805634n],[8495653923123431417604973247489272438418190587263600148770280649306958101930n,4082367875863433681332203403145435568316851327593401208105741076214120093531n],[1n,0n]],j=t.alloc([...se.bigInt2BytesLE(W(Z[0][0]),l),...se.bigInt2BytesLE(W(Z[0][1]),l),...se.bigInt2BytesLE(W(Z[1][0]),l),...se.bigInt2BytesLE(W(Z[1][1]),l),...se.bigInt2BytesLE(W(Z[2][0]),l),...se.bigInt2BytesLE(W(Z[2][1]),l)]),nt=[[0n,0n],[1n,0n],[0n,0n]],v=t.alloc([...se.bigInt2BytesLE(W(nt[0][0]),l),...se.bigInt2BytesLE(W(nt[0][1]),l),...se.bigInt2BytesLE(W(nt[1][0]),l),...se.bigInt2BytesLE(W(nt[1][1]),l),...se.bigInt2BytesLE(W(nt[2][0]),l),...se.bigInt2BytesLE(W(nt[2][1]),l)]),y=t.alloc([...se.bigInt2BytesLE(W(1),l),...se.bigInt2BytesLE(W(0),l),...se.bigInt2BytesLE(W(0),l),...se.bigInt2BytesLE(W(0),l),...se.bigInt2BytesLE(W(0),l),...se.bigInt2BytesLE(W(0),l),...se.bigInt2BytesLE(W(0),l),...se.bigInt2BytesLE(W(0),l),...se.bigInt2BytesLE(W(0),l),...se.bigInt2BytesLE(W(0),l),...se.bigInt2BytesLE(W(0),l),...se.bigInt2BytesLE(W(0),l)]),T=t.alloc([...se.bigInt2BytesLE(W(9),l),...se.bigInt2BytesLE(W(1),l)]),V=t.alloc([...se.bigInt2BytesLE(W(uh(2n,o)),l),...se.bigInt2BytesLE(0n,l)]),rt=T,dt=t.alloc([...se.bigInt2BytesLE(W(19485874751759354771024239261021720505790618469301721065564631296452457478373n),l),...se.bigInt2BytesLE(W(266929791119991161246907387137283842545076965332900288569378510910307636690n),l)]);function ot(){let D=t.addFunction(n+\"_mulNR6\");D.addParam(\"x\",\"i32\"),D.addParam(\"pr\",\"i32\");let u=D.getCodeBuilder();D.addCode(u.call(q+\"_mul\",u.i32_const(T),u.getLocal(\"x\"),u.getLocal(\"pr\")))}ot();let xt=ch(t,n+\"_mulNR6\",\"f6m\",\"f2m\");function pt(){let D=t.addFunction(n+\"_mulNR12\");D.addParam(\"x\",\"i32\"),D.addParam(\"pr\",\"i32\");let u=D.getCodeBuilder();D.addCode(u.call(q+\"_mul\",u.i32_const(T),u.i32_add(u.getLocal(\"x\"),u.i32_const(f*4)),u.getLocal(\"pr\")),u.call(q+\"_copy\",u.getLocal(\"x\"),u.i32_add(u.getLocal(\"pr\"),u.i32_const(f*2))),u.call(q+\"_copy\",u.i32_add(u.getLocal(\"x\"),u.i32_const(f*2)),u.i32_add(u.getLocal(\"pr\"),u.i32_const(f*4))))}pt();let bt=Hl(t,n+\"_mulNR12\",\"ftm\",xt),Pt=Lt(29793968203157093288n),Ht=t.alloc(Pt),m=!1,a=3*s,w=Pt.length-1,G=Pt.reduce((D,u)=>D+(u!=0?1:0),0)+w+1,R=3*2*f,F=3*f*2+G*a,U=!1;t.modules[n]={n64:h,pG1gen:E,pG1zero:r,pG1b:$,pG2gen:j,pG2zero:v,pG2b:S,pq:t.modules.f1m.pq,pr:C,pOneT:y,prePSize:R,preQSize:F,r:d.toString(),q:o.toString()};let A=4965661367192848881n;function et(D){let u=D,b=[];for(;u>0n;){if(Kl(u)){let B=2-Number(u%4n);b.push(B),u=u-BigInt(B)}else b.push(0);u=u>>1n}return b}function Lt(D){let u=D,b=[];for(;u>0n;)Kl(u)?b.push(1):b.push(0),u=u>>1n;return b}function St(){let D=t.addFunction(n+\"_prepareG1\");D.addParam(\"pP\",\"i32\"),D.addParam(\"ppreP\",\"i32\");let u=D.getCodeBuilder();D.addCode(u.call(it+\"_normalize\",u.getLocal(\"pP\"),u.getLocal(\"ppreP\")))}function qt(){let D=t.addFunction(n+\"_prepAddStep\");D.addParam(\"pQ\",\"i32\"),D.addParam(\"pR\",\"i32\"),D.addParam(\"pCoef\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"pQ\"),B=u.i32_add(u.getLocal(\"pQ\"),u.i32_const(s)),p=u.getLocal(\"pR\"),P=u.i32_add(u.getLocal(\"pR\"),u.i32_const(s)),k=u.i32_add(u.getLocal(\"pR\"),u.i32_const(2*s)),Q=u.getLocal(\"pCoef\"),Y=u.i32_add(u.getLocal(\"pCoef\"),u.i32_const(s)),H=u.i32_add(u.getLocal(\"pCoef\"),u.i32_const(2*s)),tt=Y,X=u.i32_const(t.alloc(s)),lt=u.i32_const(t.alloc(s)),ht=u.i32_const(t.alloc(s)),yt=u.i32_const(t.alloc(s)),At=u.i32_const(t.alloc(s)),Ft=u.i32_const(t.alloc(s)),Mt=u.i32_const(t.alloc(s));D.addCode(u.call(q+\"_mul\",b,k,tt),u.call(q+\"_sub\",p,tt,tt),u.call(q+\"_mul\",B,k,X),u.call(q+\"_sub\",P,X,X),u.call(q+\"_square\",tt,lt),u.call(q+\"_square\",X,ht),u.call(q+\"_mul\",tt,lt,yt),u.call(q+\"_mul\",p,lt,At),u.call(q+\"_add\",At,At,Mt),u.call(q+\"_mul\",k,ht,Ft),u.call(q+\"_add\",yt,Ft,Ft),u.call(q+\"_sub\",Ft,Mt,Ft),u.call(q+\"_mul\",tt,Ft,p),u.call(q+\"_mul\",yt,P,P),u.call(q+\"_sub\",At,Ft,Mt),u.call(q+\"_mul\",X,Mt,Mt),u.call(q+\"_sub\",Mt,P,P),u.call(q+\"_mul\",k,yt,k),u.call(q+\"_mul\",tt,B,Mt),u.call(q+\"_mul\",X,b,Q),u.call(q+\"_sub\",Q,Mt,Q),u.call(q+\"_mul\",Q,u.i32_const(rt),Q),u.call(q+\"_neg\",X,H))}function Dt(){let D=t.addFunction(n+\"_prepDblStep\");D.addParam(\"pR\",\"i32\"),D.addParam(\"pCoef\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"pR\"),B=u.i32_add(u.getLocal(\"pR\"),u.i32_const(s)),p=u.i32_add(u.getLocal(\"pR\"),u.i32_const(2*s)),P=u.getLocal(\"pCoef\"),k=u.i32_add(u.getLocal(\"pCoef\"),u.i32_const(s)),Q=u.i32_add(u.getLocal(\"pCoef\"),u.i32_const(2*s)),Y=u.i32_const(t.alloc(s)),H=u.i32_const(t.alloc(s)),tt=u.i32_const(t.alloc(s)),X=u.i32_const(t.alloc(s)),lt=u.i32_const(t.alloc(s)),ht=u.i32_const(t.alloc(s)),yt=u.i32_const(t.alloc(s)),At=u.i32_const(t.alloc(s)),Ft=u.i32_const(t.alloc(s)),Mt=u.i32_const(t.alloc(s)),Qt=u.i32_const(t.alloc(s)),$t=u.i32_const(t.alloc(s));D.addCode(u.call(q+\"_mul\",B,u.i32_const(V),Y),u.call(q+\"_mul\",b,Y,Y),u.call(q+\"_square\",B,H),u.call(q+\"_square\",p,tt),u.call(q+\"_add\",tt,tt,X),u.call(q+\"_add\",X,tt,X),u.call(q+\"_mul\",u.i32_const(dt),X,lt),u.call(q+\"_add\",lt,lt,ht),u.call(q+\"_add\",lt,ht,ht),u.call(q+\"_add\",H,ht,yt),u.call(q+\"_mul\",yt,u.i32_const(V),yt),u.call(q+\"_add\",H,tt,$t),u.call(q+\"_add\",B,p,At),u.call(q+\"_square\",At,At),u.call(q+\"_sub\",At,$t,At),u.call(q+\"_sub\",lt,H,Ft),u.call(q+\"_square\",b,Mt),u.call(q+\"_square\",lt,Qt),u.call(q+\"_sub\",H,ht,$t),u.call(q+\"_mul\",Y,$t,b),u.call(q+\"_add\",Qt,Qt,$t),u.call(q+\"_add\",Qt,$t,$t),u.call(q+\"_square\",yt,B),u.call(q+\"_sub\",B,$t,B),u.call(q+\"_mul\",H,At,p),u.call(q+\"_mul\",u.i32_const(rt),Ft,P),u.call(q+\"_neg\",At,k),u.call(q+\"_add\",Mt,Mt,Q),u.call(q+\"_add\",Mt,Q,Q))}function kt(){let D=t.addFunction(n+\"_mulByQ\");D.addParam(\"p1\",\"i32\"),D.addParam(\"pr\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"p1\"),B=u.i32_add(u.getLocal(\"p1\"),u.i32_const(s)),p=u.i32_add(u.getLocal(\"p1\"),u.i32_const(s*2)),P=u.getLocal(\"pr\"),k=u.i32_add(u.getLocal(\"pr\"),u.i32_const(s)),Q=u.i32_add(u.getLocal(\"pr\"),u.i32_const(s*2)),Y=u.i32_const(t.alloc([...se.bigInt2BytesLE(W(\"21575463638280843010398324269430826099269044274347216827212613867836435027261\"),l),...se.bigInt2BytesLE(W(\"10307601595873709700152284273816112264069230130616436755625194854815875713954\"),l)])),H=u.i32_const(t.alloc([...se.bigInt2BytesLE(W(\"2821565182194536844548159561693502659359617185244120367078079554186484126554\"),l),...se.bigInt2BytesLE(W(\"3505843767911556378687030309984248845540243509899259641013678093033130930403\"),l)]));D.addCode(u.call(q+\"_conjugate\",b,P),u.call(q+\"_mul\",Y,P,P),u.call(q+\"_conjugate\",B,k),u.call(q+\"_mul\",H,k,k),u.call(q+\"_conjugate\",p,Q))}function Bt(){kt();let D=t.addFunction(n+\"_prepareG2\");D.addParam(\"pQ\",\"i32\"),D.addParam(\"ppreQ\",\"i32\"),D.addLocal(\"pCoef\",\"i32\"),D.addLocal(\"i\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"pQ\"),B=t.alloc(s*3),p=u.i32_const(B),P=u.i32_const(B),k=u.i32_const(B+s),Q=u.i32_const(B+2*s),Y=u.i32_add(u.getLocal(\"ppreQ\"),u.i32_const(0)),H=u.i32_add(u.getLocal(\"ppreQ\"),u.i32_const(s)),tt=t.alloc(s*3),X=u.i32_const(tt),lt=t.alloc(s*3),ht=u.i32_const(lt),yt=u.i32_const(lt+s);D.addCode(u.call(O+\"_normalize\",b,Y),u.call(q+\"_copy\",Y,P),u.call(q+\"_copy\",H,k),u.call(q+\"_one\",Q)),D.addCode(u.setLocal(\"pCoef\",u.i32_add(u.getLocal(\"ppreQ\"),u.i32_const(s*3))),u.setLocal(\"i\",u.i32_const(Pt.length-2)),u.block(u.loop(u.call(n+\"_prepDblStep\",p,u.getLocal(\"pCoef\")),u.setLocal(\"pCoef\",u.i32_add(u.getLocal(\"pCoef\"),u.i32_const(a))),u.if(u.i32_load8_s(u.getLocal(\"i\"),Ht),[...u.call(n+\"_prepAddStep\",Y,p,u.getLocal(\"pCoef\")),...u.setLocal(\"pCoef\",u.i32_add(u.getLocal(\"pCoef\"),u.i32_const(a)))]),u.br_if(1,u.i32_eqz(u.getLocal(\"i\"))),u.setLocal(\"i\",u.i32_sub(u.getLocal(\"i\"),u.i32_const(1))),u.br(0)))),D.addCode(u.call(n+\"_mulByQ\",Y,X),u.call(n+\"_mulByQ\",X,ht)),m&&D.addCode(u.call(q+\"_neg\",k,k)),D.addCode(u.call(q+\"_neg\",yt,yt),u.call(n+\"_prepAddStep\",X,p,u.getLocal(\"pCoef\")),u.setLocal(\"pCoef\",u.i32_add(u.getLocal(\"pCoef\"),u.i32_const(a))),u.call(n+\"_prepAddStep\",ht,p,u.getLocal(\"pCoef\")),u.setLocal(\"pCoef\",u.i32_add(u.getLocal(\"pCoef\"),u.i32_const(a))))}function Tt(){let D=t.addFunction(n+\"__mulBy024Old\");D.addParam(\"pEll0\",\"i32\"),D.addParam(\"pEllVW\",\"i32\"),D.addParam(\"pEllVV\",\"i32\"),D.addParam(\"pR\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"pEll0\"),B=u.getLocal(\"pEllVV\"),p=u.getLocal(\"pEllVW\"),P=u.getLocal(\"pR\"),k=t.alloc(x),Q=u.i32_const(k),Y=u.i32_const(k),H=u.i32_const(k+s),tt=u.i32_const(k+s*2),X=u.i32_const(k+s*3),lt=u.i32_const(k+s*4),ht=u.i32_const(k+s*5);D.addCode(u.call(q+\"_copy\",b,Y),u.call(q+\"_zero\",H),u.call(q+\"_copy\",B,tt),u.call(q+\"_zero\",X),u.call(q+\"_copy\",p,lt),u.call(q+\"_zero\",ht),u.call(bt+\"_mul\",Q,P,P))}function wt(){let D=t.addFunction(n+\"__mulBy024\");D.addParam(\"pEll0\",\"i32\"),D.addParam(\"pEllVW\",\"i32\"),D.addParam(\"pEllVV\",\"i32\"),D.addParam(\"pR\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"pEll0\"),B=u.getLocal(\"pEllVV\"),p=u.getLocal(\"pEllVW\"),P=u.getLocal(\"pR\"),k=u.i32_add(u.getLocal(\"pR\"),u.i32_const(2*f)),Q=u.i32_add(u.getLocal(\"pR\"),u.i32_const(4*f)),Y=u.i32_add(u.getLocal(\"pR\"),u.i32_const(6*f)),H=u.i32_add(u.getLocal(\"pR\"),u.i32_const(8*f)),tt=u.i32_add(u.getLocal(\"pR\"),u.i32_const(10*f)),X=u.i32_const(t.alloc(s)),lt=u.i32_const(t.alloc(s)),ht=u.i32_const(t.alloc(s)),yt=u.i32_const(t.alloc(s)),At=u.i32_const(t.alloc(s)),Ft=u.i32_const(t.alloc(s)),Mt=u.i32_const(t.alloc(s)),Qt=u.i32_const(t.alloc(s)),$t=u.i32_const(t.alloc(s)),Nt=u.i32_const(t.alloc(s)),Ot=u.i32_const(t.alloc(s));D.addCode(u.call(q+\"_mul\",P,b,Mt),u.call(q+\"_mul\",Q,B,Qt),u.call(q+\"_mul\",H,p,$t),u.call(q+\"_add\",P,H,ht),u.call(q+\"_add\",P,Q,lt),u.call(q+\"_add\",k,Y,yt),u.call(q+\"_add\",yt,tt,yt),u.call(q+\"_mul\",k,B,Nt),u.call(q+\"_add\",Nt,$t,At),u.call(q+\"_mul\",u.i32_const(T),At,Ft),u.call(q+\"_add\",Ft,Mt,P),u.call(q+\"_mul\",tt,p,At),u.call(q+\"_add\",Nt,At,Nt),u.call(q+\"_add\",At,Qt,At),u.call(q+\"_mul\",u.i32_const(T),At,Ft),u.call(q+\"_mul\",k,b,At),u.call(q+\"_add\",Nt,At,Nt),u.call(q+\"_add\",Ft,At,k),u.call(q+\"_add\",b,B,X),u.call(q+\"_mul\",lt,X,At),u.call(q+\"_add\",Mt,Qt,Ot),u.call(q+\"_sub\",At,Ot,At),u.call(q+\"_mul\",Y,p,Ft),u.call(q+\"_add\",Nt,Ft,Nt),u.call(q+\"_add\",Q,H,X),u.call(q+\"_add\",At,Ft,Q),u.call(q+\"_add\",B,p,lt),u.call(q+\"_mul\",lt,X,At),u.call(q+\"_add\",Qt,$t,Ot),u.call(q+\"_sub\",At,Ot,At),u.call(q+\"_mul\",u.i32_const(T),At,Ft),u.call(q+\"_mul\",Y,b,At),u.call(q+\"_add\",Nt,At,Nt),u.call(q+\"_add\",Ft,At,Y),u.call(q+\"_mul\",tt,B,At),u.call(q+\"_add\",Nt,At,Nt),u.call(q+\"_mul\",u.i32_const(T),At,Ft),u.call(q+\"_add\",b,p,X),u.call(q+\"_mul\",ht,X,At),u.call(q+\"_add\",Mt,$t,Ot),u.call(q+\"_sub\",At,Ot,At),u.call(q+\"_add\",Ft,At,H),u.call(q+\"_add\",b,B,X),u.call(q+\"_add\",X,p,X),u.call(q+\"_mul\",yt,X,At),u.call(q+\"_sub\",At,Nt,tt))}function Rt(){let D=t.addFunction(n+\"_millerLoop\");D.addParam(\"ppreP\",\"i32\"),D.addParam(\"ppreQ\",\"i32\"),D.addParam(\"r\",\"i32\"),D.addLocal(\"pCoef\",\"i32\"),D.addLocal(\"i\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"ppreP\"),B=u.i32_add(u.getLocal(\"ppreP\"),u.i32_const(l)),p=u.getLocal(\"pCoef\"),P=u.i32_add(u.getLocal(\"pCoef\"),u.i32_const(s)),k=u.i32_add(u.getLocal(\"pCoef\"),u.i32_const(2*s)),Q=t.alloc(s),Y=u.i32_const(Q),H=t.alloc(s),tt=u.i32_const(H),X=u.getLocal(\"r\");D.addCode(u.call(bt+\"_one\",X),u.setLocal(\"pCoef\",u.i32_add(u.getLocal(\"ppreQ\"),u.i32_const(s*3))),u.setLocal(\"i\",u.i32_const(Pt.length-2)),u.block(u.loop(u.call(bt+\"_square\",X,X),u.call(q+\"_mul1\",P,B,Y),u.call(q+\"_mul1\",k,b,tt),u.call(n+\"__mulBy024\",p,Y,tt,X),u.setLocal(\"pCoef\",u.i32_add(u.getLocal(\"pCoef\"),u.i32_const(a))),u.if(u.i32_load8_s(u.getLocal(\"i\"),Ht),[...u.call(q+\"_mul1\",P,B,Y),...u.call(q+\"_mul1\",k,b,tt),...u.call(n+\"__mulBy024\",p,Y,tt,X),...u.setLocal(\"pCoef\",u.i32_add(u.getLocal(\"pCoef\"),u.i32_const(a)))]),u.br_if(1,u.i32_eqz(u.getLocal(\"i\"))),u.setLocal(\"i\",u.i32_sub(u.getLocal(\"i\"),u.i32_const(1))),u.br(0)))),m&&D.addCode(u.call(bt+\"_inverse\",X,X)),D.addCode(u.call(q+\"_mul1\",P,B,Y),u.call(q+\"_mul1\",k,b,tt),u.call(n+\"__mulBy024\",p,Y,tt,X),u.setLocal(\"pCoef\",u.i32_add(u.getLocal(\"pCoef\"),u.i32_const(a))),u.call(q+\"_mul1\",P,B,Y),u.call(q+\"_mul1\",k,b,tt),u.call(n+\"__mulBy024\",p,Y,tt,X),u.setLocal(\"pCoef\",u.i32_add(u.getLocal(\"pCoef\"),u.i32_const(a))))}function I(D){let u=[[[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]]],b=[[[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]]],B=t.addFunction(n+\"__frobeniusMap\"+D);B.addParam(\"x\",\"i32\"),B.addParam(\"r\",\"i32\");let p=B.getCodeBuilder();for(let k=0;k<6;k++){let Q=k==0?p.getLocal(\"x\"):p.i32_add(p.getLocal(\"x\"),p.i32_const(k*s)),Y=Q,H=p.i32_add(p.getLocal(\"x\"),p.i32_const(k*s+l)),tt=k==0?p.getLocal(\"r\"):p.i32_add(p.getLocal(\"r\"),p.i32_const(k*s)),X=tt,lt=p.i32_add(p.getLocal(\"r\"),p.i32_const(k*s+l)),ht=P(u[Math.floor(k/3)][D%12],b[k%3][D%6]),yt=t.alloc([...se.bigInt2BytesLE(W(ht[0]),32),...se.bigInt2BytesLE(W(ht[1]),32)]);D%2==1?B.addCode(p.call(g+\"_copy\",Y,X),p.call(g+\"_neg\",H,lt),p.call(q+\"_mul\",tt,p.i32_const(yt),tt)):B.addCode(p.call(q+\"_mul\",Q,p.i32_const(yt),tt))}function P(k,Q){let Y=BigInt(k[0]),H=BigInt(k[1]),tt=BigInt(Q[0]),X=BigInt(Q[1]),lt=[(Y*tt-H*X)%o,(Y*X+H*tt)%o];return fh(lt[0])&&(lt[0]=lt[0]+o),lt}}function z(){let D=t.addFunction(n+\"__finalExponentiationFirstChunk\");D.addParam(\"x\",\"i32\"),D.addParam(\"r\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"x\"),B=b,p=u.i32_add(b,u.i32_const(f*6)),P=u.getLocal(\"r\"),k=t.alloc(x),Q=u.i32_const(k),Y=Q,H=u.i32_const(k+f*6),tt=u.i32_const(t.alloc(x)),X=u.i32_const(t.alloc(x)),lt=u.i32_const(t.alloc(x));D.addCode(u.call(xt+\"_copy\",B,Y),u.call(xt+\"_neg\",p,H),u.call(bt+\"_inverse\",b,tt),u.call(bt+\"_mul\",Q,tt,X),u.call(n+\"__frobeniusMap2\",X,lt),u.call(bt+\"_mul\",X,lt,P))}function J(){let D=t.addFunction(n+\"__cyclotomicSquare\");D.addParam(\"x\",\"i32\"),D.addParam(\"r\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"x\"),B=u.i32_add(u.getLocal(\"x\"),u.i32_const(s)),p=u.i32_add(u.getLocal(\"x\"),u.i32_const(2*s)),P=u.i32_add(u.getLocal(\"x\"),u.i32_const(3*s)),k=u.i32_add(u.getLocal(\"x\"),u.i32_const(4*s)),Q=u.i32_add(u.getLocal(\"x\"),u.i32_const(5*s)),Y=u.getLocal(\"r\"),H=u.i32_add(u.getLocal(\"r\"),u.i32_const(s)),tt=u.i32_add(u.getLocal(\"r\"),u.i32_const(2*s)),X=u.i32_add(u.getLocal(\"r\"),u.i32_const(3*s)),lt=u.i32_add(u.getLocal(\"r\"),u.i32_const(4*s)),ht=u.i32_add(u.getLocal(\"r\"),u.i32_const(5*s)),yt=u.i32_const(t.alloc(s)),At=u.i32_const(t.alloc(s)),Ft=u.i32_const(t.alloc(s)),Mt=u.i32_const(t.alloc(s)),Qt=u.i32_const(t.alloc(s)),$t=u.i32_const(t.alloc(s)),Nt=u.i32_const(t.alloc(s)),Ot=u.i32_const(t.alloc(s));D.addCode(u.call(q+\"_mul\",b,k,Nt),u.call(q+\"_mul\",k,u.i32_const(T),yt),u.call(q+\"_add\",b,yt,yt),u.call(q+\"_add\",b,k,Ot),u.call(q+\"_mul\",Ot,yt,yt),u.call(q+\"_mul\",u.i32_const(T),Nt,Ot),u.call(q+\"_add\",Nt,Ot,Ot),u.call(q+\"_sub\",yt,Ot,yt),u.call(q+\"_add\",Nt,Nt,At),u.call(q+\"_mul\",P,p,Nt),u.call(q+\"_mul\",p,u.i32_const(T),Ft),u.call(q+\"_add\",P,Ft,Ft),u.call(q+\"_add\",P,p,Ot),u.call(q+\"_mul\",Ot,Ft,Ft),u.call(q+\"_mul\",u.i32_const(T),Nt,Ot),u.call(q+\"_add\",Nt,Ot,Ot),u.call(q+\"_sub\",Ft,Ot,Ft),u.call(q+\"_add\",Nt,Nt,Mt),u.call(q+\"_mul\",B,Q,Nt),u.call(q+\"_mul\",Q,u.i32_const(T),Qt),u.call(q+\"_add\",B,Qt,Qt),u.call(q+\"_add\",B,Q,Ot),u.call(q+\"_mul\",Ot,Qt,Qt),u.call(q+\"_mul\",u.i32_const(T),Nt,Ot),u.call(q+\"_add\",Nt,Ot,Ot),u.call(q+\"_sub\",Qt,Ot,Qt),u.call(q+\"_add\",Nt,Nt,$t),u.call(q+\"_sub\",yt,b,Y),u.call(q+\"_add\",Y,Y,Y),u.call(q+\"_add\",yt,Y,Y),u.call(q+\"_add\",At,k,lt),u.call(q+\"_add\",lt,lt,lt),u.call(q+\"_add\",At,lt,lt),u.call(q+\"_mul\",$t,u.i32_const(rt),Ot),u.call(q+\"_add\",Ot,P,X),u.call(q+\"_add\",X,X,X),u.call(q+\"_add\",Ot,X,X),u.call(q+\"_sub\",Qt,p,tt),u.call(q+\"_add\",tt,tt,tt),u.call(q+\"_add\",Qt,tt,tt),u.call(q+\"_sub\",Ft,B,H),u.call(q+\"_add\",H,H,H),u.call(q+\"_add\",Ft,H,H),u.call(q+\"_add\",Mt,Q,ht),u.call(q+\"_add\",ht,ht,ht),u.call(q+\"_add\",Mt,ht,ht))}function st(D,u){let b=et(D).map(H=>H==-1?255:H),B=t.alloc(b),p=t.addFunction(n+\"__cyclotomicExp_\"+u);p.addParam(\"x\",\"i32\"),p.addParam(\"r\",\"i32\"),p.addLocal(\"bit\",\"i32\"),p.addLocal(\"i\",\"i32\");let P=p.getCodeBuilder(),k=P.getLocal(\"x\"),Q=P.getLocal(\"r\"),Y=P.i32_const(t.alloc(x));p.addCode(P.call(bt+\"_conjugate\",k,Y),P.call(bt+\"_one\",Q),P.if(P.teeLocal(\"bit\",P.i32_load8_s(P.i32_const(b.length-1),B)),P.if(P.i32_eq(P.getLocal(\"bit\"),P.i32_const(1)),P.call(bt+\"_mul\",Q,k,Q),P.call(bt+\"_mul\",Q,Y,Q))),P.setLocal(\"i\",P.i32_const(b.length-2)),P.block(P.loop(P.call(n+\"__cyclotomicSquare\",Q,Q),P.if(P.teeLocal(\"bit\",P.i32_load8_s(P.getLocal(\"i\"),B)),P.if(P.i32_eq(P.getLocal(\"bit\"),P.i32_const(1)),P.call(bt+\"_mul\",Q,k,Q),P.call(bt+\"_mul\",Q,Y,Q))),P.br_if(1,P.i32_eqz(P.getLocal(\"i\"))),P.setLocal(\"i\",P.i32_sub(P.getLocal(\"i\"),P.i32_const(1))),P.br(0))))}function mt(){J(),st(A,\"w0\");let D=t.addFunction(n+\"__finalExponentiationLastChunk\");D.addParam(\"x\",\"i32\"),D.addParam(\"r\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"x\"),B=u.getLocal(\"r\"),p=u.i32_const(t.alloc(x)),P=u.i32_const(t.alloc(x)),k=u.i32_const(t.alloc(x)),Q=u.i32_const(t.alloc(x)),Y=u.i32_const(t.alloc(x)),H=u.i32_const(t.alloc(x)),tt=u.i32_const(t.alloc(x)),X=u.i32_const(t.alloc(x)),lt=u.i32_const(t.alloc(x)),ht=u.i32_const(t.alloc(x)),yt=u.i32_const(t.alloc(x)),At=u.i32_const(t.alloc(x)),Ft=u.i32_const(t.alloc(x)),Mt=u.i32_const(t.alloc(x)),Qt=u.i32_const(t.alloc(x)),$t=u.i32_const(t.alloc(x)),Nt=u.i32_const(t.alloc(x)),Ot=u.i32_const(t.alloc(x)),Xt=u.i32_const(t.alloc(x)),ie=u.i32_const(t.alloc(x)),ce=u.i32_const(t.alloc(x));D.addCode(u.call(n+\"__cyclotomicExp_w0\",b,p),U?[]:u.call(bt+\"_conjugate\",p,p),u.call(n+\"__cyclotomicSquare\",p,P),u.call(n+\"__cyclotomicSquare\",P,k),u.call(bt+\"_mul\",k,P,Q),u.call(n+\"__cyclotomicExp_w0\",Q,Y),U?[]:u.call(bt+\"_conjugate\",Y,Y),u.call(n+\"__cyclotomicSquare\",Y,H),u.call(n+\"__cyclotomicExp_w0\",H,tt),U?[]:u.call(bt+\"_conjugate\",tt,tt),u.call(bt+\"_conjugate\",Q,X),u.call(bt+\"_conjugate\",tt,lt),u.call(bt+\"_mul\",lt,Y,ht),u.call(bt+\"_mul\",ht,X,yt),u.call(bt+\"_mul\",yt,P,At),u.call(bt+\"_mul\",yt,Y,Ft),u.call(bt+\"_mul\",Ft,b,Mt),u.call(n+\"__frobeniusMap1\",At,Qt),u.call(bt+\"_mul\",Qt,Mt,$t),u.call(n+\"__frobeniusMap2\",yt,Nt),u.call(bt+\"_mul\",Nt,$t,Ot),u.call(bt+\"_conjugate\",b,Xt),u.call(bt+\"_mul\",Xt,At,ie),u.call(n+\"__frobeniusMap3\",ie,ce),u.call(bt+\"_mul\",ce,Ot,B))}function _t(){z(),mt();let D=t.addFunction(n+\"_finalExponentiation\");D.addParam(\"x\",\"i32\"),D.addParam(\"r\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"x\"),B=u.getLocal(\"r\"),p=u.i32_const(t.alloc(x));D.addCode(u.call(n+\"__finalExponentiationFirstChunk\",b,p),u.call(n+\"__finalExponentiationLastChunk\",p,B))}function It(){let D=t.addFunction(n+\"_finalExponentiationOld\");D.addParam(\"x\",\"i32\"),D.addParam(\"r\",\"i32\");let b=t.alloc(se.bigInt2BytesLE(552484233613224096312617126783173147097382103762957654188882734314196910839907541213974502761540629817009608548654680343627701153829446747810907373256841551006201639677726139946029199968412598804882391702273019083653272047566316584365559776493027495458238373902875937659943504873220554161550525926302303331747463515644711876653177129578303191095900909191624817826566688241804408081892785725967931714097716709526092261278071952560171111444072049229123565057483750161460024353346284167282452756217662335528813519139808291170539072125381230815729071544861602750936964829313608137325426383735122175229541155376346436093930287402089517426973178917569713384748081827255472576937471496195752727188261435633271238710131736096299798168852925540549342330775279877006784354801422249722573783561685179618816480037695005515426162362431072245638324744480n,352)),B=D.getCodeBuilder();D.addCode(B.call(bt+\"_exp\",B.getLocal(\"x\"),B.i32_const(b),B.i32_const(352),B.getLocal(\"r\")))}let Et=t.alloc(R),Ct=t.alloc(F);function Wt(D){let u=t.addFunction(n+\"_pairingEq\"+D);for(let P=0;P<D;P++)u.addParam(\"p_\"+P,\"i32\"),u.addParam(\"q_\"+P,\"i32\");u.addParam(\"c\",\"i32\"),u.setReturnType(\"i32\");let b=u.getCodeBuilder(),B=b.i32_const(t.alloc(x)),p=b.i32_const(t.alloc(x));u.addCode(b.call(bt+\"_one\",B));for(let P=0;P<D;P++)u.addCode(b.call(n+\"_prepareG1\",b.getLocal(\"p_\"+P),b.i32_const(Et))),u.addCode(b.call(n+\"_prepareG2\",b.getLocal(\"q_\"+P),b.i32_const(Ct))),u.addCode(b.call(n+\"_millerLoop\",b.i32_const(Et),b.i32_const(Ct),p)),u.addCode(b.call(bt+\"_mul\",B,p,B));u.addCode(b.call(n+\"_finalExponentiation\",B,B)),u.addCode(b.call(bt+\"_eq\",B,b.getLocal(\"c\")))}function ne(){let D=t.addFunction(n+\"_pairing\");D.addParam(\"p\",\"i32\"),D.addParam(\"q\",\"i32\"),D.addParam(\"r\",\"i32\");let u=D.getCodeBuilder(),b=u.i32_const(t.alloc(x));D.addCode(u.call(n+\"_prepareG1\",u.getLocal(\"p\"),u.i32_const(Et))),D.addCode(u.call(n+\"_prepareG2\",u.getLocal(\"q\"),u.i32_const(Ct))),D.addCode(u.call(n+\"_millerLoop\",u.i32_const(Et),u.i32_const(Ct),b)),D.addCode(u.call(n+\"_finalExponentiation\",b,u.getLocal(\"r\")))}qt(),Dt(),St(),Bt(),wt(),Tt(),Rt();for(let D=0;D<10;D++)I(D),t.exportFunction(n+\"__frobeniusMap\"+D);It(),_t();for(let D=1;D<=5;D++)Wt(D),t.exportFunction(n+\"_pairingEq\"+D);ne(),t.exportFunction(n+\"_pairing\"),t.exportFunction(n+\"_prepareG1\"),t.exportFunction(n+\"_prepareG2\"),t.exportFunction(n+\"_millerLoop\"),t.exportFunction(n+\"_finalExponentiation\"),t.exportFunction(n+\"_finalExponentiationOld\"),t.exportFunction(n+\"__mulBy024\"),t.exportFunction(n+\"__mulBy024Old\"),t.exportFunction(n+\"__cyclotomicSquare\"),t.exportFunction(n+\"__cyclotomicExp_w0\")}});var ed=Yt((Ry,td)=>{var ae=Ii(),_h=ra(),hh=xs(),Wl=Es(),gh=Bs(),Yl=vs(),Ps=Ss(),ph=qs(),Lh=Us(),fa=Rs(),{bitLength:Xl,isOdd:Jl,isNegative:mh}=Bi();td.exports=function(t,e){let n=e||\"bls12381\";if(t.modules[n])return n;let o=0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn,d=0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001n,h=Math.floor((Xl(o-1n)-1)/64)+1,f=h*8,L=f,l=L*2,s=L*12,x=Math.floor((Xl(d-1n)-1)/64)+1,C=x*8,g=C,$=t.alloc(ae.bigInt2BytesLE(d,g)),it=_h(t,o,\"f1m\",\"intq\");hh(t,d,\"fr\",\"frm\",\"intr\");let q=t.alloc(ae.bigInt2BytesLE(E(4n),L)),S=Yl(t,\"g1m\",\"f1m\",q);Ps(t,\"frm\",\"frm\",\"frm\",\"frm_mul\"),ph(t,\"pol\",\"frm\"),Lh(t,\"qap\",\"frm\");let O=Wl(t,\"f1m_neg\",\"f2m\",\"f1m\"),M=t.alloc([...ae.bigInt2BytesLE(E(4n),L),...ae.bigInt2BytesLE(E(4n),L)]),W=Yl(t,\"g2m\",\"f2m\",M);function ct(D,u){let b=t.addFunction(D);b.addParam(\"pG\",\"i32\"),b.addParam(\"pFr\",\"i32\"),b.addParam(\"pr\",\"i32\");let B=b.getCodeBuilder(),p=B.i32_const(t.alloc(C));b.addCode(B.call(\"frm_fromMontgomery\",B.getLocal(\"pFr\"),p),B.call(u,B.getLocal(\"pG\"),p,B.i32_const(C),B.getLocal(\"pr\"))),t.exportFunction(D)}ct(\"g1m_timesFr\",\"g1m_timesScalar\"),Ps(t,\"g1m\",\"g1m\",\"frm\",\"g1m_timesFr\"),ct(\"g2m_timesFr\",\"g2m_timesScalar\"),Ps(t,\"g2m\",\"g2m\",\"frm\",\"g2m_timesFr\"),ct(\"g1m_timesFrAffine\",\"g1m_timesScalarAffine\"),ct(\"g2m_timesFrAffine\",\"g2m_timesScalarAffine\"),fa(t,\"frm_batchApplyKey\",\"fmr\",\"frm\",C,C,C,\"frm_mul\"),fa(t,\"g1m_batchApplyKey\",\"g1m\",\"frm\",f*3,f*3,C,\"g1m_timesFr\"),fa(t,\"g1m_batchApplyKeyMixed\",\"g1m\",\"frm\",f*2,f*3,C,\"g1m_timesFrAffine\"),fa(t,\"g2m_batchApplyKey\",\"g2m\",\"frm\",f*2*3,f*3*2,C,\"g2m_timesFr\"),fa(t,\"g2m_batchApplyKeyMixed\",\"g2m\",\"frm\",f*2*2,f*3*2,C,\"g2m_timesFrAffine\");function E(D){return BigInt(D)*(1n<<BigInt(L*8))%o}let _=[3685416753713387016781088315183077757961620795782546409894578378688607592378376318836054947676345821548104185464507n,1339506544944476473020471379941921221584933875938349620426543736416511423956333506472724655353366534992391756441569n,1n],r=t.alloc([...ae.bigInt2BytesLE(E(_[0]),L),...ae.bigInt2BytesLE(E(_[1]),L),...ae.bigInt2BytesLE(E(_[2]),L)]),Z=[0n,1n,0n],j=t.alloc([...ae.bigInt2BytesLE(E(Z[0]),L),...ae.bigInt2BytesLE(E(Z[1]),L),...ae.bigInt2BytesLE(E(Z[2]),L)]),nt=[[352701069587466618187139116011060144890029952792775240219908644239793785735715026873347600343865175952761926303160n,3059144344244213709971259814753781636986470325476647558659373206291635324768958432433509563104347017837885763365758n],[1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905n,927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582n],[1n,0n]],v=t.alloc([...ae.bigInt2BytesLE(E(nt[0][0]),L),...ae.bigInt2BytesLE(E(nt[0][1]),L),...ae.bigInt2BytesLE(E(nt[1][0]),L),...ae.bigInt2BytesLE(E(nt[1][1]),L),...ae.bigInt2BytesLE(E(nt[2][0]),L),...ae.bigInt2BytesLE(E(nt[2][1]),L)]),y=[[0n,0n],[1n,0n],[0n,0n]],T=t.alloc([...ae.bigInt2BytesLE(E(y[0][0]),L),...ae.bigInt2BytesLE(E(y[0][1]),L),...ae.bigInt2BytesLE(E(y[1][0]),L),...ae.bigInt2BytesLE(E(y[1][1]),L),...ae.bigInt2BytesLE(E(y[2][0]),L),...ae.bigInt2BytesLE(E(y[2][1]),L)]),V=t.alloc([...ae.bigInt2BytesLE(E(1n),L),...ae.bigInt2BytesLE(E(0n),L),...ae.bigInt2BytesLE(E(0n),L),...ae.bigInt2BytesLE(E(0n),L),...ae.bigInt2BytesLE(E(0n),L),...ae.bigInt2BytesLE(E(0n),L),...ae.bigInt2BytesLE(E(0n),L),...ae.bigInt2BytesLE(E(0n),L),...ae.bigInt2BytesLE(E(0n),L),...ae.bigInt2BytesLE(E(0n),L),...ae.bigInt2BytesLE(E(0n),L),...ae.bigInt2BytesLE(E(0n),L)]),rt=t.alloc([...ae.bigInt2BytesLE(E(1n),L),...ae.bigInt2BytesLE(E(1n),L)]);function dt(){let D=t.addFunction(O+\"_mulNR\");D.addParam(\"x\",\"i32\"),D.addParam(\"pr\",\"i32\");let u=D.getCodeBuilder(),b=u.i32_const(t.alloc(L)),B=u.getLocal(\"x\"),p=u.i32_add(u.getLocal(\"x\"),u.i32_const(L)),P=u.getLocal(\"pr\"),k=u.i32_add(u.getLocal(\"pr\"),u.i32_const(L));D.addCode(u.call(it+\"_copy\",B,b),u.call(it+\"_sub\",B,p,P),u.call(it+\"_add\",b,p,k))}dt();let ot=gh(t,O+\"_mulNR\",\"f6m\",\"f2m\");function xt(){let D=t.addFunction(ot+\"_mulNR\");D.addParam(\"x\",\"i32\"),D.addParam(\"pr\",\"i32\");let u=D.getCodeBuilder(),b=u.i32_const(t.alloc(L*2));D.addCode(u.call(O+\"_copy\",u.getLocal(\"x\"),b),u.call(O+\"_mulNR\",u.i32_add(u.getLocal(\"x\"),u.i32_const(f*4)),u.getLocal(\"pr\")),u.call(O+\"_copy\",u.i32_add(u.getLocal(\"x\"),u.i32_const(f*2)),u.i32_add(u.getLocal(\"pr\"),u.i32_const(f*4))),u.call(O+\"_copy\",b,u.i32_add(u.getLocal(\"pr\"),u.i32_const(f*2))))}xt();let pt=Wl(t,ot+\"_mulNR\",\"ftm\",ot),vt=et(0xd201000000010000n),Pt=t.alloc(vt),Ht=!0,m=3*l,a=vt.length-1,c=vt.reduce((D,u)=>D+(u!=0?1:0),0)+a+1,G=3*2*f,R=3*f*2+c*m,F=!0,U=15132376222941642752n;t.modules[n]={n64q:h,n64r:x,n8q:f,n8r:C,pG1gen:r,pG1zero:j,pG1b:q,pG2gen:v,pG2zero:T,pG2b:M,pq:t.modules.f1m.pq,pr:$,pOneT:V,r:d,q:o,prePSize:G,preQSize:R};function A(D){let u=D,b=[];for(;u>0n;){if(Jl(u)){let B=2-Number(u%4n);b.push(B),u=u-BigInt(B)}else b.push(0);u=u>>1n}return b}function et(D){let u=D,b=[];for(;u>0n;)Jl(u)?b.push(1):b.push(0),u=u>>1n;return b}function Lt(){let D=t.addFunction(n+\"_prepareG1\");D.addParam(\"pP\",\"i32\"),D.addParam(\"ppreP\",\"i32\");let u=D.getCodeBuilder();D.addCode(u.call(S+\"_normalize\",u.getLocal(\"pP\"),u.getLocal(\"ppreP\")))}function St(){let D=t.addFunction(n+\"_prepDblStep\");D.addParam(\"R\",\"i32\"),D.addParam(\"r\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"R\"),B=u.i32_add(u.getLocal(\"R\"),u.i32_const(2*f)),p=u.i32_add(u.getLocal(\"R\"),u.i32_const(4*f)),P=u.getLocal(\"r\"),k=u.i32_add(u.getLocal(\"r\"),u.i32_const(2*f)),Q=u.i32_add(u.getLocal(\"r\"),u.i32_const(4*f)),Y=u.i32_const(t.alloc(l)),H=u.i32_const(t.alloc(l)),tt=u.i32_const(t.alloc(l)),X=u.i32_const(t.alloc(l)),lt=u.i32_const(t.alloc(l));D.addCode(u.call(O+\"_square\",b,P),u.call(O+\"_square\",B,H),u.call(O+\"_square\",H,tt),u.call(O+\"_add\",H,b,k),u.call(O+\"_square\",k,k),u.call(O+\"_sub\",k,P,k),u.call(O+\"_sub\",k,tt,k),u.call(O+\"_add\",k,k,k),u.call(O+\"_add\",P,P,X),u.call(O+\"_add\",X,P,X),u.call(O+\"_add\",b,X,Q),u.call(O+\"_square\",X,lt),u.call(O+\"_square\",p,Y),u.call(O+\"_sub\",lt,k,b),u.call(O+\"_sub\",b,k,b),u.call(O+\"_add\",p,B,p),u.call(O+\"_square\",p,p),u.call(O+\"_sub\",p,H,p),u.call(O+\"_sub\",p,Y,p),u.call(O+\"_sub\",k,b,B),u.call(O+\"_mul\",B,X,B),u.call(O+\"_add\",tt,tt,tt),u.call(O+\"_add\",tt,tt,tt),u.call(O+\"_add\",tt,tt,tt),u.call(O+\"_sub\",B,tt,B),u.call(O+\"_mul\",X,Y,k),u.call(O+\"_add\",k,k,k),u.call(O+\"_neg\",k,k),u.call(O+\"_square\",Q,Q),u.call(O+\"_sub\",Q,P,Q),u.call(O+\"_sub\",Q,lt,Q),u.call(O+\"_add\",H,H,H),u.call(O+\"_add\",H,H,H),u.call(O+\"_sub\",Q,H,Q),u.call(O+\"_mul\",p,Y,P),u.call(O+\"_add\",P,P,P))}function qt(){let D=t.addFunction(n+\"_prepAddStep\");D.addParam(\"R\",\"i32\"),D.addParam(\"Q\",\"i32\"),D.addParam(\"r\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"R\"),B=u.i32_add(u.getLocal(\"R\"),u.i32_const(2*f)),p=u.i32_add(u.getLocal(\"R\"),u.i32_const(4*f)),P=u.getLocal(\"Q\"),k=u.i32_add(u.getLocal(\"Q\"),u.i32_const(2*f)),Q=u.getLocal(\"r\"),Y=u.i32_add(u.getLocal(\"r\"),u.i32_const(2*f)),H=u.i32_add(u.getLocal(\"r\"),u.i32_const(4*f)),tt=u.i32_const(t.alloc(l)),X=u.i32_const(t.alloc(l)),lt=u.i32_const(t.alloc(l)),ht=u.i32_const(t.alloc(l)),yt=u.i32_const(t.alloc(l)),At=u.i32_const(t.alloc(l)),Ft=u.i32_const(t.alloc(l)),Mt=u.i32_const(t.alloc(l)),Qt=u.i32_const(t.alloc(l)),$t=u.i32_const(t.alloc(l)),Nt=u.i32_const(t.alloc(l));D.addCode(u.call(O+\"_square\",p,tt),u.call(O+\"_square\",k,X),u.call(O+\"_mul\",tt,P,ht),u.call(O+\"_add\",k,p,Y),u.call(O+\"_square\",Y,Y),u.call(O+\"_sub\",Y,X,Y),u.call(O+\"_sub\",Y,tt,Y),u.call(O+\"_mul\",Y,tt,Y),u.call(O+\"_sub\",ht,b,yt),u.call(O+\"_square\",yt,At),u.call(O+\"_add\",At,At,Ft),u.call(O+\"_add\",Ft,Ft,Ft),u.call(O+\"_mul\",Ft,yt,Mt),u.call(O+\"_sub\",Y,B,Qt),u.call(O+\"_sub\",Qt,B,Qt),u.call(O+\"_mul\",Qt,P,H),u.call(O+\"_mul\",Ft,b,$t),u.call(O+\"_square\",Qt,b),u.call(O+\"_sub\",b,Mt,b),u.call(O+\"_sub\",b,$t,b),u.call(O+\"_sub\",b,$t,b),u.call(O+\"_add\",p,yt,p),u.call(O+\"_square\",p,p),u.call(O+\"_sub\",p,tt,p),u.call(O+\"_sub\",p,At,p),u.call(O+\"_add\",k,p,Q),u.call(O+\"_sub\",$t,b,Nt),u.call(O+\"_mul\",Nt,Qt,Nt),u.call(O+\"_mul\",B,Mt,ht),u.call(O+\"_add\",ht,ht,ht),u.call(O+\"_sub\",Nt,ht,B),u.call(O+\"_square\",Q,Q),u.call(O+\"_sub\",Q,X,Q),u.call(O+\"_square\",p,lt),u.call(O+\"_sub\",Q,lt,Q),u.call(O+\"_add\",H,H,H),u.call(O+\"_sub\",H,Q,H),u.call(O+\"_add\",p,p,Q),u.call(O+\"_neg\",Qt,Qt),u.call(O+\"_add\",Qt,Qt,Y))}function Dt(){let D=t.addFunction(n+\"_prepareG2\");D.addParam(\"pQ\",\"i32\"),D.addParam(\"ppreQ\",\"i32\"),D.addLocal(\"pCoef\",\"i32\"),D.addLocal(\"i\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"pQ\"),B=t.alloc(l*3),p=u.i32_const(B),P=u.getLocal(\"ppreQ\");D.addCode(u.call(W+\"_normalize\",b,P),u.if(u.call(W+\"_isZero\",P),u.ret([])),u.call(W+\"_copy\",P,p),u.setLocal(\"pCoef\",u.i32_add(u.getLocal(\"ppreQ\"),u.i32_const(l*3)))),D.addCode(u.setLocal(\"i\",u.i32_const(vt.length-2)),u.block(u.loop(u.call(n+\"_prepDblStep\",p,u.getLocal(\"pCoef\")),u.setLocal(\"pCoef\",u.i32_add(u.getLocal(\"pCoef\"),u.i32_const(m))),u.if(u.i32_load8_s(u.getLocal(\"i\"),Pt),[...u.call(n+\"_prepAddStep\",p,P,u.getLocal(\"pCoef\")),...u.setLocal(\"pCoef\",u.i32_add(u.getLocal(\"pCoef\"),u.i32_const(m)))]),u.br_if(1,u.i32_eqz(u.getLocal(\"i\"))),u.setLocal(\"i\",u.i32_sub(u.getLocal(\"i\"),u.i32_const(1))),u.br(0))))}function kt(){let D=t.addFunction(ot+\"_mul1\");D.addParam(\"pA\",\"i32\"),D.addParam(\"pC1\",\"i32\"),D.addParam(\"pR\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"pA\"),B=u.i32_add(u.getLocal(\"pA\"),u.i32_const(L*2)),p=u.i32_add(u.getLocal(\"pA\"),u.i32_const(L*4)),P=u.getLocal(\"pC1\"),k=u.getLocal(\"pR\"),Q=u.i32_add(u.getLocal(\"pR\"),u.i32_const(L*2)),Y=u.i32_add(u.getLocal(\"pR\"),u.i32_const(L*4)),H=u.i32_const(t.alloc(L*2)),tt=u.i32_const(t.alloc(L*2));D.addCode(u.call(O+\"_add\",b,B,H),u.call(O+\"_add\",B,p,tt),u.call(O+\"_mul\",B,P,Y),u.call(O+\"_mul\",tt,P,k),u.call(O+\"_sub\",k,Y,k),u.call(O+\"_mulNR\",k,k),u.call(O+\"_mul\",H,P,Q),u.call(O+\"_sub\",Q,Y,Q))}kt();function Bt(){let D=t.addFunction(ot+\"_mul01\");D.addParam(\"pA\",\"i32\"),D.addParam(\"pC0\",\"i32\"),D.addParam(\"pC1\",\"i32\"),D.addParam(\"pR\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"pA\"),B=u.i32_add(u.getLocal(\"pA\"),u.i32_const(L*2)),p=u.i32_add(u.getLocal(\"pA\"),u.i32_const(L*4)),P=u.getLocal(\"pC0\"),k=u.getLocal(\"pC1\"),Q=u.getLocal(\"pR\"),Y=u.i32_add(u.getLocal(\"pR\"),u.i32_const(L*2)),H=u.i32_add(u.getLocal(\"pR\"),u.i32_const(L*4)),tt=u.i32_const(t.alloc(L*2)),X=u.i32_const(t.alloc(L*2)),lt=u.i32_const(t.alloc(L*2)),ht=u.i32_const(t.alloc(L*2));D.addCode(u.call(O+\"_mul\",b,P,tt),u.call(O+\"_mul\",B,k,X),u.call(O+\"_add\",b,B,lt),u.call(O+\"_add\",b,p,ht),u.call(O+\"_add\",B,p,Q),u.call(O+\"_mul\",Q,k,Q),u.call(O+\"_sub\",Q,X,Q),u.call(O+\"_mulNR\",Q,Q),u.call(O+\"_add\",Q,tt,Q),u.call(O+\"_add\",P,k,Y),u.call(O+\"_mul\",Y,lt,Y),u.call(O+\"_sub\",Y,tt,Y),u.call(O+\"_sub\",Y,X,Y),u.call(O+\"_mul\",ht,P,H),u.call(O+\"_sub\",H,tt,H),u.call(O+\"_add\",H,X,H))}Bt();function Tt(){let D=t.addFunction(pt+\"_mul014\");D.addParam(\"pA\",\"i32\"),D.addParam(\"pC0\",\"i32\"),D.addParam(\"pC1\",\"i32\"),D.addParam(\"pC4\",\"i32\"),D.addParam(\"pR\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"pA\"),B=u.i32_add(u.getLocal(\"pA\"),u.i32_const(L*6)),p=u.getLocal(\"pC0\"),P=u.getLocal(\"pC1\"),k=u.getLocal(\"pC4\"),Q=u.i32_const(t.alloc(L*6)),Y=u.i32_const(t.alloc(L*6)),H=u.i32_const(t.alloc(L*2)),tt=u.getLocal(\"pR\"),X=u.i32_add(u.getLocal(\"pR\"),u.i32_const(L*6));D.addCode(u.call(ot+\"_mul01\",b,p,P,Q),u.call(ot+\"_mul1\",B,k,Y),u.call(O+\"_add\",P,k,H),u.call(ot+\"_add\",B,b,X),u.call(ot+\"_mul01\",X,p,H,X),u.call(ot+\"_sub\",X,Q,X),u.call(ot+\"_sub\",X,Y,X),u.call(ot+\"_copy\",Y,tt),u.call(ot+\"_mulNR\",tt,tt),u.call(ot+\"_add\",tt,Q,tt))}Tt();function wt(){let D=t.addFunction(n+\"_ell\");D.addParam(\"pP\",\"i32\"),D.addParam(\"pCoefs\",\"i32\"),D.addParam(\"pF\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"pP\"),B=u.i32_add(u.getLocal(\"pP\"),u.i32_const(f)),p=u.getLocal(\"pF\"),P=u.getLocal(\"pCoefs\"),k=u.i32_add(u.getLocal(\"pCoefs\"),u.i32_const(L)),Q=u.i32_add(u.getLocal(\"pCoefs\"),u.i32_const(L*2)),Y=u.i32_add(u.getLocal(\"pCoefs\"),u.i32_const(L*3)),H=u.i32_add(u.getLocal(\"pCoefs\"),u.i32_const(L*4)),tt=t.alloc(L*2),X=u.i32_const(tt),lt=u.i32_const(tt),ht=u.i32_const(tt+L),yt=t.alloc(L*2),At=u.i32_const(yt),Ft=u.i32_const(yt),Mt=u.i32_const(yt+L);D.addCode(u.call(it+\"_mul\",P,B,lt),u.call(it+\"_mul\",k,B,ht),u.call(it+\"_mul\",Q,b,Ft),u.call(it+\"_mul\",Y,b,Mt),u.call(pt+\"_mul014\",p,H,At,X,p))}wt();function Rt(){let D=t.addFunction(n+\"_millerLoop\");D.addParam(\"ppreP\",\"i32\"),D.addParam(\"ppreQ\",\"i32\"),D.addParam(\"r\",\"i32\"),D.addLocal(\"pCoef\",\"i32\"),D.addLocal(\"i\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"ppreP\"),B=u.getLocal(\"pCoef\"),p=u.getLocal(\"r\");D.addCode(u.call(pt+\"_one\",p),u.if(u.call(S+\"_isZero\",b),u.ret([])),u.if(u.call(S+\"_isZero\",u.getLocal(\"ppreQ\")),u.ret([])),u.setLocal(\"pCoef\",u.i32_add(u.getLocal(\"ppreQ\"),u.i32_const(l*3))),u.setLocal(\"i\",u.i32_const(vt.length-2)),u.block(u.loop(u.call(n+\"_ell\",b,B,p),u.setLocal(\"pCoef\",u.i32_add(u.getLocal(\"pCoef\"),u.i32_const(m))),u.if(u.i32_load8_s(u.getLocal(\"i\"),Pt),[...u.call(n+\"_ell\",b,B,p),...u.setLocal(\"pCoef\",u.i32_add(u.getLocal(\"pCoef\"),u.i32_const(m)))]),u.call(pt+\"_square\",p,p),u.br_if(1,u.i32_eq(u.getLocal(\"i\"),u.i32_const(1))),u.setLocal(\"i\",u.i32_sub(u.getLocal(\"i\"),u.i32_const(1))),u.br(0))),u.call(n+\"_ell\",b,B,p)),Ht&&D.addCode(u.call(pt+\"_conjugate\",p,p))}function I(D){let u=[[[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]]],b=[[[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]]],B=t.addFunction(pt+\"_frobeniusMap\"+D);B.addParam(\"x\",\"i32\"),B.addParam(\"r\",\"i32\");let p=B.getCodeBuilder();for(let k=0;k<6;k++){let Q=k==0?p.getLocal(\"x\"):p.i32_add(p.getLocal(\"x\"),p.i32_const(k*l)),Y=Q,H=p.i32_add(p.getLocal(\"x\"),p.i32_const(k*l+L)),tt=k==0?p.getLocal(\"r\"):p.i32_add(p.getLocal(\"r\"),p.i32_const(k*l)),X=tt,lt=p.i32_add(p.getLocal(\"r\"),p.i32_const(k*l+L)),ht=P(u[Math.floor(k/3)][D%12],b[k%3][D%6]),yt=t.alloc([...ae.bigInt2BytesLE(E(ht[0]),f),...ae.bigInt2BytesLE(E(ht[1]),f)]);D%2==1?B.addCode(p.call(it+\"_copy\",Y,X),p.call(it+\"_neg\",H,lt),p.call(O+\"_mul\",tt,p.i32_const(yt),tt)):B.addCode(p.call(O+\"_mul\",Q,p.i32_const(yt),tt))}function P(k,Q){let Y=k[0],H=k[1],tt=Q[0],X=Q[1],lt=[(Y*tt-H*X)%o,(Y*X+H*tt)%o];return mh(lt[0])&&(lt[0]=lt[0]+o),lt}}function z(){let D=t.addFunction(n+\"__cyclotomicSquare\");D.addParam(\"x\",\"i32\"),D.addParam(\"r\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"x\"),B=u.i32_add(u.getLocal(\"x\"),u.i32_const(l)),p=u.i32_add(u.getLocal(\"x\"),u.i32_const(2*l)),P=u.i32_add(u.getLocal(\"x\"),u.i32_const(3*l)),k=u.i32_add(u.getLocal(\"x\"),u.i32_const(4*l)),Q=u.i32_add(u.getLocal(\"x\"),u.i32_const(5*l)),Y=u.getLocal(\"r\"),H=u.i32_add(u.getLocal(\"r\"),u.i32_const(l)),tt=u.i32_add(u.getLocal(\"r\"),u.i32_const(2*l)),X=u.i32_add(u.getLocal(\"r\"),u.i32_const(3*l)),lt=u.i32_add(u.getLocal(\"r\"),u.i32_const(4*l)),ht=u.i32_add(u.getLocal(\"r\"),u.i32_const(5*l)),yt=u.i32_const(t.alloc(l)),At=u.i32_const(t.alloc(l)),Ft=u.i32_const(t.alloc(l)),Mt=u.i32_const(t.alloc(l)),Qt=u.i32_const(t.alloc(l)),$t=u.i32_const(t.alloc(l)),Nt=u.i32_const(t.alloc(l)),Ot=u.i32_const(t.alloc(l));D.addCode(u.call(O+\"_mul\",b,k,Nt),u.call(O+\"_mulNR\",k,yt),u.call(O+\"_add\",b,yt,yt),u.call(O+\"_add\",b,k,Ot),u.call(O+\"_mul\",Ot,yt,yt),u.call(O+\"_mulNR\",Nt,Ot),u.call(O+\"_add\",Nt,Ot,Ot),u.call(O+\"_sub\",yt,Ot,yt),u.call(O+\"_add\",Nt,Nt,At),u.call(O+\"_mul\",P,p,Nt),u.call(O+\"_mulNR\",p,Ft),u.call(O+\"_add\",P,Ft,Ft),u.call(O+\"_add\",P,p,Ot),u.call(O+\"_mul\",Ot,Ft,Ft),u.call(O+\"_mulNR\",Nt,Ot),u.call(O+\"_add\",Nt,Ot,Ot),u.call(O+\"_sub\",Ft,Ot,Ft),u.call(O+\"_add\",Nt,Nt,Mt),u.call(O+\"_mul\",B,Q,Nt),u.call(O+\"_mulNR\",Q,Qt),u.call(O+\"_add\",B,Qt,Qt),u.call(O+\"_add\",B,Q,Ot),u.call(O+\"_mul\",Ot,Qt,Qt),u.call(O+\"_mulNR\",Nt,Ot),u.call(O+\"_add\",Nt,Ot,Ot),u.call(O+\"_sub\",Qt,Ot,Qt),u.call(O+\"_add\",Nt,Nt,$t),u.call(O+\"_sub\",yt,b,Y),u.call(O+\"_add\",Y,Y,Y),u.call(O+\"_add\",yt,Y,Y),u.call(O+\"_add\",At,k,lt),u.call(O+\"_add\",lt,lt,lt),u.call(O+\"_add\",At,lt,lt),u.call(O+\"_mul\",$t,u.i32_const(rt),Ot),u.call(O+\"_add\",Ot,P,X),u.call(O+\"_add\",X,X,X),u.call(O+\"_add\",Ot,X,X),u.call(O+\"_sub\",Qt,p,tt),u.call(O+\"_add\",tt,tt,tt),u.call(O+\"_add\",Qt,tt,tt),u.call(O+\"_sub\",Ft,B,H),u.call(O+\"_add\",H,H,H),u.call(O+\"_add\",Ft,H,H),u.call(O+\"_add\",Mt,Q,ht),u.call(O+\"_add\",ht,ht,ht),u.call(O+\"_add\",Mt,ht,ht))}function J(D,u,b){let B=A(D).map(tt=>tt==-1?255:tt),p=t.alloc(B),P=t.addFunction(n+\"__cyclotomicExp_\"+b);P.addParam(\"x\",\"i32\"),P.addParam(\"r\",\"i32\"),P.addLocal(\"bit\",\"i32\"),P.addLocal(\"i\",\"i32\");let k=P.getCodeBuilder(),Q=k.getLocal(\"x\"),Y=k.getLocal(\"r\"),H=k.i32_const(t.alloc(s));P.addCode(k.call(pt+\"_conjugate\",Q,H),k.call(pt+\"_one\",Y),k.if(k.teeLocal(\"bit\",k.i32_load8_s(k.i32_const(B.length-1),p)),k.if(k.i32_eq(k.getLocal(\"bit\"),k.i32_const(1)),k.call(pt+\"_mul\",Y,Q,Y),k.call(pt+\"_mul\",Y,H,Y))),k.setLocal(\"i\",k.i32_const(B.length-2)),k.block(k.loop(k.call(n+\"__cyclotomicSquare\",Y,Y),k.if(k.teeLocal(\"bit\",k.i32_load8_s(k.getLocal(\"i\"),p)),k.if(k.i32_eq(k.getLocal(\"bit\"),k.i32_const(1)),k.call(pt+\"_mul\",Y,Q,Y),k.call(pt+\"_mul\",Y,H,Y))),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)))),u&&P.addCode(k.call(pt+\"_conjugate\",Y,Y))}function st(){z(),J(U,F,\"w0\");let D=t.addFunction(n+\"_finalExponentiation\");D.addParam(\"x\",\"i32\"),D.addParam(\"r\",\"i32\");let u=D.getCodeBuilder(),b=u.getLocal(\"x\"),B=u.getLocal(\"r\"),p=u.i32_const(t.alloc(s)),P=u.i32_const(t.alloc(s)),k=u.i32_const(t.alloc(s)),Q=u.i32_const(t.alloc(s)),Y=u.i32_const(t.alloc(s)),H=u.i32_const(t.alloc(s)),tt=u.i32_const(t.alloc(s));D.addCode(u.call(pt+\"_frobeniusMap6\",b,p),u.call(pt+\"_inverse\",b,P),u.call(pt+\"_mul\",p,P,k),u.call(pt+\"_copy\",k,P),u.call(pt+\"_frobeniusMap2\",k,k),u.call(pt+\"_mul\",k,P,k),u.call(n+\"__cyclotomicSquare\",k,P),u.call(pt+\"_conjugate\",P,P),u.call(n+\"__cyclotomicExp_w0\",k,Q),u.call(n+\"__cyclotomicSquare\",Q,Y),u.call(pt+\"_mul\",P,Q,H),u.call(n+\"__cyclotomicExp_w0\",H,P),u.call(n+\"__cyclotomicExp_w0\",P,p),u.call(n+\"__cyclotomicExp_w0\",p,tt),u.call(pt+\"_mul\",tt,Y,tt),u.call(n+\"__cyclotomicExp_w0\",tt,Y),u.call(pt+\"_conjugate\",H,H),u.call(pt+\"_mul\",Y,H,Y),u.call(pt+\"_mul\",Y,k,Y),u.call(pt+\"_conjugate\",k,H),u.call(pt+\"_mul\",P,k,P),u.call(pt+\"_frobeniusMap3\",P,P),u.call(pt+\"_mul\",tt,H,tt),u.call(pt+\"_frobeniusMap1\",tt,tt),u.call(pt+\"_mul\",Q,p,Q),u.call(pt+\"_frobeniusMap2\",Q,Q),u.call(pt+\"_mul\",Q,P,Q),u.call(pt+\"_mul\",Q,tt,Q),u.call(pt+\"_mul\",Q,Y,B))}function mt(){let D=t.addFunction(n+\"_finalExponentiationOld\");D.addParam(\"x\",\"i32\"),D.addParam(\"r\",\"i32\");let b=t.alloc(ae.bigInt2BytesLE(322277361516934140462891564586510139908379969514828494218366688025288661041104682794998680497580008899973249814104447692778988208376779573819485263026159588510513834876303014016798809919343532899164848730280942609956670917565618115867287399623286813270357901731510188149934363360381614501334086825442271920079363289954510565375378443704372994881406797882676971082200626541916413184642520269678897559532260949334760604962086348898118982248842634379637598665468817769075878555493752214492790122785850202957575200176084204422751485957336465472324810982833638490904279282696134323072515220044451592646885410572234451732790590013479358343841220074174848221722017083597872017638514103174122784843925578370430843522959600095676285723737049438346544753168912974976791528535276317256904336520179281145394686565050419250614107803233314658825463117900250701199181529205942363159325765991819433914303908860460720581408201373164047773794825411011922305820065611121544561808414055302212057471395719432072209245600258134364584636810093520285711072578721435517884103526483832733289802426157301542744476740008494780363354305116978805620671467071400711358839553375340724899735460480144599782014906586543813292157922220645089192130209334926661588737007768565838519456601560804957985667880395221049249803753582637708560n,544)),B=D.getCodeBuilder();D.addCode(B.call(pt+\"_exp\",B.getLocal(\"x\"),B.i32_const(b),B.i32_const(544),B.getLocal(\"r\")))}let _t=t.alloc(G),It=t.alloc(R);function Et(D){let u=t.addFunction(n+\"_pairingEq\"+D);for(let P=0;P<D;P++)u.addParam(\"p_\"+P,\"i32\"),u.addParam(\"q_\"+P,\"i32\");u.addParam(\"c\",\"i32\"),u.setReturnType(\"i32\");let b=u.getCodeBuilder(),B=b.i32_const(t.alloc(s)),p=b.i32_const(t.alloc(s));u.addCode(b.call(pt+\"_one\",B));for(let P=0;P<D;P++)u.addCode(b.call(n+\"_prepareG1\",b.getLocal(\"p_\"+P),b.i32_const(_t))),u.addCode(b.call(n+\"_prepareG2\",b.getLocal(\"q_\"+P),b.i32_const(It))),u.addCode(b.if(b.i32_eqz(b.call(S+\"_inGroupAffine\",b.i32_const(_t))),b.ret(b.i32_const(0))),b.if(b.i32_eqz(b.call(W+\"_inGroupAffine\",b.i32_const(It))),b.ret(b.i32_const(0)))),u.addCode(b.call(n+\"_millerLoop\",b.i32_const(_t),b.i32_const(It),p)),u.addCode(b.call(pt+\"_mul\",B,p,B));u.addCode(b.call(n+\"_finalExponentiation\",B,B)),u.addCode(b.call(pt+\"_eq\",B,b.getLocal(\"c\")))}function Ct(){let D=t.addFunction(n+\"_pairing\");D.addParam(\"p\",\"i32\"),D.addParam(\"q\",\"i32\"),D.addParam(\"r\",\"i32\");let u=D.getCodeBuilder(),b=u.i32_const(t.alloc(s));D.addCode(u.call(n+\"_prepareG1\",u.getLocal(\"p\"),u.i32_const(_t))),D.addCode(u.call(n+\"_prepareG2\",u.getLocal(\"q\"),u.i32_const(It))),D.addCode(u.call(n+\"_millerLoop\",u.i32_const(_t),u.i32_const(It),b)),D.addCode(u.call(n+\"_finalExponentiation\",b,u.getLocal(\"r\")))}function Wt(){let D=t.addFunction(W+\"_inGroupAffine\");D.addParam(\"p\",\"i32\"),D.setReturnType(\"i32\");let u=D.getCodeBuilder(),b=[2001204777610833696708894912867952078278441409969503942666029068062015825245418932221343814564507832018947136279894n,2001204777610833696708894912867952078278441409969503942666029068062015825245418932221343814564507832018947136279893n],B=4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,p=[2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n,2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n],P=u.i32_const(t.alloc([...ae.bigInt2BytesLE(E(b[0]),f),...ae.bigInt2BytesLE(E(b[1]),f)])),k=u.i32_const(t.alloc(ae.bigInt2BytesLE(E(B),f))),Q=u.i32_const(t.alloc([...ae.bigInt2BytesLE(E(p[0]),f),...ae.bigInt2BytesLE(E(p[1]),f)])),Y=u.i32_const(t.alloc(ae.bigInt2BytesLE(U,8))),H=u.getLocal(\"p\"),tt=u.i32_add(u.getLocal(\"p\"),u.i32_const(l)),X=u.i32_const(t.alloc(L)),lt=u.i32_const(t.alloc(l)),ht=u.i32_const(t.alloc(l)),yt=t.alloc(l*2),At=u.i32_const(yt),Ft=u.i32_const(yt),Mt=u.i32_const(yt),Qt=u.i32_const(yt+L),$t=u.i32_const(yt+l),Nt=u.i32_const(yt+l),Ot=u.i32_const(yt+l+L),Xt=t.alloc(l*3),ie=u.i32_const(Xt),ce=u.i32_const(Xt),Ae=u.i32_const(Xt),ze=u.i32_const(Xt+L),wn=u.i32_const(Xt+l),$e=u.i32_const(Xt+l),Ke=u.i32_const(Xt+l+L),Fn=u.i32_const(Xt+l*2);D.addCode(u.if(u.call(W+\"_isZeroAffine\",u.getLocal(\"p\")),u.ret(u.i32_const(1))),u.if(u.i32_eqz(u.call(W+\"_inCurveAffine\",u.getLocal(\"p\"))),u.ret(u.i32_const(0))),u.call(O+\"_mul\",H,P,lt),u.call(O+\"_mul\",tt,P,ht),u.call(O+\"_mul1\",lt,k,Ft),u.call(O+\"_neg\",ht,$t),u.call(O+\"_neg\",lt,ce),u.call(O+\"_mul\",ht,Q,wn),u.call(it+\"_sub\",Mt,Qt,X),u.call(it+\"_add\",Mt,Qt,Qt),u.call(it+\"_copy\",X,Mt),u.call(it+\"_sub\",Nt,Ot,X),u.call(it+\"_add\",Nt,Ot,Ot),u.call(it+\"_copy\",X,Nt),u.call(it+\"_add\",Ae,ze,X),u.call(it+\"_sub\",Ae,ze,ze),u.call(it+\"_copy\",X,Ae),u.call(it+\"_sub\",Ke,$e,X),u.call(it+\"_add\",$e,Ke,Ke),u.call(it+\"_copy\",X,$e),u.call(O+\"_one\",Fn),u.call(W+\"_timesScalar\",ie,Y,u.i32_const(8),ie),u.call(W+\"_addMixed\",ie,At,ie),u.ret(u.call(W+\"_eqMixed\",ie,u.getLocal(\"p\"))));let Te=t.addFunction(W+\"_inGroup\");Te.addParam(\"pIn\",\"i32\"),Te.setReturnType(\"i32\");let Me=Te.getCodeBuilder(),fn=Me.i32_const(t.alloc(l*2));Te.addCode(Me.call(W+\"_toAffine\",Me.getLocal(\"pIn\"),fn),Me.ret(Me.call(W+\"_inGroupAffine\",fn)))}function ne(){let D=t.addFunction(S+\"_inGroupAffine\");D.addParam(\"p\",\"i32\"),D.setReturnType(\"i32\");let u=D.getCodeBuilder(),b=4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,B=793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,p=(U*U-1n)/3n,P=u.i32_const(t.alloc(ae.bigInt2BytesLE(E(b),f))),k=u.i32_const(t.alloc(ae.bigInt2BytesLE(E(B),f))),Q=u.i32_const(t.alloc(ae.bigInt2BytesLE(p,16))),Y=u.getLocal(\"p\"),H=u.i32_add(u.getLocal(\"p\"),u.i32_const(L)),tt=t.alloc(L*3),X=u.i32_const(tt),lt=u.i32_const(tt),ht=u.i32_const(tt+L),yt=t.alloc(L*2),At=u.i32_const(yt),Ft=u.i32_const(yt),Mt=u.i32_const(yt+L);D.addCode(u.if(u.call(S+\"_isZeroAffine\",u.getLocal(\"p\")),u.ret(u.i32_const(1))),u.if(u.i32_eqz(u.call(S+\"_inCurveAffine\",u.getLocal(\"p\"))),u.ret(u.i32_const(0))),u.call(it+\"_mul\",Y,P,lt),u.call(it+\"_copy\",H,ht),u.call(it+\"_mul\",Y,k,Ft),u.call(it+\"_copy\",H,Mt),u.call(S+\"_doubleAffine\",X,X),u.call(S+\"_subMixed\",X,u.getLocal(\"p\"),X),u.call(S+\"_subMixed\",X,At,X),u.call(S+\"_timesScalar\",X,Q,u.i32_const(16),X),u.ret(u.call(S+\"_eqMixed\",X,At)));let Qt=t.addFunction(S+\"_inGroup\");Qt.addParam(\"pIn\",\"i32\"),Qt.setReturnType(\"i32\");let $t=Qt.getCodeBuilder(),Nt=$t.i32_const(t.alloc(L*2));Qt.addCode($t.call(S+\"_toAffine\",$t.getLocal(\"pIn\"),Nt),$t.ret($t.call(S+\"_inGroupAffine\",Nt)))}for(let D=0;D<10;D++)I(D),t.exportFunction(pt+\"_frobeniusMap\"+D);ne(),Wt(),qt(),St(),Lt(),Dt(),Rt(),mt(),st();for(let D=1;D<=5;D++)Et(D),t.exportFunction(n+\"_pairingEq\"+D);Ct(),t.exportFunction(n+\"_pairing\"),t.exportFunction(n+\"_prepareG1\"),t.exportFunction(n+\"_prepareG2\"),t.exportFunction(n+\"_millerLoop\"),t.exportFunction(n+\"_finalExponentiation\"),t.exportFunction(n+\"_finalExponentiationOld\"),t.exportFunction(n+\"__cyclotomicSquare\"),t.exportFunction(n+\"__cyclotomicExp_w0\"),t.exportFunction(ot+\"_mul1\"),t.exportFunction(ot+\"_mul01\"),t.exportFunction(pt+\"_mul014\"),t.exportFunction(S+\"_inGroupAffine\"),t.exportFunction(S+\"_inGroup\"),t.exportFunction(W+\"_inGroupAffine\"),t.exportFunction(W+\"_inGroup\")}});var zs=Yt((Oy,go)=>{go.exports.buildBn128=Vl();go.exports.buildBls12381=ed();go.exports.buildF1m=ra()});var Gs=Yt((Wy,ad)=>{ad.exports=Worker});var Ve=Yt((k4,mo)=>{var ve=function(i){\"use strict\";var t=1e7,e=7,n=9007199254740992,o=C(n),d=\"0123456789abcdefghijklmnopqrstuvwxyz\",h=typeof BigInt==\"function\";function f(I,z,J,st){return typeof I>\"u\"?f[0]:typeof z<\"u\"?+z==10&&!J?wt(I):Lt(I,z,J,st):wt(I)}function L(I,z){this.value=I,this.sign=z,this.isSmall=!1}L.prototype=Object.create(f.prototype);function l(I){this.value=I,this.sign=I<0,this.isSmall=!0}l.prototype=Object.create(f.prototype);function s(I){this.value=I}s.prototype=Object.create(f.prototype);function x(I){return-n<I&&I<n}function C(I){return I<1e7?[I]:I<1e14?[I%1e7,Math.floor(I/1e7)]:[I%1e7,Math.floor(I/1e7)%1e7,Math.floor(I/1e14)]}function g(I){$(I);var z=I.length;if(z<4&&ot(I,o)<0)switch(z){case 0:return 0;case 1:return I[0];case 2:return I[0]+I[1]*t;default:return I[0]+(I[1]+I[2]*t)*t}return I}function $(I){for(var z=I.length;I[--z]===0;);I.length=z+1}function it(I){for(var z=new Array(I),J=-1;++J<I;)z[J]=0;return z}function q(I){return I>0?Math.floor(I):Math.ceil(I)}function S(I,z){var J=I.length,st=z.length,mt=new Array(J),_t=0,It=t,Et,Ct;for(Ct=0;Ct<st;Ct++)Et=I[Ct]+z[Ct]+_t,_t=Et>=It?1:0,mt[Ct]=Et-_t*It;for(;Ct<J;)Et=I[Ct]+_t,_t=Et===It?1:0,mt[Ct++]=Et-_t*It;return _t>0&&mt.push(_t),mt}function O(I,z){return I.length>=z.length?S(I,z):S(z,I)}function M(I,z){var J=I.length,st=new Array(J),mt=t,_t,It;for(It=0;It<J;It++)_t=I[It]-mt+z,z=Math.floor(_t/mt),st[It]=_t-z*mt,z+=1;for(;z>0;)st[It++]=z%mt,z=Math.floor(z/mt);return st}L.prototype.add=function(I){var z=wt(I);if(this.sign!==z.sign)return this.subtract(z.negate());var J=this.value,st=z.value;return z.isSmall?new L(M(J,Math.abs(st)),this.sign):new L(O(J,st),this.sign)},L.prototype.plus=L.prototype.add,l.prototype.add=function(I){var z=wt(I),J=this.value;if(J<0!==z.sign)return this.subtract(z.negate());var st=z.value;if(z.isSmall){if(x(J+st))return new l(J+st);st=C(Math.abs(st))}return new L(M(st,Math.abs(J)),J<0)},l.prototype.plus=l.prototype.add,s.prototype.add=function(I){return new s(this.value+wt(I).value)},s.prototype.plus=s.prototype.add;function W(I,z){var J=I.length,st=z.length,mt=new Array(J),_t=0,It=t,Et,Ct;for(Et=0;Et<st;Et++)Ct=I[Et]-_t-z[Et],Ct<0?(Ct+=It,_t=1):_t=0,mt[Et]=Ct;for(Et=st;Et<J;Et++){if(Ct=I[Et]-_t,Ct<0)Ct+=It;else{mt[Et++]=Ct;break}mt[Et]=Ct}for(;Et<J;Et++)mt[Et]=I[Et];return $(mt),mt}function ct(I,z,J){var st;return ot(I,z)>=0?st=W(I,z):(st=W(z,I),J=!J),st=g(st),typeof st==\"number\"?(J&&(st=-st),new l(st)):new L(st,J)}function E(I,z,J){var st=I.length,mt=new Array(st),_t=-z,It=t,Et,Ct;for(Et=0;Et<st;Et++)Ct=I[Et]+_t,_t=Math.floor(Ct/It),Ct%=It,mt[Et]=Ct<0?Ct+It:Ct;return mt=g(mt),typeof mt==\"number\"?(J&&(mt=-mt),new l(mt)):new L(mt,J)}L.prototype.subtract=function(I){var z=wt(I);if(this.sign!==z.sign)return this.add(z.negate());var J=this.value,st=z.value;return z.isSmall?E(J,Math.abs(st),this.sign):ct(J,st,this.sign)},L.prototype.minus=L.prototype.subtract,l.prototype.subtract=function(I){var z=wt(I),J=this.value;if(J<0!==z.sign)return this.add(z.negate());var st=z.value;return z.isSmall?new l(J-st):E(st,Math.abs(J),J>=0)},l.prototype.minus=l.prototype.subtract,s.prototype.subtract=function(I){return new s(this.value-wt(I).value)},s.prototype.minus=s.prototype.subtract,L.prototype.negate=function(){return new L(this.value,!this.sign)},l.prototype.negate=function(){var I=this.sign,z=new l(-this.value);return z.sign=!I,z},s.prototype.negate=function(){return new s(-this.value)},L.prototype.abs=function(){return new L(this.value,!1)},l.prototype.abs=function(){return new l(Math.abs(this.value))},s.prototype.abs=function(){return new s(this.value>=0?this.value:-this.value)};function _(I,z){var J=I.length,st=z.length,mt=J+st,_t=it(mt),It=t,Et,Ct,Wt,ne,D;for(Wt=0;Wt<J;++Wt){ne=I[Wt];for(var u=0;u<st;++u)D=z[u],Et=ne*D+_t[Wt+u],Ct=Math.floor(Et/It),_t[Wt+u]=Et-Ct*It,_t[Wt+u+1]+=Ct}return $(_t),_t}function r(I,z){var J=I.length,st=new Array(J),mt=t,_t=0,It,Et;for(Et=0;Et<J;Et++)It=I[Et]*z+_t,_t=Math.floor(It/mt),st[Et]=It-_t*mt;for(;_t>0;)st[Et++]=_t%mt,_t=Math.floor(_t/mt);return st}function Z(I,z){for(var J=[];z-- >0;)J.push(0);return J.concat(I)}function j(I,z){var J=Math.max(I.length,z.length);if(J<=30)return _(I,z);J=Math.ceil(J/2);var st=I.slice(J),mt=I.slice(0,J),_t=z.slice(J),It=z.slice(0,J),Et=j(mt,It),Ct=j(st,_t),Wt=j(O(mt,st),O(It,_t)),ne=O(O(Et,Z(W(W(Wt,Et),Ct),J)),Z(Ct,2*J));return $(ne),ne}function nt(I,z){return-.012*I-.012*z+15e-6*I*z>0}L.prototype.multiply=function(I){var z=wt(I),J=this.value,st=z.value,mt=this.sign!==z.sign,_t;if(z.isSmall){if(st===0)return f[0];if(st===1)return this;if(st===-1)return this.negate();if(_t=Math.abs(st),_t<t)return new L(r(J,_t),mt);st=C(_t)}return nt(J.length,st.length)?new L(j(J,st),mt):new L(_(J,st),mt)},L.prototype.times=L.prototype.multiply;function v(I,z,J){return I<t?new L(r(z,I),J):new L(_(z,C(I)),J)}l.prototype._multiplyBySmall=function(I){return x(I.value*this.value)?new l(I.value*this.value):v(Math.abs(I.value),C(Math.abs(this.value)),this.sign!==I.sign)},L.prototype._multiplyBySmall=function(I){return I.value===0?f[0]:I.value===1?this:I.value===-1?this.negate():v(Math.abs(I.value),this.value,this.sign!==I.sign)},l.prototype.multiply=function(I){return wt(I)._multiplyBySmall(this)},l.prototype.times=l.prototype.multiply,s.prototype.multiply=function(I){return new s(this.value*wt(I).value)},s.prototype.times=s.prototype.multiply;function y(I){var z=I.length,J=it(z+z),st=t,mt,_t,It,Et,Ct;for(It=0;It<z;It++){Et=I[It],_t=0-Et*Et;for(var Wt=It;Wt<z;Wt++)Ct=I[Wt],mt=2*(Et*Ct)+J[It+Wt]+_t,_t=Math.floor(mt/st),J[It+Wt]=mt-_t*st;J[It+z]=_t}return $(J),J}L.prototype.square=function(){return new L(y(this.value),!1)},l.prototype.square=function(){var I=this.value*this.value;return x(I)?new l(I):new L(y(C(Math.abs(this.value))),!1)},s.prototype.square=function(I){return new s(this.value*this.value)};function T(I,z){var J=I.length,st=z.length,mt=t,_t=it(z.length),It=z[st-1],Et=Math.ceil(mt/(2*It)),Ct=r(I,Et),Wt=r(z,Et),ne,D,u,b,B,p,P;for(Ct.length<=J&&Ct.push(0),Wt.push(0),It=Wt[st-1],D=J-st;D>=0;D--){for(ne=mt-1,Ct[D+st]!==It&&(ne=Math.floor((Ct[D+st]*mt+Ct[D+st-1])/It)),u=0,b=0,p=Wt.length,B=0;B<p;B++)u+=ne*Wt[B],P=Math.floor(u/mt),b+=Ct[D+B]-(u-P*mt),u=P,b<0?(Ct[D+B]=b+mt,b=-1):(Ct[D+B]=b,b=0);for(;b!==0;){for(ne-=1,u=0,B=0;B<p;B++)u+=Ct[D+B]-mt+Wt[B],u<0?(Ct[D+B]=u+mt,u=0):(Ct[D+B]=u,u=1);b+=u}_t[D]=ne}return Ct=rt(Ct,Et)[0],[g(_t),g(Ct)]}function V(I,z){for(var J=I.length,st=z.length,mt=[],_t=[],It=t,Et,Ct,Wt,ne,D;J;){if(_t.unshift(I[--J]),$(_t),ot(_t,z)<0){mt.push(0);continue}Ct=_t.length,Wt=_t[Ct-1]*It+_t[Ct-2],ne=z[st-1]*It+z[st-2],Ct>st&&(Wt=(Wt+1)*It),Et=Math.ceil(Wt/ne);do{if(D=r(z,Et),ot(D,_t)<=0)break;Et--}while(Et);mt.push(Et),_t=W(_t,D)}return mt.reverse(),[g(mt),g(_t)]}function rt(I,z){var J=I.length,st=it(J),mt=t,_t,It,Et,Ct;for(Et=0,_t=J-1;_t>=0;--_t)Ct=Et*mt+I[_t],It=q(Ct/z),Et=Ct-It*z,st[_t]=It|0;return[st,Et|0]}function dt(I,z){var J,st=wt(z);if(h)return[new s(I.value/st.value),new s(I.value%st.value)];var mt=I.value,_t=st.value,It;if(_t===0)throw new Error(\"Cannot divide by zero\");if(I.isSmall)return st.isSmall?[new l(q(mt/_t)),new l(mt%_t)]:[f[0],I];if(st.isSmall){if(_t===1)return[I,f[0]];if(_t==-1)return[I.negate(),f[0]];var Et=Math.abs(_t);if(Et<t){J=rt(mt,Et),It=g(J[0]);var Ct=J[1];return I.sign&&(Ct=-Ct),typeof It==\"number\"?(I.sign!==st.sign&&(It=-It),[new l(It),new l(Ct)]):[new L(It,I.sign!==st.sign),new l(Ct)]}_t=C(Et)}var Wt=ot(mt,_t);if(Wt===-1)return[f[0],I];if(Wt===0)return[f[I.sign===st.sign?1:-1],f[0]];mt.length+_t.length<=200?J=T(mt,_t):J=V(mt,_t),It=J[0];var ne=I.sign!==st.sign,D=J[1],u=I.sign;return typeof It==\"number\"?(ne&&(It=-It),It=new l(It)):It=new L(It,ne),typeof D==\"number\"?(u&&(D=-D),D=new l(D)):D=new L(D,u),[It,D]}L.prototype.divmod=function(I){var z=dt(this,I);return{quotient:z[0],remainder:z[1]}},s.prototype.divmod=l.prototype.divmod=L.prototype.divmod,L.prototype.divide=function(I){return dt(this,I)[0]},s.prototype.over=s.prototype.divide=function(I){return new s(this.value/wt(I).value)},l.prototype.over=l.prototype.divide=L.prototype.over=L.prototype.divide,L.prototype.mod=function(I){return dt(this,I)[1]},s.prototype.mod=s.prototype.remainder=function(I){return new s(this.value%wt(I).value)},l.prototype.remainder=l.prototype.mod=L.prototype.remainder=L.prototype.mod,L.prototype.pow=function(I){var z=wt(I),J=this.value,st=z.value,mt,_t,It;if(st===0)return f[1];if(J===0)return f[0];if(J===1)return f[1];if(J===-1)return z.isEven()?f[1]:f[-1];if(z.sign)return f[0];if(!z.isSmall)throw new Error(\"The exponent \"+z.toString()+\" is too large.\");if(this.isSmall&&x(mt=Math.pow(J,st)))return new l(q(mt));for(_t=this,It=f[1];st&!0&&(It=It.times(_t),--st),st!==0;)st/=2,_t=_t.square();return It},l.prototype.pow=L.prototype.pow,s.prototype.pow=function(I){var z=wt(I),J=this.value,st=z.value,mt=BigInt(0),_t=BigInt(1),It=BigInt(2);if(st===mt)return f[1];if(J===mt)return f[0];if(J===_t)return f[1];if(J===BigInt(-1))return z.isEven()?f[1]:f[-1];if(z.isNegative())return new s(mt);for(var Et=this,Ct=f[1];(st&_t)===_t&&(Ct=Ct.times(Et),--st),st!==mt;)st/=It,Et=Et.square();return Ct},L.prototype.modPow=function(I,z){if(I=wt(I),z=wt(z),z.isZero())throw new Error(\"Cannot take modPow with modulus 0\");var J=f[1],st=this.mod(z);for(I.isNegative()&&(I=I.multiply(f[-1]),st=st.modInv(z));I.isPositive();){if(st.isZero())return f[0];I.isOdd()&&(J=J.multiply(st).mod(z)),I=I.divide(2),st=st.square().mod(z)}return J},s.prototype.modPow=l.prototype.modPow=L.prototype.modPow;function ot(I,z){if(I.length!==z.length)return I.length>z.length?1:-1;for(var J=I.length-1;J>=0;J--)if(I[J]!==z[J])return I[J]>z[J]?1:-1;return 0}L.prototype.compareAbs=function(I){var z=wt(I),J=this.value,st=z.value;return z.isSmall?1:ot(J,st)},l.prototype.compareAbs=function(I){var z=wt(I),J=Math.abs(this.value),st=z.value;return z.isSmall?(st=Math.abs(st),J===st?0:J>st?1:-1):-1},s.prototype.compareAbs=function(I){var z=this.value,J=wt(I).value;return z=z>=0?z:-z,J=J>=0?J:-J,z===J?0:z>J?1:-1},L.prototype.compare=function(I){if(I===1/0)return-1;if(I===-1/0)return 1;var z=wt(I),J=this.value,st=z.value;return this.sign!==z.sign?z.sign?1:-1:z.isSmall?this.sign?-1:1:ot(J,st)*(this.sign?-1:1)},L.prototype.compareTo=L.prototype.compare,l.prototype.compare=function(I){if(I===1/0)return-1;if(I===-1/0)return 1;var z=wt(I),J=this.value,st=z.value;return z.isSmall?J==st?0:J>st?1:-1:J<0!==z.sign?J<0?-1:1:J<0?1:-1},l.prototype.compareTo=l.prototype.compare,s.prototype.compare=function(I){if(I===1/0)return-1;if(I===-1/0)return 1;var z=this.value,J=wt(I).value;return z===J?0:z>J?1:-1},s.prototype.compareTo=s.prototype.compare,L.prototype.equals=function(I){return this.compare(I)===0},s.prototype.eq=s.prototype.equals=l.prototype.eq=l.prototype.equals=L.prototype.eq=L.prototype.equals,L.prototype.notEquals=function(I){return this.compare(I)!==0},s.prototype.neq=s.prototype.notEquals=l.prototype.neq=l.prototype.notEquals=L.prototype.neq=L.prototype.notEquals,L.prototype.greater=function(I){return this.compare(I)>0},s.prototype.gt=s.prototype.greater=l.prototype.gt=l.prototype.greater=L.prototype.gt=L.prototype.greater,L.prototype.lesser=function(I){return this.compare(I)<0},s.prototype.lt=s.prototype.lesser=l.prototype.lt=l.prototype.lesser=L.prototype.lt=L.prototype.lesser,L.prototype.greaterOrEquals=function(I){return this.compare(I)>=0},s.prototype.geq=s.prototype.greaterOrEquals=l.prototype.geq=l.prototype.greaterOrEquals=L.prototype.geq=L.prototype.greaterOrEquals,L.prototype.lesserOrEquals=function(I){return this.compare(I)<=0},s.prototype.leq=s.prototype.lesserOrEquals=l.prototype.leq=l.prototype.lesserOrEquals=L.prototype.leq=L.prototype.lesserOrEquals,L.prototype.isEven=function(){return(this.value[0]&1)===0},l.prototype.isEven=function(){return(this.value&1)===0},s.prototype.isEven=function(){return(this.value&BigInt(1))===BigInt(0)},L.prototype.isOdd=function(){return(this.value[0]&1)===1},l.prototype.isOdd=function(){return(this.value&1)===1},s.prototype.isOdd=function(){return(this.value&BigInt(1))===BigInt(1)},L.prototype.isPositive=function(){return!this.sign},l.prototype.isPositive=function(){return this.value>0},s.prototype.isPositive=l.prototype.isPositive,L.prototype.isNegative=function(){return this.sign},l.prototype.isNegative=function(){return this.value<0},s.prototype.isNegative=l.prototype.isNegative,L.prototype.isUnit=function(){return!1},l.prototype.isUnit=function(){return Math.abs(this.value)===1},s.prototype.isUnit=function(){return this.abs().value===BigInt(1)},L.prototype.isZero=function(){return!1},l.prototype.isZero=function(){return this.value===0},s.prototype.isZero=function(){return this.value===BigInt(0)},L.prototype.isDivisibleBy=function(I){var z=wt(I);return z.isZero()?!1:z.isUnit()?!0:z.compareAbs(2)===0?this.isEven():this.mod(z).isZero()},s.prototype.isDivisibleBy=l.prototype.isDivisibleBy=L.prototype.isDivisibleBy;function xt(I){var z=I.abs();if(z.isUnit())return!1;if(z.equals(2)||z.equals(3)||z.equals(5))return!0;if(z.isEven()||z.isDivisibleBy(3)||z.isDivisibleBy(5))return!1;if(z.lesser(49))return!0}function pt(I,z){for(var J=I.prev(),st=J,mt=0,_t,It,Et,Ct;st.isEven();)st=st.divide(2),mt++;t:for(Et=0;Et<z.length;Et++)if(!I.lesser(z[Et])&&(Ct=ve(z[Et]).modPow(st,I),!(Ct.isUnit()||Ct.equals(J)))){for(_t=mt-1;_t!=0;_t--){if(Ct=Ct.square().mod(I),Ct.isUnit())return!1;if(Ct.equals(J))continue t}return!1}return!0}L.prototype.isPrime=function(I){var z=xt(this);if(z!==i)return z;var J=this.abs(),st=J.bitLength();if(st<=64)return pt(J,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var mt=Math.log(2)*st.toJSNumber(),_t=Math.ceil(I===!0?2*Math.pow(mt,2):mt),It=[],Et=0;Et<_t;Et++)It.push(ve(Et+2));return pt(J,It)},s.prototype.isPrime=l.prototype.isPrime=L.prototype.isPrime,L.prototype.isProbablePrime=function(I,z){var J=xt(this);if(J!==i)return J;for(var st=this.abs(),mt=I===i?5:I,_t=[],It=0;It<mt;It++)_t.push(ve.randBetween(2,st.minus(2),z));return pt(st,_t)},s.prototype.isProbablePrime=l.prototype.isProbablePrime=L.prototype.isProbablePrime,L.prototype.modInv=function(I){for(var z=ve.zero,J=ve.one,st=wt(I),mt=this.abs(),_t,It,Et;!mt.isZero();)_t=st.divide(mt),It=z,Et=st,z=J,st=mt,J=It.subtract(_t.multiply(J)),mt=Et.subtract(_t.multiply(mt));if(!st.isUnit())throw new Error(this.toString()+\" and \"+I.toString()+\" are not co-prime\");return z.compare(0)===-1&&(z=z.add(I)),this.isNegative()?z.negate():z},s.prototype.modInv=l.prototype.modInv=L.prototype.modInv,L.prototype.next=function(){var I=this.value;return this.sign?E(I,1,this.sign):new L(M(I,1),this.sign)},l.prototype.next=function(){var I=this.value;return I+1<n?new l(I+1):new L(o,!1)},s.prototype.next=function(){return new s(this.value+BigInt(1))},L.prototype.prev=function(){var I=this.value;return this.sign?new L(M(I,1),!0):E(I,1,this.sign)},l.prototype.prev=function(){var I=this.value;return I-1>-n?new l(I-1):new L(o,!0)},s.prototype.prev=function(){return new s(this.value-BigInt(1))};for(var bt=[1];2*bt[bt.length-1]<=t;)bt.push(2*bt[bt.length-1]);var vt=bt.length,Pt=bt[vt-1];function Ht(I){return Math.abs(I)<=t}L.prototype.shiftLeft=function(I){var z=wt(I).toJSNumber();if(!Ht(z))throw new Error(String(z)+\" is too large for shifting.\");if(z<0)return this.shiftRight(-z);var J=this;if(J.isZero())return J;for(;z>=vt;)J=J.multiply(Pt),z-=vt-1;return J.multiply(bt[z])},s.prototype.shiftLeft=l.prototype.shiftLeft=L.prototype.shiftLeft,L.prototype.shiftRight=function(I){var z,J=wt(I).toJSNumber();if(!Ht(J))throw new Error(String(J)+\" is too large for shifting.\");if(J<0)return this.shiftLeft(-J);for(var st=this;J>=vt;){if(st.isZero()||st.isNegative()&&st.isUnit())return st;z=dt(st,Pt),st=z[1].isNegative()?z[0].prev():z[0],J-=vt-1}return z=dt(st,bt[J]),z[1].isNegative()?z[0].prev():z[0]},s.prototype.shiftRight=l.prototype.shiftRight=L.prototype.shiftRight;function m(I,z,J){z=wt(z);for(var st=I.isNegative(),mt=z.isNegative(),_t=st?I.not():I,It=mt?z.not():z,Et=0,Ct=0,Wt=null,ne=null,D=[];!_t.isZero()||!It.isZero();)Wt=dt(_t,Pt),Et=Wt[1].toJSNumber(),st&&(Et=Pt-1-Et),ne=dt(It,Pt),Ct=ne[1].toJSNumber(),mt&&(Ct=Pt-1-Ct),_t=Wt[0],It=ne[0],D.push(J(Et,Ct));for(var u=J(st?1:0,mt?1:0)!==0?ve(-1):ve(0),b=D.length-1;b>=0;b-=1)u=u.multiply(Pt).add(ve(D[b]));return u}L.prototype.not=function(){return this.negate().prev()},s.prototype.not=l.prototype.not=L.prototype.not,L.prototype.and=function(I){return m(this,I,function(z,J){return z&J})},s.prototype.and=l.prototype.and=L.prototype.and,L.prototype.or=function(I){return m(this,I,function(z,J){return z|J})},s.prototype.or=l.prototype.or=L.prototype.or,L.prototype.xor=function(I){return m(this,I,function(z,J){return z^J})},s.prototype.xor=l.prototype.xor=L.prototype.xor;var a=1<<30,w=(t&-t)*(t&-t)|a;function c(I){var z=I.value,J=typeof z==\"number\"?z|a:typeof z==\"bigint\"?z|BigInt(a):z[0]+z[1]*t|w;return J&-J}function G(I,z){if(z.compareTo(I)<=0){var J=G(I,z.square(z)),st=J.p,mt=J.e,_t=st.multiply(z);return _t.compareTo(I)<=0?{p:_t,e:mt*2+1}:{p:st,e:mt*2}}return{p:ve(1),e:0}}L.prototype.bitLength=function(){var I=this;return I.compareTo(ve(0))<0&&(I=I.negate().subtract(ve(1))),I.compareTo(ve(0))===0?ve(0):ve(G(I,ve(2)).e).add(ve(1))},s.prototype.bitLength=l.prototype.bitLength=L.prototype.bitLength;function R(I,z){return I=wt(I),z=wt(z),I.greater(z)?I:z}function F(I,z){return I=wt(I),z=wt(z),I.lesser(z)?I:z}function U(I,z){if(I=wt(I).abs(),z=wt(z).abs(),I.equals(z))return I;if(I.isZero())return z;if(z.isZero())return I;for(var J=f[1],st,mt;I.isEven()&&z.isEven();)st=F(c(I),c(z)),I=I.divide(st),z=z.divide(st),J=J.multiply(st);for(;I.isEven();)I=I.divide(c(I));do{for(;z.isEven();)z=z.divide(c(z));I.greater(z)&&(mt=z,z=I,I=mt),z=z.subtract(I)}while(!z.isZero());return J.isUnit()?I:I.multiply(J)}function A(I,z){return I=wt(I).abs(),z=wt(z).abs(),I.divide(U(I,z)).multiply(z)}function et(I,z,J){I=wt(I),z=wt(z);var st=J||Math.random,mt=F(I,z),_t=R(I,z),It=_t.subtract(mt).add(1);if(It.isSmall)return mt.add(Math.floor(st()*It));for(var Et=Dt(It,t).value,Ct=[],Wt=!0,ne=0;ne<Et.length;ne++){var D=Wt?Et[ne]+(ne+1<Et.length?Et[ne+1]/t:0):t,u=q(st()*D);Ct.push(u),u<Et[ne]&&(Wt=!1)}return mt.add(f.fromArray(Ct,t,!1))}var Lt=function(I,z,J,st){J=J||d,I=String(I),st||(I=I.toLowerCase(),J=J.toLowerCase());var mt=I.length,_t,It=Math.abs(z),Et={};for(_t=0;_t<J.length;_t++)Et[J[_t]]=_t;for(_t=0;_t<mt;_t++){var Ct=I[_t];if(Ct!==\"-\"&&Ct in Et&&Et[Ct]>=It){if(Ct===\"1\"&&It===1)continue;throw new Error(Ct+\" is not a valid digit in base \"+z+\".\")}}z=wt(z);var Wt=[],ne=I[0]===\"-\";for(_t=ne?1:0;_t<I.length;_t++){var Ct=I[_t];if(Ct in Et)Wt.push(wt(Et[Ct]));else if(Ct===\"<\"){var D=_t;do _t++;while(I[_t]!==\">\"&&_t<I.length);Wt.push(wt(I.slice(D+1,_t)))}else throw new Error(Ct+\" is not a valid character\")}return St(Wt,z,ne)};function St(I,z,J){var st=f[0],mt=f[1],_t;for(_t=I.length-1;_t>=0;_t--)st=st.add(I[_t].times(mt)),mt=mt.times(z);return J?st.negate():st}function qt(I,z){return z=z||d,I<z.length?z[I]:\"<\"+I+\">\"}function Dt(I,z){if(z=ve(z),z.isZero()){if(I.isZero())return{value:[0],isNegative:!1};throw new Error(\"Cannot convert nonzero numbers to base 0.\")}if(z.equals(-1)){if(I.isZero())return{value:[0],isNegative:!1};if(I.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-I.toJSNumber())).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var J=Array.apply(null,Array(I.toJSNumber()-1)).map(Array.prototype.valueOf,[0,1]);return J.unshift([1]),{value:[].concat.apply([],J),isNegative:!1}}var st=!1;if(I.isNegative()&&z.isPositive()&&(st=!0,I=I.abs()),z.isUnit())return I.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(I.toJSNumber())).map(Number.prototype.valueOf,1),isNegative:st};for(var mt=[],_t=I,It;_t.isNegative()||_t.compareAbs(z)>=0;){It=_t.divmod(z),_t=It.quotient;var Et=It.remainder;Et.isNegative()&&(Et=z.minus(Et).abs(),_t=_t.next()),mt.push(Et.toJSNumber())}return mt.push(_t.toJSNumber()),{value:mt.reverse(),isNegative:st}}function kt(I,z,J){var st=Dt(I,z);return(st.isNegative?\"-\":\"\")+st.value.map(function(mt){return qt(mt,J)}).join(\"\")}L.prototype.toArray=function(I){return Dt(this,I)},l.prototype.toArray=function(I){return Dt(this,I)},s.prototype.toArray=function(I){return Dt(this,I)},L.prototype.toString=function(I,z){if(I===i&&(I=10),I!==10||z)return kt(this,I,z);for(var J=this.value,st=J.length,mt=String(J[--st]),_t=\"0000000\",It;--st>=0;)It=String(J[st]),mt+=_t.slice(It.length)+It;var Et=this.sign?\"-\":\"\";return Et+mt},l.prototype.toString=function(I,z){return I===i&&(I=10),I!=10||z?kt(this,I,z):String(this.value)},s.prototype.toString=l.prototype.toString,s.prototype.toJSON=L.prototype.toJSON=l.prototype.toJSON=function(){return this.toString()},L.prototype.valueOf=function(){return parseInt(this.toString(),10)},L.prototype.toJSNumber=L.prototype.valueOf,l.prototype.valueOf=function(){return this.value},l.prototype.toJSNumber=l.prototype.valueOf,s.prototype.valueOf=s.prototype.toJSNumber=function(){return parseInt(this.toString(),10)};function Bt(I){if(x(+I)){var z=+I;if(z===q(z))return h?new s(BigInt(z)):new l(z);throw new Error(\"Invalid integer: \"+I)}var J=I[0]===\"-\";J&&(I=I.slice(1));var st=I.split(/e/i);if(st.length>2)throw new Error(\"Invalid integer: \"+st.join(\"e\"));if(st.length===2){var mt=st[1];if(mt[0]===\"+\"&&(mt=mt.slice(1)),mt=+mt,mt!==q(mt)||!x(mt))throw new Error(\"Invalid integer: \"+mt+\" is not a valid exponent.\");var _t=st[0],It=_t.indexOf(\".\");if(It>=0&&(mt-=_t.length-It-1,_t=_t.slice(0,It)+_t.slice(It+1)),mt<0)throw new Error(\"Cannot include negative exponent part for integers\");_t+=new Array(mt+1).join(\"0\"),I=_t}var Et=/^([0-9][0-9]*)$/.test(I);if(!Et)throw new Error(\"Invalid integer: \"+I);if(h)return new s(BigInt(J?\"-\"+I:I));for(var Ct=[],Wt=I.length,ne=e,D=Wt-ne;Wt>0;)Ct.push(+I.slice(D,Wt)),D-=ne,D<0&&(D=0),Wt-=ne;return $(Ct),new L(Ct,J)}function Tt(I){if(h)return new s(BigInt(I));if(x(I)){if(I!==q(I))throw new Error(I+\" is not an integer.\");return new l(I)}return Bt(I.toString())}function wt(I){return typeof I==\"number\"?Tt(I):typeof I==\"string\"?Bt(I):typeof I==\"bigint\"?new s(I):I}for(var Rt=0;Rt<1e3;Rt++)f[Rt]=wt(Rt),Rt>0&&(f[-Rt]=wt(-Rt));return f.one=f[1],f.zero=f[0],f.minusOne=f[-1],f.max=R,f.min=F,f.gcd=U,f.lcm=A,f.isInstance=function(I){return I instanceof L||I instanceof l||I instanceof s},f.randBetween=et,f.fromArray=function(I,z,J){return St(I.map(wt),wt(z||10),J)},f}();typeof mo<\"u\"&&mo.hasOwnProperty(\"exports\")&&(mo.exports=ve);typeof define==\"function\"&&define.amd&&define(function(){return ve})});var ri=Yt(Ao=>{var Bd=Ve();Ao.bigInt2BytesLE=function(t,e){let n=Array(e),o=Bd(t);for(let d=0;d<e;d++)n[d]=o.and(255).toJSNumber(),o=o.shiftRight(8);return n};Ao.bigInt2U32LE=function(t,e){let n=Array(e),o=Bd(t);for(let d=0;d<e;d++)n[d]=o.and(4294967295).toJSNumber(),o=o.shiftRight(32);return n};Ao.isOcamNum=function(i){return!(!Array.isArray(i)||i.length!=3||typeof i[0]!=\"number\"||typeof i[1]!=\"number\"||!Array.isArray(i[2]))}});var Sd=Yt((c8,vd)=>{var v0=ri();vd.exports=function(t,e,n){let o=n||\"int\";if(t.modules[o])return o;t.modules[o]={};let d=e*2,h=e*8,f=t.alloc(h,v0.bigInt2BytesLE(1,h));function L(){let _=t.addFunction(o+\"_copy\");_.addParam(\"px\",\"i32\"),_.addParam(\"pr\",\"i32\");let r=_.getCodeBuilder();for(let Z=0;Z<e;Z++)_.addCode(r.i64_store(r.getLocal(\"pr\"),Z*8,r.i64_load(r.getLocal(\"px\"),Z*8)))}function l(){let _=t.addFunction(o+\"_zero\");_.addParam(\"pr\",\"i32\");let r=_.getCodeBuilder();for(let Z=0;Z<e;Z++)_.addCode(r.i64_store(r.getLocal(\"pr\"),Z*8,r.i64_const(0)))}function s(){let _=t.addFunction(o+\"_one\");_.addParam(\"pr\",\"i32\");let r=_.getCodeBuilder();_.addCode(r.i64_store(r.getLocal(\"pr\"),0,r.i64_const(1)));for(let Z=1;Z<e;Z++)_.addCode(r.i64_store(r.getLocal(\"pr\"),Z*8,r.i64_const(0)))}function x(){let _=t.addFunction(o+\"_isZero\");_.addParam(\"px\",\"i32\"),_.setReturnType(\"i32\");let r=_.getCodeBuilder();function Z(j){return j==0?r.ret(r.i64_eqz(r.i64_load(r.getLocal(\"px\")))):r.if(r.i64_eqz(r.i64_load(r.getLocal(\"px\"),j*8)),Z(j-1),r.ret(r.i32_const(0)))}_.addCode(Z(e-1)),_.addCode(r.ret(r.i32_const(0)))}function C(){let _=t.addFunction(o+\"_eq\");_.addParam(\"px\",\"i32\"),_.addParam(\"py\",\"i32\"),_.setReturnType(\"i32\");let r=_.getCodeBuilder();function Z(j){return j==0?r.ret(r.i64_eq(r.i64_load(r.getLocal(\"px\")),r.i64_load(r.getLocal(\"py\")))):r.if(r.i64_eq(r.i64_load(r.getLocal(\"px\"),j*8),r.i64_load(r.getLocal(\"py\"),j*8)),Z(j-1),r.ret(r.i32_const(0)))}_.addCode(Z(e-1)),_.addCode(r.ret(r.i32_const(0)))}function g(){let _=t.addFunction(o+\"_gte\");_.addParam(\"px\",\"i32\"),_.addParam(\"py\",\"i32\"),_.setReturnType(\"i32\");let r=_.getCodeBuilder();function Z(j){return j==0?r.ret(r.i64_ge_u(r.i64_load(r.getLocal(\"px\")),r.i64_load(r.getLocal(\"py\")))):r.if(r.i64_lt_u(r.i64_load(r.getLocal(\"px\"),j*8),r.i64_load(r.getLocal(\"py\"),j*8)),r.ret(r.i32_const(0)),r.if(r.i64_gt_u(r.i64_load(r.getLocal(\"px\"),j*8),r.i64_load(r.getLocal(\"py\"),j*8)),r.ret(r.i32_const(1)),Z(j-1)))}_.addCode(Z(e-1)),_.addCode(r.ret(r.i32_const(0)))}function $(){let _=t.addFunction(o+\"_add\");_.addParam(\"x\",\"i32\"),_.addParam(\"y\",\"i32\"),_.addParam(\"r\",\"i32\"),_.setReturnType(\"i32\"),_.addLocal(\"c\",\"i64\");let r=_.getCodeBuilder();_.addCode(r.setLocal(\"c\",r.i64_add(r.i64_load32_u(r.getLocal(\"x\")),r.i64_load32_u(r.getLocal(\"y\"))))),_.addCode(r.i64_store32(r.getLocal(\"r\"),r.getLocal(\"c\")));for(let Z=1;Z<d;Z++)_.addCode(r.setLocal(\"c\",r.i64_add(r.i64_add(r.i64_load32_u(r.getLocal(\"x\"),4*Z),r.i64_load32_u(r.getLocal(\"y\"),4*Z)),r.i64_shr_u(r.getLocal(\"c\"),r.i64_const(32))))),_.addCode(r.i64_store32(r.getLocal(\"r\"),Z*4,r.getLocal(\"c\")));_.addCode(r.i32_wrap_i64(r.i64_shr_u(r.getLocal(\"c\"),r.i64_const(32))))}function it(){let _=t.addFunction(o+\"_sub\");_.addParam(\"x\",\"i32\"),_.addParam(\"y\",\"i32\"),_.addParam(\"r\",\"i32\"),_.setReturnType(\"i32\"),_.addLocal(\"c\",\"i64\");let r=_.getCodeBuilder();_.addCode(r.setLocal(\"c\",r.i64_sub(r.i64_load32_u(r.getLocal(\"x\")),r.i64_load32_u(r.getLocal(\"y\"))))),_.addCode(r.i64_store32(r.getLocal(\"r\"),r.i64_and(r.getLocal(\"c\"),r.i64_const(\"0xFFFFFFFF\"))));for(let Z=1;Z<d;Z++)_.addCode(r.setLocal(\"c\",r.i64_add(r.i64_sub(r.i64_load32_u(r.getLocal(\"x\"),4*Z),r.i64_load32_u(r.getLocal(\"y\"),4*Z)),r.i64_shr_s(r.getLocal(\"c\"),r.i64_const(32))))),_.addCode(r.i64_store32(r.getLocal(\"r\"),Z*4,r.i64_and(r.getLocal(\"c\"),r.i64_const(\"0xFFFFFFFF\"))));_.addCode(r.i32_wrap_i64(r.i64_shr_s(r.getLocal(\"c\"),r.i64_const(32))))}function q(){let _=t.addFunction(o+\"_mul\");_.addParam(\"x\",\"i32\"),_.addParam(\"y\",\"i32\"),_.addParam(\"r\",\"i32\"),_.addLocal(\"c0\",\"i64\"),_.addLocal(\"c1\",\"i64\");for(let T=0;T<d;T++)_.addLocal(\"x\"+T,\"i64\"),_.addLocal(\"y\"+T,\"i64\");let r=_.getCodeBuilder(),Z=[],j=[];function nt(T,V){let rt,dt;return Z[T]?rt=r.getLocal(\"x\"+T):(rt=r.teeLocal(\"x\"+T,r.i64_load32_u(r.getLocal(\"x\"),T*4)),Z[T]=!0),j[V]?dt=r.getLocal(\"y\"+V):(dt=r.teeLocal(\"y\"+V,r.i64_load32_u(r.getLocal(\"y\"),V*4)),j[V]=!0),r.i64_mul(rt,dt)}let v=\"c0\",y=\"c1\";for(let T=0;T<d*2-1;T++){for(let V=Math.max(0,T-d+1);V<=T&&V<d;V++){let rt=T-V;_.addCode(r.setLocal(v,r.i64_add(r.i64_and(r.getLocal(v),r.i64_const(4294967295)),nt(V,rt)))),_.addCode(r.setLocal(y,r.i64_add(r.getLocal(y),r.i64_shr_u(r.getLocal(v),r.i64_const(32)))))}_.addCode(r.i64_store32(r.getLocal(\"r\"),T*4,r.getLocal(v))),[v,y]=[y,v],_.addCode(r.setLocal(y,r.i64_shr_u(r.getLocal(v),r.i64_const(32))))}_.addCode(r.i64_store32(r.getLocal(\"r\"),d*4*2-4,r.getLocal(v)))}function S(){let _=t.addFunction(o+\"_square\");_.addParam(\"x\",\"i32\"),_.addParam(\"r\",\"i32\"),_.addLocal(\"c0\",\"i64\"),_.addLocal(\"c1\",\"i64\"),_.addLocal(\"c0_old\",\"i64\"),_.addLocal(\"c1_old\",\"i64\");for(let V=0;V<d;V++)_.addLocal(\"x\"+V,\"i64\");let r=_.getCodeBuilder(),Z=[];function j(V,rt){let dt,ot;return Z[V]?dt=r.getLocal(\"x\"+V):(dt=r.teeLocal(\"x\"+V,r.i64_load32_u(r.getLocal(\"x\"),V*4)),Z[V]=!0),Z[rt]?ot=r.getLocal(\"x\"+rt):(ot=r.teeLocal(\"x\"+rt,r.i64_load32_u(r.getLocal(\"x\"),rt*4)),Z[rt]=!0),r.i64_mul(dt,ot)}let nt=\"c0\",v=\"c1\",y=\"c0_old\",T=\"c1_old\";for(let V=0;V<d*2-1;V++){_.addCode(r.setLocal(nt,r.i64_const(0)),r.setLocal(v,r.i64_const(0)));for(let rt=Math.max(0,V-d+1);rt<V+1>>1&&rt<d;rt++){let dt=V-rt;_.addCode(r.setLocal(nt,r.i64_add(r.i64_and(r.getLocal(nt),r.i64_const(4294967295)),j(rt,dt)))),_.addCode(r.setLocal(v,r.i64_add(r.getLocal(v),r.i64_shr_u(r.getLocal(nt),r.i64_const(32)))))}_.addCode(r.setLocal(nt,r.i64_shl(r.i64_and(r.getLocal(nt),r.i64_const(4294967295)),r.i64_const(1)))),_.addCode(r.setLocal(v,r.i64_add(r.i64_shl(r.getLocal(v),r.i64_const(1)),r.i64_shr_u(r.getLocal(nt),r.i64_const(32))))),V%2==0&&(_.addCode(r.setLocal(nt,r.i64_add(r.i64_and(r.getLocal(nt),r.i64_const(4294967295)),j(V>>1,V>>1)))),_.addCode(r.setLocal(v,r.i64_add(r.getLocal(v),r.i64_shr_u(r.getLocal(nt),r.i64_const(32)))))),V>0&&(_.addCode(r.setLocal(nt,r.i64_add(r.i64_and(r.getLocal(nt),r.i64_const(4294967295)),r.i64_and(r.getLocal(y),r.i64_const(4294967295))))),_.addCode(r.setLocal(v,r.i64_add(r.i64_add(r.getLocal(v),r.i64_shr_u(r.getLocal(nt),r.i64_const(32))),r.getLocal(T))))),_.addCode(r.i64_store32(r.getLocal(\"r\"),V*4,r.getLocal(nt))),_.addCode(r.setLocal(y,r.getLocal(v)),r.setLocal(T,r.i64_shr_u(r.getLocal(y),r.i64_const(32))))}_.addCode(r.i64_store32(r.getLocal(\"r\"),d*4*2-4,r.getLocal(y)))}function O(){let _=t.addFunction(o+\"_squareOld\");_.addParam(\"x\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder();_.addCode(r.call(o+\"_mul\",r.getLocal(\"x\"),r.getLocal(\"x\"),r.getLocal(\"r\")))}function M(){let _=t.addFunction(o+\"__mul1\");_.addParam(\"px\",\"i32\"),_.addParam(\"y\",\"i64\"),_.addParam(\"pr\",\"i32\"),_.addLocal(\"c\",\"i64\");let r=_.getCodeBuilder();_.addCode(r.setLocal(\"c\",r.i64_mul(r.i64_load32_u(r.getLocal(\"px\"),0,0),r.getLocal(\"y\")))),_.addCode(r.i64_store32(r.getLocal(\"pr\"),0,0,r.getLocal(\"c\")));for(let Z=1;Z<d;Z++)_.addCode(r.setLocal(\"c\",r.i64_add(r.i64_mul(r.i64_load32_u(r.getLocal(\"px\"),4*Z,0),r.getLocal(\"y\")),r.i64_shr_u(r.getLocal(\"c\"),r.i64_const(32))))),_.addCode(r.i64_store32(r.getLocal(\"pr\"),Z*4,0,r.getLocal(\"c\")))}function W(){let _=t.addFunction(o+\"__add1\");_.addParam(\"x\",\"i32\"),_.addParam(\"y\",\"i64\"),_.addLocal(\"c\",\"i64\"),_.addLocal(\"px\",\"i32\");let r=_.getCodeBuilder();_.addCode(r.setLocal(\"px\",r.getLocal(\"x\"))),_.addCode(r.setLocal(\"c\",r.i64_add(r.i64_load32_u(r.getLocal(\"px\"),0,0),r.getLocal(\"y\")))),_.addCode(r.i64_store32(r.getLocal(\"px\"),0,0,r.getLocal(\"c\"))),_.addCode(r.setLocal(\"c\",r.i64_shr_u(r.getLocal(\"c\"),r.i64_const(32)))),_.addCode(r.block(r.loop(r.br_if(1,r.i64_eqz(r.getLocal(\"c\"))),r.setLocal(\"px\",r.i32_add(r.getLocal(\"px\"),r.i32_const(4))),r.setLocal(\"c\",r.i64_add(r.i64_load32_u(r.getLocal(\"px\"),0,0),r.getLocal(\"c\"))),r.i64_store32(r.getLocal(\"px\"),0,0,r.getLocal(\"c\")),r.setLocal(\"c\",r.i64_shr_u(r.getLocal(\"c\"),r.i64_const(32))),r.br(0))))}function ct(){M(),W();let _=t.addFunction(o+\"_div\");_.addParam(\"x\",\"i32\"),_.addParam(\"y\",\"i32\"),_.addParam(\"c\",\"i32\"),_.addParam(\"r\",\"i32\"),_.addLocal(\"rr\",\"i32\"),_.addLocal(\"cc\",\"i32\"),_.addLocal(\"eX\",\"i32\"),_.addLocal(\"eY\",\"i32\"),_.addLocal(\"sy\",\"i64\"),_.addLocal(\"sx\",\"i64\"),_.addLocal(\"ec\",\"i32\");let r=_.getCodeBuilder(),Z=r.i32_const(t.alloc(h)),j=r.i32_const(t.alloc(h)),nt=r.i32_const(t.alloc(h)),v=r.getLocal(\"cc\"),y=r.getLocal(\"rr\"),T=t.alloc(h*2),V=r.i32_const(T),rt=r.i32_const(T+h);_.addCode(r.if(r.getLocal(\"c\"),r.setLocal(\"cc\",r.getLocal(\"c\")),r.setLocal(\"cc\",j))),_.addCode(r.if(r.getLocal(\"r\"),r.setLocal(\"rr\",r.getLocal(\"r\")),r.setLocal(\"rr\",nt))),_.addCode(r.call(o+\"_copy\",r.getLocal(\"x\"),y)),_.addCode(r.call(o+\"_copy\",r.getLocal(\"y\"),Z)),_.addCode(r.call(o+\"_zero\",v)),_.addCode(r.call(o+\"_zero\",V)),_.addCode(r.setLocal(\"eX\",r.i32_const(h-1))),_.addCode(r.setLocal(\"eY\",r.i32_const(h-1))),_.addCode(r.block(r.loop(r.br_if(1,r.i32_or(r.i32_load8_u(r.i32_add(Z,r.getLocal(\"eY\")),0,0),r.i32_eq(r.getLocal(\"eY\"),r.i32_const(3)))),r.setLocal(\"eY\",r.i32_sub(r.getLocal(\"eY\"),r.i32_const(1))),r.br(0)))),_.addCode(r.setLocal(\"sy\",r.i64_add(r.i64_load32_u(r.i32_sub(r.i32_add(Z,r.getLocal(\"eY\")),r.i32_const(3)),0,0),r.i64_const(1)))),_.addCode(r.if(r.i64_eq(r.getLocal(\"sy\"),r.i64_const(1)),r.drop(r.i64_div_u(r.i64_const(0),r.i64_const(0))))),_.addCode(r.block(r.loop(r.block(r.loop(r.br_if(1,r.i32_or(r.i32_load8_u(r.i32_add(y,r.getLocal(\"eX\")),0,0),r.i32_eq(r.getLocal(\"eX\"),r.i32_const(7)))),r.setLocal(\"eX\",r.i32_sub(r.getLocal(\"eX\"),r.i32_const(1))),r.br(0))),r.setLocal(\"sx\",r.i64_load(r.i32_sub(r.i32_add(y,r.getLocal(\"eX\")),r.i32_const(7)),0,0)),r.setLocal(\"sx\",r.i64_div_u(r.getLocal(\"sx\"),r.getLocal(\"sy\"))),r.setLocal(\"ec\",r.i32_sub(r.i32_sub(r.getLocal(\"eX\"),r.getLocal(\"eY\")),r.i32_const(4))),r.block(r.loop(r.br_if(1,r.i32_and(r.i64_eqz(r.i64_and(r.getLocal(\"sx\"),r.i64_const(\"0xFFFFFFFF00000000\"))),r.i32_ge_s(r.getLocal(\"ec\"),r.i32_const(0)))),r.setLocal(\"sx\",r.i64_shr_u(r.getLocal(\"sx\"),r.i64_const(8))),r.setLocal(\"ec\",r.i32_add(r.getLocal(\"ec\"),r.i32_const(1))),r.br(0))),r.if(r.i64_eqz(r.getLocal(\"sx\")),[...r.br_if(2,r.i32_eqz(r.call(o+\"_gte\",y,Z))),...r.setLocal(\"sx\",r.i64_const(1)),...r.setLocal(\"ec\",r.i32_const(0))]),r.call(o+\"__mul1\",Z,r.getLocal(\"sx\"),rt),r.drop(r.call(o+\"_sub\",y,r.i32_sub(rt,r.getLocal(\"ec\")),y)),r.call(o+\"__add1\",r.i32_add(v,r.getLocal(\"ec\")),r.getLocal(\"sx\")),r.br(0))))}function E(){let _=t.addFunction(o+\"_inverseMod\");_.addParam(\"px\",\"i32\"),_.addParam(\"pm\",\"i32\"),_.addParam(\"pr\",\"i32\"),_.addLocal(\"t\",\"i32\"),_.addLocal(\"newt\",\"i32\"),_.addLocal(\"r\",\"i32\"),_.addLocal(\"qq\",\"i32\"),_.addLocal(\"qr\",\"i32\"),_.addLocal(\"newr\",\"i32\"),_.addLocal(\"swp\",\"i32\"),_.addLocal(\"x\",\"i32\"),_.addLocal(\"signt\",\"i32\"),_.addLocal(\"signnewt\",\"i32\"),_.addLocal(\"signx\",\"i32\");let r=_.getCodeBuilder(),Z=r.i32_const(t.alloc(h)),j=r.i32_const(t.alloc(h)),nt=r.i32_const(t.alloc(h)),v=r.i32_const(t.alloc(h)),y=r.i32_const(t.alloc(h)),T=r.i32_const(t.alloc(h)),V=r.i32_const(t.alloc(h*2)),rt=r.i32_const(t.alloc(h));_.addCode(r.setLocal(\"t\",Z),r.call(o+\"_zero\",Z),r.setLocal(\"signt\",r.i32_const(0))),_.addCode(r.setLocal(\"r\",j),r.call(o+\"_copy\",r.getLocal(\"pm\"),j)),_.addCode(r.setLocal(\"newt\",nt),r.call(o+\"_one\",nt),r.setLocal(\"signnewt\",r.i32_const(0))),_.addCode(r.setLocal(\"newr\",v),r.call(o+\"_copy\",r.getLocal(\"px\"),v)),_.addCode(r.setLocal(\"qq\",y)),_.addCode(r.setLocal(\"qr\",T)),_.addCode(r.setLocal(\"x\",rt)),_.addCode(r.block(r.loop(r.br_if(1,r.call(o+\"_isZero\",r.getLocal(\"newr\"))),r.call(o+\"_div\",r.getLocal(\"r\"),r.getLocal(\"newr\"),r.getLocal(\"qq\"),r.getLocal(\"qr\")),r.call(o+\"_mul\",r.getLocal(\"qq\"),r.getLocal(\"newt\"),V),r.if(r.getLocal(\"signt\"),r.if(r.getLocal(\"signnewt\"),r.if(r.call(o+\"_gte\",V,r.getLocal(\"t\")),[...r.drop(r.call(o+\"_sub\",V,r.getLocal(\"t\"),r.getLocal(\"x\"))),...r.setLocal(\"signx\",r.i32_const(0))],[...r.drop(r.call(o+\"_sub\",r.getLocal(\"t\"),V,r.getLocal(\"x\"))),...r.setLocal(\"signx\",r.i32_const(1))]),[...r.drop(r.call(o+\"_add\",V,r.getLocal(\"t\"),r.getLocal(\"x\"))),...r.setLocal(\"signx\",r.i32_const(1))]),r.if(r.getLocal(\"signnewt\"),[...r.drop(r.call(o+\"_add\",V,r.getLocal(\"t\"),r.getLocal(\"x\"))),...r.setLocal(\"signx\",r.i32_const(0))],r.if(r.call(o+\"_gte\",r.getLocal(\"t\"),V),[...r.drop(r.call(o+\"_sub\",r.getLocal(\"t\"),V,r.getLocal(\"x\"))),...r.setLocal(\"signx\",r.i32_const(0))],[...r.drop(r.call(o+\"_sub\",V,r.getLocal(\"t\"),r.getLocal(\"x\"))),...r.setLocal(\"signx\",r.i32_const(1))]))),r.setLocal(\"swp\",r.getLocal(\"t\")),r.setLocal(\"t\",r.getLocal(\"newt\")),r.setLocal(\"newt\",r.getLocal(\"x\")),r.setLocal(\"x\",r.getLocal(\"swp\")),r.setLocal(\"signt\",r.getLocal(\"signnewt\")),r.setLocal(\"signnewt\",r.getLocal(\"signx\")),r.setLocal(\"swp\",r.getLocal(\"r\")),r.setLocal(\"r\",r.getLocal(\"newr\")),r.setLocal(\"newr\",r.getLocal(\"qr\")),r.setLocal(\"qr\",r.getLocal(\"swp\")),r.br(0)))),_.addCode(r.if(r.getLocal(\"signt\"),r.drop(r.call(o+\"_sub\",r.getLocal(\"pm\"),r.getLocal(\"t\"),r.getLocal(\"pr\"))),r.call(o+\"_copy\",r.getLocal(\"t\"),r.getLocal(\"pr\"))))}return L(),l(),x(),s(),C(),g(),$(),it(),q(),S(),O(),ct(),E(),t.exportFunction(o+\"_copy\"),t.exportFunction(o+\"_zero\"),t.exportFunction(o+\"_one\"),t.exportFunction(o+\"_isZero\"),t.exportFunction(o+\"_eq\"),t.exportFunction(o+\"_gte\"),t.exportFunction(o+\"_add\"),t.exportFunction(o+\"_sub\"),t.exportFunction(o+\"_mul\"),t.exportFunction(o+\"_square\"),t.exportFunction(o+\"_squareOld\"),t.exportFunction(o+\"_div\"),t.exportFunction(o+\"_inverseMod\"),o}});var Co=Yt((r8,qd)=>{qd.exports=function(t,e,n,o,d,h,f){let L=t.addFunction(e);L.addParam(\"base\",\"i32\"),L.addParam(\"scalar\",\"i32\"),L.addParam(\"scalarLength\",\"i32\"),L.addParam(\"r\",\"i32\"),L.addLocal(\"i\",\"i32\"),L.addLocal(\"b\",\"i32\");let l=L.getCodeBuilder(),s=l.i32_const(t.alloc(n));L.addCode(l.if(l.i32_eqz(l.getLocal(\"scalarLength\")),[...l.call(f,l.getLocal(\"r\")),...l.ret([])])),L.addCode(l.call(h,l.getLocal(\"base\"),s)),L.addCode(l.call(f,l.getLocal(\"r\"))),L.addCode(l.setLocal(\"i\",l.getLocal(\"scalarLength\"))),L.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\")))),...x(),l.br_if(1,l.i32_eqz(l.getLocal(\"i\"))),l.br(0))));function x(){let C=[];for(let g=0;g<8;g++)C.push(...l.call(d,l.getLocal(\"r\"),l.getLocal(\"r\")),...l.if(l.i32_ge_u(l.getLocal(\"b\"),l.i32_const(128>>g)),[...l.setLocal(\"b\",l.i32_sub(l.getLocal(\"b\"),l.i32_const(128>>g))),...l.call(o,l.getLocal(\"r\"),s,l.getLocal(\"r\"))]));return C}}});var xo=Yt((l8,Ud)=>{Ud.exports=S0;function S0(i,t){let e=i.modules[t].n64*8,n=i.addFunction(t+\"_batchInverse\");n.addParam(\"pIn\",\"i32\"),n.addParam(\"inStep\",\"i32\"),n.addParam(\"n\",\"i32\"),n.addParam(\"pOut\",\"i32\"),n.addParam(\"outStep\",\"i32\"),n.addLocal(\"itAux\",\"i32\"),n.addLocal(\"itIn\",\"i32\"),n.addLocal(\"itOut\",\"i32\"),n.addLocal(\"i\",\"i32\");let o=n.getCodeBuilder(),d=o.i32_const(i.alloc(e));n.addCode(o.setLocal(\"itAux\",o.i32_load(o.i32_const(0))),o.i32_store(o.i32_const(0),o.i32_add(o.getLocal(\"itAux\"),o.i32_mul(o.i32_add(o.getLocal(\"n\"),o.i32_const(1)),o.i32_const(e))))),n.addCode(o.call(t+\"_one\",o.getLocal(\"itAux\")),o.setLocal(\"itIn\",o.getLocal(\"pIn\")),o.setLocal(\"itAux\",o.i32_add(o.getLocal(\"itAux\"),o.i32_const(e))),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(t+\"_isZero\",o.getLocal(\"itIn\")),o.call(t+\"_copy\",o.i32_sub(o.getLocal(\"itAux\"),o.i32_const(e)),o.getLocal(\"itAux\")),o.call(t+\"_mul\",o.getLocal(\"itIn\"),o.i32_sub(o.getLocal(\"itAux\"),o.i32_const(e)),o.getLocal(\"itAux\"))),o.setLocal(\"itIn\",o.i32_add(o.getLocal(\"itIn\"),o.getLocal(\"inStep\"))),o.setLocal(\"itAux\",o.i32_add(o.getLocal(\"itAux\"),o.i32_const(e))),o.setLocal(\"i\",o.i32_add(o.getLocal(\"i\"),o.i32_const(1))),o.br(0))),o.setLocal(\"itIn\",o.i32_sub(o.getLocal(\"itIn\"),o.getLocal(\"inStep\"))),o.setLocal(\"itAux\",o.i32_sub(o.getLocal(\"itAux\"),o.i32_const(e))),o.setLocal(\"itOut\",o.i32_add(o.getLocal(\"pOut\"),o.i32_mul(o.i32_sub(o.getLocal(\"n\"),o.i32_const(1)),o.getLocal(\"outStep\")))),o.call(t+\"_inverse\",o.getLocal(\"itAux\"),o.getLocal(\"itAux\")),o.block(o.loop(o.br_if(1,o.i32_eqz(o.getLocal(\"i\"))),o.if(o.call(t+\"_isZero\",o.getLocal(\"itIn\")),[...o.call(t+\"_copy\",o.getLocal(\"itAux\"),o.i32_sub(o.getLocal(\"itAux\"),o.i32_const(e))),...o.call(t+\"_zero\",o.getLocal(\"itOut\"))],[...o.call(t+\"_copy\",o.i32_sub(o.getLocal(\"itAux\"),o.i32_const(e)),d),...o.call(t+\"_mul\",o.getLocal(\"itAux\"),o.getLocal(\"itIn\"),o.i32_sub(o.getLocal(\"itAux\"),o.i32_const(e))),...o.call(t+\"_mul\",o.getLocal(\"itAux\"),d,o.getLocal(\"itOut\"))]),o.setLocal(\"itIn\",o.i32_sub(o.getLocal(\"itIn\"),o.getLocal(\"inStep\"))),o.setLocal(\"itOut\",o.i32_sub(o.getLocal(\"itOut\"),o.getLocal(\"outStep\"))),o.setLocal(\"itAux\",o.i32_sub(o.getLocal(\"itAux\"),o.i32_const(e))),o.setLocal(\"i\",o.i32_sub(o.getLocal(\"i\"),o.i32_const(1))),o.br(0)))),n.addCode(o.i32_store(o.i32_const(0),o.getLocal(\"itAux\")))}});var ac=Yt((d8,Rd)=>{Rd.exports=q0;function q0(i,t,e,n,o,d){typeof d>\"u\"&&(n<o?d=!0:d=!1);let h=i.addFunction(t);h.addParam(\"pIn\",\"i32\"),h.addParam(\"n\",\"i32\"),h.addParam(\"pOut\",\"i32\"),h.addLocal(\"i\",\"i32\"),h.addLocal(\"itIn\",\"i32\"),h.addLocal(\"itOut\",\"i32\");let f=h.getCodeBuilder();d?h.addCode(f.setLocal(\"itIn\",f.i32_add(f.getLocal(\"pIn\"),f.i32_mul(f.i32_sub(f.getLocal(\"n\"),f.i32_const(1)),f.i32_const(n)))),f.setLocal(\"itOut\",f.i32_add(f.getLocal(\"pOut\"),f.i32_mul(f.i32_sub(f.getLocal(\"n\"),f.i32_const(1)),f.i32_const(o)))),f.setLocal(\"i\",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal(\"i\"),f.getLocal(\"n\"))),f.call(e,f.getLocal(\"itIn\"),f.getLocal(\"itOut\")),f.setLocal(\"itIn\",f.i32_sub(f.getLocal(\"itIn\"),f.i32_const(n))),f.setLocal(\"itOut\",f.i32_sub(f.getLocal(\"itOut\"),f.i32_const(o))),f.setLocal(\"i\",f.i32_add(f.getLocal(\"i\"),f.i32_const(1))),f.br(0)))):h.addCode(f.setLocal(\"itIn\",f.getLocal(\"pIn\")),f.setLocal(\"itOut\",f.getLocal(\"pOut\")),f.setLocal(\"i\",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal(\"i\"),f.getLocal(\"n\"))),f.call(e,f.getLocal(\"itIn\"),f.getLocal(\"itOut\")),f.setLocal(\"itIn\",f.i32_add(f.getLocal(\"itIn\"),f.i32_const(n))),f.setLocal(\"itOut\",f.i32_add(f.getLocal(\"itOut\"),f.i32_const(o))),f.setLocal(\"i\",f.i32_add(f.getLocal(\"i\"),f.i32_const(1))),f.br(0))))}});var Pd=Yt((u8,Od)=>{Od.exports=U0;function U0(i,t,e,n,o,d){typeof d>\"u\"&&(n<o?d=!0:d=!1);let h=i.addFunction(t);h.addParam(\"pIn1\",\"i32\"),h.addParam(\"pIn2\",\"i32\"),h.addParam(\"n\",\"i32\"),h.addParam(\"pOut\",\"i32\"),h.addLocal(\"i\",\"i32\"),h.addLocal(\"itIn1\",\"i32\"),h.addLocal(\"itIn2\",\"i32\"),h.addLocal(\"itOut\",\"i32\");let f=h.getCodeBuilder();d?h.addCode(f.setLocal(\"itIn1\",f.i32_add(f.getLocal(\"pIn1\"),f.i32_mul(f.i32_sub(f.getLocal(\"n\"),f.i32_const(1)),f.i32_const(n)))),f.setLocal(\"itIn2\",f.i32_add(f.getLocal(\"pIn2\"),f.i32_mul(f.i32_sub(f.getLocal(\"n\"),f.i32_const(1)),f.i32_const(n)))),f.setLocal(\"itOut\",f.i32_add(f.getLocal(\"pOut\"),f.i32_mul(f.i32_sub(f.getLocal(\"n\"),f.i32_const(1)),f.i32_const(o)))),f.setLocal(\"i\",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal(\"i\"),f.getLocal(\"n\"))),f.call(e,f.getLocal(\"itIn1\"),f.getLocal(\"itIn2\"),f.getLocal(\"itOut\")),f.setLocal(\"itIn1\",f.i32_sub(f.getLocal(\"itIn1\"),f.i32_const(n))),f.setLocal(\"itIn2\",f.i32_sub(f.getLocal(\"itIn2\"),f.i32_const(n))),f.setLocal(\"itOut\",f.i32_sub(f.getLocal(\"itOut\"),f.i32_const(o))),f.setLocal(\"i\",f.i32_add(f.getLocal(\"i\"),f.i32_const(1))),f.br(0)))):h.addCode(f.setLocal(\"itIn1\",f.getLocal(\"pIn1\")),f.setLocal(\"itIn2\",f.getLocal(\"pIn2\")),f.setLocal(\"itOut\",f.getLocal(\"pOut\")),f.setLocal(\"i\",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal(\"i\"),f.getLocal(\"n\"))),f.call(e,f.getLocal(\"itIn1\"),f.getLocal(\"itIn2\"),f.getLocal(\"itOut\")),f.setLocal(\"itIn1\",f.i32_add(f.getLocal(\"itIn1\"),f.i32_const(n))),f.setLocal(\"itIn2\",f.i32_add(f.getLocal(\"itIn2\"),f.i32_const(n))),f.setLocal(\"itOut\",f.i32_add(f.getLocal(\"itOut\"),f.i32_const(o))),f.setLocal(\"i\",f.i32_add(f.getLocal(\"i\"),f.i32_const(1))),f.br(0))))}});var Io=Yt((f8,zd)=>{var Ne=Ve(),R0=Sd(),pn=ri(),O0=Co(),P0=xo(),oc=ac(),sc=Pd();zd.exports=function(t,e,n,o){let d=Ne(e),h=Math.floor((d.minus(1).bitLength()-1)/64)+1,f=h*2,L=h*8,l=n||\"f1m\";if(t.modules[l])return l;let s=R0(t,h,o),x=t.alloc(L,pn.bigInt2BytesLE(d,L)),C=t.alloc(pn.bigInt2BytesLE(Ne.one.shiftLeft(h*64).mod(d),L)),g=t.alloc(pn.bigInt2BytesLE(Ne.one.shiftLeft(h*64).square().mod(d),L)),$=t.alloc(pn.bigInt2BytesLE(Ne.one.shiftLeft(h*64).mod(d),L)),it=t.alloc(pn.bigInt2BytesLE(Ne.zero,L)),q=d.minus(Ne.one),S=q.shiftRight(1),O=t.alloc(L,pn.bigInt2BytesLE(S,L)),M=S.add(Ne.one),W=t.alloc(L,pn.bigInt2BytesLE(M,L));t.modules[l]={pq:x,pR2:g,n64:h,q:d,pOne:$,pZero:it,pePlusOne:W};function ct(){let U=t.addFunction(l+\"_one\");U.addParam(\"pr\",\"i32\");let A=U.getCodeBuilder();U.addCode(A.call(s+\"_copy\",A.i32_const($),A.getLocal(\"pr\")))}function E(){let U=t.addFunction(l+\"_add\");U.addParam(\"x\",\"i32\"),U.addParam(\"y\",\"i32\"),U.addParam(\"r\",\"i32\");let A=U.getCodeBuilder();U.addCode(A.if(A.call(s+\"_add\",A.getLocal(\"x\"),A.getLocal(\"y\"),A.getLocal(\"r\")),A.drop(A.call(s+\"_sub\",A.getLocal(\"r\"),A.i32_const(x),A.getLocal(\"r\"))),A.if(A.call(s+\"_gte\",A.getLocal(\"r\"),A.i32_const(x)),A.drop(A.call(s+\"_sub\",A.getLocal(\"r\"),A.i32_const(x),A.getLocal(\"r\"))))))}function _(){let U=t.addFunction(l+\"_sub\");U.addParam(\"x\",\"i32\"),U.addParam(\"y\",\"i32\"),U.addParam(\"r\",\"i32\");let A=U.getCodeBuilder();U.addCode(A.if(A.call(s+\"_sub\",A.getLocal(\"x\"),A.getLocal(\"y\"),A.getLocal(\"r\")),A.drop(A.call(s+\"_add\",A.getLocal(\"r\"),A.i32_const(x),A.getLocal(\"r\")))))}function r(){let U=t.addFunction(l+\"_neg\");U.addParam(\"x\",\"i32\"),U.addParam(\"r\",\"i32\");let A=U.getCodeBuilder();U.addCode(A.call(l+\"_sub\",A.i32_const(it),A.getLocal(\"x\"),A.getLocal(\"r\")))}function Z(){let U=t.addFunction(l+\"_isNegative\");U.addParam(\"x\",\"i32\"),U.setReturnType(\"i32\");let A=U.getCodeBuilder(),et=A.i32_const(t.alloc(L));U.addCode(A.call(l+\"_fromMontgomery\",A.getLocal(\"x\"),et),A.call(s+\"_gte\",et,A.i32_const(W)))}function j(){let U=t.addFunction(l+\"_sign\");U.addParam(\"x\",\"i32\"),U.setReturnType(\"i32\");let A=U.getCodeBuilder(),et=A.i32_const(t.alloc(L));U.addCode(A.if(A.call(s+\"_isZero\",A.getLocal(\"x\")),A.ret(A.i32_const(0))),A.call(l+\"_fromMontgomery\",A.getLocal(\"x\"),et),A.if(A.call(s+\"_gte\",et,A.i32_const(W)),A.ret(A.i32_const(-1))),A.ret(A.i32_const(1)))}function nt(){let U=t.alloc(f*f*8),A=t.addFunction(l+\"_mReduct\");A.addParam(\"t\",\"i32\"),A.addParam(\"r\",\"i32\"),A.addLocal(\"np32\",\"i64\"),A.addLocal(\"c\",\"i64\"),A.addLocal(\"m\",\"i64\");let et=A.getCodeBuilder(),Lt=Ne(\"100000000\",16).minus(d.modInv(Ne(\"100000000\",16))).toJSNumber();A.addCode(et.setLocal(\"np32\",et.i64_const(Lt)));for(let St=0;St<f;St++){A.addCode(et.setLocal(\"c\",et.i64_const(0))),A.addCode(et.setLocal(\"m\",et.i64_and(et.i64_mul(et.i64_load32_u(et.getLocal(\"t\"),St*4),et.getLocal(\"np32\")),et.i64_const(\"0xFFFFFFFF\"))));for(let qt=0;qt<f;qt++)A.addCode(et.setLocal(\"c\",et.i64_add(et.i64_add(et.i64_load32_u(et.getLocal(\"t\"),(St+qt)*4),et.i64_shr_u(et.getLocal(\"c\"),et.i64_const(32))),et.i64_mul(et.i64_load32_u(et.i32_const(x),qt*4),et.getLocal(\"m\"))))),A.addCode(et.i64_store32(et.getLocal(\"t\"),(St+qt)*4,et.getLocal(\"c\")));A.addCode(et.i64_store32(et.i32_const(U),St*4,et.i64_shr_u(et.getLocal(\"c\"),et.i64_const(32))))}A.addCode(et.call(l+\"_add\",et.i32_const(U),et.i32_add(et.getLocal(\"t\"),et.i32_const(f*4)),et.getLocal(\"r\")))}function v(){let U=t.addFunction(l+\"_mul\");U.addParam(\"x\",\"i32\"),U.addParam(\"y\",\"i32\"),U.addParam(\"r\",\"i32\"),U.addLocal(\"c0\",\"i64\"),U.addLocal(\"c1\",\"i64\"),U.addLocal(\"np32\",\"i64\");for(let wt=0;wt<f;wt++)U.addLocal(\"x\"+wt,\"i64\"),U.addLocal(\"y\"+wt,\"i64\"),U.addLocal(\"m\"+wt,\"i64\"),U.addLocal(\"q\"+wt,\"i64\");let A=U.getCodeBuilder(),et=Ne(\"100000000\",16).minus(d.modInv(Ne(\"100000000\",16))).toJSNumber();U.addCode(A.setLocal(\"np32\",A.i64_const(et)));let Lt=[],St=[],qt=[];function Dt(wt,Rt){let I,z;return Lt[wt]?I=A.getLocal(\"x\"+wt):(I=A.teeLocal(\"x\"+wt,A.i64_load32_u(A.getLocal(\"x\"),wt*4)),Lt[wt]=!0),St[Rt]?z=A.getLocal(\"y\"+Rt):(z=A.teeLocal(\"y\"+Rt,A.i64_load32_u(A.getLocal(\"y\"),Rt*4)),St[Rt]=!0),A.i64_mul(I,z)}function kt(wt,Rt){let I,z;return qt[wt]?I=A.getLocal(\"q\"+wt):(I=A.teeLocal(\"q\"+wt,A.i64_load32_u(A.i32_const(0),x+wt*4)),qt[wt]=!0),z=A.getLocal(\"m\"+Rt),A.i64_mul(I,z)}let Bt=\"c0\",Tt=\"c1\";for(let wt=0;wt<f*2-1;wt++){for(let Rt=Math.max(0,wt-f+1);Rt<=wt&&Rt<f;Rt++){let I=wt-Rt;U.addCode(A.setLocal(Bt,A.i64_add(A.i64_and(A.getLocal(Bt),A.i64_const(4294967295)),Dt(Rt,I)))),U.addCode(A.setLocal(Tt,A.i64_add(A.getLocal(Tt),A.i64_shr_u(A.getLocal(Bt),A.i64_const(32)))))}for(let Rt=Math.max(1,wt-f+1);Rt<=wt&&Rt<f;Rt++){let I=wt-Rt;U.addCode(A.setLocal(Bt,A.i64_add(A.i64_and(A.getLocal(Bt),A.i64_const(4294967295)),kt(Rt,I)))),U.addCode(A.setLocal(Tt,A.i64_add(A.getLocal(Tt),A.i64_shr_u(A.getLocal(Bt),A.i64_const(32)))))}wt<f&&(U.addCode(A.setLocal(\"m\"+wt,A.i64_and(A.i64_mul(A.i64_and(A.getLocal(Bt),A.i64_const(4294967295)),A.getLocal(\"np32\")),A.i64_const(\"0xFFFFFFFF\")))),U.addCode(A.setLocal(Bt,A.i64_add(A.i64_and(A.getLocal(Bt),A.i64_const(4294967295)),kt(0,wt)))),U.addCode(A.setLocal(Tt,A.i64_add(A.getLocal(Tt),A.i64_shr_u(A.getLocal(Bt),A.i64_const(32)))))),wt>=f&&U.addCode(A.i64_store32(A.getLocal(\"r\"),(wt-f)*4,A.getLocal(Bt))),[Bt,Tt]=[Tt,Bt],U.addCode(A.setLocal(Tt,A.i64_shr_u(A.getLocal(Bt),A.i64_const(32))))}U.addCode(A.i64_store32(A.getLocal(\"r\"),f*4-4,A.getLocal(Bt))),U.addCode(A.if(A.i32_wrap_i64(A.getLocal(Tt)),A.drop(A.call(s+\"_sub\",A.getLocal(\"r\"),A.i32_const(x),A.getLocal(\"r\"))),A.if(A.call(s+\"_gte\",A.getLocal(\"r\"),A.i32_const(x)),A.drop(A.call(s+\"_sub\",A.getLocal(\"r\"),A.i32_const(x),A.getLocal(\"r\"))))))}function y(){let U=t.addFunction(l+\"_square\");U.addParam(\"x\",\"i32\"),U.addParam(\"r\",\"i32\"),U.addLocal(\"c0\",\"i64\"),U.addLocal(\"c1\",\"i64\"),U.addLocal(\"c0_old\",\"i64\"),U.addLocal(\"c1_old\",\"i64\"),U.addLocal(\"np32\",\"i64\");for(let Rt=0;Rt<f;Rt++)U.addLocal(\"x\"+Rt,\"i64\"),U.addLocal(\"m\"+Rt,\"i64\"),U.addLocal(\"q\"+Rt,\"i64\");let A=U.getCodeBuilder(),et=Ne(\"100000000\",16).minus(d.modInv(Ne(\"100000000\",16))).toJSNumber();U.addCode(A.setLocal(\"np32\",A.i64_const(et)));let Lt=[],St=[];function qt(Rt,I){let z,J;return Lt[Rt]?z=A.getLocal(\"x\"+Rt):(z=A.teeLocal(\"x\"+Rt,A.i64_load32_u(A.getLocal(\"x\"),Rt*4)),Lt[Rt]=!0),Lt[I]?J=A.getLocal(\"x\"+I):(J=A.teeLocal(\"x\"+I,A.i64_load32_u(A.getLocal(\"x\"),I*4)),Lt[I]=!0),A.i64_mul(z,J)}function Dt(Rt,I){let z,J;return St[Rt]?z=A.getLocal(\"q\"+Rt):(z=A.teeLocal(\"q\"+Rt,A.i64_load32_u(A.i32_const(0),x+Rt*4)),St[Rt]=!0),J=A.getLocal(\"m\"+I),A.i64_mul(z,J)}let kt=\"c0\",Bt=\"c1\",Tt=\"c0_old\",wt=\"c1_old\";for(let Rt=0;Rt<f*2-1;Rt++){U.addCode(A.setLocal(kt,A.i64_const(0)),A.setLocal(Bt,A.i64_const(0)));for(let I=Math.max(0,Rt-f+1);I<Rt+1>>1&&I<f;I++){let z=Rt-I;U.addCode(A.setLocal(kt,A.i64_add(A.i64_and(A.getLocal(kt),A.i64_const(4294967295)),qt(I,z)))),U.addCode(A.setLocal(Bt,A.i64_add(A.getLocal(Bt),A.i64_shr_u(A.getLocal(kt),A.i64_const(32)))))}U.addCode(A.setLocal(kt,A.i64_shl(A.i64_and(A.getLocal(kt),A.i64_const(4294967295)),A.i64_const(1)))),U.addCode(A.setLocal(Bt,A.i64_add(A.i64_shl(A.getLocal(Bt),A.i64_const(1)),A.i64_shr_u(A.getLocal(kt),A.i64_const(32))))),Rt%2==0&&(U.addCode(A.setLocal(kt,A.i64_add(A.i64_and(A.getLocal(kt),A.i64_const(4294967295)),qt(Rt>>1,Rt>>1)))),U.addCode(A.setLocal(Bt,A.i64_add(A.getLocal(Bt),A.i64_shr_u(A.getLocal(kt),A.i64_const(32)))))),Rt>0&&(U.addCode(A.setLocal(kt,A.i64_add(A.i64_and(A.getLocal(kt),A.i64_const(4294967295)),A.i64_and(A.getLocal(Tt),A.i64_const(4294967295))))),U.addCode(A.setLocal(Bt,A.i64_add(A.i64_add(A.getLocal(Bt),A.i64_shr_u(A.getLocal(kt),A.i64_const(32))),A.getLocal(wt)))));for(let I=Math.max(1,Rt-f+1);I<=Rt&&I<f;I++){let z=Rt-I;U.addCode(A.setLocal(kt,A.i64_add(A.i64_and(A.getLocal(kt),A.i64_const(4294967295)),Dt(I,z)))),U.addCode(A.setLocal(Bt,A.i64_add(A.getLocal(Bt),A.i64_shr_u(A.getLocal(kt),A.i64_const(32)))))}Rt<f&&(U.addCode(A.setLocal(\"m\"+Rt,A.i64_and(A.i64_mul(A.i64_and(A.getLocal(kt),A.i64_const(4294967295)),A.getLocal(\"np32\")),A.i64_const(\"0xFFFFFFFF\")))),U.addCode(A.setLocal(kt,A.i64_add(A.i64_and(A.getLocal(kt),A.i64_const(4294967295)),Dt(0,Rt)))),U.addCode(A.setLocal(Bt,A.i64_add(A.getLocal(Bt),A.i64_shr_u(A.getLocal(kt),A.i64_const(32)))))),Rt>=f&&U.addCode(A.i64_store32(A.getLocal(\"r\"),(Rt-f)*4,A.getLocal(kt))),U.addCode(A.setLocal(Tt,A.getLocal(Bt)),A.setLocal(wt,A.i64_shr_u(A.getLocal(Tt),A.i64_const(32))))}U.addCode(A.i64_store32(A.getLocal(\"r\"),f*4-4,A.getLocal(Tt))),U.addCode(A.if(A.i32_wrap_i64(A.getLocal(wt)),A.drop(A.call(s+\"_sub\",A.getLocal(\"r\"),A.i32_const(x),A.getLocal(\"r\"))),A.if(A.call(s+\"_gte\",A.getLocal(\"r\"),A.i32_const(x)),A.drop(A.call(s+\"_sub\",A.getLocal(\"r\"),A.i32_const(x),A.getLocal(\"r\"))))))}function T(){let U=t.addFunction(l+\"_squareOld\");U.addParam(\"x\",\"i32\"),U.addParam(\"r\",\"i32\");let A=U.getCodeBuilder();U.addCode(A.call(l+\"_mul\",A.getLocal(\"x\"),A.getLocal(\"x\"),A.getLocal(\"r\")))}function V(){let U=t.addFunction(l+\"_toMontgomery\");U.addParam(\"x\",\"i32\"),U.addParam(\"r\",\"i32\");let A=U.getCodeBuilder();U.addCode(A.call(l+\"_mul\",A.getLocal(\"x\"),A.i32_const(g),A.getLocal(\"r\")))}function rt(){let U=t.alloc(L*2),A=t.addFunction(l+\"_fromMontgomery\");A.addParam(\"x\",\"i32\"),A.addParam(\"r\",\"i32\");let et=A.getCodeBuilder();A.addCode(et.call(s+\"_copy\",et.getLocal(\"x\"),et.i32_const(U))),A.addCode(et.call(s+\"_zero\",et.i32_const(U+L))),A.addCode(et.call(l+\"_mReduct\",et.i32_const(U),et.getLocal(\"r\")))}function dt(){let U=t.addFunction(l+\"_inverse\");U.addParam(\"x\",\"i32\"),U.addParam(\"r\",\"i32\");let A=U.getCodeBuilder();U.addCode(A.call(l+\"_fromMontgomery\",A.getLocal(\"x\"),A.getLocal(\"r\"))),U.addCode(A.call(s+\"_inverseMod\",A.getLocal(\"r\"),A.i32_const(x),A.getLocal(\"r\"))),U.addCode(A.call(l+\"_toMontgomery\",A.getLocal(\"r\"),A.getLocal(\"r\")))}let ot=Ne(2);if(d.isPrime())for(;!ot.modPow(S,d).equals(q);)ot=ot.add(Ne.one);let xt=t.alloc(pn.bigInt2BytesLE(ot.shiftLeft(h*64).mod(d),L)),pt=0,bt=q;for(;!bt.isOdd()&&!bt.isZero();)pt++,bt=bt.shiftRight(1);let vt=t.alloc(L,pn.bigInt2BytesLE(bt,L)),Pt=ot.modPow(bt,d),Ht=t.alloc(pn.bigInt2BytesLE(Pt.shiftLeft(h*64).mod(d),L)),m=bt.add(1).shiftRight(1),a=t.alloc(L,pn.bigInt2BytesLE(m,L));function w(){let U=t.addFunction(l+\"_sqrt\");U.addParam(\"n\",\"i32\"),U.addParam(\"r\",\"i32\"),U.addLocal(\"m\",\"i32\"),U.addLocal(\"i\",\"i32\"),U.addLocal(\"j\",\"i32\");let A=U.getCodeBuilder(),et=A.i32_const($),Lt=A.i32_const(t.alloc(L)),St=A.i32_const(t.alloc(L)),qt=A.i32_const(t.alloc(L)),Dt=A.i32_const(t.alloc(L)),kt=A.i32_const(t.alloc(L));U.addCode(A.if(A.call(l+\"_isZero\",A.getLocal(\"n\")),A.ret(A.call(l+\"_zero\",A.getLocal(\"r\")))),A.setLocal(\"m\",A.i32_const(pt)),A.call(l+\"_copy\",A.i32_const(Ht),Lt),A.call(l+\"_exp\",A.getLocal(\"n\"),A.i32_const(vt),A.i32_const(L),St),A.call(l+\"_exp\",A.getLocal(\"n\"),A.i32_const(a),A.i32_const(L),qt),A.block(A.loop(A.br_if(1,A.call(l+\"_eq\",St,et)),A.call(l+\"_square\",St,Dt),A.setLocal(\"i\",A.i32_const(1)),A.block(A.loop(A.br_if(1,A.call(l+\"_eq\",Dt,et)),A.call(l+\"_square\",Dt,Dt),A.setLocal(\"i\",A.i32_add(A.getLocal(\"i\"),A.i32_const(1))),A.br(0))),A.call(l+\"_copy\",Lt,kt),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(l+\"_square\",kt,kt),A.setLocal(\"j\",A.i32_sub(A.getLocal(\"j\"),A.i32_const(1))),A.br(0))),A.setLocal(\"m\",A.getLocal(\"i\")),A.call(l+\"_square\",kt,Lt),A.call(l+\"_mul\",St,Lt,St),A.call(l+\"_mul\",qt,kt,qt),A.br(0))),A.if(A.call(l+\"_isNegative\",qt),A.call(l+\"_neg\",qt,A.getLocal(\"r\")),A.call(l+\"_copy\",qt,A.getLocal(\"r\"))))}function c(){let U=t.addFunction(l+\"_isSquare\");U.addParam(\"n\",\"i32\"),U.setReturnType(\"i32\");let A=U.getCodeBuilder(),et=A.i32_const($),Lt=A.i32_const(t.alloc(L));U.addCode(A.if(A.call(l+\"_isZero\",A.getLocal(\"n\")),A.ret(A.i32_const(1))),A.call(l+\"_exp\",A.getLocal(\"n\"),A.i32_const(O),A.i32_const(L),Lt),A.call(l+\"_eq\",Lt,et))}function G(){let U=t.addFunction(l+\"_load\");U.addParam(\"scalar\",\"i32\"),U.addParam(\"scalarLen\",\"i32\"),U.addParam(\"r\",\"i32\"),U.addLocal(\"p\",\"i32\"),U.addLocal(\"l\",\"i32\"),U.addLocal(\"i\",\"i32\"),U.addLocal(\"j\",\"i32\");let A=U.getCodeBuilder(),et=A.i32_const(t.alloc(L)),Lt=t.alloc(L),St=A.i32_const(Lt);U.addCode(A.call(s+\"_zero\",A.getLocal(\"r\")),A.setLocal(\"i\",A.i32_const(L)),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(L)),A.call(l+\"_one\",et),A.call(l+\"_mul\",et,A.i32_const(g),et)),A.call(l+\"_mul\",A.getLocal(\"p\"),et,St),A.call(l+\"_add\",A.getLocal(\"r\"),St,A.getLocal(\"r\")),A.setLocal(\"p\",A.i32_add(A.getLocal(\"p\"),A.i32_const(L))),A.setLocal(\"i\",A.i32_add(A.getLocal(\"i\"),A.i32_const(L))),A.br(0))),A.setLocal(\"l\",A.i32_rem_u(A.getLocal(\"scalarLen\"),A.i32_const(L))),A.if(A.i32_eqz(A.getLocal(\"l\")),A.ret([])),A.call(s+\"_zero\",St),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\"),Lt,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(L)),A.call(l+\"_one\",et),A.call(l+\"_mul\",et,A.i32_const(g),et)),A.call(l+\"_mul\",St,et,St),A.call(l+\"_add\",A.getLocal(\"r\"),St,A.getLocal(\"r\")))}function R(){let U=t.addFunction(l+\"_timesScalar\");U.addParam(\"x\",\"i32\"),U.addParam(\"scalar\",\"i32\"),U.addParam(\"scalarLen\",\"i32\"),U.addParam(\"r\",\"i32\");let A=U.getCodeBuilder(),et=A.i32_const(t.alloc(L));U.addCode(A.call(l+\"_load\",A.getLocal(\"scalar\"),A.getLocal(\"scalarLen\"),et),A.call(l+\"_toMontgomery\",et,et),A.call(l+\"_mul\",A.getLocal(\"x\"),et,A.getLocal(\"r\")))}function F(){let U=t.addFunction(l+\"_isOne\");U.addParam(\"x\",\"i32\"),U.setReturnType(\"i32\");let A=U.getCodeBuilder();U.addCode(A.ret(A.call(s+\"_eq\",A.getLocal(\"x\"),A.i32_const($))))}return t.exportFunction(s+\"_copy\",l+\"_copy\"),t.exportFunction(s+\"_zero\",l+\"_zero\"),t.exportFunction(s+\"_isZero\",l+\"_isZero\"),t.exportFunction(s+\"_eq\",l+\"_eq\"),F(),E(),_(),r(),nt(),v(),y(),T(),V(),rt(),Z(),j(),dt(),ct(),G(),R(),P0(t,l),oc(t,l+\"_batchToMontgomery\",l+\"_toMontgomery\",L,L),oc(t,l+\"_batchFromMontgomery\",l+\"_fromMontgomery\",L,L),oc(t,l+\"_batchNeg\",l+\"_neg\",L,L),sc(t,l+\"_batchAdd\",l+\"_add\",L,L),sc(t,l+\"_batchSub\",l+\"_sub\",L,L),sc(t,l+\"_batchMul\",l+\"_mul\",L,L),t.exportFunction(l+\"_add\"),t.exportFunction(l+\"_sub\"),t.exportFunction(l+\"_neg\"),t.exportFunction(l+\"_isNegative\"),t.exportFunction(l+\"_isOne\"),t.exportFunction(l+\"_sign\"),t.exportFunction(l+\"_mReduct\"),t.exportFunction(l+\"_mul\"),t.exportFunction(l+\"_square\"),t.exportFunction(l+\"_squareOld\"),t.exportFunction(l+\"_fromMontgomery\"),t.exportFunction(l+\"_toMontgomery\"),t.exportFunction(l+\"_inverse\"),t.exportFunction(l+\"_one\"),t.exportFunction(l+\"_load\"),t.exportFunction(l+\"_timesScalar\"),O0(t,l+\"_exp\",L,l+\"_mul\",l+\"_square\",s+\"_copy\",l+\"_one\"),t.exportFunction(l+\"_exp\"),t.exportFunction(l+\"_batchInverse\"),d.isPrime()&&(w(),c(),t.exportFunction(l+\"_sqrt\"),t.exportFunction(l+\"_isSquare\")),t.exportFunction(l+\"_batchToMontgomery\"),t.exportFunction(l+\"_batchFromMontgomery\"),l}});var cc=Yt((_8,Md)=>{var z0=Ve(),M0=Io();Md.exports=function(t,e,n,o,d){let h=z0(e),f=Math.floor((h.minus(1).bitLength()-1)/64)+1,L=f*8,l=n||\"f1\";if(t.modules[l])return l;t.modules[l]={n64:f};let s=d||\"int\",x=M0(t,h,o,s),C=t.modules[x].pR2,g=t.modules[x].pq,$=t.modules[x].pePlusOne;function it(){let M=t.alloc(L),W=t.addFunction(l+\"_mul\");W.addParam(\"x\",\"i32\"),W.addParam(\"y\",\"i32\"),W.addParam(\"r\",\"i32\");let ct=W.getCodeBuilder();W.addCode(ct.call(x+\"_mul\",ct.getLocal(\"x\"),ct.getLocal(\"y\"),ct.i32_const(M))),W.addCode(ct.call(x+\"_mul\",ct.i32_const(M),ct.i32_const(C),ct.getLocal(\"r\")))}function q(){let M=t.addFunction(l+\"_square\");M.addParam(\"x\",\"i32\"),M.addParam(\"r\",\"i32\");let W=M.getCodeBuilder();M.addCode(W.call(l+\"_mul\",W.getLocal(\"x\"),W.getLocal(\"x\"),W.getLocal(\"r\")))}function S(){let M=t.addFunction(l+\"_inverse\");M.addParam(\"x\",\"i32\"),M.addParam(\"r\",\"i32\");let W=M.getCodeBuilder();M.addCode(W.call(s+\"_inverseMod\",W.getLocal(\"x\"),W.i32_const(g),W.getLocal(\"r\")))}function O(){let M=t.addFunction(l+\"_isNegative\");M.addParam(\"x\",\"i32\"),M.setReturnType(\"i32\");let W=M.getCodeBuilder();M.addCode(W.call(s+\"_gte\",W.getLocal(\"x\"),W.i32_const($)))}return it(),q(),S(),O(),t.exportFunction(x+\"_add\",l+\"_add\"),t.exportFunction(x+\"_sub\",l+\"_sub\"),t.exportFunction(x+\"_neg\",l+\"_neg\"),t.exportFunction(l+\"_mul\"),t.exportFunction(l+\"_square\"),t.exportFunction(l+\"_inverse\"),t.exportFunction(l+\"_isNegative\"),t.exportFunction(x+\"_copy\",l+\"_copy\"),t.exportFunction(x+\"_zero\",l+\"_zero\"),t.exportFunction(x+\"_one\",l+\"_one\"),t.exportFunction(x+\"_isZero\",l+\"_isZero\"),t.exportFunction(x+\"_eq\",l+\"_eq\"),l}});var lc=Yt((h8,Gd)=>{var G0=Co(),T0=xo(),zi=Ve(),rc=ri();Gd.exports=function(t,e,n,o){if(t.modules[n])return n;let d=t.modules[o].n64*8,h=t.modules[o].q;t.modules[n]={n64:t.modules[o].n64*2};function f(){let v=t.addFunction(n+\"_add\");v.addParam(\"x\",\"i32\"),v.addParam(\"y\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"y\"),dt=y.i32_add(y.getLocal(\"y\"),y.i32_const(d)),ot=y.getLocal(\"r\"),xt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d));v.addCode(y.call(o+\"_add\",T,rt,ot),y.call(o+\"_add\",V,dt,xt))}function L(){let v=t.addFunction(n+\"_timesScalar\");v.addParam(\"x\",\"i32\"),v.addParam(\"scalar\",\"i32\"),v.addParam(\"scalarLen\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"r\"),dt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d));v.addCode(y.call(o+\"_timesScalar\",T,y.getLocal(\"scalar\"),y.getLocal(\"scalarLen\"),rt),y.call(o+\"_timesScalar\",V,y.getLocal(\"scalar\"),y.getLocal(\"scalarLen\"),dt))}function l(){let v=t.addFunction(n+\"_sub\");v.addParam(\"x\",\"i32\"),v.addParam(\"y\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"y\"),dt=y.i32_add(y.getLocal(\"y\"),y.i32_const(d)),ot=y.getLocal(\"r\"),xt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d));v.addCode(y.call(o+\"_sub\",T,rt,ot),y.call(o+\"_sub\",V,dt,xt))}function s(){let v=t.addFunction(n+\"_neg\");v.addParam(\"x\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"r\"),dt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d));v.addCode(y.call(o+\"_neg\",T,rt),y.call(o+\"_neg\",V,dt))}function x(){let v=t.addFunction(n+\"_conjugate\");v.addParam(\"x\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"r\"),dt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d));v.addCode(y.call(o+\"_copy\",T,rt),y.call(o+\"_neg\",V,dt))}function C(){let v=t.addFunction(n+\"_isNegative\");v.addParam(\"x\",\"i32\"),v.setReturnType(\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d));v.addCode(y.if(y.call(o+\"_isZero\",V),y.ret(y.call(o+\"_isNegative\",T))),y.ret(y.call(o+\"_isNegative\",V)))}function g(){let v=t.addFunction(n+\"_mul\");v.addParam(\"x\",\"i32\"),v.addParam(\"y\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"y\"),dt=y.i32_add(y.getLocal(\"y\"),y.i32_const(d)),ot=y.getLocal(\"r\"),xt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d)),pt=y.i32_const(t.alloc(d)),bt=y.i32_const(t.alloc(d)),vt=y.i32_const(t.alloc(d)),Pt=y.i32_const(t.alloc(d));v.addCode(y.call(o+\"_mul\",T,rt,pt),y.call(o+\"_mul\",V,dt,bt),y.call(o+\"_add\",T,V,vt),y.call(o+\"_add\",rt,dt,Pt),y.call(o+\"_mul\",vt,Pt,vt),y.call(e,bt,ot),y.call(o+\"_add\",pt,ot,ot),y.call(o+\"_add\",pt,bt,xt),y.call(o+\"_sub\",vt,xt,xt))}function $(){let v=t.addFunction(n+\"_mul1\");v.addParam(\"x\",\"i32\"),v.addParam(\"y\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"y\"),dt=y.getLocal(\"r\"),ot=y.i32_add(y.getLocal(\"r\"),y.i32_const(d));v.addCode(y.call(o+\"_mul\",T,rt,dt),y.call(o+\"_mul\",V,rt,ot))}function it(){let v=t.addFunction(n+\"_square\");v.addParam(\"x\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"r\"),dt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d)),ot=y.i32_const(t.alloc(d)),xt=y.i32_const(t.alloc(d)),pt=y.i32_const(t.alloc(d)),bt=y.i32_const(t.alloc(d));v.addCode(y.call(o+\"_mul\",T,V,ot),y.call(o+\"_add\",T,V,xt),y.call(e,V,pt),y.call(o+\"_add\",T,pt,pt),y.call(e,ot,bt),y.call(o+\"_add\",bt,ot,bt),y.call(o+\"_mul\",xt,pt,rt),y.call(o+\"_sub\",rt,bt,rt),y.call(o+\"_add\",ot,ot,dt))}function q(){let v=t.addFunction(n+\"_toMontgomery\");v.addParam(\"x\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"r\"),dt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d));v.addCode(y.call(o+\"_toMontgomery\",T,rt),y.call(o+\"_toMontgomery\",V,dt))}function S(){let v=t.addFunction(n+\"_fromMontgomery\");v.addParam(\"x\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"r\"),dt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d));v.addCode(y.call(o+\"_fromMontgomery\",T,rt),y.call(o+\"_fromMontgomery\",V,dt))}function O(){let v=t.addFunction(n+\"_copy\");v.addParam(\"x\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"r\"),dt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d));v.addCode(y.call(o+\"_copy\",T,rt),y.call(o+\"_copy\",V,dt))}function M(){let v=t.addFunction(n+\"_zero\");v.addParam(\"x\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d));v.addCode(y.call(o+\"_zero\",T),y.call(o+\"_zero\",V))}function W(){let v=t.addFunction(n+\"_one\");v.addParam(\"x\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d));v.addCode(y.call(o+\"_one\",T),y.call(o+\"_zero\",V))}function ct(){let v=t.addFunction(n+\"_eq\");v.addParam(\"x\",\"i32\"),v.addParam(\"y\",\"i32\"),v.setReturnType(\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"y\"),dt=y.i32_add(y.getLocal(\"y\"),y.i32_const(d));v.addCode(y.i32_and(y.call(o+\"_eq\",T,rt),y.call(o+\"_eq\",V,dt)))}function E(){let v=t.addFunction(n+\"_isZero\");v.addParam(\"x\",\"i32\"),v.setReturnType(\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d));v.addCode(y.i32_and(y.call(o+\"_isZero\",T),y.call(o+\"_isZero\",V)))}function _(){let v=t.addFunction(n+\"_inverse\");v.addParam(\"x\",\"i32\"),v.addParam(\"r\",\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d)),rt=y.getLocal(\"r\"),dt=y.i32_add(y.getLocal(\"r\"),y.i32_const(d)),ot=y.i32_const(t.alloc(d)),xt=y.i32_const(t.alloc(d)),pt=y.i32_const(t.alloc(d)),bt=y.i32_const(t.alloc(d));v.addCode(y.call(o+\"_square\",T,ot),y.call(o+\"_square\",V,xt),y.call(e,xt,pt),y.call(o+\"_sub\",ot,pt,pt),y.call(o+\"_inverse\",pt,bt),y.call(o+\"_mul\",T,bt,rt),y.call(o+\"_mul\",V,bt,dt),y.call(o+\"_neg\",dt,dt))}function r(){let v=t.addFunction(n+\"_sign\");v.addParam(\"x\",\"i32\"),v.addLocal(\"s\",\"i32\"),v.setReturnType(\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d));v.addCode(y.setLocal(\"s\",y.call(o+\"_sign\",V)),y.if(y.getLocal(\"s\"),y.ret(y.getLocal(\"s\"))),y.ret(y.call(o+\"_sign\",T)))}function Z(){let v=t.addFunction(n+\"_isOne\");v.addParam(\"x\",\"i32\"),v.setReturnType(\"i32\");let y=v.getCodeBuilder(),T=y.getLocal(\"x\"),V=y.i32_add(y.getLocal(\"x\"),y.i32_const(d));v.addCode(y.ret(y.i32_and(y.call(o+\"_isOne\",T),y.call(o+\"_isZero\",V))))}function j(){let v=t.addFunction(n+\"_sqrt\");v.addParam(\"a\",\"i32\"),v.addParam(\"pr\",\"i32\");let y=v.getCodeBuilder(),T=y.i32_const(t.alloc(rc.bigInt2BytesLE(zi(h).minus(zi(3)).divide(4),d))),V=y.i32_const(t.alloc(rc.bigInt2BytesLE(zi(h).minus(zi(1)).divide(2),d))),rt=y.getLocal(\"a\"),dt=y.i32_const(t.alloc(d*2)),ot=y.i32_const(t.alloc(d*2)),xt=y.i32_const(t.alloc(d*2)),pt=t.alloc(d*2),bt=y.i32_const(pt),vt=y.i32_const(pt),Pt=y.i32_const(pt+d),Ht=y.i32_const(t.alloc(d*2)),m=y.i32_const(t.alloc(d*2));v.addCode(y.call(n+\"_one\",bt),y.call(n+\"_neg\",bt,bt),y.call(n+\"_exp\",rt,T,y.i32_const(d),dt),y.call(n+\"_square\",dt,ot),y.call(n+\"_mul\",rt,ot,ot),y.call(n+\"_conjugate\",ot,xt),y.call(n+\"_mul\",xt,ot,xt),y.if(y.call(n+\"_eq\",xt,bt),y.unreachable()),y.call(n+\"_mul\",dt,rt,Ht),y.if(y.call(n+\"_eq\",ot,bt),[...y.call(o+\"_zero\",vt),...y.call(o+\"_one\",Pt),...y.call(n+\"_mul\",bt,Ht,y.getLocal(\"pr\"))],[...y.call(n+\"_one\",m),...y.call(n+\"_add\",m,ot,m),...y.call(n+\"_exp\",m,V,y.i32_const(d),m),...y.call(n+\"_mul\",m,Ht,y.getLocal(\"pr\"))]))}function nt(){let v=t.addFunction(n+\"_isSquare\");v.addParam(\"a\",\"i32\"),v.setReturnType(\"i32\");let y=v.getCodeBuilder(),T=y.i32_const(t.alloc(rc.bigInt2BytesLE(zi(h).minus(zi(3)).divide(4),d))),V=y.getLocal(\"a\"),rt=y.i32_const(t.alloc(d*2)),dt=y.i32_const(t.alloc(d*2)),ot=y.i32_const(t.alloc(d*2)),xt=t.alloc(d*2),pt=y.i32_const(xt);v.addCode(y.call(n+\"_one\",pt),y.call(n+\"_neg\",pt,pt),y.call(n+\"_exp\",V,T,y.i32_const(d),rt),y.call(n+\"_square\",rt,dt),y.call(n+\"_mul\",V,dt,dt),y.call(n+\"_conjugate\",dt,ot),y.call(n+\"_mul\",ot,dt,ot),y.if(y.call(n+\"_eq\",ot,pt),y.ret(y.i32_const(0))),y.ret(y.i32_const(1)))}return E(),Z(),M(),W(),O(),g(),$(),it(),f(),l(),s(),x(),q(),S(),ct(),_(),L(),r(),C(),t.exportFunction(n+\"_isZero\"),t.exportFunction(n+\"_isOne\"),t.exportFunction(n+\"_zero\"),t.exportFunction(n+\"_one\"),t.exportFunction(n+\"_copy\"),t.exportFunction(n+\"_mul\"),t.exportFunction(n+\"_mul1\"),t.exportFunction(n+\"_square\"),t.exportFunction(n+\"_add\"),t.exportFunction(n+\"_sub\"),t.exportFunction(n+\"_neg\"),t.exportFunction(n+\"_sign\"),t.exportFunction(n+\"_conjugate\"),t.exportFunction(n+\"_fromMontgomery\"),t.exportFunction(n+\"_toMontgomery\"),t.exportFunction(n+\"_eq\"),t.exportFunction(n+\"_inverse\"),T0(t,n),G0(t,n+\"_exp\",d*2,n+\"_mul\",n+\"_square\",n+\"_copy\",n+\"_one\"),j(),nt(),t.exportFunction(n+\"_exp\"),t.exportFunction(n+\"_timesScalar\"),t.exportFunction(n+\"_batchInverse\"),t.exportFunction(n+\"_sqrt\"),t.exportFunction(n+\"_isSquare\"),t.exportFunction(n+\"_isNegative\"),n}});var dc=Yt((g8,Td)=>{var k0=Co(),N0=xo();Td.exports=function(t,e,n,o){if(t.modules[n])return n;let d=t.modules[o].n64*8;t.modules[n]={n64:t.modules[o].n64*3};function h(){let _=t.addFunction(n+\"_add\");_.addParam(\"x\",\"i32\"),_.addParam(\"y\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"y\"),y=r.i32_add(r.getLocal(\"y\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"y\"),r.i32_const(2*d)),V=r.getLocal(\"r\"),rt=r.i32_add(r.getLocal(\"r\"),r.i32_const(d)),dt=r.i32_add(r.getLocal(\"r\"),r.i32_const(2*d));_.addCode(r.call(o+\"_add\",Z,v,V),r.call(o+\"_add\",j,y,rt),r.call(o+\"_add\",nt,T,dt))}function f(){let _=t.addFunction(n+\"_timesScalar\");_.addParam(\"x\",\"i32\"),_.addParam(\"scalar\",\"i32\"),_.addParam(\"scalarLen\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"r\"),y=r.i32_add(r.getLocal(\"r\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"r\"),r.i32_const(2*d));_.addCode(r.call(o+\"_timesScalar\",Z,r.getLocal(\"scalar\"),r.getLocal(\"scalarLen\"),v),r.call(o+\"_timesScalar\",j,r.getLocal(\"scalar\"),r.getLocal(\"scalarLen\"),y),r.call(o+\"_timesScalar\",nt,r.getLocal(\"scalar\"),r.getLocal(\"scalarLen\"),T))}function L(){let _=t.addFunction(n+\"_sub\");_.addParam(\"x\",\"i32\"),_.addParam(\"y\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"y\"),y=r.i32_add(r.getLocal(\"y\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"y\"),r.i32_const(2*d)),V=r.getLocal(\"r\"),rt=r.i32_add(r.getLocal(\"r\"),r.i32_const(d)),dt=r.i32_add(r.getLocal(\"r\"),r.i32_const(2*d));_.addCode(r.call(o+\"_sub\",Z,v,V),r.call(o+\"_sub\",j,y,rt),r.call(o+\"_sub\",nt,T,dt))}function l(){let _=t.addFunction(n+\"_neg\");_.addParam(\"x\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"r\"),y=r.i32_add(r.getLocal(\"r\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"r\"),r.i32_const(2*d));_.addCode(r.call(o+\"_neg\",Z,v),r.call(o+\"_neg\",j,y),r.call(o+\"_neg\",nt,T))}function s(){let _=t.addFunction(n+\"_isNegative\");_.addParam(\"x\",\"i32\"),_.setReturnType(\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d));_.addCode(r.if(r.call(o+\"_isZero\",nt),r.if(r.call(o+\"_isZero\",j),r.ret(r.call(o+\"_isNegative\",Z)),r.ret(r.call(o+\"_isNegative\",j)))),r.ret(r.call(o+\"_isNegative\",nt)))}function x(){let _=t.addFunction(n+\"_mul\");_.addParam(\"x\",\"i32\"),_.addParam(\"y\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"y\"),y=r.i32_add(r.getLocal(\"y\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"y\"),r.i32_const(2*d)),V=r.getLocal(\"r\"),rt=r.i32_add(r.getLocal(\"r\"),r.i32_const(d)),dt=r.i32_add(r.getLocal(\"r\"),r.i32_const(2*d)),ot=r.i32_const(t.alloc(d)),xt=r.i32_const(t.alloc(d)),pt=r.i32_const(t.alloc(d)),bt=r.i32_const(t.alloc(d)),vt=r.i32_const(t.alloc(d)),Pt=r.i32_const(t.alloc(d)),Ht=r.i32_const(t.alloc(d)),m=r.i32_const(t.alloc(d)),a=r.i32_const(t.alloc(d)),w=r.i32_const(t.alloc(d)),c=r.i32_const(t.alloc(d)),G=r.i32_const(t.alloc(d)),R=r.i32_const(t.alloc(d));_.addCode(r.call(o+\"_mul\",Z,v,ot),r.call(o+\"_mul\",j,y,xt),r.call(o+\"_mul\",nt,T,pt),r.call(o+\"_add\",Z,j,bt),r.call(o+\"_add\",v,y,vt),r.call(o+\"_add\",Z,nt,Pt),r.call(o+\"_add\",v,T,Ht),r.call(o+\"_add\",j,nt,m),r.call(o+\"_add\",y,T,a),r.call(o+\"_add\",ot,xt,w),r.call(o+\"_add\",ot,pt,c),r.call(o+\"_add\",xt,pt,G),r.call(o+\"_mul\",m,a,V),r.call(o+\"_sub\",V,G,V),r.call(e,V,V),r.call(o+\"_add\",ot,V,V),r.call(o+\"_mul\",bt,vt,rt),r.call(o+\"_sub\",rt,w,rt),r.call(e,pt,R),r.call(o+\"_add\",rt,R,rt),r.call(o+\"_mul\",Pt,Ht,dt),r.call(o+\"_sub\",dt,c,dt),r.call(o+\"_add\",dt,xt,dt))}function C(){let _=t.addFunction(n+\"_square\");_.addParam(\"x\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"r\"),y=r.i32_add(r.getLocal(\"r\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"r\"),r.i32_const(2*d)),V=r.i32_const(t.alloc(d)),rt=r.i32_const(t.alloc(d)),dt=r.i32_const(t.alloc(d)),ot=r.i32_const(t.alloc(d)),xt=r.i32_const(t.alloc(d)),pt=r.i32_const(t.alloc(d)),bt=r.i32_const(t.alloc(d));_.addCode(r.call(o+\"_square\",Z,V),r.call(o+\"_mul\",Z,j,rt),r.call(o+\"_add\",rt,rt,dt),r.call(o+\"_sub\",Z,j,ot),r.call(o+\"_add\",ot,nt,ot),r.call(o+\"_square\",ot,ot),r.call(o+\"_mul\",j,nt,xt),r.call(o+\"_add\",xt,xt,pt),r.call(o+\"_square\",nt,bt),r.call(e,pt,v),r.call(o+\"_add\",V,v,v),r.call(e,bt,y),r.call(o+\"_add\",dt,y,y),r.call(o+\"_add\",V,bt,T),r.call(o+\"_sub\",pt,T,T),r.call(o+\"_add\",ot,T,T),r.call(o+\"_add\",dt,T,T))}function g(){let _=t.addFunction(n+\"_toMontgomery\");_.addParam(\"x\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"r\"),y=r.i32_add(r.getLocal(\"r\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"r\"),r.i32_const(2*d));_.addCode(r.call(o+\"_toMontgomery\",Z,v),r.call(o+\"_toMontgomery\",j,y),r.call(o+\"_toMontgomery\",nt,T))}function $(){let _=t.addFunction(n+\"_fromMontgomery\");_.addParam(\"x\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"r\"),y=r.i32_add(r.getLocal(\"r\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"r\"),r.i32_const(2*d));_.addCode(r.call(o+\"_fromMontgomery\",Z,v),r.call(o+\"_fromMontgomery\",j,y),r.call(o+\"_fromMontgomery\",nt,T))}function it(){let _=t.addFunction(n+\"_copy\");_.addParam(\"x\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"r\"),y=r.i32_add(r.getLocal(\"r\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"r\"),r.i32_const(2*d));_.addCode(r.call(o+\"_copy\",Z,v),r.call(o+\"_copy\",j,y),r.call(o+\"_copy\",nt,T))}function q(){let _=t.addFunction(n+\"_zero\");_.addParam(\"x\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d));_.addCode(r.call(o+\"_zero\",Z),r.call(o+\"_zero\",j),r.call(o+\"_zero\",nt))}function S(){let _=t.addFunction(n+\"_one\");_.addParam(\"x\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d));_.addCode(r.call(o+\"_one\",Z),r.call(o+\"_zero\",j),r.call(o+\"_zero\",nt))}function O(){let _=t.addFunction(n+\"_eq\");_.addParam(\"x\",\"i32\"),_.addParam(\"y\",\"i32\"),_.setReturnType(\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"y\"),y=r.i32_add(r.getLocal(\"y\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"y\"),r.i32_const(2*d));_.addCode(r.i32_and(r.i32_and(r.call(o+\"_eq\",Z,v),r.call(o+\"_eq\",j,y)),r.call(o+\"_eq\",nt,T)))}function M(){let _=t.addFunction(n+\"_isZero\");_.addParam(\"x\",\"i32\"),_.setReturnType(\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d));_.addCode(r.i32_and(r.i32_and(r.call(o+\"_isZero\",Z),r.call(o+\"_isZero\",j)),r.call(o+\"_isZero\",nt)))}function W(){let _=t.addFunction(n+\"_inverse\");_.addParam(\"x\",\"i32\"),_.addParam(\"r\",\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d)),v=r.getLocal(\"r\"),y=r.i32_add(r.getLocal(\"r\"),r.i32_const(d)),T=r.i32_add(r.getLocal(\"r\"),r.i32_const(2*d)),V=r.i32_const(t.alloc(d)),rt=r.i32_const(t.alloc(d)),dt=r.i32_const(t.alloc(d)),ot=r.i32_const(t.alloc(d)),xt=r.i32_const(t.alloc(d)),pt=r.i32_const(t.alloc(d)),bt=r.i32_const(t.alloc(d)),vt=r.i32_const(t.alloc(d)),Pt=r.i32_const(t.alloc(d)),Ht=r.i32_const(t.alloc(d)),m=r.i32_const(t.alloc(d));_.addCode(r.call(o+\"_square\",Z,V),r.call(o+\"_square\",j,rt),r.call(o+\"_square\",nt,dt),r.call(o+\"_mul\",Z,j,ot),r.call(o+\"_mul\",Z,nt,xt),r.call(o+\"_mul\",j,nt,pt),r.call(e,pt,bt),r.call(o+\"_sub\",V,bt,bt),r.call(e,dt,vt),r.call(o+\"_sub\",vt,ot,vt),r.call(o+\"_sub\",rt,xt,Pt),r.call(o+\"_mul\",nt,vt,Ht),r.call(o+\"_mul\",j,Pt,m),r.call(o+\"_add\",Ht,m,Ht),r.call(e,Ht,Ht),r.call(o+\"_mul\",Z,bt,m),r.call(o+\"_add\",m,Ht,Ht),r.call(o+\"_inverse\",Ht,Ht),r.call(o+\"_mul\",Ht,bt,v),r.call(o+\"_mul\",Ht,vt,y),r.call(o+\"_mul\",Ht,Pt,T))}function ct(){let _=t.addFunction(n+\"_sign\");_.addParam(\"x\",\"i32\"),_.addLocal(\"s\",\"i32\"),_.setReturnType(\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(2*d));_.addCode(r.setLocal(\"s\",r.call(o+\"_sign\",nt)),r.if(r.getLocal(\"s\"),r.ret(r.getLocal(\"s\"))),r.setLocal(\"s\",r.call(o+\"_sign\",j)),r.if(r.getLocal(\"s\"),r.ret(r.getLocal(\"s\"))),r.ret(r.call(o+\"_sign\",Z)))}function E(){let _=t.addFunction(n+\"_isOne\");_.addParam(\"x\",\"i32\"),_.setReturnType(\"i32\");let r=_.getCodeBuilder(),Z=r.getLocal(\"x\"),j=r.i32_add(r.getLocal(\"x\"),r.i32_const(d)),nt=r.i32_add(r.getLocal(\"x\"),r.i32_const(d*2));_.addCode(r.ret(r.i32_and(r.i32_and(r.call(o+\"_isOne\",Z),r.call(o+\"_isZero\",j)),r.call(o+\"_isZero\",nt))))}return M(),E(),q(),S(),it(),x(),C(),h(),L(),l(),ct(),g(),$(),O(),W(),f(),s(),t.exportFunction(n+\"_isZero\"),t.exportFunction(n+\"_isOne\"),t.exportFunction(n+\"_zero\"),t.exportFunction(n+\"_one\"),t.exportFunction(n+\"_copy\"),t.exportFunction(n+\"_mul\"),t.exportFunction(n+\"_square\"),t.exportFunction(n+\"_add\"),t.exportFunction(n+\"_sub\"),t.exportFunction(n+\"_neg\"),t.exportFunction(n+\"_sign\"),t.exportFunction(n+\"_fromMontgomery\"),t.exportFunction(n+\"_toMontgomery\"),t.exportFunction(n+\"_eq\"),t.exportFunction(n+\"_inverse\"),N0(t,n),k0(t,n+\"_exp\",d*3,n+\"_mul\",n+\"_square\",n+\"_copy\",n+\"_one\"),t.exportFunction(n+\"_exp\"),t.exportFunction(n+\"_timesScalar\"),t.exportFunction(n+\"_batchInverse\"),t.exportFunction(n+\"_isNegative\"),n}});var Nd=Yt((p8,kd)=>{kd.exports=function(t,e,n,o,d,h,f,L){let l=t.addFunction(e);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\");let s=l.getCodeBuilder(),x=s.i32_const(t.alloc(n));function C($){return s.i32_and(s.i32_shr_u(s.i32_load(s.i32_add(s.getLocal(\"scalar\"),s.i32_and(s.i32_shr_u($,s.i32_const(3)),s.i32_const(4294967292)))),s.i32_and($,s.i32_const(31))),s.i32_const(1))}function g($){return[...s.i32_store8(s.getLocal(\"p\"),s.i32_const($)),...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(L,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\",C(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\",C(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)),...g(1)],[...s.setLocal(\"last\",s.i32_const(0)),...s.setLocal(\"carry\",s.i32_const(1)),...g(255)]),s.if(s.getLocal(\"carry\"),[...s.setLocal(\"last\",s.i32_const(0)),...s.setLocal(\"carry\",s.i32_const(1)),...g(255)],[...s.setLocal(\"last\",s.i32_const(0)),...s.setLocal(\"carry\",s.i32_const(0)),...g(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)),...g(0)],[...s.setLocal(\"last\",s.i32_const(1)),...s.setLocal(\"carry\",s.i32_const(0)),...g(0)]),s.if(s.getLocal(\"carry\"),[...s.setLocal(\"last\",s.i32_const(1)),...s.setLocal(\"carry\",s.i32_const(0)),...g(0)],[...s.setLocal(\"last\",s.i32_const(0)),...s.setLocal(\"carry\",s.i32_const(0)),...g(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\"),[...g(255),...g(0),...g(1)],[...g(1)]),s.if(s.getLocal(\"carry\"),[...g(0),...g(1)])),s.setLocal(\"p\",s.i32_sub(s.getLocal(\"p\"),s.i32_const(1))),s.call(f,s.getLocal(\"base\"),x),s.call(L,s.getLocal(\"r\")),s.block(s.loop(s.call(d,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(o,s.getLocal(\"r\"),x,s.getLocal(\"r\")),s.call(h,s.getLocal(\"r\"),x,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\")))}});var Dd=Yt((L8,Qd)=>{Qd.exports=function(t,e,n,o,d){let f=t.modules[e].n64*8;function L(){let C=t.addFunction(n+\"_getChunk\");C.addParam(\"pScalar\",\"i32\"),C.addParam(\"scalarSize\",\"i32\"),C.addParam(\"startBit\",\"i32\"),C.addParam(\"chunkSize\",\"i32\"),C.addLocal(\"bitsToEnd\",\"i32\"),C.addLocal(\"mask\",\"i32\"),C.setReturnType(\"i32\");let g=C.getCodeBuilder();C.addCode(g.setLocal(\"bitsToEnd\",g.i32_sub(g.i32_mul(g.getLocal(\"scalarSize\"),g.i32_const(8)),g.getLocal(\"startBit\"))),g.if(g.i32_gt_s(g.getLocal(\"chunkSize\"),g.getLocal(\"bitsToEnd\")),g.setLocal(\"mask\",g.i32_sub(g.i32_shl(g.i32_const(1),g.getLocal(\"bitsToEnd\")),g.i32_const(1))),g.setLocal(\"mask\",g.i32_sub(g.i32_shl(g.i32_const(1),g.getLocal(\"chunkSize\")),g.i32_const(1)))),g.i32_and(g.i32_shr_u(g.i32_load(g.i32_add(g.getLocal(\"pScalar\"),g.i32_shr_u(g.getLocal(\"startBit\"),g.i32_const(3))),0,0),g.i32_and(g.getLocal(\"startBit\"),g.i32_const(7))),g.getLocal(\"mask\")))}function l(){let C=t.addFunction(n+\"_chunk\");C.addParam(\"pBases\",\"i32\"),C.addParam(\"pScalars\",\"i32\"),C.addParam(\"scalarSize\",\"i32\"),C.addParam(\"n\",\"i32\"),C.addParam(\"startBit\",\"i32\"),C.addParam(\"chunkSize\",\"i32\"),C.addParam(\"pr\",\"i32\"),C.addLocal(\"nChunks\",\"i32\"),C.addLocal(\"itScalar\",\"i32\"),C.addLocal(\"endScalar\",\"i32\"),C.addLocal(\"itBase\",\"i32\"),C.addLocal(\"i\",\"i32\"),C.addLocal(\"j\",\"i32\"),C.addLocal(\"nTable\",\"i32\"),C.addLocal(\"pTable\",\"i32\"),C.addLocal(\"idx\",\"i32\"),C.addLocal(\"pIdxTable\",\"i32\");let g=C.getCodeBuilder();C.addCode(g.if(g.i32_eqz(g.getLocal(\"n\")),[...g.call(e+\"_zero\",g.getLocal(\"pr\")),...g.ret([])]),g.setLocal(\"nTable\",g.i32_shl(g.i32_const(1),g.getLocal(\"chunkSize\"))),g.setLocal(\"pTable\",g.i32_load(g.i32_const(0))),g.i32_store(g.i32_const(0),g.i32_add(g.getLocal(\"pTable\"),g.i32_mul(g.getLocal(\"nTable\"),g.i32_const(f)))),g.setLocal(\"j\",g.i32_const(0)),g.block(g.loop(g.br_if(1,g.i32_eq(g.getLocal(\"j\"),g.getLocal(\"nTable\"))),g.call(e+\"_zero\",g.i32_add(g.getLocal(\"pTable\"),g.i32_mul(g.getLocal(\"j\"),g.i32_const(f)))),g.setLocal(\"j\",g.i32_add(g.getLocal(\"j\"),g.i32_const(1))),g.br(0))),g.setLocal(\"itBase\",g.getLocal(\"pBases\")),g.setLocal(\"itScalar\",g.getLocal(\"pScalars\")),g.setLocal(\"endScalar\",g.i32_add(g.getLocal(\"pScalars\"),g.i32_mul(g.getLocal(\"n\"),g.getLocal(\"scalarSize\")))),g.block(g.loop(g.br_if(1,g.i32_eq(g.getLocal(\"itScalar\"),g.getLocal(\"endScalar\"))),g.setLocal(\"idx\",g.call(n+\"_getChunk\",g.getLocal(\"itScalar\"),g.getLocal(\"scalarSize\"),g.getLocal(\"startBit\"),g.getLocal(\"chunkSize\"))),g.if(g.getLocal(\"idx\"),[...g.setLocal(\"pIdxTable\",g.i32_add(g.getLocal(\"pTable\"),g.i32_mul(g.i32_sub(g.getLocal(\"idx\"),g.i32_const(1)),g.i32_const(f)))),...g.call(o,g.getLocal(\"pIdxTable\"),g.getLocal(\"itBase\"),g.getLocal(\"pIdxTable\"))]),g.setLocal(\"itScalar\",g.i32_add(g.getLocal(\"itScalar\"),g.getLocal(\"scalarSize\"))),g.setLocal(\"itBase\",g.i32_add(g.getLocal(\"itBase\"),g.i32_const(d))),g.br(0))),g.call(n+\"_reduceTable\",g.getLocal(\"pTable\"),g.getLocal(\"chunkSize\")),g.call(e+\"_copy\",g.getLocal(\"pTable\"),g.getLocal(\"pr\")),g.i32_store(g.i32_const(0),g.getLocal(\"pTable\")))}function s(){let C=t.addFunction(n);C.addParam(\"pBases\",\"i32\"),C.addParam(\"pScalars\",\"i32\"),C.addParam(\"scalarSize\",\"i32\"),C.addParam(\"n\",\"i32\"),C.addParam(\"pr\",\"i32\"),C.addLocal(\"chunkSize\",\"i32\"),C.addLocal(\"nChunks\",\"i32\"),C.addLocal(\"itScalar\",\"i32\"),C.addLocal(\"endScalar\",\"i32\"),C.addLocal(\"itBase\",\"i32\"),C.addLocal(\"itBit\",\"i32\"),C.addLocal(\"i\",\"i32\"),C.addLocal(\"j\",\"i32\"),C.addLocal(\"nTable\",\"i32\"),C.addLocal(\"pTable\",\"i32\"),C.addLocal(\"idx\",\"i32\"),C.addLocal(\"pIdxTable\",\"i32\");let g=C.getCodeBuilder(),$=g.i32_const(t.alloc(f)),it=t.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]);C.addCode(g.call(e+\"_zero\",g.getLocal(\"pr\")),g.if(g.i32_eqz(g.getLocal(\"n\")),g.ret([])),g.setLocal(\"chunkSize\",g.i32_load8_u(g.i32_clz(g.getLocal(\"n\")),it)),g.setLocal(\"nChunks\",g.i32_add(g.i32_div_u(g.i32_sub(g.i32_shl(g.getLocal(\"scalarSize\"),g.i32_const(3)),g.i32_const(1)),g.getLocal(\"chunkSize\")),g.i32_const(1))),g.setLocal(\"itBit\",g.i32_mul(g.i32_sub(g.getLocal(\"nChunks\"),g.i32_const(1)),g.getLocal(\"chunkSize\"))),g.block(g.loop(g.br_if(1,g.i32_lt_s(g.getLocal(\"itBit\"),g.i32_const(0))),g.if(g.i32_eqz(g.call(e+\"_isZero\",g.getLocal(\"pr\"))),[...g.setLocal(\"j\",g.i32_const(0)),...g.block(g.loop(g.br_if(1,g.i32_eq(g.getLocal(\"j\"),g.getLocal(\"chunkSize\"))),g.call(e+\"_double\",g.getLocal(\"pr\"),g.getLocal(\"pr\")),g.setLocal(\"j\",g.i32_add(g.getLocal(\"j\"),g.i32_const(1))),g.br(0)))]),g.call(n+\"_chunk\",g.getLocal(\"pBases\"),g.getLocal(\"pScalars\"),g.getLocal(\"scalarSize\"),g.getLocal(\"n\"),g.getLocal(\"itBit\"),g.getLocal(\"chunkSize\"),$),g.call(e+\"_add\",g.getLocal(\"pr\"),$,g.getLocal(\"pr\")),g.setLocal(\"itBit\",g.i32_sub(g.getLocal(\"itBit\"),g.getLocal(\"chunkSize\"))),g.br(0))))}function x(){let C=t.addFunction(n+\"_reduceTable\");C.addParam(\"pTable\",\"i32\"),C.addParam(\"p\",\"i32\"),C.addLocal(\"half\",\"i32\"),C.addLocal(\"it1\",\"i32\"),C.addLocal(\"it2\",\"i32\"),C.addLocal(\"pAcc\",\"i32\");let g=C.getCodeBuilder();C.addCode(g.if(g.i32_eq(g.getLocal(\"p\"),g.i32_const(1)),g.ret([])),g.setLocal(\"half\",g.i32_shl(g.i32_const(1),g.i32_sub(g.getLocal(\"p\"),g.i32_const(1)))),g.setLocal(\"it1\",g.getLocal(\"pTable\")),g.setLocal(\"it2\",g.i32_add(g.getLocal(\"pTable\"),g.i32_mul(g.getLocal(\"half\"),g.i32_const(f)))),g.setLocal(\"pAcc\",g.i32_sub(g.getLocal(\"it2\"),g.i32_const(f))),g.block(g.loop(g.br_if(1,g.i32_eq(g.getLocal(\"it1\"),g.getLocal(\"pAcc\"))),g.call(e+\"_add\",g.getLocal(\"it1\"),g.getLocal(\"it2\"),g.getLocal(\"it1\")),g.call(e+\"_add\",g.getLocal(\"pAcc\"),g.getLocal(\"it2\"),g.getLocal(\"pAcc\")),g.setLocal(\"it1\",g.i32_add(g.getLocal(\"it1\"),g.i32_const(f))),g.setLocal(\"it2\",g.i32_add(g.getLocal(\"it2\"),g.i32_const(f))),g.br(0))),g.call(n+\"_reduceTable\",g.getLocal(\"pTable\"),g.i32_sub(g.getLocal(\"p\"),g.i32_const(1))),g.setLocal(\"p\",g.i32_sub(g.getLocal(\"p\"),g.i32_const(1))),g.block(g.loop(g.br_if(1,g.i32_eqz(g.getLocal(\"p\"))),g.call(e+\"_double\",g.getLocal(\"pAcc\"),g.getLocal(\"pAcc\")),g.setLocal(\"p\",g.i32_sub(g.getLocal(\"p\"),g.i32_const(1))),g.br(0))),g.call(e+\"_add\",g.getLocal(\"pTable\"),g.getLocal(\"pAcc\"),g.getLocal(\"pTable\")))}L(),x(),l(),s(),t.exportFunction(n),t.exportFunction(n+\"_chunk\")}});var uc=Yt((m8,$d)=>{var Zd=Nd(),wa=ac(),Hd=Dd();$d.exports=function(t,e,n,o){let d=t.modules[n].n64,h=d*8;if(t.modules[e])return e;t.modules[e]={n64:d*3};function f(){let m=t.addFunction(e+\"_isZero\");m.addParam(\"p1\",\"i32\"),m.setReturnType(\"i32\");let a=m.getCodeBuilder();m.addCode(a.call(n+\"_isZero\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(h*2))))}function L(){let m=t.addFunction(e+\"_isZeroAffine\");m.addParam(\"p1\",\"i32\"),m.setReturnType(\"i32\");let a=m.getCodeBuilder();m.addCode(a.i32_and(a.call(n+\"_isZero\",a.getLocal(\"p1\")),a.call(n+\"_isZero\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(h)))))}function l(){let m=t.addFunction(e+\"_copy\");m.addParam(\"ps\",\"i32\"),m.addParam(\"pd\",\"i32\");let a=m.getCodeBuilder();for(let w=0;w<d*3;w++)m.addCode(a.i64_store(a.getLocal(\"pd\"),w*8,a.i64_load(a.getLocal(\"ps\"),w*8)))}function s(){let m=t.addFunction(e+\"_copyAffine\");m.addParam(\"ps\",\"i32\"),m.addParam(\"pd\",\"i32\");let a=m.getCodeBuilder();for(let w=0;w<d*2;w++)m.addCode(a.i64_store(a.getLocal(\"pd\"),w*8,a.i64_load(a.getLocal(\"ps\"),w*8)))}function x(){let m=t.addFunction(e+\"_zero\");m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder();m.addCode(a.call(n+\"_zero\",a.getLocal(\"pr\"))),m.addCode(a.call(n+\"_one\",a.i32_add(a.getLocal(\"pr\"),a.i32_const(h)))),m.addCode(a.call(n+\"_zero\",a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2))))}function C(){let m=t.addFunction(e+\"_zeroAffine\");m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder();m.addCode(a.call(n+\"_zero\",a.getLocal(\"pr\"))),m.addCode(a.call(n+\"_zero\",a.i32_add(a.getLocal(\"pr\"),a.i32_const(h))))}function g(){let m=t.addFunction(e+\"_eq\");m.addParam(\"p1\",\"i32\"),m.addParam(\"p2\",\"i32\"),m.setReturnType(\"i32\"),m.addLocal(\"z1\",\"i32\"),m.addLocal(\"z2\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h));m.addCode(a.setLocal(\"z1\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(h*2))));let G=a.getLocal(\"z1\"),R=a.getLocal(\"p2\"),F=a.i32_add(a.getLocal(\"p2\"),a.i32_const(h));m.addCode(a.setLocal(\"z2\",a.i32_add(a.getLocal(\"p2\"),a.i32_const(h*2))));let U=a.getLocal(\"z2\"),A=a.i32_const(t.alloc(h)),et=a.i32_const(t.alloc(h)),Lt=a.i32_const(t.alloc(h)),St=a.i32_const(t.alloc(h)),qt=a.i32_const(t.alloc(h)),Dt=a.i32_const(t.alloc(h)),kt=a.i32_const(t.alloc(h)),Bt=a.i32_const(t.alloc(h));m.addCode(a.if(a.call(e+\"_isZero\",a.getLocal(\"p1\")),a.ret(a.call(e+\"_isZero\",a.getLocal(\"p2\")))),a.if(a.call(e+\"_isZero\",a.getLocal(\"p2\")),a.ret(a.i32_const(0))),a.if(a.call(n+\"_isOne\",G),a.ret(a.call(e+\"_eqMixed\",a.getLocal(\"p2\"),a.getLocal(\"p1\")))),a.if(a.call(n+\"_isOne\",U),a.ret(a.call(e+\"_eqMixed\",a.getLocal(\"p1\"),a.getLocal(\"p2\")))),a.call(n+\"_square\",G,A),a.call(n+\"_square\",U,et),a.call(n+\"_mul\",w,et,Lt),a.call(n+\"_mul\",R,A,St),a.call(n+\"_mul\",G,A,qt),a.call(n+\"_mul\",U,et,Dt),a.call(n+\"_mul\",c,Dt,kt),a.call(n+\"_mul\",F,qt,Bt),a.if(a.call(n+\"_eq\",Lt,St),a.if(a.call(n+\"_eq\",kt,Bt),a.ret(a.i32_const(1)))),a.ret(a.i32_const(0)))}function $(){let m=t.addFunction(e+\"_eqMixed\");m.addParam(\"p1\",\"i32\"),m.addParam(\"p2\",\"i32\"),m.setReturnType(\"i32\"),m.addLocal(\"z1\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h));m.addCode(a.setLocal(\"z1\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(h*2))));let G=a.getLocal(\"z1\"),R=a.getLocal(\"p2\"),F=a.i32_add(a.getLocal(\"p2\"),a.i32_const(h)),U=a.i32_const(t.alloc(h)),A=a.i32_const(t.alloc(h)),et=a.i32_const(t.alloc(h)),Lt=a.i32_const(t.alloc(h));m.addCode(a.if(a.call(e+\"_isZero\",a.getLocal(\"p1\")),a.ret(a.call(e+\"_isZeroAffine\",a.getLocal(\"p2\")))),a.if(a.call(e+\"_isZeroAffine\",a.getLocal(\"p2\")),a.ret(a.i32_const(0))),a.if(a.call(n+\"_isOne\",G),a.ret(a.call(e+\"_eqAffine\",a.getLocal(\"p1\"),a.getLocal(\"p2\")))),a.call(n+\"_square\",G,U),a.call(n+\"_mul\",R,U,A),a.call(n+\"_mul\",G,U,et),a.call(n+\"_mul\",F,et,Lt),a.if(a.call(n+\"_eq\",w,A),a.if(a.call(n+\"_eq\",c,Lt),a.ret(a.i32_const(1)))),a.ret(a.i32_const(0)))}function it(){let m=t.addFunction(e+\"_double\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h)),G=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h*2)),R=a.getLocal(\"pr\"),F=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h)),U=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2)),A=a.i32_const(t.alloc(h)),et=a.i32_const(t.alloc(h)),Lt=a.i32_const(t.alloc(h)),St=a.i32_const(t.alloc(h)),qt=a.i32_const(t.alloc(h)),Dt=a.i32_const(t.alloc(h)),kt=a.i32_const(t.alloc(h)),Bt=a.i32_const(t.alloc(h));m.addCode(a.if(a.call(e+\"_isZero\",a.getLocal(\"p1\")),[...a.call(e+\"_copy\",a.getLocal(\"p1\"),a.getLocal(\"pr\")),...a.ret([])]),a.if(a.call(n+\"_isOne\",G),[...a.ret(a.call(e+\"_doubleAffine\",a.getLocal(\"p1\"),a.getLocal(\"pr\"))),...a.ret([])]),a.call(n+\"_square\",w,A),a.call(n+\"_square\",c,et),a.call(n+\"_square\",et,Lt),a.call(n+\"_add\",w,et,St),a.call(n+\"_square\",St,St),a.call(n+\"_sub\",St,A,St),a.call(n+\"_sub\",St,Lt,St),a.call(n+\"_add\",St,St,St),a.call(n+\"_add\",A,A,qt),a.call(n+\"_add\",qt,A,qt),a.call(n+\"_square\",qt,Dt),a.call(n+\"_mul\",c,G,kt),a.call(n+\"_add\",St,St,R),a.call(n+\"_sub\",Dt,R,R),a.call(n+\"_add\",Lt,Lt,Bt),a.call(n+\"_add\",Bt,Bt,Bt),a.call(n+\"_add\",Bt,Bt,Bt),a.call(n+\"_sub\",St,R,F),a.call(n+\"_mul\",F,qt,F),a.call(n+\"_sub\",F,Bt,F),a.call(n+\"_add\",kt,kt,U))}function q(){let m=t.addFunction(e+\"_doubleAffine\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h)),G=a.getLocal(\"pr\"),R=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h)),F=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2)),U=a.i32_const(t.alloc(h)),A=a.i32_const(t.alloc(h)),et=a.i32_const(t.alloc(h)),Lt=a.i32_const(t.alloc(h)),St=a.i32_const(t.alloc(h)),qt=a.i32_const(t.alloc(h));m.addCode(a.if(a.call(e+\"_isZeroAffine\",a.getLocal(\"p1\")),[...a.call(e+\"_toJacobian\",a.getLocal(\"p1\"),a.getLocal(\"pr\")),...a.ret([])]),a.call(n+\"_square\",w,U),a.call(n+\"_square\",c,A),a.call(n+\"_square\",A,et),a.call(n+\"_add\",w,A,Lt),a.call(n+\"_square\",Lt,Lt),a.call(n+\"_sub\",Lt,U,Lt),a.call(n+\"_sub\",Lt,et,Lt),a.call(n+\"_add\",Lt,Lt,Lt),a.call(n+\"_add\",U,U,St),a.call(n+\"_add\",St,U,St),a.call(n+\"_add\",c,c,F),a.call(n+\"_square\",St,G),a.call(n+\"_sub\",G,Lt,G),a.call(n+\"_sub\",G,Lt,G),a.call(n+\"_add\",et,et,qt),a.call(n+\"_add\",qt,qt,qt),a.call(n+\"_add\",qt,qt,qt),a.call(n+\"_sub\",Lt,G,R),a.call(n+\"_mul\",R,St,R),a.call(n+\"_sub\",R,qt,R))}function S(){let m=t.addFunction(e+\"_eqAffine\");m.addParam(\"p1\",\"i32\"),m.addParam(\"p2\",\"i32\"),m.setReturnType(\"i32\"),m.addLocal(\"z1\",\"i32\");let a=m.getCodeBuilder();m.addCode(a.ret(a.i32_and(a.call(n+\"_eq\",a.getLocal(\"p1\"),a.getLocal(\"p2\")),a.call(n+\"_eq\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(h)),a.i32_add(a.getLocal(\"p2\"),a.i32_const(h))))))}function O(){let m=t.addFunction(e+\"_toMontgomery\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder();m.addCode(a.call(n+\"_toMontgomery\",a.getLocal(\"p1\"),a.getLocal(\"pr\")));for(let w=1;w<3;w++)m.addCode(a.call(n+\"_toMontgomery\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(w*h)),a.i32_add(a.getLocal(\"pr\"),a.i32_const(w*h))))}function M(){let m=t.addFunction(e+\"_toMontgomeryAffine\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder();m.addCode(a.call(n+\"_toMontgomery\",a.getLocal(\"p1\"),a.getLocal(\"pr\")));for(let w=1;w<2;w++)m.addCode(a.call(n+\"_toMontgomery\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(w*h)),a.i32_add(a.getLocal(\"pr\"),a.i32_const(w*h))))}function W(){let m=t.addFunction(e+\"_fromMontgomery\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder();m.addCode(a.call(n+\"_fromMontgomery\",a.getLocal(\"p1\"),a.getLocal(\"pr\")));for(let w=1;w<3;w++)m.addCode(a.call(n+\"_fromMontgomery\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(w*h)),a.i32_add(a.getLocal(\"pr\"),a.i32_const(w*h))))}function ct(){let m=t.addFunction(e+\"_fromMontgomeryAffine\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder();m.addCode(a.call(n+\"_fromMontgomery\",a.getLocal(\"p1\"),a.getLocal(\"pr\")));for(let w=1;w<2;w++)m.addCode(a.call(n+\"_fromMontgomery\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(w*h)),a.i32_add(a.getLocal(\"pr\"),a.i32_const(w*h))))}function E(){let m=t.addFunction(e+\"_add\");m.addParam(\"p1\",\"i32\"),m.addParam(\"p2\",\"i32\"),m.addParam(\"pr\",\"i32\"),m.addLocal(\"z1\",\"i32\"),m.addLocal(\"z2\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h));m.addCode(a.setLocal(\"z1\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(h*2))));let G=a.getLocal(\"z1\"),R=a.getLocal(\"p2\"),F=a.i32_add(a.getLocal(\"p2\"),a.i32_const(h));m.addCode(a.setLocal(\"z2\",a.i32_add(a.getLocal(\"p2\"),a.i32_const(h*2))));let U=a.getLocal(\"z2\"),A=a.getLocal(\"pr\"),et=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h)),Lt=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2)),St=a.i32_const(t.alloc(h)),qt=a.i32_const(t.alloc(h)),Dt=a.i32_const(t.alloc(h)),kt=a.i32_const(t.alloc(h)),Bt=a.i32_const(t.alloc(h)),Tt=a.i32_const(t.alloc(h)),wt=a.i32_const(t.alloc(h)),Rt=a.i32_const(t.alloc(h)),I=a.i32_const(t.alloc(h)),z=a.i32_const(t.alloc(h)),J=a.i32_const(t.alloc(h)),st=a.i32_const(t.alloc(h)),mt=a.i32_const(t.alloc(h)),_t=a.i32_const(t.alloc(h)),It=a.i32_const(t.alloc(h)),Et=a.i32_const(t.alloc(h)),Ct=a.i32_const(t.alloc(h));m.addCode(a.if(a.call(e+\"_isZero\",a.getLocal(\"p1\")),[...a.call(e+\"_copy\",a.getLocal(\"p2\"),a.getLocal(\"pr\")),...a.ret([])]),a.if(a.call(e+\"_isZero\",a.getLocal(\"p2\")),[...a.call(e+\"_copy\",a.getLocal(\"p1\"),a.getLocal(\"pr\")),...a.ret([])]),a.if(a.call(n+\"_isOne\",G),[...a.call(e+\"_addMixed\",R,w,A),...a.ret([])]),a.if(a.call(n+\"_isOne\",U),[...a.call(e+\"_addMixed\",w,R,A),...a.ret([])]),a.call(n+\"_square\",G,St),a.call(n+\"_square\",U,qt),a.call(n+\"_mul\",w,qt,Dt),a.call(n+\"_mul\",R,St,kt),a.call(n+\"_mul\",G,St,Bt),a.call(n+\"_mul\",U,qt,Tt),a.call(n+\"_mul\",c,Tt,wt),a.call(n+\"_mul\",F,Bt,Rt),a.if(a.call(n+\"_eq\",Dt,kt),a.if(a.call(n+\"_eq\",wt,Rt),[...a.call(e+\"_double\",a.getLocal(\"p1\"),a.getLocal(\"pr\")),...a.ret([])])),a.call(n+\"_sub\",kt,Dt,I),a.call(n+\"_sub\",Rt,wt,z),a.call(n+\"_add\",I,I,J),a.call(n+\"_square\",J,J),a.call(n+\"_mul\",I,J,st),a.call(n+\"_add\",z,z,mt),a.call(n+\"_mul\",Dt,J,It),a.call(n+\"_square\",mt,_t),a.call(n+\"_add\",It,It,Et),a.call(n+\"_sub\",_t,st,A),a.call(n+\"_sub\",A,Et,A),a.call(n+\"_mul\",wt,st,Ct),a.call(n+\"_add\",Ct,Ct,Ct),a.call(n+\"_sub\",It,A,et),a.call(n+\"_mul\",et,mt,et),a.call(n+\"_sub\",et,Ct,et),a.call(n+\"_add\",G,U,Lt),a.call(n+\"_square\",Lt,Lt),a.call(n+\"_sub\",Lt,St,Lt),a.call(n+\"_sub\",Lt,qt,Lt),a.call(n+\"_mul\",Lt,I,Lt))}function _(){let m=t.addFunction(e+\"_addMixed\");m.addParam(\"p1\",\"i32\"),m.addParam(\"p2\",\"i32\"),m.addParam(\"pr\",\"i32\"),m.addLocal(\"z1\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h));m.addCode(a.setLocal(\"z1\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(h*2))));let G=a.getLocal(\"z1\"),R=a.getLocal(\"p2\"),F=a.i32_add(a.getLocal(\"p2\"),a.i32_const(h)),U=a.getLocal(\"pr\"),A=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h)),et=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2)),Lt=a.i32_const(t.alloc(h)),St=a.i32_const(t.alloc(h)),qt=a.i32_const(t.alloc(h)),Dt=a.i32_const(t.alloc(h)),kt=a.i32_const(t.alloc(h)),Bt=a.i32_const(t.alloc(h)),Tt=a.i32_const(t.alloc(h)),wt=a.i32_const(t.alloc(h)),Rt=a.i32_const(t.alloc(h)),I=a.i32_const(t.alloc(h)),z=a.i32_const(t.alloc(h)),J=a.i32_const(t.alloc(h)),st=a.i32_const(t.alloc(h)),mt=a.i32_const(t.alloc(h));m.addCode(a.if(a.call(e+\"_isZero\",a.getLocal(\"p1\")),[...a.call(e+\"_copyAffine\",a.getLocal(\"p2\"),a.getLocal(\"pr\")),...a.call(n+\"_one\",a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2))),...a.ret([])]),a.if(a.call(e+\"_isZeroAffine\",a.getLocal(\"p2\")),[...a.call(e+\"_copy\",a.getLocal(\"p1\"),a.getLocal(\"pr\")),...a.ret([])]),a.if(a.call(n+\"_isOne\",G),[...a.call(e+\"_addAffine\",w,R,U),...a.ret([])]),a.call(n+\"_square\",G,Lt),a.call(n+\"_mul\",R,Lt,St),a.call(n+\"_mul\",G,Lt,qt),a.call(n+\"_mul\",F,qt,Dt),a.if(a.call(n+\"_eq\",w,St),a.if(a.call(n+\"_eq\",c,Dt),[...a.call(e+\"_doubleAffine\",a.getLocal(\"p2\"),a.getLocal(\"pr\")),...a.ret([])])),a.call(n+\"_sub\",St,w,kt),a.call(n+\"_sub\",Dt,c,Tt),a.call(n+\"_square\",kt,Bt),a.call(n+\"_add\",Bt,Bt,wt),a.call(n+\"_add\",wt,wt,wt),a.call(n+\"_mul\",kt,wt,Rt),a.call(n+\"_add\",Tt,Tt,I),a.call(n+\"_mul\",w,wt,J),a.call(n+\"_square\",I,z),a.call(n+\"_add\",J,J,st),a.call(n+\"_sub\",z,Rt,U),a.call(n+\"_sub\",U,st,U),a.call(n+\"_mul\",c,Rt,mt),a.call(n+\"_add\",mt,mt,mt),a.call(n+\"_sub\",J,U,A),a.call(n+\"_mul\",A,I,A),a.call(n+\"_sub\",A,mt,A),a.call(n+\"_add\",G,kt,et),a.call(n+\"_square\",et,et),a.call(n+\"_sub\",et,Lt,et),a.call(n+\"_sub\",et,Bt,et))}function r(){let m=t.addFunction(e+\"_addAffine\");m.addParam(\"p1\",\"i32\"),m.addParam(\"p2\",\"i32\"),m.addParam(\"pr\",\"i32\"),m.addLocal(\"z1\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h));m.addCode(a.setLocal(\"z1\",a.i32_add(a.getLocal(\"p1\"),a.i32_const(h*2))));let G=a.getLocal(\"p2\"),R=a.i32_add(a.getLocal(\"p2\"),a.i32_const(h)),F=a.getLocal(\"pr\"),U=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h)),A=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2)),et=a.i32_const(t.alloc(h)),Lt=a.i32_const(t.alloc(h)),St=a.i32_const(t.alloc(h)),qt=a.i32_const(t.alloc(h)),Dt=a.i32_const(t.alloc(h)),kt=a.i32_const(t.alloc(h)),Bt=a.i32_const(t.alloc(h)),Tt=a.i32_const(t.alloc(h)),wt=a.i32_const(t.alloc(h)),Rt=a.i32_const(t.alloc(h));m.addCode(a.if(a.call(e+\"_isZeroAffine\",a.getLocal(\"p1\")),[...a.call(e+\"_copyAffine\",a.getLocal(\"p2\"),a.getLocal(\"pr\")),...a.call(n+\"_one\",a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2))),...a.ret([])]),a.if(a.call(e+\"_isZeroAffine\",a.getLocal(\"p2\")),[...a.call(e+\"_copyAffine\",a.getLocal(\"p1\"),a.getLocal(\"pr\")),...a.call(n+\"_one\",a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2))),...a.ret([])]),a.if(a.call(n+\"_eq\",w,G),a.if(a.call(n+\"_eq\",c,R),[...a.call(e+\"_doubleAffine\",a.getLocal(\"p2\"),a.getLocal(\"pr\")),...a.ret([])])),a.call(n+\"_sub\",G,w,et),a.call(n+\"_sub\",R,c,St),a.call(n+\"_square\",et,Lt),a.call(n+\"_add\",Lt,Lt,qt),a.call(n+\"_add\",qt,qt,qt),a.call(n+\"_mul\",et,qt,Dt),a.call(n+\"_add\",St,St,kt),a.call(n+\"_mul\",w,qt,Tt),a.call(n+\"_square\",kt,Bt),a.call(n+\"_add\",Tt,Tt,wt),a.call(n+\"_sub\",Bt,Dt,F),a.call(n+\"_sub\",F,wt,F),a.call(n+\"_mul\",c,Dt,Rt),a.call(n+\"_add\",Rt,Rt,Rt),a.call(n+\"_sub\",Tt,F,U),a.call(n+\"_mul\",U,kt,U),a.call(n+\"_sub\",U,Rt,U),a.call(n+\"_add\",et,et,A))}function Z(){let m=t.addFunction(e+\"_neg\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h)),G=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h*2)),R=a.getLocal(\"pr\"),F=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h)),U=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2));m.addCode(a.call(n+\"_copy\",w,R),a.call(n+\"_neg\",c,F),a.call(n+\"_copy\",G,U))}function j(){let m=t.addFunction(e+\"_negAffine\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h)),G=a.getLocal(\"pr\"),R=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h));m.addCode(a.call(n+\"_copy\",w,G),a.call(n+\"_neg\",c,R))}function nt(){let m=t.addFunction(e+\"_sub\");m.addParam(\"p1\",\"i32\"),m.addParam(\"p2\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder(),w=a.i32_const(t.alloc(h*3));m.addCode(a.call(e+\"_neg\",a.getLocal(\"p2\"),w),a.call(e+\"_add\",a.getLocal(\"p1\"),w,a.getLocal(\"pr\")))}function v(){let m=t.addFunction(e+\"_subMixed\");m.addParam(\"p1\",\"i32\"),m.addParam(\"p2\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder(),w=a.i32_const(t.alloc(h*3));m.addCode(a.call(e+\"_negAffine\",a.getLocal(\"p2\"),w),a.call(e+\"_addMixed\",a.getLocal(\"p1\"),w,a.getLocal(\"pr\")))}function y(){let m=t.addFunction(e+\"_subAffine\");m.addParam(\"p1\",\"i32\"),m.addParam(\"p2\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder(),w=a.i32_const(t.alloc(h*3));m.addCode(a.call(e+\"_negAffine\",a.getLocal(\"p2\"),w),a.call(e+\"_addAffine\",a.getLocal(\"p1\"),w,a.getLocal(\"pr\")))}function T(){let m=t.addFunction(e+\"_normalize\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h)),G=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h*2)),R=a.getLocal(\"pr\"),F=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h)),U=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2)),A=a.i32_const(t.alloc(h)),et=a.i32_const(t.alloc(h)),Lt=a.i32_const(t.alloc(h));m.addCode(a.if(a.call(e+\"_isZero\",a.getLocal(\"p1\")),a.call(e+\"_zero\",a.getLocal(\"pr\")),[...a.call(n+\"_inverse\",G,A),...a.call(n+\"_square\",A,et),...a.call(n+\"_mul\",A,et,Lt),...a.call(n+\"_mul\",w,et,R),...a.call(n+\"_mul\",c,Lt,F),...a.call(n+\"_one\",U)]))}function V(){let m=t.addFunction(e+\"_toAffine\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h)),G=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h*2)),R=a.getLocal(\"pr\"),F=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h)),U=a.i32_const(t.alloc(h)),A=a.i32_const(t.alloc(h)),et=a.i32_const(t.alloc(h));m.addCode(a.if(a.call(e+\"_isZero\",a.getLocal(\"p1\")),[...a.call(n+\"_zero\",R),...a.call(n+\"_zero\",F)],[...a.call(n+\"_inverse\",G,U),...a.call(n+\"_square\",U,A),...a.call(n+\"_mul\",U,A,et),...a.call(n+\"_mul\",w,A,R),...a.call(n+\"_mul\",c,et,F)]))}function rt(){let m=t.addFunction(e+\"_toJacobian\");m.addParam(\"p1\",\"i32\"),m.addParam(\"pr\",\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"p1\"),c=a.i32_add(a.getLocal(\"p1\"),a.i32_const(h)),G=a.getLocal(\"pr\"),R=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h)),F=a.i32_add(a.getLocal(\"pr\"),a.i32_const(h*2));m.addCode(a.if(a.call(e+\"_isZeroAffine\",a.getLocal(\"p1\")),a.call(e+\"_zero\",a.getLocal(\"pr\")),[...a.call(n+\"_one\",F),...a.call(n+\"_copy\",c,R),...a.call(n+\"_copy\",w,G)]))}function dt(){let m=t.addFunction(e+\"_batchToAffine\");m.addParam(\"pIn\",\"i32\"),m.addParam(\"n\",\"i32\"),m.addParam(\"pOut\",\"i32\"),m.addLocal(\"pAux\",\"i32\"),m.addLocal(\"itIn\",\"i32\"),m.addLocal(\"itAux\",\"i32\"),m.addLocal(\"itOut\",\"i32\"),m.addLocal(\"i\",\"i32\");let a=m.getCodeBuilder(),w=a.i32_const(t.alloc(h));m.addCode(a.setLocal(\"pAux\",a.i32_load(a.i32_const(0))),a.i32_store(a.i32_const(0),a.i32_add(a.getLocal(\"pAux\"),a.i32_mul(a.getLocal(\"n\"),a.i32_const(h)))),a.call(n+\"_batchInverse\",a.i32_add(a.getLocal(\"pIn\"),a.i32_const(h*2)),a.i32_const(h*3),a.getLocal(\"n\"),a.getLocal(\"pAux\"),a.i32_const(h)),a.setLocal(\"itIn\",a.getLocal(\"pIn\")),a.setLocal(\"itAux\",a.getLocal(\"pAux\")),a.setLocal(\"itOut\",a.getLocal(\"pOut\")),a.setLocal(\"i\",a.i32_const(0)),a.block(a.loop(a.br_if(1,a.i32_eq(a.getLocal(\"i\"),a.getLocal(\"n\"))),a.if(a.call(n+\"_isZero\",a.getLocal(\"itAux\")),[...a.call(n+\"_zero\",a.getLocal(\"itOut\")),...a.call(n+\"_zero\",a.i32_add(a.getLocal(\"itOut\"),a.i32_const(h)))],[...a.call(n+\"_mul\",a.getLocal(\"itAux\"),a.i32_add(a.getLocal(\"itIn\"),a.i32_const(h)),w),...a.call(n+\"_square\",a.getLocal(\"itAux\"),a.getLocal(\"itAux\")),...a.call(n+\"_mul\",a.getLocal(\"itAux\"),a.getLocal(\"itIn\"),a.getLocal(\"itOut\")),...a.call(n+\"_mul\",a.getLocal(\"itAux\"),w,a.i32_add(a.getLocal(\"itOut\"),a.i32_const(h)))]),a.setLocal(\"itIn\",a.i32_add(a.getLocal(\"itIn\"),a.i32_const(h*3))),a.setLocal(\"itOut\",a.i32_add(a.getLocal(\"itOut\"),a.i32_const(h*2))),a.setLocal(\"itAux\",a.i32_add(a.getLocal(\"itAux\"),a.i32_const(h))),a.setLocal(\"i\",a.i32_add(a.getLocal(\"i\"),a.i32_const(1))),a.br(0))),a.i32_store(a.i32_const(0),a.getLocal(\"pAux\")))}function ot(){let m=t.addFunction(e+\"__reverseBytes\");m.addParam(\"pIn\",\"i32\"),m.addParam(\"n\",\"i32\"),m.addParam(\"pOut\",\"i32\"),m.addLocal(\"itOut\",\"i32\"),m.addLocal(\"itIn\",\"i32\");let a=m.getCodeBuilder();m.addCode(a.setLocal(\"itOut\",a.i32_sub(a.i32_add(a.getLocal(\"pOut\"),a.getLocal(\"n\")),a.i32_const(1))),a.setLocal(\"itIn\",a.getLocal(\"pIn\")),a.block(a.loop(a.br_if(1,a.i32_lt_s(a.getLocal(\"itOut\"),a.getLocal(\"pOut\"))),a.i32_store8(a.getLocal(\"itOut\"),a.i32_load8_u(a.getLocal(\"itIn\"))),a.setLocal(\"itOut\",a.i32_sub(a.getLocal(\"itOut\"),a.i32_const(1))),a.setLocal(\"itIn\",a.i32_add(a.getLocal(\"itIn\"),a.i32_const(1))),a.br(0))))}function xt(){let m=t.addFunction(e+\"_LEMtoC\");m.addParam(\"pIn\",\"i32\"),m.addParam(\"pOut\",\"i32\");let a=m.getCodeBuilder(),w=a.i32_const(t.alloc(h));m.addCode(a.if(a.call(e+\"_isZero\",a.getLocal(\"pIn\")),[...a.call(n+\"_zero\",a.getLocal(\"pOut\")),...a.i32_store8(a.getLocal(\"pOut\"),a.i32_const(64)),...a.ret([])]),a.call(n+\"_fromMontgomery\",a.getLocal(\"pIn\"),w),a.call(e+\"__reverseBytes\",w,a.i32_const(h),a.getLocal(\"pOut\")),a.if(a.i32_eq(a.call(n+\"_sign\",a.i32_add(a.getLocal(\"pIn\"),a.i32_const(h))),a.i32_const(-1)),a.i32_store8(a.getLocal(\"pOut\"),a.i32_or(a.i32_load8_u(a.getLocal(\"pOut\")),a.i32_const(128)))))}function pt(){let m=t.addFunction(e+\"_LEMtoU\");m.addParam(\"pIn\",\"i32\"),m.addParam(\"pOut\",\"i32\");let a=m.getCodeBuilder(),w=t.alloc(h*2),c=a.i32_const(w),G=a.i32_const(w),R=a.i32_const(w+h);m.addCode(a.if(a.call(e+\"_isZeroAffine\",a.getLocal(\"pIn\")),[...a.call(e+\"_zeroAffine\",a.getLocal(\"pOut\")),...a.i32_store8(a.getLocal(\"pOut\"),a.i32_const(64)),...a.ret([])]),a.call(e+\"_fromMontgomeryAffine\",a.getLocal(\"pIn\"),c),a.call(e+\"__reverseBytes\",G,a.i32_const(h),a.getLocal(\"pOut\")),a.call(e+\"__reverseBytes\",R,a.i32_const(h),a.i32_add(a.getLocal(\"pOut\"),a.i32_const(h))))}function bt(){let m=t.addFunction(e+\"_UtoLEM\");m.addParam(\"pIn\",\"i32\"),m.addParam(\"pOut\",\"i32\");let a=m.getCodeBuilder(),w=t.alloc(h*2),c=a.i32_const(w),G=a.i32_const(w),R=a.i32_const(w+h);m.addCode(a.if(a.i32_and(a.i32_load8_u(a.getLocal(\"pIn\")),a.i32_const(64)),[...a.call(e+\"_zeroAffine\",a.getLocal(\"pOut\")),...a.ret([])]),a.call(e+\"__reverseBytes\",a.getLocal(\"pIn\"),a.i32_const(h),G),a.call(e+\"__reverseBytes\",a.i32_add(a.getLocal(\"pIn\"),a.i32_const(h)),a.i32_const(h),R),a.call(e+\"_toMontgomeryAffine\",c,a.getLocal(\"pOut\")))}function vt(){let m=t.addFunction(e+\"_CtoLEM\");m.addParam(\"pIn\",\"i32\"),m.addParam(\"pOut\",\"i32\"),m.addLocal(\"firstByte\",\"i32\"),m.addLocal(\"greatest\",\"i32\");let a=m.getCodeBuilder(),w=t.alloc(h*2),c=a.i32_const(w),G=a.i32_const(w+h);m.addCode(a.setLocal(\"firstByte\",a.i32_load8_u(a.getLocal(\"pIn\"))),a.if(a.i32_and(a.getLocal(\"firstByte\"),a.i32_const(64)),[...a.call(e+\"_zeroAffine\",a.getLocal(\"pOut\")),...a.ret([])]),a.setLocal(\"greatest\",a.i32_and(a.getLocal(\"firstByte\"),a.i32_const(128))),a.call(n+\"_copy\",a.getLocal(\"pIn\"),G),a.i32_store8(G,a.i32_and(a.getLocal(\"firstByte\"),a.i32_const(63))),a.call(e+\"__reverseBytes\",G,a.i32_const(h),c),a.call(n+\"_toMontgomery\",c,a.getLocal(\"pOut\")),a.call(n+\"_square\",a.getLocal(\"pOut\"),G),a.call(n+\"_mul\",a.getLocal(\"pOut\"),G,G),a.call(n+\"_add\",G,a.i32_const(o),G),a.call(n+\"_sqrt\",G,G),a.call(n+\"_neg\",G,c),a.if(a.i32_eq(a.call(n+\"_sign\",G),a.i32_const(-1)),a.if(a.getLocal(\"greatest\"),a.call(n+\"_copy\",G,a.i32_add(a.getLocal(\"pOut\"),a.i32_const(h))),a.call(n+\"_neg\",G,a.i32_add(a.getLocal(\"pOut\"),a.i32_const(h)))),a.if(a.getLocal(\"greatest\"),a.call(n+\"_neg\",G,a.i32_add(a.getLocal(\"pOut\"),a.i32_const(h))),a.call(n+\"_copy\",G,a.i32_add(a.getLocal(\"pOut\"),a.i32_const(h))))))}function Pt(){let m=t.addFunction(e+\"_inCurveAffine\");m.addParam(\"pIn\",\"i32\"),m.setReturnType(\"i32\");let a=m.getCodeBuilder(),w=a.getLocal(\"pIn\"),c=a.i32_add(a.getLocal(\"pIn\"),a.i32_const(h)),G=a.i32_const(t.alloc(h)),R=a.i32_const(t.alloc(h));m.addCode(a.call(n+\"_square\",c,G),a.call(n+\"_square\",w,R),a.call(n+\"_mul\",w,R,R),a.call(n+\"_add\",R,a.i32_const(o),R),a.ret(a.call(n+\"_eq\",G,R)))}function Ht(){let m=t.addFunction(e+\"_inCurve\");m.addParam(\"pIn\",\"i32\"),m.setReturnType(\"i32\");let a=m.getCodeBuilder(),w=a.i32_const(t.alloc(h*2));m.addCode(a.call(e+\"_toAffine\",a.getLocal(\"pIn\"),w),a.ret(a.call(e+\"_inCurveAffine\",w)))}return L(),f(),C(),x(),s(),l(),rt(),S(),$(),g(),q(),it(),r(),_(),E(),j(),Z(),y(),v(),nt(),ct(),W(),M(),O(),V(),Pt(),Ht(),dt(),T(),ot(),pt(),xt(),bt(),vt(),wa(t,e+\"_batchLEMtoU\",e+\"_LEMtoU\",h*2,h*2),wa(t,e+\"_batchLEMtoC\",e+\"_LEMtoC\",h*2,h),wa(t,e+\"_batchUtoLEM\",e+\"_UtoLEM\",h*2,h*2),wa(t,e+\"_batchCtoLEM\",e+\"_CtoLEM\",h,h*2,!0),wa(t,e+\"_batchToJacobian\",e+\"_toJacobian\",h*2,h*3,!0),Hd(t,e,e+\"_multiexp\",e+\"_add\",h*3),Hd(t,e,e+\"_multiexpAffine\",e+\"_addMixed\",h*2),Zd(t,e+\"_timesScalar\",h*3,e+\"_add\",e+\"_double\",e+\"_sub\",e+\"_copy\",e+\"_zero\"),Zd(t,e+\"_timesScalarAffine\",h*2,e+\"_addMixed\",e+\"_double\",e+\"_subMixed\",e+\"_copyAffine\",e+\"_zero\"),t.exportFunction(e+\"_isZero\"),t.exportFunction(e+\"_isZeroAffine\"),t.exportFunction(e+\"_eq\"),t.exportFunction(e+\"_eqMixed\"),t.exportFunction(e+\"_eqAffine\"),t.exportFunction(e+\"_copy\"),t.exportFunction(e+\"_copyAffine\"),t.exportFunction(e+\"_zero\"),t.exportFunction(e+\"_zeroAffine\"),t.exportFunction(e+\"_double\"),t.exportFunction(e+\"_doubleAffine\"),t.exportFunction(e+\"_add\"),t.exportFunction(e+\"_addMixed\"),t.exportFunction(e+\"_addAffine\"),t.exportFunction(e+\"_neg\"),t.exportFunction(e+\"_negAffine\"),t.exportFunction(e+\"_sub\"),t.exportFunction(e+\"_subMixed\"),t.exportFunction(e+\"_subAffine\"),t.exportFunction(e+\"_fromMontgomery\"),t.exportFunction(e+\"_fromMontgomeryAffine\"),t.exportFunction(e+\"_toMontgomery\"),t.exportFunction(e+\"_toMontgomeryAffine\"),t.exportFunction(e+\"_timesScalar\"),t.exportFunction(e+\"_timesScalarAffine\"),t.exportFunction(e+\"_normalize\"),t.exportFunction(e+\"_LEMtoU\"),t.exportFunction(e+\"_LEMtoC\"),t.exportFunction(e+\"_UtoLEM\"),t.exportFunction(e+\"_CtoLEM\"),t.exportFunction(e+\"_batchLEMtoU\"),t.exportFunction(e+\"_batchLEMtoC\"),t.exportFunction(e+\"_batchUtoLEM\"),t.exportFunction(e+\"_batchCtoLEM\"),t.exportFunction(e+\"_toAffine\"),t.exportFunction(e+\"_toJacobian\"),t.exportFunction(e+\"_batchToAffine\"),t.exportFunction(e+\"_batchToJacobian\"),t.exportFunction(e+\"_inCurve\"),t.exportFunction(e+\"_inCurveAffine\"),e}});var fc=Yt((b8,Kd)=>{var Mi=Ve(),Eo=ri();Kd.exports=function(t,e,n,o,d){let f=t.modules[o].n64*8,l=t.modules[n].n64*8,s=t.modules[o].q,x=s.minus(Mi(1)),C=0;for(;!x.isOdd();)C++,x=x.shiftRight(1);let g=Mi(2);for(;g.modPow(s.shiftRight(1),s).equals(1);)g=g.add(1);let $=new Array(C+1);$[C]=g.modPow(x,s);let it=C-1;for(;it>=0;)$[it]=$[it+1].modPow(2,s),it--;let q=[],S=Mi(1).shiftLeft(f*8).mod(s);for(let w=0;w<$.length;w++){let c=$[w].times(S).mod(s);q.push(...Eo.bigInt2BytesLE(c,f))}let O=t.alloc(q),M=new Array(C+1);M[0]=Mi(1);for(let w=1;w<=C;w++)M[w]=M[w-1].times(2);let W=[];for(let w=0;w<=C;w++){let c=M[w].modInv(s).times(S).mod(s);W.push(...Eo.bigInt2BytesLE(c,f))}let ct=t.alloc(W),E=g.modPow(2,s),_=[],r=[];for(let w=0;w<=C;w++){let c=E.modPow(Mi(2).pow(w),s),G=s.add(Mi.one).minus(c).modInv(s);_.push(...Eo.bigInt2BytesLE(c.times(S).mod(s),f)),r.push(...Eo.bigInt2BytesLE(G.times(S).mod(s),f))}let Z=t.alloc(_),j=t.alloc(r);function nt(w){let c=0;for(let G=0;G<8;G++)w&1<<G&&(c=c|128>>G);return c}let v=Array(256);for(let w=0;w<256;w++)v[w]=nt(w);let y=t.alloc(v);function T(){let w=t.addFunction(e+\"__log2\");w.addParam(\"n\",\"i32\"),w.setReturnType(\"i32\"),w.addLocal(\"bits\",\"i32\"),w.addLocal(\"aux\",\"i32\");let c=w.getCodeBuilder();w.addCode(c.setLocal(\"aux\",c.i32_shr_u(c.getLocal(\"n\"),c.i32_const(1)))),w.addCode(c.setLocal(\"bits\",c.i32_const(0))),w.addCode(c.block(c.loop(c.br_if(1,c.i32_eqz(c.getLocal(\"aux\"))),c.setLocal(\"aux\",c.i32_shr_u(c.getLocal(\"aux\"),c.i32_const(1))),c.setLocal(\"bits\",c.i32_add(c.getLocal(\"bits\"),c.i32_const(1))),c.br(0)))),w.addCode(c.if(c.i32_ne(c.getLocal(\"n\"),c.i32_shl(c.i32_const(1),c.getLocal(\"bits\"))),c.unreachable())),w.addCode(c.if(c.i32_gt_u(c.getLocal(\"bits\"),c.i32_const(C)),c.unreachable())),w.addCode(c.getLocal(\"bits\"))}function V(){let w=t.addFunction(e+\"_fft\");w.addParam(\"px\",\"i32\"),w.addParam(\"n\",\"i32\"),w.addLocal(\"bits\",\"i32\");let c=w.getCodeBuilder(),G=c.i32_const(t.alloc(f));w.addCode(c.setLocal(\"bits\",c.call(e+\"__log2\",c.getLocal(\"n\"))),c.call(o+\"_one\",G),c.call(e+\"_rawfft\",c.getLocal(\"px\"),c.getLocal(\"bits\"),c.i32_const(0),G))}function rt(){let w=t.addFunction(e+\"_ifft\");w.addParam(\"px\",\"i32\"),w.addParam(\"n\",\"i32\"),w.addLocal(\"bits\",\"i32\"),w.addLocal(\"pInv2\",\"i32\");let c=w.getCodeBuilder();w.addCode(c.setLocal(\"bits\",c.call(e+\"__log2\",c.getLocal(\"n\"))),c.setLocal(\"pInv2\",c.i32_add(c.i32_const(ct),c.i32_mul(c.getLocal(\"bits\"),c.i32_const(f)))),c.call(e+\"_rawfft\",c.getLocal(\"px\"),c.getLocal(\"bits\"),c.i32_const(1),c.getLocal(\"pInv2\")))}function dt(){let w=t.addFunction(e+\"_rawfft\");w.addParam(\"px\",\"i32\"),w.addParam(\"bits\",\"i32\"),w.addParam(\"reverse\",\"i32\"),w.addParam(\"mulFactor\",\"i32\"),w.addLocal(\"s\",\"i32\"),w.addLocal(\"k\",\"i32\"),w.addLocal(\"j\",\"i32\"),w.addLocal(\"m\",\"i32\"),w.addLocal(\"mdiv2\",\"i32\"),w.addLocal(\"n\",\"i32\"),w.addLocal(\"pwm\",\"i32\"),w.addLocal(\"idx1\",\"i32\"),w.addLocal(\"idx2\",\"i32\");let c=w.getCodeBuilder(),G=c.i32_const(t.alloc(f)),R=c.i32_const(t.alloc(l)),F=c.i32_const(t.alloc(l));w.addCode(c.call(e+\"__reversePermutation\",c.getLocal(\"px\"),c.getLocal(\"bits\")),c.setLocal(\"n\",c.i32_shl(c.i32_const(1),c.getLocal(\"bits\"))),c.setLocal(\"s\",c.i32_const(1)),c.block(c.loop(c.br_if(1,c.i32_gt_u(c.getLocal(\"s\"),c.getLocal(\"bits\"))),c.setLocal(\"m\",c.i32_shl(c.i32_const(1),c.getLocal(\"s\"))),c.setLocal(\"pwm\",c.i32_add(c.i32_const(O),c.i32_mul(c.getLocal(\"s\"),c.i32_const(f)))),c.setLocal(\"k\",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_ge_u(c.getLocal(\"k\"),c.getLocal(\"n\"))),c.call(o+\"_one\",G),c.setLocal(\"mdiv2\",c.i32_shr_u(c.getLocal(\"m\"),c.i32_const(1))),c.setLocal(\"j\",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_ge_u(c.getLocal(\"j\"),c.getLocal(\"mdiv2\"))),c.setLocal(\"idx1\",c.i32_add(c.getLocal(\"px\"),c.i32_mul(c.i32_add(c.getLocal(\"k\"),c.getLocal(\"j\")),c.i32_const(l)))),c.setLocal(\"idx2\",c.i32_add(c.getLocal(\"idx1\"),c.i32_mul(c.getLocal(\"mdiv2\"),c.i32_const(l)))),c.call(d,c.getLocal(\"idx2\"),G,R),c.call(n+\"_copy\",c.getLocal(\"idx1\"),F),c.call(n+\"_add\",F,R,c.getLocal(\"idx1\")),c.call(n+\"_sub\",F,R,c.getLocal(\"idx2\")),c.call(o+\"_mul\",G,c.getLocal(\"pwm\"),G),c.setLocal(\"j\",c.i32_add(c.getLocal(\"j\"),c.i32_const(1))),c.br(0))),c.setLocal(\"k\",c.i32_add(c.getLocal(\"k\"),c.getLocal(\"m\"))),c.br(0))),c.setLocal(\"s\",c.i32_add(c.getLocal(\"s\"),c.i32_const(1))),c.br(0))),c.call(e+\"__fftFinal\",c.getLocal(\"px\"),c.getLocal(\"bits\"),c.getLocal(\"reverse\"),c.getLocal(\"mulFactor\")))}function ot(){let w=t.addFunction(e+\"__fftFinal\");w.addParam(\"px\",\"i32\"),w.addParam(\"bits\",\"i32\"),w.addParam(\"reverse\",\"i32\"),w.addParam(\"mulFactor\",\"i32\"),w.addLocal(\"n\",\"i32\"),w.addLocal(\"ndiv2\",\"i32\"),w.addLocal(\"pInv2\",\"i32\"),w.addLocal(\"i\",\"i32\"),w.addLocal(\"mask\",\"i32\"),w.addLocal(\"idx1\",\"i32\"),w.addLocal(\"idx2\",\"i32\");let c=w.getCodeBuilder(),G=c.i32_const(t.alloc(l));w.addCode(c.if(c.i32_and(c.i32_eqz(c.getLocal(\"reverse\")),c.call(o+\"_isOne\",c.getLocal(\"mulFactor\"))),c.ret([])),c.setLocal(\"n\",c.i32_shl(c.i32_const(1),c.getLocal(\"bits\"))),c.setLocal(\"mask\",c.i32_sub(c.getLocal(\"n\"),c.i32_const(1))),c.setLocal(\"i\",c.i32_const(1)),c.setLocal(\"ndiv2\",c.i32_shr_u(c.getLocal(\"n\"),c.i32_const(1))),c.block(c.loop(c.br_if(1,c.i32_ge_u(c.getLocal(\"i\"),c.getLocal(\"ndiv2\"))),c.setLocal(\"idx1\",c.i32_add(c.getLocal(\"px\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.setLocal(\"idx2\",c.i32_add(c.getLocal(\"px\"),c.i32_mul(c.i32_sub(c.getLocal(\"n\"),c.getLocal(\"i\")),c.i32_const(l)))),c.if(c.getLocal(\"reverse\"),c.if(c.call(o+\"_isOne\",c.getLocal(\"mulFactor\")),[...c.call(n+\"_copy\",c.getLocal(\"idx1\"),G),...c.call(n+\"_copy\",c.getLocal(\"idx2\"),c.getLocal(\"idx1\")),...c.call(n+\"_copy\",G,c.getLocal(\"idx2\"))],[...c.call(n+\"_copy\",c.getLocal(\"idx1\"),G),...c.call(d,c.getLocal(\"idx2\"),c.getLocal(\"mulFactor\"),c.getLocal(\"idx1\")),...c.call(d,G,c.getLocal(\"mulFactor\"),c.getLocal(\"idx2\"))]),c.if(c.call(o+\"_isOne\",c.getLocal(\"mulFactor\")),[],[...c.call(d,c.getLocal(\"idx1\"),c.getLocal(\"mulFactor\"),c.getLocal(\"idx1\")),...c.call(d,c.getLocal(\"idx2\"),c.getLocal(\"mulFactor\"),c.getLocal(\"idx2\"))])),c.setLocal(\"i\",c.i32_add(c.getLocal(\"i\"),c.i32_const(1))),c.br(0))),c.if(c.call(o+\"_isOne\",c.getLocal(\"mulFactor\")),[],[...c.call(d,c.getLocal(\"px\"),c.getLocal(\"mulFactor\"),c.getLocal(\"px\")),...c.setLocal(\"idx2\",c.i32_add(c.getLocal(\"px\"),c.i32_mul(c.getLocal(\"ndiv2\"),c.i32_const(l)))),...c.call(d,c.getLocal(\"idx2\"),c.getLocal(\"mulFactor\"),c.getLocal(\"idx2\"))]))}function xt(){let w=t.addFunction(e+\"__reversePermutation\");w.addParam(\"px\",\"i32\"),w.addParam(\"bits\",\"i32\"),w.addLocal(\"n\",\"i32\"),w.addLocal(\"i\",\"i32\"),w.addLocal(\"ri\",\"i32\"),w.addLocal(\"idx1\",\"i32\"),w.addLocal(\"idx2\",\"i32\");let c=w.getCodeBuilder(),G=c.i32_const(t.alloc(l));w.addCode(c.setLocal(\"n\",c.i32_shl(c.i32_const(1),c.getLocal(\"bits\"))),c.setLocal(\"i\",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal(\"i\"),c.getLocal(\"n\"))),c.setLocal(\"idx1\",c.i32_add(c.getLocal(\"px\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.setLocal(\"ri\",c.call(e+\"__rev\",c.getLocal(\"i\"),c.getLocal(\"bits\"))),c.setLocal(\"idx2\",c.i32_add(c.getLocal(\"px\"),c.i32_mul(c.getLocal(\"ri\"),c.i32_const(l)))),c.if(c.i32_lt_u(c.getLocal(\"i\"),c.getLocal(\"ri\")),[...c.call(n+\"_copy\",c.getLocal(\"idx1\"),G),...c.call(n+\"_copy\",c.getLocal(\"idx2\"),c.getLocal(\"idx1\")),...c.call(n+\"_copy\",G,c.getLocal(\"idx2\"))]),c.setLocal(\"i\",c.i32_add(c.getLocal(\"i\"),c.i32_const(1))),c.br(0))))}function pt(){let w=t.addFunction(e+\"__rev\");w.addParam(\"x\",\"i32\"),w.addParam(\"bits\",\"i32\"),w.setReturnType(\"i32\");let c=w.getCodeBuilder();w.addCode(c.i32_rotl(c.i32_add(c.i32_add(c.i32_shl(c.i32_load8_u(c.i32_and(c.getLocal(\"x\"),c.i32_const(255)),y,0),c.i32_const(24)),c.i32_shl(c.i32_load8_u(c.i32_and(c.i32_shr_u(c.getLocal(\"x\"),c.i32_const(8)),c.i32_const(255)),y,0),c.i32_const(16))),c.i32_add(c.i32_shl(c.i32_load8_u(c.i32_and(c.i32_shr_u(c.getLocal(\"x\"),c.i32_const(16)),c.i32_const(255)),y,0),c.i32_const(8)),c.i32_load8_u(c.i32_and(c.i32_shr_u(c.getLocal(\"x\"),c.i32_const(24)),c.i32_const(255)),y,0))),c.getLocal(\"bits\")))}function bt(){let w=t.addFunction(e+\"_fftJoin\");w.addParam(\"pBuff1\",\"i32\"),w.addParam(\"pBuff2\",\"i32\"),w.addParam(\"n\",\"i32\"),w.addParam(\"first\",\"i32\"),w.addParam(\"inc\",\"i32\"),w.addLocal(\"idx1\",\"i32\"),w.addLocal(\"idx2\",\"i32\"),w.addLocal(\"i\",\"i32\");let c=w.getCodeBuilder(),G=c.i32_const(t.alloc(f)),R=c.i32_const(t.alloc(l)),F=c.i32_const(t.alloc(l));w.addCode(c.call(o+\"_copy\",c.getLocal(\"first\"),G),c.setLocal(\"i\",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal(\"i\"),c.getLocal(\"n\"))),c.setLocal(\"idx1\",c.i32_add(c.getLocal(\"pBuff1\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.setLocal(\"idx2\",c.i32_add(c.getLocal(\"pBuff2\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.call(d,c.getLocal(\"idx2\"),G,R),c.call(n+\"_copy\",c.getLocal(\"idx1\"),F),c.call(n+\"_add\",F,R,c.getLocal(\"idx1\")),c.call(n+\"_sub\",F,R,c.getLocal(\"idx2\")),c.call(o+\"_mul\",G,c.getLocal(\"inc\"),G),c.setLocal(\"i\",c.i32_add(c.getLocal(\"i\"),c.i32_const(1))),c.br(0))))}function vt(){let w=t.addFunction(e+\"_fftJoinExt\");w.addParam(\"pBuff1\",\"i32\"),w.addParam(\"pBuff2\",\"i32\"),w.addParam(\"n\",\"i32\"),w.addParam(\"first\",\"i32\"),w.addParam(\"inc\",\"i32\"),w.addParam(\"totalBits\",\"i32\"),w.addLocal(\"idx1\",\"i32\"),w.addLocal(\"idx2\",\"i32\"),w.addLocal(\"i\",\"i32\"),w.addLocal(\"pShiftToM\",\"i32\");let c=w.getCodeBuilder(),G=c.i32_const(t.alloc(f)),R=c.i32_const(t.alloc(l));w.addCode(c.setLocal(\"pShiftToM\",c.i32_add(c.i32_const(Z),c.i32_mul(c.getLocal(\"totalBits\"),c.i32_const(f)))),c.call(o+\"_copy\",c.getLocal(\"first\"),G),c.setLocal(\"i\",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal(\"i\"),c.getLocal(\"n\"))),c.setLocal(\"idx1\",c.i32_add(c.getLocal(\"pBuff1\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.setLocal(\"idx2\",c.i32_add(c.getLocal(\"pBuff2\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.call(n+\"_add\",c.getLocal(\"idx1\"),c.getLocal(\"idx2\"),R),c.call(d,c.getLocal(\"idx2\"),c.getLocal(\"pShiftToM\"),c.getLocal(\"idx2\")),c.call(n+\"_add\",c.getLocal(\"idx1\"),c.getLocal(\"idx2\"),c.getLocal(\"idx2\")),c.call(d,c.getLocal(\"idx2\"),G,c.getLocal(\"idx2\")),c.call(n+\"_copy\",R,c.getLocal(\"idx1\")),c.call(o+\"_mul\",G,c.getLocal(\"inc\"),G),c.setLocal(\"i\",c.i32_add(c.getLocal(\"i\"),c.i32_const(1))),c.br(0))))}function Pt(){let w=t.addFunction(e+\"_fftJoinExtInv\");w.addParam(\"pBuff1\",\"i32\"),w.addParam(\"pBuff2\",\"i32\"),w.addParam(\"n\",\"i32\"),w.addParam(\"first\",\"i32\"),w.addParam(\"inc\",\"i32\"),w.addParam(\"totalBits\",\"i32\"),w.addLocal(\"idx1\",\"i32\"),w.addLocal(\"idx2\",\"i32\"),w.addLocal(\"i\",\"i32\"),w.addLocal(\"pShiftToM\",\"i32\"),w.addLocal(\"pSConst\",\"i32\");let c=w.getCodeBuilder(),G=c.i32_const(t.alloc(f)),R=c.i32_const(t.alloc(l));w.addCode(c.setLocal(\"pShiftToM\",c.i32_add(c.i32_const(Z),c.i32_mul(c.getLocal(\"totalBits\"),c.i32_const(f)))),c.setLocal(\"pSConst\",c.i32_add(c.i32_const(j),c.i32_mul(c.getLocal(\"totalBits\"),c.i32_const(f)))),c.call(o+\"_copy\",c.getLocal(\"first\"),G),c.setLocal(\"i\",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal(\"i\"),c.getLocal(\"n\"))),c.setLocal(\"idx1\",c.i32_add(c.getLocal(\"pBuff1\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.setLocal(\"idx2\",c.i32_add(c.getLocal(\"pBuff2\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.call(d,c.getLocal(\"idx2\"),G,R),c.call(n+\"_sub\",c.getLocal(\"idx1\"),R,c.getLocal(\"idx2\")),c.call(d,c.getLocal(\"idx2\"),c.getLocal(\"pSConst\"),c.getLocal(\"idx2\")),c.call(d,c.getLocal(\"idx1\"),c.getLocal(\"pShiftToM\"),c.getLocal(\"idx1\")),c.call(n+\"_sub\",R,c.getLocal(\"idx1\"),c.getLocal(\"idx1\")),c.call(d,c.getLocal(\"idx1\"),c.getLocal(\"pSConst\"),c.getLocal(\"idx1\")),c.call(o+\"_mul\",G,c.getLocal(\"inc\"),G),c.setLocal(\"i\",c.i32_add(c.getLocal(\"i\"),c.i32_const(1))),c.br(0))))}function Ht(){let w=t.addFunction(e+\"_prepareLagrangeEvaluation\");w.addParam(\"pBuff1\",\"i32\"),w.addParam(\"pBuff2\",\"i32\"),w.addParam(\"n\",\"i32\"),w.addParam(\"first\",\"i32\"),w.addParam(\"inc\",\"i32\"),w.addParam(\"totalBits\",\"i32\"),w.addLocal(\"idx1\",\"i32\"),w.addLocal(\"idx2\",\"i32\"),w.addLocal(\"i\",\"i32\"),w.addLocal(\"pShiftToM\",\"i32\"),w.addLocal(\"pSConst\",\"i32\");let c=w.getCodeBuilder(),G=c.i32_const(t.alloc(f)),R=c.i32_const(t.alloc(l));w.addCode(c.setLocal(\"pShiftToM\",c.i32_add(c.i32_const(Z),c.i32_mul(c.getLocal(\"totalBits\"),c.i32_const(f)))),c.setLocal(\"pSConst\",c.i32_add(c.i32_const(j),c.i32_mul(c.getLocal(\"totalBits\"),c.i32_const(f)))),c.call(o+\"_copy\",c.getLocal(\"first\"),G),c.setLocal(\"i\",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal(\"i\"),c.getLocal(\"n\"))),c.setLocal(\"idx1\",c.i32_add(c.getLocal(\"pBuff1\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.setLocal(\"idx2\",c.i32_add(c.getLocal(\"pBuff2\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.call(d,c.getLocal(\"idx1\"),c.getLocal(\"pShiftToM\"),R),c.call(n+\"_sub\",c.getLocal(\"idx2\"),R,R),c.call(n+\"_sub\",c.getLocal(\"idx1\"),c.getLocal(\"idx2\"),c.getLocal(\"idx2\")),c.call(d,R,c.getLocal(\"pSConst\"),c.getLocal(\"idx1\")),c.call(d,c.getLocal(\"idx2\"),G,c.getLocal(\"idx2\")),c.call(o+\"_mul\",G,c.getLocal(\"inc\"),G),c.setLocal(\"i\",c.i32_add(c.getLocal(\"i\"),c.i32_const(1))),c.br(0))))}function m(){let w=t.addFunction(e+\"_fftMix\");w.addParam(\"pBuff\",\"i32\"),w.addParam(\"n\",\"i32\"),w.addParam(\"exp\",\"i32\"),w.addLocal(\"nGroups\",\"i32\"),w.addLocal(\"nPerGroup\",\"i32\"),w.addLocal(\"nPerGroupDiv2\",\"i32\"),w.addLocal(\"pairOffset\",\"i32\"),w.addLocal(\"idx1\",\"i32\"),w.addLocal(\"idx2\",\"i32\"),w.addLocal(\"i\",\"i32\"),w.addLocal(\"j\",\"i32\"),w.addLocal(\"pwm\",\"i32\");let c=w.getCodeBuilder(),G=c.i32_const(t.alloc(f)),R=c.i32_const(t.alloc(l)),F=c.i32_const(t.alloc(l));w.addCode(c.setLocal(\"nPerGroup\",c.i32_shl(c.i32_const(1),c.getLocal(\"exp\"))),c.setLocal(\"nPerGroupDiv2\",c.i32_shr_u(c.getLocal(\"nPerGroup\"),c.i32_const(1))),c.setLocal(\"nGroups\",c.i32_shr_u(c.getLocal(\"n\"),c.getLocal(\"exp\"))),c.setLocal(\"pairOffset\",c.i32_mul(c.getLocal(\"nPerGroupDiv2\"),c.i32_const(l))),c.setLocal(\"pwm\",c.i32_add(c.i32_const(O),c.i32_mul(c.getLocal(\"exp\"),c.i32_const(f)))),c.setLocal(\"i\",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal(\"i\"),c.getLocal(\"nGroups\"))),c.call(o+\"_one\",G),c.setLocal(\"j\",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal(\"j\"),c.getLocal(\"nPerGroupDiv2\"))),c.setLocal(\"idx1\",c.i32_add(c.getLocal(\"pBuff\"),c.i32_mul(c.i32_add(c.i32_mul(c.getLocal(\"i\"),c.getLocal(\"nPerGroup\")),c.getLocal(\"j\")),c.i32_const(l)))),c.setLocal(\"idx2\",c.i32_add(c.getLocal(\"idx1\"),c.getLocal(\"pairOffset\"))),c.call(d,c.getLocal(\"idx2\"),G,R),c.call(n+\"_copy\",c.getLocal(\"idx1\"),F),c.call(n+\"_add\",F,R,c.getLocal(\"idx1\")),c.call(n+\"_sub\",F,R,c.getLocal(\"idx2\")),c.call(o+\"_mul\",G,c.getLocal(\"pwm\"),G),c.setLocal(\"j\",c.i32_add(c.getLocal(\"j\"),c.i32_const(1))),c.br(0))),c.setLocal(\"i\",c.i32_add(c.getLocal(\"i\"),c.i32_const(1))),c.br(0))))}function a(){let w=t.addFunction(e+\"_fftFinal\");w.addParam(\"pBuff\",\"i32\"),w.addParam(\"n\",\"i32\"),w.addParam(\"factor\",\"i32\"),w.addLocal(\"idx1\",\"i32\"),w.addLocal(\"idx2\",\"i32\"),w.addLocal(\"i\",\"i32\"),w.addLocal(\"ndiv2\",\"i32\");let c=w.getCodeBuilder(),G=c.i32_const(t.alloc(l));w.addCode(c.setLocal(\"ndiv2\",c.i32_shr_u(c.getLocal(\"n\"),c.i32_const(1))),c.if(c.i32_and(c.getLocal(\"n\"),c.i32_const(1)),c.call(d,c.i32_add(c.getLocal(\"pBuff\"),c.i32_mul(c.getLocal(\"ndiv2\"),c.i32_const(l))),c.getLocal(\"factor\"),c.i32_add(c.getLocal(\"pBuff\"),c.i32_mul(c.getLocal(\"ndiv2\"),c.i32_const(l))))),c.setLocal(\"i\",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_ge_u(c.getLocal(\"i\"),c.getLocal(\"ndiv2\"))),c.setLocal(\"idx1\",c.i32_add(c.getLocal(\"pBuff\"),c.i32_mul(c.getLocal(\"i\"),c.i32_const(l)))),c.setLocal(\"idx2\",c.i32_add(c.getLocal(\"pBuff\"),c.i32_mul(c.i32_sub(c.i32_sub(c.getLocal(\"n\"),c.i32_const(1)),c.getLocal(\"i\")),c.i32_const(l)))),c.call(d,c.getLocal(\"idx2\"),c.getLocal(\"factor\"),G),c.call(d,c.getLocal(\"idx1\"),c.getLocal(\"factor\"),c.getLocal(\"idx2\")),c.call(n+\"_copy\",G,c.getLocal(\"idx1\")),c.setLocal(\"i\",c.i32_add(c.getLocal(\"i\"),c.i32_const(1))),c.br(0))))}pt(),xt(),ot(),dt(),T(),V(),rt(),bt(),vt(),Pt(),m(),a(),Ht(),t.exportFunction(e+\"_fft\"),t.exportFunction(e+\"_ifft\"),t.exportFunction(e+\"_rawfft\"),t.exportFunction(e+\"_fftJoin\"),t.exportFunction(e+\"_fftJoinExt\"),t.exportFunction(e+\"_fftJoinExtInv\"),t.exportFunction(e+\"_fftMix\"),t.exportFunction(e+\"_fftFinal\"),t.exportFunction(e+\"_prepareLagrangeEvaluation\")}});var _c=Yt((y8,jd)=>{jd.exports=function(t,e,n){let d=t.modules[n].n64*8;function h(){let L=t.addFunction(e+\"_zero\");L.addParam(\"px\",\"i32\"),L.addParam(\"n\",\"i32\"),L.addLocal(\"lastp\",\"i32\"),L.addLocal(\"p\",\"i32\");let l=L.getCodeBuilder();L.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(d)))),l.block(l.loop(l.br_if(1,l.i32_eq(l.getLocal(\"p\"),l.getLocal(\"lastp\"))),l.call(n+\"_zero\",l.getLocal(\"p\")),l.setLocal(\"p\",l.i32_add(l.getLocal(\"p\"),l.i32_const(d))),l.br(0))))}function f(){let L=t.addFunction(e+\"_constructLC\");L.addParam(\"ppolynomials\",\"i32\"),L.addParam(\"psignals\",\"i32\"),L.addParam(\"nSignals\",\"i32\"),L.addParam(\"pres\",\"i32\"),L.addLocal(\"i\",\"i32\"),L.addLocal(\"j\",\"i32\"),L.addLocal(\"pp\",\"i32\"),L.addLocal(\"ps\",\"i32\"),L.addLocal(\"pd\",\"i32\"),L.addLocal(\"ncoefs\",\"i32\");let l=L.getCodeBuilder(),s=l.i32_const(t.alloc(d));L.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(d)))),l.setLocal(\"pp\",l.i32_add(l.getLocal(\"pp\"),l.i32_const(4))),l.call(n+\"_mul\",l.getLocal(\"ps\"),l.getLocal(\"pp\"),s),l.call(n+\"_add\",s,l.getLocal(\"pd\"),l.getLocal(\"pd\")),l.setLocal(\"pp\",l.i32_add(l.getLocal(\"pp\"),l.i32_const(d))),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(d))),l.setLocal(\"i\",l.i32_add(l.getLocal(\"i\"),l.i32_const(1))),l.br(0))))}return h(),f(),t.exportFunction(e+\"_zero\"),t.exportFunction(e+\"_constructLC\"),e}});var hc=Yt((w8,Vd)=>{Vd.exports=function(t,e,n){let d=t.modules[n].n64*8;function h(){let l=t.addFunction(e+\"_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\");let s=l.getCodeBuilder(),x=s.i32_const(t.alloc(d));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(d)))),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal(\"ita\"),s.getLocal(\"last\"))),s.call(n+\"_zero\",s.getLocal(\"ita\")),s.call(n+\"_zero\",s.getLocal(\"itb\")),s.setLocal(\"ita\",s.i32_add(s.getLocal(\"ita\"),s.i32_const(d))),s.setLocal(\"itb\",s.i32_add(s.getLocal(\"itb\"),s.i32_const(d))),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(d+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(d+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(d+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(d+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(d)))),s.call(n+\"_mul\",s.i32_add(s.getLocal(\"pWitness\"),s.i32_mul(s.i32_sub(s.getLocal(\"s\"),s.getLocal(\"offsetWitness\")),s.i32_const(d))),s.i32_add(s.getLocal(\"it\"),s.i32_const(12)),x),s.call(n+\"_add\",s.getLocal(\"pOut\"),x,s.getLocal(\"pOut\")),s.setLocal(\"it\",s.i32_add(s.getLocal(\"it\"),s.i32_const(d+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(d)))),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal(\"ita\"),s.getLocal(\"last\"))),s.call(n+\"_mul\",s.getLocal(\"ita\"),s.getLocal(\"itb\"),s.getLocal(\"it\")),s.setLocal(\"ita\",s.i32_add(s.getLocal(\"ita\"),s.i32_const(d))),s.setLocal(\"itb\",s.i32_add(s.getLocal(\"itb\"),s.i32_const(d))),s.setLocal(\"it\",s.i32_add(s.getLocal(\"it\"),s.i32_const(d))),s.br(0))))}function f(){let l=t.addFunction(e+\"_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\");let s=l.getCodeBuilder(),x=s.i32_const(t.alloc(d));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(d)))),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal(\"ita\"),s.getLocal(\"last\"))),s.call(n+\"_mul\",s.getLocal(\"ita\"),s.getLocal(\"itb\"),x),s.call(n+\"_sub\",x,s.getLocal(\"itc\"),s.getLocal(\"itp\")),s.setLocal(\"ita\",s.i32_add(s.getLocal(\"ita\"),s.i32_const(d))),s.setLocal(\"itb\",s.i32_add(s.getLocal(\"itb\"),s.i32_const(d))),s.setLocal(\"itc\",s.i32_add(s.getLocal(\"itc\"),s.i32_const(d))),s.setLocal(\"itp\",s.i32_add(s.getLocal(\"itp\"),s.i32_const(d))),s.br(0))))}function L(){let l=t.addFunction(e+\"_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\");let 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(d)))),s.block(s.loop(s.br_if(1,s.i32_eq(s.getLocal(\"ita\"),s.getLocal(\"last\"))),s.call(n+\"_add\",s.getLocal(\"ita\"),s.getLocal(\"itb\"),s.getLocal(\"itr\")),s.setLocal(\"ita\",s.i32_add(s.getLocal(\"ita\"),s.i32_const(d))),s.setLocal(\"itb\",s.i32_add(s.getLocal(\"itb\"),s.i32_const(d))),s.setLocal(\"itr\",s.i32_add(s.getLocal(\"itr\"),s.i32_const(d))),s.br(0))))}return h(),f(),L(),t.exportFunction(e+\"_buildABC\"),t.exportFunction(e+\"_joinABC\"),t.exportFunction(e+\"_batchAdd\"),e}});var gc=Yt((F8,Wd)=>{Wd.exports=function(t,e,n,o,d,h,f,L){let l=t.addFunction(e);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\");let s=l.getCodeBuilder(),x=s.i32_const(t.alloc(f));l.addCode(s.setLocal(\"pFrom\",s.getLocal(\"pIn\")),s.setLocal(\"pTo\",s.getLocal(\"pOut\"))),l.addCode(s.call(o+\"_copy\",s.getLocal(\"pFirst\"),x)),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(L,s.getLocal(\"pFrom\"),x,s.getLocal(\"pTo\")),s.setLocal(\"pFrom\",s.i32_add(s.getLocal(\"pFrom\"),s.i32_const(d))),s.setLocal(\"pTo\",s.i32_add(s.getLocal(\"pTo\"),s.i32_const(h))),s.call(o+\"_mul\",x,s.getLocal(\"pInc\"),x),s.setLocal(\"i\",s.i32_add(s.getLocal(\"i\"),s.i32_const(1))),s.br(0)))),t.exportFunction(e)}});var tu=Yt((A8,Jd)=>{var zt=Ve(),oe=ri(),Q0=Io(),D0=cc(),Yd=lc(),Z0=dc(),Xd=uc(),pc=fc(),H0=_c(),$0=hc(),Fa=gc();Jd.exports=function(t,e){let n=e||\"bn128\";if(t.modules[n])return n;let o=zt(\"21888242871839275222246405745257275088696311157297823662689037894645226208583\"),d=zt(\"21888242871839275222246405745257275088548364400416034343698204186575808495617\"),h=Math.floor((o.minus(1).bitLength()-1)/64)+1,f=h*8,L=f,l=f,s=l*2,x=l*6,C=l*12,g=t.alloc(oe.bigInt2BytesLE(d,L)),$=Q0(t,o,\"f1m\");D0(t,d,\"fr\",\"frm\");let it=t.alloc(oe.bigInt2BytesLE(ct(zt(3)),l)),q=Xd(t,\"g1m\",\"f1m\",it);pc(t,\"frm\",\"frm\",\"frm\",\"frm_mul\"),H0(t,\"pol\",\"frm\"),$0(t,\"qap\",\"frm\");let S=Yd(t,\"f1m_neg\",\"f2m\",\"f1m\"),O=t.alloc([...oe.bigInt2BytesLE(ct(zt(\"19485874751759354771024239261021720505790618469301721065564631296452457478373\")),l),...oe.bigInt2BytesLE(ct(zt(\"266929791119991161246907387137283842545076965332900288569378510910307636690\")),l)]),M=Xd(t,\"g2m\",\"f2m\",O);function W(u,b){let B=t.addFunction(u);B.addParam(\"pG\",\"i32\"),B.addParam(\"pFr\",\"i32\"),B.addParam(\"pr\",\"i32\");let p=B.getCodeBuilder(),P=p.i32_const(t.alloc(f));B.addCode(p.call(\"frm_fromMontgomery\",p.getLocal(\"pFr\"),P),p.call(b,p.getLocal(\"pG\"),P,p.i32_const(f),p.getLocal(\"pr\"))),t.exportFunction(u)}W(\"g1m_timesFr\",\"g1m_timesScalar\"),pc(t,\"g1m\",\"g1m\",\"frm\",\"g1m_timesFr\"),W(\"g2m_timesFr\",\"g2m_timesScalar\"),pc(t,\"g2m\",\"g2m\",\"frm\",\"g2m_timesFr\"),W(\"g1m_timesFrAffine\",\"g1m_timesScalarAffine\"),W(\"g2m_timesFrAffine\",\"g2m_timesScalarAffine\"),Fa(t,\"frm_batchApplyKey\",\"fmr\",\"frm\",f,f,f,\"frm_mul\"),Fa(t,\"g1m_batchApplyKey\",\"g1m\",\"frm\",f*3,f*3,f,\"g1m_timesFr\"),Fa(t,\"g1m_batchApplyKeyMixed\",\"g1m\",\"frm\",f*2,f*3,f,\"g1m_timesFrAffine\"),Fa(t,\"g2m_batchApplyKey\",\"g2m\",\"frm\",f*2*3,f*3*2,f,\"g2m_timesFr\"),Fa(t,\"g2m_batchApplyKeyMixed\",\"g2m\",\"frm\",f*2*2,f*3*2,f,\"g2m_timesFrAffine\");function ct(u){return zt(u).times(zt.one.shiftLeft(l*8)).mod(o)}let E=[zt(\"1\"),zt(\"2\"),zt.one],_=t.alloc([...oe.bigInt2BytesLE(ct(E[0]),l),...oe.bigInt2BytesLE(ct(E[1]),l),...oe.bigInt2BytesLE(ct(E[2]),l)]),r=[zt.zero,zt.one,zt.zero],Z=t.alloc([...oe.bigInt2BytesLE(ct(r[0]),l),...oe.bigInt2BytesLE(ct(r[1]),l),...oe.bigInt2BytesLE(ct(r[2]),l)]),j=[[zt(\"10857046999023057135944570762232829481370756359578518086990519993285655852781\"),zt(\"11559732032986387107991004021392285783925812861821192530917403151452391805634\")],[zt(\"8495653923123431417604973247489272438418190587263600148770280649306958101930\"),zt(\"4082367875863433681332203403145435568316851327593401208105741076214120093531\")],[zt.one,zt.zero]],nt=t.alloc([...oe.bigInt2BytesLE(ct(j[0][0]),l),...oe.bigInt2BytesLE(ct(j[0][1]),l),...oe.bigInt2BytesLE(ct(j[1][0]),l),...oe.bigInt2BytesLE(ct(j[1][1]),l),...oe.bigInt2BytesLE(ct(j[2][0]),l),...oe.bigInt2BytesLE(ct(j[2][1]),l)]),v=[[zt.zero,zt.zero],[zt.one,zt.zero],[zt.zero,zt.zero]],y=t.alloc([...oe.bigInt2BytesLE(ct(v[0][0]),l),...oe.bigInt2BytesLE(ct(v[0][1]),l),...oe.bigInt2BytesLE(ct(v[1][0]),l),...oe.bigInt2BytesLE(ct(v[1][1]),l),...oe.bigInt2BytesLE(ct(v[2][0]),l),...oe.bigInt2BytesLE(ct(v[2][1]),l)]),T=t.alloc([...oe.bigInt2BytesLE(ct(1),l),...oe.bigInt2BytesLE(ct(0),l),...oe.bigInt2BytesLE(ct(0),l),...oe.bigInt2BytesLE(ct(0),l),...oe.bigInt2BytesLE(ct(0),l),...oe.bigInt2BytesLE(ct(0),l),...oe.bigInt2BytesLE(ct(0),l),...oe.bigInt2BytesLE(ct(0),l),...oe.bigInt2BytesLE(ct(0),l),...oe.bigInt2BytesLE(ct(0),l),...oe.bigInt2BytesLE(ct(0),l),...oe.bigInt2BytesLE(ct(0),l)]),V=t.alloc([...oe.bigInt2BytesLE(ct(9),l),...oe.bigInt2BytesLE(ct(1),l)]),rt=t.alloc([...oe.bigInt2BytesLE(ct(zt(2).modInv(o)),l),...oe.bigInt2BytesLE(zt(0),l)]),dt=V,ot=t.alloc([...oe.bigInt2BytesLE(ct(\"19485874751759354771024239261021720505790618469301721065564631296452457478373\"),l),...oe.bigInt2BytesLE(ct(\"266929791119991161246907387137283842545076965332900288569378510910307636690\"),l)]);function xt(){let u=t.addFunction(n+\"_mulNR6\");u.addParam(\"x\",\"i32\"),u.addParam(\"pr\",\"i32\");let b=u.getCodeBuilder();u.addCode(b.call(S+\"_mul\",b.i32_const(V),b.getLocal(\"x\"),b.getLocal(\"pr\")))}xt();let pt=Z0(t,n+\"_mulNR6\",\"f6m\",\"f2m\");function bt(){let u=t.addFunction(n+\"_mulNR12\");u.addParam(\"x\",\"i32\"),u.addParam(\"pr\",\"i32\");let b=u.getCodeBuilder();u.addCode(b.call(S+\"_mul\",b.i32_const(V),b.i32_add(b.getLocal(\"x\"),b.i32_const(f*4)),b.getLocal(\"pr\")),b.call(S+\"_copy\",b.getLocal(\"x\"),b.i32_add(b.getLocal(\"pr\"),b.i32_const(f*2))),b.call(S+\"_copy\",b.i32_add(b.getLocal(\"x\"),b.i32_const(f*2)),b.i32_add(b.getLocal(\"pr\"),b.i32_const(f*4))))}bt();let vt=Yd(t,n+\"_mulNR12\",\"ftm\",pt),Pt=zt(\"29793968203157093288\"),Ht=St(Pt),m=t.alloc(Ht),a=!1,w=3*s,c=Ht.length-1,R=Ht.reduce((u,b)=>u+(b!=0?1:0),0)+c+1,F=3*2*f,U=3*f*2+R*w,A=!1;t.modules[n]={n64:h,pG1gen:_,pG1zero:Z,pG1b:it,pG2gen:nt,pG2zero:y,pG2b:O,pq:t.modules.f1m.pq,pr:g,pOneT:T,prePSize:F,preQSize:U,r:d.toString(),q:o.toString()};let et=zt(\"4965661367192848881\");function Lt(u){let b=u,B=[];for(;b.gt(zt.zero);){if(b.isOdd()){let p=2-b.mod(4).toJSNumber();B.push(p),b=b.minus(p)}else B.push(0);b=b.shiftRight(1)}return B}function St(u){let b=u,B=[];for(;b.gt(zt.zero);)b.isOdd()?B.push(1):B.push(0),b=b.shiftRight(1);return B}function qt(){let u=t.addFunction(n+\"_prepareG1\");u.addParam(\"pP\",\"i32\"),u.addParam(\"ppreP\",\"i32\");let b=u.getCodeBuilder();u.addCode(b.call(q+\"_normalize\",b.getLocal(\"pP\"),b.getLocal(\"ppreP\")))}function Dt(){let u=t.addFunction(n+\"_prepAddStep\");u.addParam(\"pQ\",\"i32\"),u.addParam(\"pR\",\"i32\"),u.addParam(\"pCoef\",\"i32\");let b=u.getCodeBuilder(),B=b.getLocal(\"pQ\"),p=b.i32_add(b.getLocal(\"pQ\"),b.i32_const(s)),P=b.getLocal(\"pR\"),k=b.i32_add(b.getLocal(\"pR\"),b.i32_const(s)),Q=b.i32_add(b.getLocal(\"pR\"),b.i32_const(2*s)),Y=b.getLocal(\"pCoef\"),H=b.i32_add(b.getLocal(\"pCoef\"),b.i32_const(s)),tt=b.i32_add(b.getLocal(\"pCoef\"),b.i32_const(2*s)),X=H,lt=b.i32_const(t.alloc(s)),ht=b.i32_const(t.alloc(s)),yt=b.i32_const(t.alloc(s)),At=b.i32_const(t.alloc(s)),Ft=b.i32_const(t.alloc(s)),Mt=b.i32_const(t.alloc(s)),Qt=b.i32_const(t.alloc(s));u.addCode(b.call(S+\"_mul\",B,Q,X),b.call(S+\"_sub\",P,X,X),b.call(S+\"_mul\",p,Q,lt),b.call(S+\"_sub\",k,lt,lt),b.call(S+\"_square\",X,ht),b.call(S+\"_square\",lt,yt),b.call(S+\"_mul\",X,ht,At),b.call(S+\"_mul\",P,ht,Ft),b.call(S+\"_add\",Ft,Ft,Qt),b.call(S+\"_mul\",Q,yt,Mt),b.call(S+\"_add\",At,Mt,Mt),b.call(S+\"_sub\",Mt,Qt,Mt),b.call(S+\"_mul\",X,Mt,P),b.call(S+\"_mul\",At,k,k),b.call(S+\"_sub\",Ft,Mt,Qt),b.call(S+\"_mul\",lt,Qt,Qt),b.call(S+\"_sub\",Qt,k,k),b.call(S+\"_mul\",Q,At,Q),b.call(S+\"_mul\",X,p,Qt),b.call(S+\"_mul\",lt,B,Y),b.call(S+\"_sub\",Y,Qt,Y),b.call(S+\"_mul\",Y,b.i32_const(dt),Y),b.call(S+\"_neg\",lt,tt))}function kt(){let u=t.addFunction(n+\"_prepDblStep\");u.addParam(\"pR\",\"i32\"),u.addParam(\"pCoef\",\"i32\");let b=u.getCodeBuilder(),B=b.getLocal(\"pR\"),p=b.i32_add(b.getLocal(\"pR\"),b.i32_const(s)),P=b.i32_add(b.getLocal(\"pR\"),b.i32_const(2*s)),k=b.getLocal(\"pCoef\"),Q=b.i32_add(b.getLocal(\"pCoef\"),b.i32_const(s)),Y=b.i32_add(b.getLocal(\"pCoef\"),b.i32_const(2*s)),H=b.i32_const(t.alloc(s)),tt=b.i32_const(t.alloc(s)),X=b.i32_const(t.alloc(s)),lt=b.i32_const(t.alloc(s)),ht=b.i32_const(t.alloc(s)),yt=b.i32_const(t.alloc(s)),At=b.i32_const(t.alloc(s)),Ft=b.i32_const(t.alloc(s)),Mt=b.i32_const(t.alloc(s)),Qt=b.i32_const(t.alloc(s)),$t=b.i32_const(t.alloc(s)),Nt=b.i32_const(t.alloc(s));u.addCode(b.call(S+\"_mul\",p,b.i32_const(rt),H),b.call(S+\"_mul\",B,H,H),b.call(S+\"_square\",p,tt),b.call(S+\"_square\",P,X),b.call(S+\"_add\",X,X,lt),b.call(S+\"_add\",lt,X,lt),b.call(S+\"_mul\",b.i32_const(ot),lt,ht),b.call(S+\"_add\",ht,ht,yt),b.call(S+\"_add\",ht,yt,yt),b.call(S+\"_add\",tt,yt,At),b.call(S+\"_mul\",At,b.i32_const(rt),At),b.call(S+\"_add\",tt,X,Nt),b.call(S+\"_add\",p,P,Ft),b.call(S+\"_square\",Ft,Ft),b.call(S+\"_sub\",Ft,Nt,Ft),b.call(S+\"_sub\",ht,tt,Mt),b.call(S+\"_square\",B,Qt),b.call(S+\"_square\",ht,$t),b.call(S+\"_sub\",tt,yt,Nt),b.call(S+\"_mul\",H,Nt,B),b.call(S+\"_add\",$t,$t,Nt),b.call(S+\"_add\",$t,Nt,Nt),b.call(S+\"_square\",At,p),b.call(S+\"_sub\",p,Nt,p),b.call(S+\"_mul\",tt,Ft,P),b.call(S+\"_mul\",b.i32_const(dt),Mt,k),b.call(S+\"_neg\",Ft,Q),b.call(S+\"_add\",Qt,Qt,Y),b.call(S+\"_add\",Qt,Y,Y))}function Bt(){let u=t.addFunction(n+\"_mulByQ\");u.addParam(\"p1\",\"i32\"),u.addParam(\"pr\",\"i32\");let b=u.getCodeBuilder(),B=b.getLocal(\"p1\"),p=b.i32_add(b.getLocal(\"p1\"),b.i32_const(s)),P=b.i32_add(b.getLocal(\"p1\"),b.i32_const(s*2)),k=b.getLocal(\"pr\"),Q=b.i32_add(b.getLocal(\"pr\"),b.i32_const(s)),Y=b.i32_add(b.getLocal(\"pr\"),b.i32_const(s*2)),H=b.i32_const(t.alloc([...oe.bigInt2BytesLE(ct(\"21575463638280843010398324269430826099269044274347216827212613867836435027261\"),l),...oe.bigInt2BytesLE(ct(\"10307601595873709700152284273816112264069230130616436755625194854815875713954\"),l)])),tt=b.i32_const(t.alloc([...oe.bigInt2BytesLE(ct(\"2821565182194536844548159561693502659359617185244120367078079554186484126554\"),l),...oe.bigInt2BytesLE(ct(\"3505843767911556378687030309984248845540243509899259641013678093033130930403\"),l)]));u.addCode(b.call(S+\"_conjugate\",B,k),b.call(S+\"_mul\",H,k,k),b.call(S+\"_conjugate\",p,Q),b.call(S+\"_mul\",tt,Q,Q),b.call(S+\"_conjugate\",P,Y))}function Tt(){Bt();let u=t.addFunction(n+\"_prepareG2\");u.addParam(\"pQ\",\"i32\"),u.addParam(\"ppreQ\",\"i32\"),u.addLocal(\"pCoef\",\"i32\"),u.addLocal(\"i\",\"i32\");let b=u.getCodeBuilder(),B=b.getLocal(\"pQ\"),p=b.i32_add(b.getLocal(\"pQ\"),b.i32_const(s)),P=b.i32_add(b.getLocal(\"pQ\"),b.i32_const(s*2)),k=t.alloc(s*3),Q=b.i32_const(k),Y=b.i32_const(k),H=b.i32_const(k+s),tt=b.i32_const(k+2*s),X=b.i32_add(b.getLocal(\"ppreQ\"),b.i32_const(0)),lt=b.i32_add(b.getLocal(\"ppreQ\"),b.i32_const(s)),ht=b.i32_add(b.getLocal(\"ppreQ\"),b.i32_const(s*2)),yt=t.alloc(s*3),At=b.i32_const(yt),Ft=t.alloc(s*3),Mt=b.i32_const(Ft),Qt=b.i32_const(Ft),$t=b.i32_const(Ft+s),Nt=b.i32_const(Ft+s*2);u.addCode(b.call(M+\"_normalize\",B,X),b.call(S+\"_copy\",X,Y),b.call(S+\"_copy\",lt,H),b.call(S+\"_one\",tt)),u.addCode(b.setLocal(\"pCoef\",b.i32_add(b.getLocal(\"ppreQ\"),b.i32_const(s*3))),b.setLocal(\"i\",b.i32_const(Ht.length-2)),b.block(b.loop(b.call(n+\"_prepDblStep\",Q,b.getLocal(\"pCoef\")),b.setLocal(\"pCoef\",b.i32_add(b.getLocal(\"pCoef\"),b.i32_const(w))),b.if(b.i32_load8_s(b.getLocal(\"i\"),m),[...b.call(n+\"_prepAddStep\",X,Q,b.getLocal(\"pCoef\")),...b.setLocal(\"pCoef\",b.i32_add(b.getLocal(\"pCoef\"),b.i32_const(w)))]),b.br_if(1,b.i32_eqz(b.getLocal(\"i\"))),b.setLocal(\"i\",b.i32_sub(b.getLocal(\"i\"),b.i32_const(1))),b.br(0)))),u.addCode(b.call(n+\"_mulByQ\",X,At),b.call(n+\"_mulByQ\",At,Mt)),a&&u.addCode(b.call(S+\"_neg\",H,H)),u.addCode(b.call(S+\"_neg\",$t,$t),b.call(n+\"_prepAddStep\",At,Q,b.getLocal(\"pCoef\")),b.setLocal(\"pCoef\",b.i32_add(b.getLocal(\"pCoef\"),b.i32_const(w))),b.call(n+\"_prepAddStep\",Mt,Q,b.getLocal(\"pCoef\")),b.setLocal(\"pCoef\",b.i32_add(b.getLocal(\"pCoef\"),b.i32_const(w))))}function wt(){let u=t.addFunction(n+\"__mulBy024Old\");u.addParam(\"pEll0\",\"i32\"),u.addParam(\"pEllVW\",\"i32\"),u.addParam(\"pEllVV\",\"i32\"),u.addParam(\"pR\",\"i32\");let b=u.getCodeBuilder(),B=b.getLocal(\"pEll0\"),p=b.getLocal(\"pEllVV\"),P=b.getLocal(\"pEllVW\"),k=b.getLocal(\"pR\"),Q=t.alloc(C),Y=b.i32_const(Q),H=b.i32_const(Q),tt=b.i32_const(Q+s),X=b.i32_const(Q+s*2),lt=b.i32_const(Q+s*3),ht=b.i32_const(Q+s*4),yt=b.i32_const(Q+s*5);u.addCode(b.call(S+\"_copy\",B,H),b.call(S+\"_zero\",tt),b.call(S+\"_copy\",p,X),b.call(S+\"_zero\",lt),b.call(S+\"_copy\",P,ht),b.call(S+\"_zero\",yt),b.call(vt+\"_mul\",Y,k,k))}function Rt(){let u=t.addFunction(n+\"__mulBy024\");u.addParam(\"pEll0\",\"i32\"),u.addParam(\"pEllVW\",\"i32\"),u.addParam(\"pEllVV\",\"i32\"),u.addParam(\"pR\",\"i32\");let b=u.getCodeBuilder(),B=b.getLocal(\"pEll0\"),p=b.getLocal(\"pEllVV\"),P=b.getLocal(\"pEllVW\"),k=b.getLocal(\"pR\"),Q=b.i32_add(b.getLocal(\"pR\"),b.i32_const(2*f)),Y=b.i32_add(b.getLocal(\"pR\"),b.i32_const(4*f)),H=b.i32_add(b.getLocal(\"pR\"),b.i32_const(6*f)),tt=b.i32_add(b.getLocal(\"pR\"),b.i32_const(8*f)),X=b.i32_add(b.getLocal(\"pR\"),b.i32_const(10*f)),lt=b.i32_const(t.alloc(s)),ht=b.i32_const(t.alloc(s)),yt=b.i32_const(t.alloc(s)),At=b.i32_const(t.alloc(s)),Ft=b.i32_const(t.alloc(s)),Mt=b.i32_const(t.alloc(s)),Qt=b.i32_const(t.alloc(s)),$t=b.i32_const(t.alloc(s)),Nt=b.i32_const(t.alloc(s)),Ot=b.i32_const(t.alloc(s)),Xt=b.i32_const(t.alloc(s));u.addCode(b.call(S+\"_mul\",k,B,Qt),b.call(S+\"_mul\",Y,p,$t),b.call(S+\"_mul\",tt,P,Nt),b.call(S+\"_add\",k,tt,yt),b.call(S+\"_add\",k,Y,ht),b.call(S+\"_add\",Q,H,At),b.call(S+\"_add\",At,X,At),b.call(S+\"_mul\",Q,p,Ot),b.call(S+\"_add\",Ot,Nt,Ft),b.call(S+\"_mul\",b.i32_const(V),Ft,Mt),b.call(S+\"_add\",Mt,Qt,k),b.call(S+\"_mul\",X,P,Ft),b.call(S+\"_add\",Ot,Ft,Ot),b.call(S+\"_add\",Ft,$t,Ft),b.call(S+\"_mul\",b.i32_const(V),Ft,Mt),b.call(S+\"_mul\",Q,B,Ft),b.call(S+\"_add\",Ot,Ft,Ot),b.call(S+\"_add\",Mt,Ft,Q),b.call(S+\"_add\",B,p,lt),b.call(S+\"_mul\",ht,lt,Ft),b.call(S+\"_add\",Qt,$t,Xt),b.call(S+\"_sub\",Ft,Xt,Ft),b.call(S+\"_mul\",H,P,Mt),b.call(S+\"_add\",Ot,Mt,Ot),b.call(S+\"_add\",Y,tt,lt),b.call(S+\"_add\",Ft,Mt,Y),b.call(S+\"_add\",p,P,ht),b.call(S+\"_mul\",ht,lt,Ft),b.call(S+\"_add\",$t,Nt,Xt),b.call(S+\"_sub\",Ft,Xt,Ft),b.call(S+\"_mul\",b.i32_const(V),Ft,Mt),b.call(S+\"_mul\",H,B,Ft),b.call(S+\"_add\",Ot,Ft,Ot),b.call(S+\"_add\",Mt,Ft,H),b.call(S+\"_mul\",X,p,Ft),b.call(S+\"_add\",Ot,Ft,Ot),b.call(S+\"_mul\",b.i32_const(V),Ft,Mt),b.call(S+\"_add\",B,P,lt),b.call(S+\"_mul\",yt,lt,Ft),b.call(S+\"_add\",Qt,Nt,Xt),b.call(S+\"_sub\",Ft,Xt,Ft),b.call(S+\"_add\",Mt,Ft,tt),b.call(S+\"_add\",B,p,lt),b.call(S+\"_add\",lt,P,lt),b.call(S+\"_mul\",At,lt,Ft),b.call(S+\"_sub\",Ft,Ot,X))}function I(){let u=t.addFunction(n+\"_millerLoop\");u.addParam(\"ppreP\",\"i32\"),u.addParam(\"ppreQ\",\"i32\"),u.addParam(\"r\",\"i32\"),u.addLocal(\"pCoef\",\"i32\"),u.addLocal(\"i\",\"i32\");let b=u.getCodeBuilder(),B=b.getLocal(\"ppreP\"),p=b.i32_add(b.getLocal(\"ppreP\"),b.i32_const(l)),P=b.getLocal(\"pCoef\"),k=b.i32_add(b.getLocal(\"pCoef\"),b.i32_const(s)),Q=b.i32_add(b.getLocal(\"pCoef\"),b.i32_const(2*s)),Y=t.alloc(s),H=b.i32_const(Y),tt=t.alloc(s),X=b.i32_const(tt),lt=b.getLocal(\"r\");u.addCode(b.call(vt+\"_one\",lt),b.setLocal(\"pCoef\",b.i32_add(b.getLocal(\"ppreQ\"),b.i32_const(s*3))),b.setLocal(\"i\",b.i32_const(Ht.length-2)),b.block(b.loop(b.call(vt+\"_square\",lt,lt),b.call(S+\"_mul1\",k,p,H),b.call(S+\"_mul1\",Q,B,X),b.call(n+\"__mulBy024\",P,H,X,lt),b.setLocal(\"pCoef\",b.i32_add(b.getLocal(\"pCoef\"),b.i32_const(w))),b.if(b.i32_load8_s(b.getLocal(\"i\"),m),[...b.call(S+\"_mul1\",k,p,H),...b.call(S+\"_mul1\",Q,B,X),...b.call(n+\"__mulBy024\",P,H,X,lt),...b.setLocal(\"pCoef\",b.i32_add(b.getLocal(\"pCoef\"),b.i32_const(w)))]),b.br_if(1,b.i32_eqz(b.getLocal(\"i\"))),b.setLocal(\"i\",b.i32_sub(b.getLocal(\"i\"),b.i32_const(1))),b.br(0)))),a&&u.addCode(b.call(vt+\"_inverse\",lt,lt)),u.addCode(b.call(S+\"_mul1\",k,p,H),b.call(S+\"_mul1\",Q,B,X),b.call(n+\"__mulBy024\",P,H,X,lt),b.setLocal(\"pCoef\",b.i32_add(b.getLocal(\"pCoef\"),b.i32_const(w))),b.call(S+\"_mul1\",k,p,H),b.call(S+\"_mul1\",Q,B,X),b.call(n+\"__mulBy024\",P,H,X,lt),b.setLocal(\"pCoef\",b.i32_add(b.getLocal(\"pCoef\"),b.i32_const(w))))}function z(u){let b=[[[zt(\"1\"),zt(\"0\")],[zt(\"1\"),zt(\"0\")],[zt(\"1\"),zt(\"0\")],[zt(\"1\"),zt(\"0\")],[zt(\"1\"),zt(\"0\")],[zt(\"1\"),zt(\"0\")],[zt(\"1\"),zt(\"0\")],[zt(\"1\"),zt(\"0\")],[zt(\"1\"),zt(\"0\")],[zt(\"1\"),zt(\"0\")],[zt(\"1\"),zt(\"0\")],[zt(\"1\"),zt(\"0\")]],[[zt(\"1\"),zt(\"0\")],[zt(\"8376118865763821496583973867626364092589906065868298776909617916018768340080\"),zt(\"16469823323077808223889137241176536799009286646108169935659301613961712198316\")],[zt(\"21888242871839275220042445260109153167277707414472061641714758635765020556617\"),zt(\"0\")],[zt(\"11697423496358154304825782922584725312912383441159505038794027105778954184319\"),zt(\"303847389135065887422783454877609941456349188919719272345083954437860409601\")],[zt(\"21888242871839275220042445260109153167277707414472061641714758635765020556616\"),zt(\"0\")],[zt(\"3321304630594332808241809054958361220322477375291206261884409189760185844239\"),zt(\"5722266937896532885780051958958348231143373700109372999374820235121374419868\")],[zt(\"21888242871839275222246405745257275088696311157297823662689037894645226208582\"),zt(\"0\")],[zt(\"13512124006075453725662431877630910996106405091429524885779419978626457868503\"),zt(\"5418419548761466998357268504080738289687024511189653727029736280683514010267\")],[zt(\"2203960485148121921418603742825762020974279258880205651966\"),zt(\"0\")],[zt(\"10190819375481120917420622822672549775783927716138318623895010788866272024264\"),zt(\"21584395482704209334823622290379665147239961968378104390343953940207365798982\")],[zt(\"2203960485148121921418603742825762020974279258880205651967\"),zt(\"0\")],[zt(\"18566938241244942414004596690298913868373833782006617400804628704885040364344\"),zt(\"16165975933942742336466353786298926857552937457188450663314217659523851788715\")]]],B=[[[zt(\"1\"),zt(\"0\")],[zt(\"1\"),zt(\"0\")],[zt(\"1\"),zt(\"0\")],[zt(\"1\"),zt(\"0\")],[zt(\"1\"),zt(\"0\")],[zt(\"1\"),zt(\"0\")]],[[zt(\"1\"),zt(\"0\")],[zt(\"21575463638280843010398324269430826099269044274347216827212613867836435027261\"),zt(\"10307601595873709700152284273816112264069230130616436755625194854815875713954\")],[zt(\"21888242871839275220042445260109153167277707414472061641714758635765020556616\"),zt(\"0\")],[zt(\"3772000881919853776433695186713858239009073593817195771773381919316419345261\"),zt(\"2236595495967245188281701248203181795121068902605861227855261137820944008926\")],[zt(\"2203960485148121921418603742825762020974279258880205651966\"),zt(\"0\")],[zt(\"18429021223477853657660792034369865839114504446431234726392080002137598044644\"),zt(\"9344045779998320333812420223237981029506012124075525679208581902008406485703\")]],[[zt(\"1\"),zt(\"0\")],[zt(\"2581911344467009335267311115468803099551665605076196740867805258568234346338\"),zt(\"19937756971775647987995932169929341994314640652964949448313374472400716661030\")],[zt(\"2203960485148121921418603742825762020974279258880205651966\"),zt(\"0\")],[zt(\"5324479202449903542726783395506214481928257762400643279780343368557297135718\"),zt(\"16208900380737693084919495127334387981393726419856888799917914180988844123039\")],[zt(\"21888242871839275220042445260109153167277707414472061641714758635765020556616\"),zt(\"0\")],[zt(\"13981852324922362344252311234282257507216387789820983642040889267519694726527\"),zt(\"7629828391165209371577384193250820201684255241773809077146787135900891633097\")]]],p=t.addFunction(n+\"__frobeniusMap\"+u);p.addParam(\"x\",\"i32\"),p.addParam(\"r\",\"i32\");let P=p.getCodeBuilder();for(let Q=0;Q<6;Q++){let Y=Q==0?P.getLocal(\"x\"):P.i32_add(P.getLocal(\"x\"),P.i32_const(Q*s)),H=Y,tt=P.i32_add(P.getLocal(\"x\"),P.i32_const(Q*s+l)),X=Q==0?P.getLocal(\"r\"):P.i32_add(P.getLocal(\"r\"),P.i32_const(Q*s)),lt=X,ht=P.i32_add(P.getLocal(\"r\"),P.i32_const(Q*s+l)),yt=k(b[Math.floor(Q/3)][u%12],B[Q%3][u%6]),At=t.alloc([...oe.bigInt2BytesLE(ct(yt[0]),32),...oe.bigInt2BytesLE(ct(yt[1]),32)]);u%2==1?p.addCode(P.call($+\"_copy\",H,lt),P.call($+\"_neg\",tt,ht),P.call(S+\"_mul\",X,P.i32_const(At),X)):p.addCode(P.call(S+\"_mul\",Y,P.i32_const(At),X))}function k(Q,Y){let H=zt(Q[0]),tt=zt(Q[1]),X=zt(Y[0]),lt=zt(Y[1]),ht=[H.times(X).minus(tt.times(lt)).mod(o),H.times(lt).add(tt.times(X)).mod(o)];return ht[0].isNegative()&&(ht[0]=ht[0].add(o)),ht}}function J(){let u=t.addFunction(n+\"__finalExponentiationFirstChunk\");u.addParam(\"x\",\"i32\"),u.addParam(\"r\",\"i32\");let b=u.getCodeBuilder(),B=b.getLocal(\"x\"),p=B,P=b.i32_add(B,b.i32_const(f*6)),k=b.getLocal(\"r\"),Q=t.alloc(C),Y=b.i32_const(Q),H=Y,tt=b.i32_const(Q+f*6),X=b.i32_const(t.alloc(C)),lt=b.i32_const(t.alloc(C)),ht=b.i32_const(t.alloc(C));u.addCode(b.call(pt+\"_copy\",p,H),b.call(pt+\"_neg\",P,tt),b.call(vt+\"_inverse\",B,X),b.call(vt+\"_mul\",Y,X,lt),b.call(n+\"__frobeniusMap2\",lt,ht),b.call(vt+\"_mul\",lt,ht,k))}function st(){let u=t.addFunction(n+\"__cyclotomicSquare\");u.addParam(\"x\",\"i32\"),u.addParam(\"r\",\"i32\");let b=u.getCodeBuilder(),B=b.getLocal(\"x\"),p=b.i32_add(b.getLocal(\"x\"),b.i32_const(s)),P=b.i32_add(b.getLocal(\"x\"),b.i32_const(2*s)),k=b.i32_add(b.getLocal(\"x\"),b.i32_const(3*s)),Q=b.i32_add(b.getLocal(\"x\"),b.i32_const(4*s)),Y=b.i32_add(b.getLocal(\"x\"),b.i32_const(5*s)),H=b.getLocal(\"r\"),tt=b.i32_add(b.getLocal(\"r\"),b.i32_const(s)),X=b.i32_add(b.getLocal(\"r\"),b.i32_const(2*s)),lt=b.i32_add(b.getLocal(\"r\"),b.i32_const(3*s)),ht=b.i32_add(b.getLocal(\"r\"),b.i32_const(4*s)),yt=b.i32_add(b.getLocal(\"r\"),b.i32_const(5*s)),At=b.i32_const(t.alloc(s)),Ft=b.i32_const(t.alloc(s)),Mt=b.i32_const(t.alloc(s)),Qt=b.i32_const(t.alloc(s)),$t=b.i32_const(t.alloc(s)),Nt=b.i32_const(t.alloc(s)),Ot=b.i32_const(t.alloc(s)),Xt=b.i32_const(t.alloc(s));u.addCode(b.call(S+\"_mul\",B,Q,Ot),b.call(S+\"_mul\",Q,b.i32_const(V),At),b.call(S+\"_add\",B,At,At),b.call(S+\"_add\",B,Q,Xt),b.call(S+\"_mul\",Xt,At,At),b.call(S+\"_mul\",b.i32_const(V),Ot,Xt),b.call(S+\"_add\",Ot,Xt,Xt),b.call(S+\"_sub\",At,Xt,At),b.call(S+\"_add\",Ot,Ot,Ft),b.call(S+\"_mul\",k,P,Ot),b.call(S+\"_mul\",P,b.i32_const(V),Mt),b.call(S+\"_add\",k,Mt,Mt),b.call(S+\"_add\",k,P,Xt),b.call(S+\"_mul\",Xt,Mt,Mt),b.call(S+\"_mul\",b.i32_const(V),Ot,Xt),b.call(S+\"_add\",Ot,Xt,Xt),b.call(S+\"_sub\",Mt,Xt,Mt),b.call(S+\"_add\",Ot,Ot,Qt),b.call(S+\"_mul\",p,Y,Ot),b.call(S+\"_mul\",Y,b.i32_const(V),$t),b.call(S+\"_add\",p,$t,$t),b.call(S+\"_add\",p,Y,Xt),b.call(S+\"_mul\",Xt,$t,$t),b.call(S+\"_mul\",b.i32_const(V),Ot,Xt),b.call(S+\"_add\",Ot,Xt,Xt),b.call(S+\"_sub\",$t,Xt,$t),b.call(S+\"_add\",Ot,Ot,Nt),b.call(S+\"_sub\",At,B,H),b.call(S+\"_add\",H,H,H),b.call(S+\"_add\",At,H,H),b.call(S+\"_add\",Ft,Q,ht),b.call(S+\"_add\",ht,ht,ht),b.call(S+\"_add\",Ft,ht,ht),b.call(S+\"_mul\",Nt,b.i32_const(dt),Xt),b.call(S+\"_add\",Xt,k,lt),b.call(S+\"_add\",lt,lt,lt),b.call(S+\"_add\",Xt,lt,lt),b.call(S+\"_sub\",$t,P,X),b.call(S+\"_add\",X,X,X),b.call(S+\"_add\",$t,X,X),b.call(S+\"_sub\",Mt,p,tt),b.call(S+\"_add\",tt,tt,tt),b.call(S+\"_add\",Mt,tt,tt),b.call(S+\"_add\",Qt,Y,yt),b.call(S+\"_add\",yt,yt,yt),b.call(S+\"_add\",Qt,yt,yt))}function mt(u,b){let B=Lt(u).map(X=>X==-1?255:X),p=t.alloc(B),P=t.alloc(oe.bigInt2BytesLE(u,32)),k=t.addFunction(n+\"__cyclotomicExp_\"+b);k.addParam(\"x\",\"i32\"),k.addParam(\"r\",\"i32\"),k.addLocal(\"bit\",\"i32\"),k.addLocal(\"i\",\"i32\");let Q=k.getCodeBuilder(),Y=Q.getLocal(\"x\"),H=Q.getLocal(\"r\"),tt=Q.i32_const(t.alloc(C));k.addCode(Q.call(vt+\"_conjugate\",Y,tt),Q.call(vt+\"_one\",H),Q.if(Q.teeLocal(\"bit\",Q.i32_load8_s(Q.i32_const(B.length-1),p)),Q.if(Q.i32_eq(Q.getLocal(\"bit\"),Q.i32_const(1)),Q.call(vt+\"_mul\",H,Y,H),Q.call(vt+\"_mul\",H,tt,H))),Q.setLocal(\"i\",Q.i32_const(B.length-2)),Q.block(Q.loop(Q.call(n+\"__cyclotomicSquare\",H,H),Q.if(Q.teeLocal(\"bit\",Q.i32_load8_s(Q.getLocal(\"i\"),p)),Q.if(Q.i32_eq(Q.getLocal(\"bit\"),Q.i32_const(1)),Q.call(vt+\"_mul\",H,Y,H),Q.call(vt+\"_mul\",H,tt,H))),Q.br_if(1,Q.i32_eqz(Q.getLocal(\"i\"))),Q.setLocal(\"i\",Q.i32_sub(Q.getLocal(\"i\"),Q.i32_const(1))),Q.br(0))))}function _t(){st(),mt(et,\"w0\");let u=t.addFunction(n+\"__finalExponentiationLastChunk\");u.addParam(\"x\",\"i32\"),u.addParam(\"r\",\"i32\");let b=u.getCodeBuilder(),B=b.getLocal(\"x\"),p=b.getLocal(\"r\"),P=b.i32_const(t.alloc(C)),k=b.i32_const(t.alloc(C)),Q=b.i32_const(t.alloc(C)),Y=b.i32_const(t.alloc(C)),H=b.i32_const(t.alloc(C)),tt=b.i32_const(t.alloc(C)),X=b.i32_const(t.alloc(C)),lt=b.i32_const(t.alloc(C)),ht=b.i32_const(t.alloc(C)),yt=b.i32_const(t.alloc(C)),At=b.i32_const(t.alloc(C)),Ft=b.i32_const(t.alloc(C)),Mt=b.i32_const(t.alloc(C)),Qt=b.i32_const(t.alloc(C)),$t=b.i32_const(t.alloc(C)),Nt=b.i32_const(t.alloc(C)),Ot=b.i32_const(t.alloc(C)),Xt=b.i32_const(t.alloc(C)),ie=b.i32_const(t.alloc(C)),ce=b.i32_const(t.alloc(C)),Ae=b.i32_const(t.alloc(C));u.addCode(b.call(n+\"__cyclotomicExp_w0\",B,P),A?[]:b.call(vt+\"_conjugate\",P,P),b.call(n+\"__cyclotomicSquare\",P,k),b.call(n+\"__cyclotomicSquare\",k,Q),b.call(vt+\"_mul\",Q,k,Y),b.call(n+\"__cyclotomicExp_w0\",Y,H),A?[]:b.call(vt+\"_conjugate\",H,H),b.call(n+\"__cyclotomicSquare\",H,tt),b.call(n+\"__cyclotomicExp_w0\",tt,X),A?[]:b.call(vt+\"_conjugate\",X,X),b.call(vt+\"_conjugate\",Y,lt),b.call(vt+\"_conjugate\",X,ht),b.call(vt+\"_mul\",ht,H,yt),b.call(vt+\"_mul\",yt,lt,At),b.call(vt+\"_mul\",At,k,Ft),b.call(vt+\"_mul\",At,H,Mt),b.call(vt+\"_mul\",Mt,B,Qt),b.call(n+\"__frobeniusMap1\",Ft,$t),b.call(vt+\"_mul\",$t,Qt,Nt),b.call(n+\"__frobeniusMap2\",At,Ot),b.call(vt+\"_mul\",Ot,Nt,Xt),b.call(vt+\"_conjugate\",B,ie),b.call(vt+\"_mul\",ie,Ft,ce),b.call(n+\"__frobeniusMap3\",ce,Ae),b.call(vt+\"_mul\",Ae,Xt,p))}function It(){J(),_t();let u=t.addFunction(n+\"_finalExponentiation\");u.addParam(\"x\",\"i32\"),u.addParam(\"r\",\"i32\");let b=u.getCodeBuilder(),B=b.getLocal(\"x\"),p=b.getLocal(\"r\"),P=b.i32_const(t.alloc(C));u.addCode(b.call(n+\"__finalExponentiationFirstChunk\",B,P),b.call(n+\"__finalExponentiationLastChunk\",P,p))}function Et(){let u=t.addFunction(n+\"_finalExponentiationOld\");u.addParam(\"x\",\"i32\"),u.addParam(\"r\",\"i32\");let b=zt(\"552484233613224096312617126783173147097382103762957654188882734314196910839907541213974502761540629817009608548654680343627701153829446747810907373256841551006201639677726139946029199968412598804882391702273019083653272047566316584365559776493027495458238373902875937659943504873220554161550525926302303331747463515644711876653177129578303191095900909191624817826566688241804408081892785725967931714097716709526092261278071952560171111444072049229123565057483750161460024353346284167282452756217662335528813519139808291170539072125381230815729071544861602750936964829313608137325426383735122175229541155376346436093930287402089517426973178917569713384748081827255472576937471496195752727188261435633271238710131736096299798168852925540549342330775279877006784354801422249722573783561685179618816480037695005515426162362431072245638324744480\"),B=t.alloc(oe.bigInt2BytesLE(b,352)),p=u.getCodeBuilder();u.addCode(p.call(vt+\"_exp\",p.getLocal(\"x\"),p.i32_const(B),p.i32_const(352),p.getLocal(\"r\")))}let Ct=t.alloc(F),Wt=t.alloc(U);function ne(u){let b=t.addFunction(n+\"_pairingEq\"+u);for(let k=0;k<u;k++)b.addParam(\"p_\"+k,\"i32\"),b.addParam(\"q_\"+k,\"i32\");b.addParam(\"c\",\"i32\"),b.setReturnType(\"i32\");let B=b.getCodeBuilder(),p=B.i32_const(t.alloc(C)),P=B.i32_const(t.alloc(C));b.addCode(B.call(vt+\"_one\",p));for(let k=0;k<u;k++)b.addCode(B.call(n+\"_prepareG1\",B.getLocal(\"p_\"+k),B.i32_const(Ct))),b.addCode(B.call(n+\"_prepareG2\",B.getLocal(\"q_\"+k),B.i32_const(Wt))),b.addCode(B.call(n+\"_millerLoop\",B.i32_const(Ct),B.i32_const(Wt),P)),b.addCode(B.call(vt+\"_mul\",p,P,p));b.addCode(B.call(n+\"_finalExponentiation\",p,p)),b.addCode(B.call(vt+\"_eq\",p,B.getLocal(\"c\")))}function D(){let u=t.addFunction(n+\"_pairing\");u.addParam(\"p\",\"i32\"),u.addParam(\"q\",\"i32\"),u.addParam(\"r\",\"i32\");let b=u.getCodeBuilder(),B=b.i32_const(t.alloc(C));u.addCode(b.call(n+\"_prepareG1\",b.getLocal(\"p\"),b.i32_const(Ct))),u.addCode(b.call(n+\"_prepareG2\",b.getLocal(\"q\"),b.i32_const(Wt))),u.addCode(b.call(n+\"_millerLoop\",b.i32_const(Ct),b.i32_const(Wt),B)),u.addCode(b.call(n+\"_finalExponentiation\",B,b.getLocal(\"r\")))}Dt(),kt(),qt(),Tt(),Rt(),wt(),I();for(let u=0;u<10;u++)z(u),t.exportFunction(n+\"__frobeniusMap\"+u);Et(),It();for(let u=1;u<=5;u++)ne(u),t.exportFunction(n+\"_pairingEq\"+u);D(),t.exportFunction(n+\"_pairing\"),t.exportFunction(n+\"_prepareG1\"),t.exportFunction(n+\"_prepareG2\"),t.exportFunction(n+\"_millerLoop\"),t.exportFunction(n+\"_finalExponentiation\"),t.exportFunction(n+\"_finalExponentiationOld\"),t.exportFunction(n+\"__mulBy024\"),t.exportFunction(n+\"__mulBy024Old\"),t.exportFunction(n+\"__cyclotomicSquare\"),t.exportFunction(n+\"__cyclotomicExp_w0\")}});var au=Yt((C8,iu)=>{var Ut=Ve(),ee=ri(),K0=Io(),j0=cc(),eu=lc(),V0=dc(),nu=uc(),Lc=fc(),W0=_c(),Y0=hc(),Aa=gc();iu.exports=function(t,e){let n=e||\"bls12381\";if(t.modules[n])return n;let o=Ut(\"1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab\",16),d=Ut(\"73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001\",16),h=Math.floor((o.minus(1).bitLength()-1)/64)+1,f=h*8,L=f,l=L*2,s=L*6,x=L*12,C=Math.floor((d.minus(1).bitLength()-1)/64)+1,g=C*8,$=g,it=t.alloc(ee.bigInt2BytesLE(d,$)),q=K0(t,o,\"f1m\",\"intq\");j0(t,d,\"fr\",\"frm\",\"intr\");let S=t.alloc(ee.bigInt2BytesLE(_(Ut(4)),L)),O=nu(t,\"g1m\",\"f1m\",S);Lc(t,\"frm\",\"frm\",\"frm\",\"frm_mul\"),W0(t,\"pol\",\"frm\"),Y0(t,\"qap\",\"frm\");let M=eu(t,\"f1m_neg\",\"f2m\",\"f1m\"),W=t.alloc([...ee.bigInt2BytesLE(_(Ut(\"4\")),L),...ee.bigInt2BytesLE(_(Ut(\"4\")),L)]),ct=nu(t,\"g2m\",\"f2m\",W);function E(B,p){let P=t.addFunction(B);P.addParam(\"pG\",\"i32\"),P.addParam(\"pFr\",\"i32\"),P.addParam(\"pr\",\"i32\");let k=P.getCodeBuilder(),Q=k.i32_const(t.alloc(g));P.addCode(k.call(\"frm_fromMontgomery\",k.getLocal(\"pFr\"),Q),k.call(p,k.getLocal(\"pG\"),Q,k.i32_const(g),k.getLocal(\"pr\"))),t.exportFunction(B)}E(\"g1m_timesFr\",\"g1m_timesScalar\"),Lc(t,\"g1m\",\"g1m\",\"frm\",\"g1m_timesFr\"),E(\"g2m_timesFr\",\"g2m_timesScalar\"),Lc(t,\"g2m\",\"g2m\",\"frm\",\"g2m_timesFr\"),E(\"g1m_timesFrAffine\",\"g1m_timesScalarAffine\"),E(\"g2m_timesFrAffine\",\"g2m_timesScalarAffine\"),Aa(t,\"frm_batchApplyKey\",\"fmr\",\"frm\",g,g,g,\"frm_mul\"),Aa(t,\"g1m_batchApplyKey\",\"g1m\",\"frm\",f*3,f*3,g,\"g1m_timesFr\"),Aa(t,\"g1m_batchApplyKeyMixed\",\"g1m\",\"frm\",f*2,f*3,g,\"g1m_timesFrAffine\"),Aa(t,\"g2m_batchApplyKey\",\"g2m\",\"frm\",f*2*3,f*3*2,g,\"g2m_timesFr\"),Aa(t,\"g2m_batchApplyKeyMixed\",\"g2m\",\"frm\",f*2*2,f*3*2,g,\"g2m_timesFrAffine\");function _(B){return Ut(B).times(Ut.one.shiftLeft(L*8)).mod(o)}let r=[Ut(\"3685416753713387016781088315183077757961620795782546409894578378688607592378376318836054947676345821548104185464507\"),Ut(\"1339506544944476473020471379941921221584933875938349620426543736416511423956333506472724655353366534992391756441569\"),Ut.one],Z=t.alloc([...ee.bigInt2BytesLE(_(r[0]),L),...ee.bigInt2BytesLE(_(r[1]),L),...ee.bigInt2BytesLE(_(r[2]),L)]),j=[Ut.zero,Ut.one,Ut.zero],nt=t.alloc([...ee.bigInt2BytesLE(_(j[0]),L),...ee.bigInt2BytesLE(_(j[1]),L),...ee.bigInt2BytesLE(_(j[2]),L)]),v=[[Ut(\"352701069587466618187139116011060144890029952792775240219908644239793785735715026873347600343865175952761926303160\"),Ut(\"3059144344244213709971259814753781636986470325476647558659373206291635324768958432433509563104347017837885763365758\")],[Ut(\"1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905\"),Ut(\"927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582\")],[Ut.one,Ut.zero]],y=t.alloc([...ee.bigInt2BytesLE(_(v[0][0]),L),...ee.bigInt2BytesLE(_(v[0][1]),L),...ee.bigInt2BytesLE(_(v[1][0]),L),...ee.bigInt2BytesLE(_(v[1][1]),L),...ee.bigInt2BytesLE(_(v[2][0]),L),...ee.bigInt2BytesLE(_(v[2][1]),L)]),T=[[Ut.zero,Ut.zero],[Ut.one,Ut.zero],[Ut.zero,Ut.zero]],V=t.alloc([...ee.bigInt2BytesLE(_(T[0][0]),L),...ee.bigInt2BytesLE(_(T[0][1]),L),...ee.bigInt2BytesLE(_(T[1][0]),L),...ee.bigInt2BytesLE(_(T[1][1]),L),...ee.bigInt2BytesLE(_(T[2][0]),L),...ee.bigInt2BytesLE(_(T[2][1]),L)]),rt=t.alloc([...ee.bigInt2BytesLE(_(1),L),...ee.bigInt2BytesLE(_(0),L),...ee.bigInt2BytesLE(_(0),L),...ee.bigInt2BytesLE(_(0),L),...ee.bigInt2BytesLE(_(0),L),...ee.bigInt2BytesLE(_(0),L),...ee.bigInt2BytesLE(_(0),L),...ee.bigInt2BytesLE(_(0),L),...ee.bigInt2BytesLE(_(0),L),...ee.bigInt2BytesLE(_(0),L),...ee.bigInt2BytesLE(_(0),L),...ee.bigInt2BytesLE(_(0),L)]),dt=t.alloc([...ee.bigInt2BytesLE(_(Ut(2).modInv(o)),L),...ee.bigInt2BytesLE(Ut(0),L)]),ot=t.alloc([...ee.bigInt2BytesLE(_(1),L),...ee.bigInt2BytesLE(_(1),L)]),xt=t.alloc([...ee.bigInt2BytesLE(_(\"4\"),L),...ee.bigInt2BytesLE(_(\"4\"),L)]);function pt(){let B=t.addFunction(M+\"_mulNR\");B.addParam(\"x\",\"i32\"),B.addParam(\"pr\",\"i32\");let p=B.getCodeBuilder(),P=p.i32_const(t.alloc(L)),k=p.getLocal(\"x\"),Q=p.i32_add(p.getLocal(\"x\"),p.i32_const(L)),Y=p.getLocal(\"pr\"),H=p.i32_add(p.getLocal(\"pr\"),p.i32_const(L));B.addCode(p.call(q+\"_copy\",k,P),p.call(q+\"_sub\",k,Q,Y),p.call(q+\"_add\",P,Q,H))}pt();let bt=V0(t,M+\"_mulNR\",\"f6m\",\"f2m\");function vt(){let B=t.addFunction(bt+\"_mulNR\");B.addParam(\"x\",\"i32\"),B.addParam(\"pr\",\"i32\");let p=B.getCodeBuilder(),P=p.i32_const(t.alloc(L*2));B.addCode(p.call(M+\"_copy\",p.getLocal(\"x\"),P),p.call(M+\"_mulNR\",p.i32_add(p.getLocal(\"x\"),p.i32_const(f*4)),p.getLocal(\"pr\")),p.call(M+\"_copy\",p.i32_add(p.getLocal(\"x\"),p.i32_const(f*2)),p.i32_add(p.getLocal(\"pr\"),p.i32_const(f*4))),p.call(M+\"_copy\",P,p.i32_add(p.getLocal(\"pr\"),p.i32_const(f*2))))}vt();let Pt=eu(t,bt+\"_mulNR\",\"ftm\",bt),Ht=Ut(\"d201000000010000\",16),m=qt(Ht),a=t.alloc(m),w=!0,c=3*l,G=m.length-1,F=m.reduce((B,p)=>B+(p!=0?1:0),0)+G+1,U=3*2*f,A=3*f*2+F*c,et=!0,Lt=Ut(\"15132376222941642752\");t.modules[n]={n64q:h,n64r:C,n8q:f,n8r:g,pG1gen:Z,pG1zero:nt,pG1b:S,pG2gen:y,pG2zero:V,pG2b:W,pq:t.modules.f1m.pq,pr:it,pOneT:rt,r:d,q:o,prePSize:U,preQSize:A};function St(B){let p=B,P=[];for(;p.gt(Ut.zero);){if(p.isOdd()){let k=2-p.mod(4).toJSNumber();P.push(k),p=p.minus(k)}else P.push(0);p=p.shiftRight(1)}return P}function qt(B){let p=B,P=[];for(;p.gt(Ut.zero);)p.isOdd()?P.push(1):P.push(0),p=p.shiftRight(1);return P}function Dt(){let B=t.addFunction(n+\"_prepareG1\");B.addParam(\"pP\",\"i32\"),B.addParam(\"ppreP\",\"i32\");let p=B.getCodeBuilder();B.addCode(p.call(O+\"_normalize\",p.getLocal(\"pP\"),p.getLocal(\"ppreP\")))}function kt(){let B=t.addFunction(n+\"_prepDblStep\");B.addParam(\"R\",\"i32\"),B.addParam(\"r\",\"i32\");let p=B.getCodeBuilder(),P=p.getLocal(\"R\"),k=p.i32_add(p.getLocal(\"R\"),p.i32_const(2*f)),Q=p.i32_add(p.getLocal(\"R\"),p.i32_const(4*f)),Y=p.getLocal(\"r\"),H=p.i32_add(p.getLocal(\"r\"),p.i32_const(2*f)),tt=p.i32_add(p.getLocal(\"r\"),p.i32_const(4*f)),X=p.i32_const(t.alloc(l)),lt=p.i32_const(t.alloc(l)),ht=p.i32_const(t.alloc(l)),yt=p.i32_const(t.alloc(l)),At=p.i32_const(t.alloc(l));B.addCode(p.call(M+\"_square\",P,Y),p.call(M+\"_square\",k,lt),p.call(M+\"_square\",lt,ht),p.call(M+\"_add\",lt,P,H),p.call(M+\"_square\",H,H),p.call(M+\"_sub\",H,Y,H),p.call(M+\"_sub\",H,ht,H),p.call(M+\"_add\",H,H,H),p.call(M+\"_add\",Y,Y,yt),p.call(M+\"_add\",yt,Y,yt),p.call(M+\"_add\",P,yt,tt),p.call(M+\"_square\",yt,At),p.call(M+\"_square\",Q,X),p.call(M+\"_sub\",At,H,P),p.call(M+\"_sub\",P,H,P),p.call(M+\"_add\",Q,k,Q),p.call(M+\"_square\",Q,Q),p.call(M+\"_sub\",Q,lt,Q),p.call(M+\"_sub\",Q,X,Q),p.call(M+\"_sub\",H,P,k),p.call(M+\"_mul\",k,yt,k),p.call(M+\"_add\",ht,ht,ht),p.call(M+\"_add\",ht,ht,ht),p.call(M+\"_add\",ht,ht,ht),p.call(M+\"_sub\",k,ht,k),p.call(M+\"_mul\",yt,X,H),p.call(M+\"_add\",H,H,H),p.call(M+\"_neg\",H,H),p.call(M+\"_square\",tt,tt),p.call(M+\"_sub\",tt,Y,tt),p.call(M+\"_sub\",tt,At,tt),p.call(M+\"_add\",lt,lt,lt),p.call(M+\"_add\",lt,lt,lt),p.call(M+\"_sub\",tt,lt,tt),p.call(M+\"_mul\",Q,X,Y),p.call(M+\"_add\",Y,Y,Y))}function Bt(){let B=t.addFunction(n+\"_prepAddStep\");B.addParam(\"R\",\"i32\"),B.addParam(\"Q\",\"i32\"),B.addParam(\"r\",\"i32\");let p=B.getCodeBuilder(),P=p.getLocal(\"R\"),k=p.i32_add(p.getLocal(\"R\"),p.i32_const(2*f)),Q=p.i32_add(p.getLocal(\"R\"),p.i32_const(4*f)),Y=p.getLocal(\"Q\"),H=p.i32_add(p.getLocal(\"Q\"),p.i32_const(2*f)),tt=p.getLocal(\"r\"),X=p.i32_add(p.getLocal(\"r\"),p.i32_const(2*f)),lt=p.i32_add(p.getLocal(\"r\"),p.i32_const(4*f)),ht=p.i32_const(t.alloc(l)),yt=p.i32_const(t.alloc(l)),At=p.i32_const(t.alloc(l)),Ft=p.i32_const(t.alloc(l)),Mt=p.i32_const(t.alloc(l)),Qt=p.i32_const(t.alloc(l)),$t=p.i32_const(t.alloc(l)),Nt=p.i32_const(t.alloc(l)),Ot=p.i32_const(t.alloc(l)),Xt=p.i32_const(t.alloc(l)),ie=p.i32_const(t.alloc(l));B.addCode(p.call(M+\"_square\",Q,ht),p.call(M+\"_square\",H,yt),p.call(M+\"_mul\",ht,Y,Ft),p.call(M+\"_add\",H,Q,X),p.call(M+\"_square\",X,X),p.call(M+\"_sub\",X,yt,X),p.call(M+\"_sub\",X,ht,X),p.call(M+\"_mul\",X,ht,X),p.call(M+\"_sub\",Ft,P,Mt),p.call(M+\"_square\",Mt,Qt),p.call(M+\"_add\",Qt,Qt,$t),p.call(M+\"_add\",$t,$t,$t),p.call(M+\"_mul\",$t,Mt,Nt),p.call(M+\"_sub\",X,k,Ot),p.call(M+\"_sub\",Ot,k,Ot),p.call(M+\"_mul\",Ot,Y,lt),p.call(M+\"_mul\",$t,P,Xt),p.call(M+\"_square\",Ot,P),p.call(M+\"_sub\",P,Nt,P),p.call(M+\"_sub\",P,Xt,P),p.call(M+\"_sub\",P,Xt,P),p.call(M+\"_add\",Q,Mt,Q),p.call(M+\"_square\",Q,Q),p.call(M+\"_sub\",Q,ht,Q),p.call(M+\"_sub\",Q,Qt,Q),p.call(M+\"_add\",H,Q,tt),p.call(M+\"_sub\",Xt,P,ie),p.call(M+\"_mul\",ie,Ot,ie),p.call(M+\"_mul\",k,Nt,Ft),p.call(M+\"_add\",Ft,Ft,Ft),p.call(M+\"_sub\",ie,Ft,k),p.call(M+\"_square\",tt,tt),p.call(M+\"_sub\",tt,yt,tt),p.call(M+\"_square\",Q,At),p.call(M+\"_sub\",tt,At,tt),p.call(M+\"_add\",lt,lt,lt),p.call(M+\"_sub\",lt,tt,lt),p.call(M+\"_add\",Q,Q,tt),p.call(M+\"_neg\",Ot,Ot),p.call(M+\"_add\",Ot,Ot,X))}function Tt(){let B=t.addFunction(n+\"_prepareG2\");B.addParam(\"pQ\",\"i32\"),B.addParam(\"ppreQ\",\"i32\"),B.addLocal(\"pCoef\",\"i32\"),B.addLocal(\"i\",\"i32\");let p=B.getCodeBuilder(),P=p.getLocal(\"pQ\"),k=t.alloc(l*3),Q=p.i32_const(k),Y=p.getLocal(\"ppreQ\");B.addCode(p.call(ct+\"_normalize\",P,Y),p.if(p.call(ct+\"_isZero\",Y),p.ret([])),p.call(ct+\"_copy\",Y,Q),p.setLocal(\"pCoef\",p.i32_add(p.getLocal(\"ppreQ\"),p.i32_const(l*3)))),B.addCode(p.setLocal(\"i\",p.i32_const(m.length-2)),p.block(p.loop(p.call(n+\"_prepDblStep\",Q,p.getLocal(\"pCoef\")),p.setLocal(\"pCoef\",p.i32_add(p.getLocal(\"pCoef\"),p.i32_const(c))),p.if(p.i32_load8_s(p.getLocal(\"i\"),a),[...p.call(n+\"_prepAddStep\",Q,Y,p.getLocal(\"pCoef\")),...p.setLocal(\"pCoef\",p.i32_add(p.getLocal(\"pCoef\"),p.i32_const(c)))]),p.br_if(1,p.i32_eqz(p.getLocal(\"i\"))),p.setLocal(\"i\",p.i32_sub(p.getLocal(\"i\"),p.i32_const(1))),p.br(0))))}function wt(){let B=t.addFunction(bt+\"_mul1\");B.addParam(\"pA\",\"i32\"),B.addParam(\"pC1\",\"i32\"),B.addParam(\"pR\",\"i32\");let p=B.getCodeBuilder(),P=p.getLocal(\"pA\"),k=p.i32_add(p.getLocal(\"pA\"),p.i32_const(L*2)),Q=p.i32_add(p.getLocal(\"pA\"),p.i32_const(L*4)),Y=p.getLocal(\"pC1\"),H=p.getLocal(\"pR\"),tt=p.i32_add(p.getLocal(\"pR\"),p.i32_const(L*2)),X=p.i32_add(p.getLocal(\"pR\"),p.i32_const(L*4)),lt=p.i32_const(t.alloc(L*2)),ht=p.i32_const(t.alloc(L*2));B.addCode(p.call(M+\"_add\",P,k,lt),p.call(M+\"_add\",k,Q,ht),p.call(M+\"_mul\",k,Y,X),p.call(M+\"_mul\",ht,Y,H),p.call(M+\"_sub\",H,X,H),p.call(M+\"_mulNR\",H,H),p.call(M+\"_mul\",lt,Y,tt),p.call(M+\"_sub\",tt,X,tt))}wt();function Rt(){let B=t.addFunction(bt+\"_mul01\");B.addParam(\"pA\",\"i32\"),B.addParam(\"pC0\",\"i32\"),B.addParam(\"pC1\",\"i32\"),B.addParam(\"pR\",\"i32\");let p=B.getCodeBuilder(),P=p.getLocal(\"pA\"),k=p.i32_add(p.getLocal(\"pA\"),p.i32_const(L*2)),Q=p.i32_add(p.getLocal(\"pA\"),p.i32_const(L*4)),Y=p.getLocal(\"pC0\"),H=p.getLocal(\"pC1\"),tt=p.getLocal(\"pR\"),X=p.i32_add(p.getLocal(\"pR\"),p.i32_const(L*2)),lt=p.i32_add(p.getLocal(\"pR\"),p.i32_const(L*4)),ht=p.i32_const(t.alloc(L*2)),yt=p.i32_const(t.alloc(L*2)),At=p.i32_const(t.alloc(L*2)),Ft=p.i32_const(t.alloc(L*2));B.addCode(p.call(M+\"_mul\",P,Y,ht),p.call(M+\"_mul\",k,H,yt),p.call(M+\"_add\",P,k,At),p.call(M+\"_add\",P,Q,Ft),p.call(M+\"_add\",k,Q,tt),p.call(M+\"_mul\",tt,H,tt),p.call(M+\"_sub\",tt,yt,tt),p.call(M+\"_mulNR\",tt,tt),p.call(M+\"_add\",tt,ht,tt),p.call(M+\"_add\",Y,H,X),p.call(M+\"_mul\",X,At,X),p.call(M+\"_sub\",X,ht,X),p.call(M+\"_sub\",X,yt,X),p.call(M+\"_mul\",Ft,Y,lt),p.call(M+\"_sub\",lt,ht,lt),p.call(M+\"_add\",lt,yt,lt))}Rt();function I(){let B=t.addFunction(Pt+\"_mul014\");B.addParam(\"pA\",\"i32\"),B.addParam(\"pC0\",\"i32\"),B.addParam(\"pC1\",\"i32\"),B.addParam(\"pC4\",\"i32\"),B.addParam(\"pR\",\"i32\");let p=B.getCodeBuilder(),P=p.getLocal(\"pA\"),k=p.i32_add(p.getLocal(\"pA\"),p.i32_const(L*6)),Q=p.getLocal(\"pC0\"),Y=p.getLocal(\"pC1\"),H=p.getLocal(\"pC4\"),tt=p.i32_const(t.alloc(L*6)),X=p.i32_const(t.alloc(L*6)),lt=p.i32_const(t.alloc(L*2)),ht=p.getLocal(\"pR\"),yt=p.i32_add(p.getLocal(\"pR\"),p.i32_const(L*6));B.addCode(p.call(bt+\"_mul01\",P,Q,Y,tt),p.call(bt+\"_mul1\",k,H,X),p.call(M+\"_add\",Y,H,lt),p.call(bt+\"_add\",k,P,yt),p.call(bt+\"_mul01\",yt,Q,lt,yt),p.call(bt+\"_sub\",yt,tt,yt),p.call(bt+\"_sub\",yt,X,yt),p.call(bt+\"_copy\",X,ht),p.call(bt+\"_mulNR\",ht,ht),p.call(bt+\"_add\",ht,tt,ht))}I();function z(){let B=t.addFunction(n+\"_ell\");B.addParam(\"pP\",\"i32\"),B.addParam(\"pCoefs\",\"i32\"),B.addParam(\"pF\",\"i32\");let p=B.getCodeBuilder(),P=p.getLocal(\"pP\"),k=p.i32_add(p.getLocal(\"pP\"),p.i32_const(f)),Q=p.getLocal(\"pF\"),Y=p.getLocal(\"pCoefs\"),H=p.i32_add(p.getLocal(\"pCoefs\"),p.i32_const(L)),tt=p.i32_add(p.getLocal(\"pCoefs\"),p.i32_const(L*2)),X=p.i32_add(p.getLocal(\"pCoefs\"),p.i32_const(L*3)),lt=p.i32_add(p.getLocal(\"pCoefs\"),p.i32_const(L*4)),ht=t.alloc(L*2),yt=p.i32_const(ht),At=p.i32_const(ht),Ft=p.i32_const(ht+L),Mt=t.alloc(L*2),Qt=p.i32_const(Mt),$t=p.i32_const(Mt),Nt=p.i32_const(Mt+L);B.addCode(p.call(q+\"_mul\",Y,k,At),p.call(q+\"_mul\",H,k,Ft),p.call(q+\"_mul\",tt,P,$t),p.call(q+\"_mul\",X,P,Nt),p.call(Pt+\"_mul014\",Q,lt,Qt,yt,Q))}z();function J(){let B=t.addFunction(n+\"_millerLoop\");B.addParam(\"ppreP\",\"i32\"),B.addParam(\"ppreQ\",\"i32\"),B.addParam(\"r\",\"i32\"),B.addLocal(\"pCoef\",\"i32\"),B.addLocal(\"i\",\"i32\");let p=B.getCodeBuilder(),P=p.getLocal(\"ppreP\"),k=p.getLocal(\"ppreQ\"),Q=p.getLocal(\"pCoef\"),Y=p.getLocal(\"r\");B.addCode(p.call(Pt+\"_one\",Y),p.if(p.call(O+\"_isZero\",P),p.ret([])),p.if(p.call(O+\"_isZero\",p.getLocal(\"ppreQ\")),p.ret([])),p.setLocal(\"pCoef\",p.i32_add(p.getLocal(\"ppreQ\"),p.i32_const(l*3))),p.setLocal(\"i\",p.i32_const(m.length-2)),p.block(p.loop(p.call(n+\"_ell\",P,Q,Y),p.setLocal(\"pCoef\",p.i32_add(p.getLocal(\"pCoef\"),p.i32_const(c))),p.if(p.i32_load8_s(p.getLocal(\"i\"),a),[...p.call(n+\"_ell\",P,Q,Y),...p.setLocal(\"pCoef\",p.i32_add(p.getLocal(\"pCoef\"),p.i32_const(c)))]),p.call(Pt+\"_square\",Y,Y),p.br_if(1,p.i32_eq(p.getLocal(\"i\"),p.i32_const(1))),p.setLocal(\"i\",p.i32_sub(p.getLocal(\"i\"),p.i32_const(1))),p.br(0))),p.call(n+\"_ell\",P,Q,Y)),w&&B.addCode(p.call(Pt+\"_conjugate\",Y,Y))}function st(B){let p=[[[Ut(\"1\"),Ut(\"0\")],[Ut(\"1\"),Ut(\"0\")],[Ut(\"1\"),Ut(\"0\")],[Ut(\"1\"),Ut(\"0\")],[Ut(\"1\"),Ut(\"0\")],[Ut(\"1\"),Ut(\"0\")],[Ut(\"1\"),Ut(\"0\")],[Ut(\"1\"),Ut(\"0\")],[Ut(\"1\"),Ut(\"0\")],[Ut(\"1\"),Ut(\"0\")],[Ut(\"1\"),Ut(\"0\")],[Ut(\"1\"),Ut(\"0\")]],[[Ut(\"1\"),Ut(\"0\")],[Ut(\"3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760\"),Ut(\"151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027\")],[Ut(\"793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351\"),Ut(\"0\")],[Ut(\"2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530\"),Ut(\"1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257\")],[Ut(\"793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350\"),Ut(\"0\")],[Ut(\"3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557\"),Ut(\"877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230\")],[Ut(\"4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786\"),Ut(\"0\")],[Ut(\"151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027\"),Ut(\"3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760\")],[Ut(\"4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436\"),Ut(\"0\")],[Ut(\"1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257\"),Ut(\"2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530\")],[Ut(\"4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437\"),Ut(\"0\")],[Ut(\"877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230\"),Ut(\"3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557\")]]],P=[[[Ut(\"1\"),Ut(\"0\")],[Ut(\"1\"),Ut(\"0\")],[Ut(\"1\"),Ut(\"0\")],[Ut(\"1\"),Ut(\"0\")],[Ut(\"1\"),Ut(\"0\")],[Ut(\"1\"),Ut(\"0\")]],[[Ut(\"1\"),Ut(\"0\")],[Ut(\"0\"),Ut(\"4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436\")],[Ut(\"793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350\"),Ut(\"0\")],[Ut(\"0\"),Ut(\"1\")],[Ut(\"4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436\"),Ut(\"0\")],[Ut(\"0\"),Ut(\"793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350\")]],[[Ut(\"1\"),Ut(\"0\")],[Ut(\"4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437\"),Ut(\"0\")],[Ut(\"4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436\"),Ut(\"0\")],[Ut(\"4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786\"),Ut(\"0\")],[Ut(\"793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350\"),Ut(\"0\")],[Ut(\"793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351\"),Ut(\"0\")]]],k=t.addFunction(Pt+\"_frobeniusMap\"+B);k.addParam(\"x\",\"i32\"),k.addParam(\"r\",\"i32\");let Q=k.getCodeBuilder();for(let H=0;H<6;H++){let tt=H==0?Q.getLocal(\"x\"):Q.i32_add(Q.getLocal(\"x\"),Q.i32_const(H*l)),X=tt,lt=Q.i32_add(Q.getLocal(\"x\"),Q.i32_const(H*l+L)),ht=H==0?Q.getLocal(\"r\"):Q.i32_add(Q.getLocal(\"r\"),Q.i32_const(H*l)),yt=ht,At=Q.i32_add(Q.getLocal(\"r\"),Q.i32_const(H*l+L)),Ft=Y(p[Math.floor(H/3)][B%12],P[H%3][B%6]),Mt=t.alloc([...ee.bigInt2BytesLE(_(Ft[0]),f),...ee.bigInt2BytesLE(_(Ft[1]),f)]);B%2==1?k.addCode(Q.call(q+\"_copy\",X,yt),Q.call(q+\"_neg\",lt,At),Q.call(M+\"_mul\",ht,Q.i32_const(Mt),ht)):k.addCode(Q.call(M+\"_mul\",tt,Q.i32_const(Mt),ht))}function Y(H,tt){let X=Ut(H[0]),lt=Ut(H[1]),ht=Ut(tt[0]),yt=Ut(tt[1]),At=[X.times(ht).minus(lt.times(yt)).mod(o),X.times(yt).add(lt.times(ht)).mod(o)];return At[0].isNegative()&&(At[0]=At[0].add(o)),At}}function mt(){let B=t.addFunction(n+\"__cyclotomicSquare\");B.addParam(\"x\",\"i32\"),B.addParam(\"r\",\"i32\");let p=B.getCodeBuilder(),P=p.getLocal(\"x\"),k=p.i32_add(p.getLocal(\"x\"),p.i32_const(l)),Q=p.i32_add(p.getLocal(\"x\"),p.i32_const(2*l)),Y=p.i32_add(p.getLocal(\"x\"),p.i32_const(3*l)),H=p.i32_add(p.getLocal(\"x\"),p.i32_const(4*l)),tt=p.i32_add(p.getLocal(\"x\"),p.i32_const(5*l)),X=p.getLocal(\"r\"),lt=p.i32_add(p.getLocal(\"r\"),p.i32_const(l)),ht=p.i32_add(p.getLocal(\"r\"),p.i32_const(2*l)),yt=p.i32_add(p.getLocal(\"r\"),p.i32_const(3*l)),At=p.i32_add(p.getLocal(\"r\"),p.i32_const(4*l)),Ft=p.i32_add(p.getLocal(\"r\"),p.i32_const(5*l)),Mt=p.i32_const(t.alloc(l)),Qt=p.i32_const(t.alloc(l)),$t=p.i32_const(t.alloc(l)),Nt=p.i32_const(t.alloc(l)),Ot=p.i32_const(t.alloc(l)),Xt=p.i32_const(t.alloc(l)),ie=p.i32_const(t.alloc(l)),ce=p.i32_const(t.alloc(l));B.addCode(p.call(M+\"_mul\",P,H,ie),p.call(M+\"_mulNR\",H,Mt),p.call(M+\"_add\",P,Mt,Mt),p.call(M+\"_add\",P,H,ce),p.call(M+\"_mul\",ce,Mt,Mt),p.call(M+\"_mulNR\",ie,ce),p.call(M+\"_add\",ie,ce,ce),p.call(M+\"_sub\",Mt,ce,Mt),p.call(M+\"_add\",ie,ie,Qt),p.call(M+\"_mul\",Y,Q,ie),p.call(M+\"_mulNR\",Q,$t),p.call(M+\"_add\",Y,$t,$t),p.call(M+\"_add\",Y,Q,ce),p.call(M+\"_mul\",ce,$t,$t),p.call(M+\"_mulNR\",ie,ce),p.call(M+\"_add\",ie,ce,ce),p.call(M+\"_sub\",$t,ce,$t),p.call(M+\"_add\",ie,ie,Nt),p.call(M+\"_mul\",k,tt,ie),p.call(M+\"_mulNR\",tt,Ot),p.call(M+\"_add\",k,Ot,Ot),p.call(M+\"_add\",k,tt,ce),p.call(M+\"_mul\",ce,Ot,Ot),p.call(M+\"_mulNR\",ie,ce),p.call(M+\"_add\",ie,ce,ce),p.call(M+\"_sub\",Ot,ce,Ot),p.call(M+\"_add\",ie,ie,Xt),p.call(M+\"_sub\",Mt,P,X),p.call(M+\"_add\",X,X,X),p.call(M+\"_add\",Mt,X,X),p.call(M+\"_add\",Qt,H,At),p.call(M+\"_add\",At,At,At),p.call(M+\"_add\",Qt,At,At),p.call(M+\"_mul\",Xt,p.i32_const(ot),ce),p.call(M+\"_add\",ce,Y,yt),p.call(M+\"_add\",yt,yt,yt),p.call(M+\"_add\",ce,yt,yt),p.call(M+\"_sub\",Ot,Q,ht),p.call(M+\"_add\",ht,ht,ht),p.call(M+\"_add\",Ot,ht,ht),p.call(M+\"_sub\",$t,k,lt),p.call(M+\"_add\",lt,lt,lt),p.call(M+\"_add\",$t,lt,lt),p.call(M+\"_add\",Nt,tt,Ft),p.call(M+\"_add\",Ft,Ft,Ft),p.call(M+\"_add\",Nt,Ft,Ft))}function _t(B,p,P){let k=St(B).map(ht=>ht==-1?255:ht),Q=t.alloc(k),Y=t.addFunction(n+\"__cyclotomicExp_\"+P);Y.addParam(\"x\",\"i32\"),Y.addParam(\"r\",\"i32\"),Y.addLocal(\"bit\",\"i32\"),Y.addLocal(\"i\",\"i32\");let H=Y.getCodeBuilder(),tt=H.getLocal(\"x\"),X=H.getLocal(\"r\"),lt=H.i32_const(t.alloc(x));Y.addCode(H.call(Pt+\"_conjugate\",tt,lt),H.call(Pt+\"_one\",X),H.if(H.teeLocal(\"bit\",H.i32_load8_s(H.i32_const(k.length-1),Q)),H.if(H.i32_eq(H.getLocal(\"bit\"),H.i32_const(1)),H.call(Pt+\"_mul\",X,tt,X),H.call(Pt+\"_mul\",X,lt,X))),H.setLocal(\"i\",H.i32_const(k.length-2)),H.block(H.loop(H.call(n+\"__cyclotomicSquare\",X,X),H.if(H.teeLocal(\"bit\",H.i32_load8_s(H.getLocal(\"i\"),Q)),H.if(H.i32_eq(H.getLocal(\"bit\"),H.i32_const(1)),H.call(Pt+\"_mul\",X,tt,X),H.call(Pt+\"_mul\",X,lt,X))),H.br_if(1,H.i32_eqz(H.getLocal(\"i\"))),H.setLocal(\"i\",H.i32_sub(H.getLocal(\"i\"),H.i32_const(1))),H.br(0)))),p&&Y.addCode(H.call(Pt+\"_conjugate\",X,X))}function It(){mt(),_t(Lt,et,\"w0\");let B=t.addFunction(n+\"_finalExponentiation\");B.addParam(\"x\",\"i32\"),B.addParam(\"r\",\"i32\");let p=B.getCodeBuilder(),P=p.getLocal(\"x\"),k=p.getLocal(\"r\"),Q=p.i32_const(t.alloc(x)),Y=p.i32_const(t.alloc(x)),H=p.i32_const(t.alloc(x)),tt=p.i32_const(t.alloc(x)),X=p.i32_const(t.alloc(x)),lt=p.i32_const(t.alloc(x)),ht=p.i32_const(t.alloc(x));B.addCode(p.call(Pt+\"_frobeniusMap6\",P,Q),p.call(Pt+\"_inverse\",P,Y),p.call(Pt+\"_mul\",Q,Y,H),p.call(Pt+\"_copy\",H,Y),p.call(Pt+\"_frobeniusMap2\",H,H),p.call(Pt+\"_mul\",H,Y,H),p.call(n+\"__cyclotomicSquare\",H,Y),p.call(Pt+\"_conjugate\",Y,Y),p.call(n+\"__cyclotomicExp_w0\",H,tt),p.call(n+\"__cyclotomicSquare\",tt,X),p.call(Pt+\"_mul\",Y,tt,lt),p.call(n+\"__cyclotomicExp_w0\",lt,Y),p.call(n+\"__cyclotomicExp_w0\",Y,Q),p.call(n+\"__cyclotomicExp_w0\",Q,ht),p.call(Pt+\"_mul\",ht,X,ht),p.call(n+\"__cyclotomicExp_w0\",ht,X),p.call(Pt+\"_conjugate\",lt,lt),p.call(Pt+\"_mul\",X,lt,X),p.call(Pt+\"_mul\",X,H,X),p.call(Pt+\"_conjugate\",H,lt),p.call(Pt+\"_mul\",Y,H,Y),p.call(Pt+\"_frobeniusMap3\",Y,Y),p.call(Pt+\"_mul\",ht,lt,ht),p.call(Pt+\"_frobeniusMap1\",ht,ht),p.call(Pt+\"_mul\",tt,Q,tt),p.call(Pt+\"_frobeniusMap2\",tt,tt),p.call(Pt+\"_mul\",tt,Y,tt),p.call(Pt+\"_mul\",tt,ht,tt),p.call(Pt+\"_mul\",tt,X,k))}function Et(){let B=t.addFunction(n+\"_finalExponentiationOld\");B.addParam(\"x\",\"i32\"),B.addParam(\"r\",\"i32\");let p=Ut(\"322277361516934140462891564586510139908379969514828494218366688025288661041104682794998680497580008899973249814104447692778988208376779573819485263026159588510513834876303014016798809919343532899164848730280942609956670917565618115867287399623286813270357901731510188149934363360381614501334086825442271920079363289954510565375378443704372994881406797882676971082200626541916413184642520269678897559532260949334760604962086348898118982248842634379637598665468817769075878555493752214492790122785850202957575200176084204422751485957336465472324810982833638490904279282696134323072515220044451592646885410572234451732790590013479358343841220074174848221722017083597872017638514103174122784843925578370430843522959600095676285723737049438346544753168912974976791528535276317256904336520179281145394686565050419250614107803233314658825463117900250701199181529205942363159325765991819433914303908860460720581408201373164047773794825411011922305820065611121544561808414055302212057471395719432072209245600258134364584636810093520285711072578721435517884103526483832733289802426157301542744476740008494780363354305116978805620671467071400711358839553375340724899735460480144599782014906586543813292157922220645089192130209334926661588737007768565838519456601560804957985667880395221049249803753582637708560\"),P=t.alloc(ee.bigInt2BytesLE(p,544)),k=B.getCodeBuilder();B.addCode(k.call(Pt+\"_exp\",k.getLocal(\"x\"),k.i32_const(P),k.i32_const(544),k.getLocal(\"r\")))}let Ct=t.alloc(U),Wt=t.alloc(A);function ne(B){let p=t.addFunction(n+\"_pairingEq\"+B);for(let Y=0;Y<B;Y++)p.addParam(\"p_\"+Y,\"i32\"),p.addParam(\"q_\"+Y,\"i32\");p.addParam(\"c\",\"i32\"),p.setReturnType(\"i32\");let P=p.getCodeBuilder(),k=P.i32_const(t.alloc(x)),Q=P.i32_const(t.alloc(x));p.addCode(P.call(Pt+\"_one\",k));for(let Y=0;Y<B;Y++)p.addCode(P.call(n+\"_prepareG1\",P.getLocal(\"p_\"+Y),P.i32_const(Ct))),p.addCode(P.call(n+\"_prepareG2\",P.getLocal(\"q_\"+Y),P.i32_const(Wt))),p.addCode(P.if(P.i32_eqz(P.call(O+\"_inGroupAffine\",P.i32_const(Ct))),P.ret(P.i32_const(0))),P.if(P.i32_eqz(P.call(ct+\"_inGroupAffine\",P.i32_const(Wt))),P.ret(P.i32_const(0)))),p.addCode(P.call(n+\"_millerLoop\",P.i32_const(Ct),P.i32_const(Wt),Q)),p.addCode(P.call(Pt+\"_mul\",k,Q,k));p.addCode(P.call(n+\"_finalExponentiation\",k,k)),p.addCode(P.call(Pt+\"_eq\",k,P.getLocal(\"c\")))}function D(){let B=t.addFunction(n+\"_pairing\");B.addParam(\"p\",\"i32\"),B.addParam(\"q\",\"i32\"),B.addParam(\"r\",\"i32\");let p=B.getCodeBuilder(),P=p.i32_const(t.alloc(x));B.addCode(p.call(n+\"_prepareG1\",p.getLocal(\"p\"),p.i32_const(Ct))),B.addCode(p.call(n+\"_prepareG2\",p.getLocal(\"q\"),p.i32_const(Wt))),B.addCode(p.call(n+\"_millerLoop\",p.i32_const(Ct),p.i32_const(Wt),P)),B.addCode(p.call(n+\"_finalExponentiation\",P,p.getLocal(\"r\")))}function u(){let B=t.addFunction(ct+\"_inGroupAffine\");B.addParam(\"p\",\"i32\"),B.setReturnType(\"i32\");let p=B.getCodeBuilder(),P=[Ut(\"2001204777610833696708894912867952078278441409969503942666029068062015825245418932221343814564507832018947136279894\"),Ut(\"2001204777610833696708894912867952078278441409969503942666029068062015825245418932221343814564507832018947136279893\")],k=Ut(\"4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436\"),Q=[Ut(\"2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530\"),Ut(\"2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530\")],Y=p.i32_const(t.alloc([...ee.bigInt2BytesLE(_(P[0]),f),...ee.bigInt2BytesLE(_(P[1]),f)])),H=p.i32_const(t.alloc(ee.bigInt2BytesLE(_(k),f))),tt=p.i32_const(t.alloc([...ee.bigInt2BytesLE(_(Q[0]),f),...ee.bigInt2BytesLE(_(Q[1]),f)])),X=p.i32_const(t.alloc(ee.bigInt2BytesLE(Lt,8))),lt=p.getLocal(\"p\"),ht=p.i32_add(p.getLocal(\"p\"),p.i32_const(l)),yt=p.i32_const(t.alloc(L)),At=p.i32_const(t.alloc(l)),Ft=p.i32_const(t.alloc(l)),Mt=t.alloc(l*2),Qt=p.i32_const(Mt),$t=p.i32_const(Mt),Nt=p.i32_const(Mt),Ot=p.i32_const(Mt+L),Xt=p.i32_const(Mt+l),ie=p.i32_const(Mt+l),ce=p.i32_const(Mt+l+L),Ae=t.alloc(l*3),ze=p.i32_const(Ae),wn=p.i32_const(Ae),$e=p.i32_const(Ae),Ke=p.i32_const(Ae+L),Fn=p.i32_const(Ae+l),Te=p.i32_const(Ae+l),Me=p.i32_const(Ae+l+L),fn=p.i32_const(Ae+l*2);B.addCode(p.if(p.call(ct+\"_isZeroAffine\",p.getLocal(\"p\")),p.ret(p.i32_const(1))),p.if(p.i32_eqz(p.call(ct+\"_inCurveAffine\",p.getLocal(\"p\"))),p.ret(p.i32_const(0))),p.call(M+\"_mul\",lt,Y,At),p.call(M+\"_mul\",ht,Y,Ft),p.call(M+\"_mul1\",At,H,$t),p.call(M+\"_neg\",Ft,Xt),p.call(M+\"_neg\",At,wn),p.call(M+\"_mul\",Ft,tt,Fn),p.call(q+\"_sub\",Nt,Ot,yt),p.call(q+\"_add\",Nt,Ot,Ot),p.call(q+\"_copy\",yt,Nt),p.call(q+\"_sub\",ie,ce,yt),p.call(q+\"_add\",ie,ce,ce),p.call(q+\"_copy\",yt,ie),p.call(q+\"_add\",$e,Ke,yt),p.call(q+\"_sub\",$e,Ke,Ke),p.call(q+\"_copy\",yt,$e),p.call(q+\"_sub\",Me,Te,yt),p.call(q+\"_add\",Te,Me,Me),p.call(q+\"_copy\",yt,Te),p.call(M+\"_one\",fn),p.call(ct+\"_timesScalar\",ze,X,p.i32_const(8),ze),p.call(ct+\"_addMixed\",ze,Qt,ze),p.ret(p.call(ct+\"_eqMixed\",ze,p.getLocal(\"p\"))));let Ci=t.addFunction(ct+\"_inGroup\");Ci.addParam(\"pIn\",\"i32\"),Ci.setReturnType(\"i32\");let ai=Ci.getCodeBuilder(),na=ai.i32_const(t.alloc(l*2));Ci.addCode(ai.call(ct+\"_toAffine\",ai.getLocal(\"pIn\"),na),ai.ret(ai.call(ct+\"_inGroupAffine\",na)))}function b(){let B=t.addFunction(O+\"_inGroupAffine\");B.addParam(\"p\",\"i32\"),B.setReturnType(\"i32\");let p=B.getCodeBuilder(),P=Ut(\"4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436\"),k=Ut(\"793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350\"),Q=Lt.times(Lt).minus(Ut.one).divide(Ut(3)),Y=p.i32_const(t.alloc(ee.bigInt2BytesLE(_(P),f))),H=p.i32_const(t.alloc(ee.bigInt2BytesLE(_(k),f))),tt=p.i32_const(t.alloc(ee.bigInt2BytesLE(Q,16))),X=p.getLocal(\"p\"),lt=p.i32_add(p.getLocal(\"p\"),p.i32_const(L)),ht=t.alloc(L*3),yt=p.i32_const(ht),At=p.i32_const(ht),Ft=p.i32_const(ht+L),Mt=p.i32_const(ht+2*L),Qt=t.alloc(L*2),$t=p.i32_const(Qt),Nt=p.i32_const(Qt),Ot=p.i32_const(Qt+L);B.addCode(p.if(p.call(O+\"_isZeroAffine\",p.getLocal(\"p\")),p.ret(p.i32_const(1))),p.if(p.i32_eqz(p.call(O+\"_inCurveAffine\",p.getLocal(\"p\"))),p.ret(p.i32_const(0))),p.call(q+\"_mul\",X,Y,At),p.call(q+\"_copy\",lt,Ft),p.call(q+\"_mul\",X,H,Nt),p.call(q+\"_copy\",lt,Ot),p.call(O+\"_doubleAffine\",yt,yt),p.call(O+\"_subMixed\",yt,p.getLocal(\"p\"),yt),p.call(O+\"_subMixed\",yt,$t,yt),p.call(O+\"_timesScalar\",yt,tt,p.i32_const(16),yt),p.ret(p.call(O+\"_eqMixed\",yt,$t)));let Xt=t.addFunction(O+\"_inGroup\");Xt.addParam(\"pIn\",\"i32\"),Xt.setReturnType(\"i32\");let ie=Xt.getCodeBuilder(),ce=ie.i32_const(t.alloc(L*2));Xt.addCode(ie.call(O+\"_toAffine\",ie.getLocal(\"pIn\"),ce),ie.ret(ie.call(O+\"_inGroupAffine\",ce)))}for(let B=0;B<10;B++)st(B),t.exportFunction(Pt+\"_frobeniusMap\"+B);b(),u(),Bt(),kt(),Dt(),Tt(),J(),Et(),It();for(let B=1;B<=5;B++)ne(B),t.exportFunction(n+\"_pairingEq\"+B);D(),t.exportFunction(n+\"_pairing\"),t.exportFunction(n+\"_prepareG1\"),t.exportFunction(n+\"_prepareG2\"),t.exportFunction(n+\"_millerLoop\"),t.exportFunction(n+\"_finalExponentiation\"),t.exportFunction(n+\"_finalExponentiationOld\"),t.exportFunction(n+\"__cyclotomicSquare\"),t.exportFunction(n+\"__cyclotomicExp_w0\"),t.exportFunction(bt+\"_mul1\"),t.exportFunction(bt+\"_mul01\"),t.exportFunction(Pt+\"_mul014\"),t.exportFunction(O+\"_inGroupAffine\"),t.exportFunction(O+\"_inGroup\"),t.exportFunction(ct+\"_inGroupAffine\"),t.exportFunction(ct+\"_inGroup\")}});var bc=Yt((x8,mc)=>{mc.exports.buildBn128=tu();mc.exports.buildBls12381=au()});var li=Yt((c6,mn)=>{var De=Ve();function Tn(i){let t;return typeof i==\"string\"&&i.slice(0,2).toLowerCase()==\"0x\"?t=De(i.slice(2),16):t=De(i),t}function wg(i){let t=[],e=Tn(i);return t.push(e.and(255).toJSNumber()),t.push(e.shiftRight(8).and(255).toJSNumber()),t.push(e.shiftRight(16).and(255).toJSNumber()),t.push(e.shiftRight(24).and(255).toJSNumber()),t}function Fg(i){let t=[],e=Tn(i);return t.push(e.and(255).toJSNumber()),t.push(e.shiftRight(8).and(255).toJSNumber()),t.push(e.shiftRight(16).and(255).toJSNumber()),t.push(e.shiftRight(24).and(255).toJSNumber()),t.push(e.shiftRight(32).and(255).toJSNumber()),t.push(e.shiftRight(40).and(255).toJSNumber()),t.push(e.shiftRight(48).and(255).toJSNumber()),t.push(e.shiftRight(56).and(255).toJSNumber()),t}function Ag(i){for(var t=[],e=0;e<i.length;e++){var n=i.charCodeAt(e);n<128?t.push(n):n<2048?t.push(192|n>>6,128|n&63):n<55296||n>=57344?t.push(224|n>>12,128|n>>6&63,128|n&63):(e++,n=65536+((n&1023)<<10|i.charCodeAt(e)&1023),t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|n&63))}return t}function Cg(i){let t=Ag(i);return[...ru(t.length),...t]}function Oc(i){let t=[],e=Tn(i);if(e.isNegative())throw new Error(\"Number cannot be negative\");for(;!e.isZero();)t.push(e.and(127).toJSNumber()),e=e.shiftRight(7);t.length==0&&t.push(0);for(let n=0;n<t.length-1;n++)t[n]=t[n]|128;return t}function cu(i){let t,e,n=i.bitLength().toJSNumber();i<0?(e=!0,t=De.one.shiftLeft(n).add(i)):(e=!1,t=Tn(i));let o=7-n%7,d=De.one.shiftLeft(o).minus(1).shiftLeft(n),h=(1<<7-o)-1|128,f=Oc(t.add(d));return e||(f[f.length-1]=f[f.length-1]&h),f}function xg(i){let t=Tn(i);if(t.greater(De(\"FFFFFFFF\",16)))throw new Error(\"Number too big\");if(t.greater(De(\"7FFFFFFF\",16))&&(t=t.minus(De(\"100000000\",16))),t.lesser(De(\"-80000000\",16)))throw new Error(\"Number too small\");return cu(t)}function Ig(i){let t=Tn(i);if(t.greater(De(\"FFFFFFFFFFFFFFFF\",16)))throw new Error(\"Number too big\");if(t.greater(De(\"7FFFFFFFFFFFFFFF\",16))&&(t=t.minus(De(\"10000000000000000\",16))),t.lesser(De(\"-8000000000000000\",16)))throw new Error(\"Number too small\");return cu(t)}function ru(i){let t=Tn(i);if(t.greater(De(\"FFFFFFFF\",16)))throw new Error(\"Number too big\");return Oc(t)}function Eg(i){let t=Tn(i);if(t.greater(De(\"FFFFFFFFFFFFFFFF\",16)))throw new Error(\"Number too big\");return Oc(t)}function Bg(i){return Array.from(i,function(t){return(\"0\"+(t&255).toString(16)).slice(-2)}).join(\"\")}function lu(i){if(typeof i==\"string\"){let t=i.split(`\n`);for(let e=0;e<t.length;e++)t[e]&&(t[e]=\" \"+t[e]);return t.join(`\n`)}else if(Array.isArray(i)){for(let t=0;t<i.length;t++)i[t]=lu(i[t]);return i}}mn.exports.toNumber=Tn;mn.exports.u32=wg;mn.exports.u64=Fg;mn.exports.varuint32=ru;mn.exports.varuint64=Eg;mn.exports.varint32=xg;mn.exports.varint64=Ig;mn.exports.string=Cg;mn.exports.toHexString=Bg;mn.exports.ident=lu});var uu=Yt((r6,du)=>{var be=li(),Pc=class{constructor(t){this.func=t,this.functionName=t.functionName,this.module=t.module}setLocal(t,e){let n=this.func.localIdxByName[t];if(n===void 0)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${t} `);return[...e,33,...be.varuint32(n)]}teeLocal(t,e){let n=this.func.localIdxByName[t];if(n===void 0)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${t} `);return[...e,34,...be.varuint32(n)]}getLocal(t){let e=this.func.localIdxByName[t];if(e===void 0)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${t} `);return[32,...be.varuint32(e)]}i64_load8_s(t,e,n){let o=e||0,d=n===void 0?0:n;return[...t,48,d,...be.varuint32(o)]}i64_load8_u(t,e,n){let o=e||0,d=n===void 0?0:n;return[...t,49,d,...be.varuint32(o)]}i64_load16_s(t,e,n){let o=e||0,d=n===void 0?1:n;return[...t,50,d,...be.varuint32(o)]}i64_load16_u(t,e,n){let o=e||0,d=n===void 0?1:n;return[...t,51,d,...be.varuint32(o)]}i64_load32_s(t,e,n){let o=e||0,d=n===void 0?2:n;return[...t,52,d,...be.varuint32(o)]}i64_load32_u(t,e,n){let o=e||0,d=n===void 0?2:n;return[...t,53,d,...be.varuint32(o)]}i64_load(t,e,n){let o=e||0,d=n===void 0?3:n;return[...t,41,d,...be.varuint32(o)]}i64_store(t,e,n,o){let d,h,f;return Array.isArray(e)?(d=0,h=3,f=e):Array.isArray(n)?(d=e,h=3,f=n):Array.isArray(o)&&(d=e,h=n,f=o),[...t,...f,55,h,...be.varuint32(d)]}i64_store32(t,e,n,o){let d,h,f;return Array.isArray(e)?(d=0,h=2,f=e):Array.isArray(n)?(d=e,h=2,f=n):Array.isArray(o)&&(d=e,h=n,f=o),[...t,...f,62,h,...be.varuint32(d)]}i64_store16(t,e,n,o){let d,h,f;return Array.isArray(e)?(d=0,h=1,f=e):Array.isArray(n)?(d=e,h=1,f=n):Array.isArray(o)&&(d=e,h=n,f=o),[...t,...f,61,h,...be.varuint32(d)]}i64_store8(t,e,n,o){let d,h,f;return Array.isArray(e)?(d=0,h=0,f=e):Array.isArray(n)?(d=e,h=0,f=n):Array.isArray(o)&&(d=e,h=n,f=o),[...t,...f,60,h,...be.varuint32(d)]}i32_load8_s(t,e,n){let o=e||0,d=n===void 0?0:n;return[...t,44,d,...be.varuint32(o)]}i32_load8_u(t,e,n){let o=e||0,d=n===void 0?0:n;return[...t,45,d,...be.varuint32(o)]}i32_load16_s(t,e,n){let o=e||0,d=n===void 0?1:n;return[...t,46,d,...be.varuint32(o)]}i32_load16_u(t,e,n){let o=e||0,d=n===void 0?1:n;return[...t,47,d,...be.varuint32(o)]}i32_load(t,e,n){let o=e||0,d=n===void 0?2:n;return[...t,40,d,...be.varuint32(o)]}i32_store(t,e,n,o){let d,h,f;return Array.isArray(e)?(d=0,h=2,f=e):Array.isArray(n)?(d=e,h=2,f=n):Array.isArray(o)&&(d=e,h=n,f=o),[...t,...f,54,h,...be.varuint32(d)]}i32_store16(t,e,n,o){let d,h,f;return Array.isArray(e)?(d=0,h=1,f=e):Array.isArray(n)?(d=e,h=1,f=n):Array.isArray(o)&&(d=e,h=n,f=o),[...t,...f,59,h,...be.varuint32(d)]}i32_store8(t,e,n,o){let d,h,f;return Array.isArray(e)?(d=0,h=0,f=e):Array.isArray(n)?(d=e,h=0,f=n):Array.isArray(o)&&(d=e,h=n,f=o),[...t,...f,58,h,...be.varuint32(d)]}call(t,...e){let n=this.module.functionIdxByName[t];if(n===void 0)throw new Error(`Function not defined: Function: ${t}`);return[...[].concat(...e),16,...be.varuint32(n)]}call_indirect(t,...e){return[...[].concat(...e),...t,17,0,0]}if(t,e,n){return n?[...t,4,64,...e,5,...n,11]:[...t,4,64,...e,11]}block(t){return[2,64,...t,11]}loop(...t){return[3,64,...[].concat(...t),11]}br_if(t,e){return[...e,13,...be.varuint32(t)]}br(t){return[12,...be.varuint32(t)]}ret(t){return[...t,15]}drop(t){return[...t,26]}i64_const(t){return[66,...be.varint64(t)]}i32_const(t){return[65,...be.varint32(t)]}i64_eqz(t){return[...t,80]}i64_eq(t,e){return[...t,...e,81]}i64_ne(t,e){return[...t,...e,82]}i64_lt_s(t,e){return[...t,...e,83]}i64_lt_u(t,e){return[...t,...e,84]}i64_gt_s(t,e){return[...t,...e,85]}i64_gt_u(t,e){return[...t,...e,86]}i64_le_s(t,e){return[...t,...e,87]}i64_le_u(t,e){return[...t,...e,88]}i64_ge_s(t,e){return[...t,...e,89]}i64_ge_u(t,e){return[...t,...e,90]}i64_add(t,e){return[...t,...e,124]}i64_sub(t,e){return[...t,...e,125]}i64_mul(t,e){return[...t,...e,126]}i64_div_s(t,e){return[...t,...e,127]}i64_div_u(t,e){return[...t,...e,128]}i64_rem_s(t,e){return[...t,...e,129]}i64_rem_u(t,e){return[...t,...e,130]}i64_and(t,e){return[...t,...e,131]}i64_or(t,e){return[...t,...e,132]}i64_xor(t,e){return[...t,...e,133]}i64_shl(t,e){return[...t,...e,134]}i64_shr_s(t,e){return[...t,...e,135]}i64_shr_u(t,e){return[...t,...e,136]}i64_extend_i32_s(t){return[...t,172]}i64_extend_i32_u(t){return[...t,173]}i64_clz(t){return[...t,121]}i64_ctz(t){return[...t,122]}i32_eqz(t){return[...t,69]}i32_eq(t,e){return[...t,...e,70]}i32_ne(t,e){return[...t,...e,71]}i32_lt_s(t,e){return[...t,...e,72]}i32_lt_u(t,e){return[...t,...e,73]}i32_gt_s(t,e){return[...t,...e,74]}i32_gt_u(t,e){return[...t,...e,75]}i32_le_s(t,e){return[...t,...e,76]}i32_le_u(t,e){return[...t,...e,77]}i32_ge_s(t,e){return[...t,...e,78]}i32_ge_u(t,e){return[...t,...e,79]}i32_add(t,e){return[...t,...e,106]}i32_sub(t,e){return[...t,...e,107]}i32_mul(t,e){return[...t,...e,108]}i32_div_s(t,e){return[...t,...e,109]}i32_div_u(t,e){return[...t,...e,110]}i32_rem_s(t,e){return[...t,...e,111]}i32_rem_u(t,e){return[...t,...e,112]}i32_and(t,e){return[...t,...e,113]}i32_or(t,e){return[...t,...e,114]}i32_xor(t,e){return[...t,...e,115]}i32_shl(t,e){return[...t,...e,116]}i32_shr_s(t,e){return[...t,...e,117]}i32_shr_u(t,e){return[...t,...e,118]}i32_rotl(t,e){return[...t,...e,119]}i32_rotr(t,e){return[...t,...e,120]}i32_wrap_i64(t){return[...t,167]}i32_clz(t){return[...t,103]}i32_ctz(t){return[...t,104]}unreachable(){return[0]}current_memory(){return[63,0]}comment(){return[]}};du.exports=Pc});var _u=Yt((l6,fu)=>{var vg=uu(),Uo=li(),zc={i32:127,i64:126,f32:125,f64:124,anyfunc:112,func:96,emptyblock:64},Mc=class{constructor(t,e,n,o,d){if(n==\"import\")this.fnType=\"import\",this.moduleName=o,this.fieldName=d;else if(n==\"internal\")this.fnType=\"internal\";else throw new Error(\"Invalid function fnType: \"+n);this.module=t,this.fnName=e,this.params=[],this.locals=[],this.localIdxByName={},this.code=[],this.returnType=null,this.nextLocal=0}addParam(t,e){if(this.localIdxByName[t])throw new Error(`param already exists. Function: ${this.fnName}, Param: ${t} `);let n=this.nextLocal++;this.localIdxByName[t]=n,this.params.push({type:e})}addLocal(t,e,n){let o=n||1;if(this.localIdxByName[t])throw new Error(`local already exists. Function: ${this.fnName}, Param: ${t} `);let d=this.nextLocal++;this.localIdxByName[t]=d,this.locals.push({type:e,length:o})}setReturnType(t){if(this.returnType)throw new Error(`returnType already defined. Function: ${this.fnName}`);this.returnType=t}getSignature(){let t=[...Uo.varuint32(this.params.length),...this.params.map(n=>zc[n.type])],e=this.returnType?[1,zc[this.returnType]]:[0];return[96,...t,...e]}getBody(){let t=this.locals.map(n=>[...Uo.varuint32(n.length),zc[n.type]]),e=[...Uo.varuint32(this.locals.length),...[].concat(...t),...this.code,11];return[...Uo.varuint32(e.length),...e]}addCode(...t){this.code.push(...[].concat(...t))}getCodeBuilder(){return new vg(this)}};fu.exports=Mc});var Tc=Yt((d6,gu)=>{var hu=_u(),pe=li(),Gc=class{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([...pe.u32(1836278016),...pe.u32(1),...this._buildType(),...this._buildImport(),...this._buildFunctionDeclarations(),...this._buildFunctionsTable(),...this._buildExports(),...this._buildElements(),...this._buildCode(),...this._buildData()])}addFunction(t){if(typeof this.functionIdxByName[t]<\"u\")throw new Error(`Function already defined: ${t}`);let e=this.functions.length;return this.functionIdxByName[t]=e,this.functions.push(new hu(this,t,\"internal\")),this.nInternalFunctions++,this.functions[e]}addIimportFunction(t,e,n){if(typeof this.functionIdxByName[t]<\"u\")throw new Error(`Function already defined: ${t}`);if(this.functions.length>0&&this.functions[this.functions.length-1].type==\"internal\")throw new Error(`Import functions must be declared before internal: ${t}`);let o=n||t,d=this.functions.length;return this.functionIdxByName[t]=d,this.functions.push(new hu(this,t,\"import\",e,o)),this.nImportFunctions++,this.functions[d]}setMemory(t,e,n){this.memory={pagesSize:t,moduleName:e||\"env\",fieldName:n||\"memory\"}}exportFunction(t,e){let n=e||t;if(typeof this.functionIdxByName[t]>\"u\")throw new Error(`Function not defined: ${t}`);let o=this.functionIdxByName[t];n!=t&&(this.functionIdxByName[n]=o),this.exports.push({exportName:n,idx:o})}addFunctionToTable(t){let e=this.functionIdxByName[t];this.functionsTable.push(e)}addData(t,e){this.datas.push({offset:t,bytes:e})}alloc(t,e){let n,o;(Array.isArray(t)||ArrayBuffer.isView(t))&&typeof e>\"u\"?(n=t.length,o=t):(n=t,o=e),n=(n-1>>3)+1<<3;let d=this.free;return this.free+=n,o&&this.addData(d,o),d}allocString(t){let n=new globalThis.TextEncoder().encode(t);return this.alloc([...n,0])}_setSignatures(){this.signatures=[];let t={};if(this.functionsTable.length>0){let e=this.functions[this.functionsTable[0]].getSignature(),n=\"s_\"+pe.toHexString(e);t[n]=0,this.signatures.push(e)}for(let e=0;e<this.functions.length;e++){let n=this.functions[e].getSignature(),o=\"s_\"+pe.toHexString(n);typeof t[o]>\"u\"&&(t[o]=this.signatures.length,this.signatures.push(n)),this.functions[e].signatureIdx=t[o]}}_buildSection(t,e){return[t,...pe.varuint32(e.length),...e]}_buildType(){return this._buildSection(1,[...pe.varuint32(this.signatures.length),...[].concat(...this.signatures)])}_buildImport(){let t=[];t.push([...pe.string(this.memory.moduleName),...pe.string(this.memory.fieldName),2,0,...pe.varuint32(this.memory.pagesSize)]);for(let e=0;e<this.nImportFunctions;e++)t.push([...pe.string(this.functions[e].moduleName),...pe.string(this.functions[e].fieldName),0,...pe.varuint32(this.functions[e].signatureIdx)]);return this._buildSection(2,pe.varuint32(t.length).concat(...t))}_buildFunctionDeclarations(){let t=[];for(let e=this.nImportFunctions;e<this.nImportFunctions+this.nInternalFunctions;e++)t.push(...pe.varuint32(this.functions[e].signatureIdx));return this._buildSection(3,[...pe.varuint32(t.length),...t])}_buildFunctionsTable(){return this.functionsTable.length==0?[]:this._buildSection(4,[...pe.varuint32(1),112,0,...pe.varuint32(this.functionsTable.length)])}_buildElements(){if(this.functionsTable.length==0)return[];let t=[];for(let e=0;e<this.functionsTable.length;e++)t.push(...pe.varuint32(this.functionsTable[e]));return this._buildSection(9,[...pe.varuint32(1),...pe.varuint32(0),65,...pe.varint32(0),11,...pe.varuint32(this.functionsTable.length),...t])}_buildExports(){let t=[];for(let e=0;e<this.exports.length;e++)t.push([...pe.string(this.exports[e].exportName),0,...pe.varuint32(this.exports[e].idx)]);return this._buildSection(7,pe.varuint32(t.length).concat(...t))}_buildCode(){let t=[];for(let e=this.nImportFunctions;e<this.nImportFunctions+this.nInternalFunctions;e++)t.push(this.functions[e].getBody());return this._buildSection(10,pe.varuint32(t.length).concat(...t))}_buildData(){let t=[];t.push([0,65,0,11,4,...pe.u32(this.free)]);for(let e=0;e<this.datas.length;e++)t.push([0,65,...pe.varint32(this.datas[e].offset),11,...pe.varuint32(this.datas[e].bytes.length),...this.datas[e].bytes]);return this._buildSection(11,pe.varuint32(t.length).concat(...t))}};gu.exports=Gc});var Lu=Yt((u6,pu)=>{var Sa=li(),kc=class{constructor(t){this.func=t,this.functionName=t.functionName,this.module=t.module}setLocal(t,e){if(this.func.localIdxByName[t]===void 0)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${t} `);return[e,`set_local $${t}`]}teeLocal(t,e){if(this.func.localIdxByName[t]===void 0)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${t} `);return[e,`tee_local $${t}`]}getLocal(t){if(this.func.localIdxByName[t]===void 0)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${t} `);return`get_local $${t}`}genLoad(t,e,n,o,d){let h=t,f=o||0;f>0&&(h+=` offset=${f}`);let L=d===void 0?e:d;return L!=e&&(h+=` align=${1<<L}`),[n,h]}genStore(t,e,n,o,d,h){let f,L,l;typeof d>\"u\"?(f=0,L=e,l=o):typeof h>\"u\"?(f=o,L=e,l=d):(f=o,L=d,l=h);let s=t;return f>0&&(s+=` offset=${f}`),L!=e&&(s+=` align=${1<<L}`),[n,l,s]}i64_load8_s(t,e,n){return this.genLoad(\"i64.load8_s\",0,t,e,n)}i64_load8_u(t,e,n){return this.genLoad(\"i64.load8_u\",0,t,e,n)}i64_load16_s(t,e,n){return this.genLoad(\"i64.load16_s\",1,t,e,n)}i64_load16_u(t,e,n){return this.genLoad(\"i64.load16_u\",1,t,e,n)}i64_load32_s(t,e,n){return this.genLoad(\"i64.load32_s\",2,t,e,n)}i64_load32_u(t,e,n){return this.genLoad(\"i64.load32_u\",2,t,e,n)}i64_load(t,e,n){return this.genLoad(\"i64.load\",3,t,e,n)}i64_store(t,e,n,o){return this.genStore(\"i64.store\",3,t,e,n,o)}i64_store32(t,e,n,o){return this.genStore(\"i64.store32\",2,t,e,n,o)}i64_store16(t,e,n,o){return this.genStore(\"i64.store16\",1,t,e,n,o)}i64_store8(t,e,n,o){return this.genStore(\"i64.store8\",0,t,e,n,o)}i32_load8_s(t,e,n){return this.genLoad(\"i32.load8_s\",0,t,e,n)}i32_load8_u(t,e,n){return this.genLoad(\"i32.load8_u\",0,t,e,n)}i32_load16_s(t,e,n){return this.genLoad(\"i32.load16_s\",1,t,e,n)}i32_load16_u(t,e,n){return this.genLoad(\"i32.load16_u\",1,t,e,n)}i32_load(t,e,n){return this.genLoad(\"i32.load\",2,t,e,n)}i32_store(t,e,n,o){return this.genStore(\"i32.store\",2,t,e,n,o)}i32_store16(t,e,n,o){return this.genStore(\"i32.store16\",1,t,e,n,o)}i32_store8(t,e,n,o){return this.genStore(\"i32.store8\",0,t,e,n,o)}call(t,...e){if(this.module.functionIdxByName[t]===void 0)throw new Error(`Function not defined: Function: ${t}`);return[e,`call $${t}`]}call_indirect(t,...e){return[e,t,\"call_indirect (type 0)\"]}if(t,e,n){return n?[t,\"if\",Sa.ident(e),\"else\",Sa.ident(n),\"end\"]:[t,\"if\",Sa.ident(e),\"end\"]}block(t){return[\"block\",Sa.ident(t),\"end\"]}loop(...t){return[\"loop\",Sa.ident(t),\"end\"]}br_if(t,e){return[e,`br_if ${t}`]}br(t){return`br ${t}`}ret(t){return[t,\"return\"]}drop(t){return[t,\"drop\"]}i64_const(t){return`i64.const ${t}`}i32_const(t){return`i32.const ${t}`}i64_eqz(t){return[t,\"i64.eqz\"]}i64_eq(t,e){return[t,e,\"i64.eq\"]}i64_ne(t,e){return[t,e,\"i64.ne\"]}i64_lt_s(t,e){return[t,e,\"i64.lt_s\"]}i64_lt_u(t,e){return[t,e,\"i64.lt_u\"]}i64_gt_s(t,e){return[t,e,\"i64.gt_s\"]}i64_gt_u(t,e){return[t,e,\"i64.gt_u\"]}i64_le_s(t,e){return[t,e,\"i64.le_s\"]}i64_le_u(t,e){return[t,e,\"i64.le_u\"]}i64_ge_s(t,e){return[t,e,\"i64.ge_s\"]}i64_ge_u(t,e){return[t,e,\"i64.ge_u\"]}i64_add(t,e){return[t,e,\"i64.add\"]}i64_sub(t,e){return[t,e,\"i64.sub\"]}i64_mul(t,e){return[t,e,\"i64.mul\"]}i64_div_s(t,e){return[t,e,\"i64.div_s\"]}i64_div_u(t,e){return[t,e,\"i64.div_u\"]}i64_rem_s(t,e){return[t,e,\"i64.rem_s\"]}i64_rem_u(t,e){return[t,e,\"i64.rem_u\"]}i64_and(t,e){return[t,e,\"i64.and\"]}i64_or(t,e){return[t,e,\"i64.or\"]}i64_xor(t,e){return[t,e,\"i64.xor\"]}i64_shl(t,e){return[t,e,\"i64.shl\"]}i64_shr_s(t,e){return[t,e,\"i64.shr_s\"]}i64_shr_u(t,e){return[t,e,\"i64.shr_u\"]}i64_extend_i32_s(t){return[t,\"i64.extend_s/i32\"]}i64_extend_i32_u(t){return[t,\"i64.extend_u/i32\"]}i32_eqz(t){return[t,\"i32.eqz\"]}i32_eq(t,e){return[t,e,\"i32.eq\"]}i32_ne(t,e){return[t,e,\"i32.ne\"]}i32_lt_s(t,e){return[t,e,\"i32.lt_s\"]}i32_lt_u(t,e){return[t,e,\"i32.lt_u\"]}i32_gt_s(t,e){return[t,e,\"i32.gt_s\"]}i32_gt_u(t,e){return[t,e,\"i32.gt_u\"]}i32_le_s(t,e){return[t,e,\"i32.le_s\"]}i32_le_u(t,e){return[t,e,\"i32.le_u\"]}i32_ge_s(t,e){return[t,e,\"i32.ge_s\"]}i32_ge_u(t,e){return[t,e,\"i32.ge_u\"]}i32_add(t,e){return[t,e,\"i32.add\"]}i32_sub(t,e){return[t,e,\"i32.sub\"]}i32_mul(t,e){return[t,e,\"i32.mul\"]}i32_div_s(t,e){return[t,e,\"i32.div_s\"]}i32_div_u(t,e){return[t,e,\"i32.div_u\"]}i32_rem_s(t,e){return[t,e,\"i32.rem_s\"]}i32_rem_u(t,e){return[t,e,\"i32.rem_u\"]}i32_and(t,e){return[t,e,\"i32.and\"]}i32_or(t,e){return[t,e,\"i32.or\"]}i32_xor(t,e){return[t,e,\"i32.xor\"]}i32_shl(t,e){return[t,e,\"i32.shl\"]}i32_shr_s(t,e){return[t,e,\"i32.shr_s\"]}i32_shr_u(t,e){return[t,e,\"i32.shr_u\"]}i32_rotl(t,e){return[t,e,\"i32.rotl\"]}i32_rotr(t,e){return[t,e,\"i32.rotr\"]}i32_wrap_i64(t){return[t,\"i32.wrap/i64\"]}ureachable(){return\"unreachable\"}current_memory(){return\"current_memory\"}comment(t){return\";; \"+t}};pu.exports=kc});var bu=Yt((f6,mu)=>{var Sg=Lu(),qg=li(),Nc=class{constructor(t,e,n,o,d){if(n==\"import\")this.fnType=\"import\",this.moduleName=o,this.fieldName=d;else if(n==\"internal\")this.fnType=\"internal\",this.comment=o;else throw new Error(\"Invalid function fnType: \"+n);this.module=t,this.fnName=e,this.params=[],this.locals=[],this.localIdxByName={},this.code=[],this.returnType=null,this.nextLocal=0}addParam(t,e){if(this.localIdxByName[t])throw new Error(`param already exists. Function: ${this.fnName}, Param: ${t} `);let n=this.nextLocal++;this.localIdxByName[t]=n,this.params.push({type:e,name:t})}addLocal(t,e,n){if(typeof n<\"u\"&&n!=1)throw new Error(\"Locals greater than 1 not implemented\");if(this.localIdxByName[t])throw new Error(`local already exists. Function: ${this.fnName}, Param: ${t} `);let o=this.nextLocal++;this.localIdxByName[t]=o,this.locals.push({type:e,name:t})}setReturnType(t){if(this.returnType)throw new Error(`returnType already defined. Function: ${this.fnName}`);this.returnType=t}getSignature(){let t=\"\";for(let n=0;n<this.params.length;n++)n==0&&(t+=\" (param\"),t+=\" \"+this.params[n].type;t!=\"\"&&(t+=\")\");let e=\"\";return this.returnType&&(e+=` (result ${this.returnType})`),`(type $${this.getSignatureName()} (func ${t}${e}))`}getSignatureName(){let t=\"_sig_\";for(let e=0;e<this.params.length;e++)t+=this.params[e].type;return this.returnType&&(t+=\"r\"+this.returnType),t}getBody(){let t=[];for(let n=0;n<this.params.length;n++)t.push(` (param $${this.params[n].name} ${this.params[n].type})`);this.returnType&&t.push(`(result ${this.returnType})`);for(let n=0;n<this.locals.length;n++)t.push(` (local $${this.locals[n].name} ${this.locals[n].type})`);t.push(this.code);let e;if(this.comment){e=this.comment.split(`\n`);for(let n=0;n<e.length;n++)e[n]=\";; \"+e[n]}else e=[];return[...e,`(func $${this.fnName} (type $${this.getSignatureName()})`,qg.ident(t),\")\"]}addCode(...t){this.code.push(t)}getCodeBuilder(){return new Sg(this)}};mu.exports=Nc});var Fu=Yt((_6,wu)=>{var yu=bu(),Ug=li(),Qc=class{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(){let t=[];return this._setSignatures(),t.push(this._buildType()),t.push(this._buildImport()),this.functionsTable.length>0&&t.push(this._buildFunctionsTable()),this.exports.length>0&&t.push(this._buildExports()),this.functionsTable.length>0&&t.push(this._buildElements()),this.nInternalFunctions>0&&t.push(this._buildFunctions()),t.push(this._buildData()),[\"(module\",Ug.ident(t),\")\"]}addFunction(t,e){if(typeof this.functionIdxByName[t]<\"u\")throw new Error(`Function already defined: ${t}`);let n=this.functions.length;return this.functionIdxByName[t]=n,this.functions.push(new yu(this,t,\"internal\",e)),this.nInternalFunctions++,this.functions[n]}addIimportFunction(t,e,n){if(typeof this.functionIdxByName[t]<\"u\")throw new Error(`Function already defined: ${t}`);if(this.functions.length>0&&this.functions[this.functions.length-1].type==\"internal\")throw new Error(`Import functions must be declared before internal: ${t}`);let o=n||t,d=this.functions.length;return this.functionIdxByName[t]=d,this.functions.push(new yu(this,t,\"import\",e,o)),this.nImportFunctions++,this.functions[d]}setMemory(t,e,n){this.memory={pagesSize:t,moduleName:e||\"env\",fieldName:n||\"memory\"}}exportFunction(t,e){let n=e||t;if(typeof this.functionIdxByName[t]>\"u\")throw new Error(`Function not defined: ${t}`);let o=this.functionIdxByName[t];n!=t&&(this.functionIdxByName[n]=o),this.exports.push({exportName:n,idx:o})}addFunctionToTable(t){let e=this.functionIdxByName[t];this.functionsTable.push(e)}addData(t,e){this.datas.push({offset:t,bytes:e})}alloc(t,e){let n,o;(Array.isArray(t)||ArrayBuffer.isView(t))&&typeof e>\"u\"?(n=t.length,o=t):(n=t,o=e),n=(n-1>>3)+1<<3;let d=this.free;return this.free+=n,o&&this.addData(d,o),d}allocString(t){let n=new TextEncoder().encode(t);return this.alloc([...n,0])}_setSignatures(){this.signatures=[];let t={};if(this.functionsTable.length>0){let e=this.functions[this.functionsTable[0]].getSignature(),n=this.functions[this.functionsTable[0]].getSignatureName();t[n]=0,this.signatures.push(e)}for(let e=0;e<this.functions.length;e++){let n=this.functions[e].getSignature(),o=this.functions[e].getSignatureName();typeof t[o]>\"u\"&&(t[o]=this.signatures.length,this.signatures.push(n)),this.functions[e].signatureIdx=t[o],this.functions[e].signatureName=o}}_buildType(){return this.signatures}_buildImport(){let t=[];t.push(`(import \"${this.memory.moduleName}\" \"${this.memory.fieldName}\" (memory ${this.memory.pagesSize}))`);for(let e=0;e<this.nImportFunctions;e++)t.push(`(import \"${this.functions[e].moduleName}\" \"${this.functions[e].fieldName}\" (func $${this.functions[e].fnName} (type $${this.functions[e].getSignatureName()})))`);return t}_buildFunctionsTable(){return`(table ${this.functionsTable.length} anyfunc)`}_buildElements(){let t=\"\";for(let e=0;e<this.functionsTable.length;e++)t+=\" $\"+this.functions[this.functionsTable[e]].fnName;return`(elem (i32.const 0) ${t})`}_buildExports(){let t=[];for(let e=0;e<this.exports.length;e++)t.push(`(export \"${this.exports[e].exportName}\" (func $${this.functions[this.exports[e].idx].fnName}))`);return t}_buildFunctions(){let t=[];for(let e=this.nImportFunctions;e<this.nImportFunctions+this.nInternalFunctions;e++)t.push(this.functions[e].getBody());return t}_buildData(){let t=[],e=Buffer.alloc(4);e.writeUInt32LE(this.free,0),t.push(`(data (i32.const 0) ${n(e)})`);for(let o=0;o<this.datas.length;o++)t.push(`(data (i32.const ${this.datas[o].offset}) ${n(this.datas[o].bytes)})`);return t;function n(o){let d='\"';for(let h=0;h<o.length;h++)if(o[h]<32||o[h]>126||o[h]==34||o[h]==92){let f=o[h].toString(16);for(;f.length<2;)f=\"0\"+f;d+=\"\\\\\"+f}else d+=String.fromCharCode(o[h]);return d+='\"',d}}};wu.exports=Qc});var Cu=Yt((h6,Au)=>{var Qi=Ve(),Rg=Tc();async function Og(i,t,e){let n=new Dc;n.defBytes=t,n.bitsPerBytes=e||32,n.memory=new WebAssembly.Memory({initial:2e4}),n.i32=new Uint32Array(n.memory.buffer),n.i8=new Uint8Array(n.memory.buffer);let o=new Rg;o.addIimportFunction(\"debug_log32\",\"debug\",\"log32\").addParam(\"x\",\"i32\");let h=o.addIimportFunction(\"debug_log64\",\"debug\",\"log64\");h.addParam(\"x\",\"i32\"),h.addParam(\"y\",\"i32\"),l(o),s(o),i(o,n);let f=o.build(),L=await WebAssembly.compile(f);return n.log=console.log,n.instance=await WebAssembly.instantiate(L,{env:{memory:n.memory},debug:{log32:function(x){x<0&&(x=4294967296+x);let C=x.toString(16);for(;C.length<8;)C=\"0\"+C;n.log(C+\": \"+x.toString())},log64:function(x,C){x<0&&(x=4294967296+x),C<0&&(C=4294967296+C);let g=Qi(x)+Qi(C).shiftLeft(32),$=g.toString(16);for(;$.length<16;)$=\"0\"+$;n.log($+\": \"+g.toString())}}}),Object.assign(n,n.instance.exports),Object.assign(n,o.modules),n;function l(x){let C=x.addFunction(\"log32\");C.addParam(\"x\",\"i32\");let g=C.getCodeBuilder();C.addCode(g.call(\"debug_log32\",g.getLocal(\"x\")))}function s(x){let C=x.addFunction(\"log64\");C.addParam(\"x\",\"i64\");let g=C.getCodeBuilder();C.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)))))}}var Dc=class{constructor(){}alloc(t){typeof t>\"u\"&&(t=this.defBytes),t=(t-1>>3)+1<<3;let e=this.i32[0];return this.i32[0]+=t,e}set(t,e,n){Array.isArray(e)||(e=[e]),typeof n>\"u\"&&(n=this.defBytes);let o=Math.floor((n-1)/4)+1,d=t,h=Qi.one.shiftLeft(this.bitsPerBytes);for(let f=0;f<e.length;f++){let L=Qi(e[f]);for(let l=0;l<o;l++){let s=L.divmod(h);this.i32[d>>2]=s.remainder.toJSNumber(),L=s.quotient,d+=4}if(!L.isZero())throw new Error(\"Expected v to be 0\")}return t}get(t,e,n){typeof n>\"u\"&&(typeof e>\"u\"?(e=1,n=this.defBytes):(e=n,n=this.defBytes));let o=Math.floor((n-1)/4)+1,d=Qi.one.shiftLeft(this.bitsPerBytes),h=[];for(let f=0;f<e;f++){let L=Qi.zero;for(let l=o-1;l>=0;l--){L=L.times(d);let s=this.i32[(t>>2)+l];this.bitsPerBytes<32&&s&2147483648&&(s=s-4294967296),L=L.add(s)}h.push(L),t+=o*4}return h.length==1?h[0]:h}};Au.exports=Og});var Zc=Yt((g6,Ro)=>{Ro.exports.ModuleBuilder=Tc();Ro.exports.ModuleBuilderWat=Fu();Ro.exports.buildProtoboard=Cu()});var Ru=Yt((Y6,Uu)=>{Uu.exports=qu;var Po=class extends Error{};Po.prototype.name=\"AssertionError\";function qu(i,t){if(!i){var e=new Po(t);throw Error.captureStackTrace&&Error.captureStackTrace(e,qu),e}}});var zu=Yt((X6,Pu)=>{function Ou(i){return i.length}function Gg(i){let t=i.byteLength,e=\"\";for(let n=0;n<t;n++)e+=String.fromCharCode(i[n]);return e}function Tg(i,t,e=0,n=Ou(t)){let o=Math.min(n,i.byteLength-e);for(let d=0;d<o;d++)i[e+d]=t.charCodeAt(d);return o}Pu.exports={byteLength:Ou,toString:Gg,write:Tg}});var Tu=Yt((J6,Gu)=>{var Hi=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",hi=new Uint8Array(256);for(let i=0;i<Hi.length;i++)hi[Hi.charCodeAt(i)]=i;hi[45]=62;hi[95]=63;function Mu(i){let t=i.length;return i.charCodeAt(t-1)===61&&t--,t>1&&i.charCodeAt(t-1)===61&&t--,t*3>>>2}function kg(i){let t=i.byteLength,e=\"\";for(let n=0;n<t;n+=3)e+=Hi[i[n]>>2]+Hi[(i[n]&3)<<4|i[n+1]>>4]+Hi[(i[n+1]&15)<<2|i[n+2]>>6]+Hi[i[n+2]&63];return t%3===2?e=e.substring(0,e.length-1)+\"=\":t%3===1&&(e=e.substring(0,e.length-2)+\"==\"),e}function Ng(i,t,e=0,n=Mu(t)){let o=Math.min(n,i.byteLength-e);for(let d=0,h=0;h<o;d+=4){let f=hi[t.charCodeAt(d)],L=hi[t.charCodeAt(d+1)],l=hi[t.charCodeAt(d+2)],s=hi[t.charCodeAt(d+3)];i[h++]=f<<2|L>>4,i[h++]=(L&15)<<4|l>>2,i[h++]=(l&3)<<6|s&63}return o}Gu.exports={byteLength:Mu,toString:kg,write:Ng}});var Du=Yt((tF,Qu)=>{function Nu(i){return i.length>>>1}function Qg(i){let t=i.byteLength;i=new DataView(i.buffer,i.byteOffset,t);let e=\"\",n=0;for(let o=t-t%4;n<o;n+=4)e+=i.getUint32(n).toString(16).padStart(8,\"0\");for(;n<t;n++)e+=i.getUint8(n).toString(16).padStart(2,\"0\");return e}function Dg(i,t,e=0,n=Nu(t)){let o=Math.min(n,i.byteLength-e);for(let d=0;d<o;d++){let h=ku(t.charCodeAt(d*2)),f=ku(t.charCodeAt(d*2+1));if(h===void 0||f===void 0)return i.subarray(0,d);i[e+d]=h<<4|f}return o}Qu.exports={byteLength:Nu,toString:Qg,write:Dg};function ku(i){if(i>=48&&i<=57)return i-48;if(i>=65&&i<=70)return i-65+10;if(i>=97&&i<=102)return i-97+10}});var Hu=Yt((eF,Zu)=>{function Hc(i){let t=0;for(let e=0,n=i.length;e<n;e++){let o=i.charCodeAt(e);if(o>=55296&&o<=56319&&e+1<n){let d=i.charCodeAt(e+1);if(d>=56320&&d<=57343){t+=4,e++;continue}}o<=127?t+=1:o<=2047?t+=2:t+=3}return t}var $c;if(typeof TextDecoder<\"u\"){let i=new TextDecoder;$c=function(e){return i.decode(e)}}else $c=function(t){let e=t.byteLength,n=\"\",o=0;for(;o<e;){let d=t[o];if(d<=127){n+=String.fromCharCode(d),o++;continue}let h=0,f=0;if(d<=223?(h=1,f=d&31):d<=239?(h=2,f=d&15):d<=244&&(h=3,f=d&7),e-o-h>0){let L=0;for(;L<h;)d=t[o+L+1],f=f<<6|d&63,L+=1}else f=65533,h=e-o;n+=String.fromCodePoint(f),o+=h+1}return n};var Kc;if(typeof TextEncoder<\"u\"){let i=new TextEncoder;Kc=function(e,n,o=0,d=Hc(n)){let h=Math.min(d,e.byteLength-o);return i.encodeInto(n,e.subarray(o,o+h)),h}}else Kc=function(t,e,n=0,o=Hc(e)){let d=Math.min(o,t.byteLength-n);t=t.subarray(n,n+d);let h=0,f=0;for(;h<e.length;){let L=e.codePointAt(h);if(L<=127){t[f++]=L,h++;continue}let l=0,s=0;for(L<=2047?(l=6,s=192):L<=65535?(l=12,s=224):L<=2097151&&(l=18,s=240),t[f++]=s|L>>l,l-=6;l>=0;)t[f++]=128|L>>l&63,l-=6;h+=L>=65536?2:1}return d};Zu.exports={byteLength:Hc,toString:$c,write:Kc}});var ju=Yt((nF,Ku)=>{function $u(i){return i.length*2}function Zg(i){let t=i.byteLength,e=\"\";for(let n=0;n<t-1;n+=2)e+=String.fromCharCode(i[n]+i[n+1]*256);return e}function Hg(i,t,e=0,n=$u(t)){let o=Math.min(n,i.byteLength-e),d=o;for(let h=0;h<t.length&&!((d-=2)<0);++h){let f=t.charCodeAt(h),L=f>>8,l=f%256;i[e+h*2]=l,i[e+h*2+1]=L}return o}Ku.exports={byteLength:$u,toString:Zg,write:Hg}});var Ju=Yt((Vc,Xu)=>{var $g=zu(),Kg=Tu(),jg=Du(),Vg=Hu(),Wg=ju(),zo=new Uint8Array(Uint16Array.of(255).buffer)[0]===255;function qa(i){switch(i){case\"ascii\":return $g;case\"base64\":return Kg;case\"hex\":return jg;case\"utf8\":case\"utf-8\":case void 0:case null:return Vg;case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return Wg;default:throw new Error(`Unknown encoding: ${i}`)}}function Vu(i){return i instanceof Uint8Array}function Yg(i){try{return qa(i),!0}catch{return!1}}function Xg(i,t,e){let n=new Uint8Array(i);return t!==void 0&&Vc.fill(n,t,0,n.byteLength,e),n}function Jg(i){return new Uint8Array(i)}function tp(i){return new Uint8Array(i)}function ep(i,t){return qa(t).byteLength(i)}function np(i,t){if(i===t)return 0;let e=Math.min(i.byteLength,t.byteLength);i=new DataView(i.buffer,i.byteOffset,i.byteLength),t=new DataView(t.buffer,t.byteOffset,t.byteLength);let n=0;for(let o=e-e%4;n<o;n+=4){let d=i.getUint32(n,zo),h=t.getUint32(n,zo);if(d!==h)break}for(;n<e;n++){let o=i.getUint8(n),d=t.getUint8(n);if(o<d)return-1;if(o>d)return 1}return i.byteLength>t.byteLength?1:i.byteLength<t.byteLength?-1:0}function ip(i,t){t===void 0&&(t=i.reduce((o,d)=>o+d.byteLength,0));let e=new Uint8Array(t),n=0;for(let o of i){if(n+o.byteLength>e.byteLength){let d=o.subarray(0,e.byteLength-n);return e.set(d,n),e}e.set(o,n),n+=o.byteLength}return e}function ap(i,t,e=0,n=0,o=i.byteLength){if(o>0&&o<n||o===n||i.byteLength===0||t.byteLength===0)return 0;if(e<0)throw new RangeError(\"targetStart is out of range\");if(n<0||n>=i.byteLength)throw new RangeError(\"sourceStart is out of range\");if(o<0)throw new RangeError(\"sourceEnd is out of range\");e>=t.byteLength&&(e=t.byteLength),o>i.byteLength&&(o=i.byteLength),t.byteLength-e<o-n&&(o=t.length-e+n);let d=o-n;return i===t?t.copyWithin(e,n,o):t.set(i.subarray(n,o),e),d}function op(i,t){if(i===t)return!0;if(i.byteLength!==t.byteLength)return!1;let e=i.byteLength;i=new DataView(i.buffer,i.byteOffset,i.byteLength),t=new DataView(t.buffer,t.byteOffset,t.byteLength);let n=0;for(let o=e-e%4;n<o;n+=4)if(i.getUint32(n,zo)!==t.getUint32(n,zo))return!1;for(;n<e;n++)if(i.getUint8(n)!==t.getUint8(n))return!1;return!0}function sp(i,t,e,n,o){if(typeof t==\"string\"?typeof e==\"string\"?(o=e,e=0,n=i.byteLength):typeof n==\"string\"&&(o=n,n=i.byteLength):typeof t==\"number\"?t=t&255:typeof t==\"boolean\"&&(t=+t),e<0||i.byteLength<e||i.byteLength<n)throw new RangeError(\"Out of range index\");if(e===void 0&&(e=0),n===void 0&&(n=i.byteLength),n<=e)return i;if(t||(t=0),typeof t==\"number\")for(let d=e;d<n;++d)i[d]=t;else{t=Vu(t)?t:jc(t,o);let d=t.byteLength;for(let h=0;h<n-e;++h)i[h+e]=t[h%d]}return i}function jc(i,t,e){return typeof i==\"string\"?cp(i,t):Array.isArray(i)?rp(i):ArrayBuffer.isView(i)?lp(i):dp(i,t,e)}function cp(i,t){let e=qa(t),n=new Uint8Array(e.byteLength(i));return e.write(n,i,0,n.byteLength),n}function rp(i){let t=new Uint8Array(i.length);return t.set(i),t}function lp(i){let t=new Uint8Array(i.byteLength);return t.set(i),t}function dp(i,t,e){return new Uint8Array(i,t,e)}function up(i,t,e,n){return Yu(i,t,e,n)!==-1}function Wu(i,t,e,n,o){if(i.byteLength===0)return-1;if(typeof e==\"string\"?(n=e,e=0):e===void 0?e=o?0:i.length-1:e<0&&(e+=i.byteLength),e>=i.byteLength){if(o)return-1;e=i.byteLength-1}else if(e<0)if(o)e=0;else return-1;if(typeof t==\"string\")t=jc(t,n);else if(typeof t==\"number\")return t=t&255,o?i.indexOf(t,e):i.lastIndexOf(t,e);if(t.byteLength===0)return-1;if(o){let d=-1;for(let h=e;h<i.byteLength;h++)if(i[h]===t[d===-1?0:h-d]){if(d===-1&&(d=h),h-d+1===t.byteLength)return d}else d!==-1&&(h-=h-d),d=-1}else{e+t.byteLength>i.byteLength&&(e=i.byteLength-t.byteLength);for(let d=e;d>=0;d--){let h=!0;for(let f=0;f<t.byteLength;f++)if(i[d+f]!==t[f]){h=!1;break}if(h)return d}}return-1}function Yu(i,t,e,n){return Wu(i,t,e,n,!0)}function fp(i,t,e,n){return Wu(i,t,e,n,!1)}function gi(i,t,e){let n=i[t];i[t]=i[e],i[e]=n}function _p(i){let t=i.byteLength;if(t%2!==0)throw new RangeError(\"Buffer size must be a multiple of 16-bits\");for(let e=0;e<t;e+=2)gi(i,e,e+1);return i}function hp(i){let t=i.byteLength;if(t%4!==0)throw new RangeError(\"Buffer size must be a multiple of 32-bits\");for(let e=0;e<t;e+=4)gi(i,e,e+3),gi(i,e+1,e+2);return i}function gp(i){let t=i.byteLength;if(t%8!==0)throw new RangeError(\"Buffer size must be a multiple of 64-bits\");for(let e=0;e<t;e+=8)gi(i,e,e+7),gi(i,e+1,e+6),gi(i,e+2,e+5),gi(i,e+3,e+4);return i}function pp(i){return i}function Lp(i,t,e=0,n=i.byteLength){let o=i.byteLength;return e>=o||n<=e?\"\":(e<0&&(e=0),n>o&&(n=o),(e!==0||n<o)&&(i=i.subarray(e,n)),qa(t).toString(i))}function mp(i,t,e,n,o){return e===void 0?o=\"utf8\":n===void 0&&typeof e==\"string\"?(o=e,e=void 0):o===void 0&&typeof n==\"string\"&&(o=n,n=void 0),qa(o).write(i,t,e,n)}function bp(i,t,e){return e===void 0&&(e=0),new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(e,t,!0),e+8}function yp(i,t,e){return e===void 0&&(e=0),new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(e,t,!0),e+4}function wp(i,t,e){return e===void 0&&(e=0),new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(e,t,!0),e+4}function Fp(i,t,e){return e===void 0&&(e=0),new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(e,t,!0),e+4}function Ap(i,t){return t===void 0&&(t=0),new DataView(i.buffer,i.byteOffset,i.byteLength).getFloat64(t,!0)}function Cp(i,t){return t===void 0&&(t=0),new DataView(i.buffer,i.byteOffset,i.byteLength).getFloat32(t,!0)}function xp(i,t){return t===void 0&&(t=0),new DataView(i.buffer,i.byteOffset,i.byteLength).getUint32(t,!0)}function Ip(i,t){return t===void 0&&(t=0),new DataView(i.buffer,i.byteOffset,i.byteLength).getInt32(t,!0)}function Ep(i,t,e){return e===void 0&&(e=0),new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(e,t,!1),e+8}function Bp(i,t,e){return e===void 0&&(e=0),new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(e,t,!1),e+4}function vp(i,t,e){return e===void 0&&(e=0),new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(e,t,!1),e+4}function Sp(i,t,e){return e===void 0&&(e=0),new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(e,t,!1),e+4}function qp(i,t){return t===void 0&&(t=0),new DataView(i.buffer,i.byteOffset,i.byteLength).getFloat64(t,!1)}function Up(i,t){return t===void 0&&(t=0),new DataView(i.buffer,i.byteOffset,i.byteLength).getFloat32(t,!1)}function Rp(i,t){return t===void 0&&(t=0),new DataView(i.buffer,i.byteOffset,i.byteLength).getUint32(t,!1)}function Op(i,t){return t===void 0&&(t=0),new DataView(i.buffer,i.byteOffset,i.byteLength).getInt32(t,!1)}Xu.exports=Vc={isBuffer:Vu,isEncoding:Yg,alloc:Xg,allocUnsafe:Jg,allocUnsafeSlow:tp,byteLength:ep,compare:np,concat:ip,copy:ap,equals:op,fill:sp,from:jc,includes:up,indexOf:Yu,lastIndexOf:fp,swap16:_p,swap32:hp,swap64:gp,toBuffer:pp,toString:Lp,write:mp,writeDoubleLE:bp,writeFloatLE:yp,writeUInt32LE:wp,writeInt32LE:Fp,readDoubleLE:Ap,readFloatLE:Cp,readUInt32LE:xp,readInt32LE:Ip,writeDoubleBE:Ep,writeFloatBE:Bp,writeUInt32BE:vp,writeInt32BE:Sp,readDoubleBE:qp,readFloatBE:Up,readUInt32BE:Rp,readInt32BE:Op}});var e2=Yt((iF,t2)=>{var Pp=(i,t)=>function(){return t||(0,i[Object.keys(i)[0]])((t={exports:{}}).exports,t),t.exports},zp=(()=>{for(var i=new Uint8Array(128),t=0;t<64;t++)i[t<26?t+65:t<52?t+71:t<62?t-4:t*4-205]=t;return e=>{for(var n=e.length,o=new Uint8Array((n-(e[n-1]==\"=\")-(e[n-2]==\"=\"))*3/4|0),d=0,h=0;d<n;){var f=i[e.charCodeAt(d++)],L=i[e.charCodeAt(d++)],l=i[e.charCodeAt(d++)],s=i[e.charCodeAt(d++)];o[h++]=f<<2|L>>4,o[h++]=L<<4|l>>2,o[h++]=l<<6|s}return o}})(),Mp=Pp({\"wasm-binary:./blake2b.wat\"(i,t){t.exports=zp(\"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=\")}}),Gp=Mp(),Tp=WebAssembly.compile(Gp);t2.exports=async i=>(await WebAssembly.instantiate(await Tp,i)).exports});var Oe=Yt((sF,vn)=>{var Ye=Ru(),kp=Ju(),Nn=null,n2=typeof WebAssembly<\"u\"&&e2()().then(i=>{Nn=i}),kn=64,Mo=[];vn.exports=Ze;var i2=vn.exports.BYTES_MIN=16,a2=vn.exports.BYTES_MAX=64,aF=vn.exports.BYTES=32,o2=vn.exports.KEYBYTES_MIN=16,s2=vn.exports.KEYBYTES_MAX=64,oF=vn.exports.KEYBYTES=32,c2=vn.exports.SALTBYTES=16,r2=vn.exports.PERSONALBYTES=16;function Ze(i,t,e,n,o){if(!(this instanceof Ze))return new Ze(i,t,e,n,o);if(!Nn)throw new Error(\"WASM not loaded. Wait for Blake2b.ready(cb)\");i||(i=32),o!==!0&&(Ye(i>=i2,\"digestLength must be at least \"+i2+\", was given \"+i),Ye(i<=a2,\"digestLength must be at most \"+a2+\", was given \"+i),t!=null&&(Ye(t instanceof Uint8Array,\"key must be Uint8Array or Buffer\"),Ye(t.length>=o2,\"key must be at least \"+o2+\", was given \"+t.length),Ye(t.length<=s2,\"key must be at least \"+s2+\", was given \"+t.length)),e!=null&&(Ye(e instanceof Uint8Array,\"salt must be Uint8Array or Buffer\"),Ye(e.length===c2,\"salt must be exactly \"+c2+\", was given \"+e.length)),n!=null&&(Ye(n instanceof Uint8Array,\"personal must be Uint8Array or Buffer\"),Ye(n.length===r2,\"personal must be exactly \"+r2+\", was given \"+n.length))),Mo.length||(Mo.push(kn),kn+=216),this.digestLength=i,this.finalized=!1,this.pointer=Mo.pop(),this._memory=new Uint8Array(Nn.memory.buffer),this._memory.fill(0,0,64),this._memory[0]=this.digestLength,this._memory[1]=t?t.length:0,this._memory[2]=1,this._memory[3]=1,e&&this._memory.set(e,32),n&&this._memory.set(n,48),this.pointer+216>this._memory.length&&this._realloc(this.pointer+216),Nn.blake2b_init(this.pointer,this.digestLength),t&&(this.update(t),this._memory.fill(0,kn,kn+t.length),this._memory[this.pointer+200]=128)}Ze.prototype._realloc=function(i){Nn.memory.grow(Math.max(0,Math.ceil(Math.abs(i-this._memory.length)/65536))),this._memory=new Uint8Array(Nn.memory.buffer)};Ze.prototype.update=function(i){return Ye(this.finalized===!1,\"Hash instance finalized\"),Ye(i instanceof Uint8Array,\"input must be Uint8Array or Buffer\"),kn+i.length>this._memory.length&&this._realloc(kn+i.length),this._memory.set(i,kn),Nn.blake2b_update(this.pointer,kn,kn+i.length),this};Ze.prototype.digest=function(i){if(Ye(this.finalized===!1,\"Hash instance finalized\"),this.finalized=!0,Mo.push(this.pointer),Nn.blake2b_final(this.pointer),!i||i===\"binary\")return this._memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(typeof i==\"string\")return kp.toString(this._memory,i,this.pointer+128,this.pointer+128+this.digestLength);Ye(i instanceof Uint8Array&&i.length>=this.digestLength,\"input must be Uint8Array or Buffer\");for(var t=0;t<this.digestLength;t++)i[t]=this._memory[this.pointer+128+t];return i};Ze.prototype.final=Ze.prototype.digest;Ze.WASM=Nn;Ze.SUPPORTED=typeof WebAssembly<\"u\";Ze.ready=function(i){return i||(i=Np),n2?n2.then(()=>i(),i):i(new Error(\"WebAssembly not supported\"))};Ze.prototype.ready=Ze.ready;Ze.prototype.getPartialHash=function(){return this._memory.slice(this.pointer,this.pointer+216)};Ze.prototype.setPartialHash=function(i){this._memory.set(i,this.pointer)};function Np(){}});var u2=Yt((cF,d2)=>{var Qp=An(\"fs\"),l2=An(\"events\").EventEmitter,Dp=An(\"util\"),Wc=d2.exports=function(i,t){if(!(this instanceof Wc))return new Wc(i,t);l2.call(this),t=t||{},t.maxLineLength=t.maxLineLength||4096,t.retainBuffer=!!t.retainBuffer;var e=this,n=new Buffer(t.maxLineLength),o=0,d=0,h=0,f=function(L,l){try{var s=n.slice(0,o);e.emit(\"line\",t.retainBuffer?s:s.toString(),L,l)}catch(x){e.emit(\"error\",x)}finally{o=0}};this.input=typeof i==\"string\"?Qp.createReadStream(i,t):i,this.input.on(\"open\",function(L){e.emit(\"open\",L)}).on(\"data\",function(L){for(var l=0;l<L.length;l++)L[l]==10||L[l]==13?L[l]==10&&(d++,f(d,h)):(n[o]=L[l],o++),h++}).on(\"error\",function(L){e.emit(\"error\",L)}).on(\"end\",function(){o&&(d++,f(d,h)),e.emit(\"end\")}).on(\"close\",function(){e.emit(\"close\")})};Dp.inherits(Wc,l2)});var A2=Yt(ln=>{\"use strict\";var x1=/[|\\\\{}()[\\]^$+*?.]/g,I1=Object.prototype.hasOwnProperty,_r=function(i,t){return I1.apply(i,[t])};ln.escapeRegExpChars=function(i){return i?String(i).replace(x1,\"\\\\$&\"):\"\"};var E1={\"&\":\"&\",\"<\":\"<\",\">\":\">\",'\"':\""\",\"'\":\"'\"},B1=/[&<>'\"]/g;function v1(i){return E1[i]||i}var S1=`var _ENCODE_HTML_RULES = {\n \"&\": \"&\"\n , \"<\": \"<\"\n , \">\": \">\"\n , '\"': \""\"\n , \"'\": \"'\"\n }\n , _MATCH_HTML = /[&<>'\"]/g;\nfunction encode_char(c) {\n return _ENCODE_HTML_RULES[c] || c;\n};\n`;ln.escapeXML=function(i){return i==null?\"\":String(i).replace(B1,v1)};function F2(){return Function.prototype.toString.call(this)+`;\n`+S1}try{typeof Object.defineProperty==\"function\"?Object.defineProperty(ln.escapeXML,\"toString\",{value:F2}):ln.escapeXML.toString=F2}catch{console.warn(\"Unable to set escapeXML.toString (is the Function prototype frozen?)\")}ln.shallowCopy=function(i,t){if(t=t||{},i!=null)for(var e in t)_r(t,e)&&(e===\"__proto__\"||e===\"constructor\"||(i[e]=t[e]));return i};ln.shallowCopyFromList=function(i,t,e){if(e=e||[],t=t||{},i!=null)for(var n=0;n<e.length;n++){var o=e[n];if(typeof t[o]<\"u\"){if(!_r(t,o)||o===\"__proto__\"||o===\"constructor\")continue;i[o]=t[o]}}return i};ln.cache={_data:{},set:function(i,t){this._data[i]=t},get:function(i){return this._data[i]},remove:function(i){delete this._data[i]},reset:function(){this._data={}}};ln.hyphenToCamel=function(i){return i.replace(/-[a-z]/g,function(t){return t[1].toUpperCase()})};ln.createNullProtoObjWherePossible=function(){return typeof Object.create==\"function\"?function(){return Object.create(null)}:{__proto__:null}instanceof Object?function(){return{}}:function(){return{__proto__:null}}}();ln.hasOwnOnlyObject=function(i){var t=ln.createNullProtoObjWherePossible();for(var e in i)_r(i,e)&&(t[e]=i[e]);return t}});var C2=Yt((nx,q1)=>{q1.exports={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\"}}});var R2=Yt(_e=>{\"use strict\";var gr=An(\"fs\"),Ma=An(\"path\"),xe=A2(),x2=!1,U1=C2().version,R1=\"<\",O1=\">\",P1=\"%\",q2=\"locals\",z1=\"ejs\",M1=\"(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)\",U2=[\"delimiter\",\"scope\",\"context\",\"debug\",\"compileDebug\",\"client\",\"_with\",\"rmWhitespace\",\"strict\",\"filename\",\"async\"],G1=U2.concat(\"cache\"),I2=/^\\uFEFF/,hr=/^[a-zA-Z_$][0-9a-zA-Z_$]*$/;_e.cache=xe.cache;_e.fileLoader=gr.readFileSync;_e.localsName=q2;_e.promiseImpl=new Function(\"return this;\")().Promise;_e.resolveInclude=function(i,t,e){var n=Ma.dirname,o=Ma.extname,d=Ma.resolve,h=d(e?t:n(t),i),f=o(i);return f||(h+=\".ejs\"),h};function E2(i,t){var e;if(t.some(function(n){return e=_e.resolveInclude(i,n,!0),gr.existsSync(e)}))return e}function T1(i,t){var e,n,o=t.views,d=/^[A-Za-z]+:\\\\|^\\//.exec(i);if(d&&d.length)i=i.replace(/^\\/*/,\"\"),Array.isArray(t.root)?e=E2(i,t.root):e=_e.resolveInclude(i,t.root||\"/\",!0);else if(t.filename&&(n=_e.resolveInclude(i,t.filename),gr.existsSync(n)&&(e=n)),!e&&Array.isArray(o)&&(e=E2(i,o)),!e&&typeof t.includer!=\"function\")throw new Error('Could not find the include file \"'+t.escapeFunction(i)+'\"');return e}function Ga(i,t){var e,n=i.filename,o=arguments.length>1;if(i.cache){if(!n)throw new Error(\"cache option requires a filename\");if(e=_e.cache.get(n),e)return e;o||(t=B2(n).toString().replace(I2,\"\"))}else if(!o){if(!n)throw new Error(\"Internal EJS error: no file name or template provided\");t=B2(n).toString().replace(I2,\"\")}return e=_e.compile(t,i),i.cache&&_e.cache.set(n,e),e}function k1(i,t,e){var n;if(e){try{n=Ga(i)(t)}catch(o){return e(o)}e(null,n)}else{if(typeof _e.promiseImpl==\"function\")return new _e.promiseImpl(function(o,d){try{n=Ga(i)(t),o(n)}catch(h){d(h)}});throw new Error(\"Please provide a callback function\")}}function B2(i){return _e.fileLoader(i)}function N1(i,t){var e=xe.shallowCopy(xe.createNullProtoObjWherePossible(),t);if(e.filename=T1(i,e),typeof t.includer==\"function\"){var n=t.includer(i,e.filename);if(n&&(n.filename&&(e.filename=n.filename),n.template))return Ga(e,n.template)}return Ga(e)}function v2(i,t,e,n,o){var d=t.split(`\n`),h=Math.max(n-3,0),f=Math.min(d.length,n+3),L=o(e),l=d.slice(h,f).map(function(s,x){var C=x+h+1;return(C==n?\" >> \":\" \")+C+\"| \"+s}).join(`\n`);throw i.path=L,i.message=(L||\"ejs\")+\":\"+n+`\n`+l+`\n\n`+i.message,i}function S2(i){return i.replace(/;(\\s*$)/,\"$1\")}_e.compile=function(t,e){var n;return e&&e.scope&&(x2||(console.warn(\"`scope` option is deprecated and will be removed in EJS 3\"),x2=!0),e.context||(e.context=e.scope),delete e.scope),n=new Se(t,e),n.compile()};_e.render=function(i,t,e){var n=t||xe.createNullProtoObjWherePossible(),o=e||xe.createNullProtoObjWherePossible();return arguments.length==2&&xe.shallowCopyFromList(o,n,U2),Ga(o,i)(n)};_e.renderFile=function(){var i=Array.prototype.slice.call(arguments),t=i.shift(),e,n={filename:t},o,d;return typeof arguments[arguments.length-1]==\"function\"&&(e=i.pop()),i.length?(o=i.shift(),i.length?xe.shallowCopy(n,i.pop()):(o.settings&&(o.settings.views&&(n.views=o.settings.views),o.settings[\"view cache\"]&&(n.cache=!0),d=o.settings[\"view options\"],d&&xe.shallowCopy(n,d)),xe.shallowCopyFromList(n,o,G1)),n.filename=t):o=xe.createNullProtoObjWherePossible(),k1(n,o,e)};_e.Template=Se;_e.clearCache=function(){_e.cache.reset()};function Se(i,t){var e=xe.hasOwnOnlyObject(t),n=xe.createNullProtoObjWherePossible();this.templateText=i,this.mode=null,this.truncate=!1,this.currentLine=1,this.source=\"\",n.client=e.client||!1,n.escapeFunction=e.escape||e.escapeFunction||xe.escapeXML,n.compileDebug=e.compileDebug!==!1,n.debug=!!e.debug,n.filename=e.filename,n.openDelimiter=e.openDelimiter||_e.openDelimiter||R1,n.closeDelimiter=e.closeDelimiter||_e.closeDelimiter||O1,n.delimiter=e.delimiter||_e.delimiter||P1,n.strict=e.strict||!1,n.context=e.context,n.cache=e.cache||!1,n.rmWhitespace=e.rmWhitespace,n.root=e.root,n.includer=e.includer,n.outputFunctionName=e.outputFunctionName,n.localsName=e.localsName||_e.localsName||q2,n.views=e.views,n.async=e.async,n.destructuredLocals=e.destructuredLocals,n.legacyInclude=typeof e.legacyInclude<\"u\"?!!e.legacyInclude:!0,n.strict?n._with=!1:n._with=typeof e._with<\"u\"?e._with:!0,this.opts=n,this.regex=this.createRegex()}Se.modes={EVAL:\"eval\",ESCAPED:\"escaped\",RAW:\"raw\",COMMENT:\"comment\",LITERAL:\"literal\"};Se.prototype={createRegex:function(){var i=M1,t=xe.escapeRegExpChars(this.opts.delimiter),e=xe.escapeRegExpChars(this.opts.openDelimiter),n=xe.escapeRegExpChars(this.opts.closeDelimiter);return i=i.replace(/%/g,t).replace(/</g,e).replace(/>/g,n),new RegExp(i)},compile:function(){var i,t,e=this.opts,n=\"\",o=\"\",d=e.escapeFunction,h,f=e.filename?JSON.stringify(e.filename):\"undefined\";if(!this.source){if(this.generateSource(),n+=` var __output = \"\";\n function __append(s) { if (s !== undefined && s !== null) __output += s }\n`,e.outputFunctionName){if(!hr.test(e.outputFunctionName))throw new Error(\"outputFunctionName is not a valid JS identifier.\");n+=\" var \"+e.outputFunctionName+` = __append;\n`}if(e.localsName&&!hr.test(e.localsName))throw new Error(\"localsName is not a valid JS identifier.\");if(e.destructuredLocals&&e.destructuredLocals.length){for(var L=\" var __locals = (\"+e.localsName+` || {}),\n`,l=0;l<e.destructuredLocals.length;l++){var s=e.destructuredLocals[l];if(!hr.test(s))throw new Error(\"destructuredLocals[\"+l+\"] is not a valid JS identifier.\");l>0&&(L+=`,\n `),L+=s+\" = __locals.\"+s}n+=L+`;\n`}e._with!==!1&&(n+=\" with (\"+e.localsName+` || {}) {\n`,o+=` }\n`),o+=` return __output;\n`,this.source=n+this.source+o}e.compileDebug?i=`var __line = 1\n , __lines = `+JSON.stringify(this.templateText)+`\n , __filename = `+f+`;\ntry {\n`+this.source+`} catch (e) {\n rethrow(e, __lines, __filename, __line, escapeFn);\n}\n`:i=this.source,e.client&&(i=\"escapeFn = escapeFn || \"+d.toString()+`;\n`+i,e.compileDebug&&(i=\"rethrow = rethrow || \"+v2.toString()+`;\n`+i)),e.strict&&(i=`\"use strict\";\n`+i),e.debug&&console.log(i),e.compileDebug&&e.filename&&(i=i+`\n//# sourceURL=`+f+`\n`);try{if(e.async)try{h=new Function(\"return (async function(){}).constructor;\")()}catch($){throw $ instanceof SyntaxError?new Error(\"This environment does not support async/await\"):$}else h=Function;t=new h(e.localsName+\", escapeFn, include, rethrow\",i)}catch($){throw $ instanceof SyntaxError&&(e.filename&&($.message+=\" in \"+e.filename),$.message+=` while compiling ejs\n\n`,$.message+=`If the above error is not helpful, you may want to try EJS-Lint:\n`,$.message+=\"https://github.com/RyanZim/EJS-Lint\",e.async||($.message+=`\n`,$.message+=\"Or, if you meant to create an async function, pass `async: true` as an option.\")),$}var x=e.client?t:function(it){var q=function(S,O){var M=xe.shallowCopy(xe.createNullProtoObjWherePossible(),it);return O&&(M=xe.shallowCopy(M,O)),N1(S,e)(M)};return t.apply(e.context,[it||xe.createNullProtoObjWherePossible(),d,q,v2])};if(e.filename&&typeof Object.defineProperty==\"function\"){var C=e.filename,g=Ma.basename(C,Ma.extname(C));try{Object.defineProperty(x,\"name\",{value:g,writable:!1,enumerable:!1,configurable:!0})}catch{}}return x},generateSource:function(){var i=this.opts;i.rmWhitespace&&(this.templateText=this.templateText.replace(/[\\r\\n]+/g,`\n`).replace(/^\\s+|\\s+$/gm,\"\")),this.templateText=this.templateText.replace(/[ \\t]*<%_/gm,\"<%_\").replace(/_%>[ \\t]*/gm,\"_%>\");var t=this,e=this.parseTemplateText(),n=this.opts.delimiter,o=this.opts.openDelimiter,d=this.opts.closeDelimiter;e&&e.length&&e.forEach(function(h,f){var L;if(h.indexOf(o+n)===0&&h.indexOf(o+n+n)!==0&&(L=e[f+2],!(L==n+d||L==\"-\"+n+d||L==\"_\"+n+d)))throw new Error('Could not find matching close tag for \"'+h+'\".');t.scanLine(h)})},parseTemplateText:function(){for(var i=this.templateText,t=this.regex,e=t.exec(i),n=[],o;e;)o=e.index,o!==0&&(n.push(i.substring(0,o)),i=i.slice(o)),n.push(e[0]),i=i.slice(e[0].length),e=t.exec(i);return i&&n.push(i),n},_addOutput:function(i){if(this.truncate&&(i=i.replace(/^(?:\\r\\n|\\r|\\n)/,\"\"),this.truncate=!1),!i)return i;i=i.replace(/\\\\/g,\"\\\\\\\\\"),i=i.replace(/\\n/g,\"\\\\n\"),i=i.replace(/\\r/g,\"\\\\r\"),i=i.replace(/\"/g,'\\\\\"'),this.source+=' ; __append(\"'+i+`\")\n`},scanLine:function(i){var t=this,e=this.opts.delimiter,n=this.opts.openDelimiter,o=this.opts.closeDelimiter,d=0;switch(d=i.split(`\n`).length-1,i){case n+e:case n+e+\"_\":this.mode=Se.modes.EVAL;break;case n+e+\"=\":this.mode=Se.modes.ESCAPED;break;case n+e+\"-\":this.mode=Se.modes.RAW;break;case n+e+\"#\":this.mode=Se.modes.COMMENT;break;case n+e+e:this.mode=Se.modes.LITERAL,this.source+=' ; __append(\"'+i.replace(n+e+e,n+e)+`\")\n`;break;case e+e+o:this.mode=Se.modes.LITERAL,this.source+=' ; __append(\"'+i.replace(e+e+o,e+o)+`\")\n`;break;case e+o:case\"-\"+e+o:case\"_\"+e+o:this.mode==Se.modes.LITERAL&&this._addOutput(i),this.mode=null,this.truncate=i.indexOf(\"-\")===0||i.indexOf(\"_\")===0;break;default:if(this.mode){switch(this.mode){case Se.modes.EVAL:case Se.modes.ESCAPED:case Se.modes.RAW:i.lastIndexOf(\"//\")>i.lastIndexOf(`\n`)&&(i+=`\n`)}switch(this.mode){case Se.modes.EVAL:this.source+=\" ; \"+i+`\n`;break;case Se.modes.ESCAPED:this.source+=\" ; __append(escapeFn(\"+S2(i)+`))\n`;break;case Se.modes.RAW:this.source+=\" ; __append(\"+S2(i)+`)\n`;break;case Se.modes.COMMENT:break;case Se.modes.LITERAL:this._addOutput(i);break}}else this._addOutput(i)}t.opts.compileDebug&&d&&(this.currentLine+=d,this.source+=\" ; __line = \"+this.currentLine+`\n`)}};_e.escapeXML=xe.escapeXML;_e.__express=_e.renderFile;_e.VERSION=U1;_e.name=z1;typeof window<\"u\"&&(window.ejs=_e)});var pr=Yt((Ux,Zo)=>{(function(){\"use strict\";var i=\"input is invalid type\",t=\"finalize already called\",e=typeof window==\"object\",n=e?window:{};n.JS_SHA3_NO_WINDOW&&(e=!1);var o=!e&&typeof self==\"object\",d=!n.JS_SHA3_NO_NODE_JS&&typeof process==\"object\"&&process.versions&&process.versions.node;d?n=global:o&&(n=self);var h=!n.JS_SHA3_NO_COMMON_JS&&typeof Zo==\"object\"&&Zo.exports,f=typeof define==\"function\"&&define.amd,L=!n.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<\"u\",l=\"0123456789abcdef\".split(\"\"),s=[31,7936,2031616,520093696],x=[4,1024,262144,67108864],C=[1,256,65536,16777216],g=[6,1536,393216,100663296],$=[0,8,16,24],it=[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],q=[224,256,384,512],S=[128,256],O=[\"hex\",\"buffer\",\"arrayBuffer\",\"array\",\"digest\"],M={128:168,256:136};(n.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(m){return Object.prototype.toString.call(m)===\"[object Array]\"}),L&&(n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(m){return typeof m==\"object\"&&m.buffer&&m.buffer.constructor===ArrayBuffer});for(var W=function(m,a,w){return function(c){return new vt(m,a,m).update(c)[w]()}},ct=function(m,a,w){return function(c,G){return new vt(m,a,G).update(c)[w]()}},E=function(m,a,w){return function(c,G,R,F){return T[\"cshake\"+m].update(c,G,R,F)[w]()}},_=function(m,a,w){return function(c,G,R,F){return T[\"kmac\"+m].update(c,G,R,F)[w]()}},r=function(m,a,w,c){for(var G=0;G<O.length;++G){var R=O[G];m[R]=a(w,c,R)}return m},Z=function(m,a){var w=W(m,a,\"hex\");return w.create=function(){return new vt(m,a,m)},w.update=function(c){return w.create().update(c)},r(w,W,m,a)},j=function(m,a){var w=ct(m,a,\"hex\");return w.create=function(c){return new vt(m,a,c)},w.update=function(c,G){return w.create(G).update(c)},r(w,ct,m,a)},nt=function(m,a){var w=M[m],c=E(m,a,\"hex\");return c.create=function(G,R,F){return!R&&!F?T[\"shake\"+m].create(G):new vt(m,a,G).bytepad([R,F],w)},c.update=function(G,R,F,U){return c.create(R,F,U).update(G)},r(c,E,m,a)},v=function(m,a){var w=M[m],c=_(m,a,\"hex\");return c.create=function(G,R,F){return new Pt(m,a,R).bytepad([\"KMAC\",F],w).bytepad([G],w)},c.update=function(G,R,F,U){return c.create(G,F,U).update(R)},r(c,_,m,a)},y=[{name:\"keccak\",padding:C,bits:q,createMethod:Z},{name:\"sha3\",padding:g,bits:q,createMethod:Z},{name:\"shake\",padding:s,bits:S,createMethod:j},{name:\"cshake\",padding:x,bits:S,createMethod:nt},{name:\"kmac\",padding:x,bits:S,createMethod:v}],T={},V=[],rt=0;rt<y.length;++rt)for(var dt=y[rt],ot=dt.bits,xt=0;xt<ot.length;++xt){var pt=dt.name+\"_\"+ot[xt];if(V.push(pt),T[pt]=dt.createMethod(ot[xt],dt.padding),dt.name!==\"sha3\"){var bt=dt.name+ot[xt];V.push(bt),T[bt]=T[pt]}}function vt(m,a,w){this.blocks=[],this.s=[],this.padding=a,this.outputBits=w,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(m<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=w>>5,this.extraBytes=(w&31)>>3;for(var c=0;c<50;++c)this.s[c]=0}vt.prototype.update=function(m){if(this.finalized)throw new Error(t);var a,w=typeof m;if(w!==\"string\"){if(w===\"object\"){if(m===null)throw new Error(i);if(L&&m.constructor===ArrayBuffer)m=new Uint8Array(m);else if(!Array.isArray(m)&&(!L||!ArrayBuffer.isView(m)))throw new Error(i)}else throw new Error(i);a=!0}for(var c=this.blocks,G=this.byteCount,R=m.length,F=this.blockCount,U=0,A=this.s,et,Lt;U<R;){if(this.reset)for(this.reset=!1,c[0]=this.block,et=1;et<F+1;++et)c[et]=0;if(a)for(et=this.start;U<R&&et<G;++U)c[et>>2]|=m[U]<<$[et++&3];else for(et=this.start;U<R&&et<G;++U)Lt=m.charCodeAt(U),Lt<128?c[et>>2]|=Lt<<$[et++&3]:Lt<2048?(c[et>>2]|=(192|Lt>>6)<<$[et++&3],c[et>>2]|=(128|Lt&63)<<$[et++&3]):Lt<55296||Lt>=57344?(c[et>>2]|=(224|Lt>>12)<<$[et++&3],c[et>>2]|=(128|Lt>>6&63)<<$[et++&3],c[et>>2]|=(128|Lt&63)<<$[et++&3]):(Lt=65536+((Lt&1023)<<10|m.charCodeAt(++U)&1023),c[et>>2]|=(240|Lt>>18)<<$[et++&3],c[et>>2]|=(128|Lt>>12&63)<<$[et++&3],c[et>>2]|=(128|Lt>>6&63)<<$[et++&3],c[et>>2]|=(128|Lt&63)<<$[et++&3]);if(this.lastByteIndex=et,et>=G){for(this.start=et-G,this.block=c[F],et=0;et<F;++et)A[et]^=c[et];Ht(A),this.reset=!0}else this.start=et}return this},vt.prototype.encode=function(m,a){var w=m&255,c=1,G=[w];for(m=m>>8,w=m&255;w>0;)G.unshift(w),m=m>>8,w=m&255,++c;return a?G.push(c):G.unshift(c),this.update(G),G.length},vt.prototype.encodeString=function(m){var a,w=typeof m;if(w!==\"string\"){if(w===\"object\"){if(m===null)throw new Error(i);if(L&&m.constructor===ArrayBuffer)m=new Uint8Array(m);else if(!Array.isArray(m)&&(!L||!ArrayBuffer.isView(m)))throw new Error(i)}else throw new Error(i);a=!0}var c=0,G=m.length;if(a)c=G;else for(var R=0;R<m.length;++R){var F=m.charCodeAt(R);F<128?c+=1:F<2048?c+=2:F<55296||F>=57344?c+=3:(F=65536+((F&1023)<<10|m.charCodeAt(++R)&1023),c+=4)}return c+=this.encode(c*8),this.update(m),c},vt.prototype.bytepad=function(m,a){for(var w=this.encode(a),c=0;c<m.length;++c)w+=this.encodeString(m[c]);var G=a-w%a,R=[];return R.length=G,this.update(R),this},vt.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var m=this.blocks,a=this.lastByteIndex,w=this.blockCount,c=this.s;if(m[a>>2]|=this.padding[a&3],this.lastByteIndex===this.byteCount)for(m[0]=m[w],a=1;a<w+1;++a)m[a]=0;for(m[w-1]|=2147483648,a=0;a<w;++a)c[a]^=m[a];Ht(c)}},vt.prototype.toString=vt.prototype.hex=function(){this.finalize();for(var m=this.blockCount,a=this.s,w=this.outputBlocks,c=this.extraBytes,G=0,R=0,F=\"\",U;R<w;){for(G=0;G<m&&R<w;++G,++R)U=a[G],F+=l[U>>4&15]+l[U&15]+l[U>>12&15]+l[U>>8&15]+l[U>>20&15]+l[U>>16&15]+l[U>>28&15]+l[U>>24&15];R%m===0&&(Ht(a),G=0)}return c&&(U=a[G],F+=l[U>>4&15]+l[U&15],c>1&&(F+=l[U>>12&15]+l[U>>8&15]),c>2&&(F+=l[U>>20&15]+l[U>>16&15])),F},vt.prototype.arrayBuffer=function(){this.finalize();var m=this.blockCount,a=this.s,w=this.outputBlocks,c=this.extraBytes,G=0,R=0,F=this.outputBits>>3,U;c?U=new ArrayBuffer(w+1<<2):U=new ArrayBuffer(F);for(var A=new Uint32Array(U);R<w;){for(G=0;G<m&&R<w;++G,++R)A[R]=a[G];R%m===0&&Ht(a)}return c&&(A[G]=a[G],U=U.slice(0,F)),U},vt.prototype.buffer=vt.prototype.arrayBuffer,vt.prototype.digest=vt.prototype.array=function(){this.finalize();for(var m=this.blockCount,a=this.s,w=this.outputBlocks,c=this.extraBytes,G=0,R=0,F=[],U,A;R<w;){for(G=0;G<m&&R<w;++G,++R)U=R<<2,A=a[G],F[U]=A&255,F[U+1]=A>>8&255,F[U+2]=A>>16&255,F[U+3]=A>>24&255;R%m===0&&Ht(a)}return c&&(U=R<<2,A=a[G],F[U]=A&255,c>1&&(F[U+1]=A>>8&255),c>2&&(F[U+2]=A>>16&255)),F};function Pt(m,a,w){vt.call(this,m,a,w)}Pt.prototype=new vt,Pt.prototype.finalize=function(){return this.encode(this.outputBits,!0),vt.prototype.finalize.call(this)};var Ht=function(m){var a,w,c,G,R,F,U,A,et,Lt,St,qt,Dt,kt,Bt,Tt,wt,Rt,I,z,J,st,mt,_t,It,Et,Ct,Wt,ne,D,u,b,B,p,P,k,Q,Y,H,tt,X,lt,ht,yt,At,Ft,Mt,Qt,$t,Nt,Ot,Xt,ie,ce,Ae,ze,wn,$e,Ke,Fn,Te,Me,fn;for(c=0;c<48;c+=2)G=m[0]^m[10]^m[20]^m[30]^m[40],R=m[1]^m[11]^m[21]^m[31]^m[41],F=m[2]^m[12]^m[22]^m[32]^m[42],U=m[3]^m[13]^m[23]^m[33]^m[43],A=m[4]^m[14]^m[24]^m[34]^m[44],et=m[5]^m[15]^m[25]^m[35]^m[45],Lt=m[6]^m[16]^m[26]^m[36]^m[46],St=m[7]^m[17]^m[27]^m[37]^m[47],qt=m[8]^m[18]^m[28]^m[38]^m[48],Dt=m[9]^m[19]^m[29]^m[39]^m[49],a=qt^(F<<1|U>>>31),w=Dt^(U<<1|F>>>31),m[0]^=a,m[1]^=w,m[10]^=a,m[11]^=w,m[20]^=a,m[21]^=w,m[30]^=a,m[31]^=w,m[40]^=a,m[41]^=w,a=G^(A<<1|et>>>31),w=R^(et<<1|A>>>31),m[2]^=a,m[3]^=w,m[12]^=a,m[13]^=w,m[22]^=a,m[23]^=w,m[32]^=a,m[33]^=w,m[42]^=a,m[43]^=w,a=F^(Lt<<1|St>>>31),w=U^(St<<1|Lt>>>31),m[4]^=a,m[5]^=w,m[14]^=a,m[15]^=w,m[24]^=a,m[25]^=w,m[34]^=a,m[35]^=w,m[44]^=a,m[45]^=w,a=A^(qt<<1|Dt>>>31),w=et^(Dt<<1|qt>>>31),m[6]^=a,m[7]^=w,m[16]^=a,m[17]^=w,m[26]^=a,m[27]^=w,m[36]^=a,m[37]^=w,m[46]^=a,m[47]^=w,a=Lt^(G<<1|R>>>31),w=St^(R<<1|G>>>31),m[8]^=a,m[9]^=w,m[18]^=a,m[19]^=w,m[28]^=a,m[29]^=w,m[38]^=a,m[39]^=w,m[48]^=a,m[49]^=w,kt=m[0],Bt=m[1],Ft=m[11]<<4|m[10]>>>28,Mt=m[10]<<4|m[11]>>>28,Wt=m[20]<<3|m[21]>>>29,ne=m[21]<<3|m[20]>>>29,Fn=m[31]<<9|m[30]>>>23,Te=m[30]<<9|m[31]>>>23,lt=m[40]<<18|m[41]>>>14,ht=m[41]<<18|m[40]>>>14,p=m[2]<<1|m[3]>>>31,P=m[3]<<1|m[2]>>>31,Tt=m[13]<<12|m[12]>>>20,wt=m[12]<<12|m[13]>>>20,Qt=m[22]<<10|m[23]>>>22,$t=m[23]<<10|m[22]>>>22,D=m[33]<<13|m[32]>>>19,u=m[32]<<13|m[33]>>>19,Me=m[42]<<2|m[43]>>>30,fn=m[43]<<2|m[42]>>>30,ce=m[5]<<30|m[4]>>>2,Ae=m[4]<<30|m[5]>>>2,k=m[14]<<6|m[15]>>>26,Q=m[15]<<6|m[14]>>>26,Rt=m[25]<<11|m[24]>>>21,I=m[24]<<11|m[25]>>>21,Nt=m[34]<<15|m[35]>>>17,Ot=m[35]<<15|m[34]>>>17,b=m[45]<<29|m[44]>>>3,B=m[44]<<29|m[45]>>>3,_t=m[6]<<28|m[7]>>>4,It=m[7]<<28|m[6]>>>4,ze=m[17]<<23|m[16]>>>9,wn=m[16]<<23|m[17]>>>9,Y=m[26]<<25|m[27]>>>7,H=m[27]<<25|m[26]>>>7,z=m[36]<<21|m[37]>>>11,J=m[37]<<21|m[36]>>>11,Xt=m[47]<<24|m[46]>>>8,ie=m[46]<<24|m[47]>>>8,yt=m[8]<<27|m[9]>>>5,At=m[9]<<27|m[8]>>>5,Et=m[18]<<20|m[19]>>>12,Ct=m[19]<<20|m[18]>>>12,$e=m[29]<<7|m[28]>>>25,Ke=m[28]<<7|m[29]>>>25,tt=m[38]<<8|m[39]>>>24,X=m[39]<<8|m[38]>>>24,st=m[48]<<14|m[49]>>>18,mt=m[49]<<14|m[48]>>>18,m[0]=kt^~Tt&Rt,m[1]=Bt^~wt&I,m[10]=_t^~Et&Wt,m[11]=It^~Ct&ne,m[20]=p^~k&Y,m[21]=P^~Q&H,m[30]=yt^~Ft&Qt,m[31]=At^~Mt&$t,m[40]=ce^~ze&$e,m[41]=Ae^~wn&Ke,m[2]=Tt^~Rt&z,m[3]=wt^~I&J,m[12]=Et^~Wt&D,m[13]=Ct^~ne&u,m[22]=k^~Y&tt,m[23]=Q^~H&X,m[32]=Ft^~Qt&Nt,m[33]=Mt^~$t&Ot,m[42]=ze^~$e&Fn,m[43]=wn^~Ke&Te,m[4]=Rt^~z&st,m[5]=I^~J&mt,m[14]=Wt^~D&b,m[15]=ne^~u&B,m[24]=Y^~tt<,m[25]=H^~X&ht,m[34]=Qt^~Nt&Xt,m[35]=$t^~Ot&ie,m[44]=$e^~Fn&Me,m[45]=Ke^~Te&fn,m[6]=z^~st&kt,m[7]=J^~mt&Bt,m[16]=D^~b&_t,m[17]=u^~B&It,m[26]=tt^~lt&p,m[27]=X^~ht&P,m[36]=Nt^~Xt&yt,m[37]=Ot^~ie&At,m[46]=Fn^~Me&ce,m[47]=Te^~fn&Ae,m[8]=st^~kt&Tt,m[9]=mt^~Bt&wt,m[18]=b^~_t&Et,m[19]=B^~It&Ct,m[28]=lt^~p&k,m[29]=ht^~P&Q,m[38]=Xt^~yt&Ft,m[39]=ie^~At&Mt,m[48]=Me^~ce&ze,m[49]=fn^~Ae&wn,m[0]^=it[c],m[1]^=it[c+1]};if(h)Zo.exports=T;else{for(rt=0;rt<V.length;++rt)n[V[rt]]=T[V[rt]];f&&define(function(){return T})}})()});var is=fe(Wr());var To={};Kn(To,{exportSolidityCallData:()=>cr,fullProve:()=>ar,prove:()=>Ua,verify:()=>sr});var Re={};Kn(Re,{abs:()=>x_,add:()=>fs,band:()=>Ls,bitLength:()=>oa,bits:()=>tl,bor:()=>v_,bxor:()=>S_,div:()=>ol,e:()=>ke,eq:()=>gs,exp:()=>C_,fromArray:()=>b_,fromRprBE:()=>rl,fromRprLE:()=>co,fromString:()=>ao,geq:()=>sl,gt:()=>ps,isNegative:()=>Yr,isOdd:()=>us,isZero:()=>Xr,land:()=>q_,leq:()=>B_,lnot:()=>R_,lor:()=>U_,lt:()=>E_,mod:()=>hs,mul:()=>il,naf:()=>Jr,neg:()=>nl,neq:()=>I_,one:()=>dl,pow:()=>al,shiftLeft:()=>ds,shiftRight:()=>oo,shl:()=>y_,shr:()=>w_,square:()=>A_,sub:()=>_s,toArray:()=>F_,toLEBuff:()=>sa,toNumber:()=>el,toRprBE:()=>cl,toRprLE:()=>so,toString:()=>ms,zero:()=>ll});var m_=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4];function ao(i,t){if(!t||t==10)return BigInt(i);if(t==16)return i.slice(0,2)==\"0x\"?BigInt(i):BigInt(\"0x\"+i)}var ke=ao;function b_(i,t){let e=BigInt(0);t=BigInt(t);for(let n=0;n<i.length;n++)e=e*t+BigInt(i[n]);return e}function oa(i){let t=i.toString(16);return(t.length-1)*4+m_[parseInt(t[0],16)]}function Yr(i){return BigInt(i)<BigInt(0)}function Xr(i){return!i}function ds(i,t){return BigInt(i)<<BigInt(t)}function oo(i,t){return BigInt(i)>>BigInt(t)}var y_=ds,w_=oo;function us(i){return(BigInt(i)&BigInt(1))==BigInt(1)}function Jr(i){let t=BigInt(i),e=[];for(;t;){if(t&BigInt(1)){let n=2-Number(t%BigInt(4));e.push(n),t=t-BigInt(n)}else e.push(0);t=t>>BigInt(1)}return e}function tl(i){let t=BigInt(i),e=[];for(;t;)t&BigInt(1)?e.push(1):e.push(0),t=t>>BigInt(1);return e}function el(i){if(i>BigInt(Number.MAX_SAFE_INTEGER))throw new Error(\"Number too big\");return Number(i)}function F_(i,t){let e=[],n=BigInt(i);for(t=BigInt(t);n;)e.unshift(Number(n%t)),n=n/t;return e}function fs(i,t){return BigInt(i)+BigInt(t)}function _s(i,t){return BigInt(i)-BigInt(t)}function nl(i){return-BigInt(i)}function il(i,t){return BigInt(i)*BigInt(t)}function A_(i){return BigInt(i)*BigInt(i)}function al(i,t){return BigInt(i)**BigInt(t)}function C_(i,t){return BigInt(i)**BigInt(t)}function x_(i){return BigInt(i)>=0?BigInt(i):-BigInt(i)}function ol(i,t){return BigInt(i)/BigInt(t)}function hs(i,t){return BigInt(i)%BigInt(t)}function gs(i,t){return BigInt(i)==BigInt(t)}function I_(i,t){return BigInt(i)!=BigInt(t)}function E_(i,t){return BigInt(i)<BigInt(t)}function ps(i,t){return BigInt(i)>BigInt(t)}function B_(i,t){return BigInt(i)<=BigInt(t)}function sl(i,t){return BigInt(i)>=BigInt(t)}function Ls(i,t){return BigInt(i)&BigInt(t)}function v_(i,t){return BigInt(i)|BigInt(t)}function S_(i,t){return BigInt(i)^BigInt(t)}function q_(i,t){return BigInt(i)&&BigInt(t)}function U_(i,t){return BigInt(i)||BigInt(t)}function R_(i){return!BigInt(i)}function so(i,t,e,n){let o=\"0000000\"+e.toString(16),d=new Uint32Array(i.buffer,t,n/4),h=((o.length-7)*4-1>>5)+1;for(let f=0;f<h;f++)d[f]=parseInt(o.substring(o.length-8*f-8,o.length-8*f),16);for(let f=h;f<d.length;f++)d[f]=0;for(let f=d.length*4;f<n;f++)i[f]=el(Ls(oo(e,f*8),255))}function cl(i,t,e,n){let o=\"0000000\"+e.toString(16),d=new DataView(i.buffer,i.byteOffset+t,n),h=((o.length-7)*4-1>>5)+1;for(let f=0;f<h;f++)d.setUint32(n-f*4-4,parseInt(o.substring(o.length-8*f-8,o.length-8*f),16),!1);for(let f=0;f<n/4-h;f++)d[f]=0}function co(i,t,e){e=e||i.byteLength,t=t||0;let n=new Uint32Array(i.buffer,t,e/4),o=new Array(e/4);return n.forEach((d,h)=>o[o.length-h-1]=d.toString(16).padStart(8,\"0\")),ao(o.join(\"\"),16)}function rl(i,t,e){e=e||i.byteLength,t=t||0;let n=new DataView(i.buffer,i.byteOffset+t,e),o=new Array(e/4);for(let d=0;d<e/4;d++)o[d]=n.getUint32(d*4,!1).toString(16).padStart(8,\"0\");return ao(o.join(\"\"),16)}function ms(i,t){return i.toString(t)}function sa(i){let t=new Uint8Array(Math.floor((oa(i)-1)/8)+1);return so(t,0,i,t.byteLength),t}var ll=ke(0),dl=ke(1);var O_=[];for(let i=0;i<256;i++)O_[i]=P_(i,8);function P_(i,t){let e=0,n=i;for(let o=0;o<t;o++)e<<=1,e=e|n&1,n>>=1;return e}import ey from\"crypto\";var Sh=fe(zs(),1);var bh=[];for(let i=0;i<256;i++)bh[i]=yh(i,8);function yh(i,t){let e=0,n=i;for(let o=0;o<t;o++)e<<=1,e=e|n&1,n>>=1;return e}var Cn=class i{constructor(t){this.buffers=[],this.byteLength=t;for(let e=0;e<t;e+=1073741824){let n=Math.min(t-e,1073741824);this.buffers.push(new Uint8Array(n))}}slice(t,e){e===void 0&&(e=this.byteLength),t===void 0&&(t=0);let n=e-t,o=Math.floor(t/1073741824),d=Math.floor((t+n-1)/1073741824);if(o==d||n==0)return this.buffers[o].slice(t%1073741824,t%1073741824+n);let h,f=o,L=t%1073741824,l=n;for(;l>0;){let s=L+l>1073741824?1073741824-L:l,x=new Uint8Array(this.buffers[f].buffer,this.buffers[f].byteOffset+L,s);if(s==n)return x.slice();h||(n<=1073741824?h=new Uint8Array(n):h=new i(n)),h.set(x,n-l),l=l-s,f++,L=0}return h}set(t,e){e===void 0&&(e=0);let n=t.byteLength;if(n==0)return;let o=Math.floor(e/1073741824),d=Math.floor((e+n-1)/1073741824);if(o==d)return t instanceof i&&t.buffers.length==1?this.buffers[o].set(t.buffers[0],e%1073741824):this.buffers[o].set(t,e%1073741824);let h=o,f=e%1073741824,L=n;for(;L>0;){let l=f+L>1073741824?1073741824-f:L,s=t.slice(n-L,n-L+l);new Uint8Array(this.buffers[h].buffer,this.buffers[h].byteOffset+f,l).set(s),L=L-l,h++,f=0}}};function Ms(i){let e,n;i&&(i.onmessage=function(s){let x;if(s.data?x=s.data:x=s,x[0].cmd==\"INIT\")o(x[0]).then(function(){i.postMessage(x.result)});else if(x[0].cmd==\"TERMINATE\")i.close();else{let C=l(x);i.postMessage(C)}});async function o(s){let x=new Uint8Array(s.code),C=await WebAssembly.compile(x);n=new WebAssembly.Memory({initial:s.init,maximum:32767}),e=await WebAssembly.instantiate(C,{env:{memory:n}})}function d(s){let x=new Uint32Array(n.buffer,0,1);for(;x[0]&3;)x[0]++;let C=x[0];if(x[0]+=s,x[0]+s>n.buffer.byteLength){let g=n.buffer.byteLength/65536,$=Math.floor((x[0]+s)/65536)+1;$>32767&&($=32767),n.grow($-g)}return C}function h(s){let x=d(s.byteLength);return L(x,s),x}function f(s,x){let C=new Uint8Array(n.buffer);return new Uint8Array(C.buffer,C.byteOffset+s,x)}function L(s,x){new Uint8Array(n.buffer).set(new Uint8Array(x),s)}function l(s){if(s[0].cmd==\"INIT\")return o(s[0]);let x={vars:[],out:[]},g=new Uint32Array(n.buffer,0,1)[0];for(let it=0;it<s.length;it++)switch(s[it].cmd){case\"ALLOCSET\":x.vars[s[it].var]=h(s[it].buff);break;case\"ALLOC\":x.vars[s[it].var]=d(s[it].len);break;case\"SET\":L(x.vars[s[it].var],s[it].buff);break;case\"CALL\":{let q=[];for(let S=0;S<s[it].params.length;S++){let O=s[it].params[S];typeof O.var<\"u\"?q.push(x.vars[O.var]+(O.offset||0)):typeof O.val<\"u\"&&q.push(O.val)}e.exports[s[it].fnName](...q);break}case\"GET\":x.out[s[it].out]=f(x.vars[s[it].var],s[it].len).slice();break;default:throw new Error(\"Invalid cmd\")}let $=new Uint32Array(n.buffer,0,1);return $[0]=g,x.out}return l}var Ch=fe(Gs(),1);import Jy from\"os\";function xh(i){return process.browser?globalThis.btoa(i):Buffer.from(i).toString(\"base64\")}var Ih=xh(\"(\"+Ms.toString()+\")(self)\"),tw=\"data:application/javascript;base64,\"+Ih;globalThis.curve_bn128=null;var qh=fe(zs(),1);globalThis.curve_bls12381=null;var d4=ke(\"73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001\",16),u4=ke(\"21888242871839275222246405745257275088548364400416034343698204186575808495617\"),f4=ke(\"1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab\",16),_4=ke(\"21888242871839275222246405745257275088696311157297823662689037894645226208583\");var ks=Re;import cd from\"fs\";async function Qs(i,t,e,n){if(e=e||4096*64,[\"w+\",\"wx+\",\"r\",\"ax+\",\"a+\"].indexOf(t)<0)throw new Error(\"Invalid open option\");let o=await cd.promises.open(i,t),d=await o.stat();return new Ns(o,d,e,n,i)}var Ns=class{constructor(t,e,n,o,d){for(this.fileName=d,this.fd=t,this.pos=0,this.pageSize=o||256;this.pageSize<e.blksize;)this.pageSize*=2;this.totalSize=e.size,this.totalPages=Math.floor((e.size-1)/this.pageSize)+1,this.maxPagesLoaded=Math.floor(n/this.pageSize)+1,this.pages={},this.pendingLoads=[],this.writing=!1,this.reading=!1,this.avBuffs=[],this.history={}}_loadPage(t){let e=this,n=new Promise((o,d)=>{e.pendingLoads.push({page:t,resolve:o,reject:d})});return e.__statusPage(\"After Load request: \",t),n}__statusPage(t,e){let n=[],o=this;if(!o.logHistory)return;n.push(\"==\"+t+\" \"+e);let d=\"\";for(let h=0;h<o.pendingLoads.length;h++)o.pendingLoads[h].page==e&&(d=d+\" \"+h);if(d&&n.push(\"Pending loads:\"+d),typeof o.pages[e]<\"u\"){let h=o.pages[e];n.push(\"Loaded\"),n.push(\"pendingOps: \"+h.pendingOps),h.loading&&n.push(\"loading: \"+h.loading),h.writing&&n.push(\"writing\"),h.dirty&&n.push(\"dirty\")}n.push(\"==\"),o.history[e]||(o.history[e]=[]),o.history[e].push(n)}__printHistory(t){let e=this;e.history[t]||console.log(\"Empty History \",t),console.log(\"History \"+t);for(let n=0;n<e.history[t].length;n++)for(let o=0;o<e.history[t][n].length;o++)console.log(\"-> \"+e.history[t][n][o])}_triggerLoad(){let t=this;if(t.reading||t.pendingLoads.length==0)return;let e=Object.keys(t.pages),n=[];for(let f=0;f<e.length;f++){let L=t.pages[parseInt(e[f])];L.dirty==!1&&L.pendingOps==0&&!L.writing&&!L.loading&&n.push(parseInt(e[f]))}let o=t.maxPagesLoaded-e.length,d=[];for(;t.pendingLoads.length>0&&(typeof t.pages[t.pendingLoads[0].page]<\"u\"||o>0||n.length>0);){let f=t.pendingLoads.shift();if(typeof t.pages[f.page]<\"u\"){t.pages[f.page].pendingOps++;let L=n.indexOf(f.page);L>=0&&n.splice(L,1),t.pages[f.page].loading?t.pages[f.page].loading.push(f):f.resolve(),t.__statusPage(\"After Load (cached): \",f.page)}else{if(o)o--;else{let L=n.shift();t.__statusPage(\"Before Unload: \",L),t.avBuffs.unshift(t.pages[L]),delete t.pages[L],t.__statusPage(\"After Unload: \",L)}f.page>=t.totalPages?(t.pages[f.page]=h(),f.resolve(),t.__statusPage(\"After Load (new): \",f.page)):(t.reading=!0,t.pages[f.page]=h(),t.pages[f.page].loading=[f],d.push(t.fd.read(t.pages[f.page].buff,0,t.pageSize,f.page*t.pageSize).then(L=>{t.pages[f.page].size=L.bytesRead;let l=t.pages[f.page].loading;delete t.pages[f.page].loading;for(let s=0;s<l.length;s++)l[s].resolve();return t.__statusPage(\"After Load (loaded): \",f.page),L},L=>{f.reject(L)})),t.__statusPage(\"After Load (loading): \",f.page))}}Promise.all(d).then(()=>{t.reading=!1,t.pendingLoads.length>0&&setImmediate(t._triggerLoad.bind(t)),t._tryClose()});function h(){if(t.avBuffs.length>0){let f=t.avBuffs.shift();return f.dirty=!1,f.pendingOps=1,f.size=0,f}else return{dirty:!1,buff:new Uint8Array(t.pageSize),pendingOps:1,size:0}}}_triggerWrite(){let t=this;if(t.writing)return;let e=Object.keys(t.pages),n=[];for(let o=0;o<e.length;o++){let d=t.pages[parseInt(e[o])];d.dirty&&(d.dirty=!1,d.writing=!0,t.writing=!0,n.push(t.fd.write(d.buff,0,d.size,parseInt(e[o])*t.pageSize).then(()=>{d.writing=!1},h=>{console.log(\"ERROR Writing: \"+h),t.error=h,t._tryClose()})))}t.writing&&Promise.all(n).then(()=>{t.writing=!1,setImmediate(t._triggerWrite.bind(t)),t._tryClose(),t.pendingLoads.length>0&&setImmediate(t._triggerLoad.bind(t))})}_getDirtyPage(){for(let t in this.pages)if(this.pages[t].dirty)return t;return-1}async write(t,e){if(t.byteLength==0)return;let n=this;if(typeof e>\"u\"&&(e=n.pos),n.pos=e+t.byteLength,n.totalSize<e+t.byteLength&&(n.totalSize=e+t.byteLength),n.pendingClose)throw new Error(\"Writing a closing file\");let o=Math.floor(e/n.pageSize),d=Math.floor((e+t.byteLength-1)/n.pageSize),h=[];for(let s=o;s<=d;s++)h.push(n._loadPage(s));n._triggerLoad();let f=o,L=e%n.pageSize,l=t.byteLength;for(;l>0;){await h[f-o];let s=L+l>n.pageSize?n.pageSize-L:l,x=t.slice(t.byteLength-l,t.byteLength-l+s);new Uint8Array(n.pages[f].buff.buffer,L,s).set(x),n.pages[f].dirty=!0,n.pages[f].pendingOps--,n.pages[f].size=Math.max(L+s,n.pages[f].size),f>=n.totalPages&&(n.totalPages=f+1),l=l-s,f++,L=0,n.writing||setImmediate(n._triggerWrite.bind(n))}}async read(t,e){let n=this,o=new Uint8Array(t);return await n.readToBuffer(o,0,t,e),o}async readToBuffer(t,e,n,o){if(n==0)return;let d=this;if(n>d.pageSize*d.maxPagesLoaded*.8){let C=Math.floor(n*1.1);this.maxPagesLoaded=Math.floor(C/d.pageSize)+1}if(typeof o>\"u\"&&(o=d.pos),d.pos=o+n,d.pendingClose)throw new Error(\"Reading a closing file\");let h=Math.floor(o/d.pageSize),f=Math.floor((o+n-1)/d.pageSize),L=[];for(let C=h;C<=f;C++)L.push(d._loadPage(C));d._triggerLoad();let l=h,s=o%d.pageSize,x=o+n>d.totalSize?n-(o+n-d.totalSize):n;for(;x>0;){await L[l-h],d.__statusPage(\"After Await (read): \",l);let C=s+x>d.pageSize?d.pageSize-s:x,g=new Uint8Array(d.pages[l].buff.buffer,d.pages[l].buff.byteOffset+s,C);t.set(g,e+n-x),d.pages[l].pendingOps--,d.__statusPage(\"After Op done: \",l),x=x-C,l++,s=0,d.pendingLoads.length>0&&setImmediate(d._triggerLoad.bind(d))}this.pos=o+n}_tryClose(){let t=this;!t.pendingClose||(t.error&&t.pendingCloseReject(t.error),t._getDirtyPage()>=0||t.writing||t.reading||t.pendingLoads.length>0)||t.pendingClose()}close(){let t=this;if(t.pendingClose)throw new Error(\"Closing the file twice\");return new Promise((e,n)=>{t.pendingClose=e,t.pendingCloseReject=n,t._tryClose()}).then(()=>{t.fd.close()},e=>{throw t.fd.close(),e})}async discard(){await this.close(),await cd.promises.unlink(this.fileName)}async writeULE32(t,e){let n=this,o=new Uint8Array(4);new DataView(o.buffer).setUint32(0,t,!0),await n.write(o,e)}async writeUBE32(t,e){let n=this,o=new Uint8Array(4);new DataView(o.buffer).setUint32(0,t,!1),await n.write(o,e)}async writeULE64(t,e){let n=this,o=new Uint8Array(8),d=new DataView(o.buffer);d.setUint32(0,t&4294967295,!0),d.setUint32(4,Math.floor(t/4294967296),!0),await n.write(o,e)}async readULE32(t){let n=await this.read(4,t);return new Uint32Array(n.buffer)[0]}async readUBE32(t){let n=await this.read(4,t);return new DataView(n.buffer).getUint32(0,!1)}async readULE64(t){let n=await this.read(8,t),o=new Uint32Array(n.buffer);return o[1]*4294967296+o[0]}};function dd(i){let t=i.initialSize||1048576,e=new po;return e.o=i,e.o.data=new Uint8Array(t),e.allocSize=t,e.totalSize=0,e.readOnly=!1,e.pos=0,e}function ud(i){let t=new po;return t.o=i,t.allocSize=i.data.byteLength,t.totalSize=i.data.byteLength,t.readOnly=!0,t.pos=0,t}var Ds=new Uint8Array(4),rd=new DataView(Ds.buffer),fd=new Uint8Array(8),ld=new DataView(fd.buffer),po=class{constructor(){this.pageSize=16384}_resizeIfNeeded(t){if(t>this.allocSize){let e=Math.max(this.allocSize+1048576,Math.floor(this.allocSize*1.1),t),n=new Uint8Array(e);n.set(this.o.data),this.o.data=n,this.allocSize=e}}async write(t,e){if(typeof e>\"u\"&&(e=this.pos),this.readOnly)throw new Error(\"Writing a read only file\");this._resizeIfNeeded(e+t.byteLength),this.o.data.set(t.slice(),e),e+t.byteLength>this.totalSize&&(this.totalSize=e+t.byteLength),this.pos=e+t.byteLength}async readToBuffer(t,e,n,o){if(typeof o>\"u\"&&(o=this.pos),this.readOnly&&o+n>this.totalSize)throw new Error(\"Reading out of bounds\");this._resizeIfNeeded(o+n);let h=new Uint8Array(this.o.data.buffer,this.o.data.byteOffset+o,n);t.set(h,e),this.pos=o+n}async read(t,e){let n=this,o=new Uint8Array(t);return await n.readToBuffer(o,0,t,e),o}close(){this.o.data.byteLength!=this.totalSize&&(this.o.data=this.o.data.slice(0,this.totalSize))}async discard(){}async writeULE32(t,e){let n=this;rd.setUint32(0,t,!0),await n.write(Ds,e)}async writeUBE32(t,e){let n=this;rd.setUint32(0,t,!1),await n.write(Ds,e)}async writeULE64(t,e){let n=this;ld.setUint32(0,t&4294967295,!0),ld.setUint32(4,Math.floor(t/4294967296),!0),await n.write(fd,e)}async readULE32(t){let n=await this.read(4,t);return new Uint32Array(n.buffer)[0]}async readUBE32(t){let n=await this.read(4,t);return new DataView(n.buffer).getUint32(0,!1)}async readULE64(t){let n=await this.read(8,t),o=new Uint32Array(n.buffer);return o[1]*4294967296+o[0]}};function gd(i){let t=i.initialSize||0,e=new Lo;e.o=i;let n=t?Math.floor((t-1)/4194304)+1:0;e.o.data=[];for(let o=0;o<n-1;o++)e.o.data.push(new Uint8Array(4194304));return n&&e.o.data.push(new Uint8Array(t-4194304*(n-1))),e.totalSize=0,e.readOnly=!1,e.pos=0,e}function pd(i){let t=new Lo;return t.o=i,t.totalSize=(i.data.length-1)*4194304+i.data[i.data.length-1].byteLength,t.readOnly=!0,t.pos=0,t}var Zs=new Uint8Array(4),_d=new DataView(Zs.buffer),Ld=new Uint8Array(8),hd=new DataView(Ld.buffer),Lo=class{constructor(){this.pageSize=16384}_resizeIfNeeded(t){if(t<=this.totalSize)return;if(this.readOnly)throw new Error(\"Reading out of file bounds\");let e=Math.floor((t-1)/4194304)+1;for(let n=Math.max(this.o.data.length-1,0);n<e;n++){let o=n<e-1?4194304:t-(e-1)*4194304,d=new Uint8Array(o);n==this.o.data.length-1&&d.set(this.o.data[n]),this.o.data[n]=d}this.totalSize=t}async write(t,e){let n=this;if(typeof e>\"u\"&&(e=n.pos),this.readOnly)throw new Error(\"Writing a read only file\");this._resizeIfNeeded(e+t.byteLength);let d=Math.floor(e/4194304),h=e%4194304,f=t.byteLength;for(;f>0;){let L=h+f>4194304?4194304-h:f,l=t.slice(t.byteLength-f,t.byteLength-f+L);new Uint8Array(n.o.data[d].buffer,h,L).set(l),f=f-L,d++,h=0}this.pos=e+t.byteLength}async readToBuffer(t,e,n,o){let d=this;if(typeof o>\"u\"&&(o=d.pos),this.readOnly&&o+n>this.totalSize)throw new Error(\"Reading out of bounds\");this._resizeIfNeeded(o+n);let f=Math.floor(o/4194304),L=o%4194304,l=n;for(;l>0;){let s=L+l>4194304?4194304-L:l,x=new Uint8Array(d.o.data[f].buffer,L,s);t.set(x,e+n-l),l=l-s,f++,L=0}this.pos=o+n}async read(t,e){let n=this,o=new Uint8Array(t);return await n.readToBuffer(o,0,t,e),o}close(){}async discard(){}async writeULE32(t,e){let n=this;_d.setUint32(0,t,!0),await n.write(Zs,e)}async writeUBE32(t,e){let n=this;_d.setUint32(0,t,!1),await n.write(Zs,e)}async writeULE64(t,e){let n=this;hd.setUint32(0,t&4294967295,!0),hd.setUint32(4,Math.floor(t/4294967296),!0),await n.write(Ld,e)}async readULE32(t){let n=await this.read(4,t);return new Uint32Array(n.buffer)[0]}async readUBE32(t){let n=await this.read(4,t);return new DataView(n.buffer).getUint32(0,!1)}async readULE64(t){let n=await this.read(8,t),o=new Uint32Array(n.buffer);return o[1]*4294967296+o[0]}};var md=65536,bd=8192;async function jn(i,t,e){if(typeof i==\"string\"&&(i={type:\"file\",fileName:i,cacheSize:t||md,pageSize:e||bd}),i.type==\"file\")return await Qs(i.fileName,\"w+\",i.cacheSize,i.pageSize);if(i.type==\"mem\")return dd(i);if(i.type==\"bigMem\")return gd(i);throw new Error(\"Invalid FastFile type: \"+i.type)}async function an(i,t,e){if(i instanceof Uint8Array&&(i={type:\"mem\",data:i}),process.browser?typeof i==\"string\"&&(i={type:\"mem\",data:await fetch(i).then(function(o){return o.arrayBuffer()}).then(function(o){return new Uint8Array(o)})}):typeof i==\"string\"&&(i={type:\"file\",fileName:i,cacheSize:t||md,pageSize:e||bd}),i.type==\"file\")return await Qs(i.fileName,\"r\",i.cacheSize,i.pageSize);if(i.type==\"mem\")return await ud(i);if(i.type==\"bigMem\")return await pd(i);throw new Error(\"Invalid FastFile type: \"+i.type)}async function Ee(i,t,e,n,o){let d=await an(i,n,o),h=await d.read(4),f=\"\";for(let x=0;x<4;x++)f+=String.fromCharCode(h[x]);if(f!=t)throw new Error(i+\": Invalid File format\");if(await d.readULE32()>e)throw new Error(\"Version not supported\");let l=await d.readULE32(),s=[];for(let x=0;x<l;x++){let C=await d.readULE32(),g=await d.readULE64();typeof s[C]>\"u\"&&(s[C]=[]),s[C].push({p:d.pos,size:g}),d.pos+=g}return{fd:d,sections:s}}async function Ge(i,t,e,n,o,d){let h=await jn(i,o,d),f=new Uint8Array(4);for(let L=0;L<4;L++)f[L]=t.charCodeAt(L);return await h.write(f,0),await h.writeULE32(e),await h.writeULE32(n),h}async function on(i,t){if(typeof i.writingSection<\"u\")throw new Error(\"Already writing a section\");await i.writeULE32(t),i.writingSection={pSectionSize:i.pos},await i.writeULE64(0)}async function sn(i){if(typeof i.writingSection>\"u\")throw new Error(\"Not writing a section\");let t=i.pos-i.writingSection.pSectionSize-8,e=i.pos;i.pos=i.writingSection.pSectionSize,await i.writeULE64(t),i.pos=e,delete i.writingSection}async function zn(i,t,e){if(typeof i.readingSection<\"u\")throw new Error(\"Already reading a section\");if(!t[e])throw new Error(i.fileName+\": Missing section \"+e);if(t[e].length>1)throw new Error(i.fileName+\": Section Duplicated \"+e);i.pos=t[e][0].p,i.readingSection=t[e][0]}async function Mn(i,t){if(typeof i.readingSection>\"u\")throw new Error(\"Not reading a section\");if(!t&&i.pos-i.readingSection.p!=i.readingSection.size)throw new Error(\"Invalid section size reading\");delete i.readingSection}async function Si(i,t,e,n){let o=new Uint8Array(e);ks.toRprLE(o,0,t,e),await i.write(o,n)}async function qi(i,t,e){let n=await i.read(t,e);return ks.fromRprLE(n,0,t)}async function oi(i,t,e,n,o){if(n=typeof n>\"u\"?0:n,o=typeof o>\"u\"?t[e][0].size-n:o,n+o>t[e][0].size)throw new Error(\"Reading out of the range of the section\");let d;return o<1<<30?d=new Uint8Array(o):d=new Cn(o),await i.readToBuffer(d,0,o,t[e][0].p+n),d}import $6 from\"fs\";var qe={};Kn(qe,{abs:()=>c0,add:()=>ga,band:()=>nc,bitLength:()=>si,bits:()=>Xs,bor:()=>u0,bxor:()=>f0,div:()=>ci,e:()=>me,eq:()=>Gn,exp:()=>s0,fromArray:()=>t0,fromRprBE:()=>js,fromRprLE:()=>Vn,fromString:()=>J3,geq:()=>ec,gt:()=>pa,isNegative:()=>Ws,isOdd:()=>ha,isZero:()=>Ys,land:()=>_0,leq:()=>d0,lnot:()=>g0,lor:()=>h0,lt:()=>l0,mod:()=>cn,mul:()=>tc,naf:()=>Id,neg:()=>Js,neq:()=>r0,one:()=>Wn,pow:()=>Ri,shiftLeft:()=>yo,shiftRight:()=>_a,shl:()=>e0,shr:()=>n0,square:()=>o0,sub:()=>gn,toArray:()=>a0,toLEBuff:()=>xn,toNumber:()=>i0,toRprBE:()=>Ks,toRprLE:()=>Ui,toString:()=>bo,zero:()=>Vs});var Hs={};Kn(Hs,{abs:()=>i3,add:()=>Wh,band:()=>f3,bitLength:()=>kh,bits:()=>Kh,bor:()=>_3,bxor:()=>h3,div:()=>a3,e:()=>Gh,eq:()=>s3,exp:()=>n3,fromArray:()=>Th,fromString:()=>yd,geq:()=>u3,gt:()=>l3,isNegative:()=>Nh,isOdd:()=>Hh,isZero:()=>Qh,land:()=>g3,leq:()=>d3,lnot:()=>L3,lor:()=>p3,lt:()=>r3,mod:()=>o3,mul:()=>Jh,naf:()=>$h,neg:()=>Xh,neq:()=>c3,pow:()=>e3,shiftLeft:()=>wd,shiftRight:()=>Fd,shl:()=>Dh,shr:()=>Zh,square:()=>t3,sub:()=>Yh,toArray:()=>Vh,toNumber:()=>jh});var Mh=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4];function yd(i,t){if(!t||t==10)return BigInt(i);if(t==16)return i.slice(0,2)==\"0x\"?BigInt(i):BigInt(\"0x\"+i)}var Gh=yd;function Th(i,t){let e=BigInt(0);t=BigInt(t);for(let n=0;n<i.length;n++)e=e*t+BigInt(i[n]);return e}function kh(i){let t=i.toString(16);return(t.length-1)*4+Mh[parseInt(t[0],16)]}function Nh(i){return BigInt(i)<BigInt(0)}function Qh(i){return!i}function wd(i,t){return BigInt(i)<<BigInt(t)}function Fd(i,t){return BigInt(i)>>BigInt(t)}var Dh=wd,Zh=Fd;function Hh(i){return(BigInt(i)&BigInt(1))==BigInt(1)}function $h(i){let t=BigInt(i),e=[];for(;t;){if(t&BigInt(1)){let n=2-Number(t%BigInt(4));e.push(n),t=t-BigInt(n)}else e.push(0);t=t>>BigInt(1)}return e}function Kh(i){let t=BigInt(i),e=[];for(;t;)t&BigInt(1)?e.push(1):e.push(0),t=t>>BigInt(1);return e}function jh(i){if(i>BigInt(Number.MAX_SAFE_INTEGER))throw new Error(\"Number too big\");return Number(i)}function Vh(i,t){let e=[],n=BigInt(i);for(t=BigInt(t);n;)e.unshift(Number(n%t)),n=n/t;return e}function Wh(i,t){return BigInt(i)+BigInt(t)}function Yh(i,t){return BigInt(i)-BigInt(t)}function Xh(i){return-BigInt(i)}function Jh(i,t){return BigInt(i)*BigInt(t)}function t3(i){return BigInt(i)*BigInt(i)}function e3(i,t){return BigInt(i)**BigInt(t)}function n3(i,t){return BigInt(i)**BigInt(t)}function i3(i){return BigInt(i)>=0?BigInt(i):-BigInt(i)}function a3(i,t){return BigInt(i)/BigInt(t)}function o3(i,t){return BigInt(i)%BigInt(t)}function s3(i,t){return BigInt(i)==BigInt(t)}function c3(i,t){return BigInt(i)!=BigInt(t)}function r3(i,t){return BigInt(i)<BigInt(t)}function l3(i,t){return BigInt(i)>BigInt(t)}function d3(i,t){return BigInt(i)<=BigInt(t)}function u3(i,t){return BigInt(i)>=BigInt(t)}function f3(i,t){return BigInt(i)&BigInt(t)}function _3(i,t){return BigInt(i)|BigInt(t)}function h3(i,t){return BigInt(i)^BigInt(t)}function g3(i,t){return BigInt(i)&&BigInt(t)}function p3(i,t){return BigInt(i)||BigInt(t)}function L3(i){return!BigInt(i)}var $s={};Kn($s,{abs:()=>M3,add:()=>S3,band:()=>$3,bitLength:()=>y3,bits:()=>E3,bor:()=>K3,bxor:()=>j3,div:()=>G3,e:()=>m3,eq:()=>k3,exp:()=>z3,fromArray:()=>b3,fromString:()=>Ad,geq:()=>H3,gt:()=>D3,isNegative:()=>w3,isOdd:()=>x3,isZero:()=>F3,land:()=>V3,leq:()=>Z3,lnot:()=>Y3,lor:()=>W3,lt:()=>Q3,mod:()=>T3,mul:()=>R3,naf:()=>I3,neg:()=>U3,neq:()=>N3,pow:()=>P3,shiftLeft:()=>Cd,shiftRight:()=>xd,shl:()=>A3,shr:()=>C3,square:()=>O3,sub:()=>q3,toArray:()=>v3,toNumber:()=>B3});var te=fe(Ve(),1);function Ad(i,t){return typeof i==\"string\"?i.slice(0,2)==\"0x\"?(0,te.default)(i.slice(2),16):(0,te.default)(i,t):(0,te.default)(i,t)}var m3=Ad;function b3(i,t){return te.default.fromArray(i,t)}function y3(i){return(0,te.default)(i).bitLength()}function w3(i){return(0,te.default)(i).isNegative()}function F3(i){return(0,te.default)(i).isZero()}function Cd(i,t){return(0,te.default)(i).shiftLeft(t)}function xd(i,t){return(0,te.default)(i).shiftRight(t)}var A3=Cd,C3=xd;function x3(i){return(0,te.default)(i).isOdd()}function I3(i){let t=(0,te.default)(i),e=[];for(;t.gt(te.default.zero);){if(t.isOdd()){let n=2-t.mod(4).toJSNumber();e.push(n),t=t.minus(n)}else e.push(0);t=t.shiftRight(1)}return e}function E3(i){let t=(0,te.default)(i),e=[];for(;t.gt(te.default.zero);)t.isOdd()?e.push(1):e.push(0),t=t.shiftRight(1);return e}function B3(i){if(!i.lt((0,te.default)(\"9007199254740992\",10)))throw new Error(\"Number too big\");return i.toJSNumber()}function v3(i,t){return(0,te.default)(i).toArray(t)}function S3(i,t){return(0,te.default)(i).add((0,te.default)(t))}function q3(i,t){return(0,te.default)(i).minus((0,te.default)(t))}function U3(i){return te.default.zero.minus((0,te.default)(i))}function R3(i,t){return(0,te.default)(i).times((0,te.default)(t))}function O3(i){return(0,te.default)(i).square()}function P3(i,t){return(0,te.default)(i).pow((0,te.default)(t))}function z3(i,t){return(0,te.default)(i).pow((0,te.default)(t))}function M3(i){return(0,te.default)(i).abs()}function G3(i,t){return(0,te.default)(i).divide((0,te.default)(t))}function T3(i,t){return(0,te.default)(i).mod((0,te.default)(t))}function k3(i,t){return(0,te.default)(i).eq((0,te.default)(t))}function N3(i,t){return(0,te.default)(i).neq((0,te.default)(t))}function Q3(i,t){return(0,te.default)(i).lt((0,te.default)(t))}function D3(i,t){return(0,te.default)(i).gt((0,te.default)(t))}function Z3(i,t){return(0,te.default)(i).leq((0,te.default)(t))}function H3(i,t){return(0,te.default)(i).geq((0,te.default)(t))}function $3(i,t){return(0,te.default)(i).and((0,te.default)(t))}function K3(i,t){return(0,te.default)(i).or((0,te.default)(t))}function j3(i,t){return(0,te.default)(i).xor((0,te.default)(t))}function V3(i,t){return!(0,te.default)(i).isZero()&&!(0,te.default)(t).isZero()}function W3(i,t){return!(0,te.default)(i).isZero()||!(0,te.default)(t).isZero()}function Y3(i){return(0,te.default)(i).isZero()}var X3=typeof BigInt==\"function\",Be={};X3?Object.assign(Be,Hs):Object.assign(Be,$s);Be.toRprLE=function(t,e,n,o){let d=\"0000000\"+n.toString(16),h=new Uint32Array(t.buffer,e,o/4),f=((d.length-7)*4-1>>5)+1;for(let L=0;L<f;L++)h[L]=parseInt(d.substring(d.length-8*L-8,d.length-8*L),16);for(let L=f;L<h.length;L++)h[L]=0;for(let L=h.length*4;L<o;L++)t[L]=Be.toNumber(Be.band(Be.shiftRight(n,L*8),255))};Be.toRprBE=function(t,e,n,o){let d=\"0000000\"+n.toString(16),h=new DataView(t.buffer,t.byteOffset+e,o),f=((d.length-7)*4-1>>5)+1;for(let L=0;L<f;L++)h.setUint32(o-L*4-4,parseInt(d.substring(d.length-8*L-8,d.length-8*L),16),!1);for(let L=0;L<o/4-f;L++)h[L]=0};Be.fromRprLE=function(t,e,n){n=n||t.byteLength,e=e||0;let o=new Uint32Array(t.buffer,e,n/4),d=new Array(n/4);return o.forEach((h,f)=>d[d.length-f-1]=h.toString(16).padStart(8,\"0\")),Be.fromString(d.join(\"\"),16)};Be.fromRprBE=function(t,e,n){n=n||t.byteLength,e=e||0;let o=new DataView(t.buffer,t.byteOffset+e,n),d=new Array(n/4);for(let h=0;h<n/4;h++)d[h]=o.getUint32(h*4,!1).toString(16).padStart(8,\"0\");return Be.fromString(d.join(\"\"),16)};Be.toString=function(t,e){return t.toString(e)};Be.toLEBuff=function(t){let e=new Uint8Array(Math.floor((Be.bitLength(t)-1)/8)+1);return Be.toRprLE(e,0,t,e.byteLength),e};Be.zero=Be.e(0);Be.one=Be.e(1);var{toRprLE:Ui,toRprBE:Ks,fromRprLE:Vn,fromRprBE:js,toString:bo,toLEBuff:xn,zero:Vs,one:Wn,fromString:J3,e:me,fromArray:t0,bitLength:si,isNegative:Ws,isZero:Ys,shiftLeft:yo,shiftRight:_a,shl:e0,shr:n0,isOdd:ha,naf:Id,bits:Xs,toNumber:i0,toArray:a0,add:ga,sub:gn,neg:Js,mul:tc,square:o0,pow:Ri,exp:s0,abs:c0,div:ci,mod:cn,eq:Gn,neq:r0,lt:l0,gt:pa,leq:d0,geq:ec,band:nc,bor:u0,bxor:f0,land:_0,lor:h0,lnot:g0}=Be;var p0=[];for(let i=0;i<256;i++)p0[i]=L0(i,8);function L0(i,t){let e=0,n=i;for(let o=0;o<t;o++)e<<=1,e=e|n&1,n>>=1;return e}function La(i,t,e){if(Ys(e))return i.one;let n=Xs(e);if(n.legth==0)return i.one;let o=t;for(let d=n.length-2;d>=0;d--)o=i.square(o),n[d]&&(o=i.mul(o,t));return o}function Oi(i){if(i.m%2==1)if(Gn(cn(i.p,4),1))if(Gn(cn(i.p,8),1))if(Gn(cn(i.p,16),1))m0(i);else if(Gn(cn(i.p,16),9))b0(i);else throw new Error(\"Field withot sqrt\");else if(Gn(cn(i.p,8),5))y0(i);else throw new Error(\"Field withot sqrt\");else Gn(cn(i.p,4),3)&&w0(i);else{let t=cn(Ri(i.p,i.m/2),4);t==1?F0(i):t==3?A0(i):C0(i)}}function m0(i){for(i.sqrt_q=Ri(i.p,i.m),i.sqrt_s=0,i.sqrt_t=gn(i.sqrt_q,1);!ha(i.sqrt_t);)i.sqrt_s=i.sqrt_s+1,i.sqrt_t=ci(i.sqrt_t,2);let t=i.one;for(;i.eq(t,i.one);){let e=i.random();i.sqrt_z=i.pow(e,i.sqrt_t),t=i.pow(i.sqrt_z,2**(i.sqrt_s-1))}i.sqrt_tm1d2=ci(gn(i.sqrt_t,1),2),i.sqrt=function(e){let n=this;if(n.isZero(e))return n.zero;let o=n.pow(e,n.sqrt_tm1d2),d=n.pow(n.mul(n.square(o),e),2**(n.sqrt_s-1));if(n.eq(d,n.negone))return null;let h=n.sqrt_s,f=n.mul(e,o),L=n.mul(f,o),l=n.sqrt_z;for(;!n.eq(L,n.one);){let s=n.square(L),x=1;for(;!n.eq(s,n.one);)s=n.square(s),x++;o=l;for(let C=0;C<h-x-1;C++)o=n.square(o);l=n.square(o),L=n.mul(L,l),f=n.mul(f,o),h=x}return n.geq(f,n.zero)?f:n.neg(f)}}function b0(i){i.sqrt=function(){throw new Error(\"Sqrt alg 4 not implemented\")}}function y0(i){i.sqrt=function(){throw new Error(\"Sqrt alg 3 not implemented\")}}function w0(i){i.sqrt_q=Ri(i.p,i.m),i.sqrt_e1=ci(gn(i.sqrt_q,3),4),i.sqrt=function(t){if(this.isZero(t))return this.zero;let e=this.pow(t,this.sqrt_e1),n=this.mul(this.square(e),t);if(this.eq(n,this.negone))return null;let o=this.mul(e,t);return i.geq(o,i.zero)?o:i.neg(o)}}function F0(i){i.sqrt=function(){throw new Error(\"Sqrt alg 10 not implemented\")}}function A0(i){i.sqrt_q=Ri(i.p,i.m/2),i.sqrt_e34=ci(gn(i.sqrt_q,3),4),i.sqrt_e12=ci(gn(i.sqrt_q,1),2),i.frobenius=function(t,e){return t%2==1?i.conjugate(e):e},i.sqrt=function(t){let e=this,n=e.pow(t,e.sqrt_e34),o=e.mul(e.square(n),t),d=e.mul(e.frobenius(1,o),o);if(e.eq(d,e.negone))return null;let h=e.mul(n,t),f;if(e.eq(o,e.negone))f=e.mul(h,[e.F.zero,e.F.one]);else{let L=e.pow(e.add(e.one,o),e.sqrt_e12);f=e.mul(L,h)}return e.geq(f,e.zero)?f:e.neg(f)}}function C0(i){i.sqrt=function(){throw new Error(\"Sqrt alg 8 not implemented\")}}function Yn(i,t,e,n,o){i[t]=i[t]+i[e]>>>0,i[o]=(i[o]^i[t])>>>0,i[o]=(i[o]<<16|i[o]>>>16&65535)>>>0,i[n]=i[n]+i[o]>>>0,i[e]=(i[e]^i[n])>>>0,i[e]=(i[e]<<12|i[e]>>>20&4095)>>>0,i[t]=i[t]+i[e]>>>0,i[o]=(i[o]^i[t])>>>0,i[o]=(i[o]<<8|i[o]>>>24&255)>>>0,i[n]=i[n]+i[o]>>>0,i[e]=(i[e]^i[n])>>>0,i[e]=(i[e]<<7|i[e]>>>25&127)>>>0}function x0(i){Yn(i,0,4,8,12),Yn(i,1,5,9,13),Yn(i,2,6,10,14),Yn(i,3,7,11,15),Yn(i,0,5,10,15),Yn(i,1,6,11,12),Yn(i,2,7,8,13),Yn(i,3,4,9,14)}var In=class{constructor(t){t=t||[0,0,0,0,0,0,0,0],this.state=[1634760805,857760878,2036477234,1797285236,t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[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 ga(tc(this.nextU32(),4294967296),this.nextU32())}nextBool(){return(this.nextU32()&1)==1}update(){for(let t=0;t<16;t++)this.buff[t]=this.state[t];for(let t=0;t<10;t++)x0(this.buff);for(let t=0;t<16;t++)this.buff[t]=this.buff[t]+this.state[t]>>>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)))}};import I0 from\"crypto\";function ma(i){let t=new Uint8Array(i);if(process.browser)if(typeof globalThis.crypto<\"u\")globalThis.crypto.getRandomValues(t);else for(let e=0;e<i;e++)t[e]=Math.random()*4294967296>>>0;else I0.randomFillSync(t);return t}function E0(){let i=ma(32),t=new Uint32Array(i.buffer),e=[];for(let n=0;n<8;n++)e.push(t[n]);return e}var Fo=null;function Pi(){return Fo||(Fo=new In(E0()),Fo)}var ba=class{constructor(t){this.type=\"F1\",this.one=BigInt(1),this.zero=BigInt(0),this.p=BigInt(t),this.m=1,this.negone=this.p-this.one,this.two=BigInt(2),this.half=this.p>>this.one,this.bitLength=si(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);let e=this.negone>>this.one;this.nqr=this.two;let n=this.pow(this.nqr,e);for(;!this.eq(n,this.negone);)this.nqr=this.nqr+this.one,n=this.pow(this.nqr,e);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),Oi(this)}e(t,e){let n;if(e?e==16&&(n=BigInt(\"0x\"+t)):n=BigInt(t),n<0){let o=-n;return o>=this.p&&(o=o%this.p),this.p-o}else return n>=this.p?n%this.p:n}add(t,e){let n=t+e;return n>=this.p?n-this.p:n}sub(t,e){return t>=e?t-e:this.p-e+t}neg(t){return t&&this.p-t}mul(t,e){return t*e%this.p}mulScalar(t,e){return t*this.e(e)%this.p}square(t){return t*t%this.p}eq(t,e){return t==e}neq(t,e){return t!=e}lt(t,e){let n=t>this.half?t-this.p:t,o=e>this.half?e-this.p:e;return n<o}gt(t,e){let n=t>this.half?t-this.p:t,o=e>this.half?e-this.p:e;return n>o}leq(t,e){let n=t>this.half?t-this.p:t,o=e>this.half?e-this.p:e;return n<=o}geq(t,e){let n=t>this.half?t-this.p:t,o=e>this.half?e-this.p:e;return n>=o}div(t,e){return this.mul(t,this.inv(e))}idiv(t,e){if(!e)throw new Error(\"Division by zero\");return t/e}inv(t){if(!t)throw new Error(\"Division by zero\");let e=this.zero,n=this.p,o=this.one,d=t%this.p;for(;d;){let h=n/d;[e,o]=[o,e-h*o],[n,d]=[d,n-h*d]}return e<this.zero&&(e+=this.p),e}mod(t,e){return t%e}pow(t,e){return La(this,t,e)}exp(t,e){return La(this,t,e)}band(t,e){let n=t&e&this.mask;return n>=this.p?n-this.p:n}bor(t,e){let n=(t|e)&this.mask;return n>=this.p?n-this.p:n}bxor(t,e){let n=(t^e)&this.mask;return n>=this.p?n-this.p:n}bnot(t){let e=t^this.mask;return e>=this.p?e-this.p:e}shl(t,e){if(Number(e)<this.bitLength){let n=t<<e&this.mask;return n>=this.p?n-this.p:n}else{let n=this.p-e;return Number(n)<this.bitLength?t>>n:this.zero}}shr(t,e){if(Number(e)<this.bitLength)return t>>e;{let n=this.p-e;if(Number(n)<this.bitLength){let o=t<<n&this.mask;return o>=this.p?o-this.p:o}else return 0}}land(t,e){return t&&e?this.one:this.zero}lor(t,e){return t||e?this.one:this.zero}lnot(t){return t?this.zero:this.one}sqrt_old(t){if(t==this.zero)return this.zero;if(this.pow(t,this.negone>>this.one)!=this.one)return null;let n=this.s,o=this.nqr_to_t,d=this.pow(t,this.t),h=this.pow(t,this.add(this.t,this.one)>>this.one);for(;d!=this.one;){let f=this.square(d),L=1;for(;f!=this.one;)L++,f=this.square(f);let l=o;for(let s=0;s<n-L-1;s++)l=this.square(l);n=L,o=this.square(l),d=this.mul(d,o),h=this.mul(h,l)}return h>this.p>>this.one&&(h=this.neg(h)),h}normalize(t,e){if(t=BigInt(t,e),t<0){let n=-t;return n>=this.p&&(n=n%this.p),this.p-n}else return t>=this.p?t%this.p:t}random(){let t=this.bitLength*2/8,e=this.zero;for(let n=0;n<t;n++)e=(e<<BigInt(8))+BigInt(ma(1)[0]);return e%this.p}toString(t,e){let n;return t>this.half?n=\"-\"+(this.p-t).toString(e):n=t.toString(e),n}isZero(t){return t==this.zero}fromRng(t){let e;do{e=this.zero;for(let n=0;n<this.n64;n++)e+=t.nextU64()<<BigInt(64*n);e&=this.mask}while(e>=this.p);return e=e*this.Ri%this.p,e}};var ye=fe(Ve(),1);var ya=class{constructor(t){this.type=\"F1\",this.one=ye.default.one,this.zero=ye.default.zero,this.p=(0,ye.default)(t),this.m=1,this.negone=this.p.minus(ye.default.one),this.two=(0,ye.default)(2),this.half=this.p.shiftRight(1),this.bitLength=this.p.bitLength(),this.mask=ye.default.one.shiftLeft(this.bitLength).minus(ye.default.one),this.n64=Math.floor((this.bitLength-1)/64)+1,this.n32=this.n64*2,this.n8=this.n64*8,this.R=ye.default.one.shiftLeft(this.n64*64),this.Ri=this.inv(this.R);let e=this.negone.shiftRight(this.one);this.nqr=this.two;let n=this.pow(this.nqr,e);for(;!n.equals(this.negone);)this.nqr=this.nqr.add(this.one),n=this.pow(this.nqr,e);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),Oi(this)}e(t,e){let n=(0,ye.default)(t,e);return this.normalize(n)}add(t,e){let n=t.add(e);return n.geq(this.p)&&(n=n.minus(this.p)),n}sub(t,e){return t.geq(e)?t.minus(e):this.p.minus(e.minus(t))}neg(t){return t.isZero()?t:this.p.minus(t)}mul(t,e){return t.times(e).mod(this.p)}mulScalar(t,e){return t.times((0,ye.default)(e)).mod(this.p)}square(t){return t.square().mod(this.p)}eq(t,e){return t.eq(e)}neq(t,e){return t.neq(e)}lt(t,e){let n=t.gt(this.half)?t.minus(this.p):t,o=e.gt(this.half)?e.minus(this.p):e;return n.lt(o)}gt(t,e){let n=t.gt(this.half)?t.minus(this.p):t,o=e.gt(this.half)?e.minus(this.p):e;return n.gt(o)}leq(t,e){let n=t.gt(this.half)?t.minus(this.p):t,o=e.gt(this.half)?e.minus(this.p):e;return n.leq(o)}geq(t,e){let n=t.gt(this.half)?t.minus(this.p):t,o=e.gt(this.half)?e.minus(this.p):e;return n.geq(o)}div(t,e){if(e.isZero())throw new Error(\"Division by zero\");return t.times(e.modInv(this.p)).mod(this.p)}idiv(t,e){if(e.isZero())throw new Error(\"Division by zero\");return t.divide(e)}inv(t){if(t.isZero())throw new Error(\"Division by zero\");return t.modInv(this.p)}mod(t,e){return t.mod(e)}pow(t,e){return t.modPow(e,this.p)}exp(t,e){return t.modPow(e,this.p)}band(t,e){return t.and(e).and(this.mask).mod(this.p)}bor(t,e){return t.or(e).and(this.mask).mod(this.p)}bxor(t,e){return t.xor(e).and(this.mask).mod(this.p)}bnot(t){return t.xor(this.mask).mod(this.p)}shl(t,e){if(e.lt(this.bitLength))return t.shiftLeft(e).and(this.mask).mod(this.p);{let n=this.p.minus(e);return n.lt(this.bitLength)?this.shr(t,n):ye.default.zero}}shr(t,e){if(e.lt(this.bitLength))return t.shiftRight(e);{let n=this.p.minus(e);return n.lt(this.bitLength)?this.shl(t,n):ye.default.zero}}land(t,e){return t.isZero()||e.isZero()?ye.default.zero:ye.default.one}lor(t,e){return t.isZero()&&e.isZero()?ye.default.zero:ye.default.one}lnot(t){return t.isZero()?ye.default.one:ye.default.zero}sqrt_old(t){if(t.equals(this.zero))return this.zero;if(!this.pow(t,this.negone.shiftRight(this.one)).equals(this.one))return null;let n=parseInt(this.s),o=this.nqr_to_t,d=this.pow(t,this.t),h=this.pow(t,this.add(this.t,this.one).shiftRight(this.one));for(;!d.equals(this.one);){let f=this.square(d),L=1;for(;!f.equals(this.one);)L++,f=this.square(f);let l=o;for(let s=0;s<n-L-1;s++)l=this.square(l);n=L,o=this.square(l),d=this.mul(d,o),h=this.mul(h,l)}return h.greater(this.p.shiftRight(this.one))&&(h=this.neg(h)),h}normalize(t){return t=(0,ye.default)(t),t.isNegative()?this.p.minus(t.abs().mod(this.p)):t.mod(this.p)}random(){let t=(0,ye.default)(0),e=(0,ye.default)(this.p.square());for(;!e.isZero();)t=t.shiftLeft(8).add((0,ye.default)(ma(1)[0])),e=e.shiftRight(8);return t.mod(this.p)}toString(t,e){let n;return t.lesserOrEquals(this.p.shiftRight((0,ye.default)(1)))?n=t.toString(e):n=\"-\"+this.p.minus(t).toString(e),n}isZero(t){return t.isZero()}fromRng(t){let e;do{e=(0,ye.default)(0);for(let n=0;n<this.n64;n++)e=e.add(e,t.nextU64().shiftLeft(64*n));e=e.and(this.mask)}while(e.geq(this.p));return e=e.times(this.Ri).mod(this.q),e}};var B0=typeof BigInt==\"function\",ic;B0?ic=ba:ic=ya;var Xn=class extends ic{toRprLE(t,e,n){Ui(t,e,n,this.n64*8)}toRprBE(t,e,n){Ks(t,e,n,this.n64*8)}toRprBEM(t,e,n){return this.toRprBE(t,e,this.mul(this.R,n))}toRprLEM(t,e,n){return this.toRprLE(t,e,this.mul(this.R,n))}fromRprLE(t,e){return Vn(t,e,this.n8)}fromRprBE(t,e){return js(t,e,this.n8)}fromRprLEM(t,e){return this.mul(this.fromRprLE(t,e),this.Ri)}fromRprBEM(t,e){return this.mul(this.fromRprBE(t,e),this.Ri)}};var xu=fe(bc(),1);var Bo={};Kn(Bo,{array2buffer:()=>xa,beBuff2int:()=>ug,beInt2Buff:()=>fg,bitReverse:()=>rg,buffReverseBits:()=>Bc,buffer2array:()=>Gi,leBuff2int:()=>_g,leInt2Buff:()=>vc,log2:()=>Qe,stringifyBigInts:()=>lg,stringifyFElements:()=>hg,unstringifyBigInts:()=>dg,unstringifyFElements:()=>gg});var Cc={};Kn(Cc,{beBuff2int:()=>X0,beInt2Buff:()=>J0,leBuff2int:()=>tg,leInt2Buff:()=>eg,stringifyBigInts:()=>yc,stringifyFElements:()=>Fc,unstringifyBigInts:()=>wc,unstringifyFElements:()=>Ac});function yc(i){if(typeof i==\"bigint\"||i.eq!==void 0)return i.toString(10);if(i instanceof Uint8Array)return Vn(i,0);if(Array.isArray(i))return i.map(yc);if(typeof i==\"object\"){let t={};return Object.keys(i).forEach(n=>{t[n]=yc(i[n])}),t}else return i}function wc(i){if(typeof i==\"string\"&&/^[0-9]+$/.test(i))return BigInt(i);if(typeof i==\"string\"&&/^0x[0-9a-fA-F]+$/.test(i))return BigInt(i);if(Array.isArray(i))return i.map(wc);if(typeof i==\"object\"){if(i===null)return null;let t={};return Object.keys(i).forEach(n=>{t[n]=wc(i[n])}),t}else return i}function X0(i){let t=BigInt(0),e=i.length,n=0,o=new DataView(i.buffer,i.byteOffset,i.byteLength);for(;e>0;)e>=4?(e-=4,t+=BigInt(o.getUint32(e))<<BigInt(n*8),n+=4):e>=2?(e-=2,t+=BigInt(o.getUint16(e))<<BigInt(n*8),n+=2):(e-=1,t+=BigInt(o.getUint8(e))<<BigInt(n*8),n+=1);return t}function J0(i,t){let e=i,n=new Uint8Array(t),o=new DataView(n.buffer),d=t;for(;d>0;)d-4>=0?(d-=4,o.setUint32(d,Number(e&BigInt(4294967295))),e=e>>BigInt(32)):d-2>=0?(d-=2,o.setUint16(d,Number(e&BigInt(65535))),e=e>>BigInt(16)):(d-=1,o.setUint8(d,Number(e&BigInt(255))),e=e>>BigInt(8));if(e)throw new Error(\"Number does not fit in this length\");return n}function tg(i){let t=BigInt(0),e=0,n=new DataView(i.buffer,i.byteOffset,i.byteLength);for(;e<i.length;)e+4<=i.length?(t+=BigInt(n.getUint32(e,!0))<<BigInt(e*8),e+=4):e+4<=i.length?(t+=BigInt(n.getUint16(e,!0))<<BigInt(e*8),e+=2):(t+=BigInt(n.getUint8(e,!0))<<BigInt(e*8),e+=1);return t}function eg(i,t){let e=i;typeof t>\"u\"&&(t=Math.floor((si(i)-1)/8)+1,t==0&&(t=1));let n=new Uint8Array(t),o=new DataView(n.buffer),d=0;for(;d<t;)d+4<=t?(o.setUint32(d,Number(e&BigInt(4294967295)),!0),d+=4,e=e>>BigInt(32)):d+2<=t?(o.setUint16(Number(d,e&BigInt(65535)),!0),d+=2,e=e>>BigInt(16)):(o.setUint8(Number(d,e&BigInt(255)),!0),d+=1,e=e>>BigInt(8));if(e)throw new Error(\"Number does not fit in this length\");return n}function Fc(i,t){if(typeof t==\"bigint\"||t.eq!==void 0)return t.toString(10);if(t instanceof Uint8Array)return i.toString(i.e(t));if(Array.isArray(t))return t.map(Fc.bind(this,i));if(typeof t==\"object\"){let e={};return Object.keys(t).forEach(o=>{e[o]=Fc(i,t[o])}),e}else return t}function Ac(i,t){if(typeof t==\"string\"&&/^[0-9]+$/.test(t))return i.e(t);if(typeof t==\"string\"&&/^0x[0-9a-fA-F]+$/.test(t))return i.e(t);if(Array.isArray(t))return t.map(Ac.bind(this,i));if(typeof t==\"object\"){if(t===null)return null;let e={};return Object.keys(t).forEach(o=>{e[o]=Ac(i,t[o])}),e}else return t}var Ec={};Kn(Ec,{beBuff2int:()=>ng,beInt2Buff:()=>ig,leBuff2int:()=>ag,leInt2Buff:()=>og,stringifyBigInts:()=>xc,unstringifyBigInts:()=>Ic});var We=fe(Ve(),1);function xc(i){if(typeof i==\"bigint\"||i.eq!==void 0)return i.toString(10);if(Array.isArray(i))return i.map(xc);if(typeof i==\"object\"){let t={};return Object.keys(i).forEach(n=>{t[n]=xc(i[n])}),t}else return i}function Ic(i){if(typeof i==\"string\"&&/^[0-9]+$/.test(i))return(0,We.default)(i);if(typeof i==\"string\"&&/^0x[0-9a-fA-F]+$/.test(i))return(0,We.default)(i);if(Array.isArray(i))return i.map(Ic);if(typeof i==\"object\"){let t={};return Object.keys(i).forEach(n=>{t[n]=Ic(i[n])}),t}else return i}function ng(i){let t=We.default.zero;for(let e=0;e<i.length;e++){let n=(0,We.default)(i[i.length-e-1]);t=t.add(n.shiftLeft(e*8))}return t}function ig(i,t){let e=i,n=t-1,o=new Uint8Array(t);for(;e.gt(We.default.zero)&&n>=0;){let d=Number(e.and((0,We.default)(\"255\")));o[n]=d,n--,e=e.shiftRight(8)}if(!e.eq(We.default.zero))throw new Error(\"Number does not fit in this length\");return o}function ag(i){let t=We.default.zero;for(let e=0;e<i.length;e++){let n=(0,We.default)(i[e]);t=t.add(n.shiftLeft(e*8))}return t}function og(i,t){let e=i,n=0,o=new Uint8Array(t);for(;e.gt(We.default.zero)&&n<o.length;){let d=Number(e.and((0,We.default)(255)));o[n]=d,n++,e=e.shiftRight(8)}if(!e.eq(We.default.zero))throw new Error(\"Number does not fit in this length\");return o}var En={},sg=typeof BigInt==\"function\";sg?Object.assign(En,Cc):Object.assign(En,Ec);var Ca=[];for(let i=0;i<256;i++)Ca[i]=cg(i,8);function cg(i,t){let e=0,n=i;for(let o=0;o<t;o++)e<<=1,e=e|n&1,n>>=1;return e}En.bitReverse=function(t,e){return(Ca[t>>>24]|Ca[t>>>16&255]<<8|Ca[t>>>8&255]<<16|Ca[t&255]<<24)>>>32-e};En.log2=function(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};En.buffReverseBits=function(t,e){let n=t.byteLength/e,o=En.log2(n);if(n!=1<<o)throw new Error(\"Invalid number of pointers\");for(let d=0;d<n;d++){let h=En.bitReverse(d,o);if(d>h){let f=t.slice(d*e,(d+1)*e);t.set(t.slice(h*e,(h+1)*e),d*e),t.set(f,h*e)}}};En.array2buffer=function(i,t){let e=new Uint8Array(t*i.length);for(let n=0;n<i.length;n++)e.set(i[n],n*t);return e};En.buffer2array=function(i,t){let e=i.byteLength/t,n=new Array(e);for(let o=0;o<e;o++)n[o]=i.slice(o*t,o*t+t);return n};var{bitReverse:rg,log2:Qe,buffReverseBits:Bc,stringifyBigInts:lg,unstringifyBigInts:dg,beBuff2int:ug,beInt2Buff:fg,leBuff2int:_g,leInt2Buff:vc,array2buffer:xa,buffer2array:Gi,stringifyFElements:hg,unstringifyFElements:gg}=En;var re=class i{constructor(t){this.buffers=[],this.byteLength=t;for(let e=0;e<t;e+=1073741824){let n=Math.min(t-e,1073741824);this.buffers.push(new Uint8Array(n))}}slice(t,e){e===void 0&&(e=this.byteLength),t===void 0&&(t=0);let n=e-t,o=Math.floor(t/1073741824),d=Math.floor((t+n-1)/1073741824);if(o==d||n==0)return this.buffers[o].slice(t%1073741824,t%1073741824+n);let h,f=o,L=t%1073741824,l=n;for(;l>0;){let s=L+l>1073741824?1073741824-L:l,x=new Uint8Array(this.buffers[f].buffer,this.buffers[f].byteOffset+L,s);if(s==n)return x.slice();h||(n<=1073741824?h=new Uint8Array(n):h=new i(n)),h.set(x,n-l),l=l-s,f++,L=0}return h}set(t,e){e===void 0&&(e=0);let n=t.byteLength;if(n==0)return;let o=Math.floor(e/1073741824),d=Math.floor((e+n-1)/1073741824);if(o==d)return t instanceof i&&t.buffers.length==1?this.buffers[o].set(t.buffers[0],e%1073741824):this.buffers[o].set(t,e%1073741824);let h=o,f=e%1073741824,L=n;for(;L>0;){let l=f+L>1073741824?1073741824-f:L,s=t.slice(n-L,n-L+l);new Uint8Array(this.buffers[h].buffer,this.buffers[h].byteOffset+f,l).set(s),L=L-l,h++,f=0}}};function Ln(i,t,e,n){return async function(d){let h=Math.floor(d.byteLength/e);if(h*e!==d.byteLength)throw new Error(\"Invalid buffer size\");let f=Math.floor(h/i.concurrency),L=[];for(let C=0;C<i.concurrency;C++){let g;if(C<i.concurrency-1?g=f:g=h-C*f,g==0)continue;let it=[{cmd:\"ALLOCSET\",var:0,buff:d.slice(C*f*e,C*f*e+g*e)},{cmd:\"ALLOC\",var:1,len:n*g},{cmd:\"CALL\",fnName:t,params:[{var:0},{val:g},{var:1}]},{cmd:\"GET\",out:0,var:1,len:n*g}];L.push(i.queueAction(it))}let l=await Promise.all(L),s;d instanceof re?s=new re(h*n):s=new Uint8Array(h*n);let x=0;for(let C=0;C<l.length;C++)s.set(l[C][0],x),x+=l[C][0].byteLength;return s}}var Ti=class{constructor(t,e,n,o){if(this.tm=t,this.prefix=e,this.p=o,this.n8=n,this.type=\"F1\",this.m=1,this.half=_a(o,Wn),this.bitLength=si(o),this.mask=gn(yo(Wn,this.bitLength),Wn),this.pOp1=t.alloc(n),this.pOp2=t.alloc(n),this.pOp3=t.alloc(n),this.tm.instance.exports[e+\"_zero\"](this.pOp1),this.zero=this.tm.getBuff(this.pOp1,this.n8),this.tm.instance.exports[e+\"_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(n/8),this.n32=Math.floor(n/4),this.n64*8!=this.n8)throw new Error(\"n8 must be a multiple of 8\");this.half=_a(this.p,Wn),this.nqr=this.two;let d=this.exp(this.nqr,this.half);for(;!this.eq(d,this.negone);)this.nqr=this.add(this.nqr,this.one),d=this.exp(this.nqr,this.half);this.shift=this.mul(this.nqr,this.nqr),this.shiftInv=this.inv(this.shift),this.s=0;let h=gn(this.p,Wn);for(;!ha(h);)this.s=this.s+1,h=_a(h,Wn);this.w=[],this.w[this.s]=this.exp(this.nqr,h);for(let f=this.s-1;f>=0;f--)this.w[f]=this.square(this.w[f+1]);if(!this.eq(this.w[0],this.one))throw new Error(\"Error calculating roots of unity\");this.batchToMontgomery=Ln(t,e+\"_batchToMontgomery\",this.n8,this.n8),this.batchFromMontgomery=Ln(t,e+\"_batchFromMontgomery\",this.n8,this.n8)}op2(t,e,n){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op2Bool(t,e,n){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,n),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2)}op1(t,e){return this.tm.setBuff(this.pOp1,e),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op1Bool(t,e){return this.tm.setBuff(this.pOp1,e),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3)}add(t,e){return this.op2(\"_add\",t,e)}eq(t,e){return this.op2Bool(\"_eq\",t,e)}isZero(t){return this.op1Bool(\"_isZero\",t)}sub(t,e){return this.op2(\"_sub\",t,e)}neg(t){return this.op1(\"_neg\",t)}inv(t){return this.op1(\"_inverse\",t)}toMontgomery(t){return this.op1(\"_toMontgomery\",t)}fromMontgomery(t){return this.op1(\"_fromMontgomery\",t)}mul(t,e){return this.op2(\"_mul\",t,e)}div(t,e){return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,e),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(t){return this.op1(\"_square\",t)}isSquare(t){return this.op1Bool(\"_isSquare\",t)}sqrt(t){return this.op1(\"_sqrt\",t)}exp(t,e){return e instanceof Uint8Array||(e=xn(me(e))),this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[this.prefix+\"_exp\"](this.pOp1,this.pOp2,e.byteLength,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}isNegative(t){return this.op1Bool(\"_isNegative\",t)}e(t,e){if(t instanceof Uint8Array)return t;let n=me(t,e);Ws(n)?(n=Js(n),pa(n,this.p)&&(n=cn(n,this.p)),n=gn(this.p,n)):pa(n,this.p)&&(n=cn(n,this.p));let o=vc(n,this.n8);return this.toMontgomery(o)}toString(t,e){let n=this.fromMontgomery(t),o=Vn(n,0);return bo(o,e)}fromRng(t){let e,n=new Uint8Array(this.n8);do{e=Vs;for(let o=0;o<this.n64;o++)e=ga(e,yo(t.nextU64(),64*o));e=nc(e,this.mask)}while(ec(e,this.p));return Ui(n,0,e,this.n8),n}random(){return this.fromRng(Pi())}toObject(t){let e=this.fromMontgomery(t);return Vn(e,0)}fromObject(t){let e=new Uint8Array(this.n8);return Ui(e,0,t,this.n8),this.toMontgomery(e)}toRprLE(t,e,n){t.set(this.fromMontgomery(n),e)}toRprBE(t,e,n){let o=this.fromMontgomery(n);for(let d=0;d<this.n8/2;d++){let h=o[d];o[d]=o[this.n8-1-d],o[this.n8-1-d]=h}t.set(o,e)}fromRprLE(t,e){e=e||0;let n=t.slice(e,e+this.n8);return this.toMontgomery(n)}async batchInverse(t){let e=!1,n=this.n8,o=this.n8;Array.isArray(t)?(t=xa(t,n),e=!0):t=t.slice(0,t.byteLength);let d=Math.floor(t.byteLength/n);if(d*n!==t.byteLength)throw new Error(\"Invalid buffer size\");let h=Math.floor(d/this.tm.concurrency),f=[];for(let x=0;x<this.tm.concurrency;x++){let C;if(x<this.tm.concurrency-1?C=h:C=d-x*h,C==0)continue;let $=[{cmd:\"ALLOCSET\",var:0,buff:t.slice(x*h*n,x*h*n+C*n)},{cmd:\"ALLOC\",var:1,len:o*C},{cmd:\"CALL\",fnName:this.prefix+\"_batchInverse\",params:[{var:0},{val:n},{val:C},{var:1},{val:o}]},{cmd:\"GET\",out:0,var:1,len:o*C}];f.push(this.tm.queueAction($))}let L=await Promise.all(f),l;t instanceof re?l=new re(d*o):l=new Uint8Array(d*o);let s=0;for(let x=0;x<L.length;x++)l.set(L[x][0],s),s+=L[x][0].byteLength;return e?Gi(l,o):l}};var ki=class{constructor(t,e,n){this.tm=t,this.prefix=e,this.F=n,this.type=\"F2\",this.m=n.m*2,this.n8=this.F.n8*2,this.n32=this.F.n32*2,this.n64=this.F.n64*2,this.pOp1=t.alloc(n.n8*2),this.pOp2=t.alloc(n.n8*2),this.pOp3=t.alloc(n.n8*2),this.tm.instance.exports[e+\"_zero\"](this.pOp1),this.zero=t.getBuff(this.pOp1,this.n8),this.tm.instance.exports[e+\"_one\"](this.pOp1),this.one=t.getBuff(this.pOp1,this.n8),this.negone=this.neg(this.one),this.two=this.add(this.one,this.one)}op2(t,e,n){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op2Bool(t,e,n){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,n),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2)}op1(t,e){return this.tm.setBuff(this.pOp1,e),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op1Bool(t,e){return this.tm.setBuff(this.pOp1,e),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3)}add(t,e){return this.op2(\"_add\",t,e)}eq(t,e){return this.op2Bool(\"_eq\",t,e)}isZero(t){return this.op1Bool(\"_isZero\",t)}sub(t,e){return this.op2(\"_sub\",t,e)}neg(t){return this.op1(\"_neg\",t)}inv(t){return this.op1(\"_inverse\",t)}isNegative(t){return this.op1Bool(\"_isNegative\",t)}toMontgomery(t){return this.op1(\"_toMontgomery\",t)}fromMontgomery(t){return this.op1(\"_fromMontgomery\",t)}mul(t,e){return this.op2(\"_mul\",t,e)}mul1(t,e){return this.op2(\"_mul1\",t,e)}div(t,e){return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,e),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(t){return this.op1(\"_square\",t)}isSquare(t){return this.op1Bool(\"_isSquare\",t)}sqrt(t){return this.op1(\"_sqrt\",t)}exp(t,e){return e instanceof Uint8Array||(e=xn(me(e))),this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[this.prefix+\"_exp\"](this.pOp1,this.pOp2,e.byteLength,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}e(t,e){if(t instanceof Uint8Array)return t;if(Array.isArray(t)&&t.length==2){let n=this.F.e(t[0],e),o=this.F.e(t[1],e),d=new Uint8Array(this.F.n8*2);return d.set(n),d.set(o,this.F.n8*2),d}else throw new Error(\"invalid F2\")}toString(t,e){let n=this.F.toString(t.slice(0,this.F.n8),e),o=this.F.toString(t.slice(this.F.n8),e);return`[${n}, ${o}]`}fromRng(t){let e=this.F.fromRng(t),n=this.F.fromRng(t),o=new Uint8Array(this.F.n8*2);return o.set(e),o.set(n,this.F.n8),o}random(){return this.fromRng(Pi())}toObject(t){let e=this.F.toObject(t.slice(0,this.F.n8)),n=this.F.toObject(t.slice(this.F.n8,this.F.n8*2));return[e,n]}fromObject(t){let e=new Uint8Array(this.F.n8*2),n=this.F.fromObject(t[0]),o=this.F.fromObject(t[1]);return e.set(n),e.set(o,this.F.n8),e}c1(t){return t.slice(0,this.F.n8)}c2(t){return t.slice(this.F.n8)}};var Ia=class{constructor(t,e,n){this.tm=t,this.prefix=e,this.F=n,this.type=\"F3\",this.m=n.m*3,this.n8=this.F.n8*3,this.n32=this.F.n32*3,this.n64=this.F.n64*3,this.pOp1=t.alloc(n.n8*3),this.pOp2=t.alloc(n.n8*3),this.pOp3=t.alloc(n.n8*3),this.tm.instance.exports[e+\"_zero\"](this.pOp1),this.zero=t.getBuff(this.pOp1,this.n8),this.tm.instance.exports[e+\"_one\"](this.pOp1),this.one=t.getBuff(this.pOp1,this.n8),this.negone=this.neg(this.one),this.two=this.add(this.one,this.one)}op2(t,e,n){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op2Bool(t,e,n){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,n),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2)}op1(t,e){return this.tm.setBuff(this.pOp1,e),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op1Bool(t,e){return this.tm.setBuff(this.pOp1,e),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3)}eq(t,e){return this.op2Bool(\"_eq\",t,e)}isZero(t){return this.op1Bool(\"_isZero\",t)}add(t,e){return this.op2(\"_add\",t,e)}sub(t,e){return this.op2(\"_sub\",t,e)}neg(t){return this.op1(\"_neg\",t)}inv(t){return this.op1(\"_inverse\",t)}isNegative(t){return this.op1Bool(\"_isNegative\",t)}toMontgomery(t){return this.op1(\"_toMontgomery\",t)}fromMontgomery(t){return this.op1(\"_fromMontgomery\",t)}mul(t,e){return this.op2(\"_mul\",t,e)}div(t,e){return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,e),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(t){return this.op1(\"_square\",t)}isSquare(t){return this.op1Bool(\"_isSquare\",t)}sqrt(t){return this.op1(\"_sqrt\",t)}exp(t,e){return e instanceof Uint8Array||(e=xn(me(e))),this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[this.prefix+\"_exp\"](this.pOp1,this.pOp2,e.byteLength,this.pOp3),this.getBuff(this.pOp3,this.n8)}e(t,e){if(t instanceof Uint8Array)return t;if(Array.isArray(t)&&t.length==3){let n=this.F.e(t[0],e),o=this.F.e(t[1],e),d=this.F.e(t[2],e),h=new Uint8Array(this.F.n8*3);return h.set(n),h.set(o,this.F.n8),h.set(d,this.F.n8*2),h}else throw new Error(\"invalid F3\")}toString(t,e){let n=this.F.toString(t.slice(0,this.F.n8),e),o=this.F.toString(t.slice(this.F.n8,this.F.n8*2),e),d=this.F.toString(t.slice(this.F.n8*2),e);return`[${n}, ${o}, ${d}]`}fromRng(t){let e=this.F.fromRng(t),n=this.F.fromRng(t),o=this.F.fromRng(t),d=new Uint8Array(this.F.n8*3);return d.set(e),d.set(n,this.F.n8),d.set(o,this.F.n8*2),d}random(){return this.fromRng(Pi())}toObject(t){let e=this.F.toObject(t.slice(0,this.F.n8)),n=this.F.toObject(t.slice(this.F.n8,this.F.n8*2)),o=this.F.toObject(t.slice(this.F.n8*2,this.F.n8*3));return[e,n,o]}fromObject(t){let e=new Uint8Array(this.F.n8*3),n=this.F.fromObject(t[0]),o=this.F.fromObject(t[1]),d=this.F.fromObject(t[2]);return e.set(n),e.set(o,this.F.n8),e.set(d,this.F.n8*2),e}c1(t){return t.slice(0,this.F.n8)}c2(t){return t.slice(this.F.n8,this.F.n8*2)}c3(t){return t.slice(this.F.n8*2)}};var Ni=class{constructor(t,e,n,o,d,h){this.tm=t,this.prefix=e,this.F=n,this.pOp1=t.alloc(n.n8*3),this.pOp2=t.alloc(n.n8*3),this.pOp3=t.alloc(n.n8*3),this.tm.instance.exports[e+\"_zero\"](this.pOp1),this.zero=this.tm.getBuff(this.pOp1,n.n8*3),this.tm.instance.exports[e+\"_zeroAffine\"](this.pOp1),this.zeroAffine=this.tm.getBuff(this.pOp1,n.n8*2),this.one=this.tm.getBuff(o,n.n8*3),this.g=this.one,this.oneAffine=this.tm.getBuff(o,n.n8*2),this.gAffine=this.oneAffine,this.b=this.tm.getBuff(d,n.n8),h&&(this.cofactor=xn(h)),this.negone=this.neg(this.one),this.two=this.add(this.one,this.one),this.batchLEMtoC=Ln(t,e+\"_batchLEMtoC\",n.n8*2,n.n8),this.batchLEMtoU=Ln(t,e+\"_batchLEMtoU\",n.n8*2,n.n8*2),this.batchCtoLEM=Ln(t,e+\"_batchCtoLEM\",n.n8,n.n8*2),this.batchUtoLEM=Ln(t,e+\"_batchUtoLEM\",n.n8*2,n.n8*2),this.batchToJacobian=Ln(t,e+\"_batchToJacobian\",n.n8*2,n.n8*3),this.batchToAffine=Ln(t,e+\"_batchToAffine\",n.n8*3,n.n8*2)}op2(t,e,n){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.F.n8*3)}op2bool(t,e,n){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,n),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2,this.pOp3)}op1(t,e){return this.tm.setBuff(this.pOp1,e),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.F.n8*3)}op1Affine(t,e){return this.tm.setBuff(this.pOp1,e),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.F.n8*2)}op1Bool(t,e){return this.tm.setBuff(this.pOp1,e),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3)}add(t,e){if(t.byteLength==this.F.n8*3){if(e.byteLength==this.F.n8*3)return this.op2(\"_add\",t,e);if(e.byteLength==this.F.n8*2)return this.op2(\"_addMixed\",t,e);throw new Error(\"invalid point size\")}else if(t.byteLength==this.F.n8*2){if(e.byteLength==this.F.n8*3)return this.op2(\"_addMixed\",e,t);if(e.byteLength==this.F.n8*2)return this.op2(\"_addAffine\",t,e);throw new Error(\"invalid point size\")}else throw new Error(\"invalid point size\")}sub(t,e){if(t.byteLength==this.F.n8*3){if(e.byteLength==this.F.n8*3)return this.op2(\"_sub\",t,e);if(e.byteLength==this.F.n8*2)return this.op2(\"_subMixed\",t,e);throw new Error(\"invalid point size\")}else if(t.byteLength==this.F.n8*2){if(e.byteLength==this.F.n8*3)return this.op2(\"_subMixed\",e,t);if(e.byteLength==this.F.n8*2)return this.op2(\"_subAffine\",t,e);throw new Error(\"invalid point size\")}else throw new Error(\"invalid point size\")}neg(t){if(t.byteLength==this.F.n8*3)return this.op1(\"_neg\",t);if(t.byteLength==this.F.n8*2)return this.op1Affine(\"_negAffine\",t);throw new Error(\"invalid point size\")}double(t){if(t.byteLength==this.F.n8*3)return this.op1(\"_double\",t);if(t.byteLength==this.F.n8*2)return this.op1(\"_doubleAffine\",t);throw new Error(\"invalid point size\")}isZero(t){if(t.byteLength==this.F.n8*3)return this.op1Bool(\"_isZero\",t);if(t.byteLength==this.F.n8*2)return this.op1Bool(\"_isZeroAffine\",t);throw new Error(\"invalid point size\")}timesScalar(t,e){e instanceof Uint8Array||(e=xn(me(e)));let n;if(t.byteLength==this.F.n8*3)n=this.prefix+\"_timesScalar\";else if(t.byteLength==this.F.n8*2)n=this.prefix+\"_timesScalarAffine\";else throw new Error(\"invalid point size\");return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[n](this.pOp1,this.pOp2,e.byteLength,this.pOp3),this.tm.getBuff(this.pOp3,this.F.n8*3)}timesFr(t,e){let n;if(t.byteLength==this.F.n8*3)n=this.prefix+\"_timesFr\";else if(t.byteLength==this.F.n8*2)n=this.prefix+\"_timesFrAffine\";else throw new Error(\"invalid point size\");return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[n](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.F.n8*3)}eq(t,e){if(t.byteLength==this.F.n8*3){if(e.byteLength==this.F.n8*3)return this.op2bool(\"_eq\",t,e);if(e.byteLength==this.F.n8*2)return this.op2bool(\"_eqMixed\",t,e);throw new Error(\"invalid point size\")}else if(t.byteLength==this.F.n8*2){if(e.byteLength==this.F.n8*3)return this.op2bool(\"_eqMixed\",e,t);if(e.byteLength==this.F.n8*2)return this.op2bool(\"_eqAffine\",t,e);throw new Error(\"invalid point size\")}else throw new Error(\"invalid point size\")}toAffine(t){if(t.byteLength==this.F.n8*3)return this.op1Affine(\"_toAffine\",t);if(t.byteLength==this.F.n8*2)return t;throw new Error(\"invalid point size\")}toJacobian(t){if(t.byteLength==this.F.n8*3)return t;if(t.byteLength==this.F.n8*2)return this.op1(\"_toJacobian\",t);throw new Error(\"invalid point size\")}toRprUncompressed(t,e,n){if(this.tm.setBuff(this.pOp1,n),n.byteLength==this.F.n8*3)this.tm.instance.exports[this.prefix+\"_toAffine\"](this.pOp1,this.pOp1);else if(n.byteLength!=this.F.n8*2)throw new Error(\"invalid point size\");this.tm.instance.exports[this.prefix+\"_LEMtoU\"](this.pOp1,this.pOp1);let o=this.tm.getBuff(this.pOp1,this.F.n8*2);t.set(o,e)}fromRprUncompressed(t,e){let n=t.slice(e,e+this.F.n8*2);return this.tm.setBuff(this.pOp1,n),this.tm.instance.exports[this.prefix+\"_UtoLEM\"](this.pOp1,this.pOp1),this.tm.getBuff(this.pOp1,this.F.n8*2)}toRprCompressed(t,e,n){if(this.tm.setBuff(this.pOp1,n),n.byteLength==this.F.n8*3)this.tm.instance.exports[this.prefix+\"_toAffine\"](this.pOp1,this.pOp1);else if(n.byteLength!=this.F.n8*2)throw new Error(\"invalid point size\");this.tm.instance.exports[this.prefix+\"_LEMtoC\"](this.pOp1,this.pOp1);let o=this.tm.getBuff(this.pOp1,this.F.n8);t.set(o,e)}fromRprCompressed(t,e){let n=t.slice(e,e+this.F.n8);return this.tm.setBuff(this.pOp1,n),this.tm.instance.exports[this.prefix+\"_CtoLEM\"](this.pOp1,this.pOp2),this.tm.getBuff(this.pOp2,this.F.n8*2)}toUncompressed(t){let e=new Uint8Array(this.F.n8*2);return this.toRprUncompressed(e,0,t),e}toRprLEM(t,e,n){if(n.byteLength==this.F.n8*2){t.set(n,e);return}else if(n.byteLength==this.F.n8*3){this.tm.setBuff(this.pOp1,n),this.tm.instance.exports[this.prefix+\"_toAffine\"](this.pOp1,this.pOp1);let o=this.tm.getBuff(this.pOp1,this.F.n8*2);t.set(o,e)}else throw new Error(\"invalid point size\")}fromRprLEM(t,e){return e=e||0,t.slice(e,e+this.F.n8*2)}toString(t,e){if(t.byteLength==this.F.n8*3){let n=this.F.toString(t.slice(0,this.F.n8),e),o=this.F.toString(t.slice(this.F.n8,this.F.n8*2),e),d=this.F.toString(t.slice(this.F.n8*2),e);return`[ ${n}, ${o}, ${d} ]`}else if(t.byteLength==this.F.n8*2){let n=this.F.toString(t.slice(0,this.F.n8),e),o=this.F.toString(t.slice(this.F.n8),e);return`[ ${n}, ${o} ]`}else throw new Error(\"invalid point size\")}isValid(t){if(this.isZero(t))return!0;let e=this.F,n=this.toAffine(t),o=n.slice(0,this.F.n8),d=n.slice(this.F.n8,this.F.n8*2),h=e.add(e.mul(e.square(o),o),this.b),f=e.square(d);return e.eq(h,f)}fromRng(t){let e=this.F,n=[],o,d;do n[0]=e.fromRng(t),o=t.nextBool(),d=e.add(e.mul(e.square(n[0]),n[0]),this.b);while(!e.isSquare(d));n[1]=e.sqrt(d);let h=e.isNegative(n[1]);o^h&&(n[1]=e.neg(n[1]));let f=new Uint8Array(this.F.n8*2);return f.set(n[0]),f.set(n[1],this.F.n8),this.cofactor&&(f=this.timesScalar(f,this.cofactor)),f}toObject(t){if(this.isZero(t))return[this.F.toObject(this.F.zero),this.F.toObject(this.F.one),this.F.toObject(this.F.zero)];let e=this.F.toObject(t.slice(0,this.F.n8)),n=this.F.toObject(t.slice(this.F.n8,this.F.n8*2)),o;return t.byteLength==this.F.n8*3?o=this.F.toObject(t.slice(this.F.n8*2,this.F.n8*3)):o=this.F.toObject(this.F.one),[e,n,o]}fromObject(t){let e=this.F.fromObject(t[0]),n=this.F.fromObject(t[1]),o;if(t.length==3?o=this.F.fromObject(t[2]):o=this.F.one,this.F.isZero(o,this.F.one))return this.zeroAffine;if(this.F.eq(o,this.F.one)){let d=new Uint8Array(this.F.n8*2);return d.set(e),d.set(n,this.F.n8),d}else{let d=new Uint8Array(this.F.n8*3);return d.set(e),d.set(n,this.F.n8),d.set(o,this.F.n8*2),d}}e(t){return t instanceof Uint8Array?t:this.fromObject(t)}x(t){return this.toAffine(t).slice(0,this.F.n8)}y(t){return this.toAffine(t).slice(this.F.n8)}};function vo(i){let e,n;i&&(i.onmessage=function(s){let x;if(s.data?x=s.data:x=s,x[0].cmd==\"INIT\")o(x[0]).then(function(){i.postMessage(x.result)});else if(x[0].cmd==\"TERMINATE\")i.close();else{let C=l(x);i.postMessage(C)}});async function o(s){let x=new Uint8Array(s.code),C=await WebAssembly.compile(x);n=new WebAssembly.Memory({initial:s.init,maximum:32767}),e=await WebAssembly.instantiate(C,{env:{memory:n}})}function d(s){let x=new Uint32Array(n.buffer,0,1);for(;x[0]&3;)x[0]++;let C=x[0];if(x[0]+=s,x[0]+s>n.buffer.byteLength){let g=n.buffer.byteLength/65536,$=Math.floor((x[0]+s)/65536)+1;$>32767&&($=32767),n.grow($-g)}return C}function h(s){let x=d(s.byteLength);return L(x,s),x}function f(s,x){let C=new Uint8Array(n.buffer);return new Uint8Array(C.buffer,C.byteOffset+s,x)}function L(s,x){new Uint8Array(n.buffer).set(new Uint8Array(x),s)}function l(s){if(s[0].cmd==\"INIT\")return o(s[0]);let x={vars:[],out:[]},g=new Uint32Array(n.buffer,0,1)[0];for(let it=0;it<s.length;it++)switch(s[it].cmd){case\"ALLOCSET\":x.vars[s[it].var]=h(s[it].buff);break;case\"ALLOC\":x.vars[s[it].var]=d(s[it].len);break;case\"SET\":L(x.vars[s[it].var],s[it].buff);break;case\"CALL\":{let q=[];for(let S=0;S<s[it].params.length;S++){let O=s[it].params[S];typeof O.var<\"u\"?q.push(x.vars[O.var]+(O.offset||0)):typeof O.val<\"u\"&&q.push(O.val)}e.exports[s[it].fnName](...q);break}case\"GET\":x.out[s[it].out]=f(x.vars[s[it].var],s[it].len).slice();break;default:throw new Error(\"Invalid cmd\")}let $=new Uint32Array(n.buffer,0,1);return $[0]=g,x.out}return l}var ou=fe(Gs(),1);import pg from\"os\";var Sc=25,So=class{constructor(){this.promise=new Promise((t,e)=>{this.reject=e,this.resolve=t})}};function Lg(i){return new Promise(t=>setTimeout(t,i))}function mg(i){return process.browser?globalThis.btoa(i):Buffer.from(i).toString(\"base64\")}var bg=mg(\"(\"+vo.toString()+\")(self)\"),yg=\"data:application/javascript;base64,\"+bg;async function Uc(i,t){let e=new qc;e.memory=new WebAssembly.Memory({initial:Sc}),e.u8=new Uint8Array(e.memory.buffer),e.u32=new Uint32Array(e.memory.buffer);let n=await WebAssembly.compile(i.code);if(e.instance=await WebAssembly.instantiate(n,{env:{memory:e.memory}}),e.singleThread=t,e.initalPFree=e.u32[0],e.pq=i.pq,e.pr=i.pr,e.pG1gen=i.pG1gen,e.pG1zero=i.pG1zero,e.pG2gen=i.pG2gen,e.pG2zero=i.pG2zero,e.pOneT=i.pOneT,t)e.code=i.code,e.taskManager=vo(),await e.taskManager([{cmd:\"INIT\",init:Sc,code:e.code.slice()}]),e.concurrency=1;else{e.workers=[],e.pendingDeferreds=[],e.working=[];let d;typeof navigator==\"object\"&&navigator.hardwareConcurrency?d=navigator.hardwareConcurrency:d=pg.cpus().length,d==0&&(d=2),d>64&&(d=64),e.concurrency=d;for(let f=0;f<d;f++)e.workers[f]=new ou.default(yg),e.workers[f].addEventListener(\"message\",o(f)),e.working[f]=!1;let h=[];for(let f=0;f<e.workers.length;f++){let L=i.code.slice();h.push(e.postAction(f,[{cmd:\"INIT\",init:Sc,code:L}],[L.buffer]))}await Promise.all(h)}return e;function o(d){return function(h){let f;h&&h.data?f=h.data:f=h,e.working[d]=!1,e.pendingDeferreds[d].resolve(f),e.processWorks()}}}var qc=class{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(t,e,n,o){if(this.working[t])throw new Error(\"Posting a job t a working worker\");return this.working[t]=!0,this.pendingDeferreds[t]=o||new So,this.workers[t].postMessage(e,n),this.pendingDeferreds[t].promise}processWorks(){for(let t=0;t<this.workers.length&&this.actionQueue.length>0;t++)if(this.working[t]==!1){let e=this.actionQueue.shift();this.postAction(t,e.data,e.transfers,e.deferred)}}queueAction(t,e){let n=new So;if(this.singleThread){let o=this.taskManager(t);n.resolve(o)}else this.actionQueue.push({data:t,transfers:e,deferred:n}),this.processWorks();return n.promise}resetMemory(){this.u32[0]=this.initalPFree}allocBuff(t){let e=this.alloc(t.byteLength);return this.setBuff(e,t),e}getBuff(t,e){return this.u8.slice(t,t+e)}setBuff(t,e){this.u8.set(new Uint8Array(e),t)}alloc(t){for(;this.u32[0]&3;)this.u32[0]++;let e=this.u32[0];return this.u32[0]+=t,e}async terminate(){for(let t=0;t<this.workers.length;t++)this.workers[t].postMessage([{cmd:\"TERMINATE\"}]);await Lg(200)}};function Ea(i,t){let e=i[t],n=i.Fr,o=i.tm;i[t].batchApplyKey=async function(d,h,f,L,l){L=L||\"affine\",l=l||\"affine\";let s,x,C,g,$;if(t==\"G1\")L==\"jacobian\"?(C=e.F.n8*3,s=\"g1m_batchApplyKey\"):(C=e.F.n8*2,s=\"g1m_batchApplyKeyMixed\"),g=e.F.n8*3,l==\"jacobian\"?$=e.F.n8*3:(x=\"g1m_batchToAffine\",$=e.F.n8*2);else if(t==\"G2\")L==\"jacobian\"?(C=e.F.n8*3,s=\"g2m_batchApplyKey\"):(C=e.F.n8*2,s=\"g2m_batchApplyKeyMixed\"),g=e.F.n8*3,l==\"jacobian\"?$=e.F.n8*3:(x=\"g2m_batchToAffine\",$=e.F.n8*2);else if(t==\"Fr\")s=\"frm_batchApplyKey\",C=e.n8,g=e.n8,$=e.n8;else throw new Error(\"Invalid group: \"+t);let it=Math.floor(d.byteLength/C),q=Math.floor(it/o.concurrency),S=[];f=n.e(f);let O=n.e(h);for(let E=0;E<o.concurrency;E++){let _;if(E<o.concurrency-1?_=q:_=it-E*q,_==0)continue;let r=[];r.push({cmd:\"ALLOCSET\",var:0,buff:d.slice(E*q*C,E*q*C+_*C)}),r.push({cmd:\"ALLOCSET\",var:1,buff:O}),r.push({cmd:\"ALLOCSET\",var:2,buff:f}),r.push({cmd:\"ALLOC\",var:3,len:_*Math.max(g,$)}),r.push({cmd:\"CALL\",fnName:s,params:[{var:0},{val:_},{var:1},{var:2},{var:3}]}),x&&r.push({cmd:\"CALL\",fnName:x,params:[{var:3},{val:_},{var:3}]}),r.push({cmd:\"GET\",out:0,var:3,len:_*$}),S.push(o.queueAction(r)),O=n.mul(O,n.exp(f,_))}let M=await Promise.all(S),W;d instanceof re?W=new re(it*$):W=new Uint8Array(it*$);let ct=0;for(let E=0;E<M.length;E++)W.set(M[E][0],ct),ct+=M[E][0].byteLength;return W}}function Rc(i){let t=i.tm;i.pairing=function(n,o){t.startSyncOp();let d=t.allocBuff(i.G1.toJacobian(n)),h=t.allocBuff(i.G2.toJacobian(o)),f=t.alloc(i.Gt.n8);t.instance.exports[i.name+\"_pairing\"](d,h,f);let L=t.getBuff(f,i.Gt.n8);return t.endSyncOp(),L},i.pairingEq=async function(){let n,o;arguments.length%2==1?(n=arguments[arguments.length-1],o=(arguments.length-1)/2):(n=i.Gt.one,o=arguments.length/2);let d=[];for(let s=0;s<o;s++){let x=[],C=i.G1.toJacobian(arguments[s*2]);x.push({cmd:\"ALLOCSET\",var:0,buff:C}),x.push({cmd:\"ALLOC\",var:1,len:i.prePSize});let g=i.G2.toJacobian(arguments[s*2+1]);x.push({cmd:\"ALLOCSET\",var:2,buff:g}),x.push({cmd:\"ALLOC\",var:3,len:i.preQSize}),x.push({cmd:\"ALLOC\",var:4,len:i.Gt.n8}),x.push({cmd:\"CALL\",fnName:i.name+\"_prepareG1\",params:[{var:0},{var:1}]}),x.push({cmd:\"CALL\",fnName:i.name+\"_prepareG2\",params:[{var:2},{var:3}]}),x.push({cmd:\"CALL\",fnName:i.name+\"_millerLoop\",params:[{var:1},{var:3},{var:4}]}),x.push({cmd:\"GET\",out:0,var:4,len:i.Gt.n8}),d.push(t.queueAction(x))}let h=await Promise.all(d);t.startSyncOp();let f=t.alloc(i.Gt.n8);t.instance.exports.ftm_one(f);for(let s=0;s<h.length;s++){let x=t.allocBuff(h[s][0]);t.instance.exports.ftm_mul(f,x,f)}t.instance.exports[i.name+\"_finalExponentiation\"](f,f);let L=t.allocBuff(n),l=!!t.instance.exports.ftm_eq(f,L);return t.endSyncOp(),l},i.prepareG1=function(e){this.tm.startSyncOp();let n=this.tm.allocBuff(e),o=this.tm.alloc(this.prePSize);this.tm.instance.exports[this.name+\"_prepareG1\"](n,o);let d=this.tm.getBuff(o,this.prePSize);return this.tm.endSyncOp(),d},i.prepareG2=function(e){this.tm.startSyncOp();let n=this.tm.allocBuff(e),o=this.tm.alloc(this.preQSize);this.tm.instance.exports[this.name+\"_prepareG2\"](n,o);let d=this.tm.getBuff(o,this.preQSize);return this.tm.endSyncOp(),d},i.millerLoop=function(e,n){this.tm.startSyncOp();let o=this.tm.allocBuff(e),d=this.tm.allocBuff(n),h=this.tm.alloc(this.Gt.n8);this.tm.instance.exports[this.name+\"_millerLoop\"](o,d,h);let f=this.tm.getBuff(h,this.Gt.n8);return this.tm.endSyncOp(),f},i.finalExponentiation=function(e){this.tm.startSyncOp();let n=this.tm.allocBuff(e),o=this.tm.alloc(this.Gt.n8);this.tm.instance.exports[this.name+\"_finalExponentiation\"](n,o);let d=this.tm.getBuff(o,this.Gt.n8);return this.tm.endSyncOp(),d}}var su=[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 qo(i,t){let e=i[t],n=e.tm;async function o(h,f,L,l,s){if(!(h instanceof Uint8Array))throw l&&l.error(`${s} _multiExpChunk buffBases is not Uint8Array`),new Error(`${s} _multiExpChunk buffBases is not Uint8Array`);if(!(f instanceof Uint8Array))throw l&&l.error(`${s} _multiExpChunk buffScalars is not Uint8Array`),new Error(`${s} _multiExpChunk buffScalars is not Uint8Array`);L=L||\"affine\";let x,C;if(t==\"G1\")L==\"affine\"?(C=\"g1m_multiexpAffine_chunk\",x=e.F.n8*2):(C=\"g1m_multiexp_chunk\",x=e.F.n8*3);else if(t==\"G2\")L==\"affine\"?(C=\"g2m_multiexpAffine_chunk\",x=e.F.n8*2):(C=\"g2m_multiexp_chunk\",x=e.F.n8*3);else throw new Error(\"Invalid group\");let g=Math.floor(h.byteLength/x);if(g==0)return e.zero;let $=Math.floor(f.byteLength/g);if($*g!=f.byteLength)throw new Error(\"Scalar size does not match\");let it=su[Qe(g)],q=Math.floor(($*8-1)/it)+1,S=[];for(let W=0;W<q;W++){let ct=[{cmd:\"ALLOCSET\",var:0,buff:h},{cmd:\"ALLOCSET\",var:1,buff:f},{cmd:\"ALLOC\",var:2,len:e.F.n8*3},{cmd:\"CALL\",fnName:C,params:[{var:0},{var:1},{val:$},{val:g},{val:W*it},{val:Math.min($*8-W*it,it)},{var:2}]},{cmd:\"GET\",out:0,var:2,len:e.F.n8*3}];S.push(e.tm.queueAction(ct))}let O=await Promise.all(S),M=e.zero;for(let W=O.length-1;W>=0;W--){if(!e.isZero(M))for(let ct=0;ct<it;ct++)M=e.double(M);M=e.add(M,O[W][0])}return M}async function d(h,f,L,l,s){let g;if(t==\"G1\")L==\"affine\"?g=e.F.n8*2:g=e.F.n8*3;else if(t==\"G2\")L==\"affine\"?g=e.F.n8*2:g=e.F.n8*3;else throw new Error(\"Invalid group\");let $=Math.floor(h.byteLength/g),it=Math.floor(f.byteLength/$);if(it*$!=f.byteLength)throw new Error(\"Scalar size does not match\");let q=su[Qe($)],S=Math.floor((it*8-1)/q)+1,O;O=Math.floor($/(n.concurrency/S)),O>4194304&&(O=4194304),O<1024&&(O=1024);let M=[];for(let E=0;E<$;E+=O){l&&l.debug(`Multiexp start: ${s}: ${E}/${$}`);let _=Math.min($-E,O),r=h.slice(E*g,(E+_)*g),Z=f.slice(E*it,(E+_)*it);M.push(o(r,Z,L,l,s).then(j=>(l&&l.debug(`Multiexp end: ${s}: ${E}/${$}`),j)))}let W=await Promise.all(M),ct=e.zero;for(let E=W.length-1;E>=0;E--)ct=e.add(ct,W[E]);return ct}e.multiExp=async function(f,L,l,s){return await d(f,L,\"jacobian\",l,s)},e.multiExpAffine=async function(f,L,l,s){return await d(f,L,\"affine\",l,s)}}function Ba(i,t){let e=i[t],n=i.Fr,o=e.tm;async function d(l,s,x,C,g,$){x=x||\"affine\",C=C||\"affine\";let it=14,q,S,O,M,W,ct,E,_;t==\"G1\"?(x==\"affine\"?(q=e.F.n8*2,M=\"g1m_batchToJacobian\"):q=e.F.n8*3,S=e.F.n8*3,s&&(_=\"g1m_fftFinal\"),E=\"g1m_fftJoin\",ct=\"g1m_fftMix\",C==\"affine\"?(O=e.F.n8*2,W=\"g1m_batchToAffine\"):O=e.F.n8*3):t==\"G2\"?(x==\"affine\"?(q=e.F.n8*2,M=\"g2m_batchToJacobian\"):q=e.F.n8*3,S=e.F.n8*3,s&&(_=\"g2m_fftFinal\"),E=\"g2m_fftJoin\",ct=\"g2m_fftMix\",C==\"affine\"?(O=e.F.n8*2,W=\"g2m_batchToAffine\"):O=e.F.n8*3):t==\"Fr\"&&(q=e.n8,S=e.n8,O=e.n8,s&&(_=\"frm_fftFinal\"),ct=\"frm_fftMix\",E=\"frm_fftJoin\");let r=!1;Array.isArray(l)?(l=xa(l,q),r=!0):l=l.slice(0,l.byteLength);let Z=l.byteLength/q,j=Qe(Z);if(1<<j!=Z)throw new Error(\"fft must be multiple of 2\");if(j==n.s+1){let ot;return s?ot=await f(l,x,C,g,$):ot=await h(l,x,C,g,$),r?Gi(ot,O):ot}let nt;s&&(nt=n.inv(n.e(Z)));let v;Bc(l,q);let y,T=Math.min(1<<it,Z),V=Z/T;for(;V<o.concurrency&&T>=16;)V*=2,T/=2;let rt=Qe(T),dt=[];for(let ot=0;ot<V;ot++){g&&g.debug(`${$}: fft ${j} mix start: ${ot}/${V}`);let xt=[];xt.push({cmd:\"ALLOC\",var:0,len:S*T});let pt=l.slice(T*ot*q,T*(ot+1)*q);xt.push({cmd:\"SET\",var:0,buff:pt}),M&&xt.push({cmd:\"CALL\",fnName:M,params:[{var:0},{val:T},{var:0}]});for(let bt=1;bt<=rt;bt++)xt.push({cmd:\"CALL\",fnName:ct,params:[{var:0},{val:T},{val:bt}]});rt==j?(_&&(xt.push({cmd:\"ALLOCSET\",var:1,buff:nt}),xt.push({cmd:\"CALL\",fnName:_,params:[{var:0},{val:T},{var:1}]})),W&&xt.push({cmd:\"CALL\",fnName:W,params:[{var:0},{val:T},{var:0}]}),xt.push({cmd:\"GET\",out:0,var:0,len:T*O})):xt.push({cmd:\"GET\",out:0,var:0,len:S*T}),dt.push(o.queueAction(xt).then(bt=>(g&&g.debug(`${$}: fft ${j} mix end: ${ot}/${V}`),bt)))}y=await Promise.all(dt);for(let ot=0;ot<V;ot++)y[ot]=y[ot][0];for(let ot=rt+1;ot<=j;ot++){g&&g.debug(`${$}: fft ${j} join: ${ot}/${j}`);let xt=1<<j-ot,pt=V/xt,bt=[];for(let Pt=0;Pt<xt;Pt++)for(let Ht=0;Ht<pt/2;Ht++){let m=n.exp(n.w[ot],Ht*T),a=n.w[ot],w=Pt*pt+Ht,c=Pt*pt+Ht+pt/2,G=[];G.push({cmd:\"ALLOCSET\",var:0,buff:y[w]}),G.push({cmd:\"ALLOCSET\",var:1,buff:y[c]}),G.push({cmd:\"ALLOCSET\",var:2,buff:m}),G.push({cmd:\"ALLOCSET\",var:3,buff:a}),G.push({cmd:\"CALL\",fnName:E,params:[{var:0},{var:1},{val:T},{var:2},{var:3}]}),ot==j?(_&&(G.push({cmd:\"ALLOCSET\",var:4,buff:nt}),G.push({cmd:\"CALL\",fnName:_,params:[{var:0},{val:T},{var:4}]}),G.push({cmd:\"CALL\",fnName:_,params:[{var:1},{val:T},{var:4}]})),W&&(G.push({cmd:\"CALL\",fnName:W,params:[{var:0},{val:T},{var:0}]}),G.push({cmd:\"CALL\",fnName:W,params:[{var:1},{val:T},{var:1}]})),G.push({cmd:\"GET\",out:0,var:0,len:T*O}),G.push({cmd:\"GET\",out:1,var:1,len:T*O})):(G.push({cmd:\"GET\",out:0,var:0,len:T*S}),G.push({cmd:\"GET\",out:1,var:1,len:T*S})),bt.push(o.queueAction(G).then(R=>(g&&g.debug(`${$}: fft ${j} join ${ot}/${j} ${Pt+1}/${xt} ${Ht}/${pt/2}`),R)))}let vt=await Promise.all(bt);for(let Pt=0;Pt<xt;Pt++)for(let Ht=0;Ht<pt/2;Ht++){let m=Pt*pt+Ht,a=Pt*pt+Ht+pt/2,w=vt.shift();y[m]=w[0],y[a]=w[1]}}if(l instanceof re?v=new re(Z*O):v=new Uint8Array(Z*O),s){v.set(y[0].slice((T-1)*O));let ot=O;for(let xt=V-1;xt>0;xt--)v.set(y[xt],ot),ot+=T*O,delete y[xt];v.set(y[0].slice(0,(T-1)*O),ot),delete y[0]}else for(let ot=0;ot<V;ot++)v.set(y[ot],T*O*ot),delete y[ot];return r?Gi(v,O):v}async function h(l,s,x,C,g){let $,it;$=l.slice(0,l.byteLength/2),it=l.slice(l.byteLength/2,l.byteLength);let q=[];[$,it]=await L($,it,\"fftJoinExt\",n.one,n.shift,s,\"jacobian\",C,g),q.push(d($,!1,\"jacobian\",x,C,g)),q.push(d(it,!1,\"jacobian\",x,C,g));let S=await Promise.all(q),O;return S[0].byteLength>1<<28?O=new re(S[0].byteLength*2):O=new Uint8Array(S[0].byteLength*2),O.set(S[0]),O.set(S[1],S[0].byteLength),O}async function f(l,s,x,C,g){let $,it;$=l.slice(0,l.byteLength/2),it=l.slice(l.byteLength/2,l.byteLength);let q=[];q.push(d($,!0,s,\"jacobian\",C,g)),q.push(d(it,!0,s,\"jacobian\",C,g)),[$,it]=await Promise.all(q);let S=await L($,it,\"fftJoinExtInv\",n.one,n.shiftInv,\"jacobian\",x,C,g),O;return S[0].byteLength>1<<28?O=new re(S[0].byteLength*2):O=new Uint8Array(S[0].byteLength*2),O.set(S[0]),O.set(S[1],S[0].byteLength),O}async function L(l,s,x,C,g,$,it,q,S){let W,ct,E,_,r,Z;if(t==\"G1\")$==\"affine\"?(r=e.F.n8*2,ct=\"g1m_batchToJacobian\"):r=e.F.n8*3,Z=e.F.n8*3,W=\"g1m_\"+x,it==\"affine\"?(E=\"g1m_batchToAffine\",_=e.F.n8*2):_=e.F.n8*3;else if(t==\"G2\")$==\"affine\"?(r=e.F.n8*2,ct=\"g2m_batchToJacobian\"):r=e.F.n8*3,W=\"g2m_\"+x,Z=e.F.n8*3,it==\"affine\"?(E=\"g2m_batchToAffine\",_=e.F.n8*2):_=e.F.n8*3;else if(t==\"Fr\")r=n.n8,_=n.n8,Z=n.n8,W=\"frm_\"+x;else throw new Error(\"Invalid group\");if(l.byteLength!=s.byteLength)throw new Error(\"Invalid buffer size\");let j=Math.floor(l.byteLength/r);if(j!=1<<Qe(j))throw new Error(\"Invalid number of points\");let nt=Math.floor(j/o.concurrency);nt<16&&(nt=16),nt>65536&&(nt=65536);let v=[];for(let dt=0;dt<j;dt+=nt){q&&q.debug(`${S}: fftJoinExt Start: ${dt}/${j}`);let ot=Math.min(j-dt,nt),xt=n.mul(C,n.exp(g,dt)),pt=[],bt=l.slice(dt*r,(dt+ot)*r),vt=s.slice(dt*r,(dt+ot)*r);pt.push({cmd:\"ALLOC\",var:0,len:Z*ot}),pt.push({cmd:\"SET\",var:0,buff:bt}),pt.push({cmd:\"ALLOC\",var:1,len:Z*ot}),pt.push({cmd:\"SET\",var:1,buff:vt}),pt.push({cmd:\"ALLOCSET\",var:2,buff:xt}),pt.push({cmd:\"ALLOCSET\",var:3,buff:g}),ct&&(pt.push({cmd:\"CALL\",fnName:ct,params:[{var:0},{val:ot},{var:0}]}),pt.push({cmd:\"CALL\",fnName:ct,params:[{var:1},{val:ot},{var:1}]})),pt.push({cmd:\"CALL\",fnName:W,params:[{var:0},{var:1},{val:ot},{var:2},{var:3},{val:n.s}]}),E&&(pt.push({cmd:\"CALL\",fnName:E,params:[{var:0},{val:ot},{var:0}]}),pt.push({cmd:\"CALL\",fnName:E,params:[{var:1},{val:ot},{var:1}]})),pt.push({cmd:\"GET\",out:0,var:0,len:ot*_}),pt.push({cmd:\"GET\",out:1,var:1,len:ot*_}),v.push(o.queueAction(pt).then(Pt=>(q&&q.debug(`${S}: fftJoinExt End: ${dt}/${j}`),Pt)))}let y=await Promise.all(v),T,V;j*_>1<<28?(T=new re(j*_),V=new re(j*_)):(T=new Uint8Array(j*_),V=new Uint8Array(j*_));let rt=0;for(let dt=0;dt<y.length;dt++)T.set(y[dt][0],rt),V.set(y[dt][1],rt),rt+=y[dt][0].byteLength;return[T,V]}e.fft=async function(l,s,x,C,g){return await d(l,!1,s,x,C,g)},e.ifft=async function(l,s,x,C,g){return await d(l,!0,s,x,C,g)},e.lagrangeEvaluations=async function(l,s,x,C,g){s=s||\"affine\",x=x||\"affine\";let $;if(t==\"G1\")s==\"affine\"?$=e.F.n8*2:$=e.F.n8*3;else if(t==\"G2\")s==\"affine\"?$=e.F.n8*2:$=e.F.n8*3;else if(t==\"Fr\")$=n.n8;else throw new Error(\"Invalid group\");let it=l.byteLength/$,q=Qe(it);if(2**q*$!=l.byteLength)throw C&&C.error(\"lagrangeEvaluations iinvalid input size\"),new Error(\"lagrangeEvaluations invalid Input size\");if(q<=n.s)return await e.ifft(l,s,x,C,g);if(q>n.s+1)throw C&&C.error(\"lagrangeEvaluations input too big\"),new Error(\"lagrangeEvaluations input too big\");let S=l.slice(0,l.byteLength/2),O=l.slice(l.byteLength/2,l.byteLength),M=n.exp(n.shift,it/2),W=n.inv(n.sub(n.one,M));[S,O]=await L(S,O,\"prepareLagrangeEvaluation\",W,n.shiftInv,s,\"jacobian\",C,g+\" prep\");let ct=[];ct.push(d(S,!0,\"jacobian\",x,C,g+\" t0\")),ct.push(d(O,!0,\"jacobian\",x,C,g+\" t1\")),[S,O]=await Promise.all(ct);let E;return S.byteLength>1<<28?E=new re(S.byteLength*2):E=new Uint8Array(S.byteLength*2),E.set(S),E.set(O,S.byteLength),E},e.fftMix=async function(s){let x=e.F.n8*3,C,g;if(t==\"G1\")C=\"g1m_fftMix\",g=\"g1m_fftJoin\";else if(t==\"G2\")C=\"g2m_fftMix\",g=\"g2m_fftJoin\";else if(t==\"Fr\")C=\"frm_fftMix\",g=\"frm_fftJoin\";else throw new Error(\"Invalid group\");let $=Math.floor(s.byteLength/x),it=Qe($),q=1<<Qe(o.concurrency);$<=q*2&&(q=1);let S=$/q,O=Qe(S),M=[];for(let r=0;r<q;r++){let Z=[],j=s.slice(r*S*x,(r+1)*S*x);Z.push({cmd:\"ALLOCSET\",var:0,buff:j});for(let nt=1;nt<=O;nt++)Z.push({cmd:\"CALL\",fnName:C,params:[{var:0},{val:S},{val:nt}]});Z.push({cmd:\"GET\",out:0,var:0,len:S*x}),M.push(o.queueAction(Z))}let W=await Promise.all(M),ct=[];for(let r=0;r<W.length;r++)ct[r]=W[r][0];for(let r=O+1;r<=it;r++){let Z=1<<it-r,j=q/Z,nt=[];for(let y=0;y<Z;y++)for(let T=0;T<j/2;T++){let V=n.exp(n.w[r],T*S),rt=n.w[r],dt=y*j+T,ot=y*j+T+j/2,xt=[];xt.push({cmd:\"ALLOCSET\",var:0,buff:ct[dt]}),xt.push({cmd:\"ALLOCSET\",var:1,buff:ct[ot]}),xt.push({cmd:\"ALLOCSET\",var:2,buff:V}),xt.push({cmd:\"ALLOCSET\",var:3,buff:rt}),xt.push({cmd:\"CALL\",fnName:g,params:[{var:0},{var:1},{val:S},{var:2},{var:3}]}),xt.push({cmd:\"GET\",out:0,var:0,len:S*x}),xt.push({cmd:\"GET\",out:1,var:1,len:S*x}),nt.push(o.queueAction(xt))}let v=await Promise.all(nt);for(let y=0;y<Z;y++)for(let T=0;T<j/2;T++){let V=y*j+T,rt=y*j+T+j/2,dt=v.shift();ct[V]=dt[0],ct[rt]=dt[1]}}let E;s instanceof re?E=new re($*x):E=new Uint8Array($*x);let _=0;for(let r=0;r<q;r++)E.set(ct[r],_),_+=ct[r].byteLength;return E},e.fftJoin=async function(s,x,C,g){let $=e.F.n8*3,it;if(t==\"G1\")it=\"g1m_fftJoin\";else if(t==\"G2\")it=\"g2m_fftJoin\";else if(t==\"Fr\")it=\"frm_fftJoin\";else throw new Error(\"Invalid group\");if(s.byteLength!=x.byteLength)throw new Error(\"Invalid buffer size\");let q=Math.floor(s.byteLength/$);if(q!=1<<Qe(q))throw new Error(\"Invalid number of points\");let S=1<<Qe(o.concurrency);q<=S*2&&(S=1);let O=q/S,M=[];for(let r=0;r<S;r++){let Z=[],j=n.mul(C,n.exp(g,r*O)),nt=s.slice(r*O*$,(r+1)*O*$),v=x.slice(r*O*$,(r+1)*O*$);Z.push({cmd:\"ALLOCSET\",var:0,buff:nt}),Z.push({cmd:\"ALLOCSET\",var:1,buff:v}),Z.push({cmd:\"ALLOCSET\",var:2,buff:j}),Z.push({cmd:\"ALLOCSET\",var:3,buff:g}),Z.push({cmd:\"CALL\",fnName:it,params:[{var:0},{var:1},{val:O},{var:2},{var:3}]}),Z.push({cmd:\"GET\",out:0,var:0,len:O*$}),Z.push({cmd:\"GET\",out:1,var:1,len:O*$}),M.push(o.queueAction(Z))}let W=await Promise.all(M),ct,E;s instanceof re?(ct=new re(q*$),E=new re(q*$)):(ct=new Uint8Array(q*$),E=new Uint8Array(q*$));let _=0;for(let r=0;r<W.length;r++)ct.set(W[r][0],_),E.set(W[r][1],_),_+=W[r][0].byteLength;return[ct,E]},e.fftFinal=async function(s,x){let C=e.F.n8*3,g=e.F.n8*2,$,it;if(t==\"G1\")$=\"g1m_fftFinal\",it=\"g1m_batchToAffine\";else if(t==\"G2\")$=\"g2m_fftFinal\",it=\"g2m_batchToAffine\";else throw new Error(\"Invalid group\");let q=Math.floor(s.byteLength/C);if(q!=1<<Qe(q))throw new Error(\"Invalid number of points\");let S=Math.floor(q/o.concurrency),O=[];for(let E=0;E<o.concurrency;E++){let _;if(E<o.concurrency-1?_=S:_=q-E*S,_==0)continue;let r=[],Z=s.slice(E*S*C,(E*S+_)*C);r.push({cmd:\"ALLOCSET\",var:0,buff:Z}),r.push({cmd:\"ALLOCSET\",var:1,buff:x}),r.push({cmd:\"CALL\",fnName:$,params:[{var:0},{val:_},{var:1}]}),r.push({cmd:\"CALL\",fnName:it,params:[{var:0},{val:_},{var:0}]}),r.push({cmd:\"GET\",out:0,var:0,len:_*g}),O.push(o.queueAction(r))}let M=await Promise.all(O),W;s instanceof re?W=new re(q*g):W=new Uint8Array(q*g);let ct=0;for(let E=M.length-1;E>=0;E--)W.set(M[E][0],ct),ct+=M[E][0].byteLength;return W}}async function va(i){let t=await Uc(i.wasm,i.singleThread),e={};return e.q=me(i.wasm.q),e.r=me(i.wasm.r),e.name=i.name,e.tm=t,e.prePSize=i.wasm.prePSize,e.preQSize=i.wasm.preQSize,e.Fr=new Ti(t,\"frm\",i.n8r,i.r),e.F1=new Ti(t,\"f1m\",i.n8q,i.q),e.F2=new ki(t,\"f2m\",e.F1),e.G1=new Ni(t,\"g1m\",e.F1,i.wasm.pG1gen,i.wasm.pG1b,i.cofactorG1),e.G2=new Ni(t,\"g2m\",e.F2,i.wasm.pG2gen,i.wasm.pG2b,i.cofactorG2),e.F6=new Ia(t,\"f6m\",e.F2),e.F12=new ki(t,\"ftm\",e.F6),e.Gt=e.F12,Ea(e,\"G1\"),Ea(e,\"G2\"),Ea(e,\"Fr\"),qo(e,\"G1\"),qo(e,\"G2\"),Ba(e,\"G1\"),Ba(e,\"G2\"),Ba(e,\"Fr\"),Rc(e),e.array2buffer=function(n,o){let d=new Uint8Array(o*n.length);for(let h=0;h<n.length;h++)d.set(n[h],h*o);return d},e.buffer2array=function(n,o){let d=n.byteLength/o,h=new Array(d);for(let f=0;f<d;f++)h[f]=n.slice(f*o,f*o+o);return h},e}var Iu=fe(Zc(),1);globalThis.curve_bn128=null;async function Di(i,t){let e=new Iu.ModuleBuilder;e.setMemory(25),(0,xu.buildBn128)(e),t&&t(e);let n={};if(n.code=e.build(),n.pq=e.modules.f1m.pq,n.pr=e.modules.frm.pq,n.pG1gen=e.modules.bn128.pG1gen,n.pG1zero=e.modules.bn128.pG1zero,n.pG1b=e.modules.bn128.pG1b,n.pG2gen=e.modules.bn128.pG2gen,n.pG2zero=e.modules.bn128.pG2zero,n.pG2b=e.modules.bn128.pG2b,n.pOneT=e.modules.bn128.pOneT,n.prePSize=e.modules.bn128.prePSize,n.preQSize=e.modules.bn128.preQSize,n.n8q=32,n.n8r=32,n.q=e.modules.bn128.q,n.r=e.modules.bn128.r,!i&&globalThis.curve_bn128)return globalThis.curve_bn128;let o={name:\"bn128\",wasm:n,q:me(\"21888242871839275222246405745257275088696311157297823662689037894645226208583\"),r:me(\"21888242871839275222246405745257275088548364400416034343698204186575808495617\"),n8q:32,n8r:32,cofactorG2:me(\"30644e72e131a029b85045b68181585e06ceecda572a2489345f2299c0f9fa8d\",16),singleThread:!!i},d=await va(o);return d.terminate=async function(){o.singleThread||(globalThis.curve_bn128=null,await this.tm.terminate())},i||(globalThis.curve_bn128=d),d}var Eu=fe(bc(),1);var Bu=fe(Zc(),1);globalThis.curve_bls12381=null;async function Zi(i,t){let e=new Bu.ModuleBuilder;e.setMemory(25),(0,Eu.buildBls12381)(e),t&&t(e);let n={};if(n.code=e.build(),n.pq=e.modules.f1m.pq,n.pr=e.modules.frm.pq,n.pG1gen=e.modules.bls12381.pG1gen,n.pG1zero=e.modules.bls12381.pG1zero,n.pG1b=e.modules.bls12381.pG1b,n.pG2gen=e.modules.bls12381.pG2gen,n.pG2zero=e.modules.bls12381.pG2zero,n.pG2b=e.modules.bls12381.pG2b,n.pOneT=e.modules.bls12381.pOneT,n.prePSize=e.modules.bls12381.prePSize,n.preQSize=e.modules.bls12381.preQSize,n.n8q=48,n.n8r=32,n.q=e.modules.bn128.q,n.r=e.modules.bn128.r,!i&&globalThis.curve_bls12381)return globalThis.curve_bls12381;let o={name:\"bls12381\",wasm:n,q:me(\"1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab\",16),r:me(\"73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001\",16),n8q:48,n8r:32,cofactorG1:me(\"0x396c8c005555e1568c00aaab0000aaab\",16),cofactorG2:me(\"0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5\",16),singleThread:!!i},d=await va(o);return d.terminate=async function(){o.singleThread||(globalThis.curve_bls12381=null,await this.tm.terminate())},i||(globalThis.curve_bls12381=d),d}var F6=me(\"73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001\",16),A6=me(\"21888242871839275222246405745257275088548364400416034343698204186575808495617\"),C6=me(\"1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab\",16),x6=me(\"21888242871839275222246405745257275088696311157297823662689037894645226208583\");var de=qe,Bn=Bo;function vu(i){return String.fromCharCode(97+i)}async function di(i,t,e){let n=i+vu(t),o=\"zky\"+vu(t),d=await an(n),h=await d.read(4),f=\"\";for(let x=0;x<4;x++)f+=String.fromCharCode(h[x]);if(f!=o)throw new Error(n+\": Invalid File format\");if(await d.readULE32()>e)throw new Error(\"Version not supported\");if(await d.readULE32()!=1)throw new Error(\"More than one section found\");let s=await d.readULE64();return d.readingSection={size:s,p:d.pos},d}async function ui(i,t){if(typeof i.readingSection>\"u\")throw new Error(\"Not reading a section\");if(!t&&i.pos-i.readingSection.p!=i.readingSection.size)throw new Error(\"Invalid section size reading\");await i.close(),delete i.readingSection}async function fi(i,t,e){let n=await di(i,t,e),o;return n.readingSection.size<1<<30?o=new Uint8Array(n.readingSection.size):o=new re(n.readingSection.size),await n.readToBuffer(o,0,n.readingSection.size,n.pos),await ui(n),o}var V6=de.e(\"73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001\",16),W6=de.e(\"21888242871839275222246405745257275088548364400416034343698204186575808495617\"),zg=de.e(\"1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab\",16),Mg=de.e(\"21888242871839275222246405745257275088696311157297823662689037894645226208583\");async function rn(i){let t;if(de.eq(i,Mg))t=await Di();else if(de.eq(i,zg))t=await Zi();else throw new Error(`Curve not supported: ${de.toString(i)}`);return t}async function Oo(i){let t,e=n(i);if([\"BN128\",\"BN254\",\"ALTBN128\"].indexOf(e)>=0)t=await Di();else if([\"BLS12381\"].indexOf(e)>=0)t=await Zi();else throw new Error(`Curve not supported: ${i}`);return t;function n(o){return o.toUpperCase().match(/[A-Za-z0-9]+/g).join(\"\")}}var Zp=fe(Oe(),1),Hp=fe(u2(),1);import dF from\"crypto\";var $p=[];for(let i=0;i<256;i++)$p[i]=Kp(i,8);function Kp(i,t){let e=0,n=i;for(let o=0;o<t;o++)e<<=1,e=e|n&1,n>>=1;return e}function $i(i){return(i&4294901760?(i&=4294901760,16):0)|(i&4278255360?(i&=4278255360,8):0)|(i&4042322160?(i&=4042322160,4):0)|(i&3435973836?(i&=3435973836,2):0)|(i&2863311530)!==0}async function Yc(i,t,e){let n=await i.read(t.G1.F.n8*2),o=t.G1.fromRprLEM(n,0);return e?t.G1.toObject(o):o}async function Xc(i,t,e){let n=await i.read(t.G2.F.n8*2),o=t.G2.fromRprLEM(n,0);return e?t.G2.toObject(o):o}async function Qn(i,t){let e=await di(i,1,t),n=await e.readULE32();if(await ui(e),n==1)return await jp(i,t);throw new Error(\"Protocol not supported: \")}async function jp(i,t,e){let n={};n.protocol=\"groth16\";let o=await di(i,2,t),d=await o.readULE32();n.n8q=d,n.q=await qi(o,d);let h=await o.readULE32();n.n8r=h,n.r=await qi(o,h);let f=await rn(n.q);return n.nVars=await o.readULE32(),n.nPublic=await o.readULE32(),n.domainSize=await o.readULE32(),n.power=$i(n.domainSize),n.vk_alpha_1=await Yc(o,f,e),n.vk_beta_1=await Yc(o,f,e),n.vk_beta_2=await Xc(o,f,e),n.vk_gamma_2=await Xc(o,f,e),n.vk_delta_1=await Yc(o,f,e),n.vk_delta_2=await Xc(o,f,e),await ui(o),n}async function h2(i,t,e){await on(i,1);let n=(Math.floor((de.bitLength(e)-1)/64)+1)*8;if(await i.writeULE32(n),await Si(i,e,n),t.byteLength%n!=0)throw new Error(\"Invalid witness length\");await i.writeULE32(t.byteLength/n),await sn(i),await on(i,2),await i.write(t),await sn(i)}async function Jc(i,t){await zn(i,t,1);let e=await i.readULE32(),n=await qi(i,e),o=await i.readULE32();return await Mn(i),{n8:e,q:n,nWitness:o}}var{stringifyBigInts:g2}=Bn;async function Ua(i,t,e){let{fd:n,sections:o}=await Ee(t,\"wtns\",2,33554432,8388608),d=await Jc(n,o),h=2,f=await Qn(i,h);if(f.protocol!=\"groth16\")throw new Error(\"zkey file is not groth16\");if(!de.eq(f.r,d.q))throw new Error(\"Curve of the witness does not match the curve of the proving key\");if(d.nWitness!=f.nVars)throw new Error(`Invalid witness length. Circuit: ${f.nVars}, witness: ${d.nWitness}`);let L=await rn(f.q),l=L.Fr,s=L.G1,x=L.G2,C=$i(f.domainSize);e&&e.debug(\"Reading Wtns\");let g=await oi(n,o,2);e&&e.debug(\"Reading Coeffs\");let $=await fi(i,4,h);e&&e.debug(\"Building ABC\");let[it,q,S]=await Vp(L,f,g,$,e),O=C==l.s?L.Fr.shift:L.Fr.w[C+1],M=await l.ifft(it,\"\",\"\",e,\"IFFT_A\"),W=await l.batchApplyKey(M,l.e(1),O),ct=await l.fft(W,\"\",\"\",e,\"FFT_A\"),E=await l.ifft(q,\"\",\"\",e,\"IFFT_B\"),_=await l.batchApplyKey(E,l.e(1),O),r=await l.fft(_,\"\",\"\",e,\"FFT_B\"),Z=await l.ifft(S,\"\",\"\",e,\"IFFT_C\"),j=await l.batchApplyKey(Z,l.e(1),O),nt=await l.fft(j,\"\",\"\",e,\"FFT_C\");e&&e.debug(\"Join ABC\");let v=await Wp(L,f,ct,r,nt,e),y={};e&&e.debug(\"Reading A Points\");let T=await fi(i,5,h);y.pi_a=await L.G1.multiExpAffine(T,g,e,\"multiexp A\"),e&&e.debug(\"Reading B1 Points\");let V=await fi(i,6,h),rt=await L.G1.multiExpAffine(V,g,e,\"multiexp B1\");e&&e.debug(\"Reading B2 Points\");let dt=await fi(i,7,h);y.pi_b=await L.G2.multiExpAffine(dt,g,e,\"multiexp B2\"),e&&e.debug(\"Reading C Points\");let ot=await fi(i,8,h);y.pi_c=await L.G1.multiExpAffine(ot,g.slice((f.nPublic+1)*L.Fr.n8),e,\"multiexp C\"),e&&e.debug(\"Reading H Points\");let xt=await fi(i,9,h),pt=await L.G1.multiExpAffine(xt,v,e,\"multiexp H\"),bt=L.Fr.random(),vt=L.Fr.random();y.pi_a=s.add(y.pi_a,f.vk_alpha_1),y.pi_a=s.add(y.pi_a,s.timesFr(f.vk_delta_1,bt)),y.pi_b=x.add(y.pi_b,f.vk_beta_2),y.pi_b=x.add(y.pi_b,x.timesFr(f.vk_delta_2,vt)),rt=s.add(rt,f.vk_beta_1),rt=s.add(rt,s.timesFr(f.vk_delta_1,vt)),y.pi_c=s.add(y.pi_c,pt),y.pi_c=s.add(y.pi_c,s.timesFr(y.pi_a,vt)),y.pi_c=s.add(y.pi_c,s.timesFr(rt,bt)),y.pi_c=s.add(y.pi_c,s.timesFr(f.vk_delta_1,l.neg(l.mul(bt,vt))));let Pt=[];for(let Ht=1;Ht<=f.nPublic;Ht++){let m=g.slice(Ht*l.n8,Ht*l.n8+l.n8);Pt.push(de.fromRprLE(m))}return y.pi_a=s.toObject(s.toAffine(y.pi_a)),y.pi_b=x.toObject(x.toAffine(y.pi_b)),y.pi_c=s.toObject(s.toAffine(y.pi_c)),y.protocol=\"groth16\",y.curve=L.name,await n.close(),y=g2(y),Pt=g2(Pt),{proof:y,publicSignals:Pt}}async function Vp(i,t,e,n,o){let d=i.Fr.n8,h=4*3+t.n8r,f=(n.byteLength-4)/h,L=new re(t.domainSize*d),l=new re(t.domainSize*d),s=new re(t.domainSize*d),x=[L,l];for(let C=0;C<f;C++){o&&C%1e6==0&&o.debug(`QAP AB: ${C}/${f}`);let g=n.slice(4+C*h,4+C*h+h),$=new DataView(g.buffer),it=$.getUint32(0,!0),q=$.getUint32(4,!0),S=$.getUint32(8,!0),O=g.slice(12,12+d);x[it].set(i.Fr.add(x[it].slice(q*d,q*d+d),i.Fr.mul(O,e.slice(S*d,S*d+d))),q*d)}for(let C=0;C<t.domainSize;C++)o&&C%1e6==0&&o.debug(`QAP C: ${C}/${t.domainSize}`),s.set(i.Fr.mul(L.slice(C*d,C*d+d),l.slice(C*d,C*d+d)),C*d);return[L,l,s]}async function Wp(i,t,e,n,o,d){let f=i.Fr.n8,L=Math.floor(e.byteLength/i.Fr.n8),l=[];for(let g=0;g<L;g+=4194304){d&&d.debug(`JoinABC: ${g}/${L}`);let $=Math.min(L-g,4194304),it=[],q=e.slice(g*f,(g+$)*f),S=n.slice(g*f,(g+$)*f),O=o.slice(g*f,(g+$)*f);it.push({cmd:\"ALLOCSET\",var:0,buff:q}),it.push({cmd:\"ALLOCSET\",var:1,buff:S}),it.push({cmd:\"ALLOCSET\",var:2,buff:O}),it.push({cmd:\"ALLOC\",var:3,len:$*f}),it.push({cmd:\"CALL\",fnName:\"qap_joinABC\",params:[{var:0},{var:1},{var:2},{val:$},{var:3}]}),it.push({cmd:\"CALL\",fnName:\"frm_batchFromMontgomery\",params:[{var:3},{val:$},{var:3}]}),it.push({cmd:\"GET\",out:0,var:3,len:$*f}),l.push(i.tm.queueAction(it))}let s=await Promise.all(l),x;e instanceof re?x=new re(e.byteLength):x=new Uint8Array(e.byteLength);let C=0;for(let g=0;g<s.length;g++)x.set(s[g][0],C),C+=s[g][0].byteLength;return x}function tr(i){var t=[];return e(t,i),t;function e(n,o){if(Array.isArray(o))for(let d=0;d<o.length;d++)e(n,o[d]);else n.push(o)}}function er(i){let t=BigInt(2)**BigInt(64),e=BigInt(\"0xCBF29CE484222325\");for(var n=0;n<i.length;n++)e^=BigInt(i[n].charCodeAt()),e*=BigInt(1099511628211),e%=t;let o=e.toString(16),d=16-o.length;return o=\"0\".repeat(d).concat(o),o}function p2(i,t){let e=[],n=BigInt(i),o=BigInt(4294967296);for(;n;)e.unshift(Number(n%o)),n=n/o;if(t)for(var d=t-e.length;d>0;)e.unshift(0),d--;return e}async function Ra(i,t){t=t||{};let e=32767,n,o=!1;for(;!o;)try{n=new WebAssembly.Memory({initial:e}),o=!0}catch(s){if(e===1)throw s;console.warn(\"Could not allocate \"+e*1024*64+\" bytes. This may cause severe instability. Trying with \"+e*1024*64/2+\" bytes\"),e=Math.floor(e/2)}let d=await WebAssembly.compile(i),h,f=await WebAssembly.instantiate(d,{env:{memory:n},runtime:{exceptionHandler:function(s){let x;throw s==1?x=\"Signal not found. \":s==2?x=\"Too many signals set. \":s==3?x=\"Signal already set. \":s==4?x=\"Assert Failed. \":s==5?x=\"Not enough memory. \":x=\"Unknown error.\",console.log(\"ERROR: \",s,x),new Error(x)},showSharedRWMemory:function(){let s=f.exports.getFieldNumLen32(),x=new Uint32Array(s);for(let C=0;C<s;C++)x[s-1-C]=f.exports.readSharedRWMemory(C);console.log(de.fromArray(x,4294967296))},error:function(s,x,C,g,$,it){let q;throw s==7?q=l(x)+\" \"+h.getFr(g).toString()+\" != \"+h.getFr($).toString()+\" \"+l(it):s==9?q=l(x)+\" \"+h.getFr(g).toString()+\" \"+l($):s==5&&t.sym?q=l(x)+\" \"+t.sym.labelIdx2Name[$]:q=l(x)+\" \"+C+\" \"+g+\" \"+$+\" \"+it,console.log(\"ERROR: \",s,q),new Error(q)},log:function(s){console.log(h.getFr(s).toString())},logGetSignal:function(s,x){t.logGetSignal&&t.logGetSignal(s,h.getFr(x))},logSetSignal:function(s,x){t.logSetSignal&&t.logSetSignal(s,h.getFr(x))},logStartComponent:function(s){t.logStartComponent&&t.logStartComponent(s)},logFinishComponent:function(s){t.logFinishComponent&&t.logFinishComponent(s)}}}),L=t&&(t.sanityCheck||t.logGetSignal||t.logSetSignal||t.logStartComponent||t.logFinishComponent);return typeof f.exports.getVersion==\"function\"?h=new ir(f,L):h=new nr(n,f,L),h;function l(s){let x=new Uint8Array(n.buffer),C=[];for(let g=0;x[s+g]>0;g++)C.push(x[s+g]);return String.fromCharCode.apply(null,C)}}var nr=class{constructor(t,e,n){this.memory=t,this.i32=new Uint32Array(t.buffer),this.instance=e,this.n32=(this.instance.exports.getFrLen()>>2)-2;let o=this.instance.exports.getPRawPrime(),d=new Array(this.n32);for(let h=0;h<this.n32;h++)d[this.n32-1-h]=this.i32[(o>>2)+h];this.prime=de.fromArray(d,4294967296),this.Fr=new Xn(this.prime),this.mask32=de.fromString(\"FFFFFFFF\",16),this.NVars=this.instance.exports.getNVars(),this.n64=Math.floor((this.Fr.bitLength-1)/64)+1,this.R=this.Fr.e(de.shiftLeft(1,this.n64*64)),this.RInv=this.Fr.inv(this.R),this.sanityCheck=n}circom_version(){return 1}async _doCalculateWitness(t,e){this.instance.exports.init(this.sanityCheck||e?1:0);let n=this.allocInt(),o=this.allocFr();Object.keys(t).forEach(h=>{let f=er(h),L=parseInt(f.slice(0,8),16),l=parseInt(f.slice(8,16),16);try{this.instance.exports.getSignalOffset32(n,0,L,l)}catch{throw new Error(`Signal ${h} is not an input of the circuit.`)}let s=this.getInt(n),x=tr(t[h]);for(let C=0;C<x.length;C++)this.setFr(o,x[C]),this.instance.exports.setSignal(0,0,s+C,o)})}async calculateWitness(t,e){let n=this,o=n.i32[0],d=[];await n._doCalculateWitness(t,e);for(let h=0;h<n.NVars;h++){let f=n.instance.exports.getPWitness(h);d.push(n.getFr(f))}return n.i32[0]=o,d}async calculateBinWitness(t,e){let n=this,o=n.i32[0];await n._doCalculateWitness(t,e);let d=n.instance.exports.getWitnessBuffer();n.i32[0]=o;let h=n.memory.buffer.slice(d,d+n.NVars*n.n64*8);return new Uint8Array(h)}allocInt(){let t=this.i32[0];return this.i32[0]=t+8,t}allocFr(){let t=this.i32[0];return this.i32[0]=t+this.n32*4+8,t}getInt(t){return this.i32[t>>2]}setInt(t,e){this.i32[t>>2]=e}getFr(t){let e=this,n=t>>2;if(e.i32[n+1]&2147483648){let d=new Array(e.n32);for(let f=0;f<e.n32;f++)d[e.n32-1-f]=e.i32[n+2+f];let h=e.Fr.e(de.fromArray(d,4294967296));return e.i32[n+1]&1073741824?o(h):h}else return e.i32[n]&2147483648?e.Fr.e(e.i32[n]-4294967296):e.Fr.e(e.i32[n]);function o(d){return e.Fr.mul(e.RInv,d)}}setFr(t,e){let n=this;e=n.Fr.e(e);let o=n.Fr.neg(n.Fr.e(\"80000000\",16)),d=n.Fr.e(\"7FFFFFFF\",16);if(n.Fr.geq(e,o)&&n.Fr.leq(e,d)){let f;n.Fr.geq(e,n.Fr.zero)?f=de.toNumber(e):(f=de.toNumber(n.Fr.sub(e,o)),f=f-2147483648,f=4294967296+f),n.i32[t>>2]=f,n.i32[(t>>2)+1]=0;return}n.i32[t>>2]=0,n.i32[(t>>2)+1]=2147483648;let h=de.toArray(e,4294967296);for(let f=0;f<n.n32;f++){let L=h.length-1-f;L>=0?n.i32[(t>>2)+2+f]=h[L]:n.i32[(t>>2)+2+f]=0}}},ir=class{constructor(t,e){this.instance=t,this.version=this.instance.exports.getVersion(),this.n32=this.instance.exports.getFieldNumLen32(),this.instance.exports.getRawPrime();let n=new Array(this.n32);for(let o=0;o<this.n32;o++)n[this.n32-1-o]=this.instance.exports.readSharedRWMemory(o);this.prime=de.fromArray(n,4294967296),this.witnessSize=this.instance.exports.getWitnessSize(),this.sanityCheck=e}circom_version(){return this.instance.exports.getVersion()}async _doCalculateWitness(t,e){this.instance.exports.init(this.sanityCheck||e?1:0);let n=Object.keys(t);var o=0;if(n.forEach(d=>{let h=er(d),f=parseInt(h.slice(0,8),16),L=parseInt(h.slice(8,16),16),l=tr(t[d]);for(let s=0;s<l.length;s++){let x=p2(l[s],this.n32);for(let C=0;C<this.n32;C++)this.instance.exports.writeSharedRWMemory(C,x[this.n32-1-C]);try{this.instance.exports.setInputSignal(f,L,s),o++}catch(C){throw new Error(C)}}}),o<this.instance.exports.getInputSize())throw new Error(`Not all inputs have been set. Only ${o} out of ${this.instance.exports.getInputSize()}`)}async calculateWitness(t,e){let n=[];await this._doCalculateWitness(t,e);for(let o=0;o<this.witnessSize;o++){this.instance.exports.getWitness(o);let d=new Uint32Array(this.n32);for(let h=0;h<this.n32;h++)d[this.n32-1-h]=this.instance.exports.readSharedRWMemory(h);n.push(fromArray32(d))}return n}async calculateWTNSBin(t,e){let n=new Uint32Array(this.witnessSize*this.n32+this.n32+11),o=new Uint8Array(n.buffer);await this._doCalculateWitness(t,e),o[0]=119,o[1]=116,o[2]=110,o[3]=115,n[1]=2,n[2]=2,n[3]=1;let d=this.n32*4,f=(8+d).toString(16);n[4]=parseInt(f.slice(0,8),16),n[5]=parseInt(f.slice(8,16),16),n[6]=d,this.instance.exports.getRawPrime();var L=7;for(let x=0;x<this.n32;x++)n[L+x]=this.instance.exports.readSharedRWMemory(x);L+=this.n32,n[L]=this.witnessSize,L++,n[L]=2,L++;let s=(d*this.witnessSize).toString(16);n[L]=parseInt(s.slice(0,8),16),n[L+1]=parseInt(s.slice(8,16),16),L+=2;for(let x=0;x<this.witnessSize;x++){this.instance.exports.getWitness(x);for(let C=0;C<this.n32;C++)n[L+C]=this.instance.exports.readSharedRWMemory(C);L+=this.n32}return o}};async function Oa(i,t,e,n){let o=await an(t),d=await o.read(o.totalSize);await o.close();let h=await Ra(d);if(h.circom_version()==1){let f=await h.calculateBinWitness(i),L=await Ge(e,\"wtns\",2,2);await h2(L,f,h.prime),await L.close()}else{let f=await jn(e),L=await h.calculateWTNSBin(i);await f.write(L),await f.close()}}async function ar(i,t,e,n){let o={type:\"mem\"};return await Oa(i,t,o),await Ua(e,o,n)}var{unstringifyBigInts:or}=Bn;async function sr(i,t,e,n){i=or(i),e=or(e),t=or(t);let o=await Oo(i.curve),d=o.G1.fromObject(i.IC[0]),h=new Uint8Array(o.G1.F.n8*2*t.length),f=new Uint8Array(o.Fr.n8*t.length);for(let S=0;S<t.length;S++){let O=o.G1.fromObject(i.IC[S+1]);h.set(O,S*o.G1.F.n8*2),de.toRprLE(f,o.Fr.n8*S,t[S],o.Fr.n8)}let L=await o.G1.multiExpAffine(h,f);L=o.G1.add(L,d);let l=o.G1.fromObject(e.pi_a),s=o.G2.fromObject(e.pi_b),x=o.G1.fromObject(e.pi_c),C=o.G2.fromObject(i.vk_gamma_2),g=o.G2.fromObject(i.vk_delta_2),$=o.G1.fromObject(i.vk_alpha_1),it=o.G2.fromObject(i.vk_beta_2);return await o.pairingEq(o.G1.neg(l),s,L,C,x,g,$,it)?(n&&n.info(\"OK!\"),!0):(n&&n.error(\"Invalid proof\"),!1)}function Dn(i){let t=i.toString(16);for(;t.length<64;)t=\"0\"+t;return t=`\"0x${t}\"`,t}async function cr(i,t){let e=\"\";for(let o=0;o<t.length;o++)e!=\"\"&&(e=e+\",\"),e=e+Dn(t[o]);let n;return n=`[${Dn(i.pi_a[0])}, ${Dn(i.pi_a[1])}],[[${Dn(i.pi_b[0][1])}, ${Dn(i.pi_b[0][0])}],[${Dn(i.pi_b[1][1])}, ${Dn(i.pi_b[1][0])}]],[${Dn(i.pi_c[0])}, ${Dn(i.pi_c[1])}],[${e}]`,n}var Xp=fe(Oe(),1);var Yp=fe(Oe(),1);var Jp=fe(Oe(),1);var t1=fe(Oe(),1);var e1=fe(Oe(),1);var o1=fe(Oe(),1);import KF from\"crypto\";var c1=fe(Oe(),1);var l1=fe(Oe(),1);var d1=fe(Oe(),1);var TA=de.e(\"73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001\",16),kA=de.e(\"21888242871839275222246405745257275088548364400416034343698204186575808495617\");var L1=fe(Oe(),1);var m1=fe(Oe(),1);import EC from\"crypto\";var F1=fe(Oe(),1);var A1=fe(Oe(),1);var C1=fe(Oe(),1);var{stringifyBigInts:JC}=Bn;var D1=fe(R2(),1);var H1=fe(Oe(),1);var O2=fe(pr(),1),{stringifyBigInts:Px}=Bn,{keccak256:zx}=O2.default;var P2=fe(pr(),1),{unstringifyBigInts:Dx}=Bn,{keccak256:Zx}=P2.default;function Ji(i){let t=i.length;for(;--t>=0;)i[t]=0}var V1=0,wf=1,W1=2,Y1=3,X1=258,kr=29,Ja=256,Ha=Ja+1+kr,Wi=30,Nr=19,Ff=2*Ha+1,pi=15,Lr=16,J1=7,Qr=256,Af=16,Cf=17,xf=18,qr=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]),Wo=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]),tL=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),If=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),eL=512,Hn=new Array((Ha+2)*2);Ji(Hn);var Qa=new Array(Wi*2);Ji(Qa);var $a=new Array(eL);Ji($a);var Ka=new Array(X1-Y1+1);Ji(Ka);var Dr=new Array(kr);Ji(Dr);var Yo=new Array(Wi);Ji(Yo);function mr(i,t,e,n,o){this.static_tree=i,this.extra_bits=t,this.extra_base=e,this.elems=n,this.max_length=o,this.has_stree=i&&i.length}var Ef,Bf,vf;function br(i,t){this.dyn_tree=i,this.max_code=0,this.stat_desc=t}var Sf=i=>i<256?$a[i]:$a[256+(i>>>7)],ja=(i,t)=>{i.pending_buf[i.pending++]=t&255,i.pending_buf[i.pending++]=t>>>8&255},je=(i,t,e)=>{i.bi_valid>Lr-e?(i.bi_buf|=t<<i.bi_valid&65535,ja(i,i.bi_buf),i.bi_buf=t>>Lr-i.bi_valid,i.bi_valid+=e-Lr):(i.bi_buf|=t<<i.bi_valid&65535,i.bi_valid+=e)},Un=(i,t,e)=>{je(i,e[t*2],e[t*2+1])},qf=(i,t)=>{let e=0;do e|=i&1,i>>>=1,e<<=1;while(--t>0);return e>>>1},nL=i=>{i.bi_valid===16?(ja(i,i.bi_buf),i.bi_buf=0,i.bi_valid=0):i.bi_valid>=8&&(i.pending_buf[i.pending++]=i.bi_buf&255,i.bi_buf>>=8,i.bi_valid-=8)},iL=(i,t)=>{let e=t.dyn_tree,n=t.max_code,o=t.stat_desc.static_tree,d=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,L=t.stat_desc.max_length,l,s,x,C,g,$,it=0;for(C=0;C<=pi;C++)i.bl_count[C]=0;for(e[i.heap[i.heap_max]*2+1]=0,l=i.heap_max+1;l<Ff;l++)s=i.heap[l],C=e[e[s*2+1]*2+1]+1,C>L&&(C=L,it++),e[s*2+1]=C,!(s>n)&&(i.bl_count[C]++,g=0,s>=f&&(g=h[s-f]),$=e[s*2],i.opt_len+=$*(C+g),d&&(i.static_len+=$*(o[s*2+1]+g)));if(it!==0){do{for(C=L-1;i.bl_count[C]===0;)C--;i.bl_count[C]--,i.bl_count[C+1]+=2,i.bl_count[L]--,it-=2}while(it>0);for(C=L;C!==0;C--)for(s=i.bl_count[C];s!==0;)x=i.heap[--l],!(x>n)&&(e[x*2+1]!==C&&(i.opt_len+=(C-e[x*2+1])*e[x*2],e[x*2+1]=C),s--)}},Uf=(i,t,e)=>{let n=new Array(pi+1),o=0,d,h;for(d=1;d<=pi;d++)o=o+e[d-1]<<1,n[d]=o;for(h=0;h<=t;h++){let f=i[h*2+1];f!==0&&(i[h*2]=qf(n[f]++,f))}},aL=()=>{let i,t,e,n,o,d=new Array(pi+1);for(e=0,n=0;n<kr-1;n++)for(Dr[n]=e,i=0;i<1<<qr[n];i++)Ka[e++]=n;for(Ka[e-1]=n,o=0,n=0;n<16;n++)for(Yo[n]=o,i=0;i<1<<Wo[n];i++)$a[o++]=n;for(o>>=7;n<Wi;n++)for(Yo[n]=o<<7,i=0;i<1<<Wo[n]-7;i++)$a[256+o++]=n;for(t=0;t<=pi;t++)d[t]=0;for(i=0;i<=143;)Hn[i*2+1]=8,i++,d[8]++;for(;i<=255;)Hn[i*2+1]=9,i++,d[9]++;for(;i<=279;)Hn[i*2+1]=7,i++,d[7]++;for(;i<=287;)Hn[i*2+1]=8,i++,d[8]++;for(Uf(Hn,Ha+1,d),i=0;i<Wi;i++)Qa[i*2+1]=5,Qa[i*2]=qf(i,5);Ef=new mr(Hn,qr,Ja+1,Ha,pi),Bf=new mr(Qa,Wo,0,Wi,pi),vf=new mr(new Array(0),tL,0,Nr,J1)},Rf=i=>{let t;for(t=0;t<Ha;t++)i.dyn_ltree[t*2]=0;for(t=0;t<Wi;t++)i.dyn_dtree[t*2]=0;for(t=0;t<Nr;t++)i.bl_tree[t*2]=0;i.dyn_ltree[Qr*2]=1,i.opt_len=i.static_len=0,i.sym_next=i.matches=0},Of=i=>{i.bi_valid>8?ja(i,i.bi_buf):i.bi_valid>0&&(i.pending_buf[i.pending++]=i.bi_buf),i.bi_buf=0,i.bi_valid=0},z2=(i,t,e,n)=>{let o=t*2,d=e*2;return i[o]<i[d]||i[o]===i[d]&&n[t]<=n[e]},yr=(i,t,e)=>{let n=i.heap[e],o=e<<1;for(;o<=i.heap_len&&(o<i.heap_len&&z2(t,i.heap[o+1],i.heap[o],i.depth)&&o++,!z2(t,n,i.heap[o],i.depth));)i.heap[e]=i.heap[o],e=o,o<<=1;i.heap[e]=n},M2=(i,t,e)=>{let n,o,d=0,h,f;if(i.sym_next!==0)do n=i.pending_buf[i.sym_buf+d++]&255,n+=(i.pending_buf[i.sym_buf+d++]&255)<<8,o=i.pending_buf[i.sym_buf+d++],n===0?Un(i,o,t):(h=Ka[o],Un(i,h+Ja+1,t),f=qr[h],f!==0&&(o-=Dr[h],je(i,o,f)),n--,h=Sf(n),Un(i,h,e),f=Wo[h],f!==0&&(n-=Yo[h],je(i,n,f)));while(d<i.sym_next);Un(i,Qr,t)},Ur=(i,t)=>{let e=t.dyn_tree,n=t.stat_desc.static_tree,o=t.stat_desc.has_stree,d=t.stat_desc.elems,h,f,L=-1,l;for(i.heap_len=0,i.heap_max=Ff,h=0;h<d;h++)e[h*2]!==0?(i.heap[++i.heap_len]=L=h,i.depth[h]=0):e[h*2+1]=0;for(;i.heap_len<2;)l=i.heap[++i.heap_len]=L<2?++L:0,e[l*2]=1,i.depth[l]=0,i.opt_len--,o&&(i.static_len-=n[l*2+1]);for(t.max_code=L,h=i.heap_len>>1;h>=1;h--)yr(i,e,h);l=d;do h=i.heap[1],i.heap[1]=i.heap[i.heap_len--],yr(i,e,1),f=i.heap[1],i.heap[--i.heap_max]=h,i.heap[--i.heap_max]=f,e[l*2]=e[h*2]+e[f*2],i.depth[l]=(i.depth[h]>=i.depth[f]?i.depth[h]:i.depth[f])+1,e[h*2+1]=e[f*2+1]=l,i.heap[1]=l++,yr(i,e,1);while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],iL(i,t),Uf(e,L,i.bl_count)},G2=(i,t,e)=>{let n,o=-1,d,h=t[0*2+1],f=0,L=7,l=4;for(h===0&&(L=138,l=3),t[(e+1)*2+1]=65535,n=0;n<=e;n++)d=h,h=t[(n+1)*2+1],!(++f<L&&d===h)&&(f<l?i.bl_tree[d*2]+=f:d!==0?(d!==o&&i.bl_tree[d*2]++,i.bl_tree[Af*2]++):f<=10?i.bl_tree[Cf*2]++:i.bl_tree[xf*2]++,f=0,o=d,h===0?(L=138,l=3):d===h?(L=6,l=3):(L=7,l=4))},T2=(i,t,e)=>{let n,o=-1,d,h=t[0*2+1],f=0,L=7,l=4;for(h===0&&(L=138,l=3),n=0;n<=e;n++)if(d=h,h=t[(n+1)*2+1],!(++f<L&&d===h)){if(f<l)do Un(i,d,i.bl_tree);while(--f!==0);else d!==0?(d!==o&&(Un(i,d,i.bl_tree),f--),Un(i,Af,i.bl_tree),je(i,f-3,2)):f<=10?(Un(i,Cf,i.bl_tree),je(i,f-3,3)):(Un(i,xf,i.bl_tree),je(i,f-11,7));f=0,o=d,h===0?(L=138,l=3):d===h?(L=6,l=3):(L=7,l=4)}},oL=i=>{let t;for(G2(i,i.dyn_ltree,i.l_desc.max_code),G2(i,i.dyn_dtree,i.d_desc.max_code),Ur(i,i.bl_desc),t=Nr-1;t>=3&&i.bl_tree[If[t]*2+1]===0;t--);return i.opt_len+=3*(t+1)+5+5+4,t},sL=(i,t,e,n)=>{let o;for(je(i,t-257,5),je(i,e-1,5),je(i,n-4,4),o=0;o<n;o++)je(i,i.bl_tree[If[o]*2+1],3);T2(i,i.dyn_ltree,t-1),T2(i,i.dyn_dtree,e-1)},cL=i=>{let t=4093624447,e;for(e=0;e<=31;e++,t>>>=1)if(t&1&&i.dyn_ltree[e*2]!==0)return 0;if(i.dyn_ltree[9*2]!==0||i.dyn_ltree[10*2]!==0||i.dyn_ltree[13*2]!==0)return 1;for(e=32;e<Ja;e++)if(i.dyn_ltree[e*2]!==0)return 1;return 0},k2=!1,rL=i=>{k2||(aL(),k2=!0),i.l_desc=new br(i.dyn_ltree,Ef),i.d_desc=new br(i.dyn_dtree,Bf),i.bl_desc=new br(i.bl_tree,vf),i.bi_buf=0,i.bi_valid=0,Rf(i)},Pf=(i,t,e,n)=>{je(i,(V1<<1)+(n?1:0),3),Of(i),ja(i,e),ja(i,~e),e&&i.pending_buf.set(i.window.subarray(t,t+e),i.pending),i.pending+=e},lL=i=>{je(i,wf<<1,3),Un(i,Qr,Hn),nL(i)},dL=(i,t,e,n)=>{let o,d,h=0;i.level>0?(i.strm.data_type===2&&(i.strm.data_type=cL(i)),Ur(i,i.l_desc),Ur(i,i.d_desc),h=oL(i),o=i.opt_len+3+7>>>3,d=i.static_len+3+7>>>3,d<=o&&(o=d)):o=d=e+5,e+4<=o&&t!==-1?Pf(i,t,e,n):i.strategy===4||d===o?(je(i,(wf<<1)+(n?1:0),3),M2(i,Hn,Qa)):(je(i,(W1<<1)+(n?1:0),3),sL(i,i.l_desc.max_code+1,i.d_desc.max_code+1,h+1),M2(i,i.dyn_ltree,i.dyn_dtree)),Rf(i),n&&Of(i)},uL=(i,t,e)=>(i.pending_buf[i.sym_buf+i.sym_next++]=t,i.pending_buf[i.sym_buf+i.sym_next++]=t>>8,i.pending_buf[i.sym_buf+i.sym_next++]=e,t===0?i.dyn_ltree[e*2]++:(i.matches++,t--,i.dyn_ltree[(Ka[e]+Ja+1)*2]++,i.dyn_dtree[Sf(t)*2]++),i.sym_next===i.sym_end),fL=rL,_L=Pf,hL=dL,gL=uL,pL=lL,LL={_tr_init:fL,_tr_stored_block:_L,_tr_flush_block:hL,_tr_tally:gL,_tr_align:pL},mL=(i,t,e,n)=>{let o=i&65535|0,d=i>>>16&65535|0,h=0;for(;e!==0;){h=e>2e3?2e3:e,e-=h;do o=o+t[n++]|0,d=d+o|0;while(--h);o%=65521,d%=65521}return o|d<<16|0},Va=mL,bL=()=>{let i,t=[];for(var e=0;e<256;e++){i=e;for(var n=0;n<8;n++)i=i&1?3988292384^i>>>1:i>>>1;t[e]=i}return t},yL=new Uint32Array(bL()),wL=(i,t,e,n)=>{let o=yL,d=n+e;i^=-1;for(let h=n;h<d;h++)i=i>>>8^o[(i^t[h])&255];return i^-1},Ue=wL,bi={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\"},Fi={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},{_tr_init:FL,_tr_stored_block:Rr,_tr_flush_block:AL,_tr_tally:ei,_tr_align:CL}=LL,{Z_NO_FLUSH:ni,Z_PARTIAL_FLUSH:xL,Z_FULL_FLUSH:IL,Z_FINISH:dn,Z_BLOCK:N2,Z_OK:Pe,Z_STREAM_END:Q2,Z_STREAM_ERROR:Rn,Z_DATA_ERROR:EL,Z_BUF_ERROR:wr,Z_DEFAULT_COMPRESSION:BL,Z_FILTERED:vL,Z_HUFFMAN_ONLY:Ho,Z_RLE:SL,Z_FIXED:qL,Z_DEFAULT_STRATEGY:UL,Z_UNKNOWN:RL,Z_DEFLATED:ts}=Fi,OL=9,PL=15,zL=8,ML=29,GL=256,Or=GL+1+ML,TL=30,kL=19,NL=2*Or+1,QL=15,ue=3,ti=258,On=ti+ue+1,DL=32,Yi=42,Zr=57,Pr=69,zr=73,Mr=91,Gr=103,Li=113,ka=666,He=1,ta=2,yi=3,ea=4,ZL=3,mi=(i,t)=>(i.msg=bi[t],t),D2=i=>i*2-(i>4?9:0),Jn=i=>{let t=i.length;for(;--t>=0;)i[t]=0},HL=i=>{let t,e,n,o=i.w_size;t=i.hash_size,n=t;do e=i.head[--n],i.head[n]=e>=o?e-o:0;while(--t);t=o,n=t;do e=i.prev[--n],i.prev[n]=e>=o?e-o:0;while(--t)},$L=(i,t,e)=>(t<<i.hash_shift^e)&i.hash_mask,ii=$L,tn=i=>{let t=i.state,e=t.pending;e>i.avail_out&&(e=i.avail_out),e!==0&&(i.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+e),i.next_out),i.next_out+=e,t.pending_out+=e,i.total_out+=e,i.avail_out-=e,t.pending-=e,t.pending===0&&(t.pending_out=0))},en=(i,t)=>{AL(i,i.block_start>=0?i.block_start:-1,i.strstart-i.block_start,t),i.block_start=i.strstart,tn(i.strm)},he=(i,t)=>{i.pending_buf[i.pending++]=t},Ta=(i,t)=>{i.pending_buf[i.pending++]=t>>>8&255,i.pending_buf[i.pending++]=t&255},Tr=(i,t,e,n)=>{let o=i.avail_in;return o>n&&(o=n),o===0?0:(i.avail_in-=o,t.set(i.input.subarray(i.next_in,i.next_in+o),e),i.state.wrap===1?i.adler=Va(i.adler,t,o,e):i.state.wrap===2&&(i.adler=Ue(i.adler,t,o,e)),i.next_in+=o,i.total_in+=o,o)},zf=(i,t)=>{let e=i.max_chain_length,n=i.strstart,o,d,h=i.prev_length,f=i.nice_match,L=i.strstart>i.w_size-On?i.strstart-(i.w_size-On):0,l=i.window,s=i.w_mask,x=i.prev,C=i.strstart+ti,g=l[n+h-1],$=l[n+h];i.prev_length>=i.good_match&&(e>>=2),f>i.lookahead&&(f=i.lookahead);do if(o=t,!(l[o+h]!==$||l[o+h-1]!==g||l[o]!==l[n]||l[++o]!==l[n+1])){n+=2,o++;do;while(l[++n]===l[++o]&&l[++n]===l[++o]&&l[++n]===l[++o]&&l[++n]===l[++o]&&l[++n]===l[++o]&&l[++n]===l[++o]&&l[++n]===l[++o]&&l[++n]===l[++o]&&n<C);if(d=ti-(C-n),n=C-ti,d>h){if(i.match_start=t,h=d,d>=f)break;g=l[n+h-1],$=l[n+h]}}while((t=x[t&s])>L&&--e!==0);return h<=i.lookahead?h:i.lookahead},Xi=i=>{let t=i.w_size,e,n,o;do{if(n=i.window_size-i.lookahead-i.strstart,i.strstart>=t+(t-On)&&(i.window.set(i.window.subarray(t,t+t-n),0),i.match_start-=t,i.strstart-=t,i.block_start-=t,i.insert>i.strstart&&(i.insert=i.strstart),HL(i),n+=t),i.strm.avail_in===0)break;if(e=Tr(i.strm,i.window,i.strstart+i.lookahead,n),i.lookahead+=e,i.lookahead+i.insert>=ue)for(o=i.strstart-i.insert,i.ins_h=i.window[o],i.ins_h=ii(i,i.ins_h,i.window[o+1]);i.insert&&(i.ins_h=ii(i,i.ins_h,i.window[o+ue-1]),i.prev[o&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=o,o++,i.insert--,!(i.lookahead+i.insert<ue)););}while(i.lookahead<On&&i.strm.avail_in!==0)},Mf=(i,t)=>{let e=i.pending_buf_size-5>i.w_size?i.w_size:i.pending_buf_size-5,n,o,d,h=0,f=i.strm.avail_in;do{if(n=65535,d=i.bi_valid+42>>3,i.strm.avail_out<d||(d=i.strm.avail_out-d,o=i.strstart-i.block_start,n>o+i.strm.avail_in&&(n=o+i.strm.avail_in),n>d&&(n=d),n<e&&(n===0&&t!==dn||t===ni||n!==o+i.strm.avail_in)))break;h=t===dn&&n===o+i.strm.avail_in?1:0,Rr(i,0,0,h),i.pending_buf[i.pending-4]=n,i.pending_buf[i.pending-3]=n>>8,i.pending_buf[i.pending-2]=~n,i.pending_buf[i.pending-1]=~n>>8,tn(i.strm),o&&(o>n&&(o=n),i.strm.output.set(i.window.subarray(i.block_start,i.block_start+o),i.strm.next_out),i.strm.next_out+=o,i.strm.avail_out-=o,i.strm.total_out+=o,i.block_start+=o,n-=o),n&&(Tr(i.strm,i.strm.output,i.strm.next_out,n),i.strm.next_out+=n,i.strm.avail_out-=n,i.strm.total_out+=n)}while(h===0);return f-=i.strm.avail_in,f&&(f>=i.w_size?(i.matches=2,i.window.set(i.strm.input.subarray(i.strm.next_in-i.w_size,i.strm.next_in),0),i.strstart=i.w_size,i.insert=i.strstart):(i.window_size-i.strstart<=f&&(i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,i.insert>i.strstart&&(i.insert=i.strstart)),i.window.set(i.strm.input.subarray(i.strm.next_in-f,i.strm.next_in),i.strstart),i.strstart+=f,i.insert+=f>i.w_size-i.insert?i.w_size-i.insert:f),i.block_start=i.strstart),i.high_water<i.strstart&&(i.high_water=i.strstart),h?ea:t!==ni&&t!==dn&&i.strm.avail_in===0&&i.strstart===i.block_start?ta:(d=i.window_size-i.strstart,i.strm.avail_in>d&&i.block_start>=i.w_size&&(i.block_start-=i.w_size,i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,d+=i.w_size,i.insert>i.strstart&&(i.insert=i.strstart)),d>i.strm.avail_in&&(d=i.strm.avail_in),d&&(Tr(i.strm,i.window,i.strstart,d),i.strstart+=d,i.insert+=d>i.w_size-i.insert?i.w_size-i.insert:d),i.high_water<i.strstart&&(i.high_water=i.strstart),d=i.bi_valid+42>>3,d=i.pending_buf_size-d>65535?65535:i.pending_buf_size-d,e=d>i.w_size?i.w_size:d,o=i.strstart-i.block_start,(o>=e||(o||t===dn)&&t!==ni&&i.strm.avail_in===0&&o<=d)&&(n=o>d?d:o,h=t===dn&&i.strm.avail_in===0&&n===o?1:0,Rr(i,i.block_start,n,h),i.block_start+=n,tn(i.strm)),h?yi:He)},Fr=(i,t)=>{let e,n;for(;;){if(i.lookahead<On){if(Xi(i),i.lookahead<On&&t===ni)return He;if(i.lookahead===0)break}if(e=0,i.lookahead>=ue&&(i.ins_h=ii(i,i.ins_h,i.window[i.strstart+ue-1]),e=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),e!==0&&i.strstart-e<=i.w_size-On&&(i.match_length=zf(i,e)),i.match_length>=ue)if(n=ei(i,i.strstart-i.match_start,i.match_length-ue),i.lookahead-=i.match_length,i.match_length<=i.max_lazy_match&&i.lookahead>=ue){i.match_length--;do i.strstart++,i.ins_h=ii(i,i.ins_h,i.window[i.strstart+ue-1]),e=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart;while(--i.match_length!==0);i.strstart++}else i.strstart+=i.match_length,i.match_length=0,i.ins_h=i.window[i.strstart],i.ins_h=ii(i,i.ins_h,i.window[i.strstart+1]);else n=ei(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++;if(n&&(en(i,!1),i.strm.avail_out===0))return He}return i.insert=i.strstart<ue-1?i.strstart:ue-1,t===dn?(en(i,!0),i.strm.avail_out===0?yi:ea):i.sym_next&&(en(i,!1),i.strm.avail_out===0)?He:ta},ji=(i,t)=>{let e,n,o;for(;;){if(i.lookahead<On){if(Xi(i),i.lookahead<On&&t===ni)return He;if(i.lookahead===0)break}if(e=0,i.lookahead>=ue&&(i.ins_h=ii(i,i.ins_h,i.window[i.strstart+ue-1]),e=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),i.prev_length=i.match_length,i.prev_match=i.match_start,i.match_length=ue-1,e!==0&&i.prev_length<i.max_lazy_match&&i.strstart-e<=i.w_size-On&&(i.match_length=zf(i,e),i.match_length<=5&&(i.strategy===vL||i.match_length===ue&&i.strstart-i.match_start>4096)&&(i.match_length=ue-1)),i.prev_length>=ue&&i.match_length<=i.prev_length){o=i.strstart+i.lookahead-ue,n=ei(i,i.strstart-1-i.prev_match,i.prev_length-ue),i.lookahead-=i.prev_length-1,i.prev_length-=2;do++i.strstart<=o&&(i.ins_h=ii(i,i.ins_h,i.window[i.strstart+ue-1]),e=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart);while(--i.prev_length!==0);if(i.match_available=0,i.match_length=ue-1,i.strstart++,n&&(en(i,!1),i.strm.avail_out===0))return He}else if(i.match_available){if(n=ei(i,0,i.window[i.strstart-1]),n&&en(i,!1),i.strstart++,i.lookahead--,i.strm.avail_out===0)return He}else i.match_available=1,i.strstart++,i.lookahead--}return i.match_available&&(n=ei(i,0,i.window[i.strstart-1]),i.match_available=0),i.insert=i.strstart<ue-1?i.strstart:ue-1,t===dn?(en(i,!0),i.strm.avail_out===0?yi:ea):i.sym_next&&(en(i,!1),i.strm.avail_out===0)?He:ta},KL=(i,t)=>{let e,n,o,d,h=i.window;for(;;){if(i.lookahead<=ti){if(Xi(i),i.lookahead<=ti&&t===ni)return He;if(i.lookahead===0)break}if(i.match_length=0,i.lookahead>=ue&&i.strstart>0&&(o=i.strstart-1,n=h[o],n===h[++o]&&n===h[++o]&&n===h[++o])){d=i.strstart+ti;do;while(n===h[++o]&&n===h[++o]&&n===h[++o]&&n===h[++o]&&n===h[++o]&&n===h[++o]&&n===h[++o]&&n===h[++o]&&o<d);i.match_length=ti-(d-o),i.match_length>i.lookahead&&(i.match_length=i.lookahead)}if(i.match_length>=ue?(e=ei(i,1,i.match_length-ue),i.lookahead-=i.match_length,i.strstart+=i.match_length,i.match_length=0):(e=ei(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++),e&&(en(i,!1),i.strm.avail_out===0))return He}return i.insert=0,t===dn?(en(i,!0),i.strm.avail_out===0?yi:ea):i.sym_next&&(en(i,!1),i.strm.avail_out===0)?He:ta},jL=(i,t)=>{let e;for(;;){if(i.lookahead===0&&(Xi(i),i.lookahead===0)){if(t===ni)return He;break}if(i.match_length=0,e=ei(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++,e&&(en(i,!1),i.strm.avail_out===0))return He}return i.insert=0,t===dn?(en(i,!0),i.strm.avail_out===0?yi:ea):i.sym_next&&(en(i,!1),i.strm.avail_out===0)?He:ta};function qn(i,t,e,n,o){this.good_length=i,this.max_lazy=t,this.nice_length=e,this.max_chain=n,this.func=o}var Na=[new qn(0,0,0,0,Mf),new qn(4,4,8,4,Fr),new qn(4,5,16,8,Fr),new qn(4,6,32,32,Fr),new qn(4,4,16,16,ji),new qn(8,16,32,32,ji),new qn(8,16,128,128,ji),new qn(8,32,128,256,ji),new qn(32,128,258,1024,ji),new qn(32,258,258,4096,ji)],VL=i=>{i.window_size=2*i.w_size,Jn(i.head),i.max_lazy_match=Na[i.level].max_lazy,i.good_match=Na[i.level].good_length,i.nice_match=Na[i.level].nice_length,i.max_chain_length=Na[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=ue-1,i.match_available=0,i.ins_h=0};function WL(){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=ts,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(NL*2),this.dyn_dtree=new Uint16Array((2*TL+1)*2),this.bl_tree=new Uint16Array((2*kL+1)*2),Jn(this.dyn_ltree),Jn(this.dyn_dtree),Jn(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(QL+1),this.heap=new Uint16Array(2*Or+1),Jn(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Or+1),Jn(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}var to=i=>{if(!i)return 1;let t=i.state;return!t||t.strm!==i||t.status!==Yi&&t.status!==Zr&&t.status!==Pr&&t.status!==zr&&t.status!==Mr&&t.status!==Gr&&t.status!==Li&&t.status!==ka?1:0},Gf=i=>{if(to(i))return mi(i,Rn);i.total_in=i.total_out=0,i.data_type=RL;let t=i.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?Zr:t.wrap?Yi:Li,i.adler=t.wrap===2?0:1,t.last_flush=-2,FL(t),Pe},Tf=i=>{let t=Gf(i);return t===Pe&&VL(i.state),t},YL=(i,t)=>to(i)||i.state.wrap!==2?Rn:(i.state.gzhead=t,Pe),kf=(i,t,e,n,o,d)=>{if(!i)return Rn;let h=1;if(t===BL&&(t=6),n<0?(h=0,n=-n):n>15&&(h=2,n-=16),o<1||o>OL||e!==ts||n<8||n>15||t<0||t>9||d<0||d>qL||n===8&&h!==1)return mi(i,Rn);n===8&&(n=9);let f=new WL;return i.state=f,f.strm=i,f.status=Yi,f.wrap=h,f.gzhead=null,f.w_bits=n,f.w_size=1<<f.w_bits,f.w_mask=f.w_size-1,f.hash_bits=o+7,f.hash_size=1<<f.hash_bits,f.hash_mask=f.hash_size-1,f.hash_shift=~~((f.hash_bits+ue-1)/ue),f.window=new Uint8Array(f.w_size*2),f.head=new Uint16Array(f.hash_size),f.prev=new Uint16Array(f.w_size),f.lit_bufsize=1<<o+6,f.pending_buf_size=f.lit_bufsize*4,f.pending_buf=new Uint8Array(f.pending_buf_size),f.sym_buf=f.lit_bufsize,f.sym_end=(f.lit_bufsize-1)*3,f.level=t,f.strategy=d,f.method=e,Tf(i)},XL=(i,t)=>kf(i,t,ts,PL,zL,UL),JL=(i,t)=>{if(to(i)||t>N2||t<0)return i?mi(i,Rn):Rn;let e=i.state;if(!i.output||i.avail_in!==0&&!i.input||e.status===ka&&t!==dn)return mi(i,i.avail_out===0?wr:Rn);let n=e.last_flush;if(e.last_flush=t,e.pending!==0){if(tn(i),i.avail_out===0)return e.last_flush=-1,Pe}else if(i.avail_in===0&&D2(t)<=D2(n)&&t!==dn)return mi(i,wr);if(e.status===ka&&i.avail_in!==0)return mi(i,wr);if(e.status===Yi&&e.wrap===0&&(e.status=Li),e.status===Yi){let o=ts+(e.w_bits-8<<4)<<8,d=-1;if(e.strategy>=Ho||e.level<2?d=0:e.level<6?d=1:e.level===6?d=2:d=3,o|=d<<6,e.strstart!==0&&(o|=DL),o+=31-o%31,Ta(e,o),e.strstart!==0&&(Ta(e,i.adler>>>16),Ta(e,i.adler&65535)),i.adler=1,e.status=Li,tn(i),e.pending!==0)return e.last_flush=-1,Pe}if(e.status===Zr){if(i.adler=0,he(e,31),he(e,139),he(e,8),e.gzhead)he(e,(e.gzhead.text?1:0)+(e.gzhead.hcrc?2:0)+(e.gzhead.extra?4:0)+(e.gzhead.name?8:0)+(e.gzhead.comment?16:0)),he(e,e.gzhead.time&255),he(e,e.gzhead.time>>8&255),he(e,e.gzhead.time>>16&255),he(e,e.gzhead.time>>24&255),he(e,e.level===9?2:e.strategy>=Ho||e.level<2?4:0),he(e,e.gzhead.os&255),e.gzhead.extra&&e.gzhead.extra.length&&(he(e,e.gzhead.extra.length&255),he(e,e.gzhead.extra.length>>8&255)),e.gzhead.hcrc&&(i.adler=Ue(i.adler,e.pending_buf,e.pending,0)),e.gzindex=0,e.status=Pr;else if(he(e,0),he(e,0),he(e,0),he(e,0),he(e,0),he(e,e.level===9?2:e.strategy>=Ho||e.level<2?4:0),he(e,ZL),e.status=Li,tn(i),e.pending!==0)return e.last_flush=-1,Pe}if(e.status===Pr){if(e.gzhead.extra){let o=e.pending,d=(e.gzhead.extra.length&65535)-e.gzindex;for(;e.pending+d>e.pending_buf_size;){let f=e.pending_buf_size-e.pending;if(e.pending_buf.set(e.gzhead.extra.subarray(e.gzindex,e.gzindex+f),e.pending),e.pending=e.pending_buf_size,e.gzhead.hcrc&&e.pending>o&&(i.adler=Ue(i.adler,e.pending_buf,e.pending-o,o)),e.gzindex+=f,tn(i),e.pending!==0)return e.last_flush=-1,Pe;o=0,d-=f}let h=new Uint8Array(e.gzhead.extra);e.pending_buf.set(h.subarray(e.gzindex,e.gzindex+d),e.pending),e.pending+=d,e.gzhead.hcrc&&e.pending>o&&(i.adler=Ue(i.adler,e.pending_buf,e.pending-o,o)),e.gzindex=0}e.status=zr}if(e.status===zr){if(e.gzhead.name){let o=e.pending,d;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>o&&(i.adler=Ue(i.adler,e.pending_buf,e.pending-o,o)),tn(i),e.pending!==0)return e.last_flush=-1,Pe;o=0}e.gzindex<e.gzhead.name.length?d=e.gzhead.name.charCodeAt(e.gzindex++)&255:d=0,he(e,d)}while(d!==0);e.gzhead.hcrc&&e.pending>o&&(i.adler=Ue(i.adler,e.pending_buf,e.pending-o,o)),e.gzindex=0}e.status=Mr}if(e.status===Mr){if(e.gzhead.comment){let o=e.pending,d;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>o&&(i.adler=Ue(i.adler,e.pending_buf,e.pending-o,o)),tn(i),e.pending!==0)return e.last_flush=-1,Pe;o=0}e.gzindex<e.gzhead.comment.length?d=e.gzhead.comment.charCodeAt(e.gzindex++)&255:d=0,he(e,d)}while(d!==0);e.gzhead.hcrc&&e.pending>o&&(i.adler=Ue(i.adler,e.pending_buf,e.pending-o,o))}e.status=Gr}if(e.status===Gr){if(e.gzhead.hcrc){if(e.pending+2>e.pending_buf_size&&(tn(i),e.pending!==0))return e.last_flush=-1,Pe;he(e,i.adler&255),he(e,i.adler>>8&255),i.adler=0}if(e.status=Li,tn(i),e.pending!==0)return e.last_flush=-1,Pe}if(i.avail_in!==0||e.lookahead!==0||t!==ni&&e.status!==ka){let o=e.level===0?Mf(e,t):e.strategy===Ho?jL(e,t):e.strategy===SL?KL(e,t):Na[e.level].func(e,t);if((o===yi||o===ea)&&(e.status=ka),o===He||o===yi)return i.avail_out===0&&(e.last_flush=-1),Pe;if(o===ta&&(t===xL?CL(e):t!==N2&&(Rr(e,0,0,!1),t===IL&&(Jn(e.head),e.lookahead===0&&(e.strstart=0,e.block_start=0,e.insert=0))),tn(i),i.avail_out===0))return e.last_flush=-1,Pe}return t!==dn?Pe:e.wrap<=0?Q2:(e.wrap===2?(he(e,i.adler&255),he(e,i.adler>>8&255),he(e,i.adler>>16&255),he(e,i.adler>>24&255),he(e,i.total_in&255),he(e,i.total_in>>8&255),he(e,i.total_in>>16&255),he(e,i.total_in>>24&255)):(Ta(e,i.adler>>>16),Ta(e,i.adler&65535)),tn(i),e.wrap>0&&(e.wrap=-e.wrap),e.pending!==0?Pe:Q2)},tm=i=>{if(to(i))return Rn;let t=i.state.status;return i.state=null,t===Li?mi(i,EL):Pe},em=(i,t)=>{let e=t.length;if(to(i))return Rn;let n=i.state,o=n.wrap;if(o===2||o===1&&n.status!==Yi||n.lookahead)return Rn;if(o===1&&(i.adler=Va(i.adler,t,e,0)),n.wrap=0,e>=n.w_size){o===0&&(Jn(n.head),n.strstart=0,n.block_start=0,n.insert=0);let L=new Uint8Array(n.w_size);L.set(t.subarray(e-n.w_size,e),0),t=L,e=n.w_size}let d=i.avail_in,h=i.next_in,f=i.input;for(i.avail_in=e,i.next_in=0,i.input=t,Xi(n);n.lookahead>=ue;){let L=n.strstart,l=n.lookahead-(ue-1);do n.ins_h=ii(n,n.ins_h,n.window[L+ue-1]),n.prev[L&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=L,L++;while(--l);n.strstart=L,n.lookahead=ue-1,Xi(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=ue-1,n.match_available=0,i.next_in=h,i.input=f,i.avail_in=d,n.wrap=o,Pe},nm=XL,im=kf,am=Tf,om=Gf,sm=YL,cm=JL,rm=tm,lm=em,dm=\"pako deflate (from Nodeca project)\",Da={deflateInit:nm,deflateInit2:im,deflateReset:am,deflateResetKeep:om,deflateSetHeader:sm,deflate:cm,deflateEnd:rm,deflateSetDictionary:lm,deflateInfo:dm},um=(i,t)=>Object.prototype.hasOwnProperty.call(i,t),fm=function(i){let t=Array.prototype.slice.call(arguments,1);for(;t.length;){let e=t.shift();if(e){if(typeof e!=\"object\")throw new TypeError(e+\"must be non-object\");for(let n in e)um(e,n)&&(i[n]=e[n])}}return i},_m=i=>{let t=0;for(let n=0,o=i.length;n<o;n++)t+=i[n].length;let e=new Uint8Array(t);for(let n=0,o=0,d=i.length;n<d;n++){let h=i[n];e.set(h,o),o+=h.length}return e},es={assign:fm,flattenChunks:_m},Nf=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Nf=!1}var Wa=new Uint8Array(256);for(let i=0;i<256;i++)Wa[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;Wa[254]=Wa[254]=1;var hm=i=>{if(typeof TextEncoder==\"function\"&&TextEncoder.prototype.encode)return new TextEncoder().encode(i);let t,e,n,o,d,h=i.length,f=0;for(o=0;o<h;o++)e=i.charCodeAt(o),(e&64512)===55296&&o+1<h&&(n=i.charCodeAt(o+1),(n&64512)===56320&&(e=65536+(e-55296<<10)+(n-56320),o++)),f+=e<128?1:e<2048?2:e<65536?3:4;for(t=new Uint8Array(f),d=0,o=0;d<f;o++)e=i.charCodeAt(o),(e&64512)===55296&&o+1<h&&(n=i.charCodeAt(o+1),(n&64512)===56320&&(e=65536+(e-55296<<10)+(n-56320),o++)),e<128?t[d++]=e:e<2048?(t[d++]=192|e>>>6,t[d++]=128|e&63):e<65536?(t[d++]=224|e>>>12,t[d++]=128|e>>>6&63,t[d++]=128|e&63):(t[d++]=240|e>>>18,t[d++]=128|e>>>12&63,t[d++]=128|e>>>6&63,t[d++]=128|e&63);return t},gm=(i,t)=>{if(t<65534&&i.subarray&&Nf)return String.fromCharCode.apply(null,i.length===t?i:i.subarray(0,t));let e=\"\";for(let n=0;n<t;n++)e+=String.fromCharCode(i[n]);return e},pm=(i,t)=>{let e=t||i.length;if(typeof TextDecoder==\"function\"&&TextDecoder.prototype.decode)return new TextDecoder().decode(i.subarray(0,t));let n,o,d=new Array(e*2);for(o=0,n=0;n<e;){let h=i[n++];if(h<128){d[o++]=h;continue}let f=Wa[h];if(f>4){d[o++]=65533,n+=f-1;continue}for(h&=f===2?31:f===3?15:7;f>1&&n<e;)h=h<<6|i[n++]&63,f--;if(f>1){d[o++]=65533;continue}h<65536?d[o++]=h:(h-=65536,d[o++]=55296|h>>10&1023,d[o++]=56320|h&1023)}return gm(d,o)},Lm=(i,t)=>{t=t||i.length,t>i.length&&(t=i.length);let e=t-1;for(;e>=0&&(i[e]&192)===128;)e--;return e<0||e===0?t:e+Wa[i[e]]>t?e:t},Ya={string2buf:hm,buf2string:pm,utf8border:Lm};function mm(){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 Qf=mm,Df=Object.prototype.toString,{Z_NO_FLUSH:bm,Z_SYNC_FLUSH:ym,Z_FULL_FLUSH:wm,Z_FINISH:Fm,Z_OK:Xo,Z_STREAM_END:Am,Z_DEFAULT_COMPRESSION:Cm,Z_DEFAULT_STRATEGY:xm,Z_DEFLATED:Im}=Fi;function eo(i){this.options=es.assign({level:Cm,method:Im,chunkSize:16384,windowBits:15,memLevel:8,strategy:xm},i||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg=\"\",this.ended=!1,this.chunks=[],this.strm=new Qf,this.strm.avail_out=0;let e=Da.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(e!==Xo)throw new Error(bi[e]);if(t.header&&Da.deflateSetHeader(this.strm,t.header),t.dictionary){let n;if(typeof t.dictionary==\"string\"?n=Ya.string2buf(t.dictionary):Df.call(t.dictionary)===\"[object ArrayBuffer]\"?n=new Uint8Array(t.dictionary):n=t.dictionary,e=Da.deflateSetDictionary(this.strm,n),e!==Xo)throw new Error(bi[e]);this._dict_set=!0}}eo.prototype.push=function(i,t){let e=this.strm,n=this.options.chunkSize,o,d;if(this.ended)return!1;for(t===~~t?d=t:d=t===!0?Fm:bm,typeof i==\"string\"?e.input=Ya.string2buf(i):Df.call(i)===\"[object ArrayBuffer]\"?e.input=new Uint8Array(i):e.input=i,e.next_in=0,e.avail_in=e.input.length;;){if(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),(d===ym||d===wm)&&e.avail_out<=6){this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;continue}if(o=Da.deflate(e,d),o===Am)return e.next_out>0&&this.onData(e.output.subarray(0,e.next_out)),o=Da.deflateEnd(this.strm),this.onEnd(o),this.ended=!0,o===Xo;if(e.avail_out===0){this.onData(e.output);continue}if(d>0&&e.next_out>0){this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;continue}if(e.avail_in===0)break}return!0};eo.prototype.onData=function(i){this.chunks.push(i)};eo.prototype.onEnd=function(i){i===Xo&&(this.result=es.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function Hr(i,t){let e=new eo(t);if(e.push(i,!0),e.err)throw e.msg||bi[e.err];return e.result}function Em(i,t){return t=t||{},t.raw=!0,Hr(i,t)}function Bm(i,t){return t=t||{},t.gzip=!0,Hr(i,t)}var vm=eo,Sm=Hr,qm=Em,Um=Bm,Rm=Fi,Om={Deflate:vm,deflate:Sm,deflateRaw:qm,gzip:Um,constants:Rm},$o=16209,Pm=16191,zm=function(t,e){let n,o,d,h,f,L,l,s,x,C,g,$,it,q,S,O,M,W,ct,E,_,r,Z,j,nt=t.state;n=t.next_in,Z=t.input,o=n+(t.avail_in-5),d=t.next_out,j=t.output,h=d-(e-t.avail_out),f=d+(t.avail_out-257),L=nt.dmax,l=nt.wsize,s=nt.whave,x=nt.wnext,C=nt.window,g=nt.hold,$=nt.bits,it=nt.lencode,q=nt.distcode,S=(1<<nt.lenbits)-1,O=(1<<nt.distbits)-1;t:do{$<15&&(g+=Z[n++]<<$,$+=8,g+=Z[n++]<<$,$+=8),M=it[g&S];e:for(;;){if(W=M>>>24,g>>>=W,$-=W,W=M>>>16&255,W===0)j[d++]=M&65535;else if(W&16){ct=M&65535,W&=15,W&&($<W&&(g+=Z[n++]<<$,$+=8),ct+=g&(1<<W)-1,g>>>=W,$-=W),$<15&&(g+=Z[n++]<<$,$+=8,g+=Z[n++]<<$,$+=8),M=q[g&O];n:for(;;){if(W=M>>>24,g>>>=W,$-=W,W=M>>>16&255,W&16){if(E=M&65535,W&=15,$<W&&(g+=Z[n++]<<$,$+=8,$<W&&(g+=Z[n++]<<$,$+=8)),E+=g&(1<<W)-1,E>L){t.msg=\"invalid distance too far back\",nt.mode=$o;break t}if(g>>>=W,$-=W,W=d-h,E>W){if(W=E-W,W>s&&nt.sane){t.msg=\"invalid distance too far back\",nt.mode=$o;break t}if(_=0,r=C,x===0){if(_+=l-W,W<ct){ct-=W;do j[d++]=C[_++];while(--W);_=d-E,r=j}}else if(x<W){if(_+=l+x-W,W-=x,W<ct){ct-=W;do j[d++]=C[_++];while(--W);if(_=0,x<ct){W=x,ct-=W;do j[d++]=C[_++];while(--W);_=d-E,r=j}}}else if(_+=x-W,W<ct){ct-=W;do j[d++]=C[_++];while(--W);_=d-E,r=j}for(;ct>2;)j[d++]=r[_++],j[d++]=r[_++],j[d++]=r[_++],ct-=3;ct&&(j[d++]=r[_++],ct>1&&(j[d++]=r[_++]))}else{_=d-E;do j[d++]=j[_++],j[d++]=j[_++],j[d++]=j[_++],ct-=3;while(ct>2);ct&&(j[d++]=j[_++],ct>1&&(j[d++]=j[_++]))}}else if(W&64){t.msg=\"invalid distance code\",nt.mode=$o;break t}else{M=q[(M&65535)+(g&(1<<W)-1)];continue n}break}}else if(W&64)if(W&32){nt.mode=Pm;break t}else{t.msg=\"invalid literal/length code\",nt.mode=$o;break t}else{M=it[(M&65535)+(g&(1<<W)-1)];continue e}break}}while(n<o&&d<f);ct=$>>3,n-=ct,$-=ct<<3,g&=(1<<$)-1,t.next_in=n,t.next_out=d,t.avail_in=n<o?5+(o-n):5-(n-o),t.avail_out=d<f?257+(f-d):257-(d-f),nt.hold=g,nt.bits=$},Vi=15,Z2=852,H2=592,$2=0,Ar=1,K2=2,Mm=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]),Gm=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]),Tm=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]),km=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]),Nm=(i,t,e,n,o,d,h,f)=>{let L=f.bits,l=0,s=0,x=0,C=0,g=0,$=0,it=0,q=0,S=0,O=0,M,W,ct,E,_,r=null,Z,j=new Uint16Array(Vi+1),nt=new Uint16Array(Vi+1),v=null,y,T,V;for(l=0;l<=Vi;l++)j[l]=0;for(s=0;s<n;s++)j[t[e+s]]++;for(g=L,C=Vi;C>=1&&j[C]===0;C--);if(g>C&&(g=C),C===0)return o[d++]=1<<24|64<<16|0,o[d++]=1<<24|64<<16|0,f.bits=1,0;for(x=1;x<C&&j[x]===0;x++);for(g<x&&(g=x),q=1,l=1;l<=Vi;l++)if(q<<=1,q-=j[l],q<0)return-1;if(q>0&&(i===$2||C!==1))return-1;for(nt[1]=0,l=1;l<Vi;l++)nt[l+1]=nt[l]+j[l];for(s=0;s<n;s++)t[e+s]!==0&&(h[nt[t[e+s]]++]=s);if(i===$2?(r=v=h,Z=20):i===Ar?(r=Mm,v=Gm,Z=257):(r=Tm,v=km,Z=0),O=0,s=0,l=x,_=d,$=g,it=0,ct=-1,S=1<<g,E=S-1,i===Ar&&S>Z2||i===K2&&S>H2)return 1;for(;;){y=l-it,h[s]+1<Z?(T=0,V=h[s]):h[s]>=Z?(T=v[h[s]-Z],V=r[h[s]-Z]):(T=96,V=0),M=1<<l-it,W=1<<$,x=W;do W-=M,o[_+(O>>it)+W]=y<<24|T<<16|V|0;while(W!==0);for(M=1<<l-1;O&M;)M>>=1;if(M!==0?(O&=M-1,O+=M):O=0,s++,--j[l]===0){if(l===C)break;l=t[e+h[s]]}if(l>g&&(O&E)!==ct){for(it===0&&(it=g),_+=x,$=l-it,q=1<<$;$+it<C&&(q-=j[$+it],!(q<=0));)$++,q<<=1;if(S+=1<<$,i===Ar&&S>Z2||i===K2&&S>H2)return 1;ct=O&E,o[ct]=g<<24|$<<16|_-d|0}}return O!==0&&(o[_+O]=l-it<<24|64<<16|0),f.bits=g,0},Za=Nm,Qm=0,Zf=1,Hf=2,{Z_FINISH:j2,Z_BLOCK:Dm,Z_TREES:Ko,Z_OK:wi,Z_STREAM_END:Zm,Z_NEED_DICT:Hm,Z_STREAM_ERROR:un,Z_DATA_ERROR:$f,Z_MEM_ERROR:Kf,Z_BUF_ERROR:$m,Z_DEFLATED:V2}=Fi,ns=16180,W2=16181,Y2=16182,X2=16183,J2=16184,tf=16185,ef=16186,nf=16187,af=16188,of=16189,Jo=16190,Zn=16191,Cr=16192,sf=16193,xr=16194,cf=16195,rf=16196,lf=16197,df=16198,jo=16199,Vo=16200,uf=16201,ff=16202,_f=16203,hf=16204,gf=16205,Ir=16206,pf=16207,Lf=16208,we=16209,jf=16210,Vf=16211,Km=852,jm=592,Vm=15,Wm=Vm,mf=i=>(i>>>24&255)+(i>>>8&65280)+((i&65280)<<8)+((i&255)<<24);function Ym(){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}var Ai=i=>{if(!i)return 1;let t=i.state;return!t||t.strm!==i||t.mode<ns||t.mode>Vf?1:0},Wf=i=>{if(Ai(i))return un;let t=i.state;return i.total_in=i.total_out=t.total=0,i.msg=\"\",t.wrap&&(i.adler=t.wrap&1),t.mode=ns,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(Km),t.distcode=t.distdyn=new Int32Array(jm),t.sane=1,t.back=-1,wi},Yf=i=>{if(Ai(i))return un;let t=i.state;return t.wsize=0,t.whave=0,t.wnext=0,Wf(i)},Xf=(i,t)=>{let e;if(Ai(i))return un;let n=i.state;return t<0?(e=0,t=-t):(e=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?un:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=e,n.wbits=t,Yf(i))},Jf=(i,t)=>{if(!i)return un;let e=new Ym;i.state=e,e.strm=i,e.window=null,e.mode=ns;let n=Xf(i,t);return n!==wi&&(i.state=null),n},Xm=i=>Jf(i,Wm),bf=!0,Er,Br,Jm=i=>{if(bf){Er=new Int32Array(512),Br=new Int32Array(32);let t=0;for(;t<144;)i.lens[t++]=8;for(;t<256;)i.lens[t++]=9;for(;t<280;)i.lens[t++]=7;for(;t<288;)i.lens[t++]=8;for(Za(Zf,i.lens,0,288,Er,0,i.work,{bits:9}),t=0;t<32;)i.lens[t++]=5;Za(Hf,i.lens,0,32,Br,0,i.work,{bits:5}),bf=!1}i.lencode=Er,i.lenbits=9,i.distcode=Br,i.distbits=5},t_=(i,t,e,n)=>{let o,d=i.state;return d.window===null&&(d.wsize=1<<d.wbits,d.wnext=0,d.whave=0,d.window=new Uint8Array(d.wsize)),n>=d.wsize?(d.window.set(t.subarray(e-d.wsize,e),0),d.wnext=0,d.whave=d.wsize):(o=d.wsize-d.wnext,o>n&&(o=n),d.window.set(t.subarray(e-n,e-n+o),d.wnext),n-=o,n?(d.window.set(t.subarray(e-n,e),0),d.wnext=n,d.whave=d.wsize):(d.wnext+=o,d.wnext===d.wsize&&(d.wnext=0),d.whave<d.wsize&&(d.whave+=o))),0},tb=(i,t)=>{let e,n,o,d,h,f,L,l,s,x,C,g,$,it,q=0,S,O,M,W,ct,E,_,r,Z=new Uint8Array(4),j,nt,v=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ai(i)||!i.output||!i.input&&i.avail_in!==0)return un;e=i.state,e.mode===Zn&&(e.mode=Cr),h=i.next_out,o=i.output,L=i.avail_out,d=i.next_in,n=i.input,f=i.avail_in,l=e.hold,s=e.bits,x=f,C=L,r=wi;t:for(;;)switch(e.mode){case ns:if(e.wrap===0){e.mode=Cr;break}for(;s<16;){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}if(e.wrap&2&&l===35615){e.wbits===0&&(e.wbits=15),e.check=0,Z[0]=l&255,Z[1]=l>>>8&255,e.check=Ue(e.check,Z,2,0),l=0,s=0,e.mode=W2;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((l&255)<<8)+(l>>8))%31){i.msg=\"incorrect header check\",e.mode=we;break}if((l&15)!==V2){i.msg=\"unknown compression method\",e.mode=we;break}if(l>>>=4,s-=4,_=(l&15)+8,e.wbits===0&&(e.wbits=_),_>15||_>e.wbits){i.msg=\"invalid window size\",e.mode=we;break}e.dmax=1<<e.wbits,e.flags=0,i.adler=e.check=1,e.mode=l&512?of:Zn,l=0,s=0;break;case W2:for(;s<16;){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}if(e.flags=l,(e.flags&255)!==V2){i.msg=\"unknown compression method\",e.mode=we;break}if(e.flags&57344){i.msg=\"unknown header flags set\",e.mode=we;break}e.head&&(e.head.text=l>>8&1),e.flags&512&&e.wrap&4&&(Z[0]=l&255,Z[1]=l>>>8&255,e.check=Ue(e.check,Z,2,0)),l=0,s=0,e.mode=Y2;case Y2:for(;s<32;){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}e.head&&(e.head.time=l),e.flags&512&&e.wrap&4&&(Z[0]=l&255,Z[1]=l>>>8&255,Z[2]=l>>>16&255,Z[3]=l>>>24&255,e.check=Ue(e.check,Z,4,0)),l=0,s=0,e.mode=X2;case X2:for(;s<16;){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}e.head&&(e.head.xflags=l&255,e.head.os=l>>8),e.flags&512&&e.wrap&4&&(Z[0]=l&255,Z[1]=l>>>8&255,e.check=Ue(e.check,Z,2,0)),l=0,s=0,e.mode=J2;case J2:if(e.flags&1024){for(;s<16;){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}e.length=l,e.head&&(e.head.extra_len=l),e.flags&512&&e.wrap&4&&(Z[0]=l&255,Z[1]=l>>>8&255,e.check=Ue(e.check,Z,2,0)),l=0,s=0}else e.head&&(e.head.extra=null);e.mode=tf;case tf:if(e.flags&1024&&(g=e.length,g>f&&(g=f),g&&(e.head&&(_=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(n.subarray(d,d+g),_)),e.flags&512&&e.wrap&4&&(e.check=Ue(e.check,n,g,d)),f-=g,d+=g,e.length-=g),e.length))break t;e.length=0,e.mode=ef;case ef:if(e.flags&2048){if(f===0)break t;g=0;do _=n[d+g++],e.head&&_&&e.length<65536&&(e.head.name+=String.fromCharCode(_));while(_&&g<f);if(e.flags&512&&e.wrap&4&&(e.check=Ue(e.check,n,g,d)),f-=g,d+=g,_)break t}else e.head&&(e.head.name=null);e.length=0,e.mode=nf;case nf:if(e.flags&4096){if(f===0)break t;g=0;do _=n[d+g++],e.head&&_&&e.length<65536&&(e.head.comment+=String.fromCharCode(_));while(_&&g<f);if(e.flags&512&&e.wrap&4&&(e.check=Ue(e.check,n,g,d)),f-=g,d+=g,_)break t}else e.head&&(e.head.comment=null);e.mode=af;case af:if(e.flags&512){for(;s<16;){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}if(e.wrap&4&&l!==(e.check&65535)){i.msg=\"header crc mismatch\",e.mode=we;break}l=0,s=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),i.adler=e.check=0,e.mode=Zn;break;case of:for(;s<32;){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}i.adler=e.check=mf(l),l=0,s=0,e.mode=Jo;case Jo:if(e.havedict===0)return i.next_out=h,i.avail_out=L,i.next_in=d,i.avail_in=f,e.hold=l,e.bits=s,Hm;i.adler=e.check=1,e.mode=Zn;case Zn:if(t===Dm||t===Ko)break t;case Cr:if(e.last){l>>>=s&7,s-=s&7,e.mode=Ir;break}for(;s<3;){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}switch(e.last=l&1,l>>>=1,s-=1,l&3){case 0:e.mode=sf;break;case 1:if(Jm(e),e.mode=jo,t===Ko){l>>>=2,s-=2;break t}break;case 2:e.mode=rf;break;case 3:i.msg=\"invalid block type\",e.mode=we}l>>>=2,s-=2;break;case sf:for(l>>>=s&7,s-=s&7;s<32;){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}if((l&65535)!==(l>>>16^65535)){i.msg=\"invalid stored block lengths\",e.mode=we;break}if(e.length=l&65535,l=0,s=0,e.mode=xr,t===Ko)break t;case xr:e.mode=cf;case cf:if(g=e.length,g){if(g>f&&(g=f),g>L&&(g=L),g===0)break t;o.set(n.subarray(d,d+g),h),f-=g,d+=g,L-=g,h+=g,e.length-=g;break}e.mode=Zn;break;case rf:for(;s<14;){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}if(e.nlen=(l&31)+257,l>>>=5,s-=5,e.ndist=(l&31)+1,l>>>=5,s-=5,e.ncode=(l&15)+4,l>>>=4,s-=4,e.nlen>286||e.ndist>30){i.msg=\"too many length or distance symbols\",e.mode=we;break}e.have=0,e.mode=lf;case lf:for(;e.have<e.ncode;){for(;s<3;){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}e.lens[v[e.have++]]=l&7,l>>>=3,s-=3}for(;e.have<19;)e.lens[v[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,j={bits:e.lenbits},r=Za(Qm,e.lens,0,19,e.lencode,0,e.work,j),e.lenbits=j.bits,r){i.msg=\"invalid code lengths set\",e.mode=we;break}e.have=0,e.mode=df;case df:for(;e.have<e.nlen+e.ndist;){for(;q=e.lencode[l&(1<<e.lenbits)-1],S=q>>>24,O=q>>>16&255,M=q&65535,!(S<=s);){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}if(M<16)l>>>=S,s-=S,e.lens[e.have++]=M;else{if(M===16){for(nt=S+2;s<nt;){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}if(l>>>=S,s-=S,e.have===0){i.msg=\"invalid bit length repeat\",e.mode=we;break}_=e.lens[e.have-1],g=3+(l&3),l>>>=2,s-=2}else if(M===17){for(nt=S+3;s<nt;){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}l>>>=S,s-=S,_=0,g=3+(l&7),l>>>=3,s-=3}else{for(nt=S+7;s<nt;){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}l>>>=S,s-=S,_=0,g=11+(l&127),l>>>=7,s-=7}if(e.have+g>e.nlen+e.ndist){i.msg=\"invalid bit length repeat\",e.mode=we;break}for(;g--;)e.lens[e.have++]=_}}if(e.mode===we)break;if(e.lens[256]===0){i.msg=\"invalid code -- missing end-of-block\",e.mode=we;break}if(e.lenbits=9,j={bits:e.lenbits},r=Za(Zf,e.lens,0,e.nlen,e.lencode,0,e.work,j),e.lenbits=j.bits,r){i.msg=\"invalid literal/lengths set\",e.mode=we;break}if(e.distbits=6,e.distcode=e.distdyn,j={bits:e.distbits},r=Za(Hf,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,j),e.distbits=j.bits,r){i.msg=\"invalid distances set\",e.mode=we;break}if(e.mode=jo,t===Ko)break t;case jo:e.mode=Vo;case Vo:if(f>=6&&L>=258){i.next_out=h,i.avail_out=L,i.next_in=d,i.avail_in=f,e.hold=l,e.bits=s,zm(i,C),h=i.next_out,o=i.output,L=i.avail_out,d=i.next_in,n=i.input,f=i.avail_in,l=e.hold,s=e.bits,e.mode===Zn&&(e.back=-1);break}for(e.back=0;q=e.lencode[l&(1<<e.lenbits)-1],S=q>>>24,O=q>>>16&255,M=q&65535,!(S<=s);){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}if(O&&!(O&240)){for(W=S,ct=O,E=M;q=e.lencode[E+((l&(1<<W+ct)-1)>>W)],S=q>>>24,O=q>>>16&255,M=q&65535,!(W+S<=s);){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}l>>>=W,s-=W,e.back+=W}if(l>>>=S,s-=S,e.back+=S,e.length=M,O===0){e.mode=gf;break}if(O&32){e.back=-1,e.mode=Zn;break}if(O&64){i.msg=\"invalid literal/length code\",e.mode=we;break}e.extra=O&15,e.mode=uf;case uf:if(e.extra){for(nt=e.extra;s<nt;){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}e.length+=l&(1<<e.extra)-1,l>>>=e.extra,s-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=ff;case ff:for(;q=e.distcode[l&(1<<e.distbits)-1],S=q>>>24,O=q>>>16&255,M=q&65535,!(S<=s);){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}if(!(O&240)){for(W=S,ct=O,E=M;q=e.distcode[E+((l&(1<<W+ct)-1)>>W)],S=q>>>24,O=q>>>16&255,M=q&65535,!(W+S<=s);){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}l>>>=W,s-=W,e.back+=W}if(l>>>=S,s-=S,e.back+=S,O&64){i.msg=\"invalid distance code\",e.mode=we;break}e.offset=M,e.extra=O&15,e.mode=_f;case _f:if(e.extra){for(nt=e.extra;s<nt;){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}e.offset+=l&(1<<e.extra)-1,l>>>=e.extra,s-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){i.msg=\"invalid distance too far back\",e.mode=we;break}e.mode=hf;case hf:if(L===0)break t;if(g=C-L,e.offset>g){if(g=e.offset-g,g>e.whave&&e.sane){i.msg=\"invalid distance too far back\",e.mode=we;break}g>e.wnext?(g-=e.wnext,$=e.wsize-g):$=e.wnext-g,g>e.length&&(g=e.length),it=e.window}else it=o,$=h-e.offset,g=e.length;g>L&&(g=L),L-=g,e.length-=g;do o[h++]=it[$++];while(--g);e.length===0&&(e.mode=Vo);break;case gf:if(L===0)break t;o[h++]=e.length,L--,e.mode=Vo;break;case Ir:if(e.wrap){for(;s<32;){if(f===0)break t;f--,l|=n[d++]<<s,s+=8}if(C-=L,i.total_out+=C,e.total+=C,e.wrap&4&&C&&(i.adler=e.check=e.flags?Ue(e.check,o,C,h-C):Va(e.check,o,C,h-C)),C=L,e.wrap&4&&(e.flags?l:mf(l))!==e.check){i.msg=\"incorrect data check\",e.mode=we;break}l=0,s=0}e.mode=pf;case pf:if(e.wrap&&e.flags){for(;s<32;){if(f===0)break t;f--,l+=n[d++]<<s,s+=8}if(e.wrap&4&&l!==(e.total&4294967295)){i.msg=\"incorrect length check\",e.mode=we;break}l=0,s=0}e.mode=Lf;case Lf:r=Zm;break t;case we:r=$f;break t;case jf:return Kf;case Vf:default:return un}return i.next_out=h,i.avail_out=L,i.next_in=d,i.avail_in=f,e.hold=l,e.bits=s,(e.wsize||C!==i.avail_out&&e.mode<we&&(e.mode<Ir||t!==j2))&&t_(i,i.output,i.next_out,C-i.avail_out),x-=i.avail_in,C-=i.avail_out,i.total_in+=x,i.total_out+=C,e.total+=C,e.wrap&4&&C&&(i.adler=e.check=e.flags?Ue(e.check,o,C,i.next_out-C):Va(e.check,o,C,i.next_out-C)),i.data_type=e.bits+(e.last?64:0)+(e.mode===Zn?128:0)+(e.mode===jo||e.mode===xr?256:0),(x===0&&C===0||t===j2)&&r===wi&&(r=$m),r},eb=i=>{if(Ai(i))return un;let t=i.state;return t.window&&(t.window=null),i.state=null,wi},nb=(i,t)=>{if(Ai(i))return un;let e=i.state;return e.wrap&2?(e.head=t,t.done=!1,wi):un},ib=(i,t)=>{let e=t.length,n,o,d;return Ai(i)||(n=i.state,n.wrap!==0&&n.mode!==Jo)?un:n.mode===Jo&&(o=1,o=Va(o,t,e,0),o!==n.check)?$f:(d=t_(i,t,e,e),d?(n.mode=jf,Kf):(n.havedict=1,wi))},ab=Yf,ob=Xf,sb=Wf,cb=Xm,rb=Jf,lb=tb,db=eb,ub=nb,fb=ib,_b=\"pako inflate (from Nodeca project)\",$n={inflateReset:ab,inflateReset2:ob,inflateResetKeep:sb,inflateInit:cb,inflateInit2:rb,inflate:lb,inflateEnd:db,inflateGetHeader:ub,inflateSetDictionary:fb,inflateInfo:_b};function hb(){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 gb=hb,e_=Object.prototype.toString,{Z_NO_FLUSH:pb,Z_FINISH:Lb,Z_OK:Xa,Z_STREAM_END:vr,Z_NEED_DICT:Sr,Z_STREAM_ERROR:mb,Z_DATA_ERROR:yf,Z_MEM_ERROR:bb}=Fi;function no(i){this.options=es.assign({chunkSize:1024*64,windowBits:15,to:\"\"},i||{});let t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(i&&i.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg=\"\",this.ended=!1,this.chunks=[],this.strm=new Qf,this.strm.avail_out=0;let e=$n.inflateInit2(this.strm,t.windowBits);if(e!==Xa)throw new Error(bi[e]);if(this.header=new gb,$n.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary==\"string\"?t.dictionary=Ya.string2buf(t.dictionary):e_.call(t.dictionary)===\"[object ArrayBuffer]\"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=$n.inflateSetDictionary(this.strm,t.dictionary),e!==Xa)))throw new Error(bi[e])}no.prototype.push=function(i,t){let e=this.strm,n=this.options.chunkSize,o=this.options.dictionary,d,h,f;if(this.ended)return!1;for(t===~~t?h=t:h=t===!0?Lb:pb,e_.call(i)===\"[object ArrayBuffer]\"?e.input=new Uint8Array(i):e.input=i,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),d=$n.inflate(e,h),d===Sr&&o&&(d=$n.inflateSetDictionary(e,o),d===Xa?d=$n.inflate(e,h):d===yf&&(d=Sr));e.avail_in>0&&d===vr&&e.state.wrap>0&&i[e.next_in]!==0;)$n.inflateReset(e),d=$n.inflate(e,h);switch(d){case mb:case yf:case Sr:case bb:return this.onEnd(d),this.ended=!0,!1}if(f=e.avail_out,e.next_out&&(e.avail_out===0||d===vr))if(this.options.to===\"string\"){let L=Ya.utf8border(e.output,e.next_out),l=e.next_out-L,s=Ya.buf2string(e.output,L);e.next_out=l,e.avail_out=n-l,l&&e.output.set(e.output.subarray(L,L+l),0),this.onData(s)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(!(d===Xa&&f===0)){if(d===vr)return d=$n.inflateEnd(this.strm),this.onEnd(d),this.ended=!0,!0;if(e.avail_in===0)break}}return!0};no.prototype.onData=function(i){this.chunks.push(i)};no.prototype.onEnd=function(i){i===Xa&&(this.options.to===\"string\"?this.result=this.chunks.join(\"\"):this.result=es.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function $r(i,t){let e=new no(t);if(e.push(i),e.err)throw e.msg||bi[e.err];return e.result}function yb(i,t){return t=t||{},t.raw=!0,$r(i,t)}var wb=no,Fb=$r,Ab=yb,Cb=$r,xb=Fi,Ib={Inflate:wb,inflate:Fb,inflateRaw:Ab,ungzip:Cb,constants:xb},{Deflate:Eb,deflate:Bb,deflateRaw:vb,gzip:Sb}=Om,{Inflate:qb,inflate:Ub,inflateRaw:Rb,ungzip:Ob}=Ib,Pb=Eb,zb=Bb,Mb=vb,Gb=Sb,Tb=qb,kb=Ub,Nb=Rb,Qb=Ob,Db=Fi,n_={Deflate:Pb,deflate:zb,deflateRaw:Mb,gzip:Gb,Inflate:Tb,inflate:kb,inflateRaw:Nb,ungzip:Qb,constants:Db};var i_=\"circuit\";async function Zb(i,t){for(let e=1;e<=t;e++){console.log(`download attempt ${e} for ${i}`);let n=await fetch(i,{method:\"GET\"});if(n.status===200)return n}throw new Error(`Error downloading ${i} after ${t} retries`)}var Hb=async i=>n_.ungzip(i).buffer;async function $b(i,t,e=!1){let o=await(await Zb(i,3)).arrayBuffer();if(!e)await is.default.setItem(t,o);else{let d=await Hb(o);await is.default.setItem(t,d),console.log(\"stored file in localforage\",t)}console.log(`Storage of ${t} successful!`)}self.onmessage=async function(i){let{chunkedZkeyUrls:t,inputs:e,wasmUrl:n}=i.data;self.postMessage({type:\"message\",message:\"Worker started\"}),await Promise.all(t.map(async({suffix:o,url:d})=>{await $b(d,`${i_}.zkey${o}`,!0)})),self.postMessage({type:\"message\",message:\"Download complete\"});try{let{proof:o,publicSignals:d}=await To.fullProve(JSON.parse(e),n,`${i_}.zkey`);await is.default.clear(),self.postMessage({type:\"result\",message:o}),self.close()}catch(o){self.postMessage({type:\"error\",error:o.message}),self.close()}};export{$b as downloadFromUrl,Hb as uncompressGz};\n/*! Bundled license information:\n\nlocalforage/dist/localforage.js:\n (*!\n localForage -- Offline Storage, Improved\n Version 1.10.0\n https://localforage.github.io/localForage\n (c) 2013-2017 Mozilla, Apache License 2.0\n *)\n\nejs/lib/ejs.js:\n (**\n * @file Embedded JavaScript templating engine. {@link http://ejs.co}\n * @author Matthew Eernisse <mde@fleegix.org>\n * @author Tiancheng \"Timothy\" Gu <timothygu99@gmail.com>\n * @project EJS\n * @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0}\n *)\n\njs-sha3/src/sha3.js:\n (**\n * [js-sha3]{@link https://github.com/emn178/js-sha3}\n *\n * @version 0.8.0\n * @author Chen, Yi-Cyuan [emn178@gmail.com]\n * @copyright Chen, Yi-Cyuan 2015-2018\n * @license MIT\n *)\n\npako/dist/pako.esm.mjs:\n (*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) *)\n*/\n";
|