ethers.js/packages/hardware-wallets/dist/hardware-wallets.esm.min.js

2 lines
45 KiB
JavaScript
Raw Normal View History

2020-05-21 07:07:41 +03:00
let e={};const t=window;null==t._ethers?console.log("WARNING: @ethersproject/hardware-wallet requires ethers loaded first"):e=t._ethers;var r="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s=!1;function a(){s=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;t<r;++t)n[t]=e[t],o[e.charCodeAt(t)]=t;o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63}function u(e,t,r){for(var o,i,s=[],a=t;a<r;a+=3)o=(e[a]<<16)+(e[a+1]<<8)+e[a+2],s.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}function h(e){var t;s||a();for(var r=e.length,o=r%3,i="",h=[],f=0,c=r-o;f<c;f+=16383)h.push(u(e,f,f+16383>c?c:f+16383));return 1===o?(t=e[r-1],i+=n[t>>2],i+=n[t<<4&63],i+="=="):2===o&&(t=(e[r-2]<<8)+e[r-1],i+=n[t>>10],i+=n[t>>4&63],i+=n[t<<2&63],i+="="),h.push(i),h.join("")}function f(e,t,r,n,o){var i,s,a=8*o-n-1,u=(1<<a)-1,h=u>>1,f=-7,c=r?o-1:0,l=r?-1:1,p=e[t+c];for(c+=l,i=p&(1<<-f)-1,p>>=-f,f+=a;f>0;i=256*i+e[t+c],c+=l,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=n;f>0;s=256*s+e[t+c],c+=l,f-=8);if(0===i)i=1-h;else{if(i===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),i-=h}return(p?-1:1)*s*Math.pow(2,i-n)}function c(e,t,r,n,o,i){var s,a,u,h=8*i-o-1,f=(1<<h)-1,c=f>>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(s++,u/=2),s+c>=f?(a=0,s=f):s+c>=1?(a=(t*u-1)*Math.pow(2,o),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,o),s=0));o>=8;e[r+p]=255&a,p+=d,a/=256,o-=8);for(s=s<<o|a,h+=o;h>0;e[r+p]=255&s,p+=d,s/=256,h-=8);e[r+p-d]|=128*g}var l={}.toString,p=Array.isArray||function(e){return"[object Array]"==l.call(e)};v.TYPED_ARRAY_SUPPORT=void 0===r.TYPED_ARRAY_SUPPORT||r.TYPED_ARRAY_SUPPORT;d();function d(){return v.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function g(e,t){if(d()<t)throw new RangeError("Invalid typed array length");return v.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=v.prototype:(null===e&&(e=new v(t)),e.length=t),e}function v(e,t,r){if(!(v.TYPED_ARRAY_SUPPORT||this instanceof v))return new v(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return w(this,e)}return y(this,e,t,r)}function y(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);v.TYPED_ARRAY_SUPPORT?(e=t).__proto__=v.prototype:e=m(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!v.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|A(t,r),o=(e=g(e,n)).write(t,r);o!==n&&(e=e.slice(0,o));return e}(e,t,r):function(e,t){if(T(t)){var r=0|_(t.length);return 0===(e=g(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?g(e,0):m(e,t);if("Buffer"===t.type&&p(t.data))return m(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function E(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function w(e,t){if(E(t),e=g(e,t<0?0:0|_(t)),!v.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function m(e,t){var r=t.length<0?0:0|_(t.length);e=g(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function _(e){if(e>=d())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+d()