import{d as f,L as v,z as w,r as b,b as r,o as m}from"./jwt-decode.esm-CuqABuF0.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]="f4c88072-3293-47a7-854f-b23c0882104e",t._sentryDebugIdIdentifier="sentry-dbid-f4c88072-3293-47a7-854f-b23c0882104e")}catch{}})();const p=7200*1e3,y=t=>{try{const e=m(t);if(!e.exp)throw Error("expired jwt");return{email:e.email,expiresInMs:e.exp*1e3}}catch{console.warn("Invalid JWT")}return null},h=f("user",()=>{const t=new v(w.string(),"auth:jwt"),e=b(null),a=()=>{e.value=null,t.remove()},u=o=>{t.set(o),e.value=o},s=()=>{e.value=t.get()},l=r(()=>e.value?{Authorization:`Bearer ${e.value}`}:{}),c=r(()=>e.value?["default",`base64url.bearer.authorization.${e.value}`]:[]),n=r(()=>e.value?y(e.value):null),i=r(()=>n.value?.email),d=()=>n.value?n.value.expiresInMs-Date.now()>p:!1;return s(),{jwt:e,email:i,saveJWT:u,removeJWT:a,loadJWT:s,isJWTValid:d,authHeaders:l,wsAuthHeaders:c}});export{h as u};
//# sourceMappingURL=userStore-gUmjnlUt.js.map
