@vkontakte/videoplayer-statistics 1.0.39 → 1.0.40-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es2015.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-statistics v1.0.39
3
- * Tue, 29 Aug 2023 12:33:55 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-39/doc/
2
+ * @vkontakte/videoplayer-statistics v1.0.40-beta.1
3
+ * Wed, 06 Sep 2023 16:25:58 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-40/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 Oe;(function(e){e.AUTO="auto",e.MANUAL=""})(Oe||(Oe={}));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 k;(function(e){e.PIP="pip",e.FULLSCREEN="fullscreen",e.EXTERNAL="external",e.PREFETCH="prefetch"})(k||(k={}));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,Oo=ln({}.toString),_o=ln("".slice),se=function(e){return _o(Oo(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"},kt={},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,ko=Do("".split),jo=xo(function(){return!Be("z").propertyIsEnumerable(0)})?function(e){return Lo(e)=="String"?ko(e,""):Be(e)}:Be,ce=function(e){return e==null},Fo=ce,Mo=TypeError,jt=function(e){if(Fo(e))throw Mo("Can't call method on "+e);return e},Uo=jo,Bo=jt,Vo=function(e){return Uo(Bo(e))},Zt=b,bn=vn,Ho=bn.all,N=bn.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:Zt(e)||e===Ho}:function(e){return typeof e=="object"?e!==null:Zt(e)},$n={},Ve=$n,He=$,Wo=b,er=function(e){return Wo(e)?e:void 0},F=function(e,t){return arguments.length<2?er(Ve[e])||er(He[e]):Ve[e]&&Ve[e][t]||He[e]&&He[e][t]},Ko=w,Ie=Ko({}.isPrototypeOf),Re=typeof navigator!="undefined"&&String(navigator.userAgent)||"",mn=$,We=Re,tr=mn.process,rr=mn.Deno,nr=tr&&tr.versions||rr&&rr.version,or=nr&&nr.v8,_,_e;or&&(_=or.split("."),_e=_[0]>0&&_[0]<4?1:+(_[0]+_[1]));!_e&&We&&(_=We.match(/Edge\/(\d+)/),(!_||_[1]>=74)&&(_=We.match(/Chrome\/(\d+)/),_&&(_e=+_[1])));var Sn=_e,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,On=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")},_n={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;(_n.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=_n.exports,pi=jt,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)},Oi=$,_i=wn,ur=U,wi=An,Pi=En,Ai=Tn,Q=Oi.Symbol,Qe=_i("wks"),Ci=Ai?Q.for||Q:Q&&Q.withoutSetter||wi,O=function(e){return ur(Qe,e)||(Qe[e]=Pi&&ur(Q,e)?Q[e]:Ci("Symbol."+e)),Qe[e]},Ii=T,lr=N,fr=On,Ri=De,Ni=ci,Di=O,xi=TypeError,Li=Di("toPrimitive"),ki=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)},ji=ki,Fi=On,Cn=function(e){var t=ji(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,Hi=In,Rn=!Bi&&!Vi(function(){return Object.defineProperty(Hi("div"),"a",{get:function(){return 7}}).a!=7}),Wi=X,Ki=T,Gi=hn,qi=yn,Qi=Vo,zi=Cn,Yi=U,Ji=Rn,dr=Object.getOwnPropertyDescriptor;kt.f=Wi?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,ke=$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,Oa=b,_a=kt.f,wa=Nn,H=$n,Pa=xe,W=ke,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?H:H[r]||W(H,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=_a(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&&Oa(d)?m=Ta(d):m=d,(e.sham||d&&d.sham||g&&g.sham)&&W(m,"sham",!0),W(v,h,m),a&&(f=r+"Prototype",gr(H,f)||W(H,f,{}),W(H[f],h,d),e.real&&l&&(u||!l[h])&&W(l,h,d)))},Ca=N,Ia=se,Ra=O,Na=Ra("match"),Da=function(e){var t;return Ca(e)&&((t=e[Na])!==void 0?!!t:Ia(e)=="RegExp")},xa=O,La=xa("toStringTag"),Dn={};Dn[La]="z";var Mt=String(Dn)==="[object z]",ka=Mt,ja=b,Ee=se,Fa=O,Ma=Fa("toStringTag"),Ua=Object,Ba=Ee(function(){return arguments}())=="Arguments",Va=function(e,t){try{return e[t]}catch(r){}},je=ka?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"&&ja(t.callee)?"Arguments":n},Ha=je,Wa=String,Ka=function(e){if(Ha(e)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return Wa(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=jt,ss=b,cs=ce,us=Da,K=Ka,ls=De,fs=Xa,vs=os,ds=O,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,Os=Ts,_s=on(Os),ws=se,Fe=typeof process!="undefined"&&ws(process)=="process",Ps=ke,As=function(e,t,r,n){return n&&n.enumerable?e[t]=r:Ps(e,t,r),e},Cs=Mt,Is=je,Rs=Cs?{}.toString:function(){return"[object "+Is(this)+"]"},Ns=Mt,Ds=Le.f,xs=ke,Ls=U,ks=Rs,js=O,Sr=js("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",ks)}},Ms=Le,Us=function(e,t,r){return Ms.f(e,t,r)},Bs=F,Vs=Us,Hs=O,Ws=X,Er=Hs("species"),Ks=function(e){var t=Bs(e);Ws&&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 kn=Tt.inspectSource,Xs=w,Zs=A,jn=b,ec=je,tc=F,rc=kn,Fn=function(){},nc=[],Mn=tc("Reflect","construct"),Vt=/^\s*(?:class|function)\b/,oc=Xs(Vt.exec),ic=!Vt.exec(Fn),te=function(t){if(!jn(t))return!1;try{return Mn(Fn,nc,t),!0}catch(r){return!1}},Un=function(t){if(!jn(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=O,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,Or=b,Oc=U,Hn=A,_r=gc,_c=bc,wr=In,wc=mc,Pc=Vn,Ac=Fe,Ot=S.setImmediate,_t=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;Hn(function(){ie=S.location});var Ht=function(e){if(Oc(ne,e)){var t=ne[e];delete ne[e],t()}},it=function(e){return function(){Ht(e)}},Cr=function(e){Ht(e.data)},Ir=function(e){S.postMessage(Rc(e),ie.protocol+"//"+ie.host)};(!Ot||!_t)&&(Ot=function(t){wc(arguments.length,1);var r=Or(t)?t:Ic(t),n=_c(arguments,1);return ne[++rt]=function(){Ec(r,void 0,n)},x(rt),rt},_t=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&&Or(S.postMessage)&&!S.importScripts&&ie&&ie.protocol!=="file:"&&!Hn(Ir)?(x=Ir,S.addEventListener("message",Cr,!1)):Ar in wr("script")?x=function(e){_r.appendChild(wr("script"))[Ar]=function(){_r.removeChild(this),Ht(e)}}:x=function(e){setTimeout(it(e),0)});var Wn={set:Ot,clear:_t},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),j=$,Rr=xe,kc=kt.f,at=Wn.set,jc=Gn,Fc=Vn,Mc=Dc,Uc=Lc,st=Fe,Nr=j.MutationObserver||j.WebKitMutationObserver,Dr=j.document,xr=j.process,ge=j.Promise,Lr=kc(j,"queueMicrotask"),wt=Lr&&Lr.value,G,ct,ut,ye,kr;if(!wt){var be=new jc,$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,kr=Rr(ye.then,ye),G=function(){kr($e)}):st?G=function(){xr.nextTick($e)}:(at=Rr(at,j),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){}},Wt=function(e){try{return{error:!1,value:e()}}catch(t){return{error:!0,value:t}}},Hc=$,Wc=b,jr=Hc.WeakMap,Kc=Wc(jr)&&/native code/.test(String(jr)),Gc=wn,qc=An,Fr=Gc("keys"),Qc=function(e){return Fr[e]||(Fr[e]=qc(e))},zc=Kc,qn=$,Yc=N,Jc=ke,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=kn,fu=O,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,Ou=Qs,_u=Bn,Yn=Wn.set,Kt=Bc,wu=Vc,Pu=Wt,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,Hr,ku,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&&ju(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)},ju=function(e){fe(Yn,R,function(){var t=e.facade,r=e.value,n=Wr(e),o;if(n&&(o=Pu(function(){Ae?qt.emit("unhandledRejection",r,t):so(to,t,r)}),e.rejection=Ae||Wr(e)?no:Qt,o.error))throw o.value})},Wr=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){Ou(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(_u(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}),Hr=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===ku?new Hr(e):Nu(e)});bu({global:!0,constructor:!0,wrap:!0,forced:Zn},{Promise:z});mu(z,Me,!1,!0);Su(Me);var co={},Mu=O,Uu=co,Bu=Mu("iterator"),Vu=Array.prototype,Hu=function(e){return e!==void 0&&(Uu.Array===e||Vu[Bu]===e)},Wu=Math.ceil,Ku=Math.floor,Gu=Math.trunc||function(t){var r=+t;return(r>0?Ku:Wu)(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=je,Kr=De,tl=ce,rl=co,nl=O,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=Hu,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)},Ol=O,fo=Ol("iterator"),vo=!1;try{var _l=0,Yr={next:function(){return{done:!!_l++}},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=Wt,Ll=lo,kl=ho;Il({target:"Promise",stat:!0,forced:kl},{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 jl=D,Fl=le.CONSTRUCTOR,Jr=Z;Jr&&Jr.prototype;jl({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,Hl=Wt,Wl=lo,Kl=ho;Ml({target:"Promise",stat:!0,forced:Kl},{race:function(t){var r=this,n=Vl.f(r),o=n.reject,a=Hl(function(){var c=Bl(r.resolve);Wl(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.39",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 Of{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=_s(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 _f{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&&(_f.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 k.FULLSCREEN;case p.Surface.SECOND_SCREEN:return k.EXTERNAL;case p.Surface.PIP:return k.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 Of({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$,()=>{this.logActionPlay({position:t.info.position$.getValue()})}),n(t.events.looped$,()=>{this.resetViewSession(),this.logActionPlay({position:t.info.position$.getValue()})}),n(t.events.seeked$,()=>{this.logSeek({action:this.seekAction$.getValue(),time:t.info.position$.getValue()}),this.seekAction$.next(exports.SeekAction.UNKNOWN)}),n(t.events.paused$,()=>{this.logPause({position:t.info.position$.getValue()})}),n(t.events.willResume$,()=>{this.logPlay()}),n(t.events.started$,()=>{this.statContext.clip&&this.logWatchCoverageRecord({start:0,end:0})}),n(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?k.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?k.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))})}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?Oe.AUTO:this.statContext.autoplay===!1?Oe.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 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 Oe;(function(e){e.AUTO="auto",e.MANUAL=""})(Oe||(Oe={}));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 k;(function(e){e.PIP="pip",e.FULLSCREEN="fullscreen",e.EXTERNAL="external",e.PREFETCH="prefetch"})(k||(k={}));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,Oo=ln({}.toString),_o=ln("".slice),se=function(e){return _o(Oo(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"},kt={},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,ko=Do("".split),jo=xo(function(){return!Be("z").propertyIsEnumerable(0)})?function(e){return Lo(e)=="String"?ko(e,""):Be(e)}:Be,ce=function(e){return e==null},Fo=ce,Mo=TypeError,jt=function(e){if(Fo(e))throw Mo("Can't call method on "+e);return e},Uo=jo,Bo=jt,Vo=function(e){return Uo(Bo(e))},Zt=b,bn=vn,Ho=bn.all,N=bn.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:Zt(e)||e===Ho}:function(e){return typeof e=="object"?e!==null:Zt(e)},$n={},Ve=$n,He=$,Wo=b,er=function(e){return Wo(e)?e:void 0},F=function(e,t){return arguments.length<2?er(Ve[e])||er(He[e]):Ve[e]&&Ve[e][t]||He[e]&&He[e][t]},Ko=w,Ie=Ko({}.isPrototypeOf),Re=typeof navigator!="undefined"&&String(navigator.userAgent)||"",mn=$,We=Re,tr=mn.process,rr=mn.Deno,nr=tr&&tr.versions||rr&&rr.version,or=nr&&nr.v8,_,_e;or&&(_=or.split("."),_e=_[0]>0&&_[0]<4?1:+(_[0]+_[1]));!_e&&We&&(_=We.match(/Edge\/(\d+)/),(!_||_[1]>=74)&&(_=We.match(/Chrome\/(\d+)/),_&&(_e=+_[1])));var Sn=_e,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,On=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")},_n={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;(_n.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=_n.exports,pi=jt,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)},Oi=$,_i=wn,ur=U,wi=An,Pi=En,Ai=Tn,Q=Oi.Symbol,Qe=_i("wks"),Ci=Ai?Q.for||Q:Q&&Q.withoutSetter||wi,O=function(e){return ur(Qe,e)||(Qe[e]=Pi&&ur(Q,e)?Q[e]:Ci("Symbol."+e)),Qe[e]},Ii=T,lr=N,fr=On,Ri=De,Ni=ci,Di=O,xi=TypeError,Li=Di("toPrimitive"),ki=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)},ji=ki,Fi=On,Cn=function(e){var t=ji(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,Hi=In,Rn=!Bi&&!Vi(function(){return Object.defineProperty(Hi("div"),"a",{get:function(){return 7}}).a!=7}),Wi=X,Ki=T,Gi=hn,qi=yn,Qi=Vo,zi=Cn,Yi=U,Ji=Rn,dr=Object.getOwnPropertyDescriptor;kt.f=Wi?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,ke=$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,Oa=b,_a=kt.f,wa=Nn,H=$n,Pa=xe,W=ke,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?H:H[r]||W(H,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=_a(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&&Oa(d)?m=Ta(d):m=d,(e.sham||d&&d.sham||g&&g.sham)&&W(m,"sham",!0),W(v,h,m),a&&(f=r+"Prototype",gr(H,f)||W(H,f,{}),W(H[f],h,d),e.real&&l&&(u||!l[h])&&W(l,h,d)))},Ca=N,Ia=se,Ra=O,Na=Ra("match"),Da=function(e){var t;return Ca(e)&&((t=e[Na])!==void 0?!!t:Ia(e)=="RegExp")},xa=O,La=xa("toStringTag"),Dn={};Dn[La]="z";var Mt=String(Dn)==="[object z]",ka=Mt,ja=b,Ee=se,Fa=O,Ma=Fa("toStringTag"),Ua=Object,Ba=Ee(function(){return arguments}())=="Arguments",Va=function(e,t){try{return e[t]}catch(r){}},je=ka?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"&&ja(t.callee)?"Arguments":n},Ha=je,Wa=String,Ka=function(e){if(Ha(e)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return Wa(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=jt,ss=b,cs=ce,us=Da,K=Ka,ls=De,fs=Xa,vs=os,ds=O,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,Os=Ts,_s=on(Os),ws=se,Fe=typeof process!="undefined"&&ws(process)=="process",Ps=ke,As=function(e,t,r,n){return n&&n.enumerable?e[t]=r:Ps(e,t,r),e},Cs=Mt,Is=je,Rs=Cs?{}.toString:function(){return"[object "+Is(this)+"]"},Ns=Mt,Ds=Le.f,xs=ke,Ls=U,ks=Rs,js=O,Sr=js("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",ks)}},Ms=Le,Us=function(e,t,r){return Ms.f(e,t,r)},Bs=F,Vs=Us,Hs=O,Ws=X,Er=Hs("species"),Ks=function(e){var t=Bs(e);Ws&&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 kn=Tt.inspectSource,Xs=w,Zs=A,jn=b,ec=je,tc=F,rc=kn,Fn=function(){},nc=[],Mn=tc("Reflect","construct"),Vt=/^\s*(?:class|function)\b/,oc=Xs(Vt.exec),ic=!Vt.exec(Fn),te=function(t){if(!jn(t))return!1;try{return Mn(Fn,nc,t),!0}catch(r){return!1}},Un=function(t){if(!jn(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=O,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,Or=b,Oc=U,Hn=A,_r=gc,_c=bc,wr=In,wc=mc,Pc=Vn,Ac=Fe,Ot=S.setImmediate,_t=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;Hn(function(){ie=S.location});var Ht=function(e){if(Oc(ne,e)){var t=ne[e];delete ne[e],t()}},it=function(e){return function(){Ht(e)}},Cr=function(e){Ht(e.data)},Ir=function(e){S.postMessage(Rc(e),ie.protocol+"//"+ie.host)};(!Ot||!_t)&&(Ot=function(t){wc(arguments.length,1);var r=Or(t)?t:Ic(t),n=_c(arguments,1);return ne[++rt]=function(){Ec(r,void 0,n)},x(rt),rt},_t=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&&Or(S.postMessage)&&!S.importScripts&&ie&&ie.protocol!=="file:"&&!Hn(Ir)?(x=Ir,S.addEventListener("message",Cr,!1)):Ar in wr("script")?x=function(e){_r.appendChild(wr("script"))[Ar]=function(){_r.removeChild(this),Ht(e)}}:x=function(e){setTimeout(it(e),0)});var Wn={set:Ot,clear:_t},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),j=$,Rr=xe,kc=kt.f,at=Wn.set,jc=Gn,Fc=Vn,Mc=Dc,Uc=Lc,st=Fe,Nr=j.MutationObserver||j.WebKitMutationObserver,Dr=j.document,xr=j.process,ge=j.Promise,Lr=kc(j,"queueMicrotask"),wt=Lr&&Lr.value,G,ct,ut,ye,kr;if(!wt){var be=new jc,$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,kr=Rr(ye.then,ye),G=function(){kr($e)}):st?G=function(){xr.nextTick($e)}:(at=Rr(at,j),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){}},Wt=function(e){try{return{error:!1,value:e()}}catch(t){return{error:!0,value:t}}},Hc=$,Wc=b,jr=Hc.WeakMap,Kc=Wc(jr)&&/native code/.test(String(jr)),Gc=wn,qc=An,Fr=Gc("keys"),Qc=function(e){return Fr[e]||(Fr[e]=qc(e))},zc=Kc,qn=$,Yc=N,Jc=ke,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=kn,fu=O,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,Ou=Qs,_u=Bn,Yn=Wn.set,Kt=Bc,wu=Vc,Pu=Wt,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,Hr,ku,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&&ju(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)},ju=function(e){fe(Yn,R,function(){var t=e.facade,r=e.value,n=Wr(e),o;if(n&&(o=Pu(function(){Ae?qt.emit("unhandledRejection",r,t):so(to,t,r)}),e.rejection=Ae||Wr(e)?no:Qt,o.error))throw o.value})},Wr=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){Ou(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(_u(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}),Hr=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===ku?new Hr(e):Nu(e)});bu({global:!0,constructor:!0,wrap:!0,forced:Zn},{Promise:z});mu(z,Me,!1,!0);Su(Me);var co={},Mu=O,Uu=co,Bu=Mu("iterator"),Vu=Array.prototype,Hu=function(e){return e!==void 0&&(Uu.Array===e||Vu[Bu]===e)},Wu=Math.ceil,Ku=Math.floor,Gu=Math.trunc||function(t){var r=+t;return(r>0?Ku:Wu)(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=je,Kr=De,tl=ce,rl=co,nl=O,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=Hu,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)},Ol=O,fo=Ol("iterator"),vo=!1;try{var _l=0,Yr={next:function(){return{done:!!_l++}},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=Wt,Ll=lo,kl=ho;Il({target:"Promise",stat:!0,forced:kl},{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 jl=D,Fl=le.CONSTRUCTOR,Jr=Z;Jr&&Jr.prototype;jl({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,Hl=Wt,Wl=lo,Kl=ho;Ml({target:"Promise",stat:!0,forced:Kl},{race:function(t){var r=this,n=Vl.f(r),o=n.reject,a=Hl(function(){var c=Bl(r.resolve);Wl(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.40-beta.1",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 Of{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=_s(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 _f{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&&(_f.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 k.FULLSCREEN;case p.Surface.SECOND_SCREEN:return k.EXTERNAL;case p.Surface.PIP:return k.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 Of({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$,()=>{this.logActionPlay({position:t.info.position$.getValue()})}),n(t.events.looped$,()=>{this.resetViewSession(),this.logActionPlay({position:t.info.position$.getValue()})}),n(t.events.seeked$,()=>{this.logSeek({action:this.seekAction$.getValue(),time:t.info.position$.getValue()}),this.seekAction$.next(exports.SeekAction.UNKNOWN)}),n(t.events.paused$,()=>{this.logPause({position:t.info.position$.getValue()})}),n(t.events.willResume$,()=>{this.logPlay()}),n(t.events.started$,()=>{this.statContext.clip&&this.logWatchCoverageRecord({start:0,end:0})}),n(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?k.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?k.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))})}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?Oe.AUTO:this.statContext.autoplay===!1?Oe.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;
package/es2015.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-statistics v1.0.39
3
- * Tue, 29 Aug 2023 12:33:55 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-39/doc/
2
+ * @vkontakte/videoplayer-statistics v1.0.40-beta.1
3
+ * Wed, 06 Sep 2023 16:25:58 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-40/doc/
5
5
  */
6
- import{fillWithDefault as Bo,ValueSubject as Yr,safeStorage as M,getExponentialDelay as Wo,ErrorCategory as P,now as S,assertNever as _n,Observable as Ho,Subscription as xe,merge as Ce,fromEvent as Dr,filterChanged as Ko,map as Go,filter as ft,Subject as wn,isNullable as xr,isNonNullable as Q,once as Vo,combine as vt,observableFrom as qo}from"@vkontakte/videoplayer-shared/es2015.esm.js";import dt from"lodash/debounce.js";import{Surface as ce,VideoQuality as R,HttpConnectionType as Xe,VideoFormat as $,PlaybackState as ht}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 pt;(function(e){e.GRAPH_SHOW="iGraphShow",e.GRAPH_HIDE="iGraphHide",e.NEXT_AREA="iNextChapterArea",e.NEXT_BUTTON="iNextChapterBtn",e.WATCH_AGAIN="iWatchAgainBtn"})(pt||(pt={}));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,r,t,n){function o(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=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,r||[])).next())})}var Ze=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Pn(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(r){return!0}},Yo=D,Be=!Yo(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),Jo=Be,An=Function.prototype,gt=An.apply,bt=An.call,In=typeof Reflect=="object"&&Reflect.apply||(Jo?bt.bind(gt):function(){return bt.apply(gt,arguments)}),Rn=Be,Cn=Function.prototype,Lr=Cn.call,Xo=Rn&&Cn.bind.bind(Lr,Lr),I=Rn?Xo:function(e){return function(){return Lr.apply(e,arguments)}},Nn=I,Zo=Nn({}.toString),ei=Nn("".slice),ge=function(e){return ei(Zo(e),8,-1)},ri=ge,ti=I,Dn=function(e){if(ri(e)==="Function")return ti(e)},Mr=typeof document=="object"&&document.all,ni=typeof Mr=="undefined"&&Mr!==void 0,xn={all:Mr,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"},Jr={},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={},kn={}.propertyIsEnumerable,jn=Object.getOwnPropertyDescriptor,si=jn&&!kn.call({1:2},1);Mn.f=si?function(r){var t=jn(this,r);return!!t&&t.enumerable}:kn;var Un=function(e,r){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:r}},ci=I,ui=D,li=ge,er=Object,fi=ci("".split),vi=ui(function(){return!er("z").propertyIsEnumerable(0)})?function(e){return li(e)=="String"?fi(e,""):er(e)}:er,be=function(e){return e==null},di=be,hi=TypeError,Xr=function(e){if(di(e))throw hi("Can't call method on "+e);return e},pi=vi,gi=Xr,bi=function(e){return pi(gi(e))},$t=g,Fn=xn,$i=Fn.all,j=Fn.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:$t(e)||e===$i}:function(e){return typeof e=="object"?e!==null:$t(e)},Bn={},rr=Bn,tr=b,mi=g,mt=function(e){return mi(e)?e:void 0},K=function(e,r){return arguments.length<2?mt(rr[e])||mt(tr[e]):rr[e]&&rr[e][r]||tr[e]&&tr[e][r]},yi=I,We=yi({}.isPrototypeOf),He=typeof navigator!="undefined"&&String(navigator.userAgent)||"",Wn=b,nr=He,yt=Wn.process,St=Wn.Deno,Et=yt&&yt.versions||St&&St.version,Tt=Et&&Et.v8,A,ke;Tt&&(A=Tt.split("."),ke=A[0]>0&&A[0]<4?1:+(A[0]+A[1]));!ke&&nr&&(A=nr.match(/Edge\/(\d+)/),(!A||A[1]>=74)&&(A=nr.match(/Chrome\/(\d+)/),A&&(ke=+A[1])));var Hn=ke,Ot=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&&Ot&&Ot<41}),Oi=Kn,Gn=Oi&&!Symbol.sham&&typeof Symbol.iterator=="symbol",_i=K,wi=g,Pi=We,Ai=Gn,Ii=Object,Vn=Ai?function(e){return typeof e=="symbol"}:function(e){var r=_i("Symbol");return wi(r)&&Pi(r.prototype,Ii(e))},Ri=String,Ke=function(e){try{return Ri(e)}catch(r){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,r){var t=e[r];return Li(t)?void 0:xi(t)},or=_,ir=g,ar=j,Mi=TypeError,ki=function(e,r){var t,n;if(r==="string"&&ir(t=e.toString)&&!ar(n=or(t,e))||ir(t=e.valueOf)&&!ar(n=or(t,e))||r!=="string"&&ir(t=e.toString)&&!ar(n=or(t,e)))return n;throw Mi("Can't convert object to primitive value")},qn={exports:{}},ji=!0,_t=b,Ui=Object.defineProperty,Fi=function(e,r){try{Ui(_t,e,{value:r,configurable:!0,writable:!0})}catch(t){_t[e]=r}return r},Bi=b,Wi=Fi,wt="__core-js_shared__",Hi=Bi[wt]||Wi(wt,{}),Zr=Hi,Pt=Zr;(qn.exports=function(e,r){return Pt[e]||(Pt[e]=r!==void 0?r:{})})("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=Xr,Gi=Object,Qn=function(e){return Gi(Ki(e))},Vi=I,qi=Qn,zi=Vi({}.hasOwnProperty),V=Object.hasOwn||function(r,t){return zi(qi(r),t)},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,At=V,ra=Yn,ta=Kn,na=Gn,re=Zi.Symbol,sr=ea("wks"),oa=na?re.for||re:re&&re.withoutSetter||ra,w=function(e){return At(sr,e)||(sr[e]=ta&&At(re,e)?re[e]:oa("Symbol."+e)),sr[e]},ia=_,It=j,Rt=Vn,aa=Ge,sa=ki,ca=w,ua=TypeError,la=ca("toPrimitive"),fa=function(e,r){if(!It(e)||Rt(e))return e;var t=aa(e,la),n;if(t){if(r===void 0&&(r="default"),n=ia(t,e,r),!It(n)||Rt(n))return n;throw ua("Can't convert object to primitive value")}return r===void 0&&(r="number"),sa(e,r)},va=fa,da=Vn,Jn=function(e){var r=va(e,"string");return da(r)?r:r+""},ha=b,Ct=j,kr=ha.document,pa=Ct(kr)&&Ct(kr.createElement),Xn=function(e){return pa?kr.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,wa=Zn,Nt=Object.getOwnPropertyDescriptor;Jr.f=ma?Nt:function(r,t){if(r=Ta(r),t=Oa(t),wa)try{return Nt(r,t)}catch(n){}if(_a(r,t))return Ea(!ya(Sa.f,r,t),r[t])};var Pa=D,Aa=g,Ia=/#|\.prototype\./,$e=function(e,r){var t=Ca[Ra(e)];return t==Da?!0:t==Na?!1:Aa(r)?Pa(r):!!r},Ra=$e.normalize=function(e){return String(e).replace(Ia,".").toLowerCase()},Ca=$e.data={},Na=$e.NATIVE="N",Da=$e.POLYFILL="P",eo=$e,Dt=Dn,xa=G,La=Be,Ma=Dt(Dt.bind),Ve=function(e,r){return xa(e),r===void 0?e:La?Ma(e,r):function(){return e.apply(r,arguments)}},qe={},ka=ie,ja=D,Ua=ka&&ja(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),Fa=j,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,xt=Jn,Va=TypeError,cr=Object.defineProperty,qa=Object.getOwnPropertyDescriptor,ur="enumerable",lr="configurable",fr="writable";qe.f=Ha?Ga?function(r,t,n){if(Te(r),t=xt(t),Te(n),typeof r=="function"&&t==="prototype"&&"value"in n&&fr in n&&!n[fr]){var o=qa(r,t);o&&o[fr]&&(r[t]=n.value,n={configurable:lr in n?n[lr]:o[lr],enumerable:ur in n?n[ur]:o[ur],writable:!1})}return cr(r,t,n)}:cr:function(r,t,n){if(Te(r),t=xt(t),Te(n),Ka)try{return cr(r,t,n)}catch(o){}if("get"in n||"set"in n)throw Va("Accessors not supported");return"value"in n&&(r[t]=n.value),r};var za=ie,Qa=qe,Ya=Un,ze=za?function(e,r,t){return Qa.f(e,r,Ya(1,t))}:function(e,r,t){return e[r]=t,e},Oe=b,Ja=In,Xa=Dn,Za=g,es=Jr.f,rs=eo,Y=Bn,ts=Ve,J=ze,Lt=V,ns=function(e){var r=function(t,n,o){if(this instanceof r){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,o)}return Ja(e,this,arguments)};return r.prototype=e.prototype,r},U=function(e,r){var t=e.target,n=e.global,o=e.stat,a=e.proto,s=n?Oe:o?Oe[t]:(Oe[t]||{}).prototype,f=n?Y:Y[t]||J(Y,t,{})[t],u=f.prototype,c,i,l,d,v,h,p,m,z;for(d in r)c=rs(n?d:t+(o?".":"#")+d,e.forced),i=!c&&s&&Lt(s,d),h=f[d],i&&(e.dontCallGetSet?(z=es(s,d),p=z&&z.value):p=s[d]),v=i&&p?p:r[d],!(i&&typeof h==typeof v)&&(e.bind&&i?m=ts(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=t+"Prototype",Lt(Y,l)||J(Y,l,{}),J(Y[l],d,v),e.real&&u&&(c||!u[d])&&J(u,d,v)))},os=j,is=ge,as=w,ss=as("match"),cs=function(e){var r;return os(e)&&((r=e[ss])!==void 0?!!r:is(e)=="RegExp")},us=w,ls=us("toStringTag"),ro={};ro[ls]="z";var et=String(ro)==="[object z]",fs=et,vs=g,Ne=ge,ds=w,hs=ds("toStringTag"),ps=Object,gs=Ne(function(){return arguments}())=="Arguments",bs=function(e,r){try{return e[r]}catch(t){}},Qe=fs?Ne:function(e){var r,t,n;return e===void 0?"Undefined":e===null?"Null":typeof(t=bs(r=ps(e),hs))=="string"?t:gs?Ne(r):(n=Ne(r))=="Object"&&vs(r.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),r="";return e.hasIndices&&(r+="d"),e.global&&(r+="g"),e.ignoreCase&&(r+="i"),e.multiline&&(r+="m"),e.dotAll&&(r+="s"),e.unicode&&(r+="u"),e.unicodeSets&&(r+="v"),e.sticky&&(r+="y"),r},Ts=_,Os=V,_s=We,ws=Es,Mt=RegExp.prototype,Ps=function(e){var r=e.flags;return r===void 0&&!("flags"in Mt)&&!Os(e,"flags")&&_s(Mt,e)?Ts(ws,e):r},rt=I,As=Qn,Is=Math.floor,vr=rt("".charAt),Rs=rt("".replace),dr=rt("".slice),Cs=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Ns=/\$([$&'`]|\d{1,2})/g,Ds=function(e,r,t,n,o,a){var s=t+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(vr(i,0)){case"$":return"$";case"&":return e;case"`":return dr(r,0,t);case"'":return dr(r,s);case"<":l=o[dr(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?vr(i,1):n[v-1]+vr(i,1):c}l=n[d-1]}return l===void 0?"":l})},xs=U,Ls=_,tt=I,kt=Xr,Ms=g,ks=be,js=cs,X=ys,Us=Ge,Fs=Ps,Bs=Ds,Ws=w,Hs=Ws("replace"),Ks=TypeError,to=tt("".indexOf),Gs=tt("".replace),jt=tt("".slice),Vs=Math.max,Ut=function(e,r,t){return t>e.length?-1:r===""?t:to(e,r,t)};xs({target:"String",proto:!0},{replaceAll:function(r,t){var n=kt(this),o,a,s,f,u,c,i,l,d,v=0,h=0,p="";if(!ks(r)){if(o=js(r),o&&(a=X(kt(Fs(r))),!~to(a,"g")))throw Ks("`.replaceAll` does not allow non-global regexes");if(s=Us(r,Hs),s)return Ls(s,r,n,t);if(o)return Gs(X(n),r,t)}for(f=X(n),u=X(r),c=Ms(t),c||(t=X(t)),i=u.length,l=Vs(1,i),v=Ut(f,u,0);v!==-1;)d=c?X(t(u,v,f)):Bs(u,f,v,[],void 0,t),p+=jt(f,h,v)+d,h=v+i,v=Ut(f,u,v+l);return h<f.length&&(p+=jt(f,h)),p}});var qs=K,no=qs,zs=no,Qs=zs("String","replaceAll"),Ys=Qs,Js=Ys,Xs=Js,Zs=Xs,ec=Pn(Zs),rc=ge,Ye=typeof process!="undefined"&&rc(process)=="process",tc=ze,nc=function(e,r,t,n){return n&&n.enumerable?e[r]=t:tc(e,r,t),e},oc=et,ic=Qe,ac=oc?{}.toString:function(){return"[object "+ic(this)+"]"},sc=et,cc=qe.f,uc=ze,lc=V,fc=ac,vc=w,Ft=vc("toStringTag"),dc=function(e,r,t,n){if(e){var o=t?e:e.prototype;lc(o,Ft)||cc(o,Ft,{configurable:!0,value:r}),n&&!sc&&uc(o,"toString",fc)}},hc=qe,pc=function(e,r,t){return hc.f(e,r,t)},gc=K,bc=pc,$c=w,mc=ie,Bt=$c("species"),yc=function(e){var r=gc(e);mc&&r&&!r[Bt]&&bc(r,Bt,{configurable:!0,get:function(){return this}})},Sc=We,Ec=TypeError,Tc=function(e,r){if(Sc(r,e))return e;throw Ec("Incorrect invocation")},Oc=I,_c=g,jr=Zr,wc=Oc(Function.toString);_c(jr.inspectSource)||(jr.inspectSource=function(e){return wc(e)});var oo=jr.inspectSource,Pc=I,Ac=D,io=g,Ic=Qe,Rc=K,Cc=oo,ao=function(){},Nc=[],so=Rc("Reflect","construct"),nt=/^\s*(?:class|function)\b/,Dc=Pc(nt.exec),xc=!nt.exec(ao),ue=function(r){if(!io(r))return!1;try{return so(ao,Nc,r),!0}catch(t){return!1}},co=function(r){if(!io(r))return!1;switch(Ic(r)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return xc||!!Dc(nt,Cc(r))}catch(t){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,kc=Ke,jc=TypeError,Uc=function(e){if(Mc(e))return e;throw jc(kc(e)+" is not a constructor")},Wt=q,Fc=Uc,Bc=be,Wc=w,Hc=Wc("species"),uo=function(e,r){var t=Wt(e).constructor,n;return t===void 0||Bc(n=Wt(t)[Hc])?r:Fc(n)},Kc=K,Gc=Kc("document","documentElement"),Vc=I,qc=Vc([].slice),zc=TypeError,Qc=function(e,r){if(e<r)throw zc("Not enough arguments");return e},Yc=He,lo=/(?:ipad|iphone|ipod).*applewebkit/i.test(Yc),E=b,Jc=In,Xc=Ve,Ht=g,Zc=V,fo=D,Kt=Gc,eu=qc,Gt=Xn,ru=Qc,tu=lo,nu=Ye,Ur=E.setImmediate,Fr=E.clearImmediate,ou=E.process,hr=E.Dispatch,iu=E.Function,Vt=E.MessageChannel,au=E.String,pr=0,ve={},qt="onreadystatechange",he,F,gr,br;fo(function(){he=E.location});var ot=function(e){if(Zc(ve,e)){var r=ve[e];delete ve[e],r()}},$r=function(e){return function(){ot(e)}},zt=function(e){ot(e.data)},Qt=function(e){E.postMessage(au(e),he.protocol+"//"+he.host)};(!Ur||!Fr)&&(Ur=function(r){ru(arguments.length,1);var t=Ht(r)?r:iu(r),n=eu(arguments,1);return ve[++pr]=function(){Jc(t,void 0,n)},F(pr),pr},Fr=function(r){delete ve[r]},nu?F=function(e){ou.nextTick($r(e))}:hr&&hr.now?F=function(e){hr.now($r(e))}:Vt&&!tu?(gr=new Vt,br=gr.port2,gr.port1.onmessage=zt,F=Xc(br.postMessage,br)):E.addEventListener&&Ht(E.postMessage)&&!E.importScripts&&he&&he.protocol!=="file:"&&!fo(Qt)?(F=Qt,E.addEventListener("message",zt,!1)):qt in Gt("script")?F=function(e){Kt.appendChild(Gt("script"))[qt]=function(){Kt.removeChild(this),ot(e)}}:F=function(e){setTimeout($r(e),0)});var vo={set:Ur,clear:Fr},ho=function(){this.head=null,this.tail=null};ho.prototype={add:function(e){var r={item:e,next:null},t=this.tail;t?t.next=r:this.head=r,this.tail=r},get:function(){var e=this.head;if(e){var r=this.head=e.next;return r===null&&(this.tail=null),e.item}}};var po=ho,su=He,cu=/ipad|iphone|ipod/i.test(su)&&typeof Pebble!="undefined",uu=He,lu=/web0s(?!.*chrome)/i.test(uu),H=b,Yt=Ve,fu=Jr.f,mr=vo.set,vu=po,du=lo,hu=cu,pu=lu,yr=Ye,Jt=H.MutationObserver||H.WebKitMutationObserver,Xt=H.document,Zt=H.process,_e=H.Promise,en=fu(H,"queueMicrotask"),Br=en&&en.value,Z,Sr,Er,we,rn;if(!Br){var Pe=new vu,Ae=function(){var e,r;for(yr&&(e=Zt.domain)&&e.exit();r=Pe.get();)try{r()}catch(t){throw Pe.head&&Z(),t}e&&e.enter()};!du&&!yr&&!pu&&Jt&&Xt?(Sr=!0,Er=Xt.createTextNode(""),new Jt(Ae).observe(Er,{characterData:!0}),Z=function(){Er.data=Sr=!Sr}):!hu&&_e&&_e.resolve?(we=_e.resolve(void 0),we.constructor=_e,rn=Yt(we.then,we),Z=function(){rn(Ae)}):yr?Z=function(){Zt.nextTick(Ae)}:(mr=Yt(mr,H),Z=function(){mr(Ae)}),Br=function(e){Pe.head||Z(),Pe.add(e)}}var gu=Br,bu=function(e,r){try{arguments.length==1?console.error(e):console.error(e,r)}catch(t){}},it=function(e){try{return{error:!1,value:e()}}catch(r){return{error:!0,value:r}}},$u=b,mu=g,tn=$u.WeakMap,yu=mu(tn)&&/native code/.test(String(tn)),Su=zn,Eu=Yn,nn=Su("keys"),Tu=function(e){return nn[e]||(nn[e]=Eu(e))},Ou=yu,go=b,_u=j,wu=ze,Tr=V,Or=Zr,Pu=Tu,on="Object already initialized",Wr=go.TypeError,Au=go.WeakMap,je,pe,Ue,Iu=function(e){return Ue(e)?pe(e):je(e,{})},Ru=function(e){return function(r){var t;if(!_u(r)||(t=pe(r)).type!==e)throw Wr("Incompatible receiver, "+e+" required");return t}};if(Ou||Or.state){var C=Or.state||(Or.state=new Au);C.get=C.get,C.has=C.has,C.set=C.set,je=function(e,r){if(C.has(e))throw Wr(on);return r.facade=e,C.set(e,r),r},pe=function(e){return C.get(e)||{}},Ue=function(e){return C.has(e)}}else{var le=Pu("state");je=function(e,r){if(Tr(e,le))throw Wr(on);return r.facade=e,wu(e,le,r),r},pe=function(e){return Tr(e,le)?e[le]:{}},Ue=function(e){return Tr(e,le)}}var Cu={set:je,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,ku=g,ju=eo,Uu=oo,Fu=w,Bu=Lu,Wu=bo,_r=Hn,an=de&&de.prototype,Hu=Fu("species"),Hr=!1,$o=ku(Mu.PromiseRejectionEvent),Ku=ju("Promise",function(){var e=Uu(de),r=e!==String(de);if(!r&&_r===66||!(an.catch&&an.finally))return!0;if(!_r||_r<51||!/native code/.test(e)){var t=new de(function(a){a(1)}),n=function(a){a(function(){},function(){})},o=t.constructor={};if(o[Hu]=n,Hr=t.then(function(){})instanceof n,!Hr)return!0}return!r&&(Bu||Wu)&&!$o}),me={CONSTRUCTOR:Ku,REJECTION_EVENT:$o,SUBCLASSING:Hr},se={},sn=G,Gu=TypeError,Vu=function(e){var r,t;this.promise=new e(function(n,o){if(r!==void 0||t!==void 0)throw Gu("Bad Promise constructor");r=n,t=o}),this.resolve=sn(r),this.reject=sn(t)};se.f=function(e){return new Vu(e)};var qu=U,Fe=Ye,k=b,ye=_,zu=nc,Qu=dc,Yu=yc,Ju=G,Kr=g,Xu=j,Zu=Tc,el=uo,mo=vo.set,at=gu,rl=bu,tl=it,nl=po,yo=Cu,Gr=ae,st=me,So=se,Je="Promise",Eo=st.CONSTRUCTOR,ol=st.REJECTION_EVENT;st.SUBCLASSING;var wr=yo.getterFor(Je),il=yo.set,al=Gr&&Gr.prototype,te=Gr,Pr=al,To=k.TypeError,Vr=k.document,ct=k.process,qr=So.f,sl=qr,cl=!!(Vr&&Vr.createEvent&&k.dispatchEvent),Oo="unhandledrejection",ul="rejectionhandled",cn=0,_o=1,ll=2,ut=1,wo=2,Ie,un,fl,Po=function(e){var r;return Xu(e)&&Kr(r=e.then)?r:!1},Ao=function(e,r){var t=r.value,n=r.state==_o,o=n?e.ok:e.fail,a=e.resolve,s=e.reject,f=e.domain,u,c,i;try{o?(n||(r.rejection===wo&&dl(r),r.rejection=ut),o===!0?u=t:(f&&f.enter(),u=o(t),f&&(f.exit(),i=!0)),u===e.promise?s(To("Promise-chain cycle")):(c=Po(u))?ye(c,u,a,s):a(u)):s(t)}catch(l){f&&!i&&f.exit(),s(l)}},Io=function(e,r){e.notified||(e.notified=!0,at(function(){for(var t=e.reactions,n;n=t.get();)Ao(n,e);e.notified=!1,r&&!e.rejection&&vl(e)}))},Ro=function(e,r,t){var n,o;cl?(n=Vr.createEvent("Event"),n.promise=r,n.reason=t,n.initEvent(e,!1,!0),k.dispatchEvent(n)):n={promise:r,reason:t},!ol&&(o=k["on"+e])?o(n):e===Oo&&rl("Unhandled promise rejection",t)},vl=function(e){ye(mo,k,function(){var r=e.facade,t=e.value,n=ln(e),o;if(n&&(o=tl(function(){Fe?ct.emit("unhandledRejection",t,r):Ro(Oo,r,t)}),e.rejection=Fe||ln(e)?wo:ut,o.error))throw o.value})},ln=function(e){return e.rejection!==ut&&!e.parent},dl=function(e){ye(mo,k,function(){var r=e.facade;Fe?ct.emit("rejectionHandled",r):Ro(ul,r,e.value)})},ne=function(e,r,t){return function(n){e(r,n,t)}},oe=function(e,r,t){e.done||(e.done=!0,t&&(e=t),e.value=r,e.state=ll,Io(e,!0))},zr=function(e,r,t){if(!e.done){e.done=!0,t&&(e=t);try{if(e.facade===r)throw To("Promise can't be resolved itself");var n=Po(r);n?at(function(){var o={done:!1};try{ye(n,r,ne(zr,o,e),ne(oe,o,e))}catch(a){oe(o,a,e)}}):(e.value=r,e.state=_o,Io(e,!1))}catch(o){oe({done:!1},o,e)}}};Eo&&(te=function(r){Zu(this,Pr),Ju(r),ye(Ie,this);var t=wr(this);try{r(ne(zr,t),ne(oe,t))}catch(n){oe(t,n)}},Pr=te.prototype,Ie=function(r){il(this,{type:Je,done:!1,notified:!1,parent:!1,reactions:new nl,rejection:!1,state:cn,value:void 0})},Ie.prototype=zu(Pr,"then",function(r,t){var n=wr(this),o=qr(el(this,te));return n.parent=!0,o.ok=Kr(r)?r:!0,o.fail=Kr(t)&&t,o.domain=Fe?ct.domain:void 0,n.state==cn?n.reactions.add(o):at(function(){Ao(o,n)}),o.promise}),un=function(){var e=new Ie,r=wr(e);this.promise=e,this.resolve=ne(zr,r),this.reject=ne(oe,r)},So.f=qr=function(e){return e===te||e===fl?new un(e):sl(e)});qu({global:!0,constructor:!0,wrap:!0,forced:Eo},{Promise:te});Qu(te,Je,!1,!0);Yu(Je);var Co={},hl=w,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(r){var t=+r;return(t>0?yl:ml)(t)},El=Sl,Tl=function(e){var r=+e;return r!==r||r===0?0:El(r)},Ol=Tl,_l=Math.min,wl=function(e){return e>0?_l(Ol(e),9007199254740991):0},Pl=wl,Al=function(e){return Pl(e.length)},Il=Qe,fn=Ge,Rl=be,Cl=Co,Nl=w,Dl=Nl("iterator"),No=function(e){if(!Rl(e))return fn(e,Dl)||fn(e,"@@iterator")||Cl[Il(e)]},xl=_,Ll=G,Ml=q,kl=Ke,jl=No,Ul=TypeError,Fl=function(e,r){var t=arguments.length<2?jl(e):r;if(Ll(t))return Ml(xl(t,e));throw Ul(kl(e)+" is not iterable")},Bl=_,vn=q,Wl=Ge,Hl=function(e,r,t){var n,o;vn(e);try{if(n=Wl(e,"return"),!n){if(r==="throw")throw t;return t}n=Bl(n,e)}catch(a){o=!0,n=a}if(r==="throw")throw t;if(o)throw n;return vn(n),t},Kl=Ve,Gl=_,Vl=q,ql=Ke,zl=$l,Ql=Al,dn=We,Yl=Fl,Jl=No,hn=Hl,Xl=TypeError,De=function(e,r){this.stopped=e,this.result=r},pn=De.prototype,Do=function(e,r,t){var n=t&&t.that,o=!!(t&&t.AS_ENTRIES),a=!!(t&&t.IS_RECORD),s=!!(t&&t.IS_ITERATOR),f=!!(t&&t.INTERRUPTED),u=Kl(r,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=w,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 rf=function(e,r){if(!r&&!Lo)return!1;var t=!1;try{var n={};n[xo]=function(){return{next:function(){return{done:t=!0}}}},e(n)}catch(o){}return t},tf=ae,nf=rf,of=me.CONSTRUCTOR,Mo=of||!nf(function(e){tf.all(e).then(void 0,function(){})}),af=U,sf=_,cf=G,uf=se,lf=it,ff=Do,vf=Mo;af({target:"Promise",stat:!0,forced:vf},{all:function(r){var t=this,n=uf.f(t),o=n.resolve,a=n.reject,s=lf(function(){var f=cf(t.resolve),u=[],c=0,i=1;ff(r,function(l){var d=c++,v=!1;i++,sf(f,t,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=it,yf=Do,Sf=Mo;pf({target:"Promise",stat:!0,forced:Sf},{race:function(r){var t=this,n=$f.f(t),o=n.reject,a=mf(function(){var s=bf(t.resolve);yf(r,function(f){gf(s,t,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(r){var t=Of.f(this);return Tf(t.reject,void 0,r),t.promise}});var wf=q,Pf=j,Af=se,ko=function(e,r){if(wf(e),Pf(r)&&r.constructor===e)return r;var t=Af.f(e),n=t.resolve;return n(r),t.promise},If=U,Rf=K,Cf=ji,Nf=ae,Df=me.CONSTRUCTOR,xf=ko,Lf=Rf("Promise"),Mf=!Df;If({target:"Promise",stat:!0,forced:Cf},{resolve:function(r){return xf(Mf&&this===Lf?Nf:this,r)}});var kf=U,Qr=ae,jf=D,Uf=K,Ff=g,Bf=uo,$n=ko,Wf=Qr&&Qr.prototype,Hf=!!Qr&&jf(function(){Wf.finally.call({then:function(){}},function(){})});kf({target:"Promise",proto:!0,real:!0,forced:Hf},{finally:function(e){var r=Bf(this,Uf("Promise")),t=Ff(e);return this.then(t?function(n){return $n(r,e()).then(function(){return n})}:e,t?function(n){return $n(r,e()).then(function(){throw n})}:e)}});var Kf=no,Gf=Kf("Promise","finally"),Vf=Gf,qf=Vf,zf=qf,Qf=zf,Ar=Pn(Qf);function Yf(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=new Array(36);let t=0,n,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?r[o]="-":o===14?r[o]="4":(t<=2&&(t=33554432+Math.random()*16777216|0),n=t&15,t=t>>4,r[o]=e[o===19?n&3|8:n]);return r.join("")}const mn="1.0.39",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_",Ir=`${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(r){this.consequentAuthErrors=0,this.authorized$=new Yr(!1),this.params=r;const t=M.get(Ir);t?t.startsWith('"')&&t.endsWith('"')?(this.uuid=ec(t,'"',""),M.set(Ir,this.uuid)):this.uuid=t:(this.uuid=Yf(),M.set(Ir,this.uuid))}authorize(r){return L(this,void 0,void 0,function*(){return this.authToken=r!=null?r:yield this.refreshAuthToken(),this._authorizeWithBackoff()})}logBeacon(r){const t="log.externalLog",n=this.createLogParams(r),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(t,n,o)||this.logRequest(r)}logRequest(r){var t;return L(this,void 0,void 0,function*(){const n="log.externalLog",o=this.createLogParams(r),a=(t=this.sessionKey)!==null&&t!==void 0?t:yield this._authorizeWithBackoff();if(!a)return;const 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:P.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:P.EXTERNAL_API,message:`${n} error`,data:c});return}}}});return s(r)})}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=Ar(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise})}createLogParams(r){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${mn}`,platform:this.params.mobile?"M_WEB":"WEB",items:r})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();const r=Wo(this.consequentAuthErrors,this.params.config.backoff);return new Promise(t=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{Ar(this._authorize().then(t).catch(n=>this.params.error$.next({id:"AuthorizeBackoff",category:P.NETWORK,message:"Otherwise unhandled error in authorization",thrown:n})),()=>this.backoffTimeoutId=0)},r))})}_authorize(){return L(this,void 0,void 0,function*(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);const r="auth.anonymLogin",t={session_data:{version:2,device_id:this.uuid,client_version:mn.split("-")[0],client_type:"SDK_JS"}};return this.authToken!==void 0&&(t.session_data.auth_token=this.authToken,t.session_data.version=3),this.authorizePromise=Ar(this.params.apiTransport.sendRequest(r,t).then(n=>{var o;return(!n||!n.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:P.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:P.EXTERNAL_API,message:"authorize error",data:n}):this.params.error$.next({id:"AuthorizeUnknown",category:P.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(r,t,n){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:t,options:n})}removeEventListener(r,t){if(!(r in this.listeners))return;const n=this.listeners[r];for(let o=0,a=n.length;o<a;o++)if(n[o].callback===t){n.splice(o,1);return}}dispatchEvent(r){if(!(r.type in this.listeners))return;const n=this.listeners[r.type].slice();for(let o=0,a=n.length;o<a;o++){const s=n[o];try{s.callback.call(this,r)}catch(f){Promise.resolve().then(()=>{throw f})}s.options&&s.options.once&&this.removeEventListener(r.type,s.callback)}return!r.defaultPrevented}}class jo 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(r){r.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,r)),super.dispatchEvent(r)}}class ev{constructor(){Object.defineProperty(this,"signal",{value:new jo,writable:!0,configurable:!0})}abort(r){let t;try{t=new Event("abort")}catch(o){typeof document!="undefined"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}let n=r;if(n===void 0)if(typeof document=="undefined")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch(o){n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(t)}toString(){return"[object AbortController]"}}typeof Symbol!="undefined"&&Symbol.toStringTag&&(ev.prototype[Symbol.toStringTag]="AbortController",jo.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 rv(e){typeof e=="function"&&(e={fetch:e});const{fetch:r,Request:t=r.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=e;if(!Uo({fetch:r,Request:t,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o}))return{fetch:r,Request:a};let a=t;(a&&!a.prototype.hasOwnProperty("signal")||o)&&(a=function(c,i){let l;i&&i.signal&&(l=i.signal,delete i.signal);const d=new t(c,i);return l&&Object.defineProperty(d,"signal",{writable:!1,enumerable:!1,configurable:!0,value:l}),d},a.prototype=t.prototype);const s=r;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 lt=Uo({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Fo=lt?rv({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,En=lt?Fo.fetch:window.fetch;lt?Fo.Request:window.Request;class tv{constructor(r){this.params=r,this.apiKey=r.apiKey,this.apiEnv=r.config.apiEnv,this.apiBaseUrl=yn[this.apiEnv],this.timeSynchronisation=r.timeSynchronisation,this.isApiBaseUrlFetched=!1}resolveApiBaseUrl(){var r;return L(this,void 0,void 0,function*(){if(this.apiEnv!==N.AUTO||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{const t=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=yield(yield En(t,{method:"GET",mode:"cors",cache:"no-cache"})).json(),a=(r=o==null?void 0:o.Answer[0])===null||r===void 0?void 0:r.data;if(!a)throw new Error("Wrong DNS response");return a}catch(t){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:P.NETWORK,message:"Unhandled resolve api base url error",thrown:t}),yn[N.VK_ALIAS]}finally{this.isApiBaseUrlFetched=!0}})}sendBeacon(r,t,n){if(!window.Blob||!window.navigator.sendBeacon)return!1;const o=this._prepareQueryParams({method:r,queryParams:t,sessionKey:n}),a=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,a)}catch(s){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:P.NETWORK,message:"Unhandled beacon error",thrown:s,data:{method:r,params:t}})}return!1}sendRequest(r,t,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:P.NETWORK,message:"Request failed",thrown:s});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:P.NETWORK,message:"Unhandled request error",thrown:s,data:{method:r,params:t,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:r,queryParams:t,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(r){const t=new URLSearchParams({format:"JSON",method:r.method,application_key:this.apiKey});return r.sessionKey!==void 0&&t.append("session_key",r.sessionKey),Object.entries(r.queryParams).forEach(([n,o])=>t.append(n,typeof o=="string"?o:JSON.stringify(o))),t}}const Re="onestat_events",Rr=e=>r=>r.timestamp+e>=S();class nv{constructor(r){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=r,this.api=r.api,this.error$=r.error$,this.userSalt=r.userSalt,this.firstFlush=dt(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});const t=M.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=dt(()=>this.safeFlush(),this.params.config.flushDebounceTime,{maxWait:t}),this.subscription=this.api.authorized$.subscribe(n=>{n&&this.debouncedFlush()}),this.housekeepStorage()}safeFlush(){var r;try{this.flush()}catch(t){this.error$.next({id:"LoggerError",category:P.WTF,message:(r=String(t))!==null&&r!==void 0?r:"Unknown logger error",thrown:t})}}readFromStorage(){const r=M.get(Re);try{return r?JSON.parse(r):{}}catch(t){}return{}}addToStorage(r){var t;if(!this.userSalt){this.unsaltedStorage.push(r);return}const n=this.readFromStorage(),a=((t=n[this.userSalt])!==null&&t!==void 0?t:[]).filter(Rr(this.params.config.storageExpiration));M.set(Re,JSON.stringify(Object.assign(Object.assign({},n),{[this.userSalt]:[...a,r]})))}getFromStorage(){var r;return this.userSalt?((r=this.readFromStorage()[this.userSalt])!==null&&r!==void 0?r:[]).filter(Rr(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}const r=this.readFromStorage();delete r[this.userSalt],M.set(Re,JSON.stringify(r))}housekeepStorage(){const r=this.readFromStorage();for(const[t,n]of Object.entries(r)){const o=n.filter(Rr(this.params.config.storageExpiration));o.length?r[t]=o:delete r[t]}M.set(Re,JSON.stringify(r))}log(r){this.addToStorage(r),!this.isPaused&&(this.isUrgent(r)?this.flush():this.lastVsid!==r.custom.vsid?this.firstFlush():this.debouncedFlush(),this.lastVsid=r.custom.vsid)}flush(r=!1){const t=this.getFromStorage();t.length!==0&&(this.api.authorized$.getValue()?(r&&this.params.config.useBeacon?this.api.logBeacon(t):this.api.logRequest(t),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,r;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&&(r=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!r&&document.referrer&&(r=document.referrer)}catch(n){console.error(n)}const t=r?new URL(r).hostname:void 0;return{isEmbed:e,host:t}},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)}},Cr=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(r){this.offset=void 0,this.offset=r}getOffset(){var r;return(r=this.offset)!==null&&r!==void 0?r:0}setOffset(r){this.offset=r}now(){var r;return Date.now()+((r=this.offset)!==null&&r!==void 0?r:0)}date(r=new Date){var t;return r.setTime(r.getTime()+((t=this.offset)!==null&&t!==void 0?t:0)),r}addServerTime(r,t){const n=Date.now(),o=r-n-t/2;if(Math.abs(o)<1e3){this.offset=0;return}this.offset===void 0?this.offset=Math.round(o):this.offset=Math.round(.2*o+(1-.2)*this.offset)}}const On=()=>Math.floor(Math.random()*Math.pow(2,32)).toString(36).padStart(8,"0"),uv=e=>new Ho(r=>{const t=new xe,n=Ce(Dr(window,"beforeunload"),e.events.willDestruct$),o=new Yr(void 0);let a;t.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),t.add(a)}));const{playing$:s,paused$:f}=e.events,u=e.events.willSeek$.pipe(ft(()=>e.info.playbackState$.getValue()===ht.PLAYING)),c=e.events.seeked$.pipe(ft(()=>e.info.playbackState$.getValue()===ht.PLAYING));let i=!1;const l=new wn;t.add(u.subscribe(()=>{i||l.next(),i=!0})),t.add(c.subscribe(()=>i=!1));const d=Ce(s,c),v=Ce(f,l,n,e.events.looped$);let h;return t.add(d.subscribe(()=>h=o.getValue())),t.add(v.subscribe(()=>{const p=o.getValue();xr(h)||h===p||xr(p)||(r.next({from:h,to:p}),h=void 0)})),t}),Nr=()=>{const e=new xe;return{subscription:e,subscribe:(r,t)=>{r&&e.add(r.subscribe(t))}}};class dv{constructor(r,t){var n,o;this.subscription=new xe,this.vsid=On(),this.seekAction$=new Yr(Me.UNKNOWN),this.statContext=r,this.config=Qo((n=t.config)!==null&&n!==void 0?n:{}),Q(t.apiEnv)&&(this.config.apiEnv=t.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new cv);const a=new wn;this.experimental={error$:a};const s=new tv({apiKey:Jf,config:this.config,error$:a,timeSynchronisation:this.timeSynchronisation});this.api=new Zf({config:this.config,apiTransport:s,refreshAuthToken:t.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:t.userSalt});const{isEmbed:f,host:u}=ov();this.isEmbed=f,this.embedParent=u,this.subscribe()}updateContext(r){this.statContext=Object.assign(Object.assign({},this.statContext),r)}attachTo(r){const t=new xe,n=(i,l)=>t.add(i.subscribe(l));n(r.events.willStart$,()=>{this.logActionPlay({position:r.info.position$.getValue()})}),n(r.events.looped$,()=>{this.resetViewSession(),this.logActionPlay({position:r.info.position$.getValue()})}),n(r.events.seeked$,()=>{this.logSeek({action:this.seekAction$.getValue(),time:r.info.position$.getValue()}),this.seekAction$.next(Me.UNKNOWN)}),n(r.events.paused$,()=>{this.logPause({position:r.info.position$.getValue()})}),n(r.events.willResume$,()=>{this.logPlay()}),n(r.events.started$,()=>{this.statContext.clip&&this.logWatchCoverageRecord({start:0,end:0})}),n(uv(r),i=>{const l=r.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(r.info.isStalled$,i=>{i?o=S():(Q(o)&&this.logEmptyBuffer({duration:S()-o}),o=void 0)});let a=!1;t.add(r.events.fatalError$.pipe(Vo()).subscribe(()=>a=!0)),n(r.events.willStop$,()=>{if(r.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(r.events.managedError$,({id:i})=>{this.logError({fatal:!1,errorType:i})}),n(r.events.fatalError$,({id:i})=>{this.logError({fatal:!0,errorType:i})});let s,f,u=!1;n(r.events.firstBytes$,i=>{s=S(),this.logFirstBytes({time:i})}),n(r.events.willStart$,()=>f=S()),n(r.info.currentBuffer$,i=>{!u&&i&&i.end-i.start>0&&Q(s)&&(this.logPlayerReady({duration:S()-s}),u=!0)}),n(r.events.firstFrame$,()=>{Q(s)&&!u&&(this.logPlayerReady({duration:S()-s}),u=!0),Q(f)&&this.logFirstFrame({time:S()-f})}),n(r.info.atLiveEdge$,i=>this.updateContext({liveEdge:i})),n(vt({muted:r.info.muted$,volume:r.info.volume$}),({muted:i,volume:l})=>this.updateContext({audible:!i&&l>0})),n(r.info.currentQuality$,i=>this.updateContext({quality:iv(i)})),n(r.info.isAutoQualityEnabled$,i=>this.updateContext({autoQuality:i})),n(r.info.currentFormat$,i=>this.updateContext({contentType:av(i)}));let c;return n(r.info.hostname$,i=>{this.updateContext({cdnHostname:i,failover:c!==void 0&&c!==i}),c=i}),n(r.info.throughputEstimation$,i=>this.updateContext({downloadSpeed:i})),n(r.info.httpConnectionType$,i=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:Tn(i)}),this.updateContext({connectionType:Tn(i)})}),n(r.info.httpConnectionReused$,i=>{xr(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:i}),this.updateContext({connectionReused:i})}),n(r.info.surface$,i=>this.updateContext({mode:Cr(i)})),n(vt({current:r.info.currentTextTrack$,available:r.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=r,this.uiEvents&&this.attachToUi(this.uiEvents),this.resubscribeBeforeunload(),this.subscription.add(t),t}attachToUi(r){this.uiEvents=r;const{subscription:t,subscribe:n}=Nr();return this.player&&(n(r.actionRewind$,()=>{this.player&&(this.resetViewSession(),this.logActionPlay({position:this.player.info.position$.getValue()}))}),n(r.actionSeek$,this.seekAction$),n(r.inPiP$,o=>{var a;const s=o?W.PIP:Cr((a=this.player)===null||a===void 0?void 0:a.info.surface$.getValue());this.updateContext({mode:s})}),n(r.inFullscreen$,o=>{var a;const s=o?W.FULLSCREEN:Cr((a=this.player)===null||a===void 0?void 0:a.info.surface$.getValue());this.updateContext({mode:s})}),n(r.actionSetSubtitle$,o=>this.updateContext({subtitles:o})),n(r.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(t)),t}attachToAds(r){const{subscription:t,subscribe:n}=Nr();return n(r.slotRequested$,()=>this.logAdSlotRequest()),n(r.started$,o=>this.logAdStarted(o)),n(r.paused$,()=>this.logAdPaused()),n(r.resumed$,()=>this.logAdResumed()),n(r.ended$,()=>this.logAdEnded()),n(r.skipped$,()=>this.logAdSkipped()),n(r.clicked$,()=>this.logAdClicked()),this.resubscribeBeforeunload(),this.subscription.add(t),t}attachToInteractive(r){const{subscription:t,subscribe:n}=Nr();return n(r.click$,o=>this.logInterfaceClick(o)),n(r.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(t),t}authorize(r){return this.api.authorize(r)}pause(){this.logger.pause()}resume(){this.logger.resume()}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.vsid=On()}setFieldBlacklist(){}logInited(){}logReady(r){this.log({operation:"player_ready",param:String(r.time)})}logStarted(...r){this.logActionPlay(...r)}logPlay(){this.log({operation:"play_toggle"})}logPause(r){this.log({operation:"pause",param:String(Math.round(r.position))})}logSeek(r){this.log({operation:"seek",param:r.action,time:r.time})}logFirstBytes(r){this.log({operation:"first_bytes",param:String(r.time)})}logFirstFrame(r){this.log({operation:"first_frame",param:String(r.time)})}logError(r){this.log({operation:"content_error",param:`${r.fatal?"fatal":"recoverable"}_${r.errorType}`})}logWatchCoverageRecord(r){this.log({operation:"watch_coverage_record",param:`${r.start}-${r.end}`})}logWatchCoverageLive(r){var t,n;const o=(n=(t=this.timeSynchronisation)===null||t===void 0?void 0:t.getOffset())!==null&&n!==void 0?n:0,a=r.start+o,s=r.end+o;this.log({operation:"watch_coverage_live",param:`${a}-${s}`})}logEmptyBuffer(r){this.log({operation:"empty_buffer",param:String(r.duration)})}logDownloadSpeed(){}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(r){this.log({operation:"adv",param:r})}logAdPaused(){this.log({operation:"adv",param:"pause"})}logAdResumed(){this.log({operation:"adv",param:"resume"})}logAdEnded(){this.log({operation:"adv",param:"ended"})}logAdSkipped(){this.log({operation:"adv",param:"skip"})}logAdClicked(){this.log({operation:"adv",param:"click"})}logInterfaceClick(r){this.log({operation:"player_interface_click",param:r})}logNextMovie(r){this.log({operation:"next_movie",param:String(r)})}subscribe(){this.resubscribeBeforeunload();const r=window.navigator.connection;r&&"onchange"in r&&"effectiveType"in r&&this.subscription.add(Ce(Dr(r,"change"),qo(["init"])).subscribe(()=>this.updateContext({network:sv(r.effectiveType)})))}resubscribeBeforeunload(){var r;(r=this.beforeunloadSubscription)===null||r===void 0||r.unsubscribe(),this.beforeunloadSubscription=Dr(window,"beforeunload").subscribe(()=>this.logger.flush(!0)),this.subscription.add(this.beforeunloadSubscription)}logPlayerReady(r){this.log({operation:"player_ready",param:String(Math.round(r.duration))})}logActionPlay(r){this.log({operation:"action_play",param:String(Math.round(r.position))})}logCloseAtEmptyBuffer(r){this.log({operation:"close_at_empty_buffer",param:String(Math.round(r.duration))})}logActionStop(){this.log({operation:"action_stop"})}log(r){if(this.config.disabledOperations.includes(r.operation))return;const t=this.createLogItem(r);this.logger.log(t)}createLogItem({operation:r,param:t,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=r==="empty_buffer"||r==="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:t,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:r,type:1,time:n,network:this.statContext.network,timestamp:s,custom:c}}}export{N as ApiEnv,fe as ConnectionType,y as ContentType,pt as InteractiveInterfaceClick,dv as OneStat,O as Quality,Me as SeekAction,mn as VERSION};
6
+ import{fillWithDefault as Bo,ValueSubject as Yr,safeStorage as M,getExponentialDelay as Wo,ErrorCategory as P,now as S,assertNever as _n,Observable as Ho,Subscription as xe,merge as Ce,fromEvent as Dr,filterChanged as Ko,map as Go,filter as ft,Subject as wn,isNullable as xr,isNonNullable as Q,once as Vo,combine as vt,observableFrom as qo}from"@vkontakte/videoplayer-shared/es2015.esm.js";import dt from"lodash/debounce.js";import{Surface as ce,VideoQuality as R,HttpConnectionType as Xe,VideoFormat as $,PlaybackState as ht}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 pt;(function(e){e.GRAPH_SHOW="iGraphShow",e.GRAPH_HIDE="iGraphHide",e.NEXT_AREA="iNextChapterArea",e.NEXT_BUTTON="iNextChapterBtn",e.WATCH_AGAIN="iWatchAgainBtn"})(pt||(pt={}));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,r,t,n){function o(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=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,r||[])).next())})}var Ze=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Pn(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(r){return!0}},Yo=D,Be=!Yo(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),Jo=Be,An=Function.prototype,gt=An.apply,bt=An.call,In=typeof Reflect=="object"&&Reflect.apply||(Jo?bt.bind(gt):function(){return bt.apply(gt,arguments)}),Rn=Be,Cn=Function.prototype,Lr=Cn.call,Xo=Rn&&Cn.bind.bind(Lr,Lr),I=Rn?Xo:function(e){return function(){return Lr.apply(e,arguments)}},Nn=I,Zo=Nn({}.toString),ei=Nn("".slice),ge=function(e){return ei(Zo(e),8,-1)},ri=ge,ti=I,Dn=function(e){if(ri(e)==="Function")return ti(e)},Mr=typeof document=="object"&&document.all,ni=typeof Mr=="undefined"&&Mr!==void 0,xn={all:Mr,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"},Jr={},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={},kn={}.propertyIsEnumerable,jn=Object.getOwnPropertyDescriptor,si=jn&&!kn.call({1:2},1);Mn.f=si?function(r){var t=jn(this,r);return!!t&&t.enumerable}:kn;var Un=function(e,r){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:r}},ci=I,ui=D,li=ge,er=Object,fi=ci("".split),vi=ui(function(){return!er("z").propertyIsEnumerable(0)})?function(e){return li(e)=="String"?fi(e,""):er(e)}:er,be=function(e){return e==null},di=be,hi=TypeError,Xr=function(e){if(di(e))throw hi("Can't call method on "+e);return e},pi=vi,gi=Xr,bi=function(e){return pi(gi(e))},$t=g,Fn=xn,$i=Fn.all,j=Fn.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:$t(e)||e===$i}:function(e){return typeof e=="object"?e!==null:$t(e)},Bn={},rr=Bn,tr=b,mi=g,mt=function(e){return mi(e)?e:void 0},K=function(e,r){return arguments.length<2?mt(rr[e])||mt(tr[e]):rr[e]&&rr[e][r]||tr[e]&&tr[e][r]},yi=I,We=yi({}.isPrototypeOf),He=typeof navigator!="undefined"&&String(navigator.userAgent)||"",Wn=b,nr=He,yt=Wn.process,St=Wn.Deno,Et=yt&&yt.versions||St&&St.version,Tt=Et&&Et.v8,A,ke;Tt&&(A=Tt.split("."),ke=A[0]>0&&A[0]<4?1:+(A[0]+A[1]));!ke&&nr&&(A=nr.match(/Edge\/(\d+)/),(!A||A[1]>=74)&&(A=nr.match(/Chrome\/(\d+)/),A&&(ke=+A[1])));var Hn=ke,Ot=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&&Ot&&Ot<41}),Oi=Kn,Gn=Oi&&!Symbol.sham&&typeof Symbol.iterator=="symbol",_i=K,wi=g,Pi=We,Ai=Gn,Ii=Object,Vn=Ai?function(e){return typeof e=="symbol"}:function(e){var r=_i("Symbol");return wi(r)&&Pi(r.prototype,Ii(e))},Ri=String,Ke=function(e){try{return Ri(e)}catch(r){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,r){var t=e[r];return Li(t)?void 0:xi(t)},or=_,ir=g,ar=j,Mi=TypeError,ki=function(e,r){var t,n;if(r==="string"&&ir(t=e.toString)&&!ar(n=or(t,e))||ir(t=e.valueOf)&&!ar(n=or(t,e))||r!=="string"&&ir(t=e.toString)&&!ar(n=or(t,e)))return n;throw Mi("Can't convert object to primitive value")},qn={exports:{}},ji=!0,_t=b,Ui=Object.defineProperty,Fi=function(e,r){try{Ui(_t,e,{value:r,configurable:!0,writable:!0})}catch(t){_t[e]=r}return r},Bi=b,Wi=Fi,wt="__core-js_shared__",Hi=Bi[wt]||Wi(wt,{}),Zr=Hi,Pt=Zr;(qn.exports=function(e,r){return Pt[e]||(Pt[e]=r!==void 0?r:{})})("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=Xr,Gi=Object,Qn=function(e){return Gi(Ki(e))},Vi=I,qi=Qn,zi=Vi({}.hasOwnProperty),V=Object.hasOwn||function(r,t){return zi(qi(r),t)},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,At=V,ra=Yn,ta=Kn,na=Gn,re=Zi.Symbol,sr=ea("wks"),oa=na?re.for||re:re&&re.withoutSetter||ra,w=function(e){return At(sr,e)||(sr[e]=ta&&At(re,e)?re[e]:oa("Symbol."+e)),sr[e]},ia=_,It=j,Rt=Vn,aa=Ge,sa=ki,ca=w,ua=TypeError,la=ca("toPrimitive"),fa=function(e,r){if(!It(e)||Rt(e))return e;var t=aa(e,la),n;if(t){if(r===void 0&&(r="default"),n=ia(t,e,r),!It(n)||Rt(n))return n;throw ua("Can't convert object to primitive value")}return r===void 0&&(r="number"),sa(e,r)},va=fa,da=Vn,Jn=function(e){var r=va(e,"string");return da(r)?r:r+""},ha=b,Ct=j,kr=ha.document,pa=Ct(kr)&&Ct(kr.createElement),Xn=function(e){return pa?kr.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,wa=Zn,Nt=Object.getOwnPropertyDescriptor;Jr.f=ma?Nt:function(r,t){if(r=Ta(r),t=Oa(t),wa)try{return Nt(r,t)}catch(n){}if(_a(r,t))return Ea(!ya(Sa.f,r,t),r[t])};var Pa=D,Aa=g,Ia=/#|\.prototype\./,$e=function(e,r){var t=Ca[Ra(e)];return t==Da?!0:t==Na?!1:Aa(r)?Pa(r):!!r},Ra=$e.normalize=function(e){return String(e).replace(Ia,".").toLowerCase()},Ca=$e.data={},Na=$e.NATIVE="N",Da=$e.POLYFILL="P",eo=$e,Dt=Dn,xa=G,La=Be,Ma=Dt(Dt.bind),Ve=function(e,r){return xa(e),r===void 0?e:La?Ma(e,r):function(){return e.apply(r,arguments)}},qe={},ka=ie,ja=D,Ua=ka&&ja(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),Fa=j,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,xt=Jn,Va=TypeError,cr=Object.defineProperty,qa=Object.getOwnPropertyDescriptor,ur="enumerable",lr="configurable",fr="writable";qe.f=Ha?Ga?function(r,t,n){if(Te(r),t=xt(t),Te(n),typeof r=="function"&&t==="prototype"&&"value"in n&&fr in n&&!n[fr]){var o=qa(r,t);o&&o[fr]&&(r[t]=n.value,n={configurable:lr in n?n[lr]:o[lr],enumerable:ur in n?n[ur]:o[ur],writable:!1})}return cr(r,t,n)}:cr:function(r,t,n){if(Te(r),t=xt(t),Te(n),Ka)try{return cr(r,t,n)}catch(o){}if("get"in n||"set"in n)throw Va("Accessors not supported");return"value"in n&&(r[t]=n.value),r};var za=ie,Qa=qe,Ya=Un,ze=za?function(e,r,t){return Qa.f(e,r,Ya(1,t))}:function(e,r,t){return e[r]=t,e},Oe=b,Ja=In,Xa=Dn,Za=g,es=Jr.f,rs=eo,Y=Bn,ts=Ve,J=ze,Lt=V,ns=function(e){var r=function(t,n,o){if(this instanceof r){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,o)}return Ja(e,this,arguments)};return r.prototype=e.prototype,r},U=function(e,r){var t=e.target,n=e.global,o=e.stat,a=e.proto,s=n?Oe:o?Oe[t]:(Oe[t]||{}).prototype,f=n?Y:Y[t]||J(Y,t,{})[t],u=f.prototype,c,i,l,d,v,h,p,m,z;for(d in r)c=rs(n?d:t+(o?".":"#")+d,e.forced),i=!c&&s&&Lt(s,d),h=f[d],i&&(e.dontCallGetSet?(z=es(s,d),p=z&&z.value):p=s[d]),v=i&&p?p:r[d],!(i&&typeof h==typeof v)&&(e.bind&&i?m=ts(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=t+"Prototype",Lt(Y,l)||J(Y,l,{}),J(Y[l],d,v),e.real&&u&&(c||!u[d])&&J(u,d,v)))},os=j,is=ge,as=w,ss=as("match"),cs=function(e){var r;return os(e)&&((r=e[ss])!==void 0?!!r:is(e)=="RegExp")},us=w,ls=us("toStringTag"),ro={};ro[ls]="z";var et=String(ro)==="[object z]",fs=et,vs=g,Ne=ge,ds=w,hs=ds("toStringTag"),ps=Object,gs=Ne(function(){return arguments}())=="Arguments",bs=function(e,r){try{return e[r]}catch(t){}},Qe=fs?Ne:function(e){var r,t,n;return e===void 0?"Undefined":e===null?"Null":typeof(t=bs(r=ps(e),hs))=="string"?t:gs?Ne(r):(n=Ne(r))=="Object"&&vs(r.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),r="";return e.hasIndices&&(r+="d"),e.global&&(r+="g"),e.ignoreCase&&(r+="i"),e.multiline&&(r+="m"),e.dotAll&&(r+="s"),e.unicode&&(r+="u"),e.unicodeSets&&(r+="v"),e.sticky&&(r+="y"),r},Ts=_,Os=V,_s=We,ws=Es,Mt=RegExp.prototype,Ps=function(e){var r=e.flags;return r===void 0&&!("flags"in Mt)&&!Os(e,"flags")&&_s(Mt,e)?Ts(ws,e):r},rt=I,As=Qn,Is=Math.floor,vr=rt("".charAt),Rs=rt("".replace),dr=rt("".slice),Cs=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Ns=/\$([$&'`]|\d{1,2})/g,Ds=function(e,r,t,n,o,a){var s=t+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(vr(i,0)){case"$":return"$";case"&":return e;case"`":return dr(r,0,t);case"'":return dr(r,s);case"<":l=o[dr(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?vr(i,1):n[v-1]+vr(i,1):c}l=n[d-1]}return l===void 0?"":l})},xs=U,Ls=_,tt=I,kt=Xr,Ms=g,ks=be,js=cs,X=ys,Us=Ge,Fs=Ps,Bs=Ds,Ws=w,Hs=Ws("replace"),Ks=TypeError,to=tt("".indexOf),Gs=tt("".replace),jt=tt("".slice),Vs=Math.max,Ut=function(e,r,t){return t>e.length?-1:r===""?t:to(e,r,t)};xs({target:"String",proto:!0},{replaceAll:function(r,t){var n=kt(this),o,a,s,f,u,c,i,l,d,v=0,h=0,p="";if(!ks(r)){if(o=js(r),o&&(a=X(kt(Fs(r))),!~to(a,"g")))throw Ks("`.replaceAll` does not allow non-global regexes");if(s=Us(r,Hs),s)return Ls(s,r,n,t);if(o)return Gs(X(n),r,t)}for(f=X(n),u=X(r),c=Ms(t),c||(t=X(t)),i=u.length,l=Vs(1,i),v=Ut(f,u,0);v!==-1;)d=c?X(t(u,v,f)):Bs(u,f,v,[],void 0,t),p+=jt(f,h,v)+d,h=v+i,v=Ut(f,u,v+l);return h<f.length&&(p+=jt(f,h)),p}});var qs=K,no=qs,zs=no,Qs=zs("String","replaceAll"),Ys=Qs,Js=Ys,Xs=Js,Zs=Xs,ec=Pn(Zs),rc=ge,Ye=typeof process!="undefined"&&rc(process)=="process",tc=ze,nc=function(e,r,t,n){return n&&n.enumerable?e[r]=t:tc(e,r,t),e},oc=et,ic=Qe,ac=oc?{}.toString:function(){return"[object "+ic(this)+"]"},sc=et,cc=qe.f,uc=ze,lc=V,fc=ac,vc=w,Ft=vc("toStringTag"),dc=function(e,r,t,n){if(e){var o=t?e:e.prototype;lc(o,Ft)||cc(o,Ft,{configurable:!0,value:r}),n&&!sc&&uc(o,"toString",fc)}},hc=qe,pc=function(e,r,t){return hc.f(e,r,t)},gc=K,bc=pc,$c=w,mc=ie,Bt=$c("species"),yc=function(e){var r=gc(e);mc&&r&&!r[Bt]&&bc(r,Bt,{configurable:!0,get:function(){return this}})},Sc=We,Ec=TypeError,Tc=function(e,r){if(Sc(r,e))return e;throw Ec("Incorrect invocation")},Oc=I,_c=g,jr=Zr,wc=Oc(Function.toString);_c(jr.inspectSource)||(jr.inspectSource=function(e){return wc(e)});var oo=jr.inspectSource,Pc=I,Ac=D,io=g,Ic=Qe,Rc=K,Cc=oo,ao=function(){},Nc=[],so=Rc("Reflect","construct"),nt=/^\s*(?:class|function)\b/,Dc=Pc(nt.exec),xc=!nt.exec(ao),ue=function(r){if(!io(r))return!1;try{return so(ao,Nc,r),!0}catch(t){return!1}},co=function(r){if(!io(r))return!1;switch(Ic(r)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return xc||!!Dc(nt,Cc(r))}catch(t){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,kc=Ke,jc=TypeError,Uc=function(e){if(Mc(e))return e;throw jc(kc(e)+" is not a constructor")},Wt=q,Fc=Uc,Bc=be,Wc=w,Hc=Wc("species"),uo=function(e,r){var t=Wt(e).constructor,n;return t===void 0||Bc(n=Wt(t)[Hc])?r:Fc(n)},Kc=K,Gc=Kc("document","documentElement"),Vc=I,qc=Vc([].slice),zc=TypeError,Qc=function(e,r){if(e<r)throw zc("Not enough arguments");return e},Yc=He,lo=/(?:ipad|iphone|ipod).*applewebkit/i.test(Yc),E=b,Jc=In,Xc=Ve,Ht=g,Zc=V,fo=D,Kt=Gc,eu=qc,Gt=Xn,ru=Qc,tu=lo,nu=Ye,Ur=E.setImmediate,Fr=E.clearImmediate,ou=E.process,hr=E.Dispatch,iu=E.Function,Vt=E.MessageChannel,au=E.String,pr=0,ve={},qt="onreadystatechange",he,F,gr,br;fo(function(){he=E.location});var ot=function(e){if(Zc(ve,e)){var r=ve[e];delete ve[e],r()}},$r=function(e){return function(){ot(e)}},zt=function(e){ot(e.data)},Qt=function(e){E.postMessage(au(e),he.protocol+"//"+he.host)};(!Ur||!Fr)&&(Ur=function(r){ru(arguments.length,1);var t=Ht(r)?r:iu(r),n=eu(arguments,1);return ve[++pr]=function(){Jc(t,void 0,n)},F(pr),pr},Fr=function(r){delete ve[r]},nu?F=function(e){ou.nextTick($r(e))}:hr&&hr.now?F=function(e){hr.now($r(e))}:Vt&&!tu?(gr=new Vt,br=gr.port2,gr.port1.onmessage=zt,F=Xc(br.postMessage,br)):E.addEventListener&&Ht(E.postMessage)&&!E.importScripts&&he&&he.protocol!=="file:"&&!fo(Qt)?(F=Qt,E.addEventListener("message",zt,!1)):qt in Gt("script")?F=function(e){Kt.appendChild(Gt("script"))[qt]=function(){Kt.removeChild(this),ot(e)}}:F=function(e){setTimeout($r(e),0)});var vo={set:Ur,clear:Fr},ho=function(){this.head=null,this.tail=null};ho.prototype={add:function(e){var r={item:e,next:null},t=this.tail;t?t.next=r:this.head=r,this.tail=r},get:function(){var e=this.head;if(e){var r=this.head=e.next;return r===null&&(this.tail=null),e.item}}};var po=ho,su=He,cu=/ipad|iphone|ipod/i.test(su)&&typeof Pebble!="undefined",uu=He,lu=/web0s(?!.*chrome)/i.test(uu),H=b,Yt=Ve,fu=Jr.f,mr=vo.set,vu=po,du=lo,hu=cu,pu=lu,yr=Ye,Jt=H.MutationObserver||H.WebKitMutationObserver,Xt=H.document,Zt=H.process,_e=H.Promise,en=fu(H,"queueMicrotask"),Br=en&&en.value,Z,Sr,Er,we,rn;if(!Br){var Pe=new vu,Ae=function(){var e,r;for(yr&&(e=Zt.domain)&&e.exit();r=Pe.get();)try{r()}catch(t){throw Pe.head&&Z(),t}e&&e.enter()};!du&&!yr&&!pu&&Jt&&Xt?(Sr=!0,Er=Xt.createTextNode(""),new Jt(Ae).observe(Er,{characterData:!0}),Z=function(){Er.data=Sr=!Sr}):!hu&&_e&&_e.resolve?(we=_e.resolve(void 0),we.constructor=_e,rn=Yt(we.then,we),Z=function(){rn(Ae)}):yr?Z=function(){Zt.nextTick(Ae)}:(mr=Yt(mr,H),Z=function(){mr(Ae)}),Br=function(e){Pe.head||Z(),Pe.add(e)}}var gu=Br,bu=function(e,r){try{arguments.length==1?console.error(e):console.error(e,r)}catch(t){}},it=function(e){try{return{error:!1,value:e()}}catch(r){return{error:!0,value:r}}},$u=b,mu=g,tn=$u.WeakMap,yu=mu(tn)&&/native code/.test(String(tn)),Su=zn,Eu=Yn,nn=Su("keys"),Tu=function(e){return nn[e]||(nn[e]=Eu(e))},Ou=yu,go=b,_u=j,wu=ze,Tr=V,Or=Zr,Pu=Tu,on="Object already initialized",Wr=go.TypeError,Au=go.WeakMap,je,pe,Ue,Iu=function(e){return Ue(e)?pe(e):je(e,{})},Ru=function(e){return function(r){var t;if(!_u(r)||(t=pe(r)).type!==e)throw Wr("Incompatible receiver, "+e+" required");return t}};if(Ou||Or.state){var C=Or.state||(Or.state=new Au);C.get=C.get,C.has=C.has,C.set=C.set,je=function(e,r){if(C.has(e))throw Wr(on);return r.facade=e,C.set(e,r),r},pe=function(e){return C.get(e)||{}},Ue=function(e){return C.has(e)}}else{var le=Pu("state");je=function(e,r){if(Tr(e,le))throw Wr(on);return r.facade=e,wu(e,le,r),r},pe=function(e){return Tr(e,le)?e[le]:{}},Ue=function(e){return Tr(e,le)}}var Cu={set:je,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,ku=g,ju=eo,Uu=oo,Fu=w,Bu=Lu,Wu=bo,_r=Hn,an=de&&de.prototype,Hu=Fu("species"),Hr=!1,$o=ku(Mu.PromiseRejectionEvent),Ku=ju("Promise",function(){var e=Uu(de),r=e!==String(de);if(!r&&_r===66||!(an.catch&&an.finally))return!0;if(!_r||_r<51||!/native code/.test(e)){var t=new de(function(a){a(1)}),n=function(a){a(function(){},function(){})},o=t.constructor={};if(o[Hu]=n,Hr=t.then(function(){})instanceof n,!Hr)return!0}return!r&&(Bu||Wu)&&!$o}),me={CONSTRUCTOR:Ku,REJECTION_EVENT:$o,SUBCLASSING:Hr},se={},sn=G,Gu=TypeError,Vu=function(e){var r,t;this.promise=new e(function(n,o){if(r!==void 0||t!==void 0)throw Gu("Bad Promise constructor");r=n,t=o}),this.resolve=sn(r),this.reject=sn(t)};se.f=function(e){return new Vu(e)};var qu=U,Fe=Ye,k=b,ye=_,zu=nc,Qu=dc,Yu=yc,Ju=G,Kr=g,Xu=j,Zu=Tc,el=uo,mo=vo.set,at=gu,rl=bu,tl=it,nl=po,yo=Cu,Gr=ae,st=me,So=se,Je="Promise",Eo=st.CONSTRUCTOR,ol=st.REJECTION_EVENT;st.SUBCLASSING;var wr=yo.getterFor(Je),il=yo.set,al=Gr&&Gr.prototype,te=Gr,Pr=al,To=k.TypeError,Vr=k.document,ct=k.process,qr=So.f,sl=qr,cl=!!(Vr&&Vr.createEvent&&k.dispatchEvent),Oo="unhandledrejection",ul="rejectionhandled",cn=0,_o=1,ll=2,ut=1,wo=2,Ie,un,fl,Po=function(e){var r;return Xu(e)&&Kr(r=e.then)?r:!1},Ao=function(e,r){var t=r.value,n=r.state==_o,o=n?e.ok:e.fail,a=e.resolve,s=e.reject,f=e.domain,u,c,i;try{o?(n||(r.rejection===wo&&dl(r),r.rejection=ut),o===!0?u=t:(f&&f.enter(),u=o(t),f&&(f.exit(),i=!0)),u===e.promise?s(To("Promise-chain cycle")):(c=Po(u))?ye(c,u,a,s):a(u)):s(t)}catch(l){f&&!i&&f.exit(),s(l)}},Io=function(e,r){e.notified||(e.notified=!0,at(function(){for(var t=e.reactions,n;n=t.get();)Ao(n,e);e.notified=!1,r&&!e.rejection&&vl(e)}))},Ro=function(e,r,t){var n,o;cl?(n=Vr.createEvent("Event"),n.promise=r,n.reason=t,n.initEvent(e,!1,!0),k.dispatchEvent(n)):n={promise:r,reason:t},!ol&&(o=k["on"+e])?o(n):e===Oo&&rl("Unhandled promise rejection",t)},vl=function(e){ye(mo,k,function(){var r=e.facade,t=e.value,n=ln(e),o;if(n&&(o=tl(function(){Fe?ct.emit("unhandledRejection",t,r):Ro(Oo,r,t)}),e.rejection=Fe||ln(e)?wo:ut,o.error))throw o.value})},ln=function(e){return e.rejection!==ut&&!e.parent},dl=function(e){ye(mo,k,function(){var r=e.facade;Fe?ct.emit("rejectionHandled",r):Ro(ul,r,e.value)})},ne=function(e,r,t){return function(n){e(r,n,t)}},oe=function(e,r,t){e.done||(e.done=!0,t&&(e=t),e.value=r,e.state=ll,Io(e,!0))},zr=function(e,r,t){if(!e.done){e.done=!0,t&&(e=t);try{if(e.facade===r)throw To("Promise can't be resolved itself");var n=Po(r);n?at(function(){var o={done:!1};try{ye(n,r,ne(zr,o,e),ne(oe,o,e))}catch(a){oe(o,a,e)}}):(e.value=r,e.state=_o,Io(e,!1))}catch(o){oe({done:!1},o,e)}}};Eo&&(te=function(r){Zu(this,Pr),Ju(r),ye(Ie,this);var t=wr(this);try{r(ne(zr,t),ne(oe,t))}catch(n){oe(t,n)}},Pr=te.prototype,Ie=function(r){il(this,{type:Je,done:!1,notified:!1,parent:!1,reactions:new nl,rejection:!1,state:cn,value:void 0})},Ie.prototype=zu(Pr,"then",function(r,t){var n=wr(this),o=qr(el(this,te));return n.parent=!0,o.ok=Kr(r)?r:!0,o.fail=Kr(t)&&t,o.domain=Fe?ct.domain:void 0,n.state==cn?n.reactions.add(o):at(function(){Ao(o,n)}),o.promise}),un=function(){var e=new Ie,r=wr(e);this.promise=e,this.resolve=ne(zr,r),this.reject=ne(oe,r)},So.f=qr=function(e){return e===te||e===fl?new un(e):sl(e)});qu({global:!0,constructor:!0,wrap:!0,forced:Eo},{Promise:te});Qu(te,Je,!1,!0);Yu(Je);var Co={},hl=w,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(r){var t=+r;return(t>0?yl:ml)(t)},El=Sl,Tl=function(e){var r=+e;return r!==r||r===0?0:El(r)},Ol=Tl,_l=Math.min,wl=function(e){return e>0?_l(Ol(e),9007199254740991):0},Pl=wl,Al=function(e){return Pl(e.length)},Il=Qe,fn=Ge,Rl=be,Cl=Co,Nl=w,Dl=Nl("iterator"),No=function(e){if(!Rl(e))return fn(e,Dl)||fn(e,"@@iterator")||Cl[Il(e)]},xl=_,Ll=G,Ml=q,kl=Ke,jl=No,Ul=TypeError,Fl=function(e,r){var t=arguments.length<2?jl(e):r;if(Ll(t))return Ml(xl(t,e));throw Ul(kl(e)+" is not iterable")},Bl=_,vn=q,Wl=Ge,Hl=function(e,r,t){var n,o;vn(e);try{if(n=Wl(e,"return"),!n){if(r==="throw")throw t;return t}n=Bl(n,e)}catch(a){o=!0,n=a}if(r==="throw")throw t;if(o)throw n;return vn(n),t},Kl=Ve,Gl=_,Vl=q,ql=Ke,zl=$l,Ql=Al,dn=We,Yl=Fl,Jl=No,hn=Hl,Xl=TypeError,De=function(e,r){this.stopped=e,this.result=r},pn=De.prototype,Do=function(e,r,t){var n=t&&t.that,o=!!(t&&t.AS_ENTRIES),a=!!(t&&t.IS_RECORD),s=!!(t&&t.IS_ITERATOR),f=!!(t&&t.INTERRUPTED),u=Kl(r,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=w,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 rf=function(e,r){if(!r&&!Lo)return!1;var t=!1;try{var n={};n[xo]=function(){return{next:function(){return{done:t=!0}}}},e(n)}catch(o){}return t},tf=ae,nf=rf,of=me.CONSTRUCTOR,Mo=of||!nf(function(e){tf.all(e).then(void 0,function(){})}),af=U,sf=_,cf=G,uf=se,lf=it,ff=Do,vf=Mo;af({target:"Promise",stat:!0,forced:vf},{all:function(r){var t=this,n=uf.f(t),o=n.resolve,a=n.reject,s=lf(function(){var f=cf(t.resolve),u=[],c=0,i=1;ff(r,function(l){var d=c++,v=!1;i++,sf(f,t,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=it,yf=Do,Sf=Mo;pf({target:"Promise",stat:!0,forced:Sf},{race:function(r){var t=this,n=$f.f(t),o=n.reject,a=mf(function(){var s=bf(t.resolve);yf(r,function(f){gf(s,t,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(r){var t=Of.f(this);return Tf(t.reject,void 0,r),t.promise}});var wf=q,Pf=j,Af=se,ko=function(e,r){if(wf(e),Pf(r)&&r.constructor===e)return r;var t=Af.f(e),n=t.resolve;return n(r),t.promise},If=U,Rf=K,Cf=ji,Nf=ae,Df=me.CONSTRUCTOR,xf=ko,Lf=Rf("Promise"),Mf=!Df;If({target:"Promise",stat:!0,forced:Cf},{resolve:function(r){return xf(Mf&&this===Lf?Nf:this,r)}});var kf=U,Qr=ae,jf=D,Uf=K,Ff=g,Bf=uo,$n=ko,Wf=Qr&&Qr.prototype,Hf=!!Qr&&jf(function(){Wf.finally.call({then:function(){}},function(){})});kf({target:"Promise",proto:!0,real:!0,forced:Hf},{finally:function(e){var r=Bf(this,Uf("Promise")),t=Ff(e);return this.then(t?function(n){return $n(r,e()).then(function(){return n})}:e,t?function(n){return $n(r,e()).then(function(){throw n})}:e)}});var Kf=no,Gf=Kf("Promise","finally"),Vf=Gf,qf=Vf,zf=qf,Qf=zf,Ar=Pn(Qf);function Yf(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=new Array(36);let t=0,n,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?r[o]="-":o===14?r[o]="4":(t<=2&&(t=33554432+Math.random()*16777216|0),n=t&15,t=t>>4,r[o]=e[o===19?n&3|8:n]);return r.join("")}const mn="1.0.40-beta.1",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_",Ir=`${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(r){this.consequentAuthErrors=0,this.authorized$=new Yr(!1),this.params=r;const t=M.get(Ir);t?t.startsWith('"')&&t.endsWith('"')?(this.uuid=ec(t,'"',""),M.set(Ir,this.uuid)):this.uuid=t:(this.uuid=Yf(),M.set(Ir,this.uuid))}authorize(r){return L(this,void 0,void 0,function*(){return this.authToken=r!=null?r:yield this.refreshAuthToken(),this._authorizeWithBackoff()})}logBeacon(r){const t="log.externalLog",n=this.createLogParams(r),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(t,n,o)||this.logRequest(r)}logRequest(r){var t;return L(this,void 0,void 0,function*(){const n="log.externalLog",o=this.createLogParams(r),a=(t=this.sessionKey)!==null&&t!==void 0?t:yield this._authorizeWithBackoff();if(!a)return;const 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:P.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:P.EXTERNAL_API,message:`${n} error`,data:c});return}}}});return s(r)})}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=Ar(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise})}createLogParams(r){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${mn}`,platform:this.params.mobile?"M_WEB":"WEB",items:r})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();const r=Wo(this.consequentAuthErrors,this.params.config.backoff);return new Promise(t=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{Ar(this._authorize().then(t).catch(n=>this.params.error$.next({id:"AuthorizeBackoff",category:P.NETWORK,message:"Otherwise unhandled error in authorization",thrown:n})),()=>this.backoffTimeoutId=0)},r))})}_authorize(){return L(this,void 0,void 0,function*(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);const r="auth.anonymLogin",t={session_data:{version:2,device_id:this.uuid,client_version:mn.split("-")[0],client_type:"SDK_JS"}};return this.authToken!==void 0&&(t.session_data.auth_token=this.authToken,t.session_data.version=3),this.authorizePromise=Ar(this.params.apiTransport.sendRequest(r,t).then(n=>{var o;return(!n||!n.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:P.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:P.EXTERNAL_API,message:"authorize error",data:n}):this.params.error$.next({id:"AuthorizeUnknown",category:P.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(r,t,n){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:t,options:n})}removeEventListener(r,t){if(!(r in this.listeners))return;const n=this.listeners[r];for(let o=0,a=n.length;o<a;o++)if(n[o].callback===t){n.splice(o,1);return}}dispatchEvent(r){if(!(r.type in this.listeners))return;const n=this.listeners[r.type].slice();for(let o=0,a=n.length;o<a;o++){const s=n[o];try{s.callback.call(this,r)}catch(f){Promise.resolve().then(()=>{throw f})}s.options&&s.options.once&&this.removeEventListener(r.type,s.callback)}return!r.defaultPrevented}}class jo 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(r){r.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,r)),super.dispatchEvent(r)}}class ev{constructor(){Object.defineProperty(this,"signal",{value:new jo,writable:!0,configurable:!0})}abort(r){let t;try{t=new Event("abort")}catch(o){typeof document!="undefined"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}let n=r;if(n===void 0)if(typeof document=="undefined")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch(o){n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(t)}toString(){return"[object AbortController]"}}typeof Symbol!="undefined"&&Symbol.toStringTag&&(ev.prototype[Symbol.toStringTag]="AbortController",jo.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 rv(e){typeof e=="function"&&(e={fetch:e});const{fetch:r,Request:t=r.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=e;if(!Uo({fetch:r,Request:t,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o}))return{fetch:r,Request:a};let a=t;(a&&!a.prototype.hasOwnProperty("signal")||o)&&(a=function(c,i){let l;i&&i.signal&&(l=i.signal,delete i.signal);const d=new t(c,i);return l&&Object.defineProperty(d,"signal",{writable:!1,enumerable:!1,configurable:!0,value:l}),d},a.prototype=t.prototype);const s=r;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 lt=Uo({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Fo=lt?rv({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,En=lt?Fo.fetch:window.fetch;lt?Fo.Request:window.Request;class tv{constructor(r){this.params=r,this.apiKey=r.apiKey,this.apiEnv=r.config.apiEnv,this.apiBaseUrl=yn[this.apiEnv],this.timeSynchronisation=r.timeSynchronisation,this.isApiBaseUrlFetched=!1}resolveApiBaseUrl(){var r;return L(this,void 0,void 0,function*(){if(this.apiEnv!==N.AUTO||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{const t=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=yield(yield En(t,{method:"GET",mode:"cors",cache:"no-cache"})).json(),a=(r=o==null?void 0:o.Answer[0])===null||r===void 0?void 0:r.data;if(!a)throw new Error("Wrong DNS response");return a}catch(t){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:P.NETWORK,message:"Unhandled resolve api base url error",thrown:t}),yn[N.VK_ALIAS]}finally{this.isApiBaseUrlFetched=!0}})}sendBeacon(r,t,n){if(!window.Blob||!window.navigator.sendBeacon)return!1;const o=this._prepareQueryParams({method:r,queryParams:t,sessionKey:n}),a=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,a)}catch(s){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:P.NETWORK,message:"Unhandled beacon error",thrown:s,data:{method:r,params:t}})}return!1}sendRequest(r,t,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:P.NETWORK,message:"Request failed",thrown:s});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:P.NETWORK,message:"Unhandled request error",thrown:s,data:{method:r,params:t,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:r,queryParams:t,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(r){const t=new URLSearchParams({format:"JSON",method:r.method,application_key:this.apiKey});return r.sessionKey!==void 0&&t.append("session_key",r.sessionKey),Object.entries(r.queryParams).forEach(([n,o])=>t.append(n,typeof o=="string"?o:JSON.stringify(o))),t}}const Re="onestat_events",Rr=e=>r=>r.timestamp+e>=S();class nv{constructor(r){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=r,this.api=r.api,this.error$=r.error$,this.userSalt=r.userSalt,this.firstFlush=dt(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});const t=M.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=dt(()=>this.safeFlush(),this.params.config.flushDebounceTime,{maxWait:t}),this.subscription=this.api.authorized$.subscribe(n=>{n&&this.debouncedFlush()}),this.housekeepStorage()}safeFlush(){var r;try{this.flush()}catch(t){this.error$.next({id:"LoggerError",category:P.WTF,message:(r=String(t))!==null&&r!==void 0?r:"Unknown logger error",thrown:t})}}readFromStorage(){const r=M.get(Re);try{return r?JSON.parse(r):{}}catch(t){}return{}}addToStorage(r){var t;if(!this.userSalt){this.unsaltedStorage.push(r);return}const n=this.readFromStorage(),a=((t=n[this.userSalt])!==null&&t!==void 0?t:[]).filter(Rr(this.params.config.storageExpiration));M.set(Re,JSON.stringify(Object.assign(Object.assign({},n),{[this.userSalt]:[...a,r]})))}getFromStorage(){var r;return this.userSalt?((r=this.readFromStorage()[this.userSalt])!==null&&r!==void 0?r:[]).filter(Rr(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}const r=this.readFromStorage();delete r[this.userSalt],M.set(Re,JSON.stringify(r))}housekeepStorage(){const r=this.readFromStorage();for(const[t,n]of Object.entries(r)){const o=n.filter(Rr(this.params.config.storageExpiration));o.length?r[t]=o:delete r[t]}M.set(Re,JSON.stringify(r))}log(r){this.addToStorage(r),!this.isPaused&&(this.isUrgent(r)?this.flush():this.lastVsid!==r.custom.vsid?this.firstFlush():this.debouncedFlush(),this.lastVsid=r.custom.vsid)}flush(r=!1){const t=this.getFromStorage();t.length!==0&&(this.api.authorized$.getValue()?(r&&this.params.config.useBeacon?this.api.logBeacon(t):this.api.logRequest(t),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,r;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&&(r=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!r&&document.referrer&&(r=document.referrer)}catch(n){console.error(n)}const t=r?new URL(r).hostname:void 0;return{isEmbed:e,host:t}},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)}},Cr=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(r){this.offset=void 0,this.offset=r}getOffset(){var r;return(r=this.offset)!==null&&r!==void 0?r:0}setOffset(r){this.offset=r}now(){var r;return Date.now()+((r=this.offset)!==null&&r!==void 0?r:0)}date(r=new Date){var t;return r.setTime(r.getTime()+((t=this.offset)!==null&&t!==void 0?t:0)),r}addServerTime(r,t){const n=Date.now(),o=r-n-t/2;if(Math.abs(o)<1e3){this.offset=0;return}this.offset===void 0?this.offset=Math.round(o):this.offset=Math.round(.2*o+(1-.2)*this.offset)}}const On=()=>Math.floor(Math.random()*Math.pow(2,32)).toString(36).padStart(8,"0"),uv=e=>new Ho(r=>{const t=new xe,n=Ce(Dr(window,"beforeunload"),e.events.willDestruct$),o=new Yr(void 0);let a;t.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),t.add(a)}));const{playing$:s,paused$:f}=e.events,u=e.events.willSeek$.pipe(ft(()=>e.info.playbackState$.getValue()===ht.PLAYING)),c=e.events.seeked$.pipe(ft(()=>e.info.playbackState$.getValue()===ht.PLAYING));let i=!1;const l=new wn;t.add(u.subscribe(()=>{i||l.next(),i=!0})),t.add(c.subscribe(()=>i=!1));const d=Ce(s,c),v=Ce(f,l,n,e.events.looped$);let h;return t.add(d.subscribe(()=>h=o.getValue())),t.add(v.subscribe(()=>{const p=o.getValue();xr(h)||h===p||xr(p)||(r.next({from:h,to:p}),h=void 0)})),t}),Nr=()=>{const e=new xe;return{subscription:e,subscribe:(r,t)=>{r&&e.add(r.subscribe(t))}}};class dv{constructor(r,t){var n,o;this.subscription=new xe,this.vsid=On(),this.seekAction$=new Yr(Me.UNKNOWN),this.statContext=r,this.config=Qo((n=t.config)!==null&&n!==void 0?n:{}),Q(t.apiEnv)&&(this.config.apiEnv=t.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new cv);const a=new wn;this.experimental={error$:a};const s=new tv({apiKey:Jf,config:this.config,error$:a,timeSynchronisation:this.timeSynchronisation});this.api=new Zf({config:this.config,apiTransport:s,refreshAuthToken:t.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:t.userSalt});const{isEmbed:f,host:u}=ov();this.isEmbed=f,this.embedParent=u,this.subscribe()}updateContext(r){this.statContext=Object.assign(Object.assign({},this.statContext),r)}attachTo(r){const t=new xe,n=(i,l)=>t.add(i.subscribe(l));n(r.events.willStart$,()=>{this.logActionPlay({position:r.info.position$.getValue()})}),n(r.events.looped$,()=>{this.resetViewSession(),this.logActionPlay({position:r.info.position$.getValue()})}),n(r.events.seeked$,()=>{this.logSeek({action:this.seekAction$.getValue(),time:r.info.position$.getValue()}),this.seekAction$.next(Me.UNKNOWN)}),n(r.events.paused$,()=>{this.logPause({position:r.info.position$.getValue()})}),n(r.events.willResume$,()=>{this.logPlay()}),n(r.events.started$,()=>{this.statContext.clip&&this.logWatchCoverageRecord({start:0,end:0})}),n(uv(r),i=>{const l=r.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(r.info.isStalled$,i=>{i?o=S():(Q(o)&&this.logEmptyBuffer({duration:S()-o}),o=void 0)});let a=!1;t.add(r.events.fatalError$.pipe(Vo()).subscribe(()=>a=!0)),n(r.events.willStop$,()=>{if(r.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(r.events.managedError$,({id:i})=>{this.logError({fatal:!1,errorType:i})}),n(r.events.fatalError$,({id:i})=>{this.logError({fatal:!0,errorType:i})});let s,f,u=!1;n(r.events.firstBytes$,i=>{s=S(),this.logFirstBytes({time:i})}),n(r.events.willStart$,()=>f=S()),n(r.info.currentBuffer$,i=>{!u&&i&&i.end-i.start>0&&Q(s)&&(this.logPlayerReady({duration:S()-s}),u=!0)}),n(r.events.firstFrame$,()=>{Q(s)&&!u&&(this.logPlayerReady({duration:S()-s}),u=!0),Q(f)&&this.logFirstFrame({time:S()-f})}),n(r.info.atLiveEdge$,i=>this.updateContext({liveEdge:i})),n(vt({muted:r.info.muted$,volume:r.info.volume$}),({muted:i,volume:l})=>this.updateContext({audible:!i&&l>0})),n(r.info.currentQuality$,i=>this.updateContext({quality:iv(i)})),n(r.info.isAutoQualityEnabled$,i=>this.updateContext({autoQuality:i})),n(r.info.currentFormat$,i=>this.updateContext({contentType:av(i)}));let c;return n(r.info.hostname$,i=>{this.updateContext({cdnHostname:i,failover:c!==void 0&&c!==i}),c=i}),n(r.info.throughputEstimation$,i=>this.updateContext({downloadSpeed:i})),n(r.info.httpConnectionType$,i=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:Tn(i)}),this.updateContext({connectionType:Tn(i)})}),n(r.info.httpConnectionReused$,i=>{xr(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:i}),this.updateContext({connectionReused:i})}),n(r.info.surface$,i=>this.updateContext({mode:Cr(i)})),n(vt({current:r.info.currentTextTrack$,available:r.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=r,this.uiEvents&&this.attachToUi(this.uiEvents),this.resubscribeBeforeunload(),this.subscription.add(t),t}attachToUi(r){this.uiEvents=r;const{subscription:t,subscribe:n}=Nr();return this.player&&(n(r.actionRewind$,()=>{this.player&&(this.resetViewSession(),this.logActionPlay({position:this.player.info.position$.getValue()}))}),n(r.actionSeek$,this.seekAction$),n(r.inPiP$,o=>{var a;const s=o?W.PIP:Cr((a=this.player)===null||a===void 0?void 0:a.info.surface$.getValue());this.updateContext({mode:s})}),n(r.inFullscreen$,o=>{var a;const s=o?W.FULLSCREEN:Cr((a=this.player)===null||a===void 0?void 0:a.info.surface$.getValue());this.updateContext({mode:s})}),n(r.actionSetSubtitle$,o=>this.updateContext({subtitles:o})),n(r.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(t)),t}attachToAds(r){const{subscription:t,subscribe:n}=Nr();return n(r.slotRequested$,()=>this.logAdSlotRequest()),n(r.started$,o=>this.logAdStarted(o)),n(r.paused$,()=>this.logAdPaused()),n(r.resumed$,()=>this.logAdResumed()),n(r.ended$,()=>this.logAdEnded()),n(r.skipped$,()=>this.logAdSkipped()),n(r.clicked$,()=>this.logAdClicked()),this.resubscribeBeforeunload(),this.subscription.add(t),t}attachToInteractive(r){const{subscription:t,subscribe:n}=Nr();return n(r.click$,o=>this.logInterfaceClick(o)),n(r.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(t),t}authorize(r){return this.api.authorize(r)}pause(){this.logger.pause()}resume(){this.logger.resume()}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.vsid=On()}setFieldBlacklist(){}logInited(){}logReady(r){this.log({operation:"player_ready",param:String(r.time)})}logStarted(...r){this.logActionPlay(...r)}logPlay(){this.log({operation:"play_toggle"})}logPause(r){this.log({operation:"pause",param:String(Math.round(r.position))})}logSeek(r){this.log({operation:"seek",param:r.action,time:r.time})}logFirstBytes(r){this.log({operation:"first_bytes",param:String(r.time)})}logFirstFrame(r){this.log({operation:"first_frame",param:String(r.time)})}logError(r){this.log({operation:"content_error",param:`${r.fatal?"fatal":"recoverable"}_${r.errorType}`})}logWatchCoverageRecord(r){this.log({operation:"watch_coverage_record",param:`${r.start}-${r.end}`})}logWatchCoverageLive(r){var t,n;const o=(n=(t=this.timeSynchronisation)===null||t===void 0?void 0:t.getOffset())!==null&&n!==void 0?n:0,a=r.start+o,s=r.end+o;this.log({operation:"watch_coverage_live",param:`${a}-${s}`})}logEmptyBuffer(r){this.log({operation:"empty_buffer",param:String(r.duration)})}logDownloadSpeed(){}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(r){this.log({operation:"adv",param:r})}logAdPaused(){this.log({operation:"adv",param:"pause"})}logAdResumed(){this.log({operation:"adv",param:"resume"})}logAdEnded(){this.log({operation:"adv",param:"ended"})}logAdSkipped(){this.log({operation:"adv",param:"skip"})}logAdClicked(){this.log({operation:"adv",param:"click"})}logInterfaceClick(r){this.log({operation:"player_interface_click",param:r})}logNextMovie(r){this.log({operation:"next_movie",param:String(r)})}subscribe(){this.resubscribeBeforeunload();const r=window.navigator.connection;r&&"onchange"in r&&"effectiveType"in r&&this.subscription.add(Ce(Dr(r,"change"),qo(["init"])).subscribe(()=>this.updateContext({network:sv(r.effectiveType)})))}resubscribeBeforeunload(){var r;(r=this.beforeunloadSubscription)===null||r===void 0||r.unsubscribe(),this.beforeunloadSubscription=Dr(window,"beforeunload").subscribe(()=>this.logger.flush(!0)),this.subscription.add(this.beforeunloadSubscription)}logPlayerReady(r){this.log({operation:"player_ready",param:String(Math.round(r.duration))})}logActionPlay(r){this.log({operation:"action_play",param:String(Math.round(r.position))})}logCloseAtEmptyBuffer(r){this.log({operation:"close_at_empty_buffer",param:String(Math.round(r.duration))})}logActionStop(){this.log({operation:"action_stop"})}log(r){if(this.config.disabledOperations.includes(r.operation))return;const t=this.createLogItem(r);this.logger.log(t)}createLogItem({operation:r,param:t,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=r==="empty_buffer"||r==="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:t,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:r,type:1,time:n,network:this.statContext.network,timestamp:s,custom:c}}}export{N as ApiEnv,fe as ConnectionType,y as ContentType,pt as InteractiveInterfaceClick,dv as OneStat,O as Quality,Me as SeekAction,mn as VERSION};