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