(()=>{"use strict";constt=newclass{constructor(){this.states=newMap}get(t){returnthis.states.get(t)}set(t,e){returnthis.states.set(t,e)}};classe{constructor(){this.inventory=[],this.currentRoom="start"}}classi{speak(t){}stop(){}setOptions(t){}}classsextendsi{constructor(t={}){super(),this.timeout=100,this.timeout=t.timeout||100,this.init()}init(){this.container=document.createElement("div"),this.container.setAttribute("aria-live","polite"),this.speechDisplay=document.createElement("div"),this.speechDisplay.setAttribute("aria-live","polite"),this.container.append(this.speechDisplay),document.body.appendChild(this.container),document.body.insertBefore(this.container,document.body.firstChild)}speak(t){this.clearDisplay();conste=document.createTextNode(t),i=document.createElement("p");i.appendChild(e),this.speechDisplay.appendChild(i),setTimeout(this.clearDisplay.bind(this),this.timeout)}stop(){this.clearDisplay()}clearDisplay(){this.speechDisplay.innerHTML=""}}classnextendsi{}classo{constructor(t=function(t="aria"){return"webtts"===t?n:s}()){this.output=t}speak(t){this.output.speak(t)}stop(){this.output.stop()}}classa{constructor(){this.tts=newo(news),this.history=document.getElementById("output-area")}say(t){conste=document.createElement("p");e.appendChild(document.createTextNode(t)),this.history.appendChild(e)}}classr{constructor(t){this.handler=t,this.inputField=document.getElementById("input-area"),this.init()}init(){this.inputField.addEventListener("keydown",(t=>{if(13==t.which){constt=this.inputField.value;this.inputField.value="",this.handler.doCommand(t)}}))}}consth=[[["look","l"],function(t,e){if(1==t.length)e.examineRoom();else{consti=e.getRoom(e.player.currentRoom).getItems();lets=null;for(leteofi)if(e.name.includes(t[1])){s=e;break}s?(e.output.say(s.name),e.output.say(s.description)):e.output.say(`I could not find a ${t[1]}`)}}],[["use","interact"],asyncfunction(t,e){consti=e.getRoom(e.player.currentRoom).getItems();lets=null;for(leteofi)if(e.name.includes(t[1])){s=e;break}s?awaits.onUse():e.output.say(`I could not find a ${t[1]}`)}]],c=[["n","north"],["ne","northeast"],["e","east"],["se","southeast"],["s","south"],["sw","southwest"],["w","west"],["nw","northwest"],["u","up"],["d","down"]];classl{constructor(t,e){this.context=t,this.commands=e||newMap,this.enabled=!0,this.addDefaultCommands()}doCommand(t){if(!this.enabled)returnvoidthis.context.print("You can't seem to do anything at the moment.");conste=this.context.getRoom(this.context.player.currentRoom),i=t.split(" ");this.commands.get(i[0])&&this.commands.get(i[0])(i,this.context);consts=this.matchDirection(i[0]);e.getExit(s)&&this.context.move(e.getExit(s))}addCommand(t,e){Array.isArray(t)?t.forEach((t=>this.commands.set(t,e))):this.commands.set(t,e)}addCommands(t){t.forEach((t=>{this.addCommand(t[0],t[1])}))}addDefaultCommands(){this.addCommands(h)}matchDirection(t){for(leteofc)if(e[0]==t)returne[1]}}classu{constructor(){this.id="room",this.title="A room",this.description="You see nothing special",this.firstDescription="As you walk into the room, you notice nothing special",this.objects=[],this.exits=newMap,this.enterCallback=null,this.exitCallback=null,this.canEnterLogic=null,this.canExitLogic=null,this.tickCallback=null,this.context=null}asynconEnter(){if(this.enterCallback)returnthis.enterCallback(this.context)}asynconExit(){if(this.exitCallback)returnthis.exitCallback(this.context)}canEnter(){return!this.canEnterLogic||this.canEnterLogic(this.context)}canExit(){return!this.canExitLogic||this.canExitLogic(this.context)}addExit(t,e){returnthis.exits.set(t,e),this}getExit(t){returnthis.exits.get(t)}addItem(t){this.objects.push(t)}addEnterCallback(t){this.enterCallback=t}addExitCallback(t){this.exitCallback=t}addEnterLogic(t){this.canEnterLogic=t}addExitLogic(t){this.canExitLogic=t}addTickCallback(t){this.tickCallback=t}getItems(){returnthis.objects.map((t=>this.context.getItem(t)))}}classm{constructor(){this.room=newu}withID(t){returnthis.room.id=t,this}withTitle(t){returnthis.room.title=t,this}wi