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