import{d as f,L as v,z as w,r as b,c as a,o as m}from"./jwt-decode.esm-BUhVyVlz.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]="677cefe4-a9e6-41c7-96a8-a73b4f4ff32a",t._sentryDebugIdIdentifier="sentry-dbid-677cefe4-a9e6-41c7-96a8-a73b4f4ff32a")}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),n=()=>{e.value=null,t.remove()},u=o=>{t.set(o),e.value=o},s=()=>{e.value=t.get()},l=a(()=>e.value?{Authorization:`Bearer ${e.value}`}:{}),c=a(()=>e.value?["default",`base64url.bearer.authorization.${e.value}`]:[]),r=a(()=>e.value?y(e.value):null),i=a(()=>r.value?.email),d=()=>r.value?r.value.expiresInMs-Date.now()>p:!1;return s(),{jwt:e,email:i,saveJWT:u,removeJWT:n,loadJWT:s,isJWTValid:d,authHeaders:l,wsAuthHeaders:c}});export{h as u};
//# sourceMappingURL=userStore-BE74D4vD.js.map
