/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/gretchen@1.5.1/dist/gretchen.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
function t(){return(t=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,n(t,e)}function r(t){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function n(t,e){return(n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function o(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function u(t,e,r){return(u=o()?Reflect.construct:function(t,e,r){var o=[null];o.push.apply(o,e);var u=new(Function.bind.apply(t,o));return r&&n(u,r.prototype),u}).apply(null,arguments)}function c(t){var e="function"==typeof Map?new Map:void 0;return(c=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,o)}function o(){return u(t,arguments,r(this).constructor)}return o.prototype=Object.create(t.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),n(o,t)})(t)}var i=function(t){function r(e){var r;return(r=t.call(this,e.statusText)||this).name="HTTPError",r.status=e.status,r.url=e.url,r}return e(r,t),r}(c(Error)),a=function(t){function r(){var e;return(e=t.call(this,"Request timed out")||this).name="HTTPTimeout",e}return e(r,t),r}(c(Error)),f=function e(r,n,o){try{return Promise.resolve(r()).then(function(u){var c,i=u.status,f=u.headers.get("Retry-After"),l=t({},s,o),p=l.attempts,h=l.codes,d=l.methods,v=l.delay,y=h.indexOf(i)>-1||i>=500&&i<600,m=d.indexOf(n)>-1,b=function(){if(y&&m)return 0===p||u instanceof a?(c=1,u):Promise.resolve(new Promise(function(t){setTimeout(t,f?1e3*parseInt(f,10):v)})).then(function(){return c=1,e(r,n,{attempts:p-1,codes:h,methods:d,delay:v*v})})}();return b&&b.then?b.then(function(t){return c?t:u}):c?b:u})}catch(t){return Promise.reject(t)}},s={attempts:2,codes:[408,413,429],methods:["GET"],delay:6},l=/https?:\/\//;function p(t){var e={};return t.forEach(function(t,r){e[r]=t}),e}function h(e,r){void 0===e&&(e={}),void 0===r&&(r={});for(var n=t({},e),o=0,u=Object.keys(r);o<u.length;o++){var c=u[o],i=r[c];n[c]="object"==typeof i?"headers"===c?h(p(new Headers(e[c])),p(new Headers(i))):i.pop&&e[c].pop?[].concat(e[c]||[],i):"object"!=typeof e[c]||e[c].pop?i:h(e[c],i):i}return n}var d=["method","baseURL","json","retry","timeout","hooks"];function v(e,r){void 0===r&&(r={});var n=r.method,o=void 0===n?"GET":n,u=r.baseURL,c=r.json,p=r.retry,h=void 0===p?s:p,v=r.timeout,y=void 0===v?1e4:v,m=r.hooks,b=void 0===m?{}:m,O=t({method:o,headers:{}},function(t,e){if(null==t)return{};var r,n,o={},u=Object.keys(t);for(n=0;n<u.length;n++)e.indexOf(r=u[n])>=0||(o[r]=t[r]);return o}(r,d)),P="undefined"!=typeof AbortController?new AbortController:null;P&&(O.signal=P.signal),c&&(O.headers=t({"Content-Type":"application/json"},O.headers),O.body=JSON.stringify(c));var j=void 0!==u?function(t,e){var r=e.baseURL;if(l.test(t)||!r)return t;var n=(r.match(l)||[""])[0];return n+((r.replace(n,"")+"/").replace(/\/\//,"/")+t).replace(/\/\//,"/")}(e,{baseURL:u}):e,g=new Request(j,O);b.before&&[].concat(b.before).forEach(function(t){return t(g,r)});var w=function(){return y?function(t,e,r){void 0===e&&(e=1e4);try{return Promise.resolve(new Promise(function(n,o){var u=setTimeout(function(){r&&r.abort(),o(new a)},e);t.then(n).catch(o).then(function(){return clearTimeout(u)})}))}catch(t){return Promise.reject(t)}}(fetch(g),y,P):fetch(g)},T=!1===h?w():f(w,o,h),R={flush:function(){try{return Promise.resolve(T).then(function(t){return{url:j,status:t.status,response:t}})}catch(t){return Promise.reject(t)}}};return["json","text","formData","arrayBuffer","blob"].forEach(function(e){R[e]=function(){try{var n,o,u,c,a=function(){var e={url:j,status:f,data:c,error:u,response:n};return b.after&&[].concat(b.after).forEach(function(n){return n(t({},e),r)}),e},f=500,s=function(t,r){try{var a=Promise.resolve(T).then(function(t){function r(){n.ok?c=o:u=o||new i(n)}f=(n=t).status||500;var a=function(){if(204!==f)return Promise.resolve(n[e]()).then(function(t){o=t})}();return a&&a.then?a.then(r):r()})}catch(t){return r(t)}return a&&a.then?a.then(void 0,r):a}(0,function(t){u=t||"You tried to make fetch happen, but it didn't."});return Promise.resolve(s&&s.then?s.then(a):a())}catch(t){return Promise.reject(t)}}}),R}exports.create=function(t){return void 0===t&&(t={}),function(e,r){return void 0===r&&(r={}),v(e,h(t,r))}},exports.gretch=v;
//# sourceMappingURL=gretchen.js.map
