2024-08-20 02:45:04 +03:00

3 lines
114 KiB
JavaScript

import{createHash as t}from"crypto";for(var r="qpzry9x8gf2tvdw0s3jn54khce6mua7l",e={},n=0;n<r.length;n++){var i=r.charAt(n);if(void 0!==e[i])throw new TypeError(i+" is ambiguous");e[i]=n}function o(t){var r=t>>25;return(33554431&t)<<5^996825010&-(r>>0&1)^642813549&-(r>>1&1)^513874426&-(r>>2&1)^1027748829&-(r>>3&1)^705979059&-(r>>4&1)}function f(t){for(var r=1,e=0;e<t.length;++e){var n=t.charCodeAt(e);if(n<33||n>126)throw new Error("Invalid prefix ("+t+")");r=o(r)^n>>5}for(r=o(r),e=0;e<t.length;++e){var i=t.charCodeAt(e);r=o(r)^31&i}return r}function u(t,r,e,n){for(var i=0,o=0,f=(1<<e)-1,u=[],a=0;a<t.length;++a)for(i=i<<r|t[a],o+=r;o>=e;)u.push(i>>(o-=e)&f);if(n)o>0&&u.push(i<<e-o&f);else{if(o>=r)throw new Error("Excess padding");if(i<<e-o&f)throw new Error("Non-zero padding")}return u}var a=function(t,r){if(r=r||90,t.length<8)throw new TypeError(t+" too short");if(t.length>r)throw new TypeError("Exceeds length limit");var n=t.toLowerCase(),i=t.toUpperCase();if(t!==n&&t!==i)throw new Error("Mixed-case string "+t);var u=(t=n).lastIndexOf("1");if(-1===u)throw new Error("No separator character for "+t);if(0===u)throw new Error("Missing prefix for "+t);var a=t.slice(0,u),s=t.slice(u+1);if(s.length<6)throw new Error("Data too short");for(var h=f(a),c=[],l=0;l<s.length;++l){var p=s.charAt(l),d=e[p];if(void 0===d)throw new Error("Unknown character "+p);h=o(h)^d,l+6>=s.length||c.push(d)}if(1!==h)throw new Error("Invalid checksum for "+t);return{prefix:a,words:c}},s=function(t,e,n){if(t.length+7+e.length>(n=n||90))throw new TypeError("Exceeds length limit");for(var i=f(t=t.toLowerCase()),u=t+"1",a=0;a<e.length;++a){var s=e[a];if(s>>5!=0)throw new Error("Non 5-bit word");i=o(i)^s,u+=r.charAt(s)}for(a=0;a<6;++a)i=o(i);for(i^=1,a=0;a<6;++a)u+=r.charAt(i>>5*(5-a)&31);return u},h=function(t){return u(t,8,5,!0)},c=function(t){return u(t,5,8,!1)};function l(t,r,e){return t(e={path:r,exports:{},require:function(t,r){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},e.exports),e.exports}var p=l(function(t){var r=function(t){var e=1e7,n=9007199254740992,i=h(n),o=Math.log(n);function f(t,r){return void 0===t?f[0]:void 0!==r?10==+r?K(t):q(t,r):K(t)}function u(t,r){this.value=t,this.sign=r,this.isSmall=!1}function a(t){this.value=t,this.sign=t<0,this.isSmall=!0}function s(t){return-n<t&&t<n}function h(t){return t<1e7?[t]:t<1e14?[t%1e7,Math.floor(t/1e7)]:[t%1e7,Math.floor(t/1e7)%1e7,Math.floor(t/1e14)]}function c(t){l(t);var r=t.length;if(r<4&&S(t,i)<0)switch(r){case 0:return 0;case 1:return t[0];case 2:return t[0]+t[1]*e;default:return t[0]+(t[1]+t[2]*e)*e}return t}function l(t){for(var r=t.length;0===t[--r];);t.length=r+1}function p(t){for(var r=new Array(t),e=-1;++e<t;)r[e]=0;return r}function d(t){return t>0?Math.floor(t):Math.ceil(t)}function g(t,r){var n,i,o=t.length,f=r.length,u=new Array(o),a=0,s=e;for(i=0;i<f;i++)u[i]=(n=t[i]+r[i]+a)-(a=n>=s?1:0)*s;for(;i<o;)n=t[i]+a,u[i++]=n-(a=n===s?1:0)*s;return a>0&&u.push(a),u}function y(t,r){return t.length>=r.length?g(t,r):g(r,t)}function v(t,r){var n,i,o=t.length,f=new Array(o),u=e;for(i=0;i<o;i++)n=t[i]-u+r,r=Math.floor(n/u),f[i]=n-r*u,r+=1;for(;r>0;)f[i++]=r%u,r=Math.floor(r/u);return f}function w(t,r){var e,n,i=t.length,o=r.length,f=new Array(i),u=0;for(e=0;e<o;e++)(n=t[e]-u-r[e])<0?(n+=1e7,u=1):u=0,f[e]=n;for(e=o;e<i;e++){if(!((n=t[e]-u)<0)){f[e++]=n;break}f[e]=n+=1e7}for(;e<i;e++)f[e]=t[e];return l(f),f}function b(t,r,e){var n,i,o=t.length,f=new Array(o),s=-r;for(n=0;n<o;n++)i=t[n]+s,s=Math.floor(i/1e7),f[n]=(i%=1e7)<0?i+1e7:i;return"number"==typeof(f=c(f))?(e&&(f=-f),new a(f)):new u(f,e)}function m(t,r){var e,n,i,o,f=t.length,u=r.length,a=p(f+u);for(i=0;i<f;++i){o=t[i];for(var s=0;s<u;++s)e=o*r[s]+a[i+s],n=Math.floor(e/1e7),a[i+s]=e-1e7*n,a[i+s+1]+=n}return l(a),a}function E(t,r){var n,i,o=t.length,f=new Array(o),u=e,a=0;for(i=0;i<o;i++)n=t[i]*r+a,a=Math.floor(n/u),f[i]=n-a*u;for(;a>0;)f[i++]=a%u,a=Math.floor(a/u);return f}function B(t,r){for(var e=[];r-- >0;)e.push(0);return e.concat(t)}function A(t,r,n){return new u(t<e?E(r,t):m(r,h(t)),n)}function U(t){var r,e,n,i,o=t.length,f=p(o+o);for(n=0;n<o;n++){e=0-(i=t[n])*i;for(var u=n;u<o;u++)r=i*t[u]*2+f[n+u]+e,e=Math.floor(r/1e7),f[n+u]=r-1e7*e;f[n+o]=e}return l(f),f}function I(t,r){var e,n,i,o,f=t.length,u=p(f);for(i=0,e=f-1;e>=0;--e)i=(o=1e7*i+t[e])-(n=d(o/r))*r,u[e]=0|n;return[u,0|i]}function _(t,r){var n,i,o=K(r),s=t.value,g=o.value;if(0===g)throw new Error("Cannot divide by zero");if(t.isSmall)return o.isSmall?[new a(d(s/g)),new a(s%g)]:[f[0],t];if(o.isSmall){if(1===g)return[t,f[0]];if(-1==g)return[t.negate(),f[0]];var y=Math.abs(g);if(y<e){i=c((n=I(s,y))[0]);var v=n[1];return t.sign&&(v=-v),"number"==typeof i?(t.sign!==o.sign&&(i=-i),[new a(i),new a(v)]):[new u(i,t.sign!==o.sign),new a(v)]}g=h(y)}var b=S(s,g);if(-1===b)return[f[0],t];if(0===b)return[f[t.sign===o.sign?1:-1],f[0]];n=s.length+g.length<=200?function(t,r){var n,i,o,f,u,a,s,h=t.length,l=r.length,d=e,g=p(r.length),y=r[l-1],v=Math.ceil(d/(2*y)),w=E(t,v),b=E(r,v);for(w.length<=h&&w.push(0),b.push(0),y=b[l-1],i=h-l;i>=0;i--){for(n=d-1,w[i+l]!==y&&(n=Math.floor((w[i+l]*d+w[i+l-1])/y)),o=0,f=0,a=b.length,u=0;u<a;u++)o+=n*b[u],s=Math.floor(o/d),f+=w[i+u]-(o-s*d),o=s,f<0?(w[i+u]=f+d,f=-1):(w[i+u]=f,f=0);for(;0!==f;){for(n-=1,o=0,u=0;u<a;u++)(o+=w[i+u]-d+b[u])<0?(w[i+u]=o+d,o=0):(w[i+u]=o,o=1);f+=o}g[i]=n}return w=I(w,v)[0],[c(g),c(w)]}(s,g):function(t,r){for(var e,n,i,o,f=t.length,u=r.length,a=[],s=[];f;)if(s.unshift(t[--f]),l(s),S(s,r)<0)a.push(0);else{i=1e7*s[(n=s.length)-1]+s[n-2],n>u&&(i=1e7*(i+1)),e=Math.ceil(i/(1e7*r[u-1]+r[u-2]));do{if(S(o=E(r,e),s)<=0)break;e--}while(e);a.push(e),s=w(s,o)}return a.reverse(),[c(a),c(s)]}(s,g);var m=t.sign!==o.sign,B=n[1],A=t.sign;return"number"==typeof(i=n[0])?(m&&(i=-i),i=new a(i)):i=new u(i,m),"number"==typeof B?(A&&(B=-B),B=new a(B)):B=new u(B,A),[i,B]}function S(t,r){if(t.length!==r.length)return t.length>r.length?1:-1;for(var e=t.length-1;e>=0;e--)if(t[e]!==r[e])return t[e]>r[e]?1:-1;return 0}function x(t){var r=t.abs();return!r.isUnit()&&(!!(r.equals(2)||r.equals(3)||r.equals(5))||!(r.isEven()||r.isDivisibleBy(3)||r.isDivisibleBy(5))&&(!!r.lesser(49)||void 0))}function k(t,e){for(var n,i,o,u=t.prev(),a=u,s=0;a.isEven();)a=a.divide(2),s++;t:for(i=0;i<e.length;i++)if(!t.lesser(e[i])&&!(o=r(e[i]).modPow(a,t)).equals(f[1])&&!o.equals(u)){for(n=s-1;0!=n;n--){if((o=o.square().mod(t)).isUnit())return!1;if(o.equals(u))continue t}return!1}return!0}u.prototype=Object.create(f.prototype),a.prototype=Object.create(f.prototype),u.prototype.add=function(t){var r=K(t);if(this.sign!==r.sign)return this.subtract(r.negate());var e=this.value,n=r.value;return new u(r.isSmall?v(e,Math.abs(n)):y(e,n),this.sign)},u.prototype.plus=u.prototype.add,a.prototype.add=function(t){var r=K(t),e=this.value;if(e<0!==r.sign)return this.subtract(r.negate());var n=r.value;if(r.isSmall){if(s(e+n))return new a(e+n);n=h(Math.abs(n))}return new u(v(n,Math.abs(e)),e<0)},a.prototype.plus=a.prototype.add,u.prototype.subtract=function(t){var r=K(t);if(this.sign!==r.sign)return this.add(r.negate());var e=this.value,n=r.value;return r.isSmall?b(e,Math.abs(n),this.sign):function(t,r,e){var n;return S(t,r)>=0?n=w(t,r):(n=w(r,t),e=!e),"number"==typeof(n=c(n))?(e&&(n=-n),new a(n)):new u(n,e)}(e,n,this.sign)},u.prototype.minus=u.prototype.subtract,a.prototype.subtract=function(t){var r=K(t),e=this.value;if(e<0!==r.sign)return this.add(r.negate());var n=r.value;return r.isSmall?new a(e-n):b(n,Math.abs(e),e>=0)},a.prototype.minus=a.prototype.subtract,u.prototype.negate=function(){return new u(this.value,!this.sign)},a.prototype.negate=function(){var t=this.sign,r=new a(-this.value);return r.sign=!t,r},u.prototype.abs=function(){return new u(this.value,!1)},a.prototype.abs=function(){return new a(Math.abs(this.value))},u.prototype.multiply=function(t){var r,n,i,o=K(t),a=this.value,s=o.value,c=this.sign!==o.sign;if(o.isSmall){if(0===s)return f[0];if(1===s)return this;if(-1===s)return this.negate();if((r=Math.abs(s))<e)return new u(E(a,r),c);s=h(r)}return-.012*(n=a.length)-.012*(i=s.length)+15e-6*n*i>0?new u(function t(r,e){var n=Math.max(r.length,e.length);if(n<=30)return m(r,e);n=Math.ceil(n/2);var i=r.slice(n),o=r.slice(0,n),f=e.slice(n),u=e.slice(0,n),a=t(o,u),s=t(i,f),h=t(y(o,i),y(u,f)),c=y(y(a,B(w(w(h,a),s),n)),B(s,2*n));return l(c),c}(a,s),c):new u(m(a,s),c)},u.prototype.times=u.prototype.multiply,a.prototype._multiplyBySmall=function(t){return s(t.value*this.value)?new a(t.value*this.value):A(Math.abs(t.value),h(Math.abs(this.value)),this.sign!==t.sign)},u.prototype._multiplyBySmall=function(t){return 0===t.value?f[0]:1===t.value?this:-1===t.value?this.negate():A(Math.abs(t.value),this.value,this.sign!==t.sign)},a.prototype.times=a.prototype.multiply=function(t){return K(t)._multiplyBySmall(this)},u.prototype.square=function(){return new u(U(this.value),!1)},a.prototype.square=function(){var t=this.value*this.value;return s(t)?new a(t):new u(U(h(Math.abs(this.value))),!1)},a.prototype.divmod=u.prototype.divmod=function(t){var r=_(this,t);return{quotient:r[0],remainder:r[1]}},a.prototype.over=a.prototype.divide=u.prototype.over=u.prototype.divide=function(t){return _(this,t)[0]},a.prototype.remainder=a.prototype.mod=u.prototype.remainder=u.prototype.mod=function(t){return _(this,t)[1]},u.prototype.pow=function(t){var r,e,n,i=K(t),o=this.value,u=i.value;if(0===u)return f[1];if(0===o)return f[0];if(1===o)return f[1];if(-1===o)return i.isEven()?f[1]:f[-1];if(i.sign)return f[0];if(!i.isSmall)throw new Error("The exponent "+i.toString()+" is too large.");if(this.isSmall&&s(r=Math.pow(o,u)))return new a(d(r));for(e=this,n=f[1];!0&u&&(n=n.times(e),--u),0!==u;)u/=2,e=e.square();return n},a.prototype.pow=u.prototype.pow,a.prototype.modPow=u.prototype.modPow=function(t,r){if(t=K(t),(r=K(r)).isZero())throw new Error("Cannot take modPow with modulus 0");for(var e=f[1],n=this.mod(r);t.isPositive();){if(n.isZero())return f[0];t.isOdd()&&(e=e.multiply(n).mod(r)),t=t.divide(2),n=n.square().mod(r)}return e},u.prototype.compareAbs=function(t){var r=K(t);return r.isSmall?1:S(this.value,r.value)},a.prototype.compareAbs=function(t){var r=K(t),e=Math.abs(this.value),n=r.value;return r.isSmall?e===(n=Math.abs(n))?0:e>n?1:-1:-1},u.prototype.compareTo=u.prototype.compare=function(t){if(Infinity===t)return-1;if(-Infinity===t)return 1;var r=K(t);return this.sign!==r.sign?r.sign?1:-1:r.isSmall?this.sign?-1:1:S(this.value,r.value)*(this.sign?-1:1)},a.prototype.compareTo=a.prototype.compare=function(t){if(Infinity===t)return-1;if(-Infinity===t)return 1;var r=K(t),e=this.value,n=r.value;return r.isSmall?e==n?0:e>n?1:-1:e<0!==r.sign?e<0?-1:1:e<0?1:-1},a.prototype.eq=a.prototype.equals=u.prototype.eq=u.prototype.equals=function(t){return 0===this.compare(t)},a.prototype.neq=a.prototype.notEquals=u.prototype.neq=u.prototype.notEquals=function(t){return 0!==this.compare(t)},a.prototype.gt=a.prototype.greater=u.prototype.gt=u.prototype.greater=function(t){return this.compare(t)>0},a.prototype.lt=a.prototype.lesser=u.prototype.lt=u.prototype.lesser=function(t){return this.compare(t)<0},a.prototype.geq=a.prototype.greaterOrEquals=u.prototype.geq=u.prototype.greaterOrEquals=function(t){return this.compare(t)>=0},a.prototype.leq=a.prototype.lesserOrEquals=u.prototype.leq=u.prototype.lesserOrEquals=function(t){return this.compare(t)<=0},u.prototype.isEven=function(){return 0==(1&this.value[0])},a.prototype.isEven=function(){return 0==(1&this.value)},u.prototype.isOdd=function(){return 1==(1&this.value[0])},a.prototype.isOdd=function(){return 1==(1&this.value)},u.prototype.isPositive=function(){return!this.sign},a.prototype.isPositive=function(){return this.value>0},u.prototype.isNegative=function(){return this.sign},a.prototype.isNegative=function(){return this.value<0},u.prototype.isUnit=function(){return!1},a.prototype.isUnit=function(){return 1===Math.abs(this.value)},u.prototype.isZero=function(){return!1},a.prototype.isZero=function(){return 0===this.value},a.prototype.isDivisibleBy=u.prototype.isDivisibleBy=function(t){var r=K(t),e=r.value;return 0!==e&&(1===e||(2===e?this.isEven():this.mod(r).equals(f[0])))},a.prototype.isPrime=u.prototype.isPrime=function(t){var e=x(this);if(void 0!==e)return e;var n=this.abs(),i=n.bitLength();if(i<=64)return k(n,[2,325,9375,28178,450775,9780504,1795265022]);for(var o=Math.log(2)*i,f=Math.ceil(!0===t?2*Math.pow(o,2):o),u=[],a=0;a<f;a++)u.push(r(a+2));return k(n,u)},a.prototype.isProbablePrime=u.prototype.isProbablePrime=function(t){var e=x(this);if(void 0!==e)return e;for(var n=this.abs(),i=void 0===t?5:t,o=[],f=0;f<i;f++)o.push(r.randBetween(2,n.minus(2)));return k(n,o)},a.prototype.modInv=u.prototype.modInv=function(t){for(var e,n,i,o=r.zero,f=r.one,u=K(t),a=this.abs();!a.equals(r.zero);)e=u.divide(a),n=o,i=u,o=f,u=a,f=n.subtract(e.multiply(f)),a=i.subtract(e.multiply(a));if(!u.equals(1))throw new Error(this.toString()+" and "+t.toString()+" are not co-prime");return-1===o.compare(0)&&(o=o.add(t)),this.isNegative()?o.negate():o},u.prototype.next=function(){var t=this.value;return this.sign?b(t,1,this.sign):new u(v(t,1),this.sign)},a.prototype.next=function(){var t=this.value;return t+1<n?new a(t+1):new u(i,!1)},u.prototype.prev=function(){var t=this.value;return this.sign?new u(v(t,1),!0):b(t,1,this.sign)},a.prototype.prev=function(){var t=this.value;return t-1>-n?new a(t-1):new u(i,!0)};for(var O=[1];2*O[O.length-1]<=e;)O.push(2*O[O.length-1]);var C=O.length,M=O[C-1];function T(t){return("number"==typeof t||"string"==typeof t)&&+Math.abs(t)<=e||t instanceof u&&t.value.length<=1}function L(t,e,n){e=K(e);for(var i=t.isNegative(),o=e.isNegative(),f=i?t.not():t,u=o?e.not():e,a=0,s=0,h=null,c=null,l=[];!f.isZero()||!u.isZero();)a=(h=_(f,M))[1].toJSNumber(),i&&(a=M-1-a),s=(c=_(u,M))[1].toJSNumber(),o&&(s=M-1-s),f=h[0],u=c[0],l.push(n(a,s));for(var p=0!==n(i?1:0,o?1:0)?r(-1):r(0),d=l.length-1;d>=0;d-=1)p=p.multiply(M).add(r(l[d]));return p}function P(t){var r=t.value,n="number"==typeof r?r|1<<30:r[0]+r[1]*e|1073758208;return n&-n}function z(t,r){return t=K(t),r=K(r),t.greater(r)?t:r}function R(t,r){return t=K(t),r=K(r),t.lesser(r)?t:r}function N(t,r){if(t=K(t).abs(),r=K(r).abs(),t.equals(r))return t;if(t.isZero())return r;if(r.isZero())return t;for(var e,n,i=f[1];t.isEven()&&r.isEven();)e=Math.min(P(t),P(r)),t=t.divide(e),r=r.divide(e),i=i.multiply(e);for(;t.isEven();)t=t.divide(P(t));do{for(;r.isEven();)r=r.divide(P(r));t.greater(r)&&(n=r,r=t,t=n),r=r.subtract(t)}while(!r.isZero());return i.isUnit()?t:t.multiply(i)}a.prototype.shiftLeft=u.prototype.shiftLeft=function(t){if(!T(t))throw new Error(String(t)+" is too large for shifting.");if((t=+t)<0)return this.shiftRight(-t);var r=this;if(r.isZero())return r;for(;t>=C;)r=r.multiply(M),t-=C-1;return r.multiply(O[t])},a.prototype.shiftRight=u.prototype.shiftRight=function(t){var r;if(!T(t))throw new Error(String(t)+" is too large for shifting.");if((t=+t)<0)return this.shiftLeft(-t);for(var e=this;t>=C;){if(e.isZero()||e.isNegative()&&e.isUnit())return e;e=(r=_(e,M))[1].isNegative()?r[0].prev():r[0],t-=C-1}return(r=_(e,O[t]))[1].isNegative()?r[0].prev():r[0]},a.prototype.not=u.prototype.not=function(){return this.negate().prev()},a.prototype.and=u.prototype.and=function(t){return L(this,t,function(t,r){return t&r})},a.prototype.or=u.prototype.or=function(t){return L(this,t,function(t,r){return t|r})},a.prototype.xor=u.prototype.xor=function(t){return L(this,t,function(t,r){return t^r})},a.prototype.bitLength=u.prototype.bitLength=function(){var t=this;return t.compareTo(r(0))<0&&(t=t.negate().subtract(r(1))),0===t.compareTo(r(0))?r(0):r(function t(e,n){if(n.compareTo(e)<=0){var i=t(e,n.square(n)),o=i.p,f=i.e,u=o.multiply(n);return u.compareTo(e)<=0?{p:u,e:2*f+1}:{p:o,e:2*f}}return{p:r(1),e:0}}(t,r(2)).e).add(r(1))};var q=function(t,r){for(var e=t.length,n=Math.abs(r),i=0;i<e;i++)if("-"!==(h=t[i].toLowerCase())&&/[a-z0-9]/.test(h)){if(/[0-9]/.test(h)&&+h>=n){if("1"===h&&1===n)continue;throw new Error(h+" is not a valid digit in base "+r+".")}if(h.charCodeAt(0)-87>=n)throw new Error(h+" is not a valid digit in base "+r+".")}if(2<=r&&r<=36&&e<=o/Math.log(r)){var f=parseInt(t,r);if(isNaN(f))throw new Error(h+" is not a valid digit in base "+r+".");return new a(parseInt(t,r))}r=K(r);var u=[],s="-"===t[0];for(i=s?1:0;i<t.length;i++){var h,c=(h=t[i].toLowerCase()).charCodeAt(0);if(48<=c&&c<=57)u.push(K(h));else if(97<=c&&c<=122)u.push(K(h.charCodeAt(0)-87));else{if("<"!==h)throw new Error(h+" is not a valid character");var l=i;do{i++}while(">"!==t[i]);u.push(K(t.slice(l+1,i)))}}return j(u,r,s)};function j(t,r,e){var n,i=f[0],o=f[1];for(n=t.length-1;n>=0;n--)i=i.add(t[n].times(o)),o=o.times(r);return e?i.negate():i}function D(t){return t<=35?"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t):"<"+t+">"}function H(t,e){if((e=r(e)).isZero()){if(t.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(e.equals(-1)){if(t.isZero())return{value:[0],isNegative:!1};if(t.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-t)).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var n=Array.apply(null,Array(+t-1)).map(Array.prototype.valueOf,[0,1]);return n.unshift([1]),{value:[].concat.apply([],n),isNegative:!1}}var i=!1;if(t.isNegative()&&e.isPositive()&&(i=!0,t=t.abs()),e.equals(1))return t.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(+t)).map(Number.prototype.valueOf,1),isNegative:i};for(var o,f=[],u=t;u.isNegative()||u.compareAbs(e)>=0;){o=u.divmod(e),u=o.quotient;var a=o.remainder;a.isNegative()&&(a=e.minus(a).abs(),u=u.next()),f.push(a.toJSNumber())}return f.push(u.toJSNumber()),{value:f.reverse(),isNegative:i}}function F(t,r){var e=H(t,r);return(e.isNegative?"-":"")+e.value.map(D).join("")}function Z(t){if(s(+t)){var r=+t;if(r===d(r))return new a(r);throw new Error("Invalid integer: "+t)}var e="-"===t[0];e&&(t=t.slice(1));var n=t.split(/e/i);if(n.length>2)throw new Error("Invalid integer: "+n.join("e"));if(2===n.length){var i=n[1];if("+"===i[0]&&(i=i.slice(1)),(i=+i)!==d(i)||!s(i))throw new Error("Invalid integer: "+i+" is not a valid exponent.");var o=n[0],f=o.indexOf(".");if(f>=0&&(i-=o.length-f-1,o=o.slice(0,f)+o.slice(f+1)),i<0)throw new Error("Cannot include negative exponent part for integers");t=o+=new Array(i+1).join("0")}if(!/^([0-9][0-9]*)$/.test(t))throw new Error("Invalid integer: "+t);for(var h=[],c=t.length,p=c-7;c>0;)h.push(+t.slice(p,c)),(p-=7)<0&&(p=0),c-=7;return l(h),new u(h,e)}function K(t){return"number"==typeof t?function(t){if(s(t)){if(t!==d(t))throw new Error(t+" is not an integer.");return new a(t)}return Z(t.toString())}(t):"string"==typeof t?Z(t):t}u.prototype.toArray=function(t){return H(this,t)},a.prototype.toArray=function(t){return H(this,t)},u.prototype.toString=function(t){if(void 0===t&&(t=10),10!==t)return F(this,t);for(var r,e=this.value,n=e.length,i=String(e[--n]);--n>=0;)r=String(e[n]),i+="0000000".slice(r.length)+r;return(this.sign?"-":"")+i},a.prototype.toString=function(t){return void 0===t&&(t=10),10!=t?F(this,t):String(this.value)},u.prototype.toJSON=a.prototype.toJSON=function(){return this.toString()},u.prototype.toJSNumber=u.prototype.valueOf=function(){return parseInt(this.toString(),10)},a.prototype.toJSNumber=a.prototype.valueOf=function(){return this.value};for(var X=0;X<1e3;X++)f[X]=new a(X),X>0&&(f[-X]=new a(-X));return f.one=f[1],f.zero=f[0],f.minusOne=f[-1],f.max=z,f.min=R,f.gcd=N,f.lcm=function(t,r){return t=K(t).abs(),r=K(r).abs(),t.divide(N(t,r)).multiply(r)},f.isInstance=function(t){return t instanceof u||t instanceof a},f.randBetween=function(t,r){var n=R(t=K(t),r=K(r)),i=z(t,r).subtract(n).add(1);if(i.isSmall)return n.add(Math.floor(Math.random()*i));for(var o=[],f=!0,s=i.value.length-1;s>=0;s--){var h=f?i.value[s]:e,l=d(Math.random()*h);o.unshift(l),l<h&&(f=!1)}return o=c(o),n.add("number"==typeof o?new a(o):new u(o,!1))},f.fromArray=function(t,r,e){return j(t.map(K),K(r||10),e)},f}();t.hasOwnProperty("exports")&&(t.exports=r)}),d=function(t){var r;if(t instanceof Uint8Array)r=t;else if(t instanceof Buffer)r=new Uint8Array(t);else{if("string"!=typeof t)throw new Error("Input must be an string, Buffer or Uint8Array");r=new Uint8Array(Buffer.from(t,"utf8"))}return r},g=function(t){return Array.prototype.map.call(t,function(t){return(t<16?"0":"")+t.toString(16)}).join("")};function y(t,r,e){var n=t[r]+t[e],i=t[r+1]+t[e+1];n>=4294967296&&i++,t[r]=n,t[r+1]=i}function v(t,r,e,n){var i=t[r]+e;e<0&&(i+=4294967296);var o=t[r+1]+n;i>=4294967296&&o++,t[r]=i,t[r+1]=o}function w(t,r){return t[r]^t[r+1]<<8^t[r+2]<<16^t[r+3]<<24}function b(t,r,e,n,i,o){var f=A[i],u=A[i+1],a=A[o],s=A[o+1];y(B,t,r),v(B,t,f,u);var h=B[n]^B[t],c=B[n+1]^B[t+1];B[n]=c,B[n+1]=h,y(B,e,n),B[r]=(h=B[r]^B[e])>>>24^(c=B[r+1]^B[e+1])<<8,B[r+1]=c>>>24^h<<8,y(B,t,r),v(B,t,a,s),B[n]=(h=B[n]^B[t])>>>16^(c=B[n+1]^B[t+1])<<16,B[n+1]=c>>>16^h<<16,y(B,e,n),B[r]=(c=B[r+1]^B[e+1])>>>31^(h=B[r]^B[e])<<1,B[r+1]=h>>>31^c<<1}var m=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),E=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map(function(t){return 2*t})),B=new Uint32Array(32),A=new Uint32Array(32);function U(t,r){var e=0;for(e=0;e<16;e++)B[e]=t.h[e],B[e+16]=m[e];for(B[24]=B[24]^t.t,B[25]=B[25]^t.t/4294967296,r&&(B[28]=~B[28],B[29]=~B[29]),e=0;e<32;e++)A[e]=w(t.b,4*e);for(e=0;e<12;e++)b(0,8,16,24,E[16*e+0],E[16*e+1]),b(2,10,18,26,E[16*e+2],E[16*e+3]),b(4,12,20,28,E[16*e+4],E[16*e+5]),b(6,14,22,30,E[16*e+6],E[16*e+7]),b(0,10,20,30,E[16*e+8],E[16*e+9]),b(2,12,22,24,E[16*e+10],E[16*e+11]),b(4,14,16,26,E[16*e+12],E[16*e+13]),b(6,8,18,28,E[16*e+14],E[16*e+15]);for(e=0;e<16;e++)t.h[e]=t.h[e]^B[e]^B[e+16]}function I(t,r){if(0===t||t>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(r&&r.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");for(var e={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:t},n=0;n<16;n++)e.h[n]=m[n];return e.h[0]^=16842752^(r?r.length:0)<<8^t,r&&(_(e,r),e.c=128),e}function _(t,r){for(var e=0;e<r.length;e++)128===t.c&&(t.t+=t.c,U(t,!1),t.c=0),t.b[t.c++]=r[e]}function S(t){for(t.t+=t.c;t.c<128;)t.b[t.c++]=0;U(t,!0);for(var r=new Uint8Array(t.outlen),e=0;e<t.outlen;e++)r[e]=t.h[e>>2]>>8*(3&e);return r}function x(t,r,e){e=e||64,t=d(t);var n=I(e,r);return _(n,t),S(n)}var k={blake2b:x,blake2bHex:function(t,r,e){var n=x(t,r,e);return g(n)},blake2bInit:I,blake2bUpdate:_,blake2bFinal:S};function O(t,r){return t[r]^t[r+1]<<8^t[r+2]<<16^t[r+3]<<24}function C(t,r,e,n,i,o){P[t]=P[t]+P[r]+i,P[n]=M(P[n]^P[t],16),P[e]=P[e]+P[n],P[r]=M(P[r]^P[e],12),P[t]=P[t]+P[r]+o,P[n]=M(P[n]^P[t],8),P[e]=P[e]+P[n],P[r]=M(P[r]^P[e],7)}function M(t,r){return t>>>r^t<<32-r}var T=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),L=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),P=new Uint32Array(16),z=new Uint32Array(16);function R(t,r){var e=0;for(e=0;e<8;e++)P[e]=t.h[e],P[e+8]=T[e];for(P[12]^=t.t,P[13]^=t.t/4294967296,r&&(P[14]=~P[14]),e=0;e<16;e++)z[e]=O(t.b,4*e);for(e=0;e<10;e++)C(0,4,8,12,z[L[16*e+0]],z[L[16*e+1]]),C(1,5,9,13,z[L[16*e+2]],z[L[16*e+3]]),C(2,6,10,14,z[L[16*e+4]],z[L[16*e+5]]),C(3,7,11,15,z[L[16*e+6]],z[L[16*e+7]]),C(0,5,10,15,z[L[16*e+8]],z[L[16*e+9]]),C(1,6,11,12,z[L[16*e+10]],z[L[16*e+11]]),C(2,7,8,13,z[L[16*e+12]],z[L[16*e+13]]),C(3,4,9,14,z[L[16*e+14]],z[L[16*e+15]]);for(e=0;e<8;e++)t.h[e]^=P[e]^P[e+8]}function N(t,r){if(!(t>0&&t<=32))throw new Error("Incorrect output length, should be in [1, 32]");var e=r?r.length:0;if(r&&!(e>0&&e<=32))throw new Error("Incorrect key length, should be in [1, 32]");var n={h:new Uint32Array(T),b:new Uint32Array(64),c:0,t:0,outlen:t};return n.h[0]^=16842752^e<<8^t,e>0&&(q(n,r),n.c=64),n}function q(t,r){for(var e=0;e<r.length;e++)64===t.c&&(t.t+=t.c,R(t,!1),t.c=0),t.b[t.c++]=r[e]}function j(t){for(t.t+=t.c;t.c<64;)t.b[t.c++]=0;R(t,!0);for(var r=new Uint8Array(t.outlen),e=0;e<t.outlen;e++)r[e]=t.h[e>>2]>>8*(3&e)&255;return r}function D(t,r,e){e=e||32,t=d(t);var n=N(e,r);return q(n,t),j(n)}for(var H={blake2s:D,blake2sHex:function(t,r,e){var n=D(t,r,e);return g(n)},blake2sInit:N,blake2sUpdate:q,blake2sFinal:j},F={blake2b:k.blake2b,blake2bHex:k.blake2bHex,blake2bInit:k.blake2bInit,blake2bUpdate:k.blake2bUpdate,blake2bFinal:k.blake2bFinal,blake2s:H.blake2s,blake2sHex:H.blake2sHex,blake2sInit:H.blake2sInit,blake2sUpdate:H.blake2sUpdate,blake2sFinal:H.blake2sFinal},Z=[],K=[],X="undefined"!=typeof Uint8Array?Uint8Array:Array,V="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Y=0,W=V.length;Y<W;++Y)Z[Y]=V[Y],K[V.charCodeAt(Y)]=Y;function J(t,r,e){for(var n,i=[],o=r;o<e;o+=3)i.push(Z[(n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]))>>18&63]+Z[n>>12&63]+Z[n>>6&63]+Z[63&n]);return i.join("")}K["-".charCodeAt(0)]=62,K["_".charCodeAt(0)]=63;var G=function(t){var r,e,n=function(t){var r=t.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=t.indexOf("=");return-1===e&&(e=r),[e,e===r?0:4-e%4]}(t),i=n[0],o=n[1],f=new X(function(t,r,e){return 3*(r+e)/4-e}(0,i,o)),u=0,a=o>0?i-4:i;for(e=0;e<a;e+=4)r=K[t.charCodeAt(e)]<<18|K[t.charCodeAt(e+1)]<<12|K[t.charCodeAt(e+2)]<<6|K[t.charCodeAt(e+3)],f[u++]=r>>16&255,f[u++]=r>>8&255,f[u++]=255&r;return 2===o&&(r=K[t.charCodeAt(e)]<<2|K[t.charCodeAt(e+1)]>>4,f[u++]=255&r),1===o&&(r=K[t.charCodeAt(e)]<<10|K[t.charCodeAt(e+1)]<<4|K[t.charCodeAt(e+2)]>>2,f[u++]=r>>8&255,f[u++]=255&r),f},Q=function(t){for(var r,e=t.length,n=e%3,i=[],o=0,f=e-n;o<f;o+=16383)i.push(J(t,o,o+16383>f?f:o+16383));return 1===n?i.push(Z[(r=t[e-1])>>2]+Z[r<<4&63]+"=="):2===n&&i.push(Z[(r=(t[e-2]<<8)+t[e-1])>>10]+Z[r>>4&63]+Z[r<<2&63]+"="),i.join("")},$=function(t,r,e,n,i){var o,f,u=8*i-n-1,a=(1<<u)-1,s=a>>1,h=-7,c=e?i-1:0,l=e?-1:1,p=t[r+c];for(c+=l,o=p&(1<<-h)-1,p>>=-h,h+=u;h>0;o=256*o+t[r+c],c+=l,h-=8);for(f=o&(1<<-h)-1,o>>=-h,h+=n;h>0;f=256*f+t[r+c],c+=l,h-=8);if(0===o)o=1-s;else{if(o===a)return f?NaN:Infinity*(p?-1:1);f+=Math.pow(2,n),o-=s}return(p?-1:1)*f*Math.pow(2,o-n)},tt=function(t,r,e,n,i,o){var f,u,a,s=8*o-i-1,h=(1<<s)-1,c=h>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,g=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||Infinity===r?(u=isNaN(r)?1:0,f=h):(f=Math.floor(Math.log(r)/Math.LN2),r*(a=Math.pow(2,-f))<1&&(f--,a*=2),(r+=f+c>=1?l/a:l*Math.pow(2,1-c))*a>=2&&(f++,a/=2),f+c>=h?(u=0,f=h):f+c>=1?(u=(r*a-1)*Math.pow(2,i),f+=c):(u=r*Math.pow(2,c-1)*Math.pow(2,i),f=0));i>=8;t[e+p]=255&u,p+=d,u/=256,i-=8);for(f=f<<i|u,s+=i;s>0;t[e+p]=255&f,p+=d,f/=256,s-=8);t[e+p-d]|=128*g},rt=l(function(t,r){var e="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function n(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var r=new Uint8Array(t);return Object.setPrototypeOf(r,i.prototype),r}function i(t,r,e){if("number"==typeof t){if("string"==typeof r)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return o(t,r,e)}function o(t,r,e){if("string"==typeof t)return function(t,r){if("string"==typeof r&&""!==r||(r="utf8"),!i.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var e=0|c(t,r),o=n(e),f=o.write(t,r);return f!==e&&(o=o.slice(0,f)),o}(t,r);if(ArrayBuffer.isView(t))return a(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(R(t,ArrayBuffer)||t&&R(t.buffer,ArrayBuffer))return s(t,r,e);if("undefined"!=typeof SharedArrayBuffer&&(R(t,SharedArrayBuffer)||t&&R(t.buffer,SharedArrayBuffer)))return s(t,r,e);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var o=t.valueOf&&t.valueOf();if(null!=o&&o!==t)return i.from(o,r,e);var f=function(t){if(i.isBuffer(t)){var r=0|h(t.length),e=n(r);return 0===e.length||t.copy(e,0,0,r),e}return void 0!==t.length?"number"!=typeof t.length||N(t.length)?n(0):a(t):"Buffer"===t.type&&Array.isArray(t.data)?a(t.data):void 0}(t);if(f)return f;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return i.from(t[Symbol.toPrimitive]("string"),r,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return f(t),n(t<0?0:0|h(t))}function a(t){for(var r=t.length<0?0:0|h(t.length),e=n(r),i=0;i<r;i+=1)e[i]=255&t[i];return e}function s(t,r,e){if(r<0||t.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<r+(e||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===r&&void 0===e?new Uint8Array(t):void 0===e?new Uint8Array(t,r):new Uint8Array(t,r,e),Object.setPrototypeOf(n,i.prototype),n}function h(t){if(t>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function c(t,r){if(i.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||R(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var e=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===e)return 0;for(var o=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return L(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return P(t).length;default:if(o)return n?-1:L(t).length;r=(""+r).toLowerCase(),o=!0}}function l(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return _(this,r,e);case"utf8":case"utf-8":return A(this,r,e);case"ascii":return U(this,r,e);case"latin1":case"binary":return I(this,r,e);case"base64":return B(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function p(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function d(t,r,e,n,o){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),N(e=+e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0){if(!o)return-1;e=0}if("string"==typeof r&&(r=i.from(r,n)),i.isBuffer(r))return 0===r.length?-1:g(t,r,e,n,o);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):g(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function g(t,r,e,n,i){var o,f=1,u=t.length,a=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;f=2,u/=2,a/=2,e/=2}function s(t,r){return 1===f?t[r]:t.readUInt16BE(r*f)}if(i){var h=-1;for(o=e;o<u;o++)if(s(t,o)===s(r,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===a)return h*f}else-1!==h&&(o-=o-h),h=-1}else for(e+a>u&&(e=u-a),o=e;o>=0;o--){for(var c=!0,l=0;l<a;l++)if(s(t,o+l)!==s(r,l)){c=!1;break}if(c)return o}return-1}function y(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n))>i&&(n=i):n=i;var o=r.length;n>o/2&&(n=o/2);for(var f=0;f<n;++f){var u=parseInt(r.substr(2*f,2),16);if(N(u))return f;t[e+f]=u}return f}function v(t,r,e,n){return z(L(r,t.length-e),t,e,n)}function w(t,r,e,n){return z(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function b(t,r,e,n){return w(t,r,e,n)}function m(t,r,e,n){return z(P(r),t,e,n)}function E(t,r,e,n){return z(function(t,r){for(var e,n,i=[],o=0;o<t.length&&!((r-=2)<0);++o)n=(e=t.charCodeAt(o))>>8,i.push(e%256),i.push(n);return i}(r,t.length-e),t,e,n)}function B(t,r,e){return Q(0===r&&e===t.length?t:t.slice(r,e))}function A(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o,f,u,a,s=t[i],h=null,c=s>239?4:s>223?3:s>191?2:1;if(i+c<=e)switch(c){case 1:s<128&&(h=s);break;case 2:128==(192&(o=t[i+1]))&&(a=(31&s)<<6|63&o)>127&&(h=a);break;case 3:f=t[i+2],128==(192&(o=t[i+1]))&&128==(192&f)&&(a=(15&s)<<12|(63&o)<<6|63&f)>2047&&(a<55296||a>57343)&&(h=a);break;case 4:f=t[i+2],u=t[i+3],128==(192&(o=t[i+1]))&&128==(192&f)&&128==(192&u)&&(a=(15&s)<<18|(63&o)<<12|(63&f)<<6|63&u)>65535&&a<1114112&&(h=a)}null===h?(h=65533,c=1):h>65535&&(n.push((h-=65536)>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=c}return function(t){var r=t.length;if(r<=4096)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return e}(n)}function U(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(127&t[i]);return n}function I(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function _(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=q[t[o]];return i}function S(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function x(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function k(t,r,e,n,o,f){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<f)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function O(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function C(t,r,e,n,i){return r=+r,e>>>=0,i||O(t,0,e,4),tt(t,r,e,n,23,4),e+4}function M(t,r,e,n,i){return r=+r,e>>>=0,i||O(t,0,e,8),tt(t,r,e,n,52,8),e+8}r.Buffer=i,r.SlowBuffer=function(t){return+t!=t&&(t=0),i.alloc(+t)},r.INSPECT_MAX_BYTES=50,r.kMaxLength=2147483647,(i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(t,r),42===t.foo()}catch(t){return!1}}())||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(i.prototype,"parent",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,r,e){return o(t,r,e)},Object.setPrototypeOf(i.prototype,Uint8Array.prototype),Object.setPrototypeOf(i,Uint8Array),i.alloc=function(t,r,e){return function(t,r,e){return f(t),t<=0?n(t):void 0!==r?"string"==typeof e?n(t).fill(r,e):n(t).fill(r):n(t)}(t,r,e)},i.allocUnsafe=function(t){return u(t)},i.allocUnsafeSlow=function(t){return u(t)},i.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==i.prototype},i.compare=function(t,r){if(R(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),R(r,Uint8Array)&&(r=i.from(r,r.offset,r.byteLength)),!i.isBuffer(t)||!i.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;for(var e=t.length,n=r.length,o=0,f=Math.min(e,n);o<f;++o)if(t[o]!==r[o]){e=t[o],n=r[o];break}return e<n?-1:n<e?1:0},i.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}},i.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return i.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=i.allocUnsafe(r),o=0;for(e=0;e<t.length;++e){var f=t[e];if(R(f,Uint8Array)&&(f=i.from(f)),!i.isBuffer(f))throw new TypeError('"list" argument must be an Array of Buffers');f.copy(n,o),o+=f.length}return n},i.byteLength=c,i.prototype._isBuffer=!0,i.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)p(this,r,r+1);return this},i.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)p(this,r,r+3),p(this,r+1,r+2);return this},i.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)p(this,r,r+7),p(this,r+1,r+6),p(this,r+2,r+5),p(this,r+3,r+4);return this},i.prototype.toLocaleString=i.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?A(this,0,t):l.apply(this,arguments)},i.prototype.equals=function(t){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===i.compare(this,t)},i.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"},e&&(i.prototype[e]=i.prototype.inspect),i.prototype.compare=function(t,r,e,n,o){if(R(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),!i.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),r<0||e>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=e)return 0;if(n>=o)return-1;if(r>=e)return 1;if(this===t)return 0;for(var f=(o>>>=0)-(n>>>=0),u=(e>>>=0)-(r>>>=0),a=Math.min(f,u),s=this.slice(n,o),h=t.slice(r,e),c=0;c<a;++c)if(s[c]!==h[c]){f=s[c],u=h[c];break}return f<u?-1:u<f?1:0},i.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},i.prototype.indexOf=function(t,r,e){return d(this,t,r,e,!0)},i.prototype.lastIndexOf=function(t,r,e){return d(this,t,r,e,!1)},i.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r>>>=0,isFinite(e)?(e>>>=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||e>i)&&(e=i),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return y(this,t,r,e);case"utf8":case"utf-8":return v(this,t,r,e);case"ascii":return w(this,t,r,e);case"latin1":case"binary":return b(this,t,r,e);case"base64":return m(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},i.prototype.slice=function(t,r){var e=this.length;(t=~~t)<0?(t+=e)<0&&(t=0):t>e&&(t=e),(r=void 0===r?e:~~r)<0?(r+=e)<0&&(r=0):r>e&&(r=e),r<t&&(r=t);var n=this.subarray(t,r);return Object.setPrototypeOf(n,i.prototype),n},i.prototype.readUIntLE=function(t,r,e){t>>>=0,r>>>=0,e||x(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n},i.prototype.readUIntBE=function(t,r,e){t>>>=0,r>>>=0,e||x(t,r,this.length);for(var n=this[t+--r],i=1;r>0&&(i*=256);)n+=this[t+--r]*i;return n},i.prototype.readUInt8=function(t,r){return t>>>=0,r||x(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,r){return t>>>=0,r||x(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,r){return t>>>=0,r||x(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,r){return t>>>=0,r||x(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,r){return t>>>=0,r||x(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,r,e){t>>>=0,r>>>=0,e||x(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*r)),n},i.prototype.readIntBE=function(t,r,e){t>>>=0,r>>>=0,e||x(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*r)),o},i.prototype.readInt8=function(t,r){return t>>>=0,r||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,r){t>>>=0,r||x(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},i.prototype.readInt16BE=function(t,r){t>>>=0,r||x(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},i.prototype.readInt32LE=function(t,r){return t>>>=0,r||x(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,r){return t>>>=0,r||x(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,r){return t>>>=0,r||x(t,4,this.length),$(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,r){return t>>>=0,r||x(t,4,this.length),$(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,r){return t>>>=0,r||x(t,8,this.length),$(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,r){return t>>>=0,r||x(t,8,this.length),$(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,r,e,n){t=+t,r>>>=0,e>>>=0,n||k(this,t,r,e,Math.pow(2,8*e)-1,0);var i=1,o=0;for(this[r]=255&t;++o<e&&(i*=256);)this[r+o]=t/i&255;return r+e},i.prototype.writeUIntBE=function(t,r,e,n){t=+t,r>>>=0,e>>>=0,n||k(this,t,r,e,Math.pow(2,8*e)-1,0);var i=e-1,o=1;for(this[r+i]=255&t;--i>=0&&(o*=256);)this[r+i]=t/o&255;return r+e},i.prototype.writeUInt8=function(t,r,e){return t=+t,r>>>=0,e||k(this,t,r,1,255,0),this[r]=255&t,r+1},i.prototype.writeUInt16LE=function(t,r,e){return t=+t,r>>>=0,e||k(this,t,r,2,65535,0),this[r]=255&t,this[r+1]=t>>>8,r+2},i.prototype.writeUInt16BE=function(t,r,e){return t=+t,r>>>=0,e||k(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=255&t,r+2},i.prototype.writeUInt32LE=function(t,r,e){return t=+t,r>>>=0,e||k(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t,r+4},i.prototype.writeUInt32BE=function(t,r,e){return t=+t,r>>>=0,e||k(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t,r+4},i.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r>>>=0,!n){var i=Math.pow(2,8*e-1);k(this,t,r,e,i-1,-i)}var o=0,f=1,u=0;for(this[r]=255&t;++o<e&&(f*=256);)t<0&&0===u&&0!==this[r+o-1]&&(u=1),this[r+o]=(t/f>>0)-u&255;return r+e},i.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r>>>=0,!n){var i=Math.pow(2,8*e-1);k(this,t,r,e,i-1,-i)}var o=e-1,f=1,u=0;for(this[r+o]=255&t;--o>=0&&(f*=256);)t<0&&0===u&&0!==this[r+o+1]&&(u=1),this[r+o]=(t/f>>0)-u&255;return r+e},i.prototype.writeInt8=function(t,r,e){return t=+t,r>>>=0,e||k(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=255&t,r+1},i.prototype.writeInt16LE=function(t,r,e){return t=+t,r>>>=0,e||k(this,t,r,2,32767,-32768),this[r]=255&t,this[r+1]=t>>>8,r+2},i.prototype.writeInt16BE=function(t,r,e){return t=+t,r>>>=0,e||k(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=255&t,r+2},i.prototype.writeInt32LE=function(t,r,e){return t=+t,r>>>=0,e||k(this,t,r,4,2147483647,-2147483648),this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4},i.prototype.writeInt32BE=function(t,r,e){return t=+t,r>>>=0,e||k(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t,r+4},i.prototype.writeFloatLE=function(t,r,e){return C(this,t,r,!0,e)},i.prototype.writeFloatBE=function(t,r,e){return C(this,t,r,!1,e)},i.prototype.writeDoubleLE=function(t,r,e){return M(this,t,r,!0,e)},i.prototype.writeDoubleBE=function(t,r,e){return M(this,t,r,!1,e)},i.prototype.copy=function(t,r,e,n){if(!i.isBuffer(t))throw new TypeError("argument should be a Buffer");if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-e&&(n=t.length-r+e);var o=n-e;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(r,e,n);else if(this===t&&e<r&&r<n)for(var f=o-1;f>=0;--f)t[f+r]=this[f+e];else Uint8Array.prototype.set.call(t,this.subarray(e,n),r);return o},i.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!i.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var f;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(f=r;f<e;++f)this[f]=t;else{var u=i.isBuffer(t)?t:i.from(t,n),a=u.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(f=0;f<e-r;++f)this[f+r]=u[f%a]}return this};var T=/[^+/0-9A-Za-z-_]/g;function L(t,r){var e;r=r||Infinity;for(var n=t.length,i=null,o=[],f=0;f<n;++f){if((e=t.charCodeAt(f))>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(f+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=65536+(i-55296<<10|e-56320)}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function P(t){return G(function(t){if((t=(t=t.split("=")[0]).trim().replace(T,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function R(t,r){return t instanceof r||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===r.name}function N(t){return t!=t}var q=function(){for(var t=new Array(256),r=0;r<16;++r)for(var e=16*r,n=0;n<16;++n)t[e+n]="0123456789abcdef"[r]+"0123456789abcdef"[n];return t}()}),et=l(function(t,r){var e=rt.Buffer;function n(t,r){for(var e in t)r[e]=t[e]}function i(t,r,n){return e(t,r,n)}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?t.exports=rt:(n(rt,r),r.Buffer=i),i.prototype=Object.create(e.prototype),n(e,i),i.from=function(t,r,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return e(t,r,n)},i.alloc=function(t,r,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=e(t);return void 0!==r?"string"==typeof n?i.fill(r,n):i.fill(r):i.fill(0),i},i.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return e(t)},i.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return rt.SlowBuffer(t)}}),nt=et.Buffer,it=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),e=0;e<r.length;e++)r[e]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),o=i.charCodeAt(0);if(255!==r[o])throw new TypeError(i+" is ambiguous");r[o]=n}var f=t.length,u=t.charAt(0),a=Math.log(f)/Math.log(256),s=Math.log(256)/Math.log(f);function h(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return nt.alloc(0);var e=0;if(" "!==t[e]){for(var n=0,i=0;t[e]===u;)n++,e++;for(var o=(t.length-e)*a+1>>>0,s=new Uint8Array(o);t[e];){var h=r[t.charCodeAt(e)];if(255===h)return;for(var c=0,l=o-1;(0!==h||c<i)&&-1!==l;l--,c++)s[l]=(h+=f*s[l]>>>0)%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");i=c,e++}if(" "!==t[e]){for(var p=o-i;p!==o&&0===s[p];)p++;var d=nt.allocUnsafe(n+(o-p));d.fill(0,0,n);for(var g=n;p!==o;)d[g++]=s[p++];return d}}}return{encode:function(r){if((Array.isArray(r)||r instanceof Uint8Array)&&(r=nt.from(r)),!nt.isBuffer(r))throw new TypeError("Expected Buffer");if(0===r.length)return"";for(var e=0,n=0,i=0,o=r.length;i!==o&&0===r[i];)i++,e++;for(var a=(o-i)*s+1>>>0,h=new Uint8Array(a);i!==o;){for(var c=r[i],l=0,p=a-1;(0!==c||l<n)&&-1!==p;p--,l++)h[p]=(c+=256*h[p]>>>0)%f>>>0,c=c/f>>>0;if(0!==c)throw new Error("Non-zero carry");n=l,i++}for(var d=a-n;d!==a&&0===h[d];)d++;for(var g=u.repeat(e);d<a;++d)g+=t.charAt(h[d]);return g},decodeUnsafe:h,decode:function(t){var r=h(t);if(r)return r;throw new Error("Non-base"+f+" character")}}},ot=it("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),ft=l(function(t,r){var e="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function n(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var r=new Uint8Array(t);return Object.setPrototypeOf(r,i.prototype),r}function i(t,r,e){if("number"==typeof t){if("string"==typeof r)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return o(t,r,e)}function o(t,r,e){if("string"==typeof t)return function(t,r){if("string"==typeof r&&""!==r||(r="utf8"),!i.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var e=0|c(t,r),o=n(e),f=o.write(t,r);return f!==e&&(o=o.slice(0,f)),o}(t,r);if(ArrayBuffer.isView(t))return a(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(R(t,ArrayBuffer)||t&&R(t.buffer,ArrayBuffer))return s(t,r,e);if("undefined"!=typeof SharedArrayBuffer&&(R(t,SharedArrayBuffer)||t&&R(t.buffer,SharedArrayBuffer)))return s(t,r,e);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var o=t.valueOf&&t.valueOf();if(null!=o&&o!==t)return i.from(o,r,e);var f=function(t){if(i.isBuffer(t)){var r=0|h(t.length),e=n(r);return 0===e.length||t.copy(e,0,0,r),e}return void 0!==t.length?"number"!=typeof t.length||N(t.length)?n(0):a(t):"Buffer"===t.type&&Array.isArray(t.data)?a(t.data):void 0}(t);if(f)return f;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return i.from(t[Symbol.toPrimitive]("string"),r,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return f(t),n(t<0?0:0|h(t))}function a(t){for(var r=t.length<0?0:0|h(t.length),e=n(r),i=0;i<r;i+=1)e[i]=255&t[i];return e}function s(t,r,e){if(r<0||t.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<r+(e||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===r&&void 0===e?new Uint8Array(t):void 0===e?new Uint8Array(t,r):new Uint8Array(t,r,e),Object.setPrototypeOf(n,i.prototype),n}function h(t){if(t>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function c(t,r){if(i.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||R(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var e=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===e)return 0;for(var o=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return L(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return P(t).length;default:if(o)return n?-1:L(t).length;r=(""+r).toLowerCase(),o=!0}}function l(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return _(this,r,e);case"utf8":case"utf-8":return A(this,r,e);case"ascii":return U(this,r,e);case"latin1":case"binary":return I(this,r,e);case"base64":return B(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function p(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function d(t,r,e,n,o){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),N(e=+e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0){if(!o)return-1;e=0}if("string"==typeof r&&(r=i.from(r,n)),i.isBuffer(r))return 0===r.length?-1:g(t,r,e,n,o);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):g(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function g(t,r,e,n,i){var o,f=1,u=t.length,a=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;f=2,u/=2,a/=2,e/=2}function s(t,r){return 1===f?t[r]:t.readUInt16BE(r*f)}if(i){var h=-1;for(o=e;o<u;o++)if(s(t,o)===s(r,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===a)return h*f}else-1!==h&&(o-=o-h),h=-1}else for(e+a>u&&(e=u-a),o=e;o>=0;o--){for(var c=!0,l=0;l<a;l++)if(s(t,o+l)!==s(r,l)){c=!1;break}if(c)return o}return-1}function y(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n))>i&&(n=i):n=i;var o=r.length;n>o/2&&(n=o/2);for(var f=0;f<n;++f){var u=parseInt(r.substr(2*f,2),16);if(N(u))return f;t[e+f]=u}return f}function v(t,r,e,n){return z(L(r,t.length-e),t,e,n)}function w(t,r,e,n){return z(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function b(t,r,e,n){return w(t,r,e,n)}function m(t,r,e,n){return z(P(r),t,e,n)}function E(t,r,e,n){return z(function(t,r){for(var e,n,i=[],o=0;o<t.length&&!((r-=2)<0);++o)n=(e=t.charCodeAt(o))>>8,i.push(e%256),i.push(n);return i}(r,t.length-e),t,e,n)}function B(t,r,e){return Q(0===r&&e===t.length?t:t.slice(r,e))}function A(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o,f,u,a,s=t[i],h=null,c=s>239?4:s>223?3:s>191?2:1;if(i+c<=e)switch(c){case 1:s<128&&(h=s);break;case 2:128==(192&(o=t[i+1]))&&(a=(31&s)<<6|63&o)>127&&(h=a);break;case 3:f=t[i+2],128==(192&(o=t[i+1]))&&128==(192&f)&&(a=(15&s)<<12|(63&o)<<6|63&f)>2047&&(a<55296||a>57343)&&(h=a);break;case 4:f=t[i+2],u=t[i+3],128==(192&(o=t[i+1]))&&128==(192&f)&&128==(192&u)&&(a=(15&s)<<18|(63&o)<<12|(63&f)<<6|63&u)>65535&&a<1114112&&(h=a)}null===h?(h=65533,c=1):h>65535&&(n.push((h-=65536)>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=c}return function(t){var r=t.length;if(r<=4096)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return e}(n)}function U(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(127&t[i]);return n}function I(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function _(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=q[t[o]];return i}function S(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function x(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function k(t,r,e,n,o,f){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<f)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function O(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function C(t,r,e,n,i){return r=+r,e>>>=0,i||O(t,0,e,4),tt(t,r,e,n,23,4),e+4}function M(t,r,e,n,i){return r=+r,e>>>=0,i||O(t,0,e,8),tt(t,r,e,n,52,8),e+8}r.Buffer=i,r.SlowBuffer=function(t){return+t!=t&&(t=0),i.alloc(+t)},r.INSPECT_MAX_BYTES=50,r.kMaxLength=2147483647,(i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(t,r),42===t.foo()}catch(t){return!1}}())||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(i.prototype,"parent",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.byteOffset}}),i.poolSize=8192,i.from=function(t,r,e){return o(t,r,e)},Object.setPrototypeOf(i.prototype,Uint8Array.prototype),Object.setPrototypeOf(i,Uint8Array),i.alloc=function(t,r,e){return function(t,r,e){return f(t),t<=0?n(t):void 0!==r?"string"==typeof e?n(t).fill(r,e):n(t).fill(r):n(t)}(t,r,e)},i.allocUnsafe=function(t){return u(t)},i.allocUnsafeSlow=function(t){return u(t)},i.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==i.prototype},i.compare=function(t,r){if(R(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),R(r,Uint8Array)&&(r=i.from(r,r.offset,r.byteLength)),!i.isBuffer(t)||!i.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;for(var e=t.length,n=r.length,o=0,f=Math.min(e,n);o<f;++o)if(t[o]!==r[o]){e=t[o],n=r[o];break}return e<n?-1:n<e?1:0},i.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}},i.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return i.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=i.allocUnsafe(r),o=0;for(e=0;e<t.length;++e){var f=t[e];if(R(f,Uint8Array)&&(f=i.from(f)),!i.isBuffer(f))throw new TypeError('"list" argument must be an Array of Buffers');f.copy(n,o),o+=f.length}return n},i.byteLength=c,i.prototype._isBuffer=!0,i.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)p(this,r,r+1);return this},i.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)p(this,r,r+3),p(this,r+1,r+2);return this},i.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)p(this,r,r+7),p(this,r+1,r+6),p(this,r+2,r+5),p(this,r+3,r+4);return this},i.prototype.toLocaleString=i.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?A(this,0,t):l.apply(this,arguments)},i.prototype.equals=function(t){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===i.compare(this,t)},i.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"},e&&(i.prototype[e]=i.prototype.inspect),i.prototype.compare=function(t,r,e,n,o){if(R(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),!i.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),r<0||e>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=e)return 0;if(n>=o)return-1;if(r>=e)return 1;if(this===t)return 0;for(var f=(o>>>=0)-(n>>>=0),u=(e>>>=0)-(r>>>=0),a=Math.min(f,u),s=this.slice(n,o),h=t.slice(r,e),c=0;c<a;++c)if(s[c]!==h[c]){f=s[c],u=h[c];break}return f<u?-1:u<f?1:0},i.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},i.prototype.indexOf=function(t,r,e){return d(this,t,r,e,!0)},i.prototype.lastIndexOf=function(t,r,e){return d(this,t,r,e,!1)},i.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r>>>=0,isFinite(e)?(e>>>=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||e>i)&&(e=i),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return y(this,t,r,e);case"utf8":case"utf-8":return v(this,t,r,e);case"ascii":return w(this,t,r,e);case"latin1":case"binary":return b(this,t,r,e);case"base64":return m(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},i.prototype.slice=function(t,r){var e=this.length;(t=~~t)<0?(t+=e)<0&&(t=0):t>e&&(t=e),(r=void 0===r?e:~~r)<0?(r+=e)<0&&(r=0):r>e&&(r=e),r<t&&(r=t);var n=this.subarray(t,r);return Object.setPrototypeOf(n,i.prototype),n},i.prototype.readUIntLE=function(t,r,e){t>>>=0,r>>>=0,e||x(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n},i.prototype.readUIntBE=function(t,r,e){t>>>=0,r>>>=0,e||x(t,r,this.length);for(var n=this[t+--r],i=1;r>0&&(i*=256);)n+=this[t+--r]*i;return n},i.prototype.readUInt8=function(t,r){return t>>>=0,r||x(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,r){return t>>>=0,r||x(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,r){return t>>>=0,r||x(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,r){return t>>>=0,r||x(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,r){return t>>>=0,r||x(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,r,e){t>>>=0,r>>>=0,e||x(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*r)),n},i.prototype.readIntBE=function(t,r,e){t>>>=0,r>>>=0,e||x(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*r)),o},i.prototype.readInt8=function(t,r){return t>>>=0,r||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,r){t>>>=0,r||x(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},i.prototype.readInt16BE=function(t,r){t>>>=0,r||x(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},i.prototype.readInt32LE=function(t,r){return t>>>=0,r||x(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,r){return t>>>=0,r||x(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,r){return t>>>=0,r||x(t,4,this.length),$(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,r){return t>>>=0,r||x(t,4,this.length),$(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,r){return t>>>=0,r||x(t,8,this.length),$(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,r){return t>>>=0,r||x(t,8,this.length),$(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,r,e,n){t=+t,r>>>=0,e>>>=0,n||k(this,t,r,e,Math.pow(2,8*e)-1,0);var i=1,o=0;for(this[r]=255&t;++o<e&&(i*=256);)this[r+o]=t/i&255;return r+e},i.prototype.writeUIntBE=function(t,r,e,n){t=+t,r>>>=0,e>>>=0,n||k(this,t,r,e,Math.pow(2,8*e)-1,0);var i=e-1,o=1;for(this[r+i]=255&t;--i>=0&&(o*=256);)this[r+i]=t/o&255;return r+e},i.prototype.writeUInt8=function(t,r,e){return t=+t,r>>>=0,e||k(this,t,r,1,255,0),this[r]=255&t,r+1},i.prototype.writeUInt16LE=function(t,r,e){return t=+t,r>>>=0,e||k(this,t,r,2,65535,0),this[r]=255&t,this[r+1]=t>>>8,r+2},i.prototype.writeUInt16BE=function(t,r,e){return t=+t,r>>>=0,e||k(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=255&t,r+2},i.prototype.writeUInt32LE=function(t,r,e){return t=+t,r>>>=0,e||k(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t,r+4},i.prototype.writeUInt32BE=function(t,r,e){return t=+t,r>>>=0,e||k(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t,r+4},i.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r>>>=0,!n){var i=Math.pow(2,8*e-1);k(this,t,r,e,i-1,-i)}var o=0,f=1,u=0;for(this[r]=255&t;++o<e&&(f*=256);)t<0&&0===u&&0!==this[r+o-1]&&(u=1),this[r+o]=(t/f>>0)-u&255;return r+e},i.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r>>>=0,!n){var i=Math.pow(2,8*e-1);k(this,t,r,e,i-1,-i)}var o=e-1,f=1,u=0;for(this[r+o]=255&t;--o>=0&&(f*=256);)t<0&&0===u&&0!==this[r+o+1]&&(u=1),this[r+o]=(t/f>>0)-u&255;return r+e},i.prototype.writeInt8=function(t,r,e){return t=+t,r>>>=0,e||k(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=255&t,r+1},i.prototype.writeInt16LE=function(t,r,e){return t=+t,r>>>=0,e||k(this,t,r,2,32767,-32768),this[r]=255&t,this[r+1]=t>>>8,r+2},i.prototype.writeInt16BE=function(t,r,e){return t=+t,r>>>=0,e||k(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=255&t,r+2},i.prototype.writeInt32LE=function(t,r,e){return t=+t,r>>>=0,e||k(this,t,r,4,2147483647,-2147483648),this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4},i.prototype.writeInt32BE=function(t,r,e){return t=+t,r>>>=0,e||k(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t,r+4},i.prototype.writeFloatLE=function(t,r,e){return C(this,t,r,!0,e)},i.prototype.writeFloatBE=function(t,r,e){return C(this,t,r,!1,e)},i.prototype.writeDoubleLE=function(t,r,e){return M(this,t,r,!0,e)},i.prototype.writeDoubleBE=function(t,r,e){return M(this,t,r,!1,e)},i.prototype.copy=function(t,r,e,n){if(!i.isBuffer(t))throw new TypeError("argument should be a Buffer");if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-e&&(n=t.length-r+e);var o=n-e;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(r,e,n);else if(this===t&&e<r&&r<n)for(var f=o-1;f>=0;--f)t[f+r]=this[f+e];else Uint8Array.prototype.set.call(t,this.subarray(e,n),r);return o},i.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!i.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var f;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(f=r;f<e;++f)this[f]=t;else{var u=i.isBuffer(t)?t:i.from(t,n),a=u.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(f=0;f<e-r;++f)this[f+r]=u[f%a]}return this};var T=/[^+/0-9A-Za-z-_]/g;function L(t,r){var e;r=r||Infinity;for(var n=t.length,i=null,o=[],f=0;f<n;++f){if((e=t.charCodeAt(f))>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(f+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=65536+(i-55296<<10|e-56320)}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function P(t){return G(function(t){if((t=(t=t.split("=")[0]).trim().replace(T,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function R(t,r){return t instanceof r||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===r.name}function N(t){return t!=t}var q=function(){for(var t=new Array(256),r=0;r<16;++r)for(var e=16*r,n=0;n<16;++n)t[e+n]="0123456789abcdef"[r]+"0123456789abcdef"[n];return t}()}),ut=function(t,r){return function(e,n){var i=2*n,o=2*r;e[i]=t[o],e[i+1]=t[o+1]}},at=l(function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var e,n=(e=ut)&&e.__esModule?e:{default:e};r.default=function(t){for(var r=t.A,e=t.C,i=0;i<25;i+=5){for(var o=0;o<5;o++)(0,n.default)(r,i+o)(e,o);for(var f=0;f<5;f++){var u=2*(i+f),a=(f+1)%5*2,s=(f+2)%5*2;r[u]^=~e[a]&e[s],r[u+1]^=~e[a+1]&e[s+1]}}}}),st=l(function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var e=new Uint32Array([0,1,0,32898,2147483648,32906,2147483648,2147516416,0,32907,0,2147483649,2147483648,2147516545,2147483648,32777,0,138,0,136,0,2147516425,0,2147483658,0,2147516555,2147483648,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,0,32778,2147483648,2147483658,2147483648,2147516545,2147483648,32896,0,2147483649,2147483648,2147516424]);r.default=e}),ht=l(function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var e,n=(e=st)&&e.__esModule?e:{default:e};r.default=function(t){var r=t.A,e=2*t.roundIndex;r[0]^=n.default[e],r[1]^=n.default[e+1]}}),ct=l(function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,r.default=[10,7,11,17,18,3,5,16,8,21,24,4,15,23,19,13,12,2,20,14,22,9,6,1]}),lt=l(function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,r.default=[1,3,6,10,15,21,28,36,45,55,2,14,27,41,56,8,25,43,62,18,39,61,20,44]}),pt=l(function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var e=o(ct),n=o(lt),i=o(ut);function o(t){return t&&t.__esModule?t:{default:t}}r.default=function(t){var r=t.A,o=t.C,f=t.W;(0,i.default)(r,1)(f,0);for(var u=0,a=0,s=0,h=32,c=0;c<24;c++){var l=e.default[c],p=n.default[c];(0,i.default)(r,l)(o,0),f[s=p<32?0:1]=(u=f[0])<<p|(a=f[1])>>>(h=32-p),f[(s+1)%2]=a<<p|u>>>h,(0,i.default)(f,0)(r,l),(0,i.default)(o,0)(f,0)}}}),dt=l(function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var e,n=(e=ut)&&e.__esModule?e:{default:e};r.default=function(t){for(var r=t.A,e=t.C,i=t.D,o=t.W,f=0,u=0,a=0;a<5;a++){var s=2*a,h=2*(a+5),c=2*(a+10),l=2*(a+15),p=2*(a+20);e[s]=r[s]^r[h]^r[c]^r[l]^r[p],e[s+1]=r[s+1]^r[h+1]^r[c+1]^r[l+1]^r[p+1]}for(var d=0;d<5;d++){(0,n.default)(e,(d+1)%5)(o,0),o[0]=(f=o[0])<<1|(u=o[1])>>>31,o[1]=u<<1|f>>>31,i[2*d]=e[(d+4)%5*2]^o[0],i[2*d+1]=e[(d+4)%5*2+1]^o[1];for(var g=0;g<25;g+=5)r[2*(g+d)]^=i[2*d],r[2*(g+d)+1]^=i[2*d+1]}}}),gt=l(function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var e=f(at),n=f(ht),i=f(pt),o=f(dt);function f(t){return t&&t.__esModule?t:{default:t}}r.default=function(){var t=new Uint32Array(10),r=new Uint32Array(10),f=new Uint32Array(2);return function(u){for(var a=0;a<24;a++)(0,o.default)({A:u,C:t,D:r,W:f}),(0,i.default)({A:u,C:t,W:f}),(0,e.default)({A:u,C:t}),(0,n.default)({A:u,roundIndex:a});t.fill(0),r.fill(0),f.fill(0)}}}),yt=l(function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var e,n=(e=gt)&&e.__esModule?e:{default:e},i=function(t,r){for(var e=0;e<t.length;e+=8){var n=e/4;r[n]^=t[e+7]<<24|t[e+6]<<16|t[e+5]<<8|t[e+4],r[n+1]^=t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}return r},o=function(t,r){for(var e=0;e<r.length;e+=8){var n=e/4;r[e]=t[n+1],r[e+1]=t[n+1]>>>8,r[e+2]=t[n+1]>>>16,r[e+3]=t[n+1]>>>24,r[e+4]=t[n],r[e+5]=t[n]>>>8,r[e+6]=t[n]>>>16,r[e+7]=t[n]>>>24}return r};r.default=function(t){var r=this,e=t.capacity,f=t.padding,u=(0,n.default)(),a=e/8,s=200-e/4,h=0,c=new Uint32Array(50),l=ft.Buffer.allocUnsafe(s);return this.absorb=function(t){for(var e=0;e<t.length;e++)l[h]=t[e],(h+=1)>=s&&(i(l,c),u(c),h=0);return r},this.squeeze=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r={buffer:t.buffer||ft.Buffer.allocUnsafe(a),padding:t.padding||f,queue:ft.Buffer.allocUnsafe(l.length),state:new Uint32Array(c.length)};l.copy(r.queue);for(var e=0;e<c.length;e++)r.state[e]=c[e];r.queue.fill(0,h),r.queue[h]|=r.padding,r.queue[s-1]|=128,i(r.queue,r.state);for(var n=0;n<r.buffer.length;n+=s)u(r.state),o(r.state,r.buffer.slice(n,n+s));return r.buffer},this.reset=function(){return l.fill(0),c.fill(0),h=0,r},this}}),vt=l(function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=r.SHAKE=r.SHA3Hash=r.SHA3=r.Keccak=void 0;var e,n=(e=yt)&&e.__esModule?e:{default:e},i=function(t){var r=t.allowedSizes,e=t.padding;return function t(){var i=this,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:512;if(!this||this.constructor!==t)return new t(o);if(r&&!r.includes(o))throw new Error("Unsupported hash length");var f=new n.default({capacity:o});return this.update=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";if(ft.Buffer.isBuffer(t))return f.absorb(t),i;if("string"==typeof t)return i.update(ft.Buffer.from(t,r));throw new TypeError("Not a string or buffer")},this.digest=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"binary",r="string"==typeof t?{format:t}:t,n=f.squeeze({buffer:r.buffer,padding:r.padding||e});return r.format&&"binary"!==r.format?n.toString(r.format):n},this.reset=function(){return f.reset(),i},this}},o=i({allowedSizes:[224,256,384,512],padding:1});r.Keccak=o;var f=i({allowedSizes:[224,256,384,512],padding:6});r.SHA3=f;var u=i({allowedSizes:[128,256],padding:31});r.SHAKE=u;var a=o;r.SHA3Hash=a,f.SHA3Hash=a,r.default=f});const wt=new Array(16),bt=Pt([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),mt=Pt([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),Et=Pt([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),Bt=Pt([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),At=Lt([0,1518500249,1859775393,2400959708,2840853838]),Ut=Lt([1352829926,1548603684,1836072691,2053994217,0]);function It(t,r){return t<<r|t>>>32-r}function _t(t,r,e,n,i,o,f,u){return It(t+(r^e^n)+o+f|0,u)+i|0}function St(t,r,e,n,i,o,f,u){return It(t+(r&e|~r&n)+o+f|0,u)+i|0}function xt(t,r,e,n,i,o,f,u){return It(t+((r|~e)^n)+o+f|0,u)+i|0}function kt(t,r,e,n,i,o,f,u){return It(t+(r&n|e&~n)+o+f|0,u)+i|0}function Ot(t,r,e,n,i,o,f,u){return It(t+(r^(e|~n))+o+f|0,u)+i|0}function Ct(t,r){return t[r>>>=0]|t[r+1]<<8|t[r+2]<<16|t[r+3]<<24}function Mt(t,r,e){return t[3+(e>>>=0)]=(r=+r)>>>24,t[e+2]=r>>>16,t[e+1]=r>>>8,t[e]=255&r,e+4}function Tt(t,r,e){return t[e>>>=0]=255&(r=+r),t[e+1]=r>>>8,t[e+2]=r>>>16,t[e+3]=r>>>24,e+4}function Lt(t){return"undefined"!=typeof Uint32Array?new Uint32Array(t):t}function Pt(t){return"undefined"!=typeof Uint8Array?new Uint8Array(t):t}function zt(t){return"undefined"!=typeof Uint8Array?new Uint8Array(t):new Array(t)}class Rt{constructor(){this._block=zt(64),this._blockSize=64,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1,this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}update(t){if(this._finalized)throw new Error("Digest already called");const r=this._block;let e=0;for(;this._blockOffset+t.length-e>=this._blockSize;){for(let n=this._blockOffset;n<this._blockSize;)r[n++]=t[e++];this._update(),this._blockOffset=0}for(;e<t.length;)r[this._blockOffset++]=t[e++];for(let r=0,e=8*t.length;e>0;++r)this._length[r]+=e,e=this._length[r]/4294967296|0,e>0&&(this._length[r]-=4294967296*e);return this}_update(){const t=wt;for(let r=0;r<16;++r)t[r]=Ct(this._block,4*r);let r=0|this._a,e=0|this._b,n=0|this._c,i=0|this._d,o=0|this._e,f=0|this._a,u=0|this._b,a=0|this._c,s=0|this._d,h=0|this._e;for(let c=0;c<80;c+=1){let l,p;c<16?(l=_t(r,e,n,i,o,t[bt[c]],At[0],Et[c]),p=Ot(f,u,a,s,h,t[mt[c]],Ut[0],Bt[c])):c<32?(l=St(r,e,n,i,o,t[bt[c]],At[1],Et[c]),p=kt(f,u,a,s,h,t[mt[c]],Ut[1],Bt[c])):c<48?(l=xt(r,e,n,i,o,t[bt[c]],At[2],Et[c]),p=xt(f,u,a,s,h,t[mt[c]],Ut[2],Bt[c])):c<64?(l=kt(r,e,n,i,o,t[bt[c]],At[3],Et[c]),p=St(f,u,a,s,h,t[mt[c]],Ut[3],Bt[c])):(l=Ot(r,e,n,i,o,t[bt[c]],At[4],Et[c]),p=_t(f,u,a,s,h,t[mt[c]],Ut[4],Bt[c])),r=o,o=i,i=It(n,10),n=e,e=l,f=h,h=s,s=It(a,10),a=u,u=p}const c=this._b+n+s|0;this._b=this._c+i+h|0,this._c=this._d+o+f|0,this._d=this._e+r+u|0,this._e=this._a+e+a|0,this._a=c}digest(){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),Mt(this._block,this._length[0],56),Mt(this._block,this._length[1],60),this._update();const t=zt(20);Tt(t,this._a,0),Tt(t,this._b,4),Tt(t,this._c,8),Tt(t,this._d,12),Tt(t,this._e,16),this._block.fill(0),this._blockOffset=0;for(let t=0;t<4;++t)this._length[t]=0;return t}}var Nt,qt=(Nt={__proto__:null,RIPEMD160:Rt,default:Rt})&&Nt.default||Nt,jt=l(function(t,r){function e(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var n=vt,i=e(it),o=et,f=e(p),u=e(ot),a=qt,s=k,h="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",c=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],l=function(t){for(var r=new ArrayBuffer(5*t.length/8),e=new Uint8Array(r),n=0;n<t.length/8;n++){for(var i=[0,0,0,0,0,0,0,0],o=0;o<8;++o)i[o]=h.indexOf(t[8*n+o]);e[5*n+0]=i[0]<<3|i[1]>>2,e[5*n+1]=(3&i[1])<<6|i[2]<<1|i[3]>>4,e[5*n+2]=(15&i[3])<<4|i[4]>>1,e[5*n+3]=(1&i[4])<<7|i[5]<<2|i[6]>>3,e[5*n+4]=(7&i[6])<<5|i[7]}return Buffer.from(e)};function d(t,r){this._block=o.Buffer.alloc(t),this._finalSize=r,this._blockSize=t,this._len=0}d.prototype.update=function(t,r){"string"==typeof t&&(t=o.Buffer.from(t,r=r||"utf8"));for(var e=this._block,n=this._blockSize,i=t.length,f=this._len,u=0;u<i;){for(var a=f%n,s=Math.min(i-u,n-a),h=0;h<s;h++)e[a+h]=t[u+h];u+=s,(f+=s)%n==0&&this._update(e)}return this._len+=i,this},d.prototype.digest=function(t){var r=this._len%this._blockSize;this._block[r]=128,this._block.fill(0,r+1),r>=this._finalSize&&(this._update(this._block),this._block.fill(0));var e=8*this._len;if(e<=4294967295)this._block.writeUInt32BE(e,this._blockSize-4);else{var n=(4294967295&e)>>>0;this._block.writeUInt32BE((e-n)/4294967296,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var i=this._hash();return t?i.toString(t):i},d.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var g,y,v=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],w=new Array(64);function b(){this.init(),this._w=w,d.call(this,64,56)}function m(t,r,e){return e^t&(r^e)}function E(t,r,e){return t&r|e&(t|r)}function B(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function A(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function U(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function I(t){return void 0!==t.length}g=b,(y=d)&&(g.super_=y,g.prototype=Object.create(y.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}})),b.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},b.prototype._update=function(t){for(var r,e=this._w,n=0|this._a,i=0|this._b,o=0|this._c,f=0|this._d,u=0|this._e,a=0|this._f,s=0|this._g,h=0|this._h,c=0;c<16;++c)e[c]=t.readInt32BE(4*c);for(;c<64;++c)e[c]=0|(((r=e[c-2])>>>17|r<<15)^(r>>>19|r<<13)^r>>>10)+e[c-7]+U(e[c-15])+e[c-16];for(var l=0;l<64;++l){var p=h+A(u)+m(u,a,s)+v[l]+e[l]|0,d=B(n)+E(n,i,o)|0;h=s,s=a,a=u,u=f+p|0,f=o,o=i,i=n,n=p+d|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=f+this._d|0,this._e=u+this._e|0,this._f=a+this._f|0,this._g=s+this._g|0,this._h=h+this._h|0},b.prototype._hash=function(){var t=o.Buffer.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t};var _=new(function(){function t(t){this.sha256=t.sha256,this.alphabet=t.alphabet,this.codec=i(this.alphabet),this.base=this.alphabet.length}var r=t.prototype;return r.encodeChecked=function(t){var r=this.sha256(this.sha256(t)).slice(0,4);return this.encodeRaw(Buffer.from(function(){for(var t=[],r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];return e.forEach(function(r){if(I(r))for(var e=0;e<r.length;e++)t.push(r[e]);else t.push(r)}),t}(t,r)))},r.encodeRaw=function(t){return this.codec.encode(t)},r.decodeChecked=function(t){var r=this.decodeRaw(t);if(r.length<5)throw new Error("invalid_input_size: decoded data must have length >= 5");if(!this.verifyCheckSum(r))throw new Error("checksum_invalid");return r.slice(0,-4)},r.decodeRaw=function(t){return this.codec.decode(t)},r.verifyCheckSum=function(t){return function(t,r){if(t.length!==r.length)return!1;for(var e=0;e<t.length;e++)if(t[e]!==r[e])return!1;return!0}(this.sha256(this.sha256(t.slice(0,-4))).slice(0,4),t.slice(-4))},t}())({sha256:function(t){return(new b).update(Buffer.from(t)).digest()},alphabet:"rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"}),S=function(t){return"0x"===t.slice(0,2)?t.slice(2):t},x=function(t,r){if(void 0===r&&(r=null),"string"!=typeof t)throw new Error("stripHexPrefix param must be type 'string', is currently type "+typeof t+".");for(var e,i=S(t).toLowerCase(),o=(e=(null!=r?r.toString()+"0x":"")+i,new n.Keccak(256).update(e).digest()).toString("hex"),f="0x",u=0;u<i.length;u++)f+=parseInt(o[u],16)>=8?i[u].toUpperCase():i[u];return f},O=function(t,r){if(!t)throw r},C=function(t,r){if(!Buffer.isBuffer(t))throw r},M=f.one,T=f.zero,L=f(3);function P(t,r){return t.and(M.shiftLeft(r)).notEquals(T)}function z(t){return f.fromArray(Array.prototype.slice.call(t,0),256)}function R(t,r){var e=t.toArray(256).value,n=r?Math.max(r-e.length,0):0;return Buffer.from([].concat(Array(n).fill(0),e))}function N(t,r,e,n){O(void 0!==n,"Missing Z coordinate"),this.curve=t,this.x=r,this.y=e,this.z=n,this._zInv=null,this.compressed=!0}Object.defineProperty(N.prototype,"zInv",{get:function(){return null===this._zInv&&(this._zInv=this.z.modInv(this.curve.p)),this._zInv}}),Object.defineProperty(N.prototype,"affineX",{get:function(){return this.x.multiply(this.zInv).mod(this.curve.p)}}),Object.defineProperty(N.prototype,"affineY",{get:function(){return this.y.multiply(this.zInv).mod(this.curve.p)}}),N.fromAffine=function(t,r,e){return new N(t,r,e,M)},N.prototype.equals=function(t){return t===this||(this.curve.isInfinity(this)?this.curve.isInfinity(t):this.curve.isInfinity(t)?this.curve.isInfinity(this):0===t.y.multiply(this.z).subtract(this.y.multiply(t.z)).mod(this.curve.p).compare(T)&&0===t.x.multiply(this.z).subtract(this.x.multiply(t.z)).mod(this.curve.p).compare(T))},N.prototype.negate=function(){var t=this.curve.p.subtract(this.y);return new N(this.curve,this.x,t,this.z)},N.prototype.add=function(t){if(this.curve.isInfinity(this))return t;if(this.curve.isInfinity(t))return this;var r=this.x,e=this.y,n=t.x,i=t.y.multiply(this.z).subtract(e.multiply(t.z)).mod(this.curve.p),o=n.multiply(this.z).subtract(r.multiply(t.z)).mod(this.curve.p);if(0===o.compare(T))return 0===i.compare(T)?this.twice():this.curve.infinity;var f=o.square(),u=f.multiply(o),a=r.multiply(f),s=i.square().multiply(this.z),h=s.subtract(a.shiftLeft(1)).multiply(t.z).subtract(u).multiply(o).mod(this.curve.p),c=a.multiply(L).multiply(i).subtract(e.multiply(u)).subtract(s.multiply(i)).multiply(t.z).add(i.multiply(u)).mod(this.curve.p),l=u.multiply(this.z).multiply(t.z).mod(this.curve.p);return new N(this.curve,h,c,l)},N.prototype.twice=function(){if(this.curve.isInfinity(this))return this;if(0===this.y.compare(T))return this.curve.infinity;var t=this.x,r=this.y,e=r.multiply(this.z).mod(this.curve.p),n=e.multiply(r).mod(this.curve.p),i=this.curve.a,o=t.square().multiply(L);0!==i.compare(T)&&(o=o.add(this.z.square().multiply(i)));var f=(o=o.mod(this.curve.p)).square().subtract(t.shiftLeft(3).multiply(n)).shiftLeft(1).multiply(e).mod(this.curve.p),u=o.multiply(L).multiply(t).subtract(n.shiftLeft(1)).shiftLeft(2).multiply(n).subtract(o.pow(3)).mod(this.curve.p),a=e.pow(3).shiftLeft(3).mod(this.curve.p);return new N(this.curve,f,u,a)},N.prototype.multiply=function(t){if(this.curve.isInfinity(this))return this;if(0===t.compare(T))return this.curve.infinity;for(var r=t,e=r.multiply(L),n=this.negate(),i=this,o=e.bitLength()-2;o>0;--o){var f=P(e,o),u=P(r,o);i=i.twice(),f!==u&&(i=i.add(f?this:n))}return i},N.prototype.multiplyTwo=function(t,r,e){for(var n=Math.max(t.bitLength(),e.bitLength())-1,i=this.curve.infinity,o=this.add(r);n>=0;){var f=P(t,n),u=P(e,n);i=i.twice(),f?i=i.add(u?o:this):u&&(i=i.add(r)),--n}return i},N.prototype.getEncoded=function(t){if(null==t&&(t=this.compressed),this.curve.isInfinity(this))return new Buffer("00","hex");var r,e=this.affineX,n=this.affineY,i=this.curve.pLength;return t?(r=new Buffer(1+i)).writeUInt8(n.isEven()?2:3,0):((r=new Buffer(1+i+i)).writeUInt8(4,0),R(n,i).copy(r,1+i)),R(e,i).copy(r,1),r},N.decodeFrom=function(t,r){var e,n=r.readUInt8(0),i=4!==n,o=Math.floor((t.p.bitLength()+7)/8),f=z(r.slice(1,1+o));if(i)O(r.length===o+1,"Invalid sequence length"),O(2===n||3===n,"Invalid sequence tag"),e=t.pointFromX(3===n,f);else{O(r.length===1+o+o,"Invalid sequence length");var u=z(r.slice(1+o));e=N.fromAffine(t,f,u)}return e.compressed=i,e},N.prototype.toString=function(){return this.curve.isInfinity(this)?"(INFINITY)":"("+this.affineX.toString()+","+this.affineY.toString()+")"};var q=f.zero,j=f.one;function D(t,r,e,n,i,o,f){this.p=t,this.a=r,this.b=e,this.G=N.fromAffine(this,n,i),this.n=o,this.h=f,this.infinity=new N(this,null,null,q),this.pOverFour=t.add(j).shiftRight(2),this.pLength=Math.floor((this.p.bitLength()+7)/8)}D.prototype.pointFromX=function(t,r){var e=r.pow(3).add(this.a.multiply(r)).add(this.b).mod(this.p).modPow(this.pOverFour,this.p),n=e;return e.isEven()^!t&&(n=this.p.subtract(n)),N.fromAffine(this,r,n)},D.prototype.isInfinity=function(t){return t===this.infinity||0===t.z.compare(q)&&0!==t.y.compare(q)},D.prototype.isOnCurve=function(t){if(this.isInfinity(t))return!0;var r=t.affineX,e=t.affineY,n=this.a,i=this.b,o=this.p;if(r.compare(q)<0||r.compareTo(o)>=0)return!1;if(e.compare(q)<0||e.compareTo(o)>=0)return!1;var f=e.square().mod(o),u=r.pow(3).add(n.multiply(r)).add(i).mod(o);return f.equals(u)},D.prototype.validate=function(t){O(!this.isInfinity(t),"Point is at infinity"),O(this.isOnCurve(t),"Point is not on the curve");var r=t.multiply(this.n);return O(this.isInfinity(r),"Point is not a scalar multiple of G"),!0};var H={p:"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f",a:"00",b:"07",n:"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",h:"01",Gx:"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",Gy:"483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"};function F(t,r){return new n.SHA3(256).update(t).digest(r)}function Z(t){return Buffer.from((new a.RIPEMD160).update(t).digest())}function K(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(C(t,"expecting keyBuffer<Buffer>"),"sha256x2"===r){var e=F(F(t)).slice(0,4);return u.encode(Buffer.concat([t,e]))}var n=[t];r&&n.push(Buffer.from(r));var i=Z(Buffer.concat(n)).slice(0,4);return u.encode(Buffer.concat([t,i]))}function X(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;O(t,"private key expected");var e,n=new Buffer(u.decode(t)),i=n.slice(-4),o=n.slice(0,-4);if("sha256x2"===r)e=F(F(o)).slice(0,4);else{var f=[o];r&&f.push(Buffer.from(r)),e=Z(Buffer.concat(f)).slice(0,4)}if(i.toString("hex")!==e.toString("hex"))throw new Error("Invalid checksum, "+"".concat(i.toString("hex")," != ").concat(e.toString("hex")));return o}var V=function(t){var r=H;if(!r)return null;var e=f(r.p,16),n=f(r.a,16),i=f(r.b,16),o=f(r.n,16),u=f(r.h,16);return new D(e,n,i,f(r.Gx,16),f(r.Gy,16),o,u)}();function Y(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"EOS";if("string"==typeof t)return Y.fromString(t,r);if(Buffer.isBuffer(t))return Y.fromBuffer(t);if("object"==typeof t&&t.Q)return Y(t.Q);function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.compressed;return t.getEncoded(r)}function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"EOS";return t+K(e())}function i(){return e().toString("hex")}return{Q:t,toString:n,toBuffer:e,toHex:i}}Y.isValid=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"EOS";try{return Y(t,r),!0}catch(t){return!1}},Y.fromBuffer=function(t){return Y(N.decodeFrom(V,t))},Y.fromString=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"EOS";try{return Y.fromStringOrThrow(t,r)}catch(t){return null}},Y.fromStringOrThrow=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"EOS",e=t.match(/^PUB_([A-Za-z0-9]+)_([A-Za-z0-9]+)$/);if(null===e){var n=new RegExp("^"+r);return n.test(t)&&(t=t.substring(r.length)),Y.fromBuffer(X(t))}var i=e[1],o=e[2];return Y.fromBuffer(X(o,i))},Y.fromHex=function(t){return Y.fromBuffer(new Buffer(t,"hex"))},Y.fromStringHex=function(t){return Y.fromString(new Buffer(t,"hex"))};var W=i("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),J=W.encode,G=W.decode,Q=function(t){return void 0===t},$={ed25519PublicKey:48,ed25519SecretSeed:144,preAuthTx:152,sha256Hash:184},tt=function(t){var r=Buffer.alloc(2);return r.writeUInt16LE(function(t,r){Buffer.isBuffer(t)||(t=new Buffer);for(var e=0,n=0;n<t.length;n++){var i=e>>>8&255;i^=255&t[n],e=e<<8&65535,e^=i^=i>>>4,e^=i=i<<5&65535,e^=i=i<<7&65535}return e}(t),0),r};function rt(t){return(rt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function nt(t,r){return(nt=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t})(t,r)}function ft(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}function ut(t,r,e){return(ut=ft()?Reflect.construct:function(t,r,e){var n=[null];n.push.apply(n,r);var i=new(Function.bind.apply(t,n));return e&&nt(i,e.prototype),i}).apply(null,arguments)}function at(t){var r="function"==typeof Map?new Map:void 0;return(at=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return ut(t,arguments,rt(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),nt(e,t)})(t)}var st=[0,1,2,42,43,68,69],ht=function(t){for(var r=new Uint8Array(t.length),e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r}("SS58PRE"),ct=function(t){var r,e;function n(){return t.apply(this,arguments)||this}return e=t,(r=n).prototype=Object.create(e.prototype),r.prototype.constructor=r,r.__proto__=e,n.prototype.toJSON=function(){return{_type:"AccountIndex",data:this+0}},n}(at(Number));function lt(t,r){t.length||(t=[t]),r.length||(r=[r]);var e=new Uint8Array(t.length+r.length);return e.set(t),e.set(r,t.length),e}function pt(t){var r=new Error;this.name=r.name="ValidationError",this.message=r.message=t,this.stack=r.stack}function dt(t,r){if(null==r&&(r="Assertion failed."),!t)throw new pt(r)}pt.prototype=Object.create(Error.prototype);var gt=function(){function t(t,r){this.hi=0|t,this.lo=0|r}return t.prototype.ushrn32=function(t){var r=this.lo;return 0==(t&=63)||(t<32?(r>>>=t,r|=this.hi<<32-t):r=this.hi>>>t-32),r},t}(),yt=Buffer.allocUnsafe(105),wt="qpzry9x8gf2tvdw0s3jn54khce6mua7l",bt=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,15,-1,10,17,21,20,26,30,7,5,-1,-1,-1,-1,-1,-1,-1,29,-1,24,13,25,9,8,23,-1,18,22,31,27,19,-1,1,0,3,16,11,28,12,14,6,4,2,-1,-1,-1,-1,-1,-1,29,-1,24,13,25,9,8,23,-1,18,22,31,27,19,-1,1,0,3,16,11,28,12,14,6,4,2,-1,-1,-1,-1,-1],mt=new gt(7,4294967295),Et=[new gt(152,4072443489),new gt(121,3077413346),new gt(243,1046459332),new gt(174,783016616),new gt(30,1329849456)];function Bt(t,r){var e=t,n=e.hi>>>3;e.hi&=mt.hi,e.lo&=mt.lo,e.hi<<=5,e.hi|=e.lo>>>27,e.lo<<=5;for(var i=0;i<Et.length;i++)n>>>i&1&&(e.hi^=Et[i].hi,e.lo^=Et[i].lo);return e.lo^=r,e}function At(t,r,e,n,i,o,f){dt(Buffer.isBuffer(t)),dt(r>>>0===r),dt(Buffer.isBuffer(e)),dt(n>>>0===n),dt((255&i)===i),dt((255&o)===o),dt("boolean"==typeof f);for(var u=(1<<o)-1,a=0,s=0;r<t.length;r++){var h=t[r];if(h>>>i!=0)throw new Error("Invalid bits.");for(a=a<<i|h,s+=i;s>=o;)e[n++]=a>>>(s-=o)&u}if(f)s&&(e[n++]=a<<o-s&u);else if(s>=i||a<<o-s&u)throw new Error("Invalid bits.");return dt(n<=e.length),e.slice(0,n)}var Ut=function(t){function r(r){var e=r.slice(0,-4),n=r.slice(-4),i=t(e);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return e}return{bs58Encode:function(r){var e=t(r);return u.encode(Buffer.concat([r,e],r.length+4))},bs58Decode:function(t){var e=r(u.decode(t));if(!e)throw new Error("Invalid checksum");return e},decodeUnsafe:function(t){var e=u.decodeUnsafe(t);if(e)return r(e)}}}(function(t){var r=(new b).update(t).digest();return(new b).update(r).digest()}),It=Ut.bs58Decode,_t=Ut.bs58Encode;r.b32decode=l,r.b32encode=function(t){var r=[],e=Math.floor(t.length/5),n=t.length%5;if(0!=n){for(var i=0;i<5-n;i++)t+="\0";e+=1}for(var o=0;o<e;o++)r.push(h.charAt(t.charCodeAt(5*o)>>3)),r.push(h.charAt((7&t.charCodeAt(5*o))<<2|t.charCodeAt(5*o+1)>>6)),r.push(h.charAt((63&t.charCodeAt(5*o+1))>>1)),r.push(h.charAt((1&t.charCodeAt(5*o+1))<<4|t.charCodeAt(5*o+2)>>4)),r.push(h.charAt((15&t.charCodeAt(5*o+2))<<1|t.charCodeAt(5*o+3)>>7)),r.push(h.charAt((127&t.charCodeAt(5*o+3))>>2)),r.push(h.charAt((3&t.charCodeAt(5*o+3))<<3|t.charCodeAt(5*o+4)>>5)),r.push(h.charAt(31&t.charCodeAt(5*o+4)));var f=0;1==n?f=6:2==n?f=4:3==n?f=3:4==n&&(f=1);for(var u=0;u<f;u++)r.pop();for(var a=0;a<f;a++)r.push("=");return r.join("")},r.bs58Decode=It,r.bs58Encode=_t,r.calculateChecksum=tt,r.cashaddrDecode=function(t,r){void 0===r&&(r="bitcoincash"),dt("string"==typeof t),dt("string"==typeof r);var e=function(t,r){if(dt("string"==typeof t),t.length<8||t.length>196)throw new Error("Invalid cashaddr data length.");for(var e=!1,n=!1,i=!1,o=0,f=0;f<t.length;f++){var u=t.charCodeAt(f);if(u>=97&&u<=122)e=!0;else if(u>=65&&u<=90)n=!0;else if(u>=48&&u<=57)i=!0;else{if(58!==u)throw new Error("Invalid cashaddr character.");if(i||0===f||f>83)throw new Error("Invalid cashaddr prefix.");if(0!==o)throw new Error("Invalid cashaddr separators.");o=f}}if(n&&e)throw new Error("Invalid cashaddr casing.");var a,s=new gt(0,1);0===o?a=r.toLowerCase():(a=t.substring(0,o).toLowerCase(),o+=1);for(var h=0;h<a.length;h++)Bt(s,31&(32|a.charCodeAt(h)));Bt(s,0);var c=t.length-o;if(c<=8||c>112)throw new Error("Invalid cashaddr data length.");for(var l=Buffer.allocUnsafe(c),p=o;p<t.length;p++){var d=t.charCodeAt(p),g=65408&d?-1:bt[d];if(-1===g)throw new Error("Invalid cashaddr character.");Bt(s,g),p+8<t.length&&(l[p-o]=g)}if(0!==s.hi||1!==s.lo||a!==r)throw new Error("Invalid cashaddr checksum.");return[a,l.slice(0,-8)]}(t,r),n=e[0],i=e[1],o=5*i.length&7;if(o>=5)throw new Error("Invalid padding in data.");if(i[i.length-1]&(1<<o)-1)throw new Error("Non zero padding.");var f=At(i,0,i,0,5,8,!1),u=f[0]>>>3&31,a=f.slice(1),s=20+4*(3&f[0]);if(4&f[0]&&(s*=2),s!==a.length)throw new Error("Invalid cashaddr data length.");return{prefix:n,type:u,hash:a}},r.cashaddrEncode=function(t,r,e){if(dt("string"==typeof t),dt((15&r)===r,"Invalid cashaddr type."),dt(Buffer.isBuffer(e)),0===t.length||t.length>83)throw new Error("Invalid cashaddr prefix.");var n=function(t){switch(dt(t>>>0===t),t){case 20:return 0;case 24:return 1;case 28:return 2;case 32:return 3;case 40:return 4;case 48:return 5;case 56:return 6;case 64:return 7;default:throw new Error("Non standard length.")}}(e.length),i=Buffer.allocUnsafe(e.length+1);return i[0]=r<<3|n,e.copy(i,1),function(t,r){dt("string"==typeof t),dt(Buffer.isBuffer(r));for(var e=new gt(0,1),n="",i=!1,o=!1,f=0;f<t.length;f++){var u=t.charCodeAt(f);if(65280&u||u>>>5==0)throw new Error("Invalid cashaddr character.");if(u>=97&&u<=122)o=!0;else if(u>=65&&u<=90)i=!0,u=u-65+97;else if(u>=48&&u<=57)throw new Error("Invalid cashaddr prefix.");Bt(e,31&u),n+=String.fromCharCode(u)}if(o&&i)throw new Error("Invalid cashaddr prefix.");Bt(e,0),n+=":";for(var a=0;a<r.length;a++){var s=r[a];if(s>>>5!=0)throw new Error("Invalid cashaddr value.");Bt(e,s),n+=wt[s]}for(var h=0;h<8;h++)Bt(e,0);e.lo^=1;for(var c=0;c<8;c++){var l=31&e.ushrn32(5*(7-c));n+=wt[l]}return n}(t,At(i,0,yt,0,8,5,!0))},r.codec=_,r.decodeCheck=function(t,r){if("string"!=typeof r)throw new TypeError("encoded argument must be of type String");var e=G(r),n=e[0],i=e.slice(0,-2),o=i.slice(1),f=e.slice(-2);if(r!==J(e))throw new Error("invalid encoded string");var u=$[t];if(Q(u))throw new Error(t+' is not a valid version byte name. expected one of "accountId" or "seed"');if(n!==u)throw new Error("invalid version byte. expected "+u+", got "+n);if(!function(t,r){if(t.length!==r.length)return!1;if(0===t.length)return!0;for(var e=0;e<t.length;e+=1)if(t[e]!==r[e])return!1;return!0}(tt(i),f))throw new Error("invalid checksum");return Buffer.from(o)},r.encodeCheck=function(t,r){if(null===r||Q(r))throw new Error("cannot encode null data");var e=$[t];if(Q(e))throw new Error(t+' is not a valid version byte name. expected one of "ed25519PublicKey", "ed25519SecretSeed", "preAuthTx", "sha256Hash"');r=Buffer.from(r);var n=Buffer.from([e]),i=Buffer.concat([n,r]),o=tt(i),f=Buffer.concat([i,o]);return J(f)},r.eosPublicKey=Y,r.hex2a=function(t){for(var r=t.toString(),e="",n=0;n<r.length;n+=2)e+=String.fromCharCode(parseInt(r.substr(n,2),16));return e},r.isValid=function(t){var r=t.toString().toUpperCase().replace(/-/g,"");if(!r||40!==r.length)return!1;var e,i=function(t){for(var r="",e=0;e<t.length;e++){var n=Math.round(t[e]).toString(16);1===n.length&&(n="0"+n),r+=n}return r}(l(r));return e=Buffer.from(i.slice(0,42),"hex"),new n.Keccak(256).update(e).digest("hex").toString().substr(0,8)===i.slice(42)},r.isValidChecksumAddress=function(t,r){return function(t){return/^0x[0-9a-fA-F]{40}$/.test(t)}(t)&&x(t,r)===t},r.ss58Decode=function(t,r){var e;void 0===r&&(r=0);try{e=u.decode(t)}catch(t){return null}if(-1===st.indexOf(e[0]))return null;if(e.length<3)return null;var n,i=e.length<=3?1:e.length<=5?2:e.length<=9?4:e.length<=17?8:32,o=e.length-1-i,f=e.slice(1,1+i);e.slice(1+e.length),32===i&&(n=f);var a=i<32?new ct(function(t){var r=0,e=1;return t.forEach(function(t){r+=t*e,e*=256}),r}(f)):new Buffer.from(f);if(e[0]%1&&!n&&!r)return null;for(var h=s.blake2b(lt(ht,e[0]%1?n||r(a):e.slice(0,1+i))),c=0;c<o;++c)if(h[c]!==e[1+i+c])return null;return a},r.ss58Encode=function(t,r,e,n,i){var o;if(void 0===r&&(r=42),void 0===e&&(e=null),void 0===n&&(n=null),-1===st.indexOf(r))throw new Error("Unknown ss58 address type",r);if("number"==typeof t||t instanceof ct){var f=t<256?1:t<65536?2:t<1?4:8;if(-1===[1,2,4,8].indexOf(n=n||f))throw new Error("Invalid length");if(n=Math.max(f,n),e&&"number"!=typeof e)throw new Error("Invalid checksum length");switch(n){case 1:e=1;break;case 2:e=[1,2].indexOf(e)+1||1;break;case 4:e=[1,2,3,4].indexOf(e)+1||1;break;case 8:e=[1,2,3,4,5,6,7,8].indexOf(e)+1||1}o=function(t,r){var e=!1;t<0&&(t=-t-1,e=!0);for(var n=new Uint8Array(r),i=0;i<r;++i)n[i]=t%256,e&&(n[i]=255&~n[i]),t/=256;return n}(t,n)}else{if(!(t instanceof Uint8Array)||32!==t.length&&35!==t.length)throw new Error("Unknown item to encode as ss58. Passing back.",t);e=2,i=o=35===t.length?t.slice(1,33):t}var a=s.blake2b(lt(ht,1&r?i:lt(r,o))),h=lt(lt(r,o),a.slice(0,e));return u.encode(Buffer.from(h))},r.stripHexPrefix=S,r.toChecksumAddress=x,r.ua2hex=function(t){for(var r="",e=0;e<t.length;e++){var n=t[e];r+=c[n>>>4],r+=c[15&n]}return r}});const Dt="13456789abcdefghijkmnopqrstuwxyz";function Ht(t){var r=Dt.indexOf(t);if(-1===r)throw new Error("Invalid character found: "+t);return r}var Ft=function(t){if(t.constructor!==Uint8Array)throw new Error("View must be a Uint8Array!");const r=t.length,e=8*r%5,n=0===e?0:5-e;let i=0,o="",f=0;for(var u=0;u<r;u++)for(i=i<<8|t[u],f+=8;f>=5;)o+=Dt[i>>>f+n-5&31],f-=5;return f>0&&(o+=Dt[i<<5-(f+n)&31]),o},Zt=require("bn.js"),Kt=function(){function t(t){void 0===t&&(t=Buffer.from([])),this.buffer=t,this.bytesRead=0}var r=t.prototype;return r.read=function(t){var r=this.buffer.slice(0,t);return this.buffer=this.buffer.slice(t),this.bytesRead+=t,r},r.write=function(t){this.buffer=Buffer.concat([this.buffer,Buffer.from(t)])},t}(),Xt=function(){function t(t){if(!t||t.length<1)throw new Error("Missing str in address");this.str=t}var r=t.prototype;return r.protocol=function(){if(this.str.length<1)throw Error("No address found.");return this.str[0]},r.payload=function(){if(this.str.length<1)throw Error("No address found.");return this.str.slice(1,this.str.length)},t}();function Vt(t){return F.blake2b(t,null,4)}function Yt(t,r){if(!r||!r.str)throw Error("Invalid address");var e="",n=r.payload(),i=r.protocol();switch(i){case 0:var o=function(t){return function(t){for(var r,e=new Zt(0),n=0;r=t.read(1)[0],e.ior(new Zt(127&r).shln(n)),r>>7!=0;)n+=7;return e}(new Kt(t)).toString()}(n);e=t+String(i)+o;break;default:var f=Buffer.from([i]),u=Vt(Buffer.concat([f,n])),a=Buffer.concat([n,Buffer.from(u)]),s=jt.hex2a(a.toString("hex")),h=jt.b32encode(s).replace(/=/g,"").toLowerCase();e=String(t)+String(i)+h}return e}function Wt(t,r){var e=Buffer.from([t]),n=Buffer.concat([e,r]);return new Xt(n)}function Jt(t,r){return function(e){var n;switch(e.readUInt8(0)){case 118:if(169!==e.readUInt8(1)||136!==e.readUInt8(e.length-2)||172!==e.readUInt8(e.length-1))throw Error("Unrecognised address format");return n=Buffer.concat([Buffer.from(t),e.slice(3,3+e.readUInt8(2))]),jt.bs58Encode(n);case 169:if(135!==e.readUInt8(e.length-1))throw Error("Unrecognised address format");return n=Buffer.concat([Buffer.from(r),e.slice(2,2+e.readUInt8(1))]),jt.bs58Encode(n);default:throw Error("Unrecognised address format")}}}function Gt(t,r){return function(e){var n=jt.bs58Decode(e),i=function(t){return t.every(function(t,r){return r<n.length&&t===n.readUInt8(r)})};if(t.some(i))return Buffer.concat([Buffer.from([118,169,20]),n.slice(t[0].length),Buffer.from([136,172])]);if(r.some(i))return Buffer.concat([Buffer.from([169,20]),n.slice(r[0].length),Buffer.from([135])]);throw Error("Unrecognised address format")}}var Qt=function(t,r,e,n){return{coinType:r,decoder:Gt(e,n),encoder:Jt(e[0],n[0]),name:t}};function $t(t,r,e){var n=function(t){return function(r){var e=r.readUInt8(0);if(e>=81&&e<=96)e-=80;else if(0!==e)throw Error("Unrecognised address format");var n=[e].concat(h(r.slice(2,r.readUInt8(1)+2)));return s(t,n)}}(t),i=Jt(r,e);return function(t){try{return i(t)}catch(r){return n(t)}}}function tr(t,r,e){var n=function(t){return function(r){var e=a(r),n=e.words;if(e.prefix!==t)throw Error("Unexpected human-readable part in bech32 encoded address");var i=c(n.slice(1)),o=n[0];return o>0&&(o+=80),Buffer.concat([Buffer.from([o,i.length]),Buffer.from(i)])}}(t),i=Gt(r,e);return function(r){return r.toLowerCase().startsWith(t+"1")?n(r):i(r)}}var rr=function(t,r,e,n,i){return{coinType:r,decoder:tr(e,n,i),encoder:$t(e,n[0],i[0]),name:t}};function er(t){return function(r){return jt.toChecksumAddress(r.toString("hex"),t||null)}}function nr(t){return function(r){var e=jt.stripHexPrefix(r);if(!jt.isValidChecksumAddress(r,t||null)&&e!==e.toLowerCase()&&e!==e.toUpperCase())throw Error("Invalid address checksum");return Buffer.from(jt.stripHexPrefix(r),"hex")}}var ir=function(t,r,e){return{coinType:r,decoder:nr(e),encoder:er(e),name:t}};function or(t){return function(r){return s(t,h(r))}}function fr(t){return function(r){var e=a(r),n=e.words;if(e.prefix!==t)throw Error("Unrecognised address format");return Buffer.from(c(n))}}var ur=function(t,r,e){return{coinType:r,decoder:fr(e),encoder:or(e),name:t}};function ar(t){return new Buffer(jt.ss58Decode(t))}function sr(t){var r=(new(require("ripemd160"))).update(t).digest();return"STM"+ot.encode(Buffer.concat([t,r.slice(0,4)]))}function hr(t){var r=require("ripemd160");if("STM"!==t.slice(0,3))throw Error("Unrecognised address format");t=t.slice(3);var e=ot.decode(t),n=e.slice(-4),i=e.slice(0,-4);if(!(new r).update(i).digest().slice(0,4).equals(n))throw Error("Invalid checksum");return Buffer.from(i)}function cr(r){return t("SHA512-256").update(r).digest("hex").substr(-8)}var lr,pr,dr,gr,yr,vr,wr=function(t,r,e,n){return{coinType:r,decoder:n,encoder:e,name:t}},br=[rr("BTC",0,"bc",[[0]],[[5]]),rr("LTC",2,"ltc",[[48]],[[50],[5]]),Qt("DOGE",3,[[30]],[[22]]),Qt("RDD",4,[[61]],[[5]]),Qt("DASH",5,[[76]],[[16]]),Qt("PPC",6,[[55]],[[117]]),wr("NMC",7,jt.bs58Encode,jt.bs58Decode),rr("MONA",22,"mona",[[50]],[[55],[5]]),wr("DCR",42,ot.encode,ot.decode),wr("XEM",43,function(t){return jt.b32encode(jt.hex2a(t.toString("hex")))},function(t){if(!jt.isValid(t))throw Error("Unrecognised address format");var r=t.toString().toUpperCase().replace(/-/g,"");return jt.b32decode(r)}),Qt("AIB",55,[[23]],[[5]]),rr("SYS",57,"sys",[[63]],[[5]]),ir("ETH",60),ir("ETC",61),wr("ICX",74,function(t){if(21!==t.length)throw Error("Unrecognised address format");switch(t.readUInt8(0)){case 0:return"hx"+t.slice(1).toString("hex");case 1:return"cx"+t.slice(1).toString("hex");default:throw Error("Unrecognised address format")}},function(t){var r=t.slice(0,2),e=t.slice(2);switch(r){case"hx":return Buffer.concat([Buffer.from([0]),Buffer.from(e,"hex")]);case"cx":return Buffer.concat([Buffer.from([1]),Buffer.from(e,"hex")]);default:throw Error("Unrecognised address format")}}),wr("ARK",111,jt.bs58Encode,function(t){var r=jt.bs58Decode(t);if(23!==r[0])throw Error("Unrecognised address format");return r}),ur("ATOM",118,"cosmos"),ur("ZIL",119,"zil"),ur("EGLD",120,"erd"),(lr=[[28,184]],pr=[[28,189]],{coinType:133,decoder:function(t,r,e){var n=Gt(r,e),i=fr("zs");return function(t){return t.toLowerCase().startsWith("zs")?i(t):n(t)}}(0,lr,pr),encoder:(dr=lr[0],gr=pr[0],yr=or("zs"),vr=Jt(dr,gr),function(t){try{return vr(t)}catch(r){return yr(t)}}),name:"ZEC"}),wr("LSK",134,function(t){return p(t.toString("hex"),16).toString(10)+"L"},function(t){return function(t){if(t.length<2||t.length>22)throw new Error("Address length does not match requirements. Expected between 2 and 22 characters.");if("L"!==t[t.length-1])throw new Error('Address format does not match requirements. Expected "L" at the end.');if(t.includes("."))throw new Error("Address format does not match requirements. Address includes invalid character: `.`.")}(t),Buffer.from(p(t.slice(0,-1)).toString(16),"hex")}),wr("STEEM",135,sr,hr),ir("RSK",137,30),wr("XRP",144,function(t){return jt.codec.encodeChecked(t)},function(t){return jt.codec.decodeChecked(t)}),wr("BCH",145,function(t){switch(t.readUInt8(0)){case 118:if(169!==t.readUInt8(1)||136!==t.readUInt8(t.length-2)||172!==t.readUInt8(t.length-1))throw Error("Unrecognised address format");return jt.cashaddrEncode("bitcoincash",0,t.slice(3,3+t.readUInt8(2)));case 169:if(135!==t.readUInt8(t.length-1))throw Error("Unrecognised address format");return jt.cashaddrEncode("bitcoincash",1,t.slice(2,2+t.readUInt8(1)));default:throw Error("Unrecognised address format")}},function(t){var r=Gt([[0]],[[5]]);try{return r(t)}catch(r){return function(t){var r=jt.cashaddrDecode(t),e=r.type,n=r.hash;if(0===e)return Buffer.concat([Buffer.from([118,169,20]),Buffer.from(n),Buffer.from([136,172])]);if(1===e)return Buffer.concat([Buffer.from([169,20]),Buffer.from(n),Buffer.from([135])]);throw Error("Unrecognised address format")}(t)}}),wr("XLM",148,function(t){return jt.encodeCheck("ed25519PublicKey",t)},function(t){return jt.decodeCheck("ed25519PublicKey",t)}),wr("NANO",165,function(t){var r=Ft(Uint8Array.from(t)),e=F.blake2b(t,null,5).reverse();return"nano_"+r+Ft(e)},function(t){var r=function(t){if("string"!=typeof t)throw new Error("Input must be a string!");var r=t.length;const e=5*r%8,n=0===e?0:8-e;for(var i=0,o=0,f=0,u=new Uint8Array(Math.ceil(5*r/8)),a=0;a<r;a++)o=o<<5|Ht(t[a]),(i+=5)>=8&&(u[f++]=o>>>i+n-8&255,i-=8);return i>0&&(u[f++]=o<<i+n-8&255),0!==e&&(u=u.slice(1)),u}(t.slice(5));return Buffer.from(r).slice(0,-5)}),wr("EOS",194,function(t){if(!jt.eosPublicKey.isValid(t))throw Error("Unrecognised address format");return jt.eosPublicKey.fromHex(t).toString()},function(t){if(!jt.eosPublicKey.isValid(t))throw Error("Unrecognised address format");return jt.eosPublicKey(t).toBuffer()}),wr("TRX",195,jt.bs58Encode,jt.bs58Decode),wr("NEO",239,jt.bs58Encode,jt.bs58Decode),wr("ALGO",283,function(t){var r=cr(t);return jt.b32encode(jt.hex2a(t.toString("hex").concat(r))).replace(/=/g,"")},function(t){var r=jt.b32decode(t);if(36!==r.length)throw Error("Unrecognised address format");var e=r.slice(0,-4),n=r.slice(-4),i=cr(e);if(n.toString("hex")!==i)throw Error("Unrecognised address format");return e}),Qt("DIVI",301,[[30]],[[13]]),ur("IOTX",304,"io"),wr("DOT",354,function(t){return jt.ss58Encode(Uint8Array.from(t),0)},ar),wr("KSM",434,function(t){return jt.ss58Encode(Uint8Array.from(t),2)},ar),wr("FIL",461,function(t){return Yt("f",Wt(t[0],t.slice(1))).toString()},function(t){return function(t){!function(t){if(!t)throw Error("No bytes to validate.");if(t.length<3)throw Error("Address is too short to validate.");if("f"!==t[0]&&"t"!==t[0])throw Error("Unknown address network.");switch(t[1]){case"0":if(t.length>22)throw Error("Invalid ID address length.");break;case"1":if(41!==t.length)throw Error("Invalid secp256k1 address length.");break;case"2":if(41!==t.length)throw Error("Invalid Actor address length.");break;case"3":if(86!==t.length)throw Error("Invalid BLS address length.");break;default:throw new Error("Invalid address protocol.")}}(t);var r,e=t[0],n=parseInt(t[1],10),i=Buffer.from([n]),o=t.slice(2);if(0===n)return Wt(n,Buffer.from((function(t,r){for(var e=new Zt(t);;){var n=e.maskn(7).toNumber();if(e.ishrn(7),e.isZero()){r.write([n]);break}r.write([128|n])}}(o,r=new Kt),r.buffer)));var f,u,a=Buffer.from(jt.b32decode(o.toUpperCase())),s=a.length,h=a.slice(0,s-4);if(f=a.slice(s-4,s),u=Vt(Buffer.concat([i,h])),Buffer.compare(Buffer.from(u),f))throw Error("Checksums don't match");var c=Wt(n,h);if(Yt(e,c)!==t)throw Error("Did not encode this address properly: "+t);return c}(t).str}),Qt("CCA",489,[[11]],[[5]]),wr("SOL",501,ot.encode,ot.decode),Qt("LRG",568,[[30]],[[13]]),rr("CCXX",571,"ccx",[[137]],[[75],[5]]),Qt("BPS",576,[[0]],[[5]]),ir("XDAI",700),ir("VET",703),ur("BNB",714,"bnb"),wr("HIVE",825,sr,hr),ur("ONE",1023,"one"),wr("ONT",1024,function(t){return jt.bs58Encode(Buffer.concat([Buffer.from([23]),t]))},function(t){var r=jt.bs58Decode(t);switch(r.readUInt8(0)){case 23:return r.slice(1);default:throw Error("Unrecognised address format")}}),{coinType:1729,decoder:function(t){var r=jt.bs58Decode(t).slice(3);switch(t.substring(0,3)){case"tz1":return Buffer.concat([Buffer.from([0,0]),r]);case"tz2":return Buffer.concat([Buffer.from([0,1]),r]);case"tz3":return Buffer.concat([Buffer.from([0,2]),r]);case"KT1":return Buffer.concat([Buffer.from([1]),r,Buffer.from([0])]);default:throw Error("Unrecognised address format")}},encoder:function(t){if(22!==t.length&&21!==t.length)throw Error("Unrecognised address format");var r;switch(t.readUInt8(0)){case 0:if(0===t.readUInt8(1))r=Buffer.from([6,161,159]);else if(1===t.readUInt8(1))r=Buffer.from([6,161,161]);else{if(2!==t.readUInt8(1))throw Error("Unrecognised address format");r=Buffer.from([6,161,164])}return jt.bs58Encode(Buffer.concat([r,t.slice(2)]));case 1:return r=Buffer.from([2,90,121]),jt.bs58Encode(Buffer.concat([r,t.slice(1,21)]));default:throw Error("Unrecognised address format")}},name:"XTZ"},ur("ADA",1815,"addr"),wr("QTUM",2301,jt.bs58Encode,jt.bs58Decode),wr("ELA",2305,ot.encode,ot.decode),{coinType:3030,decoder:function(t){var r=Buffer.alloc(20),e=new DataView(r.buffer,0,20),n=t.split(".");if(3!==n.length)throw Error("Unrecognised address format");var i=Number(n[0]),o=BigInt(n[1]),f=BigInt(n[2]);return e.setUint32(0,i),e.setBigUint64(4,o),e.setBigUint64(12,f),r},encoder:function(t){if(20!==t.length)throw Error("Unrecognised address format");var r=new DataView(t.buffer,0);return[r.getUint32(0),r.getBigUint64(4),r.getBigUint64(12)].join(".")},name:"HBAR"},wr("HNS",5353,function(t){if(20!==t.length)throw Error("P2WPKH must be 20 bytes");var r=[0].concat(h(t));return s("hs",r)},function(t){var r=a(t),e=r.words;if("hs"!==r.prefix)throw Error("Unrecognised address format");var n=e[0],i=c(e.slice(1));if(0!==n)throw Error("Bad program version");if(20!==i.length)throw Error("Witness program hash is the wrong size");return Buffer.from(i)}),ir("CELO",52752)],mr=Object.assign.apply(Object,[{}].concat(br.map(function(t){var r;return(r={})[t.name]=t,r}))),Er=Object.assign.apply(Object,[{}].concat(br.map(function(t){var r;return(r={})[t.coinType]=t,r})));export{br as formats,Er as formatsByCoinType,mr as formatsByName};
//# sourceMappingURL=index.module.js.map