enterprise-fetch 1.0.1 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1,3 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("cross-fetch")):"function"==typeof define&&define.amd?define(["exports","cross-fetch"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["enterprise-fetch-legacy"]={},t.fetch)}(this,(function(t,e){"use strict";function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=r(e);function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function a(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var r=[],n=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==u.return||u.return()}finally{if(o)throw i}}return r}}(t,e)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function c(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function s(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){c(i,n,o,a,u,"next",t)}function u(t){c(i,n,o,a,u,"throw",t)}a(void 0)}))}}function f(t){var e={exports:{}};return t(e,e.exports),e.exports}var p=f((function(t){var e=function(t){var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=e&&e.prototype instanceof v?e:v,i=Object.create(o.prototype),a=new L(n||[]);return i._invoke=function(t,e,r){var n=p;return function(o,i){if(n===l)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return k()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=E(a,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===p)throw n=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=l;var c=f(t,e,r);if("normal"===c.type){if(n=r.done?y:h,c.arg===m)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=y,r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",l="executing",y="completed",m={};function v(){}function d(){}function g(){}var b={};b[i]=function(){return this};var w=Object.getPrototypeOf,_=w&&w(w(P([])));_&&_!==r&&n.call(_,i)&&(b=_);var x=g.prototype=v.prototype=Object.create(b);function T(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function r(o,i,a,u){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,p=s.value;return p&&"object"==typeof p&&n.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(p).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,u)}))}u(c.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function E(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,E(t,r),"throw"===r.method))return m;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var o=f(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,m;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function P(t){if(t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}return{next:k}}function k(){return{value:e,done:!0}}return d.prototype=x.constructor=g,g.constructor=d,d.displayName=c(g,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,c(t,u,"GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},T(O.prototype),O.prototype[a]=function(){return this},t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new O(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},T(x),c(x,u,"Generator"),x[i]=function(){return this},x.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=P,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(S),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return u.type="throw",u.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:P(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));function h(t){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,e){for(var r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}var y=function(t,e,r){if(!t||"string"==typeof t)throw new TypeError("Please pass an Error to err-code");r||(r={}),"object"===h(e)&&(r=e,e=void 0),null!=e&&(r.code=e);try{return l(t,r)}catch(e){r.message=t.message,r.stack=t.stack;var n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),l(new n,r)}};function m(t,e){"boolean"==typeof e&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var v=m;m.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},m.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},m.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=(new Date).getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(void 0===r){if(!this._cachedTimeouts)return!1;this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift()}var n=this,o=setTimeout((function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout((function(){n._operationTimeoutCb(n._attempts)}),n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)}),r);return this._options.unref&&o.unref(),!0},m.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout((function(){r._operationTimeoutCb()}),r._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},m.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},m.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},m.prototype.start=m.prototype.try,m.prototype.errors=function(){return this._errors},m.prototype.attempts=function(){return this._attempts},m.prototype.mainError=function(){if(0===this._errors.length)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var o=this._errors[n],i=o.message,a=(t[i]||0)+1;t[i]=a,a>=r&&(e=o,r=a)}return e};var d=f((function(t,e){e.operation=function(t){var r=e.timeouts(t);return new v(r,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})},e.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],o=0;o<e.retries;o++)n.push(this.createTimeout(o,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(o,e)),n.sort((function(t,e){return t-e})),n},e.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*e.minTimeout*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout)},e.wrap=function(t,r,n){if(r instanceof Array&&(n=r,r=null),!n)for(var o in n=[],t)"function"==typeof t[o]&&n.push(o);for(var i=0;i<n.length;i++){var a=n[i],u=t[a];t[a]=function(n){var o=e.operation(r),i=Array.prototype.slice.call(arguments,1),a=i.pop();i.push((function(t){o.retry(t)||(t&&(arguments[0]=o.mainError()),a.apply(this,arguments))})),o.attempt((function(){n.apply(t,i)}))}.bind(t,u),t[a].options=r}}})),g=Object.prototype.hasOwnProperty;function b(t){return t&&"EPROMISERETRY"===t.code&&g.call(t,"retried")}var w=function(t,e){var r,n;return"object"==typeof t&&"function"==typeof e&&(r=e,e=t,t=r),n=d.operation(e),new Promise((function(e,r){n.attempt((function(o){Promise.resolve().then((function(){return t((function(t){throw b(t)&&(t=t.retried),y(new Error("Retrying"),"EPROMISERETRY",{retried:t})}),o)})).then(e,(function(t){b(t)&&(t=t.retried,n.retry(t||new Error))||r(t)}))}))}))},_="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0,x=_.AbortController,T=_.AbortSignal,O=x,E=T,j=x;function S(t,e){return t.then((function(t){return[null,t]})).catch((function(t){return e&&Object.assign(t,e),[t,void 0]}))}O.AbortSignal=E,O.default=j;var L,P={timeout:6e4,retry:{retries:3,minTimeout:400,factor:2},doRetry:(L=s(p.mark((function t(e,r,n){var o,i,a,u,c;return p.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=n.url,i=n.options,a=i.retry,u=void 0===a?P.retry:a,!(e<=u.retries)){t.next=7;break}if(c="".concat(e,"/").concat(u.retries),r.status&&!(r.status>=400&&404!==r.status)){t.next=7;break}return"message"in r?console.warn("[fetch] Attempt ".concat(c," ").concat(r.name,": ").concat(r.message," ").concat(o)):console.warn("[fetch] Attempt ".concat(c," ").concat(r.status,": ").concat(r.statusText," ").concat(o)),t.abrupt("return",!0);case 7:return t.abrupt("return",!1);case 8:case"end":return t.stop()}}),t)}))),function(t,e,r){return L.apply(this,arguments)})},k=function(){var t=s(p.mark((function t(){var e,r,n;return p.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e="undefined"!=typeof process&&process.env.http_proxy||!1)){t.next=8;break}return process.env.NODE_TLS_REJECT_UNAUTHORIZED="0",t.next=5,"https-proxy-agent";case 5:return r=t.sent,n=r.HttpsProxyAgent,t.abrupt("return",{agent:new n(e)});case 8:return t.abrupt("return",{});case 9:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),R=function(t){return"function"==typeof t};function A(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function N(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?A(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var I="undefined"!=typeof window?window.fetch:n.default,C=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:P,e=function(){var e=s(p.mark((function e(r){var n,o,i=arguments;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.length>1&&void 0!==i[1]?i[1]:{},e.next=3,w(function(){var e=s(p.mark((function e(o,i){var c,s,f,h,l,y,m,v,d,g,b,w;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===n.retry&&t.retry,c=n.timeout,s=void 0===c?t.timeout:c,f=n.doRetry,h=void 0===f?t.doRetry||P.doRetry:f,l=u(n,["retry","timeout","doRetry"]),y=s||t.timeout||6e4,m=new O,v=setTimeout((function(){m.abort()}),y),e.t0=S,e.t1=I,e.t2=r,e.t3=N,e.t4=N,e.t5=N({},l),e.next=12,k();case 12:return e.t6=e.sent,e.t7=(0,e.t4)(e.t5,e.t6),e.t8={},e.t9={signal:m.signal},e.t10=(0,e.t3)(e.t7,e.t8,e.t9),e.t11=(0,e.t1)(e.t2,e.t10),e.next=20,(0,e.t0)(e.t11);case 20:if(d=e.sent,g=a(d,2),b=g[0],w=g[1],!b){e.next=34;break}if(clearTimeout(v),e.t12=R(h),!e.t12){e.next=31;break}return e.next=30,h(i,b,{url:r,options:n});case 30:e.t12=e.sent;case 31:if(!e.t12){e.next=33;break}o(b);case 33:throw b;case 34:if(w.ok){e.next=44;break}if(clearTimeout(v),e.t13=R(h),!e.t13){e.next=41;break}return e.next=40,h(i,w,{url:r,options:n});case 40:e.t13=e.sent;case 41:if(!e.t13){e.next=43;break}o(w);case 43:return e.abrupt("return",w);case 44:return clearTimeout(v),e.abrupt("return",w);case 46:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),n.retry||t.retry);case 3:return o=e.sent,e.abrupt("return",o);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return e},D=C(P);t.default=D,t.fetchWithDefaults=C,Object.defineProperty(t,"__esModule",{value:!0})}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["enterprise-fetch-legacy"]={})}(this,function(t){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function r(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,r);if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==e(r)?r:r+""}function n(t,e,n){return(e=r(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,u,a=[],s=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e);else for(;!(s=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);s=!0);}catch(t){c=!0,o=t}finally{try{if(!s&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(c)throw o}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function a(t,e,r,n,o,i,u){try{var a=t[i](u),s=a.value}catch(t){return void r(t)}a.done?e(s):Promise.resolve(s).then(n,o)}function s(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function u(t){a(i,n,o,u,s,"next",t)}function s(t){a(i,n,o,u,s,"throw",t)}u(void 0)})}}function c(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var f,p={exports:{}},l={exports:{}};function y(){return f||(f=1,function(t){t.exports=function(t,e){this.v=t,this.k=e},t.exports.__esModule=!0,t.exports.default=t.exports}(l)),l.exports}var h,m,v={exports:{}},d={exports:{}};function x(){return h||(h=1,function(t){function e(r,n,o,i){var u=Object.defineProperty;try{u({},"",{})}catch(r){u=0}t.exports=e=function(t,r,n,o){function i(r,n){e(t,r,function(t){return this._invoke(r,n,t)})}r?u?u(t,r,{value:n,enumerable:!o,configurable:!o,writable:!o}):t[r]=n:(i("next",0),i("throw",1),i("return",2))},t.exports.__esModule=!0,t.exports.default=t.exports,e(r,n,o,i)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports}(d)),d.exports}function b(){return m||(m=1,function(t){var e=x();function r(){
2
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
3
+ var n,o,i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.toStringTag||"@@toStringTag";function s(t,r,i,u){var a=r&&r.prototype instanceof f?r:f,s=Object.create(a.prototype);return e(s,"_invoke",function(t,e,r){var i,u,a,s=0,f=r||[],p=!1,l={p:0,n:0,v:n,a:y,f:y.bind(n,4),d:function(t,e){return i=t,u=0,a=n,l.n=e,c}};function y(t,e){for(u=t,a=e,o=0;!p&&s&&!r&&o<f.length;o++){var r,i=f[o],y=l.p,h=i[2];t>3?(r=h===e)&&(a=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=n):i[0]<=y&&((r=t<2&&y<i[1])?(u=0,l.v=e,l.n=i[1]):y<h&&(r=t<3||i[0]>e||e>h)&&(i[4]=t,i[5]=e,l.n=h,u=0))}if(r||t>1)return c;throw p=!0,e}return function(r,f,h){if(s>1)throw TypeError("Generator is already running");for(p&&1===f&&y(f,h),u=f,a=h;(o=u<2?n:a)||!p;){i||(u?u<3?(u>1&&(l.n=-1),y(u,a)):l.n=a:l.v=a);try{if(s=2,i){if(u||(r="next"),o=i[r]){if(!(o=o.call(i,a)))throw TypeError("iterator result is not an object");if(!o.done)return o;a=o.value,u<2&&(u=0)}else 1===u&&(o=i.return)&&o.call(i),u<2&&(a=TypeError("The iterator does not provide a '"+r+"' method"),u=1);i=n}else if((o=(p=l.n<0)?a:t.call(e,l))!==c)break}catch(t){i=n,u=1,a=t}finally{s=1}}return{value:o,done:p}}}(t,i,u),!0),s}var c={};function f(){}function p(){}function l(){}o=Object.getPrototypeOf;var y=[][u]?o(o([][u]())):(e(o={},u,function(){return this}),o),h=l.prototype=f.prototype=Object.create(y);function m(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,e(t,a,"GeneratorFunction")),t.prototype=Object.create(h),t}return p.prototype=l,e(h,"constructor",l),e(l,"constructor",p),p.displayName="GeneratorFunction",e(l,a,"GeneratorFunction"),e(h),e(h,a,"Generator"),e(h,u,function(){return this}),e(h,"toString",function(){return"[object Generator]"}),(t.exports=r=function(){return{w:s,m:m}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}(v)),v.exports}var _,g,w,T={exports:{}},O={exports:{}},j={exports:{}};function S(){return _||(_=1,function(t){var e=y(),r=x();t.exports=function t(n,o){function i(t,r,u,a){try{var s=n[t](r),c=s.value;return c instanceof e?o.resolve(c.v).then(function(t){i("next",t,u,a)},function(t){i("throw",t,u,a)}):o.resolve(c).then(function(t){s.value=t,u(s)},function(t){return i("throw",t,u,a)})}catch(t){a(t)}}var u;this.next||(r(t.prototype),r(t.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),r(this,"_invoke",function(t,e,r){function n(){return new o(function(e,n){i(t,r,e,n)})}return u=u?u.then(n,n):n()},!0)},t.exports.__esModule=!0,t.exports.default=t.exports}(j)),j.exports}function P(){return g||(g=1,function(t){var e=b(),r=S();t.exports=function(t,n,o,i,u){return new r(e().w(t,n,o,i),u||Promise)},t.exports.__esModule=!0,t.exports.default=t.exports}(O)),O.exports}function k(){return w||(w=1,function(t){var e=P();t.exports=function(t,r,n,o,i){var u=e(t,r,n,o,i);return u.next().then(function(t){return t.done?t.value:u.next()})},t.exports.__esModule=!0,t.exports.default=t.exports}(T)),T.exports}var E,R={exports:{}};function M(){return E||(E=1,function(t){t.exports=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},t.exports.__esModule=!0,t.exports.default=t.exports}(R)),R.exports}var A,N,I,C,D,F={exports:{}},G={exports:{}};function U(){return A||(A=1,function(t){function e(r){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports}(G)),G.exports}function H(){return N||(N=1,function(t){var e=U().default;t.exports=function(t){if(null!=t){var r=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}throw new TypeError(e(t)+" is not iterable")},t.exports.__esModule=!0,t.exports.default=t.exports}(F)),F.exports}var J,Y=function(){if(D)return C;D=1;var t=(I||(I=1,function(t){var e=y(),r=b(),n=k(),o=P(),i=S(),u=M(),a=H();function s(){var c=r(),f=c.m(s),p=(Object.getPrototypeOf?Object.getPrototypeOf(f):f.__proto__).constructor;function l(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))}var y={throw:1,return:2,break:3,continue:3};function h(t){var e,r;return function(n){e||(e={stop:function(){return r(n.a,2)},catch:function(){return n.v},abrupt:function(t,e){return r(n.a,y[t],e)},delegateYield:function(t,o,i){return e.resultName=o,r(n.d,a(t),i)},finish:function(t){return r(n.f,t)}},r=function(t,r,o){n.p=e.prev,n.n=e.next;try{return t(r,o)}finally{e.next=n.n}}),e.resultName&&(e[e.resultName]=n.v,e.resultName=void 0),e.sent=n.v,e.next=n.n;try{return t.call(this,e)}finally{n.p=e.prev,n.n=e.next}}}return(t.exports=s=function(){return{wrap:function(t,e,r,n){return c.w(h(t),e,r,n&&n.reverse())},isGeneratorFunction:l,mark:c.m,awrap:function(t,r){return new e(t,r)},AsyncIterator:i,async:function(t,e,r,i,u){return(l(e)?o:n)(h(t),e,r,i,u)},keys:u,values:a}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}(p)),p.exports)();C=t;try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}return C}(),z=c(Y),L={exports:{}};var W,Z,$=function(){if(J)return L.exports;J=1;var t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0,e=t.AbortController,r=t.AbortSignal;return L.exports=e,L.exports.AbortSignal=r,L.exports.default=e,L.exports}(),q=c($);function B(t,e){return t.then(function(t){return[null,t]}).catch(function(t){return e&&Object.assign(t,e),[t,void 0]})}var K,Q,V,X,tt,et,rt,nt={};function ot(){return V||(V=1,function(t){var e=function(){if(Q)return K;function t(t,e){"boolean"==typeof e&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}return Q=1,K=t,t.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},t.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},t.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=(new Date).getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(void 0===r){if(!this._cachedTimeouts)return!1;this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift()}var n=this,o=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r);return this._options.unref&&o.unref(),!0},t.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},t.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},t.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},t.prototype.start=t.prototype.try,t.prototype.errors=function(){return this._errors},t.prototype.attempts=function(){return this._attempts},t.prototype.mainError=function(){if(0===this._errors.length)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var o=this._errors[n],i=o.message,u=(t[i]||0)+1;t[i]=u,u>=r&&(e=o,r=u)}return e},K}();t.operation=function(r){var n=t.timeouts(r);return new e(n,{forever:r&&r.forever,unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},t.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],o=0;o<e.retries;o++)n.push(this.createTimeout(o,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(o,e)),n.sort(function(t,e){return t-e}),n},t.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*e.minTimeout*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout)},t.wrap=function(e,r,n){if(r instanceof Array&&(n=r,r=null),!n)for(var o in n=[],e)"function"==typeof e[o]&&n.push(o);for(var i=0;i<n.length;i++){var u=n[i],a=e[u];e[u]=function(n){var o=t.operation(r),i=Array.prototype.slice.call(arguments,1),u=i.pop();i.push(function(t){o.retry(t)||(t&&(arguments[0]=o.mainError()),u.apply(this,arguments))}),o.attempt(function(){n.apply(e,i)})}.bind(e,a),e[u].options=r}}}(nt)),nt}function it(){return tt?X:(tt=1,X=ot())}var ut,at=function(){if(rt)return et;rt=1;var t=function(){if(Z)return W;function t(t,e){for(var r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}return Z=1,W=function(r,n,o){if(!r||"string"==typeof r)throw new TypeError("Please pass an Error to err-code");o||(o={}),"object"===e(n)&&(o=n,n=void 0),null!=n&&(o.code=n);try{return t(r,o)}catch(e){o.message=r.message,o.stack=r.stack;var i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(r)),t(new i,o)}}}(),r=it(),n=Object.prototype.hasOwnProperty;function o(t){return t&&"EPROMISERETRY"===t.code&&n.call(t,"retried")}return et=function(e,n){var i,u;return"object"==typeof e&&"function"==typeof n&&(i=n,n=e,e=i),u=r.operation(n),new Promise(function(r,n){u.attempt(function(i){Promise.resolve().then(function(){return e(function(e){throw o(e)&&(e=e.retried),t(new Error("Retrying"),"EPROMISERETRY",{retried:e})},i)}).then(r,function(t){o(t)&&(t=t.retried,u.retry(t||new Error))||n(t)})})})}}(),st=c(at),ct={timeout:6e4,retry:{retries:3,minTimeout:400,factor:2},doRetry:(ut=s(z.mark(function t(e,r,n){var o,i,u,a,s;return z.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(o=n.url,i=n.options,u=i.retry,a=void 0===u?ct.retry:u,!(e<=a.retries)){t.next=1;break}if(s="".concat(e,"/").concat(a.retries),r.status&&!(r.status>=400&&404!==r.status)){t.next=1;break}return"message"in r?console.warn("[fetch] Attempt ".concat(s," ").concat(r.name,": ").concat(r.message," ").concat(o)):console.warn("[fetch] Attempt ".concat(s," ").concat(r.status,": ").concat(r.statusText," ").concat(o)),t.abrupt("return",!0);case 1:return t.abrupt("return",!1);case 2:case"end":return t.stop()}},t)})),function(t,e,r){return ut.apply(this,arguments)})},ft=function(){return"undefined"!=typeof window},pt=function(){return!ft()&&(globalThis.fallbackFetch||"function"!=typeof globalThis.fetch?"node-fetch":"node")},lt=function(){var t=s(z.mark(function t(){var e;return z.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e=pt()){t.next=1;break}return t.abrupt("return",window.fetch);case 1:if("node"===e){t.next=3;break}return globalThis.fallbackFetch=!0,t.next=2,"node-fetch";case 2:globalThis.fetch=t.sent.default;case 3:return t.abrupt("return",globalThis.fetch);case 4:case"end":return t.stop()}},t)}));return function(){return t.apply(this,arguments)}}(),yt=function(){var t=s(z.mark(function t(){var e,r,n,o,i;return z.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e=!ft()&&process.env.http_proxy)){t.next=4;break}if(process.env.NODE_TLS_REJECT_UNAUTHORIZED="0",!globalThis.fallbackFetch){t.next=2;break}return t.next=1,"https-proxy-agent";case 1:return r=t.sent,n=r.HttpsProxyAgent,t.abrupt("return",{agent:new n(e)});case 2:return t.next=3,"undici";case 3:return o=t.sent,i=o.EnvHttpProxyAgent,t.abrupt("return",{dispatcher:new i});case 4:return t.abrupt("return",{});case 5:case"end":return t.stop()}},t)}));return function(){return t.apply(this,arguments)}}(),ht=function(t){return"function"==typeof t},mt=["retry","timeout","doRetry"];function vt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function dt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?vt(Object(r),!0).forEach(function(e){n(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vt(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}var xt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ct,e=function(){var e=s(z.mark(function e(r){var n,o,a,c=arguments;return z.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=c.length>1&&void 0!==c[1]?c[1]:{},e.next=1,lt();case 1:return o=e.sent,e.next=2,st(function(){var e=s(z.mark(function e(a,s){var c,f,p,l,y,h,m,v,d,x,b,_,g,w,T,O,j,S,P,k;return z.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===n.retry&&t.retry,c=n.timeout,f=void 0===c?t.timeout:c,p=n.doRetry,l=void 0===p?t.doRetry||ct.doRetry:p,y=u(n,mt),h=f||t.timeout||6e4,m=new q,v=setTimeout(function(){m.abort()},h),g=B,w=o,T=r,O=dt,j=dt,S=dt({},y),e.next=1,yt();case 1:return e.next=2,g(w(T,O(j(S,e.sent),{},{signal:m.signal})));case 2:if(d=e.sent,x=i(d,2),b=x[0],_=x[1],!b){e.next=6;break}if(clearTimeout(v),!(P=ht(l))){e.next=4;break}return e.next=3,l(s,b,{url:r.toString(),options:n});case 3:P=e.sent;case 4:if(!P){e.next=5;break}a(b);case 5:throw b;case 6:if(_.ok){e.next=10;break}if(clearTimeout(v),!(k=ht(l))){e.next=8;break}return e.next=7,l(s,_,{url:r.toString(),options:n});case 7:k=e.sent;case 8:if(!k){e.next=9;break}a(_);case 9:return e.abrupt("return",_);case 10:return clearTimeout(v),e.abrupt("return",_);case 11:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}(),n.retry||t.retry);case 2:return a=e.sent,e.abrupt("return",a);case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}();return e},bt=xt(ct);t.default=bt,t.fetch=bt,t.fetchWithDefaults=xt,Object.defineProperty(t,"__esModule",{value:!0})});