@vkontakte/videoplayer-interactive 1.0.34 → 1.0.35-beta.1
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 +126 -37
- package/es2015.esm.js +126 -37
- package/es2018.cjs.js +126 -37
- package/es2018.esm.js +126 -37
- package/es2024.cjs.js +149 -0
- package/es2024.esm.js +149 -0
- package/esnext.cjs.js +126 -37
- package/esnext.esm.js +126 -37
- package/evergreen.esm.js +126 -37
- package/package.json +20 -15
- package/types/modules/Graph/Graph.d.ts +1 -1
- package/types/modules/Interactives/Interactives.d.ts +4 -1
- package/types/modules/Interactives/containers/ChoiceContainer.d.ts +7 -0
- package/types/modules/Interactives/containers/Container.d.ts +1 -1
- package/types/modules/Interactives/containers/types.d.ts +1 -1
- package/types/modules/Interactives/controls/AreaControl.d.ts +7 -1
- package/types/modules/Interactives/controls/ButtonControl.d.ts +7 -1
- package/types/modules/Interactives/controls/Control.d.ts +9 -2
- package/types/modules/Interactives/controls/TextControl.d.ts +4 -1
- package/types/modules/Interactives/controls/types.d.ts +1 -1
- package/types/modules/Interactives/controls/utils.d.ts +4 -0
- package/types/modules/Interactives/index.d.ts +26 -12
- package/types/modules/Interactives/styles/index.d.ts +1 -0
- package/types/modules/Interactives/types.d.ts +6 -7
- package/types/modules/Interactives/utils/BlinkAnimationRef.d.ts +15 -0
- package/types/modules/Interactives/utils/GameController.d.ts +6 -1
- package/types/modules/Interactives/utils/ResizeManager.d.ts +1 -0
- package/types/modules/Interactives/utils/SelectBranches.types.d.ts +1 -0
- package/types/modules/Interactives/utils/fallbackStrategies.d.ts +2 -2
- package/types/modules/Interactives/utils/functionUtils.d.ts +5 -0
- package/types/modules/Interactives/utils/gameUtils.d.ts +13 -2
- package/types/modules/Interactives/utils/renderingUtils.d.ts +15 -1
- package/types/modules/ManifestController/ManifestController.d.ts +1 -1
- package/types/modules/SeamlessController/SeamlessController.d.ts +1 -1
- package/types/utils/typeCheck.d.ts +2 -2
- /package/types/modules/Interactives/{styles.d.ts → styles/utils.d.ts} +0 -0
package/es2015.cjs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-interactive v1.0.
|
|
3
|
-
*
|
|
4
|
-
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-
|
|
2
|
+
* @vkontakte/videoplayer-interactive v1.0.35-beta.1
|
|
3
|
+
* Wed, 09 Apr 2025 13:57:38 GMT
|
|
4
|
+
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-35/doc/
|
|
5
5
|
*/
|
|
6
|
-
"use strict";var Bo=Object.create;var je=Object.defineProperty,Do=Object.defineProperties,Ho=Object.getOwnPropertyDescriptor,Uo=Object.getOwnPropertyDescriptors,Go=Object.getOwnPropertyNames,ct=Object.getOwnPropertySymbols,zo=Object.getPrototypeOf,Qt=Object.prototype.hasOwnProperty,mn=Object.prototype.propertyIsEnumerable;var fn=r=>{throw TypeError(r)};var dn=(r,e,t)=>e in r?je(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)&&dn(r,t,e[t]);if(ct)for(var t of ct(e))mn.call(e,t)&&dn(r,t,e[t]);return r},w=(r,e)=>Do(r,Uo(e));var J=(r,e)=>{var t={};for(var n in r)Qt.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&ct)for(var n of ct(r))e.indexOf(n)<0&&mn.call(r,n)&&(t[n]=r[n]);return t};var p=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Wo=(r,e)=>{for(var t in e)je(r,t,{get:e[t],enumerable:!0})},vn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Go(e))!Qt.call(r,i)&&i!==t&&je(r,i,{get:()=>e[i],enumerable:!(n=Ho(e,i))||n.enumerable});return r};var ee=(r,e,t)=>(t=r!=null?Bo(zo(r)):{},vn(e||!r||!r.__esModule?je(t,"default",{value:r,enumerable:!0}):t,r)),Ko=r=>vn(je({},"__esModule",{value:!0}),r);var yn=(r,e,t)=>e.has(r)||fn("Cannot "+t);var R=(r,e,t)=>(yn(r,e,"read from private field"),t?t.call(r):e.get(r)),H=(r,e,t)=>e.has(r)?fn("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 R(r,e,n)}});var V=(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 te=p((ir,An)=>{"use strict";var Le=function(r){return r&&r.Math===Math&&r};An.exports=Le(typeof globalThis=="object"&&globalThis)||Le(typeof window=="object"&&window)||Le(typeof self=="object"&&self)||Le(typeof global=="object"&&global)||Le(typeof ir=="object"&&ir)||function(){return this}()||Function("return this")()});var G=p((cd,Rn)=>{"use strict";Rn.exports=function(r){try{return!!r()}catch(e){return!0}}});var $e=p((ld,On)=>{"use strict";var Qo=G();On.exports=!Qo(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Nn=p((ud,Mn)=>{"use strict";var Xo=$e(),Vn=Function.prototype,Pn=Vn.apply,kn=Vn.call;Mn.exports=typeof Reflect=="object"&&Reflect.apply||(Xo?kn.bind(Pn):function(){return kn.apply(Pn,arguments)})});var Q=p((pd,$n)=>{"use strict";var jn=$e(),Ln=Function.prototype,sr=Ln.call,Yo=jn&&Ln.bind.bind(sr,sr);$n.exports=jn?Yo:function(r){return function(){return sr.apply(r,arguments)}}});var _e=p((hd,Fn)=>{"use strict";var _n=Q(),Zo=_n({}.toString),Jo=_n("".slice);Fn.exports=function(r){return Jo(Zo(r),8,-1)}});var ar=p((dd,qn)=>{"use strict";var ec=_e(),tc=Q();qn.exports=function(r){if(ec(r)==="Function")return tc(r)}});var z=p((md,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 ue=p((fd,Dn)=>{"use strict";var rc=G();Dn.exports=!rc(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var Ct=p((vd,Hn)=>{"use strict";var nc=$e(),bt=Function.prototype.call;Hn.exports=nc?bt.bind(bt):function(){return bt.apply(bt,arguments)}});var cr=p(zn=>{"use strict";var Un={}.propertyIsEnumerable,Gn=Object.getOwnPropertyDescriptor,ic=Gn&&!Un.call({1:2},1);zn.f=ic?function(e){var t=Gn(this,e);return!!t&&t.enumerable}:Un});var lr=p((bd,Wn)=>{"use strict";Wn.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var Qn=p((Cd,Kn)=>{"use strict";var sc=Q(),ac=G(),oc=_e(),ur=Object,cc=sc("".split);Kn.exports=ac(function(){return!ur("z").propertyIsEnumerable(0)})?function(r){return oc(r)==="String"?cc(r,""):ur(r)}:ur});var pr=p((gd,Xn)=>{"use strict";Xn.exports=function(r){return r==null}});var hr=p((Ed,Yn)=>{"use strict";var lc=pr(),uc=TypeError;Yn.exports=function(r){if(lc(r))throw new uc("Can't call method on "+r);return r}});var Fe=p((Id,Zn)=>{"use strict";var pc=Qn(),hc=hr();Zn.exports=function(r){return pc(hc(r))}});var xe=p((Td,Jn)=>{"use strict";var dc=z();Jn.exports=function(r){return typeof r=="object"?r!==null:dc(r)}});var gt=p((xd,ei)=>{"use strict";ei.exports={}});var Et=p((Sd,ri)=>{"use strict";var dr=gt(),mr=te(),mc=z(),ti=function(r){return mc(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((wd,ni)=>{"use strict";var fc=Q();ni.exports=fc({}.isPrototypeOf)});var ci=p((Ad,oi)=>{"use strict";var vc=te(),si=vc.navigator,ai=si&&si.userAgent;oi.exports=ai?String(ai):""});var fi=p((Rd,mi)=>{"use strict";var di=te(),fr=ci(),li=di.process,ui=di.Deno,pi=li&&li.versions||ui&&ui.version,hi=pi&&pi.v8,X,It;hi&&(X=hi.split("."),It=X[0]>0&&X[0]<4?1:+(X[0]+X[1]));!It&&fr&&(X=fr.match(/Edge\/(\d+)/),(!X||X[1]>=74)&&(X=fr.match(/Chrome\/(\d+)/),X&&(It=+X[1])));mi.exports=It});var vr=p((Od,yi)=>{"use strict";var vi=fi(),yc=G(),bc=te(),Cc=bc.String;yi.exports=!!Object.getOwnPropertySymbols&&!yc(function(){var r=Symbol("symbol detection");return!Cc(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&vi&&vi<41})});var yr=p((Pd,bi)=>{"use strict";var gc=vr();bi.exports=gc&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var br=p((kd,Ci)=>{"use strict";var Ec=Et(),Ic=z(),Tc=ii(),xc=yr(),Sc=Object;Ci.exports=xc?function(r){return typeof r=="symbol"}:function(r){var e=Ec("Symbol");return Ic(e)&&Tc(e.prototype,Sc(r))}});var Ei=p((Vd,gi)=>{"use strict";var wc=String;gi.exports=function(r){try{return wc(r)}catch(e){return"Object"}}});var Cr=p((Md,Ii)=>{"use strict";var Ac=z(),Rc=Ei(),Oc=TypeError;Ii.exports=function(r){if(Ac(r))return r;throw new Oc(Rc(r)+" is not a function")}});var xi=p((Nd,Ti)=>{"use strict";var Pc=Cr(),kc=pr();Ti.exports=function(r,e){var t=r[e];return kc(t)?void 0:Pc(t)}});var wi=p((jd,Si)=>{"use strict";var gr=Ct(),Er=z(),Ir=xe(),Vc=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 Vc("Can't convert object to primitive value")}});var Ri=p((Ld,Ai)=>{"use strict";Ai.exports=!0});var ki=p(($d,Pi)=>{"use strict";var Oi=te(),Mc=Object.defineProperty;Pi.exports=function(r,e){try{Mc(Oi,r,{value:e,configurable:!0,writable:!0})}catch(t){Oi[r]=e}return e}});var Tt=p((_d,Ni)=>{"use strict";var Nc=Ri(),jc=te(),Lc=ki(),Vi="__core-js_shared__",Mi=Ni.exports=jc[Vi]||Lc(Vi,{});(Mi.versions||(Mi.versions=[])).push({version:"3.38.0",mode:Nc?"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((Fd,Li)=>{"use strict";var ji=Tt();Li.exports=function(r,e){return ji[r]||(ji[r]=e||{})}});var qe=p((qd,$i)=>{"use strict";var $c=hr(),_c=Object;$i.exports=function(r){return _c($c(r))}});var Se=p((Bd,_i)=>{"use strict";var Fc=Q(),qc=qe(),Bc=Fc({}.hasOwnProperty);_i.exports=Object.hasOwn||function(e,t){return Bc(qc(e),t)}});var xr=p((Dd,Fi)=>{"use strict";var Dc=Q(),Hc=0,Uc=Math.random(),Gc=Dc(1 .toString);Fi.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+Gc(++Hc+Uc,36)}});var Be=p((Hd,Bi)=>{"use strict";var zc=te(),Wc=Tr(),qi=Se(),Kc=xr(),Qc=vr(),Xc=yr(),we=zc.Symbol,Sr=Wc("wks"),Yc=Xc?we.for||we:we&&we.withoutSetter||Kc;Bi.exports=function(r){return qi(Sr,r)||(Sr[r]=Qc&&qi(we,r)?we[r]:Yc("Symbol."+r)),Sr[r]}});var Gi=p((Ud,Ui)=>{"use strict";var Zc=Ct(),Di=xe(),Hi=br(),Jc=xi(),el=wi(),tl=Be(),rl=TypeError,nl=tl("toPrimitive");Ui.exports=function(r,e){if(!Di(r)||Hi(r))return r;var t=Jc(r,nl),n;if(t){if(e===void 0&&(e="default"),n=Zc(t,r,e),!Di(n)||Hi(n))return n;throw new rl("Can't convert object to primitive value")}return e===void 0&&(e="number"),el(r,e)}});var wr=p((Gd,zi)=>{"use strict";var il=Gi(),sl=br();zi.exports=function(r){var e=il(r,"string");return sl(e)?e:e+""}});var Qi=p((zd,Ki)=>{"use strict";var al=te(),Wi=xe(),Ar=al.document,ol=Wi(Ar)&&Wi(Ar.createElement);Ki.exports=function(r){return ol?Ar.createElement(r):{}}});var Rr=p((Wd,Xi)=>{"use strict";var cl=ue(),ll=G(),ul=Qi();Xi.exports=!cl&&!ll(function(){return Object.defineProperty(ul("div"),"a",{get:function(){return 7}}).a!==7})});var Ji=p(Zi=>{"use strict";var pl=ue(),hl=Ct(),dl=cr(),ml=lr(),fl=Fe(),vl=wr(),yl=Se(),bl=Rr(),Yi=Object.getOwnPropertyDescriptor;Zi.f=pl?Yi:function(e,t){if(e=fl(e),t=vl(t),bl)try{return Yi(e,t)}catch(n){}if(yl(e,t))return ml(!hl(dl.f,e,t),e[t])}});var ts=p((Qd,es)=>{"use strict";var Cl=G(),gl=z(),El=/#|\.prototype\./,De=function(r,e){var t=Tl[Il(r)];return t===Sl?!0:t===xl?!1:gl(e)?Cl(e):!!e},Il=De.normalize=function(r){return String(r).replace(El,".").toLowerCase()},Tl=De.data={},xl=De.NATIVE="N",Sl=De.POLYFILL="P";es.exports=De});var Or=p((Xd,ns)=>{"use strict";var rs=ar(),wl=Cr(),Al=$e(),Rl=rs(rs.bind);ns.exports=function(r,e){return wl(r),e===void 0?r:Al?Rl(r,e):function(){return r.apply(e,arguments)}}});var ss=p((Yd,is)=>{"use strict";var Ol=ue(),Pl=G();is.exports=Ol&&Pl(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var os=p((Zd,as)=>{"use strict";var kl=xe(),Vl=String,Ml=TypeError;as.exports=function(r){if(kl(r))return r;throw new Ml(Vl(r)+" is not an object")}});var us=p(ls=>{"use strict";var Nl=ue(),jl=Rr(),Ll=ss(),xt=os(),cs=wr(),$l=TypeError,Pr=Object.defineProperty,_l=Object.getOwnPropertyDescriptor,kr="enumerable",Vr="configurable",Mr="writable";ls.f=Nl?Ll?function(e,t,n){if(xt(e),t=cs(t),xt(n),typeof e=="function"&&t==="prototype"&&"value"in n&&Mr in n&&!n[Mr]){var i=_l(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(xt(e),t=cs(t),xt(n),jl)try{return Pr(e,t,n)}catch(i){}if("get"in n||"set"in n)throw new $l("Accessors not supported");return"value"in n&&(e[t]=n.value),e}});var hs=p((em,ps)=>{"use strict";var Fl=ue(),ql=us(),Bl=lr();ps.exports=Fl?function(r,e,t){return ql.f(r,e,Bl(1,t))}:function(r,e,t){return r[e]=t,r}});var Ue=p((tm,ms)=>{"use strict";var He=te(),Dl=Nn(),Hl=ar(),Ul=z(),Gl=Ji().f,zl=ts(),Ae=gt(),Wl=Or(),Re=hs(),ds=Se();Tt();var Kl=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 Dl(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?He:i?He[t]:He[t]&&He[t].prototype,c=n?Ae:Ae[t]||Re(Ae,t,{})[t],a=c.prototype,l,f,y,b,g,A,E,v,P;for(b in e)l=zl(n?b:t+(i?".":"#")+b,r.forced),f=!l&&o&&ds(o,b),A=c[b],f&&(r.dontCallGetSet?(P=Gl(o,b),E=P&&P.value):E=o[b]),g=f&&E?E:e[b],!(!l&&!s&&typeof A==typeof g)&&(r.bind&&f?v=Wl(g,He):r.wrap&&f?v=Kl(g):s&&Ul(g)?v=Hl(g):v=g,(r.sham||g&&g.sham||A&&A.sham)&&Re(v,"sham",!0),Re(c,b,v),s&&(y=t+"Prototype",ds(Ae,y)||Re(Ae,y,{}),Re(Ae[y],b,g),r.real&&a&&(l||!a[b])&&Re(a,b,g)))}});var vs=p((rm,fs)=>{"use strict";var Ql=Math.ceil,Xl=Math.floor;fs.exports=Math.trunc||function(e){var t=+e;return(t>0?Xl:Ql)(t)}});var Ge=p((nm,ys)=>{"use strict";var Yl=vs();ys.exports=function(r){var e=+r;return e!==e||e===0?0:Yl(e)}});var Cs=p((im,bs)=>{"use strict";var Zl=Ge(),Jl=Math.min;bs.exports=function(r){var e=Zl(r);return e>0?Jl(e,9007199254740991):0}});var ze=p((sm,gs)=>{"use strict";var eu=Cs();gs.exports=function(r){return eu(r.length)}});var St=p((am,Es)=>{"use strict";Es.exports=function(){}});var Is=p(()=>{"use strict";var tu=Ue(),ru=qe(),nu=ze(),iu=Ge(),su=St();tu({target:"Array",proto:!0},{at:function(e){var t=ru(this),n=nu(t),i=iu(e),s=i>=0?i:n+i;return s<0||s>=n?void 0:t[s]}});su("at")});var wt=p((lm,Ts)=>{"use strict";var au=Et();Ts.exports=au});var Ss=p((um,xs)=>{"use strict";Is();var ou=wt();xs.exports=ou("Array","at")});var As=p((pm,ws)=>{"use strict";var cu=Ss();ws.exports=cu});var Nr=p((hm,Rs)=>{"use strict";var lu=As();Rs.exports=lu});var Hs=p((bf,Ds)=>{"use strict";var Iu=Tr(),Tu=xr(),Bs=Iu("keys");Ds.exports=function(r){return Bs[r]||(Bs[r]=Tu(r))}});var Gs=p((Cf,Us)=>{"use strict";var xu=G();Us.exports=!xu(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var Ks=p((gf,Ws)=>{"use strict";var Su=Se(),wu=z(),Au=qe(),Ru=Hs(),Ou=Gs(),zs=Ru("IE_PROTO"),Gr=Object,Pu=Gr.prototype;Ws.exports=Ou?Gr.getPrototypeOf:function(r){var e=Au(r);if(Su(e,zs))return e[zs];var t=e.constructor;return wu(t)&&e instanceof t?t.prototype:e instanceof Gr?Pu:null}});var Xs=p((Ef,Qs)=>{"use strict";var ku=Ge(),Vu=Math.max,Mu=Math.min;Qs.exports=function(r,e){var t=ku(r);return t<0?Vu(t+e,0):Mu(t,e)}});var zr=p((If,Zs)=>{"use strict";var Nu=Fe(),ju=Xs(),Lu=ze(),Ys=function(r){return function(e,t,n){var i=Nu(e),s=Lu(i);if(s===0)return!r&&-1;var o=ju(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}};Zs.exports={includes:Ys(!0),indexOf:Ys(!1)}});var ea=p((Tf,Js)=>{"use strict";Js.exports={}});var na=p((xf,ra)=>{"use strict";var $u=Q(),Wr=Se(),_u=Fe(),Fu=zr().indexOf,qu=ea(),ta=$u([].push);ra.exports=function(r,e){var t=_u(r),n=0,i=[],s;for(s in t)!Wr(qu,s)&&Wr(t,s)&&ta(i,s);for(;e.length>n;)Wr(t,s=e[n++])&&(~Fu(i,s)||ta(i,s));return i}});var sa=p((Sf,ia)=>{"use strict";ia.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var oa=p((wf,aa)=>{"use strict";var Bu=na(),Du=sa();aa.exports=Object.keys||function(e){return Bu(e,Du)}});var da=p((Af,ha)=>{"use strict";var la=ue(),Hu=G(),ua=Q(),Uu=Ks(),Gu=oa(),zu=Fe(),Wu=cr().f,pa=ua(Wu),Ku=ua([].push),Qu=la&&Hu(function(){var r=Object.create(null);return r[2]=2,!pa(r,2)}),ca=function(r){return function(e){for(var t=zu(e),n=Gu(t),i=Qu&&Uu(t)===null,s=n.length,o=0,c=[],a;s>o;)a=n[o++],(!la||(i?a in t:pa(t,a)))&&Ku(c,r?[a,t[a]]:t[a]);return c}};ha.exports={entries:ca(!0),values:ca(!1)}});var ma=p(()=>{"use strict";var Xu=Ue(),Yu=da().values;Xu({target:"Object",stat:!0},{values:function(e){return Yu(e)}})});var va=p((Pf,fa)=>{"use strict";ma();var Zu=gt();fa.exports=Zu.Object.values});var ba=p((kf,ya)=>{"use strict";var Ju=va();ya.exports=Ju});var Ft=p((Vf,Ca)=>{"use strict";var ep=ba();Ca.exports=ep});var Ia=p(()=>{"use strict";var tp=Ue(),rp=zr().includes,np=G(),ip=St(),sp=np(function(){return!Array(1).includes()});tp({target:"Array",proto:!0,forced:sp},{includes:function(e){return rp(this,e,arguments.length>1?arguments[1]:void 0)}});ip("includes")});var xa=p((_f,Ta)=>{"use strict";Ia();var ap=wt();Ta.exports=ap("Array","includes")});var wa=p((Ff,Sa)=>{"use strict";var op=xa();Sa.exports=op});var qt=p((qf,Aa)=>{"use strict";var cp=wa();Aa.exports=cp});var Yr=p((nv,Na)=>{"use strict";var up=_e();Na.exports=Array.isArray||function(e){return up(e)==="Array"}});var La=p((iv,ja)=>{"use strict";var pp=TypeError,hp=9007199254740991;ja.exports=function(r){if(r>hp)throw pp("Maximum allowed index exceeded");return r}});var Fa=p((sv,_a)=>{"use strict";var dp=Yr(),mp=ze(),fp=La(),vp=Or(),$a=function(r,e,t,n,i,s,o,c){for(var a=i,l=0,f=o?vp(o,c):!1,y,b;l<n;)l in t&&(y=f?f(t[l],l,e):t[l],s>0&&dp(y)?(b=mp(y),a=$a(r,e,y,b,a,s-1)-1):(fp(a+1),r[a]=y),a++),l++;return a};_a.exports=$a});var Da=p((av,Ba)=>{"use strict";var yp=Be(),bp=yp("toStringTag"),qa={};qa[bp]="z";Ba.exports=String(qa)==="[object z]"});var Ua=p((ov,Ha)=>{"use strict";var Cp=Da(),gp=z(),Dt=_e(),Ep=Be(),Ip=Ep("toStringTag"),Tp=Object,xp=Dt(function(){return arguments}())==="Arguments",Sp=function(r,e){try{return r[e]}catch(t){}};Ha.exports=Cp?Dt:function(r){var e,t,n;return r===void 0?"Undefined":r===null?"Null":typeof(t=Sp(e=Tp(r),Ip))=="string"?t:xp?Dt(e):(n=Dt(e))==="Object"&&gp(e.callee)?"Arguments":n}});var za=p((cv,Ga)=>{"use strict";var wp=Q(),Ap=z(),Zr=Tt(),Rp=wp(Function.toString);Ap(Zr.inspectSource)||(Zr.inspectSource=function(r){return Rp(r)});Ga.exports=Zr.inspectSource});var Za=p((lv,Ya)=>{"use strict";var Op=Q(),Pp=G(),Wa=z(),kp=Ua(),Vp=Et(),Mp=za(),Ka=function(){},Qa=Vp("Reflect","construct"),Jr=/^\s*(?:class|function)\b/,Np=Op(Jr.exec),jp=!Jr.test(Ka),it=function(e){if(!Wa(e))return!1;try{return Qa(Ka,[],e),!0}catch(t){return!1}},Xa=function(e){if(!Wa(e))return!1;switch(kp(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return jp||!!Np(Jr,Mp(e))}catch(t){return!0}};Xa.sham=!0;Ya.exports=!Qa||Pp(function(){var r;return it(it.call)||!it(Object)||!it(function(){r=!0})||r})?Xa:it});var ro=p((uv,to)=>{"use strict";var Ja=Yr(),Lp=Za(),$p=xe(),_p=Be(),Fp=_p("species"),eo=Array;to.exports=function(r){var e;return Ja(r)&&(e=r.constructor,Lp(e)&&(e===eo||Ja(e.prototype))?e=void 0:$p(e)&&(e=e[Fp],e===null&&(e=void 0))),e===void 0?eo:e}});var io=p((pv,no)=>{"use strict";var qp=ro();no.exports=function(r,e){return new(qp(r))(e===0?0:e)}});var so=p(()=>{"use strict";var Bp=Ue(),Dp=Fa(),Hp=qe(),Up=ze(),Gp=Ge(),zp=io();Bp({target:"Array",proto:!0},{flat:function(){var e=arguments.length?arguments[0]:void 0,t=Hp(this),n=Up(t),i=zp(t,0);return i.length=Dp(i,t,t,n,0,e===void 0?1:Gp(e)),i}})});var ao=p(()=>{"use strict";var Wp=St();Wp("flat")});var co=p((vv,oo)=>{"use strict";so();ao();var Kp=wt();oo.exports=Kp("Array","flat")});var uo=p((yv,lo)=>{"use strict";var Qp=co();lo.exports=Qp});var ho=p((bv,po)=>{"use strict";var Xp=uo();po.exports=Xp});var oh={};Wo(oh,{ContainerTypes:()=>I.ContainerTypes,ControlTypes:()=>I.ControlTypes,CustomError:()=>q,EVENT_NAMES:()=>M,EventActionTypes:()=>I.EventActionTypes,EventTypes:()=>I.EventTypes,Interactives:()=>at,ManifestController:()=>fe,SDKInfo:()=>ah,chapterIdsToVKVideoIds:()=>Ut,compareVersions:()=>Lt,containerTypes:()=>du,controlTypes:()=>mu,eventActionTypes:()=>_r,eventTypes:()=>fu,getChapterIdByVkVideoId:()=>Mo,getVKVideoIdByMedia:()=>rn,getVideoRawIdByMedia:()=>ko,graphEventTypes:()=>ke,hasEndTemplate:()=>rt,interactivesEventTypes:()=>j,isAreaControl:()=>hu,isButtonControl:()=>pu,isLastChapter:()=>Y,isOneTextCtrlContainer:()=>me,isSupportedManifest:()=>I.isSupportedManifest,isTextControl:()=>Ze,isVKVariantItem:()=>Vo,isValidManifest:()=>$r,migrateManifestToLatestVersion:()=>I.migrateManifestToLatestVersion,utils:()=>Fo,vkVideoIdsToChapterIds:()=>nn});module.exports=Ko(oh);var Cn="1.0.34";var Xt=class{constructor(e){this.layout=e}},lt=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 Ee=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",B={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||{}),ut=({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"},pt=({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},ht=({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)},dt=({target:r,props:e,fallback:t,dependsOn:n})=>{var i,s,o,c,a,l,f,y,b,g,A;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} * ${(A=(g=e==null?void 0:e.shape)==null?void 0:g.roundCorners)!=null?A:t.roundCorners})`},Ie=({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",le=(n=>(n.AREA=`${Zt}_area`,n.TEXT=`${Zt}_text`,n.BUTTON=`${Zt}_bttn`,n))(le||{});function Sn(r){return"features"in r}var Te="interactive-control",L={common:Te,wrapper:`${Te}-wrapper`,disabled:`${Te}-disabled`,button:`${Te}-button`,area:`${Te}-area`,text:`${Te}-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:B.innerSizesDependOn)==="self"?{height:t.style.height,width:t.style.width}:{height:"var(--interactive-content-height)",width:"var(--interactive-content-width)"};this.container={element:t,dimensions: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 mt=(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",le.AREA),ht({target:n,props:this.control.props,fallback:w(d({},B),{backgroundColor:"transparent"})}),dt({target:n,props:this.control.props,fallback:w(d({},B),{borderAlpha:0}),dependsOn:this.container.dimensions}),Ie({target:n,layoutParams:this.control.layoutParams,fallback:B}),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 ft=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 vt=(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",le.BUTTON),Ie({target:n,layoutParams:this.control.layoutParams,fallback:B}),ht({target:n,props:this.control.props,fallback:B}),dt({target:n,props:this.control.props,fallback:B,dependsOn:this.container.dimensions}),ut({target:n,props:w(d({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let i=ft(this.control.type.trim().toLowerCase()),s=(o=i.firstElementChild)!=null?o:i;pt({target:s,props:this.control.props,fallback:B,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",le.TEXT),Ie({target:n,layoutParams:this.control.layoutParams,fallback:B}),ut({target:n,props:w(d({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let i=ft(this.control.type.trim().toLowerCase()),s=(o=i.firstElementChild)!=null?o:i;pt({target:s,props:this.control.props,fallback:B,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",U={common:rr,hidden:`${rr}-hidden`,disabled:`${rr}-disabled`};var yt=(r,e,t)=>{if(r.type.trim().toLowerCase()==="choice")return new nr(r,e,t)},nr=class extends Ee{constructor(t,n,i){super(t,i);this.containerElement=null;this.rootElement=n,this.layout=new lt(this.container.layout),this.isRemoved=!1,this.isDisabled=!1,this.addControlFactory("button",vt),this.addControlFactory("text",wn),this.addControlFactory("area",mt)}createView({eventCallback:t}){let n=document.createElement("div");return n.classList.add(U.common,U.disabled),requestAnimationFrame(()=>{n.classList.remove(U.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(U.hidden)}show(){let t=this.getElement();t&&t.classList.remove(U.hidden)}enable(){let t=this.getElement();t&&(t.classList.remove(U.disabled),this.controls.forEach(n=>n.enable()),this.isDisabled=!1)}disable(){let t=this.getElement();t&&(t.classList.add(U.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=ee(Nr(),1),S=require("@vkontakte/videoplayer-shared/es2015"),Ne=require("@vkontakte/videoplayer-statistics/es2015");var Ms=require("@vkontakte/videoplayer-shared/es2015");function We(r,e){let t;return(...n)=>{clearTimeout(t),t=setTimeout(()=>r(...n),e)}}var pe=(r,e)=>Object.prototype.toString.call(r)===`[object ${e}]`,Ke=r=>pe(r,"Object"),At=r=>pe(r,"String"),Rt=r=>pe(r,"Array"),Ot=r=>pe(r,"Number"),Os=r=>pe(r,"Function");var jr=r=>Ot(r)&&!isNaN(r);var he=r=>Ke(r)&&Object.keys(r).length===0,Lr=r=>Rt(r)&&!r.length;var Qe=(r,e)=>At(r)&&(e?r.trim():r).length;var Ps="video_interactive",ks="videoint";var Vs=250,Xe=class{constructor(e){this.handleZoomChange=We(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,!Ot(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=uu(e),this.resizeObserver=new ResizeObserver(We(this.onResize,Vs)),this.resizeObserver.observe(this.graphWrapperElement)}getNextPoint(e=this.ngEditorSize){return!this.lastZoomInfo||!e?null:[(this.lastZoomInfo.x-e.width/2)/this.lastZoomInfo.value*-1,(this.lastZoomInfo.y-e.height/2)/this.lastZoomInfo.value*-1]}setVisitedChapters(e){var t;this.visitedChapterIds=new Set([...this.visitedChapterIds,...e]),(t=this.ngEditor)==null||t.setVisitedChapters(Array.from(this.visitedChapterIds))}updateVideosInfo(e){var t;(t=this.ngEditor)==null||t.updateVideosInfo(e)}show(){return V(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 V(this,null,function*(){var n;if(!this.manifest)return;let e;try{e=yield(0,Ms.loadVKLangPack)(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=J(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 uu(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 Ye=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}}};var I=require("@interactiveplatform/movika-manifest");var Ns={metadata:"Object",chapters:"Array"},$r=r=>{if(!Ke(r))return!1;for(let e in Ns)if(!r[e]||!pe(r[e],Ns[e]))return!1;return(0,I.isSupportedManifest)(r.metadata.version)},Ze=r=>r.type===I.ControlTypes.Text,pu=r=>r.type===I.ControlTypes.Button,hu=r=>r.type===I.ControlTypes.Area,du={Choice:"Choice",TextInput:"TextInput"},mu={Button:"Button",Area:"Area",Text:"Text"},fu={onClick:"onClick",onSuspense:"onSuspense"},_r={openURI:"openURI",setNextBranch:"setNextBranch",setWeightlessRandomBranch:"setWeightlessRandomBranch",setRandomBranch:"setRandomBranch",setMaxWeightBranch:"setMaxWeightBranch",setMinWeightBranch:"setMinWeightBranch",setDefaultBranch:"setDefaultBranch",continuePlayback:"continuePlayback",expect:"expect"};var q=class{constructor(e,t,...n){this.severity=e;this.category=t;this.data=n}toString(){return`Interactive SDK error ${JSON.stringify(this,null," ")}`}};var Pt=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 kt=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=[]}};var qs=require("@vkontakte/videoplayer-shared/es2015");var Vt=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 V(this,null,function*(){return vu(...this.loaders[e])(t)})}};function vu(...r){return function(t){return V(this,null,function*(){let n=[...r];for(;n.length>0;)t=yield n.shift()(t);return t})}}function Je(r,e,t){return r?w(d({},r),{[e]:r[e]?[t,...r[e]]:[t]}):{[e]:[t]}}function Mt(i){var s=i,{actions:r,errors:e,chapterId:t}=s,n=J(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?w(d({},n),{actions:r,errors:e,result:{chapter:c,media:a,graph:l}}):w(d({},n),{errors:Je(e,Mt.name,"Could not find media"),actions:r})}}}return w(d({},n),{errors:Je(e,Mt.name,"Could not find chapter"),actions:r})}var Nt=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}},Oe=class extends Nt{constructor(){super(),this.listeners||Nt.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(e){e.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,e)),super.dispatchEvent(e)}},et=class{constructor(){Object.defineProperty(this,"signal",{value:new Oe,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&&(et.prototype[Symbol.toStringTag]="AbortController",Oe.prototype[Symbol.toStringTag]="AbortSignal");function jt(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 Fr(r){typeof r=="function"&&(r={fetch:r});let{fetch:e,Request:t=e.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=r;if(!jt({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,A)=>{f.addEventListener("abort",()=>A(y),{once:!0})});return l&&l.signal&&delete l.signal,Promise.race([b,o(a,l)])}return o(a,l)},Request:s}}var tt=jt({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),js=tt?Fr({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,qr=tt?js.fetch:window.fetch,Qm=tt?js.Request:window.Request,Xm=tt?et:window.AbortController,Ym=tt?Oe:window.AbortSignal;var Lt=(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 yu=r=>V(void 0,null,function*(){try{let e={},t;if(At(r)){t=new URL(r).href;let i=yield qr(t);if(!i.ok)return{};e=yield i.json()}else if(Ke(r))e=r;else return{};if(!$r(e))return{};let n=e.metadata.media;if(At(n)&&!("media"in e))try{let i;t?i=new URL(n,t).href:(i=new URL(n).href,t=i);let s=yield qr(i);if(!s.ok)throw new Error;e.metadata.media=yield s.json()}catch(i){return gu(e.metadata.version)?{manifest:e}:{}}return{manifest:e,manifestURL:t}}catch(e){return{}}});function Ls(r){return V(this,null,function*(){let{manifest:e,manifestURL:t}=yield yu(r);if(!e)throw new Error("Failed on fetch");let n=(0,I.migrateManifestToLatestVersion)(e);return n.media=bu(n.media,t),delete n.metadata.media,n})}function $t(r,e){if(e)return r.find(t=>t.id===e)}function Br(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 Dr(r,e){return r.videos.find(t=>t.id===e)}function bu(r,e){return w(d({},r),{videos:r.videos.map(t=>w(d({},t),{variants:t.variants.map(n=>{let i="url"in n?n.url:"",s=Cu(i,e);return w(d({},n),{url:s||i})})}))})}function Cu(r="",e){try{return new URL(r,e).href}catch(t){return""}}function gu(r){return Lt(r,"3.2.0")>=0}var _t=r=>Rt(r)&&!Lr(r),Y=r=>r.order==="end",rt=r=>Rt(r.containers)&&!Lr(r.containers)&&Y(r),$s=(r,e)=>{var n;let t=r*1e3;return _t(e.controls)&&t<((n=e.startTime)!=null?n:0)},Hr=(r,e)=>{var n,i;let t=r*1e3;return _t(e.controls)&&t>=((n=e.startTime)!=null?n:0)&&t<=((i=e.endTime)!=null?i:1/0)};var de=(r=[])=>r.some(e=>e.action.type==="expect"),Ur=(r=[])=>r.find(e=>e.action.type==="expect"),Eu=r=>(r==null?void 0:r.length)===1,me=r=>Eu(r)&&Ze(r[0]);function _s(r,...e){return t=>typeof e[0]=="object"&&typeof t=="object"?r(d(d({},e[0]),t)):r(...e,...t)}var Fs=(r,e)=>{let t=E=>{let v=e.find(({container:P})=>P.container.id===E);return v==null?void 0:v.container.isRemoved},n=de(r.events)&&!t(r.id),i=(E,v=!1,P=!1)=>{let h=P?"every":"some";return E.controls[h](u=>{var T;let m=v?E.endTime===r.endTime:!0;return((T=u.events)==null?void 0:T[h](x=>{var C;return((C=x.action)==null?void 0:C.type)===_r.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&&de(E.container.events)&&E.container.endTime===r.endTime&&!E.isRemoved).length,a=E=>E.controls.some(v=>{var P;return(P=v.events)==null?void 0:P.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,A=a(r);return{isExpectTime:l,hasOtherExpect:c>0,hasOpenURIEvent:f,hasOpenURIEventInCurrentContainer:y,isAllOpenURIEventsValid:b,isExpectEventForCurrentContainer:g,hasShouldOpenNowEvent:A}};var fe=class extends Vt{constructor(t,n){super(t);this.manifest=null;this.chapter=null;this.media=null;this.graph=null;this.prevChapter$=new qs.ValueSubject(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 V(this,null,function*(){var i;this.release();let n=yield this.exec("manifestLoaders",{actions:{addErrorMessage:Je},result:null,errors:null,source:t});return n.errors&&this.errorHandler(n.errors),this.manifest=yield Ls((i=n.result)!=null?i:t),this})}setInitial(){return V(this,null,function*(){return this.setNext()})}setNext(){return V(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",Mt({actions:{getManifest:()=>this.manifest,getCurrent:this.getCurrent,getGraph:Br,getChapter:$t,getMedia:Dr,getByBranches:this.getByBranches.bind(this),addErrorMessage:Je},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=$t(this.manifest.chapters,t);if(i){let s=Dr(this.manifest.media,i.videoId),o=Br(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=$t(((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?Y(this.chapter):!1}};var Ra=ee(Ft(),1),Oa=require("@vkontakte/videoplayer-core/es2015"),oe=require("@vkontakte/videoplayer-shared/es2015");var ga=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 Ea=ee(Ft(),1);function Kr(){let r=new Map;function e(a){var l=a,{listId:s=Math.random().toString(),itemId:o=Math.random().toString()}=l,c=J(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,Ea.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 Pe=ee(qt(),1);function Qr(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,Pe.default)(e,"mp4"))&&(t.MPEG=w(d({},t.MPEG),{[(s=a.standard)!=null?s:"Invariant quality"]:a.url}));break;case"mpeg":(i||(0,Pe.default)(e,"mpeg"))&&(t.MPEG=w(d({},t.MPEG),{[(o=a.standard)!=null?o:"Invariant quality"]:a.url}));break;case"hls":(i||(0,Pe.default)(e,"hls"))&&(t=w(d({},t),{HLS:{type:"url",url:a.url}}));break;case"dash":(i||(0,Pe.default)(e,"dash"))&&(t=w(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 nt=(r,e)=>{let t=r.info.currentQuality$.getValue(),n=r.info.availableQualities$.getValue();t!==e&&(0,Pe.default)(n,e)&&(r.setQuality(e),r.setAutoQuality(!1))};var lp=2;function Xr(r){let e=Kr(),t=new oe.Subscription,n={},i=null,s=!1,o,c=new oe.ValueSubject(null);r&&a(r);function a(v){i=v}function l(v,P,h){var T;if(!i)throw Error("need to set interactive controller");if(!i.options)return;let m=((T=e.map.get(v))!=null?T:{})[P];if(m){n=d({chapterId:h,listId:v,itemId:P},m);let x=n.player;n.subscription.add(x.info.currentQuality$.subscribe(C=>{let O=x.info.position$.getValue(),F=x.info.isAutoQualityEnabled$.getValue();if(!(!C||!O||F))for(let k of e.map)(0,Ra.default)(k[1]).forEach(({player:N})=>{nt(N,C)})})).add(x.events.started$.subscribe(()=>{f(P)})),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 V(this,null,function*(){if(!i)throw Error("need to set interactive controller");if(he(n)||v!==n.itemId)return;let P=i.getChapterBranches(),h=new Set;for(let u of P)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 V(this,arguments,function*({chapter:{id:v},manifestVideo:P}){if(he(n)||!i)return;let u=n.player.info.muted$.getValue(),m=n.player.info.currentQuality$.getValue(),T=n.player.info.isAutoQualityEnabled$.getValue(),x=n.player.info.volume$.getValue(),C=n.player.info.currentPlaybackRate$.getValue(),O=!T,F=!1;for(let k of e.map)if(k[0]===P.id&&!i.state.isReplay$.getValue()){let N=Object.keys(k[1]);for(let $ of N)$===n.itemId?(N.length<lp||(F=!0),e.removePlayer(k[0],$)):(F=!0,l(k[0],$,v),O?nt(n.player,m):n.player.setAutoQuality(!0),n.player.setVolume(x),n.player.setMuted(u),n.player.setPlaybackRate(C))}else e.removePlayer(k[0]);F||(yield b({media:P,chapterId:v,setAsActive:!0,playbackRate:C}),O?nt(n.player,m):n.player.setAutoQuality(!0),n.player.setVolume(x),n.player.setMuted(u))})}function b(O){return V(this,arguments,function*({media:v,chapterId:P,prefetch:h=!0,setAsActive:u=!0,autoplay:m=!1,preferredExt:T,title:x,playbackRate:C}){var on,cn,ln,un,pn;let F=Math.random().toString(),k=document.createElement("div");o.append(k);let N;if((on=i==null?void 0:i.options)!=null&&on.vkVideoLoader){let ot=ga(v);ot.length&&(N=yield i.options.vkVideoLoader(...ot))}let $=((cn=i==null?void 0:i.options)==null?void 0:cn.coreConfig)||void 0,Z=w(d({},$),{configName:[...(ln=$==null?void 0:$.configName)!=null?ln:[],"interactive"]}),ce=w(d({container:k},((un=N==null?void 0:N.videos)==null?void 0:un[0])||{sources:Qr(v,T).sources}),{title:x,failoverHosts:(N==null?void 0:N.failoverHosts)||[]}),D=new Oa.Player(Z,oe.Tracer.createRootTracer());D.initVideo(ce);let Ce=null;if(N!=null&&N.videos&&(i!=null&&i.options.createOneStat)){let ot=N.videos[0],Kt=i.options.createOneStat(ot),hn=new oe.Subscription;Kt&&(hn.add(Kt.attachTo(D)),Ce={oneStat:Kt,statSubscription:hn})}let an=new oe.Subscription,qo=(pn=n==null?void 0:n.player)==null?void 0:pn.info.isAutoQualityEnabled$.getValue();an.add(D.events.canplay$.subscribe(function(){qo||nt(D,n.player.info.currentQuality$.getValue()),C&&D.setPlaybackRate(C)}));let ge=e.createPlayer({listId:v.id,itemId:F,player:D,container:k,sources:Qr(v,T).sources,config:ce,subscription:an,statistics:Ce});return u&&l(v.id,ge.itemId,P),m&&ge.player.play(),h&&!m&&ge.player.prepare(),{player:ge.player,config:ge.config,statistics:ge.statistics}})}function g(){A(),i=null,o.remove()}function A(){t.unsubscribe(),e.removeAll(),n={},s=!1}function E(){return V(this,null,function*(){if(!i)throw Error("need to set interactive controller");A(),o=document.createElement("div");let{media:v,chapter:P}=i.getCurrentChapter();v&&P?(t.add(i.events.chapterChanged$.subscribe(y)),yield b({media:v,chapterId:P.id,title:P.label})):console.error("not found")})}return w(d({},e),{init:E,setInteractiveController:a,createPlayer:b,removeAll:g,getActivePlayer:function(){return n},activePlayerChanged:c})}var M={graph:"graph",interactives:"interactives",chapterChanged:"chapter-changed",playerChanged:"player-changed",manifestChanged:"manifest-changed",errors:"errors",eachTick:"eachTick",historyInited:"history-inited",historyDestroyed:"history-destroyed"},ke={visibility:"visibility",watchAgainClicked:"watchAgainClicked"},j={actionChoiceCanceled:"action-choice-canceled",actionChoice:"action-choice",actionExecution:"action-execution",visibility:"visibility",containerRemoved:"container-removed",rangeEnded:"range-ended"};var ka=ee(qt(),1),Va=require("@vkontakte/videoplayer-shared/es2015");var Bt=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&&(de(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:A,hasShouldOpenNowEvent:E}=this.getContainerEventState(),v=this.interactiveTimeOpenUri&&!g,P=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&&!A&&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(P){let u=((m,T,x,C)=>!m&&!T&&x||m&&!T&&x&&!C||m&&!T&&x&&C)(f,y,A,this.isSelectedContainerEvent);this.fakeRemoveView(u)}else this.removeView(),this.emitContainerVisibilityEvent(!1);(!f||!y||!E)&&(this.selectBranches.stopExpect(),l())}},isEOV:()=>this.gameState===4},c=_s(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($s(s,this.container.container))this.gameState!==1&&(this.gameState=1,this.onBeforeStartTime());else if(Hr(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,A=this.interactiveTimeOpenUri&&b;if(A&&!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&&!A&&this.removeView()}let o=Hr(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(M.eachTick,a),this.globalEvents.eachTick$.next(a)};this.container=t,this.branches=n,this.selectBranches=i,this.subscription=new Va.Subscription,this.player=e,this.interactiveEvents=s,this.getContainerEventState=a,this.isPermanentText=l&&me(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(M.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.visibility,visibility:e,isFirst:t}),this.globalEvents.interactiveVisibilityChanged$.next({subjectId:this.container.container.id,subjectName:"container",type:"visibility",visibility:e,isFirst:t})):(this.globalEventEmitter.emit(M.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.visibility,visibility:!1}),this.globalEvents.interactiveVisibilityChanged$.next({subjectId:this.container.container.id,subjectName:"container",type:"visibility",visibility:e}))}registerEvents(){this.subscription.add(this.player.events.playing$.subscribe(this.show)).add(this.player.events.paused$.subscribe(this.hide)).add(this.player.events.ended$.subscribe(this.onEndOfVideo)).add(this.disabledControls$.subscribe(e=>{var t,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:de(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(M.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.containerRemoved,visibility:!1}),this.globalEvents.interactiveContainerRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-removed"}),this.gameState=5,(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 Ma=(r=[])=>r.reduce((e,t,n)=>{var s,o,c;let i=((s=t==null?void 0:t.controls)!=null?s:[]).filter(a=>!Ze(a));if(_t(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=[],A=[];for(let E=0;E<e.length;E++){let v=e[E];if(A.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(A.push(l),a[0]<=b&&a[1]>=y)return[{subjects:A,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 fo=ee(qt(),1),en=ee(Ft(),1),vo=ee(ho(),1);function mo(){let r={};function e(){for(let c in r)Object.prototype.hasOwnProperty.call(r,c)&&delete r[c]}function t(c){let a={};for(let l in r)+l<=c&&(a[l]=r[l]);return a}function 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&&Qe(a,!0)){let b={},g=y[a];if(g&&(b=d(d({},b),g)),b=he(b)?null:b,b&&Qe(l,!0)){let A=b[l];return A!=null?A:null}return b}return y}return null}function s({timestamp:c,priority:a,initiator:l}){if(jr(c))if(r[c]){if(a&&Qe(a,!0))if(r[c][a]){if(l&&Qe(l,!0))if(r[c][a][l]){if(delete r[c][a][l],!he(r[c][a]))return!0}else return!1;if(delete r[c][a],!he(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=J(b,["timestamp","priority","initiator"]);var g,A,E;(A=(g=r[c])==null?void 0:g[a])!=null&&A[l]?r[c][a][l].push(d({},f)):(E=r[c])!=null&&E[a]?r[c][a]=w(d({},r[c][a]),{[l]:[d({},f)]}):r[c]?r[c]=w(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 Yp=[I.EventActionTypes.expect,I.EventActionTypes.setNextBranch],Zp=1/0;function yo(r,e){let t=r,n,i=Jp(e),s=mo(),o,c=()=>{g(),h()},a=u=>{s.add.call(void 0,u),E()},l=(u=[])=>{for(let m of u)if(m.action(),(0,fo.default)(Yp,m.actionType))break},f=(u=1/0)=>{var C,O,F;let m=Ht((C=s.get({timestamp:u,priority:"control"}))!=null?C:{}),T=Ht((O=s.get({timestamp:u,priority:"container"}))!=null?O:{}),x=Ht((F=s.get({timestamp:u,priority:"chapter"}))!=null?F:{});return[...m,...T,...x]},y=u=>{i.isReady(u)&&l(f(u))},b=()=>{var u;l([...Ht((u=s.get({timestamp:1/0,priority:"chapter"}))!=null?u:{})])},g=()=>{n&&(o==null||o.unsubscribe(),n=void 0)},A=u=>{},E=()=>{n||(n=()=>setTimeout(()=>{y(1/0)}),o=t.events.ended$.subscribe(n))},v=u=>{g(),t=u},P=u=>{u.priority==="container"&&i.resetCalled(u.timestamp),s.remove(u)},h=()=>{i.release(),s.removeAll()};return{setPlayer:v,add:a,remove:P,exec:y,execEndOfVideo:b,listen:E,unlisten:g,release:c,containersEventsCallState:i,getPreparedToExecActions:f}}function Jp(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:Zp,y=e.get(f);e.set(f,w(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 Ht(r){return(0,vo.default)((0,en.default)(r)).sort(e=>e.actionType===I.EventActionTypes.expect?-1:1)}var bo={videoContentHeight:0,videoContentWidth:0},Co=r=>{let{height:e,width:t}=r.info.intrinsicVideoSize$.getValue()||{};if(!(e&&t))return bo;let{clientHeight:n,clientWidth:i}=r.experimental.element$.getValue()||{};if(!(n&&i))return bo;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 eh=250;function go(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}=Co(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=We(c=>{let{fns:a=[]}=r();n(c);for(let l of a)l()},eh);function o(){e=void 0,t.disconnect(),i()}return{resizeObserver:t,calc:()=>{e==null||e()},release:o}}var th=r=>Math.floor(Math.random()*r),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:1;o<t&&(t=o,n=s)}return n},To=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 xo=r=>{let e=r.length,t=th(e);return r[t]},Eo=1,So=r=>{var n,i;let e=0;for(let s=0;s<r.length;++s)e+=(n=r[s].weight)!=null?n:Eo;let t=Math.random()*e;e=0;for(let s=0;s<r.length-1;++s)if(e+=(i=r[s].weight)!=null?i:Eo,e>=t)return r[s];return r[r.length-1]};var wo={shouldOpenNow:!0,isDetachContainer:!0},Ao="after-expect";var tn=(r,e=!1)=>w(d({},r),{args:e?d(d({},r.args),wo):d(d({},wo),r.args)}),Po=({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:T,branches:x=[],onEvent:C,isEOV:O=()=>!1,isDisabled:F=()=>!1})=>{let k=tn(h,O()),N={timestamp:1/0,priority:"control",initiator:m,actionType:k.type},$=F(),Z=r.emit.bind(r,M.interactives,{subjectId:m,subjectType:u,subjectName:"control",type:$?j.actionChoiceCanceled:j.actionChoice,actionType:h.type,payload:d({invokeImmediately:k.args.shouldOpenNow,containerId:T},k.args)}),ce=()=>{e.interactiveActionChoice$.next({subjectId:m,subjectType:u,subjectName:"control",type:$?"action-choice-canceled":"action-choice",actionType:h.type,payload:d({invokeImmediately:k.args.shouldOpenNow,containerId:T},k.args)})};if($){Z(),ce();return}switch(k.type.trim().toLowerCase()){case I.EventActionTypes.setNextBranch.trim().toLowerCase():{let D=x.find(Ce=>Ce.id===k.args.branchId);if(!D)return;C(k.args.isDetachContainer,g.bind(null,{subjectId:m,subjectName:"control"})),Z(),ce(),k.args.shouldOpenNow?E({subjectId:m,subjectName:"control",subjectType:u,action:k,payload:{chapterId:D.chapterId,autoSelect:!1}}):n.add(w(d({},N),{action:E.bind(null,{subjectId:m,subjectName:"control",subjectType:u,action:k,payload:{chapterId:D.chapterId,autoSelect:!1}})}));return}case I.EventActionTypes.continuePlayback.trim().toLowerCase():{C(k.args.isDetachContainer,g.bind(null,{subjectId:m,subjectName:"control"})),Z(),ce(),k.args.shouldOpenNow?A({subjectId:m,subjectName:"control",subjectType:u,action:h}):n.add(w(d({},N),{action:A.bind(null,{subjectId:m,subjectName:"control",subjectType:u,action:h})}));return}case I.EventActionTypes.openURI.trim().toLowerCase():{C(k.args.isDetachContainer,g.bind(null,{subjectId:m,subjectName:"control"})),Z(),ce(),k.args.shouldOpenNow?P({subjectId:m,subjectName:"control",subjectType:u,action:k,payload:{URI:h.args.uri}}):n.add(w(d({},N),{action:P.bind(null,{subjectId:m,subjectName:"control",subjectType:u,action:k,payload:{URI:h.args.uri}})}));return}default:{let D="Unexpected control event",Ce=new q(1,1,{message:D});f(Ce,D);return}}},c=({action:h,container:{id:u,endTime:m},branches:T=[],isEOV:x=!1,autoSelected:C=!1})=>{let O=tn(h,x),F={timestamp:!O.args.shouldOpenNow||x?1/0:m!=null?m:1/0,priority:"container",initiator:u,actionType:O.type},k=r.emit.bind(r,M.interactives,{subjectId:u,subjectName:"container",type:j.actionChoice,actionType:O.type,payload:d({invokeImmediately:O.args.shouldOpenNow},O.args)}),N=()=>{e.interactiveActionChoice$.next({subjectId:u,subjectName:"container",type:"action-choice",actionType:O.type,payload:d({invokeImmediately:O.args.shouldOpenNow},O.args)})};switch(O.type.trim().toLowerCase()){case I.EventActionTypes.setNextBranch.trim().toLowerCase():{let $=T.find(Z=>Z.id===O.args.branchId);if(!$)return;k(),N(),n.add(w(d({},F),{action:E.bind(null,{subjectId:u,subjectName:"container",action:O,payload:{chapterId:$.chapterId,autoSelect:C}})}));return}case I.EventActionTypes.setMaxWeightBranch.trim().toLowerCase():return;case I.EventActionTypes.setMinWeightBranch.trim().toLowerCase():return;case I.EventActionTypes.setRandomBranch.trim().toLowerCase():return;case I.EventActionTypes.setWeightlessRandomBranch.trim().toLowerCase():return;case I.EventActionTypes.continuePlayback.trim().toLowerCase():{k(),N(),n.add(w(d({},F),{action:A.bind(null,{subjectId:u,subjectName:"container",action:O})}));return}case I.EventActionTypes.openURI.trim().toLowerCase():{k(),N(),n.add(w(d({},F),{action:P.bind(null,{subjectId:u,subjectName:"container",action:O,payload:{URI:h.args.uri}})}));return}default:{let $="Unexpected container event",Z=new q(1,1,{message:$});f(Z,$);return}}};function a({container:h,branches:u,isEOV:m=!1}){var x,C;let T=Ur(h.events);if(T){let O=tn(T.action,m);r.emit(M.interactives,{subjectId:h.id,subjectName:"container",type:j.actionChoice,actionType:O.type,payload:d({invokeImmediately:O.args.shouldOpenNow},O.args)}),e.interactiveActionChoice$.next({subjectId:h.id,subjectName:"container",type:"action-choice",actionType:O.type,payload:d({invokeImmediately:O.args.shouldOpenNow},O.args)}),n.add({timestamp:m?1/0:(x=h.endTime)!=null?x:1/0,priority:"container",initiator:h.id,actionType:I.EventActionTypes.expect,action:b.bind(null,{subjectId:h.id,subjectName:"container"})}),i.isExpect=!0}else for(let O of(C=h.events)!=null?C:[])c({action:O.action,container:h,branches:u,isEOV:m})}let l=({chapterId:h,action:u,branches:m=[]})=>{let T=r.emit.bind(r,M.interactives,{subjectId:h,subjectName:"chapter",type:j.actionChoice,actionType:u.type,payload:u.args}),x=()=>{e.interactiveActionChoice$.next({subjectId:h,subjectName:"chapter",type:"action-choice",actionType:u.type,payload:u.args})};switch(u.type.trim().toLowerCase()){case I.EventActionTypes.setNextBranch.trim().toLowerCase():{let C=m.find(O=>O.id===u.args.branchId);return C!=null&&C.chapterId?(T(),x(),E.bind(null,{subjectId:h,subjectName:"chapter",action:u,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case I.EventActionTypes.setWeightlessRandomBranch.trim().toLowerCase():{let C=xo(m);return C!=null&&C.chapterId?(T(),x(),E.bind(null,{subjectId:h,subjectName:"chapter",action:u,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case I.EventActionTypes.setRandomBranch.trim().toLowerCase():{let C=So(m);return C!=null&&C.chapterId?(T(),x(),E.bind(null,{subjectId:h,subjectName:"chapter",action:u,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case I.EventActionTypes.setMaxWeightBranch.trim().toLowerCase():{let C=To(m);return C!=null&&C.chapterId?(T(),x(),E.bind(null,{subjectId:h,subjectName:"chapter",action:u,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case I.EventActionTypes.setMinWeightBranch.trim().toLowerCase():{let C=Io(m);return C!=null&&C.chapterId?(T(),x(),E.bind(null,{subjectId:h,subjectName:"chapter",action:u,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case I.EventActionTypes.continuePlayback.trim().toLowerCase():return T(),x(),A.bind(null,{subjectId:h,subjectName:"chapter",action:u});case I.EventActionTypes.openURI.trim().toLowerCase():return T(),x(),P.bind(null,{subjectId:h,subjectName:"chapter",action:u,payload:{URI:u.args.uri}});default:{let C="Unexpected chapter event",O=new q(1,1,{message:C});f(O,C);return}}};function f(h,u){console.error(u),e.error$.next(h),r.emit(M.errors,h)}function y(h){var m;let u=Ur(h.events);if(u){if(Y(h))return;r.emit(M.interactives,{subjectId:h.id,subjectName:"chapter",type:j.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:I.EventActionTypes.expect,action:b.bind(null,{subjectId:h.id,subjectName:"chapter"})})}else(m=h.events)==null||m.forEach(T=>{let x=l({chapterId:h.id,action:T.action,branches:h.branches});x&&n.add({timestamp:1/0,priority:"chapter",initiator:h.id,actionType:T.action.type,action:x})})}let b=({subjectId:h,subjectName:u})=>{t.pause(),r.emit(M.interactives,{subjectId:h,subjectName:u,type:j.actionExecution,actionType:I.EventActionTypes.expect}),e.interactiveActionExecution$.next({subjectId:h,subjectName:u,type:"action-execution",actionType:I.EventActionTypes.expect})},g=({subjectId:h,subjectName:u})=>{t.info.isEnded$.getValue()?n.execEndOfVideo():t.play(),r.emit(M.interactives,{subjectId:h,subjectName:u,type:j.actionExecution,actionType:Ao}),e.interactiveActionExecution$.next({subjectId:h,subjectName:u,type:"action-execution",actionType:Ao})},A=({subjectId:h,subjectName:u,subjectType:m,action:T})=>{r.emit(M.interactives,{subjectId:h,subjectName:u,subjectType:m,type:j.actionExecution,actionType:T.type}),e.interactiveActionExecution$.next({subjectId:h,subjectName:u,subjectType:m,type:"action-execution",actionType:T.type})},E=({subjectId:h,subjectName:u,subjectType:m,action:T,payload:x})=>{x.behaviour="change-chapter",r.emit(M.interactives,{subjectId:h,subjectName:u,subjectType:m,type:j.actionExecution,actionType:T.type,payload:x}),e.interactiveActionExecution$.next({subjectId:h,subjectName:u,subjectType:m,type:"action-execution",actionType:T.type,payload:x})},v=({subjectId:h,subjectName:u,subjectType:m,action:T,payload:x})=>{x.behaviour="change-manifest",r.emit(M.interactives,{subjectId:h,subjectName:u,subjectType:m,type:j.actionExecution,actionType:T.type,payload:x}),e.interactiveActionExecution$.next({subjectId:h,subjectName:u,subjectType:m,type:"action-execution",actionType:T.type,payload:x})},P=({subjectId:h,subjectName:u,subjectType:m,action:T,payload:x})=>{if(!x.URI)return;let C=window.open(x.URI,"_blank","noopener,noreferrer");C&&(C.opener=null),r.emit(M.interactives,{subjectId:h,subjectName:u,subjectType:m,type:j.actionExecution,actionType:T.type}),e.interactiveActionExecution$.next({subjectId:h,subjectName:u,subjectType:m,type:"action-execution",actionType:T.type})};return{onControlEvent:o,onContainerEvent:c,onChapterEvent:l,onExpectEvent:b,expectEventHandler:g,setManifestChapterEvents:y,setManifestContainerEvents:a,stopExpect:s,state:i}};var sn=ee(Nr(),1),K=require("@vkontakte/videoplayer-shared/es2015");var Ut=(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]=rn(s)}return t[n]}).filter(Boolean)},ko=r=>{for(let e of r.variants)if(Vo(e)&&e.payload)return e.payload.id},Vo=r=>!!(r.type==="custom"&&r.payload&&r.payload.type==="vk"),rn=r=>{let e=ko(r);if(!e)return null;let t=e.split("_").pop();return t?parseInt(t,10):null},Mo=(r,e)=>{for(let t of r.media.videos)if(e===rn(t)){for(let n of r.chapters)if(n.videoId===t.id)return n.id;return}},nn=(r,e)=>r.reduce((t,n)=>{let i=Mo(e,n);return i?[...t,i]:t},[]);var ne,ve,ye,W,Gt,ie,se,re,be,Ve,Me,st=class{constructor({globalEventEmitter:e,videoId:t,interactiveController:n,historyApi:i,settings:s}){this.state={history$:new K.ValueSubject([]),hasPrevChapter$:new K.ValueSubject(!1),prevChapter$:new K.ValueSubject(null),isInitialChapter$:new K.ValueSubject(!1),isGoBackLimited$:new K.ValueSubject(!1)};H(this,ne,null);H(this,ve);H(this,ye,!1);H(this,W,null);H(this,Gt,null);this.events={inited$:new K.Subject,destroyed$:new K.Subject,error$:new K.Subject};H(this,ie,null);H(this,se,null);H(this,re,null);H(this,be,new K.Subscription);H(this,Ve,!1);H(this,Me,0);var o;_(this,ie,t),_(this,re,e),_(this,se,n),_(this,ne,i),_(this,ve,s),this.state.history$&&R(this,be)&&((o=R(this,be))==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=R(this,W))==null?void 0:a.metadata)==null?void 0:l.initChapterId)),this.state.isGoBackLimited$.next(R(this,Me)===R(this,ve).maxLength-1)})))}setManifest(e){return V(this,null,function*(){if(!R(this,se)||!R(this,re))return;_(this,W,e),yield this.getProjectHistory();let t=this.getInitialChapterId();yield R(this,se).setChapter({chapterId:t,pushToHistory:!1}),R(this,ye)||(_(this,ye,!0),this.events.inited$.next({initChapterId:t}))})}get inited(){return R(this,ye)}updateHistory(e,t=!0){return V(this,null,function*(){var c;if(!R(this,W))return;R(this,Ve)?(_(this,Ve,!1),bn(this,Me)._++):_(this,Me,0);let n=R(this,W),i=e.length-R(this,ve).maxLength,s=i>0?e.slice(i):e,o=Ut(s,n);if(_(this,Gt,o),this.state.history$.next(s),!(!t||!R(this,ne)||!R(this,ie)))try{yield R(this,ne).save(R(this,ie),o)}catch(a){let l=new q(1,5,"Unable to save interactive history");this.events.error$.next(l),(c=R(this,re))==null||c.emit(M.errors,l)}})}goBack(){return V(this,null,function*(){var n;if(!this.state||!R(this,se)){let i=new q(1,5,"Unable to save interactive history");return this.events.error$.next(i),(n=R(this,re))==null?void 0:n.emit(M.errors,i)}_(this,Ve,!0);let e=this.state.history$.getValue().slice(0,-1),t=e.pop();this.state.history$.next(e),yield R(this,se).setChapter({chapterId:t,playPrev:!0})})}getProjectHistory(){return V(this,null,function*(){var i;if(!R(this,W)||!R(this,ie))return;let e=R(this,W),t=[this.getInitialVideoId()];if(R(this,ne))try{let s=yield R(this,ne).get(R(this,ie));s.length&&(t=s)}catch(s){let o=new q(1,5,"Error while trying to fetch data");this.events.error$.next(o),(i=R(this,re))==null||i.emit(M.errors,o)}let n=nn(t,e);this.state.history$.next(n)})}getInitialChapterId(){var t;let e=this.state.history$.getValue();return(0,sn.default)(e,-1)||R(this,ve).initChapterId||((t=R(this,W))==null?void 0:t.metadata.initChapterId)}getInitialVideoId(){if(R(this,W)){let e=this.getInitialChapterId();return Ut([e],R(this,W)).pop()}return null}destroy(){var e,t;_(this,ie,null),_(this,ne,null),_(this,se,null),(e=R(this,be))==null||e.unsubscribe(),_(this,be,null),_(this,ye,!1),(t=R(this,re))==null||t.emit(M.historyDestroyed),this.events.destroyed$.next(),_(this,re,null)}};ne=new WeakMap,ve=new WeakMap,ye=new WeakMap,W=new WeakMap,Gt=new WeakMap,ie=new WeakMap,se=new WeakMap,re=new WeakMap,be=new WeakMap,Ve=new WeakMap,Me=new WeakMap;var zt=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 V(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 V(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 Wt=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
|
+
"use strict";var tl=Object.create;var _e=Object.defineProperty,rl=Object.defineProperties,nl=Object.getOwnPropertyDescriptor,il=Object.getOwnPropertyDescriptors,ol=Object.getOwnPropertyNames,yt=Object.getOwnPropertySymbols,sl=Object.getPrototypeOf,or=Object.prototype.hasOwnProperty,wn=Object.prototype.propertyIsEnumerable;var An=r=>{throw TypeError(r)};var Sn=(r,e,t)=>e in r?_e(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,d=(r,e)=>{for(var t in e||(e={}))or.call(e,t)&&Sn(r,t,e[t]);if(yt)for(var t of yt(e))wn.call(e,t)&&Sn(r,t,e[t]);return r},T=(r,e)=>rl(r,il(e));var ee=(r,e)=>{var t={};for(var n in r)or.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&yt)for(var n of yt(r))e.indexOf(n)<0&&wn.call(r,n)&&(t[n]=r[n]);return t};var h=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),al=(r,e)=>{for(var t in e)_e(r,t,{get:e[t],enumerable:!0})},Rn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ol(e))!or.call(r,i)&&i!==t&&_e(r,i,{get:()=>e[i],enumerable:!(n=nl(e,i))||n.enumerable});return r};var Q=(r,e,t)=>(t=r!=null?tl(sl(r)):{},Rn(e||!r||!r.__esModule?_e(t,"default",{value:r,enumerable:!0}):t,r)),ll=r=>Rn(_e({},"__esModule",{value:!0}),r);var kn=(r,e,t)=>e.has(r)||An("Cannot "+t);var k=(r,e,t)=>(kn(r,e,"read from private field"),t?t.call(r):e.get(r)),U=(r,e,t)=>e.has(r)?An("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),F=(r,e,t,n)=>(kn(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);var On=(r,e,t,n)=>({set _(i){F(r,e,i,t)},get _(){return k(r,e,n)}});var O=(r,e,t)=>new Promise((n,i)=>{var o=a=>{try{l(t.next(a))}catch(c){i(c)}},s=a=>{try{l(t.throw(a))}catch(c){i(c)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(o,s);l((t=t.apply(r,e)).next())});var re=h((vr,Dn)=>{"use strict";var Ge=function(r){return r&&r.Math===Math&&r};Dn.exports=Ge(typeof globalThis=="object"&&globalThis)||Ge(typeof window=="object"&&window)||Ge(typeof self=="object"&&self)||Ge(typeof global=="object"&&global)||Ge(typeof vr=="object"&&vr)||function(){return this}()||Function("return this")()});var G=h((_d,Hn)=>{"use strict";Hn.exports=function(r){try{return!!r()}catch(e){return!0}}});var ze=h((Bd,Un)=>{"use strict";var cl=G();Un.exports=!cl(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Qn=h((qd,Kn)=>{"use strict";var ul=ze(),Wn=Function.prototype,Gn=Wn.apply,zn=Wn.call;Kn.exports=typeof Reflect=="object"&&Reflect.apply||(ul?zn.bind(Gn):function(){return zn.apply(Gn,arguments)})});var X=h((Dd,Zn)=>{"use strict";var Xn=ze(),Yn=Function.prototype,yr=Yn.call,pl=Xn&&Yn.bind.bind(yr,yr);Zn.exports=Xn?pl:function(r){return function(){return yr.apply(r,arguments)}}});var We=h((Hd,ei)=>{"use strict";var Jn=X(),hl=Jn({}.toString),dl=Jn("".slice);ei.exports=function(r){return dl(hl(r),8,-1)}});var br=h((Ud,ti)=>{"use strict";var ml=We(),fl=X();ti.exports=function(r){if(ml(r)==="Function")return fl(r)}});var z=h((Gd,ri)=>{"use strict";var Cr=typeof document=="object"&&document.all;ri.exports=typeof Cr=="undefined"&&Cr!==void 0?function(r){return typeof r=="function"||r===Cr}:function(r){return typeof r=="function"}});var ve=h((zd,ni)=>{"use strict";var vl=G();ni.exports=!vl(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var Vt=h((Wd,ii)=>{"use strict";var yl=ze(),Pt=Function.prototype.call;ii.exports=yl?Pt.bind(Pt):function(){return Pt.apply(Pt,arguments)}});var gr=h(ai=>{"use strict";var oi={}.propertyIsEnumerable,si=Object.getOwnPropertyDescriptor,bl=si&&!oi.call({1:2},1);ai.f=bl?function(e){var t=si(this,e);return!!t&&t.enumerable}:oi});var Er=h((Qd,li)=>{"use strict";li.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var ui=h((Xd,ci)=>{"use strict";var Cl=X(),gl=G(),El=We(),Ir=Object,Il=Cl("".split);ci.exports=gl(function(){return!Ir("z").propertyIsEnumerable(0)})?function(r){return El(r)==="String"?Il(r,""):Ir(r)}:Ir});var xr=h((Yd,pi)=>{"use strict";pi.exports=function(r){return r==null}});var Tr=h((Zd,hi)=>{"use strict";var xl=xr(),Tl=TypeError;hi.exports=function(r){if(xl(r))throw new Tl("Can't call method on "+r);return r}});var Ke=h((Jd,di)=>{"use strict";var Sl=ui(),wl=Tr();di.exports=function(r){return Sl(wl(r))}});var Re=h((em,mi)=>{"use strict";var Al=z();mi.exports=function(r){return typeof r=="object"?r!==null:Al(r)}});var Mt=h((tm,fi)=>{"use strict";fi.exports={}});var Nt=h((rm,yi)=>{"use strict";var Sr=Mt(),wr=re(),Rl=z(),vi=function(r){return Rl(r)?r:void 0};yi.exports=function(r,e){return arguments.length<2?vi(Sr[r])||vi(wr[r]):Sr[r]&&Sr[r][e]||wr[r]&&wr[r][e]}});var Ci=h((nm,bi)=>{"use strict";var kl=X();bi.exports=kl({}.isPrototypeOf)});var xi=h((im,Ii)=>{"use strict";var Ol=re(),gi=Ol.navigator,Ei=gi&&gi.userAgent;Ii.exports=Ei?String(Ei):""});var Oi=h((om,ki)=>{"use strict";var Ri=re(),Ar=xi(),Ti=Ri.process,Si=Ri.Deno,wi=Ti&&Ti.versions||Si&&Si.version,Ai=wi&&wi.v8,Y,Lt;Ai&&(Y=Ai.split("."),Lt=Y[0]>0&&Y[0]<4?1:+(Y[0]+Y[1]));!Lt&&Ar&&(Y=Ar.match(/Edge\/(\d+)/),(!Y||Y[1]>=74)&&(Y=Ar.match(/Chrome\/(\d+)/),Y&&(Lt=+Y[1])));ki.exports=Lt});var Rr=h((sm,Vi)=>{"use strict";var Pi=Oi(),Pl=G(),Vl=re(),Ml=Vl.String;Vi.exports=!!Object.getOwnPropertySymbols&&!Pl(function(){var r=Symbol("symbol detection");return!Ml(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&Pi&&Pi<41})});var kr=h((am,Mi)=>{"use strict";var Nl=Rr();Mi.exports=Nl&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Or=h((lm,Ni)=>{"use strict";var Ll=Nt(),jl=z(),$l=Ci(),Fl=kr(),_l=Object;Ni.exports=Fl?function(r){return typeof r=="symbol"}:function(r){var e=Ll("Symbol");return jl(e)&&$l(e.prototype,_l(r))}});var ji=h((cm,Li)=>{"use strict";var Bl=String;Li.exports=function(r){try{return Bl(r)}catch(e){return"Object"}}});var Pr=h((um,$i)=>{"use strict";var ql=z(),Dl=ji(),Hl=TypeError;$i.exports=function(r){if(ql(r))return r;throw new Hl(Dl(r)+" is not a function")}});var _i=h((pm,Fi)=>{"use strict";var Ul=Pr(),Gl=xr();Fi.exports=function(r,e){var t=r[e];return Gl(t)?void 0:Ul(t)}});var qi=h((hm,Bi)=>{"use strict";var Vr=Vt(),Mr=z(),Nr=Re(),zl=TypeError;Bi.exports=function(r,e){var t,n;if(e==="string"&&Mr(t=r.toString)&&!Nr(n=Vr(t,r))||Mr(t=r.valueOf)&&!Nr(n=Vr(t,r))||e!=="string"&&Mr(t=r.toString)&&!Nr(n=Vr(t,r)))return n;throw new zl("Can't convert object to primitive value")}});var Hi=h((dm,Di)=>{"use strict";Di.exports=!0});var zi=h((mm,Gi)=>{"use strict";var Ui=re(),Wl=Object.defineProperty;Gi.exports=function(r,e){try{Wl(Ui,r,{value:e,configurable:!0,writable:!0})}catch(t){Ui[r]=e}return e}});var jt=h((fm,Qi)=>{"use strict";var Kl=Hi(),Ql=re(),Xl=zi(),Wi="__core-js_shared__",Ki=Qi.exports=Ql[Wi]||Xl(Wi,{});(Ki.versions||(Ki.versions=[])).push({version:"3.38.0",mode:Kl?"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 Lr=h((vm,Yi)=>{"use strict";var Xi=jt();Yi.exports=function(r,e){return Xi[r]||(Xi[r]=e||{})}});var Qe=h((ym,Zi)=>{"use strict";var Yl=Tr(),Zl=Object;Zi.exports=function(r){return Zl(Yl(r))}});var ke=h((bm,Ji)=>{"use strict";var Jl=X(),ec=Qe(),tc=Jl({}.hasOwnProperty);Ji.exports=Object.hasOwn||function(e,t){return tc(ec(e),t)}});var jr=h((Cm,eo)=>{"use strict";var rc=X(),nc=0,ic=Math.random(),oc=rc(1 .toString);eo.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+oc(++nc+ic,36)}});var Xe=h((gm,ro)=>{"use strict";var sc=re(),ac=Lr(),to=ke(),lc=jr(),cc=Rr(),uc=kr(),Oe=sc.Symbol,$r=ac("wks"),pc=uc?Oe.for||Oe:Oe&&Oe.withoutSetter||lc;ro.exports=function(r){return to($r,r)||($r[r]=cc&&to(Oe,r)?Oe[r]:pc("Symbol."+r)),$r[r]}});var so=h((Em,oo)=>{"use strict";var hc=Vt(),no=Re(),io=Or(),dc=_i(),mc=qi(),fc=Xe(),vc=TypeError,yc=fc("toPrimitive");oo.exports=function(r,e){if(!no(r)||io(r))return r;var t=dc(r,yc),n;if(t){if(e===void 0&&(e="default"),n=hc(t,r,e),!no(n)||io(n))return n;throw new vc("Can't convert object to primitive value")}return e===void 0&&(e="number"),mc(r,e)}});var Fr=h((Im,ao)=>{"use strict";var bc=so(),Cc=Or();ao.exports=function(r){var e=bc(r,"string");return Cc(e)?e:e+""}});var uo=h((xm,co)=>{"use strict";var gc=re(),lo=Re(),_r=gc.document,Ec=lo(_r)&&lo(_r.createElement);co.exports=function(r){return Ec?_r.createElement(r):{}}});var Br=h((Tm,po)=>{"use strict";var Ic=ve(),xc=G(),Tc=uo();po.exports=!Ic&&!xc(function(){return Object.defineProperty(Tc("div"),"a",{get:function(){return 7}}).a!==7})});var fo=h(mo=>{"use strict";var Sc=ve(),wc=Vt(),Ac=gr(),Rc=Er(),kc=Ke(),Oc=Fr(),Pc=ke(),Vc=Br(),ho=Object.getOwnPropertyDescriptor;mo.f=Sc?ho:function(e,t){if(e=kc(e),t=Oc(t),Vc)try{return ho(e,t)}catch(n){}if(Pc(e,t))return Rc(!wc(Ac.f,e,t),e[t])}});var yo=h((wm,vo)=>{"use strict";var Mc=G(),Nc=z(),Lc=/#|\.prototype\./,Ye=function(r,e){var t=$c[jc(r)];return t===_c?!0:t===Fc?!1:Nc(e)?Mc(e):!!e},jc=Ye.normalize=function(r){return String(r).replace(Lc,".").toLowerCase()},$c=Ye.data={},Fc=Ye.NATIVE="N",_c=Ye.POLYFILL="P";vo.exports=Ye});var qr=h((Am,Co)=>{"use strict";var bo=br(),Bc=Pr(),qc=ze(),Dc=bo(bo.bind);Co.exports=function(r,e){return Bc(r),e===void 0?r:qc?Dc(r,e):function(){return r.apply(e,arguments)}}});var Eo=h((Rm,go)=>{"use strict";var Hc=ve(),Uc=G();go.exports=Hc&&Uc(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var xo=h((km,Io)=>{"use strict";var Gc=Re(),zc=String,Wc=TypeError;Io.exports=function(r){if(Gc(r))return r;throw new Wc(zc(r)+" is not an object")}});var wo=h(So=>{"use strict";var Kc=ve(),Qc=Br(),Xc=Eo(),$t=xo(),To=Fr(),Yc=TypeError,Dr=Object.defineProperty,Zc=Object.getOwnPropertyDescriptor,Hr="enumerable",Ur="configurable",Gr="writable";So.f=Kc?Xc?function(e,t,n){if($t(e),t=To(t),$t(n),typeof e=="function"&&t==="prototype"&&"value"in n&&Gr in n&&!n[Gr]){var i=Zc(e,t);i&&i[Gr]&&(e[t]=n.value,n={configurable:Ur in n?n[Ur]:i[Ur],enumerable:Hr in n?n[Hr]:i[Hr],writable:!1})}return Dr(e,t,n)}:Dr:function(e,t,n){if($t(e),t=To(t),$t(n),Qc)try{return Dr(e,t,n)}catch(i){}if("get"in n||"set"in n)throw new Yc("Accessors not supported");return"value"in n&&(e[t]=n.value),e}});var Ro=h((Pm,Ao)=>{"use strict";var Jc=ve(),eu=wo(),tu=Er();Ao.exports=Jc?function(r,e,t){return eu.f(r,e,tu(1,t))}:function(r,e,t){return r[e]=t,r}});var Je=h((Vm,Oo)=>{"use strict";var Ze=re(),ru=Qn(),nu=br(),iu=z(),ou=fo().f,su=yo(),Pe=Mt(),au=qr(),Ve=Ro(),ko=ke();jt();var lu=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 ru(r,this,arguments)};return e.prototype=r.prototype,e};Oo.exports=function(r,e){var t=r.target,n=r.global,i=r.stat,o=r.proto,s=n?Ze:i?Ze[t]:Ze[t]&&Ze[t].prototype,l=n?Pe:Pe[t]||Ve(Pe,t,{})[t],a=l.prototype,c,f,v,y,g,R,I,m,u;for(y in e)c=su(n?y:t+(i?".":"#")+y,r.forced),f=!c&&s&&ko(s,y),R=l[y],f&&(r.dontCallGetSet?(u=ou(s,y),I=u&&u.value):I=s[y]),g=f&&I?I:e[y],!(!c&&!o&&typeof R==typeof g)&&(r.bind&&f?m=au(g,Ze):r.wrap&&f?m=lu(g):o&&iu(g)?m=nu(g):m=g,(r.sham||g&&g.sham||R&&R.sham)&&Ve(m,"sham",!0),Ve(l,y,m),o&&(v=t+"Prototype",ko(Pe,v)||Ve(Pe,v,{}),Ve(Pe[v],y,g),r.real&&a&&(c||!a[y])&&Ve(a,y,g)))}});var Vo=h((Mm,Po)=>{"use strict";var cu=Math.ceil,uu=Math.floor;Po.exports=Math.trunc||function(e){var t=+e;return(t>0?uu:cu)(t)}});var et=h((Nm,Mo)=>{"use strict";var pu=Vo();Mo.exports=function(r){var e=+r;return e!==e||e===0?0:pu(e)}});var Lo=h((Lm,No)=>{"use strict";var hu=et(),du=Math.min;No.exports=function(r){var e=hu(r);return e>0?du(e,9007199254740991):0}});var tt=h((jm,jo)=>{"use strict";var mu=Lo();jo.exports=function(r){return mu(r.length)}});var Ft=h(($m,$o)=>{"use strict";$o.exports=function(){}});var Fo=h(()=>{"use strict";var fu=Je(),vu=Qe(),yu=tt(),bu=et(),Cu=Ft();fu({target:"Array",proto:!0},{at:function(e){var t=vu(this),n=yu(t),i=bu(e),o=i>=0?i:n+i;return o<0||o>=n?void 0:t[o]}});Cu("at")});var _t=h((Bm,_o)=>{"use strict";var gu=Nt();_o.exports=gu});var qo=h((qm,Bo)=>{"use strict";Fo();var Eu=_t();Bo.exports=Eu("Array","at")});var Ho=h((Dm,Do)=>{"use strict";var Iu=qo();Do.exports=Iu});var zr=h((Hm,Uo)=>{"use strict";var xu=Ho();Uo.exports=xu});var Jo=h((Mf,Zo)=>{"use strict";var Lu=et(),ju=Math.max,$u=Math.min;Zo.exports=function(r,e){var t=Lu(r);return t<0?ju(t+e,0):$u(t,e)}});var Jr=h((Nf,ts)=>{"use strict";var Fu=Ke(),_u=Jo(),Bu=tt(),es=function(r){return function(e,t,n){var i=Fu(e),o=Bu(i);if(o===0)return!r&&-1;var s=_u(n,o),l;if(r&&t!==t){for(;o>s;)if(l=i[s++],l!==l)return!0}else for(;o>s;s++)if((r||s in i)&&i[s]===t)return r||s||0;return!r&&-1}};ts.exports={includes:es(!0),indexOf:es(!1)}});var rs=h(()=>{"use strict";var qu=Je(),Du=Jr().includes,Hu=G(),Uu=Ft(),Gu=Hu(function(){return!Array(1).includes()});qu({target:"Array",proto:!0,forced:Gu},{includes:function(e){return Du(this,e,arguments.length>1?arguments[1]:void 0)}});Uu("includes")});var is=h(($f,ns)=>{"use strict";rs();var zu=_t();ns.exports=zu("Array","includes")});var ss=h((Ff,os)=>{"use strict";var Wu=is();os.exports=Wu});var ct=h((_f,as)=>{"use strict";var Ku=ss();as.exports=Ku});var fs=h((Xf,ms)=>{"use strict";var Xu=Lr(),Yu=jr(),ds=Xu("keys");ms.exports=function(r){return ds[r]||(ds[r]=Yu(r))}});var ys=h((Yf,vs)=>{"use strict";var Zu=G();vs.exports=!Zu(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var gs=h((Zf,Cs)=>{"use strict";var Ju=ke(),ep=z(),tp=Qe(),rp=fs(),np=ys(),bs=rp("IE_PROTO"),rn=Object,ip=rn.prototype;Cs.exports=np?rn.getPrototypeOf:function(r){var e=tp(r);if(Ju(e,bs))return e[bs];var t=e.constructor;return ep(t)&&e instanceof t?t.prototype:e instanceof rn?ip:null}});var Is=h((Jf,Es)=>{"use strict";Es.exports={}});var Ss=h((ev,Ts)=>{"use strict";var op=X(),nn=ke(),sp=Ke(),ap=Jr().indexOf,lp=Is(),xs=op([].push);Ts.exports=function(r,e){var t=sp(r),n=0,i=[],o;for(o in t)!nn(lp,o)&&nn(t,o)&&xs(i,o);for(;e.length>n;)nn(t,o=e[n++])&&(~ap(i,o)||xs(i,o));return i}});var As=h((tv,ws)=>{"use strict";ws.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var ks=h((rv,Rs)=>{"use strict";var cp=Ss(),up=As();Rs.exports=Object.keys||function(e){return cp(e,up)}});var Ls=h((nv,Ns)=>{"use strict";var Ps=ve(),pp=G(),Vs=X(),hp=gs(),dp=ks(),mp=Ke(),fp=gr().f,Ms=Vs(fp),vp=Vs([].push),yp=Ps&&pp(function(){var r=Object.create(null);return r[2]=2,!Ms(r,2)}),Os=function(r){return function(e){for(var t=mp(e),n=dp(t),i=yp&&hp(t)===null,o=n.length,s=0,l=[],a;o>s;)a=n[s++],(!Ps||(i?a in t:Ms(t,a)))&&vp(l,r?[a,t[a]]:t[a]);return l}};Ns.exports={entries:Os(!0),values:Os(!1)}});var js=h(()=>{"use strict";var bp=Je(),Cp=Ls().values;bp({target:"Object",stat:!0},{values:function(e){return Cp(e)}})});var Fs=h((sv,$s)=>{"use strict";js();var gp=Mt();$s.exports=gp.Object.values});var Bs=h((av,_s)=>{"use strict";var Ep=Fs();_s.exports=Ep});var Xt=h((lv,qs)=>{"use strict";var Ip=Bs();qs.exports=Ip});var cn=h((Mv,Xs)=>{"use strict";var Tp=We();Xs.exports=Array.isArray||function(e){return Tp(e)==="Array"}});var Zs=h((Nv,Ys)=>{"use strict";var Sp=TypeError,wp=9007199254740991;Ys.exports=function(r){if(r>wp)throw Sp("Maximum allowed index exceeded");return r}});var ta=h((Lv,ea)=>{"use strict";var Ap=cn(),Rp=tt(),kp=Zs(),Op=qr(),Js=function(r,e,t,n,i,o,s,l){for(var a=i,c=0,f=s?Op(s,l):!1,v,y;c<n;)c in t&&(v=f?f(t[c],c,e):t[c],o>0&&Ap(v)?(y=Rp(v),a=Js(r,e,v,y,a,o-1)-1):(kp(a+1),r[a]=v),a++),c++;return a};ea.exports=Js});var ia=h((jv,na)=>{"use strict";var Pp=Xe(),Vp=Pp("toStringTag"),ra={};ra[Vp]="z";na.exports=String(ra)==="[object z]"});var sa=h(($v,oa)=>{"use strict";var Mp=ia(),Np=z(),Zt=We(),Lp=Xe(),jp=Lp("toStringTag"),$p=Object,Fp=Zt(function(){return arguments}())==="Arguments",_p=function(r,e){try{return r[e]}catch(t){}};oa.exports=Mp?Zt:function(r){var e,t,n;return r===void 0?"Undefined":r===null?"Null":typeof(t=_p(e=$p(r),jp))=="string"?t:Fp?Zt(e):(n=Zt(e))==="Object"&&Np(e.callee)?"Arguments":n}});var la=h((Fv,aa)=>{"use strict";var Bp=X(),qp=z(),un=jt(),Dp=Bp(Function.toString);qp(un.inspectSource)||(un.inspectSource=function(r){return Dp(r)});aa.exports=un.inspectSource});var ma=h((_v,da)=>{"use strict";var Hp=X(),Up=G(),ca=z(),Gp=sa(),zp=Nt(),Wp=la(),ua=function(){},pa=zp("Reflect","construct"),pn=/^\s*(?:class|function)\b/,Kp=Hp(pn.exec),Qp=!pn.test(ua),dt=function(e){if(!ca(e))return!1;try{return pa(ua,[],e),!0}catch(t){return!1}},ha=function(e){if(!ca(e))return!1;switch(Gp(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Qp||!!Kp(pn,Wp(e))}catch(t){return!0}};ha.sham=!0;da.exports=!pa||Up(function(){var r;return dt(dt.call)||!dt(Object)||!dt(function(){r=!0})||r})?ha:dt});var ba=h((Bv,ya)=>{"use strict";var fa=cn(),Xp=ma(),Yp=Re(),Zp=Xe(),Jp=Zp("species"),va=Array;ya.exports=function(r){var e;return fa(r)&&(e=r.constructor,Xp(e)&&(e===va||fa(e.prototype))?e=void 0:Yp(e)&&(e=e[Jp],e===null&&(e=void 0))),e===void 0?va:e}});var ga=h((qv,Ca)=>{"use strict";var eh=ba();Ca.exports=function(r,e){return new(eh(r))(e===0?0:e)}});var Ea=h(()=>{"use strict";var th=Je(),rh=ta(),nh=Qe(),ih=tt(),oh=et(),sh=ga();th({target:"Array",proto:!0},{flat:function(){var e=arguments.length?arguments[0]:void 0,t=nh(this),n=ih(t),i=sh(t,0);return i.length=rh(i,t,t,n,0,e===void 0?1:oh(e)),i}})});var Ia=h(()=>{"use strict";var ah=Ft();ah("flat")});var Ta=h((zv,xa)=>{"use strict";Ea();Ia();var lh=_t();xa.exports=lh("Array","flat")});var wa=h((Wv,Sa)=>{"use strict";var ch=Ta();Sa.exports=ch});var Ra=h((Kv,Aa)=>{"use strict";var uh=wa();Aa.exports=uh});var gh={};al(gh,{ContainerTypes:()=>E.ContainerTypes,ControlTypes:()=>E.ControlTypes,CustomError:()=>L,EVENT_NAMES:()=>P,EventActionTypes:()=>E.EventActionTypes,EventTypes:()=>E.EventTypes,Interactives:()=>ft,ManifestController:()=>Ce,SDKInfo:()=>Ch,chapterIdsToVKVideoIds:()=>er,compareVersions:()=>zt,containerTypes:()=>Au,controlTypes:()=>Ru,eventActionTypes:()=>Kr,eventTypes:()=>ku,getChapterIdByVkVideoId:()=>za,getVKVideoIdByMedia:()=>mn,getVideoRawIdByMedia:()=>Ua,graphEventTypes:()=>Le,hasEndTemplate:()=>ut,interactivesEventTypes:()=>j,isAreaControl:()=>wu,isButtonControl:()=>Su,isLastChapter:()=>Z,isOneTextCtrlContainer:()=>be,isSupportedManifest:()=>E.isSupportedManifest,isTextControl:()=>ot,isVKVariantItem:()=>Ga,isValidManifest:()=>Wr,migrateManifestToLatestVersion:()=>E.migrateManifestToLatestVersion,utils:()=>Ja,vkVideoIdsToChapterIds:()=>fn});module.exports=ll(gh);var Pn="1.0.35-beta.1";var kt=require("@vkontakte/videoplayer-shared/es2015");var sr=class{constructor(e){this.layout=e}},bt=class extends sr{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 Vn(r){return"features"in r}var Se=class{constructor(e,t){this.container=e,this.options=t,this.factories=new Map,this.controls=[],this.setControls()}featureIsEnabled(e){return this.options&&Vn(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(),o=this.factories.get(i);if(o){let s=o(n,this.options);if(s)return[...t,s]}return[...t]},[]))||[]}};var me=require("@vkontakte/videoplayer-shared/es2015");function Be(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 Mn="interactive",_={textColor:"#000",textSize:.4,textContent:"",roundCorners:0,borderWidth:0,borderWidthRawValue:"1px",roundCornersRawValue:"0",borderColor:"#000",borderAlpha:1,backgroundColor:"#fff",backgroundAlpha:1,innerSizesDependOn:"self",angle:0,shadowColorLight:"#fff",shadowColorDark:"#000",shadowColorAlpha:.24},Nn=(n=>(n.top="flex-start",n.bottom="flex-end",n.center="center",n))(Nn||{}),Ln=(n=>(n.start="flex-start",n.end="flex-end",n.center="center",n))(Ln||{}),jn=(n=>(n.start="left",n.end="right",n.center="center",n))(jn||{}),Ct=({target:r,props:e})=>{var t,n,i;r.style.alignItems=(t=(e==null?void 0:e.gravityVertical)&&Nn[e.gravityVertical])!=null?t:"center",r.style.justifyContent=(n=(e==null?void 0:e.gravityHorizontal)&&Ln[e.gravityHorizontal])!=null?n:"center",r.style.textAlign=(i=(e==null?void 0:e.alignment)&&jn[e.alignment])!=null?i:"center"},gt=({target:r,props:e,fallback:t,dependsOn:n})=>{var i,o,s,l,a,c;r.style.color=(o=(i=e==null?void 0:e.text)==null?void 0:i.color)!=null?o:t.textColor,r.style.fontSize=`calc(${n.height} * ${(l=(s=e==null?void 0:e.text)==null?void 0:s.size)!=null?l:t.textSize})`,r.textContent=(c=(a=e==null?void 0:e.text)==null?void 0:a.value)!=null?c:t.textContent},Et=({target:r,props:e,fallback:t})=>{var n,i,o,s;r.style.backgroundColor=Be((i=(n=e==null?void 0:e.background)==null?void 0:n.color)!=null?i:t.backgroundColor,(s=(o=e==null?void 0:e.background)==null?void 0:o.alpha)!=null?s:t.backgroundAlpha)},qe=({target:r,props:e,fallback:t,dependsOn:n,useRawValues:i=!1})=>{var l,a,c,f,v,y,g,R,I,m,u;let o=i?t.borderWidthRawValue:`calc(${n.height} * ${(c=(a=(l=e==null?void 0:e.shape)==null?void 0:l.border)==null?void 0:a.width)!=null?c:t.borderWidth})`,s=i?t.roundCornersRawValue:`calc(${n.height} * ${(v=(f=e==null?void 0:e.shape)==null?void 0:f.roundCorners)!=null?v:t.roundCorners})`;r.style.borderWidth=o,r.style.borderStyle="solid",r.style.borderColor=Be(i?t.borderColor:(R=(g=(y=e==null?void 0:e.shape)==null?void 0:y.border)==null?void 0:g.color)!=null?R:t.borderColor,i?t.borderAlpha:(u=(m=(I=e==null?void 0:e.shape)==null?void 0:I.border)==null?void 0:m.alpha)!=null?u:t.borderAlpha),r.style.borderRadius=s},$n=({target:r,isDark:e,baseDimension:t,fallback:n})=>{let s=Be(n.shadowColorLight,n.shadowColorAlpha),l=Be(n.shadowColorDark,n.shadowColorAlpha),a=`calc(${t} * ${.25})`,c=`calc(${t} * ${.11})`,f=`0px 0px ${a} ${c} ${e?l:s}`;r.style.boxShadow=f},we=({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 Ae=require("@vkontakte/videoplayer-shared/es2015");var ar="int",he=(n=>(n.AREA=`${ar}_area`,n.TEXT=`${ar}_text`,n.BUTTON=`${ar}_bttn`,n))(he||{});function Fn(r){return"features"in r}var te="interactive-control",M={common:te,selected:`${te}-selected`,wrapper:`${te}-wrapper`,disabled:`${te}-disabled`,button:`${te}-button`,area:`${te}-area`,text:`${te}-text`,blinkAnim:`${te}-blink-anim`,blinkAnimButton:`${te}-blink-anim-button`,blinkAnimArea:`${te}-blink-anim-area`};var L=class{constructor(e,t,...n){this.severity=e;this.category=t;this.data=n}toString(){return`Interactive SDK error ${JSON.stringify(this,null," ")}`}};var le=class{constructor(e,t){this.control=e;this.options=t;this.container=null;this.controlElement=null;this.subscriptions=new Ae.Subscription;this.error$=new Ae.Subject}createContainerElement(e){var i;let t=document.createElement("div");t.classList.add(M.wrapper),e.setControlLayout(t,this.control.layoutParams);let n=((i=this.control.layoutParams.innerSizesDependOn)!=null?i:_.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&&Fn(this.options)&&this.options.features[e]}setEvents(e){!this.container||!this.control.events||this.control.events.forEach(t=>{switch(t.type.trim().toLowerCase()){case"onclick":{if(!this.container)break;this.subscriptions.add((0,Ae.fromEvent)(this.container.element,"click").subscribe(this.createClickListener(()=>e({action:t.action,controlId:this.control.id,controlType:this.control.type})),i=>{let o=new L(1,1,{message:"Error happened on control interaction",error:i});this.error$.next(o)}));break}default:break}})}removeListeners(){this.subscriptions.unsubscribe()}};var ce=(r,e)=>Object.prototype.toString.call(r)===`[object ${e}]`,ue=r=>ce(r,"Object"),It=r=>ce(r,"String"),xt=r=>ce(r,"Array"),Tt=r=>ce(r,"Number"),_n=r=>ce(r,"Function"),Bn=r=>ce(r,"Boolean"),lr=r=>Tt(r)&&!isNaN(r);var de=r=>ue(r)&&Object.keys(r).length===0,cr=r=>xt(r)&&!r.length;var Ue=(r,e)=>It(r)&&(e?r.trim():r).length;var ur="interactive-blink-anim-reference",q={common:ur,animation:`${ur}-animation`,disabled:`${ur}-disabled`},St=class{constructor(){this._RAFId=0;this._element=void 0}get element(){return this._element}create(){if(this._element)return;let e=document.createElement("div");e.classList.add(q.common,q.animation),this._element=e}restart(){this._element&&(this._element.classList.add(q.disabled),this.cleanupRAF(),this._RAFId=requestAnimationFrame(()=>{this._element&&(this._element.classList.remove(q.disabled),this.cleanupRAF())}))}cleanupRAF(){this._RAFId&&(cancelAnimationFrame(this._RAFId),this._RAFId=0)}destroy(){this.cleanupRAF(),this._element=void 0}};var pr="interactive-container",D={common:pr,hidden:`${pr}-hidden`,disabled:`${pr}-disabled`};var wt=(r,e)=>{if(r.type.trim().toLowerCase()==="area")return new hr(r,e)},hr=class extends le{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(M.common,M.area),n.setAttribute("data-testid",he.AREA),Et({target:n,props:this.control.props,fallback:T(d({},_),{backgroundColor:"transparent"})}),we({target:n,layoutParams:this.control.layoutParams,fallback:_}),this.container.element.append(n),e.append(this.container.element),this.controlElement=n,this.updateShadowStyles(),this.registerEvents()}registerEvents(){var t;if(!this.featureIsEnabled("controlsExpectTimeBlinkAnimation"))return;let e=(t=this.container)==null?void 0:t.element.parentElement;!e||!this.controlElement||(this.subscriptions.add((0,me.fromEvent)(this.controlElement,"mouseleave").subscribe(()=>{if(e.classList.contains(D.disabled))return;let n=e.parentElement;if(n){let i=n.querySelector(`.${q.common}`);i&&this.syncBlinkAnimation(i)}},n=>this.onError("Error happened in mouseleave callback",n))),this.subscriptions.add((0,me.fromEvent)(this.controlElement,"mouseenter").subscribe(()=>{e.classList.contains(D.disabled)||this.onBlinkHovering()},n=>this.onError("Error happened in mouseenter callback",n))).add((0,me.fromEvent)(this.controlElement,"mouseleave").subscribe(()=>{this.controlElement&&(this.controlElement.style.animation="")},n=>this.onError("Error happened in mouseleave callback",n))))}disable(){this.controlElement&&this.controlElement.classList.add(M.disabled)}enable(){this.controlElement&&this.controlElement.classList.remove(M.disabled)}getElement(){return this.controlElement}updateShadowStyles(e){var t,n,i;if(!(!this.container||!this.controlElement))if(Bn(e)){let o=Math.min(this.controlElement.offsetWidth,this.controlElement.offsetHeight)+"px";$n({target:this.controlElement,props:this.control.props,fallback:_,isDark:e,baseDimension:o}),qe({target:this.controlElement,props:this.control.props,fallback:T(d({},_),{borderColor:e?_.shadowColorDark:_.shadowColorLight,borderAlpha:1,borderWidthRawValue:"0.1px",roundCornersRawValue:`calc(${this.container.dimensions.height} * ${(i=(n=(t=this.control.props)==null?void 0:t.shape)==null?void 0:n.roundCorners)!=null?i:_.roundCorners})`}),dependsOn:this.container.dimensions,useRawValues:!0})}else qe({target:this.controlElement,props:this.control.props,fallback:T(d({},_),{borderAlpha:0}),dependsOn:this.container.dimensions})}toggleBlinkAnimation(e){var t,n;(t=this.controlElement)==null||t.classList.toggle(M.blinkAnim,e),(n=this.controlElement)==null||n.classList.toggle(M.blinkAnimArea,e)}syncBlinkAnimation(e){this.controlElement&&(!this.controlElement.classList.contains(`${M.blinkAnimArea}`)||this.controlElement.classList.contains(M.selected)||this.controlElement.classList.contains(q.disabled)||(this.controlElement.classList.add(q.disabled),this.subscriptions.add((0,me.fromEvent)(e,"animationiteration").pipe((0,me.once)()).subscribe(()=>{this.controlElement&&this.controlElement.classList.remove(q.disabled)},t=>this.onError("Error happened in animationiteration callback",t)))))}onBlinkHovering(){if(!this.controlElement||!this.controlElement.classList.contains(`${M.blinkAnimArea}`)||this.controlElement.classList.contains(M.selected))return;let e=window.getComputedStyle(this.controlElement),t=e.getPropertyValue("--interactive-area-hover-opacity").trim();this.controlElement.style.opacity=e.opacity,this.controlElement.style.animation="none",requestAnimationFrame(()=>{this.controlElement&&(this.controlElement.style.opacity=t)})}onError(e="",t){let n=new L(1,1,{message:e,error:t,details:{id:this.control.id}});this.error$.next(n)}onProgress(){}onResize(){}};var fe=require("@vkontakte/videoplayer-shared/es2015");var At=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 Rt=(r,e)=>{if(r.type.trim().toLowerCase()==="button")return new dr(r,e)},dr=class extends le{constructor(e,t){super(e,t)}createView({parentElement:e,callbacks:t}){var s;if(super.createContainerElement(t),!this.container)return;let n=document.createElement("button");n.type="button",n.classList.add(M.common,M.button),n.setAttribute("data-testid",he.BUTTON),we({target:n,layoutParams:this.control.layoutParams,fallback:_}),Et({target:n,props:this.control.props,fallback:_}),qe({target:n,props:this.control.props,fallback:_,dependsOn:this.container.dimensions}),Ct({target:n,props:T(d({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let i=At(this.control.type.trim().toLowerCase()),o=(s=i.firstElementChild)!=null?s:i;gt({target:o,props:this.control.props,fallback:_,dependsOn:this.container.dimensions}),n.append(i),this.container.element.append(n),e.append(this.container.element),this.controlElement=n,this.registerEvents()}registerEvents(){var t;if(!this.featureIsEnabled("controlsExpectTimeBlinkAnimation"))return;let e=(t=this.container)==null?void 0:t.element.parentElement;!e||!this.controlElement||(this.subscriptions.add((0,fe.fromEvent)(this.controlElement,"mouseleave").subscribe(()=>{if(e.classList.contains(D.disabled))return;let n=e.parentElement;if(n){let i=n.querySelector(`.${q.common}`);i&&this.syncBlinkAnimation(i)}},n=>this.onError("Error happened in mouseleave callback",n))),this.subscriptions.add((0,fe.fromEvent)(this.controlElement,"mouseenter").subscribe(()=>{e.classList.contains(D.disabled)||this.onBlinkHovering()},n=>this.onError("Error happened in mouseenter callback",n))).add((0,fe.fromEvent)(this.controlElement,"mouseleave").subscribe(()=>{this.controlElement&&(this.controlElement.style.animation="")},n=>this.onError("Error happened in mouseleave callback",n))))}disable(){this.controlElement&&this.controlElement.classList.add(M.disabled)}enable(){this.controlElement&&this.controlElement.classList.remove(M.disabled)}getElement(){return this.controlElement}toggleBlinkAnimation(e){var t,n;(t=this.controlElement)==null||t.classList.toggle(M.blinkAnim,e),(n=this.controlElement)==null||n.classList.toggle(M.blinkAnimButton,e)}syncBlinkAnimation(e){this.controlElement&&(!this.controlElement.classList.contains(`${M.blinkAnimButton}`)||this.controlElement.classList.contains(M.selected)||this.controlElement.classList.contains(q.disabled)||(this.controlElement.classList.add(q.disabled),this.subscriptions.add((0,fe.fromEvent)(e,"animationiteration").pipe((0,fe.once)()).subscribe(()=>{this.controlElement&&this.controlElement.classList.remove(q.disabled)},t=>this.onError("Error happened in animationiteration callback",t)))))}onBlinkHovering(){if(!this.controlElement||!this.controlElement.classList.contains(`${M.blinkAnimButton}`)||this.controlElement.classList.contains(M.selected))return;let e=window.getComputedStyle(this.controlElement),t=e.getPropertyValue("--interactive-button-hover-opacity").trim();this.controlElement.style.opacity=e.opacity,this.controlElement.style.animation="none",requestAnimationFrame(()=>{this.controlElement&&(this.controlElement.style.opacity=t)})}onError(e="",t){let n=new L(1,1,{message:e,error:t,details:{id:this.control.id}});this.error$.next(n)}onProgress(){}onResize(){}updateShadowStyles(){}};var qn=(r,e)=>{if(r.type.trim().toLowerCase()==="text")return new mr(r,e)},mr=class extends le{constructor(e,t){super(e,t)}createView({parentElement:e,callbacks:t}){var s;if(super.createContainerElement(t),!this.container)return;let n=document.createElement("div");n.classList.add(M.common,M.text),n.setAttribute("data-testid",he.TEXT),we({target:n,layoutParams:this.control.layoutParams,fallback:_}),Ct({target:n,props:T(d({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let i=At(this.control.type.trim().toLowerCase()),o=(s=i.firstElementChild)!=null?s:i;gt({target:o,props:this.control.props,fallback:_,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(){}updateShadowStyles(){}toggleBlinkAnimation(){}onError(){}};var Ot=(r,e,t)=>{if(r.type.trim().toLowerCase()==="choice")return new fr(r,e,t)},fr=class extends Se{constructor(t,n,i){super(t,i);this.containerElement=null;this.controlSubscriptions=new kt.Subscription;this.error$=new kt.Subject;this.rootElement=n,this.layout=new bt(this.container.layout),this.isRemoved=!1,this.isDisabled=!1,this.addControlFactory("button",Rt),this.addControlFactory("text",qn),this.addControlFactory("area",wt)}createView({eventCallback:t}){let n=document.createElement("div");return n.classList.add(D.common,D.disabled),requestAnimationFrame(()=>{n.classList.remove(D.disabled)}),this.layout.setContainerLayout(n),this.controls.forEach(i=>{i.createView({parentElement:n,callbacks:{setControlLayout:this.layout.setControlLayout}}),i.setEvents(t),this.controlSubscriptions.add(i.error$.subscribe(this.error$))}),this.rootElement.append(n),this.isRemoved=!1,this.containerElement=n,n}hide(){let t=this.getElement();t&&t.classList.add(D.hidden)}show(){let t=this.getElement();t&&t.classList.remove(D.hidden)}enable(){let t=this.getElement();t&&(t.classList.remove(D.disabled),this.controls.forEach(n=>n.enable()),this.isDisabled=!1)}disable(){let t=this.getElement();t&&(t.classList.add(D.disabled),this.controls.forEach(n=>n.disable()),this.isDisabled=!0)}removeView(){let t=this.getElement();t&&(this.controlSubscriptions.unsubscribe(),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()})}updateControlsShadowStyles(t){this.controls.forEach(n=>n.updateShadowStyles(t))}toggleBlinkAnimation(t){this.controls.forEach(n=>n.toggleBlinkAnimation(t))}};var Ya=Q(zr(),1),w=require("@vkontakte/videoplayer-shared/es2015"),Fe=require("@vkontakte/videoplayer-statistics/es2015");var Ko=require("@vkontakte/videoplayer-shared/es2015");function rt(r,e){let t;return(...n)=>{clearTimeout(t),t=setTimeout(()=>r(...n),e)}}var Go="video_interactive",zo="videoint";var Wo=250,nt=class{constructor(e){this.handleZoomChange=rt(e=>{this.lastZoomInfo=e},Wo);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,void 0,{isFromCenter:!0})),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,!Tt(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:o=[]}){this.isReady=!1,this.isHidden=!0,this.manifest=null,this.visitedChapterIds=new Set(o),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=Tu(e),this.resizeObserver=new ResizeObserver(rt(this.onResize,Wo)),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 O(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 O(this,null,function*(){var n;if(!this.manifest)return;let e;try{e=yield(0,Ko.loadVKLangPack)(this.lang,Go,zo)}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:"view",lang:this.lang==="ru"?"ru":"en",translation:e}),this.currentManifestId=this.manifest.metadata.id,this.ngEditor.update(this.manifest),this.ngEditor.setVisitedChapters(Array.from(this.visitedChapterIds)),this.currentChapterId&&this.ngEditor.selectChapter(this.currentChapterId),this.ngEditor.on("control",s=>{var l=s,{name:i}=l,o=ee(l,["name"]);var a;i==="openPreview"&&"chapterId"in o&&((a=this.onOpenPreviewClick)==null||a.call(this,o.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 Tu(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 it=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 o of this._containers){let s=o.startTime-e;if(s<=i&&(o.endTime&&i<=o.endTime||o.endTime===null)){n=!0;break}i<s&&(t=t===-1?s:Math.min(t,s))}return!n&&t!==-1?t:null}}};var E=require("@interactiveplatform/movika-manifest");var Qo={metadata:"Object",chapters:"Array"},Wr=r=>{if(!ue(r))return!1;for(let e in Qo)if(!r[e]||!ce(r[e],Qo[e]))return!1;return(0,E.isSupportedManifest)(r.metadata.version)},ot=r=>r.type===E.ControlTypes.Text,Su=r=>r.type===E.ControlTypes.Button,wu=r=>r.type===E.ControlTypes.Area,Au={Choice:"Choice",TextInput:"TextInput"},Ru={Button:"Button",Area:"Area",Text:"Text"},ku={onClick:"onClick",onSuspense:"onSuspense"},Kr={openURI:"openURI",setNextBranch:"setNextBranch",setWeightlessRandomBranch:"setWeightlessRandomBranch",setRandomBranch:"setRandomBranch",setMaxWeightBranch:"setMaxWeightBranch",setMinWeightBranch:"setMinWeightBranch",setDefaultBranch:"setDefaultBranch",continuePlayback:"continuePlayback",expect:"expect"};var Bt=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 qt=class{constructor(e){this.fns=[];this.addFn=(e,t=!1)=>{_n(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=[]}};var hs=require("@vkontakte/videoplayer-shared/es2015");var Dt=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 O(this,null,function*(){return Ou(...this.loaders[e])(t)})}};function Ou(...r){return function(t){return O(this,null,function*(){let n=[...r];for(;n.length>0;)t=yield n.shift()(t);return t})}}function st(r,e,t){return r?T(d({},r),{[e]:r[e]?[t,...r[e]]:[t]}):{[e]:[t]}}function Ht(i){var o=i,{actions:r,errors:e,chapterId:t}=o,n=ee(o,["actions","errors","chapterId"]);if(t){let s=r.getManifest();if(s){let l=r.getChapter(s.chapters,t);if(l){let a=r.getMedia(s.media,l.videoId),c=r.getGraph(s.graph,l.id);return a?T(d({},n),{actions:r,errors:e,result:{chapter:l,media:a,graph:c}}):T(d({},n),{errors:st(e,Ht.name,"Could not find media"),actions:r})}}}return T(d({},n),{errors:st(e,Ht.name,"Could not find chapter"),actions:r})}var Ut=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,o=n.length;i<o;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,o=n.length;i<o;i++){let s=n[i];try{s.callback.call(this,e)}catch(l){Promise.resolve().then(()=>{throw l})}s.options&&s.options.once&&this.removeEventListener(e.type,s.callback)}return!e.defaultPrevented}},Me=class extends Ut{constructor(){super(),this.listeners||Ut.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)}},at=class{constructor(){Object.defineProperty(this,"signal",{value:new Me,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&&(at.prototype[Symbol.toStringTag]="AbortController",Me.prototype[Symbol.toStringTag]="AbortSignal");function Gt(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 Qr(r){typeof r=="function"&&(r={fetch:r});let{fetch:e,Request:t=e.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=r;if(!Gt({fetch:e,Request:t,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i}))return{fetch:e,Request:o};let o=t;(o&&!o.prototype.hasOwnProperty("signal")||i)&&(o=function(c,f){let v;f&&f.signal&&(v=f.signal,delete f.signal);let y=new t(c,f);return v&&Object.defineProperty(y,"signal",{writable:!1,enumerable:!1,configurable:!0,value:v}),y},o.prototype=t.prototype);let s=e;return{fetch:(a,c)=>{let f=o&&o.prototype.isPrototypeOf(a)?a.signal:c?c.signal:void 0;if(f){let v;try{v=new DOMException("Aborted","AbortError")}catch(g){v=new Error("Aborted"),v.name="AbortError"}if(f.aborted)return Promise.reject(v);let y=new Promise((g,R)=>{f.addEventListener("abort",()=>R(v),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([y,s(a,c)])}return s(a,c)},Request:o}}var lt=Gt({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Xo=lt?Qr({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,Xr=lt?Xo.fetch:window.fetch,If=lt?Xo.Request:window.Request,xf=lt?at:window.AbortController,Tf=lt?Me:window.AbortSignal;var zt=(r="",e="")=>{let t=r.split("."),n=e.split("."),i=0;for(let o=0;o<Math.max(t.length,n.length)&&!i;o++)t[o]>n[o]?i=1:t[o]<n[o]?i=-1:i=0;return i};var Pu=r=>O(void 0,null,function*(){try{let e={},t;if(It(r)){t=new URL(r).href;let i=yield Xr(t);if(!i.ok)return{};e=yield i.json()}else if(ue(r))e=r;else return{};if(!Wr(e))return{};let n=e.metadata.media;if(It(n)&&!("media"in e))try{let i;t?i=new URL(n,t).href:(i=new URL(n).href,t=i);let o=yield Xr(i);if(!o.ok)throw new Error;e.metadata.media=yield o.json()}catch(i){return Nu(e.metadata.version)?{manifest:e}:{}}return{manifest:e,manifestURL:t}}catch(e){return{}}});function Yo(r){return O(this,null,function*(){let{manifest:e,manifestURL:t}=yield Pu(r);if(!e)throw new Error("Failed on fetch");let n=(0,E.migrateManifestToLatestVersion)(e);return n.media=Vu(n.media,t),delete n.metadata.media,n})}function Wt(r,e){if(e)return r.find(t=>t.id===e)}function Yr(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 Zr(r,e){return r.videos.find(t=>t.id===e)}function Vu(r,e){return T(d({},r),{videos:r.videos.map(t=>T(d({},t),{variants:t.variants.map(n=>{let i="url"in n?n.url:"",o=Mu(i,e);return T(d({},n),{url:o||i})})}))})}function Mu(r="",e){try{return new URL(r,e).href}catch(t){return""}}function Nu(r){return zt(r,"3.2.0")>=0}var ls=Q(ct(),1);var Kt=r=>xt(r)&&!cr(r),Z=r=>r.order==="end",ut=r=>xt(r.containers)&&!cr(r.containers)&&Z(r),cs=(r,e)=>{var n;let t=r*1e3;return Kt(e.controls)&&t<((n=e.startTime)!=null?n:0)},en=(r,e)=>{var n,i;let t=r*1e3;return Kt(e.controls)&&t>=((n=e.startTime)!=null?n:0)&&t<=((i=e.endTime)!=null?i:1/0)};var ye=(r=[])=>r.some(e=>e.action.type==="expect"),tn=(r=[])=>r.find(e=>e.action.type==="expect"),Qu=r=>(r==null?void 0:r.length)===1,be=r=>Qu(r)&&ot(r[0]);function us(r=[],e=1/0,t=[]){return r.filter(({container:n})=>!(0,ls.default)(t,n.container.id)&&ye(n.container.events)&&n.container.endTime===e&&!n.isRemoved)}function Qt({gameControllers:r=[],subjectName:e,subjectId:t,execFn:n}){for(let i of r)if(e==="container"&&i.container.container.id===t){n(i),us(r,i.container.container.endTime,[i.container.container.id]).forEach(s=>{n(s)});break}}var ps=(r,e)=>{let t=I=>{let m=e.find(({container:u})=>u.container.id===I);return m==null?void 0:m.container.isRemoved},n=ye(r.events)&&!t(r.id),i=(I,m=!1,u=!1)=>{let p=u?"every":"some";return I.controls[p](b=>{var A;let x=m?I.endTime===r.endTime:!0;return((A=b.events)==null?void 0:A[p](C=>{var S;return((S=C.action)==null?void 0:S.type)===Kr.openURI}))&&x})},o=I=>I.some(({container:m})=>i(m.container,!0,!1)&&!m.isRemoved),s=I=>I.every(({container:m})=>m.isRemoved?!0:i(m.container,!0,!0)),l=us(e,r.endTime,[r.id]).length,a=I=>I.controls.some(m=>{var u;return(u=m.events)==null?void 0:u.some(p=>{var b,x;return(x=(b=p.action)==null?void 0:b.args)==null?void 0:x.shouldOpenNow})}),c=n||l>0,f=o(e),v=i(r),y=s(e),g=n?!1:l>0,R=a(r);return{isExpectTime:c,hasOtherExpect:l>0,hasOpenURIEvent:f,hasOpenURIEventInCurrentContainer:v,isAllOpenURIEventsValid:y,isExpectEventForCurrentContainer:g,hasShouldOpenNowEvent:R}};var Ce=class extends Dt{constructor(t,n){super(t);this.manifest=null;this.chapter=null;this.media=null;this.graph=null;this.prevChapter$=new hs.ValueSubject(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 O(this,null,function*(){var i;this.release();let n=yield this.exec("manifestLoaders",{actions:{addErrorMessage:st},result:null,errors:null,source:t});return n.errors&&this.errorHandler(n.errors),this.manifest=yield Yo((i=n.result)!=null?i:t),this})}setInitial(){return O(this,null,function*(){return this.setNext()})}setNext(){return O(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",Ht({actions:{getManifest:()=>this.manifest,getCurrent:this.getCurrent,getGraph:Yr,getChapter:Wt,getMedia:Zr,getByBranches:this.getByBranches.bind(this),addErrorMessage:st},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=Wt(this.manifest.chapters,t);if(i){let o=Zr(this.manifest.media,i.videoId),s=Yr(this.manifest.graph,i.id);if(o)return{chapter:i,media:o,graph:s}}return null}getBranches(t=(n=>(n=this.chapter)==null?void 0:n.id)()){var i,o,s;if(t===((i=this.chapter)==null?void 0:i.id))return this.getByBranches((o=this.chapter)==null?void 0:o.branches);{let l=Wt(((s=this.manifest)==null?void 0:s.chapters)||[],t);return this.getByBranches(l==null?void 0:l.branches)}}getByBranches(t=[]){return t.reduce((n,i)=>{let o=this.getByChapterId(i.chapterId);return o&&n.push(o),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?Z(this.chapter):!1}};var Us=Q(Xt(),1),Gs=require("@vkontakte/videoplayer-core/es2015"),pe=require("@vkontakte/videoplayer-shared/es2015");var Ds=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 Hs=Q(Xt(),1);function on(){let r=new Map;function e(a){var c=a,{listId:o=Math.random().toString(),itemId:s=Math.random().toString()}=c,l=ee(c,["listId","itemId"]);let f=r.get(o),v=d({},l);return f?f[s]=v:r.set(o,{[s]:v}),d({listId:o,itemId:s},l)}function t(o){var s,l;o.player.destroy(),o.container.remove(),o.subscription.unsubscribe(),(s=o.statistics)==null||s.oneStat.destroy(),(l=o.statistics)==null||l.statSubscription.unsubscribe()}function n(o,s){let l=r.get(o);if(!l)throw Error("Can't remove. Not find.");if(s){let a=l[s];a&&t(a),delete l[s],Object.keys(l).length||r.delete(o)}else{for(let a of(0,Hs.default)(l))t(a);r.delete(o)}}function i(){for(let o of r)n(o[0])}return{createPlayer:e,removePlayer:n,map:r,removeAll:i}}var Ne=Q(ct(),1);function sn(r,e=[]){var o,s,l;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,Ne.default)(e,"mp4"))&&(t.MPEG=T(d({},t.MPEG),{[(o=a.standard)!=null?o:"Invariant quality"]:a.url}));break;case"mpeg":(i||(0,Ne.default)(e,"mpeg"))&&(t.MPEG=T(d({},t.MPEG),{[(s=a.standard)!=null?s:"Invariant quality"]:a.url}));break;case"hls":(i||(0,Ne.default)(e,"hls"))&&(t=T(d({},t),{HLS:{type:"url",url:a.url}}));break;case"dash":(i||(0,Ne.default)(e,"dash"))&&(t=T(d({},t),{DASH_SEP:{compatibilityMode:!0,type:"url",url:a.url}}));break;default:break}return{sources:t,thumbUrl:n,title:(l=r.title)!=null?l:""}}var pt=(r,e)=>{let t=r.info.currentQuality$.getValue(),n=r.info.availableQualities$.getValue();t!==e&&(0,Ne.default)(n,e)&&(r.setQuality(e),r.setAutoQuality(!1))};var xp=2;function an(r){let e=on(),t=new pe.Subscription,n={},i=null,o=!1,s,l=new pe.ValueSubject(null);r&&a(r);function a(m){i=m}function c(m,u,p){var A;if(!i)throw Error("need to set interactive controller");if(!i.options)return;let x=((A=e.map.get(m))!=null?A:{})[u];if(x){n=d({chapterId:p,listId:m,itemId:u},x);let C=n.player;n.subscription.add(C.info.currentQuality$.subscribe(S=>{let H=C.info.position$.getValue(),V=C.info.isAutoQualityEnabled$.getValue();if(!(!S||!H||V))for(let $ of e.map)(0,Us.default)($[1]).forEach(({player:N})=>{pt(N,S)})})).add(C.events.started$.subscribe(()=>{f(u)})),x.container.remove(),i.setPlayer(x.player),o||(i.init(),o=!0),l.next({player:n.player,config:n.config,statistics:n.statistics});return}throw Error("Can't set. Not find.")}function f(m){return O(this,null,function*(){if(!i)throw Error("need to set interactive controller");if(de(n)||m!==n.itemId)return;let u=i.getChapterBranches(),p=new Set;for(let b of u)p.has(b.media.id)||(yield y({media:b.media,chapterId:b.chapter.id,setAsActive:!1,title:b.chapter.label}),p.add(b.media.id))})}function v(p){return O(this,arguments,function*({chapter:{id:m},manifestVideo:u}){if(de(n)||!i)return;let b=n.player.info.muted$.getValue(),x=n.player.info.currentQuality$.getValue(),A=n.player.info.isAutoQualityEnabled$.getValue(),C=n.player.info.volume$.getValue(),S=n.player.info.currentPlaybackRate$.getValue(),H=!A,V=!1;for(let $ of e.map)if($[0]===u.id&&!i.state.isReplay$.getValue()){let N=Object.keys($[1]);for(let B of N)B===n.itemId?(N.length<xp||(V=!0),e.removePlayer($[0],B)):(V=!0,c($[0],B,m),H?pt(n.player,x):n.player.setAutoQuality(!0),n.player.setVolume(C),n.player.setMuted(b),n.player.setPlaybackRate(S))}else e.removePlayer($[0]);V||(yield y({media:u,chapterId:m,setAsActive:!0,playbackRate:S}),H?pt(n.player,x):n.player.setAutoQuality(!0),n.player.setVolume(C),n.player.setMuted(b))})}function y(H){return O(this,arguments,function*({media:m,chapterId:u,prefetch:p=!0,setAsActive:b=!0,autoplay:x=!1,preferredExt:A,title:C,playbackRate:S}){var Cn,gn,En,In,xn;let V=Math.random().toString(),$=document.createElement("div");s.append($);let N;if((Cn=i==null?void 0:i.options)!=null&&Cn.vkVideoLoader){let vt=Ds(m);vt.length&&(N=yield i.options.vkVideoLoader(...vt))}let B=((gn=i==null?void 0:i.options)==null?void 0:gn.coreConfig)||void 0,xe=T(d({},B),{configName:[...(En=B==null?void 0:B.configName)!=null?En:[],"interactive"]}),ie=T(d({container:$},((In=N==null?void 0:N.videos)==null?void 0:In[0])||{sources:sn(m,A).sources}),{title:C,failoverHosts:(N==null?void 0:N.failoverHosts)||[]}),J=new Gs.Player(xe,pe.Tracer.createRootTracer());J.initVideo(ie);let yn=null;if(N!=null&&N.videos&&(i!=null&&i.options.createOneStat)){let vt=N.videos[0],ir=i.options.createOneStat(vt),Tn=new pe.Subscription;ir&&(Tn.add(ir.attachTo(J)),yn={oneStat:ir,statSubscription:Tn})}let bn=new pe.Subscription,el=(xn=n==null?void 0:n.player)==null?void 0:xn.info.isAutoQualityEnabled$.getValue();bn.add(J.events.canplay$.subscribe(function(){el||pt(J,n.player.info.currentQuality$.getValue()),S&&J.setPlaybackRate(S)}));let Te=e.createPlayer({listId:m.id,itemId:V,player:J,container:$,sources:sn(m,A).sources,config:ie,subscription:bn,statistics:yn});return b&&c(m.id,Te.itemId,u),x&&Te.player.play(),p&&!x&&Te.player.prepare(),{player:Te.player,config:Te.config,statistics:Te.statistics}})}function g(){R(),i=null,s.remove()}function R(){t.unsubscribe(),e.removeAll(),n={},o=!1}function I(){return O(this,null,function*(){if(!i)throw Error("need to set interactive controller");R(),s=document.createElement("div");let{media:m,chapter:u}=i.getCurrentChapter();m&&u?(t.add(i.events.chapterChanged$.subscribe(v)),yield y({media:m,chapterId:u.id,title:u.label})):console.error("not found")})}return T(d({},e),{init:I,setInteractiveController:a,createPlayer:y,removeAll:g,getActivePlayer:function(){return n},activePlayerChanged:l})}var P={graph:"graph",interactives:"interactives",chapterChanged:"chapter-changed",playerChanged:"player-changed",manifestChanged:"manifest-changed",errors:"errors",eachTick:"eachTick",historyInited:"history-inited",historyDestroyed:"history-destroyed"},Le={visibility:"visibility",watchAgainClicked:"watchAgainClicked"},j={actionChoiceCanceled:"action-choice-canceled",actionChoice:"action-choice",actionExecution:"action-execution",visibility:"visibility",containerRemoved:"container-removed",rangeEnded:"range-ended"};var Ws=Q(ct(),1),Ks=require("@vkontakte/videoplayer-shared/es2015");function ln(r){return function(...t){return r(...t.reverse())}}function ht(r,...e){return(...t)=>ue(e[0])&&ue(t[0])?r(d(d({},e[0]),t[0])):r(...e,...t)}var Yt=class{constructor({player:e,container:t,branches:n,selectBranches:i,interactiveEvents:o,globalEvents:s,globalEventEmitter:l,getContainerEventState:a,permanentTextControls:c,interactiveTimeOpenUri:f,disabledControls$:v,onRemove:y,onError:g}){this.hide=()=>{setTimeout(()=>{var e,t;this.gameState!==4&&(ye(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,o;if(this.gameState!==2||this.isSelectedControlEvent)return;if(this.container.getElement()){let{hasOpenURIEventInCurrentContainer:s}=this.getContainerEventState();if((n=(t=this.container).show)==null||n.call(t),this.interactiveTimeOpenUri&&s)return;this.emitContainerVisibilityEvent(!0,!1)}else{let s={isDisabled:()=>this.container.isDisabled,branches:this.branches,containerId:this.container.container.id,onDetachContainer:()=>{this.removeView(),this.emitContainerVisibilityEvent(!1)},onEvent:(a,c)=>{let{isExpectTime:f,hasOtherExpect:v,hasOpenURIEvent:y,hasOpenURIEventInCurrentContainer:g,isAllOpenURIEventsValid:R,hasShouldOpenNowEvent:I}=this.getContainerEventState(),m=this.interactiveTimeOpenUri&&!g,u=this.interactiveTimeOpenUri&&g;if((!this.interactiveTimeOpenUri||m)&&(this.isSelectedControlEvent=!0),a!==!1){if(!this.selectBranches.state.isExpect&&(!this.interactiveTimeOpenUri||m)){if(this.interactiveTimeOpenUri){let p=!v&&!R&&g;p&&this.globalEvents.interactiveContainerFakeRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-fake-removed",removeAllOpenURI:p})}this.removeView()}this.emitContainerVisibilityEvent(!1)}if(this.gameState===4||this.gameState===3||this.selectBranches.state.isExpect||this.interactiveTimeOpenUri&&y&&this.gameState!==5){if(u){let b=((x,A,C,S)=>!x&&!A&&C||x&&!A&&C&&!S||x&&!A&&C&&S)(f,v,R,this.isSelectedContainerEvent);this.fakeRemoveView(b)}else this.removeView(),this.emitContainerVisibilityEvent(!1);(!f||!v||!I)&&(this.selectBranches.stopExpect(),c())}},isEOV:()=>this.gameState===4},l=ht(this.selectBranches.onControlEvent,s);this.container.createView({eventCallback:l}),this.emitContainerVisibilityEvent(!0,!0),this.disabledControls$.getValue()&&((o=(i=this.container).disable)==null||o.call(i))}};this.onEndOfVideo=()=>{this.gameState=4,this.selectContainerEvent(!0)};this.whilePlaying=()=>{var c,f,v;let e=this.player.experimental.element$.getValue(),n=e instanceof HTMLVideoElement?e.readyState:void 0,i=[6,5];if(!n||(0,Ws.default)(i,this.gameState)&&!this.isPermanentText)return;let o=this.player.getExactTime();if(cs(o,this.container.container))this.gameState!==1&&(this.gameState=1,this.onBeforeStartTime());else if(en(o,this.container.container))this.gameState!==2&&(this.gameState=2,this.onStartTime());else if(this.gameState!==3){let y=this.gameState;this.gameState=3,y===2&&this.onEndTime()}else{let{hasOpenURIEventInCurrentContainer:y}=this.getContainerEventState(),g=this.selectBranches.state.isExpect,R=this.interactiveTimeOpenUri&&y;if(R&&!g){let I=this.container.getElement();I&&(I.style.visibility!=="hidden"&&((f=(c=this.container).hide)==null||f.call(c)),this.container.isRemoved||this.fakeRemoveView())}!this.isPermanentText&&!R&&this.removeView()}let s=en(o,this.container.container),l=this.container.container.startTime?[this.container.container.startTime,(v=this.container.container.endTime)!=null?v:1/0]:[],a={subjectId:this.container.container.id,subjectName:"container",range:l,currentTime:o,isInteractiveTime:s};this.container.onProgress(o*1e3,s),this.globalEventEmitter.emit(P.eachTick,a),this.globalEvents.eachTick$.next(a)};this.container=t,this.branches=n,this.selectBranches=i,this.subscription=new Ks.Subscription,this.player=e,this.interactiveEvents=o,this.getContainerEventState=a,this.isPermanentText=c&&be(t.container.controls),this.interactiveTimeOpenUri=f,this.disabledControls$=v,this.onRemove=y,this.globalEventEmitter=l,this.gameState=0,this.globalEvents=s,this.onError=g,this.isSelectedControlEvent=!1,this.isSelectedContainerEvent=!1,this.registerEvents()}emitContainerVisibilityEvent(e,t=!1){e?(this.globalEventEmitter.emit(P.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.visibility,visibility:e,isFirst:t}),this.globalEvents.interactiveVisibilityChanged$.next({subjectId:this.container.container.id,subjectName:"container",type:"visibility",visibility:e,isFirst:t})):(this.globalEventEmitter.emit(P.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.visibility,visibility:!1}),this.globalEvents.interactiveVisibilityChanged$.next({subjectId:this.container.container.id,subjectName:"container",type:"visibility",visibility:e}))}registerEvents(){this.subscription.add(this.player.events.playing$.subscribe(this.show)).add(this.player.events.paused$.subscribe(this.hide)).add(this.player.events.ended$.subscribe(this.onEndOfVideo)).add(this.disabledControls$.subscribe(e=>{var t,n,i,o;e?(n=(t=this.container).disable)==null||n.call(t):(o=(i=this.container).enable)==null||o.call(i)})),this.subscription.add(this.container.error$.subscribe(this.onError))}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:ye(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(P.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.containerRemoved,visibility:!1}),this.globalEvents.interactiveContainerRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-removed"}),this.gameState=5,(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()}updateControlsShadowStyles(e){this.container.updateControlsShadowStyles(e)}toggleBlinkAnimation(e){this.container.toggleBlinkAnimation(e)}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 Qs=(r=[])=>r.reduce((e,t,n)=>{var o,s,l;let i=((o=t==null?void 0:t.controls)!=null?o:[]).filter(a=>!ot(a));if(Kt(i)){let a=[(s=t.startTime)!=null?s:0,(l=t.endTime)!=null?l:1/0],c={id:t.id,isRemoved:!1};if(!n)e.push({subjects:[c],range:a});else{let f=[],v=-1/0,y=1/0,g=[],R=[];for(let I=0;I<e.length;I++){let m=e[I];if(R.push(...m.subjects),m.range[0]<y&&(y=m.range[0]),m.range[1]>v&&(v=m.range[1]),a[0]>=m.range[0]&&a[1]<=m.range[1])return e[I].subjects.push(c),e;a[0]<m.range[0]&&a[1]>m.range[0]&&(f.push(I),g=g.concat(m.subjects)),a[0]>=m.range[0]&&a[0]<=m.range[1]&&(f.push(I),g=g.concat(m.subjects),a[0]=m.range[0]),a[1]>=m.range[0]&&a[1]<=m.range[1]&&(f.push(I),g=g.concat(m.subjects),a[1]=m.range[1])}if(R.push(c),a[0]<=y&&a[1]>=v)return[{subjects:R,range:a}];f.length&&f.reverse().forEach(I=>{e.splice(I,1)}),e.push({subjects:g.concat([c]),range:a})}}return e},[]).sort((e,t)=>e.range[0]-t.range[0]);var Oa=Q(ct(),1),hn=Q(Xt(),1),Pa=Q(Ra(),1);function ka(){let r={};function e(){for(let l in r)Object.prototype.hasOwnProperty.call(r,l)&&delete r[l]}function t(l){let a={};for(let c in r)+c<=l&&(a[c]=r[c]);return a}function n(l){let a={};for(let c in r)+c>=l&&(a[c]=r[c]);return a}function i({timestamp:l,priority:a,initiator:c}){var f;if(lr(l)){let v=(f=r[l])!=null?f:null;if(v&&a&&Ue(a,!0)){let y={},g=v[a];if(g&&(y=d(d({},y),g)),y=de(y)?null:y,y&&Ue(c,!0)){let R=y[c];return R!=null?R:null}return y}return v}return null}function o({timestamp:l,priority:a,initiator:c}){if(lr(l))if(r[l]){if(a&&Ue(a,!0))if(r[l][a]){if(c&&Ue(c,!0))if(r[l][a][c]){if(delete r[l][a][c],!de(r[l][a]))return!0}else return!1;if(delete r[l][a],!de(r[l]))return!0}else return!1;return delete r[l]}else return!1;return!1}function s(v){var y=v,{timestamp:l,priority:a,initiator:c}=y,f=ee(y,["timestamp","priority","initiator"]);var g,R,I;(R=(g=r[l])==null?void 0:g[a])!=null&&R[c]?r[l][a][c].push(d({},f)):(I=r[l])!=null&&I[a]?r[l][a]=T(d({},r[l][a]),{[c]:[d({},f)]}):r[l]?r[l]=T(d({},r[l]),{[a]:{[c]:[d({},f)]}}):r[l]={[a]:{[c]:[d({},f)]}}}return{map:r,remove:o,add:s,removeAll:e,get:i,getLte:t,getGte:n}}var ph=[E.EventActionTypes.expect,E.EventActionTypes.setNextBranch],hh=1/0;function Va(r,e){let t=r,n,i=dh(e),o=ka(),s,l=()=>{g(),u()},a=p=>{o.add.call(void 0,p),R()},c=(p=[])=>{for(let b of p)if(b.action(),(0,Oa.default)(ph,b.actionType))break},f=(p=1/0)=>{var C,S,H;let b=Jt((C=o.get({timestamp:p,priority:"control"}))!=null?C:{}),x=Jt((S=o.get({timestamp:p,priority:"container"}))!=null?S:{}),A=Jt((H=o.get({timestamp:p,priority:"chapter"}))!=null?H:{});return[...b,...x,...A]},v=p=>{i.isReady(p)&&c(f(p))},y=()=>{var p;c([...Jt((p=o.get({timestamp:1/0,priority:"chapter"}))!=null?p:{})])},g=()=>{n&&(s==null||s.unsubscribe(),n=void 0)},R=()=>{n||(n=()=>setTimeout(()=>{v(1/0)}),s=t.events.ended$.subscribe(n))},I=p=>{g(),t=p},m=p=>{p.priority==="container"&&i.resetCalled(p.timestamp),o.remove(p)},u=()=>{i.release(),o.removeAll()};return{setPlayer:I,add:a,remove:m,exec:v,execEndOfVideo:y,listen:R,unlisten:g,release:l,containersEventsCallState:i,getPreparedToExecActions:f}}function dh(r){let e=new Map;return{setCalled:({timestamp:l,id:a})=>{let c=e.get(l);c&&c[a]!==void 0&&(c[a]=!0)},setData:(l=[])=>{var a;for(let c of l){let f=(a=c.endTime)!=null?a:hh,v=e.get(f);e.set(f,T(d({},v),{[c.id]:!1}))}},resetCalled:l=>{let a=e.get(l);if(a)for(let c in a)a[c]=!1},isReady:l=>{let a=e.get(l);if(!a)return!0;let c=(0,hn.default)(a);return r?c.some(v=>v):!c.some(v=>!v)},release:()=>e.clear()}}function Jt(r){return(0,Pa.default)((0,hn.default)(r)).sort(e=>e.actionType===E.EventActionTypes.expect?-1:1)}var Ma={videoContentHeight:0,videoContentWidth:0},Na=r=>{let{height:e,width:t}=r.info.intrinsicVideoSize$.getValue()||{};if(!(e&&t))return Ma;let{clientHeight:n,clientWidth:i}=r.experimental.element$.getValue()||{};if(!(n&&i))return Ma;let o=e/t,s=n/i,l,a;return s>o?(a=i,l=i*o):s<o?(a=n/o,l=n):(a=i,l=n),{videoContentWidth:a,videoContentHeight:l}};var mh=250;function La(r){let e,t=new ResizeObserver(l=>{o(l),e=o.bind(null,l)});function n(l){let{parentElement:a,player:c}=r();if(a&&c){let{videoContentWidth:f,videoContentHeight:v}=Na(c);a.style.setProperty("--interactive-content-width",`${f}px`),a.style.setProperty("--interactive-content-height",`${v}px`),a.style.setProperty("--interactive-width",`${l[0].contentRect.width}px`),a.style.setProperty("--interactive-height",`${l[0].contentRect.height}px`)}}function i(){let{parentElement:l}=r();l.removeAttribute("style")}let o=rt(l=>{let{fns:a=[]}=r();n(l);for(let c of a)c()},mh);function s(){e=void 0,t.disconnect(),i()}return{resizeObserver:t,calc:()=>{e==null||e()},release:s}}var fh=r=>Math.floor(Math.random()*r),$a=r=>{var i;let e=r.length,t=1/0,n=null;for(;e--;){let o=r[e],s=(i=o.weight)!=null?i:1;s<t&&(t=s,n=o)}return n},Fa=r=>{var i;let e=r.length,t=-1/0,n=null;for(;e--;){let o=r[e],s=(i=o.weight)!=null?i:0;s>t&&(t=s,n=o)}return n};var _a=r=>{let e=r.length,t=fh(e);return r[t]},ja=1,Ba=r=>{var n,i;let e=0;for(let o=0;o<r.length;++o)e+=(n=r[o].weight)!=null?n:ja;let t=Math.random()*e;e=0;for(let o=0;o<r.length-1;++o)if(e+=(i=r[o].weight)!=null?i:ja,e>=t)return r[o];return r[r.length-1]};var qa={shouldOpenNow:!0,isDetachContainer:!0},Da="after-expect",dn=(r,e=!1)=>T(d({},r),{args:e?d(d({},r.args),qa):d(d({},qa),r.args)}),Ha=({globalEventEmitter:r,globalEvents:e,player:t,interactiveEvents:n})=>{let i={isExpect:!1},o=()=>{i.isExpect&&(i.isExpect=!1)},s=({action:u,controlType:p,controlId:b,containerId:x,branches:A=[],onEvent:C,isEOV:S=()=>!1,isDisabled:H=()=>!1})=>{let V=dn(u,S()),$={timestamp:1/0,priority:"control",initiator:b,actionType:V.type},N=H(),B=r.emit.bind(r,P.interactives,{subjectId:b,subjectType:p,subjectName:"control",type:N?j.actionChoiceCanceled:j.actionChoice,actionType:u.type,payload:d({invokeImmediately:V.args.shouldOpenNow,containerId:x},V.args)}),xe=()=>{e.interactiveActionChoice$.next({subjectId:b,subjectType:p,subjectName:"control",type:N?"action-choice-canceled":"action-choice",actionType:u.type,payload:d({invokeImmediately:V.args.shouldOpenNow,containerId:x},V.args)})};if(N){B(),xe();return}switch(V.type.trim().toLowerCase()){case E.EventActionTypes.setNextBranch.trim().toLowerCase():{let ie=A.find(J=>J.id===V.args.branchId);if(!ie)return;C(V.args.isDetachContainer,g.bind(null,{subjectId:b,subjectName:"control"})),B(),xe(),V.args.shouldOpenNow?I({subjectId:b,subjectName:"control",subjectType:p,action:V,payload:{chapterId:ie.chapterId,autoSelect:!1}}):n.add(T(d({},$),{action:I.bind(null,{subjectId:b,subjectName:"control",subjectType:p,action:V,payload:{chapterId:ie.chapterId,autoSelect:!1}})}));return}case E.EventActionTypes.continuePlayback.trim().toLowerCase():{C(V.args.isDetachContainer,g.bind(null,{subjectId:b,subjectName:"control"})),B(),xe(),V.args.shouldOpenNow?R({subjectId:b,subjectName:"control",subjectType:p,action:u}):n.add(T(d({},$),{action:R.bind(null,{subjectId:b,subjectName:"control",subjectType:p,action:u})}));return}case E.EventActionTypes.openURI.trim().toLowerCase():{C(V.args.isDetachContainer,g.bind(null,{subjectId:b,subjectName:"control"})),B(),xe(),V.args.shouldOpenNow?m({subjectId:b,subjectName:"control",subjectType:p,action:V,payload:{URI:u.args.uri}}):n.add(T(d({},$),{action:m.bind(null,{subjectId:b,subjectName:"control",subjectType:p,action:V,payload:{URI:u.args.uri}})}));return}default:{let ie="Unexpected control event",J=new L(1,1,{message:ie});f(J,ie);return}}},l=({action:u,container:{id:p,endTime:b},branches:x=[],isEOV:A=!1,autoSelected:C=!1})=>{let S=dn(u,A),H={timestamp:!S.args.shouldOpenNow||A?1/0:b!=null?b:1/0,priority:"container",initiator:p,actionType:S.type},V=r.emit.bind(r,P.interactives,{subjectId:p,subjectName:"container",type:j.actionChoice,actionType:S.type,payload:d({invokeImmediately:S.args.shouldOpenNow},S.args)}),$=()=>{e.interactiveActionChoice$.next({subjectId:p,subjectName:"container",type:"action-choice",actionType:S.type,payload:d({invokeImmediately:S.args.shouldOpenNow},S.args)})};switch(S.type.trim().toLowerCase()){case E.EventActionTypes.setNextBranch.trim().toLowerCase():{let N=x.find(B=>B.id===S.args.branchId);if(!N)return;V(),$(),n.add(T(d({},H),{action:I.bind(null,{subjectId:p,subjectName:"container",action:S,payload:{chapterId:N.chapterId,autoSelect:C}})}));return}case E.EventActionTypes.setMaxWeightBranch.trim().toLowerCase():return;case E.EventActionTypes.setMinWeightBranch.trim().toLowerCase():return;case E.EventActionTypes.setRandomBranch.trim().toLowerCase():return;case E.EventActionTypes.setWeightlessRandomBranch.trim().toLowerCase():return;case E.EventActionTypes.continuePlayback.trim().toLowerCase():{V(),$(),n.add(T(d({},H),{action:R.bind(null,{subjectId:p,subjectName:"container",action:S})}));return}case E.EventActionTypes.openURI.trim().toLowerCase():{V(),$(),n.add(T(d({},H),{action:m.bind(null,{subjectId:p,subjectName:"container",action:S,payload:{URI:u.args.uri}})}));return}default:{let N="Unexpected container event",B=new L(1,1,{message:N});f(B,N);return}}};function a({container:u,branches:p,isEOV:b=!1}){var A,C;let x=tn(u.events);if(x){let S=dn(x.action,b);r.emit(P.interactives,{subjectId:u.id,subjectName:"container",type:j.actionChoice,actionType:S.type,payload:d({invokeImmediately:S.args.shouldOpenNow},S.args)}),e.interactiveActionChoice$.next({subjectId:u.id,subjectName:"container",type:"action-choice",actionType:S.type,payload:d({invokeImmediately:S.args.shouldOpenNow},S.args)}),n.add({timestamp:b?1/0:(A=u.endTime)!=null?A:1/0,priority:"container",initiator:u.id,actionType:E.EventActionTypes.expect,action:y.bind(null,{subjectId:u.id,subjectName:"container"})}),i.isExpect=!0}else for(let S of(C=u.events)!=null?C:[])l({action:S.action,container:u,branches:p,isEOV:b})}let c=({chapterId:u,action:p,branches:b=[]})=>{let x=r.emit.bind(r,P.interactives,{subjectId:u,subjectName:"chapter",type:j.actionChoice,actionType:p.type,payload:p.args}),A=()=>{e.interactiveActionChoice$.next({subjectId:u,subjectName:"chapter",type:"action-choice",actionType:p.type,payload:p.args})};switch(p.type.trim().toLowerCase()){case E.EventActionTypes.setNextBranch.trim().toLowerCase():{let C=b.find(S=>S.id===p.args.branchId);return C!=null&&C.chapterId?(x(),A(),I.bind(null,{subjectId:u,subjectName:"chapter",action:p,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case E.EventActionTypes.setWeightlessRandomBranch.trim().toLowerCase():{let C=_a(b);return C!=null&&C.chapterId?(x(),A(),I.bind(null,{subjectId:u,subjectName:"chapter",action:p,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case E.EventActionTypes.setRandomBranch.trim().toLowerCase():{let C=Ba(b);return C!=null&&C.chapterId?(x(),A(),I.bind(null,{subjectId:u,subjectName:"chapter",action:p,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case E.EventActionTypes.setMaxWeightBranch.trim().toLowerCase():{let C=Fa(b);return C!=null&&C.chapterId?(x(),A(),I.bind(null,{subjectId:u,subjectName:"chapter",action:p,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case E.EventActionTypes.setMinWeightBranch.trim().toLowerCase():{let C=$a(b);return C!=null&&C.chapterId?(x(),A(),I.bind(null,{subjectId:u,subjectName:"chapter",action:p,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case E.EventActionTypes.continuePlayback.trim().toLowerCase():return x(),A(),R.bind(null,{subjectId:u,subjectName:"chapter",action:p});case E.EventActionTypes.openURI.trim().toLowerCase():return x(),A(),m.bind(null,{subjectId:u,subjectName:"chapter",action:p,payload:{URI:p.args.uri}});default:{let C="Unexpected chapter event",S=new L(1,1,{message:C});f(S,C);return}}};function f(u,p){console.error(p),e.error$.next(u),r.emit(P.errors,u)}function v(u){var b;let p=tn(u.events);if(p){if(Z(u))return;r.emit(P.interactives,{subjectId:u.id,subjectName:"chapter",type:j.actionChoice,actionType:p.action.type,payload:p.action.args}),e.interactiveActionChoice$.next({subjectId:u.id,subjectName:"chapter",type:"action-choice",actionType:p.action.type,payload:p.action.args}),n.add({timestamp:1/0,priority:"chapter",initiator:u.id,actionType:E.EventActionTypes.expect,action:y.bind(null,{subjectId:u.id,subjectName:"chapter"})})}else(b=u.events)==null||b.forEach(x=>{let A=c({chapterId:u.id,action:x.action,branches:u.branches});A&&n.add({timestamp:1/0,priority:"chapter",initiator:u.id,actionType:x.action.type,action:A})})}let y=({subjectId:u,subjectName:p})=>{t.pause(),r.emit(P.interactives,{subjectId:u,subjectName:p,type:j.actionExecution,actionType:E.EventActionTypes.expect}),e.interactiveActionExecution$.next({subjectId:u,subjectName:p,type:"action-execution",actionType:E.EventActionTypes.expect})},g=({subjectId:u,subjectName:p})=>{t.info.isEnded$.getValue()?n.execEndOfVideo():t.play(),r.emit(P.interactives,{subjectId:u,subjectName:p,type:j.actionExecution,actionType:Da}),e.interactiveActionExecution$.next({subjectId:u,subjectName:p,type:"action-execution",actionType:Da})},R=({subjectId:u,subjectName:p,subjectType:b,action:x})=>{r.emit(P.interactives,{subjectId:u,subjectName:p,subjectType:b,type:j.actionExecution,actionType:x.type}),e.interactiveActionExecution$.next({subjectId:u,subjectName:p,subjectType:b,type:"action-execution",actionType:x.type})},I=({subjectId:u,subjectName:p,subjectType:b,action:x,payload:A})=>{A.behaviour="change-chapter",r.emit(P.interactives,{subjectId:u,subjectName:p,subjectType:b,type:j.actionExecution,actionType:x.type,payload:A}),e.interactiveActionExecution$.next({subjectId:u,subjectName:p,subjectType:b,type:"action-execution",actionType:x.type,payload:A})},m=({subjectId:u,subjectName:p,subjectType:b,action:x,payload:A})=>{if(!A.URI)return;let C=window.open(A.URI,"_blank","noopener,noreferrer");C&&(C.opener=null),r.emit(P.interactives,{subjectId:u,subjectName:p,subjectType:b,type:j.actionExecution,actionType:x.type}),e.interactiveActionExecution$.next({subjectId:u,subjectName:p,subjectType:b,type:"action-execution",actionType:x.type})};return{onControlEvent:s,onContainerEvent:l,onChapterEvent:c,onExpectEvent:y,expectEventHandler:g,setManifestChapterEvents:v,setManifestContainerEvents:a,stopExpect:o,state:i}};var vn=Q(zr(),1),K=require("@vkontakte/videoplayer-shared/es2015");var er=(r,e)=>{let t={};return r.map(n=>{if(!t[n]){let i=e.chapters.find(s=>s.id===n);if(!i)return null;let o=e.media.videos.find(s=>i.videoId===s.id);if(!o)return null;t[n]=mn(o)}return t[n]}).filter(Boolean)},Ua=r=>{for(let e of r.variants)if(Ga(e)&&e.payload)return e.payload.id},Ga=r=>!!(r.type==="custom"&&r.payload&&r.payload.type==="vk"),mn=r=>{let e=Ua(r);if(!e)return null;let t=e.split("_").pop();return t?parseInt(t,10):null},za=(r,e)=>{for(let t of r.media.videos)if(e===mn(t)){for(let n of r.chapters)if(n.videoId===t.id)return n.id;return}},fn=(r,e)=>r.reduce((t,n)=>{let i=za(e,n);return i?[...t,i]:t},[]);var oe,ge,Ee,W,tr,se,ae,ne,Ie,je,$e,mt=class{constructor({globalEventEmitter:e,videoId:t,interactiveController:n,historyApi:i,settings:o}){this.state={history$:new K.ValueSubject([]),hasPrevChapter$:new K.ValueSubject(!1),prevChapter$:new K.ValueSubject(null),isInitialChapter$:new K.ValueSubject(!1),isGoBackLimited$:new K.ValueSubject(!1)};U(this,oe,null);U(this,ge);U(this,Ee,!1);U(this,W,null);U(this,tr,null);this.events={inited$:new K.Subject,destroyed$:new K.Subject,error$:new K.Subject};U(this,se,null);U(this,ae,null);U(this,ne,null);U(this,Ie,new K.Subscription);U(this,je,!1);U(this,$e,0);var s;F(this,se,t),F(this,ne,e),F(this,ae,n),F(this,oe,i),F(this,ge,o),this.state.history$&&k(this,Ie)&&((s=k(this,Ie))==null||s.add(this.state.history$.subscribe(l=>{var a,c;this.state.prevChapter$.next((0,vn.default)(l,-2)||null),this.state.hasPrevChapter$.next(l.length>1),this.state.isInitialChapter$.next(this.getInitialChapterId()===((c=(a=k(this,W))==null?void 0:a.metadata)==null?void 0:c.initChapterId)),this.state.isGoBackLimited$.next(k(this,$e)===k(this,ge).maxLength-1)})))}setManifest(e){return O(this,null,function*(){if(!k(this,ae)||!k(this,ne))return;F(this,W,e),yield this.getProjectHistory();let t=this.getInitialChapterId();yield k(this,ae).setChapter({chapterId:t,pushToHistory:!1}),k(this,Ee)||(F(this,Ee,!0),this.events.inited$.next({initChapterId:t}))})}get inited(){return k(this,Ee)}updateHistory(e,t=!0){return O(this,null,function*(){var l;if(!k(this,W))return;k(this,je)?(F(this,je,!1),On(this,$e)._++):F(this,$e,0);let n=k(this,W),i=e.length-k(this,ge).maxLength,o=i>0?e.slice(i):e,s=er(o,n);if(F(this,tr,s),this.state.history$.next(o),!(!t||!k(this,oe)||!k(this,se)))try{yield k(this,oe).save(k(this,se),s)}catch(a){let c=new L(1,5,"Unable to save interactive history");this.events.error$.next(c),(l=k(this,ne))==null||l.emit(P.errors,c)}})}goBack(){return O(this,null,function*(){var n;if(!this.state||!k(this,ae)){let i=new L(1,5,"Unable to save interactive history");return this.events.error$.next(i),(n=k(this,ne))==null?void 0:n.emit(P.errors,i)}F(this,je,!0);let e=this.state.history$.getValue().slice(0,-1),t=e.pop();this.state.history$.next(e),yield k(this,ae).setChapter({chapterId:t,playPrev:!0})})}getProjectHistory(){return O(this,null,function*(){var i;if(!k(this,W)||!k(this,se))return;let e=k(this,W),t=[this.getInitialVideoId()];if(k(this,oe))try{let o=yield k(this,oe).get(k(this,se));o.length&&(t=o)}catch(o){let s=new L(1,5,"Error while trying to fetch data");this.events.error$.next(s),(i=k(this,ne))==null||i.emit(P.errors,s)}let n=fn(t,e);this.state.history$.next(n)})}getInitialChapterId(){var t;let e=this.state.history$.getValue();return(0,vn.default)(e,-1)||k(this,ge).initChapterId||((t=k(this,W))==null?void 0:t.metadata.initChapterId)}getInitialVideoId(){if(k(this,W)){let e=this.getInitialChapterId();return er([e],k(this,W)).pop()}return null}destroy(){var e,t;F(this,se,null),F(this,oe,null),F(this,ae,null),(e=k(this,Ie))==null||e.unsubscribe(),F(this,Ie,null),F(this,Ee,!1),(t=k(this,ne))==null||t.emit(P.historyDestroyed),this.events.destroyed$.next(),F(this,ne,null)}};oe=new WeakMap,ge=new WeakMap,Ee=new WeakMap,W=new WeakMap,tr=new WeakMap,se=new WeakMap,ae=new WeakMap,ne=new WeakMap,Ie=new WeakMap,je=new WeakMap,$e=new WeakMap;var rr=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 o=3;o<n;o+=40)if(t[o]!==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 O(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 O(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 nr=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;
|
|
@@ -11,50 +11,139 @@
|
|
|
11
11
|
height: var(--interactive-height);
|
|
12
12
|
background-color: var(--black);
|
|
13
13
|
visibility: hidden;
|
|
14
|
-
`,this.lastFrameCanvas=new
|
|
14
|
+
`,this.lastFrameCanvas=new rr,this.endOffsetMs=t,this._callbacks={onError:n},this.lastFrameCanvas.rootElement.style.cssText=`
|
|
15
15
|
position: absolute;
|
|
16
16
|
top: 50%;
|
|
17
17
|
left: 50%;
|
|
18
18
|
transform: translate(-50%, -50%);
|
|
19
|
-
`,this.rootElement.prepend(this.lastFrameCanvas.rootElement),e.prepend(this.rootElement)}destroy(){this.hide(),this.reset(),this._callbacks=void 0,this.lastFrameCanvas.destroy(),this.rootElement.remove()}setVideoDuration(e){this.currentVideoDurationMs=e}setVideoElement(e){this.lastFrameCanvas.setCanvasImageSource(e)}setCurrentChapter(e){this.currentChapter=e}show(){this.rootElement.style.visibility="visible"}hide(){this.rootElement.style.visibility="hidden"}updateCanvasDimensions(e=!1){return
|
|
20
|
-
|
|
19
|
+
`,this.rootElement.prepend(this.lastFrameCanvas.rootElement),e.prepend(this.rootElement)}destroy(){this.hide(),this.reset(),this._callbacks=void 0,this.lastFrameCanvas.destroy(),this.rootElement.remove()}setVideoDuration(e){this.currentVideoDurationMs=e}setVideoElement(e){this.lastFrameCanvas.setCanvasImageSource(e)}setCurrentChapter(e){this.currentChapter=e}show(){this.rootElement.style.visibility="visible"}hide(){this.rootElement.style.visibility="hidden"}updateCanvasDimensions(e=!1){return O(this,null,function*(){this._containerTimeFrameShouldReceived||this._endTimeFrameReceived||(e=!1);let t=getComputedStyle(this.rootElement),n={width:parseInt(t.getPropertyValue("--interactive-content-width"),10),height:parseInt(t.getPropertyValue("--interactive-content-height"),10)};try{this.lastFrameCanvas.updateCanvasDimensions(n,e)}catch(i){this._onError(i)}})}draw(){(this._containerTimeFrameShouldReceived||!this._containerTimeFrameShouldReceived&&!this._endTimeFrameReceived)&&this.lastFrameCanvas.draw()}isChapterEndTime(e){return this.currentVideoDurationMs&&e>=this.currentVideoDurationMs-this.endOffsetMs}isContainerTime(e){if(this.currentChapter)return this.currentChapter.containers.some(t=>{var n,i,o;return((n=t.controls)==null?void 0:n.length)&&e>=((i=t.startTime)!=null?i:0)&&e<=Math.min((o=t.endTime)!=null?o:1/0,this.currentVideoDurationMs-this.endOffsetMs)})}reset(){this._endTimeFrameReceived=!1,this._containerTimeFrameShouldReceived=!1,this._shouldCallSkip=!1}_onError(e){var t,n;(n=(t=this._callbacks)==null?void 0:t.onError)==null||n.call(t,e)}};function Wa(r=0){return new Promise(e=>{setTimeout(()=>{e(0)},r)})}var Ka=`/* interactive-container */
|
|
20
|
+
.interactive-container {
|
|
21
|
+
opacity: 1;
|
|
22
|
+
visibility: visible;
|
|
23
|
+
transition: opacity var(--interactive-transition-1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.interactive-container-disabled {
|
|
27
|
+
opacity: 0.5;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.interactive-container-hidden {
|
|
31
|
+
visibility: hidden;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* blink-anim */
|
|
35
|
+
.interactive-control-blink-anim {
|
|
36
|
+
animation-duration: 2001ms;
|
|
37
|
+
animation-iteration-count: infinite;
|
|
38
|
+
animation-timing-function: cubic-bezier(0.3, 0.3, 0.3, 1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.interactive-control-blink-anim-button {
|
|
42
|
+
animation-name: interactive-blinking-button;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.interactive-control-blink-anim-area {
|
|
46
|
+
animation-name: interactive-blinking-area;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@keyframes interactive-blinking-area {
|
|
50
|
+
0%, 100% {
|
|
21
51
|
opacity: 1;
|
|
22
|
-
visibility: visible;
|
|
23
|
-
transition: opacity var(--interactive-transition-1);
|
|
24
52
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
opacity: 0.5;
|
|
53
|
+
50% {
|
|
54
|
+
opacity: var(--interactive-area-hover-opacity);
|
|
28
55
|
}
|
|
56
|
+
}
|
|
29
57
|
|
|
30
|
-
|
|
31
|
-
|
|
58
|
+
@keyframes interactive-blinking-button {
|
|
59
|
+
0%, 100% {
|
|
60
|
+
opacity: 1;
|
|
32
61
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
position: absolute;
|
|
36
|
-
top: 0;
|
|
37
|
-
left: 0;
|
|
38
|
-
font-family: inherit;
|
|
39
|
-
|
|
40
|
-
--interactive-transition-1: 100ms ease-in-out;
|
|
62
|
+
50% {
|
|
63
|
+
opacity: var(--interactive-button-hover-opacity);
|
|
41
64
|
}
|
|
65
|
+
}
|
|
42
66
|
|
|
43
|
-
|
|
67
|
+
/* blink-anim-reference */
|
|
68
|
+
.interactive-blink-anim-reference {
|
|
69
|
+
position: absolute;
|
|
70
|
+
height: 0;
|
|
71
|
+
width: 0;
|
|
72
|
+
top: 0;
|
|
73
|
+
left: 0;
|
|
74
|
+
pointer-events: none;
|
|
75
|
+
}
|
|
44
76
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
77
|
+
.interactive-blink-anim-reference-animation {
|
|
78
|
+
animation-duration: 2001ms;
|
|
79
|
+
animation-iteration-count: infinite;
|
|
80
|
+
animation-timing-function: cubic-bezier(0.3, 0.3, 0.3, 1);
|
|
81
|
+
animation-name: interactive-blinking-button;
|
|
82
|
+
}
|
|
51
83
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
84
|
+
.interactive-blink-anim-reference-disabled {
|
|
85
|
+
animation: none;
|
|
86
|
+
}
|
|
55
87
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
`,jo=r=>{let e=document.createElement("style");e.textContent=ih,r.prepend(e)};var _o=require("@vkontakte/videoplayer-core/es2015");var Lo=Object.freeze({lang:S.InterfaceLanguage.RU,loaders:{},graph:!1,initSeamless:!1,lastFrame:!1,permanentTextControls:!0,interactiveTimeOpenUri:!1,config:{historyMaxLength:100,noInteractionEventTimeout:3e4}});function sh(){let r=document.createElement("div");return r.classList.add("interactive-chapter"),r}var at=class{constructor(e){this.playerSubscriptions=new S.Subscription;this.subscriptions=new S.Subscription;this.globalEventEmitter=new Pt;this.animation=new kt;this.seekToInteractiveController=new Ye;this.endedRanges=new Set;this.gameControllers=[];this.rootElement=sh();this.factories=new Map([["choice",yt]]);this.isFirstChapterFetched=!1;this.player=null;this.interactiveEvents=null;this.selectBranches=null;this.seamlessController=null;this.seamlessControllerSubs=new S.Subscription;this.graph=null;this.lastFrame=null;this.appState=0;this.state={prevChapter$:new S.ValueSubject(null),isInitialChapter$:new S.ValueSubject(!1),isFirstChapter$:new S.ValueSubject(!0),isEndChapter$:new S.ValueSubject(!1),isInteractiveExpectation$:new S.ValueSubject(!1),isReplay$:new S.ValueSubject(!1),calledByInteractive$:new S.ValueSubject(!1),lastChapterChangeWasInitiatedByInteractive$:new S.ValueSubject(!1),disabledControls$:new S.ValueSubject(!1),interactiveRanges$:new S.ValueSubject([]),isInteractiveTime$:new S.ValueSubject(!1),statistics$:new S.ValueSubject(null),isSeekable$:new S.ValueSubject(!1)};this.events={noInteraction$:new S.Subject,graphVisibilityChanged$:new S.Subject,watchAgainIsClicked$:new S.Subject,chapterChanged$:new S.Subject,playerChanged$:new S.Subject,error$:new S.Subject,eachTick$:new S.Subject,manifestChanged$:new S.Subject,interactiveRangeEnded$:new S.Subject,interactiveContainerRemoved$:new S.Subject,interactiveContainerFakeRemoved$:new S.Subject,interactiveActionExecution$:new S.Subject,interactiveActionChoice$:new S.Subject,interactiveVisibilityChanged$:new S.Subject};this.emitErrorEvent=e=>{this.events.error$.next(e),this.globalEventEmitter.emit(M.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&&Y(n)&&!t&&this.historyController.updateHistory([]),window.removeEventListener("beforeunload",this.clearHistoryIfEnded)};this.handleSeamlessPlayerChanged=e=>{if(!e)return;let i=e,{statistics:t}=i,n=J(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(M.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=>w(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=w(d(d({},Lo),e),{config:d(d({},Lo.config),e.config)}),this._options.parentElement.append(this.rootElement),this.historyController=new st({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 Wt({parentElement:this._options.parentElement,onError:i=>{let s=new q(1,6,i);this.emitErrorEvent(s)}})),jo(this._options.parentElement),this.subscriptions.add((0,S.fromEvent)(this.rootElement,"mousedown").subscribe(i=>i.stopPropagation())).add((0,S.fromEvent)(this.rootElement,"mouseup").subscribe(i=>i.stopPropagation())),this.manifestController=new fe(this._options.loaders,i=>{let s=new q(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=go(()=>({player:this.player,parentElement:this._options.parentElement,fns:t})),this._options.graph&&(this.graph=new Xe({root:this._options.parentElement,lang:this._options.lang,onOpenPreviewClick:i=>{this.setChapter({chapterId:i}),this.globalEventEmitter.emit(M.graph,{type:ke.watchAgainClicked,chapterId:i}),this.events.watchAgainIsClicked$.next(i)},onError:i=>{let s=new q(1,2,{message:i});this.emitErrorEvent(s)}})),this.initSubscriptions()}initSubscriptions(){this.playerSubscriptions.add(this.historyController.events.inited$.subscribe(t=>V(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 V(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(M.interactives,{type:j.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((0,S.once)()).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((0,S.combine)({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(A=>!A.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=>!me(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 Bt({player:this.player,container:o,branches:e.branches,selectBranches:this.selectBranches,interactiveEvents:this.interactiveEvents,globalEvents:this.events,globalEventEmitter:this.globalEventEmitter,getContainerEventState:()=>Fs(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&&Y(n)&&rt(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?w(d({},l),{isRemoved:!0}):l);return w(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 V(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(M.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=yo(this.player,this._options.interactiveTimeOpenUri),this.selectBranches=Po({player:this.player,interactiveEvents:this.interactiveEvents,globalEvents:this.events,globalEventEmitter:this.globalEventEmitter}),this.appState===1&&(this.registerVideoEvents(),this.setGameControllers())}setChapter(){return V(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&&_o.clientChecker.browser.isSafari&&(yield No(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(M.chapterChanged,{chapter:s,media:o,graph:c}),this.setGameControllers(),this.endedRanges=new Set,this.isFirstChapterFetched=!0)})}getStatEvents(){return{click$:new S.Observable(e=>{this.subscriptions.add(this.events.graphVisibilityChanged$.subscribe(t=>{e.next(t?Ne.InteractiveInterfaceClick.GRAPH_SHOW:Ne.InteractiveInterfaceClick.GRAPH_HIDE)})).add(this.events.watchAgainIsClicked$.subscribe(()=>{e.next(Ne.InteractiveInterfaceClick.WATCH_AGAIN)})).add(this.events.interactiveActionChoice$.subscribe(({type:t,subjectName:n,subjectType:i})=>{t!=="action-choice"||n!=="control"||(i==="Button"&&e.next(Ne.InteractiveInterfaceClick.NEXT_BUTTON),i==="Area"&&e.next(Ne.InteractiveInterfaceClick.NEXT_AREA))}))}),nextMovie$:new S.Observable(e=>{this.events.playerChanged$.subscribe(({config:t})=>{t!=null&&t.unitedVideoId&&!this.state.isFirstChapter$.getValue()&&e.next(t.unitedVideoId)})})}}toggleGraphView(e=!0){return V(this,null,function*(){this.graph&&(e?(yield this.graph.show(),this.state.isSeekable$.next(!1)):(this.graph.hide(),this.checkIfSeekable()),this.globalEventEmitter.emit(M.graph,{type:ke.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===I.EventActionTypes.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&&de(i.events)})}playPrevChapter(){this.historyController.goBack()}setDisabledControls(e){this.state.disabledControls$.next(e)}isSupport(e=this.manifestController.manifest){return!!e&&(0,I.isSupportedManifest)(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 Ma((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 Fo={Container:Ee,createChoiceContainer:yt,createAreaControl:mt,createButtonControl:vt,classnamesPrefix:En};var ah={version:Cn};
|
|
88
|
+
/* interactive-chapter */
|
|
89
|
+
.interactive-chapter {
|
|
90
|
+
position: absolute;
|
|
91
|
+
top: 0;
|
|
92
|
+
left: 0;
|
|
93
|
+
font-family: inherit;
|
|
94
|
+
|
|
95
|
+
--interactive-transition-1: 100ms ease-in-out;
|
|
96
|
+
--interactive-transition-2: 400ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
97
|
+
--interactive-button-hover-opacity: 0.8;
|
|
98
|
+
--interactive-area-hover-opacity: 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* interactive-control */
|
|
102
|
+
.interactive-control {
|
|
103
|
+
display: flex;
|
|
104
|
+
width: 100%;
|
|
105
|
+
height: 100%;
|
|
106
|
+
font-family: inherit;
|
|
107
|
+
|
|
108
|
+
position: relative;
|
|
109
|
+
isolation: isolate;
|
|
110
|
+
opacity: 1;
|
|
111
|
+
|
|
112
|
+
box-shadow: none;
|
|
113
|
+
border: none;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.interactive-control-disabled {
|
|
117
|
+
cursor: default;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.interactive-control-button
|
|
121
|
+
.interactive-control-area {
|
|
122
|
+
cursor: pointer;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.interactive-control-button {
|
|
126
|
+
transition: opacity var(--interactive-transition-2);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.interactive-control-area {
|
|
130
|
+
transition: border-color var(--interactive-transition-1), box-shadow var(--interactive-transition-1), opacity var(--interactive-transition-2);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.interactive-container.interactive-container-disabled .interactive-control-button,
|
|
134
|
+
.interactive-container.interactive-container-disabled .interactive-control-area {
|
|
135
|
+
animation: none;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.interactive-container:not(.interactive-container-disabled) .interactive-control-button:not(.interactive-control-selected):not(.interactive-control-blink-anim):hover,
|
|
139
|
+
.interactive-container:not(.interactive-container-disabled) .interactive-control-button:not(.interactive-control-selected):not(.interactive-control-blink-anim):focus-visible {
|
|
140
|
+
opacity: var(--interactive-button-hover-opacity);
|
|
141
|
+
animation: none;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.interactive-container:not(.interactive-container-disabled) .interactive-control-area:not(.interactive-control-selected):not(.interactive-control-blink-anim):hover,
|
|
145
|
+
.interactive-container:not(.interactive-container-disabled) .interactive-control-area:not(.interactive-control-selected):not(.interactive-control-blink-anim):focus-visible {
|
|
146
|
+
opacity: var(--interactive-area-hover-opacity);
|
|
147
|
+
animation: none;
|
|
148
|
+
}
|
|
149
|
+
`;var Qa=r=>{let e=document.createElement("style");e.textContent=Ka,r.prepend(e)};var Za=require("@vkontakte/videoplayer-core/es2015");var Xa=Object.freeze({lang:w.InterfaceLanguage.RU,loaders:{},graph:!1,initSeamless:!1,lastFrame:!1,permanentTextControls:!0,interactiveTimeOpenUri:!1,config:{historyMaxLength:100,noInteractionEventTimeout:3e4},animationsFeatureToggles:{areaControlShadow:!1,controlsExpectTimeBlinkAnimation:!1}});function bh(){let r=document.createElement("div");return r.classList.add("interactive-chapter"),r}var ft=class{constructor(e){this.playerSubscriptions=new w.Subscription;this.subscriptions=new w.Subscription;this.globalEventEmitter=new Bt;this.animation=new qt;this.seekToInteractiveController=new it;this.endedRanges=new Set;this.gameControllers=[];this.rootElement=bh();this.factories=new Map([["choice",Ot]]);this.isFirstChapterFetched=!1;this.player=null;this.interactiveEvents=null;this.selectBranches=null;this.seamlessController=null;this.seamlessControllerSubs=new w.Subscription;this.graph=null;this.lastFrame=null;this.blinkAnimationRef=null;this.appState=0;this.state={prevChapter$:new w.ValueSubject(null),isInitialChapter$:new w.ValueSubject(!1),isFirstChapter$:new w.ValueSubject(!0),isEndChapter$:new w.ValueSubject(!1),isInteractiveExpectation$:new w.ValueSubject(!1),isReplay$:new w.ValueSubject(!1),calledByInteractive$:new w.ValueSubject(!1),lastChapterChangeWasInitiatedByInteractive$:new w.ValueSubject(!1),disabledControls$:new w.ValueSubject(!1),interactiveRanges$:new w.ValueSubject([]),isInteractiveTime$:new w.ValueSubject(!1),statistics$:new w.ValueSubject(null),isSeekable$:new w.ValueSubject(!1)};this.events={noInteraction$:new w.Subject,graphVisibilityChanged$:new w.Subject,watchAgainIsClicked$:new w.Subject,chapterChanged$:new w.Subject,playerChanged$:new w.Subject,error$:new w.Subject,eachTick$:new w.Subject,manifestChanged$:new w.Subject,interactiveRangeEnded$:new w.Subject,interactiveContainerRemoved$:new w.Subject,interactiveContainerFakeRemoved$:new w.Subject,interactiveActionExecution$:new w.Subject,interactiveActionChoice$:new w.Subject,interactiveVisibilityChanged$:new w.Subject};this.emitErrorEvent=e=>{this.events.error$.next(e),this.globalEventEmitter.emit(P.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&&Z(n)&&!t&&this.historyController.updateHistory([]),window.removeEventListener("beforeunload",this.clearHistoryIfEnded)};this.handleSeamlessPlayerChanged=e=>{if(!e)return;let i=e,{statistics:t}=i,n=ee(i,["statistics"]);if(t){let{statSubscription:o,oneStat:s}=t;o.add(s.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(P.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(o=>T(d({},o),{subjects:o.subjects.filter(s=>s.id!==e)}));t.next(i)};this.clearNoInteractionTimeout=()=>{this.noInteractionTimeout&&(clearTimeout(this.noInteractionTimeout),this.noInteractionTimeout=void 0)};var i,o;if(this._options=T(d(d({},Xa),e),{config:d(d({},Xa.config),e.config)}),(i=this._options.animationsFeatureToggles)==null?void 0:i.controlsExpectTimeBlinkAnimation){this.blinkAnimationRef=new St,this.blinkAnimationRef.create();let s=this.blinkAnimationRef.element;s&&this.rootElement.append(s)}this._options.parentElement.append(this.rootElement),this.historyController=new mt({interactiveController:this,globalEventEmitter:this.globalEventEmitter,videoId:(o=this._options.projectInfo)==null?void 0:o.videoId,historyApi:this._options.historyApi,settings:{maxLength:this._options.config.historyMaxLength,initChapterId:this._options.initChapterId}}),this._options.lastFrame&&(this.lastFrame=new nr({parentElement:this._options.parentElement,onError:s=>{let l=new L(1,6,s);this.emitErrorEvent(l)}})),Qa(this._options.parentElement),this.subscriptions.add((0,w.fromEvent)(this.rootElement,"mousedown").subscribe(s=>s.stopPropagation())).add((0,w.fromEvent)(this.rootElement,"mouseup").subscribe(s=>s.stopPropagation())),this.manifestController=new Ce(this._options.loaders,s=>{let l=new L(1,3,s);this.emitErrorEvent(l)});let n=[];this._options.lastFrame&&n.push(()=>{var s;(s=this.lastFrame)==null||s.updateCanvasDimensions(!0)}),n.push(()=>{let s=this.state.isInteractiveTime$.getValue();for(let l of this.gameControllers)l.onResize(s)}),this.resizeManager=La(()=>({player:this.player,parentElement:this._options.parentElement,fns:n})),this._options.graph&&(this.graph=new nt({root:this._options.parentElement,lang:this._options.lang,onOpenPreviewClick:s=>{this.setChapter({chapterId:s}),this.globalEventEmitter.emit(P.graph,{type:Le.watchAgainClicked,chapterId:s}),this.events.watchAgainIsClicked$.next(s)},onError:s=>{let l=new L(1,2,{message:s});this.emitErrorEvent(l)}})),this.initSubscriptions()}initSubscriptions(){this.playerSubscriptions.add(this.historyController.events.inited$.subscribe(t=>O(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),this.updateControlsShadowStyles({subjectName:e.subjectName,subjectId:e.subjectId,isExpect:!0}),this.toggleBlinkAnimation({subjectName:e.subjectName,subjectId:e.subjectId,isExpect:!0})):e.actionType==="after-expect"&&(this.state.isInteractiveExpectation$.next(!1),this.updateControlsShadowStyles({subjectName:e.subjectName,subjectId:e.subjectId,isExpect:!1}),this.toggleBlinkAnimation({subjectName:e.subjectName,subjectId:e.subjectId,isExpect:!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 O(this,null,function*(){this.seamlessController=an(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:o})=>t>=o[1]);if(i){let o=i.range.join("-");this.endedRanges.has(o)||(this.endedRanges.add(o),this.globalEventEmitter.emit(P.interactives,{type:j.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((0,w.once)()).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((0,w.combine)({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 c=e*1e3;i=!!t.find(({range:[v,y],subjects:g})=>v<c&&c<y&&g.some(R=>!R.isRemoved)&&g.length)}i!==this.state.isInteractiveTime$.getValue()&&this.state.isInteractiveTime$.next(i);let o=!!this.noInteractionTimeout,l=((a=this.player)==null?void 0:a.info.playbackState$.getValue())==="playing"||n;i&&!o&&l?this.noInteractionTimeout=window.setTimeout(()=>{this.events.noInteraction$.next()},this._options.config.noInteractionEventTimeout):o&&!l&&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=>!be(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=>{var l;let i=n.type.trim().toLowerCase(),o=this.factories.get(i),s=o==null?void 0:o(n,this.rootElement,{features:{controlsExpectTimeBlinkAnimation:(l=this._options.animationsFeatureToggles)==null?void 0:l.controlsExpectTimeBlinkAnimation}});if(s&&this.selectBranches&&this.interactiveEvents&&this.player){let a=new Yt({player:this.player,container:s,branches:e.branches,selectBranches:this.selectBranches,interactiveEvents:this.interactiveEvents,globalEvents:this.events,globalEventEmitter:this.globalEventEmitter,getContainerEventState:()=>ps(n,this.gameControllers),permanentTextControls:this._options.permanentTextControls,interactiveTimeOpenUri:this._options.interactiveTimeOpenUri,disabledControls$:this.state.disabledControls$,onRemove:()=>{this.seekToInteractiveController.deleteContainer(n.id)},onError:this.emitErrorEvent});this.animation.addFn(a.whilePlaying,!0),t.push(a)}}),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 l,a;if(this.updateLastEventInfo(),!this.historyController.inited)return;let t=this.state.lastChapterChangeWasInitiatedByInteractive$.getValue(),n=this.state.prevChapter$.getValue(),i=(l=n&&Z(n)&&ut(n))!=null?l:!1,o=((a=this.manifestController.manifest)==null?void 0:a.metadata.initChapterId)===e,s=this.historyController.state.history$.getValue();if(o||i&&t){this.historyController.updateHistory([e]);return}(0,Ya.default)(s,-1)!==e&&this.historyController.updateHistory([...s,e])}handleFakeRemoval(e,t){let{interactiveRanges$:n}=this.state,o=n.getValue().map(s=>{let l=s.subjects.some(c=>c.id===e),a=s.subjects.map(c=>t&&l||c.id===e?T(d({},c),{isRemoved:!0}):c);return T(d({},s),{subjects:a})});n.next(o)}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())}toggleBlinkAnimation(e){var n,i;if(!((n=this._options.animationsFeatureToggles)!=null&&n.controlsExpectTimeBlinkAnimation))return;let t=(o,s)=>{o.toggleBlinkAnimation(s)};Qt(T(d({},e),{gameControllers:this.gameControllers,execFn:ht(ln(t),e.isExpect)})),e.isExpect&&((i=this.blinkAnimationRef)==null||i.restart())}updateControlsShadowStyles(e){var n;if(!((n=this._options.animationsFeatureToggles)!=null&&n.areaControlShadow))return;let t=(i,o)=>{i.updateControlsShadowStyles(o)};e.isExpect?Qt(T(d({},e),{gameControllers:this.gameControllers,execFn:ht(ln(t),!1)})):Qt(T(d({},e),{gameControllers:this.gameControllers,execFn:t}))}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 O(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(P.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=Va(this.player,this._options.interactiveTimeOpenUri),this.selectBranches=Ha({player:this.player,interactiveEvents:this.interactiveEvents,globalEvents:this.events,globalEventEmitter:this.globalEventEmitter}),this.appState===1&&(this.registerVideoEvents(),this.setGameControllers())}setChapter(){return O(this,arguments,function*({chapterId:e,pushToHistory:t=!0,playPrev:n=!1}={}){var a,c;this.reset(),this.lastFrame&&this.isFirstChapterFetched&&(this.lastFrame.draw(),this.lastFrame.show()),this.lastFrame&&Za.clientChecker.browser.isSafari&&(yield Wa(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:o,media:s,graph:l}=yield e?this.manifestController.setNext(e):this.manifestController.setInitial();(!e||i)&&this.state.isFirstChapter$.next(!0),!(!o||!s)&&(t&&this.pushChapterToHistory(o.id),this.state.isInitialChapter$.next(this.manifestController.isInitialChapter()),this.state.isEndChapter$.next(this.manifestController.isEndChapter()),this.graph&&this.graph.handleChapterChange(o),(c=this.lastFrame)==null||c.setCurrentChapter(o),this.events.chapterChanged$.next({chapter:o,manifestVideo:s}),this.globalEventEmitter.emit(P.chapterChanged,{chapter:o,media:s,graph:l}),this.setGameControllers(),this.endedRanges=new Set,this.isFirstChapterFetched=!0)})}getStatEvents(){return{click$:new w.Observable(e=>{this.subscriptions.add(this.events.graphVisibilityChanged$.subscribe(t=>{e.next(t?Fe.InteractiveInterfaceClick.GRAPH_SHOW:Fe.InteractiveInterfaceClick.GRAPH_HIDE)})).add(this.events.watchAgainIsClicked$.subscribe(()=>{e.next(Fe.InteractiveInterfaceClick.WATCH_AGAIN)})).add(this.events.interactiveActionChoice$.subscribe(({type:t,subjectName:n,subjectType:i})=>{t!=="action-choice"||n!=="control"||(i==="Button"&&e.next(Fe.InteractiveInterfaceClick.NEXT_BUTTON),i==="Area"&&e.next(Fe.InteractiveInterfaceClick.NEXT_AREA))}))}),nextMovie$:new w.Observable(e=>{this.events.playerChanged$.subscribe(({config:t})=>{t!=null&&t.unitedVideoId&&!this.state.isFirstChapter$.getValue()&&e.next(t.unitedVideoId)})})}}toggleGraphView(e=!0){return O(this,null,function*(){this.graph&&(e?(yield this.graph.show(),this.state.isSeekable$.next(!1)):(this.graph.hide(),this.checkIfSeekable()),this.globalEventEmitter.emit(P.graph,{type:Le.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===E.EventActionTypes.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&&ye(i.events)})}playPrevChapter(){this.historyController.goBack()}setDisabledControls(e){this.state.disabledControls$.next(e)}isSupport(e=this.manifestController.manifest){return!!e&&(0,E.isSupportedManifest)(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 Qs((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,o,s;this.clearHistoryIfEnded(),(e=this.blinkAnimationRef)==null||e.destroy(),this.destroyGameControllers(),this.gameControllers=[],(t=this.graph)==null||t.destroy(),this.seamlessControllerSubs.unsubscribe(),(n=this.seamlessController)==null||n.removeAll(),(i=this.resizeManager)==null||i.release(),this.animation.release(),(o=this.interactiveEvents)==null||o.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 Ja={Container:Se,createChoiceContainer:Ot,createAreaControl:wt,createButtonControl:Rt,classnamesPrefix:Mn};var Ch={version:Pn};
|