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