@vkontakte/videoplayer-statistics 1.0.34 → 1.0.35-beta.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/es2015.cjs.js +4 -4
- package/es2015.esm.js +4 -4
- package/es2018.cjs.js +4 -4
- package/es2018.esm.js +4 -4
- package/esnext.cjs.js +4 -4
- package/esnext.esm.js +4 -4
- package/evergreen.esm.js +4 -4
- package/index.d.ts +155 -53
- package/package.json +3 -3
package/es2015.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-statistics v1.0.
|
|
3
|
-
*
|
|
4
|
-
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-
|
|
2
|
+
* @vkontakte/videoplayer-statistics v1.0.35-beta.0
|
|
3
|
+
* Wed, 24 May 2023 14:18:45 GMT
|
|
4
|
+
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-35/doc/
|
|
5
5
|
*/
|
|
6
|
-
"use strict";var h=require("@vkontakte/videoplayer-shared/es2015.cjs.js"),f=require("@vkontakte/videoplayer-core/es2015.cjs.js"),ho=require("lodash/debounce.js");function w(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function v(c){try{s(n.next(c))}catch(l){i(l)}}function u(c){try{s(n.throw(c))}catch(l){i(l)}}function s(c){c.done?a(c.value):o(c.value).then(v,u)}s((n=n.apply(e,r||[])).next())})}var Hr=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},ue=function(e){return e&&e.Math==Math&&e},g=ue(typeof globalThis=="object"&&globalThis)||ue(typeof window=="object"&&window)||ue(typeof self=="object"&&self)||ue(typeof Hr=="object"&&Hr)||function(){return this}()||Function("return this")(),T=function(e){try{return!!e()}catch(r){return!0}},po=T,Ae=!po(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),yo=Ae,Xt=Function.prototype,qr=Xt.apply,Kr=Xt.call,Zt=typeof Reflect=="object"&&Reflect.apply||(yo?Kr.bind(qr):function(){return Kr.apply(qr,arguments)}),en=Ae,rn=Function.prototype,dr=rn.call,go=en&&rn.bind.bind(dr,dr),O=en?go:function(e){return function(){return dr.apply(e,arguments)}},tn=O,$o=tn({}.toString),bo=tn("".slice),Ne=function(e){return bo($o(e),8,-1)},mo=Ne,Eo=O,nn=function(e){if(mo(e)==="Function")return Eo(e)},hr=typeof document=="object"&&document.all,So=typeof hr=="undefined"&&hr!==void 0,on={all:hr,IS_HTMLDDA:So},an=on,To=an.all,y=an.IS_HTMLDDA?function(e){return typeof e=="function"||e===To}:function(e){return typeof e=="function"},Ir={},Oo=T,J=!Oo(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),_o=Ae,le=Function.prototype.call,_=_o?le.bind(le):function(){return le.apply(le,arguments)},sn={},cn={}.propertyIsEnumerable,un=Object.getOwnPropertyDescriptor,Po=un&&!cn.call({1:2},1);sn.f=Po?function(r){var t=un(this,r);return!!t&&t.enumerable}:cn;var ln=function(e,r){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:r}},Io=O,wo=T,Ro=Ne,xe=Object,Co=Io("".split),Ao=wo(function(){return!xe("z").propertyIsEnumerable(0)})?function(e){return Ro(e)=="String"?Co(e,""):xe(e)}:xe,De=function(e){return e==null},No=De,Do=TypeError,vn=function(e){if(No(e))throw Do("Can't call method on "+e);return e},jo=Ao,Lo=vn,Mo=function(e){return jo(Lo(e))},Qr=y,fn=on,Uo=fn.all,M=fn.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:Qr(e)||e===Uo}:function(e){return typeof e=="object"?e!==null:Qr(e)},dn={},Ve=dn,He=g,ko=y,Wr=function(e){return ko(e)?e:void 0},C=function(e,r){return arguments.length<2?Wr(Ve[e])||Wr(He[e]):Ve[e]&&Ve[e][r]||He[e]&&He[e][r]},Bo=O,wr=Bo({}.isPrototypeOf),je=typeof navigator!="undefined"&&String(navigator.userAgent)||"",hn=g,qe=je,Gr=hn.process,zr=hn.Deno,Yr=Gr&&Gr.versions||zr&&zr.version,Jr=Yr&&Yr.v8,E,Se;Jr&&(E=Jr.split("."),Se=E[0]>0&&E[0]<4?1:+(E[0]+E[1]));!Se&&qe&&(E=qe.match(/Edge\/(\d+)/),(!E||E[1]>=74)&&(E=qe.match(/Chrome\/(\d+)/),E&&(Se=+E[1])));var pn=Se,Xr=pn,Fo=T,yn=!!Object.getOwnPropertySymbols&&!Fo(function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Xr&&Xr<41}),xo=yn,gn=xo&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Vo=C,Ho=y,qo=wr,Ko=gn,Qo=Object,$n=Ko?function(e){return typeof e=="symbol"}:function(e){var r=Vo("Symbol");return Ho(r)&&qo(r.prototype,Qo(e))},Wo=String,Le=function(e){try{return Wo(e)}catch(r){return"Object"}},Go=y,zo=Le,Yo=TypeError,U=function(e){if(Go(e))return e;throw Yo(zo(e)+" is not a function")},Jo=U,Xo=De,Rr=function(e,r){var t=e[r];return Xo(t)?void 0:Jo(t)},Ke=_,Qe=y,We=M,Zo=TypeError,ea=function(e,r){var t,n;if(r==="string"&&Qe(t=e.toString)&&!We(n=Ke(t,e))||Qe(t=e.valueOf)&&!We(n=Ke(t,e))||r!=="string"&&Qe(t=e.toString)&&!We(n=Ke(t,e)))return n;throw Zo("Can't convert object to primitive value")},Te={},ra={get exports(){return Te},set exports(e){Te=e}},ie=!0,Zr=g,ta=Object.defineProperty,na=function(e,r){try{ta(Zr,e,{value:r,configurable:!0,writable:!0})}catch(t){Zr[e]=r}return r},oa=g,aa=na,et="__core-js_shared__",ia=oa[et]||aa(et,{}),Cr=ia,rt=Cr;(ra.exports=function(e,r){return rt[e]||(rt[e]=r!==void 0?r:{})})("versions",[]).push({version:"3.27.2",mode:"pure",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.27.2/LICENSE",source:"https://github.com/zloirock/core-js"});var sa=vn,ca=Object,ua=function(e){return ca(sa(e))},la=O,va=ua,fa=la({}.hasOwnProperty),X=Object.hasOwn||function(r,t){return fa(va(r),t)},da=O,ha=0,pa=Math.random(),ya=da(1 .toString),bn=function(e){return"Symbol("+(e===void 0?"":e)+")_"+ya(++ha+pa,36)},ga=g,$a=Te,tt=X,ba=bn,ma=yn,Ea=gn,Q=ga.Symbol,Ge=$a("wks"),Sa=Ea?Q.for||Q:Q&&Q.withoutSetter||ba,P=function(e){return tt(Ge,e)||(Ge[e]=ma&&tt(Q,e)?Q[e]:Sa("Symbol."+e)),Ge[e]},Ta=_,nt=M,ot=$n,Oa=Rr,_a=ea,Pa=P,Ia=TypeError,wa=Pa("toPrimitive"),Ra=function(e,r){if(!nt(e)||ot(e))return e;var t=Oa(e,wa),n;if(t){if(r===void 0&&(r="default"),n=Ta(t,e,r),!nt(n)||ot(n))return n;throw Ia("Can't convert object to primitive value")}return r===void 0&&(r="number"),_a(e,r)},Ca=Ra,Aa=$n,mn=function(e){var r=Ca(e,"string");return Aa(r)?r:r+""},Na=g,at=M,pr=Na.document,Da=at(pr)&&at(pr.createElement),En=function(e){return Da?pr.createElement(e):{}},ja=J,La=T,Ma=En,Sn=!ja&&!La(function(){return Object.defineProperty(Ma("div"),"a",{get:function(){return 7}}).a!=7}),Ua=J,ka=_,Ba=sn,Fa=ln,xa=Mo,Va=mn,Ha=X,qa=Sn,it=Object.getOwnPropertyDescriptor;Ir.f=Ua?it:function(r,t){if(r=xa(r),t=Va(t),qa)try{return it(r,t)}catch(n){}if(Ha(r,t))return Fa(!ka(Ba.f,r,t),r[t])};var Ka=T,Qa=y,Wa=/#|\.prototype\./,se=function(e,r){var t=za[Ga(e)];return t==Ja?!0:t==Ya?!1:Qa(r)?Ka(r):!!r},Ga=se.normalize=function(e){return String(e).replace(Wa,".").toLowerCase()},za=se.data={},Ya=se.NATIVE="N",Ja=se.POLYFILL="P",Tn=se,st=nn,Xa=U,Za=Ae,ei=st(st.bind),Me=function(e,r){return Xa(e),r===void 0?e:Za?ei(e,r):function(){return e.apply(r,arguments)}},Ue={},ri=J,ti=T,ni=ri&&ti(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),oi=M,ai=String,ii=TypeError,k=function(e){if(oi(e))return e;throw ii(ai(e)+" is not an object")},si=J,ci=Sn,ui=ni,ve=k,ct=mn,li=TypeError,ze=Object.defineProperty,vi=Object.getOwnPropertyDescriptor,Ye="enumerable",Je="configurable",Xe="writable";Ue.f=si?ui?function(r,t,n){if(ve(r),t=ct(t),ve(n),typeof r=="function"&&t==="prototype"&&"value"in n&&Xe in n&&!n[Xe]){var o=vi(r,t);o&&o[Xe]&&(r[t]=n.value,n={configurable:Je in n?n[Je]:o[Je],enumerable:Ye in n?n[Ye]:o[Ye],writable:!1})}return ze(r,t,n)}:ze:function(r,t,n){if(ve(r),t=ct(t),ve(n),ci)try{return ze(r,t,n)}catch(o){}if("get"in n||"set"in n)throw li("Accessors not supported");return"value"in n&&(r[t]=n.value),r};var fi=J,di=Ue,hi=ln,ke=fi?function(e,r,t){return di.f(e,r,hi(1,t))}:function(e,r,t){return e[r]=t,e},fe=g,pi=Zt,yi=nn,gi=y,$i=Ir.f,bi=Tn,x=dn,mi=Me,V=ke,ut=X,Ei=function(e){var r=function(t,n,o){if(this instanceof r){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,o)}return pi(e,this,arguments)};return r.prototype=e.prototype,r},B=function(e,r){var t=e.target,n=e.global,o=e.stat,a=e.proto,i=n?fe:o?fe[t]:(fe[t]||{}).prototype,v=n?x:x[t]||V(x,t,{})[t],u=v.prototype,s,c,l,p,d,m,A,I,F;for(p in r)s=bi(n?p:t+(o?".":"#")+p,e.forced),c=!s&&i&&ut(i,p),m=v[p],c&&(e.dontCallGetSet?(F=$i(i,p),A=F&&F.value):A=i[p]),d=c&&A?A:r[p],!(c&&typeof m==typeof d)&&(e.bind&&c?I=mi(d,fe):e.wrap&&c?I=Ei(d):a&&gi(d)?I=yi(d):I=d,(e.sham||d&&d.sham||m&&m.sham)&&V(I,"sham",!0),V(v,p,I),a&&(l=t+"Prototype",ut(x,l)||V(x,l,{}),V(x[l],p,d),e.real&&u&&(s||!u[p])&&V(u,p,d)))},Si=Ne,Be=typeof process!="undefined"&&Si(process)=="process",Ti=ke,Ar=function(e,r,t,n){return n&&n.enumerable?e[r]=t:Ti(e,r,t),e},Oi=y,_i=String,Pi=TypeError,Ii=function(e){if(typeof e=="object"||Oi(e))return e;throw Pi("Can't set "+_i(e)+" as a prototype")},wi=O,Ri=k,Ci=Ii,Ai=Object.setPrototypeOf||("__proto__"in{}?function(){var e=!1,r={},t;try{t=wi(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(r,[]),e=r instanceof Array}catch(n){}return function(o,a){return Ri(o),Ci(a),e?t(o,a):o.__proto__=a,o}}():void 0),Ni=P,Di=Ni("toStringTag"),On={};On[Di]="z";var Nr=String(On)==="[object z]",ji=Nr,Li=y,be=Ne,Mi=P,Ui=Mi("toStringTag"),ki=Object,Bi=be(function(){return arguments}())=="Arguments",Fi=function(e,r){try{return e[r]}catch(t){}},Dr=ji?be:function(e){var r,t,n;return e===void 0?"Undefined":e===null?"Null":typeof(t=Fi(r=ki(e),Ui))=="string"?t:Bi?be(r):(n=be(r))=="Object"&&Li(r.callee)?"Arguments":n},xi=Nr,Vi=Dr,Hi=xi?{}.toString:function(){return"[object "+Vi(this)+"]"},qi=Nr,Ki=Ue.f,Qi=ke,Wi=X,Gi=Hi,zi=P,lt=zi("toStringTag"),Yi=function(e,r,t,n){if(e){var o=t?e:e.prototype;Wi(o,lt)||Ki(o,lt,{configurable:!0,value:r}),n&&!qi&&Qi(o,"toString",Gi)}},Ji=C,Xi=Ue,Zi=P,es=J,vt=Zi("species"),rs=function(e){var r=Ji(e),t=Xi.f;es&&r&&!r[vt]&&t(r,vt,{configurable:!0,get:function(){return this}})},ts=wr,ns=TypeError,os=function(e,r){if(ts(r,e))return e;throw ns("Incorrect invocation")},as=O,is=y,yr=Cr,ss=as(Function.toString);is(yr.inspectSource)||(yr.inspectSource=function(e){return ss(e)});var _n=yr.inspectSource,cs=O,us=T,Pn=y,ls=Dr,vs=C,fs=_n,In=function(){},ds=[],wn=vs("Reflect","construct"),jr=/^\s*(?:class|function)\b/,hs=cs(jr.exec),ps=!jr.exec(In),re=function(r){if(!Pn(r))return!1;try{return wn(In,ds,r),!0}catch(t){return!1}},Rn=function(r){if(!Pn(r))return!1;switch(ls(r)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ps||!!hs(jr,fs(r))}catch(t){return!0}};Rn.sham=!0;var ys=!wn||us(function(){var e;return re(re.call)||!re(Object)||!re(function(){e=!0})||e})?Rn:re,gs=ys,$s=Le,bs=TypeError,ms=function(e){if(gs(e))return e;throw bs($s(e)+" is not a constructor")},ft=k,Es=ms,Ss=De,Ts=P,Os=Ts("species"),Cn=function(e,r){var t=ft(e).constructor,n;return t===void 0||Ss(n=ft(t)[Os])?r:Es(n)},_s=C,Ps=_s("document","documentElement"),Is=O,ws=Is([].slice),Rs=TypeError,Cs=function(e,r){if(e<r)throw Rs("Not enough arguments");return e},As=je,An=/(?:ipad|iphone|ipod).*applewebkit/i.test(As),$=g,Ns=Zt,Ds=Me,dt=y,js=X,Nn=T,ht=Ps,Ls=ws,pt=En,Ms=Cs,Us=An,ks=Be,gr=$.setImmediate,$r=$.clearImmediate,Bs=$.process,Ze=$.Dispatch,Fs=$.Function,yt=$.MessageChannel,xs=$.String,er=0,te={},gt="onreadystatechange",oe,N,rr,tr;Nn(function(){oe=$.location});var Lr=function(e){if(js(te,e)){var r=te[e];delete te[e],r()}},nr=function(e){return function(){Lr(e)}},$t=function(e){Lr(e.data)},bt=function(e){$.postMessage(xs(e),oe.protocol+"//"+oe.host)};(!gr||!$r)&&(gr=function(r){Ms(arguments.length,1);var t=dt(r)?r:Fs(r),n=Ls(arguments,1);return te[++er]=function(){Ns(t,void 0,n)},N(er),er},$r=function(r){delete te[r]},ks?N=function(e){Bs.nextTick(nr(e))}:Ze&&Ze.now?N=function(e){Ze.now(nr(e))}:yt&&!Us?(rr=new yt,tr=rr.port2,rr.port1.onmessage=$t,N=Ds(tr.postMessage,tr)):$.addEventListener&&dt($.postMessage)&&!$.importScripts&&oe&&oe.protocol!=="file:"&&!Nn(bt)?(N=bt,$.addEventListener("message",$t,!1)):gt in pt("script")?N=function(e){ht.appendChild(pt("script"))[gt]=function(){ht.removeChild(this),Lr(e)}}:N=function(e){setTimeout(nr(e),0)});var Dn={set:gr,clear:$r},jn=function(){this.head=null,this.tail=null};jn.prototype={add:function(e){var r={item:e,next:null},t=this.tail;t?t.next=r:this.head=r,this.tail=r},get:function(){var e=this.head;if(e){var r=this.head=e.next;return r===null&&(this.tail=null),e.item}}};var Ln=jn,Vs=je,Hs=/ipad|iphone|ipod/i.test(Vs)&&typeof Pebble!="undefined",qs=je,Ks=/web0s(?!.*chrome)/i.test(qs),L=g,mt=Me,Qs=Ir.f,or=Dn.set,Ws=Ln,Gs=An,zs=Hs,Ys=Ks,ar=Be,Et=L.MutationObserver||L.WebKitMutationObserver,St=L.document,Tt=L.process,de=L.Promise,Ot=Qs(L,"queueMicrotask"),br=Ot&&Ot.value,H,ir,sr,he,_t;if(!br){var pe=new Ws,ye=function(){var e,r;for(ar&&(e=Tt.domain)&&e.exit();r=pe.get();)try{r()}catch(t){throw pe.head&&H(),t}e&&e.enter()};!Gs&&!ar&&!Ys&&Et&&St?(ir=!0,sr=St.createTextNode(""),new Et(ye).observe(sr,{characterData:!0}),H=function(){sr.data=ir=!ir}):!zs&&de&&de.resolve?(he=de.resolve(void 0),he.constructor=de,_t=mt(he.then,he),H=function(){_t(ye)}):ar?H=function(){Tt.nextTick(ye)}:(or=mt(or,L),H=function(){or(ye)}),br=function(e){pe.head||H(),pe.add(e)}}var Js=br,Xs=function(e,r){try{arguments.length==1?console.error(e):console.error(e,r)}catch(t){}},Mr=function(e){try{return{error:!1,value:e()}}catch(r){return{error:!0,value:r}}},Zs=g,ec=y,Pt=Zs.WeakMap,rc=ec(Pt)&&/native code/.test(String(Pt)),tc=Te,nc=bn,It=tc("keys"),oc=function(e){return It[e]||(It[e]=nc(e))},ac={},ic=rc,Mn=g,sc=M,cc=ke,cr=X,ur=Cr,uc=oc,lc=ac,wt="Object already initialized",mr=Mn.TypeError,vc=Mn.WeakMap,Oe,ae,_e,fc=function(e){return _e(e)?ae(e):Oe(e,{})},dc=function(e){return function(r){var t;if(!sc(r)||(t=ae(r)).type!==e)throw mr("Incompatible receiver, "+e+" required");return t}};if(ic||ur.state){var S=ur.state||(ur.state=new vc);S.get=S.get,S.has=S.has,S.set=S.set,Oe=function(e,r){if(S.has(e))throw mr(wt);return r.facade=e,S.set(e,r),r},ae=function(e){return S.get(e)||{}},_e=function(e){return S.has(e)}}else{var q=uc("state");lc[q]=!0,Oe=function(e,r){if(cr(e,q))throw mr(wt);return r.facade=e,cc(e,q,r),r},ae=function(e){return cr(e,q)?e[q]:{}},_e=function(e){return cr(e,q)}}var hc={set:Oe,get:ae,has:_e,enforce:fc,getterFor:dc},pc=g,Z=pc.Promise,Un=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",yc=Un,gc=Be,$c=!yc&&!gc&&typeof window=="object"&&typeof document=="object",bc=g,ne=Z,mc=y,Ec=Tn,Sc=_n,Tc=P,Oc=$c,_c=Un,Pc=ie,lr=pn,Rt=ne&&ne.prototype,Ic=Tc("species"),Er=!1,kn=mc(bc.PromiseRejectionEvent),wc=Ec("Promise",function(){var e=Sc(ne),r=e!==String(ne);if(!r&&lr===66||Pc&&!(Rt.catch&&Rt.finally))return!0;if(!lr||lr<51||!/native code/.test(e)){var t=new ne(function(a){a(1)}),n=function(a){a(function(){},function(){})},o=t.constructor={};if(o[Ic]=n,Er=t.then(function(){})instanceof n,!Er)return!0}return!r&&(Oc||_c)&&!kn}),ce={CONSTRUCTOR:wc,REJECTION_EVENT:kn,SUBCLASSING:Er},ee={},Ct=U,Rc=TypeError,Cc=function(e){var r,t;this.promise=new e(function(n,o){if(r!==void 0||t!==void 0)throw Rc("Bad Promise constructor");r=n,t=o}),this.resolve=Ct(r),this.reject=Ct(t)};ee.f=function(e){return new Cc(e)};var Ac=B,Nc=ie,Pe=Be,R=g,z=_,At=Ar,Nt=Ai,Dc=Yi,jc=rs,Lc=U,me=y,Mc=M,Uc=os,kc=Cn,Bn=Dn.set,Ur=Js,Bc=Xs,Fc=Mr,xc=Ln,Fn=hc,Ie=Z,kr=ce,xn=ee,Fe="Promise",Vn=kr.CONSTRUCTOR,Vc=kr.REJECTION_EVENT,Hc=kr.SUBCLASSING,vr=Fn.getterFor(Fe),qc=Fn.set,K=Ie&&Ie.prototype,D=Ie,ge=K,Hn=R.TypeError,Sr=R.document,Br=R.process,Tr=xn.f,Kc=Tr,Qc=!!(Sr&&Sr.createEvent&&R.dispatchEvent),qn="unhandledrejection",Wc="rejectionhandled",Dt=0,Kn=1,Gc=2,Fr=1,Qn=2,$e,jt,zc,Lt,Wn=function(e){var r;return Mc(e)&&me(r=e.then)?r:!1},Gn=function(e,r){var t=r.value,n=r.state==Kn,o=n?e.ok:e.fail,a=e.resolve,i=e.reject,v=e.domain,u,s,c;try{o?(n||(r.rejection===Qn&&Jc(r),r.rejection=Fr),o===!0?u=t:(v&&v.enter(),u=o(t),v&&(v.exit(),c=!0)),u===e.promise?i(Hn("Promise-chain cycle")):(s=Wn(u))?z(s,u,a,i):a(u)):i(t)}catch(l){v&&!c&&v.exit(),i(l)}},zn=function(e,r){e.notified||(e.notified=!0,Ur(function(){for(var t=e.reactions,n;n=t.get();)Gn(n,e);e.notified=!1,r&&!e.rejection&&Yc(e)}))},Yn=function(e,r,t){var n,o;Qc?(n=Sr.createEvent("Event"),n.promise=r,n.reason=t,n.initEvent(e,!1,!0),R.dispatchEvent(n)):n={promise:r,reason:t},!Vc&&(o=R["on"+e])?o(n):e===qn&&Bc("Unhandled promise rejection",t)},Yc=function(e){z(Bn,R,function(){var r=e.facade,t=e.value,n=Mt(e),o;if(n&&(o=Fc(function(){Pe?Br.emit("unhandledRejection",t,r):Yn(qn,r,t)}),e.rejection=Pe||Mt(e)?Qn:Fr,o.error))throw o.value})},Mt=function(e){return e.rejection!==Fr&&!e.parent},Jc=function(e){z(Bn,R,function(){var r=e.facade;Pe?Br.emit("rejectionHandled",r):Yn(Wc,r,e.value)})},W=function(e,r,t){return function(n){e(r,n,t)}},G=function(e,r,t){e.done||(e.done=!0,t&&(e=t),e.value=r,e.state=Gc,zn(e,!0))},Or=function(e,r,t){if(!e.done){e.done=!0,t&&(e=t);try{if(e.facade===r)throw Hn("Promise can't be resolved itself");var n=Wn(r);n?Ur(function(){var o={done:!1};try{z(n,r,W(Or,o,e),W(G,o,e))}catch(a){G(o,a,e)}}):(e.value=r,e.state=Kn,zn(e,!1))}catch(o){G({done:!1},o,e)}}};if(Vn&&(D=function(r){Uc(this,ge),Lc(r),z($e,this);var t=vr(this);try{r(W(Or,t),W(G,t))}catch(n){G(t,n)}},ge=D.prototype,$e=function(r){qc(this,{type:Fe,done:!1,notified:!1,parent:!1,reactions:new xc,rejection:!1,state:Dt,value:void 0})},$e.prototype=At(ge,"then",function(r,t){var n=vr(this),o=Tr(kc(this,D));return n.parent=!0,o.ok=me(r)?r:!0,o.fail=me(t)&&t,o.domain=Pe?Br.domain:void 0,n.state==Dt?n.reactions.add(o):Ur(function(){Gn(o,n)}),o.promise}),jt=function(){var e=new $e,r=vr(e);this.promise=e,this.resolve=W(Or,r),this.reject=W(G,r)},xn.f=Tr=function(e){return e===D||e===zc?new jt(e):Kc(e)},!Nc&&me(Ie)&&K!==Object.prototype)){Lt=K.then,Hc||At(K,"then",function(r,t){var n=this;return new D(function(o,a){z(Lt,n,o,a)}).then(r,t)},{unsafe:!0});try{delete K.constructor}catch(e){}Nt&&Nt(K,ge)}Ac({global:!0,constructor:!0,wrap:!0,forced:Vn},{Promise:D});Dc(D,Fe,!1,!0);jc(Fe);var Jn={},Xc=P,Zc=Jn,eu=Xc("iterator"),ru=Array.prototype,tu=function(e){return e!==void 0&&(Zc.Array===e||ru[eu]===e)},nu=Math.ceil,ou=Math.floor,au=Math.trunc||function(r){var t=+r;return(t>0?ou:nu)(t)},iu=au,su=function(e){var r=+e;return r!==r||r===0?0:iu(r)},cu=su,uu=Math.min,lu=function(e){return e>0?uu(cu(e),9007199254740991):0},vu=lu,fu=function(e){return vu(e.length)},du=Dr,Ut=Rr,hu=De,pu=Jn,yu=P,gu=yu("iterator"),Xn=function(e){if(!hu(e))return Ut(e,gu)||Ut(e,"@@iterator")||pu[du(e)]},$u=_,bu=U,mu=k,Eu=Le,Su=Xn,Tu=TypeError,Ou=function(e,r){var t=arguments.length<2?Su(e):r;if(bu(t))return mu($u(t,e));throw Tu(Eu(e)+" is not iterable")},_u=_,kt=k,Pu=Rr,Iu=function(e,r,t){var n,o;kt(e);try{if(n=Pu(e,"return"),!n){if(r==="throw")throw t;return t}n=_u(n,e)}catch(a){o=!0,n=a}if(r==="throw")throw t;if(o)throw n;return kt(n),t},wu=Me,Ru=_,Cu=k,Au=Le,Nu=tu,Du=fu,Bt=wr,ju=Ou,Lu=Xn,Ft=Iu,Mu=TypeError,Ee=function(e,r){this.stopped=e,this.result=r},xt=Ee.prototype,Zn=function(e,r,t){var n=t&&t.that,o=!!(t&&t.AS_ENTRIES),a=!!(t&&t.IS_RECORD),i=!!(t&&t.IS_ITERATOR),v=!!(t&&t.INTERRUPTED),u=wu(r,n),s,c,l,p,d,m,A,I=function(b){return s&&Ft(s,"normal",b),new Ee(!0,b)},F=function(b){return o?(Cu(b),v?u(b[0],b[1],I):u(b[0],b[1])):v?u(b,I):u(b)};if(a)s=e.iterator;else if(i)s=e;else{if(c=Lu(e),!c)throw Mu(Au(e)+" is not iterable");if(Nu(c)){for(l=0,p=Du(e);p>l;l++)if(d=F(e[l]),d&&Bt(xt,d))return d;return new Ee(!1)}s=ju(e,c)}for(m=a?e.next:s.next;!(A=Ru(m,s)).done;){try{d=F(A.value)}catch(b){Ft(s,"throw",b)}if(typeof d=="object"&&d&&Bt(xt,d))return d}return new Ee(!1)},Uu=P,eo=Uu("iterator"),ro=!1;try{var ku=0,Vt={next:function(){return{done:!!ku++}},return:function(){ro=!0}};Vt[eo]=function(){return this},Array.from(Vt,function(){throw 2})}catch(e){}var Bu=function(e,r){if(!r&&!ro)return!1;var t=!1;try{var n={};n[eo]=function(){return{next:function(){return{done:t=!0}}}},e(n)}catch(o){}return t},Fu=Z,xu=Bu,Vu=ce.CONSTRUCTOR,to=Vu||!xu(function(e){Fu.all(e).then(void 0,function(){})}),Hu=B,qu=_,Ku=U,Qu=ee,Wu=Mr,Gu=Zn,zu=to;Hu({target:"Promise",stat:!0,forced:zu},{all:function(r){var t=this,n=Qu.f(t),o=n.resolve,a=n.reject,i=Wu(function(){var v=Ku(t.resolve),u=[],s=0,c=1;Gu(r,function(l){var p=s++,d=!1;c++,qu(v,t,l).then(function(m){d||(d=!0,u[p]=m,--c||o(u))},a)}),--c||o(u)});return i.error&&a(i.value),n.promise}});var Yu=B,Ju=ie,Xu=ce.CONSTRUCTOR,_r=Z,Zu=C,el=y,rl=Ar,Ht=_r&&_r.prototype;Yu({target:"Promise",proto:!0,forced:Xu,real:!0},{catch:function(e){return this.then(void 0,e)}});if(!Ju&&el(_r)){var qt=Zu("Promise").prototype.catch;Ht.catch!==qt&&rl(Ht,"catch",qt,{unsafe:!0})}var tl=B,nl=_,ol=U,al=ee,il=Mr,sl=Zn,cl=to;tl({target:"Promise",stat:!0,forced:cl},{race:function(r){var t=this,n=al.f(t),o=n.reject,a=il(function(){var i=ol(t.resolve);sl(r,function(v){nl(i,t,v).then(n.resolve,o)})});return a.error&&o(a.value),n.promise}});var ul=B,ll=_,vl=ee,fl=ce.CONSTRUCTOR;ul({target:"Promise",stat:!0,forced:fl},{reject:function(r){var t=vl.f(this);return ll(t.reject,void 0,r),t.promise}});var dl=k,hl=M,pl=ee,no=function(e,r){if(dl(e),hl(r)&&r.constructor===e)return r;var t=pl.f(e),n=t.resolve;return n(r),t.promise},yl=B,gl=C,oo=ie,$l=Z,ao=ce.CONSTRUCTOR,bl=no,ml=gl("Promise"),El=oo&&!ao;yl({target:"Promise",stat:!0,forced:oo||ao},{resolve:function(r){return bl(El&&this===ml?$l:this,r)}});var Sl=B,Tl=ie,we=Z,Ol=T,io=C,so=y,_l=Cn,Kt=no,Pl=Ar,Pr=we&&we.prototype,Il=!!we&&Ol(function(){Pr.finally.call({then:function(){}},function(){})});Sl({target:"Promise",proto:!0,real:!0,forced:Il},{finally:function(e){var r=_l(this,io("Promise")),t=so(e);return this.then(t?function(n){return Kt(r,e()).then(function(){return n})}:e,t?function(n){return Kt(r,e()).then(function(){throw n})}:e)}});if(!Tl&&so(we)){var Qt=io("Promise").prototype.finally;Pr.finally!==Qt&&Pl(Pr,"finally",Qt,{unsafe:!0})}var wl=C,Rl=wl,Cl=Rl,Al=Cl("Promise","finally"),Nl=Al,Dl=Nl,jl=Dl,Ll=jl,fr=Ll;const xr="_one-stat_",Y=(()=>{try{const e=Date.now().toString(),r=window.localStorage;r.setItem(e,e);const t=r.getItem(e)===e;return r.removeItem(e),t?r:null}catch(e){return null}})();function Ml(e){const r=Y?Y.getItem(xr+e):null;if(r===null)return null;try{return JSON.parse(r)}catch(t){return null}}function Ul(e,r){try{Y&&Y.setItem(xr+e,JSON.stringify(r))}catch(t){}}function kl(e){Y&&Y.removeItem(xr+e)}var Wt={get(e){return Ml(e)||null},set(e,r){Ul(e,r)},remove(e){kl(e)}};function Bl(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=new Array(36);let t=0,n,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?r[o]="-":o===14?r[o]="4":(t<=2&&(t=33554432+Math.random()*16777216|0),n=t&15,t=t>>4,r[o]=e[o===19?n&3|8:n]);return r.join("")}exports.ApiEnv=void 0;(function(e){e.PROD="prod",e.VK_ALIAS="vk_alias",e.VIDEOTEST="videotest",e.TEST="test",e.AUTO="auto"})(exports.ApiEnv||(exports.ApiEnv={}));exports.Quality=void 0;(function(e){e.Q144P="144",e.Q240P="240",e.Q360P="360",e.Q480P="480",e.Q720P="720",e.Q1080P="1080",e.Q1440P="1440",e.Q2160P="2160",e.Q4320P="4320",e.UNKNOWN="unknown"})(exports.Quality||(exports.Quality={}));exports.ScreenDestination=void 0;(function(e){e.CHROMECAST="chromecast",e.APPLE_TV="appletv",e.PIP="pip",e.HEADPHONES="externalHeadphones",e.SCREEN=""})(exports.ScreenDestination||(exports.ScreenDestination={}));exports.ContentType=void 0;(function(e){e.MP4="mp4",e.DASH="dash",e.DASH_SEP="dash_sep",e.ONDEMAND_DASH="ondemand_dash",e.HLS="hls",e.ONDEMAND_HLS="ondemand_hls",e.WEBM="webm",e.RTMP="rtmp",e.UNKNOWN="unknown"})(exports.ContentType||(exports.ContentType={}));var Re;(function(e){e.AUTO="auto",e.MANUAL=""})(Re||(Re={}));exports.ConnectionType=void 0;(function(e){e.HTTP1="http1",e.HTTP2="http2",e.HTTP3="http3"})(exports.ConnectionType||(exports.ConnectionType={}));var Ce;(function(e){e[e.YES=1]="YES",e[e.NO=0]="NO"})(Ce||(Ce={}));const Gt="1.0.34",Fl="es2015.cjs.js",xl="CIOPGQJGDIHBABABA",co={[exports.ApiEnv.PROD]:"https://api.ok.ru",[exports.ApiEnv.VK_ALIAS]:"https://api.mycdn.me",[exports.ApiEnv.VIDEOTEST]:"https://videotestapi.ok.ru/api",[exports.ApiEnv.TEST]:"https://apitest.ok.ru",[exports.ApiEnv.AUTO]:""},Vl={start:1e3,factor:1.5,max:5*60*1e3,random:.1};var j;(function(e){e[e.PARAM_SESSION_EXPIRED=102]="PARAM_SESSION_EXPIRED",e[e.PARAM_SESSION_KEY=103]="PARAM_SESSION_KEY",e[e.PARAM_SIGNATURE=104]="PARAM_SIGNATURE",e[e.AUTH_LOGIN=401]="AUTH_LOGIN"})(j||(j={}));class Hl{constructor(r){this.consequentAuthErrors=0,this.authorized$=new h.ValueSubject(!1),this.params=r;const t=Wt.get("uuid");t?this.uuid=String(t):(this.uuid=Bl(),Wt.set("uuid",this.uuid))}authorize(r){return w(this,void 0,void 0,function*(){return this.authToken=r!=null?r:yield this.refreshAuthToken(),this._authorizeWithBackoff()})}logBeacon(r){const t="log.externalLog",n=this.createLogParams(r),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(t,n,o)||this.logRequest(r)}logRequest(r){var t;return w(this,void 0,void 0,function*(){const n="log.externalLog",o=this.createLogParams(r),a=(t=this.sessionKey)!==null&&t!==void 0?t:yield this._authorizeWithBackoff();if(!a)return;const i=(v,u=this.params.requestRetryCount)=>w(this,void 0,void 0,function*(){try{return yield this.params.apiTransport.sendRequest(n,o,a)}catch(s){if(!s||!("error_code"in s)){this.params.error$.next({id:"logRequestUnknown",category:h.ErrorCategory.NETWORK,message:`Unknown ${n} error`,thrown:s});return}const c=s==null?void 0:s.error_code;switch(c){case j.PARAM_SESSION_EXPIRED:case j.PARAM_SESSION_KEY:case j.PARAM_SIGNATURE:return this.authorized$.next(!1),this.sessionKey=yield this._authorizeWithBackoff(),u>0?i(v,u-1):void 0;case j.AUTH_LOGIN:return this.authorized$.next(!1),this.authToken=yield this.refreshAuthToken(),this.sessionKey=yield this._authorizeWithBackoff(),u>0?i(v,u-1):void 0;default:{this.params.error$.next({id:`LogRequest#${c}`,category:h.ErrorCategory.EXTERNAL_API,message:`${n} error`,data:s});return}}}});return i(r)})}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}refreshAuthToken(){return w(this,void 0,void 0,function*(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=fr(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise})}createLogParams(r){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`${Fl}:${Gt}`,platform:"WEB",items:r.map(t=>Object.assign(Object.assign({},t),{time:0,type:1}))})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();const r=h.getExponentialDelay(this.consequentAuthErrors,Vl);return new Promise(t=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{fr(this._authorize().then(t).catch(n=>this.params.error$.next({id:"AuthorizeBackoff",category:h.ErrorCategory.NETWORK,message:"Otherwise unhandle errror in authrization",thrown:n})),()=>this.backoffTimeoutId=0)},r))})}_authorize(){return w(this,void 0,void 0,function*(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);const r="auth.anonymLogin",t={session_data:{version:2,device_id:this.uuid,client_version:Gt.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=fr(this.params.apiTransport.sendRequest(r,t).then(n=>{var o;return(!n||!n.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:h.ErrorCategory.EXTERNAL_API,message:"No session key",data:n}),this.sessionKey=(o=n==null?void 0:n.session_key)!==null&&o!==void 0?o:void 0,this.sessionKey}).catch(n=>w(this,void 0,void 0,function*(){this.sessionKey=void 0;const o=n==null?void 0:n.error_code;switch(o){case j.AUTH_LOGIN:return this.authToken=yield this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:h.ErrorCategory.EXTERNAL_API,message:"authorize error",data:n}):this.params.error$.next({id:"AuthorizeUnknown",category:h.ErrorCategory.NETWORK,message:"authorize error",thrown:n})})),()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise})}}class zt{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(r,t,n){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:t,options:n})}removeEventListener(r,t){if(!(r in this.listeners))return;const n=this.listeners[r];for(let o=0,a=n.length;o<a;o++)if(n[o].callback===t){n.splice(o,1);return}}dispatchEvent(r){if(!(r.type in this.listeners))return;const n=this.listeners[r.type].slice();for(let o=0,a=n.length;o<a;o++){const i=n[o];try{i.callback.call(this,r)}catch(v){Promise.resolve().then(()=>{throw v})}i.options&&i.options.once&&this.removeEventListener(r.type,i.callback)}return!r.defaultPrevented}}class uo extends zt{constructor(){super(),this.listeners||zt.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(r){r.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,r)),super.dispatchEvent(r)}}class ql{constructor(){Object.defineProperty(this,"signal",{value:new uo,writable:!0,configurable:!0})}abort(r){let t;try{t=new Event("abort")}catch(o){typeof document!="undefined"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}let n=r;if(n===void 0)if(typeof document=="undefined")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch(o){n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(t)}toString(){return"[object AbortController]"}}typeof Symbol!="undefined"&&Symbol.toStringTag&&(ql.prototype[Symbol.toStringTag]="AbortController",uo.prototype[Symbol.toStringTag]="AbortSignal");function lo(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function Kl(e){typeof e=="function"&&(e={fetch:e});const{fetch:r,Request:t=r.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=e;if(!lo({fetch:r,Request:t,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o}))return{fetch:r,Request:a};let a=t;(a&&!a.prototype.hasOwnProperty("signal")||o)&&(a=function(s,c){let l;c&&c.signal&&(l=c.signal,delete c.signal);const p=new t(s,c);return l&&Object.defineProperty(p,"signal",{writable:!1,enumerable:!1,configurable:!0,value:l}),p},a.prototype=t.prototype);const i=r;return{fetch:(u,s)=>{const c=a&&a.prototype.isPrototypeOf(u)?u.signal:s?s.signal:void 0;if(c){let l;try{l=new DOMException("Aborted","AbortError")}catch(d){l=new Error("Aborted"),l.name="AbortError"}if(c.aborted)return Promise.reject(l);const p=new Promise((d,m)=>{c.addEventListener("abort",()=>m(l),{once:!0})});return s&&s.signal&&delete s.signal,Promise.race([p,i(u,s)])}return i(u,s)},Request:a}}const Vr=lo({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),vo=Vr?Kl({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,Yt=Vr?vo.fetch:window.fetch;Vr?vo.Request:window.Request;class Ql{constructor(r){this.params=r,this.apiKey=r.apiKey,this.apiEnv=r.apiEnv,this.apiBaseUrl=r.apiBaseUrl,this.timeSynchronisation=r.timeSynchronisation,this.isApiBaseUrlFetched=!1}resolveApiBaseUrl(){var r;return w(this,void 0,void 0,function*(){if(this.apiEnv!==exports.ApiEnv.AUTO||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{const t=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=yield(yield Yt(t,{method:"GET",mode:"cors",cache:"no-cache"})).json(),a=(r=o==null?void 0:o.Answer[0])===null||r===void 0?void 0:r.data;if(!a)throw new Error("Wrong DNS response");return a}catch(t){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:h.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:t}),co[exports.ApiEnv.VK_ALIAS]}finally{this.isApiBaseUrlFetched=!0}})}sendBeacon(r,t,n){if(!window.Blob||!window.navigator.sendBeacon)return!1;const o=this._prepareQueryParams({method:r,queryParams:t,sessionKey:n}),a=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,a)}catch(i){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:h.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:i,data:{method:r,params:t}})}return!1}sendRequest(r,t,n){return w(this,void 0,void 0,function*(){const o=h.now(),a=i=>{if(i instanceof TypeError&&["Failed to fetch","NetworkError when attempting to fetch resource."].includes(i.message)){this.params.error$.next({id:"Network",category:h.ErrorCategory.NETWORK,message:"Request failed",thrown:i});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:h.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:i,data:{method:r,params:t,sessionKey:n,time:h.now()-o}})};return this.apiBaseUrl=yield this.resolveApiBaseUrl(),Yt(`${this.apiBaseUrl}/fb.do`,{method:"post",headers:{"Content-type":"application/x-www-form-urlencoded"},body:this._prepareQueryParams({method:r,queryParams:t,sessionKey:n})}).then(i=>{var v;const u=Number(i.headers.get("content-length"))===0,s=new Date((v=i.headers.get("date"))!==null&&v!==void 0?v:"").getTime(),c=h.now()-o;if(isFinite(s)&&this.timeSynchronisation.addServerTime(s,c),!u)return i.json().then(l=>Object.prototype.hasOwnProperty.call(l,"error_msg")?Promise.reject(l):l,a)},a)})}_prepareQueryParams(r){const t=new URLSearchParams({format:"JSON",method:r.method,application_key:this.apiKey});return r.sessionKey!==void 0&&t.append("session_key",r.sessionKey),Object.entries(r.queryParams).forEach(([n,o])=>t.append(n,typeof o=="string"?o:JSON.stringify(o))),t}}const fo=3e3,Wl=fo*5;class Gl{constructor(r){this.requestQueue=[],this.isPaused=!1,this.debouncedFlush=ho(()=>{var t;try{this.flush()}catch(n){this.error$.next({id:"LoggerError",category:h.ErrorCategory.WTF,message:(t=String(n))!==null&&t!==void 0?t:"Unknown logger error",thrown:n})}},fo,{maxWait:Wl}),this.api=r.api,this.error$=r.error$,this.subscription=this.api.authorized$.subscribe(t=>{t&&this.debouncedFlush()})}log(r){this.requestQueue.push(r),this.isPaused||this.debouncedFlush()}flush(r=!1){this.requestQueue.length!==0&&(this.api.authorized$.getValue()?(r?this.api.logBeacon(this.requestQueue):this.api.logRequest(this.requestQueue),this.requestQueue=[]):this.api.authorize(),this.debouncedFlush.cancel())}pause(){this.isPaused=!0,this.debouncedFlush.cancel()}resume(){this.isPaused=!1,this.debouncedFlush()}destroy(){this.subscription.unsubscribe()}}class zl{constructor(r){this.offset=void 0,this.offset=r}getOffset(){var r;return(r=this.offset)!==null&&r!==void 0?r:0}setOffset(r){this.offset=r}now(){var r;return Date.now()+((r=this.offset)!==null&&r!==void 0?r:0)}date(r=new Date){var t;return r.setTime(r.getTime()+((t=this.offset)!==null&&t!==void 0?t:0)),r}addServerTime(r,t){const n=Date.now(),o=r-n-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)}}const Jt=()=>Math.floor(Math.random()*Math.pow(2,32)).toString(36).padStart(8,"0"),Yl=e=>e&&{[f.VideoQuality.INVARIANT]:exports.Quality.UNKNOWN,[f.VideoQuality.Q_144P]:exports.Quality.Q144P,[f.VideoQuality.Q_240P]:exports.Quality.Q240P,[f.VideoQuality.Q_360P]:exports.Quality.Q360P,[f.VideoQuality.Q_480P]:exports.Quality.Q480P,[f.VideoQuality.Q_720P]:exports.Quality.Q720P,[f.VideoQuality.Q_1080P]:exports.Quality.Q1080P,[f.VideoQuality.Q_1440P]:exports.Quality.Q1440P,[f.VideoQuality.Q_2160P]:exports.Quality.Q2160P,[f.VideoQuality.Q_4320P]:exports.Quality.Q4320P}[e],Jl=e=>e&&{[f.HttpConnectionType.HTTP1]:exports.ConnectionType.HTTP1,[f.HttpConnectionType.HTTP2]:exports.ConnectionType.HTTP2,[f.HttpConnectionType.QUIC]:exports.ConnectionType.HTTP3}[e],Xl=e=>{if(e!==void 0)switch(e){case f.VideoFormat.MPEG:return exports.ContentType.MP4;case f.VideoFormat.DASH:case f.VideoFormat.DASH_LIVE:case f.VideoFormat.DASH_LIVE_CMAF:return exports.ContentType.DASH;case f.VideoFormat.DASH_SEP:return exports.ContentType.DASH_SEP;case f.VideoFormat.DASH_ONDEMAND:return exports.ContentType.ONDEMAND_DASH;case f.VideoFormat.DASH_WEBM:case f.VideoFormat.DASH_LIVE_WEBM:return exports.ContentType.WEBM;case f.VideoFormat.HLS:case f.VideoFormat.HLS_LIVE:case f.VideoFormat.HLS_LIVE_CMAF:return exports.ContentType.HLS;case f.VideoFormat.HLS_ONDEMAND:return exports.ContentType.ONDEMAND_HLS;case f.VideoFormat.WEB_RTC_LIVE:return exports.ContentType.RTMP;default:return h.assertNever(e)}};class Zl{constructor(r,t){var n;this.subscription=new h.Subscription,this.timeSynchronisation=new zl,this.vsid=Jt(),this.fieldBlacklist=[],this.statContext=r,this.config=Object.assign(Object.assign({},(n=t.config)!==null&&n!==void 0?n:{}),{requestRetryCount:1});const o=new h.Subject;this.experimental={error$:o};const a=new Ql({apiKey:xl,apiBaseUrl:co[t.apiEnv],apiEnv:t.apiEnv,error$:o,timeSynchronisation:this.timeSynchronisation});this.api=new Hl({apiTransport:a,refreshAuthToken:t.refreshAuthToken,requestRetryCount:this.config.requestRetryCount,error$:o}),this.logger=new Gl({api:this.api,error$:o}),this.subscription.add(h.fromEvent(window,"beforeunload").subscribe(()=>this.logger.flush(!0)))}updateContext(r){this.statContext=Object.assign(Object.assign({},this.statContext),r)}attachTo(r){let t;return new h.Subscription().add(r.events.started$.subscribe(()=>{this.logStarted({position:r.info.position$.getValue()})})).add(r.events.looped$.subscribe(()=>{this.resetViewSession(),this.logStarted({position:r.info.position$.getValue()})})).add(r.events.seeked$.subscribe(()=>{this.logSeek()})).add(r.events.willPause$.subscribe(()=>{this.logPause({position:r.info.position$.getValue()})})).add(r.events.willResume$.subscribe(()=>{this.logPlay()})).add(r.events.managedError$.subscribe(({id:n})=>{this.logError({errorType:n})})).add(r.events.fatalError$.subscribe(({id:n})=>{this.logError({errorType:n})})).add(r.events.inited$.subscribe(()=>{this.logInited()})).add(r.events.canplay$.subscribe(n=>{this.logReady({time:n})})).add(r.events.firstBytes$.subscribe(n=>{this.logFirstBytes({time:n})})).add(r.events.firstFrame$.subscribe(n=>{this.logFirstFrame({time:n})})).add(r.events.watchCoverageRecord$.subscribe(n=>{this.logWatchCoverageRecord(n)})).add(r.events.watchCoverageLive$.subscribe(n=>{this.logWatchCoverageLive(n)})).add(r.info.isStalled$.subscribe(n=>{n?t=h.now():(h.isNonNullable(t)&&this.logEmptyBuffer({duration:h.now()-t}),t=void 0)})).add(r.events.ended$.subscribe(()=>{const n=r.info.throughputEstimation$.getValue();h.isNonNullable(n)&&this.logDownloadSpeed({speed:n/8})})).add(r.info.hostname$.subscribe(n=>{this.updateContext({cdnHostname:n})})).add(r.info.httpConnectionType$.subscribe(n=>{this.updateContext({connectionType:Jl(n)})})).add(r.info.httpConnectionReused$.subscribe(n=>{this.updateContext({connectionReused:n})})).add(r.info.currentQuality$.subscribe(n=>{this.updateContext({quality:Yl(n)})})).add(r.info.currentFormat$.subscribe(n=>{this.updateContext({contentType:Xl(n)})})).add(r.info.chromecastState$.subscribe(n=>{this.updateContext({destination:n===f.ChromecastState.CONNECTED?exports.ScreenDestination.CHROMECAST:exports.ScreenDestination.SCREEN})}))}authorize(r){return this.api.authorize(r)}pause(){this.logger.pause()}resume(){this.logger.resume()}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.vsid=Jt()}setFieldBlacklist(r=[]){this.fieldBlacklist=r}logInited(){this.log({operation:"init"})}logReady(r){this.log({operation:"player_ready",param:String(r.time)})}logStarted(r){this.log({operation:"play",param:String(Math.round(r.position))})}logPlay(){this.log({operation:"play_toggle"})}logPause(r){this.log({operation:"pause",param:String(Math.round(r.position))})}logSeek(){this.log({operation:"seek"})}logFirstBytes(r){this.log({operation:"first_bytes",param:String(r.time)})}logFirstFrame(r){this.log({operation:"first_frame",param:String(r.time)})}logError(r){this.log({operation:"error",param:r.errorType})}logWatchCoverageRecord(r){this.log({operation:"watch_coverage_record",param:`${r.start}-${r.end}`}),this.logger.flush(!0)}logWatchCoverageLive(r){const t=r.start+this.timeSynchronisation.getOffset(),n=r.end+this.timeSynchronisation.getOffset();this.log({operation:"watch_coverage_live",param:`${t}-${n}`}),this.logger.flush(!0)}logEmptyBuffer(r){this.log({operation:"empty_buffer",param:String(r.duration)})}logDownloadSpeed(r){this.log({operation:"download_speed",param:String(r.speed)})}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(r){this.log({operation:"adv",param:r})}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"})}log(r){const t=this.createLogItem(r);this.logger.log(t)}createLogItem({operation:r,param:t}){const n=this.timeSynchronisation.now(),o={vsid:this.vsid,vid:this.statContext.movieId,quality:this.statContext.quality,dst:this.statContext.destination,ct:this.statContext.contentType,aid:this.statContext.albumId,place:this.statContext.place,cdn_host:this.statContext.cdnHostname,connection_type:this.statContext.connectionType,connection_reused:this.statContext.connectionReused===!0?Ce.YES:this.statContext.connectionReused===!1?Ce.NO:void 0,stat_type:this.statContext.autoplay===!0?Re.AUTO:this.statContext.autoplay===!1?Re.MANUAL:void 0,vk_playlist_id:this.statContext.vkPlaylistId,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode};t!==void 0&&(o.param=t);for(const a of this.fieldBlacklist)delete o[a];return{operation:r,timestamp:n,custom:o}}}exports.OneStat=Zl;
|
|
6
|
+
"use strict";var s=require("@vkontakte/videoplayer-shared/es2015.cjs.js"),Gt=require("lodash/debounce.js"),p=require("@vkontakte/videoplayer-core/es2015.cjs.js");function I(e,t,r,n){function o(i){return i instanceof r?i:new r(function(c){c(i)})}return new(r||(r=Promise))(function(i,c){function v(a){try{u(n.next(a))}catch(l){c(l)}}function f(a){try{u(n.throw(a))}catch(l){c(l)}}function u(a){a.done?i(a.value):o(a.value).then(v,f)}u((n=n.apply(e,t||[])).next())})}var Qt=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},fe=function(e){return e&&e.Math==Math&&e},b=fe(typeof globalThis=="object"&&globalThis)||fe(typeof window=="object"&&window)||fe(typeof self=="object"&&self)||fe(typeof Qt=="object"&&Qt)||function(){return this}()||Function("return this")(),T=function(e){try{return!!e()}catch(t){return!0}},$o=T,De=!$o(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),mo=De,on=Function.prototype,zt=on.apply,Yt=on.call,an=typeof Reflect=="object"&&Reflect.apply||(mo?Yt.bind(zt):function(){return Yt.apply(zt,arguments)}),sn=De,cn=Function.prototype,gt=cn.call,So=sn&&cn.bind.bind(gt,gt),_=sn?So:function(e){return function(){return gt.apply(e,arguments)}},un=_,Eo=un({}.toString),To=un("".slice),Le=function(e){return To(Eo(e),8,-1)},_o=Le,Oo=_,ln=function(e){if(_o(e)==="Function")return Oo(e)},bt=typeof document=="object"&&document.all,Po=typeof bt=="undefined"&&bt!==void 0,fn={all:bt,IS_HTMLDDA:Po},vn=fn,wo=vn.all,y=vn.IS_HTMLDDA?function(e){return typeof e=="function"||e===wo}:function(e){return typeof e=="function"},Nt={},Co=T,Z=!Co(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),Io=De,ve=Function.prototype.call,O=Io?ve.bind(ve):function(){return ve.apply(ve,arguments)},dn={},hn={}.propertyIsEnumerable,pn=Object.getOwnPropertyDescriptor,Ro=pn&&!hn.call({1:2},1);dn.f=Ro?function(t){var r=pn(this,t);return!!r&&r.enumerable}:hn;var yn=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},Ao=_,No=T,Do=Le,He=Object,Lo=Ao("".split),jo=No(function(){return!He("z").propertyIsEnumerable(0)})?function(e){return Do(e)=="String"?Lo(e,""):He(e)}:He,je=function(e){return e==null},xo=je,ko=TypeError,gn=function(e){if(xo(e))throw ko("Can't call method on "+e);return e},Uo=jo,Fo=gn,Mo=function(e){return Uo(Fo(e))},Jt=y,bn=fn,Bo=bn.all,U=bn.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:Jt(e)||e===Bo}:function(e){return typeof e=="object"?e!==null:Jt(e)},$n={},Ke=$n,We=b,Vo=y,Xt=function(e){return Vo(e)?e:void 0},A=function(e,t){return arguments.length<2?Xt(Ke[e])||Xt(We[e]):Ke[e]&&Ke[e][t]||We[e]&&We[e][t]},Ho=_,Dt=Ho({}.isPrototypeOf),xe=typeof navigator!="undefined"&&String(navigator.userAgent)||"",mn=b,qe=xe,Zt=mn.process,er=mn.Deno,tr=Zt&&Zt.versions||er&&er.version,rr=tr&&tr.v8,S,Oe;rr&&(S=rr.split("."),Oe=S[0]>0&&S[0]<4?1:+(S[0]+S[1]));!Oe&&qe&&(S=qe.match(/Edge\/(\d+)/),(!S||S[1]>=74)&&(S=qe.match(/Chrome\/(\d+)/),S&&(Oe=+S[1])));var Sn=Oe,nr=Sn,Ko=T,En=!!Object.getOwnPropertySymbols&&!Ko(function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&nr&&nr<41}),Wo=En,Tn=Wo&&!Symbol.sham&&typeof Symbol.iterator=="symbol",qo=A,Go=y,Qo=Dt,zo=Tn,Yo=Object,_n=zo?function(e){return typeof e=="symbol"}:function(e){var t=qo("Symbol");return Go(t)&&Qo(t.prototype,Yo(e))},Jo=String,ke=function(e){try{return Jo(e)}catch(t){return"Object"}},Xo=y,Zo=ke,ea=TypeError,F=function(e){if(Xo(e))return e;throw ea(Zo(e)+" is not a function")},ta=F,ra=je,Lt=function(e,t){var r=e[t];return ra(r)?void 0:ta(r)},Ge=O,Qe=y,ze=U,na=TypeError,oa=function(e,t){var r,n;if(t==="string"&&Qe(r=e.toString)&&!ze(n=Ge(r,e))||Qe(r=e.valueOf)&&!ze(n=Ge(r,e))||t!=="string"&&Qe(r=e.toString)&&!ze(n=Ge(r,e)))return n;throw na("Can't convert object to primitive value")},Pe={},aa={get exports(){return Pe},set exports(e){Pe=e}},ce=!0,or=b,ia=Object.defineProperty,sa=function(e,t){try{ia(or,e,{value:t,configurable:!0,writable:!0})}catch(r){or[e]=t}return t},ca=b,ua=sa,ar="__core-js_shared__",la=ca[ar]||ua(ar,{}),jt=la,ir=jt;(aa.exports=function(e,t){return ir[e]||(ir[e]=t!==void 0?t:{})})("versions",[]).push({version:"3.27.2",mode:"pure",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.27.2/LICENSE",source:"https://github.com/zloirock/core-js"});var fa=gn,va=Object,da=function(e){return va(fa(e))},ha=_,pa=da,ya=ha({}.hasOwnProperty),ee=Object.hasOwn||function(t,r){return ya(pa(t),r)},ga=_,ba=0,$a=Math.random(),ma=ga(1 .toString),On=function(e){return"Symbol("+(e===void 0?"":e)+")_"+ma(++ba+$a,36)},Sa=b,Ea=Pe,sr=ee,Ta=On,_a=En,Oa=Tn,Q=Sa.Symbol,Ye=Ea("wks"),Pa=Oa?Q.for||Q:Q&&Q.withoutSetter||Ta,P=function(e){return sr(Ye,e)||(Ye[e]=_a&&sr(Q,e)?Q[e]:Pa("Symbol."+e)),Ye[e]},wa=O,cr=U,ur=_n,Ca=Lt,Ia=oa,Ra=P,Aa=TypeError,Na=Ra("toPrimitive"),Da=function(e,t){if(!cr(e)||ur(e))return e;var r=Ca(e,Na),n;if(r){if(t===void 0&&(t="default"),n=wa(r,e,t),!cr(n)||ur(n))return n;throw Aa("Can't convert object to primitive value")}return t===void 0&&(t="number"),Ia(e,t)},La=Da,ja=_n,Pn=function(e){var t=La(e,"string");return ja(t)?t:t+""},xa=b,lr=U,$t=xa.document,ka=lr($t)&&lr($t.createElement),wn=function(e){return ka?$t.createElement(e):{}},Ua=Z,Fa=T,Ma=wn,Cn=!Ua&&!Fa(function(){return Object.defineProperty(Ma("div"),"a",{get:function(){return 7}}).a!=7}),Ba=Z,Va=O,Ha=dn,Ka=yn,Wa=Mo,qa=Pn,Ga=ee,Qa=Cn,fr=Object.getOwnPropertyDescriptor;Nt.f=Ba?fr:function(t,r){if(t=Wa(t),r=qa(r),Qa)try{return fr(t,r)}catch(n){}if(Ga(t,r))return Ka(!Va(Ha.f,t,r),t[r])};var za=T,Ya=y,Ja=/#|\.prototype\./,ue=function(e,t){var r=Za[Xa(e)];return r==ti?!0:r==ei?!1:Ya(t)?za(t):!!t},Xa=ue.normalize=function(e){return String(e).replace(Ja,".").toLowerCase()},Za=ue.data={},ei=ue.NATIVE="N",ti=ue.POLYFILL="P",In=ue,vr=ln,ri=F,ni=De,oi=vr(vr.bind),Ue=function(e,t){return ri(e),t===void 0?e:ni?oi(e,t):function(){return e.apply(t,arguments)}},Fe={},ai=Z,ii=T,si=ai&&ii(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),ci=U,ui=String,li=TypeError,M=function(e){if(ci(e))return e;throw li(ui(e)+" is not an object")},fi=Z,vi=Cn,di=si,de=M,dr=Pn,hi=TypeError,Je=Object.defineProperty,pi=Object.getOwnPropertyDescriptor,Xe="enumerable",Ze="configurable",et="writable";Fe.f=fi?di?function(t,r,n){if(de(t),r=dr(r),de(n),typeof t=="function"&&r==="prototype"&&"value"in n&&et in n&&!n[et]){var o=pi(t,r);o&&o[et]&&(t[r]=n.value,n={configurable:Ze in n?n[Ze]:o[Ze],enumerable:Xe in n?n[Xe]:o[Xe],writable:!1})}return Je(t,r,n)}:Je:function(t,r,n){if(de(t),r=dr(r),de(n),vi)try{return Je(t,r,n)}catch(o){}if("get"in n||"set"in n)throw hi("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var yi=Z,gi=Fe,bi=yn,Me=yi?function(e,t,r){return gi.f(e,t,bi(1,r))}:function(e,t,r){return e[t]=r,e},he=b,$i=an,mi=ln,Si=y,Ei=Nt.f,Ti=In,H=$n,_i=Ue,K=Me,hr=ee,Oi=function(e){var t=function(r,n,o){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,o)}return $i(e,this,arguments)};return t.prototype=e.prototype,t},B=function(e,t){var r=e.target,n=e.global,o=e.stat,i=e.proto,c=n?he:o?he[r]:(he[r]||{}).prototype,v=n?H:H[r]||K(H,r,{})[r],f=v.prototype,u,a,l,d,h,g,N,w,V;for(d in t)u=Ti(n?d:r+(o?".":"#")+d,e.forced),a=!u&&c&&hr(c,d),g=v[d],a&&(e.dontCallGetSet?(V=Ei(c,d),N=V&&V.value):N=c[d]),h=a&&N?N:t[d],!(a&&typeof g==typeof h)&&(e.bind&&a?w=_i(h,he):e.wrap&&a?w=Oi(h):i&&Si(h)?w=mi(h):w=h,(e.sham||h&&h.sham||g&&g.sham)&&K(w,"sham",!0),K(v,d,w),i&&(l=r+"Prototype",hr(H,l)||K(H,l,{}),K(H[l],d,h),e.real&&f&&(u||!f[d])&&K(f,d,h)))},Pi=Le,Be=typeof process!="undefined"&&Pi(process)=="process",wi=Me,xt=function(e,t,r,n){return n&&n.enumerable?e[t]=r:wi(e,t,r),e},Ci=y,Ii=String,Ri=TypeError,Ai=function(e){if(typeof e=="object"||Ci(e))return e;throw Ri("Can't set "+Ii(e)+" as a prototype")},Ni=_,Di=M,Li=Ai,ji=Object.setPrototypeOf||("__proto__"in{}?function(){var e=!1,t={},r;try{r=Ni(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),r(t,[]),e=t instanceof Array}catch(n){}return function(o,i){return Di(o),Li(i),e?r(o,i):o.__proto__=i,o}}():void 0),xi=P,ki=xi("toStringTag"),Rn={};Rn[ki]="z";var kt=String(Rn)==="[object z]",Ui=kt,Fi=y,Ee=Le,Mi=P,Bi=Mi("toStringTag"),Vi=Object,Hi=Ee(function(){return arguments}())=="Arguments",Ki=function(e,t){try{return e[t]}catch(r){}},Ut=Ui?Ee:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=Ki(t=Vi(e),Bi))=="string"?r:Hi?Ee(t):(n=Ee(t))=="Object"&&Fi(t.callee)?"Arguments":n},Wi=kt,qi=Ut,Gi=Wi?{}.toString:function(){return"[object "+qi(this)+"]"},Qi=kt,zi=Fe.f,Yi=Me,Ji=ee,Xi=Gi,Zi=P,pr=Zi("toStringTag"),es=function(e,t,r,n){if(e){var o=r?e:e.prototype;Ji(o,pr)||zi(o,pr,{configurable:!0,value:t}),n&&!Qi&&Yi(o,"toString",Xi)}},ts=A,rs=Fe,ns=P,os=Z,yr=ns("species"),as=function(e){var t=ts(e),r=rs.f;os&&t&&!t[yr]&&r(t,yr,{configurable:!0,get:function(){return this}})},is=Dt,ss=TypeError,cs=function(e,t){if(is(t,e))return e;throw ss("Incorrect invocation")},us=_,ls=y,mt=jt,fs=us(Function.toString);ls(mt.inspectSource)||(mt.inspectSource=function(e){return fs(e)});var An=mt.inspectSource,vs=_,ds=T,Nn=y,hs=Ut,ps=A,ys=An,Dn=function(){},gs=[],Ln=ps("Reflect","construct"),Ft=/^\s*(?:class|function)\b/,bs=vs(Ft.exec),$s=!Ft.exec(Dn),ne=function(t){if(!Nn(t))return!1;try{return Ln(Dn,gs,t),!0}catch(r){return!1}},jn=function(t){if(!Nn(t))return!1;switch(hs(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return $s||!!bs(Ft,ys(t))}catch(r){return!0}};jn.sham=!0;var ms=!Ln||ds(function(){var e;return ne(ne.call)||!ne(Object)||!ne(function(){e=!0})||e})?jn:ne,Ss=ms,Es=ke,Ts=TypeError,_s=function(e){if(Ss(e))return e;throw Ts(Es(e)+" is not a constructor")},gr=M,Os=_s,Ps=je,ws=P,Cs=ws("species"),xn=function(e,t){var r=gr(e).constructor,n;return r===void 0||Ps(n=gr(r)[Cs])?t:Os(n)},Is=A,Rs=Is("document","documentElement"),As=_,Ns=As([].slice),Ds=TypeError,Ls=function(e,t){if(e<t)throw Ds("Not enough arguments");return e},js=xe,kn=/(?:ipad|iphone|ipod).*applewebkit/i.test(js),$=b,xs=an,ks=Ue,br=y,Us=ee,Un=T,$r=Rs,Fs=Ns,mr=wn,Ms=Ls,Bs=kn,Vs=Be,St=$.setImmediate,Et=$.clearImmediate,Hs=$.process,tt=$.Dispatch,Ks=$.Function,Sr=$.MessageChannel,Ws=$.String,rt=0,oe={},Er="onreadystatechange",ie,D,nt,ot;Un(function(){ie=$.location});var Mt=function(e){if(Us(oe,e)){var t=oe[e];delete oe[e],t()}},at=function(e){return function(){Mt(e)}},Tr=function(e){Mt(e.data)},_r=function(e){$.postMessage(Ws(e),ie.protocol+"//"+ie.host)};(!St||!Et)&&(St=function(t){Ms(arguments.length,1);var r=br(t)?t:Ks(t),n=Fs(arguments,1);return oe[++rt]=function(){xs(r,void 0,n)},D(rt),rt},Et=function(t){delete oe[t]},Vs?D=function(e){Hs.nextTick(at(e))}:tt&&tt.now?D=function(e){tt.now(at(e))}:Sr&&!Bs?(nt=new Sr,ot=nt.port2,nt.port1.onmessage=Tr,D=ks(ot.postMessage,ot)):$.addEventListener&&br($.postMessage)&&!$.importScripts&&ie&&ie.protocol!=="file:"&&!Un(_r)?(D=_r,$.addEventListener("message",Tr,!1)):Er in mr("script")?D=function(e){$r.appendChild(mr("script"))[Er]=function(){$r.removeChild(this),Mt(e)}}:D=function(e){setTimeout(at(e),0)});var Fn={set:St,clear:Et},Mn=function(){this.head=null,this.tail=null};Mn.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e){var t=this.head=e.next;return t===null&&(this.tail=null),e.item}}};var Bn=Mn,qs=xe,Gs=/ipad|iphone|ipod/i.test(qs)&&typeof Pebble!="undefined",Qs=xe,zs=/web0s(?!.*chrome)/i.test(Qs),k=b,Or=Ue,Ys=Nt.f,it=Fn.set,Js=Bn,Xs=kn,Zs=Gs,ec=zs,st=Be,Pr=k.MutationObserver||k.WebKitMutationObserver,wr=k.document,Cr=k.process,pe=k.Promise,Ir=Ys(k,"queueMicrotask"),Tt=Ir&&Ir.value,W,ct,ut,ye,Rr;if(!Tt){var ge=new Js,be=function(){var e,t;for(st&&(e=Cr.domain)&&e.exit();t=ge.get();)try{t()}catch(r){throw ge.head&&W(),r}e&&e.enter()};!Xs&&!st&&!ec&&Pr&&wr?(ct=!0,ut=wr.createTextNode(""),new Pr(be).observe(ut,{characterData:!0}),W=function(){ut.data=ct=!ct}):!Zs&&pe&&pe.resolve?(ye=pe.resolve(void 0),ye.constructor=pe,Rr=Or(ye.then,ye),W=function(){Rr(be)}):st?W=function(){Cr.nextTick(be)}:(it=Or(it,k),W=function(){it(be)}),Tt=function(e){ge.head||W(),ge.add(e)}}var tc=Tt,rc=function(e,t){try{arguments.length==1?console.error(e):console.error(e,t)}catch(r){}},Bt=function(e){try{return{error:!1,value:e()}}catch(t){return{error:!0,value:t}}},nc=b,oc=y,Ar=nc.WeakMap,ac=oc(Ar)&&/native code/.test(String(Ar)),ic=Pe,sc=On,Nr=ic("keys"),cc=function(e){return Nr[e]||(Nr[e]=sc(e))},uc={},lc=ac,Vn=b,fc=U,vc=Me,lt=ee,ft=jt,dc=cc,hc=uc,Dr="Object already initialized",_t=Vn.TypeError,pc=Vn.WeakMap,we,se,Ce,yc=function(e){return Ce(e)?se(e):we(e,{})},gc=function(e){return function(t){var r;if(!fc(t)||(r=se(t)).type!==e)throw _t("Incompatible receiver, "+e+" required");return r}};if(lc||ft.state){var E=ft.state||(ft.state=new pc);E.get=E.get,E.has=E.has,E.set=E.set,we=function(e,t){if(E.has(e))throw _t(Dr);return t.facade=e,E.set(e,t),t},se=function(e){return E.get(e)||{}},Ce=function(e){return E.has(e)}}else{var q=dc("state");hc[q]=!0,we=function(e,t){if(lt(e,q))throw _t(Dr);return t.facade=e,vc(e,q,t),t},se=function(e){return lt(e,q)?e[q]:{}},Ce=function(e){return lt(e,q)}}var bc={set:we,get:se,has:Ce,enforce:yc,getterFor:gc},$c=b,te=$c.Promise,Hn=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",mc=Hn,Sc=Be,Ec=!mc&&!Sc&&typeof window=="object"&&typeof document=="object",Tc=b,ae=te,_c=y,Oc=In,Pc=An,wc=P,Cc=Ec,Ic=Hn,Rc=ce,vt=Sn,Lr=ae&&ae.prototype,Ac=wc("species"),Ot=!1,Kn=_c(Tc.PromiseRejectionEvent),Nc=Oc("Promise",function(){var e=Pc(ae),t=e!==String(ae);if(!t&&vt===66||Rc&&!(Lr.catch&&Lr.finally))return!0;if(!vt||vt<51||!/native code/.test(e)){var r=new ae(function(i){i(1)}),n=function(i){i(function(){},function(){})},o=r.constructor={};if(o[Ac]=n,Ot=r.then(function(){})instanceof n,!Ot)return!0}return!t&&(Cc||Ic)&&!Kn}),le={CONSTRUCTOR:Nc,REJECTION_EVENT:Kn,SUBCLASSING:Ot},re={},jr=F,Dc=TypeError,Lc=function(e){var t,r;this.promise=new e(function(n,o){if(t!==void 0||r!==void 0)throw Dc("Bad Promise constructor");t=n,r=o}),this.resolve=jr(t),this.reject=jr(r)};re.f=function(e){return new Lc(e)};var jc=B,xc=ce,Ie=Be,R=b,X=O,xr=xt,kr=ji,kc=es,Uc=as,Fc=F,Te=y,Mc=U,Bc=cs,Vc=xn,Wn=Fn.set,Vt=tc,Hc=rc,Kc=Bt,Wc=Bn,qn=bc,Re=te,Ht=le,Gn=re,Ve="Promise",Qn=Ht.CONSTRUCTOR,qc=Ht.REJECTION_EVENT,Gc=Ht.SUBCLASSING,dt=qn.getterFor(Ve),Qc=qn.set,G=Re&&Re.prototype,L=Re,$e=G,zn=R.TypeError,Pt=R.document,Kt=R.process,wt=Gn.f,zc=wt,Yc=!!(Pt&&Pt.createEvent&&R.dispatchEvent),Yn="unhandledrejection",Jc="rejectionhandled",Ur=0,Jn=1,Xc=2,Wt=1,Xn=2,me,Fr,Zc,Mr,Zn=function(e){var t;return Mc(e)&&Te(t=e.then)?t:!1},eo=function(e,t){var r=t.value,n=t.state==Jn,o=n?e.ok:e.fail,i=e.resolve,c=e.reject,v=e.domain,f,u,a;try{o?(n||(t.rejection===Xn&&tu(t),t.rejection=Wt),o===!0?f=r:(v&&v.enter(),f=o(r),v&&(v.exit(),a=!0)),f===e.promise?c(zn("Promise-chain cycle")):(u=Zn(f))?X(u,f,i,c):i(f)):c(r)}catch(l){v&&!a&&v.exit(),c(l)}},to=function(e,t){e.notified||(e.notified=!0,Vt(function(){for(var r=e.reactions,n;n=r.get();)eo(n,e);e.notified=!1,t&&!e.rejection&&eu(e)}))},ro=function(e,t,r){var n,o;Yc?(n=Pt.createEvent("Event"),n.promise=t,n.reason=r,n.initEvent(e,!1,!0),R.dispatchEvent(n)):n={promise:t,reason:r},!qc&&(o=R["on"+e])?o(n):e===Yn&&Hc("Unhandled promise rejection",r)},eu=function(e){X(Wn,R,function(){var t=e.facade,r=e.value,n=Br(e),o;if(n&&(o=Kc(function(){Ie?Kt.emit("unhandledRejection",r,t):ro(Yn,t,r)}),e.rejection=Ie||Br(e)?Xn:Wt,o.error))throw o.value})},Br=function(e){return e.rejection!==Wt&&!e.parent},tu=function(e){X(Wn,R,function(){var t=e.facade;Ie?Kt.emit("rejectionHandled",t):ro(Jc,t,e.value)})},z=function(e,t,r){return function(n){e(t,n,r)}},J=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=Xc,to(e,!0))},Ct=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw zn("Promise can't be resolved itself");var n=Zn(t);n?Vt(function(){var o={done:!1};try{X(n,t,z(Ct,o,e),z(J,o,e))}catch(i){J(o,i,e)}}):(e.value=t,e.state=Jn,to(e,!1))}catch(o){J({done:!1},o,e)}}};if(Qn&&(L=function(t){Bc(this,$e),Fc(t),X(me,this);var r=dt(this);try{t(z(Ct,r),z(J,r))}catch(n){J(r,n)}},$e=L.prototype,me=function(t){Qc(this,{type:Ve,done:!1,notified:!1,parent:!1,reactions:new Wc,rejection:!1,state:Ur,value:void 0})},me.prototype=xr($e,"then",function(t,r){var n=dt(this),o=wt(Vc(this,L));return n.parent=!0,o.ok=Te(t)?t:!0,o.fail=Te(r)&&r,o.domain=Ie?Kt.domain:void 0,n.state==Ur?n.reactions.add(o):Vt(function(){eo(o,n)}),o.promise}),Fr=function(){var e=new me,t=dt(e);this.promise=e,this.resolve=z(Ct,t),this.reject=z(J,t)},Gn.f=wt=function(e){return e===L||e===Zc?new Fr(e):zc(e)},!xc&&Te(Re)&&G!==Object.prototype)){Mr=G.then,Gc||xr(G,"then",function(t,r){var n=this;return new L(function(o,i){X(Mr,n,o,i)}).then(t,r)},{unsafe:!0});try{delete G.constructor}catch(e){}kr&&kr(G,$e)}jc({global:!0,constructor:!0,wrap:!0,forced:Qn},{Promise:L});kc(L,Ve,!1,!0);Uc(Ve);var no={},ru=P,nu=no,ou=ru("iterator"),au=Array.prototype,iu=function(e){return e!==void 0&&(nu.Array===e||au[ou]===e)},su=Math.ceil,cu=Math.floor,uu=Math.trunc||function(t){var r=+t;return(r>0?cu:su)(r)},lu=uu,fu=function(e){var t=+e;return t!==t||t===0?0:lu(t)},vu=fu,du=Math.min,hu=function(e){return e>0?du(vu(e),9007199254740991):0},pu=hu,yu=function(e){return pu(e.length)},gu=Ut,Vr=Lt,bu=je,$u=no,mu=P,Su=mu("iterator"),oo=function(e){if(!bu(e))return Vr(e,Su)||Vr(e,"@@iterator")||$u[gu(e)]},Eu=O,Tu=F,_u=M,Ou=ke,Pu=oo,wu=TypeError,Cu=function(e,t){var r=arguments.length<2?Pu(e):t;if(Tu(r))return _u(Eu(r,e));throw wu(Ou(e)+" is not iterable")},Iu=O,Hr=M,Ru=Lt,Au=function(e,t,r){var n,o;Hr(e);try{if(n=Ru(e,"return"),!n){if(t==="throw")throw r;return r}n=Iu(n,e)}catch(i){o=!0,n=i}if(t==="throw")throw r;if(o)throw n;return Hr(n),r},Nu=Ue,Du=O,Lu=M,ju=ke,xu=iu,ku=yu,Kr=Dt,Uu=Cu,Fu=oo,Wr=Au,Mu=TypeError,_e=function(e,t){this.stopped=e,this.result=t},qr=_e.prototype,ao=function(e,t,r){var n=r&&r.that,o=!!(r&&r.AS_ENTRIES),i=!!(r&&r.IS_RECORD),c=!!(r&&r.IS_ITERATOR),v=!!(r&&r.INTERRUPTED),f=Nu(t,n),u,a,l,d,h,g,N,w=function(m){return u&&Wr(u,"normal",m),new _e(!0,m)},V=function(m){return o?(Lu(m),v?f(m[0],m[1],w):f(m[0],m[1])):v?f(m,w):f(m)};if(i)u=e.iterator;else if(c)u=e;else{if(a=Fu(e),!a)throw Mu(ju(e)+" is not iterable");if(xu(a)){for(l=0,d=ku(e);d>l;l++)if(h=V(e[l]),h&&Kr(qr,h))return h;return new _e(!1)}u=Uu(e,a)}for(g=i?e.next:u.next;!(N=Du(g,u)).done;){try{h=V(N.value)}catch(m){Wr(u,"throw",m)}if(typeof h=="object"&&h&&Kr(qr,h))return h}return new _e(!1)},Bu=P,io=Bu("iterator"),so=!1;try{var Vu=0,Gr={next:function(){return{done:!!Vu++}},return:function(){so=!0}};Gr[io]=function(){return this},Array.from(Gr,function(){throw 2})}catch(e){}var Hu=function(e,t){if(!t&&!so)return!1;var r=!1;try{var n={};n[io]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(o){}return r},Ku=te,Wu=Hu,qu=le.CONSTRUCTOR,co=qu||!Wu(function(e){Ku.all(e).then(void 0,function(){})}),Gu=B,Qu=O,zu=F,Yu=re,Ju=Bt,Xu=ao,Zu=co;Gu({target:"Promise",stat:!0,forced:Zu},{all:function(t){var r=this,n=Yu.f(r),o=n.resolve,i=n.reject,c=Ju(function(){var v=zu(r.resolve),f=[],u=0,a=1;Xu(t,function(l){var d=u++,h=!1;a++,Qu(v,r,l).then(function(g){h||(h=!0,f[d]=g,--a||o(f))},i)}),--a||o(f)});return c.error&&i(c.value),n.promise}});var el=B,tl=ce,rl=le.CONSTRUCTOR,It=te,nl=A,ol=y,al=xt,Qr=It&&It.prototype;el({target:"Promise",proto:!0,forced:rl,real:!0},{catch:function(e){return this.then(void 0,e)}});if(!tl&&ol(It)){var zr=nl("Promise").prototype.catch;Qr.catch!==zr&&al(Qr,"catch",zr,{unsafe:!0})}var il=B,sl=O,cl=F,ul=re,ll=Bt,fl=ao,vl=co;il({target:"Promise",stat:!0,forced:vl},{race:function(t){var r=this,n=ul.f(r),o=n.reject,i=ll(function(){var c=cl(r.resolve);fl(t,function(v){sl(c,r,v).then(n.resolve,o)})});return i.error&&o(i.value),n.promise}});var dl=B,hl=O,pl=re,yl=le.CONSTRUCTOR;dl({target:"Promise",stat:!0,forced:yl},{reject:function(t){var r=pl.f(this);return hl(r.reject,void 0,t),r.promise}});var gl=M,bl=U,$l=re,uo=function(e,t){if(gl(e),bl(t)&&t.constructor===e)return t;var r=$l.f(e),n=r.resolve;return n(t),r.promise},ml=B,Sl=A,lo=ce,El=te,fo=le.CONSTRUCTOR,Tl=uo,_l=Sl("Promise"),Ol=lo&&!fo;ml({target:"Promise",stat:!0,forced:lo||fo},{resolve:function(t){return Tl(Ol&&this===_l?El:this,t)}});var Pl=B,wl=ce,Ae=te,Cl=T,vo=A,ho=y,Il=xn,Yr=uo,Rl=xt,Rt=Ae&&Ae.prototype,Al=!!Ae&&Cl(function(){Rt.finally.call({then:function(){}},function(){})});Pl({target:"Promise",proto:!0,real:!0,forced:Al},{finally:function(e){var t=Il(this,vo("Promise")),r=ho(e);return this.then(r?function(n){return Yr(t,e()).then(function(){return n})}:e,r?function(n){return Yr(t,e()).then(function(){throw n})}:e)}});if(!wl&&ho(Ae)){var Jr=vo("Promise").prototype.finally;Rt.finally!==Jr&&Rl(Rt,"finally",Jr,{unsafe:!0})}var Nl=A,Dl=Nl,Ll=Dl,jl=Ll("Promise","finally"),xl=jl,kl=xl,Ul=kl,Fl=Ul,ht=Fl;function Ml(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),t=new Array(36);let r=0,n,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?t[o]="-":o===14?t[o]="4":(r<=2&&(r=33554432+Math.random()*16777216|0),n=r&15,r=r>>4,t[o]=e[o===19?n&3|8:n]);return t.join("")}exports.ApiEnv=void 0;(function(e){e.PROD="prod",e.VK_ALIAS="vk_alias",e.VIDEOTEST="videotest",e.TEST="test",e.AUTO="auto"})(exports.ApiEnv||(exports.ApiEnv={}));exports.Quality=void 0;(function(e){e.Q144P="mobile",e.Q240P="lowest",e.Q360P="low",e.Q480P="medium",e.Q720P="high",e.Q1080P="fullhd",e.Q1440P="quadhd",e.Q2160P="ultrahd",e.UNKNOWN="unknown"})(exports.Quality||(exports.Quality={}));exports.ContentType=void 0;(function(e){e.MP4="mp4",e.DASH="dash",e.DASH_SEP="dash_sep",e.ONDEMAND_DASH="ondemand_dash",e.HLS="hls",e.ONDEMAND_HLS="ondemand_hls",e.WEBM="webm",e.ONDEMAND_DASH_LIVE="ondemand_dash_live",e.ONDEMAND_HLS_LIVE="ondemand_hls_live",e.WEBRTC="webrtc",e.UNKNOWN="unknown",e.RTMP="rtmp"})(exports.ContentType||(exports.ContentType={}));var Ne;(function(e){e.AUTO="auto",e.MANUAL=""})(Ne||(Ne={}));exports.ConnectionType=void 0;(function(e){e.HTTP1="http1",e.HTTP2="http2",e.HTTP3="http3"})(exports.ConnectionType||(exports.ConnectionType={}));var C;(function(e){e[e.YES=1]="YES",e[e.NO=0]="NO"})(C||(C={}));var Y;(function(e){e.EXCELLENT="excellent",e.GOOD="good",e.POOR="poor"})(Y||(Y={}));var x;(function(e){e.PIP="pip",e.FULLSCREEN="fullscreen",e.EXTERNAL="external",e.PREFETCH="prefetch"})(x||(x={}));exports.SeekAction=void 0;(function(e){e.SLIDER="slider",e.DOUBLE_TAP="double_tap",e.TIME_CODE="time_code",e.EPISODE="episode",e.REWIND="rewind",e.LIVE="live",e.UNKNOWN="unknown"})(exports.SeekAction||(exports.SeekAction={}));const At="1.0.35-beta.0",Bl="CIOPGQJGDIHBABABA",po={[exports.ApiEnv.PROD]:"https://api.ok.ru",[exports.ApiEnv.VK_ALIAS]:"https://api.mycdn.me",[exports.ApiEnv.VIDEOTEST]:"https://videotestapi.ok.ru/api",[exports.ApiEnv.TEST]:"https://apitest.ok.ru",[exports.ApiEnv.AUTO]:""},Vl="_one-stat_",Xr=`${Vl}uuid`,Hl={start:1e3,factor:1.5,max:5*60*1e3,random:.1};var j;(function(e){e[e.PARAM_SESSION_EXPIRED=102]="PARAM_SESSION_EXPIRED",e[e.PARAM_SESSION_KEY=103]="PARAM_SESSION_KEY",e[e.PARAM_SIGNATURE=104]="PARAM_SIGNATURE",e[e.AUTH_LOGIN=401]="AUTH_LOGIN"})(j||(j={}));class Kl{constructor(t){this.consequentAuthErrors=0,this.authorized$=new s.ValueSubject(!1),this.params=t;const r=s.safeStorage.get(Xr);r?this.uuid=String(r):(this.uuid=Ml(),s.safeStorage.set(Xr,this.uuid))}authorize(t){return I(this,void 0,void 0,function*(){return this.authToken=t!=null?t:yield this.refreshAuthToken(),this._authorizeWithBackoff()})}logBeacon(t){const r="log.externalLog",n=this.createLogParams(t),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(r,n,o)||this.logRequest(t)}logRequest(t){var r;return I(this,void 0,void 0,function*(){const n="log.externalLog",o=this.createLogParams(t),i=(r=this.sessionKey)!==null&&r!==void 0?r:yield this._authorizeWithBackoff();if(!i)return;const c=(v,f=this.params.requestRetryCount)=>I(this,void 0,void 0,function*(){try{return yield this.params.apiTransport.sendRequest(n,o,i)}catch(u){if(!u||!("error_code"in u)){this.params.error$.next({id:"logRequestUnknown",category:s.ErrorCategory.NETWORK,message:`Unknown ${n} error`,thrown:u});return}const a=u==null?void 0:u.error_code;switch(a){case j.PARAM_SESSION_EXPIRED:case j.PARAM_SESSION_KEY:case j.PARAM_SIGNATURE:return this.authorized$.next(!1),this.sessionKey=yield this._authorizeWithBackoff(),f>0?c(v,f-1):void 0;case j.AUTH_LOGIN:return this.authorized$.next(!1),this.authToken=yield this.refreshAuthToken(),this.sessionKey=yield this._authorizeWithBackoff(),f>0?c(v,f-1):void 0;default:{this.params.error$.next({id:`LogRequest#${a}`,category:s.ErrorCategory.EXTERNAL_API,message:`${n} error`,data:u});return}}}});return c(t)})}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}refreshAuthToken(){return I(this,void 0,void 0,function*(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=ht(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise})}createLogParams(t){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${At}`,platform:this.params.mobile?"M_WEB":"WEB",items:t})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();const t=s.getExponentialDelay(this.consequentAuthErrors,Hl);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{ht(this._authorize().then(r).catch(n=>this.params.error$.next({id:"AuthorizeBackoff",category:s.ErrorCategory.NETWORK,message:"Otherwise unhandled error in authorization",thrown:n})),()=>this.backoffTimeoutId=0)},t))})}_authorize(){return I(this,void 0,void 0,function*(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);const t="auth.anonymLogin",r={session_data:{version:2,device_id:this.uuid,client_version:At.split("-")[0],client_type:"SDK_JS"}};return this.authToken!==void 0&&(r.session_data.auth_token=this.authToken,r.session_data.version=3),this.authorizePromise=ht(this.params.apiTransport.sendRequest(t,r).then(n=>{var o;return(!n||!n.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:s.ErrorCategory.EXTERNAL_API,message:"No session key",data:n}),this.sessionKey=(o=n==null?void 0:n.session_key)!==null&&o!==void 0?o:void 0,this.sessionKey}).catch(n=>I(this,void 0,void 0,function*(){this.sessionKey=void 0;const o=n==null?void 0:n.error_code;switch(o){case j.AUTH_LOGIN:return this.authToken=yield this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:s.ErrorCategory.EXTERNAL_API,message:"authorize error",data:n}):this.params.error$.next({id:"AuthorizeUnknown",category:s.ErrorCategory.NETWORK,message:"authorize error",thrown:n})})),()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise})}}class Zr{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(t,r,n){t in this.listeners||(this.listeners[t]=[]),this.listeners[t].push({callback:r,options:n})}removeEventListener(t,r){if(!(t in this.listeners))return;const n=this.listeners[t];for(let o=0,i=n.length;o<i;o++)if(n[o].callback===r){n.splice(o,1);return}}dispatchEvent(t){if(!(t.type in this.listeners))return;const n=this.listeners[t.type].slice();for(let o=0,i=n.length;o<i;o++){const c=n[o];try{c.callback.call(this,t)}catch(v){Promise.resolve().then(()=>{throw v})}c.options&&c.options.once&&this.removeEventListener(t.type,c.callback)}return!t.defaultPrevented}}class yo extends Zr{constructor(){super(),this.listeners||Zr.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(t){t.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,t)),super.dispatchEvent(t)}}class Wl{constructor(){Object.defineProperty(this,"signal",{value:new yo,writable:!0,configurable:!0})}abort(t){let r;try{r=new Event("abort")}catch(o){typeof document!="undefined"?document.createEvent?(r=document.createEvent("Event"),r.initEvent("abort",!1,!1)):(r=document.createEventObject(),r.type="abort"):r={type:"abort",bubbles:!1,cancelable:!1}}let n=t;if(n===void 0)if(typeof document=="undefined")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch(o){n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(r)}toString(){return"[object AbortController]"}}typeof Symbol!="undefined"&&Symbol.toStringTag&&(Wl.prototype[Symbol.toStringTag]="AbortController",yo.prototype[Symbol.toStringTag]="AbortSignal");function go(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function ql(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:r=t.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=e;if(!go({fetch:t,Request:r,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o}))return{fetch:t,Request:i};let i=r;(i&&!i.prototype.hasOwnProperty("signal")||o)&&(i=function(u,a){let l;a&&a.signal&&(l=a.signal,delete a.signal);const d=new r(u,a);return l&&Object.defineProperty(d,"signal",{writable:!1,enumerable:!1,configurable:!0,value:l}),d},i.prototype=r.prototype);const c=t;return{fetch:(f,u)=>{const a=i&&i.prototype.isPrototypeOf(f)?f.signal:u?u.signal:void 0;if(a){let l;try{l=new DOMException("Aborted","AbortError")}catch(h){l=new Error("Aborted"),l.name="AbortError"}if(a.aborted)return Promise.reject(l);const d=new Promise((h,g)=>{a.addEventListener("abort",()=>g(l),{once:!0})});return u&&u.signal&&delete u.signal,Promise.race([d,c(f,u)])}return c(f,u)},Request:i}}const qt=go({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),bo=qt?ql({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,en=qt?bo.fetch:window.fetch;qt?bo.Request:window.Request;class Gl{constructor(t){this.params=t,this.apiKey=t.apiKey,this.apiEnv=t.apiEnv,this.apiBaseUrl=t.apiBaseUrl,this.timeSynchronisation=t.timeSynchronisation,this.isApiBaseUrlFetched=!1}resolveApiBaseUrl(){var t;return I(this,void 0,void 0,function*(){if(this.apiEnv!==exports.ApiEnv.AUTO||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{const r=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=yield(yield en(r,{method:"GET",mode:"cors",cache:"no-cache"})).json(),i=(t=o==null?void 0:o.Answer[0])===null||t===void 0?void 0:t.data;if(!i)throw new Error("Wrong DNS response");return i}catch(r){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:s.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),po[exports.ApiEnv.VK_ALIAS]}finally{this.isApiBaseUrlFetched=!0}})}sendBeacon(t,r,n){if(!window.Blob||!window.navigator.sendBeacon)return!1;const o=this._prepareQueryParams({method:t,queryParams:r,sessionKey:n}),i=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,i)}catch(c){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:s.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:c,data:{method:t,params:r}})}return!1}sendRequest(t,r,n){return I(this,void 0,void 0,function*(){const o=s.now(),i=c=>{if(c instanceof TypeError&&["Failed to fetch","NetworkError when attempting to fetch resource."].includes(c.message)){this.params.error$.next({id:"Network",category:s.ErrorCategory.NETWORK,message:"Request failed",thrown:c});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:s.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:c,data:{method:t,params:r,sessionKey:n,time:s.now()-o}})};return this.apiBaseUrl=yield this.resolveApiBaseUrl(),en(`${this.apiBaseUrl}/fb.do`,{method:"post",headers:{"Content-type":"application/x-www-form-urlencoded"},body:this._prepareQueryParams({method:t,queryParams:r,sessionKey:n})}).then(c=>{var v;const f=Number(c.headers.get("content-length"))===0,u=new Date((v=c.headers.get("date"))!==null&&v!==void 0?v:"").getTime(),a=s.now()-o;if(isFinite(u)&&this.timeSynchronisation.addServerTime(u,a),!f)return c.json().then(l=>Object.prototype.hasOwnProperty.call(l,"error_msg")?Promise.reject(l):l,i)},i)})}_prepareQueryParams(t){const r=new URLSearchParams({format:"JSON",method:t.method,application_key:this.apiKey});return t.sessionKey!==void 0&&r.append("session_key",t.sessionKey),Object.entries(t.queryParams).forEach(([n,o])=>r.append(n,typeof o=="string"?o:JSON.stringify(o))),r}}const tn=5e3,Ql=1e4,zl=6e4,Se="onestat_events",Yl=36*60*60*1e3,pt=e=>e.timestamp+Yl>=s.now();class Jl{constructor(t){this.unsaltedStorage=[],this.isPaused=!1,this.isUrgent=r=>{const{operation:n,custom:{param:o}}=r;return["action_stop","close_at_empty_buffer"].includes(n)||n==="watch_coverage_record"&&o==="0-0"},this.firstFlush=Gt(()=>this.safeFlush(),tn,{maxWait:tn}),this.debouncedFlush=Gt(()=>this.safeFlush(),Ql,{maxWait:zl}),this.api=t.api,this.error$=t.error$,this.userSalt=t.userSalt,this.subscription=this.api.authorized$.subscribe(r=>{r&&this.debouncedFlush()}),this.housekeepStorage()}safeFlush(){var t;try{this.flush()}catch(r){this.error$.next({id:"LoggerError",category:s.ErrorCategory.WTF,message:(t=String(r))!==null&&t!==void 0?t:"Unknown logger error",thrown:r})}}readFromStorage(){const t=s.safeStorage.get(Se);try{return t?JSON.parse(t):{}}catch(r){}return{}}addToStorage(t){var r;if(!this.userSalt){this.unsaltedStorage.push(t);return}const n=this.readFromStorage(),i=((r=n[this.userSalt])!==null&&r!==void 0?r:[]).filter(pt);s.safeStorage.set(Se,JSON.stringify(Object.assign(Object.assign({},n),{[this.userSalt]:[...i,t]})))}getFromStorage(){var t;return this.userSalt?((t=this.readFromStorage()[this.userSalt])!==null&&t!==void 0?t:[]).filter(pt):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}const t=this.readFromStorage();delete t[this.userSalt],s.safeStorage.set(Se,JSON.stringify(t))}housekeepStorage(){const t=this.readFromStorage();for(const[r,n]of Object.entries(t)){const o=n.filter(pt);o.length?t[r]=o:delete t[r]}s.safeStorage.set(Se,JSON.stringify(t))}log(t){console.log(t.operation,t.custom.param,t),this.addToStorage(t),!this.isPaused&&(this.isUrgent(t)?this.flush():this.lastVsid!==t.custom.vsid?this.firstFlush():this.debouncedFlush(),this.lastVsid=t.custom.vsid)}flush(t=!1){const r=this.getFromStorage();r.length!==0&&(this.api.authorized$.getValue()?(console.log("flush",r.length,"events",r),t?this.api.logBeacon(r):this.api.logRequest(r),this.markStorageSent()):this.api.authorize(),this.firstFlush.cancel(),this.debouncedFlush.cancel())}pause(){this.isPaused=!0,this.debouncedFlush.cancel()}resume(){this.isPaused=!1,this.debouncedFlush()}destroy(){this.subscription.unsubscribe(),this.firstFlush.cancel(),this.debouncedFlush.cancel()}}const Xl=()=>{let e,t;try{e=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?e=!0:(e=!1,console.error(n))}try{window.location.ancestorOrigins&&(t=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!t&&document.referrer&&(t=document.referrer)}catch(n){console.error(n)}const r=t?new URL(t).hostname:void 0;return{isEmbed:e,host:r}},Zl=e=>e&&{[p.VideoQuality.INVARIANT]:exports.Quality.UNKNOWN,[p.VideoQuality.Q_144P]:exports.Quality.Q144P,[p.VideoQuality.Q_240P]:exports.Quality.Q240P,[p.VideoQuality.Q_360P]:exports.Quality.Q360P,[p.VideoQuality.Q_480P]:exports.Quality.Q480P,[p.VideoQuality.Q_720P]:exports.Quality.Q720P,[p.VideoQuality.Q_1080P]:exports.Quality.Q1080P,[p.VideoQuality.Q_1440P]:exports.Quality.Q1440P,[p.VideoQuality.Q_2160P]:exports.Quality.Q2160P,[p.VideoQuality.Q_4320P]:exports.Quality.UNKNOWN}[e],rn=e=>e&&{[p.HttpConnectionType.HTTP1]:exports.ConnectionType.HTTP1,[p.HttpConnectionType.HTTP2]:exports.ConnectionType.HTTP2,[p.HttpConnectionType.QUIC]:exports.ConnectionType.HTTP3}[e],ef=e=>{if(e!==void 0)switch(e){case p.VideoFormat.MPEG:return exports.ContentType.MP4;case p.VideoFormat.DASH:case p.VideoFormat.DASH_LIVE:return exports.ContentType.DASH;case p.VideoFormat.DASH_SEP:return exports.ContentType.DASH_SEP;case p.VideoFormat.DASH_ONDEMAND:return exports.ContentType.ONDEMAND_DASH;case p.VideoFormat.DASH_WEBM:case p.VideoFormat.DASH_LIVE_WEBM:return exports.ContentType.WEBM;case p.VideoFormat.DASH_LIVE_CMAF:return exports.ContentType.ONDEMAND_DASH_LIVE;case p.VideoFormat.HLS:case p.VideoFormat.HLS_LIVE:return exports.ContentType.HLS;case p.VideoFormat.HLS_ONDEMAND:return exports.ContentType.ONDEMAND_HLS;case p.VideoFormat.HLS_LIVE_CMAF:return exports.ContentType.ONDEMAND_HLS_LIVE;case p.VideoFormat.WEB_RTC_LIVE:return exports.ContentType.WEBRTC;default:return s.assertNever(e)}},yt=e=>{if(e!==void 0)switch(e){case p.Surface.NONE:case p.Surface.INLINE:return;case p.Surface.FULLSCREEN:return x.FULLSCREEN;case p.Surface.SECOND_SCREEN:return x.EXTERNAL;case p.Surface.PIP:return x.PIP;default:return s.assertNever(e)}},tf=e=>{switch(e){case"slow-2g":return Y.POOR;case"2g":return Y.POOR;case"3g":return Y.GOOD;case"4g":return Y.EXCELLENT}};class rf{constructor(t){this.offset=void 0,this.offset=t}getOffset(){var t;return(t=this.offset)!==null&&t!==void 0?t:0}setOffset(t){this.offset=t}now(){var t;return Date.now()+((t=this.offset)!==null&&t!==void 0?t:0)}date(t=new Date){var r;return t.setTime(t.getTime()+((r=this.offset)!==null&&r!==void 0?r:0)),t}addServerTime(t,r){const n=Date.now(),o=t-n-r/2;if(Math.abs(o)<1e3){this.offset=0;return}this.offset===void 0?this.offset=Math.round(o):this.offset=Math.round(.2*o+(1-.2)*this.offset)}}const nn=()=>Math.floor(Math.random()*Math.pow(2,32)).toString(36).padStart(8,"0"),nf=e=>new s.Observable(t=>{const r=new s.Subscription,n=s.merge(s.fromEvent(window,"beforeunload"),e.events.willDestruct$),o=new s.ValueSubject(void 0);let i;e.info.isLive$.pipe(s.filterChanged()).subscribe(h=>{i&&(i.unsubscribe(),o.next(void 0)),h?i=e.info.liveTime$.pipe(s.map(g=>g&&g/1e3)).subscribe(o):i=e.info.position$.subscribe(o),r.add(i)});const{playing$:c,paused$:v}=e.events,f=e.events.willSeek$.pipe(s.filter(()=>e.info.playbackState$.getValue()===p.PlaybackState.PLAYING)),u=e.events.seeked$.pipe(s.filter(()=>e.info.playbackState$.getValue()===p.PlaybackState.PLAYING)),a=s.merge(c,u),l=s.merge(v,f,n,e.events.looped$);let d;return r.add(a.subscribe(()=>d=o.getValue())),r.add(l.subscribe(()=>{const h=o.getValue();s.isNullable(d)||d===h||s.isNullable(h)||(t.next({from:d,to:h}),d=void 0)})),r});class of{constructor(t,r){var n,o;this.subscription=new s.Subscription,this.timeSynchronisation=new rf,this.vsid=nn(),this.seekAction$=new s.ValueSubject(exports.SeekAction.UNKNOWN),this.statContext=t,this.config=Object.assign(Object.assign({},(n=r.config)!==null&&n!==void 0?n:{}),{requestRetryCount:1});const i=new s.Subject;this.experimental={error$:i};const c=new Gl({apiKey:Bl,apiBaseUrl:po[r.apiEnv],apiEnv:r.apiEnv,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new Kl({apiTransport:c,refreshAuthToken:r.refreshAuthToken,requestRetryCount:this.config.requestRetryCount,mobile:(o=this.statContext.mobile)!==null&&o!==void 0?o:!1,error$:i}),this.logger=new Jl({api:this.api,error$:i,userSalt:r.userSalt});const{isEmbed:v,host:f}=Xl();this.isEmbed=v,this.embedParent=f,this.subscribe()}updateContext(t){this.statContext=Object.assign(Object.assign({},this.statContext),t)}attachTo(t){const r=new s.Subscription,n=(a,l)=>r.add(a.subscribe(l));n(t.events.willStart$,()=>{this.logActionPlay({position:t.info.position$.getValue()})}),n(t.events.looped$,()=>{this.resetViewSession(),this.logActionPlay({position:t.info.position$.getValue()})}),n(t.events.seeked$,()=>{this.logSeek({action:this.seekAction$.getValue(),time:t.info.position$.getValue()}),this.seekAction$.next(exports.SeekAction.UNKNOWN)}),n(t.events.paused$,()=>{this.logPause({position:t.info.position$.getValue()})}),n(t.events.willResume$,()=>{this.logPlay()}),n(t.events.started$,()=>{this.statContext.clip&&this.logWatchCoverageRecord({start:0,end:0})}),n(nf(t),a=>{const l=t.info.isLive$.getValue(),d={start:a.from,end:a.to};l?this.logWatchCoverageLive(d):this.logWatchCoverageRecord(d)});let o;n(t.info.isStalled$,a=>{a?o=s.now():(s.isNonNullable(o)&&this.logEmptyBuffer({duration:s.now()-o}),o=void 0)});let i=!1;r.add(t.events.fatalError$.pipe(s.once()).subscribe(()=>i=!0)),n(t.events.willStop$,()=>{if(t.info.isStalled$.getValue()){const l=s.isNonNullable(o)?s.now()-o:void 0;this.logCloseAtEmptyBuffer({duration:l!=null?l:0}),o=void 0}else i||this.logActionStop()}),n(t.events.managedError$,({id:a})=>{this.logError({fatal:!1,errorType:a})}),n(t.events.fatalError$,({id:a})=>{this.logError({fatal:!0,errorType:a})});let c,v,f=!1;n(t.events.firstBytes$,a=>{c=s.now(),this.logFirstBytes({time:a})}),n(t.events.willStart$,()=>v=s.now()),n(t.info.currentBuffer$,a=>{!f&&a&&a.end-a.start>0&&s.isNonNullable(c)&&(this.logPlayerReady({duration:s.now()-c}),f=!0)}),n(t.events.firstFrame$,()=>{s.isNonNullable(c)&&!f&&(this.logPlayerReady({duration:s.now()-c}),f=!0),s.isNonNullable(v)&&this.logFirstFrame({time:s.now()-v})}),n(t.info.atLiveEdge$,a=>this.updateContext({liveEdge:a})),n(s.combine({muted:t.info.muted$,volume:t.info.volume$}),({muted:a,volume:l})=>this.updateContext({audible:!a&&l>0})),n(t.info.currentQuality$,a=>this.updateContext({quality:Zl(a)})),n(t.info.isAutoQualityEnabled$,a=>this.updateContext({autoQuality:a})),n(t.info.currentFormat$,a=>this.updateContext({contentType:ef(a)}));let u;return n(t.info.hostname$,a=>{this.updateContext({cdnHostname:a,failover:u!==void 0&&u!==a}),u=a}),n(t.info.throughputEstimation$,a=>this.updateContext({downloadSpeed:a})),n(t.info.httpConnectionType$,a=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:rn(a)}),this.updateContext({connectionType:rn(a)})}),n(t.info.httpConnectionReused$,a=>{s.isNullable(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:a}),this.updateContext({connectionReused:a})}),n(t.info.surface$,a=>this.updateContext({mode:yt(a)})),n(s.combine({current:t.info.currentTextTrack$,available:t.info.availableTextTracks$}),({current:a,available:l})=>{const d=l.find(({id:h})=>h===a);this.updateContext({subtitles:d==null?void 0:d.language})}),this.player=t,this.uiEvents&&this.attachToUi(this.uiEvents),this.subscription.add(r),r}attachToUi(t){this.uiEvents=t;const r=new s.Subscription;return this.player&&(r.add(t.actionRewind$.subscribe(()=>{this.player&&(this.resetViewSession(),this.logActionPlay({position:this.player.info.position$.getValue()}))})),r.add(t.actionSeek$.subscribe(this.seekAction$)),r.add(t.inPiP$.subscribe(n=>{var o;const i=n?x.PIP:yt((o=this.player)===null||o===void 0?void 0:o.info.surface$.getValue());this.updateContext({mode:i})})),r.add(t.inFullscreen$.subscribe(n=>{var o;const i=n?x.FULLSCREEN:yt((o=this.player)===null||o===void 0?void 0:o.info.surface$.getValue());this.updateContext({mode:i})})),r.add(t.actionSetSubtitle$.subscribe(n=>{this.updateContext({subtitles:n})})),this.subscription.add(r)),r}attachToAds(t){const r=new s.Subscription;return r.add(t.slotRequested$.subscribe(()=>this.logAdSlotRequest())).add(t.started$.subscribe(n=>this.logAdStarted(n))).add(t.paused$.subscribe(()=>this.logAdPaused())).add(t.resumed$.subscribe(()=>this.logAdResumed())).add(t.ended$.subscribe(()=>this.logAdEnded())).add(t.skipped$.subscribe(()=>this.logAdSkipped())).add(t.clicked$.subscribe(()=>this.logAdClicked())),this.subscription.add(r),r}authorize(t){return this.api.authorize(t)}pause(){this.logger.pause()}resume(){this.logger.resume()}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.vsid=nn()}setFieldBlacklist(){}logInited(){}logReady(t){this.log({operation:"player_ready",param:String(t.time)})}logStarted(...t){this.logActionPlay(...t)}logPlay(){this.log({operation:"play_toggle"})}logPause(t){this.log({operation:"pause",param:String(Math.round(t.position))})}logSeek(t){this.log({operation:"seek",param:t.action,time:t.time})}logFirstBytes(t){this.log({operation:"first_bytes",param:String(t.time)})}logFirstFrame(t){this.log({operation:"first_frame",param:String(t.time)})}logError(t){this.log({operation:"content_error",param:`${t.fatal?"fatal":"recoverable"}_${t.errorType}`})}logWatchCoverageRecord(t){this.log({operation:"watch_coverage_record",param:`${t.start}-${t.end}`})}logWatchCoverageLive(t){const r=t.start+this.timeSynchronisation.getOffset(),n=t.end+this.timeSynchronisation.getOffset();this.log({operation:"watch_coverage_live",param:`${r}-${n}`})}logEmptyBuffer(t){this.log({operation:"empty_buffer",param:String(t.duration)})}logDownloadSpeed(){}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(t){this.log({operation:"adv",param:t})}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"})}subscribe(){this.subscription.add(s.fromEvent(window,"beforeunload").subscribe(()=>this.logger.flush(!0)));const t=window.navigator.connection;t&&"onchange"in t&&"effectiveType"in t&&this.subscription.add(s.merge(s.fromEvent(t,"change"),s.observableFrom(["init"])).subscribe(()=>this.updateContext({network:tf(t.effectiveType)})))}logPlayerReady(t){this.log({operation:"player_ready",param:String(Math.round(t.duration))})}logActionPlay(t){this.log({operation:"action_play",param:String(Math.round(t.position))})}logCloseAtEmptyBuffer(t){this.log({operation:"close_at_empty_buffer",param:String(Math.round(t.duration))})}logActionStop(){this.log({operation:"action_stop"})}log(t){const r=this.createLogItem(t);this.logger.log(r)}createLogItem({operation:t,param:r,time:n}){const o=this.timeSynchronisation.now(),i=t==="empty_buffer"||t==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,c=this.statContext.firstConnectionReused,v={vsid:this.vsid,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?Ne.AUTO:this.statContext.autoplay===!1?Ne.MANUAL:void 0,param:r,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:i,connection_reused:c===!0?C.YES:c===!1?C.NO:void 0,cached_data:this.statContext.cached===!0?C.YES:this.statContext.cached===!1?C.NO:void 0,live:this.statContext.liveEdge?C.YES:void 0,muted:this.statContext.audible===!1?C.YES:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:C.YES,ref_domain:this.embedParent,aid:this.statContext.albumId,vk_playlist_id:this.statContext.vkPlaylistId};return{operation:t,type:1,time:n,network:this.statContext.network,timestamp:o,custom:v}}}exports.OneStat=of;exports.VERSION=At;
|
package/es2015.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-statistics v1.0.
|
|
3
|
-
*
|
|
4
|
-
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-
|
|
2
|
+
* @vkontakte/videoplayer-statistics v1.0.35-beta.0
|
|
3
|
+
* Wed, 24 May 2023 14:18:45 GMT
|
|
4
|
+
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-35/doc/
|
|
5
5
|
*/
|
|
6
|
-
import{ValueSubject as Oo,getExponentialDelay as _o,ErrorCategory as E,now as ie,assertNever as Po,Subscription as Jr,Subject as Io,fromEvent as wo,isNonNullable as Xr}from"@vkontakte/videoplayer-shared/es2015.esm.js";import{VideoQuality as T,HttpConnectionType as ze,VideoFormat as y,ChromecastState as Ro}from"@vkontakte/videoplayer-core/es2015.esm.js";import Ao from"lodash/debounce.js";function N(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function v(c){try{s(n.next(c))}catch(l){i(l)}}function u(c){try{s(n.throw(c))}catch(l){i(l)}}function s(c){c.done?a(c.value):o(c.value).then(v,u)}s((n=n.apply(e,r||[])).next())})}var Zr=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},pe=function(e){return e&&e.Math==Math&&e},p=pe(typeof globalThis=="object"&&globalThis)||pe(typeof window=="object"&&window)||pe(typeof self=="object"&&self)||pe(typeof Zr=="object"&&Zr)||function(){return this}()||Function("return this")(),P=function(e){try{return!!e()}catch(r){return!0}},Co=P,ke=!Co(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),No=ke,un=Function.prototype,et=un.apply,rt=un.call,ln=typeof Reflect=="object"&&Reflect.apply||(No?rt.bind(et):function(){return rt.apply(et,arguments)}),vn=ke,fn=Function.prototype,Er=fn.call,Do=vn&&fn.bind.bind(Er,Er),I=vn?Do:function(e){return function(){return Er.apply(e,arguments)}},hn=I,jo=hn({}.toString),Lo=hn("".slice),Be=function(e){return Lo(jo(e),8,-1)},Mo=Be,Uo=I,dn=function(e){if(Mo(e)==="Function")return Uo(e)},Sr=typeof document=="object"&&document.all,ko=typeof Sr=="undefined"&&Sr!==void 0,pn={all:Sr,IS_HTMLDDA:ko},yn=pn,Bo=yn.all,d=yn.IS_HTMLDDA?function(e){return typeof e=="function"||e===Bo}:function(e){return typeof e=="function"},Lr={},xo=P,re=!xo(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),Fo=ke,ye=Function.prototype.call,w=Fo?ye.bind(ye):function(){return ye.apply(ye,arguments)},gn={},$n={}.propertyIsEnumerable,bn=Object.getOwnPropertyDescriptor,Ho=bn&&!$n.call({1:2},1);gn.f=Ho?function(r){var t=bn(this,r);return!!t&&t.enumerable}:$n;var mn=function(e,r){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:r}},Ko=I,qo=P,Vo=Be,Qe=Object,Wo=Ko("".split),Go=qo(function(){return!Qe("z").propertyIsEnumerable(0)})?function(e){return Vo(e)=="String"?Wo(e,""):Qe(e)}:Qe,xe=function(e){return e==null},zo=xe,Qo=TypeError,En=function(e){if(zo(e))throw Qo("Can't call method on "+e);return e},Yo=Go,Jo=En,Xo=function(e){return Yo(Jo(e))},tt=d,Sn=pn,Zo=Sn.all,x=Sn.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:tt(e)||e===Zo}:function(e){return typeof e=="object"?e!==null:tt(e)},Tn={},Ye=Tn,Je=p,ea=d,nt=function(e){return ea(e)?e:void 0},j=function(e,r){return arguments.length<2?nt(Ye[e])||nt(Je[e]):Ye[e]&&Ye[e][r]||Je[e]&&Je[e][r]},ra=I,Mr=ra({}.isPrototypeOf),Fe=typeof navigator!="undefined"&&String(navigator.userAgent)||"",On=p,Xe=Fe,ot=On.process,at=On.Deno,it=ot&&ot.versions||at&&at.version,st=it&&it.v8,S,we;st&&(S=st.split("."),we=S[0]>0&&S[0]<4?1:+(S[0]+S[1]));!we&&Xe&&(S=Xe.match(/Edge\/(\d+)/),(!S||S[1]>=74)&&(S=Xe.match(/Chrome\/(\d+)/),S&&(we=+S[1])));var _n=we,ct=_n,ta=P,Pn=!!Object.getOwnPropertySymbols&&!ta(function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ct&&ct<41}),na=Pn,In=na&&!Symbol.sham&&typeof Symbol.iterator=="symbol",oa=j,aa=d,ia=Mr,sa=In,ca=Object,wn=sa?function(e){return typeof e=="symbol"}:function(e){var r=oa("Symbol");return aa(r)&&ia(r.prototype,ca(e))},ua=String,He=function(e){try{return ua(e)}catch(r){return"Object"}},la=d,va=He,fa=TypeError,F=function(e){if(la(e))return e;throw fa(va(e)+" is not a function")},ha=F,da=xe,Ur=function(e,r){var t=e[r];return da(t)?void 0:ha(t)},Ze=w,er=d,rr=x,pa=TypeError,ya=function(e,r){var t,n;if(r==="string"&&er(t=e.toString)&&!rr(n=Ze(t,e))||er(t=e.valueOf)&&!rr(n=Ze(t,e))||r!=="string"&&er(t=e.toString)&&!rr(n=Ze(t,e)))return n;throw pa("Can't convert object to primitive value")},Re={},ga={get exports(){return Re},set exports(e){Re=e}},fe=!0,ut=p,$a=Object.defineProperty,ba=function(e,r){try{$a(ut,e,{value:r,configurable:!0,writable:!0})}catch(t){ut[e]=r}return r},ma=p,Ea=ba,lt="__core-js_shared__",Sa=ma[lt]||Ea(lt,{}),kr=Sa,vt=kr;(ga.exports=function(e,r){return vt[e]||(vt[e]=r!==void 0?r:{})})("versions",[]).push({version:"3.27.2",mode:"pure",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.27.2/LICENSE",source:"https://github.com/zloirock/core-js"});var Ta=En,Oa=Object,_a=function(e){return Oa(Ta(e))},Pa=I,Ia=_a,wa=Pa({}.hasOwnProperty),te=Object.hasOwn||function(r,t){return wa(Ia(r),t)},Ra=I,Aa=0,Ca=Math.random(),Na=Ra(1 .toString),Rn=function(e){return"Symbol("+(e===void 0?"":e)+")_"+Na(++Aa+Ca,36)},Da=p,ja=Re,ft=te,La=Rn,Ma=Pn,Ua=In,Y=Da.Symbol,tr=ja("wks"),ka=Ua?Y.for||Y:Y&&Y.withoutSetter||La,R=function(e){return ft(tr,e)||(tr[e]=Ma&&ft(Y,e)?Y[e]:ka("Symbol."+e)),tr[e]},Ba=w,ht=x,dt=wn,xa=Ur,Fa=ya,Ha=R,Ka=TypeError,qa=Ha("toPrimitive"),Va=function(e,r){if(!ht(e)||dt(e))return e;var t=xa(e,qa),n;if(t){if(r===void 0&&(r="default"),n=Ba(t,e,r),!ht(n)||dt(n))return n;throw Ka("Can't convert object to primitive value")}return r===void 0&&(r="number"),Fa(e,r)},Wa=Va,Ga=wn,An=function(e){var r=Wa(e,"string");return Ga(r)?r:r+""},za=p,pt=x,Tr=za.document,Qa=pt(Tr)&&pt(Tr.createElement),Cn=function(e){return Qa?Tr.createElement(e):{}},Ya=re,Ja=P,Xa=Cn,Nn=!Ya&&!Ja(function(){return Object.defineProperty(Xa("div"),"a",{get:function(){return 7}}).a!=7}),Za=re,ei=w,ri=gn,ti=mn,ni=Xo,oi=An,ai=te,ii=Nn,yt=Object.getOwnPropertyDescriptor;Lr.f=Za?yt:function(r,t){if(r=ni(r),t=oi(t),ii)try{return yt(r,t)}catch(n){}if(ai(r,t))return ti(!ei(ri.f,r,t),r[t])};var si=P,ci=d,ui=/#|\.prototype\./,he=function(e,r){var t=vi[li(e)];return t==hi?!0:t==fi?!1:ci(r)?si(r):!!r},li=he.normalize=function(e){return String(e).replace(ui,".").toLowerCase()},vi=he.data={},fi=he.NATIVE="N",hi=he.POLYFILL="P",Dn=he,gt=dn,di=F,pi=ke,yi=gt(gt.bind),Ke=function(e,r){return di(e),r===void 0?e:pi?yi(e,r):function(){return e.apply(r,arguments)}},qe={},gi=re,$i=P,bi=gi&&$i(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),mi=x,Ei=String,Si=TypeError,H=function(e){if(mi(e))return e;throw Si(Ei(e)+" is not an object")},Ti=re,Oi=Nn,_i=bi,ge=H,$t=An,Pi=TypeError,nr=Object.defineProperty,Ii=Object.getOwnPropertyDescriptor,or="enumerable",ar="configurable",ir="writable";qe.f=Ti?_i?function(r,t,n){if(ge(r),t=$t(t),ge(n),typeof r=="function"&&t==="prototype"&&"value"in n&&ir in n&&!n[ir]){var o=Ii(r,t);o&&o[ir]&&(r[t]=n.value,n={configurable:ar in n?n[ar]:o[ar],enumerable:or in n?n[or]:o[or],writable:!1})}return nr(r,t,n)}:nr:function(r,t,n){if(ge(r),t=$t(t),ge(n),Oi)try{return nr(r,t,n)}catch(o){}if("get"in n||"set"in n)throw Pi("Accessors not supported");return"value"in n&&(r[t]=n.value),r};var wi=re,Ri=qe,Ai=mn,Ve=wi?function(e,r,t){return Ri.f(e,r,Ai(1,t))}:function(e,r,t){return e[r]=t,e},$e=p,Ci=ln,Ni=dn,Di=d,ji=Lr.f,Li=Dn,V=Tn,Mi=Ke,W=Ve,bt=te,Ui=function(e){var r=function(t,n,o){if(this instanceof r){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,o)}return Ci(e,this,arguments)};return r.prototype=e.prototype,r},K=function(e,r){var t=e.target,n=e.global,o=e.stat,a=e.proto,i=n?$e:o?$e[t]:($e[t]||{}).prototype,v=n?V:V[t]||W(V,t,{})[t],u=v.prototype,s,c,l,h,f,m,L,A,q;for(h in r)s=Li(n?h:t+(o?".":"#")+h,e.forced),c=!s&&i&&bt(i,h),m=v[h],c&&(e.dontCallGetSet?(q=ji(i,h),L=q&&q.value):L=i[h]),f=c&&L?L:r[h],!(c&&typeof m==typeof f)&&(e.bind&&c?A=Mi(f,$e):e.wrap&&c?A=Ui(f):a&&Di(f)?A=Ni(f):A=f,(e.sham||f&&f.sham||m&&m.sham)&&W(A,"sham",!0),W(v,h,A),a&&(l=t+"Prototype",bt(V,l)||W(V,l,{}),W(V[l],h,f),e.real&&u&&(s||!u[h])&&W(u,h,f)))},ki=Be,We=typeof process!="undefined"&&ki(process)=="process",Bi=Ve,Br=function(e,r,t,n){return n&&n.enumerable?e[r]=t:Bi(e,r,t),e},xi=d,Fi=String,Hi=TypeError,Ki=function(e){if(typeof e=="object"||xi(e))return e;throw Hi("Can't set "+Fi(e)+" as a prototype")},qi=I,Vi=H,Wi=Ki,Gi=Object.setPrototypeOf||("__proto__"in{}?function(){var e=!1,r={},t;try{t=qi(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(r,[]),e=r instanceof Array}catch(n){}return function(o,a){return Vi(o),Wi(a),e?t(o,a):o.__proto__=a,o}}():void 0),zi=R,Qi=zi("toStringTag"),jn={};jn[Qi]="z";var xr=String(jn)==="[object z]",Yi=xr,Ji=d,_e=Be,Xi=R,Zi=Xi("toStringTag"),es=Object,rs=_e(function(){return arguments}())=="Arguments",ts=function(e,r){try{return e[r]}catch(t){}},Fr=Yi?_e:function(e){var r,t,n;return e===void 0?"Undefined":e===null?"Null":typeof(t=ts(r=es(e),Zi))=="string"?t:rs?_e(r):(n=_e(r))=="Object"&&Ji(r.callee)?"Arguments":n},ns=xr,os=Fr,as=ns?{}.toString:function(){return"[object "+os(this)+"]"},is=xr,ss=qe.f,cs=Ve,us=te,ls=as,vs=R,mt=vs("toStringTag"),fs=function(e,r,t,n){if(e){var o=t?e:e.prototype;us(o,mt)||ss(o,mt,{configurable:!0,value:r}),n&&!is&&cs(o,"toString",ls)}},hs=j,ds=qe,ps=R,ys=re,Et=ps("species"),gs=function(e){var r=hs(e),t=ds.f;ys&&r&&!r[Et]&&t(r,Et,{configurable:!0,get:function(){return this}})},$s=Mr,bs=TypeError,ms=function(e,r){if($s(r,e))return e;throw bs("Incorrect invocation")},Es=I,Ss=d,Or=kr,Ts=Es(Function.toString);Ss(Or.inspectSource)||(Or.inspectSource=function(e){return Ts(e)});var Ln=Or.inspectSource,Os=I,_s=P,Mn=d,Ps=Fr,Is=j,ws=Ln,Un=function(){},Rs=[],kn=Is("Reflect","construct"),Hr=/^\s*(?:class|function)\b/,As=Os(Hr.exec),Cs=!Hr.exec(Un),ae=function(r){if(!Mn(r))return!1;try{return kn(Un,Rs,r),!0}catch(t){return!1}},Bn=function(r){if(!Mn(r))return!1;switch(Ps(r)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Cs||!!As(Hr,ws(r))}catch(t){return!0}};Bn.sham=!0;var Ns=!kn||_s(function(){var e;return ae(ae.call)||!ae(Object)||!ae(function(){e=!0})||e})?Bn:ae,Ds=Ns,js=He,Ls=TypeError,Ms=function(e){if(Ds(e))return e;throw Ls(js(e)+" is not a constructor")},St=H,Us=Ms,ks=xe,Bs=R,xs=Bs("species"),xn=function(e,r){var t=St(e).constructor,n;return t===void 0||ks(n=St(t)[xs])?r:Us(n)},Fs=j,Hs=Fs("document","documentElement"),Ks=I,qs=Ks([].slice),Vs=TypeError,Ws=function(e,r){if(e<r)throw Vs("Not enough arguments");return e},Gs=Fe,Fn=/(?:ipad|iphone|ipod).*applewebkit/i.test(Gs),g=p,zs=ln,Qs=Ke,Tt=d,Ys=te,Hn=P,Ot=Hs,Js=qs,_t=Cn,Xs=Ws,Zs=Fn,ec=We,_r=g.setImmediate,Pr=g.clearImmediate,rc=g.process,sr=g.Dispatch,tc=g.Function,Pt=g.MessageChannel,nc=g.String,cr=0,se={},It="onreadystatechange",le,M,ur,lr;Hn(function(){le=g.location});var Kr=function(e){if(Ys(se,e)){var r=se[e];delete se[e],r()}},vr=function(e){return function(){Kr(e)}},wt=function(e){Kr(e.data)},Rt=function(e){g.postMessage(nc(e),le.protocol+"//"+le.host)};(!_r||!Pr)&&(_r=function(r){Xs(arguments.length,1);var t=Tt(r)?r:tc(r),n=Js(arguments,1);return se[++cr]=function(){zs(t,void 0,n)},M(cr),cr},Pr=function(r){delete se[r]},ec?M=function(e){rc.nextTick(vr(e))}:sr&&sr.now?M=function(e){sr.now(vr(e))}:Pt&&!Zs?(ur=new Pt,lr=ur.port2,ur.port1.onmessage=wt,M=Qs(lr.postMessage,lr)):g.addEventListener&&Tt(g.postMessage)&&!g.importScripts&&le&&le.protocol!=="file:"&&!Hn(Rt)?(M=Rt,g.addEventListener("message",wt,!1)):It in _t("script")?M=function(e){Ot.appendChild(_t("script"))[It]=function(){Ot.removeChild(this),Kr(e)}}:M=function(e){setTimeout(vr(e),0)});var Kn={set:_r,clear:Pr},qn=function(){this.head=null,this.tail=null};qn.prototype={add:function(e){var r={item:e,next:null},t=this.tail;t?t.next=r:this.head=r,this.tail=r},get:function(){var e=this.head;if(e){var r=this.head=e.next;return r===null&&(this.tail=null),e.item}}};var Vn=qn,oc=Fe,ac=/ipad|iphone|ipod/i.test(oc)&&typeof Pebble!="undefined",ic=Fe,sc=/web0s(?!.*chrome)/i.test(ic),B=p,At=Ke,cc=Lr.f,fr=Kn.set,uc=Vn,lc=Fn,vc=ac,fc=sc,hr=We,Ct=B.MutationObserver||B.WebKitMutationObserver,Nt=B.document,Dt=B.process,be=B.Promise,jt=cc(B,"queueMicrotask"),Ir=jt&&jt.value,G,dr,pr,me,Lt;if(!Ir){var Ee=new uc,Se=function(){var e,r;for(hr&&(e=Dt.domain)&&e.exit();r=Ee.get();)try{r()}catch(t){throw Ee.head&&G(),t}e&&e.enter()};!lc&&!hr&&!fc&&Ct&&Nt?(dr=!0,pr=Nt.createTextNode(""),new Ct(Se).observe(pr,{characterData:!0}),G=function(){pr.data=dr=!dr}):!vc&&be&&be.resolve?(me=be.resolve(void 0),me.constructor=be,Lt=At(me.then,me),G=function(){Lt(Se)}):hr?G=function(){Dt.nextTick(Se)}:(fr=At(fr,B),G=function(){fr(Se)}),Ir=function(e){Ee.head||G(),Ee.add(e)}}var hc=Ir,dc=function(e,r){try{arguments.length==1?console.error(e):console.error(e,r)}catch(t){}},qr=function(e){try{return{error:!1,value:e()}}catch(r){return{error:!0,value:r}}},pc=p,yc=d,Mt=pc.WeakMap,gc=yc(Mt)&&/native code/.test(String(Mt)),$c=Re,bc=Rn,Ut=$c("keys"),mc=function(e){return Ut[e]||(Ut[e]=bc(e))},Ec={},Sc=gc,Wn=p,Tc=x,Oc=Ve,yr=te,gr=kr,_c=mc,Pc=Ec,kt="Object already initialized",wr=Wn.TypeError,Ic=Wn.WeakMap,Ae,ve,Ce,wc=function(e){return Ce(e)?ve(e):Ae(e,{})},Rc=function(e){return function(r){var t;if(!Tc(r)||(t=ve(r)).type!==e)throw wr("Incompatible receiver, "+e+" required");return t}};if(Sc||gr.state){var O=gr.state||(gr.state=new Ic);O.get=O.get,O.has=O.has,O.set=O.set,Ae=function(e,r){if(O.has(e))throw wr(kt);return r.facade=e,O.set(e,r),r},ve=function(e){return O.get(e)||{}},Ce=function(e){return O.has(e)}}else{var z=_c("state");Pc[z]=!0,Ae=function(e,r){if(yr(e,z))throw wr(kt);return r.facade=e,Oc(e,z,r),r},ve=function(e){return yr(e,z)?e[z]:{}},Ce=function(e){return yr(e,z)}}var Ac={set:Ae,get:ve,has:Ce,enforce:wc,getterFor:Rc},Cc=p,ne=Cc.Promise,Gn=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",Nc=Gn,Dc=We,jc=!Nc&&!Dc&&typeof window=="object"&&typeof document=="object",Lc=p,ce=ne,Mc=d,Uc=Dn,kc=Ln,Bc=R,xc=jc,Fc=Gn,Hc=fe,$r=_n,Bt=ce&&ce.prototype,Kc=Bc("species"),Rr=!1,zn=Mc(Lc.PromiseRejectionEvent),qc=Uc("Promise",function(){var e=kc(ce),r=e!==String(ce);if(!r&&$r===66||Hc&&!(Bt.catch&&Bt.finally))return!0;if(!$r||$r<51||!/native code/.test(e)){var t=new ce(function(a){a(1)}),n=function(a){a(function(){},function(){})},o=t.constructor={};if(o[Kc]=n,Rr=t.then(function(){})instanceof n,!Rr)return!0}return!r&&(xc||Fc)&&!zn}),de={CONSTRUCTOR:qc,REJECTION_EVENT:zn,SUBCLASSING:Rr},oe={},xt=F,Vc=TypeError,Wc=function(e){var r,t;this.promise=new e(function(n,o){if(r!==void 0||t!==void 0)throw Vc("Bad Promise constructor");r=n,t=o}),this.resolve=xt(r),this.reject=xt(t)};oe.f=function(e){return new Wc(e)};var Gc=K,zc=fe,Ne=We,D=p,Z=w,Ft=Br,Ht=Gi,Qc=fs,Yc=gs,Jc=F,Pe=d,Xc=x,Zc=ms,eu=xn,Qn=Kn.set,Vr=hc,ru=dc,tu=qr,nu=Vn,Yn=Ac,De=ne,Wr=de,Jn=oe,Ge="Promise",Xn=Wr.CONSTRUCTOR,ou=Wr.REJECTION_EVENT,au=Wr.SUBCLASSING,br=Yn.getterFor(Ge),iu=Yn.set,Q=De&&De.prototype,U=De,Te=Q,Zn=D.TypeError,Ar=D.document,Gr=D.process,Cr=Jn.f,su=Cr,cu=!!(Ar&&Ar.createEvent&&D.dispatchEvent),eo="unhandledrejection",uu="rejectionhandled",Kt=0,ro=1,lu=2,zr=1,to=2,Oe,qt,vu,Vt,no=function(e){var r;return Xc(e)&&Pe(r=e.then)?r:!1},oo=function(e,r){var t=r.value,n=r.state==ro,o=n?e.ok:e.fail,a=e.resolve,i=e.reject,v=e.domain,u,s,c;try{o?(n||(r.rejection===to&&hu(r),r.rejection=zr),o===!0?u=t:(v&&v.enter(),u=o(t),v&&(v.exit(),c=!0)),u===e.promise?i(Zn("Promise-chain cycle")):(s=no(u))?Z(s,u,a,i):a(u)):i(t)}catch(l){v&&!c&&v.exit(),i(l)}},ao=function(e,r){e.notified||(e.notified=!0,Vr(function(){for(var t=e.reactions,n;n=t.get();)oo(n,e);e.notified=!1,r&&!e.rejection&&fu(e)}))},io=function(e,r,t){var n,o;cu?(n=Ar.createEvent("Event"),n.promise=r,n.reason=t,n.initEvent(e,!1,!0),D.dispatchEvent(n)):n={promise:r,reason:t},!ou&&(o=D["on"+e])?o(n):e===eo&&ru("Unhandled promise rejection",t)},fu=function(e){Z(Qn,D,function(){var r=e.facade,t=e.value,n=Wt(e),o;if(n&&(o=tu(function(){Ne?Gr.emit("unhandledRejection",t,r):io(eo,r,t)}),e.rejection=Ne||Wt(e)?to:zr,o.error))throw o.value})},Wt=function(e){return e.rejection!==zr&&!e.parent},hu=function(e){Z(Qn,D,function(){var r=e.facade;Ne?Gr.emit("rejectionHandled",r):io(uu,r,e.value)})},J=function(e,r,t){return function(n){e(r,n,t)}},X=function(e,r,t){e.done||(e.done=!0,t&&(e=t),e.value=r,e.state=lu,ao(e,!0))},Nr=function(e,r,t){if(!e.done){e.done=!0,t&&(e=t);try{if(e.facade===r)throw Zn("Promise can't be resolved itself");var n=no(r);n?Vr(function(){var o={done:!1};try{Z(n,r,J(Nr,o,e),J(X,o,e))}catch(a){X(o,a,e)}}):(e.value=r,e.state=ro,ao(e,!1))}catch(o){X({done:!1},o,e)}}};if(Xn&&(U=function(r){Zc(this,Te),Jc(r),Z(Oe,this);var t=br(this);try{r(J(Nr,t),J(X,t))}catch(n){X(t,n)}},Te=U.prototype,Oe=function(r){iu(this,{type:Ge,done:!1,notified:!1,parent:!1,reactions:new nu,rejection:!1,state:Kt,value:void 0})},Oe.prototype=Ft(Te,"then",function(r,t){var n=br(this),o=Cr(eu(this,U));return n.parent=!0,o.ok=Pe(r)?r:!0,o.fail=Pe(t)&&t,o.domain=Ne?Gr.domain:void 0,n.state==Kt?n.reactions.add(o):Vr(function(){oo(o,n)}),o.promise}),qt=function(){var e=new Oe,r=br(e);this.promise=e,this.resolve=J(Nr,r),this.reject=J(X,r)},Jn.f=Cr=function(e){return e===U||e===vu?new qt(e):su(e)},!zc&&Pe(De)&&Q!==Object.prototype)){Vt=Q.then,au||Ft(Q,"then",function(r,t){var n=this;return new U(function(o,a){Z(Vt,n,o,a)}).then(r,t)},{unsafe:!0});try{delete Q.constructor}catch(e){}Ht&&Ht(Q,Te)}Gc({global:!0,constructor:!0,wrap:!0,forced:Xn},{Promise:U});Qc(U,Ge,!1,!0);Yc(Ge);var so={},du=R,pu=so,yu=du("iterator"),gu=Array.prototype,$u=function(e){return e!==void 0&&(pu.Array===e||gu[yu]===e)},bu=Math.ceil,mu=Math.floor,Eu=Math.trunc||function(r){var t=+r;return(t>0?mu:bu)(t)},Su=Eu,Tu=function(e){var r=+e;return r!==r||r===0?0:Su(r)},Ou=Tu,_u=Math.min,Pu=function(e){return e>0?_u(Ou(e),9007199254740991):0},Iu=Pu,wu=function(e){return Iu(e.length)},Ru=Fr,Gt=Ur,Au=xe,Cu=so,Nu=R,Du=Nu("iterator"),co=function(e){if(!Au(e))return Gt(e,Du)||Gt(e,"@@iterator")||Cu[Ru(e)]},ju=w,Lu=F,Mu=H,Uu=He,ku=co,Bu=TypeError,xu=function(e,r){var t=arguments.length<2?ku(e):r;if(Lu(t))return Mu(ju(t,e));throw Bu(Uu(e)+" is not iterable")},Fu=w,zt=H,Hu=Ur,Ku=function(e,r,t){var n,o;zt(e);try{if(n=Hu(e,"return"),!n){if(r==="throw")throw t;return t}n=Fu(n,e)}catch(a){o=!0,n=a}if(r==="throw")throw t;if(o)throw n;return zt(n),t},qu=Ke,Vu=w,Wu=H,Gu=He,zu=$u,Qu=wu,Qt=Mr,Yu=xu,Ju=co,Yt=Ku,Xu=TypeError,Ie=function(e,r){this.stopped=e,this.result=r},Jt=Ie.prototype,uo=function(e,r,t){var n=t&&t.that,o=!!(t&&t.AS_ENTRIES),a=!!(t&&t.IS_RECORD),i=!!(t&&t.IS_ITERATOR),v=!!(t&&t.INTERRUPTED),u=qu(r,n),s,c,l,h,f,m,L,A=function($){return s&&Yt(s,"normal",$),new Ie(!0,$)},q=function($){return o?(Wu($),v?u($[0],$[1],A):u($[0],$[1])):v?u($,A):u($)};if(a)s=e.iterator;else if(i)s=e;else{if(c=Ju(e),!c)throw Xu(Gu(e)+" is not iterable");if(zu(c)){for(l=0,h=Qu(e);h>l;l++)if(f=q(e[l]),f&&Qt(Jt,f))return f;return new Ie(!1)}s=Yu(e,c)}for(m=a?e.next:s.next;!(L=Vu(m,s)).done;){try{f=q(L.value)}catch($){Yt(s,"throw",$)}if(typeof f=="object"&&f&&Qt(Jt,f))return f}return new Ie(!1)},Zu=R,lo=Zu("iterator"),vo=!1;try{var el=0,Xt={next:function(){return{done:!!el++}},return:function(){vo=!0}};Xt[lo]=function(){return this},Array.from(Xt,function(){throw 2})}catch(e){}var rl=function(e,r){if(!r&&!vo)return!1;var t=!1;try{var n={};n[lo]=function(){return{next:function(){return{done:t=!0}}}},e(n)}catch(o){}return t},tl=ne,nl=rl,ol=de.CONSTRUCTOR,fo=ol||!nl(function(e){tl.all(e).then(void 0,function(){})}),al=K,il=w,sl=F,cl=oe,ul=qr,ll=uo,vl=fo;al({target:"Promise",stat:!0,forced:vl},{all:function(r){var t=this,n=cl.f(t),o=n.resolve,a=n.reject,i=ul(function(){var v=sl(t.resolve),u=[],s=0,c=1;ll(r,function(l){var h=s++,f=!1;c++,il(v,t,l).then(function(m){f||(f=!0,u[h]=m,--c||o(u))},a)}),--c||o(u)});return i.error&&a(i.value),n.promise}});var fl=K,hl=fe,dl=de.CONSTRUCTOR,Dr=ne,pl=j,yl=d,gl=Br,Zt=Dr&&Dr.prototype;fl({target:"Promise",proto:!0,forced:dl,real:!0},{catch:function(e){return this.then(void 0,e)}});if(!hl&&yl(Dr)){var en=pl("Promise").prototype.catch;Zt.catch!==en&&gl(Zt,"catch",en,{unsafe:!0})}var $l=K,bl=w,ml=F,El=oe,Sl=qr,Tl=uo,Ol=fo;$l({target:"Promise",stat:!0,forced:Ol},{race:function(r){var t=this,n=El.f(t),o=n.reject,a=Sl(function(){var i=ml(t.resolve);Tl(r,function(v){bl(i,t,v).then(n.resolve,o)})});return a.error&&o(a.value),n.promise}});var _l=K,Pl=w,Il=oe,wl=de.CONSTRUCTOR;_l({target:"Promise",stat:!0,forced:wl},{reject:function(r){var t=Il.f(this);return Pl(t.reject,void 0,r),t.promise}});var Rl=H,Al=x,Cl=oe,ho=function(e,r){if(Rl(e),Al(r)&&r.constructor===e)return r;var t=Cl.f(e),n=t.resolve;return n(r),t.promise},Nl=K,Dl=j,po=fe,jl=ne,yo=de.CONSTRUCTOR,Ll=ho,Ml=Dl("Promise"),Ul=po&&!yo;Nl({target:"Promise",stat:!0,forced:po||yo},{resolve:function(r){return Ll(Ul&&this===Ml?jl:this,r)}});var kl=K,Bl=fe,je=ne,xl=P,go=j,$o=d,Fl=xn,rn=ho,Hl=Br,jr=je&&je.prototype,Kl=!!je&&xl(function(){jr.finally.call({then:function(){}},function(){})});kl({target:"Promise",proto:!0,real:!0,forced:Kl},{finally:function(e){var r=Fl(this,go("Promise")),t=$o(e);return this.then(t?function(n){return rn(r,e()).then(function(){return n})}:e,t?function(n){return rn(r,e()).then(function(){throw n})}:e)}});if(!Bl&&$o(je)){var tn=go("Promise").prototype.finally;jr.finally!==tn&&Hl(jr,"finally",tn,{unsafe:!0})}var ql=j,Vl=ql,Wl=Vl,Gl=Wl("Promise","finally"),zl=Gl,Ql=zl,Yl=Ql,Jl=Yl,mr=Jl;const Qr="_one-stat_",ee=(()=>{try{const e=Date.now().toString(),r=window.localStorage;r.setItem(e,e);const t=r.getItem(e)===e;return r.removeItem(e),t?r:null}catch(e){return null}})();function Xl(e){const r=ee?ee.getItem(Qr+e):null;if(r===null)return null;try{return JSON.parse(r)}catch(t){return null}}function Zl(e,r){try{ee&&ee.setItem(Qr+e,JSON.stringify(r))}catch(t){}}function ev(e){ee&&ee.removeItem(Qr+e)}var nn={get(e){return Xl(e)||null},set(e,r){Zl(e,r)},remove(e){ev(e)}};function rv(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=new Array(36);let t=0,n,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?r[o]="-":o===14?r[o]="4":(t<=2&&(t=33554432+Math.random()*16777216|0),n=t&15,t=t>>4,r[o]=e[o===19?n&3|8:n]);return r.join("")}var C;(function(e){e.PROD="prod",e.VK_ALIAS="vk_alias",e.VIDEOTEST="videotest",e.TEST="test",e.AUTO="auto"})(C||(C={}));var b;(function(e){e.Q144P="144",e.Q240P="240",e.Q360P="360",e.Q480P="480",e.Q720P="720",e.Q1080P="1080",e.Q1440P="1440",e.Q2160P="2160",e.Q4320P="4320",e.UNKNOWN="unknown"})(b||(b={}));var Le;(function(e){e.CHROMECAST="chromecast",e.APPLE_TV="appletv",e.PIP="pip",e.HEADPHONES="externalHeadphones",e.SCREEN=""})(Le||(Le={}));var _;(function(e){e.MP4="mp4",e.DASH="dash",e.DASH_SEP="dash_sep",e.ONDEMAND_DASH="ondemand_dash",e.HLS="hls",e.ONDEMAND_HLS="ondemand_hls",e.WEBM="webm",e.RTMP="rtmp",e.UNKNOWN="unknown"})(_||(_={}));var Me;(function(e){e.AUTO="auto",e.MANUAL=""})(Me||(Me={}));var ue;(function(e){e.HTTP1="http1",e.HTTP2="http2",e.HTTP3="http3"})(ue||(ue={}));var Ue;(function(e){e[e.YES=1]="YES",e[e.NO=0]="NO"})(Ue||(Ue={}));const on="1.0.34",tv="es2015.esm.js",nv="CIOPGQJGDIHBABABA",bo={[C.PROD]:"https://api.ok.ru",[C.VK_ALIAS]:"https://api.mycdn.me",[C.VIDEOTEST]:"https://videotestapi.ok.ru/api",[C.TEST]:"https://apitest.ok.ru",[C.AUTO]:""},ov={start:1e3,factor:1.5,max:5*60*1e3,random:.1};var k;(function(e){e[e.PARAM_SESSION_EXPIRED=102]="PARAM_SESSION_EXPIRED",e[e.PARAM_SESSION_KEY=103]="PARAM_SESSION_KEY",e[e.PARAM_SIGNATURE=104]="PARAM_SIGNATURE",e[e.AUTH_LOGIN=401]="AUTH_LOGIN"})(k||(k={}));class av{constructor(r){this.consequentAuthErrors=0,this.authorized$=new Oo(!1),this.params=r;const t=nn.get("uuid");t?this.uuid=String(t):(this.uuid=rv(),nn.set("uuid",this.uuid))}authorize(r){return N(this,void 0,void 0,function*(){return this.authToken=r!=null?r:yield this.refreshAuthToken(),this._authorizeWithBackoff()})}logBeacon(r){const t="log.externalLog",n=this.createLogParams(r),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(t,n,o)||this.logRequest(r)}logRequest(r){var t;return N(this,void 0,void 0,function*(){const n="log.externalLog",o=this.createLogParams(r),a=(t=this.sessionKey)!==null&&t!==void 0?t:yield this._authorizeWithBackoff();if(!a)return;const i=(v,u=this.params.requestRetryCount)=>N(this,void 0,void 0,function*(){try{return yield this.params.apiTransport.sendRequest(n,o,a)}catch(s){if(!s||!("error_code"in s)){this.params.error$.next({id:"logRequestUnknown",category:E.NETWORK,message:`Unknown ${n} error`,thrown:s});return}const c=s==null?void 0:s.error_code;switch(c){case k.PARAM_SESSION_EXPIRED:case k.PARAM_SESSION_KEY:case k.PARAM_SIGNATURE:return this.authorized$.next(!1),this.sessionKey=yield this._authorizeWithBackoff(),u>0?i(v,u-1):void 0;case k.AUTH_LOGIN:return this.authorized$.next(!1),this.authToken=yield this.refreshAuthToken(),this.sessionKey=yield this._authorizeWithBackoff(),u>0?i(v,u-1):void 0;default:{this.params.error$.next({id:`LogRequest#${c}`,category:E.EXTERNAL_API,message:`${n} error`,data:s});return}}}});return i(r)})}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}refreshAuthToken(){return N(this,void 0,void 0,function*(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=mr(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise})}createLogParams(r){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`${tv}:${on}`,platform:"WEB",items:r.map(t=>Object.assign(Object.assign({},t),{time:0,type:1}))})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();const r=_o(this.consequentAuthErrors,ov);return new Promise(t=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{mr(this._authorize().then(t).catch(n=>this.params.error$.next({id:"AuthorizeBackoff",category:E.NETWORK,message:"Otherwise unhandle errror in authrization",thrown:n})),()=>this.backoffTimeoutId=0)},r))})}_authorize(){return N(this,void 0,void 0,function*(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);const r="auth.anonymLogin",t={session_data:{version:2,device_id:this.uuid,client_version:on.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=mr(this.params.apiTransport.sendRequest(r,t).then(n=>{var o;return(!n||!n.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:E.EXTERNAL_API,message:"No session key",data:n}),this.sessionKey=(o=n==null?void 0:n.session_key)!==null&&o!==void 0?o:void 0,this.sessionKey}).catch(n=>N(this,void 0,void 0,function*(){this.sessionKey=void 0;const o=n==null?void 0:n.error_code;switch(o){case k.AUTH_LOGIN:return this.authToken=yield this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:E.EXTERNAL_API,message:"authorize error",data:n}):this.params.error$.next({id:"AuthorizeUnknown",category:E.NETWORK,message:"authorize error",thrown:n})})),()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise})}}class an{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(r,t,n){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:t,options:n})}removeEventListener(r,t){if(!(r in this.listeners))return;const n=this.listeners[r];for(let o=0,a=n.length;o<a;o++)if(n[o].callback===t){n.splice(o,1);return}}dispatchEvent(r){if(!(r.type in this.listeners))return;const n=this.listeners[r.type].slice();for(let o=0,a=n.length;o<a;o++){const i=n[o];try{i.callback.call(this,r)}catch(v){Promise.resolve().then(()=>{throw v})}i.options&&i.options.once&&this.removeEventListener(r.type,i.callback)}return!r.defaultPrevented}}class mo extends an{constructor(){super(),this.listeners||an.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(r){r.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,r)),super.dispatchEvent(r)}}class iv{constructor(){Object.defineProperty(this,"signal",{value:new mo,writable:!0,configurable:!0})}abort(r){let t;try{t=new Event("abort")}catch(o){typeof document!="undefined"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}let n=r;if(n===void 0)if(typeof document=="undefined")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch(o){n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(t)}toString(){return"[object AbortController]"}}typeof Symbol!="undefined"&&Symbol.toStringTag&&(iv.prototype[Symbol.toStringTag]="AbortController",mo.prototype[Symbol.toStringTag]="AbortSignal");function Eo(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function sv(e){typeof e=="function"&&(e={fetch:e});const{fetch:r,Request:t=r.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=e;if(!Eo({fetch:r,Request:t,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o}))return{fetch:r,Request:a};let a=t;(a&&!a.prototype.hasOwnProperty("signal")||o)&&(a=function(s,c){let l;c&&c.signal&&(l=c.signal,delete c.signal);const h=new t(s,c);return l&&Object.defineProperty(h,"signal",{writable:!1,enumerable:!1,configurable:!0,value:l}),h},a.prototype=t.prototype);const i=r;return{fetch:(u,s)=>{const c=a&&a.prototype.isPrototypeOf(u)?u.signal:s?s.signal:void 0;if(c){let l;try{l=new DOMException("Aborted","AbortError")}catch(f){l=new Error("Aborted"),l.name="AbortError"}if(c.aborted)return Promise.reject(l);const h=new Promise((f,m)=>{c.addEventListener("abort",()=>m(l),{once:!0})});return s&&s.signal&&delete s.signal,Promise.race([h,i(u,s)])}return i(u,s)},Request:a}}const Yr=Eo({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),So=Yr?sv({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,sn=Yr?So.fetch:window.fetch;Yr?So.Request:window.Request;class cv{constructor(r){this.params=r,this.apiKey=r.apiKey,this.apiEnv=r.apiEnv,this.apiBaseUrl=r.apiBaseUrl,this.timeSynchronisation=r.timeSynchronisation,this.isApiBaseUrlFetched=!1}resolveApiBaseUrl(){var r;return N(this,void 0,void 0,function*(){if(this.apiEnv!==C.AUTO||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{const t=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=yield(yield sn(t,{method:"GET",mode:"cors",cache:"no-cache"})).json(),a=(r=o==null?void 0:o.Answer[0])===null||r===void 0?void 0:r.data;if(!a)throw new Error("Wrong DNS response");return a}catch(t){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:E.NETWORK,message:"Unhandled resolve api base url error",thrown:t}),bo[C.VK_ALIAS]}finally{this.isApiBaseUrlFetched=!0}})}sendBeacon(r,t,n){if(!window.Blob||!window.navigator.sendBeacon)return!1;const o=this._prepareQueryParams({method:r,queryParams:t,sessionKey:n}),a=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,a)}catch(i){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:E.NETWORK,message:"Unhandled beacon error",thrown:i,data:{method:r,params:t}})}return!1}sendRequest(r,t,n){return N(this,void 0,void 0,function*(){const o=ie(),a=i=>{if(i instanceof TypeError&&["Failed to fetch","NetworkError when attempting to fetch resource."].includes(i.message)){this.params.error$.next({id:"Network",category:E.NETWORK,message:"Request failed",thrown:i});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:E.NETWORK,message:"Unhandled request error",thrown:i,data:{method:r,params:t,sessionKey:n,time:ie()-o}})};return this.apiBaseUrl=yield this.resolveApiBaseUrl(),sn(`${this.apiBaseUrl}/fb.do`,{method:"post",headers:{"Content-type":"application/x-www-form-urlencoded"},body:this._prepareQueryParams({method:r,queryParams:t,sessionKey:n})}).then(i=>{var v;const u=Number(i.headers.get("content-length"))===0,s=new Date((v=i.headers.get("date"))!==null&&v!==void 0?v:"").getTime(),c=ie()-o;if(isFinite(s)&&this.timeSynchronisation.addServerTime(s,c),!u)return i.json().then(l=>Object.prototype.hasOwnProperty.call(l,"error_msg")?Promise.reject(l):l,a)},a)})}_prepareQueryParams(r){const t=new URLSearchParams({format:"JSON",method:r.method,application_key:this.apiKey});return r.sessionKey!==void 0&&t.append("session_key",r.sessionKey),Object.entries(r.queryParams).forEach(([n,o])=>t.append(n,typeof o=="string"?o:JSON.stringify(o))),t}}const To=3e3,uv=To*5;class lv{constructor(r){this.requestQueue=[],this.isPaused=!1,this.debouncedFlush=Ao(()=>{var t;try{this.flush()}catch(n){this.error$.next({id:"LoggerError",category:E.WTF,message:(t=String(n))!==null&&t!==void 0?t:"Unknown logger error",thrown:n})}},To,{maxWait:uv}),this.api=r.api,this.error$=r.error$,this.subscription=this.api.authorized$.subscribe(t=>{t&&this.debouncedFlush()})}log(r){this.requestQueue.push(r),this.isPaused||this.debouncedFlush()}flush(r=!1){this.requestQueue.length!==0&&(this.api.authorized$.getValue()?(r?this.api.logBeacon(this.requestQueue):this.api.logRequest(this.requestQueue),this.requestQueue=[]):this.api.authorize(),this.debouncedFlush.cancel())}pause(){this.isPaused=!0,this.debouncedFlush.cancel()}resume(){this.isPaused=!1,this.debouncedFlush()}destroy(){this.subscription.unsubscribe()}}class vv{constructor(r){this.offset=void 0,this.offset=r}getOffset(){var r;return(r=this.offset)!==null&&r!==void 0?r:0}setOffset(r){this.offset=r}now(){var r;return Date.now()+((r=this.offset)!==null&&r!==void 0?r:0)}date(r=new Date){var t;return r.setTime(r.getTime()+((t=this.offset)!==null&&t!==void 0?t:0)),r}addServerTime(r,t){const n=Date.now(),o=r-n-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)}}const cn=()=>Math.floor(Math.random()*Math.pow(2,32)).toString(36).padStart(8,"0"),fv=e=>e&&{[T.INVARIANT]:b.UNKNOWN,[T.Q_144P]:b.Q144P,[T.Q_240P]:b.Q240P,[T.Q_360P]:b.Q360P,[T.Q_480P]:b.Q480P,[T.Q_720P]:b.Q720P,[T.Q_1080P]:b.Q1080P,[T.Q_1440P]:b.Q1440P,[T.Q_2160P]:b.Q2160P,[T.Q_4320P]:b.Q4320P}[e],hv=e=>e&&{[ze.HTTP1]:ue.HTTP1,[ze.HTTP2]:ue.HTTP2,[ze.QUIC]:ue.HTTP3}[e],dv=e=>{if(e!==void 0)switch(e){case y.MPEG:return _.MP4;case y.DASH:case y.DASH_LIVE:case y.DASH_LIVE_CMAF:return _.DASH;case y.DASH_SEP:return _.DASH_SEP;case y.DASH_ONDEMAND:return _.ONDEMAND_DASH;case y.DASH_WEBM:case y.DASH_LIVE_WEBM:return _.WEBM;case y.HLS:case y.HLS_LIVE:case y.HLS_LIVE_CMAF:return _.HLS;case y.HLS_ONDEMAND:return _.ONDEMAND_HLS;case y.WEB_RTC_LIVE:return _.RTMP;default:return Po(e)}};class $v{constructor(r,t){var n;this.subscription=new Jr,this.timeSynchronisation=new vv,this.vsid=cn(),this.fieldBlacklist=[],this.statContext=r,this.config=Object.assign(Object.assign({},(n=t.config)!==null&&n!==void 0?n:{}),{requestRetryCount:1});const o=new Io;this.experimental={error$:o};const a=new cv({apiKey:nv,apiBaseUrl:bo[t.apiEnv],apiEnv:t.apiEnv,error$:o,timeSynchronisation:this.timeSynchronisation});this.api=new av({apiTransport:a,refreshAuthToken:t.refreshAuthToken,requestRetryCount:this.config.requestRetryCount,error$:o}),this.logger=new lv({api:this.api,error$:o}),this.subscription.add(wo(window,"beforeunload").subscribe(()=>this.logger.flush(!0)))}updateContext(r){this.statContext=Object.assign(Object.assign({},this.statContext),r)}attachTo(r){let t;return new Jr().add(r.events.started$.subscribe(()=>{this.logStarted({position:r.info.position$.getValue()})})).add(r.events.looped$.subscribe(()=>{this.resetViewSession(),this.logStarted({position:r.info.position$.getValue()})})).add(r.events.seeked$.subscribe(()=>{this.logSeek()})).add(r.events.willPause$.subscribe(()=>{this.logPause({position:r.info.position$.getValue()})})).add(r.events.willResume$.subscribe(()=>{this.logPlay()})).add(r.events.managedError$.subscribe(({id:n})=>{this.logError({errorType:n})})).add(r.events.fatalError$.subscribe(({id:n})=>{this.logError({errorType:n})})).add(r.events.inited$.subscribe(()=>{this.logInited()})).add(r.events.canplay$.subscribe(n=>{this.logReady({time:n})})).add(r.events.firstBytes$.subscribe(n=>{this.logFirstBytes({time:n})})).add(r.events.firstFrame$.subscribe(n=>{this.logFirstFrame({time:n})})).add(r.events.watchCoverageRecord$.subscribe(n=>{this.logWatchCoverageRecord(n)})).add(r.events.watchCoverageLive$.subscribe(n=>{this.logWatchCoverageLive(n)})).add(r.info.isStalled$.subscribe(n=>{n?t=ie():(Xr(t)&&this.logEmptyBuffer({duration:ie()-t}),t=void 0)})).add(r.events.ended$.subscribe(()=>{const n=r.info.throughputEstimation$.getValue();Xr(n)&&this.logDownloadSpeed({speed:n/8})})).add(r.info.hostname$.subscribe(n=>{this.updateContext({cdnHostname:n})})).add(r.info.httpConnectionType$.subscribe(n=>{this.updateContext({connectionType:hv(n)})})).add(r.info.httpConnectionReused$.subscribe(n=>{this.updateContext({connectionReused:n})})).add(r.info.currentQuality$.subscribe(n=>{this.updateContext({quality:fv(n)})})).add(r.info.currentFormat$.subscribe(n=>{this.updateContext({contentType:dv(n)})})).add(r.info.chromecastState$.subscribe(n=>{this.updateContext({destination:n===Ro.CONNECTED?Le.CHROMECAST:Le.SCREEN})}))}authorize(r){return this.api.authorize(r)}pause(){this.logger.pause()}resume(){this.logger.resume()}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.vsid=cn()}setFieldBlacklist(r=[]){this.fieldBlacklist=r}logInited(){this.log({operation:"init"})}logReady(r){this.log({operation:"player_ready",param:String(r.time)})}logStarted(r){this.log({operation:"play",param:String(Math.round(r.position))})}logPlay(){this.log({operation:"play_toggle"})}logPause(r){this.log({operation:"pause",param:String(Math.round(r.position))})}logSeek(){this.log({operation:"seek"})}logFirstBytes(r){this.log({operation:"first_bytes",param:String(r.time)})}logFirstFrame(r){this.log({operation:"first_frame",param:String(r.time)})}logError(r){this.log({operation:"error",param:r.errorType})}logWatchCoverageRecord(r){this.log({operation:"watch_coverage_record",param:`${r.start}-${r.end}`}),this.logger.flush(!0)}logWatchCoverageLive(r){const t=r.start+this.timeSynchronisation.getOffset(),n=r.end+this.timeSynchronisation.getOffset();this.log({operation:"watch_coverage_live",param:`${t}-${n}`}),this.logger.flush(!0)}logEmptyBuffer(r){this.log({operation:"empty_buffer",param:String(r.duration)})}logDownloadSpeed(r){this.log({operation:"download_speed",param:String(r.speed)})}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(r){this.log({operation:"adv",param:r})}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"})}log(r){const t=this.createLogItem(r);this.logger.log(t)}createLogItem({operation:r,param:t}){const n=this.timeSynchronisation.now(),o={vsid:this.vsid,vid:this.statContext.movieId,quality:this.statContext.quality,dst:this.statContext.destination,ct:this.statContext.contentType,aid:this.statContext.albumId,place:this.statContext.place,cdn_host:this.statContext.cdnHostname,connection_type:this.statContext.connectionType,connection_reused:this.statContext.connectionReused===!0?Ue.YES:this.statContext.connectionReused===!1?Ue.NO:void 0,stat_type:this.statContext.autoplay===!0?Me.AUTO:this.statContext.autoplay===!1?Me.MANUAL:void 0,vk_playlist_id:this.statContext.vkPlaylistId,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode};t!==void 0&&(o.param=t);for(const a of this.fieldBlacklist)delete o[a];return{operation:r,timestamp:n,custom:o}}}export{C as ApiEnv,ue as ConnectionType,_ as ContentType,$v as OneStat,b as Quality,Le as ScreenDestination};
|
|
6
|
+
import{ValueSubject as Gt,safeStorage as Z,getExponentialDelay as Mo,ErrorCategory as T,now as E,assertNever as _n,Observable as Fo,Subscription as ve,merge as Ne,fromEvent as At,filterChanged as Bo,map as Vo,filter as cr,isNullable as Ct,Subject as Ho,once as Ko,combine as ur,observableFrom as Wo,isNonNullable as ue}from"@vkontakte/videoplayer-shared/es2015.esm.js";import lr from"lodash/debounce.js";import{Surface as le,VideoQuality as O,HttpConnectionType as tt,VideoFormat as y,PlaybackState as fr}from"@vkontakte/videoplayer-core/es2015.esm.js";function L(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function f(a){try{c(n.next(a))}catch(u){s(u)}}function l(a){try{c(n.throw(a))}catch(u){s(u)}}function c(a){a.done?i(a.value):o(a.value).then(f,l)}c((n=n.apply(e,t||[])).next())})}var vr=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},Se=function(e){return e&&e.Math==Math&&e},g=Se(typeof globalThis=="object"&&globalThis)||Se(typeof window=="object"&&window)||Se(typeof self=="object"&&self)||Se(typeof vr=="object"&&vr)||function(){return this}()||Function("return this")(),w=function(e){try{return!!e()}catch(t){return!0}},Go=w,We=!Go(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),qo=We,On=Function.prototype,dr=On.apply,hr=On.call,Pn=typeof Reflect=="object"&&Reflect.apply||(qo?hr.bind(dr):function(){return hr.apply(dr,arguments)}),wn=We,In=Function.prototype,Nt=In.call,zo=wn&&In.bind.bind(Nt,Nt),I=wn?zo:function(e){return function(){return Nt.apply(e,arguments)}},Rn=I,Qo=Rn({}.toString),Yo=Rn("".slice),Ge=function(e){return Yo(Qo(e),8,-1)},Jo=Ge,Xo=I,An=function(e){if(Jo(e)==="Function")return Xo(e)},Dt=typeof document=="object"&&document.all,Zo=typeof Dt=="undefined"&&Dt!==void 0,Cn={all:Dt,IS_HTMLDDA:Zo},Nn=Cn,ea=Nn.all,h=Nn.IS_HTMLDDA?function(e){return typeof e=="function"||e===ea}:function(e){return typeof e=="function"},qt={},ta=w,ae=!ta(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),ra=We,Ee=Function.prototype.call,R=ra?Ee.bind(Ee):function(){return Ee.apply(Ee,arguments)},Dn={},Ln={}.propertyIsEnumerable,jn=Object.getOwnPropertyDescriptor,na=jn&&!Ln.call({1:2},1);Dn.f=na?function(t){var r=jn(this,t);return!!r&&r.enumerable}:Ln;var xn=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},oa=I,aa=w,ia=Ge,rt=Object,sa=oa("".split),ca=aa(function(){return!rt("z").propertyIsEnumerable(0)})?function(e){return ia(e)=="String"?sa(e,""):rt(e)}:rt,qe=function(e){return e==null},ua=qe,la=TypeError,Un=function(e){if(ua(e))throw la("Can't call method on "+e);return e},fa=ca,va=Un,da=function(e){return fa(va(e))},pr=h,kn=Cn,ha=kn.all,H=kn.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:pr(e)||e===ha}:function(e){return typeof e=="object"?e!==null:pr(e)},Mn={},nt=Mn,ot=g,pa=h,gr=function(e){return pa(e)?e:void 0},x=function(e,t){return arguments.length<2?gr(nt[e])||gr(ot[e]):nt[e]&&nt[e][t]||ot[e]&&ot[e][t]},ga=I,zt=ga({}.isPrototypeOf),ze=typeof navigator!="undefined"&&String(navigator.userAgent)||"",Fn=g,at=ze,yr=Fn.process,br=Fn.Deno,$r=yr&&yr.versions||br&&br.version,mr=$r&&$r.v8,_,xe;mr&&(_=mr.split("."),xe=_[0]>0&&_[0]<4?1:+(_[0]+_[1]));!xe&&at&&(_=at.match(/Edge\/(\d+)/),(!_||_[1]>=74)&&(_=at.match(/Chrome\/(\d+)/),_&&(xe=+_[1])));var Bn=xe,Sr=Bn,ya=w,Vn=!!Object.getOwnPropertySymbols&&!ya(function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Sr&&Sr<41}),ba=Vn,Hn=ba&&!Symbol.sham&&typeof Symbol.iterator=="symbol",$a=x,ma=h,Sa=zt,Ea=Hn,Ta=Object,Kn=Ea?function(e){return typeof e=="symbol"}:function(e){var t=$a("Symbol");return ma(t)&&Sa(t.prototype,Ta(e))},_a=String,Qe=function(e){try{return _a(e)}catch(t){return"Object"}},Oa=h,Pa=Qe,wa=TypeError,K=function(e){if(Oa(e))return e;throw wa(Pa(e)+" is not a function")},Ia=K,Ra=qe,Qt=function(e,t){var r=e[t];return Ra(r)?void 0:Ia(r)},it=R,st=h,ct=H,Aa=TypeError,Ca=function(e,t){var r,n;if(t==="string"&&st(r=e.toString)&&!ct(n=it(r,e))||st(r=e.valueOf)&&!ct(n=it(r,e))||t!=="string"&&st(r=e.toString)&&!ct(n=it(r,e)))return n;throw Aa("Can't convert object to primitive value")},Ue={},Na={get exports(){return Ue},set exports(e){Ue=e}},be=!0,Er=g,Da=Object.defineProperty,La=function(e,t){try{Da(Er,e,{value:t,configurable:!0,writable:!0})}catch(r){Er[e]=t}return t},ja=g,xa=La,Tr="__core-js_shared__",Ua=ja[Tr]||xa(Tr,{}),Yt=Ua,_r=Yt;(Na.exports=function(e,t){return _r[e]||(_r[e]=t!==void 0?t:{})})("versions",[]).push({version:"3.27.2",mode:"pure",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.27.2/LICENSE",source:"https://github.com/zloirock/core-js"});var ka=Un,Ma=Object,Fa=function(e){return Ma(ka(e))},Ba=I,Va=Fa,Ha=Ba({}.hasOwnProperty),ie=Object.hasOwn||function(t,r){return Ha(Va(t),r)},Ka=I,Wa=0,Ga=Math.random(),qa=Ka(1 .toString),Wn=function(e){return"Symbol("+(e===void 0?"":e)+")_"+qa(++Wa+Ga,36)},za=g,Qa=Ue,Or=ie,Ya=Wn,Ja=Vn,Xa=Hn,ee=za.Symbol,ut=Qa("wks"),Za=Xa?ee.for||ee:ee&&ee.withoutSetter||Ya,A=function(e){return Or(ut,e)||(ut[e]=Ja&&Or(ee,e)?ee[e]:Za("Symbol."+e)),ut[e]},ei=R,Pr=H,wr=Kn,ti=Qt,ri=Ca,ni=A,oi=TypeError,ai=ni("toPrimitive"),ii=function(e,t){if(!Pr(e)||wr(e))return e;var r=ti(e,ai),n;if(r){if(t===void 0&&(t="default"),n=ei(r,e,t),!Pr(n)||wr(n))return n;throw oi("Can't convert object to primitive value")}return t===void 0&&(t="number"),ri(e,t)},si=ii,ci=Kn,Gn=function(e){var t=si(e,"string");return ci(t)?t:t+""},ui=g,Ir=H,Lt=ui.document,li=Ir(Lt)&&Ir(Lt.createElement),qn=function(e){return li?Lt.createElement(e):{}},fi=ae,vi=w,di=qn,zn=!fi&&!vi(function(){return Object.defineProperty(di("div"),"a",{get:function(){return 7}}).a!=7}),hi=ae,pi=R,gi=Dn,yi=xn,bi=da,$i=Gn,mi=ie,Si=zn,Rr=Object.getOwnPropertyDescriptor;qt.f=hi?Rr:function(t,r){if(t=bi(t),r=$i(r),Si)try{return Rr(t,r)}catch(n){}if(mi(t,r))return yi(!pi(gi.f,t,r),t[r])};var Ei=w,Ti=h,_i=/#|\.prototype\./,$e=function(e,t){var r=Pi[Oi(e)];return r==Ii?!0:r==wi?!1:Ti(t)?Ei(t):!!t},Oi=$e.normalize=function(e){return String(e).replace(_i,".").toLowerCase()},Pi=$e.data={},wi=$e.NATIVE="N",Ii=$e.POLYFILL="P",Qn=$e,Ar=An,Ri=K,Ai=We,Ci=Ar(Ar.bind),Ye=function(e,t){return Ri(e),t===void 0?e:Ai?Ci(e,t):function(){return e.apply(t,arguments)}},Je={},Ni=ae,Di=w,Li=Ni&&Di(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),ji=H,xi=String,Ui=TypeError,W=function(e){if(ji(e))return e;throw Ui(xi(e)+" is not an object")},ki=ae,Mi=zn,Fi=Li,Te=W,Cr=Gn,Bi=TypeError,lt=Object.defineProperty,Vi=Object.getOwnPropertyDescriptor,ft="enumerable",vt="configurable",dt="writable";Je.f=ki?Fi?function(t,r,n){if(Te(t),r=Cr(r),Te(n),typeof t=="function"&&r==="prototype"&&"value"in n&&dt in n&&!n[dt]){var o=Vi(t,r);o&&o[dt]&&(t[r]=n.value,n={configurable:vt in n?n[vt]:o[vt],enumerable:ft in n?n[ft]:o[ft],writable:!1})}return lt(t,r,n)}:lt:function(t,r,n){if(Te(t),r=Cr(r),Te(n),Mi)try{return lt(t,r,n)}catch(o){}if("get"in n||"set"in n)throw Bi("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var Hi=ae,Ki=Je,Wi=xn,Xe=Hi?function(e,t,r){return Ki.f(e,t,Wi(1,r))}:function(e,t,r){return e[t]=r,e},_e=g,Gi=Pn,qi=An,zi=h,Qi=qt.f,Yi=Qn,z=Mn,Ji=Ye,Q=Xe,Nr=ie,Xi=function(e){var t=function(r,n,o){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,o)}return Gi(e,this,arguments)};return t.prototype=e.prototype,t},G=function(e,t){var r=e.target,n=e.global,o=e.stat,i=e.proto,s=n?_e:o?_e[r]:(_e[r]||{}).prototype,f=n?z:z[r]||Q(z,r,{})[r],l=f.prototype,c,a,u,v,d,p,U,C,q;for(v in t)c=Yi(n?v:r+(o?".":"#")+v,e.forced),a=!c&&s&&Nr(s,v),p=f[v],a&&(e.dontCallGetSet?(q=Qi(s,v),U=q&&q.value):U=s[v]),d=a&&U?U:t[v],!(a&&typeof p==typeof d)&&(e.bind&&a?C=Ji(d,_e):e.wrap&&a?C=Xi(d):i&&zi(d)?C=qi(d):C=d,(e.sham||d&&d.sham||p&&p.sham)&&Q(C,"sham",!0),Q(f,v,C),i&&(u=r+"Prototype",Nr(z,u)||Q(z,u,{}),Q(z[u],v,d),e.real&&l&&(c||!l[v])&&Q(l,v,d)))},Zi=Ge,Ze=typeof process!="undefined"&&Zi(process)=="process",es=Xe,Jt=function(e,t,r,n){return n&&n.enumerable?e[t]=r:es(e,t,r),e},ts=h,rs=String,ns=TypeError,os=function(e){if(typeof e=="object"||ts(e))return e;throw ns("Can't set "+rs(e)+" as a prototype")},as=I,is=W,ss=os,cs=Object.setPrototypeOf||("__proto__"in{}?function(){var e=!1,t={},r;try{r=as(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),r(t,[]),e=t instanceof Array}catch(n){}return function(o,i){return is(o),ss(i),e?r(o,i):o.__proto__=i,o}}():void 0),us=A,ls=us("toStringTag"),Yn={};Yn[ls]="z";var Xt=String(Yn)==="[object z]",fs=Xt,vs=h,De=Ge,ds=A,hs=ds("toStringTag"),ps=Object,gs=De(function(){return arguments}())=="Arguments",ys=function(e,t){try{return e[t]}catch(r){}},Zt=fs?De:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=ys(t=ps(e),hs))=="string"?r:gs?De(t):(n=De(t))=="Object"&&vs(t.callee)?"Arguments":n},bs=Xt,$s=Zt,ms=bs?{}.toString:function(){return"[object "+$s(this)+"]"},Ss=Xt,Es=Je.f,Ts=Xe,_s=ie,Os=ms,Ps=A,Dr=Ps("toStringTag"),ws=function(e,t,r,n){if(e){var o=r?e:e.prototype;_s(o,Dr)||Es(o,Dr,{configurable:!0,value:t}),n&&!Ss&&Ts(o,"toString",Os)}},Is=x,Rs=Je,As=A,Cs=ae,Lr=As("species"),Ns=function(e){var t=Is(e),r=Rs.f;Cs&&t&&!t[Lr]&&r(t,Lr,{configurable:!0,get:function(){return this}})},Ds=zt,Ls=TypeError,js=function(e,t){if(Ds(t,e))return e;throw Ls("Incorrect invocation")},xs=I,Us=h,jt=Yt,ks=xs(Function.toString);Us(jt.inspectSource)||(jt.inspectSource=function(e){return ks(e)});var Jn=jt.inspectSource,Ms=I,Fs=w,Xn=h,Bs=Zt,Vs=x,Hs=Jn,Zn=function(){},Ks=[],eo=Vs("Reflect","construct"),er=/^\s*(?:class|function)\b/,Ws=Ms(er.exec),Gs=!er.exec(Zn),fe=function(t){if(!Xn(t))return!1;try{return eo(Zn,Ks,t),!0}catch(r){return!1}},to=function(t){if(!Xn(t))return!1;switch(Bs(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Gs||!!Ws(er,Hs(t))}catch(r){return!0}};to.sham=!0;var qs=!eo||Fs(function(){var e;return fe(fe.call)||!fe(Object)||!fe(function(){e=!0})||e})?to:fe,zs=qs,Qs=Qe,Ys=TypeError,Js=function(e){if(zs(e))return e;throw Ys(Qs(e)+" is not a constructor")},jr=W,Xs=Js,Zs=qe,ec=A,tc=ec("species"),ro=function(e,t){var r=jr(e).constructor,n;return r===void 0||Zs(n=jr(r)[tc])?t:Xs(n)},rc=x,nc=rc("document","documentElement"),oc=I,ac=oc([].slice),ic=TypeError,sc=function(e,t){if(e<t)throw ic("Not enough arguments");return e},cc=ze,no=/(?:ipad|iphone|ipod).*applewebkit/i.test(cc),b=g,uc=Pn,lc=Ye,xr=h,fc=ie,oo=w,Ur=nc,vc=ac,kr=qn,dc=sc,hc=no,pc=Ze,xt=b.setImmediate,Ut=b.clearImmediate,gc=b.process,ht=b.Dispatch,yc=b.Function,Mr=b.MessageChannel,bc=b.String,pt=0,de={},Fr="onreadystatechange",ge,k,gt,yt;oo(function(){ge=b.location});var tr=function(e){if(fc(de,e)){var t=de[e];delete de[e],t()}},bt=function(e){return function(){tr(e)}},Br=function(e){tr(e.data)},Vr=function(e){b.postMessage(bc(e),ge.protocol+"//"+ge.host)};(!xt||!Ut)&&(xt=function(t){dc(arguments.length,1);var r=xr(t)?t:yc(t),n=vc(arguments,1);return de[++pt]=function(){uc(r,void 0,n)},k(pt),pt},Ut=function(t){delete de[t]},pc?k=function(e){gc.nextTick(bt(e))}:ht&&ht.now?k=function(e){ht.now(bt(e))}:Mr&&!hc?(gt=new Mr,yt=gt.port2,gt.port1.onmessage=Br,k=lc(yt.postMessage,yt)):b.addEventListener&&xr(b.postMessage)&&!b.importScripts&&ge&&ge.protocol!=="file:"&&!oo(Vr)?(k=Vr,b.addEventListener("message",Br,!1)):Fr in kr("script")?k=function(e){Ur.appendChild(kr("script"))[Fr]=function(){Ur.removeChild(this),tr(e)}}:k=function(e){setTimeout(bt(e),0)});var ao={set:xt,clear:Ut},io=function(){this.head=null,this.tail=null};io.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e){var t=this.head=e.next;return t===null&&(this.tail=null),e.item}}};var so=io,$c=ze,mc=/ipad|iphone|ipod/i.test($c)&&typeof Pebble!="undefined",Sc=ze,Ec=/web0s(?!.*chrome)/i.test(Sc),V=g,Hr=Ye,Tc=qt.f,$t=ao.set,_c=so,Oc=no,Pc=mc,wc=Ec,mt=Ze,Kr=V.MutationObserver||V.WebKitMutationObserver,Wr=V.document,Gr=V.process,Oe=V.Promise,qr=Tc(V,"queueMicrotask"),kt=qr&&qr.value,Y,St,Et,Pe,zr;if(!kt){var we=new _c,Ie=function(){var e,t;for(mt&&(e=Gr.domain)&&e.exit();t=we.get();)try{t()}catch(r){throw we.head&&Y(),r}e&&e.enter()};!Oc&&!mt&&!wc&&Kr&&Wr?(St=!0,Et=Wr.createTextNode(""),new Kr(Ie).observe(Et,{characterData:!0}),Y=function(){Et.data=St=!St}):!Pc&&Oe&&Oe.resolve?(Pe=Oe.resolve(void 0),Pe.constructor=Oe,zr=Hr(Pe.then,Pe),Y=function(){zr(Ie)}):mt?Y=function(){Gr.nextTick(Ie)}:($t=Hr($t,V),Y=function(){$t(Ie)}),kt=function(e){we.head||Y(),we.add(e)}}var Ic=kt,Rc=function(e,t){try{arguments.length==1?console.error(e):console.error(e,t)}catch(r){}},rr=function(e){try{return{error:!1,value:e()}}catch(t){return{error:!0,value:t}}},Ac=g,Cc=h,Qr=Ac.WeakMap,Nc=Cc(Qr)&&/native code/.test(String(Qr)),Dc=Ue,Lc=Wn,Yr=Dc("keys"),jc=function(e){return Yr[e]||(Yr[e]=Lc(e))},xc={},Uc=Nc,co=g,kc=H,Mc=Xe,Tt=ie,_t=Yt,Fc=jc,Bc=xc,Jr="Object already initialized",Mt=co.TypeError,Vc=co.WeakMap,ke,ye,Me,Hc=function(e){return Me(e)?ye(e):ke(e,{})},Kc=function(e){return function(t){var r;if(!kc(t)||(r=ye(t)).type!==e)throw Mt("Incompatible receiver, "+e+" required");return r}};if(Uc||_t.state){var P=_t.state||(_t.state=new Vc);P.get=P.get,P.has=P.has,P.set=P.set,ke=function(e,t){if(P.has(e))throw Mt(Jr);return t.facade=e,P.set(e,t),t},ye=function(e){return P.get(e)||{}},Me=function(e){return P.has(e)}}else{var J=Fc("state");Bc[J]=!0,ke=function(e,t){if(Tt(e,J))throw Mt(Jr);return t.facade=e,Mc(e,J,t),t},ye=function(e){return Tt(e,J)?e[J]:{}},Me=function(e){return Tt(e,J)}}var Wc={set:ke,get:ye,has:Me,enforce:Hc,getterFor:Kc},Gc=g,se=Gc.Promise,uo=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",qc=uo,zc=Ze,Qc=!qc&&!zc&&typeof window=="object"&&typeof document=="object",Yc=g,he=se,Jc=h,Xc=Qn,Zc=Jn,eu=A,tu=Qc,ru=uo,nu=be,Ot=Bn,Xr=he&&he.prototype,ou=eu("species"),Ft=!1,lo=Jc(Yc.PromiseRejectionEvent),au=Xc("Promise",function(){var e=Zc(he),t=e!==String(he);if(!t&&Ot===66||nu&&!(Xr.catch&&Xr.finally))return!0;if(!Ot||Ot<51||!/native code/.test(e)){var r=new he(function(i){i(1)}),n=function(i){i(function(){},function(){})},o=r.constructor={};if(o[ou]=n,Ft=r.then(function(){})instanceof n,!Ft)return!0}return!t&&(tu||ru)&&!lo}),me={CONSTRUCTOR:au,REJECTION_EVENT:lo,SUBCLASSING:Ft},ce={},Zr=K,iu=TypeError,su=function(e){var t,r;this.promise=new e(function(n,o){if(t!==void 0||r!==void 0)throw iu("Bad Promise constructor");t=n,r=o}),this.resolve=Zr(t),this.reject=Zr(r)};ce.f=function(e){return new su(e)};var cu=G,uu=be,Fe=Ze,j=g,oe=R,en=Jt,tn=cs,lu=ws,fu=Ns,vu=K,Le=h,du=H,hu=js,pu=ro,fo=ao.set,nr=Ic,gu=Rc,yu=rr,bu=so,vo=Wc,Be=se,or=me,ho=ce,et="Promise",po=or.CONSTRUCTOR,$u=or.REJECTION_EVENT,mu=or.SUBCLASSING,Pt=vo.getterFor(et),Su=vo.set,X=Be&&Be.prototype,M=Be,Re=X,go=j.TypeError,Bt=j.document,ar=j.process,Vt=ho.f,Eu=Vt,Tu=!!(Bt&&Bt.createEvent&&j.dispatchEvent),yo="unhandledrejection",_u="rejectionhandled",rn=0,bo=1,Ou=2,ir=1,$o=2,Ae,nn,Pu,on,mo=function(e){var t;return du(e)&&Le(t=e.then)?t:!1},So=function(e,t){var r=t.value,n=t.state==bo,o=n?e.ok:e.fail,i=e.resolve,s=e.reject,f=e.domain,l,c,a;try{o?(n||(t.rejection===$o&&Iu(t),t.rejection=ir),o===!0?l=r:(f&&f.enter(),l=o(r),f&&(f.exit(),a=!0)),l===e.promise?s(go("Promise-chain cycle")):(c=mo(l))?oe(c,l,i,s):i(l)):s(r)}catch(u){f&&!a&&f.exit(),s(u)}},Eo=function(e,t){e.notified||(e.notified=!0,nr(function(){for(var r=e.reactions,n;n=r.get();)So(n,e);e.notified=!1,t&&!e.rejection&&wu(e)}))},To=function(e,t,r){var n,o;Tu?(n=Bt.createEvent("Event"),n.promise=t,n.reason=r,n.initEvent(e,!1,!0),j.dispatchEvent(n)):n={promise:t,reason:r},!$u&&(o=j["on"+e])?o(n):e===yo&&gu("Unhandled promise rejection",r)},wu=function(e){oe(fo,j,function(){var t=e.facade,r=e.value,n=an(e),o;if(n&&(o=yu(function(){Fe?ar.emit("unhandledRejection",r,t):To(yo,t,r)}),e.rejection=Fe||an(e)?$o:ir,o.error))throw o.value})},an=function(e){return e.rejection!==ir&&!e.parent},Iu=function(e){oe(fo,j,function(){var t=e.facade;Fe?ar.emit("rejectionHandled",t):To(_u,t,e.value)})},te=function(e,t,r){return function(n){e(t,n,r)}},ne=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=Ou,Eo(e,!0))},Ht=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw go("Promise can't be resolved itself");var n=mo(t);n?nr(function(){var o={done:!1};try{oe(n,t,te(Ht,o,e),te(ne,o,e))}catch(i){ne(o,i,e)}}):(e.value=t,e.state=bo,Eo(e,!1))}catch(o){ne({done:!1},o,e)}}};if(po&&(M=function(t){hu(this,Re),vu(t),oe(Ae,this);var r=Pt(this);try{t(te(Ht,r),te(ne,r))}catch(n){ne(r,n)}},Re=M.prototype,Ae=function(t){Su(this,{type:et,done:!1,notified:!1,parent:!1,reactions:new bu,rejection:!1,state:rn,value:void 0})},Ae.prototype=en(Re,"then",function(t,r){var n=Pt(this),o=Vt(pu(this,M));return n.parent=!0,o.ok=Le(t)?t:!0,o.fail=Le(r)&&r,o.domain=Fe?ar.domain:void 0,n.state==rn?n.reactions.add(o):nr(function(){So(o,n)}),o.promise}),nn=function(){var e=new Ae,t=Pt(e);this.promise=e,this.resolve=te(Ht,t),this.reject=te(ne,t)},ho.f=Vt=function(e){return e===M||e===Pu?new nn(e):Eu(e)},!uu&&Le(Be)&&X!==Object.prototype)){on=X.then,mu||en(X,"then",function(t,r){var n=this;return new M(function(o,i){oe(on,n,o,i)}).then(t,r)},{unsafe:!0});try{delete X.constructor}catch(e){}tn&&tn(X,Re)}cu({global:!0,constructor:!0,wrap:!0,forced:po},{Promise:M});lu(M,et,!1,!0);fu(et);var _o={},Ru=A,Au=_o,Cu=Ru("iterator"),Nu=Array.prototype,Du=function(e){return e!==void 0&&(Au.Array===e||Nu[Cu]===e)},Lu=Math.ceil,ju=Math.floor,xu=Math.trunc||function(t){var r=+t;return(r>0?ju:Lu)(r)},Uu=xu,ku=function(e){var t=+e;return t!==t||t===0?0:Uu(t)},Mu=ku,Fu=Math.min,Bu=function(e){return e>0?Fu(Mu(e),9007199254740991):0},Vu=Bu,Hu=function(e){return Vu(e.length)},Ku=Zt,sn=Qt,Wu=qe,Gu=_o,qu=A,zu=qu("iterator"),Oo=function(e){if(!Wu(e))return sn(e,zu)||sn(e,"@@iterator")||Gu[Ku(e)]},Qu=R,Yu=K,Ju=W,Xu=Qe,Zu=Oo,el=TypeError,tl=function(e,t){var r=arguments.length<2?Zu(e):t;if(Yu(r))return Ju(Qu(r,e));throw el(Xu(e)+" is not iterable")},rl=R,cn=W,nl=Qt,ol=function(e,t,r){var n,o;cn(e);try{if(n=nl(e,"return"),!n){if(t==="throw")throw r;return r}n=rl(n,e)}catch(i){o=!0,n=i}if(t==="throw")throw r;if(o)throw n;return cn(n),r},al=Ye,il=R,sl=W,cl=Qe,ul=Du,ll=Hu,un=zt,fl=tl,vl=Oo,ln=ol,dl=TypeError,je=function(e,t){this.stopped=e,this.result=t},fn=je.prototype,Po=function(e,t,r){var n=r&&r.that,o=!!(r&&r.AS_ENTRIES),i=!!(r&&r.IS_RECORD),s=!!(r&&r.IS_ITERATOR),f=!!(r&&r.INTERRUPTED),l=al(t,n),c,a,u,v,d,p,U,C=function($){return c&&ln(c,"normal",$),new je(!0,$)},q=function($){return o?(sl($),f?l($[0],$[1],C):l($[0],$[1])):f?l($,C):l($)};if(i)c=e.iterator;else if(s)c=e;else{if(a=vl(e),!a)throw dl(cl(e)+" is not iterable");if(ul(a)){for(u=0,v=ll(e);v>u;u++)if(d=q(e[u]),d&&un(fn,d))return d;return new je(!1)}c=fl(e,a)}for(p=i?e.next:c.next;!(U=il(p,c)).done;){try{d=q(U.value)}catch($){ln(c,"throw",$)}if(typeof d=="object"&&d&&un(fn,d))return d}return new je(!1)},hl=A,wo=hl("iterator"),Io=!1;try{var pl=0,vn={next:function(){return{done:!!pl++}},return:function(){Io=!0}};vn[wo]=function(){return this},Array.from(vn,function(){throw 2})}catch(e){}var gl=function(e,t){if(!t&&!Io)return!1;var r=!1;try{var n={};n[wo]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(o){}return r},yl=se,bl=gl,$l=me.CONSTRUCTOR,Ro=$l||!bl(function(e){yl.all(e).then(void 0,function(){})}),ml=G,Sl=R,El=K,Tl=ce,_l=rr,Ol=Po,Pl=Ro;ml({target:"Promise",stat:!0,forced:Pl},{all:function(t){var r=this,n=Tl.f(r),o=n.resolve,i=n.reject,s=_l(function(){var f=El(r.resolve),l=[],c=0,a=1;Ol(t,function(u){var v=c++,d=!1;a++,Sl(f,r,u).then(function(p){d||(d=!0,l[v]=p,--a||o(l))},i)}),--a||o(l)});return s.error&&i(s.value),n.promise}});var wl=G,Il=be,Rl=me.CONSTRUCTOR,Kt=se,Al=x,Cl=h,Nl=Jt,dn=Kt&&Kt.prototype;wl({target:"Promise",proto:!0,forced:Rl,real:!0},{catch:function(e){return this.then(void 0,e)}});if(!Il&&Cl(Kt)){var hn=Al("Promise").prototype.catch;dn.catch!==hn&&Nl(dn,"catch",hn,{unsafe:!0})}var Dl=G,Ll=R,jl=K,xl=ce,Ul=rr,kl=Po,Ml=Ro;Dl({target:"Promise",stat:!0,forced:Ml},{race:function(t){var r=this,n=xl.f(r),o=n.reject,i=Ul(function(){var s=jl(r.resolve);kl(t,function(f){Ll(s,r,f).then(n.resolve,o)})});return i.error&&o(i.value),n.promise}});var Fl=G,Bl=R,Vl=ce,Hl=me.CONSTRUCTOR;Fl({target:"Promise",stat:!0,forced:Hl},{reject:function(t){var r=Vl.f(this);return Bl(r.reject,void 0,t),r.promise}});var Kl=W,Wl=H,Gl=ce,Ao=function(e,t){if(Kl(e),Wl(t)&&t.constructor===e)return t;var r=Gl.f(e),n=r.resolve;return n(t),r.promise},ql=G,zl=x,Co=be,Ql=se,No=me.CONSTRUCTOR,Yl=Ao,Jl=zl("Promise"),Xl=Co&&!No;ql({target:"Promise",stat:!0,forced:Co||No},{resolve:function(t){return Yl(Xl&&this===Jl?Ql:this,t)}});var Zl=G,ef=be,Ve=se,tf=w,Do=x,Lo=h,rf=ro,pn=Ao,nf=Jt,Wt=Ve&&Ve.prototype,of=!!Ve&&tf(function(){Wt.finally.call({then:function(){}},function(){})});Zl({target:"Promise",proto:!0,real:!0,forced:of},{finally:function(e){var t=rf(this,Do("Promise")),r=Lo(e);return this.then(r?function(n){return pn(t,e()).then(function(){return n})}:e,r?function(n){return pn(t,e()).then(function(){throw n})}:e)}});if(!ef&&Lo(Ve)){var gn=Do("Promise").prototype.finally;Wt.finally!==gn&&nf(Wt,"finally",gn,{unsafe:!0})}var af=x,sf=af,cf=sf,uf=cf("Promise","finally"),lf=uf,ff=lf,vf=ff,df=vf,wt=df;function hf(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),t=new Array(36);let r=0,n,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?t[o]="-":o===14?t[o]="4":(r<=2&&(r=33554432+Math.random()*16777216|0),n=r&15,r=r>>4,t[o]=e[o===19?n&3|8:n]);return t.join("")}var D;(function(e){e.PROD="prod",e.VK_ALIAS="vk_alias",e.VIDEOTEST="videotest",e.TEST="test",e.AUTO="auto"})(D||(D={}));var m;(function(e){e.Q144P="mobile",e.Q240P="lowest",e.Q360P="low",e.Q480P="medium",e.Q720P="high",e.Q1080P="fullhd",e.Q1440P="quadhd",e.Q2160P="ultrahd",e.UNKNOWN="unknown"})(m||(m={}));var S;(function(e){e.MP4="mp4",e.DASH="dash",e.DASH_SEP="dash_sep",e.ONDEMAND_DASH="ondemand_dash",e.HLS="hls",e.ONDEMAND_HLS="ondemand_hls",e.WEBM="webm",e.ONDEMAND_DASH_LIVE="ondemand_dash_live",e.ONDEMAND_HLS_LIVE="ondemand_hls_live",e.WEBRTC="webrtc",e.UNKNOWN="unknown",e.RTMP="rtmp"})(S||(S={}));var He;(function(e){e.AUTO="auto",e.MANUAL=""})(He||(He={}));var pe;(function(e){e.HTTP1="http1",e.HTTP2="http2",e.HTTP3="http3"})(pe||(pe={}));var N;(function(e){e[e.YES=1]="YES",e[e.NO=0]="NO"})(N||(N={}));var re;(function(e){e.EXCELLENT="excellent",e.GOOD="good",e.POOR="poor"})(re||(re={}));var B;(function(e){e.PIP="pip",e.FULLSCREEN="fullscreen",e.EXTERNAL="external",e.PREFETCH="prefetch"})(B||(B={}));var Ke;(function(e){e.SLIDER="slider",e.DOUBLE_TAP="double_tap",e.TIME_CODE="time_code",e.EPISODE="episode",e.REWIND="rewind",e.LIVE="live",e.UNKNOWN="unknown"})(Ke||(Ke={}));const yn="1.0.35-beta.0",pf="CIOPGQJGDIHBABABA",jo={[D.PROD]:"https://api.ok.ru",[D.VK_ALIAS]:"https://api.mycdn.me",[D.VIDEOTEST]:"https://videotestapi.ok.ru/api",[D.TEST]:"https://apitest.ok.ru",[D.AUTO]:""},gf="_one-stat_",bn=`${gf}uuid`,yf={start:1e3,factor:1.5,max:5*60*1e3,random:.1};var F;(function(e){e[e.PARAM_SESSION_EXPIRED=102]="PARAM_SESSION_EXPIRED",e[e.PARAM_SESSION_KEY=103]="PARAM_SESSION_KEY",e[e.PARAM_SIGNATURE=104]="PARAM_SIGNATURE",e[e.AUTH_LOGIN=401]="AUTH_LOGIN"})(F||(F={}));class bf{constructor(t){this.consequentAuthErrors=0,this.authorized$=new Gt(!1),this.params=t;const r=Z.get(bn);r?this.uuid=String(r):(this.uuid=hf(),Z.set(bn,this.uuid))}authorize(t){return L(this,void 0,void 0,function*(){return this.authToken=t!=null?t:yield this.refreshAuthToken(),this._authorizeWithBackoff()})}logBeacon(t){const r="log.externalLog",n=this.createLogParams(t),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(r,n,o)||this.logRequest(t)}logRequest(t){var r;return L(this,void 0,void 0,function*(){const n="log.externalLog",o=this.createLogParams(t),i=(r=this.sessionKey)!==null&&r!==void 0?r:yield this._authorizeWithBackoff();if(!i)return;const s=(f,l=this.params.requestRetryCount)=>L(this,void 0,void 0,function*(){try{return yield this.params.apiTransport.sendRequest(n,o,i)}catch(c){if(!c||!("error_code"in c)){this.params.error$.next({id:"logRequestUnknown",category:T.NETWORK,message:`Unknown ${n} error`,thrown:c});return}const a=c==null?void 0:c.error_code;switch(a){case F.PARAM_SESSION_EXPIRED:case F.PARAM_SESSION_KEY:case F.PARAM_SIGNATURE:return this.authorized$.next(!1),this.sessionKey=yield this._authorizeWithBackoff(),l>0?s(f,l-1):void 0;case F.AUTH_LOGIN:return this.authorized$.next(!1),this.authToken=yield this.refreshAuthToken(),this.sessionKey=yield this._authorizeWithBackoff(),l>0?s(f,l-1):void 0;default:{this.params.error$.next({id:`LogRequest#${a}`,category:T.EXTERNAL_API,message:`${n} error`,data:c});return}}}});return s(t)})}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}refreshAuthToken(){return L(this,void 0,void 0,function*(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=wt(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise})}createLogParams(t){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${yn}`,platform:this.params.mobile?"M_WEB":"WEB",items:t})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();const t=Mo(this.consequentAuthErrors,yf);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{wt(this._authorize().then(r).catch(n=>this.params.error$.next({id:"AuthorizeBackoff",category:T.NETWORK,message:"Otherwise unhandled error in authorization",thrown:n})),()=>this.backoffTimeoutId=0)},t))})}_authorize(){return L(this,void 0,void 0,function*(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);const t="auth.anonymLogin",r={session_data:{version:2,device_id:this.uuid,client_version:yn.split("-")[0],client_type:"SDK_JS"}};return this.authToken!==void 0&&(r.session_data.auth_token=this.authToken,r.session_data.version=3),this.authorizePromise=wt(this.params.apiTransport.sendRequest(t,r).then(n=>{var o;return(!n||!n.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:T.EXTERNAL_API,message:"No session key",data:n}),this.sessionKey=(o=n==null?void 0:n.session_key)!==null&&o!==void 0?o:void 0,this.sessionKey}).catch(n=>L(this,void 0,void 0,function*(){this.sessionKey=void 0;const o=n==null?void 0:n.error_code;switch(o){case F.AUTH_LOGIN:return this.authToken=yield this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:T.EXTERNAL_API,message:"authorize error",data:n}):this.params.error$.next({id:"AuthorizeUnknown",category:T.NETWORK,message:"authorize error",thrown:n})})),()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise})}}class $n{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(t,r,n){t in this.listeners||(this.listeners[t]=[]),this.listeners[t].push({callback:r,options:n})}removeEventListener(t,r){if(!(t in this.listeners))return;const n=this.listeners[t];for(let o=0,i=n.length;o<i;o++)if(n[o].callback===r){n.splice(o,1);return}}dispatchEvent(t){if(!(t.type in this.listeners))return;const n=this.listeners[t.type].slice();for(let o=0,i=n.length;o<i;o++){const s=n[o];try{s.callback.call(this,t)}catch(f){Promise.resolve().then(()=>{throw f})}s.options&&s.options.once&&this.removeEventListener(t.type,s.callback)}return!t.defaultPrevented}}class xo extends $n{constructor(){super(),this.listeners||$n.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(t){t.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,t)),super.dispatchEvent(t)}}class $f{constructor(){Object.defineProperty(this,"signal",{value:new xo,writable:!0,configurable:!0})}abort(t){let r;try{r=new Event("abort")}catch(o){typeof document!="undefined"?document.createEvent?(r=document.createEvent("Event"),r.initEvent("abort",!1,!1)):(r=document.createEventObject(),r.type="abort"):r={type:"abort",bubbles:!1,cancelable:!1}}let n=t;if(n===void 0)if(typeof document=="undefined")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch(o){n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(r)}toString(){return"[object AbortController]"}}typeof Symbol!="undefined"&&Symbol.toStringTag&&($f.prototype[Symbol.toStringTag]="AbortController",xo.prototype[Symbol.toStringTag]="AbortSignal");function Uo(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function mf(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:r=t.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=e;if(!Uo({fetch:t,Request:r,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o}))return{fetch:t,Request:i};let i=r;(i&&!i.prototype.hasOwnProperty("signal")||o)&&(i=function(c,a){let u;a&&a.signal&&(u=a.signal,delete a.signal);const v=new r(c,a);return u&&Object.defineProperty(v,"signal",{writable:!1,enumerable:!1,configurable:!0,value:u}),v},i.prototype=r.prototype);const s=t;return{fetch:(l,c)=>{const a=i&&i.prototype.isPrototypeOf(l)?l.signal:c?c.signal:void 0;if(a){let u;try{u=new DOMException("Aborted","AbortError")}catch(d){u=new Error("Aborted"),u.name="AbortError"}if(a.aborted)return Promise.reject(u);const v=new Promise((d,p)=>{a.addEventListener("abort",()=>p(u),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([v,s(l,c)])}return s(l,c)},Request:i}}const sr=Uo({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),ko=sr?mf({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,mn=sr?ko.fetch:window.fetch;sr?ko.Request:window.Request;class Sf{constructor(t){this.params=t,this.apiKey=t.apiKey,this.apiEnv=t.apiEnv,this.apiBaseUrl=t.apiBaseUrl,this.timeSynchronisation=t.timeSynchronisation,this.isApiBaseUrlFetched=!1}resolveApiBaseUrl(){var t;return L(this,void 0,void 0,function*(){if(this.apiEnv!==D.AUTO||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{const r=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=yield(yield mn(r,{method:"GET",mode:"cors",cache:"no-cache"})).json(),i=(t=o==null?void 0:o.Answer[0])===null||t===void 0?void 0:t.data;if(!i)throw new Error("Wrong DNS response");return i}catch(r){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:T.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),jo[D.VK_ALIAS]}finally{this.isApiBaseUrlFetched=!0}})}sendBeacon(t,r,n){if(!window.Blob||!window.navigator.sendBeacon)return!1;const o=this._prepareQueryParams({method:t,queryParams:r,sessionKey:n}),i=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,i)}catch(s){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:T.NETWORK,message:"Unhandled beacon error",thrown:s,data:{method:t,params:r}})}return!1}sendRequest(t,r,n){return L(this,void 0,void 0,function*(){const o=E(),i=s=>{if(s instanceof TypeError&&["Failed to fetch","NetworkError when attempting to fetch resource."].includes(s.message)){this.params.error$.next({id:"Network",category:T.NETWORK,message:"Request failed",thrown:s});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:T.NETWORK,message:"Unhandled request error",thrown:s,data:{method:t,params:r,sessionKey:n,time:E()-o}})};return this.apiBaseUrl=yield this.resolveApiBaseUrl(),mn(`${this.apiBaseUrl}/fb.do`,{method:"post",headers:{"Content-type":"application/x-www-form-urlencoded"},body:this._prepareQueryParams({method:t,queryParams:r,sessionKey:n})}).then(s=>{var f;const l=Number(s.headers.get("content-length"))===0,c=new Date((f=s.headers.get("date"))!==null&&f!==void 0?f:"").getTime(),a=E()-o;if(isFinite(c)&&this.timeSynchronisation.addServerTime(c,a),!l)return s.json().then(u=>Object.prototype.hasOwnProperty.call(u,"error_msg")?Promise.reject(u):u,i)},i)})}_prepareQueryParams(t){const r=new URLSearchParams({format:"JSON",method:t.method,application_key:this.apiKey});return t.sessionKey!==void 0&&r.append("session_key",t.sessionKey),Object.entries(t.queryParams).forEach(([n,o])=>r.append(n,typeof o=="string"?o:JSON.stringify(o))),r}}const Sn=5e3,Ef=1e4,Tf=6e4,Ce="onestat_events",_f=36*60*60*1e3,It=e=>e.timestamp+_f>=E();class Of{constructor(t){this.unsaltedStorage=[],this.isPaused=!1,this.isUrgent=r=>{const{operation:n,custom:{param:o}}=r;return["action_stop","close_at_empty_buffer"].includes(n)||n==="watch_coverage_record"&&o==="0-0"},this.firstFlush=lr(()=>this.safeFlush(),Sn,{maxWait:Sn}),this.debouncedFlush=lr(()=>this.safeFlush(),Ef,{maxWait:Tf}),this.api=t.api,this.error$=t.error$,this.userSalt=t.userSalt,this.subscription=this.api.authorized$.subscribe(r=>{r&&this.debouncedFlush()}),this.housekeepStorage()}safeFlush(){var t;try{this.flush()}catch(r){this.error$.next({id:"LoggerError",category:T.WTF,message:(t=String(r))!==null&&t!==void 0?t:"Unknown logger error",thrown:r})}}readFromStorage(){const t=Z.get(Ce);try{return t?JSON.parse(t):{}}catch(r){}return{}}addToStorage(t){var r;if(!this.userSalt){this.unsaltedStorage.push(t);return}const n=this.readFromStorage(),i=((r=n[this.userSalt])!==null&&r!==void 0?r:[]).filter(It);Z.set(Ce,JSON.stringify(Object.assign(Object.assign({},n),{[this.userSalt]:[...i,t]})))}getFromStorage(){var t;return this.userSalt?((t=this.readFromStorage()[this.userSalt])!==null&&t!==void 0?t:[]).filter(It):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}const t=this.readFromStorage();delete t[this.userSalt],Z.set(Ce,JSON.stringify(t))}housekeepStorage(){const t=this.readFromStorage();for(const[r,n]of Object.entries(t)){const o=n.filter(It);o.length?t[r]=o:delete t[r]}Z.set(Ce,JSON.stringify(t))}log(t){console.log(t.operation,t.custom.param,t),this.addToStorage(t),!this.isPaused&&(this.isUrgent(t)?this.flush():this.lastVsid!==t.custom.vsid?this.firstFlush():this.debouncedFlush(),this.lastVsid=t.custom.vsid)}flush(t=!1){const r=this.getFromStorage();r.length!==0&&(this.api.authorized$.getValue()?(console.log("flush",r.length,"events",r),t?this.api.logBeacon(r):this.api.logRequest(r),this.markStorageSent()):this.api.authorize(),this.firstFlush.cancel(),this.debouncedFlush.cancel())}pause(){this.isPaused=!0,this.debouncedFlush.cancel()}resume(){this.isPaused=!1,this.debouncedFlush()}destroy(){this.subscription.unsubscribe(),this.firstFlush.cancel(),this.debouncedFlush.cancel()}}const Pf=()=>{let e,t;try{e=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?e=!0:(e=!1,console.error(n))}try{window.location.ancestorOrigins&&(t=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!t&&document.referrer&&(t=document.referrer)}catch(n){console.error(n)}const r=t?new URL(t).hostname:void 0;return{isEmbed:e,host:r}},wf=e=>e&&{[O.INVARIANT]:m.UNKNOWN,[O.Q_144P]:m.Q144P,[O.Q_240P]:m.Q240P,[O.Q_360P]:m.Q360P,[O.Q_480P]:m.Q480P,[O.Q_720P]:m.Q720P,[O.Q_1080P]:m.Q1080P,[O.Q_1440P]:m.Q1440P,[O.Q_2160P]:m.Q2160P,[O.Q_4320P]:m.UNKNOWN}[e],En=e=>e&&{[tt.HTTP1]:pe.HTTP1,[tt.HTTP2]:pe.HTTP2,[tt.QUIC]:pe.HTTP3}[e],If=e=>{if(e!==void 0)switch(e){case y.MPEG:return S.MP4;case y.DASH:case y.DASH_LIVE:return S.DASH;case y.DASH_SEP:return S.DASH_SEP;case y.DASH_ONDEMAND:return S.ONDEMAND_DASH;case y.DASH_WEBM:case y.DASH_LIVE_WEBM:return S.WEBM;case y.DASH_LIVE_CMAF:return S.ONDEMAND_DASH_LIVE;case y.HLS:case y.HLS_LIVE:return S.HLS;case y.HLS_ONDEMAND:return S.ONDEMAND_HLS;case y.HLS_LIVE_CMAF:return S.ONDEMAND_HLS_LIVE;case y.WEB_RTC_LIVE:return S.WEBRTC;default:return _n(e)}},Rt=e=>{if(e!==void 0)switch(e){case le.NONE:case le.INLINE:return;case le.FULLSCREEN:return B.FULLSCREEN;case le.SECOND_SCREEN:return B.EXTERNAL;case le.PIP:return B.PIP;default:return _n(e)}},Rf=e=>{switch(e){case"slow-2g":return re.POOR;case"2g":return re.POOR;case"3g":return re.GOOD;case"4g":return re.EXCELLENT}};class Af{constructor(t){this.offset=void 0,this.offset=t}getOffset(){var t;return(t=this.offset)!==null&&t!==void 0?t:0}setOffset(t){this.offset=t}now(){var t;return Date.now()+((t=this.offset)!==null&&t!==void 0?t:0)}date(t=new Date){var r;return t.setTime(t.getTime()+((r=this.offset)!==null&&r!==void 0?r:0)),t}addServerTime(t,r){const n=Date.now(),o=t-n-r/2;if(Math.abs(o)<1e3){this.offset=0;return}this.offset===void 0?this.offset=Math.round(o):this.offset=Math.round(.2*o+(1-.2)*this.offset)}}const Tn=()=>Math.floor(Math.random()*Math.pow(2,32)).toString(36).padStart(8,"0"),Cf=e=>new Fo(t=>{const r=new ve,n=Ne(At(window,"beforeunload"),e.events.willDestruct$),o=new Gt(void 0);let i;e.info.isLive$.pipe(Bo()).subscribe(d=>{i&&(i.unsubscribe(),o.next(void 0)),d?i=e.info.liveTime$.pipe(Vo(p=>p&&p/1e3)).subscribe(o):i=e.info.position$.subscribe(o),r.add(i)});const{playing$:s,paused$:f}=e.events,l=e.events.willSeek$.pipe(cr(()=>e.info.playbackState$.getValue()===fr.PLAYING)),c=e.events.seeked$.pipe(cr(()=>e.info.playbackState$.getValue()===fr.PLAYING)),a=Ne(s,c),u=Ne(f,l,n,e.events.looped$);let v;return r.add(a.subscribe(()=>v=o.getValue())),r.add(u.subscribe(()=>{const d=o.getValue();Ct(v)||v===d||Ct(d)||(t.next({from:v,to:d}),v=void 0)})),r});class jf{constructor(t,r){var n,o;this.subscription=new ve,this.timeSynchronisation=new Af,this.vsid=Tn(),this.seekAction$=new Gt(Ke.UNKNOWN),this.statContext=t,this.config=Object.assign(Object.assign({},(n=r.config)!==null&&n!==void 0?n:{}),{requestRetryCount:1});const i=new Ho;this.experimental={error$:i};const s=new Sf({apiKey:pf,apiBaseUrl:jo[r.apiEnv],apiEnv:r.apiEnv,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new bf({apiTransport:s,refreshAuthToken:r.refreshAuthToken,requestRetryCount:this.config.requestRetryCount,mobile:(o=this.statContext.mobile)!==null&&o!==void 0?o:!1,error$:i}),this.logger=new Of({api:this.api,error$:i,userSalt:r.userSalt});const{isEmbed:f,host:l}=Pf();this.isEmbed=f,this.embedParent=l,this.subscribe()}updateContext(t){this.statContext=Object.assign(Object.assign({},this.statContext),t)}attachTo(t){const r=new ve,n=(a,u)=>r.add(a.subscribe(u));n(t.events.willStart$,()=>{this.logActionPlay({position:t.info.position$.getValue()})}),n(t.events.looped$,()=>{this.resetViewSession(),this.logActionPlay({position:t.info.position$.getValue()})}),n(t.events.seeked$,()=>{this.logSeek({action:this.seekAction$.getValue(),time:t.info.position$.getValue()}),this.seekAction$.next(Ke.UNKNOWN)}),n(t.events.paused$,()=>{this.logPause({position:t.info.position$.getValue()})}),n(t.events.willResume$,()=>{this.logPlay()}),n(t.events.started$,()=>{this.statContext.clip&&this.logWatchCoverageRecord({start:0,end:0})}),n(Cf(t),a=>{const u=t.info.isLive$.getValue(),v={start:a.from,end:a.to};u?this.logWatchCoverageLive(v):this.logWatchCoverageRecord(v)});let o;n(t.info.isStalled$,a=>{a?o=E():(ue(o)&&this.logEmptyBuffer({duration:E()-o}),o=void 0)});let i=!1;r.add(t.events.fatalError$.pipe(Ko()).subscribe(()=>i=!0)),n(t.events.willStop$,()=>{if(t.info.isStalled$.getValue()){const u=ue(o)?E()-o:void 0;this.logCloseAtEmptyBuffer({duration:u!=null?u:0}),o=void 0}else i||this.logActionStop()}),n(t.events.managedError$,({id:a})=>{this.logError({fatal:!1,errorType:a})}),n(t.events.fatalError$,({id:a})=>{this.logError({fatal:!0,errorType:a})});let s,f,l=!1;n(t.events.firstBytes$,a=>{s=E(),this.logFirstBytes({time:a})}),n(t.events.willStart$,()=>f=E()),n(t.info.currentBuffer$,a=>{!l&&a&&a.end-a.start>0&&ue(s)&&(this.logPlayerReady({duration:E()-s}),l=!0)}),n(t.events.firstFrame$,()=>{ue(s)&&!l&&(this.logPlayerReady({duration:E()-s}),l=!0),ue(f)&&this.logFirstFrame({time:E()-f})}),n(t.info.atLiveEdge$,a=>this.updateContext({liveEdge:a})),n(ur({muted:t.info.muted$,volume:t.info.volume$}),({muted:a,volume:u})=>this.updateContext({audible:!a&&u>0})),n(t.info.currentQuality$,a=>this.updateContext({quality:wf(a)})),n(t.info.isAutoQualityEnabled$,a=>this.updateContext({autoQuality:a})),n(t.info.currentFormat$,a=>this.updateContext({contentType:If(a)}));let c;return n(t.info.hostname$,a=>{this.updateContext({cdnHostname:a,failover:c!==void 0&&c!==a}),c=a}),n(t.info.throughputEstimation$,a=>this.updateContext({downloadSpeed:a})),n(t.info.httpConnectionType$,a=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:En(a)}),this.updateContext({connectionType:En(a)})}),n(t.info.httpConnectionReused$,a=>{Ct(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:a}),this.updateContext({connectionReused:a})}),n(t.info.surface$,a=>this.updateContext({mode:Rt(a)})),n(ur({current:t.info.currentTextTrack$,available:t.info.availableTextTracks$}),({current:a,available:u})=>{const v=u.find(({id:d})=>d===a);this.updateContext({subtitles:v==null?void 0:v.language})}),this.player=t,this.uiEvents&&this.attachToUi(this.uiEvents),this.subscription.add(r),r}attachToUi(t){this.uiEvents=t;const r=new ve;return this.player&&(r.add(t.actionRewind$.subscribe(()=>{this.player&&(this.resetViewSession(),this.logActionPlay({position:this.player.info.position$.getValue()}))})),r.add(t.actionSeek$.subscribe(this.seekAction$)),r.add(t.inPiP$.subscribe(n=>{var o;const i=n?B.PIP:Rt((o=this.player)===null||o===void 0?void 0:o.info.surface$.getValue());this.updateContext({mode:i})})),r.add(t.inFullscreen$.subscribe(n=>{var o;const i=n?B.FULLSCREEN:Rt((o=this.player)===null||o===void 0?void 0:o.info.surface$.getValue());this.updateContext({mode:i})})),r.add(t.actionSetSubtitle$.subscribe(n=>{this.updateContext({subtitles:n})})),this.subscription.add(r)),r}attachToAds(t){const r=new ve;return r.add(t.slotRequested$.subscribe(()=>this.logAdSlotRequest())).add(t.started$.subscribe(n=>this.logAdStarted(n))).add(t.paused$.subscribe(()=>this.logAdPaused())).add(t.resumed$.subscribe(()=>this.logAdResumed())).add(t.ended$.subscribe(()=>this.logAdEnded())).add(t.skipped$.subscribe(()=>this.logAdSkipped())).add(t.clicked$.subscribe(()=>this.logAdClicked())),this.subscription.add(r),r}authorize(t){return this.api.authorize(t)}pause(){this.logger.pause()}resume(){this.logger.resume()}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.vsid=Tn()}setFieldBlacklist(){}logInited(){}logReady(t){this.log({operation:"player_ready",param:String(t.time)})}logStarted(...t){this.logActionPlay(...t)}logPlay(){this.log({operation:"play_toggle"})}logPause(t){this.log({operation:"pause",param:String(Math.round(t.position))})}logSeek(t){this.log({operation:"seek",param:t.action,time:t.time})}logFirstBytes(t){this.log({operation:"first_bytes",param:String(t.time)})}logFirstFrame(t){this.log({operation:"first_frame",param:String(t.time)})}logError(t){this.log({operation:"content_error",param:`${t.fatal?"fatal":"recoverable"}_${t.errorType}`})}logWatchCoverageRecord(t){this.log({operation:"watch_coverage_record",param:`${t.start}-${t.end}`})}logWatchCoverageLive(t){const r=t.start+this.timeSynchronisation.getOffset(),n=t.end+this.timeSynchronisation.getOffset();this.log({operation:"watch_coverage_live",param:`${r}-${n}`})}logEmptyBuffer(t){this.log({operation:"empty_buffer",param:String(t.duration)})}logDownloadSpeed(){}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(t){this.log({operation:"adv",param:t})}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"})}subscribe(){this.subscription.add(At(window,"beforeunload").subscribe(()=>this.logger.flush(!0)));const t=window.navigator.connection;t&&"onchange"in t&&"effectiveType"in t&&this.subscription.add(Ne(At(t,"change"),Wo(["init"])).subscribe(()=>this.updateContext({network:Rf(t.effectiveType)})))}logPlayerReady(t){this.log({operation:"player_ready",param:String(Math.round(t.duration))})}logActionPlay(t){this.log({operation:"action_play",param:String(Math.round(t.position))})}logCloseAtEmptyBuffer(t){this.log({operation:"close_at_empty_buffer",param:String(Math.round(t.duration))})}logActionStop(){this.log({operation:"action_stop"})}log(t){const r=this.createLogItem(t);this.logger.log(r)}createLogItem({operation:t,param:r,time:n}){const o=this.timeSynchronisation.now(),i=t==="empty_buffer"||t==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,s=this.statContext.firstConnectionReused,f={vsid:this.vsid,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?He.AUTO:this.statContext.autoplay===!1?He.MANUAL:void 0,param:r,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:i,connection_reused:s===!0?N.YES:s===!1?N.NO:void 0,cached_data:this.statContext.cached===!0?N.YES:this.statContext.cached===!1?N.NO:void 0,live:this.statContext.liveEdge?N.YES:void 0,muted:this.statContext.audible===!1?N.YES:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:N.YES,ref_domain:this.embedParent,aid:this.statContext.albumId,vk_playlist_id:this.statContext.vkPlaylistId};return{operation:t,type:1,time:n,network:this.statContext.network,timestamp:o,custom:f}}}export{D as ApiEnv,pe as ConnectionType,S as ContentType,jf as OneStat,m as Quality,Ke as SeekAction,yn as VERSION};
|