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AC,EAAW,CAAC,KACnC,IAAK,SAAS,IAAa,MAAM,QAAQ,GACxC,MAAM,IAAI,UAAU,mDAGrB,MAAM,EAAK,CAAC,EAAO,IAAY,IAAI,GAAG,EAAO,UAAU,CAAC,EAAG,EAAU,IAErE,IAAK,MAAM,KAAU,eACpB,EAAG,GAAU,CAAC,EAAO,IAAY,IAAI,GAAG,EAAO,UAAU,CAAC,EAAG,EAAU,EAAS,CAAC,YAKlF,OAFA,EAAG,OAAS,GAAY,eAAe,GAEhC,CAAE,iBAGK,wBAGd,UACA","file":"/npm/ky@0.7.1/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/ky@0.7.1/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/*! MIT License © Sindre Sorhus */\n\nconst getGlobal = property => {\n\t/* istanbul ignore next */\n\tif (typeof self !== 'undefined' && self && property in self) {\n\t\treturn self[property];\n\t}\n\n\t/* istanbul ignore next */\n\tif (typeof window !== 'undefined' && window && property in window) {\n\t\treturn window[property];\n\t}\n\n\tif (typeof global !== 'undefined' && global && property in global) {\n\t\treturn global[property];\n\t}\n\n\t/* istanbul ignore next */\n\tif (typeof globalThis !== 'undefined' && globalThis) {\n\t\treturn globalThis[property];\n\t}\n};\n\nconst document = getGlobal('document');\nconst Headers = getGlobal('Headers');\nconst Response = getGlobal('Response');\nconst fetch = getGlobal('fetch');\n\nconst isObject = value => value !== null && typeof value === 'object';\n\nconst deepMerge = (...sources) => {\n\tlet returnValue = {};\n\n\tfor (const source of sources) {\n\t\tif (Array.isArray(source)) {\n\t\t\tif (!(Array.isArray(returnValue))) {\n\t\t\t\treturnValue = [];\n\t\t\t}\n\n\t\t\treturnValue = [...returnValue, ...source];\n\t\t} else if (isObject(source)) {\n\t\t\tfor (let [key, value] of Object.entries(source)) {\n\t\t\t\tif (isObject(value) && Reflect.has(returnValue, key)) {\n\t\t\t\t\tvalue = deepMerge(returnValue[key], value);\n\t\t\t\t}\n\n\t\t\t\treturnValue = {...returnValue, [key]: value};\n\t\t\t}\n\t\t}\n\t}\n\n\treturn returnValue;\n};\n\nconst requestMethods = [\n\t'get',\n\t'post',\n\t'put',\n\t'patch',\n\t'head',\n\t'delete'\n];\n\nconst responseTypes = [\n\t'json',\n\t'text',\n\t'formData',\n\t'arrayBuffer',\n\t'blob'\n];\n\nconst retryMethods = new Set([\n\t'get',\n\t'put',\n\t'head',\n\t'delete',\n\t'options',\n\t'trace'\n]);\n\nconst retryStatusCodes = new Set([\n\t408,\n\t413,\n\t429,\n\t500,\n\t502,\n\t503,\n\t504\n]);\n\nconst retryAfterStatusCodes = new Set([\n\t413,\n\t429,\n\t503\n]);\n\nclass HTTPError extends Error {\n\tconstructor(response) {\n\t\tsuper(response.statusText);\n\t\tthis.name = 'HTTPError';\n\t\tthis.response = response;\n\t}\n}\n\nclass TimeoutError extends Error {\n\tconstructor() {\n\t\tsuper('Request timed out');\n\t\tthis.name = 'TimeoutError';\n\t}\n}\n\nconst delay = ms => new Promise(resolve => setTimeout(resolve, ms));\n\nconst timeout = (promise, ms) => Promise.race([\n\tpromise,\n\t(async () => {\n\t\tawait delay(ms);\n\t\tthrow new TimeoutError();\n\t})()\n]);\n\nconst normalizeRequestMethod = input => requestMethods.includes(input) ? input.toUpperCase() : input;\n\nclass Ky {\n\tconstructor(input, {\n\t\ttimeout = 10000,\n\t\thooks,\n\t\tthrowHttpErrors = true,\n\t\tsearchParams,\n\t\tjson,\n\t\t...otherOptions\n\t}) {\n\t\tthis._retryCount = 0;\n\n\t\tthis._options = {\n\t\t\tmethod: 'get',\n\t\t\tcredentials: 'same-origin', // TODO: This can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208\n\t\t\tretry: 2,\n\t\t\t...otherOptions\n\t\t};\n\t\tthis._options.method = normalizeRequestMethod(this._options.method);\n\t\tthis._options.prefixUrl = String(this._options.prefixUrl || '');\n\t\tthis._input = String(input || '');\n\n\t\tif (this._options.prefixUrl && this._input.startsWith('/')) {\n\t\t\tthrow new Error('`input` must not begin with a slash when using `prefixUrl`');\n\t\t}\n\n\t\tif (this._options.prefixUrl && !this._options.prefixUrl.endsWith('/')) {\n\t\t\tthis._options.prefixUrl += '/';\n\t\t}\n\n\t\tthis._input = this._options.prefixUrl + this._input;\n\n\t\tif (searchParams) {\n\t\t\tconst url = new URL(this._input, document && document.baseURI);\n\t\t\tif (typeof searchParams === 'string' || (URLSearchParams && searchParams instanceof URLSearchParams)) {\n\t\t\t\turl.search = searchParams;\n\t\t\t} else if (Object.values(searchParams).every(param => typeof param === 'number' || typeof param === 'string')) {\n\t\t\t\turl.search = new URLSearchParams(searchParams).toString();\n\t\t\t} else {\n\t\t\t\tthrow new Error('The `searchParams` option must be either a string, `URLSearchParams` instance or an object with string and number values');\n\t\t\t}\n\n\t\t\tthis._input = url.toString();\n\t\t}\n\n\t\tthis._timeout = timeout;\n\t\tthis._hooks = deepMerge({\n\t\t\tbeforeRequest: [],\n\t\t\tafterResponse: []\n\t\t}, hooks);\n\t\tthis._throwHttpErrors = throwHttpErrors;\n\n\t\tconst headers = new Headers(this._options.headers || {});\n\n\t\tif (json) {\n\t\t\theaders.set('content-type', 'application/json');\n\t\t\tthis._options.body = JSON.stringify(json);\n\t\t}\n\n\t\tthis._options.headers = headers;\n\n\t\tthis._response = this._fetch();\n\n\t\tfor (const type of responseTypes) {\n\t\t\tconst isRetriableMethod = retryMethods.has(this._options.method.toLowerCase());\n\t\t\tconst fn = async () => {\n\t\t\t\tif (this._retryCount > 0) {\n\t\t\t\t\tthis._response = this._fetch();\n\t\t\t\t}\n\n\t\t\t\tlet response = await this._response;\n\n\t\t\t\tfor (const hook of this._hooks.afterResponse) {\n\t\t\t\t\t// eslint-disable-next-line no-await-in-loop\n\t\t\t\t\tconst modifiedResponse = await hook(response.clone());\n\n\t\t\t\t\tif (modifiedResponse instanceof Response) {\n\t\t\t\t\t\tresponse = modifiedResponse;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!response.ok && (isRetriableMethod || this._throwHttpErrors)) {\n\t\t\t\t\tthrow new HTTPError(response);\n\t\t\t\t}\n\n\t\t\t\treturn response.clone()[type]();\n\t\t\t};\n\n\t\t\tthis._response[type] = isRetriableMethod ? this._retry(fn) : fn;\n\t\t}\n\n\t\treturn this._response;\n\t}\n\n\t_calculateRetryDelay(error) {\n\t\tthis._retryCount++;\n\n\t\tif (this._retryCount < this._options.retry && !(error instanceof TimeoutError)) {\n\t\t\tif (error instanceof HTTPError) {\n\t\t\t\tif (!retryStatusCodes.has(error.response.status)) {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\n\t\t\t\tconst retryAfter = error.response.headers.get('Retry-After');\n\t\t\t\tif (retryAfter && retryAfterStatusCodes.has(error.response.status)) {\n\t\t\t\t\tlet after = Number(retryAfter);\n\t\t\t\t\tif (Number.isNaN(after)) {\n\t\t\t\t\t\tafter = Date.parse(retryAfter) - Date.now();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tafter *= 1000;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn after;\n\t\t\t\t}\n\n\t\t\t\tif (error.response.status === 413) {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst BACKOFF_FACTOR = 0.3;\n\t\t\treturn BACKOFF_FACTOR * (2 ** (this._retryCount - 1)) * 1000;\n\t\t}\n\n\t\treturn 0;\n\t}\n\n\t_retry(fn) {\n\t\tconst retry = async () => {\n\t\t\ttry {\n\t\t\t\treturn await fn();\n\t\t\t} catch (error) {\n\t\t\t\tconst ms = this._calculateRetryDelay(error);\n\t\t\t\tif (ms !== 0) {\n\t\t\t\t\tawait delay(ms);\n\t\t\t\t\treturn retry();\n\t\t\t\t}\n\n\t\t\t\tif (this._throwHttpErrors) {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\treturn retry;\n\t}\n\n\tasync _fetch() {\n\t\tfor (const hook of this._hooks.beforeRequest) {\n\t\t\t// eslint-disable-next-line no-await-in-loop\n\t\t\tawait hook(this._options);\n\t\t}\n\n\t\treturn timeout(fetch(this._input, this._options), this._timeout);\n\t}\n}\n\nconst createInstance = (defaults = {}) => {\n\tif (!isObject(defaults) || Array.isArray(defaults)) {\n\t\tthrow new TypeError('The `defaultOptions` argument must be an object');\n\t}\n\n\tconst ky = (input, options) => new Ky(input, deepMerge({}, defaults, options));\n\n\tfor (const method of requestMethods) {\n\t\tky[method] = (input, options) => new Ky(input, deepMerge({}, defaults, options, {method}));\n\t}\n\n\tky.extend = defaults => createInstance(defaults);\n\n\treturn ky;\n};\n\nexport default createInstance();\n\nexport {\n\tHTTPError,\n\tTimeoutError\n};\n"]}