@vkontakte/videoplayer-statistics 1.0.83-dev.c0e6f99b.0 → 1.0.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esnext.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-statistics v1.0.83-dev.c0e6f99b.0
3
- * Tue, 05 Aug 2025 09:57:25 GMT
2
+ * @vkontakte/videoplayer-statistics v1.0.83
3
+ * Tue, 05 Aug 2025 13:54:03 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-83/doc/
5
5
  */
6
- "use strict";var Cd=Object.create;var st=Object.defineProperty;var kd=Object.getOwnPropertyDescriptor;var Ld=Object.getOwnPropertyNames;var Nd=Object.getPrototypeOf,Dd=Object.prototype.hasOwnProperty;var a=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Eo=(t,e)=>{for(var r in e)st(t,r,{get:e[r],enumerable:!0})},To=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ld(e))!Dd.call(t,o)&&o!==r&&st(t,o,{get:()=>e[o],enumerable:!(i=kd(e,o))||i.enumerable});return t};var A=(t,e,r)=>(r=t!=null?Cd(Nd(t)):{},To(e||!t||!t.__esModule?st(r,"default",{value:t,enumerable:!0}):r,t)),$d=t=>To(st({},"__esModule",{value:!0}),t);var w=a((fr,wo)=>{"use strict";var Ne=function(t){return t&&t.Math===Math&&t};wo.exports=Ne(typeof globalThis=="object"&&globalThis)||Ne(typeof window=="object"&&window)||Ne(typeof self=="object"&&self)||Ne(typeof global=="object"&&global)||Ne(typeof fr=="object"&&fr)||function(){return this}()||Function("return this")()});var q=a((Wy,Oo)=>{"use strict";Oo.exports=function(t){try{return!!t()}catch{return!0}}});var De=a((Hy,xo)=>{"use strict";var Md=q();xo.exports=!Md(function(){var t=function(){}.bind();return typeof t!="function"||t.hasOwnProperty("prototype")})});var pr=a((Ky,Co)=>{"use strict";var Vd=De(),Ro=Function.prototype,Ao=Ro.apply,qo=Ro.call;Co.exports=typeof Reflect=="object"&&Reflect.apply||(Vd?qo.bind(Ao):function(){return qo.apply(Ao,arguments)})});var R=a((Gy,No)=>{"use strict";var ko=De(),Lo=Function.prototype,hr=Lo.call,Fd=ko&&Lo.bind.bind(hr,hr);No.exports=ko?Fd:function(t){return function(){return hr.apply(t,arguments)}}});var $e=a((zy,$o)=>{"use strict";var Do=R(),Ud=Do({}.toString),Bd=Do("".slice);$o.exports=function(t){return Bd(Ud(t),8,-1)}});var vr=a((Qy,Mo)=>{"use strict";var jd=$e(),Wd=R();Mo.exports=function(t){if(jd(t)==="Function")return Wd(t)}});var O=a((Yy,Vo)=>{"use strict";var gr=typeof document=="object"&&document.all;Vo.exports=typeof gr>"u"&&gr!==void 0?function(t){return typeof t=="function"||t===gr}:function(t){return typeof t=="function"}});var L=a((Jy,Fo)=>{"use strict";var Hd=q();Fo.exports=!Hd(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var F=a((Xy,Uo)=>{"use strict";var Kd=De(),ut=Function.prototype.call;Uo.exports=Kd?ut.bind(ut):function(){return ut.apply(ut,arguments)}});var mr=a(Wo=>{"use strict";var Bo={}.propertyIsEnumerable,jo=Object.getOwnPropertyDescriptor,Gd=jo&&!Bo.call({1:2},1);Wo.f=Gd?function(e){var r=jo(this,e);return!!r&&r.enumerable}:Bo});var Me=a((eI,Ho)=>{"use strict";Ho.exports=function(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}}});var Go=a((tI,Ko)=>{"use strict";var zd=R(),Qd=q(),Yd=$e(),br=Object,Jd=zd("".split);Ko.exports=Qd(function(){return!br("z").propertyIsEnumerable(0)})?function(t){return Yd(t)==="String"?Jd(t,""):br(t)}:br});var Ve=a((rI,zo)=>{"use strict";zo.exports=function(t){return t==null}});var ve=a((iI,Qo)=>{"use strict";var Xd=Ve(),Zd=TypeError;Qo.exports=function(t){if(Xd(t))throw new Zd("Can't call method on "+t);return t}});var ne=a((oI,Yo)=>{"use strict";var ef=Go(),tf=ve();Yo.exports=function(t){return ef(tf(t))}});var U=a((nI,Jo)=>{"use strict";var rf=O();Jo.exports=function(t){return typeof t=="object"?t!==null:rf(t)}});var ge=a((aI,Xo)=>{"use strict";Xo.exports={}});var J=a((sI,en)=>{"use strict";var yr=ge(),Ir=w(),of=O(),Zo=function(t){return of(t)?t:void 0};en.exports=function(t,e){return arguments.length<2?Zo(yr[t])||Zo(Ir[t]):yr[t]&&yr[t][e]||Ir[t]&&Ir[t][e]}});var ct=a((uI,tn)=>{"use strict";var nf=R();tn.exports=nf({}.isPrototypeOf)});var ae=a((cI,nn)=>{"use strict";var af=w(),rn=af.navigator,on=rn&&rn.userAgent;nn.exports=on?String(on):""});var _r=a((lI,dn)=>{"use strict";var ln=w(),Sr=ae(),an=ln.process,sn=ln.Deno,un=an&&an.versions||sn&&sn.version,cn=un&&un.v8,B,lt;cn&&(B=cn.split("."),lt=B[0]>0&&B[0]<4?1:+(B[0]+B[1]));!lt&&Sr&&(B=Sr.match(/Edge\/(\d+)/),(!B||B[1]>=74)&&(B=Sr.match(/Chrome\/(\d+)/),B&&(lt=+B[1])));dn.exports=lt});var Pr=a((dI,pn)=>{"use strict";var fn=_r(),sf=q(),uf=w(),cf=uf.String;pn.exports=!!Object.getOwnPropertySymbols&&!sf(function(){var t=Symbol("symbol detection");return!cf(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&fn&&fn<41})});var Er=a((fI,hn)=>{"use strict";var lf=Pr();hn.exports=lf&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Tr=a((pI,vn)=>{"use strict";var df=J(),ff=O(),pf=ct(),hf=Er(),vf=Object;vn.exports=hf?function(t){return typeof t=="symbol"}:function(t){var e=df("Symbol");return ff(e)&&pf(e.prototype,vf(t))}});var Fe=a((hI,gn)=>{"use strict";var gf=String;gn.exports=function(t){try{return gf(t)}catch{return"Object"}}});var X=a((vI,mn)=>{"use strict";var mf=O(),bf=Fe(),yf=TypeError;mn.exports=function(t){if(mf(t))return t;throw new yf(bf(t)+" is not a function")}});var dt=a((gI,bn)=>{"use strict";var If=X(),Sf=Ve();bn.exports=function(t,e){var r=t[e];return Sf(r)?void 0:If(r)}});var In=a((mI,yn)=>{"use strict";var wr=F(),Or=O(),xr=U(),_f=TypeError;yn.exports=function(t,e){var r,i;if(e==="string"&&Or(r=t.toString)&&!xr(i=wr(r,t))||Or(r=t.valueOf)&&!xr(i=wr(r,t))||e!=="string"&&Or(r=t.toString)&&!xr(i=wr(r,t)))return i;throw new _f("Can't convert object to primitive value")}});var G=a((bI,Sn)=>{"use strict";Sn.exports=!0});var En=a((yI,Pn)=>{"use strict";var _n=w(),Pf=Object.defineProperty;Pn.exports=function(t,e){try{Pf(_n,t,{value:e,configurable:!0,writable:!0})}catch{_n[t]=e}return e}});var Ue=a((II,On)=>{"use strict";var Ef=G(),Tf=w(),wf=En(),Tn="__core-js_shared__",wn=On.exports=Tf[Tn]||wf(Tn,{});(wn.versions||(wn.versions=[])).push({version:"3.43.0",mode:Ef?"pure":"global",copyright:"\xA9 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.43.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var Ar=a((SI,An)=>{"use strict";var xn=Ue();An.exports=function(t,e){return xn[t]||(xn[t]=e||{})}});var qr=a((_I,qn)=>{"use strict";var Of=ve(),xf=Object;qn.exports=function(t){return xf(Of(t))}});var z=a((PI,Rn)=>{"use strict";var Af=R(),qf=qr(),Rf=Af({}.hasOwnProperty);Rn.exports=Object.hasOwn||function(e,r){return Rf(qf(e),r)}});var Rr=a((EI,Cn)=>{"use strict";var Cf=R(),kf=0,Lf=Math.random(),Nf=Cf(1.1.toString);Cn.exports=function(t){return"Symbol("+(t===void 0?"":t)+")_"+Nf(++kf+Lf,36)}});var N=a((TI,Ln)=>{"use strict";var Df=w(),$f=Ar(),kn=z(),Mf=Rr(),Vf=Pr(),Ff=Er(),me=Df.Symbol,Cr=$f("wks"),Uf=Ff?me.for||me:me&&me.withoutSetter||Mf;Ln.exports=function(t){return kn(Cr,t)||(Cr[t]=Vf&&kn(me,t)?me[t]:Uf("Symbol."+t)),Cr[t]}});var Mn=a((wI,$n)=>{"use strict";var Bf=F(),Nn=U(),Dn=Tr(),jf=dt(),Wf=In(),Hf=N(),Kf=TypeError,Gf=Hf("toPrimitive");$n.exports=function(t,e){if(!Nn(t)||Dn(t))return t;var r=jf(t,Gf),i;if(r){if(e===void 0&&(e="default"),i=Bf(r,t,e),!Nn(i)||Dn(i))return i;throw new Kf("Can't convert object to primitive value")}return e===void 0&&(e="number"),Wf(t,e)}});var kr=a((OI,Vn)=>{"use strict";var zf=Mn(),Qf=Tr();Vn.exports=function(t){var e=zf(t,"string");return Qf(e)?e:e+""}});var ft=a((xI,Un)=>{"use strict";var Yf=w(),Fn=U(),Lr=Yf.document,Jf=Fn(Lr)&&Fn(Lr.createElement);Un.exports=function(t){return Jf?Lr.createElement(t):{}}});var Nr=a((AI,Bn)=>{"use strict";var Xf=L(),Zf=q(),ep=ft();Bn.exports=!Xf&&!Zf(function(){return Object.defineProperty(ep("div"),"a",{get:function(){return 7}}).a!==7})});var Hn=a(Wn=>{"use strict";var tp=L(),rp=F(),ip=mr(),op=Me(),np=ne(),ap=kr(),sp=z(),up=Nr(),jn=Object.getOwnPropertyDescriptor;Wn.f=tp?jn:function(e,r){if(e=np(e),r=ap(r),up)try{return jn(e,r)}catch{}if(sp(e,r))return op(!rp(ip.f,e,r),e[r])}});var Dr=a((RI,Kn)=>{"use strict";var cp=q(),lp=O(),dp=/#|\.prototype\./,Be=function(t,e){var r=pp[fp(t)];return r===vp?!0:r===hp?!1:lp(e)?cp(e):!!e},fp=Be.normalize=function(t){return String(t).replace(dp,".").toLowerCase()},pp=Be.data={},hp=Be.NATIVE="N",vp=Be.POLYFILL="P";Kn.exports=Be});var je=a((CI,zn)=>{"use strict";var Gn=vr(),gp=X(),mp=De(),bp=Gn(Gn.bind);zn.exports=function(t,e){return gp(t),e===void 0?t:mp?bp(t,e):function(){return t.apply(e,arguments)}}});var $r=a((kI,Qn)=>{"use strict";var yp=L(),Ip=q();Qn.exports=yp&&Ip(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var Z=a((LI,Yn)=>{"use strict";var Sp=U(),_p=String,Pp=TypeError;Yn.exports=function(t){if(Sp(t))return t;throw new Pp(_p(t)+" is not an object")}});var se=a(Xn=>{"use strict";var Ep=L(),Tp=Nr(),wp=$r(),pt=Z(),Jn=kr(),Op=TypeError,Mr=Object.defineProperty,xp=Object.getOwnPropertyDescriptor,Vr="enumerable",Fr="configurable",Ur="writable";Xn.f=Ep?wp?function(e,r,i){if(pt(e),r=Jn(r),pt(i),typeof e=="function"&&r==="prototype"&&"value"in i&&Ur in i&&!i[Ur]){var o=xp(e,r);o&&o[Ur]&&(e[r]=i.value,i={configurable:Fr in i?i[Fr]:o[Fr],enumerable:Vr in i?i[Vr]:o[Vr],writable:!1})}return Mr(e,r,i)}:Mr:function(e,r,i){if(pt(e),r=Jn(r),pt(i),Tp)try{return Mr(e,r,i)}catch{}if("get"in i||"set"in i)throw new Op("Accessors not supported");return"value"in i&&(e[r]=i.value),e}});var be=a((DI,Zn)=>{"use strict";var Ap=L(),qp=se(),Rp=Me();Zn.exports=Ap?function(t,e,r){return qp.f(t,e,Rp(1,r))}:function(t,e,r){return t[e]=r,t}});var D=a(($I,ta)=>{"use strict";var We=w(),Cp=pr(),kp=vr(),Lp=O(),Np=Hn().f,Dp=Dr(),ye=ge(),$p=je(),Ie=be(),ea=z();Ue();var Mp=function(t){var e=function(r,i,o){if(this instanceof e){switch(arguments.length){case 0:return new t;case 1:return new t(r);case 2:return new t(r,i)}return new t(r,i,o)}return Cp(t,this,arguments)};return e.prototype=t.prototype,e};ta.exports=function(t,e){var r=t.target,i=t.global,o=t.stat,n=t.proto,s=i?We:o?We[r]:We[r]&&We[r].prototype,u=i?ye:ye[r]||Ie(ye,r,{})[r],d=u.prototype,l,p,h,c,f,g,y,S,I;for(c in e)l=Dp(i?c:r+(o?".":"#")+c,t.forced),p=!l&&s&&ea(s,c),g=u[c],p&&(t.dontCallGetSet?(I=Np(s,c),y=I&&I.value):y=s[c]),f=p&&y?y:e[c],!(!l&&!n&&typeof g==typeof f)&&(t.bind&&p?S=$p(f,We):t.wrap&&p?S=Mp(f):n&&Lp(f)?S=kp(f):S=f,(t.sham||f&&f.sham||g&&g.sham)&&Ie(S,"sham",!0),Ie(u,c,S),n&&(h=r+"Prototype",ea(ye,h)||Ie(ye,h,{}),Ie(ye[h],c,f),t.real&&d&&(l||!d[c])&&Ie(d,c,f)))}});var ia=a((MI,ra)=>{"use strict";var Vp=Math.ceil,Fp=Math.floor;ra.exports=Math.trunc||function(e){var r=+e;return(r>0?Fp:Vp)(r)}});var ht=a((VI,oa)=>{"use strict";var Up=ia();oa.exports=function(t){var e=+t;return e!==e||e===0?0:Up(e)}});var aa=a((FI,na)=>{"use strict";var Bp=ht(),jp=Math.max,Wp=Math.min;na.exports=function(t,e){var r=Bp(t);return r<0?jp(r+e,0):Wp(r,e)}});var Br=a((UI,sa)=>{"use strict";var Hp=ht(),Kp=Math.min;sa.exports=function(t){var e=Hp(t);return e>0?Kp(e,9007199254740991):0}});var jr=a((BI,ua)=>{"use strict";var Gp=Br();ua.exports=function(t){return Gp(t.length)}});var Wr=a((jI,la)=>{"use strict";var zp=ne(),Qp=aa(),Yp=jr(),ca=function(t){return function(e,r,i){var o=zp(e),n=Yp(o);if(n===0)return!t&&-1;var s=Qp(i,n),u;if(t&&r!==r){for(;n>s;)if(u=o[s++],u!==u)return!0}else for(;n>s;s++)if((t||s in o)&&o[s]===r)return t||s||0;return!t&&-1}};la.exports={includes:ca(!0),indexOf:ca(!1)}});var Hr=a((WI,da)=>{"use strict";da.exports=function(){}});var fa=a(()=>{"use strict";var Jp=D(),Xp=Wr().includes,Zp=q(),eh=Hr(),th=Zp(function(){return!Array(1).includes()});Jp({target:"Array",proto:!0,forced:th},{includes:function(e){return Xp(this,e,arguments.length>1?arguments[1]:void 0)}});eh("includes")});var vt=a((GI,pa)=>{"use strict";var rh=J();pa.exports=rh});var va=a((zI,ha)=>{"use strict";fa();var ih=vt();ha.exports=ih("Array","includes")});var ma=a((QI,ga)=>{"use strict";var oh=va();ga.exports=oh});var Se=a((YI,ba)=>{"use strict";var nh=ma();ba.exports=nh});var wa=a(()=>{"use strict"});var Qr=a((uS,Oa)=>{"use strict";var He=w(),sh=ae(),uh=$e(),It=function(t){return sh.slice(0,t.length)===t};Oa.exports=function(){return It("Bun/")?"BUN":It("Cloudflare-Workers")?"CLOUDFLARE":It("Deno/")?"DENO":It("Node.js/")?"NODE":He.Bun&&typeof Bun.version=="string"?"BUN":He.Deno&&typeof Deno.version=="object"?"DENO":uh(He.process)==="process"?"NODE":He.window&&He.document?"BROWSER":"REST"}()});var St=a((cS,xa)=>{"use strict";var ch=Qr();xa.exports=ch==="NODE"});var Pe=a((lS,Aa)=>{"use strict";var lh=be();Aa.exports=function(t,e,r,i){return i&&i.enumerable?t[e]=r:lh(t,e,r),t}});var Ra=a((dS,qa)=>{"use strict";var dh=R(),fh=X();qa.exports=function(t,e,r){try{return dh(fh(Object.getOwnPropertyDescriptor(t,e)[r]))}catch{}}});var ka=a((fS,Ca)=>{"use strict";var ph=U();Ca.exports=function(t){return ph(t)||t===null}});var Na=a((pS,La)=>{"use strict";var hh=ka(),vh=String,gh=TypeError;La.exports=function(t){if(hh(t))return t;throw new gh("Can't set "+vh(t)+" as a prototype")}});var Yr=a((hS,Da)=>{"use strict";var mh=Ra(),bh=U(),yh=ve(),Ih=Na();Da.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t=!1,e={},r;try{r=mh(Object.prototype,"__proto__","set"),r(e,[]),t=e instanceof Array}catch{}return function(o,n){return yh(o),Ih(n),bh(o)&&(t?r(o,n):o.__proto__=n),o}}():void 0)});var _t=a((vS,Ma)=>{"use strict";var Sh=N(),_h=Sh("toStringTag"),$a={};$a[_h]="z";Ma.exports=String($a)==="[object z]"});var Ke=a((gS,Va)=>{"use strict";var Ph=_t(),Eh=O(),Pt=$e(),Th=N(),wh=Th("toStringTag"),Oh=Object,xh=Pt(function(){return arguments}())==="Arguments",Ah=function(t,e){try{return t[e]}catch{}};Va.exports=Ph?Pt:function(t){var e,r,i;return t===void 0?"Undefined":t===null?"Null":typeof(r=Ah(e=Oh(t),wh))=="string"?r:xh?Pt(e):(i=Pt(e))==="Object"&&Eh(e.callee)?"Arguments":i}});var Ua=a((mS,Fa)=>{"use strict";var qh=_t(),Rh=Ke();Fa.exports=qh?{}.toString:function(){return"[object "+Rh(this)+"]"}});var Ge=a((bS,ja)=>{"use strict";var Ch=_t(),kh=se().f,Lh=be(),Nh=z(),Dh=Ua(),$h=N(),Ba=$h("toStringTag");ja.exports=function(t,e,r,i){var o=r?t:t&&t.prototype;o&&(Nh(o,Ba)||kh(o,Ba,{configurable:!0,value:e}),i&&!Ch&&Lh(o,"toString",Dh))}});var Ha=a((yS,Wa)=>{"use strict";var Mh=se();Wa.exports=function(t,e,r){return Mh.f(t,e,r)}});var za=a((IS,Ga)=>{"use strict";var Vh=J(),Fh=Ha(),Uh=N(),Bh=L(),Ka=Uh("species");Ga.exports=function(t){var e=Vh(t);Bh&&e&&!e[Ka]&&Fh(e,Ka,{configurable:!0,get:function(){return this}})}});var Ya=a((SS,Qa)=>{"use strict";var jh=ct(),Wh=TypeError;Qa.exports=function(t,e){if(jh(e,t))return t;throw new Wh("Incorrect invocation")}});var Xr=a((_S,Ja)=>{"use strict";var Hh=R(),Kh=O(),Jr=Ue(),Gh=Hh(Function.toString);Kh(Jr.inspectSource)||(Jr.inspectSource=function(t){return Gh(t)});Ja.exports=Jr.inspectSource});var is=a((PS,rs)=>{"use strict";var zh=R(),Qh=q(),Xa=O(),Yh=Ke(),Jh=J(),Xh=Xr(),Za=function(){},es=Jh("Reflect","construct"),Zr=/^\s*(?:class|function)\b/,Zh=zh(Zr.exec),ev=!Zr.test(Za),ze=function(e){if(!Xa(e))return!1;try{return es(Za,[],e),!0}catch{return!1}},ts=function(e){if(!Xa(e))return!1;switch(Yh(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ev||!!Zh(Zr,Xh(e))}catch{return!0}};ts.sham=!0;rs.exports=!es||Qh(function(){var t;return ze(ze.call)||!ze(Object)||!ze(function(){t=!0})||t})?ts:ze});var ns=a((ES,os)=>{"use strict";var tv=is(),rv=Fe(),iv=TypeError;os.exports=function(t){if(tv(t))return t;throw new iv(rv(t)+" is not a constructor")}});var ei=a((TS,ss)=>{"use strict";var as=Z(),ov=ns(),nv=Ve(),av=N(),sv=av("species");ss.exports=function(t,e){var r=as(t).constructor,i;return r===void 0||nv(i=as(r)[sv])?e:ov(i)}});var ti=a((wS,us)=>{"use strict";var uv=J();us.exports=uv("document","documentElement")});var ls=a((OS,cs)=>{"use strict";var cv=R();cs.exports=cv([].slice)});var fs=a((xS,ds)=>{"use strict";var lv=TypeError;ds.exports=function(t,e){if(t<e)throw new lv("Not enough arguments");return t}});var ri=a((AS,ps)=>{"use strict";var dv=ae();ps.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(dv)});var di=a((qS,_s)=>{"use strict";var $=w(),fv=pr(),pv=je(),hs=O(),hv=z(),Ss=q(),vs=ti(),vv=ls(),gs=ft(),gv=fs(),mv=ri(),bv=St(),ui=$.setImmediate,ci=$.clearImmediate,yv=$.process,ii=$.Dispatch,Iv=$.Function,ms=$.MessageChannel,Sv=$.String,oi=0,Qe={},bs="onreadystatechange",Ye,ue,ni,ai;Ss(function(){Ye=$.location});var li=function(t){if(hv(Qe,t)){var e=Qe[t];delete Qe[t],e()}},si=function(t){return function(){li(t)}},ys=function(t){li(t.data)},Is=function(t){$.postMessage(Sv(t),Ye.protocol+"//"+Ye.host)};(!ui||!ci)&&(ui=function(e){gv(arguments.length,1);var r=hs(e)?e:Iv(e),i=vv(arguments,1);return Qe[++oi]=function(){fv(r,void 0,i)},ue(oi),oi},ci=function(e){delete Qe[e]},bv?ue=function(t){yv.nextTick(si(t))}:ii&&ii.now?ue=function(t){ii.now(si(t))}:ms&&!mv?(ni=new ms,ai=ni.port2,ni.port1.onmessage=ys,ue=pv(ai.postMessage,ai)):$.addEventListener&&hs($.postMessage)&&!$.importScripts&&Ye&&Ye.protocol!=="file:"&&!Ss(Is)?(ue=Is,$.addEventListener("message",ys,!1)):bs in gs("script")?ue=function(t){vs.appendChild(gs("script"))[bs]=function(){vs.removeChild(this),li(t)}}:ue=function(t){setTimeout(si(t),0)});_s.exports={set:ui,clear:ci}});var Ts=a((RS,Es)=>{"use strict";var Ps=w(),_v=L(),Pv=Object.getOwnPropertyDescriptor;Es.exports=function(t){if(!_v)return Ps[t];var e=Pv(Ps,t);return e&&e.value}});var fi=a((CS,Os)=>{"use strict";var ws=function(){this.head=null,this.tail=null};ws.prototype={add:function(t){var e={item:t,next:null},r=this.tail;r?r.next=e:this.head=e,this.tail=e},get:function(){var t=this.head;if(t){var e=this.head=t.next;return e===null&&(this.tail=null),t.item}}};Os.exports=ws});var As=a((kS,xs)=>{"use strict";var Ev=ae();xs.exports=/ipad|iphone|ipod/i.test(Ev)&&typeof Pebble<"u"});var Rs=a((LS,qs)=>{"use strict";var Tv=ae();qs.exports=/web0s(?!.*chrome)/i.test(Tv)});var Ms=a((NS,$s)=>{"use strict";var Te=w(),wv=Ts(),Cs=je(),pi=di().set,Ov=fi(),xv=ri(),Av=As(),qv=Rs(),hi=St(),ks=Te.MutationObserver||Te.WebKitMutationObserver,Ls=Te.document,Ns=Te.process,Et=Te.Promise,mi=wv("queueMicrotask"),Ee,vi,gi,Tt,Ds;mi||(Je=new Ov,Xe=function(){var t,e;for(hi&&(t=Ns.domain)&&t.exit();e=Je.get();)try{e()}catch(r){throw Je.head&&Ee(),r}t&&t.enter()},!xv&&!hi&&!qv&&ks&&Ls?(vi=!0,gi=Ls.createTextNode(""),new ks(Xe).observe(gi,{characterData:!0}),Ee=function(){gi.data=vi=!vi}):!Av&&Et&&Et.resolve?(Tt=Et.resolve(void 0),Tt.constructor=Et,Ds=Cs(Tt.then,Tt),Ee=function(){Ds(Xe)}):hi?Ee=function(){Ns.nextTick(Xe)}:(pi=Cs(pi,Te),Ee=function(){pi(Xe)}),mi=function(t){Je.head||Ee(),Je.add(t)});var Je,Xe;$s.exports=mi});var Fs=a((DS,Vs)=>{"use strict";Vs.exports=function(t,e){try{arguments.length===1?console.error(t):console.error(t,e)}catch{}}});var wt=a(($S,Us)=>{"use strict";Us.exports=function(t){try{return{error:!1,value:t()}}catch(e){return{error:!0,value:e}}}});var Ws=a((MS,js)=>{"use strict";var Rv=w(),Cv=O(),Bs=Rv.WeakMap;js.exports=Cv(Bs)&&/native code/.test(String(Bs))});var Ot=a((VS,Ks)=>{"use strict";var kv=Ar(),Lv=Rr(),Hs=kv("keys");Ks.exports=function(t){return Hs[t]||(Hs[t]=Lv(t))}});var xt=a((FS,Gs)=>{"use strict";Gs.exports={}});var Si=a((US,Ys)=>{"use strict";var Nv=Ws(),Qs=w(),Dv=U(),$v=be(),bi=z(),yi=Ue(),Mv=Ot(),Vv=xt(),zs="Object already initialized",Ii=Qs.TypeError,Fv=Qs.WeakMap,At,Ze,qt,Uv=function(t){return qt(t)?Ze(t):At(t,{})},Bv=function(t){return function(e){var r;if(!Dv(e)||(r=Ze(e)).type!==t)throw new Ii("Incompatible receiver, "+t+" required");return r}};Nv||yi.state?(j=yi.state||(yi.state=new Fv),j.get=j.get,j.has=j.has,j.set=j.set,At=function(t,e){if(j.has(t))throw new Ii(zs);return e.facade=t,j.set(t,e),e},Ze=function(t){return j.get(t)||{}},qt=function(t){return j.has(t)}):(ce=Mv("state"),Vv[ce]=!0,At=function(t,e){if(bi(t,ce))throw new Ii(zs);return e.facade=t,$v(t,ce,e),e},Ze=function(t){return bi(t,ce)?t[ce]:{}},qt=function(t){return bi(t,ce)});var j,ce;Ys.exports={set:At,get:Ze,has:qt,enforce:Uv,getterFor:Bv}});var le=a((BS,Js)=>{"use strict";var jv=w();Js.exports=jv.Promise});var we=a((jS,tu)=>{"use strict";var Wv=w(),et=le(),Hv=O(),Kv=Dr(),Gv=Xr(),zv=N(),Xs=Qr(),Qv=G(),_i=_r(),Zs=et&&et.prototype,Yv=zv("species"),Pi=!1,eu=Hv(Wv.PromiseRejectionEvent),Jv=Kv("Promise",function(){var t=Gv(et),e=t!==String(et);if(!e&&_i===66||Qv&&!(Zs.catch&&Zs.finally))return!0;if(!_i||_i<51||!/native code/.test(t)){var r=new et(function(n){n(1)}),i=function(n){n(function(){},function(){})},o=r.constructor={};if(o[Yv]=i,Pi=r.then(function(){})instanceof i,!Pi)return!0}return!e&&(Xs==="BROWSER"||Xs==="DENO")&&!eu});tu.exports={CONSTRUCTOR:Jv,REJECTION_EVENT:eu,SUBCLASSING:Pi}});var Oe=a((WS,iu)=>{"use strict";var ru=X(),Xv=TypeError,Zv=function(t){var e,r;this.promise=new t(function(i,o){if(e!==void 0||r!==void 0)throw new Xv("Bad Promise constructor");e=i,r=o}),this.resolve=ru(e),this.reject=ru(r)};iu.exports.f=function(t){return new Zv(t)}});var Pu=a(()=>{"use strict";var eg=D(),tg=G(),Lt=St(),ie=w(),rg=ge(),Re=F(),ou=Pe(),nu=Yr(),ig=Ge(),og=za(),ng=X(),kt=O(),ag=U(),sg=Ya(),ug=ei(),lu=di().set,xi=Ms(),cg=Fs(),lg=wt(),dg=fi(),du=Si(),Nt=le(),Ai=we(),fu=Oe(),Dt="Promise",pu=Ai.CONSTRUCTOR,fg=Ai.REJECTION_EVENT,pg=Ai.SUBCLASSING,Ei=du.getterFor(Dt),hg=du.set,xe=Nt&&Nt.prototype,de=Nt,Rt=xe,hu=ie.TypeError,Ti=ie.document,qi=ie.process,wi=fu.f,vg=wi,gg=!!(Ti&&Ti.createEvent&&ie.dispatchEvent),vu="unhandledrejection",mg="rejectionhandled",au=0,gu=1,bg=2,Ri=1,mu=2,Ct,su,bu,uu,yu=function(t){var e;return ag(t)&&kt(e=t.then)?e:!1},Iu=function(t,e){var r=e.value,i=e.state===gu,o=i?t.ok:t.fail,n=t.resolve,s=t.reject,u=t.domain,d,l,p;try{o?(i||(e.rejection===mu&&Ig(e),e.rejection=Ri),o===!0?d=r:(u&&u.enter(),d=o(r),u&&(u.exit(),p=!0)),d===t.promise?s(new hu("Promise-chain cycle")):(l=yu(d))?Re(l,d,n,s):n(d)):s(r)}catch(h){u&&!p&&u.exit(),s(h)}},Su=function(t,e){t.notified||(t.notified=!0,xi(function(){for(var r=t.reactions,i;i=r.get();)Iu(i,t);t.notified=!1,e&&!t.rejection&&yg(t)}))},_u=function(t,e,r){var i,o;gg?(i=Ti.createEvent("Event"),i.promise=e,i.reason=r,i.initEvent(t,!1,!0),ie.dispatchEvent(i)):i={promise:e,reason:r},!fg&&(o=ie["on"+t])?o(i):t===vu&&cg("Unhandled promise rejection",r)},yg=function(t){Re(lu,ie,function(){var e=t.facade,r=t.value,i=cu(t),o;if(i&&(o=lg(function(){Lt?qi.emit("unhandledRejection",r,e):_u(vu,e,r)}),t.rejection=Lt||cu(t)?mu:Ri,o.error))throw o.value})},cu=function(t){return t.rejection!==Ri&&!t.parent},Ig=function(t){Re(lu,ie,function(){var e=t.facade;Lt?qi.emit("rejectionHandled",e):_u(mg,e,t.value)})},Ae=function(t,e,r){return function(i){t(e,i,r)}},qe=function(t,e,r){t.done||(t.done=!0,r&&(t=r),t.value=e,t.state=bg,Su(t,!0))},Oi=function(t,e,r){if(!t.done){t.done=!0,r&&(t=r);try{if(t.facade===e)throw new hu("Promise can't be resolved itself");var i=yu(e);i?xi(function(){var o={done:!1};try{Re(i,e,Ae(Oi,o,t),Ae(qe,o,t))}catch(n){qe(o,n,t)}}):(t.value=e,t.state=gu,Su(t,!1))}catch(o){qe({done:!1},o,t)}}};if(pu&&(de=function(e){sg(this,Rt),ng(e),Re(Ct,this);var r=Ei(this);try{e(Ae(Oi,r),Ae(qe,r))}catch(i){qe(r,i)}},Rt=de.prototype,Ct=function(e){hg(this,{type:Dt,done:!1,notified:!1,parent:!1,reactions:new dg,rejection:!1,state:au,value:null})},Ct.prototype=ou(Rt,"then",function(e,r){var i=Ei(this),o=wi(ug(this,de));return i.parent=!0,o.ok=kt(e)?e:!0,o.fail=kt(r)&&r,o.domain=Lt?qi.domain:void 0,i.state===au?i.reactions.add(o):xi(function(){Iu(o,i)}),o.promise}),su=function(){var t=new Ct,e=Ei(t);this.promise=t,this.resolve=Ae(Oi,e),this.reject=Ae(qe,e)},fu.f=wi=function(t){return t===de||t===bu?new su(t):vg(t)},!tg&&kt(Nt)&&xe!==Object.prototype)){uu=xe.then,pg||ou(xe,"then",function(e,r){var i=this;return new de(function(o,n){Re(uu,i,o,n)}).then(e,r)},{unsafe:!0});try{delete xe.constructor}catch{}nu&&nu(xe,Rt)}eg({global:!0,constructor:!0,wrap:!0,forced:pu},{Promise:de});bu=rg.Promise;ig(de,Dt,!1,!0);og(Dt)});var fe=a((GS,Eu)=>{"use strict";Eu.exports={}});var wu=a((zS,Tu)=>{"use strict";var Sg=N(),_g=fe(),Pg=Sg("iterator"),Eg=Array.prototype;Tu.exports=function(t){return t!==void 0&&(_g.Array===t||Eg[Pg]===t)}});var Ci=a((QS,xu)=>{"use strict";var Tg=Ke(),Ou=dt(),wg=Ve(),Og=fe(),xg=N(),Ag=xg("iterator");xu.exports=function(t){if(!wg(t))return Ou(t,Ag)||Ou(t,"@@iterator")||Og[Tg(t)]}});var qu=a((YS,Au)=>{"use strict";var qg=F(),Rg=X(),Cg=Z(),kg=Fe(),Lg=Ci(),Ng=TypeError;Au.exports=function(t,e){var r=arguments.length<2?Lg(t):e;if(Rg(r))return Cg(qg(r,t));throw new Ng(kg(t)+" is not iterable")}});var ku=a((JS,Cu)=>{"use strict";var Dg=F(),Ru=Z(),$g=dt();Cu.exports=function(t,e,r){var i,o;Ru(t);try{if(i=$g(t,"return"),!i){if(e==="throw")throw r;return r}i=Dg(i,t)}catch(n){o=!0,i=n}if(e==="throw")throw r;if(o)throw i;return Ru(i),r}});var Mt=a((XS,$u)=>{"use strict";var Mg=je(),Vg=F(),Fg=Z(),Ug=Fe(),Bg=wu(),jg=jr(),Lu=ct(),Wg=qu(),Hg=Ci(),Nu=ku(),Kg=TypeError,$t=function(t,e){this.stopped=t,this.result=e},Du=$t.prototype;$u.exports=function(t,e,r){var i=r&&r.that,o=!!(r&&r.AS_ENTRIES),n=!!(r&&r.IS_RECORD),s=!!(r&&r.IS_ITERATOR),u=!!(r&&r.INTERRUPTED),d=Mg(e,i),l,p,h,c,f,g,y,S=function(P){return l&&Nu(l,"normal"),new $t(!0,P)},I=function(P){return o?(Fg(P),u?d(P[0],P[1],S):d(P[0],P[1])):u?d(P,S):d(P)};if(n)l=t.iterator;else if(s)l=t;else{if(p=Hg(t),!p)throw new Kg(Ug(t)+" is not iterable");if(Bg(p)){for(h=0,c=jg(t);c>h;h++)if(f=I(t[h]),f&&Lu(Du,f))return f;return new $t(!1)}l=Wg(t,p)}for(g=n?t.next:l.next;!(y=Vg(g,l)).done;){try{f=I(y.value)}catch(P){Nu(l,"throw",P)}if(typeof f=="object"&&f&&Lu(Du,f))return f}return new $t(!1)}});var Bu=a((ZS,Uu)=>{"use strict";var Gg=N(),Vu=Gg("iterator"),Fu=!1;try{Mu=0,ki={next:function(){return{done:!!Mu++}},return:function(){Fu=!0}},ki[Vu]=function(){return this},Array.from(ki,function(){throw 2})}catch{}var Mu,ki;Uu.exports=function(t,e){try{if(!e&&!Fu)return!1}catch{return!1}var r=!1;try{var i={};i[Vu]=function(){return{next:function(){return{done:r=!0}}}},t(i)}catch{}return r}});var Li=a((e_,ju)=>{"use strict";var zg=le(),Qg=Bu(),Yg=we().CONSTRUCTOR;ju.exports=Yg||!Qg(function(t){zg.all(t).then(void 0,function(){})})});var Wu=a(()=>{"use strict";var Jg=D(),Xg=F(),Zg=X(),em=Oe(),tm=wt(),rm=Mt(),im=Li();Jg({target:"Promise",stat:!0,forced:im},{all:function(e){var r=this,i=em.f(r),o=i.resolve,n=i.reject,s=tm(function(){var u=Zg(r.resolve),d=[],l=0,p=1;rm(e,function(h){var c=l++,f=!1;p++,Xg(u,r,h).then(function(g){f||(f=!0,d[c]=g,--p||o(d))},n)}),--p||o(d)});return s.error&&n(s.value),i.promise}})});var Ku=a(()=>{"use strict";var om=D(),nm=G(),am=we().CONSTRUCTOR,Di=le(),sm=J(),um=O(),cm=Pe(),Hu=Di&&Di.prototype;om({target:"Promise",proto:!0,forced:am,real:!0},{catch:function(t){return this.then(void 0,t)}});!nm&&um(Di)&&(Ni=sm("Promise").prototype.catch,Hu.catch!==Ni&&cm(Hu,"catch",Ni,{unsafe:!0}));var Ni});var Gu=a(()=>{"use strict";var lm=D(),dm=F(),fm=X(),pm=Oe(),hm=wt(),vm=Mt(),gm=Li();lm({target:"Promise",stat:!0,forced:gm},{race:function(e){var r=this,i=pm.f(r),o=i.reject,n=hm(function(){var s=fm(r.resolve);vm(e,function(u){dm(s,r,u).then(i.resolve,o)})});return n.error&&o(n.value),i.promise}})});var zu=a(()=>{"use strict";var mm=D(),bm=Oe(),ym=we().CONSTRUCTOR;mm({target:"Promise",stat:!0,forced:ym},{reject:function(e){var r=bm.f(this),i=r.reject;return i(e),r.promise}})});var $i=a((c_,Qu)=>{"use strict";var Im=Z(),Sm=U(),_m=Oe();Qu.exports=function(t,e){if(Im(t),Sm(e)&&e.constructor===t)return e;var r=_m.f(t),i=r.resolve;return i(e),r.promise}});var Xu=a(()=>{"use strict";var Pm=D(),Em=J(),Yu=G(),Tm=le(),Ju=we().CONSTRUCTOR,wm=$i(),Om=Em("Promise"),xm=Yu&&!Ju;Pm({target:"Promise",stat:!0,forced:Yu||Ju},{resolve:function(e){return wm(xm&&this===Om?Tm:this,e)}})});var Zu=a(()=>{"use strict";Pu();Wu();Ku();Gu();zu();Xu()});var ic=a(()=>{"use strict";var Am=D(),qm=G(),Vt=le(),Rm=q(),tc=J(),rc=O(),Cm=ei(),ec=$i(),km=Pe(),Vi=Vt&&Vt.prototype,Lm=!!Vt&&Rm(function(){Vi.finally.call({then:function(){}},function(){})});Am({target:"Promise",proto:!0,real:!0,forced:Lm},{finally:function(t){var e=Cm(this,tc("Promise")),r=rc(t);return this.then(r?function(i){return ec(e,t()).then(function(){return i})}:t,r?function(i){return ec(e,t()).then(function(){throw i})}:t)}});!qm&&rc(Vt)&&(Mi=tc("Promise").prototype.finally,Vi.finally!==Mi&&km(Vi,"finally",Mi,{unsafe:!0}));var Mi});var nc=a((g_,oc)=>{"use strict";wa();Zu();ic();var Nm=vt();oc.exports=Nm("Promise","finally")});var sc=a((m_,ac)=>{"use strict";var Dm=nc();ac.exports=Dm});var Fi=a((b_,uc)=>{"use strict";var $m=sc();uc.exports=$m});var lc=a((y_,cc)=>{"use strict";var Mm=q();cc.exports=!Mm(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})});var Ft=a((I_,fc)=>{"use strict";var Vm=z(),Fm=O(),Um=qr(),Bm=Ot(),jm=lc(),dc=Bm("IE_PROTO"),Ui=Object,Wm=Ui.prototype;fc.exports=jm?Ui.getPrototypeOf:function(t){var e=Um(t);if(Vm(e,dc))return e[dc];var r=e.constructor;return Fm(r)&&e instanceof r?r.prototype:e instanceof Ui?Wm:null}});var vc=a((S_,hc)=>{"use strict";var Hm=R(),Bi=z(),Km=ne(),Gm=Wr().indexOf,zm=xt(),pc=Hm([].push);hc.exports=function(t,e){var r=Km(t),i=0,o=[],n;for(n in r)!Bi(zm,n)&&Bi(r,n)&&pc(o,n);for(;e.length>i;)Bi(r,n=e[i++])&&(~Gm(o,n)||pc(o,n));return o}});var ji=a((__,gc)=>{"use strict";gc.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Wi=a((P_,mc)=>{"use strict";var Qm=vc(),Ym=ji();mc.exports=Object.keys||function(e){return Qm(e,Ym)}});var Pc=a((E_,_c)=>{"use strict";var yc=L(),Jm=q(),Ic=R(),Xm=Ft(),Zm=Wi(),eb=ne(),tb=mr().f,Sc=Ic(tb),rb=Ic([].push),ib=yc&&Jm(function(){var t=Object.create(null);return t[2]=2,!Sc(t,2)}),bc=function(t){return function(e){for(var r=eb(e),i=Zm(r),o=ib&&Xm(r)===null,n=i.length,s=0,u=[],d;n>s;)d=i[s++],(!yc||(o?d in r:Sc(r,d)))&&rb(u,t?[d,r[d]]:r[d]);return u}};_c.exports={entries:bc(!0),values:bc(!1)}});var Ec=a(()=>{"use strict";var ob=D(),nb=Pc().entries;ob({target:"Object",stat:!0},{entries:function(e){return nb(e)}})});var wc=a((O_,Tc)=>{"use strict";Ec();var ab=ge();Tc.exports=ab.Object.entries});var xc=a((x_,Oc)=>{"use strict";var sb=wc();Oc.exports=sb});var Ce=a((A_,Ac)=>{"use strict";var ub=xc();Ac.exports=ub});var Cc=a((q_,Rc)=>{"use strict";var Hi=L(),cb=z(),qc=Function.prototype,lb=Hi&&Object.getOwnPropertyDescriptor,Ki=cb(qc,"name"),db=Ki&&function(){}.name==="something",fb=Ki&&(!Hi||Hi&&lb(qc,"name").configurable);Rc.exports={EXISTS:Ki,PROPER:db,CONFIGURABLE:fb}});var Lc=a(kc=>{"use strict";var pb=L(),hb=$r(),vb=se(),gb=Z(),mb=ne(),bb=Wi();kc.f=pb&&!hb?Object.defineProperties:function(e,r){gb(e);for(var i=mb(r),o=bb(r),n=o.length,s=0,u;n>s;)vb.f(e,u=o[s++],i[u]);return e}});var Yi=a((C_,Uc)=>{"use strict";var yb=Z(),Ib=Lc(),Nc=ji(),Sb=xt(),_b=ti(),Pb=ft(),Eb=Ot(),Dc=">",$c="<",zi="prototype",Qi="script",Vc=Eb("IE_PROTO"),Gi=function(){},Fc=function(t){return $c+Qi+Dc+t+$c+"/"+Qi+Dc},Mc=function(t){t.write(Fc("")),t.close();var e=t.parentWindow.Object;return t=null,e},Tb=function(){var t=Pb("iframe"),e="java"+Qi+":",r;return t.style.display="none",_b.appendChild(t),t.src=String(e),r=t.contentWindow.document,r.open(),r.write(Fc("document.F=Object")),r.close(),r.F},Ut,Bt=function(){try{Ut=new ActiveXObject("htmlfile")}catch{}Bt=typeof document<"u"?document.domain&&Ut?Mc(Ut):Tb():Mc(Ut);for(var t=Nc.length;t--;)delete Bt[zi][Nc[t]];return Bt()};Sb[Vc]=!0;Uc.exports=Object.create||function(e,r){var i;return e!==null?(Gi[zi]=yb(e),i=new Gi,Gi[zi]=null,i[Vc]=e):i=Bt(),r===void 0?i:Ib.f(i,r)}});var eo=a((k_,Wc)=>{"use strict";var wb=q(),Ob=O(),xb=U(),Ab=Yi(),Bc=Ft(),qb=Pe(),Rb=N(),Cb=G(),Zi=Rb("iterator"),jc=!1,ee,Ji,Xi;[].keys&&(Xi=[].keys(),"next"in Xi?(Ji=Bc(Bc(Xi)),Ji!==Object.prototype&&(ee=Ji)):jc=!0);var kb=!xb(ee)||wb(function(){var t={};return ee[Zi].call(t)!==t});kb?ee={}:Cb&&(ee=Ab(ee));Ob(ee[Zi])||qb(ee,Zi,function(){return this});Wc.exports={IteratorPrototype:ee,BUGGY_SAFARI_ITERATORS:jc}});var Kc=a((L_,Hc)=>{"use strict";var Lb=eo().IteratorPrototype,Nb=Yi(),Db=Me(),$b=Ge(),Mb=fe(),Vb=function(){return this};Hc.exports=function(t,e,r,i){var o=e+" Iterator";return t.prototype=Nb(Lb,{next:Db(+!i,r)}),$b(t,o,!1,!0),Mb[o]=Vb,t}});var il=a((N_,rl)=>{"use strict";var Fb=D(),Ub=F(),jt=G(),el=Cc(),Bb=O(),jb=Kc(),Gc=Ft(),zc=Yr(),Wb=Ge(),Hb=be(),to=Pe(),Kb=N(),Qc=fe(),tl=eo(),Gb=el.PROPER,zb=el.CONFIGURABLE,Yc=tl.IteratorPrototype,Wt=tl.BUGGY_SAFARI_ITERATORS,tt=Kb("iterator"),Jc="keys",rt="values",Xc="entries",Zc=function(){return this};rl.exports=function(t,e,r,i,o,n,s){jb(r,e,i);var u=function(I){if(I===o&&c)return c;if(!Wt&&I&&I in p)return p[I];switch(I){case Jc:return function(){return new r(this,I)};case rt:return function(){return new r(this,I)};case Xc:return function(){return new r(this,I)}}return function(){return new r(this)}},d=e+" Iterator",l=!1,p=t.prototype,h=p[tt]||p["@@iterator"]||o&&p[o],c=!Wt&&h||u(o),f=e==="Array"&&p.entries||h,g,y,S;if(f&&(g=Gc(f.call(new t)),g!==Object.prototype&&g.next&&(!jt&&Gc(g)!==Yc&&(zc?zc(g,Yc):Bb(g[tt])||to(g,tt,Zc)),Wb(g,d,!0,!0),jt&&(Qc[d]=Zc))),Gb&&o===rt&&h&&h.name!==rt&&(!jt&&zb?Hb(p,"name",rt):(l=!0,c=function(){return Ub(h,this)})),o)if(y={values:u(rt),keys:n?c:u(Jc),entries:u(Xc)},s)for(S in y)(Wt||l||!(S in p))&&to(p,S,y[S]);else Fb({target:e,proto:!0,forced:Wt||l},y);return(!jt||s)&&p[tt]!==c&&to(p,tt,c,{name:o}),Qc[e]=c,y}});var nl=a((D_,ol)=>{"use strict";ol.exports=function(t,e){return{value:t,done:e}}});var io=a(($_,ll)=>{"use strict";var Qb=ne(),ro=Hr(),al=fe(),ul=Si(),Yb=se().f,Jb=il(),Ht=nl(),Xb=G(),Zb=L(),cl="Array Iterator",ey=ul.set,ty=ul.getterFor(cl);ll.exports=Jb(Array,"Array",function(t,e){ey(this,{type:cl,target:Qb(t),index:0,kind:e})},function(){var t=ty(this),e=t.target,r=t.index++;if(!e||r>=e.length)return t.target=null,Ht(void 0,!0);switch(t.kind){case"keys":return Ht(r,!1);case"values":return Ht(e[r],!1)}return Ht([r,e[r]],!1)},"values");var sl=al.Arguments=al.Array;ro("keys");ro("values");ro("entries");if(!Xb&&Zb&&sl.name!=="values")try{Yb(sl,"name",{value:"values"})}catch{}});var fl=a((M_,dl)=>{"use strict";var ry=L(),iy=se(),oy=Me();dl.exports=function(t,e,r){ry?iy.f(t,e,oy(0,r)):t[e]=r}});var pl=a(()=>{"use strict";var ny=D(),ay=Mt(),sy=fl();ny({target:"Object",stat:!0},{fromEntries:function(e){var r={};return ay(e,function(i,o){sy(r,i,o)},{AS_ENTRIES:!0}),r}})});var vl=a((U_,hl)=>{"use strict";io();pl();var uy=ge();hl.exports=uy.Object.fromEntries});var ml=a((B_,gl)=>{"use strict";gl.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}});var yl=a(()=>{"use strict";io();var cy=ml(),ly=w(),dy=Ge(),bl=fe();for(Kt in cy)dy(ly[Kt],Kt),bl[Kt]=bl.Array;var Kt});var Sl=a((H_,Il)=>{"use strict";var fy=vl();yl();Il.exports=fy});var Pl=a((K_,_l)=>{"use strict";var py=Sl();_l.exports=py});var uo=a((DP,$l)=>{"use strict";var my=Ke(),by=String;$l.exports=function(t){if(my(t)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return by(t)}});var Vl=a(($P,Ml)=>{"use strict";var yy=ht(),Iy=uo(),Sy=ve(),_y=RangeError;Ml.exports=function(e){var r=Iy(Sy(this)),i="",o=yy(e);if(o<0||o===1/0)throw new _y("Wrong number of repetitions");for(;o>0;(o>>>=1)&&(r+=r))o&1&&(i+=r);return i}});var Wl=a((MP,jl)=>{"use strict";var Bl=R(),Py=Br(),Fl=uo(),Ey=Vl(),Ty=ve(),wy=Bl(Ey),Oy=Bl("".slice),xy=Math.ceil,Ul=function(t){return function(e,r,i){var o=Fl(Ty(e)),n=Py(r),s=o.length,u=i===void 0?" ":Fl(i),d,l;return n<=s||u===""?o:(d=n-s,l=wy(u,xy(d/u.length)),l.length>d&&(l=Oy(l,0,d)),t?o+l:l+o)}};jl.exports={start:Ul(!1),end:Ul(!0)}});var Kl=a((VP,Hl)=>{"use strict";var Ay=ae();Hl.exports=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Ay)});var Gl=a(()=>{"use strict";var qy=D(),Ry=Wl().start,Cy=Kl();qy({target:"String",proto:!0,forced:Cy},{padStart:function(e){return Ry(this,e,arguments.length>1?arguments[1]:void 0)}})});var Ql=a((BP,zl)=>{"use strict";Gl();var ky=vt();zl.exports=ky("String","padStart")});var Jl=a((jP,Yl)=>{"use strict";var Ly=Ql();Yl.exports=Ly});var co=a((WP,Xl)=>{"use strict";var Ny=Jl();Xl.exports=Ny});var By={};Eo(By,{ApiEnv:()=>_e,ConnectionType:()=>bt,ContentType:()=>mt,InteractiveInterfaceClick:()=>Kr,MediascopePixel:()=>lr,MediascopePixelTypes:()=>Pd,OneStat:()=>er,Quality:()=>gt,SeekAction:()=>yt,ThinOneStat:()=>Po,VERSION:()=>C});module.exports=$d(By);var ho=A(Se(),1);var _e=(s=>(s.PROD="prod",s.VK_ALIAS="vk_alias",s.VIDEOTEST="videotest",s.TEST="test",s.OKCDN="okcdn",s.AUTO="auto",s))(_e||{}),gt=(l=>(l.Q144P="mobile",l.Q240P="lowest",l.Q360P="low",l.Q480P="medium",l.Q720P="high",l.Q1080P="fullhd",l.Q1440P="quadhd",l.Q2160P="ultrahd",l.UNKNOWN="unknown",l))(gt||{}),mt=(f=>(f.MP4="mp4",f.DASH="dash",f.DASH_SEP="dash_sep",f.ONDEMAND_DASH="ondemand_dash",f.HLS="hls",f.ONDEMAND_HLS="ondemand_hls",f.WEBM="webm",f.AV1="av1",f.ONDEMAND_DASH_LIVE="ondemand_dash_live",f.ONDEMAND_HLS_LIVE="ondemand_hls_live",f.WEBRTC="webrtc",f.UNKNOWN="unknown",f.RTMP="rtmp",f))(mt||{});var bt=(i=>(i.HTTP1="http1",i.HTTP2="http2",i.HTTP3="http3",i))(bt||{});var yt=(u=>(u.SLIDER="slider",u.DOUBLE_TAP="double_tap",u.TIME_CODE="time_code",u.EPISODE="episode",u.REWIND="rewind",u.LIVE="live",u.UNKNOWN="unknown",u))(yt||{}),Kr=(n=>(n.GRAPH_SHOW="iGraphShow",n.GRAPH_HIDE="iGraphHide",n.NEXT_AREA="iNextChapterArea",n.NEXT_BUTTON="iNextChapterBtn",n.WATCH_AGAIN="iWatchAgainBtn",n))(Kr||{}),ya={action_play:"ap",action_play_interactive:"api",first_bytes:"fb",player_ready:"pr",first_frame:"ff",seek:"sk",watch_coverage_record:"wr",watch_coverage_live:"wl",empty_buffer:"eb",action_stop:"as",close_at_empty_buffer:"cb",content_error:"er",player_interface_click:"pc",next_movie:"nm",track_switch:"ts",failover:"fo",quality:"qt"},Ia={vsid:"si",isid:"is",vid:"vi",place:"pl",quality:"qt",cdn_host:"ch",stat_type:"st",param:"pm",vk_app_id:"va",track_code:"tc",connection_type:"cnt",connection_reused:"cr",cached_data:"cd",live:"lv",muted:"mu",mode:"mo",subtitles:"sb",failover:"fo",download_speed:"ds",manual_quality:"mq",ref_domain:"rd",direct_url:"du"},Sa={unknown:"un",mobile:"m",lowest:"ls",low:"l",medium:"md",high:"h",fullhd:"f",quadhd:"q",ultrahd:"u"},_a={pip:"pi",fullscreen:"fs",external:"ex",prefetch:"pr",airplay:"ap",chromecast:"cc",invisible:"iv"};var Ea=require("@vkontakte/videoplayer-shared");var Pa="CIOPGQJGDIHBABABA",Gr={prod:"https://api.ok.ru",vk_alias:"https://api.mycdn.me",videotest:"https://videotestapi.ok.ru/api",test:"https://apitest.ok.ru",okcdn:"https://api.okcdn.ru",auto:""};var ah={apiEnv:"vk_alias",apiKey:Pa,requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageInterval:15e3,disabledOperations:["quality"],disabledCustomFields:[],shorten:!0,maxLoops:100,embedUrlParams:[],useBeacon:!0,synchronizeTime:!0,debugLog:!1,clearStorageAtUnload:!0,useVKComIsMobileLogic:!1,backoff:{start:1e3,factor:1.5,max:5*60*1e3,random:.1},useKeepalive:!1},Ta=t=>(0,Ea.fillWithDefault)(t,ah);function zr(){let t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),e=new Array(36),r=0,i,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?e[o]="-":o===14?e[o]="4":(r<=2&&(r=33554432+Math.random()*16777216|0),i=r&15,r=r>>4,e[o]=t[o===19?i&3|8:i]);return e.join("")}var v=require("@vkontakte/videoplayer-shared"),tr=require("@vkontakte/videoplayer-shared");var Gt=A(Fi(),1);var El=A(Ce(),1),Tl=A(Pl(),1);var wl=t=>{let{operation:e,custom:r}=t,i=(0,Tl.default)((0,El.default)(r).map(([o,n])=>{let s=Ia[o]??o,u=n;return n&&(o==="mode"?u=_a[n]??n:o==="quality"&&(u=Sa[n]??n)),[s,u]}));return{...t,operation:ya[e]??e,custom:i}};var C="1.0.83-dev.c0e6f99b.0";var W=require("@vkontakte/videoplayer-shared");var hy=/Mobile|mini|Fennec|Android|iP(ad|od|hone)|opera (mini|mobi)/i,it=class{constructor(e){this.consequentAuthErrors=0;this.authorized$=new W.ValueSubject(!1);this.params=e}async authorize(e){return this.authToken=e??await this.refreshAuthToken(),this._authorizeWithBackoff()}logBeacon(e){let r="log.externalLog",i=this.createLogParams(e),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(r,i,o)||this.logRequest(e).catch(()=>{})}async logRequest(e){let r="log.externalLog",i=this.createLogParams(e),o=this.sessionKey??await this._authorizeWithBackoff();if(!o)return;let n=async(s,u=this.params.config.requestRetryCount)=>{try{return await this.params.apiTransport.sendRequest(r,i,o)}catch(d){if(!d||!("error_code"in d)){this.params.error$.next({id:"logRequestUnknown",category:W.ErrorCategory.NETWORK,message:`Unknown ${r} error`,thrown:d});return}let l=d?.error_code;switch(l){case 102:case 103:case 104:return this.authorized$.next(!1),this.sessionKey=await this._authorizeWithBackoff(),u>0?n(s,u-1):void 0;case 401:return this.authorized$.next(!1),this.authToken=await this.refreshAuthToken(),this.sessionKey=await this._authorizeWithBackoff(),u>0?n(s,u-1):void 0;default:{this.params.error$.next({id:`LogRequest#${l}`,category:W.ErrorCategory.EXTERNAL_API,message:`${r} error`,data:d});return}}}};return n(e)}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}async refreshAuthToken(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=(0,Gt.default)(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise}createLogParams(e){let r="WEB",i=!1,o=`@vkontakte/videoplayer-statistics:${C}`;if(this.params.config.useVKComIsMobileLogic){let{appVersion:n}=window.navigator;i=hy.test(n)}else this.params.mobile&&(i=!0);return i&&(r="M_WEB"),this.params.vktvVersion&&(r="SMART_TV",o=this.params.vktvVersion),{collector:"ok.mobile.apps.video",data:JSON.stringify({application:o,platform:r,items:this.params.config.shorten?e.map(wl):e})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();let e=(0,W.getExponentialDelay)(this.consequentAuthErrors,this.params.config.backoff);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{(0,Gt.default)(this._authorize().then(r).catch(i=>this.params.error$.next({id:"AuthorizeBackoff",category:W.ErrorCategory.NETWORK,message:"Otherwise unhandled error in authorization",thrown:i})),()=>this.backoffTimeoutId=0)},e))})}async _authorize(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);let e="auth.anonymLogin",r={session_data:{version:2,device_id:this.params.deviceId,client_version:C.split("-")[0],client_type:"SDK_JS"}};return this.authToken!==void 0&&(r.session_data.auth_token=this.authToken,r.session_data.version=3),this.authorizePromise=(0,Gt.default)(this.params.apiTransport.sendRequest(e,r).then(i=>((!i||!i.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:W.ErrorCategory.EXTERNAL_API,message:"No session key",data:i}),this.sessionKey=i?.session_key??void 0,this.sessionKey)).catch(async i=>{this.sessionKey=void 0;let o=i?.error_code;switch(o){case 401:return this.authToken=await this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:W.ErrorCategory.EXTERNAL_API,message:"authorize error",data:i}):this.params.error$.next({id:"AuthorizeUnknown",category:W.ErrorCategory.NETWORK,message:"authorize error",thrown:i})}),()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise}};var{NativeAbortSignal:oP,NativeAbortController:nP}=function(t){return{NativeAbortSignal:t.AbortSignal,NativeAbortController:t.AbortController}}(typeof self<"u"?self:global);function Ol(t){let e;try{e=new Event("abort")}catch{typeof document<"u"?document.createEvent?(e=document.createEvent("Event"),e.initEvent("abort",!1,!1)):(e=document.createEventObject(),e.type="abort"):e={type:"abort",bubbles:!1,cancelable:!1}}return e.reason=t,e}function xl(t){if(t===void 0)if(typeof document>"u")t=new Error("This operation was aborted"),t.name="AbortError";else try{t=new DOMException("signal is aborted without reason"),Object.defineProperty(t,"name",{value:"AbortError"})}catch{t=new Error("This operation was aborted"),t.name="AbortError"}return t}var zt=class{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(e,r,i){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:r,options:i})}removeEventListener(e,r){if(!(e in this.listeners))return;let i=this.listeners[e];for(let o=0,n=i.length;o<n;o++)if(i[o].callback===r){i.splice(o,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let i=this.listeners[e.type].slice();for(let o=0,n=i.length;o<n;o++){let s=i[o];try{s.callback.call(this,e)}catch(u){Promise.resolve().then(()=>{throw u})}s.options&&s.options.once&&this.removeEventListener(e.type,s.callback)}return!e.defaultPrevented}},ke=class extends zt{constructor(){super(),this.listeners||zt.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(e){e.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,e)),super.dispatchEvent(e)}throwIfAborted(){let{aborted:e,reason:r="Aborted"}=this;if(e)throw r}static timeout(e){let r=new pe;return setTimeout(()=>r.abort(new DOMException(`This signal is timeout in ${e}ms`,"TimeoutError")),e),r.signal}static any(e){let r=new pe;function i(){r.abort(this.reason),o()}function o(){for(let n of e)n.removeEventListener("abort",i)}for(let n of e)if(n.aborted){r.abort(n.reason);break}else n.addEventListener("abort",i);return r.signal}},pe=class{constructor(){Object.defineProperty(this,"signal",{value:new ke,writable:!0,configurable:!0})}abort(e){let r=xl(e),i=Ol(r);this.signal.reason=r,this.signal.dispatchEvent(i)}toString(){return"[object AbortController]"}};typeof Symbol<"u"&&Symbol.toStringTag&&(pe.prototype[Symbol.toStringTag]="AbortController",ke.prototype[Symbol.toStringTag]="AbortSignal");function Qt(t){return t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof t.Request=="function"&&!t.Request.prototype.hasOwnProperty("signal")||!t.AbortController}function oo(t){typeof t=="function"&&(t={fetch:t});let{fetch:e,Request:r=e.Request,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=t;if(!Qt({fetch:e,Request:r,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o}))return{fetch:e,Request:n};let n=r;(n&&!n.prototype.hasOwnProperty("signal")||o)&&(n=function(l,p){let h;p&&p.signal&&(h=p.signal,delete p.signal);let c=new r(l,p);return h&&Object.defineProperty(c,"signal",{writable:!1,enumerable:!1,configurable:!0,value:h}),c},n.prototype=r.prototype);let s=e;return{fetch:(d,l)=>{let p=n&&n.prototype.isPrototypeOf(d)?d.signal:l?l.signal:void 0;if(p){let h;try{h=new DOMException("Aborted","AbortError")}catch{h=new Error("Aborted"),h.name="AbortError"}if(p.aborted)return Promise.reject(h);let c=new Promise((f,g)=>{p.addEventListener("abort",()=>g(h),{once:!0})});return l&&l.signal&&delete l.signal,Promise.race([c,s(d,l)])}return s(d,l)},Request:n}}var vy=()=>"fetch"in window,ot=vy()&&Qt({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Al=ot?oo({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,Le=ot?Al.fetch:window.fetch,vP=ot?Al.Request:window.Request,gP=ot?pe:window.AbortController,mP=ot?ke:window.AbortSignal;var ql=A(Se(),1),Rl=A(Ce(),1),te=require("@vkontakte/videoplayer-shared");var nt=class{constructor(e){this.params=e,this.apiKey=e.config.apiKey,this.apiEnv=e.config.apiEnv,this.apiBaseUrl=Gr[this.apiEnv],this.timeSynchronisation=e.timeSynchronisation,this.isApiBaseUrlFetched=!1}async resolveApiBaseUrl(){if(this.apiEnv!=="auto"||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{let e=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=(await(await Le(e,{method:"GET",mode:"cors",cache:"no-cache"})).json())?.Answer[0]?.data;if(!o)throw new Error("Wrong DNS response");return o}catch(e){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:te.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:e}),Gr.vk_alias}finally{this.isApiBaseUrlFetched=!0}}sendBeacon(e,r,i){if(!window.Blob||!window.navigator.sendBeacon)return!1;let o=this._prepareQueryParams({method:e,queryParams:r,sessionKey:i}),n=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,n)}catch(s){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:te.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:s,data:{method:e,params:r}})}return!1}async sendRequest(e,r,i){let o=(0,te.now)(),n=u=>{if(u instanceof TypeError&&(0,ql.default)(["Failed to fetch","NetworkError when attempting to fetch resource."],u.message)){this.params.error$.next({id:"Network",category:te.ErrorCategory.NETWORK,message:"Request failed",thrown:u});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:te.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:u,data:{method:e,params:r,sessionKey:i,time:(0,te.now)()-o}})};this.apiBaseUrl=await this.resolveApiBaseUrl();let s={method:"post",headers:{"Content-type":"application/x-www-form-urlencoded"},body:this._prepareQueryParams({method:e,queryParams:r,sessionKey:i})};return this.params.config.useKeepalive&&(s.keepalive=!0),Le(`${this.apiBaseUrl}/fb.do`,s).then(u=>{let d=Number(u.headers.get("content-length"))===0,l=new Date(u.headers.get("date")??"").getTime(),p=(0,te.now)()-o;if(isFinite(l)&&this.timeSynchronisation?.addServerTime(l,p),!d)return u.json().then(h=>Object.prototype.hasOwnProperty.call(h,"error_msg")?Promise.reject(h):h,n)},n)}_prepareQueryParams(e){let r=new URLSearchParams({format:"JSON",method:e.method,application_key:this.apiKey});return e.sessionKey!==void 0&&r.append("session_key",e.sessionKey),(0,Rl.default)(e.queryParams).forEach(([i,o])=>r.append(i,typeof o=="string"?o:JSON.stringify(o))),r}};var Cl=A(Se(),1),kl=A(Ce(),1),M=require("@vkontakte/videoplayer-shared"),Yt="onestat_events",no=t=>e=>e.timestamp+t>=(0,M.now)(),Jt=class{constructor(e){this.unsaltedStorage=[];this.isPaused=!1;this.isUrgent=e=>{let{operation:r}=e;return(0,Cl.default)(["action_play","watch_coverage_record","watch_coverage_live"],r)};this.params=e,this.api=e.api,this.error$=e.error$,this.userSalt=e.userSalt,this.loggerDebugLog=e.debugLogger.createComponentLog("stat logger"),this.firstFlush=(0,M.debounceFn)(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});let r=M.safeStorage.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=(0,M.debounceFn)(()=>this.safeFlush(),this.params.config.flushDebounceTime,{maxWait:r}),this.subscription=this.api.authorized$.subscribe(i=>{i&&this.debouncedFlush()}),this.housekeepStorage()}safeFlush(){try{this.flush()}catch(e){this.error$.next({id:"LoggerError",category:M.ErrorCategory.WTF,message:e?String(e):"Unknown logger error",thrown:e})}}readFromStorage(){let e=M.safeStorage.get(Yt);try{return e?JSON.parse(e):{}}catch{}return{}}addToStorage(e){if(!this.userSalt){this.unsaltedStorage.push(e);return}let r=this.readFromStorage(),o=(r[this.userSalt]??[]).filter(no(this.params.config.storageExpiration));M.safeStorage.set(Yt,JSON.stringify({...r,[this.userSalt]:[...o,e]}))}getFromStorage(){return this.userSalt?(this.readFromStorage()[this.userSalt]??[]).filter(no(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}let e=this.readFromStorage();delete e[this.userSalt],M.safeStorage.set(Yt,JSON.stringify(e))}housekeepStorage(){let e=this.readFromStorage();for(let[r,i]of(0,kl.default)(e)){let o=i.filter(no(this.params.config.storageExpiration));o.length?e[r]=o:delete e[r],this.loggerDebugLog({message:`${i.length} retrieved from storage, ${o.length} of them actual`})}M.safeStorage.set(Yt,JSON.stringify(e))}log(e){this.addToStorage(e),!this.isPaused&&(this.isUrgent(e)?this.flush():this.lastVsid!==e.custom.vsid?this.firstFlush():this.debouncedFlush(),this.lastVsid=e.custom.vsid)}flush({wantBeacon:e,clearStorage:r}={wantBeacon:!1,clearStorage:!0}){let i=this.getFromStorage();i.length!==0&&(this.api.authorized$.getValue()?(e&&this.params.config.useBeacon?(this.loggerDebugLog({message:`Flushing ${i.length} events through beacon`}),this.api.logBeacon(i)):(this.loggerDebugLog({message:`Flushing ${i.length} events`}),this.api.logRequest(i)),r&&this.markStorageSent()):this.api.authorize(),this.firstFlush.cancel(),this.debouncedFlush.cancel())}pause(){this.isPaused=!0,this.debouncedFlush.cancel()}resume(){this.isPaused=!1,this.debouncedFlush()}destroy(){this.subscription.unsubscribe(),this.firstFlush.cancel(),this.debouncedFlush.cancel()}};var m=require("@vkontakte/videoplayer-core"),ao=require("@vkontakte/videoplayer-shared");var Ll=t=>t&&{[m.VideoQuality.INVARIANT]:"unknown",[m.VideoQuality.Q_144P]:"mobile",[m.VideoQuality.Q_240P]:"lowest",[m.VideoQuality.Q_360P]:"low",[m.VideoQuality.Q_480P]:"medium",[m.VideoQuality.Q_576P]:"unknown",[m.VideoQuality.Q_720P]:"high",[m.VideoQuality.Q_1080P]:"fullhd",[m.VideoQuality.Q_1440P]:"quadhd",[m.VideoQuality.Q_2160P]:"ultrahd",[m.VideoQuality.Q_4320P]:"unknown"}[t],so=t=>t&&{[m.HttpConnectionType.HTTP1]:"http1",[m.HttpConnectionType.HTTP2]:"http2",[m.HttpConnectionType.QUIC]:"http3"}[t],Nl=t=>{if(t!==void 0)switch(t){case m.VideoFormat.MPEG:return"mp4";case m.VideoFormat.DASH:case m.VideoFormat.DASH_LIVE:case m.VideoFormat.DASH_STREAMS:return"dash";case m.VideoFormat.DASH_SEP:return"dash_sep";case m.VideoFormat.DASH_ONDEMAND:return"ondemand_dash";case m.VideoFormat.DASH_WEBM:case m.VideoFormat.DASH_LIVE_WEBM:return"webm";case m.VideoFormat.DASH_WEBM_AV1:return"av1";case m.VideoFormat.DASH_LIVE_CMAF:return"ondemand_dash_live";case m.VideoFormat.HLS:case m.VideoFormat.HLS_LIVE:return"hls";case m.VideoFormat.HLS_ONDEMAND:return"ondemand_hls";case m.VideoFormat.HLS_LIVE_CMAF:return"ondemand_hls_live";case m.VideoFormat.WEB_RTC_LIVE:return"webrtc";default:return(0,ao.assertNever)(t)}},Xt=t=>{if(t!==void 0)switch(t){case m.Surface.NONE:case m.Surface.INLINE:return;case m.Surface.FULLSCREEN:return"fullscreen";case m.Surface.SECOND_SCREEN:return"chromecast";case m.Surface.PIP:return"pip";case m.Surface.INVISIBLE:return"invisible";default:return(0,ao.assertNever)(t)}},Dl=t=>{switch(t){case"slow-2g":return"poor";case"2g":return"poor";case"3g":return"good";case"4g":return"excellent"}};var Zt=class{constructor(e){this.offset=void 0;this.offset=e}getOffset(){return this.offset??0}setOffset(e){this.offset=e}now(){return Date.now()+(this.offset??0)}date(e=new Date){return e.setTime(e.getTime()+(this.offset??0)),e}addServerTime(e,r){let i=Date.now(),o=e-i-r/2;if(Math.abs(o)<1e3){this.offset=0;return}this.offset===void 0?this.offset=Math.round(o):this.offset=Math.round(.2*o+(1-.2)*this.offset)}};var lo=A(co(),1),Zl=()=>(0,lo.default)(Math.floor(Math.random()*2**32).toString(36),7,"0"),ed=()=>(0,lo.default)(Math.floor(Math.random()*2**64).toString(36),13,"0");var fo=require("@vkontakte/videoplayer-core"),_=require("@vkontakte/videoplayer-shared"),td=(t,e)=>new _.Observable(r=>{let i=new _.Subscription,o=(0,_.merge)((0,_.fromEvent)(window,"beforeunload"),t.events.willDestruct$),n=new _.ValueSubject(void 0),s;i.add(t.info.isLive$.pipe((0,_.filterChanged)()).subscribe(x=>{s&&(s.unsubscribe(),n.next(void 0)),x?s=t.info.liveTime$.pipe((0,_.map)(k=>k&&k/1e3)).subscribe(n):s=t.info.position$.subscribe(n),i.add(s)}));let{playing$:u,paused$:d}=t.events,l=t.events.willSeek$.pipe((0,_.filter)(()=>t.info.playbackState$.getValue()===fo.PlaybackState.PLAYING)),p=t.events.seeked$.pipe((0,_.filter)(()=>t.info.playbackState$.getValue()===fo.PlaybackState.PLAYING)),h=!1,c=new _.Subject;i.add(l.subscribe(()=>{h||c.next(),h=!0})),i.add(p.subscribe(()=>h=!1));let f=new _.Subject,g=new _.Subject,y=(0,_.merge)(u,p,f),S=(0,_.merge)(d,c,o,t.events.looped$,g),I,P=()=>I=n.getValue(),Q=()=>{let x=n.getValue();(0,_.isNullable)(I)||I===x||(0,_.isNullable)(x)||(r.next({from:I,to:x}),I=void 0)},Y=()=>{g.next(),f.next()};if(i.add(y.subscribe(P)),i.add(S.subscribe(Q)),e.forceInterval&&isFinite(e.forceInterval)){let x=0;i.add(y.subscribe(()=>x=window.setTimeout(Y,e.forceInterval))),i.add(S.subscribe(()=>window.clearTimeout(x)))}return i});var Dy="_one-stat_",rd=`${Dy}deviceId`,po=()=>{let t=new v.Subscription;return{subscription:t,subscribe:(e,r)=>{e&&t.add(e.subscribe(r))}}},er=class{constructor(e,r){this.subscription=new v.Subscription;this.debugLogger=new tr.Logger;this.oneStatDebugLog=this.debugLogger.createComponentLog("onestat");this.loopCounter=0;this.disabled=!1;this.vsid$=new v.ValueSubject(void 0);this.isid$=new v.ValueSubject(void 0);this.zenUid$=new v.ValueSubject(void 0);this.seekAction$=new v.ValueSubject("unknown");this.statContext=e,this.config=Ta(r.config??{}),(0,v.isNonNullable)(r.apiEnv)&&(this.config.apiEnv=r.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new Zt);let i=new v.Subject;this.experimental={error$:i};let o=v.safeStorage.get(rd);this.statContext.deviceId?this.deviceId=this.statContext.deviceId:o?this.deviceId=o:(this.deviceId=zr(),v.safeStorage.set(rd,this.deviceId)),this.resetViewSession(),r.useIsid&&this.isid$.next(r.isid??ed()),this.zenUid$.next(r.zenUid);let n=new nt({config:this.config,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new it({config:this.config,apiTransport:n,refreshAuthToken:r.refreshAuthToken,mobile:this.statContext.mobile??!1,deviceId:this.deviceId,error$:i,vktvVersion:r.vktvVersion}),this.logger=new Jt({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:i,userSalt:r.userSalt});let{isEmbed:s,topOrigin:u}=(0,tr.detectEmbed)();this.isEmbed=s,this.embedParent=u?new URL(u).hostname:void 0,this.subscribe()}updateContext(e){this.statContext={...this.statContext,...e}}attachTo(e){let r=new v.Subscription,i=(c,f)=>r.add(c.subscribe(f));i(e.events.willStart$,()=>{let c=e.info.position$.getValue();this.logActionPlay({position:c}),this.statContext.projectId&&this.logActionPlayInteractive()}),i(e.events.looped$,()=>{this.resetViewSession(),++this.loopCounter>this.config.maxLoops&&(this.disabled=!0),this.logActionPlay({position:e.info.position$.getValue()})}),i(e.events.seeked$,()=>{this.logSeek({action:this.seekAction$.getValue(),time:e.info.position$.getValue()}),this.seekAction$.next("unknown")}),i(e.events.paused$,()=>{this.logPause({position:e.info.position$.getValue()})}),i(e.events.willResume$,()=>{this.logPlay()}),i(e.events.started$,()=>{this.statContext.clip&&this.logWatchCoverageRecord({start:0,end:0})}),i(e.events.playing$,()=>{this.logPlaying()}),i(td(e,{forceInterval:this.config.watchCoverageInterval}),c=>{let f=e.info.isLive$.getValue(),g=e.info.atLiveEdge$.getValue(),y={start:parseFloat(c.from.toFixed(3)),end:parseFloat(c.to.toFixed(3))};if(g){let S=e.info.liveLatency$.getValue()??0,I=e.info.currentBuffer$.getValue()?.end??0,P=e.info.liveBufferTime$.getValue()??0,Q=Math.round((S-(I-P))*1e3),Y=Math.round(S*1e3);Q&&Y&&(y.latency=Q,y.bufferLatency=Y)}f?this.logWatchCoverageLive(y):this.logWatchCoverageRecord(y)});let o;i(e.info.isStalled$,c=>{c?o=(0,v.now)():((0,v.isNonNullable)(o)&&this.logEmptyBuffer({duration:(0,v.now)()-o}),o=void 0)});let n=!1;r.add(e.events.fatalError$.pipe((0,v.once)()).subscribe(()=>n=!0)),i(e.events.willStop$,()=>{if(e.info.isStalled$.getValue()){let f=(0,v.isNonNullable)(o)?(0,v.now)()-o:void 0;this.logCloseAtEmptyBuffer({duration:f??0}),o=void 0}else n||this.logActionStop()}),i(e.events.managedError$,({id:c})=>{this.logError({fatal:!1,errorType:c})}),i(e.events.fatalError$,({id:c})=>{this.logError({fatal:!0,errorType:c})});let s,u,d=!1;i(e.events.firstBytes$,c=>{s=(0,v.now)(),this.logFirstBytes({time:c})}),i(e.events.willStart$,()=>u=(0,v.now)()),i(e.info.currentBuffer$,c=>{!d&&c&&c.end-c.start>0&&(0,v.isNonNullable)(s)&&(this.logPlayerReady({duration:(0,v.now)()-s}),d=!0)}),i(e.events.firstFrame$,()=>{(0,v.isNonNullable)(s)&&!d&&(this.logPlayerReady({duration:(0,v.now)()-s}),d=!0),(0,v.isNonNullable)(u)&&this.logFirstFrame({time:(0,v.now)()-u})});let l;i(e.info.currentVideoStream$,c=>{c&&(l&&c.id!==l&&this.logTrackSwitch(c),l=c.id)});let p;i(e.info.currentAudioStream$,c=>{c&&(p&&c.id!==p&&this.logTrackSwitch(c),p=c.id)}),i(e.info.atLiveEdge$,c=>this.updateContext({liveEdge:c})),i((0,v.combine)({muted:e.info.muted$,volume:e.info.volume$}),({muted:c,volume:f})=>this.updateContext({audible:!c&&f>0})),i(e.info.currentQuality$,c=>{let f=Ll(c);this.updateContext({quality:f}),f&&this.logQuality(f)}),i(e.info.isAutoQualityEnabled$,c=>this.updateContext({autoQuality:c})),i(e.info.currentFormat$,c=>this.updateContext({contentType:Nl(c)})),i(e.info.currentPlaybackRate$,c=>this.updateContext({rate:c})),i(e.info.is3DVideo$,c=>this.updateContext({is3d:c}));let h;return i(e.info.hostname$,c=>{let f=h!==void 0&&h!==c;this.updateContext({cdnHostname:c,failover:f}),f&&this.logFailover(c),h=c}),i(e.info.throughputEstimation$,c=>this.updateContext({downloadSpeed:c})),i(e.info.httpConnectionType$,c=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:so(c)}),this.updateContext({connectionType:so(c)})}),i(e.info.httpConnectionReused$,c=>{(0,v.isNullable)(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:c}),this.updateContext({connectionReused:c})}),i(e.info.surface$,c=>this.updateContext({mode:Xt(c)})),i((0,v.combine)({current:e.info.currentTextTrack$,available:e.info.availableTextTracks$}),({current:c,available:f})=>{let g=f.find(({id:S})=>S===c),y=g&&(g.isAuto?`${g.language}_auto`:g.language);this.updateContext({subtitles:y?.split(".")[0]})}),this.player=e,this.uiEvents&&this.attachToUi(this.uiEvents),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToUi(e){this.uiEvents=e;let{subscription:r,subscribe:i}=po();return this.player&&(i(e.actionRewind$,()=>{this.player&&(this.resetViewSession(),this.logActionPlay({position:this.player.info.position$.getValue()}))}),i(e.actionSeek$,this.seekAction$),i(e.inPiP$,o=>{let n=o?"pip":Xt(this.player?.info.surface$.getValue());this.updateContext({mode:n})}),i(e.inFullscreen$,o=>{let n=o?"fullscreen":Xt(this.player?.info.surface$.getValue());this.updateContext({mode:n})}),i(e.actionSetSubtitle$,o=>this.updateContext({subtitles:o.split(".")[0]})),i(e.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(r)),r}attachToAds(e){let{subscription:r,subscribe:i}=po();return i(e.slotRequested$,()=>this.logAdSlotRequest()),i(e.started$,o=>this.logAdStarted(o)),i(e.paused$,()=>this.logAdPaused()),i(e.resumed$,()=>this.logAdResumed()),i(e.ended$,()=>this.logAdEnded()),i(e.skipped$,()=>this.logAdSkipped()),i(e.clicked$,()=>this.logAdClicked()),i(e.error$,o=>this.logError({errorType:o,fatal:!1})),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToInteractive(e){let{subscription:r,subscribe:i}=po();return i(e.click$,o=>this.logInterfaceClick(o)),i(e.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(r),r}authorize(e){return this.api.authorize(e)}pause(){this.logger.pause(),this.oneStatDebugLog({message:"paused"})}resume(){this.logger.resume(),this.oneStatDebugLog({message:"resumed"})}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.oneStatDebugLog({message:"VSID reset"}),this.vsid$.next(Zl())}getDeviceId(){return this.deviceId}setFieldBlacklist(){}logInited(){}logReady(e){this.log({operation:"player_ready",param:String(e.time)})}logStarted(...e){this.logActionPlay(...e)}logPlay(){this.log({operation:"play_toggle"})}logPlaying(){this.log({operation:"playing"})}logPause(e){this.log({operation:"pause",param:String(Math.round(e.position))})}logSeek(e){this.log({operation:"seek",param:e.action,time:e.time})}logFirstBytes(e){this.log({operation:"first_bytes",param:String(e.time)})}logFirstFrame(e){this.log({operation:"first_frame",param:String(e.time)})}logError(e){this.log({operation:"content_error",param:`${e.fatal?"fatal":"recoverable"}_${e.errorType}`})}logWatchCoverageRecord(e){this.log({operation:"watch_coverage_record",param:`${e.start}-${e.end}`},{in_history:this.statContext.inHistory?1:void 0})}logWatchCoverageLive(e){let r=this.timeSynchronisation?.getOffset()??0,i=e.start+r,o=e.end+r;this.log({operation:"watch_coverage_live",param:`${i}-${o}`},{in_history:this.statContext.inHistory?1:void 0,latency:e.latency,buffer_latency:e.bufferLatency})}logEmptyBuffer(e){this.log({operation:"empty_buffer",param:String(e.duration)})}logDownloadSpeed(){}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(e){this.log({operation:"adv",param:e})}logAdPaused(){this.log({operation:"adv",param:"pause"})}logAdResumed(){this.log({operation:"adv",param:"resume"})}logAdEnded(){this.log({operation:"adv",param:"ended"})}logAdSkipped(){this.log({operation:"adv",param:"skip"})}logAdClicked(){this.log({operation:"adv",param:"click"})}logInterfaceClick(e){this.log({operation:"player_interface_click",param:e})}logNextMovie(e){this.log({operation:"next_movie",param:String(e)})}subscribe(){this.resubscribeBeforeunload();let e=window.navigator.connection;e&&"onchange"in e&&"effectiveType"in e&&this.subscription.add((0,v.merge)((0,v.fromEvent)(e,"change"),(0,v.observableFrom)(["init"])).subscribe(()=>this.updateContext({network:Dl(e.effectiveType)}))),this.config.debugLog&&this.debugLogger.log$.subscribe(r=>{console.debug("%c stat ","background:#fa6470;",`component: ${r.component}.`,r.message)})}resubscribeBeforeunload(){this.beforeunloadSubscription?.unsubscribe(),this.beforeunloadSubscription=(0,v.fromEvent)(window,"beforeunload").subscribe(()=>this.logger.flush({wantBeacon:!0,clearStorage:this.config.clearStorageAtUnload})),this.subscription.add(this.beforeunloadSubscription)}logPlayerReady(e){this.log({operation:"player_ready",param:String(Math.round(e.duration))})}logActionPlay(e){this.log({operation:"action_play",param:String(Math.round(e.position))})}logActionPlayInteractive(){this.statContext.projectId&&this.log({operation:"action_play_interactive",param:String(this.statContext.movieId)},{vid:this.statContext.projectId})}logFailover(e){this.log({operation:"failover",param:e})}logCloseAtEmptyBuffer(e){this.log({operation:"close_at_empty_buffer",param:String(Math.round(e.duration))})}logActionStop(){this.log({operation:"action_stop"})}logTrackSwitch(e){this.log({operation:"track_switch",param:e.id})}logQuality(e){this.log({operation:"quality",param:e})}log(e,r={}){if(this.disabled){this.oneStatDebugLog({message:`operation ${e.operation} but statistics is disabled`});return}if((0,ho.default)(this.config.disabledOperations,e.operation)){this.oneStatDebugLog({message:`operation ${e.operation} but it is disabled`});return}this.oneStatDebugLog({message:`operation ${e.operation} ${e.param}`});let i=this.createLogItem(e,r);this.logger.log(i)}createLogItem({operation:e,param:r,time:i},o={}){let n=this.timeSynchronisation?.now()??(0,v.now)(),s=this.vsid$.getValue();(0,v.assertNonNullable)(s);let u=this.isid$.getValue(),d=e==="empty_buffer"||e==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,l=this.statContext.firstConnectionReused,p,h;if(this.isEmbed||this.statContext.place==="embed"){p=this.embedParent;let f=[...new URLSearchParams(location.search).entries()].filter(([g,y])=>(0,ho.default)(this.config.embedUrlParams,g));h=new URLSearchParams(f).toString()}else this.statContext.place==="direct"&&(this.statContext.refDomain?p=(0,v.createURL)(this.statContext.refDomain)?.hostname??this.statContext.refDomain:document.referrer&&(p=(0,v.createURL)(document.referrer)?.hostname??document.referrer),h=location.href.substring(0,1024));let c={vsid:s,isid:u,vid:this.statContext.movieId,uid:this.zenUid$.getValue(),ct:this.statContext.contentType,place:this.isEmbed?"embed":this.statContext.place,quality:this.statContext.quality,cdn_host:this.statContext.cdnHostname,stat_type:this.statContext.autoplay===!0?"auto":this.statContext.autoplay===!1?"":void 0,param:r,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:d,connection_reused:l===!0?1:l===!1?0:void 0,cached_data:this.statContext.cached===!0?1:this.statContext.cached===!1?0:void 0,live:this.statContext.liveEdge?1:void 0,muted:this.statContext.audible===!1?1:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:1,ref_domain:p,direct_url:h,rate:this.statContext.rate===1||(0,v.isNullable)(this.statContext.rate)?void 0:this.statContext.rate.toFixed(2),view_360:this.statContext.is3d?1:void 0,aid:this.statContext.albumId,vk_playlist_id:this.statContext.vkPlaylistId,...o};for(let f of this.config.disabledCustomFields)delete c[f];return{operation:e,type:1,time:i,network:this.statContext.network,timestamp:n,custom:c}}};var Po={};Eo(Po,{SeekType:()=>rr,ThinOneStat:()=>ur,VERSION:()=>C});var T=require("@vkontakte/videoplayer-shared"),K=require("@vkontakte/videoplayer-core");var nd=require("@vkontakte/videoplayer-shared");var rr=(u=>(u.SLIDER="slider",u.DOUBLE_TAP="double_tap",u.TIME_CODE="time_code",u.EPISODE="episode",u.REWIND="rewind",u.LIVE="live",u.UNKNOWN="unknown",u))(rr||{});var od="CIOPGQJGDIHBABABA",vo={prod:"https://api.ok.ru",vk_alias:"https://api.mycdn.me",videotest:"https://videotestapi.ok.ru/api",test:"https://apitest.ok.ru",okcdn:"https://api.okcdn.ru",auto:""};var $y={apiKey:od,apiEnv:"vk_alias",requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageHeartbeatInterval:15,synchronizeTime:!0,useBeacon:!1,alwaysSendDesktop:!1},ad=t=>(0,nd.fillWithDefault)(t,$y);var go=A(Fi(),1),H=require("@vkontakte/videoplayer-shared");var ir=class{constructor(e){this.params=e,this.authorized$=new H.ValueSubject(!1),this.consequentAuthErrors=0}async authorize(e){return this.authToken=e??await this.refreshAuthToken(),this.authorizeWithBackoff()}logBeacon(e){let r="log.logUvStat",i=this.createLogParams(e),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(r,i,o)||this.logRequest(e).catch(()=>{})}async logRequest(e){let r="log.logUvStat",i=this.createLogParams(e),o={},n=this.sessionKey??await this.authorizeWithBackoff();if(!n)return;let s=async(u,d=this.params.config.requestRetryCount)=>{try{return await this.params.apiTransport.sendRequest(r,i,n,o)}catch(l){if(!l||!("error_code"in l)){this.params.error$.next({id:"logRequestUnknown",category:H.ErrorCategory.NETWORK,message:`Unknown ${r} error`,thrown:l});return}let p=l?.error_code;switch(p){case 102:case 103:case 104:return this.authorized$.next(!1),this.sessionKey=await this.authorizeWithBackoff(),d>0?s(u,d-1):void 0;case 401:return this.authorized$.next(!1),this.authToken=await this.refreshAuthToken(),this.sessionKey=await this.authorizeWithBackoff(),d>0?s(u,d-1):void 0;default:{this.params.error$.next({id:`LogRequest#${p}`,category:H.ErrorCategory.EXTERNAL_API,message:`${r} error`,data:l});return}}}};return s(e)}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}async refreshAuthToken(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=(0,go.default)(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise}createLogParams(e){return{collector:"ok.mobile.apps.video",uv_stat_data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${C}`,platform:e[0].platform,product:e[0].product,events:e})}}authorizeWithBackoff(){if(!this.consequentAuthErrors)return this.doAuthorize();let e=(0,H.getExponentialDelay)(this.consequentAuthErrors);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(async()=>{try{let i=await this.doAuthorize();r(i)}catch(i){this.params.error$.next({id:"AuthorizeBackoff",category:H.ErrorCategory.NETWORK,message:"Otherwise unhandled error in authorization",thrown:i})}finally{this.backoffTimeoutId=0}},e))})}doAuthorize(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);let e="auth.anonymLogin",r={session_data:{version:2,device_id:this.params.deviceId,client_version:C.split("-")[0],client_type:"SDK_JS"}};return this.authToken!==void 0&&(r.session_data.auth_token=this.authToken,r.session_data.version=3),this.authorizePromise=(0,go.default)(this.params.apiTransport.sendRequest(e,r).then(i=>((!i||!i.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:H.ErrorCategory.EXTERNAL_API,message:"No session key",data:i}),this.sessionKey=i?.session_key??void 0,this.sessionKey)).catch(async i=>{this.sessionKey=void 0;let o=i?.error_code;switch(o){case 401:return this.authToken=await this.refreshAuthToken(),this.authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:H.ErrorCategory.EXTERNAL_API,message:"authorize error",data:i}):this.params.error$.next({id:"AuthorizeUnknown",category:H.ErrorCategory.NETWORK,message:"authorize error",thrown:i})}),()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise}};var sd=A(Se(),1);var ud=A(Ce(),1),re=require("@vkontakte/videoplayer-shared");var or=class{constructor(e){this.params=e,this.apiKey=e.config.apiKey,this.apiEnv=e.config.apiEnv,this.apiBaseUrl=vo[this.apiEnv],this.timeSynchronisation=e.timeSynchronisation,this.isApiBaseUrlFetched=!1}sendBeacon(e,r,i){if(!window.Blob||!window.navigator.sendBeacon)return!1;let o=this.prepareQueryParams({method:e,queryParams:r,sessionKey:i}),n=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,n)}catch(s){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:re.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:s,data:{method:e,params:r}})}return!1}async sendRequest(e,r,i,o){let n=(0,re.now)(),s=u=>{if(u instanceof TypeError&&(0,sd.default)(["Failed to fetch","NetworkError when attempting to fetch resource."],u.message)){this.params.error$.next({id:"Network",category:re.ErrorCategory.NETWORK,message:"Request failed",thrown:u});return}this.params.error$.next({id:"ThinOneStat:ApiTransport:sendRequest",category:re.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:u,data:{method:e,params:r,sessionKey:i,time:(0,re.now)()-n}})};return this.apiBaseUrl=await this.resolveApiBaseUrl(),Le(`${this.apiBaseUrl}/fb.do`,{method:"post",headers:{"Content-type":"application/x-www-form-urlencoded",...o},body:this.prepareQueryParams({method:e,queryParams:r,sessionKey:i})}).then(u=>{let d=Number(u.headers.get("content-length"))===0,l=new Date(u.headers.get("date")??"").getTime(),p=(0,re.now)()-n;if(isFinite(l)&&this.timeSynchronisation?.addServerTime(l,p),!d)return u.json().then(h=>Object.prototype.hasOwnProperty.call(h,"error_msg")?Promise.reject(h):h,s)},s)}async resolveApiBaseUrl(){if(this.apiEnv!=="auto"||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{let e=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=(await(await Le(e,{method:"GET",mode:"cors",cache:"no-cache"})).json())?.Answer[0]?.data;if(!o)throw new Error("Wrong DNS response");return o}catch(e){return this.params.error$.next({id:"ThinOneStat:ApiTransport:resolveApiBaseUrl",category:re.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:e}),vo.vk_alias}finally{this.isApiBaseUrlFetched=!0}}prepareQueryParams(e){let r=new URLSearchParams({format:"JSON",method:e.method,application_key:this.apiKey});return e.sessionKey!==void 0&&r.append("session_key",e.sessionKey),(0,ud.default)(e.queryParams).forEach(([i,o])=>r.append(i,typeof o=="string"?o:JSON.stringify(o))),r}};var cd=A(Se(),1),ld=A(Ce(),1),V=require("@vkontakte/videoplayer-shared"),nr="thinonestat_events",mo=t=>e=>e.client_time+t>=(0,V.now)(),ar=class{constructor(e){this.unsaltedStorage=[];this.isPaused=!1;this.isUrgent=e=>{let{event_name:r}=e;return(0,cd.default)(["watch_coverage","watch_coverage_live","watched_n","playback_started"],r)};this.params=e,this.api=e.api,this.error$=e.error$,this.userSalt=e.userSalt,this.loggerDebugLog=e.debugLogger.createComponentLog("stat logger"),this.firstFlush=(0,V.debounceFn)(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});let r=V.safeStorage.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=(0,V.debounceFn)(()=>this.safeFlush(),this.params.config.flushDebounceTime,{maxWait:r}),this.subscription=this.api.authorized$.subscribe(i=>{i&&this.debouncedFlush()}),this.housekeepStorage()}safeFlush(){try{this.flush()}catch(e){this.error$.next({id:"LoggerError",category:V.ErrorCategory.WTF,message:String(e)||"Unknown logger error",thrown:e})}}readFromStorage(){let e=V.safeStorage.get(nr);try{return e?JSON.parse(e):{}}catch{}return{}}addToStorage(e){if(!this.userSalt){this.unsaltedStorage.push(e);return}let r=this.readFromStorage(),o=(r[this.userSalt]??[]).filter(mo(this.params.config.storageExpiration));V.safeStorage.set(nr,JSON.stringify({...r,[this.userSalt]:[...o,e]}))}getFromStorage(){return this.userSalt?(this.readFromStorage()[this.userSalt]??[]).filter(mo(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}let e=this.readFromStorage();delete e[this.userSalt],V.safeStorage.set(nr,JSON.stringify(e))}housekeepStorage(){let e=this.readFromStorage();for(let[r,i]of(0,ld.default)(e)){let o=i.filter(mo(this.params.config.storageExpiration));o.length?e[r]=o:delete e[r],this.loggerDebugLog({message:`${i.length} retrieved from storage, ${o.length} of them actual`})}V.safeStorage.set(nr,JSON.stringify(e))}log(e){this.addToStorage(e),!this.isPaused&&(this.isUrgent(e)?this.flush():this.lastVsid!==e.vsid?this.firstFlush():this.debouncedFlush(),this.lastVsid=e.vsid)}flush({wantBeacon:e,clearStorage:r}={wantBeacon:!1,clearStorage:!0}){let i=this.getFromStorage();i.length!==0&&(this.api.authorized$.getValue()?(e&&this.params.config.useBeacon?(this.loggerDebugLog({message:`Flushing ${i.length} events through beacon`}),this.api.logBeacon(i)):(this.loggerDebugLog({message:`Flushing ${i.length} events`}),this.api.logRequest(i)),r&&this.markStorageSent()):this.api.authorize(),this.firstFlush.cancel(),this.debouncedFlush.cancel())}pause(){this.isPaused=!0,this.debouncedFlush.cancel()}resume(){this.isPaused=!1,this.debouncedFlush()}destroy(){this.subscription.unsubscribe(),this.firstFlush.cancel(),this.debouncedFlush.cancel()}};function bo(){let t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),e=new Array(36),r=0,i,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?e[o]="-":o===14?e[o]="4":(r<=2&&(r=33554432+Math.random()*16777216|0),i=r&15,r=r>>4,e[o]=t[o===19?i&3|8:i]);return e.join("")}var sr=class{constructor(e){this.offset=void 0;this.offset=e}getOffset(){return this.offset??0}setOffset(e){this.offset=e}now(){return Date.now()+(this.offset??0)}date(e=new Date){return e.setTime(e.getTime()+(this.offset??0)),e}addServerTime(e,r){let i=Date.now(),o=e-i-r/2;if(Math.abs(o)<1e3){this.offset=0;return}this.offset===void 0?this.offset=Math.round(o):this.offset=Math.round(.2*o+(1-.2)*this.offset)}};var yo=require("@vkontakte/videoplayer-core"),E=require("@vkontakte/videoplayer-shared"),dd=(t,e)=>new E.Observable(r=>{let i=new E.Subscription,o=new E.ValueSubject(void 0),n;i.add(t.info.isLive$.pipe((0,E.filterChanged)()).subscribe(k=>{n&&(n.unsubscribe(),o.next(void 0)),k?n=t.info.liveTime$.pipe((0,E.filterChanged)()).subscribe(o):n=t.info.position$.subscribe(o),i.add(n)}));let{playing$:s,paused$:u,ended$:d,looped$:l}=t.events,p=t.events.willSeek$.pipe((0,E.filter)(()=>t.info.playbackState$.getValue()===yo.PlaybackState.PLAYING)),h=t.events.seeked$.pipe((0,E.filter)(()=>t.info.playbackState$.getValue()===yo.PlaybackState.PLAYING)),c=!1,f=new E.Subject;i.add(p.subscribe(()=>{c||f.next(),c=!0})).add(h.subscribe(()=>c=!1));let g=(0,E.merge)((0,E.fromEvent)(window,"beforeunload"),t.events.willDestruct$),y,S=()=>y=o.getValue(),I=()=>{let k=o.getValue();(0,E.isNullable)(y)||(0,E.isNullable)(k)||y===k||(r.next({from:y,to:k}),y=void 0)},P=new E.Subject,Q=new E.Subject,Y=(0,E.merge)(s,f,P),x=(0,E.merge)(u,h,g,d,l,Q);if(i.add(Y.subscribe(S)).add(x.subscribe(I)),e.heartbeatInterval&&isFinite(e.heartbeatInterval)){let k=[],qd=e.heartbeatInterval*1e3,Rd=()=>{Q.next(),P.next()};i.add(Y.subscribe(()=>{let dr=window.setTimeout(Rd,qd);k.push(dr)})).add(x.subscribe(()=>{k.forEach(dr=>{window.clearTimeout(dr)}),k=[]}))}return i});var fd=require("@vkontakte/videoplayer-core"),pd=require("@vkontakte/videoplayer-shared"),hd=(t,e)=>new pd.Observable(r=>{let i=new fd.Subscription,o=1e4,n=0;return i.add(t.info.position$.subscribe(()=>{let s=e.getTotalViewTime()*1e3;s>n&&s%o===0&&(n=s,r.next({target_duration:o,current_tvt:s}))})),i});var he=require("@vkontakte/videoplayer-shared"),vd=t=>new he.Observable(e=>{let r=new he.Subscription,i=0,o=1,n=0,s=!1,u=!1,d=()=>{if(!s)return;let x=Date.now();n+=(x-i)*o,i=x},l=()=>{(!s||u)&&(i=Date.now(),s=!0,u=!1)},p=()=>{s&&(d(),s=!1)},h=()=>{s&&(d(),s=!1,u=!0)},c=x=>{s&&d(),o=x,i=Date.now()},{started$:f,playing$:g,paused$:y,willSeek$:S,ended$:I,willDestruct$:P}=t.events,{currentPlaybackRate$:Q}=t.info;r.add(S.subscribe(h)).add((0,he.merge)(f,g).subscribe(l)).add((0,he.merge)(y,I,P).subscribe(p)).add(Q.subscribe(c));let Y=()=>{let x=n;return s&&(x+=(Date.now()-i)*o),Math.floor(x/1e3)};return e.next(Y),r});var Io=require("@vkontakte/videoplayer-shared"),b=require("@vkontakte/videoplayer-core");var So=t=>{if(t!==void 0)switch(t){case b.VideoFormat.MPEG:return"MP4";case b.VideoFormat.DASH:case b.VideoFormat.DASH_LIVE:return"DASH";case b.VideoFormat.DASH_SEP:return"DASH_SEP";case b.VideoFormat.DASH_ONDEMAND:return"ONDEMAND_DASH";case b.VideoFormat.HLS_ONDEMAND:return"ONDEMAND_HLS";case b.VideoFormat.HLS:case b.VideoFormat.HLS_LIVE:return"HLS";case b.VideoFormat.DASH_WEBM:case b.VideoFormat.DASH_LIVE_WEBM:return"WEBM";case b.VideoFormat.DASH_LIVE_CMAF:return"ONDEMAND_DASH_LIVE";case b.VideoFormat.HLS_LIVE_CMAF:return"ONDEMAND_HLS_LIVE";case b.VideoFormat.WEB_RTC_LIVE:return"WEBRTC";case b.VideoFormat.DASH_WEBM_AV1:return"AV1";case b.VideoFormat.DASH_STREAMS:return"MULTI_DASH";default:return(0,Io.assertNever)(t)}},oe=t=>{if(t!==void 0)switch(t){case b.VideoQuality.Q_144P:return"144p";case b.VideoQuality.Q_240P:return"240p";case b.VideoQuality.Q_360P:return"360p";case b.VideoQuality.Q_480P:return"480p";case b.VideoQuality.Q_720P:return"720p";case b.VideoQuality.Q_1080P:return"1080p";case b.VideoQuality.Q_1440P:return"1440p";case b.VideoQuality.Q_2160P:return"2160p";case b.VideoQuality.INVARIANT:case b.VideoQuality.Q_576P:case b.VideoQuality.Q_4320P:return"UNKNOWN";default:return(0,Io.assertNever)(t)}},gd=t=>{if(t!==void 0)switch(t){case"MP4":case"ONDEMAND_DASH":case"ONDEMAND_DASH_LIVE":case"ONDEMAND_HLS":case"ONDEMAND_HLS_LIVE":case"MULTI_DASH":case"WEBM":case"AV1":return"vod";case"DASH":case"HLS":case"WEBRTC":return"live";default:return}},md=(t,e,r)=>{if(t&&e)switch(t){case b.VideoFormat.MPEG:return r&&e[t]&&e[t][r];default:return e[t]?.url}},bd=t=>{if(t!==void 0)switch(t){case b.Surface.NONE:return;case b.Surface.INLINE:return"inline";case b.Surface.FULLSCREEN:return"fullscreen";case b.Surface.SECOND_SCREEN:return"chromecast";case b.Surface.PIP:return"pip_external"}},yd=t=>{if(t!==void 0)return t===b.Surface.INVISIBLE?"background":"foreground"};var _o=A(co(),1),Id=()=>(0,_o.default)(Math.floor(Math.random()*2**32).toString(36),13,"0"),Sd=()=>(0,_o.default)(Math.floor(Math.random()*2**64).toString(36),13,"0");var My="_thin-one-stat_",_d=`${My}deviceId`,Vy=()=>{let t=new T.Subscription;return{subscription:t,subscribe:(e,r)=>{e&&t.add(e.subscribe(r))}}},ur=class{constructor(e,r){this.debugLogger=new T.Logger;this.thinOneStatDebugLog=this.debugLogger.createComponentLog("ThinOneStat");this.eventNumber=1;this.seekAction$=new T.ValueSubject("unknown");this.playerSize$=new T.ValueSubject({width:0,height:0});this.vsid$=new T.ValueSubject(void 0);this.isid$=new T.ValueSubject(void 0);this.statContext=e,this.config=ad(r.config??{}),this.subscription=new T.Subscription,this.config.synchronizeTime&&(this.timeSynchronisation=new sr);let i=new T.Subject,o=T.safeStorage.get(_d);this.statContext.deviceId?this.deviceId=this.statContext.deviceId:o?this.deviceId=o:(this.deviceId=bo(),T.safeStorage.set(_d,this.deviceId)),this.resetViewSession(),r.useIsid&&this.isid$.next(r.isid??Sd());let n=new or({error$:i,config:this.config,timeSynchronisation:this.timeSynchronisation});this.api=new ir({config:this.config,apiTransport:n,error$:i,deviceId:this.deviceId,refreshAuthToken:r.refreshAuthToken}),this.logger=new ar({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:i,userSalt:r.userSalt});let{isEmbed:s,topOrigin:u}=(0,T.detectEmbed)();this.isEmbed=s,this.embedHostname=u?new URL(u).hostname:void 0}authorize(e){return this.api.authorize(e)}updateContext(e){this.statContext={...this.statContext,...e}}attachTo(e){let r=new T.Subscription,i=(n,s)=>r.add(n.subscribe(s));i(vd(e),n=>{this.getTotalViewTime=n}),i(e.info.isLive$,n=>this.isLive=n),i(e.info.position$,n=>this.position=n);let o;return i(e.info.hostname$,n=>{o!==void 0&&o!==n&&this.logFailover({cdn_host:n}),this.cdnHostname=o=n}),i(dd(e,{heartbeatInterval:this.config.watchCoverageHeartbeatInterval}),n=>{let s=Math.round(n.from*1e3),u=Math.round(n.to*1e3),d={watch_interval:`${s}-${u}`,in_history:!!this.statContext.inHistory,content_type:So(e.info.currentFormat$.getValue()),playback_quality:oe(e.info.currentQuality$.getValue()),recom_info:this.statContext.recomInfo};if(!e.info.isLive$.getValue())this.logWatchCoverage(d);else{let p=e.info.atLiveEdge$.getValue();this.logWatchCoverageLive({...d,live:!!p})}}),i(hd(e,{getTotalViewTime:this.getTotalViewTime}),n=>{this.logWatchedN(n)}),i((0,T.merge)(e.events.willStart$,e.events.looped$),n=>{n&&this.resetViewSession();let s={isid:this.isid$.getValue(),stream_profile:gd(So(e.info.currentFormat$.getValue())),dpi:K.clientChecker.display.pixelRatio,web_layout:K.clientChecker.device.isMobile?"mobile":"desktop",iframe_host:this.isEmbed?this.embedHostname??void 0:null,from_downloads:!0,preloaded:this.statContext.preload,navigation:this.statContext.navigation,recom_info:this.statContext.recomInfo};this.logStartSession(s)}),i(e.events.willReady$,()=>{if(this.statContext.preload){let n=e.info.currentFormat$.getValue(),s=e.info.availableSources$.getValue(),u=e.info.currentBuffer$.getValue(),d=e.info.currentQuality$.getValue(),l={target_buffer_time:u?u.end-u.start:void 0,playback_url:md(n,s,d),playback_quality:oe(d)};this.logPreloadStarted(l)}}),i(e.events.ready$,()=>{if(this.statContext.preload){let n=e.info.currentBuffer$.getValue(),s={buffer_time:n?n.end-n.start:void 0};this.logPreloadEnded(s)}}),i(e.events.playing$,()=>{this.logPlay()}),i(e.info.playbackState$,n=>{if(n===K.PlaybackState.PLAYING){let s=e.info.currentBuffer$.getValue(),u={buffer_time:s?s.end-s.start:void 0};if(this.logPlaying(u),this.isStarted)this.logResume();else{this.isStarted=!0;let d=e.info.currentQuality$.getValue(),l=e.info.isAutoQualityEnabled$.getValue(),p=e.info.muted$.getValue(),h=e.info.volume$.getValue(),c=e.info.surface$.getValue(),f=e.info.availableTextTracks$.getValue(),g=e.info.currentTextTrack$.getValue(),y=e.info.currentAudioStream$.getValue(),S=e.info.currentPlaybackRate$.getValue(),I={playback_quality:oe(d),user_quality:l?"auto":oe(d),player_width:this.playerSize$.getValue().width,player_height:this.playerSize$.getValue().height,muted:p,sound_volume:h,buffer_time:s?Math.round(s.end-s.start):void 0,mode:bd(c),visibility:yd(c),subtitles_enabled:!!g,auto_subtitles:!!f.find(({id:P})=>P===g)?.isAuto,audio_track_lang:y?.language,playback_rate:S,recom_info:this.statContext.recomInfo};this.logPlaybackStarted(I)}}else n===K.PlaybackState.PAUSED&&this.logPause()}),i(e.events.willSeek$,({to:n})=>{let s={target_position:n,seek_type:this.seekAction$.getValue()};this.logSeeking(s)}),i(e.events.seeked$,()=>{let s={target_position:e.info.position$.getValue(),seek_type:this.seekAction$.getValue()};this.logSeeked(s),this.seekAction$.next("unknown")}),i((0,T.merge)(e.info.isBuffering$,e.info.isStalled$),n=>{n&&this.logShowLoader()}),i(e.info.currentQuality$,n=>{if(n){let s=e.info.isAutoQualityEnabled$.getValue(),u=e.info.currentVideoStream$.getValue()?.codec,d=e.info.currentAudioStream$.getValue()?.codec,l={user_quality:s?"auto":oe(n),playback_quality:oe(n),download_quality:oe(n),codec_info:u&&d?`${u},${d}`:void 0,manual_switch:!s};this.logQualityChanged(l)}}),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToUi(e){let{subscribe:r,subscription:i}=Vy();return r(e.actionSeek$,this.seekAction$),r(e.playerSize$,this.playerSize$),this.subscription.add(i),i}getDeviceId(){return this.deviceId}resetViewSession(){this.thinOneStatDebugLog({message:"VSID reset"}),this.vsid$.next(Id()),this.eventNumber=0}destroy(){this.api.destroy()}createRequiredParams(e){let r=this.vsid$.getValue();(0,T.assertNonNullable)(r);let i=this.eventNumber++;return{vsid:r,uv_movie_id:this.statContext.movieId,event_name:e,client_time:Date.now(),application:`@vkontakte/videoplayer-statistics:${C}`,platform:`web:${K.clientChecker.device.isMobile?"mobile":"desktop"}`,product:this.statContext.product,event_number:i,playback_position:this.isLive?void 0:Math.round(this.position),current_tvt:this.getTotalViewTime(),cdn_host:this.cdnHostname}}createRequiredFatParams(){return{stats_version:C,browser:K.clientChecker.browser.current,browser_version:String(K.clientChecker.browser.currentVersion),os:K.clientChecker.device.current,os_version:"",device_type:K.clientChecker.device.isMobile?"mobile":"desktop",navigation:this.statContext.navigation}}log(e,r,i=!1){let o=this.createRequiredParams(e),n={};i&&(n=this.createRequiredFatParams()),this.logger.log({...o,...n,...r})}logWatchCoverage(e){this.log("watch_coverage",e,!0)}logWatchCoverageLive(e){this.log("watch_coverage_live",e,!0)}logWatchedN(e){this.log("watched_n",e,!0)}logStartSession(e){this.log("start_session",e,!0)}logPreloadStarted(e){this.log("preload_started",e)}logPreloadEnded(e){this.log("preload_ended",e)}logPlaybackStarted(e){this.log("playback_started",e,!0)}logPlay(){this.log("play")}logPlaying(e){this.log("playing",e)}logPause(){this.log("pause")}logResume(){this.log("resume")}logSeeking(e){this.log("seeking",e)}logSeeked(e){this.log("seeked",e)}logShowLoader(){this.log("show_loader")}logQualityChanged(e){this.log("quality_changed",e)}logFailover(e){this.log("failover",e)}resubscribeBeforeunload(){this.beforeunloadSubscription?.unsubscribe(),this.beforeunloadSubscription=(0,T.fromEvent)(window,"beforeunload").subscribe(()=>{}),this.subscription.add(this.beforeunloadSubscription)}};var Pd={};var Fy=(t,e={})=>{let i=e.timeout||1,o=performance.now();return window.setTimeout(()=>{t({get didTimeout(){return e.timeout?!1:performance.now()-o-1>i},timeRemaining(){return Math.max(0,1+(performance.now()-o))}})},1)},Uy=t=>window.clearTimeout(t),Ed=t=>typeof t=="function"&&t?.toString().endsWith("{ [native code] }"),Td=!Ed(window.requestIdleCallback)||!Ed(window.cancelIdleCallback),wd=Td?Fy:window.requestIdleCallback,Od=Td?Uy:window.cancelIdleCallback;var at=require("@vkontakte/videoplayer-core"),Ad=require("@vkontakte/videoplayer-shared");var cr=class{constructor(){this.startTime=null;this.stopTime=null;this.accumulatedTime=0}get time(){return Math.floor(this.timeMs/1e3)}get timeMs(){return this.startTime===null?0:(this.stopTime??this.now())-this.startTime-this.accumulatedTime}get isRunning(){return this.startTime!==null&&this.stopTime===null}start(){this.isRunning||(this.stopTime!==null?(this.accumulatedTime+=this.now()-this.stopTime,this.stopTime=null):this.startTime=this.now())}stop(){this.isRunning&&(this.stopTime=this.now())}reset(){this.startTime=null,this.stopTime=null,this.accumulatedTime=0}now(){return Date.now()}};var xd=()=>window.Image?new Image:document.createElement("img");var lr=class{constructor(e){this.position=0;this.started=!1;this.heartbeatPixels=[];this.heartbeatLastTimeSent={};this.idleCallbackIds=[];this.stopwatch=new cr;this.subscription=new at.Subscription;this.params=e;let r=new Ad.Logger;this.log=r.createComponentLog("MediascopePixel")}attachTo(e){this.subscription.add(e.info.playbackState$.subscribe(r=>this.onPlaybackState(r))).add(e.info.position$.subscribe(r=>this.onPosition(r))).add(e.info.atLiveEdge$.subscribe(r=>this.isActiveLive=r)),this.subscription.add(e.events.willSeek$.subscribe(()=>this.onWillSeek())).add(e.events.seeked$.subscribe(()=>this.onSeeked())).add(e.events.ended$.subscribe(()=>this.onEnded()))}destroy(){this.stopwatch.reset(),this.subscription.unsubscribe(),window.clearTimeout(this.heartbeatFirstTimeoutId),this.idleCallbackIds.forEach(e=>Od(e)),this.send("stop")}onPlaybackState(e){e===at.PlaybackState.PLAYING?this.started?this.play():this.start():e===at.PlaybackState.PAUSED&&this.pause()}start(){this.started=!0,this.stopwatch.start(),this.send("start"),this.heartbeatPixels=this.prepareHeartbeatPixels(),this.heartbeatInterval=this.heartbeatPixels[0]?.interval;let e=this.heartbeatPixels[0]?.url,r=this.heartbeatPixels[0]?.delay;if(r!==void 0&&e)try{this.heartbeatFirstTimeoutId=window.setTimeout(()=>{this.sendHeartbeat(e)},r*1e3)}catch(i){this.log({message:i.message})}}play(){this.stopwatch.start(),this.send("resume")}pause(){this.stopwatch.stop(),this.send("pause")}onPosition(e){if(this.position=e,this.heartbeatInterval&&this.stopwatch.time!==0&&this.stopwatch.time%this.heartbeatInterval===0)for(let[r,{url:i}]of this.heartbeatPixels.entries())this.heartbeatLastTimeSent[r]!==this.stopwatch.time&&(this.heartbeatLastTimeSent[r]=this.stopwatch.time,this.sendHeartbeat(i))}onWillSeek(){this.started&&this.send("stop")}onSeeked(){this.started&&this.send("start")}onEnded(){this.stopwatch.stop(),this.send("stop")}validatePixels(e,r){return e?.filter(i=>i.event===r.event&&r.keys.every(o=>!!i[o]))}getFrameTimestamp(){let e;if(this.isActiveLive){let r=Math.floor(Math.random()*25)+5;e=Date.now()/1e3-r}else e=this.position||0;return Math.floor(e)}getUTC(){return Math.floor(Date.now()/1e3)}prepareUrl(e){let r=new URL(e);return r.pathname=r.pathname.replace("{@fts_fake_sec}",String(this.getFrameTimestamp())).replace("{@utc_sec}",String(this.getUTC())),r.search=[...new URLSearchParams(r.search)].filter(([i,o])=>!/={@[\w]+}/.test(`${i}=${o}`)).map(i=>i.join("=")).join("&"),r.toString()}preparePixels(e){return this.validatePixels(this.params.pixels,{event:e,keys:["url"]})}prepareHeartbeatPixels(){return this.validatePixels(this.params.pixels,{event:"heartbeat",keys:["url","interval"]})}call(e){try{this.idleCallbackIds.push(wd(()=>xd().src=this.prepareUrl(e)))}catch(r){this.log({message:r.message})}}send(e){let r=this.preparePixels(e);for(let{url:i}of r)this.call(i)}sendHeartbeat(e){this.call(e)}};
6
+ "use strict";var Cd=Object.create;var st=Object.defineProperty;var kd=Object.getOwnPropertyDescriptor;var Ld=Object.getOwnPropertyNames;var Nd=Object.getPrototypeOf,Dd=Object.prototype.hasOwnProperty;var a=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Eo=(t,e)=>{for(var r in e)st(t,r,{get:e[r],enumerable:!0})},To=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ld(e))!Dd.call(t,o)&&o!==r&&st(t,o,{get:()=>e[o],enumerable:!(i=kd(e,o))||i.enumerable});return t};var A=(t,e,r)=>(r=t!=null?Cd(Nd(t)):{},To(e||!t||!t.__esModule?st(r,"default",{value:t,enumerable:!0}):r,t)),$d=t=>To(st({},"__esModule",{value:!0}),t);var w=a((fr,wo)=>{"use strict";var Ne=function(t){return t&&t.Math===Math&&t};wo.exports=Ne(typeof globalThis=="object"&&globalThis)||Ne(typeof window=="object"&&window)||Ne(typeof self=="object"&&self)||Ne(typeof global=="object"&&global)||Ne(typeof fr=="object"&&fr)||function(){return this}()||Function("return this")()});var q=a((Wy,Oo)=>{"use strict";Oo.exports=function(t){try{return!!t()}catch{return!0}}});var De=a((Hy,xo)=>{"use strict";var Md=q();xo.exports=!Md(function(){var t=function(){}.bind();return typeof t!="function"||t.hasOwnProperty("prototype")})});var pr=a((Ky,Co)=>{"use strict";var Vd=De(),Ro=Function.prototype,Ao=Ro.apply,qo=Ro.call;Co.exports=typeof Reflect=="object"&&Reflect.apply||(Vd?qo.bind(Ao):function(){return qo.apply(Ao,arguments)})});var R=a((Gy,No)=>{"use strict";var ko=De(),Lo=Function.prototype,hr=Lo.call,Fd=ko&&Lo.bind.bind(hr,hr);No.exports=ko?Fd:function(t){return function(){return hr.apply(t,arguments)}}});var $e=a((zy,$o)=>{"use strict";var Do=R(),Ud=Do({}.toString),Bd=Do("".slice);$o.exports=function(t){return Bd(Ud(t),8,-1)}});var vr=a((Qy,Mo)=>{"use strict";var jd=$e(),Wd=R();Mo.exports=function(t){if(jd(t)==="Function")return Wd(t)}});var O=a((Yy,Vo)=>{"use strict";var gr=typeof document=="object"&&document.all;Vo.exports=typeof gr>"u"&&gr!==void 0?function(t){return typeof t=="function"||t===gr}:function(t){return typeof t=="function"}});var L=a((Jy,Fo)=>{"use strict";var Hd=q();Fo.exports=!Hd(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var F=a((Xy,Uo)=>{"use strict";var Kd=De(),ut=Function.prototype.call;Uo.exports=Kd?ut.bind(ut):function(){return ut.apply(ut,arguments)}});var mr=a(Wo=>{"use strict";var Bo={}.propertyIsEnumerable,jo=Object.getOwnPropertyDescriptor,Gd=jo&&!Bo.call({1:2},1);Wo.f=Gd?function(e){var r=jo(this,e);return!!r&&r.enumerable}:Bo});var Me=a((eI,Ho)=>{"use strict";Ho.exports=function(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}}});var Go=a((tI,Ko)=>{"use strict";var zd=R(),Qd=q(),Yd=$e(),br=Object,Jd=zd("".split);Ko.exports=Qd(function(){return!br("z").propertyIsEnumerable(0)})?function(t){return Yd(t)==="String"?Jd(t,""):br(t)}:br});var Ve=a((rI,zo)=>{"use strict";zo.exports=function(t){return t==null}});var ve=a((iI,Qo)=>{"use strict";var Xd=Ve(),Zd=TypeError;Qo.exports=function(t){if(Xd(t))throw new Zd("Can't call method on "+t);return t}});var ne=a((oI,Yo)=>{"use strict";var ef=Go(),tf=ve();Yo.exports=function(t){return ef(tf(t))}});var U=a((nI,Jo)=>{"use strict";var rf=O();Jo.exports=function(t){return typeof t=="object"?t!==null:rf(t)}});var ge=a((aI,Xo)=>{"use strict";Xo.exports={}});var J=a((sI,en)=>{"use strict";var yr=ge(),Ir=w(),of=O(),Zo=function(t){return of(t)?t:void 0};en.exports=function(t,e){return arguments.length<2?Zo(yr[t])||Zo(Ir[t]):yr[t]&&yr[t][e]||Ir[t]&&Ir[t][e]}});var ct=a((uI,tn)=>{"use strict";var nf=R();tn.exports=nf({}.isPrototypeOf)});var ae=a((cI,nn)=>{"use strict";var af=w(),rn=af.navigator,on=rn&&rn.userAgent;nn.exports=on?String(on):""});var _r=a((lI,dn)=>{"use strict";var ln=w(),Sr=ae(),an=ln.process,sn=ln.Deno,un=an&&an.versions||sn&&sn.version,cn=un&&un.v8,B,lt;cn&&(B=cn.split("."),lt=B[0]>0&&B[0]<4?1:+(B[0]+B[1]));!lt&&Sr&&(B=Sr.match(/Edge\/(\d+)/),(!B||B[1]>=74)&&(B=Sr.match(/Chrome\/(\d+)/),B&&(lt=+B[1])));dn.exports=lt});var Pr=a((dI,pn)=>{"use strict";var fn=_r(),sf=q(),uf=w(),cf=uf.String;pn.exports=!!Object.getOwnPropertySymbols&&!sf(function(){var t=Symbol("symbol detection");return!cf(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&fn&&fn<41})});var Er=a((fI,hn)=>{"use strict";var lf=Pr();hn.exports=lf&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Tr=a((pI,vn)=>{"use strict";var df=J(),ff=O(),pf=ct(),hf=Er(),vf=Object;vn.exports=hf?function(t){return typeof t=="symbol"}:function(t){var e=df("Symbol");return ff(e)&&pf(e.prototype,vf(t))}});var Fe=a((hI,gn)=>{"use strict";var gf=String;gn.exports=function(t){try{return gf(t)}catch{return"Object"}}});var X=a((vI,mn)=>{"use strict";var mf=O(),bf=Fe(),yf=TypeError;mn.exports=function(t){if(mf(t))return t;throw new yf(bf(t)+" is not a function")}});var dt=a((gI,bn)=>{"use strict";var If=X(),Sf=Ve();bn.exports=function(t,e){var r=t[e];return Sf(r)?void 0:If(r)}});var In=a((mI,yn)=>{"use strict";var wr=F(),Or=O(),xr=U(),_f=TypeError;yn.exports=function(t,e){var r,i;if(e==="string"&&Or(r=t.toString)&&!xr(i=wr(r,t))||Or(r=t.valueOf)&&!xr(i=wr(r,t))||e!=="string"&&Or(r=t.toString)&&!xr(i=wr(r,t)))return i;throw new _f("Can't convert object to primitive value")}});var G=a((bI,Sn)=>{"use strict";Sn.exports=!0});var En=a((yI,Pn)=>{"use strict";var _n=w(),Pf=Object.defineProperty;Pn.exports=function(t,e){try{Pf(_n,t,{value:e,configurable:!0,writable:!0})}catch{_n[t]=e}return e}});var Ue=a((II,On)=>{"use strict";var Ef=G(),Tf=w(),wf=En(),Tn="__core-js_shared__",wn=On.exports=Tf[Tn]||wf(Tn,{});(wn.versions||(wn.versions=[])).push({version:"3.43.0",mode:Ef?"pure":"global",copyright:"\xA9 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.43.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var Ar=a((SI,An)=>{"use strict";var xn=Ue();An.exports=function(t,e){return xn[t]||(xn[t]=e||{})}});var qr=a((_I,qn)=>{"use strict";var Of=ve(),xf=Object;qn.exports=function(t){return xf(Of(t))}});var z=a((PI,Rn)=>{"use strict";var Af=R(),qf=qr(),Rf=Af({}.hasOwnProperty);Rn.exports=Object.hasOwn||function(e,r){return Rf(qf(e),r)}});var Rr=a((EI,Cn)=>{"use strict";var Cf=R(),kf=0,Lf=Math.random(),Nf=Cf(1.1.toString);Cn.exports=function(t){return"Symbol("+(t===void 0?"":t)+")_"+Nf(++kf+Lf,36)}});var N=a((TI,Ln)=>{"use strict";var Df=w(),$f=Ar(),kn=z(),Mf=Rr(),Vf=Pr(),Ff=Er(),me=Df.Symbol,Cr=$f("wks"),Uf=Ff?me.for||me:me&&me.withoutSetter||Mf;Ln.exports=function(t){return kn(Cr,t)||(Cr[t]=Vf&&kn(me,t)?me[t]:Uf("Symbol."+t)),Cr[t]}});var Mn=a((wI,$n)=>{"use strict";var Bf=F(),Nn=U(),Dn=Tr(),jf=dt(),Wf=In(),Hf=N(),Kf=TypeError,Gf=Hf("toPrimitive");$n.exports=function(t,e){if(!Nn(t)||Dn(t))return t;var r=jf(t,Gf),i;if(r){if(e===void 0&&(e="default"),i=Bf(r,t,e),!Nn(i)||Dn(i))return i;throw new Kf("Can't convert object to primitive value")}return e===void 0&&(e="number"),Wf(t,e)}});var kr=a((OI,Vn)=>{"use strict";var zf=Mn(),Qf=Tr();Vn.exports=function(t){var e=zf(t,"string");return Qf(e)?e:e+""}});var ft=a((xI,Un)=>{"use strict";var Yf=w(),Fn=U(),Lr=Yf.document,Jf=Fn(Lr)&&Fn(Lr.createElement);Un.exports=function(t){return Jf?Lr.createElement(t):{}}});var Nr=a((AI,Bn)=>{"use strict";var Xf=L(),Zf=q(),ep=ft();Bn.exports=!Xf&&!Zf(function(){return Object.defineProperty(ep("div"),"a",{get:function(){return 7}}).a!==7})});var Hn=a(Wn=>{"use strict";var tp=L(),rp=F(),ip=mr(),op=Me(),np=ne(),ap=kr(),sp=z(),up=Nr(),jn=Object.getOwnPropertyDescriptor;Wn.f=tp?jn:function(e,r){if(e=np(e),r=ap(r),up)try{return jn(e,r)}catch{}if(sp(e,r))return op(!rp(ip.f,e,r),e[r])}});var Dr=a((RI,Kn)=>{"use strict";var cp=q(),lp=O(),dp=/#|\.prototype\./,Be=function(t,e){var r=pp[fp(t)];return r===vp?!0:r===hp?!1:lp(e)?cp(e):!!e},fp=Be.normalize=function(t){return String(t).replace(dp,".").toLowerCase()},pp=Be.data={},hp=Be.NATIVE="N",vp=Be.POLYFILL="P";Kn.exports=Be});var je=a((CI,zn)=>{"use strict";var Gn=vr(),gp=X(),mp=De(),bp=Gn(Gn.bind);zn.exports=function(t,e){return gp(t),e===void 0?t:mp?bp(t,e):function(){return t.apply(e,arguments)}}});var $r=a((kI,Qn)=>{"use strict";var yp=L(),Ip=q();Qn.exports=yp&&Ip(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var Z=a((LI,Yn)=>{"use strict";var Sp=U(),_p=String,Pp=TypeError;Yn.exports=function(t){if(Sp(t))return t;throw new Pp(_p(t)+" is not an object")}});var se=a(Xn=>{"use strict";var Ep=L(),Tp=Nr(),wp=$r(),pt=Z(),Jn=kr(),Op=TypeError,Mr=Object.defineProperty,xp=Object.getOwnPropertyDescriptor,Vr="enumerable",Fr="configurable",Ur="writable";Xn.f=Ep?wp?function(e,r,i){if(pt(e),r=Jn(r),pt(i),typeof e=="function"&&r==="prototype"&&"value"in i&&Ur in i&&!i[Ur]){var o=xp(e,r);o&&o[Ur]&&(e[r]=i.value,i={configurable:Fr in i?i[Fr]:o[Fr],enumerable:Vr in i?i[Vr]:o[Vr],writable:!1})}return Mr(e,r,i)}:Mr:function(e,r,i){if(pt(e),r=Jn(r),pt(i),Tp)try{return Mr(e,r,i)}catch{}if("get"in i||"set"in i)throw new Op("Accessors not supported");return"value"in i&&(e[r]=i.value),e}});var be=a((DI,Zn)=>{"use strict";var Ap=L(),qp=se(),Rp=Me();Zn.exports=Ap?function(t,e,r){return qp.f(t,e,Rp(1,r))}:function(t,e,r){return t[e]=r,t}});var D=a(($I,ta)=>{"use strict";var We=w(),Cp=pr(),kp=vr(),Lp=O(),Np=Hn().f,Dp=Dr(),ye=ge(),$p=je(),Ie=be(),ea=z();Ue();var Mp=function(t){var e=function(r,i,o){if(this instanceof e){switch(arguments.length){case 0:return new t;case 1:return new t(r);case 2:return new t(r,i)}return new t(r,i,o)}return Cp(t,this,arguments)};return e.prototype=t.prototype,e};ta.exports=function(t,e){var r=t.target,i=t.global,o=t.stat,n=t.proto,s=i?We:o?We[r]:We[r]&&We[r].prototype,u=i?ye:ye[r]||Ie(ye,r,{})[r],d=u.prototype,l,p,h,c,f,g,y,S,I;for(c in e)l=Dp(i?c:r+(o?".":"#")+c,t.forced),p=!l&&s&&ea(s,c),g=u[c],p&&(t.dontCallGetSet?(I=Np(s,c),y=I&&I.value):y=s[c]),f=p&&y?y:e[c],!(!l&&!n&&typeof g==typeof f)&&(t.bind&&p?S=$p(f,We):t.wrap&&p?S=Mp(f):n&&Lp(f)?S=kp(f):S=f,(t.sham||f&&f.sham||g&&g.sham)&&Ie(S,"sham",!0),Ie(u,c,S),n&&(h=r+"Prototype",ea(ye,h)||Ie(ye,h,{}),Ie(ye[h],c,f),t.real&&d&&(l||!d[c])&&Ie(d,c,f)))}});var ia=a((MI,ra)=>{"use strict";var Vp=Math.ceil,Fp=Math.floor;ra.exports=Math.trunc||function(e){var r=+e;return(r>0?Fp:Vp)(r)}});var ht=a((VI,oa)=>{"use strict";var Up=ia();oa.exports=function(t){var e=+t;return e!==e||e===0?0:Up(e)}});var aa=a((FI,na)=>{"use strict";var Bp=ht(),jp=Math.max,Wp=Math.min;na.exports=function(t,e){var r=Bp(t);return r<0?jp(r+e,0):Wp(r,e)}});var Br=a((UI,sa)=>{"use strict";var Hp=ht(),Kp=Math.min;sa.exports=function(t){var e=Hp(t);return e>0?Kp(e,9007199254740991):0}});var jr=a((BI,ua)=>{"use strict";var Gp=Br();ua.exports=function(t){return Gp(t.length)}});var Wr=a((jI,la)=>{"use strict";var zp=ne(),Qp=aa(),Yp=jr(),ca=function(t){return function(e,r,i){var o=zp(e),n=Yp(o);if(n===0)return!t&&-1;var s=Qp(i,n),u;if(t&&r!==r){for(;n>s;)if(u=o[s++],u!==u)return!0}else for(;n>s;s++)if((t||s in o)&&o[s]===r)return t||s||0;return!t&&-1}};la.exports={includes:ca(!0),indexOf:ca(!1)}});var Hr=a((WI,da)=>{"use strict";da.exports=function(){}});var fa=a(()=>{"use strict";var Jp=D(),Xp=Wr().includes,Zp=q(),eh=Hr(),th=Zp(function(){return!Array(1).includes()});Jp({target:"Array",proto:!0,forced:th},{includes:function(e){return Xp(this,e,arguments.length>1?arguments[1]:void 0)}});eh("includes")});var vt=a((GI,pa)=>{"use strict";var rh=J();pa.exports=rh});var va=a((zI,ha)=>{"use strict";fa();var ih=vt();ha.exports=ih("Array","includes")});var ma=a((QI,ga)=>{"use strict";var oh=va();ga.exports=oh});var Se=a((YI,ba)=>{"use strict";var nh=ma();ba.exports=nh});var wa=a(()=>{"use strict"});var Qr=a((uS,Oa)=>{"use strict";var He=w(),sh=ae(),uh=$e(),It=function(t){return sh.slice(0,t.length)===t};Oa.exports=function(){return It("Bun/")?"BUN":It("Cloudflare-Workers")?"CLOUDFLARE":It("Deno/")?"DENO":It("Node.js/")?"NODE":He.Bun&&typeof Bun.version=="string"?"BUN":He.Deno&&typeof Deno.version=="object"?"DENO":uh(He.process)==="process"?"NODE":He.window&&He.document?"BROWSER":"REST"}()});var St=a((cS,xa)=>{"use strict";var ch=Qr();xa.exports=ch==="NODE"});var Pe=a((lS,Aa)=>{"use strict";var lh=be();Aa.exports=function(t,e,r,i){return i&&i.enumerable?t[e]=r:lh(t,e,r),t}});var Ra=a((dS,qa)=>{"use strict";var dh=R(),fh=X();qa.exports=function(t,e,r){try{return dh(fh(Object.getOwnPropertyDescriptor(t,e)[r]))}catch{}}});var ka=a((fS,Ca)=>{"use strict";var ph=U();Ca.exports=function(t){return ph(t)||t===null}});var Na=a((pS,La)=>{"use strict";var hh=ka(),vh=String,gh=TypeError;La.exports=function(t){if(hh(t))return t;throw new gh("Can't set "+vh(t)+" as a prototype")}});var Yr=a((hS,Da)=>{"use strict";var mh=Ra(),bh=U(),yh=ve(),Ih=Na();Da.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t=!1,e={},r;try{r=mh(Object.prototype,"__proto__","set"),r(e,[]),t=e instanceof Array}catch{}return function(o,n){return yh(o),Ih(n),bh(o)&&(t?r(o,n):o.__proto__=n),o}}():void 0)});var _t=a((vS,Ma)=>{"use strict";var Sh=N(),_h=Sh("toStringTag"),$a={};$a[_h]="z";Ma.exports=String($a)==="[object z]"});var Ke=a((gS,Va)=>{"use strict";var Ph=_t(),Eh=O(),Pt=$e(),Th=N(),wh=Th("toStringTag"),Oh=Object,xh=Pt(function(){return arguments}())==="Arguments",Ah=function(t,e){try{return t[e]}catch{}};Va.exports=Ph?Pt:function(t){var e,r,i;return t===void 0?"Undefined":t===null?"Null":typeof(r=Ah(e=Oh(t),wh))=="string"?r:xh?Pt(e):(i=Pt(e))==="Object"&&Eh(e.callee)?"Arguments":i}});var Ua=a((mS,Fa)=>{"use strict";var qh=_t(),Rh=Ke();Fa.exports=qh?{}.toString:function(){return"[object "+Rh(this)+"]"}});var Ge=a((bS,ja)=>{"use strict";var Ch=_t(),kh=se().f,Lh=be(),Nh=z(),Dh=Ua(),$h=N(),Ba=$h("toStringTag");ja.exports=function(t,e,r,i){var o=r?t:t&&t.prototype;o&&(Nh(o,Ba)||kh(o,Ba,{configurable:!0,value:e}),i&&!Ch&&Lh(o,"toString",Dh))}});var Ha=a((yS,Wa)=>{"use strict";var Mh=se();Wa.exports=function(t,e,r){return Mh.f(t,e,r)}});var za=a((IS,Ga)=>{"use strict";var Vh=J(),Fh=Ha(),Uh=N(),Bh=L(),Ka=Uh("species");Ga.exports=function(t){var e=Vh(t);Bh&&e&&!e[Ka]&&Fh(e,Ka,{configurable:!0,get:function(){return this}})}});var Ya=a((SS,Qa)=>{"use strict";var jh=ct(),Wh=TypeError;Qa.exports=function(t,e){if(jh(e,t))return t;throw new Wh("Incorrect invocation")}});var Xr=a((_S,Ja)=>{"use strict";var Hh=R(),Kh=O(),Jr=Ue(),Gh=Hh(Function.toString);Kh(Jr.inspectSource)||(Jr.inspectSource=function(t){return Gh(t)});Ja.exports=Jr.inspectSource});var is=a((PS,rs)=>{"use strict";var zh=R(),Qh=q(),Xa=O(),Yh=Ke(),Jh=J(),Xh=Xr(),Za=function(){},es=Jh("Reflect","construct"),Zr=/^\s*(?:class|function)\b/,Zh=zh(Zr.exec),ev=!Zr.test(Za),ze=function(e){if(!Xa(e))return!1;try{return es(Za,[],e),!0}catch{return!1}},ts=function(e){if(!Xa(e))return!1;switch(Yh(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ev||!!Zh(Zr,Xh(e))}catch{return!0}};ts.sham=!0;rs.exports=!es||Qh(function(){var t;return ze(ze.call)||!ze(Object)||!ze(function(){t=!0})||t})?ts:ze});var ns=a((ES,os)=>{"use strict";var tv=is(),rv=Fe(),iv=TypeError;os.exports=function(t){if(tv(t))return t;throw new iv(rv(t)+" is not a constructor")}});var ei=a((TS,ss)=>{"use strict";var as=Z(),ov=ns(),nv=Ve(),av=N(),sv=av("species");ss.exports=function(t,e){var r=as(t).constructor,i;return r===void 0||nv(i=as(r)[sv])?e:ov(i)}});var ti=a((wS,us)=>{"use strict";var uv=J();us.exports=uv("document","documentElement")});var ls=a((OS,cs)=>{"use strict";var cv=R();cs.exports=cv([].slice)});var fs=a((xS,ds)=>{"use strict";var lv=TypeError;ds.exports=function(t,e){if(t<e)throw new lv("Not enough arguments");return t}});var ri=a((AS,ps)=>{"use strict";var dv=ae();ps.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(dv)});var di=a((qS,_s)=>{"use strict";var $=w(),fv=pr(),pv=je(),hs=O(),hv=z(),Ss=q(),vs=ti(),vv=ls(),gs=ft(),gv=fs(),mv=ri(),bv=St(),ui=$.setImmediate,ci=$.clearImmediate,yv=$.process,ii=$.Dispatch,Iv=$.Function,ms=$.MessageChannel,Sv=$.String,oi=0,Qe={},bs="onreadystatechange",Ye,ue,ni,ai;Ss(function(){Ye=$.location});var li=function(t){if(hv(Qe,t)){var e=Qe[t];delete Qe[t],e()}},si=function(t){return function(){li(t)}},ys=function(t){li(t.data)},Is=function(t){$.postMessage(Sv(t),Ye.protocol+"//"+Ye.host)};(!ui||!ci)&&(ui=function(e){gv(arguments.length,1);var r=hs(e)?e:Iv(e),i=vv(arguments,1);return Qe[++oi]=function(){fv(r,void 0,i)},ue(oi),oi},ci=function(e){delete Qe[e]},bv?ue=function(t){yv.nextTick(si(t))}:ii&&ii.now?ue=function(t){ii.now(si(t))}:ms&&!mv?(ni=new ms,ai=ni.port2,ni.port1.onmessage=ys,ue=pv(ai.postMessage,ai)):$.addEventListener&&hs($.postMessage)&&!$.importScripts&&Ye&&Ye.protocol!=="file:"&&!Ss(Is)?(ue=Is,$.addEventListener("message",ys,!1)):bs in gs("script")?ue=function(t){vs.appendChild(gs("script"))[bs]=function(){vs.removeChild(this),li(t)}}:ue=function(t){setTimeout(si(t),0)});_s.exports={set:ui,clear:ci}});var Ts=a((RS,Es)=>{"use strict";var Ps=w(),_v=L(),Pv=Object.getOwnPropertyDescriptor;Es.exports=function(t){if(!_v)return Ps[t];var e=Pv(Ps,t);return e&&e.value}});var fi=a((CS,Os)=>{"use strict";var ws=function(){this.head=null,this.tail=null};ws.prototype={add:function(t){var e={item:t,next:null},r=this.tail;r?r.next=e:this.head=e,this.tail=e},get:function(){var t=this.head;if(t){var e=this.head=t.next;return e===null&&(this.tail=null),t.item}}};Os.exports=ws});var As=a((kS,xs)=>{"use strict";var Ev=ae();xs.exports=/ipad|iphone|ipod/i.test(Ev)&&typeof Pebble<"u"});var Rs=a((LS,qs)=>{"use strict";var Tv=ae();qs.exports=/web0s(?!.*chrome)/i.test(Tv)});var Ms=a((NS,$s)=>{"use strict";var Te=w(),wv=Ts(),Cs=je(),pi=di().set,Ov=fi(),xv=ri(),Av=As(),qv=Rs(),hi=St(),ks=Te.MutationObserver||Te.WebKitMutationObserver,Ls=Te.document,Ns=Te.process,Et=Te.Promise,mi=wv("queueMicrotask"),Ee,vi,gi,Tt,Ds;mi||(Je=new Ov,Xe=function(){var t,e;for(hi&&(t=Ns.domain)&&t.exit();e=Je.get();)try{e()}catch(r){throw Je.head&&Ee(),r}t&&t.enter()},!xv&&!hi&&!qv&&ks&&Ls?(vi=!0,gi=Ls.createTextNode(""),new ks(Xe).observe(gi,{characterData:!0}),Ee=function(){gi.data=vi=!vi}):!Av&&Et&&Et.resolve?(Tt=Et.resolve(void 0),Tt.constructor=Et,Ds=Cs(Tt.then,Tt),Ee=function(){Ds(Xe)}):hi?Ee=function(){Ns.nextTick(Xe)}:(pi=Cs(pi,Te),Ee=function(){pi(Xe)}),mi=function(t){Je.head||Ee(),Je.add(t)});var Je,Xe;$s.exports=mi});var Fs=a((DS,Vs)=>{"use strict";Vs.exports=function(t,e){try{arguments.length===1?console.error(t):console.error(t,e)}catch{}}});var wt=a(($S,Us)=>{"use strict";Us.exports=function(t){try{return{error:!1,value:t()}}catch(e){return{error:!0,value:e}}}});var Ws=a((MS,js)=>{"use strict";var Rv=w(),Cv=O(),Bs=Rv.WeakMap;js.exports=Cv(Bs)&&/native code/.test(String(Bs))});var Ot=a((VS,Ks)=>{"use strict";var kv=Ar(),Lv=Rr(),Hs=kv("keys");Ks.exports=function(t){return Hs[t]||(Hs[t]=Lv(t))}});var xt=a((FS,Gs)=>{"use strict";Gs.exports={}});var Si=a((US,Ys)=>{"use strict";var Nv=Ws(),Qs=w(),Dv=U(),$v=be(),bi=z(),yi=Ue(),Mv=Ot(),Vv=xt(),zs="Object already initialized",Ii=Qs.TypeError,Fv=Qs.WeakMap,At,Ze,qt,Uv=function(t){return qt(t)?Ze(t):At(t,{})},Bv=function(t){return function(e){var r;if(!Dv(e)||(r=Ze(e)).type!==t)throw new Ii("Incompatible receiver, "+t+" required");return r}};Nv||yi.state?(j=yi.state||(yi.state=new Fv),j.get=j.get,j.has=j.has,j.set=j.set,At=function(t,e){if(j.has(t))throw new Ii(zs);return e.facade=t,j.set(t,e),e},Ze=function(t){return j.get(t)||{}},qt=function(t){return j.has(t)}):(ce=Mv("state"),Vv[ce]=!0,At=function(t,e){if(bi(t,ce))throw new Ii(zs);return e.facade=t,$v(t,ce,e),e},Ze=function(t){return bi(t,ce)?t[ce]:{}},qt=function(t){return bi(t,ce)});var j,ce;Ys.exports={set:At,get:Ze,has:qt,enforce:Uv,getterFor:Bv}});var le=a((BS,Js)=>{"use strict";var jv=w();Js.exports=jv.Promise});var we=a((jS,tu)=>{"use strict";var Wv=w(),et=le(),Hv=O(),Kv=Dr(),Gv=Xr(),zv=N(),Xs=Qr(),Qv=G(),_i=_r(),Zs=et&&et.prototype,Yv=zv("species"),Pi=!1,eu=Hv(Wv.PromiseRejectionEvent),Jv=Kv("Promise",function(){var t=Gv(et),e=t!==String(et);if(!e&&_i===66||Qv&&!(Zs.catch&&Zs.finally))return!0;if(!_i||_i<51||!/native code/.test(t)){var r=new et(function(n){n(1)}),i=function(n){n(function(){},function(){})},o=r.constructor={};if(o[Yv]=i,Pi=r.then(function(){})instanceof i,!Pi)return!0}return!e&&(Xs==="BROWSER"||Xs==="DENO")&&!eu});tu.exports={CONSTRUCTOR:Jv,REJECTION_EVENT:eu,SUBCLASSING:Pi}});var Oe=a((WS,iu)=>{"use strict";var ru=X(),Xv=TypeError,Zv=function(t){var e,r;this.promise=new t(function(i,o){if(e!==void 0||r!==void 0)throw new Xv("Bad Promise constructor");e=i,r=o}),this.resolve=ru(e),this.reject=ru(r)};iu.exports.f=function(t){return new Zv(t)}});var Pu=a(()=>{"use strict";var eg=D(),tg=G(),Lt=St(),ie=w(),rg=ge(),Re=F(),ou=Pe(),nu=Yr(),ig=Ge(),og=za(),ng=X(),kt=O(),ag=U(),sg=Ya(),ug=ei(),lu=di().set,xi=Ms(),cg=Fs(),lg=wt(),dg=fi(),du=Si(),Nt=le(),Ai=we(),fu=Oe(),Dt="Promise",pu=Ai.CONSTRUCTOR,fg=Ai.REJECTION_EVENT,pg=Ai.SUBCLASSING,Ei=du.getterFor(Dt),hg=du.set,xe=Nt&&Nt.prototype,de=Nt,Rt=xe,hu=ie.TypeError,Ti=ie.document,qi=ie.process,wi=fu.f,vg=wi,gg=!!(Ti&&Ti.createEvent&&ie.dispatchEvent),vu="unhandledrejection",mg="rejectionhandled",au=0,gu=1,bg=2,Ri=1,mu=2,Ct,su,bu,uu,yu=function(t){var e;return ag(t)&&kt(e=t.then)?e:!1},Iu=function(t,e){var r=e.value,i=e.state===gu,o=i?t.ok:t.fail,n=t.resolve,s=t.reject,u=t.domain,d,l,p;try{o?(i||(e.rejection===mu&&Ig(e),e.rejection=Ri),o===!0?d=r:(u&&u.enter(),d=o(r),u&&(u.exit(),p=!0)),d===t.promise?s(new hu("Promise-chain cycle")):(l=yu(d))?Re(l,d,n,s):n(d)):s(r)}catch(h){u&&!p&&u.exit(),s(h)}},Su=function(t,e){t.notified||(t.notified=!0,xi(function(){for(var r=t.reactions,i;i=r.get();)Iu(i,t);t.notified=!1,e&&!t.rejection&&yg(t)}))},_u=function(t,e,r){var i,o;gg?(i=Ti.createEvent("Event"),i.promise=e,i.reason=r,i.initEvent(t,!1,!0),ie.dispatchEvent(i)):i={promise:e,reason:r},!fg&&(o=ie["on"+t])?o(i):t===vu&&cg("Unhandled promise rejection",r)},yg=function(t){Re(lu,ie,function(){var e=t.facade,r=t.value,i=cu(t),o;if(i&&(o=lg(function(){Lt?qi.emit("unhandledRejection",r,e):_u(vu,e,r)}),t.rejection=Lt||cu(t)?mu:Ri,o.error))throw o.value})},cu=function(t){return t.rejection!==Ri&&!t.parent},Ig=function(t){Re(lu,ie,function(){var e=t.facade;Lt?qi.emit("rejectionHandled",e):_u(mg,e,t.value)})},Ae=function(t,e,r){return function(i){t(e,i,r)}},qe=function(t,e,r){t.done||(t.done=!0,r&&(t=r),t.value=e,t.state=bg,Su(t,!0))},Oi=function(t,e,r){if(!t.done){t.done=!0,r&&(t=r);try{if(t.facade===e)throw new hu("Promise can't be resolved itself");var i=yu(e);i?xi(function(){var o={done:!1};try{Re(i,e,Ae(Oi,o,t),Ae(qe,o,t))}catch(n){qe(o,n,t)}}):(t.value=e,t.state=gu,Su(t,!1))}catch(o){qe({done:!1},o,t)}}};if(pu&&(de=function(e){sg(this,Rt),ng(e),Re(Ct,this);var r=Ei(this);try{e(Ae(Oi,r),Ae(qe,r))}catch(i){qe(r,i)}},Rt=de.prototype,Ct=function(e){hg(this,{type:Dt,done:!1,notified:!1,parent:!1,reactions:new dg,rejection:!1,state:au,value:null})},Ct.prototype=ou(Rt,"then",function(e,r){var i=Ei(this),o=wi(ug(this,de));return i.parent=!0,o.ok=kt(e)?e:!0,o.fail=kt(r)&&r,o.domain=Lt?qi.domain:void 0,i.state===au?i.reactions.add(o):xi(function(){Iu(o,i)}),o.promise}),su=function(){var t=new Ct,e=Ei(t);this.promise=t,this.resolve=Ae(Oi,e),this.reject=Ae(qe,e)},fu.f=wi=function(t){return t===de||t===bu?new su(t):vg(t)},!tg&&kt(Nt)&&xe!==Object.prototype)){uu=xe.then,pg||ou(xe,"then",function(e,r){var i=this;return new de(function(o,n){Re(uu,i,o,n)}).then(e,r)},{unsafe:!0});try{delete xe.constructor}catch{}nu&&nu(xe,Rt)}eg({global:!0,constructor:!0,wrap:!0,forced:pu},{Promise:de});bu=rg.Promise;ig(de,Dt,!1,!0);og(Dt)});var fe=a((GS,Eu)=>{"use strict";Eu.exports={}});var wu=a((zS,Tu)=>{"use strict";var Sg=N(),_g=fe(),Pg=Sg("iterator"),Eg=Array.prototype;Tu.exports=function(t){return t!==void 0&&(_g.Array===t||Eg[Pg]===t)}});var Ci=a((QS,xu)=>{"use strict";var Tg=Ke(),Ou=dt(),wg=Ve(),Og=fe(),xg=N(),Ag=xg("iterator");xu.exports=function(t){if(!wg(t))return Ou(t,Ag)||Ou(t,"@@iterator")||Og[Tg(t)]}});var qu=a((YS,Au)=>{"use strict";var qg=F(),Rg=X(),Cg=Z(),kg=Fe(),Lg=Ci(),Ng=TypeError;Au.exports=function(t,e){var r=arguments.length<2?Lg(t):e;if(Rg(r))return Cg(qg(r,t));throw new Ng(kg(t)+" is not iterable")}});var ku=a((JS,Cu)=>{"use strict";var Dg=F(),Ru=Z(),$g=dt();Cu.exports=function(t,e,r){var i,o;Ru(t);try{if(i=$g(t,"return"),!i){if(e==="throw")throw r;return r}i=Dg(i,t)}catch(n){o=!0,i=n}if(e==="throw")throw r;if(o)throw i;return Ru(i),r}});var Mt=a((XS,$u)=>{"use strict";var Mg=je(),Vg=F(),Fg=Z(),Ug=Fe(),Bg=wu(),jg=jr(),Lu=ct(),Wg=qu(),Hg=Ci(),Nu=ku(),Kg=TypeError,$t=function(t,e){this.stopped=t,this.result=e},Du=$t.prototype;$u.exports=function(t,e,r){var i=r&&r.that,o=!!(r&&r.AS_ENTRIES),n=!!(r&&r.IS_RECORD),s=!!(r&&r.IS_ITERATOR),u=!!(r&&r.INTERRUPTED),d=Mg(e,i),l,p,h,c,f,g,y,S=function(P){return l&&Nu(l,"normal"),new $t(!0,P)},I=function(P){return o?(Fg(P),u?d(P[0],P[1],S):d(P[0],P[1])):u?d(P,S):d(P)};if(n)l=t.iterator;else if(s)l=t;else{if(p=Hg(t),!p)throw new Kg(Ug(t)+" is not iterable");if(Bg(p)){for(h=0,c=jg(t);c>h;h++)if(f=I(t[h]),f&&Lu(Du,f))return f;return new $t(!1)}l=Wg(t,p)}for(g=n?t.next:l.next;!(y=Vg(g,l)).done;){try{f=I(y.value)}catch(P){Nu(l,"throw",P)}if(typeof f=="object"&&f&&Lu(Du,f))return f}return new $t(!1)}});var Bu=a((ZS,Uu)=>{"use strict";var Gg=N(),Vu=Gg("iterator"),Fu=!1;try{Mu=0,ki={next:function(){return{done:!!Mu++}},return:function(){Fu=!0}},ki[Vu]=function(){return this},Array.from(ki,function(){throw 2})}catch{}var Mu,ki;Uu.exports=function(t,e){try{if(!e&&!Fu)return!1}catch{return!1}var r=!1;try{var i={};i[Vu]=function(){return{next:function(){return{done:r=!0}}}},t(i)}catch{}return r}});var Li=a((e_,ju)=>{"use strict";var zg=le(),Qg=Bu(),Yg=we().CONSTRUCTOR;ju.exports=Yg||!Qg(function(t){zg.all(t).then(void 0,function(){})})});var Wu=a(()=>{"use strict";var Jg=D(),Xg=F(),Zg=X(),em=Oe(),tm=wt(),rm=Mt(),im=Li();Jg({target:"Promise",stat:!0,forced:im},{all:function(e){var r=this,i=em.f(r),o=i.resolve,n=i.reject,s=tm(function(){var u=Zg(r.resolve),d=[],l=0,p=1;rm(e,function(h){var c=l++,f=!1;p++,Xg(u,r,h).then(function(g){f||(f=!0,d[c]=g,--p||o(d))},n)}),--p||o(d)});return s.error&&n(s.value),i.promise}})});var Ku=a(()=>{"use strict";var om=D(),nm=G(),am=we().CONSTRUCTOR,Di=le(),sm=J(),um=O(),cm=Pe(),Hu=Di&&Di.prototype;om({target:"Promise",proto:!0,forced:am,real:!0},{catch:function(t){return this.then(void 0,t)}});!nm&&um(Di)&&(Ni=sm("Promise").prototype.catch,Hu.catch!==Ni&&cm(Hu,"catch",Ni,{unsafe:!0}));var Ni});var Gu=a(()=>{"use strict";var lm=D(),dm=F(),fm=X(),pm=Oe(),hm=wt(),vm=Mt(),gm=Li();lm({target:"Promise",stat:!0,forced:gm},{race:function(e){var r=this,i=pm.f(r),o=i.reject,n=hm(function(){var s=fm(r.resolve);vm(e,function(u){dm(s,r,u).then(i.resolve,o)})});return n.error&&o(n.value),i.promise}})});var zu=a(()=>{"use strict";var mm=D(),bm=Oe(),ym=we().CONSTRUCTOR;mm({target:"Promise",stat:!0,forced:ym},{reject:function(e){var r=bm.f(this),i=r.reject;return i(e),r.promise}})});var $i=a((c_,Qu)=>{"use strict";var Im=Z(),Sm=U(),_m=Oe();Qu.exports=function(t,e){if(Im(t),Sm(e)&&e.constructor===t)return e;var r=_m.f(t),i=r.resolve;return i(e),r.promise}});var Xu=a(()=>{"use strict";var Pm=D(),Em=J(),Yu=G(),Tm=le(),Ju=we().CONSTRUCTOR,wm=$i(),Om=Em("Promise"),xm=Yu&&!Ju;Pm({target:"Promise",stat:!0,forced:Yu||Ju},{resolve:function(e){return wm(xm&&this===Om?Tm:this,e)}})});var Zu=a(()=>{"use strict";Pu();Wu();Ku();Gu();zu();Xu()});var ic=a(()=>{"use strict";var Am=D(),qm=G(),Vt=le(),Rm=q(),tc=J(),rc=O(),Cm=ei(),ec=$i(),km=Pe(),Vi=Vt&&Vt.prototype,Lm=!!Vt&&Rm(function(){Vi.finally.call({then:function(){}},function(){})});Am({target:"Promise",proto:!0,real:!0,forced:Lm},{finally:function(t){var e=Cm(this,tc("Promise")),r=rc(t);return this.then(r?function(i){return ec(e,t()).then(function(){return i})}:t,r?function(i){return ec(e,t()).then(function(){throw i})}:t)}});!qm&&rc(Vt)&&(Mi=tc("Promise").prototype.finally,Vi.finally!==Mi&&km(Vi,"finally",Mi,{unsafe:!0}));var Mi});var nc=a((g_,oc)=>{"use strict";wa();Zu();ic();var Nm=vt();oc.exports=Nm("Promise","finally")});var sc=a((m_,ac)=>{"use strict";var Dm=nc();ac.exports=Dm});var Fi=a((b_,uc)=>{"use strict";var $m=sc();uc.exports=$m});var lc=a((y_,cc)=>{"use strict";var Mm=q();cc.exports=!Mm(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})});var Ft=a((I_,fc)=>{"use strict";var Vm=z(),Fm=O(),Um=qr(),Bm=Ot(),jm=lc(),dc=Bm("IE_PROTO"),Ui=Object,Wm=Ui.prototype;fc.exports=jm?Ui.getPrototypeOf:function(t){var e=Um(t);if(Vm(e,dc))return e[dc];var r=e.constructor;return Fm(r)&&e instanceof r?r.prototype:e instanceof Ui?Wm:null}});var vc=a((S_,hc)=>{"use strict";var Hm=R(),Bi=z(),Km=ne(),Gm=Wr().indexOf,zm=xt(),pc=Hm([].push);hc.exports=function(t,e){var r=Km(t),i=0,o=[],n;for(n in r)!Bi(zm,n)&&Bi(r,n)&&pc(o,n);for(;e.length>i;)Bi(r,n=e[i++])&&(~Gm(o,n)||pc(o,n));return o}});var ji=a((__,gc)=>{"use strict";gc.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Wi=a((P_,mc)=>{"use strict";var Qm=vc(),Ym=ji();mc.exports=Object.keys||function(e){return Qm(e,Ym)}});var Pc=a((E_,_c)=>{"use strict";var yc=L(),Jm=q(),Ic=R(),Xm=Ft(),Zm=Wi(),eb=ne(),tb=mr().f,Sc=Ic(tb),rb=Ic([].push),ib=yc&&Jm(function(){var t=Object.create(null);return t[2]=2,!Sc(t,2)}),bc=function(t){return function(e){for(var r=eb(e),i=Zm(r),o=ib&&Xm(r)===null,n=i.length,s=0,u=[],d;n>s;)d=i[s++],(!yc||(o?d in r:Sc(r,d)))&&rb(u,t?[d,r[d]]:r[d]);return u}};_c.exports={entries:bc(!0),values:bc(!1)}});var Ec=a(()=>{"use strict";var ob=D(),nb=Pc().entries;ob({target:"Object",stat:!0},{entries:function(e){return nb(e)}})});var wc=a((O_,Tc)=>{"use strict";Ec();var ab=ge();Tc.exports=ab.Object.entries});var xc=a((x_,Oc)=>{"use strict";var sb=wc();Oc.exports=sb});var Ce=a((A_,Ac)=>{"use strict";var ub=xc();Ac.exports=ub});var Cc=a((q_,Rc)=>{"use strict";var Hi=L(),cb=z(),qc=Function.prototype,lb=Hi&&Object.getOwnPropertyDescriptor,Ki=cb(qc,"name"),db=Ki&&function(){}.name==="something",fb=Ki&&(!Hi||Hi&&lb(qc,"name").configurable);Rc.exports={EXISTS:Ki,PROPER:db,CONFIGURABLE:fb}});var Lc=a(kc=>{"use strict";var pb=L(),hb=$r(),vb=se(),gb=Z(),mb=ne(),bb=Wi();kc.f=pb&&!hb?Object.defineProperties:function(e,r){gb(e);for(var i=mb(r),o=bb(r),n=o.length,s=0,u;n>s;)vb.f(e,u=o[s++],i[u]);return e}});var Yi=a((C_,Uc)=>{"use strict";var yb=Z(),Ib=Lc(),Nc=ji(),Sb=xt(),_b=ti(),Pb=ft(),Eb=Ot(),Dc=">",$c="<",zi="prototype",Qi="script",Vc=Eb("IE_PROTO"),Gi=function(){},Fc=function(t){return $c+Qi+Dc+t+$c+"/"+Qi+Dc},Mc=function(t){t.write(Fc("")),t.close();var e=t.parentWindow.Object;return t=null,e},Tb=function(){var t=Pb("iframe"),e="java"+Qi+":",r;return t.style.display="none",_b.appendChild(t),t.src=String(e),r=t.contentWindow.document,r.open(),r.write(Fc("document.F=Object")),r.close(),r.F},Ut,Bt=function(){try{Ut=new ActiveXObject("htmlfile")}catch{}Bt=typeof document<"u"?document.domain&&Ut?Mc(Ut):Tb():Mc(Ut);for(var t=Nc.length;t--;)delete Bt[zi][Nc[t]];return Bt()};Sb[Vc]=!0;Uc.exports=Object.create||function(e,r){var i;return e!==null?(Gi[zi]=yb(e),i=new Gi,Gi[zi]=null,i[Vc]=e):i=Bt(),r===void 0?i:Ib.f(i,r)}});var eo=a((k_,Wc)=>{"use strict";var wb=q(),Ob=O(),xb=U(),Ab=Yi(),Bc=Ft(),qb=Pe(),Rb=N(),Cb=G(),Zi=Rb("iterator"),jc=!1,ee,Ji,Xi;[].keys&&(Xi=[].keys(),"next"in Xi?(Ji=Bc(Bc(Xi)),Ji!==Object.prototype&&(ee=Ji)):jc=!0);var kb=!xb(ee)||wb(function(){var t={};return ee[Zi].call(t)!==t});kb?ee={}:Cb&&(ee=Ab(ee));Ob(ee[Zi])||qb(ee,Zi,function(){return this});Wc.exports={IteratorPrototype:ee,BUGGY_SAFARI_ITERATORS:jc}});var Kc=a((L_,Hc)=>{"use strict";var Lb=eo().IteratorPrototype,Nb=Yi(),Db=Me(),$b=Ge(),Mb=fe(),Vb=function(){return this};Hc.exports=function(t,e,r,i){var o=e+" Iterator";return t.prototype=Nb(Lb,{next:Db(+!i,r)}),$b(t,o,!1,!0),Mb[o]=Vb,t}});var il=a((N_,rl)=>{"use strict";var Fb=D(),Ub=F(),jt=G(),el=Cc(),Bb=O(),jb=Kc(),Gc=Ft(),zc=Yr(),Wb=Ge(),Hb=be(),to=Pe(),Kb=N(),Qc=fe(),tl=eo(),Gb=el.PROPER,zb=el.CONFIGURABLE,Yc=tl.IteratorPrototype,Wt=tl.BUGGY_SAFARI_ITERATORS,tt=Kb("iterator"),Jc="keys",rt="values",Xc="entries",Zc=function(){return this};rl.exports=function(t,e,r,i,o,n,s){jb(r,e,i);var u=function(I){if(I===o&&c)return c;if(!Wt&&I&&I in p)return p[I];switch(I){case Jc:return function(){return new r(this,I)};case rt:return function(){return new r(this,I)};case Xc:return function(){return new r(this,I)}}return function(){return new r(this)}},d=e+" Iterator",l=!1,p=t.prototype,h=p[tt]||p["@@iterator"]||o&&p[o],c=!Wt&&h||u(o),f=e==="Array"&&p.entries||h,g,y,S;if(f&&(g=Gc(f.call(new t)),g!==Object.prototype&&g.next&&(!jt&&Gc(g)!==Yc&&(zc?zc(g,Yc):Bb(g[tt])||to(g,tt,Zc)),Wb(g,d,!0,!0),jt&&(Qc[d]=Zc))),Gb&&o===rt&&h&&h.name!==rt&&(!jt&&zb?Hb(p,"name",rt):(l=!0,c=function(){return Ub(h,this)})),o)if(y={values:u(rt),keys:n?c:u(Jc),entries:u(Xc)},s)for(S in y)(Wt||l||!(S in p))&&to(p,S,y[S]);else Fb({target:e,proto:!0,forced:Wt||l},y);return(!jt||s)&&p[tt]!==c&&to(p,tt,c,{name:o}),Qc[e]=c,y}});var nl=a((D_,ol)=>{"use strict";ol.exports=function(t,e){return{value:t,done:e}}});var io=a(($_,ll)=>{"use strict";var Qb=ne(),ro=Hr(),al=fe(),ul=Si(),Yb=se().f,Jb=il(),Ht=nl(),Xb=G(),Zb=L(),cl="Array Iterator",ey=ul.set,ty=ul.getterFor(cl);ll.exports=Jb(Array,"Array",function(t,e){ey(this,{type:cl,target:Qb(t),index:0,kind:e})},function(){var t=ty(this),e=t.target,r=t.index++;if(!e||r>=e.length)return t.target=null,Ht(void 0,!0);switch(t.kind){case"keys":return Ht(r,!1);case"values":return Ht(e[r],!1)}return Ht([r,e[r]],!1)},"values");var sl=al.Arguments=al.Array;ro("keys");ro("values");ro("entries");if(!Xb&&Zb&&sl.name!=="values")try{Yb(sl,"name",{value:"values"})}catch{}});var fl=a((M_,dl)=>{"use strict";var ry=L(),iy=se(),oy=Me();dl.exports=function(t,e,r){ry?iy.f(t,e,oy(0,r)):t[e]=r}});var pl=a(()=>{"use strict";var ny=D(),ay=Mt(),sy=fl();ny({target:"Object",stat:!0},{fromEntries:function(e){var r={};return ay(e,function(i,o){sy(r,i,o)},{AS_ENTRIES:!0}),r}})});var vl=a((U_,hl)=>{"use strict";io();pl();var uy=ge();hl.exports=uy.Object.fromEntries});var ml=a((B_,gl)=>{"use strict";gl.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}});var yl=a(()=>{"use strict";io();var cy=ml(),ly=w(),dy=Ge(),bl=fe();for(Kt in cy)dy(ly[Kt],Kt),bl[Kt]=bl.Array;var Kt});var Sl=a((H_,Il)=>{"use strict";var fy=vl();yl();Il.exports=fy});var Pl=a((K_,_l)=>{"use strict";var py=Sl();_l.exports=py});var uo=a((DP,$l)=>{"use strict";var my=Ke(),by=String;$l.exports=function(t){if(my(t)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return by(t)}});var Vl=a(($P,Ml)=>{"use strict";var yy=ht(),Iy=uo(),Sy=ve(),_y=RangeError;Ml.exports=function(e){var r=Iy(Sy(this)),i="",o=yy(e);if(o<0||o===1/0)throw new _y("Wrong number of repetitions");for(;o>0;(o>>>=1)&&(r+=r))o&1&&(i+=r);return i}});var Wl=a((MP,jl)=>{"use strict";var Bl=R(),Py=Br(),Fl=uo(),Ey=Vl(),Ty=ve(),wy=Bl(Ey),Oy=Bl("".slice),xy=Math.ceil,Ul=function(t){return function(e,r,i){var o=Fl(Ty(e)),n=Py(r),s=o.length,u=i===void 0?" ":Fl(i),d,l;return n<=s||u===""?o:(d=n-s,l=wy(u,xy(d/u.length)),l.length>d&&(l=Oy(l,0,d)),t?o+l:l+o)}};jl.exports={start:Ul(!1),end:Ul(!0)}});var Kl=a((VP,Hl)=>{"use strict";var Ay=ae();Hl.exports=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Ay)});var Gl=a(()=>{"use strict";var qy=D(),Ry=Wl().start,Cy=Kl();qy({target:"String",proto:!0,forced:Cy},{padStart:function(e){return Ry(this,e,arguments.length>1?arguments[1]:void 0)}})});var Ql=a((BP,zl)=>{"use strict";Gl();var ky=vt();zl.exports=ky("String","padStart")});var Jl=a((jP,Yl)=>{"use strict";var Ly=Ql();Yl.exports=Ly});var co=a((WP,Xl)=>{"use strict";var Ny=Jl();Xl.exports=Ny});var By={};Eo(By,{ApiEnv:()=>_e,ConnectionType:()=>bt,ContentType:()=>mt,InteractiveInterfaceClick:()=>Kr,MediascopePixel:()=>lr,MediascopePixelTypes:()=>Pd,OneStat:()=>er,Quality:()=>gt,SeekAction:()=>yt,ThinOneStat:()=>Po,VERSION:()=>C});module.exports=$d(By);var ho=A(Se(),1);var _e=(s=>(s.PROD="prod",s.VK_ALIAS="vk_alias",s.VIDEOTEST="videotest",s.TEST="test",s.OKCDN="okcdn",s.AUTO="auto",s))(_e||{}),gt=(l=>(l.Q144P="mobile",l.Q240P="lowest",l.Q360P="low",l.Q480P="medium",l.Q720P="high",l.Q1080P="fullhd",l.Q1440P="quadhd",l.Q2160P="ultrahd",l.UNKNOWN="unknown",l))(gt||{}),mt=(f=>(f.MP4="mp4",f.DASH="dash",f.DASH_SEP="dash_sep",f.ONDEMAND_DASH="ondemand_dash",f.HLS="hls",f.ONDEMAND_HLS="ondemand_hls",f.WEBM="webm",f.AV1="av1",f.ONDEMAND_DASH_LIVE="ondemand_dash_live",f.ONDEMAND_HLS_LIVE="ondemand_hls_live",f.WEBRTC="webrtc",f.UNKNOWN="unknown",f.RTMP="rtmp",f))(mt||{});var bt=(i=>(i.HTTP1="http1",i.HTTP2="http2",i.HTTP3="http3",i))(bt||{});var yt=(u=>(u.SLIDER="slider",u.DOUBLE_TAP="double_tap",u.TIME_CODE="time_code",u.EPISODE="episode",u.REWIND="rewind",u.LIVE="live",u.UNKNOWN="unknown",u))(yt||{}),Kr=(n=>(n.GRAPH_SHOW="iGraphShow",n.GRAPH_HIDE="iGraphHide",n.NEXT_AREA="iNextChapterArea",n.NEXT_BUTTON="iNextChapterBtn",n.WATCH_AGAIN="iWatchAgainBtn",n))(Kr||{}),ya={action_play:"ap",action_play_interactive:"api",first_bytes:"fb",player_ready:"pr",first_frame:"ff",seek:"sk",watch_coverage_record:"wr",watch_coverage_live:"wl",empty_buffer:"eb",action_stop:"as",close_at_empty_buffer:"cb",content_error:"er",player_interface_click:"pc",next_movie:"nm",track_switch:"ts",failover:"fo",quality:"qt"},Ia={vsid:"si",isid:"is",vid:"vi",place:"pl",quality:"qt",cdn_host:"ch",stat_type:"st",param:"pm",vk_app_id:"va",track_code:"tc",connection_type:"cnt",connection_reused:"cr",cached_data:"cd",live:"lv",muted:"mu",mode:"mo",subtitles:"sb",failover:"fo",download_speed:"ds",manual_quality:"mq",ref_domain:"rd",direct_url:"du"},Sa={unknown:"un",mobile:"m",lowest:"ls",low:"l",medium:"md",high:"h",fullhd:"f",quadhd:"q",ultrahd:"u"},_a={pip:"pi",fullscreen:"fs",external:"ex",prefetch:"pr",airplay:"ap",chromecast:"cc",invisible:"iv"};var Ea=require("@vkontakte/videoplayer-shared");var Pa="CIOPGQJGDIHBABABA",Gr={prod:"https://api.ok.ru",vk_alias:"https://api.mycdn.me",videotest:"https://videotestapi.ok.ru/api",test:"https://apitest.ok.ru",okcdn:"https://api.okcdn.ru",auto:""};var ah={apiEnv:"vk_alias",apiKey:Pa,requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageInterval:15e3,disabledOperations:["quality"],disabledCustomFields:[],shorten:!0,maxLoops:100,embedUrlParams:[],useBeacon:!0,synchronizeTime:!0,debugLog:!1,clearStorageAtUnload:!0,useVKComIsMobileLogic:!1,backoff:{start:1e3,factor:1.5,max:5*60*1e3,random:.1},useKeepalive:!1},Ta=t=>(0,Ea.fillWithDefault)(t,ah);function zr(){let t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),e=new Array(36),r=0,i,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?e[o]="-":o===14?e[o]="4":(r<=2&&(r=33554432+Math.random()*16777216|0),i=r&15,r=r>>4,e[o]=t[o===19?i&3|8:i]);return e.join("")}var v=require("@vkontakte/videoplayer-shared"),tr=require("@vkontakte/videoplayer-shared");var Gt=A(Fi(),1);var El=A(Ce(),1),Tl=A(Pl(),1);var wl=t=>{let{operation:e,custom:r}=t,i=(0,Tl.default)((0,El.default)(r).map(([o,n])=>{let s=Ia[o]??o,u=n;return n&&(o==="mode"?u=_a[n]??n:o==="quality"&&(u=Sa[n]??n)),[s,u]}));return{...t,operation:ya[e]??e,custom:i}};var C="1.0.83";var W=require("@vkontakte/videoplayer-shared");var hy=/Mobile|mini|Fennec|Android|iP(ad|od|hone)|opera (mini|mobi)/i,it=class{constructor(e){this.consequentAuthErrors=0;this.authorized$=new W.ValueSubject(!1);this.params=e}async authorize(e){return this.authToken=e??await this.refreshAuthToken(),this._authorizeWithBackoff()}logBeacon(e){let r="log.externalLog",i=this.createLogParams(e),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(r,i,o)||this.logRequest(e).catch(()=>{})}async logRequest(e){let r="log.externalLog",i=this.createLogParams(e),o=this.sessionKey??await this._authorizeWithBackoff();if(!o)return;let n=async(s,u=this.params.config.requestRetryCount)=>{try{return await this.params.apiTransport.sendRequest(r,i,o)}catch(d){if(!d||!("error_code"in d)){this.params.error$.next({id:"logRequestUnknown",category:W.ErrorCategory.NETWORK,message:`Unknown ${r} error`,thrown:d});return}let l=d?.error_code;switch(l){case 102:case 103:case 104:return this.authorized$.next(!1),this.sessionKey=await this._authorizeWithBackoff(),u>0?n(s,u-1):void 0;case 401:return this.authorized$.next(!1),this.authToken=await this.refreshAuthToken(),this.sessionKey=await this._authorizeWithBackoff(),u>0?n(s,u-1):void 0;default:{this.params.error$.next({id:`LogRequest#${l}`,category:W.ErrorCategory.EXTERNAL_API,message:`${r} error`,data:d});return}}}};return n(e)}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}async refreshAuthToken(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=(0,Gt.default)(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise}createLogParams(e){let r="WEB",i=!1,o=`@vkontakte/videoplayer-statistics:${C}`;if(this.params.config.useVKComIsMobileLogic){let{appVersion:n}=window.navigator;i=hy.test(n)}else this.params.mobile&&(i=!0);return i&&(r="M_WEB"),this.params.vktvVersion&&(r="SMART_TV",o=this.params.vktvVersion),{collector:"ok.mobile.apps.video",data:JSON.stringify({application:o,platform:r,items:this.params.config.shorten?e.map(wl):e})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();let e=(0,W.getExponentialDelay)(this.consequentAuthErrors,this.params.config.backoff);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{(0,Gt.default)(this._authorize().then(r).catch(i=>this.params.error$.next({id:"AuthorizeBackoff",category:W.ErrorCategory.NETWORK,message:"Otherwise unhandled error in authorization",thrown:i})),()=>this.backoffTimeoutId=0)},e))})}async _authorize(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);let e="auth.anonymLogin",r={session_data:{version:2,device_id:this.params.deviceId,client_version:C.split("-")[0],client_type:"SDK_JS"}};return this.authToken!==void 0&&(r.session_data.auth_token=this.authToken,r.session_data.version=3),this.authorizePromise=(0,Gt.default)(this.params.apiTransport.sendRequest(e,r).then(i=>((!i||!i.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:W.ErrorCategory.EXTERNAL_API,message:"No session key",data:i}),this.sessionKey=i?.session_key??void 0,this.sessionKey)).catch(async i=>{this.sessionKey=void 0;let o=i?.error_code;switch(o){case 401:return this.authToken=await this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:W.ErrorCategory.EXTERNAL_API,message:"authorize error",data:i}):this.params.error$.next({id:"AuthorizeUnknown",category:W.ErrorCategory.NETWORK,message:"authorize error",thrown:i})}),()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise}};var{NativeAbortSignal:oP,NativeAbortController:nP}=function(t){return{NativeAbortSignal:t.AbortSignal,NativeAbortController:t.AbortController}}(typeof self<"u"?self:global);function Ol(t){let e;try{e=new Event("abort")}catch{typeof document<"u"?document.createEvent?(e=document.createEvent("Event"),e.initEvent("abort",!1,!1)):(e=document.createEventObject(),e.type="abort"):e={type:"abort",bubbles:!1,cancelable:!1}}return e.reason=t,e}function xl(t){if(t===void 0)if(typeof document>"u")t=new Error("This operation was aborted"),t.name="AbortError";else try{t=new DOMException("signal is aborted without reason"),Object.defineProperty(t,"name",{value:"AbortError"})}catch{t=new Error("This operation was aborted"),t.name="AbortError"}return t}var zt=class{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(e,r,i){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:r,options:i})}removeEventListener(e,r){if(!(e in this.listeners))return;let i=this.listeners[e];for(let o=0,n=i.length;o<n;o++)if(i[o].callback===r){i.splice(o,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let i=this.listeners[e.type].slice();for(let o=0,n=i.length;o<n;o++){let s=i[o];try{s.callback.call(this,e)}catch(u){Promise.resolve().then(()=>{throw u})}s.options&&s.options.once&&this.removeEventListener(e.type,s.callback)}return!e.defaultPrevented}},ke=class extends zt{constructor(){super(),this.listeners||zt.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(e){e.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,e)),super.dispatchEvent(e)}throwIfAborted(){let{aborted:e,reason:r="Aborted"}=this;if(e)throw r}static timeout(e){let r=new pe;return setTimeout(()=>r.abort(new DOMException(`This signal is timeout in ${e}ms`,"TimeoutError")),e),r.signal}static any(e){let r=new pe;function i(){r.abort(this.reason),o()}function o(){for(let n of e)n.removeEventListener("abort",i)}for(let n of e)if(n.aborted){r.abort(n.reason);break}else n.addEventListener("abort",i);return r.signal}},pe=class{constructor(){Object.defineProperty(this,"signal",{value:new ke,writable:!0,configurable:!0})}abort(e){let r=xl(e),i=Ol(r);this.signal.reason=r,this.signal.dispatchEvent(i)}toString(){return"[object AbortController]"}};typeof Symbol<"u"&&Symbol.toStringTag&&(pe.prototype[Symbol.toStringTag]="AbortController",ke.prototype[Symbol.toStringTag]="AbortSignal");function Qt(t){return t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof t.Request=="function"&&!t.Request.prototype.hasOwnProperty("signal")||!t.AbortController}function oo(t){typeof t=="function"&&(t={fetch:t});let{fetch:e,Request:r=e.Request,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=t;if(!Qt({fetch:e,Request:r,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o}))return{fetch:e,Request:n};let n=r;(n&&!n.prototype.hasOwnProperty("signal")||o)&&(n=function(l,p){let h;p&&p.signal&&(h=p.signal,delete p.signal);let c=new r(l,p);return h&&Object.defineProperty(c,"signal",{writable:!1,enumerable:!1,configurable:!0,value:h}),c},n.prototype=r.prototype);let s=e;return{fetch:(d,l)=>{let p=n&&n.prototype.isPrototypeOf(d)?d.signal:l?l.signal:void 0;if(p){let h;try{h=new DOMException("Aborted","AbortError")}catch{h=new Error("Aborted"),h.name="AbortError"}if(p.aborted)return Promise.reject(h);let c=new Promise((f,g)=>{p.addEventListener("abort",()=>g(h),{once:!0})});return l&&l.signal&&delete l.signal,Promise.race([c,s(d,l)])}return s(d,l)},Request:n}}var vy=()=>"fetch"in window,ot=vy()&&Qt({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Al=ot?oo({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,Le=ot?Al.fetch:window.fetch,vP=ot?Al.Request:window.Request,gP=ot?pe:window.AbortController,mP=ot?ke:window.AbortSignal;var ql=A(Se(),1),Rl=A(Ce(),1),te=require("@vkontakte/videoplayer-shared");var nt=class{constructor(e){this.params=e,this.apiKey=e.config.apiKey,this.apiEnv=e.config.apiEnv,this.apiBaseUrl=Gr[this.apiEnv],this.timeSynchronisation=e.timeSynchronisation,this.isApiBaseUrlFetched=!1}async resolveApiBaseUrl(){if(this.apiEnv!=="auto"||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{let e=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=(await(await Le(e,{method:"GET",mode:"cors",cache:"no-cache"})).json())?.Answer[0]?.data;if(!o)throw new Error("Wrong DNS response");return o}catch(e){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:te.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:e}),Gr.vk_alias}finally{this.isApiBaseUrlFetched=!0}}sendBeacon(e,r,i){if(!window.Blob||!window.navigator.sendBeacon)return!1;let o=this._prepareQueryParams({method:e,queryParams:r,sessionKey:i}),n=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,n)}catch(s){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:te.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:s,data:{method:e,params:r}})}return!1}async sendRequest(e,r,i){let o=(0,te.now)(),n=u=>{if(u instanceof TypeError&&(0,ql.default)(["Failed to fetch","NetworkError when attempting to fetch resource."],u.message)){this.params.error$.next({id:"Network",category:te.ErrorCategory.NETWORK,message:"Request failed",thrown:u});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:te.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:u,data:{method:e,params:r,sessionKey:i,time:(0,te.now)()-o}})};this.apiBaseUrl=await this.resolveApiBaseUrl();let s={method:"post",headers:{"Content-type":"application/x-www-form-urlencoded"},body:this._prepareQueryParams({method:e,queryParams:r,sessionKey:i})};return this.params.config.useKeepalive&&(s.keepalive=!0),Le(`${this.apiBaseUrl}/fb.do`,s).then(u=>{let d=Number(u.headers.get("content-length"))===0,l=new Date(u.headers.get("date")??"").getTime(),p=(0,te.now)()-o;if(isFinite(l)&&this.timeSynchronisation?.addServerTime(l,p),!d)return u.json().then(h=>Object.prototype.hasOwnProperty.call(h,"error_msg")?Promise.reject(h):h,n)},n)}_prepareQueryParams(e){let r=new URLSearchParams({format:"JSON",method:e.method,application_key:this.apiKey});return e.sessionKey!==void 0&&r.append("session_key",e.sessionKey),(0,Rl.default)(e.queryParams).forEach(([i,o])=>r.append(i,typeof o=="string"?o:JSON.stringify(o))),r}};var Cl=A(Se(),1),kl=A(Ce(),1),M=require("@vkontakte/videoplayer-shared"),Yt="onestat_events",no=t=>e=>e.timestamp+t>=(0,M.now)(),Jt=class{constructor(e){this.unsaltedStorage=[];this.isPaused=!1;this.isUrgent=e=>{let{operation:r}=e;return(0,Cl.default)(["action_play","watch_coverage_record","watch_coverage_live"],r)};this.params=e,this.api=e.api,this.error$=e.error$,this.userSalt=e.userSalt,this.loggerDebugLog=e.debugLogger.createComponentLog("stat logger"),this.firstFlush=(0,M.debounceFn)(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});let r=M.safeStorage.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=(0,M.debounceFn)(()=>this.safeFlush(),this.params.config.flushDebounceTime,{maxWait:r}),this.subscription=this.api.authorized$.subscribe(i=>{i&&this.debouncedFlush()}),this.housekeepStorage()}safeFlush(){try{this.flush()}catch(e){this.error$.next({id:"LoggerError",category:M.ErrorCategory.WTF,message:e?String(e):"Unknown logger error",thrown:e})}}readFromStorage(){let e=M.safeStorage.get(Yt);try{return e?JSON.parse(e):{}}catch{}return{}}addToStorage(e){if(!this.userSalt){this.unsaltedStorage.push(e);return}let r=this.readFromStorage(),o=(r[this.userSalt]??[]).filter(no(this.params.config.storageExpiration));M.safeStorage.set(Yt,JSON.stringify({...r,[this.userSalt]:[...o,e]}))}getFromStorage(){return this.userSalt?(this.readFromStorage()[this.userSalt]??[]).filter(no(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}let e=this.readFromStorage();delete e[this.userSalt],M.safeStorage.set(Yt,JSON.stringify(e))}housekeepStorage(){let e=this.readFromStorage();for(let[r,i]of(0,kl.default)(e)){let o=i.filter(no(this.params.config.storageExpiration));o.length?e[r]=o:delete e[r],this.loggerDebugLog({message:`${i.length} retrieved from storage, ${o.length} of them actual`})}M.safeStorage.set(Yt,JSON.stringify(e))}log(e){this.addToStorage(e),!this.isPaused&&(this.isUrgent(e)?this.flush():this.lastVsid!==e.custom.vsid?this.firstFlush():this.debouncedFlush(),this.lastVsid=e.custom.vsid)}flush({wantBeacon:e,clearStorage:r}={wantBeacon:!1,clearStorage:!0}){let i=this.getFromStorage();i.length!==0&&(this.api.authorized$.getValue()?(e&&this.params.config.useBeacon?(this.loggerDebugLog({message:`Flushing ${i.length} events through beacon`}),this.api.logBeacon(i)):(this.loggerDebugLog({message:`Flushing ${i.length} events`}),this.api.logRequest(i)),r&&this.markStorageSent()):this.api.authorize(),this.firstFlush.cancel(),this.debouncedFlush.cancel())}pause(){this.isPaused=!0,this.debouncedFlush.cancel()}resume(){this.isPaused=!1,this.debouncedFlush()}destroy(){this.subscription.unsubscribe(),this.firstFlush.cancel(),this.debouncedFlush.cancel()}};var m=require("@vkontakte/videoplayer-core"),ao=require("@vkontakte/videoplayer-shared");var Ll=t=>t&&{[m.VideoQuality.INVARIANT]:"unknown",[m.VideoQuality.Q_144P]:"mobile",[m.VideoQuality.Q_240P]:"lowest",[m.VideoQuality.Q_360P]:"low",[m.VideoQuality.Q_480P]:"medium",[m.VideoQuality.Q_576P]:"unknown",[m.VideoQuality.Q_720P]:"high",[m.VideoQuality.Q_1080P]:"fullhd",[m.VideoQuality.Q_1440P]:"quadhd",[m.VideoQuality.Q_2160P]:"ultrahd",[m.VideoQuality.Q_4320P]:"unknown"}[t],so=t=>t&&{[m.HttpConnectionType.HTTP1]:"http1",[m.HttpConnectionType.HTTP2]:"http2",[m.HttpConnectionType.QUIC]:"http3"}[t],Nl=t=>{if(t!==void 0)switch(t){case m.VideoFormat.MPEG:return"mp4";case m.VideoFormat.DASH:case m.VideoFormat.DASH_LIVE:case m.VideoFormat.DASH_STREAMS:return"dash";case m.VideoFormat.DASH_SEP:return"dash_sep";case m.VideoFormat.DASH_ONDEMAND:return"ondemand_dash";case m.VideoFormat.DASH_WEBM:case m.VideoFormat.DASH_LIVE_WEBM:return"webm";case m.VideoFormat.DASH_WEBM_AV1:return"av1";case m.VideoFormat.DASH_LIVE_CMAF:return"ondemand_dash_live";case m.VideoFormat.HLS:case m.VideoFormat.HLS_LIVE:return"hls";case m.VideoFormat.HLS_ONDEMAND:return"ondemand_hls";case m.VideoFormat.HLS_LIVE_CMAF:return"ondemand_hls_live";case m.VideoFormat.WEB_RTC_LIVE:return"webrtc";default:return(0,ao.assertNever)(t)}},Xt=t=>{if(t!==void 0)switch(t){case m.Surface.NONE:case m.Surface.INLINE:return;case m.Surface.FULLSCREEN:return"fullscreen";case m.Surface.SECOND_SCREEN:return"chromecast";case m.Surface.PIP:return"pip";case m.Surface.INVISIBLE:return"invisible";default:return(0,ao.assertNever)(t)}},Dl=t=>{switch(t){case"slow-2g":return"poor";case"2g":return"poor";case"3g":return"good";case"4g":return"excellent"}};var Zt=class{constructor(e){this.offset=void 0;this.offset=e}getOffset(){return this.offset??0}setOffset(e){this.offset=e}now(){return Date.now()+(this.offset??0)}date(e=new Date){return e.setTime(e.getTime()+(this.offset??0)),e}addServerTime(e,r){let i=Date.now(),o=e-i-r/2;if(Math.abs(o)<1e3){this.offset=0;return}this.offset===void 0?this.offset=Math.round(o):this.offset=Math.round(.2*o+(1-.2)*this.offset)}};var lo=A(co(),1),Zl=()=>(0,lo.default)(Math.floor(Math.random()*2**32).toString(36),7,"0"),ed=()=>(0,lo.default)(Math.floor(Math.random()*2**64).toString(36),13,"0");var fo=require("@vkontakte/videoplayer-core"),_=require("@vkontakte/videoplayer-shared"),td=(t,e)=>new _.Observable(r=>{let i=new _.Subscription,o=(0,_.merge)((0,_.fromEvent)(window,"beforeunload"),t.events.willDestruct$),n=new _.ValueSubject(void 0),s;i.add(t.info.isLive$.pipe((0,_.filterChanged)()).subscribe(x=>{s&&(s.unsubscribe(),n.next(void 0)),x?s=t.info.liveTime$.pipe((0,_.map)(k=>k&&k/1e3)).subscribe(n):s=t.info.position$.subscribe(n),i.add(s)}));let{playing$:u,paused$:d}=t.events,l=t.events.willSeek$.pipe((0,_.filter)(()=>t.info.playbackState$.getValue()===fo.PlaybackState.PLAYING)),p=t.events.seeked$.pipe((0,_.filter)(()=>t.info.playbackState$.getValue()===fo.PlaybackState.PLAYING)),h=!1,c=new _.Subject;i.add(l.subscribe(()=>{h||c.next(),h=!0})),i.add(p.subscribe(()=>h=!1));let f=new _.Subject,g=new _.Subject,y=(0,_.merge)(u,p,f),S=(0,_.merge)(d,c,o,t.events.looped$,g),I,P=()=>I=n.getValue(),Q=()=>{let x=n.getValue();(0,_.isNullable)(I)||I===x||(0,_.isNullable)(x)||(r.next({from:I,to:x}),I=void 0)},Y=()=>{g.next(),f.next()};if(i.add(y.subscribe(P)),i.add(S.subscribe(Q)),e.forceInterval&&isFinite(e.forceInterval)){let x=0;i.add(y.subscribe(()=>x=window.setTimeout(Y,e.forceInterval))),i.add(S.subscribe(()=>window.clearTimeout(x)))}return i});var Dy="_one-stat_",rd=`${Dy}deviceId`,po=()=>{let t=new v.Subscription;return{subscription:t,subscribe:(e,r)=>{e&&t.add(e.subscribe(r))}}},er=class{constructor(e,r){this.subscription=new v.Subscription;this.debugLogger=new tr.Logger;this.oneStatDebugLog=this.debugLogger.createComponentLog("onestat");this.loopCounter=0;this.disabled=!1;this.vsid$=new v.ValueSubject(void 0);this.isid$=new v.ValueSubject(void 0);this.zenUid$=new v.ValueSubject(void 0);this.seekAction$=new v.ValueSubject("unknown");this.statContext=e,this.config=Ta(r.config??{}),(0,v.isNonNullable)(r.apiEnv)&&(this.config.apiEnv=r.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new Zt);let i=new v.Subject;this.experimental={error$:i};let o=v.safeStorage.get(rd);this.statContext.deviceId?this.deviceId=this.statContext.deviceId:o?this.deviceId=o:(this.deviceId=zr(),v.safeStorage.set(rd,this.deviceId)),this.resetViewSession(),r.useIsid&&this.isid$.next(r.isid??ed()),this.zenUid$.next(r.zenUid);let n=new nt({config:this.config,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new it({config:this.config,apiTransport:n,refreshAuthToken:r.refreshAuthToken,mobile:this.statContext.mobile??!1,deviceId:this.deviceId,error$:i,vktvVersion:r.vktvVersion}),this.logger=new Jt({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:i,userSalt:r.userSalt});let{isEmbed:s,topOrigin:u}=(0,tr.detectEmbed)();this.isEmbed=s,this.embedParent=u?new URL(u).hostname:void 0,this.subscribe()}updateContext(e){this.statContext={...this.statContext,...e}}attachTo(e){let r=new v.Subscription,i=(c,f)=>r.add(c.subscribe(f));i(e.events.willStart$,()=>{let c=e.info.position$.getValue();this.logActionPlay({position:c}),this.statContext.projectId&&this.logActionPlayInteractive()}),i(e.events.looped$,()=>{this.resetViewSession(),++this.loopCounter>this.config.maxLoops&&(this.disabled=!0),this.logActionPlay({position:e.info.position$.getValue()})}),i(e.events.seeked$,()=>{this.logSeek({action:this.seekAction$.getValue(),time:e.info.position$.getValue()}),this.seekAction$.next("unknown")}),i(e.events.paused$,()=>{this.logPause({position:e.info.position$.getValue()})}),i(e.events.willResume$,()=>{this.logPlay()}),i(e.events.started$,()=>{this.statContext.clip&&this.logWatchCoverageRecord({start:0,end:0})}),i(e.events.playing$,()=>{this.logPlaying()}),i(td(e,{forceInterval:this.config.watchCoverageInterval}),c=>{let f=e.info.isLive$.getValue(),g=e.info.atLiveEdge$.getValue(),y={start:parseFloat(c.from.toFixed(3)),end:parseFloat(c.to.toFixed(3))};if(g){let S=e.info.liveLatency$.getValue()??0,I=e.info.currentBuffer$.getValue()?.end??0,P=e.info.liveBufferTime$.getValue()??0,Q=Math.round((S-(I-P))*1e3),Y=Math.round(S*1e3);Q&&Y&&(y.latency=Q,y.bufferLatency=Y)}f?this.logWatchCoverageLive(y):this.logWatchCoverageRecord(y)});let o;i(e.info.isStalled$,c=>{c?o=(0,v.now)():((0,v.isNonNullable)(o)&&this.logEmptyBuffer({duration:(0,v.now)()-o}),o=void 0)});let n=!1;r.add(e.events.fatalError$.pipe((0,v.once)()).subscribe(()=>n=!0)),i(e.events.willStop$,()=>{if(e.info.isStalled$.getValue()){let f=(0,v.isNonNullable)(o)?(0,v.now)()-o:void 0;this.logCloseAtEmptyBuffer({duration:f??0}),o=void 0}else n||this.logActionStop()}),i(e.events.managedError$,({id:c})=>{this.logError({fatal:!1,errorType:c})}),i(e.events.fatalError$,({id:c})=>{this.logError({fatal:!0,errorType:c})});let s,u,d=!1;i(e.events.firstBytes$,c=>{s=(0,v.now)(),this.logFirstBytes({time:c})}),i(e.events.willStart$,()=>u=(0,v.now)()),i(e.info.currentBuffer$,c=>{!d&&c&&c.end-c.start>0&&(0,v.isNonNullable)(s)&&(this.logPlayerReady({duration:(0,v.now)()-s}),d=!0)}),i(e.events.firstFrame$,()=>{(0,v.isNonNullable)(s)&&!d&&(this.logPlayerReady({duration:(0,v.now)()-s}),d=!0),(0,v.isNonNullable)(u)&&this.logFirstFrame({time:(0,v.now)()-u})});let l;i(e.info.currentVideoStream$,c=>{c&&(l&&c.id!==l&&this.logTrackSwitch(c),l=c.id)});let p;i(e.info.currentAudioStream$,c=>{c&&(p&&c.id!==p&&this.logTrackSwitch(c),p=c.id)}),i(e.info.atLiveEdge$,c=>this.updateContext({liveEdge:c})),i((0,v.combine)({muted:e.info.muted$,volume:e.info.volume$}),({muted:c,volume:f})=>this.updateContext({audible:!c&&f>0})),i(e.info.currentQuality$,c=>{let f=Ll(c);this.updateContext({quality:f}),f&&this.logQuality(f)}),i(e.info.isAutoQualityEnabled$,c=>this.updateContext({autoQuality:c})),i(e.info.currentFormat$,c=>this.updateContext({contentType:Nl(c)})),i(e.info.currentPlaybackRate$,c=>this.updateContext({rate:c})),i(e.info.is3DVideo$,c=>this.updateContext({is3d:c}));let h;return i(e.info.hostname$,c=>{let f=h!==void 0&&h!==c;this.updateContext({cdnHostname:c,failover:f}),f&&this.logFailover(c),h=c}),i(e.info.throughputEstimation$,c=>this.updateContext({downloadSpeed:c})),i(e.info.httpConnectionType$,c=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:so(c)}),this.updateContext({connectionType:so(c)})}),i(e.info.httpConnectionReused$,c=>{(0,v.isNullable)(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:c}),this.updateContext({connectionReused:c})}),i(e.info.surface$,c=>this.updateContext({mode:Xt(c)})),i((0,v.combine)({current:e.info.currentTextTrack$,available:e.info.availableTextTracks$}),({current:c,available:f})=>{let g=f.find(({id:S})=>S===c),y=g&&(g.isAuto?`${g.language}_auto`:g.language);this.updateContext({subtitles:y?.split(".")[0]})}),this.player=e,this.uiEvents&&this.attachToUi(this.uiEvents),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToUi(e){this.uiEvents=e;let{subscription:r,subscribe:i}=po();return this.player&&(i(e.actionRewind$,()=>{this.player&&(this.resetViewSession(),this.logActionPlay({position:this.player.info.position$.getValue()}))}),i(e.actionSeek$,this.seekAction$),i(e.inPiP$,o=>{let n=o?"pip":Xt(this.player?.info.surface$.getValue());this.updateContext({mode:n})}),i(e.inFullscreen$,o=>{let n=o?"fullscreen":Xt(this.player?.info.surface$.getValue());this.updateContext({mode:n})}),i(e.actionSetSubtitle$,o=>this.updateContext({subtitles:o.split(".")[0]})),i(e.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(r)),r}attachToAds(e){let{subscription:r,subscribe:i}=po();return i(e.slotRequested$,()=>this.logAdSlotRequest()),i(e.started$,o=>this.logAdStarted(o)),i(e.paused$,()=>this.logAdPaused()),i(e.resumed$,()=>this.logAdResumed()),i(e.ended$,()=>this.logAdEnded()),i(e.skipped$,()=>this.logAdSkipped()),i(e.clicked$,()=>this.logAdClicked()),i(e.error$,o=>this.logError({errorType:o,fatal:!1})),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToInteractive(e){let{subscription:r,subscribe:i}=po();return i(e.click$,o=>this.logInterfaceClick(o)),i(e.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(r),r}authorize(e){return this.api.authorize(e)}pause(){this.logger.pause(),this.oneStatDebugLog({message:"paused"})}resume(){this.logger.resume(),this.oneStatDebugLog({message:"resumed"})}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.oneStatDebugLog({message:"VSID reset"}),this.vsid$.next(Zl())}getDeviceId(){return this.deviceId}setFieldBlacklist(){}logInited(){}logReady(e){this.log({operation:"player_ready",param:String(e.time)})}logStarted(...e){this.logActionPlay(...e)}logPlay(){this.log({operation:"play_toggle"})}logPlaying(){this.log({operation:"playing"})}logPause(e){this.log({operation:"pause",param:String(Math.round(e.position))})}logSeek(e){this.log({operation:"seek",param:e.action,time:e.time})}logFirstBytes(e){this.log({operation:"first_bytes",param:String(e.time)})}logFirstFrame(e){this.log({operation:"first_frame",param:String(e.time)})}logError(e){this.log({operation:"content_error",param:`${e.fatal?"fatal":"recoverable"}_${e.errorType}`})}logWatchCoverageRecord(e){this.log({operation:"watch_coverage_record",param:`${e.start}-${e.end}`},{in_history:this.statContext.inHistory?1:void 0})}logWatchCoverageLive(e){let r=this.timeSynchronisation?.getOffset()??0,i=e.start+r,o=e.end+r;this.log({operation:"watch_coverage_live",param:`${i}-${o}`},{in_history:this.statContext.inHistory?1:void 0,latency:e.latency,buffer_latency:e.bufferLatency})}logEmptyBuffer(e){this.log({operation:"empty_buffer",param:String(e.duration)})}logDownloadSpeed(){}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(e){this.log({operation:"adv",param:e})}logAdPaused(){this.log({operation:"adv",param:"pause"})}logAdResumed(){this.log({operation:"adv",param:"resume"})}logAdEnded(){this.log({operation:"adv",param:"ended"})}logAdSkipped(){this.log({operation:"adv",param:"skip"})}logAdClicked(){this.log({operation:"adv",param:"click"})}logInterfaceClick(e){this.log({operation:"player_interface_click",param:e})}logNextMovie(e){this.log({operation:"next_movie",param:String(e)})}subscribe(){this.resubscribeBeforeunload();let e=window.navigator.connection;e&&"onchange"in e&&"effectiveType"in e&&this.subscription.add((0,v.merge)((0,v.fromEvent)(e,"change"),(0,v.observableFrom)(["init"])).subscribe(()=>this.updateContext({network:Dl(e.effectiveType)}))),this.config.debugLog&&this.debugLogger.log$.subscribe(r=>{console.debug("%c stat ","background:#fa6470;",`component: ${r.component}.`,r.message)})}resubscribeBeforeunload(){this.beforeunloadSubscription?.unsubscribe(),this.beforeunloadSubscription=(0,v.fromEvent)(window,"beforeunload").subscribe(()=>this.logger.flush({wantBeacon:!0,clearStorage:this.config.clearStorageAtUnload})),this.subscription.add(this.beforeunloadSubscription)}logPlayerReady(e){this.log({operation:"player_ready",param:String(Math.round(e.duration))})}logActionPlay(e){this.log({operation:"action_play",param:String(Math.round(e.position))})}logActionPlayInteractive(){this.statContext.projectId&&this.log({operation:"action_play_interactive",param:String(this.statContext.movieId)},{vid:this.statContext.projectId})}logFailover(e){this.log({operation:"failover",param:e})}logCloseAtEmptyBuffer(e){this.log({operation:"close_at_empty_buffer",param:String(Math.round(e.duration))})}logActionStop(){this.log({operation:"action_stop"})}logTrackSwitch(e){this.log({operation:"track_switch",param:e.id})}logQuality(e){this.log({operation:"quality",param:e})}log(e,r={}){if(this.disabled){this.oneStatDebugLog({message:`operation ${e.operation} but statistics is disabled`});return}if((0,ho.default)(this.config.disabledOperations,e.operation)){this.oneStatDebugLog({message:`operation ${e.operation} but it is disabled`});return}this.oneStatDebugLog({message:`operation ${e.operation} ${e.param}`});let i=this.createLogItem(e,r);this.logger.log(i)}createLogItem({operation:e,param:r,time:i},o={}){let n=this.timeSynchronisation?.now()??(0,v.now)(),s=this.vsid$.getValue();(0,v.assertNonNullable)(s);let u=this.isid$.getValue(),d=e==="empty_buffer"||e==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,l=this.statContext.firstConnectionReused,p,h;if(this.isEmbed||this.statContext.place==="embed"){p=this.embedParent;let f=[...new URLSearchParams(location.search).entries()].filter(([g,y])=>(0,ho.default)(this.config.embedUrlParams,g));h=new URLSearchParams(f).toString()}else this.statContext.place==="direct"&&(this.statContext.refDomain?p=(0,v.createURL)(this.statContext.refDomain)?.hostname??this.statContext.refDomain:document.referrer&&(p=(0,v.createURL)(document.referrer)?.hostname??document.referrer),h=location.href.substring(0,1024));let c={vsid:s,isid:u,vid:this.statContext.movieId,uid:this.zenUid$.getValue(),ct:this.statContext.contentType,place:this.isEmbed?"embed":this.statContext.place,quality:this.statContext.quality,cdn_host:this.statContext.cdnHostname,stat_type:this.statContext.autoplay===!0?"auto":this.statContext.autoplay===!1?"":void 0,param:r,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:d,connection_reused:l===!0?1:l===!1?0:void 0,cached_data:this.statContext.cached===!0?1:this.statContext.cached===!1?0:void 0,live:this.statContext.liveEdge?1:void 0,muted:this.statContext.audible===!1?1:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:1,ref_domain:p,direct_url:h,rate:this.statContext.rate===1||(0,v.isNullable)(this.statContext.rate)?void 0:this.statContext.rate.toFixed(2),view_360:this.statContext.is3d?1:void 0,aid:this.statContext.albumId,vk_playlist_id:this.statContext.vkPlaylistId,...o};for(let f of this.config.disabledCustomFields)delete c[f];return{operation:e,type:1,time:i,network:this.statContext.network,timestamp:n,custom:c}}};var Po={};Eo(Po,{SeekType:()=>rr,ThinOneStat:()=>ur,VERSION:()=>C});var T=require("@vkontakte/videoplayer-shared"),K=require("@vkontakte/videoplayer-core");var nd=require("@vkontakte/videoplayer-shared");var rr=(u=>(u.SLIDER="slider",u.DOUBLE_TAP="double_tap",u.TIME_CODE="time_code",u.EPISODE="episode",u.REWIND="rewind",u.LIVE="live",u.UNKNOWN="unknown",u))(rr||{});var od="CIOPGQJGDIHBABABA",vo={prod:"https://api.ok.ru",vk_alias:"https://api.mycdn.me",videotest:"https://videotestapi.ok.ru/api",test:"https://apitest.ok.ru",okcdn:"https://api.okcdn.ru",auto:""};var $y={apiKey:od,apiEnv:"vk_alias",requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageHeartbeatInterval:15,synchronizeTime:!0,useBeacon:!1,alwaysSendDesktop:!1},ad=t=>(0,nd.fillWithDefault)(t,$y);var go=A(Fi(),1),H=require("@vkontakte/videoplayer-shared");var ir=class{constructor(e){this.params=e,this.authorized$=new H.ValueSubject(!1),this.consequentAuthErrors=0}async authorize(e){return this.authToken=e??await this.refreshAuthToken(),this.authorizeWithBackoff()}logBeacon(e){let r="log.logUvStat",i=this.createLogParams(e),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(r,i,o)||this.logRequest(e).catch(()=>{})}async logRequest(e){let r="log.logUvStat",i=this.createLogParams(e),o={},n=this.sessionKey??await this.authorizeWithBackoff();if(!n)return;let s=async(u,d=this.params.config.requestRetryCount)=>{try{return await this.params.apiTransport.sendRequest(r,i,n,o)}catch(l){if(!l||!("error_code"in l)){this.params.error$.next({id:"logRequestUnknown",category:H.ErrorCategory.NETWORK,message:`Unknown ${r} error`,thrown:l});return}let p=l?.error_code;switch(p){case 102:case 103:case 104:return this.authorized$.next(!1),this.sessionKey=await this.authorizeWithBackoff(),d>0?s(u,d-1):void 0;case 401:return this.authorized$.next(!1),this.authToken=await this.refreshAuthToken(),this.sessionKey=await this.authorizeWithBackoff(),d>0?s(u,d-1):void 0;default:{this.params.error$.next({id:`LogRequest#${p}`,category:H.ErrorCategory.EXTERNAL_API,message:`${r} error`,data:l});return}}}};return s(e)}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}async refreshAuthToken(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=(0,go.default)(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise}createLogParams(e){return{collector:"ok.mobile.apps.video",uv_stat_data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${C}`,platform:e[0].platform,product:e[0].product,events:e})}}authorizeWithBackoff(){if(!this.consequentAuthErrors)return this.doAuthorize();let e=(0,H.getExponentialDelay)(this.consequentAuthErrors);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(async()=>{try{let i=await this.doAuthorize();r(i)}catch(i){this.params.error$.next({id:"AuthorizeBackoff",category:H.ErrorCategory.NETWORK,message:"Otherwise unhandled error in authorization",thrown:i})}finally{this.backoffTimeoutId=0}},e))})}doAuthorize(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);let e="auth.anonymLogin",r={session_data:{version:2,device_id:this.params.deviceId,client_version:C.split("-")[0],client_type:"SDK_JS"}};return this.authToken!==void 0&&(r.session_data.auth_token=this.authToken,r.session_data.version=3),this.authorizePromise=(0,go.default)(this.params.apiTransport.sendRequest(e,r).then(i=>((!i||!i.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:H.ErrorCategory.EXTERNAL_API,message:"No session key",data:i}),this.sessionKey=i?.session_key??void 0,this.sessionKey)).catch(async i=>{this.sessionKey=void 0;let o=i?.error_code;switch(o){case 401:return this.authToken=await this.refreshAuthToken(),this.authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:H.ErrorCategory.EXTERNAL_API,message:"authorize error",data:i}):this.params.error$.next({id:"AuthorizeUnknown",category:H.ErrorCategory.NETWORK,message:"authorize error",thrown:i})}),()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise}};var sd=A(Se(),1);var ud=A(Ce(),1),re=require("@vkontakte/videoplayer-shared");var or=class{constructor(e){this.params=e,this.apiKey=e.config.apiKey,this.apiEnv=e.config.apiEnv,this.apiBaseUrl=vo[this.apiEnv],this.timeSynchronisation=e.timeSynchronisation,this.isApiBaseUrlFetched=!1}sendBeacon(e,r,i){if(!window.Blob||!window.navigator.sendBeacon)return!1;let o=this.prepareQueryParams({method:e,queryParams:r,sessionKey:i}),n=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,n)}catch(s){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:re.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:s,data:{method:e,params:r}})}return!1}async sendRequest(e,r,i,o){let n=(0,re.now)(),s=u=>{if(u instanceof TypeError&&(0,sd.default)(["Failed to fetch","NetworkError when attempting to fetch resource."],u.message)){this.params.error$.next({id:"Network",category:re.ErrorCategory.NETWORK,message:"Request failed",thrown:u});return}this.params.error$.next({id:"ThinOneStat:ApiTransport:sendRequest",category:re.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:u,data:{method:e,params:r,sessionKey:i,time:(0,re.now)()-n}})};return this.apiBaseUrl=await this.resolveApiBaseUrl(),Le(`${this.apiBaseUrl}/fb.do`,{method:"post",headers:{"Content-type":"application/x-www-form-urlencoded",...o},body:this.prepareQueryParams({method:e,queryParams:r,sessionKey:i})}).then(u=>{let d=Number(u.headers.get("content-length"))===0,l=new Date(u.headers.get("date")??"").getTime(),p=(0,re.now)()-n;if(isFinite(l)&&this.timeSynchronisation?.addServerTime(l,p),!d)return u.json().then(h=>Object.prototype.hasOwnProperty.call(h,"error_msg")?Promise.reject(h):h,s)},s)}async resolveApiBaseUrl(){if(this.apiEnv!=="auto"||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{let e=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=(await(await Le(e,{method:"GET",mode:"cors",cache:"no-cache"})).json())?.Answer[0]?.data;if(!o)throw new Error("Wrong DNS response");return o}catch(e){return this.params.error$.next({id:"ThinOneStat:ApiTransport:resolveApiBaseUrl",category:re.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:e}),vo.vk_alias}finally{this.isApiBaseUrlFetched=!0}}prepareQueryParams(e){let r=new URLSearchParams({format:"JSON",method:e.method,application_key:this.apiKey});return e.sessionKey!==void 0&&r.append("session_key",e.sessionKey),(0,ud.default)(e.queryParams).forEach(([i,o])=>r.append(i,typeof o=="string"?o:JSON.stringify(o))),r}};var cd=A(Se(),1),ld=A(Ce(),1),V=require("@vkontakte/videoplayer-shared"),nr="thinonestat_events",mo=t=>e=>e.client_time+t>=(0,V.now)(),ar=class{constructor(e){this.unsaltedStorage=[];this.isPaused=!1;this.isUrgent=e=>{let{event_name:r}=e;return(0,cd.default)(["watch_coverage","watch_coverage_live","watched_n","playback_started"],r)};this.params=e,this.api=e.api,this.error$=e.error$,this.userSalt=e.userSalt,this.loggerDebugLog=e.debugLogger.createComponentLog("stat logger"),this.firstFlush=(0,V.debounceFn)(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});let r=V.safeStorage.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=(0,V.debounceFn)(()=>this.safeFlush(),this.params.config.flushDebounceTime,{maxWait:r}),this.subscription=this.api.authorized$.subscribe(i=>{i&&this.debouncedFlush()}),this.housekeepStorage()}safeFlush(){try{this.flush()}catch(e){this.error$.next({id:"LoggerError",category:V.ErrorCategory.WTF,message:String(e)||"Unknown logger error",thrown:e})}}readFromStorage(){let e=V.safeStorage.get(nr);try{return e?JSON.parse(e):{}}catch{}return{}}addToStorage(e){if(!this.userSalt){this.unsaltedStorage.push(e);return}let r=this.readFromStorage(),o=(r[this.userSalt]??[]).filter(mo(this.params.config.storageExpiration));V.safeStorage.set(nr,JSON.stringify({...r,[this.userSalt]:[...o,e]}))}getFromStorage(){return this.userSalt?(this.readFromStorage()[this.userSalt]??[]).filter(mo(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}let e=this.readFromStorage();delete e[this.userSalt],V.safeStorage.set(nr,JSON.stringify(e))}housekeepStorage(){let e=this.readFromStorage();for(let[r,i]of(0,ld.default)(e)){let o=i.filter(mo(this.params.config.storageExpiration));o.length?e[r]=o:delete e[r],this.loggerDebugLog({message:`${i.length} retrieved from storage, ${o.length} of them actual`})}V.safeStorage.set(nr,JSON.stringify(e))}log(e){this.addToStorage(e),!this.isPaused&&(this.isUrgent(e)?this.flush():this.lastVsid!==e.vsid?this.firstFlush():this.debouncedFlush(),this.lastVsid=e.vsid)}flush({wantBeacon:e,clearStorage:r}={wantBeacon:!1,clearStorage:!0}){let i=this.getFromStorage();i.length!==0&&(this.api.authorized$.getValue()?(e&&this.params.config.useBeacon?(this.loggerDebugLog({message:`Flushing ${i.length} events through beacon`}),this.api.logBeacon(i)):(this.loggerDebugLog({message:`Flushing ${i.length} events`}),this.api.logRequest(i)),r&&this.markStorageSent()):this.api.authorize(),this.firstFlush.cancel(),this.debouncedFlush.cancel())}pause(){this.isPaused=!0,this.debouncedFlush.cancel()}resume(){this.isPaused=!1,this.debouncedFlush()}destroy(){this.subscription.unsubscribe(),this.firstFlush.cancel(),this.debouncedFlush.cancel()}};function bo(){let t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),e=new Array(36),r=0,i,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?e[o]="-":o===14?e[o]="4":(r<=2&&(r=33554432+Math.random()*16777216|0),i=r&15,r=r>>4,e[o]=t[o===19?i&3|8:i]);return e.join("")}var sr=class{constructor(e){this.offset=void 0;this.offset=e}getOffset(){return this.offset??0}setOffset(e){this.offset=e}now(){return Date.now()+(this.offset??0)}date(e=new Date){return e.setTime(e.getTime()+(this.offset??0)),e}addServerTime(e,r){let i=Date.now(),o=e-i-r/2;if(Math.abs(o)<1e3){this.offset=0;return}this.offset===void 0?this.offset=Math.round(o):this.offset=Math.round(.2*o+(1-.2)*this.offset)}};var yo=require("@vkontakte/videoplayer-core"),E=require("@vkontakte/videoplayer-shared"),dd=(t,e)=>new E.Observable(r=>{let i=new E.Subscription,o=new E.ValueSubject(void 0),n;i.add(t.info.isLive$.pipe((0,E.filterChanged)()).subscribe(k=>{n&&(n.unsubscribe(),o.next(void 0)),k?n=t.info.liveTime$.pipe((0,E.filterChanged)()).subscribe(o):n=t.info.position$.subscribe(o),i.add(n)}));let{playing$:s,paused$:u,ended$:d,looped$:l}=t.events,p=t.events.willSeek$.pipe((0,E.filter)(()=>t.info.playbackState$.getValue()===yo.PlaybackState.PLAYING)),h=t.events.seeked$.pipe((0,E.filter)(()=>t.info.playbackState$.getValue()===yo.PlaybackState.PLAYING)),c=!1,f=new E.Subject;i.add(p.subscribe(()=>{c||f.next(),c=!0})).add(h.subscribe(()=>c=!1));let g=(0,E.merge)((0,E.fromEvent)(window,"beforeunload"),t.events.willDestruct$),y,S=()=>y=o.getValue(),I=()=>{let k=o.getValue();(0,E.isNullable)(y)||(0,E.isNullable)(k)||y===k||(r.next({from:y,to:k}),y=void 0)},P=new E.Subject,Q=new E.Subject,Y=(0,E.merge)(s,f,P),x=(0,E.merge)(u,h,g,d,l,Q);if(i.add(Y.subscribe(S)).add(x.subscribe(I)),e.heartbeatInterval&&isFinite(e.heartbeatInterval)){let k=[],qd=e.heartbeatInterval*1e3,Rd=()=>{Q.next(),P.next()};i.add(Y.subscribe(()=>{let dr=window.setTimeout(Rd,qd);k.push(dr)})).add(x.subscribe(()=>{k.forEach(dr=>{window.clearTimeout(dr)}),k=[]}))}return i});var fd=require("@vkontakte/videoplayer-core"),pd=require("@vkontakte/videoplayer-shared"),hd=(t,e)=>new pd.Observable(r=>{let i=new fd.Subscription,o=1e4,n=0;return i.add(t.info.position$.subscribe(()=>{let s=e.getTotalViewTime()*1e3;s>n&&s%o===0&&(n=s,r.next({target_duration:o,current_tvt:s}))})),i});var he=require("@vkontakte/videoplayer-shared"),vd=t=>new he.Observable(e=>{let r=new he.Subscription,i=0,o=1,n=0,s=!1,u=!1,d=()=>{if(!s)return;let x=Date.now();n+=(x-i)*o,i=x},l=()=>{(!s||u)&&(i=Date.now(),s=!0,u=!1)},p=()=>{s&&(d(),s=!1)},h=()=>{s&&(d(),s=!1,u=!0)},c=x=>{s&&d(),o=x,i=Date.now()},{started$:f,playing$:g,paused$:y,willSeek$:S,ended$:I,willDestruct$:P}=t.events,{currentPlaybackRate$:Q}=t.info;r.add(S.subscribe(h)).add((0,he.merge)(f,g).subscribe(l)).add((0,he.merge)(y,I,P).subscribe(p)).add(Q.subscribe(c));let Y=()=>{let x=n;return s&&(x+=(Date.now()-i)*o),Math.floor(x/1e3)};return e.next(Y),r});var Io=require("@vkontakte/videoplayer-shared"),b=require("@vkontakte/videoplayer-core");var So=t=>{if(t!==void 0)switch(t){case b.VideoFormat.MPEG:return"MP4";case b.VideoFormat.DASH:case b.VideoFormat.DASH_LIVE:return"DASH";case b.VideoFormat.DASH_SEP:return"DASH_SEP";case b.VideoFormat.DASH_ONDEMAND:return"ONDEMAND_DASH";case b.VideoFormat.HLS_ONDEMAND:return"ONDEMAND_HLS";case b.VideoFormat.HLS:case b.VideoFormat.HLS_LIVE:return"HLS";case b.VideoFormat.DASH_WEBM:case b.VideoFormat.DASH_LIVE_WEBM:return"WEBM";case b.VideoFormat.DASH_LIVE_CMAF:return"ONDEMAND_DASH_LIVE";case b.VideoFormat.HLS_LIVE_CMAF:return"ONDEMAND_HLS_LIVE";case b.VideoFormat.WEB_RTC_LIVE:return"WEBRTC";case b.VideoFormat.DASH_WEBM_AV1:return"AV1";case b.VideoFormat.DASH_STREAMS:return"MULTI_DASH";default:return(0,Io.assertNever)(t)}},oe=t=>{if(t!==void 0)switch(t){case b.VideoQuality.Q_144P:return"144p";case b.VideoQuality.Q_240P:return"240p";case b.VideoQuality.Q_360P:return"360p";case b.VideoQuality.Q_480P:return"480p";case b.VideoQuality.Q_720P:return"720p";case b.VideoQuality.Q_1080P:return"1080p";case b.VideoQuality.Q_1440P:return"1440p";case b.VideoQuality.Q_2160P:return"2160p";case b.VideoQuality.INVARIANT:case b.VideoQuality.Q_576P:case b.VideoQuality.Q_4320P:return"UNKNOWN";default:return(0,Io.assertNever)(t)}},gd=t=>{if(t!==void 0)switch(t){case"MP4":case"ONDEMAND_DASH":case"ONDEMAND_DASH_LIVE":case"ONDEMAND_HLS":case"ONDEMAND_HLS_LIVE":case"MULTI_DASH":case"WEBM":case"AV1":return"vod";case"DASH":case"HLS":case"WEBRTC":return"live";default:return}},md=(t,e,r)=>{if(t&&e)switch(t){case b.VideoFormat.MPEG:return r&&e[t]&&e[t][r];default:return e[t]?.url}},bd=t=>{if(t!==void 0)switch(t){case b.Surface.NONE:return;case b.Surface.INLINE:return"inline";case b.Surface.FULLSCREEN:return"fullscreen";case b.Surface.SECOND_SCREEN:return"chromecast";case b.Surface.PIP:return"pip_external"}},yd=t=>{if(t!==void 0)return t===b.Surface.INVISIBLE?"background":"foreground"};var _o=A(co(),1),Id=()=>(0,_o.default)(Math.floor(Math.random()*2**32).toString(36),13,"0"),Sd=()=>(0,_o.default)(Math.floor(Math.random()*2**64).toString(36),13,"0");var My="_thin-one-stat_",_d=`${My}deviceId`,Vy=()=>{let t=new T.Subscription;return{subscription:t,subscribe:(e,r)=>{e&&t.add(e.subscribe(r))}}},ur=class{constructor(e,r){this.debugLogger=new T.Logger;this.thinOneStatDebugLog=this.debugLogger.createComponentLog("ThinOneStat");this.eventNumber=1;this.seekAction$=new T.ValueSubject("unknown");this.playerSize$=new T.ValueSubject({width:0,height:0});this.vsid$=new T.ValueSubject(void 0);this.isid$=new T.ValueSubject(void 0);this.statContext=e,this.config=ad(r.config??{}),this.subscription=new T.Subscription,this.config.synchronizeTime&&(this.timeSynchronisation=new sr);let i=new T.Subject,o=T.safeStorage.get(_d);this.statContext.deviceId?this.deviceId=this.statContext.deviceId:o?this.deviceId=o:(this.deviceId=bo(),T.safeStorage.set(_d,this.deviceId)),this.resetViewSession(),r.useIsid&&this.isid$.next(r.isid??Sd());let n=new or({error$:i,config:this.config,timeSynchronisation:this.timeSynchronisation});this.api=new ir({config:this.config,apiTransport:n,error$:i,deviceId:this.deviceId,refreshAuthToken:r.refreshAuthToken}),this.logger=new ar({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:i,userSalt:r.userSalt});let{isEmbed:s,topOrigin:u}=(0,T.detectEmbed)();this.isEmbed=s,this.embedHostname=u?new URL(u).hostname:void 0}authorize(e){return this.api.authorize(e)}updateContext(e){this.statContext={...this.statContext,...e}}attachTo(e){let r=new T.Subscription,i=(n,s)=>r.add(n.subscribe(s));i(vd(e),n=>{this.getTotalViewTime=n}),i(e.info.isLive$,n=>this.isLive=n),i(e.info.position$,n=>this.position=n);let o;return i(e.info.hostname$,n=>{o!==void 0&&o!==n&&this.logFailover({cdn_host:n}),this.cdnHostname=o=n}),i(dd(e,{heartbeatInterval:this.config.watchCoverageHeartbeatInterval}),n=>{let s=Math.round(n.from*1e3),u=Math.round(n.to*1e3),d={watch_interval:`${s}-${u}`,in_history:!!this.statContext.inHistory,content_type:So(e.info.currentFormat$.getValue()),playback_quality:oe(e.info.currentQuality$.getValue()),recom_info:this.statContext.recomInfo};if(!e.info.isLive$.getValue())this.logWatchCoverage(d);else{let p=e.info.atLiveEdge$.getValue();this.logWatchCoverageLive({...d,live:!!p})}}),i(hd(e,{getTotalViewTime:this.getTotalViewTime}),n=>{this.logWatchedN(n)}),i((0,T.merge)(e.events.willStart$,e.events.looped$),n=>{n&&this.resetViewSession();let s={isid:this.isid$.getValue(),stream_profile:gd(So(e.info.currentFormat$.getValue())),dpi:K.clientChecker.display.pixelRatio,web_layout:K.clientChecker.device.isMobile?"mobile":"desktop",iframe_host:this.isEmbed?this.embedHostname??void 0:null,from_downloads:!0,preloaded:this.statContext.preload,navigation:this.statContext.navigation,recom_info:this.statContext.recomInfo};this.logStartSession(s)}),i(e.events.willReady$,()=>{if(this.statContext.preload){let n=e.info.currentFormat$.getValue(),s=e.info.availableSources$.getValue(),u=e.info.currentBuffer$.getValue(),d=e.info.currentQuality$.getValue(),l={target_buffer_time:u?u.end-u.start:void 0,playback_url:md(n,s,d),playback_quality:oe(d)};this.logPreloadStarted(l)}}),i(e.events.ready$,()=>{if(this.statContext.preload){let n=e.info.currentBuffer$.getValue(),s={buffer_time:n?n.end-n.start:void 0};this.logPreloadEnded(s)}}),i(e.events.playing$,()=>{this.logPlay()}),i(e.info.playbackState$,n=>{if(n===K.PlaybackState.PLAYING){let s=e.info.currentBuffer$.getValue(),u={buffer_time:s?s.end-s.start:void 0};if(this.logPlaying(u),this.isStarted)this.logResume();else{this.isStarted=!0;let d=e.info.currentQuality$.getValue(),l=e.info.isAutoQualityEnabled$.getValue(),p=e.info.muted$.getValue(),h=e.info.volume$.getValue(),c=e.info.surface$.getValue(),f=e.info.availableTextTracks$.getValue(),g=e.info.currentTextTrack$.getValue(),y=e.info.currentAudioStream$.getValue(),S=e.info.currentPlaybackRate$.getValue(),I={playback_quality:oe(d),user_quality:l?"auto":oe(d),player_width:this.playerSize$.getValue().width,player_height:this.playerSize$.getValue().height,muted:p,sound_volume:h,buffer_time:s?Math.round(s.end-s.start):void 0,mode:bd(c),visibility:yd(c),subtitles_enabled:!!g,auto_subtitles:!!f.find(({id:P})=>P===g)?.isAuto,audio_track_lang:y?.language,playback_rate:S,recom_info:this.statContext.recomInfo};this.logPlaybackStarted(I)}}else n===K.PlaybackState.PAUSED&&this.logPause()}),i(e.events.willSeek$,({to:n})=>{let s={target_position:n,seek_type:this.seekAction$.getValue()};this.logSeeking(s)}),i(e.events.seeked$,()=>{let s={target_position:e.info.position$.getValue(),seek_type:this.seekAction$.getValue()};this.logSeeked(s),this.seekAction$.next("unknown")}),i((0,T.merge)(e.info.isBuffering$,e.info.isStalled$),n=>{n&&this.logShowLoader()}),i(e.info.currentQuality$,n=>{if(n){let s=e.info.isAutoQualityEnabled$.getValue(),u=e.info.currentVideoStream$.getValue()?.codec,d=e.info.currentAudioStream$.getValue()?.codec,l={user_quality:s?"auto":oe(n),playback_quality:oe(n),download_quality:oe(n),codec_info:u&&d?`${u},${d}`:void 0,manual_switch:!s};this.logQualityChanged(l)}}),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToUi(e){let{subscribe:r,subscription:i}=Vy();return r(e.actionSeek$,this.seekAction$),r(e.playerSize$,this.playerSize$),this.subscription.add(i),i}getDeviceId(){return this.deviceId}resetViewSession(){this.thinOneStatDebugLog({message:"VSID reset"}),this.vsid$.next(Id()),this.eventNumber=0}destroy(){this.api.destroy()}createRequiredParams(e){let r=this.vsid$.getValue();(0,T.assertNonNullable)(r);let i=this.eventNumber++;return{vsid:r,uv_movie_id:this.statContext.movieId,event_name:e,client_time:Date.now(),application:`@vkontakte/videoplayer-statistics:${C}`,platform:`web:${K.clientChecker.device.isMobile?"mobile":"desktop"}`,product:this.statContext.product,event_number:i,playback_position:this.isLive?void 0:Math.round(this.position),current_tvt:this.getTotalViewTime(),cdn_host:this.cdnHostname}}createRequiredFatParams(){return{stats_version:C,browser:K.clientChecker.browser.current,browser_version:String(K.clientChecker.browser.currentVersion),os:K.clientChecker.device.current,os_version:"",device_type:K.clientChecker.device.isMobile?"mobile":"desktop",navigation:this.statContext.navigation}}log(e,r,i=!1){let o=this.createRequiredParams(e),n={};i&&(n=this.createRequiredFatParams()),this.logger.log({...o,...n,...r})}logWatchCoverage(e){this.log("watch_coverage",e,!0)}logWatchCoverageLive(e){this.log("watch_coverage_live",e,!0)}logWatchedN(e){this.log("watched_n",e,!0)}logStartSession(e){this.log("start_session",e,!0)}logPreloadStarted(e){this.log("preload_started",e)}logPreloadEnded(e){this.log("preload_ended",e)}logPlaybackStarted(e){this.log("playback_started",e,!0)}logPlay(){this.log("play")}logPlaying(e){this.log("playing",e)}logPause(){this.log("pause")}logResume(){this.log("resume")}logSeeking(e){this.log("seeking",e)}logSeeked(e){this.log("seeked",e)}logShowLoader(){this.log("show_loader")}logQualityChanged(e){this.log("quality_changed",e)}logFailover(e){this.log("failover",e)}resubscribeBeforeunload(){this.beforeunloadSubscription?.unsubscribe(),this.beforeunloadSubscription=(0,T.fromEvent)(window,"beforeunload").subscribe(()=>{}),this.subscription.add(this.beforeunloadSubscription)}};var Pd={};var Fy=(t,e={})=>{let i=e.timeout||1,o=performance.now();return window.setTimeout(()=>{t({get didTimeout(){return e.timeout?!1:performance.now()-o-1>i},timeRemaining(){return Math.max(0,1+(performance.now()-o))}})},1)},Uy=t=>window.clearTimeout(t),Ed=t=>typeof t=="function"&&t?.toString().endsWith("{ [native code] }"),Td=!Ed(window.requestIdleCallback)||!Ed(window.cancelIdleCallback),wd=Td?Fy:window.requestIdleCallback,Od=Td?Uy:window.cancelIdleCallback;var at=require("@vkontakte/videoplayer-core"),Ad=require("@vkontakte/videoplayer-shared");var cr=class{constructor(){this.startTime=null;this.stopTime=null;this.accumulatedTime=0}get time(){return Math.floor(this.timeMs/1e3)}get timeMs(){return this.startTime===null?0:(this.stopTime??this.now())-this.startTime-this.accumulatedTime}get isRunning(){return this.startTime!==null&&this.stopTime===null}start(){this.isRunning||(this.stopTime!==null?(this.accumulatedTime+=this.now()-this.stopTime,this.stopTime=null):this.startTime=this.now())}stop(){this.isRunning&&(this.stopTime=this.now())}reset(){this.startTime=null,this.stopTime=null,this.accumulatedTime=0}now(){return Date.now()}};var xd=()=>window.Image?new Image:document.createElement("img");var lr=class{constructor(e){this.position=0;this.started=!1;this.heartbeatPixels=[];this.heartbeatLastTimeSent={};this.idleCallbackIds=[];this.stopwatch=new cr;this.subscription=new at.Subscription;this.params=e;let r=new Ad.Logger;this.log=r.createComponentLog("MediascopePixel")}attachTo(e){this.subscription.add(e.info.playbackState$.subscribe(r=>this.onPlaybackState(r))).add(e.info.position$.subscribe(r=>this.onPosition(r))).add(e.info.atLiveEdge$.subscribe(r=>this.isActiveLive=r)),this.subscription.add(e.events.willSeek$.subscribe(()=>this.onWillSeek())).add(e.events.seeked$.subscribe(()=>this.onSeeked())).add(e.events.ended$.subscribe(()=>this.onEnded()))}destroy(){this.stopwatch.reset(),this.subscription.unsubscribe(),window.clearTimeout(this.heartbeatFirstTimeoutId),this.idleCallbackIds.forEach(e=>Od(e)),this.send("stop")}onPlaybackState(e){e===at.PlaybackState.PLAYING?this.started?this.play():this.start():e===at.PlaybackState.PAUSED&&this.pause()}start(){this.started=!0,this.stopwatch.start(),this.send("start"),this.heartbeatPixels=this.prepareHeartbeatPixels(),this.heartbeatInterval=this.heartbeatPixels[0]?.interval;let e=this.heartbeatPixels[0]?.url,r=this.heartbeatPixels[0]?.delay;if(r!==void 0&&e)try{this.heartbeatFirstTimeoutId=window.setTimeout(()=>{this.sendHeartbeat(e)},r*1e3)}catch(i){this.log({message:i.message})}}play(){this.stopwatch.start(),this.send("resume")}pause(){this.stopwatch.stop(),this.send("pause")}onPosition(e){if(this.position=e,this.heartbeatInterval&&this.stopwatch.time!==0&&this.stopwatch.time%this.heartbeatInterval===0)for(let[r,{url:i}]of this.heartbeatPixels.entries())this.heartbeatLastTimeSent[r]!==this.stopwatch.time&&(this.heartbeatLastTimeSent[r]=this.stopwatch.time,this.sendHeartbeat(i))}onWillSeek(){this.started&&this.send("stop")}onSeeked(){this.started&&this.send("start")}onEnded(){this.stopwatch.stop(),this.send("stop")}validatePixels(e,r){return e?.filter(i=>i.event===r.event&&r.keys.every(o=>!!i[o]))}getFrameTimestamp(){let e;if(this.isActiveLive){let r=Math.floor(Math.random()*25)+5;e=Date.now()/1e3-r}else e=this.position||0;return Math.floor(e)}getUTC(){return Math.floor(Date.now()/1e3)}prepareUrl(e){let r=new URL(e);return r.pathname=r.pathname.replace("{@fts_fake_sec}",String(this.getFrameTimestamp())).replace("{@utc_sec}",String(this.getUTC())),r.search=[...new URLSearchParams(r.search)].filter(([i,o])=>!/={@[\w]+}/.test(`${i}=${o}`)).map(i=>i.join("=")).join("&"),r.toString()}preparePixels(e){return this.validatePixels(this.params.pixels,{event:e,keys:["url"]})}prepareHeartbeatPixels(){return this.validatePixels(this.params.pixels,{event:"heartbeat",keys:["url","interval"]})}call(e){try{this.idleCallbackIds.push(wd(()=>xd().src=this.prepareUrl(e)))}catch(r){this.log({message:r.message})}}send(e){let r=this.preparePixels(e);for(let{url:i}of r)this.call(i)}sendHeartbeat(e){this.call(e)}};