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EAAQ3D,aAAewD,EAChDK,EAAWxD,QAAUsD,EAAQtD,SAAW,GACxCwD,EAAWtB,kBAAoBoB,EAAQpB,mBAAqBlG,EAC5DwH,EAAWE,mBACPJ,EAAQI,oBAAsBtE,EAA0BoE,GAC5DA,EAAWG,oBACPL,EAAQK,qBAAuBpC,EAA2BiC,GAE9DA,EAAWhE,SAASlB,MAAQ,CACxByD,IAA4B,QAAtBvD,EAAK8E,EAAQvB,WAAwB,IAAPvD,EAAgBA,EAAK,IACzDwD,gBAAoD,QAAlC1B,EAAKgD,EAAQtB,uBAAoC,IAAP1B,GAAgBA,EAC5Eb,QAAS6D,EAAQ7D,SAAW,CAAC,OAC7BoC,eAAgByB,EAAQzB,gBAAkB,CACtCf,YAAc9C,GAAWA,GAAU,KAAOA,EAAS,KAEvDS,KAA8B,QAAvBiD,EAAK4B,EAAQ7E,YAAyB,IAAPiD,GAAgBA,EACtDhD,cAAgD,QAAhCiD,EAAK2B,EAAQ5E,qBAAkC,IAAPiD,GAAgBA,EACxEpE,aAA8C,QAA/BgG,EAAKD,EAAQ/F,oBAAiC,IAAPgG,GAAgBA,EACtEpB,OAAQmB,EAAQnB,QAAU,IAG9BqB,EAAWE,mBAAmBlD,QAC9BgD,EAAWG,oBAAoBnD,QACxBgD,ECpDJ,SAASI,EAAgB/D,EAASgE,EAAS,IAC9C,OAAOrB,EAAa,CAChBC,KAAOnI,IACH,MAAMwJ,EAAOjE,EAAQkE,QAAQF,EAASvJ,GACtC,OAAOwJ,EAAO1K,KAAKwE,MAAMkG,QAAQ5J,GAErCgG,IAAK,CAAC5F,EAAKU,KACP6E,EAAQmE,QAAQH,EAASvJ,EAAKlB,KAAKC,UAAU2B,KAEjDqF,OAAS/F,IACLuF,EAAQoE,WAAWJ,EAASvJ,Q","sources":["webpack://AxiosCacheInterceptor/webpack/universalModuleDefinition","webpack://AxiosCacheInterceptor/./node_modules/fast-defer/index.min.js","webpack://AxiosCacheInterceptor/./node_modules/object-code/index.min.js","webpack://AxiosCacheInterceptor/webpack/bootstrap","webpack://AxiosCacheInterceptor/webpack/runtime/define property getters","webpack://AxiosCacheInterceptor/webpack/runtime/hasOwnProperty shorthand","webpack://AxiosCacheInterceptor/webpack/runtime/make namespace object","webpack://AxiosCacheInterceptor/./node_modules/cache-parser/dist/index.mjs","webpack://AxiosCacheInterceptor/./src/util/headers.ts","webpack://AxiosCacheInterceptor/./src/header/interpreter.ts","webpack://AxiosCacheInterceptor/./src/interceptors/util.ts","webpack://AxiosCacheInterceptor/./src/interceptors/request.ts","webpack://AxiosCacheInterceptor/./src/util/cache-predicate.ts","webpack://AxiosCacheInterceptor/./src/util/update-cache.ts","webpack://AxiosCacheInterceptor/./src/interceptors/response.ts","webpack://AxiosCacheInterceptor/./src/storage/build.ts","webpack://AxiosCacheInterceptor/./src/storage/memory.ts","webpack://AxiosCacheInterceptor/./src/util/key-generator.ts","webpack://AxiosCacheInterceptor/./src/cache/create.ts","webpack://AxiosCacheInterceptor/./src/storage/web-api.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"AxiosCacheInterceptor\"] = factory();\n\telse\n\t\troot[\"AxiosCacheInterceptor\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn ","!function(e){var r=Symbol(\"fast-defer\");e.deferred=function(){var e,n,t=new Promise((function(r,t){e=r,n=t}));return t.resolve=e,t.reject=n,t[r]=1,t},e.isDeferred=function(e){return!!e&&!!e[r]}}(\"undefined\"!=typeof exports?exports:window.FastDefer||(window.FastDefer={}));","!function(r){r.transform=function(t){var n=typeof t;if(\"object\"===n&&t){if(t instanceof Date)return\"#\"+t.getTime();if(t instanceof RegExp)return\"#\"+t.toString();var o=Array.isArray(t)?[]:{};for(var e in t)o[e]=r.transform(t[e]);return\"#\"+String(t.constructor)+JSON.stringify(o,Object.keys(o).sort())}return n+String(t)+(\"symbol\"===n?Math.random():\"\")},r.code=function(t){t=r.transform(t);for(var n=7,o=0;o<t.length;)n=31*n+t.charCodeAt(o++)&9007199254740991;return n}}(\"undefined\"!=typeof exports?exports:window.FastHash||(window.FastHash={}));","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","var e=Symbol(\"cache-parser\");function a(a){return!(!a||!a[e])}function r(e){return(\"string\"==typeof e||\"number\"==typeof e)&&(e=Number(e))>=0&&e<Infinity}function t(e){return\"number\"==typeof e||!0===e||\"string\"==typeof e&&\"false\"!==e}function s(e){var a=e.toLowerCase().replace(/\\s+/g,\"\").split(\",\"),r={};for(var t in a){var s=a[t].split(\"=\",2);r[s[0]]=1===s.length||s[1]}return r}function n(a){var n=Object.defineProperty({},e,{enumerable:!1,value:1});if(!a||\"string\"!=typeof a)return n;var i=s(a);return t(i.immutable)&&(n.immutable=!0),r(i[\"max-age\"])&&(n.maxAge=Number(i[\"max-age\"])),r(i[\"max-stale\"])&&(n.maxStale=Number(i[\"max-stale\"])),r(i[\"min-fresh\"])&&(n.minFresh=Number(i[\"min-fresh\"])),t(i[\"must-revalidate\"])&&(n.mustRevalidate=!0),t(i[\"must-understand\"])&&(n.mustUnderstand=!0),t(i[\"no-cache\"])&&(n.noCache=!0),t(i[\"no-store\"])&&(n.noStore=!0),t(i[\"no-transform\"])&&(n.noTransform=!0),t(i[\"only-if-cached\"])&&(n.onlyIfCached=!0),t(i.private)&&(n.private=!0),t(i[\"proxy-revalidate\"])&&(n.proxyRevalidate=!0),t(i.public)&&(n.public=!0),r(i[\"s-maxage\"])&&(n.sMaxAge=Number(i[\"s-maxage\"])),r(i[\"stale-if-error\"])&&(n.staleIfError=Number(i[\"stale-if-error\"])),r(i[\"stale-while-revalidate\"])&&(n.staleWhileRevalidate=Number(i[\"stale-while-revalidate\"])),n}function i(e){if(!e||\"object\"!=typeof e)return[];var a=[];return t(e.immutable)&&a.push(\"immutable\"),r(e.maxAge)&&a.push(\"max-age=\"+e.maxAge),r(e.maxStale)&&a.push(\"max-stale=\"+e.maxStale),r(e.minFresh)&&a.push(\"min-fresh=\"+e.minFresh),t(e.mustRevalidate)&&a.push(\"must-revalidate\"),t(e.mustUnderstand)&&a.push(\"must-understand\"),t(e.noCache)&&a.push(\"no-cache\"),t(e.noStore)&&a.push(\"no-store\"),t(e.noTransform)&&a.push(\"no-transform\"),t(e.onlyIfCached)&&a.push(\"only-if-cached\"),t(e.private)&&a.push(\"private\"),t(e.proxyRevalidate)&&a.push(\"proxy-revalidate\"),t(e.public)&&a.push(\"public\"),r(e.sMaxAge)&&a.push(\"s-maxage=\"+e.sMaxAge),r(e.staleIfError)&&a.push(\"stale-if-error=\"+e.staleIfError),r(e.staleWhileRevalidate)&&a.push(\"stale-while-revalidate=\"+e.staleWhileRevalidate),a}export{a as isCacheControl,r as isDuration,t as isTruthy,n as parse,s as parseHeadersString,i as tokenize};\n//# sourceMappingURL=index.mjs.map\n","export const Header = Object.freeze({\n    /**\n     * ```txt\n     * If-Modified-Since: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT\n     * ```\n     *\n     * @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since\n     */\n    IfModifiedSince: 'if-modified-since',\n    /**\n     * ```txt\n     * Last-Modified: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT\n     * ```\n     *\n     * @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified\n     */\n    LastModified: 'last-modified',\n    /**\n     * ```txt\n     * If-None-Match: \"<etag_value>\"\n     * If-None-Match: \"<etag_value>\", \"<etag_value>\", …\n     * If-None-Match: *\n     * ```\n     *\n     * @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match\n     */\n    IfNoneMatch: 'if-none-match',\n    /**\n     * ```txt\n     * Cache-Control: max-age=604800\n     * ```\n     *\n     * @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control\n     */\n    CacheControl: 'cache-control',\n    /**\n     * ```txt\n     * ETag: W / '<etag_value>';\n     * ETag: '<etag_value>';\n     * ```\n     *\n     * @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag\n     */\n    ETag: 'etag',\n    /**\n     * ```txt\n     * Expires: <http-date>\n     * ```\n     *\n     * @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires\n     */\n    Expires: 'expires',\n    /**\n     * ```txt\n     * Age: <delta-seconds>\n     * ```\n     *\n     * @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Age\n     */\n    Age: 'age',\n    /**\n     * ```txt\n     * Content-Type: text/html; charset=UTF-8\n     * Content-Type: multipart/form-data; boundary=something\n     * ```\n     *\n     * @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type\n     */\n    ContentType: 'content-type',\n    /**\n     * Used internally as metadata to mark the cache item as revalidatable and enabling\n     * stale cache state Contains a string of ASCII characters that can be used as ETag for\n     * `If-Match` header Provided by user using `cache.etag` value.\n     *\n     * ```txt\n     * X-Axios-Cache-Etag: \"<etag_value>\"\n     * ```\n     */\n    XAxiosCacheEtag: 'x-axios-cache-etag',\n    /**\n     * Used internally as metadata to mark the cache item as revalidatable and enabling\n     * stale cache state may contain `'use-cache-timestamp'` if `cache.modifiedSince` is\n     * `true`, otherwise will contain a date from `cache.modifiedSince`. If a date is\n     * provided, it can be used for `If-Modified-Since` header, otherwise the cache\n     * timestamp can be used for `If-Modified-Since` header.\n     *\n     * ```txt\n     * X-Axios-Cache-Last-Modified: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT\n     * X-Axios-Cache-Last-Modified: use-cache-timestamp\n     * ```\n     */\n    XAxiosCacheLastModified: 'x-axios-cache-last-modified',\n    /**\n     * Used internally as metadata to mark the cache item able to be used if the server\n     * returns an error. The stale-if-error response directive indicates that the cache can\n     * reuse a stale response when any error occurs.\n     *\n     * ```txt\n     * XAxiosCacheStaleIfError: <seconds>\n     * ```\n     */\n    XAxiosCacheStaleIfError: 'x-axios-cache-stale-if-error'\n});\n","import { parse } from 'cache-parser';\nimport { Header } from '../util/headers';\nexport const defaultHeaderInterpreter = (headers) => {\n    if (!headers)\n        return 'not enough headers';\n    const cacheControl = headers[Header.CacheControl];\n    if (cacheControl) {\n        const { noCache, noStore, mustRevalidate, maxAge, immutable } = parse(String(cacheControl));\n        // Header told that this response should not be cached.\n        if (noCache || noStore) {\n            return 'dont cache';\n        }\n        if (immutable) {\n            // 1 year is sufficient, as Infinity may cause more problems.\n            // It might not be the best way, but a year is better than none.\n            return 1000 * 60 * 60 * 24 * 365;\n        }\n        // Already out of date, for cache can be saved, but must be requested again\n        if (mustRevalidate) {\n            return 0;\n        }\n        if (maxAge) {\n            const age = headers[Header.Age];\n            if (!age) {\n                return maxAge * 1000;\n            }\n            return (maxAge - Number(age)) * 1000;\n        }\n    }\n    const expires = headers[Header.Expires];\n    if (expires) {\n        const milliseconds = Date.parse(String(expires)) - Date.now();\n        return milliseconds >= 0 ? milliseconds : 'dont cache';\n    }\n    return 'not enough headers';\n};\n","import { Header } from '../util/headers';\n/**\n * Creates a new validateStatus function that will use the one already used and also\n * accept status code 304.\n */\nexport function createValidateStatus(oldValidate) {\n    return oldValidate\n        ? (status) => oldValidate(status) || status === 304\n        : (status) => (status >= 200 && status < 300) || status === 304;\n}\n/** Checks if the given method is in the methods array */\nexport function isMethodIn(requestMethod = 'get', methodList = []) {\n    requestMethod = requestMethod.toLowerCase();\n    for (const method of methodList) {\n        if (method.toLowerCase() === requestMethod) {\n            return true;\n        }\n    }\n    return false;\n}\n/**\n * This function updates the cache when the request is stale. So, the next request to the\n * server will be made with proper header / settings.\n */\nexport function updateStaleRequest(cache, config) {\n    var _a;\n    config.headers || (config.headers = {});\n    const { etag, modifiedSince } = config.cache;\n    if (etag) {\n        const etagValue = etag === true ? (_a = cache.data) === null || _a === void 0 ? void 0 : _a.headers[Header.ETag] : etag;\n        if (etagValue) {\n            config.headers[Header.IfNoneMatch] = etagValue;\n        }\n    }\n    if (modifiedSince) {\n        config.headers[Header.IfModifiedSince] =\n            modifiedSince === true\n                ? // If last-modified is not present, use the createdAt timestamp\n                    cache.data.headers[Header.LastModified] ||\n                        new Date(cache.createdAt).toUTCString()\n                : modifiedSince.toUTCString();\n    }\n}\n/**\n * Creates the new date to the cache by the provided response. Also handles possible 304\n * Not Modified by updating response properties.\n */\nexport function createCacheResponse(response, cache) {\n    if (response.status === 304 && cache) {\n        // Set the cache information into the response object\n        response.cached = true;\n        response.data = cache.data;\n        response.status = cache.status;\n        response.statusText = cache.statusText;\n        // Update possible new headers\n        response.headers = Object.assign(Object.assign({}, cache.headers), response.headers);\n        // return the old cache\n        return cache;\n    }\n    // New Response\n    return {\n        data: response.data,\n        status: response.status,\n        statusText: response.statusText,\n        headers: response.headers\n    };\n}\n","import { deferred } from 'fast-defer';\nimport { createValidateStatus, isMethodIn, updateStaleRequest } from './util';\nexport function defaultRequestInterceptor(axios) {\n    const onFulfilled = async (config) => {\n        var _a;\n        if (config.cache === false) {\n            return config;\n        }\n        // merge defaults with per request configuration\n        config.cache = Object.assign(Object.assign({}, axios.defaults.cache), config.cache);\n        if (!isMethodIn(config.method, config.cache.methods)) {\n            return config;\n        }\n        const key = (config.id = axios.generateKey(config));\n        // Assumes that the storage handled staled responses\n        let cache = await axios.storage.get(key);\n        // Not cached, continue the request, and mark it as fetching\n        emptyOrStale: if (cache.state === 'empty' || cache.state === 'stale') {\n            /**\n             * This checks for simultaneous access to a new key. The js event loop jumps on the\n             * first await statement, so the second (asynchronous call) request may have already\n             * started executing.\n             */\n            if (axios.waiting[key]) {\n                cache = (await axios.storage.get(key));\n                break emptyOrStale;\n            }\n            // Create a deferred to resolve other requests for the same key when it's completed\n            axios.waiting[key] = deferred();\n            /**\n             * Add a default reject handler to catch when the request is aborted without others\n             * waiting for it.\n             */\n            (_a = axios.waiting[key]) === null || _a === void 0 ? void 0 : _a.catch(() => undefined);\n            await axios.storage.set(key, {\n                state: 'loading',\n                previous: cache.state,\n                // Eslint complains a lot :)\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any\n                data: cache.data,\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any\n                createdAt: cache.createdAt\n            });\n            if (cache.state === 'stale') {\n                updateStaleRequest(cache, config);\n            }\n            config.validateStatus = createValidateStatus(config.validateStatus);\n            return config;\n        }\n        let cachedResponse;\n        if (cache.state === 'loading') {\n            const deferred = axios.waiting[key];\n            // Just in case, the deferred doesn't exists.\n            /* istanbul ignore if 'really hard to test' */\n            if (!deferred) {\n                await axios.storage.remove(key);\n                return config;\n            }\n            try {\n                cachedResponse = await deferred;\n            }\n            catch (_b) {\n                // The deferred is rejected when the request that we are waiting rejected cache.\n                return config;\n            }\n        }\n        else {\n            cachedResponse = cache.data;\n        }\n        // Even though the response interceptor receives this one from here,\n        // it has been configured to ignore cached responses = true\n        config.adapter = () => Promise.resolve({\n            config,\n            data: cachedResponse.data,\n            headers: cachedResponse.headers,\n            status: cachedResponse.status,\n            statusText: cachedResponse.statusText,\n            cached: true,\n            id: key\n        });\n        return config;\n    };\n    return {\n        onFulfilled,\n        apply: () => axios.interceptors.request.use(onFulfilled)\n    };\n}\n","/** Tests an response against a {@link CachePredicateObject}. */\nexport async function testCachePredicate(response, predicate) {\n    var _a;\n    if (typeof predicate === 'function') {\n        return predicate(response);\n    }\n    const { statusCheck, responseMatch, containsHeaders } = predicate;\n    if ((statusCheck && !(await statusCheck(response.status))) ||\n        (responseMatch && !(await responseMatch(response)))) {\n        return false;\n    }\n    if (containsHeaders) {\n        for (const header in containsHeaders) {\n            const predicate = containsHeaders[header];\n            if (predicate &&\n                !(await predicate(\n                // Axios uses lowercase headers, but if for some reason it doesn't, we should\n                // still be able to match.\n                (_a = response.headers[header.toLowerCase()]) !== null && _a !== void 0 ? _a : response.headers[header]))) {\n                return false;\n            }\n        }\n    }\n    return true;\n}\n","/** Function to update all caches, from CacheProperties.update, with the new data. */\nexport async function updateCache(storage, data, entries) {\n    for (const cacheKey in entries) {\n        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n        const value = entries[cacheKey];\n        if (value === 'delete') {\n            await storage.remove(cacheKey);\n            continue;\n        }\n        const oldValue = await storage.get(cacheKey);\n        if (oldValue.state === 'loading') {\n            continue;\n        }\n        const newValue = await value(oldValue, data);\n        if (newValue === 'delete') {\n            await storage.remove(cacheKey);\n            continue;\n        }\n        if (newValue === 'ignore') {\n            continue;\n        }\n        await storage.set(cacheKey, newValue);\n    }\n}\n","import { testCachePredicate } from '../util/cache-predicate';\nimport { Header } from '../util/headers';\nimport { updateCache } from '../util/update-cache';\nimport { createCacheResponse } from './util';\nexport function defaultResponseInterceptor(axios) {\n    /**\n     * Rejects cache for an response response.\n     *\n     * Also update the waiting list for this key by rejecting it.\n     */\n    const rejectResponse = async (responseId) => {\n        var _a;\n        // Update the cache to empty to prevent infinite loading state\n        await axios.storage.remove(responseId);\n        // Reject the deferred if present\n        (_a = axios.waiting[responseId]) === null || _a === void 0 ? void 0 : _a.reject(null);\n        delete axios.waiting[responseId];\n    };\n    const onFulfilled = async (response) => {\n        var _a, _b, _c;\n        var _d;\n        response.id = (_a = (_d = response.config).id) !== null && _a !== void 0 ? _a : (_d.id = axios.generateKey(response.config));\n        (_b = response.cached) !== null && _b !== void 0 ? _b : (response.cached = false);\n        // Response is already cached\n        if (response.cached) {\n            return response;\n        }\n        // Skip cache: either false or weird behavior\n        // config.cache should always exists, at least from global config merge.\n        if (!response.config.cache) {\n            return Object.assign(Object.assign({}, response), { cached: false });\n        }\n        // Request interceptor merges defaults with per request configuration\n        const cacheConfig = response.config.cache;\n        const cache = await axios.storage.get(response.id);\n        if (\n        // If the request interceptor had a problem\n        cache.state === 'stale' ||\n            cache.state === 'empty' ||\n            // Should not hit here because of previous response.cached check\n            cache.state === 'cached') {\n            return response;\n        }\n        // Config told that this response should be cached.\n        if (\n        // For 'loading' values (post stale), this check was already run in the past.\n        !cache.data &&\n            !(await testCachePredicate(response, cacheConfig.cachePredicate))) {\n            await rejectResponse(response.id);\n            return response;\n        }\n        // avoid remnant headers from remote server to break implementation\n        for (const header in Header) {\n            if (!header.startsWith('XAxiosCache')) {\n                continue;\n            }\n            delete response.headers[header];\n        }\n        if (cacheConfig.etag && cacheConfig.etag !== true) {\n            response.headers[Header.XAxiosCacheEtag] = cacheConfig.etag;\n        }\n        if (cacheConfig.modifiedSince) {\n            response.headers[Header.XAxiosCacheLastModified] =\n                cacheConfig.modifiedSince === true\n                    ? 'use-cache-timestamp'\n                    : cacheConfig.modifiedSince.toUTCString();\n        }\n        let ttl = cacheConfig.ttl || -1; // always set from global config\n        if (cacheConfig === null || cacheConfig === void 0 ? void 0 : cacheConfig.interpretHeader) {\n            const expirationTime = axios.headerInterpreter(response.headers);\n            // Cache should not be used\n            if (expirationTime === 'dont cache') {\n                await rejectResponse(response.id);\n                return response;\n            }\n            ttl = expirationTime === 'not enough headers' ? ttl : expirationTime;\n        }\n        const data = createCacheResponse(response, cache.data);\n        if (typeof ttl === 'function') {\n            ttl = await ttl(response);\n        }\n        if (cacheConfig.staleIfError) {\n            response.headers[Header.XAxiosCacheStaleIfError] = String(ttl);\n        }\n        // Update other entries before updating himself\n        if (cacheConfig === null || cacheConfig === void 0 ? void 0 : cacheConfig.update) {\n            await updateCache(axios.storage, response, cacheConfig.update);\n        }\n        const newCache = {\n            state: 'cached',\n            ttl,\n            createdAt: Date.now(),\n            data\n        };\n        // Resolve all other requests waiting for this response\n        (_c = axios.waiting[response.id]) === null || _c === void 0 ? void 0 : _c.resolve(newCache.data);\n        delete axios.waiting[response.id];\n        // Define this key as cache on the storage\n        await axios.storage.set(response.id, newCache);\n        // Return the response with cached as false, because it was not cached at all\n        return response;\n    };\n    const onRejected = async (error) => {\n        var _a;\n        const config = error['config'];\n        if (!config || config.cache === false || !config.id) {\n            throw error;\n        }\n        const cache = await axios.storage.get(config.id);\n        const cacheConfig = config.cache;\n        if (\n        // This will only not be loading if the interceptor broke\n        cache.state !== 'loading' ||\n            cache.previous !== 'stale') {\n            await rejectResponse(config.id);\n            throw error;\n        }\n        if (cacheConfig === null || cacheConfig === void 0 ? void 0 : cacheConfig.staleIfError) {\n            const staleIfError = typeof cacheConfig.staleIfError === 'function'\n                ? await cacheConfig.staleIfError(error.response, cache, error)\n                : cacheConfig.staleIfError;\n            if (staleIfError === true ||\n                // staleIfError is the number of seconds that stale is allowed to be used\n                (typeof staleIfError === 'number' && cache.createdAt + staleIfError > Date.now())) {\n                // Resolve all other requests waiting for this response\n                (_a = axios.waiting[config.id]) === null || _a === void 0 ? void 0 : _a.resolve(cache.data);\n                delete axios.waiting[config.id];\n                // re-mark the cache as stale\n                await axios.storage.set(config.id, {\n                    state: 'stale',\n                    createdAt: Date.now(),\n                    data: cache.data\n                });\n                return {\n                    cached: true,\n                    config,\n                    id: config.id,\n                    data: cache.data.data,\n                    headers: cache.data.headers,\n                    status: cache.data.status,\n                    statusText: cache.data.statusText\n                };\n            }\n        }\n        throw error;\n    };\n    return {\n        onFulfilled,\n        onRejected,\n        apply: () => axios.interceptors.response.use(onFulfilled, onRejected)\n    };\n}\n","import { Header } from '../util/headers';\nconst storage = Symbol();\n/** Returns true if the provided object was created from {@link buildStorage} function. */\nexport const isStorage = (obj) => !!obj && !!obj[storage];\n/**\n * Builds a custom storage.\n *\n * **Note**: You can only create an custom storage with this function.\n *\n * @example\n *\n * ```js\n * const myStorage = buildStorage({\n *   find: () => {...},\n *   set: () => {...},\n *   remove: () => {...}\n * });\n *\n * const axios = setupCache(axios, { storage: myStorage });\n * ```\n */\nexport function buildStorage({ set, find, remove }) {\n    return {\n        //@ts-expect-error - we don't want to expose this\n        [storage]: 1,\n        set,\n        remove,\n        get: async (key) => {\n            const value = await find(key);\n            if (!value) {\n                return { state: 'empty' };\n            }\n            if (\n            // Not cached or fresh value\n            value.state !== 'cached' ||\n                value.createdAt + value.ttl > Date.now()) {\n                return value;\n            }\n            if (value.data.headers &&\n                // Any header below allows the response to stale\n                (Header.ETag in value.data.headers ||\n                    Header.LastModified in value.data.headers ||\n                    Header.XAxiosCacheEtag in value.data.headers ||\n                    Header.XAxiosCacheStaleIfError in value.data.headers ||\n                    Header.XAxiosCacheLastModified in value.data.headers)) {\n                const stale = {\n                    state: 'stale',\n                    createdAt: value.createdAt,\n                    data: value.data\n                };\n                await set(key, stale);\n                return stale;\n            }\n            await remove(key);\n            return { state: 'empty' };\n        }\n    };\n}\n","import { buildStorage } from './build';\n/**\n * Creates a simple in-memory storage. This means that if you need to persist data between\n * page or server reloads, this will not help.\n *\n * This is the storage used by default.\n *\n * If you need to modify it's data, you can do by the `data` property.\n *\n * @example\n *\n * ```js\n * const memoryStorage = buildMemoryStorage();\n *\n * setupCache(axios, { storage: memoryStorage });\n *\n * // Simple example to force delete the request cache\n *\n * const { id } = axios.get('url');\n *\n * delete memoryStorage.data[id];\n * ```\n */\nexport function buildMemoryStorage() {\n    const data = {};\n    const storage = buildStorage({\n        find: (key) => data[key],\n        set: (key, value) => {\n            data[key] = value;\n        },\n        remove: (key) => {\n            delete data[key];\n        }\n    });\n    return Object.assign(Object.assign({}, storage), { data });\n}\n","import { code } from 'object-code';\n// Remove first and last '/' char, if present\nconst SLASHES_REGEX = /^\\/|\\/$/g;\nexport function buildKeyGenerator(hash, generator) {\n    return (request) => {\n        if (request.id) {\n            return request.id;\n        }\n        // Remove trailing slashes\n        request.baseURL && (request.baseURL = request.baseURL.replace(SLASHES_REGEX, ''));\n        request.url && (request.url = request.url.replace(SLASHES_REGEX, ''));\n        // lowercase method\n        request.method && (request.method = request.method.toLowerCase());\n        const result = generator(request);\n        return hash ? code(result).toString() : result;\n    };\n}\nexport const defaultKeyGenerator = buildKeyGenerator(true, ({ baseURL = '', url = '', method = 'get', params, data }) => {\n    return {\n        url: baseURL + (baseURL && url ? '/' : '') + url,\n        method,\n        params: params,\n        data\n    };\n});\n","import { defaultHeaderInterpreter } from '../header/interpreter';\nimport { defaultRequestInterceptor } from '../interceptors/request';\nimport { defaultResponseInterceptor } from '../interceptors/response';\nimport { isStorage } from '../storage/build';\nimport { buildMemoryStorage } from '../storage/memory';\nimport { defaultKeyGenerator } from '../util/key-generator';\n/**\n * Apply the caching interceptors for a already created axios instance.\n *\n * @example\n *\n * ```ts\n * import Axios from 'axios';\n * import { setupCache, AxiosCacheInstance } from 'axios-cache-interceptor';\n *\n * // instance will have our custom typings from the return of this function\n * const instance = setupCache(\n *   Axios.create({\n *     // Axios options\n *   }),\n *   {\n *     // Axios-cache-interceptor options\n *   }\n * );\n *\n * // OR\n *\n * const instance = axios.create({\n *   // Axios options\n * }) as AxiosCacheInstance;\n *\n * // As this functions returns the same axios instance but only with\n * // different typings, you can ignore the function return.\n * setupCache(instance, {\n *   // Axios-cache-interceptor options\n * });\n * ```\n *\n * @param axios The already created axios instance\n * @param config The config for the caching interceptors\n * @returns The same instance with extended typescript types.\n */\nexport function setupCache(axios, options = {}) {\n    var _a, _b, _c, _d, _e;\n    const axiosCache = axios;\n    axiosCache.storage = options.storage || buildMemoryStorage();\n    if (!isStorage(axiosCache.storage)) {\n        throw new Error('Use buildStorage() function');\n    }\n    axiosCache.generateKey = options.generateKey || defaultKeyGenerator;\n    axiosCache.waiting = options.waiting || {};\n    axiosCache.headerInterpreter = options.headerInterpreter || defaultHeaderInterpreter;\n    axiosCache.requestInterceptor =\n        options.requestInterceptor || defaultRequestInterceptor(axiosCache);\n    axiosCache.responseInterceptor =\n        options.responseInterceptor || defaultResponseInterceptor(axiosCache);\n    // CacheRequestConfig values\n    axiosCache.defaults.cache = {\n        ttl: (_a = options.ttl) !== null && _a !== void 0 ? _a : 1000 * 60 * 5,\n        interpretHeader: (_b = options.interpretHeader) !== null && _b !== void 0 ? _b : false,\n        methods: options.methods || ['get'],\n        cachePredicate: options.cachePredicate || {\n            statusCheck: (status) => status >= 200 && status < 400\n        },\n        etag: (_c = options.etag) !== null && _c !== void 0 ? _c : false,\n        modifiedSince: (_d = options.modifiedSince) !== null && _d !== void 0 ? _d : false,\n        staleIfError: (_e = options.staleIfError) !== null && _e !== void 0 ? _e : false,\n        update: options.update || {}\n    };\n    // Apply interceptors\n    axiosCache.requestInterceptor.apply();\n    axiosCache.responseInterceptor.apply();\n    return axiosCache;\n}\n","import { buildStorage } from './build';\n/**\n * Creates a simple storage. You can persist his data by using `sessionStorage` or\n * `localStorage` with it.\n *\n * **ImplNote**: Without polyfill, this storage only works on browser environments.\n *\n * @example\n *\n * ```js\n * const fromLocalStorage = buildWebStorage(localStorage);\n * const fromSessionStorage = buildWebStorage(sessionStorage);\n *\n * const myStorage = new Storage();\n * const fromMyStorage = buildWebStorage(myStorage);\n * ```\n *\n * @param prefix The prefix to index the storage. Useful to prevent collision between\n *   multiple places using the same storage.\n */\nexport function buildWebStorage(storage, prefix = '') {\n    return buildStorage({\n        find: (key) => {\n            const json = storage.getItem(prefix + key);\n            return json ? JSON.parse(json) : undefined;\n        },\n        set: (key, value) => {\n            storage.setItem(prefix + key, JSON.stringify(value));\n        },\n        remove: (key) => {\n            storage.removeItem(prefix + key);\n        }\n    });\n}\n"],"names":["root","factory","exports","module","define","amd","self","this","e","r","Symbol","deferred","n","t","Promise","resolve","reject","isDeferred","transform","Date","getTime","RegExp","toString","o","Array","isArray","String","constructor","JSON","stringify","Object","keys","sort","Math","random","code","length","charCodeAt","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","toStringTag","value","Number","Infinity","Header","freeze","IfModifiedSince","LastModified","IfNoneMatch","CacheControl","ETag","Expires","Age","ContentType","XAxiosCacheEtag","XAxiosCacheLastModified","XAxiosCacheStaleIfError","defaultHeaderInterpreter","headers","cacheControl","noCache","noStore","mustRevalidate","maxAge","immutable","a","i","toLowerCase","replace","split","s","maxStale","minFresh","mustUnderstand","noTransform","onlyIfCached","private","proxyRevalidate","public","sMaxAge","staleIfError","staleWhileRevalidate","age","expires","milliseconds","parse","now","createValidateStatus","oldValidate","status","isMethodIn","requestMethod","methodList","method","updateStaleRequest","cache","config","_a","etag","modifiedSince","etagValue","data","createdAt","toUTCString","createCacheResponse","response","cached","statusText","assign","defaultRequestInterceptor","axios","onFulfilled","async","defaults","methods","id","generateKey","cachedResponse","storage","emptyOrStale","state","waiting","catch","set","previous","validateStatus","remove","_b","adapter","apply","interceptors","request","use","testCachePredicate","predicate","statusCheck","responseMatch","containsHeaders","header","updateCache","entries","cacheKey","oldValue","newValue","defaultResponseInterceptor","rejectResponse","responseId","_c","_d","cacheConfig","cachePredicate","startsWith","ttl","interpretHeader","expirationTime","headerInterpreter","update","newCache","onRejected","error","isStorage","buildStorage","find","stale","buildMemoryStorage","SLASHES_REGEX","buildKeyGenerator","hash","generator","baseURL","url","result","defaultKeyGenerator","params","setupCache","options","_e","axiosCache","Error","requestInterceptor","responseInterceptor","buildWebStorage","prefix","json","getItem","setItem","removeItem"],"sourceRoot":""}