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