@vkontakte/videoplayer-statistics 1.0.49-dev.dac80653.0 → 1.0.49

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