!function(e){function t(o){if(i[o])return i[o].exports;var r=i[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerPrimitive("a-log",{defaultComponents:{geometry:{primitive:"plane",height:5},log:{},material:{color:"#111",shader:"flat",side:"double"},text:{color:"lightgreen",baseline:"top",align:"center",height:5}},mappings:{channel:"log.channel"}}),AFRAME.registerSystem("log",{schema:{console:{default:!0}},init:function(){var e=this.data,t=this.logs=[],i=this.loggers=[];AFRAME.log=function(o,r){t.push([o,r]),i.forEach(function(e){e.receiveLog(o,r)}),e.console&&console.log("[log:"+(r||"")+"] "+o)}},registerLogger:function(e){this.loggers.push(e),this.logs.forEach(function(t){e.receiveLog.apply(e,t)})},unregisterLogger:function(e){this.loggers.splice(this.loggers.indexOf(e),1)}}),AFRAME.registerComponent("log",{schema:{channel:{type:"string"},filter:{type:"string"},max:{default:100},showErrors:{default:!0}},init:function(){this.logs=[],this.system.registerLogger(this)},play:function(){var e=this;this.el.sceneEl.addEventListener("log",function(t){t.detail&&e.receiveLog(t.detail.message,t.detail.channel)}),window.onerror=function(t,i,o,r,n){e.receiveLog("Error: "+t)}},receiveLog:function(e,t){var i=this.data;"string"!=typeof e&&(e=JSON.stringify(e)),i.channel&&t&&i.channel!==t||i.filter&&e.indexOf(i.filter)===-1||(this.logs.push(e),i.max&&this.logs.length>i.max&&this.logs.shift(),this.el.setAttribute("text",{value:this.logs.join("\n")}))},remove:function(){this.el.removeAttribute("text"),this.system.unregisterLogger(this)}})}]);