@vkontakte/videoplayer-statistics 1.0.65-dev.a42a4411.0 → 1.0.65-dev.ff684b5c.0

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