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