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