import{k as f,O as v,L as b,r as w,c as a,Q as m}from"./jwt-decode.esm.54a1ea22.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]="630987ab-5f72-40ec-84ae-28cf5b3c77eb",t._sentryDebugIdIdentifier="sentry-dbid-630987ab-5f72-40ec-84ae-28cf5b3c77eb")}catch{}})();const p=2*60*60,y=t=>{try{const e=m(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(b.string(),"auth:jwt"),e=w(null),s=()=>{e.value=null,t.remove()},o=r=>{t.set(r),e.value=r},u=()=>{e.value=t.get()},l=a(()=>e.value?{Authorization:`Bearer ${e.value}`}:{}),c=a(()=>e.value?["default",`base64url.bearer.authorization.${e.value}`]:[]),n=a(()=>e.value?y(e.value):null),i=a(()=>{var r;return(r=n.value)==null?void 0:r.email}),d=()=>n.value?n.value.expiresInSeconds-Date.now()>p:!1;return u(),{jwt:e,email:i,saveJWT:o,removeJWT:s,isJWTValid:d,authHeaders:l,wsAuthHeaders:c}});export{g as u};
//# sourceMappingURL=userStore.6ab1e5ac.js.map
