import{q as f,O as v,L as w,r as b,c as r,Q as m}from"./jwt-decode.esm.43a112d3.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]="439175e9-97ed-4f85-b01a-fe33453aa70f",t._sentryDebugIdIdentifier="sentry-dbid-439175e9-97ed-4f85-b01a-fe33453aa70f")}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=a=>{t.set(a),e.value=a},u=()=>{e.value=t.get()},l=r(()=>e.value?{Authorization:`Bearer ${e.value}`}:{}),i=r(()=>e.value?["default",`base64url.bearer.authorization.${e.value}`]:[]),n=r(()=>e.value?y(e.value):null),c=r(()=>{var a;return(a=n.value)==null?void 0:a.email}),d=()=>n.value?n.value.expiresInSeconds-Date.now()>p:!1;return u(),{jwt:e,email:c,saveJWT:o,removeJWT:s,isJWTValid:d,authHeaders:l,wsAuthHeaders:i}});export{g as u};
//# sourceMappingURL=userStore.05a27538.js.map
