Build 545032stable
Module 390310
1,041 characters · in 55e2903546517464.jsDependencies
Source Raw
function(t,e,s){s.d(e,{r:()=>m,Y:()=>g});var i=s(64700),n=s(989349),a=s.n(n),r=s(17928),l=s(495544),d=s(228366);let c=[];function o(){c=[]}class x extends r.Ay.Store{static displayName="AuthSessionsStore";getSessions(){return c}}let h=new x(d.h,{LOGOUT:o,LOGIN_SUCCESS:o,FETCH_AUTH_SESSIONS_SUCCESS:function(t){let{sessions:e}=t;c=e.map(t=>({...t,approx_last_used_time:new Date(t.approx_last_used_time)}))},LOGOUT_AUTH_SESSIONS_SUCCESS:function(t){let{sessionIdHashes:e}=t,s=[...c],i=!1;for(let t of e){let e=s.findIndex(e=>e.id_hash===t);e>=0&&(s.splice(e,1),i=!0)}if(!i)return!1;c=s}});var u=s(375708);function m(){let t=(0,r.cf)([h],()=>h.getSessions());return i.useMemo(()=>{let e=[...t],s=null,i=l.default.getAuthSessionIdHash();if(null!=i){let t=e.findIndex(t=>t.id_hash===i);t>=0&&(s=e.splice(t,1)[0])}return e.sort((t,e)=>e.approx_last_used_time.valueOf()-t.approx_last_used_time.valueOf()),{currentSession:s,otherSessions:e}},[t])}function g(t){return(Date.now()-t.valueOf())/1e3/60/60<1?u.intl.string(u.t.TXCmfL):a()(t).fromNow()}}