var Pixel=function(host,token){function calculateScrollPercent(){var body=document.body||{},html=document.documentElement||{},height=(height=width=0,width=window.screen.availWidth&&window.screen.width?window.screen.availWidth>window.screen.width?window.screen.width:window.screen.availWidth:window.screen.availWidth||window.screen.width,window.innerWidth&&window.innerWidth<width&&(width=window.innerWidth),height=window.screen.availHeight&&window.screen.height?window.screen.availHeight>window.screen.height?window.screen.height:window.screen.availHeight:window.screen.availHeight||window.screen.height,window.innerHeight&&window.innerHeight<height&&(height=window.innerHeight),1<window.innerWidth/window.innerHeight?{width:height<width?width:height,height:height<width?height:width}:{width:width<height?width:height,height:width<height?height:width}),width=(()=>{var body=document.body||{},html=document.documentElement||{};return Math.max(body.scrollHeight||0,body.offsetHeight||0,html.clientHeight||0,html.scrollHeight||0,html.offsetHeight||0)})(),html=html.scrollTop||body.scrollTop||window.pageYOffset||0,body=Math.min(html+height.height,width);return 0<width?body/width*100:0}var $pixel,data,anchorParams,camp_id,url_search,tc;window.MAT_blocked=!1,window.addEventListener("blockMat",function(event){window.MAT_blocked=!0}),window.addEventListener("unblockMat",function(event){window.MAT_blocked=!1}),host&&token&&(host.indexOf(".spxl.socy.es",host.length-".spxl.socy.es".length)<0&&(host="json.spxl.socy.es"),this.token=token="A3NO_734_752_123_A3ME"==(token="ATREStCJZbZJWdr"==(token="EUFM_734_026_541_A3ME"==(token="CINEMANIA"==token?"CINE_486_193_607":token)?"ONCE_928_838_342_A3ME":token)?"A3AN_934_952_923":token)?"A3NN_834_852_823":token,this.host=host,this.referrer=document.referrer,this.time_init=Date.now()/1e3,this.is_blur=!1,this.counter=0,($pixel=this).mat=null,this.getCookie=function(cname){for(var name=cname+"=",ca=document.cookie.split(";"),i=0;i<ca.length;i++){for(var c=ca[i];" "==c.charAt(0);)c=c.substring(1);if(0==c.indexOf(name))try{return decodeURIComponent(c.substring(name.length))}catch(e){return c.substring(name.length)}}return""},this.setCookie=function(cname,cvalue,exhours,cpath="/"){var host,d=new Date,exhours=(d.setTime(d.getTime()+60*exhours*60*1e3),"expires="+d.toUTCString());return"md_pxl_n"!=cname&&"_MAT_XUM_"!=cname&&"SPC_XUM"!=cname?(document.cookie=cname+"=",document.cookie=cname+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;",document.cookie=cname+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path="+cpath,document.cookie=cname+"="+cvalue+";"+exhours+";path="+cpath,!!this.getCookie(cname)):"_MAT_XUM_"==cname?(host=window.location.hostname.replace("www.",""),document.cookie=cname+"=",document.cookie=cname+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;",document.cookie=cname+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path="+cpath+";domain=."+host,document.cookie=cname+"="+cvalue+";"+exhours+";path="+cpath+";domain=."+host,localStorage.setItem("_MAT_XUM_",cvalue),!!this.getCookie(cname)&&!!localStorage.getItem("_MAT_XUM_")):"SPC_XUM"==cname?(host=window.location.hostname.replace("www.",""),document.cookie=cname+"=",document.cookie=cname+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;",document.cookie=cname+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path="+cpath+";domain=."+host,document.cookie=cname+"="+cvalue+";"+exhours+";path="+cpath+";domain=."+host,!!this.getCookie(cname)):(localStorage.setItem("md_pxl_n",cvalue),localStorage.setItem("md_pxl_n_expires",exhours),!!localStorage.getItem("md_pxl_n")&&!!localStorage.getItem("md_pxl_n_expires"))},this.serialize=function(obj){var key,str="";for(key in obj)""!=str&&(str+="&"),str+=key+"="+encodeURIComponent(obj[key]);return str},this.get=function(url,dataObject,callback,errorCallback){var xhr=new XMLHttpRequest;xhr.onreadystatechange=function(){xhr.readyState===XMLHttpRequest.DONE&&200===xhr.status&&"function"==typeof callback&&callback(xhr.responseText),xhr.readyState===XMLHttpRequest.DONE&&200!==xhr.status&&"function"==typeof errorCallback&&errorCallback(xhr.responseText)},xhr.open("GET",url+"?"+this.serialize(dataObject),!0),xhr.send()},this.getWithCredentials=function(url,dataObject,callback,errorCallback){var xhr=new XMLHttpRequest;xhr.onreadystatechange=function(){xhr.readyState===XMLHttpRequest.DONE&&200===xhr.status&&"function"==typeof callback&&callback(xhr.responseText),xhr.readyState===XMLHttpRequest.DONE&&200!==xhr.status&&"function"==typeof errorCallback&&errorCallback(xhr.responseText)},xhr.withCredentials=!0,xhr.open("GET",url+"?"+this.serialize(dataObject),!0),xhr.send()},this.getJSON=function(url,dataObject,callback,errorCallback){this.get(url,dataObject,function(data){callback(JSON.parse(data))},function(data){"function"==typeof errorCallback&&errorCallback(JSON.parse(data))})},this.getJSONWithCredentials=function(url,dataObject,callback,errorCallback){this.getWithCredentials(url,dataObject,function(data){callback(JSON.parse(data))},function(data){"function"==typeof errorCallback&&errorCallback(JSON.parse(data))})},this.ping=function(seconds,id_media){var $this;this.idv&&!this.is_blur&&0!==(seconds="number"!=typeof seconds?0:seconds)&&($this=this,window.setTimeout(function(){$pixel.counter=$pixel.counter+1,$pixel.get("https://p1.socy.es/pf1.json",{idv:$pixel.idv,t:$pixel.token,time:Math.floor(Date.now()/1e3-$this.time_init),prof:Math.floor($pixel.maxScroll),c:$pixel.counter,i:id_media,a:Math.floor(Date.now()/1e3)},function(pingObject){$pixel.ping(seconds,id_media)})},1e3*seconds))},this._ga=this.getCookie("_ga"),this._gid=this.getCookie("_gid"),this.maxScroll=calculateScrollPercent(),this._uid=this._ga||this._gid||this.getCookie("__bs_id")||"bs.1.0."+(length=>{for(var result="",alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=0;i<length;i++)result+=alphabet.charAt(Math.floor(Math.random()*alphabet.length));return result})(12),this.setCookie("__bs_id",this._uid,8760),data={t:$pixel.token,r:$pixel.referrer,h:window&&window.location&&window.location.href,_ga:$pixel._ga,_gid:$pixel._gid,_uid:$pixel._uid},(token=window&&window.location&&window.location.hash)&&(anchorParams={},(token=(token=(token=(token=token.slice(1)).split("#"))[0]).split("@")).map(function(param,i){param=param.split("=");return"mat_token"!==param[0]||void 0===param[1]||(anchorParams[param[0]]=param[1].substring(0,45),!1)}),data.fm=anchorParams.mat_token||""),(""===document.referrer||document.referrer.indexOf(window.location.host)<0&&document.referrer.indexOf("traffic.besocy.com")<0)&&sessionStorage.setItem("original_visit",""),localStorage.getItem("md_pxl_n")&&(data.n=localStorage.getItem("md_pxl_n")),sessionStorage.getItem("matSessionID")&&(data.matSession=sessionStorage.getItem("matSessionID")),sessionStorage.getItem("original_visit")&&(data.original_visit=sessionStorage.getItem("original_visit")),location.search&&(tc=(url_search=new URLSearchParams(location.search)).get("_tcode"),camp_id=url_search.get("sp_ad"),tc)&&(data._tcode=tc),location.hash&&(tc=(url_search=new URLSearchParams(location.hash.replace("#",""))).get("_tcode"),camp_id=url_search.get("sp_ad"),tc)&&(data._tcode=tc),dt_spxl_CO={camp_id:camp_id,getData:function(){var that=this;return new Promise(function(resolve,reject){try{var request;that.camp_id?((request=new XMLHttpRequest).open("GET","https://co.socy.es/"+that.camp_id,!0),request.onload=function(){200<=request.status&&request.status<400?(data=JSON.parse(request.responseText))?resolve(data):reject({error:2,error_msg:"json parse error"}):reject({error:1,error_msg:"http error"})},request.onerror=function(){reject({error:1,error_msg:"http error"})},request.send()):reject({error:0,error_msg:"Not campaign found"})}catch(e){reject(e)}})}},$pixel.getJSON("https://"+host+"/pixel.json",data,function(responseData){if(responseData&&void 0===responseData.error_msg){$pixel.idv=responseData.__IDV__,$pixel.browserId=responseData.__NAVEGADOR__,$pixel.cookies=responseData.__COOKIES__,$pixel.medio=responseData.__MEDIADATA__,$pixel.geoip=responseData.__GEOIP__,$pixel.adsocyTest=responseData.__ADSOCY_TEST__||!1,$pixel.adsocyHbTest=responseData.__ADSOCY_HB_TEST__||!1;var cookie,matHost=(matHost=$pixel.medio.mat_host||"mat.socy.es").trim(),medioPathIncluded=(document.querySelector("[data-mat-mix-data]")&&((responseData=$pixel.geoip&&$pixel.geoip.countryCode?$pixel.geoip:{}).countryName&&(responseData.countryName=encodeURIComponent(responseData.countryName)),responseData.cityName&&(responseData.cityName=encodeURIComponent(responseData.cityName)),responseData.regionName&&(responseData.regionName=encodeURIComponent(responseData.regionName)),responseData.subregionName&&(responseData.subregionName=encodeURIComponent(responseData.subregionName)),pingDomain=(pingDomain=$pixel.medio.ping_domain||"p1.socy.es").trim(),($mixAnchorJsonV3=document.createElement("script")).src="https://"+matHost+"/mat.php/api/mix_json?p1="+encodeURIComponent(btoa(pingDomain))+"&g="+encodeURIComponent(btoa(JSON.stringify(responseData))),document.body.appendChild($mixAnchorJsonV3)),$pixel.adsocyTest=$pixel.adsocyTest?JSON.stringify($pixel.adsocyTest):"",$pixel.adsocyTest&&sessionStorage.setItem("adsocy_test",$pixel.adsocyTest),$pixel.adsocyHbTest&&$pixel.adsocyHbTest.selectors&&Array.isArray($pixel.adsocyHbTest.selectors)&&$pixel.adsocyHbTest.url&&$pixel.adsocyHbTest.selectors.forEach(function(selector){var iframe,selector=document.querySelector(selector);selector&&(console.log("[ADSOCY HB TEST] Printing campaign test"),selector.innerHTML="",(iframe=document.createElement("iframe")).setAttribute("style","display:block; width:300px; height:600px; border:none; margin:0 auto 30px;"),iframe.setAttribute("width",300),iframe.setAttribute("height",600),iframe.src=$pixel.adsocyHbTest.url,selector.appendChild(iframe))}),"");for(cookie in $pixel.medio&&$pixel.medio.path_included&&(medioPathIncluded=$pixel.medio.path_included.trim()),$pixel.cookies)$pixel.cookies[cookie]&&"false"!=$pixel.cookies[cookie]?$pixel.setCookie(cookie,$pixel.cookies[cookie],148,"/"+medioPathIncluded):$pixel.setCookie(cookie,$pixel.cookies[cookie],0,"/"+medioPathIncluded);if($pixel.idv){var cachebuster=Math.round((new Date).getTime()/6e5);if($pixel.xandrUserMapping=null,!(-1<window.location.href.indexOf("ref=iframe")||window.frameElement)){$pixel.medio&&$pixel.medio.ping&&0<$pixel.medio.ping&&$pixel.ping(parseInt($pixel.medio.ping),parseInt($pixel.medio.id)),(""===document.referrer||document.referrer.indexOf(window.location.host)<0&&document.referrer.indexOf("traffic.besocy.com")<0)&&sessionStorage.setItem("original_visit",$pixel.idv),window.onscroll=function(){var actualScroll=calculateScrollPercent();actualScroll>$pixel.maxScroll&&($pixel.maxScroll=actualScroll)},window.onblur=function(){$pixel.is_blur=!0},window.onfocus=function(){$pixel.is_blur?($pixel.time_init=Date.now()/1e3,$pixel.is_blur=!1,$pixel.medio&&$pixel.medio.ping&&0<$pixel.medio.ping&&$pixel.ping(parseInt($pixel.medio.ping),parseInt($pixel.medio.id))):$pixel.is_blur=!1},$pixel.initMAT=function(){"undefined"!=typeof Mat&&window.__mat_data&&($pixel.mat=new Mat($pixel,window.__mat_data))},$pixel.getMAT=function(getData){var matToken,metaKeywords;$pixel.getCookie("_MAT_TK_")&&"void"!==$pixel.getCookie("_MAT_TK_").substring(0,4)&&$pixel.medio.id&&!window.frameElement&&(matToken=$pixel.getCookie("_MAT_TK_"),metaKeywords=document.querySelector("meta[name='keywords']"),getData.endpoint||(getData.endpoint="https://"+matHost+"/mat.json"),getData.styles||(getData.styles="https://"+matHost+"/mat/css/"+$pixel.token+"?mat_token="+matToken),getData.script||(getData.script="https://"+matHost+"/mat/js/"+$pixel.token+"?mat_token="+matToken),$pixel.loadData={matToken:matToken,metaKeywords:metaKeywords,endpoint:getData.endpoint,styles:getData.styles,stylesContent:getData.stylesContent||"",script:getData.script,scriptContent:getData.scriptContent||"",noCacheEndpoint:getData.noCacheEndpoint,consent:"",sendMatR:getData.sendMatR||!1},matToken="",$pixel.medio.consent_name&&$pixel.getCookie($pixel.medio.consent_name)?matToken=$pixel.getCookie($pixel.medio.consent_name):$pixel.getCookie("euconsent-v2")?matToken=$pixel.getCookie("euconsent-v2"):$pixel.getCookie("eupubconsent-v2")&&(matToken=$pixel.getCookie("eupubconsent-v2")),$pixel.medio.sconsent&&"1"===$pixel.medio.sconsent&&""!==matToken&&150<matToken.length&&$pixel.medio.consent_sign&&this.get("https://"+matHost+"/mat.php/api/sconsent",{cid:$pixel.medio.client,mid:$pixel.medio.id,s:$pixel.medio.consent_sign,c:matToken}),$pixel.loadData.consent=matToken,$pixel.getCookie("_MAT_XUM_")||$pixel.getCookie("SPC_XUM")?($pixel.xandrUserMapping={pixel_uid:$pixel.browserId,xandr_uid:$pixel.getCookie("_MAT_XUM_")},$pixel.loadMat()):((metaKeywords=document.createElement("script")).onerror=function(){$pixel.xandrUserMapping={pixel_uid:$pixel.browserId,xandr_uid:""},$pixel.loadMat()},metaKeywords.src="https://ib.adnxs.com/getuid?https://"+matHost+"/mat.php/api/xandr_usermapping?pxl_id="+$pixel.browserId+"&user_id=$UID&consent="+matToken,document.body.appendChild(metaKeywords)))},$pixel.loadMat=function(){var loadData=$pixel.loadData,style=($pixel.xandrUserMapping&&($pixel.xandrUserMapping.consent=loadData.consent),loadData.stylesContent?document.querySelector("style#mat-styles")||((style=document.createElement("style")).id="mat-styles",style.innerHTML=loadData.stylesContent,document.head.append(style)):document.querySelector("link#mat-styles")||((style=document.createElement("link")).id="mat-styles",style.rel="stylesheet",style.href=loadData.styles,document.head.append(style)),loadData.scriptContent?document.querySelector("script#mat-scripts")||((matScript=document.createElement("script")).setAttribute("id","mat-scripts"),matScript.innerHTML=loadData.scriptContent,document.head.append(matScript),$pixel.initMAT()):document.querySelector("script#mat-scripts")||((matScript=document.createElement("script")).setAttribute("id","mat-scripts"),matScript.setAttribute("crossorigin","anonymous"),matScript.setAttribute("async","1"),matScript.onload=$pixel.initMAT,document.head.append(matScript),matScript.src=loadData.script),-1!==loadData.endpoint.search("/yc/")),matScript=-1!==loadData.script.search("/mini/"),preMatSession=sessionStorage.getItem("matSessionID")?sessionStorage.getItem("matSessionID"):"",preMatR=(preMatR=document.location.href||$pixel.referrer).split("?")[0],matScript=(style&&(preMatSession="sessionCached",matScript&&loadData.sendMatR||(preMatR="")),"");style?$pixel.geoip&&$pixel.geoip.countryCode&&["ES"].includes($pixel.geoip.countryCode)&&(matScript=JSON.stringify({countryCode:$pixel.geoip.countryCode})):matScript=JSON.stringify($pixel.geoip),$pixel.getJSON(loadData.endpoint,{media:$pixel.medio.id,matToken:loadData.matToken,_ga:style?"":$pixel._uid,matSession:preMatSession,_:!style&&loadData.noCacheEndpoint?(new Date).getTime():"",adsocyTest:sessionStorage.getItem("adsocy_test")?sessionStorage.getItem("adsocy_test"):"",geoip:matScript,matR:preMatR,xandrData:$pixel.xandrUserMapping&&!style?JSON.stringify($pixel.xandrUserMapping):"",t:cachebuster},function(data){if(data.mat){if((window.__mat_data=data).session)if("sessionCached"===data.session){for(var digits=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],matSession="",i=0;i<32;i++)matSession+=digits[Math.floor(Math.random()*digits.length)];$pixel.setCookie("matSessionID",matSession,1,"/"+medioPathIncluded)}else $pixel.setCookie("matSessionID",data.session,1,"/"+medioPathIncluded);$pixel.initMAT()}else $pixel.setCookie("_MAT_TK_","void_1_nomatdata",.00167,"/"+medioPathIncluded)},function(data){$pixel.setCookie("_MAT_TK_","void_2_loadfail",.00167,"/"+medioPathIncluded)})};var pingDomain=null;if(!$pixel.getCookie("_MAT_TK_")&&$pixel.medio.id&&2==$pixel.medio.phase?pingDomain={media:$pixel.medio.id,t:cachebuster}:$pixel.getCookie("_MAT_TK_")&&"void"!==$pixel.getCookie("_MAT_TK_").substring(0,4)&&$pixel.medio.id&&(pingDomain={media:$pixel.medio.id,matToken:$pixel.getCookie("_MAT_TK_"),t:cachebuster}),pingDomain){var responseData=["_MAT_1_","_MAT_2_"],$mixAnchorJsonV3=null,modUserAgent=($pixel.getCookie("_MAT_RNG_")&&responseData.includes($pixel.getCookie("_MAT_RNG_"))?$mixAnchorJsonV3=$pixel.getCookie("_MAT_RNG_"):($mixAnchorJsonV3=responseData[Math.floor(Math.random()*responseData.length)],$pixel.setCookie("_MAT_RNG_",$mixAnchorJsonV3,720,"/"+medioPathIncluded)),navigator.userAgent+" "+$mixAnchorJsonV3),responseData=!0;if(pingDomain.matToken&&$pixel.getCookie("_MAT_CHK_"+pingDomain.matToken.replace("0x","").toLowerCase())&&!$pixel.getCookie("__MAT_REGENERATE__")){var re,reUrl,$mixAnchorJsonV3=$pixel.getCookie("_MAT_CHK_"+pingDomain.matToken.replace("0x","").toLowerCase());try{($mixAnchorJsonV3=JSON.parse(atob($mixAnchorJsonV3))).pi&&$mixAnchorJsonV3.pi!=="/"+medioPathIncluded?(responseData=!0,delete pingDomain.matToken,$pixel.setCookie("_MAT_TK_","void_8_novalidcookiepath",.1,"/"+medioPathIncluded)):(re=new RegExp($mixAnchorJsonV3.ua),modUserAgent.match(re)?!$mixAnchorJsonV3.ur||(reUrl=new RegExp($mixAnchorJsonV3.ur),(window.location.hostname+window.location.pathname).match(reUrl))?(responseData=!1,$pixel.getMAT({endpoint:$mixAnchorJsonV3.ep,styles:$mixAnchorJsonV3.st,script:$mixAnchorJsonV3.sc,noCacheEndpoint:!1})):responseData=!0:(responseData=!1,$pixel.setCookie("_MAT_TK_","void_6_novalidcachedtoken",.1,"/"+medioPathIncluded)))}catch(e){responseData=!1,$pixel.setCookie("_MAT_TK_","void_7_novalidcachedtokendata",.1,"/"+medioPathIncluded)}}responseData&&$pixel.getJSON("https://"+matHost+"/mat.php/check",pingDomain,function(matCheck){if("success"==matCheck.result&&matCheck.tokensData){for(var endpoint,noCache,checkData,tokenData=null,i=0;i<Object.keys(matCheck.tokensData).length;i++){var re=new RegExp(matCheck.tokensData[i].uaRegExp);if(modUserAgent.match(re)){if(!matCheck.tokensData[i].urlRegExp){tokenData=matCheck.tokensData[i];break}re=new RegExp(matCheck.tokensData[i].urlRegExp);if((window.location.hostname+window.location.pathname).match(re)){tokenData=matCheck.tokensData[i];break}}}tokenData?(endpoint=null,noCache=!1,$pixel.getCookie("__MAT_REGENERATE__")&&"void"!=$pixel.getCookie("__MAT_REGENERATE__").substring(0,4)?($pixel.setCookie("__MAT_REGENERATE__","void_3_regenerate",.25,"/"+medioPathIncluded),endpoint=tokenData.endpointRegenerate,noCache=!0):endpoint=tokenData.endpoint,$pixel.setCookie("_MAT_TK_",tokenData.data.token,.25,"/"+medioPathIncluded),tokenData.scriptContent?$pixel.getMAT({endpoint:endpoint,styles:tokenData.styles,stylesContent:tokenData.stylesContent,script:tokenData.script,scriptContent:tokenData.scriptContent,noCacheEndpoint:noCache,sendMatR:tokenData.sendMatR||!1}):(checkData={ua:tokenData.uaRegExp,ur:tokenData.urlRegExp,ep:endpoint,st:tokenData.styles,sc:tokenData.script,pi:"/"+medioPathIncluded},$pixel.setCookie("_MAT_CHK_"+tokenData.data.token.replace("0x","").toLowerCase(),btoa(JSON.stringify(checkData)),.25,"/"+medioPathIncluded),$pixel.getMAT({endpoint:endpoint,styles:tokenData.styles,script:tokenData.script,noCacheEndpoint:noCache}))):$pixel.setCookie("_MAT_TK_","void_4_novalidtoken",.1,"/"+medioPathIncluded)}else $pixel.setCookie("_MAT_TK_","void_5_notokenfound",.1,"/"+medioPathIncluded)},function(){$pixel.setCookie("_MAT_TK_","void_5_checkfail",.00167,"/"+medioPathIncluded)})}}}}}))};(()=>{window.zzzPixelScript=document.currentScript||document.getElementById("dogtrack-pixel")||document.getElementById("dogtrack-app")||document.getElementById("besocy_spixel");var parser=document.createElement("a");parser.href=zzzPixelScript.src,zzzPixelScript.dataset.h||(zzzPixelScript.dataset.h=zzzPixelScript.h||parser.hostname),zzzPixelScript.dataset.t||("string"==typeof(parser=zzzPixelScript.t||parser.pathname.replace("/pixel/js/","").replace("pixel/js/",""))&&-1<parser.indexOf("/")&&(parser=parser.substring(0,parser.indexOf("/"))),zzzPixelScript.dataset.t=parser),zzzPixelScript.p=new Pixel(zzzPixelScript.dataset.h,zzzPixelScript.dataset.t)})();