@walletconnect/browser-crypto
Version:
Browser Crypto for WalletConnect
23 lines (21 loc) • 106 kB
JavaScript
!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("WalletConnectBrowserCrypto",[],r):"object"==typeof exports?exports.WalletConnectBrowserCrypto=r():t.WalletConnectBrowserCrypto=r()}(this,(function(){return function(t){var r={};function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(n,i,function(r){return t[r]}.bind(null,i));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=12)}([function(t,r,e){"use strict";e.r(r),e.d(r,"__extends",(function(){return i})),e.d(r,"__assign",(function(){return o})),e.d(r,"__rest",(function(){return u})),e.d(r,"__decorate",(function(){return s})),e.d(r,"__param",(function(){return a})),e.d(r,"__metadata",(function(){return h})),e.d(r,"__awaiter",(function(){return f})),e.d(r,"__generator",(function(){return l})),e.d(r,"__exportStar",(function(){return c})),e.d(r,"__values",(function(){return d})),e.d(r,"__read",(function(){return p})),e.d(r,"__spread",(function(){return m})),e.d(r,"__await",(function(){return y})),e.d(r,"__asyncGenerator",(function(){return g})),e.d(r,"__asyncDelegator",(function(){return v})),e.d(r,"__asyncValues",(function(){return w})),e.d(r,"__makeTemplateObject",(function(){return M})),e.d(r,"__importStar",(function(){return b})),e.d(r,"__importDefault",(function(){return _}));
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(t,r)};function i(t,r){function e(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}var o=function(){return(o=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var i in r=arguments[e])Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i]);return t}).apply(this,arguments)};function u(t,r){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)r.indexOf(n[i])<0&&(e[n[i]]=t[n[i]])}return e}function s(t,r,e,n){var i,o=arguments.length,u=o<3?r:null===n?n=Object.getOwnPropertyDescriptor(r,e):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(t,r,e,n);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(u=(o<3?i(u):o>3?i(r,e,u):i(r,e))||u);return o>3&&u&&Object.defineProperty(r,e,u),u}function a(t,r){return function(e,n){r(e,n,t)}}function h(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)}function f(t,r,e,n){return new(e||(e=Promise))((function(i,o){function u(t){try{a(n.next(t))}catch(t){o(t)}}function s(t){try{a(n.throw(t))}catch(t){o(t)}}function a(t){t.done?i(t.value):new e((function(r){r(t.value)})).then(u,s)}a((n=n.apply(t,r||[])).next())}))}function l(t,r){var e,n,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(e)throw new TypeError("Generator is already executing.");for(;u;)try{if(e=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return u.label++,{value:o[1],done:!1};case 5:u.label++,n=o[1],o=[0];continue;case 7:o=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){u=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){u.label=o[1];break}if(6===o[0]&&u.label<i[1]){u.label=i[1],i=o;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(o);break}i[2]&&u.ops.pop(),u.trys.pop();continue}o=r.call(t,u)}catch(t){o=[6,t],n=0}finally{e=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function c(t,r){for(var e in t)r.hasOwnProperty(e)||(r[e]=t[e])}function d(t){var r="function"==typeof Symbol&&t[Symbol.iterator],e=0;return r?r.call(t):{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}}}function p(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var n,i,o=e.call(t),u=[];try{for(;(void 0===r||r-- >0)&&!(n=o.next()).done;)u.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(e=o.return)&&e.call(o)}finally{if(i)throw i.error}}return u}function m(){for(var t=[],r=0;r<arguments.length;r++)t=t.concat(p(arguments[r]));return t}function y(t){return this instanceof y?(this.v=t,this):new y(t)}function g(t,r,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,i=e.apply(t,r||[]),o=[];return n={},u("next"),u("throw"),u("return"),n[Symbol.asyncIterator]=function(){return this},n;function u(t){i[t]&&(n[t]=function(r){return new Promise((function(e,n){o.push([t,r,e,n])>1||s(t,r)}))})}function s(t,r){try{(e=i[t](r)).value instanceof y?Promise.resolve(e.value.v).then(a,h):f(o[0][2],e)}catch(t){f(o[0][3],t)}var e}function a(t){s("next",t)}function h(t){s("throw",t)}function f(t,r){t(r),o.shift(),o.length&&s(o[0][0],o[0][1])}}function v(t){var r,e;return r={},n("next"),n("throw",(function(t){throw t})),n("return"),r[Symbol.iterator]=function(){return this},r;function n(n,i){r[n]=t[n]?function(r){return(e=!e)?{value:y(t[n](r)),done:"return"===n}:i?i(r):r}:i}}function w(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,e=t[Symbol.asyncIterator];return e?e.call(t):(t=d(t),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(e){r[e]=t[e]&&function(r){return new Promise((function(n,i){(function(t,r,e,n){Promise.resolve(n).then((function(r){t({value:r,done:e})}),r)})(n,i,(r=t[e](r)).done,r.value)}))}}}function M(t,r){return Object.defineProperty?Object.defineProperty(t,"raw",{value:r}):t.raw=r,t}function b(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)Object.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r.default=t,r}function _(t){return t&&t.__esModule?t:{default:t}}},function(t,r,e){"use strict";(function(t){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0});const i=n(e(18)),o=n(e(9)),u=n(e(21));function s(t){return new Uint8Array(t)}function a(t,r=!1){const e=t.toString("hex");return r?A(e):e}function h(t){return t.toString("utf8")}function f(t){return p(a(t))}function l(t){return u.default(t)}function c(r){return t.from(_(r),"hex")}function d(t){return s(c(t))}function p(t){return new i.default(_(t),"hex").toNumber()}function m(r){return t.from(r,"utf8")}function y(t,r){const e=_(x(new i.default(t).toString(16)));return r?A(e):e}function g(t,r){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!r||t.length===2+2*r)}function v(r){return t.isBuffer(r)}function w(t){return o.default.strict(t)&&!v(t)}function M(t){return!w(t)&&!v(t)&&void 0!==t.byteLength}function b(t,r,e,n="0"){const i=r-t.length;let o=t;if(i>0){const r=n.repeat(i);o=e?r+t:t+r}return o}function _(t){return t.replace(/^0x/,"")}function A(t){return t.startsWith("0x")?t:"0x"+t}function x(t){return(t=(t=_(t)).length%2!=0?"0"+t:t)&&(t=A(t)),t}r.bufferToArray=s,r.bufferToHex=a,r.bufferToUtf8=h,r.bufferToNumber=f,r.arrayToBuffer=l,r.arrayToHex=function(t,r=!1){return a(l(t),r)},r.arrayToUtf8=function(t){return h(l(t))},r.arrayToNumber=function(t){return f(l(t))},r.hexToBuffer=c,r.hexToArray=d,r.hexToUtf8=function(t){return h(c(t))},r.hexToNumber=p,r.utf8ToBuffer=m,r.utf8ToArray=function(t){return s(m(t))},r.utf8ToHex=function(t,r=!1){return a(m(t),r)},r.utf8ToNumber=function(t){return new i.default(t,10).toNumber()},r.numberToBuffer=function(t){return c(y(t))},r.numberToArray=function(t){return d(y(t))},r.numberToHex=y,r.numberToUtf8=function(t){return new i.default(t).toString()},r.isHexString=g,r.isBuffer=v,r.isTypedArray=w,r.isArrayBuffer=M,r.getType=function(t){return v(t)?"buffer":w(t)?"typed-array":M(t)?"array-buffer":Array.isArray(t)?"array":typeof t},r.getEncoding=function(t){return g(t)?"hex":"utf8"},r.concatBuffers=function(...r){return t.concat(r)},r.trimLeft=function(t,r){const e=t.length-r;return e>0&&(t=t.slice(e)),t},r.trimRight=function(t,r){return t.slice(0,r)},r.padLeft=function(t,r,e="0"){return b(t,r,!0,e)},r.padRight=function(t,r,e="0"){return b(t,r,!1,e)},r.removeHexPrefix=_,r.addHexPrefix=A,r.sanitizeHex=x,r.removeHexLeadingZeros=function(t){const r=t.startsWith("0x");return t=(t=_(t)).startsWith("0")?t.substring(1):t,r?A(t):t}}).call(this,e(7).Buffer)},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=e(0).__importStar(e(1));r.sanitizeHex=function(t){return n.sanitizeHex(t)},r.addHexPrefix=function(t){return n.addHexPrefix(t)},r.removeHexPrefix=function(t){return n.removeHexPrefix(t)},r.removeHexLeadingZeros=function(t){return n.removeHexLeadingZeros(n.addHexPrefix(t))},r.safeJsonParse=function(t){try{return JSON.parse(t)}catch(r){return t}},r.safeJsonStringify=function(t){return"string"==typeof t?t:JSON.stringify(t,(t,r)=>void 0===r?null:r)},r.payloadId=function(){return(new Date).getTime()*Math.pow(10,3)+Math.floor(Math.random()*Math.pow(10,3))},r.uuid=function(){return((t,r)=>{for(r=t="";t++<36;r+=51*t&52?(15^t?8^Math.random()*(20^t?16:4):4).toString(16):"-");return r})()},r.logDeprecationWarning=function(){console.warn("DEPRECATION WARNING: This WalletConnect client library will be deprecated in favor of @walletconnect/client. Please check docs.walletconnect.org to learn more about this migration!")}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=e(14);function i(t){return n.detect(t)}function o(){const t=i();return t&&t.os?t.os:void 0}function u(){const t=i();return!(!t||!t.name)&&"node"===t.name.toLowerCase()}function s(t){let r=void 0;return"undefined"!=typeof window&&void 0!==window[t]&&(r=window[t]),r}function a(t){const r=s(t);if(!r)throw new Error(t+" is not defined in Window");return r}function h(){return a("document")}function f(){return s("navigator")}function l(){return a("location")}r.detectEnv=i,r.detectOS=o,r.isIOS=function(){const t=o();return!!t&&t.toLowerCase().includes("ios")},r.isMobile=function(){const t=o();return!!t&&(t.toLowerCase().includes("android")||t.toLowerCase().includes("ios"))},r.isNode=u,r.isBrowser=function(){return!u()&&!!f()},r.unsafeGetFromWindow=s,r.safeGetFromWindow=a,r.getDocument=h,r.getDocumentUnsafe=function(){return s("document")},r.getNavigator=function(){return a("navigator")},r.getNavigatorUnsafe=f,r.getLocation=l,r.getLocationUnsafe=function(){return s("location")},r.getCrypto=function(){return a("crypto")},r.getCryptoUnsafe=function(){return s("crypto")},r.getLocalStorage=function(){return a("localStorage")},r.getLocalStorageUnsafe=function(){return s("localStorage")},r.getMeta=function(){let t,r;try{t=h(),r=l()}catch(t){return null}function e(...r){const e=t.getElementsByTagName("meta");for(let t=0;t<e.length;t++){const n=e[t],i=["itemprop","property","name"].map(t=>n.getAttribute(t)).filter(t=>{t&&r.includes(t)});if(i.length&&i){const t=n.getAttribute("content");if(t)return t}}return""}const n=function(){let r=e("name","og:site_name","og:title","twitter:title");return r||(r=t.title),r}();return{description:e("description","og:description","twitter:description","keywords"),url:r.origin,icons:function(){const e=t.getElementsByTagName("link"),n=[];for(let t=0;t<e.length;t++){const i=e[t],o=i.getAttribute("rel");if(o&&o.toLowerCase().indexOf("icon")>-1){const t=i.getAttribute("href");if(t)if(-1===t.toLowerCase().indexOf("https:")&&-1===t.toLowerCase().indexOf("http:")&&0!==t.indexOf("//")){let e=r.protocol+"//"+r.host;if(0===t.indexOf("/"))e+=t;else{const n=r.pathname.split("/");n.pop();e+=n.join("/")+"/"+t}n.push(e)}else if(0===t.indexOf("//")){const e=r.protocol+t;n.push(e)}else n.push(t)}}return n}(),name:n}}},function(t,r){var e,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function s(t){if(e===setTimeout)return setTimeout(t,0);if((e===o||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:o}catch(t){e=o}try{n="function"==typeof clearTimeout?clearTimeout:u}catch(t){n=u}}();var a,h=[],f=!1,l=-1;function c(){f&&a&&(f=!1,a.length?h=a.concat(h):l=-1,h.length&&d())}function d(){if(!f){var t=s(c);f=!0;for(var r=h.length;r;){for(a=h,h=[];++l<r;)a&&a[l].run();l=-1,r=h.length}a=null,f=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===u||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(r){try{return n.call(null,t)}catch(r){return n.call(this,t)}}}(t)}}function p(t,r){this.fun=t,this.array=r}function m(){}i.nextTick=function(t){var r=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)r[e-1]=arguments[e];h.push(new p(t,r)),1!==h.length||f||s(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.reservedEvents=["session_request","session_update","exchange_key","connect","disconnect","display_uri","modal_closed","transport_open","transport_close"],r.signingMethods=["eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v2","eth_signTypedData_v3","eth_signTypedData_v4","personal_sign"],r.stateMethods=["eth_accounts","eth_chainId","net_version"],r.deeplinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE"},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=e(0).__importStar(e(1));r.convertArrayBufferToBuffer=function(t){return n.arrayToBuffer(new Uint8Array(t))},r.convertArrayBufferToUtf8=function(t){return n.arrayToUtf8(new Uint8Array(t))},r.convertArrayBufferToHex=function(t,r){return n.arrayToHex(new Uint8Array(t),!r)},r.convertArrayBufferToNumber=function(t){return n.arrayToNumber(new Uint8Array(t))},r.concatArrayBuffers=function(...t){return n.hexToArray(t.map(t=>n.arrayToHex(new Uint8Array(t))).join("")).buffer},r.convertBufferToArrayBuffer=function(t){return n.bufferToArray(t).buffer},r.convertBufferToUtf8=function(t){return n.bufferToUtf8(t)},r.convertBufferToHex=function(t,r){return n.bufferToHex(t,!r)},r.convertBufferToNumber=function(t){return n.bufferToNumber(t)},r.concatBuffers=function(...t){return n.concatBuffers(...t)},r.convertUtf8ToArrayBuffer=function(t){return n.utf8ToArray(t).buffer},r.convertUtf8ToBuffer=function(t){return n.utf8ToBuffer(t)},r.convertUtf8ToHex=function(t,r){return n.utf8ToHex(t,!r)},r.convertUtf8ToNumber=function(t){return n.utf8ToNumber(t)},r.convertHexToBuffer=function(t){return n.hexToBuffer(t)},r.convertHexToArrayBuffer=function(t){return n.hexToArray(t).buffer},r.convertHexToUtf8=function(t){return n.hexToUtf8(t)},r.convertHexToNumber=function(t){return n.hexToNumber(t)},r.convertNumberToBuffer=function(t){return n.numberToBuffer(t)},r.convertNumberToArrayBuffer=function(t){return n.numberToArray(t).buffer},r.convertNumberToUtf8=function(t){return n.numberToUtf8(t)},r.convertNumberToHex=function(t,r){return n.numberToHex(t,!r)}},function(t,r,e){"use strict";(function(t){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
var n=e(15),i=e(16),o=e(17);function u(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,r){if(u()<r)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=a.prototype:(null===t&&(t=new a(r)),t.length=r),t}function a(t,r,e){if(!(a.TYPED_ARRAY_SUPPORT||this instanceof a))return new a(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return h(this,t,r,e)}function h(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n);a.TYPED_ARRAY_SUPPORT?(t=r).__proto__=a.prototype:t=c(t,r);return t}(t,r,e,n):"string"==typeof r?function(t,r,e){"string"==typeof e&&""!==e||(e="utf8");if(!a.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(r,e),i=(t=s(t,n)).write(r,e);i!==n&&(t=t.slice(0,i));return t}(t,r,e):function(t,r){if(a.isBuffer(r)){var e=0|d(r.length);return 0===(t=s(t,e)).length||r.copy(t,0,0,e),t}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||(n=r.length)!=n?s(t,0):c(t,r);if("Buffer"===r.type&&o(r.data))return c(t,r.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,r){if(f(r),t=s(t,r<0?0:0|d(r)),!a.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function c(t,r){var e=r.length<0?0:0|d(r.length);t=s(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function d(t){if(t>=u())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u().toString(16)+" bytes");return 0|t}function p(t,r){if(a.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return D(t).length;default:if(n)return W(t).length;r=(""+r).toLowerCase(),n=!0}}function m(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return O(this,r,e);case"utf8":case"utf-8":return T(this,r,e);case"ascii":return B(this,r,e);case"latin1":case"binary":return E(this,r,e);case"base64":return S(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function y(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function g(t,r,e,n,i){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0){if(!i)return-1;e=0}if("string"==typeof r&&(r=a.from(r,n)),a.isBuffer(r))return 0===r.length?-1:v(t,r,e,n,i);if("number"==typeof r)return r&=255,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):v(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,r,e,n,i){var o,u=1,s=t.length,a=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;u=2,s/=2,a/=2,e/=2}function h(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}if(i){var f=-1;for(o=e;o<s;o++)if(h(t,o)===h(r,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===a)return f*u}else-1!==f&&(o-=o-f),f=-1}else for(e+a>s&&(e=s-a),o=e;o>=0;o--){for(var l=!0,c=0;c<a;c++)if(h(t,o+c)!==h(r,c)){l=!1;break}if(l)return o}return-1}function w(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n))>i&&(n=i):n=i;var o=r.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var u=0;u<n;++u){var s=parseInt(r.substr(2*u,2),16);if(isNaN(s))return u;t[e+u]=s}return u}function M(t,r,e,n){return Y(W(r,t.length-e),t,e,n)}function b(t,r,e,n){return Y(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function _(t,r,e,n){return b(t,r,e,n)}function A(t,r,e,n){return Y(D(r),t,e,n)}function x(t,r,e,n){return Y(function(t,r){for(var e,n,i,o=[],u=0;u<t.length&&!((r-=2)<0);++u)e=t.charCodeAt(u),n=e>>8,i=e%256,o.push(i),o.push(n);return o}(r,t.length-e),t,e,n)}function S(t,r,e){return 0===r&&e===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(r,e))}function T(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o,u,s,a,h=t[i],f=null,l=h>239?4:h>223?3:h>191?2:1;if(i+l<=e)switch(l){case 1:h<128&&(f=h);break;case 2:128==(192&(o=t[i+1]))&&(a=(31&h)<<6|63&o)>127&&(f=a);break;case 3:o=t[i+1],u=t[i+2],128==(192&o)&&128==(192&u)&&(a=(15&h)<<12|(63&o)<<6|63&u)>2047&&(a<55296||a>57343)&&(f=a);break;case 4:o=t[i+1],u=t[i+2],s=t[i+3],128==(192&o)&&128==(192&u)&&128==(192&s)&&(a=(15&h)<<18|(63&o)<<12|(63&u)<<6|63&s)>65535&&a<1114112&&(f=a)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=l}return function(t){var r=t.length;if(r<=4096)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return e}(n)}r.Buffer=a,r.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},r.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),r.kMaxLength=u(),a.poolSize=8192,a._augment=function(t){return t.__proto__=a.prototype,t},a.from=function(t,r,e){return h(null,t,r,e)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(t,r,e){return function(t,r,e,n){return f(r),r<=0?s(t,r):void 0!==e?"string"==typeof n?s(t,r).fill(e,n):s(t,r).fill(e):s(t,r)}(null,t,r,e)},a.allocUnsafe=function(t){return l(null,t)},a.allocUnsafeSlow=function(t){return l(null,t)},a.isBuffer=function(t){return!(null==t||!t._isBuffer)},a.compare=function(t,r){if(!a.isBuffer(t)||!a.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,i=0,o=Math.min(e,n);i<o;++i)if(t[i]!==r[i]){e=t[i],n=r[i];break}return e<n?-1:n<e?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,r){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=a.allocUnsafe(r),i=0;for(e=0;e<t.length;++e){var u=t[e];if(!a.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(n,i),i+=u.length}return n},a.byteLength=p,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 r=0;r<t;r+=2)y(this,r,r+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 r=0;r<t;r+=4)y(this,r,r+3),y(this,r+1,r+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 r=0;r<t;r+=8)y(this,r,r+7),y(this,r+1,r+6),y(this,r+2,r+5),y(this,r+3,r+4);return this},a.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?T(this,0,t):m.apply(this,arguments)},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 this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},a.prototype.compare=function(t,r,e,n,i){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),r<0||e>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&r>=e)return 0;if(n>=i)return-1;if(r>=e)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),u=(e>>>=0)-(r>>>=0),s=Math.min(o,u),h=this.slice(n,i),f=t.slice(r,e),l=0;l<s;++l)if(h[l]!==f[l]){o=h[l],u=f[l];break}return o<u?-1:u<o?1:0},a.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},a.prototype.indexOf=function(t,r,e){return g(this,t,r,e,!0)},a.prototype.lastIndexOf=function(t,r,e){return g(this,t,r,e,!1)},a.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||e>i)&&(e=i),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,t,r,e);case"utf8":case"utf-8":return M(this,t,r,e);case"ascii":return b(this,t,r,e);case"latin1":case"binary":return _(this,t,r,e);case"base64":return A(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function B(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(127&t[i]);return n}function E(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function O(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=H(t[o]);return i}function P(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function R(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function k(t,r,e,n,i,o){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function C(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function U(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>8*(n?i:3-i)&255}function I(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function N(t,r,e,n,o){return o||I(t,0,e,4),i.write(t,r,e,n,23,4),e+4}function L(t,r,e,n,o){return o||I(t,0,e,8),i.write(t,r,e,n,52,8),e+8}a.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t),a.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=a.prototype;else{var i=r-t;e=new a(i,void 0);for(var o=0;o<i;++o)e[o]=this[o+t]}return e},a.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||R(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n},a.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||R(t,r,this.length);for(var n=this[t+--r],i=1;r>0&&(i*=256);)n+=this[t+--r]*i;return n},a.prototype.readUInt8=function(t,r){return r||R(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,r){return r||R(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,r){return r||R(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,r){return r||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,r){return r||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||R(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*r)),n},a.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||R(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*r)),o},a.prototype.readInt8=function(t,r){return r||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,r){r||R(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},a.prototype.readInt16BE=function(t,r){r||R(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},a.prototype.readInt32LE=function(t,r){return r||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,r){return r||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,r){return r||R(t,4,this.length),i.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,r){return r||R(t,4,this.length),i.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,r){return r||R(t,8,this.length),i.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,r){return r||R(t,8,this.length),i.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||k(this,t,r,e,Math.pow(2,8*e)-1,0);var i=1,o=0;for(this[r]=255&t;++o<e&&(i*=256);)this[r+o]=t/i&255;return r+e},a.prototype.writeUIntBE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||k(this,t,r,e,Math.pow(2,8*e)-1,0);var i=e-1,o=1;for(this[r+i]=255&t;--i>=0&&(o*=256);)this[r+i]=t/o&255;return r+e},a.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},a.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):C(this,t,r,!0),r+2},a.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):C(this,t,r,!1),r+2},a.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):U(this,t,r,!0),r+4},a.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):U(this,t,r,!1),r+4},a.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);k(this,t,r,e,i-1,-i)}var o=0,u=1,s=0;for(this[r]=255&t;++o<e&&(u*=256);)t<0&&0===s&&0!==this[r+o-1]&&(s=1),this[r+o]=(t/u>>0)-s&255;return r+e},a.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);k(this,t,r,e,i-1,-i)}var o=e-1,u=1,s=0;for(this[r+o]=255&t;--o>=0&&(u*=256);)t<0&&0===s&&0!==this[r+o+1]&&(s=1),this[r+o]=(t/u>>0)-s&255;return r+e},a.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},a.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):C(this,t,r,!0),r+2},a.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):C(this,t,r,!1),r+2},a.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):U(this,t,r,!0),r+4},a.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):U(this,t,r,!1),r+4},a.prototype.writeFloatLE=function(t,r,e){return N(this,t,r,!0,e)},a.prototype.writeFloatBE=function(t,r,e){return N(this,t,r,!1,e)},a.prototype.writeDoubleLE=function(t,r,e){return L(this,t,r,!0,e)},a.prototype.writeDoubleBE=function(t,r,e){return L(this,t,r,!1,e)},a.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-e&&(n=t.length-r+e);var i,o=n-e;if(this===t&&e<r&&r<n)for(i=o-1;i>=0;--i)t[i+r]=this[i+e];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+r]=this[i+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+o),r);return o},a.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(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)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var o;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(o=r;o<e;++o)this[o]=t;else{var u=a.isBuffer(t)?t:W(new a(t,n).toString()),s=u.length;for(o=0;o<e-r;++o)this[o+r]=u[o%s]}return this};var j=/[^+\/0-9A-Za-z-_]/g;function H(t){return t<16?"0"+t.toString(16):t.toString(16)}function W(t,r){var e;r=r||1/0;for(var n=t.length,i=null,o=[],u=0;u<n;++u){if((e=t.charCodeAt(u))>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(u+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=65536+(i-55296<<10|e-56320)}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function D(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(j,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Y(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}}).call(this,e(8))},function(t,r){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,r){t.exports=i,i.strict=o,i.loose=u;var e=Object.prototype.toString,n={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function i(t){return o(t)||u(t)}function o(t){return t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array}function u(t){return n[e.call(t)]}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=e(0).__importStar(e(1)),i=e(5);r.isEmptyString=function(t){return""===t||"string"==typeof t&&""===t.trim()},r.isEmptyArray=function(t){return!(t&&t.length)},r.isBuffer=function(t){return n.isBuffer(t)},r.isTypedArray=function(t){return n.isTypedArray(t)},r.isArrayBuffer=function(t){return n.isArrayBuffer(t)},r.getType=function(t){return n.getType(t)},r.getEncoding=function(t){return n.getEncoding(t)},r.isHexString=function(t,r){return n.isHexString(t,r)},r.isJsonRpcSubscription=function(t){return"object"==typeof t.params},r.isJsonRpcRequest=function(t){return void 0!==t.method},r.isJsonRpcResponseSuccess=function(t){return void 0!==t.result},r.isJsonRpcResponseError=function(t){return void 0!==t.error},r.isInternalEvent=function(t){return void 0!==t.event},r.isReservedEvent=function(t){return i.reservedEvents.includes(t)||t.startsWith("wc_")},r.isSilentPayload=function(t){return!!t.method.startsWith("wc_")||!i.signingMethods.includes(t.method)}},function(t,r,e){"use strict";function n(t){const r={},e=("?"===t[0]?t.substr(1):t).split("&");for(let t=0;t<e.length;t++){const n=e[t].match(/\w+(?==)/i)||[],i=e[t].match(/=.+/i)||[];n[0]&&(r[decodeURIComponent(n[0])]=decodeURIComponent(i[0].substr(1)))}return r}function i(t){let r="";const e=Object.keys(t);return e&&e.forEach((e,n)=>{const i=t[e];0===n?r=`?${e}=${i}`:r+=`&${e}=${i}`}),r}Object.defineProperty(r,"__esModule",{value:!0}),r.getQueryString=function(t){const r=-1!==t.indexOf("?")?t.indexOf("?"):void 0;return void 0!==r?t.substr(r):""},r.appendToQueryString=function(t,r){let e=n(t);return e=Object.assign(Object.assign({},e),r),t=i(e)},r.parseQueryString=n,r.formatQueryString=i},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=e(0),i=e(13);function o(t){return n.__awaiter(this,void 0,void 0,(function*(){const r=i.getCrypto();return yield r.subtle.exportKey("raw",t)}))}function u(t,r="AES-CBC"){return n.__awaiter(this,void 0,void 0,(function*(){const e="AES-CBC"===r?{length:256,name:"AES-CBC"}:{hash:{name:"SHA-256"},name:"HMAC"},n="AES-CBC"===r?["encrypt","decrypt"]:["sign","verify"],o=i.getCrypto();return yield o.subtle.importKey("raw",t,e,!0,n)}))}function s(t){return n.__awaiter(this,void 0,void 0,(function*(){const r=t||256,e=i.getCrypto(),n=yield e.subtle.generateKey({length:r,name:"AES-CBC"},!0,["encrypt","decrypt"]);return yield o(n)}))}function a(t,r){return n.__awaiter(this,void 0,void 0,(function*(){const e=yield u(r,"HMAC"),n=i.getCrypto();return yield n.subtle.sign({length:256,name:"HMAC"},e,t)}))}function h(t,r){return n.__awaiter(this,void 0,void 0,(function*(){const e=i.convertHexToArrayBuffer(t.data),n=i.convertHexToArrayBuffer(t.iv),o=i.convertHexToArrayBuffer(t.hmac),u=i.convertArrayBufferToHex(o,!0),s=i.concatArrayBuffers(e,n),h=yield a(s,r),f=i.convertArrayBufferToHex(h,!0);return i.removeHexPrefix(u)===i.removeHexPrefix(f)}))}function f(t,r,e){return n.__awaiter(this,void 0,void 0,(function*(){const n=yield u(r,"AES-CBC"),o=i.getCrypto();return yield o.subtle.encrypt({iv:e,name:"AES-CBC"},n,t)}))}function l(t,r,e){return n.__awaiter(this,void 0,void 0,(function*(){const n=yield u(r,"AES-CBC"),o=i.getCrypto();return yield o.subtle.decrypt({iv:e,name:"AES-CBC"},n,t)}))}r.exportKey=o,r.importKey=u,r.generateKey=s,r.createHmac=a,r.verifyHmac=h,r.aesCbcEncrypt=f,r.aesCbcDecrypt=l,r.encrypt=function(t,r,e){return n.__awaiter(this,void 0,void 0,(function*(){if(!r)throw new Error("Missing key: required for encryption");const n=e||(yield s(128)),o=i.convertArrayBufferToHex(n,!0),u=JSON.stringify(t),h=i.convertUtf8ToArrayBuffer(u),l=yield f(h,r,n),c=i.convertArrayBufferToHex(l,!0),d=i.concatArrayBuffers(l,n),p=yield a(d,r);return{data:c,hmac:i.convertArrayBufferToHex(p,!0),iv:o}}))},r.decrypt=function(t,r){return n.__awaiter(this,void 0,void 0,(function*(){if(!r)throw new Error("Missing key: required for decryption");if(!(yield h(t,r)))return null;const e=i.convertHexToArrayBuffer(t.data),n=i.convertHexToArrayBuffer(t.iv),o=yield l(e,r,n),u=i.convertArrayBufferToUtf8(o);let s;try{s=JSON.parse(u)}catch(t){return null}return s}))}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=e(0);n.__exportStar(e(3),r),n.__exportStar(e(5),r),n.__exportStar(e(6),r),n.__exportStar(e(22),r),n.__exportStar(e(25),r),n.__exportStar(e(2),r),n.__exportStar(e(26),r),n.__exportStar(e(27),r),n.__exportStar(e(11),r),n.__exportStar(e(10),r)},function(t,r,e){"use strict";(function(t){var e=this&&this.__spreadArrays||function(){for(var t=0,r=0,e=arguments.length;r<e;r++)t+=arguments[r].length;var n=Array(t),i=0;for(r=0;r<e;r++)for(var o=arguments[r],u=0,s=o.length;u<s;u++,i++)n[i]=o[u];return n};Object.defineProperty(r,"__esModule",{value:!0});var n=function(t,r,e){this.name=t,this.version=r,this.os=e,this.type="browser"};r.BrowserInfo=n;var i=function(r){this.version=r,this.type="node",this.name="node",this.os=t.platform};r.NodeInfo=i;var o=function(t,r,e,n){this.name=t,this.version=r,this.os=e,this.bot=n,this.type="bot-device"};r.SearchBotDeviceInfo=o;var u=function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null};r.BotInfo=u;var s=function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null};r.ReactNativeInfo=s;var a=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,h=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/Edg\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],f=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function l(t){return""!==t&&h.reduce((function(r,e){var n=e[0],i=e[1];if(r)return r;var o=i.exec(t);return!!o&&[n,o]}),!1)}function c(t){var r=l(t);if(!r)return null;var i=r[0],s=r[1];if("searchbot"===i)return new u;var h=s[1]&&s[1].split(/[._]/).slice(0,3);h?h.length<3&&(h=e(h,function(t){for(var r=[],e=0;e<t;e++)r.push("0");return r}(3-h.length))):h=[];var f=h.join("."),c=d(t),p=a.exec(t);return p&&p[1]?new o(i,f,c,p[1]):new n(i,h.join("."),c)}function d(t){for(var r=0,e=f.length;r<e;r++){var n=f[r],i=n[0];if(n[1].exec(t))return i}return null}function p(){return void 0!==t&&t.version?new i(t.version.slice(1)):null}r.detect=function(t){return t?c(t):"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new s:"undefined"!=typeof navigator?c(navigator.userAgent):p()},r.browserName=function(t){var r=l(t);return r?r[0]:null},r.parseUserAgent=c,r.detectOS=d,r.getNodeVersion=p}).call(this,e(4))},function(t,r,e){"use strict";r.byteLength=function(t){var r=h(t),e=r[0],n=r[1];return 3*(e+n)/4-n},r.toByteArray=function(t){var r,e,n=h(t),u=n[0],s=n[1],a=new o(function(t,r,e){return 3*(r+e)/4-e}(0,u,s)),f=0,l=s>0?u-4:u;for(e=0;e<l;e+=4)r=i[t.charCodeAt(e)]<<18|i[t.charCodeAt(e+1)]<<12|i[t.charCodeAt(e+2)]<<6|i[t.charCodeAt(e+3)],a[f++]=r>>16&255,a[f++]=r>>8&255,a[f++]=255&r;2===s&&(r=i[t.charCodeAt(e)]<<2|i[t.charCodeAt(e+1)]>>4,a[f++]=255&r);1===s&&(r=i[t.charCodeAt(e)]<<10|i[t.charCodeAt(e+1)]<<4|i[t.charCodeAt(e+2)]>>2,a[f++]=r>>8&255,a[f++]=255&r);return a},r.fromByteArray=function(t){for(var r,e=t.length,i=e%3,o=[],u=0,s=e-i;u<s;u+=16383)o.push(f(t,u,u+16383>s?s:u+16383));1===i?(r=t[e-1],o.push(n[r>>2]+n[r<<4&63]+"==")):2===i&&(r=(t[e-2]<<8)+t[e-1],o.push(n[r>>10]+n[r>>4&63]+n[r<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=u.length;s<a;++s)n[s]=u[s],i[u.charCodeAt(s)]=s;function h(t){var r=t.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=t.indexOf("=");return-1===e&&(e=r),[e,e===r?0:4-e%4]}function f(t,r,e){for(var i,o,u=[],s=r;s<e;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),u.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return u.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,r){r.read=function(t,r,e,n,i){var o,u,s=8*i-n-1,a=(1<<s)-1,h=a>>1,f=-7,l=e?i-1:0,c=e?-1:1,d=t[r+l];for(l+=c,o=d&(1<<-f)-1,d>>=-f,f+=s;f>0;o=256*o+t[r+l],l+=c,f-=8);for(u=o&(1<<-f)-1,o>>=-f,f+=n;f>0;u=256*u+t[r+l],l+=c,f-=8);if(0===o)o=1-h;else{if(o===a)return u?NaN:1/0*(d?-1:1);u+=Math.pow(2,n),o-=h}return(d?-1:1)*u*Math.pow(2,o-n)},r.write=function(t,r,e,n,i,o){var u,s,a,h=8*o-i-1,f=(1<<h)-1,l=f>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,m=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(s=isNaN(r)?1:0,u=f):(u=Math.floor(Math.log(r)/Math.LN2),r*(a=Math.pow(2,-u))<1&&(u--,a*=2),(r+=u+l>=1?c/a:c*Math.pow(2,1-l))*a>=2&&(u++,a/=2),u+l>=f?(s=0,u=f):u+l>=1?(s=(r*a-1)*Math.pow(2,i),u+=l):(s=r*Math.pow(2,l-1)*Math.pow(2,i),u=0));i>=8;t[e+d]=255&s,d+=p,s/=256,i-=8);for(u=u<<i|s,h+=i;h>0;t[e+d]=255&u,d+=p,u/=256,h-=8);t[e+d-p]|=128*m}},function(t,r){var e={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==e.call(t)}},function(t,r,e){(function(t){!function(t,r){"use strict";function n(t,r){if(!t)throw new Error(r||"Assertion failed")}function i(t,r){t.super_=r;var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t}function o(t,r,e){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==r&&"be"!==r||(e=r,r=10),this._init(t||0,r||10,e||"be"))}var u;"object"==typeof t?t.exports=o:r.BN=o,o.BN=o,o.wordSize=26;try{u=e(20).Buffer}catch(t){}function s(t,r,e){for(var n=0,i=Math.min(t.length,e),o=r;o<i;o++){var u=t.charCodeAt(o)-48;n<<=4,n|=u>=49&&u<=54?u-49+10:u>=17&&u<=22?u-17+10:15&u}return n}function a(t,r,e,n){for(var i=0,o=Math.min(t.length,e),u=r;u<o;u++){var s=t.charCodeAt(u)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,r){return t.cmp(r)>0?t:r},o.min=function(t,r){return t.cmp(r)<0?t:r},o.protot