bsv2
Version:
Javascript library for Bitcoin SV (BSV).
6 lines • 920 kB
JavaScript
(function(We,nt){typeof exports=="object"&&typeof module<"u"?nt(exports):typeof define=="function"&&define.amd?define(["exports"],nt):(We=typeof globalThis<"u"?globalThis:We||self,nt(We.bsv2={}))})(this,function(We){"use strict";var nt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sr(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x.default:x}function ll(x){if(Object.prototype.hasOwnProperty.call(x,"__esModule"))return x;var a=x.default;if(typeof a=="function"){var c=function h(){return this instanceof h?Reflect.construct(a,arguments,this.constructor):a.apply(this,arguments)};c.prototype=a.prototype}else c={};return Object.defineProperty(c,"__esModule",{value:!0}),Object.keys(x).forEach(function(h){var M=Object.getOwnPropertyDescriptor(x,h);Object.defineProperty(c,h,M.get?M:{enumerable:!0,get:function(){return x[h]}})}),c}var Di,Ys;function dl(){if(Ys)return Di;Ys=1,Di=x;function x(a){this._tables[0][0][0]||this._precompute();var c,h,M,n=this._tables[0][4],y=this._tables[1],g=a.length,b=1;if(g!==4&&g!==6&&g!==8)throw new Error("invalid aes key size");this._key=[h=a.slice(0),M=[]];for(var p=g;p<4*g+28;p++)c=h[p-1],(p%g===0||g===8&&p%g===4)&&(c=n[c>>>24]<<24^n[c>>16&255]<<16^n[c>>8&255]<<8^n[c&255],p%g===0&&(c=c<<8^c>>>24^b<<24,b=b<<1^(b>>7)*283)),h[p]=h[p-g]^c;for(var l=0;p;l++,p--)c=h[l&3?p:p-4],p<=4||l<4?M[l]=c:M[l]=y[0][n[c>>>24]]^y[1][n[c>>16&255]]^y[2][n[c>>8&255]]^y[3][n[c&255]]}return x.prototype={encrypt:function(a){return this._crypt(a,0)},decrypt:function(a){return this._crypt(a,1)},_tables:[[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)]],_precompute:function(){var a=this._tables[0],c=this._tables[1],h=a[4],M=c[4],n,y,g,b=new Uint8Array(256),p=new Uint8Array(256),l,w,_,S,B,A;for(n=0;n<256;n++)p[(b[n]=n<<1^(n>>7)*283)^n]=n;for(y=g=0;!h[y];y^=l||1,g=p[g]||1)for(S=g^g<<1^g<<2^g<<3^g<<4,S=S>>8^S&255^99,h[y]=S,M[S]=y,_=b[w=b[l=b[y]]],A=_*16843009^w*65537^l*257^y*16843008,B=b[S]*257^S*16843008,n=0;n<4;n++)a[n][y]=B=B<<24^B>>>8,c[n][S]=A=A<<24^A>>>8},_crypt:function(a,c){if(a.length!==4)throw new Error("invalid aes block size");var h=this._key[c],M=a[0]^h[0],n=a[c?3:1]^h[1],y=a[2]^h[2],g=a[c?1:3]^h[3],b,p,l,w=h.length/4-2,_,S=4,B=new Uint32Array(4),A=this._tables[c],k=A[0],R=A[1],O=A[2],L=A[3],N=A[4];for(_=0;_<w;_++)b=k[M>>>24]^R[n>>16&255]^O[y>>8&255]^L[g&255]^h[S],p=k[n>>>24]^R[y>>16&255]^O[g>>8&255]^L[M&255]^h[S+1],l=k[y>>>24]^R[g>>16&255]^O[M>>8&255]^L[n&255]^h[S+2],g=k[g>>>24]^R[M>>16&255]^O[n>>8&255]^L[y&255]^h[S+3],S+=4,M=b,n=p,y=l;for(_=0;_<4;_++)B[c?3&-_:_]=N[M>>>24]<<24^N[n>>16&255]<<16^N[y>>8&255]<<8^N[g&255]^h[S++],b=M,M=n,n=y,y=g,g=b;return B}},Di}var pl=dl();const Ui=Sr(pl);var Xr={exports:{}},Hi={},Js;function Nt(){return Js||(Js=1,function(x){Object.defineProperties(x,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var a={},c={};c.byteLength=l,c.toByteArray=_,c.fromByteArray=A;for(var h=[],M=[],n=typeof Uint8Array<"u"?Uint8Array:Array,y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",g=0,b=y.length;g<b;++g)h[g]=y[g],M[y.charCodeAt(g)]=g;M[45]=62,M[95]=63;function p(O){var L=O.length;if(L%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var N=O.indexOf("=");N===-1&&(N=L);var q=N===L?0:4-N%4;return[N,q]}function l(O){var L=p(O),N=L[0],q=L[1];return(N+q)*3/4-q}function w(O,L,N){return(L+N)*3/4-N}function _(O){var L,N=p(O),q=N[0],j=N[1],Q=new n(w(O,q,j)),ie=0,Y=j>0?q-4:q,ue;for(ue=0;ue<Y;ue+=4)L=M[O.charCodeAt(ue)]<<18|M[O.charCodeAt(ue+1)]<<12|M[O.charCodeAt(ue+2)]<<6|M[O.charCodeAt(ue+3)],Q[ie++]=L>>16&255,Q[ie++]=L>>8&255,Q[ie++]=L&255;return j===2&&(L=M[O.charCodeAt(ue)]<<2|M[O.charCodeAt(ue+1)]>>4,Q[ie++]=L&255),j===1&&(L=M[O.charCodeAt(ue)]<<10|M[O.charCodeAt(ue+1)]<<4|M[O.charCodeAt(ue+2)]>>2,Q[ie++]=L>>8&255,Q[ie++]=L&255),Q}function S(O){return h[O>>18&63]+h[O>>12&63]+h[O>>6&63]+h[O&63]}function B(O,L,N){for(var q,j=[],Q=L;Q<N;Q+=3)q=(O[Q]<<16&16711680)+(O[Q+1]<<8&65280)+(O[Q+2]&255),j.push(S(q));return j.join("")}function A(O){for(var L,N=O.length,q=N%3,j=[],Q=16383,ie=0,Y=N-q;ie<Y;ie+=Q)j.push(B(O,ie,ie+Q>Y?Y:ie+Q));return q===1?(L=O[N-1],j.push(h[L>>2]+h[L<<4&63]+"==")):q===2&&(L=(O[N-2]<<8)+O[N-1],j.push(h[L>>10]+h[L>>4&63]+h[L<<2&63]+"=")),j.join("")}var k={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */k.read=function(O,L,N,q,j){var Q,ie,Y=j*8-q-1,ue=(1<<Y)-1,v=ue>>1,e=-7,r=N?j-1:0,i=N?-1:1,f=O[L+r];for(r+=i,Q=f&(1<<-e)-1,f>>=-e,e+=Y;e>0;Q=Q*256+O[L+r],r+=i,e-=8);for(ie=Q&(1<<-e)-1,Q>>=-e,e+=q;e>0;ie=ie*256+O[L+r],r+=i,e-=8);if(Q===0)Q=1-v;else{if(Q===ue)return ie?NaN:(f?-1:1)*(1/0);ie=ie+Math.pow(2,q),Q=Q-v}return(f?-1:1)*ie*Math.pow(2,Q-q)},k.write=function(O,L,N,q,j,Q){var ie,Y,ue,v=Q*8-j-1,e=(1<<v)-1,r=e>>1,i=j===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=q?0:Q-1,o=q?1:-1,d=L<0||L===0&&1/L<0?1:0;for(L=Math.abs(L),isNaN(L)||L===1/0?(Y=isNaN(L)?1:0,ie=e):(ie=Math.floor(Math.log(L)/Math.LN2),L*(ue=Math.pow(2,-ie))<1&&(ie--,ue*=2),ie+r>=1?L+=i/ue:L+=i*Math.pow(2,1-r),L*ue>=2&&(ie++,ue/=2),ie+r>=e?(Y=0,ie=e):ie+r>=1?(Y=(L*ue-1)*Math.pow(2,j),ie=ie+r):(Y=L*Math.pow(2,r-1)*Math.pow(2,j),ie=0));j>=8;O[N+f]=Y&255,f+=o,Y/=256,j-=8);for(ie=ie<<j|Y,v+=j;v>0;O[N+f]=ie&255,f+=o,ie/=256,v-=8);O[N+f-o]|=d*128};/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/(function(O){const L=c,N=k,q=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;O.Buffer=e,O.SlowBuffer=I,O.INSPECT_MAX_BYTES=50;const j=2147483647;O.kMaxLength=j;const{Uint8Array:Q,ArrayBuffer:ie,SharedArrayBuffer:Y}=globalThis;e.TYPED_ARRAY_SUPPORT=ue(),!e.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function ue(){try{const K=new Q(1),T={foo:function(){return 42}};return Object.setPrototypeOf(T,Q.prototype),Object.setPrototypeOf(K,T),K.foo()===42}catch{return!1}}Object.defineProperty(e.prototype,"parent",{enumerable:!0,get:function(){if(e.isBuffer(this))return this.buffer}}),Object.defineProperty(e.prototype,"offset",{enumerable:!0,get:function(){if(e.isBuffer(this))return this.byteOffset}});function v(K){if(K>j)throw new RangeError('The value "'+K+'" is invalid for option "size"');const T=new Q(K);return Object.setPrototypeOf(T,e.prototype),T}function e(K,T,D){if(typeof K=="number"){if(typeof T=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return o(K)}return r(K,T,D)}e.poolSize=8192;function r(K,T,D){if(typeof K=="string")return d(K,T);if(ie.isView(K))return s(K);if(K==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof K);if(Te(K,ie)||K&&Te(K.buffer,ie)||typeof Y<"u"&&(Te(K,Y)||K&&Te(K.buffer,Y)))return t(K,T,D);if(typeof K=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const W=K.valueOf&&K.valueOf();if(W!=null&&W!==K)return e.from(W,T,D);const re=u(K);if(re)return re;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof K[Symbol.toPrimitive]=="function")return e.from(K[Symbol.toPrimitive]("string"),T,D);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof K)}e.from=function(K,T,D){return r(K,T,D)},Object.setPrototypeOf(e.prototype,Q.prototype),Object.setPrototypeOf(e,Q);function i(K){if(typeof K!="number")throw new TypeError('"size" argument must be of type number');if(K<0)throw new RangeError('The value "'+K+'" is invalid for option "size"')}function f(K,T,D){return i(K),K<=0?v(K):T!==void 0?typeof D=="string"?v(K).fill(T,D):v(K).fill(T):v(K)}e.alloc=function(K,T,D){return f(K,T,D)};function o(K){return i(K),v(K<0?0:E(K)|0)}e.allocUnsafe=function(K){return o(K)},e.allocUnsafeSlow=function(K){return o(K)};function d(K,T){if((typeof T!="string"||T==="")&&(T="utf8"),!e.isEncoding(T))throw new TypeError("Unknown encoding: "+T);const D=U(K,T)|0;let W=v(D);const re=W.write(K,T);return re!==D&&(W=W.slice(0,re)),W}function m(K){const T=K.length<0?0:E(K.length)|0,D=v(T);for(let W=0;W<T;W+=1)D[W]=K[W]&255;return D}function s(K){if(Te(K,Q)){const T=new Q(K);return t(T.buffer,T.byteOffset,T.byteLength)}return m(K)}function t(K,T,D){if(T<0||K.byteLength<T)throw new RangeError('"offset" is outside of buffer bounds');if(K.byteLength<T+(D||0))throw new RangeError('"length" is outside of buffer bounds');let W;return T===void 0&&D===void 0?W=new Q(K):D===void 0?W=new Q(K,T):W=new Q(K,T,D),Object.setPrototypeOf(W,e.prototype),W}function u(K){if(e.isBuffer(K)){const T=E(K.length)|0,D=v(T);return D.length===0||K.copy(D,0,0,T),D}if(K.length!==void 0)return typeof K.length!="number"||et(K.length)?v(0):m(K);if(K.type==="Buffer"&&Array.isArray(K.data))return m(K.data)}function E(K){if(K>=j)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+j.toString(16)+" bytes");return K|0}function I(K){return+K!=K&&(K=0),e.alloc(+K)}e.isBuffer=function(T){return T!=null&&T._isBuffer===!0&&T!==e.prototype},e.compare=function(T,D){if(Te(T,Q)&&(T=e.from(T,T.offset,T.byteLength)),Te(D,Q)&&(D=e.from(D,D.offset,D.byteLength)),!e.isBuffer(T)||!e.isBuffer(D))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(T===D)return 0;let W=T.length,re=D.length;for(let ve=0,fe=Math.min(W,re);ve<fe;++ve)if(T[ve]!==D[ve]){W=T[ve],re=D[ve];break}return W<re?-1:re<W?1:0},e.isEncoding=function(T){switch(String(T).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},e.concat=function(T,D){if(!Array.isArray(T))throw new TypeError('"list" argument must be an Array of Buffers');if(T.length===0)return e.alloc(0);let W;if(D===void 0)for(D=0,W=0;W<T.length;++W)D+=T[W].length;const re=e.allocUnsafe(D);let ve=0;for(W=0;W<T.length;++W){let fe=T[W];if(Te(fe,Q))ve+fe.length>re.length?(e.isBuffer(fe)||(fe=e.from(fe)),fe.copy(re,ve)):Q.prototype.set.call(re,fe,ve);else if(e.isBuffer(fe))fe.copy(re,ve);else throw new TypeError('"list" argument must be an Array of Buffers');ve+=fe.length}return re};function U(K,T){if(e.isBuffer(K))return K.length;if(ie.isView(K)||Te(K,ie))return K.byteLength;if(typeof K!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof K);const D=K.length,W=arguments.length>2&&arguments[2]===!0;if(!W&&D===0)return 0;let re=!1;for(;;)switch(T){case"ascii":case"latin1":case"binary":return D;case"utf8":case"utf-8":return ze(K).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D*2;case"hex":return D>>>1;case"base64":return Ue(K).length;default:if(re)return W?-1:ze(K).length;T=(""+T).toLowerCase(),re=!0}}e.byteLength=U;function J(K,T,D){let W=!1;if((T===void 0||T<0)&&(T=0),T>this.length||((D===void 0||D>this.length)&&(D=this.length),D<=0)||(D>>>=0,T>>>=0,D<=T))return"";for(K||(K="utf8");;)switch(K){case"hex":return Ke(this,T,D);case"utf8":case"utf-8":return le(this,T,D);case"ascii":return be(this,T,D);case"latin1":case"binary":return se(this,T,D);case"base64":return Pe(this,T,D);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pe(this,T,D);default:if(W)throw new TypeError("Unknown encoding: "+K);K=(K+"").toLowerCase(),W=!0}}e.prototype._isBuffer=!0;function $(K,T,D){const W=K[T];K[T]=K[D],K[D]=W}e.prototype.swap16=function(){const T=this.length;if(T%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let D=0;D<T;D+=2)$(this,D,D+1);return this},e.prototype.swap32=function(){const T=this.length;if(T%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let D=0;D<T;D+=4)$(this,D,D+3),$(this,D+1,D+2);return this},e.prototype.swap64=function(){const T=this.length;if(T%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let D=0;D<T;D+=8)$(this,D,D+7),$(this,D+1,D+6),$(this,D+2,D+5),$(this,D+3,D+4);return this},e.prototype.toString=function(){const T=this.length;return T===0?"":arguments.length===0?le(this,0,T):J.apply(this,arguments)},e.prototype.toLocaleString=e.prototype.toString,e.prototype.equals=function(T){if(!e.isBuffer(T))throw new TypeError("Argument must be a Buffer");return this===T?!0:e.compare(this,T)===0},e.prototype.inspect=function(){let T="";const D=O.INSPECT_MAX_BYTES;return T=this.toString("hex",0,D).replace(/(.{2})/g,"$1 ").trim(),this.length>D&&(T+=" ... "),"<Buffer "+T+">"},q&&(e.prototype[q]=e.prototype.inspect),e.prototype.compare=function(T,D,W,re,ve){if(Te(T,Q)&&(T=e.from(T,T.offset,T.byteLength)),!e.isBuffer(T))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof T);if(D===void 0&&(D=0),W===void 0&&(W=T?T.length:0),re===void 0&&(re=0),ve===void 0&&(ve=this.length),D<0||W>T.length||re<0||ve>this.length)throw new RangeError("out of range index");if(re>=ve&&D>=W)return 0;if(re>=ve)return-1;if(D>=W)return 1;if(D>>>=0,W>>>=0,re>>>=0,ve>>>=0,this===T)return 0;let fe=ve-re,xe=W-D;const je=Math.min(fe,xe),we=this.slice(re,ve),Re=T.slice(D,W);for(let He=0;He<je;++He)if(we[He]!==Re[He]){fe=we[He],xe=Re[He];break}return fe<xe?-1:xe<fe?1:0};function C(K,T,D,W,re){if(K.length===0)return-1;if(typeof D=="string"?(W=D,D=0):D>2147483647?D=2147483647:D<-2147483648&&(D=-2147483648),D=+D,et(D)&&(D=re?0:K.length-1),D<0&&(D=K.length+D),D>=K.length){if(re)return-1;D=K.length-1}else if(D<0)if(re)D=0;else return-1;if(typeof T=="string"&&(T=e.from(T,W)),e.isBuffer(T))return T.length===0?-1:V(K,T,D,W,re);if(typeof T=="number")return T=T&255,typeof Q.prototype.indexOf=="function"?re?Q.prototype.indexOf.call(K,T,D):Q.prototype.lastIndexOf.call(K,T,D):V(K,[T],D,W,re);throw new TypeError("val must be string, number or Buffer")}function V(K,T,D,W,re){let ve=1,fe=K.length,xe=T.length;if(W!==void 0&&(W=String(W).toLowerCase(),W==="ucs2"||W==="ucs-2"||W==="utf16le"||W==="utf-16le")){if(K.length<2||T.length<2)return-1;ve=2,fe/=2,xe/=2,D/=2}function je(Re,He){return ve===1?Re[He]:Re.readUInt16BE(He*ve)}let we;if(re){let Re=-1;for(we=D;we<fe;we++)if(je(K,we)===je(T,Re===-1?0:we-Re)){if(Re===-1&&(Re=we),we-Re+1===xe)return Re*ve}else Re!==-1&&(we-=we-Re),Re=-1}else for(D+xe>fe&&(D=fe-xe),we=D;we>=0;we--){let Re=!0;for(let He=0;He<xe;He++)if(je(K,we+He)!==je(T,He)){Re=!1;break}if(Re)return we}return-1}e.prototype.includes=function(T,D,W){return this.indexOf(T,D,W)!==-1},e.prototype.indexOf=function(T,D,W){return C(this,T,D,W,!0)},e.prototype.lastIndexOf=function(T,D,W){return C(this,T,D,W,!1)};function Z(K,T,D,W){D=Number(D)||0;const re=K.length-D;W?(W=Number(W),W>re&&(W=re)):W=re;const ve=T.length;W>ve/2&&(W=ve/2);let fe;for(fe=0;fe<W;++fe){const xe=parseInt(T.substr(fe*2,2),16);if(et(xe))return fe;K[D+fe]=xe}return fe}function ee(K,T,D,W){return Ae(ze(T,K.length-D),K,D,W)}function X(K,T,D,W){return Ae(ye(T),K,D,W)}function z(K,T,D,W){return Ae(Ue(T),K,D,W)}function ne(K,T,D,W){return Ae(Be(T,K.length-D),K,D,W)}e.prototype.write=function(T,D,W,re){if(D===void 0)re="utf8",W=this.length,D=0;else if(W===void 0&&typeof D=="string")re=D,W=this.length,D=0;else if(isFinite(D))D=D>>>0,isFinite(W)?(W=W>>>0,re===void 0&&(re="utf8")):(re=W,W=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const ve=this.length-D;if((W===void 0||W>ve)&&(W=ve),T.length>0&&(W<0||D<0)||D>this.length)throw new RangeError("Attempt to write outside buffer bounds");re||(re="utf8");let fe=!1;for(;;)switch(re){case"hex":return Z(this,T,D,W);case"utf8":case"utf-8":return ee(this,T,D,W);case"ascii":case"latin1":case"binary":return X(this,T,D,W);case"base64":return z(this,T,D,W);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ne(this,T,D,W);default:if(fe)throw new TypeError("Unknown encoding: "+re);re=(""+re).toLowerCase(),fe=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Pe(K,T,D){return T===0&&D===K.length?L.fromByteArray(K):L.fromByteArray(K.slice(T,D))}function le(K,T,D){D=Math.min(K.length,D);const W=[];let re=T;for(;re<D;){const ve=K[re];let fe=null,xe=ve>239?4:ve>223?3:ve>191?2:1;if(re+xe<=D){let je,we,Re,He;switch(xe){case 1:ve<128&&(fe=ve);break;case 2:je=K[re+1],(je&192)===128&&(He=(ve&31)<<6|je&63,He>127&&(fe=He));break;case 3:je=K[re+1],we=K[re+2],(je&192)===128&&(we&192)===128&&(He=(ve&15)<<12|(je&63)<<6|we&63,He>2047&&(He<55296||He>57343)&&(fe=He));break;case 4:je=K[re+1],we=K[re+2],Re=K[re+3],(je&192)===128&&(we&192)===128&&(Re&192)===128&&(He=(ve&15)<<18|(je&63)<<12|(we&63)<<6|Re&63,He>65535&&He<1114112&&(fe=He))}}fe===null?(fe=65533,xe=1):fe>65535&&(fe-=65536,W.push(fe>>>10&1023|55296),fe=56320|fe&1023),W.push(fe),re+=xe}return Le(W)}const ce=4096;function Le(K){const T=K.length;if(T<=ce)return String.fromCharCode.apply(String,K);let D="",W=0;for(;W<T;)D+=String.fromCharCode.apply(String,K.slice(W,W+=ce));return D}function be(K,T,D){let W="";D=Math.min(K.length,D);for(let re=T;re<D;++re)W+=String.fromCharCode(K[re]&127);return W}function se(K,T,D){let W="";D=Math.min(K.length,D);for(let re=T;re<D;++re)W+=String.fromCharCode(K[re]);return W}function Ke(K,T,D){const W=K.length;(!T||T<0)&&(T=0),(!D||D<0||D>W)&&(D=W);let re="";for(let ve=T;ve<D;++ve)re+=Ie[K[ve]];return re}function pe(K,T,D){const W=K.slice(T,D);let re="";for(let ve=0;ve<W.length-1;ve+=2)re+=String.fromCharCode(W[ve]+W[ve+1]*256);return re}e.prototype.slice=function(T,D){const W=this.length;T=~~T,D=D===void 0?W:~~D,T<0?(T+=W,T<0&&(T=0)):T>W&&(T=W),D<0?(D+=W,D<0&&(D=0)):D>W&&(D=W),D<T&&(D=T);const re=this.subarray(T,D);return Object.setPrototypeOf(re,e.prototype),re};function ge(K,T,D){if(K%1!==0||K<0)throw new RangeError("offset is not uint");if(K+T>D)throw new RangeError("Trying to access beyond buffer length")}e.prototype.readUintLE=e.prototype.readUIntLE=function(T,D,W){T=T>>>0,D=D>>>0,W||ge(T,D,this.length);let re=this[T],ve=1,fe=0;for(;++fe<D&&(ve*=256);)re+=this[T+fe]*ve;return re},e.prototype.readUintBE=e.prototype.readUIntBE=function(T,D,W){T=T>>>0,D=D>>>0,W||ge(T,D,this.length);let re=this[T+--D],ve=1;for(;D>0&&(ve*=256);)re+=this[T+--D]*ve;return re},e.prototype.readUint8=e.prototype.readUInt8=function(T,D){return T=T>>>0,D||ge(T,1,this.length),this[T]},e.prototype.readUint16LE=e.prototype.readUInt16LE=function(T,D){return T=T>>>0,D||ge(T,2,this.length),this[T]|this[T+1]<<8},e.prototype.readUint16BE=e.prototype.readUInt16BE=function(T,D){return T=T>>>0,D||ge(T,2,this.length),this[T]<<8|this[T+1]},e.prototype.readUint32LE=e.prototype.readUInt32LE=function(T,D){return T=T>>>0,D||ge(T,4,this.length),(this[T]|this[T+1]<<8|this[T+2]<<16)+this[T+3]*16777216},e.prototype.readUint32BE=e.prototype.readUInt32BE=function(T,D){return T=T>>>0,D||ge(T,4,this.length),this[T]*16777216+(this[T+1]<<16|this[T+2]<<8|this[T+3])},e.prototype.readBigUInt64LE=Ne(function(T){T=T>>>0,te(T,"offset");const D=this[T],W=this[T+7];(D===void 0||W===void 0)&&de(T,this.length-8);const re=D+this[++T]*2**8+this[++T]*2**16+this[++T]*2**24,ve=this[++T]+this[++T]*2**8+this[++T]*2**16+W*2**24;return BigInt(re)+(BigInt(ve)<<BigInt(32))}),e.prototype.readBigUInt64BE=Ne(function(T){T=T>>>0,te(T,"offset");const D=this[T],W=this[T+7];(D===void 0||W===void 0)&&de(T,this.length-8);const re=D*2**24+this[++T]*2**16+this[++T]*2**8+this[++T],ve=this[++T]*2**24+this[++T]*2**16+this[++T]*2**8+W;return(BigInt(re)<<BigInt(32))+BigInt(ve)}),e.prototype.readIntLE=function(T,D,W){T=T>>>0,D=D>>>0,W||ge(T,D,this.length);let re=this[T],ve=1,fe=0;for(;++fe<D&&(ve*=256);)re+=this[T+fe]*ve;return ve*=128,re>=ve&&(re-=Math.pow(2,8*D)),re},e.prototype.readIntBE=function(T,D,W){T=T>>>0,D=D>>>0,W||ge(T,D,this.length);let re=D,ve=1,fe=this[T+--re];for(;re>0&&(ve*=256);)fe+=this[T+--re]*ve;return ve*=128,fe>=ve&&(fe-=Math.pow(2,8*D)),fe},e.prototype.readInt8=function(T,D){return T=T>>>0,D||ge(T,1,this.length),this[T]&128?(255-this[T]+1)*-1:this[T]},e.prototype.readInt16LE=function(T,D){T=T>>>0,D||ge(T,2,this.length);const W=this[T]|this[T+1]<<8;return W&32768?W|4294901760:W},e.prototype.readInt16BE=function(T,D){T=T>>>0,D||ge(T,2,this.length);const W=this[T+1]|this[T]<<8;return W&32768?W|4294901760:W},e.prototype.readInt32LE=function(T,D){return T=T>>>0,D||ge(T,4,this.length),this[T]|this[T+1]<<8|this[T+2]<<16|this[T+3]<<24},e.prototype.readInt32BE=function(T,D){return T=T>>>0,D||ge(T,4,this.length),this[T]<<24|this[T+1]<<16|this[T+2]<<8|this[T+3]},e.prototype.readBigInt64LE=Ne(function(T){T=T>>>0,te(T,"offset");const D=this[T],W=this[T+7];(D===void 0||W===void 0)&&de(T,this.length-8);const re=this[T+4]+this[T+5]*2**8+this[T+6]*2**16+(W<<24);return(BigInt(re)<<BigInt(32))+BigInt(D+this[++T]*2**8+this[++T]*2**16+this[++T]*2**24)}),e.prototype.readBigInt64BE=Ne(function(T){T=T>>>0,te(T,"offset");const D=this[T],W=this[T+7];(D===void 0||W===void 0)&&de(T,this.length-8);const re=(D<<24)+this[++T]*2**16+this[++T]*2**8+this[++T];return(BigInt(re)<<BigInt(32))+BigInt(this[++T]*2**24+this[++T]*2**16+this[++T]*2**8+W)}),e.prototype.readFloatLE=function(T,D){return T=T>>>0,D||ge(T,4,this.length),N.read(this,T,!0,23,4)},e.prototype.readFloatBE=function(T,D){return T=T>>>0,D||ge(T,4,this.length),N.read(this,T,!1,23,4)},e.prototype.readDoubleLE=function(T,D){return T=T>>>0,D||ge(T,8,this.length),N.read(this,T,!0,52,8)},e.prototype.readDoubleBE=function(T,D){return T=T>>>0,D||ge(T,8,this.length),N.read(this,T,!1,52,8)};function De(K,T,D,W,re,ve){if(!e.isBuffer(K))throw new TypeError('"buffer" argument must be a Buffer instance');if(T>re||T<ve)throw new RangeError('"value" argument is out of bounds');if(D+W>K.length)throw new RangeError("Index out of range")}e.prototype.writeUintLE=e.prototype.writeUIntLE=function(T,D,W,re){if(T=+T,D=D>>>0,W=W>>>0,!re){const xe=Math.pow(2,8*W)-1;De(this,T,D,W,xe,0)}let ve=1,fe=0;for(this[D]=T&255;++fe<W&&(ve*=256);)this[D+fe]=T/ve&255;return D+W},e.prototype.writeUintBE=e.prototype.writeUIntBE=function(T,D,W,re){if(T=+T,D=D>>>0,W=W>>>0,!re){const xe=Math.pow(2,8*W)-1;De(this,T,D,W,xe,0)}let ve=W-1,fe=1;for(this[D+ve]=T&255;--ve>=0&&(fe*=256);)this[D+ve]=T/fe&255;return D+W},e.prototype.writeUint8=e.prototype.writeUInt8=function(T,D,W){return T=+T,D=D>>>0,W||De(this,T,D,1,255,0),this[D]=T&255,D+1},e.prototype.writeUint16LE=e.prototype.writeUInt16LE=function(T,D,W){return T=+T,D=D>>>0,W||De(this,T,D,2,65535,0),this[D]=T&255,this[D+1]=T>>>8,D+2},e.prototype.writeUint16BE=e.prototype.writeUInt16BE=function(T,D,W){return T=+T,D=D>>>0,W||De(this,T,D,2,65535,0),this[D]=T>>>8,this[D+1]=T&255,D+2},e.prototype.writeUint32LE=e.prototype.writeUInt32LE=function(T,D,W){return T=+T,D=D>>>0,W||De(this,T,D,4,4294967295,0),this[D+3]=T>>>24,this[D+2]=T>>>16,this[D+1]=T>>>8,this[D]=T&255,D+4},e.prototype.writeUint32BE=e.prototype.writeUInt32BE=function(T,D,W){return T=+T,D=D>>>0,W||De(this,T,D,4,4294967295,0),this[D]=T>>>24,this[D+1]=T>>>16,this[D+2]=T>>>8,this[D+3]=T&255,D+4};function me(K,T,D,W,re){G(T,W,re,K,D,7);let ve=Number(T&BigInt(4294967295));K[D++]=ve,ve=ve>>8,K[D++]=ve,ve=ve>>8,K[D++]=ve,ve=ve>>8,K[D++]=ve;let fe=Number(T>>BigInt(32)&BigInt(4294967295));return K[D++]=fe,fe=fe>>8,K[D++]=fe,fe=fe>>8,K[D++]=fe,fe=fe>>8,K[D++]=fe,D}function Se(K,T,D,W,re){G(T,W,re,K,D,7);let ve=Number(T&BigInt(4294967295));K[D+7]=ve,ve=ve>>8,K[D+6]=ve,ve=ve>>8,K[D+5]=ve,ve=ve>>8,K[D+4]=ve;let fe=Number(T>>BigInt(32)&BigInt(4294967295));return K[D+3]=fe,fe=fe>>8,K[D+2]=fe,fe=fe>>8,K[D+1]=fe,fe=fe>>8,K[D]=fe,D+8}e.prototype.writeBigUInt64LE=Ne(function(T,D=0){return me(this,T,D,BigInt(0),BigInt("0xffffffffffffffff"))}),e.prototype.writeBigUInt64BE=Ne(function(T,D=0){return Se(this,T,D,BigInt(0),BigInt("0xffffffffffffffff"))}),e.prototype.writeIntLE=function(T,D,W,re){if(T=+T,D=D>>>0,!re){const je=Math.pow(2,8*W-1);De(this,T,D,W,je-1,-je)}let ve=0,fe=1,xe=0;for(this[D]=T&255;++ve<W&&(fe*=256);)T<0&&xe===0&&this[D+ve-1]!==0&&(xe=1),this[D+ve]=(T/fe>>0)-xe&255;return D+W},e.prototype.writeIntBE=function(T,D,W,re){if(T=+T,D=D>>>0,!re){const je=Math.pow(2,8*W-1);De(this,T,D,W,je-1,-je)}let ve=W-1,fe=1,xe=0;for(this[D+ve]=T&255;--ve>=0&&(fe*=256);)T<0&&xe===0&&this[D+ve+1]!==0&&(xe=1),this[D+ve]=(T/fe>>0)-xe&255;return D+W},e.prototype.writeInt8=function(T,D,W){return T=+T,D=D>>>0,W||De(this,T,D,1,127,-128),T<0&&(T=255+T+1),this[D]=T&255,D+1},e.prototype.writeInt16LE=function(T,D,W){return T=+T,D=D>>>0,W||De(this,T,D,2,32767,-32768),this[D]=T&255,this[D+1]=T>>>8,D+2},e.prototype.writeInt16BE=function(T,D,W){return T=+T,D=D>>>0,W||De(this,T,D,2,32767,-32768),this[D]=T>>>8,this[D+1]=T&255,D+2},e.prototype.writeInt32LE=function(T,D,W){return T=+T,D=D>>>0,W||De(this,T,D,4,2147483647,-2147483648),this[D]=T&255,this[D+1]=T>>>8,this[D+2]=T>>>16,this[D+3]=T>>>24,D+4},e.prototype.writeInt32BE=function(T,D,W){return T=+T,D=D>>>0,W||De(this,T,D,4,2147483647,-2147483648),T<0&&(T=4294967295+T+1),this[D]=T>>>24,this[D+1]=T>>>16,this[D+2]=T>>>8,this[D+3]=T&255,D+4},e.prototype.writeBigInt64LE=Ne(function(T,D=0){return me(this,T,D,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),e.prototype.writeBigInt64BE=Ne(function(T,D=0){return Se(this,T,D,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ge(K,T,D,W,re,ve){if(D+W>K.length)throw new RangeError("Index out of range");if(D<0)throw new RangeError("Index out of range")}function _e(K,T,D,W,re){return T=+T,D=D>>>0,re||Ge(K,T,D,4),N.write(K,T,D,W,23,4),D+4}e.prototype.writeFloatLE=function(T,D,W){return _e(this,T,D,!0,W)},e.prototype.writeFloatBE=function(T,D,W){return _e(this,T,D,!1,W)};function Oe(K,T,D,W,re){return T=+T,D=D>>>0,re||Ge(K,T,D,8),N.write(K,T,D,W,52,8),D+8}e.prototype.writeDoubleLE=function(T,D,W){return Oe(this,T,D,!0,W)},e.prototype.writeDoubleBE=function(T,D,W){return Oe(this,T,D,!1,W)},e.prototype.copy=function(T,D,W,re){if(!e.isBuffer(T))throw new TypeError("argument should be a Buffer");if(W||(W=0),!re&&re!==0&&(re=this.length),D>=T.length&&(D=T.length),D||(D=0),re>0&&re<W&&(re=W),re===W||T.length===0||this.length===0)return 0;if(D<0)throw new RangeError("targetStart out of bounds");if(W<0||W>=this.length)throw new RangeError("Index out of range");if(re<0)throw new RangeError("sourceEnd out of bounds");re>this.length&&(re=this.length),T.length-D<re-W&&(re=T.length-D+W);const ve=re-W;return this===T&&typeof Q.prototype.copyWithin=="function"?this.copyWithin(D,W,re):Q.prototype.set.call(T,this.subarray(W,re),D),ve},e.prototype.fill=function(T,D,W,re){if(typeof T=="string"){if(typeof D=="string"?(re=D,D=0,W=this.length):typeof W=="string"&&(re=W,W=this.length),re!==void 0&&typeof re!="string")throw new TypeError("encoding must be a string");if(typeof re=="string"&&!e.isEncoding(re))throw new TypeError("Unknown encoding: "+re);if(T.length===1){const fe=T.charCodeAt(0);(re==="utf8"&&fe<128||re==="latin1")&&(T=fe)}}else typeof T=="number"?T=T&255:typeof T=="boolean"&&(T=Number(T));if(D<0||this.length<D||this.length<W)throw new RangeError("Out of range index");if(W<=D)return this;D=D>>>0,W=W===void 0?this.length:W>>>0,T||(T=0);let ve;if(typeof T=="number")for(ve=D;ve<W;++ve)this[ve]=T;else{const fe=e.isBuffer(T)?T:e.from(T,re),xe=fe.length;if(xe===0)throw new TypeError('The value "'+T+'" is invalid for argument "value"');for(ve=0;ve<W-D;++ve)this[ve+D]=fe[ve%xe]}return this};const Je={};function H(K,T,D){Je[K]=class extends D{constructor(){super(),Object.defineProperty(this,"message",{value:T.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${K}]`,this.stack,delete this.name}get code(){return K}set code(re){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:re,writable:!0})}toString(){return`${this.name} [${K}]: ${this.message}`}}}H("ERR_BUFFER_OUT_OF_BOUNDS",function(K){return K?`${K} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),H("ERR_INVALID_ARG_TYPE",function(K,T){return`The "${K}" argument must be of type number. Received type ${typeof T}`},TypeError),H("ERR_OUT_OF_RANGE",function(K,T,D){let W=`The value of "${K}" is out of range.`,re=D;return Number.isInteger(D)&&Math.abs(D)>2**32?re=P(String(D)):typeof D=="bigint"&&(re=String(D),(D>BigInt(2)**BigInt(32)||D<-(BigInt(2)**BigInt(32)))&&(re=P(re)),re+="n"),W+=` It must be ${T}. Received ${re}`,W},RangeError);function P(K){let T="",D=K.length;const W=K[0]==="-"?1:0;for(;D>=W+4;D-=3)T=`_${K.slice(D-3,D)}${T}`;return`${K.slice(0,D)}${T}`}function F(K,T,D){te(T,"offset"),(K[T]===void 0||K[T+D]===void 0)&&de(T,K.length-(D+1))}function G(K,T,D,W,re,ve){if(K>D||K<T){const fe=typeof T=="bigint"?"n":"";let xe;throw T===0||T===BigInt(0)?xe=`>= 0${fe} and < 2${fe} ** ${(ve+1)*8}${fe}`:xe=`>= -(2${fe} ** ${(ve+1)*8-1}${fe}) and < 2 ** ${(ve+1)*8-1}${fe}`,new Je.ERR_OUT_OF_RANGE("value",xe,K)}F(W,re,ve)}function te(K,T){if(typeof K!="number")throw new Je.ERR_INVALID_ARG_TYPE(T,"number",K)}function de(K,T,D){throw Math.floor(K)!==K?(te(K,D),new Je.ERR_OUT_OF_RANGE("offset","an integer",K)):T<0?new Je.ERR_BUFFER_OUT_OF_BOUNDS:new Je.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${T}`,K)}const ae=/[^+/0-9A-Za-z-_]/g;function Me(K){if(K=K.split("=")[0],K=K.trim().replace(ae,""),K.length<2)return"";for(;K.length%4!==0;)K=K+"=";return K}function ze(K,T){T=T||1/0;let D;const W=K.length;let re=null;const ve=[];for(let fe=0;fe<W;++fe){if(D=K.charCodeAt(fe),D>55295&&D<57344){if(!re){if(D>56319){(T-=3)>-1&&ve.push(239,191,189);continue}else if(fe+1===W){(T-=3)>-1&&ve.push(239,191,189);continue}re=D;continue}if(D<56320){(T-=3)>-1&&ve.push(239,191,189),re=D;continue}D=(re-55296<<10|D-56320)+65536}else re&&(T-=3)>-1&&ve.push(239,191,189);if(re=null,D<128){if((T-=1)<0)break;ve.push(D)}else if(D<2048){if((T-=2)<0)break;ve.push(D>>6|192,D&63|128)}else if(D<65536){if((T-=3)<0)break;ve.push(D>>12|224,D>>6&63|128,D&63|128)}else if(D<1114112){if((T-=4)<0)break;ve.push(D>>18|240,D>>12&63|128,D>>6&63|128,D&63|128)}else throw new Error("Invalid code point")}return ve}function ye(K){const T=[];for(let D=0;D<K.length;++D)T.push(K.charCodeAt(D)&255);return T}function Be(K,T){let D,W,re;const ve=[];for(let fe=0;fe<K.length&&!((T-=2)<0);++fe)D=K.charCodeAt(fe),W=D>>8,re=D%256,ve.push(re),ve.push(W);return ve}function Ue(K){return L.toByteArray(Me(K))}function Ae(K,T,D,W){let re;for(re=0;re<W&&!(re+D>=T.length||re>=K.length);++re)T[re+D]=K[re];return re}function Te(K,T){return K instanceof T||K!=null&&K.constructor!=null&&K.constructor.name!=null&&K.constructor.name===T.name}function et(K){return K!==K}const Ie=function(){const K="0123456789abcdef",T=new Array(256);for(let D=0;D<16;++D){const W=D*16;for(let re=0;re<16;++re)T[W+re]=K[D]+K[re]}return T}();function Ne(K){return typeof BigInt>"u"?it:K}function it(){throw new Error("BigInt not supported")}})(a);const R=a.Buffer;x.Blob=a.Blob,x.BlobOptions=a.BlobOptions,x.Buffer=a.Buffer,x.File=a.File,x.FileOptions=a.FileOptions,x.INSPECT_MAX_BYTES=a.INSPECT_MAX_BYTES,x.SlowBuffer=a.SlowBuffer,x.TranscodeEncoding=a.TranscodeEncoding,x.atob=a.atob,x.btoa=a.btoa,x.constants=a.constants,x.default=R,x.isAscii=a.isAscii,x.isUtf8=a.isUtf8,x.kMaxLength=a.kMaxLength,x.kStringMaxLength=a.kStringMaxLength,x.resolveObjectURL=a.resolveObjectURL,x.transcode=a.transcode}(Hi)),Hi}var vl=Xr.exports,Zs;function er(){return Zs||(Zs=1,function(x){(function(a,c){function h(r,i){if(!r)throw new Error(i||"Assertion failed")}function M(r,i){r.super_=i;var f=function(){};f.prototype=i.prototype,r.prototype=new f,r.prototype.constructor=r}function n(r,i,f){if(n.isBN(r))return r;this.negative=0,this.words=null,this.length=0,this.red=null,r!==null&&((i==="le"||i==="be")&&(f=i,i=10),this._init(r||0,i||10,f||"be"))}typeof a=="object"?a.exports=n:c.BN=n,n.BN=n,n.wordSize=26;var y;try{typeof window<"u"&&typeof window.Buffer<"u"?y=window.Buffer:y=Nt().Buffer}catch{}n.isBN=function(i){return i instanceof n?!0:i!==null&&typeof i=="object"&&i.constructor.wordSize===n.wordSize&&Array.isArray(i.words)},n.max=function(i,f){return i.cmp(f)>0?i:f},n.min=function(i,f){return i.cmp(f)<0?i:f},n.prototype._init=function(i,f,o){if(typeof i=="number")return this._initNumber(i,f,o);if(typeof i=="object")return this._initArray(i,f,o);f==="hex"&&(f=16),h(f===(f|0)&&f>=2&&f<=36),i=i.toString().replace(/\s+/g,"");var d=0;i[0]==="-"&&(d++,this.negative=1),d<i.length&&(f===16?this._parseHex(i,d,o):(this._parseBase(i,f,d),o==="le"&&this._initArray(this.toArray(),f,o)))},n.prototype._initNumber=function(i,f,o){i<0&&(this.negative=1,i=-i),i<67108864?(this.words=[i&67108863],this.length=1):i<4503599627370496?(this.words=[i&67108863,i/67108864&67108863],this.length=2):(h(i<9007199254740992),this.words=[i&67108863,i/67108864&67108863,1],this.length=3),o==="le"&&this._initArray(this.toArray(),f,o)},n.prototype._initArray=function(i,f,o){if(h(typeof i.length=="number"),i.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(i.length/3),this.words=new Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var m,s,t=0;if(o==="be")for(d=i.length-1,m=0;d>=0;d-=3)s=i[d]|i[d-1]<<8|i[d-2]<<16,this.words[m]|=s<<t&67108863,this.words[m+1]=s>>>26-t&67108863,t+=24,t>=26&&(t-=26,m++);else if(o==="le")for(d=0,m=0;d<i.length;d+=3)s=i[d]|i[d+1]<<8|i[d+2]<<16,this.words[m]|=s<<t&67108863,this.words[m+1]=s>>>26-t&67108863,t+=24,t>=26&&(t-=26,m++);return this._strip()};function g(r,i){var f=r.charCodeAt(i);if(f>=48&&f<=57)return f-48;if(f>=65&&f<=70)return f-55;if(f>=97&&f<=102)return f-87;h(!1,"Invalid character in "+r)}function b(r,i,f){var o=g(r,f);return f-1>=i&&(o|=g(r,f-1)<<4),o}n.prototype._parseHex=function(i,f,o){this.length=Math.ceil((i.length-f)/6),this.words=new Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var m=0,s=0,t;if(o==="be")for(d=i.length-1;d>=f;d-=2)t=b(i,f,d)<<m,this.words[s]|=t&67108863,m>=18?(m-=18,s+=1,this.words[s]|=t>>>26):m+=8;else{var u=i.length-f;for(d=u%2===0?f+1:f;d<i.length;d+=2)t=b(i,f,d)<<m,this.words[s]|=t&67108863,m>=18?(m-=18,s+=1,this.words[s]|=t>>>26):m+=8}this._strip()};function p(r,i,f,o){for(var d=0,m=0,s=Math.min(r.length,f),t=i;t<s;t++){var u=r.charCodeAt(t)-48;d*=o,u>=49?m=u-49+10:u>=17?m=u-17+10:m=u,h(u>=0&&m<o,"Invalid character"),d+=m}return d}n.prototype._parseBase=function(i,f,o){this.words=[0],this.length=1;for(var d=0,m=1;m<=67108863;m*=f)d++;d--,m=m/f|0;for(var s=i.length-o,t=s%d,u=Math.min(s,s-t)+o,E=0,I=o;I<u;I+=d)E=p(i,I,I+d,f),this.imuln(m),this.words[0]+E<67108864?this.words[0]+=E:this._iaddn(E);if(t!==0){var U=1;for(E=p(i,I,i.length,f),I=0;I<t;I++)U*=f;this.imuln(U),this.words[0]+E<67108864?this.words[0]+=E:this._iaddn(E)}this._strip()},n.prototype.copy=function(i){i.words=new Array(this.length);for(var f=0;f<this.length;f++)i.words[f]=this.words[f];i.length=this.length,i.negative=this.negative,i.red=this.red};function l(r,i){r.words=i.words,r.length=i.length,r.negative=i.negative,r.red=i.red}if(n.prototype._move=function(i){l(i,this)},n.prototype.clone=function(){var i=new n(null);return this.copy(i),i},n.prototype._expand=function(i){for(;this.length<i;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=w}catch{n.prototype.inspect=w}else n.prototype.inspect=w;function w(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var _=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],S=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],B=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(i,f){i=i||10,f=f|0||1;var o;if(i===16||i==="hex"){o="";for(var d=0,m=0,s=0;s<this.length;s++){var t=this.words[s],u=((t<<d|m)&16777215).toString(16);m=t>>>24-d&16777215,d+=2,d>=26&&(d-=26,s--),m!==0||s!==this.length-1?o=_[6-u.length]+u+o:o=u+o}for(m!==0&&(o=m.toString(16)+o);o.length%f!==0;)o="0"+o;return this.negative!==0&&(o="-"+o),o}if(i===(i|0)&&i>=2&&i<=36){var E=S[i],I=B[i];o="";var U=this.clone();for(U.negative=0;!U.isZero();){var J=U.modrn(I).toString(i);U=U.idivn(I),U.isZero()?o=J+o:o=_[E-J.length]+J+o}for(this.isZero()&&(o="0"+o);o.length%f!==0;)o="0"+o;return this.negative!==0&&(o="-"+o),o}h(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var i=this.words[0];return this.length===2?i+=this.words[1]*67108864:this.length===3&&this.words[2]===1?i+=4503599627370496+this.words[1]*67108864:this.length>2&&h(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-i:i},n.prototype.toJSON=function(){return this.toString(16,2)},y&&(n.prototype.toBuffer=function(i,f){return this.toArrayLike(y,i,f)}),n.prototype.toArray=function(i,f){return this.toArrayLike(Array,i,f)};var A=function(i,f){return i.allocUnsafe?i.allocUnsafe(f):new i(f)};n.prototype.toArrayLike=function(i,f,o){this._strip();var d=this.byteLength(),m=o||Math.max(1,d);h(d<=m,"byte array longer than desired length"),h(m>0,"Requested array length <= 0");var s=A(i,m),t=f==="le"?"LE":"BE";return this["_toArrayLike"+t](s,d),s},n.prototype._toArrayLikeLE=function(i,f){for(var o=0,d=0,m=0,s=0;m<this.length;m++){var t=this.words[m]<<s|d;i[o++]=t&255,o<i.length&&(i[o++]=t>>8&255),o<i.length&&(i[o++]=t>>16&255),s===6?(o<i.length&&(i[o++]=t>>24&255),d=0,s=0):(d=t>>>24,s+=2)}if(o<i.length)for(i[o++]=d;o<i.length;)i[o++]=0},n.prototype._toArrayLikeBE=function(i,f){for(var o=i.length-1,d=0,m=0,s=0;m<this.length;m++){var t=this.words[m]<<s|d;i[o--]=t&255,o>=0&&(i[o--]=t>>8&255),o>=0&&(i[o--]=t>>16&255),s===6?(o>=0&&(i[o--]=t>>24&255),d=0,s=0):(d=t>>>24,s+=2)}if(o>=0)for(i[o--]=d;o>=0;)i[o--]=0},Math.clz32?n.prototype._countBits=function(i){return 32-Math.clz32(i)}:n.prototype._countBits=function(i){var f=i,o=0;return f>=4096&&(o+=13,f>>>=13),f>=64&&(o+=7,f>>>=7),f>=8&&(o+=4,f>>>=4),f>=2&&(o+=2,f>>>=2),o+f},n.prototype._zeroBits=function(i){if(i===0)return 26;var f=i,o=0;return(f&8191)===0&&(o+=13,f>>>=13),(f&127)===0&&(o+=7,f>>>=7),(f&15)===0&&(o+=4,f>>>=4),(f&3)===0&&(o+=2,f>>>=2),(f&1)===0&&o++,o},n.prototype.bitLength=function(){var i=this.words[this.length-1],f=this._countBits(i);return(this.length-1)*26+f};function k(r){for(var i=new Array(r.bitLength()),f=0;f<i.length;f++){var o=f/26|0,d=f%26;i[f]=r.words[o]>>>d&1}return i}n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var i=0,f=0;f<this.length;f++){var o=this._zeroBits(this.words[f]);if(i+=o,o!==26)break}return i},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(i){return this.negative!==0?this.abs().inotn(i).iaddn(1):this.clone()},n.prototype.fromTwos=function(i){return this.testn(i-1)?this.notn(i).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return this.negative!==0},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(i){for(;this.length<i.length;)this.words[this.length++]=0;for(var f=0;f<i.length;f++)this.words[f]=this.words[f]|i.words[f];return this._strip()},n.prototype.ior=function(i){return h((this.negative|i.negative)===0),this.iuor(i)},n.prototype.or=function(i){return this.length>i.length?this.clone().ior(i):i.clone().ior(this)},n.prototype.uor=function(i){return this.length>i.length?this.clone().iuor(i):i.clone().iuor(this)},n.prototype.iuand=function(i){var f;this.length>i.length?f=i:f=this;for(var o=0;o<f.length;o++)this.words[o]=this.words[o]&i.words[o];return this.length=f.length,this._strip()},n.prototype.iand=function(i){return h((this.negative|i.negative)===0),this.iuand(i)},n.prototype.and=function(i){return this.length>i.length?this.clone().iand(i):i.clone().iand(this)},n.prototype.uand=function(i){return this.length>i.length?this.clone().iuand(i):i.clone().iuand(this)},n.prototype.iuxor=function(i){var f,o;this.length>i.length?(f=this,o=i):(f=i,o=this);for(var d=0;d<o.length;d++)this.words[d]=f.words[d]^o.words[d];if(this!==f)for(;d<f.length;d++)this.words[d]=f.words[d];return this.length=f.length,this._strip()},n.prototype.ixor=function(i){return h((this.negative|i.negative)===0),this.iuxor(i)},n.prototype.xor=function(i){return this.length>i.length?this.clone().ixor(i):i.clone().ixor(this)},n.prototype.uxor=function(i){return this.length>i.length?this.clone().iuxor(i):i.clone().iuxor(this)},n.prototype.inotn=function(i){h(typeof i=="number"&&i>=0);var f=Math.ceil(i/26)|0,o=i%26;this._expand(f),o>0&&f--;for(var d=0;d<f;d++)this.words[d]=~this.words[d]&67108863;return o>0&&(this.words[d]=~this.words[d]&67108863>>26-o),this._strip()},n.prototype.notn=function(i){return this.clone().inotn(i)},n.prototype.setn=function(i,f){h(typeof i=="number"&&i>=0);var o=i/26|0,d=i%26;return this._expand(o+1),f?this.words[o]=this.words[o]|1<<d:this.words[o]=this.words[o]&~(1<<d),this._strip()},n.prototype.iadd=function(i){var f;if(this.negative!==0&&i.negative===0)return this.negative=0,f=this.isub(i),this.negative^=1,this._normSign();if(this.negative===0&&i.negative!==0)return i.negative=0,f=this.isub(i),i.negative=1,f._normSign();var o,d;this.length>i.length?(o=this,d=i):(o=i,d=this);for(var m=0,s=0;s<d.length;s++)f=(o.words[s]|0)+(d.words[s]|0)+m,this.words[s]=f&67108863,m=f>>>26;for(;m!==0&&s<o.length;s++)f=(o.words[s]|0)+m,this.words[s]=f&67108863,m=f>>>26;if(this.length=o.length,m!==0)this.words[this.length]=m,this.length++;else if(o!==this)for(;s<o.length;s++)this.words[s]=o.words[s];return this},n.prototype.add=function(i){var f;return i.negative!==0&&this.negative===0?(i.negative=0,f=this.sub(i),i.negative^=1,f):i.negative===0&&this.negative!==0?(this.negative=0,f=i.sub(this),this.negative=1,f):this.length>i.length?this.clone().iadd(i):i.clone().iadd(this)},n.prototype.isub=function(i){if(i.negative!==0){i.negative=0;var f=this.iadd(i);return i.negative=1,f._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(i),this.negative=1,this._normSign();var o=this.cmp(i);if(o===0)return this.negative=0,this.length=1,this.words[0]=0,this;var d,m;o>0?(d=this,m=i):(d=i,m=this);for(var s=0,t=0;t<m.length;t++)f=(d.words[t]|0)-(m.words[t]|0)+s,s=f>>26,this.words[t]=f&67108863;for(;s!==0&&t<d.length;t++)f=(d.words[t]|0)+s,s=f>>26,this.words[t]=f&67108863;if(s===0&&t<d.length&&d!==this)for(;t<d.length;t++)this.words[t]=d.words[t];return this.length=Math.max(this.length,t),d!==this&&(this.negative=1),this._strip()},n.prototype.sub=function(i){return this.clone().isub(i)};function R(r,i,f){f.negative=i.negative^r.negative;var o=r.length+i.length|0;f.length=o,o=o-1|0;var d=r.words[0]|0,m=i.words[0]|0,s=d*m,t=s&67108863,u=s/67108864|0;f.words[0]=t;for(var E=1;E<o;E++){for(var I=u>>>26,U=u&67108863,J=Math.min(E,i.length-1),$=Math.max(0,E-r.length+1);$<=J;$++){var C=E-$|0;d=r.words[C]|0,m=i.words[$]|0,s=d*m+U,I+=s/67108864|0,U=s&67108863}f.words[E]=U|0,u=I|0}return u!==0?f.words[E]=u|0:f.length--,f._strip()}var O=function(i,f,o){var d=i.words,m=f.words,s=o.words,t=0,u,E,I,U=d[0]|0,J=U&8191,$=U>>>13,C=d[1]|0,V=C&8191,Z=C>>>13,ee=d[2]|0,X=ee&8191,z=ee>>>13,ne=d[3]|0,Pe=ne&8191,le=ne>>>13,ce=d[4]|0,Le=ce&8191,be=ce>>>13,se=d[5]|0,Ke=se&8191,pe=se>>>13,ge=d[6]|0,De=ge&8191,me=ge>>>13,Se=d[7]|0,Ge=Se&8191,_e=Se>>>13,Oe=d[8]|0,Je=Oe&8191,H=Oe>>>13,P=d[9]|0,F=P&8191,G=P>>>13,te=m[0]|0,de=te&8191,ae=te>>>13,Me=m[1]|0,ze=Me&8191,ye=Me>>>13,Be=m[2]|0,Ue=Be&8191,Ae=Be>>>13,Te=m[3]|0,et=Te&8191,Ie=Te>>>13,Ne=m[4]|0,it=Ne&8191,K=Ne>>>13,T=m[5]|0,D=T&8191,W=T>>>13,re=m[6]|0,ve=re&8191,fe=re>>>13,xe=m[7]|0,je=xe&8191,we=xe>>>13,Re=m[8]|0,He=Re&8191,ke=Re>>>13,Ce=m[9]|0,Xe=Ce&8191,Qe=Ce>>>13;o.negative=i.negative^f.negative,o.length=19,u=Math.imul(J,de),E=Math.imul(J,ae),E=E+Math.imul($,de)|0,I=Math.imul($,ae);var lt=(t+u|0)+((E&8191)<<13)|0;t=(I+(E>>>13)|0)+(lt>>>26)|0,lt&=67108863,u=Math.imul(V,de),E=Math.imul(V,ae),E=E+Math.imul(Z,de)|0,I=Math.imul(Z,ae),u=u+Math.imul(J,ze)|0,E=E+Math.imul(J,ye)|0,E=E+Math.imul($,ze)|0,I=I+Math.imul($,ye)|0;var dt=(t+u|0)+((E&8191)<<13)|0;t=(I+(E>>>13)|0)+(dt>>>26)|0,dt&=67108863,u=Math.imul(X,de),E=Math.imul(X,ae),E=E+Math.imul(z,de)|0,I=Math.imul(z,ae),u=u+Math.imul(V,ze)|0,E=E+Math.imul(V,ye)|0,E=E+Math.imul(Z,ze)|0,I=I+Math.imul(Z,ye)|0,u=u+Math.imul(J,Ue)|0,E=E+Math.imul(J,Ae)|0,E=E+Math.imul($,Ue)|0,I=I+Math.imul($,Ae)|0;var pt=(t+u|0)+((E&8191)<<13)|0;t=(I+(E>>>13)|0)+(pt>>>26)|0,pt&=67108863,u=Math.imul(Pe,de),E=Math.imul(Pe,ae),E=E+Math.imul(le,de)|0,I=Math.imul(le,ae),u=u+Math.imul(X,ze)|0,E=E+Math.imul(X,ye)|0,E=E+Math.imul(z,ze)|0,I=I+Math.imul(z,ye)|0,u=u+Math.imul(V,Ue)|0,E=E+Math.imul(V,Ae)|0,E=E+Math.imul(Z,Ue)|0,I=I+Math.imul(Z,Ae)|0,u=u+Math.imul(J,et)|0,E=E+Math.imul(J,Ie)|0,E=E+Math.imul($,et)|0,I=I+Math.imul($,Ie)|0;var vt=(t+u|0)+((E&8191)<<13)|0;t=(I+(E>>>13)|0)+(vt>>>26)|0,vt&=67108863,u=Math.imul(Le,de),E=Math.imul(Le,ae),E=E+Math.imul(be,de)|0,I=Math.imul(be,ae),u=u+Math.imul(Pe,ze)|0,E=E+Math.imul(Pe,ye)|0,E=E+Math.imul(le,ze)|0,I=I+Math.imul(le,ye)|0,u=u+Math.imul(X,Ue)|0,E=E+Math.imul(X,Ae)|0,E=E+Math.imul(z,Ue)|0,I=I+Math.imul(z,Ae)|0,u=u+Math.imul(V,et)|0,E=E+Math.imul(V,Ie)|0,E=E+Math.imul(Z,et)|0,I=I+Math.imul(Z,Ie)|0,u=u+Math.imul(J,it)|0,E=E+Math.imul(J,K)|0,E=E+Math.imul($,it)|0,I=I+Math.imul($,K)|0;var mt=(t+u|0)+((E&8191)<<13)|0;t=(I+(E>>>13)|0)+(mt>>>26)|0,mt&=67108863,u=Math.imul(Ke,de),E=Math.imul(Ke,ae),E=E+Math.imul(pe,de)|0,I=Math.imul(pe,ae),u=u+Math.imul(Le,ze)|0,E=E+Math.imul(Le,ye)|0,E=E+Math.imul(be,ze)|0,I=I+Math.imul(be,ye)|0,u=u+Math.imul(Pe,Ue)|0,E=E+Math.imul(Pe,Ae)|0,E=E+Math.imul(le,Ue)|0,I=I+Math.imul(le,Ae)|0,u=u+Math.imul(X,et)|0,E=E+Math.imul(X,Ie)|0,E=E+Math.imul(z,et)|0,I=I+Math.imul(z,Ie)|0,u=u+Math.imul(V,it)|0,E=E+Math.imul(V,K)|0,E=E+Math.imul(Z,it)|0,I=I+Math.imul(Z,K)|0,u=u+Math.imul(J,D)|0,E=E+Math.imul(J,W)|0,E=E+Math.imul($,D)|0,I=I+Math.imul($,W)|0;var bt=(t+u|0)+((E&8191)<<13)|0;t=(I+(E>>>13)|0)+(bt>>>26)|0,bt&=67108863,u=Math.imul(De,de),E=Math.imul(De,ae),E=E+Math.imul(me,de)|0,I=Math.imul(me,ae),u=u+Math.imul(Ke,ze)|0,E=E+Math.imul(Ke,ye)|0,E=E+Math.imul(pe,ze)|0,I=I+Math.imul(pe,ye)|0,u=u+Math.imul(Le,Ue)|0,E=E+Math.imul(Le,Ae)|0,E=E+Math.imul(be,Ue)|0,I=I+Math.imul(be,Ae)|0,u=u+Math.imul(Pe,et)|0,E=E+Math.imul(Pe,Ie)|0,E=E+Math.imul(le,et)|0,I=I+Math.imul(le,Ie)|0,u=u+Math.imul(X,it)|0,E=E+Math.imul(X,K)|0,E=E+Math.imul(z,it)|0,I=I+Math.imul(z,K)|0,u=u+Math.imul(V,D)|0,E=E+Math.imul(V,W)|0,E=E+Math.imul(Z,D)|0,I=I+Math.imul(Z,W)|0,u=u+Math.imul(J,ve)|0,E=E+Math.imul(J,fe)|0,E=E+Math.imul($,ve)|0,I=I+Math.imul($,fe)|0;var gt=(t+u|0)+((E&8191)<<13)|0;t=(I+(E>>>13)|0)+(gt>>>26)|0,gt&=67108863,u=Math.imul(Ge,de),E=Math.imul(Ge,ae),E=E+Math.imul(_e,de)|0,I=Math.imul(_e,ae),u=u+Math.imul(De,ze)|0,E=E+Math.imul(De,ye)|0,E=E+Math.imul(me,ze)|0,I=I+Math.imul(me,ye)|0,u=u+Math.imul(Ke,Ue)|0,E=E+Math.imul(Ke,Ae)|0,E=E+Math.imul(pe,Ue)|0,I=I+Math.imul(pe,Ae)|0,u=u+Math.imul(Le,et)|0,E=E+Math.imul(Le,Ie)|0,E=E+Math.imul(be,et)|0,I=I+Math.imul(be,Ie)|0,u=u+Math.imul(Pe,it)|0,E=E+Math.imul(Pe,K)|0,E=E+Math.imul(le,it)|0,I=I+Math.imul(le,K)|0,u=u+Math.imul(X,D)|0,E=E+Math.imul(X,W)|0,E=E+Math.imul(z,D)|0,I=I+Math.imul(z,W)|0,u=u+Math.imul(V,ve)|0,E=E+Math.imul(V,fe)|0,E=E+Math.imul(Z,ve)|0,I=I+Math.imul(Z,fe)|0,u=u+Math.imul(J,je)|0,E=E+Math.imul(J,we)|0,E=E+Math.imul($,je)|0,I=I+Math.imul($,we)|0;var yt=(t+u|0)+((E&8191)<<13)|0;t=(I+(E>>>13)|0)+(yt>>>26)|0,yt&=67108863,u=Math.imul(Je,de),E=Math.imul(Je,ae),E=E+Math.imul(H,de)|0,I=Math.imul(H,ae),u=u+Math.imul(Ge,ze)|0,E=E+Math.imul(Ge,ye)|0,E=E+Math.imul(_e,ze)|0,I=I+Math.imul(_e,ye)|0,u=u+Math.imul(De,Ue)|0,E=E+Math.imul(De,Ae)|0,E=E+Math.imul(me,Ue)|0,I=I+Math.imul(me,Ae)|0,u=u+Math.imul(Ke,et)|0,E=E+Math.imul(Ke,Ie)|0,E=E+Math.imul(pe,et)|0,I=I+Math.imul(pe,Ie)|0,u=u+Math.imul(Le,it)|0,E=E+Math.imul(Le,K)|0,E=E+Math.imul(be,it)|0,I=I+Math.imul(be,K)|0,u=u+Math.imul(Pe,D)|0,E=E+Math.imul(Pe,W)|0,E=E+Math.imul(le,D)|0,I=I+Math.imul(le,W)|0,u=u+Math.imul(X,ve)|0,E=E+Math.imul(X,fe)|0,E=E+Math.imul(z,ve)|0,I=I+Math.imul(z,fe)|0,u=u+Math.imul(V,je)|0,E=E+Math.imul(V,we)|0,E=E+Math.imul(Z,je)|0,I=I+Math.imul(Z,we)|0,u=u+Math.imul(J,He)|0,E=E+Math.imul(J,ke)|0,E=E+Math.imul($,He)|0,I=I+Math.imul($,ke)|0;var wt=(t+u|0)+((E&8191)<<13)|0;t=(I+(E>>>13)|0)+(wt>>>26)|0,wt&=67108863,u=Math.imul(F,de),E=Math.imul(F,ae),E=E+Math.imul(G,de)|0,I=Math.imul(G,ae),u=u+Math.imul(Je,ze)|0,E=E+Math.imul(Je,ye)|0,E=E+Math.imul(H,ze)|0,I=I+Math.imul(H,ye)|0,u=u+Math.imul(Ge,Ue)|0,E=E+Math.imul(Ge,Ae)|0,E=E+Math.imul(_e,Ue)|0,I=I+Math.imul(_e,Ae)|0,u=u+Math.imul(De,et)|0,E=E+Math.imul(De,Ie)|0,E=E+Math.imul(me,et)|0,I=I+Math.imul(me,Ie)|0,u=u+Math.imul(Ke,it)|0,E=E+Math.imul(Ke,K)|0,E=E+Math.imul(pe,it)|0,I=I+Math.imul(pe,K)|0,u=u+Math.imul(Le,D)|0,E=E+Math.imul(Le,W)|0,E=E+Math.imul(be,D)|0,I=I+Math.imul(be,W)|0,u=u+Math.imul(Pe,ve)|0,E=E+Math.imul(Pe,fe)|0,E=E+Math.imul(le,ve)|0,I=I+Math.imul(le,fe)|0,u=u+Math.imul(X,je)|0,E=