const tokenRegex = /.*\.(.*)\..*/;
export function decodeToken() {
    const token = window.sessionStorage.getItem("eden_token");
    if (!token)
        return;
    const extracted = tokenRegex.exec(token);
    if (extracted === null || extracted.length !== 2)
        return;
    const value = extracted[1];
    const decoded = decodeURIComponent(escape(atob(value)));
    try {
        return JSON.parse(decoded);
    }
    catch {
    }
}
