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