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