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AAOG,EAAU,KAAME,E,MAEpClB,GACiB,iBAAVO,GAEDP,aAAqB3J,OACtB2J,EAAUmB,SAASb,GAOxBzC,EAASgD,OAAOG,EAAST,GAJX,OAAVA,GACAN,EAAgBM,EAAOP,EAAWnC,EAAU,OAAIkD,GAAS,CAAET,IAKvE,IAEOzC,CACX,CAEA,SAAS2C,EAAiBF,EAAaC,GACnC,OAAOa,mBAAmBd,GACtB,IACAc,mBACqB,iBAAVb,EACHV,KAAKC,UAAUS,GACf,GAAKA,EAErB,CCrXA,IAAM7G,EAAUG,EAASH,QACzBA,EAAiB,QAAIG,EAASH,QAuB9B,S","sources":["webpack:///./node_modules/wretch/src/mix.ts","webpack:///./node_modules/wretch/src/config.ts","webpack:///./node_modules/wretch/src/perfs.ts","webpack:///./node_modules/wretch/src/middleware.ts","webpack:///./node_modules/wretch/src/resolver.ts","webpack:///./node_modules/wretch/src/wretcher.ts","webpack:///./node_modules/wretch/src/index.ts"],"sourcesContent":["export const mix = function (one: object, two: object, mergeArrays: boolean = false) {\n if(!one || !two || typeof one !== \"object\" || typeof two !== \"object\")\n return one\n\n const clone = { ...one }\n for(const prop in two) {\n if(two.hasOwnProperty(prop)) {\n if(two[prop] instanceof Array && one[prop] instanceof Array) {\n clone[prop] = mergeArrays ? [ ...one[prop], ...two[prop] ] : two[prop]\n } else if(typeof two[prop] === \"object\" && typeof one[prop] === \"object\") {\n clone[prop] = mix(one[prop], two[prop], mergeArrays)\n } else {\n clone[prop] = two[prop]\n }\n }\n }\n\n return clone\n}\n","declare const global\n\nconst config = {\n // Default options\n defaults: {},\n // Error type\n errorType: null,\n // Polyfills\n polyfills: {\n fetch: null,\n FormData: null,\n URLSearchParams: null,\n performance: null,\n PerformanceObserver: null,\n AbortController: null\n },\n polyfill(p: string, { doThrow = true, instance = false } = {}, ...args) {\n const res = this.polyfills[p] ||\n (typeof self !== \"undefined\" ? self[p] : null) ||\n (typeof global !== \"undefined\" ? global[p] : null)\n if(doThrow && !res) throw new Error(p + \" is not defined\")\n return instance && res ? new res(...args) : res\n }\n}\n\nexport default config\n","import conf from \"./config\"\n\nconst onMatch = (entries, name, callback, _performance) => {\n if(!entries.getEntriesByName)\n return false\n const matches = entries.getEntriesByName(name)\n if(matches && matches.length > 0) {\n callback(matches.reverse()[0])\n if(_performance.clearMeasures)\n _performance.clearMeasures(name)\n perfs.callbacks.delete(name)\n\n if(perfs.callbacks.size < 1) {\n perfs.observer.disconnect()\n if(_performance.clearResourceTimings) {\n _performance.clearResourceTimings()\n }\n }\n return true\n }\n return false\n}\n\nconst lazyObserver = (_performance, _observer) => {\n if(!perfs.observer && _performance && _observer) {\n perfs.observer = new _observer(entries => {\n perfs.callbacks.forEach((callback, name) => {\n onMatch(entries, name, callback, _performance)\n })\n })\n if(_performance.clearResourceTimings)\n _performance.clearResourceTimings()\n }\n return perfs.observer\n}\n\nconst perfs = {\n callbacks: new Map(),\n observer: null,\n observe: (name, callback) => {\n if(!name || !callback)\n return\n\n const _performance = conf.polyfill(\"performance\", { doThrow: false })\n const _observer = conf.polyfill(\"PerformanceObserver\", { doThrow: false })\n\n if(!lazyObserver(_performance, _observer))\n return\n\n if(!onMatch(_performance, name, callback, _performance)) {\n if(perfs.callbacks.size < 1)\n perfs.observer.observe({ entryTypes: [\"resource\", \"measure\"] })\n perfs.callbacks.set(name, callback)\n }\n\n }\n}\n\nexport default perfs\n","import { WretcherOptions } from \"./wretcher\"\nimport { WretcherResponse } from \"./resolver\"\n\nexport type Middleware = (options?: {[key: string]: any}) => ConfiguredMiddleware\nexport type ConfiguredMiddleware = (next: FetchLike) => FetchLike\nexport type FetchLike = (url: string, opts: WretcherOptions) => Promise<WretcherResponse>\n\nexport const middlewareHelper = (middlewares: ConfiguredMiddleware[]) => (fetchFunction: FetchLike): FetchLike => {\n return (\n middlewares.length === 0 ?\n fetchFunction :\n middlewares.length === 1 ?\n middlewares[0](fetchFunction) :\n middlewares.reduceRight((acc, curr, idx): any =>\n (idx === middlewares.length - 2) ? curr(acc(fetchFunction)) : curr(acc as any)\n )\n ) as FetchLike\n}\n","import { Wretcher } from \"./wretcher\"\nimport { mix } from \"./mix\"\nimport conf from \"./config\"\nimport perfs from \"./perfs\"\nimport { middlewareHelper } from \"./middleware\"\n\nexport type WretcherError = Error & { status: number, response: WretcherResponse, text?: string, json?: any }\nexport type WretcherErrorCallback = (error: WretcherError, originalRequest: Wretcher) => any\nexport type WretcherResponse = Response & { [key: string]: any }\nexport type ResponseChain = {\n // Response types\n res: <Result = WretcherResponse>(cb?: (type: WretcherResponse) => Result) => Promise<Result>,\n json: <Result = {[key: string]: any}>(cb?: (type: {[key: string]: any}) => Result) => Promise<Result>,\n blob: <Result = Blob>(cb?: (type: Blob) => Result) => Promise<Result>,\n formData: <Result = FormData>(cb?: (type: FormData) => Result) => Promise<Result>,\n arrayBuffer: <Result = ArrayBuffer>(cb?: (type: ArrayBuffer) => Result) => Promise<Result>,\n text: <Result = string>(cb?: (type: string) => Result) => Promise<Result>,\n // Extras\n perfs: (cb?: (timing: any) => void) => ResponseChain,\n setTimeout: (time: number, controller?: AbortController) => ResponseChain,\n controller: () => [any, ResponseChain],\n // Catchers\n error: (code: (number | string), cb: WretcherErrorCallback) => ResponseChain,\n badRequest: (cb: WretcherErrorCallback) => ResponseChain,\n unauthorized: (cb: WretcherErrorCallback) => ResponseChain,\n forbidden: (cb: WretcherErrorCallback) => ResponseChain,\n notFound: (cb: WretcherErrorCallback) => ResponseChain,\n timeout: (cb: WretcherErrorCallback) => ResponseChain,\n internalError: (cb: WretcherErrorCallback) => ResponseChain,\n fetchError: (cb: WretcherErrorCallback) => ResponseChain,\n onAbort: (cb: WretcherErrorCallback) => ResponseChain\n}\n\nclass WretchErrorWrapper {\n constructor(public error: any) {}\n}\n\nexport const resolver = (wretcher: Wretcher) => {\n const {\n _url: url,\n _catchers: _catchers,\n _resolvers: resolvers,\n _middlewares: middlewares,\n _options: opts\n } = wretcher\n const catchers = new Map(_catchers)\n const finalOptions = mix(conf.defaults, opts)\n const fetchController = conf.polyfill(\"AbortController\", { doThrow: false, instance: true })\n if(!finalOptions[\"signal\"] && fetchController) {\n finalOptions[\"signal\"] = fetchController.signal\n }\n // Request timeout\n const timeout = {\n ref: null,\n clear() {\n if(timeout.ref) {\n clearTimeout(timeout.ref)\n timeout.ref = null\n }\n }\n }\n // The generated fetch request\n const fetchRequest = middlewareHelper(middlewares)(conf.polyfill(\"fetch\"))(url, finalOptions)\n // Throws on an http error\n const throwingPromise: Promise<void | WretcherResponse> = fetchRequest\n .catch(error => {\n throw new WretchErrorWrapper(error)\n })\n .then(response => {\n timeout.clear()\n if (!response.ok) {\n return response[conf.errorType || \"text\"]().then(msg => {\n // Enhances the error object\n const err = new Error(msg)\n err[conf.errorType || \"text\"] = msg\n err[\"status\"] = response.status\n err[\"response\"] = response\n throw err\n })\n }\n return response\n })\n // Wraps the Promise in order to dispatch the error to a matching catcher\n const catchersWrapper = <T>(promise: Promise<T>): Promise<void | T> => {\n return promise.catch(err => {\n timeout.clear()\n const error = err instanceof WretchErrorWrapper ? err.error : err\n if(err instanceof WretchErrorWrapper && catchers.has(\"__fromFetch\"))\n return catchers.get(\"__fromFetch\")(error, wretcher)\n else if(catchers.has(error.status))\n return catchers.get(error.status)(error, wretcher)\n else if(catchers.has(error.name))\n return catchers.get(error.name)(error, wretcher)\n else\n throw error\n })\n }\n // Enforces the proper promise type when a body parsing method is called.\n type BodyParser = <Type>(funName: string | null) => <Result = void>(cb?: (type: Type) => Result) => Promise<Result>\n const bodyParser: BodyParser = <T>(funName) => <R>(cb) => funName ?\n // If a callback is provided, then callback with the body result otherwise return the parsed body itself.\n catchersWrapper(throwingPromise.then(_ => _ && _[funName]()).then(_ => cb ? cb(_) : _)) :\n // No body parsing method - return the response\n catchersWrapper(throwingPromise.then(_ => cb ? cb(_) : _))\n\n const responseChain: ResponseChain = {\n /**\n * Retrieves the raw result as a promise.\n */\n res: bodyParser<WretcherResponse>(null),\n /**\n * Retrieves the result as a parsed JSON object.\n */\n json: bodyParser<any>(\"json\"),\n /**\n * Retrieves the result as a Blob object.\n */\n blob: bodyParser<Blob>(\"blob\"),\n /**\n * Retrieves the result as a FormData object.\n */\n formData: bodyParser<FormData>(\"formData\"),\n /**\n * Retrieves the result as an ArrayBuffer object.\n */\n arrayBuffer: bodyParser<ArrayBuffer>(\"arrayBuffer\"),\n /**\n * Retrieves the result as a string.\n */\n text: bodyParser<string>(\"text\"),\n /**\n * Performs a callback on the API performance timings of the request.\n *\n * Warning: Still experimental on browsers and node.js\n */\n perfs: cb => {\n fetchRequest.then(res => perfs.observe(res.url, cb))\n return responseChain\n },\n /**\n * Aborts the request after a fixed time.\n *\n * @param time Time in milliseconds\n * @param controller A custom controller\n */\n setTimeout: (time, controller = fetchController) => {\n timeout.clear()\n timeout.ref = setTimeout(() => controller.abort(), time)\n return responseChain\n },\n /**\n * Returns the automatically generated AbortController alongside the current wretch response as a pair.\n */\n controller: () => [ fetchController, responseChain ],\n /**\n * Catches an http response with a specific error code or name and performs a callback.\n */\n error(errorId, cb) {\n catchers.set(errorId, cb)\n return responseChain\n },\n /**\n * Catches a bad request (http code 400) and performs a callback.\n */\n badRequest: cb => responseChain.error(400, cb),\n /**\n * Catches an unauthorized request (http code 401) and performs a callback.\n */\n unauthorized: cb => responseChain.error(401, cb),\n /**\n * Catches a forbidden request (http code 403) and performs a callback.\n */\n forbidden: cb => responseChain.error(403, cb),\n /**\n * Catches a \"not found\" request (http code 404) and performs a callback.\n */\n notFound: cb => responseChain.error(404, cb),\n /**\n * Catches a timeout (http code 408) and performs a callback.\n */\n timeout: cb => responseChain.error(408, cb),\n /**\n * Catches an internal server error (http code 500) and performs a callback.\n */\n internalError: cb => responseChain.error(500, cb),\n /**\n * Catches errors thrown when calling the fetch function and performs a callback.\n */\n fetchError: cb => responseChain.error(\"__fromFetch\", cb),\n /**\n * Catches an AbortError and performs a callback.\n */\n onAbort: cb => responseChain.error(\"AbortError\", cb)\n }\n\n return resolvers.reduce((chain, r) => r(chain, wretcher), responseChain) as (ResponseChain & Promise<any>)\n}\n","import { mix } from \"./mix\"\nimport conf from \"./config\"\nimport { resolver, WretcherError, ResponseChain } from \"./resolver\"\nimport { ConfiguredMiddleware } from \"./middleware\"\n\nexport type WretcherOptions = RequestInit & {\n [key: string]: any\n}\n\nexport type DeferredCallback = (wretcher: Wretcher, url: string, options: WretcherOptions) => Wretcher\n\nconst JSON_MIME = \"application/json\"\nconst CONTENT_TYPE_HEADER = \"Content-Type\"\n\n/**\n * The Wretcher class used to perform easy fetch requests.\n *\n * Immutability : almost every method of this class return a fresh Wretcher object.\n */\nexport class Wretcher {\n\n protected constructor(\n public _url: string,\n public _options: WretcherOptions,\n public _catchers: Map<number | string, (error: WretcherError, originalRequest: Wretcher) => void> = new Map(),\n public _resolvers: ((resolver: ResponseChain, originalRequest: Wretcher) => any)[] = [],\n public _middlewares: ConfiguredMiddleware[] = [],\n public _deferredChain: DeferredCallback[] = []) { }\n\n static factory(url = \"\", options: WretcherOptions = {}) { return new Wretcher(url, options) }\n private selfFactory({ url = this._url, options = this._options, catchers = this._catchers,\n resolvers = this._resolvers, middlewares = this._middlewares, deferredChain = this._deferredChain } = {}) {\n return new Wretcher(url, { ...options }, new Map(catchers), [...resolvers], [...middlewares], [...deferredChain])\n }\n\n /**\n * Sets the default fetch options used for every subsequent fetch call.\n * @param options New default options\n * @param mixin If true, mixes in instead of replacing the existing options\n */\n defaults(options: WretcherOptions, mixin = false) {\n conf.defaults = mixin ? mix(conf.defaults, options) : options\n return this\n }\n\n /**\n * Sets the method (text, json ...) used to parse the data contained in the response body in case of an HTTP error.\n *\n * Persists for every subsequent requests.\n *\n * Default is \"text\".\n */\n errorType(method: \"text\" | \"json\") {\n conf.errorType = method\n return this\n }\n\n /**\n * Sets the non-global polyfills which will be used for every subsequent calls.\n *\n * Needed for libraries like [fetch-ponyfill](https://github.com/qubyte/fetch-ponyfill).\n *\n * @param polyfills An object containing the polyfills.\n */\n polyfills(polyfills: Partial<typeof conf.polyfills>) {\n conf.polyfills = { ...conf.polyfills, ...polyfills }\n return this\n }\n\n /**\n * Returns a new Wretcher object with the argument url appended and the same options.\n * @param url String url\n * @param replace Boolean If true, replaces the current url instead of appending\n */\n url(url: string, replace = false) {\n if (replace)\n return this.selfFactory({ url })\n const split = this._url.split(\"?\")\n return this.selfFactory({\n url: split.length > 1 ?\n split[0] + url + \"?\" + split[1] :\n this._url + url\n })\n }\n\n /**\n * Returns a new Wretcher object with the same url and new options.\n * @param options New options\n * @param mixin If true, mixes in instead of replacing the existing options\n */\n options(options: WretcherOptions, mixin = true) {\n return this.selfFactory({ options: mixin ? mix(this._options, options) : options })\n }\n\n /**\n * Converts a javascript object to query parameters,\n * then appends this query string to the current url.\n *\n * If given a string, use the string as the query verbatim.\n *\n * ```\n * let w = wretch(\"http://example.com\") // url is http://example.com\n *\n * // Chain query calls\n * w = w.query({ a: 1, b : 2 }) // url is now http://example.com?a=1&b=2\n * w = w.query(\"foo-bar-baz-woz\") // url is now http://example.com?a=1&b=2&foo-bar-baz-woz\n *\n * // Pass true as the second argument to replace existing query parameters\n * w = w.query(\"c=3&d=4\", true) // url is now http://example.com?c=3&d=4\n * ```\n *\n * @param qp An object which will be converted, or a string which will be used verbatim.\n */\n query(qp: object | string, replace: boolean = false) {\n return this.selfFactory({ url: appendQueryParams(this._url, qp, replace) })\n }\n\n /**\n * Set request headers.\n * @param headerValues An object containing header keys and values\n */\n headers(headerValues: { [headerName: string]: string }) {\n return this.selfFactory({ options: mix(this._options, { headers: headerValues || {} }) })\n }\n\n /**\n * Shortcut to set the \"Accept\" header.\n * @param headerValue Header value\n */\n accept(headerValue: string) {\n return this.headers({ Accept: headerValue })\n }\n\n /**\n * Shortcut to set the \"Content-Type\" header.\n * @param headerValue Header value\n */\n content(headerValue: string) {\n return this.headers({ [CONTENT_TYPE_HEADER]: headerValue })\n }\n\n /**\n * Shortcut to set the \"Authorization\" header.\n * @param headerValue Header value\n */\n auth(headerValue: string) {\n return this.headers({ Authorization: headerValue })\n }\n\n /**\n * Adds a default catcher which will be called on every subsequent request error when the error code matches.\n * @param errorId Error code or name\n * @param catcher: The catcher method\n */\n catcher(errorId: number | string, catcher: (error: WretcherError, originalRequest: Wretcher) => any) {\n const newMap = new Map(this._catchers)\n newMap.set(errorId, catcher)\n return this.selfFactory({ catchers: newMap })\n }\n\n /**\n * Associates a custom signal with the request.\n * @param controller : An AbortController\n */\n signal(controller: AbortController) {\n return this.selfFactory({ options: { ...this._options, signal: controller.signal } })\n }\n\n /**\n * Program a resolver to perform response chain tasks automatically.\n * @param doResolve : Resolver callback\n */\n resolve(doResolve: (chain: ResponseChain, originalRequest: Wretcher) => ResponseChain | Promise<any>, clear: boolean = false) {\n return this.selfFactory({ resolvers: clear ? [doResolve] : [...this._resolvers, doResolve] })\n }\n\n /**\n * Defer wretcher methods that will be chained and called just before the request is performed.\n */\n defer(callback: DeferredCallback, clear = false) {\n return this.selfFactory({\n deferredChain: clear ? [callback] : [...this._deferredChain, callback]\n })\n }\n\n /**\n * Add middlewares to intercept a request before being sent.\n */\n middlewares(middlewares: ConfiguredMiddleware[], clear = false) {\n return this.selfFactory({\n middlewares: clear ? middlewares : [...this._middlewares, ...middlewares]\n })\n }\n\n private method(method: string, options = {}, body = null) {\n let base = this.options({ ...options, method })\n const headers = base._options.headers\n base =\n !body ? base :\n typeof body === \"object\" && (\n !headers ||\n Object.entries(headers).every(([k, v]) =>\n k.toLowerCase() !== CONTENT_TYPE_HEADER.toLowerCase() ||\n v.startsWith(JSON_MIME)\n )\n ) ? base.json(body) :\n base.body(body)\n return resolver(\n base\n ._deferredChain\n .reduce((acc: Wretcher, curr) => curr(acc, acc._url, acc._options), base)\n )\n }\n\n /**\n * Performs a get request.\n */\n get(options?: WretcherOptions) {\n return this.method(\"GET\", options)\n }\n /**\n * Performs a delete request.\n */\n delete(options?: WretcherOptions) {\n return this.method(\"DELETE\", options)\n }\n /**\n * Performs a put request.\n */\n put(body?: any, options?: WretcherOptions) {\n return this.method(\"PUT\", options, body)\n }\n /**\n * Performs a post request.\n */\n post(body?: any, options?: WretcherOptions) {\n return this.method(\"POST\", options, body)\n }\n /**\n * Performs a patch request.\n */\n patch(body?: any, options?: WretcherOptions) {\n return this.method(\"PATCH\", options, body)\n }\n /**\n * Performs a head request.\n */\n head(options?: WretcherOptions) {\n return this.method(\"HEAD\", options)\n }\n /**\n * Performs an options request\n */\n opts(options?: WretcherOptions) {\n return this.method(\"OPTIONS\", options)\n }\n /**\n * Replay a request.\n */\n replay(options?: WretcherOptions) {\n return this.method(this._options.method, options)\n }\n\n /**\n * Sets the request body with any content.\n * @param contents The body contents\n */\n body(contents: any) {\n return this.selfFactory({ options: { ...this._options, body: contents } })\n }\n /**\n * Sets the content type header, stringifies an object and sets the request body.\n * @param jsObject An object which will be serialized into a JSON\n */\n json(jsObject: object) {\n const preservedContentType = Object.entries(this._options.headers || {}).find(([k, v]) =>\n k.toLowerCase() === CONTENT_TYPE_HEADER.toLowerCase() && v.startsWith(JSON_MIME)\n )?.[1]\n return this.content(preservedContentType || JSON_MIME).body(JSON.stringify(jsObject))\n }\n /**\n * Converts the javascript object to a FormData and sets the request body.\n * @param formObject An object which will be converted to a FormData\n * @param recursive If `true`, will recurse through all nested objects\n * Can be set as an array of string to exclude specific keys.\n * See https://github.com/elbywan/wretch/issues/68 for more details.\n */\n formData(formObject: object, recursive: string[] | boolean = false) {\n return this.body(convertFormData(formObject, recursive))\n }\n /**\n * Converts the input to an url encoded string and sets the content-type header and body.\n * If the input argument is already a string, skips the conversion part.\n *\n * @param input An object to convert into an url encoded string or an already encoded string\n */\n formUrl(input: (object | string)) {\n return this\n .body(typeof input === \"string\" ? input : convertFormUrl(input))\n .content(\"application/x-www-form-urlencoded\")\n }\n}\n\n// Internal helpers\n\nconst appendQueryParams = (url: string, qp: object | string, replace: boolean) => {\n let queryString : string\n\n if (typeof qp === \"string\") {\n queryString = qp\n } else {\n const usp = conf.polyfill(\"URLSearchParams\", { instance: true })\n for (const key in qp) {\n if (qp[key] instanceof Array) {\n for (const val of qp[key])\n usp.append(key, val)\n } else {\n usp.append(key, qp[key])\n }\n }\n queryString = usp.toString()\n }\n\n const split = url.split(\"?\")\n\n if (!queryString)\n return replace ? split[0] : url\n\n if (replace || split.length < 2)\n return split[0] + \"?\" + queryString\n\n return url + \"&\" + queryString\n}\n\nfunction convertFormData(\n formObject: object,\n recursive: string[] | boolean = false,\n formData = conf.polyfill(\"FormData\", { instance: true }),\n ancestors = []\n) {\n Object.entries(formObject).forEach(([key, value]) => {\n let formKey = ancestors.reduce((acc, ancestor) => (\n acc ? `${acc}[${ancestor}]` : ancestor\n ), null)\n formKey = formKey ? `${formKey}[${key}]` : key\n if (value instanceof Array) {\n for (const item of value)\n formData.append(formKey + \"[]\", item)\n } else if (\n recursive &&\n typeof value === \"object\" &&\n (\n !(recursive instanceof Array) ||\n !recursive.includes(key)\n )\n ) {\n if (value !== null) {\n convertFormData(value, recursive, formData, [...ancestors, key])\n }\n } else {\n formData.append(formKey, value)\n }\n })\n\n return formData\n}\n\nfunction encodeQueryValue(key: string, value: unknown) {\n return encodeURIComponent(key) +\n \"=\" +\n encodeURIComponent(\n typeof value === \"object\" ?\n JSON.stringify(value) :\n \"\" + value\n )\n}\nfunction convertFormUrl(formObject: object) {\n return Object.keys(formObject)\n .map(key => {\n const value = formObject[key]\n if (value instanceof Array) {\n return value.map(v => encodeQueryValue(key, v)).join(\"&\")\n }\n return encodeQueryValue(key, value)\n })\n .join(\"&\")\n}\n","import { Wretcher } from \"./wretcher\"\n\nconst factory = Wretcher.factory\nfactory[\"default\"] = Wretcher.factory\n\n/* Export typescript types */\nexport {\n Wretcher,\n WretcherOptions\n} from \"./wretcher\"\nexport {\n WretcherResponse,\n WretcherError,\n WretcherErrorCallback,\n ResponseChain\n} from \"./resolver\"\n\nexport {\n Middleware,\n ConfiguredMiddleware,\n FetchLike\n} from \"./middleware\"\n\n/**\n * Return a fresh Wretcher instance.\n */\nexport default factory\n"],"names":["mix","one","two","mergeArrays","clone","prop","hasOwnProperty","Array","defaults","errorType","polyfills","fetch","FormData","URLSearchParams","performance","PerformanceObserver","AbortController","polyfill","p","doThrow","instance","res","this","self","g","Error","args","onMatch","entries","name","callback","_performance","getEntriesByName","matches","length","reverse","clearMeasures","perfs","callbacks","delete","size","observer","disconnect","clearResourceTimings","Map","observe","_observer","forEach","lazyObserver","entryTypes","set","error","JSON_MIME","CONTENT_TYPE_HEADER","_url","_options","_catchers","_resolvers","_middlewares","_deferredChain","factory","url","options","Wretcher","selfFactory","catchers","resolvers","middlewares","deferredChain","mixin","method","replace","split","query","qp","appendQueryParams","headers","headerValues","accept","headerValue","Accept","content","auth","Authorization","catcher","errorId","newMap","signal","controller","resolve","doResolve","clear","defer","body","base","wretcher","opts","finalOptions","fetchController","timeout","ref","clearTimeout","fetchRequest","fetchFunction","reduceRight","acc","curr","idx","middlewareHelper","throwingPromise","catch","WretchErrorWrapper","then","response","ok","msg","err","status","bodyParser","funName","cb","_","has","get","responseChain","json","blob","formData","arrayBuffer","text","setTimeout","time","abort","badRequest","unauthorized","forbidden","notFound","internalError","fetchError","onAbort","reduce","chain","r","resolver","Object","every","k","v","toLowerCase","startsWith","put","post","patch","head","replay","contents","jsObject","preservedContentType","find","JSON","stringify","formObject","recursive","convertFormData","formUrl","input","keys","map","key","value","encodeQueryValue","join","queryString","usp","val","append","toString","ancestors","formKey","ancestor","item","includes","encodeURIComponent"],"sourceRoot":""}