console.log("loading config for pcinvasion");window.gamursInfScrollCustomSiteConfig={site:"pcinvasion",useCategories:true,useTags:true,categories:undefined,tags:undefined,sameCategory:false};window.gamursInfScroll={infScrollURL:"https://infinity-api.pcinvasion.com"};"use strict";console.log("Infinite scroll initialised");(function(){var P,D,J,H,W;if(typeof window>"u")return;let n=window.gamursInfScrollCustomSiteConfig,U=window.gamursInfScroll,q=n&&(P=n.categories)!=null?P:"",T=n&&(D=n.tags)!=null?D:"",L=!(n&&n.useCategories===!1),M=!(n&&n.useTags===!1),N=!!(n&&n.sameCategory),y=U&&(J=U.infScrollURL)!=null?J:"",v=document.getElementsByClassName("gamurs-inf-scroll-post")[0].attributes["data-categories"].value,$=document.getElementsByClassName("gamurs-inf-scroll-post")[0].attributes["data-tags"].value,m=(H=document.getElementsByClassName("gamurs-inf-scroll-post")[0].attributes["data-experiments"])==null?void 0:H.value,F=window.location.href;window.gamurs_inf_scroll_data=window.gamurs_inf_scroll_data||{};let S=document.getElementsByClassName("gamurs-inf-scroll-post")[0].dataset.id,s=window.location.hostname.split(".")[window.location.hostname.split(".").length-2];s==="lndo"?s=window.location.hostname.split(".")[0]:s==="go-vip"&&(s=window.location.hostname.split(".")[0],s=s.split("-")[0],s==="www"&&(s=window.location.hostname.split(".")[0].split("-")[1])),window.gamurs_inf_scroll_data.nextUrl=`${y}/infscroll/${s}/${S}?categories=${v}&tags=${$}&useCategories=${L}&useTags=${M}&forceCategories=${q}&forceTags=${T}&sameCategory=${N}${m?`&experiments="${m}"`:""}`;let V={root:document.querySelector("#scroll-area"),rootMargin:"0px",threshold:.5},Y={rootMargin:"-50% 0% -50% 0%",threshold:0},z={rootMargin:"-50% 0% -10% 0%",threshold:0},G={rootMargin:"-75% 0% -25% 0%",threshold:0};function B(e,l,o){let t;return o==="middle"?(t=new IntersectionObserver(l,Y),t=u(e,t,!1)):o==="middleofmiddle"?(t=new IntersectionObserver(l,z),t=u(e,t,!0)):o==="middlelower"?(t=new IntersectionObserver(l,G),t=u(e,t,!1)):(t=new IntersectionObserver(l,V),t=u(e,t,!1)),t}function K(e){if(typeof window.gamursInfScrollOnInfiniteScrollAppend=="function")try{window.gamursInfScrollOnInfiniteScrollAppend(e)}catch(l){console.log(l)}}function Q(e,l){e[0].isIntersecting&&(O(),l.unobserve(e[0].target))}function u(e,l,o){let t;return o?(e.style.position="relative",t=document.createElement("div"),t.style.position="absolute",t.style.top="50%",t.style.width="100%",t.style.height="50%",t.style.pointerEvents="none",e.appendChild(t)):t=e,l.observe(t),l}let p=[],w=document.querySelector(".gamurs-inf-scroll-post");p[w&&(W=w.dataset.id)!=null?W:0]=document.URL;let R=!1;history.scrollRestoration="manual";let C=!0,_="down",b=0;document.addEventListener("scroll",function(){let e=window.pageYOffset||document.documentElement.scrollTop;e>b?_="down":e<b&&(_="up"),b=e<=0?0:e});function X(e,l){e.forEach(o=>{if(o.isIntersecting&&window.location.href!==o.target.dataset.url){let t=p[o.target.dataset.id];if(_==="down"?document.getElementsByClassName("gamurs-inf-scroll-post")[0].dataset.id!==o.target.dataset.id&&history.pushState(null,"",t):window.location.href!==F&&(C=!1,history.back()),document.title=o.target.dataset.title,typeof window.gamursInfScrollOnUrlChange=="function")try{window.gamursInfScrollOnUrlChange(t)}catch(I){console.log(I)}window.snowplow&&window.snowplow("trackStructEvent",{category:"gamurs-infinite-scroll",action:"impression"})}}),Array.from(document.getElementsByClassName("gamurs-inf-scroll-post")).map(o=>l.observe(o))}addEventListener("popstate",e=>{try{C&&document.querySelector(`[data-url="${e.target.location.href.split("?")[0]}"]`).scrollIntoView()}catch(l){console.log(l)}C=!0});function O(){R?j(!1,p,E,x):(R=!0,j(!0,p,E,x))}async function j(e,l,o,t){let I=e?`${y}/campaign/${s}/${S}?categories=${v}&tags=${$}${m?`&experiments="${m}"`:""}`:window.gamurs_inf_scroll_data.nextUrl;await fetch(I).then(i=>{if(i.status!==200)throw e?"No Campaign":`request failed: ${i.text()}`;return i.json()}).then(function(h){let r=h;if(r.html!=null){l[r.id]=r.url,e||(window.gamurs_inf_scroll_data.nextUrl=r.nextUrl);let a=document.createElement("div");a.innerHTML=r.html;let c=a.firstElementChild,g=document.querySelector("#gamurs-inf-scroll-main");if(g&&c)g.appendChild(c);else throw"did not find #gamurs-inf-scroll-main";window.snowplow&&window.snowplow("trackStructEvent",{category:"gamurs-infinite-scroll",action:"append-article",label:r.id}),[a,c].forEach(k=>{Array.from(k.querySelectorAll("script")).forEach(f=>{try{if(f.src){let d=document.createElement("script");d.src=f.src,d.type=f.type,d.id=f.id,d.async=!0,c&&k===c&&c.removeChild(f),g==null||g.appendChild(d)}else(0,eval)(f.innerText)}catch(d){console.log(d)}})}),K(r.id),u(document.querySelectorAll(".gamurs-inf-scroll-post")[document.querySelectorAll(".gamurs-inf-scroll-post").length-1],o,!0),u(document.querySelectorAll(".gamurs-inf-scroll-post")[document.querySelectorAll(".gamurs-inf-scroll-post").length-1],t,!1),o.unobserve(document.querySelectorAll(".gamurs-inf-scroll-post")[document.querySelectorAll(".gamurs-inf-scroll-post").length-2].lastChild)}}).catch(i=>{if(e)console.log(i),i!=="did not find #gamurs-inf-scroll-main"&&O();else{let h=window.gamurs_inf_scroll_data.nextUrl.split("?")[1].split("&").filter(a=>a.slice(0,5)==="page="),r=h.length?parseInt(h[0].split("=")[1]):1;if(r<20){if(i.slice(0,15)==="request failed:"){let a=window.gamurs_inf_scroll_data.nextUrl.split("?");window.gamurs_inf_scroll_data.nextUrl=a[0]+"?page="+(r+1).toString()+"&"+a[1].split("&").filter(c=>c.slice(0,5)!=="page=").join("&")}i!=="did not find #gamurs-inf-scroll-main"&&O()}}})}let x,E;function A(){x=B(w,X,"middlelower"),E=B(w,Q,"middleofmiddle")}s==="dotesports"?fetch("/wp-json/gamurs/v1/infscroll/multisites").then(e=>e.json()).then(e=>{let l=new URL(window.location.href).pathname.split("/")[1];e.includes(l)&&(s=`${s}|${l}`,window.gamurs_inf_scroll_data.nextUrl=`${y}/infscroll/${s}/${S}?categories=${v}&tags=${$}&useCategories=${L}&useTags=${M}&forceCategories=${q}&forceTags=${T}&sameCategory=${N}`),A()}).catch(e=>{console.log(e),A()}):A()})();
