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