!function(t){!functione(t,s,o){functioni(a,r){if(!s[a]){if(!t[a]){vard="function"==typeofrequire&&require;if(!r&&d)returnd(a,!0);if(n)returnn(a,!0);thrownewError("Cannot find module '"+a+"'")}varu=s[a]={exports:{}};t[a][0].call(u.exports,function(e){vars=t[a][1][e];returni(s?s:e)},u,u.exports,e,t,s,o)}returns[a].exports}for(varn="function"==typeofrequire&&require,a=0;a<o.length;a++)i(o[a]);returni}({1:[function(e){vars=t.FrankerFaceZ,o=e("./constants"),i=e("./utils");s.settings_info.show_badges={type:"boolean",value:!0,category:"Chat Appearance",name:"Additional Badges",help:"Show additional badges for bots, FrankerFaceZ donors, and other special users."},s.settings_info.transparent_badges={type:"boolean",value:!1,category:"Chat Appearance",no_bttv:!0,name:"Transparent Badges",help:"Make chat badges transparent for a nice, clean look. On light chat, non-subscriber badges are inverted to remain visible.",on_update:function(t){this.has_bttv||document.body.classList.toggle("ffz-transparent-badges",t)}},s.prototype.setup_badges=function(){this.has_bttv||document.body.classList.toggle("ffz-transparent-badges",this.settings.transparent_badges),this.log("Preparing badge system."),this.badges={},this.log("Creating badge style element.");vart=this._badge_style=document.createElement("style");t.id="ffz-badge-css",document.head.appendChild(t),this.log("Adding legacy donor badges."),this._legacy_add_donors()},s.ws_commands.reload_badges=function(){this._legacy_load_bots(),this._legacy_load_donors()},s.ws_commands.set_badge=function(t){vare=t[0],s=t[1],o=t[2],i=this.users[e]=this.users[e]||{},n=i.badges=i.badges||{};void0===o||null===o?deleten[s]:n[s]=o};varn=function(t){vare=".badges .ffz-badge-"+t.id+" { background-color: "+t.color+'; background-image: url("'+t.image+'"); '+(t.extra_css||"")+"}";returnt.transparent_image&&(e+=".ffz-transparent-badges .badges .ffz-badge-"+t.id+' { background-image: url("'+t.transparent_image+'"); }'),e};s.prototype.bttv_badges=function(t){if(this.settings.show_badges){vare=t.sender,s=this.users[e],o=[],i=-1,n=BetterTTV.settings.get("alphaTags");if(s&&s.badges){t.badges||(t.badges=[]);for(vara=0;a<t.badges.length;a++){varr=t.badges[a];if("subscriber"==r.type||"turbo"==r.type){i=a;break}}for(vardins.badges)if(s.badges.hasOwnProperty(d)){varr=s.badges[d],u=this.badges[r.id]||{},c=r.title||u.title,l="";if(void0!==u.visible){varh=u.visible;if("function"==typeofh&&(h=h.bind(this)(null,e)),!h)continue}if(u.replaces){for(varf=!1,a=0;a<t.badges.length;a++){varm=t.badges[a];if(m.type===u.replaces_type){m.type="ffz-badge-replacement "+m.type,m.description+=", "+(r.title||u.title)+'" style="background-image: url("'+(r.image||u.image)+"")",f=!0;break}}if(f)continue}r.image&&(l+="background-image: url(""+r.image+""); "),r.color&&!n&&(l+="background-color: "+r.color+"; "),r.extra_css&&(l+=r.extra_css),l&&(c+='" style="'+l),o.push([(-1==i?1:-1)*d,{type:"ffz-badge-"+r.id+(n?" alpha":""),name:"",description:c}])}if(o.sort(function(t,e){returnt[0]-e[0]}),-1==i)for(;o.length;)t.badges.push(o.shift()[1]);elsefor(;o.length;)t.badges.insertAt(i,o.shift()[1])}}},s.prototype.render_badges=function(t,e){if(!this.settings.show_badges)returne;vars=t.get("msgObject.from"),o=t.get("msgObject.room")||App.__container__.lookup("controller:chat").get("currentRoom.id"),i=this.users[s];if(!i||!i.badges)returne;for(varnini.badges)if(i.badges.hasOwnProperty(n)){vara=i.badges[n],r=this.badges[a.id]||{},d=e[n];if(void0!==r.visible){varu=r.visible;if("function"==typeofu&&(u=u.bind(this)(o,s,t,e)),!u)continue}if(d){varc=a.hasOwnProperty("replaces")?a.replaces:r.replaces;if(!c)continue;d.image=a.image||r.image,d.klass+=" ffz-badge-replacement",d.title+=", "+(a.title||r.title)}elsee[n]={klass:"ffz-badge-"+a.id,title:a.title||r.title,image:a.image,color:a.color,extra_css:a.extra_css}}returne},s.prototype.render_badge=function(t){if(this.settings.show_badges){vare=t.get("msgObject.from"),s=App.__container__.lookup("controller:chat").get("currentRoom.id"),o=t.$(".badges"),i=
},{}],5:[function(){vare=t.FrankerFaceZ;e.settings_info.developer_mode={type:"boolean",value:!1,storage_key:"ffzDebugMode",visible:function(){returnthis.settings.developer_mode||Date.now()-parseInt(localStorage.ffzLastDevMode||"0")<6048e5},category:"Debugging",name:"Developer Mode",help:"Load FrankerFaceZ from the local development server instead of the CDN. Please refresh after changing this setting.",on_update:function(){localStorage.ffzLastDevMode=Date.now()}},e.ffz_commands.developer_mode=function(t,e){vars,e=e&&e.length?e[0].toLowerCase():null;return"y"==e||"yes"==e||"true"==e||"on"==e?s=!0:("n"==e||"no"==e||"false"==e||"off"==e)&&(s=!1),void0===s?"Developer Mode is currently "+(this.settings.developer_mode?"enabled.":"disabled."):(this.settings.set("developer_mode",s),"Developer Mode is now "+(s?"enabled":"disabled")+". Please refresh your browser.")},e.ffz_commands.developer_mode.help="Usage: /ffz developer_mode <on|off>\nEnable or disable Developer Mode. When Developer Mode is enabled, the script will be reloaded from //localhost:8000/script.js instead of from the CDN."},{}],6:[function(e){vars=t.FrankerFaceZ,o=e("../utils"),i=e("../constants");s.prototype.setup_channel=function(){this.log("Creating channel style element.");vart=this._channel_style=document.createElement("style");t.id="ffz-channel-css",document.head.appendChild(t),document.body.classList.toggle("ffz-hide-view-count",!this.settings.channel_views),this.log("Creating channel style element.");vart=this._channel_style=document.createElement("style");t.id="ffz-channel-css",document.head.appendChild(t),this.log("Hooking the Ember Channel Index view.");vare=App.__container__.resolve("view:channel/index"),o=this;if(e){this._modify_cindex(e);try{e.create().destroy()}catch(i){}for(varninEmber.View.views)if(Ember.View.views.hasOwnProperty(n)){vara=Ember.View.views[n];ainstanceofe&&(this.log("Manually updating Channel Index view.",a),this._modify_cindex(a),a.ffzInit())}this.log("Hooking the Ember Channel model."),e=App.__container__.resolve("model:channel"),e&&(e.reopen({ffz_host_target:void0,setHostMode:function(t){returno.settings.hosted_channels?(this.set("ffz_host_target",t.target),this._super(t)):(this.set("ffz_host_target",void0),this._super({target:void0,delay:0}))}}),this.log("Hooking the Ember Channel controller."),e=App.__container__.lookup("controller:channel"),e&&(e.reopen({ffzUpdateUptime:function(){o._cindex&&o._cindex.ffzUpdateUptime()}.observes("isLive","content.id"),ffzUpdateInfo:function(){this._ffz_update_timer&&clearTimeout(this._ffz_update_timer),this.get("content.id")&&(this._ffz_update_timer=setTimeout(this.ffzCheckUpdate.bind(this),6e4))}.observes("content.id"),ffzCheckUpdate:function(){vart=this,e=t.get("content.id");e&&Twitch.api&&Twitch.api.get("streams/"+e,{},{version:3}).done(function(e){if(!e||!e.stream)returnt.set("stream.created_at",null),voidt.set("stream.viewers",0);t.set("stream.created_at",e.stream.created_at||null),t.set("stream.viewers",e.stream.viewers||0);vars=e.stream.game||e.stream.channel&&e.stream.channel.game;s&&(t.set("game",s),t.set("rollbackData.game",s)),e.stream.channel&&(e.stream.channel.status&&t.set("status",e.stream.channel.status),e.stream.channel.views&&t.set("views",e.stream.channel.views),e.stream.channel.followers&&t.get("content.followers.isLoaded")&&t.set("content.followers.total",e.stream.channel.followers))}).always(function(){t.ffzUpdateInfo()})},ffzUpdateTitle:function(){vart=this.get("content.name"),e=this.get("content.display_name");e&&(s.capitalization[t]=[e,Date.now()]),o._cindex&&o._cindex.ffzFixTitle()}.observes("content.status","content.id"),ffzHostTarget:function(){vart=this.get("content.hostModeTarget"),e=t&&t.get("name"),i=t&&t.get("id"),n=t&&t.get("display_name");i!==o.__old_host_target&&(o.__old_host_target&&o.ws_send("unsub_channel",o.__old_host_target),i?(o.ws_send("sub_channel",i),o.__old_host_target=i):deleteo.__old_host_target),n&&(s.capitalization[e]=[n,Date.now()]),o.settings.group_tabs&&o._chatv&&o._chatv.ffzRebuildTabs(),o.settings.follow_buttons&&o
if(n){varr=o.format_unread(t===i?0:n.room.get("unreadCount"));a.querySelector("span").innerHTML=r}}}}},ffzBuildTab:function(t,n,a,r){{vard,u,c=document.createElement("span"),l="",h=n.get("id"),f=n.get("isGroupRoom"),m=n===t.get("controller.currentRoom");m||-1!==e.settings.visible_rooms.indexOf(h)}returnc.setAttribute("data-room",n.id),c.className="ffz-chat-tab tooltip",c.classList.toggle("current-channel",a),c.classList.toggle("host-channel",r),c.classList.toggle("group-chat",f),c.classList.toggle("active",m),u=o.format_unread(m?0:n.get("unreadCount")),d=n.get("tmiRoom.displayName")||(f?n.get("tmiRoom.name"):s.get_capitalization(n.get("id"),function(t){u=o.format_unread(m?0:n.get("unreadCount")),c.innerHTML=l+o.sanitize(t)+"<span>"+u+"</span>"})),a?(l=i.CAMERA,c.title="Current Channel"):r?(l=i.EYE,c.title="Hosted Channel"):c.title=f?"Group Chat":"Pinned Channel",c.innerHTML=l+o.sanitize(d)+"<span>"+u+"</span>",c.addEventListener("click",function(){vare=t.get("controller");e.focusRoom(n),e.set("showList",!1)}),n._ffz_tab=c,c},ffzDisableTabs:function(){this._ffz_tabs&&(this._ffz_tabs.parentElement.removeChild(this._ffz_tabs),deletethis._ffz_tabs,deletethis._ffz_invite),this._ffz_host&&(-1===e.settings.pinned_rooms.indexOf(this._ffz_host)&&this._ffz_host_room&&(this.get("controller.currentRoom")===this._ffz_host_room&&this.get("controller").blurRoom(),this._ffz_host_room.destroy()),deletethis._ffz_host,deletethis._ffz_host_room),this.$(".chat-room").css("top",""),this.$(".chat-header").removeClass("hidden")}})},s.prototype.connect_extra_chat=function(){vart=this.get_user();if(t&&t.login&&(!this.rooms[t.login]||this.rooms[t.login].room)){vare=App.__container__.resolve("model:room");e&&e.findOne(t.login)}if(!this.has_bttv){for(vars=0;s<this.settings.pinned_rooms.length;s++)this._join_room(this.settings.pinned_rooms[s],!0);this._chatv&&(!this.has_bttv&&this.settings.group_tabs&&this._chatv.ffzRebuildTabs(),this._chatv.ffzRebuildMenu())}},s.prototype._join_room=function(t,e){vars=!1;if(-1===this.settings.pinned_rooms.indexOf(t)&&(this.settings.pinned_rooms.push(t),this.settings.set("pinned_rooms",this.settings.pinned_rooms),s=!0),this.rooms[t]&&this.rooms[t].room)returns&&!e&&!this.has_bttv&&this._chatv&&this.settings.group_tabs&&this._chatv.ffzRebuildTabs(),s;{varo=App.__container__.resolve("model:room");o&&o.findOne(t)}return!e&&!this.has_bttv&&this._chatv&&this.settings.group_tabs&&this._chatv.ffzRebuildTabs(),!e&&this._chatv&&this._chatv.ffzRebuildMenu(),s},s.prototype._leave_room=function(t,e){vars=!1;if(-1!==this.settings.pinned_rooms.indexOf(t)&&(this.settings.pinned_rooms.removeObject(t),this.settings.set("pinned_rooms",this.settings.pinned_rooms),s=!0),!this.rooms[t]||!this.rooms[t].room)returns;varo=App.__container__.lookup("controller:chat"),i=this.rooms[t].room,n=this.get_user();return!o||o.get("currentChannelRoom.id")===t||this._chatv&&this._chatv._ffz_host===t?s:(o.get("currentRoom.id")===t&&o.blurRoom(),n&&n.login===t||i.destroy(),!e&&!this.has_bttv&&this._chatv&&this.settings.group_tabs&&this._chatv.ffzRebuildTabs(),!e&&this._chatv&&this._chatv.ffzRebuildMenu(),s)},s.chat_commands.join=function(t,e){if(!e||!e.length||e.length>1)return"Join Usage: /join <channel>";vars=e[0].toLowerCase();return"#"===s.charAt(0)&&(s=s.substr(1)),this._join_room(s)?"Joining "+s+". You will always connect to this channel's chat unless you later /part from it.":"You have already joined "+s+'. Please use "/part '+s+'" to leave it.'},s.chat_commands.part=function(t,e){if(!e||!e.length||e.length>1)return"Part Usage: /part <channel>";vars=e[0].toLowerCase();return"#"===s.charAt(0)&&(s=s.substr(1)),this._leave_room(s)?"Leaving "+s+".":this.rooms[s]?"You do not have "+s+" pinned and you cannot leave the current channel or hosted channels via /part.":"You are not in "+s+"."}},{"../constants":4,"../utils":34}],9:[function(){vare=t.FrankerFaceZ;e.settings_info.swap_sidebars={type:"boolean",value:!1,category:"Appearance",no_mobile:!0,no_bttv:!0,name:"Swap Sidebar Positions",help:"Swapthepositionsoftheleftandrightsi