generateur_v3/frontend_old/node_modules/.vite/deps/jwt-decode.js
2022-12-27 18:26:05 +01:00

64 lines
1.9 KiB
JavaScript

import "./chunk-7FP5O474.js";
// node_modules/.pnpm/jwt-decode@3.1.2/node_modules/jwt-decode/build/jwt-decode.esm.js
function e(e2) {
this.message = e2;
}
e.prototype = new Error(), e.prototype.name = "InvalidCharacterError";
var r = "undefined" != typeof window && window.atob && window.atob.bind(window) || function(r2) {
var t2 = String(r2).replace(/=+$/, "");
if (t2.length % 4 == 1)
throw new e("'atob' failed: The string to be decoded is not correctly encoded.");
for (var n2, o2, a = 0, i = 0, c = ""; o2 = t2.charAt(i++); ~o2 && (n2 = a % 4 ? 64 * n2 + o2 : o2, a++ % 4) ? c += String.fromCharCode(255 & n2 >> (-2 * a & 6)) : 0)
o2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o2);
return c;
};
function t(e2) {
var t2 = e2.replace(/-/g, "+").replace(/_/g, "/");
switch (t2.length % 4) {
case 0:
break;
case 2:
t2 += "==";
break;
case 3:
t2 += "=";
break;
default:
throw "Illegal base64url string!";
}
try {
return function(e3) {
return decodeURIComponent(r(e3).replace(/(.)/g, function(e4, r2) {
var t3 = r2.charCodeAt(0).toString(16).toUpperCase();
return t3.length < 2 && (t3 = "0" + t3), "%" + t3;
}));
}(t2);
} catch (e3) {
return r(t2);
}
}
function n(e2) {
this.message = e2;
}
function o(e2, r2) {
if ("string" != typeof e2)
throw new n("Invalid token specified");
var o2 = true === (r2 = r2 || {}).header ? 0 : 1;
try {
return JSON.parse(t(e2.split(".")[o2]));
} catch (e3) {
throw new n("Invalid token specified: " + e3.message);
}
}
n.prototype = new Error(), n.prototype.name = "InvalidTokenError";
var jwt_decode_esm_default = o;
// dep:jwt-decode
var jwt_decode_default = jwt_decode_esm_default;
export {
n as InvalidTokenError,
jwt_decode_default as default
};
//# sourceMappingURL=jwt-decode.js.map