@vkontakte/videoplayer-statistics 1.0.43 → 1.0.44-beta.0

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