import{q as f,O as v,L as w,r as m,c as n,Q as p}from"./jwt-decode.esm.d86c27e0.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]="098dec23-de53-4325-9dde-cffd1c0f2114",t._sentryDebugIdIdentifier="sentry-dbid-098dec23-de53-4325-9dde-cffd1c0f2114")}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),a=()=>{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}`}:{}),d=n(()=>e.value?["default",`base64url.bearer.authorization.${e.value}`]:[]),s=n(()=>e.value?_(e.value):null),c=n(()=>{var r;return(r=s.value)==null?void 0:r.email}),i=()=>s.value?s.value.expiresInSeconds-Date.now()>y:!1;return u(),{jwt:e,email:c,saveJWT:o,removeJWT:a,isJWTValid:i,authHeaders:l,wsAuthHeaders:d}});export{g as u};
//# sourceMappingURL=userStore.f2537ff3.js.map
