define(["components/chat/module"],function(a){"use strict";a.registerDirective("chatWidget",["ChatApi",function(a){return{replace:!0,restrict:"E",templateUrl:"build/components/chat/directives/chat-widget.tpl.html",scope:{},link:function(b,c){b.newMessage="",b.sendMessage=function(){a.sendMessage(b.newMessage),b.newMessage=""},b.messageTo=function(a){b.newMessage+=a.username+", "},a.initialized.then(function(){b.chatMessages=a.messages}),b.$watch(function(){return a.messages.length},function(a){if(a){var b=$(".chat-body",c);b.animate({scrollTop:b[0].scrollHeight})}})}}}])});