@vkontakte/videoplayer-statistics 1.0.41-beta.2 → 1.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es2015.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-statistics v1.0.41-beta.2
3
- * Tue, 10 Oct 2023 08:39:46 GMT
2
+ * @vkontakte/videoplayer-statistics v1.0.41
3
+ * Mon, 16 Oct 2023 13:03:33 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-41/doc/
5
5
  */
6
- "use strict";var s=require("@vkontakte/videoplayer-shared/es2015.cjs.js"),Yt=require("lodash/debounce.js"),p=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 _e;(function(e){e.AUTO="auto",e.MANUAL=""})(_e||(_e={}));exports.ConnectionType=void 0;(function(e){e.HTTP1="http1",e.HTTP2="http2",e.HTTP3="http3"})(exports.ConnectionType||(exports.ConnectionType={}));var C;(function(e){e[e.YES=1]="YES",e[e.NO=0]="NO"})(C||(C={}));var q;(function(e){e.EXCELLENT="excellent",e.GOOD="good",e.POOR="poor"})(q||(q={}));var j;(function(e){e.PIP="pip",e.FULLSCREEN="fullscreen",e.EXTERNAL="external",e.PREFETCH="prefetch"})(j||(j={}));exports.SeekAction=void 0;(function(e){e.SLIDER="slider",e.DOUBLE_TAP="double_tap",e.TIME_CODE="time_code",e.EPISODE="episode",e.REWIND="rewind",e.LIVE="live",e.UNKNOWN="unknown"})(exports.SeekAction||(exports.SeekAction={}));exports.InteractiveInterfaceClick=void 0;(function(e){e.GRAPH_SHOW="iGraphShow",e.GRAPH_HIDE="iGraphHide",e.NEXT_AREA="iNextChapterArea",e.NEXT_BUTTON="iNextChapterBtn",e.WATCH_AGAIN="iWatchAgainBtn"})(exports.InteractiveInterfaceClick||(exports.InteractiveInterfaceClick={}));const $o={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}},mo=e=>s.fillWithDefault(e,$o);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 Ue=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function on(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ve=function(e){return e&&e.Math==Math&&e},$=ve(typeof globalThis=="object"&&globalThis)||ve(typeof window=="object"&&window)||ve(typeof self=="object"&&self)||ve(typeof Ue=="object"&&Ue)||function(){return this}()||Ue||Function("return this")(),A=function(e){try{return!!e()}catch(t){return!0}},So=A,Ce=!So(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),Eo=Ce,an=Function.prototype,Jt=an.apply,Xt=an.call,sn=typeof Reflect=="object"&&Reflect.apply||(Eo?Xt.bind(Jt):function(){return Xt.apply(Jt,arguments)}),cn=Ce,un=Function.prototype,mt=un.call,To=cn&&un.bind.bind(mt,mt),w=cn?To:function(e){return function(){return mt.apply(e,arguments)}},ln=w,_o=ln({}.toString),Oo=ln("".slice),se=function(e){return Oo(_o(e),8,-1)},wo=se,Po=w,fn=function(e){if(wo(e)==="Function")return Po(e)},St=typeof document=="object"&&document.all,Ao=typeof St=="undefined"&&St!==void 0,vn={all:St,IS_HTMLDDA:Ao},dn=vn,Co=dn.all,b=dn.IS_HTMLDDA?function(e){return typeof e=="function"||e===Co}:function(e){return typeof e=="function"},jt={},Io=A,X=!Io(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),Ro=Ce,de=Function.prototype.call,T=Ro?de.bind(de):function(){return de.apply(de,arguments)},hn={},pn={}.propertyIsEnumerable,gn=Object.getOwnPropertyDescriptor,No=gn&&!pn.call({1:2},1);hn.f=No?function(t){var r=gn(this,t);return!!r&&r.enumerable}:pn;var yn=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},Do=w,xo=A,Lo=se,Be=Object,jo=Do("".split),ko=xo(function(){return!Be("z").propertyIsEnumerable(0)})?function(e){return Lo(e)=="String"?jo(e,""):Be(e)}:Be,ce=function(e){return e==null},Fo=ce,Mo=TypeError,kt=function(e){if(Fo(e))throw Mo("Can't call method on "+e);return e},Uo=ko,Bo=kt,Vo=function(e){return Uo(Bo(e))},Zt=b,bn=vn,Wo=bn.all,N=bn.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:Zt(e)||e===Wo}:function(e){return typeof e=="object"?e!==null:Zt(e)},$n={},Ve=$n,We=$,Ho=b,er=function(e){return Ho(e)?e:void 0},F=function(e,t){return arguments.length<2?er(Ve[e])||er(We[e]):Ve[e]&&Ve[e][t]||We[e]&&We[e][t]},Ko=w,Ie=Ko({}.isPrototypeOf),Re=typeof navigator!="undefined"&&String(navigator.userAgent)||"",mn=$,He=Re,tr=mn.process,rr=mn.Deno,nr=tr&&tr.versions||rr&&rr.version,or=nr&&nr.v8,O,Oe;or&&(O=or.split("."),Oe=O[0]>0&&O[0]<4?1:+(O[0]+O[1]));!Oe&&He&&(O=He.match(/Edge\/(\d+)/),(!O||O[1]>=74)&&(O=He.match(/Chrome\/(\d+)/),O&&(Oe=+O[1])));var Sn=Oe,ir=Sn,Go=A,qo=$,Qo=qo.String,En=!!Object.getOwnPropertySymbols&&!Go(function(){var e=Symbol();return!Qo(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ir&&ir<41}),zo=En,Tn=zo&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Yo=F,Jo=b,Xo=Ie,Zo=Tn,ei=Object,_n=Zo?function(e){return typeof e=="symbol"}:function(e){var t=Yo("Symbol");return Jo(t)&&Xo(t.prototype,ei(e))},ti=String,Ne=function(e){try{return ti(e)}catch(t){return"Object"}},ri=b,ni=Ne,oi=TypeError,M=function(e){if(ri(e))return e;throw oi(ni(e)+" is not a function")},ii=M,ai=ce,De=function(e,t){var r=e[t];return ai(r)?void 0:ii(r)},Ke=T,Ge=b,qe=N,si=TypeError,ci=function(e,t){var r,n;if(t==="string"&&Ge(r=e.toString)&&!qe(n=Ke(r,e))||Ge(r=e.valueOf)&&!qe(n=Ke(r,e))||t!=="string"&&Ge(r=e.toString)&&!qe(n=Ke(r,e)))return n;throw si("Can't convert object to primitive value")},On={exports:{}},ui=!0,ar=$,li=Object.defineProperty,fi=function(e,t){try{li(ar,e,{value:t,configurable:!0,writable:!0})}catch(r){ar[e]=t}return t},vi=$,di=fi,sr="__core-js_shared__",hi=vi[sr]||di(sr,{}),Ft=hi,cr=Ft;(On.exports=function(e,t){return cr[e]||(cr[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 wn=On.exports,pi=kt,gi=Object,Pn=function(e){return gi(pi(e))},yi=w,bi=Pn,$i=yi({}.hasOwnProperty),U=Object.hasOwn||function(t,r){return $i(bi(t),r)},mi=w,Si=0,Ei=Math.random(),Ti=mi(1 .toString),An=function(e){return"Symbol("+(e===void 0?"":e)+")_"+Ti(++Si+Ei,36)},_i=$,Oi=wn,ur=U,wi=An,Pi=En,Ai=Tn,Q=_i.Symbol,Qe=Oi("wks"),Ci=Ai?Q.for||Q:Q&&Q.withoutSetter||wi,_=function(e){return ur(Qe,e)||(Qe[e]=Pi&&ur(Q,e)?Q[e]:Ci("Symbol."+e)),Qe[e]},Ii=T,lr=N,fr=_n,Ri=De,Ni=ci,Di=_,xi=TypeError,Li=Di("toPrimitive"),ji=function(e,t){if(!lr(e)||fr(e))return e;var r=Ri(e,Li),n;if(r){if(t===void 0&&(t="default"),n=Ii(r,e,t),!lr(n)||fr(n))return n;throw xi("Can't convert object to primitive value")}return t===void 0&&(t="number"),Ni(e,t)},ki=ji,Fi=_n,Cn=function(e){var t=ki(e,"string");return Fi(t)?t:t+""},Mi=$,vr=N,Et=Mi.document,Ui=vr(Et)&&vr(Et.createElement),In=function(e){return Ui?Et.createElement(e):{}},Bi=X,Vi=A,Wi=In,Rn=!Bi&&!Vi(function(){return Object.defineProperty(Wi("div"),"a",{get:function(){return 7}}).a!=7}),Hi=X,Ki=T,Gi=hn,qi=yn,Qi=Vo,zi=Cn,Yi=U,Ji=Rn,dr=Object.getOwnPropertyDescriptor;jt.f=Hi?dr:function(t,r){if(t=Qi(t),r=zi(r),Ji)try{return dr(t,r)}catch(n){}if(Yi(t,r))return qi(!Ki(Gi.f,t,r),t[r])};var Xi=A,Zi=b,ea=/#|\.prototype\./,ue=function(e,t){var r=ra[ta(e)];return r==oa?!0:r==na?!1:Zi(t)?Xi(t):!!t},ta=ue.normalize=function(e){return String(e).replace(ea,".").toLowerCase()},ra=ue.data={},na=ue.NATIVE="N",oa=ue.POLYFILL="P",Nn=ue,hr=fn,ia=M,aa=Ce,sa=hr(hr.bind),xe=function(e,t){return ia(e),t===void 0?e:aa?sa(e,t):function(){return e.apply(t,arguments)}},Le={},ca=X,ua=A,la=ca&&ua(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),fa=N,va=String,da=TypeError,B=function(e){if(fa(e))return e;throw da(va(e)+" is not an object")},ha=X,pa=Rn,ga=la,he=B,pr=Cn,ya=TypeError,ze=Object.defineProperty,ba=Object.getOwnPropertyDescriptor,Ye="enumerable",Je="configurable",Xe="writable";Le.f=ha?ga?function(t,r,n){if(he(t),r=pr(r),he(n),typeof t=="function"&&r==="prototype"&&"value"in n&&Xe in n&&!n[Xe]){var o=ba(t,r);o&&o[Xe]&&(t[r]=n.value,n={configurable:Je in n?n[Je]:o[Je],enumerable:Ye in n?n[Ye]:o[Ye],writable:!1})}return ze(t,r,n)}:ze:function(t,r,n){if(he(t),r=pr(r),he(n),pa)try{return ze(t,r,n)}catch(o){}if("get"in n||"set"in n)throw ya("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var $a=X,ma=Le,Sa=yn,je=$a?function(e,t,r){return ma.f(e,t,Sa(1,r))}:function(e,t,r){return e[t]=r,e},pe=$,Ea=sn,Ta=fn,_a=b,Oa=jt.f,wa=Nn,W=$n,Pa=xe,H=je,gr=U,Aa=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 Ea(e,this,arguments)};return t.prototype=e.prototype,t},D=function(e,t){var r=e.target,n=e.global,o=e.stat,a=e.proto,c=n?pe:o?pe[r]:(pe[r]||{}).prototype,v=n?W:W[r]||H(W,r,{})[r],l=v.prototype,u,i,f,h,d,g,y,m,V;for(h in t)u=wa(n?h:r+(o?".":"#")+h,e.forced),i=!u&&c&&gr(c,h),g=v[h],i&&(e.dontCallGetSet?(V=Oa(c,h),y=V&&V.value):y=c[h]),d=i&&y?y:t[h],!(i&&typeof g==typeof d)&&(e.bind&&i?m=Pa(d,pe):e.wrap&&i?m=Aa(d):a&&_a(d)?m=Ta(d):m=d,(e.sham||d&&d.sham||g&&g.sham)&&H(m,"sham",!0),H(v,h,m),a&&(f=r+"Prototype",gr(W,f)||H(W,f,{}),H(W[f],h,d),e.real&&l&&(u||!l[h])&&H(l,h,d)))},Ca=N,Ia=se,Ra=_,Na=Ra("match"),Da=function(e){var t;return Ca(e)&&((t=e[Na])!==void 0?!!t:Ia(e)=="RegExp")},xa=_,La=xa("toStringTag"),Dn={};Dn[La]="z";var Mt=String(Dn)==="[object z]",ja=Mt,ka=b,Ee=se,Fa=_,Ma=Fa("toStringTag"),Ua=Object,Ba=Ee(function(){return arguments}())=="Arguments",Va=function(e,t){try{return e[t]}catch(r){}},ke=ja?Ee:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=Va(t=Ua(e),Ma))=="string"?r:Ba?Ee(t):(n=Ee(t))=="Object"&&ka(t.callee)?"Arguments":n},Wa=ke,Ha=String,Ka=function(e){if(Wa(e)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return Ha(e)},Ga=B,qa=function(){var e=Ga(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},Qa=T,za=U,Ya=Ie,Ja=qa,yr=RegExp.prototype,Xa=function(e){var t=e.flags;return t===void 0&&!("flags"in yr)&&!za(e,"flags")&&Ya(yr,e)?Qa(Ja,e):t},Ut=w,Za=Pn,es=Math.floor,Ze=Ut("".charAt),ts=Ut("".replace),et=Ut("".slice),rs=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,ns=/\$([$&'`]|\d{1,2})/g,os=function(e,t,r,n,o,a){var c=r+e.length,v=n.length,l=ns;return o!==void 0&&(o=Za(o),l=rs),ts(a,l,function(u,i){var f;switch(Ze(i,0)){case"$":return"$";case"&":return e;case"`":return et(t,0,r);case"'":return et(t,c);case"<":f=o[et(i,1,-1)];break;default:var h=+i;if(h===0)return u;if(h>v){var d=es(h/10);return d===0?u:d<=v?n[d-1]===void 0?Ze(i,1):n[d-1]+Ze(i,1):u}f=n[h-1]}return f===void 0?"":f})},is=D,as=T,Bt=w,br=kt,ss=b,cs=ce,us=Da,K=Ka,ls=De,fs=Xa,vs=os,ds=_,hs=ds("replace"),ps=TypeError,xn=Bt("".indexOf),gs=Bt("".replace),$r=Bt("".slice),ys=Math.max,mr=function(e,t,r){return r>e.length?-1:t===""?r:xn(e,t,r)};is({target:"String",proto:!0},{replaceAll:function(t,r){var n=br(this),o,a,c,v,l,u,i,f,h,d=0,g=0,y="";if(!cs(t)){if(o=us(t),o&&(a=K(br(fs(t))),!~xn(a,"g")))throw ps("`.replaceAll` does not allow non-global regexes");if(c=ls(t,hs),c)return as(c,t,n,r);if(o)return gs(K(n),t,r)}for(v=K(n),l=K(t),u=ss(r),u||(r=K(r)),i=l.length,f=ys(1,i),d=mr(v,l,0);d!==-1;)h=u?K(r(l,d,v)):vs(l,v,d,[],void 0,r),y+=$r(v,g,d)+h,g=d+i,d=mr(v,l,d+f);return g<v.length&&(y+=$r(v,g)),y}});var bs=F,Ln=bs,$s=Ln,ms=$s("String","replaceAll"),Ss=ms,Es=Ss,Ts=Es,_s=Ts,Os=on(_s),ws=se,Fe=typeof process!="undefined"&&ws(process)=="process",Ps=je,As=function(e,t,r,n){return n&&n.enumerable?e[t]=r:Ps(e,t,r),e},Cs=Mt,Is=ke,Rs=Cs?{}.toString:function(){return"[object "+Is(this)+"]"},Ns=Mt,Ds=Le.f,xs=je,Ls=U,js=Rs,ks=_,Sr=ks("toStringTag"),Fs=function(e,t,r,n){if(e){var o=r?e:e.prototype;Ls(o,Sr)||Ds(o,Sr,{configurable:!0,value:t}),n&&!Ns&&xs(o,"toString",js)}},Ms=Le,Us=function(e,t,r){return Ms.f(e,t,r)},Bs=F,Vs=Us,Ws=_,Hs=X,Er=Ws("species"),Ks=function(e){var t=Bs(e);Hs&&t&&!t[Er]&&Vs(t,Er,{configurable:!0,get:function(){return this}})},Gs=Ie,qs=TypeError,Qs=function(e,t){if(Gs(t,e))return e;throw qs("Incorrect invocation")},zs=w,Ys=b,Tt=Ft,Js=zs(Function.toString);Ys(Tt.inspectSource)||(Tt.inspectSource=function(e){return Js(e)});var jn=Tt.inspectSource,Xs=w,Zs=A,kn=b,ec=ke,tc=F,rc=jn,Fn=function(){},nc=[],Mn=tc("Reflect","construct"),Vt=/^\s*(?:class|function)\b/,oc=Xs(Vt.exec),ic=!Vt.exec(Fn),te=function(t){if(!kn(t))return!1;try{return Mn(Fn,nc,t),!0}catch(r){return!1}},Un=function(t){if(!kn(t))return!1;switch(ec(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ic||!!oc(Vt,rc(t))}catch(r){return!0}};Un.sham=!0;var ac=!Mn||Zs(function(){var e;return te(te.call)||!te(Object)||!te(function(){e=!0})||e})?Un:te,sc=ac,cc=Ne,uc=TypeError,lc=function(e){if(sc(e))return e;throw uc(cc(e)+" is not a constructor")},Tr=B,fc=lc,vc=ce,dc=_,hc=dc("species"),Bn=function(e,t){var r=Tr(e).constructor,n;return r===void 0||vc(n=Tr(r)[hc])?t:fc(n)},pc=F,gc=pc("document","documentElement"),yc=w,bc=yc([].slice),$c=TypeError,mc=function(e,t){if(e<t)throw $c("Not enough arguments");return e},Sc=Re,Vn=/(?:ipad|iphone|ipod).*applewebkit/i.test(Sc),S=$,Ec=sn,Tc=xe,_r=b,_c=U,Wn=A,Or=gc,Oc=bc,wr=In,wc=mc,Pc=Vn,Ac=Fe,_t=S.setImmediate,Ot=S.clearImmediate,Cc=S.process,tt=S.Dispatch,Ic=S.Function,Pr=S.MessageChannel,Rc=S.String,rt=0,ne={},Ar="onreadystatechange",ie,x,nt,ot;Wn(function(){ie=S.location});var Wt=function(e){if(_c(ne,e)){var t=ne[e];delete ne[e],t()}},it=function(e){return function(){Wt(e)}},Cr=function(e){Wt(e.data)},Ir=function(e){S.postMessage(Rc(e),ie.protocol+"//"+ie.host)};(!_t||!Ot)&&(_t=function(t){wc(arguments.length,1);var r=_r(t)?t:Ic(t),n=Oc(arguments,1);return ne[++rt]=function(){Ec(r,void 0,n)},x(rt),rt},Ot=function(t){delete ne[t]},Ac?x=function(e){Cc.nextTick(it(e))}:tt&&tt.now?x=function(e){tt.now(it(e))}:Pr&&!Pc?(nt=new Pr,ot=nt.port2,nt.port1.onmessage=Cr,x=Tc(ot.postMessage,ot)):S.addEventListener&&_r(S.postMessage)&&!S.importScripts&&ie&&ie.protocol!=="file:"&&!Wn(Ir)?(x=Ir,S.addEventListener("message",Cr,!1)):Ar in wr("script")?x=function(e){Or.appendChild(wr("script"))[Ar]=function(){Or.removeChild(this),Wt(e)}}:x=function(e){setTimeout(it(e),0)});var Hn={set:_t,clear:Ot},Kn=function(){this.head=null,this.tail=null};Kn.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 Gn=Kn,Nc=Re,Dc=/ipad|iphone|ipod/i.test(Nc)&&typeof Pebble!="undefined",xc=Re,Lc=/web0s(?!.*chrome)/i.test(xc),k=$,Rr=xe,jc=jt.f,at=Hn.set,kc=Gn,Fc=Vn,Mc=Dc,Uc=Lc,st=Fe,Nr=k.MutationObserver||k.WebKitMutationObserver,Dr=k.document,xr=k.process,ge=k.Promise,Lr=jc(k,"queueMicrotask"),wt=Lr&&Lr.value,G,ct,ut,ye,jr;if(!wt){var be=new kc,$e=function(){var e,t;for(st&&(e=xr.domain)&&e.exit();t=be.get();)try{t()}catch(r){throw be.head&&G(),r}e&&e.enter()};!Fc&&!st&&!Uc&&Nr&&Dr?(ct=!0,ut=Dr.createTextNode(""),new Nr($e).observe(ut,{characterData:!0}),G=function(){ut.data=ct=!ct}):!Mc&&ge&&ge.resolve?(ye=ge.resolve(void 0),ye.constructor=ge,jr=Rr(ye.then,ye),G=function(){jr($e)}):st?G=function(){xr.nextTick($e)}:(at=Rr(at,k),G=function(){at($e)}),wt=function(e){be.head||G(),be.add(e)}}var Bc=wt,Vc=function(e,t){try{arguments.length==1?console.error(e):console.error(e,t)}catch(r){}},Ht=function(e){try{return{error:!1,value:e()}}catch(t){return{error:!0,value:t}}},Wc=$,Hc=b,kr=Wc.WeakMap,Kc=Hc(kr)&&/native code/.test(String(kr)),Gc=wn,qc=An,Fr=Gc("keys"),Qc=function(e){return Fr[e]||(Fr[e]=qc(e))},zc=Kc,qn=$,Yc=N,Jc=je,lt=U,ft=Ft,Xc=Qc,Mr="Object already initialized",Pt=qn.TypeError,Zc=qn.WeakMap,we,ae,Pe,eu=function(e){return Pe(e)?ae(e):we(e,{})},tu=function(e){return function(t){var r;if(!Yc(t)||(r=ae(t)).type!==e)throw Pt("Incompatible receiver, "+e+" required");return r}};if(zc||ft.state){var P=ft.state||(ft.state=new Zc);P.get=P.get,P.has=P.has,P.set=P.set,we=function(e,t){if(P.has(e))throw Pt(Mr);return t.facade=e,P.set(e,t),t},ae=function(e){return P.get(e)||{}},Pe=function(e){return P.has(e)}}else{var re=Xc("state");we=function(e,t){if(lt(e,re))throw Pt(Mr);return t.facade=e,Jc(e,re,t),t},ae=function(e){return lt(e,re)?e[re]:{}},Pe=function(e){return lt(e,re)}}var ru={set:we,get:ae,has:Pe,enforce:eu,getterFor:tu},nu=$,Z=nu.Promise,Qn=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",ou=Qn,iu=Fe,au=!ou&&!iu&&typeof window=="object"&&typeof document=="object",su=$,oe=Z,cu=b,uu=Nn,lu=jn,fu=_,vu=au,du=Qn,vt=Sn,Ur=oe&&oe.prototype,hu=fu("species"),At=!1,zn=cu(su.PromiseRejectionEvent),pu=uu("Promise",function(){var e=lu(oe),t=e!==String(oe);if(!t&&vt===66||!(Ur.catch&&Ur.finally))return!0;if(!vt||vt<51||!/native code/.test(e)){var r=new oe(function(a){a(1)}),n=function(a){a(function(){},function(){})},o=r.constructor={};if(o[hu]=n,At=r.then(function(){})instanceof n,!At)return!0}return!t&&(vu||du)&&!zn}),le={CONSTRUCTOR:pu,REJECTION_EVENT:zn,SUBCLASSING:At},ee={},Br=M,gu=TypeError,yu=function(e){var t,r;this.promise=new e(function(n,o){if(t!==void 0||r!==void 0)throw gu("Bad Promise constructor");t=n,r=o}),this.resolve=Br(t),this.reject=Br(r)};ee.f=function(e){return new yu(e)};var bu=D,Ae=Fe,R=$,fe=T,$u=As,mu=Fs,Su=Ks,Eu=M,Ct=b,Tu=N,_u=Qs,Ou=Bn,Yn=Hn.set,Kt=Bc,wu=Vc,Pu=Ht,Au=Gn,Jn=ru,It=Z,Gt=le,Xn=ee,Me="Promise",Zn=Gt.CONSTRUCTOR,Cu=Gt.REJECTION_EVENT;Gt.SUBCLASSING;var dt=Jn.getterFor(Me),Iu=Jn.set,Ru=It&&It.prototype,z=It,ht=Ru,eo=R.TypeError,Rt=R.document,qt=R.process,Nt=Xn.f,Nu=Nt,Du=!!(Rt&&Rt.createEvent&&R.dispatchEvent),to="unhandledrejection",xu="rejectionhandled",Vr=0,ro=1,Lu=2,Qt=1,no=2,me,Wr,ju,oo=function(e){var t;return Tu(e)&&Ct(t=e.then)?t:!1},io=function(e,t){var r=t.value,n=t.state==ro,o=n?e.ok:e.fail,a=e.resolve,c=e.reject,v=e.domain,l,u,i;try{o?(n||(t.rejection===no&&Fu(t),t.rejection=Qt),o===!0?l=r:(v&&v.enter(),l=o(r),v&&(v.exit(),i=!0)),l===e.promise?c(eo("Promise-chain cycle")):(u=oo(l))?fe(u,l,a,c):a(l)):c(r)}catch(f){v&&!i&&v.exit(),c(f)}},ao=function(e,t){e.notified||(e.notified=!0,Kt(function(){for(var r=e.reactions,n;n=r.get();)io(n,e);e.notified=!1,t&&!e.rejection&&ku(e)}))},so=function(e,t,r){var n,o;Du?(n=Rt.createEvent("Event"),n.promise=t,n.reason=r,n.initEvent(e,!1,!0),R.dispatchEvent(n)):n={promise:t,reason:r},!Cu&&(o=R["on"+e])?o(n):e===to&&wu("Unhandled promise rejection",r)},ku=function(e){fe(Yn,R,function(){var t=e.facade,r=e.value,n=Hr(e),o;if(n&&(o=Pu(function(){Ae?qt.emit("unhandledRejection",r,t):so(to,t,r)}),e.rejection=Ae||Hr(e)?no:Qt,o.error))throw o.value})},Hr=function(e){return e.rejection!==Qt&&!e.parent},Fu=function(e){fe(Yn,R,function(){var t=e.facade;Ae?qt.emit("rejectionHandled",t):so(xu,t,e.value)})},Y=function(e,t,r){return function(n){e(t,n,r)}},J=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=Lu,ao(e,!0))},Dt=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw eo("Promise can't be resolved itself");var n=oo(t);n?Kt(function(){var o={done:!1};try{fe(n,t,Y(Dt,o,e),Y(J,o,e))}catch(a){J(o,a,e)}}):(e.value=t,e.state=ro,ao(e,!1))}catch(o){J({done:!1},o,e)}}};Zn&&(z=function(t){_u(this,ht),Eu(t),fe(me,this);var r=dt(this);try{t(Y(Dt,r),Y(J,r))}catch(n){J(r,n)}},ht=z.prototype,me=function(t){Iu(this,{type:Me,done:!1,notified:!1,parent:!1,reactions:new Au,rejection:!1,state:Vr,value:void 0})},me.prototype=$u(ht,"then",function(t,r){var n=dt(this),o=Nt(Ou(this,z));return n.parent=!0,o.ok=Ct(t)?t:!0,o.fail=Ct(r)&&r,o.domain=Ae?qt.domain:void 0,n.state==Vr?n.reactions.add(o):Kt(function(){io(o,n)}),o.promise}),Wr=function(){var e=new me,t=dt(e);this.promise=e,this.resolve=Y(Dt,t),this.reject=Y(J,t)},Xn.f=Nt=function(e){return e===z||e===ju?new Wr(e):Nu(e)});bu({global:!0,constructor:!0,wrap:!0,forced:Zn},{Promise:z});mu(z,Me,!1,!0);Su(Me);var co={},Mu=_,Uu=co,Bu=Mu("iterator"),Vu=Array.prototype,Wu=function(e){return e!==void 0&&(Uu.Array===e||Vu[Bu]===e)},Hu=Math.ceil,Ku=Math.floor,Gu=Math.trunc||function(t){var r=+t;return(r>0?Ku:Hu)(r)},qu=Gu,Qu=function(e){var t=+e;return t!==t||t===0?0:qu(t)},zu=Qu,Yu=Math.min,Ju=function(e){return e>0?Yu(zu(e),9007199254740991):0},Xu=Ju,Zu=function(e){return Xu(e.length)},el=ke,Kr=De,tl=ce,rl=co,nl=_,ol=nl("iterator"),uo=function(e){if(!tl(e))return Kr(e,ol)||Kr(e,"@@iterator")||rl[el(e)]},il=T,al=M,sl=B,cl=Ne,ul=uo,ll=TypeError,fl=function(e,t){var r=arguments.length<2?ul(e):t;if(al(r))return sl(il(r,e));throw ll(cl(e)+" is not iterable")},vl=T,Gr=B,dl=De,hl=function(e,t,r){var n,o;Gr(e);try{if(n=dl(e,"return"),!n){if(t==="throw")throw r;return r}n=vl(n,e)}catch(a){o=!0,n=a}if(t==="throw")throw r;if(o)throw n;return Gr(n),r},pl=xe,gl=T,yl=B,bl=Ne,$l=Wu,ml=Zu,qr=Ie,Sl=fl,El=uo,Qr=hl,Tl=TypeError,Te=function(e,t){this.stopped=e,this.result=t},zr=Te.prototype,lo=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=pl(t,n),u,i,f,h,d,g,y,m=function(E){return u&&Qr(u,"normal",E),new Te(!0,E)},V=function(E){return o?(yl(E),v?l(E[0],E[1],m):l(E[0],E[1])):v?l(E,m):l(E)};if(a)u=e.iterator;else if(c)u=e;else{if(i=El(e),!i)throw Tl(bl(e)+" is not iterable");if($l(i)){for(f=0,h=ml(e);h>f;f++)if(d=V(e[f]),d&&qr(zr,d))return d;return new Te(!1)}u=Sl(e,i)}for(g=a?e.next:u.next;!(y=gl(g,u)).done;){try{d=V(y.value)}catch(E){Qr(u,"throw",E)}if(typeof d=="object"&&d&&qr(zr,d))return d}return new Te(!1)},_l=_,fo=_l("iterator"),vo=!1;try{var Ol=0,Yr={next:function(){return{done:!!Ol++}},return:function(){vo=!0}};Yr[fo]=function(){return this},Array.from(Yr,function(){throw 2})}catch(e){}var wl=function(e,t){if(!t&&!vo)return!1;var r=!1;try{var n={};n[fo]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(o){}return r},Pl=Z,Al=wl,Cl=le.CONSTRUCTOR,ho=Cl||!Al(function(e){Pl.all(e).then(void 0,function(){})}),Il=D,Rl=T,Nl=M,Dl=ee,xl=Ht,Ll=lo,jl=ho;Il({target:"Promise",stat:!0,forced:jl},{all:function(t){var r=this,n=Dl.f(r),o=n.resolve,a=n.reject,c=xl(function(){var v=Nl(r.resolve),l=[],u=0,i=1;Ll(t,function(f){var h=u++,d=!1;i++,Rl(v,r,f).then(function(g){d||(d=!0,l[h]=g,--i||o(l))},a)}),--i||o(l)});return c.error&&a(c.value),n.promise}});var kl=D,Fl=le.CONSTRUCTOR,Jr=Z;Jr&&Jr.prototype;kl({target:"Promise",proto:!0,forced:Fl,real:!0},{catch:function(e){return this.then(void 0,e)}});var Ml=D,Ul=T,Bl=M,Vl=ee,Wl=Ht,Hl=lo,Kl=ho;Ml({target:"Promise",stat:!0,forced:Kl},{race:function(t){var r=this,n=Vl.f(r),o=n.reject,a=Wl(function(){var c=Bl(r.resolve);Hl(t,function(v){Ul(c,r,v).then(n.resolve,o)})});return a.error&&o(a.value),n.promise}});var Gl=D,ql=T,Ql=ee,zl=le.CONSTRUCTOR;Gl({target:"Promise",stat:!0,forced:zl},{reject:function(t){var r=Ql.f(this);return ql(r.reject,void 0,t),r.promise}});var Yl=B,Jl=N,Xl=ee,po=function(e,t){if(Yl(e),Jl(t)&&t.constructor===e)return t;var r=Xl.f(e),n=r.resolve;return n(t),r.promise},Zl=D,ef=F,tf=ui,rf=Z,nf=le.CONSTRUCTOR,of=po,af=ef("Promise"),sf=!nf;Zl({target:"Promise",stat:!0,forced:tf},{resolve:function(t){return of(sf&&this===af?rf:this,t)}});var cf=D,xt=Z,uf=A,lf=F,ff=b,vf=Bn,Xr=po,df=xt&&xt.prototype,hf=!!xt&&uf(function(){df.finally.call({then:function(){}},function(){})});cf({target:"Promise",proto:!0,real:!0,forced:hf},{finally:function(e){var t=vf(this,lf("Promise")),r=ff(e);return this.then(r?function(n){return Xr(t,e()).then(function(){return n})}:e,r?function(n){return Xr(t,e()).then(function(){throw n})}:e)}});var pf=Ln,gf=pf("Promise","finally"),yf=gf,bf=yf,$f=bf,mf=$f,pt=on(mf);function Sf(){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 Lt="1.0.41-beta.2",Ef="CIOPGQJGDIHBABABA",Zr={[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]:""},Tf="_one-stat_",gt=`${Tf}uuid`;var L;(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"})(L||(L={}));class _f{constructor(t){this.consequentAuthErrors=0,this.authorized$=new s.ValueSubject(!1),this.params=t;const r=s.safeStorage.get(gt);r?r.startsWith('"')&&r.endsWith('"')?(this.uuid=Os(r,'"',""),s.safeStorage.set(gt,this.uuid)):this.uuid=r:(this.uuid=Sf(),s.safeStorage.set(gt,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 L.PARAM_SESSION_EXPIRED:case L.PARAM_SESSION_KEY:case L.PARAM_SIGNATURE:return this.authorized$.next(!1),this.sessionKey=yield this._authorizeWithBackoff(),l>0?c(v,l-1):void 0;case L.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=pt(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise})}createLogParams(t){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${Lt}`,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(()=>{pt(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:Lt.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=pt(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 L.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 en{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 go extends en{constructor(){super(),this.listeners||en.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 Of{constructor(){Object.defineProperty(this,"signal",{value:new go,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&&(Of.prototype[Symbol.toStringTag]="AbortController",go.prototype[Symbol.toStringTag]="AbortSignal");function yo(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 wf(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:r=t.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=e;if(!yo({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 h=new r(u,i);return f&&Object.defineProperty(h,"signal",{writable:!1,enumerable:!1,configurable:!0,value:f}),h},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(d){f=new Error("Aborted"),f.name="AbortError"}if(i.aborted)return Promise.reject(f);const h=new Promise((d,g)=>{i.addEventListener("abort",()=>g(f),{once:!0})});return u&&u.signal&&delete u.signal,Promise.race([h,c(l,u)])}return c(l,u)},Request:a}}const zt=yo({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),bo=zt?wf({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,tn=zt?bo.fetch:window.fetch;zt?bo.Request:window.Request;class Pf{constructor(t){this.params=t,this.apiKey=t.apiKey,this.apiEnv=t.config.apiEnv,this.apiBaseUrl=Zr[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 tn(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}),Zr[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(),tn(`${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(h=>Object.prototype.hasOwnProperty.call(h,"error_msg")?Promise.reject(h):h,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 Se="onestat_events",yt=e=>t=>t.timestamp+e>=s.now();class Af{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=Yt(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});const r=s.safeStorage.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=Yt(()=>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(Se);try{return t?JSON.parse(t):{}}catch(r){}return{}}addToStorage(t){var r;if(!this.userSalt){this.unsaltedStorage.push(t);return}const n=this.readFromStorage(),a=((r=n[this.userSalt])!==null&&r!==void 0?r:[]).filter(yt(this.params.config.storageExpiration));s.safeStorage.set(Se,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(yt(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}const t=this.readFromStorage();delete t[this.userSalt],s.safeStorage.set(Se,JSON.stringify(t))}housekeepStorage(){const t=this.readFromStorage();for(const[r,n]of Object.entries(t)){const o=n.filter(yt(this.params.config.storageExpiration));o.length?t[r]=o:delete t[r]}s.safeStorage.set(Se,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 Cf=()=>{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}},If=e=>e&&{[p.VideoQuality.INVARIANT]:exports.Quality.UNKNOWN,[p.VideoQuality.Q_144P]:exports.Quality.Q144P,[p.VideoQuality.Q_240P]:exports.Quality.Q240P,[p.VideoQuality.Q_360P]:exports.Quality.Q360P,[p.VideoQuality.Q_480P]:exports.Quality.Q480P,[p.VideoQuality.Q_720P]:exports.Quality.Q720P,[p.VideoQuality.Q_1080P]:exports.Quality.Q1080P,[p.VideoQuality.Q_1440P]:exports.Quality.Q1440P,[p.VideoQuality.Q_2160P]:exports.Quality.Q2160P,[p.VideoQuality.Q_4320P]:exports.Quality.UNKNOWN}[e],rn=e=>e&&{[p.HttpConnectionType.HTTP1]:exports.ConnectionType.HTTP1,[p.HttpConnectionType.HTTP2]:exports.ConnectionType.HTTP2,[p.HttpConnectionType.QUIC]:exports.ConnectionType.HTTP3}[e],Rf=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)}},bt=e=>{if(e!==void 0)switch(e){case p.Surface.NONE:case p.Surface.INLINE:return;case p.Surface.FULLSCREEN:return j.FULLSCREEN;case p.Surface.SECOND_SCREEN:return j.EXTERNAL;case p.Surface.PIP:return j.PIP;default:return s.assertNever(e)}},Nf=e=>{switch(e){case"slow-2g":return q.POOR;case"2g":return q.POOR;case"3g":return q.GOOD;case"4g":return q.EXCELLENT}};class Df{constructor(t){this.offset=void 0,this.offset=t}getOffset(){var t;return(t=this.offset)!==null&&t!==void 0?t:0}setOffset(t){this.offset=t}now(){var t;return Date.now()+((t=this.offset)!==null&&t!==void 0?t:0)}date(t=new Date){var r;return t.setTime(t.getTime()+((r=this.offset)!==null&&r!==void 0?r:0)),t}addServerTime(t,r){const n=Date.now(),o=t-n-r/2;if(Math.abs(o)<1e3){this.offset=0;return}this.offset===void 0?this.offset=Math.round(o):this.offset=Math.round(.2*o+(1-.2)*this.offset)}}const nn=()=>Math.floor(Math.random()*Math.pow(2,32)).toString(36).padStart(8,"0"),xf=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(y=>{a&&(a.unsubscribe(),o.next(void 0)),y?a=e.info.liveTime$.pipe(s.map(m=>m&&m/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()===p.PlaybackState.PLAYING)),u=e.events.seeked$.pipe(s.filter(()=>e.info.playbackState$.getValue()===p.PlaybackState.PLAYING));let i=!1;const f=new s.Subject;r.add(l.subscribe(()=>{i||f.next(),i=!0})),r.add(u.subscribe(()=>i=!1));const h=s.merge(c,u),d=s.merge(v,f,n,e.events.looped$);let g;return r.add(h.subscribe(()=>g=o.getValue())),r.add(d.subscribe(()=>{const y=o.getValue();s.isNullable(g)||g===y||s.isNullable(y)||(t.next({from:g,to:y}),g=void 0)})),r}),$t=()=>{const e=new s.Subscription;return{subscription:e,subscribe:(t,r)=>{t&&e.add(t.subscribe(r))}}};class Lf{constructor(t,r){var n,o;this.subscription=new s.Subscription,this.vsid=nn(),this.seekAction$=new s.ValueSubject(exports.SeekAction.UNKNOWN),this.statContext=t,this.config=mo((n=r.config)!==null&&n!==void 0?n:{}),s.isNonNullable(r.apiEnv)&&(this.config.apiEnv=r.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new Df);const a=new s.Subject;this.experimental={error$:a};const c=new Pf({apiKey:Ef,config:this.config,error$:a,timeSynchronisation:this.timeSynchronisation});this.api=new _f({config:this.config,apiTransport:c,refreshAuthToken:r.refreshAuthToken,mobile:(o=this.statContext.mobile)!==null&&o!==void 0?o:!1,error$:a}),this.logger=new Af({config:this.config,api:this.api,error$:a,userSalt:r.userSalt});const{isEmbed:v,host:l}=Cf();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$,()=>{const i=t.info.position$.getValue();this.logActionPlay({position:i}),this.statContext.projectId&&this.logActionPlayWithProjectId({position:i})}),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(xf(t),i=>{const f=t.info.isLive$.getValue(),h={start:parseFloat(i.from.toFixed(3)),end:parseFloat(i.to.toFixed(3))};f?this.logWatchCoverageLive(h):this.logWatchCoverageRecord(h)});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:If(i)})),n(t.info.isAutoQualityEnabled$,i=>this.updateContext({autoQuality:i})),n(t.info.currentFormat$,i=>this.updateContext({contentType:Rf(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:rn(i)}),this.updateContext({connectionType:rn(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:bt(i)})),n(s.combine({current:t.info.currentTextTrack$,available:t.info.availableTextTracks$}),({current:i,available:f})=>{const h=f.find(({id:d})=>d===i);this.updateContext({subtitles:h==null?void 0:h.language})}),this.player=t,this.uiEvents&&this.attachToUi(this.uiEvents),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToUi(t){this.uiEvents=t;const{subscription:r,subscribe:n}=$t();return this.player&&(n(t.actionRewind$,()=>{this.player&&(this.resetViewSession(),this.logActionPlay({position:this.player.info.position$.getValue()}))}),n(t.actionSeek$,this.seekAction$),n(t.inPiP$,o=>{var a;const c=o?j.PIP:bt((a=this.player)===null||a===void 0?void 0:a.info.surface$.getValue());this.updateContext({mode:c})}),n(t.inFullscreen$,o=>{var a;const c=o?j.FULLSCREEN:bt((a=this.player)===null||a===void 0?void 0:a.info.surface$.getValue());this.updateContext({mode:c})}),n(t.actionSetSubtitle$,o=>this.updateContext({subtitles:o})),n(t.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(r)),r}attachToAds(t){const{subscription:r,subscribe:n}=$t();return n(t.slotRequested$,()=>this.logAdSlotRequest()),n(t.started$,o=>this.logAdStarted(o)),n(t.paused$,()=>this.logAdPaused()),n(t.resumed$,()=>this.logAdResumed()),n(t.ended$,()=>this.logAdEnded()),n(t.skipped$,()=>this.logAdSkipped()),n(t.clicked$,()=>this.logAdClicked()),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToInteractive(t){const{subscription:r,subscribe:n}=$t();return n(t.click$,o=>this.logInterfaceClick(o)),n(t.nextMovie$,o=>this.logNextMovie(o)),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=nn()}setFieldBlacklist(){}logInited(){}logReady(t){this.log({operation:"player_ready",param:String(t.time)})}logStarted(...t){this.logActionPlay(...t)}logPlay(){this.log({operation:"play_toggle"})}logPause(t){this.log({operation:"pause",param:String(Math.round(t.position))})}logSeek(t){this.log({operation:"seek",param:t.action,time:t.time})}logFirstBytes(t){this.log({operation:"first_bytes",param:String(t.time)})}logFirstFrame(t){this.log({operation:"first_frame",param:String(t.time)})}logError(t){this.log({operation:"content_error",param:`${t.fatal?"fatal":"recoverable"}_${t.errorType}`})}logWatchCoverageRecord(t){this.log({operation:"watch_coverage_record",param:`${t.start}-${t.end}`})}logWatchCoverageLive(t){var r,n;const o=(n=(r=this.timeSynchronisation)===null||r===void 0?void 0:r.getOffset())!==null&&n!==void 0?n:0,a=t.start+o,c=t.end+o;this.log({operation:"watch_coverage_live",param:`${a}-${c}`})}logEmptyBuffer(t){this.log({operation:"empty_buffer",param:String(t.duration)})}logDownloadSpeed(){}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(t){this.log({operation:"adv",param:t})}logAdPaused(){this.log({operation:"adv",param:"pause"})}logAdResumed(){this.log({operation:"adv",param:"resume"})}logAdEnded(){this.log({operation:"adv",param:"ended"})}logAdSkipped(){this.log({operation:"adv",param:"skip"})}logAdClicked(){this.log({operation:"adv",param:"click"})}logInterfaceClick(t){this.log({operation:"player_interface_click",param:t})}logNextMovie(t){this.log({operation:"next_movie",param:String(t)})}subscribe(){this.resubscribeBeforeunload();const t=window.navigator.connection;t&&"onchange"in t&&"effectiveType"in t&&this.subscription.add(s.merge(s.fromEvent(t,"change"),s.observableFrom(["init"])).subscribe(()=>this.updateContext({network:Nf(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))})}logActionPlayWithProjectId(t){if(!this.statContext.projectId)return;const r=this.createLogItem({operation:"action_play",param:String(Math.round(t.position))});r.custom.vid=this.statContext.projectId,this.logger.log(r)}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?_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: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.isEmbed?this.embedParent:this.statContext.refUrl,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=Lf;exports.VERSION=Lt;
6
+ "use strict";var c=require("@vkontakte/videoplayer-shared/es2015.cjs.js"),Ar=require("lodash/debounce.js"),p=require("@vkontakte/videoplayer-core/es2015.cjs.js"),Je=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function ar(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var me=function(e){return e&&e.Math==Math&&e},E=me(typeof globalThis=="object"&&globalThis)||me(typeof window=="object"&&window)||me(typeof self=="object"&&self)||me(typeof Je=="object"&&Je)||function(){return this}()||Je||Function("return this")(),P=function(e){try{return!!e()}catch(t){return!0}},Ta=P,Ue=!Ta(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),_a=Ue,eo=Function.prototype,Cr=eo.apply,Nr=eo.call,to=typeof Reflect=="object"&&Reflect.apply||(_a?Nr.bind(Cr):function(){return Nr.apply(Cr,arguments)}),ro=Ue,no=Function.prototype,Ft=no.call,Pa=ro&&no.bind.bind(Ft,Ft),w=ro?Pa:function(e){return function(){return Ft.apply(e,arguments)}},oo=w,wa=oo({}.toString),Ia=oo("".slice),fe=function(e){return Ia(wa(e),8,-1)},Ra=fe,Aa=w,ao=function(e){if(Ra(e)==="Function")return Aa(e)},Mt=typeof document=="object"&&document.all,Ca=typeof Mt=="undefined"&&Mt!==void 0,io={all:Mt,IS_HTMLDDA:Ca},so=io,Na=so.all,$=so.IS_HTMLDDA?function(e){return typeof e=="function"||e===Na}:function(e){return typeof e=="function"},ir={},La=P,M=!La(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),xa=Ue,$e=Function.prototype.call,_=xa?$e.bind($e):function(){return $e.apply($e,arguments)},co={},uo={}.propertyIsEnumerable,lo=Object.getOwnPropertyDescriptor,Da=lo&&!uo.call({1:2},1);co.f=Da?function(t){var r=lo(this,t);return!!r&&r.enumerable}:uo;var Ve=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},ja=w,ka=P,Fa=fe,Xe=Object,Ma=ja("".split),Ba=ka(function(){return!Xe("z").propertyIsEnumerable(0)})?function(e){return Fa(e)=="String"?Ma(e,""):Xe(e)}:Xe,ve=function(e){return e==null},Ua=ve,Va=TypeError,sr=function(e){if(Ua(e))throw Va("Can't call method on "+e);return e},Ga=Ba,Ka=sr,de=function(e){return Ga(Ka(e))},Lr=$,fo=io,Ha=fo.all,x=fo.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:Lr(e)||e===Ha}:function(e){return typeof e=="object"?e!==null:Lr(e)},cr={},Ze=cr,et=E,Wa=$,xr=function(e){return Wa(e)?e:void 0},K=function(e,t){return arguments.length<2?xr(Ze[e])||xr(et[e]):Ze[e]&&Ze[e][t]||et[e]&&et[e][t]},qa=w,Ge=qa({}.isPrototypeOf),Ke=typeof navigator!="undefined"&&String(navigator.userAgent)||"",vo=E,tt=Ke,Dr=vo.process,jr=vo.Deno,kr=Dr&&Dr.versions||jr&&jr.version,Fr=kr&&kr.v8,I,je;Fr&&(I=Fr.split("."),je=I[0]>0&&I[0]<4?1:+(I[0]+I[1]));!je&&tt&&(I=tt.match(/Edge\/(\d+)/),(!I||I[1]>=74)&&(I=tt.match(/Chrome\/(\d+)/),I&&(je=+I[1])));var ho=je,Mr=ho,Qa=P,za=E,Ya=za.String,po=!!Object.getOwnPropertySymbols&&!Qa(function(){var e=Symbol();return!Ya(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Mr&&Mr<41}),Ja=po,go=Ja&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Xa=K,Za=$,ei=Ge,ti=go,ri=Object,yo=ti?function(e){return typeof e=="symbol"}:function(e){var t=Xa("Symbol");return Za(t)&&ei(t.prototype,ri(e))},ni=String,He=function(e){try{return ni(e)}catch(t){return"Object"}},oi=$,ai=He,ii=TypeError,H=function(e){if(oi(e))return e;throw ii(ai(e)+" is not a function")},si=H,ci=ve,We=function(e,t){var r=e[t];return ci(r)?void 0:si(r)},rt=_,nt=$,ot=x,ui=TypeError,li=function(e,t){var r,n;if(t==="string"&&nt(r=e.toString)&&!ot(n=rt(r,e))||nt(r=e.valueOf)&&!ot(n=rt(r,e))||t!=="string"&&nt(r=e.toString)&&!ot(n=rt(r,e)))return n;throw ui("Can't convert object to primitive value")},bo={exports:{}},fi=!0,Br=E,vi=Object.defineProperty,di=function(e,t){try{vi(Br,e,{value:t,configurable:!0,writable:!0})}catch(r){Br[e]=t}return t},hi=E,pi=di,Ur="__core-js_shared__",gi=hi[Ur]||pi(Ur,{}),ur=gi,Vr=ur;(bo.exports=function(e,t){return Vr[e]||(Vr[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 mo=bo.exports,yi=sr,bi=Object,lr=function(e){return bi(yi(e))},mi=w,$i=lr,Si=mi({}.hasOwnProperty),A=Object.hasOwn||function(t,r){return Si($i(t),r)},Ei=w,Oi=0,Ti=Math.random(),_i=Ei(1 .toString),$o=function(e){return"Symbol("+(e===void 0?"":e)+")_"+_i(++Oi+Ti,36)},Pi=E,wi=mo,Gr=A,Ii=$o,Ri=po,Ai=go,X=Pi.Symbol,at=wi("wks"),Ci=Ai?X.for||X:X&&X.withoutSetter||Ii,O=function(e){return Gr(at,e)||(at[e]=Ri&&Gr(X,e)?X[e]:Ci("Symbol."+e)),at[e]},Ni=_,Kr=x,Hr=yo,Li=We,xi=li,Di=O,ji=TypeError,ki=Di("toPrimitive"),Fi=function(e,t){if(!Kr(e)||Hr(e))return e;var r=Li(e,ki),n;if(r){if(t===void 0&&(t="default"),n=Ni(r,e,t),!Kr(n)||Hr(n))return n;throw ji("Can't convert object to primitive value")}return t===void 0&&(t="number"),xi(e,t)},Mi=Fi,Bi=yo,fr=function(e){var t=Mi(e,"string");return Bi(t)?t:t+""},Ui=E,Wr=x,Bt=Ui.document,Vi=Wr(Bt)&&Wr(Bt.createElement),vr=function(e){return Vi?Bt.createElement(e):{}},Gi=M,Ki=P,Hi=vr,So=!Gi&&!Ki(function(){return Object.defineProperty(Hi("div"),"a",{get:function(){return 7}}).a!=7}),Wi=M,qi=_,Qi=co,zi=Ve,Yi=de,Ji=fr,Xi=A,Zi=So,qr=Object.getOwnPropertyDescriptor;ir.f=Wi?qr:function(t,r){if(t=Yi(t),r=Ji(r),Zi)try{return qr(t,r)}catch(n){}if(Xi(t,r))return zi(!qi(Qi.f,t,r),t[r])};var es=P,ts=$,rs=/#|\.prototype\./,he=function(e,t){var r=os[ns(e)];return r==is?!0:r==as?!1:ts(t)?es(t):!!t},ns=he.normalize=function(e){return String(e).replace(rs,".").toLowerCase()},os=he.data={},as=he.NATIVE="N",is=he.POLYFILL="P",Eo=he,Qr=ao,ss=H,cs=Ue,us=Qr(Qr.bind),qe=function(e,t){return ss(e),t===void 0?e:cs?us(e,t):function(){return e.apply(t,arguments)}},W={},ls=M,fs=P,Oo=ls&&fs(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),vs=x,ds=String,hs=TypeError,D=function(e){if(vs(e))return e;throw hs(ds(e)+" is not an object")},ps=M,gs=So,ys=Oo,Se=D,zr=fr,bs=TypeError,it=Object.defineProperty,ms=Object.getOwnPropertyDescriptor,st="enumerable",ct="configurable",ut="writable";W.f=ps?ys?function(t,r,n){if(Se(t),r=zr(r),Se(n),typeof t=="function"&&r==="prototype"&&"value"in n&&ut in n&&!n[ut]){var o=ms(t,r);o&&o[ut]&&(t[r]=n.value,n={configurable:ct in n?n[ct]:o[ct],enumerable:st in n?n[st]:o[st],writable:!1})}return it(t,r,n)}:it:function(t,r,n){if(Se(t),r=zr(r),Se(n),gs)try{return it(t,r,n)}catch(o){}if("get"in n||"set"in n)throw bs("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var $s=M,Ss=W,Es=Ve,pe=$s?function(e,t,r){return Ss.f(e,t,Es(1,r))}:function(e,t,r){return e[t]=r,e},Ee=E,Os=to,Ts=ao,_s=$,Ps=ir.f,ws=Eo,q=cr,Is=qe,Q=pe,Yr=A,Rs=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 Os(e,this,arguments)};return t.prototype=e.prototype,t},C=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,l=n?q:q[r]||Q(q,r,{})[r],v=l.prototype,f,a,u,d,h,g,y,b,m;for(d in t)f=ws(n?d:r+(o?".":"#")+d,e.forced),a=!f&&s&&Yr(s,d),g=l[d],a&&(e.dontCallGetSet?(m=Ps(s,d),y=m&&m.value):y=s[d]),h=a&&y?y:t[d],!(a&&typeof g==typeof h)&&(e.bind&&a?b=Is(h,Ee):e.wrap&&a?b=Rs(h):i&&_s(h)?b=Ts(h):b=h,(e.sham||h&&h.sham||g&&g.sham)&&Q(b,"sham",!0),Q(l,d,b),i&&(u=r+"Prototype",Yr(q,u)||Q(q,u,{}),Q(q[u],d,h),e.real&&v&&(f||!v[d])&&Q(v,d,h)))},As=x,Cs=fe,Ns=O,Ls=Ns("match"),xs=function(e){var t;return As(e)&&((t=e[Ls])!==void 0?!!t:Cs(e)=="RegExp")},Ds=O,js=Ds("toStringTag"),To={};To[js]="z";var dr=String(To)==="[object z]",ks=dr,Fs=$,Le=fe,Ms=O,Bs=Ms("toStringTag"),Us=Object,Vs=Le(function(){return arguments}())=="Arguments",Gs=function(e,t){try{return e[t]}catch(r){}},ge=ks?Le:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=Gs(t=Us(e),Bs))=="string"?r:Vs?Le(t):(n=Le(t))=="Object"&&Fs(t.callee)?"Arguments":n},Ks=ge,Hs=String,Ws=function(e){if(Ks(e)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return Hs(e)},qs=D,Qs=function(){var e=qs(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},zs=_,Ys=A,Js=Ge,Xs=Qs,Jr=RegExp.prototype,Zs=function(e){var t=e.flags;return t===void 0&&!("flags"in Jr)&&!Ys(e,"flags")&&Js(Jr,e)?zs(Xs,e):t},hr=w,ec=lr,tc=Math.floor,lt=hr("".charAt),rc=hr("".replace),ft=hr("".slice),nc=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,oc=/\$([$&'`]|\d{1,2})/g,ac=function(e,t,r,n,o,i){var s=r+e.length,l=n.length,v=oc;return o!==void 0&&(o=ec(o),v=nc),rc(i,v,function(f,a){var u;switch(lt(a,0)){case"$":return"$";case"&":return e;case"`":return ft(t,0,r);case"'":return ft(t,s);case"<":u=o[ft(a,1,-1)];break;default:var d=+a;if(d===0)return f;if(d>l){var h=tc(d/10);return h===0?f:h<=l?n[h-1]===void 0?lt(a,1):n[h-1]+lt(a,1):f}u=n[d-1]}return u===void 0?"":u})},ic=C,sc=_,pr=w,Xr=sr,cc=$,uc=ve,lc=xs,z=Ws,fc=We,vc=Zs,dc=ac,hc=O,pc=hc("replace"),gc=TypeError,_o=pr("".indexOf),yc=pr("".replace),Zr=pr("".slice),bc=Math.max,en=function(e,t,r){return r>e.length?-1:t===""?r:_o(e,t,r)};ic({target:"String",proto:!0},{replaceAll:function(t,r){var n=Xr(this),o,i,s,l,v,f,a,u,d,h=0,g=0,y="";if(!uc(t)){if(o=lc(t),o&&(i=z(Xr(vc(t))),!~_o(i,"g")))throw gc("`.replaceAll` does not allow non-global regexes");if(s=fc(t,pc),s)return sc(s,t,n,r);if(o)return yc(z(n),t,r)}for(l=z(n),v=z(t),f=cc(r),f||(r=z(r)),a=v.length,u=bc(1,a),h=en(l,v,0);h!==-1;)d=f?z(r(v,h,l)):dc(v,l,h,[],void 0,r),y+=Zr(l,g,h)+d,g=h+a,h=en(l,v,h+u);return g<l.length&&(y+=Zr(l,g)),y}});var mc=K,Po=mc,$c=Po,Sc=$c("String","replaceAll"),Ec=Sc,Oc=Ec,Tc=Oc,_c=Tc,Pc=ar(_c);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 ke;(function(e){e.AUTO="auto",e.MANUAL=""})(ke||(ke={}));exports.ConnectionType=void 0;(function(e){e.HTTP1="http1",e.HTTP2="http2",e.HTTP3="http3"})(exports.ConnectionType||(exports.ConnectionType={}));var N;(function(e){e[e.YES=1]="YES",e[e.NO=0]="NO"})(N||(N={}));var Z;(function(e){e.EXCELLENT="excellent",e.GOOD="good",e.POOR="poor"})(Z||(Z={}));var V;(function(e){e.PIP="pip",e.FULLSCREEN="fullscreen",e.EXTERNAL="external",e.PREFETCH="prefetch",e.AIRPLAY="airplay",e.CHROMECAST="chromecast",e.INVISIBLE="invisible"})(V||(V={}));exports.SeekAction=void 0;(function(e){e.SLIDER="slider",e.DOUBLE_TAP="double_tap",e.TIME_CODE="time_code",e.EPISODE="episode",e.REWIND="rewind",e.LIVE="live",e.UNKNOWN="unknown"})(exports.SeekAction||(exports.SeekAction={}));exports.InteractiveInterfaceClick=void 0;(function(e){e.GRAPH_SHOW="iGraphShow",e.GRAPH_HIDE="iGraphHide",e.NEXT_AREA="iNextChapterArea",e.NEXT_BUTTON="iNextChapterBtn",e.WATCH_AGAIN="iWatchAgainBtn"})(exports.InteractiveInterfaceClick||(exports.InteractiveInterfaceClick={}));const wc={action_play:"ap",first_bytes:"fb",player_ready:"pr",first_frame:"ff",seek:"sk",watch_coverage_record:"wr",watch_coverage_live:"wl",empty_buffer:"eb",action_stop:"as",close_at_empty_buffer:"cb",content_error:"er",player_interface_click:"pc",next_movie:"nm",track_switch:"ts"},Ic={vsid:"si",vid:"vi",place:"pl",quality:"qt",cdn_host:"ch",stat_type:"st",param:"pm",vk_app_id:"va",track_code:"tc",connection_type:"cnt",connection_reused:"cr",cached_data:"cd",live:"lv",muted:"mu",mode:"mo",subtitles:"sb",failover:"fo",download_speed:"ds",manual_quality:"mq",ref_domain:"rd",direct_url:"du"},Rc={unknown:"un",mobile:"m",lowest:"ls",low:"l",medium:"md",high:"h",fullhd:"f",quadhd:"q",ultrahd:"u"},Ac={pip:"pi",fullscreen:"fs",external:"ex",prefetch:"pr",airplay:"ap",chromecast:"cc",invisible:"iv"},Cc={apiEnv:exports.ApiEnv.VK_ALIAS,requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageInterval:15e3,disabledOperations:[],disabledCustomFields:[],shorten:!0,embedUrlParams:[],useBeacon:!0,synchronizeTime:!0,debugLog:!1,backoff:{start:1e3,factor:1.5,max:5*60*1e3,random:.1}},Nc=e=>c.fillWithDefault(e,Cc);function Lc(){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("")}function k(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 l(a){try{f(n.next(a))}catch(u){s(u)}}function v(a){try{f(n.throw(a))}catch(u){s(u)}}function f(a){a.done?i(a.value):o(a.value).then(l,v)}f((n=n.apply(e,t||[])).next())})}var xc=fe,Qe=typeof process!="undefined"&&xc(process)=="process",Dc=pe,gr=function(e,t,r,n){return n&&n.enumerable?e[t]=r:Dc(e,t,r),e},jc=dr,kc=ge,Fc=jc?{}.toString:function(){return"[object "+kc(this)+"]"},Mc=dr,Bc=W.f,Uc=pe,Vc=A,Gc=Fc,Kc=O,tn=Kc("toStringTag"),yr=function(e,t,r,n){if(e){var o=r?e:e.prototype;Vc(o,tn)||Bc(o,tn,{configurable:!0,value:t}),n&&!Mc&&Uc(o,"toString",Gc)}},Hc=W,Wc=function(e,t,r){return Hc.f(e,t,r)},qc=K,Qc=Wc,zc=O,Yc=M,rn=zc("species"),Jc=function(e){var t=qc(e);Yc&&t&&!t[rn]&&Qc(t,rn,{configurable:!0,get:function(){return this}})},Xc=Ge,Zc=TypeError,eu=function(e,t){if(Xc(t,e))return e;throw Zc("Incorrect invocation")},tu=w,ru=$,Ut=ur,nu=tu(Function.toString);ru(Ut.inspectSource)||(Ut.inspectSource=function(e){return nu(e)});var wo=Ut.inspectSource,ou=w,au=P,Io=$,iu=ge,su=K,cu=wo,Ro=function(){},uu=[],Ao=su("Reflect","construct"),br=/^\s*(?:class|function)\b/,lu=ou(br.exec),fu=!br.exec(Ro),ie=function(t){if(!Io(t))return!1;try{return Ao(Ro,uu,t),!0}catch(r){return!1}},Co=function(t){if(!Io(t))return!1;switch(iu(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return fu||!!lu(br,cu(t))}catch(r){return!0}};Co.sham=!0;var vu=!Ao||au(function(){var e;return ie(ie.call)||!ie(Object)||!ie(function(){e=!0})||e})?Co:ie,du=vu,hu=He,pu=TypeError,gu=function(e){if(du(e))return e;throw pu(hu(e)+" is not a constructor")},nn=D,yu=gu,bu=ve,mu=O,$u=mu("species"),No=function(e,t){var r=nn(e).constructor,n;return r===void 0||bu(n=nn(r)[$u])?t:yu(n)},Su=K,Lo=Su("document","documentElement"),Eu=w,Ou=Eu([].slice),Tu=TypeError,_u=function(e,t){if(e<t)throw Tu("Not enough arguments");return e},Pu=Ke,xo=/(?:ipad|iphone|ipod).*applewebkit/i.test(Pu),T=E,wu=to,Iu=qe,on=$,Ru=A,Do=P,an=Lo,Au=Ou,sn=vr,Cu=_u,Nu=xo,Lu=Qe,Vt=T.setImmediate,Gt=T.clearImmediate,xu=T.process,vt=T.Dispatch,Du=T.Function,cn=T.MessageChannel,ju=T.String,dt=0,se={},un="onreadystatechange",ue,B,ht,pt;Do(function(){ue=T.location});var mr=function(e){if(Ru(se,e)){var t=se[e];delete se[e],t()}},gt=function(e){return function(){mr(e)}},ln=function(e){mr(e.data)},fn=function(e){T.postMessage(ju(e),ue.protocol+"//"+ue.host)};(!Vt||!Gt)&&(Vt=function(t){Cu(arguments.length,1);var r=on(t)?t:Du(t),n=Au(arguments,1);return se[++dt]=function(){wu(r,void 0,n)},B(dt),dt},Gt=function(t){delete se[t]},Lu?B=function(e){xu.nextTick(gt(e))}:vt&&vt.now?B=function(e){vt.now(gt(e))}:cn&&!Nu?(ht=new cn,pt=ht.port2,ht.port1.onmessage=ln,B=Iu(pt.postMessage,pt)):T.addEventListener&&on(T.postMessage)&&!T.importScripts&&ue&&ue.protocol!=="file:"&&!Do(fn)?(B=fn,T.addEventListener("message",ln,!1)):un in sn("script")?B=function(e){an.appendChild(sn("script"))[un]=function(){an.removeChild(this),mr(e)}}:B=function(e){setTimeout(gt(e),0)});var jo={set:Vt,clear:Gt},ko=function(){this.head=null,this.tail=null};ko.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 Fo=ko,ku=Ke,Fu=/ipad|iphone|ipod/i.test(ku)&&typeof Pebble!="undefined",Mu=Ke,Bu=/web0s(?!.*chrome)/i.test(Mu),G=E,vn=qe,Uu=ir.f,yt=jo.set,Vu=Fo,Gu=xo,Ku=Fu,Hu=Bu,bt=Qe,dn=G.MutationObserver||G.WebKitMutationObserver,hn=G.document,pn=G.process,Oe=G.Promise,gn=Uu(G,"queueMicrotask"),Kt=gn&&gn.value,Y,mt,$t,Te,yn;if(!Kt){var _e=new Vu,Pe=function(){var e,t;for(bt&&(e=pn.domain)&&e.exit();t=_e.get();)try{t()}catch(r){throw _e.head&&Y(),r}e&&e.enter()};!Gu&&!bt&&!Hu&&dn&&hn?(mt=!0,$t=hn.createTextNode(""),new dn(Pe).observe($t,{characterData:!0}),Y=function(){$t.data=mt=!mt}):!Ku&&Oe&&Oe.resolve?(Te=Oe.resolve(void 0),Te.constructor=Oe,yn=vn(Te.then,Te),Y=function(){yn(Pe)}):bt?Y=function(){pn.nextTick(Pe)}:(yt=vn(yt,G),Y=function(){yt(Pe)}),Kt=function(e){_e.head||Y(),_e.add(e)}}var Wu=Kt,qu=function(e,t){try{arguments.length==1?console.error(e):console.error(e,t)}catch(r){}},$r=function(e){try{return{error:!1,value:e()}}catch(t){return{error:!0,value:t}}},Qu=E,zu=$,bn=Qu.WeakMap,Yu=zu(bn)&&/native code/.test(String(bn)),Ju=mo,Xu=$o,mn=Ju("keys"),Sr=function(e){return mn[e]||(mn[e]=Xu(e))},Er={},Zu=Yu,Mo=E,el=x,tl=pe,St=A,Et=ur,rl=Sr,nl=Er,$n="Object already initialized",Ht=Mo.TypeError,ol=Mo.WeakMap,Fe,le,Me,al=function(e){return Me(e)?le(e):Fe(e,{})},il=function(e){return function(t){var r;if(!el(t)||(r=le(t)).type!==e)throw Ht("Incompatible receiver, "+e+" required");return r}};if(Zu||Et.state){var R=Et.state||(Et.state=new ol);R.get=R.get,R.has=R.has,R.set=R.set,Fe=function(e,t){if(R.has(e))throw Ht($n);return t.facade=e,R.set(e,t),t},le=function(e){return R.get(e)||{}},Me=function(e){return R.has(e)}}else{var J=rl("state");nl[J]=!0,Fe=function(e,t){if(St(e,J))throw Ht($n);return t.facade=e,tl(e,J,t),t},le=function(e){return St(e,J)?e[J]:{}},Me=function(e){return St(e,J)}}var Bo={set:Fe,get:le,has:Me,enforce:al,getterFor:il},sl=E,ne=sl.Promise,Uo=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",cl=Uo,ul=Qe,ll=!cl&&!ul&&typeof window=="object"&&typeof document=="object",fl=E,ce=ne,vl=$,dl=Eo,hl=wo,pl=O,gl=ll,yl=Uo,Ot=ho,Sn=ce&&ce.prototype,bl=pl("species"),Wt=!1,Vo=vl(fl.PromiseRejectionEvent),ml=dl("Promise",function(){var e=hl(ce),t=e!==String(ce);if(!t&&Ot===66||!(Sn.catch&&Sn.finally))return!0;if(!Ot||Ot<51||!/native code/.test(e)){var r=new ce(function(i){i(1)}),n=function(i){i(function(){},function(){})},o=r.constructor={};if(o[bl]=n,Wt=r.then(function(){})instanceof n,!Wt)return!0}return!t&&(gl||yl)&&!Vo}),ye={CONSTRUCTOR:ml,REJECTION_EVENT:Vo,SUBCLASSING:Wt},oe={},En=H,$l=TypeError,Sl=function(e){var t,r;this.promise=new e(function(n,o){if(t!==void 0||r!==void 0)throw $l("Bad Promise constructor");t=n,r=o}),this.resolve=En(t),this.reject=En(r)};oe.f=function(e){return new Sl(e)};var El=C,Be=Qe,F=E,be=_,Ol=gr,Tl=yr,_l=Jc,Pl=H,qt=$,wl=x,Il=eu,Rl=No,Go=jo.set,Or=Wu,Al=qu,Cl=$r,Nl=Fo,Ko=Bo,Qt=ne,Tr=ye,Ho=oe,ze="Promise",Wo=Tr.CONSTRUCTOR,Ll=Tr.REJECTION_EVENT;Tr.SUBCLASSING;var Tt=Ko.getterFor(ze),xl=Ko.set,Dl=Qt&&Qt.prototype,ee=Qt,_t=Dl,qo=F.TypeError,zt=F.document,_r=F.process,Yt=Ho.f,jl=Yt,kl=!!(zt&&zt.createEvent&&F.dispatchEvent),Qo="unhandledrejection",Fl="rejectionhandled",On=0,zo=1,Ml=2,Pr=1,Yo=2,we,Tn,Bl,Jo=function(e){var t;return wl(e)&&qt(t=e.then)?t:!1},Xo=function(e,t){var r=t.value,n=t.state==zo,o=n?e.ok:e.fail,i=e.resolve,s=e.reject,l=e.domain,v,f,a;try{o?(n||(t.rejection===Yo&&Vl(t),t.rejection=Pr),o===!0?v=r:(l&&l.enter(),v=o(r),l&&(l.exit(),a=!0)),v===e.promise?s(qo("Promise-chain cycle")):(f=Jo(v))?be(f,v,i,s):i(v)):s(r)}catch(u){l&&!a&&l.exit(),s(u)}},Zo=function(e,t){e.notified||(e.notified=!0,Or(function(){for(var r=e.reactions,n;n=r.get();)Xo(n,e);e.notified=!1,t&&!e.rejection&&Ul(e)}))},ea=function(e,t,r){var n,o;kl?(n=zt.createEvent("Event"),n.promise=t,n.reason=r,n.initEvent(e,!1,!0),F.dispatchEvent(n)):n={promise:t,reason:r},!Ll&&(o=F["on"+e])?o(n):e===Qo&&Al("Unhandled promise rejection",r)},Ul=function(e){be(Go,F,function(){var t=e.facade,r=e.value,n=_n(e),o;if(n&&(o=Cl(function(){Be?_r.emit("unhandledRejection",r,t):ea(Qo,t,r)}),e.rejection=Be||_n(e)?Yo:Pr,o.error))throw o.value})},_n=function(e){return e.rejection!==Pr&&!e.parent},Vl=function(e){be(Go,F,function(){var t=e.facade;Be?_r.emit("rejectionHandled",t):ea(Fl,t,e.value)})},te=function(e,t,r){return function(n){e(t,n,r)}},re=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=Ml,Zo(e,!0))},Jt=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw qo("Promise can't be resolved itself");var n=Jo(t);n?Or(function(){var o={done:!1};try{be(n,t,te(Jt,o,e),te(re,o,e))}catch(i){re(o,i,e)}}):(e.value=t,e.state=zo,Zo(e,!1))}catch(o){re({done:!1},o,e)}}};Wo&&(ee=function(t){Il(this,_t),Pl(t),be(we,this);var r=Tt(this);try{t(te(Jt,r),te(re,r))}catch(n){re(r,n)}},_t=ee.prototype,we=function(t){xl(this,{type:ze,done:!1,notified:!1,parent:!1,reactions:new Nl,rejection:!1,state:On,value:void 0})},we.prototype=Ol(_t,"then",function(t,r){var n=Tt(this),o=Yt(Rl(this,ee));return n.parent=!0,o.ok=qt(t)?t:!0,o.fail=qt(r)&&r,o.domain=Be?_r.domain:void 0,n.state==On?n.reactions.add(o):Or(function(){Xo(o,n)}),o.promise}),Tn=function(){var e=new we,t=Tt(e);this.promise=e,this.resolve=te(Jt,t),this.reject=te(re,t)},Ho.f=Yt=function(e){return e===ee||e===Bl?new Tn(e):jl(e)});El({global:!0,constructor:!0,wrap:!0,forced:Wo},{Promise:ee});Tl(ee,ze,!1,!0);_l(ze);var ae={},Gl=O,Kl=ae,Hl=Gl("iterator"),Wl=Array.prototype,ql=function(e){return e!==void 0&&(Kl.Array===e||Wl[Hl]===e)},Ql=Math.ceil,zl=Math.floor,Yl=Math.trunc||function(t){var r=+t;return(r>0?zl:Ql)(r)},Jl=Yl,ta=function(e){var t=+e;return t!==t||t===0?0:Jl(t)},Xl=ta,Zl=Math.min,ef=function(e){return e>0?Zl(Xl(e),9007199254740991):0},tf=ef,ra=function(e){return tf(e.length)},rf=ge,Pn=We,nf=ve,of=ae,af=O,sf=af("iterator"),na=function(e){if(!nf(e))return Pn(e,sf)||Pn(e,"@@iterator")||of[rf(e)]},cf=_,uf=H,lf=D,ff=He,vf=na,df=TypeError,hf=function(e,t){var r=arguments.length<2?vf(e):t;if(uf(r))return lf(cf(r,e));throw df(ff(e)+" is not iterable")},pf=_,wn=D,gf=We,yf=function(e,t,r){var n,o;wn(e);try{if(n=gf(e,"return"),!n){if(t==="throw")throw r;return r}n=pf(n,e)}catch(i){o=!0,n=i}if(t==="throw")throw r;if(o)throw n;return wn(n),r},bf=qe,mf=_,$f=D,Sf=He,Ef=ql,Of=ra,In=Ge,Tf=hf,_f=na,Rn=yf,Pf=TypeError,xe=function(e,t){this.stopped=e,this.result=t},An=xe.prototype,wr=function(e,t,r){var n=r&&r.that,o=!!(r&&r.AS_ENTRIES),i=!!(r&&r.IS_RECORD),s=!!(r&&r.IS_ITERATOR),l=!!(r&&r.INTERRUPTED),v=bf(t,n),f,a,u,d,h,g,y,b=function(S){return f&&Rn(f,"normal",S),new xe(!0,S)},m=function(S){return o?($f(S),l?v(S[0],S[1],b):v(S[0],S[1])):l?v(S,b):v(S)};if(i)f=e.iterator;else if(s)f=e;else{if(a=_f(e),!a)throw Pf(Sf(e)+" is not iterable");if(Ef(a)){for(u=0,d=Of(e);d>u;u++)if(h=m(e[u]),h&&In(An,h))return h;return new xe(!1)}f=Tf(e,a)}for(g=i?e.next:f.next;!(y=mf(g,f)).done;){try{h=m(y.value)}catch(S){Rn(f,"throw",S)}if(typeof h=="object"&&h&&In(An,h))return h}return new xe(!1)},wf=O,oa=wf("iterator"),aa=!1;try{var If=0,Cn={next:function(){return{done:!!If++}},return:function(){aa=!0}};Cn[oa]=function(){return this},Array.from(Cn,function(){throw 2})}catch(e){}var Rf=function(e,t){if(!t&&!aa)return!1;var r=!1;try{var n={};n[oa]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(o){}return r},Af=ne,Cf=Rf,Nf=ye.CONSTRUCTOR,ia=Nf||!Cf(function(e){Af.all(e).then(void 0,function(){})}),Lf=C,xf=_,Df=H,jf=oe,kf=$r,Ff=wr,Mf=ia;Lf({target:"Promise",stat:!0,forced:Mf},{all:function(t){var r=this,n=jf.f(r),o=n.resolve,i=n.reject,s=kf(function(){var l=Df(r.resolve),v=[],f=0,a=1;Ff(t,function(u){var d=f++,h=!1;a++,xf(l,r,u).then(function(g){h||(h=!0,v[d]=g,--a||o(v))},i)}),--a||o(v)});return s.error&&i(s.value),n.promise}});var Bf=C,Uf=ye.CONSTRUCTOR,Nn=ne;Nn&&Nn.prototype;Bf({target:"Promise",proto:!0,forced:Uf,real:!0},{catch:function(e){return this.then(void 0,e)}});var Vf=C,Gf=_,Kf=H,Hf=oe,Wf=$r,qf=wr,Qf=ia;Vf({target:"Promise",stat:!0,forced:Qf},{race:function(t){var r=this,n=Hf.f(r),o=n.reject,i=Wf(function(){var s=Kf(r.resolve);qf(t,function(l){Gf(s,r,l).then(n.resolve,o)})});return i.error&&o(i.value),n.promise}});var zf=C,Yf=_,Jf=oe,Xf=ye.CONSTRUCTOR;zf({target:"Promise",stat:!0,forced:Xf},{reject:function(t){var r=Jf.f(this);return Yf(r.reject,void 0,t),r.promise}});var Zf=D,ev=x,tv=oe,sa=function(e,t){if(Zf(e),ev(t)&&t.constructor===e)return t;var r=tv.f(e),n=r.resolve;return n(t),r.promise},rv=C,nv=K,ov=fi,av=ne,iv=ye.CONSTRUCTOR,sv=sa,cv=nv("Promise"),uv=!iv;rv({target:"Promise",stat:!0,forced:ov},{resolve:function(t){return sv(uv&&this===cv?av:this,t)}});var lv=C,Xt=ne,fv=P,vv=K,dv=$,hv=No,Ln=sa,pv=Xt&&Xt.prototype,gv=!!Xt&&fv(function(){pv.finally.call({then:function(){}},function(){})});lv({target:"Promise",proto:!0,real:!0,forced:gv},{finally:function(e){var t=hv(this,vv("Promise")),r=dv(e);return this.then(r?function(n){return Ln(t,e()).then(function(){return n})}:e,r?function(n){return Ln(t,e()).then(function(){throw n})}:e)}});var yv=Po,bv=yv("Promise","finally"),mv=bv,$v=mv,Sv=$v,Ev=Sv,Pt=ar(Ev),Zt=M,Ov=A,ca=Function.prototype,Tv=Zt&&Object.getOwnPropertyDescriptor,Ir=Ov(ca,"name"),_v=Ir&&function(){}.name==="something",Pv=Ir&&(!Zt||Zt&&Tv(ca,"name").configurable),wv={EXISTS:Ir,PROPER:_v,CONFIGURABLE:Pv},ua={},Iv=ta,Rv=Math.max,Av=Math.min,Cv=function(e,t){var r=Iv(e);return r<0?Rv(r+t,0):Av(r,t)},Nv=de,Lv=Cv,xv=ra,xn=function(e){return function(t,r,n){var o=Nv(t),i=xv(o),s=Lv(n,i),l;if(e&&r!=r){for(;i>s;)if(l=o[s++],l!=l)return!0}else for(;i>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},Dv={includes:xn(!0),indexOf:xn(!1)},jv=w,wt=A,kv=de,Fv=Dv.indexOf,Mv=Er,Dn=jv([].push),Bv=function(e,t){var r=kv(e),n=0,o=[],i;for(i in r)!wt(Mv,i)&&wt(r,i)&&Dn(o,i);for(;t.length>n;)wt(r,i=t[n++])&&(~Fv(o,i)||Dn(o,i));return o},la=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Uv=Bv,Vv=la,Gv=Object.keys||function(t){return Uv(t,Vv)},Kv=M,Hv=Oo,Wv=W,qv=D,Qv=de,zv=Gv;ua.f=Kv&&!Hv?Object.defineProperties:function(t,r){qv(t);for(var n=Qv(r),o=zv(r),i=o.length,s=0,l;i>s;)Wv.f(t,l=o[s++],n[l]);return t};var Yv=D,Jv=ua,jn=la,Xv=Er,Zv=Lo,ed=vr,td=Sr,kn=">",Fn="<",er="prototype",tr="script",fa=td("IE_PROTO"),It=function(){},va=function(e){return Fn+tr+kn+e+Fn+"/"+tr+kn},Mn=function(e){e.write(va("")),e.close();var t=e.parentWindow.Object;return e=null,t},rd=function(){var e=ed("iframe"),t="java"+tr+":",r;return e.style.display="none",Zv.appendChild(e),e.src=String(t),r=e.contentWindow.document,r.open(),r.write(va("document.F=Object")),r.close(),r.F},Ie,De=function(){try{Ie=new ActiveXObject("htmlfile")}catch(t){}De=typeof document!="undefined"?document.domain&&Ie?Mn(Ie):rd():Mn(Ie);for(var e=jn.length;e--;)delete De[er][jn[e]];return De()};Xv[fa]=!0;var da=Object.create||function(t,r){var n;return t!==null?(It[er]=Yv(t),n=new It,It[er]=null,n[fa]=t):n=De(),r===void 0?n:Jv.f(n,r)},nd=P,od=!nd(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),ad=A,id=$,sd=lr,cd=Sr,ud=od,Bn=cd("IE_PROTO"),rr=Object,ld=rr.prototype,ha=ud?rr.getPrototypeOf:function(e){var t=sd(e);if(ad(t,Bn))return t[Bn];var r=t.constructor;return id(r)&&t instanceof r?r.prototype:t instanceof rr?ld:null},fd=P,vd=$,dd=x,hd=da,Un=ha,pd=gr,gd=O,nr=gd("iterator"),pa=!1,L,Rt,At;[].keys&&(At=[].keys(),"next"in At?(Rt=Un(Un(At)),Rt!==Object.prototype&&(L=Rt)):pa=!0);var yd=!dd(L)||fd(function(){var e={};return L[nr].call(e)!==e});yd?L={}:L=hd(L);vd(L[nr])||pd(L,nr,function(){return this});var ga={IteratorPrototype:L,BUGGY_SAFARI_ITERATORS:pa},bd=ga.IteratorPrototype,md=da,$d=Ve,Sd=yr,Ed=ae,Od=function(){return this},Td=function(e,t,r,n){var o=t+" Iterator";return e.prototype=md(bd,{next:$d(+!n,r)}),Sd(e,o,!1,!0),Ed[o]=Od,e},_d=C,Pd=_,ya=wv,wd=Td,Id=ha,Rd=yr,Vn=gr,Ad=O,Gn=ae,ba=ga,Cd=ya.PROPER;ya.CONFIGURABLE;ba.IteratorPrototype;var Re=ba.BUGGY_SAFARI_ITERATORS,Ct=Ad("iterator"),Kn="keys",Ae="values",Hn="entries",Nd=function(){return this},Ld=function(e,t,r,n,o,i,s){wd(r,t,n);var l=function(m){if(m===o&&d)return d;if(!Re&&m in a)return a[m];switch(m){case Kn:return function(){return new r(this,m)};case Ae:return function(){return new r(this,m)};case Hn:return function(){return new r(this,m)}}return function(){return new r(this)}},v=t+" Iterator",f=!1,a=e.prototype,u=a[Ct]||a["@@iterator"]||o&&a[o],d=!Re&&u||l(o),h=t=="Array"&&a.entries||u,g,y,b;if(h&&(g=Id(h.call(new e)),g!==Object.prototype&&g.next&&(Rd(g,v,!0,!0),Gn[v]=Nd)),Cd&&o==Ae&&u&&u.name!==Ae&&(f=!0,d=function(){return Pd(u,this)}),o)if(y={values:l(Ae),keys:i?d:l(Kn),entries:l(Hn)},s)for(b in y)(Re||f||!(b in a))&&Vn(a,b,y[b]);else _d({target:t,proto:!0,forced:Re||f},y);return s&&a[Ct]!==d&&Vn(a,Ct,d,{name:o}),Gn[t]=d,y},xd=function(e,t){return{value:e,done:t}},Dd=de,Wn=ae,ma=Bo;W.f;var jd=Ld,Ce=xd,$a="Array Iterator",kd=ma.set,Fd=ma.getterFor($a);jd(Array,"Array",function(e,t){kd(this,{type:$a,target:Dd(e),index:0,kind:t})},function(){var e=Fd(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,Ce(void 0,!0)):r=="keys"?Ce(n,!1):r=="values"?Ce(t[n],!1):Ce([n,t[n]],!1)},"values");Wn.Arguments=Wn.Array;var Md=fr,Bd=W,Ud=Ve,Vd=function(e,t,r){var n=Md(t);n in e?Bd.f(e,n,Ud(0,r)):e[n]=r},Gd=C,Kd=wr,Hd=Vd;Gd({target:"Object",stat:!0},{fromEntries:function(t){var r={};return Kd(t,function(n,o){Hd(r,n,o)},{AS_ENTRIES:!0}),r}});var Wd=cr,qd=Wd.Object.fromEntries,Qd={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},zd=Qd,Yd=E,Jd=ge,Xd=pe,qn=ae,Zd=O,Qn=Zd("toStringTag");for(var Nt in zd){var zn=Yd[Nt],Lt=zn&&zn.prototype;Lt&&Jd(Lt)!==Qn&&Xd(Lt,Qn,Nt),qn[Nt]=qn.Array}var eh=qd,th=eh,rh=th,nh=rh,oh=ar(nh);const ah=e=>{var t;const{operation:r,custom:n}=e,o=oh(Object.entries(n).map(([i,s])=>{var l,v,f;const a=(l=Ic[i])!==null&&l!==void 0?l:i;let u=s;return s&&(i==="mode"?u=(v=Ac[s])!==null&&v!==void 0?v:s:i==="quality"&&(u=(f=Rc[s])!==null&&f!==void 0?f:s)),[a,u]}));return Object.assign(Object.assign({},e),{operation:(t=wc[r])!==null&&t!==void 0?t:r,custom:o})},or="1.0.41",ih="CIOPGQJGDIHBABABA",Yn={[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]:""};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 sh{constructor(t){this.consequentAuthErrors=0,this.authorized$=new c.ValueSubject(!1),this.params=t}authorize(t){return k(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 k(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=(l,v=this.params.config.requestRetryCount)=>k(this,void 0,void 0,function*(){try{return yield this.params.apiTransport.sendRequest(n,o,i)}catch(f){if(!f||!("error_code"in f)){this.params.error$.next({id:"logRequestUnknown",category:c.ErrorCategory.NETWORK,message:`Unknown ${n} error`,thrown:f});return}const a=f==null?void 0:f.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(),v>0?s(l,v-1):void 0;case U.AUTH_LOGIN:return this.authorized$.next(!1),this.authToken=yield this.refreshAuthToken(),this.sessionKey=yield this._authorizeWithBackoff(),v>0?s(l,v-1):void 0;default:{this.params.error$.next({id:`LogRequest#${a}`,category:c.ErrorCategory.EXTERNAL_API,message:`${n} error`,data:f});return}}}});return s(t)})}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}refreshAuthToken(){return k(this,void 0,void 0,function*(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=Pt(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise})}createLogParams(t){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${or}`,platform:this.params.mobile?"M_WEB":"WEB",items:this.params.config.shorten?t.map(ah):t})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();const t=c.getExponentialDelay(this.consequentAuthErrors,this.params.config.backoff);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{Pt(this._authorize().then(r).catch(n=>this.params.error$.next({id:"AuthorizeBackoff",category:c.ErrorCategory.NETWORK,message:"Otherwise unhandled error in authorization",thrown:n})),()=>this.backoffTimeoutId=0)},t))})}_authorize(){return k(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.params.uuid,client_version:or.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=Pt(this.params.apiTransport.sendRequest(t,r).then(n=>{var o;return(!n||!n.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:c.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=>k(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:c.ErrorCategory.EXTERNAL_API,message:"authorize error",data:n}):this.params.error$.next({id:"AuthorizeUnknown",category:c.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 Jn{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(l){Promise.resolve().then(()=>{throw l})}s.options&&s.options.once&&this.removeEventListener(t.type,s.callback)}return!t.defaultPrevented}}class Sa extends Jn{constructor(){super(),this.listeners||Jn.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 ch{constructor(){Object.defineProperty(this,"signal",{value:new Sa,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&&(ch.prototype[Symbol.toStringTag]="AbortController",Sa.prototype[Symbol.toStringTag]="AbortSignal");function Ea(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 uh(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:r=t.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=e;if(!Ea({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(f,a){let u;a&&a.signal&&(u=a.signal,delete a.signal);const d=new r(f,a);return u&&Object.defineProperty(d,"signal",{writable:!1,enumerable:!1,configurable:!0,value:u}),d},i.prototype=r.prototype);const s=t;return{fetch:(v,f)=>{const a=i&&i.prototype.isPrototypeOf(v)?v.signal:f?f.signal:void 0;if(a){let u;try{u=new DOMException("Aborted","AbortError")}catch(h){u=new Error("Aborted"),u.name="AbortError"}if(a.aborted)return Promise.reject(u);const d=new Promise((h,g)=>{a.addEventListener("abort",()=>g(u),{once:!0})});return f&&f.signal&&delete f.signal,Promise.race([d,s(v,f)])}return s(v,f)},Request:i}}const Rr=Ea({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Oa=Rr?uh({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,Xn=Rr?Oa.fetch:window.fetch;Rr?Oa.Request:window.Request;class lh{constructor(t){this.params=t,this.apiKey=t.apiKey,this.apiEnv=t.config.apiEnv,this.apiBaseUrl=Yn[this.apiEnv],this.timeSynchronisation=t.timeSynchronisation,this.isApiBaseUrlFetched=!1}resolveApiBaseUrl(){var t;return k(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 Xn(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:c.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),Yn[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(s){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:c.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:s,data:{method:t,params:r}})}return!1}sendRequest(t,r,n){return k(this,void 0,void 0,function*(){const o=c.now(),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:c.ErrorCategory.NETWORK,message:"Request failed",thrown:s});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:c.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:s,data:{method:t,params:r,sessionKey:n,time:c.now()-o}})};return this.apiBaseUrl=yield this.resolveApiBaseUrl(),Xn(`${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 l,v;const f=Number(s.headers.get("content-length"))===0,a=new Date((l=s.headers.get("date"))!==null&&l!==void 0?l:"").getTime(),u=c.now()-o;if(isFinite(a)&&((v=this.timeSynchronisation)===null||v===void 0||v.addServerTime(a,u)),!f)return s.json().then(d=>Object.prototype.hasOwnProperty.call(d,"error_msg")?Promise.reject(d):d,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 Ne="onestat_events",xt=e=>t=>t.timestamp+e>=c.now();class fh{constructor(t){this.unsaltedStorage=[],this.isPaused=!1,this.isUrgent=n=>{const{operation:o,custom:{param:i}}=n;return["action_stop","close_at_empty_buffer"].includes(o)||o==="watch_coverage_record"&&i==="0-0"},this.params=t,this.api=t.api,this.error$=t.error$,this.userSalt=t.userSalt,this.loggerDebugLog=t.debugLogger.createComponentLog("stat logger"),this.firstFlush=Ar(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});const r=c.safeStorage.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=Ar(()=>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:c.ErrorCategory.WTF,message:(t=String(r))!==null&&t!==void 0?t:"Unknown logger error",thrown:r})}}readFromStorage(){const t=c.safeStorage.get(Ne);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(xt(this.params.config.storageExpiration));c.safeStorage.set(Ne,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(xt(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}const t=this.readFromStorage();delete t[this.userSalt],c.safeStorage.set(Ne,JSON.stringify(t))}housekeepStorage(){const t=this.readFromStorage();for(const[r,n]of Object.entries(t)){const o=n.filter(xt(this.params.config.storageExpiration));o.length?t[r]=o:delete t[r],this.loggerDebugLog({message:`${n.length} retrieved from storage, ${o.length} of them actual`})}c.safeStorage.set(Ne,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.loggerDebugLog({message:`Flushing ${r.length} events through beacon`}),this.api.logBeacon(r)):(this.loggerDebugLog({message:`Flushing ${r.length} events`}),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 vh=()=>{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}},dh=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],Zn=e=>e&&{[p.HttpConnectionType.HTTP1]:exports.ConnectionType.HTTP1,[p.HttpConnectionType.HTTP2]:exports.ConnectionType.HTTP2,[p.HttpConnectionType.QUIC]:exports.ConnectionType.HTTP3}[e],hh=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 c.assertNever(e)}},Dt=e=>{if(e!==void 0)switch(e){case p.Surface.NONE:case p.Surface.INLINE:return;case p.Surface.FULLSCREEN:return V.FULLSCREEN;case p.Surface.SECOND_SCREEN:return V.CHROMECAST;case p.Surface.PIP:return V.PIP;default:return c.assertNever(e)}},ph=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 gh{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 yh=()=>Math.floor(Math.random()*Math.pow(2,32)).toString(36).padStart(8,"0"),bh=(e,t)=>new c.Observable(r=>{const n=new c.Subscription,o=c.merge(c.fromEvent(window,"beforeunload"),e.events.willDestruct$),i=new c.ValueSubject(void 0);let s;n.add(e.info.isLive$.pipe(c.filterChanged()).subscribe(j=>{s&&(s.unsubscribe(),i.next(void 0)),j?s=e.info.liveTime$.pipe(c.map(Ye=>Ye&&Ye/1e3)).subscribe(i):s=e.info.position$.subscribe(i),n.add(s)}));const{playing$:l,paused$:v}=e.events,f=e.events.willSeek$.pipe(c.filter(()=>e.info.playbackState$.getValue()===p.PlaybackState.PLAYING)),a=e.events.seeked$.pipe(c.filter(()=>e.info.playbackState$.getValue()===p.PlaybackState.PLAYING));let u=!1;const d=new c.Subject;n.add(f.subscribe(()=>{u||d.next(),u=!0})),n.add(a.subscribe(()=>u=!1));const h=c.merge(l,a),g=c.merge(v,d,o,e.events.looped$);let y;const b=()=>y=i.getValue(),m=()=>{const j=i.getValue();c.isNullable(y)||y===j||c.isNullable(j)||(r.next({from:y,to:j}),y=void 0)},S=()=>{m(),b()};if(n.add(h.subscribe(b)),n.add(g.subscribe(m)),t.forceInterval&&isFinite(t.forceInterval)){let j=0;n.add(h.subscribe(()=>j=window.setTimeout(S,t.forceInterval))),n.add(g.subscribe(()=>window.clearTimeout(j)))}return n}),mh="_one-stat_",jt=`${mh}uuid`,kt=()=>{const e=new c.Subscription;return{subscription:e,subscribe:(t,r)=>{t&&e.add(t.subscribe(r))}}};class $h{constructor(t,r){var n,o;this.subscription=new c.Subscription,this.debugLogger=new c.Logger,this.oneStatDebugLog=this.debugLogger.createComponentLog("onestat"),this.vsid$=new c.ValueSubject(void 0),this.seekAction$=new c.ValueSubject(exports.SeekAction.UNKNOWN),this.statContext=t,this.config=Nc((n=r.config)!==null&&n!==void 0?n:{}),c.isNonNullable(r.apiEnv)&&(this.config.apiEnv=r.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new gh);const i=new c.Subject;this.experimental={error$:i};const s=c.safeStorage.get(jt);s?s.startsWith('"')&&s.endsWith('"')?(this.uuid=Pc(s,'"',""),c.safeStorage.set(jt,this.uuid)):this.uuid=s:(this.uuid=Lc(),c.safeStorage.set(jt,this.uuid)),this.resetViewSession();const l=new lh({apiKey:ih,config:this.config,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new sh({config:this.config,apiTransport:l,refreshAuthToken:r.refreshAuthToken,mobile:(o=this.statContext.mobile)!==null&&o!==void 0?o:!1,uuid:this.uuid,error$:i}),this.logger=new fh({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:i,userSalt:r.userSalt});const{isEmbed:v,host:f}=vh();this.isEmbed=v,this.embedParent=f,this.subscribe()}updateContext(t){this.statContext=Object.assign(Object.assign({},this.statContext),t)}attachTo(t){const r=new c.Subscription,n=(a,u)=>r.add(a.subscribe(u));n(t.events.willStart$,()=>{const a=t.info.position$.getValue();this.logActionPlay({position:a}),this.statContext.projectId&&this.logActionPlayWithProjectId({position:a})}),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(bh(t,{forceInterval:this.config.watchCoverageInterval}),a=>{const u=t.info.isLive$.getValue(),d={start:parseFloat(a.from.toFixed(3)),end:parseFloat(a.to.toFixed(3))};u?this.logWatchCoverageLive(d):this.logWatchCoverageRecord(d)});let o;n(t.info.isStalled$,a=>{a?o=c.now():(c.isNonNullable(o)&&this.logEmptyBuffer({duration:c.now()-o}),o=void 0)});let i=!1;r.add(t.events.fatalError$.pipe(c.once()).subscribe(()=>i=!0)),n(t.events.willStop$,()=>{if(t.info.isStalled$.getValue()){const u=c.isNonNullable(o)?c.now()-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,l,v=!1;n(t.events.firstBytes$,a=>{s=c.now(),this.logFirstBytes({time:a})}),n(t.events.willStart$,()=>l=c.now()),n(t.info.currentBuffer$,a=>{!v&&a&&a.end-a.start>0&&c.isNonNullable(s)&&(this.logPlayerReady({duration:c.now()-s}),v=!0)}),n(t.events.firstFrame$,()=>{c.isNonNullable(s)&&!v&&(this.logPlayerReady({duration:c.now()-s}),v=!0),c.isNonNullable(l)&&this.logFirstFrame({time:c.now()-l})}),n(t.info.atLiveEdge$,a=>this.updateContext({liveEdge:a})),n(c.combine({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:dh(a)})),n(t.info.isAutoQualityEnabled$,a=>this.updateContext({autoQuality:a})),n(t.info.currentFormat$,a=>this.updateContext({contentType:hh(a)})),n(t.info.currentPlaybackRate$,a=>this.updateContext({rate:a})),n(t.info.is3DVideo$,a=>this.updateContext({is3d:a}));let f;return n(t.info.hostname$,a=>{this.updateContext({cdnHostname:a,failover:f!==void 0&&f!==a}),f=a}),n(t.info.throughputEstimation$,a=>this.updateContext({downloadSpeed:a})),n(t.info.httpConnectionType$,a=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:Zn(a)}),this.updateContext({connectionType:Zn(a)})}),n(t.info.httpConnectionReused$,a=>{c.isNullable(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:a}),this.updateContext({connectionReused:a})}),n(t.info.surface$,a=>this.updateContext({mode:Dt(a)})),n(c.combine({current:t.info.currentTextTrack$,available:t.info.availableTextTracks$}),({current:a,available:u})=>{const d=u.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{subscription:r,subscribe:n}=kt();return this.player&&(n(t.actionRewind$,()=>{this.player&&(this.resetViewSession(),this.logActionPlay({position:this.player.info.position$.getValue()}))}),n(t.actionSeek$,this.seekAction$),n(t.inPiP$,o=>{var i;const s=o?V.PIP:Dt((i=this.player)===null||i===void 0?void 0:i.info.surface$.getValue());this.updateContext({mode:s})}),n(t.inFullscreen$,o=>{var i;const s=o?V.FULLSCREEN:Dt((i=this.player)===null||i===void 0?void 0:i.info.surface$.getValue());this.updateContext({mode:s})}),n(t.actionSetSubtitle$,o=>this.updateContext({subtitles:o})),n(t.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(r)),r}attachToAds(t){const{subscription:r,subscribe:n}=kt();return n(t.slotRequested$,()=>this.logAdSlotRequest()),n(t.started$,o=>this.logAdStarted(o)),n(t.paused$,()=>this.logAdPaused()),n(t.resumed$,()=>this.logAdResumed()),n(t.ended$,()=>this.logAdEnded()),n(t.skipped$,()=>this.logAdSkipped()),n(t.clicked$,()=>this.logAdClicked()),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToInteractive(t){const{subscription:r,subscribe:n}=kt();return n(t.click$,o=>this.logInterfaceClick(o)),n(t.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(r),r}authorize(t){return this.api.authorize(t)}pause(){this.logger.pause(),this.oneStatDebugLog({message:"paused"})}resume(){this.logger.resume(),this.oneStatDebugLog({message:"resumed"})}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.oneStatDebugLog({message:"VSID reset"}),this.vsid$.next(yh())}getDeviceId(){return this.uuid}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,i=t.start+o,s=t.end+o;this.log({operation:"watch_coverage_live",param:`${i}-${s}`})}logEmptyBuffer(t){this.log({operation:"empty_buffer",param:String(t.duration)})}logDownloadSpeed(){}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(t){this.log({operation:"adv",param:t})}logAdPaused(){this.log({operation:"adv",param:"pause"})}logAdResumed(){this.log({operation:"adv",param:"resume"})}logAdEnded(){this.log({operation:"adv",param:"ended"})}logAdSkipped(){this.log({operation:"adv",param:"skip"})}logAdClicked(){this.log({operation:"adv",param:"click"})}logInterfaceClick(t){this.log({operation:"player_interface_click",param:t})}logNextMovie(t){this.log({operation:"next_movie",param:String(t)})}subscribe(){this.resubscribeBeforeunload();const t=window.navigator.connection;t&&"onchange"in t&&"effectiveType"in t&&this.subscription.add(c.merge(c.fromEvent(t,"change"),c.observableFrom(["init"])).subscribe(()=>this.updateContext({network:ph(t.effectiveType)}))),this.config.debugLog&&this.debugLogger.log$.subscribe(r=>{console.debug("%c stat ","background:#fa6470;",`component: ${r.component}.`,r.message)})}resubscribeBeforeunload(){var t;(t=this.beforeunloadSubscription)===null||t===void 0||t.unsubscribe(),this.beforeunloadSubscription=c.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))})}logActionPlayWithProjectId(t){this.statContext.projectId&&this.log({operation:"action_play",param:String(Math.round(t.position))},{vid:this.statContext.projectId})}logCloseAtEmptyBuffer(t){this.log({operation:"close_at_empty_buffer",param:String(Math.round(t.duration))})}logActionStop(){this.log({operation:"action_stop"})}log(t,r={}){if(this.config.disabledOperations.includes(t.operation))return;this.oneStatDebugLog({message:`operation ${t.operation} ${t.param}`});const n=this.createLogItem(t,r);this.logger.log(n)}createLogItem({operation:t,param:r,time:n},o={}){var i,s;const l=(s=(i=this.timeSynchronisation)===null||i===void 0?void 0:i.now())!==null&&s!==void 0?s:c.now(),v=this.vsid$.getValue();c.assertNonNullable(v);const f=t==="empty_buffer"||t==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,a=this.statContext.firstConnectionReused;let u,d;if(this.isEmbed){u=this.embedParent;const g=[...new URLSearchParams(location.search).entries()].filter(([y,b])=>this.config.embedUrlParams.includes(y));d=new URLSearchParams(g).toString()}else this.statContext.place==="direct"&&(document.referrer&&(u=new URL(document.referrer).hostname),d=location.href.substring(0,1024));const h=Object.assign({vsid:v,vid:this.statContext.movieId,ct:this.statContext.contentType,place:this.isEmbed?"embed":this.statContext.place,quality:this.statContext.quality,cdn_host:this.statContext.cdnHostname,stat_type:this.statContext.autoplay===!0?ke.AUTO:this.statContext.autoplay===!1?ke.MANUAL:void 0,param:r,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:f,connection_reused:a===!0?N.YES:a===!1?N.NO:void 0,cached_data:this.statContext.cached===!0?N.YES:this.statContext.cached===!1?N.NO:void 0,live:this.statContext.liveEdge?N.YES:void 0,muted:this.statContext.audible===!1?N.YES:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:N.YES,ref_domain:u,direct_url:d,rate:this.statContext.rate===1||c.isNullable(this.statContext.rate)?void 0:this.statContext.rate.toFixed(2),view_360:this.statContext.is3d?1:void 0,aid:this.statContext.albumId,vk_playlist_id:this.statContext.vkPlaylistId},o);for(const g of this.config.disabledCustomFields)delete h[g];return{operation:t,type:1,time:n,network:this.statContext.network,timestamp:l,custom:h}}}exports.OneStat=$h;exports.VERSION=or;
package/es2015.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-statistics v1.0.41-beta.2
3
- * Tue, 10 Oct 2023 08:39:46 GMT
2
+ * @vkontakte/videoplayer-statistics v1.0.41
3
+ * Mon, 16 Oct 2023 13:03:33 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-41/doc/
5
5
  */
6
- import{fillWithDefault as Bo,ValueSubject as Yt,safeStorage as M,getExponentialDelay as Wo,ErrorCategory as w,now as S,assertNever as _n,Observable as Ho,Subscription as xe,merge as Ce,fromEvent as Dt,filterChanged as Ko,map as Go,filter as fr,Subject as Pn,isNullable as xt,isNonNullable as Q,once as Vo,combine as vr,observableFrom as qo}from"@vkontakte/videoplayer-shared/es2015.esm.js";import dr from"lodash/debounce.js";import{Surface as ce,VideoQuality as R,HttpConnectionType as Xe,VideoFormat as $,PlaybackState as hr}from"@vkontakte/videoplayer-core/es2015.esm.js";var N;(function(e){e.PROD="prod",e.VK_ALIAS="vk_alias",e.VIDEOTEST="videotest",e.TEST="test",e.AUTO="auto"})(N||(N={}));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 Le;(function(e){e.AUTO="auto",e.MANUAL=""})(Le||(Le={}));var fe;(function(e){e.HTTP1="http1",e.HTTP2="http2",e.HTTP3="http3"})(fe||(fe={}));var x;(function(e){e[e.YES=1]="YES",e[e.NO=0]="NO"})(x||(x={}));var ee;(function(e){e.EXCELLENT="excellent",e.GOOD="good",e.POOR="poor"})(ee||(ee={}));var W;(function(e){e.PIP="pip",e.FULLSCREEN="fullscreen",e.EXTERNAL="external",e.PREFETCH="prefetch"})(W||(W={}));var Me;(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"})(Me||(Me={}));var pr;(function(e){e.GRAPH_SHOW="iGraphShow",e.GRAPH_HIDE="iGraphHide",e.NEXT_AREA="iNextChapterArea",e.NEXT_BUTTON="iNextChapterBtn",e.WATCH_AGAIN="iWatchAgainBtn"})(pr||(pr={}));const zo={apiEnv:N.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}},Qo=e=>Bo(e,zo);function L(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 Ze=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function wn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Se=function(e){return e&&e.Math==Math&&e},b=Se(typeof globalThis=="object"&&globalThis)||Se(typeof window=="object"&&window)||Se(typeof self=="object"&&self)||Se(typeof Ze=="object"&&Ze)||function(){return this}()||Ze||Function("return this")(),D=function(e){try{return!!e()}catch(t){return!0}},Yo=D,Be=!Yo(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),Jo=Be,An=Function.prototype,gr=An.apply,br=An.call,In=typeof Reflect=="object"&&Reflect.apply||(Jo?br.bind(gr):function(){return br.apply(gr,arguments)}),Rn=Be,Cn=Function.prototype,Lt=Cn.call,Xo=Rn&&Cn.bind.bind(Lt,Lt),I=Rn?Xo:function(e){return function(){return Lt.apply(e,arguments)}},Nn=I,Zo=Nn({}.toString),ei=Nn("".slice),ge=function(e){return ei(Zo(e),8,-1)},ti=ge,ri=I,Dn=function(e){if(ti(e)==="Function")return ri(e)},Mt=typeof document=="object"&&document.all,ni=typeof Mt=="undefined"&&Mt!==void 0,xn={all:Mt,IS_HTMLDDA:ni},Ln=xn,oi=Ln.all,g=Ln.IS_HTMLDDA?function(e){return typeof e=="function"||e===oi}:function(e){return typeof e=="function"},Jt={},ii=D,ie=!ii(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),ai=Be,Ee=Function.prototype.call,_=ai?Ee.bind(Ee):function(){return Ee.apply(Ee,arguments)},Mn={},jn={}.propertyIsEnumerable,kn=Object.getOwnPropertyDescriptor,si=kn&&!jn.call({1:2},1);Mn.f=si?function(t){var r=kn(this,t);return!!r&&r.enumerable}:jn;var Un=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},ci=I,ui=D,li=ge,et=Object,fi=ci("".split),vi=ui(function(){return!et("z").propertyIsEnumerable(0)})?function(e){return li(e)=="String"?fi(e,""):et(e)}:et,be=function(e){return e==null},di=be,hi=TypeError,Xt=function(e){if(di(e))throw hi("Can't call method on "+e);return e},pi=vi,gi=Xt,bi=function(e){return pi(gi(e))},$r=g,Fn=xn,$i=Fn.all,k=Fn.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:$r(e)||e===$i}:function(e){return typeof e=="object"?e!==null:$r(e)},Bn={},tt=Bn,rt=b,mi=g,mr=function(e){return mi(e)?e:void 0},K=function(e,t){return arguments.length<2?mr(tt[e])||mr(rt[e]):tt[e]&&tt[e][t]||rt[e]&&rt[e][t]},yi=I,We=yi({}.isPrototypeOf),He=typeof navigator!="undefined"&&String(navigator.userAgent)||"",Wn=b,nt=He,yr=Wn.process,Sr=Wn.Deno,Er=yr&&yr.versions||Sr&&Sr.version,Tr=Er&&Er.v8,A,je;Tr&&(A=Tr.split("."),je=A[0]>0&&A[0]<4?1:+(A[0]+A[1]));!je&&nt&&(A=nt.match(/Edge\/(\d+)/),(!A||A[1]>=74)&&(A=nt.match(/Chrome\/(\d+)/),A&&(je=+A[1])));var Hn=je,Or=Hn,Si=D,Ei=b,Ti=Ei.String,Kn=!!Object.getOwnPropertySymbols&&!Si(function(){var e=Symbol();return!Ti(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Or&&Or<41}),Oi=Kn,Gn=Oi&&!Symbol.sham&&typeof Symbol.iterator=="symbol",_i=K,Pi=g,wi=We,Ai=Gn,Ii=Object,Vn=Ai?function(e){return typeof e=="symbol"}:function(e){var t=_i("Symbol");return Pi(t)&&wi(t.prototype,Ii(e))},Ri=String,Ke=function(e){try{return Ri(e)}catch(t){return"Object"}},Ci=g,Ni=Ke,Di=TypeError,G=function(e){if(Ci(e))return e;throw Di(Ni(e)+" is not a function")},xi=G,Li=be,Ge=function(e,t){var r=e[t];return Li(r)?void 0:xi(r)},ot=_,it=g,at=k,Mi=TypeError,ji=function(e,t){var r,n;if(t==="string"&&it(r=e.toString)&&!at(n=ot(r,e))||it(r=e.valueOf)&&!at(n=ot(r,e))||t!=="string"&&it(r=e.toString)&&!at(n=ot(r,e)))return n;throw Mi("Can't convert object to primitive value")},qn={exports:{}},ki=!0,_r=b,Ui=Object.defineProperty,Fi=function(e,t){try{Ui(_r,e,{value:t,configurable:!0,writable:!0})}catch(r){_r[e]=t}return t},Bi=b,Wi=Fi,Pr="__core-js_shared__",Hi=Bi[Pr]||Wi(Pr,{}),Zt=Hi,wr=Zt;(qn.exports=function(e,t){return wr[e]||(wr[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 zn=qn.exports,Ki=Xt,Gi=Object,Qn=function(e){return Gi(Ki(e))},Vi=I,qi=Qn,zi=Vi({}.hasOwnProperty),V=Object.hasOwn||function(t,r){return zi(qi(t),r)},Qi=I,Yi=0,Ji=Math.random(),Xi=Qi(1 .toString),Yn=function(e){return"Symbol("+(e===void 0?"":e)+")_"+Xi(++Yi+Ji,36)},Zi=b,ea=zn,Ar=V,ta=Yn,ra=Kn,na=Gn,te=Zi.Symbol,st=ea("wks"),oa=na?te.for||te:te&&te.withoutSetter||ta,P=function(e){return Ar(st,e)||(st[e]=ra&&Ar(te,e)?te[e]:oa("Symbol."+e)),st[e]},ia=_,Ir=k,Rr=Vn,aa=Ge,sa=ji,ca=P,ua=TypeError,la=ca("toPrimitive"),fa=function(e,t){if(!Ir(e)||Rr(e))return e;var r=aa(e,la),n;if(r){if(t===void 0&&(t="default"),n=ia(r,e,t),!Ir(n)||Rr(n))return n;throw ua("Can't convert object to primitive value")}return t===void 0&&(t="number"),sa(e,t)},va=fa,da=Vn,Jn=function(e){var t=va(e,"string");return da(t)?t:t+""},ha=b,Cr=k,jt=ha.document,pa=Cr(jt)&&Cr(jt.createElement),Xn=function(e){return pa?jt.createElement(e):{}},ga=ie,ba=D,$a=Xn,Zn=!ga&&!ba(function(){return Object.defineProperty($a("div"),"a",{get:function(){return 7}}).a!=7}),ma=ie,ya=_,Sa=Mn,Ea=Un,Ta=bi,Oa=Jn,_a=V,Pa=Zn,Nr=Object.getOwnPropertyDescriptor;Jt.f=ma?Nr:function(t,r){if(t=Ta(t),r=Oa(r),Pa)try{return Nr(t,r)}catch(n){}if(_a(t,r))return Ea(!ya(Sa.f,t,r),t[r])};var wa=D,Aa=g,Ia=/#|\.prototype\./,$e=function(e,t){var r=Ca[Ra(e)];return r==Da?!0:r==Na?!1:Aa(t)?wa(t):!!t},Ra=$e.normalize=function(e){return String(e).replace(Ia,".").toLowerCase()},Ca=$e.data={},Na=$e.NATIVE="N",Da=$e.POLYFILL="P",eo=$e,Dr=Dn,xa=G,La=Be,Ma=Dr(Dr.bind),Ve=function(e,t){return xa(e),t===void 0?e:La?Ma(e,t):function(){return e.apply(t,arguments)}},qe={},ja=ie,ka=D,Ua=ja&&ka(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),Fa=k,Ba=String,Wa=TypeError,q=function(e){if(Fa(e))return e;throw Wa(Ba(e)+" is not an object")},Ha=ie,Ka=Zn,Ga=Ua,Te=q,xr=Jn,Va=TypeError,ct=Object.defineProperty,qa=Object.getOwnPropertyDescriptor,ut="enumerable",lt="configurable",ft="writable";qe.f=Ha?Ga?function(t,r,n){if(Te(t),r=xr(r),Te(n),typeof t=="function"&&r==="prototype"&&"value"in n&&ft in n&&!n[ft]){var o=qa(t,r);o&&o[ft]&&(t[r]=n.value,n={configurable:lt in n?n[lt]:o[lt],enumerable:ut in n?n[ut]:o[ut],writable:!1})}return ct(t,r,n)}:ct:function(t,r,n){if(Te(t),r=xr(r),Te(n),Ka)try{return ct(t,r,n)}catch(o){}if("get"in n||"set"in n)throw Va("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var za=ie,Qa=qe,Ya=Un,ze=za?function(e,t,r){return Qa.f(e,t,Ya(1,r))}:function(e,t,r){return e[t]=r,e},Oe=b,Ja=In,Xa=Dn,Za=g,es=Jt.f,ts=eo,Y=Bn,rs=Ve,J=ze,Lr=V,ns=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 Ja(e,this,arguments)};return t.prototype=e.prototype,t},U=function(e,t){var r=e.target,n=e.global,o=e.stat,a=e.proto,s=n?Oe:o?Oe[r]:(Oe[r]||{}).prototype,f=n?Y:Y[r]||J(Y,r,{})[r],u=f.prototype,c,i,l,d,v,h,p,m,z;for(d in t)c=ts(n?d:r+(o?".":"#")+d,e.forced),i=!c&&s&&Lr(s,d),h=f[d],i&&(e.dontCallGetSet?(z=es(s,d),p=z&&z.value):p=s[d]),v=i&&p?p:t[d],!(i&&typeof h==typeof v)&&(e.bind&&i?m=rs(v,Oe):e.wrap&&i?m=ns(v):a&&Za(v)?m=Xa(v):m=v,(e.sham||v&&v.sham||h&&h.sham)&&J(m,"sham",!0),J(f,d,m),a&&(l=r+"Prototype",Lr(Y,l)||J(Y,l,{}),J(Y[l],d,v),e.real&&u&&(c||!u[d])&&J(u,d,v)))},os=k,is=ge,as=P,ss=as("match"),cs=function(e){var t;return os(e)&&((t=e[ss])!==void 0?!!t:is(e)=="RegExp")},us=P,ls=us("toStringTag"),to={};to[ls]="z";var er=String(to)==="[object z]",fs=er,vs=g,Ne=ge,ds=P,hs=ds("toStringTag"),ps=Object,gs=Ne(function(){return arguments}())=="Arguments",bs=function(e,t){try{return e[t]}catch(r){}},Qe=fs?Ne:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=bs(t=ps(e),hs))=="string"?r:gs?Ne(t):(n=Ne(t))=="Object"&&vs(t.callee)?"Arguments":n},$s=Qe,ms=String,ys=function(e){if($s(e)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return ms(e)},Ss=q,Es=function(){var e=Ss(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},Ts=_,Os=V,_s=We,Ps=Es,Mr=RegExp.prototype,ws=function(e){var t=e.flags;return t===void 0&&!("flags"in Mr)&&!Os(e,"flags")&&_s(Mr,e)?Ts(Ps,e):t},tr=I,As=Qn,Is=Math.floor,vt=tr("".charAt),Rs=tr("".replace),dt=tr("".slice),Cs=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Ns=/\$([$&'`]|\d{1,2})/g,Ds=function(e,t,r,n,o,a){var s=r+e.length,f=n.length,u=Ns;return o!==void 0&&(o=As(o),u=Cs),Rs(a,u,function(c,i){var l;switch(vt(i,0)){case"$":return"$";case"&":return e;case"`":return dt(t,0,r);case"'":return dt(t,s);case"<":l=o[dt(i,1,-1)];break;default:var d=+i;if(d===0)return c;if(d>f){var v=Is(d/10);return v===0?c:v<=f?n[v-1]===void 0?vt(i,1):n[v-1]+vt(i,1):c}l=n[d-1]}return l===void 0?"":l})},xs=U,Ls=_,rr=I,jr=Xt,Ms=g,js=be,ks=cs,X=ys,Us=Ge,Fs=ws,Bs=Ds,Ws=P,Hs=Ws("replace"),Ks=TypeError,ro=rr("".indexOf),Gs=rr("".replace),kr=rr("".slice),Vs=Math.max,Ur=function(e,t,r){return r>e.length?-1:t===""?r:ro(e,t,r)};xs({target:"String",proto:!0},{replaceAll:function(t,r){var n=jr(this),o,a,s,f,u,c,i,l,d,v=0,h=0,p="";if(!js(t)){if(o=ks(t),o&&(a=X(jr(Fs(t))),!~ro(a,"g")))throw Ks("`.replaceAll` does not allow non-global regexes");if(s=Us(t,Hs),s)return Ls(s,t,n,r);if(o)return Gs(X(n),t,r)}for(f=X(n),u=X(t),c=Ms(r),c||(r=X(r)),i=u.length,l=Vs(1,i),v=Ur(f,u,0);v!==-1;)d=c?X(r(u,v,f)):Bs(u,f,v,[],void 0,r),p+=kr(f,h,v)+d,h=v+i,v=Ur(f,u,v+l);return h<f.length&&(p+=kr(f,h)),p}});var qs=K,no=qs,zs=no,Qs=zs("String","replaceAll"),Ys=Qs,Js=Ys,Xs=Js,Zs=Xs,ec=wn(Zs),tc=ge,Ye=typeof process!="undefined"&&tc(process)=="process",rc=ze,nc=function(e,t,r,n){return n&&n.enumerable?e[t]=r:rc(e,t,r),e},oc=er,ic=Qe,ac=oc?{}.toString:function(){return"[object "+ic(this)+"]"},sc=er,cc=qe.f,uc=ze,lc=V,fc=ac,vc=P,Fr=vc("toStringTag"),dc=function(e,t,r,n){if(e){var o=r?e:e.prototype;lc(o,Fr)||cc(o,Fr,{configurable:!0,value:t}),n&&!sc&&uc(o,"toString",fc)}},hc=qe,pc=function(e,t,r){return hc.f(e,t,r)},gc=K,bc=pc,$c=P,mc=ie,Br=$c("species"),yc=function(e){var t=gc(e);mc&&t&&!t[Br]&&bc(t,Br,{configurable:!0,get:function(){return this}})},Sc=We,Ec=TypeError,Tc=function(e,t){if(Sc(t,e))return e;throw Ec("Incorrect invocation")},Oc=I,_c=g,kt=Zt,Pc=Oc(Function.toString);_c(kt.inspectSource)||(kt.inspectSource=function(e){return Pc(e)});var oo=kt.inspectSource,wc=I,Ac=D,io=g,Ic=Qe,Rc=K,Cc=oo,ao=function(){},Nc=[],so=Rc("Reflect","construct"),nr=/^\s*(?:class|function)\b/,Dc=wc(nr.exec),xc=!nr.exec(ao),ue=function(t){if(!io(t))return!1;try{return so(ao,Nc,t),!0}catch(r){return!1}},co=function(t){if(!io(t))return!1;switch(Ic(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return xc||!!Dc(nr,Cc(t))}catch(r){return!0}};co.sham=!0;var Lc=!so||Ac(function(){var e;return ue(ue.call)||!ue(Object)||!ue(function(){e=!0})||e})?co:ue,Mc=Lc,jc=Ke,kc=TypeError,Uc=function(e){if(Mc(e))return e;throw kc(jc(e)+" is not a constructor")},Wr=q,Fc=Uc,Bc=be,Wc=P,Hc=Wc("species"),uo=function(e,t){var r=Wr(e).constructor,n;return r===void 0||Bc(n=Wr(r)[Hc])?t:Fc(n)},Kc=K,Gc=Kc("document","documentElement"),Vc=I,qc=Vc([].slice),zc=TypeError,Qc=function(e,t){if(e<t)throw zc("Not enough arguments");return e},Yc=He,lo=/(?:ipad|iphone|ipod).*applewebkit/i.test(Yc),E=b,Jc=In,Xc=Ve,Hr=g,Zc=V,fo=D,Kr=Gc,eu=qc,Gr=Xn,tu=Qc,ru=lo,nu=Ye,Ut=E.setImmediate,Ft=E.clearImmediate,ou=E.process,ht=E.Dispatch,iu=E.Function,Vr=E.MessageChannel,au=E.String,pt=0,ve={},qr="onreadystatechange",he,F,gt,bt;fo(function(){he=E.location});var or=function(e){if(Zc(ve,e)){var t=ve[e];delete ve[e],t()}},$t=function(e){return function(){or(e)}},zr=function(e){or(e.data)},Qr=function(e){E.postMessage(au(e),he.protocol+"//"+he.host)};(!Ut||!Ft)&&(Ut=function(t){tu(arguments.length,1);var r=Hr(t)?t:iu(t),n=eu(arguments,1);return ve[++pt]=function(){Jc(r,void 0,n)},F(pt),pt},Ft=function(t){delete ve[t]},nu?F=function(e){ou.nextTick($t(e))}:ht&&ht.now?F=function(e){ht.now($t(e))}:Vr&&!ru?(gt=new Vr,bt=gt.port2,gt.port1.onmessage=zr,F=Xc(bt.postMessage,bt)):E.addEventListener&&Hr(E.postMessage)&&!E.importScripts&&he&&he.protocol!=="file:"&&!fo(Qr)?(F=Qr,E.addEventListener("message",zr,!1)):qr in Gr("script")?F=function(e){Kr.appendChild(Gr("script"))[qr]=function(){Kr.removeChild(this),or(e)}}:F=function(e){setTimeout($t(e),0)});var vo={set:Ut,clear:Ft},ho=function(){this.head=null,this.tail=null};ho.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 po=ho,su=He,cu=/ipad|iphone|ipod/i.test(su)&&typeof Pebble!="undefined",uu=He,lu=/web0s(?!.*chrome)/i.test(uu),H=b,Yr=Ve,fu=Jt.f,mt=vo.set,vu=po,du=lo,hu=cu,pu=lu,yt=Ye,Jr=H.MutationObserver||H.WebKitMutationObserver,Xr=H.document,Zr=H.process,_e=H.Promise,en=fu(H,"queueMicrotask"),Bt=en&&en.value,Z,St,Et,Pe,tn;if(!Bt){var we=new vu,Ae=function(){var e,t;for(yt&&(e=Zr.domain)&&e.exit();t=we.get();)try{t()}catch(r){throw we.head&&Z(),r}e&&e.enter()};!du&&!yt&&!pu&&Jr&&Xr?(St=!0,Et=Xr.createTextNode(""),new Jr(Ae).observe(Et,{characterData:!0}),Z=function(){Et.data=St=!St}):!hu&&_e&&_e.resolve?(Pe=_e.resolve(void 0),Pe.constructor=_e,tn=Yr(Pe.then,Pe),Z=function(){tn(Ae)}):yt?Z=function(){Zr.nextTick(Ae)}:(mt=Yr(mt,H),Z=function(){mt(Ae)}),Bt=function(e){we.head||Z(),we.add(e)}}var gu=Bt,bu=function(e,t){try{arguments.length==1?console.error(e):console.error(e,t)}catch(r){}},ir=function(e){try{return{error:!1,value:e()}}catch(t){return{error:!0,value:t}}},$u=b,mu=g,rn=$u.WeakMap,yu=mu(rn)&&/native code/.test(String(rn)),Su=zn,Eu=Yn,nn=Su("keys"),Tu=function(e){return nn[e]||(nn[e]=Eu(e))},Ou=yu,go=b,_u=k,Pu=ze,Tt=V,Ot=Zt,wu=Tu,on="Object already initialized",Wt=go.TypeError,Au=go.WeakMap,ke,pe,Ue,Iu=function(e){return Ue(e)?pe(e):ke(e,{})},Ru=function(e){return function(t){var r;if(!_u(t)||(r=pe(t)).type!==e)throw Wt("Incompatible receiver, "+e+" required");return r}};if(Ou||Ot.state){var C=Ot.state||(Ot.state=new Au);C.get=C.get,C.has=C.has,C.set=C.set,ke=function(e,t){if(C.has(e))throw Wt(on);return t.facade=e,C.set(e,t),t},pe=function(e){return C.get(e)||{}},Ue=function(e){return C.has(e)}}else{var le=wu("state");ke=function(e,t){if(Tt(e,le))throw Wt(on);return t.facade=e,Pu(e,le,t),t},pe=function(e){return Tt(e,le)?e[le]:{}},Ue=function(e){return Tt(e,le)}}var Cu={set:ke,get:pe,has:Ue,enforce:Iu,getterFor:Ru},Nu=b,ae=Nu.Promise,bo=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",Du=bo,xu=Ye,Lu=!Du&&!xu&&typeof window=="object"&&typeof document=="object",Mu=b,de=ae,ju=g,ku=eo,Uu=oo,Fu=P,Bu=Lu,Wu=bo,_t=Hn,an=de&&de.prototype,Hu=Fu("species"),Ht=!1,$o=ju(Mu.PromiseRejectionEvent),Ku=ku("Promise",function(){var e=Uu(de),t=e!==String(de);if(!t&&_t===66||!(an.catch&&an.finally))return!0;if(!_t||_t<51||!/native code/.test(e)){var r=new de(function(a){a(1)}),n=function(a){a(function(){},function(){})},o=r.constructor={};if(o[Hu]=n,Ht=r.then(function(){})instanceof n,!Ht)return!0}return!t&&(Bu||Wu)&&!$o}),me={CONSTRUCTOR:Ku,REJECTION_EVENT:$o,SUBCLASSING:Ht},se={},sn=G,Gu=TypeError,Vu=function(e){var t,r;this.promise=new e(function(n,o){if(t!==void 0||r!==void 0)throw Gu("Bad Promise constructor");t=n,r=o}),this.resolve=sn(t),this.reject=sn(r)};se.f=function(e){return new Vu(e)};var qu=U,Fe=Ye,j=b,ye=_,zu=nc,Qu=dc,Yu=yc,Ju=G,Kt=g,Xu=k,Zu=Tc,el=uo,mo=vo.set,ar=gu,tl=bu,rl=ir,nl=po,yo=Cu,Gt=ae,sr=me,So=se,Je="Promise",Eo=sr.CONSTRUCTOR,ol=sr.REJECTION_EVENT;sr.SUBCLASSING;var Pt=yo.getterFor(Je),il=yo.set,al=Gt&&Gt.prototype,re=Gt,wt=al,To=j.TypeError,Vt=j.document,cr=j.process,qt=So.f,sl=qt,cl=!!(Vt&&Vt.createEvent&&j.dispatchEvent),Oo="unhandledrejection",ul="rejectionhandled",cn=0,_o=1,ll=2,ur=1,Po=2,Ie,un,fl,wo=function(e){var t;return Xu(e)&&Kt(t=e.then)?t:!1},Ao=function(e,t){var r=t.value,n=t.state==_o,o=n?e.ok:e.fail,a=e.resolve,s=e.reject,f=e.domain,u,c,i;try{o?(n||(t.rejection===Po&&dl(t),t.rejection=ur),o===!0?u=r:(f&&f.enter(),u=o(r),f&&(f.exit(),i=!0)),u===e.promise?s(To("Promise-chain cycle")):(c=wo(u))?ye(c,u,a,s):a(u)):s(r)}catch(l){f&&!i&&f.exit(),s(l)}},Io=function(e,t){e.notified||(e.notified=!0,ar(function(){for(var r=e.reactions,n;n=r.get();)Ao(n,e);e.notified=!1,t&&!e.rejection&&vl(e)}))},Ro=function(e,t,r){var n,o;cl?(n=Vt.createEvent("Event"),n.promise=t,n.reason=r,n.initEvent(e,!1,!0),j.dispatchEvent(n)):n={promise:t,reason:r},!ol&&(o=j["on"+e])?o(n):e===Oo&&tl("Unhandled promise rejection",r)},vl=function(e){ye(mo,j,function(){var t=e.facade,r=e.value,n=ln(e),o;if(n&&(o=rl(function(){Fe?cr.emit("unhandledRejection",r,t):Ro(Oo,t,r)}),e.rejection=Fe||ln(e)?Po:ur,o.error))throw o.value})},ln=function(e){return e.rejection!==ur&&!e.parent},dl=function(e){ye(mo,j,function(){var t=e.facade;Fe?cr.emit("rejectionHandled",t):Ro(ul,t,e.value)})},ne=function(e,t,r){return function(n){e(t,n,r)}},oe=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=ll,Io(e,!0))},zt=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw To("Promise can't be resolved itself");var n=wo(t);n?ar(function(){var o={done:!1};try{ye(n,t,ne(zt,o,e),ne(oe,o,e))}catch(a){oe(o,a,e)}}):(e.value=t,e.state=_o,Io(e,!1))}catch(o){oe({done:!1},o,e)}}};Eo&&(re=function(t){Zu(this,wt),Ju(t),ye(Ie,this);var r=Pt(this);try{t(ne(zt,r),ne(oe,r))}catch(n){oe(r,n)}},wt=re.prototype,Ie=function(t){il(this,{type:Je,done:!1,notified:!1,parent:!1,reactions:new nl,rejection:!1,state:cn,value:void 0})},Ie.prototype=zu(wt,"then",function(t,r){var n=Pt(this),o=qt(el(this,re));return n.parent=!0,o.ok=Kt(t)?t:!0,o.fail=Kt(r)&&r,o.domain=Fe?cr.domain:void 0,n.state==cn?n.reactions.add(o):ar(function(){Ao(o,n)}),o.promise}),un=function(){var e=new Ie,t=Pt(e);this.promise=e,this.resolve=ne(zt,t),this.reject=ne(oe,t)},So.f=qt=function(e){return e===re||e===fl?new un(e):sl(e)});qu({global:!0,constructor:!0,wrap:!0,forced:Eo},{Promise:re});Qu(re,Je,!1,!0);Yu(Je);var Co={},hl=P,pl=Co,gl=hl("iterator"),bl=Array.prototype,$l=function(e){return e!==void 0&&(pl.Array===e||bl[gl]===e)},ml=Math.ceil,yl=Math.floor,Sl=Math.trunc||function(t){var r=+t;return(r>0?yl:ml)(r)},El=Sl,Tl=function(e){var t=+e;return t!==t||t===0?0:El(t)},Ol=Tl,_l=Math.min,Pl=function(e){return e>0?_l(Ol(e),9007199254740991):0},wl=Pl,Al=function(e){return wl(e.length)},Il=Qe,fn=Ge,Rl=be,Cl=Co,Nl=P,Dl=Nl("iterator"),No=function(e){if(!Rl(e))return fn(e,Dl)||fn(e,"@@iterator")||Cl[Il(e)]},xl=_,Ll=G,Ml=q,jl=Ke,kl=No,Ul=TypeError,Fl=function(e,t){var r=arguments.length<2?kl(e):t;if(Ll(r))return Ml(xl(r,e));throw Ul(jl(e)+" is not iterable")},Bl=_,vn=q,Wl=Ge,Hl=function(e,t,r){var n,o;vn(e);try{if(n=Wl(e,"return"),!n){if(t==="throw")throw r;return r}n=Bl(n,e)}catch(a){o=!0,n=a}if(t==="throw")throw r;if(o)throw n;return vn(n),r},Kl=Ve,Gl=_,Vl=q,ql=Ke,zl=$l,Ql=Al,dn=We,Yl=Fl,Jl=No,hn=Hl,Xl=TypeError,De=function(e,t){this.stopped=e,this.result=t},pn=De.prototype,Do=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=Kl(t,n),c,i,l,d,v,h,p,m=function(T){return c&&hn(c,"normal",T),new De(!0,T)},z=function(T){return o?(Vl(T),f?u(T[0],T[1],m):u(T[0],T[1])):f?u(T,m):u(T)};if(a)c=e.iterator;else if(s)c=e;else{if(i=Jl(e),!i)throw Xl(ql(e)+" is not iterable");if(zl(i)){for(l=0,d=Ql(e);d>l;l++)if(v=z(e[l]),v&&dn(pn,v))return v;return new De(!1)}c=Yl(e,i)}for(h=a?e.next:c.next;!(p=Gl(h,c)).done;){try{v=z(p.value)}catch(T){hn(c,"throw",T)}if(typeof v=="object"&&v&&dn(pn,v))return v}return new De(!1)},Zl=P,xo=Zl("iterator"),Lo=!1;try{var ef=0,gn={next:function(){return{done:!!ef++}},return:function(){Lo=!0}};gn[xo]=function(){return this},Array.from(gn,function(){throw 2})}catch(e){}var tf=function(e,t){if(!t&&!Lo)return!1;var r=!1;try{var n={};n[xo]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(o){}return r},rf=ae,nf=tf,of=me.CONSTRUCTOR,Mo=of||!nf(function(e){rf.all(e).then(void 0,function(){})}),af=U,sf=_,cf=G,uf=se,lf=ir,ff=Do,vf=Mo;af({target:"Promise",stat:!0,forced:vf},{all:function(t){var r=this,n=uf.f(r),o=n.resolve,a=n.reject,s=lf(function(){var f=cf(r.resolve),u=[],c=0,i=1;ff(t,function(l){var d=c++,v=!1;i++,sf(f,r,l).then(function(h){v||(v=!0,u[d]=h,--i||o(u))},a)}),--i||o(u)});return s.error&&a(s.value),n.promise}});var df=U,hf=me.CONSTRUCTOR,bn=ae;bn&&bn.prototype;df({target:"Promise",proto:!0,forced:hf,real:!0},{catch:function(e){return this.then(void 0,e)}});var pf=U,gf=_,bf=G,$f=se,mf=ir,yf=Do,Sf=Mo;pf({target:"Promise",stat:!0,forced:Sf},{race:function(t){var r=this,n=$f.f(r),o=n.reject,a=mf(function(){var s=bf(r.resolve);yf(t,function(f){gf(s,r,f).then(n.resolve,o)})});return a.error&&o(a.value),n.promise}});var Ef=U,Tf=_,Of=se,_f=me.CONSTRUCTOR;Ef({target:"Promise",stat:!0,forced:_f},{reject:function(t){var r=Of.f(this);return Tf(r.reject,void 0,t),r.promise}});var Pf=q,wf=k,Af=se,jo=function(e,t){if(Pf(e),wf(t)&&t.constructor===e)return t;var r=Af.f(e),n=r.resolve;return n(t),r.promise},If=U,Rf=K,Cf=ki,Nf=ae,Df=me.CONSTRUCTOR,xf=jo,Lf=Rf("Promise"),Mf=!Df;If({target:"Promise",stat:!0,forced:Cf},{resolve:function(t){return xf(Mf&&this===Lf?Nf:this,t)}});var jf=U,Qt=ae,kf=D,Uf=K,Ff=g,Bf=uo,$n=jo,Wf=Qt&&Qt.prototype,Hf=!!Qt&&kf(function(){Wf.finally.call({then:function(){}},function(){})});jf({target:"Promise",proto:!0,real:!0,forced:Hf},{finally:function(e){var t=Bf(this,Uf("Promise")),r=Ff(e);return this.then(r?function(n){return $n(t,e()).then(function(){return n})}:e,r?function(n){return $n(t,e()).then(function(){throw n})}:e)}});var Kf=no,Gf=Kf("Promise","finally"),Vf=Gf,qf=Vf,zf=qf,Qf=zf,At=wn(Qf);function Yf(){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 mn="1.0.41-beta.2",Jf="CIOPGQJGDIHBABABA",yn={[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]:""},Xf="_one-stat_",It=`${Xf}uuid`;var B;(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"})(B||(B={}));class Zf{constructor(t){this.consequentAuthErrors=0,this.authorized$=new Yt(!1),this.params=t;const r=M.get(It);r?r.startsWith('"')&&r.endsWith('"')?(this.uuid=ec(r,'"',""),M.set(It,this.uuid)):this.uuid=r:(this.uuid=Yf(),M.set(It,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),a=(r=this.sessionKey)!==null&&r!==void 0?r:yield this._authorizeWithBackoff();if(!a)return;const s=(f,u=this.params.config.requestRetryCount)=>L(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:w.NETWORK,message:`Unknown ${n} error`,thrown:c});return}const i=c==null?void 0:c.error_code;switch(i){case B.PARAM_SESSION_EXPIRED:case B.PARAM_SESSION_KEY:case B.PARAM_SIGNATURE:return this.authorized$.next(!1),this.sessionKey=yield this._authorizeWithBackoff(),u>0?s(f,u-1):void 0;case B.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:w.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=At(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise})}createLogParams(t){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${mn}`,platform:this.params.mobile?"M_WEB":"WEB",items:t})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();const t=Wo(this.consequentAuthErrors,this.params.config.backoff);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{At(this._authorize().then(r).catch(n=>this.params.error$.next({id:"AuthorizeBackoff",category:w.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:mn.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=At(this.params.apiTransport.sendRequest(t,r).then(n=>{var o;return(!n||!n.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:w.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 B.AUTH_LOGIN:return this.authToken=yield this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:w.EXTERNAL_API,message:"authorize error",data:n}):this.params.error$.next({id:"AuthorizeUnknown",category:w.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 Sn{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 ko extends Sn{constructor(){super(),this.listeners||Sn.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 ev{constructor(){Object.defineProperty(this,"signal",{value:new ko,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&&(ev.prototype[Symbol.toStringTag]="AbortController",ko.prototype[Symbol.toStringTag]="AbortSignal");function Uo(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function tv(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:r=t.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=e;if(!Uo({fetch:t,Request:r,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o}))return{fetch:t,Request: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 d=new r(c,i);return l&&Object.defineProperty(d,"signal",{writable:!1,enumerable:!1,configurable:!0,value:l}),d},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(v){l=new Error("Aborted"),l.name="AbortError"}if(i.aborted)return Promise.reject(l);const d=new Promise((v,h)=>{i.addEventListener("abort",()=>h(l),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([d,s(u,c)])}return s(u,c)},Request:a}}const lr=Uo({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Fo=lr?tv({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,En=lr?Fo.fetch:window.fetch;lr?Fo.Request:window.Request;class rv{constructor(t){this.params=t,this.apiKey=t.apiKey,this.apiEnv=t.config.apiEnv,this.apiBaseUrl=yn[this.apiEnv],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 En(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:w.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),yn[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}),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:w.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=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:w.NETWORK,message:"Request failed",thrown:s});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:w.NETWORK,message:"Unhandled request error",thrown:s,data:{method:t,params:r,sessionKey:n,time:S()-o}})};return this.apiBaseUrl=yield this.resolveApiBaseUrl(),En(`${this.apiBaseUrl}/fb.do`,{method:"post",headers:{"Content-type":"application/x-www-form-urlencoded"},body:this._prepareQueryParams({method:t,queryParams:r,sessionKey:n})}).then(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(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 Re="onestat_events",Rt=e=>t=>t.timestamp+e>=S();class nv{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=dr(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});const r=M.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=dr(()=>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:w.WTF,message:(t=String(r))!==null&&t!==void 0?t:"Unknown logger error",thrown:r})}}readFromStorage(){const t=M.get(Re);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(Rt(this.params.config.storageExpiration));M.set(Re,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(Rt(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}const t=this.readFromStorage();delete t[this.userSalt],M.set(Re,JSON.stringify(t))}housekeepStorage(){const t=this.readFromStorage();for(const[r,n]of Object.entries(t)){const o=n.filter(Rt(this.params.config.storageExpiration));o.length?t[r]=o:delete t[r]}M.set(Re,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 ov=()=>{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}},iv=e=>e&&{[R.INVARIANT]:O.UNKNOWN,[R.Q_144P]:O.Q144P,[R.Q_240P]:O.Q240P,[R.Q_360P]:O.Q360P,[R.Q_480P]:O.Q480P,[R.Q_720P]:O.Q720P,[R.Q_1080P]:O.Q1080P,[R.Q_1440P]:O.Q1440P,[R.Q_2160P]:O.Q2160P,[R.Q_4320P]:O.UNKNOWN}[e],Tn=e=>e&&{[Xe.HTTP1]:fe.HTTP1,[Xe.HTTP2]:fe.HTTP2,[Xe.QUIC]:fe.HTTP3}[e],av=e=>{if(e!==void 0)switch(e){case $.MPEG:return y.MP4;case $.DASH:case $.DASH_LIVE:return y.DASH;case $.DASH_SEP:return y.DASH_SEP;case $.DASH_ONDEMAND:return y.ONDEMAND_DASH;case $.DASH_WEBM:case $.DASH_LIVE_WEBM:return y.WEBM;case $.DASH_WEBM_AV1:return y.AV1;case $.DASH_LIVE_CMAF:return y.ONDEMAND_DASH_LIVE;case $.HLS:case $.HLS_LIVE:return y.HLS;case $.HLS_ONDEMAND:return y.ONDEMAND_HLS;case $.HLS_LIVE_CMAF:return y.ONDEMAND_HLS_LIVE;case $.WEB_RTC_LIVE:return y.WEBRTC;default:return _n(e)}},Ct=e=>{if(e!==void 0)switch(e){case ce.NONE:case ce.INLINE:return;case ce.FULLSCREEN:return W.FULLSCREEN;case ce.SECOND_SCREEN:return W.EXTERNAL;case ce.PIP:return W.PIP;default:return _n(e)}},sv=e=>{switch(e){case"slow-2g":return ee.POOR;case"2g":return ee.POOR;case"3g":return ee.GOOD;case"4g":return ee.EXCELLENT}};class cv{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 On=()=>Math.floor(Math.random()*Math.pow(2,32)).toString(36).padStart(8,"0"),uv=e=>new Ho(t=>{const r=new xe,n=Ce(Dt(window,"beforeunload"),e.events.willDestruct$),o=new Yt(void 0);let a;r.add(e.info.isLive$.pipe(Ko()).subscribe(p=>{a&&(a.unsubscribe(),o.next(void 0)),p?a=e.info.liveTime$.pipe(Go(m=>m&&m/1e3)).subscribe(o):a=e.info.position$.subscribe(o),r.add(a)}));const{playing$:s,paused$:f}=e.events,u=e.events.willSeek$.pipe(fr(()=>e.info.playbackState$.getValue()===hr.PLAYING)),c=e.events.seeked$.pipe(fr(()=>e.info.playbackState$.getValue()===hr.PLAYING));let i=!1;const l=new Pn;r.add(u.subscribe(()=>{i||l.next(),i=!0})),r.add(c.subscribe(()=>i=!1));const d=Ce(s,c),v=Ce(f,l,n,e.events.looped$);let h;return r.add(d.subscribe(()=>h=o.getValue())),r.add(v.subscribe(()=>{const p=o.getValue();xt(h)||h===p||xt(p)||(t.next({from:h,to:p}),h=void 0)})),r}),Nt=()=>{const e=new xe;return{subscription:e,subscribe:(t,r)=>{t&&e.add(t.subscribe(r))}}};class dv{constructor(t,r){var n,o;this.subscription=new xe,this.vsid=On(),this.seekAction$=new Yt(Me.UNKNOWN),this.statContext=t,this.config=Qo((n=r.config)!==null&&n!==void 0?n:{}),Q(r.apiEnv)&&(this.config.apiEnv=r.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new cv);const a=new Pn;this.experimental={error$:a};const s=new rv({apiKey:Jf,config:this.config,error$:a,timeSynchronisation:this.timeSynchronisation});this.api=new Zf({config:this.config,apiTransport:s,refreshAuthToken:r.refreshAuthToken,mobile:(o=this.statContext.mobile)!==null&&o!==void 0?o:!1,error$:a}),this.logger=new nv({config:this.config,api:this.api,error$:a,userSalt:r.userSalt});const{isEmbed:f,host:u}=ov();this.isEmbed=f,this.embedParent=u,this.subscribe()}updateContext(t){this.statContext=Object.assign(Object.assign({},this.statContext),t)}attachTo(t){const r=new xe,n=(i,l)=>r.add(i.subscribe(l));n(t.events.willStart$,()=>{const i=t.info.position$.getValue();this.logActionPlay({position:i}),this.statContext.projectId&&this.logActionPlayWithProjectId({position:i})}),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(Me.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(uv(t),i=>{const l=t.info.isLive$.getValue(),d={start:parseFloat(i.from.toFixed(3)),end:parseFloat(i.to.toFixed(3))};l?this.logWatchCoverageLive(d):this.logWatchCoverageRecord(d)});let o;n(t.info.isStalled$,i=>{i?o=S():(Q(o)&&this.logEmptyBuffer({duration:S()-o}),o=void 0)});let a=!1;r.add(t.events.fatalError$.pipe(Vo()).subscribe(()=>a=!0)),n(t.events.willStop$,()=>{if(t.info.isStalled$.getValue()){const l=Q(o)?S()-o:void 0;this.logCloseAtEmptyBuffer({duration:l!=null?l:0}),o=void 0}else a||this.logActionStop()}),n(t.events.managedError$,({id:i})=>{this.logError({fatal:!1,errorType:i})}),n(t.events.fatalError$,({id:i})=>{this.logError({fatal:!0,errorType:i})});let s,f,u=!1;n(t.events.firstBytes$,i=>{s=S(),this.logFirstBytes({time:i})}),n(t.events.willStart$,()=>f=S()),n(t.info.currentBuffer$,i=>{!u&&i&&i.end-i.start>0&&Q(s)&&(this.logPlayerReady({duration:S()-s}),u=!0)}),n(t.events.firstFrame$,()=>{Q(s)&&!u&&(this.logPlayerReady({duration:S()-s}),u=!0),Q(f)&&this.logFirstFrame({time:S()-f})}),n(t.info.atLiveEdge$,i=>this.updateContext({liveEdge:i})),n(vr({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:iv(i)})),n(t.info.isAutoQualityEnabled$,i=>this.updateContext({autoQuality:i})),n(t.info.currentFormat$,i=>this.updateContext({contentType:av(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:Tn(i)}),this.updateContext({connectionType:Tn(i)})}),n(t.info.httpConnectionReused$,i=>{xt(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:i}),this.updateContext({connectionReused:i})}),n(t.info.surface$,i=>this.updateContext({mode:Ct(i)})),n(vr({current:t.info.currentTextTrack$,available:t.info.availableTextTracks$}),({current:i,available:l})=>{const d=l.find(({id:v})=>v===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{subscription:r,subscribe:n}=Nt();return this.player&&(n(t.actionRewind$,()=>{this.player&&(this.resetViewSession(),this.logActionPlay({position:this.player.info.position$.getValue()}))}),n(t.actionSeek$,this.seekAction$),n(t.inPiP$,o=>{var a;const s=o?W.PIP:Ct((a=this.player)===null||a===void 0?void 0:a.info.surface$.getValue());this.updateContext({mode:s})}),n(t.inFullscreen$,o=>{var a;const s=o?W.FULLSCREEN:Ct((a=this.player)===null||a===void 0?void 0:a.info.surface$.getValue());this.updateContext({mode:s})}),n(t.actionSetSubtitle$,o=>this.updateContext({subtitles:o})),n(t.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(r)),r}attachToAds(t){const{subscription:r,subscribe:n}=Nt();return n(t.slotRequested$,()=>this.logAdSlotRequest()),n(t.started$,o=>this.logAdStarted(o)),n(t.paused$,()=>this.logAdPaused()),n(t.resumed$,()=>this.logAdResumed()),n(t.ended$,()=>this.logAdEnded()),n(t.skipped$,()=>this.logAdSkipped()),n(t.clicked$,()=>this.logAdClicked()),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToInteractive(t){const{subscription:r,subscribe:n}=Nt();return n(t.click$,o=>this.logInterfaceClick(o)),n(t.nextMovie$,o=>this.logNextMovie(o)),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=On()}setFieldBlacklist(){}logInited(){}logReady(t){this.log({operation:"player_ready",param:String(t.time)})}logStarted(...t){this.logActionPlay(...t)}logPlay(){this.log({operation:"play_toggle"})}logPause(t){this.log({operation:"pause",param:String(Math.round(t.position))})}logSeek(t){this.log({operation:"seek",param:t.action,time:t.time})}logFirstBytes(t){this.log({operation:"first_bytes",param:String(t.time)})}logFirstFrame(t){this.log({operation:"first_frame",param:String(t.time)})}logError(t){this.log({operation:"content_error",param:`${t.fatal?"fatal":"recoverable"}_${t.errorType}`})}logWatchCoverageRecord(t){this.log({operation:"watch_coverage_record",param:`${t.start}-${t.end}`})}logWatchCoverageLive(t){var r,n;const o=(n=(r=this.timeSynchronisation)===null||r===void 0?void 0:r.getOffset())!==null&&n!==void 0?n:0,a=t.start+o,s=t.end+o;this.log({operation:"watch_coverage_live",param:`${a}-${s}`})}logEmptyBuffer(t){this.log({operation:"empty_buffer",param:String(t.duration)})}logDownloadSpeed(){}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(t){this.log({operation:"adv",param:t})}logAdPaused(){this.log({operation:"adv",param:"pause"})}logAdResumed(){this.log({operation:"adv",param:"resume"})}logAdEnded(){this.log({operation:"adv",param:"ended"})}logAdSkipped(){this.log({operation:"adv",param:"skip"})}logAdClicked(){this.log({operation:"adv",param:"click"})}logInterfaceClick(t){this.log({operation:"player_interface_click",param:t})}logNextMovie(t){this.log({operation:"next_movie",param:String(t)})}subscribe(){this.resubscribeBeforeunload();const t=window.navigator.connection;t&&"onchange"in t&&"effectiveType"in t&&this.subscription.add(Ce(Dt(t,"change"),qo(["init"])).subscribe(()=>this.updateContext({network:sv(t.effectiveType)})))}resubscribeBeforeunload(){var t;(t=this.beforeunloadSubscription)===null||t===void 0||t.unsubscribe(),this.beforeunloadSubscription=Dt(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))})}logActionPlayWithProjectId(t){if(!this.statContext.projectId)return;const r=this.createLogItem({operation:"action_play",param:String(Math.round(t.position))});r.custom.vid=this.statContext.projectId,this.logger.log(r)}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?Le.AUTO:this.statContext.autoplay===!1?Le.MANUAL:void 0,param:r,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:f,connection_reused:u===!0?x.YES:u===!1?x.NO:void 0,cached_data:this.statContext.cached===!0?x.YES:this.statContext.cached===!1?x.NO:void 0,live:this.statContext.liveEdge?x.YES:void 0,muted:this.statContext.audible===!1?x.YES:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:x.YES,ref_domain:this.isEmbed?this.embedParent:this.statContext.refUrl,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{N as ApiEnv,fe as ConnectionType,y as ContentType,pr as InteractiveInterfaceClick,dv as OneStat,O as Quality,Me as SeekAction,mn as VERSION};
6
+ import{fillWithDefault as Wo,ValueSubject as We,getExponentialDelay as qo,ErrorCategory as A,now as T,safeStorage as K,assertNever as ya,Observable as zo,Subscription as qe,merge as Ge,fromEvent as Zt,filterChanged as Yo,map as Qo,filter as Hr,Subject as Sa,isNullable as ze,Logger as Jo,isNonNullable as Z,once as Xo,combine as Wr,observableFrom as Zo,assertNonNullable as ei}from"@vkontakte/videoplayer-shared/es2015.esm.js";import qr from"lodash/debounce.js";import{Surface as de,VideoQuality as N,HttpConnectionType as ft,VideoFormat as E,PlaybackState as zr}from"@vkontakte/videoplayer-core/es2015.esm.js";var vt=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function yr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ie=function(e){return e&&e.Math==Math&&e},y=Ie(typeof globalThis=="object"&&globalThis)||Ie(typeof window=="object"&&window)||Ie(typeof self=="object"&&self)||Ie(typeof vt=="object"&&vt)||function(){return this}()||vt||Function("return this")(),I=function(e){try{return!!e()}catch(t){return!0}},ti=I,tt=!ti(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),ri=tt,Ea=Function.prototype,Yr=Ea.apply,Qr=Ea.call,Oa=typeof Reflect=="object"&&Reflect.apply||(ri?Qr.bind(Yr):function(){return Qr.apply(Yr,arguments)}),Ta=tt,_a=Function.prototype,er=_a.call,ni=Ta&&_a.bind.bind(er,er),R=Ta?ni:function(e){return function(){return er.apply(e,arguments)}},Pa=R,ai=Pa({}.toString),oi=Pa("".slice),ye=function(e){return oi(ai(e),8,-1)},ii=ye,si=R,wa=function(e){if(ii(e)==="Function")return si(e)},tr=typeof document=="object"&&document.all,ci=typeof tr=="undefined"&&tr!==void 0,Ia={all:tr,IS_HTMLDDA:ci},Ra=Ia,ui=Ra.all,$=Ra.IS_HTMLDDA?function(e){return typeof e=="function"||e===ui}:function(e){return typeof e=="function"},Sr={},li=I,H=!li(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),fi=tt,Re=Function.prototype.call,P=fi?Re.bind(Re):function(){return Re.apply(Re,arguments)},Aa={},Ca={}.propertyIsEnumerable,Na=Object.getOwnPropertyDescriptor,vi=Na&&!Ca.call({1:2},1);Aa.f=vi?function(t){var r=Na(this,t);return!!r&&r.enumerable}:Ca;var rt=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},di=R,hi=I,pi=ye,dt=Object,gi=di("".split),bi=hi(function(){return!dt("z").propertyIsEnumerable(0)})?function(e){return pi(e)=="String"?gi(e,""):dt(e)}:dt,Se=function(e){return e==null},$i=Se,mi=TypeError,Er=function(e){if($i(e))throw mi("Can't call method on "+e);return e},yi=bi,Si=Er,Ee=function(e){return yi(Si(e))},Jr=$,La=Ia,Ei=La.all,F=La.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:Jr(e)||e===Ei}:function(e){return typeof e=="object"?e!==null:Jr(e)},Or={},ht=Or,pt=y,Oi=$,Xr=function(e){return Oi(e)?e:void 0},Q=function(e,t){return arguments.length<2?Xr(ht[e])||Xr(pt[e]):ht[e]&&ht[e][t]||pt[e]&&pt[e][t]},Ti=R,nt=Ti({}.isPrototypeOf),at=typeof navigator!="undefined"&&String(navigator.userAgent)||"",xa=y,gt=at,Zr=xa.process,en=xa.Deno,tn=Zr&&Zr.versions||en&&en.version,rn=tn&&tn.v8,C,Ye;rn&&(C=rn.split("."),Ye=C[0]>0&&C[0]<4?1:+(C[0]+C[1]));!Ye&&gt&&(C=gt.match(/Edge\/(\d+)/),(!C||C[1]>=74)&&(C=gt.match(/Chrome\/(\d+)/),C&&(Ye=+C[1])));var Da=Ye,nn=Da,_i=I,Pi=y,wi=Pi.String,ja=!!Object.getOwnPropertySymbols&&!_i(function(){var e=Symbol();return!wi(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&nn&&nn<41}),Ii=ja,ka=Ii&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Ri=Q,Ai=$,Ci=nt,Ni=ka,Li=Object,Ma=Ni?function(e){return typeof e=="symbol"}:function(e){var t=Ri("Symbol");return Ai(t)&&Ci(t.prototype,Li(e))},xi=String,ot=function(e){try{return xi(e)}catch(t){return"Object"}},Di=$,ji=ot,ki=TypeError,J=function(e){if(Di(e))return e;throw ki(ji(e)+" is not a function")},Mi=J,Fi=Se,it=function(e,t){var r=e[t];return Fi(r)?void 0:Mi(r)},bt=P,$t=$,mt=F,Bi=TypeError,Ui=function(e,t){var r,n;if(t==="string"&&$t(r=e.toString)&&!mt(n=bt(r,e))||$t(r=e.valueOf)&&!mt(n=bt(r,e))||t!=="string"&&$t(r=e.toString)&&!mt(n=bt(r,e)))return n;throw Bi("Can't convert object to primitive value")},Fa={exports:{}},Gi=!0,an=y,Ki=Object.defineProperty,Vi=function(e,t){try{Ki(an,e,{value:t,configurable:!0,writable:!0})}catch(r){an[e]=t}return t},Hi=y,Wi=Vi,on="__core-js_shared__",qi=Hi[on]||Wi(on,{}),Tr=qi,sn=Tr;(Fa.exports=function(e,t){return sn[e]||(sn[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 Ba=Fa.exports,zi=Er,Yi=Object,_r=function(e){return Yi(zi(e))},Qi=R,Ji=_r,Xi=Qi({}.hasOwnProperty),D=Object.hasOwn||function(t,r){return Xi(Ji(t),r)},Zi=R,es=0,ts=Math.random(),rs=Zi(1 .toString),Ua=function(e){return"Symbol("+(e===void 0?"":e)+")_"+rs(++es+ts,36)},ns=y,as=Ba,cn=D,os=Ua,is=ja,ss=ka,oe=ns.Symbol,yt=as("wks"),cs=ss?oe.for||oe:oe&&oe.withoutSetter||os,S=function(e){return cn(yt,e)||(yt[e]=is&&cn(oe,e)?oe[e]:cs("Symbol."+e)),yt[e]},us=P,un=F,ln=Ma,ls=it,fs=Ui,vs=S,ds=TypeError,hs=vs("toPrimitive"),ps=function(e,t){if(!un(e)||ln(e))return e;var r=ls(e,hs),n;if(r){if(t===void 0&&(t="default"),n=us(r,e,t),!un(n)||ln(n))return n;throw ds("Can't convert object to primitive value")}return t===void 0&&(t="number"),fs(e,t)},gs=ps,bs=Ma,Pr=function(e){var t=gs(e,"string");return bs(t)?t:t+""},$s=y,fn=F,rr=$s.document,ms=fn(rr)&&fn(rr.createElement),wr=function(e){return ms?rr.createElement(e):{}},ys=H,Ss=I,Es=wr,Ga=!ys&&!Ss(function(){return Object.defineProperty(Es("div"),"a",{get:function(){return 7}}).a!=7}),Os=H,Ts=P,_s=Aa,Ps=rt,ws=Ee,Is=Pr,Rs=D,As=Ga,vn=Object.getOwnPropertyDescriptor;Sr.f=Os?vn:function(t,r){if(t=ws(t),r=Is(r),As)try{return vn(t,r)}catch(n){}if(Rs(t,r))return Ps(!Ts(_s.f,t,r),t[r])};var Cs=I,Ns=$,Ls=/#|\.prototype\./,Oe=function(e,t){var r=Ds[xs(e)];return r==ks?!0:r==js?!1:Ns(t)?Cs(t):!!t},xs=Oe.normalize=function(e){return String(e).replace(Ls,".").toLowerCase()},Ds=Oe.data={},js=Oe.NATIVE="N",ks=Oe.POLYFILL="P",Ka=Oe,dn=wa,Ms=J,Fs=tt,Bs=dn(dn.bind),st=function(e,t){return Ms(e),t===void 0?e:Fs?Bs(e,t):function(){return e.apply(t,arguments)}},X={},Us=H,Gs=I,Va=Us&&Gs(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),Ks=F,Vs=String,Hs=TypeError,B=function(e){if(Ks(e))return e;throw Hs(Vs(e)+" is not an object")},Ws=H,qs=Ga,zs=Va,Ae=B,hn=Pr,Ys=TypeError,St=Object.defineProperty,Qs=Object.getOwnPropertyDescriptor,Et="enumerable",Ot="configurable",Tt="writable";X.f=Ws?zs?function(t,r,n){if(Ae(t),r=hn(r),Ae(n),typeof t=="function"&&r==="prototype"&&"value"in n&&Tt in n&&!n[Tt]){var a=Qs(t,r);a&&a[Tt]&&(t[r]=n.value,n={configurable:Ot in n?n[Ot]:a[Ot],enumerable:Et in n?n[Et]:a[Et],writable:!1})}return St(t,r,n)}:St:function(t,r,n){if(Ae(t),r=hn(r),Ae(n),qs)try{return St(t,r,n)}catch(a){}if("get"in n||"set"in n)throw Ys("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var Js=H,Xs=X,Zs=rt,Te=Js?function(e,t,r){return Xs.f(e,t,Zs(1,r))}:function(e,t,r){return e[t]=r,e},Ce=y,ec=Oa,tc=wa,rc=$,nc=Sr.f,ac=Ka,ee=Or,oc=st,te=Te,pn=D,ic=function(e){var t=function(r,n,a){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,a)}return ec(e,this,arguments)};return t.prototype=e.prototype,t},j=function(e,t){var r=e.target,n=e.global,a=e.stat,i=e.proto,s=n?Ce:a?Ce[r]:(Ce[r]||{}).prototype,u=n?ee:ee[r]||te(ee,r,{})[r],f=u.prototype,l,o,c,v,d,h,p,g,b;for(v in t)l=ac(n?v:r+(a?".":"#")+v,e.forced),o=!l&&s&&pn(s,v),h=u[v],o&&(e.dontCallGetSet?(b=nc(s,v),p=b&&b.value):p=s[v]),d=o&&p?p:t[v],!(o&&typeof h==typeof d)&&(e.bind&&o?g=oc(d,Ce):e.wrap&&o?g=ic(d):i&&rc(d)?g=tc(d):g=d,(e.sham||d&&d.sham||h&&h.sham)&&te(g,"sham",!0),te(u,v,g),i&&(c=r+"Prototype",pn(ee,c)||te(ee,c,{}),te(ee[c],v,d),e.real&&f&&(l||!f[v])&&te(f,v,d)))},sc=F,cc=ye,uc=S,lc=uc("match"),fc=function(e){var t;return sc(e)&&((t=e[lc])!==void 0?!!t:cc(e)=="RegExp")},vc=S,dc=vc("toStringTag"),Ha={};Ha[dc]="z";var Ir=String(Ha)==="[object z]",hc=Ir,pc=$,Ke=ye,gc=S,bc=gc("toStringTag"),$c=Object,mc=Ke(function(){return arguments}())=="Arguments",yc=function(e,t){try{return e[t]}catch(r){}},_e=hc?Ke:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=yc(t=$c(e),bc))=="string"?r:mc?Ke(t):(n=Ke(t))=="Object"&&pc(t.callee)?"Arguments":n},Sc=_e,Ec=String,Oc=function(e){if(Sc(e)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return Ec(e)},Tc=B,_c=function(){var e=Tc(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},Pc=P,wc=D,Ic=nt,Rc=_c,gn=RegExp.prototype,Ac=function(e){var t=e.flags;return t===void 0&&!("flags"in gn)&&!wc(e,"flags")&&Ic(gn,e)?Pc(Rc,e):t},Rr=R,Cc=_r,Nc=Math.floor,_t=Rr("".charAt),Lc=Rr("".replace),Pt=Rr("".slice),xc=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Dc=/\$([$&'`]|\d{1,2})/g,jc=function(e,t,r,n,a,i){var s=r+e.length,u=n.length,f=Dc;return a!==void 0&&(a=Cc(a),f=xc),Lc(i,f,function(l,o){var c;switch(_t(o,0)){case"$":return"$";case"&":return e;case"`":return Pt(t,0,r);case"'":return Pt(t,s);case"<":c=a[Pt(o,1,-1)];break;default:var v=+o;if(v===0)return l;if(v>u){var d=Nc(v/10);return d===0?l:d<=u?n[d-1]===void 0?_t(o,1):n[d-1]+_t(o,1):l}c=n[v-1]}return c===void 0?"":c})},kc=j,Mc=P,Ar=R,bn=Er,Fc=$,Bc=Se,Uc=fc,re=Oc,Gc=it,Kc=Ac,Vc=jc,Hc=S,Wc=Hc("replace"),qc=TypeError,Wa=Ar("".indexOf),zc=Ar("".replace),$n=Ar("".slice),Yc=Math.max,mn=function(e,t,r){return r>e.length?-1:t===""?r:Wa(e,t,r)};kc({target:"String",proto:!0},{replaceAll:function(t,r){var n=bn(this),a,i,s,u,f,l,o,c,v,d=0,h=0,p="";if(!Bc(t)){if(a=Uc(t),a&&(i=re(bn(Kc(t))),!~Wa(i,"g")))throw qc("`.replaceAll` does not allow non-global regexes");if(s=Gc(t,Wc),s)return Mc(s,t,n,r);if(a)return zc(re(n),t,r)}for(u=re(n),f=re(t),l=Fc(r),l||(r=re(r)),o=f.length,c=Yc(1,o),d=mn(u,f,0);d!==-1;)v=l?re(r(f,d,u)):Vc(f,u,d,[],void 0,r),p+=$n(u,h,d)+v,h=d+o,d=mn(u,f,d+c);return h<u.length&&(p+=$n(u,h)),p}});var Qc=Q,qa=Qc,Jc=qa,Xc=Jc("String","replaceAll"),Zc=Xc,eu=Zc,tu=eu,ru=tu,nu=yr(ru),x;(function(e){e.PROD="prod",e.VK_ALIAS="vk_alias",e.VIDEOTEST="videotest",e.TEST="test",e.AUTO="auto"})(x||(x={}));var w;(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"})(w||(w={}));var O;(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"})(O||(O={}));var Qe;(function(e){e.AUTO="auto",e.MANUAL=""})(Qe||(Qe={}));var pe;(function(e){e.HTTP1="http1",e.HTTP2="http2",e.HTTP3="http3"})(pe||(pe={}));var k;(function(e){e[e.YES=1]="YES",e[e.NO=0]="NO"})(k||(k={}));var ie;(function(e){e.EXCELLENT="excellent",e.GOOD="good",e.POOR="poor"})(ie||(ie={}));var z;(function(e){e.PIP="pip",e.FULLSCREEN="fullscreen",e.EXTERNAL="external",e.PREFETCH="prefetch",e.AIRPLAY="airplay",e.CHROMECAST="chromecast",e.INVISIBLE="invisible"})(z||(z={}));var Je;(function(e){e.SLIDER="slider",e.DOUBLE_TAP="double_tap",e.TIME_CODE="time_code",e.EPISODE="episode",e.REWIND="rewind",e.LIVE="live",e.UNKNOWN="unknown"})(Je||(Je={}));var yn;(function(e){e.GRAPH_SHOW="iGraphShow",e.GRAPH_HIDE="iGraphHide",e.NEXT_AREA="iNextChapterArea",e.NEXT_BUTTON="iNextChapterBtn",e.WATCH_AGAIN="iWatchAgainBtn"})(yn||(yn={}));const au={action_play:"ap",first_bytes:"fb",player_ready:"pr",first_frame:"ff",seek:"sk",watch_coverage_record:"wr",watch_coverage_live:"wl",empty_buffer:"eb",action_stop:"as",close_at_empty_buffer:"cb",content_error:"er",player_interface_click:"pc",next_movie:"nm",track_switch:"ts"},ou={vsid:"si",vid:"vi",place:"pl",quality:"qt",cdn_host:"ch",stat_type:"st",param:"pm",vk_app_id:"va",track_code:"tc",connection_type:"cnt",connection_reused:"cr",cached_data:"cd",live:"lv",muted:"mu",mode:"mo",subtitles:"sb",failover:"fo",download_speed:"ds",manual_quality:"mq",ref_domain:"rd",direct_url:"du"},iu={unknown:"un",mobile:"m",lowest:"ls",low:"l",medium:"md",high:"h",fullhd:"f",quadhd:"q",ultrahd:"u"},su={pip:"pi",fullscreen:"fs",external:"ex",prefetch:"pr",airplay:"ap",chromecast:"cc",invisible:"iv"},cu={apiEnv:x.VK_ALIAS,requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageInterval:15e3,disabledOperations:[],disabledCustomFields:[],shorten:!0,embedUrlParams:[],useBeacon:!0,synchronizeTime:!0,debugLog:!1,backoff:{start:1e3,factor:1.5,max:5*60*1e3,random:.1}},uu=e=>Wo(e,cu);function lu(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),t=new Array(36);let r=0,n,a;for(a=0;a<36;a++)a===8||a===13||a===18||a===23?t[a]="-":a===14?t[a]="4":(r<=2&&(r=33554432+Math.random()*16777216|0),n=r&15,r=r>>4,t[a]=e[a===19?n&3|8:n]);return t.join("")}function G(e,t,r,n){function a(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function u(o){try{l(n.next(o))}catch(c){s(c)}}function f(o){try{l(n.throw(o))}catch(c){s(c)}}function l(o){o.done?i(o.value):a(o.value).then(u,f)}l((n=n.apply(e,t||[])).next())})}var fu=ye,ct=typeof process!="undefined"&&fu(process)=="process",vu=Te,Cr=function(e,t,r,n){return n&&n.enumerable?e[t]=r:vu(e,t,r),e},du=Ir,hu=_e,pu=du?{}.toString:function(){return"[object "+hu(this)+"]"},gu=Ir,bu=X.f,$u=Te,mu=D,yu=pu,Su=S,Sn=Su("toStringTag"),Nr=function(e,t,r,n){if(e){var a=r?e:e.prototype;mu(a,Sn)||bu(a,Sn,{configurable:!0,value:t}),n&&!gu&&$u(a,"toString",yu)}},Eu=X,Ou=function(e,t,r){return Eu.f(e,t,r)},Tu=Q,_u=Ou,Pu=S,wu=H,En=Pu("species"),Iu=function(e){var t=Tu(e);wu&&t&&!t[En]&&_u(t,En,{configurable:!0,get:function(){return this}})},Ru=nt,Au=TypeError,Cu=function(e,t){if(Ru(t,e))return e;throw Au("Incorrect invocation")},Nu=R,Lu=$,nr=Tr,xu=Nu(Function.toString);Lu(nr.inspectSource)||(nr.inspectSource=function(e){return xu(e)});var za=nr.inspectSource,Du=R,ju=I,Ya=$,ku=_e,Mu=Q,Fu=za,Qa=function(){},Bu=[],Ja=Mu("Reflect","construct"),Lr=/^\s*(?:class|function)\b/,Uu=Du(Lr.exec),Gu=!Lr.exec(Qa),he=function(t){if(!Ya(t))return!1;try{return Ja(Qa,Bu,t),!0}catch(r){return!1}},Xa=function(t){if(!Ya(t))return!1;switch(ku(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Gu||!!Uu(Lr,Fu(t))}catch(r){return!0}};Xa.sham=!0;var Ku=!Ja||ju(function(){var e;return he(he.call)||!he(Object)||!he(function(){e=!0})||e})?Xa:he,Vu=Ku,Hu=ot,Wu=TypeError,qu=function(e){if(Vu(e))return e;throw Wu(Hu(e)+" is not a constructor")},On=B,zu=qu,Yu=Se,Qu=S,Ju=Qu("species"),Za=function(e,t){var r=On(e).constructor,n;return r===void 0||Yu(n=On(r)[Ju])?t:zu(n)},Xu=Q,eo=Xu("document","documentElement"),Zu=R,el=Zu([].slice),tl=TypeError,rl=function(e,t){if(e<t)throw tl("Not enough arguments");return e},nl=at,to=/(?:ipad|iphone|ipod).*applewebkit/i.test(nl),_=y,al=Oa,ol=st,Tn=$,il=D,ro=I,_n=eo,sl=el,Pn=wr,cl=rl,ul=to,ll=ct,ar=_.setImmediate,or=_.clearImmediate,fl=_.process,wt=_.Dispatch,vl=_.Function,wn=_.MessageChannel,dl=_.String,It=0,ge={},In="onreadystatechange",$e,W,Rt,At;ro(function(){$e=_.location});var xr=function(e){if(il(ge,e)){var t=ge[e];delete ge[e],t()}},Ct=function(e){return function(){xr(e)}},Rn=function(e){xr(e.data)},An=function(e){_.postMessage(dl(e),$e.protocol+"//"+$e.host)};(!ar||!or)&&(ar=function(t){cl(arguments.length,1);var r=Tn(t)?t:vl(t),n=sl(arguments,1);return ge[++It]=function(){al(r,void 0,n)},W(It),It},or=function(t){delete ge[t]},ll?W=function(e){fl.nextTick(Ct(e))}:wt&&wt.now?W=function(e){wt.now(Ct(e))}:wn&&!ul?(Rt=new wn,At=Rt.port2,Rt.port1.onmessage=Rn,W=ol(At.postMessage,At)):_.addEventListener&&Tn(_.postMessage)&&!_.importScripts&&$e&&$e.protocol!=="file:"&&!ro(An)?(W=An,_.addEventListener("message",Rn,!1)):In in Pn("script")?W=function(e){_n.appendChild(Pn("script"))[In]=function(){_n.removeChild(this),xr(e)}}:W=function(e){setTimeout(Ct(e),0)});var no={set:ar,clear:or},ao=function(){this.head=null,this.tail=null};ao.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 oo=ao,hl=at,pl=/ipad|iphone|ipod/i.test(hl)&&typeof Pebble!="undefined",gl=at,bl=/web0s(?!.*chrome)/i.test(gl),Y=y,Cn=st,$l=Sr.f,Nt=no.set,ml=oo,yl=to,Sl=pl,El=bl,Lt=ct,Nn=Y.MutationObserver||Y.WebKitMutationObserver,Ln=Y.document,xn=Y.process,Ne=Y.Promise,Dn=$l(Y,"queueMicrotask"),ir=Dn&&Dn.value,ne,xt,Dt,Le,jn;if(!ir){var xe=new ml,De=function(){var e,t;for(Lt&&(e=xn.domain)&&e.exit();t=xe.get();)try{t()}catch(r){throw xe.head&&ne(),r}e&&e.enter()};!yl&&!Lt&&!El&&Nn&&Ln?(xt=!0,Dt=Ln.createTextNode(""),new Nn(De).observe(Dt,{characterData:!0}),ne=function(){Dt.data=xt=!xt}):!Sl&&Ne&&Ne.resolve?(Le=Ne.resolve(void 0),Le.constructor=Ne,jn=Cn(Le.then,Le),ne=function(){jn(De)}):Lt?ne=function(){xn.nextTick(De)}:(Nt=Cn(Nt,Y),ne=function(){Nt(De)}),ir=function(e){xe.head||ne(),xe.add(e)}}var Ol=ir,Tl=function(e,t){try{arguments.length==1?console.error(e):console.error(e,t)}catch(r){}},Dr=function(e){try{return{error:!1,value:e()}}catch(t){return{error:!0,value:t}}},_l=y,Pl=$,kn=_l.WeakMap,wl=Pl(kn)&&/native code/.test(String(kn)),Il=Ba,Rl=Ua,Mn=Il("keys"),jr=function(e){return Mn[e]||(Mn[e]=Rl(e))},kr={},Al=wl,io=y,Cl=F,Nl=Te,jt=D,kt=Tr,Ll=jr,xl=kr,Fn="Object already initialized",sr=io.TypeError,Dl=io.WeakMap,Xe,me,Ze,jl=function(e){return Ze(e)?me(e):Xe(e,{})},kl=function(e){return function(t){var r;if(!Cl(t)||(r=me(t)).type!==e)throw sr("Incompatible receiver, "+e+" required");return r}};if(Al||kt.state){var L=kt.state||(kt.state=new Dl);L.get=L.get,L.has=L.has,L.set=L.set,Xe=function(e,t){if(L.has(e))throw sr(Fn);return t.facade=e,L.set(e,t),t},me=function(e){return L.get(e)||{}},Ze=function(e){return L.has(e)}}else{var ae=Ll("state");xl[ae]=!0,Xe=function(e,t){if(jt(e,ae))throw sr(Fn);return t.facade=e,Nl(e,ae,t),t},me=function(e){return jt(e,ae)?e[ae]:{}},Ze=function(e){return jt(e,ae)}}var so={set:Xe,get:me,has:Ze,enforce:jl,getterFor:kl},Ml=y,le=Ml.Promise,co=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",Fl=co,Bl=ct,Ul=!Fl&&!Bl&&typeof window=="object"&&typeof document=="object",Gl=y,be=le,Kl=$,Vl=Ka,Hl=za,Wl=S,ql=Ul,zl=co,Mt=Da,Bn=be&&be.prototype,Yl=Wl("species"),cr=!1,uo=Kl(Gl.PromiseRejectionEvent),Ql=Vl("Promise",function(){var e=Hl(be),t=e!==String(be);if(!t&&Mt===66||!(Bn.catch&&Bn.finally))return!0;if(!Mt||Mt<51||!/native code/.test(e)){var r=new be(function(i){i(1)}),n=function(i){i(function(){},function(){})},a=r.constructor={};if(a[Yl]=n,cr=r.then(function(){})instanceof n,!cr)return!0}return!t&&(ql||zl)&&!uo}),Pe={CONSTRUCTOR:Ql,REJECTION_EVENT:uo,SUBCLASSING:cr},fe={},Un=J,Jl=TypeError,Xl=function(e){var t,r;this.promise=new e(function(n,a){if(t!==void 0||r!==void 0)throw Jl("Bad Promise constructor");t=n,r=a}),this.resolve=Un(t),this.reject=Un(r)};fe.f=function(e){return new Xl(e)};var Zl=j,et=ct,V=y,we=P,ef=Cr,tf=Nr,rf=Iu,nf=J,ur=$,af=F,of=Cu,sf=Za,lo=no.set,Mr=Ol,cf=Tl,uf=Dr,lf=oo,fo=so,lr=le,Fr=Pe,vo=fe,ut="Promise",ho=Fr.CONSTRUCTOR,ff=Fr.REJECTION_EVENT;Fr.SUBCLASSING;var Ft=fo.getterFor(ut),vf=fo.set,df=lr&&lr.prototype,se=lr,Bt=df,po=V.TypeError,fr=V.document,Br=V.process,vr=vo.f,hf=vr,pf=!!(fr&&fr.createEvent&&V.dispatchEvent),go="unhandledrejection",gf="rejectionhandled",Gn=0,bo=1,bf=2,Ur=1,$o=2,je,Kn,$f,mo=function(e){var t;return af(e)&&ur(t=e.then)?t:!1},yo=function(e,t){var r=t.value,n=t.state==bo,a=n?e.ok:e.fail,i=e.resolve,s=e.reject,u=e.domain,f,l,o;try{a?(n||(t.rejection===$o&&yf(t),t.rejection=Ur),a===!0?f=r:(u&&u.enter(),f=a(r),u&&(u.exit(),o=!0)),f===e.promise?s(po("Promise-chain cycle")):(l=mo(f))?we(l,f,i,s):i(f)):s(r)}catch(c){u&&!o&&u.exit(),s(c)}},So=function(e,t){e.notified||(e.notified=!0,Mr(function(){for(var r=e.reactions,n;n=r.get();)yo(n,e);e.notified=!1,t&&!e.rejection&&mf(e)}))},Eo=function(e,t,r){var n,a;pf?(n=fr.createEvent("Event"),n.promise=t,n.reason=r,n.initEvent(e,!1,!0),V.dispatchEvent(n)):n={promise:t,reason:r},!ff&&(a=V["on"+e])?a(n):e===go&&cf("Unhandled promise rejection",r)},mf=function(e){we(lo,V,function(){var t=e.facade,r=e.value,n=Vn(e),a;if(n&&(a=uf(function(){et?Br.emit("unhandledRejection",r,t):Eo(go,t,r)}),e.rejection=et||Vn(e)?$o:Ur,a.error))throw a.value})},Vn=function(e){return e.rejection!==Ur&&!e.parent},yf=function(e){we(lo,V,function(){var t=e.facade;et?Br.emit("rejectionHandled",t):Eo(gf,t,e.value)})},ce=function(e,t,r){return function(n){e(t,n,r)}},ue=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=bf,So(e,!0))},dr=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw po("Promise can't be resolved itself");var n=mo(t);n?Mr(function(){var a={done:!1};try{we(n,t,ce(dr,a,e),ce(ue,a,e))}catch(i){ue(a,i,e)}}):(e.value=t,e.state=bo,So(e,!1))}catch(a){ue({done:!1},a,e)}}};ho&&(se=function(t){of(this,Bt),nf(t),we(je,this);var r=Ft(this);try{t(ce(dr,r),ce(ue,r))}catch(n){ue(r,n)}},Bt=se.prototype,je=function(t){vf(this,{type:ut,done:!1,notified:!1,parent:!1,reactions:new lf,rejection:!1,state:Gn,value:void 0})},je.prototype=ef(Bt,"then",function(t,r){var n=Ft(this),a=vr(sf(this,se));return n.parent=!0,a.ok=ur(t)?t:!0,a.fail=ur(r)&&r,a.domain=et?Br.domain:void 0,n.state==Gn?n.reactions.add(a):Mr(function(){yo(a,n)}),a.promise}),Kn=function(){var e=new je,t=Ft(e);this.promise=e,this.resolve=ce(dr,t),this.reject=ce(ue,t)},vo.f=vr=function(e){return e===se||e===$f?new Kn(e):hf(e)});Zl({global:!0,constructor:!0,wrap:!0,forced:ho},{Promise:se});tf(se,ut,!1,!0);rf(ut);var ve={},Sf=S,Ef=ve,Of=Sf("iterator"),Tf=Array.prototype,_f=function(e){return e!==void 0&&(Ef.Array===e||Tf[Of]===e)},Pf=Math.ceil,wf=Math.floor,If=Math.trunc||function(t){var r=+t;return(r>0?wf:Pf)(r)},Rf=If,Oo=function(e){var t=+e;return t!==t||t===0?0:Rf(t)},Af=Oo,Cf=Math.min,Nf=function(e){return e>0?Cf(Af(e),9007199254740991):0},Lf=Nf,To=function(e){return Lf(e.length)},xf=_e,Hn=it,Df=Se,jf=ve,kf=S,Mf=kf("iterator"),_o=function(e){if(!Df(e))return Hn(e,Mf)||Hn(e,"@@iterator")||jf[xf(e)]},Ff=P,Bf=J,Uf=B,Gf=ot,Kf=_o,Vf=TypeError,Hf=function(e,t){var r=arguments.length<2?Kf(e):t;if(Bf(r))return Uf(Ff(r,e));throw Vf(Gf(e)+" is not iterable")},Wf=P,Wn=B,qf=it,zf=function(e,t,r){var n,a;Wn(e);try{if(n=qf(e,"return"),!n){if(t==="throw")throw r;return r}n=Wf(n,e)}catch(i){a=!0,n=i}if(t==="throw")throw r;if(a)throw n;return Wn(n),r},Yf=st,Qf=P,Jf=B,Xf=ot,Zf=_f,ev=To,qn=nt,tv=Hf,rv=_o,zn=zf,nv=TypeError,Ve=function(e,t){this.stopped=e,this.result=t},Yn=Ve.prototype,Gr=function(e,t,r){var n=r&&r.that,a=!!(r&&r.AS_ENTRIES),i=!!(r&&r.IS_RECORD),s=!!(r&&r.IS_ITERATOR),u=!!(r&&r.INTERRUPTED),f=Yf(t,n),l,o,c,v,d,h,p,g=function(m){return l&&zn(l,"normal",m),new Ve(!0,m)},b=function(m){return a?(Jf(m),u?f(m[0],m[1],g):f(m[0],m[1])):u?f(m,g):f(m)};if(i)l=e.iterator;else if(s)l=e;else{if(o=rv(e),!o)throw nv(Xf(e)+" is not iterable");if(Zf(o)){for(c=0,v=ev(e);v>c;c++)if(d=b(e[c]),d&&qn(Yn,d))return d;return new Ve(!1)}l=tv(e,o)}for(h=i?e.next:l.next;!(p=Qf(h,l)).done;){try{d=b(p.value)}catch(m){zn(l,"throw",m)}if(typeof d=="object"&&d&&qn(Yn,d))return d}return new Ve(!1)},av=S,Po=av("iterator"),wo=!1;try{var ov=0,Qn={next:function(){return{done:!!ov++}},return:function(){wo=!0}};Qn[Po]=function(){return this},Array.from(Qn,function(){throw 2})}catch(e){}var iv=function(e,t){if(!t&&!wo)return!1;var r=!1;try{var n={};n[Po]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(a){}return r},sv=le,cv=iv,uv=Pe.CONSTRUCTOR,Io=uv||!cv(function(e){sv.all(e).then(void 0,function(){})}),lv=j,fv=P,vv=J,dv=fe,hv=Dr,pv=Gr,gv=Io;lv({target:"Promise",stat:!0,forced:gv},{all:function(t){var r=this,n=dv.f(r),a=n.resolve,i=n.reject,s=hv(function(){var u=vv(r.resolve),f=[],l=0,o=1;pv(t,function(c){var v=l++,d=!1;o++,fv(u,r,c).then(function(h){d||(d=!0,f[v]=h,--o||a(f))},i)}),--o||a(f)});return s.error&&i(s.value),n.promise}});var bv=j,$v=Pe.CONSTRUCTOR,Jn=le;Jn&&Jn.prototype;bv({target:"Promise",proto:!0,forced:$v,real:!0},{catch:function(e){return this.then(void 0,e)}});var mv=j,yv=P,Sv=J,Ev=fe,Ov=Dr,Tv=Gr,_v=Io;mv({target:"Promise",stat:!0,forced:_v},{race:function(t){var r=this,n=Ev.f(r),a=n.reject,i=Ov(function(){var s=Sv(r.resolve);Tv(t,function(u){yv(s,r,u).then(n.resolve,a)})});return i.error&&a(i.value),n.promise}});var Pv=j,wv=P,Iv=fe,Rv=Pe.CONSTRUCTOR;Pv({target:"Promise",stat:!0,forced:Rv},{reject:function(t){var r=Iv.f(this);return wv(r.reject,void 0,t),r.promise}});var Av=B,Cv=F,Nv=fe,Ro=function(e,t){if(Av(e),Cv(t)&&t.constructor===e)return t;var r=Nv.f(e),n=r.resolve;return n(t),r.promise},Lv=j,xv=Q,Dv=Gi,jv=le,kv=Pe.CONSTRUCTOR,Mv=Ro,Fv=xv("Promise"),Bv=!kv;Lv({target:"Promise",stat:!0,forced:Dv},{resolve:function(t){return Mv(Bv&&this===Fv?jv:this,t)}});var Uv=j,hr=le,Gv=I,Kv=Q,Vv=$,Hv=Za,Xn=Ro,Wv=hr&&hr.prototype,qv=!!hr&&Gv(function(){Wv.finally.call({then:function(){}},function(){})});Uv({target:"Promise",proto:!0,real:!0,forced:qv},{finally:function(e){var t=Hv(this,Kv("Promise")),r=Vv(e);return this.then(r?function(n){return Xn(t,e()).then(function(){return n})}:e,r?function(n){return Xn(t,e()).then(function(){throw n})}:e)}});var zv=qa,Yv=zv("Promise","finally"),Qv=Yv,Jv=Qv,Xv=Jv,Zv=Xv,Ut=yr(Zv),pr=H,ed=D,Ao=Function.prototype,td=pr&&Object.getOwnPropertyDescriptor,Kr=ed(Ao,"name"),rd=Kr&&function(){}.name==="something",nd=Kr&&(!pr||pr&&td(Ao,"name").configurable),ad={EXISTS:Kr,PROPER:rd,CONFIGURABLE:nd},Co={},od=Oo,id=Math.max,sd=Math.min,cd=function(e,t){var r=od(e);return r<0?id(r+t,0):sd(r,t)},ud=Ee,ld=cd,fd=To,Zn=function(e){return function(t,r,n){var a=ud(t),i=fd(a),s=ld(n,i),u;if(e&&r!=r){for(;i>s;)if(u=a[s++],u!=u)return!0}else for(;i>s;s++)if((e||s in a)&&a[s]===r)return e||s||0;return!e&&-1}},vd={includes:Zn(!0),indexOf:Zn(!1)},dd=R,Gt=D,hd=Ee,pd=vd.indexOf,gd=kr,ea=dd([].push),bd=function(e,t){var r=hd(e),n=0,a=[],i;for(i in r)!Gt(gd,i)&&Gt(r,i)&&ea(a,i);for(;t.length>n;)Gt(r,i=t[n++])&&(~pd(a,i)||ea(a,i));return a},No=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],$d=bd,md=No,yd=Object.keys||function(t){return $d(t,md)},Sd=H,Ed=Va,Od=X,Td=B,_d=Ee,Pd=yd;Co.f=Sd&&!Ed?Object.defineProperties:function(t,r){Td(t);for(var n=_d(r),a=Pd(r),i=a.length,s=0,u;i>s;)Od.f(t,u=a[s++],n[u]);return t};var wd=B,Id=Co,ta=No,Rd=kr,Ad=eo,Cd=wr,Nd=jr,ra=">",na="<",gr="prototype",br="script",Lo=Nd("IE_PROTO"),Kt=function(){},xo=function(e){return na+br+ra+e+na+"/"+br+ra},aa=function(e){e.write(xo("")),e.close();var t=e.parentWindow.Object;return e=null,t},Ld=function(){var e=Cd("iframe"),t="java"+br+":",r;return e.style.display="none",Ad.appendChild(e),e.src=String(t),r=e.contentWindow.document,r.open(),r.write(xo("document.F=Object")),r.close(),r.F},ke,He=function(){try{ke=new ActiveXObject("htmlfile")}catch(t){}He=typeof document!="undefined"?document.domain&&ke?aa(ke):Ld():aa(ke);for(var e=ta.length;e--;)delete He[gr][ta[e]];return He()};Rd[Lo]=!0;var Do=Object.create||function(t,r){var n;return t!==null?(Kt[gr]=wd(t),n=new Kt,Kt[gr]=null,n[Lo]=t):n=He(),r===void 0?n:Id.f(n,r)},xd=I,Dd=!xd(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),jd=D,kd=$,Md=_r,Fd=jr,Bd=Dd,oa=Fd("IE_PROTO"),$r=Object,Ud=$r.prototype,jo=Bd?$r.getPrototypeOf:function(e){var t=Md(e);if(jd(t,oa))return t[oa];var r=t.constructor;return kd(r)&&t instanceof r?r.prototype:t instanceof $r?Ud:null},Gd=I,Kd=$,Vd=F,Hd=Do,ia=jo,Wd=Cr,qd=S,mr=qd("iterator"),ko=!1,M,Vt,Ht;[].keys&&(Ht=[].keys(),"next"in Ht?(Vt=ia(ia(Ht)),Vt!==Object.prototype&&(M=Vt)):ko=!0);var zd=!Vd(M)||Gd(function(){var e={};return M[mr].call(e)!==e});zd?M={}:M=Hd(M);Kd(M[mr])||Wd(M,mr,function(){return this});var Mo={IteratorPrototype:M,BUGGY_SAFARI_ITERATORS:ko},Yd=Mo.IteratorPrototype,Qd=Do,Jd=rt,Xd=Nr,Zd=ve,eh=function(){return this},th=function(e,t,r,n){var a=t+" Iterator";return e.prototype=Qd(Yd,{next:Jd(+!n,r)}),Xd(e,a,!1,!0),Zd[a]=eh,e},rh=j,nh=P,Fo=ad,ah=th,oh=jo,ih=Nr,sa=Cr,sh=S,ca=ve,Bo=Mo,ch=Fo.PROPER;Fo.CONFIGURABLE;Bo.IteratorPrototype;var Me=Bo.BUGGY_SAFARI_ITERATORS,Wt=sh("iterator"),ua="keys",Fe="values",la="entries",uh=function(){return this},lh=function(e,t,r,n,a,i,s){ah(r,t,n);var u=function(b){if(b===a&&v)return v;if(!Me&&b in o)return o[b];switch(b){case ua:return function(){return new r(this,b)};case Fe:return function(){return new r(this,b)};case la:return function(){return new r(this,b)}}return function(){return new r(this)}},f=t+" Iterator",l=!1,o=e.prototype,c=o[Wt]||o["@@iterator"]||a&&o[a],v=!Me&&c||u(a),d=t=="Array"&&o.entries||c,h,p,g;if(d&&(h=oh(d.call(new e)),h!==Object.prototype&&h.next&&(ih(h,f,!0,!0),ca[f]=uh)),ch&&a==Fe&&c&&c.name!==Fe&&(l=!0,v=function(){return nh(c,this)}),a)if(p={values:u(Fe),keys:i?v:u(ua),entries:u(la)},s)for(g in p)(Me||l||!(g in o))&&sa(o,g,p[g]);else rh({target:t,proto:!0,forced:Me||l},p);return s&&o[Wt]!==v&&sa(o,Wt,v,{name:a}),ca[t]=v,p},fh=function(e,t){return{value:e,done:t}},vh=Ee,fa=ve,Uo=so;X.f;var dh=lh,Be=fh,Go="Array Iterator",hh=Uo.set,ph=Uo.getterFor(Go);dh(Array,"Array",function(e,t){hh(this,{type:Go,target:vh(e),index:0,kind:t})},function(){var e=ph(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,Be(void 0,!0)):r=="keys"?Be(n,!1):r=="values"?Be(t[n],!1):Be([n,t[n]],!1)},"values");fa.Arguments=fa.Array;var gh=Pr,bh=X,$h=rt,mh=function(e,t,r){var n=gh(t);n in e?bh.f(e,n,$h(0,r)):e[n]=r},yh=j,Sh=Gr,Eh=mh;yh({target:"Object",stat:!0},{fromEntries:function(t){var r={};return Sh(t,function(n,a){Eh(r,n,a)},{AS_ENTRIES:!0}),r}});var Oh=Or,Th=Oh.Object.fromEntries,_h={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Ph=_h,wh=y,Ih=_e,Rh=Te,va=ve,Ah=S,da=Ah("toStringTag");for(var qt in Ph){var ha=wh[qt],zt=ha&&ha.prototype;zt&&Ih(zt)!==da&&Rh(zt,da,qt),va[qt]=va.Array}var Ch=Th,Nh=Ch,Lh=Nh,xh=Lh,Dh=yr(xh);const jh=e=>{var t;const{operation:r,custom:n}=e,a=Dh(Object.entries(n).map(([i,s])=>{var u,f,l;const o=(u=ou[i])!==null&&u!==void 0?u:i;let c=s;return s&&(i==="mode"?c=(f=su[s])!==null&&f!==void 0?f:s:i==="quality"&&(c=(l=iu[s])!==null&&l!==void 0?l:s)),[o,c]}));return Object.assign(Object.assign({},e),{operation:(t=au[r])!==null&&t!==void 0?t:r,custom:a})},pa="1.0.41",kh="CIOPGQJGDIHBABABA",ga={[x.PROD]:"https://api.ok.ru",[x.VK_ALIAS]:"https://api.mycdn.me",[x.VIDEOTEST]:"https://videotestapi.ok.ru/api",[x.TEST]:"https://apitest.ok.ru",[x.AUTO]:""};var q;(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"})(q||(q={}));class Mh{constructor(t){this.consequentAuthErrors=0,this.authorized$=new We(!1),this.params=t}authorize(t){return G(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),a=this.sessionKey;if(!a)return;this.params.apiTransport.sendBeacon(r,n,a)||this.logRequest(t)}logRequest(t){var r;return G(this,void 0,void 0,function*(){const n="log.externalLog",a=this.createLogParams(t),i=(r=this.sessionKey)!==null&&r!==void 0?r:yield this._authorizeWithBackoff();if(!i)return;const s=(u,f=this.params.config.requestRetryCount)=>G(this,void 0,void 0,function*(){try{return yield this.params.apiTransport.sendRequest(n,a,i)}catch(l){if(!l||!("error_code"in l)){this.params.error$.next({id:"logRequestUnknown",category:A.NETWORK,message:`Unknown ${n} error`,thrown:l});return}const o=l==null?void 0:l.error_code;switch(o){case q.PARAM_SESSION_EXPIRED:case q.PARAM_SESSION_KEY:case q.PARAM_SIGNATURE:return this.authorized$.next(!1),this.sessionKey=yield this._authorizeWithBackoff(),f>0?s(u,f-1):void 0;case q.AUTH_LOGIN:return this.authorized$.next(!1),this.authToken=yield this.refreshAuthToken(),this.sessionKey=yield this._authorizeWithBackoff(),f>0?s(u,f-1):void 0;default:{this.params.error$.next({id:`LogRequest#${o}`,category:A.EXTERNAL_API,message:`${n} error`,data:l});return}}}});return s(t)})}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}refreshAuthToken(){return G(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:${pa}`,platform:this.params.mobile?"M_WEB":"WEB",items:this.params.config.shorten?t.map(jh):t})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();const t=qo(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:A.NETWORK,message:"Otherwise unhandled error in authorization",thrown:n})),()=>this.backoffTimeoutId=0)},t))})}_authorize(){return G(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.params.uuid,client_version:pa.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 a;return(!n||!n.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:A.EXTERNAL_API,message:"No session key",data:n}),this.sessionKey=(a=n==null?void 0:n.session_key)!==null&&a!==void 0?a:void 0,this.sessionKey}).catch(n=>G(this,void 0,void 0,function*(){this.sessionKey=void 0;const a=n==null?void 0:n.error_code;switch(a){case q.AUTH_LOGIN:return this.authToken=yield this.refreshAuthToken(),this._authorizeWithBackoff()}a?this.params.error$.next({id:`Authorize#${a}`,category:A.EXTERNAL_API,message:"authorize error",data:n}):this.params.error$.next({id:"AuthorizeUnknown",category:A.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 ba{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 a=0,i=n.length;a<i;a++)if(n[a].callback===r){n.splice(a,1);return}}dispatchEvent(t){if(!(t.type in this.listeners))return;const n=this.listeners[t.type].slice();for(let a=0,i=n.length;a<i;a++){const s=n[a];try{s.callback.call(this,t)}catch(u){Promise.resolve().then(()=>{throw u})}s.options&&s.options.once&&this.removeEventListener(t.type,s.callback)}return!t.defaultPrevented}}class Ko extends ba{constructor(){super(),this.listeners||ba.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 Fh{constructor(){Object.defineProperty(this,"signal",{value:new Ko,writable:!0,configurable:!0})}abort(t){let r;try{r=new Event("abort")}catch(a){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(a){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&&(Fh.prototype[Symbol.toStringTag]="AbortController",Ko.prototype[Symbol.toStringTag]="AbortSignal");function Vo(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 Bh(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:r=t.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a=!1}=e;if(!Vo({fetch:t,Request:r,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a}))return{fetch:t,Request:i};let i=r;(i&&!i.prototype.hasOwnProperty("signal")||a)&&(i=function(l,o){let c;o&&o.signal&&(c=o.signal,delete o.signal);const v=new r(l,o);return c&&Object.defineProperty(v,"signal",{writable:!1,enumerable:!1,configurable:!0,value:c}),v},i.prototype=r.prototype);const s=t;return{fetch:(f,l)=>{const o=i&&i.prototype.isPrototypeOf(f)?f.signal:l?l.signal:void 0;if(o){let c;try{c=new DOMException("Aborted","AbortError")}catch(d){c=new Error("Aborted"),c.name="AbortError"}if(o.aborted)return Promise.reject(c);const v=new Promise((d,h)=>{o.addEventListener("abort",()=>h(c),{once:!0})});return l&&l.signal&&delete l.signal,Promise.race([v,s(f,l)])}return s(f,l)},Request:i}}const Vr=Vo({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Ho=Vr?Bh({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,$a=Vr?Ho.fetch:window.fetch;Vr?Ho.Request:window.Request;class Uh{constructor(t){this.params=t,this.apiKey=t.apiKey,this.apiEnv=t.config.apiEnv,this.apiBaseUrl=ga[this.apiEnv],this.timeSynchronisation=t.timeSynchronisation,this.isApiBaseUrlFetched=!1}resolveApiBaseUrl(){var t;return G(this,void 0,void 0,function*(){if(this.apiEnv!==x.AUTO||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{const r=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),a=yield(yield $a(r,{method:"GET",mode:"cors",cache:"no-cache"})).json(),i=(t=a==null?void 0:a.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:A.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),ga[x.VK_ALIAS]}finally{this.isApiBaseUrlFetched=!0}})}sendBeacon(t,r,n){if(!window.Blob||!window.navigator.sendBeacon)return!1;const a=this._prepareQueryParams({method:t,queryParams:r,sessionKey:n}),i=new window.Blob([a.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:A.NETWORK,message:"Unhandled beacon error",thrown:s,data:{method:t,params:r}})}return!1}sendRequest(t,r,n){return G(this,void 0,void 0,function*(){const a=T(),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:A.NETWORK,message:"Request failed",thrown:s});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:A.NETWORK,message:"Unhandled request error",thrown:s,data:{method:t,params:r,sessionKey:n,time:T()-a}})};return this.apiBaseUrl=yield this.resolveApiBaseUrl(),$a(`${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 u,f;const l=Number(s.headers.get("content-length"))===0,o=new Date((u=s.headers.get("date"))!==null&&u!==void 0?u:"").getTime(),c=T()-a;if(isFinite(o)&&((f=this.timeSynchronisation)===null||f===void 0||f.addServerTime(o,c)),!l)return s.json().then(v=>Object.prototype.hasOwnProperty.call(v,"error_msg")?Promise.reject(v):v,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,a])=>r.append(n,typeof a=="string"?a:JSON.stringify(a))),r}}const Ue="onestat_events",Yt=e=>t=>t.timestamp+e>=T();class Gh{constructor(t){this.unsaltedStorage=[],this.isPaused=!1,this.isUrgent=n=>{const{operation:a,custom:{param:i}}=n;return["action_stop","close_at_empty_buffer"].includes(a)||a==="watch_coverage_record"&&i==="0-0"},this.params=t,this.api=t.api,this.error$=t.error$,this.userSalt=t.userSalt,this.loggerDebugLog=t.debugLogger.createComponentLog("stat logger"),this.firstFlush=qr(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});const r=K.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=qr(()=>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:A.WTF,message:(t=String(r))!==null&&t!==void 0?t:"Unknown logger error",thrown:r})}}readFromStorage(){const t=K.get(Ue);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(Yt(this.params.config.storageExpiration));K.set(Ue,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(Yt(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}const t=this.readFromStorage();delete t[this.userSalt],K.set(Ue,JSON.stringify(t))}housekeepStorage(){const t=this.readFromStorage();for(const[r,n]of Object.entries(t)){const a=n.filter(Yt(this.params.config.storageExpiration));a.length?t[r]=a:delete t[r],this.loggerDebugLog({message:`${n.length} retrieved from storage, ${a.length} of them actual`})}K.set(Ue,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.loggerDebugLog({message:`Flushing ${r.length} events through beacon`}),this.api.logBeacon(r)):(this.loggerDebugLog({message:`Flushing ${r.length} events`}),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 Kh=()=>{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}},Vh=e=>e&&{[N.INVARIANT]:w.UNKNOWN,[N.Q_144P]:w.Q144P,[N.Q_240P]:w.Q240P,[N.Q_360P]:w.Q360P,[N.Q_480P]:w.Q480P,[N.Q_720P]:w.Q720P,[N.Q_1080P]:w.Q1080P,[N.Q_1440P]:w.Q1440P,[N.Q_2160P]:w.Q2160P,[N.Q_4320P]:w.UNKNOWN}[e],ma=e=>e&&{[ft.HTTP1]:pe.HTTP1,[ft.HTTP2]:pe.HTTP2,[ft.QUIC]:pe.HTTP3}[e],Hh=e=>{if(e!==void 0)switch(e){case E.MPEG:return O.MP4;case E.DASH:case E.DASH_LIVE:return O.DASH;case E.DASH_SEP:return O.DASH_SEP;case E.DASH_ONDEMAND:return O.ONDEMAND_DASH;case E.DASH_WEBM:case E.DASH_LIVE_WEBM:return O.WEBM;case E.DASH_WEBM_AV1:return O.AV1;case E.DASH_LIVE_CMAF:return O.ONDEMAND_DASH_LIVE;case E.HLS:case E.HLS_LIVE:return O.HLS;case E.HLS_ONDEMAND:return O.ONDEMAND_HLS;case E.HLS_LIVE_CMAF:return O.ONDEMAND_HLS_LIVE;case E.WEB_RTC_LIVE:return O.WEBRTC;default:return ya(e)}},Qt=e=>{if(e!==void 0)switch(e){case de.NONE:case de.INLINE:return;case de.FULLSCREEN:return z.FULLSCREEN;case de.SECOND_SCREEN:return z.CHROMECAST;case de.PIP:return z.PIP;default:return ya(e)}},Wh=e=>{switch(e){case"slow-2g":return ie.POOR;case"2g":return ie.POOR;case"3g":return ie.GOOD;case"4g":return ie.EXCELLENT}};class qh{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(),a=t-n-r/2;if(Math.abs(a)<1e3){this.offset=0;return}this.offset===void 0?this.offset=Math.round(a):this.offset=Math.round(.2*a+(1-.2)*this.offset)}}const zh=()=>Math.floor(Math.random()*Math.pow(2,32)).toString(36).padStart(8,"0"),Yh=(e,t)=>new zo(r=>{const n=new qe,a=Ge(Zt(window,"beforeunload"),e.events.willDestruct$),i=new We(void 0);let s;n.add(e.info.isLive$.pipe(Yo()).subscribe(U=>{s&&(s.unsubscribe(),i.next(void 0)),U?s=e.info.liveTime$.pipe(Qo(lt=>lt&&lt/1e3)).subscribe(i):s=e.info.position$.subscribe(i),n.add(s)}));const{playing$:u,paused$:f}=e.events,l=e.events.willSeek$.pipe(Hr(()=>e.info.playbackState$.getValue()===zr.PLAYING)),o=e.events.seeked$.pipe(Hr(()=>e.info.playbackState$.getValue()===zr.PLAYING));let c=!1;const v=new Sa;n.add(l.subscribe(()=>{c||v.next(),c=!0})),n.add(o.subscribe(()=>c=!1));const d=Ge(u,o),h=Ge(f,v,a,e.events.looped$);let p;const g=()=>p=i.getValue(),b=()=>{const U=i.getValue();ze(p)||p===U||ze(U)||(r.next({from:p,to:U}),p=void 0)},m=()=>{b(),g()};if(n.add(d.subscribe(g)),n.add(h.subscribe(b)),t.forceInterval&&isFinite(t.forceInterval)){let U=0;n.add(d.subscribe(()=>U=window.setTimeout(m,t.forceInterval))),n.add(h.subscribe(()=>window.clearTimeout(U)))}return n}),Qh="_one-stat_",Jt=`${Qh}uuid`,Xt=()=>{const e=new qe;return{subscription:e,subscribe:(t,r)=>{t&&e.add(t.subscribe(r))}}};class ep{constructor(t,r){var n,a;this.subscription=new qe,this.debugLogger=new Jo,this.oneStatDebugLog=this.debugLogger.createComponentLog("onestat"),this.vsid$=new We(void 0),this.seekAction$=new We(Je.UNKNOWN),this.statContext=t,this.config=uu((n=r.config)!==null&&n!==void 0?n:{}),Z(r.apiEnv)&&(this.config.apiEnv=r.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new qh);const i=new Sa;this.experimental={error$:i};const s=K.get(Jt);s?s.startsWith('"')&&s.endsWith('"')?(this.uuid=nu(s,'"',""),K.set(Jt,this.uuid)):this.uuid=s:(this.uuid=lu(),K.set(Jt,this.uuid)),this.resetViewSession();const u=new Uh({apiKey:kh,config:this.config,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new Mh({config:this.config,apiTransport:u,refreshAuthToken:r.refreshAuthToken,mobile:(a=this.statContext.mobile)!==null&&a!==void 0?a:!1,uuid:this.uuid,error$:i}),this.logger=new Gh({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:i,userSalt:r.userSalt});const{isEmbed:f,host:l}=Kh();this.isEmbed=f,this.embedParent=l,this.subscribe()}updateContext(t){this.statContext=Object.assign(Object.assign({},this.statContext),t)}attachTo(t){const r=new qe,n=(o,c)=>r.add(o.subscribe(c));n(t.events.willStart$,()=>{const o=t.info.position$.getValue();this.logActionPlay({position:o}),this.statContext.projectId&&this.logActionPlayWithProjectId({position:o})}),n(t.events.looped$,()=>{this.resetViewSession(),this.logActionPlay({position:t.info.position$.getValue()})}),n(t.events.seeked$,()=>{this.logSeek({action:this.seekAction$.getValue(),time:t.info.position$.getValue()}),this.seekAction$.next(Je.UNKNOWN)}),n(t.events.paused$,()=>{this.logPause({position:t.info.position$.getValue()})}),n(t.events.willResume$,()=>{this.logPlay()}),n(t.events.started$,()=>{this.statContext.clip&&this.logWatchCoverageRecord({start:0,end:0})}),n(Yh(t,{forceInterval:this.config.watchCoverageInterval}),o=>{const c=t.info.isLive$.getValue(),v={start:parseFloat(o.from.toFixed(3)),end:parseFloat(o.to.toFixed(3))};c?this.logWatchCoverageLive(v):this.logWatchCoverageRecord(v)});let a;n(t.info.isStalled$,o=>{o?a=T():(Z(a)&&this.logEmptyBuffer({duration:T()-a}),a=void 0)});let i=!1;r.add(t.events.fatalError$.pipe(Xo()).subscribe(()=>i=!0)),n(t.events.willStop$,()=>{if(t.info.isStalled$.getValue()){const c=Z(a)?T()-a:void 0;this.logCloseAtEmptyBuffer({duration:c!=null?c:0}),a=void 0}else i||this.logActionStop()}),n(t.events.managedError$,({id:o})=>{this.logError({fatal:!1,errorType:o})}),n(t.events.fatalError$,({id:o})=>{this.logError({fatal:!0,errorType:o})});let s,u,f=!1;n(t.events.firstBytes$,o=>{s=T(),this.logFirstBytes({time:o})}),n(t.events.willStart$,()=>u=T()),n(t.info.currentBuffer$,o=>{!f&&o&&o.end-o.start>0&&Z(s)&&(this.logPlayerReady({duration:T()-s}),f=!0)}),n(t.events.firstFrame$,()=>{Z(s)&&!f&&(this.logPlayerReady({duration:T()-s}),f=!0),Z(u)&&this.logFirstFrame({time:T()-u})}),n(t.info.atLiveEdge$,o=>this.updateContext({liveEdge:o})),n(Wr({muted:t.info.muted$,volume:t.info.volume$}),({muted:o,volume:c})=>this.updateContext({audible:!o&&c>0})),n(t.info.currentQuality$,o=>this.updateContext({quality:Vh(o)})),n(t.info.isAutoQualityEnabled$,o=>this.updateContext({autoQuality:o})),n(t.info.currentFormat$,o=>this.updateContext({contentType:Hh(o)})),n(t.info.currentPlaybackRate$,o=>this.updateContext({rate:o})),n(t.info.is3DVideo$,o=>this.updateContext({is3d:o}));let l;return n(t.info.hostname$,o=>{this.updateContext({cdnHostname:o,failover:l!==void 0&&l!==o}),l=o}),n(t.info.throughputEstimation$,o=>this.updateContext({downloadSpeed:o})),n(t.info.httpConnectionType$,o=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:ma(o)}),this.updateContext({connectionType:ma(o)})}),n(t.info.httpConnectionReused$,o=>{ze(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:o}),this.updateContext({connectionReused:o})}),n(t.info.surface$,o=>this.updateContext({mode:Qt(o)})),n(Wr({current:t.info.currentTextTrack$,available:t.info.availableTextTracks$}),({current:o,available:c})=>{const v=c.find(({id:d})=>d===o);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{subscription:r,subscribe:n}=Xt();return this.player&&(n(t.actionRewind$,()=>{this.player&&(this.resetViewSession(),this.logActionPlay({position:this.player.info.position$.getValue()}))}),n(t.actionSeek$,this.seekAction$),n(t.inPiP$,a=>{var i;const s=a?z.PIP:Qt((i=this.player)===null||i===void 0?void 0:i.info.surface$.getValue());this.updateContext({mode:s})}),n(t.inFullscreen$,a=>{var i;const s=a?z.FULLSCREEN:Qt((i=this.player)===null||i===void 0?void 0:i.info.surface$.getValue());this.updateContext({mode:s})}),n(t.actionSetSubtitle$,a=>this.updateContext({subtitles:a})),n(t.nextMovie$,a=>this.logNextMovie(a)),this.resubscribeBeforeunload(),this.subscription.add(r)),r}attachToAds(t){const{subscription:r,subscribe:n}=Xt();return n(t.slotRequested$,()=>this.logAdSlotRequest()),n(t.started$,a=>this.logAdStarted(a)),n(t.paused$,()=>this.logAdPaused()),n(t.resumed$,()=>this.logAdResumed()),n(t.ended$,()=>this.logAdEnded()),n(t.skipped$,()=>this.logAdSkipped()),n(t.clicked$,()=>this.logAdClicked()),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToInteractive(t){const{subscription:r,subscribe:n}=Xt();return n(t.click$,a=>this.logInterfaceClick(a)),n(t.nextMovie$,a=>this.logNextMovie(a)),this.resubscribeBeforeunload(),this.subscription.add(r),r}authorize(t){return this.api.authorize(t)}pause(){this.logger.pause(),this.oneStatDebugLog({message:"paused"})}resume(){this.logger.resume(),this.oneStatDebugLog({message:"resumed"})}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.oneStatDebugLog({message:"VSID reset"}),this.vsid$.next(zh())}getDeviceId(){return this.uuid}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 a=(n=(r=this.timeSynchronisation)===null||r===void 0?void 0:r.getOffset())!==null&&n!==void 0?n:0,i=t.start+a,s=t.end+a;this.log({operation:"watch_coverage_live",param:`${i}-${s}`})}logEmptyBuffer(t){this.log({operation:"empty_buffer",param:String(t.duration)})}logDownloadSpeed(){}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(t){this.log({operation:"adv",param:t})}logAdPaused(){this.log({operation:"adv",param:"pause"})}logAdResumed(){this.log({operation:"adv",param:"resume"})}logAdEnded(){this.log({operation:"adv",param:"ended"})}logAdSkipped(){this.log({operation:"adv",param:"skip"})}logAdClicked(){this.log({operation:"adv",param:"click"})}logInterfaceClick(t){this.log({operation:"player_interface_click",param:t})}logNextMovie(t){this.log({operation:"next_movie",param:String(t)})}subscribe(){this.resubscribeBeforeunload();const t=window.navigator.connection;t&&"onchange"in t&&"effectiveType"in t&&this.subscription.add(Ge(Zt(t,"change"),Zo(["init"])).subscribe(()=>this.updateContext({network:Wh(t.effectiveType)}))),this.config.debugLog&&this.debugLogger.log$.subscribe(r=>{console.debug("%c stat ","background:#fa6470;",`component: ${r.component}.`,r.message)})}resubscribeBeforeunload(){var t;(t=this.beforeunloadSubscription)===null||t===void 0||t.unsubscribe(),this.beforeunloadSubscription=Zt(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))})}logActionPlayWithProjectId(t){this.statContext.projectId&&this.log({operation:"action_play",param:String(Math.round(t.position))},{vid:this.statContext.projectId})}logCloseAtEmptyBuffer(t){this.log({operation:"close_at_empty_buffer",param:String(Math.round(t.duration))})}logActionStop(){this.log({operation:"action_stop"})}log(t,r={}){if(this.config.disabledOperations.includes(t.operation))return;this.oneStatDebugLog({message:`operation ${t.operation} ${t.param}`});const n=this.createLogItem(t,r);this.logger.log(n)}createLogItem({operation:t,param:r,time:n},a={}){var i,s;const u=(s=(i=this.timeSynchronisation)===null||i===void 0?void 0:i.now())!==null&&s!==void 0?s:T(),f=this.vsid$.getValue();ei(f);const l=t==="empty_buffer"||t==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,o=this.statContext.firstConnectionReused;let c,v;if(this.isEmbed){c=this.embedParent;const h=[...new URLSearchParams(location.search).entries()].filter(([p,g])=>this.config.embedUrlParams.includes(p));v=new URLSearchParams(h).toString()}else this.statContext.place==="direct"&&(document.referrer&&(c=new URL(document.referrer).hostname),v=location.href.substring(0,1024));const d=Object.assign({vsid:f,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?Qe.AUTO:this.statContext.autoplay===!1?Qe.MANUAL:void 0,param:r,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:l,connection_reused:o===!0?k.YES:o===!1?k.NO:void 0,cached_data:this.statContext.cached===!0?k.YES:this.statContext.cached===!1?k.NO:void 0,live:this.statContext.liveEdge?k.YES:void 0,muted:this.statContext.audible===!1?k.YES:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:k.YES,ref_domain:c,direct_url:v,rate:this.statContext.rate===1||ze(this.statContext.rate)?void 0:this.statContext.rate.toFixed(2),view_360:this.statContext.is3d?1:void 0,aid:this.statContext.albumId,vk_playlist_id:this.statContext.vkPlaylistId},a);for(const h of this.config.disabledCustomFields)delete d[h];return{operation:t,type:1,time:n,network:this.statContext.network,timestamp:u,custom:d}}}export{x as ApiEnv,pe as ConnectionType,O as ContentType,yn as InteractiveInterfaceClick,ep as OneStat,w as Quality,Je as SeekAction,pa as VERSION};