biuauthui
Version:
Ui modal for biuAuth
2 lines • 2.51 MB
JavaScript
/*! For license information please see biuauthui.umd.min.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Biuauthui=t():e.Biuauthui=t()}(self,(()=>(()=>{var __webpack_modules__={8791:(e,t,n)=>{"use strict";n.d(t,{$c:()=>Zn,Z_:()=>Jn});var r=n(9822),o=n(1395),i=n(7022),a=n.n(i),s=n(8679),l=n(8166),c=n.n(l),u=n(7834),d=n(7339),f=n.n(d);const h=new Array(16),p=N([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]),g=N([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]),m=N([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]),y=N([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]),A=M([0,1518500249,1859775393,2400959708,2840853838]),b=M([1352829926,1548603684,1836072691,2053994217,0]);function v(e,t){return e<<t|e>>>32-t}function w(e,t,n,r,o,i,a,s){return v(e+(t^n^r)+i+a|0,s)+o|0}function E(e,t,n,r,o,i,a,s){return v(e+(t&n|~t&r)+i+a|0,s)+o|0}function x(e,t,n,r,o,i,a,s){return v(e+((t|~n)^r)+i+a|0,s)+o|0}function C(e,t,n,r,o,i,a,s){return v(e+(t&r|n&~r)+i+a|0,s)+o|0}function I(e,t,n,r,o,i,a,s){return v(e+(t^(n|~r))+i+a|0,s)+o|0}function S(e,t,n){return t=+t,e[3+(n>>>=0)]=t>>>24,e[n+2]=t>>>16,e[n+1]=t>>>8,e[n]=255&t,n+4}function k(e,t,n){return t=+t,e[n>>>=0]=255&t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24,n+4}function M(e){return"undefined"!=typeof Uint32Array?new Uint32Array(e):e}function N(e){return"undefined"!=typeof Uint8Array?new Uint8Array(e):e}function T(e){return"undefined"!=typeof Uint8Array?new Uint8Array(e):new Array(e)}class O{constructor(){this._block=T(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(e){if(this._finalized)throw new Error("Digest already called");const t=this._block;let n=0;for(;this._blockOffset+e.length-n>=this._blockSize;){for(let r=this._blockOffset;r<this._blockSize;)t[r++]=e[n++];this._update(),this._blockOffset=0}for(;n<e.length;)t[this._blockOffset++]=e[n++];for(let t=0,n=8*e.length;n>0;++t)this._length[t]+=n,n=this._length[t]/4294967296|0,n>0&&(this._length[t]-=4294967296*n);return this}_update(){const e=h;for(let r=0;r<16;++r)e[r]=(n=4*r,(t=this._block)[n>>>=0]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24);var t,n;let r=0|this._a,o=0|this._b,i=0|this._c,a=0|this._d,s=0|this._e,l=0|this._a,c=0|this._b,u=0|this._c,d=0|this._d,f=0|this._e;for(let t=0;t<80;t+=1){let n,h;t<16?(n=w(r,o,i,a,s,e[p[t]],A[0],m[t]),h=I(l,c,u,d,f,e[g[t]],b[0],y[t])):t<32?(n=E(r,o,i,a,s,e[p[t]],A[1],m[t]),h=C(l,c,u,d,f,e[g[t]],b[1],y[t])):t<48?(n=x(r,o,i,a,s,e[p[t]],A[2],m[t]),h=x(l,c,u,d,f,e[g[t]],b[2],y[t])):t<64?(n=C(r,o,i,a,s,e[p[t]],A[3],m[t]),h=E(l,c,u,d,f,e[g[t]],b[3],y[t])):(n=I(r,o,i,a,s,e[p[t]],A[4],m[t]),h=w(l,c,u,d,f,e[g[t]],b[4],y[t])),r=s,s=a,a=v(i,10),i=o,o=n,l=f,f=d,d=v(u,10),u=c,c=h}const S=this._b+i+d|0;this._b=this._c+a+f|0,this._c=this._d+s+l|0,this._d=this._e+r+c|0,this._e=this._a+o+u|0,this._a=S}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),S(this._block,this._length[0],56),S(this._block,this._length[1],60),this._update();const e=T(20);k(e,this._a,0),k(e,this._b,4),k(e,this._c,8),k(e,this._d,12),k(e,this._e,16),this._block.fill(0),this._blockOffset=0;for(let e=0;e<4;++e)this._length[e]=0;return e}}var _=n(651),B=n(8834).Buffer,D="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",j=function(e){for(var t=e.toString(),n="",r=0;r<t.length;r+=2)n+=String.fromCharCode(parseInt(t.substr(r,2),16));return n},R=function(e){for(var t=new ArrayBuffer(5*e.length/8),n=new Uint8Array(t),r=0;r<e.length/8;r++){for(var o=[0,0,0,0,0,0,0,0],i=0;i<8;++i)o[i]=D.indexOf(e[8*r+i]);n[5*r+0]=o[0]<<3|o[1]>>2,n[5*r+1]=(3&o[1])<<6|o[2]<<1|o[3]>>4,n[5*r+2]=(15&o[3])<<4|o[4]>>1,n[5*r+3]=(1&o[4])<<7|o[5]<<2|o[6]>>3,n[5*r+4]=(7&o[6])<<5|o[7]}return n},L=function(e){var t=[],n=Math.floor(e.length/5),r=e.length%5;if(0!=r){for(var o=0;o<5-r;o++)e+="\0";n+=1}for(var i=0;i<n;i++)t.push(D.charAt(e.charCodeAt(5*i)>>3)),t.push(D.charAt((7&e.charCodeAt(5*i))<<2|e.charCodeAt(5*i+1)>>6)),t.push(D.charAt((63&e.charCodeAt(5*i+1))>>1)),t.push(D.charAt((1&e.charCodeAt(5*i+1))<<4|e.charCodeAt(5*i+2)>>4)),t.push(D.charAt((15&e.charCodeAt(5*i+2))<<1|e.charCodeAt(5*i+3)>>7)),t.push(D.charAt((127&e.charCodeAt(5*i+3))>>2)),t.push(D.charAt((3&e.charCodeAt(5*i+3))<<3|e.charCodeAt(5*i+4)>>5)),t.push(D.charAt(31&e.charCodeAt(5*i+4)));var a=0;1==r?a=6:2==r?a=4:3==r?a=3:4==r&&(a=1);for(var s=0;s<a;s++)t.pop();for(var l=0;l<a;l++)t.push("=");return t.join("")};function P(e,t){this._block=u.Buffer.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}P.prototype.update=function(e,t){"string"==typeof e&&(e=u.Buffer.from(e,t=t||"utf8"));for(var n=this._block,r=this._blockSize,o=e.length,i=this._len,a=0;a<o;){for(var s=i%r,l=Math.min(o-a,r-s),c=0;c<l;c++)n[s+c]=e[a+c];a+=l,(i+=l)%r==0&&this._update(n)}return this._len+=o,this},P.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0;this._block.writeUInt32BE((n-r)/4294967296,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},P.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var U,F,z=[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],H=new Array(64);function $(){this.init(),this._w=H,P.call(this,64,56)}function V(e,t,n){return n^e&(t^n)}function Q(e,t,n){return e&t|n&(e|t)}function W(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function G(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function Y(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}U=$,(F=P)&&(U.super_=F,U.prototype=Object.create(F.prototype,{constructor:{value:U,enumerable:!1,writable:!0,configurable:!0}})),$.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},$.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,o=0|this._b,i=0|this._c,a=0|this._d,s=0|this._e,l=0|this._f,c=0|this._g,u=0|this._h,d=0;d<16;++d)n[d]=e.readInt32BE(4*d);for(;d<64;++d)n[d]=0|(((t=n[d-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+n[d-7]+Y(n[d-15])+n[d-16];for(var f=0;f<64;++f){var h=u+G(s)+V(s,l,c)+z[f]+n[f]|0,p=W(r)+Q(r,o,i)|0;u=c,c=l,l=s,s=a+h|0,a=i,i=o,o=r,r=h+p|0}this._a=r+this._a|0,this._b=o+this._b|0,this._c=i+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0,this._f=l+this._f|0,this._g=c+this._g|0,this._h=u+this._h|0},$.prototype._hash=function(){var e=u.Buffer.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var q=new(function(){function e(e){this.sha256=e.sha256,this.alphabet=e.alphabet,this.codec=c()(this.alphabet),this.base=this.alphabet.length}var t=e.prototype;return t.encodeChecked=function(e){var t=this.sha256(this.sha256(e)).slice(0,4);return this.encodeRaw(B.from(function(){var e=[];return[].slice.call(arguments).forEach((function(t){if(function(e){return void 0!==e.length}(t))for(var n=0;n<t.length;n++)e.push(t[n]);else e.push(t)})),e}(e,t)))},t.encodeRaw=function(e){return this.codec.encode(e)},t.decodeChecked=function(e){var t=this.decodeRaw(e);if(t.length<5)throw new Error("invalid_input_size: decoded data must have length >= 5");if(!this.verifyCheckSum(t))throw new Error("checksum_invalid");return t.slice(0,-4)},t.decodeRaw=function(e){return this.codec.decode(e)},t.verifyCheckSum=function(e){return function(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(this.sha256(this.sha256(e.slice(0,-4))).slice(0,4),e.slice(-4))},e}())({sha256:function(e){return(new $).update(B.from(e)).digest()},alphabet:"rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"}),K=function(e){return"0x"===e.slice(0,2)?e.slice(2):e},J=function(e,t){if(void 0===t&&(t=null),"string"!=typeof e)throw new Error("stripHexPrefix param must be type 'string', is currently type "+typeof e+".");for(var n,r=K(e).toLowerCase(),o=(n=(null!=t?t.toString()+"0x":"")+r,new s.C4(256).update(n).digest()).toString("hex"),i="0x",a=0;a<r.length;a++)i+=parseInt(o[a],16)>=8?r[a].toUpperCase():r[a];return i},X=function(e,t){if(!e)throw t},Z=function(e,t){if(!B.isBuffer(e))throw t},ee=f().one,te=f().zero,ne=f()(3);function re(e,t){return e.and(ee.shiftLeft(t)).notEquals(te)}function oe(e){return f().fromArray(Array.prototype.slice.call(e,0),256)}function ie(e,t){var n=e.toArray(256).value,r=t?Math.max(t-n.length,0):0;return B.from([].concat(Array(r).fill(0),n))}function ae(e,t,n,r){X(void 0!==r,"Missing Z coordinate"),this.curve=e,this.x=t,this.y=n,this.z=r,this._zInv=null,this.compressed=!0}Object.defineProperty(ae.prototype,"zInv",{get:function(){return null===this._zInv&&(this._zInv=this.z.modInv(this.curve.p)),this._zInv}}),Object.defineProperty(ae.prototype,"affineX",{get:function(){return this.x.multiply(this.zInv).mod(this.curve.p)}}),Object.defineProperty(ae.prototype,"affineY",{get:function(){return this.y.multiply(this.zInv).mod(this.curve.p)}}),ae.fromAffine=function(e,t,n){return new ae(e,t,n,ee)},ae.prototype.equals=function(e){return e===this||(this.curve.isInfinity(this)?this.curve.isInfinity(e):this.curve.isInfinity(e)?this.curve.isInfinity(this):0===e.y.multiply(this.z).subtract(this.y.multiply(e.z)).mod(this.curve.p).compare(te)&&0===e.x.multiply(this.z).subtract(this.x.multiply(e.z)).mod(this.curve.p).compare(te))},ae.prototype.negate=function(){var e=this.curve.p.subtract(this.y);return new ae(this.curve,this.x,e,this.z)},ae.prototype.add=function(e){if(this.curve.isInfinity(this))return e;if(this.curve.isInfinity(e))return this;var t=this.x,n=this.y,r=e.x,o=e.y.multiply(this.z).subtract(n.multiply(e.z)).mod(this.curve.p),i=r.multiply(this.z).subtract(t.multiply(e.z)).mod(this.curve.p);if(0===i.compare(te))return 0===o.compare(te)?this.twice():this.curve.infinity;var a=i.square(),s=a.multiply(i),l=t.multiply(a),c=o.square().multiply(this.z),u=c.subtract(l.shiftLeft(1)).multiply(e.z).subtract(s).multiply(i).mod(this.curve.p),d=l.multiply(ne).multiply(o).subtract(n.multiply(s)).subtract(c.multiply(o)).multiply(e.z).add(o.multiply(s)).mod(this.curve.p),f=s.multiply(this.z).multiply(e.z).mod(this.curve.p);return new ae(this.curve,u,d,f)},ae.prototype.twice=function(){if(this.curve.isInfinity(this))return this;if(0===this.y.compare(te))return this.curve.infinity;var e=this.x,t=this.y,n=t.multiply(this.z).mod(this.curve.p),r=n.multiply(t).mod(this.curve.p),o=this.curve.a,i=e.square().multiply(ne);0!==o.compare(te)&&(i=i.add(this.z.square().multiply(o)));var a=(i=i.mod(this.curve.p)).square().subtract(e.shiftLeft(3).multiply(r)).shiftLeft(1).multiply(n).mod(this.curve.p),s=i.multiply(ne).multiply(e).subtract(r.shiftLeft(1)).shiftLeft(2).multiply(r).subtract(i.pow(3)).mod(this.curve.p),l=n.pow(3).shiftLeft(3).mod(this.curve.p);return new ae(this.curve,a,s,l)},ae.prototype.multiply=function(e){if(this.curve.isInfinity(this))return this;if(0===e.compare(te))return this.curve.infinity;for(var t=e,n=t.multiply(ne),r=this.negate(),o=this,i=n.bitLength()-2;i>0;--i){var a=re(n,i),s=re(t,i);o=o.twice(),a!==s&&(o=o.add(a?this:r))}return o},ae.prototype.multiplyTwo=function(e,t,n){for(var r=Math.max(e.bitLength(),n.bitLength())-1,o=this.curve.infinity,i=this.add(t);r>=0;){var a=re(e,r),s=re(n,r);o=o.twice(),a?o=o.add(s?i:this):s&&(o=o.add(t)),--r}return o},ae.prototype.getEncoded=function(e){if(null==e&&(e=this.compressed),this.curve.isInfinity(this))return new B("00","hex");var t,n=this.affineX,r=this.affineY,o=this.curve.pLength;return e?(t=new B(1+o)).writeUInt8(r.isEven()?2:3,0):((t=new B(1+o+o)).writeUInt8(4,0),ie(r,o).copy(t,1+o)),ie(n,o).copy(t,1),t},ae.decodeFrom=function(e,t){var n,r=t.readUInt8(0),o=4!==r,i=Math.floor((e.p.bitLength()+7)/8),a=oe(t.slice(1,1+i));if(o)X(t.length===i+1,"Invalid sequence length"),X(2===r||3===r,"Invalid sequence tag"),n=e.pointFromX(3===r,a);else{X(t.length===1+i+i,"Invalid sequence length");var s=oe(t.slice(1+i));n=ae.fromAffine(e,a,s)}return n.compressed=o,n},ae.prototype.toString=function(){return this.curve.isInfinity(this)?"(INFINITY)":"("+this.affineX.toString()+","+this.affineY.toString()+")"};var se=f().zero,le=f().one;function ce(e,t,n,r,o,i,a){this.p=e,this.a=t,this.b=n,this.G=ae.fromAffine(this,r,o),this.n=i,this.h=a,this.infinity=new ae(this,null,null,se),this.pOverFour=e.add(le).shiftRight(2),this.pLength=Math.floor((this.p.bitLength()+7)/8)}ce.prototype.pointFromX=function(e,t){var n=t.pow(3).add(this.a.multiply(t)).add(this.b).mod(this.p).modPow(this.pOverFour,this.p),r=n;return n.isEven()^!e&&(r=this.p.subtract(r)),ae.fromAffine(this,t,r)},ce.prototype.isInfinity=function(e){return e===this.infinity||0===e.z.compare(se)&&0!==e.y.compare(se)},ce.prototype.isOnCurve=function(e){if(this.isInfinity(e))return!0;var t=e.affineX,n=e.affineY,r=this.a,o=this.b,i=this.p;if(t.compare(se)<0||t.compareTo(i)>=0)return!1;if(n.compare(se)<0||n.compareTo(i)>=0)return!1;var a=n.square().mod(i),s=t.pow(3).add(r.multiply(t)).add(o).mod(i);return a.equals(s)},ce.prototype.validate=function(e){X(!this.isInfinity(e),"Point is at infinity"),X(this.isOnCurve(e),"Point is not on the curve");var t=e.multiply(this.n);return X(this.isInfinity(t),"Point is not a scalar multiple of G"),!0};var ue={p:"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f",a:"00",b:"07",n:"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",h:"01",Gx:"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",Gy:"483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"};function de(e,t){return new s.Aj(256).update(e).digest(t)}function fe(e){return B.from((new O).update(e).digest())}function he(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;X(e,"private key expected");var n,r=new B(a().decode(e)),o=r.slice(-4),i=r.slice(0,-4);if("sha256x2"===t)n=de(de(i)).slice(0,4);else{var s=[i];t&&s.push(B.from(t)),n=fe(B.concat(s)).slice(0,4)}if(o.toString("hex")!==n.toString("hex"))throw new Error("Invalid checksum, "+"".concat(o.toString("hex")," != ").concat(n.toString("hex")));return i}var pe=function(e){var t=ue;if(!t)return null;var n=f()(t.p,16),r=f()(t.a,16),o=f()(t.b,16),i=f()(t.n,16),a=f()(t.h,16);return new ce(n,r,o,f()(t.Gx,16),f()(t.Gy,16),i,a)}();function ge(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"EOS";if("string"==typeof e)return ge.fromString(e,t);if(B.isBuffer(e))return ge.fromBuffer(e);if("object"==typeof e&&e.Q)return ge(e.Q);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.compressed;return e.getEncoded(t)}return{Q:e,toString:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"EOS")+function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(Z(e,"expecting keyBuffer<Buffer>"),"sha256x2"===t){var n=de(de(e)).slice(0,4);return a().encode(B.concat([e,n]))}var r=[e];t&&r.push(B.from(t));var o=fe(B.concat(r)).slice(0,4);return a().encode(B.concat([e,o]))}(n())},toBuffer:n,toHex:function(){return n().toString("hex")}}}ge.isValid=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"EOS";try{return ge(e,t),!0}catch(e){return!1}},ge.fromBuffer=function(e){return ge(ae.decodeFrom(pe,e))},ge.fromString=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"EOS";try{return ge.fromStringOrThrow(e,t)}catch(e){return null}},ge.fromStringOrThrow=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"EOS",n=e.match(/^PUB_([A-Za-z0-9]+)_([A-Za-z0-9]+)$/);if(null===n)return new RegExp("^"+t).test(e)&&(e=e.substring(t.length)),ge.fromBuffer(he(e));var r=n[1],o=n[2];return ge.fromBuffer(he(o,r))},ge.fromHex=function(e){return ge.fromBuffer(new B(e,"hex"))},ge.fromStringHex=function(e){return ge.fromString(new B(e,"hex"))};var me=c()("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),ye=me.encode,Ae=me.decode,be=function(e){return void 0===e},ve={ed25519PublicKey:48,ed25519SecretSeed:144,preAuthTx:152,sha256Hash:184},we=function(e){var t=B.alloc(2);return t.writeUInt16LE(function(e,t){B.isBuffer(e)||(e=new B);for(var n=0,r=0;r<e.length;r++){var o=n>>>8&255;o^=255&e[r],n=n<<8&65535,n^=o^=o>>>4,n^=o=o<<5&65535,n^=o=o<<7&65535}return n}(e),0),t};function Ee(e){return(Ee=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function xe(e,t){return(xe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Ce(e,t,n){return(Ce=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&xe(o,n.prototype),o}).apply(null,arguments)}function Ie(e){var t="function"==typeof Map?new Map:void 0;return(Ie=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return Ce(e,arguments,Ee(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),xe(n,e)})(e)}var Se=[0,1,2,42,43,68,69],ke=function(e){for(var t=new Uint8Array(7),n=0;n<7;n++)t[n]="SS58PRE".charCodeAt(n);return t}(),Me=function(e){var t,n;function r(){return e.apply(this,arguments)||this}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,xe(t,n),r.prototype.toJSON=function(){return{_type:"AccountIndex",data:this+0}},r}(Ie(Number));function Ne(e,t){e.length||(e=[e]),t.length||(t=[t]);var n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function Te(e,t,n,r,o){var i;if(void 0===t&&(t=42),void 0===n&&(n=null),void 0===r&&(r=null),-1===Se.indexOf(t))throw new Error("Unknown ss58 address type",t);if("number"==typeof e||e instanceof Me){var s=e<256?1:e<65536?2:e<1?4:8;if(-1===[1,2,4,8].indexOf(r=r||s))throw new Error("Invalid length");if(r=Math.max(s,r),n&&"number"!=typeof n)throw new Error("Invalid checksum length");switch(r){case 1:n=1;break;case 2:n=[1,2].indexOf(n)+1||1;break;case 4:n=[1,2,3,4].indexOf(n)+1||1;break;case 8:n=[1,2,3,4,5,6,7,8].indexOf(n)+1||1}i=function(e,t){var n=!1;e<0&&(e=-e-1,n=!0);for(var r=new Uint8Array(t),o=0;o<t;++o)r[o]=e%256,n&&(r[o]=255&~r[o]),e/=256;return r}(e,r)}else{if(!(e instanceof Uint8Array)||32!==e.length&&35!==e.length)throw new Error("Unknown item to encode as ss58. Passing back.",e);n=2,o=i=35===e.length?e.slice(1,33):e}var l=(0,_.blake2b)(Ne(ke,1&t?o:Ne(t,i))),c=Ne(Ne(t,i),l.slice(0,n));return a().encode(B.from(c))}function Oe(e){var t=new Error;this.name=t.name="ValidationError",this.message=t.message=e,this.stack=t.stack}function _e(e,t){if(null==t&&(t="Assertion failed."),!e)throw new Oe(t)}Oe.prototype=Object.create(Error.prototype);var Be=function(){function e(e,t){this.hi=0|e,this.lo=0|t}return e.prototype.ushrn32=function(e){var t=this.lo;return 0==(e&=63)||(e<32?(t>>>=e,t|=this.hi<<32-e):t=this.hi>>>e-32),t},e}(),De=B.allocUnsafe(105),je="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Re=[-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],Le=new Be(7,4294967295),Pe=[new Be(152,4072443489),new Be(121,3077413346),new Be(243,1046459332),new Be(174,783016616),new Be(30,1329849456)];function Ue(e,t){var n=e,r=n.hi>>>3;n.hi&=Le.hi,n.lo&=Le.lo,n.hi<<=5,n.hi|=n.lo>>>27,n.lo<<=5;for(var o=0;o<Pe.length;o++)r>>>o&1&&(n.hi^=Pe[o].hi,n.lo^=Pe[o].lo);return n.lo^=t,n}function Fe(e,t,n,r,o,i,a){_e(B.isBuffer(e)),_e(t>>>0===t),_e(B.isBuffer(n)),_e(r>>>0===r),_e((255&o)===o),_e((255&i)===i),_e("boolean"==typeof a);for(var s=(1<<i)-1,l=0,c=0;t<e.length;t++){var u=e[t];if(u>>>o!=0)throw new Error("Invalid bits.");for(l=l<<o|u,c+=o;c>=i;)n[r++]=l>>>(c-=i)&s}if(a)c&&(n[r++]=l<<i-c&s);else if(c>=o||l<<i-c&s)throw new Error("Invalid bits.");return _e(r<=n.length),n.slice(0,r)}function ze(e,t,n){if(_e("string"==typeof e),_e((15&t)===t,"Invalid cashaddr type."),_e(B.isBuffer(n)),0===e.length||e.length>83)throw new Error("Invalid cashaddr prefix.");var r=function(e){switch(_e(e>>>0===e),e){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.")}}(n.length),o=B.allocUnsafe(n.length+1);return o[0]=t<<3|r,n.copy(o,1),function(e,t){_e("string"==typeof e),_e(B.isBuffer(t));for(var n=new Be(0,1),r="",o=!1,i=!1,a=0;a<e.length;a++){var s=e.charCodeAt(a);if(65280&s||s>>>5==0)throw new Error("Invalid cashaddr character.");if(s>=97&&s<=122)i=!0;else if(s>=65&&s<=90)o=!0,s=s-65+97;else if(s>=48&&s<=57)throw new Error("Invalid cashaddr prefix.");Ue(n,31&s),r+=String.fromCharCode(s)}if(i&&o)throw new Error("Invalid cashaddr prefix.");Ue(n,0),r+=":";for(var l=0;l<t.length;l++){var c=t[l];if(c>>>5!=0)throw new Error("Invalid cashaddr value.");Ue(n,c),r+=je[c]}for(var u=0;u<8;u++)Ue(n,0);n.lo^=1;for(var d=0;d<8;d++){var f=31&n.ushrn32(5*(7-d));r+=je[f]}return r}(e,Fe(o,0,De,0,8,5,!0))}var He=function(e){function t(t){var n=t.slice(0,-4),r=t.slice(-4),o=e(n);if(!(r[0]^o[0]|r[1]^o[1]|r[2]^o[2]|r[3]^o[3]))return n}return{bs58Encode:function(t){var n=e(t);return a().encode(B.concat([t,n],t.length+4))},bs58Decode:function(e){var n=t(a().decode(e));if(!n)throw new Error("Invalid checksum");return n},decodeUnsafe:function(e){var n=a().decodeUnsafe(e);if(n)return t(n)}}}((function(e){var t=(new $).update(e).digest();return(new $).update(t).digest()})),$e=He.bs58Decode,Ve=He.bs58Encode,Qe=n(3299),We=n(9390),Ge=n(5012),Ye=n(1965),qe=n(8834).Buffer;function Ke(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Je(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Ke(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ke(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var Xe,Ze,et,tt=(Ze=Xe={path:void 0,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},et=function(e){var t=1e7,n=9007199254740992,r=c(n),o=Math.log(n);function i(e,t){return void 0===e?i[0]:void 0!==t?10==+t?V(e):P(e,t):V(e)}function a(e,t){this.value=e,this.sign=t,this.isSmall=!1}function s(e){this.value=e,this.sign=e<0,this.isSmall=!0}function l(e){return-n<e&&e<n}function c(e){return e<1e7?[e]:e<1e14?[e%1e7,Math.floor(e/1e7)]:[e%1e7,Math.floor(e/1e7)%1e7,Math.floor(e/1e14)]}function u(e){d(e);var n=e.length;if(n<4&&S(e,r)<0)switch(n){case 0:return 0;case 1:return e[0];case 2:return e[0]+e[1]*t;default:return e[0]+(e[1]+e[2]*t)*t}return e}function d(e){for(var t=e.length;0===e[--t];);e.length=t+1}function f(e){for(var t=new Array(e),n=-1;++n<e;)t[n]=0;return t}function h(e){return e>0?Math.floor(e):Math.ceil(e)}function p(e,n){var r,o,i=e.length,a=n.length,s=new Array(i),l=0,c=t;for(o=0;o<a;o++)s[o]=(r=e[o]+n[o]+l)-(l=r>=c?1:0)*c;for(;o<i;)r=e[o]+l,s[o++]=r-(l=r===c?1:0)*c;return l>0&&s.push(l),s}function g(e,t){return e.length>=t.length?p(e,t):p(t,e)}function m(e,n){var r,o,i=e.length,a=new Array(i),s=t;for(o=0;o<i;o++)r=e[o]-s+n,n=Math.floor(r/s),a[o]=r-n*s,n+=1;for(;n>0;)a[o++]=n%s,n=Math.floor(n/s);return a}function y(e,t){var n,r,o=e.length,i=t.length,a=new Array(o),s=0;for(n=0;n<i;n++)(r=e[n]-s-t[n])<0?(r+=1e7,s=1):s=0,a[n]=r;for(n=i;n<o;n++){if(!((r=e[n]-s)<0)){a[n++]=r;break}a[n]=r+=1e7}for(;n<o;n++)a[n]=e[n];return d(a),a}function A(e,t,n){var r,o,i=e.length,l=new Array(i),c=-t;for(r=0;r<i;r++)o=e[r]+c,c=Math.floor(o/1e7),l[r]=(o%=1e7)<0?o+1e7:o;return"number"==typeof(l=u(l))?(n&&(l=-l),new s(l)):new a(l,n)}function b(e,t){var n,r,o,i,a=e.length,s=t.length,l=f(a+s);for(o=0;o<a;++o){i=e[o];for(var c=0;c<s;++c)n=i*t[c]+l[o+c],r=Math.floor(n/1e7),l[o+c]=n-1e7*r,l[o+c+1]+=r}return d(l),l}function v(e,n){var r,o,i=e.length,a=new Array(i),s=t,l=0;for(o=0;o<i;o++)r=e[o]*n+l,l=Math.floor(r/s),a[o]=r-l*s;for(;l>0;)a[o++]=l%s,l=Math.floor(l/s);return a}function w(e,t){for(var n=[];t-- >0;)n.push(0);return n.concat(e)}function E(e,n,r){return new a(e<t?v(n,e):b(n,c(e)),r)}function x(e){var t,n,r,o,i=e.length,a=f(i+i);for(r=0;r<i;r++){n=0-(o=e[r])*o;for(var s=r;s<i;s++)t=o*e[s]*2+a[r+s]+n,n=Math.floor(t/1e7),a[r+s]=t-1e7*n;a[r+i]=n}return d(a),a}function C(e,t){var n,r,o,i,a=e.length,s=f(a);for(o=0,n=a-1;n>=0;--n)o=(i=1e7*o+e[n])-(r=h(i/t))*t,s[n]=0|r;return[s,0|o]}function I(e,n){var r,o,l=V(n),p=e.value,g=l.value;if(0===g)throw new Error("Cannot divide by zero");if(e.isSmall)return l.isSmall?[new s(h(p/g)),new s(p%g)]:[i[0],e];if(l.isSmall){if(1===g)return[e,i[0]];if(-1==g)return[e.negate(),i[0]];var m=Math.abs(g);if(m<t){o=u((r=C(p,m))[0]);var A=r[1];return e.sign&&(A=-A),"number"==typeof o?(e.sign!==l.sign&&(o=-o),[new s(o),new s(A)]):[new a(o,e.sign!==l.sign),new s(A)]}g=c(m)}var b=S(p,g);if(-1===b)return[i[0],e];if(0===b)return[i[e.sign===l.sign?1:-1],i[0]];r=p.length+g.length<=200?function(e,n){var r,o,i,a,s,l,c,d=e.length,h=n.length,p=t,g=f(n.length),m=n[h-1],y=Math.ceil(p/(2*m)),A=v(e,y),b=v(n,y);for(A.length<=d&&A.push(0),b.push(0),m=b[h-1],o=d-h;o>=0;o--){for(r=p-1,A[o+h]!==m&&(r=Math.floor((A[o+h]*p+A[o+h-1])/m)),i=0,a=0,l=b.length,s=0;s<l;s++)i+=r*b[s],c=Math.floor(i/p),a+=A[o+s]-(i-c*p),i=c,a<0?(A[o+s]=a+p,a=-1):(A[o+s]=a,a=0);for(;0!==a;){for(r-=1,i=0,s=0;s<l;s++)(i+=A[o+s]-p+b[s])<0?(A[o+s]=i+p,i=0):(A[o+s]=i,i=1);a+=i}g[o]=r}return A=C(A,y)[0],[u(g),u(A)]}(p,g):function(e,t){for(var n,r,o,i,a=e.length,s=t.length,l=[],c=[];a;)if(c.unshift(e[--a]),d(c),S(c,t)<0)l.push(0);else{o=1e7*c[(r=c.length)-1]+c[r-2],r>s&&(o=1e7*(o+1)),n=Math.ceil(o/(1e7*t[s-1]+t[s-2]));do{if(S(i=v(t,n),c)<=0)break;n--}while(n);l.push(n),c=y(c,i)}return l.reverse(),[u(l),u(c)]}(p,g);var w=e.sign!==l.sign,E=r[1],x=e.sign;return"number"==typeof(o=r[0])?(w&&(o=-o),o=new s(o)):o=new a(o,w),"number"==typeof E?(x&&(E=-E),E=new s(E)):E=new a(E,x),[o,E]}function S(e,t){if(e.length!==t.length)return e.length>t.length?1:-1;for(var n=e.length-1;n>=0;n--)if(e[n]!==t[n])return e[n]>t[n]?1:-1;return 0}function k(e){var t=e.abs();return!t.isUnit()&&(!!(t.equals(2)||t.equals(3)||t.equals(5))||!(t.isEven()||t.isDivisibleBy(3)||t.isDivisibleBy(5))&&(!!t.lesser(49)||void 0))}function M(e,t){for(var n,r,o,a=e.prev(),s=a,l=0;s.isEven();)s=s.divide(2),l++;e:for(r=0;r<t.length;r++)if(!e.lesser(t[r])&&!(o=et(t[r]).modPow(s,e)).equals(i[1])&&!o.equals(a)){for(n=l-1;0!=n;n--){if((o=o.square().mod(e)).isUnit())return!1;if(o.equals(a))continue e}return!1}return!0}a.prototype=Object.create(i.prototype),s.prototype=Object.create(i.prototype),a.prototype.add=function(e){var t=V(e);if(this.sign!==t.sign)return this.subtract(t.negate());var n=this.value,r=t.value;return new a(t.isSmall?m(n,Math.abs(r)):g(n,r),this.sign)},a.prototype.plus=a.prototype.add,s.prototype.add=function(e){var t=V(e),n=this.value;if(n<0!==t.sign)return this.subtract(t.negate());var r=t.value;if(t.isSmall){if(l(n+r))return new s(n+r);r=c(Math.abs(r))}return new a(m(r,Math.abs(n)),n<0)},s.prototype.plus=s.prototype.add,a.prototype.subtract=function(e){var t=V(e);if(this.sign!==t.sign)return this.add(t.negate());var n=this.value,r=t.value;return t.isSmall?A(n,Math.abs(r),this.sign):function(e,t,n){var r;return S(e,t)>=0?r=y(e,t):(r=y(t,e),n=!n),"number"==typeof(r=u(r))?(n&&(r=-r),new s(r)):new a(r,n)}(n,r,this.sign)},a.prototype.minus=a.prototype.subtract,s.prototype.subtract=function(e){var t=V(e),n=this.value;if(n<0!==t.sign)return this.add(t.negate());var r=t.value;return t.isSmall?new s(n-r):A(r,Math.abs(n),n>=0)},s.prototype.minus=s.prototype.subtract,a.prototype.negate=function(){return new a(this.value,!this.sign)},s.prototype.negate=function(){var e=this.sign,t=new s(-this.value);return t.sign=!e,t},a.prototype.abs=function(){return new a(this.value,!1)},s.prototype.abs=function(){return new s(Math.abs(this.value))},a.prototype.multiply=function(e){var n,r,o,s=V(e),l=this.value,u=s.value,f=this.sign!==s.sign;if(s.isSmall){if(0===u)return i[0];if(1===u)return this;if(-1===u)return this.negate();if((n=Math.abs(u))<t)return new a(v(l,n),f);u=c(n)}return-.012*(r=l.length)-.012*(o=u.length)+15e-6*r*o>0?new a(function e(t,n){var r=Math.max(t.length,n.length);if(r<=30)return b(t,n);r=Math.ceil(r/2);var o=t.slice(r),i=t.slice(0,r),a=n.slice(r),s=n.slice(0,r),l=e(i,s),c=e(o,a),u=e(g(i,o),g(s,a)),f=g(g(l,w(y(y(u,l),c),r)),w(c,2*r));return d(f),f}(l,u),f):new a(b(l,u),f)},a.prototype.times=a.prototype.multiply,s.prototype._multiplyBySmall=function(e){return l(e.value*this.value)?new s(e.value*this.value):E(Math.abs(e.value),c(Math.abs(this.value)),this.sign!==e.sign)},a.prototype._multiplyBySmall=function(e){return 0===e.value?i[0]:1===e.value?this:-1===e.value?this.negate():E(Math.abs(e.value),this.value,this.sign!==e.sign)},s.prototype.times=s.prototype.multiply=function(e){return V(e)._multiplyBySmall(this)},a.prototype.square=function(){return new a(x(this.value),!1)},s.prototype.square=function(){var e=this.value*this.value;return l(e)?new s(e):new a(x(c(Math.abs(this.value))),!1)},s.prototype.divmod=a.prototype.divmod=function(e){var t=I(this,e);return{quotient:t[0],remainder:t[1]}},s.prototype.over=s.prototype.divide=a.prototype.over=a.prototype.divide=function(e){return I(this,e)[0]},s.prototype.remainder=s.prototype.mod=a.prototype.remainder=a.prototype.mod=function(e){return I(this,e)[1]},a.prototype.pow=function(e){var t,n,r,o=V(e),a=this.value,c=o.value;if(0===c)return i[1];if(0===a)return i[0];if(1===a)return i[1];if(-1===a)return o.isEven()?i[1]:i[-1];if(o.sign)return i[0];if(!o.isSmall)throw new Error("The exponent "+o.toString()+" is too large.");if(this.isSmall&&l(t=Math.pow(a,c)))return new s(h(t));for(n=this,r=i[1];!0&c&&(r=r.times(n),--c),0!==c;)c/=2,n=n.square();return r},s.prototype.pow=a.prototype.pow,s.prototype.modPow=a.prototype.modPow=function(e,t){if(e=V(e),(t=V(t)).isZero())throw new Error("Cannot take modPow with modulus 0");for(var n=i[1],r=this.mod(t);e.isPositive();){if(r.isZero())return i[0];e.isOdd()&&(n=n.multiply(r).mod(t)),e=e.divide(2),r=r.square().mod(t)}return n},a.prototype.compareAbs=function(e){var t=V(e);return t.isSmall?1:S(this.value,t.value)},s.prototype.compareAbs=function(e){var t=V(e),n=Math.abs(this.value),r=t.value;return t.isSmall?n===(r=Math.abs(r))?0:n>r?1:-1:-1},a.prototype.compareTo=a.prototype.compare=function(e){if(1/0===e)return-1;if(-1/0===e)return 1;var t=V(e);return this.sign!==t.sign?t.sign?1:-1:t.isSmall?this.sign?-1:1:S(this.value,t.value)*(this.sign?-1:1)},s.prototype.compareTo=s.prototype.compare=function(e){if(1/0===e)return-1;if(-1/0===e)return 1;var t=V(e),n=this.value,r=t.value;return t.isSmall?n==r?0:n>r?1:-1:n<0!==t.sign?n<0?-1:1:n<0?1:-1},s.prototype.eq=s.prototype.equals=a.prototype.eq=a.prototype.equals=function(e){return 0===this.compare(e)},s.prototype.neq=s.prototype.notEquals=a.prototype.neq=a.prototype.notEquals=function(e){return 0!==this.compare(e)},s.prototype.gt=s.prototype.greater=a.prototype.gt=a.prototype.greater=function(e){return this.compare(e)>0},s.prototype.lt=s.prototype.lesser=a.prototype.lt=a.prototype.lesser=function(e){return this.compare(e)<0},s.prototype.geq=s.prototype.greaterOrEquals=a.prototype.geq=a.prototype.greaterOrEquals=function(e){return this.compare(e)>=0},s.prototype.leq=s.prototype.lesserOrEquals=a.prototype.leq=a.prototype.lesserOrEquals=function(e){return this.compare(e)<=0},a.prototype.isEven=function(){return 0==(1&this.value[0])},s.prototype.isEven=function(){return 0==(1&this.value)},a.prototype.isOdd=function(){return 1==(1&this.value[0])},s.prototype.isOdd=function(){return 1==(1&this.value)},a.prototype.isPositive=function(){return!this.sign},s.prototype.isPositive=function(){return this.value>0},a.prototype.isNegative=function(){return this.sign},s.prototype.isNegative=function(){return this.value<0},a.prototype.isUnit=function(){return!1},s.prototype.isUnit=function(){return 1===Math.abs(this.value)},a.prototype.isZero=function(){return!1},s.prototype.isZero=function(){return 0===this.value},s.prototype.isDivisibleBy=a.prototype.isDivisibleBy=function(e){var t=V(e),n=t.value;return 0!==n&&(1===n||(2===n?this.isEven():this.mod(t).equals(i[0])))},s.prototype.isPrime=a.prototype.isPrime=function(e){var t=k(this);if(void 0!==t)return t;var n=this.abs(),r=n.bitLength();if(r<=64)return M(n,[2,325,9375,28178,450775,9780504,1795265022]);for(var o=Math.log(2)*r,i=Math.ceil(!0===e?2*Math.pow(o,2):o),a=[],s=0;s<i;s++)a.push(et(s+2));return M(n,a)},s.prototype.isProbablePrime=a.prototype.isProbablePrime=function(e){var t=k(this);if(void 0!==t)return t;for(var n=this.abs(),r=void 0===e?5:e,o=[],i=0;i<r;i++)o.push(et.randBetween(2,n.minus(2)));return M(n,o)},s.prototype.modInv=a.prototype.modInv=function(e){for(var t,n,r,o=et.zero,i=et.one,a=V(e),s=this.abs();!s.equals(et.zero);)t=a.divide(s),n=o,r=a,o=i,a=s,i=n.subtract(t.multiply(i)),s=r.subtract(t.multiply(s));if(!a.equals(1))throw new Error(this.toString()+" and "+e.toString()+" are not co-prime");return-1===o.compare(0)&&(o=o.add(e)),this.isNegative()?o.negate():o},a.prototype.next=function(){var e=this.value;return this.sign?A(e,1,this.sign):new a(m(e,1),this.sign)},s.prototype.next=function(){var e=this.value;return e+1<n?new s(e+1):new a(r,!1)},a.prototype.prev=function(){var e=this.value;return this.sign?new a(m(e,1),!0):A(e,1,this.sign)},s.prototype.prev=function(){var e=this.value;return e-1>-n?new s(e-1):new a(r,!0)};for(var N=[1];2*N[N.length-1]<=t;)N.push(2*N[N.length-1]);var T=N.length,O=N[T-1];function _(e){return("number"==typeof e||"string"==typeof e)&&+Math.abs(e)<=t||e instanceof a&&e.value.length<=1}function B(e,t,n){t=V(t);for(var r=e.isNegative(),o=t.isNegative(),i=r?e.not():e,a=o?t.not():t,s=0,l=0,c=null,u=null,d=[];!i.isZero()||!a.isZero();)s=(c=I(i,O))[1].toJSNumber(),r&&(s=O-1-s),l=(u=I(a,O))[1].toJSNumber(),o&&(l=O-1-l),i=c[0],a=u[0],d.push(n(s,l));for(var f=0!==n(r?1:0,o?1:0)?et(-1):et(0),h=d.length-1;h>=0;h-=1)f=f.multiply(O).add(et(d[h]));return f}function D(e){var n=e.value,r="number"==typeof n?n|1<<30:n[0]+n[1]*t|1073758208;return r&-r}function j(e,t){return e=V(e),t=V(t),e.greater(t)?e:t}function R(e,t){return e=V(e),t=V(t),e.lesser(t)?e:t}function L(e,t){if(e=V(e).abs(),t=V(t).abs(),e.equals(t))return e;if(e.isZero())return t;if(t.isZero())return e;for(var n,r,o=i[1];e.isEven()&&t.isEven();)n=Math.min(D(e),D(t)),e=e.divide(n),t=t.divide(n),o=o.multiply(n);for(;e.isEven();)e=e.divide(D(e));do{for(;t.isEven();)t=t.divide(D(t));e.greater(t)&&(r=t,t=e,e=r),t=t.subtract(e)}while(!t.isZero());return o.isUnit()?e:e.multiply(o)}s.prototype.shiftLeft=a.prototype.shiftLeft=function(e){if(!_(e))throw new Error(String(e)+" is too large for shifting.");if((e=+e)<0)return this.shiftRight(-e);var t=this;if(t.isZero())return t;for(;e>=T;)t=t.multiply(O),e-=T-1;return t.multiply(N[e])},s.prototype.shiftRight=a.prototype.shiftRight=function(e){var t;if(!_(e))throw new Error(String(e)+" is too large for shifting.");if((e=+e)<0)return this.shiftLeft(-e);for(var n=this;e>=T;){if(n.isZero()||n.isNegative()&&n.isUnit())return n;n=(t=I(n,O))[1].isNegative()?t[0].prev():t[0],e-=T-1}return(t=I(n,N[e]))[1].isNegative()?t[0].prev():t[0]},s.prototype.not=a.prototype.not=function(){return this.negate().prev()},s.prototype.and=a.prototype.and=function(e){return B(this,e,(function(e,t){return e&t}))},s.prototype.or=a.prototype.or=function(e){return B(this,e,(function(e,t){return e|t}))},s.prototype.xor=a.prototype.xor=function(e){return B(this,e,(function(e,t){return e^t}))},s.prototype.bitLength=a.prototype.bitLength=function(){var e=this;return e.compareTo(et(0))<0&&(e=e.negate().subtract(et(1))),0===e.compareTo(et(0))?et(0):et(function e(t,n){if(n.compareTo(t)<=0){var r=e(t,n.square(n)),o=r.p,i=r.e,a=o.multiply(n);return a.compareTo(t)<=0?{p:a,e:2*i+1}:{p:o,e:2*i}}return{p:et(1),e:0}}(e,et(2)).e).add(et(1))};var P=function(e,t){for(var n=e.length,r=Math.abs(t),i=0;i<n;i++)if("-"!==(u=e[i].toLowerCase())&&/[a-z0-9]/.test(u)){if(/[0-9]/.test(u)&&+u>=r){if("1"===u&&1===r)continue;throw new Error(u+" is not a valid digit in base "+t+".")}if(u.charCodeAt(0)-87>=r)throw new Error(u+" is not a valid digit in base "+t+".")}if(2<=t&&t<=36&&n<=o/Math.log(t)){var a=parseInt(e,t);if(isNaN(a))throw new Error(u+" is not a valid digit in base "+t+".");return new s(parseInt(e,t))}t=V(t);var l=[],c="-"===e[0];for(i=c?1:0;i<e.length;i++){var u,d=(u=e[i].toLowerCase()).charCodeAt(0);if(48<=d&&d<=57)l.push(V(u));else if(97<=d&&d<=122)l.push(V(u.charCodeAt(0)-87));else{if("<"!==u)throw new Error(u+" is not a valid character");var f=i;do{i++}while(">"!==e[i]);l.push(V(e.slice(f+1,i)))}}return U(l,t,c)};function U(e,t,n){var r,o=i[0],a=i[1];for(r=e.length-1;r>=0;r--)o=o.add(e[r].times(a)),a=a.times(t);return n?o.negate():o}function F(e){return e<=35?"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e):"<"+e+">"}function z(e,t){if((t=et(t)).isZero()){if(e.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(t.equals(-1)){if(e.isZero())return{value:[0],isNegative:!1};if(e.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-e)).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var n=Array.apply(null,Array(+e-1)).map(Array.prototype.valueOf,[0,1]);return n.unshift([1]),{value:[].concat.apply([],n),isNegative:!1}}var r=!1;if(e.isNegative()&&t.isPositive()&&(r=!0,e=e.abs()),t.equals(1))return e.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(+e)).map(Number.prototype.valueOf,1),isNegative:r};for(var o,i=[],a=e;a.isNegative()||a.compareAbs(t)>=0;){o=a.divmod(t),a=o.quotient;var s=o.remainder;s.isNegative()&&(s=t.minus(s).abs(),a=a.next()),i.push(s.toJSNumber())}return i.push(a.toJSNumber()),{value:i.reverse(),isNegative:r}}function H(e,t){var n=z(e,t);return(n.isNegative?"-":"")+n.value.map(F).join("")}function $(e){if(l(+e)){var t=+e;if(t===h(t))return new s(t);throw new Error("Invalid integer: "+e)}var n="-"===e[0];n&&(e=e.slice(1));var r=e.split(/e/i);if(r.length>2)throw new Error("Invalid integer: "+r.join("e"));if(2===r.length){var o=r[1];if("+"===o[0]&&(o=o.slice(1)),(o=+o)!==h(o)||!l(o))throw new Error("Invalid integer: "+o+" is not a valid exponent.");var i=r[0],c=i.indexOf(".");if(c>=0&&(o-=i.length-c-1,i=i.slice(0,c)+i.slice(c+1)),o<0)throw new Error("Cannot include negative exponent part for integers");e=i+=new Array(o+1).join("0")}if(!/^([0-9][0-9]*)$/.test(e))throw new Error("Invalid integer: "+e);for(var u=[],f=e.length,p=f-7;f>0;)u.push(+e.slice(p,f)),(p-=7)<0&&(p=0),f-=7;return d(u),new a(u,n)}function V(e){return"number"==typeof e?function(e){if(l(e)){if(e!==h(e))throw new Error(e+" is not an integer.");return new s(e)}return $(e.toString())}(e):"string"==typeof e?$(e):e}a.prototype.toArray=function(e){return z(this,e)},s.prototype.toArray=function(e){return z(this,e)},a.prototype.toString=function(e){if(void 0===e&&(e=10),10!==e)return H(this,e);for(var t,n=this.value,r=n.length,o=String(n[--r]);--r>=0;)t=String(n[r]),o+="0000000".slice(t.length)+t;return(this.sign?"-":"")+o},s.prototype.toString=function(e){return void 0===e&&(e=10),10!=e?H(this,e):String(this.value)},a.prototype.toJSON=s.prototype.toJSON=function(){return this.toString()},a.prototype.toJSNumber=a.prototype.valueOf=function(){return parseInt(this.toString(),10)},s.prototype.toJSNumber=s.prototype.valueOf=function(){return this.value};for(var Q=0;Q<1e3;Q++)i[Q]=new s(Q),Q>0&&(i[-Q]=new s(-Q));return i.one=i[1],i.zero=i[0],i.minusOne=i[-1],i.max=j,i.min=R,i.gcd=L,i.lcm=function(e,t){return e=V(e).abs(),t=V(t).abs(),e.divide(L(e,t)).multiply(t)},i.isInstance=function(e){return e instanceof a||e instanceof s},i.randBetween=function(e,n){var r=R(e=V(e),n=V(n)),o=j(e,n).subtract(r).add(1);if(o.isSmall)return r.add(Math.floor(Math.random()*o));for(var i=[],l=!0,c=o.value.length-1;c>=0;c--){var d=l?o.value[c]:t,f=h(Math.random()*d);i.unshift(f),f<d&&(l=!1)}return i=u(i),r.add("number"==typeof i?new s(i):new a(i,!1))},i.fromArray=function(e,t,n){return U(e.map(V),V(t||10),n)},i}(),Ze.hasOwnProperty("exports")&&(Ze.exports=et),Xe.exports),nt="0123456789ABCDEFGHJKMNPQRSTVWXYZ",rt="0123456789abcdef";function ot(e){return qe.from(Ye.sha256.update(e).digest())}function it(e){return ot(ot(qe.from(e,"hex"))).slice(0,4).toString("hex")}function at(e){if(!e.match(/^[0-9a-fA-F]*$/))throw new Error("Not a hex-encoded string");e.length%2!=0&&(e="0"+e);for(var t=[],n=0,r=(e=e.toLowerCase()).length-1;r>=0;r--)if(n<4){var o=rt.indexOf(e[r])>>n,i=0;0!==r&&(i=rt.indexOf(e[r-1]));var a=1+n;n=a,t.unshift(nt[o+(i%(1<<a)<<5-a)])}else n=0;for(var s=0,l=0;l<t.length&&"0"===t[l];l++)s++;t=t.slice(s);for(var c=qe.from(e,"hex").toString().match(/^\u0000*/),u=c?c[0].length:0,d=0;d<u;d++)t.unshift(nt[0]);return t.join("")}function st(e){return e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")}var lt=function(e,t){this.value=e,this.tag=t},ct=function(e){this.value=e},ut=n(2197),dt=function(){function e(e){void 0===e&&(e=qe.from([])),this.buffer=e,this.bytesRead=0}var t=e.prototype;return t.read=function(e){var t=this.buffer.slice(0,e);return this.buffer=this.buffer.slice(e),this.bytesRead+=e,t},t.write=function(e){this.buffer=qe.concat([this.buffer,qe.from(e)])},e}(),ft=function(){function e(e){if(!e||e.length<1)throw new Error("Missing str in address");this.str=e}var t=e.prototype;return t.protocol=function(){if(this.str.length<1)throw Error("No address found.");return this.str[0]},t.payload=function(){if(this.str.length<1)throw Error("No address found.");return this.str.slice(1,this.str.length)},e}();function ht(e){return(0,o.blake2b)(Uint8Array.from(e),null,4)}function pt(e,t){if(!t||!t.str)throw Error("Invalid address");var n="",r=t.payload(),o=t.protocol();if(0===o){var i=function(e){for(var t,n=new ut(0),r=0;t=e.read(1)[0],n.ior(new ut(127&t).shln(r)),t>>7!=0;)r+=7;return n}(new dt(r)).toString();n=e+String(o)+i}else{var a=qe.from([o]),s=ht(qe.concat([a,r])),l=qe.concat([r,qe.from(s)]),c=j(l.toString("hex")),u=L(c).replace(/=/g,"").toLowerCase();n=String(e)+String(o)+u}return n}function gt(e,t){var n=qe.from([e]),r=qe.concat([n,t]);return new ft(r)}var mt=[BigInt(1),BigInt(2),BigInt(4),BigInt(8),BigInt(16),BigInt(32),BigInt(64),BigInt(128),BigInt(256),BigInt(512),BigInt(1024),BigInt(2048),BigInt(4096),BigInt(8192),BigInt(16384),BigInt(32768),BigInt(65536),BigInt(131072),BigInt(262144),BigInt(471693),BigInt(419994),BigInt(397615),BigInt(395339),BigInt(275453),BigInt(273067),BigInt(268625),BigInt(144334),BigInt(141953),BigInt(137544),BigInt(126816),BigInt(122570),BigInt(116281),BigInt(114136),BigInt(107829),BigInt(103596),BigInt(101446),BigInt(90923),BigInt(86683),BigInt(84547),BigInt(78212),BigInt(76098),BigInt(71873),BigInt(63506),BigInt(57383),BigInt(53262),BigInt(51260),BigInt(45085),BigInt(43057),BigInt(38955),BigInt(28724),BigInt(26666),BigInt(22553),BigInt(14343),BigInt(2002),BigInt(1831),BigInt(1678),BigInt(1660),BigInt(1437),BigInt(1259),BigInt(948),BigInt(874),BigInt(729),BigInt(455),BigInt(63)],yt=function(e){this.codeword=e};function At(e,t){this.hi=e>>>0,this.lo=t>>>0}function bt(e,t){return new At(e,t)}function vt(){var e=arguments,t=e[0].hi,n=e[0].lo,r=e.length-1;do{t^=e[r].hi,n^=e[r].lo,r--}while(r>0);return new this.u64(t,n)}function wt(e,t,n,r,o){o|=0;for(var i=0;i<r;)e[i+t]=n[i+o],i++}function Et(e){if(!e)return[];for(var t=e.length?1+(e.length-1>>>3):0,n=new Array(t),r=0;r<t;)n[r]=new At(e[8*r]<<24|e[8*r+1]<<16|e[8*r+2]<<8|e[8*r+3],e[8*r+4]<<24|e[8*r+5]<<16|e[8*r+6]<<8|e[8*r+7]),r++;return n}function xt(e){for(var t=new Array(e.length),n=e.length,r=0;r<n;)t[4*r]=(4278190080&e[r])>>>24,t[4*r+1]=(16711680&e[r])>>>16,t[4*r+2]=(65280&e[r])>>>8,t[4*r+3]=255&e[r],r++;return t}yt.mainnet=new yt(BigInt(0)),yt.testnet=new yt(BigInt(0x6834ba37b3980400)),yt.emulator=new yt(BigInt(0x1cb159857af02000)),At.prototype.set=function(e){this.lo=e.lo,this.hi=e.hi},At.prototype.add=function(e){var t,n,r,o;return o=(this.hi>>>16)+(e.hi>>>16)+((r=(65535&this.hi)+(65535&e.hi)+((n=(this.lo>>>16)+(e.lo>>>16)+((t=(65535&this.lo)+(65535&e.lo))>>>16))>>>16))>>>16),this.lo=n<<16|65535&t,this.hi=o<<16|65535&r,this},At.prototype.addOne=function(){-1===this.lo||4294967295===this.lo?(this.lo=0,this.hi++):this.lo++},At.prototype.plus=function(e){var t,n,r,o,i=new At(0,0);return o=(this.hi>>>16)+(e.hi>>>16)+((r=(65535&this.hi)+(65535&e.hi)+((n=(this.lo>>>16)+(e.lo>>>16)+((t=(65535&this.lo)+(65535&e.lo))>>>16))>>>16))>>>16),i.lo=n<<16|65535&t,i.hi=o<<16|65535&r,i},At.prototype.not=function(){return new At(~this.hi,~this.lo)},At.prototype.one=function(){return new At(0,1)},At.prototype.zero=function(){return new At(0,0)},At.prototype.neg=function(){return this.not().plus(this.one())},At.prototype.minus=function(e){return this.plus(e.neg())},At.prototype.isZero=function(){return 0===this.lo&&0===this.hi},At.prototype.multiply=function(e){if(this.isZero())return this.zero();var t;if(!0!==((t=e)&&t.__isLong__)&&(e=function(e){return isNaN(e)||!isFinite(e)?this.zero():new At(e%1|0,e/1|0)}(e)),e.isZero())return this.zero();var n=65535&this.hi,r=this.lo>>>16,o=65535&this.lo,i=65535&e.hi,a=e.lo>>>16,s=65535&e.lo,l=0,c=0,u=0,d=0;return u+=(d+=o*s)>>>16,c+=(u+=r*s)>>>16,u&=65535,c+=(u+=o*a)>>>16,l+=(c+=n*s)>>>16,c&=65535,l+=(c+=r*a)>>>16,c&=65535,l+=(c+=o*i)>>>16,l+=(this.hi>>>16)*s+n*a+r*i+o*(e.hi>>>16),new At((l&=65535)<<16|(c&=65535),(u&=65535)<<16|(d&=65535))},At.prototype.shiftLeft=function(e){e%=64;var t=new At(0,0);if(0===e)return this.clone();if(e>31)t.lo=0,t.hi=this.lo<<e-32;else{var n=this.lo>>>32-e;t.lo=this.lo<<e,t.hi=this.hi<<e|n}return t},At.prototype.setShiftLeft=function(e){if(0===e)return this;if(e>63&&(e%=64),e>31)this.hi=this.lo<<e-32,this.lo=0;else{var t=this.lo>>>32-e;this.lo<<=e,this.hi=this.hi<<e|t}return this},At.prototype.shiftRight=function(e){e%=64;var t=new At(0,0);if(0===e)return this.clone();if(e>=32)t.hi=0,t.lo=this.hi>>>e-32;else{var n=32-e,r=this.hi<<n>>>n;t.hi=this.hi>>>e,t.lo=this.lo>>>e|r<<n}return t},At.prototype.rotateLeft=function(e){if(e>32)return this.rotateRight(64-e);var t=new At(0,0);return 0===e?(t.lo=this.lo>>>0,t.hi=this.hi>>>0):32===e?(t.lo=this.hi,t.hi=this.lo):(t.lo=this.lo<<e|this.hi>>>32-e,t.hi=this.hi<<e|this.lo>>>32-e),t},At.prototype.setRotateLeft=function(e){return e>32?this.setRotateRight(64-e):(0===e||(32===e?(t=this.lo,this.lo=this.hi,this.hi=t):(t=this.hi<<e|this.lo>>>32-e,this.lo=this.lo<<e|this.hi>>>32-e,this.hi=t)),this);var t},At.prototype.rotateRight=function(e){if(e>32)return this.rotateLeft(64-e);var t=new At(0,0);return 0===e?(t.lo=this.lo>>>0,t.hi=this.hi>>>0):32===e?(t.lo=this.hi,t.hi=this.lo):(t.lo=this.hi<<32-e|this.lo>>>e,t.hi=this.lo<<32-e|this.hi>>>e),t},At.prototype.setFlip=function(){var e;return e=this.lo,this.lo=this.hi,this.hi=e,this},At.prototype.setRotateRight=function(e){return e>32?this.setRotateLeft(64-e):(0===e||(32===e?(t=this.lo,this.lo=this.hi,this.hi=t):(newHigh=this.lo<<32-e|this.hi>>>e,this.lo=this.hi<<32-e|this.lo>>>e,this.hi=newHigh)),this);var t},At.prototype.xor=function(e){var t=new At(0,0);return t.hi=this.hi