var __hasProp=Object.prototype.hasOwnProperty,__extends=function(a,b){function d(){this.constructor=a}for(var c in b)__hasProp.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a},__bind=function(a,b){return function(){return a.apply(b,arguments)}};define(["backbone","underscore"],function(a,b){var c,d,e,f,g;return c={debug:0,info:1,warning:2,error:3,critical:4},f=function(){function b(){b.__super__.constructor.apply(this,arguments)}return __extends(b,a.Model),b.prototype.defaults={level:"info",timeout:3e3},b}(),d=function(){function b(){this.log=__bind(this.log,this),b.__super__.constructor.apply(this,arguments)}return __extends(b,a.Collection),b.prototype.model=f,b.prototype.initialize=function(){return App.hub.subscribe("log",this.log)},b.prototype.log=function(b){if(b instanceof a.Model)return this.add(b),console.log(b)},b}(),g=function(){function c(){c.__super__.constructor.apply(this,arguments)}return __extends(c,a.View),c.prototype.template=b.template('<div class="message <%= level %>"><%= message %></div>'),c.prototype.render=function(){return this.el=this.$(this.template(this.model.get("message"))),this},c.prototype.show=function(){return this.el.fadeIn(500)},c.prototype.hide=function(){return this.el.fadeOut(300)},c}(),e=function(){function c(){this.dismiss=__bind(this.dismiss,this),this.log=__bind(this.log,this),c.__super__.constructor.apply(this,arguments)}return __extends(c,a.View),c.prototype.el="#messages",c.prototype.initialize=function(){return App.hub.subscribe("log",this.log),App.hub.subscribe("dismiss",this.dismiss),this.modelViews={}},c.prototype.log=function(c){var d;c instanceof a.View||(d=c,c=new g({model:d}),this.modelViews[d]=c),this.el.append(c.el.hide()),c.show();if(c.timeout)return this._messageTimer=b.delay(function(){return c.hide()},c.timeout)},c.prototype.dismiss=function(b){var c;b instanceof a.View||(c=b,b=this.modelViews[c],delete this.modelViews[c]);if(b)return clearTimeout(this._messageTimer),b.hide()},c}(),{Message:f,MessageView:g,Log:d,LogView:e}})