1function streamWeasels(e){this._opts=e,this.uuid=e.uuid,this.game=e.game,this.gameName=e.gameName,this.language=e.language,this.channels=e.channels,this.titleFilter=e.titleFilter,this.limit=e.limit,this.layout=e.layout,this.embed=e.embed,this.embedTheme=e.embedTheme,this.embedChat=e.embedChat?"video-with-chat":"video",this.embedTitle=e.embedTitle,this.embedTitlePosition=e.embedTitlePosition,this.embedMuted=e.embedMuted,this.showOffline=e.showOffline,this.showOfflineText=e.showOfflineText,this.showOfflineImage=e.showOfflineImage,this.autoplay=e.autoplay,this.autoplayOffline=e.autoplayOffline,this.autoplaySelect=e.autoplaySelect,this.featured=e.featured,this.offlineImage=e.offlineImage,this.logoImage=e.logoImage,this.profileImage=e.profileImage,this.tileLayout=e.tileLayout,this.tileSorting=e.tileSorting,this.tileLive=e.tileLive,this.logoBgColour=e.logoBgColour,this.logoBorderColour=e.logoBorderColour,this.tileBgColour=e.tileBgColour,this.tileTitleColour=e.tileTitleColour,this.tileSubtitleColour=e.tileSubtitleColour,this.tileRoundedCorners=e.tileRoundedCorners,this.hoverColour=e.hoverColour,this.disableScroll=e.disableScroll,this.translationsLive=e.translationsLive,this.translationsOffline=e.translationsOffline,this.translationsViewers=e.translationsViewers,this.translationsStreaming=e.translationsStreaming,this.translationsFor=e.translationsFor,this.nonce=e.nonce,this.wrapper=document.querySelector(".cp-streamweasels--"+this.uuid),this.target=this.wrapper.querySelector(".cp-streamweasels__streams"),this.loading=this.wrapper.querySelector(".cp-streamweasels__loader"),this.player=this.wrapper.querySelector(".cp-streamweasels__player"),"vods"==this.layout?this._getVods():this._getStreams(this.channels,this.game,this.language)}function fetchFreshNonce(){return fetch(streamWeaselsVars.ajaxUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:"action=get_fresh_nonce"}).then(e=>{if(e.ok)return e.json();throw new Error("fetchFreshNonce() failed")}).then(e=>{if(e.success&&e.data&&e.data.nonce)return e.data.nonce;throw new Error("fetchFreshNonce() success - data not valid: "+JSON.stringify(e))})}streamWeasels.prototype=Object.create(null,{constructor:{value:streamWeasels},_refresh:{value:function(){console.log("refresh active - refreshing streams..."),this.refreshActive=!0,this.target.innerHTML="",this.wrapper.dataset.online=0,this.wrapper.dataset.offline=0,this.wrapper.dataset.onlineList="",this.wrapper.classList.remove("cp-streamweasels--all-offline"),this._getStreams(this.channels,this.game,this.language)}},_handleApiResponse:{value:function(e,t){return"rest_cookie_invalid_nonce"===e.code?(console.error(t+" - nonce validation failed:",e),!1):!!Array.isArray(e.data)||(console.error(t+" - unexpected data format:",e),!1)}},_getStreams:{value:function(s,a,e,r=0,l=0,o=!1){var n="",d=[""],h=[],c=[],p=[],m=0;for(s&&(d=s.split(",")),i=0;i<d.length;i+=100){var t=d.slice(i,i+100);h.push(t)}for(var u=0;u<h.length;u++)!function(t){a&&(n="&game_id="+a+"&first=100",o)&&(n=n+"&after="+o),s&&(n="&user_login="+h[t]),e&&(a&&!s||!s&&!a)&&(n=n+"&language="+e.toLowerCase()),p[t]=new XMLHttpRequest,p[t].open("GET",streamWeaselsVars.siteUrl+"/?rest_route=/streamweasels/v1/fetch-streams/"+n),p[t].setRequestHeader("X-WP-Nonce",this.nonce),p[t].onreadystatechange=function(){var e;4===p[t].readyState&&(m++,e=JSON.parse(p[t].responseText),this._handleApiResponse(e,"_getStreams"))&&(c=c.concat(e.data),a&&!s&&(0<Object.keys(e.pagination).length?o=e.pagination.cursor:0==Object.keys(e.pagination).length&&(o="end",c.push("empty stream"))),m==h.length)&&(s&&1==this.showOffline&&d.length!==c.length?this._getOfflineStreams(c,d):this._appendStreams(c,!1,r,l,o,this._clickHandler))}.bind(this),p[t].send()}.bind(this)(u)}},_getVods:{value:function(){gameIdArray=[];var r=[],l=[],e=(Math.floor(1e3+9e3*Math.random()),this.wrapper.dataset.vodChannel),o=0;if(e){for(channelsArray=e.includes(",")?e.split(","):[e],i=0;i<channelsArray.length;i++)console.log(channelsArray[i]);for(var t=0;t<channelsArray.length;t++)!function(t){var e,s=this.wrapper.dataset.vodType,a=this.wrapper.dataset.vodPeriod,i=new Date;a="clips"==s?("month"==a?i.setDate(i.getDate()-30):"week"==a?i.setDate(i.getDate()-7):"day"==a?i.setDate(i.getDate()-1):i.setDate(i.getDate()-1e3),a=new Date,e=new Date(a).toISOString().slice(0,10),i=new Date(i).toISOString().slice(0,10),"&clip_type=clips&broadcaster_id="+channelsArray[t]+"&started_at="+i+"T00:00:00Z&ended_at="+e+"T00:00:00Z&first=100"):"highlights"==s?"&clip_type=videos&user_id="+channelsArray[t]+"&type=highlight&first=100":"past-broadcasts"==s?"&clip_type=videos&user_id="+channelsArray[t]+"&type=archive&first=100":"&clip_type=clips&broadcaster_id="+channelsArray[t]+"&started_at="+i+"T00:00:00Z&ended_at="+e+"T00:00:00Z&first=100",r[t]=new XMLHttpRequest,r[t].open("GET",streamWeaselsVars.siteUrl+"/?rest_route=/streamweasels/v1/fetch-video/"+a),r[t].setRequestHeader("X-WP-Nonce",this.nonce),r[t].onreadystatechange=function(){var e;4===r[t].readyState&&(o++,e=JSON.parse(r[t].responseText),this._handleApiResponse(e,"_getVods"))&&(e=e.data,l=l.concat(e),o==channelsArray.length)&&(e.length?(l.sort((e,t)=>
1{e=new Date(e.created_at);return new Date(t.created_at)-e}),this._appendVods(l)):(this.wrapper.classList.add("cp-streamweasels--no-vods"),this._postAppend()))}.bind(this),r[t].send()}.bind(this)(t)}else this.wrapper.classList.add("cp-streamweasels--no-vods"),this._postAppend()}},_appendVods:{value:function(e,t=0,s,a){for(var i=0,r=this.wrapper.dataset.vodType,l=this.wrapper.dataset.vodCreatorFilter,o=l.split(","),n=0;n<e.length;n++){i++;var d=e[n];if(i>this.limit){console.log("No more vods - limit of "+this.limit+" reached."),"clips"==r&&this._getGameName(gameIdArray),this._postAppend();break}if("clips"==r){var h=d.game_id,c=d.broadcaster_name,p=d.creator_name.toLowerCase(),m=d.embed_url,u=d.thumbnail_url,g=(v=1==d.duration.toFixed().length?"0:0"+parseInt(d.duration):"0:"+parseInt(d.duration),`<span class="cp-stream__meta" style="${this.tileSubtitleColour&&"color:"+this.tileSubtitleColour}">Clipped by ${p}</span>`),w=`data-creator="${p}"`;if(h&&gameIdArray.push(h),""!==l&&-1===o.indexOf(p)){console.log("Skipping clip by "+p+". Creator "+p+" not found in "+l),i--,n==e.length-1&&"clips"==r&&this._getGameName(gameIdArray);continue}}else var f,v,_,u=(u=(u=d.thumbnail_url||streamWeaselsVars.thumbnail).replace("%{width}","480")).replace("%{height}","272"),c=d.user_name,w="",p=(v=d.duration).includes("h")?v.split("h")[0]+":":"",g=(v=p+(f=v.includes("m")&&(f=v.split("m"),2==(f=2<v.indexOf("m")?f[0].split("h")[1]+":":f[0]+":").length)?"0"+f:f)+(_=v.includes("s")&&1==(_=1<(_=(v=v.slice(0,-1)).split("m")).length?_[1]:_[0]).length?"0"+_:_),"");var b=d.language,y=d.title,S=d.url,C=this._roundViewers(d.view_count),L=this._daysAgo(d.created_at),T=d.id,S=` 2 <div class="cp-stream" style="${this.hoverColour&&"background-color:"+this.hoverColour}" data-date="${d.created_at}" ${w}> 3 <a class="cp-stream__inner cp-stream__inner--${r}" href="${S}" target="_blank" title="${y}" data-channel-name="${c}" data-vod-id="${T}" data-language="${b}" data-type="${r}" data-viewers="${d.view_count}" data-embed="${m}" style="${this.tileBgColour&&"background-color:"+this.tileBgColour};${this.tileRoundedCorners&&"border-radius:"+this.tileRoundedCorners+"px"};"> 4 <div class="cp-stream__image"> 5 <img loading="lazy" src="${u}"> 6 <div class="cp-stream__overlay"></div> 7 <div class="cp-stream__status cp-stream__status-viewers"><span>${C} views</span></div> 8 <div class="cp-stream__status cp-stream__status-duration"><span>${v}</span></div> 9 <div class="cp-stream__status cp-stream__status-date"><span>${L}</span></div> 10 </div> 11 <div class="cp-stream__info"> 12 <img class="cp-stream__logo cp-stream__logo--${r}" src="${this.logoImage}" data-game-id="${h}" style="${this.logoBorderColour&&"border-color:"+this.logoBorderColour};${this.logoBgColour&&"background-color:"+this.logoBgColour}"></img> 13 <div class="cp-stream__info-wrapper"> 14 <span class="cp-stream__title" style="${this.tileTitleColour&&"color:"+this.tileTitleColour}">${y}</span> 15 <span class="cp-stream__meta" style="${this.tileSubtitleColour&&"color:"+this.tileSubtitleColour}">${c}</span> 16 ${g} 17 </div> 18 </div> 19 </a> 20 </div> 21 `;this.target.insertAdjacentHTML("beforeend",S),this.wrapper.dataset.online++,n!=e.length-1&&this.wrapper.dataset.online!=this.limit||("clips"==r&&this._getGameName(gameIdArray),0==this.wrapper.dataset.online&&this.wrapper.classList.add("cp-streamweasels--all-offline"),this._postAppend())}}},_getOfflineStreams:{value:function(s,e){for(var t=[],a=[],i=[],r=[],l=0,o=0;o<s.length;o++){var n=s[o].user_login;t.push(n.toString())}for(var d=e.filter(e=>!t.includes(e)),o=0;o<d.length;o+=100){var h=d.slice(o,o+100);a.push(h)}for(var c=0;c<a.length;c++)!function(t){var e="&login="+a[t].toString();r[t]=new XMLHttpRequest,r[t].open("GET",streamWeaselsVars.siteUrl+"/?rest_route=/streamweasels/v1/fetch-users/"+e),r[t].setRequestHeader("X-WP-Nonce",this.nonce),r[t].onreadystatechange=function(){var e;4===r[t].readyState&&(l++,e=JSON.parse(r[t].responseText),this._handleApiResponse(e,"_getOfflineStreams"))&&(i=i.concat(e.data),l==a.length)&&this._appendStreams(s,i)}.bind(this),r[t].send()}.bind(this)(c)}},_appendStreams:{value:function(e,t,s=0,a=0,i=!1){0==a&&(this.wrapper.dataset.online=0,this.wrapper.dataset.offline=0,l=r=!1);var r,l,o=0;
21if(a++,(e="least"==this.tileSorting?e.reverse():e).length)for(var n=0;n<e.length;n++){o++;var d,h,c,p,m,u,g=e[n];if(i&&"end"==i){console.log("No more streams - twitch query completed."),l=r=!0;break}if(o>this.limit||s==this.limit){console.log("No more streams - limit of "+this.limit+" reached."),l=r=!0;break}if(n==e.length-1&&s<this.limit&&i&&"end"!==i){console.log("Query "+a+" finished - limit not yet reached."),this._getStreams("",this.game,"",s,a,i);break}""!==this.game&&this.game!==e[n].game_id?(console.log("Skipping "+e[n].user_name+". Game "+e[n].game_id+" does not match "+this.game),o--,n!=e.length-1||i||(r=!0)):""!==this.titleFilter&&-1===g.title.toLowerCase().indexOf(this.titleFilter.toLowerCase())?(console.log("Skipping "+e[n].user_name+". Title "+this.titleFilter+" not found in "+g.title.toLowerCase()),o--,n!=e.length-1||i||(r=!0)):(d=g.game_name,h=g.language,w=g.thumbnail_url||streamWeaselsVars.thumbnail,w="showcase"==this.layout?(w=w.replace("{width}","888")).replace("{height}","500"):(w=w.replace("{width}","440")).replace("{height}","248"),c=g.title,v=g.type,_=g.user_name,p=g.user_login,u=this._roundViewers(g.viewer_count),(b="")!==this.logoImage&&(b=`<img class="cp-stream__logo" src="${this.logoImage}" style="${this.logoBorderColour&&"border-color:"+this.logoBorderColour};${this.logoBgColour&&"background-color:"+this.logoBgColour}"></img>`),m="",m="live"==this.tileLive?`<div class="cp-stream__status cp-stream__status-live"><span>${this.translationsLive}</span></div>`:"viewer"==this.tileLive?`<div class="cp-stream__status cp-stream__status-viewers"><span>${u} <span>${this.translationsViewers}</span></span></div>`:"online"!=this.tileLive&&"none"==this.tileLive?'<div class="cp-stream__status cp-stream__status-none"></div>':`<div class="cp-stream__status cp-stream__status-online"><span class="cp-stream__online-dot"></span><span>${u}</span></div>`,u=` 22 ${b}<div class="cp-stream__info-wrapper"> 23 <span class="cp-stream__title" style="${this.tileTitleColour&&"color:"+this.tileTitleColour}">${_}</span> 24 <span class="cp-stream__meta" style="${this.tileSubtitleColour&&"color:"+this.tileSubtitleColour}"><span>${this.translationsStreaming}</span> <strong class="cp-stream__meta--game">${d}</strong> <span>${this.translationsFor}</span> <strong class="cp-stream__meta--viewers">${u}</strong> <span>${this.translationsViewers}</span></span> 25 </div> 26 `,1==this.wrapper.dataset.enableClassic&&(u=` 27 <div class="cp-stream__info-wrapper"> 28 <span class="cp-stream__title cp-stream__title--classic" style="${this.tileTitleColour&&"color:"+this.tileTitleColour}"><span class="swti-live-marker"></span>${this.wrapper.dataset.classicOnlineText}</span> 29 </div> 30 `),y=` 31 <div class="cp-stream cp-stream--online cp-stream--classic-${this.wrapper.dataset.enableClassic}" style="${this.hoverColour&&"background-color:"+this.hoverColour}" data-user="${p.toLowerCase()}"> 32 <a class="cp-stream__inner" href="https://www.twitch.tv/${p}" target="_blank" title="${c}" data-channel-name="${p.toLowerCase()}" data-game="${d}" data-language="${h}" data-type="${v}" data-viewers="${g.viewer_count}" data-status="online" style="${this.tileBgColour&&"background-color:"+this.tileBgColour};${this.tileRoundedCorners&&"border-radius:"+this.tileRoundedCorners+"px"};"> 33 <div class="cp-stream__image"> 34 <img loading="lazy" src="${w}"> 35 <div class="cp-stream__overlay"></div> 36 </div> 37 <div class="cp-stream__info"> 38 ${u} 39 </div> 40 ${m} 41 </a> 42 </div> 43 `,this.target.insertAdjacentHTML("beforeend",y),s++,this.wrapper.dataset.online++,this.wrapper.dataset.onlineList=this.wrapper.dataset.onlineList+p.toLowerCase()+",",""!=this.game||n!=e.length-1||t.length&&"0"!=this.showOffline||(l=r=!0),""==this.game&&n==e.length-1&&t.length&&"1"==this.showOffline&&(r=!0),""===this.game||n!=e.length-1||i||(r=!0))}else r=!0;if(t.length){if(this.showOffline)for(n=0;n<t.length;n++){if(++o>this.limit){console.log("No more streams - limit of "+this.limit+" reached."),l=!0;break}var w,g=t[n],f=(w=this.offlineImage||g.offline_image_url||streamWeaselsVars.thumbnail,g.profile_image_url),v=g.type,_=g.display_name,b=(g.view_count,""),f=(""!==this.logoImage&&(b=`<img class="cp-stream__logo" src="${this.logoImage}" style="${this.logoBorderColour&&"border-color:"+this.logoBorderColour};${this.logoBgColour&&"background-color:"+this.logoBgColour}">`),this.profileImage&&(b=`<img class="cp-stream__logo" src="${f}" style="${this.logoBorderColour&&"border-color:"+this.logoBorderColour};${this.logoBgColour&&"background-color:"+this.logoBgColour}">`),` 44 <div class="cp-stream__info-wrapper">
45 <span class="cp-stream__title" style="${this.tileTitleColour&&"color:"+this.tileTitleColour}">${_}</span> 46 <span class="cp-stream__meta" style="${this.tileSubtitleColour&&"color:"+this.tileSubtitleColour}">${this.translationsOffline}</span> 47 </div> 48 `),y=(1==this.wrapper.dataset.enableClassic&&(f=` 49 <div class="cp-stream__info-wrapper"> 50 <span class="cp-stream__title cp-stream__title--classic" style="${this.tileTitleColour&&"color:"+this.tileTitleColour}">${this.wrapper.dataset.classicOfflineText}</span> 51 </div> 52 `),` 53 <div class="cp-stream cp-stream--offline cp-stream--classic-${this.wrapper.dataset.enableClassic}" style="${this.hoverColour&&"background-color:"+this.hoverColour}"> 54 <a class="cp-stream__inner" href="https://www.twitch.tv/${_}" target="_blank" data-channel-name="${_.toLowerCase()}" data-type="${v}" data-status="offline" style="${this.tileBgColour&&"background-color:"+this.tileBgColour};${this.tileRoundedCorners&&"border-radius:"+this.tileRoundedCorners+"px"}"> 55 <div class="cp-stream__image"> 56 <img loading="lazy" src="${w}"> 57 <div class="cp-stream__overlay"></div> 58 </div> 59 <div class="cp-stream__info"> 60 ${b} 61 ${f} 62 </div> 63 </a> 64 </div> 65 `);this.target.insertAdjacentHTML("beforeend",y),this.wrapper.dataset.offline++,n!=t.length-1||i||(l=!0)}}else l=!0;r&&l&&this._postAppend()}},_postAppend:{value:function(){var e,t,a,s;this.loading&&this.loading.remove(),this._sortStreams(),0==this.wrapper.dataset.online&&(this.wrapper.classList.add("cp-streamweasels--all-offline"),(this.showOfflineText||this.showOfflineImage)&&this._offlineMessage(),this.featured)&&this._moveFeaturedStream(),"rail"==this.layout&&this._startRailSlides(this.wrapper,this.target),"showcase"==this.layout&&setTimeout(function(){this._startShowcase(this.wrapper,this.target)}.bind(this),300),"feature"==this.layout&&this.target.children.length&&(1==(e=this.target.querySelectorAll(".cp-stream")).length&&(e=e[0].cloneNode(!0),this.target.appendChild(e)),setTimeout(function(){this._startFlipster(this.wrapper,this.target)}.bind(this),300)),"nav"==this.layout&&(e=document.querySelectorAll(".swti-twitch-nav--channel"),t=document.querySelectorAll(".swti-twitch-nav--team"),a=this.wrapper.dataset.channels,s=this.wrapper.dataset.team,a&&e.forEach(function(e){var t,s;e&&a&&(navNodeChild=e.querySelector("a"),indicatorClass=s=t="","1"==this.wrapper.dataset.online?(t=this.target.querySelector(".cp-stream__inner").dataset.viewers,navNodeChild.setAttribute("title",this._roundViewers(t)+" "+this.translationsViewers),indicatorClass="swti-twitch-nav__indicator--live",0<this.wrapper.dataset.showViewers&&(s=`<span class="swti-twitch-nav__meta"></span>${this._roundViewers(t)}</span>`)):1<this.wrapper.dataset.online?(t=this.wrapper.dataset.online,navNodeChild.setAttribute("title",t+" "+this.translationsStreaming),indicatorClass="swti-twitch-nav__indicator--live",0<this.wrapper.dataset.showViewers&&(s=`<span class="swti-twitch-nav__meta"></span>${t}</span>`)):(navNodeChild.classList.add("swti-twitch-nav--offline"),navNodeChild.setAttribute("title","0 "+this.translationsStreaming))),"1"==this.wrapper.dataset.hideDot&&"0"==this.wrapper.dataset.online?liveIndicatorMarkup="":(liveIndicatorMarkup=`<span class="swti-twitch-nav__indicator ${indicatorClass}"></span>`,navNodeChild.classList.add("swti-twitch-nav--show-indicator")),e&&(twitchLogo='<span class="swti-twitch-nav__logo"><svg width="22px" height="23px" viewBox="0 0 256 268" version="1.1" preserveAspectRatio="xMidYMid"><g><path d="M17.4579119,0 L0,46.5559188 L0,232.757287 L63.9826001,232.757287 L63.9826001,267.690956 L98.9144853,267.690956 L133.811571,232.757287 L186.171922,232.757287 L256,162.954193 L256,0 L17.4579119,0 Z M4
650.7166868,23.2632364 L232.73141,23.2632364 L232.73141,151.29179 L191.992415,192.033461 L128,192.033461 L93.11273,226.918947 L93.11273,192.033461 L40.7166868,192.033461 L40.7166868,23.2632364 Z M104.724985,139.668381 L127.999822,139.668381 L127.999822,69.843872 L104.724985,69.843872 L104.724985,139.668381 Z M168.721862,139.668381 L191.992237,139.668381 L191.992237,69.843872 L168.721862,69.843872 L168.721862,139.668381 Z" fill="inherit"></path></g></svg></span>',html=`<span class="swti-twitch-nav">${liveIndicatorMarkup}${s}</span>`,navNodeChild.insertAdjacentHTML("beforeend",html),0<this.wrapper.dataset.twitchLogo)&&("1"==this.wrapper.dataset.hideLogo&&"0"==this.wrapper.dataset.online||(navNodeChild.classList.add("swti-twitch-nav--show-logo"),navNodeChild.insertAdjacentHTML("afterbegin",twitchLogo)))}.bind(this)),s)&&t.forEach(function(e){var t;e&&s&&(indicatorClass=t="",liveMeta=this.wrapper.dataset.online,navNodeChild=e.querySelector("a"),0<this.wrapper.dataset.online?(navNodeChild.setAttribute("title",liveMeta+" "+this.translationsStreaming),indicatorClass="swti-twitch-nav__indicator--live",0<this.wrapper.dataset.showTeamMembers&&(t=`<span class="swti-twitch-nav__meta"></span>${liveMeta}</span>`)):(navNodeChild.classList.add("swti-twitch-nav--offline"),navNodeChild.setAttribute("title","0 "+this.translationsStreaming))),"1"==this.wrapper.dataset.hideDot&&"0"==this.wrapper.dataset.online?liveIndicatorMarkup="":(liveIndicatorMarkup=`<span class="swti-twitch-nav__indicator ${indicatorClass}"></span>`,navNodeChild.classList.add("swti-twitch-nav--show-indicator")),e&&(twitchLogo='<span class="swti-twitch-nav__logo"><svg width="22px" height="23px" viewBox="0 0 256 268" version="1.1" preserveAspectRatio="xMidYMid"><g><path d="M17.4579119,0 L0,46.5559188 L0,232.757287 L63.9826001,232.757287 L63.9826001,267.690956 L98.9144853,267.690956 L133.811571,232.757287 L186.171922,232.757287 L256,162.954193 L256,0 L17.4579119,0 Z M40.7166868,23.2632364 L232.73141,23.2632364 L232.73141,151.29179 L191.992415,192.033461 L128,192.033461 L93.11273,226.918947 L93.11273,192.033461 L40.7166868,192.033461 L40.7166868,23.2632364 Z M104.724985,139.668381 L127.999822,139.668381 L127.999822,69.843872 L104.724985,69.843872 L104.724985,139.668381 Z M168.721862,139.668381 L191.992237,139.668381 L191.992237,69.843872 L168.721862,69.843872 L168.721862,139.668381 Z" fill="inherit"></path></g></svg></span>',html=`<span class="swti-twitch-nav">${liveIndicatorMarkup}${t}</span>`,navNodeChild.insertAdjacentHTML("beforeend",html),0<this.wrapper.dataset.twitchLogo)&&("1"==this.wrapper.dataset.hideLogo&&"0"==this.wrapper.dataset.online||(navNodeChild.classList.add("swti-twitch-nav--show-logo"),navNodeChild.insertAdjacentHTML("afterbegin",twitchLogo)))}.bind(this)),"status"==this.layout&&(this.wrapper.classList.add("cp-streamweasels--loaded"),setTimeout(function(){this.target.classList.add("cp-streamweasels__streams--loaded")}.bind(this),1e3),setTimeout(function(){this.wrapper.classList.add("cp-streamweasels--animation-finished")}.bind(this),2e3),this.target.classList.contains("cp-streamweasels__streams--carousel-0"))&&setTimeout(function(){jQuery(this.target).slick({dots:!1,slidesToShow:1,slidesToScroll:1,swipeToSlide:!0,nextArrow:'<button type="button" class="slick-prev"><svg fill="#FFFFFF" height="24" viewBox="0 0 24 24" width="24"><path d="M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"/><path d="M0-.5h24v24H0z" fill="none"/></svg></button>',prevArrow:'<button type="button" class="slick-next"><svg fill="#FFFFFF" height="24" viewBox="0 0 24 24" width="24"><path d="M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"/><path d="M0-.25h24v24H0z" fill="none"/></svg></button>'})}.bind(this),3e3),this._clickHandler()}},_moveFeaturedStream:{value:function(){this.wrapper.querySelectorAll(".cp-stream--offline").forEach(e=>{this.featured.toLowerCase()==e.children[0].dataset.channelName.toLowerCase()&&this.target.prepend(e)})}},_clickHandler:{value:function(){var e,t,s,a;this.autoplay&&"twitch"!==this.embed&&"vods"!==this.layout&&"nav"!==this.layout&&(0<(s=this.wrapper.querySelectorAll(".cp-stream--online")).length?(e=s.length-1,t=Math.floor(Math.random()*s.length),a=("most"==this.autoplaySelect?s[0]:"least"==this.autoplaySelect?s[e]:"random"==this.autoplaySelect?s[t]:s[0]).querySelector("a"),this.featured&&s.forEac
65h(e=>{this.featured.toLowerCase()==e.children[0].dataset.channelName.toLowerCase()&&(a=e.children[0])}),this.refreshActive&&this.player.dataset.channelName!==a.dataset.channelName&&this.wrapper.dataset.onlineList.split(",").includes(this.player.dataset.channelName)||this._embedStream(a)):this.autoplayOffline&&"vods"!==this.layout&&(a=(s=this.wrapper.querySelectorAll(".cp-stream--offline"))[0].querySelector("a"),this._embedStream(a))),this.wrapper.querySelectorAll(".cp-stream__inner").forEach(t=>{t.addEventListener("click",function(e){e.preventDefault(),"vods"==this.layout?this._embedVod(t):this._embedStream(t)}.bind(this))})}},_offlineMessage:{value:function(){var e=`<div class="cp-streamweasels__offline"> 66 ${this.showOfflineImage&&"<img src='"+this.showOfflineImage+"'>"} 67 ${this.showOfflineText&&"<h3>"+this.showOfflineText+"</h3>"} 68 </div>`;"inside"!==this.embed&&"nav"!==this.layout&&(this.wrapper.querySelector(".cp-streamweasels__offline-wrapper").innerHTML="",this.wrapper.querySelector(".cp-streamweasels__offline-wrapper").insertAdjacentHTML("beforeend",e))}},_embedStream:{value:function(r){var e,t,s,a=document.querySelector("body"),i=`<div class="cp-streamweasels-modal"> 69 ${this.embedTitle&&"top"==this.embedTitlePosition&&"online"==r.dataset.status?'<div class="cp-streamweasels-modal__title cp-streamweasels-modal__title--'+this.embedChat+'"><p>'+r.getAttribute("title")+"</p></div>":""} 70 <div class="cp-streamweasels-modal__player cp-streamweasels-modal__player--${this.embedChat}"></div> 71 ${this.embedTitle&&"bottom"==this.embedTitlePosition&&"online"==r.dataset.status?'<div class="cp-streamweasels-modal__title cp-streamweasels-modal__title--'+this.embedChat+'"><p>'+r.getAttribute("title")+"</p></div>":""} 72 </div>`,l=this.wrapper.querySelector(".cp-streamweasels__player");"twitch"==this.embed&&window.open("https://twitch.tv/"+r.dataset.channelName,"_blank"),"status"==this.layout&&"page"==this.embed&&(this.embed="popup"),"feature"==this.layout&&"inside"==this.embed&&setTimeout(function(){var e=this.wrapper.querySelector(".flipster__item--current"),t=e.querySelector(".cp-stream__image"),s=t.querySelector("iframe"),a=t.querySelector("img"),i=a.width,a=a.height;"detailed"==this.tileLayout&&(a+=48),e.classList.add("flipster__item--embed"),s&&s.remove(),new Twitch.Embed(t,{width:i+"px",height:a+"px",channel:r.dataset.channelName,theme:this.embedTheme,layout:"video"});this.wrapper.classList.add("cp-streamweasels--embed-page-active"),this.embedTitle=!1}.bind(this),300),"page"==this.embed&&(t=!!(t=!!(t=!!(e=l.querySelector("iframe")??!1)&&e.getAttribute("src"))&&new URLSearchParams(new URL(t).search))&&t.get("channel"),e&&t==r.dataset.channelName?console.log("Stream already playing"):(l.innerHTML="",s=new Twitch.Embed(l,{width:"100%",height:"100%",channel:r.dataset.channelName,theme:this.embedTheme,layout:this.embedChat}),"wall"!=this.layout||this.refreshActive||"0"!=this.disableScroll||l.scrollIntoView(),this.wrapper.classList.add("cp-streamweasels--embed-page-active"),this.player.classList.add("cp-streamweasels__player--embed-page-active"),this.player.dataset.channelName=r.dataset.channelName)),"popup"==this.embed&&(a.insertAdjacentHTML("beforeend",i),e=document.querySelector(".cp-streamweasels-modal"),t=document.querySelector(".cp-streamweasels-modal__player"),s=new Twitch.Embed(t,{width:"100%",height:"100%",channel:r.dataset.channelName,theme:this.embedTheme,layout:this.embedChat}),this._modalControls(e),this.wrapper.classList.add("cp-streamweasels--embed-popup-active")),this.embedMuted&&"twitch"!==this.embed&&this._muteEmbed(s,!0),this.embedTitle&&"page"==this.embed&&"online"==r.dataset.status&&this._embedTitle(r.getAttribute("title"))}},_embedVod:{value:function(e){var t,s=this.wrapper.dataset.vodType,a=document.querySelector("body"),i=this.wrapper.querySelector(".cp-streamweasels__player"),r=`<div class="cp-streamweasels-modal"> 73 ${this.embedTitle&&"top"==this.embedTitlePosition?'<div class="cp-streamweasels-modal__title"><p>'+e.getAttribute("title")+"</p></div>":""} 74 <div class="cp-streamweasels-modal__player"></div> 75 ${this.embedTitle&&"bottom"==this.embedTitlePosition?'<div class="cp-streamweasels-modal__title"><p>'+e.getAttribute("title")+"</p></div>":""} 76 </div>`,i=this.wrapper.querySelector(".cp-streamweasels__player");"twitch"==this.embed&&window.open(e.getAttribute("href"),"_blank"),"page"==this.embed&&(i.innerHTML="","clips"==s?(t=` 77 <iframe 78 src="https://clips.twitch.tv/embed?clip=${e.dataset.vodId}&parent=${window.location.host}&muted=${this.embedMuted&&!0}" 79 height="100%" 80 width="100%" 81 allowfullscreen="true"> 82 </iframe> 83 `,i.insertAdjacentHTML("beforeend",t)):new Twitch.Embed(i,{width:"100%",height:"100%",video:e.dataset.vodId,theme:this.embedTheme,layout:this.embedChat}),i.scrollIntoView(),this.wrapper.classList.add("cp-streamweasels--embed-page-active"),this.player.classList.add("cp-streamweasels__player--embed-page-active")),"popup"==this.embed&&(a.insertAdjacentHTML("beforeend",r),i=document.querySelector(".cp-streamweasels-modal"),a=document.querySelector(".cp-streamweasels-modal__player"),"clips"==s?(t=` 84 <iframe 85 src="https://clips.twitch.tv/embed?clip=${e.dataset.vodId}&parent=${window.location.host}&muted=${this.embedMuted&&!0}" 86 height="100%" 87 width="100%" 88 allowfullscreen="true"> 89 </iframe> 90 `,a.insertAdjacentHTML("beforeend",t)):new Twitch.Embed(a,{width:"100%",height:"100%",video:e.dataset.vodId,theme:this.embedTheme,layout:this.embedChat}),this._modalControls(i),this.wrapper.classList.add("cp-streamweasels--embed-popup-active")),this.embedTitle&&"page"==this.embed&&this._embedTitle(e.getAttribute("title"))}},_sortStreams:{value:function(){var t=this.wrapper.querySelector(".cp-streamweasels__streams");[...t.children].sort(function(e,t){return"alpha"==this.tileSorting?"vods"==this.layout?new Date(e.children[0].dataset.date)>new Date(t.children[0].dataset.date)?1:-1:e.children[0].dataset.channelName>t.children[0].dataset.channelName?1:-1:"least"==this.tileSorting?e.children[0].dataset.viewers-t.children[0].dataset.viewers:"most"==this.tileSorting?t.children[0].dataset.viewers-e.children[0].dataset.viewers:"random"==this.tileSorting?.5-Math.random():void 0}
90.bind(this)).forEach(e=>{t.appendChild(e)})}},_muteEmbed:{value:function(e){e.addEventListener(Twitch.Embed.VIDEO_READY,()=>{e.getPlayer().setMuted(!0)})}},_embedTitle:{value:function(e){this.wrapper.querySelector(".cp-streamweasels__title").innerHTML="<p>"+e+"</p>"}},_modalControls:{value:function(t){t.addEventListener("click",function(e){t.remove()}),document.onkeydown=function(e){"Escape"===e.key&&t.remove()}}},_roundViewers:{value:function(e){return e=1e3<e&&e<999999&&".0K"==(e=(e/1e3).toFixed(1)+"K").slice(e.length-3)?e.replace(".0K","K"):e}},_getGameName:{value:function(s){var e="&id="+s.filter((e,t)=>s.indexOf(e)===t).toString(),t=Math.floor(1e3+9e3*Math.random()),a=[];a[t]=new XMLHttpRequest,a[t].open("GET",streamWeaselsVars.siteUrl+"/?rest_route=/streamweasels/v1/fetch-games/"+e),a[t].setRequestHeader("X-WP-Nonce",this.nonce),a[t].onreadystatechange=function(){var e;4===a[t].readyState&&(e=JSON.parse(a[t].responseText),this._handleApiResponse(e,"_getGameName"))&&this._setGameName(e.data)}.bind(this),a[t].send()}},_setGameName:{value:function(e){for(var i=new Object,t=0;t<e.length;t++)i[e[t].id]={name:e[t].name,art:e[t].box_art_url};this.target.children.length&&this.target.querySelectorAll(".cp-stream").forEach(function(e,t,s){var e=e.querySelector(".cp-stream__logo"),a=e.dataset.gameId,a=(a=(a=i[a]?.art||"").replace("{width}","80")).replace("{height}","106");e.setAttribute("src",a)})}},_startRailSlides:{value:function(e,t){var s=3;e.offsetWidth<768&&(s=2),e.offsetWidth<560&&(s=1),jQuery(t).slick({dots:!1,slidesToShow:s,slidesToScroll:1,swipeToSlide:!0,nextArrow:'<button type="button" class="slick-prev"><svg fill="#FFFFFF" height="24" viewBox="0 0 24 24" width="24"><path d="M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"/><path d="M0-.5h24v24H0z" fill="none"/></svg></button>',prevArrow:'<button type="button" class="slick-next"><svg fill="#FFFFFF" height="24" viewBox="0 0 24 24" width="24"><path d="M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"/><path d="M0-.25h24v24H0z" fill="none"/></svg></button>',responsive:[{breakpoint:768,settings:{slidesToShow:2}},{breakpoint:560,settings:{slidesToShow:1}}]})}},_startShowcase:{value:function(e,t){var s=this.wrapper.querySelector(".cp-streamweasels__inner");1920<=s.offsetWidth?slidesToShow=7:1680<=s.offsetWidth?slidesToShow=6:1440<=s.offsetWidth?slidesToShow=5:1280<=s.offsetWidth?slidesToShow=4:1024<=s.offsetWidth?slidesToShow=3:768<=s.offsetWidth?slidesToShow=2:560<=s.offsetWidth&&(slidesToShow=1),jQuery(t).slick({dots:!1,slidesToShow:slidesToShow,slidesToScroll:1,swipeToSlide:!0,nextArrow:'<button type="button" class="slick-prev"><svg fill="#FFFFFF" height="24" viewBox="0 0 24 24" width="24"><path d="M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"/><path d="M0-.5h24v24H0z" fill="none"/></svg></button>',prevArrow:'<button type="button" class="slick-next"><svg fill="#FFFFFF" height="24" viewBox="0 0 24 24" width="24"><path d="M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"/><path d="M0-.25h24v24H0z" fill="none"/></svg></button>',responsive:[{breakpoint:9999,settings:{slidesToShow:1680<=s.offsetWidth?6:slidesToShow}},{breakpoint:1680,settings:{slidesToShow:1440<=s.offsetWidth?5:slidesToShow}},{breakpoint:1440,settings:{slidesToShow:1280<=s.offsetWidth?4:slidesToShow}},{breakpoint:1280,settings:{slidesToShow:1024<=s.offsetWidth?4:slidesToShow}},{breakpoint:1024,settings:{slidesToShow:768<=s.offsetWidth?3:slidesToShow}},{breakpoint:768,settings:{slidesToShow:560<=s.offsetWidth?2:slidesToShow}},{breakpoint:560,settings:{slidesToShow:1}}]})}},_startFlipster:{value:function(i,e){var t=2;switch(e.querySelectorAll(".cp-stream--online").length){case 1:t=0;break;case 2:t=1}jQuery(i).flipster({style:"carousel",itemContainer:".cp-streamweasels__streams",itemSelector:".cp-stream",loop:!0,buttons:!0,spacing:-.5,scrollwheel:!1,start:t,onItemSwitch:function(){var e,t=i.querySelector(".flipster__item--embed"),s=i.querySelector(".flipster__item--past-1"),a=i.querySelector(".flipster__item--future-1");t&&(e=t.querySelector("iframe"),s=s?s.querySelector("iframe"):"",a=a?a.querySelector("iframe"):"",t.classList.remove("flipster__item--embed"),e&&e.remove(),s&&e.remove(),a)&&e.remove()}})}},_daysAgo:{value:function(e){var t=new Date,e=new Date(e),s=(e.setDate(e.getDate()),t-e),a=0;if((s=Math.floor(s/1e3))<2)return"a moment ago";if(s<5)return"moments ago";if(s<60)return s+" seconds ago";if(s<120)return"a minute ago";if(s<3600){for(;60<=s;)s-=60,a+=1;return a+" minutes ago"}if(s<7200)return"an hour ago";if(s<86400){for(;3600<=s;)s-=3600,a+=1;return a+" hours ago"}if(s<172800)return"a day ago";if(s<604800){for(;172800<=s;)s-=172800,a+=1;return a+" days ago"}if(s<1209600)return"a week ago";if(s<2592e3){for(;604800<=s;)s-=604800,a+=1;return a+" weeks ago"}if(s<5184e3)return"a month ago";if(s<31536e3){for(;2592e3<=s;)s-=2592e3,a+=1;return a+" months ago"}return s<141912e4?"more than year ago":void 0}}});var streamWeaselsNodes=document.querySelectorAll(".cp-streamweasels"),navChannelCount=0,navTeamCount=0;
90streamWeaselsNodes.forEach(function(item,index,array){var uuid=item.dataset.uuid,layout=item.dataset.layout;if("nav"==layout){if(item.dataset.channels&&(navChannelCount++,1<navChannelCount))return;if(item.dataset.team&&(navTeamCount++,1<navTeamCount))return}fetchFreshNonce().then(function(freshNonce){var streamWeaselsVarUuid,streamWeaselsInit;/^\d+$/.test(uuid)?(streamWeaselsVarUuid=eval("streamWeaselsVars"+uuid),streamWeaselsInit=new streamWeasels({uuid:uuid,gameName:streamWeaselsVarUuid.gameName,game:streamWeaselsVarUuid.gameid,language:streamWeaselsVarUuid.language,channels:streamWeaselsVarUuid.channels,team:streamWeaselsVarUuid.team,titleFilter:streamWeaselsVarUuid.titleFilter,limit:streamWeaselsVarUuid.limit,layout:streamWeaselsVarUuid.layout,embed:streamWeaselsVarUuid.embed,embedTheme:streamWeaselsVarUuid.embedTheme,embedChat:streamWeaselsVarUuid.embedChat,embedTitle:streamWeaselsVarUuid.embedTitle,embedTitlePosition:streamWeaselsVarUuid.embedTitlePosition,embedMuted:streamWeaselsVarUuid.embedMuted,showOffline:streamWeaselsVarUuid.showOffline,showOfflineText:streamWeaselsVarUuid.showOfflineText,showOfflineImage:streamWeaselsVarUuid.showOfflineImage,auto
90play:streamWeaselsVarUuid.autoplay,autoplayOffline:streamWeaselsVarUuid.autoplayOffline,autoplaySelect:streamWeaselsVarUuid.autoplaySelect,featured:streamWeaselsVarUuid.featured,offlineImage:streamWeaselsVarUuid.offlineImage,logoImage:streamWeaselsVarUuid.logoImage,profileImage:streamWeaselsVarUuid.profileImage,tileLayout:streamWeaselsVarUuid.tileLayout,tileSorting:streamWeaselsVarUuid.tileSorting,tileLive:streamWeaselsVarUuid.tileLive,logoBgColour:streamWeaselsVarUuid.logoBgColour,logoBorderColour:streamWeaselsVarUuid.logoBorderColour,maxWidth:streamWeaselsVarUuid.maxWidth,tileBgColour:streamWeaselsVarUuid.tileBgColour,tileTitleColour:streamWeaselsVarUuid.tileTitleColour,tileSubtitleColour:streamWeaselsVarUuid.tileSubtitleColour,tileRoundedCorners:streamWeaselsVarUuid.tileRoundedCorners,hoverColour:streamWeaselsVarUuid.hoverColour,refresh:streamWeaselsVarUuid.refresh,disableScroll:streamWeaselsVarUuid.disableScroll,translationsLive:streamWeaselsVarUuid.translationsLive,translationsOffline:streamWeaselsVarUuid.translationsOffline,translationsViewers:streamWeaselsVarUuid.translationsViewers,translationsStreaming:streamWeaselsVarUuid.translationsStreaming,translationsFor:streamWeaselsVarUuid.translationsFor,nonce:freshNonce}),"wall"==streamWeaselsVarUuid.layout&&"1"==streamWeaselsVarUuid.refresh&&setInterval(function(){streamWeaselsInit._refresh()},6e4)):console.error("Invalid UUID:",uuid)}).catch(function(e){console.error("Error fetching nonce:",e)})});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.