!function(e){!functiont(e,n,o){functioni(s,a){if(!n[s]){if(!e[s]){varl="function"==typeofrequire&&require;if(!a&&l)returnl(s,!0);if(r)returnr(s,!0);thrownewError("Cannot find module '"+s+"'")}varc=n[s]={exports:{}};e[s][0].call(c.exports,function(t){varn=e[s][1][t];returni(n?n:t)},c,c.exports,t,e,n,o)}returnn[s].exports}for(varr="function"==typeofrequire&&require,s=0;s<o.length;s++)i(o[s]);returni}({1:[function(t){varn=e.FrankerFaceZ,o=t("./constants"),i=t("./utils");n.prototype.setup_badges=function(){this.log("Preparing badge system."),this.badges={},this.log("Creating badge style element.");vare=this._badge_style=document.createElement("style");e.id="ffz-badge-css",document.head.appendChild(e),this.log("Adding legacy donor badges."),this._legacy_add_donors()};varr=function(e){return".badges .ffz-badge-"+e.id+" { background-color: "+e.color+'; background-image: url("'+e.image+'"); '+(e.extra_css||"")+"}"};n.prototype.bttv_badges=function(e){vart=e.sender,n=this.users[t],o=[],i=-1;if(n&&n.badges){for(varr=0;r<e.badges.length;r++){vars=e.badges[r];if("subscriber"==s.type||"turbo"==s.type){i=r;break}}for(varainn.badges)if(n.badges.hasOwnProperty(a)){vars=n.badges[a],l=this.badges[s.id]||{},c=s.title||l.title,u="",d=BetterTTV.settings.get("alphaTags");s.image&&(u+='background-image: url(\\"'+s.image+'\\"); '),s.color&&!d&&(u+="background-color: "+s.color+"; "),s.extra_css&&(u+=s.extra_css),u&&(c+='" style="'+u),o.push([(-1==i?1:-1)*a,{type:"ffz-badge-"+s.id+(d?" alpha":""),name:"",description:c}])}if(o.sort(function(e,t){returne[0]-t[0]}),-1==i)for(;o.length;)e.badges.push(o.shift()[1]);elsefor(;o.length;)e.badges.insertAt(i,o.shift()[1])}},n.prototype.render_badge=function(e){vart=e.get("context.model.from"),n=(e.get("context.parentController.content.id"),e.$(".badges")),o=this.users[t];if(o&&o.badges){vari=n.find(".badge").filter(function(){vare=this.title.toLowerCase();return"subscriber"==e||"turbo"==e}).first(),r=[],s=!!i.length;for(varaino.badges)if(o.badges.hasOwnProperty(a)){varl=o.badges[a],c=this.badges[l.id]||{},u=document.createElement("div");u.className="badge float-left tooltip ffz-badge-"+l.id,u.setAttribute("title",l.title||c.title),l.image&&(u.style.backgroundImage='url("'+l.image+'")'),l.color&&(u.style.backgroundColor=l.color),l.extra_css&&(u.style.cssText+=l.extra_css),r.push([(s?1:-1)*a,u])}if(r.sort(function(e,t){returne[0]-t[0]}),s)for(;r.length;)i.before(r.shift()[1]);elsefor(;r.length;)n.append(r.shift()[1])}},n.prototype._legacy_add_donors=function(e){this.badges[1]={id:1,title:"FFZ Donor",color:"#755000",image:"//cdn.frankerfacez.com/channel/global/donoricon.png"},i.update_css(this._badge_style,1,r(this.badges[1])),this.badges[0]={id:0,title:"FFZ Developer",color:"#FAAF19",image:"//cdn.frankerfacez.com/channel/global/devicon.png"},i.update_css(this._badge_style,0,r(this.badges[0])),this.users.sirstendec={badges:{0:{id:0}}},jQuery.ajax(o.SERVER+"script/donors.txt",{cache:!1,context:this}).done(function(e){this._legacy_parse_donors(e)}).fail(function(t){return404!=t.status?(e=(e||0)+1,10>e?this._legacy_add_donors(e):void0):void0})},n.prototype._legacy_parse_donors=function(e){vart=0;if(null!=e)for(varn=e.trim().split(/\W+/),o=0;o<n.length;o++){varr=n[o],s=this.users[r]=this.users[r]||{},a=s.badges=s.badges||{};a[0]||(a[0]={id:1},t+=1)}this.log("Added donor badge to "+i.number_commas(t)+" users.")}},{"./constants":3,"./utils":26}],2:[function(){vart=e.FrankerFaceZ;t.ffz_commands.log=function(e){this._pastebin(this._log_data.join("\n"),function(t){returnt?voidthis.room_message(e,"Your FrankerFaceZ log has been pasted to: "+t):this.room_message(e,"There was an error uploading the FrankerFaceZ log.")})},t.ffz_commands.massunmod=function(e,t){if(t=t.join(" ").trim(),!t.length)return"You must provide a list of users to unmod.";t=t.split(/\W*,\W*/);varn=this.get_user();if(!n||!n.login==e.id)return"You must be the broadcaster to use massunmod.";if(t.length>50)return"Eachuseryouunmodcountsasasinglemessage.Toavoidbeinggloballybanned,pleaselimityou
a&&a[1]&&(s=a[1]);varl={id:e,menu_sets:[s],sets:[s],moderator_badge:null,css:null};returnn&&(n=n.replace(o,"").trim()),n&&(n=n.replace(i,function(e,t){returnl.moderator_badge||"modicon.png"!==t.substr(-11)?e:(l.moderator_badge=t,"")})),l.css=n||null,this._load_room_json(e,t,l)}},{"../constants":3,"../utils":26}],9:[function(){vart=e.FrankerFaceZ;t.prototype.setup_viewers=function(){this.log("Hooking the Ember Viewers controller.");vare=App.__container__.resolve("controller:viewers");this._modify_viewers(e)},t.prototype._modify_viewers=function(e){varn=this;e.reopen({lines:function(){vare=this._super();try{varo=[],i={},r=null,s=App.__container__.lookup("controller:channel"),a=this.get("parentController.model.id"),l=s&&s.get("id");if(l){varc=s.get("display_name");c&&(t.capitalization[l]=[c,Date.now()])}a!=l&&(l=null);for(varu=0;u<e.length;u++){vard=e[u];if(d.category)r=d.category,o.push(r),i[r]=[];else{varh=d.chatter.toLowerCase();if(!h)continue;h==l?(o.unshift("Broadcaster"),i.Broadcaster=[h]):i.hasOwnProperty(r)&&i[r].push(h)}}e=[];for(varu=0;u<o.length;u++){varm=o[u],p=i[m];if(p&&p.length)for(e.push({category:m}),e.push({chatter:""}),p.sort();p.length;){varh=p.shift();h=t.get_capitalization(h),e.push({chatter:h})}}}catch(f){n.error("ViewersController lines: "+f)}returne}.property("content.chatters")})}},{}],10:[function(t){varn=e.FrankerFaceZ,o=/\.([\w\-_]+)\s*?\{content:\s*?"([^"]+)";\s*?background-image:\s*?url\("([^"]+)"\);\s*?height:\s*?(\d+)px;\s*?width:\s*?(\d+)px;\s*?margin:([^;}]+);?([^}]*)\}/gm,i=/[^\n}]*\.badges\s+\.moderator\s*{\s*background-image:\s*url\(\s*['"]([^'"]+)['"][^}]+(?:}|$)/,r=t("./constants"),s=t("./utils"),a=function(e,t,n){t&&(n.global=!0,this.global_sets.push(e))},l=function(e,t){varn=e.split(/ +/);return2!=n.length?e:(n[0]=parseFloat(n[0]),n[1]=parseFloat(n[1]),n[0]==(t-18)/-2&&0==n[1]?null:e)},c=function(e){vart=e.margins;returnt||(t=(e.height-18)/-2+"px 0"),".ffz-emote-"+e.id+' { background-image: url("'+e.url+'"); height: '+e.height+"px; width: "+e.width+"px; margin: "+t+(e.extra_css?"; "+e.extra_css:"")+"}\n"},u=function(e){returne.margins||e.extra_css?c(e)+'img[src="'+e.url+'"] { '+(e.margins?"margin: "+e.margins+";":"")+(e.extra_css||"")+" }\n":c(e)},d=u;n.prototype.setup_emoticons=function(){this.log("Preparing emoticon system."),this.emote_sets={},this.global_sets=[],this._last_emote_id=0,this.log("Creating emoticon style element.");vare=this._emote_style=document.createElement("style");e.id="ffz-emoticon-css",document.head.appendChild(e),this.log("Loading global emote set."),this.load_set("global",a.bind(this,"global"))},n.prototype.getEmotes=function(e,t){varn=this.users[e],o=this.rooms[t];return_.union(n&&n.sets||[],o&&o.sets||[],this.global_sets)},n.ws_commands.reload_set=function(e){this.load_set(e)},n.prototype.load_set=function(e,t){returnthis._legacy_load_set(e,t)},n.prototype.unload_set=function(e){vart=this.emote_sets[e];if(t){this.log("Unloading emoticons for set: "+e),s.update_css(this._emote_style,e,null),deletethis.emote_sets[e];for(varn=0;n<t.users.length;n++){varo=this.rooms[t.users[n]];o&&o.sets.removeObject(e)}}},n.prototype._load_set_json=function(e,t,n){this.emote_sets[e]=n,n.users=[],n.global=!1,n.count=0;varo="";for(variinn.emotes)if(n.emotes.hasOwnProperty(i)){varr=n.emotes[i];r.klass="ffz-emote-"+r.id,r.regex="!"===r.name[r.name.length-1]?newRegExp("\\b"+r.name+"(?=\\W|$)","g"):newRegExp("\\b"+r.name+"\\b","g"),o+=d(r),n.count++}s.update_css(this._emote_style,e,o+(n.extra_css||"")),this.log("Updated emoticons for set: "+e,n),this.update_ui_link(),t&&t(!0,n)},n.prototype._legacy_load_set=function(e,t,n){jQuery.ajax(r.SERVER+"channel/"+e+".css",{cache:!1,context:this}).done(function(n){this._legacy_load_css(e,t,n)}).fail(function(o){return404==o.status?"function"==typeoft&&t(!1):(n=n||0,n++,10>n?this._legacy_load_set(e,t,n):"function"==typeoft&&t(!1))})},n.prototype._legacy_load_css=function(e,t,n){varr={},s={id:e,emotes:r,extra_css:null},a=this;n=n.replace(o,function(t,n,o,i,s,c,u,d){s=parseInt(s),c=parseInt(c),u=l(u,s)
})}}}},t.ws_commands.message=function(e){this.show_message(e)},t._notifications={},t._last_notification=0,t.prototype.clear_notifications=function(){for(vareint._notifications){varn=t._notifications[e];if(n)try{n.close()}catch(o){}}t._notifications={},t._last_notification=0},t.prototype.show_notification=function(e,n,o,i,r,s){vara=Notification.permission;if("denied "===a)return!1;if("granted"===a){n=n||"FrankerFaceZ",i=i||1e4;varl={lang:"en-US",dir:"ltr",body:e,tag:o||"FrankerFaceZ",icon:"http://cdn.frankerfacez.com/icon32.png"},c=this,u=newNotification(n,l),d=t._last_notification++;returnt._notifications[d]=u,u.addEventListener("click",function(){deletet._notifications[d],r&&r.bind(c)()}),u.addEventListener("close",function(){deletet._notifications[d],s&&s.bind(c)()}),void("number"==typeofi&&u.addEventListener("show",function(){setTimeout(function(){deletet._notifications[d],u.close()},i)}))}varc=this;Notification.requestPermission(function(){c.show_notification(e,n,o)})},t.prototype.show_message=function(t){e.noty({text:t,theme:"ffzTheme",layout:"bottomCenter",closeWith:["button"]}).show()}},{}],23:[function(t){varn=e.FrankerFaceZ,o=t("../utils");n.prototype.setup_races=function(){this.log("Initializing race support."),this.srl_races={}},n.settings_info.srl_races={type:"boolean",value:!0,category:"Channel Metadata",name:"SRL Race Information",help:'Display information about <a href="http://www.speedrunslive.com/" target="_new">SpeedRunsLive</a> races under channels.',on_update:function(){this.rebuild_race_ui()}},n.ws_on_close.push(function(){vare=App.__container__.lookup("controller:channel"),t=e.get("id"),n=!1;for(varointhis.srl_races)deletethis.srl_races[o],o==t&&(n=!0);n&&this.rebuild_race_ui()}),n.ws_commands.srl_race=function(e){for(vart=App.__container__.lookup("controller:channel"),n=t.get("id"),o=!1,i=0;i<e[0].length;i++){varr=e[0][i];this.srl_races[r]=e[1],r==n&&(o=!0)}if(e[1]){vars=e[1],a=s.twitch_entrants={};for(varlins.entrants)s.entrants.hasOwnProperty(l)&&(s.entrants[l].channel&&(a[s.entrants[l].channel]=l),s.entrants[l].name=l)}o&&this.rebuild_race_ui()},n.prototype.rebuild_race_ui=function(){vare=App.__container__.lookup("controller:channel"),t=e.get("id"),n=this.srl_races[t],o=this.settings.srl_races,i=document.querySelector(".stats-and-actions .channel-actions"),r=i.querySelector("#ffz-ui-race");if(!n||!o)returnr&&r.parentElement.removeChild(r),void(this._popup&&"ffz-race-popup"==this._popup.id&&(deletethis._popup,this._popup_kill&&this._popup_kill(),deletethis._popup_kill));if(r)returnthis._update_race(!0);r=document.createElement("span"),r.setAttribute("data-channel",t),r.id="ffz-ui-race";vars=document.createElement("span");s.className="button drop action",s.title="SpeedRunsLive Race",s.innerHTML='<span class="logo"><span>',s.addEventListener("click",this.build_race_popup.bind(this)),r.appendChild(s),i.appendChild(r),this._update_race(!0)},n.prototype._race_kill=function(){this._race_timer&&(clearTimeout(this._race_timer),deletethis._race_timer),deletethis._race_game,deletethis._race_goal},n.prototype.build_race_popup=function(){vare=this._popup;if(!e||(e.parentElement.removeChild(e),deletethis._popup,this._popup_kill&&this._popup_kill(),deletethis._popup_kill,"ffz-race-popup"!=e.id)){vart=document.querySelector("#ffz-ui-race");if(t){varo=t.querySelector(".button"),i=o.offsetLeft+o.offsetWidth,r=t.getAttribute("data-channel"),s=this.srl_races[r],e=document.createElement("div"),a="";e.id="ffz-race-popup",e.className=(i>=300?"right":"left")+" share dropmenu",this._popup_kill=this._race_kill.bind(this),this._popup=e;varl="http://kadgar.net/live",c=!1;for(varuins.entrants){vard=s.entrants[u].state;s.entrants.hasOwnProperty(u)&&s.entrants[u].channel&&("racing"==d||"entered"==d)&&(l+="/"+s.entrants[u].channel,c=!0)}varh=document.querySelector(".app-main.theatre")?document.body.clientHeight-300:t.parentElement.offsetTop-175,m=App.__container__.lookup("controller:channel"),p=m?m.get("display_name"):n.get_capitalization(r),f=encodeURIComponent("I'm watching "+p+"