UNPKG

parse-request

Version:

Parse requests in the Browser and Node (with added support for multer and passport). Made for Cabin.

1 lines 163 kB
!function(u){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=u();else if("function"==typeof define&&define.amd)define([],u);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).parseRequest=u()}}((function(){var u,e,t,n=function(u){var e;return function(t){return e||u(e={exports:{},parent:t},e.exports),e.exports}},r=n((function(u,e){var t=1e3,n=6e4,r=60*n,i=24*r;function o(u,e,t,n){var r=e>=1.5*t;return Math.round(u/t)+" "+n+(r?"s":"")}u.exports=function(u,e){e=e||{};var a,c,s=typeof u;if("string"===s&&u.length>0)return function(u){if(!((u=String(u)).length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(e){var o=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*o;case"weeks":case"week":case"w":return 6048e5*o;case"days":case"day":case"d":return o*i;case"hours":case"hour":case"hrs":case"hr":case"h":return o*r;case"minutes":case"minute":case"mins":case"min":case"m":return o*n;case"seconds":case"second":case"secs":case"sec":case"s":return o*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return o;default:return}}}}(u);if("number"===s&&isFinite(u))return e.long?(a=u,(c=Math.abs(a))>=i?o(a,c,i,"day"):c>=r?o(a,c,r,"hour"):c>=n?o(a,c,n,"minute"):c>=t?o(a,c,t,"second"):a+" ms"):function(u){var e=Math.abs(u);return e>=i?Math.round(u/i)+"d":e>=r?Math.round(u/r)+"h":e>=n?Math.round(u/n)+"m":e>=t?Math.round(u/t)+"s":u+"ms"}(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))}})),i=n((function(u,e){(function(u){(function(){"use strict";e.Buffer=t,e.INSPECT_MAX_BYTES=50;function u(u){if(u>2147483647)throw new RangeError('The value "'+u+'" is invalid for option "size"');var e=new Uint8Array(u);return e.__proto__=t.prototype,e}function t(u,e,t){if("number"==typeof u){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return i(u)}return n(u,e,t)}function n(e,n,r){if("string"==typeof e)return function(e,n){if("string"==typeof n&&""!==n||(n="utf8"),!t.isEncoding(n))throw new TypeError("Unknown encoding: "+n);var r=0|c(e,n),i=u(r),o=i.write(e,n);return o!==r&&(i=i.slice(0,o)),i}(e,n);if(ArrayBuffer.isView(e))return o(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(U(e,ArrayBuffer)||e&&U(e.buffer,ArrayBuffer))return function(u,e,n){if(e<0||u.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(u.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;return(r=void 0===e&&void 0===n?new Uint8Array(u):void 0===n?new Uint8Array(u,e):new Uint8Array(u,e,n)).__proto__=t.prototype,r}(e,n,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return t.from(i,n,r);var s=function(e){if(t.isBuffer(e)){var n=0|a(e.length),r=u(n);return 0===r.length||e.copy(r,0,0,n),r}return void 0!==e.length?"number"!=typeof e.length||L(e.length)?u(0):o(e):"Buffer"===e.type&&Array.isArray(e.data)?o(e.data):void 0}(e);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return t.from(e[Symbol.toPrimitive]("string"),n,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function r(u){if("number"!=typeof u)throw new TypeError('"size" argument must be of type number');if(u<0)throw new RangeError('The value "'+u+'" is invalid for option "size"')}function i(e){return r(e),u(e<0?0:0|a(e))}function o(e){for(var t=e.length<0?0:0|a(e.length),n=u(t),r=0;r<t;r+=1)n[r]=255&e[r];return n}function a(u){if(u>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|u}function c(u,e){if(t.isBuffer(u))return u.length;if(ArrayBuffer.isView(u)||U(u,ArrayBuffer))return u.byteLength;if("string"!=typeof u)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof u);var n=u.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return P(u).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return O(u).length;default:if(i)return r?-1:P(u).length;e=(""+e).toLowerCase(),i=!0}}function s(u,e,t){var n=u[e];u[e]=u[t],u[t]=n}function p(u,e,n,r,i){if(0===u.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),L(n=+n)&&(n=i?0:u.length-1),n<0&&(n=u.length+n),n>=u.length){if(i)return-1;n=u.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=t.from(e,r)),t.isBuffer(e))return 0===e.length?-1:f(u,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(u,e,n):Uint8Array.prototype.lastIndexOf.call(u,e,n):f(u,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function f(u,e,t,n,r){var i,o=1,a=u.length,c=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(u.length<2||e.length<2)return-1;o=2,a/=2,c/=2,t/=2}function s(u,e){return 1===o?u[e]:u.readUInt16BE(e*o)}if(r){var p=-1;for(i=t;i<a;i++)if(s(u,i)===s(e,-1===p?0:i-p)){if(-1===p&&(p=i),i-p+1===c)return p*o}else-1!==p&&(i-=i-p),p=-1}else for(t+c>a&&(t=a-c),i=t;i>=0;i--){for(var f=!0,d=0;d<c;d++)if(s(u,i+d)!==s(e,d)){f=!1;break}if(f)return i}return-1}function d(u,e,t,n){t=Number(t)||0;var r=u.length-t;n?(n=Number(n))>r&&(n=r):n=r;var i=e.length;n>i/2&&(n=i/2);for(var o=0;o<n;++o){var a=parseInt(e.substr(2*o,2),16);if(L(a))return o;u[t+o]=a}return o}function l(u,e,t,n){return R(P(e,u.length-t),u,t,n)}function A(u,e,t,n){return R(function(u){for(var e=[],t=0;t<u.length;++t)e.push(255&u.charCodeAt(t));return e}(e),u,t,n)}function E(u,e,t,n){return A(u,e,t,n)}function C(u,e,t,n){return R(O(e),u,t,n)}function _(u,e,t,n){return R(function(u,e){for(var t,n,r,i=[],o=0;o<u.length&&!((e-=2)<0);++o)n=(t=u.charCodeAt(o))>>8,r=t%256,i.push(r),i.push(n);return i}(e,u.length-t),u,t,n)}function y(u,e,t){return 0===e&&t===u.length?F.fromByteArray(u):F.fromByteArray(u.slice(e,t))}function m(u,e,t){t=Math.min(u.length,t);for(var n=[],r=e;r<t;){var i,o,a,c,s=u[r],p=null,f=s>239?4:s>223?3:s>191?2:1;if(r+f<=t)switch(f){case 1:s<128&&(p=s);break;case 2:128==(192&(i=u[r+1]))&&(c=(31&s)<<6|63&i)>127&&(p=c);break;case 3:i=u[r+1],o=u[r+2],128==(192&i)&&128==(192&o)&&(c=(15&s)<<12|(63&i)<<6|63&o)>2047&&(c<55296||c>57343)&&(p=c);break;case 4:i=u[r+1],o=u[r+2],a=u[r+3],128==(192&i)&&128==(192&o)&&128==(192&a)&&(c=(15&s)<<18|(63&i)<<12|(63&o)<<6|63&a)>65535&&c<1114112&&(p=c)}null===p?(p=65533,f=1):p>65535&&(p-=65536,n.push(p>>>10&1023|55296),p=56320|1023&p),n.push(p),r+=f}return function(u){var e=u.length;if(e<=h)return String.fromCharCode.apply(String,u);for(var t="",n=0;n<e;)t+=String.fromCharCode.apply(String,u.slice(n,n+=h));return t}(n)}t.TYPED_ARRAY_SUPPORT=function(){try{var u=new Uint8Array(1);return u.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===u.foo()}catch(e){return!1}}(),t.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(t.prototype,"parent",{enumerable:!0,get:function(){if(t.isBuffer(this))return this.buffer}}),Object.defineProperty(t.prototype,"offset",{enumerable:!0,get:function(){if(t.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&t[Symbol.species]===t&&Object.defineProperty(t,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),t.poolSize=8192,t.from=function(u,e,t){return n(u,e,t)},t.prototype.__proto__=Uint8Array.prototype,t.__proto__=Uint8Array,t.alloc=function(e,t,n){return function(e,t,n){return r(e),e<=0?u(e):void 0!==t?"string"==typeof n?u(e).fill(t,n):u(e).fill(t):u(e)}(e,t,n)},t.allocUnsafe=function(u){return i(u)},t.allocUnsafeSlow=function(u){return i(u)},t.isBuffer=function(u){return null!=u&&!0===u._isBuffer&&u!==t.prototype},t.compare=function(u,e){if(U(u,Uint8Array)&&(u=t.from(u,u.offset,u.byteLength)),U(e,Uint8Array)&&(e=t.from(e,e.offset,e.byteLength)),!t.isBuffer(u)||!t.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===e)return 0;for(var n=u.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(u[i]!==e[i]){n=u[i],r=e[i];break}return n<r?-1:r<n?1:0},t.isEncoding=function(u){switch(String(u).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}},t.concat=function(u,e){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(0===u.length)return t.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<u.length;++n)e+=u[n].length;var r=t.allocUnsafe(e),i=0;for(n=0;n<u.length;++n){var o=u[n];if(U(o,Uint8Array)&&(o=t.from(o)),!t.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},t.byteLength=c,t.prototype._isBuffer=!0,t.prototype.swap16=function(){var u=this.length;if(u%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<u;e+=2)s(this,e,e+1);return this},t.prototype.swap32=function(){var u=this.length;if(u%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<u;e+=4)s(this,e,e+3),s(this,e+1,e+2);return this},t.prototype.swap64=function(){var u=this.length;if(u%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<u;e+=8)s(this,e,e+7),s(this,e+1,e+6),s(this,e+2,e+5),s(this,e+3,e+4);return this},t.prototype.toString=function(){var u=this.length;return 0===u?"":0===arguments.length?m(this,0,u):function(u,e,t){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===t||t>this.length)&&(t=this.length),t<=0)return"";if((t>>>=0)<=(e>>>=0))return"";for(u||(u="utf8");;)switch(u){case"hex":return D(this,e,t);case"utf8":case"utf-8":return m(this,e,t);case"ascii":return b(this,e,t);case"latin1":case"binary":return g(this,e,t);case"base64":return y(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+u);u=(u+"").toLowerCase(),n=!0}}.apply(this,arguments)},t.prototype.toLocaleString=t.prototype.toString,t.prototype.equals=function(u){if(!t.isBuffer(u))throw new TypeError("Argument must be a Buffer");return this===u||0===t.compare(this,u)},t.prototype.inspect=function(){var u="",t=e.INSPECT_MAX_BYTES;return u=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(u+=" ... "),"<Buffer "+u+">"},t.prototype.compare=function(u,e,n,r,i){if(U(u,Uint8Array)&&(u=t.from(u,u.offset,u.byteLength)),!t.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(void 0===e&&(e=0),void 0===n&&(n=u?u.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>u.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===u)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),c=Math.min(o,a),s=this.slice(r,i),p=u.slice(e,n),f=0;f<c;++f)if(s[f]!==p[f]){o=s[f],a=p[f];break}return o<a?-1:a<o?1:0},t.prototype.includes=function(u,e,t){return-1!==this.indexOf(u,e,t)},t.prototype.indexOf=function(u,e,t){return p(this,u,e,t,!0)},t.prototype.lastIndexOf=function(u,e,t){return p(this,u,e,t,!1)},t.prototype.write=function(u,e,t,n){if(void 0===e)n="utf8",t=this.length,e=0;else if(void 0===t&&"string"==typeof e)n=e,t=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(t)?(t>>>=0,void 0===n&&(n="utf8")):(n=t,t=void 0)}var r=this.length-e;if((void 0===t||t>r)&&(t=r),u.length>0&&(t<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return d(this,u,e,t);case"utf8":case"utf-8":return l(this,u,e,t);case"ascii":return A(this,u,e,t);case"latin1":case"binary":return E(this,u,e,t);case"base64":return C(this,u,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,u,e,t);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var h=4096;function b(u,e,t){var n="";t=Math.min(u.length,t);for(var r=e;r<t;++r)n+=String.fromCharCode(127&u[r]);return n}function g(u,e,t){var n="";t=Math.min(u.length,t);for(var r=e;r<t;++r)n+=String.fromCharCode(u[r]);return n}function D(u,e,t){var n,r=u.length;(!e||e<0)&&(e=0),(!t||t<0||t>r)&&(t=r);for(var i="",o=e;o<t;++o)i+=(n=u[o])<16?"0"+n.toString(16):n.toString(16);return i}function I(u,e,t){for(var n=u.slice(e,t),r="",i=0;i<n.length;i+=2)r+=String.fromCharCode(n[i]+256*n[i+1]);return r}function B(u,e,t){if(u%1!=0||u<0)throw new RangeError("offset is not uint");if(u+e>t)throw new RangeError("Trying to access beyond buffer length")}function N(u,e,n,r,i,o){if(!t.isBuffer(u))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>u.length)throw new RangeError("Index out of range")}function T(u,e,t,n,r,i){if(t+n>u.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function v(u,e,t,n,r){return e=+e,t>>>=0,r||T(u,0,t,4),w.write(u,e,t,n,23,4),t+4}function k(u,e,t,n,r){return e=+e,t>>>=0,r||T(u,0,t,8),w.write(u,e,t,n,52,8),t+8}t.prototype.slice=function(u,e){var n=this.length;(u=~~u)<0?(u+=n)<0&&(u=0):u>n&&(u=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<u&&(e=u);var r=this.subarray(u,e);return r.__proto__=t.prototype,r},t.prototype.readUIntLE=function(u,e,t){u>>>=0,e>>>=0,t||B(u,e,this.length);for(var n=this[u],r=1,i=0;++i<e&&(r*=256);)n+=this[u+i]*r;return n},t.prototype.readUIntBE=function(u,e,t){u>>>=0,e>>>=0,t||B(u,e,this.length);for(var n=this[u+--e],r=1;e>0&&(r*=256);)n+=this[u+--e]*r;return n},t.prototype.readUInt8=function(u,e){return u>>>=0,e||B(u,1,this.length),this[u]},t.prototype.readUInt16LE=function(u,e){return u>>>=0,e||B(u,2,this.length),this[u]|this[u+1]<<8},t.prototype.readUInt16BE=function(u,e){return u>>>=0,e||B(u,2,this.length),this[u]<<8|this[u+1]},t.prototype.readUInt32LE=function(u,e){return u>>>=0,e||B(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+16777216*this[u+3]},t.prototype.readUInt32BE=function(u,e){return u>>>=0,e||B(u,4,this.length),16777216*this[u]+(this[u+1]<<16|this[u+2]<<8|this[u+3])},t.prototype.readIntLE=function(u,e,t){u>>>=0,e>>>=0,t||B(u,e,this.length);for(var n=this[u],r=1,i=0;++i<e&&(r*=256);)n+=this[u+i]*r;return n>=(r*=128)&&(n-=Math.pow(2,8*e)),n},t.prototype.readIntBE=function(u,e,t){u>>>=0,e>>>=0,t||B(u,e,this.length);for(var n=e,r=1,i=this[u+--n];n>0&&(r*=256);)i+=this[u+--n]*r;return i>=(r*=128)&&(i-=Math.pow(2,8*e)),i},t.prototype.readInt8=function(u,e){return u>>>=0,e||B(u,1,this.length),128&this[u]?-1*(255-this[u]+1):this[u]},t.prototype.readInt16LE=function(u,e){u>>>=0,e||B(u,2,this.length);var t=this[u]|this[u+1]<<8;return 32768&t?4294901760|t:t},t.prototype.readInt16BE=function(u,e){u>>>=0,e||B(u,2,this.length);var t=this[u+1]|this[u]<<8;return 32768&t?4294901760|t:t},t.prototype.readInt32LE=function(u,e){return u>>>=0,e||B(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},t.prototype.readInt32BE=function(u,e){return u>>>=0,e||B(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},t.prototype.readFloatLE=function(u,e){return u>>>=0,e||B(u,4,this.length),w.read(this,u,!0,23,4)},t.prototype.readFloatBE=function(u,e){return u>>>=0,e||B(u,4,this.length),w.read(this,u,!1,23,4)},t.prototype.readDoubleLE=function(u,e){return u>>>=0,e||B(u,8,this.length),w.read(this,u,!0,52,8)},t.prototype.readDoubleBE=function(u,e){return u>>>=0,e||B(u,8,this.length),w.read(this,u,!1,52,8)},t.prototype.writeUIntLE=function(u,e,t,n){u=+u,e>>>=0,t>>>=0,n||N(this,u,e,t,Math.pow(2,8*t)-1,0);var r=1,i=0;for(this[e]=255&u;++i<t&&(r*=256);)this[e+i]=u/r&255;return e+t},t.prototype.writeUIntBE=function(u,e,t,n){u=+u,e>>>=0,t>>>=0,n||N(this,u,e,t,Math.pow(2,8*t)-1,0);var r=t-1,i=1;for(this[e+r]=255&u;--r>=0&&(i*=256);)this[e+r]=u/i&255;return e+t},t.prototype.writeUInt8=function(u,e,t){return u=+u,e>>>=0,t||N(this,u,e,1,255,0),this[e]=255&u,e+1},t.prototype.writeUInt16LE=function(u,e,t){return u=+u,e>>>=0,t||N(this,u,e,2,65535,0),this[e]=255&u,this[e+1]=u>>>8,e+2},t.prototype.writeUInt16BE=function(u,e,t){return u=+u,e>>>=0,t||N(this,u,e,2,65535,0),this[e]=u>>>8,this[e+1]=255&u,e+2},t.prototype.writeUInt32LE=function(u,e,t){return u=+u,e>>>=0,t||N(this,u,e,4,4294967295,0),this[e+3]=u>>>24,this[e+2]=u>>>16,this[e+1]=u>>>8,this[e]=255&u,e+4},t.prototype.writeUInt32BE=function(u,e,t){return u=+u,e>>>=0,t||N(this,u,e,4,4294967295,0),this[e]=u>>>24,this[e+1]=u>>>16,this[e+2]=u>>>8,this[e+3]=255&u,e+4},t.prototype.writeIntLE=function(u,e,t,n){if(u=+u,e>>>=0,!n){var r=Math.pow(2,8*t-1);N(this,u,e,t,r-1,-r)}var i=0,o=1,a=0;for(this[e]=255&u;++i<t&&(o*=256);)u<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(u/o>>0)-a&255;return e+t},t.prototype.writeIntBE=function(u,e,t,n){if(u=+u,e>>>=0,!n){var r=Math.pow(2,8*t-1);N(this,u,e,t,r-1,-r)}var i=t-1,o=1,a=0;for(this[e+i]=255&u;--i>=0&&(o*=256);)u<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(u/o>>0)-a&255;return e+t},t.prototype.writeInt8=function(u,e,t){return u=+u,e>>>=0,t||N(this,u,e,1,127,-128),u<0&&(u=255+u+1),this[e]=255&u,e+1},t.prototype.writeInt16LE=function(u,e,t){return u=+u,e>>>=0,t||N(this,u,e,2,32767,-32768),this[e]=255&u,this[e+1]=u>>>8,e+2},t.prototype.writeInt16BE=function(u,e,t){return u=+u,e>>>=0,t||N(this,u,e,2,32767,-32768),this[e]=u>>>8,this[e+1]=255&u,e+2},t.prototype.writeInt32LE=function(u,e,t){return u=+u,e>>>=0,t||N(this,u,e,4,2147483647,-2147483648),this[e]=255&u,this[e+1]=u>>>8,this[e+2]=u>>>16,this[e+3]=u>>>24,e+4},t.prototype.writeInt32BE=function(u,e,t){return u=+u,e>>>=0,t||N(this,u,e,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[e]=u>>>24,this[e+1]=u>>>16,this[e+2]=u>>>8,this[e+3]=255&u,e+4},t.prototype.writeFloatLE=function(u,e,t){return v(this,u,e,!0,t)},t.prototype.writeFloatBE=function(u,e,t){return v(this,u,e,!1,t)},t.prototype.writeDoubleLE=function(u,e,t){return k(this,u,e,!0,t)},t.prototype.writeDoubleBE=function(u,e,t){return k(this,u,e,!1,t)},t.prototype.copy=function(u,e,n,r){if(!t.isBuffer(u))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=u.length&&(e=u.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===u.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),u.length-e<r-n&&(r=u.length-e+n);var i=r-n;if(this===u&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(e,n,r);else if(this===u&&n<e&&e<r)for(var o=i-1;o>=0;--o)u[o+e]=this[o+n];else Uint8Array.prototype.set.call(u,this.subarray(n,r),e);return i},t.prototype.fill=function(u,e,n,r){if("string"==typeof u){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!t.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===u.length){var i=u.charCodeAt(0);("utf8"===r&&i<128||"latin1"===r)&&(u=i)}}else"number"==typeof u&&(u&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=void 0===n?this.length:n>>>0,u||(u=0),"number"==typeof u)for(o=e;o<n;++o)this[o]=u;else{var a=t.isBuffer(u)?u:t.from(u,r),c=a.length;if(0===c)throw new TypeError('The value "'+u+'" is invalid for argument "value"');for(o=0;o<n-e;++o)this[o+e]=a[o%c]}return this};var S=/[^+/0-9A-Za-z-_]/g;function P(u,e){var t;e=e||1/0;for(var n=u.length,r=null,i=[],o=0;o<n;++o){if((t=u.charCodeAt(o))>55295&&t<57344){if(!r){if(t>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&i.push(239,191,189);continue}r=t;continue}if(t<56320){(e-=3)>-1&&i.push(239,191,189),r=t;continue}t=65536+(r-55296<<10|t-56320)}else r&&(e-=3)>-1&&i.push(239,191,189);if(r=null,t<128){if((e-=1)<0)break;i.push(t)}else if(t<2048){if((e-=2)<0)break;i.push(t>>6|192,63&t|128)}else if(t<65536){if((e-=3)<0)break;i.push(t>>12|224,t>>6&63|128,63&t|128)}else{if(!(t<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(t>>18|240,t>>12&63|128,t>>6&63|128,63&t|128)}}return i}function O(u){return F.toByteArray(function(u){if((u=(u=u.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;u.length%4!=0;)u+="=";return u}(u))}function R(u,e,t,n){for(var r=0;r<n&&!(r+t>=e.length||r>=u.length);++r)e[r+t]=u[r];return r}function U(u,e){return u instanceof e||null!=u&&null!=u.constructor&&null!=u.constructor.name&&u.constructor.name===e.name}function L(u){return u!=u}}).call(this)}).call(this,i({}).Buffer)})),o=u={};function a(){throw new Error("setTimeout has not been defined")}function c(){throw new Error("clearTimeout has not been defined")}function s(u){if(e===setTimeout)return setTimeout(u,0);if((e===a||!e)&&setTimeout)return e=setTimeout,setTimeout(u,0);try{return e(u,0)}catch(t){try{return e.call(null,u,0)}catch(t){return e.call(this,u,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:a}catch(u){e=a}try{t="function"==typeof clearTimeout?clearTimeout:c}catch(u){t=c}}();var p,f=[],d=!1,l=-1;function A(){d&&p&&(d=!1,p.length?f=p.concat(f):l=-1,f.length&&E())}function E(){if(!d){var u=s(A);d=!0;for(var e=f.length;e;){for(p=f,f=[];++l<e;)p&&p[l].run();l=-1,e=f.length}p=null,d=!1,function(u){if(t===clearTimeout)return clearTimeout(u);if((t===c||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(u);try{t(u)}catch(e){try{return t.call(null,u)}catch(e){return t.call(this,u)}}}(u)}}function C(u,e){this.fun=u,this.array=e}function _(){}o.nextTick=function(u){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];f.push(new C(u,e)),1!==f.length||d||s(E)},C.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=_,o.addListener=_,o.once=_,o.off=_,o.removeListener=_,o.removeAllListeners=_,o.emit=_,o.prependListener=_,o.prependOnceListener=_,o.listeners=function(u){return[]},o.binding=function(u){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(u){throw new Error("process.chdir is not supported")},o.umask=function(){return 0};for(var F={toByteArray:function(u){var e,t,n=I(u),r=n[0],i=n[1],o=new h(function(u,e,t){return 3*(e+t)/4-t}(0,r,i)),a=0,c=i>0?r-4:r;for(t=0;t<c;t+=4)e=m[u.charCodeAt(t)]<<18|m[u.charCodeAt(t+1)]<<12|m[u.charCodeAt(t+2)]<<6|m[u.charCodeAt(t+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=255&e;return 2===i&&(e=m[u.charCodeAt(t)]<<2|m[u.charCodeAt(t+1)]>>4,o[a++]=255&e),1===i&&(e=m[u.charCodeAt(t)]<<10|m[u.charCodeAt(t+1)]<<4|m[u.charCodeAt(t+2)]>>2,o[a++]=e>>8&255,o[a++]=255&e),o},fromByteArray:function(u){for(var e,t=u.length,n=t%3,r=[],i=0,o=t-n;i<o;i+=16383)r.push(B(u,i,i+16383>o?o:i+16383));return 1===n?(e=u[t-1],r.push(y[e>>2]+y[e<<4&63]+"==")):2===n&&(e=(u[t-2]<<8)+u[t-1],r.push(y[e>>10]+y[e>>4&63]+y[e<<2&63]+"=")),r.join("")}},y=[],m=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",g=0,D=b.length;g<D;++g)y[g]=b[g],m[b.charCodeAt(g)]=g;function I(u){var e=u.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=u.indexOf("=");return-1===t&&(t=e),[t,t===e?0:4-t%4]}function B(u,e,t){for(var n,r,i=[],o=e;o<t;o+=3)n=(u[o]<<16&16711680)+(u[o+1]<<8&65280)+(255&u[o+2]),i.push(y[(r=n)>>18&63]+y[r>>12&63]+y[r>>6&63]+y[63&r]);return i.join("")}m["-".charCodeAt(0)]=62,m["_".charCodeAt(0)]=63;var w={read:function(u,e,t,n,r){var i,o,a=8*r-n-1,c=(1<<a)-1,s=c>>1,p=-7,f=t?r-1:0,d=t?-1:1,l=u[e+f];for(f+=d,i=l&(1<<-p)-1,l>>=-p,p+=a;p>0;i=256*i+u[e+f],f+=d,p-=8);for(o=i&(1<<-p)-1,i>>=-p,p+=n;p>0;o=256*o+u[e+f],f+=d,p-=8);if(0===i)i=1-s;else{if(i===c)return o?NaN:1/0*(l?-1:1);o+=Math.pow(2,n),i-=s}return(l?-1:1)*o*Math.pow(2,i-n)},write:function(u,e,t,n,r,i){var o,a,c,s=8*i-r-1,p=(1<<s)-1,f=p>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:i-1,A=n?1:-1,E=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=p):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),(e+=o+f>=1?d/c:d*Math.pow(2,1-f))*c>=2&&(o++,c/=2),o+f>=p?(a=0,o=p):o+f>=1?(a=(e*c-1)*Math.pow(2,r),o+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,r),o=0));r>=8;u[t+l]=255&a,l+=A,a/=256,r-=8);for(o=o<<r|a,s+=r;s>0;u[t+l]=255&o,l+=A,o/=256,s-=8);u[t+l-A]|=128*E}},N={};(function(u,e){(function(){for(var t=Math.floor(16777215*Math.random()),n=f.index=parseInt(16777215*Math.random(),10),r=(void 0===u||"number"!=typeof u.pid?Math.floor(1e5*Math.random()):u.pid)%65535,i=(()=>{try{return _Buffer}catch(u){try{return e}catch(u){return null}}})(),o=function(u){return!(null==u||!u.constructor||"function"!=typeof u.constructor.isBuffer||!u.constructor.isBuffer(u))},a=[],c=0;c<256;c++)a[c]=(c<=15?"0":"")+c.toString(16);var s=new RegExp("^[0-9a-fA-F]{24}$"),p=[];for(c=0;c<10;)p[48+c]=c++;for(;c<16;)p[55+c]=p[87+c]=c++;function f(u){if(!(this instanceof f))return new f(u);if(u&&(u instanceof f||"ObjectID"===u._bsontype))return u;if(this._bsontype="ObjectID",null!=u&&"number"!=typeof u){var e=f.isValid(u);if(!e&&null!=u)throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");if(e&&"string"==typeof u&&24===u.length)return f.createFromHexString(u);if(null==u||12!==u.length){if(null!=u&&"function"==typeof u.toHexString)return u;throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters")}this.id=u}else this.id=this.generate(u)}N=f,f.default=f,f.createFromTime=function(u){return new f((8,(8===(e=(e=u=parseInt(u,10)%4294967295).toString(16)).length?e:"00000000".substring(e.length,8)+e)+"0000000000000000"));var e},f.createFromHexString=function(u){if(void 0===u||null!=u&&24!==u.length)throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");for(var e="",t=0;t<24;)e+=String.fromCharCode(p[u.charCodeAt(t++)]<<4|p[u.charCodeAt(t++)]);return new f(e)},f.isValid=function(u){return null!=u&&("number"==typeof u||("string"==typeof u?12===u.length||24===u.length&&s.test(u):u instanceof f||(o(u)?f.isValid(u.toString("hex")):!("function"!=typeof u.toHexString||!i||!(u.id instanceof i||"string"==typeof u.id))&&(12===u.id.length||24===u.id.length&&s.test(u.id)))))},f.prototype={constructor:f,toHexString:function(){if(!this.id||!this.id.length)throw new Error("invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is ["+JSON.stringify(this.id)+"]");if(24===this.id.length)return this.id;if(o(this.id))return this.id.toString("hex");for(var u="",e=0;e<this.id.length;e++)u+=a[this.id.charCodeAt(e)];return u},equals:function(u){return u instanceof f?this.toString()===u.toString():"string"==typeof u&&f.isValid(u)&&12===u.length&&o(this.id)?u===this.id.toString("binary"):"string"==typeof u&&f.isValid(u)&&24===u.length?u.toLowerCase()===this.toHexString():"string"==typeof u&&f.isValid(u)&&12===u.length?u===this.id:!(null==u||!(u instanceof f||u.toHexString))&&u.toHexString()===this.toHexString()},getTimestamp:function(){var u,e=new Date;return u=o(this.id)?this.id[3]|this.id[2]<<8|this.id[1]<<16|this.id[0]<<24:this.id.charCodeAt(3)|this.id.charCodeAt(2)<<8|this.id.charCodeAt(1)<<16|this.id.charCodeAt(0)<<24,e.setTime(1e3*Math.floor(u)),e},generate:function(u){"number"!=typeof u&&(u=~~(Date.now()/1e3)),u=parseInt(u,10)%4294967295;var e=n=(n+1)%16777215;return String.fromCharCode(u>>24&255,u>>16&255,u>>8&255,255&u,t>>16&255,t>>8&255,255&t,r>>8&255,255&r,e>>16&255,e>>8&255,255&e)}};var d=Symbol&&Symbol.for&&Symbol.for("nodejs.util.inspect.custom")||"inspect";f.prototype[d]=function(){return"ObjectID("+this+")"},f.prototype.toJSON=f.prototype.toHexString,f.prototype.toString=f.prototype.toHexString}).call(this)}).call(this,u,i({}).Buffer);var T=function(u,e){if(e=e.split(":")[0],!(u=+u))return!1;switch(e){case"http":case"ws":return 80!==u;case"https":case"wss":return 443!==u;case"ftp":return 21!==u;case"gopher":return 70!==u;case"file":return!1}return 0!==u},v={},k=Object.prototype.hasOwnProperty;function S(u){try{return decodeURIComponent(u.replace(/\+/g," "))}catch(e){return null}}function P(u){try{return encodeURIComponent(u)}catch(e){return null}}v.stringify=function(u,e){e=e||"";var t,n,r=[];for(n in"string"!=typeof e&&(e="?"),u)if(k.call(u,n)){if((t=u[n])||null!=t&&!isNaN(t)||(t=""),n=P(n),t=P(t),null===n||null===t)continue;r.push(n+"="+t)}return r.length?e+r.join("&"):""},v.parse=function(u){for(var e,t=/([^=?#&]+)=?([^&]*)/g,n={};e=t.exec(u);){var r=S(e[1]),i=S(e[2]);null===r||null===i||r in n||(n[r]=i)}return n};var O={};(function(u){(function(){"use strict";var e=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,t=/[\n\r\t]/g,n=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,r=/:\d+$/,i=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,o=/^[a-zA-Z]:/;function a(u){return(u||"").toString().replace(e,"")}var c=[["#","hash"],["?","query"],function(u,e){return f(e.protocol)?u.replace(/\\/g,"/"):u},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],s={hash:1,query:1};function p(e){var t,r=("undefined"!=typeof window?window:void 0!==u?u:"undefined"!=typeof self?self:{}).location||{},i={},o=typeof(e=e||r);if("blob:"===e.protocol)i=new l(unescape(e.pathname),{});else if("string"===o)for(t in i=new l(e,{}),s)delete i[t];else if("object"===o){for(t in e)t in s||(i[t]=e[t]);void 0===i.slashes&&(i.slashes=n.test(e.href))}return i}function f(u){return"file:"===u||"ftp:"===u||"http:"===u||"https:"===u||"ws:"===u||"wss:"===u}function d(u,e){u=(u=a(u)).replace(t,""),e=e||{};var n,r=i.exec(u),o=r[1]?r[1].toLowerCase():"",c=!!r[2],s=!!r[3],p=0;return c?s?(n=r[2]+r[3]+r[4],p=r[2].length+r[3].length):(n=r[2]+r[4],p=r[2].length):s?(n=r[3]+r[4],p=r[3].length):n=r[4],"file:"===o?p>=2&&(n=n.slice(2)):f(o)?n=r[4]:o?c&&(n=n.slice(2)):p>=2&&f(e.protocol)&&(n=r[4]),{protocol:o,slashes:c||f(o),slashesCount:p,rest:n}}function l(u,e,n){if(u=(u=a(u)).replace(t,""),!(this instanceof l))return new l(u,e,n);var r,i,s,A,E,C,_=c.slice(),F=typeof e,y=this,m=0;for("object"!==F&&"string"!==F&&(n=e,e=null),n&&"function"!=typeof n&&(n=v.parse),r=!(i=d(u||"",e=p(e))).protocol&&!i.slashes,y.slashes=i.slashes||r&&e.slashes,y.protocol=i.protocol||e.protocol||"",u=i.rest,("file:"===i.protocol&&(2!==i.slashesCount||o.test(u))||!i.slashes&&(i.protocol||i.slashesCount<2||!f(y.protocol)))&&(_[3]=[/(.*)/,"pathname"]);m<_.length;m++)"function"!=typeof(A=_[m])?(s=A[0],C=A[1],s!=s?y[C]=u:"string"==typeof s?~(E="@"===s?u.lastIndexOf(s):u.indexOf(s))&&("number"==typeof A[2]?(y[C]=u.slice(0,E),u=u.slice(E+A[2])):(y[C]=u.slice(E),u=u.slice(0,E))):(E=s.exec(u))&&(y[C]=E[1],u=u.slice(0,E.index)),y[C]=y[C]||r&&A[3]&&e[C]||"",A[4]&&(y[C]=y[C].toLowerCase())):u=A(u,y);n&&(y.query=n(y.query)),r&&e.slashes&&"/"!==y.pathname.charAt(0)&&(""!==y.pathname||""!==e.pathname)&&(y.pathname=function(u,e){if(""===u)return e;for(var t=(e||"/").split("/").slice(0,-1).concat(u.split("/")),n=t.length,r=t[n-1],i=!1,o=0;n--;)"."===t[n]?t.splice(n,1):".."===t[n]?(t.splice(n,1),o++):o&&(0===n&&(i=!0),t.splice(n,1),o--);return i&&t.unshift(""),"."!==r&&".."!==r||t.push(""),t.join("/")}(y.pathname,e.pathname)),"/"!==y.pathname.charAt(0)&&f(y.protocol)&&(y.pathname="/"+y.pathname),T(y.port,y.protocol)||(y.host=y.hostname,y.port=""),y.username=y.password="",y.auth&&(~(E=y.auth.indexOf(":"))?(y.username=y.auth.slice(0,E),y.username=encodeURIComponent(decodeURIComponent(y.username)),y.password=y.auth.slice(E+1),y.password=encodeURIComponent(decodeURIComponent(y.password))):y.username=encodeURIComponent(decodeURIComponent(y.auth)),y.auth=y.password?y.username+":"+y.password:y.username),y.origin="file:"!==y.protocol&&f(y.protocol)&&y.host?y.protocol+"//"+y.host:"null",y.href=y.toString()}l.prototype={set:function(u,e,t){var n=this;switch(u){case"query":"string"==typeof e&&e.length&&(e=(t||v.parse)(e)),n[u]=e;break;case"port":n[u]=e,T(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[u]="");break;case"hostname":n[u]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[u]=e,r.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!t;break;case"pathname":case"hash":if(e){var i="pathname"===u?"/":"#";n[u]=e.charAt(0)!==i?i+e:e}else n[u]=e;break;case"username":case"password":n[u]=encodeURIComponent(e);break;case"auth":var o=e.indexOf(":");~o?(n.username=e.slice(0,o),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=e.slice(o+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(e))}for(var a=0;a<c.length;a++){var s=c[a];s[4]&&(n[s[1]]=n[s[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin="file:"!==n.protocol&&f(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n},toString:function(u){u&&"function"==typeof u||(u=v.stringify);var e,t=this,n=t.host,i=t.protocol;i&&":"!==i.charAt(i.length-1)&&(i+=":");var o=i+(t.protocol&&t.slashes||f(t.protocol)?"//":"");return t.username?(o+=t.username,t.password&&(o+=":"+t.password),o+="@"):t.password?(o+=":"+t.password,o+="@"):"file:"!==t.protocol&&f(t.protocol)&&!n&&"/"!==t.pathname&&(o+="@"),(":"===n[n.length-1]||r.test(t.hostname)&&!t.port)&&(n+=":"),o+=n+t.pathname,(e="object"==typeof t.query?u(t.query):t.query)&&(o+="?"!==e.charAt(0)?"?"+e:e),t.hash&&(o+=t.hash),o}},l.extractProtocol=d,l.location=p,l.trimLeft=a,l.qs=v,O=l}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var R=u=>{const e=1e9*u[0]+u[1];return{seconds:e/1e9,milliseconds:e/1e6,nanoseconds:e}},U={parse:function(u,e){if("string"!=typeof u)throw new TypeError("argument str must be a string");for(var t={},n=(e||{}).decode||L,r=0;r<u.length;){var i=u.indexOf("=",r);if(-1===i)break;var o=u.indexOf(";",r);if(-1===o)o=u.length;else if(o<i){r=u.lastIndexOf(";",i-1)+1;continue}var a=u.slice(r,i).trim();if(void 0===t[a]){var c=u.slice(i+1,o).trim();34===c.charCodeAt(0)&&(c=c.slice(1,-1)),t[a]=M(c,n)}r=o+1}return t}};Object.prototype.toString;function L(u){return-1!==u.indexOf("%")?decodeURIComponent(u):u}function M(u,e){try{return e(u)}catch(t){return u}}var j={visa:{niceType:"Visa",type:"visa",patterns:[4],gaps:[4,8,12],lengths:[16,18,19],code:{name:"CVV",size:3}},mastercard:{niceType:"Mastercard",type:"mastercard",patterns:[[51,55],[2221,2229],[223,229],[23,26],[270,271],2720],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},"american-express":{niceType:"American Express",type:"american-express",patterns:[34,37],gaps:[4,10],lengths:[15],code:{name:"CID",size:4}},"diners-club":{niceType:"Diners Club",type:"diners-club",patterns:[[300,305],36,38,39],gaps:[4,10],lengths:[14,16,19],code:{name:"CVV",size:3}},discover:{niceType:"Discover",type:"discover",patterns:[6011,[644,649],65],gaps:[4,8,12],lengths:[16,19],code:{name:"CID",size:3}},jcb:{niceType:"JCB",type:"jcb",patterns:[2131,1800,[3528,3589]],gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVV",size:3}},unionpay:{niceType:"UnionPay",type:"unionpay",patterns:[620,[624,626],[62100,62182],[62184,62187],[62185,62197],[62200,62205],[622010,622999],622018,[622019,622999],[62207,62209],[622126,622925],[623,626],6270,6272,6276,[627700,627779],[627781,627799],[6282,6289],6291,6292,810,[8110,8131],[8132,8151],[8152,8163],[8164,8171]],gaps:[4,8,12],lengths:[14,15,16,17,18,19],code:{name:"CVN",size:3}},maestro:{niceType:"Maestro",type:"maestro",patterns:[493698,[5e5,504174],[504176,506698],[506779,508999],[56,59],63,67,6],gaps:[4,8,12],lengths:[12,13,14,15,16,17,18,19],code:{name:"CVC",size:3}},elo:{niceType:"Elo",type:"elo",patterns:[401178,401179,438935,457631,457632,431274,451416,457393,504175,[506699,506778],[509e3,509999],627780,636297,636368,[650031,650033],[650035,650051],[650405,650439],[650485,650538],[650541,650598],[650700,650718],[650720,650727],[650901,650978],[651652,651679],[655e3,655019],[655021,655058]],gaps:[4,8,12],lengths:[16],code:{name:"CVE",size:3}},mir:{niceType:"Mir",type:"mir",patterns:[[2200,2204]],gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVP2",size:3}},hiper:{niceType:"Hiper",type:"hiper",patterns:[637095,63737423,63743358,637568,637599,637609,637612],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},hipercard:{niceType:"Hipercard",type:"hipercard",patterns:[606282],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}}},x={};Object.defineProperty(x,"__esModule",{value:!0}),x.clone=void 0,x.clone=function(u){return u?JSON.parse(JSON.stringify(u)):null};var K={};Object.defineProperty(K,"__esModule",{value:!0}),K.matches=void 0,K.matches=function(u,e){return Array.isArray(e)?function(u,e,t){var n=String(e).length,r=u.substr(0,n),i=parseInt(r,10);return e=parseInt(String(e).substr(0,r.length),10),t=parseInt(String(t).substr(0,r.length),10),i>=e&&i<=t}(u,e[0],e[1]):function(u,e){return(e=String(e)).substring(0,u.length)===u.substring(0,e.length)}(u,e)};var W={};Object.defineProperty(W,"__esModule",{value:!0}),W.addMatchingCardsToResults=void 0,W.addMatchingCardsToResults=function(u,e,t){var n,r;for(n=0;n<e.patterns.length;n++){var i=e.patterns[n];if(K.matches(u,i)){var o=x.clone(e);r=Array.isArray(i)?String(i[0]).length:String(i).length,u.length>=r&&(o.matchStrength=r),t.push(o);break}}};var q={};Object.defineProperty(q,"__esModule",{value:!0}),q.isValidInputType=void 0,q.isValidInputType=function(u){return"string"==typeof u||u instanceof String};var V={};Object.defineProperty(V,"__esModule",{value:!0}),V.findBestMatch=void 0,V.findBestMatch=function(u){return function(u){var e=u.filter((function(u){return u.matchStrength})).length;return e>0&&e===u.length}(u)?u.reduce((function(u,e){return u?Number(u.matchStrength)<Number(e.matchStrength)?e:u:e})):null};var G={},Y=this&&this.__assign||function(){return(Y=Object.assign||function(u){for(var e,t=1,n=arguments.length;t<n;t++)for(var r in e=arguments[t])Object.prototype.hasOwnProperty.call(e,r)&&(u[r]=e[r]);return u}).apply(this,arguments)},z={},H={VISA:"visa",MASTERCARD:"mastercard",AMERICAN_EXPRESS:"american-express",DINERS_CLUB:"diners-club",DISCOVER:"discover",JCB:"jcb",UNIONPAY:"unionpay",MAESTRO:"maestro",ELO:"elo",MIR:"mir",HIPER:"hiper",HIPERCARD:"hipercard"},$=[H.VISA,H.MASTERCARD,H.AMERICAN_EXPRESS,H.DINERS_CLUB,H.DISCOVER,H.JCB,H.UNIONPAY,H.MAESTRO,H.ELO,H.MIR,H.HIPER,H.HIPERCARD],J=x.clone($);function Z(u){return z[u]||j[u]}function Q(u,e){void 0===e&&(e=!1);var t=J.indexOf(u);if(!e&&-1===t)throw new Error('"'+u+'" is not a supported card type.');return t}function X(u){var e=[];if(!q.isValidInputType(u))return e;if(0===u.length)return J.map((function(u){return x.clone(Z(u))}));J.forEach((function(t){var n=Z(t);W.addMatchingCardsToResults(u,n,e)}));var t=V.findBestMatch(e);return t?[t]:e}X.getTypeInfo=function(u){return x.clone(Z(u))},X.removeCard=function(u){var e=Q(u);J.splice(e,1)},X.addCard=function(u){var e=Q(u.type,!0);z[u.type]=u,-1===e&&J.push(u.type)},X.updateCard=function(u,e){var t=z[u]||j[u];if(!t)throw new Error('"'+u+"\" is not a recognized type. Use `addCard` instead.'");if(e.type&&t.type!==e.type)throw new Error("Cannot overwrite type parameter.");var n=x.clone(t);n=Y(Y({},n),e),z[n.type]=n},X.changeOrder=function(u,e){var t=Q(u);J.splice(t,1),J.splice(e,0,u)},X.resetModifications=function(){J=x.clone($),z={}},X.types=H,G=X;var uu={};(function(u){(function(){uu.formatArgs=function(u){if(u[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+u[0]+(this.useColors?"%c ":" ")+"+"+uu.humanize(this.diff),!this.useColors)return;const e="color: "+this.color;u.splice(1,0,e,"color: inherit");let t=0,n=0;u[0].replace(/%[a-zA-Z%]/g,u=>{"%%"!==u&&(t++,"%c"===u&&(n=t))}),u.splice(n,0,e)},uu.save=function(u){try{u?uu.storage.setItem("debug",u):uu.storage.removeItem("debug")}catch(e){}},uu.load=function(){let e;try{e=uu.storage.getItem("debug")}catch(t){}return!e&&void 0!==u&&"env"in u&&(e=u.env.DEBUG),e},uu.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},uu.storage=function(){try{return localStorage}catch(u){}}(),uu.destroy=(()=>{let u=!1;return()=>{u||(u=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),uu.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],uu.log=console.debug||console.log||(()=>{}),uu=function(u){function e(u){let n,r,i,o=null;function a(){for(var u=arguments.length,t=new Array(u),r=0;r<u;r++)t[r]=arguments[r];if(!a.enabled)return;const i=a,o=Number(new Date),c=o-(n||o);i.diff=c,i.prev=n,i.curr=o,n=o,t[0]=e.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let s=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,(u,n)=>{if("%%"===u)return"%";s++;const r=e.formatters[n];if("function"==typeof r){const e=t[s];u=r.call(i,e),t.splice(s,1),s--}return u}),e.formatArgs.call(i,t),(i.log||e.log).apply(i,t)}return a.namespace=u,a.useColors=e.useColors(),a.color=e.selectColor(u),a.extend=t,a.destroy=e.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(r!==e.namespaces&&(r=e.namespaces,i=e.enabled(u)),i),set:u=>{o=u}}),"function"==typeof e.init&&e.init(a),a}function t(u,t){const n=e(this.namespace+(void 0===t?":":t)+u);return n.log=this.log,n}function n(u){return u.toString().substring(2,u.toString().length-2).replace(/\.\*\?$/,"*")}return e.debug=e,e.default=e,e.coerce=function(u){return u instanceof Error?u.stack||u.message:u},e.disable=function(){const u=[...e.names.map(n),...e.skips.map(n).map(u=>"-"+u)].join(",");return e.enable(""),u},e.enable=function(u){let t;e.save(u),e.namespaces=u,e.names=[],e.skips=[];const n=("string"==typeof u?u:"").split(/[\s,]+/),r=n.length;for(t=0;t<r;t++)n[t]&&("-"===(u=n[t].replace(/\*/g,".*?"))[0]?e.skips.push(new RegExp("^"+u.slice(1)+"$")):e.names.push(new RegExp("^"+u+"$")))},e.enabled=function(u){if("*"===u[u.length-1])return!0;let t,n;for(t=0,n=e.skips.length;t<n;t++)if(e.skips[t].test(u))return!1;for(t=0,n=e.names.length;t<n;t++)if(e.names[t].test(u))return!0;return!1},e.humanize=r({}),e.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(u).forEach(t=>{e[t]=u[t]}),e.names=[],e.skips=[],e.formatters={},e.selectColor=function(u){let t=0;for(let e=0;e<u.length;e++)t=(t<<5)-t+u.charCodeAt(e),t|=0;return e.colors[Math.abs(t)%e.colors.length]},e.enable(e.load()),e}(uu);const{formatters:e}=uu;e.j=function(u){try{return JSON.stringify(u)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this)}).call(this,u);var eu={exports:{}};(function(u){(function(){var e,t;e=this,t=function(){"use strict";var e=function(u){!function(){if("performance"in window==0&&(window.performance={}),Date.now=Date.now||function(){return(new Date).getTime()},"now"in window.performance==0){var u=Date.now();performance.timing&&performance.timing.navigationStart&&(u=performance.timing.navigationStart),window.performance.now=function(){return Date.now()-u}}}();var e=Math.floor(.001*(Date.now()-performance.now())),t=.001*performance.now(),n=Math.floor(t)+e,r=Math.floor(t%1*1e9);return u&&(n-=u[0],(r-=u[1])<0&&(n--,r+=1e9)),[n,r]};return e.bigint=function(u){var t=e(u);return 1e9*t[0]+t[1]},void 0!==u&&void 0!==u.hrtime||void 0!==window.process||(window.process={}),void 0===u.hrtime?window.process.hrtime=e:u.hrtime},"object"==typeof eu.exports?eu.exports=t():(e="undefined"!=typeof globalThis?globalThis:e||self).hrtime=t()}).call(this)}).call(this,u),eu=eu.exports;var tu=/^[A-Z_]+(\/\d\.\d)? /,nu=/^([A-Z_]+) (.+) [A-Z]+\/(\d)\.(\d)$/,ru=/^[A-Z]+\/(\d)\.(\d) (\d{3}) (.*)$/;function iu(u){var e,t,n,r={},i=function(u){var e=0;return u=u.toString(),function(){var n=u.indexOf("\r\n",e),r=[n,u.indexOf("\n",e),u.indexOf("\r",e)].sort((function(u,e){return u>e?1:u<e?-1:0})).filter((function(u){return-1!==u}))[0];if(void 0!==r)return t(r,r===n?2:1);var i=u.length;return i===e?null:t(i,0)};function t(t,n){var r=u.substr(e,t-e);return e=t+n,r}}(u),o=i();for(tu.test(o)&&(o=i());o;)" "!==o[0]&&"\t"!==o[0]?(t&&ou(t,n,r),e=o.indexOf(":"),t=o.substr(0,e),n=o.substr(e+1).trim(),o=i()):(n+=" "+o.trim(),o=i());return t&&ou(t,n,r),r}function ou(u,e,t){switch(u=u.toLowerCase()){case"set-cookie":void 0!==t[u]?t[u].push(e):t[u]=[e];break;case"content-type":case"content-length":case"user-agent":case"referer":case"host":case"authorization":case"proxy-authorization":case"if-modified-since":case"if-unmodified-since":case"from":case"location":case"max-forwards":case"retry-after":case"etag":case"last-modified":case"server":case"age":case"expires":void 0===t[u]&&(t[u]=e);break;default:"string"==typeof t[u]?t[u]+=", "+e:t[u]=e}}var au=function(u,e){return function(u,e){var t,n=function(u){var e=u.indexOf("\r\n");return-1===e?u:u.slice(0,e)}(u);return e&&tu.test(n)?iu(u):null!==(t=n.match(nu))?{method:t[1],url:t[2],version:{major:parseInt(t[3],10),minor:parseInt(t[4],10)},headers:iu(u)}:null!==(t=n.match(ru))?{version:{major:parseInt(t[1],10),minor:parseInt(t[2],10)},statusCode:parseInt(t[3],10),statusMessage:t[4],headers:iu(u)}:iu(u)}(((t=u)&&t._header&&(t=t._header),t&&"function"==typeof t.toString?t.toString().trim():""),e);var t},cu=Object.prototype.toString,su=Math.max,pu=function(u,e){for(var t=[],n=0;n<u.length;n+=1)t[n]=u[n];for(var r=0;r<e.length;r+=1)t[r+u.length]=e[r];return t},fu=Function.prototype.bind||function(u){var e=this;if("function"!=typeof e||"[object Function]"!==cu.apply(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var t,n=function(u,e){for(var t=[],n=1,r=0;n<u.length;n+=1,r+=1)t[r]=u[n];return t}(arguments),r=su(0,e.length-n.length),i=[],o=0;o<r;o++)i[o]="$"+o;if(t=Function("binder","return function ("+function(u,e){for(var t="",n=0;n<u.length;n+=1)t+=u[n],n+1<u.length&&(t+=",");return t}(i)+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof t){var r=e.apply(this,pu(n,arguments));return Object(r)===r?r:this}return e.apply(u,pu(n,arguments))})),e.prototype){var a=function(){};a.prototype=e.prototype,t.prototype=new a,a.prototype=null}return t},du=Error,lu=EvalError,Au=RangeError,Eu=ReferenceError,Cu=SyntaxError,_u=TypeError,Fu=URIError,yu="undefined"!=typeof Symbol&&Symbol,mu={__proto__:null,foo:{}},hu=Object,bu=Function.prototype.call,gu=Object.prototype.hasOwnProperty,Du=fu.call(bu,gu),Iu=Function,Bu=function(u){try{return Iu('"use strict"; return ('+u+").constructor;")()}catch(e){}},wu=Object.getOwnPropertyDescriptor;if(wu)try{wu({},"")}catch(_t){wu=null}var Nu=function(){throw new _u},Tu=wu?function(){try{return Nu}catch(u){try{return wu(arguments,"callee").get}catch(e){return Nu}}}():Nu,vu="function"==typeof yu&&"function"==typeof Symbol&&"symbol"==typeof yu("foo")&&"symbol"==typeof Symbol("bar")&&function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var u={},e=Symbol("test"),t=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toSt