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