fitch
Version:
A lightweight Promise based HTTP client, using Fetch API.
2 lines • 21.9 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.fitch=e():t.fitch=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){function e(e,r){return t("GET",e,r)}function r(e,r){return t("POST",e,r)}function n(e,r){return t("PUT",e,r)}function i(e,r){return t("PATCH",e,r)}function u(e,r){return t("DELETE",e,r)}function c(t){return Promise.all(t)}function f(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.config,r=void 0===e?{}:e,n=t.interceptor,i=void 0===n?function(t){return t}:n,u=function(t,e,n){return(0,s.default)(t,e,(0,a.default)({},r,n)).then(i)};return o(u)}return{all:c,del:u,get:e,init:f,patch:i,post:r,put:n}}Object.defineProperty(e,"__esModule",{value:!0}),e.put=e.post=e.patch=e.init=e.get=e.del=e.all=void 0;var i=r(6),a=n(i),u=r(4),s=n(u),c=o(s.default);e.default=c;var f=c.all,l=c.del,h=c.get,d=c.init,p=c.patch,y=c.post,b=c.put;e.all=f,e.del=l,e.get=h,e.init=d,e.patch=p,e.post=y,e.put=b},function(t,e){"use strict";function r(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"json",r=["arrayBuffer","blob","formData","json","text"],n=r.indexOf(e)!==-1;if(t.ok&&n)return t[e]().then(function(e){return{data:e,status:t.status,statusText:t.statusText,headers:t.headers}});var o=n?t.status+" - "+t.statusText+".":"Invalid data type";throw new Error(o)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=r},function(t,e){"use strict";function r(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.body,n=e.cache,o=void 0===n?"default":n,i=e.credentials,a=e.headers,u=void 0===a?{"Content-Type":"application/json"}:a,s=e.integrity,c=e.mode,f=void 0===c?"cors":c,l=e.redirect,h=e.referrer,d=e.referrerPolicy,p=void 0;r&&(p=JSON.stringify(r));var y={body:p,cache:o,credentials:i,headers:u,method:t,mode:f,redirect:l,referrer:h};return s&&(y.integrity=s),d&&(y.referrerPolicy=d),y}Object.defineProperty(e,"__esModule",{value:!0}),e.default=r},function(t,e){"use strict";function r(t){var e=[];for(var r in t)({}).hasOwnProperty.call(t,r)&&e.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e.length?"?"+e.join("&"):""}Object.defineProperty(e,"__esModule",{value:!0}),e.default=r},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="";r.params&&(n=(0,s.default)(r.params));var o=(0,a.default)(t,r),i=fetch(e+n,o);return r.raw?i:i.then(function(t){return(0,f.default)(t,r.dataType)})}Object.defineProperty(e,"__esModule",{value:!0}),r(5);var i=r(2),a=n(i),u=r(3),s=n(u),c=r(1),f=n(c);e.default=o},function(t,e,r){r(8);var n="undefined"!=typeof self&&self||this;t.exports=n.fetch.bind(n)},function(t,e,r){(function(t,r){function n(t,e){return t.set(e[0],e[1]),t}function o(t,e){return t.add(e),t}function i(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function a(t,e){for(var r=-1,n=t?t.length:0;++r<n&&e(t[r],r,t)!==!1;);return t}function u(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}function s(t,e,r,n){var o=-1,i=t?t.length:0;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}function c(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function f(t){return function(e){return t(e)}}function l(t,e){return null==t?void 0:t[e]}function h(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function d(t){var e=-1,r=Array(t.size);return t.forEach(function(t,n){r[++e]=[n,t]}),r}function p(t,e){return function(r){return t(e(r))}}function y(t){var e=-1,r=Array(t.size);return t.forEach(function(t){r[++e]=t}),r}function b(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function v(){this.__data__=or?or(null):{}}function _(t){return this.has(t)&&delete this.__data__[t]}function m(t){var e=this.__data__;if(or){var r=e[t];return r===qt?void 0:r}return Me.call(e,t)?e[t]:void 0}function w(t){var e=this.__data__;return or?void 0!==e[t]:Me.call(e,t)}function g(t,e){var r=this.__data__;return r[t]=or&&void 0===e?qt:e,this}function j(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function A(){this.__data__=[]}function O(t){var e=this.__data__,r=N(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():We.call(e,r,1),!0}function x(t){var e=this.__data__,r=N(e,t);return r<0?void 0:e[r][1]}function P(t){return N(this.__data__,t)>-1}function T(t,e){var r=this.__data__,n=N(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}function B(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function E(){this.__data__={hash:new b,map:new(tr||j),string:new b}}function U(t){return yt(this,t).delete(t)}function S(t){return yt(this,t).get(t)}function I(t){return yt(this,t).has(t)}function R(t,e){return yt(this,t).set(t,e),this}function D(t){this.__data__=new j(t)}function F(){this.__data__=new j}function C(t){return this.__data__.delete(t)}function L(t){return this.__data__.get(t)}function M(t){return this.__data__.has(t)}function k(t,e){var r=this.__data__;if(r instanceof j){var n=r.__data__;if(!tr||n.length<Ht-1)return n.push([t,e]),this;r=this.__data__=new B(n)}return r.set(t,e),this}function $(t,e){var r=pr(t)||Bt(t)?c(t.length,String):[],n=r.length,o=!!n;for(var i in t)!e&&!Me.call(t,i)||o&&("length"==i||wt(i,n))||r.push(i);return r}function H(t,e,r){(void 0===r||Tt(t[e],r))&&("number"!=typeof e||void 0!==r||e in t)||(t[e]=r)}function q(t,e,r){var n=t[e];Me.call(t,e)&&Tt(n,r)&&(void 0!==r||e in t)||(t[e]=r)}function N(t,e){for(var r=t.length;r--;)if(Tt(t[r][0],e))return r;return-1}function G(t,e){return t&<(e,Lt(e),t)}function V(t,e,r,n,o,i,u){var s;if(n&&(s=i?n(t,o,i,u):n(t)),void 0!==s)return s;if(!Rt(t))return t;var c=pr(t);if(c){if(s=vt(t),!e)return ft(t,s)}else{var f=dr(t),l=f==Xt||f==Kt;if(yr(t))return rt(t,e);if(f==Zt||f==Gt||l&&!i){if(h(t))return i?t:{};if(s=_t(l?{}:t),!e)return ht(t,G(s,t))}else{if(!je[f])return i?t:{};s=mt(t,f,V,e)}}u||(u=new D);var d=u.get(t);if(d)return d;if(u.set(t,s),!c)var p=r?pt(t):Lt(t);return a(p||t,function(o,i){p&&(i=o,o=t[i]),q(s,i,V(o,e,r,n,i,t,u))}),s}function z(t){return Rt(t)?ze(t):{}}function J(t,e,r){var n=e(t);return pr(t)?n:u(n,r(t))}function W(t){return $e.call(t)}function X(t){if(!Rt(t)||At(t))return!1;var e=St(t)||h(t)?He:me;return e.test(Pt(t))}function K(t){return Dt(t)&&It(t.length)&&!!ge[$e.call(t)]}function Q(t){if(!Ot(t))return Qe(t);var e=[];for(var r in Object(t))Me.call(t,r)&&"constructor"!=r&&e.push(r);return e}function Y(t){if(!Rt(t))return xt(t);var e=Ot(t),r=[];for(var n in t)("constructor"!=n||!e&&Me.call(t,n))&&r.push(n);return r}function Z(t,e,r,n,o){if(t!==e){if(!pr(e)&&!br(e))var i=Y(e);a(i||e,function(a,u){if(i&&(u=a,a=e[u]),Rt(a))o||(o=new D),tt(t,e,u,r,Z,n,o);else{var s=n?n(t[u],a,u+"",t,e,o):void 0;void 0===s&&(s=a),H(t,u,s)}})}}function tt(t,e,r,n,o,i,a){var u=t[r],s=e[r],c=a.get(s);if(c)return void H(t,r,c);var f=i?i(u,s,r+"",t,e,a):void 0,l=void 0===f;l&&(f=s,pr(s)||br(s)?pr(u)?f=u:Ut(u)?f=ft(u):(l=!1,f=V(s,!0)):Ft(s)||Bt(s)?Bt(u)?f=Ct(u):!Rt(u)||n&&St(u)?(l=!1,f=V(s,!0)):f=u:l=!1),l&&(a.set(s,f),o(f,s,n,i,a),a.delete(s)),H(t,r,f)}function et(t,e){return e=Ye(void 0===e?t.length-1:e,0),function(){for(var r=arguments,n=-1,o=Ye(r.length-e,0),a=Array(o);++n<o;)a[n]=r[e+n];n=-1;for(var u=Array(e+1);++n<e;)u[n]=r[n];return u[e]=a,i(t,this,u)}}function rt(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}function nt(t){var e=new t.constructor(t.byteLength);return new Ge(e).set(new Ge(t)),e}function ot(t,e){var r=e?nt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}function it(t,e,r){var o=e?r(d(t),!0):d(t);return s(o,n,new t.constructor)}function at(t){var e=new t.constructor(t.source,_e.exec(t));return e.lastIndex=t.lastIndex,e}function ut(t,e,r){var n=e?r(y(t),!0):y(t);return s(n,o,new t.constructor)}function st(t){return lr?Object(lr.call(t)):{}}function ct(t,e){var r=e?nt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function ft(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}function lt(t,e,r,n){r||(r={});for(var o=-1,i=e.length;++o<i;){var a=e[o],u=n?n(r[a],t[a],a,r,t):void 0;q(r,a,void 0===u?t[a]:u)}return r}function ht(t,e){return lt(t,hr(t),e)}function dt(t){return et(function(e,r){var n=-1,o=r.length,i=o>1?r[o-1]:void 0,a=o>2?r[2]:void 0;for(i=t.length>3&&"function"==typeof i?(o--,i):void 0,a&>(r[0],r[1],a)&&(i=o<3?void 0:i,o=1),e=Object(e);++n<o;){var u=r[n];u&&t(e,u,n,i)}return e})}function pt(t){return J(t,Lt,hr)}function yt(t,e){var r=t.__data__;return jt(e)?r["string"==typeof e?"string":"hash"]:r.map}function bt(t,e){var r=l(t,e);return X(r)?r:void 0}function vt(t){var e=t.length,r=t.constructor(e);return e&&"string"==typeof t[0]&&Me.call(t,"index")&&(r.index=t.index,r.input=t.input),r}function _t(t){return"function"!=typeof t.constructor||Ot(t)?{}:z(Ve(t))}function mt(t,e,r,n){var o=t.constructor;switch(e){case ae:return nt(t);case zt:case Jt:return new o(+t);case ue:return ot(t,n);case se:case ce:case fe:case le:case he:case de:case pe:case ye:case be:return ct(t,n);case Qt:return it(t,n,r);case Yt:case ne:return new o(t);case ee:return at(t);case re:return ut(t,n,r);case oe:return st(t)}}function wt(t,e){return e=null==e?Nt:e,!!e&&("number"==typeof t||we.test(t))&&t>-1&&t%1==0&&t<e}function gt(t,e,r){if(!Rt(r))return!1;var n=typeof e;return!!("number"==n?Et(r)&&wt(e,r.length):"string"==n&&e in r)&&Tt(r[e],t)}function jt(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function At(t){return!!Ce&&Ce in t}function Ot(t){var e=t&&t.constructor,r="function"==typeof e&&e.prototype||De;return t===r}function xt(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}function Pt(t){if(null!=t){try{return Le.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Tt(t,e){return t===e||t!==t&&e!==e}function Bt(t){return Ut(t)&&Me.call(t,"callee")&&(!Je.call(t,"callee")||$e.call(t)==Gt)}function Et(t){return null!=t&&It(t.length)&&!St(t)}function Ut(t){return Dt(t)&&Et(t)}function St(t){var e=Rt(t)?$e.call(t):"";return e==Xt||e==Kt}function It(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=Nt}function Rt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Dt(t){return!!t&&"object"==typeof t}function Ft(t){if(!Dt(t)||$e.call(t)!=Zt||h(t))return!1;var e=Ve(t);if(null===e)return!0;var r=Me.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&Le.call(r)==ke}function Ct(t){return lt(t,Mt(t))}function Lt(t){return Et(t)?$(t):Q(t)}function Mt(t){return Et(t)?$(t,!0):Y(t)}function kt(){return[]}function $t(){return!1}var Ht=200,qt="__lodash_hash_undefined__",Nt=9007199254740991,Gt="[object Arguments]",Vt="[object Array]",zt="[object Boolean]",Jt="[object Date]",Wt="[object Error]",Xt="[object Function]",Kt="[object GeneratorFunction]",Qt="[object Map]",Yt="[object Number]",Zt="[object Object]",te="[object Promise]",ee="[object RegExp]",re="[object Set]",ne="[object String]",oe="[object Symbol]",ie="[object WeakMap]",ae="[object ArrayBuffer]",ue="[object DataView]",se="[object Float32Array]",ce="[object Float64Array]",fe="[object Int8Array]",le="[object Int16Array]",he="[object Int32Array]",de="[object Uint8Array]",pe="[object Uint8ClampedArray]",ye="[object Uint16Array]",be="[object Uint32Array]",ve=/[\\^$.*+?()[\]{}|]/g,_e=/\w*$/,me=/^\[object .+?Constructor\]$/,we=/^(?:0|[1-9]\d*)$/,ge={};ge[se]=ge[ce]=ge[fe]=ge[le]=ge[he]=ge[de]=ge[pe]=ge[ye]=ge[be]=!0,ge[Gt]=ge[Vt]=ge[ae]=ge[zt]=ge[ue]=ge[Jt]=ge[Wt]=ge[Xt]=ge[Qt]=ge[Yt]=ge[Zt]=ge[ee]=ge[re]=ge[ne]=ge[ie]=!1;var je={};je[Gt]=je[Vt]=je[ae]=je[ue]=je[zt]=je[Jt]=je[se]=je[ce]=je[fe]=je[le]=je[he]=je[Qt]=je[Yt]=je[Zt]=je[ee]=je[re]=je[ne]=je[oe]=je[de]=je[pe]=je[ye]=je[be]=!0,je[Wt]=je[Xt]=je[ie]=!1;var Ae="object"==typeof t&&t&&t.Object===Object&&t,Oe="object"==typeof self&&self&&self.Object===Object&&self,xe=Ae||Oe||Function("return this")(),Pe="object"==typeof e&&e&&!e.nodeType&&e,Te=Pe&&"object"==typeof r&&r&&!r.nodeType&&r,Be=Te&&Te.exports===Pe,Ee=Be&&Ae.process,Ue=function(){try{return Ee&&Ee.binding("util")}catch(t){}}(),Se=Ue&&Ue.isTypedArray,Ie=Array.prototype,Re=Function.prototype,De=Object.prototype,Fe=xe["__core-js_shared__"],Ce=function(){var t=/[^.]+$/.exec(Fe&&Fe.keys&&Fe.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Le=Re.toString,Me=De.hasOwnProperty,ke=Le.call(Object),$e=De.toString,He=RegExp("^"+Le.call(Me).replace(ve,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),qe=Be?xe.Buffer:void 0,Ne=xe.Symbol,Ge=xe.Uint8Array,Ve=p(Object.getPrototypeOf,Object),ze=Object.create,Je=De.propertyIsEnumerable,We=Ie.splice,Xe=Object.getOwnPropertySymbols,Ke=qe?qe.isBuffer:void 0,Qe=p(Object.keys,Object),Ye=Math.max,Ze=bt(xe,"DataView"),tr=bt(xe,"Map"),er=bt(xe,"Promise"),rr=bt(xe,"Set"),nr=bt(xe,"WeakMap"),or=bt(Object,"create"),ir=Pt(Ze),ar=Pt(tr),ur=Pt(er),sr=Pt(rr),cr=Pt(nr),fr=Ne?Ne.prototype:void 0,lr=fr?fr.valueOf:void 0;b.prototype.clear=v,b.prototype.delete=_,b.prototype.get=m,b.prototype.has=w,b.prototype.set=g,j.prototype.clear=A,j.prototype.delete=O,j.prototype.get=x,j.prototype.has=P,j.prototype.set=T,B.prototype.clear=E,B.prototype.delete=U,B.prototype.get=S,B.prototype.has=I,B.prototype.set=R,D.prototype.clear=F,D.prototype.delete=C,D.prototype.get=L,D.prototype.has=M,D.prototype.set=k;var hr=Xe?p(Xe,Object):kt,dr=W;(Ze&&dr(new Ze(new ArrayBuffer(1)))!=ue||tr&&dr(new tr)!=Qt||er&&dr(er.resolve())!=te||rr&&dr(new rr)!=re||nr&&dr(new nr)!=ie)&&(dr=function(t){var e=$e.call(t),r=e==Zt?t.constructor:void 0,n=r?Pt(r):void 0;if(n)switch(n){case ir:return ue;case ar:return Qt;case ur:return te;case sr:return re;case cr:return ie}return e});var pr=Array.isArray,yr=Ke||$t,br=Se?f(Se):K,vr=dt(function(t,e,r){Z(t,e,r)});r.exports=vr}).call(e,function(){return this}(),r(7)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){!function(t){"use strict";function e(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function r(t){return"string"!=typeof t&&(t=String(t)),t}function n(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return v.iterable&&(e[Symbol.iterator]=function(){return e}),e}function o(t){this.map={},t instanceof o?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function i(t){return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function a(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function u(t){var e=new FileReader,r=a(e);return e.readAsArrayBuffer(t),r}function s(t){var e=new FileReader,r=a(e);return e.readAsText(t),r}function c(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}function f(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function l(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"==typeof t)this._bodyText=t;else if(v.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(v.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(v.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(v.arrayBuffer&&v.blob&&m(t))this._bodyArrayBuffer=f(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!v.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!w(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=f(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):v.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},v.blob&&(this.blob=function(){var t=i(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?i(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(u)}),this.text=function(){var t=i(this);if(t)return t;if(this._bodyBlob)return s(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(c(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},v.formData&&(this.formData=function(){return this.text().then(p)}),this.json=function(){return this.text().then(JSON.parse)},this}function h(t){var e=t.toUpperCase();return g.indexOf(e)>-1?e:t}function d(t,e){e=e||{};var r=e.body;if(t instanceof d){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new o(t.headers)),this.method=t.method,this.mode=t.mode,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new o(e.headers)),this.method=h(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function p(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e}function y(t){var e=new o;return t.split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}}),e}function b(t,e){e||(e={}),this.type="default",this.status="status"in e?e.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new o(e.headers),this.url=e.url||"",this._initBody(t)}if(!t.fetch){var v={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(v.arrayBuffer)var _=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],m=function(t){return t&&DataView.prototype.isPrototypeOf(t)},w=ArrayBuffer.isView||function(t){return t&&_.indexOf(Object.prototype.toString.call(t))>-1};o.prototype.append=function(t,n){t=e(t),n=r(n);var o=this.map[t];this.map[t]=o?o+","+n:n},o.prototype.delete=function(t){delete this.map[e(t)]},o.prototype.get=function(t){return t=e(t),this.has(t)?this.map[t]:null},o.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},o.prototype.set=function(t,n){this.map[e(t)]=r(n)},o.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},o.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),n(t)},o.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),n(t)},o.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),n(t)},v.iterable&&(o.prototype[Symbol.iterator]=o.prototype.entries);var g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];d.prototype.clone=function(){return new d(this,{body:this._bodyInit})},l.call(d.prototype),l.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new o(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var j=[301,302,303,307,308];b.redirect=function(t,e){if(j.indexOf(e)===-1)throw new RangeError("Invalid status code");return new b(null,{status:e,headers:{location:t}})},t.Headers=o,t.Request=d,t.Response=b,t.fetch=function(t,e){return new Promise(function(r,n){var o=new d(t,e),i=new XMLHttpRequest;i.onload=function(){var t={status:i.status,statusText:i.statusText,headers:y(i.getAllResponseHeaders()||"")};t.url="responseURL"in i?i.responseURL:t.headers.get("X-Request-URL");var e="response"in i?i.response:i.responseText;r(new b(e,t))},i.onerror=function(){n(new TypeError("Network request failed"))},i.ontimeout=function(){n(new TypeError("Network request failed"))},i.open(o.method,o.url,!0),"include"===o.credentials&&(i.withCredentials=!0),"responseType"in i&&v.blob&&(i.responseType="blob"),o.headers.forEach(function(t,e){i.setRequestHeader(e,t)}),i.send("undefined"==typeof o._bodyInit?null:o._bodyInit)})},t.fetch.polyfill=!0}}("undefined"!=typeof self?self:this)}])});
//# sourceMappingURL=index.umd.min.js.map