import{K as e,L as t,n,t as r}from"./index-OiQ-fHeQ.js";async function i(i,a){try{let o=i();if(!o)return e.log(`No session stored; continuing without a client`),null;e.log(`Using a standalone client`);let{user_id:s,device_id:c,access_token:l,passwordlessUser:u}=o,d={baseUrl:n.defaultHomeserverUrl(),accessToken:l,userId:s,deviceId:c,fallbackICEServerAllowed:!1,livekitServiceURL:n.get().livekit?.livekit_service_url};try{return{widgetApi:null,client:await r(d,!0),passwordlessUser:u}}catch(n){if(n instanceof t&&n.errcode===`M_UNKNOWN_TOKEN`)return e.log(`The session from local store is invalid; continuing without a client`),a(),null;throw n}}catch(e){throw a(),e}}export{i as initSPA};
//# sourceMappingURL=spa-Z5Bwq0Gp.js.map