trezor-address-validator
Version:
Multicoin address validator for Bitcoin and other altcoins.
1 lines • 198 kB
JavaScript
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).WAValidator=t()}}(function(){return function(){return function t(e,r,n){function o(s,a){if(!r[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var f=new Error("Cannot find module '"+s+"'");throw f.code="MODULE_NOT_FOUND",f}var c=r[s]={exports:{}};e[s][0].call(c.exports,function(t){return o(e[s][1][t]||t)},c,c.exports,t,e,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}}()({1:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer;e.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");var e=new Uint8Array(256);e.fill(255);for(var r=0;r<t.length;r++){var o=t.charAt(r),i=o.charCodeAt(0);if(255!==e[i])throw new TypeError(o+" is ambiguous");e[i]=r}var s=t.length,a=t.charAt(0),u=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function c(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return n.alloc(0);var r=0;if(" "!==t[r]){for(var o=0,i=0;t[r]===a;)o++,r++;for(var f=(t.length-r)*u+1>>>0,c=new Uint8Array(f);t[r];){var l=e[t.charCodeAt(r)];if(255===l)return;for(var h=0,d=f-1;(0!==l||h<i)&&-1!==d;d--,h++)l+=s*c[d]>>>0,c[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=h,r++}if(" "!==t[r]){for(var p=f-i;p!==f&&0===c[p];)p++;var y=n.allocUnsafe(o+(f-p));y.fill(0,0,o);for(var v=o;p!==f;)y[v++]=c[p++];return y}}}return{encode:function(e){if(!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,o=0,i=0,u=e.length;i!==u&&0===e[i];)i++,r++;for(var c=(u-i)*f+1>>>0,l=new Uint8Array(c);i!==u;){for(var h=e[i],d=0,p=c-1;(0!==h||d<o)&&-1!==p;p--,d++)h+=256*l[p]>>>0,l[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");o=d,i++}for(var y=c-o;y!==c&&0===l[y];)y++;for(var v=a.repeat(r);y<c;++y)v+=t.charAt(l[y]);return v},decodeUnsafe:c,decode:function(t){var e=c(t);if(e)return e;throw new Error("Non-base"+s+" character")}}}},{"safe-buffer":128}],2:[function(t,e,r){"use strict";r.byteLength=function(t){var e=f(t),r=e[0],n=e[1];return 3*(r+n)/4-n},r.toByteArray=function(t){for(var e,r=f(t),n=r[0],s=r[1],a=new i(function(t,e,r){return 3*(e+r)/4-r}(0,n,s)),u=0,c=s>0?n-4:n,l=0;l<c;l+=4)e=o[t.charCodeAt(l)]<<18|o[t.charCodeAt(l+1)]<<12|o[t.charCodeAt(l+2)]<<6|o[t.charCodeAt(l+3)],a[u++]=e>>16&255,a[u++]=e>>8&255,a[u++]=255&e;2===s&&(e=o[t.charCodeAt(l)]<<2|o[t.charCodeAt(l+1)]>>4,a[u++]=255&e);1===s&&(e=o[t.charCodeAt(l)]<<10|o[t.charCodeAt(l+1)]<<4|o[t.charCodeAt(l+2)]>>2,a[u++]=e>>8&255,a[u++]=255&e);return a},r.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],s=0,a=r-o;s<a;s+=16383)i.push(c(t,s,s+16383>a?a:s+16383));1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)n[a]=s[a],o[s.charCodeAt(a)]=a;function f(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var o,i,s=[],a=e;a<r;a+=3)o=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},{}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.bech32m=r.bech32=void 0;const n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",o={};for(let t=0;t<n.length;t++){const e=n.charAt(t);o[e]=t}function i(t){const e=t>>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function s(t){let e=1;for(let r=0;r<t.length;++r){const n=t.charCodeAt(r);if(n<33||n>126)return"Invalid prefix ("+t+")";e=i(e)^n>>5}e=i(e);for(let r=0;r<t.length;++r){const n=t.charCodeAt(r);e=i(e)^31&n}return e}function a(t,e,r,n){let o=0,i=0;const s=(1<<r)-1,a=[];for(let n=0;n<t.length;++n)for(o=o<<e|t[n],i+=e;i>=r;)i-=r,a.push(o>>i&s);if(n)i>0&&a.push(o<<r-i&s);else{if(i>=e)return"Excess padding";if(o<<r-i&s)return"Non-zero padding"}return a}function u(t){return a(t,8,5,!0)}function f(t){const e=a(t,5,8,!1);if(Array.isArray(e))return e}function c(t){const e=a(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}function l(t){let e;function r(t,r){if(r=r||90,t.length<8)return t+" too short";if(t.length>r)return"Exceeds length limit";const n=t.toLowerCase(),a=t.toUpperCase();if(t!==n&&t!==a)return"Mixed-case string "+t;const u=(t=n).lastIndexOf("1");if(-1===u)return"No separator character for "+t;if(0===u)return"Missing prefix for "+t;const f=t.slice(0,u),c=t.slice(u+1);if(c.length<6)return"Data too short";let l=s(f);if("string"==typeof l)return l;const h=[];for(let t=0;t<c.length;++t){const e=c.charAt(t),r=o[e];if(void 0===r)return"Unknown character "+e;l=i(l)^r,t+6>=c.length||h.push(r)}return l!==e?"Invalid checksum for "+t:{prefix:f,words:h}}return e="bech32"===t?1:734539939,{decodeUnsafe:function(t,e){const n=r(t,e);if("object"==typeof n)return n},decode:function(t,e){const n=r(t,e);if("object"==typeof n)return n;throw new Error(n)},encode:function(t,r,o){if(o=o||90,t.length+7+r.length>o)throw new TypeError("Exceeds length limit");let a=s(t=t.toLowerCase());if("string"==typeof a)throw new Error(a);let u=t+"1";for(let t=0;t<r.length;++t){const e=r[t];if(e>>5!=0)throw new Error("Non 5-bit word");a=i(a)^e,u+=n.charAt(e)}for(let t=0;t<6;++t)a=i(a);a^=e;for(let t=0;t<6;++t){const e=a>>5*(5-t)&31;u+=n.charAt(e)}return u},toWords:u,fromWordsUnsafe:f,fromWords:c}}r.bech32=l("bech32"),r.bech32m=l("bech32m")},{}],4:[function(t,e,r){(function(t){var r,n=20,o=4,i=-7,s=21,a=-1e9,u=1e9,f=!0,c=parseInt,l=b.prototype,h="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",d=0,p=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},v=b(1);function b(t,e){var i,s,c,l,v,w,A=this;if(!(A instanceof b))return new b(t,e);if(t instanceof b){if(d=0,e===i)return A.s=t.s,A.e=t.e,void(A.c=(t=t.c)?t.slice():t);t+=""}if("string"!=typeof t&&(t=(c="number"==typeof t||"[object Number]"==Object.prototype.toString.call(t))&&0===t&&1/t<0?"-0":t+""),w=t,e===i&&p.test(t))A.s="-"==t.charAt(0)?(t=t.slice(1),-1):1;else{if(10==e)return _(t,n,o);if(t=y.call(t).replace(/^\+(?!-)/,""),A.s="-"==t.charAt(0)?(t=t.replace(/^-(?!-)/,""),-1):1,null!=e?e!=(0|e)&&f||(r=!(e>=2&&e<65))?(g(e,2),v=p.test(t)):(l="["+h.slice(0,e|=0)+"]+",t=t.replace(/\.$/,"").replace(/^\./,"0."),(v=new RegExp("^"+l+"(?:\\."+l+")?$",e<37?"i":"").test(t))?(c&&(t.replace(/^0\.0*|\./,"").length>15&&g(w,0),c=!c),t=m(t,10,e,A.s)):"Infinity"!=t&&"NaN"!=t&&(g(w,1,e),t="NaN")):v=p.test(t),!v)return A.c=A.e=null,"Infinity"!=t&&("NaN"!=t&&g(w,3),A.s=null),void(d=0)}for((i=t.indexOf("."))>-1&&(t=t.replace(".","")),(s=t.search(/e/i))>0?(i<0&&(i=s),i+=+t.slice(s+1),t=t.substring(0,s)):i<0&&(i=t.length),s=0;"0"==t.charAt(s);s++);if(e=t.length,c&&e>15&&t.slice(s).length>15&&g(w,0),d=0,(i-=s+1)>u)A.c=A.e=null;else if(s==e||i<a)A.c=[A.e=0];else{for(;"0"==t.charAt(--e););for(A.e=i,A.c=[],i=0;s<=e;A.c[i++]=+t.charAt(s++));}}function g(t,e,n,o,i,s){if(f){var a,u=["new BigNumber","cmp","div","eq","gt","gte","lt","lte","minus","mod","plus","times","toFr"][d?d<0?-d:d:1/d<0?1:0]+"()",c=r?" out of range":" not a"+(i?" non-zero":"n")+" integer";throw c=([u+" number type has more than 15 significant digits",u+" not a base "+n+" number",u+" base"+c,u+" not a number"][e]||n+"() "+e+(s?" not a boolean or binary digit":c+(o?" or not ["+(r?" negative, positive":" integer, integer")+" ]":"")))+": "+t,r=d=0,(a=new Error(c)).name="BigNumber Error",a}}function m(t,e,r,n){var o,i,s,a,u,f;function c(t,n){var o,i,s=0,a=t.length,u=[0];for(n=n||r;s<a;s++){for(i=u.length,o=0;o<i;u[o]*=n,o++);for(u[0]+=h.indexOf(t.charAt(s)),o=0;o<u.length;o++)u[o]>e-1&&(null==u[o+1]&&(u[o+1]=0),u[o+1]+=u[o]/e^0,u[o]%=e)}return u.reverse()}function l(t){for(var e=0,r=t.length,n="";e<r;n+=h.charAt(t[e++]));return n}if(r<37&&(t=t.toLowerCase()),(o=t.indexOf("."))>-1)if(o=t.length-o-1,i=c(new b(r).pow(o).toF(),10),s=c((a=t.split("."))[1]),a=c(a[0]),u=(f=w(s,i,s.length-i.length,n,e,1&a[a.length-1])).c,o=f.e){for(;++o;u.unshift(0));t=l(a)+"."+l(u)}else u[0]?a[o=a.length-1]<e-1?(++a[o],t=l(a)):t=new b(l(a),e).plus(v).toS(e):t=l(a);else t=l(c(t));return t}function w(t,e,r,o,i,s){var f,c,l,h,d,p=e.slice(),y=f=e.length,g=t.length,m=t.slice(0,f),w=m.length,A=new b(v),_=A.c=[],E=0,S=n+(A.e=r)+1;for(A.s=o,o=S<0?0:S;w++<f;m.push(0));p.unshift(0);do{for(l=0;l<i;l++){if(f!=(w=m.length))h=f>w?1:-1;else for(d=-1,h=0;++d<f;)if(e[d]!=m[d]){h=e[d]>m[d]?1:-1;break}if(!(h<0))break;for(c=w==f?e:p;w;){if(m[--w]<c[w]){for(d=w;d&&!m[--d];m[d]=i-1);--m[d],m[w]+=i}m[w]-=c[w]}for(;!m[0];m.shift());}_[E++]=h?l:++l,m[0]&&h?m[w]=t[y]||0:m=[t[y]]}while((y++<g||null!=m[0])&&o--);return _[0]||1==E||(--A.e,_.shift()),E>S&&x(A,n,i,s,null!=m[0]),A.e>u?A.c=A.e=null:A.e<a&&(A.c=[A.e=0]),A}function A(t,e,r){var n=e-(t=new b(t)).e,o=t.c;if(!o)return t.toS();for(o.length>++e&&x(t,n,10),n=0==o[0]?n+1:r?e:t.e+n+1;o.length<n;o.push(0));return n=t.e,1==r||2==r&&(--e<n||n<=i)?(t.s<0&&o[0]?"-":"")+(o.length>1?(o.splice(1,0,"."),o.join("")):o[0])+(n<0?"e":"e+")+n:t.toS()}function x(t,e,r,n,i){var s=t.c,a=t.s<0,u=r/2,f=t.e+e+1,c=s[f],l=i||f<0||null!=s[f+1];if(i=o<4?(null!=c||l)&&(0==o||2==o&&!a||3==o&&a):c>u||c==u&&(4==o||l||6==o&&(1&s[f-1]||!e&&n)||7==o&&!a||8==o&&a),f<1||!s[0])return s.length=0,s.push(0),i?(s[0]=1,t.e=-e):t.e=0,t;if(s.length=f--,i)for(--r;++s[f]>r;)s[f]=0,f--||(++t.e,s.unshift(1));for(f=s.length;!s[--f];s.pop());return t}function _(t,e,r){var n=o;return o=r,(t=new b(t)).c&&x(t,e,10),o=n,t}b.ROUND_UP=0,b.ROUND_DOWN=1,b.ROUND_CEIL=2,b.ROUND_FLOOR=3,b.ROUND_HALF_UP=4,b.ROUND_HALF_DOWN=5,b.ROUND_HALF_EVEN=6,b.ROUND_HALF_CEIL=7,b.ROUND_HALF_FLOOR=8,b.fromBuffer=function(t,e){e||(e={});var r={1:"big","-1":"little"}[e.endian]||e.endian||"big",n="auto"===e.size?Math.ceil(t.length):e.size||1;if(t.length%n!=0)throw new RangeError("Buffer length ("+t.length+") must be a multiple of size ("+n+")");for(var o=[],i=0;i<t.length;i+=n){for(var s=[],a=0;a<n;a++)s.push(t[i+("big"===r?a:n-a-1)]);o.push(s.map(function(t){return(t<16?"0":"")+t.toString(16)}).join(""))}return b(o.join(""),16)},b.config=function(){var t,e,l=0,h={},p=arguments,y=p[0],v="config",b=function(t,e,n){return!((r=t<e||t>n)||c(t)!=t&&0!==t)},m=y&&"object"==typeof y?function(){if(y.hasOwnProperty(e))return null!=(t=y[e])}:function(){if(p.length>l)return null!=(t=p[l++])};return m(e="DECIMAL_PLACES")&&(b(t,0,1e9)?n=0|t:g(t,e,v)),h[e]=n,m(e="ROUNDING_MODE")&&(b(t,0,8)?o=0|t:g(t,e,v)),h[e]=o,m(e="EXPONENTIAL_AT")&&(b(t,-1e9,1e9)?i=-(s=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,0)&&b(t[1],0,1e9)?(i=~~t[0],s=~~t[1]):g(t,e,v,1)),h[e]=[i,s],m(e="RANGE")&&(b(t,-1e9,1e9)&&~~t?a=-(u=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,-1)&&b(t[1],1,1e9)?(a=~~t[0],u=~~t[1]):g(t,e,v,1,1)),h[e]=[a,u],m(e="ERRORS")&&(t===!!t||1===t||0===t?(r=d=0,c=(f=!!t)?parseInt:parseFloat):g(t,e,v,0,0,1)),h[e]=f,h},l.abs=l.absoluteValue=function(){var t=new b(this);return t.s<0&&(t.s=1),t},l.bitLength=function(){return this.toString(2).length},l.ceil=function(){return _(this,0,2)},l.comparedTo=l.cmp=function(t,e){var r,n=this,o=n.c,i=(d=-d,t=new b(t,e)).c,s=n.s,a=t.s,u=n.e,f=t.e;if(!s||!a)return null;if(r=o&&!o[0],e=i&&!i[0],r||e)return r?e?0:-a:s;if(s!=a)return s;if(r=s<0,e=u==f,!o||!i)return e?0:!o^r?1:-1;if(!e)return u>f^r?1:-1;for(s=-1,a=(u=o.length)<(f=i.length)?u:f;++s<a;)if(o[s]!=i[s])return o[s]>i[s]^r?1:-1;return u==f?0:u>f^r?1:-1},l.dividedBy=l.div=function(t,e){var r=this.c,n=this.e,o=this.s,i=(d=2,t=new b(t,e)).c,s=t.e,a=t.s,u=o==a?1:-1;return(n||r&&r[0])&&(s||i&&i[0])?w(r,i,n-s,u,10):new b(o&&a&&(r?!i||r[0]!=i[0]:i)?r&&0==r[0]||!i?0*u:u/0:NaN)},l.equals=l.eq=function(t,e){return d=3,0===this.cmp(t,e)},l.floor=function(){return _(this,0,3)},l.greaterThan=l.gt=function(t,e){return d=4,this.cmp(t,e)>0},l.greaterThanOrEqualTo=l.gte=l.gt=function(t,e){return d=5,1==(e=this.cmp(t,e))||0===e},l.isFinite=l.isF=function(){return!!this.c},l.isNaN=function(){return!this.s},l.isNegative=l.isNeg=function(){return this.s<0},l.isZero=l.isZ=function(){return!!this.c&&0==this.c[0]},l.lessThan=l.lt=function(t,e){return d=6,this.cmp(t,e)<0},l.lessThanOrEqualTo=l.lte=l.le=function(t,e){return d=7,-1==(e=this.cmp(t,e))||0===e},l.minus=l.sub=function(t,e){var r,n,i,s,u=this,f=u.s;if(e=(d=8,t=new b(t,e)).s,!f||!e)return new b(NaN);if(f!=e)return t.s=-e,u.plus(t);var c=u.c,l=u.e,h=t.c,p=t.e;if(!l||!p){if(!c||!h)return c?(t.s=-e,t):new b(h?u:NaN);if(!c[0]||!h[0])return h[0]?(t.s=-e,t):new b(c[0]?u:3==o?-0:0)}if(c=c.slice(),f=l-p){for((r=(s=f<0)?(f=-f,c):(p=l,h)).reverse(),e=f;e--;r.push(0));r.reverse()}else for(i=((s=c.length<h.length)?c:h).length,f=e=0;e<i;e++)if(c[e]!=h[e]){s=c[e]<h[e];break}if(s&&(r=c,c=h,h=r,t.s=-t.s),(e=-((i=c.length)-h.length))>0)for(;e--;c[i++]=0);for(e=h.length;e>f;){if(c[--e]<h[e]){for(n=e;n&&!c[--n];c[n]=9);--c[n],c[e]+=10}c[e]-=h[e]}for(;0==c[--i];c.pop());for(;0==c[0];c.shift(),--p);return(p<a||!c[0])&&(c[0]||(t.s=3==o?-1:1),c=[p=0]),t.c=c,t.e=p,t},l.modulo=l.mod=function(t,e){var r=this,i=r.c,s=(d=9,t=new b(t,e)).c,a=r.s,u=t.s;return(e=!a||!u||s&&!s[0])||i&&!i[0]?new b(e?NaN:r):(r.s=t.s=1,e=1==t.cmp(r),r.s=a,t.s=u,e?new b(r):(a=n,u=o,n=0,o=1,r=r.div(t),n=a,o=u,this.minus(r.times(t))))},l.negated=l.neg=function(){var t=new b(this);return t.s=-t.s||null,t},l.plus=l.add=function(t,e){var r,n=this,o=n.s;if(e=(d=10,t=new b(t,e)).s,!o||!e)return new b(NaN);if(o!=e)return t.s=-e,n.minus(t);var i=n.e,s=n.c,a=t.e,f=t.c;if(!i||!a){if(!s||!f)return new b(o/0);if(!s[0]||!f[0])return f[0]?t:new b(s[0]?n:0*o)}if(s=s.slice(),o=i-a){for((r=o>0?(a=i,f):(o=-o,s)).reverse();o--;r.push(0));r.reverse()}for(s.length-f.length<0&&(r=f,f=s,s=r),o=f.length,e=0;o;e=(s[--o]=s[o]+f[o]+e)/10^0,s[o]%=10);for(e&&(s.unshift(e),++a>u&&(s=a=null)),o=s.length;0==s[--o];s.pop());return t.c=s,t.e=a,t},l.toPower=l.pow=function(t){var e=0*t==0?0|t:t,n=new b(this),o=new b(v);if(((r=t<-1e6||t>1e6)&&(e=1*t/0)||c(t)!=t&&0!==t&&!(e=NaN))&&!g(t,"exponent","pow")||!e)return new b(Math.pow(n.toS(),e));for(e=e<0?-e:e;1&e&&(o=o.times(n)),e>>=1;)n=n.times(n);return t<0?v.div(o):o},l.powm=function(t,e){return this.pow(t).mod(e)},l.round=function(t,e){return _(this,t=null==t||((r=t<0||t>1e9)||c(t)!=t)&&!g(t,"decimal places","round")?0:0|t,e=null==e||((r=e<0||e>8)||c(e)!=e&&0!==e)&&!g(e,"mode","round")?o:0|e)},l.squareRoot=l.sqrt=function(){var t,e,r,i,s=this,a=s.c,u=s.s,f=s.e,c=n,l=o,h=new b("0.5");if(1!==u||!a||!a[0])return new b(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);for(u=Math.sqrt(s.toS()),o=1,0==u||u==1/0?((t=a.join("")).length+f&1||(t+="0"),(e=new b(Math.sqrt(t)+"")).c||(e.c=[1]),e.e=((f+1)/2|0)-(f<0||1&f)):e=new b(t=u.toString()),(u=(r=e.e)+(n+=4))<3&&(u=0),f=u;;)if(i=e,e=h.times(i.plus(s.div(i))),i.c.slice(0,u).join("")===e.c.slice(0,u).join("")){if(9!=(a=e.c)[u-=t&&e.e<r]||9!=a[u-1]||9!=a[u-2]||!(9==a[u-3]||t&&4==a[u-3])){if(!(a[f]||a[f-1]||a[f-2]||a[f-3]&&5!=a[f-3]||(a.length>f-2&&(a.length=f-2),e.times(e).eq(s)))){for(;a.length<f-3;)a.push(0);a[f-3]++}return o=l,x(e,n=c,10),e}if(t&&9==a[u-3]&&(i=e.round(c,0)).times(i).eq(s))return o=l,n=c,i;n+=4,u+=4,t=""}},l.times=l.mul=function(t,e){var r,n=this,o=n.c,i=(d=11,t=new b(t,e)).c,s=n.e,f=t.e,c=n.s;if(t.s=c==(e=t.s)?1:-1,!((s||o&&o[0])&&(f||i&&i[0])))return new b(!c||!e||o&&!o[0]&&!i||i&&!i[0]&&!o?NaN:o&&i?0*t.s:t.s/0);for(t.e=s+f,(c=o.length)<(e=i.length)&&(r=o,o=i,i=r,f=c,c=e,e=f),f=c+e,r=[];f--;r.push(0));for(s=e-1;s>-1;s--){for(e=0,f=c+s;f>s;e=r[f]+i[s]*o[f-s-1]+e,r[f--]=e%10|0,e=e/10|0);e&&(r[f]=(r[f]+e)%10)}for(e&&++t.e,!r[0]&&r.shift(),f=r.length;!r[--f];r.pop());return t.c=t.e>u?t.e=null:t.e<a?[t.e=0]:r,t},l.toBuffer=function(e){if("string"==typeof e){if("mpint"!==e)return"Unsupported Buffer representation";var r=this.abs(),n=1===(c=r.toBuffer({size:1,endian:"big"})).length&&0===c[0]?0:c.length;128&c[0]&&n++;var o=new t(4+n);n>0&&c.copy(o,4+(128&c[0]?1:0)),128&c[0]&&(o[4]=0),o[0]=n&255<<24,o[1]=n&255<<16,o[2]=65280&n,o[3]=255&n;var i=this.lt(0);if(i)for(var s=4;s<o.length;s++)o[s]=255-o[s];return o[4]=127&o[4]|(i?128:0),i&&o[o.length-1]++,o}e||(e={});var a={1:"big","-1":"little"}[e.endian]||e.endian||"big",u=this.toString(16);if("-"===u.charAt(0))throw new Error("converting negative numbers to Buffers not supported yet");for(var f="auto"===e.size?Math.ceil(u.length/2):e.size||1,c=(n=Math.ceil(u.length/(2*f))*f,new t(n));u.length<2*n;)u="0"+u;return u.split(new RegExp("(.{"+2*f+"})")).filter(function(t){return t.length>0}).forEach(function(t,e){for(var r=0;r<f;r++){c[e*f+("big"===a?r:f-r-1)]=parseInt(t.slice(2*r,2*r+2),16)}}),c},l.toExponential=l.toE=function(t){return A(this,(null==t||((r=t<0||t>1e9)||c(t)!=t&&0!==t)&&!g(t,"decimal places","toE"))&&this.c?this.c.length-1:0|t,1)},l.toFixed=l.toF=function(t){var e,n,o,a=this;return null==t||((r=t<0||t>1e9)||c(t)!=t&&0!==t)&&!g(t,"decimal places","toF")||(o=a.e+(0|t)),e=i,t=s,i=-(s=1/0),o==n?n=a.toS():(n=A(a,o),a.s<0&&a.c&&(a.c[0]?n.indexOf("-")<0&&(n="-"+n):n=n.replace(/^-/,""))),i=e,s=t,n},l.toFraction=l.toFr=function(t){var e,i,s,a,c,l,h,p=a=new b(v),y=s=new b("0"),m=this,w=m.c,A=u,x=n,_=o,E=new b(v);if(!w)return m.toS();for(h=E.e=w.length-m.e-1,(null==t||(!(d=12,l=new b(t)).s||(r=l.cmp(p)<0||!l.c)||f&&l.e<l.c.length-1)&&!g(t,"max denominator","toFr")||(t=l).cmp(E)>0)&&(t=h>0?E:p),u=1/0,l=new b(w.join("")),n=0,o=1;e=l.div(E),1!=(c=a.plus(e.times(y))).cmp(t);)a=y,y=c,p=s.plus(e.times(c=p)),s=c,E=l.minus(e.times(c=E)),l=c;return c=t.minus(a).div(y),s=s.plus(c.times(p)),a=a.plus(c.times(y)),s.s=p.s=m.s,n=2*h,o=_,i=p.div(y).minus(m).abs().cmp(s.div(a).minus(m).abs())<1?[p.toS(),y.toS()]:[s.toS(),a.toS()],u=A,n=x,i},l.toPrecision=l.toP=function(t){return null==t||((r=t<1||t>1e9)||c(t)!=t)&&!g(t,"precision","toP")?this.toS():A(this,0|--t,2)},l.toString=l.toS=function(t){var e,n,o,a=this,u=a.e;if(null===u)n=a.s?"Infinity":"NaN";else{if(t===e&&(u<=i||u>=s))return A(a,a.c.length-1,1);if(n=a.c.join(""),u<0){for(;++u;n="0"+n);n="0."+n}else if(o=n.length,u>0)if(++u>o)for(u-=o;u--;n+="0");else u<o&&(n=n.slice(0,u)+"."+n.slice(u));else if(e=n.charAt(0),o>1)n=e+"."+n.slice(1);else if("0"==e)return e;if(null!=t)if((r=!(t>=2&&t<65))||t!=(0|t)&&f)g(t,"base","toS");else if("0"==(n=m(n,0|t,10,a.s)))return n}return a.s<0?"-"+n:n},l.valueOf=function(){return this.toS()},e.exports=b}).call(this,t("buffer").Buffer)},{buffer:5}],5:[function(t,e,r){"use strict";var n=t("base64-js"),o=t("ieee754");r.Buffer=a,r.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function s(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=a.prototype,e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|d(t,e),n=s(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return l(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(H(t,ArrayBuffer)||t&&H(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r);return n.__proto__=a.prototype,n}(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return a.from(n,e,r);var o=function(t){if(a.isBuffer(t)){var e=0|h(t.length),r=s(e);return 0===r.length?r:(t.copy(r,0,0,e),r)}if(void 0!==t.length)return"number"!=typeof t.length||P(t.length)?s(0):l(t);if("Buffer"===t.type&&Array.isArray(t.data))return l(t.data)}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive]("string"),e,r);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 c(t){return f(t),s(t<0?0:0|h(t))}function l(t){for(var e=t.length<0?0:0|h(t.length),r=s(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function h(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function d(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||H(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 r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return L(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(o)return n?-1:L(t).length;e=(""+e).toLowerCase(),o=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),P(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,o){var i,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){var c=-1;for(i=r;i<a;i++)if(f(t,i)===f(e,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===u)return c*s}else-1!==c&&(i-=i-c),c=-1}else for(r+u>a&&(r=a-u),i=r;i>=0;i--){for(var l=!0,h=0;h<u;h++)if(f(t,i+h)!==f(e,h)){l=!1;break}if(l)return i}return-1}function b(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(P(a))return s;t[r+s]=a}return s}function g(t,e,r,n){return M(L(e,t.length-r),t,r,n)}function m(t,e,r,n){return M(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function w(t,e,r,n){return m(t,e,r,n)}function A(t,e,r,n){return M(F(e),t,r,n)}function x(t,e,r,n){return M(function(t,e){for(var r,n,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function _(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,s,a,u,f=t[o],c=null,l=f>239?4:f>223?3:f>191?2:1;if(o+l<=r)switch(l){case 1:f<128&&(c=f);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&f)<<6|63&i)>127&&(c=u);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(u=(15&f)<<12|(63&i)<<6|63&s)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:i=t[o+1],s=t[o+2],a=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(u=(15&f)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,l=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=l}return function(t){var e=t.length;if(e<=S)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=S));return r}(n)}r.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),a.TYPED_ARRAY_SUPPORT||"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(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),a.poolSize=8192,a.from=function(t,e,r){return u(t,e,r)},a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,a.alloc=function(t,e,r){return function(t,e,r){return f(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},a.allocUnsafe=function(t){return c(t)},a.allocUnsafeSlow=function(t){return c(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype},a.compare=function(t,e){if(H(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),H(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},a.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}},a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=a.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var i=t[r];if(H(i,Uint8Array)&&(i=a.from(i)),!a.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},a.byteLength=d,a.prototype._isBuffer=!0,a.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 e=0;e<t;e+=2)p(this,e,e+1);return this},a.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 e=0;e<t;e+=4)p(this,e,e+3),p(this,e+1,e+2);return this},a.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 e=0;e<t;e+=8)p(this,e,e+7),p(this,e+1,e+6),p(this,e+2,e+5),p(this,e+3,e+4);return this},a.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?E(this,0,t):function(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return B(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return T(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return _(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.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+">"},a.prototype.compare=function(t,e,r,n,o){if(H(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var i=o-n,s=r-e,u=Math.min(i,s),f=this.slice(n,o),c=t.slice(e,r),l=0;l<u;++l)if(f[l]!==c[l]){i=f[l],s=c[l];break}return i<s?-1:s<i?1:0},a.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},a.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return g(this,t,e,r);case"ascii":return m(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var S=4096;function T(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function k(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function B(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=N(t[i]);return o}function C(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function U(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,o,i){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function R(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(t,e,r,n,i){return e=+e,r>>>=0,i||R(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,i){return e=+e,r>>>=0,i||R(t,0,r,8),o.write(t,e,r,n,52,8),r+8}a.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return n.__proto__=a.prototype,n},a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},a.prototype.readUInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||U(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||U(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},a.prototype.readInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||U(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||U(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||U(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||U(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return t>>>=0,e||U(t,4,this.length),o.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||U(t,4,this.length),o.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},a.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},a.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i<r&&(s*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeFloatLE=function(t,e,r){return I(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return I(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,n){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=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-e<n-r&&(n=t.length-e+r);var o=n-r;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(e,r,n);else if(this===t&&r<e&&e<n)for(var i=o-1;i>=0;--i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},a.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.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);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var s=a.isBuffer(t)?t:a.from(t,n),u=s.length;if(0===u)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=s[i%u]}return this};var j=/[^+/0-9A-Za-z-_]/g;function N(t){return t<16?"0"+t.toString(16):t.toString(16)}function L(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function F(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(j,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function M(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function H(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function P(t){return t!=t}},{"base64-js":2,ieee754:36}],6:[function(t,e,r){!function(t,r){"use strict";var n=Math.pow(2,-24),o=Math.pow(2,32),i=Math.pow(2,53);var s={encode:function(t){var e,n=new ArrayBuffer(256),s=new DataView(n),a=0;function u(t){for(var r=n.byteLength,o=a+t;r<o;)r*=2;if(r!==n.byteLength){var i=s;n=new ArrayBuffer(r),s=new DataView(n);for(var u=a+3>>2,f=0;f<u;++f)s.setUint32(4*f,i.getUint32(4*f))}return e=t,s}function f(){a+=e}function c(t){f(u(1).setUint8(a,t))}function l(t){for(var e=u(t.length),r=0;r<t.length;++r)e.setUint8(a+r,t[r]);f()}function h(t,e){var r;e<24?c(t<<5|e):e<256?(c(t<<5|24),c(e)):e<65536?(c(t<<5|25),r=e,f(u(2).setUint16(a,r))):e<4294967296?(c(t<<5|26),function(t){f(u(4).setUint32(a,t))}(e)):(c(t<<5|27),function(t){var e=t%o,r=(t-e)/o,n=u(8);n.setUint32(a,r),n.setUint32(a+4,e),f()}(e))}if(function t(e){var n;if(!1===e)return c(244);if(!0===e)return c(245);if(null===e)return c(246);if(e===r)return c(247);switch(typeof e){case"number":if(Math.floor(e)===e){if(0<=e&&e<=i)return h(0,e);if(-i<=e&&e<0)return h(1,-(e+1))}return c(251),function(t){f(u(8).setFloat64(a,t))}(e);case"string":var o=[];for(n=0;n<e.length;++n){var s=e.charCodeAt(n);s<128?o.push(s):s<2048?(o.push(192|s>>6),o.push(128|63&s)):s<55296?(o.push(224|s>>12),o.push(128|s>>6&63),o.push(128|63&s)):(s=(1023&s)<<10,s|=1023&e.charCodeAt(++n),s+=65536,o.push(240|s>>18),o.push(128|s>>12&63),o.push(128|s>>6&63),o.push(128|63&s))}return h(3,o.length),l(o);default:var d;if(Array.isArray(e))for(h(4,d=e.length),n=0;n<d;++n)t(e[n]);else if(e instanceof Uint8Array)h(2,e.length),l(e);else{var p=Object.keys(e);for(h(5,d=p.length),n=0;n<d;++n){var y=p[n];t(y),t(e[y])}}}}(t),"slice"in n)return n.slice(0,a);for(var d=new ArrayBuffer(a),p=new DataView(d),y=0;y<a;++y)p.setUint8(y,s.getUint8(y));return d},decode:function(t,e,i){var s=new DataView(t),a=0;function u(t,e){return a+=e,t}function f(e){return u(new Uint8Array(t,a,e),e)}function c(){return u(s.getUint8(a),1)}function l(){return u(s.getUint16(a),2)}function h(){return u(s.getUint32(a),4)}function d(){return 255===s.getUint8(a)&&(a+=1,!0)}function p(t){if(t<24)return t;if(24===t)return c();if(25===t)return l();if(26===t)return h();if(27===t)return h()*o+h();if(31===t)return-1;throw"Invalid length encoding"}function y(t){var e=c();if(255===e)return-1;var r=p(31&e);if(r<0||e>>5!==t)throw"Invalid indefinite length element";return r}function v(t,e){for(var r=0;r<e;++r){var n=c();128&n&&(n<224?(n=(31&n)<<6|63&c(),e-=1):n<240?(n=(15&n)<<12|(63&c())<<6|63&c(),e-=2):(n=(15&n)<<18|(63&c())<<12|(63&c())<<6|63&c(),e-=3)),n<65536?t.push(n):(n-=65536,t.push(55296|n>>10),t.push(56320|1023&n))}}"function"!=typeof e&&(e=function(t){return t}),"function"!=typeof i&&(i=function(){return r});var b=function t(){var o,h,b=c(),g=b>>5,m=31&b;if(7===g)switch(m){case 25:return function(){var t=new ArrayBuffer(4),e=new DataView(t),r=l(),o=32768&r,i=31744&r,s=1023&r;if(31744===i)i=261120;else if(0!==i)i+=114688;else if(0!==s)return s*n;return e.setUint32(0,o<<16|i<<13|s<<13),e.getFloat32(0)}();case 26:return u(s.getFloat32(a),4);case 27:return u(s.getFloat64(a),8)}if((h=p(m))<0&&(g<2||6<g))throw"Invalid length";switch(g){case 0:return h;case 1:return-1-h;case 2:if(h<0){for(var w=[],A=0;(h=y(g))>=0;)A+=h,w.push(f(h));var x=new Uint8Array(A),_=0;for(o=0;o<w.length;++o)x.set(w[o],_),_+=w[o].length;return x}return f(h);case 3:var E=[];if(h<0)for(;(h=y(g))>=0;)v(E,h);else v(E,h);return String.fromCharCode.apply(null,E);case 4:var S;if(h<0)for(S=[];!d();)S.push(t());else for(S=new Array(h),o=0;o<h;++o)S[o]=t();return S;case 5:var T={};for(o=0;o<h||h<0&&!d();++o)T[t()]=t();return T;case 6:return e(t(),h);case 7:switch(h){case 20:return!1;case 21:return!0;case 22:return null;case 23:return r;default:return i(h)}}}();if(a!==t.byteLength)throw"Remaining bytes";return b}};void 0!==e&&e.exports?e.exports=s:t.CBOR||(t.CBOR=s)}(this)},{}],7:[function(t,e,r){"use strict";e.exports=t("./es6/crc1").default},{"./es6/crc1":18}],8:[function(t,e,r){"use strict";e.exports=t("./es6/crc16").default},{"./es6/crc16":19}],9:[function(t,e,r){"use strict";e.exports=t("./es6/crc16ccitt").default},{"./es6/crc16ccitt":20}],10:[function(t,e,r){"use strict";e.exports=t("./es6/crc16kermit").default},{"./es6/crc16kermit":21}],11:[function(t,e,r){"use strict";e.exports=t("./es6/crc16modbus").default},{"./es6/crc16modbus":22}],12:[function(t,e,r){"use strict";e.exports=t("./es6/crc16xmodem").default},{"./es6/crc16xmodem":23}],13:[function(t,e,r){"use strict";e.exports=t("./es6/crc24").default},{"./es6/crc24":24}],14:[function(t,e,r){"use strict";e.exports=t("./es6/crc32").default},{"./es6/crc32":25}],15:[function(t,e,r){"use strict";e.exports=t("./es6/crc8").default},{"./es6/crc8":26}],16:[function(t,e,r){"use strict";e.exports=t("./es6/crc81wire").default},{"./es6/crc81wire":27}],17:[function(t,e,r){"use strict";e.exports=t("./es6/crcjam").default},{"./es6/crcjam":28}],18:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=i(t("./create_buffer"));function i(t){return t&&t.__esModule?t:{default:t}}var s=(0,i(t("./define_crc")).default)("crc1",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=~~e,i=0,s=0;s<t.length;s++){i+=t[s]}return(r+=i%256)%256});r.default=s},{"./create_buffer":29,"./define_crc":30,buffer:5}],19:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=s(t("./create_buffer")),i=s(t("./define_crc"));function s(t){return t&&t.__esModule?t:{default:t}}var a=[0,49345,49537,320,49921,960,640,49729,50689,1728,1920,51009,1280,50625,50305,1088,52225,3264,3456,52545,3840,53185,52865,3648,2560,51905,52097,2880,51457,2496,2176,51265,55297,6336,6528,55617,6912,56257,55937,6720,7680,57025,57217,8e3,56577,7616,7296,56385,5120,54465,54657,5440,55041,6080,5760,54849,53761,4800,4992,54081,4352,53697,53377,4160,61441,12480,12672,61761,13056,62401,62081,12864,13824,63169,63361,14144,62721,13760,13440,62529,15360,64705,64897,15680,65281,16320,16e3,65089,64001,15040,15232,64321,14592,63937,63617,14400,10240,59585,59777,10560,60161,11200,10880,59969,60929,11968,12160,61249,11520,60865,60545,11328,58369,9408,9600,58689,9984,59329,59009,9792,8704,58049,58241,9024,57601,8640,8320,57409,40961,24768,24960,41281,25344,41921,41601,25152,26112,42689,42881,26432,42241,26048,25728,42049,27648,44225,44417,27968,44801,28608,28288,44609,43521,27328,27520,43841,26880,43457,43137,26688,30720,47297,47489,31040,47873,31680,31360,47681,48641,32448,32640,48961,32e3,48577,48257,31808,46081,29888,30080,46401,30464,47041,46721,30272,29184,45761,45953,29504,45313,29120,28800,45121,20480,37057,37249,20800,37633,21440,21120,37441,38401,22208,22400,38721,21760,38337,38017,21568,39937,23744,23936,40257,24320,40897,40577,24128,23040,39617,39809,23360,39169,22976,22656,38977,34817,18624,18816,35137,19200,35777,35457,19008,19968,36545,36737,20288,36097,19904,19584,35905,17408,33985,34177,17728,34561,18368,18048,34369,33281,17088,17280,33601,16640,33217,32897,16448];"undefined"!=typeof Int32Array&&(a=new Int32Array(a));var u=(0,i.default)("crc-16",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=~~e,i=0;i<t.length;i++){var s=t[i];r=65535&(a[255&(r^s)]^r>>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],20:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=s(t("./create_buffer")),i=s(t("./define_crc"));function s(t){return t&&t.__esModule?t:{default:t}}var a=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920];"undefined"!=typeof Int32Array&&(a=new Int32Array(a));var u=(0,i.default)("ccitt",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i<t.length;i++){var s=t[i];r=65535&(a[255&(r>>8^s)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],21:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=s(t("./create_buffer")),i=s(t("./define_crc"));function s(t){return t&&t.__esModule?t:{default:t}}var a=[0,4489,8978,12955,17956,22445,25910,29887,35912,40385,44890,48851,51820,56293,59774,63735,4225,264,13203,8730,22181,18220,30135,25662,40137,36160,49115,44626,56045,52068,63999,59510,8450,12427,528,5017,26406,30383,17460,21949,44362,48323,36440,40913,60270,64231,51324,55797,12675,8202,4753,792,30631,26158,21685,17724,48587,44098,40665,36688,64495,60006,55549,51572,16900,21389,24854,28831,1056,5545,10034,14011,52812,57285,60766,64727,34920,39393,43898,47859,21125,17164,29079,24606,5281,1320,14259,9786,57037,53060,64991,60502,39145,35168,48123,43634,25350,29327,16404,20893,9506,13483,1584,6073,61262,65223,52316,56789,43370,47331,35448,39921,29575,25102,20629,16668,13731,9258,5809,1848,65487,60998,56541,52564,47595,43106,39673,35696,33800,38273,42778,46739,49708,54181,57662,61623,2112,6601,11090,15067,20068,24557,28022,31999,38025,34048,47003,42514,53933,49956,61887,57398,6337,2376,15315,10842,24293,20332,32247,27774,42250,46211,34328,38801,58158,62119,49212,53685,10562,14539,2640,7129,28518,32495,19572,24061,46475,41986,38553,34576,62383,57894,53437,49460,14787,10314,6865,2904,32743,28270,23797,19836,50700,55173,58654,62615,32808,37281,41786,45747,19012,23501,26966,30943,3168,7657,12146,16123,54925,50948,62879,58390,37033,33056,46011,41522,23237,19276,31191,26718,7393,3432,16371,11898,59150,63111,50204,54677,41258,45219,33336,37809,27462,31439,18516,23005,11618,15595,3696,8185,63375,58886,54429,50452,45483,40994,37561,33584,31687,27214,22741,18780,15843,11370,7921,3960