text: /* 
  * Fire Comments JS v0.3.2 (https://github.com/theakshaydhiman/Fire-Comments-JS)
  * Copyright 2018 Akshay Dhiman
  * MIT License (https://github.com/theakshaydhiman/Fire-Comments-JS/blob/master/LICENSE)
  */
  
  'use strict';var _createClass=function(){function a(b,d){for(var h,f=0;f<d.length;f++)h=d[f],h.enumerable=h.enumerable||!1,h.configurable=!0,'value'in h&&(h.writable=!0),Object.defineProperty(b,h.key,h)}return function(b,d,f){return d&&a(b.prototype,d),f&&a(b,f),b}}();function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}(function(){'use strict';var a=function(){function k(){_classCallCheck(this,k),this.comment=this.id('comment'),this.reply=this.id('reply'),this.commentsCount=this.id('comments-count'),this.ulList=this.id('comments-list'),this.cancelReply=this.id('cancel-reply'),this.notif=this.id('notif'),this.commentsRef=firebase.database().ref('comments').child(this.slugify(window.location.pathname))}return _createClass(k,[{key:'slugify',value:function slugify(l){return l.toString().toLowerCase().trim().replace(/&/g,'-and-').replace(/[\s\W-]+/g,'-').replace(/[^a-zA-Z0-9-_]+/g,'')}},{key:'id',value:function id(l){return document.getElementById(l)}},{key:'getVal',value:function getVal(l){return document.getElementById(l).value}},{key:'commentsCountShow',value:function commentsCountShow(l){this.commentsCount.innerText=l}}]),k}(),b=function(k){function l(){_classCallCheck(this,l);var m=_possibleConstructorReturn(this,(l.__proto__||Object.getPrototypeOf(l)).call(this));return m.fexecuted=!0,m.linkKey='',m}return _inherits(l,k),_createClass(l,[{key:'saveComment',value:function saveComment(m,n,o){this.commentsRef.push().set({name:m,message:o,md5Email:n,postedAt:firebase.database.ServerValue.TIMESTAMP})}},{key:'saveReply',value:function saveReply(m,n,o){this.fexecuted||this.commentsRef.child(this.linkKey).child('replies').push().set({name:m,message:o,md5Email:n,postedAt:firebase.database.ServerValue.TIMESTAMP})}},{key:'toggleReplyForm',value:function toggleReplyForm(m,n){this.reply.style.display=m,this.comment.style.display=n}}]),l}(a),d=function(k){function l(m){_classCallCheck(this,l);var n=_possibleConstructorReturn(this,(l.__proto__||Object.getPrototypeOf(l)).call(this));return n.key=m.key,n.c=m.val(),n.li=document.createElement('li'),n.html='',n}return _inherits(l,k),_createClass(l,[{key:'makeNoFollow',value:function makeNoFollow(m){return m=m.replace('<a ','<a target="_blank" rel="nofollow noopener" '),m}},{key:'showComments',value:function showComments(){this.c.message=this.makeNoFollow(this.c.message),this.html=this.createMarkup(this.c,'comment'),this.li.innerHTML=this.html,this.ulList.appendChild(this.li),this.showReplies()}},{key:'showReplies',value:function showReplies(){var n=this,m=firebase.database().ref('comments/'+this.slugify(window.location.pathname)+'/'+this.key+'/replies');m.on('child_added',function(o){var p=o.val(),q=document.createElement('li');p.message=n.makeNoFollow(p.message);var u=n.createMarkup(p,'reply');q.innerHTML=u,n.ulList.appendChild(q),f+=1})}},{key:'createMarkup',value:function createMarkup(m,n){var o;'comment'===n?o='comment':'reply'==n&&(o='reply');var p='<div class="'+o+'-item">\n        <div class="left"><img class="author-grav" src="https://www.gravatar.com/avatar/'+m.md5Email+'?s=80&d=retro"></div>\n        <h3>'+xssFilters.inHTMLData(m.name)+'</h3>\n        <small>'+timeago().format(m.postedAt)+'</small>\n        <p>'+xssFilters.inHTMLComment(m.message)+'</p>\n        <button class="comment-reply btn" data-id="'+this.key+'">Reply</button>\n        </div>';return p}}]),l}(a),f=0,h=new a,j=new b;comment.addEventListener('submit',function(k){var l=h.getVal('name'),m=h.getVal('message'),n=md5(h.getVal('email'));k.preventDefault(),j.saveComment(l,n,m),h.notif.style.display='block',setTimeout(function(){h.notif.style.display='none'},3e3),comment.reset()}),document.addEventListener('click',function(k){k.target.classList.contains('comment-reply')&&(j.linkKey=k.target.dataset.id,j.fexecuted=!1,k.target.insertAdjacentElement('afterend',h.reply),j.toggleReplyForm('block','none'))}),h.reply.addEventListener('submit',function(k){var l=h.getVal('name'),m=h.getVal('message'),n=md5(h.getVal('email'));k.preventDefault(),j.saveReply(l,n,m),h.reply.reset(),j.toggleReplyForm('none','block'),h.notif.style.display='block',setTimeout(function(){h.notif.style.display='none',window.location.reload()},3e3),j.fexecuted=!0}),h.cancelReply.addEventListener('click',function(){j.toggleReplyForm('none','block'),j.linkKey=null,j.fexecuted=!0}),h.commentsRef.on('child_added',function(k){var l=new d(k);l.showComments()}),h.commentsRef.once('value').then(function(k){h.commentsCountShow(k.numChildren()+f)})})();