import View from"./view.mjs";import sessions from"../../sessions.mjs";export default class GameView extends View{route="/game";_template="game";_methods=["get"];async handleGet(e,r){try{this.constructor.assertDocumentDestination(e)}catch(e){return r.status(401).send(e.message)}if(!game.world)return this._noWorld(e,r);const t=sessions.getOrCreate(e,r);if(!e.user)return t.gameRedirect={world:game.world.id,path:e.originalUrl},r.redirect(`${e.baseUrl}/join`);if(!await db.User.get(e.user))return logger.error(Error(`User ${e.user} not found!`)),t.gameRedirect={world:game.world.id,path:e.originalUrl},r.redirect(`${e.baseUrl}/join`);t.firstLaunch&&=!1;const s=await db.Setting.getValue("core.moduleConfiguration")||{},i=View._getStaticContent({world:!0,moduleConfig:s});r.render(this._template,{scripts:i.scripts,styles:i.styles,watermark:null})}}