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

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