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