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