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