import{v as f,a0 as v,Z as w,r as m,c as r,a1 as p}from"./jwt-decode.esm.fbcfeaec.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]="86820f40-e78c-4aea-a1c4-c9f83597c919",t._sentryDebugIdIdentifier="sentry-dbid-86820f40-e78c-4aea-a1c4-c9f83597c919")}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=a=>{t.set(a),e.value=a},u=()=>{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?_(e.value):null),i=r(()=>{var a;return(a=n.value)==null?void 0:a.email}),d=()=>n.value?n.value.expiresInSeconds-Date.now()>y:!1;return u(),{jwt:e,email:i,saveJWT:o,removeJWT:s,isJWTValid:d,authHeaders:l,wsAuthHeaders:c}});export{g as u};
//# sourceMappingURL=userStore.5192b178.js.map
