UNPKG

pkce-js

Version:

Generate PKCE verifier and code_challenge in a simple way.

1 lines 32.3 kB
!function(){var t,r,e,n,i,o=(t=function(t,e){(function(t){(function(){"use strict";function t(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var r=new Uint8Array(t);return r.__proto__=n.prototype,r}function n(t,r,e){if("number"==typeof t){if("string"==typeof r)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return i(t,r,e)}function i(r,e,i){if("string"==typeof r)return function(r,e){if("string"==typeof e&&""!==e||(e="utf8"),!n.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var i=0|a(r,e),o=t(i),u=o.write(r,e);return u!==i&&(o=o.slice(0,u)),o}(r,e);if(ArrayBuffer.isView(r))return f(r);if(null==r)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(z(r,ArrayBuffer)||r&&z(r.buffer,ArrayBuffer))return function(t,r,e){if(r<0||t.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<r+(e||0))throw new RangeError('"length" is outside of buffer bounds');var i;return(i=void 0===r&&void 0===e?new Uint8Array(t):void 0===e?new Uint8Array(t,r):new Uint8Array(t,r,e)).__proto__=n.prototype,i}(r,e,i);if("number"==typeof r)throw new TypeError('The "value" argument must not be of type number. Received type number');var o=r.valueOf&&r.valueOf();if(null!=o&&o!==r)return n.from(o,e,i);var u=function(r){if(n.isBuffer(r)){var e=0|s(r.length),i=t(e);return 0===i.length||r.copy(i,0,0,e),i}return void 0!==r.length?"number"!=typeof r.length||H(r.length)?t(0):f(r):"Buffer"===r.type&&Array.isArray(r.data)?f(r.data):void 0}(r);if(u)return u;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof r[Symbol.toPrimitive])return n.from(r[Symbol.toPrimitive]("string"),e,i);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}function o(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 u(r){return o(r),t(r<0?0:0|s(r))}function f(r){for(var e=r.length<0?0:0|s(r.length),n=t(e),i=0;i<e;i+=1)n[i]=255&r[i];return n}function s(t){if(t>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function a(t,r){if(n.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||z(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 e=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===e)return 0;for(var o=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return O(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return k(t).length;default:if(o)return i?-1:O(t).length;r=(""+r).toLowerCase(),o=!0}}function h(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function c(t,r,e,i,o){if(0===t.length)return-1;if("string"==typeof e?(i=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),H(e=+e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0){if(!o)return-1;e=0}if("string"==typeof r&&(r=n.from(r,i)),n.isBuffer(r))return 0===r.length?-1:p(t,r,e,i,o);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):p(t,[r],e,i,o);throw new TypeError("val must be string, number or Buffer")}function p(t,r,e,n,i){var o,u=1,f=t.length,s=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,f/=2,s/=2,e/=2}function a(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}if(i){var h=-1;for(o=e;o<f;o++)if(a(t,o)===a(r,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===s)return h*u}else-1!==h&&(o-=o-h),h=-1}else for(e+s>f&&(e=f-s),o=e;o>=0;o--){for(var c=!0,p=0;p<s;p++)if(a(t,o+p)!==a(r,p)){c=!1;break}if(c)return o}return-1}function l(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;n>o/2&&(n=o/2);for(var u=0;u<n;++u){var f=parseInt(r.substr(2*u,2),16);if(H(f))return u;t[e+u]=f}return u}function y(t,r,e,n){return P(O(r,t.length-e),t,e,n)}function g(t,r,e,n){return P(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function d(t,r,e,n){return g(t,r,e,n)}function w(t,r,e,n){return P(k(r),t,e,n)}function m(t,r,e,n){return P(function(t,r){for(var e,n,i,o=[],u=0;u<t.length&&!((r-=2)<0);++u)n=(e=t.charCodeAt(u))>>8,i=e%256,o.push(i),o.push(n);return o}(r,t.length-e),t,e,n)}function b(t,r,e){return 0===r&&e===t.length?v.fromByteArray(t):v.fromByteArray(t.slice(r,e))}function A(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o,u,f,s,a=t[i],h=null,c=a>239?4:a>223?3:a>191?2:1;if(i+c<=e)switch(c){case 1:a<128&&(h=a);break;case 2:128==(192&(o=t[i+1]))&&(s=(31&a)<<6|63&o)>127&&(h=s);break;case 3:o=t[i+1],u=t[i+2],128==(192&o)&&128==(192&u)&&(s=(15&a)<<12|(63&o)<<6|63&u)>2047&&(s<55296||s>57343)&&(h=s);break;case 4:o=t[i+1],u=t[i+2],f=t[i+3],128==(192&o)&&128==(192&u)&&128==(192&f)&&(s=(15&a)<<18|(63&o)<<12|(63&u)<<6|63&f)>65535&&s<1114112&&(h=s)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=c}return function(t){var r=t.length;if(r<=B)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=B));return e}(n)}e.Buffer=n,e.INSPECT_MAX_BYTES=50,n.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(r){return!1}}(),n.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(n.prototype,"parent",{enumerable:!0,get:function(){if(n.isBuffer(this))return this.buffer}}),Object.defineProperty(n.prototype,"offset",{enumerable:!0,get:function(){if(n.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&n[Symbol.species]===n&&Object.defineProperty(n,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),n.poolSize=8192,n.from=function(t,r,e){return i(t,r,e)},n.prototype.__proto__=Uint8Array.prototype,n.__proto__=Uint8Array,n.alloc=function(r,e,n){return function(r,e,n){return o(r),r<=0?t(r):void 0!==e?"string"==typeof n?t(r).fill(e,n):t(r).fill(e):t(r)}(r,e,n)},n.allocUnsafe=function(t){return u(t)},n.allocUnsafeSlow=function(t){return u(t)},n.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==n.prototype},n.compare=function(t,r){if(z(t,Uint8Array)&&(t=n.from(t,t.offset,t.byteLength)),z(r,Uint8Array)&&(r=n.from(r,r.offset,r.byteLength)),!n.isBuffer(t)||!n.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;for(var e=t.length,i=r.length,o=0,u=Math.min(e,i);o<u;++o)if(t[o]!==r[o]){e=t[o],i=r[o];break}return e<i?-1:i<e?1:0},n.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}},n.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return n.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var i=n.allocUnsafe(r),o=0;for(e=0;e<t.length;++e){var u=t[e];if(z(u,Uint8Array)&&(u=n.from(u)),!n.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(i,o),o+=u.length}return i},n.byteLength=a,n.prototype._isBuffer=!0,n.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)h(this,r,r+1);return this},n.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)h(this,r,r+3),h(this,r+1,r+2);return this},n.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)h(this,r,r+7),h(this,r+1,r+6),h(this,r+2,r+5),h(this,r+3,r+4);return this},n.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?A(this,0,t):function(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 T(this,r,e);case"utf8":case"utf-8":return A(this,r,e);case"ascii":return E(this,r,e);case"latin1":case"binary":return _(this,r,e);case"base64":return b(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},n.prototype.toLocaleString=n.prototype.toString,n.prototype.equals=function(t){if(!n.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===n.compare(this,t)},n.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},n.prototype.compare=function(t,r,e,i,o){if(z(t,Uint8Array)&&(t=n.from(t,t.offset,t.byteLength)),!n.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),r<0||e>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=e)return 0;if(i>=o)return-1;if(r>=e)return 1;if(this===t)return 0;for(var u=(o>>>=0)-(i>>>=0),f=(e>>>=0)-(r>>>=0),s=Math.min(u,f),a=this.slice(i,o),h=t.slice(r,e),c=0;c<s;++c)if(a[c]!==h[c]){u=a[c],f=h[c];break}return u<f?-1:f<u?1:0},n.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},n.prototype.indexOf=function(t,r,e){return c(this,t,r,e,!0)},n.prototype.lastIndexOf=function(t,r,e){return c(this,t,r,e,!1)},n.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 l(this,t,r,e);case"utf8":case"utf-8":return y(this,t,r,e);case"ascii":return g(this,t,r,e);case"latin1":case"binary":return d(this,t,r,e);case"base64":return w(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},n.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var B=4096;function E(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 _(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 T(t,r,e){var n,i=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>i)&&(e=i);for(var o="",u=r;u<e;++u)o+=(n=t[u])<16?"0"+n.toString(16):n.toString(16);return o}function S(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 x(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 I(t,r,e,i,o,u){if(!n.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<u)throw new RangeError('"value" argument is out of bounds');if(e+i>t.length)throw new RangeError("Index out of range")}function C(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 R(t,r,e,n,i){return r=+r,e>>>=0,i||C(t,0,e,4),U.write(t,r,e,n,23,4),e+4}function L(t,r,e,n,i){return r=+r,e>>>=0,i||C(t,0,e,8),U.write(t,r,e,n,52,8),e+8}n.prototype.slice=function(t,r){var e=this.length;(t=~~t)<0?(t+=e)<0&&(t=0):t>e&&(t=e),(r=void 0===r?e:~~r)<0?(r+=e)<0&&(r=0):r>e&&(r=e),r<t&&(r=t);var i=this.subarray(t,r);return i.__proto__=n.prototype,i},n.prototype.readUIntLE=function(t,r,e){t>>>=0,r>>>=0,e||x(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n},n.prototype.readUIntBE=function(t,r,e){t>>>=0,r>>>=0,e||x(t,r,this.length);for(var n=this[t+--r],i=1;r>0&&(i*=256);)n+=this[t+--r]*i;return n},n.prototype.readUInt8=function(t,r){return t>>>=0,r||x(t,1,this.length),this[t]},n.prototype.readUInt16LE=function(t,r){return t>>>=0,r||x(t,2,this.length),this[t]|this[t+1]<<8},n.prototype.readUInt16BE=function(t,r){return t>>>=0,r||x(t,2,this.length),this[t]<<8|this[t+1]},n.prototype.readUInt32LE=function(t,r){return t>>>=0,r||x(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},n.prototype.readUInt32BE=function(t,r){return t>>>=0,r||x(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},n.prototype.readIntLE=function(t,r,e){t>>>=0,r>>>=0,e||x(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},n.prototype.readIntBE=function(t,r,e){t>>>=0,r>>>=0,e||x(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},n.prototype.readInt8=function(t,r){return t>>>=0,r||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},n.prototype.readInt16LE=function(t,r){t>>>=0,r||x(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},n.prototype.readInt16BE=function(t,r){t>>>=0,r||x(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},n.prototype.readInt32LE=function(t,r){return t>>>=0,r||x(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},n.prototype.readInt32BE=function(t,r){return t>>>=0,r||x(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},n.prototype.readFloatLE=function(t,r){return t>>>=0,r||x(t,4,this.length),U.read(this,t,!0,23,4)},n.prototype.readFloatBE=function(t,r){return t>>>=0,r||x(t,4,this.length),U.read(this,t,!1,23,4)},n.prototype.readDoubleLE=function(t,r){return t>>>=0,r||x(t,8,this.length),U.read(this,t,!0,52,8)},n.prototype.readDoubleBE=function(t,r){return t>>>=0,r||x(t,8,this.length),U.read(this,t,!1,52,8)},n.prototype.writeUIntLE=function(t,r,e,n){t=+t,r>>>=0,e>>>=0,n||I(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},n.prototype.writeUIntBE=function(t,r,e,n){t=+t,r>>>=0,e>>>=0,n||I(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},n.prototype.writeUInt8=function(t,r,e){return t=+t,r>>>=0,e||I(this,t,r,1,255,0),this[r]=255&t,r+1},n.prototype.writeUInt16LE=function(t,r,e){return t=+t,r>>>=0,e||I(this,t,r,2,65535,0),this[r]=255&t,this[r+1]=t>>>8,r+2},n.prototype.writeUInt16BE=function(t,r,e){return t=+t,r>>>=0,e||I(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=255&t,r+2},n.prototype.writeUInt32LE=function(t,r,e){return t=+t,r>>>=0,e||I(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t,r+4},n.prototype.writeUInt32BE=function(t,r,e){return t=+t,r>>>=0,e||I(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t,r+4},n.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r>>>=0,!n){var i=Math.pow(2,8*e-1);I(this,t,r,e,i-1,-i)}var o=0,u=1,f=0;for(this[r]=255&t;++o<e&&(u*=256);)t<0&&0===f&&0!==this[r+o-1]&&(f=1),this[r+o]=(t/u>>0)-f&255;return r+e},n.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r>>>=0,!n){var i=Math.pow(2,8*e-1);I(this,t,r,e,i-1,-i)}var o=e-1,u=1,f=0;for(this[r+o]=255&t;--o>=0&&(u*=256);)t<0&&0===f&&0!==this[r+o+1]&&(f=1),this[r+o]=(t/u>>0)-f&255;return r+e},n.prototype.writeInt8=function(t,r,e){return t=+t,r>>>=0,e||I(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=255&t,r+1},n.prototype.writeInt16LE=function(t,r,e){return t=+t,r>>>=0,e||I(this,t,r,2,32767,-32768),this[r]=255&t,this[r+1]=t>>>8,r+2},n.prototype.writeInt16BE=function(t,r,e){return t=+t,r>>>=0,e||I(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=255&t,r+2},n.prototype.writeInt32LE=function(t,r,e){return t=+t,r>>>=0,e||I(this,t,r,4,2147483647,-2147483648),this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4},n.prototype.writeInt32BE=function(t,r,e){return t=+t,r>>>=0,e||I(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t,r+4},n.prototype.writeFloatLE=function(t,r,e){return R(this,t,r,!0,e)},n.prototype.writeFloatBE=function(t,r,e){return R(this,t,r,!1,e)},n.prototype.writeDoubleLE=function(t,r,e){return L(this,t,r,!0,e)},n.prototype.writeDoubleBE=function(t,r,e){return L(this,t,r,!1,e)},n.prototype.copy=function(t,r,e,i){if(!n.isBuffer(t))throw new TypeError("argument should be a Buffer");if(e||(e=0),i||0===i||(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i<e&&(i=e),i===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("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r<i-e&&(i=t.length-r+e);var o=i-e;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(r,e,i);else if(this===t&&e<r&&r<i)for(var u=o-1;u>=0;--u)t[u+r]=this[u+e];else Uint8Array.prototype.set.call(t,this.subarray(e,i),r);return o},n.prototype.fill=function(t,r,e,i){if("string"==typeof t){if("string"==typeof r?(i=r,r=0,e=this.length):"string"==typeof e&&(i=e,e=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!n.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){var o=t.charCodeAt(0);("utf8"===i&&o<128||"latin1"===i)&&(t=o)}}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 u;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(u=r;u<e;++u)this[u]=t;else{var f=n.isBuffer(t)?t:n.from(t,i),s=f.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(u=0;u<e-r;++u)this[u+r]=f[u%s]}return this};var M=/[^+/0-9A-Za-z-_]/g;function O(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 k(t){return v.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function P(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}function z(t,r){return t instanceof r||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===r.name}function H(t){return t!=t}}).call(this)}).call(this,o({}).Buffer)},function(e){return r||t(r={exports:{},parent:e},r.exports),r.exports}),u=e={};function f(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===f||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(r){try{return n.call(null,t,0)}catch(r){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:f}catch(r){n=f}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(r){i=s}}();var h,c=[],p=!1,l=-1;function y(){p&&h&&(p=!1,h.length?c=h.concat(c):l=-1,c.length&&g())}function g(){if(!p){var t=a(y);p=!0;for(var e=c.length;e;){for(h=c,c=[];++l<e;)h&&h[l].run();l=-1,e=c.length}h=null,p=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(r){try{return i.call(null,t)}catch(r){return i.call(this,t)}}}(t)}}function d(t,r){this.fun=t,this.array=r}function w(){}u.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];c.push(new d(t,r)),1!==c.length||p||a(g)},d.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},u.on=w,u.addListener=w,u.once=w,u.off=w,u.removeListener=w,u.removeAllListeners=w,u.emit=w,u.prependListener=w,u.prependOnceListener=w,u.listeners=function(t){return[]},u.binding=function(t){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(t){throw new Error("process.chdir is not supported")},u.umask=function(){return 0};for(var v={toByteArray:function(t){var r,e,n=function(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]}(t),i=n[0],o=n[1],u=new A(3*(i+o)/4-o),f=0,s=o>0?i-4:i;for(e=0;e<s;e+=4)r=b[t.charCodeAt(e)]<<18|b[t.charCodeAt(e+1)]<<12|b[t.charCodeAt(e+2)]<<6|b[t.charCodeAt(e+3)],u[f++]=r>>16&255,u[f++]=r>>8&255,u[f++]=255&r;return 2===o&&(r=b[t.charCodeAt(e)]<<2|b[t.charCodeAt(e+1)]>>4,u[f++]=255&r),1===o&&(r=b[t.charCodeAt(e)]<<10|b[t.charCodeAt(e+1)]<<4|b[t.charCodeAt(e+2)]>>2,u[f++]=r>>8&255,u[f++]=255&r),u},fromByteArray:function(t){for(var r,e=t.length,n=e%3,i=[],o=0,u=e-n;o<u;o+=16383)i.push(T(t,o,o+16383>u?u:o+16383));return 1===n?(r=t[e-1],i.push(m[r>>2]+m[r<<4&63]+"==")):2===n&&(r=(t[e-2]<<8)+t[e-1],i.push(m[r>>10]+m[r>>4&63]+m[r<<2&63]+"=")),i.join("")}},m=[],b=[],A="undefined"!=typeof Uint8Array?Uint8Array:Array,B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",E=0,_=B.length;E<_;++E)m[E]=B[E],b[B.charCodeAt(E)]=E;function T(t,r,e){for(var n,i,o=[],u=r;u<e;u+=3)n=(t[u]<<16&16711680)+(t[u+1]<<8&65280)+(255&t[u+2]),o.push(m[(i=n)>>18&63]+m[i>>12&63]+m[i>>6&63]+m[63&i]);return o.join("")}b["-".charCodeAt(0)]=62,b["_".charCodeAt(0)]=63;var U={read:function(t,r,e,n,i){var o,u,f=8*i-n-1,s=(1<<f)-1,a=s>>1,h=-7,c=e?i-1:0,p=e?-1:1,l=t[r+c];for(c+=p,o=l&(1<<-h)-1,l>>=-h,h+=f;h>0;o=256*o+t[r+c],c+=p,h-=8);for(u=o&(1<<-h)-1,o>>=-h,h+=n;h>0;u=256*u+t[r+c],c+=p,h-=8);if(0===o)o=1-a;else{if(o===s)return u?NaN:1/0*(l?-1:1);u+=Math.pow(2,n),o-=a}return(l?-1:1)*u*Math.pow(2,o-n)},write:function(t,r,e,n,i,o){var u,f,s,a=8*o-i-1,h=(1<<a)-1,c=h>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:o-1,y=n?1:-1,g=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(f=isNaN(r)?1:0,u=h):(u=Math.floor(Math.log(r)/Math.LN2),r*(s=Math.pow(2,-u))<1&&(u--,s*=2),(r+=u+c>=1?p/s:p*Math.pow(2,1-c))*s>=2&&(u++,s/=2),u+c>=h?(f=0,u=h):u+c>=1?(f=(r*s-1)*Math.pow(2,i),u+=c):(f=r*Math.pow(2,c-1)*Math.pow(2,i),u=0));i>=8;t[e+l]=255&f,l+=y,f/=256,i-=8);for(u=u<<i|f,a+=i;a>0;t[e+l]=255&u,l+=y,u/=256,a-=8);t[e+l-y]|=128*g}};(function(t,r){(function(){(()=>{var e={249:function(t,r,e){var n;t.exports=n=n||function(t,r){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==e.g&&e.g.crypto&&(n=e.g.crypto),!n)try{n=e(480)}catch(t){}var i=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function t(){}return function(r){var e;return t.prototype=r,e=new t,t.prototype=null,e}}(),u={},f=u.lib={},s=f.Base={extend:function(t){var r=o(this);return t&&r.mixIn(t),r.hasOwnProperty("init")&&this.init!==r.init||(r.init=function(){r.$super.init.apply(this,arguments)}),r.init.prototype=r,r.$super=this,r},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var r in t)t.hasOwnProperty(r)&&(this[r]=t[r]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},a=f.WordArray=s.extend({init:function(t,r){t=this.words=t||[],this.sigBytes=null!=r?r:4*t.length},toString:function(t){return(t||c).stringify(this)},concat:function(t){var r=this.words,e=t.words,n=this.sigBytes,i=t.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var u=e[o>>>2]>>>24-o%4*8&255;r[n+o>>>2]|=u<<24-(n+o)%4*8}else for(var f=0;f<i;f+=4)r[n+f>>>2]=e[f>>>2];return this.sigBytes+=i,this},clamp:function(){var r=this.words,e=this.sigBytes;r[e>>>2]&=4294967295<<32-e%4*8,r.length=t.ceil(e/4)},clone:function(){var t=s.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var r=[],e=0;e<t;e+=4)r.push(i());return new a.init(r,t)}}),h=u.enc={},c=h.Hex={stringify:function(t){for(var r=t.words,e=t.sigBytes,n=[],i=0;i<e;i++){var o=r[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(t){for(var r=t.length,e=[],n=0;n<r;n+=2)e[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new a.init(e,r/2)}},p=h.Latin1={stringify:function(t){for(var r=t.words,e=t.sigBytes,n=[],i=0;i<e;i++){var o=r[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(t){for(var r=t.length,e=[],n=0;n<r;n++)e[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new a.init(e,r)}},l=h.Utf8={stringify:function(t){try{return decodeURIComponent(escape(p.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return p.parse(unescape(encodeURIComponent(t)))}},y=f.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=l.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(r){var e,n=this._data,i=n.words,o=n.sigBytes,u=this.blockSize,f=o/(4*u),s=(f=r?t.ceil(f):t.max((0|f)-this._minBufferSize,0))*u,h=t.min(4*s,o);if(s){for(var c=0;c<s;c+=u)this._doProcessBlock(i,c);e=i.splice(0,s),n.sigBytes-=h}return new a.init(e,h)},clone:function(){var t=s.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),g=(f.Hasher=y.extend({cfg:s.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){y.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(r,e){return new t.init(e).finalize(r)}},_createHmacHelper:function(t){return function(r,e){return new g.HMAC.init(t,e).finalize(r)}}}),u.algo={});return u}(Math)},269:function(t,r,e){var n,i,o;t.exports=(n=e(249),o=(i=n).lib.WordArray,i.enc.Base64={stringify:function(t){var r=t.words,e=t.sigBytes,n=this._map;t.clamp();for(var i=[],o=0;o<e;o+=3)for(var u=(r[o>>>2]>>>24-o%4*8&255)<<16|(r[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|r[o+2>>>2]>>>24-(o+2)%4*8&255,f=0;f<4&&o+.75*f<e;f++)i.push(n.charAt(u>>>6*(3-f)&63));var s=n.charAt(64);if(s)for(;i.length%4;)i.push(s);return i.join("")},parse:function(t){var r=t.length,e=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var i=0;i<e.length;i++)n[e.charCodeAt(i)]=i}var u=e.charAt(64);if(u){var f=t.indexOf(u);-1!==f&&(r=f)}return function(t,r,e){for(var n=[],i=0,u=0;u<r;u++)if(u%4){var f=e[t.charCodeAt(u-1)]<<u%4*2|e[t.charCodeAt(u)]>>>6-u%4*2;n[i>>>2]|=f<<24-i%4*8,i++}return o.create(n,i)}(t,r,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},n.enc.Base64)},153:function(t,r,e){var n;t.exports=(n=e(249),function(t){var r=n,e=r.lib,i=e.WordArray,o=e.Hasher,u=r.algo,f=[],s=[];!function(){function r(r){for(var e=t.sqrt(r),n=2;n<=e;n++)if(!(r%n))return!1;return!0}function e(t){return 4294967296*(t-(0|t))|0}for(var n=2,i=0;i<64;)r(n)&&(i<8&&(f[i]=e(t.pow(n,.5))),s[i]=e(t.pow(n,1/3)),i++),n++}();var a=[],h=u.SHA256=o.extend({_doReset:function(){this._hash=new i.init(f.slice(0))},_doProcessBlock:function(t,r){for(var e=this._hash.words,n=e[0],i=e[1],o=e[2],u=e[3],f=e[4],h=e[5],c=e[6],p=e[7],l=0;l<64;l++){if(l<16)a[l]=0|t[r+l];else{var y=a[l-15],g=(y<<25|y>>>7)^(y<<14|y>>>18)^y>>>3,d=a[l-2],w=(d<<15|d>>>17)^(d<<13|d>>>19)^d>>>10;a[l]=g+a[l-7]+w+a[l-16]}var v=n&i^n&o^i&o,m=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),b=p+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&h^~f&c)+s[l]+a[l];p=c,c=h,h=f,f=u+b|0,u=o,o=i,i=n,n=b+(m+v)|0}e[0]=e[0]+n|0,e[1]=e[1]+i|0,e[2]=e[2]+o|0,e[3]=e[3]+u|0,e[4]=e[4]+f|0,e[5]=e[5]+h|0,e[6]=e[6]+c|0,e[7]=e[7]+p|0},_doFinalize:function(){var r=this._data,e=r.words,n=8*this._nDataBytes,i=8*r.sigBytes;return e[i>>>5]|=128<<24-i%32,e[14+(i+64>>>9<<4)]=t.floor(n/4294967296),e[15+(i+64>>>9<<4)]=n,r.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});r.SHA256=o._createHelper(h),r.HmacSHA256=o._createHmacHelper(h)}(Math),n.SHA256)},64:function(e,n,i){var o;!function(u){"use strict";function f(e,n){if(n=n||{type:"Array"},void 0!==t&&"number"==typeof t.pid&&t.versions&&t.versions.node)return function(t,r){var e=i(954).randomBytes(t);switch(r.type){case"Array":return[].slice.call(e);case"Buffer":return e;case"Uint8Array":for(var n=new Uint8Array(t),o=0;o<t;++o)n[o]=e.readUInt8(o);return n;default:throw new Error(r.type+" is unsupported.")}}(e,n);if(!window.crypto&&!window.msCrypto)throw new Error("Your browser does not support window.crypto.");return function(t,e){var n=new Uint8Array(t);switch((window.crypto||window.msCrypto).getRandomValues(n),e.type){case"Array":return[].slice.call(n);case"Buffer":try{new r(1)}catch(t){throw new Error("Buffer not supported in this environment. Use Node.js or Browserify for browser support.")}return new r(n);case"Uint8Array":return n;default:throw new Error(e.type+" is unsupported.")}}(e,n)}void 0===(o=function(){return f}.apply(n,[]))||(e.exports=o),f.randomArray=function(t){return f(t,{type:"Array"})},f.randomUint8Array=function(t){return f(t,{type:"Uint8Array"})},f.randomBuffer=function(t){return f(t,{type:"Buffer"})}}()},382:function(t,r,e){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0}),r.base64Url=r.b64Sha256Hash=r.randomString=void 0;var i=n(e(153)),o=n(e(269)),u=n(e(64));r.randomString=function(t){for(var r="",e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",n=u.default(t),i=256/e.length,o=0;o<t;o++)r+=e.charAt(Math.floor(n[o]/i));return r},r.b64Sha256Hash=function(t){return o.default.stringify(i.default(t))},r.base64Url=function(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}},480:()=>{},954:()=>{}},n={};function i(t){var r=n[t];if(void 0!==r)return r.exports;var o=n[t]={exports:{}};return e[t].call(o.exports,o,o.exports,i),o.exports}i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),(()=>{"use strict";i(382)})()})()}).call(this)}).call(this,e,o({}).Buffer)}();