import{v as f,a0 as v,Z as w,r as m,c as n,a1 as p}from"./jwt-decode.esm.c9c37cdc.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="f8ef8c7e-d4ee-4f6e-9e07-7df4603126e3",t._sentryDebugIdIdentifier="sentry-dbid-f8ef8c7e-d4ee-4f6e-9e07-7df4603126e3")}catch{}})();const y=2*60*60,_=t=>{try{const e=p(t);if(!e.exp)throw Error("expired jwt");return{email:e.email,expiresInSeconds:e.exp*1e3}}catch{console.warn("Invalid JWT")}return null},g=f("user",()=>{const t=new v(w.string(),"auth:jwt"),e=m(null),s=()=>{e.value=null,t.remove()},o=r=>{t.set(r),e.value=r},u=()=>{e.value=t.get()},l=n(()=>e.value?{Authorization:`Bearer ${e.value}`}:{}),c=n(()=>e.value?["default",`base64url.bearer.authorization.${e.value}`]:[]),a=n(()=>e.value?_(e.value):null),d=n(()=>{var r;return(r=a.value)==null?void 0:r.email}),i=()=>a.value?a.value.expiresInSeconds-Date.now()>y:!1;return u(),{jwt:e,email:d,saveJWT:o,removeJWT:s,isJWTValid:i,authHeaders:l,wsAuthHeaders:c}});export{g as u};
//# sourceMappingURL=userStore.d962fba4.js.map
