import{q as f,O as v,L as b,r as w,c as r,Q as m}from"./jwt-decode.esm.28320b05.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[e]="891bbf5a-5adc-42a5-876d-6c6f4a74a8d1",a._sentryDebugIdIdentifier="sentry-dbid-891bbf5a-5adc-42a5-876d-6c6f4a74a8d1")}catch{}})();const p=2*60*60,y=a=>{try{const e=m(a);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 a=new v(b.string(),"auth:jwt"),e=w(null),s=()=>{e.value=null,a.remove()},o=t=>{a.set(t),e.value=t},u=()=>{e.value=a.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),d=r(()=>{var t;return(t=n.value)==null?void 0:t.email}),i=()=>n.value?n.value.expiresInSeconds-Date.now()>p:!1;return u(),{jwt:e,email:d,saveJWT:o,removeJWT:s,isJWTValid:i,authHeaders:l,wsAuthHeaders:c}});export{g as u};
//# sourceMappingURL=userStore.c0562f9d.js.map
