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