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