import{v as f,a0 as v,Z as w,r as b,c as a,a1 as m}from"./jwt-decode.esm.32f71954.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]="c4a50997-d1be-4478-8f62-7e4993ddf7ee",t._sentryDebugIdIdentifier="sentry-dbid-c4a50997-d1be-4478-8f62-7e4993ddf7ee")}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(w.string(),"auth:jwt"),e=b(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}`}:{}),d=a(()=>e.value?["default",`base64url.bearer.authorization.${e.value}`]:[]),n=a(()=>e.value?y(e.value):null),c=a(()=>{var r;return(r=n.value)==null?void 0:r.email}),i=()=>n.value?n.value.expiresInSeconds-Date.now()>p:!1;return u(),{jwt:e,email:c,saveJWT:o,removeJWT:s,isJWTValid:i,authHeaders:l,wsAuthHeaders:d}});export{g as u};
//# sourceMappingURL=userStore.339db438.js.map
