@vkontakte/videoplayer-statistics 1.0.45-dev.bcc74a3.0 → 1.0.46-beta.0

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