@vkontakte/videoplayer-core 2.0.134-dev.464b6f35.0 → 2.0.134-dev.6250ee46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es2015.cjs.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
- * @vkontakte/videoplayer-core v2.0.134-dev.464b6f35.0
3
- * Mon, 09 Jun 2025 10:17:36 GMT
2
+ * @vkontakte/videoplayer-core v2.0.134-dev.6250ee46.0
3
+ * Tue, 10 Jun 2025 05:36:00 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/2-0-134/doc/
5
5
  */
6
6
  "use strict";var FT=Object.create;var ra=Object.defineProperty,NT=Object.defineProperties,UT=Object.getOwnPropertyDescriptor,qT=Object.getOwnPropertyDescriptors,HT=Object.getOwnPropertyNames,po=Object.getOwnPropertySymbols,jT=Object.getPrototypeOf,rl=Object.prototype.hasOwnProperty,up=Object.prototype.propertyIsEnumerable;var GT=(s,e)=>(e=Symbol[s])?e:Symbol.for("Symbol."+s);var St=Math.pow,op=(s,e,t)=>e in s?ra(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,k=(s,e)=>{for(var t in e||(e={}))rl.call(e,t)&&op(s,t,e[t]);if(po)for(var t of po(e))up.call(e,t)&&op(s,t,e[t]);return s},N=(s,e)=>NT(s,qT(e));var lp=(s,e)=>{var t={};for(var i in s)rl.call(s,i)&&e.indexOf(i)<0&&(t[i]=s[i]);if(s!=null&&po)for(var i of po(s))e.indexOf(i)<0&&up.call(s,i)&&(t[i]=s[i]);return t};var g=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),zT=(s,e)=>{for(var t in e)ra(s,t,{get:e[t],enumerable:!0})},cp=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of HT(e))!rl.call(s,r)&&r!==t&&ra(s,r,{get:()=>e[r],enumerable:!(i=UT(e,r))||i.enumerable});return s};var K=(s,e,t)=>(t=s!=null?FT(jT(s)):{},cp(e||!s||!s.__esModule?ra(t,"default",{value:s,enumerable:!0}):t,s)),QT=s=>cp(ra({},"__esModule",{value:!0}),s);var A=(s,e,t)=>new Promise((i,r)=>{var a=u=>{try{o(t.next(u))}catch(l){r(l)}},n=u=>{try{o(t.throw(u))}catch(l){r(l)}},o=u=>u.done?i(u.value):Promise.resolve(u.value).then(a,n);o((t=t.apply(s,e)).next())}),hr=function(s,e){this[0]=s,this[1]=e},pe=(s,e,t)=>{var i=(n,o,u,l)=>{try{var d=t[n](o),c=(o=d.value)instanceof hr,h=d.done;Promise.resolve(c?o[0]:o).then(p=>c?i(n==="return"?n:"next",o[1]?{done:p.done,value:p.value}:p,u,l):u({value:p,done:h})).catch(p=>i("throw",p,u,l))}catch(p){l(p)}},r=n=>a[n]=o=>new Promise((u,l)=>i(n,o,u,l)),a={};return t=t.apply(s,e),a[GT("asyncIterator")]=()=>a,r("next"),r("throw"),r("return"),a};var Fe=g((al,dp)=>{"use strict";var na=function(s){return s&&s.Math===Math&&s};dp.exports=na(typeof globalThis=="object"&&globalThis)||na(typeof window=="object"&&window)||na(typeof self=="object"&&self)||na(typeof global=="object"&&global)||na(typeof al=="object"&&al)||function(){return this}()||Function("return this")()});var st=g((W$,pp)=>{"use strict";pp.exports=function(s){try{return!!s()}catch(e){return!0}}});var oa=g((Y$,hp)=>{"use strict";var WT=st();hp.exports=!WT(function(){var s=function(){}.bind();return typeof s!="function"||s.hasOwnProperty("prototype")})});var nl=g((K$,gp)=>{"use strict";var YT=oa(),bp=Function.prototype,fp=bp.apply,mp=bp.call;gp.exports=typeof Reflect=="object"&&Reflect.apply||(YT?mp.bind(fp):function(){return mp.apply(fp,arguments)})});var Ze=g((X$,yp)=>{"use strict";var Sp=oa(),vp=Function.prototype,ol=vp.call,KT=Sp&&vp.bind.bind(ol,ol);yp.exports=Sp?KT:function(s){return function(){return ol.apply(s,arguments)}}});var fr=g((J$,Ip)=>{"use strict";var Tp=Ze(),XT=Tp({}.toString),JT=Tp("".slice);Ip.exports=function(s){return JT(XT(s),8,-1)}});var ul=g((Z$,xp)=>{"use strict";var ZT=fr(),eI=Ze();xp.exports=function(s){if(ZT(s)==="Function")return eI(s)}});var Oe=g((eB,Ep)=>{"use strict";var ll=typeof document=="object"&&document.all;Ep.exports=typeof ll=="undefined"&&ll!==void 0?function(s){return typeof s=="function"||s===ll}:function(s){return typeof s=="function"}});var Ct=g((tB,wp)=>{"use strict";var tI=st();wp.exports=!tI(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var Vt=g((iB,Pp)=>{"use strict";var iI=oa(),mo=Function.prototype.call;Pp.exports=iI?mo.bind(mo):function(){return mo.apply(mo,arguments)}});var cl=g(Rp=>{"use strict";var Ap={}.propertyIsEnumerable,kp=Object.getOwnPropertyDescriptor,rI=kp&&!Ap.call({1:2},1);Rp.f=rI?function(e){var t=kp(this,e);return!!t&&t.enumerable}:Ap});var ua=g((sB,Lp)=>{"use strict";Lp.exports=function(s,e){return{enumerable:!(s&1),configurable:!(s&2),writable:!(s&4),value:e}}});var $p=g((aB,Mp)=>{"use strict";var sI=Ze(),aI=st(),nI=fr(),dl=Object,oI=sI("".split);Mp.exports=aI(function(){return!dl("z").propertyIsEnumerable(0)})?function(s){return nI(s)==="String"?oI(s,""):dl(s)}:dl});var Cr=g((nB,Bp)=>{"use strict";Bp.exports=function(s){return s==null}});var Yi=g((oB,Dp)=>{"use strict";var uI=Cr(),lI=TypeError;Dp.exports=function(s){if(uI(s))throw new lI("Can't call method on "+s);return s}});var mr=g((uB,Cp)=>{"use strict";var cI=$p(),dI=Yi();Cp.exports=function(s){return cI(dI(s))}});var Ot=g((lB,Vp)=>{"use strict";var pI=Oe();Vp.exports=function(s){return typeof s=="object"?s!==null:pI(s)}});var Vr=g((cB,Op)=>{"use strict";Op.exports={}});var Bi=g((dB,Fp)=>{"use strict";var pl=Vr(),hl=Fe(),hI=Oe(),_p=function(s){return hI(s)?s:void 0};Fp.exports=function(s,e){return arguments.length<2?_p(pl[s])||_p(hl[s]):pl[s]&&pl[s][e]||hl[s]&&hl[s][e]}});var la=g((pB,Np)=>{"use strict";var fI=Ze();Np.exports=fI({}.isPrototypeOf)});var br=g((hB,Hp)=>{"use strict";var mI=Fe(),Up=mI.navigator,qp=Up&&Up.userAgent;Hp.exports=qp?String(qp):""});var ml=g((fB,Yp)=>{"use strict";var Wp=Fe(),fl=br(),jp=Wp.process,Gp=Wp.Deno,zp=jp&&jp.versions||Gp&&Gp.version,Qp=zp&&zp.v8,ei,bo;Qp&&(ei=Qp.split("."),bo=ei[0]>0&&ei[0]<4?1:+(ei[0]+ei[1]));!bo&&fl&&(ei=fl.match(/Edge\/(\d+)/),(!ei||ei[1]>=74)&&(ei=fl.match(/Chrome\/(\d+)/),ei&&(bo=+ei[1])));Yp.exports=bo});var bl=g((mB,Xp)=>{"use strict";var Kp=ml(),bI=st(),gI=Fe(),SI=gI.String;Xp.exports=!!Object.getOwnPropertySymbols&&!bI(function(){var s=Symbol("symbol detection");return!SI(s)||!(Object(s)instanceof Symbol)||!Symbol.sham&&Kp&&Kp<41})});var gl=g((bB,Jp)=>{"use strict";var vI=bl();Jp.exports=vI&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Sl=g((gB,Zp)=>{"use strict";var yI=Bi(),TI=Oe(),II=la(),xI=gl(),EI=Object;Zp.exports=xI?function(s){return typeof s=="symbol"}:function(s){var e=yI("Symbol");return TI(e)&&II(e.prototype,EI(s))}});var ca=g((SB,eh)=>{"use strict";var wI=String;eh.exports=function(s){try{return wI(s)}catch(e){return"Object"}}});var ci=g((vB,th)=>{"use strict";var PI=Oe(),AI=ca(),kI=TypeError;th.exports=function(s){if(PI(s))return s;throw new kI(AI(s)+" is not a function")}});var da=g((yB,ih)=>{"use strict";var RI=ci(),LI=Cr();ih.exports=function(s,e){var t=s[e];return LI(t)?void 0:RI(t)}});var sh=g((TB,rh)=>{"use strict";var vl=Vt(),yl=Oe(),Tl=Ot(),MI=TypeError;rh.exports=function(s,e){var t,i;if(e==="string"&&yl(t=s.toString)&&!Tl(i=vl(t,s))||yl(t=s.valueOf)&&!Tl(i=vl(t,s))||e!=="string"&&yl(t=s.toString)&&!Tl(i=vl(t,s)))return i;throw new MI("Can't convert object to primitive value")}});var ti=g((IB,ah)=>{"use strict";ah.exports=!0});var uh=g((xB,oh)=>{"use strict";var nh=Fe(),$I=Object.defineProperty;oh.exports=function(s,e){try{$I(nh,s,{value:e,configurable:!0,writable:!0})}catch(t){nh[s]=e}return e}});var pa=g((EB,dh)=>{"use strict";var BI=ti(),DI=Fe(),CI=uh(),lh="__core-js_shared__",ch=dh.exports=DI[lh]||CI(lh,{});(ch.versions||(ch.versions=[])).push({version:"3.38.0",mode:BI?"pure":"global",copyright:"\xA9 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.38.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var Il=g((wB,hh)=>{"use strict";var ph=pa();hh.exports=function(s,e){return ph[s]||(ph[s]=e||{})}});var Or=g((PB,fh)=>{"use strict";var VI=Yi(),OI=Object;fh.exports=function(s){return OI(VI(s))}});var ii=g((AB,mh)=>{"use strict";var _I=Ze(),FI=Or(),NI=_I({}.hasOwnProperty);mh.exports=Object.hasOwn||function(e,t){return NI(FI(e),t)}});var xl=g((kB,bh)=>{"use strict";var UI=Ze(),qI=0,HI=Math.random(),jI=UI(1 .toString);bh.exports=function(s){return"Symbol("+(s===void 0?"":s)+")_"+jI(++qI+HI,36)}});var at=g((RB,Sh)=>{"use strict";var GI=Fe(),zI=Il(),gh=ii(),QI=xl(),WI=bl(),YI=gl(),_r=GI.Symbol,El=zI("wks"),KI=YI?_r.for||_r:_r&&_r.withoutSetter||QI;Sh.exports=function(s){return gh(El,s)||(El[s]=WI&&gh(_r,s)?_r[s]:KI("Symbol."+s)),El[s]}});var Ih=g((LB,Th)=>{"use strict";var XI=Vt(),vh=Ot(),yh=Sl(),JI=da(),ZI=sh(),ex=at(),tx=TypeError,ix=ex("toPrimitive");Th.exports=function(s,e){if(!vh(s)||yh(s))return s;var t=JI(s,ix),i;if(t){if(e===void 0&&(e="default"),i=XI(t,s,e),!vh(i)||yh(i))return i;throw new tx("Can't convert object to primitive value")}return e===void 0&&(e="number"),ZI(s,e)}});var wl=g((MB,xh)=>{"use strict";var rx=Ih(),sx=Sl();xh.exports=function(s){var e=rx(s,"string");return sx(e)?e:e+""}});var go=g(($B,wh)=>{"use strict";var ax=Fe(),Eh=Ot(),Pl=ax.document,nx=Eh(Pl)&&Eh(Pl.createElement);wh.exports=function(s){return nx?Pl.createElement(s):{}}});var Al=g((BB,Ph)=>{"use strict";var ox=Ct(),ux=st(),lx=go();Ph.exports=!ox&&!ux(function(){return Object.defineProperty(lx("div"),"a",{get:function(){return 7}}).a!==7})});var Rh=g(kh=>{"use strict";var cx=Ct(),dx=Vt(),px=cl(),hx=ua(),fx=mr(),mx=wl(),bx=ii(),gx=Al(),Ah=Object.getOwnPropertyDescriptor;kh.f=cx?Ah:function(e,t){if(e=fx(e),t=mx(t),gx)try{return Ah(e,t)}catch(i){}if(bx(e,t))return hx(!dx(px.f,e,t),e[t])}});var kl=g((CB,Lh)=>{"use strict";var Sx=st(),vx=Oe(),yx=/#|\.prototype\./,ha=function(s,e){var t=Ix[Tx(s)];return t===Ex?!0:t===xx?!1:vx(e)?Sx(e):!!e},Tx=ha.normalize=function(s){return String(s).replace(yx,".").toLowerCase()},Ix=ha.data={},xx=ha.NATIVE="N",Ex=ha.POLYFILL="P";Lh.exports=ha});var Fr=g((VB,$h)=>{"use strict";var Mh=ul(),wx=ci(),Px=oa(),Ax=Mh(Mh.bind);$h.exports=function(s,e){return wx(s),e===void 0?s:Px?Ax(s,e):function(){return s.apply(e,arguments)}}});var Rl=g((OB,Bh)=>{"use strict";var kx=Ct(),Rx=st();Bh.exports=kx&&Rx(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var di=g((_B,Dh)=>{"use strict";var Lx=Ot(),Mx=String,$x=TypeError;Dh.exports=function(s){if(Lx(s))return s;throw new $x(Mx(s)+" is not an object")}});var gr=g(Vh=>{"use strict";var Bx=Ct(),Dx=Al(),Cx=Rl(),So=di(),Ch=wl(),Vx=TypeError,Ll=Object.defineProperty,Ox=Object.getOwnPropertyDescriptor,Ml="enumerable",$l="configurable",Bl="writable";Vh.f=Bx?Cx?function(e,t,i){if(So(e),t=Ch(t),So(i),typeof e=="function"&&t==="prototype"&&"value"in i&&Bl in i&&!i[Bl]){var r=Ox(e,t);r&&r[Bl]&&(e[t]=i.value,i={configurable:$l in i?i[$l]:r[$l],enumerable:Ml in i?i[Ml]:r[Ml],writable:!1})}return Ll(e,t,i)}:Ll:function(e,t,i){if(So(e),t=Ch(t),So(i),Dx)try{return Ll(e,t,i)}catch(r){}if("get"in i||"set"in i)throw new Vx("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var Nr=g((NB,Oh)=>{"use strict";var _x=Ct(),Fx=gr(),Nx=ua();Oh.exports=_x?function(s,e,t){return Fx.f(s,e,Nx(1,t))}:function(s,e,t){return s[e]=t,s}});var je=g((UB,Fh)=>{"use strict";var fa=Fe(),Ux=nl(),qx=ul(),Hx=Oe(),jx=Rh().f,Gx=kl(),Ur=Vr(),zx=Fr(),qr=Nr(),_h=ii();pa();var Qx=function(s){var e=function(t,i,r){if(this instanceof e){switch(arguments.length){case 0:return new s;case 1:return new s(t);case 2:return new s(t,i)}return new s(t,i,r)}return Ux(s,this,arguments)};return e.prototype=s.prototype,e};Fh.exports=function(s,e){var t=s.target,i=s.global,r=s.stat,a=s.proto,n=i?fa:r?fa[t]:fa[t]&&fa[t].prototype,o=i?Ur:Ur[t]||qr(Ur,t,{})[t],u=o.prototype,l,d,c,h,p,f,b,S,v;for(h in e)l=Gx(i?h:t+(r?".":"#")+h,s.forced),d=!l&&n&&_h(n,h),f=o[h],d&&(s.dontCallGetSet?(v=jx(n,h),b=v&&v.value):b=n[h]),p=d&&b?b:e[h],!(!l&&!a&&typeof f==typeof p)&&(s.bind&&d?S=zx(p,fa):s.wrap&&d?S=Qx(p):a&&Hx(p)?S=qx(p):S=p,(s.sham||p&&p.sham||f&&f.sham)&&qr(S,"sham",!0),qr(o,h,S),a&&(c=t+"Prototype",_h(Ur,c)||qr(Ur,c,{}),qr(Ur[c],h,p),s.real&&u&&(l||!u[h])&&qr(u,h,p)))}});var Uh=g((qB,Nh)=>{"use strict";var Wx=Math.ceil,Yx=Math.floor;Nh.exports=Math.trunc||function(e){var t=+e;return(t>0?Yx:Wx)(t)}});var ma=g((HB,qh)=>{"use strict";var Kx=Uh();qh.exports=function(s){var e=+s;return e!==e||e===0?0:Kx(e)}});var jh=g((jB,Hh)=>{"use strict";var Xx=ma(),Jx=Math.max,Zx=Math.min;Hh.exports=function(s,e){var t=Xx(s);return t<0?Jx(t+e,0):Zx(t,e)}});var Dl=g((GB,Gh)=>{"use strict";var eE=ma(),tE=Math.min;Gh.exports=function(s){var e=eE(s);return e>0?tE(e,9007199254740991):0}});var Hr=g((zB,zh)=>{"use strict";var iE=Dl();zh.exports=function(s){return iE(s.length)}});var Cl=g((QB,Wh)=>{"use strict";var rE=mr(),sE=jh(),aE=Hr(),Qh=function(s){return function(e,t,i){var r=rE(e),a=aE(r);if(a===0)return!s&&-1;var n=sE(i,a),o;if(s&&t!==t){for(;a>n;)if(o=r[n++],o!==o)return!0}else for(;a>n;n++)if((s||n in r)&&r[n]===t)return s||n||0;return!s&&-1}};Wh.exports={includes:Qh(!0),indexOf:Qh(!1)}});var ba=g((WB,Yh)=>{"use strict";Yh.exports=function(){}});var Kh=g(()=>{"use strict";var nE=je(),oE=Cl().includes,uE=st(),lE=ba(),cE=uE(function(){return!Array(1).includes()});nE({target:"Array",proto:!0,forced:cE},{includes:function(e){return oE(this,e,arguments.length>1?arguments[1]:void 0)}});lE("includes")});var Ki=g((XB,Xh)=>{"use strict";var dE=Bi();Xh.exports=dE});var Zh=g((JB,Jh)=>{"use strict";Kh();var pE=Ki();Jh.exports=pE("Array","includes")});var tf=g((ZB,ef)=>{"use strict";var hE=Zh();ef.exports=hE});var _t=g((eD,rf)=>{"use strict";var fE=tf();rf.exports=fE});var yo=g((dD,nf)=>{"use strict";var bE=Il(),gE=xl(),af=bE("keys");nf.exports=function(s){return af[s]||(af[s]=gE(s))}});var uf=g((pD,of)=>{"use strict";var SE=st();of.exports=!SE(function(){function s(){}return s.prototype.constructor=null,Object.getPrototypeOf(new s)!==s.prototype})});var To=g((hD,cf)=>{"use strict";var vE=ii(),yE=Oe(),TE=Or(),IE=yo(),xE=uf(),lf=IE("IE_PROTO"),Vl=Object,EE=Vl.prototype;cf.exports=xE?Vl.getPrototypeOf:function(s){var e=TE(s);if(vE(e,lf))return e[lf];var t=e.constructor;return yE(t)&&e instanceof t?t.prototype:e instanceof Vl?EE:null}});var Io=g((fD,df)=>{"use strict";df.exports={}});var ff=g((mD,hf)=>{"use strict";var wE=Ze(),Ol=ii(),PE=mr(),AE=Cl().indexOf,kE=Io(),pf=wE([].push);hf.exports=function(s,e){var t=PE(s),i=0,r=[],a;for(a in t)!Ol(kE,a)&&Ol(t,a)&&pf(r,a);for(;e.length>i;)Ol(t,a=e[i++])&&(~AE(r,a)||pf(r,a));return r}});var _l=g((bD,mf)=>{"use strict";mf.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Fl=g((gD,bf)=>{"use strict";var RE=ff(),LE=_l();bf.exports=Object.keys||function(e){return RE(e,LE)}});var Nl=g((SD,Tf)=>{"use strict";var Sf=Ct(),ME=st(),vf=Ze(),$E=To(),BE=Fl(),DE=mr(),CE=cl().f,yf=vf(CE),VE=vf([].push),OE=Sf&&ME(function(){var s=Object.create(null);return s[2]=2,!yf(s,2)}),gf=function(s){return function(e){for(var t=DE(e),i=BE(t),r=OE&&$E(t)===null,a=i.length,n=0,o=[],u;a>n;)u=i[n++],(!Sf||(r?u in t:yf(t,u)))&&VE(o,s?[u,t[u]]:t[u]);return o}};Tf.exports={entries:gf(!0),values:gf(!1)}});var If=g(()=>{"use strict";var _E=je(),FE=Nl().entries;_E({target:"Object",stat:!0},{entries:function(e){return FE(e)}})});var Ef=g((TD,xf)=>{"use strict";If();var NE=Vr();xf.exports=NE.Object.entries});var Pf=g((ID,wf)=>{"use strict";var UE=Ef();wf.exports=UE});var Sr=g((xD,Af)=>{"use strict";var qE=Pf();Af.exports=qE});var vr=g((ED,kf)=>{"use strict";kf.exports={}});var Mf=g((wD,Lf)=>{"use strict";var HE=Fe(),jE=Oe(),Rf=HE.WeakMap;Lf.exports=jE(Rf)&&/native code/.test(String(Rf))});var jl=g((PD,Df)=>{"use strict";var GE=Mf(),Bf=Fe(),zE=Ot(),QE=Nr(),Ul=ii(),ql=pa(),WE=yo(),YE=Io(),$f="Object already initialized",Hl=Bf.TypeError,KE=Bf.WeakMap,xo,ga,Eo,XE=function(s){return Eo(s)?ga(s):xo(s,{})},JE=function(s){return function(e){var t;if(!zE(e)||(t=ga(e)).type!==s)throw new Hl("Incompatible receiver, "+s+" required");return t}};GE||ql.state?(ri=ql.state||(ql.state=new KE),ri.get=ri.get,ri.has=ri.has,ri.set=ri.set,xo=function(s,e){if(ri.has(s))throw new Hl($f);return e.facade=s,ri.set(s,e),e},ga=function(s){return ri.get(s)||{}},Eo=function(s){return ri.has(s)}):(yr=WE("state"),YE[yr]=!0,xo=function(s,e){if(Ul(s,yr))throw new Hl($f);return e.facade=s,QE(s,yr,e),e},ga=function(s){return Ul(s,yr)?s[yr]:{}},Eo=function(s){return Ul(s,yr)});var ri,yr;Df.exports={set:xo,get:ga,has:Eo,enforce:XE,getterFor:JE}});var Ql=g((AD,Vf)=>{"use strict";var Gl=Ct(),ZE=ii(),Cf=Function.prototype,ew=Gl&&Object.getOwnPropertyDescriptor,zl=ZE(Cf,"name"),tw=zl&&function(){}.name==="something",iw=zl&&(!Gl||Gl&&ew(Cf,"name").configurable);Vf.exports={EXISTS:zl,PROPER:tw,CONFIGURABLE:iw}});var _f=g(Of=>{"use strict";var rw=Ct(),sw=Rl(),aw=gr(),nw=di(),ow=mr(),uw=Fl();Of.f=rw&&!sw?Object.defineProperties:function(e,t){nw(e);for(var i=ow(t),r=uw(t),a=r.length,n=0,o;a>n;)aw.f(e,o=r[n++],i[o]);return e}});var Wl=g((RD,Ff)=>{"use strict";var lw=Bi();Ff.exports=lw("document","documentElement")});var Jl=g((LD,zf)=>{"use strict";var cw=di(),dw=_f(),Nf=_l(),pw=Io(),hw=Wl(),fw=go(),mw=yo(),Uf=">",qf="<",Kl="prototype",Xl="script",jf=mw("IE_PROTO"),Yl=function(){},Gf=function(s){return qf+Xl+Uf+s+qf+"/"+Xl+Uf},Hf=function(s){s.write(Gf("")),s.close();var e=s.parentWindow.Object;return s=null,e},bw=function(){var s=fw("iframe"),e="java"+Xl+":",t;return s.style.display="none",hw.appendChild(s),s.src=String(e),t=s.contentWindow.document,t.open(),t.write(Gf("document.F=Object")),t.close(),t.F},wo,Po=function(){try{wo=new ActiveXObject("htmlfile")}catch(e){}Po=typeof document!="undefined"?document.domain&&wo?Hf(wo):bw():Hf(wo);for(var s=Nf.length;s--;)delete Po[Kl][Nf[s]];return Po()};pw[jf]=!0;zf.exports=Object.create||function(e,t){var i;return e!==null?(Yl[Kl]=cw(e),i=new Yl,Yl[Kl]=null,i[jf]=e):i=Po(),t===void 0?i:dw.f(i,t)}});var jr=g((MD,Qf)=>{"use strict";var gw=Nr();Qf.exports=function(s,e,t,i){return i&&i.enumerable?s[e]=t:gw(s,e,t),s}});var ic=g(($D,Kf)=>{"use strict";var Sw=st(),vw=Oe(),yw=Ot(),Tw=Jl(),Wf=To(),Iw=jr(),xw=at(),Ew=ti(),tc=xw("iterator"),Yf=!1,Di,Zl,ec;[].keys&&(ec=[].keys(),"next"in ec?(Zl=Wf(Wf(ec)),Zl!==Object.prototype&&(Di=Zl)):Yf=!0);var ww=!yw(Di)||Sw(function(){var s={};return Di[tc].call(s)!==s});ww?Di={}:Ew&&(Di=Tw(Di));vw(Di[tc])||Iw(Di,tc,function(){return this});Kf.exports={IteratorPrototype:Di,BUGGY_SAFARI_ITERATORS:Yf}});var Ao=g((BD,Jf)=>{"use strict";var Pw=at(),Aw=Pw("toStringTag"),Xf={};Xf[Aw]="z";Jf.exports=String(Xf)==="[object z]"});var Sa=g((DD,Zf)=>{"use strict";var kw=Ao(),Rw=Oe(),ko=fr(),Lw=at(),Mw=Lw("toStringTag"),$w=Object,Bw=ko(function(){return arguments}())==="Arguments",Dw=function(s,e){try{return s[e]}catch(t){}};Zf.exports=kw?ko:function(s){var e,t,i;return s===void 0?"Undefined":s===null?"Null":typeof(t=Dw(e=$w(s),Mw))=="string"?t:Bw?ko(e):(i=ko(e))==="Object"&&Rw(e.callee)?"Arguments":i}});var tm=g((CD,em)=>{"use strict";var Cw=Ao(),Vw=Sa();em.exports=Cw?{}.toString:function(){return"[object "+Vw(this)+"]"}});var va=g((VD,rm)=>{"use strict";var Ow=Ao(),_w=gr().f,Fw=Nr(),Nw=ii(),Uw=tm(),qw=at(),im=qw("toStringTag");rm.exports=function(s,e,t,i){var r=t?s:s&&s.prototype;r&&(Nw(r,im)||_w(r,im,{configurable:!0,value:e}),i&&!Ow&&Fw(r,"toString",Uw))}});var am=g((OD,sm)=>{"use strict";var Hw=ic().IteratorPrototype,jw=Jl(),Gw=ua(),zw=va(),Qw=vr(),Ww=function(){return this};sm.exports=function(s,e,t,i){var r=e+" Iterator";return s.prototype=jw(Hw,{next:Gw(+!i,t)}),zw(s,r,!1,!0),Qw[r]=Ww,s}});var om=g((_D,nm)=>{"use strict";var Yw=Ze(),Kw=ci();nm.exports=function(s,e,t){try{return Yw(Kw(Object.getOwnPropertyDescriptor(s,e)[t]))}catch(i){}}});var lm=g((FD,um)=>{"use strict";var Xw=Ot();um.exports=function(s){return Xw(s)||s===null}});var dm=g((ND,cm)=>{"use strict";var Jw=lm(),Zw=String,eP=TypeError;cm.exports=function(s){if(Jw(s))return s;throw new eP("Can't set "+Zw(s)+" as a prototype")}});var rc=g((UD,pm)=>{"use strict";var tP=om(),iP=Ot(),rP=Yi(),sP=dm();pm.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var s=!1,e={},t;try{t=tP(Object.prototype,"__proto__","set"),t(e,[]),s=e instanceof Array}catch(i){}return function(r,a){return rP(r),sP(a),iP(r)&&(s?t(r,a):r.__proto__=a),r}}():void 0)});var xm=g((qD,Im)=>{"use strict";var aP=je(),nP=Vt(),Ro=ti(),ym=Ql(),oP=Oe(),uP=am(),hm=To(),fm=rc(),lP=va(),cP=Nr(),sc=jr(),dP=at(),mm=vr(),Tm=ic(),pP=ym.PROPER,hP=ym.CONFIGURABLE,bm=Tm.IteratorPrototype,Lo=Tm.BUGGY_SAFARI_ITERATORS,ya=dP("iterator"),gm="keys",Ta="values",Sm="entries",vm=function(){return this};Im.exports=function(s,e,t,i,r,a,n){uP(t,e,i);var o=function(v){if(v===r&&h)return h;if(!Lo&&v&&v in d)return d[v];switch(v){case gm:return function(){return new t(this,v)};case Ta:return function(){return new t(this,v)};case Sm:return function(){return new t(this,v)}}return function(){return new t(this)}},u=e+" Iterator",l=!1,d=s.prototype,c=d[ya]||d["@@iterator"]||r&&d[r],h=!Lo&&c||o(r),p=e==="Array"&&d.entries||c,f,b,S;if(p&&(f=hm(p.call(new s)),f!==Object.prototype&&f.next&&(!Ro&&hm(f)!==bm&&(fm?fm(f,bm):oP(f[ya])||sc(f,ya,vm)),lP(f,u,!0,!0),Ro&&(mm[u]=vm))),pP&&r===Ta&&c&&c.name!==Ta&&(!Ro&&hP?cP(d,"name",Ta):(l=!0,h=function(){return nP(c,this)})),r)if(b={values:o(Ta),keys:a?h:o(gm),entries:o(Sm)},n)for(S in b)(Lo||l||!(S in d))&&sc(d,S,b[S]);else aP({target:e,proto:!0,forced:Lo||l},b);return(!Ro||n)&&d[ya]!==h&&sc(d,ya,h,{name:r}),mm[e]=h,b}});var wm=g((HD,Em)=>{"use strict";Em.exports=function(s,e){return{value:s,done:e}}});var nc=g((jD,Lm)=>{"use strict";var fP=mr(),ac=ba(),Pm=vr(),km=jl(),mP=gr().f,bP=xm(),Mo=wm(),gP=ti(),SP=Ct(),Rm="Array Iterator",vP=km.set,yP=km.getterFor(Rm);Lm.exports=bP(Array,"Array",function(s,e){vP(this,{type:Rm,target:fP(s),index:0,kind:e})},function(){var s=yP(this),e=s.target,t=s.index++;if(!e||t>=e.length)return s.target=void 0,Mo(void 0,!0);switch(s.kind){case"keys":return Mo(t,!1);case"values":return Mo(e[t],!1)}return Mo([t,e[t]],!1)},"values");var Am=Pm.Arguments=Pm.Array;ac("keys");ac("values");ac("entries");if(!gP&&SP&&Am.name!=="values")try{mP(Am,"name",{value:"values"})}catch(s){}});var $m=g((GD,Mm)=>{"use strict";var TP=at(),IP=vr(),xP=TP("iterator"),EP=Array.prototype;Mm.exports=function(s){return s!==void 0&&(IP.Array===s||EP[xP]===s)}});var oc=g((zD,Dm)=>{"use strict";var wP=Sa(),Bm=da(),PP=Cr(),AP=vr(),kP=at(),RP=kP("iterator");Dm.exports=function(s){if(!PP(s))return Bm(s,RP)||Bm(s,"@@iterator")||AP[wP(s)]}});var Vm=g((QD,Cm)=>{"use strict";var LP=Vt(),MP=ci(),$P=di(),BP=ca(),DP=oc(),CP=TypeError;Cm.exports=function(s,e){var t=arguments.length<2?DP(s):e;if(MP(t))return $P(LP(t,s));throw new CP(BP(s)+" is not iterable")}});var Fm=g((WD,_m)=>{"use strict";var VP=Vt(),Om=di(),OP=da();_m.exports=function(s,e,t){var i,r;Om(s);try{if(i=OP(s,"return"),!i){if(e==="throw")throw t;return t}i=VP(i,s)}catch(a){r=!0,i=a}if(e==="throw")throw t;if(r)throw i;return Om(i),t}});var Bo=g((YD,Hm)=>{"use strict";var _P=Fr(),FP=Vt(),NP=di(),UP=ca(),qP=$m(),HP=Hr(),Nm=la(),jP=Vm(),GP=oc(),Um=Fm(),zP=TypeError,$o=function(s,e){this.stopped=s,this.result=e},qm=$o.prototype;Hm.exports=function(s,e,t){var i=t&&t.that,r=!!(t&&t.AS_ENTRIES),a=!!(t&&t.IS_RECORD),n=!!(t&&t.IS_ITERATOR),o=!!(t&&t.INTERRUPTED),u=_P(e,i),l,d,c,h,p,f,b,S=function(y){return l&&Um(l,"normal",y),new $o(!0,y)},v=function(y){return r?(NP(y),o?u(y[0],y[1],S):u(y[0],y[1])):o?u(y,S):u(y)};if(a)l=s.iterator;else if(n)l=s;else{if(d=GP(s),!d)throw new zP(UP(s)+" is not iterable");if(qP(d)){for(c=0,h=HP(s);h>c;c++)if(p=v(s[c]),p&&Nm(qm,p))return p;return new $o(!1)}l=jP(s,d)}for(f=a?s.next:l.next;!(b=FP(f,l)).done;){try{p=v(b.value)}catch(y){Um(l,"throw",y)}if(typeof p=="object"&&p&&Nm(qm,p))return p}return new $o(!1)}});var Gm=g((KD,jm)=>{"use strict";var QP=Ct(),WP=gr(),YP=ua();jm.exports=function(s,e,t){QP?WP.f(s,e,YP(0,t)):s[e]=t}});var zm=g(()=>{"use strict";var KP=je(),XP=Bo(),JP=Gm();KP({target:"Object",stat:!0},{fromEntries:function(e){var t={};return XP(e,function(i,r){JP(t,i,r)},{AS_ENTRIES:!0}),t}})});var Wm=g((ZD,Qm)=>{"use strict";nc();zm();var ZP=Vr();Qm.exports=ZP.Object.fromEntries});var Km=g((e0,Ym)=>{"use strict";Ym.exports={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}});var Jm=g(()=>{"use strict";nc();var eA=Km(),tA=Fe(),iA=va(),Xm=vr();for(Do in eA)iA(tA[Do],Do),Xm[Do]=Xm.Array;var Do});var eb=g((r0,Zm)=>{"use strict";var rA=Wm();Jm();Zm.exports=rA});var uc=g((s0,tb)=>{"use strict";var sA=eb();tb.exports=sA});var ib=g(()=>{"use strict"});var lc=g((o0,rb)=>{"use strict";var Ia=Fe(),aA=br(),nA=fr(),Co=function(s){return aA.slice(0,s.length)===s};rb.exports=function(){return Co("Bun/")?"BUN":Co("Cloudflare-Workers")?"CLOUDFLARE":Co("Deno/")?"DENO":Co("Node.js/")?"NODE":Ia.Bun&&typeof Bun.version=="string"?"BUN":Ia.Deno&&typeof Deno.version=="object"?"DENO":nA(Ia.process)==="process"?"NODE":Ia.window&&Ia.document?"BROWSER":"REST"}()});var Vo=g((u0,sb)=>{"use strict";var oA=lc();sb.exports=oA==="NODE"});var nb=g((l0,ab)=>{"use strict";var uA=gr();ab.exports=function(s,e,t){return uA.f(s,e,t)}});var lb=g((c0,ub)=>{"use strict";var lA=Bi(),cA=nb(),dA=at(),pA=Ct(),ob=dA("species");ub.exports=function(s){var e=lA(s);pA&&e&&!e[ob]&&cA(e,ob,{configurable:!0,get:function(){return this}})}});var db=g((d0,cb)=>{"use strict";var hA=la(),fA=TypeError;cb.exports=function(s,e){if(hA(e,s))return s;throw new fA("Incorrect invocation")}});var dc=g((p0,pb)=>{"use strict";var mA=Ze(),bA=Oe(),cc=pa(),gA=mA(Function.toString);bA(cc.inspectSource)||(cc.inspectSource=function(s){return gA(s)});pb.exports=cc.inspectSource});var hc=g((h0,gb)=>{"use strict";var SA=Ze(),vA=st(),hb=Oe(),yA=Sa(),TA=Bi(),IA=dc(),fb=function(){},mb=TA("Reflect","construct"),pc=/^\s*(?:class|function)\b/,xA=SA(pc.exec),EA=!pc.test(fb),xa=function(e){if(!hb(e))return!1;try{return mb(fb,[],e),!0}catch(t){return!1}},bb=function(e){if(!hb(e))return!1;switch(yA(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return EA||!!xA(pc,IA(e))}catch(t){return!0}};bb.sham=!0;gb.exports=!mb||vA(function(){var s;return xa(xa.call)||!xa(Object)||!xa(function(){s=!0})||s})?bb:xa});var vb=g((f0,Sb)=>{"use strict";var wA=hc(),PA=ca(),AA=TypeError;Sb.exports=function(s){if(wA(s))return s;throw new AA(PA(s)+" is not a constructor")}});var fc=g((m0,Tb)=>{"use strict";var yb=di(),kA=vb(),RA=Cr(),LA=at(),MA=LA("species");Tb.exports=function(s,e){var t=yb(s).constructor,i;return t===void 0||RA(i=yb(t)[MA])?e:kA(i)}});var xb=g((b0,Ib)=>{"use strict";var $A=Ze();Ib.exports=$A([].slice)});var wb=g((g0,Eb)=>{"use strict";var BA=TypeError;Eb.exports=function(s,e){if(s<e)throw new BA("Not enough arguments");return s}});var mc=g((S0,Pb)=>{"use strict";var DA=br();Pb.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(DA)});var Ec=g((v0,Cb)=>{"use strict";var Ft=Fe(),CA=nl(),VA=Fr(),Ab=Oe(),OA=ii(),Db=st(),kb=Wl(),_A=xb(),Rb=go(),FA=wb(),NA=mc(),UA=Vo(),Tc=Ft.setImmediate,Ic=Ft.clearImmediate,qA=Ft.process,bc=Ft.Dispatch,HA=Ft.Function,Lb=Ft.MessageChannel,jA=Ft.String,gc=0,Ea={},Mb="onreadystatechange",wa,Tr,Sc,vc;Db(function(){wa=Ft.location});var xc=function(s){if(OA(Ea,s)){var e=Ea[s];delete Ea[s],e()}},yc=function(s){return function(){xc(s)}},$b=function(s){xc(s.data)},Bb=function(s){Ft.postMessage(jA(s),wa.protocol+"//"+wa.host)};(!Tc||!Ic)&&(Tc=function(e){FA(arguments.length,1);var t=Ab(e)?e:HA(e),i=_A(arguments,1);return Ea[++gc]=function(){CA(t,void 0,i)},Tr(gc),gc},Ic=function(e){delete Ea[e]},UA?Tr=function(s){qA.nextTick(yc(s))}:bc&&bc.now?Tr=function(s){bc.now(yc(s))}:Lb&&!NA?(Sc=new Lb,vc=Sc.port2,Sc.port1.onmessage=$b,Tr=VA(vc.postMessage,vc)):Ft.addEventListener&&Ab(Ft.postMessage)&&!Ft.importScripts&&wa&&wa.protocol!=="file:"&&!Db(Bb)?(Tr=Bb,Ft.addEventListener("message",$b,!1)):Mb in Rb("script")?Tr=function(s){kb.appendChild(Rb("script"))[Mb]=function(){kb.removeChild(this),xc(s)}}:Tr=function(s){setTimeout(yc(s),0)});Cb.exports={set:Tc,clear:Ic}});var _b=g((y0,Ob)=>{"use strict";var Vb=Fe(),GA=Ct(),zA=Object.getOwnPropertyDescriptor;Ob.exports=function(s){if(!GA)return Vb[s];var e=zA(Vb,s);return e&&e.value}});var wc=g((T0,Nb)=>{"use strict";var Fb=function(){this.head=null,this.tail=null};Fb.prototype={add:function(s){var e={item:s,next:null},t=this.tail;t?t.next=e:this.head=e,this.tail=e},get:function(){var s=this.head;if(s){var e=this.head=s.next;return e===null&&(this.tail=null),s.item}}};Nb.exports=Fb});var qb=g((I0,Ub)=>{"use strict";var QA=br();Ub.exports=/ipad|iphone|ipod/i.test(QA)&&typeof Pebble!="undefined"});var jb=g((x0,Hb)=>{"use strict";var WA=br();Hb.exports=/web0s(?!.*chrome)/i.test(WA)});var Xb=g((E0,Kb)=>{"use strict";var zr=Fe(),YA=_b(),Gb=Fr(),Pc=Ec().set,KA=wc(),XA=mc(),JA=qb(),ZA=jb(),Ac=Vo(),zb=zr.MutationObserver||zr.WebKitMutationObserver,Qb=zr.document,Wb=zr.process,Oo=zr.Promise,Lc=YA("queueMicrotask"),Gr,kc,Rc,_o,Yb;Lc||(Pa=new KA,Aa=function(){var s,e;for(Ac&&(s=Wb.domain)&&s.exit();e=Pa.get();)try{e()}catch(t){throw Pa.head&&Gr(),t}s&&s.enter()},!XA&&!Ac&&!ZA&&zb&&Qb?(kc=!0,Rc=Qb.createTextNode(""),new zb(Aa).observe(Rc,{characterData:!0}),Gr=function(){Rc.data=kc=!kc}):!JA&&Oo&&Oo.resolve?(_o=Oo.resolve(void 0),_o.constructor=Oo,Yb=Gb(_o.then,_o),Gr=function(){Yb(Aa)}):Ac?Gr=function(){Wb.nextTick(Aa)}:(Pc=Gb(Pc,zr),Gr=function(){Pc(Aa)}),Lc=function(s){Pa.head||Gr(),Pa.add(s)});var Pa,Aa;Kb.exports=Lc});var Zb=g((w0,Jb)=>{"use strict";Jb.exports=function(s,e){try{arguments.length===1?console.error(s):console.error(s,e)}catch(t){}}});var Fo=g((P0,eg)=>{"use strict";eg.exports=function(s){try{return{error:!1,value:s()}}catch(e){return{error:!0,value:e}}}});var Ir=g((A0,tg)=>{"use strict";var ek=Fe();tg.exports=ek.Promise});var Qr=g((k0,ag)=>{"use strict";var tk=Fe(),ka=Ir(),ik=Oe(),rk=kl(),sk=dc(),ak=at(),ig=lc(),nk=ti(),Mc=ml(),rg=ka&&ka.prototype,ok=ak("species"),$c=!1,sg=ik(tk.PromiseRejectionEvent),uk=rk("Promise",function(){var s=sk(ka),e=s!==String(ka);if(!e&&Mc===66||nk&&!(rg.catch&&rg.finally))return!0;if(!Mc||Mc<51||!/native code/.test(s)){var t=new ka(function(a){a(1)}),i=function(a){a(function(){},function(){})},r=t.constructor={};if(r[ok]=i,$c=t.then(function(){})instanceof i,!$c)return!0}return!e&&(ig==="BROWSER"||ig==="DENO")&&!sg});ag.exports={CONSTRUCTOR:uk,REJECTION_EVENT:sg,SUBCLASSING:$c}});var Wr=g((R0,og)=>{"use strict";var ng=ci(),lk=TypeError,ck=function(s){var e,t;this.promise=new s(function(i,r){if(e!==void 0||t!==void 0)throw new lk("Bad Promise constructor");e=i,t=r}),this.resolve=ng(e),this.reject=ng(t)};og.exports.f=function(s){return new ck(s)}});var Pg=g(()=>{"use strict";var dk=je(),pk=ti(),Ho=Vo(),Xi=Fe(),Jr=Vt(),ug=jr(),lg=rc(),hk=va(),fk=lb(),mk=ci(),qo=Oe(),bk=Ot(),gk=db(),Sk=fc(),fg=Ec().set,Oc=Xb(),vk=Zb(),yk=Fo(),Tk=wc(),mg=jl(),jo=Ir(),_c=Qr(),bg=Wr(),Go="Promise",gg=_c.CONSTRUCTOR,Ik=_c.REJECTION_EVENT,xk=_c.SUBCLASSING,Bc=mg.getterFor(Go),Ek=mg.set,Yr=jo&&jo.prototype,xr=jo,No=Yr,Sg=Xi.TypeError,Dc=Xi.document,Fc=Xi.process,Cc=bg.f,wk=Cc,Pk=!!(Dc&&Dc.createEvent&&Xi.dispatchEvent),vg="unhandledrejection",Ak="rejectionhandled",cg=0,yg=1,kk=2,Nc=1,Tg=2,Uo,dg,Rk,pg,Ig=function(s){var e;return bk(s)&&qo(e=s.then)?e:!1},xg=function(s,e){var t=e.value,i=e.state===yg,r=i?s.ok:s.fail,a=s.resolve,n=s.reject,o=s.domain,u,l,d;try{r?(i||(e.rejection===Tg&&Mk(e),e.rejection=Nc),r===!0?u=t:(o&&o.enter(),u=r(t),o&&(o.exit(),d=!0)),u===s.promise?n(new Sg("Promise-chain cycle")):(l=Ig(u))?Jr(l,u,a,n):a(u)):n(t)}catch(c){o&&!d&&o.exit(),n(c)}},Eg=function(s,e){s.notified||(s.notified=!0,Oc(function(){for(var t=s.reactions,i;i=t.get();)xg(i,s);s.notified=!1,e&&!s.rejection&&Lk(s)}))},wg=function(s,e,t){var i,r;Pk?(i=Dc.createEvent("Event"),i.promise=e,i.reason=t,i.initEvent(s,!1,!0),Xi.dispatchEvent(i)):i={promise:e,reason:t},!Ik&&(r=Xi["on"+s])?r(i):s===vg&&vk("Unhandled promise rejection",t)},Lk=function(s){Jr(fg,Xi,function(){var e=s.facade,t=s.value,i=hg(s),r;if(i&&(r=yk(function(){Ho?Fc.emit("unhandledRejection",t,e):wg(vg,e,t)}),s.rejection=Ho||hg(s)?Tg:Nc,r.error))throw r.value})},hg=function(s){return s.rejection!==Nc&&!s.parent},Mk=function(s){Jr(fg,Xi,function(){var e=s.facade;Ho?Fc.emit("rejectionHandled",e):wg(Ak,e,s.value)})},Kr=function(s,e,t){return function(i){s(e,i,t)}},Xr=function(s,e,t){s.done||(s.done=!0,t&&(s=t),s.value=e,s.state=kk,Eg(s,!0))},Vc=function(s,e,t){if(!s.done){s.done=!0,t&&(s=t);try{if(s.facade===e)throw new Sg("Promise can't be resolved itself");var i=Ig(e);i?Oc(function(){var r={done:!1};try{Jr(i,e,Kr(Vc,r,s),Kr(Xr,r,s))}catch(a){Xr(r,a,s)}}):(s.value=e,s.state=yg,Eg(s,!1))}catch(r){Xr({done:!1},r,s)}}};if(gg&&(xr=function(e){gk(this,No),mk(e),Jr(Uo,this);var t=Bc(this);try{e(Kr(Vc,t),Kr(Xr,t))}catch(i){Xr(t,i)}},No=xr.prototype,Uo=function(e){Ek(this,{type:Go,done:!1,notified:!1,parent:!1,reactions:new Tk,rejection:!1,state:cg,value:void 0})},Uo.prototype=ug(No,"then",function(e,t){var i=Bc(this),r=Cc(Sk(this,xr));return i.parent=!0,r.ok=qo(e)?e:!0,r.fail=qo(t)&&t,r.domain=Ho?Fc.domain:void 0,i.state===cg?i.reactions.add(r):Oc(function(){xg(r,i)}),r.promise}),dg=function(){var s=new Uo,e=Bc(s);this.promise=s,this.resolve=Kr(Vc,e),this.reject=Kr(Xr,e)},bg.f=Cc=function(s){return s===xr||s===Rk?new dg(s):wk(s)},!pk&&qo(jo)&&Yr!==Object.prototype)){pg=Yr.then,xk||ug(Yr,"then",function(e,t){var i=this;return new xr(function(r,a){Jr(pg,i,r,a)}).then(e,t)},{unsafe:!0});try{delete Yr.constructor}catch(s){}lg&&lg(Yr,No)}dk({global:!0,constructor:!0,wrap:!0,forced:gg},{Promise:xr});hk(xr,Go,!1,!0);fk(Go)});var Mg=g(($0,Lg)=>{"use strict";var $k=at(),kg=$k("iterator"),Rg=!1;try{Ag=0,Uc={next:function(){return{done:!!Ag++}},return:function(){Rg=!0}},Uc[kg]=function(){return this},Array.from(Uc,function(){throw 2})}catch(s){}var Ag,Uc;Lg.exports=function(s,e){try{if(!e&&!Rg)return!1}catch(r){return!1}var t=!1;try{var i={};i[kg]=function(){return{next:function(){return{done:t=!0}}}},s(i)}catch(r){}return t}});var qc=g((B0,$g)=>{"use strict";var Bk=Ir(),Dk=Mg(),Ck=Qr().CONSTRUCTOR;$g.exports=Ck||!Dk(function(s){Bk.all(s).then(void 0,function(){})})});var Bg=g(()=>{"use strict";var Vk=je(),Ok=Vt(),_k=ci(),Fk=Wr(),Nk=Fo(),Uk=Bo(),qk=qc();Vk({target:"Promise",stat:!0,forced:qk},{all:function(e){var t=this,i=Fk.f(t),r=i.resolve,a=i.reject,n=Nk(function(){var o=_k(t.resolve),u=[],l=0,d=1;Uk(e,function(c){var h=l++,p=!1;d++,Ok(o,t,c).then(function(f){p||(p=!0,u[h]=f,--d||r(u))},a)}),--d||r(u)});return n.error&&a(n.value),i.promise}})});var Cg=g(()=>{"use strict";var Hk=je(),jk=ti(),Gk=Qr().CONSTRUCTOR,jc=Ir(),zk=Bi(),Qk=Oe(),Wk=jr(),Dg=jc&&jc.prototype;Hk({target:"Promise",proto:!0,forced:Gk,real:!0},{catch:function(s){return this.then(void 0,s)}});!jk&&Qk(jc)&&(Hc=zk("Promise").prototype.catch,Dg.catch!==Hc&&Wk(Dg,"catch",Hc,{unsafe:!0}));var Hc});var Vg=g(()=>{"use strict";var Yk=je(),Kk=Vt(),Xk=ci(),Jk=Wr(),Zk=Fo(),eR=Bo(),tR=qc();Yk({target:"Promise",stat:!0,forced:tR},{race:function(e){var t=this,i=Jk.f(t),r=i.reject,a=Zk(function(){var n=Xk(t.resolve);eR(e,function(o){Kk(n,t,o).then(i.resolve,r)})});return a.error&&r(a.value),i.promise}})});var Og=g(()=>{"use strict";var iR=je(),rR=Wr(),sR=Qr().CONSTRUCTOR;iR({target:"Promise",stat:!0,forced:sR},{reject:function(e){var t=rR.f(this),i=t.reject;return i(e),t.promise}})});var Gc=g((q0,_g)=>{"use strict";var aR=di(),nR=Ot(),oR=Wr();_g.exports=function(s,e){if(aR(s),nR(e)&&e.constructor===s)return e;var t=oR.f(s),i=t.resolve;return i(e),t.promise}});var Ug=g(()=>{"use strict";var uR=je(),lR=Bi(),Fg=ti(),cR=Ir(),Ng=Qr().CONSTRUCTOR,dR=Gc(),pR=lR("Promise"),hR=Fg&&!Ng;uR({target:"Promise",stat:!0,forced:Fg||Ng},{resolve:function(e){return dR(hR&&this===pR?cR:this,e)}})});var qg=g(()=>{"use strict";Pg();Bg();Cg();Vg();Og();Ug()});var zg=g(()=>{"use strict";var fR=je(),mR=ti(),zo=Ir(),bR=st(),jg=Bi(),Gg=Oe(),gR=fc(),Hg=Gc(),SR=jr(),Qc=zo&&zo.prototype,vR=!!zo&&bR(function(){Qc.finally.call({then:function(){}},function(){})});fR({target:"Promise",proto:!0,real:!0,forced:vR},{finally:function(s){var e=gR(this,jg("Promise")),t=Gg(s);return this.then(t?function(i){return Hg(e,s()).then(function(){return i})}:s,t?function(i){return Hg(e,s()).then(function(){throw i})}:s)}});!mR&&Gg(zo)&&(zc=jg("Promise").prototype.finally,Qc.finally!==zc&&SR(Qc,"finally",zc,{unsafe:!0}));var zc});var Wg=g((Y0,Qg)=>{"use strict";ib();qg();zg();var yR=Ki();Qg.exports=yR("Promise","finally")});var Kg=g((K0,Yg)=>{"use strict";var TR=Wg();Yg.exports=TR});var Ra=g((X0,Xg)=>{"use strict";var IR=Kg();Xg.exports=IR});var sS=g(()=>{"use strict";var AR=je(),kR=Nl().values;AR({target:"Object",stat:!0},{values:function(e){return kR(e)}})});var nS=g((kC,aS)=>{"use strict";sS();var RR=Vr();aS.exports=RR.Object.values});var uS=g((RC,oS)=>{"use strict";var LR=nS();oS.exports=LR});var Er=g((LC,lS)=>{"use strict";var MR=uS();lS.exports=MR});var yS=g(()=>{"use strict";var UR=je(),qR=Or(),HR=Hr(),jR=ma(),GR=ba();UR({target:"Array",proto:!0},{at:function(e){var t=qR(this),i=HR(t),r=jR(e),a=r>=0?r:i+r;return a<0||a>=i?void 0:t[a]}});GR("at")});var IS=g((OV,TS)=>{"use strict";yS();var zR=Ki();TS.exports=zR("Array","at")});var ES=g((_V,xS)=>{"use strict";var QR=IS();xS.exports=QR});var si=g((FV,wS)=>{"use strict";var WR=ES();wS.exports=WR});var pd=g((b_,QS)=>{"use strict";var aL=fr();QS.exports=Array.isArray||function(e){return aL(e)==="Array"}});var YS=g((g_,WS)=>{"use strict";var nL=TypeError,oL=9007199254740991;WS.exports=function(s){if(s>oL)throw nL("Maximum allowed index exceeded");return s}});var JS=g((S_,XS)=>{"use strict";var uL=pd(),lL=Hr(),cL=YS(),dL=Fr(),KS=function(s,e,t,i,r,a,n,o){for(var u=r,l=0,d=n?dL(n,o):!1,c,h;l<i;)l in t&&(c=d?d(t[l],l,e):t[l],a>0&&uL(c)?(h=lL(c),u=KS(s,e,c,h,u,a-1)-1):(cL(u+1),s[u]=c),u++),l++;return u};XS.exports=KS});var iv=g((v_,tv)=>{"use strict";var ZS=pd(),pL=hc(),hL=Ot(),fL=at(),mL=fL("species"),ev=Array;tv.exports=function(s){var e;return ZS(s)&&(e=s.constructor,pL(e)&&(e===ev||ZS(e.prototype))?e=void 0:hL(e)&&(e=e[mL],e===null&&(e=void 0))),e===void 0?ev:e}});var sv=g((y_,rv)=>{"use strict";var bL=iv();rv.exports=function(s,e){return new(bL(s))(e===0?0:e)}});var av=g(()=>{"use strict";var gL=je(),SL=JS(),vL=ci(),yL=Or(),TL=Hr(),IL=sv();gL({target:"Array",proto:!0},{flatMap:function(e){var t=yL(this),i=TL(t),r;return vL(e),r=IL(t,0),r.length=SL(r,t,t,i,0,1,e,arguments.length>1?arguments[1]:void 0),r}})});var nv=g(()=>{"use strict";var xL=ba();xL("flatMap")});var uv=g((w_,ov)=>{"use strict";av();nv();var EL=Ki();ov.exports=EL("Array","flatMap")});var cv=g((P_,lv)=>{"use strict";var wL=uv();lv.exports=wL});var Ua=g((A_,dv)=>{"use strict";var PL=cv();dv.exports=PL});var qa=g((k_,pv)=>{"use strict";var AL=Sa(),kL=String;pv.exports=function(s){if(AL(s)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return kL(s)}});var hd=g((R_,hv)=>{"use strict";hv.exports=`
7
- \v\f\r \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF`});var bv=g((L_,mv)=>{"use strict";var RL=Ze(),LL=Yi(),ML=qa(),md=hd(),fv=RL("".replace),$L=RegExp("^["+md+"]+"),BL=RegExp("(^|[^"+md+"])["+md+"]+$"),fd=function(s){return function(e){var t=ML(LL(e));return s&1&&(t=fv(t,$L,"")),s&2&&(t=fv(t,BL,"$1")),t}};mv.exports={start:fd(1),end:fd(2),trim:fd(3)}});var yv=g((M_,vv)=>{"use strict";var DL=Ql().PROPER,CL=st(),gv=hd(),Sv="\u200B\x85\u180E";vv.exports=function(s){return CL(function(){return!!gv[s]()||Sv[s]()!==Sv||DL&&gv[s].name!==s})}});var bd=g(($_,Tv)=>{"use strict";var VL=bv().start,OL=yv();Tv.exports=OL("trimStart")?function(){return VL(this)}:"".trimStart});var xv=g(()=>{"use strict";var _L=je(),Iv=bd();_L({target:"String",proto:!0,name:"trimStart",forced:"".trimLeft!==Iv},{trimLeft:Iv})});var wv=g(()=>{"use strict";xv();var FL=je(),Ev=bd();FL({target:"String",proto:!0,name:"trimStart",forced:"".trimStart!==Ev},{trimStart:Ev})});var Av=g((O_,Pv)=>{"use strict";wv();var NL=Ki();Pv.exports=NL("String","trimLeft")});var Rv=g((__,kv)=>{"use strict";var UL=Av();kv.exports=UL});var Mv=g((F_,Lv)=>{"use strict";var qL=Rv();Lv.exports=qL});var jv=g(()=>{"use strict"});var Gv=g(()=>{"use strict"});var Qv=g((SU,zv)=>{"use strict";var uM=Ot(),lM=fr(),cM=at(),dM=cM("match");zv.exports=function(s){var e;return uM(s)&&((e=s[dM])!==void 0?!!e:lM(s)==="RegExp")}});var Yv=g((vU,Wv)=>{"use strict";var pM=di();Wv.exports=function(){var s=pM(this),e="";return s.hasIndices&&(e+="d"),s.global&&(e+="g"),s.ignoreCase&&(e+="i"),s.multiline&&(e+="m"),s.dotAll&&(e+="s"),s.unicode&&(e+="u"),s.unicodeSets&&(e+="v"),s.sticky&&(e+="y"),e}});var Jv=g((yU,Xv)=>{"use strict";var hM=Vt(),fM=ii(),mM=la(),bM=Yv(),Kv=RegExp.prototype;Xv.exports=function(s){var e=s.flags;return e===void 0&&!("flags"in Kv)&&!fM(s,"flags")&&mM(Kv,s)?hM(bM,s):e}});var ey=g((TU,Zv)=>{"use strict";var Td=Ze(),gM=Or(),SM=Math.floor,vd=Td("".charAt),vM=Td("".replace),yd=Td("".slice),yM=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,TM=/\$([$&'`]|\d{1,2})/g;Zv.exports=function(s,e,t,i,r,a){var n=t+s.length,o=i.length,u=TM;return r!==void 0&&(r=gM(r),u=yM),vM(a,u,function(l,d){var c;switch(vd(d,0)){case"$":return"$";case"&":return s;case"`":return yd(e,0,t);case"'":return yd(e,n);case"<":c=r[yd(d,1,-1)];break;default:var h=+d;if(h===0)return l;if(h>o){var p=SM(h/10);return p===0?l:p<=o?i[p-1]===void 0?vd(d,1):i[p-1]+vd(d,1):l}c=i[h-1]}return c===void 0?"":c})}});var ry=g(()=>{"use strict";var IM=je(),xM=Vt(),xd=Ze(),ty=Yi(),EM=Oe(),wM=Cr(),PM=Qv(),cs=qa(),AM=da(),kM=Jv(),RM=ey(),LM=at(),MM=ti(),$M=LM("replace"),BM=TypeError,Id=xd("".indexOf),DM=xd("".replace),iy=xd("".slice),CM=Math.max;IM({target:"String",proto:!0},{replaceAll:function(e,t){var i=ty(this),r,a,n,o,u,l,d,c,h,p,f=0,b="";if(!wM(e)){if(r=PM(e),r&&(a=cs(ty(kM(e))),!~Id(a,"g")))throw new BM("`.replaceAll` does not allow non-global regexes");if(n=AM(e,$M),n)return xM(n,e,i,t);if(MM&&r)return DM(cs(i),e,t)}for(o=cs(i),u=cs(e),l=EM(t),l||(t=cs(t)),d=u.length,c=CM(1,d),h=Id(o,u);h!==-1;)p=l?cs(t(u,h,o)):RM(u,o,h,[],void 0,t),b+=iy(o,f,h)+p,f=h+d,h=h+c>o.length?-1:Id(o,u,h+c);return f<o.length&&(b+=iy(o,f)),b}})});var ay=g((EU,sy)=>{"use strict";jv();Gv();ry();var VM=Ki();sy.exports=VM("String","replaceAll")});var oy=g((wU,ny)=>{"use strict";var OM=ay();ny.exports=OM});var Ed=g((PU,uy)=>{"use strict";var _M=oy();uy.exports=_M});var cy=g((AU,ly)=>{"use strict";var FM=ma(),NM=qa(),UM=Yi(),qM=RangeError;ly.exports=function(e){var t=NM(UM(this)),i="",r=FM(e);if(r<0||r===1/0)throw new qM("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))r&1&&(i+=t);return i}});var my=g((kU,fy)=>{"use strict";var hy=Ze(),HM=Dl(),dy=qa(),jM=cy(),GM=Yi(),zM=hy(jM),QM=hy("".slice),WM=Math.ceil,py=function(s){return function(e,t,i){var r=dy(GM(e)),a=HM(t),n=r.length,o=i===void 0?" ":dy(i),u,l;return a<=n||o===""?r:(u=a-n,l=zM(o,WM(u/o.length)),l.length>u&&(l=QM(l,0,u)),s?r+l:l+r)}};fy.exports={start:py(!1),end:py(!0)}});var gy=g((RU,by)=>{"use strict";var YM=br();by.exports=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(YM)});var Sy=g(()=>{"use strict";var KM=je(),XM=my().start,JM=gy();KM({target:"String",proto:!0,forced:JM},{padStart:function(e){return XM(this,e,arguments.length>1?arguments[1]:void 0)}})});var yy=g(($U,vy)=>{"use strict";Sy();var ZM=Ki();vy.exports=ZM("String","padStart")});var Iy=g((BU,Ty)=>{"use strict";var e$=yy();Ty.exports=e$});var wd=g((DU,xy)=>{"use strict";var t$=Iy();xy.exports=t$});var j$={};zT(j$,{ChromecastState:()=>sa,HttpConnectionType:()=>ho,Observable:()=>Si.Observable,PlaybackState:()=>vt,Player:()=>co,PredefinedQualityLimits:()=>aa,SDK_VERSION:()=>H$,Subject:()=>Si.Subject,Subscription:()=>Si.Subscription,Surface:()=>fo,VERSION:()=>sl,ValueSubject:()=>Si.ValueSubject,VideoFormat:()=>li,VideoQuality:()=>Si.VideoQuality,clientChecker:()=>ee,isMobile:()=>Zr});module.exports=QT(j$);var sl="2.0.134-dev.464b6f35.0";var vt=(r=>(r.STOPPED="stopped",r.READY="ready",r.PLAYING="playing",r.PAUSED="paused",r))(vt||{}),li=(x=>(x.MPEG="MPEG",x.DASH="DASH",x.DASH_SEP="DASH_SEP",x.DASH_SEP_VK="DASH_SEP",x.DASH_WEBM="DASH_WEBM",x.DASH_WEBM_AV1="DASH_WEBM_AV1",x.DASH_STREAMS="DASH_STREAMS",x.DASH_WEBM_VK="DASH_WEBM",x.DASH_ONDEMAND="DASH_ONDEMAND",x.DASH_ONDEMAND_VK="DASH_ONDEMAND",x.DASH_LIVE="DASH_LIVE",x.DASH_LIVE_CMAF="DASH_LIVE_CMAF",x.DASH_LIVE_WEBM="DASH_LIVE_WEBM",x.HLS="HLS",x.HLS_ONDEMAND="HLS_ONDEMAND",x.HLS_JS="HLS",x.HLS_LIVE="HLS_LIVE",x.HLS_LIVE_CMAF="HLS_LIVE_CMAF",x.WEB_RTC_LIVE="WEB_RTC_LIVE",x))(li||{});var sa=(r=>(r.NOT_AVAILABLE="NOT_AVAILABLE",r.AVAILABLE="AVAILABLE",r.CONNECTING="CONNECTING",r.CONNECTED="CONNECTED",r))(sa||{}),ho=(i=>(i.HTTP1="http1",i.HTTP2="http2",i.QUIC="quic",i))(ho||{});var fo=(n=>(n.NONE="none",n.INLINE="inline",n.FULLSCREEN="fullscreen",n.SECOND_SCREEN="second_screen",n.PIP="pip",n.INVISIBLE="invisible",n))(fo||{}),aa=(i=>(i.TRAFFIC_SAVING="traffic_saving",i.HIGH_QUALITY="high_quality",i.UNKNOWN="unknown",i))(aa||{});var _T=K(_t(),1);var ce=require("@vkontakte/videoplayer-shared/es2015");var sf=s=>new Promise((e,t)=>{let i=document.createElement("script");i.setAttribute("src",s),i.onload=()=>e(),i.onerror=r=>t(r),document.body.appendChild(i)});var vo=class{constructor(e){this.connection$=new ce.ValueSubject(void 0);this.castState$=new ce.ValueSubject("NOT_AVAILABLE");this.errorEvent$=new ce.Subject;this.realCastState$=new ce.ValueSubject("NOT_AVAILABLE");this.subscription=new ce.Subscription;this.isDestroyed=!1;var a;this.params=e,this.log=this.params.dependencies.logger.createComponentLog("ChromecastInitializer");let t="chrome"in window;if(this.log({message:`[constructor] receiverApplicationId: ${this.params.receiverApplicationId}, isDisabled: ${this.params.isDisabled}, isSupported: ${t}`}),e.isDisabled||!t)return;let i=(0,ce.isNonNullable)((a=window.chrome)==null?void 0:a.cast),r=!!window.__onGCastApiAvailable;i?this.initializeCastApi():(window.__onGCastApiAvailable=n=>{delete window.__onGCastApiAvailable,n&&!this.isDestroyed&&this.initializeCastApi()},r||sf("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1").catch(()=>this.errorEvent$.next({id:"ChromecastLoading",category:ce.ErrorCategory.NETWORK,message:"Script loading failed!"})))}connect(){var e;(e=cast.framework.CastContext.getInstance())==null||e.requestSession()}disconnect(){var e,t;(t=(e=cast.framework.CastContext.getInstance())==null?void 0:e.getCurrentSession())==null||t.endSession(!0)}stopMedia(){return new Promise((e,t)=>{var i,r,a;(a=(r=(i=cast.framework.CastContext.getInstance())==null?void 0:i.getCurrentSession())==null?void 0:r.getMediaSession())==null||a.stop(new chrome.cast.media.StopRequest,e,t)})}toggleConnection(){(0,ce.isNonNullable)(this.connection$.getValue())?this.disconnect():this.connect()}setVolume(e){let t=this.connection$.getValue();(0,ce.isNullable)(t)||(t.remotePlayer.volumeLevel=e,t.remotePlayerController.setVolumeLevel())}setMuted(e){let t=this.connection$.getValue();(0,ce.isNullable)(t)||e!==t.remotePlayer.isMuted&&t.remotePlayerController.muteOrUnmute()}destroy(){this.isDestroyed=!0,this.subscription.unsubscribe()}initListeners(){let e=new cast.framework.RemotePlayer,t=new cast.framework.RemotePlayerController(e),i=cast.framework.CastContext.getInstance();this.subscription.add((0,ce.fromEvent)(i,cast.framework.CastContextEventType.SESSION_STATE_CHANGED).subscribe(r=>{var a,n,o;switch(r.sessionState){case cast.framework.SessionState.SESSION_STARTED:case cast.framework.SessionState.SESSION_STARTING:case cast.framework.SessionState.SESSION_RESUMED:this.contentId=(o=(n=(a=i.getCurrentSession())==null?void 0:a.getMediaSession())==null?void 0:n.media)==null?void 0:o.contentId;break;case cast.framework.SessionState.NO_SESSION:case cast.framework.SessionState.SESSION_ENDING:case cast.framework.SessionState.SESSION_ENDED:case cast.framework.SessionState.SESSION_START_FAILED:this.contentId=void 0;break;default:return(0,ce.assertNever)(r.sessionState)}})).add((0,ce.merge)((0,ce.fromEvent)(i,cast.framework.CastContextEventType.CAST_STATE_CHANGED).pipe((0,ce.tap)(r=>{this.log({message:`[cast.framework.RemotePlayerEventType.CAST_STATE_CHANGED]: ${JSON.stringify(r)}`})}),(0,ce.map)(r=>r.castState)),(0,ce.observableFrom)([i.getCastState()])).pipe((0,ce.filterChanged)(),(0,ce.map)(mE),(0,ce.tap)(r=>{this.log({message:`realCastState$: ${r}`})})).subscribe(this.realCastState$)).add(this.realCastState$.subscribe(r=>{var o,u;let a=r==="CONNECTED",n=(0,ce.isNonNullable)(this.connection$.getValue());if(a&&!n){let l=i.getCurrentSession();(0,ce.assertNonNullable)(l);let d=l.getCastDevice(),c=(u=(o=l.getMediaSession())==null?void 0:o.media)==null?void 0:u.contentId;((0,ce.isNullable)(c)||c===this.contentId)&&(this.log({message:"connection created"}),this.connection$.next({remotePlayer:e,remotePlayerController:t,session:l,castDevice:d}))}else!a&&n&&(this.log({message:"connection destroyed"}),this.connection$.next(void 0));this.castState$.next(r==="CONNECTED"?(0,ce.isNonNullable)(this.connection$.getValue())?"CONNECTED":"AVAILABLE":r)}))}initializeCastApi(){var r;let e,t,i;try{e=cast.framework.CastContext.getInstance(),t=chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,i=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}catch(a){return}try{e.setOptions({receiverApplicationId:(r=this.params.receiverApplicationId)!=null?r:t,autoJoinPolicy:i}),this.initListeners()}catch(a){this.errorEvent$.next({id:"ChromecastInitializer",category:ce.ErrorCategory.EXTERNAL_API,message:"[initializeCastApi] failed",thrown:a})}}},mE=s=>{switch(s){case cast.framework.CastState.NO_DEVICES_AVAILABLE:return"NOT_AVAILABLE";case cast.framework.CastState.NOT_CONNECTED:return"AVAILABLE";case cast.framework.CastState.CONNECTING:return"CONNECTING";case cast.framework.CastState.CONNECTED:return"CONNECTED";default:return(0,ce.assertNever)(s)}};var sp=K(_t(),1),wT=K(Sr(),1),PT=K(uc(),1);var tS=K(Ra(),1);var Wc=require("@vkontakte/videoplayer-shared/es2015");var _e=(s,e=0,t=0)=>{switch(t){case 0:return s.replace("_offset_p",e===0?"":"_"+e.toFixed(0));case 1:{if(e===0)return s;let i=new URL(s);return i.searchParams.append("playback_shift",e.toFixed(0)),i.toString()}case 2:{let i=new URL(s);return!i.searchParams.get("offset_p")&&e===0?s:(i.searchParams.set("offset_p",e.toFixed(0)),i.toString())}default:(0,Wc.assertNever)(t)}return s},Ji=(s,e)=>{var t;switch(e){case 0:return NaN;case 1:{let i=new URL(s);return Number(i.searchParams.get("playback_shift"))}case 2:{let i=new URL(s);return Number((t=i.searchParams.get("offset_p"))!=null?t:0)}default:(0,Wc.assertNever)(e)}};var O=(s,e,t=!1)=>{let i=s.getTransition();(t||!i||i.to===e)&&s.setState(e)};var pi=require("@vkontakte/videoplayer-shared/es2015"),se=class{constructor(e){this.transitionStarted$=new pi.Subject;this.transitionEnded$=new pi.Subject;this.transitionUpdated$=new pi.Subject;this.forceChanged$=new pi.Subject;this.stateChangeStarted$=(0,pi.merge)(this.transitionStarted$,this.transitionUpdated$);this.stateChangeEnded$=(0,pi.merge)(this.transitionEnded$,this.forceChanged$);this.state=e,this.prevState=void 0}setState(e){let t=this.transition,i=this.state;this.transition=void 0,this.prevState=i,this.state=e,t?t.to===e?this.transitionEnded$.next(t):this.forceChanged$.next({from:t.from,to:e,canceledTransition:t}):this.forceChanged$.next({from:i,to:e,canceledTransition:t})}startTransitionTo(e){let t=this.transition,i=this.state;i===e||(0,pi.isNonNullable)(t)&&t.to===e||(this.prevState=i,this.state=e,t?(this.transition={from:t.from,to:e,canceledTransition:t},this.transitionUpdated$.next(this.transition)):(this.transition={from:i,to:e},this.transitionStarted$.next(this.transition)))}getTransition(){return this.transition}getState(){return this.state}getPrevState(){return this.prevState}};var Jg=require("@vkontakte/videoplayer-shared/es2015"),Zg=s=>{switch(s){case"MPEG":case"DASH":case"DASH_SEP":case"DASH_ONDEMAND":case"DASH_WEBM":case"DASH_WEBM_AV1":case"DASH_STREAMS":case"HLS":case"HLS_ONDEMAND":return!1;case"DASH_LIVE":case"DASH_LIVE_CMAF":case"HLS_LIVE":case"HLS_LIVE_CMAF":case"DASH_LIVE_WEBM":case"WEB_RTC_LIVE":return!0;default:return(0,Jg.assertNever)(s)}};var X=require("@vkontakte/videoplayer-shared/es2015");var xR=5,ER=5,wR=500,eS=7e3,La=class{constructor(e){this.subscription=new X.Subscription;this.loadMediaTimeoutSubscription=new X.Subscription;this.videoState=new se("stopped");this.syncPlayback=()=>{let e=this.videoState.getState(),t=this.videoState.getTransition(),i=this.params.desiredState.playbackState.getState(),r=this.params.desiredState.playbackState.getTransition(),a=this.params.desiredState.seekState.getState();if(this.log({message:`[syncPlayback] videoState: ${e}; videoTransition: ${JSON.stringify(t)}; desiredPlaybackState: ${i}; desiredPlaybackStateTransition: ${this.params.desiredState.playbackState.getTransition()}; seekState: ${JSON.stringify(a)};`}),i==="stopped"){e!=="stopped"&&(this.videoState.startTransitionTo("stopped"),this.stop());return}if(!t){if((r==null?void 0:r.to)!=="paused"&&a.state==="requested"&&e!=="stopped"){this.seek(a.position/1e3);return}switch(i){case"ready":{switch(e){case"playing":case"paused":case"ready":break;case"stopped":this.videoState.startTransitionTo("ready"),this.prepare();break;default:(0,X.assertNever)(e)}break}case"playing":{switch(e){case"playing":break;case"paused":this.videoState.startTransitionTo("playing"),this.params.connection.remotePlayerController.playOrPause();break;case"ready":this.videoState.startTransitionTo("playing"),this.params.connection.remotePlayerController.playOrPause();break;case"stopped":this.videoState.startTransitionTo("ready"),this.prepare();break;default:(0,X.assertNever)(e)}break}case"paused":{switch(e){case"playing":this.videoState.startTransitionTo("paused"),this.params.connection.remotePlayerController.playOrPause();break;case"paused":break;case"ready":this.videoState.startTransitionTo("paused"),this.videoState.setState("paused");break;case"stopped":this.videoState.startTransitionTo("ready"),this.prepare();break;default:(0,X.assertNever)(e)}break}default:(0,X.assertNever)(i)}}};this.params=e,this.log=this.params.dependencies.logger.createComponentLog("ChromecastProvider"),this.log({message:`constructor, format: ${e.format}`}),this.params.output.isLive$.next(Zg(e.format)),this.params.output.isAudioAvailable$.next(!0),this.handleRemoteVolumeChange({volume:this.params.connection.remotePlayer.volumeLevel,muted:this.params.connection.remotePlayer.isMuted});let t=this.params.connection.session.getMediaSession();t&&this.restoreSession(t),this.subscribe()}destroy(){this.log({message:"[destroy]"}),this.subscription.unsubscribe()}subscribe(){this.subscription.add(this.loadMediaTimeoutSubscription);let e=new X.Subscription;this.subscription.add(e),this.subscription.add((0,X.merge)(this.videoState.stateChangeStarted$.pipe((0,X.map)(r=>`stateChangeStarted$ ${JSON.stringify(r)}`)),this.videoState.stateChangeEnded$.pipe((0,X.map)(r=>`stateChangeEnded$ ${JSON.stringify(r)}`))).subscribe(r=>this.log({message:`[videoState] ${r}`})));let t=(r,a)=>this.subscription.add(r.subscribe(a));if(this.params.output.isLive$.getValue())this.params.output.position$.next(0),this.params.output.duration$.next(0);else{let r=new X.Subject;e.add(r.pipe((0,X.debounce)(wR)).subscribe(()=>{this.params.output.seekedEvent$.next()}));let a=NaN;e.add((0,X.fromEvent)(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED).subscribe(n=>{this.logRemoteEvent(n);let o=n.value;this.params.output.position$.next(o),(this.params.desiredState.seekState.getState().state==="applying"||Math.abs(o-a)>xR)&&r.next(o),a=o})),e.add((0,X.fromEvent)(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.DURATION_CHANGED).subscribe(n=>{this.logRemoteEvent(n),this.params.output.duration$.next(n.value)}))}t((0,X.fromEvent)(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED),r=>{this.logRemoteEvent(r),r.value?this.handleRemoteReady():(this.handleRemoteStop(),e.unsubscribe())}),t((0,X.fromEvent)(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED),r=>{this.logRemoteEvent(r),r.value?this.handleRemotePause():this.handleRemotePlay()}),t((0,X.fromEvent)(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED),r=>{this.logRemoteEvent(r);let{remotePlayer:a}=this.params.connection,n=r.value,o=this.params.output.isBuffering$.getValue(),u=n===chrome.cast.media.PlayerState.BUFFERING;switch(o!==u&&this.params.output.isBuffering$.next(u),n){case chrome.cast.media.PlayerState.IDLE:!this.params.output.isLive$.getValue()&&a.duration-a.currentTime<ER&&this.params.output.endedEvent$.next(),this.handleRemoteStop(),O(this.params.desiredState.playbackState,"stopped");break;case chrome.cast.media.PlayerState.PAUSED:{this.handleRemotePause();break}case chrome.cast.media.PlayerState.PLAYING:this.handleRemotePlay();break;case chrome.cast.media.PlayerState.BUFFERING:break;default:(0,X.assertNever)(n)}}),t((0,X.fromEvent)(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.VOLUME_LEVEL_CHANGED),r=>{this.logRemoteEvent(r),this.handleRemoteVolumeChange({volume:r.value})}),t((0,X.fromEvent)(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.IS_MUTED_CHANGED),r=>{this.logRemoteEvent(r),this.handleRemoteVolumeChange({muted:r.value})});let i=(0,X.merge)(this.params.desiredState.playbackState.stateChangeStarted$,this.params.desiredState.seekState.stateChangeEnded$,this.videoState.stateChangeEnded$,(0,X.observableFrom)(["init"])).pipe((0,X.debounce)(0));t(i,this.syncPlayback)}restoreSession(e){this.log({message:"restoreSession"});let{remotePlayer:t}=this.params.connection;if(e.playerState!==chrome.cast.media.PlayerState.IDLE){t.isPaused?(this.videoState.setState("paused"),O(this.params.desiredState.playbackState,"paused")):(this.videoState.setState("playing"),O(this.params.desiredState.playbackState,"playing"));let i=this.params.output.isLive$.getValue();this.params.output.duration$.next(i?0:t.duration),this.params.output.position$.next(i?0:t.currentTime),this.params.desiredState.seekState.setState({state:"none"})}}prepare(){let e=this.params.format;this.log({message:`[prepare] format: ${e}`});let t=this.createMediaInfo(e),i=this.createLoadRequest(t);this.loadMedia(i)}handleRemotePause(){let e=this.videoState.getState(),t=this.videoState.getTransition();((t==null?void 0:t.to)==="paused"||e==="playing")&&(this.videoState.setState("paused"),O(this.params.desiredState.playbackState,"paused"))}handleRemotePlay(){let e=this.videoState.getState(),t=this.videoState.getTransition();((t==null?void 0:t.to)==="playing"||e==="paused")&&(this.videoState.setState("playing"),O(this.params.desiredState.playbackState,"playing"))}handleRemoteReady(){var t;let e=this.videoState.getTransition();(e==null?void 0:e.to)==="ready"&&this.videoState.setState("ready"),((t=this.params.desiredState.playbackState.getTransition())==null?void 0:t.to)==="ready"&&O(this.params.desiredState.playbackState,"ready")}handleRemoteStop(){this.videoState.getState()!=="stopped"&&this.videoState.setState("stopped")}handleRemoteVolumeChange(e){var r,a;let t=this.params.output.volume$.getValue(),i={volume:(r=e.volume)!=null?r:t.volume,muted:(a=e.muted)!=null?a:t.muted};(i.volume!==t.volume||i.muted!==i.muted)&&this.params.output.volume$.next(i)}seek(e){this.params.output.willSeekEvent$.next();let{remotePlayer:t,remotePlayerController:i}=this.params.connection;t.currentTime=e,i.seek()}stop(){let{remotePlayerController:e}=this.params.connection;e.stop()}createMediaInfo(e){var l;let t=this.params.source,i,r,a;switch(e){case"MPEG":{let d=t[e];(0,X.assertNonNullable)(d);let c=(0,X.getHighestQuality)(Object.keys(d));(0,X.assertNonNullable)(c);let h=d[c];(0,X.assertNonNullable)(h),i=h,r="video/mp4",a=chrome.cast.media.StreamType.BUFFERED;break}case"HLS":case"HLS_ONDEMAND":{let d=t[e];(0,X.assertNonNullable)(d),i=d.url,r="application/x-mpegurl",a=chrome.cast.media.StreamType.BUFFERED;break}case"DASH_SEP":case"DASH_ONDEMAND":case"DASH_WEBM":case"DASH_WEBM_AV1":case"DASH_STREAMS":{let d=t[e];(0,X.assertNonNullable)(d),i=d.url,r="application/dash+xml",a=chrome.cast.media.StreamType.BUFFERED;break}case"DASH_LIVE_CMAF":{let d=t[e];(0,X.assertNonNullable)(d),i=d.url,r="application/dash+xml",a=chrome.cast.media.StreamType.LIVE;break}case"HLS_LIVE":case"HLS_LIVE_CMAF":{let d=t[e];(0,X.assertNonNullable)(d),i=_e(d.url),r="application/x-mpegurl",a=chrome.cast.media.StreamType.LIVE;break}case"DASH_LIVE":case"WEB_RTC_LIVE":{let d="Unsupported format for Chromecast",c=new Error(d);throw this.params.output.error$.next({id:"ChromecastProvider.createMediaInfo()",category:X.ErrorCategory.VIDEO_PIPELINE,message:d,thrown:c}),c}case"DASH":case"DASH_LIVE_WEBM":throw new Error(`${e} is no longer supported`);default:return(0,X.assertNever)(e)}let n=new chrome.cast.media.MediaInfo((l=this.params.meta.videoId)!=null?l:i,r);n.contentUrl=i,n.streamType=a,n.metadata=new chrome.cast.media.GenericMediaMetadata;let{title:o,subtitle:u}=this.params.meta;return(0,X.isNonNullable)(o)&&(n.metadata.title=o),(0,X.isNonNullable)(u)&&(n.metadata.subtitle=u),n}createLoadRequest(e){let t=new chrome.cast.media.LoadRequest(e);t.autoplay=!1;let i=this.params.desiredState.seekState.getState();return i.state==="applying"||i.state==="requested"?t.currentTime=this.params.output.isLive$.getValue()?0:i.position/1e3:t.currentTime=0,t}loadMedia(e){let t=this.params.connection.session.loadMedia(e),i=new Promise((r,a)=>{this.loadMediaTimeoutSubscription.add((0,X.timeout)(eS).subscribe(()=>a(`timeout(${eS})`)))});(0,tS.default)(Promise.race([t,i]).then(()=>{this.log({message:`[loadMedia] completed, format: ${this.params.format}`}),this.params.desiredState.seekState.getState().state==="applying"&&this.params.output.seekedEvent$.next(),this.handleRemoteReady()},r=>{let a=`[prepare] loadMedia failed, format: ${this.params.format}, reason: ${r}`;this.log({message:a}),this.params.output.error$.next({id:"ChromecastProvider.loadMedia",category:X.ErrorCategory.VIDEO_PIPELINE,message:a,thrown:r})}),()=>{this.loadMediaTimeoutSubscription.unsubscribe()})}logRemoteEvent(e){this.log({message:`[remoteEvent] ${JSON.stringify(e)}`})}};var cd=K(_t(),1);var Jc=require("@vkontakte/videoplayer-shared/es2015");var iS=require("@vkontakte/videoplayer-shared/es2015"),rS=s=>{try{s.pause(),s.playbackRate=0,(0,iS.clearVideoElement)(s),s.remove()}catch(e){console.error(e)}};var Qo=require("@vkontakte/videoplayer-shared/es2015"),Yc=class{constructor(){this.attribute="data-pool-reused"}get(e){return e.hasAttribute(this.attribute)}set(e,t){e.toggleAttribute(this.attribute,t)}delete(e){e.removeAttribute(this.attribute)}},Kc=window.WeakMap?new WeakMap:new Yc,Xc=window.WeakMap?new WeakMap:new Map,PR=(s,e=20)=>{let t=0;return(0,Qo.fromEvent)(s,"ratechange").subscribe(i=>{t++,t>=e&&(s.currentTime=s.currentTime,t=0)})},nt=(s,{audioVideoSyncRate:e,disableYandexPiP:t})=>{let i=s.querySelector("video"),r=!!i;i?(0,Jc.clearVideoElement)(i):(i=document.createElement("video"),s.appendChild(i)),Kc.set(i,r);let a=new Qo.Subscription;return a.add(PR(i,e)),Xc.set(i,a),i.setAttribute("crossorigin","anonymous"),i.setAttribute("playsinline","playsinline"),t&&i.setAttribute("x-yandex-pip","false"),i.controls=!1,i.setAttribute("poster","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),i},ot=s=>{let e=Xc.get(s);e==null||e.unsubscribe(),Xc.delete(s);let t=Kc.get(s);Kc.delete(s),t?(0,Jc.clearVideoElement)(s):rS(s)};var Zc=K(Er(),1),J=require("@vkontakte/videoplayer-shared/es2015");var Zi=require("@vkontakte/videoplayer-shared/es2015"),Wo=(s,e,t,{equal:i=(n,o)=>n===o,changed$:r,onError:a}={})=>{let n=s.getState(),o=e(),u=(0,Zi.isNullable)(r),l=new Zi.Subscription;return r&&l.add(r.subscribe(d=>{let c=s.getState();i(d,c)&&s.setState(d)},a)),i(o,n)||(t(n),u&&s.setState(n)),l.add(s.stateChangeStarted$.subscribe(d=>{t(d.to),u&&s.setState(d.to)},a)),l},jt=(s,e,t)=>Wo(e,()=>s.loop,i=>{(0,Zi.isNonNullable)(i)&&(s.loop=i)},{onError:t}),ut=(s,e,t,i)=>Wo(e,()=>({muted:s.muted,volume:s.volume}),r=>{(0,Zi.isNonNullable)(r)&&(s.muted=r.muted,s.volume=r.volume)},{equal:(r,a)=>r===a||(r==null?void 0:r.muted)===(a==null?void 0:a.muted)&&(r==null?void 0:r.volume)===(a==null?void 0:a.volume),changed$:t,onError:i}),Et=(s,e,t,i)=>Wo(e,()=>s.playbackRate,r=>{(0,Zi.isNonNullable)(r)&&(s.playbackRate=r)},{changed$:t,onError:i}),er=Wo;var $R=s=>["__",s.language,s.label].join("|"),BR=(s,e)=>{if(s.id===e)return!0;let[t,i,r]=e.split("|");return s.language===i&&s.label===r},ed=class s{constructor(e){this.available$=new J.Subject;this.current$=new J.ValueSubject(void 0);this.error$=new J.Subject;this.subscription=new J.Subscription;this.externalTracks=new Map;this.internalTracks=new Map;this.baseURL=e}connect(e,t,i){this.video=e,this.cueSettings=t.textTrackCuesSettings,this.subscribe();let r=a=>{this.error$.next({id:"TextTracksManager",category:J.ErrorCategory.WTF,message:"Generic HtmlVideoTextTrackManager error",thrown:a})};this.subscription.add(this.available$.subscribe(i.availableTextTracks$)),this.subscription.add(this.current$.subscribe(i.currentTextTrack$)),this.subscription.add(this.error$.subscribe(i.error$)),this.subscription.add(er(t.internalTextTracks,()=>(0,Zc.default)(this.internalTracks),a=>{(0,J.isNonNullable)(a)&&this.setInternal(a)},{equal:(a,n)=>(0,J.isNonNullable)(a)&&(0,J.isNonNullable)(n)&&a.length===n.length&&a.every(({id:o},u)=>o===n[u].id),changed$:this.available$.pipe((0,J.map)(a=>a.filter(({type:n})=>n==="internal"))),onError:r})),this.subscription.add(er(t.externalTextTracks,()=>(0,Zc.default)(this.externalTracks),a=>{(0,J.isNonNullable)(a)&&this.setExternal(a)},{equal:(a,n)=>(0,J.isNonNullable)(a)&&(0,J.isNonNullable)(n)&&a.length===n.length&&a.every(({id:o},u)=>o===n[u].id),changed$:this.available$.pipe((0,J.map)(a=>a.filter(({type:n})=>n==="external"))),onError:r})),this.subscription.add(er(t.currentTextTrack,()=>{if(this.video)return;let a=this.htmlTextTracksAsArray().find(({mode:n})=>n==="showing");return a&&this.htmlTextTrackToITextTrack(a).id},a=>this.select(a),{changed$:this.current$,onError:r})),this.subscription.add(er(t.textTrackCuesSettings,()=>({}),()=>{if(this.video)for(let a of this.htmlTextTracksAsArray())this.applyCueSettings(a.cues),this.applyCueSettings(a.activeCues)}))}subscribe(){(0,J.assertNonNullable)(this.video);let{textTracks:e}=this.video;this.subscription.add((0,J.fromEvent)(e,"addtrack").subscribe(()=>{let i=this.current$.getValue();i&&this.select(i)})),this.subscription.add((0,J.merge)((0,J.fromEvent)(e,"addtrack"),(0,J.fromEvent)(e,"removetrack"),(0,J.observableFrom)(["init"])).pipe((0,J.map)(()=>this.htmlTextTracksAsArray().map(i=>this.htmlTextTrackToITextTrack(i))),(0,J.filterChanged)((i,r)=>i.length===r.length&&i.every(({id:a},n)=>a===r[n].id))).subscribe(this.available$)),this.subscription.add((0,J.merge)((0,J.fromEvent)(e,"change"),(0,J.observableFrom)(["init"])).pipe((0,J.map)(()=>this.htmlTextTracksAsArray().find(({mode:i})=>i==="showing")),(0,J.map)(i=>i&&this.htmlTextTrackToITextTrack(i).id),(0,J.filterChanged)()).subscribe(this.current$));let t=i=>{var r,a;return this.applyCueSettings((a=(r=i.target)==null?void 0:r.activeCues)!=null?a:null)};this.subscription.add((0,J.fromEvent)(e,"addtrack").subscribe(i=>{var a,n;(a=i.track)==null||a.addEventListener("cuechange",t);let r=o=>{var l,d,c,h,p;let u=(d=(l=o.target)==null?void 0:l.cues)!=null?d:null;u&&u.length&&(this.applyCueSettings((h=(c=o.target)==null?void 0:c.cues)!=null?h:null),(p=o.target)==null||p.removeEventListener("cuechange",r))};(n=i.track)==null||n.addEventListener("cuechange",r)})),this.subscription.add((0,J.fromEvent)(e,"removetrack").subscribe(i=>{var r;(r=i.track)==null||r.removeEventListener("cuechange",t)}))}applyCueSettings(e){if(!e||!e.length)return;let t=this.cueSettings.getState();for(let i of Array.from(e)){let r=i;(0,J.isNonNullable)(t.align)&&(r.align=t.align),(0,J.isNonNullable)(t.position)&&(r.position=t.position),(0,J.isNonNullable)(t.size)&&(r.size=t.size),(0,J.isNonNullable)(t.line)&&(r.line=t.line)}}htmlTextTracksAsArray(e=!1){(0,J.assertNonNullable)(this.video);let t=[...this.video.textTracks];return e?t:t.filter(s.isHealthyTrack)}htmlTextTrackToITextTrack(e){var o,u,l,d,c;let{language:t,label:i}=e,r=e.id?e.id:$R(e),a=this.externalTracks.has(r),n=(l=a?(o=this.externalTracks.get(r))==null?void 0:o.isAuto:(u=this.internalTracks.get(r))==null?void 0:u.isAuto)!=null?l:r.includes("auto");return a?{id:r,type:"external",isAuto:n,language:t,label:i,url:(d=this.externalTracks.get(r))==null?void 0:d.url}:{id:r,type:"internal",isAuto:n,language:t,label:i,url:(c=this.internalTracks.get(r))==null?void 0:c.url}}static isHealthyTrack(e){return!(e.kind==="metadata"||e.groupId||e.id===""&&e.label===""&&e.language==="")}setExternal(e){this.internalTracks.size>0&&Array.from(this.internalTracks).forEach(([,t])=>this.detach(t)),e.filter(({id:t})=>!this.externalTracks.has(t)).forEach(t=>this.attach(t)),Array.from(this.externalTracks).filter(([t])=>!e.find(i=>i.id===t)).forEach(([,t])=>this.detach(t))}setInternal(e){let t=[...this.externalTracks];e.filter(({id:i,language:r,isAuto:a})=>!this.internalTracks.has(i)&&!t.some(([,n])=>n.language===r&&n.isAuto===a)).forEach(i=>this.attach(i)),Array.from(this.internalTracks).filter(([i])=>!e.find(r=>r.id===i)).forEach(([,i])=>this.detach(i))}select(e){(0,J.assertNonNullable)(this.video);for(let t of this.htmlTextTracksAsArray(!0))t.mode="showing";for(let t of this.htmlTextTracksAsArray(!0))((0,J.isNullable)(e)||!BR(t,e))&&(t.mode="disabled")}destroy(){if(this.subscription.unsubscribe(),this.video)for(let e of Array.from(this.video.getElementsByTagName("track"))){let t=e.getAttribute("id");t&&this.externalTracks.has(t)&&this.video.removeChild(e)}this.externalTracks.clear()}attach(e){(0,J.assertNonNullable)(this.video);let t=document.createElement("track");this.baseURL?t.setAttribute("src",new URL(e.url,this.baseURL).toString()):t.setAttribute("src",e.url),t.setAttribute("id",e.id),e.label&&t.setAttribute("label",e.label),e.language&&t.setAttribute("srclang",e.language),e.type==="external"?this.externalTracks.set(e.id,e):e.type==="internal"&&this.internalTracks.set(e.id,e),this.video.appendChild(t)}detach(e){(0,J.assertNonNullable)(this.video);let t=Array.prototype.find.call(this.video.getElementsByTagName("track"),i=>i.getAttribute("id")===e.id);t&&this.video.removeChild(t),e.type==="external"?this.externalTracks.delete(e.id):e.type==="internal"&&this.internalTracks.delete(e.id)}},wt=ed;var wr=class{constructor(){this.pausedTime=0;this.streamOffset=0;this.pauseTimestamp=0}getTotalPausedTime(){return this.pausedTime+this.getCurrentPausedTime()}getCurrentPausedTime(){return this.pauseTimestamp>0?Date.now()-this.pauseTimestamp:0}getStreamOffset(){return this.streamOffset}getTotalOffset(){return this.getTotalPausedTime()+this.streamOffset}pause(){this.pauseTimestamp===0&&(this.pauseTimestamp=Date.now())}resume(){this.pauseTimestamp>0&&(this.pausedTime+=this.getCurrentPausedTime(),this.pauseTimestamp=0)}resetTo(e,t=!1){this.streamOffset=e,this.pauseTimestamp=0,this.pausedTime=0,t&&this.pause()}};var cS=s=>{let e=s;for(;!(e instanceof Document)&&!(e instanceof ShadowRoot)&&e!==null;)e=e==null?void 0:e.parentNode;return e!=null?e:void 0},td=s=>{let e=cS(s);return!!(e&&e.fullscreenElement&&e.fullscreenElement===s)},dS=s=>{let e=cS(s);return!!(e&&e.pictureInPictureElement&&e.pictureInPictureElement===s)};var q=require("@vkontakte/videoplayer-shared/es2015");var DR=3,pS=(s,e,t=DR)=>{let i=0,r=0;for(let a=0;a<s.length;a++){let n=s.start(a),o=s.end(a);if(n<=e&&e<=o){if(i=n,r=o,!t)return{from:i,to:r};for(let u=a-1;u>=0;u--)s.end(u)+t>=i&&(i=s.start(u));for(let u=a+1;u<s.length;u++)s.start(u)-t<=r&&(r=s.end(u))}}return{from:i,to:r}};var Yo=class{constructor(){this._isMiuiBrowser=!1}get current(){return this._current}get isYandex(){return this.current==="Yandex"}get isSafari(){return this.current==="Safari"}get isFirefox(){return this.current==="Firefox"}get isSamsungBrowser(){return this.current==="SamsungBrowser"}get safariVersion(){return this._safariVersion}get isMiuiBrowser(){return this._isMiuiBrowser}detect(){let{userAgent:e}=navigator;try{let t=/yabrowser/i.test(e)?"Yandex":void 0,i=/samsungbrowser/i.test(e)?"SamsungBrowser":void 0,r=/chrome|crios/i.test(e)?"Chrome":void 0,a=/chromium/i.test(e)?"Chromium":void 0,n=/firefox|fxios/i.test(e)?"Firefox":void 0,o=/webkit|safari|khtml/i.test(e)?"Safari":void 0,u=/opr\//i.test(e)?"Opera":void 0,l=/edg/i.test(e)?"Edge":void 0;this._isMiuiBrowser=/(XiaoMi)|(MiuiBrowser)/i.test(e),this._current=t||i||n||u||l||r||a||o||"Rest"}catch(t){console.error(t)}this.isSafari&&this.detectSafariVersion()}detectSafariVersion(){try{let{userAgent:e}=window.navigator,t=e.match(/Version\/(\d+)/);if(!t)return;let i=t[1],r=parseInt(i,10);if(isNaN(r))return;this._safariVersion=r}catch(e){console.error(e)}}};var hS=K(_t(),1);var Zr=()=>{var s,e;return/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test((s=navigator.appVersion)!=null?s:navigator.userAgent)||((e=navigator==null?void 0:navigator.userAgentData)==null?void 0:e.mobile)};var Ko=class{constructor(e){this._highEntropyValues={};this._displayChecker=e}get current(){return this._current}get isIOS(){let e=["iPhone","iPad","iPod"];return this._highEntropyValues.platform==="iOS"||(0,hS.default)(e,this.current)}get isMac(){return this._highEntropyValues.platform==="macOS"||this.current==="Mac"}get isApple(){return this.isIOS||this.isMac}get isIphoneOrOldIpad(){if(!this.isApple||!this._displayChecker.isTouch)return!1;let e=this.current==="iPad"||this._displayChecker.width>700,t=this._iosVersion;return!e||e&&!!t&&t<16}get isAndroid(){return this._highEntropyValues.platform==="Android"||this.current==="Android"}get isMobile(){return this._highEntropyValues.mobile||this._isMobile}get iOSVersion(){return this._iosVersion}detect(){let{userAgent:e}=navigator;try{this._isMobile=Zr()}catch(t){console.error(t)}this.detectDevice(e),this.detectHighEntropyValues(),this.isIOS&&this.detectIOSVersion()}detectHighEntropyValues(){return A(this,null,function*(){let{userAgentData:e}=navigator;if(e!=null&&e.getHighEntropyValues){let t=yield e.getHighEntropyValues(["architecture","bitness","brands","mobile","platform","formFactor","model","platformVersion","wow64"]);this._highEntropyValues=t}})}detectDevice(e){try{let t=/android/i.test(e)?"Android":void 0,i=/iphone/i.test(e)?"iPhone":void 0,r=/ipad/i.test(e)?"iPad":void 0,a=/ipod/i.test(e)?"iPod":void 0,n=/mac/i.test(e)?"Mac":void 0,o=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?"RestMobile":void 0;this._current=t||i||r||a||o||n||"Desktop"}catch(t){console.error(t)}}detectIOSVersion(){try{if(this._highEntropyValues.platformVersion){let a=this._highEntropyValues.platformVersion.split(".").slice(0,2).join("."),n=parseFloat(a);this._iosVersion=n;return}let{userAgent:e}=window.navigator,t=e.match(/OS (\d+(_\d+)?)/i);if(!t)return;let i=t[1].replace(/_/g,".");if(!i)return;let r=parseFloat(i);if(isNaN(r))return;this._iosVersion=r}catch(e){console.error(e)}}};var Xo=class{get isTouch(){return typeof this._maxTouchPoints=="number"?this._maxTouchPoints>1:"ontouchstart"in window}get maxTouchPoints(){return this._maxTouchPoints}get height(){return this._height}get width(){return this._width}get screenHeight(){return this._screenHeight}get screenWidth(){return this._screenWidth}get pixelRatio(){return this._pixelRatio}get isHDR(){return this._isHdr}get colorDepth(){return this._colorDepth}detect(){var t;let{maxTouchPoints:e}=navigator;try{this._maxTouchPoints=e!=null?e:0,this._isHdr=!!((t=matchMedia("(dynamic-range: high)"))!=null&&t.matches),this._colorDepth=screen.colorDepth}catch(i){console.error(i)}try{this._pixelRatio=window.devicePixelRatio||1,this._height=screen.height,this._width=screen.width,this._height=screen.height,this._screenHeight=this._height*this._pixelRatio,this._screenWidth=this._width*this._pixelRatio}catch(i){console.error(i)}}};var Nt=()=>window.ManagedMediaSource||window.MediaSource,es=()=>{var s,e;return!!(window.ManagedMediaSource&&((e=(s=window.ManagedSourceBuffer)==null?void 0:s.prototype)!=null&&e.appendBuffer))},fS=()=>{var s,e;return!!(window.MediaSource&&((e=(s=window.SourceBuffer)==null?void 0:s.prototype)!=null&&e.appendBuffer))},Jo=()=>window.ManagedMediaSource?new ManagedMediaSource:new MediaSource;var CR=document.createElement("video"),VR='video/mp4; codecs="avc1.42000a,mp4a.40.2"',OR='video/mp4; codecs="hev1.1.6.L93.B0"',mS='video/webm; codecs="vp09.00.10.08"',bS='video/webm; codecs="av01.0.00M.08"',_R='audio/mp4; codecs="mp4a.40.2"',FR='audio/webm; codecs="opus"',gS,NR=()=>A(void 0,null,function*(){if(!window.navigator.mediaCapabilities)return;let s={type:"media-source",video:{contentType:"video/webm",width:1280,height:720,bitrate:1e6,framerate:30}},[e,t]=yield Promise.all([window.navigator.mediaCapabilities.decodingInfo(N(k({},s),{video:N(k({},s.video),{contentType:bS})})),window.navigator.mediaCapabilities.decodingInfo(N(k({},s),{video:N(k({},s.video),{contentType:mS})}))]);gS={DASH_WEBM_AV1:e,DASH_WEBM:t}});NR().catch(s=>{console.log(CR),console.error(s)});var Zo=class{constructor(e,t){this._deviceChecker=e,this._browserChecker=t}get protocols(){return this._protocols}get containers(){return this._containers}get codecs(){return this._codecs}get webmDecodingInfo(){return gS}get supportedCodecs(){return Object.keys(this._codecs).filter(e=>this._codecs[e])}get nativeHlsSupported(){return this._nativeHlsSupported}detect(){var e,t,i,r,a,n,o,u,l,d,c,h,p,f,b,S,v,y,x,w;this._video=document.createElement("video");try{this._protocols={mms:es(),mse:fS(),hls:!!((t=(e=this._video).canPlayType)!=null&&t.call(e,"application/x-mpegurl")||(r=(i=this._video).canPlayType)!=null&&r.call(i,"vnd.apple.mpegURL")),webrtc:!!window.RTCPeerConnection,ws:!!window.WebSocket},this._containers={mp4:!!((n=(a=this._video).canPlayType)!=null&&n.call(a,"video/mp4")),webm:!!((u=(o=this._video).canPlayType)!=null&&u.call(o,"video/webm")),cmaf:!0};let P=!!((d=(l=Nt())==null?void 0:l.isTypeSupported)!=null&&d.call(l,VR)),D=!!((h=(c=Nt())==null?void 0:c.isTypeSupported)!=null&&h.call(c,OR)),H=!!((f=(p=Nt())==null?void 0:p.isTypeSupported)!=null&&f.call(p,_R));this._codecs={h264:P,h265:D,vp9:!!((S=(b=Nt())==null?void 0:b.isTypeSupported)!=null&&S.call(b,mS)),av1:!!((y=(v=Nt())==null?void 0:v.isTypeSupported)!=null&&y.call(v,bS)),aac:H,opus:!!((w=(x=Nt())==null?void 0:x.isTypeSupported)!=null&&w.call(x,FR)),mpeg:(P||D)&&H},this._nativeHlsSupported=this._protocols.hls&&this._containers.mp4}catch(P){console.error(P)}this.destroyVideoElement()}destroyVideoElement(){var t;if(!this._video)return;if(this._video.pause(),this._video.currentTime=0,this._video.removeAttribute("src"),this._video.src="",this._video.load(),this._video.remove){this._video.remove(),this._video=null;return}this._video.parentNode&&this._video.parentNode.removeChild(this._video);let e=this._video.cloneNode(!1);(t=this._video.parentNode)==null||t.replaceChild(e,this._video),this._video=null}};var SS="audio/mpeg",eu=class{supportMp3(){return this._codecs.mp3&&this._containers.mpeg}detect(){var e,t,i,r;this._audio=document.createElement("audio");try{this._containers={mpeg:!!((t=(e=this._audio).canPlayType)!=null&&t.call(e,SS))},this._codecs={mp3:!!((r=(i=Nt())==null?void 0:i.isTypeSupported)!=null&&r.call(i,SS))}}catch(a){console.error(a)}this.destroyAudioElement()}destroyAudioElement(){var t;if(!this._audio)return;if(this._audio.pause(),this._audio.currentTime=0,this._audio.removeAttribute("src"),this._audio.src="",this._audio.load(),this._audio.remove){this._audio.remove(),this._audio=null;return}this._audio.parentNode&&this._audio.parentNode.removeChild(this._audio);let e=this._audio.cloneNode(!1);(t=this._audio.parentNode)==null||t.replaceChild(e,this._audio),this._audio=null}};var vS=require("@vkontakte/videoplayer-shared/es2015");var id=class{constructor(){this.isInited$=new vS.ValueSubject(!1);this._displayChecker=new Xo,this._deviceChecker=new Ko(this._displayChecker),this._browserChecker=new Yo,this._videoChecker=new Zo(this._deviceChecker,this._browserChecker),this._audioChecker=new eu,this.detect()}get display(){return this._displayChecker}get device(){return this._deviceChecker}get browser(){return this._browserChecker}get video(){return this._videoChecker}get audio(){return this._audioChecker}detect(){return A(this,null,function*(){this._displayChecker.detect(),this._deviceChecker.detect(),this._browserChecker.detect(),this._videoChecker.detect(),this._audioChecker.detect(),this.isInited$.next(!0)})}},ee=new id;var lt=s=>{let e=L=>(0,q.fromEvent)(s,L).pipe((0,q.mapTo)(void 0)),t=new q.Subscription,i=()=>t.unsubscribe(),r=(0,q.merge)((0,q.fromEvent)(s,"progress"),(0,q.fromEvent)(s,"timeupdate")).pipe((0,q.map)(()=>pS(s.buffered,s.currentTime))),a=ee.browser.isSafari?(0,q.combine)({play:e("play").pipe((0,q.once)()),playing:e("playing")}).pipe((0,q.mapTo)(void 0)):e("playing"),n=(0,q.fromEvent)(s,"volumechange").pipe((0,q.map)(()=>({muted:s.muted,volume:s.volume}))),o=(0,q.fromEvent)(s,"ratechange").pipe((0,q.map)(()=>s.playbackRate)),u=(0,q.fromEvent)(s,"error").pipe((0,q.filter)(()=>!!(s.error||s.played.length)),(0,q.map)(()=>{var z;let L=s.error;return{id:L?`MediaError#${L.code}`:"HtmlVideoError",category:q.ErrorCategory.VIDEO_PIPELINE,message:L?L.message:"Error event from HTML video element",thrown:(z=s.error)!=null?z:void 0}})),l=(0,q.fromEvent)(s,"timeupdate").pipe((0,q.map)(()=>s.currentTime)),d=["waiting","seeking","seeked","timeupdate"],c=new q.Subject,h=.3,p;t.add((0,q.merge)(...d.map(L=>(0,q.fromEvent)(s,L))).subscribe(L=>{let z=s.currentTime;s.loop&&(0,q.isNonNullable)(p)&&(0,q.isNonNullable)(z)&&p>=s.duration-h&&z<=h&&c.next(p),p=z}));let f=e("pause").pipe((0,q.filter)(()=>!s.error&&p!==s.duration)),b=(0,q.fromEvent)(s,"enterpictureinpicture"),S=(0,q.fromEvent)(s,"leavepictureinpicture"),v=new q.ValueSubject(dS(s));t.add(b.subscribe(()=>v.next(!0))),t.add(S.subscribe(()=>v.next(!1)));let y=new q.ValueSubject(td(s)),x=(0,q.fromEvent)(s,"fullscreenchange");t.add(x.pipe((0,q.map)(()=>td(s))).subscribe(y));let w=.1,P=1e3,D=(0,q.fromEvent)(s,"timeupdate").pipe((0,q.map)(L=>s.duration-s.currentTime<w),(0,q.filterChanged)()),H=(0,q.merge)(D.pipe((0,q.filter)(L=>!s.loop&&L)),(0,q.fromEvent)(s,"ended")).pipe((0,q.throttle)(P),(0,q.mapTo)(void 0)),U=(0,q.merge)(...["waiting","pause","canplay","play","canplaythrough","playing","seeking","seeked","ended"].map(L=>(0,q.fromEvent)(s,L)),D.pipe((0,q.map)(L=>({type:L?"ended":"unknown"})))).pipe((0,q.map)(L=>ee.browser.isFirefox&&L.type==="ended"?s.readyState<2:s.readyState<3),(0,q.filterChanged)());return{playing$:a,pause$:f,canplay$:e("canplay"),ended$:H,looped$:c,error$:u,seeked$:e("seeked"),seeking$:e("seeking"),progress$:e("progress"),loadStart$:e("loadstart"),loadedMetadata$:e("loadedmetadata"),loadedData$:e("loadeddata"),timeUpdate$:l,durationChange$:(0,q.fromEvent)(s,"durationchange").pipe((0,q.map)(()=>s.duration)),isBuffering$:U,currentBuffer$:r,volumeState$:n,playbackRateState$:o,inPiP$:v,inFullscreen$:y,enterPip$:b,leavePip$:S,destroy:i}};var Ci=require("@vkontakte/videoplayer-shared/es2015"),fi=s=>{switch(s){case"mobile":return Ci.VideoQuality.Q_144P;case"lowest":return Ci.VideoQuality.Q_240P;case"low":return Ci.VideoQuality.Q_360P;case"sd":case"medium":return Ci.VideoQuality.Q_480P;case"hd":case"high":return Ci.VideoQuality.Q_720P;case"fullhd":case"full":return Ci.VideoQuality.Q_1080P;case"quadhd":case"quad":return Ci.VideoQuality.Q_1440P;case"ultrahd":case"ultra":return Ci.VideoQuality.Q_2160P}};var Tt=K(si(),1),ad=K(_t(),1),Pr=K(Sr(),1),C=require("@vkontakte/videoplayer-shared/es2015");var rd=!1,Vi={},PS=s=>{rd=s},AS=()=>{Vi={}},kS=s=>{s(Vi)},Ma=(s,e)=>{var t;rd&&(Vi.meta=(t=Vi.meta)!=null?t:{},Vi.meta[s]=e)},yt=class{constructor(e){this.name=e}next(e){var i,r;if(!rd)return;Vi.series=(i=Vi.series)!=null?i:{};let t=(r=Vi.series[this.name])!=null?r:[];t.push([Date.now(),e]),Vi.series[this.name]=t}};var Ge=require("@vkontakte/videoplayer-shared/es2015");function sd(s,e,t){return!s.max&&s.min===e?"high_quality":!s.min&&s.max===t?"traffic_saving":"unknown"}function tu(s,e,t){return!!s&&sd(s,e,t)==="high_quality"}function ts(s,e,t){return(0,Ge.isNullable)(s)||(0,Ge.isNonNullable)(s.min)&&(0,Ge.isNonNullable)(s.max)&&(0,Ge.isLower)(s.max,s.min)||(0,Ge.isNonNullable)(s.min)&&e&&(0,Ge.isHigher)(s.min,e)||(0,Ge.isNonNullable)(s.max)&&t&&(0,Ge.isLower)(s.max,t)}function RS({limits:s,highestAvailableHeight:e,lowestAvailableHeight:t}){return ts({max:s!=null&&s.max?(0,Ge.videoHeightToQuality)(s.max):void 0,min:s!=null&&s.min?(0,Ge.videoHeightToQuality)(s.min):void 0},e?(0,Ge.videoHeightToQuality)(e):void 0,t?(0,Ge.videoHeightToQuality)(t):void 0)}var DS=new yt("best_bitrate"),ru=(s,e,t)=>(e-t)*Math.pow(2,-10*s)+t;var is=s=>(e,t)=>s*(Number(e.bitrate)-Number(t.bitrate)),tr=class{constructor(){this.history={}}recordSelection(e){this.history[e.id]=(0,C.now)()}recordSwitch(e){this.last=e}clear(){this.last=void 0,this.history={}}},su='Assertion "ABR Tracks is empty array" failed',iu=new WeakMap,LS=new WeakMap,MS=new WeakMap,$a=(s,e,t,i)=>{var u;let r=[...e].sort(is(1)),a=[...t].sort(is(1)),n=a.filter(l=>(0,C.isNonNullable)(l.bitrate)&&(0,C.isNonNullable)(s.bitrate)?s.bitrate/l.bitrate>i:!0),o=(u=(0,Tt.default)(a,Math.round(a.length*r.indexOf(s)/(r.length+1))))!=null?u:(0,Tt.default)(a,-1);return o&&(0,ad.default)(n,o)?o:n.length?(0,Tt.default)(n,-1):(0,Tt.default)(a,0)},Ba=(s,e,t,i)=>{var u;let r=iu.get(e);r||(r=[...e].sort(is(1)),iu.set(e,r));let a=iu.get(t);a||(a=[...t].sort(is(1)),iu.set(t,a));let n=MS.get(s);n||(n=a.filter(l=>(0,C.isNonNullable)(l.bitrate)&&(0,C.isNonNullable)(s.bitrate)?s.bitrate/l.bitrate>i:!0),MS.set(s,n));let o=(u=(0,Tt.default)(a,Math.round(a.length*r.indexOf(s)/(r.length+1))))!=null?u:(0,Tt.default)(a,-1);return o&&(0,ad.default)(n,o)?o:n.length?(0,Tt.default)(n,-1):(0,Tt.default)(a,0)},$S=s=>"quality"in s,au=(s,e,t,i)=>{var n;let r=(0,C.isNonNullable)((n=i==null?void 0:i.last)==null?void 0:n.bitrate)&&(0,C.isNonNullable)(t==null?void 0:t.bitrate)&&i.last.bitrate<t.bitrate?s.trackCooldownIncreaseQuality:s.trackCooldownDecreaseQuality,a=t&&i&&i.history[t.id]&&(0,C.now)()-i.history[t.id]<=r&&(!i.last||t.id!==i.last.id);if(t!=null&&t.id&&i&&!a&&i.recordSelection(t),a&&(i!=null&&i.last)){let o=i.last;i==null||i.recordSwitch(o);let u=$S(o)?"video":"audio",l=$S(o)?o.quality:o.bitrate;return e({message:`
7
+ \v\f\r \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF`});var bv=g((L_,mv)=>{"use strict";var RL=Ze(),LL=Yi(),ML=qa(),md=hd(),fv=RL("".replace),$L=RegExp("^["+md+"]+"),BL=RegExp("(^|[^"+md+"])["+md+"]+$"),fd=function(s){return function(e){var t=ML(LL(e));return s&1&&(t=fv(t,$L,"")),s&2&&(t=fv(t,BL,"$1")),t}};mv.exports={start:fd(1),end:fd(2),trim:fd(3)}});var yv=g((M_,vv)=>{"use strict";var DL=Ql().PROPER,CL=st(),gv=hd(),Sv="\u200B\x85\u180E";vv.exports=function(s){return CL(function(){return!!gv[s]()||Sv[s]()!==Sv||DL&&gv[s].name!==s})}});var bd=g(($_,Tv)=>{"use strict";var VL=bv().start,OL=yv();Tv.exports=OL("trimStart")?function(){return VL(this)}:"".trimStart});var xv=g(()=>{"use strict";var _L=je(),Iv=bd();_L({target:"String",proto:!0,name:"trimStart",forced:"".trimLeft!==Iv},{trimLeft:Iv})});var wv=g(()=>{"use strict";xv();var FL=je(),Ev=bd();FL({target:"String",proto:!0,name:"trimStart",forced:"".trimStart!==Ev},{trimStart:Ev})});var Av=g((O_,Pv)=>{"use strict";wv();var NL=Ki();Pv.exports=NL("String","trimLeft")});var Rv=g((__,kv)=>{"use strict";var UL=Av();kv.exports=UL});var Mv=g((F_,Lv)=>{"use strict";var qL=Rv();Lv.exports=qL});var jv=g(()=>{"use strict"});var Gv=g(()=>{"use strict"});var Qv=g((SU,zv)=>{"use strict";var uM=Ot(),lM=fr(),cM=at(),dM=cM("match");zv.exports=function(s){var e;return uM(s)&&((e=s[dM])!==void 0?!!e:lM(s)==="RegExp")}});var Yv=g((vU,Wv)=>{"use strict";var pM=di();Wv.exports=function(){var s=pM(this),e="";return s.hasIndices&&(e+="d"),s.global&&(e+="g"),s.ignoreCase&&(e+="i"),s.multiline&&(e+="m"),s.dotAll&&(e+="s"),s.unicode&&(e+="u"),s.unicodeSets&&(e+="v"),s.sticky&&(e+="y"),e}});var Jv=g((yU,Xv)=>{"use strict";var hM=Vt(),fM=ii(),mM=la(),bM=Yv(),Kv=RegExp.prototype;Xv.exports=function(s){var e=s.flags;return e===void 0&&!("flags"in Kv)&&!fM(s,"flags")&&mM(Kv,s)?hM(bM,s):e}});var ey=g((TU,Zv)=>{"use strict";var Td=Ze(),gM=Or(),SM=Math.floor,vd=Td("".charAt),vM=Td("".replace),yd=Td("".slice),yM=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,TM=/\$([$&'`]|\d{1,2})/g;Zv.exports=function(s,e,t,i,r,a){var n=t+s.length,o=i.length,u=TM;return r!==void 0&&(r=gM(r),u=yM),vM(a,u,function(l,d){var c;switch(vd(d,0)){case"$":return"$";case"&":return s;case"`":return yd(e,0,t);case"'":return yd(e,n);case"<":c=r[yd(d,1,-1)];break;default:var h=+d;if(h===0)return l;if(h>o){var p=SM(h/10);return p===0?l:p<=o?i[p-1]===void 0?vd(d,1):i[p-1]+vd(d,1):l}c=i[h-1]}return c===void 0?"":c})}});var ry=g(()=>{"use strict";var IM=je(),xM=Vt(),xd=Ze(),ty=Yi(),EM=Oe(),wM=Cr(),PM=Qv(),cs=qa(),AM=da(),kM=Jv(),RM=ey(),LM=at(),MM=ti(),$M=LM("replace"),BM=TypeError,Id=xd("".indexOf),DM=xd("".replace),iy=xd("".slice),CM=Math.max;IM({target:"String",proto:!0},{replaceAll:function(e,t){var i=ty(this),r,a,n,o,u,l,d,c,h,p,f=0,b="";if(!wM(e)){if(r=PM(e),r&&(a=cs(ty(kM(e))),!~Id(a,"g")))throw new BM("`.replaceAll` does not allow non-global regexes");if(n=AM(e,$M),n)return xM(n,e,i,t);if(MM&&r)return DM(cs(i),e,t)}for(o=cs(i),u=cs(e),l=EM(t),l||(t=cs(t)),d=u.length,c=CM(1,d),h=Id(o,u);h!==-1;)p=l?cs(t(u,h,o)):RM(u,o,h,[],void 0,t),b+=iy(o,f,h)+p,f=h+d,h=h+c>o.length?-1:Id(o,u,h+c);return f<o.length&&(b+=iy(o,f)),b}})});var ay=g((EU,sy)=>{"use strict";jv();Gv();ry();var VM=Ki();sy.exports=VM("String","replaceAll")});var oy=g((wU,ny)=>{"use strict";var OM=ay();ny.exports=OM});var Ed=g((PU,uy)=>{"use strict";var _M=oy();uy.exports=_M});var cy=g((AU,ly)=>{"use strict";var FM=ma(),NM=qa(),UM=Yi(),qM=RangeError;ly.exports=function(e){var t=NM(UM(this)),i="",r=FM(e);if(r<0||r===1/0)throw new qM("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))r&1&&(i+=t);return i}});var my=g((kU,fy)=>{"use strict";var hy=Ze(),HM=Dl(),dy=qa(),jM=cy(),GM=Yi(),zM=hy(jM),QM=hy("".slice),WM=Math.ceil,py=function(s){return function(e,t,i){var r=dy(GM(e)),a=HM(t),n=r.length,o=i===void 0?" ":dy(i),u,l;return a<=n||o===""?r:(u=a-n,l=zM(o,WM(u/o.length)),l.length>u&&(l=QM(l,0,u)),s?r+l:l+r)}};fy.exports={start:py(!1),end:py(!0)}});var gy=g((RU,by)=>{"use strict";var YM=br();by.exports=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(YM)});var Sy=g(()=>{"use strict";var KM=je(),XM=my().start,JM=gy();KM({target:"String",proto:!0,forced:JM},{padStart:function(e){return XM(this,e,arguments.length>1?arguments[1]:void 0)}})});var yy=g(($U,vy)=>{"use strict";Sy();var ZM=Ki();vy.exports=ZM("String","padStart")});var Iy=g((BU,Ty)=>{"use strict";var e$=yy();Ty.exports=e$});var wd=g((DU,xy)=>{"use strict";var t$=Iy();xy.exports=t$});var j$={};zT(j$,{ChromecastState:()=>sa,HttpConnectionType:()=>ho,Observable:()=>Si.Observable,PlaybackState:()=>vt,Player:()=>co,PredefinedQualityLimits:()=>aa,SDK_VERSION:()=>H$,Subject:()=>Si.Subject,Subscription:()=>Si.Subscription,Surface:()=>fo,VERSION:()=>sl,ValueSubject:()=>Si.ValueSubject,VideoFormat:()=>li,VideoQuality:()=>Si.VideoQuality,clientChecker:()=>ee,isMobile:()=>Zr});module.exports=QT(j$);var sl="2.0.134-dev.6250ee46.0";var vt=(r=>(r.STOPPED="stopped",r.READY="ready",r.PLAYING="playing",r.PAUSED="paused",r))(vt||{}),li=(x=>(x.MPEG="MPEG",x.DASH="DASH",x.DASH_SEP="DASH_SEP",x.DASH_SEP_VK="DASH_SEP",x.DASH_WEBM="DASH_WEBM",x.DASH_WEBM_AV1="DASH_WEBM_AV1",x.DASH_STREAMS="DASH_STREAMS",x.DASH_WEBM_VK="DASH_WEBM",x.DASH_ONDEMAND="DASH_ONDEMAND",x.DASH_ONDEMAND_VK="DASH_ONDEMAND",x.DASH_LIVE="DASH_LIVE",x.DASH_LIVE_CMAF="DASH_LIVE_CMAF",x.DASH_LIVE_WEBM="DASH_LIVE_WEBM",x.HLS="HLS",x.HLS_ONDEMAND="HLS_ONDEMAND",x.HLS_JS="HLS",x.HLS_LIVE="HLS_LIVE",x.HLS_LIVE_CMAF="HLS_LIVE_CMAF",x.WEB_RTC_LIVE="WEB_RTC_LIVE",x))(li||{});var sa=(r=>(r.NOT_AVAILABLE="NOT_AVAILABLE",r.AVAILABLE="AVAILABLE",r.CONNECTING="CONNECTING",r.CONNECTED="CONNECTED",r))(sa||{}),ho=(i=>(i.HTTP1="http1",i.HTTP2="http2",i.QUIC="quic",i))(ho||{});var fo=(n=>(n.NONE="none",n.INLINE="inline",n.FULLSCREEN="fullscreen",n.SECOND_SCREEN="second_screen",n.PIP="pip",n.INVISIBLE="invisible",n))(fo||{}),aa=(i=>(i.TRAFFIC_SAVING="traffic_saving",i.HIGH_QUALITY="high_quality",i.UNKNOWN="unknown",i))(aa||{});var _T=K(_t(),1);var ce=require("@vkontakte/videoplayer-shared/es2015");var sf=s=>new Promise((e,t)=>{let i=document.createElement("script");i.setAttribute("src",s),i.onload=()=>e(),i.onerror=r=>t(r),document.body.appendChild(i)});var vo=class{constructor(e){this.connection$=new ce.ValueSubject(void 0);this.castState$=new ce.ValueSubject("NOT_AVAILABLE");this.errorEvent$=new ce.Subject;this.realCastState$=new ce.ValueSubject("NOT_AVAILABLE");this.subscription=new ce.Subscription;this.isDestroyed=!1;var a;this.params=e,this.log=this.params.dependencies.logger.createComponentLog("ChromecastInitializer");let t="chrome"in window;if(this.log({message:`[constructor] receiverApplicationId: ${this.params.receiverApplicationId}, isDisabled: ${this.params.isDisabled}, isSupported: ${t}`}),e.isDisabled||!t)return;let i=(0,ce.isNonNullable)((a=window.chrome)==null?void 0:a.cast),r=!!window.__onGCastApiAvailable;i?this.initializeCastApi():(window.__onGCastApiAvailable=n=>{delete window.__onGCastApiAvailable,n&&!this.isDestroyed&&this.initializeCastApi()},r||sf("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1").catch(()=>this.errorEvent$.next({id:"ChromecastLoading",category:ce.ErrorCategory.NETWORK,message:"Script loading failed!"})))}connect(){var e;(e=cast.framework.CastContext.getInstance())==null||e.requestSession()}disconnect(){var e,t;(t=(e=cast.framework.CastContext.getInstance())==null?void 0:e.getCurrentSession())==null||t.endSession(!0)}stopMedia(){return new Promise((e,t)=>{var i,r,a;(a=(r=(i=cast.framework.CastContext.getInstance())==null?void 0:i.getCurrentSession())==null?void 0:r.getMediaSession())==null||a.stop(new chrome.cast.media.StopRequest,e,t)})}toggleConnection(){(0,ce.isNonNullable)(this.connection$.getValue())?this.disconnect():this.connect()}setVolume(e){let t=this.connection$.getValue();(0,ce.isNullable)(t)||(t.remotePlayer.volumeLevel=e,t.remotePlayerController.setVolumeLevel())}setMuted(e){let t=this.connection$.getValue();(0,ce.isNullable)(t)||e!==t.remotePlayer.isMuted&&t.remotePlayerController.muteOrUnmute()}destroy(){this.isDestroyed=!0,this.subscription.unsubscribe()}initListeners(){let e=new cast.framework.RemotePlayer,t=new cast.framework.RemotePlayerController(e),i=cast.framework.CastContext.getInstance();this.subscription.add((0,ce.fromEvent)(i,cast.framework.CastContextEventType.SESSION_STATE_CHANGED).subscribe(r=>{var a,n,o;switch(r.sessionState){case cast.framework.SessionState.SESSION_STARTED:case cast.framework.SessionState.SESSION_STARTING:case cast.framework.SessionState.SESSION_RESUMED:this.contentId=(o=(n=(a=i.getCurrentSession())==null?void 0:a.getMediaSession())==null?void 0:n.media)==null?void 0:o.contentId;break;case cast.framework.SessionState.NO_SESSION:case cast.framework.SessionState.SESSION_ENDING:case cast.framework.SessionState.SESSION_ENDED:case cast.framework.SessionState.SESSION_START_FAILED:this.contentId=void 0;break;default:return(0,ce.assertNever)(r.sessionState)}})).add((0,ce.merge)((0,ce.fromEvent)(i,cast.framework.CastContextEventType.CAST_STATE_CHANGED).pipe((0,ce.tap)(r=>{this.log({message:`[cast.framework.RemotePlayerEventType.CAST_STATE_CHANGED]: ${JSON.stringify(r)}`})}),(0,ce.map)(r=>r.castState)),(0,ce.observableFrom)([i.getCastState()])).pipe((0,ce.filterChanged)(),(0,ce.map)(mE),(0,ce.tap)(r=>{this.log({message:`realCastState$: ${r}`})})).subscribe(this.realCastState$)).add(this.realCastState$.subscribe(r=>{var o,u;let a=r==="CONNECTED",n=(0,ce.isNonNullable)(this.connection$.getValue());if(a&&!n){let l=i.getCurrentSession();(0,ce.assertNonNullable)(l);let d=l.getCastDevice(),c=(u=(o=l.getMediaSession())==null?void 0:o.media)==null?void 0:u.contentId;((0,ce.isNullable)(c)||c===this.contentId)&&(this.log({message:"connection created"}),this.connection$.next({remotePlayer:e,remotePlayerController:t,session:l,castDevice:d}))}else!a&&n&&(this.log({message:"connection destroyed"}),this.connection$.next(void 0));this.castState$.next(r==="CONNECTED"?(0,ce.isNonNullable)(this.connection$.getValue())?"CONNECTED":"AVAILABLE":r)}))}initializeCastApi(){var r;let e,t,i;try{e=cast.framework.CastContext.getInstance(),t=chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,i=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}catch(a){return}try{e.setOptions({receiverApplicationId:(r=this.params.receiverApplicationId)!=null?r:t,autoJoinPolicy:i}),this.initListeners()}catch(a){this.errorEvent$.next({id:"ChromecastInitializer",category:ce.ErrorCategory.EXTERNAL_API,message:"[initializeCastApi] failed",thrown:a})}}},mE=s=>{switch(s){case cast.framework.CastState.NO_DEVICES_AVAILABLE:return"NOT_AVAILABLE";case cast.framework.CastState.NOT_CONNECTED:return"AVAILABLE";case cast.framework.CastState.CONNECTING:return"CONNECTING";case cast.framework.CastState.CONNECTED:return"CONNECTED";default:return(0,ce.assertNever)(s)}};var sp=K(_t(),1),wT=K(Sr(),1),PT=K(uc(),1);var tS=K(Ra(),1);var Wc=require("@vkontakte/videoplayer-shared/es2015");var _e=(s,e=0,t=0)=>{switch(t){case 0:return s.replace("_offset_p",e===0?"":"_"+e.toFixed(0));case 1:{if(e===0)return s;let i=new URL(s);return i.searchParams.append("playback_shift",e.toFixed(0)),i.toString()}case 2:{let i=new URL(s);return!i.searchParams.get("offset_p")&&e===0?s:(i.searchParams.set("offset_p",e.toFixed(0)),i.toString())}default:(0,Wc.assertNever)(t)}return s},Ji=(s,e)=>{var t;switch(e){case 0:return NaN;case 1:{let i=new URL(s);return Number(i.searchParams.get("playback_shift"))}case 2:{let i=new URL(s);return Number((t=i.searchParams.get("offset_p"))!=null?t:0)}default:(0,Wc.assertNever)(e)}};var O=(s,e,t=!1)=>{let i=s.getTransition();(t||!i||i.to===e)&&s.setState(e)};var pi=require("@vkontakte/videoplayer-shared/es2015"),se=class{constructor(e){this.transitionStarted$=new pi.Subject;this.transitionEnded$=new pi.Subject;this.transitionUpdated$=new pi.Subject;this.forceChanged$=new pi.Subject;this.stateChangeStarted$=(0,pi.merge)(this.transitionStarted$,this.transitionUpdated$);this.stateChangeEnded$=(0,pi.merge)(this.transitionEnded$,this.forceChanged$);this.state=e,this.prevState=void 0}setState(e){let t=this.transition,i=this.state;this.transition=void 0,this.prevState=i,this.state=e,t?t.to===e?this.transitionEnded$.next(t):this.forceChanged$.next({from:t.from,to:e,canceledTransition:t}):this.forceChanged$.next({from:i,to:e,canceledTransition:t})}startTransitionTo(e){let t=this.transition,i=this.state;i===e||(0,pi.isNonNullable)(t)&&t.to===e||(this.prevState=i,this.state=e,t?(this.transition={from:t.from,to:e,canceledTransition:t},this.transitionUpdated$.next(this.transition)):(this.transition={from:i,to:e},this.transitionStarted$.next(this.transition)))}getTransition(){return this.transition}getState(){return this.state}getPrevState(){return this.prevState}};var Jg=require("@vkontakte/videoplayer-shared/es2015"),Zg=s=>{switch(s){case"MPEG":case"DASH":case"DASH_SEP":case"DASH_ONDEMAND":case"DASH_WEBM":case"DASH_WEBM_AV1":case"DASH_STREAMS":case"HLS":case"HLS_ONDEMAND":return!1;case"DASH_LIVE":case"DASH_LIVE_CMAF":case"HLS_LIVE":case"HLS_LIVE_CMAF":case"DASH_LIVE_WEBM":case"WEB_RTC_LIVE":return!0;default:return(0,Jg.assertNever)(s)}};var X=require("@vkontakte/videoplayer-shared/es2015");var xR=5,ER=5,wR=500,eS=7e3,La=class{constructor(e){this.subscription=new X.Subscription;this.loadMediaTimeoutSubscription=new X.Subscription;this.videoState=new se("stopped");this.syncPlayback=()=>{let e=this.videoState.getState(),t=this.videoState.getTransition(),i=this.params.desiredState.playbackState.getState(),r=this.params.desiredState.playbackState.getTransition(),a=this.params.desiredState.seekState.getState();if(this.log({message:`[syncPlayback] videoState: ${e}; videoTransition: ${JSON.stringify(t)}; desiredPlaybackState: ${i}; desiredPlaybackStateTransition: ${this.params.desiredState.playbackState.getTransition()}; seekState: ${JSON.stringify(a)};`}),i==="stopped"){e!=="stopped"&&(this.videoState.startTransitionTo("stopped"),this.stop());return}if(!t){if((r==null?void 0:r.to)!=="paused"&&a.state==="requested"&&e!=="stopped"){this.seek(a.position/1e3);return}switch(i){case"ready":{switch(e){case"playing":case"paused":case"ready":break;case"stopped":this.videoState.startTransitionTo("ready"),this.prepare();break;default:(0,X.assertNever)(e)}break}case"playing":{switch(e){case"playing":break;case"paused":this.videoState.startTransitionTo("playing"),this.params.connection.remotePlayerController.playOrPause();break;case"ready":this.videoState.startTransitionTo("playing"),this.params.connection.remotePlayerController.playOrPause();break;case"stopped":this.videoState.startTransitionTo("ready"),this.prepare();break;default:(0,X.assertNever)(e)}break}case"paused":{switch(e){case"playing":this.videoState.startTransitionTo("paused"),this.params.connection.remotePlayerController.playOrPause();break;case"paused":break;case"ready":this.videoState.startTransitionTo("paused"),this.videoState.setState("paused");break;case"stopped":this.videoState.startTransitionTo("ready"),this.prepare();break;default:(0,X.assertNever)(e)}break}default:(0,X.assertNever)(i)}}};this.params=e,this.log=this.params.dependencies.logger.createComponentLog("ChromecastProvider"),this.log({message:`constructor, format: ${e.format}`}),this.params.output.isLive$.next(Zg(e.format)),this.params.output.isAudioAvailable$.next(!0),this.handleRemoteVolumeChange({volume:this.params.connection.remotePlayer.volumeLevel,muted:this.params.connection.remotePlayer.isMuted});let t=this.params.connection.session.getMediaSession();t&&this.restoreSession(t),this.subscribe()}destroy(){this.log({message:"[destroy]"}),this.subscription.unsubscribe()}subscribe(){this.subscription.add(this.loadMediaTimeoutSubscription);let e=new X.Subscription;this.subscription.add(e),this.subscription.add((0,X.merge)(this.videoState.stateChangeStarted$.pipe((0,X.map)(r=>`stateChangeStarted$ ${JSON.stringify(r)}`)),this.videoState.stateChangeEnded$.pipe((0,X.map)(r=>`stateChangeEnded$ ${JSON.stringify(r)}`))).subscribe(r=>this.log({message:`[videoState] ${r}`})));let t=(r,a)=>this.subscription.add(r.subscribe(a));if(this.params.output.isLive$.getValue())this.params.output.position$.next(0),this.params.output.duration$.next(0);else{let r=new X.Subject;e.add(r.pipe((0,X.debounce)(wR)).subscribe(()=>{this.params.output.seekedEvent$.next()}));let a=NaN;e.add((0,X.fromEvent)(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED).subscribe(n=>{this.logRemoteEvent(n);let o=n.value;this.params.output.position$.next(o),(this.params.desiredState.seekState.getState().state==="applying"||Math.abs(o-a)>xR)&&r.next(o),a=o})),e.add((0,X.fromEvent)(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.DURATION_CHANGED).subscribe(n=>{this.logRemoteEvent(n),this.params.output.duration$.next(n.value)}))}t((0,X.fromEvent)(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED),r=>{this.logRemoteEvent(r),r.value?this.handleRemoteReady():(this.handleRemoteStop(),e.unsubscribe())}),t((0,X.fromEvent)(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED),r=>{this.logRemoteEvent(r),r.value?this.handleRemotePause():this.handleRemotePlay()}),t((0,X.fromEvent)(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED),r=>{this.logRemoteEvent(r);let{remotePlayer:a}=this.params.connection,n=r.value,o=this.params.output.isBuffering$.getValue(),u=n===chrome.cast.media.PlayerState.BUFFERING;switch(o!==u&&this.params.output.isBuffering$.next(u),n){case chrome.cast.media.PlayerState.IDLE:!this.params.output.isLive$.getValue()&&a.duration-a.currentTime<ER&&this.params.output.endedEvent$.next(),this.handleRemoteStop(),O(this.params.desiredState.playbackState,"stopped");break;case chrome.cast.media.PlayerState.PAUSED:{this.handleRemotePause();break}case chrome.cast.media.PlayerState.PLAYING:this.handleRemotePlay();break;case chrome.cast.media.PlayerState.BUFFERING:break;default:(0,X.assertNever)(n)}}),t((0,X.fromEvent)(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.VOLUME_LEVEL_CHANGED),r=>{this.logRemoteEvent(r),this.handleRemoteVolumeChange({volume:r.value})}),t((0,X.fromEvent)(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.IS_MUTED_CHANGED),r=>{this.logRemoteEvent(r),this.handleRemoteVolumeChange({muted:r.value})});let i=(0,X.merge)(this.params.desiredState.playbackState.stateChangeStarted$,this.params.desiredState.seekState.stateChangeEnded$,this.videoState.stateChangeEnded$,(0,X.observableFrom)(["init"])).pipe((0,X.debounce)(0));t(i,this.syncPlayback)}restoreSession(e){this.log({message:"restoreSession"});let{remotePlayer:t}=this.params.connection;if(e.playerState!==chrome.cast.media.PlayerState.IDLE){t.isPaused?(this.videoState.setState("paused"),O(this.params.desiredState.playbackState,"paused")):(this.videoState.setState("playing"),O(this.params.desiredState.playbackState,"playing"));let i=this.params.output.isLive$.getValue();this.params.output.duration$.next(i?0:t.duration),this.params.output.position$.next(i?0:t.currentTime),this.params.desiredState.seekState.setState({state:"none"})}}prepare(){let e=this.params.format;this.log({message:`[prepare] format: ${e}`});let t=this.createMediaInfo(e),i=this.createLoadRequest(t);this.loadMedia(i)}handleRemotePause(){let e=this.videoState.getState(),t=this.videoState.getTransition();((t==null?void 0:t.to)==="paused"||e==="playing")&&(this.videoState.setState("paused"),O(this.params.desiredState.playbackState,"paused"))}handleRemotePlay(){let e=this.videoState.getState(),t=this.videoState.getTransition();((t==null?void 0:t.to)==="playing"||e==="paused")&&(this.videoState.setState("playing"),O(this.params.desiredState.playbackState,"playing"))}handleRemoteReady(){var t;let e=this.videoState.getTransition();(e==null?void 0:e.to)==="ready"&&this.videoState.setState("ready"),((t=this.params.desiredState.playbackState.getTransition())==null?void 0:t.to)==="ready"&&O(this.params.desiredState.playbackState,"ready")}handleRemoteStop(){this.videoState.getState()!=="stopped"&&this.videoState.setState("stopped")}handleRemoteVolumeChange(e){var r,a;let t=this.params.output.volume$.getValue(),i={volume:(r=e.volume)!=null?r:t.volume,muted:(a=e.muted)!=null?a:t.muted};(i.volume!==t.volume||i.muted!==i.muted)&&this.params.output.volume$.next(i)}seek(e){this.params.output.willSeekEvent$.next();let{remotePlayer:t,remotePlayerController:i}=this.params.connection;t.currentTime=e,i.seek()}stop(){let{remotePlayerController:e}=this.params.connection;e.stop()}createMediaInfo(e){var l;let t=this.params.source,i,r,a;switch(e){case"MPEG":{let d=t[e];(0,X.assertNonNullable)(d);let c=(0,X.getHighestQuality)(Object.keys(d));(0,X.assertNonNullable)(c);let h=d[c];(0,X.assertNonNullable)(h),i=h,r="video/mp4",a=chrome.cast.media.StreamType.BUFFERED;break}case"HLS":case"HLS_ONDEMAND":{let d=t[e];(0,X.assertNonNullable)(d),i=d.url,r="application/x-mpegurl",a=chrome.cast.media.StreamType.BUFFERED;break}case"DASH_SEP":case"DASH_ONDEMAND":case"DASH_WEBM":case"DASH_WEBM_AV1":case"DASH_STREAMS":{let d=t[e];(0,X.assertNonNullable)(d),i=d.url,r="application/dash+xml",a=chrome.cast.media.StreamType.BUFFERED;break}case"DASH_LIVE_CMAF":{let d=t[e];(0,X.assertNonNullable)(d),i=d.url,r="application/dash+xml",a=chrome.cast.media.StreamType.LIVE;break}case"HLS_LIVE":case"HLS_LIVE_CMAF":{let d=t[e];(0,X.assertNonNullable)(d),i=_e(d.url),r="application/x-mpegurl",a=chrome.cast.media.StreamType.LIVE;break}case"DASH_LIVE":case"WEB_RTC_LIVE":{let d="Unsupported format for Chromecast",c=new Error(d);throw this.params.output.error$.next({id:"ChromecastProvider.createMediaInfo()",category:X.ErrorCategory.VIDEO_PIPELINE,message:d,thrown:c}),c}case"DASH":case"DASH_LIVE_WEBM":throw new Error(`${e} is no longer supported`);default:return(0,X.assertNever)(e)}let n=new chrome.cast.media.MediaInfo((l=this.params.meta.videoId)!=null?l:i,r);n.contentUrl=i,n.streamType=a,n.metadata=new chrome.cast.media.GenericMediaMetadata;let{title:o,subtitle:u}=this.params.meta;return(0,X.isNonNullable)(o)&&(n.metadata.title=o),(0,X.isNonNullable)(u)&&(n.metadata.subtitle=u),n}createLoadRequest(e){let t=new chrome.cast.media.LoadRequest(e);t.autoplay=!1;let i=this.params.desiredState.seekState.getState();return i.state==="applying"||i.state==="requested"?t.currentTime=this.params.output.isLive$.getValue()?0:i.position/1e3:t.currentTime=0,t}loadMedia(e){let t=this.params.connection.session.loadMedia(e),i=new Promise((r,a)=>{this.loadMediaTimeoutSubscription.add((0,X.timeout)(eS).subscribe(()=>a(`timeout(${eS})`)))});(0,tS.default)(Promise.race([t,i]).then(()=>{this.log({message:`[loadMedia] completed, format: ${this.params.format}`}),this.params.desiredState.seekState.getState().state==="applying"&&this.params.output.seekedEvent$.next(),this.handleRemoteReady()},r=>{let a=`[prepare] loadMedia failed, format: ${this.params.format}, reason: ${r}`;this.log({message:a}),this.params.output.error$.next({id:"ChromecastProvider.loadMedia",category:X.ErrorCategory.VIDEO_PIPELINE,message:a,thrown:r})}),()=>{this.loadMediaTimeoutSubscription.unsubscribe()})}logRemoteEvent(e){this.log({message:`[remoteEvent] ${JSON.stringify(e)}`})}};var cd=K(_t(),1);var Jc=require("@vkontakte/videoplayer-shared/es2015");var iS=require("@vkontakte/videoplayer-shared/es2015"),rS=s=>{try{s.pause(),s.playbackRate=0,(0,iS.clearVideoElement)(s),s.remove()}catch(e){console.error(e)}};var Qo=require("@vkontakte/videoplayer-shared/es2015"),Yc=class{constructor(){this.attribute="data-pool-reused"}get(e){return e.hasAttribute(this.attribute)}set(e,t){e.toggleAttribute(this.attribute,t)}delete(e){e.removeAttribute(this.attribute)}},Kc=window.WeakMap?new WeakMap:new Yc,Xc=window.WeakMap?new WeakMap:new Map,PR=(s,e=20)=>{let t=0;return(0,Qo.fromEvent)(s,"ratechange").subscribe(i=>{t++,t>=e&&(s.currentTime=s.currentTime,t=0)})},nt=(s,{audioVideoSyncRate:e,disableYandexPiP:t})=>{let i=s.querySelector("video"),r=!!i;i?(0,Jc.clearVideoElement)(i):(i=document.createElement("video"),s.appendChild(i)),Kc.set(i,r);let a=new Qo.Subscription;return a.add(PR(i,e)),Xc.set(i,a),i.setAttribute("crossorigin","anonymous"),i.setAttribute("playsinline","playsinline"),t&&i.setAttribute("x-yandex-pip","false"),i.controls=!1,i.setAttribute("poster","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),i},ot=s=>{let e=Xc.get(s);e==null||e.unsubscribe(),Xc.delete(s);let t=Kc.get(s);Kc.delete(s),t?(0,Jc.clearVideoElement)(s):rS(s)};var Zc=K(Er(),1),J=require("@vkontakte/videoplayer-shared/es2015");var Zi=require("@vkontakte/videoplayer-shared/es2015"),Wo=(s,e,t,{equal:i=(n,o)=>n===o,changed$:r,onError:a}={})=>{let n=s.getState(),o=e(),u=(0,Zi.isNullable)(r),l=new Zi.Subscription;return r&&l.add(r.subscribe(d=>{let c=s.getState();i(d,c)&&s.setState(d)},a)),i(o,n)||(t(n),u&&s.setState(n)),l.add(s.stateChangeStarted$.subscribe(d=>{t(d.to),u&&s.setState(d.to)},a)),l},jt=(s,e,t)=>Wo(e,()=>s.loop,i=>{(0,Zi.isNonNullable)(i)&&(s.loop=i)},{onError:t}),ut=(s,e,t,i)=>Wo(e,()=>({muted:s.muted,volume:s.volume}),r=>{(0,Zi.isNonNullable)(r)&&(s.muted=r.muted,s.volume=r.volume)},{equal:(r,a)=>r===a||(r==null?void 0:r.muted)===(a==null?void 0:a.muted)&&(r==null?void 0:r.volume)===(a==null?void 0:a.volume),changed$:t,onError:i}),Et=(s,e,t,i)=>Wo(e,()=>s.playbackRate,r=>{(0,Zi.isNonNullable)(r)&&(s.playbackRate=r)},{changed$:t,onError:i}),er=Wo;var $R=s=>["__",s.language,s.label].join("|"),BR=(s,e)=>{if(s.id===e)return!0;let[t,i,r]=e.split("|");return s.language===i&&s.label===r},ed=class s{constructor(e){this.available$=new J.Subject;this.current$=new J.ValueSubject(void 0);this.error$=new J.Subject;this.subscription=new J.Subscription;this.externalTracks=new Map;this.internalTracks=new Map;this.baseURL=e}connect(e,t,i){this.video=e,this.cueSettings=t.textTrackCuesSettings,this.subscribe();let r=a=>{this.error$.next({id:"TextTracksManager",category:J.ErrorCategory.WTF,message:"Generic HtmlVideoTextTrackManager error",thrown:a})};this.subscription.add(this.available$.subscribe(i.availableTextTracks$)),this.subscription.add(this.current$.subscribe(i.currentTextTrack$)),this.subscription.add(this.error$.subscribe(i.error$)),this.subscription.add(er(t.internalTextTracks,()=>(0,Zc.default)(this.internalTracks),a=>{(0,J.isNonNullable)(a)&&this.setInternal(a)},{equal:(a,n)=>(0,J.isNonNullable)(a)&&(0,J.isNonNullable)(n)&&a.length===n.length&&a.every(({id:o},u)=>o===n[u].id),changed$:this.available$.pipe((0,J.map)(a=>a.filter(({type:n})=>n==="internal"))),onError:r})),this.subscription.add(er(t.externalTextTracks,()=>(0,Zc.default)(this.externalTracks),a=>{(0,J.isNonNullable)(a)&&this.setExternal(a)},{equal:(a,n)=>(0,J.isNonNullable)(a)&&(0,J.isNonNullable)(n)&&a.length===n.length&&a.every(({id:o},u)=>o===n[u].id),changed$:this.available$.pipe((0,J.map)(a=>a.filter(({type:n})=>n==="external"))),onError:r})),this.subscription.add(er(t.currentTextTrack,()=>{if(this.video)return;let a=this.htmlTextTracksAsArray().find(({mode:n})=>n==="showing");return a&&this.htmlTextTrackToITextTrack(a).id},a=>this.select(a),{changed$:this.current$,onError:r})),this.subscription.add(er(t.textTrackCuesSettings,()=>({}),()=>{if(this.video)for(let a of this.htmlTextTracksAsArray())this.applyCueSettings(a.cues),this.applyCueSettings(a.activeCues)}))}subscribe(){(0,J.assertNonNullable)(this.video);let{textTracks:e}=this.video;this.subscription.add((0,J.fromEvent)(e,"addtrack").subscribe(()=>{let i=this.current$.getValue();i&&this.select(i)})),this.subscription.add((0,J.merge)((0,J.fromEvent)(e,"addtrack"),(0,J.fromEvent)(e,"removetrack"),(0,J.observableFrom)(["init"])).pipe((0,J.map)(()=>this.htmlTextTracksAsArray().map(i=>this.htmlTextTrackToITextTrack(i))),(0,J.filterChanged)((i,r)=>i.length===r.length&&i.every(({id:a},n)=>a===r[n].id))).subscribe(this.available$)),this.subscription.add((0,J.merge)((0,J.fromEvent)(e,"change"),(0,J.observableFrom)(["init"])).pipe((0,J.map)(()=>this.htmlTextTracksAsArray().find(({mode:i})=>i==="showing")),(0,J.map)(i=>i&&this.htmlTextTrackToITextTrack(i).id),(0,J.filterChanged)()).subscribe(this.current$));let t=i=>{var r,a;return this.applyCueSettings((a=(r=i.target)==null?void 0:r.activeCues)!=null?a:null)};this.subscription.add((0,J.fromEvent)(e,"addtrack").subscribe(i=>{var a,n;(a=i.track)==null||a.addEventListener("cuechange",t);let r=o=>{var l,d,c,h,p;let u=(d=(l=o.target)==null?void 0:l.cues)!=null?d:null;u&&u.length&&(this.applyCueSettings((h=(c=o.target)==null?void 0:c.cues)!=null?h:null),(p=o.target)==null||p.removeEventListener("cuechange",r))};(n=i.track)==null||n.addEventListener("cuechange",r)})),this.subscription.add((0,J.fromEvent)(e,"removetrack").subscribe(i=>{var r;(r=i.track)==null||r.removeEventListener("cuechange",t)}))}applyCueSettings(e){if(!e||!e.length)return;let t=this.cueSettings.getState();for(let i of Array.from(e)){let r=i;(0,J.isNonNullable)(t.align)&&(r.align=t.align),(0,J.isNonNullable)(t.position)&&(r.position=t.position),(0,J.isNonNullable)(t.size)&&(r.size=t.size),(0,J.isNonNullable)(t.line)&&(r.line=t.line)}}htmlTextTracksAsArray(e=!1){(0,J.assertNonNullable)(this.video);let t=[...this.video.textTracks];return e?t:t.filter(s.isHealthyTrack)}htmlTextTrackToITextTrack(e){var o,u,l,d,c;let{language:t,label:i}=e,r=e.id?e.id:$R(e),a=this.externalTracks.has(r),n=(l=a?(o=this.externalTracks.get(r))==null?void 0:o.isAuto:(u=this.internalTracks.get(r))==null?void 0:u.isAuto)!=null?l:r.includes("auto");return a?{id:r,type:"external",isAuto:n,language:t,label:i,url:(d=this.externalTracks.get(r))==null?void 0:d.url}:{id:r,type:"internal",isAuto:n,language:t,label:i,url:(c=this.internalTracks.get(r))==null?void 0:c.url}}static isHealthyTrack(e){return!(e.kind==="metadata"||e.groupId||e.id===""&&e.label===""&&e.language==="")}setExternal(e){this.internalTracks.size>0&&Array.from(this.internalTracks).forEach(([,t])=>this.detach(t)),e.filter(({id:t})=>!this.externalTracks.has(t)).forEach(t=>this.attach(t)),Array.from(this.externalTracks).filter(([t])=>!e.find(i=>i.id===t)).forEach(([,t])=>this.detach(t))}setInternal(e){let t=[...this.externalTracks];e.filter(({id:i,language:r,isAuto:a})=>!this.internalTracks.has(i)&&!t.some(([,n])=>n.language===r&&n.isAuto===a)).forEach(i=>this.attach(i)),Array.from(this.internalTracks).filter(([i])=>!e.find(r=>r.id===i)).forEach(([,i])=>this.detach(i))}select(e){(0,J.assertNonNullable)(this.video);for(let t of this.htmlTextTracksAsArray(!0))t.mode="showing";for(let t of this.htmlTextTracksAsArray(!0))((0,J.isNullable)(e)||!BR(t,e))&&(t.mode="disabled")}destroy(){if(this.subscription.unsubscribe(),this.video)for(let e of Array.from(this.video.getElementsByTagName("track"))){let t=e.getAttribute("id");t&&this.externalTracks.has(t)&&this.video.removeChild(e)}this.externalTracks.clear()}attach(e){(0,J.assertNonNullable)(this.video);let t=document.createElement("track");this.baseURL?t.setAttribute("src",new URL(e.url,this.baseURL).toString()):t.setAttribute("src",e.url),t.setAttribute("id",e.id),e.label&&t.setAttribute("label",e.label),e.language&&t.setAttribute("srclang",e.language),e.type==="external"?this.externalTracks.set(e.id,e):e.type==="internal"&&this.internalTracks.set(e.id,e),this.video.appendChild(t)}detach(e){(0,J.assertNonNullable)(this.video);let t=Array.prototype.find.call(this.video.getElementsByTagName("track"),i=>i.getAttribute("id")===e.id);t&&this.video.removeChild(t),e.type==="external"?this.externalTracks.delete(e.id):e.type==="internal"&&this.internalTracks.delete(e.id)}},wt=ed;var wr=class{constructor(){this.pausedTime=0;this.streamOffset=0;this.pauseTimestamp=0}getTotalPausedTime(){return this.pausedTime+this.getCurrentPausedTime()}getCurrentPausedTime(){return this.pauseTimestamp>0?Date.now()-this.pauseTimestamp:0}getStreamOffset(){return this.streamOffset}getTotalOffset(){return this.getTotalPausedTime()+this.streamOffset}pause(){this.pauseTimestamp===0&&(this.pauseTimestamp=Date.now())}resume(){this.pauseTimestamp>0&&(this.pausedTime+=this.getCurrentPausedTime(),this.pauseTimestamp=0)}resetTo(e,t=!1){this.streamOffset=e,this.pauseTimestamp=0,this.pausedTime=0,t&&this.pause()}};var cS=s=>{let e=s;for(;!(e instanceof Document)&&!(e instanceof ShadowRoot)&&e!==null;)e=e==null?void 0:e.parentNode;return e!=null?e:void 0},td=s=>{let e=cS(s);return!!(e&&e.fullscreenElement&&e.fullscreenElement===s)},dS=s=>{let e=cS(s);return!!(e&&e.pictureInPictureElement&&e.pictureInPictureElement===s)};var q=require("@vkontakte/videoplayer-shared/es2015");var DR=3,pS=(s,e,t=DR)=>{let i=0,r=0;for(let a=0;a<s.length;a++){let n=s.start(a),o=s.end(a);if(n<=e&&e<=o){if(i=n,r=o,!t)return{from:i,to:r};for(let u=a-1;u>=0;u--)s.end(u)+t>=i&&(i=s.start(u));for(let u=a+1;u<s.length;u++)s.start(u)-t<=r&&(r=s.end(u))}}return{from:i,to:r}};var Yo=class{constructor(){this._isMiuiBrowser=!1}get current(){return this._current}get isYandex(){return this.current==="Yandex"}get isSafari(){return this.current==="Safari"}get isFirefox(){return this.current==="Firefox"}get isSamsungBrowser(){return this.current==="SamsungBrowser"}get safariVersion(){return this._safariVersion}get isMiuiBrowser(){return this._isMiuiBrowser}detect(){let{userAgent:e}=navigator;try{let t=/yabrowser/i.test(e)?"Yandex":void 0,i=/samsungbrowser/i.test(e)?"SamsungBrowser":void 0,r=/chrome|crios/i.test(e)?"Chrome":void 0,a=/chromium/i.test(e)?"Chromium":void 0,n=/firefox|fxios/i.test(e)?"Firefox":void 0,o=/webkit|safari|khtml/i.test(e)?"Safari":void 0,u=/opr\//i.test(e)?"Opera":void 0,l=/edg/i.test(e)?"Edge":void 0;this._isMiuiBrowser=/(XiaoMi)|(MiuiBrowser)/i.test(e),this._current=t||i||n||u||l||r||a||o||"Rest"}catch(t){console.error(t)}this.isSafari&&this.detectSafariVersion()}detectSafariVersion(){try{let{userAgent:e}=window.navigator,t=e.match(/Version\/(\d+)/);if(!t)return;let i=t[1],r=parseInt(i,10);if(isNaN(r))return;this._safariVersion=r}catch(e){console.error(e)}}};var hS=K(_t(),1);var Zr=()=>{var s,e;return/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test((s=navigator.appVersion)!=null?s:navigator.userAgent)||((e=navigator==null?void 0:navigator.userAgentData)==null?void 0:e.mobile)};var Ko=class{constructor(e){this._highEntropyValues={};this._displayChecker=e}get current(){return this._current}get isIOS(){let e=["iPhone","iPad","iPod"];return this._highEntropyValues.platform==="iOS"||(0,hS.default)(e,this.current)}get isMac(){return this._highEntropyValues.platform==="macOS"||this.current==="Mac"}get isApple(){return this.isIOS||this.isMac}get isIphoneOrOldIpad(){if(!this.isApple||!this._displayChecker.isTouch)return!1;let e=this.current==="iPad"||this._displayChecker.width>700,t=this._iosVersion;return!e||e&&!!t&&t<16}get isAndroid(){return this._highEntropyValues.platform==="Android"||this.current==="Android"}get isMobile(){return this._highEntropyValues.mobile||this._isMobile}get iOSVersion(){return this._iosVersion}detect(){let{userAgent:e}=navigator;try{this._isMobile=Zr()}catch(t){console.error(t)}this.detectDevice(e),this.detectHighEntropyValues(),this.isIOS&&this.detectIOSVersion()}detectHighEntropyValues(){return A(this,null,function*(){let{userAgentData:e}=navigator;if(e!=null&&e.getHighEntropyValues){let t=yield e.getHighEntropyValues(["architecture","bitness","brands","mobile","platform","formFactor","model","platformVersion","wow64"]);this._highEntropyValues=t}})}detectDevice(e){try{let t=/android/i.test(e)?"Android":void 0,i=/iphone/i.test(e)?"iPhone":void 0,r=/ipad/i.test(e)?"iPad":void 0,a=/ipod/i.test(e)?"iPod":void 0,n=/mac/i.test(e)?"Mac":void 0,o=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?"RestMobile":void 0;this._current=t||i||r||a||o||n||"Desktop"}catch(t){console.error(t)}}detectIOSVersion(){try{if(this._highEntropyValues.platformVersion){let a=this._highEntropyValues.platformVersion.split(".").slice(0,2).join("."),n=parseFloat(a);this._iosVersion=n;return}let{userAgent:e}=window.navigator,t=e.match(/OS (\d+(_\d+)?)/i);if(!t)return;let i=t[1].replace(/_/g,".");if(!i)return;let r=parseFloat(i);if(isNaN(r))return;this._iosVersion=r}catch(e){console.error(e)}}};var Xo=class{get isTouch(){return typeof this._maxTouchPoints=="number"?this._maxTouchPoints>1:"ontouchstart"in window}get maxTouchPoints(){return this._maxTouchPoints}get height(){return this._height}get width(){return this._width}get screenHeight(){return this._screenHeight}get screenWidth(){return this._screenWidth}get pixelRatio(){return this._pixelRatio}get isHDR(){return this._isHdr}get colorDepth(){return this._colorDepth}detect(){var t;let{maxTouchPoints:e}=navigator;try{this._maxTouchPoints=e!=null?e:0,this._isHdr=!!((t=matchMedia("(dynamic-range: high)"))!=null&&t.matches),this._colorDepth=screen.colorDepth}catch(i){console.error(i)}try{this._pixelRatio=window.devicePixelRatio||1,this._height=screen.height,this._width=screen.width,this._height=screen.height,this._screenHeight=this._height*this._pixelRatio,this._screenWidth=this._width*this._pixelRatio}catch(i){console.error(i)}}};var Nt=()=>window.ManagedMediaSource||window.MediaSource,es=()=>{var s,e;return!!(window.ManagedMediaSource&&((e=(s=window.ManagedSourceBuffer)==null?void 0:s.prototype)!=null&&e.appendBuffer))},fS=()=>{var s,e;return!!(window.MediaSource&&((e=(s=window.SourceBuffer)==null?void 0:s.prototype)!=null&&e.appendBuffer))},Jo=()=>window.ManagedMediaSource?new ManagedMediaSource:new MediaSource;var CR=document.createElement("video"),VR='video/mp4; codecs="avc1.42000a,mp4a.40.2"',OR='video/mp4; codecs="hev1.1.6.L93.B0"',mS='video/webm; codecs="vp09.00.10.08"',bS='video/webm; codecs="av01.0.00M.08"',_R='audio/mp4; codecs="mp4a.40.2"',FR='audio/webm; codecs="opus"',gS,NR=()=>A(void 0,null,function*(){if(!window.navigator.mediaCapabilities)return;let s={type:"media-source",video:{contentType:"video/webm",width:1280,height:720,bitrate:1e6,framerate:30}},[e,t]=yield Promise.all([window.navigator.mediaCapabilities.decodingInfo(N(k({},s),{video:N(k({},s.video),{contentType:bS})})),window.navigator.mediaCapabilities.decodingInfo(N(k({},s),{video:N(k({},s.video),{contentType:mS})}))]);gS={DASH_WEBM_AV1:e,DASH_WEBM:t}});NR().catch(s=>{console.log(CR),console.error(s)});var Zo=class{constructor(e,t){this._deviceChecker=e,this._browserChecker=t}get protocols(){return this._protocols}get containers(){return this._containers}get codecs(){return this._codecs}get webmDecodingInfo(){return gS}get supportedCodecs(){return Object.keys(this._codecs).filter(e=>this._codecs[e])}get nativeHlsSupported(){return this._nativeHlsSupported}detect(){var e,t,i,r,a,n,o,u,l,d,c,h,p,f,b,S,v,y,x,w;this._video=document.createElement("video");try{this._protocols={mms:es(),mse:fS(),hls:!!((t=(e=this._video).canPlayType)!=null&&t.call(e,"application/x-mpegurl")||(r=(i=this._video).canPlayType)!=null&&r.call(i,"vnd.apple.mpegURL")),webrtc:!!window.RTCPeerConnection,ws:!!window.WebSocket},this._containers={mp4:!!((n=(a=this._video).canPlayType)!=null&&n.call(a,"video/mp4")),webm:!!((u=(o=this._video).canPlayType)!=null&&u.call(o,"video/webm")),cmaf:!0};let P=!!((d=(l=Nt())==null?void 0:l.isTypeSupported)!=null&&d.call(l,VR)),D=!!((h=(c=Nt())==null?void 0:c.isTypeSupported)!=null&&h.call(c,OR)),H=!!((f=(p=Nt())==null?void 0:p.isTypeSupported)!=null&&f.call(p,_R));this._codecs={h264:P,h265:D,vp9:!!((S=(b=Nt())==null?void 0:b.isTypeSupported)!=null&&S.call(b,mS)),av1:!!((y=(v=Nt())==null?void 0:v.isTypeSupported)!=null&&y.call(v,bS)),aac:H,opus:!!((w=(x=Nt())==null?void 0:x.isTypeSupported)!=null&&w.call(x,FR)),mpeg:(P||D)&&H},this._nativeHlsSupported=this._protocols.hls&&this._containers.mp4}catch(P){console.error(P)}this.destroyVideoElement()}destroyVideoElement(){var t;if(!this._video)return;if(this._video.pause(),this._video.currentTime=0,this._video.removeAttribute("src"),this._video.src="",this._video.load(),this._video.remove){this._video.remove(),this._video=null;return}this._video.parentNode&&this._video.parentNode.removeChild(this._video);let e=this._video.cloneNode(!1);(t=this._video.parentNode)==null||t.replaceChild(e,this._video),this._video=null}};var SS="audio/mpeg",eu=class{supportMp3(){return this._codecs.mp3&&this._containers.mpeg}detect(){var e,t,i,r;this._audio=document.createElement("audio");try{this._containers={mpeg:!!((t=(e=this._audio).canPlayType)!=null&&t.call(e,SS))},this._codecs={mp3:!!((r=(i=Nt())==null?void 0:i.isTypeSupported)!=null&&r.call(i,SS))}}catch(a){console.error(a)}this.destroyAudioElement()}destroyAudioElement(){var t;if(!this._audio)return;if(this._audio.pause(),this._audio.currentTime=0,this._audio.removeAttribute("src"),this._audio.src="",this._audio.load(),this._audio.remove){this._audio.remove(),this._audio=null;return}this._audio.parentNode&&this._audio.parentNode.removeChild(this._audio);let e=this._audio.cloneNode(!1);(t=this._audio.parentNode)==null||t.replaceChild(e,this._audio),this._audio=null}};var vS=require("@vkontakte/videoplayer-shared/es2015");var id=class{constructor(){this.isInited$=new vS.ValueSubject(!1);this._displayChecker=new Xo,this._deviceChecker=new Ko(this._displayChecker),this._browserChecker=new Yo,this._videoChecker=new Zo(this._deviceChecker,this._browserChecker),this._audioChecker=new eu,this.detect()}get display(){return this._displayChecker}get device(){return this._deviceChecker}get browser(){return this._browserChecker}get video(){return this._videoChecker}get audio(){return this._audioChecker}detect(){return A(this,null,function*(){this._displayChecker.detect(),this._deviceChecker.detect(),this._browserChecker.detect(),this._videoChecker.detect(),this._audioChecker.detect(),this.isInited$.next(!0)})}},ee=new id;var lt=s=>{let e=L=>(0,q.fromEvent)(s,L).pipe((0,q.mapTo)(void 0)),t=new q.Subscription,i=()=>t.unsubscribe(),r=(0,q.merge)((0,q.fromEvent)(s,"progress"),(0,q.fromEvent)(s,"timeupdate")).pipe((0,q.map)(()=>pS(s.buffered,s.currentTime))),a=ee.browser.isSafari?(0,q.combine)({play:e("play").pipe((0,q.once)()),playing:e("playing")}).pipe((0,q.mapTo)(void 0)):e("playing"),n=(0,q.fromEvent)(s,"volumechange").pipe((0,q.map)(()=>({muted:s.muted,volume:s.volume}))),o=(0,q.fromEvent)(s,"ratechange").pipe((0,q.map)(()=>s.playbackRate)),u=(0,q.fromEvent)(s,"error").pipe((0,q.filter)(()=>!!(s.error||s.played.length)),(0,q.map)(()=>{var z;let L=s.error;return{id:L?`MediaError#${L.code}`:"HtmlVideoError",category:q.ErrorCategory.VIDEO_PIPELINE,message:L?L.message:"Error event from HTML video element",thrown:(z=s.error)!=null?z:void 0}})),l=(0,q.fromEvent)(s,"timeupdate").pipe((0,q.map)(()=>s.currentTime)),d=["waiting","seeking","seeked","timeupdate"],c=new q.Subject,h=.3,p;t.add((0,q.merge)(...d.map(L=>(0,q.fromEvent)(s,L))).subscribe(L=>{let z=s.currentTime;s.loop&&(0,q.isNonNullable)(p)&&(0,q.isNonNullable)(z)&&p>=s.duration-h&&z<=h&&c.next(p),p=z}));let f=e("pause").pipe((0,q.filter)(()=>!s.error&&p!==s.duration)),b=(0,q.fromEvent)(s,"enterpictureinpicture"),S=(0,q.fromEvent)(s,"leavepictureinpicture"),v=new q.ValueSubject(dS(s));t.add(b.subscribe(()=>v.next(!0))),t.add(S.subscribe(()=>v.next(!1)));let y=new q.ValueSubject(td(s)),x=(0,q.fromEvent)(s,"fullscreenchange");t.add(x.pipe((0,q.map)(()=>td(s))).subscribe(y));let w=.1,P=1e3,D=(0,q.fromEvent)(s,"timeupdate").pipe((0,q.map)(L=>s.duration-s.currentTime<w),(0,q.filterChanged)()),H=(0,q.merge)(D.pipe((0,q.filter)(L=>!s.loop&&L)),(0,q.fromEvent)(s,"ended")).pipe((0,q.throttle)(P),(0,q.mapTo)(void 0)),U=(0,q.merge)(...["waiting","pause","canplay","play","canplaythrough","playing","seeking","seeked","ended"].map(L=>(0,q.fromEvent)(s,L)),D.pipe((0,q.map)(L=>({type:L?"ended":"unknown"})))).pipe((0,q.map)(L=>ee.browser.isFirefox&&L.type==="ended"?s.readyState<2:s.readyState<3),(0,q.filterChanged)());return{playing$:a,pause$:f,canplay$:e("canplay"),ended$:H,looped$:c,error$:u,seeked$:e("seeked"),seeking$:e("seeking"),progress$:e("progress"),loadStart$:e("loadstart"),loadedMetadata$:e("loadedmetadata"),loadedData$:e("loadeddata"),timeUpdate$:l,durationChange$:(0,q.fromEvent)(s,"durationchange").pipe((0,q.map)(()=>s.duration)),isBuffering$:U,currentBuffer$:r,volumeState$:n,playbackRateState$:o,inPiP$:v,inFullscreen$:y,enterPip$:b,leavePip$:S,destroy:i}};var Ci=require("@vkontakte/videoplayer-shared/es2015"),fi=s=>{switch(s){case"mobile":return Ci.VideoQuality.Q_144P;case"lowest":return Ci.VideoQuality.Q_240P;case"low":return Ci.VideoQuality.Q_360P;case"sd":case"medium":return Ci.VideoQuality.Q_480P;case"hd":case"high":return Ci.VideoQuality.Q_720P;case"fullhd":case"full":return Ci.VideoQuality.Q_1080P;case"quadhd":case"quad":return Ci.VideoQuality.Q_1440P;case"ultrahd":case"ultra":return Ci.VideoQuality.Q_2160P}};var Tt=K(si(),1),ad=K(_t(),1),Pr=K(Sr(),1),C=require("@vkontakte/videoplayer-shared/es2015");var rd=!1,Vi={},PS=s=>{rd=s},AS=()=>{Vi={}},kS=s=>{s(Vi)},Ma=(s,e)=>{var t;rd&&(Vi.meta=(t=Vi.meta)!=null?t:{},Vi.meta[s]=e)},yt=class{constructor(e){this.name=e}next(e){var i,r;if(!rd)return;Vi.series=(i=Vi.series)!=null?i:{};let t=(r=Vi.series[this.name])!=null?r:[];t.push([Date.now(),e]),Vi.series[this.name]=t}};var Ge=require("@vkontakte/videoplayer-shared/es2015");function sd(s,e,t){return!s.max&&s.min===e?"high_quality":!s.min&&s.max===t?"traffic_saving":"unknown"}function tu(s,e,t){return!!s&&sd(s,e,t)==="high_quality"}function ts(s,e,t){return(0,Ge.isNullable)(s)||(0,Ge.isNonNullable)(s.min)&&(0,Ge.isNonNullable)(s.max)&&(0,Ge.isLower)(s.max,s.min)||(0,Ge.isNonNullable)(s.min)&&e&&(0,Ge.isHigher)(s.min,e)||(0,Ge.isNonNullable)(s.max)&&t&&(0,Ge.isLower)(s.max,t)}function RS({limits:s,highestAvailableHeight:e,lowestAvailableHeight:t}){return ts({max:s!=null&&s.max?(0,Ge.videoHeightToQuality)(s.max):void 0,min:s!=null&&s.min?(0,Ge.videoHeightToQuality)(s.min):void 0},e?(0,Ge.videoHeightToQuality)(e):void 0,t?(0,Ge.videoHeightToQuality)(t):void 0)}var DS=new yt("best_bitrate"),ru=(s,e,t)=>(e-t)*Math.pow(2,-10*s)+t;var is=s=>(e,t)=>s*(Number(e.bitrate)-Number(t.bitrate)),tr=class{constructor(){this.history={}}recordSelection(e){this.history[e.id]=(0,C.now)()}recordSwitch(e){this.last=e}clear(){this.last=void 0,this.history={}}},su='Assertion "ABR Tracks is empty array" failed',iu=new WeakMap,LS=new WeakMap,MS=new WeakMap,$a=(s,e,t,i)=>{var u;let r=[...e].sort(is(1)),a=[...t].sort(is(1)),n=a.filter(l=>(0,C.isNonNullable)(l.bitrate)&&(0,C.isNonNullable)(s.bitrate)?s.bitrate/l.bitrate>i:!0),o=(u=(0,Tt.default)(a,Math.round(a.length*r.indexOf(s)/(r.length+1))))!=null?u:(0,Tt.default)(a,-1);return o&&(0,ad.default)(n,o)?o:n.length?(0,Tt.default)(n,-1):(0,Tt.default)(a,0)},Ba=(s,e,t,i)=>{var u;let r=iu.get(e);r||(r=[...e].sort(is(1)),iu.set(e,r));let a=iu.get(t);a||(a=[...t].sort(is(1)),iu.set(t,a));let n=MS.get(s);n||(n=a.filter(l=>(0,C.isNonNullable)(l.bitrate)&&(0,C.isNonNullable)(s.bitrate)?s.bitrate/l.bitrate>i:!0),MS.set(s,n));let o=(u=(0,Tt.default)(a,Math.round(a.length*r.indexOf(s)/(r.length+1))))!=null?u:(0,Tt.default)(a,-1);return o&&(0,ad.default)(n,o)?o:n.length?(0,Tt.default)(n,-1):(0,Tt.default)(a,0)},$S=s=>"quality"in s,au=(s,e,t,i)=>{var n;let r=(0,C.isNonNullable)((n=i==null?void 0:i.last)==null?void 0:n.bitrate)&&(0,C.isNonNullable)(t==null?void 0:t.bitrate)&&i.last.bitrate<t.bitrate?s.trackCooldownIncreaseQuality:s.trackCooldownDecreaseQuality,a=t&&i&&i.history[t.id]&&(0,C.now)()-i.history[t.id]<=r&&(!i.last||t.id!==i.last.id);if(t!=null&&t.id&&i&&!a&&i.recordSelection(t),a&&(i!=null&&i.last)){let o=i.last;i==null||i.recordSwitch(o);let u=$S(o)?"video":"audio",l=$S(o)?o.quality:o.bitrate;return e({message:`
8
8
  [last ${u} selected] ${l}
9
9
  `}),o}return i==null||i.recordSwitch(t),t},YR=(s,e)=>Math.log(e)/Math.log(s),CS=({tuning:s,container:e,limits:t,panelSize:i})=>{let r=s.containerSizeFactor;if(i)return{containerSizeLimit:i,containerSizeFactor:r};if(s.usePixelRatio&&ee.display.pixelRatio){let a=ee.display.pixelRatio;if(s.pixelRatioMultiplier)r*=s.pixelRatioMultiplier*(a-1)+1;else{let n=s.pixelRatioLogBase,[o=0,u=0,l=0]=s.pixelRatioLogCoefficients,d=YR(n,o*a+u)+l;Number.isFinite(d)&&(r*=d)}}return tu(t,s.highQualityLimit,s.trafficSavingLimit)&&(r*=2),{containerSizeLimit:s.limitByContainer&&e&&e.width>0&&e.height>0?{width:e.width*r,height:e.height*r}:void 0,containerSizeFactor:r}},BS=new WeakMap,mi=(s,{container:e,estimatedThroughput:t,tuning:i,limits:r,reserve:a=0,forwardBufferHealth:n,playbackRate:o,current:u,history:l,visible:d,droppedVideoMaxQualityLimit:c,stallsVideoMaxQualityLimit:h,stallsPredictedThroughput:p,abrLogger:f,panelSize:b})=>{var Z,Q,de,B,F;(0,C.assertNotEmptyArray)(s,su);let{containerSizeFactor:S,containerSizeLimit:v}=CS({container:e,tuning:i,limits:r,panelSize:b}),y=i.considerPlaybackRate&&(0,C.isNonNullable)(o)?o:1,x=BS.get(s);x||(x=s.filter(V=>!(0,C.isInvariantQuality)(V.quality)).sort((V,$)=>(0,C.isHigher)(V.quality,$.quality)?-1:1),BS.set(s,x));let w=(Z=(0,Tt.default)(x,-1))==null?void 0:Z.quality,P=(Q=(0,Tt.default)(x,0))==null?void 0:Q.quality,D=ts(r,P,w),H=y*ru(n!=null?n:.5,i.bitrateFactorAtEmptyBuffer,i.bitrateFactorAtFullBuffer),j={},U=null;for(let V of x){let $=!0;if(v)if(V.size)$=V.size.width<=v.width&&V.size.height<=v.height;else{let rt=v&&(0,C.videoSizeToQuality)(v);$=rt?(0,C.isLowerOrEqual)(V.quality,rt):!0}if(!$){j[V.quality]="FitsContainer";continue}let G=p||t,we=(0,C.isNonNullable)(G)&&isFinite(G)&&(0,C.isNonNullable)(V.bitrate)?G-a>=V.bitrate*H:!0,it=tu(r,i.highQualityLimit,i.trafficSavingLimit)&&(r==null?void 0:r.min)===V.quality;if(!we&&!it){j[V.quality]="FitsThroughput";continue}if(i.lazyQualitySwitch&&(0,C.isNonNullable)(i.minBufferToSwitchUp)&&u&&!(0,C.isInvariantQuality)(u.quality)&&(n!=null?n:0)<i.minBufferToSwitchUp&&(0,C.isHigher)(V.quality,u.quality)){j[V.quality]="Buffer";continue}if(!!c&&(0,C.isHigherOrEqual)(V.quality,c)&&!it){j[V.quality]="DroppedFramesLimit";continue}if(!!h&&(0,C.isHigherOrEqual)(V.quality,h)&&!it){j[V.quality]="StallsLimit";continue}let Ue=D||((0,C.isNullable)(r==null?void 0:r.max)||(0,C.isLowerOrEqual)(V.quality,r.max))&&((0,C.isNullable)(r==null?void 0:r.min)||(0,C.isHigherOrEqual)(V.quality,r.min)),qe=(0,C.isNonNullable)(d)&&!d?(0,C.isLowerOrEqual)(V.quality,i.backgroundVideoQualityLimit):!0;if(!Ue||!qe){j[V.quality]="FitsQualityLimits";continue}U||(U=V)}U&&U.bitrate&&DS.next(U.bitrate);let L=(de=U!=null?U:(0,Tt.default)(x,-1))!=null?de:s[0],z=l==null?void 0:l.last,_=au(i,f,L,l);return(0,C.isNonNullable)(l)&&_.quality!==(z==null?void 0:z.quality)&&f({message:`
10
10
  [VIDEO TRACKS ABR]