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