!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;np.depthLimit)return void s("[...]",e,r,i);if(void 0!==p.edgesLimit&&o+1>p.edgesLimit)return void s("[...]",e,r,i);if(n.push(e),Array.isArray(e))for(u=0;ue?1:0}function u(t,e,r,a){void 0===a&&(a=i());var u,c=function t(e,r,n,i,a,u,l){var c;if(u+=1,"object"==typeof e&&null!==e){for(c=0;cl.depthLimit)return void s("[...]",e,r,a);if(void 0!==l.edgesLimit&&n+1>l.edgesLimit)return void s("[...]",e,r,a);if(i.push(e),Array.isArray(e))for(c=0;c0)for(var o=0;o-1e3&&t<1e3||S.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var o=t<0?-j(-t):j(t);if(o!==t){var n=String(o),i=b.call(e,n.length+1);return v.call(n,r,"$&_")+"."+v.call(v.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return v.call(e,r,"$&_")}var F=f.custom,N=$(F)?F:null,M={__proto__:null,double:'"',single:"'"},U={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};function q(t,e,r){var o=r.quoteStyle||e,n=M[o];return n+t+n}function L(t){return v.call(String(t),/"/g,""")}function B(t){return!k||!("object"==typeof t&&(k in t||void 0!==t[k]))}function W(t){return"[object Array]"===J(t)&&B(t)}function H(t){return"[object RegExp]"===J(t)&&B(t)}function $(t){if(R)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!x)return!1;try{return x.call(t),!0}catch(e){}return!1}y=function e(r,i,a,y){var d=i||{};if(G(d,"quoteStyle")&&!G(M,d.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(G(d,"maxStringLength")&&("number"==typeof d.maxStringLength?d.maxStringLength<0&&d.maxStringLength!==1/0:null!==d.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var w=!G(d,"customInspect")||d.customInspect;if("boolean"!=typeof w&&"symbol"!==w)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(G(d,"indent")&&null!==d.indent&&"\t"!==d.indent&&!(parseInt(d.indent,10)===d.indent&&d.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(G(d,"numericSeparator")&&"boolean"!=typeof d.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var S=d.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(b.call(e,0,r.maxStringLength),r)+n}var i=U[r.quoteStyle||"single"];return i.lastIndex=0,q(v.call(v.call(e,i,"\\$1"),/[\x00-\x1f]/g,V),"single",r)}(r,d);if("number"==typeof r){if(0===r)return 1/0/r>0?"0":"-0";var j=String(r);return S?C(r,j):j}if("bigint"==typeof r){var P=String(r)+"n";return S?C(r,P):P}var F=void 0===d.depth?5:d.depth;if(void 0===a&&(a=0),a>=F&&F>0&&"object"==typeof r)return W(r)?"[Array]":"[Object]";var z,et=function(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=E.call(Array(t.indent+1)," ")}return{base:r,prev:E.call(Array(e+1),r)}}(d,a);if(void 0===y)y=[];else if(K(y,r)>=0)return"[Circular]";function rt(t,r,o){if(r&&(y=O.call(y)).push(r),o){var n={depth:d.depth};return G(d,"quoteStyle")&&(n.quoteStyle=d.quoteStyle),e(t,n,a+1,y)}return e(t,d,a+1,y)}if("function"==typeof r&&!H(r)){var ot=function(t){if(t.name)return t.name;var e=g.call(m.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}(r),nt=tt(r,rt);return"[Function"+(ot?": "+ot:" (anonymous)")+"]"+(nt.length>0?" { "+E.call(nt,", ")+" }":"")}if($(r)){var it=R?v.call(String(r),/^(Symbol\(.*\))_[^)]*$/,"$1"):x.call(r);return"object"!=typeof r||R?it:Q(it)}if((z=r)&&"object"==typeof z&&("undefined"!=typeof HTMLElement&&z instanceof HTMLElement||"string"==typeof z.nodeName&&"function"==typeof z.getAttribute)){for(var at="<"+_.call(String(r.nodeName)),st=r.attributes||[],pt=0;pt"}if(W(r)){if(0===r.length)return"[]";var ut=tt(r,rt);return et&&!function(t){for(var e=0;e=0)return!1;return!0}(ut)?"["+Z(ut,et)+"]":"[ "+E.call(ut,", ")+" ]"}if(function(t){return"[object Error]"===J(t)&&B(t)}(r)){var lt=tt(r,rt);return"cause"in Error.prototype||!("cause"in r)||I.call(r,"cause")?0===lt.length?"["+String(r)+"]":"{ ["+String(r)+"] "+E.call(lt,", ")+" }":"{ ["+String(r)+"] "+E.call(A.call("[cause]: "+rt(r.cause),lt),", ")+" }"}if("object"==typeof r&&w){if(N&&"function"==typeof r[N]&&f)return f(r,{depth:F-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(at){return!0}return t instanceof Map}catch(e){}return!1}(r)){var ct=[];return n&&n.call(r,(function(t,e){ct.push(rt(e,r,!0)+" => "+rt(t,r))})),Y("Map",o.call(r),ct,et)}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(r){}return!1}(r)){var ft=[];return p&&p.call(r,(function(t){ft.push(rt(t,r))})),Y("Set",s.call(r),ft,et)}if(function(t){if(!u||!t||"object"!=typeof t)return!1;try{u.call(t,u);try{l.call(t,l)}catch(at){return!0}return t instanceof WeakMap}catch(e){}return!1}(r))return X("WeakMap");if(function(t){if(!l||!t||"object"!=typeof t)return!1;try{l.call(t,l);try{u.call(t,u)}catch(at){return!0}return t instanceof WeakSet}catch(e){}return!1}(r))return X("WeakSet");if(function(t){if(!c||!t||"object"!=typeof t)return!1;try{return c.call(t),!0}catch(e){}return!1}(r))return X("WeakRef");if(function(t){return"[object Number]"===J(t)&&B(t)}(r))return Q(rt(Number(r)));if(function(t){if(!t||"object"!=typeof t||!T)return!1;try{return T.call(t),!0}catch(e){}return!1}(r))return Q(rt(T.call(r)));if(function(t){return"[object Boolean]"===J(t)&&B(t)}(r))return Q(h.call(r));if(function(t){return"[object String]"===J(t)&&B(t)}(r))return Q(rt(String(r)));if("undefined"!=typeof window&&r===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&r===globalThis||void 0!==t&&r===t)return"{ [object globalThis] }";if(!function(t){return"[object Date]"===J(t)&&B(t)}(r)&&!H(r)){var yt=tt(r,rt),ht=D?D(r)===Object.prototype:r instanceof Object||r.constructor===Object,dt=r instanceof Object?"":"null prototype",mt=!ht&&k&&Object(r)===r&&k in r?b.call(J(r),8,-1):dt?"Object":"",gt=(ht||"function"!=typeof r.constructor?"":r.constructor.name?r.constructor.name+" ":"")+(mt||dt?"["+E.call(A.call([],mt||[],dt||[]),": ")+"] ":"");return 0===yt.length?gt+"{}":et?gt+"{"+Z(yt,et)+"}":gt+"{ "+E.call(yt,", ")+" }"}return String(r)};var z=Object.prototype.hasOwnProperty||function(t){return t in this};function G(t,e){return z.call(t,e)}function J(t){return d.call(t)}function K(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,o=t.length;r1&&"boolean"!=typeof e)throw new c('"allowMissing" argument must be a boolean');if(null===yt(/^%?[^%]*%?$/,t))throw new w("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(t){var e=ft(t,0,1),r=ft(t,-1);if("%"===e&&"%"!==r)throw new w("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new w("invalid intrinsic syntax, expected opening `%`");var o=[];return ct(t,ht,(function(t,e,r,n){o[o.length]=r?ct(n,dt,"$1"):e||t})),o}(t),o=r.length>0?r[0]:"",n=mt("%"+o+"%",e),i=n.name,a=n.value,s=!1,p=n.alias;p&&(o=p[0],lt(r,ut([0,1],p)));for(var u=1,l=!0;u=r.length){var d=R(a,f);a=(l=!!d)&&"get"in d&&!("originalValue"in d.get)?d.get:a[f]}else l=Y(a,f),a=a[f];l&&!s&&(at[i]=a)}}return a},bt=$([gt("%String.prototype.indexOf%")]),vt=function(t,e){var r=gt(t,!!e);return"function"==typeof r&&bt(t,".prototype.")>-1?$([r]):r},wt=gt("%Map%",!0),_t=vt("Map.prototype.get",!0),St=vt("Map.prototype.set",!0),At=vt("Map.prototype.has",!0),Et=vt("Map.prototype.delete",!0),Ot=vt("Map.prototype.size",!0),jt=!!wt&&function(){var t,e={assert:function(t){if(!e.has(t))throw new c("Side channel does not contain "+y(t))},delete:function(e){if(t){var r=Et(t,e);return 0===Ot(t)&&(t=void 0),r}return!1},get:function(e){if(t)return _t(t,e)},has:function(e){return!!t&&At(t,e)},set:function(e,r){t||(t=new wt),St(t,e,r)}};return e},Tt=gt("%WeakMap%",!0),Pt=vt("WeakMap.prototype.get",!0),xt=vt("WeakMap.prototype.set",!0),Rt=vt("WeakMap.prototype.has",!0),kt=vt("WeakMap.prototype.delete",!0),It=(Tt?function(){var t,e,r={assert:function(t){if(!r.has(t))throw new c("Side channel does not contain "+y(t))},delete:function(r){if(Tt&&r&&("object"==typeof r||"function"==typeof r)){if(t)return kt(t,r)}else if(jt&&e)return e.delete(r);return!1},get:function(r){return Tt&&r&&("object"==typeof r||"function"==typeof r)&&t?Pt(t,r):e&&e.get(r)},has:function(r){return Tt&&r&&("object"==typeof r||"function"==typeof r)&&t?Rt(t,r):!!e&&e.has(r)},set:function(r,o){Tt&&r&&("object"==typeof r||"function"==typeof r)?(t||(t=new Tt),xt(t,r,o)):jt&&(e||(e=jt()),e.set(r,o))}};return r}:jt)||jt||function(){var t,e={assert:function(t){if(!e.has(t))throw new c("Side channel does not contain "+y(t))},delete:function(e){var r=t&&t.next,o=function(t,e){if(t)return h(t,e,!0)}(t,e);return o&&r&&r===o&&(t=void 0),!!o},get:function(e){return function(t,e){if(t){var r=h(t,e);return r&&r.value}}(t,e)},has:function(e){return function(t,e){return!!t&&!!h(t,e)}(t,e)},set:function(e,r){t||(t={next:void 0}),function(t,e,r){var o=h(t,e);o?o.value=r:t.next={key:e,next:t.next,value:r}}(t,e,r)}};return e},Dt=function(){var t,e={assert:function(t){if(!e.has(t))throw new c("Side channel does not contain "+y(t))},delete:function(e){return!!t&&t.delete(e)},get:function(e){return t&&t.get(e)},has:function(e){return!!t&&t.has(e)},set:function(e,r){t||(t=It()),t.set(e,r)}};return e},Ct=String.prototype.replace,Ft=/%20/g,Nt={default:"RFC3986",formatters:{RFC1738:function(t){return Ct.call(t,Ft,"+")},RFC3986:function(t){return String(t)}},RFC1738:"RFC1738",RFC3986:"RFC3986"},Mt=Object.prototype.hasOwnProperty,Ut=Array.isArray,qt=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),Lt={combine:function(t,e){return[].concat(t,e)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],o=0;o1;){var e=t.pop(),r=e.obj[e.prop];if(Ut(r)){for(var o=[],n=0;n=1024?i.slice(s,s+1024):i,u=[],l=0;l=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||n===Nt.RFC1738&&(40===c||41===c)?u[u.length]=p.charAt(l):c<128?u[u.length]=qt[c]:c<2048?u[u.length]=qt[192|c>>6]+qt[128|63&c]:c<55296||c>=57344?u[u.length]=qt[224|c>>12]+qt[128|c>>6&63]+qt[128|63&c]:(l+=1,c=65536+((1023&c)<<10|1023&p.charCodeAt(l)),u[u.length]=qt[240|c>>18]+qt[128|c>>12&63]+qt[128|c>>6&63]+qt[128|63&c])}a+=u.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(Ut(t)){for(var r=[],o=0;o0?w.join(",")||null:void 0}];else if(Ht(l))O=l;else{var T=Object.keys(w);O=c?T.sort(c):T}var P=p?String(r).replace(/\./g,"%2E"):String(r),x=n&&Ht(w)&&1===w.length?P+"[]":P;if(i&&Ht(w)&&0===w.length)return x+"[]";for(var R=0;R0?y+f:""}),Yt={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};Yt.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)},Yt.mixin=(t,e)=>{for(const r in e)Yt.hasOwn(e,r)&&(t[r]=e[r])};var Zt;const{isObject:te,hasOwn:ee}=Yt;function re(){}Zt=re,re.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),clearTimeout(this._uploadTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,delete this._uploadTimeoutTimer,this},re.prototype.parse=function(t){return this._parser=t,this},re.prototype.responseType=function(t){return this._responseType=t,this},re.prototype.serialize=function(t){return this._serializer=t,this},re.prototype.timeout=function(t){if(!t||"object"!=typeof t)return this._timeout=t,this._responseTimeout=0,this._uploadTimeout=0,this;for(const e in t)if(ee(t,e))switch(e){case"deadline":this._timeout=t.deadline;break;case"response":this._responseTimeout=t.response;break;case"upload":this._uploadTimeout=t.upload;break;default:console.warn("Unknown timeout option",e)}return this},re.prototype.retry=function(t,e){return 0!==arguments.length&&!0!==t||(t=1),t<=0&&(t=0),this._maxRetries=t,this._retries=0,this._retryCallback=e,this};const oe=new Set(["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"]),ne=new Set([408,413,429,500,502,503,504,521,522,524]);re.prototype._shouldRetry=function(t,e){if(!this._maxRetries||this._retries++>=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&&ne.has(e.status))return!0;if(t){if(t.code&&oe.has(t.code))return!0;if(t.timeout&&"ECONNABORTED"===t.code)return!0;if(t.crossDomain)return!0}return!1},re.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()},re.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)},re.prototype.catch=function(t){return this.then(void 0,t)},re.prototype.use=function(t){return t(this),this},re.prototype.ok=function(t){if("function"!=typeof t)throw new Error("Callback required");return this._okCallback=t,this},re.prototype._isResponseOK=function(t){return!!t&&(this._okCallback?this._okCallback(t):t.status>=200&&t.status<300)},re.prototype.get=function(t){return this._header[t.toLowerCase()]},re.prototype.getHeader=re.prototype.get,re.prototype.set=function(t,e){if(te(t)){for(const e in t)ee(t,e)&&this.set(e,t[e]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},re.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},re.prototype.field=function(t,e,r){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(te(t)){for(const e in t)ee(t,e)&&this.field(e,t[e]);return this}if(Array.isArray(e)){for(const r in e)ee(e,r)&&this.field(t,e[r]);return this}if(null==e)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof e&&(e=String(e)),r?this._getFormData().append(t,e,r):this._getFormData().append(t,e),this},re.prototype.abort=function(){return this._aborted||(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort")),this},re.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},re.prototype.withCredentials=function(t){return void 0===t&&(t=!0),this._withCredentials=t,this},re.prototype.redirects=function(t){return this._maxRedirects=t,this},re.prototype.maxResponseSize=function(t){if("number"!=typeof t)throw new TypeError("Invalid argument");return this._maxResponseSize=t,this},re.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},re.prototype.send=function(t){const e=te(t);let r=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(e&&!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(e&&te(this._data))for(const o in t){if("bigint"==typeof t[o]&&!t[o].toJSON)throw new Error("Cannot serialize BigInt value to json");ee(t,o)&&(this._data[o]=t[o])}else{if("bigint"==typeof t)throw new Error("Cannot send value of type BigInt");"string"==typeof t?(r||this.type("form"),(r=this._header["content-type"])&&(r=r.toLowerCase().trim()),this._data="application/x-www-form-urlencoded"===r?this._data?`${this._data}&${t}`:t:(this._data||"")+t):this._data=t}return!e||this._isHost(t)||r||this.type("json"),this},re.prototype.sortQuery=function(t){return this._sort=void 0===t||t,this},re.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("&")}}},re.prototype._appendQueryString=()=>{console.warn("Unsupported")},re.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)},re.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))};var ie;function ae(){}ie=ae,ae.prototype.get=function(t){return this.header[t.toLowerCase()]},ae.prototype._setHeaderProperties=function(t){const e=t["content-type"]||"";this.type=Yt.type(e);const r=Yt.params(e);for(const n in r)Object.prototype.hasOwnProperty.call(r,n)&&(this[n]=r[n]);this.links={};try{t.link&&(this.links=Yt.parseLinks(t.link))}catch(o){}},ae.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 se=["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert","disableTLSCerts"];class pe{constructor(){this._defaults=[]}_setDefaults(t){for(const e of this._defaults)t[e.fn](...e.args)}}for(const je of se)pe.prototype[je]=function(...t){return this._defaults.push({fn:je,args:t}),this};var ue=pe,le={};let ce;"undefined"!=typeof window?ce=window:"undefined"==typeof self?(console.warn("Using browser-only version of superagent in non-browser environment"),ce=this):ce=self;const{isObject:fe,mixin:ye,hasOwn:he}=Yt;function de(){}const me=le=le=function(t,e){return"function"==typeof e?new le.Request("GET",t).end(e):1===arguments.length?new le.Request("GET",t):new le.Request(t,e)};le.Request=Ae,me.getXHR=()=>{if(ce.XMLHttpRequest)return new ce.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 be(t){if(!fe(t))return t;const e=[];for(const r in t)he(t,r)&&ve(e,r,t[r]);return e.join("&")}function ve(t,e,r){if(void 0!==r)if(null!==r)if(Array.isArray(r))for(const o of r)ve(t,e,o);else if(fe(r))for(const o in r)he(r,o)&&ve(t,`${e}[${o}]`,r[o]);else t.push(encodeURI(e)+"="+encodeURIComponent(r));else t.push(encodeURI(e))}function we(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 Se(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)})}me.serializeObject=be,me.parseString=we,me.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"},me.serialize={"application/x-www-form-urlencoded":t=>Xt(t,{indices:!1,strictNullHandling:!0}),"application/json":r},me.parse={"application/x-www-form-urlencoded":we,"application/json":JSON.parse},ye(Se.prototype,ie.prototype),Se.prototype._parseBody=function(t){let e=me.parse[this.type];return this.req._parser?this.req._parser(this,t):(!e&&_e(this.type)&&(e=me.parse["application/json"]),e&&t&&(t.length>0||t instanceof Object)?e(t):null)},Se.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},me.Response=Se,t(Ae.prototype),ye(Ae.prototype,Zt.prototype),Ae.prototype.type=function(t){return this.set("Content-Type",me.types[t]||t),this},Ae.prototype.accept=function(t){return this.set("Accept",me.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=be(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 ce.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||de,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=me.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||me.serialize[t?t.split(";")[0]:""];!e&&_e(t)&&(e=me.serialize["application/json"]),e&&(r=e(r))}for(const i in this.header)null!==this.header[i]&&he(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)},me.agent=()=>new ue;for(const je of["GET","POST","OPTIONS","PATCH","PUT","DELETE"])ue.prototype[je.toLowerCase()]=function(t,e){const r=new me.Request(je,t);return this._setDefaults(r),e&&r.end(e),r};function Ee(t,e,r){const o=me("DELETE",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o}return ue.prototype.del=ue.prototype.delete,me.get=(t,e,r)=>{const o=me("GET",t);return"function"==typeof e&&(r=e,e=null),e&&o.query(e),r&&o.end(r),o},me.head=(t,e,r)=>{const o=me("HEAD",t);return"function"==typeof e&&(r=e,e=null),e&&o.query(e),r&&o.end(r),o},me.options=(t,e,r)=>{const o=me("OPTIONS",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},me.del=Ee,me.delete=Ee,me.patch=(t,e,r)=>{const o=me("PATCH",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},me.post=(t,e,r)=>{const o=me("POST",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},me.put=(t,e,r)=>{const o=me("PUT",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},le}));