rentdynamics
Version:
Package to help facilitate communicating with the Rent Dynamics API
1 lines • 30.6 kB
JavaScript
var RentDynamics=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";(function(e){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(r(2)),i=function(){function t(t){if(this.options=t,this.helpers=new s(t),void 0!==e&&e&&e.fetch)this._fetch=e.fetch.bind(e);else{var n=r(3);this._fetch=n}}return t.prototype.get=function(e,t){void 0===t&&(t={});var r=this.helpers.stringifyParameters(t),n={method:"GET"};n.headers=this.helpers.getHeaders(e+r);var o=this.helpers.getBaseUrl()+e+r;return this._fetch(o.replace(/\|/g,"%7C"),n).then(function(e){return e.ok?e.clone().json().catch(function(t){return e.clone().text()}):e})},t.prototype.put=function(e,t){var r={method:"PUT"};r.headers=this.helpers.getHeaders(e,t),r.body=JSON.stringify(t);var n=this.helpers.getBaseUrl()+e;return this._fetch(n,r).then(function(e){return e.ok?e.clone().json().catch(function(t){return e.clone().text()}):e})},t.prototype.post=function(e,t){var r={method:"POST"};r.headers=this.helpers.getHeaders(e,t),r.body=JSON.stringify(t);var n=this.helpers.getBaseUrl()+e;return this._fetch(n,r).then(function(e){return e.ok?e.clone().json().catch(function(t){return e.clone().text()}):e})},t.prototype.delete=function(e){var t={method:"DELETE"};t.headers=this.helpers.getHeaders(e);var r=this.helpers.getBaseUrl()+e;return this._fetch(r,t).then(function(e){return e.ok?e.clone().json().catch(function(t){return e.clone().text()}):e})},t.prototype.login=function(e,t){var r=this,n=new o.default("SHA-1","TEXT");n.update(t),t=n.getHash("HEX");return this.post("/auth/login",{username:e,password:t}).then(function(e){return r.options.authToken=e.token,e})},t.prototype.logout=function(){var e=this;return this.post("/auth/logout",{authToken:this.options.authToken}).then(function(t){return e.options.authToken=void 0,t})},t}();t.Client=i;var a=function(){return function(){this.apiKey=void 0,this.apiSecretKey=void 0,this.authToken=void 0,this.development=!1,this.service=void 0,this.developmentUrl=void 0,this.baseUrl=void 0}}();t.ClientOptions=a;var s=function(){function e(e){this.options=e}return e.prototype.formatPayload=function(e){var t=this,r={};if(void 0===typeof e||null===e)r=null;else if(e!==Object(e))r=e;else if(Array.isArray(e)){r=[];for(var n=0;n<e.length;n++)r[n]=this.formatPayload(e[n])}else Object.keys(e).sort().forEach(function(n,o){"object"==typeof e[n]?r[n]=t.formatPayload(e[n]):"string"==typeof e[n]?r[n]=e[n].replace(/ /g,""):r[n]=e[n]},this);return r},e.prototype.getBaseUrl=function(){return this.options.development&&this.options.developmentUrl?this.options.developmentUrl:this.options.development?"https://api-dev.rentdynamics.com":this.options.baseUrl?this.options.baseUrl:"https://api.rentdynamics.com"},e.prototype.getHeaders=function(e,t){var r={};if(this.options.apiKey&&this.options.apiSecretKey){void 0!==t&&(t=this.formatPayload(t));var n=Date.now(),o=this.getNonce(n,e,JSON.stringify(t));return this.options.authToken&&(r.Authorization="TOKEN "+this.options.authToken),r["x-rd-api-key"]=this.options.apiKey,r["x-rd-api-nonce"]=o,r["x-rd-timestamp"]=n.toString(),r["Content-Type"]="application/json",r}return r},e.prototype.getNonce=function(e,t,r){if(this.options.apiSecretKey){var n=e+t;void 0!==r&&(n+=r);var i=new o.default("SHA-1","TEXT");return i.setHMACKey(this.options.apiSecretKey,"TEXT"),i.update(n),i.getHMAC("HEX")}return""},e.prototype.stringifyParameters=function(e){var t=[];return e.filters&&this.stringifyFilters(e.filters)&&t.push("filters="+this.stringifyFilters(e.filters)),e.include&&e.include.length&&t.push("include="+e.include.join(",")),e.exclude&&e.exclude.length&&t.push("exclude="+e.exclude.join(",")),e.fields&&e.fields.length&&t.push("fields="+e.fields.join(",")),e.orderBy&&t.push("orderBy="+e.orderBy),e.page&&t.push("page="+e.page),e.pageSize&&t.push("pageSize="+e.pageSize),e.distinct&&t.push("distinct=true"),t.join("&")?"?"+t.join("&"):""},e.prototype.mapKeyValuePairs=function(e,t){var r=[];if(Array.isArray(t))return t.length&&r.push(e+"__in="+t.join(",")),r;if(null!==t&&"object"==typeof t){for(var n in t){var o=void 0;(o=this.mapKeyValuePairs(e+"__"+n,t[n]))&&o.length&&r.push(o.join("|"))}return r}return null!==t&&void 0!==t&&""!==t?(r.push(e+"="+t),r):r},e.prototype.stringifyFilters=function(e){var t=[];for(var r in e){var n=this.mapKeyValuePairs(r,e[r]);n&&n.length&&t.push(n.join("|"))}return t.join("|")},e}();t.ClientHelpers=s}).call(this,r(1))},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";var n;!function(o){function i(e,t,r){var n,o,i,a,p,d,b,w,y,v=0,g=[],A=0,m=!1,E=[],S=[],H=!1,T=!1,B=-1;if(n=(r=r||{}).encoding||"UTF8",(y=r.numRounds||1)!==parseInt(y,10)||1>y)throw Error("numRounds must a integer >= 1");if("SHA-1"===e)p=512,d=D,b=I,a=160,w=function(e){return e.slice()};else if(0===e.lastIndexOf("SHA-",0))if(d=function(t,r){return M(t,r,e)},b=function(t,r,n,o){var i,a;if("SHA-224"===e||"SHA-256"===e)i=15+(r+65>>>9<<4),a=16;else{if("SHA-384"!==e&&"SHA-512"!==e)throw Error("Unexpected error in SHA-2 implementation");i=31+(r+129>>>10<<5),a=32}for(;t.length<=i;)t.push(0);for(t[r>>>5]|=128<<24-r%32,r+=n,t[i]=4294967295&r,t[i-1]=r/4294967296|0,n=t.length,r=0;r<n;r+=a)o=M(t.slice(r,r+a),o,e);if("SHA-224"===e)t=[o[0],o[1],o[2],o[3],o[4],o[5],o[6]];else if("SHA-256"===e)t=o;else if("SHA-384"===e)t=[o[0].a,o[0].b,o[1].a,o[1].b,o[2].a,o[2].b,o[3].a,o[3].b,o[4].a,o[4].b,o[5].a,o[5].b];else{if("SHA-512"!==e)throw Error("Unexpected error in SHA-2 implementation");t=[o[0].a,o[0].b,o[1].a,o[1].b,o[2].a,o[2].b,o[3].a,o[3].b,o[4].a,o[4].b,o[5].a,o[5].b,o[6].a,o[6].b,o[7].a,o[7].b]}return t},w=function(e){return e.slice()},"SHA-224"===e)p=512,a=224;else if("SHA-256"===e)p=512,a=256;else if("SHA-384"===e)p=1024,a=384;else{if("SHA-512"!==e)throw Error("Chosen SHA variant is not supported");p=1024,a=512}else{if(0!==e.lastIndexOf("SHA3-",0)&&0!==e.lastIndexOf("SHAKE",0))throw Error("Chosen SHA variant is not supported");var U=6;if(d=K,w=function(e){var t,r=[];for(t=0;5>t;t+=1)r[t]=e[t].slice();return r},B=1,"SHA3-224"===e)p=1152,a=224;else if("SHA3-256"===e)p=1088,a=256;else if("SHA3-384"===e)p=832,a=384;else if("SHA3-512"===e)p=576,a=512;else if("SHAKE128"===e)p=1344,a=-1,U=31,T=!0;else{if("SHAKE256"!==e)throw Error("Chosen SHA variant is not supported");p=1088,a=-1,U=31,T=!0}b=function(e,t,r,n,o){var i,a=U,s=[],u=(r=p)>>>5,f=0,h=t>>>5;for(i=0;i<h&&t>=r;i+=u)n=K(e.slice(i,i+u),n),t-=r;for(e=e.slice(i),t%=r;e.length<u;)e.push(0);for(e[(i=t>>>3)>>2]^=a<<i%4*8,e[u-1]^=2147483648,n=K(e,n);32*s.length<o&&(e=n[f%5][f/5|0],s.push(e.b),!(32*s.length>=o));)s.push(e.a),0==64*(f+=1)%r&&K(null,n);return s}}i=l(t,n,B),o=L(e),this.setHMACKey=function(t,r,i){var s;if(!0===m)throw Error("HMAC key already set");if(!0===H)throw Error("Cannot set HMAC key after calling update");if(!0===T)throw Error("SHAKE is not supported for HMAC");if(t=(r=l(r,n=(i||{}).encoding||"UTF8",B)(t)).binLen,r=r.value,i=(s=p>>>3)/4-1,s<t/8){for(r=b(r,t,0,L(e),a);r.length<=i;)r.push(0);r[i]&=4294967040}else if(s>t/8){for(;r.length<=i;)r.push(0);r[i]&=4294967040}for(t=0;t<=i;t+=1)E[t]=909522486^r[t],S[t]=1549556828^r[t];o=d(E,o),v=p,m=!0},this.update=function(e){var t,r,n,a=0,s=p>>>5;for(e=(t=i(e,g,A)).binLen,r=t.value,t=e>>>5,n=0;n<t;n+=s)a+p<=e&&(o=d(r.slice(n,n+s),o),a+=p);v+=a,g=r.slice(a>>>5),A=e%p,H=!0},this.getHash=function(t,r){var n,i,l,p;if(!0===m)throw Error("Cannot call getHash after setting HMAC key");if(l=c(r),!0===T){if(-1===l.shakeLen)throw Error("shakeLen must be specified in options");a=l.shakeLen}switch(t){case"HEX":n=function(e){return s(e,a,B,l)};break;case"B64":n=function(e){return u(e,a,B,l)};break;case"BYTES":n=function(e){return f(e,a,B)};break;case"ARRAYBUFFER":try{i=new ArrayBuffer(0)}catch(e){throw Error("ARRAYBUFFER not supported by this environment")}n=function(e){return h(e,a,B)};break;default:throw Error("format must be HEX, B64, BYTES, or ARRAYBUFFER")}for(p=b(g.slice(),A,v,w(o),a),i=1;i<y;i+=1)!0===T&&0!=a%32&&(p[p.length-1]&=16777215>>>24-a%32),p=b(p,a,0,L(e),a);return n(p)},this.getHMAC=function(t,r){var n,i,l,y;if(!1===m)throw Error("Cannot call getHMAC without first setting HMAC key");switch(l=c(r),t){case"HEX":n=function(e){return s(e,a,B,l)};break;case"B64":n=function(e){return u(e,a,B,l)};break;case"BYTES":n=function(e){return f(e,a,B)};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(e){throw Error("ARRAYBUFFER not supported by this environment")}n=function(e){return h(e,a,B)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, or ARRAYBUFFER")}return i=b(g.slice(),A,v,w(o),a),y=d(S,L(e)),n(y=b(i,a,p,y,a))}}function a(e,t){this.a=e,this.b=t}function s(e,t,r,n){var o,i,a,s="";for(t/=8,a=-1===r?3:0,o=0;o<t;o+=1)i=e[o>>>2]>>>8*(a+o%4*r),s+="0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i);return n.outputUpper?s.toUpperCase():s}function u(e,t,r,n){var o,i,a,s,u="",f=t/8;for(s=-1===r?3:0,o=0;o<f;o+=3)for(i=o+1<f?e[o+1>>>2]:0,a=o+2<f?e[o+2>>>2]:0,a=(e[o>>>2]>>>8*(s+o%4*r)&255)<<16|(i>>>8*(s+(o+1)%4*r)&255)<<8|a>>>8*(s+(o+2)%4*r)&255,i=0;4>i;i+=1)u+=8*o+6*i<=t?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(a>>>6*(3-i)&63):n.b64Pad;return u}function f(e,t,r){var n,o,i,a="";for(t/=8,i=-1===r?3:0,n=0;n<t;n+=1)o=e[n>>>2]>>>8*(i+n%4*r)&255,a+=String.fromCharCode(o);return a}function h(e,t,r){t/=8;var n,o,i,a=new ArrayBuffer(t);for(i=new Uint8Array(a),o=-1===r?3:0,n=0;n<t;n+=1)i[n]=e[n>>>2]>>>8*(o+n%4*r)&255;return a}function c(e){var t={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(e=e||{},t.outputUpper=e.outputUpper||!1,!0===e.hasOwnProperty("b64Pad")&&(t.b64Pad=e.b64Pad),!0===e.hasOwnProperty("shakeLen")){if(0!=e.shakeLen%8)throw Error("shakeLen must be a multiple of 8");t.shakeLen=e.shakeLen}if("boolean"!=typeof t.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof t.b64Pad)throw Error("Invalid b64Pad formatting option");return t}function l(e,t,r){switch(t){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(e){case"HEX":e=function(e,t,n){var o,i,a,s,u,f,h=e.length;if(0!=h%2)throw Error("String of HEX type must be in byte increments");for(t=t||[0],u=(n=n||0)>>>3,f=-1===r?3:0,o=0;o<h;o+=2){if(i=parseInt(e.substr(o,2),16),isNaN(i))throw Error("String of HEX type contains invalid characters");for(a=(s=(o>>>1)+u)>>>2;t.length<=a;)t.push(0);t[a]|=i<<8*(f+s%4*r)}return{value:t,binLen:4*h+n}};break;case"TEXT":e=function(e,n,o){var i,a,s,u,f,h,c,l,p=0;if(n=n||[0],f=(o=o||0)>>>3,"UTF8"===t)for(l=-1===r?3:0,s=0;s<e.length;s+=1)for(a=[],128>(i=e.charCodeAt(s))?a.push(i):2048>i?(a.push(192|i>>>6),a.push(128|63&i)):55296>i||57344<=i?a.push(224|i>>>12,128|i>>>6&63,128|63&i):(s+=1,i=65536+((1023&i)<<10|1023&e.charCodeAt(s)),a.push(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)),u=0;u<a.length;u+=1){for(h=(c=p+f)>>>2;n.length<=h;)n.push(0);n[h]|=a[u]<<8*(l+c%4*r),p+=1}else if("UTF16BE"===t||"UTF16LE"===t)for(l=-1===r?2:0,a="UTF16LE"===t&&1!==r||"UTF16LE"!==t&&1===r,s=0;s<e.length;s+=1){for(i=e.charCodeAt(s),!0===a&&(i=(u=255&i)<<8|i>>>8),h=(c=p+f)>>>2;n.length<=h;)n.push(0);n[h]|=i<<8*(l+c%4*r),p+=2}return{value:n,binLen:8*p+o}};break;case"B64":e=function(e,t,n){var o,i,a,s,u,f,h,c,l=0;if(-1===e.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(i=e.indexOf("="),e=e.replace(/\=/g,""),-1!==i&&i<e.length)throw Error("Invalid '=' found in base-64 string");for(t=t||[0],f=(n=n||0)>>>3,c=-1===r?3:0,i=0;i<e.length;i+=4){for(u=e.substr(i,4),a=s=0;a<u.length;a+=1)s|=(o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(u[a]))<<18-6*a;for(a=0;a<u.length-1;a+=1){for(o=(h=l+f)>>>2;t.length<=o;)t.push(0);t[o]|=(s>>>16-8*a&255)<<8*(c+h%4*r),l+=1}}return{value:t,binLen:8*l+n}};break;case"BYTES":e=function(e,t,n){var o,i,a,s,u,f;for(t=t||[0],a=(n=n||0)>>>3,f=-1===r?3:0,i=0;i<e.length;i+=1)o=e.charCodeAt(i),s=(u=i+a)>>>2,t.length<=s&&t.push(0),t[s]|=o<<8*(f+u%4*r);return{value:t,binLen:8*e.length+n}};break;case"ARRAYBUFFER":try{e=new ArrayBuffer(0)}catch(e){throw Error("ARRAYBUFFER not supported by this environment")}e=function(e,t,n){var o,i,a,s,u,f;for(t=t||[0],i=(n=n||0)>>>3,u=-1===r?3:0,f=new Uint8Array(e),o=0;o<e.byteLength;o+=1)a=(s=o+i)>>>2,t.length<=a&&t.push(0),t[a]|=f[o]<<8*(u+s%4*r);return{value:t,binLen:8*e.byteLength+n}};break;default:throw Error("format must be HEX, TEXT, B64, BYTES, or ARRAYBUFFER")}return e}function p(e,t){return e<<t|e>>>32-t}function d(e,t){return 32<t?(t-=32,new a(e.b<<t|e.a>>>32-t,e.a<<t|e.b>>>32-t)):0!==t?new a(e.a<<t|e.b>>>32-t,e.b<<t|e.a>>>32-t):e}function b(e,t){return e>>>t|e<<32-t}function w(e,t){var r=null;r=new a(e.a,e.b);return 32>=t?new a(r.a>>>t|r.b<<32-t&4294967295,r.b>>>t|r.a<<32-t&4294967295):new a(r.b>>>t-32|r.a<<64-t&4294967295,r.a>>>t-32|r.b<<64-t&4294967295)}function y(e,t){return 32>=t?new a(e.a>>>t,e.b>>>t|e.a<<32-t&4294967295):new a(0,e.a>>>t-32)}function v(e,t,r){return e&t^~e&r}function g(e,t,r){return new a(e.a&t.a^~e.a&r.a,e.b&t.b^~e.b&r.b)}function A(e,t,r){return e&t^e&r^t&r}function m(e,t,r){return new a(e.a&t.a^e.a&r.a^t.a&r.a,e.b&t.b^e.b&r.b^t.b&r.b)}function E(e){return b(e,2)^b(e,13)^b(e,22)}function S(e){var t=w(e,28),r=w(e,34);return e=w(e,39),new a(t.a^r.a^e.a,t.b^r.b^e.b)}function H(e){return b(e,6)^b(e,11)^b(e,25)}function T(e){var t=w(e,14),r=w(e,18);return e=w(e,41),new a(t.a^r.a^e.a,t.b^r.b^e.b)}function B(e){return b(e,7)^b(e,18)^e>>>3}function U(e){var t=w(e,1),r=w(e,8);return e=y(e,7),new a(t.a^r.a^e.a,t.b^r.b^e.b)}function x(e){return b(e,17)^b(e,19)^e>>>10}function _(e){var t=w(e,19),r=w(e,61);return e=y(e,6),new a(t.a^r.a^e.a,t.b^r.b^e.b)}function O(e,t){var r=(65535&e)+(65535&t);return((e>>>16)+(t>>>16)+(r>>>16)&65535)<<16|65535&r}function R(e,t,r,n){var o=(65535&e)+(65535&t)+(65535&r)+(65535&n);return((e>>>16)+(t>>>16)+(r>>>16)+(n>>>16)+(o>>>16)&65535)<<16|65535&o}function P(e,t,r,n,o){var i=(65535&e)+(65535&t)+(65535&r)+(65535&n)+(65535&o);return((e>>>16)+(t>>>16)+(r>>>16)+(n>>>16)+(o>>>16)+(i>>>16)&65535)<<16|65535&i}function k(e,t){var r,n,o;return r=(65535&e.b)+(65535&t.b),o=(65535&(n=(e.b>>>16)+(t.b>>>16)+(r>>>16)))<<16|65535&r,r=(65535&e.a)+(65535&t.a)+(n>>>16),new a((65535&(n=(e.a>>>16)+(t.a>>>16)+(r>>>16)))<<16|65535&r,o)}function F(e,t,r,n){var o,i,s;return o=(65535&e.b)+(65535&t.b)+(65535&r.b)+(65535&n.b),s=(65535&(i=(e.b>>>16)+(t.b>>>16)+(r.b>>>16)+(n.b>>>16)+(o>>>16)))<<16|65535&o,o=(65535&e.a)+(65535&t.a)+(65535&r.a)+(65535&n.a)+(i>>>16),new a((65535&(i=(e.a>>>16)+(t.a>>>16)+(r.a>>>16)+(n.a>>>16)+(o>>>16)))<<16|65535&o,s)}function j(e,t,r,n,o){var i,s,u;return i=(65535&e.b)+(65535&t.b)+(65535&r.b)+(65535&n.b)+(65535&o.b),u=(65535&(s=(e.b>>>16)+(t.b>>>16)+(r.b>>>16)+(n.b>>>16)+(o.b>>>16)+(i>>>16)))<<16|65535&i,i=(65535&e.a)+(65535&t.a)+(65535&r.a)+(65535&n.a)+(65535&o.a)+(s>>>16),new a((65535&(s=(e.a>>>16)+(t.a>>>16)+(r.a>>>16)+(n.a>>>16)+(o.a>>>16)+(i>>>16)))<<16|65535&i,u)}function C(e,t){return new a(e.a^t.a,e.b^t.b)}function L(e){var t,r=[];if("SHA-1"===e)r=[1732584193,4023233417,2562383102,271733878,3285377520];else if(0===e.lastIndexOf("SHA-",0))switch(r=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],t=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],e){case"SHA-224":break;case"SHA-256":r=t;break;case"SHA-384":r=[new a(3418070365,r[0]),new a(1654270250,r[1]),new a(2438529370,r[2]),new a(355462360,r[3]),new a(1731405415,r[4]),new a(41048885895,r[5]),new a(3675008525,r[6]),new a(1203062813,r[7])];break;case"SHA-512":r=[new a(t[0],4089235720),new a(t[1],2227873595),new a(t[2],4271175723),new a(t[3],1595750129),new a(t[4],2917565137),new a(t[5],725511199),new a(t[6],4215389547),new a(t[7],327033209)];break;default:throw Error("Unknown SHA variant")}else{if(0!==e.lastIndexOf("SHA3-",0)&&0!==e.lastIndexOf("SHAKE",0))throw Error("No SHA variants supported");for(e=0;5>e;e+=1)r[e]=[new a(0,0),new a(0,0),new a(0,0),new a(0,0),new a(0,0)]}return r}function D(e,t){var r,n,o,i,a,s,u,f=[];for(r=t[0],n=t[1],o=t[2],i=t[3],a=t[4],u=0;80>u;u+=1)f[u]=16>u?e[u]:p(f[u-3]^f[u-8]^f[u-14]^f[u-16],1),s=20>u?P(p(r,5),n&o^~n&i,a,1518500249,f[u]):40>u?P(p(r,5),n^o^i,a,1859775393,f[u]):60>u?P(p(r,5),A(n,o,i),a,2400959708,f[u]):P(p(r,5),n^o^i,a,3395469782,f[u]),a=i,i=o,o=p(n,30),n=r,r=s;return t[0]=O(r,t[0]),t[1]=O(n,t[1]),t[2]=O(o,t[2]),t[3]=O(i,t[3]),t[4]=O(a,t[4]),t}function I(e,t,r,n){var o;for(o=15+(t+65>>>9<<4);e.length<=o;)e.push(0);for(e[t>>>5]|=128<<24-t%32,t+=r,e[o]=4294967295&t,e[o-1]=t/4294967296|0,t=e.length,o=0;o<t;o+=16)n=D(e.slice(o,o+16),n);return n}function M(e,t,r){var n,o,i,s,u,f,h,c,l,p,d,b,w,y,C,L,D,I,M,K,Y,q,z,G=[];if("SHA-224"===r||"SHA-256"===r)p=64,b=1,q=Number,w=O,y=R,C=P,L=B,D=x,I=E,M=H,Y=A,K=v,z=X;else{if("SHA-384"!==r&&"SHA-512"!==r)throw Error("Unexpected error in SHA-2 implementation");p=80,b=2,q=a,w=k,y=F,C=j,L=U,D=_,I=S,M=T,Y=m,K=g,z=N}for(r=t[0],n=t[1],o=t[2],i=t[3],s=t[4],u=t[5],f=t[6],h=t[7],d=0;d<p;d+=1)16>d?(l=d*b,c=e.length<=l?0:e[l],l=e.length<=l+1?0:e[l+1],G[d]=new q(c,l)):G[d]=y(D(G[d-2]),G[d-7],L(G[d-15]),G[d-16]),c=C(h,M(s),K(s,u,f),z[d],G[d]),l=w(I(r),Y(r,n,o)),h=f,f=u,u=s,s=w(i,c),i=o,o=n,n=r,r=w(c,l);return t[0]=w(r,t[0]),t[1]=w(n,t[1]),t[2]=w(o,t[2]),t[3]=w(i,t[3]),t[4]=w(s,t[4]),t[5]=w(u,t[5]),t[6]=w(f,t[6]),t[7]=w(h,t[7]),t}function K(e,t){var r,n,o,i,s=[],u=[];if(null!==e)for(n=0;n<e.length;n+=2)t[(n>>>1)%5][(n>>>1)/5|0]=C(t[(n>>>1)%5][(n>>>1)/5|0],new a(e[n+1],e[n]));for(r=0;24>r;r+=1){for(i=L("SHA3-"),n=0;5>n;n+=1){o=t[n][0];var f=t[n][1],h=t[n][2],c=t[n][3],l=t[n][4];s[n]=new a(o.a^f.a^h.a^c.a^l.a,o.b^f.b^h.b^c.b^l.b)}for(n=0;5>n;n+=1)u[n]=C(s[(n+4)%5],d(s[(n+1)%5],1));for(n=0;5>n;n+=1)for(o=0;5>o;o+=1)t[n][o]=C(t[n][o],u[n]);for(n=0;5>n;n+=1)for(o=0;5>o;o+=1)i[o][(2*n+3*o)%5]=d(t[n][o],Y[n][o]);for(n=0;5>n;n+=1)for(o=0;5>o;o+=1)t[n][o]=C(i[n][o],new a(~i[(n+1)%5][o].a&i[(n+2)%5][o].a,~i[(n+1)%5][o].b&i[(n+2)%5][o].b));t[0][0]=C(t[0][0],q[r])}return t}var X,N,Y,q;N=[new a((X=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298])[0],3609767458),new a(X[1],602891725),new a(X[2],3964484399),new a(X[3],2173295548),new a(X[4],4081628472),new a(X[5],3053834265),new a(X[6],2937671579),new a(X[7],3664609560),new a(X[8],2734883394),new a(X[9],1164996542),new a(X[10],1323610764),new a(X[11],3590304994),new a(X[12],4068182383),new a(X[13],991336113),new a(X[14],633803317),new a(X[15],3479774868),new a(X[16],2666613458),new a(X[17],944711139),new a(X[18],2341262773),new a(X[19],2007800933),new a(X[20],1495990901),new a(X[21],1856431235),new a(X[22],3175218132),new a(X[23],2198950837),new a(X[24],3999719339),new a(X[25],766784016),new a(X[26],2566594879),new a(X[27],3203337956),new a(X[28],1034457026),new a(X[29],2466948901),new a(X[30],3758326383),new a(X[31],168717936),new a(X[32],1188179964),new a(X[33],1546045734),new a(X[34],1522805485),new a(X[35],2643833823),new a(X[36],2343527390),new a(X[37],1014477480),new a(X[38],1206759142),new a(X[39],344077627),new a(X[40],1290863460),new a(X[41],3158454273),new a(X[42],3505952657),new a(X[43],106217008),new a(X[44],3606008344),new a(X[45],1432725776),new a(X[46],1467031594),new a(X[47],851169720),new a(X[48],3100823752),new a(X[49],1363258195),new a(X[50],3750685593),new a(X[51],3785050280),new a(X[52],3318307427),new a(X[53],3812723403),new a(X[54],2003034995),new a(X[55],3602036899),new a(X[56],1575990012),new a(X[57],1125592928),new a(X[58],2716904306),new a(X[59],442776044),new a(X[60],593698344),new a(X[61],3733110249),new a(X[62],2999351573),new a(X[63],3815920427),new a(3391569614,3928383900),new a(3515267271,566280711),new a(3940187606,3454069534),new a(4118630271,4000239992),new a(116418474,1914138554),new a(174292421,2731055270),new a(289380356,3203993006),new a(460393269,320620315),new a(685471733,587496836),new a(852142971,1086792851),new a(1017036298,365543100),new a(1126000580,2618297676),new a(1288033470,3409855158),new a(1501505948,4234509866),new a(1607167915,987167468),new a(1816402316,1246189591)],q=[new a(0,1),new a(0,32898),new a(2147483648,32906),new a(2147483648,2147516416),new a(0,32907),new a(0,2147483649),new a(2147483648,2147516545),new a(2147483648,32777),new a(0,138),new a(0,136),new a(0,2147516425),new a(0,2147483658),new a(0,2147516555),new a(2147483648,139),new a(2147483648,32905),new a(2147483648,32771),new a(2147483648,32770),new a(2147483648,128),new a(0,32778),new a(2147483648,2147483658),new a(2147483648,2147516545),new a(2147483648,32896),new a(0,2147483649),new a(2147483648,2147516424)],Y=[[0,36,3,41,18],[1,44,10,45,2],[62,6,43,15,61],[28,55,25,21,56],[27,20,39,8,14]],void 0===(n=function(){return i}.call(t,r,t,e))||(e.exports=n)}()},function(e,t){var r=function(e){function t(){this.fetch=!1}return t.prototype=e,new t}("undefined"!=typeof self?self:this);!function(e){!function(t){var r={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(r.arrayBuffer)var n=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(e){return e&&n.indexOf(Object.prototype.toString.call(e))>-1};function i(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function a(e){return"string"!=typeof e&&(e=String(e)),e}function s(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r.iterable&&(t[Symbol.iterator]=function(){return t}),t}function u(e){this.map={},e instanceof u?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function f(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function h(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function c(e){var t=new FileReader,r=h(t);return t.readAsArrayBuffer(e),r}function l(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function p(){return this.bodyUsed=!1,this._initBody=function(e){this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:r.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:r.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():r.arrayBuffer&&r.blob&&function(e){return e&&DataView.prototype.isPrototypeOf(e)}(e)?(this._bodyArrayBuffer=l(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||o(e))?this._bodyArrayBuffer=l(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(c)}),this.text=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,r=h(t);return t.readAsText(e),r}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}u.prototype.append=function(e,t){e=i(e),t=a(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},u.prototype.delete=function(e){delete this.map[i(e)]},u.prototype.get=function(e){return e=i(e),this.has(e)?this.map[e]:null},u.prototype.has=function(e){return this.map.hasOwnProperty(i(e))},u.prototype.set=function(e,t){this.map[i(e)]=a(t)},u.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},u.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),s(e)},u.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),s(e)},u.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),s(e)},r.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);var d=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function b(e,t){var r=(t=t||{}).body;if(e instanceof b){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new u(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,r||null==e._bodyInit||(r=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new u(t.headers)),this.method=function(e){var t=e.toUpperCase();return d.indexOf(t)>-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function w(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(o))}}),t}function y(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new u(t.headers),this.url=t.url||"",this._initBody(e)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},p.call(b.prototype),p.call(y.prototype),y.prototype.clone=function(){return new y(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},y.error=function(){var e=new y(null,{status:0,statusText:""});return e.type="error",e};var v=[301,302,303,307,308];y.redirect=function(e,t){if(-1===v.indexOf(t))throw new RangeError("Invalid status code");return new y(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function g(e,n){return new Promise(function(o,i){var a=new b(e,n);if(a.signal&&a.signal.aborted)return i(new t.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function f(){s.abort()}s.onload=function(){var e={status:s.status,statusText:s.statusText,headers:function(e){var t=new u;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(e){var r=e.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();t.append(n,o)}}),t}(s.getAllResponseHeaders()||"")};e.url="responseURL"in s?s.responseURL:e.headers.get("X-Request-URL");var t="response"in s?s.response:s.responseText;o(new y(t,e))},s.onerror=function(){i(new TypeError("Network request failed"))},s.ontimeout=function(){i(new TypeError("Network request failed"))},s.onabort=function(){i(new t.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&r.blob&&(s.responseType="blob"),a.headers.forEach(function(e,t){s.setRequestHeader(t,e)}),a.signal&&(a.signal.addEventListener("abort",f),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",f)}),s.send(void 0===a._bodyInit?null:a._bodyInit)})}g.polyfill=!0,e.fetch||(e.fetch=g,e.Headers=u,e.Request=b,e.Response=y),t.Headers=u,t.Request=b,t.Response=y,t.fetch=g}({})}(r),delete r.fetch.polyfill,e.exports=t=r.fetch,t.fetch=r.fetch,t.Headers=r.Headers,t.Request=r.Request,t.Response=r.Response,t.default=r.fetch}]);