user91471.clients-cdnnow.ru Open in urlscan Pro
185.40.155.13  Public Scan

URL: http://user91471.clients-cdnnow.ru/mp_dist/mstream2.js?v4393126067
Submission: On June 07 via manual from AZ — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

(()=>{"use strict";const t={h:"/mp_dist/",l:15,u:30,p:!0,_:!0,g:"https://logger.moviead55.ru/logger.php?",A:["kinomans.website","filmskino.site"],R:{},S:{T:5,$:4,I:!0,P:!1,C:0,L:0,M:0,V:2,N:15,D:!1},F:{U:0,O:999,B:4},H:{j:5,q:10,W:10,K:15,G:15,J:5,Y:20,X:10},Z:{et:2},rt:9/16,nt:["timeupdate","error"],ht:{ot:{},lt:{ct:"mannb",ut:"manfbl"},dt:{_t:"jbns"},ft:{gt:"stparpm",wt:"stspr",yt:"stcrh"}},bt:{}};let e=(t=10)=>{const e=[...[..."ABCDEFGHIJKLMNOPQRSTUVWXYZ"],...[..."abcdefghijklmnopqrstuvwxyz"]];return[...Array(t)].map((t=>e[Math.random()*e.length|0])).join("")};const i=(t,i)=>new Promise((s=>{const r=document.createElement("iframe");r.id=e(),r.setAttribute("allowtransparency","true"),r.setAttribute("allowfullscreen","true"),r.setAttribute("referrerpolicy","unsafe-url"),r.setAttribute("scrolling","no"),r.setAttribute("allow","encrypted-media *; autoplay *; fullscreen *; "),r.setAttribute("marginheight","0px"),r.setAttribute("marginwidth","0px"),r.setAttribute("frameborder","0"),r.setAttribute("webkitallowfullscreen","true"),r.setAttribute("allowfullscreen","true"),r.setAttribute("mozallowfullscreen","true"),r.src=t,r.addEventListener("load",(()=>{s(r)}),{once:!0}),i.appendChild(r)}));class s{At;kt={};Rt;St;Tt;$t;It;Pt=null;Et=!1;Ct=0;xt=0;Lt=15;Mt=!1;Vt=!1;Nt=new MessageChannel;constructor(t){this.At=t,this.kt={},this.It=document.createElement("div"),this.Rt=document.createElement("div"),this.Rt.classList.add("wrapper"),this.St=document.createElement("div"),this.St.classList.add("container"),this.Rt.appendChild(this.St),this.Tt=document.createElement("div"),this.Tt.classList.add("sound"),this.Tt.classList.add("off"),this.Tt.classList.add("hidden"),this.St.appendChild(this.Tt),this.$t=document.createElement("div"),this.$t.classList.add("movie"),this.$t.classList.add("hidden"),this.St.appendChild(this.$t),document.body.appendChild(this.Rt);const e=document.createElement("div");e.classList.add("fullscreen-spinner"),e.innerHTML='<div class="load"><hr/><hr/><hr/><hr/></div>',document.body.appendChild(e)}lt(){return this.At}Dt(){return this.St}Ft(){return this.Tt}ot(){return this.Rt}Ut(){return this.$t}Ot(t){const e={};e[this.At.Bt]=t;const i=new CustomEvent(this.At.Ht,{detail:e});null!=this.Rt&&this.ot().dispatchEvent(i)}jt(){null!==this.Pt&&this.qt(),this.Ut().remove(),this.$t=null,this.Ft().remove(),this.Tt=null,this.ot().remove(),this.Rt=null,this.Dt().remove(),this.St=null}Wt(t){if(!Array.isArray(t))throw new TypeError("Expected an array, got "+typeof t);const e=[...t];for(let t=e.length-1;t>0;t--){const i=Math.floor(Math.random()*(t+1));[e[t],e[i]]=[e[i],e[t]]}return e}zt=t=>{const e=t.data;if("object"==typeof e)switch(e.type){case"trailer_destroy":this.lt().Kt("Удаляю фрейм"),this.qt();break;case"trailer_ready":this.Mt=!0,this.Vt&&this.Gt()}};Jt=(t,e=!0)=>{const i=t;this.Nt.port1.postMessage(i)};Yt(){const t=this.lt().Xt();this.Lt=t.Qt,this.xt=0,this.lt().Kt("Работа трейлера",this.Lt),this.Ct=window.setInterval((()=>{this.Ot("mads_ping"),this.xt++,this.xt>=this.Lt&&(this.Ut().classList.add("hidden"),this.lt().Kt("Трейлер закончился",this.xt),window.clearInterval(this.Ct),this.qt(),this.lt().ct())}),1e3)}qt(){this.lt().Kt("Удаляю фрейм трейлера"),this.Nt.port1.close(),this.Nt.port1.onmessage=null,this.Nt=new MessageChannel;const t=this.Pt.deref();t.src="about:blank",t.src=t.src,t.addEventListener("load",(()=>{this.Et=!1,this.Vt=!1,t.remove(),this.Pt=null}),{once:!0})}Gt(){if(null!==this.Pt){const t=this.lt().Xt();this.Lt=t.Qt,this.lt().Kt("Trailer Play"),this.Jt({type:"trailer_start",data:{time:t.Qt}}),this.Yt(),this.Ut().classList.remove("hidden")}else this.Vt=!0,this.Zt()}Zt(){if(this.Et)return;if(this.Et=!0,null!==this.Pt)return;const t=this.Wt(this.lt().te("playlist")).splice(0,1)[0],e=t.domain;this.lt().Kt("Trailer prepare",t),i(e+"/td/trhls.html?v"+this.lt().ee,this.lt().ie().Ut()).then((e=>{this.Nt=new MessageChannel,this.Nt.port1.onmessage=this.zt,this.Pt=new WeakRef(e);const i=this.Pt.deref();i.width="100%",i.height="100vh",i.style.border="none",i.style.minHeight="100%",i.style.minWidth="100%";const s={type:"trailer_init",data:{d:this.lt().te("debug")||this.lt().te("showLog"),c:"Hls",t:t}};try{i.contentWindow?.postMessage(s,"*",[this.Nt.port2])}catch(t){this.lt().Kt("postMessage Error",t.toString())}}))}}const r=()=>{function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()};class n{se;re;ne;he;oe;ae;le;ce;ue;de;pe;constructor(t){this.se=t.advertiser,this.re=t.description,this.ne=t.errorURLTemplates,this.he=t.extensions,this.oe=t.id,this.ae=t.impressionURLTemplates,this.le=t.pricing,this.ce=t.sequence,this.ue=t.survey,this.de=t.system,this.pe=t.title}_e(){return this.me(this.ae)}me(t){return Array.isArray(t)?t.map((t=>t&&t.hasOwnProperty("url")?t.url:t)):t}}class h{fe;constructor(t){this.fe=t}ge(){if("number"==typeof this.fe)return this.fe;const[t,e,i]=this.fe.split(":");let s=parseInt(i);return s+=60*parseInt(e),s+=3600*parseInt(t),s}toArray(){const t=this.ge();return[...Array(t).keys()]}}const o=t=>new h(t);class a{we;ve=[];constructor(t,e){t=t||{},this.we={},this.ye(e),Object.keys(t).forEach((e=>{if(t[e].offset)return!1;this.be(e,t[e])}))}Ae(){return this.ve}ye(t){return o(t).toArray().forEach((t=>{0})),this}be(t,e){const i=t.toLowerCase();return""===e||(this.ve[i]||(this.ve[i]=[]),this.ve[i].push(...e)),this}}class l{oe;ke;Re;Se;ce;Te;$e;Ie;Pe;Ee;Ce;xe;Le;Me;constructor(t){this.oe=t.id,this.ke=t.adId,this.Re=((t,e)=>new a(t,e))(t.trackingEvents,this.Ve(!1)),this.Se=t.apiFramework,this.ce=t.sequence,this.Te=t.type,this.$e=t.adParameters,this.Ie=t.duration,this.Pe=t.icons,this.Ee=t.mediaFiles,this.Ce=t.skipDelay,this.xe=t.videoClickThroughURLTemplate,this.Le=t.videoClickTrackingURLTemplates,this.Me=t.videoCustomClickURLTemplates}Ne(){return this.Ee}De(){return this.$e}Ve(t=!0){const e=this.Ie||"00:00:00";return t?o(e).ge():e}Fe(){return this.xe&&this.xe.url?this.xe.url:""}Ue(){if(0===this.Le.length)return[];const t=[];return this.Le.forEach((e=>{e.url&&t.push(e.url)})),t}Oe(){return this.Re.Ae()}Be(t=""){return t=t.toLowerCase(),this.Oe()[t]||[]}}const c=(t,e=void 0)=>t||void 0===e?"true"===t||!0===t:e;const u=(t,e)=>(Object.keys(e).length>0&&Object.keys(e).forEach((function(i){t=t.replace(i,e[i])})),t),d=t=>{const e=[];return Object.keys(t).forEach((i=>{e.push(i+"="+encodeURIComponent(t[i]))})),e.length?e.join("&"):""};(t=>{const e=document.createElement("a");e.href=t;const i=`${e.protocol}//${e.host}`,s=`${i}${e.pathname}`,r=`${s}${e.search}${e.hash}`,n=(t=>{const e=t.split("/").pop();return e.includes(".")?e:""})(r),h=i.replace(/https?:\/\//,"");(t=>{const e={};(t=t.replace("?","").split("&")).forEach((t=>{if(!t.length)return!1;t=t.split("="),e[t[0]]=t[1]}))})(e.search)})(location.href),document.referrer;class p{Se;He;je;qe;We;ze;oe;Ke;Ge;Je;Ye;Xe;Qe;constructor(t){this.Se=t.apiFramework,this.He=t.bitrate,this.je=t.codec,this.qe=t.deliveryType,this.We=(t=>{if(null===t)return"";const e=document.createElement("textarea");return e.innerHTML=t,e.value})(t.fileURL),this.ze=t.height,this.oe=t.id,this.Ke=t.maintainAspectRatio,this.Ge=t.maxBitrate,this.Je=t.mimeType,this.Ye=t.minBitrate,this.Xe=t.scalable,this.Qe=t.width}Ze(){return this.We}ti(){return this.Je}ei(){return"progressive"===this.qe}ii(){return"streaming"===this.qe}si(){return!!this.He&&this.He}ri(){return this.Qe}ni(){return this.ze}hi(){return c(this.Xe,!0)}oi(){return c(this.Ke,!1)}ai(){return!!this.Se&&this.Se}ci(){return!!this.ai()&&"VPAID"===this.ai().toUpperCase()}}const _=new Set(["video/mp4","video/ogg","video/webm","text/javascript","application/javascript","application/x-javascript"]);const m=class{ui;di;pi=[];Ee=[];constructor(){this.ui=!1,this.di=[..._]}_i(){return this.ui=!0,this}mi(){return this.ui}fi(t=[]){return t.forEach((t=>{this.Ee.push(new p(t))})),this.vi().wi().gi(),this}yi(){return this.pi.length?this.pi[0]:null}vi(){return this.pi=this.Ee.filter((t=>this.mi()?t.isVPAID():!t.ci())),this.pi.length||(this.pi=this.Ee),this}wi(){return this.pi=this.pi.filter((t=>{if(t.ci()){if(!t.We)return!1;{let e=t.We;e.startsWith("https://")||e.startsWith("http://")||e.startsWith("//")&&(e=`https://${e.substring(2)}`);try{const i=new URL(e);return!(!i.pathname||!i.pathname.endsWith(".js"))&&(t.We=e,!0)}catch(t){return!1}}}return!0})),this}gi(){return this.pi.sort(((t,e)=>this.bi(t.ti())-this.bi(e.ti()))),this}bi(t){const e=this.di.indexOf(t);return-1===e?this.di.length:e}};class f{Ai;ki;Ri;Si;Ti;$i;constructor(t){this.Ai={percentViewable:0,percentFps:0,percentIntersection:0,acceptedViewablePercentage:50,acceptedMrcPercentage:50,viewabilityStatus:!1,duration:0,measureTime:2e3},this.Si=0,this.Ri=t,this.$i=null,this.Ti=0,this.ki=!1}Ii(){this.Si&&window.cancelAnimationFrame(this.Si)}Pi(){return"object"==typeof window.performance?window.performance.now():(new Date).getTime()}Ei(){return new Promise(((t,e)=>{this.Ti=this.Pi();const i=()=>{this.Ci()||(this.Ti=this.Pi(),this.xi());const e=this.Pi()-this.Ti,s=e>=this.Ai.measureTime;this.Ai.duration=e,s?(this.Ai.viewabilityStatus=this.Ai.percentViewable>=this.Ai.acceptedViewablePercentage,t(this.Ai)):this.Si=window.requestAnimationFrame(i)};this.Si=window.requestAnimationFrame(i)}))}xi(){this.Ai.percentFps=0,this.Ai.percentIntersection=0,this.Ai.percentViewable=0,this.Ai.duration=0,this.Ai.viewabilityStatus=!1}Ci(){const t=this.Ri.lt().Li();return this.Ai.percentIntersection=t,this.Ai.percentViewable=Math.floor(t),!(t<this.Ai.acceptedViewablePercentage||t<this.Ai.acceptedMrcPercentage)&&this.Ai.percentViewable}}const g={Mi:"MadsStageSelect",Vi:"MadsStagePlayed",Ni:"MadsStageSleep",Di:"MadsStageNextEvent",Fi:"MadsStageFinished",Ui:"MadsProxyPlayOuRVideo",Oi:"MadsProxyInit",Bi:"MadsProxyLoaded",Hi:"MadsProxySetting",ji:"MadsProxyReady",qi:"MadsProxyStart",Wi:"MadsProxyStartAd",zi:"MadsProxyPause",Ki:"MadsProxyResume",Gi:"MadsProxyStop",Ji:"MadsProxyKill",Yi:"MadsProxyDestroyed",Xi:"MadsProxyFake",Qi:"MadsProxyHaveAd",Zi:"MadsProxyMuteAd",ts:"MadsProxyCrash",es:"AdStarted",ss:"AdStopped",rs:"AdSkipped",ns:"AdLoaded",hs:"AdLinearChange",os:"AdSizeChange",ls:"AdExpandedChange",cs:"AdSkippableStateChange",us:"AdDurationChange",ds:"AdRemainingTimeChange",ps:"AdVolumeChange",_s:"AdImpression",fs:"AdClickThru",gs:"AdInteraction",ws:"AdVideoStart",vs:"AdVideoFirstQuartile",ys:"AdVideoMidpoint",bs:"AdVideoThirdQuartile",As:"AdVideoComplete",ks:"AdUserAcceptInvitation",Rs:"AdUserMinimize",Ss:"AdUserClose",Ts:"AdPaused",$s:"AdPlaying",Is:"AdError",Ps:"AdLog",Es:"AllAdsCompleted"};class w{iphoneInline(){throw new Error("Method not implemented.")}Cs;xs;constructor(){this.Cs=navigator.userAgent,this.xs=navigator.platform}Ls(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(this.Cs)}Ms(){return/webOS|iPhone|iPad|iPod/i.test(this.Cs)}Vs(){const t=/iPhone|iPod/i.test(this.Cs),e=/iPhone|iPod/i.test(this.xs);return t&&e}Ns(){return navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&this.Cs&&-1==this.Cs.indexOf("CriOS")&&-1==this.Cs.indexOf("FxiOS")}Ds(){if(!this.Ns())return!0;if(!this.Ms())return!0;const t=this.Cs.match(/Version\/(.*?)\s/);return!!t&&parseInt(t[1])>=10}}const v=new w;class y{Fs=null;Us=!1;Os=!1;Bs=!1;Hs;qs;Ws;zs="";Ks="";oe;Gs;Js=[];Ys={};Xs;Qs;Zs=null;tr="";er;ir=!1;sr=null;rr=null;nr;hr={};ar=new Set([g.ns,g.ss]);lr=!1;ur=1;dr=-1;pr;_r=[];mr=0;gr=new AbortController;Nt=new MessageChannel;constructor(t,i,s,r){this.Ws=t,this.oe=i,this.Hs=new Date,this.qs=e(),this.Gs=this.Ws.vr().wr.toString()+"-"+this.Ws.yr().toString()+"("+this.Ws.br()+")-"+this.oe.toString(),this.hr={},this.Qs=s,this.Xs=new n(s),this.tr=r,this.Zs=new l(r),this.er=void 0,this.Ys={},this.pr=new Date}Ar(t){this.hr[t]=!0}kr(t){return this.hr[t]||!1}Rr(t){return this.ar.has(t)&&this.kr(t)}Sr(){this.zs=r();(async t=>{let e="0123456789abcdef";function i(t){let i,s="";for(i=0;i<=3;i++)s+=e.charAt(t>>8*i+4&15)+e.charAt(t>>8*i&15);return s}function s(t,e){let i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i}function r(t,e,i,r,n,h){return s(function(t,e){return t<<e|t>>>32-e}(s(s(e,t),s(r,h)),n),i)}function n(t,e,i,s,n,h,o){return r(e&i|~e&s,t,e,n,h,o)}function h(t,e,i,s,n,h,o){return r(e&s|i&~s,t,e,n,h,o)}function o(t,e,i,s,n,h,o){return r(e^i^s,t,e,n,h,o)}function a(t,e,i,s,n,h,o){return r(i^(e|~s),t,e,n,h,o)}let l,c,u,d,p,_=function(t){let e,i=1+(t.length+8>>6),s=new Array(16*i);for(e=0;e<16*i;e++)s[e]=0;for(e=0;e<t.length;e++)s[e>>2]|=t.charCodeAt(e)<<e%4*8;return s[e>>2]|=128<<e%4*8,s[16*i-2]=8*t.length,s}(t),m=1732584193,f=-271733879,g=-1732584194,w=271733878;for(l=0;l<_.length;l+=16)c=m,u=f,d=g,p=w,m=n(m,f,g,w,_[l+0],7,-680876936),w=n(w,m,f,g,_[l+1],12,-389564586),g=n(g,w,m,f,_[l+2],17,606105819),f=n(f,g,w,m,_[l+3],22,-1044525330),m=n(m,f,g,w,_[l+4],7,-176418897),w=n(w,m,f,g,_[l+5],12,1200080426),g=n(g,w,m,f,_[l+6],17,-1473231341),f=n(f,g,w,m,_[l+7],22,-45705983),m=n(m,f,g,w,_[l+8],7,1770035416),w=n(w,m,f,g,_[l+9],12,-1958414417),g=n(g,w,m,f,_[l+10],17,-42063),f=n(f,g,w,m,_[l+11],22,-1990404162),m=n(m,f,g,w,_[l+12],7,1804603682),w=n(w,m,f,g,_[l+13],12,-40341101),g=n(g,w,m,f,_[l+14],17,-1502002290),f=n(f,g,w,m,_[l+15],22,1236535329),m=h(m,f,g,w,_[l+1],5,-165796510),w=h(w,m,f,g,_[l+6],9,-1069501632),g=h(g,w,m,f,_[l+11],14,643717713),f=h(f,g,w,m,_[l+0],20,-373897302),m=h(m,f,g,w,_[l+5],5,-701558691),w=h(w,m,f,g,_[l+10],9,38016083),g=h(g,w,m,f,_[l+15],14,-660478335),f=h(f,g,w,m,_[l+4],20,-405537848),m=h(m,f,g,w,_[l+9],5,568446438),w=h(w,m,f,g,_[l+14],9,-1019803690),g=h(g,w,m,f,_[l+3],14,-187363961),f=h(f,g,w,m,_[l+8],20,1163531501),m=h(m,f,g,w,_[l+13],5,-1444681467),w=h(w,m,f,g,_[l+2],9,-51403784),g=h(g,w,m,f,_[l+7],14,1735328473),f=h(f,g,w,m,_[l+12],20,-1926607734),m=o(m,f,g,w,_[l+5],4,-378558),w=o(w,m,f,g,_[l+8],11,-2022574463),g=o(g,w,m,f,_[l+11],16,1839030562),f=o(f,g,w,m,_[l+14],23,-35309556),m=o(m,f,g,w,_[l+1],4,-1530992060),w=o(w,m,f,g,_[l+4],11,1272893353),g=o(g,w,m,f,_[l+7],16,-155497632),f=o(f,g,w,m,_[l+10],23,-1094730640),m=o(m,f,g,w,_[l+13],4,681279174),w=o(w,m,f,g,_[l+0],11,-358537222),g=o(g,w,m,f,_[l+3],16,-722521979),f=o(f,g,w,m,_[l+6],23,76029189),m=o(m,f,g,w,_[l+9],4,-640364487),w=o(w,m,f,g,_[l+12],11,-421815835),g=o(g,w,m,f,_[l+15],16,530742520),f=o(f,g,w,m,_[l+2],23,-995338651),m=a(m,f,g,w,_[l+0],6,-198630844),w=a(w,m,f,g,_[l+7],10,1126891415),g=a(g,w,m,f,_[l+14],15,-1416354905),f=a(f,g,w,m,_[l+5],21,-57434055),m=a(m,f,g,w,_[l+12],6,1700485571),w=a(w,m,f,g,_[l+3],10,-1894986606),g=a(g,w,m,f,_[l+10],15,-1051523),f=a(f,g,w,m,_[l+1],21,-2054922799),m=a(m,f,g,w,_[l+8],6,1873313359),w=a(w,m,f,g,_[l+15],10,-30611744),g=a(g,w,m,f,_[l+6],15,-1560198380),f=a(f,g,w,m,_[l+13],21,1309151649),m=a(m,f,g,w,_[l+4],6,-145523070),w=a(w,m,f,g,_[l+11],10,-1120210379),g=a(g,w,m,f,_[l+2],15,718787259),f=a(f,g,w,m,_[l+9],21,-343485551),m=s(m,c),f=s(f,u),g=s(g,d),w=s(w,p);return i(m)+i(f)+i(g)+i(w)})("mads"+this.zs+this.lt().Tr()+"Sig").then((t=>{this.Ks=t}))}$r(){return{"[adsrc]":this.Ws.br(),"[sig]":this.Ks,"[gguid]":this.zs,"[tti]":this.dr}}Ir(){if(this.Zs&&0!==this.Zs.Ee.length){const t=new m;if(t.fi(this.Pr().Ne()),this.er=t.yi(),this.Er())return this.ur=this.lt().Cr++,this.ir=this.Er().ci(),this.Fs=new f(this),this.Sr(),!0}return!1}Lr(t,e=!0){const i=t;this.Kt("Send event",i),this.Js?.push({time:(new Date).toISOString(),event:i.type,params:i.data}),this.Nt.port1.postMessage(i)}Mr=t=>{const e=t.data;"object"==typeof e&&this.Vr(e.type,e.data)};Nr(){this.Ar(g.Ji),this.kr(g.ts)?this.jt():(this.Dr(g.Yi,(()=>{this.Kt(this.Fr(),"СРАБОТАЛ ТАЙМЕР. Не пришло событие _MadsProxyDestroyed "),this.Vr(g.Yi),this.jt()}),5e3),this.Kt("Надо отправить _MadsProxyKill"),this.Lr({type:g.Ji,data:{}}))}Ur(){this.Ar(g.Gi),this.Dr(g.ss,(()=>{this.Kt(this.Fr(),"СРАБОТАЛ ТАЙМЕР. Не пришло событие AdStop "),this.kr(g.ss)&&(this.hr[g.ss]=null,delete this.hr[g.ss]),this.Vr(g.ss)}),1e3*t.H.J),this.Kt("Надо отправить stop"),this.Lr({type:g.Gi,data:{}})}Or(){this.Ar(g.Ki),this.Lr({type:g.Ki,data:{}})}Br(){this.Rr(g.zi)||(this.Ar(g.zi),this.Lr({type:g.zi,data:{}}))}Hr(){this.kr(g.ns)&&(this.Hs=new Date,this.Ar(g.qi),this.Lr({type:g.qi,data:{}}),this.ir&&this.Dr(g.Di,(()=>{this.Kt(this.Fr(),"СРАБОТАЛ ТАЙМЕР. Не пришло событие"),this.Ur()}),1e3*t.H.Y))}jr(){this.kr(g.Bi)&&this.Lr({type:g.Hi,data:{bv:v.Ns()?this.lt().qr:this.lt().Wr,cr:this.tr}},!1)}zr(){this.Ar(g.Ni),this.Kr(g.Di,"public _eventTimesVPAID _sleep"),this.S().Gr(this),this.S().Jr(),this.Dr(g.Vi,(()=>{this.Kt(this.Fr(),"СРАБОТАЛ ТАЙМЕР. ИЗ SLEEP в УТИЛЬ",this.Qr().Xr().Yr),this.Ar(g.Fi),this.Ur()}),1e3*this.Qr().Xr().Yr)}Zr(){return null!==this.sr&&(this.sr.style.pointerEvents="none",this.sr.style.background="transparent",this.sr.style.opacity="0.0001"),this}tn(){return null!==this.sr&&(this.sr.style.pointerEvents="",this.sr.style.background="black",this.sr.style.opacity="1"),this}Gr(){null!==this.sr&&(this.sr.style.zIndex=this.ur.toString(),this.Zr())}en(){null!==this.sr&&(this.sr.style.zIndex="1000",this.tn(),this.pr=new Date,this.Dr(g.Vi,(()=>{this.Kr(g.Vi,"СРАБОТАЛ ТАЙМЕР"),1===this.lt().sn()?(this.Kt(this.Fr(),"СРАБОТАЛ ТАЙМЕР. ОТПРАВЛЕНО В УТИЛЬ maxStagesWork = 1"),this.Ar(g.Fi),this.Ur()):(this.Kt(this.Fr(),"СРАБОТАЛ ТАЙМЕР. ОТПРАВЛЕНО В SLEEP",this.Qr().Xr().rn),this.zr())}),1e3*this.Qr().Xr().rn))}Vr(t,e){this.Rr(t)||(this.nn(t,e),this.S().hn(t,this))}nn(t,e){this.pr=new Date,this.Kr(t,"public async _event: "+t),t.includes("timeupdate")||this.Kt("Listener",t,e),this.Js?.push({time:(new Date).toISOString(),event:t,params:e}),this.Ar(t),this.ir&&this.an(t,e),this.ln(t,e)}ln(e,i){switch(e){case g.ns:break;case g.ss:this.Os=!1,this.kr(t.ht.ft.yt)&&this.lt().cn().cn("proxy_crash",this.Qr().br(),JSON.stringify(this.Js)),this.kr(g.qi)||this.Ar(g.qi);break;case g.Yi:this.Ar(g.Fi),this.jt();break;case g.Is:this.Os=!1,this.kr(g.qi)||this.Ar(g.qi);break;case g.es:this.kr(g.qi)||(this.Ar(g.qi),this.Kt("ЗАПУСК БЕЗ СТАРТА "+this.S().un(this)),this.S().un(this));break;case g._s:this.lt().ie().Ot("movieads_onstage"),this.kr(g.qi)||(this.Kt("ЗАПУСК БЕЗ СТАРТА "+this.S().un(this)),this.S().un(this)),this.Kr(g.ss,"эвент: "+g._s),this.nn(g.Vi),this.Os=!0,this.Kt("CREATIVE",this.Pr(),this.tr,this.Qs),this.lt().cn().dn(this,e),this.Qr().pn(this),1===this.Qr()._n()?this.dr=((new Date).getTime()-this.Hs.getTime())/1e3:this.dr=-1;const s={visibility:this.lt().Li(),imp_uuid:this.zs,rect:this.sr?.getBoundingClientRect(),vastUrl:this.Qr().te("tag"),subs:this.lt().mn(),tti:this.dr,ttiImp:this.Qr()._n()};this.lt().cn().cn("stage","ad_impression",JSON.stringify(s));break;case g.fs:this.lt().ie().Ot("movieads_adclick"),this.lt().cn().dn(this,e);break;case g.ws:case g.vs:case g.ys:case g.bs:this.lt().ie().Ot("movieads_onstage"),this.Kr(g.ss,"эвент: "+e),this.kr(g.qi)||(this.Ar(g.qi),this.Kt("ЗАПУСК БЕЗ СТАРТА "+this.S().un(this)),this.S().un(this)),this.lt().cn().dn(this,e),this.nn(g.Vi),this.Os=!0;break;case g.As:this.lt().cn().dn(this,e);break;case g.Xi:this.S().Gr(this);break;case g.Ui:this.lr=!0;break;case t.ht.ft.gt:this.Lr({type:e,data:i});break;case g.Vi:this.kr(g.ns)||(this.Ar(g.ns),this.Kr(g.ns,"эвент: "+e)),this.S().en(this);break;case g.ji:this.Dr(g.ns,(()=>{this.Ur(),this.Kt("СРАБОТАЛ ТАЙМЕР! Select to AdLoaded",this.Qr().Xr().fn)}),1e3*this.Qr().Xr().fn);break;case g.ts:this.Ar(g.Fi),this.S().Gr(this),this.Nr();break;case g.Bi:this.jr();break;case g.Mi:if(this.sr=document.createElement("div"),this.sr.classList.add("slot"),this.sr.dataset.name=this.Qr().br(),this.sr.dataset.partner=this.Qr().yr(),this.sr.style.zIndex=this.ur.toString(),this.Kt("Need",this.lt().te("showLog")),this.lt().te("showLog")){const t=document.createElement("div");t.innerText=this.Fr(),t.setAttribute("style","font-size: 13px;position: absolute;width: 100;height: 14px;background-color: #2B2B31;top: 2px;right: 2px;color: wheat;font-family: sans-serif;font-variant: small-caps;z-index: 99;"),this.sr.appendChild(t)}this.S().lt().ie().Dt().appendChild(this.sr),this.Zr(),this.Hs=new Date,this.gn()&&(this.Hs=new Date,this.wn(),this.Dr(g.ji,(()=>{this.Kt(this.Fr(),"СРАБОТАЛ ТАЙМЕР. Select to Ready",this.Qr().Xr().vn),this.Ur()}),1e3*this.Qr().Xr().vn))}}an(e,i){switch(e){case g.ns:break;case g.Qi:this.Bs=!0,this.Kr(g.Vi,"public _eventTimesVPAID _MadsProxyHaveAd"),this.Dr(g.Di,(()=>{this.Kt(this.Fr(),"СРАБОТАЛ ТАЙМЕР. Не пришло событие ",g.Qi),this.Ur()}),1e3*t.H.Y);break;case g.Ts:this.Kr(g.Di,"public _eventTimesVPAID _AdPaused"),this.S().un(this)&&this.Or();break;case g.es:break;case g._s:case g.ws:case g.vs:case g.ys:case g.bs:this.Kr(g.Vi,"public _eventTimesVPAID ".concat(e));case g.As:this.Kr(g.Di,"public _eventTimesVPAID ".concat(e)),this.Dr(g.Di,(()=>{this.Kt(this.Fr(),"СРАБОТАЛ ТАЙМЕР. Не пришло событие"),this.Ur()}),1e3*t.H.Y);break;case g._s:this.kr(g._s)||(this.Kt(this.Fr(),"NOT IMPRESSION"),this.lt().cn().cn("complete_not_imp",this.kr(g.Vi)?"true":"false",this.Qr().br()))}}Dr(t,e,i){return this.Ys[t]||(this.Ys[t]=window.setTimeout(e,i)),this}Kr(t,e){return this.Ys[t]&&(this.Kt("Убираю таймаут: ",t,e),window.clearTimeout(this.Ys[t]),delete this.Ys[t]),this}yn(){for(const t in this.Ys)this.Kt("Убираю таймаут скопом: ",t),window.clearTimeout(this.Ys[t]),delete this.Ys[t];this.Ys={}}Kt(...t){if(this.lt().te("debug")||this.lt().te("showLog")){const e=Array.prototype.slice.call(t),i=["%cSTAGE ["+this.Gs+"]","background-color: #1fea00; color: black;font-weight: bold;padding:1px 3px;border-radius: 3px;margin-right: 7px;"].concat(e);console.log.apply(console,i)}}ci(){return this.ir}bn(){return this.Us}Fr(){return this.Gs}lt(){return this.Ws.vr().lt()}S(){return this.Ws.vr()}Qr(){return this.Ws}An(){return this.Xs}Pr(){return this.Zs}Er(){return this.er}kn(){return this.qs}Rn(){return this.pr}jt(){this.yn(),this.gr.abort(),this.Nt.port1.close(),this.Nt.port1.onmessage=null,this.Sn().then((()=>{null!==this.Fs&&(this.Fs.Ii(),this.Fs=null),null!==this.sr&&(this.sr.remove(),this.sr=null),this.Kt("Заканчиваем"),(this.lt().te("debug")||this.lt().te("showLog"))&&console.table(this.Js),this.tr=null,this.Zs=null,this.er=null,this.Js=null}))}Tn(){return new Promise((t=>{if(null!==this.rr){const e=this.rr.deref();if(e)if(this.Kt("destroy frame start"),this.kr(g.ts))t(!0);else if(this.Qr().$n())if(this.Qr().In())this.Pn()?(e.srcdoc="<html><body></body></html>",t(!0)):this.nr&&(URL.revokeObjectURL(this.nr),this.nr=null,t(!0));else{const i=e.contentWindow||e.contentDocument.document||e.contentDocument;e.addEventListener("load",(()=>{t(!0)}),{once:!0}),this.Pn()?e.srcdoc='`<!doctype html><html lang="en"><body></body></html>':null!==i?(i.document.open(),i.document.write('`<!doctype html><html lang="en"><body></body></html>'),i.document.close()):t(!0)}else e.src="about:blank",e.src=e.src,e.addEventListener("load",(()=>{t(!0)}),{once:!0})}else t(!0)}))}Sn(){return new Promise((t=>{this.Tn().then((()=>{if(this.Kt("destroy frame kill"),null!==this.rr){const t=this.rr.deref();t.dispatchEvent(new Event("build_"+this.Gs)),t.remove(),this.Kt(" destroy frames empty")}this.rr=null,t(!0)}))}))}wn(){this.En().then((()=>{if(this.Kt("frames Proxy created"),this.Nt.port1.onmessage=this.Mr,null!==this.rr){const t=this.rr.deref(),e={type:g.Oi,data:{c:this.Fr(),d:this.lt().te("debug")||this.lt().te("showLog"),fre:this.Qr().$n(),p_pr:this.Qr().Cn(),fv:this.Qr().xn(),v:this.lt().Ln()}},i=t.contentWindow||t.contentDocument.document||t.contentDocument;if(this.Qr().$n()){if(null!==i){const t=this.lt().Ln()>0?"":'<script type="text/javascript" src="data:text/javascript;base64,'+this.lt().Mn()+'"><\/script>';i.document.open(),i.document.write(this.lt().Vn().replace("__VM__",t)),i.document.close(),window.setTimeout((()=>{i.postMessage(e,"*",[this.Nt.port2])}),200)}}else window.setTimeout((()=>{i.postMessage(e,"*",[this.Nt.port2])}),200)}this.Kt("frames created")}))}En(){return new Promise((t=>{const i=document.createElement("iframe");if(i.id=e(),i.setAttribute("allowtransparency","true"),i.setAttribute("allowfullscreen","true"),i.setAttribute("referrerpolicy","unsafe-url"),i.setAttribute("scrolling","no"),i.setAttribute("allow","encrypted-media *; autoplay *; fullscreen *; "),i.setAttribute("marginheight","0px"),i.setAttribute("marginwidth","0px"),i.setAttribute("frameborder","0"),i.setAttribute("webkitallowfullscreen","true"),i.setAttribute("allowfullscreen","true"),i.setAttribute("mozallowfullscreen","true"),this.lt().te("relFrame"),this.Nn(document),i.width="100%",i.height="100vh",i.style.border="none",i.style.minHeight="100%",i.style.minWidth="100%",this.Kt("isIframeWrite proxy useSrcDoc",this.Qr().In(),"Fren",this.Qr().$n()),this.Qr().$n())if(this.Qr().In())if(this.Pn())i.srcdoc=this.lt().Vn();else{const t=new Blob([this.lt().Vn()],{type:"text/html"});this.nr=URL.createObjectURL(t),i.src=this.nr}else i.src="about:blank";else this.lt().Ln()>0?i.src=this.Qr().Dn()+"/td/tvp.html?v"+this.lt().ee:i.src=this.Qr().Dn()+"/td/tvps.html?v"+this.lt().ee;i.addEventListener("load",(()=>{t(i)}),{once:!0}),this.rr=new WeakRef(i),this.sr?.appendChild(i)}))}Nn(t){return t.featurePolicy?.features().includes("attribution-reporting")}Pn(){return"srcdoc"in HTMLIFrameElement.prototype}gn(){if(this.Qr().O()>0&&this.Qr()._n()>=this.Qr().O())return this.Kt("max_imps_reached"),this.Vr(g.Yi),!1;const t=this.Qr().te("fsz");if(void 0!==t){const e=this.sr?.getBoundingClientRect();if(void 0!==e&&(e.width<t.x||e.height<t.y))return this.lt().cn().cn("stage","small_player_skip",""),this.Kt("SMALL PLAYER SKIP"),this.Vr(g.Yi),!1}const e=this.Qr().te("run_state");if(!this.lt().Fn()&&"visible"!==document.visibilityState||"visible"===e&&e!==document.visibilityState){const t={tag:this.Qr().te("tag"),mvt:this.Qr().te("mvt"),id:this.Qr().te("id"),cvt:this.lt().Li(),rst:e,vst:document.visibilityState,pvt:this.lt().Fn(),instant:this.lt().te("instant")};return this.lt().cn().cn("stage","invisible_player_skip",JSON.stringify(t)),this.Kt("INVISIBLE PLAYER SKIP"),this.Vr(g.Yi),!1}return!0}}function b(t={}){return{id:t.id||null,adId:t.adId||null,sequence:t.sequence||null,apiFramework:t.apiFramework||null,universalAdIds:[],creativeExtensions:[]}}const A=["ADCATEGORIES","ADCOUNT","ADPLAYHEAD","ADSERVINGID","ADTYPE","APIFRAMEWORKS","APPBUNDLE","ASSETURI","BLOCKEDADCATEGORIES","BREAKMAXADLENGTH","BREAKMAXADS","BREAKMAXDURATION","BREAKMINADLENGTH","BREAKMINDURATION","BREAKPOSITION","CLICKPOS","CLICKTYPE","CLIENTUA","CONTENTID","CONTENTPLAYHEAD","CONTENTURI","DEVICEIP","DEVICEUA","DOMAIN","EXTENSIONS","GDPRCONSENT","IFA","IFATYPE","INVENTORYSTATE","LATLONG","LIMITADTRACKING","MEDIAMIME","MEDIAPLAYHEAD","OMIDPARTNER","PAGEURL","PLACEMENTTYPE","PLAYERCAPABILITIES","PLAYERSIZE","PLAYERSTATE","PODSEQUENCE","REGULATIONS","SERVERSIDE","SERVERUA","TRANSACTIONID","UNIVERSALADID","VASTVERSIONS","VERIFICATIONVENDORS"];function k(t,e={},i={}){const s=[],r=T(t);!e.ERRORCODE||i.isCustomCode||/^[0-9]{3}$/.test(e.ERRORCODE)||(e.ERRORCODE=900),e.CACHEBUSTING=E(Math.round(1e8*Math.random())),e.TIMESTAMP=(new Date).toISOString(),e.RANDOM=e.random=e.CACHEBUSTING;for(const t in e)e[t]=P(e[t]);for(const t in r){const i=r[t];"string"==typeof i&&s.push(R(i,e))}return s}function R(t,e){const i=(t=S(t,e)).match(/[^[\]]+(?=])/g);if(!i)return t;let s=i.filter((t=>A.indexOf(t)>-1));return 0===s.length?t:(s=s.reduce(((t,e)=>(t[e]=-1,t)),{}),S(t,s))}function S(t,e){let i=t;for(const t in e){const s=e[t];i=i.replace(new RegExp(`(?:\\[|%%)(${t})(?:\\]|%%)`,"g"),s)}return i}function T(t){return Array.isArray(t)?t.map((t=>t&&t.hasOwnProperty("url")?t.url:t)):t}function $(t,e){for(let i=0;i<e.length;i++)if(I(e[i],t))return!0;return!1}function I(t,e){if(t&&e){const i=Object.getOwnPropertyNames(t),s=Object.getOwnPropertyNames(e);return i.length===s.length&&(t.id===e.id&&t.url===e.url)}return!1}function P(t){return encodeURIComponent(t).replace(/[!'()*]/g,(t=>`%${t.charCodeAt(0).toString(16)}`))}function E(t,e=8){return t.toString().padStart(e,"0")}const C={track:function(t,e,i){k(t,e,i).forEach((t=>{if("undefined"!=typeof window&&null!==window){(new Image).src=t}}))},resolveURLTemplates:k,extractURLsFromTemplates:T,containsTemplateObject:$,isTemplateObjectEqual:I,encodeURIComponentRFC3986:P,replaceUrlMacros:R,isNumeric:function(t){return!isNaN(parseFloat(t))&&isFinite(t)},flatten:function t(e){return e.reduce(((e,i)=>e.concat(Array.isArray(i)?t(i):i)),[])},joinArrayOfUniqueTemplateObjs:function(t=[],e=[]){const i=Array.isArray(t)?t:[],s=Array.isArray(e)?e:[];return i.concat(s).reduce(((t,e)=>($(e,t)||t.push(e),t)),[])},isValidTimeValue:function(t){return Number.isFinite(t)&&t>=-2},addLeadingZeros:E};function x(t){return-1!==["true","TRUE","True","1"].indexOf(t)}const L={childByName:function(t,e){const i=t.childNodes;for(const t in i){const s=i[t];if(s.nodeName===e)return s}},childrenByName:function(t,e){const i=[],s=t.childNodes;for(const t in s){const r=s[t];r.nodeName===e&&i.push(r)}return i},resolveVastAdTagURI:function(t,e){if(!e)return t;if(0===t.indexOf("//")){const{protocol:e}=location;return`${e}${t}`}if(-1===t.indexOf("://")){return`${e.slice(0,e.lastIndexOf("/"))}/${t}`}return t},parseBoolean:x,parseNodeText:function(t){return t&&(t.textContent||t.text||"").trim()},copyNodeAttribute:function(t,e,i){const s=e.getAttribute(t);s&&i.setAttribute(t,s)},parseAttributes:function(t){const e=t.attributes,i={};for(let t=0;t<e.length;t++)i[e[t].nodeName]=e[t].nodeValue;return i},parseDuration:function(t){if(null==t)return-1;if(C.isNumeric(t))return parseInt(t);const e=t.split(":");if(3!==e.length)return-1;const i=e[2].split(".");let s=parseInt(i[0]);2===i.length&&(s+=parseFloat(`0.${i[1]}`));const r=parseInt(60*e[1]),n=parseInt(60*e[0]*60);return isNaN(n)||isNaN(r)||isNaN(s)||r>3600||s>60?-1:n+r+s},splitVAST:function(t){const e=[];let i=null;return t.forEach(((s,r)=>{if(s.sequence&&(s.sequence=parseInt(s.sequence,10)),s.sequence>1){const e=t[r-1];if(e&&e.sequence===s.sequence-1)return void(i&&i.push(s));delete s.sequence}i=[s],e.push(i)})),e},assignAttributes:function(t,e){if(t)for(const i in t){const s=t[i];if(s.nodeName&&s.nodeValue&&e.hasOwnProperty(s.nodeName)){let t=s.nodeValue;"boolean"==typeof e[s.nodeName]&&(t=x(t)),e[s.nodeName]=t}}},mergeWrapperAdData:function(t,e){t.errorURLTemplates=e.errorURLTemplates.concat(t.errorURLTemplates),t.impressionURLTemplates=e.impressionURLTemplates.concat(t.impressionURLTemplates),t.extensions=e.extensions.concat(t.extensions),e.viewableImpression.length>0&&(t.viewableImpression=[...t.viewableImpression,...e.viewableImpression]),t.followAdditionalWrappers=e.followAdditionalWrappers,t.allowMultipleAds=e.allowMultipleAds,t.fallbackOnNoAd=e.fallbackOnNoAd;const i=(e.creatives||[]).filter((t=>t&&"companion"===t.type)),s=i.reduce(((t,e)=>((e.variations||[]).forEach((e=>{(e.companionClickTrackingURLTemplates||[]).forEach((e=>{C.containsTemplateObject(e,t)||t.push(e)}))})),t)),[]);t.creatives=i.concat(t.creatives);const r=e.videoClickTrackingURLTemplates&&e.videoClickTrackingURLTemplates.length,n=e.videoCustomClickURLTemplates&&e.videoCustomClickURLTemplates.length;t.creatives.forEach((t=>{if(e.trackingEvents&&e.trackingEvents[t.type])for(const i in e.trackingEvents[t.type]){const s=e.trackingEvents[t.type][i];Array.isArray(t.trackingEvents[i])||(t.trackingEvents[i]=[]),t.trackingEvents[i]=t.trackingEvents[i].concat(s)}"linear"===t.type&&(r&&(t.videoClickTrackingURLTemplates=t.videoClickTrackingURLTemplates.concat(e.videoClickTrackingURLTemplates)),n&&(t.videoCustomClickURLTemplates=t.videoCustomClickURLTemplates.concat(e.videoCustomClickURLTemplates)),!e.videoClickThroughURLTemplate||null!==t.videoClickThroughURLTemplate&&void 0!==t.videoClickThroughURLTemplate||(t.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate)),"companion"===t.type&&s.length&&(t.variations||[]).forEach((t=>{t.companionClickTrackingURLTemplates=C.joinArrayOfUniqueTemplateObjs(t.companionClickTrackingURLTemplates,s)}))})),e.adVerifications&&(t.adVerifications=t.adVerifications.concat(e.adVerifications)),e.blockedAdCategories&&(t.blockedAdCategories=t.blockedAdCategories.concat(e.blockedAdCategories))}};function M(t,e){const i=function(t={}){const{id:e,adId:i,sequence:s,apiFramework:r}=b(t);return{id:e,adId:i,sequence:s,apiFramework:r,type:"companion",required:null,variations:[]}}(e);return i.required=t.getAttribute("required")||null,i.variations=L.childrenByName(t,"Companion").map((t=>{const e=function(t={}){return{id:t.id||null,adType:"companionAd",width:t.width||0,height:t.height||0,assetWidth:t.assetWidth||null,assetHeight:t.assetHeight||null,expandedWidth:t.expandedWidth||null,expandedHeight:t.expandedHeight||null,apiFramework:t.apiFramework||null,adSlotID:t.adSlotID||null,pxratio:t.pxratio||"1",renderingMode:t.renderingMode||"default",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,xmlEncoded:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}}(L.parseAttributes(t));e.htmlResources=L.childrenByName(t,"HTMLResource").reduce(((t,e)=>{const i=L.parseNodeText(e);return i?t.concat(i):t}),[]),e.iframeResources=L.childrenByName(t,"IFrameResource").reduce(((t,e)=>{const i=L.parseNodeText(e);return i?t.concat(i):t}),[]),e.staticResources=L.childrenByName(t,"StaticResource").reduce(((t,e)=>{const i=L.parseNodeText(e);return i?t.concat({url:i,creativeType:e.getAttribute("creativeType")||null}):t}),[]),e.altText=L.parseNodeText(L.childByName(t,"AltText"))||null;const i=L.childByName(t,"TrackingEvents");i&&L.childrenByName(i,"Tracking").forEach((t=>{const i=t.getAttribute("event"),s=L.parseNodeText(t);i&&s&&(Array.isArray(e.trackingEvents[i])||(e.trackingEvents[i]=[]),e.trackingEvents[i].push(s))})),e.companionClickTrackingURLTemplates=L.childrenByName(t,"CompanionClickTracking").map((t=>({id:t.getAttribute("id")||null,url:L.parseNodeText(t)}))),e.companionClickThroughURLTemplate=L.parseNodeText(L.childByName(t,"CompanionClickThrough"))||null;const s=L.childByName(t,"AdParameters");return s&&(e.adParameters=L.parseNodeText(s),e.xmlEncoded=s.getAttribute("xmlEncoded")||null),e})),i}function V(t,e){let i;const s=function(t={}){const{id:e,adId:i,sequence:s,apiFramework:r}=b(t);return{id:e,adId:i,sequence:s,apiFramework:r,type:"linear",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}}(e);s.duration=L.parseDuration(L.parseNodeText(L.childByName(t,"Duration")));const r=t.getAttribute("skipoffset");if(null==r)s.skipDelay=null;else if("%"===r.charAt(r.length-1)&&-1!==s.duration){const t=parseInt(r,10);s.skipDelay=s.duration*(t/100)}else s.skipDelay=L.parseDuration(r);const n=L.childByName(t,"VideoClicks");if(n){const t=L.childByName(n,"ClickThrough");s.videoClickThroughURLTemplate=t?{id:t.getAttribute("id")||null,url:L.parseNodeText(t)}:null,L.childrenByName(n,"ClickTracking").forEach((t=>{s.videoClickTrackingURLTemplates.push({id:t.getAttribute("id")||null,url:L.parseNodeText(t)})})),L.childrenByName(n,"CustomClick").forEach((t=>{s.videoCustomClickURLTemplates.push({id:t.getAttribute("id")||null,url:L.parseNodeText(t)})}))}const h=L.childByName(t,"AdParameters");h&&(s.adParameters=L.parseNodeText(h)),L.childrenByName(t,"TrackingEvents").forEach((t=>{L.childrenByName(t,"Tracking").forEach((t=>{let e=t.getAttribute("event");const r=L.parseNodeText(t);if(e&&r){if("progress"===e){if(i=t.getAttribute("offset"),!i)return;e="%"===i.charAt(i.length-1)?`progress-${i}`:`progress-${Math.round(L.parseDuration(i))}`}Array.isArray(s.trackingEvents[e])||(s.trackingEvents[e]=[]),s.trackingEvents[e].push(r)}}))})),L.childrenByName(t,"MediaFiles").forEach((t=>{L.childrenByName(t,"MediaFile").forEach((t=>{s.mediaFiles.push(function(t){const e={id:null,fileURL:null,fileSize:0,deliveryType:"progressive",mimeType:null,mediaType:null,codec:null,bitrate:0,minBitrate:0,maxBitrate:0,width:0,height:0,apiFramework:null,scalable:null,maintainAspectRatio:null};e.id=t.getAttribute("id"),e.fileURL=L.parseNodeText(t),e.deliveryType=t.getAttribute("delivery"),e.codec=t.getAttribute("codec"),e.mimeType=t.getAttribute("type"),e.mediaType=t.getAttribute("mediaType")||"2D",e.apiFramework=t.getAttribute("apiFramework"),e.fileSize=parseInt(t.getAttribute("fileSize")||0),e.bitrate=parseInt(t.getAttribute("bitrate")||0),e.minBitrate=parseInt(t.getAttribute("minBitrate")||0),e.maxBitrate=parseInt(t.getAttribute("maxBitrate")||0),e.width=parseInt(t.getAttribute("width")||0),e.height=parseInt(t.getAttribute("height")||0);const i=t.getAttribute("scalable");i&&"string"==typeof i&&(e.scalable=L.parseBoolean(i));const s=t.getAttribute("maintainAspectRatio");s&&"string"==typeof s&&(e.maintainAspectRatio=L.parseBoolean(s));return e}(t))}));const e=L.childByName(t,"InteractiveCreativeFile");e&&(s.interactiveCreativeFile=function(t){const e=function(t={}){return{type:t.type||null,apiFramework:t.apiFramework||null,variableDuration:L.parseBoolean(t.variableDuration),fileURL:null}}(L.parseAttributes(t));return e.fileURL=L.parseNodeText(t),e}(e));const i=L.childByName(t,"ClosedCaptionFiles");i&&L.childrenByName(i,"ClosedCaptionFile").forEach((t=>{const e=function(t={}){return{type:t.type||null,language:t.language||null,fileURL:null}}(L.parseAttributes(t));e.fileURL=L.parseNodeText(t),s.closedCaptionFiles.push(e)}));const r=L.childByName(t,"Mezzanine"),n=function(t,e){const i={};let s=!1;return e.forEach((e=>{t&&t.getAttribute(e)?i[e]=t.getAttribute(e):s=!0})),s?null:i}(r,["delivery","type","width","height"]);if(n){const t={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};t.id=r.getAttribute("id"),t.fileURL=L.parseNodeText(r),t.delivery=n.delivery,t.codec=r.getAttribute("codec"),t.type=n.type,t.width=parseInt(n.width,10),t.height=parseInt(n.height,10),t.fileSize=parseInt(r.getAttribute("fileSize"),10),t.mediaType=r.getAttribute("mediaType")||"2D",s.mezzanine=t}}));const o=L.childByName(t,"Icons");return o&&L.childrenByName(o,"Icon").forEach((t=>{s.icons.push(function(t){const e={program:null,height:0,width:0,xPosition:0,yPosition:0,apiFramework:null,offset:null,duration:0,type:null,staticResource:null,htmlResource:null,iframeResource:null,pxratio:"1",iconClickThroughURLTemplate:null,iconClickTrackingURLTemplates:[],iconViewTrackingURLTemplate:null};e.program=t.getAttribute("program"),e.height=parseInt(t.getAttribute("height")||0),e.width=parseInt(t.getAttribute("width")||0),e.xPosition=function(t){if(-1!==["left","right"].indexOf(t))return t;return parseInt(t||0)}(t.getAttribute("xPosition")),e.yPosition=function(t){if(-1!==["top","bottom"].indexOf(t))return t;return parseInt(t||0)}(t.getAttribute("yPosition")),e.apiFramework=t.getAttribute("apiFramework"),e.pxratio=t.getAttribute("pxratio")||"1",e.offset=L.parseDuration(t.getAttribute("offset")),e.duration=L.parseDuration(t.getAttribute("duration")),L.childrenByName(t,"HTMLResource").forEach((t=>{e.type=t.getAttribute("creativeType")||"text/html",e.htmlResource=L.parseNodeText(t)})),L.childrenByName(t,"IFrameResource").forEach((t=>{e.type=t.getAttribute("creativeType")||0,e.iframeResource=L.parseNodeText(t)})),L.childrenByName(t,"StaticResource").forEach((t=>{e.type=t.getAttribute("creativeType")||0,e.staticResource=L.parseNodeText(t)}));const i=L.childByName(t,"IconClicks");i&&(e.iconClickThroughURLTemplate=L.parseNodeText(L.childByName(i,"IconClickThrough")),L.childrenByName(i,"IconClickTracking").forEach((t=>{e.iconClickTrackingURLTemplates.push({id:t.getAttribute("id")||null,url:L.parseNodeText(t)})})));return e.iconViewTrackingURLTemplate=L.parseNodeText(L.childByName(t,"IconViewTracking")),e}(t))})),s}function N(t,e){const i=function(t={}){const{id:e,adId:i,sequence:s,apiFramework:r}=b(t);return{id:e,adId:i,sequence:s,apiFramework:r,type:"nonlinear",variations:[],trackingEvents:{}}}(e);return L.childrenByName(t,"TrackingEvents").forEach((t=>{let e,s;L.childrenByName(t,"Tracking").forEach((t=>{e=t.getAttribute("event"),s=L.parseNodeText(t),e&&s&&(Array.isArray(i.trackingEvents[e])||(i.trackingEvents[e]=[]),i.trackingEvents[e].push(s))}))})),L.childrenByName(t,"NonLinear").forEach((t=>{const e={id:null,width:0,height:0,expandedWidth:0,expandedHeight:0,scalable:!0,maintainAspectRatio:!0,minSuggestedDuration:0,apiFramework:"static",adType:"nonLinearAd",type:null,staticResource:null,htmlResource:null,iframeResource:null,nonlinearClickThroughURLTemplate:null,nonlinearClickTrackingURLTemplates:[],adParameters:null};e.id=t.getAttribute("id")||null,e.width=t.getAttribute("width"),e.height=t.getAttribute("height"),e.expandedWidth=t.getAttribute("expandedWidth"),e.expandedHeight=t.getAttribute("expandedHeight"),e.scalable=L.parseBoolean(t.getAttribute("scalable")),e.maintainAspectRatio=L.parseBoolean(t.getAttribute("maintainAspectRatio")),e.minSuggestedDuration=L.parseDuration(t.getAttribute("minSuggestedDuration")),e.apiFramework=t.getAttribute("apiFramework"),L.childrenByName(t,"HTMLResource").forEach((t=>{e.type=t.getAttribute("creativeType")||"text/html",e.htmlResource=L.parseNodeText(t)})),L.childrenByName(t,"IFrameResource").forEach((t=>{e.type=t.getAttribute("creativeType")||0,e.iframeResource=L.parseNodeText(t)})),L.childrenByName(t,"StaticResource").forEach((t=>{e.type=t.getAttribute("creativeType")||0,e.staticResource=L.parseNodeText(t)}));const s=L.childByName(t,"AdParameters");s&&(e.adParameters=L.parseNodeText(s)),e.nonlinearClickThroughURLTemplate=L.parseNodeText(L.childByName(t,"NonLinearClickThrough")),L.childrenByName(t,"NonLinearClickTracking").forEach((t=>{e.nonlinearClickTrackingURLTemplates.push({id:t.getAttribute("id")||null,url:L.parseNodeText(t)})})),i.variations.push(e)})),i}function D(t){const e=[];return t.forEach((t=>{const i=F(t);i&&e.push(i)})),e}function F(t){if("#comment"===t.nodeName)return null;const e={name:null,value:null,attributes:{},children:[]},i=t.attributes,s=t.childNodes;if(e.name=t.nodeName,t.attributes)for(const t in i)if(i.hasOwnProperty(t)){const s=i[t];s.nodeName&&s.nodeValue&&(e.attributes[s.nodeName]=s.nodeValue)}for(const t in s)if(s.hasOwnProperty(t)){const i=F(s[t]);i&&e.children.push(i)}if(0===e.children.length||1===e.children.length&&["#cdata-section","#text"].indexOf(e.children[0].name)>=0){const i=L.parseNodeText(t);""!==i&&(e.value=i),e.children=[]}return null===(r=e).value&&0===Object.keys(r.attributes).length&&0===r.children.length?null:e;var r}function U(t){const e=[];return t.forEach((t=>{const i={id:t.getAttribute("id")||null,adId:O(t),sequence:t.getAttribute("sequence")||null,apiFramework:t.getAttribute("apiFramework")||null},s=[];let r;L.childrenByName(t,"UniversalAdId").forEach((t=>{const e={idRegistry:t.getAttribute("idRegistry")||"unknown",value:L.parseNodeText(t)};s.push(e)}));const n=L.childByName(t,"CreativeExtensions");n&&(r=D(L.childrenByName(n,"CreativeExtension")));for(const n in t.childNodes){const h=t.childNodes[n];let o;switch(h.nodeName){case"Linear":o=V(h,i);break;case"NonLinearAds":o=N(h,i);break;case"CompanionAds":o=M(h,i)}o&&(s&&(o.universalAdIds=s),r&&(o.creativeExtensions=r),e.push(o))}})),e}function O(t){return t.getAttribute("AdID")||t.getAttribute("adID")||t.getAttribute("adId")||null}const B={Wrapper:{subElements:["VASTAdTagURI","Impression"]},BlockedAdCategories:{attributes:["authority"]},InLine:{subElements:["AdSystem","AdTitle","Impression","AdServingId","Creatives"]},Category:{attributes:["authority"]},Pricing:{attributes:["model","currency"]},Verification:{oneOfinLineResources:["JavaScriptResource","ExecutableResource"],attributes:["vendor"]},UniversalAdId:{attributes:["idRegistry"]},JavaScriptResource:{attributes:["apiFramework","browserOptional"]},ExecutableResource:{attributes:["apiFramework","type"]},Tracking:{attributes:["event"]},Creatives:{subElements:["Creative"]},Creative:{subElements:["UniversalAdId"]},Linear:{subElements:["MediaFiles","Duration"]},MediaFiles:{subElements:["MediaFile"]},MediaFile:{attributes:["delivery","type","width","height"]},Mezzanine:{attributes:["delivery","type","width","height"]},NonLinear:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},Companion:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},StaticResource:{attributes:["creativeType"]},Icons:{subElements:["Icon"]},Icon:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"]}};function H(t,e){if(!B[t.nodeName]||!B[t.nodeName].attributes)return;const i=B[t.nodeName].attributes.filter((e=>!t.getAttribute(e)));i.length>0&&W({name:t.nodeName,parentName:t.parentNode.nodeName,attributes:i},e)}function j(t,e,i){const s=B[t.nodeName],r=!i&&"Wrapper"!==t.nodeName;if(!s||r)return;if(s.subElements){const i=s.subElements.filter((e=>!L.childByName(t,e)));i.length>0&&W({name:t.nodeName,parentName:t.parentNode.nodeName,subElements:i},e)}if(!i||!s.oneOfinLineResources)return;s.oneOfinLineResources.some((e=>L.childByName(t,e)))||W({name:t.nodeName,parentName:t.parentNode.nodeName,oneOfResources:s.oneOfinLineResources},e)}function q(t){return t.children&&0!==t.children.length}function W({name:t,parentName:e,attributes:i,subElements:s,oneOfResources:r},n){let h=`Element '${t}'`;h+=i?` missing required attribute(s) '${i.join(", ")}' `:s?` missing required sub element(s) '${s.join(", ")}' `:r?` must provide one of the following '${r.join(", ")}' `:" is empty",n("VAST-warning",{message:h,parentElement:e,specVersion:4.1})}const z={verifyRequiredValues:function t(e,i,s){if(e&&e.nodeName)if("InLine"===e.nodeName&&(s=!0),H(e,i),q(e)){j(e,i,s);for(let r=0;r<e.children.length;r++)t(e.children[r],i,s)}else 0===L.parseNodeText(e).length&&W({name:e.nodeName,parentName:e.parentNode.nodeName},i)},hasSubElements:q,emitMissingValueWarning:W,verifyRequiredAttributes:H,verifyRequiredSubElements:j};function K(t,e,{allowMultipleAds:i,followAdditionalWrappers:s}={}){const r=t.childNodes;for(const n in r){const h=r[n];if(-1!==["Wrapper","InLine"].indexOf(h.nodeName)&&("Wrapper"!==h.nodeName||!1!==s)){if(L.copyNodeAttribute("id",t,h),L.copyNodeAttribute("sequence",t,h),L.copyNodeAttribute("adType",t,h),"Wrapper"===h.nodeName)return{ad:Y(h,e),type:"WRAPPER"};if("InLine"===h.nodeName)return{ad:G(h,e,{allowMultipleAds:i}),type:"INLINE"}}}}function G(t,e,{allowMultipleAds:i}={}){return!1===i&&t.getAttribute("sequence")?null:J(t,e)}function J(t,e){let i=[];e&&z.verifyRequiredValues(t,e);const s=t.childNodes,r=function(t={}){return{id:t.id||null,sequence:t.sequence||null,adType:t.adType||null,adServingId:null,categories:[],expires:null,viewableImpression:[],system:null,title:null,description:null,advertiser:null,pricing:null,survey:null,errorURLTemplates:[],impressionURLTemplates:[],creatives:[],extensions:[],adVerifications:[],blockedAdCategories:[],followAdditionalWrappers:!0,allowMultipleAds:!1,fallbackOnNoAd:null}}(L.parseAttributes(t));for(const t in s){const e=s[t];switch(e.nodeName){case"Error":r.errorURLTemplates.push(L.parseNodeText(e));break;case"Impression":r.impressionURLTemplates.push({id:e.getAttribute("id")||null,url:L.parseNodeText(e)});break;case"Creatives":r.creatives=U(L.childrenByName(e,"Creative"));break;case"Extensions":{const t=L.childrenByName(e,"Extension");r.extensions=D(t),r.adVerifications.length||(i=Q(t));break}case"AdVerifications":r.adVerifications=X(L.childrenByName(e,"Verification"));break;case"AdSystem":r.system={value:L.parseNodeText(e),version:e.getAttribute("version")||null};break;case"AdTitle":r.title=L.parseNodeText(e);break;case"AdServingId":r.adServingId=L.parseNodeText(e);break;case"Category":r.categories.push({authority:e.getAttribute("authority")||null,value:L.parseNodeText(e)});break;case"Expires":r.expires=parseInt(L.parseNodeText(e),10);break;case"ViewableImpression":r.viewableImpression.push(Z(e));break;case"Description":r.description=L.parseNodeText(e);break;case"Advertiser":r.advertiser={id:e.getAttribute("id")||null,value:L.parseNodeText(e)};break;case"Pricing":r.pricing={value:L.parseNodeText(e),model:e.getAttribute("model")||null,currency:e.getAttribute("currency")||null};break;case"Survey":r.survey=L.parseNodeText(e);break;case"BlockedAdCategories":r.blockedAdCategories.push({authority:e.getAttribute("authority")||null,value:L.parseNodeText(e)})}}return i.length&&(r.adVerifications=r.adVerifications.concat(i)),r}function Y(t,e){const i=J(t,e),s=t.getAttribute("followAdditionalWrappers"),r=t.getAttribute("allowMultipleAds"),n=t.getAttribute("fallbackOnNoAd");i.followAdditionalWrappers=!s||L.parseBoolean(s),i.allowMultipleAds=!!r&&L.parseBoolean(r),i.fallbackOnNoAd=n?L.parseBoolean(n):null;let h=L.childByName(t,"VASTAdTagURI");if(h?i.nextWrapperURL=L.parseNodeText(h):(h=L.childByName(t,"VASTAdTagURL"),h&&(i.nextWrapperURL=L.parseNodeText(L.childByName(h,"URL")))),i.creatives.forEach((t=>{if(-1!==["linear","nonlinear"].indexOf(t.type)){if(t.trackingEvents){i.trackingEvents||(i.trackingEvents={}),i.trackingEvents[t.type]||(i.trackingEvents[t.type]={});for(const e in t.trackingEvents){const s=t.trackingEvents[e];Array.isArray(i.trackingEvents[t.type][e])||(i.trackingEvents[t.type][e]=[]),s.forEach((s=>{i.trackingEvents[t.type][e].push(s)}))}}t.videoClickTrackingURLTemplates&&(Array.isArray(i.videoClickTrackingURLTemplates)||(i.videoClickTrackingURLTemplates=[]),t.videoClickTrackingURLTemplates.forEach((t=>{i.videoClickTrackingURLTemplates.push(t)}))),t.videoClickThroughURLTemplate&&(i.videoClickThroughURLTemplate=t.videoClickThroughURLTemplate),t.videoCustomClickURLTemplates&&(Array.isArray(i.videoCustomClickURLTemplates)||(i.videoCustomClickURLTemplates=[]),t.videoCustomClickURLTemplates.forEach((t=>{i.videoCustomClickURLTemplates.push(t)})))}})),i.nextWrapperURL)return i}function X(t){const e=[];return t.forEach((t=>{const i={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},s=t.childNodes;L.assignAttributes(t.attributes,i);for(const t in s){const e=s[t];switch(e.nodeName){case"JavaScriptResource":case"ExecutableResource":i.resource=L.parseNodeText(e),L.assignAttributes(e.attributes,i);break;case"VerificationParameters":i.parameters=L.parseNodeText(e)}}const r=L.childByName(t,"TrackingEvents");r&&L.childrenByName(r,"Tracking").forEach((t=>{const e=t.getAttribute("event"),s=L.parseNodeText(t);e&&s&&(Array.isArray(i.trackingEvents[e])||(i.trackingEvents[e]=[]),i.trackingEvents[e].push(s))})),e.push(i)})),e}function Q(t){let e=null,i=[];return t.some((t=>e=L.childByName(t,"AdVerifications"))),e&&(i=X(L.childrenByName(e,"Verification"))),i}function Z(t){const e={};e.id=t.getAttribute("id")||null;const i=t.childNodes;for(const t in i){const s=i[t],r=s.nodeName,n=L.parseNodeText(s);if(("Viewable"===r||"NotViewable"===r||"ViewUndetermined"===r)&&n){const t=r.toLowerCase();Array.isArray(e[t])||(e[t]=[]),e[t].push(n)}}return e}class tt{constructor(){this.Un=[]}on(t,e){if("function"!=typeof e)throw new TypeError("The handler argument must be of type Function. Received type "+typeof e);if(!t)throw new TypeError("The event argument must be of type String. Received type "+typeof t);return this.Un.push({event:t,handler:e}),this}once(t,e){return this.on(t,function(t,e,i){const s={fired:!1,wrapFn:void 0};function r(...r){s.fired||(t.off(e,s.wrapFn),s.fired=!0,i.bind(t)(...r))}return s.wrapFn=r,r}(this,t,e))}off(t,e){return this.Un=this.Un.filter((i=>i.event!==t||i.handler!==e)),this}emit(t,...e){let i=!1;return this.Un.forEach((s=>{"*"===s.event&&(i=!0,s.handler(t,...e)),s.event===t&&(i=!0,s.handler(...e))})),i}removeAllListeners(t){return t?(this.Un=this.Un.filter((e=>e.event!==t)),this):(this.Un=[],this)}listenerCount(t){return this.Un.filter((e=>e.event===t)).length}listeners(t){return this.Un.reduce(((e,i)=>(i.event===t&&e.push(i.handler),e)),[])}eventNames(){return this.Un.map((t=>t.event))}}const et={get:function(t,e,i){i(new Error("Please bundle the library for node to use the node urlHandler"))}},it=12e4;function st(){try{const t=new window.XMLHttpRequest;return"withCredentials"in t?t:null}catch(t){return null}}function rt(t,e,i){const s=i?408:t.status,r=i?`XHRURLHandler: Request timed out after ${t.timeout} ms (${s})`:`XHRURLHandler: ${t.statusText} (${s})`;e(new Error(r),null,{statusCode:s})}const nt={get:function(t,e,i){if("https:"===window.location.protocol&&0===t.indexOf("http://"))return i(new Error("XHRURLHandler: Cannot go from HTTPS to HTTP."));try{const s=st();s.open("GET",t),s.timeout=e.timeout||it,s.withCredentials=e.withCredentials||!1,s.overrideMimeType&&s.overrideMimeType("text/xml"),s.onload=()=>function(t,e){200===t.status?e(null,t.responseXML,{byteLength:t.response.length,statusCode:t.status}):rt(t,e,!1)}(s,i),s.onerror=()=>rt(s,i,!1),s.onabort=()=>rt(s,i,!1),s.ontimeout=()=>rt(s,i,!0),s.send()}catch(t){i(new Error("XHRURLHandler: Unexpected error"))}},supported:function(){return!!st()}};const ht={get:function(t,e,i){return i||("function"==typeof e&&(i=e),e={}),"undefined"==typeof window||null===window?et.get(t,e,i):nt.supported()?nt.get(t,e,i):i(new Error("Current context is not supported by any of the default URLHandlers. Please provide a custom URLHandler"))}};let ot=0,at=0;const lt=(t,e)=>{if(!t||!e||t<=0||e<=0)return;at=(at*ot+8*t/e)/++ot},ct={ERRORCODE:900,extensions:[]};class ut extends tt{constructor(){super(),this.remainingAds=[],this.parentURLs=[],this.errorURLTemplates=[],this.rootErrorURLTemplates=[],this.maxWrapperDepth=null,this.URLTemplateFilters=[],this.fetchingOptions={},this.parsingOptions={}}addURLTemplateFilter(t){"function"==typeof t&&this.URLTemplateFilters.push(t)}removeURLTemplateFilter(){this.URLTemplateFilters.pop()}countURLTemplateFilters(){return this.URLTemplateFilters.length}clearURLTemplateFilters(){this.URLTemplateFilters=[]}trackVastError(t,e,...i){this.emit("VAST-error",Object.assign({},ct,e,...i)),C.track(t,e)}getErrorURLTemplates(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}getEstimatedBitrate(){return at}fetchVAST(t,e=0,i=null,s=null){return new Promise(((r,n)=>{this.URLTemplateFilters.forEach((e=>{t=e(t)})),this.parentURLs.push(t);const h=Date.now();this.emit("VAST-resolving",{url:t,previousUrl:i,wrapperDepth:e,maxWrapperDepth:this.maxWrapperDepth,timeout:this.fetchingOptions.timeout,wrapperAd:s}),this.urlHandler.get(t,this.fetchingOptions,((s,o,a={})=>{const l=Math.round(Date.now()-h),c=Object.assign({url:t,previousUrl:i,wrapperDepth:e,error:s,duration:l},a);this.emit("VAST-resolved",c),lt(a.byteLength,l),s?n(s):r(o)}))}))}initParsingStatus(t={}){this.errorURLTemplates=[],this.fetchingOptions={timeout:t.timeout||it,withCredentials:t.withCredentials},this.maxWrapperDepth=t.wrapperLimit||10,this.parentURLs=[],this.parsingOptions={allowMultipleAds:t.allowMultipleAds},this.remainingAds=[],this.rootErrorURLTemplates=[],this.rootURL="",this.urlHandler=t.urlHandler||t.urlhandler||ht,this.vastVersion=null,lt(t.byteLength,t.requestDuration)}getRemainingAds(t){if(0===this.remainingAds.length)return Promise.reject(new Error("No more ads are available for the given VAST"));const e=t?C.flatten(this.remainingAds):this.remainingAds.shift();return this.errorURLTemplates=[],this.parentURLs=[],this.resolveAds(e,{wrapperDepth:0,url:this.rootURL}).then((t=>this.buildVASTResponse(t)))}getAndParseVAST(t,e={}){return this.initParsingStatus(e),this.URLTemplateFilters.forEach((e=>{t=e(t)})),this.rootURL=t,this.fetchVAST(t).then((i=>(e.previousUrl=t,e.isRootVAST=!0,e.url=t,this.parse(i,e).then((t=>this.buildVASTResponse(t))))))}parseVAST(t,e={}){return this.initParsingStatus(e),e.isRootVAST=!0,this.parse(t,e).then((t=>this.buildVASTResponse(t)))}buildVASTResponse(t){const e=function({ads:t,errorURLTemplates:e,version:i}){return{ads:t||[],errorURLTemplates:e||[],version:i||null}}({ads:t,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion});return this.completeWrapperResolving(e),e}parseVastXml(t,{isRootVAST:e=!1,url:i=null,wrapperDepth:s=0,allowMultipleAds:r,followAdditionalWrappers:n}){if(!t||!t.documentElement||"VAST"!==t.documentElement.nodeName)throw this.emit("VAST-ad-parsed",{type:"ERROR",url:i,wrapperDepth:s}),new Error("Invalid VAST XMLDocument");const h=[],o=t.documentElement.childNodes,a=t.documentElement.getAttribute("version");e&&a&&(this.vastVersion=a);for(const t in o){const l=o[t];if("Error"===l.nodeName){const t=L.parseNodeText(l);e?this.rootErrorURLTemplates.push(t):this.errorURLTemplates.push(t)}else if("Ad"===l.nodeName){if(this.vastVersion&&parseFloat(this.vastVersion)<3)r=!0;else if(!1===r&&h.length>1)break;const t=K(l,this.emit.bind(this),{allowMultipleAds:r,followAdditionalWrappers:n});t.ad?(h.push(t.ad),this.emit("VAST-ad-parsed",{type:t.type,url:i,wrapperDepth:s,adIndex:h.length-1,vastVersion:a})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return h}parse(t,{url:e=null,resolveAll:i=!0,wrapperSequence:s=null,previousUrl:r=null,wrapperDepth:n=0,isRootVAST:h=!1,followAdditionalWrappers:o,allowMultipleAds:a}={}){let l=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&h&&(a=!0);try{l=this.parseVastXml(t,{isRootVAST:h,url:e,wrapperDepth:n,allowMultipleAds:a,followAdditionalWrappers:o})}catch(t){return Promise.reject(t)}return 1===l.length&&null!=s&&(l[0].sequence=s),!1===i&&(this.remainingAds=L.splitVAST(l),l=this.remainingAds.shift()),this.resolveAds(l,{wrapperDepth:n,previousUrl:r,url:e})}resolveAds(t=[],{wrapperDepth:e,previousUrl:i,url:s}){const r=[];return i=s,t.forEach((t=>{const s=this.resolveWrappers(t,e,i);r.push(s)})),Promise.all(r).then((t=>{const r=C.flatten(t);if(!r&&this.remainingAds.length>0){const t=this.remainingAds.shift();return this.resolveAds(t,{wrapperDepth:e,previousUrl:i,url:s})}return r}))}resolveWrappers(t,e,i){return new Promise((s=>{if(e++,!t.nextWrapperURL)return delete t.nextWrapperURL,s(t);if(e>=this.maxWrapperDepth||-1!==this.parentURLs.indexOf(t.nextWrapperURL))return t.errorCode=302,delete t.nextWrapperURL,s(t);t.nextWrapperURL=L.resolveVastAdTagURI(t.nextWrapperURL,i),this.URLTemplateFilters.forEach((e=>{t.nextWrapperURL=e(t.nextWrapperURL)}));const r=this.parsingOptions.allowMultipleAds??t.allowMultipleAds,n=t.sequence;this.fetchVAST(t.nextWrapperURL,e,i,t).then((h=>this.parse(h,{url:t.nextWrapperURL,previousUrl:i,wrapperSequence:n,wrapperDepth:e,followAdditionalWrappers:t.followAdditionalWrappers,allowMultipleAds:r}).then((e=>{if(delete t.nextWrapperURL,0===e.length)return t.creatives=[],s(t);e.forEach((e=>{e&&L.mergeWrapperAdData(e,t)})),s(e)})))).catch((e=>{t.errorCode=301,t.errorMessage=e.message,s(t)}))}))}completeWrapperResolving(t){if(0===t.ads.length)this.trackVastError(t.errorURLTemplates,{ERRORCODE:303});else for(let e=t.ads.length-1;e>=0;e--){const i=t.ads[e];(i.errorCode||0===i.creatives.length)&&(this.trackVastError(i.errorURLTemplates.concat(t.errorURLTemplates),{ERRORCODE:i.errorCode||303},{ERRORMESSAGE:i.errorMessage||""},{extensions:i.extensions},{system:i.system}),t.ads.splice(e,1))}}}const dt=function(t=""){return new Promise((e=>{e((new ut).getAndParseVAST(t,{timeout:1e4,withCredentials:!0}))}))};class pt{On=!1;Bn=!1;Hn=!1;jn=0;qn=0;Wn;zn;Kn=0;Gn=!1;Jn=!1;Yn=[];Xn=!1;Qn=0;Zn=0;th=0;eh=0;ih=[];sh={};rh={};nh=!1;hh=!0;oh="";ah=null;Ys;lh=!0;uh=!0;constructor(e,i){if(this.Wn=e,this.zn=i,this.Zn=void 0!==i.mips?i.mips:t.F.O,this.lt().dh,this.jn=void 0!==i.mvt?i.mvt:t.F.U,this.Gn=void 0!==i.avt&&i.avt,this.Kn=void 0!==i.round?i.round:1,this.hh=void 0===i.friendly||i.friendly,this.lh=void 0===i.proxy||i.proxy,this.uh=void 0===i.fsnd||i.fsnd,this.Qn=void 0!==i.mcr&&Number(i.mcr)>t.F.B?i.mcr:t.F.B,!this.hh&&i.td&&i.td.length>0){const t=this.lt().te("ima");this.oh=t||"https://".concat(i.td[Math.floor(Math.random()*i.td.length)]).concat("/mp_dist"),this.Kt("Tech domain ",this.oh)}if(i.trackings){const t={st:g.ws,i:g._s,f:g.vs,m:g.ys,t:g.bs,c:g.As,ck:g.fs,tt:"thirdpartytracking",s:g.rs};Object.entries(i.trackings).forEach((e=>{const i=e[0],s=e[1];t[i]&&s.length>0&&(this.rh[t[i].replace("Ad","").toLowerCase().replace("video","")]=s)}))}this.Ys={vn:t.H.q,fn:void 0!==i.ttitmt&&Number(i.ttitmt)>t.H.W?Number(i.ttitmt):t.H.W,rn:void 0!==i.ttosc&&Number(i.ttosc)>t.H.K?Number(i.ttosc):t.H.K,Yr:void 0!==i.tfss&&Number(i.tfss)>t.H.G?Number(i.tfss):t.H.G,ph:void 0!==i.tne&&Number(i.tne)>t.H.Y?Number(i.tne):t.H.Y}}_h(t=null){if(null===t)return this.Xn;this.Xn=t}xn(){return this.uh}Cn(){return this.lh}$n(){return!(!this.hh&&""!==this.oh)}Dn(){return this.oh}Xr(){return this.Ys}mh(){const t=this.Yn.filter((t=>t.kr(g.Mi)&&t.kr(g.Fi))).length;this.Kt("Зомби",this.br(),t,this.Yn.length),this.Yn.length>0&&t===this.Yn.length&&(this.Kt("Зомби",this.br(),"был"),this.Hn=!0)}In(){return this.nh}fh(){return this.Yn}gh(){return this.Yn.filter((t=>t.kr(g.Mi)&&!t.kr(g.Fi)))}wh(){this.Qn--,this.Qn<0&&(this.Qn=0)}pn(t){if(0===this.Wn.yh){this.Yn.filter((t=>t.kr(g.Mi))).length+this.Qn+1<this.Yn.length&&this.Qn++}this.ih.includes(t.Fr())||this.ih.push(t.Fr()),this.th++,this.eh++}bh(){return this.ih}Ah(){this.Kn=0,this.Qn=0}kh(){this.Yn.forEach((t=>{t.kr(g.Mi)||(t.Ar(g.Mi),t.Ar(g.Fi))}))}yt(){this.kh(),this.On=!0,this.Hn=!0}Rh(){if(this.Kt("Партнер  работает",this.B()),this.B()<=0){this.kh();const t=this.Yn.filter((t=>t.kr(g.Mi)&&t.kr(g.Fi))).length,e=this.Yn.filter((t=>t.kr(g.Mi)&&!t.kr(g.Fi))).length;this.Kt("Всего stages",this.Yn.length,"Отработал",t,"Еще в работе",e),e>0?this.Kt("Ждем"):this.Kn>0&&(this.eh>0||this.lt().te("relFrame"))?(this.Kt("Еще раз показать",this.Kn),this.On=!1):(this.Hn=!0,this.vr().Sh(this.br()),this.Kt("Закончил"))}}Th(t){return new Promise(((e,i)=>{const s=t=>"linear"===t.type&&t.mediaFiles.length,r=t.ads.filter((t=>t.creatives.some(s)));r.length||i("Ничего нету у партнера");const n=r.filter((t=>t.sequence)).filter((t=>!this.$h(t))).sort(((t,e)=>t.sequence-e.sequence)),h=r.filter((t=>!n.includes(t)));let o=[];o=n.length?n:h,this.Ih(o).then((t=>{0===t.length&&i("Не смог создать stages"),this.Qn>t.length&&(this.Qn=Number(t.length)),this.Yn=t,e("Всего подготовлено "+t.length+" stages")}))}))}Ih(t){return new Promise(((e,i)=>{const s=[];let r=1;t.forEach((t=>{t.creatives&&t.creatives.filter((t=>"linear"===t.type)).forEach((e=>{const i=new y(this,r,t,e);i.Ir()&&(r++,s.push(i))}))})),e(s)}))}Ph(){return this.Bn=!1,this.qn=0,this.Jn=!1,this.Yn=[],this}Kt(...t){if(this.lt().te("debug")||this.lt().te("showLog")){const e=Array.prototype.slice.call(t),i=["%cPARTNER ["+this.yr()+"/"+this.br()+"]","background-color: #01917c; color: white;font-weight: bold;padding:1px 3px;border-radius: 3px;margin-right: 7px;"].concat(e);console.log.apply(console,i)}}te(t){return this.zn[t]||void 0}_n(){return this.th}B(){return this.Qn}O(){return this.Zn}Eh(){return this.rh}lt(){return this.Wn.lt()}yr(){return this.te("id")}br(){return this.te("adsrc")}vr(){return this.Wn}Ch(){return this.Jn}async xh(){return this.Kn--,this.eh=0,this.Ph(),new Promise(((t,e)=>{const i=u(this.te("tag"),Object.assign({},this.lt().$r()));this.Kt("URL",i),dt(i).then((i=>{this.Th(i).then((e=>{this.On=!0,this.Kt(e),t(this.br())}),(t=>{this.On=!0,this.Hn=!0,this.Kt("VASTResponse error",t),e(this.br())}))}),(t=>{this.On=!0,this.Hn=!0,this.Kt("VASTResponse error",t),e(this.br())}))}))}async Lh(){return this.Kn--,this.eh=0,this.Ph(),new Promise(((t,e)=>{const s=new MessageChannel;i(this.oh+"/td/tp.html?v"+this.lt().ee,this.lt().ie().ot()).then((i=>{this.ah=new WeakRef(i);const r=this.ah.deref();r.width="1",r.height="1",r.style.border="none",r.style.minHeight="1",r.style.minWidth="1";s.port1.onmessage=i=>{const n=i.data;if("object"==typeof n)switch(n.type){case"tech_vast_result":this.Th(n.data).then((e=>{this.On=!0,this.Kt(e),t(this.br())}),(t=>{this.On=!0,this.Hn=!0,this.Kt("VASTResponse error",t),e(this.br())})).finally((()=>{this.Kt("Удаляю фрейм"),s.port1.close(),s.port1.onmessage=null,r.remove(),this.ah=null}));break;case"tech_vast_result_error":this.Kt("Удаляю фрейм после ошибки"),this.On=!0,this.Hn=!0,s.port1.close(),s.port1.onmessage=null,r.remove(),this.ah=null,e(this.br());break;case"tech_vast_ready":const i=u(this.te("tag"),Object.assign({},this.lt().$r()));this.Kt("URL",i),((t,e=!0)=>{const i=t;s.port1.postMessage(i)})({type:"tech_vast_get",data:{url:i}})}};const n={type:"tech_start",data:{d:this.lt().te("debug")||this.lt().te("showLog"),c:this.yr()+"/"+this.br()}};try{r.contentWindow.postMessage(n,"*",[s.port2])}catch(t){this.Kt("postMessage Error",t.toString())}}))}))}Mh(t){return t.mediaFiles.every((t=>t&&t.apiFramework))}$h(t){return t.creatives.every((t=>this.Mh(t)))}}class _t{Vh=[];Nh=!0;dh=0;wr=0;Dh=0;Qt=0;yh=0;On=!1;Fh=!1;Uh=!1;Oh=0;At;Bh=!0;Hh=null;jh=0;qh=0;Wh=new Map;zh=null;Kh=!1;constructor(e,i){this.At=e,this.jh=Number(2),this.Nh=void 0!==i.qm?i.qm:t.S.I,this.Bh=void 0!==i.s?i.s:t.S.P,this.dh=void 0!==i.k?i.k:t.S.C,this.wr=void 0!==i.i?i.i:t.S.L,this.yh=void 0!==i.li?i.li:t.S.M,this.Dh=void 0!==i.t?i.t:t.S.V,this.Qt=void 0!==i.tt?i.tt:t.S.N,this.Uh=void 0!==i.tnb?i.tnb:t.S.D}I(){return this.Nh}lt(){return this.At}Gh=()=>{this.lt().Jh(),this.Kt("Будильник"),this.Yh()};wn(){const e=[];return this.Kt("Запуск блока"),this.lt().Fn()?0===this.Vh.length?(this.On=!0,this.Kt("Пустой блок"),void this.Xh()):(this.zh=window.setInterval(this.Gh,1e3*t.l),this.Qh(),this.Vh.forEach((t=>{e.push(new pt(this,t))})),this.Vh=e,this.On=!0,void this._t()):(this.On=!0,this.Fh=!0,void this.Kt("Невозможно проигрывать"))}hn(t,e){this.nn(t,e),this.lt().Zh(this,t)}nn(t,e){switch(t.includes("timeupdate")||this.Kt("Listener",t),t){case g.ns:void 0!==e&&this.en(e);break;case g._s:this.eo();break;case g.vs:case g.ys:case g.bs:case g._s:break;case g.Xi:case g.Ni:this.Gr(e);break;case g.ts:case g.Yi:e.Qr().Rh(),this.Xh();break;case g.Is:case g.ss:e.Ar(g.Fi),this.Gr(e),e.Nr();break;case g.As:e.ci()||this.Gr(e)}}Yh(e=null){let i=!1;const s=this.Vh.filter((t=>t.On&&!t.Hn));this.Kt("_resumeStages start TODO 1, resume count: ",s.length),s.forEach((s=>{const r=s.gh();if(r&&r.length>0){const s=(new Date).getTime();r.forEach((r=>{if(r.ci()){const n=r.Rn().getTime(),h=(s-n)/1e3;if(h>=t.u)if(!0===e||r.kr(g.qi)||r.kr(g.Is)){this.Kt("Freeze",r.Fr(),r.ci(),h,r.Fr(),r.Rn()),r.Ar(g.Fi),this.Gr(r);try{r.Ur()}catch(t){r.Vr(g.ss)}i=!0}else this.Kt("Wait",r.Fr(),r.ci(),h,r.Fr(),r.Rn())}}))}i&&this._t()}))}io(t){const e=t.fh();e[0]?(this.Kt("Запуск первой"),t._h(!0),this.so(e[0])):(this.Kt("Запуск первой откинуть"),t.yt())}so(t){t.Qr().wh(),t.Ar(g.Mi);let e=1;this.qh<this.jh&&(e=2e3*this.qh,this.qh++),this.Kt("select",t.Qr().br(),t.Fr()),t.Qr().qn++,this.ro(t)?t.nn(g.Mi):window.setTimeout((()=>{t.nn(g.Mi)}),1e3)}_t(){if(this.lt().Fn()){if(!this.On)return this.Kt("Не загружено"),this;this.Kt("_nextStage "),this.no().then((t=>{let e=[];t.length>0&&(e=[...new Set(t.map((t=>t.br())))]),this.Kt("Сейчас в работе",e),this.fh(t).then((t=>{const e=t.st,i=t.stH,s=t.fr;let r=this.lt().sn()-s;if(i.length>0&&(this.Kt("Stages Hold",i.length),i.every((t=>{if(this.ho(t))return!1})),r=Number(this.lt().sn())-Number(i.length)-s,(r<0||r>this.lt().sn())&&(r=0)),this.Kt("Stages в работе ",i.length,"Первых запусков",s," Можно еще запустить",r,"из",e.length,"stages"),r>0&&e.length>0){let t=[...new Set(i.map((t=>t.Qr().br())))];const s=[...new Set(e.map((t=>t.Qr().br())))];s.length<this.lt().sn()&&(t=[]),this.Kt("Партнеров в работе",t," Не в работе партнеров",s),e.forEach((e=>{t.includes(e.Qr().br())||(this.lt().Li()>=e.Qr().jn?r>0&&e.Qr().B()>0&&(e.kr(g.Mi)||(r--,this.so(e),s.length>2&&t.push(e.Qr().br()))):e.Vr(g.ss))}))}if(i.length>0&&this.lt().te("showLog")){const t=[];i.forEach((e=>{t.push({vpaid:e.Er().ci(),start:e.kr(g.qi),view:e.Qr().qn,sleep:e.kr(g.Ni),load:e.kr(g.ns),maybeAd:e.Bs,play:e.Os,time:e.Hs.getTime(),par:e.Fr()})})),console.table(t)}})).catch((()=>{}))}))}else this.Kt("not _playerVisible ")}jt(){this.Vh=[],this.Fh=!0}Xh(){const t=this.Vh.filter((t=>t.On&&t.Hn)).length;if(this.Kt("_checkForTrailer","Отработало:",t,"Всего:",this.Vh.length),t!==this.Vh.length)this.Vh.length-t<=2&&this.Dh&&(1===this.Dh?this.Oh>0&&this.lt().ie().Zt():this.lt().te("instant")||2===this.Dh&&this.lt().ie().Zt()),this.Jr(),this._t();else if(this.Kh)this.Kt("Блок НЕ закончился");else{this.Kh=!0;const t=[...new Set(this.Vh.map((t=>{if(t._n()>0)return[...t.bh()]})))];this.Kt("Block finished",this.Dh,this.zh," -> ",t),this.lt().ie().Ot("partner_switch"),this.zh&&(window.clearInterval(this.zh),this.zh=null),this.Dh?1===this.Dh?this.Oh>0?(this.lt().ie().Ot("movieads_tlr_top"),this.lt().ie().Ot("movieads_close0"),this.lt().ie().Ot("movieads_onstage"),this.lt().ie().Gt()):window.setTimeout((()=>{this.lt().ct()}),0):2===this.Dh&&(this.lt().ie().Ot("movieads_tlr_start"),this.lt().ie().Gt()):this.lt().ct()}}Jr(){if(null!==this.Hh)return;const t=this.Vh.filter((t=>t.On&&!t.Hn)),e=[];let i=!1;if(this.Kt("check Scene"),t.forEach((t=>{if(!t._h())return;t.fh().forEach((t=>{t.kr(g.Fi)||t.kr(g.Mi)&&!t.kr(g.Ni)&&(e.push(t),t.Er().ci()||(i=!0))}))})),e.length>0){if(i?e.sort(this.oo):e.sort(this.ao),this.lt().te("showLog")){const t=[];e.forEach((e=>{t.push({vpaid:e.Er().ci(),start:e.kr(g.qi),view:e.Qr().qn,sleep:e.kr(g.Ni),load:e.kr(g.ns),maybeAd:e.Bs,play:e.Os,time:e.Hs.getTime(),par:e.Fr()})})),console.table(t)}e.every((t=>{if(this.Kt("На сцену?",t.Fr()),this.ho(t))return this.Kt("Запустилась",t.Fr()),!1}))}}ao=(t,e)=>Number(e.kr(g.ns))-Number(t.kr(g.ns))||Number(t.kr(g.Ni))-Number(e.kr(g.Ni))||Number(e.Os)-Number(t.Os)||Number(e.Bs)-Number(t.Bs)||t.Hs.getTime()-e.Hs.getTime();oo=(t,e)=>{const i=Number(t.Er().ci()),s=Number(e.Er().ci());return i>s?-1:i<s?1:0};async no(){return new Promise(((t,e)=>{const i=this.Vh.filter((t=>t.On&&!t.Hn));let s=Number(this.lt().sn())-Number(i.length);const r=this.Vh.filter((t=>!t.On&&!t.Hn));if(this.Kt("Партнеров в работе",i.length,"Ожидают загрузки",r.length,"emptySlotsForPartners",s,"Max",this.lt().sn()),0===i.length&&0===r.length&&(this.Kt("Зависли?"),this.Xh()),s>0)if(r&&r.length>0){(new Date).getTime();const t=[],e=[...new Set(i.map((t=>t.br())))];r.forEach((r=>{s>0&&this.lo(r)&&(e.includes(r.br())||(e.push(r.br()),i.push(r),s--,t.push(1),r.On=!0,r.$n()?window.setTimeout((()=>{r.Kt("Загрузка VAST fr"),r.xh().then((t=>{r.Kt("Загрузка VAST завершена fr",t),this.io(r)}),(t=>{r.Kt("Crash fr",t),this._t()}))})):window.setTimeout((()=>{r.Kt("Загрузка VAST tech"),r.Lh().then((t=>{r.Kt("Загрузка VAST завершена tech",t),this.io(r)}),(t=>{r.Kt("Crash tech",t),this._t()}))}))))})),this.Kt("Загружать",t)}else this.Kt("Нечего загружать, ");t(i)}))}async fh(t){return new Promise(((e,i)=>{const s=[],r=[];let n=!1,h=!1,o=0;t.forEach((t=>{if(!t._h())return o++,void this.Kt("Сколько ",t.br(),"Первый запуск");const e=t.fh();this.Kt("У ",t.br(),"всего ",e.length,t.On),e.forEach((t=>{t.kr(g.Fi)||(t.kr(g.Mi)?(r.push(t),t.Er().ci()||(h=!0)):(s.push(t),t.Er().ci()||(n=!0)))}))})),(h||n)&&this.Kt("Есть прямое видео","В работе",h,"Ожидает ",n),r.length>0&&(h?r.sort(this.oo):r.sort(this.ao)),s.length>0&&(this.Bh?s.sort(((t,e)=>t.Qr().te("pos")-e.Qr().te("pos"))):n?s.sort(this.oo):s.sort(((t,e)=>t.Qr().qn-e.Qr().qn))),e({st:s,stH:r,fr:o})}))}ho(t){return!(null!==this.Hh||t.kr(g.Fi)||!t.kr(g.ns))&&(this.en(t),!0)}un(t){return null!==this.Hh&&this.Hh.Fr()===t.Fr()}Gr(t){this.Kt("Что тут From Scene ",t.Fr(),"на сцене ->",this.Hh?this.Hh.Fr():"Пусто"),null!==this.Hh&&this.Hh.Fr()===t.Fr()&&(this.Hh=null,t.Gr(),this.lt().ie().Ot("movieads_offstage"),this.Qh(),this.Kt("From Scene ",Object.assign({},t)))}en(t){null===this.Hh?(this.Hh=t,this.co(this.Hh),this.Hh.en(),this.Hh.kr(g.Ts)||this.Hh.kr(g.zi)?this.Hh.Or():this.Hh.kr(g.qi)||this.Hh.Hr(),this.Kt("to Scene",this.Hh.Fr())):this.Kt("Scene wait",t.Fr(),"  на сцене ->",this.Hh.Fr())}ro(t){const e=t.Qr(),i=e.te("fsz");if(void 0===i)return!1;if(this.Kt("Received FSZ command",e.br(),i),this.Wh.has(e.br()))return this.Kt("Partner FSZ already in QUEUE"),!1;this.Wh.set(e.br(),i);let s=!0;const r={x:0,y:0};for(const t of this.Wh.values())(t.x>r.x||t.y>r.y)&&(r.x=t.x,r.y=t.y,s=!1);return this.Kt("fsz",this.Wh,r),s||this.lt().ie().Ot({fsz:r}),s}Sh(t){if(this.Wh.has(t))if(this.Wh.delete(t),0===this.Wh.size)this.Kt("Partner FSZ empty"),this.lt().ie().Ot("partner_switch");else{const t={x:0,y:0};for(const e of this.Wh.values())(e.x>t.x||e.y>t.y)&&(t.x=e.x,t.y=e.y);this.Kt("fsz recalc",this.Wh,t),this.lt().ie().Ot({fsz:t})}else this.Kt("Partner FSZ not query for delete")}uo(){}Kt(...t){if(this.lt().te("debug")||this.lt().te("showLog")){const e=Array.prototype.slice.call(t),i=["%cJMAPBLOCK ["+this.wr+"]","background-color: #0091EA; color: white;font-weight: bold;padding:1px 3px;border-radius: 3px;margin-right: 7px;"].concat(e);console.log.apply(console,i)}}eo(){this.Oh++,this.yh>0&&this.Oh>=this.yh&&(this.Kt("Limit Сейчас:",this.Oh,"Максимум:",this.yh),this.Vh.forEach((t=>{if(t.On){if(!t.Hn){this.Kt("Limit load",t.br()),t.Ah();t.fh().forEach((t=>{t.kr(g.Mi)?t.kr(g.qi)||(this.Kt("Limit stage start",t.Fr()),t.Ur(),t.Ar(g.qi),t.Ar(g.Mi),t.Ar(g.Fi)):(this.Kt("Limit stage sel",t.Fr()),t.Ar(g.Mi),t.Ar(g.Fi))}))}}else this.Kt("Limit",t.br()),t.yt()})))}lo(t){if(!t.te("avt")&&this.lt().Li()<t.jn){const e={tag:t.te("tag"),mvt:t.jn,id:t.yr(),cvt:this.lt().Li(),vst:document.visibilityState};return this.lt().cn().cn("stage","min_vt_skip",JSON.stringify(e)),this.Kt("MIN_VT_MRC SKIP"),t.yt(),!1}const e=t.te("run_state");return"visible"!==e||e===document.visibilityState||(this.lt().cn().cn("stage","invisible_run_partner_skip",e),t.yt(),!1)}co(t){let e=1;const i=t.Qr().te("tr")||!1,s=t.Qr().te("close0")||!1;i&&!1===s?e=2:!0===s&&(e=0),this.lt().ie().Ot("movieads_close"+e.toString())}Qh(){this.lt().ie().Ot("movieads_close1")}}class mt{do;At;po="";constructor(t){this.At=t,this.do={v:this.At.dh,c:this.At._o}}cn(e,i,s,r){const n=Object.assign({},this.do,{t:e,a:i,m:s,v:this.At.dh,c:this.At._o,o:void 0!==window.location.ancestorOrigins?JSON.stringify(window.location.ancestorOrigins):""}),h=new Image;void 0!==r&&(h.onload=()=>{r()},h.onerror=()=>{r()}),h.src=t.g+d(n)}xh(e){if(t._){let t=new Image;t.src=e,t=null}else console.log(e);return this}app(e={},i={},s=!1){e=Object.assign({w:"key",platform:v.Ls()?"mobile":"desktop",mo:Math.random().toString().replace(".",""),vuid:this.po},e),s&&(e=Object.assign(e,i));const r=`${t._||""}/track?${d(e)}`;return this.xh(r),console.info(`{${e.partner}} tag:${e.tag||"~"} ${e.source}:${e.status||"~"} [${i.statusName||"~"}]`,e),this}visit(){return this}partner(t){return this.app({source:"partner",status:t}),this}tag(t,e){this.app({source:"tag",status:t},{tag:e},!0)}dn(t,e,i){this.fo(t,e).then((()=>{this._(t,e),void 0!==i&&i()}),(()=>this))}fo(t,e){return new Promise(((i,s)=>{!0===t.Qr().te("avt")?t.bn()?i(!0):[g.vs,g.ys,g.bs,g._s].includes(e)?t.Fs?.Ei().then((e=>{t.Kt("MRC CALLBACK",e),e.viewabilityStatus?(t.Kt("MRC VIEWABILITY TRACKED!",e),t.Us=!0,t.Fs?.Ii(),i(!0)):(t.Kt("AD IS NOT VIEWABLE! SKIP TRACKING!"),s(!0))})):i(!0):i(!0)}))}_(e,i){const s=[];i=i.replace("Ad","").toLowerCase().replace("video","");const r=e.Qr().Eh();r[i]&&s.push(...r[i]);const n=Object.assign({},e.lt().$r(),e.$r()),h=e.Pr().Be(i);h.length>0&&s.push(...h);const o=g._s.replace("Ad","").toLowerCase().replace("video",""),a=g.fs.replace("Ad","").toLowerCase().replace("video","");switch(i){case o:const i=e.Qr().te("pm");"js"in i&&e.nn(t.ht.ft.gt,{url:u(i.js,n)}),r.thirdpartytracking&&s.push(...r.thirdpartytracking),s.push(...e.An()._e());break;case a:s.push(...e.Pr().Ue())}0!==s.length&&s.forEach((t=>{t.length>0&&(t=u(t,n),e.Kt("Sent TRACK",i,t),this.xh(t))}))}}function ft(t){return new Promise(((e,i)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>i(t.error)}))}let gt;function wt(){return gt||(gt=function(t,e){const i=indexedDB.open(t);i.onupgradeneeded=()=>i.result.createObjectStore(e);const s=ft(i);return(t,i)=>s.then((s=>i(s.transaction(e,t).objectStore(e))))}("mva","k")),gt}function vt(t,e,i=wt()){return i("readwrite",(i=>(i.put(e,t),ft(i.transaction))))}class yt{dh="";_o="";wo=!1;Ht="";Bt="";vo=null;Cr=1;qr;Wr;yo=!1;bo=!1;Ao;ko="";Ro=!1;So;To="hidden";$o="visibilitychange";Io=null;Po=!0;Eo=0;Co=[];xo=null;Lo=0;Mo="";Vo=null;No=0;Do;ee="1685623714313";Fo;Uo;Oo;Bo={};Ho;jo=!1;qo=5;Wo=2;zo=2;Fh=!1;Ko=[3];gr=new AbortController;constructor(){this.vo=new s(this),this.Ht=e(),this.Bt=e(),this.Go(),this.Ao=new mt(this),this.Ho=new Date,this.To=this.Jo(),this.To&&(this.$o=this.To.replace(/[H|h]idden/,"")+"visibilitychange"),window.addEventListener(this.$o,this.Yo,!1);(navigator.connection||navigator.mozConnection||navigator.webkitConnection)&&navigator.connection.addEventListener("change",this.Xo,{signal:this.gr.signal})}Jo(){const t=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(let e=0;e<t.length;e++)if(t[e]+"Hidden"in document)return t[e]+"Hidden";return""}Xo=t=>{const e=navigator.connection||navigator.mozConnection||navigator.webkitConnection;if(e){const t=Math.round(e.downlink);this.Ko.includes(t)||(this.Ko.push(t),this.Kt("dynamic chg",t,this.Ko))}};te(t){return this.So[t]||void 0}Qo(t){this.So=t,this.Kt("config",t),this.dh=this.te("key"),this._o=this.te("cb"),this.ko=r();const e=this.te("jp");e.sid&&(this.Mo=e.sid,"preloader"===e.sid&&(this.Lo=.6)),this.Ro=void 0!==t.backstage&&t.backstage,window.parent}Ln(){return this.Lo}Zo(t){this.dh=t.key}ta(){const t={v:this.dh,"cp.referer":this.te("ref")?this.te("ref"):document.referrer,it:1,tq:2,"cp.cb":r(),session:this._o,position:"pre",vt:this.Li(),ostream:"true",isp:void 0!==window.isp?window.isp:0,suri:this.te("suri")?this.te("suri"):""};!1===this.wo&&(t.raw="yes");const e=this.te("jp");e.ma&&!1!==e.ma&&(t.ma=e.ma),e.sid&&""!==e.sid&&(t.sid=e.sid);let i=d(t);if(void 0!==window.location.ancestorOrigins){const t=Array.from(window.location.ancestorOrigins).pop();i+="&tanc="+encodeURIComponent(t)}return"https://code.moviead55.ru/go/jmap?"+i}Sr(){this.ko=r()}$r(){const e=this.ie().ot().getBoundingClientRect();let i="";return-1===t.A.indexOf(window.location.hostname)&&(i=encodeURIComponent(window.location.href)),{"[lh]":i,"[vt]":this.No,"[subs]":this.ko,"[session]":this._o,"[w]":e.width,"[h]":e.height,"[sw]":window.screen.width,"[sh]":window.screen.height,"[ls]":window.screen.orientation&&"type"in window.screen.orientation?window.screen.orientation.type:void 0,"[pr]":window.devicePixelRatio||1}}ea(){(this.te("debug")||this.te("showLog"))&&(this.bo=!0),this.Kt("Запуск");const t=((new Date).getTime()-window.movieadsFrameInit.getTime())/1e3;this.te("relFrame")||this.cn().cn("player_loaded","",JSON.stringify({loadTime:t,version:this.ee})),this.Jh();(async()=>await Promise.all([this.ia()]))().then((t=>{this.Bo=t[0],this.sa(),this.ie().Ot("movieads_ready"),this.ie().Ot("mads_ping"),this.Yo(),this.ra()})).catch((t=>{this.Kt("Случилось страшное",t)}))}ra(){this.fetchWithTimeout(this.ta()).then((t=>t.json())).then((t=>{this.wn(t)})).catch((t=>{if(this.Kt("JMAP ERROR",t.toString()),0===this.qo)return this.Kt("STOPPING JMAP"),void this.na();this.qo--,window.setTimeout((()=>{this.Kt("RETRYING JMAP"),this.ra()}),5e3)}))}async fetchWithTimeout(t,e={}){const{timeout:i=5e3}=e,s=new AbortController;e.credentials="include",e.referrerPolicy="unsafe-url";const r=setTimeout((()=>s.abort()),i),n=await fetch(t,{...e,credentials:"include",referrerPolicy:"unsafe-url",signal:s.signal});return clearTimeout(r),n}async ha(){const e=new Headers;e.append("pragma","no-cache"),e.append("cache-control","no-cache");let i=t.h;if(this.te("falcon"))i="//86.sk.movieads.ru/";else{const t=this.te("ima");i=t||"https://user91471.clients-cdnnow.ru/mp_dist/"}return(await fetch(i+"cfg.json?v"+this.ee,{method:"GET",referrerPolicy:"no-referrer"})).json()}oa(t){return this.Bo[t]||void 0}sa(){const t=document.createElement("style");t.innerHTML=this.oa("c"),document.head.appendChild(t),this.Fo=atob(this.oa("vp")),this.Oo=this.oa("vm");const e=new Blob([this.Fo],{type:"text/html"});this.Uo=URL.createObjectURL(e),this.qr=this.oa("bv"),this.Wr=URL.createObjectURL(this.aa(this.qr)),document.body.classList.remove("hidden")}async ia(){return new Promise(((t,e)=>{(function(t,e=wt()){return e("readonly",(e=>ft(e.get(t))))})("cfg").then((e=>{void 0===e?this.ha().then((e=>{vt("cfg",e),t(e)})):(this.Kt("version ",e.v,this.ee),e.v&&e.v===this.ee?t(e):this.ha().then((e=>{vt("cfg",e),t(e)})))}),(()=>{this.ha().then((e=>{t(e)}))}))}))}la(){const e=Object.create(null);let i=!1;return this.te("instant")&&(i=!0),e[96]||(e[96]=new _t(this,{qm:t.S.I,s:t.S.P,k:t.S.C,i:96,li:3,t:i?0:1,tt:40,tnb:!0})),e[97]||(e[97]=new _t(this,{qm:!1,s:t.S.P,k:t.S.C,i:97,li:0,t:0,tt:40,tnb:!0})),e[98]||(e[98]=new _t(this,{qm:t.S.I,s:t.S.P,k:t.S.C,i:98,li:0,t:0,tt:40})),e[99]||(e[99]=new _t(this,{qm:t.S.I,s:t.S.P,k:t.S.C,i:99,li:t.S.M,t:i?0:2,tt:t.S.N})),e}wn(t){this.Co=[];let e=[],i=Object.create(null);if(t.length>0){t.length;const s=t.pop();if(void 0!==s){let r=!0;Array.isArray(s)?(e=s,e.forEach((t=>{i[t.k]=new _t(this,t)}))):(r=!1,t.push(s),i=this.la());let n=!1;["1df87ed4cf6031aeaeaa88e2feda833e","5e4f15a16887f0508d7196d442cde380","b3b1f44e01f27c6542a042d1f42a1e0e","be7a7e3b53d3fa794059913200ac9937","5586f5d247b6b36c6e014ac806915cd0","c08f148a2946aa18dbe8232c34dd6a2a","c6d0b84e9249f59bd090711e8b86cee2","0a1b13d43219008c240f0a3f69c73170","6e5763140936667ba6da84a2d20640a8","e53aaedbe9146fc985b28a4db43e33c0"].includes(this.dh)&&(n=!0),t.forEach((t=>{if(r&&t.pa)i[t.pa].Vh.push(t);else if([379,384,385,386,56].includes(t.id))i[97].Vh.push(t);else if([355,337,252,287,174,353,98].includes(t.id))i[98].Vh.push(t);else{let e=!1;"preloader"!==this.Mo&&!this.te("relFrame")&&t.ff&&(e=!0),e?i[96].Vh.push(t):i[99].Vh.push(t)}}))}}else i=this.la(),this.jo=!0,this.Kt("Empty jmap");if(this.te("debug")||this.te("showLog"))for(const t in i){console.log("Block",t);const e=[];i[t].Vh.forEach((t=>{e.push({pos:t.pos,adsrc:t.adsrc})})),console.table(e)}for(const t in i)0!==i[t].Vh.length&&this.Co.push(i[t]);return i=null,this.Co.length>0&&this.ct(),this}na(){return this.Fh||(this.Fh=!0,this.Kt("Блоки закончились, перезагрузка"),this.jt()),this}Xt(){return this.xo}ct(){this.xo&&(this.xo.jt(),this.xo=null),this.ca()||(this.yo=!0,this.na())}uo(){this.xo&&!this.xo.Fh&&this.xo.uo()}Zh(t,e,i){switch(e.includes("timeupdate")||this.Kt("Listener",e),this.ua(),e){case g.Yi:break;case"intervention":this.na()}}jt(){this.gr.abort(),window.removeEventListener(this.$o,this.Yo,!1);const t=navigator.connection||navigator.mozConnection||navigator.webkitConnection;this.gr=null,t&&navigator.connection.removeEventListener("change",this.Xo,!1),this.Uo&&(URL.revokeObjectURL(this.Uo),this.Uo=null),this.Wr&&(URL.revokeObjectURL(this.Wr),this.Wr=null),null!==this.Io&&(this.Io.remove(),this.Io=null),null!==this.Vo&&(this.Vo.unobserve(this.ie().Dt()),this.Vo=null),this.Kt("Закончил работу"),this.ie().Ot("movieads_reload"),this.vo?.jt(),this.Do=null,this.Bo=null}Kt(...t){if(this.te("debug")||this.te("showLog")){const e=Array.prototype.slice.call(t),i=["%cMANAGER","background-color: blue; color: white;font-weight: bold;padding:1px 3px;border-radius: 3px;margin-right: 7px;"].concat(e);console.log.apply(console,i)}}sn(){return null===this.xo||this.xo.I()?this.zo:1}da(){return this.Uo}Mn(){return this.Oo}Vn(){return this.Fo}Tr(){return this._o}mn(){return this.ko}Fn(){return this.Po}Li(){return this.No}cn(){return this.Ao}ie(){return this.vo}Jh=()=>{let t=2,e=0;navigator.hardwareConcurrency&&(t=navigator.hardwareConcurrency,t=Math.round(.5*t),this.te("relFrame")||t>4&&(t=4));const i=navigator.connection||navigator.mozConnection||navigator.webkitConnection;if(i&&i.downlink&&(e=Math.round(i.downlink),this.Ko.includes(e)||this.Ko.push(e)),e>0){const i=t=>t.reduce(((t,e)=>t+e),0)/t.length;e=Math.round(.5*i(this.Ko)),this.zo=Math.round((t+e)/2),this.zo>=t&&(this.zo=t)}else this.zo=t;v.Ns()&&this.zo--,this.zo<1&&(this.zo=1,this.Kt("dynamic Fix one")),this.Kt("dynamic Network","CPU",t,"Network",e,this.Ko,"max stages ",this.zo)};ua(){((new Date).getTime()-this.Ho.getTime())/1e3>=1&&(this.ie().Ot("mads_ping"),this.Ho=new Date)}aa(t){const e=t.split(","),i=e[0].match(/:(.*?);/)[1];return new Blob([atob(e[1])],{type:i})}_a=()=>{this.Po=!1};Yo=()=>{if(document[this.To]){this.Kt("checkCanPlayVideo Hidden",document.visibilityState),null!==this.Io&&(this.Io.removeEventListener("stalled",this._a),this.Io.remove(),this.Io=null),this.Io=document.createElement("video"),this.Io.setAttribute("muted","true"),this.Io.setAttribute("volume","0"),this.Io.setAttribute("src",this.oa("bv")),this.Io.style.display="none",this.Io.addEventListener("stalled",this._a),document.body.appendChild(this.Io);const t=this.Io.play();void 0!==t?t.then((()=>{this.Kt("checkCanPlayVideo Запустился"),this.Eo=0,this.Po=!0,this.xo&&!this.xo.Fh?this.xo.Yh(!0):this.ct()})).catch((t=>{this.Kt("checkCanPlayVideo Нет запуска"),this.Eo=(new Date).getTime(),this.Po=!1})):(this.Eo=(new Date).getTime(),this.Po=!1,this.Kt("checkCanPlayVideo Wtf"))}else if(this.Kt("checkCanPlayVideo Visible",this.Po),!this.Po){this.Po=!0;const t=this.Eo,e=((new Date).getTime()-t)/1e3;this.Kt("checkCanPlayVideo Time",e),e>60?(this.Kt("checkCanPlayVideo restart"),this.xo&&!this.xo.Fh?(this.xo.Yh(!0),this.jt()):this.jt()):this.xo&&!this.xo.Fh?this.xo._t():this.ct()}};ca(){return this.xo=null,this.Co.some((t=>{if(!t.On)return this.xo=t,this.xo.wn(),this})),this.xo}Go(){"undefined"!=typeof IntersectionObserver&&(this.Vo=new IntersectionObserver((t=>{for(const e in t){const i=t[e];"NaN"!==Math.floor(100*i.intersectionRatio).toString()&&(this.No=Math.floor(100*i.intersectionRatio),this.Kt("VIS",this.No))}}),{threshold:[...Array(20).keys()].map((t=>(t+1)/20)),trackVisibility:!0,delay:100}),this.Vo.observe(this.ie().Dt()))}}let bt=null;function At(t){for(const e of t)window.parent.postMessage("movieads_no_more_ads","*"),navigator.sendBeacon("*",e)}const kt=t=>{At(bt.takeRecords())};function Rt(){window.setTimeout((()=>{console.log("restart"),window.parent.postMessage("movieads_no_more_ads","*")}),0)}window.ReportingObserver&&(bt=new ReportingObserver((t=>{window.parent.postMessage("movieads_no_more_ads","*"),At(t)}),{types:["intervention"],buffered:!0}),bt.observe(),window.addEventListener("pagehide",kt,!1));let St=new class{At;constructor(){window.parent!==window.top&&console.log("YES"),this.At=new yt,window.madsConfig&&(this.At.Qo(window.madsConfig),this.At.ie()?.ot().addEventListener(this.At.Ht,this.Lr,!1),this.At.ea())}Lr=t=>{null!==t&&t.detail&&t.detail[this.At.Bt]&&(window.parent.postMessage(t.detail[this.At.Bt],"*"),"movieads_reload"===t.detail[this.At.Bt]&&this.jt())};jt(){this.At.ie()?.ot().removeEventListener(this.At.Ht,this.Lr,!1),window.setTimeout((()=>{!function(t){St=null,null!==bt&&(window.removeEventListener("pagehide",kt,!1),bt.disconnect(),bt=null);window.dispatchEvent(new Event("kill_pl")),t.debug?window.setInterval((()=>{window.parent.postMessage("mads_ping","*")}),15e3):(t.showLog,t.instant?window.setTimeout((()=>{Rt()}),15e3):Rt());window.setTimeout((()=>{}),0)}({debug:this.At.te("debug"),showLog:this.At.te("showLog"),instant:this.At.te("instant"),relFrame:this.At.te("relFrame")})}))}}})();