const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/authStore-BvQBJ9ky.js","assets/react-B8IZ02wI.js","assets/preload-helper-zJ_50EbN.js"])))=>i.map(i=>d[i]);
import{r as e}from"./react-B8IZ02wI.js";import{t}from"./preload-helper-zJ_50EbN.js";var n=e({getJwtExpireMs:()=>i,isAccessTokenExpired:()=>a,isSessionExpiredPayload:()=>o,redirectToLogin:()=>s}),r=!1;function i(e){if(!e)return null;try{let t=e.split(`.`)[1];if(!t)return null;let n=atob(t.replace(/-/g,`+`).replace(/_/g,`/`)),r=JSON.parse(n);return r.exp?r.exp*1e3:null}catch{return null}}function a(e,t=5e3){let n=i(e);return n==null?!1:Date.now()>=n-t}function o(e,t){if(e!==10003)return!1;let n=String(t||``);return/未登录|Token\s*已过期|已离职|用户不存在/.test(n)}function s(e=`session_expired`){if(typeof window>`u`||r)return;let n=`${window.location.pathname}${window.location.search}`;if(n.startsWith(`/login`)){r=!1;return}r=!0,t(async()=>{let{useAuthStore:e}=await import(`./authStore-BvQBJ9ky.js`).then(e=>e.t);return{useAuthStore:e}},__vite__mapDeps([0,1,2])).then(({useAuthStore:t})=>{t.getState().logout();let r=encodeURIComponent(n);window.location.assign(`/login?reason=${e}&from=${r}`)})}export{n as i,o as n,s as r,a as t};