@vkontakte/videoplayer-interactive 1.0.30-dev.d7235458.0 → 1.0.30-dev.df9dc719.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 +3 -3
- package/es2015.esm.js +3 -3
- package/es2018.cjs.js +3 -3
- package/es2018.esm.js +3 -3
- package/esnext.cjs.js +3 -3
- package/esnext.esm.js +3 -3
- package/evergreen.esm.js +3 -3
- package/package.json +4 -4
package/es2015.cjs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-interactive v1.0.30-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-interactive v1.0.30-dev.df9dc719.0
|
|
3
|
+
* Fri, 31 Jan 2025 12:47:27 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-30/doc/
|
|
5
5
|
*/
|
|
6
|
-
"use strict";var Fo=Object.create;var Le=Object.defineProperty,qo=Object.defineProperties,Bo=Object.getOwnPropertyDescriptor,Do=Object.getOwnPropertyDescriptors,Ho=Object.getOwnPropertyNames,ut=Object.getOwnPropertySymbols,Uo=Object.getPrototypeOf,er=Object.prototype.hasOwnProperty,vi=Object.prototype.propertyIsEnumerable;var yi=r=>{throw TypeError(r)};var mi=(r,e,t)=>e in r?Le(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,f=(r,e)=>{for(var t in e||(e={}))er.call(e,t)&&mi(r,t,e[t]);if(ut)for(var t of ut(e))vi.call(e,t)&&mi(r,t,e[t]);return r},I=(r,e)=>qo(r,Do(e));var X=(r,e)=>{var t={};for(var i in r)er.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&ut)for(var i of ut(r))e.indexOf(i)<0&&vi.call(r,i)&&(t[i]=r[i]);return t};var p=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Go=(r,e)=>{for(var t in e)Le(r,t,{get:e[t],enumerable:!0})},bi=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ho(e))!er.call(r,n)&&n!==t&&Le(r,n,{get:()=>e[n],enumerable:!(i=Bo(e,n))||i.enumerable});return r};var Z=(r,e,t)=>(t=r!=null?Fo(Uo(r)):{},bi(e||!r||!r.__esModule?Le(t,"default",{value:r,enumerable:!0}):t,r)),zo=r=>bi(Le({},"__esModule",{value:!0}),r);var gi=(r,e,t)=>e.has(r)||yi("Cannot "+t);var R=(r,e,t)=>(gi(r,e,"read from private field"),t?t.call(r):e.get(r)),H=(r,e,t)=>e.has(r)?yi("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),N=(r,e,t,i)=>(gi(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t);var Ci=(r,e,t,i)=>({set _(n){N(r,e,n,t)},get _(){return R(r,e,i)}});var k=(r,e,t)=>new Promise((i,n)=>{var s=a=>{try{c(t.next(a))}catch(l){n(l)}},o=a=>{try{c(t.throw(a))}catch(l){n(l)}},c=a=>a.done?i(a.value):Promise.resolve(a.value).then(s,o);c((t=t.apply(r,e)).next())});var J=p((cr,Ai)=>{"use strict";var $e=function(r){return r&&r.Math===Math&&r};Ai.exports=$e(typeof globalThis=="object"&&globalThis)||$e(typeof window=="object"&&window)||$e(typeof self=="object"&&self)||$e(typeof global=="object"&&global)||$e(typeof cr=="object"&&cr)||function(){return this}()||Function("return this")()});var U=p((Kh,Ri)=>{"use strict";Ri.exports=function(r){try{return!!r()}catch(e){return!0}}});var Ne=p((Qh,Oi)=>{"use strict";var Ko=U();Oi.exports=!Ko(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var ji=p((Yh,Vi)=>{"use strict";var Qo=Ne(),Mi=Function.prototype,Pi=Mi.apply,ki=Mi.call;Vi.exports=typeof Reflect=="object"&&Reflect.apply||(Qo?ki.bind(Pi):function(){return ki.apply(Pi,arguments)})});var K=p((Xh,Ni)=>{"use strict";var Li=Ne(),$i=Function.prototype,lr=$i.call,Yo=Li&&$i.bind.bind(lr,lr);Ni.exports=Li?Yo:function(r){return function(){return lr.apply(r,arguments)}}});var _e=p((Zh,Fi)=>{"use strict";var _i=K(),Xo=_i({}.toString),Zo=_i("".slice);Fi.exports=function(r){return Zo(Xo(r),8,-1)}});var ur=p((Jh,qi)=>{"use strict";var Jo=_e(),ec=K();qi.exports=function(r){if(Jo(r)==="Function")return ec(r)}});var G=p((ed,Bi)=>{"use strict";var pr=typeof document=="object"&&document.all;Bi.exports=typeof pr=="undefined"&&pr!==void 0?function(r){return typeof r=="function"||r===pr}:function(r){return typeof r=="function"}});var pe=p((td,Di)=>{"use strict";var tc=U();Di.exports=!tc(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var It=p((rd,Hi)=>{"use strict";var rc=Ne(),Et=Function.prototype.call;Hi.exports=rc?Et.bind(Et):function(){return Et.apply(Et,arguments)}});var hr=p(zi=>{"use strict";var Ui={}.propertyIsEnumerable,Gi=Object.getOwnPropertyDescriptor,ic=Gi&&!Ui.call({1:2},1);zi.f=ic?function(e){var t=Gi(this,e);return!!t&&t.enumerable}:Ui});var dr=p((nd,Wi)=>{"use strict";Wi.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var Qi=p((sd,Ki)=>{"use strict";var nc=K(),sc=U(),ac=_e(),fr=Object,oc=nc("".split);Ki.exports=sc(function(){return!fr("z").propertyIsEnumerable(0)})?function(r){return ac(r)==="String"?oc(r,""):fr(r)}:fr});var mr=p((ad,Yi)=>{"use strict";Yi.exports=function(r){return r==null}});var vr=p((od,Xi)=>{"use strict";var cc=mr(),lc=TypeError;Xi.exports=function(r){if(cc(r))throw new lc("Can't call method on "+r);return r}});var Fe=p((cd,Zi)=>{"use strict";var uc=Qi(),pc=vr();Zi.exports=function(r){return uc(pc(r))}});var Te=p((ld,Ji)=>{"use strict";var hc=G();Ji.exports=function(r){return typeof r=="object"?r!==null:hc(r)}});var Tt=p((ud,en)=>{"use strict";en.exports={}});var xt=p((pd,rn)=>{"use strict";var yr=Tt(),br=J(),dc=G(),tn=function(r){return dc(r)?r:void 0};rn.exports=function(r,e){return arguments.length<2?tn(yr[r])||tn(br[r]):yr[r]&&yr[r][e]||br[r]&&br[r][e]}});var sn=p((hd,nn)=>{"use strict";var fc=K();nn.exports=fc({}.isPrototypeOf)});var ln=p((dd,cn)=>{"use strict";var mc=J(),an=mc.navigator,on=an&&an.userAgent;cn.exports=on?String(on):""});var vn=p((fd,mn)=>{"use strict";var fn=J(),gr=ln(),un=fn.process,pn=fn.Deno,hn=un&&un.versions||pn&&pn.version,dn=hn&&hn.v8,Q,St;dn&&(Q=dn.split("."),St=Q[0]>0&&Q[0]<4?1:+(Q[0]+Q[1]));!St&&gr&&(Q=gr.match(/Edge\/(\d+)/),(!Q||Q[1]>=74)&&(Q=gr.match(/Chrome\/(\d+)/),Q&&(St=+Q[1])));mn.exports=St});var Cr=p((md,bn)=>{"use strict";var yn=vn(),vc=U(),yc=J(),bc=yc.String;bn.exports=!!Object.getOwnPropertySymbols&&!vc(function(){var r=Symbol("symbol detection");return!bc(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&yn&&yn<41})});var Er=p((vd,gn)=>{"use strict";var gc=Cr();gn.exports=gc&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Ir=p((yd,Cn)=>{"use strict";var Cc=xt(),Ec=G(),Ic=sn(),Tc=Er(),xc=Object;Cn.exports=Tc?function(r){return typeof r=="symbol"}:function(r){var e=Cc("Symbol");return Ec(e)&&Ic(e.prototype,xc(r))}});var In=p((bd,En)=>{"use strict";var Sc=String;En.exports=function(r){try{return Sc(r)}catch(e){return"Object"}}});var Tr=p((gd,Tn)=>{"use strict";var wc=G(),Ac=In(),Rc=TypeError;Tn.exports=function(r){if(wc(r))return r;throw new Rc(Ac(r)+" is not a function")}});var Sn=p((Cd,xn)=>{"use strict";var Oc=Tr(),Pc=mr();xn.exports=function(r,e){var t=r[e];return Pc(t)?void 0:Oc(t)}});var An=p((Ed,wn)=>{"use strict";var xr=It(),Sr=G(),wr=Te(),kc=TypeError;wn.exports=function(r,e){var t,i;if(e==="string"&&Sr(t=r.toString)&&!wr(i=xr(t,r))||Sr(t=r.valueOf)&&!wr(i=xr(t,r))||e!=="string"&&Sr(t=r.toString)&&!wr(i=xr(t,r)))return i;throw new kc("Can't convert object to primitive value")}});var On=p((Id,Rn)=>{"use strict";Rn.exports=!0});var Mn=p((Td,kn)=>{"use strict";var Pn=J(),Mc=Object.defineProperty;kn.exports=function(r,e){try{Mc(Pn,r,{value:e,configurable:!0,writable:!0})}catch(t){Pn[r]=e}return e}});var wt=p((xd,Ln)=>{"use strict";var Vc=On(),jc=J(),Lc=Mn(),Vn="__core-js_shared__",jn=Ln.exports=jc[Vn]||Lc(Vn,{});(jn.versions||(jn.versions=[])).push({version:"3.38.0",mode:Vc?"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 Ar=p((Sd,Nn)=>{"use strict";var $n=wt();Nn.exports=function(r,e){return $n[r]||($n[r]=e||{})}});var qe=p((wd,_n)=>{"use strict";var $c=vr(),Nc=Object;_n.exports=function(r){return Nc($c(r))}});var xe=p((Ad,Fn)=>{"use strict";var _c=K(),Fc=qe(),qc=_c({}.hasOwnProperty);Fn.exports=Object.hasOwn||function(e,t){return qc(Fc(e),t)}});var Rr=p((Rd,qn)=>{"use strict";var Bc=K(),Dc=0,Hc=Math.random(),Uc=Bc(1 .toString);qn.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+Uc(++Dc+Hc,36)}});var Be=p((Od,Dn)=>{"use strict";var Gc=J(),zc=Ar(),Bn=xe(),Wc=Rr(),Kc=Cr(),Qc=Er(),Se=Gc.Symbol,Or=zc("wks"),Yc=Qc?Se.for||Se:Se&&Se.withoutSetter||Wc;Dn.exports=function(r){return Bn(Or,r)||(Or[r]=Kc&&Bn(Se,r)?Se[r]:Yc("Symbol."+r)),Or[r]}});var zn=p((Pd,Gn)=>{"use strict";var Xc=It(),Hn=Te(),Un=Ir(),Zc=Sn(),Jc=An(),el=Be(),tl=TypeError,rl=el("toPrimitive");Gn.exports=function(r,e){if(!Hn(r)||Un(r))return r;var t=Zc(r,rl),i;if(t){if(e===void 0&&(e="default"),i=Xc(t,r,e),!Hn(i)||Un(i))return i;throw new tl("Can't convert object to primitive value")}return e===void 0&&(e="number"),Jc(r,e)}});var Pr=p((kd,Wn)=>{"use strict";var il=zn(),nl=Ir();Wn.exports=function(r){var e=il(r,"string");return nl(e)?e:e+""}});var Yn=p((Md,Qn)=>{"use strict";var sl=J(),Kn=Te(),kr=sl.document,al=Kn(kr)&&Kn(kr.createElement);Qn.exports=function(r){return al?kr.createElement(r):{}}});var Mr=p((Vd,Xn)=>{"use strict";var ol=pe(),cl=U(),ll=Yn();Xn.exports=!ol&&!cl(function(){return Object.defineProperty(ll("div"),"a",{get:function(){return 7}}).a!==7})});var es=p(Jn=>{"use strict";var ul=pe(),pl=It(),hl=hr(),dl=dr(),fl=Fe(),ml=Pr(),vl=xe(),yl=Mr(),Zn=Object.getOwnPropertyDescriptor;Jn.f=ul?Zn:function(e,t){if(e=fl(e),t=ml(t),yl)try{return Zn(e,t)}catch(i){}if(vl(e,t))return dl(!pl(hl.f,e,t),e[t])}});var rs=p((Ld,ts)=>{"use strict";var bl=U(),gl=G(),Cl=/#|\.prototype\./,De=function(r,e){var t=Il[El(r)];return t===xl?!0:t===Tl?!1:gl(e)?bl(e):!!e},El=De.normalize=function(r){return String(r).replace(Cl,".").toLowerCase()},Il=De.data={},Tl=De.NATIVE="N",xl=De.POLYFILL="P";ts.exports=De});var Vr=p(($d,ns)=>{"use strict";var is=ur(),Sl=Tr(),wl=Ne(),Al=is(is.bind);ns.exports=function(r,e){return Sl(r),e===void 0?r:wl?Al(r,e):function(){return r.apply(e,arguments)}}});var as=p((Nd,ss)=>{"use strict";var Rl=pe(),Ol=U();ss.exports=Rl&&Ol(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var cs=p((_d,os)=>{"use strict";var Pl=Te(),kl=String,Ml=TypeError;os.exports=function(r){if(Pl(r))return r;throw new Ml(kl(r)+" is not an object")}});var ps=p(us=>{"use strict";var Vl=pe(),jl=Mr(),Ll=as(),At=cs(),ls=Pr(),$l=TypeError,jr=Object.defineProperty,Nl=Object.getOwnPropertyDescriptor,Lr="enumerable",$r="configurable",Nr="writable";us.f=Vl?Ll?function(e,t,i){if(At(e),t=ls(t),At(i),typeof e=="function"&&t==="prototype"&&"value"in i&&Nr in i&&!i[Nr]){var n=Nl(e,t);n&&n[Nr]&&(e[t]=i.value,i={configurable:$r in i?i[$r]:n[$r],enumerable:Lr in i?i[Lr]:n[Lr],writable:!1})}return jr(e,t,i)}:jr:function(e,t,i){if(At(e),t=ls(t),At(i),jl)try{return jr(e,t,i)}catch(n){}if("get"in i||"set"in i)throw new $l("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var ds=p((qd,hs)=>{"use strict";var _l=pe(),Fl=ps(),ql=dr();hs.exports=_l?function(r,e,t){return Fl.f(r,e,ql(1,t))}:function(r,e,t){return r[e]=t,r}});var Ue=p((Bd,ms)=>{"use strict";var He=J(),Bl=ji(),Dl=ur(),Hl=G(),Ul=es().f,Gl=rs(),we=Tt(),zl=Vr(),Ae=ds(),fs=xe();wt();var Wl=function(r){var e=function(t,i,n){if(this instanceof e){switch(arguments.length){case 0:return new r;case 1:return new r(t);case 2:return new r(t,i)}return new r(t,i,n)}return Bl(r,this,arguments)};return e.prototype=r.prototype,e};ms.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,s=r.proto,o=i?He:n?He[t]:He[t]&&He[t].prototype,c=i?we:we[t]||Ae(we,t,{})[t],a=c.prototype,l,m,v,d,b,w,P,y,V;for(d in e)l=Gl(i?d:t+(n?".":"#")+d,r.forced),m=!l&&o&&fs(o,d),w=c[d],m&&(r.dontCallGetSet?(V=Ul(o,d),P=V&&V.value):P=o[d]),b=m&&P?P:e[d],!(!l&&!s&&typeof w==typeof b)&&(r.bind&&m?y=zl(b,He):r.wrap&&m?y=Wl(b):s&&Hl(b)?y=Dl(b):y=b,(r.sham||b&&b.sham||w&&w.sham)&&Ae(y,"sham",!0),Ae(c,d,y),s&&(v=t+"Prototype",fs(we,v)||Ae(we,v,{}),Ae(we[v],d,b),r.real&&a&&(l||!a[d])&&Ae(a,d,b)))}});var ys=p((Dd,vs)=>{"use strict";var Kl=Math.ceil,Ql=Math.floor;vs.exports=Math.trunc||function(e){var t=+e;return(t>0?Ql:Kl)(t)}});var Ge=p((Hd,bs)=>{"use strict";var Yl=ys();bs.exports=function(r){var e=+r;return e!==e||e===0?0:Yl(e)}});var Cs=p((Ud,gs)=>{"use strict";var Xl=Ge(),Zl=Math.min;gs.exports=function(r){var e=Xl(r);return e>0?Zl(e,9007199254740991):0}});var ze=p((Gd,Es)=>{"use strict";var Jl=Cs();Es.exports=function(r){return Jl(r.length)}});var Rt=p((zd,Is)=>{"use strict";Is.exports=function(){}});var Ts=p(()=>{"use strict";var eu=Ue(),tu=qe(),ru=ze(),iu=Ge(),nu=Rt();eu({target:"Array",proto:!0},{at:function(e){var t=tu(this),i=ru(t),n=iu(e),s=n>=0?n:i+n;return s<0||s>=i?void 0:t[s]}});nu("at")});var Ot=p((Qd,xs)=>{"use strict";var su=xt();xs.exports=su});var ws=p((Yd,Ss)=>{"use strict";Ts();var au=Ot();Ss.exports=au("Array","at")});var Rs=p((Xd,As)=>{"use strict";var ou=ws();As.exports=ou});var _r=p((Zd,Os)=>{"use strict";var cu=Rs();Os.exports=cu});var Us=p((nm,Hs)=>{"use strict";var Eu=Ar(),Iu=Rr(),Ds=Eu("keys");Hs.exports=function(r){return Ds[r]||(Ds[r]=Iu(r))}});var zs=p((sm,Gs)=>{"use strict";var Tu=U();Gs.exports=!Tu(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var Qs=p((am,Ks)=>{"use strict";var xu=xe(),Su=G(),wu=qe(),Au=Us(),Ru=zs(),Ws=Au("IE_PROTO"),Qr=Object,Ou=Qr.prototype;Ks.exports=Ru?Qr.getPrototypeOf:function(r){var e=wu(r);if(xu(e,Ws))return e[Ws];var t=e.constructor;return Su(t)&&e instanceof t?t.prototype:e instanceof Qr?Ou:null}});var Xs=p((om,Ys)=>{"use strict";var Pu=Ge(),ku=Math.max,Mu=Math.min;Ys.exports=function(r,e){var t=Pu(r);return t<0?ku(t+e,0):Mu(t,e)}});var Yr=p((cm,Js)=>{"use strict";var Vu=Fe(),ju=Xs(),Lu=ze(),Zs=function(r){return function(e,t,i){var n=Vu(e),s=Lu(n);if(s===0)return!r&&-1;var o=ju(i,s),c;if(r&&t!==t){for(;s>o;)if(c=n[o++],c!==c)return!0}else for(;s>o;o++)if((r||o in n)&&n[o]===t)return r||o||0;return!r&&-1}};Js.exports={includes:Zs(!0),indexOf:Zs(!1)}});var ta=p((lm,ea)=>{"use strict";ea.exports={}});var na=p((um,ia)=>{"use strict";var $u=K(),Xr=xe(),Nu=Fe(),_u=Yr().indexOf,Fu=ta(),ra=$u([].push);ia.exports=function(r,e){var t=Nu(r),i=0,n=[],s;for(s in t)!Xr(Fu,s)&&Xr(t,s)&&ra(n,s);for(;e.length>i;)Xr(t,s=e[i++])&&(~_u(n,s)||ra(n,s));return n}});var aa=p((pm,sa)=>{"use strict";sa.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var ca=p((hm,oa)=>{"use strict";var qu=na(),Bu=aa();oa.exports=Object.keys||function(e){return qu(e,Bu)}});var fa=p((dm,da)=>{"use strict";var ua=pe(),Du=U(),pa=K(),Hu=Qs(),Uu=ca(),Gu=Fe(),zu=hr().f,ha=pa(zu),Wu=pa([].push),Ku=ua&&Du(function(){var r=Object.create(null);return r[2]=2,!ha(r,2)}),la=function(r){return function(e){for(var t=Gu(e),i=Uu(t),n=Ku&&Hu(t)===null,s=i.length,o=0,c=[],a;s>o;)a=i[o++],(!ua||(n?a in t:ha(t,a)))&&Wu(c,r?[a,t[a]]:t[a]);return c}};da.exports={entries:la(!0),values:la(!1)}});var ma=p(()=>{"use strict";var Qu=Ue(),Yu=fa().values;Qu({target:"Object",stat:!0},{values:function(e){return Yu(e)}})});var ya=p((vm,va)=>{"use strict";ma();var Xu=Tt();va.exports=Xu.Object.values});var ga=p((ym,ba)=>{"use strict";var Zu=ya();ba.exports=Zu});var Dt=p((bm,Ca)=>{"use strict";var Ju=ga();Ca.exports=Ju});var Ta=p(()=>{"use strict";var ep=Ue(),tp=Yr().includes,rp=U(),ip=Rt(),np=rp(function(){return!Array(1).includes()});ep({target:"Array",proto:!0,forced:np},{includes:function(e){return tp(this,e,arguments.length>1?arguments[1]:void 0)}});ip("includes")});var Sa=p((xm,xa)=>{"use strict";Ta();var sp=Ot();xa.exports=sp("Array","includes")});var Aa=p((Sm,wa)=>{"use strict";var ap=Sa();wa.exports=ap});var Ht=p((wm,Ra)=>{"use strict";var op=Aa();Ra.exports=op});var ti=p((Hm,La)=>{"use strict";var lp=_e();La.exports=Array.isArray||function(e){return lp(e)==="Array"}});var Na=p((Um,$a)=>{"use strict";var up=TypeError,pp=9007199254740991;$a.exports=function(r){if(r>pp)throw up("Maximum allowed index exceeded");return r}});var qa=p((Gm,Fa)=>{"use strict";var hp=ti(),dp=ze(),fp=Na(),mp=Vr(),_a=function(r,e,t,i,n,s,o,c){for(var a=n,l=0,m=o?mp(o,c):!1,v,d;l<i;)l in t&&(v=m?m(t[l],l,e):t[l],s>0&&hp(v)?(d=dp(v),a=_a(r,e,v,d,a,s-1)-1):(fp(a+1),r[a]=v),a++),l++;return a};Fa.exports=_a});var Ha=p((zm,Da)=>{"use strict";var vp=Be(),yp=vp("toStringTag"),Ba={};Ba[yp]="z";Da.exports=String(Ba)==="[object z]"});var Ga=p((Wm,Ua)=>{"use strict";var bp=Ha(),gp=G(),Gt=_e(),Cp=Be(),Ep=Cp("toStringTag"),Ip=Object,Tp=Gt(function(){return arguments}())==="Arguments",xp=function(r,e){try{return r[e]}catch(t){}};Ua.exports=bp?Gt:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=xp(e=Ip(r),Ep))=="string"?t:Tp?Gt(e):(i=Gt(e))==="Object"&&gp(e.callee)?"Arguments":i}});var Wa=p((Km,za)=>{"use strict";var Sp=K(),wp=G(),ri=wt(),Ap=Sp(Function.toString);wp(ri.inspectSource)||(ri.inspectSource=function(r){return Ap(r)});za.exports=ri.inspectSource});var Ja=p((Qm,Za)=>{"use strict";var Rp=K(),Op=U(),Ka=G(),Pp=Ga(),kp=xt(),Mp=Wa(),Qa=function(){},Ya=kp("Reflect","construct"),ii=/^\s*(?:class|function)\b/,Vp=Rp(ii.exec),jp=!ii.test(Qa),nt=function(e){if(!Ka(e))return!1;try{return Ya(Qa,[],e),!0}catch(t){return!1}},Xa=function(e){if(!Ka(e))return!1;switch(Pp(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return jp||!!Vp(ii,Mp(e))}catch(t){return!0}};Xa.sham=!0;Za.exports=!Ya||Op(function(){var r;return nt(nt.call)||!nt(Object)||!nt(function(){r=!0})||r})?Xa:nt});var io=p((Ym,ro)=>{"use strict";var eo=ti(),Lp=Ja(),$p=Te(),Np=Be(),_p=Np("species"),to=Array;ro.exports=function(r){var e;return eo(r)&&(e=r.constructor,Lp(e)&&(e===to||eo(e.prototype))?e=void 0:$p(e)&&(e=e[_p],e===null&&(e=void 0))),e===void 0?to:e}});var so=p((Xm,no)=>{"use strict";var Fp=io();no.exports=function(r,e){return new(Fp(r))(e===0?0:e)}});var ao=p(()=>{"use strict";var qp=Ue(),Bp=qa(),Dp=qe(),Hp=ze(),Up=Ge(),Gp=so();qp({target:"Array",proto:!0},{flat:function(){var e=arguments.length?arguments[0]:void 0,t=Dp(this),i=Hp(t),n=Gp(t,0);return n.length=Bp(n,t,t,i,0,e===void 0?1:Up(e)),n}})});var oo=p(()=>{"use strict";var zp=Rt();zp("flat")});var lo=p((rv,co)=>{"use strict";ao();oo();var Wp=Ot();co.exports=Wp("Array","flat")});var po=p((iv,uo)=>{"use strict";var Kp=lo();uo.exports=Kp});var fo=p((nv,ho)=>{"use strict";var Qp=po();ho.exports=Qp});var nh={};Go(nh,{ContainerTypes:()=>C.ContainerTypes,ControlTypes:()=>C.ControlTypes,CustomError:()=>F,EVENT_NAMES:()=>O,EventActionTypes:()=>C.EventActionTypes,EventTypes:()=>C.EventTypes,Interactives:()=>ot,ManifestController:()=>ve,SDKInfo:()=>ih,chapterIdsToVKVideoIds:()=>Wt,compareVersions:()=>Ft,containerTypes:()=>hu,controlTypes:()=>du,eventActionTypes:()=>Dr,eventTypes:()=>fu,getChapterIdByVkVideoId:()=>jo,getVKVideoIdByMedia:()=>ai,getVideoRawIdByMedia:()=>Mo,graphEventTypes:()=>Pe,hasEndTemplate:()=>rt,interactivesEventTypes:()=>j,isAreaControl:()=>pu,isButtonControl:()=>uu,isLastChapter:()=>Y,isOneTextCtrlContainer:()=>me,isSupportedManifest:()=>C.isSupportedManifest,isTextControl:()=>Ze,isVKVariantItem:()=>Vo,isValidManifest:()=>Br,migrateManifestToLatestVersion:()=>C.migrateManifestToLatestVersion,utils:()=>_o,vkVideoIdsToChapterIds:()=>oi});module.exports=zo(nh);var Ei="1.0.30-dev.d7235458.0";function tr(r,e=1){let t="0",i="0",n="0";return r.length===4?(t="0x"+r[1]+r[1],i="0x"+r[2]+r[2],n="0x"+r[3]+r[3]):r.length===7&&(t="0x"+r[1]+r[2],i="0x"+r[3]+r[4],n="0x"+r[5]+r[6]),`rgba(${+t},${+i},${+n},${e})`}var D="interactive",Wo="interactive-controls-container",pt=()=>document.querySelector(`.${Wo}`),Ii=.4,B={textColor:"#000",textSize:.4,textContent:"",roundCorners:0,borderWidth:0,borderColor:"#000",borderAlpha:1,backgroundColor:"#fff",backgroundAlpha:1,innerSizesDependOn:"self",angle:0},Ti=(i=>(i.top="flex-start",i.bottom="flex-end",i.center="center",i))(Ti||{}),xi=(i=>(i.start="flex-start",i.end="flex-end",i.center="center",i))(xi||{}),Si=(i=>(i.start="left",i.end="right",i.center="center",i))(Si||{}),ht=({target:r,props:e})=>{var t,i,n;r.style.alignItems=(t=(e==null?void 0:e.gravityVertical)&&Ti[e.gravityVertical])!=null?t:"center",r.style.justifyContent=(i=(e==null?void 0:e.gravityHorizontal)&&xi[e.gravityHorizontal])!=null?i:"center",r.style.textAlign=(n=(e==null?void 0:e.alignment)&&Si[e.alignment])!=null?n:"left"},dt=({target:r,props:e,fallback:t,dependsOn:i})=>{var n,s,o,c,a,l;r.style.color=(s=(n=e==null?void 0:e.text)==null?void 0:n.color)!=null?s:t.textColor,r.style.fontSize=`calc(${i.height} * ${(c=(o=e==null?void 0:e.text)==null?void 0:o.size)!=null?c:t.textSize})`,r.textContent=(l=(a=e==null?void 0:e.text)==null?void 0:a.value)!=null?l:t.textContent},ft=({target:r,props:e,fallback:t})=>{var i,n,s,o;r.style.backgroundColor=tr((n=(i=e==null?void 0:e.background)==null?void 0:i.color)!=null?n:t.backgroundColor,(o=(s=e==null?void 0:e.background)==null?void 0:s.alpha)!=null?o:t.backgroundAlpha)},mt=({target:r,props:e,fallback:t,dependsOn:i})=>{var n,s,o,c,a,l,m,v,d,b,w;r.style.border=`calc(${i.height} * ${(o=(s=(n=e==null?void 0:e.shape)==null?void 0:n.border)==null?void 0:s.width)!=null?o:t.borderWidth}) solid ${tr((l=(a=(c=e==null?void 0:e.shape)==null?void 0:c.border)==null?void 0:a.color)!=null?l:t.borderColor,(d=(v=(m=e==null?void 0:e.shape)==null?void 0:m.border)==null?void 0:v.alpha)!=null?d:t.borderAlpha)}`,r.style.borderRadius=`calc(${i.height} * ${(w=(b=e==null?void 0:e.shape)==null?void 0:b.roundCorners)!=null?w:t.roundCorners})`},Ee=({target:r,layoutParams:e,fallback:t})=>{var n;let i=(n=e.angle)!=null?n:t.angle;i=i&&i*-1,r.style.transform=`rotate(${i}rad)`};var re=class{constructor(e){this.control=e;this.container=null;this.controlElement=null;this.clickListener=null}createContainerElement(e){var n;let t=document.createElement("div");t.classList.add(`${D}-control-container-${this.control.id}`),e(t,this.control.layoutParams);let i=((n=this.control.layoutParams.innerSizesDependOn)!=null?n:B.innerSizesDependOn)==="self"?{height:t.style.height,width:t.style.width}:{height:"var(--interactive-content-height)",width:"var(--interactive-content-width)"};this.container={element:t,dimensions:i}}createClickListener(e){return t=>{t.stopPropagation(),e()}}setEvents(e){!this.container||!this.control.events||this.control.events.forEach(t=>{var n;switch(t.type.trim().toLowerCase()){case"onclick":this.clickListener=this.createClickListener(()=>e({action:t.action,controlId:this.control.id,controlType:this.control.type})),(n=this.container)==null||n.element.addEventListener("click",this.clickListener);break;default:break}})}removeListeners(){var e,t;(e=this.container)!=null&&e.element&&this.clickListener&&((t=this.container)==null||t.element.removeEventListener("click",this.clickListener))}};var rr="int",ue=(i=>(i.AREA=`${rr}_area`,i.TEXT=`${rr}_text`,i.BUTTON=`${rr}_bttn`,i))(ue||{});var vt=r=>{if(r.type.trim().toLowerCase()==="area")return new ir(r)},ir=class extends re{constructor(e){super(e)}createView({parentElement:e,layoutCallback:t}){if(super.createContainerElement(t),!this.container)return;let i=document.createElement("button");i.type="button",i.classList.add(`${D}-${this.control.id}`),i.setAttribute("data-testid",ue.AREA),i.style.display="flex",i.style.width="100%",i.style.height="100%",i.style.cursor="pointer",ft({target:i,props:this.control.props,fallback:I(f({},B),{backgroundColor:"transparent"})}),mt({target:i,props:this.control.props,fallback:I(f({},B),{borderAlpha:0}),dependsOn:this.container.dimensions}),Ee({target:i,layoutParams:this.control.layoutParams,fallback:B}),this.container.element.append(i),e.append(this.container.element),this.controlElement=i}disable(){this.controlElement&&(this.controlElement.style.cursor="default")}enable(){this.controlElement&&(this.controlElement.style.cursor="pointer")}getElement(){return this.controlElement}};var yt=()=>{let r=document.createElement("span");return r.style.display="inline-block",r.style.whiteSpace="pre",r.style.overflow="hidden",r.style.textOverflow="ellipsis",r.style.maxWidth="100%",r.style.maxHeight="100%",r};var bt=r=>{if(r.type.trim().toLowerCase()==="button")return new nr(r)},nr=class extends re{constructor(e){super(e)}createView({parentElement:e,layoutCallback:t}){if(super.createContainerElement(t),!this.container)return;let i=document.createElement("button");i.type="button",i.classList.add(`${D}-${this.control.id}`),i.setAttribute("data-testid",ue.BUTTON),i.style.display="flex",i.style.width="100%",i.style.height="100%",i.style.cursor="pointer",i.style.fontFamily="inherit",Ee({target:i,layoutParams:this.control.layoutParams,fallback:B}),ft({target:i,props:this.control.props,fallback:B}),mt({target:i,props:this.control.props,fallback:B,dependsOn:this.container.dimensions}),ht({target:i,props:I(f({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let n=yt();dt({target:n,props:this.control.props,fallback:B,dependsOn:this.container.dimensions}),i.append(n),this.container.element.append(i),e.append(this.container.element),this.controlElement=i}disable(){this.controlElement&&(this.controlElement.style.cursor="default")}enable(){this.controlElement&&(this.controlElement.style.cursor="pointer")}getElement(){return this.controlElement}};var wi=r=>{if(r.type.trim().toLowerCase()==="text")return new sr(r)},sr=class extends re{constructor(e){super(e)}createView({parentElement:e,layoutCallback:t}){if(super.createContainerElement(t),!this.container)return;let i=document.createElement("div");i.classList.add(`${D}-${this.control.id}`),i.setAttribute("data-testid",ue.TEXT),i.style.display="flex",i.style.width="100%",i.style.height="100%",i.style.fontFamily="inherit",Ee({target:i,layoutParams:this.control.layoutParams,fallback:B}),ht({target:i,props:I(f({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let n=yt();dt({target:n,props:this.control.props,fallback:B,dependsOn:this.container.dimensions}),i.append(n),this.container.element.append(i),e.append(this.container.element),this.controlElement=i}disable(){}enable(){}getElement(){return this.controlElement}};var ar=class{constructor(e){this.layout=e}},gt=class extends ar{constructor(e){super(e)}setContainerLayout(e){e.style.position="relative"}setControlLayout(e,t){e.style.position="absolute",e.style.width=`calc(var(--interactive-content-width) * ${t.width})`,e.style.height=`calc(var(--interactive-content-height) * ${t.height})`,e.style.left=`calc(var(--interactive-content-width) * ${t.x} + ((var(--interactive-width) - var(--interactive-content-width)) / 2))`,e.style.top=`calc(var(--interactive-content-height) * ${t.y} + ((var(--interactive-height) - var(--interactive-content-height)) / 2))`}};var Ie=class{constructor(e){this.container=e,this.factories=new Map,this.controls=[],this.setControls()}addControlFactory(e,t){this.factories.set(e.trim().toLowerCase(),t),this.setControls()}removeControlFactory(e){this.factories.delete(e.trim().toLowerCase()),this.setControls()}setControls(){this.controls=this.chooseControls()}chooseControls(){var e;return((e=this.container.controls)==null?void 0:e.reduce((t,i)=>{let n=i.type.trim().toLowerCase(),s=this.factories.get(n);if(s){let o=s(i);if(o)return[...t,o]}return[...t]},[]))||[]}};var Ct=(r,e)=>{if(r.type.trim().toLowerCase()==="choice")return new or(r,e)},or=class extends Ie{constructor(e,t){super(e),this.rootElement=t!=null?t:pt(),this.layout=new gt(this.container.layout),this.isRemoved=!1,this.isDisabled=!1,this.addControlFactory("button",bt),this.addControlFactory("text",wi),this.addControlFactory("area",vt)}createView(e){let t=document.createElement("div");return t.classList.add(`${D}-${this.container.id}`),this.layout.setContainerLayout(t),this.controls.forEach(i=>{i.createView({parentElement:t,layoutCallback:this.layout.setControlLayout}),i.setEvents(e)}),this.rootElement.append(t),this.isRemoved=!1,t}hide(){let e=this.getElement();e&&(e.style.visibility="hidden")}show(){let e=this.getElement();e&&(e.style.visibility="visible")}enable(){let e=this.getElement();e&&(this.controls.forEach(t=>t.enable()),e.style.opacity="1",this.isDisabled=!1)}disable(){let e=this.getElement();e&&(this.controls.forEach(t=>t.disable()),e.style.opacity=`${Ii}`,this.isDisabled=!0)}removeView(e=!1){var t;(!this.isRemoved||e)&&(this.controls.forEach(i=>i.removeListeners()),(t=this.getElement())==null||t.remove(),this.isRemoved=!0)}fakeRemove(){this.isRemoved||(this.isRemoved=!0)}getElement(){return this.rootElement.querySelector(`.${D}-${this.container.id}`)}};var No=Z(_r(),1),T=require("@vkontakte/videoplayer-shared/es2015"),Ve=require("@vkontakte/videoplayer-statistics/es2015");var js=require("@vkontakte/videoplayer-shared/es2015");function We(r,e){let t;return(...i)=>{clearTimeout(t),t=setTimeout(()=>r(...i),e)}}var he=(r,e)=>Object.prototype.toString.call(r)===`[object ${e}]`,Ke=r=>he(r,"Object"),Pt=r=>he(r,"String"),kt=r=>he(r,"Array"),Mt=r=>he(r,"Number"),Ps=r=>he(r,"Function");var Fr=r=>Mt(r)&&!isNaN(r);var de=r=>Ke(r)&&Object.keys(r).length===0,qr=r=>kt(r)&&!r.length;var Qe=(r,e)=>Pt(r)&&(e?r.trim():r).length;var ks="video_interactive",Ms="videoint";var Vs=250,Ye=class{constructor(e){this.handleZoomChange=We(e=>{this.lastZoomInfo=e},Vs);this.onResize=e=>{var i;if(!this.isReady||this.isHidden||!e[0].contentRect.width||!e[0].contentRect.height)return;let t=this.getNextPoint();t&&((i=this.ngEditor)==null||i.zoomTo(t)),this.ngEditorSize={width:e[0].contentRect.width,height:e[0].contentRect.height}};this.handleChapterChange=e=>{var t,i,n;if(this.manifest){if(this.isHidden||this.hide(),!(e!=null&&e.id)){(t=this.onError)==null||t.call(this,"Id is not found"),console.error("Id is not found");return}this.visitedChapterIds.add(e.id),(i=this.ngEditor)==null||i.selectChapter(e.id),(n=this.ngEditor)==null||n.setVisitedChapters(Array.from(this.visitedChapterIds)),this.currentChapterId=e.id,this.lastZoomInfo=null}};this.handleManifestChange=(e,t=[])=>{var i;if(this.isReady=!1,!Mt(e.graph.edit.chapters[0].x)){(i=this.onError)==null||i.call(this,"Can't show graph"),console.error("Can't show graph");return}this.lastZoomInfo=null,this.manifest=e,this.visitedChapterIds=new Set(t),this.ngEditor&&(this.manifest.metadata.id!==this.currentManifestId?(this.ngEditor.update(e),this.currentManifestId=this.manifest.metadata.id):this.ngEditor.setVisitedChapters(Array.from(t)),this.isReady=!0)};this.init(e)}init({root:e,onOpenPreviewClick:t,onError:i,lang:n,visitedChapters:s=[]}){this.isReady=!1,this.isHidden=!0,this.manifest=null,this.visitedChapterIds=new Set(s),this.onOpenPreviewClick=t,this.onError=i,this.lang=n!=null?n:"ru",this.zoom=.7,this.lastZoomInfo=null,this.currentManifestId=null,this.currentChapterId=null,this.ngEditor=null,this.ngEditorSize=null,this.graphWrapperElement=lu(e),this.resizeObserver=new ResizeObserver(We(this.onResize,Vs)),this.resizeObserver.observe(this.graphWrapperElement)}getNextPoint(e=this.ngEditorSize){return!this.lastZoomInfo||!e?null:[(this.lastZoomInfo.x-e.width/2)/this.lastZoomInfo.value*-1,(this.lastZoomInfo.y-e.height/2)/this.lastZoomInfo.value*-1]}setVisitedChapters(e){var t;this.visitedChapterIds=new Set([...this.visitedChapterIds,...e]),(t=this.ngEditor)==null||t.setVisitedChapters(Array.from(this.visitedChapterIds))}updateVideosInfo(e){var t;(t=this.ngEditor)==null||t.updateVideosInfo(e)}show(){return k(this,null,function*(){var e;this.manifest&&(this.ngEditor||(yield this.initNgEditor()),this.graphWrapperElement.style.display="block",!this.lastZoomInfo&&this.currentChapterId&&((e=this.ngEditor)==null||e.focusChapter(this.currentChapterId)),this.isHidden=!1)})}initNgEditor(){return k(this,null,function*(){if(!this.manifest)return;let e;try{e=yield(0,js.loadVKLangPack)(this.lang,ks,Ms)}catch(i){console.log("Unable to load graph language pack")}let{GraphEditor:t}=yield import("@interactiveplatform/movika-graph-editor");this.ngEditor=new t(this.graphWrapperElement,{mode:"read",lang:this.lang==="ru"?"ru":"en",translation:e}),this.currentManifestId=this.manifest.metadata.id,this.ngEditor.update(this.manifest),this.ngEditor.setVisitedChapters(Array.from(this.visitedChapterIds)),this.currentChapterId&&this.ngEditor.selectChapter(this.currentChapterId),this.ngEditor.on("control",s=>{var o=s,{name:i}=o,n=X(o,["name"]);var c;i==="openPreview"&&"chapterId"in n&&((c=this.onOpenPreviewClick)==null||c.call(this,n.chapterId))}),this.ngEditor.on("zoom",this.handleZoomChange),this.isReady=!0})}hide(){this.graphWrapperElement.style.display="none",this.isHidden=!0}destroy(){var e,t;this.hide(),this.manifest=null,this.resizeObserver.disconnect(),(e=this.ngEditor)==null||e.setVisitedChapters([]),this.onOpenPreviewClick=void 0,(t=this.ngEditor)==null||t.dispose(),this.graphWrapperElement.remove(),this.isReady=!1}};function lu(r){let e=document.createElement("div");return e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.height="100%",e.style.width="100%",e.style.display="none",r.append(e),e}var Xe=class{constructor(){this._containers=[];this._player=null;this.setPlayer=e=>{this._player=e};this.setContainers=e=>{this._containers=e};this.deleteContainer=e=>{this._containers=this._containers.filter(t=>t.id!==e)};this.getNextInteractiveTime=(e=3e3)=>{if(!this._containers.length||this._player===null)return null;let t=-1,i=!1,n=Math.round(this._player.info.position$.getValue()*1e3);for(let s of this._containers){let o=s.startTime-e;if(o<=n&&(s.endTime&&n<=s.endTime||s.endTime===null)){i=!0;break}n<o&&(t=t===-1?o:Math.min(t,o))}return!i&&t!==-1?t:null}}};var C=require("@interactiveplatform/movika-manifest");var Ls={metadata:"Object",chapters:"Array"},Br=r=>{if(!Ke(r))return!1;for(let e in Ls)if(!r[e]||!he(r[e],Ls[e]))return!1;return(0,C.isSupportedManifest)(r.metadata.version)},Ze=r=>r.type===C.ControlTypes.Text,uu=r=>r.type===C.ControlTypes.Button,pu=r=>r.type===C.ControlTypes.Area,hu={Choice:"Choice",TextInput:"TextInput"},du={Button:"Button",Area:"Area",Text:"Text"},fu={onClick:"onClick",onSuspense:"onSuspense"},Dr={openURI:"openURI",setNextBranch:"setNextBranch",setWeightlessRandomBranch:"setWeightlessRandomBranch",setRandomBranch:"setRandomBranch",setMaxWeightBranch:"setMaxWeightBranch",setMinWeightBranch:"setMinWeightBranch",setDefaultBranch:"setDefaultBranch",continuePlayback:"continuePlayback",expect:"expect"};var F=class{constructor(e,t,...i){this.severity=e;this.category=t;this.data=i}toString(){return`Interactive SDK error ${JSON.stringify(this,null," ")}`}};var Vt=class{constructor(){this.listeners={}}addListener(e,t){return this.listeners[e]=this.listeners[e]||[],this.listeners[e].push(t),this}on(e,t){return this.addListener(e,t)}once(e,t){this.listeners[e]=this.listeners[e]||[];let i=()=>{t(),this.off(e,i)};return this.listeners[e].push(i),this}off(e,t){return this.removeListener(e,t)}reset(){this.listeners={}}removeListener(e,t){let i=this.listeners[e]||[];for(let n=i.length;n>0;n--)if(i[n]===t){i.splice(n,1);break}return this}emit(e,...t){let i=this.listeners[e];return i?(i.forEach(n=>{n(...t)}),!0):!1}listenerCount(e){return this.rawListeners(e).length}rawListeners(e){return this.listeners[e]||[]}};var jt=class{constructor(e){this.fns=[];this.addFn=(e,t=!1)=>{Ps(e)&&(this.fns.push(e),t&&this.updateFn())};this.removeFn=(e,t=!1)=>{this.fns=this.fns.filter(i=>i!==e),t&&this.updateFn()};this.updateFn=()=>{this.fn=()=>{this.fns.forEach(e=>e()),this.raf&&this.forceRequestAnimation()}};this.forceRequestAnimation=()=>{this.fn&&(this.raf=requestAnimationFrame(this.fn))};this.requestAnimation=()=>{this.raf||this.forceRequestAnimation()};this.cancelAnimation=()=>{this.raf&&(cancelAnimationFrame(this.raf),this.raf=void 0)};e&&(this.fn=e,this.addFn(e))}release(){this.cancelAnimation(),this.fn=void 0,this.fns=[]}};var Bs=require("@vkontakte/videoplayer-shared/es2015");var Lt=class{constructor(e){var t,i;this.loaders={chapterLoaders:(t=e==null?void 0:e.chapterLoaders)!=null?t:[],manifestLoaders:(i=e==null?void 0:e.manifestLoaders)!=null?i:[]}}exec(e,t){return k(this,null,function*(){return mu(...this.loaders[e])(t)})}};function mu(...r){return function(t){return k(this,null,function*(){let i=[...r];for(;i.length>0;)t=yield i.shift()(t);return t})}}function Je(r,e,t){return r?I(f({},r),{[e]:r[e]?[t,...r[e]]:[t]}):{[e]:[t]}}function $t(n){var s=n,{actions:r,errors:e,chapterId:t}=s,i=X(s,["actions","errors","chapterId"]);if(t){let o=r.getManifest(),c=r.getChapter(o.chapters,t);if(c){let a=r.getMedia(o.media,c.videoId),l=r.getGraph(o.graph,c.id);return a?I(f({},i),{actions:r,errors:e,result:{chapter:c,media:a,graph:l}}):I(f({},i),{errors:Je(e,$t.name,"Could not find media"),actions:r})}}return I(f({},i),{errors:Je(e,$t.name,"Could not find chapter"),actions:r})}var Nt=class{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(e,t,i){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:t,options:i})}removeEventListener(e,t){if(!(e in this.listeners))return;let i=this.listeners[e];for(let n=0,s=i.length;n<s;n++)if(i[n].callback===t){i.splice(n,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let i=this.listeners[e.type].slice();for(let n=0,s=i.length;n<s;n++){let o=i[n];try{o.callback.call(this,e)}catch(c){Promise.resolve().then(()=>{throw c})}o.options&&o.options.once&&this.removeEventListener(e.type,o.callback)}return!e.defaultPrevented}},Re=class extends Nt{constructor(){super(),this.listeners||Nt.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(e){e.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,e)),super.dispatchEvent(e)}},et=class{constructor(){Object.defineProperty(this,"signal",{value:new Re,writable:!0,configurable:!0})}abort(e){let t;try{t=new Event("abort")}catch(n){typeof document!="undefined"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}let i=e;if(i===void 0)if(typeof document=="undefined")i=new Error("This operation was aborted"),i.name="AbortError";else try{i=new DOMException("signal is aborted without reason")}catch(n){i=new Error("This operation was aborted"),i.name="AbortError"}this.signal.reason=i,this.signal.dispatchEvent(t)}toString(){return"[object AbortController]"}};typeof Symbol!="undefined"&&Symbol.toStringTag&&(et.prototype[Symbol.toStringTag]="AbortController",Re.prototype[Symbol.toStringTag]="AbortSignal");function _t(r){return r.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof r.Request=="function"&&!r.Request.prototype.hasOwnProperty("signal")||!r.AbortController}function Hr(r){typeof r=="function"&&(r={fetch:r});let{fetch:e,Request:t=e.Request,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:n=!1}=r;if(!_t({fetch:e,Request:t,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:n}))return{fetch:e,Request:s};let s=t;(s&&!s.prototype.hasOwnProperty("signal")||n)&&(s=function(l,m){let v;m&&m.signal&&(v=m.signal,delete m.signal);let d=new t(l,m);return v&&Object.defineProperty(d,"signal",{writable:!1,enumerable:!1,configurable:!0,value:v}),d},s.prototype=t.prototype);let o=e;return{fetch:(a,l)=>{let m=s&&s.prototype.isPrototypeOf(a)?a.signal:l?l.signal:void 0;if(m){let v;try{v=new DOMException("Aborted","AbortError")}catch(b){v=new Error("Aborted"),v.name="AbortError"}if(m.aborted)return Promise.reject(v);let d=new Promise((b,w)=>{m.addEventListener("abort",()=>w(v),{once:!0})});return l&&l.signal&&delete l.signal,Promise.race([d,o(a,l)])}return o(a,l)},Request:s}}var tt=_t({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),$s=tt?Hr({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,Ur=tt?$s.fetch:window.fetch,$f=tt?$s.Request:window.Request,Nf=tt?et:window.AbortController,_f=tt?Re:window.AbortSignal;var Ft=(r="",e="")=>{let t=r.split("."),i=e.split("."),n=0;for(let s=0;s<Math.max(t.length,i.length)&&!n;s++)t[s]>i[s]?n=1:t[s]<i[s]?n=-1:n=0;return n};var vu=r=>k(void 0,null,function*(){try{let e={},t;if(Pt(r)){t=new URL(r).href;let n=yield Ur(t);if(!n.ok)return{};e=yield n.json()}else if(Ke(r))e=r;else return{};if(!Br(e))return{};let i=e.metadata.media;if(Pt(i)&&!("media"in e))try{let n;t?n=new URL(i,t).href:(n=new URL(i).href,t=n);let s=yield Ur(n);if(!s.ok)throw new Error;e.metadata.media=yield s.json()}catch(n){return gu(e.metadata.version)?{manifest:e}:{}}return{manifest:e,manifestURL:t}}catch(e){return{}}});function Ns(r){return k(this,null,function*(){let{manifest:e,manifestURL:t}=yield vu(r);if(!e)throw new Error("Failed on fetch");let i=(0,C.migrateManifestToLatestVersion)(e);return i.media=yu(i.media,t),delete i.metadata.media,i})}function qt(r,e){if(e)return r.find(t=>t.id===e)}function Gr(r,e){var t,i;return(t=r.edit)!=null&&t.chapters?r.edit.chapters.find(n=>n.id===e):(i=r.view)!=null&&i.chapters?r.view.chapters.find(n=>n.id===e):void 0}function zr(r,e){return r.videos.find(t=>t.id===e)}function yu(r,e){return I(f({},r),{videos:r.videos.map(t=>I(f({},t),{variants:t.variants.map(i=>{let n="url"in i?i.url:"",s=bu(n,e);return I(f({},i),{url:s||n})})}))})}function bu(r="",e){try{return new URL(r,e).href}catch(t){return""}}function gu(r){return Ft(r,"3.2.0")>=0}var Bt=r=>kt(r)&&!qr(r),Y=r=>r.order==="end",rt=r=>kt(r.containers)&&!qr(r.containers)&&Y(r),_s=(r,e)=>{var i;let t=r*1e3;return Bt(e.controls)&&t<((i=e.startTime)!=null?i:0)},Wr=(r,e)=>{var i,n;let t=r*1e3;return Bt(e.controls)&&t>=((i=e.startTime)!=null?i:0)&&t<=((n=e.endTime)!=null?n:1/0)};var fe=(r=[])=>r.some(e=>e.action.type==="expect"),Kr=(r=[])=>r.find(e=>e.action.type==="expect"),Cu=r=>(r==null?void 0:r.length)===1,me=r=>Cu(r)&&Ze(r[0]);function Fs(r,...e){return t=>typeof e[0]=="object"&&typeof t=="object"?r(f(f({},e[0]),t)):r(...e,...t)}var qs=(r,e)=>{let t=d=>{let b=e.find(({container:w})=>w.container.id===d);return b==null?void 0:b.container.isRemoved},i=fe(r.events)&&!t(r.id),n=(d,b=!1,w=!1)=>{let P=w?"every":"some";return d.controls[P](y=>{var $;let V=b?d.endTime===r.endTime:!0;return(($=y.events)==null?void 0:$[P](u=>{var h;return((h=u.action)==null?void 0:h.type)===Dr.openURI}))&&V})},s=d=>d.some(({container:b})=>n(b.container,!0,!1)&&!b.isRemoved),o=d=>d.every(({container:b})=>b.isRemoved?!0:n(b.container,!0,!0)),c=e.filter(({container:d})=>d.container.id!==r.id&&fe(d.container.events)&&d.container.endTime===r.endTime&&!d.isRemoved).length,a=i||c>0,l=s(e),m=n(r),v=o(e);return{isExpectTime:a,hasOtherExpect:c>0,hasOpenURIEvent:l,hasOpenURIEventInCurrentContainer:m,isAllOpenURIEventsValid:v}};var ve=class extends Lt{constructor(t,i){super(t);this.manifest=null;this.chapter=null;this.media=null;this.graph=null;this.prevChapter$=new Bs.ValueSubject(null);this.onError=i,this.release()}release(){return this.manifest=null,this.chapter=null,this.media=null,this.graph=null,this.prevChapter$.next(null),this}setManifest(t){return k(this,null,function*(){var n;this.release();let i=yield this.exec("manifestLoaders",{actions:{addErrorMessage:Je},result:null,errors:null,source:t});return i.errors&&this.errorHandler(i.errors),this.manifest=yield Ns((n=i.result)!=null?n:t),this})}setInitial(){return k(this,null,function*(){return this.setNext()})}setNext(){return k(this,arguments,function*(t=(i=>(i=this.manifest)==null?void 0:i.metadata.initChapterId)()){if(!t)return this;this.prevChapter$.next(this.chapter);let n=yield this.exec("chapterLoaders",$t({actions:{getManifest:()=>this.manifest,getCurrent:this.getCurrent,getGraph:Gr,getChapter:qt,getMedia:zr,getByBranches:this.getByBranches.bind(this),addErrorMessage:Je},result:null,errors:null,chapterId:t}));return n.errors&&this.errorHandler(n.errors),this.chapter=n.result.chapter,this.media=n.result.media,this.graph=n.result.graph,this})}errorHandler(t){this.onError(t),console.error("Something went wrong with loaders",{errors:t})}getInitial(){var i;return this.getByChapterId((i=this.manifest)==null?void 0:i.metadata.initChapterId)||null}getByChapterId(t=(i=>(i=this.manifest)==null?void 0:i.metadata.initChapterId)()){if(!t||!this.manifest)return null;let n=qt(this.manifest.chapters,t);if(n){let s=zr(this.manifest.media,n.videoId),o=Gr(this.manifest.graph,n.id);if(s)return{chapter:n,media:s,graph:o}}return null}getBranches(t=(i=>(i=this.chapter)==null?void 0:i.id)()){var n,s,o;if(t===((n=this.chapter)==null?void 0:n.id))return this.getByBranches((s=this.chapter)==null?void 0:s.branches);{let c=qt(((o=this.manifest)==null?void 0:o.chapters)||[],t);return this.getByBranches(c==null?void 0:c.branches)}}getByBranches(t=[]){return t.reduce((i,n)=>{let s=this.getByChapterId(n.chapterId);return s&&i.push(s),i},[])}getCurrent(){return{chapter:this.chapter,media:this.media,graph:this.graph}}isInitialChapter(){var t,i;return((t=this.chapter)==null?void 0:t.id)===((i=this.manifest)==null?void 0:i.metadata.initChapterId)}isEndChapter(){return this.chapter?Y(this.chapter):!1}};var Oa=Z(Dt(),1),Pa=require("@vkontakte/videoplayer-core/es2015"),ce=require("@vkontakte/videoplayer-shared/es2015");var Ea=r=>{let e=r.variants.find(t=>{var i;return((i=t.payload)==null?void 0:i.type)==="vk"});if(e&&e.payload){let[t,i]=e.payload.id.split("_");return[t,i]}return[]};var Ia=Z(Dt(),1);function Zr(){let r=new Map;function e(a){var l=a,{listId:s=Math.random().toString(),itemId:o=Math.random().toString()}=l,c=X(l,["listId","itemId"]);let m=r.get(s),v=f({},c);return m?m[o]=v:r.set(s,{[o]:v}),f({listId:s,itemId:o},c)}function t(s){var o,c;s.player.destroy(),s.container.remove(),s.subscription.unsubscribe(),(o=s.statistics)==null||o.oneStat.destroy(),(c=s.statistics)==null||c.statSubscription.unsubscribe()}function i(s,o){let c=r.get(s);if(!c)throw Error("Can't remove. Not find.");if(o){let a=c[o];a&&t(a),delete c[o],Object.keys(c).length||r.delete(s)}else{for(let a of(0,Ia.default)(c))t(a);r.delete(s)}}function n(){for(let s of r)i(s[0])}return{createPlayer:e,removePlayer:i,map:r,removeAll:n}}var Oe=Z(Ht(),1);function Jr(r,e=[]){var s,o,c;let t={},i,n=!e.length;for(let a of r.variants)if(!i&&"cover"in a&&(i=a.cover),"url"in a)switch(a.type.toLowerCase()){case"mp4":(n||(0,Oe.default)(e,"mp4"))&&(t.MPEG=I(f({},t.MPEG),{[(s=a.standard)!=null?s:"Invariant quality"]:a.url}));break;case"mpeg":(n||(0,Oe.default)(e,"mpeg"))&&(t.MPEG=I(f({},t.MPEG),{[(o=a.standard)!=null?o:"Invariant quality"]:a.url}));break;case"hls":(n||(0,Oe.default)(e,"hls"))&&(t=I(f({},t),{HLS:{type:"url",url:a.url}}));break;case"dash":(n||(0,Oe.default)(e,"dash"))&&(t=I(f({},t),{DASH_SEP:{compatibilityMode:!0,type:"url",url:a.url}}));break;default:break}return{sources:t,thumbUrl:i,title:(c=r.title)!=null?c:""}}var it=(r,e)=>{let t=r.info.currentQuality$.getValue(),i=r.info.availableQualities$.getValue();t!==e&&(0,Oe.default)(i,e)&&(r.setQuality(e),r.setAutoQuality(!1))};var cp=2;function ei(r){let e=Zr(),t=new ce.Subscription,i={},n=null,s=!1,o,c=new ce.ValueSubject(null);r&&a(r);function a(y){n=y}function l(y,V,$){var g;if(!n)throw Error("need to set interactive controller");if(!n.options)return;let h=((g=e.map.get(y))!=null?g:{})[V];if(h){i=f({chapterId:$,listId:y,itemId:V},h);let x=i.player;i.subscription.add(x.info.currentQuality$.subscribe(S=>{let L=x.info.position$.getValue(),M=x.info.isAutoQualityEnabled$.getValue();if(!(!S||!L||M))for(let E of e.map)(0,Oa.default)(E[1]).forEach(({player:A})=>{it(A,S)})})).add(x.events.started$.subscribe(()=>{m(V)})),h.container.remove(),n.setPlayer(h.player),s||(n.init(),s=!0),c.next({player:i.player,config:i.config,statistics:i.statistics});return}throw Error("Can't set. Not find.")}function m(y){return k(this,null,function*(){if(!n)throw Error("need to set interactive controller");if(de(i)||y!==i.itemId)return;let V=n.getChapterBranches(),$=new Set;for(let u of V)$.has(u.media.id)||(yield d({media:u.media,chapterId:u.chapter.id,setAsActive:!1,title:u.chapter.label}),$.add(u.media.id))})}function v($){return k(this,arguments,function*({chapter:{id:y},manifestVideo:V}){if(de(i)||!n)return;let u=i.player.info.muted$.getValue(),h=i.player.info.currentQuality$.getValue(),g=i.player.info.isAutoQualityEnabled$.getValue(),x=i.player.info.volume$.getValue(),S=i.player.info.currentPlaybackRate$.getValue(),L=!g,M=!1;for(let E of e.map)if(E[0]===V.id&&!n.state.isReplay$.getValue()){let A=Object.keys(E[1]);for(let _ of A)_===i.itemId?(A.length<cp||(M=!0),e.removePlayer(E[0],_)):(M=!0,l(E[0],_,y),L?it(i.player,h):i.player.setAutoQuality(!0),i.player.setVolume(x),i.player.setMuted(u),i.player.setPlaybackRate(S))}else e.removePlayer(E[0]);M||(yield d({media:V,chapterId:y,setAsActive:!0,playbackRate:S}),L?it(i.player,h):i.player.setAutoQuality(!0),i.player.setVolume(x),i.player.setMuted(u))})}function d(L){return k(this,arguments,function*({media:y,chapterId:V,prefetch:$=!0,setAsActive:u=!0,autoplay:h=!1,preferredExt:g,title:x,playbackRate:S}){var li,ui,pi,hi,di;let M=Math.random().toString(),E=document.createElement("div");o.append(E);let A;if((li=n==null?void 0:n.options)!=null&&li.vkVideoLoader){let lt=Ea(y);lt.length&&(A=yield n.options.vkVideoLoader(...lt))}let _=((ui=n==null?void 0:n.options)==null?void 0:ui.coreConfig)||void 0,ae=I(f({},_),{configName:[...(pi=_==null?void 0:_.configName)!=null?pi:[],"interactive"]}),te=I(f({container:E},((hi=A==null?void 0:A.videos)==null?void 0:hi[0])||{sources:Jr(y,g).sources}),{title:x,failoverHosts:(A==null?void 0:A.failoverHosts)||[]}),q=new Pa.Player(ae,ce.Tracer.createRootTracer());q.initVideo(te);let le=null;if(A!=null&&A.videos&&(n!=null&&n.options.createOneStat)){let lt=A.videos[0],Jt=n.options.createOneStat(lt),fi=new ce.Subscription;Jt&&(fi.add(Jt.attachTo(q)),le={oneStat:Jt,statSubscription:fi})}let ct=new ce.Subscription,je=(di=i==null?void 0:i.player)==null?void 0:di.info.isAutoQualityEnabled$.getValue();ct.add(q.events.canplay$.subscribe(function(){je||it(q,i.player.info.currentQuality$.getValue()),S&&q.setPlaybackRate(S)}));let oe=e.createPlayer({listId:y.id,itemId:M,player:q,container:E,sources:Jr(y,g).sources,config:te,subscription:ct,statistics:le});return u&&l(y.id,oe.itemId,V),h&&oe.player.play(),$&&!h&&oe.player.prepare(),{player:oe.player,config:oe.config,statistics:oe.statistics}})}function b(){w(),n=null,o.remove()}function w(){t.unsubscribe(),e.removeAll(),i={},s=!1}function P(){return k(this,null,function*(){if(!n)throw Error("need to set interactive controller");w(),o=document.createElement("div");let{media:y,chapter:V}=n.getCurrentChapter();y&&V?(t.add(n.events.chapterChanged$.subscribe(v)),yield d({media:y,chapterId:V.id,title:V.label})):console.error("not found")})}return I(f({},e),{init:P,setInteractiveController:a,createPlayer:d,removeAll:b,getActivePlayer:function(){return i},activePlayerChanged:c})}var O={graph:"graph",interactives:"interactives",chapterChanged:"chapter-changed",playerChanged:"player-changed",manifestChanged:"manifest-changed",errors:"errors",eachTick:"eachTick",historyInited:"history-inited",historyDestroyed:"history-destroyed"},Pe={visibility:"visibility",watchAgainClicked:"watchAgainClicked"},j={actionChoiceCanceled:"action-choice-canceled",actionChoice:"action-choice",actionExecution:"action-execution",visibility:"visibility",containerRemoved:"container-removed",containerFakeRemoved:"container-fake-removed",rangeEnded:"range-ended"};var Ma=Z(Ht(),1),Va=require("@vkontakte/videoplayer-shared/es2015");var Ut=class{constructor({player:e,container:t,branches:i,selectBranches:n,interactiveEvents:s,globalEvents:o,globalEventEmitter:c,getContainerEventState:a,permanentTextControls:l,interactiveTimeOpenUri:m,disabledControls$:v,onRemove:d}){this.hide=()=>{setTimeout(()=>{var e,t;this.gameState!==4&&(fe(this.container.container.events)&&this.gameState===3||this.selectBranches.state.isExpect||(this.gameState!==2&&((t=(e=this.container).hide)==null||t.call(e)),this.emitContainerVisibilityEvent(!1)))})};this.show=()=>{var e,t,i,n;if(this.gameState===2&&!this.isSelectedControlEvent)if(this.container.getElement()){let{hasOpenURIEventInCurrentContainer:o}=this.getContainerEventState();if((n=(i=this.container).show)==null||n.call(i),this.interactiveTimeOpenUri&&o)return;this.emitContainerVisibilityEvent(!0,!1)}else{let o=Fs(this.selectBranches.onControlEvent,{isDisabled:()=>this.container.isDisabled,branches:this.branches,containerId:this.container.container.id,onDetachContainer:()=>{this.removeView(),this.emitContainerVisibilityEvent(!1)},onEvent:(c,a)=>{let{isExpectTime:l,hasOtherExpect:m,hasOpenURIEvent:v,hasOpenURIEventInCurrentContainer:d,isAllOpenURIEventsValid:b}=this.getContainerEventState(),w=this.interactiveTimeOpenUri&&!d,P=this.interactiveTimeOpenUri&&d;if((!this.interactiveTimeOpenUri||w)&&(this.isSelectedControlEvent=!0),c!==!1){if(!this.selectBranches.state.isExpect&&(!this.interactiveTimeOpenUri||w)){if(this.interactiveTimeOpenUri){let y=!m&&!b&&d;y&&this.globalEventEmitter.emit(O.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.containerFakeRemoved,visibility:!1,removeAllOpenURI:y})}this.removeView()}this.emitContainerVisibilityEvent(!1)}if(this.gameState===4||this.gameState===3||this.selectBranches.state.isExpect||this.interactiveTimeOpenUri&&v&&this.gameState!==5){if(P){let V=(($,u,h,g)=>!$&&!u&&h||$&&!u&&h&&!g||$&&!u&&h&&g)(l,m,b,this.isSelectedContainerEvent);this.fakeRemoveView(V)}else this.removeView(),this.emitContainerVisibilityEvent(!1);(!l||!m)&&(this.selectBranches.stopExpect(),a())}},isEOV:()=>this.gameState===4});this.container.createView(o),this.emitContainerVisibilityEvent(!0,!0),this.disabledControls$.getValue()&&((t=(e=this.container).disable)==null||t.call(e))}};this.onEndOfVideo=()=>{this.gameState=4,this.selectContainerEvent(!0)};this.whilePlaying=()=>{var l,m,v;let e=this.player.experimental.element$.getValue(),i=e instanceof HTMLVideoElement?e.readyState:void 0,n=[6,5];if(!i||(0,Ma.default)(n,this.gameState)&&!this.isPermanentText)return;let s=this.player.getExactTime();if(_s(s,this.container.container))this.gameState!==1&&(this.gameState=1,this.onBeforeStartTime());else if(Wr(s,this.container.container))this.gameState!==2&&(this.gameState=2,this.onStartTime());else if(this.gameState!==3){let d=this.gameState;this.gameState=3,d===2&&this.onEndTime()}else{let{hasOpenURIEventInCurrentContainer:d}=this.getContainerEventState(),b=this.selectBranches.state.isExpect;if(this.interactiveTimeOpenUri&&d&&!b){let P=this.container.getElement();if(P){if(P.style.visibility==="hidden")return;(m=(l=this.container).hide)==null||m.call(l),this.container.isRemoved||this.fakeRemoveView();return}}this.isPermanentText||this.removeView()}let o=Wr(s,this.container.container),c=this.container.container.startTime?[this.container.container.startTime,(v=this.container.container.endTime)!=null?v:1/0]:[],a={subjectId:this.container.container.id,subjectName:"container",range:c,currentTime:s,isInteractiveTime:o};this.globalEventEmitter.emit(O.eachTick,a),this.globalEvents.eachTick$.next(a)};this.container=t,this.branches=i,this.selectBranches=n,this.subscription=new Va.Subscription,this.player=e,this.interactiveEvents=s,this.getContainerEventState=a,this.isPermanentText=l&&me(t.container.controls),this.interactiveTimeOpenUri=m,this.disabledControls$=v,this.onRemove=d,this.globalEventEmitter=c,this.gameState=0,this.globalEvents=o,this.isSelectedControlEvent=!1,this.isSelectedContainerEvent=!1,this.registerEvents()}emitContainerVisibilityEvent(e,t=!1){e?(this.globalEventEmitter.emit(O.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.visibility,visibility:e,isFirst:t}),this.globalEvents.interactiveVisibilityChanged$.next({subjectId:this.container.container.id,subjectName:"container",type:"visibility",visibility:e,isFirst:t})):(this.globalEventEmitter.emit(O.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.visibility,visibility:!1}),this.globalEvents.interactiveVisibilityChanged$.next({subjectId:this.container.container.id,subjectName:"container",type:"visibility",visibility:e}))}registerEvents(){this.subscription.add(this.player.events.playing$.subscribe(this.show)).add(this.player.events.paused$.subscribe(this.hide)).add(this.player.events.ended$.subscribe(this.onEndOfVideo)).add(this.disabledControls$.subscribe(e=>{var t,i,n,s;e?(i=(t=this.container).disable)==null||i.call(t):(s=(n=this.container).enable)==null||s.call(n)}))}selectContainerEvent(e=!1){var i;let{isExpectTime:t}=this.getContainerEventState();this.interactiveEvents.containersEventsCallState.setCalled({timestamp:e?1/0:this.container.container.endTime,id:this.container.container.id}),!(this.isSelectedControlEvent||this.isSelectedContainerEvent)&&(this.isSelectedContainerEvent=!0,t&&!this.container.isRemoved&&this.selectBranches.setManifestContainerEvents({container:this.container.container,branches:this.branches,isEOV:e}),!e&&this.interactiveEvents.exec((i=this.container.container.endTime)!=null?i:1/0))}onStartTime(){this.show()}onEndTime(){this.selectContainerEvent(!1);let{isExpectTime:e,hasOpenURIEventInCurrentContainer:t}=this.getContainerEventState(),i=this.interactiveTimeOpenUri?e||t:fe(this.container.container.events)||e;(this.isSelectedControlEvent||!i)&&this.removeView()}onBeforeStartTime(){var e,t;(t=(e=this.container).hide)==null||t.call(e),this.emitContainerVisibilityEvent(!1)}reset(){this.isSelectedControlEvent=!1,this.isSelectedContainerEvent=!1,this.gameState=1}removeView(e=!1){var t;this.container.removeView(e),this.globalEventEmitter.emit(O.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.containerRemoved,visibility:!1}),this.globalEvents.interactiveContainerRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-removed"}),this.gameState=5,(t=this.onRemove)==null||t.call(this)}fakeRemoveView(e=!1){this.container.isRemoved||this.globalEventEmitter.emit(O.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.containerFakeRemoved,visibility:!1,removeAllOpenURI:e}),this.container.fakeRemove()}destroy(){var e;this.reset(),this.removeView(!0),this.gameState=6,this.subscription.unsubscribe(),this.branches=[],this.interactiveEvents.containersEventsCallState.setCalled({timestamp:(e=this.container.container.endTime)!=null?e:1/0,id:this.container.container.id})}};var ja=(r=[])=>r.reduce((e,t,i)=>{var s,o,c;let n=((s=t==null?void 0:t.controls)!=null?s:[]).filter(a=>!Ze(a));if(Bt(n)){let a=[(o=t.startTime)!=null?o:0,(c=t.endTime)!=null?c:1/0],l={id:t.id,isRemoved:!1};if(!i)e.push({subjects:[l],range:a});else{let m=[],v=-1/0,d=1/0,b=[],w=[];for(let P=0;P<e.length;P++){let y=e[P];if(w.push(...y.subjects),y.range[0]<d&&(d=y.range[0]),y.range[1]>v&&(v=y.range[1]),a[0]>=y.range[0]&&a[1]<=y.range[1])return e[P].subjects.push(l),e;a[0]<y.range[0]&&a[1]>y.range[0]&&(m.push(P),b=b.concat(y.subjects)),a[0]>=y.range[0]&&a[0]<=y.range[1]&&(m.push(P),b=b.concat(y.subjects),a[0]=y.range[0]),a[1]>=y.range[0]&&a[1]<=y.range[1]&&(m.push(P),b=b.concat(y.subjects),a[1]=y.range[1])}if(w.push(l),a[0]<=d&&a[1]>=v)return[{subjects:w,range:a}];m.length&&m.reverse().forEach(P=>{e.splice(P,1)}),e.push({subjects:b.concat([l]),range:a})}}return e},[]).sort((e,t)=>e.range[0]-t.range[0]);var vo=Z(Ht(),1),ni=Z(Dt(),1),yo=Z(fo(),1);function mo(){let r={};function e(){for(let c in r)Object.prototype.hasOwnProperty.call(r,c)&&delete r[c]}function t(c){let a={};for(let l in r)+l<=c&&(a[l]=r[l]);return a}function i(c){let a={};for(let l in r)+l>=c&&(a[l]=r[l]);return a}function n({timestamp:c,priority:a,initiator:l}){var m;if(Fr(c)){let v=(m=r[c])!=null?m:null;if(v&&a&&Qe(a,!0)){let d={},b=v[a];if(b&&(d=f(f({},d),b)),d=de(d)?null:d,d&&Qe(l,!0)){let w=d[l];return w!=null?w:null}return d}return v}return null}function s({timestamp:c,priority:a,initiator:l}){if(Fr(c))if(r[c]){if(a&&Qe(a,!0))if(r[c][a]){if(l&&Qe(l,!0))if(r[c][a][l]){if(delete r[c][a][l],!de(r[c][a]))return!0}else return!1;if(delete r[c][a],!de(r[c]))return!0}else return!1;return delete r[c]}else return!1;return!1}function o(v){var d=v,{timestamp:c,priority:a,initiator:l}=d,m=X(d,["timestamp","priority","initiator"]);var b,w,P;(w=(b=r[c])==null?void 0:b[a])!=null&&w[l]?r[c][a][l].push(f({},m)):(P=r[c])!=null&&P[a]?r[c][a]=I(f({},r[c][a]),{[l]:[f({},m)]}):r[c]?r[c]=I(f({},r[c]),{[a]:{[l]:[f({},m)]}}):r[c]={[a]:{[l]:[f({},m)]}}}return{map:r,remove:s,add:o,removeAll:e,get:n,getLte:t,getGte:i}}var Yp=[C.EventActionTypes.expect,C.EventActionTypes.setNextBranch],Xp=1/0;function bo(r,e){let t=r,i,n=Zp(e),s=mo(),o,c=()=>{b(),$()},a=u=>{s.add.call(void 0,u),P()},l=(u=[])=>{for(let h of u)if(h.action(),(0,vo.default)(Yp,h.actionType))break},m=(u=1/0)=>{var S,L,M;let h=zt((S=s.get({timestamp:u,priority:"control"}))!=null?S:{}),g=zt((L=s.get({timestamp:u,priority:"container"}))!=null?L:{}),x=zt((M=s.get({timestamp:u,priority:"chapter"}))!=null?M:{});return[...h,...g,...x]},v=u=>{n.isReady(u)&&l(m(u))},d=()=>{var u;l([...zt((u=s.get({timestamp:1/0,priority:"chapter"}))!=null?u:{})])},b=()=>{i&&(o==null||o.unsubscribe(),i=void 0)},w=u=>{},P=()=>{i||(i=()=>setTimeout(()=>{v(1/0)}),o=t.events.ended$.subscribe(i))},y=u=>{b(),t=u},V=u=>{u.priority==="container"&&n.resetCalled(u.timestamp),s.remove(u)},$=()=>{n.release(),s.removeAll()};return{setPlayer:y,add:a,remove:V,exec:v,execEndOfVideo:d,listen:P,unlisten:b,release:c,containersEventsCallState:n,getPreparedToExecActions:m}}function Zp(r){let e=new Map;return{setCalled:({timestamp:c,id:a})=>{let l=e.get(c);l&&l[a]!==void 0&&(l[a]=!0)},setData:(c=[])=>{var a,l;for(let m of c){let v=(a=m.endTime)!=null?a:Xp,d=(l=e.get(v))!=null?l:{};e.set(v,I(f({},d),{[m.id]:!1}))}},resetCalled:c=>{let a=e.get(c);if(a)for(let l in a)a[l]=!1},isReady:c=>{let a=e.get(c);if(!a)return!0;let l=(0,ni.default)(a);return r?l.some(v=>v):!l.some(v=>!v)},release:()=>e.clear()}}function zt(r){return(0,yo.default)((0,ni.default)(r)).sort(e=>e.actionType===C.EventActionTypes.expect?-1:1)}var go={videoContentHeight:0,videoContentWidth:0},Co=(r,e)=>{let{height:t,width:i}=e.info.intrinsicVideoSize$.getValue()||{};if(!(t&&i))return go;let{clientHeight:n,clientWidth:s}=e.experimental.element$.getValue()||{};if(!(n&&s))return go;let o=t/i,c=n/s,a,l;return c>o?(l=s,a=s*o):c<o?(l=n/o,a=n):(l=s,a=n),{videoContentWidth:l,videoContentHeight:a}};var Jp=250;function Eo(r){let e=()=>{},t=new ResizeObserver(c=>{s(c),e=s.bind(null,c)});function i(c){let{parentElement:a,player:l}=r();if(a&&l){let{videoContentWidth:m,videoContentHeight:v}=Co(a,l);a.style.setProperty("--interactive-content-width",`${m}px`),a.style.setProperty("--interactive-content-height",`${v}px`),a.style.setProperty("--interactive-width",`${c[0].contentRect.width}px`),a.style.setProperty("--interactive-height",`${c[0].contentRect.height}px`)}}function n(){let{parentElement:c}=r();c.removeAttribute("style")}let s=We(c=>{let{fns:a=[]}=r();i(c);for(let l of a)l()},Jp);function o(){e=void 0,t.disconnect(),n()}return{resizeObserver:t,calc:()=>{e==null||e()},release:o}}var st=class{constructor(){this.map={}}push(e,t){e in this.map?this.map[e].push(t):this.map[e]=[t]}get(e){let t=this.map[e];return t?t.slice():null}getAll(){let e=[];for(let t in this.map)e.concat(this.map[t]);return e}remove(e,t){e in this.map&&(this.map[e]=this.map[e].filter(i=>i!==t),this.map[e].length===0&&delete this.map[e])}clear(){this.map={}}keys(){return Object.keys(this.map)}size(){return this.keys().length}};var eh=r=>Math.floor(Math.random()*r),To=r=>{var n;let e=r.length,t=1/0,i=null;for(;e--;){let s=r[e],o=(n=s.weight)!=null?n:1;o<t&&(t=o,i=s)}return i},xo=r=>{var n;let e=r.length,t=-1/0,i=null;for(;e--;){let s=r[e],o=(n=s.weight)!=null?n:0;o>t&&(t=o,i=s)}return i};var So=r=>{let e=r.length,t=eh(e);return r[t]},Io=1,wo=r=>{var i,n;let e=0;for(let s=0;s<r.length;++s)e+=(i=r[s].weight)!=null?i:Io;let t=Math.random()*e;e=0;for(let s=0;s<r.length-1;++s)if(e+=(n=r[s].weight)!=null?n:Io,e>=t)return r[s];return r[r.length-1]};var Ao={shouldOpenNow:!0,isDetachContainer:!0},Ro="after-expect";var si=(r,e=!1)=>I(f({},r),{args:e?f(f({},r.args),Ao):f(f({},Ao),r.args)}),ko=({globalEventEmitter:r,globalEvents:e,player:t,interactiveEvents:i,removeControllers:n})=>{let s={isExpect:!1},o=()=>{s.isExpect&&(s.isExpect=!1)},c=({action:u,controlType:h,controlId:g,containerId:x,branches:S=[],onEvent:L,isEOV:M=()=>!1,isDisabled:E=()=>!1})=>{let A=si(u,M()),_={timestamp:1/0,priority:"control",initiator:g,actionType:A.type},ae=E(),te=r.emit.bind(r,O.interactives,{subjectId:g,subjectType:h,subjectName:"control",type:ae?j.actionChoiceCanceled:j.actionChoice,actionType:u.type,payload:f({containerId:x},A.args)}),q=()=>{e.interactiveActionChoice$.next({subjectId:g,subjectType:h,subjectName:"control",type:ae?"action-choice-canceled":"action-choice",actionType:u.type,payload:f({containerId:x},A.args)})};if(ae){te(),q();return}switch(A.type.trim().toLowerCase()){case C.EventActionTypes.setNextBranch.trim().toLowerCase():{let je=S.find(oe=>oe.id===A.args.branchId);if(!je)return;L(A.args.isDetachContainer,w.bind(null,{subjectId:g,subjectName:"control"})),te(),q(),A.args.shouldOpenNow?y({subjectId:g,subjectName:"control",subjectType:h,action:A,payload:{chapterId:je.chapterId,autoSelect:!1}}):(i.add(I(f({},_),{action:y.bind(null,{subjectId:g,subjectName:"control",subjectType:h,action:A,payload:{chapterId:je.chapterId,autoSelect:!1}})})),n==null||n());return}case C.EventActionTypes.continuePlayback.trim().toLowerCase():{L(A.args.isDetachContainer,w.bind(null,{subjectId:g,subjectName:"control"})),te(),q(),A.args.shouldOpenNow?P({subjectId:g,subjectName:"control",subjectType:h,action:u}):i.add(I(f({},_),{action:P.bind(null,{subjectId:g,subjectName:"control",subjectType:h,action:u})}));return}case C.EventActionTypes.openURI.trim().toLowerCase():{L(A.args.isDetachContainer,w.bind(null,{subjectId:g,subjectName:"control"})),te(),q(),A.args.shouldOpenNow?$({subjectId:g,subjectName:"control",subjectType:h,action:A,payload:{URI:u.args.uri}}):(i.add(I(f({},_),{action:$.bind(null,{subjectId:g,subjectName:"control",subjectType:h,action:A,payload:{URI:u.args.uri}})})),n==null||n());return}default:let le="Unexpected control event",ct=new F(1,1,{message:le});v(ct,le);return}},a=({action:u,container:{id:h,endTime:g},branches:x=[],isEOV:S=!1,autoSelected:L=!1})=>{let M=si(u,S),E={timestamp:!M.args.shouldOpenNow||S?1/0:g!=null?g:1/0,priority:"container",initiator:h,actionType:M.type},A=r.emit.bind(r,O.interactives,{subjectId:h,subjectName:"container",type:j.actionChoice,actionType:M.type,payload:M.args}),_=()=>{e.interactiveActionChoice$.next({subjectId:h,subjectName:"container",type:"action-choice",actionType:M.type,payload:M.args})};switch(M.type.trim().toLowerCase()){case C.EventActionTypes.setNextBranch.trim().toLowerCase():{let q=x.find(le=>le.id===M.args.branchId);if(!q)return;A(),_(),i.add(I(f({},E),{action:y.bind(null,{subjectId:h,subjectName:"container",action:M,payload:{chapterId:q.chapterId,autoSelect:L}})})),n==null||n();return}case C.EventActionTypes.setMaxWeightBranch.trim().toLowerCase():return;case C.EventActionTypes.setMinWeightBranch.trim().toLowerCase():return;case C.EventActionTypes.setRandomBranch.trim().toLowerCase():return;case C.EventActionTypes.setWeightlessRandomBranch.trim().toLowerCase():return;case C.EventActionTypes.continuePlayback.trim().toLowerCase():{A(),_(),i.add(I(f({},E),{action:P.bind(null,{subjectId:h,subjectName:"container",action:M})}));return}case C.EventActionTypes.openURI.trim().toLowerCase():{A(),_(),i.add(I(f({},E),{action:$.bind(null,{subjectId:h,subjectName:"container",action:M,payload:{URI:u.args.uri}})})),n==null||n();return}default:let ae="Unexpected container event",te=new F(1,1,{message:ae});v(te,ae);return}};function l({container:u,branches:h,isEOV:g=!1}){var S,L;let x=Kr(u.events);if(x){let M=si(x.action,g);r.emit(O.interactives,{subjectId:u.id,subjectName:"container",type:j.actionChoice,actionType:M.type,payload:M.args}),e.interactiveActionChoice$.next({subjectId:u.id,subjectName:"container",type:"action-choice",actionType:M.type,payload:M.args}),i.add({timestamp:g?1/0:(S=u.endTime)!=null?S:1/0,priority:"container",initiator:u.id,actionType:C.EventActionTypes.expect,action:b.bind(null,{subjectId:u.id,subjectName:"container"})}),s.isExpect=!0}else for(let M of(L=u.events)!=null?L:[])a({action:M.action,container:u,branches:h,isEOV:g})}let m=({chapterId:u,action:h,branches:g=[]})=>{let x=r.emit.bind(r,O.interactives,{subjectId:u,subjectName:"chapter",type:j.actionChoice,actionType:h.type,payload:h.args}),S=()=>{e.interactiveActionChoice$.next({subjectId:u,subjectName:"chapter",type:"action-choice",actionType:h.type,payload:h.args})};switch(h.type.trim().toLowerCase()){case C.EventActionTypes.setNextBranch.trim().toLowerCase():{let E=g.find(A=>A.id===h.args.branchId);return E!=null&&E.chapterId?(x(),S(),y.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:E.chapterId,autoSelect:!0}})):void 0}case C.EventActionTypes.setWeightlessRandomBranch.trim().toLowerCase():{let E=So(g);return E!=null&&E.chapterId?(x(),S(),y.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:E.chapterId,autoSelect:!0}})):void 0}case C.EventActionTypes.setRandomBranch.trim().toLowerCase():{let E=wo(g);return E!=null&&E.chapterId?(x(),S(),y.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:E.chapterId,autoSelect:!0}})):void 0}case C.EventActionTypes.setMaxWeightBranch.trim().toLowerCase():{let E=xo(g);return E!=null&&E.chapterId?(x(),S(),y.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:E.chapterId,autoSelect:!0}})):void 0}case C.EventActionTypes.setMinWeightBranch.trim().toLowerCase():{let E=To(g);return E!=null&&E.chapterId?(x(),S(),y.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:E.chapterId,autoSelect:!0}})):void 0}case C.EventActionTypes.continuePlayback.trim().toLowerCase():return x(),S(),P.bind(null,{subjectId:u,subjectName:"chapter",action:h});case C.EventActionTypes.openURI.trim().toLowerCase():return x(),S(),$.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{URI:h.args.uri}});default:let L="Unexpected chapter event",M=new F(1,1,{message:L});v(M,L);return}};function v(u,h){console.error(h),e.error$.next(u),r.emit(O.errors,u)}function d(u){var g;let h=Kr(u.events);if(h){if(Y(u))return;r.emit(O.interactives,{subjectId:u.id,subjectName:"chapter",type:j.actionChoice,actionType:h.action.type,payload:h.action.args}),e.interactiveActionChoice$.next({subjectId:u.id,subjectName:"chapter",type:"action-choice",actionType:h.action.type,payload:h.action.args}),i.add({timestamp:1/0,priority:"chapter",initiator:u.id,actionType:C.EventActionTypes.expect,action:b.bind(null,{subjectId:u.id,subjectName:"chapter"})})}else(g=u.events)==null||g.forEach(x=>{let S=m({chapterId:u.id,action:x.action,branches:u.branches});S&&i.add({timestamp:1/0,priority:"chapter",initiator:u.id,actionType:x.action.type,action:S})})}let b=({subjectId:u,subjectName:h})=>{t.pause(),r.emit(O.interactives,{subjectId:u,subjectName:h,type:j.actionExecution,actionType:C.EventActionTypes.expect}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,type:"action-execution",actionType:C.EventActionTypes.expect})},w=({subjectId:u,subjectName:h})=>{t.info.isEnded$.getValue()?i.execEndOfVideo():t.play(),r.emit(O.interactives,{subjectId:u,subjectName:h,type:j.actionExecution,actionType:Ro}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,type:"action-execution",actionType:Ro})},P=({subjectId:u,subjectName:h,subjectType:g,action:x})=>{r.emit(O.interactives,{subjectId:u,subjectName:h,subjectType:g,type:j.actionExecution,actionType:x.type}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,subjectType:g,type:"action-execution",actionType:x.type})},y=({subjectId:u,subjectName:h,subjectType:g,action:x,payload:S})=>{S.behaviour="change-chapter",r.emit(O.interactives,{subjectId:u,subjectName:h,subjectType:g,type:j.actionExecution,actionType:x.type,payload:S}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,subjectType:g,type:"action-execution",actionType:x.type,payload:S})},V=({subjectId:u,subjectName:h,subjectType:g,action:x,payload:S})=>{S.behaviour="change-manifest",r.emit(O.interactives,{subjectId:u,subjectName:h,subjectType:g,type:j.actionExecution,actionType:x.type,payload:S}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,subjectType:g,type:"action-execution",actionType:x.type,payload:S})},$=({subjectId:u,subjectName:h,subjectType:g,action:x,payload:S})=>{if(!S.URI)return;let L=window.open(S.URI,"_blank","noopener,noreferrer");L&&(L.opener=null),r.emit(O.interactives,{subjectId:u,subjectName:h,subjectType:g,type:j.actionExecution,actionType:x.type}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,subjectType:g,type:"action-execution",actionType:x.type})};return{onControlEvent:c,onContainerEvent:a,onChapterEvent:m,onExpectEvent:b,expectEventHandler:w,setManifestChapterEvents:d,setManifestContainerEvents:l,stopExpect:o,state:s}};var ci=Z(_r(),1),W=require("@vkontakte/videoplayer-shared/es2015");var Wt=(r,e)=>{let t={};return r.map(i=>{if(!t[i]){let n=e.chapters.find(o=>o.id===i);if(!n)return null;let s=e.media.videos.find(o=>n.videoId===o.id);if(!s)return null;t[i]=ai(s)}return t[i]}).filter(Boolean)},Mo=r=>{for(let e of r.variants)if(Vo(e)&&e.payload)return e.payload.id},Vo=r=>!!(r.type==="custom"&&r.payload&&r.payload.type==="vk"),ai=r=>{let e=Mo(r);if(!e)return null;let t=e.split("_").pop();return t?parseInt(t,10):null},jo=(r,e)=>{for(let t of r.media.videos)if(e===ai(t)){for(let i of r.chapters)if(i.videoId===t.id)return i.id;return}},oi=(r,e)=>r.reduce((t,i)=>{let n=jo(e,i);return n?[...t,n]:t},[]);var ie,ye,be,z,Kt,ne,se,ee,ge,ke,Me,at=class{constructor({globalEventEmitter:e,videoId:t,interactiveController:i,historyApi:n,settings:s}){this.state={history$:new W.ValueSubject([]),hasPrevChapter$:new W.ValueSubject(!1),prevChapter$:new W.ValueSubject(null),isInitialChapter$:new W.ValueSubject(!1),isGoBackLimited$:new W.ValueSubject(!1)};H(this,ie,null);H(this,ye);H(this,be,!1);H(this,z,null);H(this,Kt,null);this.events={inited$:new W.Subject,destroyed$:new W.Subject,error$:new W.Subject};H(this,ne,null);H(this,se,null);H(this,ee,null);H(this,ge,new W.Subscription);H(this,ke,!1);H(this,Me,0);var o;N(this,ne,t),N(this,ee,e),N(this,se,i),N(this,ie,n),N(this,ye,s),this.state.history$&&R(this,ge)&&((o=R(this,ge))==null||o.add(this.state.history$.subscribe(c=>{var a,l;this.state.prevChapter$.next((0,ci.default)(c,-2)||null),this.state.hasPrevChapter$.next(c.length>1),this.state.isInitialChapter$.next(this.getInitialChapterId()===((l=(a=R(this,z))==null?void 0:a.metadata)==null?void 0:l.initChapterId)),this.state.isGoBackLimited$.next(R(this,Me)===R(this,ye).maxLength-1)})))}setManifest(e){return k(this,null,function*(){if(!R(this,se)||!R(this,ee))return;N(this,z,e),yield this.getProjectHistory();let t=this.getInitialChapterId();yield R(this,se).setChapter({chapterId:t,pushToHistory:!1}),R(this,be)||(N(this,be,!0),this.events.inited$.next({initChapterId:t}))})}get inited(){return R(this,be)}updateHistory(e,t=!0){return k(this,null,function*(){var c;if(!R(this,z))return;R(this,ke)?(N(this,ke,!1),Ci(this,Me)._++):N(this,Me,0);let i=R(this,z),n=e.length-R(this,ye).maxLength,s=n>0?e.slice(n):e,o=Wt(s,i);if(N(this,Kt,o),this.state.history$.next(s),!(!t||!R(this,ie)||!R(this,ne)))try{yield R(this,ie).save(R(this,ne),o)}catch(a){let l=new F(1,5,"Unable to save interactive history");this.events.error$.next(l),(c=R(this,ee))==null||c.emit(O.errors,l)}})}goBack(){return k(this,null,function*(){var i;if(!this.state||!R(this,se)){let n=new F(1,5,"Unable to save interactive history");return this.events.error$.next(n),(i=R(this,ee))==null?void 0:i.emit(O.errors,n)}N(this,ke,!0);let e=this.state.history$.getValue().slice(0,-1),t=e.pop();this.state.history$.next(e),yield R(this,se).setChapter({chapterId:t,playPrev:!0})})}getProjectHistory(){return k(this,null,function*(){var n;if(!R(this,z)||!R(this,ne))return;let e=R(this,z),t=[this.getInitialVideoId()];if(R(this,ie))try{let s=yield R(this,ie).get(R(this,ne));s.length&&(t=s)}catch(s){let o=new F(1,5,"Error while trying to fetch data");this.events.error$.next(o),(n=R(this,ee))==null||n.emit(O.errors,o)}let i=oi(t,e);this.state.history$.next(i)})}getInitialChapterId(){var t;let e=this.state.history$.getValue();return(0,ci.default)(e,-1)||R(this,ye).initChapterId||((t=R(this,z))==null?void 0:t.metadata.initChapterId)}getInitialVideoId(){if(R(this,z)){let e=this.getInitialChapterId();return Wt([e],R(this,z)).pop()}return null}destroy(){var e,t;N(this,ne,null),N(this,ie,null),N(this,se,null),(e=R(this,ge))==null||e.unsubscribe(),N(this,ge,null),N(this,be,!1),(t=R(this,ee))==null||t.emit(O.historyDestroyed),this.events.destroyed$.next(),N(this,ee,null)}};ie=new WeakMap,ye=new WeakMap,be=new WeakMap,z=new WeakMap,Kt=new WeakMap,ne=new WeakMap,se=new WeakMap,ee=new WeakMap,ge=new WeakMap,ke=new WeakMap,Me=new WeakMap;var Ce=class Ce{constructor(e,t,i,n){this.target=e,this.type=t,this.listener=i,this.options=Ce._convertOptions(e,n),this.target.addEventListener(t,i,this.options)}unlisten(){var e;this.type&&this.listener&&this.options&&((e=this.target)==null||e.removeEventListener(this.type,this.listener,this.options)),this.target=null,this.type=null,this.listener=null,this.options=!1}static _convertOptions(e,t){if(t===void 0)return!1;if(typeof t=="boolean")return t;{let i=new Set(["passive","capture"]),n=Object.keys(t).filter(o=>!i.has(o));return n.length===0&&console.warn("Unsupported flag(s) to addEventListener: "+n.join(",")),Ce._doesSupportObject(e)?t:t.capture||!1}}static _doesSupportObject(e){let t=Ce._supportsObject;if(t===void 0){t=!1;try{let i={},n={get:()=>(t=!0,!1)};Object.defineProperty(i,"passive",n),Object.defineProperty(i,"capture",n);let s=()=>{};e.addEventListener("test",s,i),e.removeEventListener("test",s,i)}catch(i){t=!1}Ce._supportsObject=t}return t||!1}};Ce._supportsObject=void 0;var Qt=Ce;var Yt=class{constructor(){this.bindingMap=new st}release(){this.removeAll(),this.bindingMap=null}listen(e,t,i,n){if(!this.bindingMap)return;let s=new Qt(e,t,i,n);this.bindingMap.push(t,s)}listenOnce(e,t,i,n){let s=o=>{this.unlisten(e,t,s),i(o)};this.listen(e,t,s,n)}unlisten(e,t,i){if(!this.bindingMap)return;let n=this.bindingMap.get(t)||[];for(let s of n)s.target===e&&(i===s.listener||!i)&&(s.unlisten(),this.bindingMap.remove(t,s))}removeAll(){if(!this.bindingMap)return;let e=this.bindingMap.getAll();for(let t of e)t.unlisten();this.bindingMap.clear()}};var Xt=class{constructor(){this._prevSizeId=0;this.rootElement=document.createElement("canvas")}clear(){var e;(e=this.rootElement.getContext("2d"))==null||e.clearRect(0,0,this.rootElement.width,this.rootElement.height)}isImageDrawn(){var n;let e=(n=this.rootElement.getContext("2d"))==null?void 0:n.getImageData(0,0,this.rootElement.width,this.rootElement.height);if(!e)return!1;let t=e.data,i=t.length;for(let s=3;s<i;s+=40)if(t[s]!==0)return!0;return!1}destroy(){this.rootElement.remove()}show(){this.rootElement.style.visibility="visible"}hide(){this.rootElement.style.visibility="hidden"}setCanvasImageSource(e){this.canvasImgSrc=e}draw(){var e;this.canvasImgSrc&&((e=this.rootElement.getContext("2d"))==null||e.drawImage(this.canvasImgSrc,0,0,this.rootElement.width,this.rootElement.height))}updateCanvasDimensions(e,t=!1){return k(this,null,function*(){let i=e.width+e.height;if(this._prevSizeId===i)return;let n;t&&(n=yield this.save()),this.rootElement.width=e.width,this.rootElement.height=e.height,t&&n&&this.restore(n),this._prevSizeId=i})}save(){return k(this,null,function*(){let e=this.rootElement.toDataURL("image/jpeg",1),t=new Image;return t.crossOrigin="anonymous",t.src=e,yield t.decode(),t})}restore(e){var t;this.rootElement&&((t=this.rootElement.getContext("2d"))==null||t.drawImage(e,0,0,this.rootElement.width,this.rootElement.height))}};var Zt=class{constructor({parentElement:e,endOffsetMs:t=250,onError:i}){this.currentVideoDurationMs=1/0;this._containerTimeFrameShouldReceived=!1;this._endTimeFrameReceived=!1;this._shouldCallSkip=!1;this.onEachTick=e=>{let t=e!=null?e:this.lastFrameCanvas.canvasImgSrc.currentTime*1e3,i=this.isChapterEndTime(t);if(this.isContainerTime(t))this._endTimeFrameReceived=!1,this._containerTimeFrameShouldReceived=!0,this._shouldCallSkip=!0;else if(i)this._containerTimeFrameShouldReceived=!1,this._shouldCallSkip=!1,this._endTimeFrameReceived||(this.draw(),this._endTimeFrameReceived=!0,this.show());else{if(this._shouldCallSkip){this._shouldCallSkip=!1;return}this.reset()}};this.onSeek=()=>{this.onEachTick(),!this._containerTimeFrameShouldReceived&&!this._endTimeFrameReceived&&(this.hide(),this.lastFrameCanvas.clear())};this.rootElement=document.createElement("div"),this.rootElement.style.cssText=`
|
|
6
|
+
"use strict";var Fo=Object.create;var Le=Object.defineProperty,qo=Object.defineProperties,Bo=Object.getOwnPropertyDescriptor,Do=Object.getOwnPropertyDescriptors,Ho=Object.getOwnPropertyNames,ut=Object.getOwnPropertySymbols,Uo=Object.getPrototypeOf,er=Object.prototype.hasOwnProperty,vi=Object.prototype.propertyIsEnumerable;var yi=r=>{throw TypeError(r)};var mi=(r,e,t)=>e in r?Le(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,f=(r,e)=>{for(var t in e||(e={}))er.call(e,t)&&mi(r,t,e[t]);if(ut)for(var t of ut(e))vi.call(e,t)&&mi(r,t,e[t]);return r},I=(r,e)=>qo(r,Do(e));var X=(r,e)=>{var t={};for(var i in r)er.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&ut)for(var i of ut(r))e.indexOf(i)<0&&vi.call(r,i)&&(t[i]=r[i]);return t};var p=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Go=(r,e)=>{for(var t in e)Le(r,t,{get:e[t],enumerable:!0})},bi=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ho(e))!er.call(r,n)&&n!==t&&Le(r,n,{get:()=>e[n],enumerable:!(i=Bo(e,n))||i.enumerable});return r};var Z=(r,e,t)=>(t=r!=null?Fo(Uo(r)):{},bi(e||!r||!r.__esModule?Le(t,"default",{value:r,enumerable:!0}):t,r)),zo=r=>bi(Le({},"__esModule",{value:!0}),r);var gi=(r,e,t)=>e.has(r)||yi("Cannot "+t);var R=(r,e,t)=>(gi(r,e,"read from private field"),t?t.call(r):e.get(r)),H=(r,e,t)=>e.has(r)?yi("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),N=(r,e,t,i)=>(gi(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t);var Ci=(r,e,t,i)=>({set _(n){N(r,e,n,t)},get _(){return R(r,e,i)}});var k=(r,e,t)=>new Promise((i,n)=>{var s=a=>{try{c(t.next(a))}catch(l){n(l)}},o=a=>{try{c(t.throw(a))}catch(l){n(l)}},c=a=>a.done?i(a.value):Promise.resolve(a.value).then(s,o);c((t=t.apply(r,e)).next())});var J=p((cr,Ai)=>{"use strict";var $e=function(r){return r&&r.Math===Math&&r};Ai.exports=$e(typeof globalThis=="object"&&globalThis)||$e(typeof window=="object"&&window)||$e(typeof self=="object"&&self)||$e(typeof global=="object"&&global)||$e(typeof cr=="object"&&cr)||function(){return this}()||Function("return this")()});var U=p((Kh,Ri)=>{"use strict";Ri.exports=function(r){try{return!!r()}catch(e){return!0}}});var Ne=p((Qh,Oi)=>{"use strict";var Ko=U();Oi.exports=!Ko(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var ji=p((Yh,Vi)=>{"use strict";var Qo=Ne(),Mi=Function.prototype,Pi=Mi.apply,ki=Mi.call;Vi.exports=typeof Reflect=="object"&&Reflect.apply||(Qo?ki.bind(Pi):function(){return ki.apply(Pi,arguments)})});var K=p((Xh,Ni)=>{"use strict";var Li=Ne(),$i=Function.prototype,lr=$i.call,Yo=Li&&$i.bind.bind(lr,lr);Ni.exports=Li?Yo:function(r){return function(){return lr.apply(r,arguments)}}});var _e=p((Zh,Fi)=>{"use strict";var _i=K(),Xo=_i({}.toString),Zo=_i("".slice);Fi.exports=function(r){return Zo(Xo(r),8,-1)}});var ur=p((Jh,qi)=>{"use strict";var Jo=_e(),ec=K();qi.exports=function(r){if(Jo(r)==="Function")return ec(r)}});var G=p((ed,Bi)=>{"use strict";var pr=typeof document=="object"&&document.all;Bi.exports=typeof pr=="undefined"&&pr!==void 0?function(r){return typeof r=="function"||r===pr}:function(r){return typeof r=="function"}});var pe=p((td,Di)=>{"use strict";var tc=U();Di.exports=!tc(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var It=p((rd,Hi)=>{"use strict";var rc=Ne(),Et=Function.prototype.call;Hi.exports=rc?Et.bind(Et):function(){return Et.apply(Et,arguments)}});var hr=p(zi=>{"use strict";var Ui={}.propertyIsEnumerable,Gi=Object.getOwnPropertyDescriptor,ic=Gi&&!Ui.call({1:2},1);zi.f=ic?function(e){var t=Gi(this,e);return!!t&&t.enumerable}:Ui});var dr=p((nd,Wi)=>{"use strict";Wi.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var Qi=p((sd,Ki)=>{"use strict";var nc=K(),sc=U(),ac=_e(),fr=Object,oc=nc("".split);Ki.exports=sc(function(){return!fr("z").propertyIsEnumerable(0)})?function(r){return ac(r)==="String"?oc(r,""):fr(r)}:fr});var mr=p((ad,Yi)=>{"use strict";Yi.exports=function(r){return r==null}});var vr=p((od,Xi)=>{"use strict";var cc=mr(),lc=TypeError;Xi.exports=function(r){if(cc(r))throw new lc("Can't call method on "+r);return r}});var Fe=p((cd,Zi)=>{"use strict";var uc=Qi(),pc=vr();Zi.exports=function(r){return uc(pc(r))}});var Te=p((ld,Ji)=>{"use strict";var hc=G();Ji.exports=function(r){return typeof r=="object"?r!==null:hc(r)}});var Tt=p((ud,en)=>{"use strict";en.exports={}});var xt=p((pd,rn)=>{"use strict";var yr=Tt(),br=J(),dc=G(),tn=function(r){return dc(r)?r:void 0};rn.exports=function(r,e){return arguments.length<2?tn(yr[r])||tn(br[r]):yr[r]&&yr[r][e]||br[r]&&br[r][e]}});var sn=p((hd,nn)=>{"use strict";var fc=K();nn.exports=fc({}.isPrototypeOf)});var ln=p((dd,cn)=>{"use strict";var mc=J(),an=mc.navigator,on=an&&an.userAgent;cn.exports=on?String(on):""});var vn=p((fd,mn)=>{"use strict";var fn=J(),gr=ln(),un=fn.process,pn=fn.Deno,hn=un&&un.versions||pn&&pn.version,dn=hn&&hn.v8,Q,St;dn&&(Q=dn.split("."),St=Q[0]>0&&Q[0]<4?1:+(Q[0]+Q[1]));!St&&gr&&(Q=gr.match(/Edge\/(\d+)/),(!Q||Q[1]>=74)&&(Q=gr.match(/Chrome\/(\d+)/),Q&&(St=+Q[1])));mn.exports=St});var Cr=p((md,bn)=>{"use strict";var yn=vn(),vc=U(),yc=J(),bc=yc.String;bn.exports=!!Object.getOwnPropertySymbols&&!vc(function(){var r=Symbol("symbol detection");return!bc(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&yn&&yn<41})});var Er=p((vd,gn)=>{"use strict";var gc=Cr();gn.exports=gc&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Ir=p((yd,Cn)=>{"use strict";var Cc=xt(),Ec=G(),Ic=sn(),Tc=Er(),xc=Object;Cn.exports=Tc?function(r){return typeof r=="symbol"}:function(r){var e=Cc("Symbol");return Ec(e)&&Ic(e.prototype,xc(r))}});var In=p((bd,En)=>{"use strict";var Sc=String;En.exports=function(r){try{return Sc(r)}catch(e){return"Object"}}});var Tr=p((gd,Tn)=>{"use strict";var wc=G(),Ac=In(),Rc=TypeError;Tn.exports=function(r){if(wc(r))return r;throw new Rc(Ac(r)+" is not a function")}});var Sn=p((Cd,xn)=>{"use strict";var Oc=Tr(),Pc=mr();xn.exports=function(r,e){var t=r[e];return Pc(t)?void 0:Oc(t)}});var An=p((Ed,wn)=>{"use strict";var xr=It(),Sr=G(),wr=Te(),kc=TypeError;wn.exports=function(r,e){var t,i;if(e==="string"&&Sr(t=r.toString)&&!wr(i=xr(t,r))||Sr(t=r.valueOf)&&!wr(i=xr(t,r))||e!=="string"&&Sr(t=r.toString)&&!wr(i=xr(t,r)))return i;throw new kc("Can't convert object to primitive value")}});var On=p((Id,Rn)=>{"use strict";Rn.exports=!0});var Mn=p((Td,kn)=>{"use strict";var Pn=J(),Mc=Object.defineProperty;kn.exports=function(r,e){try{Mc(Pn,r,{value:e,configurable:!0,writable:!0})}catch(t){Pn[r]=e}return e}});var wt=p((xd,Ln)=>{"use strict";var Vc=On(),jc=J(),Lc=Mn(),Vn="__core-js_shared__",jn=Ln.exports=jc[Vn]||Lc(Vn,{});(jn.versions||(jn.versions=[])).push({version:"3.38.0",mode:Vc?"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 Ar=p((Sd,Nn)=>{"use strict";var $n=wt();Nn.exports=function(r,e){return $n[r]||($n[r]=e||{})}});var qe=p((wd,_n)=>{"use strict";var $c=vr(),Nc=Object;_n.exports=function(r){return Nc($c(r))}});var xe=p((Ad,Fn)=>{"use strict";var _c=K(),Fc=qe(),qc=_c({}.hasOwnProperty);Fn.exports=Object.hasOwn||function(e,t){return qc(Fc(e),t)}});var Rr=p((Rd,qn)=>{"use strict";var Bc=K(),Dc=0,Hc=Math.random(),Uc=Bc(1 .toString);qn.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+Uc(++Dc+Hc,36)}});var Be=p((Od,Dn)=>{"use strict";var Gc=J(),zc=Ar(),Bn=xe(),Wc=Rr(),Kc=Cr(),Qc=Er(),Se=Gc.Symbol,Or=zc("wks"),Yc=Qc?Se.for||Se:Se&&Se.withoutSetter||Wc;Dn.exports=function(r){return Bn(Or,r)||(Or[r]=Kc&&Bn(Se,r)?Se[r]:Yc("Symbol."+r)),Or[r]}});var zn=p((Pd,Gn)=>{"use strict";var Xc=It(),Hn=Te(),Un=Ir(),Zc=Sn(),Jc=An(),el=Be(),tl=TypeError,rl=el("toPrimitive");Gn.exports=function(r,e){if(!Hn(r)||Un(r))return r;var t=Zc(r,rl),i;if(t){if(e===void 0&&(e="default"),i=Xc(t,r,e),!Hn(i)||Un(i))return i;throw new tl("Can't convert object to primitive value")}return e===void 0&&(e="number"),Jc(r,e)}});var Pr=p((kd,Wn)=>{"use strict";var il=zn(),nl=Ir();Wn.exports=function(r){var e=il(r,"string");return nl(e)?e:e+""}});var Yn=p((Md,Qn)=>{"use strict";var sl=J(),Kn=Te(),kr=sl.document,al=Kn(kr)&&Kn(kr.createElement);Qn.exports=function(r){return al?kr.createElement(r):{}}});var Mr=p((Vd,Xn)=>{"use strict";var ol=pe(),cl=U(),ll=Yn();Xn.exports=!ol&&!cl(function(){return Object.defineProperty(ll("div"),"a",{get:function(){return 7}}).a!==7})});var es=p(Jn=>{"use strict";var ul=pe(),pl=It(),hl=hr(),dl=dr(),fl=Fe(),ml=Pr(),vl=xe(),yl=Mr(),Zn=Object.getOwnPropertyDescriptor;Jn.f=ul?Zn:function(e,t){if(e=fl(e),t=ml(t),yl)try{return Zn(e,t)}catch(i){}if(vl(e,t))return dl(!pl(hl.f,e,t),e[t])}});var rs=p((Ld,ts)=>{"use strict";var bl=U(),gl=G(),Cl=/#|\.prototype\./,De=function(r,e){var t=Il[El(r)];return t===xl?!0:t===Tl?!1:gl(e)?bl(e):!!e},El=De.normalize=function(r){return String(r).replace(Cl,".").toLowerCase()},Il=De.data={},Tl=De.NATIVE="N",xl=De.POLYFILL="P";ts.exports=De});var Vr=p(($d,ns)=>{"use strict";var is=ur(),Sl=Tr(),wl=Ne(),Al=is(is.bind);ns.exports=function(r,e){return Sl(r),e===void 0?r:wl?Al(r,e):function(){return r.apply(e,arguments)}}});var as=p((Nd,ss)=>{"use strict";var Rl=pe(),Ol=U();ss.exports=Rl&&Ol(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var cs=p((_d,os)=>{"use strict";var Pl=Te(),kl=String,Ml=TypeError;os.exports=function(r){if(Pl(r))return r;throw new Ml(kl(r)+" is not an object")}});var ps=p(us=>{"use strict";var Vl=pe(),jl=Mr(),Ll=as(),At=cs(),ls=Pr(),$l=TypeError,jr=Object.defineProperty,Nl=Object.getOwnPropertyDescriptor,Lr="enumerable",$r="configurable",Nr="writable";us.f=Vl?Ll?function(e,t,i){if(At(e),t=ls(t),At(i),typeof e=="function"&&t==="prototype"&&"value"in i&&Nr in i&&!i[Nr]){var n=Nl(e,t);n&&n[Nr]&&(e[t]=i.value,i={configurable:$r in i?i[$r]:n[$r],enumerable:Lr in i?i[Lr]:n[Lr],writable:!1})}return jr(e,t,i)}:jr:function(e,t,i){if(At(e),t=ls(t),At(i),jl)try{return jr(e,t,i)}catch(n){}if("get"in i||"set"in i)throw new $l("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var ds=p((qd,hs)=>{"use strict";var _l=pe(),Fl=ps(),ql=dr();hs.exports=_l?function(r,e,t){return Fl.f(r,e,ql(1,t))}:function(r,e,t){return r[e]=t,r}});var Ue=p((Bd,ms)=>{"use strict";var He=J(),Bl=ji(),Dl=ur(),Hl=G(),Ul=es().f,Gl=rs(),we=Tt(),zl=Vr(),Ae=ds(),fs=xe();wt();var Wl=function(r){var e=function(t,i,n){if(this instanceof e){switch(arguments.length){case 0:return new r;case 1:return new r(t);case 2:return new r(t,i)}return new r(t,i,n)}return Bl(r,this,arguments)};return e.prototype=r.prototype,e};ms.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,s=r.proto,o=i?He:n?He[t]:He[t]&&He[t].prototype,c=i?we:we[t]||Ae(we,t,{})[t],a=c.prototype,l,m,v,d,b,w,P,y,V;for(d in e)l=Gl(i?d:t+(n?".":"#")+d,r.forced),m=!l&&o&&fs(o,d),w=c[d],m&&(r.dontCallGetSet?(V=Ul(o,d),P=V&&V.value):P=o[d]),b=m&&P?P:e[d],!(!l&&!s&&typeof w==typeof b)&&(r.bind&&m?y=zl(b,He):r.wrap&&m?y=Wl(b):s&&Hl(b)?y=Dl(b):y=b,(r.sham||b&&b.sham||w&&w.sham)&&Ae(y,"sham",!0),Ae(c,d,y),s&&(v=t+"Prototype",fs(we,v)||Ae(we,v,{}),Ae(we[v],d,b),r.real&&a&&(l||!a[d])&&Ae(a,d,b)))}});var ys=p((Dd,vs)=>{"use strict";var Kl=Math.ceil,Ql=Math.floor;vs.exports=Math.trunc||function(e){var t=+e;return(t>0?Ql:Kl)(t)}});var Ge=p((Hd,bs)=>{"use strict";var Yl=ys();bs.exports=function(r){var e=+r;return e!==e||e===0?0:Yl(e)}});var Cs=p((Ud,gs)=>{"use strict";var Xl=Ge(),Zl=Math.min;gs.exports=function(r){var e=Xl(r);return e>0?Zl(e,9007199254740991):0}});var ze=p((Gd,Es)=>{"use strict";var Jl=Cs();Es.exports=function(r){return Jl(r.length)}});var Rt=p((zd,Is)=>{"use strict";Is.exports=function(){}});var Ts=p(()=>{"use strict";var eu=Ue(),tu=qe(),ru=ze(),iu=Ge(),nu=Rt();eu({target:"Array",proto:!0},{at:function(e){var t=tu(this),i=ru(t),n=iu(e),s=n>=0?n:i+n;return s<0||s>=i?void 0:t[s]}});nu("at")});var Ot=p((Qd,xs)=>{"use strict";var su=xt();xs.exports=su});var ws=p((Yd,Ss)=>{"use strict";Ts();var au=Ot();Ss.exports=au("Array","at")});var Rs=p((Xd,As)=>{"use strict";var ou=ws();As.exports=ou});var _r=p((Zd,Os)=>{"use strict";var cu=Rs();Os.exports=cu});var Us=p((nm,Hs)=>{"use strict";var Eu=Ar(),Iu=Rr(),Ds=Eu("keys");Hs.exports=function(r){return Ds[r]||(Ds[r]=Iu(r))}});var zs=p((sm,Gs)=>{"use strict";var Tu=U();Gs.exports=!Tu(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var Qs=p((am,Ks)=>{"use strict";var xu=xe(),Su=G(),wu=qe(),Au=Us(),Ru=zs(),Ws=Au("IE_PROTO"),Qr=Object,Ou=Qr.prototype;Ks.exports=Ru?Qr.getPrototypeOf:function(r){var e=wu(r);if(xu(e,Ws))return e[Ws];var t=e.constructor;return Su(t)&&e instanceof t?t.prototype:e instanceof Qr?Ou:null}});var Xs=p((om,Ys)=>{"use strict";var Pu=Ge(),ku=Math.max,Mu=Math.min;Ys.exports=function(r,e){var t=Pu(r);return t<0?ku(t+e,0):Mu(t,e)}});var Yr=p((cm,Js)=>{"use strict";var Vu=Fe(),ju=Xs(),Lu=ze(),Zs=function(r){return function(e,t,i){var n=Vu(e),s=Lu(n);if(s===0)return!r&&-1;var o=ju(i,s),c;if(r&&t!==t){for(;s>o;)if(c=n[o++],c!==c)return!0}else for(;s>o;o++)if((r||o in n)&&n[o]===t)return r||o||0;return!r&&-1}};Js.exports={includes:Zs(!0),indexOf:Zs(!1)}});var ta=p((lm,ea)=>{"use strict";ea.exports={}});var na=p((um,ia)=>{"use strict";var $u=K(),Xr=xe(),Nu=Fe(),_u=Yr().indexOf,Fu=ta(),ra=$u([].push);ia.exports=function(r,e){var t=Nu(r),i=0,n=[],s;for(s in t)!Xr(Fu,s)&&Xr(t,s)&&ra(n,s);for(;e.length>i;)Xr(t,s=e[i++])&&(~_u(n,s)||ra(n,s));return n}});var aa=p((pm,sa)=>{"use strict";sa.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var ca=p((hm,oa)=>{"use strict";var qu=na(),Bu=aa();oa.exports=Object.keys||function(e){return qu(e,Bu)}});var fa=p((dm,da)=>{"use strict";var ua=pe(),Du=U(),pa=K(),Hu=Qs(),Uu=ca(),Gu=Fe(),zu=hr().f,ha=pa(zu),Wu=pa([].push),Ku=ua&&Du(function(){var r=Object.create(null);return r[2]=2,!ha(r,2)}),la=function(r){return function(e){for(var t=Gu(e),i=Uu(t),n=Ku&&Hu(t)===null,s=i.length,o=0,c=[],a;s>o;)a=i[o++],(!ua||(n?a in t:ha(t,a)))&&Wu(c,r?[a,t[a]]:t[a]);return c}};da.exports={entries:la(!0),values:la(!1)}});var ma=p(()=>{"use strict";var Qu=Ue(),Yu=fa().values;Qu({target:"Object",stat:!0},{values:function(e){return Yu(e)}})});var ya=p((vm,va)=>{"use strict";ma();var Xu=Tt();va.exports=Xu.Object.values});var ga=p((ym,ba)=>{"use strict";var Zu=ya();ba.exports=Zu});var Dt=p((bm,Ca)=>{"use strict";var Ju=ga();Ca.exports=Ju});var Ta=p(()=>{"use strict";var ep=Ue(),tp=Yr().includes,rp=U(),ip=Rt(),np=rp(function(){return!Array(1).includes()});ep({target:"Array",proto:!0,forced:np},{includes:function(e){return tp(this,e,arguments.length>1?arguments[1]:void 0)}});ip("includes")});var Sa=p((xm,xa)=>{"use strict";Ta();var sp=Ot();xa.exports=sp("Array","includes")});var Aa=p((Sm,wa)=>{"use strict";var ap=Sa();wa.exports=ap});var Ht=p((wm,Ra)=>{"use strict";var op=Aa();Ra.exports=op});var ti=p((Hm,La)=>{"use strict";var lp=_e();La.exports=Array.isArray||function(e){return lp(e)==="Array"}});var Na=p((Um,$a)=>{"use strict";var up=TypeError,pp=9007199254740991;$a.exports=function(r){if(r>pp)throw up("Maximum allowed index exceeded");return r}});var qa=p((Gm,Fa)=>{"use strict";var hp=ti(),dp=ze(),fp=Na(),mp=Vr(),_a=function(r,e,t,i,n,s,o,c){for(var a=n,l=0,m=o?mp(o,c):!1,v,d;l<i;)l in t&&(v=m?m(t[l],l,e):t[l],s>0&&hp(v)?(d=dp(v),a=_a(r,e,v,d,a,s-1)-1):(fp(a+1),r[a]=v),a++),l++;return a};Fa.exports=_a});var Ha=p((zm,Da)=>{"use strict";var vp=Be(),yp=vp("toStringTag"),Ba={};Ba[yp]="z";Da.exports=String(Ba)==="[object z]"});var Ga=p((Wm,Ua)=>{"use strict";var bp=Ha(),gp=G(),Gt=_e(),Cp=Be(),Ep=Cp("toStringTag"),Ip=Object,Tp=Gt(function(){return arguments}())==="Arguments",xp=function(r,e){try{return r[e]}catch(t){}};Ua.exports=bp?Gt:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=xp(e=Ip(r),Ep))=="string"?t:Tp?Gt(e):(i=Gt(e))==="Object"&&gp(e.callee)?"Arguments":i}});var Wa=p((Km,za)=>{"use strict";var Sp=K(),wp=G(),ri=wt(),Ap=Sp(Function.toString);wp(ri.inspectSource)||(ri.inspectSource=function(r){return Ap(r)});za.exports=ri.inspectSource});var Ja=p((Qm,Za)=>{"use strict";var Rp=K(),Op=U(),Ka=G(),Pp=Ga(),kp=xt(),Mp=Wa(),Qa=function(){},Ya=kp("Reflect","construct"),ii=/^\s*(?:class|function)\b/,Vp=Rp(ii.exec),jp=!ii.test(Qa),nt=function(e){if(!Ka(e))return!1;try{return Ya(Qa,[],e),!0}catch(t){return!1}},Xa=function(e){if(!Ka(e))return!1;switch(Pp(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return jp||!!Vp(ii,Mp(e))}catch(t){return!0}};Xa.sham=!0;Za.exports=!Ya||Op(function(){var r;return nt(nt.call)||!nt(Object)||!nt(function(){r=!0})||r})?Xa:nt});var io=p((Ym,ro)=>{"use strict";var eo=ti(),Lp=Ja(),$p=Te(),Np=Be(),_p=Np("species"),to=Array;ro.exports=function(r){var e;return eo(r)&&(e=r.constructor,Lp(e)&&(e===to||eo(e.prototype))?e=void 0:$p(e)&&(e=e[_p],e===null&&(e=void 0))),e===void 0?to:e}});var so=p((Xm,no)=>{"use strict";var Fp=io();no.exports=function(r,e){return new(Fp(r))(e===0?0:e)}});var ao=p(()=>{"use strict";var qp=Ue(),Bp=qa(),Dp=qe(),Hp=ze(),Up=Ge(),Gp=so();qp({target:"Array",proto:!0},{flat:function(){var e=arguments.length?arguments[0]:void 0,t=Dp(this),i=Hp(t),n=Gp(t,0);return n.length=Bp(n,t,t,i,0,e===void 0?1:Up(e)),n}})});var oo=p(()=>{"use strict";var zp=Rt();zp("flat")});var lo=p((rv,co)=>{"use strict";ao();oo();var Wp=Ot();co.exports=Wp("Array","flat")});var po=p((iv,uo)=>{"use strict";var Kp=lo();uo.exports=Kp});var fo=p((nv,ho)=>{"use strict";var Qp=po();ho.exports=Qp});var nh={};Go(nh,{ContainerTypes:()=>C.ContainerTypes,ControlTypes:()=>C.ControlTypes,CustomError:()=>F,EVENT_NAMES:()=>O,EventActionTypes:()=>C.EventActionTypes,EventTypes:()=>C.EventTypes,Interactives:()=>ot,ManifestController:()=>ve,SDKInfo:()=>ih,chapterIdsToVKVideoIds:()=>Wt,compareVersions:()=>Ft,containerTypes:()=>hu,controlTypes:()=>du,eventActionTypes:()=>Dr,eventTypes:()=>fu,getChapterIdByVkVideoId:()=>jo,getVKVideoIdByMedia:()=>ai,getVideoRawIdByMedia:()=>Mo,graphEventTypes:()=>Pe,hasEndTemplate:()=>rt,interactivesEventTypes:()=>j,isAreaControl:()=>pu,isButtonControl:()=>uu,isLastChapter:()=>Y,isOneTextCtrlContainer:()=>me,isSupportedManifest:()=>C.isSupportedManifest,isTextControl:()=>Ze,isVKVariantItem:()=>Vo,isValidManifest:()=>Br,migrateManifestToLatestVersion:()=>C.migrateManifestToLatestVersion,utils:()=>_o,vkVideoIdsToChapterIds:()=>oi});module.exports=zo(nh);var Ei="1.0.30-dev.df9dc719.0";function tr(r,e=1){let t="0",i="0",n="0";return r.length===4?(t="0x"+r[1]+r[1],i="0x"+r[2]+r[2],n="0x"+r[3]+r[3]):r.length===7&&(t="0x"+r[1]+r[2],i="0x"+r[3]+r[4],n="0x"+r[5]+r[6]),`rgba(${+t},${+i},${+n},${e})`}var D="interactive",Wo="interactive-controls-container",pt=()=>document.querySelector(`.${Wo}`),Ii=.4,B={textColor:"#000",textSize:.4,textContent:"",roundCorners:0,borderWidth:0,borderColor:"#000",borderAlpha:1,backgroundColor:"#fff",backgroundAlpha:1,innerSizesDependOn:"self",angle:0},Ti=(i=>(i.top="flex-start",i.bottom="flex-end",i.center="center",i))(Ti||{}),xi=(i=>(i.start="flex-start",i.end="flex-end",i.center="center",i))(xi||{}),Si=(i=>(i.start="left",i.end="right",i.center="center",i))(Si||{}),ht=({target:r,props:e})=>{var t,i,n;r.style.alignItems=(t=(e==null?void 0:e.gravityVertical)&&Ti[e.gravityVertical])!=null?t:"center",r.style.justifyContent=(i=(e==null?void 0:e.gravityHorizontal)&&xi[e.gravityHorizontal])!=null?i:"center",r.style.textAlign=(n=(e==null?void 0:e.alignment)&&Si[e.alignment])!=null?n:"left"},dt=({target:r,props:e,fallback:t,dependsOn:i})=>{var n,s,o,c,a,l;r.style.color=(s=(n=e==null?void 0:e.text)==null?void 0:n.color)!=null?s:t.textColor,r.style.fontSize=`calc(${i.height} * ${(c=(o=e==null?void 0:e.text)==null?void 0:o.size)!=null?c:t.textSize})`,r.textContent=(l=(a=e==null?void 0:e.text)==null?void 0:a.value)!=null?l:t.textContent},ft=({target:r,props:e,fallback:t})=>{var i,n,s,o;r.style.backgroundColor=tr((n=(i=e==null?void 0:e.background)==null?void 0:i.color)!=null?n:t.backgroundColor,(o=(s=e==null?void 0:e.background)==null?void 0:s.alpha)!=null?o:t.backgroundAlpha)},mt=({target:r,props:e,fallback:t,dependsOn:i})=>{var n,s,o,c,a,l,m,v,d,b,w;r.style.border=`calc(${i.height} * ${(o=(s=(n=e==null?void 0:e.shape)==null?void 0:n.border)==null?void 0:s.width)!=null?o:t.borderWidth}) solid ${tr((l=(a=(c=e==null?void 0:e.shape)==null?void 0:c.border)==null?void 0:a.color)!=null?l:t.borderColor,(d=(v=(m=e==null?void 0:e.shape)==null?void 0:m.border)==null?void 0:v.alpha)!=null?d:t.borderAlpha)}`,r.style.borderRadius=`calc(${i.height} * ${(w=(b=e==null?void 0:e.shape)==null?void 0:b.roundCorners)!=null?w:t.roundCorners})`},Ee=({target:r,layoutParams:e,fallback:t})=>{var n;let i=(n=e.angle)!=null?n:t.angle;i=i&&i*-1,r.style.transform=`rotate(${i}rad)`};var re=class{constructor(e){this.control=e;this.container=null;this.controlElement=null;this.clickListener=null}createContainerElement(e){var n;let t=document.createElement("div");t.classList.add(`${D}-control-container-${this.control.id}`),e(t,this.control.layoutParams);let i=((n=this.control.layoutParams.innerSizesDependOn)!=null?n:B.innerSizesDependOn)==="self"?{height:t.style.height,width:t.style.width}:{height:"var(--interactive-content-height)",width:"var(--interactive-content-width)"};this.container={element:t,dimensions:i}}createClickListener(e){return t=>{t.stopPropagation(),e()}}setEvents(e){!this.container||!this.control.events||this.control.events.forEach(t=>{var n;switch(t.type.trim().toLowerCase()){case"onclick":this.clickListener=this.createClickListener(()=>e({action:t.action,controlId:this.control.id,controlType:this.control.type})),(n=this.container)==null||n.element.addEventListener("click",this.clickListener);break;default:break}})}removeListeners(){var e,t;(e=this.container)!=null&&e.element&&this.clickListener&&((t=this.container)==null||t.element.removeEventListener("click",this.clickListener))}};var rr="int",ue=(i=>(i.AREA=`${rr}_area`,i.TEXT=`${rr}_text`,i.BUTTON=`${rr}_bttn`,i))(ue||{});var vt=r=>{if(r.type.trim().toLowerCase()==="area")return new ir(r)},ir=class extends re{constructor(e){super(e)}createView({parentElement:e,layoutCallback:t}){if(super.createContainerElement(t),!this.container)return;let i=document.createElement("button");i.type="button",i.classList.add(`${D}-${this.control.id}`),i.setAttribute("data-testid",ue.AREA),i.style.display="flex",i.style.width="100%",i.style.height="100%",i.style.cursor="pointer",ft({target:i,props:this.control.props,fallback:I(f({},B),{backgroundColor:"transparent"})}),mt({target:i,props:this.control.props,fallback:I(f({},B),{borderAlpha:0}),dependsOn:this.container.dimensions}),Ee({target:i,layoutParams:this.control.layoutParams,fallback:B}),this.container.element.append(i),e.append(this.container.element),this.controlElement=i}disable(){this.controlElement&&(this.controlElement.style.cursor="default")}enable(){this.controlElement&&(this.controlElement.style.cursor="pointer")}getElement(){return this.controlElement}};var yt=()=>{let r=document.createElement("span");return r.style.display="inline-block",r.style.whiteSpace="pre",r.style.overflow="hidden",r.style.textOverflow="ellipsis",r.style.maxWidth="100%",r.style.maxHeight="100%",r};var bt=r=>{if(r.type.trim().toLowerCase()==="button")return new nr(r)},nr=class extends re{constructor(e){super(e)}createView({parentElement:e,layoutCallback:t}){if(super.createContainerElement(t),!this.container)return;let i=document.createElement("button");i.type="button",i.classList.add(`${D}-${this.control.id}`),i.setAttribute("data-testid",ue.BUTTON),i.style.display="flex",i.style.width="100%",i.style.height="100%",i.style.cursor="pointer",i.style.fontFamily="inherit",Ee({target:i,layoutParams:this.control.layoutParams,fallback:B}),ft({target:i,props:this.control.props,fallback:B}),mt({target:i,props:this.control.props,fallback:B,dependsOn:this.container.dimensions}),ht({target:i,props:I(f({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let n=yt();dt({target:n,props:this.control.props,fallback:B,dependsOn:this.container.dimensions}),i.append(n),this.container.element.append(i),e.append(this.container.element),this.controlElement=i}disable(){this.controlElement&&(this.controlElement.style.cursor="default")}enable(){this.controlElement&&(this.controlElement.style.cursor="pointer")}getElement(){return this.controlElement}};var wi=r=>{if(r.type.trim().toLowerCase()==="text")return new sr(r)},sr=class extends re{constructor(e){super(e)}createView({parentElement:e,layoutCallback:t}){if(super.createContainerElement(t),!this.container)return;let i=document.createElement("div");i.classList.add(`${D}-${this.control.id}`),i.setAttribute("data-testid",ue.TEXT),i.style.display="flex",i.style.width="100%",i.style.height="100%",i.style.fontFamily="inherit",Ee({target:i,layoutParams:this.control.layoutParams,fallback:B}),ht({target:i,props:I(f({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let n=yt();dt({target:n,props:this.control.props,fallback:B,dependsOn:this.container.dimensions}),i.append(n),this.container.element.append(i),e.append(this.container.element),this.controlElement=i}disable(){}enable(){}getElement(){return this.controlElement}};var ar=class{constructor(e){this.layout=e}},gt=class extends ar{constructor(e){super(e)}setContainerLayout(e){e.style.position="relative"}setControlLayout(e,t){e.style.position="absolute",e.style.width=`calc(var(--interactive-content-width) * ${t.width})`,e.style.height=`calc(var(--interactive-content-height) * ${t.height})`,e.style.left=`calc(var(--interactive-content-width) * ${t.x} + ((var(--interactive-width) - var(--interactive-content-width)) / 2))`,e.style.top=`calc(var(--interactive-content-height) * ${t.y} + ((var(--interactive-height) - var(--interactive-content-height)) / 2))`}};var Ie=class{constructor(e){this.container=e,this.factories=new Map,this.controls=[],this.setControls()}addControlFactory(e,t){this.factories.set(e.trim().toLowerCase(),t),this.setControls()}removeControlFactory(e){this.factories.delete(e.trim().toLowerCase()),this.setControls()}setControls(){this.controls=this.chooseControls()}chooseControls(){var e;return((e=this.container.controls)==null?void 0:e.reduce((t,i)=>{let n=i.type.trim().toLowerCase(),s=this.factories.get(n);if(s){let o=s(i);if(o)return[...t,o]}return[...t]},[]))||[]}};var Ct=(r,e)=>{if(r.type.trim().toLowerCase()==="choice")return new or(r,e)},or=class extends Ie{constructor(e,t){super(e),this.rootElement=t!=null?t:pt(),this.layout=new gt(this.container.layout),this.isRemoved=!1,this.isDisabled=!1,this.addControlFactory("button",bt),this.addControlFactory("text",wi),this.addControlFactory("area",vt)}createView(e){let t=document.createElement("div");return t.classList.add(`${D}-${this.container.id}`),this.layout.setContainerLayout(t),this.controls.forEach(i=>{i.createView({parentElement:t,layoutCallback:this.layout.setControlLayout}),i.setEvents(e)}),this.rootElement.append(t),this.isRemoved=!1,t}hide(){let e=this.getElement();e&&(e.style.visibility="hidden")}show(){let e=this.getElement();e&&(e.style.visibility="visible")}enable(){let e=this.getElement();e&&(this.controls.forEach(t=>t.enable()),e.style.opacity="1",this.isDisabled=!1)}disable(){let e=this.getElement();e&&(this.controls.forEach(t=>t.disable()),e.style.opacity=`${Ii}`,this.isDisabled=!0)}removeView(e=!1){var t;(!this.isRemoved||e)&&(this.controls.forEach(i=>i.removeListeners()),(t=this.getElement())==null||t.remove(),this.isRemoved=!0)}fakeRemove(){this.isRemoved||(this.isRemoved=!0)}getElement(){return this.rootElement.querySelector(`.${D}-${this.container.id}`)}};var No=Z(_r(),1),T=require("@vkontakte/videoplayer-shared/es2015"),Ve=require("@vkontakte/videoplayer-statistics/es2015");var js=require("@vkontakte/videoplayer-shared/es2015");function We(r,e){let t;return(...i)=>{clearTimeout(t),t=setTimeout(()=>r(...i),e)}}var he=(r,e)=>Object.prototype.toString.call(r)===`[object ${e}]`,Ke=r=>he(r,"Object"),Pt=r=>he(r,"String"),kt=r=>he(r,"Array"),Mt=r=>he(r,"Number"),Ps=r=>he(r,"Function");var Fr=r=>Mt(r)&&!isNaN(r);var de=r=>Ke(r)&&Object.keys(r).length===0,qr=r=>kt(r)&&!r.length;var Qe=(r,e)=>Pt(r)&&(e?r.trim():r).length;var ks="video_interactive",Ms="videoint";var Vs=250,Ye=class{constructor(e){this.handleZoomChange=We(e=>{this.lastZoomInfo=e},Vs);this.onResize=e=>{var i;if(!this.isReady||this.isHidden||!e[0].contentRect.width||!e[0].contentRect.height)return;let t=this.getNextPoint();t&&((i=this.ngEditor)==null||i.zoomTo(t)),this.ngEditorSize={width:e[0].contentRect.width,height:e[0].contentRect.height}};this.handleChapterChange=e=>{var t,i,n;if(this.manifest){if(this.isHidden||this.hide(),!(e!=null&&e.id)){(t=this.onError)==null||t.call(this,"Id is not found"),console.error("Id is not found");return}this.visitedChapterIds.add(e.id),(i=this.ngEditor)==null||i.selectChapter(e.id),(n=this.ngEditor)==null||n.setVisitedChapters(Array.from(this.visitedChapterIds)),this.currentChapterId=e.id,this.lastZoomInfo=null}};this.handleManifestChange=(e,t=[])=>{var i;if(this.isReady=!1,!Mt(e.graph.edit.chapters[0].x)){(i=this.onError)==null||i.call(this,"Can't show graph"),console.error("Can't show graph");return}this.lastZoomInfo=null,this.manifest=e,this.visitedChapterIds=new Set(t),this.ngEditor&&(this.manifest.metadata.id!==this.currentManifestId?(this.ngEditor.update(e),this.currentManifestId=this.manifest.metadata.id):this.ngEditor.setVisitedChapters(Array.from(t)),this.isReady=!0)};this.init(e)}init({root:e,onOpenPreviewClick:t,onError:i,lang:n,visitedChapters:s=[]}){this.isReady=!1,this.isHidden=!0,this.manifest=null,this.visitedChapterIds=new Set(s),this.onOpenPreviewClick=t,this.onError=i,this.lang=n!=null?n:"ru",this.zoom=.7,this.lastZoomInfo=null,this.currentManifestId=null,this.currentChapterId=null,this.ngEditor=null,this.ngEditorSize=null,this.graphWrapperElement=lu(e),this.resizeObserver=new ResizeObserver(We(this.onResize,Vs)),this.resizeObserver.observe(this.graphWrapperElement)}getNextPoint(e=this.ngEditorSize){return!this.lastZoomInfo||!e?null:[(this.lastZoomInfo.x-e.width/2)/this.lastZoomInfo.value*-1,(this.lastZoomInfo.y-e.height/2)/this.lastZoomInfo.value*-1]}setVisitedChapters(e){var t;this.visitedChapterIds=new Set([...this.visitedChapterIds,...e]),(t=this.ngEditor)==null||t.setVisitedChapters(Array.from(this.visitedChapterIds))}updateVideosInfo(e){var t;(t=this.ngEditor)==null||t.updateVideosInfo(e)}show(){return k(this,null,function*(){var e;this.manifest&&(this.ngEditor||(yield this.initNgEditor()),this.graphWrapperElement.style.display="block",!this.lastZoomInfo&&this.currentChapterId&&((e=this.ngEditor)==null||e.focusChapter(this.currentChapterId)),this.isHidden=!1)})}initNgEditor(){return k(this,null,function*(){if(!this.manifest)return;let e;try{e=yield(0,js.loadVKLangPack)(this.lang,ks,Ms)}catch(i){console.log("Unable to load graph language pack")}let{GraphEditor:t}=yield import("@interactiveplatform/movika-graph-editor");this.ngEditor=new t(this.graphWrapperElement,{mode:"read",lang:this.lang==="ru"?"ru":"en",translation:e}),this.currentManifestId=this.manifest.metadata.id,this.ngEditor.update(this.manifest),this.ngEditor.setVisitedChapters(Array.from(this.visitedChapterIds)),this.currentChapterId&&this.ngEditor.selectChapter(this.currentChapterId),this.ngEditor.on("control",s=>{var o=s,{name:i}=o,n=X(o,["name"]);var c;i==="openPreview"&&"chapterId"in n&&((c=this.onOpenPreviewClick)==null||c.call(this,n.chapterId))}),this.ngEditor.on("zoom",this.handleZoomChange),this.isReady=!0})}hide(){this.graphWrapperElement.style.display="none",this.isHidden=!0}destroy(){var e,t;this.hide(),this.manifest=null,this.resizeObserver.disconnect(),(e=this.ngEditor)==null||e.setVisitedChapters([]),this.onOpenPreviewClick=void 0,(t=this.ngEditor)==null||t.dispose(),this.graphWrapperElement.remove(),this.isReady=!1}};function lu(r){let e=document.createElement("div");return e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.height="100%",e.style.width="100%",e.style.display="none",r.append(e),e}var Xe=class{constructor(){this._containers=[];this._player=null;this.setPlayer=e=>{this._player=e};this.setContainers=e=>{this._containers=e};this.deleteContainer=e=>{this._containers=this._containers.filter(t=>t.id!==e)};this.getNextInteractiveTime=(e=3e3)=>{if(!this._containers.length||this._player===null)return null;let t=-1,i=!1,n=Math.round(this._player.info.position$.getValue()*1e3);for(let s of this._containers){let o=s.startTime-e;if(o<=n&&(s.endTime&&n<=s.endTime||s.endTime===null)){i=!0;break}n<o&&(t=t===-1?o:Math.min(t,o))}return!i&&t!==-1?t:null}}};var C=require("@interactiveplatform/movika-manifest");var Ls={metadata:"Object",chapters:"Array"},Br=r=>{if(!Ke(r))return!1;for(let e in Ls)if(!r[e]||!he(r[e],Ls[e]))return!1;return(0,C.isSupportedManifest)(r.metadata.version)},Ze=r=>r.type===C.ControlTypes.Text,uu=r=>r.type===C.ControlTypes.Button,pu=r=>r.type===C.ControlTypes.Area,hu={Choice:"Choice",TextInput:"TextInput"},du={Button:"Button",Area:"Area",Text:"Text"},fu={onClick:"onClick",onSuspense:"onSuspense"},Dr={openURI:"openURI",setNextBranch:"setNextBranch",setWeightlessRandomBranch:"setWeightlessRandomBranch",setRandomBranch:"setRandomBranch",setMaxWeightBranch:"setMaxWeightBranch",setMinWeightBranch:"setMinWeightBranch",setDefaultBranch:"setDefaultBranch",continuePlayback:"continuePlayback",expect:"expect"};var F=class{constructor(e,t,...i){this.severity=e;this.category=t;this.data=i}toString(){return`Interactive SDK error ${JSON.stringify(this,null," ")}`}};var Vt=class{constructor(){this.listeners={}}addListener(e,t){return this.listeners[e]=this.listeners[e]||[],this.listeners[e].push(t),this}on(e,t){return this.addListener(e,t)}once(e,t){this.listeners[e]=this.listeners[e]||[];let i=()=>{t(),this.off(e,i)};return this.listeners[e].push(i),this}off(e,t){return this.removeListener(e,t)}reset(){this.listeners={}}removeListener(e,t){let i=this.listeners[e]||[];for(let n=i.length;n>0;n--)if(i[n]===t){i.splice(n,1);break}return this}emit(e,...t){let i=this.listeners[e];return i?(i.forEach(n=>{n(...t)}),!0):!1}listenerCount(e){return this.rawListeners(e).length}rawListeners(e){return this.listeners[e]||[]}};var jt=class{constructor(e){this.fns=[];this.addFn=(e,t=!1)=>{Ps(e)&&(this.fns.push(e),t&&this.updateFn())};this.removeFn=(e,t=!1)=>{this.fns=this.fns.filter(i=>i!==e),t&&this.updateFn()};this.updateFn=()=>{this.fn=()=>{this.fns.forEach(e=>e()),this.raf&&this.forceRequestAnimation()}};this.forceRequestAnimation=()=>{this.fn&&(this.raf=requestAnimationFrame(this.fn))};this.requestAnimation=()=>{this.raf||this.forceRequestAnimation()};this.cancelAnimation=()=>{this.raf&&(cancelAnimationFrame(this.raf),this.raf=void 0)};e&&(this.fn=e,this.addFn(e))}release(){this.cancelAnimation(),this.fn=void 0,this.fns=[]}};var Bs=require("@vkontakte/videoplayer-shared/es2015");var Lt=class{constructor(e){var t,i;this.loaders={chapterLoaders:(t=e==null?void 0:e.chapterLoaders)!=null?t:[],manifestLoaders:(i=e==null?void 0:e.manifestLoaders)!=null?i:[]}}exec(e,t){return k(this,null,function*(){return mu(...this.loaders[e])(t)})}};function mu(...r){return function(t){return k(this,null,function*(){let i=[...r];for(;i.length>0;)t=yield i.shift()(t);return t})}}function Je(r,e,t){return r?I(f({},r),{[e]:r[e]?[t,...r[e]]:[t]}):{[e]:[t]}}function $t(n){var s=n,{actions:r,errors:e,chapterId:t}=s,i=X(s,["actions","errors","chapterId"]);if(t){let o=r.getManifest(),c=r.getChapter(o.chapters,t);if(c){let a=r.getMedia(o.media,c.videoId),l=r.getGraph(o.graph,c.id);return a?I(f({},i),{actions:r,errors:e,result:{chapter:c,media:a,graph:l}}):I(f({},i),{errors:Je(e,$t.name,"Could not find media"),actions:r})}}return I(f({},i),{errors:Je(e,$t.name,"Could not find chapter"),actions:r})}var Nt=class{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(e,t,i){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:t,options:i})}removeEventListener(e,t){if(!(e in this.listeners))return;let i=this.listeners[e];for(let n=0,s=i.length;n<s;n++)if(i[n].callback===t){i.splice(n,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let i=this.listeners[e.type].slice();for(let n=0,s=i.length;n<s;n++){let o=i[n];try{o.callback.call(this,e)}catch(c){Promise.resolve().then(()=>{throw c})}o.options&&o.options.once&&this.removeEventListener(e.type,o.callback)}return!e.defaultPrevented}},Re=class extends Nt{constructor(){super(),this.listeners||Nt.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(e){e.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,e)),super.dispatchEvent(e)}},et=class{constructor(){Object.defineProperty(this,"signal",{value:new Re,writable:!0,configurable:!0})}abort(e){let t;try{t=new Event("abort")}catch(n){typeof document!="undefined"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}let i=e;if(i===void 0)if(typeof document=="undefined")i=new Error("This operation was aborted"),i.name="AbortError";else try{i=new DOMException("signal is aborted without reason")}catch(n){i=new Error("This operation was aborted"),i.name="AbortError"}this.signal.reason=i,this.signal.dispatchEvent(t)}toString(){return"[object AbortController]"}};typeof Symbol!="undefined"&&Symbol.toStringTag&&(et.prototype[Symbol.toStringTag]="AbortController",Re.prototype[Symbol.toStringTag]="AbortSignal");function _t(r){return r.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof r.Request=="function"&&!r.Request.prototype.hasOwnProperty("signal")||!r.AbortController}function Hr(r){typeof r=="function"&&(r={fetch:r});let{fetch:e,Request:t=e.Request,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:n=!1}=r;if(!_t({fetch:e,Request:t,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:n}))return{fetch:e,Request:s};let s=t;(s&&!s.prototype.hasOwnProperty("signal")||n)&&(s=function(l,m){let v;m&&m.signal&&(v=m.signal,delete m.signal);let d=new t(l,m);return v&&Object.defineProperty(d,"signal",{writable:!1,enumerable:!1,configurable:!0,value:v}),d},s.prototype=t.prototype);let o=e;return{fetch:(a,l)=>{let m=s&&s.prototype.isPrototypeOf(a)?a.signal:l?l.signal:void 0;if(m){let v;try{v=new DOMException("Aborted","AbortError")}catch(b){v=new Error("Aborted"),v.name="AbortError"}if(m.aborted)return Promise.reject(v);let d=new Promise((b,w)=>{m.addEventListener("abort",()=>w(v),{once:!0})});return l&&l.signal&&delete l.signal,Promise.race([d,o(a,l)])}return o(a,l)},Request:s}}var tt=_t({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),$s=tt?Hr({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,Ur=tt?$s.fetch:window.fetch,$f=tt?$s.Request:window.Request,Nf=tt?et:window.AbortController,_f=tt?Re:window.AbortSignal;var Ft=(r="",e="")=>{let t=r.split("."),i=e.split("."),n=0;for(let s=0;s<Math.max(t.length,i.length)&&!n;s++)t[s]>i[s]?n=1:t[s]<i[s]?n=-1:n=0;return n};var vu=r=>k(void 0,null,function*(){try{let e={},t;if(Pt(r)){t=new URL(r).href;let n=yield Ur(t);if(!n.ok)return{};e=yield n.json()}else if(Ke(r))e=r;else return{};if(!Br(e))return{};let i=e.metadata.media;if(Pt(i)&&!("media"in e))try{let n;t?n=new URL(i,t).href:(n=new URL(i).href,t=n);let s=yield Ur(n);if(!s.ok)throw new Error;e.metadata.media=yield s.json()}catch(n){return gu(e.metadata.version)?{manifest:e}:{}}return{manifest:e,manifestURL:t}}catch(e){return{}}});function Ns(r){return k(this,null,function*(){let{manifest:e,manifestURL:t}=yield vu(r);if(!e)throw new Error("Failed on fetch");let i=(0,C.migrateManifestToLatestVersion)(e);return i.media=yu(i.media,t),delete i.metadata.media,i})}function qt(r,e){if(e)return r.find(t=>t.id===e)}function Gr(r,e){var t,i;return(t=r.edit)!=null&&t.chapters?r.edit.chapters.find(n=>n.id===e):(i=r.view)!=null&&i.chapters?r.view.chapters.find(n=>n.id===e):void 0}function zr(r,e){return r.videos.find(t=>t.id===e)}function yu(r,e){return I(f({},r),{videos:r.videos.map(t=>I(f({},t),{variants:t.variants.map(i=>{let n="url"in i?i.url:"",s=bu(n,e);return I(f({},i),{url:s||n})})}))})}function bu(r="",e){try{return new URL(r,e).href}catch(t){return""}}function gu(r){return Ft(r,"3.2.0")>=0}var Bt=r=>kt(r)&&!qr(r),Y=r=>r.order==="end",rt=r=>kt(r.containers)&&!qr(r.containers)&&Y(r),_s=(r,e)=>{var i;let t=r*1e3;return Bt(e.controls)&&t<((i=e.startTime)!=null?i:0)},Wr=(r,e)=>{var i,n;let t=r*1e3;return Bt(e.controls)&&t>=((i=e.startTime)!=null?i:0)&&t<=((n=e.endTime)!=null?n:1/0)};var fe=(r=[])=>r.some(e=>e.action.type==="expect"),Kr=(r=[])=>r.find(e=>e.action.type==="expect"),Cu=r=>(r==null?void 0:r.length)===1,me=r=>Cu(r)&&Ze(r[0]);function Fs(r,...e){return t=>typeof e[0]=="object"&&typeof t=="object"?r(f(f({},e[0]),t)):r(...e,...t)}var qs=(r,e)=>{let t=d=>{let b=e.find(({container:w})=>w.container.id===d);return b==null?void 0:b.container.isRemoved},i=fe(r.events)&&!t(r.id),n=(d,b=!1,w=!1)=>{let P=w?"every":"some";return d.controls[P](y=>{var $;let V=b?d.endTime===r.endTime:!0;return(($=y.events)==null?void 0:$[P](u=>{var h;return((h=u.action)==null?void 0:h.type)===Dr.openURI}))&&V})},s=d=>d.some(({container:b})=>n(b.container,!0,!1)&&!b.isRemoved),o=d=>d.every(({container:b})=>b.isRemoved?!0:n(b.container,!0,!0)),c=e.filter(({container:d})=>d.container.id!==r.id&&fe(d.container.events)&&d.container.endTime===r.endTime&&!d.isRemoved).length,a=i||c>0,l=s(e),m=n(r),v=o(e);return{isExpectTime:a,hasOtherExpect:c>0,hasOpenURIEvent:l,hasOpenURIEventInCurrentContainer:m,isAllOpenURIEventsValid:v}};var ve=class extends Lt{constructor(t,i){super(t);this.manifest=null;this.chapter=null;this.media=null;this.graph=null;this.prevChapter$=new Bs.ValueSubject(null);this.onError=i,this.release()}release(){return this.manifest=null,this.chapter=null,this.media=null,this.graph=null,this.prevChapter$.next(null),this}setManifest(t){return k(this,null,function*(){var n;this.release();let i=yield this.exec("manifestLoaders",{actions:{addErrorMessage:Je},result:null,errors:null,source:t});return i.errors&&this.errorHandler(i.errors),this.manifest=yield Ns((n=i.result)!=null?n:t),this})}setInitial(){return k(this,null,function*(){return this.setNext()})}setNext(){return k(this,arguments,function*(t=(i=>(i=this.manifest)==null?void 0:i.metadata.initChapterId)()){if(!t)return this;this.prevChapter$.next(this.chapter);let n=yield this.exec("chapterLoaders",$t({actions:{getManifest:()=>this.manifest,getCurrent:this.getCurrent,getGraph:Gr,getChapter:qt,getMedia:zr,getByBranches:this.getByBranches.bind(this),addErrorMessage:Je},result:null,errors:null,chapterId:t}));return n.errors&&this.errorHandler(n.errors),this.chapter=n.result.chapter,this.media=n.result.media,this.graph=n.result.graph,this})}errorHandler(t){this.onError(t),console.error("Something went wrong with loaders",{errors:t})}getInitial(){var i;return this.getByChapterId((i=this.manifest)==null?void 0:i.metadata.initChapterId)||null}getByChapterId(t=(i=>(i=this.manifest)==null?void 0:i.metadata.initChapterId)()){if(!t||!this.manifest)return null;let n=qt(this.manifest.chapters,t);if(n){let s=zr(this.manifest.media,n.videoId),o=Gr(this.manifest.graph,n.id);if(s)return{chapter:n,media:s,graph:o}}return null}getBranches(t=(i=>(i=this.chapter)==null?void 0:i.id)()){var n,s,o;if(t===((n=this.chapter)==null?void 0:n.id))return this.getByBranches((s=this.chapter)==null?void 0:s.branches);{let c=qt(((o=this.manifest)==null?void 0:o.chapters)||[],t);return this.getByBranches(c==null?void 0:c.branches)}}getByBranches(t=[]){return t.reduce((i,n)=>{let s=this.getByChapterId(n.chapterId);return s&&i.push(s),i},[])}getCurrent(){return{chapter:this.chapter,media:this.media,graph:this.graph}}isInitialChapter(){var t,i;return((t=this.chapter)==null?void 0:t.id)===((i=this.manifest)==null?void 0:i.metadata.initChapterId)}isEndChapter(){return this.chapter?Y(this.chapter):!1}};var Oa=Z(Dt(),1),Pa=require("@vkontakte/videoplayer-core/es2015"),ce=require("@vkontakte/videoplayer-shared/es2015");var Ea=r=>{let e=r.variants.find(t=>{var i;return((i=t.payload)==null?void 0:i.type)==="vk"});if(e&&e.payload){let[t,i]=e.payload.id.split("_");return[t,i]}return[]};var Ia=Z(Dt(),1);function Zr(){let r=new Map;function e(a){var l=a,{listId:s=Math.random().toString(),itemId:o=Math.random().toString()}=l,c=X(l,["listId","itemId"]);let m=r.get(s),v=f({},c);return m?m[o]=v:r.set(s,{[o]:v}),f({listId:s,itemId:o},c)}function t(s){var o,c;s.player.destroy(),s.container.remove(),s.subscription.unsubscribe(),(o=s.statistics)==null||o.oneStat.destroy(),(c=s.statistics)==null||c.statSubscription.unsubscribe()}function i(s,o){let c=r.get(s);if(!c)throw Error("Can't remove. Not find.");if(o){let a=c[o];a&&t(a),delete c[o],Object.keys(c).length||r.delete(s)}else{for(let a of(0,Ia.default)(c))t(a);r.delete(s)}}function n(){for(let s of r)i(s[0])}return{createPlayer:e,removePlayer:i,map:r,removeAll:n}}var Oe=Z(Ht(),1);function Jr(r,e=[]){var s,o,c;let t={},i,n=!e.length;for(let a of r.variants)if(!i&&"cover"in a&&(i=a.cover),"url"in a)switch(a.type.toLowerCase()){case"mp4":(n||(0,Oe.default)(e,"mp4"))&&(t.MPEG=I(f({},t.MPEG),{[(s=a.standard)!=null?s:"Invariant quality"]:a.url}));break;case"mpeg":(n||(0,Oe.default)(e,"mpeg"))&&(t.MPEG=I(f({},t.MPEG),{[(o=a.standard)!=null?o:"Invariant quality"]:a.url}));break;case"hls":(n||(0,Oe.default)(e,"hls"))&&(t=I(f({},t),{HLS:{type:"url",url:a.url}}));break;case"dash":(n||(0,Oe.default)(e,"dash"))&&(t=I(f({},t),{DASH_SEP:{compatibilityMode:!0,type:"url",url:a.url}}));break;default:break}return{sources:t,thumbUrl:i,title:(c=r.title)!=null?c:""}}var it=(r,e)=>{let t=r.info.currentQuality$.getValue(),i=r.info.availableQualities$.getValue();t!==e&&(0,Oe.default)(i,e)&&(r.setQuality(e),r.setAutoQuality(!1))};var cp=2;function ei(r){let e=Zr(),t=new ce.Subscription,i={},n=null,s=!1,o,c=new ce.ValueSubject(null);r&&a(r);function a(y){n=y}function l(y,V,$){var g;if(!n)throw Error("need to set interactive controller");if(!n.options)return;let h=((g=e.map.get(y))!=null?g:{})[V];if(h){i=f({chapterId:$,listId:y,itemId:V},h);let x=i.player;i.subscription.add(x.info.currentQuality$.subscribe(S=>{let L=x.info.position$.getValue(),M=x.info.isAutoQualityEnabled$.getValue();if(!(!S||!L||M))for(let E of e.map)(0,Oa.default)(E[1]).forEach(({player:A})=>{it(A,S)})})).add(x.events.started$.subscribe(()=>{m(V)})),h.container.remove(),n.setPlayer(h.player),s||(n.init(),s=!0),c.next({player:i.player,config:i.config,statistics:i.statistics});return}throw Error("Can't set. Not find.")}function m(y){return k(this,null,function*(){if(!n)throw Error("need to set interactive controller");if(de(i)||y!==i.itemId)return;let V=n.getChapterBranches(),$=new Set;for(let u of V)$.has(u.media.id)||(yield d({media:u.media,chapterId:u.chapter.id,setAsActive:!1,title:u.chapter.label}),$.add(u.media.id))})}function v($){return k(this,arguments,function*({chapter:{id:y},manifestVideo:V}){if(de(i)||!n)return;let u=i.player.info.muted$.getValue(),h=i.player.info.currentQuality$.getValue(),g=i.player.info.isAutoQualityEnabled$.getValue(),x=i.player.info.volume$.getValue(),S=i.player.info.currentPlaybackRate$.getValue(),L=!g,M=!1;for(let E of e.map)if(E[0]===V.id&&!n.state.isReplay$.getValue()){let A=Object.keys(E[1]);for(let _ of A)_===i.itemId?(A.length<cp||(M=!0),e.removePlayer(E[0],_)):(M=!0,l(E[0],_,y),L?it(i.player,h):i.player.setAutoQuality(!0),i.player.setVolume(x),i.player.setMuted(u),i.player.setPlaybackRate(S))}else e.removePlayer(E[0]);M||(yield d({media:V,chapterId:y,setAsActive:!0,playbackRate:S}),L?it(i.player,h):i.player.setAutoQuality(!0),i.player.setVolume(x),i.player.setMuted(u))})}function d(L){return k(this,arguments,function*({media:y,chapterId:V,prefetch:$=!0,setAsActive:u=!0,autoplay:h=!1,preferredExt:g,title:x,playbackRate:S}){var li,ui,pi,hi,di;let M=Math.random().toString(),E=document.createElement("div");o.append(E);let A;if((li=n==null?void 0:n.options)!=null&&li.vkVideoLoader){let lt=Ea(y);lt.length&&(A=yield n.options.vkVideoLoader(...lt))}let _=((ui=n==null?void 0:n.options)==null?void 0:ui.coreConfig)||void 0,ae=I(f({},_),{configName:[...(pi=_==null?void 0:_.configName)!=null?pi:[],"interactive"]}),te=I(f({container:E},((hi=A==null?void 0:A.videos)==null?void 0:hi[0])||{sources:Jr(y,g).sources}),{title:x,failoverHosts:(A==null?void 0:A.failoverHosts)||[]}),q=new Pa.Player(ae,ce.Tracer.createRootTracer());q.initVideo(te);let le=null;if(A!=null&&A.videos&&(n!=null&&n.options.createOneStat)){let lt=A.videos[0],Jt=n.options.createOneStat(lt),fi=new ce.Subscription;Jt&&(fi.add(Jt.attachTo(q)),le={oneStat:Jt,statSubscription:fi})}let ct=new ce.Subscription,je=(di=i==null?void 0:i.player)==null?void 0:di.info.isAutoQualityEnabled$.getValue();ct.add(q.events.canplay$.subscribe(function(){je||it(q,i.player.info.currentQuality$.getValue()),S&&q.setPlaybackRate(S)}));let oe=e.createPlayer({listId:y.id,itemId:M,player:q,container:E,sources:Jr(y,g).sources,config:te,subscription:ct,statistics:le});return u&&l(y.id,oe.itemId,V),h&&oe.player.play(),$&&!h&&oe.player.prepare(),{player:oe.player,config:oe.config,statistics:oe.statistics}})}function b(){w(),n=null,o.remove()}function w(){t.unsubscribe(),e.removeAll(),i={},s=!1}function P(){return k(this,null,function*(){if(!n)throw Error("need to set interactive controller");w(),o=document.createElement("div");let{media:y,chapter:V}=n.getCurrentChapter();y&&V?(t.add(n.events.chapterChanged$.subscribe(v)),yield d({media:y,chapterId:V.id,title:V.label})):console.error("not found")})}return I(f({},e),{init:P,setInteractiveController:a,createPlayer:d,removeAll:b,getActivePlayer:function(){return i},activePlayerChanged:c})}var O={graph:"graph",interactives:"interactives",chapterChanged:"chapter-changed",playerChanged:"player-changed",manifestChanged:"manifest-changed",errors:"errors",eachTick:"eachTick",historyInited:"history-inited",historyDestroyed:"history-destroyed"},Pe={visibility:"visibility",watchAgainClicked:"watchAgainClicked"},j={actionChoiceCanceled:"action-choice-canceled",actionChoice:"action-choice",actionExecution:"action-execution",visibility:"visibility",containerRemoved:"container-removed",containerFakeRemoved:"container-fake-removed",rangeEnded:"range-ended"};var Ma=Z(Ht(),1),Va=require("@vkontakte/videoplayer-shared/es2015");var Ut=class{constructor({player:e,container:t,branches:i,selectBranches:n,interactiveEvents:s,globalEvents:o,globalEventEmitter:c,getContainerEventState:a,permanentTextControls:l,interactiveTimeOpenUri:m,disabledControls$:v,onRemove:d}){this.hide=()=>{setTimeout(()=>{var e,t;this.gameState!==4&&(fe(this.container.container.events)&&this.gameState===3||this.selectBranches.state.isExpect||(this.gameState!==2&&((t=(e=this.container).hide)==null||t.call(e)),this.emitContainerVisibilityEvent(!1)))})};this.show=()=>{var e,t,i,n;if(this.gameState===2&&!this.isSelectedControlEvent)if(this.container.getElement()){let{hasOpenURIEventInCurrentContainer:o}=this.getContainerEventState();if((n=(i=this.container).show)==null||n.call(i),this.interactiveTimeOpenUri&&o)return;this.emitContainerVisibilityEvent(!0,!1)}else{let o=Fs(this.selectBranches.onControlEvent,{isDisabled:()=>this.container.isDisabled,branches:this.branches,containerId:this.container.container.id,onDetachContainer:()=>{this.removeView(),this.emitContainerVisibilityEvent(!1)},onEvent:(c,a)=>{let{isExpectTime:l,hasOtherExpect:m,hasOpenURIEvent:v,hasOpenURIEventInCurrentContainer:d,isAllOpenURIEventsValid:b}=this.getContainerEventState(),w=this.interactiveTimeOpenUri&&!d,P=this.interactiveTimeOpenUri&&d;if((!this.interactiveTimeOpenUri||w)&&(this.isSelectedControlEvent=!0),c!==!1){if(!this.selectBranches.state.isExpect&&(!this.interactiveTimeOpenUri||w)){if(this.interactiveTimeOpenUri){let y=!m&&!b&&d;y&&this.globalEventEmitter.emit(O.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.containerFakeRemoved,visibility:!1,removeAllOpenURI:y})}this.removeView()}this.emitContainerVisibilityEvent(!1)}if(this.gameState===4||this.gameState===3||this.selectBranches.state.isExpect||this.interactiveTimeOpenUri&&v&&this.gameState!==5){if(P){let V=(($,u,h,g)=>!$&&!u&&h||$&&!u&&h&&!g||$&&!u&&h&&g)(l,m,b,this.isSelectedContainerEvent);this.fakeRemoveView(V)}else this.removeView(),this.emitContainerVisibilityEvent(!1);(!l||!m)&&(this.selectBranches.stopExpect(),a())}},isEOV:()=>this.gameState===4});this.container.createView(o),this.emitContainerVisibilityEvent(!0,!0),this.disabledControls$.getValue()&&((t=(e=this.container).disable)==null||t.call(e))}};this.onEndOfVideo=()=>{this.gameState=4,this.selectContainerEvent(!0)};this.whilePlaying=()=>{var l,m,v;let e=this.player.experimental.element$.getValue(),i=e instanceof HTMLVideoElement?e.readyState:void 0,n=[6,5];if(!i||(0,Ma.default)(n,this.gameState)&&!this.isPermanentText)return;let s=this.player.getExactTime();if(_s(s,this.container.container))this.gameState!==1&&(this.gameState=1,this.onBeforeStartTime());else if(Wr(s,this.container.container))this.gameState!==2&&(this.gameState=2,this.onStartTime());else if(this.gameState!==3){let d=this.gameState;this.gameState=3,d===2&&this.onEndTime()}else{let{hasOpenURIEventInCurrentContainer:d}=this.getContainerEventState(),b=this.selectBranches.state.isExpect;if(this.interactiveTimeOpenUri&&d&&!b){let P=this.container.getElement();if(P){if(P.style.visibility==="hidden")return;(m=(l=this.container).hide)==null||m.call(l),this.container.isRemoved||this.fakeRemoveView();return}}this.isPermanentText||this.removeView()}let o=Wr(s,this.container.container),c=this.container.container.startTime?[this.container.container.startTime,(v=this.container.container.endTime)!=null?v:1/0]:[],a={subjectId:this.container.container.id,subjectName:"container",range:c,currentTime:s,isInteractiveTime:o};this.globalEventEmitter.emit(O.eachTick,a),this.globalEvents.eachTick$.next(a)};this.container=t,this.branches=i,this.selectBranches=n,this.subscription=new Va.Subscription,this.player=e,this.interactiveEvents=s,this.getContainerEventState=a,this.isPermanentText=l&&me(t.container.controls),this.interactiveTimeOpenUri=m,this.disabledControls$=v,this.onRemove=d,this.globalEventEmitter=c,this.gameState=0,this.globalEvents=o,this.isSelectedControlEvent=!1,this.isSelectedContainerEvent=!1,this.registerEvents()}emitContainerVisibilityEvent(e,t=!1){e?(this.globalEventEmitter.emit(O.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.visibility,visibility:e,isFirst:t}),this.globalEvents.interactiveVisibilityChanged$.next({subjectId:this.container.container.id,subjectName:"container",type:"visibility",visibility:e,isFirst:t})):(this.globalEventEmitter.emit(O.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.visibility,visibility:!1}),this.globalEvents.interactiveVisibilityChanged$.next({subjectId:this.container.container.id,subjectName:"container",type:"visibility",visibility:e}))}registerEvents(){this.subscription.add(this.player.events.playing$.subscribe(this.show)).add(this.player.events.paused$.subscribe(this.hide)).add(this.player.events.ended$.subscribe(this.onEndOfVideo)).add(this.disabledControls$.subscribe(e=>{var t,i,n,s;e?(i=(t=this.container).disable)==null||i.call(t):(s=(n=this.container).enable)==null||s.call(n)}))}selectContainerEvent(e=!1){var i;let{isExpectTime:t}=this.getContainerEventState();this.interactiveEvents.containersEventsCallState.setCalled({timestamp:e?1/0:this.container.container.endTime,id:this.container.container.id}),!(this.isSelectedControlEvent||this.isSelectedContainerEvent)&&(this.isSelectedContainerEvent=!0,t&&!this.container.isRemoved&&this.selectBranches.setManifestContainerEvents({container:this.container.container,branches:this.branches,isEOV:e}),!e&&this.interactiveEvents.exec((i=this.container.container.endTime)!=null?i:1/0))}onStartTime(){this.show()}onEndTime(){this.selectContainerEvent(!1);let{isExpectTime:e,hasOpenURIEventInCurrentContainer:t}=this.getContainerEventState(),i=this.interactiveTimeOpenUri?e||t:fe(this.container.container.events)||e;(this.isSelectedControlEvent||!i)&&this.removeView()}onBeforeStartTime(){var e,t;(t=(e=this.container).hide)==null||t.call(e),this.emitContainerVisibilityEvent(!1)}reset(){this.isSelectedControlEvent=!1,this.isSelectedContainerEvent=!1,this.gameState=1}removeView(e=!1){var t;this.container.removeView(e),this.globalEventEmitter.emit(O.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.containerRemoved,visibility:!1}),this.globalEvents.interactiveContainerRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-removed"}),this.gameState=5,(t=this.onRemove)==null||t.call(this)}fakeRemoveView(e=!1){this.container.isRemoved||this.globalEventEmitter.emit(O.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.containerFakeRemoved,visibility:!1,removeAllOpenURI:e}),this.container.fakeRemove()}destroy(){var e;this.reset(),this.removeView(!0),this.gameState=6,this.subscription.unsubscribe(),this.branches=[],this.interactiveEvents.containersEventsCallState.setCalled({timestamp:(e=this.container.container.endTime)!=null?e:1/0,id:this.container.container.id})}};var ja=(r=[])=>r.reduce((e,t,i)=>{var s,o,c;let n=((s=t==null?void 0:t.controls)!=null?s:[]).filter(a=>!Ze(a));if(Bt(n)){let a=[(o=t.startTime)!=null?o:0,(c=t.endTime)!=null?c:1/0],l={id:t.id,isRemoved:!1};if(!i)e.push({subjects:[l],range:a});else{let m=[],v=-1/0,d=1/0,b=[],w=[];for(let P=0;P<e.length;P++){let y=e[P];if(w.push(...y.subjects),y.range[0]<d&&(d=y.range[0]),y.range[1]>v&&(v=y.range[1]),a[0]>=y.range[0]&&a[1]<=y.range[1])return e[P].subjects.push(l),e;a[0]<y.range[0]&&a[1]>y.range[0]&&(m.push(P),b=b.concat(y.subjects)),a[0]>=y.range[0]&&a[0]<=y.range[1]&&(m.push(P),b=b.concat(y.subjects),a[0]=y.range[0]),a[1]>=y.range[0]&&a[1]<=y.range[1]&&(m.push(P),b=b.concat(y.subjects),a[1]=y.range[1])}if(w.push(l),a[0]<=d&&a[1]>=v)return[{subjects:w,range:a}];m.length&&m.reverse().forEach(P=>{e.splice(P,1)}),e.push({subjects:b.concat([l]),range:a})}}return e},[]).sort((e,t)=>e.range[0]-t.range[0]);var vo=Z(Ht(),1),ni=Z(Dt(),1),yo=Z(fo(),1);function mo(){let r={};function e(){for(let c in r)Object.prototype.hasOwnProperty.call(r,c)&&delete r[c]}function t(c){let a={};for(let l in r)+l<=c&&(a[l]=r[l]);return a}function i(c){let a={};for(let l in r)+l>=c&&(a[l]=r[l]);return a}function n({timestamp:c,priority:a,initiator:l}){var m;if(Fr(c)){let v=(m=r[c])!=null?m:null;if(v&&a&&Qe(a,!0)){let d={},b=v[a];if(b&&(d=f(f({},d),b)),d=de(d)?null:d,d&&Qe(l,!0)){let w=d[l];return w!=null?w:null}return d}return v}return null}function s({timestamp:c,priority:a,initiator:l}){if(Fr(c))if(r[c]){if(a&&Qe(a,!0))if(r[c][a]){if(l&&Qe(l,!0))if(r[c][a][l]){if(delete r[c][a][l],!de(r[c][a]))return!0}else return!1;if(delete r[c][a],!de(r[c]))return!0}else return!1;return delete r[c]}else return!1;return!1}function o(v){var d=v,{timestamp:c,priority:a,initiator:l}=d,m=X(d,["timestamp","priority","initiator"]);var b,w,P;(w=(b=r[c])==null?void 0:b[a])!=null&&w[l]?r[c][a][l].push(f({},m)):(P=r[c])!=null&&P[a]?r[c][a]=I(f({},r[c][a]),{[l]:[f({},m)]}):r[c]?r[c]=I(f({},r[c]),{[a]:{[l]:[f({},m)]}}):r[c]={[a]:{[l]:[f({},m)]}}}return{map:r,remove:s,add:o,removeAll:e,get:n,getLte:t,getGte:i}}var Yp=[C.EventActionTypes.expect,C.EventActionTypes.setNextBranch],Xp=1/0;function bo(r,e){let t=r,i,n=Zp(e),s=mo(),o,c=()=>{b(),$()},a=u=>{s.add.call(void 0,u),P()},l=(u=[])=>{for(let h of u)if(h.action(),(0,vo.default)(Yp,h.actionType))break},m=(u=1/0)=>{var S,L,M;let h=zt((S=s.get({timestamp:u,priority:"control"}))!=null?S:{}),g=zt((L=s.get({timestamp:u,priority:"container"}))!=null?L:{}),x=zt((M=s.get({timestamp:u,priority:"chapter"}))!=null?M:{});return[...h,...g,...x]},v=u=>{n.isReady(u)&&l(m(u))},d=()=>{var u;l([...zt((u=s.get({timestamp:1/0,priority:"chapter"}))!=null?u:{})])},b=()=>{i&&(o==null||o.unsubscribe(),i=void 0)},w=u=>{},P=()=>{i||(i=()=>setTimeout(()=>{v(1/0)}),o=t.events.ended$.subscribe(i))},y=u=>{b(),t=u},V=u=>{u.priority==="container"&&n.resetCalled(u.timestamp),s.remove(u)},$=()=>{n.release(),s.removeAll()};return{setPlayer:y,add:a,remove:V,exec:v,execEndOfVideo:d,listen:P,unlisten:b,release:c,containersEventsCallState:n,getPreparedToExecActions:m}}function Zp(r){let e=new Map;return{setCalled:({timestamp:c,id:a})=>{let l=e.get(c);l&&l[a]!==void 0&&(l[a]=!0)},setData:(c=[])=>{var a,l;for(let m of c){let v=(a=m.endTime)!=null?a:Xp,d=(l=e.get(v))!=null?l:{};e.set(v,I(f({},d),{[m.id]:!1}))}},resetCalled:c=>{let a=e.get(c);if(a)for(let l in a)a[l]=!1},isReady:c=>{let a=e.get(c);if(!a)return!0;let l=(0,ni.default)(a);return r?l.some(v=>v):!l.some(v=>!v)},release:()=>e.clear()}}function zt(r){return(0,yo.default)((0,ni.default)(r)).sort(e=>e.actionType===C.EventActionTypes.expect?-1:1)}var go={videoContentHeight:0,videoContentWidth:0},Co=(r,e)=>{let{height:t,width:i}=e.info.intrinsicVideoSize$.getValue()||{};if(!(t&&i))return go;let{clientHeight:n,clientWidth:s}=e.experimental.element$.getValue()||{};if(!(n&&s))return go;let o=t/i,c=n/s,a,l;return c>o?(l=s,a=s*o):c<o?(l=n/o,a=n):(l=s,a=n),{videoContentWidth:l,videoContentHeight:a}};var Jp=250;function Eo(r){let e=()=>{},t=new ResizeObserver(c=>{s(c),e=s.bind(null,c)});function i(c){let{parentElement:a,player:l}=r();if(a&&l){let{videoContentWidth:m,videoContentHeight:v}=Co(a,l);a.style.setProperty("--interactive-content-width",`${m}px`),a.style.setProperty("--interactive-content-height",`${v}px`),a.style.setProperty("--interactive-width",`${c[0].contentRect.width}px`),a.style.setProperty("--interactive-height",`${c[0].contentRect.height}px`)}}function n(){let{parentElement:c}=r();c.removeAttribute("style")}let s=We(c=>{let{fns:a=[]}=r();i(c);for(let l of a)l()},Jp);function o(){e=void 0,t.disconnect(),n()}return{resizeObserver:t,calc:()=>{e==null||e()},release:o}}var st=class{constructor(){this.map={}}push(e,t){e in this.map?this.map[e].push(t):this.map[e]=[t]}get(e){let t=this.map[e];return t?t.slice():null}getAll(){let e=[];for(let t in this.map)e.concat(this.map[t]);return e}remove(e,t){e in this.map&&(this.map[e]=this.map[e].filter(i=>i!==t),this.map[e].length===0&&delete this.map[e])}clear(){this.map={}}keys(){return Object.keys(this.map)}size(){return this.keys().length}};var eh=r=>Math.floor(Math.random()*r),To=r=>{var n;let e=r.length,t=1/0,i=null;for(;e--;){let s=r[e],o=(n=s.weight)!=null?n:1;o<t&&(t=o,i=s)}return i},xo=r=>{var n;let e=r.length,t=-1/0,i=null;for(;e--;){let s=r[e],o=(n=s.weight)!=null?n:0;o>t&&(t=o,i=s)}return i};var So=r=>{let e=r.length,t=eh(e);return r[t]},Io=1,wo=r=>{var i,n;let e=0;for(let s=0;s<r.length;++s)e+=(i=r[s].weight)!=null?i:Io;let t=Math.random()*e;e=0;for(let s=0;s<r.length-1;++s)if(e+=(n=r[s].weight)!=null?n:Io,e>=t)return r[s];return r[r.length-1]};var Ao={shouldOpenNow:!0,isDetachContainer:!0},Ro="after-expect";var si=(r,e=!1)=>I(f({},r),{args:e?f(f({},r.args),Ao):f(f({},Ao),r.args)}),ko=({globalEventEmitter:r,globalEvents:e,player:t,interactiveEvents:i,removeControllers:n})=>{let s={isExpect:!1},o=()=>{s.isExpect&&(s.isExpect=!1)},c=({action:u,controlType:h,controlId:g,containerId:x,branches:S=[],onEvent:L,isEOV:M=()=>!1,isDisabled:E=()=>!1})=>{let A=si(u,M()),_={timestamp:1/0,priority:"control",initiator:g,actionType:A.type},ae=E(),te=r.emit.bind(r,O.interactives,{subjectId:g,subjectType:h,subjectName:"control",type:ae?j.actionChoiceCanceled:j.actionChoice,actionType:u.type,payload:f({containerId:x},A.args)}),q=()=>{e.interactiveActionChoice$.next({subjectId:g,subjectType:h,subjectName:"control",type:ae?"action-choice-canceled":"action-choice",actionType:u.type,payload:f({containerId:x},A.args)})};if(ae){te(),q();return}switch(A.type.trim().toLowerCase()){case C.EventActionTypes.setNextBranch.trim().toLowerCase():{let je=S.find(oe=>oe.id===A.args.branchId);if(!je)return;L(A.args.isDetachContainer,w.bind(null,{subjectId:g,subjectName:"control"})),te(),q(),A.args.shouldOpenNow?y({subjectId:g,subjectName:"control",subjectType:h,action:A,payload:{chapterId:je.chapterId,autoSelect:!1}}):(i.add(I(f({},_),{action:y.bind(null,{subjectId:g,subjectName:"control",subjectType:h,action:A,payload:{chapterId:je.chapterId,autoSelect:!1}})})),n==null||n());return}case C.EventActionTypes.continuePlayback.trim().toLowerCase():{L(A.args.isDetachContainer,w.bind(null,{subjectId:g,subjectName:"control"})),te(),q(),A.args.shouldOpenNow?P({subjectId:g,subjectName:"control",subjectType:h,action:u}):i.add(I(f({},_),{action:P.bind(null,{subjectId:g,subjectName:"control",subjectType:h,action:u})}));return}case C.EventActionTypes.openURI.trim().toLowerCase():{L(A.args.isDetachContainer,w.bind(null,{subjectId:g,subjectName:"control"})),te(),q(),A.args.shouldOpenNow?$({subjectId:g,subjectName:"control",subjectType:h,action:A,payload:{URI:u.args.uri}}):(i.add(I(f({},_),{action:$.bind(null,{subjectId:g,subjectName:"control",subjectType:h,action:A,payload:{URI:u.args.uri}})})),n==null||n());return}default:let le="Unexpected control event",ct=new F(1,1,{message:le});v(ct,le);return}},a=({action:u,container:{id:h,endTime:g},branches:x=[],isEOV:S=!1,autoSelected:L=!1})=>{let M=si(u,S),E={timestamp:!M.args.shouldOpenNow||S?1/0:g!=null?g:1/0,priority:"container",initiator:h,actionType:M.type},A=r.emit.bind(r,O.interactives,{subjectId:h,subjectName:"container",type:j.actionChoice,actionType:M.type,payload:M.args}),_=()=>{e.interactiveActionChoice$.next({subjectId:h,subjectName:"container",type:"action-choice",actionType:M.type,payload:M.args})};switch(M.type.trim().toLowerCase()){case C.EventActionTypes.setNextBranch.trim().toLowerCase():{let q=x.find(le=>le.id===M.args.branchId);if(!q)return;A(),_(),i.add(I(f({},E),{action:y.bind(null,{subjectId:h,subjectName:"container",action:M,payload:{chapterId:q.chapterId,autoSelect:L}})})),n==null||n();return}case C.EventActionTypes.setMaxWeightBranch.trim().toLowerCase():return;case C.EventActionTypes.setMinWeightBranch.trim().toLowerCase():return;case C.EventActionTypes.setRandomBranch.trim().toLowerCase():return;case C.EventActionTypes.setWeightlessRandomBranch.trim().toLowerCase():return;case C.EventActionTypes.continuePlayback.trim().toLowerCase():{A(),_(),i.add(I(f({},E),{action:P.bind(null,{subjectId:h,subjectName:"container",action:M})}));return}case C.EventActionTypes.openURI.trim().toLowerCase():{A(),_(),i.add(I(f({},E),{action:$.bind(null,{subjectId:h,subjectName:"container",action:M,payload:{URI:u.args.uri}})})),n==null||n();return}default:let ae="Unexpected container event",te=new F(1,1,{message:ae});v(te,ae);return}};function l({container:u,branches:h,isEOV:g=!1}){var S,L;let x=Kr(u.events);if(x){let M=si(x.action,g);r.emit(O.interactives,{subjectId:u.id,subjectName:"container",type:j.actionChoice,actionType:M.type,payload:M.args}),e.interactiveActionChoice$.next({subjectId:u.id,subjectName:"container",type:"action-choice",actionType:M.type,payload:M.args}),i.add({timestamp:g?1/0:(S=u.endTime)!=null?S:1/0,priority:"container",initiator:u.id,actionType:C.EventActionTypes.expect,action:b.bind(null,{subjectId:u.id,subjectName:"container"})}),s.isExpect=!0}else for(let M of(L=u.events)!=null?L:[])a({action:M.action,container:u,branches:h,isEOV:g})}let m=({chapterId:u,action:h,branches:g=[]})=>{let x=r.emit.bind(r,O.interactives,{subjectId:u,subjectName:"chapter",type:j.actionChoice,actionType:h.type,payload:h.args}),S=()=>{e.interactiveActionChoice$.next({subjectId:u,subjectName:"chapter",type:"action-choice",actionType:h.type,payload:h.args})};switch(h.type.trim().toLowerCase()){case C.EventActionTypes.setNextBranch.trim().toLowerCase():{let E=g.find(A=>A.id===h.args.branchId);return E!=null&&E.chapterId?(x(),S(),y.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:E.chapterId,autoSelect:!0}})):void 0}case C.EventActionTypes.setWeightlessRandomBranch.trim().toLowerCase():{let E=So(g);return E!=null&&E.chapterId?(x(),S(),y.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:E.chapterId,autoSelect:!0}})):void 0}case C.EventActionTypes.setRandomBranch.trim().toLowerCase():{let E=wo(g);return E!=null&&E.chapterId?(x(),S(),y.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:E.chapterId,autoSelect:!0}})):void 0}case C.EventActionTypes.setMaxWeightBranch.trim().toLowerCase():{let E=xo(g);return E!=null&&E.chapterId?(x(),S(),y.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:E.chapterId,autoSelect:!0}})):void 0}case C.EventActionTypes.setMinWeightBranch.trim().toLowerCase():{let E=To(g);return E!=null&&E.chapterId?(x(),S(),y.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:E.chapterId,autoSelect:!0}})):void 0}case C.EventActionTypes.continuePlayback.trim().toLowerCase():return x(),S(),P.bind(null,{subjectId:u,subjectName:"chapter",action:h});case C.EventActionTypes.openURI.trim().toLowerCase():return x(),S(),$.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{URI:h.args.uri}});default:let L="Unexpected chapter event",M=new F(1,1,{message:L});v(M,L);return}};function v(u,h){console.error(h),e.error$.next(u),r.emit(O.errors,u)}function d(u){var g;let h=Kr(u.events);if(h){if(Y(u))return;r.emit(O.interactives,{subjectId:u.id,subjectName:"chapter",type:j.actionChoice,actionType:h.action.type,payload:h.action.args}),e.interactiveActionChoice$.next({subjectId:u.id,subjectName:"chapter",type:"action-choice",actionType:h.action.type,payload:h.action.args}),i.add({timestamp:1/0,priority:"chapter",initiator:u.id,actionType:C.EventActionTypes.expect,action:b.bind(null,{subjectId:u.id,subjectName:"chapter"})})}else(g=u.events)==null||g.forEach(x=>{let S=m({chapterId:u.id,action:x.action,branches:u.branches});S&&i.add({timestamp:1/0,priority:"chapter",initiator:u.id,actionType:x.action.type,action:S})})}let b=({subjectId:u,subjectName:h})=>{t.pause(),r.emit(O.interactives,{subjectId:u,subjectName:h,type:j.actionExecution,actionType:C.EventActionTypes.expect}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,type:"action-execution",actionType:C.EventActionTypes.expect})},w=({subjectId:u,subjectName:h})=>{t.info.isEnded$.getValue()?i.execEndOfVideo():t.play(),r.emit(O.interactives,{subjectId:u,subjectName:h,type:j.actionExecution,actionType:Ro}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,type:"action-execution",actionType:Ro})},P=({subjectId:u,subjectName:h,subjectType:g,action:x})=>{r.emit(O.interactives,{subjectId:u,subjectName:h,subjectType:g,type:j.actionExecution,actionType:x.type}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,subjectType:g,type:"action-execution",actionType:x.type})},y=({subjectId:u,subjectName:h,subjectType:g,action:x,payload:S})=>{S.behaviour="change-chapter",r.emit(O.interactives,{subjectId:u,subjectName:h,subjectType:g,type:j.actionExecution,actionType:x.type,payload:S}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,subjectType:g,type:"action-execution",actionType:x.type,payload:S})},V=({subjectId:u,subjectName:h,subjectType:g,action:x,payload:S})=>{S.behaviour="change-manifest",r.emit(O.interactives,{subjectId:u,subjectName:h,subjectType:g,type:j.actionExecution,actionType:x.type,payload:S}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,subjectType:g,type:"action-execution",actionType:x.type,payload:S})},$=({subjectId:u,subjectName:h,subjectType:g,action:x,payload:S})=>{if(!S.URI)return;let L=window.open(S.URI,"_blank","noopener,noreferrer");L&&(L.opener=null),r.emit(O.interactives,{subjectId:u,subjectName:h,subjectType:g,type:j.actionExecution,actionType:x.type}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,subjectType:g,type:"action-execution",actionType:x.type})};return{onControlEvent:c,onContainerEvent:a,onChapterEvent:m,onExpectEvent:b,expectEventHandler:w,setManifestChapterEvents:d,setManifestContainerEvents:l,stopExpect:o,state:s}};var ci=Z(_r(),1),W=require("@vkontakte/videoplayer-shared/es2015");var Wt=(r,e)=>{let t={};return r.map(i=>{if(!t[i]){let n=e.chapters.find(o=>o.id===i);if(!n)return null;let s=e.media.videos.find(o=>n.videoId===o.id);if(!s)return null;t[i]=ai(s)}return t[i]}).filter(Boolean)},Mo=r=>{for(let e of r.variants)if(Vo(e)&&e.payload)return e.payload.id},Vo=r=>!!(r.type==="custom"&&r.payload&&r.payload.type==="vk"),ai=r=>{let e=Mo(r);if(!e)return null;let t=e.split("_").pop();return t?parseInt(t,10):null},jo=(r,e)=>{for(let t of r.media.videos)if(e===ai(t)){for(let i of r.chapters)if(i.videoId===t.id)return i.id;return}},oi=(r,e)=>r.reduce((t,i)=>{let n=jo(e,i);return n?[...t,n]:t},[]);var ie,ye,be,z,Kt,ne,se,ee,ge,ke,Me,at=class{constructor({globalEventEmitter:e,videoId:t,interactiveController:i,historyApi:n,settings:s}){this.state={history$:new W.ValueSubject([]),hasPrevChapter$:new W.ValueSubject(!1),prevChapter$:new W.ValueSubject(null),isInitialChapter$:new W.ValueSubject(!1),isGoBackLimited$:new W.ValueSubject(!1)};H(this,ie,null);H(this,ye);H(this,be,!1);H(this,z,null);H(this,Kt,null);this.events={inited$:new W.Subject,destroyed$:new W.Subject,error$:new W.Subject};H(this,ne,null);H(this,se,null);H(this,ee,null);H(this,ge,new W.Subscription);H(this,ke,!1);H(this,Me,0);var o;N(this,ne,t),N(this,ee,e),N(this,se,i),N(this,ie,n),N(this,ye,s),this.state.history$&&R(this,ge)&&((o=R(this,ge))==null||o.add(this.state.history$.subscribe(c=>{var a,l;this.state.prevChapter$.next((0,ci.default)(c,-2)||null),this.state.hasPrevChapter$.next(c.length>1),this.state.isInitialChapter$.next(this.getInitialChapterId()===((l=(a=R(this,z))==null?void 0:a.metadata)==null?void 0:l.initChapterId)),this.state.isGoBackLimited$.next(R(this,Me)===R(this,ye).maxLength-1)})))}setManifest(e){return k(this,null,function*(){if(!R(this,se)||!R(this,ee))return;N(this,z,e),yield this.getProjectHistory();let t=this.getInitialChapterId();yield R(this,se).setChapter({chapterId:t,pushToHistory:!1}),R(this,be)||(N(this,be,!0),this.events.inited$.next({initChapterId:t}))})}get inited(){return R(this,be)}updateHistory(e,t=!0){return k(this,null,function*(){var c;if(!R(this,z))return;R(this,ke)?(N(this,ke,!1),Ci(this,Me)._++):N(this,Me,0);let i=R(this,z),n=e.length-R(this,ye).maxLength,s=n>0?e.slice(n):e,o=Wt(s,i);if(N(this,Kt,o),this.state.history$.next(s),!(!t||!R(this,ie)||!R(this,ne)))try{yield R(this,ie).save(R(this,ne),o)}catch(a){let l=new F(1,5,"Unable to save interactive history");this.events.error$.next(l),(c=R(this,ee))==null||c.emit(O.errors,l)}})}goBack(){return k(this,null,function*(){var i;if(!this.state||!R(this,se)){let n=new F(1,5,"Unable to save interactive history");return this.events.error$.next(n),(i=R(this,ee))==null?void 0:i.emit(O.errors,n)}N(this,ke,!0);let e=this.state.history$.getValue().slice(0,-1),t=e.pop();this.state.history$.next(e),yield R(this,se).setChapter({chapterId:t,playPrev:!0})})}getProjectHistory(){return k(this,null,function*(){var n;if(!R(this,z)||!R(this,ne))return;let e=R(this,z),t=[this.getInitialVideoId()];if(R(this,ie))try{let s=yield R(this,ie).get(R(this,ne));s.length&&(t=s)}catch(s){let o=new F(1,5,"Error while trying to fetch data");this.events.error$.next(o),(n=R(this,ee))==null||n.emit(O.errors,o)}let i=oi(t,e);this.state.history$.next(i)})}getInitialChapterId(){var t;let e=this.state.history$.getValue();return(0,ci.default)(e,-1)||R(this,ye).initChapterId||((t=R(this,z))==null?void 0:t.metadata.initChapterId)}getInitialVideoId(){if(R(this,z)){let e=this.getInitialChapterId();return Wt([e],R(this,z)).pop()}return null}destroy(){var e,t;N(this,ne,null),N(this,ie,null),N(this,se,null),(e=R(this,ge))==null||e.unsubscribe(),N(this,ge,null),N(this,be,!1),(t=R(this,ee))==null||t.emit(O.historyDestroyed),this.events.destroyed$.next(),N(this,ee,null)}};ie=new WeakMap,ye=new WeakMap,be=new WeakMap,z=new WeakMap,Kt=new WeakMap,ne=new WeakMap,se=new WeakMap,ee=new WeakMap,ge=new WeakMap,ke=new WeakMap,Me=new WeakMap;var Ce=class Ce{constructor(e,t,i,n){this.target=e,this.type=t,this.listener=i,this.options=Ce._convertOptions(e,n),this.target.addEventListener(t,i,this.options)}unlisten(){var e;this.type&&this.listener&&this.options&&((e=this.target)==null||e.removeEventListener(this.type,this.listener,this.options)),this.target=null,this.type=null,this.listener=null,this.options=!1}static _convertOptions(e,t){if(t===void 0)return!1;if(typeof t=="boolean")return t;{let i=new Set(["passive","capture"]),n=Object.keys(t).filter(o=>!i.has(o));return n.length===0&&console.warn("Unsupported flag(s) to addEventListener: "+n.join(",")),Ce._doesSupportObject(e)?t:t.capture||!1}}static _doesSupportObject(e){let t=Ce._supportsObject;if(t===void 0){t=!1;try{let i={},n={get:()=>(t=!0,!1)};Object.defineProperty(i,"passive",n),Object.defineProperty(i,"capture",n);let s=()=>{};e.addEventListener("test",s,i),e.removeEventListener("test",s,i)}catch(i){t=!1}Ce._supportsObject=t}return t||!1}};Ce._supportsObject=void 0;var Qt=Ce;var Yt=class{constructor(){this.bindingMap=new st}release(){this.removeAll(),this.bindingMap=null}listen(e,t,i,n){if(!this.bindingMap)return;let s=new Qt(e,t,i,n);this.bindingMap.push(t,s)}listenOnce(e,t,i,n){let s=o=>{this.unlisten(e,t,s),i(o)};this.listen(e,t,s,n)}unlisten(e,t,i){if(!this.bindingMap)return;let n=this.bindingMap.get(t)||[];for(let s of n)s.target===e&&(i===s.listener||!i)&&(s.unlisten(),this.bindingMap.remove(t,s))}removeAll(){if(!this.bindingMap)return;let e=this.bindingMap.getAll();for(let t of e)t.unlisten();this.bindingMap.clear()}};var Xt=class{constructor(){this._prevSizeId=0;this.rootElement=document.createElement("canvas")}clear(){var e;(e=this.rootElement.getContext("2d"))==null||e.clearRect(0,0,this.rootElement.width,this.rootElement.height)}isImageDrawn(){var n;let e=(n=this.rootElement.getContext("2d"))==null?void 0:n.getImageData(0,0,this.rootElement.width,this.rootElement.height);if(!e)return!1;let t=e.data,i=t.length;for(let s=3;s<i;s+=40)if(t[s]!==0)return!0;return!1}destroy(){this.rootElement.remove()}show(){this.rootElement.style.visibility="visible"}hide(){this.rootElement.style.visibility="hidden"}setCanvasImageSource(e){this.canvasImgSrc=e}draw(){var e;this.canvasImgSrc&&((e=this.rootElement.getContext("2d"))==null||e.drawImage(this.canvasImgSrc,0,0,this.rootElement.width,this.rootElement.height))}updateCanvasDimensions(e,t=!1){return k(this,null,function*(){let i=e.width+e.height;if(this._prevSizeId===i)return;let n;t&&(n=yield this.save()),this.rootElement.width=e.width,this.rootElement.height=e.height,t&&n&&this.restore(n),this._prevSizeId=i})}save(){return k(this,null,function*(){let e=this.rootElement.toDataURL("image/jpeg",1),t=new Image;return t.crossOrigin="anonymous",t.src=e,yield t.decode(),t})}restore(e){var t;this.rootElement&&((t=this.rootElement.getContext("2d"))==null||t.drawImage(e,0,0,this.rootElement.width,this.rootElement.height))}};var Zt=class{constructor({parentElement:e,endOffsetMs:t=250,onError:i}){this.currentVideoDurationMs=1/0;this._containerTimeFrameShouldReceived=!1;this._endTimeFrameReceived=!1;this._shouldCallSkip=!1;this.onEachTick=e=>{let t=e!=null?e:this.lastFrameCanvas.canvasImgSrc.currentTime*1e3,i=this.isChapterEndTime(t);if(this.isContainerTime(t))this._endTimeFrameReceived=!1,this._containerTimeFrameShouldReceived=!0,this._shouldCallSkip=!0;else if(i)this._containerTimeFrameShouldReceived=!1,this._shouldCallSkip=!1,this._endTimeFrameReceived||(this.draw(),this._endTimeFrameReceived=!0,this.show());else{if(this._shouldCallSkip){this._shouldCallSkip=!1;return}this.reset()}};this.onSeek=()=>{this.onEachTick(),!this._containerTimeFrameShouldReceived&&!this._endTimeFrameReceived&&(this.hide(),this.lastFrameCanvas.clear())};this.rootElement=document.createElement("div"),this.rootElement.style.cssText=`
|
|
7
7
|
position: absolute;
|
|
8
8
|
top: 0;
|
|
9
9
|
left: 0;
|