{"version":3,"file":"446.b237df4f2b2d44b7.js","sources":["webpack://storefronts/./node_modules/jwt-decode/build/esm/index.js"],"sourcesContent":["export class InvalidTokenError extends Error {\n}\nInvalidTokenError.prototype.name = \"InvalidTokenError\";\nfunction b64DecodeUnicode(str) {\n return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {\n let code = p.charCodeAt(0).toString(16).toUpperCase();\n if (code.length < 2) {\n code = \"0\" + code;\n }\n return \"%\" + code;\n }));\n}\nfunction base64UrlDecode(str) {\n let output = str.replace(/-/g, \"+\").replace(/_/g, \"/\");\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += \"==\";\n break;\n case 3:\n output += \"=\";\n break;\n default:\n throw new Error(\"base64 string is not of the correct length\");\n }\n try {\n return b64DecodeUnicode(output);\n }\n catch (err) {\n return atob(output);\n }\n}\nexport function jwtDecode(token, options) {\n if (typeof token !== \"string\") {\n throw new InvalidTokenError(\"Invalid token specified: must be a string\");\n }\n options || (options = {});\n const pos = options.header === true ? 0 : 1;\n const part = token.split(\".\")[pos];\n if (typeof part !== \"string\") {\n throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`);\n }\n let decoded;\n try {\n decoded = base64UrlDecode(part);\n }\n catch (e) {\n throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`);\n }\n try {\n return JSON.parse(decoded);\n }\n catch (e) {\n throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`);\n }\n}\n"],"names":["InvalidTokenError","Error","jwtDecode","token","options","decoded","pos","part","base64UrlDecode","str","output","decodeURIComponent","atob","m","p","code","err","e","JSON"],"mappings":"yKAAO,OAAMA,UAA0BC,MACvC,CAgCO,SAASC,EAAUC,CAAK,CAAEC,CAAO,MAUhCC,EATJ,GAAI,AAAiB,UAAjB,OAAOF,EACP,MAAM,IAAIH,EAAkB,4CAEhCI,CAAAA,GAAYA,CAAAA,EAAU,CAAC,GACvB,IAAME,EAAMF,CAAAA,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