!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).superagent=t()}}((function(){var t={exports:{}};function e(t){if(t)return function(t){for(var r in e.prototype)t[r]=e.prototype[r];return t}(t)}t.exports=e,e.prototype.on=e.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},e.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,o=this._callbacks["$"+t];if(!o)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var n=0;nu.depthLimit)return void s("[...]",e,r,i);if(void 0!==u.edgesLimit&&o+1>u.edgesLimit)return void s("[...]",e,r,i);if(n.push(e),Array.isArray(e))for(l=0;le?1:0}function l(t,e,r,a){void 0===a&&(a=i());var l,c=function t(e,r,n,i,a,l,p){var c;if(l+=1,"object"==typeof e&&null!==e){for(c=0;cp.depthLimit)return void s("[...]",e,r,a);if(void 0!==p.edgesLimit&&n+1>p.edgesLimit)return void s("[...]",e,r,a);if(i.push(e),Array.isArray(e))for(c=0;c0)for(var o=0;o1&&"boolean"!=typeof e)throw new m('"allowMissing" argument must be a boolean');if(null===z(/^%?[^%]*%?$/,t))throw new d("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(t){var e=H(t,0,1),r=H(t,-1);if("%"===e&&"%"!==r)throw new d("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new d("invalid intrinsic syntax, expected opening `%`");var o=[];return $(t,G,(function(t,e,r,n){o[o.length]=r?$(n,J,"$1"):e||t})),o}(t),o=r.length>0?r[0]:"",n=K("%"+o+"%",e),i=n.name,a=n.value,s=!1,u=n.alias;u&&(o=u[0],W(r,B([0,1],u)));for(var l=1,p=!0;l=r.length){var h=k(a,c);a=(p=!!h)&&"get"in h&&!("originalValue"in h.get)?h.get:a[c]}else p=T(a,c),a=a[c];p&&!s&&(M[i]=a)}}return a},Q=V("%Object.defineProperty%",!0)||!1;if(Q)try{Q({},"a",{value:1})}catch(je){Q=!1}var X=Q,Y=V("%Object.getOwnPropertyDescriptor%",!0);if(Y)try{Y([],"length")}catch(je){Y=null}var Z=Y,tt=function(t,e,r){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new m("`obj` must be an object or a function`");if("string"!=typeof e&&"symbol"!=typeof e)throw new m("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new m("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new m("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new m("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new m("`loose`, if provided, must be a boolean");var o=arguments.length>3?arguments[3]:null,n=arguments.length>4?arguments[4]:null,i=arguments.length>5?arguments[5]:null,a=arguments.length>6&&arguments[6],s=!!Z&&Z(t,e);if(X)X(t,e,{configurable:null===i&&s?s.configurable:!i,enumerable:null===o&&s?s.enumerable:!o,value:r,writable:null===n&&s?s.writable:!n});else{if(!a&&(o||n||i))throw new d("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");t[e]=r}},et=function(){return!!X};et.hasArrayLengthDefineBug=function(){if(!X)return null;try{return 1!==X([],"length",{value:1}).length}catch(je){return!0}};var rt,ot=et(),nt=V("%Math.floor%"),it=function(t,e){if("function"!=typeof t)throw new m("`fn` is not a function");if("number"!=typeof e||e<0||e>4294967295||nt(e)!==e)throw new m("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],o=!0,n=!0;if("length"in t&&Z){var i=Z(t,"length");i&&!i.configurable&&(o=!1),i&&!i.writable&&(n=!1)}return(o||n||!r)&&(ot?tt(t,"length",e,!0,!0):tt(t,"length",e)),t},at=V("%Function.prototype.apply%"),st=V("%Function.prototype.call%"),ut=V("%Reflect.apply%",!0)||A.call(st,at),lt=V("%Math.max%");rt=function(t){if("function"!=typeof t)throw new m("a function is required");var e=ut(A,st,arguments);return it(e,1+lt(0,t.length-(arguments.length-1)),!0)};var pt=function(){return ut(A,at,arguments)};X?X(rt,"apply",{value:pt}):rt.apply=pt;var ct=rt(V("String.prototype.indexOf")),ft=function(t,e){var r=V(t,!!e);return"function"==typeof r&&ct(t,".prototype.")>-1?rt(r):r},yt={},ht={};(function(t){(function(){var e="function"==typeof Map&&Map.prototype,r=Object.getOwnPropertyDescriptor&&e?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,o=e&&r&&"function"==typeof r.get?r.get:null,n=e&&Map.prototype.forEach,i="function"==typeof Set&&Set.prototype,a=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,s=i&&a&&"function"==typeof a.get?a.get:null,u=i&&Set.prototype.forEach,l="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,p="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,c="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,f=Boolean.prototype.valueOf,y=Object.prototype.toString,h=Function.prototype.toString,d=String.prototype.match,m=String.prototype.slice,b=String.prototype.replace,g=String.prototype.toUpperCase,v=String.prototype.toLowerCase,w=RegExp.prototype.test,_=Array.prototype.concat,S=Array.prototype.join,E=Array.prototype.slice,A=Math.floor,O="function"==typeof BigInt?BigInt.prototype.valueOf:null,j=Object.getOwnPropertySymbols,T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,P="function"==typeof Symbol&&"object"==typeof Symbol.iterator,x="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,k=Object.prototype.propertyIsEnumerable,R=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function I(t,e){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||w.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var o=t<0?-A(-t):A(t);if(o!==t){var n=String(o),i=m.call(e,n.length+1);return b.call(n,r,"$&_")+"."+b.call(b.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return b.call(e,r,"$&_")}var D=yt.custom,C=L(D)?D:null;function F(t,e,r){var o="double"===(r.quoteStyle||e)?'"':"'";return o+t+o}function N(t){return b.call(String(t),/"/g,""")}function U(t){return!("[object Array]"!==W(t)||x&&"object"==typeof t&&x in t)}function M(t){return!("[object RegExp]"!==W(t)||x&&"object"==typeof t&&x in t)}function L(t){if(P)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!T)return!1;try{return T.call(t),!0}catch(je){}return!1}ht=function e(r,i,a,y){var g=i||{};if(B(g,"quoteStyle")&&"single"!==g.quoteStyle&&"double"!==g.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(B(g,"maxStringLength")&&("number"==typeof g.maxStringLength?g.maxStringLength<0&&g.maxStringLength!==1/0:null!==g.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var w=!B(g,"customInspect")||g.customInspect;if("boolean"!=typeof w&&"symbol"!==w)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(B(g,"indent")&&null!==g.indent&&"\t"!==g.indent&&!(parseInt(g.indent,10)===g.indent&&g.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(B(g,"numericSeparator")&&"boolean"!=typeof g.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var A=g.numericSeparator;if(void 0===r)return"undefined";if(null===r)return"null";if("boolean"==typeof r)return r?"true":"false";if("string"==typeof r)return function t(e,r){if(e.length>r.maxStringLength){var o=e.length-r.maxStringLength,n="... "+o+" more character"+(o>1?"s":"");return t(m.call(e,0,r.maxStringLength),r)+n}return F(b.call(b.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,H),"single",r)}(r,g);if("number"==typeof r){if(0===r)return 1/0/r>0?"0":"-0";var j=String(r);return A?I(r,j):j}if("bigint"==typeof r){var D=String(r)+"n";return A?I(r,D):D}var q=void 0===g.depth?5:g.depth;if(void 0===a&&(a=0),a>=q&&q>0&&"object"==typeof r)return U(r)?"[Array]":"[Object]";var Q,X=function(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=S.call(Array(t.indent+1)," ")}return{base:r,prev:S.call(Array(e+1),r)}}(g,a);if(void 0===y)y=[];else if($(y,r)>=0)return"[Circular]";function Y(t,r,o){if(r&&(y=E.call(y)).push(r),o){var n={depth:g.depth};return B(g,"quoteStyle")&&(n.quoteStyle=g.quoteStyle),e(t,n,a+1,y)}return e(t,g,a+1,y)}if("function"==typeof r&&!M(r)){var Z=function(t){if(t.name)return t.name;var e=d.call(h.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}(r),tt=V(r,Y);return"[Function"+(Z?": "+Z:" (anonymous)")+"]"+(tt.length>0?" { "+S.call(tt,", ")+" }":"")}if(L(r)){var et=P?b.call(String(r),/^(Symbol\(.*\))_[^)]*$/,"$1"):T.call(r);return"object"!=typeof r||P?et:z(et)}if((Q=r)&&"object"==typeof Q&&("undefined"!=typeof HTMLElement&&Q instanceof HTMLElement||"string"==typeof Q.nodeName&&"function"==typeof Q.getAttribute)){for(var rt="<"+v.call(String(r.nodeName)),ot=r.attributes||[],nt=0;nt"}if(U(r)){if(0===r.length)return"[]";var it=V(r,Y);return X&&!function(t){for(var e=0;e=0)return!1;return!0}(it)?"["+K(it,X)+"]":"[ "+S.call(it,", ")+" ]"}if(function(t){return!("[object Error]"!==W(t)||x&&"object"==typeof t&&x in t)}(r)){var at=V(r,Y);return"cause"in Error.prototype||!("cause"in r)||k.call(r,"cause")?0===at.length?"["+String(r)+"]":"{ ["+String(r)+"] "+S.call(at,", ")+" }":"{ ["+String(r)+"] "+S.call(_.call("[cause]: "+Y(r.cause),at),", ")+" }"}if("object"==typeof r&&w){if(C&&"function"==typeof r[C]&&yt)return yt(r,{depth:q-a});if("symbol"!==w&&"function"==typeof r.inspect)return r.inspect()}if(function(t){if(!o||!t||"object"!=typeof t)return!1;try{o.call(t);try{s.call(t)}catch(rt){return!0}return t instanceof Map}catch(je){}return!1}(r)){var st=[];return n&&n.call(r,(function(t,e){st.push(Y(e,r,!0)+" => "+Y(t,r))})),J("Map",o.call(r),st,X)}if(function(t){if(!s||!t||"object"!=typeof t)return!1;try{s.call(t);try{o.call(t)}catch(e){return!0}return t instanceof Set}catch(je){}return!1}(r)){var ut=[];return u&&u.call(r,(function(t){ut.push(Y(t,r))})),J("Set",s.call(r),ut,X)}if(function(t){if(!l||!t||"object"!=typeof t)return!1;try{l.call(t,l);try{p.call(t,p)}catch(rt){return!0}return t instanceof WeakMap}catch(je){}return!1}(r))return G("WeakMap");if(function(t){if(!p||!t||"object"!=typeof t)return!1;try{p.call(t,p);try{l.call(t,l)}catch(rt){return!0}return t instanceof WeakSet}catch(je){}return!1}(r))return G("WeakSet");if(function(t){if(!c||!t||"object"!=typeof t)return!1;try{return c.call(t),!0}catch(je){}return!1}(r))return G("WeakRef");if(function(t){return!("[object Number]"!==W(t)||x&&"object"==typeof t&&x in t)}(r))return z(Y(Number(r)));if(function(t){if(!t||"object"!=typeof t||!O)return!1;try{return O.call(t),!0}catch(je){}return!1}(r))return z(Y(O.call(r)));if(function(t){return!("[object Boolean]"!==W(t)||x&&"object"==typeof t&&x in t)}(r))return z(f.call(r));if(function(t){return!("[object String]"!==W(t)||x&&"object"==typeof t&&x in t)}(r))return z(Y(String(r)));if("undefined"!=typeof window&&r===window)return"{ [object Window] }";if(r===t)return"{ [object globalThis] }";if(!function(t){return!("[object Date]"!==W(t)||x&&"object"==typeof t&&x in t)}(r)&&!M(r)){var lt=V(r,Y),pt=R?R(r)===Object.prototype:r instanceof Object||r.constructor===Object,ct=r instanceof Object?"":"null prototype",ft=!pt&&x&&Object(r)===r&&x in r?m.call(W(r),8,-1):ct?"Object":"",ht=(pt||"function"!=typeof r.constructor?"":r.constructor.name?r.constructor.name+" ":"")+(ft||ct?"["+S.call(_.call([],ft||[],ct||[]),": ")+"] ":"");return 0===lt.length?ht+"{}":X?ht+"{"+K(lt,X)+"}":ht+"{ "+S.call(lt,", ")+" }"}return String(r)};var q=Object.prototype.hasOwnProperty||function(t){return t in this};function B(t,e){return q.call(t,e)}function W(t){return y.call(t)}function $(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,o=t.length;r1;){var e=t.pop(),r=e.obj[e.prop];if(xt(r)){for(var o=[],n=0;n=1024?i.slice(s,s+1024):i,l=[],p=0;p=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||n===Tt.RFC1738&&(40===c||41===c)?l[l.length]=u.charAt(p):c<128?l[l.length]=kt[c]:c<2048?l[l.length]=kt[192|c>>6]+kt[128|63&c]:c<55296||c>=57344?l[l.length]=kt[224|c>>12]+kt[128|c>>6&63]+kt[128|63&c]:(p+=1,c=65536+((1023&c)<<10|1023&u.charCodeAt(p)),l[l.length]=kt[240|c>>18]+kt[128|c>>12&63]+kt[128|c>>6&63]+kt[128|63&c])}a+=l.join("")}return a},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(xt(t)){for(var r=[],o=0;o0?w.join(",")||null:void 0}];else if(Ct(p))O=p;else{var T=Object.keys(w);O=c?T.sort(c):T}var P=u?r.replace(/\./g,"%2E"):r,x=n&&Ct(w)&&1===w.length?P+"[]":P;if(i&&Ct(w)&&0===w.length)return x+"[]";for(var k=0;k0?f+c:""}}),$t={type:t=>t.split(/ *; */).shift(),params:t=>{const e={};for(const r of t.split(/ *; */)){const t=r.split(/ *= */),o=t.shift(),n=t.shift();o&&n&&(e[o]=n)}return e},parseLinks:t=>{const e={};for(const r of t.split(/ *, */)){const t=r.split(/ *; */),o=t[0].slice(1,-1);e[t[1].split(/ *= */)[1].slice(1,-1)]=o}return e},isObject:t=>null!==t&&"object"==typeof t};$t.hasOwn=Object.hasOwn||function(t,e){if(null==t)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(new Object(t),e)},$t.mixin=(t,e)=>{for(const r in e)$t.hasOwn(e,r)&&(t[r]=e[r])};var Ht,zt,Gt,Jt=Ht={};function Kt(){throw new Error("setTimeout has not been defined")}function Vt(){throw new Error("clearTimeout has not been defined")}function Qt(t){if(zt===setTimeout)return setTimeout(t,0);if((zt===Kt||!zt)&&setTimeout)return zt=setTimeout,setTimeout(t,0);try{return zt(t,0)}catch(je){try{return zt.call(null,t,0)}catch(je){return zt.call(this,t,0)}}}!function(){try{zt="function"==typeof setTimeout?setTimeout:Kt}catch(je){zt=Kt}try{Gt="function"==typeof clearTimeout?clearTimeout:Vt}catch(je){Gt=Vt}}();var Xt,Yt=[],Zt=!1,te=-1;function ee(){Zt&&Xt&&(Zt=!1,Xt.length?Yt=Xt.concat(Yt):te=-1,Yt.length&&re())}function re(){if(!Zt){var t=Qt(ee);Zt=!0;for(var e=Yt.length;e;){for(Xt=Yt,Yt=[];++te1)for(var r=1;r=this._maxRetries)return!1;if(this._retryCallback)try{const r=this._retryCallback(t,e);if(!0===r)return!0;if(!1===r)return!1}catch(r){console.error(r)}if(e&&e.status&&i.has(e.status))return!0;if(t){if(t.code&&n.has(t.code))return!0;if(t.timeout&&"ECONNABORTED"===t.code)return!0;if(t.crossDomain)return!0}return!1},o.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this.timedoutError=null,this._end()},o.prototype.then=function(t,e){if(!this._fullfilledPromise){const t=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise((e,r)=>{t.on("abort",()=>{if(this._maxRetries&&this._maxRetries>this._retries)return;if(this.timedout&&this.timedoutError)return void r(this.timedoutError);const t=new Error("Aborted");t.code="ABORTED",t.status=this.status,t.method=this.method,t.url=this.url,r(t)}),t.end((t,o)=>{t?r(t):e(o)})})}return this._fullfilledPromise.then(t,e)},o.prototype.catch=function(t){return this.then(void 0,t)},o.prototype.use=function(t){return t(this),this},o.prototype.ok=function(t){if("function"!=typeof t)throw new Error("Callback required");return this._okCallback=t,this},o.prototype._isResponseOK=function(t){return!!t&&(this._okCallback?this._okCallback(t):t.status>=200&&t.status<300)},o.prototype.get=function(t){return this._header[t.toLowerCase()]},o.prototype.getHeader=o.prototype.get,o.prototype.set=function(t,o){if(e(t)){for(const e in t)r(t,e)&&this.set(e,t[e]);return this}return this._header[t.toLowerCase()]=o,this.header[t]=o,this},o.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},o.prototype.field=function(t,o,n){if(null==t)throw new Error(".field(name, val) name can not be empty");if(this._data)throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");if(e(t)){for(const e in t)r(t,e)&&this.field(e,t[e]);return this}if(Array.isArray(o)){for(const e in o)r(o,e)&&this.field(t,o[e]);return this}if(null==o)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof o&&(o=String(o)),n?this._getFormData().append(t,o,n):this._getFormData().append(t,o),this},o.prototype.abort=function(){if(this._aborted)return this;if(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req){if(yt.gte(t.version,"v13.0.0")&&yt.lt(t.version,"v14.0.0"))throw new Error("Superagent does not work in v13 properly with abort() due to Node.js core changes");this.req.abort()}return this.clearTimeout(),this.emit("abort"),this},o.prototype._auth=function(t,e,r,o){switch(r.type){case"basic":this.set("Authorization","Basic "+o(`${t}:${e}`));break;case"auto":this.username=t,this.password=e;break;case"bearer":this.set("Authorization","Bearer "+t)}return this},o.prototype.withCredentials=function(t){return void 0===t&&(t=!0),this._withCredentials=t,this},o.prototype.redirects=function(t){return this._maxRedirects=t,this},o.prototype.maxResponseSize=function(t){if("number"!=typeof t)throw new TypeError("Invalid argument");return this._maxResponseSize=t,this},o.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},o.prototype.send=function(t){const o=e(t);let n=this._header["content-type"];if(this._formData)throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");if(o&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw new Error("Can't merge these send calls");if(o&&e(this._data))for(const e in t){if("bigint"==typeof t[e]&&!t[e].toJSON)throw new Error("Cannot serialize BigInt value to json");r(t,e)&&(this._data[e]=t[e])}else{if("bigint"==typeof t)throw new Error("Cannot send value of type BigInt");"string"==typeof t?(n||this.type("form"),(n=this._header["content-type"])&&(n=n.toLowerCase().trim()),this._data="application/x-www-form-urlencoded"===n?this._data?`${this._data}&${t}`:t:(this._data||"")+t):this._data=t}return!o||this._isHost(t)||n||this.type("json"),this},o.prototype.sortQuery=function(t){return this._sort=void 0===t||t,this},o.prototype._finalizeQueryString=function(){const t=this._query.join("&");if(t&&(this.url+=(this.url.includes("?")?"&":"?")+t),this._query.length=0,this._sort){const t=this.url.indexOf("?");if(t>=0){const e=this.url.slice(t+1).split("&");"function"==typeof this._sort?e.sort(this._sort):e.sort(),this.url=this.url.slice(0,t)+"?"+e.join("&")}}},o.prototype._appendQueryString=()=>{console.warn("Unsupported")},o.prototype._timeoutError=function(t,e,r){if(this._aborted)return;const o=new Error(t+e+"ms exceeded");o.timeout=e,o.code="ECONNABORTED",o.errno=r,this.timedout=!0,this.timedoutError=o,this.abort(),this.callback(o)},o.prototype._setTimeouts=function(){const t=this;this._timeout&&!this._timer&&(this._timer=setTimeout(()=>{t._timeoutError("Timeout of ",t._timeout,"ETIME")},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(()=>{t._timeoutError("Response timeout of ",t._responseTimeout,"ETIMEDOUT")},this._responseTimeout))}}).call(this)}).call(this,Ht);var ae;function se(){}ae=se,se.prototype.get=function(t){return this.header[t.toLowerCase()]},se.prototype._setHeaderProperties=function(t){const e=t["content-type"]||"";this.type=$t.type(e);const r=$t.params(e);for(const n in r)Object.prototype.hasOwnProperty.call(r,n)&&(this[n]=r[n]);this.links={};try{t.link&&(this.links=$t.parseLinks(t.link))}catch(o){}},se.prototype._setStatusProperties=function(t){const e=Math.trunc(t/100);this.statusCode=t,this.status=this.statusCode,this.statusType=e,this.info=1===e,this.ok=2===e,this.redirect=3===e,this.clientError=4===e,this.serverError=5===e,this.error=(4===e||5===e)&&this.toError(),this.created=201===t,this.accepted=202===t,this.noContent=204===t,this.badRequest=400===t,this.unauthorized=401===t,this.notAcceptable=406===t,this.forbidden=403===t,this.notFound=404===t,this.unprocessableEntity=422===t};const ue=["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert","disableTLSCerts"];class le{constructor(){this._defaults=[]}_setDefaults(t){for(const e of this._defaults)t[e.fn](...e.args)}}for(const Te of ue)le.prototype[Te]=function(){for(var t=arguments.length,e=new Array(t),r=0;r{if(fe.XMLHttpRequest)return new fe.XMLHttpRequest;throw new Error("Browser-only version of superagent could not find XHR")};const ge="".trim?t=>t.trim():t=>t.replace(/(^\s*|\s*$)/g,"");function ve(t){if(!ye(t))return t;const e=[];for(const r in t)de(t,r)&&we(e,r,t[r]);return e.join("&")}function we(t,e,r){if(void 0!==r)if(null!==r)if(Array.isArray(r))for(const o of r)we(t,e,o);else if(ye(r))for(const o in r)de(r,o)&&we(t,`${e}[${o}]`,r[o]);else t.push(encodeURI(e)+"="+encodeURIComponent(r));else t.push(encodeURI(e))}function _e(t){const e={},r=t.split("&");let o,n;for(let i=0,a=r.length;i{let t,e=null,o=null;try{o=new Ee(r)}catch(n){return(e=new Error("Parser is unable to parse the response")).parse=!0,e.original=n,r.xhr?(e.rawResponse=void 0===r.xhr.responseType?r.xhr.responseText:r.xhr.response,e.status=r.xhr.status?r.xhr.status:null,e.statusCode=e.status):(e.rawResponse=null,e.status=null),r.callback(e)}r.emit("response",o);try{r._isResponseOK(o)||(t=new Error(o.statusText||o.text||"Unsuccessful HTTP response"))}catch(n){t=n}t?(t.original=e,t.response=o,t.status=t.status||o.status,r.callback(t,o)):r.callback(null,o)})}be.serializeObject=ve,be.parseString=_e,be.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},be.serialize={"application/x-www-form-urlencoded":Wt.stringify,"application/json":r},be.parse={"application/x-www-form-urlencoded":_e,"application/json":JSON.parse},he(Ee.prototype,ae.prototype),Ee.prototype._parseBody=function(t){let e=be.parse[this.type];return this.req._parser?this.req._parser(this,t):(!e&&Se(this.type)&&(e=be.parse["application/json"]),e&&t&&(t.length>0||t instanceof Object)?e(t):null)},Ee.prototype.toError=function(){const{req:t}=this,{method:e}=t,{url:r}=t,o=`cannot ${e} ${r} (${this.status})`,n=new Error(o);return n.status=this.status,n.method=e,n.url=r,n},be.Response=Ee,t(Ae.prototype),he(Ae.prototype,ie.prototype),Ae.prototype.type=function(t){return this.set("Content-Type",be.types[t]||t),this},Ae.prototype.accept=function(t){return this.set("Accept",be.types[t]||t),this},Ae.prototype.auth=function(t,e,r){1===arguments.length&&(e=""),"object"==typeof e&&null!==e&&(r=e,e=""),r||(r={type:"function"==typeof btoa?"basic":"auto"});const o=r.encoder?r.encoder:t=>{if("function"==typeof btoa)return btoa(t);throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(t,e,r,o)},Ae.prototype.query=function(t){return"string"!=typeof t&&(t=ve(t)),t&&this._query.push(t),this},Ae.prototype.attach=function(t,e,r){if(e){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(t,e,r||e.name)}return this},Ae.prototype._getFormData=function(){return this._formData||(this._formData=new fe.FormData),this._formData},Ae.prototype.callback=function(t,e){if(this._shouldRetry(t,e))return this._retry();const r=this._callback;this.clearTimeout(),t&&(this._maxRetries&&(t.retries=this._retries-1),this.emit("error",t)),r(t,e)},Ae.prototype.crossDomainError=function(){const t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},Ae.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},Ae.prototype.ca=Ae.prototype.agent,Ae.prototype.buffer=Ae.prototype.ca,Ae.prototype.write=()=>{throw new Error("Streaming is not supported in browser version of superagent")},Ae.prototype.pipe=Ae.prototype.write,Ae.prototype._isHost=function(t){return t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},Ae.prototype.end=function(t){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=t||me,this._finalizeQueryString(),this._end()},Ae.prototype._setUploadTimeout=function(){const t=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout(()=>{t._timeoutError("Upload timeout of ",t._uploadTimeout,"ETIMEDOUT")},this._uploadTimeout))},Ae.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));const t=this;this.xhr=be.getXHR();const{xhr:e}=this;let r=this._formData||this._data;this._setTimeouts(),e.addEventListener("readystatechange",()=>{const{readyState:r}=e;if(r>=2&&t._responseTimeoutTimer&&clearTimeout(t._responseTimeoutTimer),4!==r)return;let o;try{o=e.status}catch(n){o=0}if(!o){if(t.timedout||t._aborted)return;return t.crossDomainError()}t.emit("end")});const o=(e,r)=>{r.total>0&&(r.percent=r.loaded/r.total*100,100===r.percent&&clearTimeout(t._uploadTimeoutTimer)),r.direction=e,t.emit("progress",r)};if(this.hasListeners("progress"))try{e.addEventListener("progress",o.bind(null,"download")),e.upload&&e.upload.addEventListener("progress",o.bind(null,"upload"))}catch(n){}e.upload&&this._setUploadTimeout();try{this.username&&this.password?e.open(this.method,this.url,!0,this.username,this.password):e.open(this.method,this.url,!0)}catch(n){return this.callback(n)}if(this._withCredentials&&(e.withCredentials=!0),!this._formData&&"GET"!==this.method&&"HEAD"!==this.method&&"string"!=typeof r&&!this._isHost(r)){const t=this._header["content-type"];let e=this._serializer||be.serialize[t?t.split(";")[0]:""];!e&&Se(t)&&(e=be.serialize["application/json"]),e&&(r=e(r))}for(const i in this.header)null!==this.header[i]&&de(this.header,i)&&e.setRequestHeader(i,this.header[i]);this._responseType&&(e.responseType=this._responseType),this.emit("request",this),e.send(void 0===r?null:r)},be.agent=()=>new pe;for(const Te of["GET","POST","OPTIONS","PATCH","PUT","DELETE"])pe.prototype[Te.toLowerCase()]=function(t,e){const r=new be.Request(Te,t);return this._setDefaults(r),e&&r.end(e),r};function Oe(t,e,r){const o=be("DELETE",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o}return pe.prototype.del=pe.prototype.delete,be.get=(t,e,r)=>{const o=be("GET",t);return"function"==typeof e&&(r=e,e=null),e&&o.query(e),r&&o.end(r),o},be.head=(t,e,r)=>{const o=be("HEAD",t);return"function"==typeof e&&(r=e,e=null),e&&o.query(e),r&&o.end(r),o},be.options=(t,e,r)=>{const o=be("OPTIONS",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},be.del=Oe,be.delete=Oe,be.patch=(t,e,r)=>{const o=be("PATCH",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},be.post=(t,e,r)=>{const o=be("POST",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},be.put=(t,e,r)=>{const o=be("PUT",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},ce}));