@converse/headless
Version:
Converse.js Headless build
19 lines • 102 kB
JavaScript
function qt(n){return typeof n=="number"&&n%1===0&&n>=0}function ut(n){if(typeof n=="string")return n;const t=new Uint8Array(n);let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e}function ct(n){if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return n;if(n instanceof ArrayBuffer||n instanceof Uint8Array)return F.toString(n);if(Array.isArray(n))return n.map(ct);if(n===Object(n)){const t={};for(const e in n){if(!Object.prototype.hasOwnProperty.call(n,e))continue;const r=n[e];if(r!==void 0)try{t[e]=ct(r)}catch(i){throw console.log("Error serializing key",e),i}}return t}else{if(n===null)return null;throw new Error(`unsure of how to jsonify object of type ${typeof n}`)}}function Dr(n){return JSON.stringify(ct(n))}function ie(n){const t=new ArrayBuffer(n.length),e=new Uint8Array(t);for(let r=0;r<n.length;r++)e[r]=n.charCodeAt(r)&255;return t}function qr(n){if(n!==void 0){if(n instanceof ArrayBuffer)return n;if(n instanceof Uint8Array)return n.buffer;if(typeof n!="string")throw new Error(`Tried to convert a non-string of type ${typeof n} to an array buffer`);return ie(n)}}function Wr(n,t){if(n instanceof ArrayBuffer)return new Uint8Array(n);if(n instanceof Uint8Array)return n;if(typeof n!="string")throw new Error("Expected string or buffer");switch(t){case"binary":{const e=new Uint8Array(n.length);for(let r=0;r<n.length;r++)e[r]=n.charCodeAt(r);return e}case"base64":{const e=atob(n),r=new Uint8Array(e.length);for(let i=0;i<e.length;i++)r[i]=e.charCodeAt(i);return r}case"hex":{const e=n.length/2,r=new Uint8Array(e);for(let i=0;i<e;i++)r[i]=parseInt(n.substring(i*2,i*2+2),16);return r}case"utf8":case"utf-8":return new TextEncoder().encode(n);default:throw new Error(`Unsupported encoding: ${t}`)}}function Fr(n,t){if(n===void 0||t===void 0)return!1;const e=ut(n),r=ut(t);if(Math.max(e.length,r.length)<5)throw new Error("a/b compare too short");if(e.length!==r.length)return!1;let i=0;for(let o=0;o<e.length;o++)i|=e.charCodeAt(o)^r.charCodeAt(o);return i===0}const F={toString:ut,toArrayBuffer:qr,normalizeBuffer:Wr,isEqual:Fr};function p(n,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!r:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(n):r?r.value:t.get(n)}function ce(n,t,e,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(n,e):i?i.value=e:t.set(n,e),e}typeof SuppressedError=="function"&&SuppressedError;var jr=(()=>{var n=import.meta.url;return(function(t){t=t||{};var e=typeof t<"u"?t:{},r,i;e.ready=new Promise(function(K,S){r=K,i=S});var o=Object.assign({},e),s=typeof window=="object",u=typeof importScripts=="function",a=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",h="";function y(K){return e.locateFile?e.locateFile(K,h):h+K}var c,l,g,d,_,O;a?(u?h=require("path").dirname(h)+"/":h=typeof document<"u"&&document.currentScript?document.currentScript.src.substring(0,document.currentScript.src.lastIndexOf("/")+1):"",O=()=>{_||(d=require("fs"),_=require("path"))},c=function(K,S){return O(),K=_.normalize(K),d.readFileSync(K,S?void 0:"utf8")},g=K=>{var S=c(K,!0);return S.buffer||(S=new Uint8Array(S)),S},l=(K,S,J)=>{O(),K=_.normalize(K),d.readFile(K,function(te,st){te?J(te):S(st.buffer)})},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(K){if(!(K instanceof $r))throw K}),process.on("unhandledRejection",function(K){throw K}),e.inspect=function(){return"[Emscripten Module object]"}):(s||u)&&(u?h=self.location.href:typeof document<"u"&&document.currentScript&&(h=document.currentScript.src),n&&(h=n),h.indexOf("blob:")!==0?h=h.substr(0,h.replace(/[?#].*/,"").lastIndexOf("/")+1):h="",c=K=>{var S=new XMLHttpRequest;return S.open("GET",K,!1),S.send(null),S.responseText},u&&(g=K=>{var S=new XMLHttpRequest;return S.open("GET",K,!1),S.responseType="arraybuffer",S.send(null),new Uint8Array(S.response)}),l=(K,S,J)=>{var te=new XMLHttpRequest;te.open("GET",K,!0),te.responseType="arraybuffer",te.onload=()=>{if(te.status==200||te.status==0&&te.response){S(te.response);return}J()},te.onerror=J,te.send(null)}),e.print||console.log.bind(console);var v=e.printErr||console.warn.bind(console);Object.assign(e,o),o=null,e.arguments&&e.arguments,e.thisProgram&&e.thisProgram,e.quit&&e.quit;var m;e.wasmBinary&&(m=e.wasmBinary),e.noExitRuntime,typeof WebAssembly!="object"&&G("no native wasm support detected");var k,M=!1;typeof TextDecoder<"u"&&new TextDecoder("utf8"),typeof TextDecoder<"u"&&new TextDecoder("utf-16le");var T;function ue(K){e.HEAP8=new Int8Array(K),e.HEAP16=new Int16Array(K),e.HEAP32=new Int32Array(K),e.HEAPU8=T=new Uint8Array(K),e.HEAPU16=new Uint16Array(K),e.HEAPU32=new Uint32Array(K),e.HEAPF32=new Float32Array(K),e.HEAPF64=new Float64Array(K)}e.INITIAL_MEMORY;var de,$e=[],xe=[],Ne=[];function Ze(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)w(e.preRun.shift());it($e)}function Y(){it(xe)}function b(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)E(e.postRun.shift());it(Ne)}function w(K){$e.unshift(K)}function f(K){xe.unshift(K)}function E(K){Ne.unshift(K)}var x=0,U=null;function $(K){x++,e.monitorRunDependencies&&e.monitorRunDependencies(x)}function q(K){if(x--,e.monitorRunDependencies&&e.monitorRunDependencies(x),x==0&&U){var S=U;U=null,S()}}e.preloadedImages={},e.preloadedAudios={};function G(K){e.onAbort&&e.onAbort(K),K="Aborted("+K+")",v(K),M=!0,K+=". Build with -s ASSERTIONS=1 for more info.";var S=new WebAssembly.RuntimeError(K);throw i(S),S}var re="data:application/octet-stream;base64,";function Z(K){return K.startsWith(re)}function D(K){return K.startsWith("file://")}var L;e.locateFile?(L="curve25519_compiled.wasm",Z(L)||(L=y(L))):L="curve25519_compiled.wasm";function W(K){try{if(K==L&&m)return new Uint8Array(m);if(g)return g(K);throw"both async and sync fetching of the wasm failed"}catch(S){G(S)}}function ee(){if(!m&&(s||u)){if(typeof fetch=="function"&&!D(L))return fetch(L,{credentials:"same-origin"}).then(function(K){if(!K.ok)throw"failed to load wasm binary file at '"+L+"'";return K.arrayBuffer()}).catch(function(){return W(L)});if(l)return new Promise(function(K,S){l(L,function(J){K(new Uint8Array(J))},S)})}return Promise.resolve().then(function(){return W(L)})}function Oe(){var K={env:Dt,wasi_snapshot_preview1:Dt};function S(pe,ge){var at=pe.exports;e.asm=at,k=e.asm.memory,ue(k.buffer),de=e.asm.__indirect_function_table,f(e.asm.__wasm_call_ctors),q()}$();function J(pe){S(pe.instance)}function te(pe){return ee().then(function(ge){return WebAssembly.instantiate(ge,K)}).then(function(ge){return ge}).then(pe,function(ge){v("failed to asynchronously prepare wasm: "+ge),G(ge)})}function st(){return!m&&typeof WebAssembly.instantiateStreaming=="function"&&!Z(L)&&!D(L)&&typeof fetch=="function"?fetch(L,{credentials:"same-origin"}).then(function(pe){var ge=WebAssembly.instantiateStreaming(pe,K);return ge.then(J,function(at){return v("wasm streaming compile failed: "+at),v("falling back to ArrayBuffer instantiation"),te(J)})}):te(J)}if(e.instantiateWasm)try{var Nr=e.instantiateWasm(K,S);return Nr}catch(pe){return v("Module.instantiateWasm callback failed with error: "+pe),!1}return st().catch(i),{}}function it(K){for(;K.length>0;){var S=K.shift();if(typeof S=="function"){S(e);continue}var J=S.func;typeof J=="number"?S.arg===void 0?Nt(J)():Nt(J)(S.arg):J(S.arg===void 0?null:S.arg)}}var Xe=[];function Nt(K){var S=Xe[K];return S||(K>=Xe.length&&(Xe.length=K+1),Xe[K]=S=de.get(K)),S}function Cr(K,S,J){T.copyWithin(K,S,S+J)}function Lr(K){G("OOM")}function Tr(K){T.length,Lr()}var Dt={emscripten_memcpy_big:Cr,emscripten_resize_heap:Tr};Oe(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.__wasm_call_ctors).apply(null,arguments)},e._crypto_sign_ed25519_ref10_ge_scalarmult_base=function(){return(e._crypto_sign_ed25519_ref10_ge_scalarmult_base=e.asm.crypto_sign_ed25519_ref10_ge_scalarmult_base).apply(null,arguments)},e._malloc=function(){return(e._malloc=e.asm.malloc).apply(null,arguments)},e._free=function(){return(e._free=e.asm.free).apply(null,arguments)},e._curve25519_verify=function(){return(e._curve25519_verify=e.asm.curve25519_verify).apply(null,arguments)},e._curve25519_pubkey_to_ed25519_pubkey=function(){return(e._curve25519_pubkey_to_ed25519_pubkey=e.asm.curve25519_pubkey_to_ed25519_pubkey).apply(null,arguments)},e._ed25519_pubkey_to_curve25519_pubkey=function(){return(e._ed25519_pubkey_to_curve25519_pubkey=e.asm.ed25519_pubkey_to_curve25519_pubkey).apply(null,arguments)},e._sph_sha512_init=function(){return(e._sph_sha512_init=e.asm.sph_sha512_init).apply(null,arguments)},e._xed25519_sign=function(){return(e._xed25519_sign=e.asm.xed25519_sign).apply(null,arguments)},e._xed25519_verify=function(){return(e._xed25519_verify=e.asm.xed25519_verify).apply(null,arguments)},e._curve25519_donna=function(){return(e._curve25519_donna=e.asm.curve25519_donna).apply(null,arguments)},e.___errno_location=function(){return(e.___errno_location=e.asm.__errno_location).apply(null,arguments)},e.stackSave=function(){return(e.stackSave=e.asm.stackSave).apply(null,arguments)},e.stackRestore=function(){return(e.stackRestore=e.asm.stackRestore).apply(null,arguments)},e.stackAlloc=function(){return(e.stackAlloc=e.asm.stackAlloc).apply(null,arguments)};var Je;function $r(K){this.name="ExitStatus",this.message="Program terminated with exit("+K+")",this.status=K}U=function K(){Je||ot(),Je||(U=K)};function ot(K){if(x>0||(Ze(),x>0))return;function S(){Je||(Je=!0,e.calledRun=!0,!M&&(Y(),r(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),b()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),S()},1)):S()}if(e.run=ot,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return ot(),t.ready})})(),B,we,Wt,oe,Me,Ft,jt,zt,Ht,Vt,Gt,Zt,Xt,Be,De;const Jt=new Uint8Array(32);Jt[0]=9;class Ue{constructor(){B.add(this),we.set(this,void 0),ce(this,we,p(this,B,"m",Wt).call(this),"f")}async ECDHE(t,e){return t=p(this,B,"m",De).call(this,t),p(this,B,"m",Be).call(this,e),p(this,B,"m",jt).call(this,await p(this,we,"f"),t,e)}async Ed25519Sign(t,e){if(p(this,B,"m",Be).call(this,t),e===void 0)throw new Error("Invalid message");return p(this,B,"m",zt).call(this,await p(this,we,"f"),t,e)}async curvePubKeyToEd25519PubKey(t){const e=p(this,B,"m",De).call(this,t,!0);return p(this,B,"m",Vt).call(this,await p(this,we,"f"),e)}async ed25519PubKeyToCurvePubKey(t){if(!(t instanceof ArrayBuffer)||t.byteLength!==32)throw new Error("Invalid Ed25519 public key: expected a 32-byte ArrayBuffer");return p(this,B,"m",Gt).call(this,await p(this,we,"f"),t)}async generateKeyPair(){const t=p(this,B,"m",Xt).call(this,32);return await this.createKeyPair(t)}async createKeyPair(t){p(this,B,"m",Be).call(this,t);const e=p(this,B,"m",Ft).call(this,await p(this,we,"f"),t);return p(this,B,"m",Zt).call(this,e)}async calculateAgreement(t,e){return p(this,B,"m",De).call(this,t),p(this,B,"m",Be).call(this,e),await this.ECDHE(t,e)}async verifySignature(t,e,r){if(t=p(this,B,"m",De).call(this,t),e===void 0)throw new Error("Invalid message");if(r===void 0||r.byteLength!==64)throw new Error("Invalid signature");if(!p(this,B,"m",Ht).call(this,await p(this,we,"f"),t,e,r))throw new Error("Invalid signature")}async calculateSignature(t,e){if(p(this,B,"m",Be).call(this,t),e===void 0)throw new Error("Invalid message");return await this.Ed25519Sign(t,e)}}we=new WeakMap,B=new WeakSet,Wt=async function(){const n={};return typeof __WASM_BASE__<"u"&&(n.locateFile=t=>t.endsWith(".wasm")?__WASM_BASE__+t:t),await jr(n)},oe=function(n,t){const e=n._malloc(t.length);return n.HEAPU8.set(t,e),e},Me=function(n,t,e,r){r.set(n.HEAPU8.subarray(t,t+e))},Ft=function(n,t){const e=new Uint8Array(t.slice(0));e[0]&=248,e[31]&=127,e[31]|=64;const r=n._malloc(32),i=p(this,B,"m",oe).call(this,n,e),o=p(this,B,"m",oe).call(this,n,Jt),s=n._curve25519_donna(r,i,o),u=new Uint8Array(32);if(p(this,B,"m",Me).call(this,n,r,32,u),n._free(r),n._free(i),n._free(o),s)throw new Error("curve25519_donna (key generation) failed");return{pubKey:u.buffer,privKey:e.buffer}},jt=function(n,t,e){const r=n._malloc(32),i=p(this,B,"m",oe).call(this,n,new Uint8Array(e)),o=p(this,B,"m",oe).call(this,n,new Uint8Array(t)),s=n._curve25519_donna(r,i,o),u=new Uint8Array(32);if(p(this,B,"m",Me).call(this,n,r,32,u),n._free(r),n._free(i),n._free(o),s)throw new Error("curve25519_donna (ECDH) failed");let a=0;for(let h=0;h<u.length;h++)a|=u[h];if(a===0)throw new Error("Invalid public key: produced an all-zero shared secret");return u.buffer},zt=function(n,t,e){const r=n._malloc(64),i=p(this,B,"m",oe).call(this,n,new Uint8Array(t)),o=p(this,B,"m",oe).call(this,n,new Uint8Array(e)),s=n._xed25519_sign(r,i,o,e.byteLength),u=new Uint8Array(64);if(p(this,B,"m",Me).call(this,n,r,64,u),n._free(r),n._free(i),n._free(o),s)throw new Error("xed25519_sign failed");return u.buffer},Ht=function(n,t,e,r){const i=p(this,B,"m",oe).call(this,n,new Uint8Array(t)),o=p(this,B,"m",oe).call(this,n,new Uint8Array(r)),s=p(this,B,"m",oe).call(this,n,new Uint8Array(e)),u=n._curve25519_verify(o,i,s,e.byteLength);return n._free(i),n._free(o),n._free(s),u===0},Vt=function(n,t){const e=n._malloc(32),r=p(this,B,"m",oe).call(this,n,new Uint8Array(t));n._curve25519_pubkey_to_ed25519_pubkey(e,r);const i=new Uint8Array(32);return p(this,B,"m",Me).call(this,n,e,32,i),n._free(e),n._free(r),i.buffer},Gt=function(n,t){const e=n._malloc(32),r=p(this,B,"m",oe).call(this,n,new Uint8Array(t));n._ed25519_pubkey_to_curve25519_pubkey(e,r);const i=new Uint8Array(32);return p(this,B,"m",Me).call(this,n,e,32,i),n._free(e),n._free(r),i.buffer},Zt=function(n){const t=new Uint8Array(n.pubKey),e=new Uint8Array(33);return e.set(t,1),e[0]=5,{pubKey:e.buffer,privKey:n.privKey}},Xt=function(n){const t=new Uint8Array(n);return globalThis.crypto.getRandomValues(t),t.buffer},Be=function(n){if(!(n instanceof ArrayBuffer))throw new Error("Invalid private key: expected ArrayBuffer");if(n.byteLength!==32)throw new Error("Invalid private key")},De=function(n,t=!1){if(!(n instanceof ArrayBuffer))throw new Error("Invalid public key: expected ArrayBuffer");if(n.byteLength===33&&new Uint8Array(n)[0]===5)return n.slice(1);if(t&&n.byteLength===32)return n;throw new Error("Invalid public key")};const fe=globalThis.crypto;if(!fe||!fe.subtle||typeof fe.getRandomValues!="function")throw new Error("WebCrypto not found");function Yt(n){const t=new Uint8Array(n);return fe.getRandomValues(t),t.buffer}async function zr(n,t,e){const r={name:"AES-CBC"},i=await fe.subtle.importKey("raw",n,r,!1,["encrypt"]);return fe.subtle.encrypt({...r,iv:new Uint8Array(e)},i,t)}async function Hr(n,t,e){const r={name:"AES-CBC"},i=await fe.subtle.importKey("raw",n,r,!1,["decrypt"]);return fe.subtle.decrypt({...r,iv:new Uint8Array(e)},i,t)}async function me(n,t){const e=await fe.subtle.importKey("raw",n,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return fe.subtle.sign({name:"HMAC",hash:"SHA-256"},e,t)}function Vr(n){return fe.subtle.digest({name:"SHA-512"},n)}async function Gr(n,t,e){const r=await me(t,n),i=new ArrayBuffer(e.byteLength+1+32),o=new Uint8Array(i);o.set(new Uint8Array(e),32),o[o.length-1]=1;const s=await me(r,i.slice(32));o.set(new Uint8Array(s)),o[o.length-1]=2;const u=await me(r,i);o.set(new Uint8Array(u)),o[o.length-1]=3;const a=await me(r,i);return[s,u,a]}function qe(n,t,e){if(t.byteLength!==32)throw new Error("Got salt of incorrect length");const r=typeof e=="string"?F.toArrayBuffer(e):e;return Gr(n,t,r)}async function Qt(n,t,e,r){const i=await me(t,n);if(e.byteLength!==r||i.byteLength<r)throw new Error("Bad MAC length");const o=new Uint8Array(i),s=new Uint8Array(e);let u=0;for(let a=0;a<e.byteLength;++a)u|=o[a]^s[a];if(u!==0)throw new Error("Bad MAC")}const z={async createKeyPair(n){return n===void 0&&(n=Yt(32)),await new Ue().createKeyPair(n)},async ECDHE(n,t){return await new Ue().ECDHE(n,t)},async Ed25519Sign(n,t){return await new Ue().Ed25519Sign(n,t)},async Ed25519Verify(n,t,e){return await new Ue().verifySignature(n,t,e)},async curvePubKeyToEd25519PubKey(n){return await new Ue().curvePubKeyToEd25519PubKey(n)},async ed25519PubKeyToCurvePubKey(n){return await new Ue().ed25519PubKeyToCurvePubKey(n)}},Zr=n=>z.curvePubKeyToEd25519PubKey(n),Xr=n=>z.ed25519PubKeyToCurvePubKey(n);var Re=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Jr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ft={},Ye={},ht,er;function Yr(){if(er)return ht;er=1,ht=n;function n(t,e){for(var r=new Array(arguments.length-1),i=0,o=2,s=!0;o<arguments.length;)r[i++]=arguments[o++];return new Promise(function(a,h){r[i]=function(c){if(s)if(s=!1,c)h(c);else{for(var l=new Array(arguments.length-1),g=0;g<l.length;)l[g++]=arguments[g];a.apply(null,l)}};try{t.apply(e||null,r)}catch(y){s&&(s=!1,h(y))}})}return ht}var lt={},tr;function Qr(){return tr||(tr=1,(function(n){var t=n;t.length=function(y){var c=y.length;if(!c)return 0;for(;c>0&&y.charAt(c-1)==="=";)--c;return Math.floor(c*3/4)};for(var e=new Array(64),r=new Array(123),i=0;i<64;)r[e[i]=i<26?i+65:i<52?i+71:i<62?i-4:i-59|43]=i++;r[45]=62,r[95]=63,t.encode=function(y,c,l){for(var g=null,d=[],_=0,O=0,v;c<l;){var m=y[c++];switch(O){case 0:d[_++]=e[m>>2],v=(m&3)<<4,O=1;break;case 1:d[_++]=e[v|m>>4],v=(m&15)<<2,O=2;break;case 2:d[_++]=e[v|m>>6],d[_++]=e[m&63],O=0;break}_>8191&&((g||(g=[])).push(String.fromCharCode.apply(String,d)),_=0)}return O&&(d[_++]=e[v],d[_++]=61,O===1&&(d[_++]=61)),g?(_&&g.push(String.fromCharCode.apply(String,d.slice(0,_))),g.join("")):String.fromCharCode.apply(String,d.slice(0,_))};var o="invalid encoding";t.decode=function(y,c,l){for(var g=l,d=0,_,O=0;O<y.length;){var v=y.charCodeAt(O++);if(v===61&&d>1)break;if((v=r[v])===void 0)throw Error(o);switch(d){case 0:_=v,d=1;break;case 1:c[l++]=_<<2|(v&48)>>4,_=v,d=2;break;case 2:c[l++]=(_&15)<<4|(v&60)>>2,_=v,d=3;break;case 3:c[l++]=(_&3)<<6|v,d=0;break}}if(d===1)throw Error(o);return l-g};var s=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,u=/[-_]/,a=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2}(?:==)?|[A-Za-z0-9_-]{3}=?)?$/;t.test=function(y){return s.test(y)||u.test(y)&&a.test(y)}})(lt)),lt}var yt,rr;function en(){if(rr)return yt;rr=1,yt=n;function n(){this._listeners=Object.create(null)}return n.prototype.on=function(e,r,i){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:i||this}),this},n.prototype.off=function(e,r){if(e===void 0)this._listeners=Object.create(null);else if(r===void 0)this._listeners[e]=[];else{var i=this._listeners[e];if(!i)return this;for(var o=0;o<i.length;)i[o].fn===r?i.splice(o,1):++o}return this},n.prototype.emit=function(e){var r=this._listeners[e];if(r){for(var i=[],o=1;o<arguments.length;)i.push(arguments[o++]);for(o=0;o<r.length;)r[o].fn.apply(r[o++].ctx,i)}return this},yt}var dt,nr;function tn(){if(nr)return dt;nr=1,dt=n(n);function n(o){return typeof Float32Array<"u"?(function(){var s=new Float32Array([-0]),u=new Uint8Array(s.buffer),a=u[3]===128;function h(g,d,_){s[0]=g,d[_]=u[0],d[_+1]=u[1],d[_+2]=u[2],d[_+3]=u[3]}function y(g,d,_){s[0]=g,d[_]=u[3],d[_+1]=u[2],d[_+2]=u[1],d[_+3]=u[0]}o.writeFloatLE=a?h:y,o.writeFloatBE=a?y:h;function c(g,d){return u[0]=g[d],u[1]=g[d+1],u[2]=g[d+2],u[3]=g[d+3],s[0]}function l(g,d){return u[3]=g[d],u[2]=g[d+1],u[1]=g[d+2],u[0]=g[d+3],s[0]}o.readFloatLE=a?c:l,o.readFloatBE=a?l:c})():(function(){function s(a,h,y,c){var l=h<0?1:0;if(l&&(h=-h),h===0)a(1/h>0?0:2147483648,y,c);else if(isNaN(h))a(2143289344,y,c);else if(h>34028234663852886e22)a((l<<31|2139095040)>>>0,y,c);else if(h<11754943508222875e-54)a((l<<31|Math.round(h/1401298464324817e-60))>>>0,y,c);else{var g=Math.floor(Math.log(h)/Math.LN2),d=Math.round(h*Math.pow(2,-g)*8388608)&8388607;a((l<<31|g+127<<23|d)>>>0,y,c)}}o.writeFloatLE=s.bind(null,t),o.writeFloatBE=s.bind(null,e);function u(a,h,y){var c=a(h,y),l=(c>>31)*2+1,g=c>>>23&255,d=c&8388607;return g===255?d?NaN:l*(1/0):g===0?l*1401298464324817e-60*d:l*Math.pow(2,g-150)*(d+8388608)}o.readFloatLE=u.bind(null,r),o.readFloatBE=u.bind(null,i)})(),typeof Float64Array<"u"?(function(){var s=new Float64Array([-0]),u=new Uint8Array(s.buffer),a=u[7]===128;function h(g,d,_){s[0]=g,d[_]=u[0],d[_+1]=u[1],d[_+2]=u[2],d[_+3]=u[3],d[_+4]=u[4],d[_+5]=u[5],d[_+6]=u[6],d[_+7]=u[7]}function y(g,d,_){s[0]=g,d[_]=u[7],d[_+1]=u[6],d[_+2]=u[5],d[_+3]=u[4],d[_+4]=u[3],d[_+5]=u[2],d[_+6]=u[1],d[_+7]=u[0]}o.writeDoubleLE=a?h:y,o.writeDoubleBE=a?y:h;function c(g,d){return u[0]=g[d],u[1]=g[d+1],u[2]=g[d+2],u[3]=g[d+3],u[4]=g[d+4],u[5]=g[d+5],u[6]=g[d+6],u[7]=g[d+7],s[0]}function l(g,d){return u[7]=g[d],u[6]=g[d+1],u[5]=g[d+2],u[4]=g[d+3],u[3]=g[d+4],u[2]=g[d+5],u[1]=g[d+6],u[0]=g[d+7],s[0]}o.readDoubleLE=a?c:l,o.readDoubleBE=a?l:c})():(function(){function s(a,h,y,c,l,g){var d=c<0?1:0;if(d&&(c=-c),c===0)a(0,l,g+h),a(1/c>0?0:2147483648,l,g+y);else if(isNaN(c))a(0,l,g+h),a(2146959360,l,g+y);else if(c>17976931348623157e292)a(0,l,g+h),a((d<<31|2146435072)>>>0,l,g+y);else{var _;if(c<22250738585072014e-324)_=c/5e-324,a(_>>>0,l,g+h),a((d<<31|_/4294967296)>>>0,l,g+y);else{var O=Math.floor(Math.log(c)/Math.LN2);O===1024&&(O=1023),_=c*Math.pow(2,-O),a(_*4503599627370496>>>0,l,g+h),a((d<<31|O+1023<<20|_*1048576&1048575)>>>0,l,g+y)}}}o.writeDoubleLE=s.bind(null,t,0,4),o.writeDoubleBE=s.bind(null,e,4,0);function u(a,h,y,c,l){var g=a(c,l+h),d=a(c,l+y),_=(d>>31)*2+1,O=d>>>20&2047,v=4294967296*(d&1048575)+g;return O===2047?v?NaN:_*(1/0):O===0?_*5e-324*v:_*Math.pow(2,O-1075)*(v+4503599627370496)}o.readDoubleLE=u.bind(null,r,0,4),o.readDoubleBE=u.bind(null,i,4,0)})(),o}function t(o,s,u){s[u]=o&255,s[u+1]=o>>>8&255,s[u+2]=o>>>16&255,s[u+3]=o>>>24}function e(o,s,u){s[u]=o>>>24,s[u+1]=o>>>16&255,s[u+2]=o>>>8&255,s[u+3]=o&255}function r(o,s){return(o[s]|o[s+1]<<8|o[s+2]<<16|o[s+3]<<24)>>>0}function i(o,s){return(o[s]<<24|o[s+1]<<16|o[s+2]<<8|o[s+3])>>>0}return dt}var pt={},ir;function rn(){return ir||(ir=1,(function(n){var t=n,e="\uFFFD",r;try{r=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}catch{r=new TextDecoder("utf-8",{ignoreBOM:!0})}t.length=function(u){for(var a=0,h=0,y=0;y<u.length;++y)h=u.charCodeAt(y),h<128?a+=1:h<2048?a+=2:(h&64512)===55296&&(u.charCodeAt(y+1)&64512)===56320?(++y,a+=4):a+=3;return a};function i(s,u,a,h){for(var y=u;y<a;){var c=s[y++];if(c<=127)h+=String.fromCharCode(c);else if(c>=192&&c<224){var l=(c&31)<<6|s[y++]&63;h+=l>=128?String.fromCharCode(l):e}else if(c>=224&&c<240){var g=(c&15)<<12|(s[y++]&63)<<6|s[y++]&63;h+=g>=2048?String.fromCharCode(g):e}else if(c>=240){var d=(c&7)<<18|(s[y++]&63)<<12|(s[y++]&63)<<6|s[y++]&63;d<65536||d>1114111?h+=e:(d-=65536,h+=String.fromCharCode(55296+(d>>10)),h+=String.fromCharCode(56320+(d&1023)))}}return h}t.read=function(u,a,h){if(h-a<1)return"";for(var y="",c=a,l,g,d,_,O,v,m,k;c+7<h;c+=8){if(l=u[c],g=u[c+1],d=u[c+2],_=u[c+3],O=u[c+4],v=u[c+5],m=u[c+6],k=u[c+7],(l|g|d|_|O|v|m|k)&128)return i(u,c,h,y);y+=String.fromCharCode(l,g,d,_,O,v,m,k)}for(;c<h;++c){if(l=u[c],l&128)return i(u,c,h,y);y+=String.fromCharCode(l)}return y};function o(s,u,a){var h=u===0&&a===s.length?s:s.subarray?s.subarray(u,a):s.slice(u,a);return Array.isArray(h)&&(h=Uint8Array.from(h)),r.decode(h)}t.readStrict=function(u,a,h){if(h-a<1)return"";for(var y="",c=a,l,g,d,_,O,v,m,k;c+7<h;c+=8){if(l=u[c],g=u[c+1],d=u[c+2],_=u[c+3],O=u[c+4],v=u[c+5],m=u[c+6],k=u[c+7],(l|g|d|_|O|v|m|k)&128)return y+o(u,c,h);y+=String.fromCharCode(l,g,d,_,O,v,m,k)}for(;c<h;++c){if(l=u[c],l&128)return y+o(u,c,h);y+=String.fromCharCode(l)}return y},t.write=function(u,a,h){for(var y=h,c,l,g=0;g<u.length;++g)c=u.charCodeAt(g),c<128?a[h++]=c:c<2048?(a[h++]=c>>6|192,a[h++]=c&63|128):(c&64512)===55296&&((l=u.charCodeAt(g+1))&64512)===56320?(c=65536+((c&1023)<<10)+(l&1023),++g,a[h++]=c>>18|240,a[h++]=c>>12&63|128,a[h++]=c>>6&63|128,a[h++]=c&63|128):(a[h++]=c>>12|224,a[h++]=c>>6&63|128,a[h++]=c&63|128);return h-y}})(pt)),pt}var gt,or;function nn(){if(or)return gt;or=1,gt=n;function n(t,e,r){var i=r||8192,o=i>>>1,s=null,u=i;return function(h){if(h<1||h>o)return t(h);u+h>i&&(s=t(i),u=0);var y=e.call(s,u,u+=h);return u&7&&(u=(u|7)+1),y}}return gt}var wt,sr;function on(){if(sr)return wt;sr=1,wt=t;var n=Ee();function t(o,s){this.lo=o>>>0,this.hi=s>>>0}var e=t.zero=new t(0,0);e.toNumber=function(){return 0},e.zzEncode=e.zzDecode=function(){return this},e.length=function(){return 1};var r=t.zeroHash="\0\0\0\0\0\0\0\0";t.fromNumber=function(s){if(s===0)return e;var u=s<0;u&&(s=-s);var a=s>>>0,h=(s-a)/4294967296>>>0;return u&&(h=~h>>>0,a=~a>>>0,++a>4294967295&&(a=0,++h>4294967295&&(h=0))),new t(a,h)},t.from=function(s){if(typeof s=="number")return t.fromNumber(s);if(n.isString(s))if(n.Long)s=n.Long.fromString(s);else return t.fromNumber(parseInt(s,10));return s.low||s.high?new t(s.low>>>0,s.high>>>0):e},t.prototype.toNumber=function(s){if(!s&&this.hi>>>31){var u=~this.lo+1>>>0,a=~this.hi>>>0;return u||(a=a+1>>>0),-(u+a*4294967296)}return this.lo+this.hi*4294967296},t.prototype.toLong=function(s){return n.Long?new n.Long(this.lo|0,this.hi|0,!!s):{low:this.lo|0,high:this.hi|0,unsigned:!!s}};var i=String.prototype.charCodeAt;return t.fromHash=function(s){return s===r?e:new t((i.call(s,0)|i.call(s,1)<<8|i.call(s,2)<<16|i.call(s,3)<<24)>>>0,(i.call(s,4)|i.call(s,5)<<8|i.call(s,6)<<16|i.call(s,7)<<24)>>>0)},t.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},t.prototype.zzEncode=function(){var s=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^s)>>>0,this.lo=(this.lo<<1^s)>>>0,this},t.prototype.zzDecode=function(){var s=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^s)>>>0,this.hi=(this.hi>>>1^s)>>>0,this},t.prototype.length=function(){var s=this.lo,u=(this.lo>>>28|this.hi<<4)>>>0,a=this.hi>>>24;return a===0?u===0?s<16384?s<128?1:2:s<2097152?3:4:u<16384?u<128?5:6:u<2097152?7:8:a<128?9:10},wt}var We={exports:{}},sn=We.exports,ar;function an(){return ar||(ar=1,(function(n,t){(function(e,r){function i(o){return o.default||o}r(t),n.exports=i(t)})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:sn,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;/**
* @license
* Copyright 2009 The Closure Library Authors
* Copyright 2020 Daniel Wirtz / The long.js Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/var r=null;try{r=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function i(w,f,E){this.low=w|0,this.high=f|0,this.unsigned=!!E}i.prototype.__isLong__,Object.defineProperty(i.prototype,"__isLong__",{value:!0});function o(w){return(w&&w.__isLong__)===!0}function s(w){var f=Math.clz32(w&-w);return w?31-f:f}i.isLong=o;var u={},a={};function h(w,f){var E,x,U;return f?(w>>>=0,(U=0<=w&&w<256)&&(x=a[w],x)?x:(E=c(w,0,!0),U&&(a[w]=E),E)):(w|=0,(U=-128<=w&&w<128)&&(x=u[w],x)?x:(E=c(w,w<0?-1:0,!1),U&&(u[w]=E),E))}i.fromInt=h;function y(w,f){if(isNaN(w))return f?ue:T;if(f){if(w<0)return ue;if(w>=m)return Ze}else{if(w<=-k)return Y;if(w+1>=k)return Ne}return w<0?y(-w,f).neg():c(w%v|0,w/v|0,f)}i.fromNumber=y;function c(w,f,E){return new i(w,f,E)}i.fromBits=c;var l=Math.pow;function g(w,f,E){if(w.length===0)throw Error("empty string");if(typeof f=="number"?(E=f,f=!1):f=!!f,w==="NaN"||w==="Infinity"||w==="+Infinity"||w==="-Infinity")return f?ue:T;if(E=E||10,E<2||36<E)throw RangeError("radix");var x;if((x=w.indexOf("-"))>0)throw Error("interior hyphen");if(x===0)return g(w.substring(1),f,E).neg();for(var U=y(l(E,8)),$=T,q=0;q<w.length;q+=8){var G=Math.min(8,w.length-q),re=parseInt(w.substring(q,q+G),E);if(G<8){var Z=y(l(E,G));$=$.mul(Z).add(y(re))}else $=$.mul(U),$=$.add(y(re))}return $.unsigned=f,$}i.fromString=g;function d(w,f){return typeof w=="number"?y(w,f):typeof w=="string"?g(w,f):c(w.low,w.high,typeof f=="boolean"?f:w.unsigned)}i.fromValue=d;var _=65536,O=1<<24,v=_*_,m=v*v,k=m/2,M=h(O),T=h(0);i.ZERO=T;var ue=h(0,!0);i.UZERO=ue;var de=h(1);i.ONE=de;var $e=h(1,!0);i.UONE=$e;var xe=h(-1);i.NEG_ONE=xe;var Ne=c(-1,2147483647,!1);i.MAX_VALUE=Ne;var Ze=c(-1,-1,!0);i.MAX_UNSIGNED_VALUE=Ze;var Y=c(0,-2147483648,!1);i.MIN_VALUE=Y;var b=i.prototype;b.toInt=function(){return this.unsigned?this.low>>>0:this.low},b.toNumber=function(){return this.unsigned?(this.high>>>0)*v+(this.low>>>0):this.high*v+(this.low>>>0)},b.toString=function(f){if(f=f||10,f<2||36<f)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(Y)){var E=y(f),x=this.div(E),U=x.mul(E).sub(this);return x.toString(f)+U.toInt().toString(f)}else return"-"+this.neg().toString(f);for(var $=y(l(f,6),this.unsigned),q=this,G="";;){var re=q.div($),Z=q.sub(re.mul($)).toInt()>>>0,D=Z.toString(f);if(q=re,q.isZero())return D+G;for(;D.length<6;)D="0"+D;G=""+D+G}},b.getHighBits=function(){return this.high},b.getHighBitsUnsigned=function(){return this.high>>>0},b.getLowBits=function(){return this.low},b.getLowBitsUnsigned=function(){return this.low>>>0},b.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Y)?64:this.neg().getNumBitsAbs();for(var f=this.high!=0?this.high:this.low,E=31;E>0&&(f&1<<E)==0;E--);return this.high!=0?E+33:E+1},b.isSafeInteger=function(){var f=this.high>>21;return f?this.unsigned?!1:f===-1&&!(this.low===0&&this.high===-2097152):!0},b.isZero=function(){return this.high===0&&this.low===0},b.eqz=b.isZero,b.isNegative=function(){return!this.unsigned&&this.high<0},b.isPositive=function(){return this.unsigned||this.high>=0},b.isOdd=function(){return(this.low&1)===1},b.isEven=function(){return(this.low&1)===0},b.equals=function(f){return o(f)||(f=d(f)),this.unsigned!==f.unsigned&&this.high>>>31===1&&f.high>>>31===1?!1:this.high===f.high&&this.low===f.low},b.eq=b.equals,b.notEquals=function(f){return!this.eq(f)},b.neq=b.notEquals,b.ne=b.notEquals,b.lessThan=function(f){return this.comp(f)<0},b.lt=b.lessThan,b.lessThanOrEqual=function(f){return this.comp(f)<=0},b.lte=b.lessThanOrEqual,b.le=b.lessThanOrEqual,b.greaterThan=function(f){return this.comp(f)>0},b.gt=b.greaterThan,b.greaterThanOrEqual=function(f){return this.comp(f)>=0},b.gte=b.greaterThanOrEqual,b.ge=b.greaterThanOrEqual,b.compare=function(f){if(o(f)||(f=d(f)),this.eq(f))return 0;var E=this.isNegative(),x=f.isNegative();return E&&!x?-1:!E&&x?1:this.unsigned?f.high>>>0>this.high>>>0||f.high===this.high&&f.low>>>0>this.low>>>0?-1:1:this.sub(f).isNegative()?-1:1},b.comp=b.compare,b.negate=function(){return!this.unsigned&&this.eq(Y)?Y:this.not().add(de)},b.neg=b.negate,b.add=function(f){o(f)||(f=d(f));var E=this.high>>>16,x=this.high&65535,U=this.low>>>16,$=this.low&65535,q=f.high>>>16,G=f.high&65535,re=f.low>>>16,Z=f.low&65535,D=0,L=0,W=0,ee=0;return ee+=$+Z,W+=ee>>>16,ee&=65535,W+=U+re,L+=W>>>16,W&=65535,L+=x+G,D+=L>>>16,L&=65535,D+=E+q,D&=65535,c(W<<16|ee,D<<16|L,this.unsigned)},b.subtract=function(f){return o(f)||(f=d(f)),this.add(f.neg())},b.sub=b.subtract,b.multiply=function(f){if(this.isZero())return this;if(o(f)||(f=d(f)),r){var E=r.mul(this.low,this.high,f.low,f.high);return c(E,r.get_high(),this.unsigned)}if(f.isZero())return this.unsigned?ue:T;if(this.eq(Y))return f.isOdd()?Y:T;if(f.eq(Y))return this.isOdd()?Y:T;if(this.isNegative())return f.isNegative()?this.neg().mul(f.neg()):this.neg().mul(f).neg();if(f.isNegative())return this.mul(f.neg()).neg();if(this.lt(M)&&f.lt(M))return y(this.toNumber()*f.toNumber(),this.unsigned);var x=this.high>>>16,U=this.high&65535,$=this.low>>>16,q=this.low&65535,G=f.high>>>16,re=f.high&65535,Z=f.low>>>16,D=f.low&65535,L=0,W=0,ee=0,Oe=0;return Oe+=q*D,ee+=Oe>>>16,Oe&=65535,ee+=$*D,W+=ee>>>16,ee&=65535,ee+=q*Z,W+=ee>>>16,ee&=65535,W+=U*D,L+=W>>>16,W&=65535,W+=$*Z,L+=W>>>16,W&=65535,W+=q*re,L+=W>>>16,W&=65535,L+=x*D+U*Z+$*re+q*G,L&=65535,c(ee<<16|Oe,L<<16|W,this.unsigned)},b.mul=b.multiply,b.divide=function(f){if(o(f)||(f=d(f)),f.isZero())throw Error("division by zero");if(r){if(!this.unsigned&&this.high===-2147483648&&f.low===-1&&f.high===-1)return this;var E=(this.unsigned?r.div_u:r.div_s)(this.low,this.high,f.low,f.high);return c(E,r.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?ue:T;var x,U,$;if(this.unsigned){if(f.unsigned||(f=f.toUnsigned()),f.gt(this))return ue;if(f.gt(this.shru(1)))return $e;$=ue}else{if(this.eq(Y)){if(f.eq(de)||f.eq(xe))return Y;if(f.eq(Y))return de;var q=this.shr(1);return x=q.div(f).shl(1),x.eq(T)?f.isNegative()?de:xe:(U=this.sub(f.mul(x)),$=x.add(U.div(f)),$)}else if(f.eq(Y))return this.unsigned?ue:T;if(this.isNegative())return f.isNegative()?this.neg().div(f.neg()):this.neg().div(f).neg();if(f.isNegative())return this.div(f.neg()).neg();$=T}for(U=this;U.gte(f);){x=Math.max(1,Math.floor(U.toNumber()/f.toNumber()));for(var G=Math.ceil(Math.log(x)/Math.LN2),re=G<=48?1:l(2,G-48),Z=y(x),D=Z.mul(f);D.isNegative()||D.gt(U);)x-=re,Z=y(x,this.unsigned),D=Z.mul(f);Z.isZero()&&(Z=de),$=$.add(Z),U=U.sub(D)}return $},b.div=b.divide,b.modulo=function(f){if(o(f)||(f=d(f)),r){var E=(this.unsigned?r.rem_u:r.rem_s)(this.low,this.high,f.low,f.high);return c(E,r.get_high(),this.unsigned)}return this.sub(this.div(f).mul(f))},b.mod=b.modulo,b.rem=b.modulo,b.not=function(){return c(~this.low,~this.high,this.unsigned)},b.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},b.clz=b.countLeadingZeros,b.countTrailingZeros=function(){return this.low?s(this.low):s(this.high)+32},b.ctz=b.countTrailingZeros,b.and=function(f){return o(f)||(f=d(f)),c(this.low&f.low,this.high&f.high,this.unsigned)},b.or=function(f){return o(f)||(f=d(f)),c(this.low|f.low,this.high|f.high,this.unsigned)},b.xor=function(f){return o(f)||(f=d(f)),c(this.low^f.low,this.high^f.high,this.unsigned)},b.shiftLeft=function(f){return o(f)&&(f=f.toInt()),(f&=63)===0?this:f<32?c(this.low<<f,this.high<<f|this.low>>>32-f,this.unsigned):c(0,this.low<<f-32,this.unsigned)},b.shl=b.shiftLeft,b.shiftRight=function(f){return o(f)&&(f=f.toInt()),(f&=63)===0?this:f<32?c(this.low>>>f|this.high<<32-f,this.high>>f,this.unsigned):c(this.high>>f-32,this.high>=0?0:-1,this.unsigned)},b.shr=b.shiftRight,b.shiftRightUnsigned=function(f){return o(f)&&(f=f.toInt()),(f&=63)===0?this:f<32?c(this.low>>>f|this.high<<32-f,this.high>>>f,this.unsigned):f===32?c(this.high,0,this.unsigned):c(this.high>>>f-32,0,this.unsigned)},b.shru=b.shiftRightUnsigned,b.shr_u=b.shiftRightUnsigned,b.rotateLeft=function(f){var E;return o(f)&&(f=f.toInt()),(f&=63)===0?this:f===32?c(this.high,this.low,this.unsigned):f<32?(E=32-f,c(this.low<<f|this.high>>>E,this.high<<f|this.low>>>E,this.unsigned)):(f-=32,E=32-f,c(this.high<<f|this.low>>>E,this.low<<f|this.high>>>E,this.unsigned))},b.rotl=b.rotateLeft,b.rotateRight=function(f){var E;return o(f)&&(f=f.toInt()),(f&=63)===0?this:f===32?c(this.high,this.low,this.unsigned):f<32?(E=32-f,c(this.high<<E|this.low>>>f,this.low<<E|this.high>>>f,this.unsigned)):(f-=32,E=32-f,c(this.low<<E|this.high>>>f,this.high<<E|this.low>>>f,this.unsigned))},b.rotr=b.rotateRight,b.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},b.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},b.toBytes=function(f){return f?this.toBytesLE():this.toBytesBE()},b.toBytesLE=function(){var f=this.high,E=this.low;return[E&255,E>>>8&255,E>>>16&255,E>>>24,f&255,f>>>8&255,f>>>16&255,f>>>24]},b.toBytesBE=function(){var f=this.high,E=this.low;return[f>>>24,f>>>16&255,f>>>8&255,f&255,E>>>24,E>>>16&255,E>>>8&255,E&255]},i.fromBytes=function(f,E,x){return x?i.fromBytesLE(f,E):i.fromBytesBE(f,E)},i.fromBytesLE=function(f,E){return new i(f[0]|f[1]<<8|f[2]<<16|f[3]<<24,f[4]|f[5]<<8|f[6]<<16|f[7]<<24,E)},i.fromBytesBE=function(f,E){return new i(f[4]<<24|f[5]<<16|f[6]<<8|f[7],f[0]<<24|f[1]<<16|f[2]<<8|f[3],E)},typeof BigInt=="function"&&(i.fromBigInt=function(f,E){var x=Number(BigInt.asIntN(32,f)),U=Number(BigInt.asIntN(32,f>>BigInt(32)));return c(x,U,E)},i.fromValue=function(f,E){return typeof f=="bigint"?i.fromBigInt(f,E):d(f,E)},b.toBigInt=function(){var f=BigInt(this.low>>>0),E=BigInt(this.unsigned?this.high>>>0:this.high);return E<<BigInt(32)|f}),e.default=i})})(We,We.exports)),We.exports}var ur;function Ee(){return ur||(ur=1,(function(n){var t=n;t.asPromise=Yr(),t.base64=Qr(),t.EventEmitter=en(),t.float=tn(),t.utf8=rn(),t.pool=nn(),t.LongBits=on();function e(o){return o==="__proto__"||o==="prototype"||o==="constructor"}t.isUnsafeProperty=e,t.isNode=!!(typeof Re<"u"&&Re&&Re.process&&Re.process.versions&&Re.process.versions.node),t.global=t.isNode&&Re||typeof window<"u"&&window||typeof self<"u"&&self||Ye,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(s){return typeof s=="number"&&isFinite(s)&&Math.floor(s)===s},t.isString=function(s){return typeof s=="string"||s instanceof String},t.isObject=function(s){return s&&typeof s=="object"},t.isset=t.isSet=function(s,u){var a=s[u];return a!=null&&Object.hasOwnProperty.call(s,u)?typeof a!="object"||(Array.isArray(a)?a.length:Object.keys(a).length)>0:!1},t.Buffer=(function(){try{var o=t.global.Buffer;return o.prototype.utf8Write?o:null}catch{return null}})(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(s){return typeof s=="number"?t.Buffer?t._Buffer_allocUnsafe(s):new t.Array(s):t.Buffer?t._Buffer_from(s):typeof Uint8Array>"u"?s:new Uint8Array(s)},t.Array=typeof Uint8Array<"u"?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||(function(){try{var o=an();return o&&o.isLong?o:null}catch{return null}})(),t.key2Re=/^(?:true|false|0|1)$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\x00-\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(s){return s?t.LongBits.from(s).toHash():t.LongBits.zeroHash},t.longFromHash=function(s,u){var a=t.LongBits.fromHash(s);return t.Long?t.Long.fromBits(a.lo,a.hi,u):a.toNumber(!!u)},t.longFromKey=function(s,u){return t.key64Re.test(s)&&!t.key32Re.test(s)?t.longFromHash(s,u):s},t.boolFromKey=function(s){return s==="true"||s==="1"};function r(o){var s=typeof arguments[arguments.length-1]=="boolean",u=s?arguments.length-1:arguments.length;s=s&&arguments[arguments.length-1];for(var a=1;a<u;++a){var h=arguments[a];if(h)for(var y=Object.keys(h),c=0;c<y.length;++c)!e(y[c])&&(o[y[c]]===void 0||!s)&&(o[y[c]]=h[y[c]])}return o}t.merge=r,t.nestingLimit=32,t.recursionLimit=100,t.makeProp=function(s,u,a){Object.prototype.hasOwnProperty.call(s,u)||Object.defineProperty(s,u,{enumerable:a===void 0?!0:a,configurable:!0,writable:!0})},t.lcFirst=function(s){return s.charAt(0).toLowerCase()+s.substring(1)};function i(o){function s(u,a){if(!(this instanceof s))return new s(u,a);Object.defineProperty(this,"message",{get:function(){return u}}),Error.captureStackTrace?Error.captureStackTrace(this,s):Object.defineProperty(this,"stack",{value:new Error().stack||""}),a&&r(this,a)}return s.prototype=Object.create(Error.prototype,{constructor:{value:s,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return o},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),s}t.newError=i,t.ProtocolError=i("ProtocolError"),t.oneOfGetter=function(s){for(var u={},a=0;a<s.length;++a)u[s[a]]=1;return function(){for(var h=Object.keys(this),y=h.length-1;y>-1;--y)if(u[h[y]]===1&&this[h[y]]!==void 0&&this[h[y]]!==null)return h[y]}},t.oneOfSetter=function(s){return function(u){for(var a=0;a<s.length;++a)s[a]!==u&&delete this[s[a]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var o=t.Buffer;if(!o){t._Buffer_from=t._Buffer_allocUnsafe=null;return}t._Buffer_from=o.from!==Uint8Array.from&&o.from||function(u,a){return new o(u,a)},t._Buffer_allocUnsafe=o.allocUnsafe||function(u){return new o(u)}}})(Ye)),Ye}var mt,cr;function fr(){if(cr)return mt;cr=1,mt=a;var n=Ee(),t,e=n.LongBits,r=n.base64,i=n.utf8;function o(v,m,k){this.fn=v,this.len=m,this.next=void 0,this.val=k}function s(){}function u(v){this.head=v.head,this.tail=v.tail,this.len=v.len,this.next=v.states}function a(){this.len=0,this.head=new o(s,0,0),this.tail=this.head,this.states=null}var h=function(){return n.Buffer?function(){return(a.create=function(){return new t})()}:function(){return new a}};a.create=h(),a.alloc=function(m){return new n.Array(m)},n.Array!==Array&&(a.alloc=n.pool(a.alloc,n.Array.prototype.subarray)),a.prototype._push=function(m,k,M){return this.tail=this.tail.next=new o(m,k,M),this.len+=k,this};function y(v,m,k){m[k]=v&255}function c(v,m,k){for(var M=0;M<v.length;)m[k++]=v.charCodeAt(M++)}function l(v,m,k){for(;v>127;)m[k++]=v&127|128,v>>>=7;m[k]=v}function g(v,m){this.len=v,this.next=void 0,this.val=m}g.prototype=Object.create(o.prototype),g.prototype.fn=l,a.prototype.uint32=function(m){return this.len+=(this.tail=this.tail.next=new g((m=m>>>0)<128?1:m<16384?2:m<2097152?3:m<268435456?4:5,m)).len,this},a.prototype.int32=function(m){return(m|=0)<0?this._push(d,10,e.fromNumber(m)):this.uint32(m)},a.prototype.sint32=function(m){return this.uint32((m<<1^m>>31)>>>0)};function d(v,m,k){for(var M=v.lo,T=v.hi;T;)m[k++]=M&127|128,M=(M>>>7|T<<25)>>>0,T>>>=7;for(;M>127;)m[k++]=M&127|128,M=M>>>7;m[k++]=M}a.prototype.uint64=function(m){var k=e.from(m);return this._push(d,k.length(),k)},a.prototype.int64=a.prototype.uint64,a.prototype.sint64=function(m){var k=e.from(m).zzEncode();return this._push(d,k.length(),k)},a.prototype.bool=function(m){return this._push(y,1,m?1:0)};function _(v,m,k){m[k]=v&255,m[k+1]=v>>>8&255,m[k+2]=v>>>16&255,m[k+3]=v>>>24}a.prototype.fixed32=function(m){return this._push(_,4,m>>>0)},a.prototype.sfixed32=a.prototype.fixed32,a.prototype.fixed64=function(m){var k=e.from(m);return this._push(_,4,k.lo)._push(_,4,k.hi)},a.prototype.sfixed64=a.prototype.fixed64,a.prototype.float=function(m){return this._push(n.float.writeFloatLE,4,m)},a.prototype.double=function(m){return this._push(n.float.writeDoubleLE,8,m)};var O=n.Array.prototype.set?function(m,k,M){k.set(m,M)}:function(m,k,M){for(var T=0;T<m.length;++T)k[M+T]=m[T]};return a.prototype.bytes=function(m){var k=m.length>>>0;if(!k)return this._push(y,1,0);if(n.isString(m)){var M=a.alloc(k=r.length(m));r.decode(m,M,0),m=M}return this.uint32(k)._push(O,k,m)},a.prototype.raw=function(m){var k=m.length>>>0;return k?this._push(O,k,m):this},a.prototype.string=function(m){var k=i.length(m);return k?this.uint32(k)._push(k===m.length?c:i.write,k,m):this._push(y,1,0)},a.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new o(s,0,0),this.len=0,this},a.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new o(s,0,0),this.len=0),this},a.prototype.ldelim=function(){var m=this.head,k=this.tail,M=this.len;return this.reset().uint32(M),M&&(this.tail.next=m.next,this.tail=k,this.len+=M),this},a.prototype.finish=function(){return this.finishInto(this.constructor.alloc(this.len),0)},a.prototype.finishInto=function(m,k){k===void 0&&(k=0);for(var M=this.head.next,T=k;M;)M.fn(M.val,m,T),T+=M.len,M=M.next;return m},a._configure=function(v){t=v,a.create=h(),t._configure()},mt}var bt,hr;function un(){if(hr)return bt;hr=1,bt=e;var n=fr();(e.prototype=Object.create(n.prototype)).constructor=e;var t=Ee();function e(){n.call(this)}e._configure=function(){e.alloc=t._Buffer_allocUnsafe,e.writeBytesBuffer=t.Buffer&&t.Buffer.prototype instanceof Uint8Array&&t.Buffer.prototype.set.name==="set"?function(s,u,a){u.set(s,a)}:function(s,u,a){if(s.copy)s.copy(u,a,0,s.length);else for(var h=0;h<s.length;)u[a++]=s[h++]}},e.prototype.bytes=function(s){t.isString(s)&&(s=t._Buffer_from(s,"base64"));var u=s.length>>>0;return this.uint32(u),u&&this._push(e.writeBytesBuffer,u,s),this},e.prototype.raw=function(s){var u=s.length>>>0;return u?this._push(e.writeBytesBuffer,u,s):this};function r(o,s,u){for(var a=0;a<o.length;)s[u++]=o.charCodeAt(a++)}function i(o,s,u){o.length<40?t.utf8.write(o,s,u):s.utf8Write?s.utf8Write(o,u):s.write(o,u)}return e.prototype.string=function(s){var u=t.Buffer.byteLength(s);return this.uint32(u),u&&this._push(u===s.length&&u<40?r:i,u,s),this},e._configure(),bt}var vt,lr;function yr(){if(lr)return vt;lr=1,vt=o;var n=Ee(),t,e=n.LongBits,r=n.utf8;function i(c,l){return RangeError("index out of range: "+c.pos+" + "+(l||1)+" > "+c.len)}function o(c){this.buf=c,this.pos=0,this.len=c.length,this.discardUnknown=o.discardUnknown}var s=typeof Uint8Array<"u"?function(l){if(l instanceof Uint8Array||Array.isArray(l))return new o(l);throw Error("illegal buffer")}:function(l){if(Array.isArray(l))return new o(l);throw Error("illegal buffer")},u=function(){return n.Buffer?function(g){return(o.create=function(_){return n.Buffer.isBuffer(_)?new t(_):s(_)})(g)}:s};o.create=u(),o.prototype._slice=n.Array.prototype.subarray||n.Array.prototype.slice,o.prototype.raw=function(l,g){return Array.isArray(this.buf)?this.buf.slice(l,g):l===g?new this.buf.constructor(0):this._slice.call(this.buf,l,g)},o.prototype.uint32=function(){var l=this.buf,g=this.pos,d=(l[g]&127)>>>0;if(l[g++]<128)return this.pos=g,d;if(d=(d|(l[g]&127)<<7)>>>0,l[g++]<128)return this.pos=g,d;if(d=(d|(l[g]&127)<<14)>>>0,l[g++]<128)return this.pos=g,d;if(d=(d|(l[g]&127)<<21)>>>0,l[g++]<128)return this.pos=g,d;if(d=(d|(l[g]&15)<<28)>>>0,l[g++]<128)return this.pos=g,d;for(var _=0;_<5;++_){if(g>=this.len)throw this.pos=g,i(this);if(l[g++]<128)return this.pos=g,d}throw this.pos=g,Error("invalid varint encoding")},o.prototype.tag=function(){var l=this.buf,g=this.pos,d=(l[g]&127)>>>0;if(l[g++]<128)return this.pos=g,d;if(d=(d|(l[g]&127)<<7)>>>0,l[g++]<128)return this.pos=g,d;if(d=(d|(l[g]&127)<<14)>>>0,l[g++]<128)return this.pos=g,d;if(d=(d|(l[g]&127)<<21)>>>0,l[g++]<128)return this.pos=g,d;if(d=(d|(l[g]&15)<<28)>>>0,l[g]<128&&(l[g]&112)===0)return this.pos=g+1,d;throw this.pos=g+1,Error("invalid tag encoding")},o.prototype.int32=function(){return this.uint32()|0},o.prototype.sint32=function(){var l=this.uint32();return l>>>1^-(l&1)|0};function a(){var c=new e(0,0),l=0;if(this.len-this.pos>4){for(;l<4;++l)if(c.lo=(c.lo|(this.buf[this.pos]&127)<<l*7)>>>0,this.buf[this.pos++]<128)return c;if(c.lo=(c.lo|(this.buf[this.pos]&127)<<28)>>>0,c.hi=(c.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return c;l=0}else{for(;l<4;++l){if(this.pos>=this.len)throw i(this);if(c.lo=(c.lo|(this.buf[this.pos]&127)<<l*7)>>>0,this.buf[this.pos++]<128)return c}throw i(this)}if(this.len-this.pos>4){for(;l<5;++l)if(c.hi=(c.hi|(this.buf[this.pos]&127)<<l*7+3)>>>0,this.buf[this.pos++]<128)return c}else for(;l<5;++l){if(this.pos>=this.len)throw i(this);if(c.hi=(c.hi|(this.buf[this.pos]&127)<<l*7+3)>>>0,this.buf[this.pos++]<128)return c}throw Error("invalid varint encoding")}o.prototype.bool=function(){for(var l=!1,g,d=0;d<10;++d){if(this.pos>=this.len)throw i(this);if(g=this.buf[this.pos++],g&127&&(l=!0),g<128)return l}throw Error("invalid varint encoding")};function h(c,l){return(c[l-4]|c[l-3]<<8|c[l-2]<<16|c[l-1]<<24)>>>0}o.prototype.fixed32=function(){if(this.pos+4>this.len)throw i(this,4);return h(this.buf,this.pos+=4)},o.prototype.sfixed32=function(){if(this.pos+4>this.len)throw i(this,4);return h(this.buf,this.pos+=4)|0};function y(){if(this.pos+8>this.len)throw i(this,8);return new e(h(this.buf,this.pos+=4),h(this.buf,this.pos+=4))}return o.prototype.float=function(){if(this.pos+4>this.len)throw i(this,4);var l=n.float.readFloatLE(this.buf,this.pos);return this.pos+=4,l},o.prototype.double=function(){if(this.pos+8>this.len)throw i(this,4);var l=n.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,l},o.prototype.bytes=function(){var l=this.uint32(),g=this.pos,d=this.pos+l;if(d>this.len)throw i(this,l);return this.pos=d,this.raw(g,d)},o.prototype.string=function(){var l=this.uint32(),g=this.pos,d=this.pos+l;if(d>this.len)throw i(this,l);return this.pos=d,r.read(this.buf,g,d)},o.prototype.stringVerify=function(){var l=this.uint32(),g=this.pos,d=this.pos+l;if(d>this.len)throw i(this,l);retur