MAX – быстрое и легкое приложение для общения и решения повседневных задач

Максимум
возможностей
для общения

Быстрое и лёгкое приложение для общения и решения повседневных задач
Image
Image

Общайтесь без ограничений

Переписывайтесь, отправляйте аудио- и видеосообщения, выражайте эмоции с анимированными стикерами и легко обменивайтесь даже объемными файлами
Image

Звоните в высоком качестве

Оставайтесь на связи даже при слабом сигнале сети. Бесплатно, без ограничений по времени и количеству участников
Image

Читайте любимых авторов

Оставайтесь в курсе событий, следите за любимыми авторами и легко находите то, что интересно именно вам
Image

Будьте в безопасности

Легко управляйте настройками безопасности профиля и общайтесь только с теми, кому доверяете
Image

Пользуйтесь уникальными сервисами

Документы всегда под рукой: подтверждайте через MAX свой возраст. Быстро заполняйте данные и подписывайте документы онлайн

Скачайте MAX
на любое устройство

Новые функции сделают приложение еще удобнее.
Следите за обновлениями
"),re=document.querySelector("div.videoplayer_controls"),re&&(_e=re.style.display,re.style.display="none"),(me=document.querySelector("div.videoplayer_ads_skip"))&&(ae=me.style.display,me.style.display="none")):(V.write(Y.src),e.log("render")),V.close(),F=AdmanHTML.Utils.getElementViewport(t.wrapper),F.addEventListener("message",d),Y.openLinkInPopup&&(Y.urlToNavigateOnClick||Y.trackingLink)&&(E.contentWindow.document.body||E.contentDocument.body?be():E.onload=be),t.viewability.start(L.mainEl,e),l(),L.onStart()}function a(){G||(G=!0,W+=Date.now()-J,clearInterval(A),A=null,re?re.style.display=_e:te&&v("pauseAd",[]),t.cb("onPaused"))}function o(){return Y.creativeType==="video-motion"}function s(){G&&(G=!1,l(),t.cb("onPlayed"))}function l(){if(!A){if(te){if(!Q)return;re?re.style.display="none":v("startAd",[])}A=setInterval(c,251),J=Date.now(),G=!1}}function u(){Me||t.cb("onCompleted")}function c(){W+=Date.now()-J,J=Date.now(),L.onTimeRemained(W/1e3,C),te?v("timeUpdateAd",[W/1e3,C]):P.onTimeRemained(W/1e3,C),W>=1e3*C&&(clearInterval(A),A=null,u())}function d(be){if(be.source===E.contentWindow){if(te&&typeof be.data=="object")return void m(be.data);try{JSON.parse(be.data).type==="trg:click"&&(e.log("click"),t.cb("onClicked"))}catch{}}}function v(be,X){if(typeof E=="object"&&typeof E.contentWindow=="object")try{var We=E.contentWindow.origin;E.contentWindow.postMessage({initiator:"render-runner",id:k,method:be,args:X},We)}catch{}}function m(be){if(te&&typeof be=="object"&&be.initiator==="render-runner"&&Array.isArray(be.args)&&be.args[0]===k)switch(be.event){case"AdStarted":Q=!0,l();break;case"AdCanPlay":e.log("render");break;case"HeaderClick":e.log("click"),t.cb("onClicked",{type:"header"});break;case"ItemClick":e.log("card_"+be.args[1]+"_click"),t.cb("onClicked",{type:"card",cardId:be.args[1]});break;case"ItemShow":e.log("card_"+be.args[1]+"_show");break;case"AdClickThru":e.log("click"),t.cb("onClicked",{type:"common"});break;case"AdError":t.cb("onError",be.args[1]);break;case"ClosedByUser":e.log("closedByUser"),t.cb("onClosed"),t.cb("onSkipped"),Me=null,S();break;case"UserAction":Me=Date.now()}}function b(){re&&(re.style.display=_e),me&&(me.style.display=ae)}function _(){A&&clearInterval(A),A=null,b(),F.removeEventListener("message",d)}function S(){_(),L.dispose(),P&&P.dispose(),D&&D.dispose()}function M(){var be=document.createElement("iframe");return be.scrolling="no",be.marginWidth="0",be.marginHeight="0",be.frameBorder="0",be.id="ad-frame-"+Math.round(1e5*Math.random()),be.onclose=b,be}var E,C,A,k,L=new AdmanHTML.AdRenderer(t,e),D=new AdmanHTML.CallToActionBtnRenderer(t,e),P=null,F=null,V=null,Y=e.getAd(),G=!1,W=0,J=0,te=o(),Q=!1,re=null,_e="flex",me=null,ae="block",Me=null;return te?k="b"+Y.bannerID:P=new AdmanHTML.DisclaimerRenderer(t,e),L.onClick=function(){},{start:r,pause:a,resume:s,skip:L.skip,dispose:S}},AdmanHTML.ImgAdRenderer=function(t,e){function r(){n.start(),n.registerTimer(),AdmanHTML.Utils.addCss(l,s);var c=e.getAd();n.setView(AdmanHTML.Utils.renderTemplate(u,c),{position:"absolute",display:"inline-block",width:"100%","max-width":c.width+"px",left:"50%",bottom:0,transform:"translate(-50%,0)","box-sizing":"border-box",overflow:"hidden","z-index":"999999","text-align":"center"});var d=e.getSettings(),v=n.mainEl.querySelector(".rb-adman_age_wrapper");if(d&&d.advertisment&&d.advertisment.image){var m=d.advertisment.image;AdmanHTML.StyleUtils.applyStyle(n.mainEl,m,"fontFace contentIndent hasBackground backgroundColor backgroundAlpha cornerRounding".split(" ")),AdmanHTML.StyleUtils.applyStyle(n.mainEl.querySelector(".rb-adman_image_wrapper"),m,"borderSize borderColor borderAlpha borderCornerRounding".split(" "));var b=d.advertisment.image.ageRestrictions;c.ageRestrictions&&b&&(AdmanHTML.StyleUtils.applyStyle(v,b),AdmanHTML.StyleUtils.applyStyle(v.querySelector(".rb-adman_age_content"),b,["textUnderline"]))}c.ageRestrictions||v.parentNode.removeChild(v),a.setWrapper(n.mainEl),a.start(),n.onStart(),o.render(),e.log("render")}function i(){n.dispose(),a.dispose(),o.dispose()}var n=new AdmanHTML.AdRenderer(t,e),a=new AdmanHTML.CloseBtnRenderer(t,e),o=new AdmanHTML.DisclaimerRenderer(t,e),s="rb-adman-img-style",l=".rb-adman_image_overlay {display:inline-block; overflow:hidden;vertical-align:middle;cursor:pointer;color:#fff}.rb-adman_image_overlay .rb-adman_image_wrapper {display:block;border:0px solid transparent;overflow:hidden;}.rb-adman_image_overlay .rb-adman_image_wrapper img {vertical-align:top;}.rb-adman_image_overlay .rb-adman_age_wrapper {display:block;position:absolute;top:0px;left:3px;border:0px solid transparent;margin-right:1px;text-decoration:none!important}",u='
{{ageRestrictions}}
';return{start:r,pause:n.pause,resume:n.resume,skip:n.skip,dispose:i}},AdmanHTML.OpenLinkPopupRender=function(t){function e(){for(var l=window;l.parent&&l.parent.frameElement;)l=l.parent;return l}function r(l){t.isPopupOpen=!0,t.pause(),o=i(l)}function i(l){o=s.createElement("div"),n(),o.classList.add("rb-adman-popup");var u=s.createElement("div");u.classList.add("rb-adman-popup-body"),o.appendChild(u);var c=s.createElement("div");c.classList.add("rb-adman-popup-closeButton");var d=o;a=function(){d.remove(),d=null,t.resume(!0),t.isPopupOpen=!1},c.onclick=a,u.appendChild(c);var v=s.createElement("iframe");v.classList.add("rb-adman-popup-frame"),v.setAttribute("src",l),u.appendChild(v),s.body.append(o)}function n(){var l=s.createElement("style");l.innerHTML=".rb-adman-popup{position:fixed;top:0;left:0;width:100vw;height:100vh;display:flex;flex-direction:row;align-items:center;justify-content:center;overflow:auto;padding: 7vh 0;box-sizing:border-box;background:rgba(0,0,0,.4);z-index: 1000000;}.rb-adman-popup-body{position:relative;max-width:630px;min-width:500px;width:50%;height:100%;z-index:20;border-radius:12px;background-color:#FFF;-webkit-box-shadow: 12px 12px 8px 0px rgba(34, 60, 80, 0.2);-moz-box-shadow: 12px 12px 8px 0px rgba(34, 60, 80, 0.2);box-shadow: 12px 12px 8px 0px rgba(34, 60, 80, 0.2);color: #FEFEFE}.rb-adman-popup-frame{width:100%;height:100%;overflow:hidden;border-radius: 12px;border:none;}.rb-adman-popup-closeButton{background-image: url(data:image/svg+xml;base64,PHN2ZyBmaWxsPSJ3aGl0ZSIgdmlld0JveD0iMCAwIDE3IDE3IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Im05LjIgOC41IDYuNjUgNi42NS0uNy43TDguNSA5LjIxbC02LjY1IDYuNjQtLjctLjdMNy43OSA4LjUgMS4xNSAxLjg1bC43LS43TDguNSA3Ljc5bDYuNjUtNi42NC43LjdMOS4yMSA4LjV6IiBzdHJva2U9Im5vbmUiLz48L3N2Zz4K);background-repeat:no-repeat;background-position:center;background-size:50%;position:absolute;top:0;right:-38px;width:28px;height:28px;border-radius:14px;padding: 4px;background-color:rgba(0,0,0,.35);background-color:#000;cursor:pointer;filter:opacity(35%);color:white;box-sizing:border-box;transition: transform .15s ease-in;}.rb-adman-popup-closeButton:hover{filter:opacity(55%);transform:scale(1.1) rotate(90deg);}",o.appendChild(l)}var a,o=null,s=e().document;return{open:r,close:a}},AdmanHTML.ResearchAdRenderer=function(t,e){function r(k,L){var D=[];return k.forEach(function(P){P.name===L&&D.push(P)}),D}function i(k,L,D){return L<=k&&(!D||D>=k)}function n(){!_&&b&&(_=!0,e.log("playbackPaused"))}function a(){_&&b&&(_=!1,e.log("playbackResumed"))}function o(){b=!1,_=!1,m.stop()}function s(k){var L=!k;L!==S&&(S=L,e.log(L?"volumeOff":"volumeOn"))}function l(){b&&(E&&c(E,E),d&&C.forEach(function(k){k.completed||(k.completed=!0,!k.viewable&&AdmanHTML.Utils.loadImg(k.url))}),o())}function u(k){e.log(k?"fullscreenOn":"fullscreenOff")}function c(k,L){if(!isNaN(k)){b||(b=!0,m.start(t.playerEl,e,!0),e.log("playbackStarted")),k=Math.round(k);var D=M!==null?k-M:null;if(M=k,e.log("thresholdValue",k),!isNaN(L)&&isFinite(L)&&L>0&&(L=Math.round(L),E=L,e.log("thresholdPValue",Math.floor(k/L*100))),D<0&&e.log("rewind"),A.forEach(function(V){if(i(k,V.start,V.end)){var Y=Math.floor((k-V.start)/V.rate);Y>0&&V.last!==Y&&(V.last=Y,AdmanHTML.Utils.loadImg(V.url.replace("[CONTENTPLAYHEAD]",k)))}else V.last=null}),d!==!1&&D!==0){var P,F=D<0||D>1;C.forEach(function(V){if(i(k,V.start,V.end)&&!V.completed){P=P||m.getViewabilityState(),d=P.state==="DETERMINED";var Y=P.percent>V.percent&&P.focus;V.duration=V.duration||0,V.lastViewable&&Y&&!F?V.duration+=D:V.duration=0,V.lastViewable=Y,V.duration>=V.value&&(V.completed=!0,V.viewable&&AdmanHTML.Utils.loadImg(V.url))}else V.duration=0,V.lastViewable=!1})}}}var d,v=e.getExtendedAdForApp().statistics,m=new AdmanHTML.Viewability,b=!1,_=!1,S=!1,M=null,E=null,C=r(v,"mrcValue"),A=r(v,"timerValue");return{pause:n,resume:a,setVolume:s,setPosition:c,setComplete:l,setFullscreen:u}},AdmanHTML.StatisticsAdRenderer=function(t,e){function r(){e.log("playbackStarted"),AdmanHTML.Utils.setTimeout(function(){t.cb("onCompleted")})}return{start:r}},AdmanHTML.SwfAdRenderer=function(t,e){function r(){n.start(),AdmanHTML.Utils.checkFlashAsync(function(a){a===AdmanHTML.Utils.FLASH_READY?(n.registerTimer(),n.setView(i(e.getAd().src,{width:"100%",height:"100%"},{}),{position:"absolute",top:0,left:0,right:0,bottom:0,"background-color":"black"}),e.log("render"),n.onStart()):t.cb("onError")})}function i(a,o,s){var l,u,c=o||{},d=s||{};c.type="application/x-shockwave-flash",window.ActiveXObject?(c.classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",d.movie=a):c.data=a,u="');return u+=""}var n=new AdmanHTML.AdRenderer(t,e);return{start:r,skip:n.skip,dispose:n.dispose,createSwfObject:i,super:n}},AdmanHTML.TextAdRenderer=function(t,e){function r(){n.start(),n.registerTimer(),AdmanHTML.Utils.addCss(l,s);var c=AdmanHTML.Utils.mixin({header:"",body:"",hyperlinkText:""},e.getAd());n.setView(AdmanHTML.Utils.renderTemplate(u,c),{position:"absolute",margin:"0 auto",left:0,right:0,bottom:0,"box-sizing":"border-box",overflow:"hidden"});var d=e.getSettings();if(d&&d.advertisment&&d.advertisment.text){var v=d.advertisment.text;AdmanHTML.StyleUtils.applyStyle(n.mainEl,v,"fontFace width height contentPadding hasBackground backgroundColor backgroundAlpha cornerRounding".split(" ")),AdmanHTML.StyleUtils.applyStyle(n.mainEl.querySelector(".rb-adman_header"),v,"headerColor headerSize headerUnderline headerBold headerIndent".split(" ")),AdmanHTML.StyleUtils.applyStyle(n.mainEl.querySelector(".rb-adman_header_text"),v,["headerUnderlineOnRollOver"]),AdmanHTML.StyleUtils.applyStyle(n.mainEl.querySelector(".rb-adman_body"),v,"bodyColor bodySize bodyUnderline bodyLeading bodyIndent bodyPaddingRight".split(" ")),AdmanHTML.StyleUtils.applyStyle(n.mainEl.querySelector(".rb-adman_link"),v,"hyperlinkColor hyperlinkSize hyperlinkUnderline hyperlinkIndent".split(" "));var m=d.advertisment.text.ageRestrictions,b=n.mainEl.querySelector(".rb-adman_age_wrapper");c.ageRestrictions?m&&(AdmanHTML.StyleUtils.applyStyle(b,m),AdmanHTML.StyleUtils.applyStyle(b.querySelector(".rb-adman_age_content"),m,["textUnderline"])):b.parentNode.removeChild(b);var _=n.mainEl.querySelector(".rb-adman_image_wrapper span");if(v.noImage)_.parentNode.removeChild(_);else if(v.contentPadding&&(_.style.marginRight=AdmanHTML.StyleUtils.getLength(v.contentPadding)),v.maxImageHeight||v.maxImageWidth){var S=c.width/c.height;_.style.width=AdmanHTML.StyleUtils.getLength(Math.round(v.maxImageWidth||v.maxImageHeight*S)),_.style.height=AdmanHTML.StyleUtils.getLength(Math.round(v.maxImageHeight||v.maxImageWidth/S))}}a.setWrapper(n.mainEl),a.start(),o.render(),e.log("render"),n.onStart()}function i(){n.dispose(),a.dispose(),o.dispose()}var n=new AdmanHTML.AdRenderer(t,e),a=new AdmanHTML.CloseBtnRenderer(t,e),o=new AdmanHTML.DisclaimerRenderer(t,e),s="rb-adman-text-style",l=".rb-adman_text_overlay {display:block; overflow:hidden;height:100%;cursor:pointer;color:#fff}.rb-adman_text_overlay .rb-adman_image_wrapper {display:block;float:left;position:relative;height:100%;vertical-align:middle}.rb-adman_text_overlay .rb-adman_image_wrapper span {display:inline-block;vertical-align:middle;background-size:contain;background-position:center}.rb-adman_text_overlay .rb-adman_text_wrapper {display:block;overflow:hidden;height:100%;vertical-align:top;line-height:1.2}.rb-adman_text_overlay .rb-adman_header {display:block;white-space:nowrap;margin-right:20px;overflow:hidden;text-overflow:ellipsis}.rb-adman_text_overlay .rb-adman_age_wrapper {display:inline-block; vertical-align:middle;border:0px solid transparent;margin-right:1px;text-decoration:none!important}.rb-adman_text_overlay .rb-adman_header_text {color:inherit;text-decoration:none;letter-spacing:normal;line-height:1.5;vertical-align:middle}.rb-adman_text_overlay .rb-adman_header_text:hover {color:inherit;text-decoration:underline}.rb-adman_text_overlay .rb-adman_body {padding:2px 0}.rb-adman_text_overlay .rb-adman_body, .rb-adman_link {display:block;text-decoration:none;padding-top:2px}",u='
{{ageRestrictions}}{{header}}{{body}}{{hyperlinkText}}
';return{start:r,pause:n.pause,resume:n.resume,skip:n.skip,dispose:i}},AdmanHTML.VideoAdRenderer=function(t,e){function r(){d.mainEl=t.videoEl,d.clickEl=t.clickEl||d.mainEl,b.forEach(function(A){d.mainEl.addEventListener(A,o)}),d.mainEl.parentNode?M={src:d.mainEl.src,time:d.mainEl.currentTime,muted:d.mainEl.muted}:d.setView(null,{position:"absolute",width:"100%",height:"100%",top:0}),d.mainEl.controls=t.browser.mobile,d.mainEl.src=e.getAd().src,d.mainEl.load(),e.log("render"),l(0),u=d.mainEl.play(),u&&u.then&&u.then(s,function(){d.mainEl.muted=!0,u=d.mainEl.play(),u.then(s,function(){})}),d.start(),v.render(),m.render()}function i(A){return A.indexOf("videolink.mycdn.me")!==-1}function n(){v.dispose(),m.dispose(),d.dispose(),b.forEach(function(A){d.mainEl.removeEventListener(A,o)}),M.src?(d.mainEl.src=M.src,d.mainEl.load(),d.mainEl.play(),l(M.time)):(d.mainEl.src="",d.mainEl.removeAttribute&&d.mainEl.removeAttribute("src"))}function a(A){if(A.indexOf("mradx")!==-1)return"rb";if(A.indexOf("videolink.mycdn.me")!==-1)return"ev";var k=new URL(A);return"evcdn:"+("hostname"in k?k.hostname:"")}function o(A){switch(A.type){case"loadstart":c=Date.now();break;case"loadeddata":E||(E=!0,C=Date.now()-c,t.stats.logMessage("firstLoadedData",C,{banner_id:S.bannerID,duration:Math.round(d.mainEl.duration),geo:S.geo!=="undefined"?S.geo:void 0,one_video_src:i(d.mainEl.src),slot:"slotId"in S?S.slotId:"no_slot_id",video_source:a(d.mainEl.src),resolution:("width"in S?S.width:"no_ad_width")+"x"+("height"in S?S.height:"no_ad_height"),label:"experimentLabel"in S?S.experimentLabel:""}));break;case"loadedmetadata":t.stats.metrics("ready"),t.stats.metrics("creative_type","video"),v.onTimeRemained(d.mainEl.currentTime,d.mainEl.duration);break;case"playing":u||s();break;case"play":t.cb("onPlayed");break;case"pause":t.cb("onPaused");break;case"timeupdate":d.onTimeRemained(d.mainEl.currentTime,d.mainEl.duration),v.onTimeRemained(d.mainEl.currentTime,d.mainEl.duration);break;case"ended":t.playStatus||(t.playStatus={}),t.playStatus.prevStatus=t.playStatus.curStatus,t.playStatus.curStatus="pause",t.cb("onCompleted"),t.stats.metrics("completed");break;case"error":var k=A.target&&typeof A.target=="object"&&A.target.error&&typeof A.target.error=="object"&&A.target.error.code?A.target.error.code:"unknown_code",L="video_el_err_code:"+k;t.stats.logError(L),t.stats.metrics("media_error_code",k),t.cb("onError")}}function s(){if(!_){_=!0;var A=AdmanHTML.Utils.isElement(d.mainEl)?d.mainEl:d.wrapperEl;t.viewability.start(A,e),d.onStart({muted:d.mainEl.muted})}}function l(A){if(d.mainEl)try{d.mainEl.currentTime=A}catch{}}var u,c,d=new AdmanHTML.AdRenderer(t,e),v=new AdmanHTML.DisclaimerRenderer(t,e),m=new AdmanHTML.CallToActionBtnRenderer(t,e),b=["loadstart","loadeddata","loadedmetadata","error","pause","play","playing","timeupdate","ended"],_=!1,S=e.getAd(),M={},E=!1,C=null;return{start:function(){t.playStatus||(t.playStatus={}),t.playStatus.prevStatus=t.playStatus.curStatus,t.playStatus.curStatus="play",r(),t.stats.metrics("playing")},skip:function(){t.playStatus||(t.playStatus={}),t.playStatus.prevStatus=t.playStatus.curStatus,t.playStatus.curStatus="pause",t.stats.metrics("skipped"),d.skip.apply(t,arguments)},dispose:function(){t.playStatus||(t.playStatus={}),t.playStatus.prevStatus=t.playStatus.curStatus,t.playStatus.curStatus="pause",n()},pause:function(){t.playStatus||(t.playStatus={}),t.playStatus.prevStatus=t.playStatus.curStatus,t.playStatus.curStatus="pause",d.mainEl.pause()},resume:function(){t.playStatus||(t.playStatus={}),t.playStatus.prevStatus=t.playStatus.curStatus,t.playStatus.curStatus="play",d.mainEl.play()},setVolume:function(A){var k=d.mainEl.muted?0:d.mainEl.volume;A>0&&d.mainEl.muted&&(d.mainEl.muted=!1),A===0&&(d.mainEl.muted=!0),d.mainEl.volume=A,(k===0&&A>0||k>0&&A===0)&&e.log(A?"volumeOn":"volumeOff")}}},AdmanHTML.VpaidJsAdRenderer=function(t,e){function r(){var G;if(!l)return L.duration;try{G=l.callGet("adDuration"),G===void 0&&(G=L.duration)}catch{G=L.duration}return G}function i(){if(A.start(),k.render(),AdmanHTML.Utils.isElement(t.videoEl)){var G=AdmanHTML.Utils.getElementViewport;G(t.videoEl)===G(A.wrapperEl)&&(t.videoEl.parentNode?(c=t.videoEl.parentNode,d=t.videoEl.nextSibling):u=!0,A.wrapperEl.insertBefore(t.videoEl,A.wrapperEl.childNodes[0]),AdmanHTML.Utils.mixin(t.videoEl.style,{position:"absolute",width:"100%",height:"100%",top:0,display:"block"}))}var W=e.getSettings();W&&(W.loadTimeout&&(D=W.loadTimeout),W.startTimeout&&(P=W.startTimeout)),AdmanHTML.Utils.isNRVpaid(L.src)&&typeof L.timeoutsFactor=="number"&&L.timeoutsFactor>1&&(D*=L.timeoutsFactor,P*=L.timeoutsFactor),t.cb("onStarted",[e.sectionType,e.getAdForApp()||{}]),a(D,"EXTERNAL_JS_ADVERTISMENT_TIMEOUT:LoadInterface"),l.urlToNavigateOnClick=e.getAd().urlToNavigateOnClick,A.setView(l.load(L.src,t.config.vpaidHtmlInterface),{position:"absolute",top:0,left:0,right:0,bottom:0,"background-color":"transparent"}),e.log("render")}function n(){u&&t.videoEl.parentNode?t.videoEl.parentNode.removeChild(t.videoEl):c&&c.insertBefore(t.videoEl,d&&d.parentNode?d:null),o(),l.destroy(),k.dispose(),A.dispose()}function a(G,W){o(),M=W,m=setTimeout(s,G)}function o(){clearTimeout(m)}function s(){S=!0,o(),e.log("error"),M&&t.stats.logError(M,{bannerID:L.bannerID,isNRVpaid:AdmanHTML.Utils.isNRVpaid(L.src)}),t.cb("onError",{force:!0,message:M})}var l,u,c,d,v,m,b,_,S,M,E,C,A=new AdmanHTML.AdRenderer(t,e),k=new AdmanHTML.DisclaimerRenderer(t,e),L=e.getAd(),D=500,P=1e3;A.onResize=function(G,W){l&&l.call("resizeAd",[G,W,"normal"])},A.onClick=function(){};var F=function(G,W){if(!S){var J,te;switch(G){case"loaded":a(D,"EXTERNAL_JS_ADVERTISMENT_TIMEOUT:LoadJs");break;case"vpaidloaded":o();break;case"inited":l.call("handshakeVersion",["2.0"])?(a(P,"EXTERNAL_JS_ADVERTISMENT_TIMEOUT:InitAd"),l.call("initAd",[A.mainEl.offsetWidth,A.mainEl.offsetHeight,"normal",L.bitrate,{AdParameters:L.params}])):t.cb("onError");break;case"AdStarted":o(),_=l.callGet("adVolume"),b===void 0||l.autoMuted||l.callSet("adVolume",b),e.log("playbackStarted"),t.viewability.start(A.mainEl,e),t.cb("onVPAIDStarted"),t.stats.metrics("playing");break;case"AdLoaded":a(P,"EXTERNAL_JS_ADVERTISMENT_TIMEOUT:StartAd"),l.call("startAd"),t.stats.metrics("ready"),t.stats.metrics("creative_type","vpaid");break;case"AdRemainingTimeChange":J=r(),te=l.callGet("adRemainingTime"),J>0&&te>=0?(A.onTimeRemained(J-te,J),k.onTimeRemained(J-te,J)):t.cb("onDurationChanged",[{remained:te,duration:J}]);break;case"AdVolumeChange":var Q=l.callGet("adVolume");(_===0&&Q>0||_>0&&Q===0)&&e.log(Q?"volumeOn":"volumeOff"),_=Q;break;case"AdVideoComplete":t.playStatus||(t.playStatus={}),t.playStatus.prevStatus=t.playStatus.curStatus,t.playStatus.curStatus="pause",J=r(),A.onTimeRemained(J,J);break;case"AdStopped":case"AdSkipped":E||(E=!0,setTimeout(function(){v?v():t.cb("onCompleted")})),t.stats.metrics(G==="AdStopped"?"completed":"skipped");break;case"AdClickThru":W.url&&W.playerHandles&&window.open(W.url,"_blank"),e.log("click"),t.cb("onClicked");break;case"AdError":t.stats.logError("EXTERNAL_JS_ADVERTISMENT_ERROR:"+(W&&W.message||"")),t.stats.metrics("vpaid_error_message",W&&W.message||"vpaid script err"),t.cb("onError");break;case"AdPaused":C||(C=!0,t.cb("onPaused"));break;case"AdPlaying":C&&(C=!1,t.cb("onPlayed"));break;case"AdUserClose":e.log("closedByUser");break;case"video:pause":C||l&&l.call("pauseAd");break;case"video:play":C&&l&&l.call("resumeAd")}}},V=t.wrapper.ownerDocument,Y=V.defaultView||V.parentWindow;return l=new AdmanHTML.VpaidLoader(t.videoEl,Y),l.onVpaidEvent(F),{start:function(){t.playStatus||(t.playStatus={}),t.playStatus.prevStatus=t.playStatus.curStatus,t.playStatus.curStatus="play",i()},dispose:function(){t.playStatus||(t.playStatus={}),t.playStatus.prevStatus=t.playStatus.curStatus,t.playStatus.curStatus="pause",n()},pause:function(){t.playStatus||(t.playStatus={}),t.playStatus.prevStatus=t.playStatus.curStatus,t.playStatus.curStatus="pause",l&&l.call("pauseAd")},resume:function(){t.playStatus||(t.playStatus={}),t.playStatus.prevStatus=t.playStatus.curStatus,t.playStatus.curStatus="play",l&&l.call("resumeAd")},setVolume:function(G){l&&l.callSet("adVolume",G),b=G},skip:function(G){t.playStatus||(t.playStatus={}),t.playStatus.prevStatus=t.playStatus.curStatus,t.playStatus.curStatus="pause",v=G;try{l&&l.call("skipAd")}catch{}t.stats.metrics("skipped")}}},AdmanHTML.VpaidSwfAdRenderer=function(t,e){function r(){var k;if(!l)return M.duration;try{k=l.callGet("adDuration")||M.duration}catch{k=M.duration}return k}function i(){S.start();var k=e.getSettings();k&&(k.loadTimeout&&(C=k.loadTimeout),k.startTimeout&&(A=k.startTimeout)),AdmanHTML.Utils.checkFlashAsync(function(L){if(L===AdmanHTML.Utils.FLASH_READY){t.cb("onStarted",[e.sectionType,e.getAdForApp()||{}]),a(C);var D="vpaidSwfUrl="+encodeURIComponent(M.src)+"&proxyMethodName="+E;S.setView(b.createSwfObject(t.config.vpaidJsInterface,{width:"100%",height:"100%"},{flashvars:D,allowScriptAccess:"always",wmode:"opaque"}),{position:"absolute",top:0,left:0,right:0,bottom:0,"background-color":"black"})}else t.cb("onError")}),_.render(),e.log("render")}function n(){o(),S.dispose(),_.dispose(),window[E]=null}function a(k){o(),c=setTimeout(s,k)}function o(){clearTimeout(c)}function s(){m=!0,o(),e.log("error"),t.cb("onError")}var l,u,c,d,v,m,b=new AdmanHTML.SwfAdRenderer(t,e),_=new AdmanHTML.DisclaimerRenderer(t,e),S=b.super,M=e.getAd(),E="vpaidProxyMethod"+Date.now(),C=500,A=1e3;return S.onResize=function(k,L){l&&l.call("resizeAd",[k,L,"normal"])},S.onClick=function(){},window[E]=function(k,L){if(!m){var D;switch(k){case"loaded":a(C);break;case"vpaidloaded":o();break;case"inited":l=S.mainEl.getElementsByTagName("object")[0],l.call("handshakeVersion",["2.0"])?(a(A),l.call("initAd",[S.mainEl.offsetWidth,S.mainEl.offsetHeight,"normal",M.bitrate,M.params,""])):t.cb("onError");break;case"AdStarted":o(),v=l.callGet("adVolume"),d!==void 0&&l.callSet("adVolume",d),e.log("playbackStarted"),t.viewability.start(S.mainEl,e),t.cb("onVPAIDStarted");break;case"AdLoaded":a(A),l.call("startAd");break;case"AdRemainingTimeChange":D=r(),S.onTimeRemained(D-l.callGet("adRemainingTime"),D),_.onTimeRemained(D-l.callGet("adRemainingTime"),D);break;case"AdVolumeChange":var P=l.callGet("adVolume");(v===0&&P>0||v>0&&P===0)&&e.log(P?"volumeOn":"volumeOff"),v=P;break;case"AdVideoComplete":D=r(),S.onTimeRemained(D,D);break;case"AdStopped":case"AdSkipped":setTimeout(function(){u?u():t.cb("onCompleted")});break;case"AdClickThru":e.log("click"),t.cb("onClicked");break;case"AdError":t.stats.logError("EXTERNAL_SWF_ADVERTISMENT_ERROR:"+(L&&L.message||"")),t.cb("onError");break;case"AdPaused":t.cb("onPaused");break;case"AdPlaying":t.cb("onPlayed");break;case"AdUserClose":e.log("closedByUser")}}},{start:i,dispose:n,pause:function(){l&&l.call("pauseAd")},resume:function(){l&&l.call("resumeAd")},setVolume:function(k){l&&l.callSet("adVolume",k),d=k},skip:function(k){u=k;try{l&&l.call("skipAd")}catch{}}}},window.admanAsyncLoader?setTimeout(admanAsyncLoader):window.admanAsyncInit&&setTimeout(admanAsyncInit);const uFe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));let qb;const cFe=new Uint8Array(16);function dFe(){if(!qb&&(qb=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!qb))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return qb(cFe)}const mo=[];for(let t=0;t<256;++t)mo.push((t+256).toString(16).slice(1));function hFe(t,e=0){return(mo[t[e+0]]+mo[t[e+1]]+mo[t[e+2]]+mo[t[e+3]]+"-"+mo[t[e+4]]+mo[t[e+5]]+"-"+mo[t[e+6]]+mo[t[e+7]]+"-"+mo[t[e+8]]+mo[t[e+9]]+"-"+mo[t[e+10]]+mo[t[e+11]]+mo[t[e+12]]+mo[t[e+13]]+mo[t[e+14]]+mo[t[e+15]]).toLowerCase()}const bU={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function pFe(t,e,r){if(bU.randomUUID&&!t)return bU.randomUUID();t=t||{};const i=t.random||(t.rng||dFe)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,hFe(i)}var fFe=Object.defineProperty,vFe=Object.defineProperties,mFe=Object.getOwnPropertyDescriptors,Yb=Object.getOwnPropertySymbols,_U=Object.prototype.hasOwnProperty,yU=Object.prototype.propertyIsEnumerable,SU=(t,e,r)=>e in t?fFe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,No=(t,e)=>{for(var r in e||(e={}))_U.call(e,r)&&SU(t,r,e[r]);if(Yb)for(var r of Yb(e))yU.call(e,r)&&SU(t,r,e[r]);return t},Do=(t,e)=>vFe(t,mFe(e)),j2=(t,e)=>{var r={};for(var i in t)_U.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&Yb)for(var i of Yb(t))e.indexOf(i)<0&&yU.call(t,i)&&(r[i]=t[i]);return r},gFe=(t=>(t[t.NoVideo=0]="NoVideo",t[t.NoEOV=1]="NoEOV",t[t.NoBranches=2]="NoBranches",t))(gFe||{}),bFe="3.3",EU=(t=>(t.Choice="Choice",t.TextInput="TextInput",t))(EU||{}),IS=(t=>(t.Button="Button",t.Area="Area",t.Text="Text",t))(IS||{}),TU=(t=>(t.onClick="onClick",t.onSuspense="onSuspense",t))(TU||{}),fn=(t=>(t.openURI="openURI",t.setNextBranch="setNextBranch",t.setWeightlessRandomBranch="setWeightlessRandomBranch",t.setRandomBranch="setRandomBranch",t.setMaxWeightBranch="setMaxWeightBranch",t.setMinWeightBranch="setMinWeightBranch",t.setDefaultBranch="setDefaultBranch",t.continuePlayback="continuePlayback",t.expect="expect",t))(fn||{}),_Fe="3.1",wU=(t,e,r,i)=>{switch(e){case"setNextBranch":return{type:t,action:{type:e,args:{branchId:r,shouldOpenNow:!0}}};case"continuePlayback":return{type:t,action:{type:e,args:{shouldOpenNow:!0}}};case"openURI":return{type:t,action:{type:e,args:{isDetachContainer:!0,shouldOpenNow:!0,uri:i}}}}},yFe=t=>{let e=[];for(let r of t.chapters){let i,n=[];for(let s of r.branches){let l=s,{isDefault:u}=l,c=j2(l,["isDefault"]);u&&(i=c.id),n.push(c)}let a,o=[];for(let s of r.containers){let l=s,{fallbackStrategy:u}=l,c=j2(l,["fallbackStrategy"]);switch(u){case"await":a=[];break;case"default":a=[{type:"onSuspense",action:{type:"setNextBranch",args:{branchId:i,shouldOpenNow:!0}}}];break;case"weightlessRandom":case"random":a=[{type:"onSuspense",action:{type:"setRandomBranch",args:{shouldOpenNow:!0}}}];break}for(let d of c.controls)o.push(Do(No({},c),{controls:[Do(No({},d),{events:d.subtype==="Text"||d.events.length?d.events:[wU("onClick","continuePlayback")]})],id:pFe(),events:[{type:"onSuspense",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}]}))}e.push(Do(No({},r),{containers:o,events:a,branches:n}))}return t.metadata.version=_Fe,t.metadata.updated=new Date().toISOString(),Do(No({},t),{chapters:e})},SFe="3.2",EFe=t=>{let e=t.metadata,{media:r}=e,i=j2(e,["media"]);if(typeof r=="string")throw new Error("Manifest media should be parsed");return{chapters:t.chapters,metadata:Do(No({},i),{version:SFe}),media:r}},TFe=(t,e)=>({type:"onSuspense",action:{type:t,args:{branchId:e,shouldOpenNow:!0}}}),OS=(t,e)=>e.map(r=>r.action.args.branchId&&t.includes(r.action.args.branchId)?Do(No({},r),{action:Do(No({},r.action),{args:Do(No({},r.action.args),{branchId:void 0})})}):r),wFe=(t,e)=>e.length?Do(No({},t),{branches:t.branches.filter(r=>!e.includes(r.id)),containers:t.containers.map(r=>Do(No({},r),{controls:r.controls.map(i=>Do(No({},i),{events:OS(e,i.events)})),events:OS(e,r.events)})),events:OS(e,t.events)}):t,AFe=(t=[])=>({edit:{chapters:t},view:{}}),MFe=t=>{let e=[],r=[];for(let i of t.chapters){let n=i,{x:a,y:o}=n,s=j2(n,["x","y"]),l=Array.isArray(i.events)&&!i.events.length,u=[],c=s.containers.map(d=>{var v;return Do(No({},d),{events:(l?(v=d.events)==null?void 0:v.map(m=>m.type==="onSuspense"?(m.action.args.branchId&&u.push(m.action.args.branchId),TFe("expect")):m):d.events)||[],controls:d.controls.map(m=>{var b=m,{subtype:_}=b,S=j2(b,["subtype"]);return Do(No({},S),{type:_,events:S.events||[wU("onClick","continuePlayback")]})})})});e.push(wFe(Do(No({},s),{containers:c,events:i.events||[]}),u)),r.push({id:s.id,x:a,y:o})}return Do(No({},t),{chapters:e,graph:AFe(r),metadata:Do(No({},t.metadata),{version:bFe})})},CFe=[{version:"3.0",migrate:yFe},{version:"3.1",migrate:EFe},{version:"3.2",migrate:MFe}],AU=t=>CFe.reduce((e,r)=>e.metadata.version===r.version?r.migrate(e):e,t),MU=(t="",e="")=>{let r=t.split("."),i=e.split("."),n=Math.max(r.length,i.length),a=0;for(let o=0;oi[o]?a=1:r[o](t.Failed="ManifestParsingFailed",t.UnsupportedVersion="ManifestUnsupportedVersion",t))(xFe||{}),kFe="3.0.0",LFe="3.3.0",PS=t=>{let e=MU(t,kFe);return e===-1?!1:e===0?!0:MU(t,LFe)!==1},$Fe=Object.create,CU=Object.defineProperty,RFe=Object.getOwnPropertyDescriptor,IFe=Object.getOwnPropertyNames,OFe=Object.getPrototypeOf,PFe=Object.prototype.hasOwnProperty,Pt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),NFe=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of IFe(e))!PFe.call(t,n)&&n!==r&&CU(t,n,{get:()=>e[n],enumerable:!(i=RFe(e,n))||i.enumerable});return t},gc=(t,e,r)=>(r=t!=null?$Fe(OFe(t)):{},NFe(CU(r,"default",{value:t,enumerable:!0}),t)),od=Pt((t,e)=>{var r=function(i){return i&&i.Math===Math&&i};e.exports=r(typeof globalThis=="object"&&globalThis)||r(typeof window=="object"&&window)||r(typeof self=="object"&&self)||r(typeof global=="object"&&global)||r(typeof t=="object"&&t)||(function(){return this})()||Function("return this")()}),bu=Pt((t,e)=>{e.exports=function(r){try{return!!r()}catch{return!0}}}),Xb=Pt((t,e)=>{var r=bu();e.exports=!r(function(){var i=(function(){}).bind();return typeof i!="function"||i.hasOwnProperty("prototype")})}),DFe=Pt((t,e)=>{var r=Xb(),i=Function.prototype,n=i.apply,a=i.call;e.exports=typeof Reflect=="object"&&Reflect.apply||(r?a.bind(n):function(){return a.apply(n,arguments)})}),bc=Pt((t,e)=>{var r=Xb(),i=Function.prototype,n=i.call,a=r&&i.bind.bind(n,n);e.exports=r?a:function(o){return function(){return n.apply(o,arguments)}}}),Qb=Pt((t,e)=>{var r=bc(),i=r({}.toString),n=r("".slice);e.exports=function(a){return n(i(a),8,-1)}}),xU=Pt((t,e)=>{var r=Qb(),i=bc();e.exports=function(n){if(r(n)==="Function")return i(n)}}),_u=Pt((t,e)=>{var r=typeof document=="object"&&document.all;e.exports=typeof r>"u"&&r!==void 0?function(i){return typeof i=="function"||i===r}:function(i){return typeof i=="function"}}),yf=Pt((t,e)=>{var r=bu();e.exports=!r(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})}),NS=Pt((t,e)=>{var r=Xb(),i=Function.prototype.call;e.exports=r?i.bind(i):function(){return i.apply(i,arguments)}}),kU=Pt(t=>{var e={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,i=r&&!e.call({1:2},1);t.f=i?function(n){var a=r(this,n);return!!a&&a.enumerable}:e}),LU=Pt((t,e)=>{e.exports=function(r,i){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:i}}}),VFe=Pt((t,e)=>{var r=bc(),i=bu(),n=Qb(),a=Object,o=r("".split);e.exports=i(function(){return!a("z").propertyIsEnumerable(0)})?function(s){return n(s)==="String"?o(s,""):a(s)}:a}),$U=Pt((t,e)=>{e.exports=function(r){return r==null}}),RU=Pt((t,e)=>{var r=$U(),i=TypeError;e.exports=function(n){if(r(n))throw new i("Can't call method on "+n);return n}}),Kb=Pt((t,e)=>{var r=VFe(),i=RU();e.exports=function(n){return r(i(n))}}),H2=Pt((t,e)=>{var r=_u();e.exports=function(i){return typeof i=="object"?i!==null:r(i)}}),Jb=Pt((t,e)=>{e.exports={}}),DS=Pt((t,e)=>{var r=Jb(),i=od(),n=_u(),a=function(o){return n(o)?o:void 0};e.exports=function(o,s){return arguments.length<2?a(r[o])||a(i[o]):r[o]&&r[o][s]||i[o]&&i[o][s]}}),BFe=Pt((t,e)=>{var r=bc();e.exports=r({}.isPrototypeOf)}),UFe=Pt((t,e)=>{var r=od(),i=r.navigator,n=i&&i.userAgent;e.exports=n?String(n):""}),FFe=Pt((t,e)=>{var r=od(),i=UFe(),n=r.process,a=r.Deno,o=n&&n.versions||a&&a.version,s=o&&o.v8,l,u;s&&(l=s.split("."),u=l[0]>0&&l[0]<4?1:+(l[0]+l[1])),!u&&i&&(l=i.match(/Edge\/(\d+)/),(!l||l[1]>=74)&&(l=i.match(/Chrome\/(\d+)/),l&&(u=+l[1]))),e.exports=u}),IU=Pt((t,e)=>{var r=FFe(),i=bu(),n=od(),a=n.String;e.exports=!!Object.getOwnPropertySymbols&&!i(function(){var o=Symbol("symbol detection");return!a(o)||!(Object(o)instanceof Symbol)||!Symbol.sham&&r&&r<41})}),OU=Pt((t,e)=>{var r=IU();e.exports=r&&!Symbol.sham&&typeof Symbol.iterator=="symbol"}),PU=Pt((t,e)=>{var r=DS(),i=_u(),n=BFe(),a=OU(),o=Object;e.exports=a?function(s){return typeof s=="symbol"}:function(s){var l=r("Symbol");return i(l)&&n(l.prototype,o(s))}}),zFe=Pt((t,e)=>{var r=String;e.exports=function(i){try{return r(i)}catch{return"Object"}}}),NU=Pt((t,e)=>{var r=_u(),i=zFe(),n=TypeError;e.exports=function(a){if(r(a))return a;throw new n(i(a)+" is not a function")}}),jFe=Pt((t,e)=>{var r=NU(),i=$U();e.exports=function(n,a){var o=n[a];return i(o)?void 0:r(o)}}),HFe=Pt((t,e)=>{var r=NS(),i=_u(),n=H2(),a=TypeError;e.exports=function(o,s){var l,u;if(s==="string"&&i(l=o.toString)&&!n(u=r(l,o))||i(l=o.valueOf)&&!n(u=r(l,o))||s!=="string"&&i(l=o.toString)&&!n(u=r(l,o)))return u;throw new a("Can't convert object to primitive value")}}),ZFe=Pt((t,e)=>{e.exports=!0}),GFe=Pt((t,e)=>{var r=od(),i=Object.defineProperty;e.exports=function(n,a){try{i(r,n,{value:a,configurable:!0,writable:!0})}catch{r[n]=a}return a}}),VS=Pt((t,e)=>{var r=ZFe(),i=od(),n=GFe(),a="__core-js_shared__",o=e.exports=i[a]||n(a,{});(o.versions||(o.versions=[])).push({version:"3.43.0",mode:r?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.43.0/LICENSE",source:"https://github.com/zloirock/core-js"})}),DU=Pt((t,e)=>{var r=VS();e.exports=function(i,n){return r[i]||(r[i]=n||{})}}),e6=Pt((t,e)=>{var r=RU(),i=Object;e.exports=function(n){return i(r(n))}}),Z2=Pt((t,e)=>{var r=bc(),i=e6(),n=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(a,o){return n(i(a),o)}}),VU=Pt((t,e)=>{var r=bc(),i=0,n=Math.random(),a=r(1.1.toString);e.exports=function(o){return"Symbol("+(o===void 0?"":o)+")_"+a(++i+n,36)}}),t6=Pt((t,e)=>{var r=od(),i=DU(),n=Z2(),a=VU(),o=IU(),s=OU(),l=r.Symbol,u=i("wks"),c=s?l.for||l:l&&l.withoutSetter||a;e.exports=function(d){return n(u,d)||(u[d]=o&&n(l,d)?l[d]:c("Symbol."+d)),u[d]}}),WFe=Pt((t,e)=>{var r=NS(),i=H2(),n=PU(),a=jFe(),o=HFe(),s=t6(),l=TypeError,u=s("toPrimitive");e.exports=function(c,d){if(!i(c)||n(c))return c;var v=a(c,u),m;if(v){if(d===void 0&&(d="default"),m=r(v,c,d),!i(m)||n(m))return m;throw new l("Can't convert object to primitive value")}return d===void 0&&(d="number"),o(c,d)}}),BU=Pt((t,e)=>{var r=WFe(),i=PU();e.exports=function(n){var a=r(n,"string");return i(a)?a:a+""}}),qFe=Pt((t,e)=>{var r=od(),i=H2(),n=r.document,a=i(n)&&i(n.createElement);e.exports=function(o){return a?n.createElement(o):{}}}),UU=Pt((t,e)=>{var r=yf(),i=bu(),n=qFe();e.exports=!r&&!i(function(){return Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a!==7})}),YFe=Pt(t=>{var e=yf(),r=NS(),i=kU(),n=LU(),a=Kb(),o=BU(),s=Z2(),l=UU(),u=Object.getOwnPropertyDescriptor;t.f=e?u:function(c,d){if(c=a(c),d=o(d),l)try{return u(c,d)}catch{}if(s(c,d))return n(!r(i.f,c,d),c[d])}}),XFe=Pt((t,e)=>{var r=bu(),i=_u(),n=/#|\.prototype\./,a=function(c,d){var v=s[o(c)];return v===u?!0:v===l?!1:i(d)?r(d):!!d},o=a.normalize=function(c){return String(c).replace(n,".").toLowerCase()},s=a.data={},l=a.NATIVE="N",u=a.POLYFILL="P";e.exports=a}),FU=Pt((t,e)=>{var r=xU(),i=NU(),n=Xb(),a=r(r.bind);e.exports=function(o,s){return i(o),s===void 0?o:n?a(o,s):function(){return o.apply(s,arguments)}}}),QFe=Pt((t,e)=>{var r=yf(),i=bu();e.exports=r&&i(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})}),KFe=Pt((t,e)=>{var r=H2(),i=String,n=TypeError;e.exports=function(a){if(r(a))return a;throw new n(i(a)+" is not an object")}}),JFe=Pt(t=>{var e=yf(),r=UU(),i=QFe(),n=KFe(),a=BU(),o=TypeError,s=Object.defineProperty,l=Object.getOwnPropertyDescriptor,u="enumerable",c="configurable",d="writable";t.f=e?i?function(v,m,b){if(n(v),m=a(m),n(b),typeof v=="function"&&m==="prototype"&&"value"in b&&d in b&&!b[d]){var _=l(v,m);_&&_[d]&&(v[m]=b.value,b={configurable:c in b?b[c]:_[c],enumerable:u in b?b[u]:_[u],writable:!1})}return s(v,m,b)}:s:function(v,m,b){if(n(v),m=a(m),n(b),r)try{return s(v,m,b)}catch{}if("get"in b||"set"in b)throw new o("Accessors not supported");return"value"in b&&(v[m]=b.value),v}}),eze=Pt((t,e)=>{var r=yf(),i=JFe(),n=LU();e.exports=r?function(a,o,s){return i.f(a,o,n(1,s))}:function(a,o,s){return a[o]=s,a}}),G2=Pt((t,e)=>{var r=od(),i=DFe(),n=xU(),a=_u(),o=YFe().f,s=XFe(),l=Jb(),u=FU(),c=eze(),d=Z2();VS();var v=function(m){var b=function(_,S,M){if(this instanceof b){switch(arguments.length){case 0:return new m;case 1:return new m(_);case 2:return new m(_,S)}return new m(_,S,M)}return i(m,this,arguments)};return b.prototype=m.prototype,b};e.exports=function(m,b){var _=m.target,S=m.global,M=m.stat,E=m.proto,C=S?r:M?r[_]:r[_]&&r[_].prototype,A=S?l:l[_]||c(l,_,{})[_],k=A.prototype,L,D,P,F,V,Y,G,W,J;for(F in b)L=s(S?F:_+(M?".":"#")+F,m.forced),D=!L&&C&&d(C,F),Y=A[F],D&&(m.dontCallGetSet?(J=o(C,F),G=J&&J.value):G=C[F]),V=D&&G?G:b[F],!(!L&&!E&&typeof Y==typeof V)&&(m.bind&&D?W=u(V,r):m.wrap&&D?W=v(V):E&&a(V)?W=n(V):W=V,(m.sham||V&&V.sham||Y&&Y.sham)&&c(W,"sham",!0),c(A,F,W),E&&(P=_+"Prototype",d(l,P)||c(l,P,{}),c(l[P],F,V),m.real&&k&&(L||!k[F])&&c(k,F,V)))}}),tze=Pt((t,e)=>{var r=Math.ceil,i=Math.floor;e.exports=Math.trunc||function(n){var a=+n;return(a>0?i:r)(a)}}),r6=Pt((t,e)=>{var r=tze();e.exports=function(i){var n=+i;return n!==n||n===0?0:r(n)}}),rze=Pt((t,e)=>{var r=r6(),i=Math.max,n=Math.min;e.exports=function(a,o){var s=r(a);return s<0?i(s+o,0):n(s,o)}}),ize=Pt((t,e)=>{var r=r6(),i=Math.min;e.exports=function(n){var a=r(n);return a>0?i(a,9007199254740991):0}}),i6=Pt((t,e)=>{var r=ize();e.exports=function(i){return r(i.length)}}),zU=Pt((t,e)=>{var r=Kb(),i=rze(),n=i6(),a=function(o){return function(s,l,u){var c=r(s),d=n(c);if(d===0)return!o&&-1;var v=i(u,d),m;if(o&&l!==l){for(;d>v;)if(m=c[v++],m!==m)return!0}else for(;d>v;v++)if((o||v in c)&&c[v]===l)return o||v||0;return!o&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}}),BS=Pt((t,e)=>{e.exports=function(){}}),nze=Pt(()=>{var t=G2(),e=zU().includes,r=bu(),i=BS(),n=r(function(){return!Array(1).includes()});t({target:"Array",proto:!0,forced:n},{includes:function(a){return e(this,a,arguments.length>1?arguments[1]:void 0)}}),i("includes")}),US=Pt((t,e)=>{var r=DS();e.exports=r}),aze=Pt((t,e)=>{nze();var r=US();e.exports=r("Array","includes")}),oze=Pt((t,e)=>{var r=aze();e.exports=r}),FS=Pt((t,e)=>{var r=oze();e.exports=r}),sze=Pt(()=>{var t=G2(),e=e6(),r=i6(),i=r6(),n=BS();t({target:"Array",proto:!0},{at:function(a){var o=e(this),s=r(o),l=i(a),u=l>=0?l:s+l;return u<0||u>=s?void 0:o[u]}}),n("at")}),lze=Pt((t,e)=>{sze();var r=US();e.exports=r("Array","at")}),uze=Pt((t,e)=>{var r=lze();e.exports=r}),jU=Pt((t,e)=>{var r=uze();e.exports=r}),cze=Pt((t,e)=>{var r=DU(),i=VU(),n=r("keys");e.exports=function(a){return n[a]||(n[a]=i(a))}}),dze=Pt((t,e)=>{var r=bu();e.exports=!r(function(){function i(){}return i.prototype.constructor=null,Object.getPrototypeOf(new i)!==i.prototype})}),hze=Pt((t,e)=>{var r=Z2(),i=_u(),n=e6(),a=cze(),o=dze(),s=a("IE_PROTO"),l=Object,u=l.prototype;e.exports=o?l.getPrototypeOf:function(c){var d=n(c);if(r(d,s))return d[s];var v=d.constructor;return i(v)&&d instanceof v?v.prototype:d instanceof l?u:null}}),pze=Pt((t,e)=>{e.exports={}}),fze=Pt((t,e)=>{var r=bc(),i=Z2(),n=Kb(),a=zU().indexOf,o=pze(),s=r([].push);e.exports=function(l,u){var c=n(l),d=0,v=[],m;for(m in c)!i(o,m)&&i(c,m)&&s(v,m);for(;u.length>d;)i(c,m=u[d++])&&(~a(v,m)||s(v,m));return v}}),vze=Pt((t,e)=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]}),mze=Pt((t,e)=>{var r=fze(),i=vze();e.exports=Object.keys||function(n){return r(n,i)}}),HU=Pt((t,e)=>{var r=yf(),i=bu(),n=bc(),a=hze(),o=mze(),s=Kb(),l=kU().f,u=n(l),c=n([].push),d=r&&i(function(){var m=Object.create(null);return m[2]=2,!u(m,2)}),v=function(m){return function(b){for(var _=s(b),S=o(_),M=d&&a(_)===null,E=S.length,C=0,A=[],k;E>C;)k=S[C++],(!r||(M?k in _:u(_,k)))&&c(A,m?[k,_[k]]:_[k]);return A}};e.exports={entries:v(!0),values:v(!1)}}),gze=Pt(()=>{var t=G2(),e=HU().entries;t({target:"Object",stat:!0},{entries:function(r){return e(r)}})}),bze=Pt((t,e)=>{gze();var r=Jb();e.exports=r.Object.entries}),_ze=Pt((t,e)=>{var r=bze();e.exports=r}),yze=Pt((t,e)=>{var r=_ze();e.exports=r}),Sze=Pt(()=>{var t=G2(),e=HU().values;t({target:"Object",stat:!0},{values:function(r){return e(r)}})}),Eze=Pt((t,e)=>{Sze();var r=Jb();e.exports=r.Object.values}),Tze=Pt((t,e)=>{var r=Eze();e.exports=r}),zS=Pt((t,e)=>{var r=Tze();e.exports=r}),ZU=Pt((t,e)=>{var r=Qb();e.exports=Array.isArray||function(i){return r(i)==="Array"}}),wze=Pt((t,e)=>{var r=TypeError,i=9007199254740991;e.exports=function(n){if(n>i)throw r("Maximum allowed index exceeded");return n}}),Aze=Pt((t,e)=>{var r=ZU(),i=i6(),n=wze(),a=FU(),o=function(s,l,u,c,d,v,m,b){for(var _=d,S=0,M=m?a(m,b):!1,E,C;S0&&r(E)?(C=i(E),_=o(s,l,E,C,_,v-1)-1):(n(_+1),s[_]=E),_++),S++;return _};e.exports=o}),Mze=Pt((t,e)=>{var r=t6(),i=r("toStringTag"),n={};n[i]="z",e.exports=String(n)==="[object z]"}),Cze=Pt((t,e)=>{var r=Mze(),i=_u(),n=Qb(),a=t6(),o=a("toStringTag"),s=Object,l=n((function(){return arguments})())==="Arguments",u=function(c,d){try{return c[d]}catch{}};e.exports=r?n:function(c){var d,v,m;return c===void 0?"Undefined":c===null?"Null":typeof(v=u(d=s(c),o))=="string"?v:l?n(d):(m=n(d))==="Object"&&i(d.callee)?"Arguments":m}}),xze=Pt((t,e)=>{var r=bc(),i=_u(),n=VS(),a=r(Function.toString);i(n.inspectSource)||(n.inspectSource=function(o){return a(o)}),e.exports=n.inspectSource}),kze=Pt((t,e)=>{var r=bc(),i=bu(),n=_u(),a=Cze(),o=DS(),s=xze(),l=function(){},u=o("Reflect","construct"),c=/^\s*(?:class|function)\b/,d=r(c.exec),v=!c.test(l),m=function(_){if(!n(_))return!1;try{return u(l,[],_),!0}catch{return!1}},b=function(_){if(!n(_))return!1;switch(a(_)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return v||!!d(c,s(_))}catch{return!0}};b.sham=!0,e.exports=!u||i(function(){var _;return m(m.call)||!m(Object)||!m(function(){_=!0})||_})?b:m}),Lze=Pt((t,e)=>{var r=ZU(),i=kze(),n=H2(),a=t6(),o=a("species"),s=Array;e.exports=function(l){var u;return r(l)&&(u=l.constructor,i(u)&&(u===s||r(u.prototype))?u=void 0:n(u)&&(u=u[o],u===null&&(u=void 0))),u===void 0?s:u}}),$ze=Pt((t,e)=>{var r=Lze();e.exports=function(i,n){return new(r(i))(n===0?0:n)}}),Rze=Pt(()=>{var t=G2(),e=Aze(),r=e6(),i=i6(),n=r6(),a=$ze();t({target:"Array",proto:!0},{flat:function(){var o=arguments.length?arguments[0]:void 0,s=r(this),l=i(s),u=a(s,0);return u.length=e(u,s,s,l,0,o===void 0?1:n(o)),u}})}),Ize=Pt(()=>{var t=BS();t("flat")}),Oze=Pt((t,e)=>{Rze(),Ize();var r=US();e.exports=r("Array","flat")}),Pze=Pt((t,e)=>{var r=Oze();e.exports=r}),Nze=Pt((t,e)=>{var r=Pze();e.exports=r}),Dze=class{constructor(t,e){this.layout=t,this.cssVarsManager=e}},Vze=class extends Dze{constructor(t,e){super(t,e),this.cssVarsManager=e,this.cssVarsManager=e}setContainerLayout(t){t.style.position="relative"}setControlLayout(t,e){let r=this.cssVarsManager.getPropValue("--interactive-content-width"),i=this.cssVarsManager.getPropValue("--interactive-content-height"),n=this.cssVarsManager.getPropValue("--interactive-width"),a=this.cssVarsManager.getPropValue("--interactive-height"),o=2e-4;t.style.position="absolute",t.style.width=`calc(${r} * (${e.width} + ${o}))`,t.style.height=`calc(${i} * ${e.height})`,t.style.left=`calc(${r} * ${e.x} + ((${n} - ${r}) / 2))`,t.style.top=`calc(${i} * ${e.y} + ((${a} - ${i}) / 2))`}};function Bze(t){return"features"in t}var yu=class{constructor(e,r,...i){this.severity=e,this.category=r,this.data=i}toString(){return`Interactive SDK error ${JSON.stringify(this,null," ")}`}};function GU({emitter$:t,error:e,subjectId:r,message:i="",severity:n=1,category:a=1}){let o=new yu(n,a,{message:i,error:e,details:{id:r}});t.next(o)}var Uze=class{constructor(e,r,i){this.error$=new ze,this.container=e,this.options=i,this.factories=new Map,this.controls=[],this.setControls(),this.cssVarsManager=r}featureIsEnabled(e){return this.options&&this.options.features&&Bze(this.options)&&this.options.features[e]}onError(e="",r){GU({emitter$:this.error$,error:r,message:e,subjectId:this.container.id})}addControlFactory(e,r){this.factories.set(e.trim().toLowerCase(),r),this.setControls()}removeControlFactory(e){this.factories.delete(e.trim().toLowerCase()),this.setControls()}setControls(){this.controls=this.chooseControls()}chooseControls(){return this.container.controls?.reduce((e,r)=>{let i=r.type.trim().toLowerCase(),n=this.factories.get(i);if(n){let a=n(r,this.options);if(a)return[...e,a]}return[...e]},[])||[]}},xp=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`,W2=t=>xp(t,"Object"),jS=t=>xp(t,"String"),HS=t=>xp(t,"Array"),WU=t=>xp(t,"Number"),Fze=t=>xp(t,"Function"),zze=t=>xp(t,"Boolean"),qU=t=>WU(t)&&!isNaN(t),q2=t=>W2(t)&&Object.keys(t).length===0,YU=t=>HS(t)&&!t.length,n6=(t,e)=>jS(t)&&(e?t.trim():t).length;function a6(t,e=1){let r="0",i="0",n="0";return t.length===4?(r="0x"+t[1]+t[1],i="0x"+t[2]+t[2],n="0x"+t[3]+t[3]):t.length===7&&(r="0x"+t[1]+t[2],i="0x"+t[3]+t[4],n="0x"+t[5]+t[6]),`rgba(${+r},${+i},${+n},${e})`}var go={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},XU=(t=>(t.top="flex-start",t.bottom="flex-end",t.center="center",t))(XU||{}),QU=(t=>(t.start="flex-start",t.end="flex-end",t.center="center",t))(QU||{}),KU=(t=>(t.start="left",t.end="right",t.center="center",t))(KU||{}),JU=({target:t,props:e})=>{t.style.alignItems=(e?.gravityVertical&&XU[e.gravityVertical])??"center",t.style.justifyContent=(e?.gravityHorizontal&&QU[e.gravityHorizontal])??"center",t.style.textAlign=(e?.alignment&&KU[e.alignment])??"center"},eF=({target:t,props:e,fallback:r,dependsOn:i})=>{t.style.color=e?.text?.color??r.textColor,t.style.fontSize=`calc(${i.height} * ${e?.text?.size??r.textSize})`,t.textContent=e?.text?.value??r.textContent},tF=({target:t,props:e,fallback:r})=>{t.style.backgroundColor=a6(e?.background?.color??r.backgroundColor,e?.background?.alpha??r.backgroundAlpha)},ZS=({target:t,props:e,fallback:r,dependsOn:i,useRawValues:n=!1})=>{let a=n?r.borderWidthRawValue:`calc(${i.height} * ${e?.shape?.border?.width??r.borderWidth})`,o=n?r.roundCornersRawValue:`calc(${i.height} * ${e?.shape?.roundCorners??r.roundCorners})`;t.style.borderWidth=a,t.style.borderStyle="solid",t.style.borderColor=a6(n?r.borderColor:e?.shape?.border?.color??r.borderColor,n?r.borderAlpha:e?.shape?.border?.alpha??r.borderAlpha),t.style.borderRadius=o},jze=({target:t,isDark:e,baseDimension:r,fallback:i})=>{let n=a6(i.shadowColorLight,i.shadowColorAlpha),a=a6(i.shadowColorDark,i.shadowColorAlpha),o=`calc(${r} * ${.25})`,s=`calc(${r} * ${.11})`,l=`0px 0px ${o} ${s} ${e?a:n}`;t.style.boxShadow=l},GS=({target:t,layoutParams:e,fallback:r})=>{let i=e.angle??r.angle;i=i&&i*-1,t.style.transform=`rotate(${i}rad)`},WS="interactive-control-tap",Y2={common:WS,animation:`${WS}-animation`,visible:`${WS}-visible`},Hze=60,Zze=class{constructor({controlRotateAngleRad:t,clickCancelCondition:e,circleDiameterPx:r=Hze,useDimensionsBasedSize:i=!1}){this.onElementClick=a=>{if(!a.target||!a.currentTarget||this.clickCancelCondition())return;let o=a.currentTarget.parentElement;if(!o)return;let s=o.getBoundingClientRect(),l={width:this.useDimensionsBasedSize?o.offsetWidth:this.circleDiameterPx,height:this.useDimensionsBasedSize?o.offsetHeight:this.circleDiameterPx},u=Math.min(l.width,l.height),c=s.left+s.width/2,d=s.top+s.height/2,v=a.clientX-c,m=a.clientY-d,b=Gze(v,m,this.controlRotateAngleRad);this.element.style.width=u+"px",this.element.style.left=b.x+s.width/2-u/2+"px",this.element.style.top=b.y+s.height/2-u/2+"px",this.element.classList.add(Y2.visible,Y2.animation)},this.onAnimationEnd=a=>{a.stopPropagation(),!(!a.target||!a.currentTarget)&&a.target===a.currentTarget&&this.element.classList.remove(Y2.visible,Y2.animation)};let n=document.createElement("div");n.classList.add(Y2.common),this.controlRotateAngleRad=t,this.element=n,this.clickCancelCondition=e,this.circleDiameterPx=r,this.useDimensionsBasedSize=i}};function Gze(t,e,r){return{x:t*Math.cos(r)-e*Math.sin(r),y:t*Math.sin(r)+e*Math.cos(r)}}var qS="int",o6=(t=>(t.AREA=`${qS}_area`,t.TEXT=`${qS}_text`,t.BUTTON=`${qS}_bttn`,t))(o6||{});function rF(t){return"features"in t}var _c="interactive-control",jn={common:_c,selected:`${_c}-selected`,wrapper:`${_c}-wrapper`,disabled:`${_c}-disabled`,button:`${_c}-button`,area:`${_c}-area`,text:`${_c}-text`,blinkAnim:`${_c}-blink-anim`,blinkAnimButton:`${_c}-blink-anim-button`,blinkAnimArea:`${_c}-blink-anim-area`},Wze=40,qze=gc(FS()),iF={metadata:"Object",chapters:"Array"},nF=t=>{if(!W2(t))return!1;for(let e in iF)if(!t[e]||!xp(t[e],iF[e]))return!1;return PS(t.metadata.version)},YS=t=>t.type===IS.Text,XS=t=>HS(t)&&!YU(t),Sf=t=>t.order==="end",aF=t=>HS(t.containers)&&!YU(t.containers)&&Sf(t),Yze=(t,e)=>{let r=t*1e3;return XS(e.controls)&&r<(e.startTime??0)},oF=(t,e)=>{let r=t*1e3;return XS(e.controls)&&r>=(e.startTime??0)&&r<=(e.endTime??1/0)},X2=(t=[])=>t.some(e=>e.action.type==="expect"),sF=(t=[])=>t.find(e=>e.action.type==="expect"),Xze=t=>t?.length===1,QS=t=>Xze(t)&&YS(t[0]);function lF(t=[],e=1/0,r=[]){return t.filter(({container:i})=>!(0,qze.default)(r,i.container.id)&&X2(i.container.events)&&i.container.endTime===e&&!i.isRemoved&&!i.willRemoved)}function KS({gameControllers:t=[],subjectName:e,subjectId:r,execFn:i}){for(let n of t)if(e==="container"&&n.container.container.id===r){i(n),lF(t,n.container.container.endTime,[n.container.container.id]).forEach(a=>{i(a)});break}}function Qze(t){for(let e of t.events)if(e.action.type==="openURI")return!0;return!1}var Kze=(t,e)=>{let r=_=>e.find(({container:S})=>S.container.id===_)?.container.isRemoved,i=X2(t.events)&&!r(t.id),n=(_,S=!1,M=!1)=>{let E=M?"every":"some";return _.controls[E](C=>{let A=S?_.endTime===t.endTime:!0;return C.events?.[E](k=>k.action?.type===fn.openURI)&&A})},a=_=>_.some(({container:S})=>n(S.container,!0,!1)&&!S.isRemoved),o=_=>_.every(({container:S})=>S.isRemoved||S.willRemoved?!0:n(S.container,!0,!0)),s=lF(e,t.endTime,[t.id]).length,l=_=>_.controls.some(S=>S.events?.some(M=>M.action?.args?.shouldOpenNow)),u=i||s>0,c=a(e),d=n(t),v=o(e),m=i?!1:s>0,b=l(t);return{isExpectTime:u,hasOtherExpect:s>0,hasOpenURIEvent:c,hasOpenURIEventInCurrentContainer:d,isAllOpenURIEventsValid:v,isExpectEventForCurrentContainer:m,hasShouldOpenNowEvent:b}},JS=class iT{constructor(e,r){this.control=e,this.options=r,this.container=null,this.controlElement=null,this.subscriptions=new Ft,this.error$=new ze,this.isInteracted=!1,this.isRemoved=!1,this.cssVarsManager=null,this.onControlSelect=()=>{this.container?.isManifestContainerDisabled()||Qze(this.control)||this.container?.element?.classList.add("interactive-control-wrapper-selected")},this.onTransitionEnd=i=>{i.stopPropagation(),!(!i.target||!i.currentTarget)&&i.target===i.currentTarget&&this.removeView()}}setCssVarsManager(e){this.cssVarsManager=e}removeView(e=!1){let r=this.getElement();if(r){if(e){if(r.classList.contains("interactive-control-before-remove"))return;r.classList.add("interactive-control-before-remove"),this.subscriptions.add(wt(r,"transitionend").subscribe(this.onTransitionEnd,i=>this.onError(`${iT.name} remove view transition error`,i))).add(wt(r,"transitioncancel").subscribe(this.onTransitionEnd,i=>this.onError(`${iT.name} remove view transition error`,i)));return}this.removeListeners(),r.remove(),this.isRemoved=!0}}onError(e="",r){GU({emitter$:this.error$,error:r,message:e,subjectId:this.control.id})}addControlTap(e){if(this.featureIsEnabled("controlsTapPlace")&&this.container){let r=this.control.layoutParams.angle??go.angle;this.controlTap=new Zze({controlRotateAngleRad:r,clickCancelCondition:this.container.isManifestContainerDisabled,circleDiameterPx:this.isTouch()?Wze:void 0}),this.subscriptions.add(wt(e,"click").subscribe(this.controlTap.onElementClick,i=>this.onError("Control click tap animation error",i))).add(wt(this.controlTap.element,"animationend").subscribe(this.controlTap.onAnimationEnd,i=>this.onError("Tap animationend error",i))),this.container.element.append(this.controlTap.element)}}createContainerElement(e){let r=document.createElement("div");r.classList.add(jn.wrapper),e.setControlLayout(r,this.control.layoutParams);let i=(this.control.layoutParams.innerSizesDependOn??go.innerSizesDependOn)==="self"?{height:r.style.height,width:r.style.width}:{height:this.cssVarsManager?.getPropValue("--interactive-content-height")??0,width:this.cssVarsManager?.getPropValue("--interactive-content-width")??0},n=()=>e.isContainerDisabled?.()??!1;this.container={element:r,dimensions:i,isManifestContainerDisabled:n}}createClickListener(e){return r=>{r.stopPropagation(),this.isInteracted=!0,e()}}featureIsEnabled(e){return this.options&&rF(this.options)&&this.options.features[e]}isTouch(){return this.options&&rF(this.options)&&this.options.isTouch}setEvents(e){!this.container||!this.control.events||this.control.events.forEach(r=>{switch(r.type.trim().toLowerCase()){case"onclick":{if(!this.container)break;this.subscriptions.add(wt(this.container.element,"click").subscribe(this.createClickListener(()=>e({action:r.action,controlId:this.control.id,controlType:this.control.type})),i=>this.onError("Error happened on control interaction",i)));break}}})}removeListeners(){this.subscriptions.unsubscribe()}},eE="interactive-blink-anim-reference",Fl={common:eE,animation:`${eE}-animation`,disabled:`${eE}-disabled`},Jze=class{constructor(){this._RAFId=0,this._element=void 0}get element(){return this._element}create(){if(this._element)return;let t=document.createElement("div");t.classList.add(Fl.common,Fl.animation),this._element=t}restart(){this._element&&(this._element.classList.add(Fl.disabled),this.cleanupRAF(),this._RAFId=requestAnimationFrame(()=>{this._element&&(this._element.classList.remove(Fl.disabled),this.cleanupRAF())}))}cleanupRAF(){this._RAFId&&(cancelAnimationFrame(this._RAFId),this._RAFId=0)}destroy(){this.cleanupRAF(),this._element=void 0}},tE="interactive-container",Su={common:tE,hidden:`${tE}-hidden`,disabled:`${tE}-disabled`},eje=(t,e)=>{if(t.type.trim().toLowerCase()==="area")return new tje(t,e)},tje=class extends JS{constructor(t,e){super(t,e)}createView({parentElement:t,callbacks:e}){if(super.createContainerElement(e),!this.container)return;this.isInteracted=!1,this.isRemoved=!1;let r=document.createElement("button");r.type="button",r.classList.add(jn.common,jn.area),r.setAttribute("data-testid",o6.AREA),tF({target:r,props:this.control.props,fallback:{...go,backgroundColor:"transparent"}}),GS({target:r,layoutParams:this.control.layoutParams,fallback:go}),this.addControlTap(r),this.subscriptions.add(wt(this.container.element,"click").pipe(ni()).subscribe(this.onControlSelect,i=>this.onError("Control click handler error",i))),this.container.element.append(r),t.append(this.container.element),this.controlElement=r,this.updateShadowStyles(),this.registerBlinkAnimationEvents()}registerBlinkAnimationEvents(){if(!this.featureIsEnabled("controlsExpectTimeBlinkAnimation"))return;let t=this.container?.element.parentElement;!t||!this.controlElement||(this.subscriptions.add(wt(this.controlElement,"mouseleave").subscribe(()=>{if(t.classList.contains(Su.disabled))return;let e=t.parentElement;if(e){let r=e.querySelector(`.${Fl.common}`);r&&this.syncBlinkAnimation(r)}},e=>this.onError("Error happened in mouseleave callback",e))),this.subscriptions.add(wt(this.controlElement,"mouseenter").subscribe(()=>{t.classList.contains(Su.disabled)||this.onBlinkHovering()},e=>this.onError("Error happened in mouseenter callback",e))).add(wt(this.controlElement,"mouseleave").subscribe(()=>{this.controlElement&&(this.controlElement.style.animation="")},e=>this.onError("Error happened in mouseleave callback",e))))}disable(){this.controlElement&&this.controlElement.classList.add(jn.disabled)}enable(){this.controlElement&&this.controlElement.classList.remove(jn.disabled)}getElement(){return this.controlElement}updateShadowStyles(t){if(!(!this.container||!this.controlElement))if(zze(t)){let e=Math.min(this.controlElement.offsetWidth,this.controlElement.offsetHeight)+"px";jze({target:this.controlElement,props:this.control.props,fallback:go,isDark:t,baseDimension:e}),ZS({target:this.controlElement,props:this.control.props,fallback:{...go,borderColor:t?go.shadowColorDark:go.shadowColorLight,borderAlpha:1,borderWidthRawValue:"0.1px",roundCornersRawValue:`calc(${this.container.dimensions.height} * ${this.control.props?.shape?.roundCorners??go.roundCorners})`},dependsOn:this.container.dimensions,useRawValues:!0})}else ZS({target:this.controlElement,props:this.control.props,fallback:{...go,borderAlpha:0},dependsOn:this.container.dimensions})}toggleBlinkAnimation(t){this.controlElement?.classList.toggle(jn.blinkAnim,t),this.controlElement?.classList.toggle(jn.blinkAnimArea,t)}syncBlinkAnimation(t){this.controlElement&&(!this.controlElement.classList.contains(`${jn.blinkAnimArea}`)||this.controlElement.classList.contains(jn.selected)||this.controlElement.classList.contains(Fl.disabled)||(this.controlElement.classList.add(Fl.disabled),this.subscriptions.add(wt(t,"animationiteration").pipe(ni()).subscribe(()=>{this.controlElement&&this.controlElement.classList.remove(Fl.disabled)},e=>this.onError("Error happened in animationiteration callback",e)))))}onBlinkHovering(){if(!this.controlElement||!this.controlElement.classList.contains(`${jn.blinkAnimArea}`)||this.controlElement.classList.contains(jn.selected))return;let t=window.getComputedStyle(this.controlElement),e=t.getPropertyValue("--interactive-area-hover-opacity").trim();this.controlElement.style.opacity=t.opacity,this.controlElement.style.animation="none",requestAnimationFrame(()=>{this.controlElement&&(this.controlElement.style.opacity=e)})}setShowTimeRange(){}updateFillAnimationDimensions(){}onProgress(){}onResize(){}},uF=t=>{let e=document.createElement("span");switch(t){case"Button":case"button":{let r=document.createElement("div"),i={overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center"};Object.assign(r.style,i),r.append(e);let n={display:"inline-block",whiteSpace:"pre",textOverflow:"ellipsis",maxWidth:"initial",maxHeight:"100%",wordBreak:"normal"};return Object.assign(e.style,n),r}default:{let r={display:"inline-block",whiteSpace:"break-spaces",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",maxHeight:"100%",wordBreak:"break-all"};return Object.assign(e.style,r),e}}},s6=Math.PI,rE=2*s6,l6=s6/2,cF=3*l6,rje=0,ije=[rje,l6,s6,cF];function nje(t){return t===l6}function aje(t){return t===s6}function oje(t){return t===cF}function sje(t){return(t%rE+rE)%rE}function lje(t){for(let e of ije)if(t===e)return e}function uje(t){if(lje(t))return null;let e=Math.floor(t/l6)+1;return[1,2,3,4][e-1]}function cje(t){return t*180/Math.PI}var sd="interactive-control-fill-animation",nl={common:sd,fillerWrapper:`${sd}-filler-wrapper`,filler:`${sd}-filler`,fillHeight:`${sd}-fill-height`,fillWidth:`${sd}-fill-width`,fromTop:`${sd}-from-top`,fromBottom:`${sd}-from-bottom`,fromLeft:`${sd}-from-left`,fromRight:`${sd}-from-right`},dje=class Pj{constructor(e){this.widthExpansionCoef=0;let r=document.createElement("div");r.classList.add(nl.common);let i=document.createElement("div");i.classList.add(nl.fillerWrapper);let n=document.createElement("div");n.classList.add(nl.filler),i.append(n),r.append(i);let a=sje(e.rotateAngle),o=uje(a),s=o!==null,l=o===2||!s&&aje(a)||o===3,u=!s&&nje(a),c=!s&&oje(a),d=!l&&!u&&!c,v=u||c,m=s&&!v,b=m?a:0;r.style.borderRadius=e.borderRadius,i.style.transform=`skew(${b*-1}rad)`,v?(n.classList.add(nl.fillHeight,u?nl.fromTop:nl.fromBottom),i.classList.add(nl.fillHeight,u?nl.fromTop:nl.fromBottom)):(n.classList.add(nl.fillWidth,d?nl.fromLeft:nl.fromRight),i.classList.add(nl.fillWidth)),e.debug&&console.log(`[interactive ${Pj.name}]`,{widthExpansionCoef:this.widthExpansionCoef,opts:e,shouldFillHeight:v,rotateAngleRad:a,rotateAngelDeg:cje(a),rotateAngleRaw:e.rotateAngle,fromRight:l,fromTop:u,fromBottom:c,fromLeft:d}),this.useSkew=m,this.fromLeft=d,this.rotateAngle=a,this.fillAnimationElement=r,this.fillAnimationFillerElement=n,this.fillAnimationFillerWrapperElement=i,this.startTime=e.startTime,this.endTime=e.endTime,this.shouldFillHeight=v,this.isDebug=e.debug??!1}updateDimension(e){this.fillAnimationElement.style.top=`${e.borderWidth*-1}px`,this.fillAnimationElement.style.left=`${e.borderWidth*-1}px`,this.fillAnimationElement.style.width=`${e.width}px`,this.fillAnimationElement.style.height=`${e.height}px`;let r=this.calcWidthExpansionCoef({rotateAngle:this.rotateAngle,isSkewed:this.useSkew,initWidth:e.width,initHeight:e.height});!this.shouldFillHeight&&(this.fillAnimationFillerWrapperElement.style.width=100*r+100+"%",this.fillAnimationFillerWrapperElement.style[`${this.fromLeft?"left":"right"}`]=`calc((${r} * 100%) / 2 * -1)`),this.widthExpansionCoef=r}updateAnimation(e){if((n=>nthis.endTime)(e))return;let r=this.endTime-this.startTime,i=Math.min(Math.max((e-this.startTime)/r,0),1);this.shouldFillHeight?this.fillAnimationFillerElement.style.transform=`scaleY(${i})`:this.fillAnimationFillerElement.style.transform=`scaleX(${i})`}calcWidthExpansionCoef({rotateAngle:e,isSkewed:r=!1,initWidth:i,initHeight:n}){return r?(i+n*Math.abs(Math.tan(e)))/i-1:0}},hje=(t,e)=>{if(t.type.trim().toLowerCase()==="button")return new pje(t,e)},pje=class extends JS{constructor(t,e){super(t,e)}createView({parentElement:t,callbacks:e}){if(super.createContainerElement(e),!this.container)return;this.isInteracted=!1,this.isRemoved=!1;let r=document.createElement("button");r.type="button",r.classList.add(jn.common,jn.button),r.setAttribute("data-testid",o6.BUTTON),GS({target:r,layoutParams:this.control.layoutParams,fallback:go}),tF({target:r,props:this.control.props,fallback:go}),ZS({target:r,props:this.control.props,fallback:go,dependsOn:this.container.dimensions}),JU({target:r,props:{...this.control.props.text,alignment:this.control.layoutParams.alignment}});let i=uF(this.control.type.trim().toLowerCase()),n=i.firstElementChild??i;eF({target:n,props:this.control.props,fallback:go,dependsOn:this.container.dimensions}),this.addControlTap(r),this.startTime!==void 0&&this.endTime!==void 0&&this.featureIsEnabled("controlsFillAnimation")&&(this.controlFillAnimation=new dje({startTime:this.startTime,endTime:this.endTime,rotateAngle:this.control.layoutParams.angle??go.angle,borderRadius:r.style.borderRadius})),this.subscriptions.add(wt(r,"click").pipe(ni()).subscribe(this.onControlSelect,a=>this.onError("Control click handler error",a))),r.append(i,this.controlFillAnimation?.fillAnimationElement??""),this.container.element.append(this.controlTap?.element??"",r),t.append(this.container.element),this.controlElement=r,this.registerBlinkAnimationEvents()}registerBlinkAnimationEvents(){if(!this.featureIsEnabled("controlsExpectTimeBlinkAnimation"))return;let t=this.container?.element.parentElement;!t||!this.controlElement||(this.subscriptions.add(wt(this.controlElement,"mouseleave").subscribe(()=>{if(t.classList.contains(Su.disabled))return;let e=t.parentElement;if(e){let r=e.querySelector(`.${Fl.common}`);r&&this.syncBlinkAnimation(r)}},e=>this.onError("Error happened in mouseleave callback",e))),this.subscriptions.add(wt(this.controlElement,"mouseenter").subscribe(()=>{t.classList.contains(Su.disabled)||this.onBlinkHovering()},e=>this.onError("Error happened in mouseenter callback",e))).add(wt(this.controlElement,"mouseleave").subscribe(()=>{this.controlElement&&(this.controlElement.style.animation="")},e=>this.onError("Error happened in mouseleave callback",e))))}disable(){this.controlElement&&this.controlElement.classList.add(jn.disabled)}enable(){this.controlElement&&this.controlElement.classList.remove(jn.disabled)}getElement(){return this.controlElement}toggleBlinkAnimation(t){this.controlElement?.classList.toggle(jn.blinkAnim,t),this.controlElement?.classList.toggle(jn.blinkAnimButton,t)}syncBlinkAnimation(t){this.controlElement&&(!this.controlElement.classList.contains(`${jn.blinkAnimButton}`)||this.controlElement.classList.contains(jn.selected)||this.controlElement.classList.contains(Fl.disabled)||(this.controlElement.classList.add(Fl.disabled),this.subscriptions.add(wt(t,"animationiteration").pipe(ni()).subscribe(()=>{this.controlElement&&this.controlElement.classList.remove(Fl.disabled)},e=>this.onError("Error happened in animationiteration callback",e)))))}onBlinkHovering(){if(!this.controlElement||!this.controlElement.classList.contains(`${jn.blinkAnimButton}`)||this.controlElement.classList.contains(jn.selected))return;let t=window.getComputedStyle(this.controlElement),e=t.getPropertyValue("--interactive-button-hover-opacity").trim();this.controlElement.style.opacity=t.opacity,this.controlElement.style.animation="none",requestAnimationFrame(()=>{this.controlElement&&(this.controlElement.style.opacity=e)})}updateFillAnimationDimensions(){if(!this.container||!this.controlElement||!this.controlFillAnimation)return;let t=getComputedStyle(this.controlElement),e={width:parseFloat(t.width),height:parseFloat(t.height),borderWidth:parseFloat(t.borderWidth)||0};this.controlFillAnimation.updateDimension(e)}setShowTimeRange(t,e){this.startTime=t,this.endTime=e}onProgress(t){this.controlFillAnimation?.updateAnimation(t)}onResize(){this.updateFillAnimationDimensions()}updateShadowStyles(){}},fje=(t,e)=>{if(t.type.trim().toLowerCase()==="text")return new vje(t,e)},vje=class extends JS{constructor(t,e){super(t,e)}createView({parentElement:t,callbacks:e}){if(super.createContainerElement(e),!this.container)return;this.isInteracted=!1,this.isRemoved=!1;let r=document.createElement("div");r.classList.add(jn.common,jn.text),r.setAttribute("data-testid",o6.TEXT),GS({target:r,layoutParams:this.control.layoutParams,fallback:go}),JU({target:r,props:{...this.control.props.text,alignment:this.control.layoutParams.alignment}});let i=uF(this.control.type.trim().toLowerCase()),n=i.firstElementChild??i;eF({target:n,props:this.control.props,fallback:go,dependsOn:this.container.dimensions}),r.append(i),this.container.element.append(r),t.append(this.container.element),this.controlElement=r}getElement(){return this.controlElement}disable(){}enable(){}onProgress(){}onResize(){}updateShadowStyles(){}toggleBlinkAnimation(){}setShowTimeRange(){}updateFillAnimationDimensions(){}},mje=(t,e,r,i)=>{if(t.type.trim().toLowerCase()==="choice")return new gje(t,e,r,i)},gje=class nT extends Uze{constructor(e,r,i,n){super(e,i,n),this.containerElement=null,this.subscriptions=new Ft,this.onTransitionEnd=a=>{a.stopPropagation(),!(!a.target||!a.currentTarget)&&a.target===a.currentTarget&&this.removeView()},this.rootElement=r,this.layout=new Vze(this.container.layout,i),this.cssVarsManager=i,this.isRemoved=!1,this.isDisabled=!1,this.addControlFactory("button",hje),this.addControlFactory("text",fje),this.addControlFactory("area",eje)}createView({eventCallback:e,videoDurationMs:r}){let i=document.createElement("div");return i.classList.add(Su.common,Su.disabled),i.setAttribute("data-subjectId",this.container.id),requestAnimationFrame(()=>{i.classList.remove(Su.disabled)}),this.layout.setContainerLayout(i),this.controls.forEach(n=>{n.setShowTimeRange(this.container.startTime,this.container.endTime??r),n.setCssVarsManager(this.cssVarsManager),n.createView({parentElement:i,callbacks:{setControlLayout:(a,o)=>this.layout.setControlLayout(a,o),isContainerDisabled:()=>this.isDisabled}}),n.setEvents(e),this.subscriptions.add(n.error$.subscribe(this.error$))}),this.rootElement.append(i),this.isRemoved=!1,this.willRemoved=!1,this.containerElement=i,this.updateControlsFillAnimationDimensions(),i}updateControlsFillAnimationDimensions(){for(let e of this.controls)e.updateFillAnimationDimensions()}hide(){let e=this.getElement();e&&e.classList.add(Su.hidden)}show(){let e=this.getElement();e&&e.classList.remove(Su.hidden)}enable(){let e=this.getElement();e&&(e.classList.remove(Su.disabled),this.controls.forEach(r=>r.enable()),this.isDisabled=!1)}disable(){let e=this.getElement();e&&(e.classList.add(Su.disabled),this.controls.forEach(r=>r.disable()),this.isDisabled=!0)}removeView(e=!1,r=!1){let i=this.getElement();if(i){if(e){if(this.willRemoved)return;this.willRemoved=!0,r&&i.classList.add("interactive-container-before-remove-delay"),i.classList.add("interactive-container-before-remove"),this.subscriptions.add(wt(i,"transitionend").subscribe(this.onTransitionEnd,n=>this.onError(`${nT.name} remove view transition error`,n))).add(wt(i,"transitioncancel").subscribe(this.onTransitionEnd,n=>this.onError(`${nT.name} remove view transition error`,n)));return}this.subscriptions.unsubscribe(),this.removeAllControls(),i.remove(),this.isRemoved=!0,this.willRemoved=!1,this.containerElement=null}}removeAllControls(e=!1){this.controls.forEach(r=>r.removeView(e))}removeNonInteractedControls(e=!1){this.controls.forEach(r=>{r.isInteracted||r.removeView(e)})}isInteracted(){return this.controls.some(e=>e.isInteracted)}fakeRemove(){this.isRemoved||(this.isRemoved=!0)}getElement(){return this.containerElement}onProgress(e,r){r&&this.controls.forEach(i=>{i.onProgress(e)})}onResize(e){e&&this.controls.forEach(r=>{r.onResize()})}updateControlsShadowStyles(e){this.controls.forEach(r=>r.updateShadowStyles(e))}toggleBlinkAnimation(e){this.controls.forEach(r=>r.toggleBlinkAnimation(e))}},bje=gc(jU());function iE(t,e){let r;return(...i)=>{clearTimeout(r),r=setTimeout(()=>t(...i),e)}}var _je="video_interactive",yje="videoint",dF=250,Sje=class{constructor(t){this.handleZoomChange=iE(e=>{this.lastZoomInfo=e},dF),this.onResize=e=>{if(!this.isReady||this.isHidden||!e[0].contentRect.width||!e[0].contentRect.height)return;let r=this.getNextPoint();r&&this.ngEditor?.zoomTo(r,void 0,{isFromCenter:!0}),this.ngEditorSize={width:e[0].contentRect.width,height:e[0].contentRect.height}},this.handleChapterChange=e=>{if(this.manifest){if(this.isHidden||this.hide(),!e?.id){this.onError?.("Chapter id is not found");return}this.visitedChapterIds.add(e.id),this.ngEditor?.selectChapter(e.id),this.ngEditor?.setVisitedChapters(Array.from(this.visitedChapterIds)),this.currentChapterId=e.id,this.lastZoomInfo=null}},this.handleManifestChange=(e,r=[])=>{if(this.isReady=!1,!WU(e.graph.edit.chapters[0].x)){this.onError?.("Can't show graph");return}this.lastZoomInfo=null,this.manifest=e,this.visitedChapterIds=new Set(r),this.ngEditor&&(this.manifest.metadata.id!==this.currentManifestId?(this.ngEditor.update(e),this.currentManifestId=this.manifest.metadata.id):this.ngEditor.setVisitedChapters(Array.from(r)),this.isReady=!0)},this.init(t)}init({root:t,onOpenPreviewClick:e,onError:r,lang:i,visitedChapters:n=[]}){this.isReady=!1,this.isHidden=!0,this.manifest=null,this.visitedChapterIds=new Set(n),this.onOpenPreviewClick=e,this.onError=r,this.lang=i??"ru",this.zoom=.7,this.lastZoomInfo=null,this.currentManifestId=null,this.currentChapterId=null,this.ngEditor=null,this.ngEditorSize=null,this.graphWrapperElement=Eje(t),this.resizeObserver=new ResizeObserver(iE(this.onResize,dF)),this.resizeObserver.observe(this.graphWrapperElement)}getNextPoint(t=this.ngEditorSize){return!this.lastZoomInfo||!t?null:[(this.lastZoomInfo.x-t.width/2)/this.lastZoomInfo.value*-1,(this.lastZoomInfo.y-t.height/2)/this.lastZoomInfo.value*-1]}setVisitedChapters(t){this.visitedChapterIds=new Set([...this.visitedChapterIds,...t]),this.ngEditor?.setVisitedChapters(Array.from(this.visitedChapterIds))}updateVideosInfo(t){this.ngEditor?.updateVideosInfo(t)}async show(){this.manifest&&(this.ngEditor||await this.initNgEditor(),this.graphWrapperElement.style.display="block",!this.lastZoomInfo&&this.currentChapterId&&this.ngEditor?.focusChapter(this.currentChapterId),this.isHidden=!1)}async initNgEditor(){if(!this.manifest)return;let t;try{t=await b_(this.lang,_je,yje)}catch{this.onError?.("Unable to load graph language pack")}let{GraphEditor:e}=await Xe(()=>Promise.resolve().then(()=>IZe),void 0);this.ngEditor=new e(this.graphWrapperElement,{mode:"view",lang:this.lang==="ru"?"ru":"en",translation:t}),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",({name:r,...i})=>{r==="openPreview"&&"chapterId"in i&&this.onOpenPreviewClick?.(i.chapterId)}),this.ngEditor.on("zoom",this.handleZoomChange),this.isReady=!0}hide(){this.graphWrapperElement.style.display="none",this.isHidden=!0}destroy(){this.hide(),this.manifest=null,this.resizeObserver.disconnect(),this.ngEditor?.setVisitedChapters([]),this.onOpenPreviewClick=void 0,this.ngEditor?.dispose(),this.graphWrapperElement.remove(),this.isReady=!1}};function Eje(t){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",t.append(e),e}var Tje=class{constructor(){this._containers=[],this._player=null,this.setPlayer=t=>{this._player=t},this.setContainers=t=>{this._containers=t},this.deleteContainer=t=>{this._containers=this._containers.filter(e=>e.id!==t)},this.getNextInteractiveTime=(t=3e3)=>{if(!this._containers.length||this._player===null)return null;let e=-1,r=!1,i=Math.round(this._player.info.position$.getValue()*1e3);for(let n of this._containers){let a=n.startTime-t;if(a<=i&&(n.endTime&&i<=n.endTime||n.endTime===null)){r=!0;break}i{e(),this.off(t,r)};return this.listeners[t].push(r),this}off(t,e){return this.removeListener(t,e)}reset(){this.listeners={}}removeListener(t,e){let r=this.listeners[t]||[];for(let i=r.length;i>0;i--)if(r[i]===e){r.splice(i,1);break}return this}emit(t,...e){let r=this.listeners[t];return r?(r.forEach(i=>{i(...e)}),!0):!1}listenerCount(t){return this.rawListeners(t).length}rawListeners(t){return this.listeners[t]||[]}},Aje=class{constructor(t){this.fns=[],this.addFn=(e,r=!1)=>{Fze(e)&&(this.fns.push(e),r&&this.updateFn())},this.removeFn=(e,r=!1)=>{this.fns=this.fns.filter(i=>i!==e),r&&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)},t&&(this.fn=t,this.addFn(t))}release(){this.cancelAnimation(),this.fn=void 0,this.fns=[]}},Mje=gc(yze()),Cje=class Nj{constructor(e){this.rootElement=e,this.rootElementProps={},this.isCssVarsSupported=Nj.checkCssVarsSupport(e)}static checkCssVarsSupport(e){let r="--test-key",i="test";e.style.setProperty(r,i);let n=e.style.getPropertyValue(r)===i;return n&&e.style.removeProperty(r),n}getPropValue(e){return this.isCssVarsSupported?`var(${e})`:this.rootElementProps[e]??""}setup(e){if(this.rootElementProps={...this.rootElementProps,...e},this.isCssVarsSupported)for(let[r,i]of(0,Mje.default)(e))this.rootElement.style.setProperty(r,i)}cleanup(){for(let e in this.rootElementProps)this.rootElement.style.removeProperty(e);this.rootElementProps={}}setProp(e,r){this.rootElementProps[e]=r,this.isCssVarsSupported&&this.rootElement.style.setProperty(e,r)}},xje=class{constructor(t){this.loaders={chapterLoaders:t?.chapterLoaders??[],manifestLoaders:t?.manifestLoaders??[]}}async exec(t,e){return kje(...this.loaders[t])(e)}};function kje(...t){return async function(e){let r=[...t];for(;r.length>0;)e=await r.shift()(e);return e}}function u6(t,e,r){return t?{...t,[e]:t[e]?[r,...t[e]]:[r]}:{[e]:[r]}}function nE({actions:t,errors:e,chapterId:r,...i}){if(r){let n=t.getManifest();if(n){let a=t.getChapter(n.chapters,r);if(a){let o=t.getMedia(n.media,a.videoId),s=t.getGraph(n.graph,a.id);return o?{...i,actions:t,errors:e,result:{chapter:a,media:o,graph:s}}:{...i,errors:u6(e,nE.name,"Could not find media"),actions:t}}}}return{...i,errors:u6(e,nE.name,"Could not find chapter"),actions:t}}function hF(t){return t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof t.Request=="function"&&!t.Request.prototype.hasOwnProperty("signal")||!t.AbortController}function Lje(t){typeof t=="function"&&(t={fetch:t});let{fetch:e,Request:r=e.Request,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:n=!1}=t;if(!hF({Request:r,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:n}))return{fetch:e,Request:a};let a=r;(a&&!a.prototype.hasOwnProperty("signal")||n)&&(a=function(s,l){let u;l&&l.signal&&(u=l.signal,delete l.signal);let c=new r(s,l);return u&&Object.defineProperty(c,"signal",{writable:!1,enumerable:!1,configurable:!0,value:u}),c},a.prototype=r.prototype);let o=e;return{fetch:(s,l)=>{let u=a&&a.prototype.isPrototypeOf(s)?s.signal:l?l.signal:void 0;if(u){let c;try{c=new DOMException("Aborted","AbortError")}catch{c=new Error("Aborted"),c.name="AbortError"}if(u.aborted)return Promise.reject(c);let d=new Promise((v,m)=>{u.addEventListener("abort",()=>m(c),{once:!0})});return l&&l.signal&&delete l.signal,Promise.race([d,o(s,l)])}return o(s,l)},Request:a}}var $je=()=>"fetch"in window,aE=$je()&&hF({Request:window.Request,AbortController:window.AbortController}),pF=aE?Lje({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,fF=aE?pF.fetch:window.fetch;aE?pF.Request:window.Request;var vF=(t="",e="")=>{let r=t.split("."),i=e.split("."),n=0;for(let a=0;ai[a]?n=1:r[a]{try{let e={},r;if(jS(t)){r=new URL(t).href;let n=await fF(r);if(!n.ok)return{};e=await n.json()}else if(W2(t))e=t;else return{};if(!nF(e))return{};let i=e.metadata.media;if(jS(i)&&!("media"in e))try{let n;r?n=new URL(i,r).href:(n=new URL(i).href,r=n);let a=await fF(n);if(!a.ok)throw new Error;e.metadata.media=await a.json()}catch{return Nje(e.metadata.version)?{manifest:e}:{}}return{manifest:e,manifestURL:r}}catch{return{}}};async function Ije(t){let{manifest:e,manifestURL:r}=await Rje(t);if(!e)throw new Error("Failed on fetch");let i=AU(e);return i.media=Oje(i.media,r),delete i.metadata.media,i}function oE(t,e){if(e)return t.find(r=>r.id===e)}function mF(t,e){return t.edit?.chapters?t.edit.chapters.find(r=>r.id===e):t.view?.chapters?t.view.chapters.find(r=>r.id===e):void 0}function gF(t,e){return t.videos.find(r=>r.id===e)}function Oje(t,e){return{...t,videos:t.videos.map(r=>({...r,variants:r.variants.map(i=>{let n="url"in i?i.url:"",a=Pje(n,e);return{...i,url:a||n}})}))}}function Pje(t="",e){try{return new URL(t,e).href}catch{return""}}function Nje(t){return vF(t,"3.2.0")>=0}var bF=class extends xje{constructor(e,r){super(e),this.manifest=null,this.chapter=null,this.media=null,this.graph=null,this.prevChapter$=new de(null),this.onError=r,this.release()}release(){return this.manifest=null,this.chapter=null,this.media=null,this.graph=null,this.prevChapter$.next(null),this}async setManifest(e){this.release();let r=await this.exec("manifestLoaders",{actions:{addErrorMessage:u6},result:null,errors:null,source:e});return r.errors&&this.errorHandler(r.errors),this.manifest=await Ije(r.result??e),this}async setInitial(){return this.setNext()}async setNext(e=this.manifest?.metadata.initChapterId){if(!e)return this;this.prevChapter$.next(this.chapter);let r=await this.exec("chapterLoaders",nE({actions:{getManifest:()=>this.manifest,getCurrent:this.getCurrent,getGraph:mF,getChapter:oE,getMedia:gF,getByBranches:this.getByBranches.bind(this),addErrorMessage:u6},result:null,errors:null,chapterId:e}));return r.errors&&this.errorHandler(r.errors),r.result&&(this.chapter=r.result.chapter,this.media=r.result.media,this.graph=r.result.graph),this}errorHandler(e){this.onError(e),console.error("Something went wrong with loaders",{errors:e})}getInitial(){return this.getByChapterId(this.manifest?.metadata.initChapterId)||null}getByChapterId(e=this.manifest?.metadata.initChapterId){if(!e||!this.manifest)return null;let r=oE(this.manifest.chapters,e);if(r){let i=gF(this.manifest.media,r.videoId),n=mF(this.manifest.graph,r.id);if(i)return{chapter:r,media:i,graph:n}}return null}getBranches(e=this.chapter?.id){if(e===this.chapter?.id)return this.getByBranches(this.chapter?.branches);{let r=oE(this.manifest?.chapters||[],e);return this.getByBranches(r?.branches)}}getByBranches(e=[]){return e.reduce((r,i)=>{let n=this.getByChapterId(i.chapterId);return n&&r.push(n),r},[])}getCurrent(){return{chapter:this.chapter,media:this.media,graph:this.graph}}isInitialChapter(){return this.chapter?.id===this.manifest?.metadata.initChapterId}isEndChapter(){return this.chapter?Sf(this.chapter):!1}},Dje=gc(zS()),Vje=t=>{let e=t.variants.find(r=>r.payload?.type==="vk");if(e&&e.payload){let[r,i]=e.payload.id.split("_");return[r,i]}return[]},Bje=gc(zS());function Uje(){let t=new Map;function e({listId:a=Math.random().toString(),itemId:o=Math.random().toString(),...s}){let l=t.get(a),u={...s};return l?l[o]=u:t.set(a,{[o]:u}),{listId:a,itemId:o,...s}}function r(a){a.player.destroy(),a.container.remove(),a.subscription.unsubscribe(),a.statistics?.oneStat.destroy(),a.statistics?.statSubscription.unsubscribe()}function i(a,o){let s=t.get(a);if(!s)throw Error("Can't remove. Not find.");if(o){let l=s[o];l&&r(l),delete s[o],Object.keys(s).length||t.delete(a)}else{for(let l of(0,Bje.default)(s))r(l);t.delete(a)}}function n(){for(let a of t)i(a[0])}return{createPlayer:e,removePlayer:i,map:t,removeAll:n}}var Q2=gc(FS());function _F(t,e=[]){let r={},i,n=!e.length;for(let a of t.variants)if(!i&&"cover"in a&&(i=a.cover),"url"in a)switch(a.type.toLowerCase()){case"mp4":(n||(0,Q2.default)(e,"mp4"))&&(r.MPEG={...r.MPEG,[a.standard??"Invariant quality"]:a.url});break;case"mpeg":(n||(0,Q2.default)(e,"mpeg"))&&(r.MPEG={...r.MPEG,[a.standard??"Invariant quality"]:a.url});break;case"hls":(n||(0,Q2.default)(e,"hls"))&&(r={...r,HLS:{type:"url",url:a.url}});break;case"dash":(n||(0,Q2.default)(e,"dash"))&&(r={...r,DASH_SEP:{compatibilityMode:!0,type:"url",url:a.url}});break}return{sources:r,thumbUrl:i,title:t.title??""}}var c6=(t,e)=>{let r=t.info.currentQuality$.getValue(),i=t.info.availableQualities$.getValue();r!==e&&(0,Q2.default)(i,e)&&(t.setQuality(e),t.setAutoQuality(!1))},Fje=2;function zje(t){let e=Uje(),r=new Ft,i={},n=null,a=!1,o,s=new de(null);t&&l(t);function l(S){n=S}function u(S,M,E){if(!n)throw Error("need to set interactive controller");if(!n.options)return;let C=(e.map.get(S)??{})[M];if(C){i={chapterId:E,listId:S,itemId:M,...C};let A=i.player;i.subscription.add(A.info.currentQuality$.subscribe(k=>{let L=A.info.position$.getValue(),D=A.info.isAutoQualityEnabled$.getValue();if(!(!k||!L||D))for(let P of e.map)(0,Dje.default)(P[1]).forEach(({player:F})=>{c6(F,k)})})).add(A.events.started$.subscribe(()=>{c(M)})),C.container.remove(),n.setPlayer(C.player),a||(n.init(),a=!0),s.next({player:i.player,config:i.config,statistics:i.statistics});return}throw Error("Can't set. Not find.")}async function c(S){if(!n)throw Error("need to set interactive controller");if(q2(i)||S!==i.itemId)return;let M=n.getChapterBranches(),E=new Set;for(let C of M)E.has(C.media.id)||(await v({media:C.media,chapterId:C.chapter.id,setAsActive:!1,title:C.chapter.label}),E.add(C.media.id))}async function d({chapter:{id:S},manifestVideo:M}){if(q2(i)||!n)return;let E=i.player.info.muted$.getValue(),C=i.player.info.currentQuality$.getValue(),A=i.player.info.isAutoQualityEnabled$.getValue(),k=i.player.info.volume$.getValue(),L=i.player.info.currentPlaybackRate$.getValue(),D=!A,P=!1;for(let F of e.map)if(F[0]===M.id&&!n.state.isReplay$.getValue()){let V=Object.keys(F[1]);for(let Y of V)Y===i.itemId?(V.lengthW2(e[0])&&W2(r[0])?t({...e[0],...r[0]}):t(...e,...r)}var jje=class{constructor({player:t,container:e,branches:r,selectBranches:i,interactiveEvents:n,globalEvents:a,globalEventEmitter:o,getContainerEventState:s,permanentTextControls:l,interactiveTimeOpenUri:u,disabledControls$:c,onRemove:d,onError:v,disableTextControlContainerVisibilityEvents:m=!1,features:b}){this.hide=()=>{setTimeout(()=>{this.gameState!==4&&(X2(this.container.container.events)&&this.gameState===3||this.selectBranches.state.isExpect||(this.gameState!==2&&this.container.hide?.(),this.emitContainerVisibilityEvent(!1)))})},this.show=()=>{if(!(this.gameState!==2||this.isSelectedControlEvent))if(this.container.getElement()){let{hasOpenURIEventInCurrentContainer:S}=this.getContainerEventState();if(this.container.show?.(),this.interactiveTimeOpenUri&&S||this.disableTextControlContainerVisibilityEvents)return;this.emitContainerVisibilityEvent(!0,!1)}else{let S={isDisabled:()=>this.container.isDisabled,branches:this.branches,containerId:this.container.container.id,onDetachContainer:()=>{this.removeView(),this.emitContainerVisibilityEvent(!1)},onEvent:(C,A)=>{let{isExpectTime:k,hasOtherExpect:L,hasOpenURIEvent:D,hasOpenURIEventInCurrentContainer:P,isAllOpenURIEventsValid:F,hasShouldOpenNowEvent:V}=this.getContainerEventState(),Y=this.interactiveTimeOpenUri&&!P,G=this.interactiveTimeOpenUri&&P;if((!this.interactiveTimeOpenUri||Y)&&(this.isSelectedControlEvent=!0),C!==!1){if(!this.selectBranches.state.isExpect&&(!this.interactiveTimeOpenUri||Y)){if(this.interactiveTimeOpenUri){let W=!L&&!F&&P;W&&this.globalEvents.interactiveContainerFakeRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-fake-removed",removeAllOpenURI:W})}this.removeView()}this.emitContainerVisibilityEvent(!1)}if(this.gameState===4||this.gameState===3||this.selectBranches.state.isExpect||this.interactiveTimeOpenUri&&D&&this.gameState!==5){if(G){let W=((J,te,Q,re)=>!J&&!te&&Q||J&&!te&&Q&&!re||J&&!te&&Q&&re)(k,L,F,this.isSelectedContainerEvent);this.fakeRemoveView(W)}else this.removeView(),this.emitContainerVisibilityEvent(!1);(!k||!L||!V)&&(this.selectBranches.stopExpect(),A())}},isEOV:()=>this.gameState===4},M=lE(this.selectBranches.onControlEvent,S),E=(this.player?.info.duration$.getValue()??1/0)*1e3;this.container.createView({eventCallback:M,videoDurationMs:E}),this.disableTextControlContainerVisibilityEvents||this.emitContainerVisibilityEvent(!0,!0),this.disabledControls$.getValue()&&this.container.disable?.()}},this.onEndOfVideo=()=>{this.gameState=4,this.selectContainerEvent(!0)},this.whilePlaying=()=>{let S=this.player.experimental.element$.getValue(),M=S instanceof HTMLVideoElement;if(this.features.enableAvPlayerSupport&&(M||=S instanceof HTMLObjectElement&&S?.getAttribute("type")==="application/avplayer"),!(M&&S?.readyState)||this.isRemovedOrDestroyed()&&!this.isPermanentText)return;let E=this.player.getExactTime();if(Yze(E,this.container.container))this.gameState!==1&&(this.gameState=1,this.onBeforeStartTime());else if(oF(E,this.container.container))this.gameState!==2&&(this.gameState=2,this.onStartTime());else if(this.gameState!==3){let L=this.gameState;this.gameState=3,L===2&&this.onEndTime()}else{let{hasOpenURIEventInCurrentContainer:L}=this.getContainerEventState(),D=this.selectBranches.state.isExpect,P=this.interactiveTimeOpenUri&&L;if(P&&!D){let F=this.container.getElement();F&&(F.style.visibility!=="hidden"&&this.container.hide?.(),this.container.isRemoved||this.fakeRemoveView())}!this.isPermanentText&&!P&&this.removeView()}let C=oF(E,this.container.container),A=this.container.container.startTime?[this.container.container.startTime,this.container.container.endTime??1/0]:[],k={subjectId:this.container.container.id,subjectName:"container",range:A,currentTime:E,isInteractiveTime:C};this.container.onProgress(E*1e3,C),this.globalEventEmitter.emit(bn.eachTick,k),this.globalEvents.eachTick$.next(k)},this.container=e,this.branches=r,this.selectBranches=i,this.subscription=new Ft,this.player=t,this.interactiveEvents=n,this.getContainerEventState=s;let _=QS(e.container.controls);this.isPermanentText=l&&_,this.disableTextControlContainerVisibilityEvents=m&&_,this.interactiveTimeOpenUri=u,this.disabledControls$=c,this.onRemove=d,this.globalEventEmitter=o,this.gameState=0,this.globalEvents=a,this.onError=v,this.features=b,this.isSelectedControlEvent=!1,this.isSelectedContainerEvent=!1,this.registerEvents()}emitContainerVisibilityEvent(t,e=!1){t?(this.globalEventEmitter.emit(bn.interactives,{subjectId:this.container.container.id,subjectName:"container",type:Vo.visibility,visibility:t,isFirst:e}),this.globalEvents.interactiveVisibilityChanged$.next({subjectId:this.container.container.id,subjectName:"container",type:"visibility",visibility:t,isFirst:e})):(this.globalEventEmitter.emit(bn.interactives,{subjectId:this.container.container.id,subjectName:"container",type:Vo.visibility,visibility:!1}),this.globalEvents.interactiveVisibilityChanged$.next({subjectId:this.container.container.id,subjectName:"container",type:"visibility",visibility:t}))}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(t=>{t?this.container.disable?.():this.container.enable?.()})),this.subscription.add(this.container.error$.subscribe(this.onError))}selectContainerEvent(t=!1){let{isExpectEventForCurrentContainer:e}=this.getContainerEventState();this.interactiveEvents.containersEventsCallState.setCalled({timestamp:t?1/0:this.container.container.endTime??1/0,id:this.container.container.id}),!(this.isSelectedControlEvent||this.isSelectedContainerEvent)&&(this.isSelectedContainerEvent=!0,!e&&!this.container.isRemoved&&this.selectBranches.setManifestContainerEvents({container:this.container.container,branches:this.branches,isEOV:t}),!t&&this.interactiveEvents.exec(this.container.container.endTime??1/0))}onStartTime(){this.show()}onEndTime(){this.selectContainerEvent(!1);let{isExpectTime:t,hasOpenURIEventInCurrentContainer:e}=this.getContainerEventState(),r=this.interactiveTimeOpenUri?t||e:X2(this.container.container.events)||t;(this.isSelectedControlEvent||!r)&&this.removeView()}onBeforeStartTime(){this.container.hide?.(),this.emitContainerVisibilityEvent(!1)}onResize(t){this.container.onResize(t)}reset(){this.isSelectedControlEvent=!1,this.isSelectedContainerEvent=!1,this.gameState=1}removeView(t=this.features.controlsHideAnimation){if(t){if(this.isRemovedOrDestroyed())return;this.container.removeNonInteractedControls(!0),this.container.removeView(!0,!0)}else this.container.removeView();this.globalEventEmitter.emit(bn.interactives,{subjectId:this.container.container.id,subjectName:"container",type:Vo.containerRemoved,visibility:!1}),this.globalEvents.interactiveContainerRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-removed"}),this.gameState=5,this.onRemove?.()}fakeRemoveView(t=!1){this.container.isRemoved||this.globalEvents.interactiveContainerFakeRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-fake-removed",removeAllOpenURI:t}),this.container.fakeRemove()}updateControlsShadowStyles(t){this.container.updateControlsShadowStyles(t)}toggleBlinkAnimation(t){this.container.toggleBlinkAnimation(t)}isInteracted(){return this.container.isInteracted()}isRemovedOrDestroyed(t=!0){let e=t?this.container.willRemoved:!1;return this.gameState===5||e||this.gameState===6}destroy(t=!1){this.reset(),this.removeView(t),this.gameState=6,this.subscription.unsubscribe(),this.branches=[],this.interactiveEvents.containersEventsCallState.setCalled({timestamp:this.container.container.endTime??1/0,id:this.container.container.id})}},Hje=(t=[])=>t.reduce((e,r,i)=>{let n=(r?.controls??[]).filter(a=>!YS(a));if(XS(n)){let a=[r.startTime??0,r.endTime??1/0],o={id:r.id,isRemoved:!1};if(!i)e.push({subjects:[o],range:a});else{let s=[],l=-1/0,u=1/0,c=[],d=[];for(let v=0;vl&&(l=m.range[1]),a[0]>=m.range[0]&&a[1]<=m.range[1])return e[v].subjects.push(o),e;a[0]m.range[0]&&(s.push(v),c=c.concat(m.subjects)),a[0]>=m.range[0]&&a[0]<=m.range[1]&&(s.push(v),c=c.concat(m.subjects),a[0]=m.range[0]),a[1]>=m.range[0]&&a[1]<=m.range[1]&&(s.push(v),c=c.concat(m.subjects),a[1]=m.range[1])}if(d.push(o),a[0]<=u&&a[1]>=l)return[{subjects:d,range:a}];s.length&&s.reverse().forEach(v=>{e.splice(v,1)}),e.push({subjects:c.concat([o]),range:a})}}return e},[]).sort((e,r)=>e.range[0]-r.range[0]),Zje=gc(FS()),SF=gc(zS()),Gje=gc(Nze());function Wje(){let t={};function e(){for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&delete t[s]}function r(s){let l={};for(let u in t)+u<=s&&(l[u]=t[u]);return l}function i(s){let l={};for(let u in t)+u>=s&&(l[u]=t[u]);return l}function n({timestamp:s,priority:l,initiator:u}){if(qU(s)){let c=t[s]??null;if(c&&l&&n6(l,!0)){let d={},v=c[l];return v&&(d={...d,...v}),d=q2(d)?null:d,d&&n6(u,!0)?d[u]??null:d}return c}return null}function a({timestamp:s,priority:l,initiator:u}){if(qU(s))if(t[s]){if(l&&n6(l,!0))if(t[s][l]){if(u&&n6(u,!0))if(t[s][l][u]){if(delete t[s][l][u],!q2(t[s][l]))return!0}else return!1;if(delete t[s][l],!q2(t[s]))return!0}else return!1;return delete t[s]}else return!1;return!1}function o({timestamp:s,priority:l,initiator:u,...c}){t[s]?.[l]?.[u]?t[s][l][u].push({...c}):t[s]?.[l]?t[s][l]={...t[s][l],[u]:[{...c}]}:t[s]?t[s]={...t[s],[l]:{[u]:[{...c}]}}:t[s]={[l]:{[u]:[{...c}]}}}return{map:t,remove:a,add:o,removeAll:e,get:n,getLte:r,getGte:i}}var qje=[fn.expect,fn.setNextBranch],Yje=1/0;function Xje(t,e){let r=t,i,n=Qje(e),a=Wje(),o,s=()=>{m(),M()},l=E=>{a.add.call(void 0,E),b()},u=(E=[])=>{for(let C of E)if(C.action(),(0,Zje.default)(qje,C.actionType))break},c=(E=1/0)=>{let C=d6(a.get({timestamp:E,priority:"control"})??{}),A=d6(a.get({timestamp:E,priority:"container"})??{}),k=d6(a.get({timestamp:E,priority:"chapter"})??{});return[...C,...A,...k]},d=E=>{n.isReady(E)&&u(c(E))},v=()=>{u([...d6(a.get({timestamp:1/0,priority:"chapter"})??{})])},m=()=>{i&&(o?.unsubscribe(),i=void 0)},b=()=>{i||(i=()=>setTimeout(()=>{d(1/0)}),o=r.events.ended$.subscribe(i))},_=E=>{m(),r=E},S=E=>{E.priority==="container"&&n.resetCalled(E.timestamp),a.remove(E)},M=()=>{n.release(),a.removeAll()};return{setPlayer:_,add:l,remove:S,exec:d,execEndOfVideo:v,listen:b,unlisten:m,release:s,containersEventsCallState:n,getPreparedToExecActions:c}}function Qje(t){let e=new Map;return{setCalled:({timestamp:r,id:i})=>{let n=e.get(r);n&&n[i]!==void 0&&(n[i]=!0)},setData:(r=[])=>{for(let i of r){let n=i.endTime??Yje,a=e.get(n);e.set(n,{...a,[i.id]:!1})}},resetCalled:r=>{let i=e.get(r);if(i)for(let n in i)i[n]=!1},isReady:r=>{let i=e.get(r);if(!i)return!0;let n=(0,SF.default)(i);return t?n.some(a=>a):!n.some(a=>!a)},release:()=>e.clear()}}function d6(t){return(0,Gje.default)((0,SF.default)(t)).sort(e=>e.actionType===fn.expect?-1:1)}var EF={videoContentHeight:0,videoContentWidth:0},Kje=t=>{let{height:e,width:r}=t.info.intrinsicVideoSize$.getValue()||{};if(!(e&&r))return EF;let{clientHeight:i,clientWidth:n}=t.experimental.element$.getValue()||{};if(!(i&&n))return EF;let a=e/r,o=i/n,s,l;return o>a?(l=n,s=n*a):o{a(s),e=a.bind(null,s)});function i(s){let{parentElement:l,player:u,cssVarsManager:c}=t();if(!l||!u)return;let{videoContentWidth:d,videoContentHeight:v}=Kje(u);c.setup({"--interactive-content-width":`${d}px`,"--interactive-content-height":`${v}px`,"--interactive-width":`${s[0].contentRect.width}px`,"--interactive-height":`${s[0].contentRect.height}px`})}function n(){let{parentElement:s}=t();s.removeAttribute("style")}let a=iE(s=>{let{fns:l=[]}=t();i(s);for(let u of l)u()},Jje);function o(){e=void 0,r.disconnect(),n()}return{resizeObserver:r,calc:()=>{e?.()},release:o}}var tHe=t=>Math.floor(Math.random()*t),rHe=t=>{let e=t.length,r=1/0,i=null;for(;e--;){let n=t[e],a=n.weight??1;a{let e=t.length,r=-1/0,i=null;for(;e--;){let n=t[e],a=n.weight??0;a>r&&(r=a,i=n)}return i},nHe=t=>{let e=t.length,r=tHe(e);return t[r]},TF=1,aHe=t=>{let e=0;for(let i=0;i=r)return t[i];return t[t.length-1]},wF={shouldOpenNow:!0,isDetachContainer:!0},AF="after-expect",uE=(t,e=!1)=>({...t,args:e?{...t.args,...wF}:{...wF,...t.args}}),oHe=({globalEventEmitter:t,globalEvents:e,player:r,interactiveEvents:i})=>{let n={isExpect:!1},a=()=>{n.isExpect&&(n.isExpect=!1)},o=({action:M,controlType:E,controlId:C,containerId:A,branches:k=[],onEvent:L,isEOV:D=()=>!1,isDisabled:P=()=>!1})=>{let F=uE(M,D()),V={timestamp:1/0,priority:"control",initiator:C,actionType:F.type},Y=P(),G=t.emit.bind(t,bn.interactives,{subjectId:C,subjectType:E,subjectName:"control",type:Y?Vo.actionChoiceCanceled:Vo.actionChoice,actionType:M.type,payload:{invokeImmediately:F.args.shouldOpenNow,containerId:A,...F.args}}),W=()=>{e.interactiveActionChoice$.next({subjectId:C,subjectType:E,subjectName:"control",type:Y?"action-choice-canceled":"action-choice",actionType:M.type,payload:{invokeImmediately:F.args.shouldOpenNow,containerId:A,...F.args}})};if(Y){G(),W();return}switch(F.type.trim().toLowerCase()){case fn.setNextBranch.trim().toLowerCase():{let J=k.find(te=>te.id===F.args.branchId);if(!J)return;L(F.args.isDetachContainer,m.bind(null,{subjectId:C,subjectName:"control"})),G(),W(),F.args.shouldOpenNow?_({subjectId:C,subjectName:"control",subjectType:E,action:F,payload:{chapterId:J.chapterId,autoSelect:!1}}):i.add({...V,action:_.bind(null,{subjectId:C,subjectName:"control",subjectType:E,action:F,payload:{chapterId:J.chapterId,autoSelect:!1}})});return}case fn.continuePlayback.trim().toLowerCase():{L(F.args.isDetachContainer,m.bind(null,{subjectId:C,subjectName:"control"})),G(),W(),F.args.shouldOpenNow?b({subjectId:C,subjectName:"control",subjectType:E,action:M}):i.add({...V,action:b.bind(null,{subjectId:C,subjectName:"control",subjectType:E,action:M})});return}case fn.openURI.trim().toLowerCase():{L(F.args.isDetachContainer,m.bind(null,{subjectId:C,subjectName:"control"})),G(),W(),F.args.shouldOpenNow?S({subjectId:C,subjectName:"control",subjectType:E,action:F,payload:{URI:M.args.uri}}):i.add({...V,action:S.bind(null,{subjectId:C,subjectName:"control",subjectType:E,action:F,payload:{URI:M.args.uri}})});return}default:{let J="Unexpected control event",te=new yu(1,1,{message:J});c(te,J);return}}},s=({action:M,container:{id:E,endTime:C},branches:A=[],isEOV:k=!1,autoSelected:L=!1})=>{let D=uE(M,k),P={timestamp:!D.args.shouldOpenNow||k?1/0:C??1/0,priority:"container",initiator:E,actionType:D.type},F=t.emit.bind(t,bn.interactives,{subjectId:E,subjectName:"container",type:Vo.actionChoice,actionType:D.type,payload:{invokeImmediately:D.args.shouldOpenNow,...D.args}}),V=()=>{e.interactiveActionChoice$.next({subjectId:E,subjectName:"container",type:"action-choice",actionType:D.type,payload:{invokeImmediately:D.args.shouldOpenNow,...D.args}})};switch(D.type.trim().toLowerCase()){case fn.setNextBranch.trim().toLowerCase():{let Y=A.find(G=>G.id===D.args.branchId);if(!Y)return;F(),V(),i.add({...P,action:_.bind(null,{subjectId:E,subjectName:"container",action:D,payload:{chapterId:Y.chapterId,autoSelect:L}})});return}case fn.setMaxWeightBranch.trim().toLowerCase():return;case fn.setMinWeightBranch.trim().toLowerCase():return;case fn.setRandomBranch.trim().toLowerCase():return;case fn.setWeightlessRandomBranch.trim().toLowerCase():return;case fn.continuePlayback.trim().toLowerCase():{F(),V(),i.add({...P,action:b.bind(null,{subjectId:E,subjectName:"container",action:D})});return}case fn.openURI.trim().toLowerCase():{F(),V(),i.add({...P,action:S.bind(null,{subjectId:E,subjectName:"container",action:D,payload:{URI:M.args.uri}})});return}default:{let Y="Unexpected container event",G=new yu(1,1,{message:Y});c(G,Y);return}}};function l({container:M,branches:E,isEOV:C=!1}){let A=sF(M.events);if(A){let k=uE(A.action,C);t.emit(bn.interactives,{subjectId:M.id,subjectName:"container",type:Vo.actionChoice,actionType:k.type,payload:{invokeImmediately:k.args.shouldOpenNow,...k.args}}),e.interactiveActionChoice$.next({subjectId:M.id,subjectName:"container",type:"action-choice",actionType:k.type,payload:{invokeImmediately:k.args.shouldOpenNow,...k.args}}),i.add({timestamp:C?1/0:M.endTime??1/0,priority:"container",initiator:M.id,actionType:fn.expect,action:v.bind(null,{subjectId:M.id,subjectName:"container"})}),n.isExpect=!0}else for(let k of M.events??[])s({action:k.action,container:M,branches:E,isEOV:C})}let u=({chapterId:M,action:E,branches:C=[]})=>{let A=t.emit.bind(t,bn.interactives,{subjectId:M,subjectName:"chapter",type:Vo.actionChoice,actionType:E.type,payload:E.args}),k=()=>{e.interactiveActionChoice$.next({subjectId:M,subjectName:"chapter",type:"action-choice",actionType:E.type,payload:E.args})};switch(E.type.trim().toLowerCase()){case fn.setNextBranch.trim().toLowerCase():{let L=C.find(D=>D.id===E.args.branchId);return L?.chapterId?(A(),k(),_.bind(null,{subjectId:M,subjectName:"chapter",action:E,payload:{chapterId:L.chapterId,autoSelect:!0}})):void 0}case fn.setWeightlessRandomBranch.trim().toLowerCase():{let L=nHe(C);return L?.chapterId?(A(),k(),_.bind(null,{subjectId:M,subjectName:"chapter",action:E,payload:{chapterId:L.chapterId,autoSelect:!0}})):void 0}case fn.setRandomBranch.trim().toLowerCase():{let L=aHe(C);return L?.chapterId?(A(),k(),_.bind(null,{subjectId:M,subjectName:"chapter",action:E,payload:{chapterId:L.chapterId,autoSelect:!0}})):void 0}case fn.setMaxWeightBranch.trim().toLowerCase():{let L=iHe(C);return L?.chapterId?(A(),k(),_.bind(null,{subjectId:M,subjectName:"chapter",action:E,payload:{chapterId:L.chapterId,autoSelect:!0}})):void 0}case fn.setMinWeightBranch.trim().toLowerCase():{let L=rHe(C);return L?.chapterId?(A(),k(),_.bind(null,{subjectId:M,subjectName:"chapter",action:E,payload:{chapterId:L.chapterId,autoSelect:!0}})):void 0}case fn.continuePlayback.trim().toLowerCase():return A(),k(),b.bind(null,{subjectId:M,subjectName:"chapter",action:E});case fn.openURI.trim().toLowerCase():return A(),k(),S.bind(null,{subjectId:M,subjectName:"chapter",action:E,payload:{URI:E.args.uri}});default:{let L="Unexpected chapter event",D=new yu(1,1,{message:L});c(D,L);return}}};function c(M,E){console.error(E),e.error$.next(M),t.emit(bn.errors,M)}function d(M){let E=sF(M.events);if(E){if(Sf(M))return;t.emit(bn.interactives,{subjectId:M.id,subjectName:"chapter",type:Vo.actionChoice,actionType:E.action.type,payload:E.action.args}),e.interactiveActionChoice$.next({subjectId:M.id,subjectName:"chapter",type:"action-choice",actionType:E.action.type,payload:E.action.args}),i.add({timestamp:1/0,priority:"chapter",initiator:M.id,actionType:fn.expect,action:v.bind(null,{subjectId:M.id,subjectName:"chapter"})})}else M.events?.forEach(C=>{let A=u({chapterId:M.id,action:C.action,branches:M.branches});A&&i.add({timestamp:1/0,priority:"chapter",initiator:M.id,actionType:C.action.type,action:A})})}let v=({subjectId:M,subjectName:E})=>{r.pause(),t.emit(bn.interactives,{subjectId:M,subjectName:E,type:Vo.actionExecution,actionType:fn.expect}),e.interactiveActionExecution$.next({subjectId:M,subjectName:E,type:"action-execution",actionType:fn.expect})},m=({subjectId:M,subjectName:E})=>{r.info.isEnded$.getValue()?i.execEndOfVideo():r.play(),t.emit(bn.interactives,{subjectId:M,subjectName:E,type:Vo.actionExecution,actionType:AF}),e.interactiveActionExecution$.next({subjectId:M,subjectName:E,type:"action-execution",actionType:AF})},b=({subjectId:M,subjectName:E,subjectType:C,action:A})=>{t.emit(bn.interactives,{subjectId:M,subjectName:E,subjectType:C,type:Vo.actionExecution,actionType:A.type}),e.interactiveActionExecution$.next({subjectId:M,subjectName:E,subjectType:C,type:"action-execution",actionType:A.type})},_=({subjectId:M,subjectName:E,subjectType:C,action:A,payload:k})=>{k.behaviour="change-chapter",t.emit(bn.interactives,{subjectId:M,subjectName:E,subjectType:C,type:Vo.actionExecution,actionType:A.type,payload:k}),e.interactiveActionExecution$.next({subjectId:M,subjectName:E,subjectType:C,type:"action-execution",actionType:A.type,payload:k})},S=({subjectId:M,subjectName:E,subjectType:C,action:A,payload:k})=>{if(!k.URI)return;let L=window.open(k.URI,"_blank","noopener,noreferrer");L&&(L.opener=null),t.emit(bn.interactives,{subjectId:M,subjectName:E,subjectType:C,type:Vo.actionExecution,actionType:A.type}),e.interactiveActionExecution$.next({subjectId:M,subjectName:E,subjectType:C,type:"action-execution",actionType:A.type})};return{onControlEvent:o,onContainerEvent:s,onChapterEvent:u,onExpectEvent:v,expectEventHandler:m,setManifestChapterEvents:d,setManifestContainerEvents:l,stopExpect:a,state:n}},MF=gc(jU()),cE=(t,e)=>{let r={};return t.map(i=>{if(!r[i]){let n=e.chapters.find(o=>o.id===i);if(!n)return null;let a=e.media.videos.find(o=>n.videoId===o.id);if(!a)return null;r[i]=dE(a)}return r[i]}).filter(Boolean)},CF=t=>{for(let e of t.variants)if(xF(e)&&e.payload)return e.payload.id},xF=t=>!!(t.type==="custom"&&t.payload&&t.payload.type==="vk"),dE=t=>{let e=CF(t);if(!e)return null;let r=e.split("_").pop();return r?parseInt(r,10):null},kF=(t,e)=>{for(let r of t.media.videos)if(e===dE(r)){for(let i of t.chapters)if(i.videoId===r.id)return i.id;return}},LF=(t,e)=>t.reduce((r,i)=>{let n=kF(e,i);return n?[...r,n]:r},[]),sHe=class{constructor({globalEventEmitter:t,videoId:e,interactiveController:r,historyApi:i,settings:n}){this.state={history$:new de([]),hasPrevChapter$:new de(!1),prevChapter$:new de(null),isInitialChapter$:new de(!1),isGoBackLimited$:new de(!1)},this.#e=null,this.#r=!1,this.#i=null,this.#s=null,this.events={inited$:new ze,destroyed$:new ze,error$:new ze},this.#a=null,this.#n=null,this.#o=null,this.#l=new Ft,this.#u=!1,this.#c=0,this.#a=e,this.#o=t,this.#n=r,this.#e=i,this.#t=n,this.state.history$&&this.#l&&this.#l?.add(this.state.history$.subscribe(a=>{this.state.prevChapter$.next((0,MF.default)(a,-2)||null),this.state.hasPrevChapter$.next(a.length>1),this.state.isInitialChapter$.next(this.getInitialChapterId()===this.#i?.metadata?.initChapterId),this.state.isGoBackLimited$.next(this.#c===this.#t.maxLength-1)}))}#e;#t;#r;#i;#s;#a;#n;#o;#l;#u;#c;async setManifest(t){if(!this.#n||!this.#o)return;this.#i=t,await this.getProjectHistory();let e=this.getInitialChapterId();await this.#n.setChapter({chapterId:e,pushToHistory:!1}),this.#r||(this.#r=!0,this.events.inited$.next({initChapterId:e}))}get inited(){return this.#r}async updateHistory(t,e=!0){if(!this.#i)return;this.#u?(this.#u=!1,this.#c++):this.#c=0;let r=this.#i,i=t.length-this.#t.maxLength,n=i>0?t.slice(i):t,a=cE(n,r);if(this.#s=a,this.state.history$.next(n),!(!e||!this.#e||!this.#a))try{await this.#e.save(this.#a,a)}catch{let o=new yu(1,5,"Unable to save interactive history");this.events.error$.next(o),this.#o?.emit(bn.errors,o)}}async goBack(){if(!this.state||!this.#n){let r=new yu(1,5,"Unable to save interactive history");return this.events.error$.next(r),this.#o?.emit(bn.errors,r)}this.#u=!0;let t=this.state.history$.getValue().slice(0,-1),e=t.pop();this.state.history$.next(t),await this.#n.setChapter({chapterId:e,playPrev:!0})}async getProjectHistory(){if(!this.#i||!this.#a)return;let t=this.#i,e=[this.getInitialVideoId()];if(this.#e)try{let i=await this.#e.get(this.#a);i.length&&(e=i)}catch{let i=new yu(1,5,"Error while trying to fetch data");this.events.error$.next(i),this.#o?.emit(bn.errors,i)}let r=LF(e,t);this.state.history$.next(r)}getInitialChapterId(){let t=this.state.history$.getValue();return(0,MF.default)(t,-1)||this.#t.initChapterId||this.#i?.metadata.initChapterId}getInitialVideoId(){if(this.#i){let t=this.getInitialChapterId();return cE([t],this.#i).pop()}return null}destroy(){this.#a=null,this.#e=null,this.#n=null,this.#l?.unsubscribe(),this.#l=null,this.#r=!1,this.#o?.emit(bn.historyDestroyed),this.events.destroyed$.next(),this.#o=null}},lHe=class{constructor(){this._prevSizeId=0,this.rootElement=document.createElement("canvas")}clear(){this.rootElement.getContext("2d")?.clearRect(0,0,this.rootElement.width,this.rootElement.height)}isImageDrawn(){let t=this.rootElement.getContext("2d")?.getImageData(0,0,this.rootElement.width,this.rootElement.height);if(!t)return!1;let e=t.data,r=e.length;for(let i=3;i{let n=i??this.lastFrameCanvas.canvasImgSrc.currentTime*1e3,a=this.isChapterEndTime(n);if(this.isContainerTime(n))this._endTimeFrameReceived=!1,this._containerTimeFrameShouldReceived=!0,this._shouldCallSkip=!0;else if(a)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=` position: absolute; top: 0; left: 0; width: var(--interactive-width); height: var(--interactive-height); background-color: var(--black); visibility: hidden; `,this.lastFrameCanvas=new lHe,this.endOffsetMs=e,this._callbacks={onError:r},this.lastFrameCanvas.rootElement.style.cssText=` position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); `,this.rootElement.prepend(this.lastFrameCanvas.rootElement),t.prepend(this.rootElement)}destroy(){this.hide(),this.reset(),this._callbacks=void 0,this.lastFrameCanvas.destroy(),this.rootElement.remove()}setVideoDuration(t){this.currentVideoDurationMs=t}setVideoElement(t){this.lastFrameCanvas.setCanvasImageSource(t)}setCurrentChapter(t){this.currentChapter=t}show(){this.rootElement.style.visibility="visible"}hide(){this.rootElement.style.visibility="hidden"}async updateCanvasDimensions(t=!1){this._containerTimeFrameShouldReceived||this._endTimeFrameReceived||(t=!1);let e=getComputedStyle(this.rootElement),r={width:parseInt(e.getPropertyValue("--interactive-content-width"),10),height:parseInt(e.getPropertyValue("--interactive-content-height"),10)};try{this.lastFrameCanvas.updateCanvasDimensions(r,t)}catch(i){this._onError(i)}}draw(){(this._containerTimeFrameShouldReceived||!this._containerTimeFrameShouldReceived&&!this._endTimeFrameReceived)&&this.lastFrameCanvas.draw()}isChapterEndTime(t){return this.currentVideoDurationMs&&t>=this.currentVideoDurationMs-this.endOffsetMs}isContainerTime(t){if(this.currentChapter)return this.currentChapter.containers.some(e=>e.controls?.length&&t>=(e.startTime??0)&&t<=Math.min(e.endTime??1/0,this.currentVideoDurationMs-this.endOffsetMs))}reset(){this._endTimeFrameReceived=!1,this._containerTimeFrameShouldReceived=!1,this._shouldCallSkip=!1}_onError(t){this._callbacks?.onError?.(t)}};function cHe(t=0){return new Promise(e=>{setTimeout(()=>{e(0)},t)})}var dHe=`/* interactive-container */ .interactive-container { opacity: 1; visibility: visible; transition: opacity var(--interactive-transition-1); } .interactive-container-disabled { opacity: 0.5; } .interactive-container-hidden { visibility: hidden; } .interactive-container.interactive-container-before-remove.interactive-container-before-remove-delay { transition-delay: var(--interactive-remove-delay); } .interactive-container.interactive-container-before-remove { transition: opacity var(--interactive-transition-1); opacity: 0; pointer-events: none; } /* blink-anim */ .interactive-control-blink-anim { animation-duration: 2001ms; animation-iteration-count: infinite; animation-timing-function: cubic-bezier(0.3, 0.3, 0.3, 1); } .interactive-control-blink-anim-button { animation-name: interactive-blinking-button; } .interactive-control-blink-anim-area { animation-name: interactive-blinking-area; } @keyframes interactive-blinking-area { 0%, 100% { opacity: 1; } 50% { opacity: var(--interactive-area-hover-opacity); } } @keyframes interactive-blinking-button { 0%, 100% { opacity: 1; } 50% { opacity: var(--interactive-button-hover-opacity); } } /* blink-anim-reference */ .interactive-blink-anim-reference { position: absolute; height: 0; width: 0; top: 0; left: 0; pointer-events: none; } .interactive-blink-anim-reference-animation { animation-duration: 2001ms; animation-iteration-count: infinite; animation-timing-function: cubic-bezier(0.3, 0.3, 0.3, 1); animation-name: interactive-blinking-button; } .interactive-blink-anim-reference-disabled { animation: none; } /* control tap */ .interactive-control-tap { position: absolute; aspect-ratio: 1; background-color: var(--interactive-bg-color-1); border: 1px solid var(--interactive-color-1); border-radius: 50%; transition: opacity var(--interactive-transition-1); opacity: 0; pointer-events: none; z-index: 1; } .interactive-control-tap-animation { animation-duration: 300ms; animation-iteration-count: 1; animation-timing-function: ease; animation-name: interactive-control-tap-bounce; } @keyframes interactive-control-tap-bounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(0.3); } } .interactive-container:not(.interactive-container-disabled) .interactive-control-tap-visible { opacity: 1; } /* interactive-chapter */ .interactive-chapter { position: absolute; top: 0; left: 0; font-family: inherit; --interactive-transition-1: 100ms ease-in-out; --interactive-transition-2: 400ms cubic-bezier(0.4, 0, 0.2, 1); --interactive-color-1: #fff; --interactive-bg-color-1: rgba(255, 255, 255, 0.08); --interactive-button-hover-opacity: 0.8; --interactive-area-hover-opacity: 0; --interactive-remove-delay: 300ms; } /* interactive-control */ .interactive-control-wrapper-selected { pointer-events: none; } .interactive-control { display: flex; width: 100%; height: 100%; font-family: inherit; position: relative; isolation: isolate; opacity: 1; box-shadow: none; border: none; } .interactive-control.interactive-control-disabled { cursor: default; } .interactive-control-button, .interactive-control-area { cursor: pointer; } .interactive-control-button { transition: opacity var(--interactive-transition-2); } .interactive-control-area { transition: border-color var(--interactive-transition-1), box-shadow var(--interactive-transition-1), opacity var(--interactive-transition-2); } .interactive-control-wrapper-selected > .interactive-control-button { transition: opacity var(--interactive-transition-1); opacity: 0.5; } .interactive-control-wrapper-selected > .interactive-control-area { transition: opacity var(--interactive-transition-1); opacity: 0; } .interactive-control.interactive-control-before-remove { transition: opacity var(--interactive-transition-1); opacity: 0; pointer-events: none; } .interactive-container.interactive-container-disabled .interactive-control-button, .interactive-container.interactive-container-disabled .interactive-control-area { animation: none; } .interactive-container:not(.interactive-container-disabled) .interactive-control-wrapper:not(.interactive-control-wrapper-selected) > .interactive-control-button:not(.interactive-control-blink-anim):hover, .interactive-container:not(.interactive-container-disabled) .interactive-control-wrapper:not(.interactive-control-wrapper-selected) > .interactive-control-button:not(.interactive-control-blink-anim):focus-visible { opacity: var(--interactive-button-hover-opacity); animation: none; } .interactive-container:not(.interactive-container-disabled) .interactive-control-wrapper:not(.interactive-control-wrapper-selected) > .interactive-control-area:not(.interactive-control-blink-anim):hover, .interactive-container:not(.interactive-container-disabled) .interactive-control-wrapper:not(.interactive-control-wrapper-selected) > .interactive-control-area:not(.interactive-control-blink-anim):focus-visible { opacity: var(--interactive-area-hover-opacity); animation: none; } /* fill animation */ .interactive-control-fill-animation { position: absolute; overflow: hidden; z-index: -1; pointer-events: none; } .interactive-control-fill-animation-filler-wrapper { position: absolute; width: 100%; height: 100%; transform-origin: center; } .interactive-control-fill-animation-filler-wrapper.interactive-control-fill-animation-fill-width { top: 0; } .interactive-control-fill-animation-filler-wrapper.interactive-control-fill-animation-fill-height { left: 0; } .interactive-control-fill-animation-filler-wrapper.interactive-control-fill-animation-from-right { right: 0; } .interactive-control-fill-animation-filler-wrapper.interactive-control-fill-animation-from-left { left: 0; } .interactive-control-fill-animation-filler-wrapper.interactive-control-fill-animation-from-top { top: 0; } .interactive-control-fill-animation-filler-wrapper.interactive-control-fill-animation-from-bottom { bottom: 0; } .interactive-control-fill-animation-filler { width: 100%; height: 100%; background-color: rgba(173, 211, 255, 0.32); } .interactive-control-fill-animation-filler.interactive-control-fill-animation-fill-width { transform: scaleX(0); } .interactive-control-fill-animation-filler.interactive-control-fill-animation-fill-height { transform: scaleY(0); } .interactive-control-fill-animation-filler.interactive-control-fill-animation-from-right { transform-origin: right; } .interactive-control-fill-animation-filler.interactive-control-fill-animation-from-left { transform-origin: left; } .interactive-control-fill-animation-filler.interactive-control-fill-animation-from-top { transform-origin: top; } .interactive-control-fill-animation-filler.interactive-control-fill-animation-from-bottom { transform-origin: bottom; } `,hHe=t=>{let e=document.createElement("style");e.textContent=dHe,t.prepend(e)},$F=Object.freeze({lang:Rd.RU,loaders:{},graph:!1,initSeamless:!1,lastFrame:!1,permanentTextControls:!0,interactiveTimeOpenUri:!1,config:{historyMaxLength:100,noInteractionEventTimeout:3e4},isTouch:!1,disableTextControlContainerVisibilityEvents:!1,animationsFeatureToggles:{areaControlShadow:!1,controlsExpectTimeBlinkAnimation:!1,controlsTapPlace:!1,controlsFillAnimation:!1,controlsHideAnimation:!1},enableAvPlayerSupport:!1});function pHe(){let t=document.createElement("div");return t.classList.add("interactive-chapter"),t}var fHe=class{constructor(t){if(this.playerSubscriptions=new Ft,this.subscriptions=new Ft,this.globalEventEmitter=new wje,this.animation=new Aje,this.seekToInteractiveController=new Tje,this.endedRanges=new Set,this.gameControllers=[],this.rootElement=pHe(),this.factories=new Map([["choice",mje]]),this.isFirstChapterFetched=!1,this.player=null,this.interactiveEvents=null,this.selectBranches=null,this.seamlessController=null,this.seamlessControllerSubs=new Ft,this.graph=null,this.lastFrame=null,this.blinkAnimationRef=null,this.appState=0,this.state={prevChapter$:new de(null),isInitialChapter$:new de(!1),isFirstChapter$:new de(!0),isEndChapter$:new de(!1),isInteractiveExpectation$:new de(!1),isReplay$:new de(!1),calledByInteractive$:new de(!1),lastChapterChangeWasInitiatedByInteractive$:new de(!1),disabledControls$:new de(!1),interactiveRanges$:new de([]),isInteractiveTime$:new de(!1),statistics$:new de(null),isSeekable$:new de(!1)},this.events={noInteraction$:new ze,graphVisibilityChanged$:new ze,watchAgainIsClicked$:new ze,chapterChanged$:new ze,playerChanged$:new ze,error$:new ze,eachTick$:new ze,manifestChanged$:new ze,interactiveRangeEnded$:new ze,interactiveContainerRemoved$:new ze,interactiveContainerFakeRemoved$:new ze,interactiveActionExecution$:new ze,interactiveActionChoice$:new ze,interactiveVisibilityChanged$:new ze},this.emitErrorEvent=r=>{this.events.error$.next(r),this.globalEventEmitter.emit(bn.errors,r)},this.clearHistoryIfEnded=()=>{let r=this.player?.info.isEnded$.getValue(),i=this.state.isInteractiveExpectation$.getValue(),{chapter:n}=this.getCurrentChapter();r&&n&&Sf(n)&&!i&&this.historyController.updateHistory([]),window.removeEventListener("beforeunload",this.clearHistoryIfEnded)},this.handleSeamlessPlayerChanged=r=>{if(!r)return;let{statistics:i,...n}=r;if(i){let{statSubscription:a,oneStat:o}=i;a.add(o.attachToInteractive(this.getStatEvents())),this.state.statistics$.next(i)}this.state.isReplay$.getValue()&&this.state.isReplay$.next(!1),this.events.playerChanged$.next(n),this.globalEventEmitter.emit(bn.playerChanged,n)},this.onPlaybackStarted=()=>{this.resizeManager?.calc(),this.animation.requestAnimation()},this.destroyGameControllers=({removeTextControls:r=!0,withTransition:i=!1}={})=>{for(let n of this.gameControllers)!r&&n.isPermanentText||(this.animation.removeFn(n.whilePlaying),n.destroy(i))},this.completeInteractiveRange=r=>{let{interactiveRanges$:i}=this.state,n=i.getValue().map(a=>({...a,subjects:a.subjects.filter(o=>o.id!==r)}));i.next(n)},this.clearNoInteractionTimeout=()=>{this.noInteractionTimeout&&(clearTimeout(this.noInteractionTimeout),this.noInteractionTimeout=void 0)},this._options={...$F,...t,config:{...$F.config,...t.config}},this._options.animationsFeatureToggles?.controlsExpectTimeBlinkAnimation){this.blinkAnimationRef=new Jze,this.blinkAnimationRef.create();let r=this.blinkAnimationRef.element;r&&this.rootElement.append(r)}this._options.parentElement.append(this.rootElement),this.historyController=new sHe({interactiveController:this,globalEventEmitter:this.globalEventEmitter,videoId:this._options.projectInfo?.videoId,historyApi:this._options.historyApi,settings:{maxLength:this._options.config.historyMaxLength,initChapterId:this._options.initChapterId}}),this._options.lastFrame&&(this.lastFrame=new uHe({parentElement:this._options.parentElement,onError:r=>{let i=new yu(1,6,r);this.emitErrorEvent(i)}})),hHe(this._options.parentElement),this.subscriptions.add(wt(this.rootElement,"mousedown").subscribe(r=>r.stopPropagation())).add(wt(this.rootElement,"mouseup").subscribe(r=>r.stopPropagation())),this.manifestController=new bF(this._options.loaders,r=>{let i=new yu(1,3,r);this.emitErrorEvent(i)});let e=[];this._options.lastFrame&&e.push(()=>{this.lastFrame?.updateCanvasDimensions(!0)}),e.push(()=>{let r=this.state.isInteractiveTime$.getValue();for(let i of this.gameControllers)i.onResize(r)}),this.cssVarsManager=new Cje(this._options?.parentElement),this.resizeManager=eHe(()=>({player:this.player,cssVarsManager:this.cssVarsManager,parentElement:this._options.parentElement,fns:e})),this._options.graph&&(this.graph=new Sje({root:this._options.parentElement,lang:this._options.lang,onOpenPreviewClick:r=>{this.setChapter({chapterId:r}),this.globalEventEmitter.emit(bn.graph,{type:sE.watchAgainClicked,chapterId:r}),this.events.watchAgainIsClicked$.next(r)},onError:r=>{let i=new yu(1,2,{message:r});this.emitErrorEvent(i)}})),this.initSubscriptions()}initSubscriptions(){this.playerSubscriptions.add(this.historyController.events.inited$.subscribe(async({videosInfo:t=[]})=>{this._options.initSeamless&&(await this.initSeamless(),this.updateGraphVideosInfo(t))})),this.subscriptions.add(this.events.interactiveContainerRemoved$.subscribe(({subjectId:t})=>{this.completeInteractiveRange(t)})).add(this.events.interactiveContainerFakeRemoved$.subscribe(({subjectId:t,removeAllOpenURI:e})=>{this.handleFakeRemoval(t,e)})).add(this.events.interactiveActionExecution$.subscribe(t=>{if(this.state.calledByInteractive$.next(!0),(t.actionType==="setNextBranch"||!this._options.endChapterHistoryFix)&&this.state.lastChapterChangeWasInitiatedByInteractive$.next(!0),t.payload?.behaviour==="change-chapter"){let{chapterId:e}=t.payload;this.setChapter({chapterId:e}),this.state.isFirstChapter$.getValue()&&this.state.isFirstChapter$.next(!1)}else if(t.payload?.behaviour==="change-manifest"){let{manifestURL:e}=t.payload;e&&this.setManifest(e)}t.actionType==="expect"?(this.state.isInteractiveExpectation$.next(!0),this.updateControlsShadowStyles({subjectName:t.subjectName,subjectId:t.subjectId,isExpect:!0}),this.toggleBlinkAnimation({subjectName:t.subjectName,subjectId:t.subjectId,isExpect:!0})):t.actionType==="after-expect"&&(this.state.isInteractiveExpectation$.next(!1),this.updateControlsShadowStyles({subjectName:t.subjectName,subjectId:t.subjectId,isExpect:!1}),this.toggleBlinkAnimation({subjectName:t.subjectName,subjectId:t.subjectId,isExpect:!1}))})).add(this.events.manifestChanged$.subscribe(()=>{this.state.calledByInteractive$.next(!1),this.state.lastChapterChangeWasInitiatedByInteractive$.next(!1)})).add(this.events.interactiveActionChoice$.subscribe(({type:t,subjectName:e,payload:r})=>{t!=="action-choice"||e==="chapter"||"invokeImmediately"in r&&r.invokeImmediately||this.destroyGameControllers({removeTextControls:!1,withTransition:this._options.animationsFeatureToggles?.controlsHideAnimation})}))}async initSeamless(){this.seamlessController=zje(this),this.seamlessControllerSubs.add(this.seamlessController.activePlayerChanged.subscribe(this.handleSeamlessPlayerChanged)),await this.seamlessController.init()}handlePositionChange(t){(!this.graph||this.graph.isHidden)&&this.checkIfSeekable();let e=t*1e3,r=this.getInteractiveRanges().reverse().find(({range:i})=>e>=i[1]);if(r){let i=r.range.join("-");this.endedRanges.has(i)||(this.endedRanges.add(i),this.globalEventEmitter.emit(bn.interactives,{type:Vo.rangeEnded,payload:r,visibility:!0}),this.events.interactiveRangeEnded$.next({type:"range-ended",payload:r}))}}registerVideoEvents(){this.player&&(window.removeEventListener("beforeunload",this.clearHistoryIfEnded),this.playerSubscriptions.unsubscribe(),window.addEventListener("beforeunload",this.clearHistoryIfEnded),this.playerSubscriptions.add(this.player.events.started$.pipe(ni()).subscribe(this.onPlaybackStarted)).add(this.player.events.playing$.subscribe(this.animation.requestAnimation)).add(this.player.events.willPause$.subscribe(this.animation.cancelAnimation)).add(this.player.info.position$.subscribe(this.handlePositionChange.bind(this))).add(this.manifestController.prevChapter$.subscribe(t=>this.state.prevChapter$.next(t))).add(Zr({position:this.player.info.position$,interactiveRanges:this.state.interactiveRanges$,isInteractiveExpectation:this.state.isInteractiveExpectation$}).subscribe(({position:t,interactiveRanges:e,isInteractiveExpectation:r})=>{let i;if(r)i=!0;else{let o=t*1e3;i=!!e.find(({range:[s,l],subjects:u})=>s!c.isRemoved)&&u.length)}i!==this.state.isInteractiveTime$.getValue()&&this.state.isInteractiveTime$.next(i);let n=!!this.noInteractionTimeout,a=this.player?.info.playbackState$.getValue()==="playing"||r;i&&!n&&a?this.noInteractionTimeout=window.setTimeout(()=>{this.events.noInteraction$.next()},this._options.config.noInteractionEventTimeout):n&&!a&&this.clearNoInteractionTimeout()})),this.playerSubscriptions.add(this.historyController.events.error$.subscribe(this.events.error$)),this._options.lastFrame&&this.playerSubscriptions.add(this.player.info.duration$.subscribe(t=>{this.lastFrame?.setVideoDuration(t*1e3)})).add(this.player.experimental.element$.subscribe(t=>{t&&this.lastFrame?.setVideoElement(t)})).add(this.player.events.firstFrame$.subscribe(()=>{this.lastFrame?.reset(),setTimeout(()=>{this.lastFrame?.hide(),this.lastFrame?.lastFrameCanvas.clear()},50)})).add(this.player.events.seeked$.subscribe(this.lastFrame.onSeek)))}setGameControllers(){let t=this.manifestController.chapter;t&&this.appState===1&&(this.selectBranches?.setManifestChapterEvents(t),this.gameControllers=this.getGameControllers(t),this.interactiveEvents?.containersEventsCallState.setData(t.containers),this.seekToInteractiveController.setContainers(this.gameControllers.map(e=>e.container.container).filter(e=>!QS(e.controls))),this._options.lastFrame&&this.animation.addFn(()=>{this.player&&this.lastFrame?.onEachTick(this.player.info.position$.getValue()*1e3)},!0),this.state.interactiveRanges$.next(this.getInteractiveRanges()),this.appState=2)}getGameControllers(t){let e=[];return t.containers.forEach(r=>{let i=r.type.trim().toLowerCase(),n=this.factories.get(i)?.(r,this.rootElement,this.cssVarsManager,{isTouch:this._options?.isTouch??!1,features:{controlsExpectTimeBlinkAnimation:this._options.animationsFeatureToggles?.controlsExpectTimeBlinkAnimation,controlsTapPlace:this._options.animationsFeatureToggles?.controlsTapPlace,controlsFillAnimation:this._options.animationsFeatureToggles?.controlsFillAnimation}});if(n&&this.selectBranches&&this.interactiveEvents&&this.player){let a=new jje({player:this.player,container:n,branches:t.branches,selectBranches:this.selectBranches,interactiveEvents:this.interactiveEvents,globalEvents:this.events,globalEventEmitter:this.globalEventEmitter,getContainerEventState:()=>Kze(r,this.gameControllers),permanentTextControls:this._options.permanentTextControls,interactiveTimeOpenUri:this._options.interactiveTimeOpenUri,disabledControls$:this.state.disabledControls$,onRemove:()=>{this.seekToInteractiveController.deleteContainer(r.id)},onError:this.emitErrorEvent,disableTextControlContainerVisibilityEvents:this.options.disableTextControlContainerVisibilityEvents??!1,features:{controlsHideAnimation:this._options.animationsFeatureToggles?.controlsHideAnimation,enableAvPlayerSupport:this._options.enableAvPlayerSupport}});this.animation.addFn(a.whilePlaying,!0),e.push(a)}}),e}checkIfSeekable(){if(this.state.isInteractiveExpectation$.getValue()){this.state.isSeekable$.next(!1);return}let t=this.state.isSeekable$.getValue(),e=!!this.seekToInteractiveController.getNextInteractiveTime();(e&&!t||!e&&t)&&this.state.isSeekable$.next(!t)}updateLastEventInfo(){this.state.calledByInteractive$.getValue()?this.state.calledByInteractive$.next(!1):this.state.lastChapterChangeWasInitiatedByInteractive$.next(!1)}pushChapterToHistory(t){if(this.updateLastEventInfo(),!this.historyController.inited)return;let e=this.state.lastChapterChangeWasInitiatedByInteractive$.getValue(),r=this.state.prevChapter$.getValue(),i=(r&&Sf(r)&&aF(r))??!1,n=this.manifestController.manifest?.metadata.initChapterId===t,a=this.historyController.state.history$.getValue();if(n||i&&e){this.historyController.updateHistory([t]);return}(0,bje.default)(a,-1)!==t&&this.historyController.updateHistory([...a,t])}handleFakeRemoval(t,e){let{interactiveRanges$:r}=this.state,i=r.getValue().map(n=>{let a=n.subjects.some(s=>s.id===t),o=n.subjects.map(s=>e&&a||s.id===t?{...s,isRemoved:!0}:s);return{...n,subjects:o}});r.next(i)}reset(){this.appState===2&&(this.destroyGameControllers(),this.gameControllers=[],this.animation.release(),this.interactiveEvents?.release(),this.appState=1,this.state.isSeekable$.next(!1),this._options.endChapterHistoryFix&&this.state.lastChapterChangeWasInitiatedByInteractive$.next(!1),this.clearNoInteractionTimeout())}toggleBlinkAnimation(t){if(!this._options.animationsFeatureToggles?.controlsExpectTimeBlinkAnimation)return;let e=(r,i)=>{r.toggleBlinkAnimation(i)};KS({...t,gameControllers:this.gameControllers,execFn:lE(yF(e),t.isExpect)}),t.isExpect&&this.blinkAnimationRef?.restart()}updateControlsShadowStyles(t){if(!this._options.animationsFeatureToggles?.areaControlShadow)return;let e=(r,i)=>{r.updateControlsShadowStyles(i)};t.isExpect?KS({...t,gameControllers:this.gameControllers,execFn:lE(yF(e),!1)}):KS({...t,gameControllers:this.gameControllers,execFn:e})}get options(){return this._options}init(){this.manifestController.chapter&&this._options.parentElement&&this.player&&this._options.fullscreenTargetElement&&this.appState===0&&(this.resizeManager?.resizeObserver.observe(this._options.fullscreenTargetElement),this.registerVideoEvents(),this.appState=1,this.setGameControllers())}async setManifest(t){this.reset(),this.isFirstChapterFetched=!1;let e=await this.manifestController.setManifest(t);if(e.manifest)return this.graph&&this.graph.handleManifestChange(e.manifest),await this.historyController.setManifest(e.manifest),this.events.manifestChanged$.next(e.manifest),this.globalEventEmitter.emit(bn.manifestChanged,{manifest:e.manifest}),this.setGameControllers(),e.manifest}setPlayer(t){this.reset(),this.player=t,this.seekToInteractiveController.setPlayer(this.player),this.interactiveEvents?this.interactiveEvents.setPlayer(this.player):this.interactiveEvents=Xje(this.player,this._options.interactiveTimeOpenUri),this.selectBranches=oHe({player:this.player,interactiveEvents:this.interactiveEvents,globalEvents:this.events,globalEventEmitter:this.globalEventEmitter}),this.appState===1&&(this.registerVideoEvents(),this.setGameControllers())}async setChapter({chapterId:t,pushToHistory:e=!0,playPrev:r=!1}={}){this.reset(),this.lastFrame&&this.isFirstChapterFetched&&(this.lastFrame.draw(),this.lastFrame.show()),this.lastFrame&&lr.browser.isSafari&&await cHe(35);let i=!r&&this.state.isEndChapter$.getValue()&&this.getCurrentManifest()?.metadata.initChapterId===t;this.state.isReplay$.next(i);let{chapter:n,media:a,graph:o}=await(t?this.manifestController.setNext(t):this.manifestController.setInitial());(!t||i)&&this.state.isFirstChapter$.next(!0),!(!n||!a)&&(e&&this.pushChapterToHistory(n.id),this.state.isInitialChapter$.next(this.manifestController.isInitialChapter()),this.state.isEndChapter$.next(this.manifestController.isEndChapter()),this.graph&&this.graph.handleChapterChange(n),this.state.isInteractiveTime$.next(!1),this.state.isInteractiveExpectation$.next(!1),this.lastFrame?.setCurrentChapter(n),this.events.chapterChanged$.next({chapter:n,manifestVideo:a}),this.globalEventEmitter.emit(bn.chapterChanged,{chapter:n,media:a,graph:o}),this.setGameControllers(),this.endedRanges=new Set,this.isFirstChapterFetched=!0)}getStatEvents(){return{click$:new Ki(t=>{this.subscriptions.add(this.events.graphVisibilityChanged$.subscribe(e=>{t.next(e?G1.GRAPH_SHOW:G1.GRAPH_HIDE)})).add(this.events.watchAgainIsClicked$.subscribe(()=>{t.next(G1.WATCH_AGAIN)})).add(this.events.interactiveActionChoice$.subscribe(({type:e,subjectName:r,subjectType:i})=>{e!=="action-choice"||r!=="control"||(i==="Button"&&t.next(G1.NEXT_BUTTON),i==="Area"&&t.next(G1.NEXT_AREA))}))}),nextMovie$:new Ki(t=>{this.events.playerChanged$.subscribe(({config:e})=>{e?.unitedVideoId&&!this.state.isFirstChapter$.getValue()&&t.next(e.unitedVideoId)})})}}async toggleGraphView(t=!0){this.graph&&(t?(await this.graph.show(),this.state.isSeekable$.next(!1)):(this.graph.hide(),this.checkIfSeekable()),this.globalEventEmitter.emit(bn.graph,{type:sE.visibility,visibility:t}),this.events.graphVisibilityChanged$.next(t))}setVisitedChapters(t){Array.isArray(t)&&this.graph?.setVisitedChapters(t)}updateGraphVideosInfo(t){Array.isArray(t)&&this.graph?.updateVideosInfo(t)}deadEndCheck(){return!(this.interactiveEvents?.getPreparedToExecActions()||[]).some(t=>t.actionType===fn.setNextBranch)}allControlsAreRemoved(t=!0){return!this.gameControllers.some(e=>{let r=t&&this._options.animationsFeatureToggles?.controlsHideAnimation?e.container.willRemoved:!0;return!e.container.isRemoved||!r})}isEndedExpectation(){if(!this.player||!this.gameControllers)return!1;let t=this.player.info.position$.getValue(),e=this.player.info.duration$.getValue();return t===e&&this.gameControllers.some(r=>{let i=r.container.container;return!r.container.isRemoved&&!r.container.willRemoved&&i.endTime===null&&X2(i.events)})}playPrevChapter(){this.historyController.goBack()}setDisabledControls(t){this.state.disabledControls$.next(t)}isSupport(t=this.manifestController.manifest){return!!t&&PS(t.metadata.version)}getInitialVideoInfo(){return{videoId:this.historyController.getInitialVideoId(),chapterId:this.historyController.getInitialChapterId()}}getHistoryState(){return this.historyController.state}getIsSeekable(){return this.state.isSeekable$}getInteractiveRanges(){return Hje(this.manifestController.chapter?.containers)}getNextInteractiveStartTime(t){return this.seekToInteractiveController.getNextInteractiveTime(t)}getChapterBranches(t){return this.manifestController.getBranches(t)}getCurrentChapter(){return this.manifestController.getCurrent()}getCurrentManifest(){return this.manifestController.manifest}on(t,e){return this.globalEventEmitter.on(t,e),this}off(t,e){return this.globalEventEmitter.off(t,e),this}once(t,e){return this.globalEventEmitter.once(t,e),this}destroy(){this.clearHistoryIfEnded(),this.blinkAnimationRef?.destroy(),this.destroyGameControllers(),this.gameControllers=[],this.graph?.destroy(),this.seamlessControllerSubs.unsubscribe(),this.seamlessController?.removeAll(),this.resizeManager?.release(),this.animation.release(),this.interactiveEvents?.release(),this.manifestController.release(),this.playerSubscriptions.unsubscribe(),this.subscriptions.unsubscribe(),this.globalEventEmitter.reset(),this.lastFrame?.destroy(),this.rootElement.remove(),this.historyController.destroy(),this.isFirstChapterFetched=!1,this.appState=3}};const vHe=Object.freeze(Object.defineProperty({__proto__:null,ContainerTypes:EU,ControlTypes:IS,CustomError:yu,EVENT_NAMES:bn,EventActionTypes:fn,EventTypes:TU,Interactives:fHe,ManifestController:bF,chapterIdsToVKVideoIds:cE,compareVersions:vF,getChapterIdByVkVideoId:kF,getVKVideoIdByMedia:dE,getVideoRawIdByMedia:CF,graphEventTypes:sE,hasEndTemplate:aF,interactivesEventTypes:Vo,isLastChapter:Sf,isOneTextCtrlContainer:QS,isSupportedManifest:PS,isTextControl:YS,isVKVariantItem:xF,isValidManifest:nF,migrateManifestToLatestVersion:AU,vkVideoIdsToChapterIds:LF},Symbol.toStringTag,{value:"Module"}));var mHe={996:t=>{var e=function(u){return(function(c){return!!c&&typeof c=="object"})(u)&&!(function(c){var d=Object.prototype.toString.call(c);return d==="[object RegExp]"||d==="[object Date]"||(function(v){return v.$$typeof===r})(c)})(u)},r=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function i(u,c){return c.clone!==!1&&c.isMergeableObject(u)?s((d=u,Array.isArray(d)?[]:{}),u,c):u;var d}function n(u,c,d){return u.concat(c).map((function(v){return i(v,d)}))}function a(u){return Object.keys(u).concat((function(c){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(c).filter((function(d){return Object.propertyIsEnumerable.call(c,d)})):[]})(u))}function o(u,c){try{return c in u}catch{return!1}}function s(u,c,d){(d=d||{}).arrayMerge=d.arrayMerge||n,d.isMergeableObject=d.isMergeableObject||e,d.cloneUnlessOtherwiseSpecified=i;var v=Array.isArray(c);return v===Array.isArray(u)?v?d.arrayMerge(u,c,d):(function(m,b,_){var S={};return _.isMergeableObject(m)&&a(m).forEach((function(M){S[M]=i(m[M],_)})),a(b).forEach((function(M){(function(E,C){return o(E,C)&&!(Object.hasOwnProperty.call(E,C)&&Object.propertyIsEnumerable.call(E,C))})(m,M)||(o(m,M)&&_.isMergeableObject(b[M])?S[M]=(function(E,C){if(!C.customMerge)return s;var A=C.customMerge(E);return typeof A=="function"?A:s})(M,_)(m[M],b[M],_):S[M]=i(b[M],_))})),S})(u,c,d):i(c,d)}s.all=function(u,c){if(!Array.isArray(u))throw new Error("first argument should be an array");return u.reduce((function(d,v){return s(d,v,c)}),{})};var l=s;t.exports=l},96:(t,e,r)=>{var i="Expected a function",n=NaN,a="[object Symbol]",o=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt,d=typeof r.g=="object"&&r.g&&r.g.Object===Object&&r.g,v=typeof self=="object"&&self&&self.Object===Object&&self,m=d||v||Function("return this")(),b=Object.prototype.toString,_=Math.max,S=Math.min,M=function(){return m.Date.now()};function E(A){var k=typeof A;return!!A&&(k=="object"||k=="function")}function C(A){if(typeof A=="number")return A;if((function(D){return typeof D=="symbol"||(function(P){return!!P&&typeof P=="object"})(D)&&b.call(D)==a})(A))return n;if(E(A)){var k=typeof A.valueOf=="function"?A.valueOf():A;A=E(k)?k+"":k}if(typeof A!="string")return A===0?A:+A;A=A.replace(o,"");var L=l.test(A);return L||u.test(A)?c(A.slice(2),L?2:8):s.test(A)?n:+A}t.exports=function(A,k,L){var D=!0,P=!0;if(typeof A!="function")throw new TypeError(i);return E(L)&&(D="leading"in L?!!L.leading:D,P="trailing"in L?!!L.trailing:P),(function(F,V,Y){var G,W,J,te,Q,re,_e=0,me=!1,ae=!1,Me=!0;if(typeof F!="function")throw new TypeError(i);function be(ve){var Fe=G,De=W;return G=W=void 0,_e=ve,te=F.apply(De,Fe)}function X(ve){var Fe=ve-re;return re===void 0||Fe>=V||Fe<0||ae&&ve-_e>=J}function We(){var ve=M();if(X(ve))return Oe(ve);Q=setTimeout(We,(function(Fe){var De=V-(Fe-re);return ae?S(De,J-(Fe-_e)):De})(ve))}function Oe(ve){return Q=void 0,Me&&G?be(ve):(G=W=void 0,te)}function Se(){var ve=M(),Fe=X(ve);if(G=arguments,W=this,re=ve,Fe){if(Q===void 0)return(function(De){return _e=De,Q=setTimeout(We,V),me?be(De):te})(re);if(ae)return Q=setTimeout(We,V),be(re)}return Q===void 0&&(Q=setTimeout(We,V)),te}return V=C(V)||0,E(Y)&&(me=!!Y.leading,J=(ae="maxWait"in Y)?_(C(Y.maxWait)||0,V):J,Me="trailing"in Y?!!Y.trailing:Me),Se.cancel=function(){Q!==void 0&&clearTimeout(Q),_e=0,G=re=W=Q=void 0},Se.flush=function(){return Q===void 0?te:Oe(M())},Se})(A,k,{leading:D,maxWait:k,trailing:P})}},254:(t,e,r)=>{var i={"./icon_action.svg":485,"./icon_action_area.svg":492,"./icon_action_button.svg":580,"./icon_add.svg":490,"./icon_arrow.svg":706,"./icon_copy.svg":418,"./icon_create_node.svg":208,"./icon_end_node.svg":181,"./icon_end_of_video.svg":71,"./icon_etc.svg":161,"./icon_inaction.svg":577,"./icon_legend_navigation.svg":893,"./icon_location.svg":978,"./icon_lock.svg":628,"./icon_minus.svg":246,"./icon_move.svg":696,"./icon_node.svg":872,"./icon_paste.svg":297,"./icon_pencil.svg":469,"./icon_pencil_filled.svg":288,"./icon_play.svg":363,"./icon_plus.svg":52,"./icon_random.svg":716,"./icon_start_node.svg":916,"./icon_trash_can.svg":228,"./icon_video.svg":691,"./icon_warning.svg":123};function n(o){var s=a(o);return r(s)}function a(o){if(!r.o(i,o)){var s=new Error("Cannot find module '"+o+"'");throw s.code="MODULE_NOT_FOUND",s}return i[o]}n.keys=function(){return Object.keys(i)},n.resolve=a,t.exports=n,n.id=254},521:t=>{t.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHBhdGggZD0iTTM1IDgxVjM3YTIgMiAwIDAgMSAyLTJoNjRhMiAyIDAgMCAxIDIgMnY0NGEyIDIgMCAwIDEtMiAySDM3YTIgMiAwIDAgMS0yLTJaIiBmaWxsPSIjZmZmIiBmaWxsLW9wYWNpdHk9Ii4wNiIvPjxwYXRoIGQ9Ik0yNyA4OVY0NWEyIDIgMCAwIDEgMi0yaDY0YTIgMiAwIDAgMSAyIDJ2NDRhMiAyIDAgMCAxLTIgMkgyOWEyIDIgMCAwIDEtMi0yWiIgZmlsbD0iI2ZmZiIgZmlsbC1vcGFjaXR5PSIuMTEiLz4KPC9zdmc+Cg=="},485:t=>{t.exports=` `},492:t=>{t.exports=` `},580:t=>{t.exports=` `},490:t=>{t.exports=` `},706:t=>{t.exports=` `},418:t=>{t.exports=` `},208:t=>{t.exports=` `},181:t=>{t.exports=` `},71:t=>{t.exports=` `},161:t=>{t.exports=` `},577:t=>{t.exports=` `},893:t=>{t.exports=` `},978:t=>{t.exports=` `},628:t=>{t.exports=` `},246:t=>{t.exports=` `},696:t=>{t.exports=` `},872:t=>{t.exports=` `},297:t=>{t.exports=` `},469:t=>{t.exports=` `},288:t=>{t.exports=` `},363:t=>{t.exports=` `},52:t=>{t.exports=` `},716:t=>{t.exports=` `},916:t=>{t.exports=` `},228:t=>{t.exports=` `},691:t=>{t.exports=` `},123:t=>{t.exports=` `}},RF={};function Bo(t){var e=RF[t];if(e!==void 0)return e.exports;var r=RF[t]={exports:{}};return mHe[t](r,r.exports,Bo),r.exports}Bo.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return Bo.d(e,{a:e}),e},Bo.d=(t,e)=>{for(var r in e)Bo.o(e,r)&&!Bo.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},Bo.g=(function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}})(),Bo.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var nr={};(()=>{Bo.d(nr,{Wk:()=>IF,CX:()=>PF,yP:()=>NF,QS:()=>Cc,bc:()=>im,rQ:()=>VF,GM:()=>DF,$D:()=>bWe,qc:()=>QF,gS:()=>XF,m6:()=>iGe,b1:()=>oGe,VJ:()=>nGe,l1:()=>aGe,U0:()=>YF,xi:()=>OF,Ql:()=>ZF,Qf:()=>zZe,Db:()=>JZe,HU:()=>GZe,n4:()=>yE,vW:()=>KZe,sY:()=>zF,gH:()=>UF,ZW:()=>jF,vF:()=>b6,q8:()=>DZe,I7:()=>Rp,FF:()=>gE,jU:()=>bE,aP:()=>XZe,J1:()=>ez,AE:()=>TE,W:()=>oz,eI:()=>EE,KJ:()=>iz,Zr:()=>lz,C9:()=>bz,sl:()=>hz,TS:()=>fz,eE:()=>mz,ws:()=>WF,U2:()=>FF,jb:()=>nm,S3:()=>OZe,sI:()=>cz,CD:()=>QZe,sN:()=>dz,E0:()=>pz,B_:()=>vz,jJ:()=>gz,vR:()=>_E,TT:()=>tz,gR:()=>az,dy:()=>sz,Y:()=>rz,jD:()=>nz,ZM:()=>uz,Vz:()=>_z,Fv:()=>am,GP:()=>YZe,BZ:()=>mE,Hi:()=>jZe,xf:()=>ZZe,gO:()=>SE,gu:()=>qZe,RW:()=>GF,d0:()=>qF,ql:()=>BF,Kh:()=>FZe});var t={enableSkeletonsOnNodesCount:300,renderSkeletonOnZoomLessThan:.2,minSectorWidthInPixels:500,sectorsCount:200,sectorsVirtualBorderWidth:.2,renderAfterZoomThrottleInMs:10},e={node:{width:186,defaultHeight:115,heightWithPreview:151,heightWithPreviewEov:196,heightFull:237,borderRadius:12,headerHeight:36,componentAddActionHeight:40,componentPreviewHeight:114,componentControlHeight:44,componentOrderRadius:12,defaultConnectorPositionY:57,connectorPositionY:93,connectorPositionDiff:20,control:{connectorRadius:8,actionLinkY:12,inactionLinkY:32,lineLength:22}},tool:{menuItemWidth:210,menuItemHeight:32,menuItemTooltipOffset:8,borderRadius:4,eov:{size:22,radius:10},copyPasteDx:50,copyPasteDy:50},strokeSize:1,iconSize:16,controlConnectorIconSize:12,color:{percentDiff:20,textPrimaryDark:"#FFFFFF",textPrimaryLight:"#0D0F12",textSecondary:"#86898F",textTertiary:"#5E6066",textNegative:"#E12727",iconsPrimaryDark:"#F2F5FF",iconsPrimaryLight:"#0D0F12",iconsTertiary:"#5E6066",iconsNegative:"#E12727",backgroundContent:"#1A1D20",backgroundSecondary:"#282A2E",backgroundSecondaryAlpha:"#0D0F128C",backgroundContrast:"#FFFFFF",backgroundContrastSecondaryAlpha:"#FFFFFF1C",backgroundFieldBackground:"#FFFFFF0F",backgroundAccent:"#7B68EE",backgroundAccentThemed:"#9889F2",backgroundNegative:"#CC0E0E",backgroundNegativeTint:"#A500003D",backgroundNegativeTint2:"#A5000014",strokeContrast:"#F2F5FF",strokeImageBorderAlpha:"#5E6066",strokeFieldBorderAlpha:"#35383C",strokeFieldBorderAlpha2:"#1A1D20",strokeAccent:"#7B68EE",strokeNegative:"#A50000BA",hoverBackgroundSecondary:"#35383C",hoverBackgroundSecondaryAlpha:"#FFFFFF1C",hoverBackgroundTertiaryAlpha:"#FFFFFF0F",hoverNegative:"#E12727",activeBackgroundSecondaryAlpha:"#FFFFFF1C",otherOverlayPrimary:"#0D0F12E3"},prefix:{nodeEOV:"eov_",nodeBorder:"border_",nodeFlipConnector:"flip_connector_",nodeActionConnector:"action_connector_",nodeInactionConnector:"inaction_connector_",nodeError:"error_"},grid:{size:18.6,steps:10}},r={node_video_error:"No video",node_video_choose:"Choose video",node_video_change:"Change video",node_open_editor:"Open editor",node_eov:"Flip to",node_add_control:"Add action",node_not_visited:"Not visited",node_watch_again_from:"Watch again",node_views:"Views",node_no_stats_data:"No information",tool_menu_item_rename:"Rename",tool_menu_item_copy:"Copy",tool_menu_item_paste:"Paste",tool_menu_item_delete:"Delete",tool_menu_item_add_node:"Add node",tool_menu_item_as_start_node:"Set as Start node",tool_menu_item_as_end_node:"Set as End node",tool_menu_items_as_end_node:"Set as End nodes",tool_menu_item_as_node:"Set as node",tool_menu_items_as_node:"Set as nodes",tool_menu_item_start_preview:"Start preview",tool_menu_item_focus_on_node:"Focus on node",tool_menu_item_replace_video:"Replace video",tool_menu_item_next_node:"Next node",tool_menu_item_random:"Random",tool_menu_item_control_area:"Area",tool_menu_item_control_button:"Button",tool_shadow_node_text:`Click on the left mouse button to create a node. Click on the right button to cancel the action.`,tool_shadow_node_link_text:"New node",tool_shadow_node_error:`The area must not be in contact with other nodes`,popup_error_title:"Error",popup_error_message_1:"Manifest is broken",popup_error_message_2:"Manifest media metadata should be parsed",new_chapter_label:"[Untitled]",copied_chapter_suffix:"Copy",new_text_label:"Text",new_text_content:"Enter text",new_button_label:"Button",new_area_label:"Area",tooltip_transition_not_available:"Cannot configure transition",tooltip_inaction_not_available:"The “Wait for interaction” option is enabled",tooltip_cannot_add_action_to_uri:"The “Follow link” setting is selected",tooltip_check_interactive_settings:"Check your interactive settings",tooltip_video_was_changed:"The video file was replaced in the chapter",tooltip_is_interaction:"If there is interaction",tooltip_is_no_interaction:"If there is no interaction",tooltip_no_interactive_added:"No interactive added to the chapter",tooltip_starting_chapter:"Starting Chapter",tooltip_final_chapter:"The final chapter",copy_chapter:"Node copied",copy_multiple_chapters:"Multiple nodes copied",remove_initial_chapter:"Start node cannot be removed",graph_node_start:"Start",graph_node_end:"End",graph_location:"Current position",navigation_controls:"Zoom"},i={node_video_error:"Нет видео",node_video_choose:"Выбрать видео",node_video_change:"Заменить видео",node_open_editor:"Открыть редактор",node_eov:"Перейти к",node_add_control:"Добавить действие",node_not_visited:"Не пройдено",node_watch_again_from:"Пересмотреть",node_views:"Просмотры",node_no_stats_data:"Нет данных",tool_menu_item_rename:"Переименовать",tool_menu_item_copy:"Копировать",tool_menu_item_paste:"Вставить",tool_menu_item_delete:"Удалить",tool_menu_item_add_node:"Новый нод",tool_menu_item_as_start_node:"Назначить стартовым",tool_menu_item_as_end_node:"Назначить финальным",tool_menu_items_as_end_node:"Назначить финальными",tool_menu_item_as_node:"Назначить обычным",tool_menu_items_as_node:"Назначить обычными",tool_menu_item_start_preview:"Начать предпросмотр",tool_menu_item_focus_on_node:"Перейти к ноду",tool_menu_item_replace_video:"Заменить видео",tool_menu_item_next_node:"Следующий нод",tool_menu_item_random:"Случайный",tool_menu_item_control_area:"Область",tool_menu_item_control_button:"Кнопка",tool_shadow_node_text:`Нажмите на левую кнопку мыши, чтобы создать нод. Нажмите на правую кнопку мыши, чтобы отменить действие.`,tool_shadow_node_link_text:"Новый нод",tool_shadow_node_error:`Область не должна задевать другие ноды`,popup_error_title:"Ошибка",popup_error_message_1:"Манифест сломан",popup_error_message_2:"Необходим парсинг поля 'metadata.media'",new_chapter_label:"[Без названия]",copied_chapter_suffix:"Копия",new_text_label:"Текст",new_text_content:"Введите текст",new_button_label:"Кнопка",new_area_label:"Область",tooltip_transition_not_available:"Нельзя настроить переход",tooltip_inaction_not_available:"Включен параметр “Ожидание взаимодействия”",tooltip_cannot_add_action_to_uri:"Выбрана настройка “Перейти по ссылке”",tooltip_check_interactive_settings:"Проверьте настройки интерактивов",tooltip_video_was_changed:"В главе был заменен видеофайл",tooltip_is_interaction:"Если есть взаимодействие",tooltip_is_no_interaction:"Если нет взаимодействия",tooltip_no_interactive_added:"В главу не добавлен интерактив",tooltip_starting_chapter:"Стартовая глава",tooltip_final_chapter:"Финальная глава",copy_chapter:"Нод скопирован",copy_multiple_chapters:"Несколько нод скопированы",remove_initial_chapter:"Стартовый нод нельзя удалить",graph_node_start:"Начало",graph_node_end:"Конец",graph_location:"Моя позиция",navigation_controls:"Перемещение"},n=function(){return n=Object.assign||function(h){for(var f,p=1,g=arguments.length;p0)&&!(N=le.next()).done;)se.push(N.value)}catch(Ae){H={error:Ae}}finally{try{N&&!N.done&&(O=le.return)&&O.call(le)}finally{if(H)throw H.error}}return se})(g),!1))}))},this.dispose=function(){f.resetListeners()},this.resetListeners()}return h.prototype.resetListeners=function(){this._listeners={manifestUpdate:[],selectBranches:[],control:[],zoom:[],notification:[],actions:[],events:[]}},h})());var s;(function(h){h.Node="icon_node",h.StartNode="icon_start_node",h.EndNode="icon_end_node",h.EndOfVideo="icon_end_of_video",h.ActionButton="icon_action_button",h.ActionArea="icon_action_area",h.Arrow="icon_arrow",h.Etc="icon_etc",h.Add="icon_add",h.Random="icon_random",h.Warning="icon_warning",h.Move="icon_move",h.Plus="icon_plus",h.Play="icon_play",h.Minus="icon_minus",h.Action="icon_action",h.Inaction="icon_inaction",h.Location="icon_location",h.Lock="icon_lock",h.LegendNavigation="icon_legend_navigation",h.PencilFilled="icon_pencil_filled",h.Pencil="icon_pencil",h.Copy="icon_copy",h.TrashCan="icon_trash_can",h.Video="icon_video",h.CreateNode="icon_create_node",h.Paste="icon_paste"})(s||(s={}));var l,u=[s.Plus,s.Minus,s.Action,s.Inaction],c=function(h){var f,p,g;try{for(var y=(function(R){var O=typeof Symbol=="function"&&Symbol.iterator,N=O&&R[O],H=0;if(N)return N.call(R);if(R&&typeof R.length=="number")return{next:function(){return R&&H>=R.length&&(R=void 0),{value:R&&R[H++],done:!R}}};throw new TypeError(O?"Object is not iterable.":"Symbol.iterator is not defined.")})((g=s,Object.keys(g).filter((function(R){return Number.isNaN(+R)})))),T=y.next();!T.done;T=y.next()){var x=T.value;h.append("svg").attr("id",s[x]).attr("class","icon").attr("height",u.includes(s[x])?a.render.controlConnectorIconSize:a.render.iconSize).attr("width",u.includes(s[x])?a.render.controlConnectorIconSize:a.render.iconSize).html(Bo(254)("./".concat(s[x],".svg")))}}catch(R){f={error:R}}finally{try{T&&!T.done&&(p=y.return)&&p.call(y)}finally{if(f)throw f.error}}},d="M 0, 0 m -5, 0 a 5,5 0 1,0 10,0 a 5,5 0 1,0 -10,0",v="-7 -7 14 14";(function(h){h.Circle="marker_circle",h.CircleDisabled="marker_circle_disabled",h.Connector="marker_connector"})(l||(l={}));var m=[{name:l.Circle,path:d,viewBox:v,stroke:a.render.color.strokeContrast,strokeWidth:2,size:8,fill:a.render.color.strokeContrast},{name:l.CircleDisabled,path:d,viewBox:v,stroke:a.render.color.strokeImageBorderAlpha,strokeWidth:2,size:8,fill:a.render.color.backgroundContent},{name:l.Connector,path:d,viewBox:v,stroke:a.render.color.strokeContrast,strokeWidth:2,size:16,fill:a.render.color.backgroundContent}];function b(){}function _(h){return h==null?b:function(){return this.querySelector(h)}}function S(){return[]}function M(h){return h==null?S:function(){return this.querySelectorAll(h)}}function E(h){return function(){return this.matches(h)}}function C(h){return function(f){return f.matches(h)}}var A=Array.prototype.find;function k(){return this.firstElementChild}var L=Array.prototype.filter;function D(){return Array.from(this.children)}function P(h){return new Array(h.length)}function F(h,f){this.ownerDocument=h.ownerDocument,this.namespaceURI=h.namespaceURI,this._next=null,this._parent=h,this.__data__=f}function V(h,f,p,g,y,T){for(var x,R=0,O=f.length,N=T.length;Rf?1:h>=f?0:NaN}F.prototype={constructor:F,appendChild:function(h){return this._parent.insertBefore(h,this._next)},insertBefore:function(h,f){return this._parent.insertBefore(h,f)},querySelector:function(h){return this._parent.querySelector(h)},querySelectorAll:function(h){return this._parent.querySelectorAll(h)}};var te="http://www.w3.org/1999/xhtml";const Q={svg:"http://www.w3.org/2000/svg",xhtml:te,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function re(h){var f=h+="",p=f.indexOf(":");return p>=0&&(f=h.slice(0,p))!=="xmlns"&&(h=h.slice(p+1)),Q.hasOwnProperty(f)?{space:Q[f],local:h}:h}function _e(h){return function(){this.removeAttribute(h)}}function me(h){return function(){this.removeAttributeNS(h.space,h.local)}}function ae(h,f){return function(){this.setAttribute(h,f)}}function Me(h,f){return function(){this.setAttributeNS(h.space,h.local,f)}}function be(h,f){return function(){var p=f.apply(this,arguments);p==null?this.removeAttribute(h):this.setAttribute(h,p)}}function X(h,f){return function(){var p=f.apply(this,arguments);p==null?this.removeAttributeNS(h.space,h.local):this.setAttributeNS(h.space,h.local,p)}}function We(h){return h.ownerDocument&&h.ownerDocument.defaultView||h.document&&h||h.defaultView}function Oe(h){return function(){this.style.removeProperty(h)}}function Se(h,f,p){return function(){this.style.setProperty(h,f,p)}}function ve(h,f,p){return function(){var g=f.apply(this,arguments);g==null?this.style.removeProperty(h):this.style.setProperty(h,g,p)}}function Fe(h,f){return h.style.getPropertyValue(f)||We(h).getComputedStyle(h,null).getPropertyValue(f)}function De(h){return function(){delete this[h]}}function He(h,f){return function(){this[h]=f}}function pe(h,f){return function(){var p=f.apply(this,arguments);p==null?delete this[h]:this[h]=p}}function tt(h){return h.trim().split(/^|\s+/)}function it(h){return h.classList||new Ke(h)}function Ke(h){this._node=h,this._names=tt(h.getAttribute("class")||"")}function ce(h,f){for(var p=it(h),g=-1,y=f.length;++g=0&&(this._names.splice(f,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(h){return this._names.indexOf(h)>=0}};var Pr=[null];function rr(h,f){this._groups=h,this._parents=f}function qt(){return new rr([[document.documentElement]],Pr)}rr.prototype=qt.prototype={constructor:rr,select:function(h){typeof h!="function"&&(h=_(h));for(var f=this._groups,p=f.length,g=new Array(p),y=0;y=Ye&&(Ye=It+1);!(Nt=gt[Ye])&&++Ye=0;)(g=y[T])&&(x&&4^g.compareDocumentPosition(x)&&x.parentNode.insertBefore(g,x),x=g);return this},sort:function(h){function f(le,se){return le&&se?h(le.__data__,se.__data__):!le-!se}h||(h=J);for(var p=this._groups,g=p.length,y=new Array(g),T=0;T1?this.each((f==null?Oe:typeof f=="function"?ve:Se)(h,f,p??"")):Fe(this.node(),h)},property:function(h,f){return arguments.length>1?this.each((f==null?De:typeof f=="function"?pe:He)(h,f)):this.node()[h]},classed:function(h,f){var p=tt(h+"");if(arguments.length<2){for(var g=it(this.node()),y=-1,T=p.length;++y=0&&(Ae=se.slice(qe+1),se=se.slice(0,qe)),{type:se,name:Ae}}))})(h+""),x=T.length;if(!(arguments.length<2)){for(R=f?or:$t,g=0;g{}};function ln(){for(var h,f=0,p=arguments.length,g={};f=0&&(N=O.slice(H+1),O=O.slice(0,H)),O&&!g.hasOwnProperty(O))throw new Error("unknown type: "+O);return{type:O,name:N}}))),x=-1,R=T.length;if(!(arguments.length<2)){if(f!=null&&typeof f!="function")throw new Error("invalid callback: "+f);for(;++x0)for(var p,g,y=new Array(p),T=0;T=0&&f._call.call(void 0,h),f=f._next;--ta})()}finally{ta=0,(function(){for(var h,f,p=wa,g=1/0;p;)p._call?(g>p._time&&(g=p._time),h=p,p=p._next):(f=p._next,p._next=null,p=h?h._next=f:wa=f);_i=h,Zn(g)})(),Hn=0}}function Yr(){var h=Be.now(),f=h-ja;f>bo&&(jr-=f,ja=h)}function Zn(h){ta||(Zi&&(Zi=clearTimeout(Zi)),h-Hn>24?(h<1/0&&(Zi=setTimeout(Qi,h-Be.now()-jr)),ra&&(ra=clearInterval(ra))):(ra||(ja=Be.now(),ra=setInterval(Yr,bo)),ta=1,Jr(Qi)))}function io(h,f,p){var g=new mr;return f=f==null?0:+f,g.restart((y=>{g.stop(),h(y+f)}),f,p),g}mr.prototype=xi.prototype={constructor:mr,restart:function(h,f,p){if(typeof h!="function")throw new TypeError("callback is not a function");p=(p==null?Ci():+p)+(f==null?0:+f),this._next||_i===this||(_i?_i._next=this:wa=this,_i=this),this._call=h,this._time=p,Zn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Zn())}};var no=cn("start","end","cancel","interrupt"),Ha=[],Gn=0,dn=3;function Uo(h,f,p,g,y,T){var x=h.__transition;if(x){if(p in x)return}else h.__transition={};(function(R,O,N){var H,le=R.__transition;function se(Ue){var gt,St,Nt,It;if(N.state!==1)return qe();for(gt in le)if((It=le[gt]).name===N.name){if(It.state===dn)return io(se);It.state===4?(It.state=6,It.timer.stop(),It.on.call("interrupt",R,R.__data__,It.index,It.group),delete le[gt]):+gtGn)throw new Error("too late; already scheduled");return p}function en(h,f){var p=wi(h,f);if(p.state>dn)throw new Error("too late; already running");return p}function wi(h,f){var p=h.__transition;if(!p||!(p=p[f]))throw new Error("transition not found");return p}function ia(h,f){var p,g,y,T=h.__transition,x=!0;if(T){for(y in f=f==null?null:f+"",T)(p=T[y]).name===f?(g=p.state>2&&p.state<5,p.state=6,p.timer.stop(),p.on.call(g?"interrupt":"cancel",h,h.__data__,p.index,p.group),delete T[y]):x=!1;x&&delete h.__transition}}function hn(h,f){return h=+h,f=+f,function(p){return h*(1-p)+f*p}}var Za,vs=180/Math.PI,Fo={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function zl(h,f,p,g,y,T){var x,R,O;return(x=Math.sqrt(h*h+f*f))&&(h/=x,f/=x),(O=h*p+f*g)&&(p-=h*O,g-=f*O),(R=Math.sqrt(p*p+g*g))&&(p/=R,g/=R,O/=R),h*g180?H+=360:H-N>180&&(N+=360),se.push({i:le.push(y(le)+"rotate(",null,g)-2,x:hn(N,H)})):H&&le.push(y(le)+"rotate("+H+g)})(T.rotate,x.rotate,R,O),(function(N,H,le,se){N!==H?se.push({i:le.push(y(le)+"skewX(",null,g)-2,x:hn(N,H)}):H&&le.push(y(le)+"skewX("+H+g)})(T.skewX,x.skewX,R,O),(function(N,H,le,se,Ae,qe){if(N!==le||H!==se){var Ue=Ae.push(y(Ae)+"scale(",null,",",null,")");qe.push({i:Ue-4,x:hn(N,le)},{i:Ue-2,x:hn(H,se)})}else le===1&&se===1||Ae.push(y(Ae)+"scale("+le+","+se+")")})(T.scaleX,T.scaleY,x.scaleX,x.scaleY,R,O),T=x=null,function(N){for(var H,le=-1,se=O.length;++le>8&15|f>>4&240,f>>4&15|240&f,(15&f)<<4|15&f,1):p===8?Ca(f>>24&255,f>>16&255,f>>8&255,(255&f)/255):p===4?Ca(f>>12&15|f>>8&240,f>>8&15|f>>4&240,f>>4&15|240&f,((15&f)<<4|15&f)/255):null):(f=_o.exec(h))?new tn(f[1],f[2],f[3],1):(f=va.exec(h))?new tn(255*f[1]/100,255*f[2]/100,255*f[3]/100,1):(f=Os.exec(h))?Ca(f[1],f[2],f[3],f[4]):(f=bs.exec(h))?Ca(255*f[1]/100,255*f[2]/100,255*f[3]/100,f[4]):(f=Sr.exec(h))?vn(f[1],f[2]/100,f[3]/100,1):(f=Bn.exec(h))?vn(f[1],f[2]/100,f[3]/100,f[4]):Ps.hasOwnProperty(h)?yo(Ps[h]):h==="transparent"?new tn(NaN,NaN,NaN,0):null}function yo(h){return new tn(h>>16&255,h>>8&255,255&h,1)}function Ca(h,f,p,g){return g<=0&&(h=f=p=NaN),new tn(h,f,p,g)}function xa(h,f,p,g){return arguments.length===1?(function(y){return y instanceof Ga||(y=Ln(y)),y?new tn((y=y.rgb()).r,y.g,y.b,y.opacity):new tn})(h):new tn(h,f,p,g??1)}function tn(h,f,p,g){this.r=+h,this.g=+f,this.b=+p,this.opacity=+g}function _s(){return`#${La(this.r)}${La(this.g)}${La(this.b)}`}function ka(){const h=aa(this.opacity);return`${h===1?"rgb(":"rgba("}${qn(this.r)}, ${qn(this.g)}, ${qn(this.b)}${h===1?")":`, ${h})`}`}function aa(h){return isNaN(h)?1:Math.max(0,Math.min(1,h))}function qn(h){return Math.max(0,Math.min(255,Math.round(h)||0))}function La(h){return((h=qn(h))<16?"0":"")+h.toString(16)}function vn(h,f,p,g){return g<=0?h=f=p=NaN:p<=0||p>=1?h=f=NaN:f<=0&&(h=NaN),new $n(h,f,p,g)}function So(h){if(h instanceof $n)return new $n(h.h,h.s,h.l,h.opacity);if(h instanceof Ga||(h=Ln(h)),!h)return new $n;if(h instanceof $n)return h;var f=(h=h.rgb()).r/255,p=h.g/255,g=h.b/255,y=Math.min(f,p,g),T=Math.max(f,p,g),x=NaN,R=T-y,O=(T+y)/2;return R?(x=f===T?(p-g)/R+6*(p0&&O<1?0:x,new $n(x,R,O,h.opacity)}function $n(h,f,p,g){this.h=+h,this.s=+f,this.l=+p,this.opacity=+g}function Zo(h){return(h=(h||0)%360)<0?h+360:h}function Go(h){return Math.max(0,Math.min(1,h||0))}function Er(h,f,p){return 255*(h<60?f+(p-f)*h/60:h<180?p:h<240?f+(p-f)*(240-h)/60:f)}zo(Ga,Ln,{copy(h){return Object.assign(new this.constructor,this,h)},displayable(){return this.rgb().displayable()},hex:Ho,formatHex:Ho,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return So(this).formatHsl()},formatRgb:Ns,toString:Ns}),zo(tn,xa,Aa(Ga,{brighter(h){return h=h==null?jo:Math.pow(jo,h),new tn(this.r*h,this.g*h,this.b*h,this.opacity)},darker(h){return h=h==null?Wa:Math.pow(Wa,h),new tn(this.r*h,this.g*h,this.b*h,this.opacity)},rgb(){return this},clamp(){return new tn(qn(this.r),qn(this.g),qn(this.b),aa(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:_s,formatHex:_s,formatHex8:function(){return`#${La(this.r)}${La(this.g)}${La(this.b)}${La(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:ka,toString:ka})),zo($n,(function(h,f,p,g){return arguments.length===1?So(h):new $n(h,f,p,g??1)}),Aa(Ga,{brighter(h){return h=h==null?jo:Math.pow(jo,h),new $n(this.h,this.s,this.l*h,this.opacity)},darker(h){return h=h==null?Wa:Math.pow(Wa,h),new $n(this.h,this.s,this.l*h,this.opacity)},rgb(){var h=this.h%360+360*(this.h<0),f=isNaN(h)||isNaN(this.s)?0:this.s,p=this.l,g=p+(p<.5?p:1-p)*f,y=2*p-g;return new tn(Er(h>=240?h-240:h+120,y,g),Er(h,y,g),Er(h<120?h+240:h-120,y,g),this.opacity)},clamp(){return new $n(Zo(this.h),Go(this.s),Go(this.l),aa(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const h=aa(this.opacity);return`${h===1?"hsl(":"hsla("}${Zo(this.h)}, ${100*Go(this.s)}%, ${100*Go(this.l)}%${h===1?")":`, ${h})`}`}}));const ei=h=>()=>h;function oa(h,f){var p=f-h;return p?(function(g,y){return function(T){return g+T*y}})(h,p):ei(isNaN(h)?f:h)}const yi=(function h(f){var p=(function(y){return(y=+y)==1?oa:function(T,x){return x-T?(function(R,O,N){return R=Math.pow(R,N),O=Math.pow(O,N)-R,N=1/N,function(H){return Math.pow(R+H*O,N)}})(T,x,y):ei(isNaN(T)?x:T)}})(f);function g(y,T){var x=p((y=xa(y)).r,(T=xa(T)).r),R=p(y.g,T.g),O=p(y.b,T.b),N=oa(y.opacity,T.opacity);return function(H){return y.r=x(H),y.g=R(H),y.b=O(H),y.opacity=N(H),y+""}}return g.gamma=h,g})(1);var so=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ys=new RegExp(so.source,"g");function Ds(h,f){var p,g,y,T=so.lastIndex=ys.lastIndex=0,x=-1,R=[],O=[];for(h+="",f+="";(p=so.exec(h))&&(g=ys.exec(f));)(y=g.index)>T&&(y=f.slice(T,y),R[x]?R[x]+=y:R[++x]=y),(p=p[0])===(g=g[0])?R[x]?R[x]+=g:R[++x]=g:(R[++x]=null,O.push({i:x,x:hn(p,g)})),T=ys.lastIndex;return T=0&&(H=H.slice(0,le)),!H||H==="start"}))})(y)?Wn:en;return function(){var N=O(this,g),H=N.on;H!==x&&(R=(x=H).copy()).on(y,T),N.on=R}})(p,h,f))},attr:function(h,f){var p=re(h),g=p==="transform"?ms:Eo;return this.attrTween(h,typeof f=="function"?(p.local?Tu:Rn)(p,g,oo(this,"attr."+h,f)):f==null?(p.local?Hl:To)(p):(p.local?Eu:Vs)(p,g,f))},attrTween:function(h,f){var p="attr."+h;if(arguments.length<2)return(p=this.tween(p))&&p._value;if(f==null)return this.tween(p,null);if(typeof f!="function")throw new Error;var g=re(h);return this.tween(p,(g.local?Zl:Gl)(g,f))},style:function(h,f,p){var g=(h+="")=="transform"?jl:Eo;return f==null?this.styleTween(h,(function(y,T){var x,R,O;return function(){var N=Fe(this,y),H=(this.style.removeProperty(y),Fe(this,y));return N===H?null:N===x&&H===R?O:O=T(x=N,R=H)}})(h,g)).on("end.style."+h,Gr(h)):typeof f=="function"?this.styleTween(h,(function(y,T,x){var R,O,N;return function(){var H=Fe(this,y),le=x(this),se=le+"";return le==null&&(this.style.removeProperty(y),se=le=Fe(this,y)),H===se?null:H===R&&se===O?N:(O=se,N=T(R=H,le))}})(h,g,oo(this,"style."+h,f))).each((function(y,T){var x,R,O,N,H="style."+T,le="end."+H;return function(){var se=en(this,y),Ae=se.on,qe=se.value[H]==null?N||(N=Gr(T)):void 0;Ae===x&&O===qe||(R=(x=Ae).copy()).on(le,O=qe),se.on=R}})(this._id,h)):this.styleTween(h,(function(y,T,x){var R,O,N=x+"";return function(){var H=Fe(this,y);return H===N?null:H===R?O:O=T(R=H,x)}})(h,g,f),p).on("end.style."+h,null)},styleTween:function(h,f,p){var g="style."+(h+="");if(arguments.length<2)return(g=this.tween(g))&&g._value;if(f==null)return this.tween(g,null);if(typeof f!="function")throw new Error;return this.tween(g,(function(y,T,x){var R,O;function N(){var H=T.apply(this,arguments);return H!==O&&(R=(O=H)&&(function(le,se,Ae){return function(qe){this.style.setProperty(le,se.call(this,qe),Ae)}})(y,H,x)),R}return N._value=T,N})(h,f,p??""))},text:function(h){return this.tween("text",typeof h=="function"?(function(f){return function(){var p=f(this);this.textContent=p??""}})(oo(this,"text",h)):(function(f){return function(){this.textContent=f}})(h==null?"":h+""))},textTween:function(h){var f="text";if(arguments.length<1)return(f=this.tween(f))&&f._value;if(h==null)return this.tween(f,null);if(typeof h!="function")throw new Error;return this.tween(f,(function(p){var g,y;function T(){var x=p.apply(this,arguments);return x!==y&&(g=(y=x)&&(function(R){return function(O){this.textContent=R.call(this,O)}})(x)),g}return T._value=p,T})(h))},remove:function(){return this.on("end.remove",(function(h){return function(){var f=this.parentNode;for(var p in this.__transition)if(+p!==h)return;f&&f.removeChild(this)}})(this._id))},tween:function(h,f){var p=this._id;if(h+="",arguments.length<2){for(var g,y=wi(this.node(),p).tween,T=0,x=y.length;T()=>h;function Ts(h,{sourceEvent:f,subject:p,target:g,identifier:y,active:T,x,y:R,dx:O,dy:N,dispatch:H}){Object.defineProperties(this,{type:{value:h,enumerable:!0,configurable:!0},sourceEvent:{value:f,enumerable:!0,configurable:!0},subject:{value:p,enumerable:!0,configurable:!0},target:{value:g,enumerable:!0,configurable:!0},identifier:{value:y,enumerable:!0,configurable:!0},active:{value:T,enumerable:!0,configurable:!0},x:{value:x,enumerable:!0,configurable:!0},y:{value:R,enumerable:!0,configurable:!0},dx:{value:O,enumerable:!0,configurable:!0},dy:{value:N,enumerable:!0,configurable:!0},_:{value:H}})}function Kt(h){return!h.ctrlKey&&!h.button}function Oi(){return this.parentNode}function Fn(h,f){return f??{x:h.x,y:h.y}}function ma(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ia(){var h,f,p,g,y=Kt,T=Oi,x=Fn,R=ma,O={},N=cn("start","drag","end"),H=0,le=0;function se(Ye){Ye.on("mousedown.drag",Ae).filter(R).on("touchstart.drag",gt).on("touchmove.drag",St,Ra).on("touchend.drag touchcancel.drag",Nt).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function Ae(Ye,Dt){if(!g&&y.call(this,Ye,Dt)){var er=It(this,T.call(this,Ye,Dt),Ye,Dt,"mouse");er&&(Cr(Ye.view).on("mousemove.drag",qe,In).on("mouseup.drag",Ue,In),Ao(Ye.view),wo(Ye),p=!1,h=Ye.clientX,f=Ye.clientY,er("start",Ye))}}function qe(Ye){if(Un(Ye),!p){var Dt=Ye.clientX-h,er=Ye.clientY-f;p=Dt*Dt+er*er>le}O.mouse("drag",Ye)}function Ue(Ye){Cr(Ye.view).on("mousemove.drag mouseup.drag",null),Es(Ye.view,p),Un(Ye),O.mouse("end",Ye)}function gt(Ye,Dt){if(y.call(this,Ye,Dt)){var er,_r,Tr=Ye.changedTouches,Vr=T.call(this,Ye,Dt),Sn=Tr.length;for(er=0;er=0?(T>=Mo?10:T>=ga?5:T>=Co?2:1)*Math.pow(10,y):-Math.pow(10,-y)/(T>=Mo?10:T>=ga?5:T>=Co?2:1)}function ll(h,f){return h==null||f==null?NaN:hf?1:h>=f?0:NaN}function qo(h,f){return h==null||f==null?NaN:fh?1:f>=h?0:NaN}function yc(h){let f,p,g;function y(T,x,R=0,O=T.length){if(R>>1;p(T[N],x)<0?R=N+1:O=N}while(Rll(h(T),x),g=(T,x)=>h(T)-x):(f=h===ll||h===qo?h:Sc,p=h,g=h),{left:y,center:function(T,x,R=0,O=T.length){const N=y(T,x,R,O-1);return N>R&&g(T[N-1],x)>-g(T[N],x)?N-1:N},right:function(T,x,R=0,O=T.length){if(R>>1;p(T[N],x)<=0?R=N+1:O=N}while(R=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Au(h){if(!(f=Ec.exec(h)))throw new Error("invalid format: "+h);var f;return new Mu({fill:f[1],align:f[2],sign:f[3],symbol:f[4],zero:f[5],width:f[6],comma:f[7],precision:f[8]&&f[8].slice(1),trim:f[9],type:f[10]})}function Mu(h){this.fill=h.fill===void 0?" ":h.fill+"",this.align=h.align===void 0?">":h.align+"",this.sign=h.sign===void 0?"-":h.sign+"",this.symbol=h.symbol===void 0?"":h.symbol+"",this.zero=!!h.zero,this.width=h.width===void 0?void 0:+h.width,this.comma=!!h.comma,this.precision=h.precision===void 0?void 0:+h.precision,this.trim=!!h.trim,this.type=h.type===void 0?"":h.type+""}function Wl(h,f){if((p=(h=f?h.toExponential(f-1):h.toExponential()).indexOf("e"))<0)return null;var p,g=h.slice(0,p);return[g.length>1?g[0]+g.slice(2):g,+h.slice(p+1)]}function Xo(h){return(h=Wl(Math.abs(h)))?h[1]:NaN}function ql(h,f){var p=Wl(h,f);if(!p)return h+"";var g=p[0],y=p[1];return y<0?"0."+new Array(-y).join("0")+g:g.length>y+1?g.slice(0,y+1)+"."+g.slice(y+1):g+new Array(y-g.length+2).join("0")}Au.prototype=Mu.prototype,Mu.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,0|this.width))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Tc={"%":(h,f)=>(100*h).toFixed(f),b:h=>Math.round(h).toString(2),c:h=>h+"",d:function(h){return Math.abs(h=Math.round(h))>=1e21?h.toLocaleString("en").replace(/,/g,""):h.toString(10)},e:(h,f)=>h.toExponential(f),f:(h,f)=>h.toFixed(f),g:(h,f)=>h.toPrecision(f),o:h=>Math.round(h).toString(8),p:(h,f)=>ql(100*h,f),r:ql,s:function(h,f){var p=Wl(h,f);if(!p)return h+"";var g=p[0],y=p[1],T=y-(ul=3*Math.max(-8,Math.min(8,Math.floor(y/3))))+1,x=g.length;return T===x?g:T>x?g+new Array(T-x+1).join("0"):T>0?g.slice(0,T)+"."+g.slice(T):"0."+new Array(1-T).join("0")+Wl(h,Math.max(0,f+T-1))[0]},X:h=>Math.round(h).toString(16).toUpperCase(),x:h=>Math.round(h).toString(16)};function wc(h){return h}var co,Cu,ld,Qo=Array.prototype.map,ah=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function oh(h){var f=h.domain;return h.ticks=function(p){var g=f();return(function(y,T,x){var R,O,N,H,le=-1;if(x=+x,(y=+y)==(T=+T)&&x>0)return[y];if((R=T0){let se=Math.round(y/H),Ae=Math.round(T/H);for(se*HT&&--Ae,N=new Array(O=Ae-se+1);++leT&&--Ae,N=new Array(O=Ae-se+1);++le=Mo?gt*=10:St>=ga?gt*=5:St>=Co&&(gt*=2),Ae0;){if((y=sl(O,N,p))===g)return T[x]=O,T[R]=N,f(T);if(y>0)O=Math.floor(O/y)*y,N=Math.ceil(N/y)*y;else{if(!(y<0))break;O=Math.ceil(O*y)/y,N=Math.floor(N*y)/y}g=y}return h},h}function sh(){var h=(function(){var f,p,g,y,T,x,R=ki,O=ki,N=Ya,H=mn;function le(){var Ae=Math.min(R.length,O.length);return H!==mn&&(H=(function(qe,Ue){var gt;return qe>Ue&&(gt=qe,qe=Ue,Ue=gt),function(St){return Math.max(qe,Math.min(Ue,St))}})(R[0],R[Ae-1])),y=Ae>2?Yo:Yn,T=x=null,se}function se(Ae){return Ae==null||isNaN(Ae=+Ae)?g:(T||(T=y(R.map(f),O,N)))(f(H(Ae)))}return se.invert=function(Ae){return H(p((x||(x=y(O,R.map(f),hn)))(Ae)))},se.domain=function(Ae){return arguments.length?(R=Array.from(Ae,Nr),le()):R.slice()},se.range=function(Ae){return arguments.length?(O=Array.from(Ae),le()):O.slice()},se.rangeRound=function(Ae){return O=Array.from(Ae),N=Ct,le()},se.clamp=function(Ae){return arguments.length?(H=!!Ae||mn,le()):H!==mn},se.interpolate=function(Ae){return arguments.length?(N=Ae,le()):N},se.unknown=function(Ae){return arguments.length?(g=Ae,se):g},function(Ae,qe){return f=Ae,p=qe,le()}})()(mn,mn);return h.copy=function(){return f=h,sh().domain(f.domain()).range(f.range()).interpolate(f.interpolate()).clamp(f.clamp()).unknown(f.unknown());var f},xo.apply(h,arguments),oh(h)}function ii(h){return Cr(Re(h).call(document.documentElement))}co=(function(h){var f,p,g=h.grouping===void 0||h.thousands===void 0?wc:(f=Qo.call(h.grouping,Number),p=h.thousands+"",function(se,Ae){for(var qe=se.length,Ue=[],gt=0,St=f[0],Nt=0;qe>0&&St>0&&(Nt+St+1>Ae&&(St=Math.max(1,Ae-Nt)),Ue.push(se.substring(qe-=St,qe+St)),!((Nt+=St+1)>Ae));)St=f[gt=(gt+1)%f.length];return Ue.reverse().join(p)}),y=h.currency===void 0?"":h.currency[0]+"",T=h.currency===void 0?"":h.currency[1]+"",x=h.decimal===void 0?".":h.decimal+"",R=h.numerals===void 0?wc:(function(se){return function(Ae){return Ae.replace(/[0-9]/g,(function(qe){return se[+qe]}))}})(Qo.call(h.numerals,String)),O=h.percent===void 0?"%":h.percent+"",N=h.minus===void 0?"−":h.minus+"",H=h.nan===void 0?"NaN":h.nan+"";function le(se){var Ae=(se=Au(se)).fill,qe=se.align,Ue=se.sign,gt=se.symbol,St=se.zero,Nt=se.width,It=se.comma,Ye=se.precision,Dt=se.trim,er=se.type;er==="n"?(It=!0,er="g"):Tc[er]||(Ye===void 0&&(Ye=12),Dt=!0,er="g"),(St||Ae==="0"&&qe==="=")&&(St=!0,Ae="0",qe="=");var _r=gt==="$"?y:gt==="#"&&/[boxX]/.test(er)?"0"+er.toLowerCase():"",Tr=gt==="$"?T:/[%p]/.test(er)?O:"",Vr=Tc[er],Sn=/[defgprs%]/.test(er);function Ni(ai){var Ka,Pa,pl,ua=_r,at=Tr;if(er==="c")at=Vr(ai)+at,ai="";else{var hr=(ai=+ai)<0||1/ai<0;if(ai=isNaN(ai)?H:Vr(Math.abs(ai),Ye),Dt&&(ai=(function(pr){e:for(var wr,li=pr.length,Di=1,Li=-1;Di0&&(Li=0)}return Li>0?pr.slice(0,Li)+pr.slice(wr+1):pr})(ai)),hr&&+ai==0&&Ue!=="+"&&(hr=!1),ua=(hr?Ue==="("?Ue:N:Ue==="-"||Ue==="("?"":Ue)+ua,at=(er==="s"?ah[8+ul/3]:"")+at+(hr&&Ue==="("?")":""),Sn){for(Ka=-1,Pa=ai.length;++Ka(pl=ai.charCodeAt(Ka))||pl>57){at=(pl===46?x+ai.slice(Ka+1):ai.slice(Ka))+at,ai=ai.slice(0,Ka);break}}}It&&!St&&(ai=g(ai,1/0));var tr=ua.length+ai.length+at.length,Gt=tr>1)+ua+ai+at+Gt.slice(tr);break;default:ai=Gt+ua+ai+at}return R(ai)}return Ye=Ye===void 0?6:/[gprs]/.test(er)?Math.max(1,Math.min(21,Ye)):Math.max(0,Math.min(20,Ye)),Ni.toString=function(){return se+""},Ni}return{format:le,formatPrefix:function(se,Ae){var qe=le(((se=Au(se)).type="f",se)),Ue=3*Math.max(-8,Math.min(8,Math.floor(Xo(Ae)/3))),gt=Math.pow(10,-Ue),St=ah[8+Ue/3];return function(Nt){return qe(gt*Nt)+St}}}})({thousands:",",grouping:[3],currency:["$",""]}),Cu=co.format,ld=co.formatPrefix;const ud=Math.PI,Ac=2*ud,br=1e-6,Dr=Ac-br;function On(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function ws(){return new On}On.prototype=ws.prototype={constructor:On,moveTo:function(h,f){this._+="M"+(this._x0=this._x1=+h)+","+(this._y0=this._y1=+f)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(h,f){this._+="L"+(this._x1=+h)+","+(this._y1=+f)},quadraticCurveTo:function(h,f,p,g){this._+="Q"+ +h+","+ +f+","+(this._x1=+p)+","+(this._y1=+g)},bezierCurveTo:function(h,f,p,g,y,T){this._+="C"+ +h+","+ +f+","+ +p+","+ +g+","+(this._x1=+y)+","+(this._y1=+T)},arcTo:function(h,f,p,g,y){h=+h,f=+f,p=+p,g=+g,y=+y;var T=this._x1,x=this._y1,R=p-h,O=g-f,N=T-h,H=x-f,le=N*N+H*H;if(y<0)throw new Error("negative radius: "+y);if(this._x1===null)this._+="M"+(this._x1=h)+","+(this._y1=f);else if(le>br)if(Math.abs(H*R-O*N)>br&&y){var se=p-T,Ae=g-x,qe=R*R+O*O,Ue=se*se+Ae*Ae,gt=Math.sqrt(qe),St=Math.sqrt(le),Nt=y*Math.tan((ud-Math.acos((qe+le-Ue)/(2*gt*St)))/2),It=Nt/St,Ye=Nt/gt;Math.abs(It-1)>br&&(this._+="L"+(h+It*N)+","+(f+It*H)),this._+="A"+y+","+y+",0,0,"+ +(H*se>N*Ae)+","+(this._x1=h+Ye*R)+","+(this._y1=f+Ye*O)}else this._+="L"+(this._x1=h)+","+(this._y1=f)},arc:function(h,f,p,g,y,T){h=+h,f=+f,T=!!T;var x=(p=+p)*Math.cos(g),R=p*Math.sin(g),O=h+x,N=f+R,H=1^T,le=T?g-y:y-g;if(p<0)throw new Error("negative radius: "+p);this._x1===null?this._+="M"+O+","+N:(Math.abs(this._x1-O)>br||Math.abs(this._y1-N)>br)&&(this._+="L"+O+","+N),p&&(le<0&&(le=le%Ac+Ac),le>Dr?this._+="A"+p+","+p+",0,1,"+H+","+(h-x)+","+(f-R)+"A"+p+","+p+",0,1,"+H+","+(this._x1=O)+","+(this._y1=N):le>br&&(this._+="A"+p+","+p+",0,"+ +(le>=ud)+","+H+","+(this._x1=h+p*Math.cos(y))+","+(this._y1=f+p*Math.sin(y))))},rect:function(h,f,p,g){this._+="M"+(this._x0=this._x1=+h)+","+(this._y0=this._y1=+f)+"h"+ +p+"v"+ +g+"h"+-p+"Z"},toString:function(){return this._}};const xu=ws;var Yl=Array.prototype.slice;function cl(h){return function(){return h}}class Mc{constructor(f,p){this._context=f,this._x=p}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(f,p){switch(f=+f,p=+p,this._point){case 0:this._point=1,this._line?this._context.lineTo(f,p):this._context.moveTo(f,p);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+f)/2,this._y0,this._x0,p,f,p):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+p)/2,f,this._y0,f,p)}this._x0=f,this._y0=p}}function kp(h){return h[0]}function Ef(h){return h[1]}function K2(h){return h.source}function Tf(h){return h.target}function wf(h){return((h=Math.exp(h))+1/h)/2}const Af=(function h(f,p,g){function y(T,x){var R,O,N=T[0],H=T[1],le=T[2],se=x[0],Ae=x[1],qe=x[2],Ue=se-N,gt=Ae-H,St=Ue*Ue+gt*gt;if(St<1e-12)O=Math.log(qe/le)/f,R=function(_r){return[N+_r*Ue,H+_r*gt,le*Math.exp(f*_r*O)]};else{var Nt=Math.sqrt(St),It=(qe*qe-le*le+g*St)/(2*le*p*Nt),Ye=(qe*qe-le*le-g*St)/(2*qe*p*Nt),Dt=Math.log(Math.sqrt(It*It+1)-It),er=Math.log(Math.sqrt(Ye*Ye+1)-Ye);O=(er-Dt)/f,R=function(_r){var Tr=_r*O,Vr=wf(Dt),Sn=le/(p*Nt)*(Vr*(function(Ni){return((Ni=Math.exp(2*Ni))-1)/(Ni+1)})(f*Tr+Dt)-(function(Ni){return((Ni=Math.exp(Ni))-1/Ni)/2})(Dt));return[N+Sn*Ue,H+Sn*gt,le*Vr/wf(f*Tr+Dt)]}}return R.duration=1e3*O*f/Math.SQRT2,R}return y.rho=function(T){var x=Math.max(.001,+T),R=x*x;return h(x,R,R*R)},y})(Math.SQRT2,2,4),lh=h=>()=>h;function Mf(h,{sourceEvent:f,target:p,transform:g,dispatch:y}){Object.defineProperties(this,{type:{value:h,enumerable:!0,configurable:!0},sourceEvent:{value:f,enumerable:!0,configurable:!0},target:{value:p,enumerable:!0,configurable:!0},transform:{value:g,enumerable:!0,configurable:!0},_:{value:y}})}function Ko(h,f,p){this.k=h,this.x=f,this.y=p}Ko.prototype={constructor:Ko,scale:function(h){return h===1?this:new Ko(this.k*h,this.x,this.y)},translate:function(h,f){return h===0&f===0?this:new Ko(this.k,this.x+this.k*h,this.y+this.k*f)},apply:function(h){return[h[0]*this.k+this.x,h[1]*this.k+this.y]},applyX:function(h){return h*this.k+this.x},applyY:function(h){return h*this.k+this.y},invert:function(h){return[(h[0]-this.x)/this.k,(h[1]-this.y)/this.k]},invertX:function(h){return(h-this.x)/this.k},invertY:function(h){return(h-this.y)/this.k},rescaleX:function(h){return h.copy().domain(h.range().map(this.invertX,this).map(h.invert,h))},rescaleY:function(h){return h.copy().domain(h.range().map(this.invertY,this).map(h.invert,h))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var uh,zs=new Ko(1,0,0);function ch(h){h.stopImmediatePropagation()}function dl(h){h.preventDefault(),h.stopImmediatePropagation()}function cd(h){return!(h.ctrlKey&&h.type!=="wheel"||h.button)}function J2(){var h=this;return h instanceof SVGElement?(h=h.ownerSVGElement||h).hasAttribute("viewBox")?[[(h=h.viewBox.baseVal).x,h.y],[h.x+h.width,h.y+h.height]]:[[0,0],[h.width.baseVal.value,h.height.baseVal.value]]:[[0,0],[h.clientWidth,h.clientHeight]]}function dh(){return this.__zoom||zs}function Lp(h){return-h.deltaY*(h.deltaMode===1?.05:h.deltaMode?1:.002)*(h.ctrlKey?10:1)}function Cf(){return navigator.maxTouchPoints||"ontouchstart"in this}function em(h,f,p){var g=h.invertX(f[0][0])-p[0][0],y=h.invertX(f[1][0])-p[1][0],T=h.invertY(f[0][1])-p[0][1],x=h.invertY(f[1][1])-p[1][1];return h.translate(y>g?(g+y)/2:Math.min(0,g)||Math.max(0,y),x>T?(T+x)/2:Math.min(0,T)||Math.max(0,x))}Ko.prototype,(function(h){h.ErrorMarker="error_marker"})(uh||(uh={}));function Zt(h,f){var p=!1;h[0]==="#"&&(h=h.slice(1),p=!0);var g=parseInt(h,16),y=(g>>16)+f;y>255?y=255:y<0&&(y=0);var T=(g>>8&255)+f;T>255?T=255:T<0&&(T=0);var x=(255&g)+f;x>255?x=255:x<0&&(x=0);var R=x|T<<8|y<<16;return p?"#"+R.toString(16):R.toString(16)}var Ei=function(h){var f=h.x,p=h.y,g=h.w,y=h.h,T=h.r,x=T===void 0?0:T,R=h.border,O={tl:!1,tr:!1,br:!1,bl:!1};x&&(R?(O.tl=R[0],O.tr=R[1],O.br=R[3],O.bl=R[2]):(O.tl=!0,O.tr=!0,O.br=!0,O.bl=!0));var N="M"+(f+x)+","+p+"h"+(g-2*x);return O.tr?N+="a"+x+","+x+" 0 0 1 "+x+","+x:(N+="h"+x,N+="v"+x),N+="v"+(y-2*x),O.br?N+="a"+x+","+x+" 0 0 1 "+-x+","+x:(N+="v"+x,N+="h"+-x),N+="h"+(2*x-g),O.bl?N+="a"+x+","+x+" 0 0 1 "+-x+","+-x:(N+="h"+-x,N+="v"+-x),N+="v"+(2*x-y),O.tl?N+="a"+x+","+x+" 0 0 1 "+x+","+-x:(N+="v"+-x,N+="h"+x),N+"z"},ko="clip-border-",Xl="clip-",Jo=a.render.strokeSize/2,dd=2*Jo,h6=function(h){var f=h.id,p=h.width,g=h.height,y=h.element,T=h.r;y.append("clipPath").attr("id",Xl+f).append("path").attr("d",Ei({x:Jo,y:Jo,w:p-2*Jo,h:g-2*Jo,r:T})),y.attr("clip-path","url(#".concat(Xl).concat(f,")"))},As=function(h,f,p){f===void 0&&(f=!1),p===void 0&&(p=!1);var g=ii("svg:g"),y=p?a.render.color.backgroundContent:a.render.color.backgroundSecondary;return g.append("circle").attr("class","connector_circle").attr("r",a.render.node.control.connectorRadius-a.render.strokeSize).attr("fill",y).attr("stroke",p?a.render.color.strokeImageBorderAlpha:a.render.color.strokeContrast).attr("stroke-width",a.render.strokeSize).attr("cx",a.render.node.control.connectorRadius).attr("cy",a.render.node.control.connectorRadius),g.append("use").style("color",p?a.render.color.iconsTertiary:a.render.color.iconsPrimaryDark).attr("x",2).attr("y",2).attr("href","#".concat(h)),f&&g.on("mouseover",(function(){Cr(this).select(".connector_circle").attr("fill",a.render.color.hoverBackgroundSecondary)})).on("mouseout",(function(){Cr(this).select(".connector_circle").attr("fill",y)})),g},Ms=(function(h){let f=K2,p=Tf,g=kp,y=Ef,T=null,x=null;function R(){let O;const N=Yl.call(arguments),H=f.apply(this,N),le=p.apply(this,N);if(T==null&&(x=h(O=xu())),x.lineStart(),N[0]=H,x.point(+g.apply(this,N),+y.apply(this,N)),N[0]=le,x.point(+g.apply(this,N),+y.apply(this,N)),x.lineEnd(),O)return x=null,O+""||null}return R.source=function(O){return arguments.length?(f=O,R):f},R.target=function(O){return arguments.length?(p=O,R):p},R.x=function(O){return arguments.length?(g=typeof O=="function"?O:cl(+O),R):g},R.y=function(O){return arguments.length?(y=typeof O=="function"?O:cl(+O),R):y},R.context=function(O){return arguments.length?(O==null?T=x=null:x=h(T=O),R):T},R})((function(h){return new Mc(h,!0)})).x((function(h){return h[0]})).y((function(h){return h[1]})),$p=function(h,f){var p=typeof Symbol=="function"&&h[Symbol.iterator];if(!p)return h;var g,y,T=p.call(h),x=[];try{for(;(f===void 0||f-- >0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},p6=function(h,f,p){if(arguments.length===2)for(var g,y=0,T=f.length;ya.performance.renderSkeletonOnZoomLessThan;return this.isPerformanceBoostDisabled()||f},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"visibleMapLayoutCoordinates",{get:function(){var f=$e.dom.getEditorWindowSize(),p=f.width,g=f.height,y=$e.inputs.zoom.zoomPosition,T=y.x,x=y.y,R=$e.inputs.zoom.zoomFactor;return[[-T/R,-x/R],[(-T+p)/R,(-x+g)/R]]},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"branchesToRender",{get:function(){var f=$p(this.visibleMapLayoutCoordinates,2),p=$p(f[0],2),g=p[0],y=p[1],T=$p(f[1],2),x=T[0],R=T[1];return this.isPerformanceBoostDisabled()?_t.manifest.branches:_t.manifest.branches.filter((function(O){var N=xc(O.target.chapterId),H=xc(O.source.chapterId),le=[N,H].some((function(gt){return _t.sectors.isNodeVisible(gt.id)}));if(le)return!0;var se=N.y>R&&H.y>R,Ae=N.yx&&H.x>x,Ue=N.x=g||p>=g&&fg[f]?1:0}var Ir,Cc={edit:{background:{color:"#0D0F12",grid:{enabled:!0,color:"#474747"}},defaultChapter:{flipTo:{enabled:!0,backgroundColor:"#282A2E",textColor:"#FFFFFF"},controls:{enabled:!0,backgroundColor:"#282A2E",textColor:"#FFFFFF"},hover:{enabled:!0,borderColor:"#7B68EE"}},chapters:[]},view:{background:{color:"#0D0F12",grid:{enabled:!1,color:"#474747"}},defaultChapter:{header:{enabled:!0,backgroundColor:"#282A2E",textColor:"#FFFFFF"},flipTo:{enabled:!1,backgroundColor:"#282A2E",textColor:"#FFFFFF"},controls:{enabled:!1,backgroundColor:"#282A2E",textColor:"#FFFFFF"},hover:{enabled:!0,borderColor:"#2688EB"},watchAgain:{enabled:!0,backgroundColor:"#2688EB",textColor:"#FFFFFF"},preview:{visible:!1,backgroundColor:"#19191A",textColor:"#5D5F61"},goBlind:!1}}},xf=function(h,f){var p=typeof Symbol=="function"&&h[Symbol.iterator];if(!p)return h;var g,y,T=p.call(h),x=[];try{for(;(f===void 0||f-- >0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x};(function(h){h.Flip="flip",h.Action="action",h.Inaction="inaction"})(Ir||(Ir={}));var hE=(function(){function h(f,p,g,y,T){var x=this;this._parentNode=y,this._targetedNode=T,this.updateSourceAbsolutePosition=function(N){var H=xf(N,2),le=H[0],se=H[1];return x.source.position.absolute=[le+x.source.position.relative[0],se+x.source.position.relative[1]],x},this.updateTargetAbsolutePosition=function(N){var H=xf(N,2),le=H[0],se=H[1];return x.target.position.absolute=[le+x.target.position.relative[0],se+x.target.position.relative[1]],x},this.isAssociatedNodeLocked=function(){return!(_t.visitedNodes.has(x.source.chapterId)&&_t.visitedNodes.has(x.target.chapterId))},this.updateInitialTargetCoordinates=function(){var N=x._targetedNode.getIncomingConnectorsCoordinates()[x.connectorType];return N&&(x.target.position.absolute[1]=x._targetedNode.styles.y+N[1],x.target.position.relative[1]=N[1]),x},this.id=f.id,this.type=p,this.connectorType=g,this.isHidden=this._parentNode.isEndNode();var R=this._parentNode.render.previewMiddleYCoordinate,O=this._targetedNode.render.previewMiddleYCoordinate;this.source={chapterId:this._parentNode.chapter.id,position:{absolute:[this._parentNode.styles.x+this._parentNode.render.width,this._parentNode.styles.y+R],relative:[this._parentNode.render.width,R]}},this.target={chapterId:f.chapterId,position:{absolute:[this._targetedNode.styles.x,this._targetedNode.styles.y+O],relative:[0,O]}},this.updateSourceCoordinates(f)}return h.prototype.isEqual=function(f){var p=this;return["id","type","connectorType","source","target"].every((function(g){return JSON.stringify(p[g])===JSON.stringify(f[g])}))},h.prototype.updateSourceCoordinates=function(f){var p,g,y,T;switch(this.type){case Ir.Flip:if(a.isEditMode()||a.isViewOrPreViewMode()&&(!((p=this._parentNode.stylesWithDefaults.flipTo)===null||p===void 0)&&p.enabled)){var x=xf((T=(y=this._parentNode).render.flipToYCoordinate,[y.styles.x+y.render.width+44,y.styles.y+T+a.render.node.componentControlHeight/2]),2),R=x[0],O=x[1];this.source.position.absolute=[R,O],this.source.position.relative=[R-this._parentNode.styles.x,O-this._parentNode.styles.y]}break;case Ir.Action:case Ir.Inaction:if(a.isEditMode()||a.isViewOrPreViewMode()&&(!((g=this._parentNode.stylesWithDefaults.controls)===null||g===void 0)&&g.enabled)){var N=xf((function(H,le){var se=H.controls().findIndex((function(Ue){var gt;return(gt=Ue.events)===null||gt===void 0?void 0:gt.some((function(St){return St.action.args.branchId===le}))})),Ae=se===-1;Ae&&(se=H.containers().reverse().findIndex((function(Ue){var gt;return(gt=Ue.events)===null||gt===void 0?void 0:gt.some((function(St){return St.action.args.branchId===le}))})));var qe=H.render.controlsContainerYCoordinate;return[H.styles.x+H.render.width,H.styles.y+qe+a.render.node.componentControlHeight*se+(Ae?a.render.node.control.inactionLinkY:a.render.node.control.actionLinkY)]})(this._parentNode,f.id),2);R=N[0],O=N[1],this.source.position.absolute=[R,O],this.source.position.relative=[R-this._parentNode.styles.x,O-this._parentNode.styles.y]}}},h})(),rm=Bo(996),pE=Bo.n(rm);const v6={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let Qr;const B=new Uint8Array(16);function oe(){if(!Qr&&(Qr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Qr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Qr(B)}const xe=[];for(let h=0;h<256;++h)xe.push((h+256).toString(16).slice(1));const ht=function(h,f,p){if(v6.randomUUID&&!f&&!h)return v6.randomUUID();const g=(h=h||{}).random||(h.rng||oe)();return g[6]=15&g[6]|64,g[8]=63&g[8]|128,(function(y,T=0){return(xe[y[T+0]]+xe[y[T+1]]+xe[y[T+2]]+xe[y[T+3]]+"-"+xe[y[T+4]]+xe[y[T+5]]+"-"+xe[y[T+6]]+xe[y[T+7]]+"-"+xe[y[T+8]]+xe[y[T+9]]+"-"+xe[y[T+10]]+xe[y[T+11]]+xe[y[T+12]]+xe[y[T+13]]+xe[y[T+14]]+xe[y[T+15]]).toLowerCase()})(g)};var Wt=Object.defineProperty,cr=Object.defineProperties,Si=Object.getOwnPropertyDescriptors,nn=Object.getOwnPropertySymbols,hl=Object.prototype.hasOwnProperty,m6=Object.prototype.propertyIsEnumerable,g6=(h,f,p)=>f in h?Wt(h,f,{enumerable:!0,configurable:!0,writable:!0,value:p}):h[f]=p,Hr=(h,f)=>{for(var p in f||(f={}))hl.call(f,p)&&g6(h,p,f[p]);if(nn)for(var p of nn(f))m6.call(f,p)&&g6(h,p,f[p]);return h},Wr=(h,f)=>cr(h,Si(f)),kf=(h,f)=>{var p={};for(var g in h)hl.call(h,g)&&f.indexOf(g)<0&&(p[g]=h[g]);if(h!=null&&nn)for(var g of nn(h))f.indexOf(g)<0&&m6.call(h,g)&&(p[g]=h[g]);return p},IF=(h=>(h[h.NoVideo=0]="NoVideo",h[h.NoEOV=1]="NoEOV",h[h.NoBranches=2]="NoBranches",h))(IF||{}),im="3.3",OF=/[3-9]{1}\.[3-9]{1}/,PF=(h=>(h.Choice="Choice",h.TextInput="TextInput",h))(PF||{}),NF=(h=>(h.Button="Button",h.Area="Area",h.Text="Text",h))(NF||{}),DF=(h=>(h.onClick="onClick",h.onSuspense="onSuspense",h))(DF||{}),VF=(h=>(h.openURI="openURI",h.setNextBranch="setNextBranch",h.setWeightlessRandomBranch="setWeightlessRandomBranch",h.setRandomBranch="setRandomBranch",h.setMaxWeightBranch="setMaxWeightBranch",h.setMinWeightBranch="setMinWeightBranch",h.setDefaultBranch="setDefaultBranch",h.continuePlayback="continuePlayback",h.expect="expect",h))(VF||{}),nm=(h,f)=>f?.find((p=>p.type===h)),OZe=(h,f)=>f?f.findIndex((p=>p.type===h)):-1,PZe=["Button"],NZe=["Button"],fE=Object.freeze({background:"#0D0F12",border:"#0D0F12",text:"#F2F5FF"}),DZe=(h,f,p,g)=>({id:ht(),type:h,label:f,layoutParams:BZe(h,g),props:UZe(h,p),events:h!=="Text"?[Rp("onClick","continuePlayback")]:[]}),Rp=(h,f,p,g)=>{switch(f){case"setNextBranch":return{type:h,action:{type:f,args:{branchId:p,shouldOpenNow:!0}}};case"continuePlayback":return{type:h,action:{type:f,args:{shouldOpenNow:!0}}};case"openURI":return{type:h,action:{type:f,args:{isDetachContainer:!0,shouldOpenNow:!0,uri:g}}}}},VZe={Text:0,Button:.3,Area:.35},BZe=(h,f)=>{let p=h==="Text",g=p?.12:.09,y=.4;if(f!=null&&f.width&&p){let T=.1*f.height*1.5,x=4.48*T,R=Math.ceil(x/f.width);y=Math.min(1,x/f.width),g=T/f.height*R}return{x:.5,y:VZe[h]||0,width:y,height:g,angle:0,innerSizesDependOn:"video"}},UZe=(h,f)=>{let p=h==="Text",g=p?"start":"center",y=p?"top":"center";return Hr({background:{type:"color",color:fE.background,alpha:PZe.includes(h)?1:0},shape:{border:{width:.005,color:fE.border,alpha:NZe.includes(h)?1:0},type:"rectangle",roundCorners:p?0:.02}},f&&{text:{value:f,gravityHorizontal:g,gravityVertical:y,color:fE.text,size:p?.1:.03,alpha:1}})},BF=(h,f,p,g)=>{let y=h.containers.find((H=>H.id===f)),T=y?y.controls.find((H=>H.id===p)):void 0,x=T?.events||[],R=nm("onClick",T?.events),O=R?.action.args.branchId;g&&(R?x=x.map((H=>{if(H===R){let le=H.action.args,se=kf(le,["uri"]);return Wr(Hr({},H),{action:Wr(Hr({},H.action),{type:g,args:Wr(Hr({},se),{branchId:g==="setNextBranch"?H.action.args.branchId:void 0,isDetachContainer:g!=="openURI"&&void 0})})})}return H})):x.push(Rp("onClick",g)));let N=g!=="setNextBranch"?h.branches.filter((H=>H.id!==O)):h.branches;return Wr(Hr({},h),{branches:N,containers:h.containers.map((H=>H.id===f?Wr(Hr({},H),{controls:H.controls.map((le=>le.id===p?Wr(Hr({},le),{events:x}):le))}):H))})},UF=(h="[Untitled]")=>({id:ht(),label:h,order:"simple",branches:[],containers:[],events:[]}),FF=(h,f,p)=>{let g=1,y=()=>`${h} (${f}${g})`,T=y();for(;p.has(T);)g+=1,T=y();return T},zF=(h,f)=>{var p;return Wr(Hr({},h),{label:f,id:ht(),order:h.order==="start"?"simple":h.order,branches:[],containers:h.containers.map((g=>Wr(Hr({},g),{id:ht(),controls:g.controls.map((y=>Wr(Hr({},y),{id:ht(),events:y.type!=="Text"?[Rp("onClick","continuePlayback")]:[]}))),events:[b6("continuePlayback")]}))),events:(p=h.events)==null?void 0:p.map((g=>g.type==="onSuspense"&&g.action.type==="setNextBranch"?Wr(Hr({},g),{action:Wr(Hr({},g.action),{args:Wr(Hr({},g.action.args),{branchId:void 0})})}):g))})},FZe=h=>{let f=[];if(h.videoId||f.push(0),h.order!=="end"){let p=!h.events||h.events.some((y=>y.type==="onSuspense"&&y.action.type==="setNextBranch"&&!y.action.args.branchId));p&&f.push(1);let g=h.containers.flatMap((y=>y.controls));(!g.length&&p||g.some((y=>{var T;return y.type!=="Text"&&!((T=y?.events)!=null&&T.length)})))&&f.push(2)}return f},jF=h=>({id:ht(),chapterId:h}),b6=(h,f)=>({type:"onSuspense",action:{type:h,args:{branchId:f,shouldOpenNow:!0}}}),HF=h=>h.containers.filter((f=>f.controls.some((p=>p.type==="Area"||p.type==="Button")))),zZe=(h,f)=>{var p;let[g,y]=((x,R)=>{let O=new Set,N=0;x.containers.forEach((se=>{N+=se.controls.length,se.controls.forEach((Ae=>O.add(`${Ae.layoutParams.x},${Ae.layoutParams.y}`)))}),0);let H=[],le=0;for(;H.length===0;){let se=le%6+1,Ae=.02*Math.floor(le/6),qe=se%2==0?.5:.05+Ae,Ue=R.layoutParams.y+.17*Math.round(se/2)+Ae;O.has([qe,Ue].join())||H.push(qe,Ue),le+=1}return H})(h,f),T=(p=h.events)==null?void 0:p.find((x=>x.type==="onSuspense"));if((T?.action.type!=="setNextBranch"||!T?.action.args.branchId)&&f.type!=="Text"&&HF(h).length===0){let x={type:"onSuspense",action:{args:{shouldOpenNow:!0,branchId:void 0},type:"setRandomBranch"}};T?T.action=x.action:h.events.push(x)}return Wr(Hr({},h),{containers:[...h.containers,{id:ht(),startTime:0,endTime:null,controls:[Wr(Hr({},f),{layoutParams:Wr(Hr({},f.layoutParams),{x:g,y})})],events:[{type:"onSuspense",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}],layout:{type:"Relative"},type:"Choice"}]})},jZe=(h,f,p)=>{if(!h.containers.find((x=>x.id===p)))return h;let g=[],y=HF(h),T=h.containers.filter((x=>{var R;return x.id===p&&(x.controls.forEach((O=>{var N;O.id===f&&(N=O.events)!=null&&N.length&&g.push(...O.events.map((H=>H.action.args.branchId)))})),(R=x.events)!=null&&R.length&&g.push(...x.events.map((O=>O.action.args.branchId)))),x.id!==p}));return Wr(Hr({},h),{containers:T,branches:h.branches.filter((x=>!g.includes(x.id))),events:HZe(h.events,y.length===1)})},HZe=(h,f=!1)=>f?h.find((p=>p.type==="onSuspense"&&p.action.type==="setNextBranch"))?h:[]:h,ZF=(h,f,p,g)=>{var y;return Wr(Hr({},h),p?{containers:h.containers.map((T=>Wr(Hr({},T),{controls:T.controls.map((x=>x.id===p?Wr(Hr({},x),{events:[Rp("onClick","setNextBranch",f.id)]}):x))}))),branches:[...h.branches,f]}:g?{containers:h.containers.map((T=>T.id===g?Wr(Hr({},T),{events:[b6("setNextBranch",f.id)]}):T)),branches:[...h.branches,f]}:{branches:[...h.branches,f],events:(y=h.events)==null?void 0:y.map((T=>T.type==="onSuspense"?Wr(Hr({},T),{action:Wr(Hr({},T.action),{args:{branchId:f.id,shouldOpenNow:!0}})}):T))})},vE=(h,f)=>f.map((p=>p.action.args.branchId&&h.includes(p.action.args.branchId)?Wr(Hr({},p),{action:Wr(Hr({},p.action),{args:Wr(Hr({},p.action.args),{branchId:void 0})})}):p)),mE=(h,f)=>f.length?Wr(Hr({},h),{branches:h.branches.filter((p=>!f.includes(p.id))),containers:h.containers.map((p=>Wr(Hr({},p),{controls:p.controls.map((g=>Wr(Hr({},g),{events:vE(f,g.events)}))),events:vE(f,p.events)}))),events:vE(f,h.events)}):h,GF=(h,f)=>{var p;let g=h.events||[],y=(p=h.events)==null?void 0:p.find((x=>x.type==="onSuspense")),T=y?.action.args.branchId;return f&&(g=y?g.map((x=>x.type==="onSuspense"?Wr(Hr({},x),{action:Wr(Hr({},x.action),{type:f,args:Wr(Hr({},x.action.args),{branchId:f==="setNextBranch"?x.action.args.branchId:void 0})})}):x)):[...g,{type:"onSuspense",action:{type:f,args:{shouldOpenNow:!0}}}]),Wr(Hr({},h),{events:g,branches:f!=="setNextBranch"?h.branches.filter((x=>x.id!==T)):h.branches})},WF=h=>{if(!h.events)return;let f=h.events.find((p=>p.type==="onSuspense"));return f?.action.type},qF=(h,f,p)=>{let g=f.events||[],y=nm("onSuspense",f.events),T=y?.action.args.branchId;p&&(g=y?g.map((O=>O.type==="onSuspense"?Wr(Hr({},O),{action:Wr(Hr({},O.action),{type:p,args:Wr(Hr({},O.action.args),{branchId:p==="setNextBranch"?O.action.args.branchId:void 0})})}):O)):[...g,{type:"onSuspense",action:{type:p,args:{shouldOpenNow:!0}}}]);let x=p!=="setNextBranch"?h.branches.filter((O=>O.id!==T)):h.branches,R=Wr(Hr({},f),{events:g});return Wr(Hr({},h),{branches:x,containers:h.containers.map((O=>O.id===f.id?R:O))})},ZZe=(h,f)=>{let p=new Set(f);return h.map((g=>Wr(Hr({},g),{controls:g.controls.filter((y=>!p.has(y.id)))})))},GZe=h=>{if(h.order==="end")return!0;if(h.order==="start")return!1;let f=h.containers.some((g=>nm("onSuspense",g.events))),p=h.containers.flatMap((g=>g.controls));return!f&&p.length===0},gE=(h=[])=>({edit:{chapters:h},view:{}}),bE=(h,[f,p])=>({id:h,x:f,y:p}),WZe=[{version:"3.0",migrate:h=>{let f=[];for(let p of h.chapters){let g,y=[];for(let R of p.branches){let O=R,{isDefault:N}=O,H=kf(O,["isDefault"]);N&&(g=H.id),y.push(H)}let T,x=[];for(let R of p.containers){let O=R,{fallbackStrategy:N}=O,H=kf(O,["fallbackStrategy"]);switch(N){case"await":T=[];break;case"default":T=[{type:"onSuspense",action:{type:"setNextBranch",args:{branchId:g,shouldOpenNow:!0}}}];break;case"weightlessRandom":case"random":T=[{type:"onSuspense",action:{type:"setRandomBranch",args:{shouldOpenNow:!0}}}]}for(let le of H.controls)x.push(Wr(Hr({},H),{controls:[Wr(Hr({},le),{events:le.subtype==="Text"||le.events.length?le.events:[Rp("onClick","continuePlayback")]})],id:ht(),events:[{type:"onSuspense",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}]}))}f.push(Wr(Hr({},p),{containers:x,events:T,branches:y}))}return h.metadata.version="3.1",h.metadata.updated=new Date().toISOString(),Wr(Hr({},h),{chapters:f})}},{version:"3.1",migrate:h=>{let f=h.metadata,{media:p}=f,g=kf(f,["media"]);if(typeof p=="string")throw new Error("Manifest media should be parsed");return{chapters:h.chapters,metadata:Wr(Hr({},g),{version:"3.2"}),media:p}}},{version:"3.2",migrate:h=>{let f=[],p=[];for(let g of h.chapters){let y=g,{x:T,y:x}=y,R=kf(y,["x","y"]),O=Array.isArray(g.events)&&!g.events.length,N=[],H=R.containers.map((le=>{var se;return Wr(Hr({},le),{events:(O?(se=le.events)==null?void 0:se.map((Ae=>Ae.type==="onSuspense"?(Ae.action.args.branchId&&N.push(Ae.action.args.branchId),b6("expect")):Ae)):le.events)||[],controls:le.controls.map((Ae=>{var qe=Ae,{subtype:Ue}=qe,gt=kf(qe,["subtype"]);return Wr(Hr({},gt),{type:Ue,events:gt.events||[Rp("onClick","continuePlayback")]})}))})}));f.push(mE(Wr(Hr({},R),{containers:H,events:g.events||[]}),N)),p.push({id:R.id,x:T,y:x})}return Wr(Hr({},h),{chapters:f,graph:gE(p),metadata:Wr(Hr({},h.metadata),{version:im})})}}],_E=h=>WZe.reduce(((f,p)=>f.metadata.version===p.version?p.migrate(f):f),h),am=(h,f)=>{let p={};for(let g of h)p[f(g)]=g;return p},qZe=h=>am(h,(f=>f.id)),yE=(h="",f="")=>{let p=h.split("."),g=f.split("."),y=Math.max(p.length,g.length),T=0;for(let x=0;xg[x]?1:p[x](h.Failed="ManifestParsingFailed",h.UnsupportedVersion="ManifestUnsupportedVersion",h))(YF||{}),YZe=h=>{let f;try{f=JSON.parse(h)}catch{throw new Error("ManifestParsingFailed")}f.metadata.version!==im&&(f=_E(f));let{chapters:p,metadata:g,media:y,graph:T}=f;if(!OF.test(g.version))throw new Error("ManifestUnsupportedVersion");return{chapters:am(p,(x=>x.id)),metadata:g,media:y,graph:{edit:Wr(Hr({},T.edit),{chapters:am(T.edit.chapters,(x=>x.id))}),view:Wr(Hr({},T.view),{chapters:T.view.chapters?am(T.view.chapters,(x=>x.id)):void 0})}}};function XZe(h=!1,f="[Untitled]"){let p=new Date().toISOString(),g=ht(),y={chapters:[{branches:[],containers:[],id:g,label:f,order:"start",events:[]}],metadata:{id:ht(),build:0,version:im,initChapterId:g,created:p,updated:p},media:{videos:[]},graph:gE([bE(g,[0,0])])};return h?JSON.stringify(y):y}var XF="3.0.0",QF="3.3.0",QZe=h=>{let f=yE(h,XF);return f!==-1&&(f===0||yE(h,QF)!==1)},SE={id:"generate_id"},KZe=h=>({id:ht(),name:"Template",chapterType:h.order,template:JSON.stringify(h.containers,((f,p)=>SE[f]||p)),type:"container",manifestVersion:im}),JZe=(h,f)=>{try{let p=JSON.parse(f.template,((g,y)=>SE[g]&&y==="generate_id"?ht():y));return Wr(Hr({},h),{branches:[],containers:p})}catch{return console.error("The following template is broken:",f.id),h}},eGe=Object.defineProperty,KF=Object.getOwnPropertySymbols,tGe=Object.prototype.hasOwnProperty,rGe=Object.prototype.propertyIsEnumerable,JF=(h,f,p)=>f in h?eGe(h,f,{enumerable:!0,configurable:!0,writable:!0,value:p}):h[f]=p,Ip=(h,f)=>{for(var p in f||(f={}))tGe.call(f,p)&&JF(h,p,f[p]);if(KF)for(var p of KF(f))rGe.call(f,p)&&JF(h,p,f[p]);return h},iGe={id:"1197ad7c-7d68-419c-949e-8f21a26b782c",label:"Chapter Title",order:"start",containers:[],branches:[],events:[]},nGe={type:"onSuspense",action:{type:"setNextBranch",args:{shouldOpenNow:!0}}},ez=(h={})=>Ip({id:"chapter_2",containers:[{id:"container_2",controls:[{id:"control_2",type:"Button",label:"Button label 2",props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,value:"Button label",alpha:1}},layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0},events:[]}],events:[],type:"Choice",startTime:0,endTime:null,layout:{type:"Relative"}}],branches:[],events:[],label:"[Untitled]",order:"end",videoId:"3840"},h),tz=ez();Object.freeze(tz);var aGe={id:"a7c9da3b-4712-4277-9949-f9758243d5f3",type:"Area",label:"Area [2]",layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0,innerSizesDependOn:"self"},props:{background:{type:"color",color:"#0D0F12",alpha:0},shape:{border:{width:.03,color:"#0D0F12",alpha:0},type:"rectangle",roundCorners:.2},text:{value:"Area Control",gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,alpha:1}},events:[]},EE=(h={})=>Ip({id:"control_1",type:"Button",label:"Button label 1",props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,value:"Button label",alpha:1}},layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0},events:[{type:"onClick",action:{type:"setNextBranch",args:{branchId:"branch_1",shouldOpenNow:!0}}}]},h),rz=EE();Object.freeze(rz);var iz=(h={})=>Ip({x:0,y:.1,width:.4,height:.2,angle:0},h),nz=iz();Object.freeze(nz);var oGe=[{id:"408c99df-dd65-47e7-bf15-c88e677a3525",startTime:0,endTime:92610,controls:[{id:"a7c9da3b-4712-4277-9949-f9758243d5f3",type:"Area",label:"Area [2]",layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0,innerSizesDependOn:"self"},props:{background:{type:"color",color:"#0D0F12",alpha:0},shape:{border:{width:.03,color:"#0D0F12",alpha:0},type:"rectangle",roundCorners:.2},text:{value:"Area Control",gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,alpha:1}},events:[{type:"onClick",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}]}],events:[{type:"onSuspense",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}],layout:{type:"Relative"},type:"Choice"},{id:"bb3af475-84d2-489c-82ec-731b10f5311d",startTime:47895,endTime:138073,controls:[{id:"32e0a6aa-0c6f-4ae7-b388-9ae5bad0c202",type:"Button",label:"Button Control 1",layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0,innerSizesDependOn:"self"},props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{value:"Button [1]",gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,alpha:1}},events:[{type:"onClick",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}]}],events:[{type:"onSuspense",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}],layout:{type:"Relative"},type:"Choice"},{id:"252277ff-cf5e-4c49-bd82-4e2ae9f29856",startTime:26193,endTime:null,controls:[{id:"9d90b398-075d-41de-985b-bb668cfe673d",type:"Button",label:"Button Control 2",layoutParams:{x:.5,y:.47,width:.4,height:.09,angle:0,innerSizesDependOn:"self"},props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{value:"Button label",gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,alpha:1}},events:[{type:"onClick",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}]}],events:[{type:"onSuspense",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}],layout:{type:"Relative"},type:"Choice"}],TE=(h={})=>Ip({id:"container_1",controls:[{id:"control_1",type:"Button",label:"Button label 1",props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,value:"Button label 1",alpha:1}},layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0},events:[]}],events:[],type:"Choice",startTime:0,endTime:null,layout:{type:"Relative"}},h),az=TE();Object.freeze(az);var oz=(h={})=>TE({controls:[EE({layoutParams:Ip({x:0,y:.1,width:.4,height:.2,angle:0},h)})]}),sz=oz();Object.freeze(sz);var lz=(h={})=>Ip({chapters:[{id:"chapter_1",containers:[{id:"container_1",controls:[{id:"control_1",type:"Button",label:"Button label 1",props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,value:"Button label",alpha:1}},layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0},events:[]}],type:"Choice",startTime:0,layout:{type:"Relative"},events:[{type:"onSuspense",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}]},{id:"container_2",controls:[{id:"control_2",type:"Area",label:"Areal label 1",props:{background:{type:"color",color:"#0D0F12",alpha:0},shape:{border:{width:.03,color:"#0D0F12",alpha:0},type:"rectangle",roundCorners:.2}},layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0},events:[{type:"onClick",action:{type:"setNextBranch",args:{branchId:"branch_1",shouldOpenNow:!0}}}]}],type:"Choice",startTime:0,layout:{type:"Relative"},events:[{type:"onSuspense",action:{type:"setNextBranch",args:{shouldOpenNow:!0,branchId:"branch_3"}}}]}],branches:[{id:"branch_1",chapterId:"chapter_3"},{id:"branch_2",chapterId:"chapter_2"},{id:"branch_3",chapterId:"chapter_3"}],events:[{type:"onSuspense",action:{type:"setNextBranch",args:{branchId:"branch_2",shouldOpenNow:!0}}}],label:"[Untitled]",order:"start"},{id:"chapter_2",containers:[],branches:[],events:[],label:"[Untitled]",order:"end"},{id:"chapter_3",containers:[],branches:[],events:[{type:"onSuspense",action:{type:"setNextBranch",args:{shouldOpenNow:!0}}}],label:"[Untitled]",order:"simple"},{id:"chapter_4",containers:[{id:"container_4",controls:[{id:"control_3",type:"Button",label:"Button label 2",props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,value:"Button label",alpha:1}},layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0},events:[]}],type:"Choice",startTime:0,layout:{type:"Relative"},events:[{type:"onSuspense",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}]}],branches:[],events:[],label:"[Untitled]",order:"simple"}],metadata:{id:"manifest_id",created:"created_date",build:0,updated:"updated_date",initChapterId:"chapter_1",version:"3.3"},media:{videos:[{id:"3840",title:"VIDEO_LONG.mp4",variants:[{cover:"image_uri",type:"mp4",url:"video_uri"}]}]},graph:{edit:{background:{color:"#0D0F12",grid:{enabled:!0,color:"#252525"}},defaultChapter:{flipTo:{enabled:!0,backgroundColor:"#282A2E",textColor:"#F2F5FF"},controls:{enabled:!0,backgroundColor:"#282A2E",textColor:"#F2F5FF"},hover:{enabled:!0,borderColor:"#7B68EE"}},chapters:[{id:"chapter_1",x:338,y:170},{id:"chapter_2",x:752,y:49},{id:"chapter_3",x:740,y:587},{id:"chapter_4",x:782,y:269}],defaultBranch:{display:!0,color:"#F2F5FF",connectionColor:"#35383C",actionConnectionColor:"#35383C",actionIconColor:"#F2F5FF",inactionConnectionColor:"#F2F5FF",inactionIconColor:"#35383C",displayActionConnections:!0},branches:[]},view:{background:{color:"#0D0F12",grid:{enabled:!0,color:"#252525"}},defaultChapter:{flipTo:{enabled:!0,backgroundColor:"#282A2E",textColor:"#F2F5FF"},controls:{enabled:!0,backgroundColor:"#282A2E",textColor:"#F2F5FF"},hover:{enabled:!0,borderColor:"#7B68EE"},watchAgain:{enabled:!0,backgroundColor:"#7B68EE",textColor:"#F2F5FF"},preview:{visible:!0,backgroundColor:"#282A2E",textColor:"#6B6E74"},goBlind:!0},chapters:[{id:"chapter_1",x:338,y:170},{id:"chapter_2",x:752,y:49},{id:"chapter_3",x:740,y:587},{id:"chapter_4",x:782,y:269}],defaultBranch:{display:!0,color:"#F2F5FF",connectionColor:"#35383C",actionConnectionColor:"#35383C",actionIconColor:"#F2F5FF",inactionConnectionColor:"#F2F5FF",inactionIconColor:"#35383C",displayActionConnections:!0},branches:[]}}},h),uz=lz();Object.freeze(uz);var cz=(h="3.3")=>`{ "chapters":[ {"id":"chapter_1","containers":[{"id":"container_1","controls":[{"id":"control_1","type":"Button","label":"Button label 1","props":{"background":{"type":"color","color":"#0D0F12","alpha":1},"shape":{"border":{"width":0.03,"color":"#0D0F12","alpha":1},"type":"rectangle","roundCorners":0.2},"text":{"gravityHorizontal":"center","gravityVertical":"center","color":"#F2F5FF","size":0.35,"value":"Button label","alpha":1}},"layoutParams":{"x":0.05,"y":0.47,"width":0.4,"height":0.09,"angle":0},"events":[]}],"type":"Choice","startTime":0,"layout":{"type":"Relative"},"events":[{"type":"onSuspense","action":{"type":"continuePlayback","args":{"shouldOpenNow":true}}}]},{"id":"container_2","controls":[{"id":"control_2","type":"Area","label":"Areal label 1","props":{"background":{"type":"color","color":"#0D0F12","alpha":0},"shape":{"border":{"width":0.03,"color":"#0D0F12","alpha":0},"type":"rectangle","roundCorners":0.2}},"layoutParams":{"x":0.05,"y":0.47,"width":0.4,"height":0.09,"angle":0},"events":[{"type":"onClick","action":{"type":"setNextBranch","args":{"branchId":"branch_1","shouldOpenNow":true}}}]}],"type":"Choice","startTime":0,"layout":{"type":"Relative"},"events":[{"type":"onSuspense","action":{"type":"setNextBranch","args":{"shouldOpenNow":true,"branchId":"branch_3"}}}]}],"branches":[{"id":"branch_1","chapterId":"chapter_3"},{"id":"branch_2","chapterId":"chapter_2"},{"id":"branch_3","chapterId":"chapter_3"}],"events":[{"type":"onSuspense","action":{"type":"setNextBranch","args":{"branchId":"branch_2","shouldOpenNow":true}}}],"label":"[Untitled]","order":"start"}, {"id":"chapter_2","containers":[],"branches":[],"events":[],"label":"[Untitled]","order":"end"}, {"id":"chapter_3","containers":[],"branches":[],"events":[{"type":"onSuspense","action":{"type":"setNextBranch","args":{"shouldOpenNow":true}}}],"label":"[Untitled]","order":"simple"}, {"id":"chapter_4","containers":[{"id":"container_4","controls":[{"id":"control_3","type":"Button","label":"Button label 2","props":{"background":{"type":"color","color":"#0D0F12","alpha":1},"shape":{"border":{"width":0.03,"color":"#0D0F12","alpha":1},"type":"rectangle","roundCorners":0.2},"text":{"gravityHorizontal":"center","gravityVertical":"center","color":"#F2F5FF","size":0.35,"value":"Button label","alpha":1}},"layoutParams":{"x":0.05,"y":0.47,"width":0.4,"height":0.09,"angle":0},"events":[]}],"type":"Choice","startTime":0,"layout":{"type":"Relative"},"events":[{"type":"onSuspense","action":{"type":"continuePlayback","args":{"shouldOpenNow":true}}}]}],"branches":[],"events":[],"label":"[Untitled]","order":"simple"} ], "metadata":{"id":"manifest_id","created":"created_date","build":0,"updated":"updated_date","initChapterId":"chapter_1","version":"${h}"}, "media":{"videos":[{"id":"3840","title":"VIDEO_LONG.mp4","variants":[{"cover":"image_uri","type":"mp4","url":"video_uri"}]}]}, "graph":{ "edit":{"background":{"color":"#0D0F12","grid":{"enabled":true,"color":"#252525"}},"defaultChapter":{"flipTo":{"enabled":true,"backgroundColor":"#282A2E","textColor":"#F2F5FF"},"controls":{"enabled":true,"backgroundColor":"#282A2E","textColor":"#F2F5FF"},"hover":{"enabled":true,"borderColor":"#7B68EE"}},"chapters":[{"id":"chapter_1","x":338,"y":170},{"id":"chapter_2","x":752,"y":49},{"id":"chapter_3","x":740,"y":587},{"id":"chapter_4","x":782,"y":269}],"defaultBranch":{"display":true,"color":"#F2F5FF","connectionColor":"#35383C","actionConnectionColor":"#35383C","actionIconColor":"#F2F5FF","inactionConnectionColor":"#F2F5FF","inactionIconColor":"#35383C","displayActionConnections":true},"branches":[]}, "view":{"background":{"color":"#0D0F12","grid":{"enabled":true,"color":"#252525"}},"defaultChapter":{"flipTo":{"enabled":true,"backgroundColor":"#282A2E","textColor":"#F2F5FF"},"controls":{"enabled":true,"backgroundColor":"#282A2E","textColor":"#F2F5FF"},"hover":{"enabled":true,"borderColor":"#7B68EE"},"watchAgain":{"enabled":true,"backgroundColor":"#7B68EE","textColor":"#F2F5FF"},"preview":{"visible":true,"backgroundColor":"#282A2E","textColor":"#6B6E74"},"goBlind":true},"chapters":[{"id":"chapter_1","x":338,"y":170},{"id":"chapter_2","x":752,"y":49},{"id":"chapter_3","x":740,"y":587},{"id":"chapter_4","x":782,"y":269}],"defaultBranch":{"display":true,"color":"#F2F5FF","connectionColor":"#35383C","actionConnectionColor":"#35383C","actionIconColor":"#F2F5FF","inactionConnectionColor":"#F2F5FF","inactionIconColor":"#35383C","displayActionConnections":true},"branches":[]} } }`,dz=cz();Object.freeze(dz);var hz=()=>({chapters:[{branches:[{id:"ee02cec4-f5da-417c-a69f-55e38186890e",chapterId:"25c9205e-a453-4c93-93c0-50100f23a76f",isDefault:!1},{id:"99082298-48ce-4361-97bf-b36a2c626d62",chapterId:"688c1442-5a9d-49fd-83a0-7f2df8433098",isDefault:!1}],containers:[{id:"b2d0e797-2140-41c5-9f53-0e9cc803c4a8",controls:[{id:"control_1",type:"Button",label:"",subtype:"Button",layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0,innerSizesDependOn:"self"},props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{value:"Название кнопки",gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,alpha:1}},events:[{type:"onClick",action:{type:"setNextBranch",args:{branchId:"ee02cec4-f5da-417c-a69f-55e38186890e",shouldOpenNow:!0}}}]},{id:"control_2",type:"Button",label:"",subtype:"Button",layoutParams:{x:.5,y:.47,width:.4,height:.09,angle:0,innerSizesDependOn:"self"},props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{value:"Название кнопки",gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,alpha:1}},events:[{type:"onClick",action:{type:"setNextBranch",args:{branchId:"99082298-48ce-4361-97bf-b36a2c626d62",shouldOpenNow:!0}}}]}],fallbackStrategy:"random",layout:{type:"Relative"},type:"Choice",startTime:0}],id:"a0f8c671-54ba-438f-9ada-42f9f144efb8",label:"[Без названия]",order:"start",x:-6.573966979980469,y:324.5441017150879,videoId:"0c579c0e-acd8-4666-b108-b29665027af2"},{id:"25c9205e-a453-4c93-93c0-50100f23a76f",x:370.8985900878906,y:184.36912536621094,label:"[Без названия]",order:"simple",branches:[{id:"c9825e4e-b583-4983-86b2-c750c4b1620a",chapterId:"72ec3e96-50d4-450b-b173-7c12b39c8d2d",isDefault:!1}],containers:[{id:"3327cbd6-946e-42d5-8760-98dcb69001f9",startTime:0,fallbackStrategy:"await",controls:[{id:"control_3",type:"Button",label:"",subtype:"Button",layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0,innerSizesDependOn:"self"},props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{value:"Название кнопки",gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,alpha:1}},events:[{type:"onClick",action:{type:"setNextBranch",args:{branchId:"c9825e4e-b583-4983-86b2-c750c4b1620a",shouldOpenNow:!0}}}]},{id:"control_4",type:"Button",label:"",subtype:"Button",layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0,innerSizesDependOn:"self"},props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{value:"Название кнопки",gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,alpha:1}},events:[]},{id:"control_5",type:"Button",label:"",subtype:"Text",layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0,innerSizesDependOn:"self"},props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{value:"TEXT",gravityHorizontal:"start",gravityVertical:"top",color:"#F2F5FF",size:.35,alpha:1}},events:[]}],layout:{type:"Relative"},type:"Choice"}]},{id:"688c1442-5a9d-49fd-83a0-7f2df8433098",x:369.14227294921875,y:561,label:"[Без названия]",order:"simple",branches:[{id:"ad025fb2-c255-47d8-95dc-d457167f49ad",chapterId:"72ec3e96-50d4-450b-b173-7c12b39c8d2d",isDefault:!0}],containers:[{id:"3f7bc642-6066-4450-a354-e37da936ad94",startTime:0,fallbackStrategy:"default",controls:[],layout:{type:"Relative"},type:"Choice"}]},{id:"72ec3e96-50d4-450b-b173-7c12b39c8d2d",x:745.001708984375,y:481.1927185058594,label:"[Без названия]",order:"end",branches:[],containers:[{id:"d09ebb52-1f17-42ea-abb9-aa4a2c47b590",startTime:0,fallbackStrategy:null,controls:[],layout:{type:"Relative"},type:"Choice"}]}],metadata:{id:"ca49d624-6583-4c3c-986d-d60a3ece513f",build:0,version:"3.0",initChapterId:"a0f8c671-54ba-438f-9ada-42f9f144efb8",created:"2021-12-12T11:30:00.000Z",updated:"2022-07-13T13:21:32.964Z",media:{videos:[{id:"0c579c0e-acd8-4666-b108-b29665027af2",variants:[{type:"mp4",url:"video_url",cover:"cover_url"}]}]}}}),pz=hz();Object.freeze(pz);var fz=()=>({chapters:[{branches:[{id:"ee02cec4-f5da-417c-a69f-55e38186890e",chapterId:"25c9205e-a453-4c93-93c0-50100f23a76f"},{id:"99082298-48ce-4361-97bf-b36a2c626d62",chapterId:"688c1442-5a9d-49fd-83a0-7f2df8433098"}],containers:[{id:"uuid_test_0",controls:[{id:"control_1",type:"Button",label:"",subtype:"Button",layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0,innerSizesDependOn:"self"},props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{value:"Название кнопки",gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,alpha:1}},events:[{type:"onClick",action:{type:"setNextBranch",args:{branchId:"ee02cec4-f5da-417c-a69f-55e38186890e",shouldOpenNow:!0}}}]}],events:[{type:"onSuspense",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}],layout:{type:"Relative"},type:"Choice",startTime:0,endTime:null},{id:"uuid_test_1",controls:[{id:"control_2",type:"Button",label:"",subtype:"Button",layoutParams:{x:.5,y:.47,width:.4,height:.09,angle:0,innerSizesDependOn:"self"},props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{value:"Название кнопки",gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,alpha:1}},events:[{type:"onClick",action:{type:"setNextBranch",args:{branchId:"99082298-48ce-4361-97bf-b36a2c626d62",shouldOpenNow:!0}}}]}],events:[{type:"onSuspense",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}],layout:{type:"Relative"},type:"Choice",startTime:0,endTime:null}],events:[{type:"onSuspense",action:{type:"setRandomBranch",args:{shouldOpenNow:!0}}}],id:"a0f8c671-54ba-438f-9ada-42f9f144efb8",label:"[Без названия]",order:"start",x:-6.573966979980469,y:324.5441017150879,videoId:"0c579c0e-acd8-4666-b108-b29665027af2"},{id:"25c9205e-a453-4c93-93c0-50100f23a76f",x:370.8985900878906,y:184.36912536621094,label:"[Без названия]",order:"simple",branches:[{id:"c9825e4e-b583-4983-86b2-c750c4b1620a",chapterId:"72ec3e96-50d4-450b-b173-7c12b39c8d2d"}],containers:[{id:"uuid_test_2",startTime:0,endTime:null,controls:[{id:"control_3",type:"Button",label:"",subtype:"Button",layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0,innerSizesDependOn:"self"},props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{value:"Название кнопки",gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,alpha:1}},events:[{type:"onClick",action:{type:"setNextBranch",args:{branchId:"c9825e4e-b583-4983-86b2-c750c4b1620a",shouldOpenNow:!0}}}]}],events:[{type:"onSuspense",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}],layout:{type:"Relative"},type:"Choice"},{id:"uuid_test_3",startTime:0,endTime:null,controls:[{id:"control_4",type:"Button",label:"",subtype:"Button",layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0,innerSizesDependOn:"self"},props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{value:"Название кнопки",gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,alpha:1}},events:[{type:"onClick",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}]}],events:[{type:"onSuspense",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}],layout:{type:"Relative"},type:"Choice"},{id:"uuid_test_4",startTime:0,endTime:null,controls:[{id:"control_5",type:"Button",label:"",subtype:"Text",layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0,innerSizesDependOn:"self"},props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{value:"TEXT",gravityHorizontal:"start",gravityVertical:"top",color:"#F2F5FF",size:.35,alpha:1}},events:[]}],events:[{type:"onSuspense",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}],layout:{type:"Relative"},type:"Choice"}],events:[]},{id:"688c1442-5a9d-49fd-83a0-7f2df8433098",x:369.14227294921875,y:561,label:"[Без названия]",order:"simple",branches:[{id:"ad025fb2-c255-47d8-95dc-d457167f49ad",chapterId:"72ec3e96-50d4-450b-b173-7c12b39c8d2d"}],containers:[],events:[{type:"onSuspense",action:{type:"setNextBranch",args:{branchId:"ad025fb2-c255-47d8-95dc-d457167f49ad",shouldOpenNow:!0}}}]},{id:"72ec3e96-50d4-450b-b173-7c12b39c8d2d",x:745.001708984375,y:481.1927185058594,events:void 0,label:"[Без названия]",order:"end",branches:[],containers:[]}],metadata:{id:"ca49d624-6583-4c3c-986d-d60a3ece513f",build:0,version:"3.1",initChapterId:"a0f8c671-54ba-438f-9ada-42f9f144efb8",created:"2021-12-12T11:30:00.000Z",updated:"2021-12-12T11:30:00.000Z",media:{videos:[{id:"0c579c0e-acd8-4666-b108-b29665027af2",variants:[{type:"mp4",url:"video_url",cover:"cover_url"}]}]}}}),vz=fz();Object.freeze(vz);var mz=()=>({chapters:[{branches:[{id:"ee02cec4-f5da-417c-a69f-55e38186890e",chapterId:"25c9205e-a453-4c93-93c0-50100f23a76f"},{id:"99082298-48ce-4361-97bf-b36a2c626d62",chapterId:"688c1442-5a9d-49fd-83a0-7f2df8433098"}],containers:[{id:"uuid_test_0",controls:[{id:"control_1",type:"Button",label:"",subtype:"Button",layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0,innerSizesDependOn:"self"},props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{value:"Название кнопки",gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,alpha:1}},events:[{type:"onClick",action:{type:"setNextBranch",args:{branchId:"ee02cec4-f5da-417c-a69f-55e38186890e",shouldOpenNow:!0}}}]}],events:[{type:"onSuspense",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}],layout:{type:"Relative"},type:"Choice",startTime:0,endTime:null},{id:"uuid_test_1",controls:[{id:"control_2",type:"Button",label:"",subtype:"Button",layoutParams:{x:.5,y:.47,width:.4,height:.09,angle:0,innerSizesDependOn:"self"},props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{value:"Название кнопки",gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,alpha:1}},events:[{type:"onClick",action:{type:"setNextBranch",args:{branchId:"99082298-48ce-4361-97bf-b36a2c626d62",shouldOpenNow:!0}}}]}],events:[{type:"onSuspense",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}],layout:{type:"Relative"},type:"Choice",startTime:0,endTime:null}],events:[{type:"onSuspense",action:{type:"setRandomBranch",args:{shouldOpenNow:!0}}}],id:"a0f8c671-54ba-438f-9ada-42f9f144efb8",label:"[Без названия]",order:"start",x:-6.573966979980469,y:324.5441017150879,videoId:"0c579c0e-acd8-4666-b108-b29665027af2"},{id:"25c9205e-a453-4c93-93c0-50100f23a76f",x:370.8985900878906,y:184.36912536621094,label:"[Без названия]",order:"simple",branches:[{id:"c9825e4e-b583-4983-86b2-c750c4b1620a",chapterId:"72ec3e96-50d4-450b-b173-7c12b39c8d2d"}],containers:[{id:"uuid_test_2",startTime:0,endTime:null,controls:[{id:"control_3",type:"Button",label:"",subtype:"Button",layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0,innerSizesDependOn:"self"},props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{value:"Название кнопки",gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,alpha:1}},events:[{type:"onClick",action:{type:"setNextBranch",args:{branchId:"c9825e4e-b583-4983-86b2-c750c4b1620a",shouldOpenNow:!0}}}]}],events:[{type:"onSuspense",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}],layout:{type:"Relative"},type:"Choice"},{id:"uuid_test_3",startTime:0,endTime:null,controls:[{id:"control_4",type:"Button",label:"",subtype:"Button",layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0,innerSizesDependOn:"self"},props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{value:"Название кнопки",gravityHorizontal:"center",gravityVertical:"center",color:"#F2F5FF",size:.35,alpha:1}},events:[{type:"onClick",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}]}],events:[{type:"onSuspense",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}],layout:{type:"Relative"},type:"Choice"},{id:"uuid_test_4",startTime:0,endTime:null,controls:[{id:"control_5",type:"Button",label:"",subtype:"Text",layoutParams:{x:.05,y:.47,width:.4,height:.09,angle:0,innerSizesDependOn:"self"},props:{background:{type:"color",color:"#0D0F12",alpha:1},shape:{border:{width:.03,color:"#0D0F12",alpha:1},type:"rectangle",roundCorners:.2},text:{value:"TEXT",gravityHorizontal:"start",gravityVertical:"top",color:"#F2F5FF",size:.35,alpha:1}},events:[]}],events:[{type:"onSuspense",action:{type:"continuePlayback",args:{shouldOpenNow:!0}}}],layout:{type:"Relative"},type:"Choice"}],events:[]},{id:"688c1442-5a9d-49fd-83a0-7f2df8433098",x:369.14227294921875,y:561,label:"[Без названия]",order:"simple",branches:[{id:"ad025fb2-c255-47d8-95dc-d457167f49ad",chapterId:"72ec3e96-50d4-450b-b173-7c12b39c8d2d"}],containers:[],events:[{type:"onSuspense",action:{type:"setNextBranch",args:{branchId:"ad025fb2-c255-47d8-95dc-d457167f49ad",shouldOpenNow:!0}}}]},{id:"72ec3e96-50d4-450b-b173-7c12b39c8d2d",x:745.001708984375,y:481.1927185058594,events:void 0,label:"[Без названия]",order:"end",branches:[],containers:[]}],metadata:{id:"ca49d624-6583-4c3c-986d-d60a3ece513f",build:0,version:"3.2",initChapterId:"a0f8c671-54ba-438f-9ada-42f9f144efb8",created:"2021-12-12T11:30:00.000Z",updated:"2021-12-12T11:30:00.000Z"},media:{videos:[{id:"0c579c0e-acd8-4666-b108-b29665027af2",variants:[{type:"mp4",url:"video_url",cover:"cover_url"}]}]}}),gz=mz();Object.freeze(gz);var bz=(h={})=>Ip({id:"video_1",title:"video_1.MP4",variants:[{type:"mp4",url:"https://pro-stage.storage.movika.net/users/4594/projects/1632/videos/video_1/video_1.MP4",cover:"/covers/video_1.jpg"}]},h),_z=bz();Object.freeze(_z);var hh=function(){return hh=Object.assign||function(h){for(var f,p=1,g=arguments.length;p=h.length&&(h=void 0),{value:h&&h[g++],done:!h}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")},Sz=(function(){function h(f,p){var g=this;this.branches=[],this.saveViewChapterDesign=!1,this.parentChaptersConnections=[],this.chapterErrors=[],this.isDragged=!1,this._modified=!1,this.getContainerControls=function(y){var T;return((T=g.chapter.containers.find((function(x){return x.id===y})))===null||T===void 0?void 0:T.controls.filter((function(x){return x.type!=="Text"})))||[]},this.controls=function(){return g.chapter.containers.flatMap((function(y){return y.controls})).reverse().filter((function(y){return y.type!=="Text"}))},this.containers=function(){return g.chapter.containers.filter((function(y){return y.controls.some((function(T){return T.type!=="Text"}))}))},this.hasParentChapters=function(y){return y?g.parentChaptersConnections.some((function(T){return T.type===y})):!!g.parentChaptersConnections.length},this.getParentChaptersByType=function(y){return g.parentChaptersConnections.filter((function(T){return T.type===y}))},this.hasBranches=function(y){return y?g.branches.some((function(T){return T.type===y})):!!g.branches.length},this.isConnected=function(){return g.hasParentChapters()||g.hasBranches()||g.chapter.order==="start"},this.isEndNode=function(){return g.chapter.order==="end"},this.hasErrors=function(){return!!g.chapterErrors.length},this.getPolygon=function(){return[[g.styles.x,g.styles.y],[g.styles.x+g.render.width,g.styles.y],[g.styles.x+g.render.width,g.styles.y+g.render.height],[g.styles.x,g.styles.y+g.render.height]]},this.getBBox=function(){return{minX:g.styles.x,minY:g.styles.y,maxX:g.styles.x+g.render.width,maxY:g.styles.y+g.render.height}},this.getCenter=function(){return[g.styles.x+g.render.width/2,g.styles.y+g.render.height/2]},this.updatePosition=function(y,T){return g.styles.x=y,g.styles.y=T,a.isPreViewMode()&&(g.saveViewChapterDesign=!0),g},this.addBranch=function(y,T,x){var R=jF(y);return g.chapter=ZF(g.chapter,R,T,x),g},this.deleteBranch=function(y){return g.chapter=mE(g.chapter,[y]),g},this.updateChapterSuspenseAction=function(y){return g.chapter=GF(g.chapter,y),g},this.getIncomingConnectorsCoordinates=function(){return g._incomingConnectorsCoordinates?g._incomingConnectorsCoordinates:g.updateIncomingConnectorsCoordinates()},this.updateIncomingConnectorsCoordinates=function(y){if(y===void 0&&(y=null),y){var T=g.parentChaptersConnections.find((function(x){return y.type===x.type}));T||g.parentChaptersConnections.push(y)}return g._incomingConnectorsCoordinates=g.getConnectorCoordinatesForBranchTypes(g.getUniqueParentConnectionTypes()),g._incomingConnectorsCoordinates},this.getConnectorCoordinatesForBranchTypes=function(y){var T=y.sort(f6),x=(T.length-1)*a.render.node.connectorPositionDiff/2,R=a.render.node.connectorPositionY-x;return T.reduce((function(O,N,H){return O[N]=[0,R+a.render.node.connectorPositionDiff*H],O}),{})},this.id=f.id,this._chapter=f,this.chapterErrors=_t.nodesErrors[this.id]||[],this.styles=this.getNodeStyles(p),this._stylesWithDefaults=this.getNodeStyles(p),this.saveViewChapterDesign=a.isPreViewMode(),this.render=this.getGraphNodeRender()}return Object.defineProperty(h.prototype,"chapter",{get:function(){return this._chapter},set:function(f){this.setModified(),this._chapter=f},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"stylesWithDefaults",{get:function(){var f,p;if(a.isStatsMode()){var g=this._stylesWithDefaults;return hh(hh({},g),{header:hh(hh({},g.header||{}),{backgroundColor:((f=_t.projectStats[this.id])===null||f===void 0?void 0:f.color)||((p=g.header)===null||p===void 0?void 0:p.backgroundColor)}),controls:{enabled:!1},flipTo:{enabled:!1}})}return this._stylesWithDefaults},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"isLocked",{get:function(){return!!a.isViewOrPreViewMode()&&this.chapter.order!=="start"&&!_t.visitedNodes.has(this.id)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"displayLockedContent",{get:function(){return!a.isViewOrPreViewMode()||this.chapter.order==="start"||!!this.stylesWithDefaults.preview.visible||!this.isLocked},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"modified",{get:function(){return this._modified},enumerable:!1,configurable:!0}),h.prototype.resetModified=function(){this._modified&&(this._modified=!1)},h.prototype.setModified=function(){this._modified||(this._modified=!0)},Object.defineProperty(h.prototype,"statistics",{get:function(){return _t.projectStats[this.id]},enumerable:!1,configurable:!0}),h.prototype.getSuspenseActionType=function(){return WF(this.chapter)},h.prototype.getSuspenseBranchId=function(){var f,p,g;return(g=(p=(f=this.chapter.events)===null||f===void 0?void 0:f.find((function(y){return y.type==="onSuspense"})))===null||p===void 0?void 0:p.action.args.branchId)!==null&&g!==void 0?g:null},h.prototype.getContainerBranchIds=function(){var f,p,g,y,T=[];try{for(var x=yz(this.containers().reverse()),R=x.next();!R.done;R=x.next()){var O=R.value;try{for(var N=(g=void 0,yz(O.events||[])),H=N.next();!H.done;H=N.next()){var le=H.value;le.type==="onSuspense"&&le.action.args.branchId&&T.push(le.action.args.branchId)}}catch(se){g={error:se}}finally{try{H&&!H.done&&(y=N.return)&&y.call(N)}finally{if(g)throw g.error}}}}catch(se){f={error:se}}finally{try{R&&!R.done&&(p=x.return)&&p.call(x)}finally{if(f)throw f.error}}return T},h.prototype.updateControlActionEvent=function(f,p,g){return this.chapter=BF(this.chapter,f.id,p.id,g),this},h.prototype.updateContainerSuspenseAction=function(f,p){return this.chapter=qF(this.chapter,f,p),this},h.prototype.isEqual=function(f){var p=this;if(this.modified||f.modified||this.chapter!==f.chapter)return!1;var g=["id","type","connectorType","source","target","isHidden"],y=function(T){return T.map((function(x){return g.map((function(R){return x[R]})).join()})).join()};return y(f.branches)===y(this.branches)&&["id","parentChaptersConnections","render","isDragged","chapterErrors","videoInfo","saveViewChapterDesign"].every((function(T){return JSON.stringify(f[T])===JSON.stringify(p[T])}))},h.prototype.getGraphNodeRender=function(){var f,p,g,y=this.calculateNodeHeight(),T=a.render.node.connectorPositionY,x=a.render.node.heightWithPreview,R=a.render.node.heightWithPreviewEov+a.render.node.componentAddActionHeight+1;return a.isViewOrPreViewMode()&&(!((f=this.stylesWithDefaults.header)===null||f===void 0)&&f.enabled||(T=a.render.node.defaultConnectorPositionY),!((p=this.stylesWithDefaults.flipTo)===null||p===void 0)&&p.enabled&&(x=a.render.node.heightWithPreview),R=!((g=this.stylesWithDefaults.flipTo)===null||g===void 0)&&g.enabled?a.render.node.heightWithPreviewEov+1:x+1),{height:y,width:a.render.node.width,previewMiddleYCoordinate:T,flipToYCoordinate:x,controlsContainerYCoordinate:R}},h.prototype.calculateNodeHeight=function(){var f,p,g,y;return this.chapter.order==="end"?a.isViewOrPreViewMode()&&!(!((f=this.stylesWithDefaults.header)===null||f===void 0)&&f.enabled)?a.render.node.defaultHeight:a.render.node.heightWithPreview:a.isViewOrPreViewMode()||a.isStatsMode()?(!((p=this.stylesWithDefaults.header)===null||p===void 0)&&p.enabled?a.render.node.heightWithPreview:a.render.node.defaultHeight)+(!((g=this.stylesWithDefaults.flipTo)===null||g===void 0)&&g.enabled?a.render.node.componentControlHeight:0)+(!((y=this.stylesWithDefaults.controls)===null||y===void 0)&&y.enabled?this.controls().length*a.render.node.componentControlHeight:0):a.render.node.heightFull+this.controls().length*a.render.node.componentControlHeight},h.prototype.getControlTypeLabelTranslation=function(f){switch(f){case"Text":return a.translation.new_text_label;case"Button":return a.translation.new_button_label;case"Area":return a.translation.new_area_label}},h.prototype.getUniqueParentConnectionTypes=function(){return Array.from(new Set(this.parentChaptersConnections.map((function(f){return f.connectorType}))))},h.prototype.getNodeStyles=function(f){var p,g=this,y=(p=f.view.chapters)===null||p===void 0?void 0:p.find((function(O){return O.id===g.id})),T=f.edit.chapters.find((function(O){return O.id===g.id})),x=y6(a.isEditMode()?T:y||T),R=a.isEditMode()?Cc.edit.defaultChapter:Cc.view.defaultChapter;if(!R)throw new Error("No default styles provided");if(!x)throw new Error("No node styles provided");return hh(hh({},x),R)},h})(),Ql=function(){return Ql=Object.assign||function(h){for(var f,p=1,g=arguments.length;p=h.length&&(h=void 0),{value:h&&h[g++],done:!h}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")},sGe=(function(){function h(){var f=this;this._graphDesign=Cc,this._nodes={},this._branches={},this.setAllNodesAsModified=function(){f.nodes.forEach((function(p){return p.setModified()}))},this.getBranchById=function(p){return f._branches[p]},this.selectBranch=function(p){return f._branches[p]},this.reset=function(){f._metadata=void 0,f._media=void 0,f._videosDict={},f._nodes={},f._branches={},f._graphDesign=Cc},this.rebuildNodesAndBranches=function(){f.buildNodesAndBranches()},this.set=function(p){p=_E(p),f._metadata=p.metadata,f._media=p.media,f._videosDict=Pp(p.media.videos),f._chapters=p.chapters,f._graphDesign=pE()(f._graphDesign,{edit:y6(p.graph.edit),view:y6(p.graph.view)}),f.buildNodesAndBranches()},this.save=function(){var p,g;if(f._metadata&&f._media&&f._graphDesign){f._metadata.updated=new Date().toISOString();var y=Object.values(f._nodes),T=[],x=[],R=a.isEditMode()?"edit":"view";try{for(var O=Op(y),N=O.next();!N.done;N=O.next()){var H=N.value,le=H.chapter,se=H.styles,Ae=H.saveViewChapterDesign;T.push(le),(R==="view"&&Ae||R==="edit")&&x.push(se)}}catch(Ue){p={error:Ue}}finally{try{N&&!N.done&&(g=O.return)&&g.call(O)}finally{if(p)throw p.error}}var qe={chapters:T,metadata:f._metadata,media:f._media,graph:Ql(Ql({},f._graphDesign),{edit:Ql(Ql({},f._graphDesign.edit),R==="edit"?{chapters:x}:{}),view:Ql(Ql({},f._graphDesign.view),R==="view"?{chapters:x}:{})})};o.emit("manifestUpdate",qe)}},this.updateBranches=function(){var p,g,y,T,x,R;f._branches={};try{for(var O=Op(Object.values(f._nodes)),N=O.next();!N.done;N=O.next())(se=N.value).parentChaptersConnections=[]}catch(Ue){p={error:Ue}}finally{try{N&&!N.done&&(g=O.return)&&g.call(O)}finally{if(p)throw p.error}}try{for(var H=Op(Object.values(f._nodes)),le=H.next();!le.done;le=H.next()){var se=le.value;f.buildNodeBranches(se)}}catch(Ue){y={error:Ue}}finally{try{le&&!le.done&&(T=H.return)&&T.call(H)}finally{if(y)throw y.error}}try{for(var Ae=Op(Object.values(f._branches)),qe=Ae.next();!qe.done;qe=Ae.next())qe.value.updateInitialTargetCoordinates()}catch(Ue){x={error:Ue}}finally{try{qe&&!qe.done&&(R=Ae.return)&&R.call(Ae)}finally{if(x)throw x.error}}return f},this.createNode=function(p,g,y){var T=UF(a.translation.new_chapter_label);if(!a.canCreateChapters(1))return f;var x=bE(T.id,p);return f._graphDesign.edit.chapters.push(x),f._nodes[T.id]=new Sz(T,f._graphDesign),y?.(T.id),g||Cz([T.id]),f},this.setNodeOrder=function(p,g){var y=Pi(p);return y.chapter.order==="start"&&f._metadata&&(f._metadata.initChapterId=void 0),y.chapter=Ql(Ql({},y.chapter),{order:g}),f},this.duplicateNode=function(p,g,y){var T=(function(Ue,gt){var St=typeof Symbol=="function"&&Ue[Symbol.iterator];if(!St)return Ue;var Nt,It,Ye=St.call(Ue),Dt=[];try{for(;(gt===void 0||gt-- >0)&&!(Nt=Ye.next()).done;)Dt.push(Nt.value)}catch(er){It={error:er}}finally{try{Nt&&!Nt.done&&(St=Ye.return)&&St.call(Ye)}finally{if(It)throw It.error}}return Dt})(g,2),x=T[0],R=T[1],O=f._nodes[p],N=O.styles,H=O.chapter,le=cGe(),se=FF(H.label,a.translation.copied_chapter_suffix,le),Ae=zF(H,se);if(!a.canCreateChapters(1))return f;var qe=JSON.parse(JSON.stringify(Ql(Ql({},N),{id:Ae.id,x:f._nodes[p].styles.x+x,y:f._nodes[p].styles.y+R})));return f._graphDesign.edit.chapters.push(qe),f.buildNodeFromChapter(Ae),y?.(Ae.id),f},this.getManifestBoundingBox=function(){var p,g,y=0,T=0,x=0,R=0;try{for(var O=Op(Object.values(f._nodes)),N=O.next();!N.done;N=O.next()){var H=N.value.getBBox();y=H.minXx?H.maxX:x,R=H.maxY>R?H.maxY:R}}catch(le){p={error:le}}finally{try{N&&!N.done&&(g=O.return)&&g.call(O)}finally{if(p)throw p.error}}return{minX:y,minY:T,maxX:x,maxY:R}}}return Object.defineProperty(h.prototype,"metadata",{get:function(){return this._metadata},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"nodesDict",{get:function(){return this._nodes},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"branchesDict",{get:function(){return this._branches},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"nodes",{get:function(){var f=this;return a.isViewMode()?Object.values(this._nodes).filter((function(p){return!(p.isLocked&&f.styles.defaultChapter.goBlind)})):Object.values(this._nodes)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"styles",{get:function(){var f=a.isEditMode()?"edit":"view";return Cc[f]},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"branches",{get:function(){if(a.isViewOrPreViewMode()){var f=!!a.isViewMode()&&this.styles.defaultChapter.goBlind;return Object.values(this._branches).filter((function(p){return!(p.isHidden||p.isAssociatedNodeLocked()&&f)}))}return Object.values(this._branches).filter((function(p){return!p.isHidden}))},enumerable:!1,configurable:!0}),h.prototype.deleteGraphBranches=function(f){var p,g,y,T;return(g=(p=this._graphDesign)===null||p===void 0?void 0:p.edit.branches)===null||g===void 0||g.filter((function(x){return!f.includes(x.id)})),(T=(y=this._graphDesign)===null||y===void 0?void 0:y.view.branches)===null||T===void 0||T.filter((function(x){return!f.includes(x.id)})),this},h.prototype.buildNodesAndBranches=function(){var f,p;if(this._chapters){try{for(var g=Op(this._chapters),y=g.next();!y.done;y=g.next()){var T=y.value;this.buildNodeFromChapter(T)}}catch(x){f={error:x}}finally{try{y&&!y.done&&(p=g.return)&&p.call(g)}finally{if(f)throw f.error}}this.updateBranches()}},h.prototype.buildNodeBranches=function(f){var p,g,y,T,x=[];f.branches=[];var R=function(se){var Ae=Xa(se.chapterId);if(!Ae)return O.showErrorMessage(a.translation.popup_error_message_1),{value:void 0};var qe,Ue=void 0;if(Ue=qe=f.getSuspenseBranchId()===se.id?Ir.Flip:f.getContainerBranchIds().includes(se.id)?Ir.Inaction:Ir.Action,(a.isViewOrPreViewMode()||a.isStatsMode())&&(qe===Ir.Flip&&!(!((y=f.stylesWithDefaults.flipTo)===null||y===void 0)&&y.enabled)||!(!((T=f.stylesWithDefaults.controls)===null||T===void 0)&&T.enabled))){if(Ue=Ir.Flip,x.find((function(St){return St.connectorType===Ir.Flip&&St.targetNodeId===Ae.id})))return"continue";x.push({connectorType:Ir.Flip,targetNodeId:Ae.id})}var gt=new hE(se,qe,Ue,f,Ae);if(O._branches[se.id]=gt,f.branches.push(gt),O._branches[se.id].isHidden)return{value:void 0};O._nodes[se.chapterId].parentChaptersConnections.push({chapterId:f.id,type:gt.type,connectorType:gt.connectorType,branchId:gt.id})},O=this;try{for(var N=Op(f.chapter.branches),H=N.next();!H.done;H=N.next()){var le=R(H.value);if(typeof le=="object")return le.value}}catch(se){p={error:se}}finally{try{H&&!H.done&&(g=N.return)&&g.call(N)}finally{if(p)throw p.error}}},h.prototype.buildNodeFromChapter=function(f){var p;if(this._videosDict&&(this._nodes[f.id]=new Sz(f,this._graphDesign),f.videoId)){var g=this._videosDict[f.videoId];if(!g)return void console.warn("videoId ".concat(f.videoId," for chapter ").concat(f.id," not found}"));var y=_t.videosInfo[g.id];this._nodes[f.id].videoInfo={id:y?.id||g.id,cover:y?.cover||((p=g.variants.find((function(T){return T.cover})))===null||p===void 0?void 0:p.cover)||"",title:y?.title||g.title}}},h.prototype.showErrorMessage=function(f){$e.popups.show({text:f,title:a.translation.popup_error_title,withScale:!1,type:"popup"}),this.reset()},h})(),wE=[[0,0],[0,0]],AE=function(h,f){var p=typeof Symbol=="function"&&h[Symbol.iterator];if(!p)return h;var g,y,T=p.call(h),x=[];try{for(;(f===void 0||f-- >0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},hd=function(h,f){var p=typeof Symbol=="function"&&h[Symbol.iterator];if(!p)return h;var g,y,T=p.call(h),x=[];try{for(;(f===void 0||f-- >0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},_6=function(h,f,p){if(arguments.length===2)for(var g,y=0,T=f.length;y=0&&Ni<=N.viewWidth})),Tr=Dt[0]<0&&Dt[1]>N.viewWidth,Vr=er.some((function(Ni){return Ni>=0&&Ni<=N.viewHeight})),Sn=er[0]<0&&er[1]>N.viewHeight;return(_r||Tr)&&(Vr||Sn)})(x,f,y);x.visible=R,g._hasHiddenSectors||R||(g._hasHiddenSectors=!0)}))}},h.prototype.isNodeVisible=function(f){var p=this.sectorsByNodes[f];return this._sectors[p].visible},h.prototype.getNodesMapCoordinates=function(){if(_t.manifest.nodes.length===0)return wE;var f=[],p=[];return _t.manifest.nodes.forEach((function(g){f.push(g.styles.x),p.push(g.styles.y)})),[[Math.min.apply(Math,_6([],hd(f),!1)),Math.min.apply(Math,_6([],hd(p),!1))],[Math.max.apply(Math,_6([],hd(f),!1)),Math.max.apply(Math,_6([],hd(p),!1))]]},h.prototype.initSectors=function(){var f=this;this.reset();var p={},g=this.getLayoutInfo(),y=g.sectorWidth,T=g.sectorsInRow,x=g.sectorsCount;this.sectors=new Array(x).fill(null).map((function(R,O){var N=f.createSector(O,y,T);return p[N.indexes.join()]=N.id,N})),this.sectorsByCoordinates=p},h.prototype.reset=function(){this.sectors=[],this.sectorsByCoordinates={},this.sectorsByNodes={},this.prevNodesMapCoordinates=wE},h.prototype.seedSectorsWithNodes=function(f){var p=this;this.sectors.forEach((function(O){return O.nodes=new Set})),this.sectorsByNodes={};var g=this.getLayoutInfo().sectorWidth,y=hd(this.getNodesMapCoordinates(),1),T=hd(y[0],2),x=T[0],R=T[1];f.forEach((function(O){var N=Pi(O),H=Math.floor((N.styles.x-x)/g),le=Math.floor((N.styles.y-R)/g),se=p.sectorsByCoordinates[[H,le].join()];if(!se)throw new Error("No sector with coordinates ".concat([H,le]));p.sectorsByNodes[O]=se,p._sectors[se].nodes.add(O)}))},h.prototype.nodesMapSizeChanged=function(){return!!this.prevNodesMapCoordinates&&this.prevNodesMapCoordinates.join()!==this.getNodesMapCoordinates().join()},h.prototype.getLayoutInfo=function(){var f=this.getNodesMapCoordinates(),p=hd(f,2),g=hd(p[0],2),y=g[0],T=g[1],x=hd(p[1],2),R=x[0],O=x[1],N=Math.abs(R-y),H=Math.abs(O-T),le=Math.ceil(Math.sqrt(N*H/a.performance.sectorsCount)),se=Math.max(le,a.performance.minSectorWidthInPixels),Ae=Math.ceil(N/se);return{sectorsInRow:Ae,sectorWidth:se,sectorsCount:Math.ceil(H/se)*Ae}},h.prototype.createSector=function(f,p,g){return{indexes:[f%g,Math.floor(f/g)],size:p,nodes:new Set,visible:!1,id:"".concat(f)}},h})(),Xa=function(h){if(h)return _t.manifest.nodesDict[h]},Pi=function(h){var f=Xa(h);if(!f)throw new Error("Can't get node with id=".concat(h));return f},uGe=new Set,Lf=function(h){var f=(function(p){if(p)return _t.manifest.branchesDict[p]})(h);if(!f)throw new Error("Can't get branch with id=".concat(h));return f},xc=function(h){var f=Xa(h);if(!f)throw new Error("Can't get node with id=".concat(h));return f.styles},cGe=function(){var h=new Set;return _t.manifest.nodes.forEach((function(f){return h.add(f.chapter.label)})),h},ME=function(){return ME=Object.assign||function(h){for(var f,p=1,g=arguments.length;p0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},om=function(h,f,p){if(arguments.length===2)for(var g,y=0,T=f.length;y=h.length&&(h=void 0),{value:h&&h[g++],done:!h}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")},dGe=(function(){function h(){var f=this;this.zoomFactor=1,this.isGraphFrozen=!1,this.selectedNodes=new Set,this.selectedBranches=new Set,this.copiedNodes=new Set,this.visitedNodes=new Set,this.hoveredNodes=new Set,this.nodesErrors={},this.videosInfo={},this.chaptersTags={},this.projectStats={},this.updateVideosInfo=function(p){f.videosInfo=Pp(p)},this.selectNodes=function(p,g){g===void 0&&(g=!0);var y,T,x=new Set(p),R=(y=f.selectedNodes,T=x,!(y.size===T.size&&wz([],Tz(y),!1).every((function(O){return T.has(O)}))));R&&(f.selectedNodes=x,g&&Mz(om([],$f(p),!1)))},this.clearSelectedNodes=function(p){p===void 0&&(p=!0),p&&f.selectedNodes.size&&Mz([]),f.selectedNodes.clear()},this.addNodesToHovered=function(p){p.forEach((function(g){return f.hoveredNodes.add(g)}))},this.removeNodesFromHovered=function(p){p.forEach((function(g){return f.hoveredNodes.delete(g)}))},this.clearHoveredNodes=function(){f.hoveredNodes.clear()},this.selectBranches=function(p){f.selectedBranches=new Set(p),o.emit("selectBranches",om([],$f(f.selectedBranches),!1))},this.clearSelectedBranches=function(){f.selectedBranches.clear(),o.emit("selectBranches",[])},this.copySelectedNodes=function(){f.setCopiedNodes(om([],$f(f.selectedNodes),!1))},this.setCopiedNodes=function(p){f.selectedNodes.size&&(f.copiedNodes=new Set(p),f.copiedNodes.size===1?o.emit("notification",{id:"copy_chapter",defaultTranslation:a.translation.copy_chapter}):o.emit("notification",{id:"copy_multiple_chapters",defaultTranslation:a.translation.copy_multiple_chapters}))},this.pasteNodes=function(p){var g,y;if(f.copiedNodes.size&&a.canCreateChapters(f.copiedChapters.length)){var T=a.render.tool.copyPasteDx,x=a.render.tool.copyPasteDy;if(p){var R=$f(f.copiedNodes,1)[0],O=xc(R);T=p[0]-O.x,x=p[1]-O.y}var N=[],H={},le=function(qe){f.manifest.duplicateNode(qe,[T,x],(function(Ue){N.push(Ue),H[qe]=Ue}))};try{for(var se=Ez(f.copiedNodes),Ae=se.next();!Ae.done;Ae=se.next())le(Ae.value)}catch(qe){g={error:qe}}finally{try{Ae&&!Ae.done&&(y=se.return)&&y.call(se)}finally{if(g)throw g.error}}f.copyNodeBranches(H),Cz(N),f.manifest.updateBranches(),$e.layers.update(),$e.layers.updateSelected(N)}},this.deleteSelection=function(p){var g,y,T,x,R;if(f.selectedBranches.size){try{for(var O=Ez(f.selectedBranches),N=O.next();!N.done;N=O.next()){var H=N.value,le=f.manifest.selectBranch(H);(T=Xa(le.source.chapterId))===null||T===void 0||T.deleteBranch(le.id),(x=Pi(le.target.chapterId))===null||x===void 0||x.setModified()}}catch(se){g={error:se}}finally{try{N&&!N.done&&(y=O.return)&&y.call(O)}finally{if(g)throw g.error}}f.clearSelectedBranches(),f.manifest.deleteGraphBranches(Array.from(f.selectedBranches)).updateBranches().save(),p?.()}f.selectedNodes.size&&(!((R=f.manifest.metadata)===null||R===void 0)&&R.initChapterId&&f.selectedNodes.has(f.manifest.metadata.initChapterId)?o.emit("notification",{id:"remove_init_chapter",defaultTranslation:a.translation.remove_initial_chapter}):Az(om([],$f(f.selectedNodes),!1)),p?.())},this.setVisitedNodes=function(p){f.visitedNodes=new Set(p)},this.setProjectStats=function(p){f.projectStats=p},this.updatedSelectedBranches=function(){f.selectedBranches.forEach((function(p){f.manifest.branchesDict[p]||f.selectedBranches.delete(p)}))},this.clearSelection=function(){f.clearSelectedNodes(),f.clearSelectedBranches()},this.reset=function(){f.manifest.reset(),f.clearSelectedNodes(!1)},this.manifest=new sGe,this.sectors=new lGe,this.layout=new tm,this.reset()}return h.prototype.setNodeErrors=function(f){this.resetErrorsFromValidNodes(f),this.setErrorsToNodes(f),this.nodesErrors=ME({},f)},Object.defineProperty(h.prototype,"copiedChapters",{get:function(){return om([],$f(this.copiedNodes),!1).map((function(f){return Pi(f).chapter}))},enumerable:!1,configurable:!0}),h.prototype.getCopiedBranchControlId=function(f,p){if(f.type===Ir.Action){var g=Pi(f.source.chapterId).chapter.containers.flatMap((function(y){return y.controls})).findIndex((function(y){return y.events.find((function(T){var x;return((x=T.action.args)===null||x===void 0?void 0:x.branchId)===f.id}))}));return p.chapter.containers.flatMap((function(y){return y.controls}))[g].id}},h.prototype.getCopiedBranchContainerId=function(f,p){if(f.type===Ir.Inaction){var g=Pi(f.source.chapterId).chapter.containers.findIndex((function(y){return y.events.find((function(T){var x;return((x=T.action.args)===null||x===void 0?void 0:x.branchId)===f.id}))}));return p.chapter.containers[g].id}},h.prototype.resetErrorsFromValidNodes=function(f){Object.keys(this.nodesErrors).filter((function(p){var g=!!Xa(p),y=!f[p];return g&&y})).forEach((function(p){var g=Pi(p);g.chapterErrors=[],g.setModified()}))},h.prototype.setErrorsToNodes=function(f){Object.keys(f).forEach((function(p){var g=Pi(p);g.chapterErrors=f[p],g.setModified()}))},h.prototype.copyNodeBranches=function(f){var p=this;Object.keys(f).map(Pi).forEach((function(g){var y=g.branches.filter((function(R){return f[R.target.chapterId]})),T=f[g.id],x=Pi(T);y.forEach((function(R){var O=f[R.target.chapterId],N=p.getCopiedBranchControlId(R,x),H=p.getCopiedBranchContainerId(R,x);x.addBranch(O,N,H)}))}))},h})();const _t=new dGe;var Tz=function(h,f){var p=typeof Symbol=="function"&&h[Symbol.iterator];if(!p)return h;var g,y,T=p.call(h),x=[];try{for(;(f===void 0||f-- >0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},wz=function(h,f,p){if(arguments.length===2)for(var g,y=0,T=f.length;y=N.length&&(N=void 0),{value:N&&N[se++],done:!N}}};throw new TypeError(H?"Object is not iterable.":"Symbol.iterator is not defined.")})(f),R=x.next();!R.done;R=x.next()){var O=R.value;T[p(O)]=O}}catch(N){g={error:N}}finally{try{R&&!R.done&&(y=x.return)&&y.call(x)}finally{if(g)throw g.error}}return T})(h,(function(f){return f.id}))},kE=function(h){var f=h.text,p=h.posX,g=h.posY,y=h.width,T=h.height,x=T===void 0?16:T,R=h.fontSize,O=h.fontWeight,N=h.lineHeight,H=h.textAlign,le=h.color,se=ii("svg:foreignObject");return se.attr("x",p).attr("y",g).attr("width",y).attr("height",x).attr("class","mge-text").html((function(Ae){var qe={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return Ae.replace(/[&<>"'/]/gi,(function(Ue){return qe[Ue]}))})(f)),R&&R!==12&&se.style("font-size",R),le&&le!=="rgb(255, 255, 255)"&&le!=="#FFFFFF"&&se.style("color",le),O&&O!==500&&se.style("font-weight",O),N&&se.style("line-height",N),H&&se.style("text-align",H),se},Rf=function(h){return kE(h).node()};(function(h){h.Order="node_order",h.TagCover="tag_cover",h.PreviewPlaceholder="preview_placeholder",h.PreviewClipPath="preview_clip_path",h.StatsPreviewClipPath="stats_preview_clip_path",h.Connector="node_connector",h.ConnectorDisabled="node_connector_disabled",h.LinearGradient="linear_gradient"})(Qa||(Qa={}));var js,pGe=function(h){var f,p=this;this._defsDOMElement=h,this.dispose=function(){p._defsDOMElement.selectAll("*").remove()},c(h),h.selectAll("marker").data(m).join("marker").attr("id",(function(g){return g.name})).attr("stroke",(function(g){return g.stroke})).attr("stroke-width",(function(g){return g.strokeWidth})).attr("markerHeight",(function(g){return g.size})).attr("markerWidth",(function(g){return g.size})).attr("markerUnits","strokeWidth").attr("orient","auto").attr("refX",0).attr("refY",0).attr("viewBox",(function(g){return g.viewBox})).append("path").attr("d",(function(g){return g.path})).attr("fill",(function(g){return g.fill})),(f=h).append((function(){return(g=ii("svg:g").attr("id",Qa.PreviewPlaceholder)).append("rect").attr("x",2).attr("y",0).attr("width",a.render.node.width-4).attr("height",a.render.node.componentPreviewHeight).attr("fill",a.render.color.backgroundContent),g.append("path").attr("d",Ei({x:8,y:8,w:a.render.node.width-16,h:a.render.node.componentPreviewHeight-16,r:8})).attr("stroke-width",a.render.strokeSize).attr("stroke",a.render.color.strokeImageBorderAlpha).style("stroke-dasharray","2, 4").attr("fill","none"),g.append("text").text(a.translation.node_video_error).attr("text-anchor","middle").attr("font-weight",600).attr("font-size",15).style("fill",a.render.color.textTertiary).attr("x",a.render.node.width/2).attr("y",a.render.node.componentPreviewHeight/2+6).attr("text-rendering","optimizeSpeed"),g.node();var g})),f.append((function(){return ii("svg:path").attr("id",Qa.Connector).attr("d","M0,0 L1,1z").attr("fill","none").style("marker-start","url(#".concat(l.Circle,")")).node()})),f.append((function(){return ii("svg:path").attr("id",Qa.ConnectorDisabled).attr("d","M0,0 L1,1z").attr("fill","none").style("marker-start","url(#".concat(l.CircleDisabled,")")).node()})),f.append((function(){return(g=ii("svg").attr("id",Qa.Order)).append("circle").attr("r",a.render.node.componentOrderRadius).attr("fill",a.render.color.iconsPrimaryDark).attr("cx",a.render.node.componentOrderRadius).attr("cy",a.render.node.componentOrderRadius),g.node();var g})),f.append((function(){return(function(){var g=sh().range([a.render.color.strokeFieldBorderAlpha2,"rgba(0, 0, 0, 0)"]).domain([1,2]),y=ii("svg:linearGradient").attr("id",Qa.LinearGradient);return y.append("stop").attr("offset","5%").attr("stop-color",g(1)),y.append("stop").attr("offset","70%").attr("stop-color",g(2)),y.node()})()})),f.append((function(){return(g=ii("svg:clipPath").attr("id",Qa.PreviewClipPath)).append("path").attr("d",Ei({x:2,y:a.render.node.headerHeight+1,w:a.render.node.width-4,h:a.render.node.componentPreviewHeight-1,r:8})),g.node();var g})),f.append((function(){return(g=ii("svg:clipPath").attr("id",Qa.StatsPreviewClipPath)).append("path").attr("d",Ei({x:0,y:a.render.node.headerHeight+1,w:a.render.node.width,h:a.render.node.componentPreviewHeight,r:8})),g.node();var g})),(function(g){g.append((function(){return y=a.render.iconSize+8,(T=ii("svg:g").attr("id",uh.ErrorMarker)).append("svg").attr("width",y).attr("height",y).attr("viewBox","0 0 ".concat(a.render.iconSize," ").concat(a.render.iconSize)).append("use").style("color",a.render.color.iconsNegative).attr("href","#".concat(s.Warning)),T.append("rect").attr("fill","transparent").attr("width",y).attr("height",y),T.node();var y,T}))})(h)},fGe=(function(){function h(f){var p=this;this.dispose=function(){p._root.selectAll("*").remove(),p._root.remove()},this.getRelativeEventCoordinates=function(g,y){return yn(g,y||p._map.node())},this.getEditorWindowSize=function(){var g,y=(g=p._root.node())===null||g===void 0?void 0:g.getBoundingClientRect();return{width:y?.width||0,height:y?.height||0}},this.updateEditorBackgroundColor=function(){p._root.style("background-color",_t.manifest.styles.background.color)},this._root=Cr(f).append("div").attr("id","movika-graph-editor").style("position","relative").style("width","100%").style("height","100%").style("padding",0).style("margin",0).on("contextmenu",(function(g){g.preventDefault()})),this.initStyles(),this._svg=this._root.append("svg").style("width","100%").style("height","100%"),this._grid=this._svg.append("g").attr("id","grid-group"),this._map=this._svg.append("g").attr("id","map-group").attr("transform","translate(0, 0) scale(1)").style("will-change","transform"),this._staticTools=this._svg.append("g").attr("id","static-tools-group"),this._defs=this._svg.append("defs"),o.on("zoom",(function(g){var y=Math.round(g.x),T=Math.round(g.y),x=g.value;p._map.attr("transform","translate(".concat(y,", ").concat(T,") scale(").concat(x,")"))}))}return Object.defineProperty(h.prototype,"root",{get:function(){return this._root},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"svg",{get:function(){return this._svg},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"grid",{get:function(){return this._grid},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"map",{get:function(){return this._map},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"staticTools",{get:function(){return this._staticTools},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"defs",{get:function(){return this._defs},enumerable:!1,configurable:!0}),h.prototype.select=function(f){return this._root.select(f)},h.prototype.selectAll=function(f){return this._root.selectAll(f)},Object.defineProperty(h.prototype,"viewPosition",{get:function(){var f=this.getEditorWindowSize();return{scale:$e.inputs.zoom.zoomFactor,viewWidth:f.width,viewHeight:f.height,transformY:$e.inputs.zoom.zoomPosition.y,transformX:$e.inputs.zoom.zoomPosition.x}},enumerable:!1,configurable:!0}),h.prototype.getClientBBox=function(){var f=this.viewPosition,p=f.viewWidth,g=f.viewHeight,y=f.scale,T=f.transformY,x=f.transformX;return{minX:-x/y,minY:-T/y,maxX:(p-x)/y,maxY:(g-T)/y}},h.prototype.getClientCenterCoordinates=function(){var f=this.viewPosition,p=f.viewWidth,g=f.viewHeight,y=f.scale,T=f.transformY;return[(p/2-f.transformX)/y,(g/2-T)/y]},h.prototype.initStyles=function(){this._root.append("style").html(` #movika-graph-editor { background-color: `.concat(_t.manifest.styles.background.color,`; font-family: inherit; font-size: 12px; } #movika-graph-editor * { box-sizing: border-box; } #movika-graph-editor.zoom_hand_tool { cursor: grab; } #movika-graph-editor.zoom_hand_tool_active { cursor: grabbing; } #movika-graph-editor.zoom_hand_tool #map-group, #movika-graph-editor.zoom_hand_tool_active #map-group { pointer-events: none; } #movika-graph-editor svg { user-select: none; -webkit-user-select: none; } #movika-graph-editor svg text, #movika-graph-editor svg div { pointer-events: none; } .mge-editorPopup { display: flex; flex-direction: column; justify-content: center; align-items: start; font-size: 12px; line-height: 16px; background-color: `).concat(a.render.color.backgroundContrast,`; color: `).concat(a.render.color.textPrimaryLight,`; border-radius: 4px; padding: 8px; position: absolute; will-change: transform; font-weight: 400; h4 { font-size: inherit; font-weight: 600; margin: 0; } h5 { margin-top: 12px; font-size: 12px; margin-bottom: 2px; font-weight: 800; } h5:first-child { margin-top: 0; } } .mge-editorPopup.arrow-down::after { content: ""; position: absolute; width: 7px; height: 7px; background: `).concat(a.render.color.backgroundContrast,`; transform: translateX(-50%) translateY(-50%) rotate(45deg); bottom: -7px; left: 50%; box-shadow: 0px 4px 4px 0px #00000040; } .mge-editorPopup.arrow-right::after, .mge-editorPopup.arrow-right-top::after, .mge-editorPopup.arrow-left::after, .mge-editorPopup.arrow-left-top::after { content: ""; position: absolute; width: 7px; height: 7px; background: `).concat(a.render.color.backgroundContrast,`; transform: translateX(-50%) translateY(-50%) rotate(45deg); top: 50%; } .mge-editorPopup.arrow-right::after, .mge-editorPopup.arrow-right-top::after { right: -7px; } .mge-editorPopup.arrow-left::after, .mge-editorPopup.arrow-left-top::after { left: 0px; } .mge-editorPopup.arrow-right-top::after, .mge-editorPopup.arrow-left-top::after { top: 12px; } #movika-graph-editor .mge-legend { display: flex; align-items: center; background-color: rgba(17, 17, 17, 0.8); border-radius: 8px; padding: 2px 4px; color: `).concat(a.render.color.textPrimaryDark,`; font-weight: 400; text-shadow: 0px 0px 4px rgba(21, 18, 49, 0.23); position: absolute; top: calc(10px + env(safe-area-inset-top)); user-select: none; pointer-events: none; } #movika-graph-editor .mge-legend.mge-graph { left: 10px; } #movika-graph-editor .mge-legendItem { display: flex; align-items: center; position: relative; height: 36px; padding: 8px; } #movika-graph-editor .mge-legendItem:not(:first-child) { margin-left: 12px; } #movika-graph-editor .mge-legendItem:not(:first-child)::before { content: "•"; color: rgba(255, 255, 255, 0.4); position: absolute; left: -8px; top: 10px; } #movika-graph-editor .mge-legendItem .mge-icon { color: `).concat(a.render.color.iconsPrimaryDark,`; width: 20px; height: 20px; margin-right: 8px; } #movika-graph-editor .mge-legendItem .mge-icon.withBg { color: `).concat(a.render.color.textPrimaryLight,`; background-color: `).concat(a.render.color.backgroundContrast,`; border-radius: 50%; padding: 4px; } #movika-graph-editor .mge-text { font-size: 12px; font-weight: 500; color: `).concat(a.render.color.textPrimaryDark,`; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } #movika-graph-editor .mge-legendItem .mge-icon svg { display: inline-block; } @media screen and (max-device-width: 600px) and (orientation: portrait) { #movika-graph-editor .mge-legend .mge-navigation-item { display: none; } } @media screen and (max-device-width: 900px) and (orientation: landscape) { #movika-graph-editor .mge-legend .mge-navigation-item { display: none; } } `))},h})(),LE=a.render.grid.size*a.render.grid.steps,$E=[{id:"grid",numberOfCells:1,strokeWidth:.2,fillOpacity:1},{id:"inner_grid",numberOfCells:a.render.grid.steps,strokeWidth:.2,fillOpacity:.8}],vGe=(function(){function h(f){var p=this;this._gridDomElement=f,this._zoom={value:1,x:0,y:0},this._displayGrid=_t.manifest.styles.background.grid.enabled,this.dispose=function(){p._gridDomElement.selectAll("*").remove()},this.getSnappedCoordinates=function(g){var y=(function(R,O){var N=typeof Symbol=="function"&&R[Symbol.iterator];if(!N)return R;var H,le,se=N.call(R),Ae=[];try{for(;(O===void 0||O-- >0)&&!(H=se.next()).done;)Ae.push(H.value)}catch(qe){le={error:qe}}finally{try{H&&!H.done&&(N=se.return)&&N.call(se)}finally{if(le)throw le.error}}return Ae})(g,2),T=y[0],x=y[1];return[p.getSnappedCoordinateValue(T),p.getSnappedCoordinateValue(x)]},this.getSnappedCoordinateValue=function(g){return $e.inputs.keydown.shiftHold&&p._displayGrid?+(Math.floor(g/a.render.grid.size)*a.render.grid.size).toFixed(2):g},this.update=function(){p._displayGrid=_t.manifest.styles.background.grid.enabled,p.updateGridVisibility(),p._displayGrid&&p.updateGridColor()},this.renderPatterns(f),this.renderRect(f),this.updateGridColor(),this.updateGridVisibility(),o.on("zoom",(function(g){p._zoom=g,p._displayGrid&&p.updateGridSize()}))}return h.prototype.updateGridColor=function(){$e.dom.select("#grid rect").attr("stroke",_t.manifest.styles.background.grid.color),$e.dom.select("#inner_grid rect").attr("stroke",_t.manifest.styles.background.grid.color)},h.prototype.updateGridSize=function(){var f=this;$E.forEach((function(p){if(p.id==="inner_grid"){if(f._zoom.value<=.3)return void $e.dom.select("#inner_grid_rect").style("display","none");$e.dom.select("#inner_grid_rect").style("display",null)}var g=f._zoom.value*LE/p.numberOfCells;$e.dom.select("#".concat(p.id)).attr("x",f._zoom.x%g).attr("y",f._zoom.y%g).attr("width",g).attr("height",g)}))},h.prototype.updateGridVisibility=function(){this._displayGrid?(this.updateGridSize(),this._gridDomElement.style("display",null)):this._gridDomElement.style("display","none")},h.prototype.renderPatterns=function(f){var p=f.selectAll("pattern").data($E).join("pattern").attr("id",(function(g){return g.id})).attr("width",(function(g){return LE/g.numberOfCells})).attr("height",(function(g){return LE/g.numberOfCells})).attr("patternUnits","userSpaceOnUse");p.append("rect").attr("width","100%").attr("height","100%").attr("stroke-width",(function(g){return g.strokeWidth})).attr("fill","none")},h.prototype.renderRect=function(f){$E.forEach((function(p){f.append("rect").attr("x",0).attr("y",0).attr("id",p.id+"_rect").attr("width","100%").attr("height","100%").attr("fill","url(#".concat(p.id,")")).attr("fill-opacity",p.fillOpacity)}))},h})();(function(h){h.C="KeyC",h.V="KeyV",h.G="KeyG",h.H="KeyH",h.Equal="Equal",h.Minus="Minus",h.NumpadAdd="NumpadAdd",h.NumpadSubtract="NumpadSubtract",h.Delete="Delete",h.Backspace="Backspace",h.ShiftLeft="ShiftLeft",h.Space="Space"})(js||(js={}));var S6,an,mGe=(function(){function h(){var f=this;this._shiftHold=!1,this._spaceHold=!1,this.dispose=function(){document.removeEventListener("keydown",f.shortcutsHandler),document.removeEventListener("keydown",f.holdKeyHandler),document.removeEventListener("keyup",f.holdKeyHandler),window.removeEventListener("blur",f.resetHoldKey)},this.shortcutsHandler=function(p){if(!f.ignoreKeyboardEvent(p)){switch(p.code){case js.Equal:case js.NumpadAdd:f.handleZoomIn();break;case js.Minus:case js.NumpadSubtract:f.handleZoomOut()}if(a.isEditMode()){if(p.repeat)return;if(p.ctrlKey||p.metaKey){if(p.code===js.C)return void f.handleCopy();if(p.code===js.V)return void f.handlePaste()}switch(p.code){case js.Backspace:case js.Delete:f.handleDelete();break;case js.H:$e.inputs.zoom.toggleMousedownZoom();break;default:return}}else if(a.isPreViewMode()){if(p.repeat||p.code!==js.H)return;$e.inputs.zoom.toggleMousedownZoom()}}},this.holdKeyHandler=function(p){if(!f.ignoreKeyboardEvent(p)&&!p.repeat){var g=p.type==="keydown";switch(p.code){case js.ShiftLeft:f._shiftHold=g;break;case js.Space:f._spaceHold=g,g?$e.inputs.zoom.enableMousedownZoom():$e.inputs.zoom.disableMousedownZoom();break;default:return}}},this.resetHoldKey=function(){f._shiftHold=!1,f._spaceHold=!1},document.addEventListener("keydown",this.shortcutsHandler),document.addEventListener("keydown",this.holdKeyHandler),document.addEventListener("keyup",this.holdKeyHandler),window.addEventListener("blur",this.resetHoldKey)}return Object.defineProperty(h.prototype,"shiftHold",{get:function(){return this._shiftHold},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"spaceHold",{get:function(){return this._spaceHold},enumerable:!1,configurable:!0}),h.prototype.handleCopy=function(){_t.copySelectedNodes()},h.prototype.handlePaste=function(){_t.pasteNodes()},h.prototype.handleDelete=function(){_t.deleteSelection((function(){$e.tools.disable()}))},h.prototype.handleZoomIn=function(){$e.inputs.zoom.update((function(f){return f+.1}))},h.prototype.handleZoomOut=function(){$e.inputs.zoom.update((function(f){return f-.1}))},h.prototype.ignoreKeyboardEvent=function(f){return _t.isGraphFrozen||f.defaultPrevented||["INPUT","TEXTAREA"].includes(f.target.nodeName)},h})(),E6=(function(){function h(f){this.toolId=f,this.toolElement=ii("svg:g").datum([0,0]).attr("id",f).attr("transform","translate(0, 0)").style("display","none").call($e.inputs.nullableDrag())}return h.prototype.render=function(f){var p=this;f.append((function(){return p.toolElement.node()}))},h.prototype.start=function(f){f===void 0&&(f=!0),f&&$e.inputs.zoom.disable(),this.toolElement.style("display","inline")},h.prototype.stop=function(){$e.inputs.zoom.enable(),this.toolElement.style("display","none")},h.prototype.clear=function(){this.toolElement.selectAll("*").remove()},h.prototype.position=function(f){var p=(function(T,x){var R=typeof Symbol=="function"&&T[Symbol.iterator];if(!R)return T;var O,N,H=R.call(T),le=[];try{for(;(x===void 0||x-- >0)&&!(O=H.next()).done;)le.push(O.value)}catch(se){N={error:se}}finally{try{O&&!O.done&&(R=H.return)&&R.call(H)}finally{if(N)throw N.error}}return le})(f,2),g=p[0],y=p[1];return this.toolElement.datum([g,y]).attr("transform",(function(){return"translate(".concat(g,", ").concat(y,")")})),this},h.test=!0,h})(),lm=186,kc=12*a.render.grid.size,xz=function(h){return h.append("path").attr("d",(function(){return Ei({x:0,y:0,w:lm,h:kc,r:a.render.node.borderRadius})})).attr("width",lm).attr("height",kc).attr("stroke-width",a.render.strokeSize).style("stroke-dasharray","3, 3").attr("stroke",a.render.color.strokeImageBorderAlpha).attr("fill",a.render.color.backgroundFieldBackground)},kz=function(h,f,p){return{primaryTextContainer:Lz(h,f),secondaryTextContainer:p?Lz(h,p,!0):void 0}},Lz=function(h,f,p){p===void 0&&(p=!1);var g=f.split(` `),y=h.append("text").style("display",p?"none":"inline").style("fill",a.render.color.textPrimaryDark).attr("font-weight",500).attr("y",kc/2.2).attr("transform","translate(".concat(93,")")).attr("text-rendering","optimizeSpeed");return g.forEach((function(T){y.append("tspan").text(T).attr("text-anchor","middle").attr("x",0).attr("dy",17)})),y},$z=function(h,f){return!(h.minX>f.maxX||h.maxXf.maxY||h.maxY0},RE=function(h){return um(h)?a.render.color.strokeNegative:h.stylesWithDefaults.hover.borderColor},gGe=(S6=function(h,f){return S6=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,g){p.__proto__=g}||function(p,g){for(var y in g)Object.prototype.hasOwnProperty.call(g,y)&&(p[y]=g[y])},S6(h,f)},function(h,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");function p(){this.constructor=h}S6(h,f),h.prototype=f===null?Object.create(f):(p.prototype=f.prototype,new p)}),cm=function(h,f){var p=typeof Symbol=="function"&&h[Symbol.iterator];if(!p)return h;var g,y,T=p.call(h),x=[];try{for(;(f===void 0||f-- >0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},bGe=(function(h){function f(){var p=h.call(this,"area-select")||this;return p._rectBoundingBox={minX:0,minY:0,maxX:0,maxY:0},p._needForRAF=!0,p._selectedNodeIds=[],p.render=function(g){h.prototype.render.call(p,g),p._rectElement=p.toolElement.append("rect").attr("id","select-area-rect").attr("fill",a.render.color.backgroundAccent).attr("fill-opacity","0.05").attr("stroke",a.render.color.backgroundAccentThemed).attr("stroke-width","0.5").attr("shape-rendering","crispEdges")},p}return gGe(f,h),f.prototype.start=function(){var p=this;h.prototype.start.call(this),$e.dom.svg.on("mousedown.areaSelect",(function(){var g;(g=p._rectElement)===null||g===void 0||g.attr("width",0).attr("height",0)})).on("mousemove.areaSelect",(function(g){if(p._needForRAF){p._needForRAF=!1,$e.dom.select("#nodes").attr("pointer-events","none"),$e.dom.select("#branches").attr("pointer-events","none");var y=cm(p.toolElement.datum(),2),T=y[0],x=y[1],R=cm(yn(g),2),O=R[0],N=R[1];p.animationFrame=requestAnimationFrame((function(){var H,le=Math.abs(T-O),se=Math.abs(x-N),Ae=T0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},dm=(function(h){function f(){var p=h!==null&&h.apply(this,arguments)||this;return p._numberOfItems=0,p._numberOfSplitters=0,p._isTooltipActive=!1,p.showContextMenu=function(g,y){g.forEach((function(T){T.type==="splitter"?p.addMenuSplitter():p.addMenuItem(T)})),p.createMenu(y)},p}return _Ge(f,h),f.prototype.start=function(){h.prototype.start.call(this),this._numberOfItems=0,this._numberOfSplitters=0,this.clear()},f.prototype.position=function(p){var g=Iz(p,2),y=g[0],T=g[1],x=this.getSafeMenuToolArea(),R=x.minXPosition,O=x.minYPosition,N=x.horizontal,H=x.vertical,le=N-a.render.tool.menuItemWidth,se=H-a.render.tool.menuItemHeight*this._numberOfItems,Ae=Math.min(le,Math.max(R,y)),qe=Math.min(se,Math.max(O,T));return this.toolElement.datum([Ae,qe]).attr("transform",(function(){return"translate(".concat(Ae,", ").concat(qe,")")})),this},f.prototype.addMenuSplitter=function(){var p=a.render.tool.menuItemWidth;this.toolElement.append((function(){return(function(g,y,T){g===void 0&&(g=a.render.node.width),y===void 0&&(y=1),T===void 0&&(T=a.render.color.strokeFieldBorderAlpha);var x=ii("svg:g");return x.append("rect").attr("x",0).attr("y",0).attr("width",g).attr("height",y).attr("fill",T),x})(p).node()})).attr("transform","translate(0, ".concat(this.currentYPosition,")")),this._numberOfSplitters+=1},f.prototype.addMenuItem=function(p){var g=this,y=(function(x){var R=x.label,O=x.icon,N=x.disabled,H=N!==void 0&&N,le=x.width,se=le===void 0?a.render.node.width:le,Ae=x.height,qe=x.onClick,Ue=x.color,gt=Ue===void 0?a.render.color.textPrimaryDark:Ue,St=H?a.render.color.textTertiary:gt,Nt=ii("svg:g").on("click",(function(){H||qe()}));return Nt.append("rect").attr("x",0).attr("y",0).attr("width",se).attr("height",Ae||a.render.node.componentControlHeight).attr("fill",H?a.render.color.backgroundContent:a.render.color.backgroundSecondary).on("mouseenter",(function(){H||Cr(this).attr("fill",a.render.color.hoverBackgroundSecondary)})).on("mouseleave",(function(){H||Cr(this).attr("fill",a.render.color.backgroundSecondary)})).style("cursor",H?"not-allowed":"pointer"),O&&Nt.append("use").style("color",St).attr("x",8).attr("y",8).attr("href","#"+O),Nt.append("text").text(R).attr("x",O?30:8).attr("y",20).attr("font-size",12).attr("font-weight",500).attr("text-anchor","start").style("fill",St).attr("text-rendering","optimizeSpeed"),Nt})({label:p.label,icon:p.icon,disabled:p.disabled,color:p.color,width:a.render.tool.menuItemWidth,height:a.render.tool.menuItemHeight,onClick:function(){p.onClick(),g.stop()}}).attr("transform","translate(0, ".concat(this.currentYPosition,")"));if(p.tooltip){var T=p.tooltip;y.on("mouseenter",(function(){if(!g._isTooltipActive){g._isTooltipActive=!0;var x=Iz(g.toolElement.datum(),2),R=x[0],O=x[1],N=$e.dom.viewPosition.viewWidth,H=[R+a.render.tool.menuItemWidth+a.render.tool.menuItemTooltipOffset,O+g.currentYPosition-28],le="left-top";H[0]+215>N&&(H[0]=R-a.render.tool.menuItemTooltipOffset-215,le="right-top"),$e.popups.position(H).show({text:T.text,title:T.title,arrowType:le,width:"".concat(215,"px"),withScale:!1})}})).on("mouseleave",(function(){g._isTooltipActive&&(g._isTooltipActive=!1,$e.popups.hide())}))}this.toolElement.append((function(){return y.node()})),this._numberOfItems+=1},f.prototype.createMenu=function(p){(function(g){var y=g.id,T=g.width,x=g.height,R=g.element,O=g.strokeColor,N=O===void 0?a.render.color.strokeFieldBorderAlpha2:O,H=g.r,le=H===void 0?a.render.node.borderRadius:H;(function(se){var Ae=se.id,qe=se.width,Ue=se.height,gt=se.element,St=se.strokeColor,Nt=se.r;gt.append("path").attr("id",ko+Ae).attr("d",Ei({x:dd,y:dd,w:qe-2*dd,h:Ue-2*dd,r:Nt-Jo})).attr("fill","none").attr("stroke-width",a.render.strokeSize).attr("stroke",St)})({id:y,width:T,height:x,element:R,strokeColor:N,r:le}),h6({id:y,width:T,height:x,element:R,r:le})})({id:this.toolId,width:a.render.tool.menuItemWidth,height:a.render.tool.menuItemHeight*this._numberOfItems,element:this.toolElement,strokeColor:p||a.render.color.strokeFieldBorderAlpha,r:a.render.tool.borderRadius})},Object.defineProperty(f.prototype,"currentYPosition",{get:function(){return a.render.tool.menuItemHeight*this._numberOfItems+this._numberOfSplitters},enumerable:!1,configurable:!0}),f.prototype.getSafeMenuToolArea=function(){var p=$e.dom.getEditorWindowSize();return{minXPosition:10,minYPosition:10,horizontal:p.width-10,vertical:p.height-10}},f})(E6),yGe=(function(){var h=function(f,p){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,y){g.__proto__=y}||function(g,y){for(var T in y)Object.prototype.hasOwnProperty.call(y,T)&&(g[T]=y[T])},h(f,p)};return function(f,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");function g(){this.constructor=f}h(f,p),f.prototype=p===null?Object.create(p):(g.prototype=p.prototype,new g)}})(),SGe=(function(h){function f(){return h.call(this,"control-menu")||this}return yGe(f,h),f.prototype.start=function(){var p;h.prototype.start.call(this);var g=Xa((p=this._node)===null||p===void 0?void 0:p.id);if(!g||!this._control)throw new Error("[Tool]: ControlMenuTool requires 'GraphNode' and 'Control' data");this.renderMenuItems(g,this._control)},f.prototype.data=function(p,g){return this._node=p,this._control=g,this},f.prototype.renderMenuItems=function(p,g){var y=p.chapter.containers.find((function(T){return!!T.controls.find((function(x){return x.id===g.id}))})).id;this.addMenuItem({label:a.translation.tool_menu_item_rename,disabled:a.isPreViewMode(),onClick:function(){o.emit("control",{name:"renameControl",chapterId:p.id,containerId:y,control:g})},icon:s.Pencil}),this.addMenuItem({label:a.translation.tool_menu_item_delete,disabled:a.isPreViewMode(),onClick:function(){o.emit("control",{name:"deleteControl",chapterId:p.id,controlId:g.id,containerId:y})},icon:s.TrashCan,color:a.render.color.textNegative}),this.createMenu()},f})(dm),EGe=(function(){var h=function(f,p){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,y){g.__proto__=y}||function(g,y){for(var T in y)Object.prototype.hasOwnProperty.call(y,T)&&(g[T]=y[T])},h(f,p)};return function(f,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");function g(){this.constructor=f}h(f,p),f.prototype=p===null?Object.create(p):(g.prototype=p.prototype,new g)}})(),TGe=(function(h){function f(){return h.call(this,"control-type-menu")||this}return EGe(f,h),f.prototype.start=function(){if(h.prototype.start.call(this),!this._node)throw new Error("[Tool]: ControlTypeMenuTool requires 'GraphNode' data");this.renderMenuItems(this._node)},f.prototype.data=function(p){return this._node=p,this},f.prototype.renderMenuItems=function(p){this.addMenuItem({label:a.translation.tool_menu_item_control_button,icon:s.ActionButton,onClick:function(){o.emit("control",{name:"addControl",type:"Button",nodeId:p.id})}}),this.addMenuItem({label:a.translation.tool_menu_item_control_area,icon:s.ActionArea,onClick:function(){o.emit("control",{name:"addControl",type:"Area",nodeId:p.id})}}),this.createMenu()},f})(dm),wGe=(function(){var h=function(f,p){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,y){g.__proto__=y}||function(g,y){for(var T in y)Object.prototype.hasOwnProperty.call(y,T)&&(g[T]=y[T])},h(f,p)};return function(f,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");function g(){this.constructor=f}h(f,p),f.prototype=p===null?Object.create(p):(g.prototype=p.prototype,new g)}})(),AGe=(function(h){function f(){return h.call(this,"editor-context-menu")||this}return wGe(f,h),f.prototype.start=function(){h.prototype.start.call(this),this.renderMenuItems()},f.prototype.data=function(){return this},f.prototype.renderMenuItems=function(){var p=this,g=a.canCreateChapters(1,!1),y=a.canCreateChapters(_t.copiedChapters.length,!1);this.addMenuItem({label:a.translation.tool_menu_item_add_node,disabled:a.isPreViewMode()||!g,onClick:function(){var T=$e.inputs.zoom.getRelativeCoordinates(p.toolElement.datum());_t.manifest.createNode(T),$e.layers.update()},icon:s.CreateNode}),this.addMenuSplitter(),this.addMenuItem({label:a.translation.tool_menu_item_copy,disabled:!_t.selectedNodes.size||a.isPreViewMode(),onClick:function(){_t.copySelectedNodes()},icon:s.Copy}),this.addMenuItem({label:a.translation.tool_menu_item_paste,disabled:!_t.copiedNodes.size||a.isPreViewMode()||!y,onClick:function(){var T=$e.inputs.zoom.getRelativeCoordinates(p.toolElement.datum());_t.pasteNodes(T)},icon:s.Paste}),this.addMenuItem({label:a.translation.tool_menu_item_delete,disabled:!_t.selectedNodes.size||a.isPreViewMode(),onClick:function(){_t.deleteSelection()},icon:s.TrashCan,color:a.render.color.iconsNegative}),this.createMenu()},f})(dm),MGe=(function(){var h=function(f,p){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,y){g.__proto__=y}||function(g,y){for(var T in y)Object.prototype.hasOwnProperty.call(y,T)&&(g[T]=y[T])},h(f,p)};return function(f,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");function g(){this.constructor=f}h(f,p),f.prototype=p===null?Object.create(p):(g.prototype=p.prototype,new g)}})(),CGe=(function(h){function f(){return h.call(this,"eov-menu")||this}return MGe(f,h),f.prototype.start=function(){var p;h.prototype.start.call(this);var g=Xa((p=this._node)===null||p===void 0?void 0:p.id);if(!g)throw new Error("[Tool]: EOVMenuTool requires 'GraphNode' data");this.renderMenuItems(g)},f.prototype.data=function(p){return this._node=p,this},f.prototype.renderMenuItems=function(p){this.addMenuItem({label:a.translation.tool_menu_item_next_node,icon:s.Node,onClick:function(){p.updateChapterSuspenseAction("setNextBranch"),sm(p.chapter),_t.manifest.updateBranches()}});var g=!!p.containers().length;this.addMenuItem({label:a.translation.tool_menu_item_random,icon:s.Random,disabled:!g,tooltip:g?void 0:{text:a.translation.tooltip_no_interactive_added,title:a.translation.tooltip_transition_not_available},onClick:function(){p.updateChapterSuspenseAction("setRandomBranch"),_t.manifest.updateBranches(),sm(p.chapter)}}),this.createMenu(a.render.color.strokeContrast)},f})(dm),xGe=(function(){var h=function(f,p){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,y){g.__proto__=y}||function(g,y){for(var T in y)Object.prototype.hasOwnProperty.call(y,T)&&(g[T]=y[T])},h(f,p)};return function(f,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");function g(){this.constructor=f}h(f,p),f.prototype=p===null?Object.create(p):(g.prototype=p.prototype,new g)}})(),Oz=function(h,f){var p=typeof Symbol=="function"&&h[Symbol.iterator];if(!p)return h;var g,y,T=p.call(h),x=[];try{for(;(f===void 0||f-- >0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},Pz=function(h,f,p){if(arguments.length===2)for(var g,y=0,T=f.length;y1,O=!!x&&_t.selectedNodes.has(x),N=T.some((function(se){return se.chapter.order!=="end"}))&&T.every((function(se){return!se.getSuspenseBranchId()&&!se.controls().length})),H=T.some((function(se){return se.chapter.order!=="simple"})),le=[{label:a.translation.tool_menu_item_start_preview,icon:s.Play,onClick:function(){o.emit("control",{name:"openPreview",chapterId:p.id})},disabled:R||!p.chapter.videoId},{label:a.translation.tool_menu_item_focus_on_node,icon:s.Arrow,onClick:function(){$e.inputs.zoom.enable(),$e.inputs.zoom.focusChapter(p.id,1),$e.inputs.zoom.disable()}},{label:a.translation.tool_menu_item_replace_video,icon:s.Video,onClick:function(){o.emit("control",{name:"changeVideo",chapterIds:y})}},{type:"splitter"},{label:a.translation.tool_menu_item_rename,icon:s.Pencil,onClick:function(){o.emit("actions",{name:"renameChapters",context:{triggerNodeId:p.id,selectedNodesIds:y}})}},{label:a.translation.tool_menu_item_copy,icon:s.Copy,disabled:a.isPreViewMode(),onClick:function(){_t.copySelectedNodes()}},{label:a.translation.tool_menu_item_delete,icon:s.TrashCan,color:a.render.color.textNegative,disabled:O,onClick:function(){return Az(Pz([],Oz(_t.selectedNodes),!1))}},{type:"splitter"},{label:a.translation.tool_menu_item_as_start_node,icon:s.StartNode,disabled:p.chapter.order==="start"||R,onClick:function(){xE({id:p.chapter.id,order:"start"})}},{label:R?a.translation.tool_menu_items_as_node:a.translation.tool_menu_item_as_node,icon:s.Node,disabled:!H,onClick:function(){var se=T.filter((function(Ae){return Ae.chapter.order!=="simple"}));se.length===1?xE({id:p.chapter.id,order:"simple"}):(se.forEach((function(Ae){return _t.manifest.setNodeOrder(Ae.id,"simple")})),_t.manifest.save())}},{label:R?a.translation.tool_menu_items_as_end_node:a.translation.tool_menu_item_as_end_node,icon:s.EndNode,disabled:!N,onClick:function(){T.length===1?xE({id:p.chapter.id,order:"end"}):(T.forEach((function(se){return _t.manifest.setNodeOrder(se.id,"end")})),_t.manifest.save())}}];this.showContextMenu(le)},f})(dm),LGe=(function(){var h=function(f,p){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,y){g.__proto__=y}||function(g,y){for(var T in y)Object.prototype.hasOwnProperty.call(y,T)&&(g[T]=y[T])},h(f,p)};return function(f,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");function g(){this.constructor=f}h(f,p),f.prototype=p===null?Object.create(p):(g.prototype=p.prototype,new g)}})(),Nz=function(h,f){var p=typeof Symbol=="function"&&h[Symbol.iterator];if(!p)return h;var g,y,T=p.call(h),x=[];try{for(;(f===void 0||f-- >0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},Dz=kc/3.3,$Ge=(function(h){function f(){var p=h.call(this,"shadow-node")||this;return p._displayToolError=!1,p.render=function(g){h.prototype.render.call(p,g),p._shadowNode=xz(p.toolElement),p.toolElement.append("svg").attr("x",83).attr("y",Dz).attr("width",a.render.iconSize+5).attr("height",a.render.iconSize+5).attr("viewBox","0 0 ".concat(a.render.iconSize," ").concat(a.render.iconSize)).append("use").style("color",a.render.color.textPrimaryDark).attr("href","#".concat(s.Move));var y=kz(p.toolElement,a.translation.tool_shadow_node_text,a.translation.tool_shadow_node_error),T=y.primaryTextContainer,x=y.secondaryTextContainer;p._primaryText=T,p._secondaryText=x,p.toolElement.on("click",(function(R){return R.preventDefault()})).on("contextmenu",(function(R){return R.preventDefault()}))},p}return LGe(f,h),f.prototype.start=function(){h.prototype.start.call(this,!1),this.redraw(),this.enableMouseMove()},f.prototype.data=function(){return this},f.prototype.stop=function(){$e.dom.svg.style("cursor",null).on("click.shadowNode",null).on("mousemove.shadowNode",null).on("contextmenu.shadowNode",null),o.emit("control",{name:"addChapterStopped"}),h.prototype.stop.call(this)},f.prototype.enableMouseMove=function(){var p=this;$e.dom.svg.style("cursor","none"),$e.dom.svg.on("click.shadowNode",(function(g){g.preventDefault(),p._displayToolError||(_t.manifest.createNode(p.toolElement.datum()),$e.layers.update()),p.stop()})).on("mousemove.shadowNode",(function(g){var y=Nz($e.dom.getRelativeEventCoordinates(g),2),T=y[0],x=y[1],R=$e.grid.getSnappedCoordinates([T-93,x-Dz]);p.toolElement.datum(R).attr("transform",(function(){return"translate(".concat(R[0],", ").concat(R[1],")")})),p.redraw()})).on("contextmenu.shadowNode",(function(g){g.preventDefault(),p.stop()}))},f.prototype.redraw=function(){var p=Rz(this.getShadowNodeBox());this._displayToolError!==p&&(this._displayToolError=p,this.renderToolError())},f.prototype.renderToolError=function(){var p,g,y;(p=this._shadowNode)===null||p===void 0||p.attr("fill",this._displayToolError?a.render.color.backgroundNegativeTint:a.render.color.backgroundFieldBackground).attr("stroke",this._displayToolError?a.render.color.strokeNegative:a.render.color.strokeImageBorderAlpha),(g=this._primaryText)===null||g===void 0||g.style("display",this._displayToolError?"none":"inline"),(y=this._secondaryText)===null||y===void 0||y.style("display",this._displayToolError?"inline":"none")},f.prototype.getShadowNodeBox=function(){var p=Nz(this.toolElement.datum(),2),g=p[0],y=p[1];return{minX:g,minY:y,maxX:g+lm,maxY:y+kc}},f})(E6),Vz="mge-node",Bz="mge-branch",Uz=function(h){return"#node-"+h},T6=function(h,f){return"".concat(Uz(h)," .").concat(f)},Lc=function(h){return $e.dom.select(Uz(h))},Fz=function(){return $e.dom.selectAll("g.".concat(Vz))},w6=function(h){return $e.dom.select((function(f){return"#branch-"+f})(h))},IE=function(){return $e.dom.selectAll("g.".concat(Bz))},OE=function(h){return $e.dom.select("#".concat(a.render.prefix.nodeBorder).concat(h))},zz=function(h){return $e.dom.select(T6(h,"previewControls"))},jz=function(h,f){var p="nodeConnector";return f===Ir.Action?p="nodeActionConnector":f===Ir.Inaction&&(p="nodeInactionConnector"),$e.dom.select(T6(h,p))},A6=function(h,f){var p=typeof Symbol=="function"&&h[Symbol.iterator];if(!p)return h;var g,y,T=p.call(h),x=[];try{for(;(f===void 0||f-- >0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},Hz=function(h,f){h.append("rect").attr("fill","transparent").attr("height",f).attr("width",f).attr("x",-f/2).attr("y",-f/2)},Zz=function(h,f){var p=A6(f,2),g=p[0],y=p[1],T=ii("svg:g").attr("id",a.render.prefix.nodeFlipConnector+h.id).attr("class","nodeConnector").style("transform","translate(".concat(g,"px, ").concat(y,"px)")).style("display","inline");return Hz(T,8),T.append("svg:use").attr("href","#".concat(h.displayLockedContent?Qa.Connector:Qa.ConnectorDisabled)),T.node()},Gz=function(h,f){if(h.hasParentChapters(Ir.Flip)){var p=A6(h.getIncomingConnectorsCoordinates()[Ir.Flip]||[0,h.render.previewMiddleYCoordinate],2)[1],g=ii("svg:g").attr("class","nodeConnector").style("transform","translateY(".concat(p,"px)")).style("display",h.hasParentChapters(Ir.Flip)?"inline":"none");Hz(g,8),g.append("svg:use").attr("href","#".concat(Qa.Connector)),f.append((function(){return g.node()}))}},PE=function(h,f){if(h.hasParentChapters(Ir.Action)){var p=A6(h.getIncomingConnectorsCoordinates()[Ir.Action]||[0,h.render.previewMiddleYCoordinate],2),g=p[0],y=p[1];g-=a.render.node.control.connectorRadius,y-=a.render.node.control.connectorRadius;var T=As(s.Action).attr("transform","translate(".concat(g,", ").concat(y,")")).attr("class","nodeActionConnector");f.append((function(){return T.node()}))}},NE=function(h,f){if(h.hasParentChapters(Ir.Inaction)){var p=A6(h.getIncomingConnectorsCoordinates()[Ir.Inaction]||[0,h.render.previewMiddleYCoordinate],2),g=p[0],y=p[1];g-=a.render.node.control.connectorRadius,y-=a.render.node.control.connectorRadius;var T=As(s.Inaction).attr("transform","translate(".concat(g,", ").concat(y,")")).attr("class","nodeInactionConnector");f.append((function(){return T.node()}))}},RGe=(function(){var h=function(f,p){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,y){g.__proto__=y}||function(g,y){for(var T in y)Object.prototype.hasOwnProperty.call(y,T)&&(g[T]=y[T])},h(f,p)};return function(f,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");function g(){this.constructor=f}h(f,p),f.prototype=p===null?Object.create(p):(g.prototype=p.prototype,new g)}})(),DE=function(h,f){var p=typeof Symbol=="function"&&h[Symbol.iterator];if(!p)return h;var g,y,T=p.call(h),x=[];try{for(;(f===void 0||f-- >0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},IGe=(function(h){function f(){var p=h.call(this,"shadow-node-link")||this;return p._displayToolError=!1,p.render=function(g){h.prototype.render.call(p,g),p._shadowNodeContainer=p.toolElement.append("g").style("display","none"),p._shadowNode=xz(p._shadowNodeContainer);var y=kz(p._shadowNodeContainer,a.translation.tool_shadow_node_link_text,a.translation.tool_shadow_node_error),T=y.primaryTextContainer,x=y.secondaryTextContainer;p._primaryText=T,p._secondaryText=x,p._shadowBranch=p.toolElement.append("path").attr("fill","none").attr("stroke",a.render.color.strokeContrast),p.renderDefaultLine(),p.toolElement.append("rect").attr("fill","transparent").attr("x",-a.render.iconSize/2).attr("y",-a.render.iconSize/2).attr("width",a.render.iconSize).attr("height",a.render.iconSize).style("cursor","pointer"),p.toggleHoverEffects(!0)},p.stop=function(){p.renderDefaultLine(),p._node=void 0,p._parentControl=void 0,p._parentContainer=void 0,p._type=void 0,p.toolElement.call($e.inputs.nullableDrag()),h.prototype.stop.call(p)},p.createSetNextBranchEvent=function(){if(!p._hasSetNextBranchEvent&&p._type!==Ir.Flip){if(!p.node)throw new Error("Node doesn't exist");switch(p._type){case Ir.Action:p.node.updateControlActionEvent(p._parentContainer,p._parentControl,"setNextBranch");break;case Ir.Inaction:p.node.updateContainerSuspenseAction(p._parentContainer,"setNextBranch")}sm(p.node.chapter)}},p.renderDefaultLine=function(){var g;(g=p._shadowBranch)===null||g===void 0||g.attr("d",Ms({source:[0,0],target:[0,0]})).style("marker-start","").style("marker-end","")},p}return RGe(f,h),Object.defineProperty(f.prototype,"node",{get:function(){var p;return Xa((p=this._node)===null||p===void 0?void 0:p.id)},enumerable:!1,configurable:!0}),f.prototype.start=function(){if(h.prototype.start.call(this),!this.node)throw new Error("[Tool]: ShadowNodeLinkTool requires 'GraphNode' data");this.redraw(this.toolElement.datum()),this.enableDrag(this.node)},f.prototype.data=function(p,g,y,T,x,R){return x===void 0&&(x=!0),this._node=p,this._parentContainer=y,this._parentControl=T,this._type=g,this._hasSetNextBranchEvent=x,this._tooltipProps=R,this},f.prototype.enableDrag=function(p){var g,y,T,x=this,R=!1;Ia().on("start",(function(O){var N;$e.popups.hide(!0),_t.selectedNodes.has(p.id)||$e.layers.updateSelected([p.id]),$e.dom.select("#nodes").attr("pointer-events","none"),$e.dom.select("#branches").attr("pointer-events","none"),x._type===Ir.Flip?x.updateEOVTool():((N=x._shadowBranch)===null||N===void 0||N.style("marker-start","url(#".concat(l.Connector,")")),x.updateControlTool());var H=$e.grid.getSnappedCoordinates(O.subject);y=O.subject[0]-H[0],T=O.subject[1]-H[1],x.toggleHoverEffects(!1)})).on("drag",(function(O){var N,H,le;x.toolElement.style("display","inline");var se,Ae=$e.grid.getSnappedCoordinates([O.x-O.subject[0],O.y-O.subject[1]]),qe=Ae[0]-y,Ue=Ae[1]-T;if((N=x._shadowBranch)===null||N===void 0||N.attr("d",Ms({source:[0,0],target:[qe,Ue]})).style("marker-start","").style("marker-end","url(#".concat(l.Connector,")")),(g=x.pointInsideNodeBBox($e.dom.getRelativeEventCoordinates(O)))&&p.id!==g.id){R=!1,(H=x._shadowNodeContainer)===null||H===void 0||H.style("display","none");var gt=jz(g.id,x._type),St={chapterId:p.id,type:x._type||Ir.Flip,connectorType:x._type||Ir.Flip,branchId:null};if(g.updateIncomingConnectorsCoordinates(St),!gt){var Nt=(se=g.id,$e.dom.select(T6(se,"nodeTools")));x._type===Ir.Action?PE(g,Nt):x._type===Ir.Inaction?NE(g,Nt):Gz(g,Nt)}}else{R=!0,(le=x._shadowNodeContainer)===null||le===void 0||le.attr("transform","translate(".concat(qe,", ").concat(Ue-kc/2,")")).style("display","inline"),x.redraw($e.dom.getRelativeEventCoordinates(O));var It=DE($e.grid.getSnappedCoordinates($e.dom.getRelativeEventCoordinates(O)),2),Ye=It[0],Dt=It[1];$e.layers.shiftLayersOnDragToEdge([[Ye,Dt],[Ye+lm,Dt+kc]])}})).on("end",(function(O){var N;if((N=x._shadowNodeContainer)===null||N===void 0||N.style("display","none"),x._type===Ir.Flip?x.updateEOVTool(!1):x.updateControlTool(!1),$e.dom.select("#nodes").attr("pointer-events",null),$e.dom.select("#branches").attr("pointer-events",null),R)if(x._displayToolError)x.createSetNextBranchEvent();else{var H=DE($e.grid.getSnappedCoordinates($e.dom.getRelativeEventCoordinates(O)),2),le=H[0],se=H[1];_t.manifest.createNode([le,$e.grid.getSnappedCoordinateValue(se-kc/2)],p.id,(function(Ae){return x.createNodeBranch(Ae)})).updateBranches().save(),$e.layers.update()}else g?(x.createNodeBranch(g.id),g.setModified(),_t.manifest.updateBranches().save()):x.createSetNextBranchEvent();R=!1,g=void 0,x.toggleHoverEffects(!0),x.stop()}))(this.toolElement)},f.prototype.createNodeBranch=function(p){var g,y,T,x;this._parentControl?(g=this.node)===null||g===void 0||g.addBranch(p,this._type===Ir.Action?(y=this._parentControl)===null||y===void 0?void 0:y.id:void 0,this._type===Ir.Inaction?(T=this._parentContainer)===null||T===void 0?void 0:T.id:void 0):(x=this.node)===null||x===void 0||x.addBranch(p)},f.prototype.redraw=function(p){var g=Rz(this.getShadowNodeBox(p));this._displayToolError!==g&&(this._displayToolError=g,this.renderToolError())},f.prototype.renderToolError=function(){var p,g,y;(p=this._shadowNode)===null||p===void 0||p.attr("fill",this._displayToolError?a.render.color.backgroundNegativeTint:a.render.color.backgroundFieldBackground).attr("stroke",this._displayToolError?a.render.color.strokeNegative:a.render.color.strokeImageBorderAlpha),(g=this._primaryText)===null||g===void 0||g.style("display",this._displayToolError?"none":"inline"),(y=this._secondaryText)===null||y===void 0||y.style("display",this._displayToolError?"inline":"none")},f.prototype.getShadowNodeBox=function(p){var g=DE(p,2),y=g[0],T=g[1];return{minX:y,minY:T-kc/2,maxX:y+lm,maxY:T+kc/2}},f.prototype.pointInsideNodeBBox=function(p){var g,y=this;return Fz().each((function(T){var x=Pi(T);g||(g=(function(R,O){for(var N,H,le=R.length,se=R[le-1],Ae=O[0],qe=O[1],Ue=se[0],gt=se[1],St=!1,Nt=0;Ntqe!=gt>qe&&Ae<(Ue-N)*(qe-H)/(gt-H)+N&&(St=!St),Ue=N,gt=H;return St})(x.getPolygon(),[p[0]+0,p[1]])?x:void 0),g||x.hasParentChapters(y._type)||jz(x.id,y._type).remove(),$e.dom.select((function(R){return"#"+ko+R})(x.id)).attr("stroke",RE(x)).attr("stroke-opacity",1)})),g},f.prototype.updateEOVTool=function(p){p===void 0&&(p=!0),this.node&&!this._parentControl&&$e.dom.select("#".concat(a.render.prefix.nodeEOV+this.node.id)).select(".eovTypeLine").style("marker-start","url(#".concat(l.Circle)).style("marker-end",p?"":"url(#".concat(l.Circle))},f.prototype.updateControlTool=function(p){var g,y,T,x;p===void 0&&(p=!0),$e.dom.select(".control_add_link_button_".concat((g=this._parentControl)===null||g===void 0?void 0:g.id)).style("display","none"),$e.dom.select(".control_link_choice_".concat((y=this._parentContainer)===null||y===void 0?void 0:y.id)).style("display","none");var R=this._type==="action"?(T=this._parentControl)===null||T===void 0?void 0:T.id:(x=this._parentContainer)===null||x===void 0?void 0:x.id;$e.dom.select(".control_connector_".concat(R)).style("display",p?"none":"inline"),$e.dom.select(".start_link_".concat(R)).style("display","inline")},f.prototype.toggleHoverEffects=function(p){var g=this;p?this.toolElement.on("mouseenter",(function(){var y;if(g.toolElement.style("display","inline"),(y=g._shadowBranch)===null||y===void 0||y.style("marker-start",g._hasSetNextBranchEvent?"url(#".concat(l.Connector,")"):""),g._tooltipProps){var T=$e.dom.getClientBBox().maxX,x=g._tooltipProps.coordinates,R="left";x[0]+185>T&&(R="right",x[0]=x[0]-32-185),$e.popups.position(x).show({text:g._tooltipProps.text,width:"".concat(185,"px"),arrowType:R})}})).on("mouseleave",(function(){var y;g.toolElement.style("display","none"),(y=g._shadowBranch)===null||y===void 0||y.style("marker-start",g._hasSetNextBranchEvent?"url(#".concat(l.Circle,")"):""),g._tooltipProps&&$e.popups.hide()})):this.toolElement.on("mouseenter",null).on("mouseleave",null)},f})(E6);(function(h){h.ShadowNode="shadow-node",h.ShadowNodeLink="shadow-node-link",h.NodeMenu="node-menu",h.EOVMenu="eov-menu",h.ControlMenu="control-menu",h.ControlTypeMenu="control-type-menu",h.EditorContextMenu="editor-context-menu",h.AreaSelectTool="area-select-tool"})(an||(an={}));var OGe=(function(){function h(f){this._svgDOMElement=f,this.handleOutsideClick=function(p){p.defaultPrevented||$e.inputs.zoom.isMousedownZoomEnabled||$e.tools.disableContextMenu()},this._svgDOMElement.on("contextmenu",(function(p){p.defaultPrevented||$e.inputs.zoom.isMousedownZoomEnabled||!a.isEditMode()||$e.tools.use(an.EditorContextMenu).position(yn(p)).start()})),this._svgDOMElement.on("mousedown",(function(p){p.defaultPrevented||$e.inputs.zoom.isMousedownZoomEnabled||a.isViewMode()||$e.tools.use(an.AreaSelectTool).position(yn(p)).start()})),this._svgDOMElement.on("click",(function(p){p.defaultPrevented||$e.inputs.zoom.isMousedownZoomEnabled||(_t.selectedBranches.size&&_t.clearSelectedBranches(),$e.tools.disable())})),document.addEventListener("mousedown",this.handleOutsideClick)}return h.prototype.dispose=function(){this._svgDOMElement.on("contextmenu",null),document.removeEventListener("mousedown",this.handleOutsideClick)},h})(),PGe=Bo(96),Wz=Bo.n(PGe),qz=function(h,f,p,g){return new(p||(p=Promise))((function(y,T){function x(N){try{O(g.next(N))}catch(H){T(H)}}function R(N){try{O(g.throw(N))}catch(H){T(H)}}function O(N){N.done?y(N.value):(function(H){return H instanceof p?H:new p((function(le){le(H)}))})(N.value).then(x,R)}O((g=g.apply(h,[])).next())}))},Yz=function(h,f){var p,g,y,T,x={label:0,sent:function(){if(1&y[0])throw y[1];return y[1]},trys:[],ops:[]};return T={next:R(0),throw:R(1),return:R(2)},typeof Symbol=="function"&&(T[Symbol.iterator]=function(){return this}),T;function R(O){return function(N){return(function(H){if(p)throw new TypeError("Generator is already executing.");for(;x;)try{if(p=1,g&&(y=2&H[0]?g.return:H[0]?g.throw||((y=g.return)&&y.call(g),0):g.next)&&!(y=y.call(g,H[1])).done)return y;switch(g=0,y&&(H=[2&H[0],y.value]),H[0]){case 0:case 1:y=H;break;case 4:return x.label++,{value:H[1],done:!1};case 5:x.label++,g=H[1],H=[0];continue;case 7:H=x.ops.pop(),x.trys.pop();continue;default:if(!((y=(y=x.trys).length>0&&y[y.length-1])||H[0]!==6&&H[0]!==2)){x=0;continue}if(H[0]===3&&(!y||H[1]>y[0]&&H[1]0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},VE=.05,NGe=(function(){function h(f){var p=this;this._svgDOMElement=f,this._zoomTransform=zs,this._prevMinZoomFactor=.05,this._wheelDelay=300,this._wheel=null,this._mouse=[[0,0],[0,0]],this._mousedownZoomEnabled=!1,this._isZoomActive=!1,this._isZoomDisabled=!1,this.update=function(g){var y;p._isZoomDisabled||(y=Xz(y=typeof g=="function"?g(p._zoomTransform.k):g,p.minZoomFactor),p._zoom.scaleExtent([p.minZoomFactor,2]).scaleTo(p._svgDOMElement,y))},this.focusChapter=function(g,y){y===void 0&&(y=p.zoomConfig.max/2);var T=Xa(g);T&&p.translateToFromCenter(T.getCenter(),y).then((function(){_t.layout.isPerformanceBoostDisabled()||($e.layers.clear(),$e.layers.update())}))},this.translateToFromCenter=function(g,y){var T=Np(g,2),x=T[0],R=T[1];return y===void 0&&(y=p._zoomTransform.k),qz(p,void 0,void 0,(function(){var O,N,H,le,se;return Yz(this,(function(Ae){return this._isZoomDisabled?[2]:(O=this._svgDOMElement.node())?(N=O.getBoundingClientRect(),H=N.width,le=N.height,H&&le?(se=Xz(y,this.minZoomFactor),[2,this._svgDOMElement.transition().duration(750).call(this._zoom.transform,zs.translate(H/2,le/2).scale(se).translate(-x,-R)).end()]):[2]):[2]}))}))},this.translateToCoordinates=function(g,y){var T=Np(g,2),x=T[0],R=T[1];return y===void 0&&(y=p._zoomTransform.k),qz(p,void 0,void 0,(function(){return Yz(this,(function(O){return this._isZoomDisabled?[2]:[2,this._svgDOMElement.transition().duration(750).call(this._zoom.transform,zs.translate(x,R).scale(y)).end()]}))}))},this.shiftTo=function(g){var y=Np(g,2),T=y[0],x=y[1],R=p.zoomPosition,O=R.x,N=R.y;p._svgDOMElement.call(p._zoom.transform,zs.translate(O+T,N+x).scale(p._zoomTransform.k))},this.getRelativeCoordinates=function(g,y){return y?p._zoomTransform.apply(g):p._zoomTransform.invert(g)},this.toggleMousedownZoom=function(){p._mousedownZoomEnabled?p.disableMousedownZoom():p.enableMousedownZoom()},this.enableMousedownZoom=function(){p._isZoomDisabled||(p._mousedownZoomEnabled=!0,$e.dom.root.attr("class","zoom_hand_tool"))},this.disableMousedownZoom=function(){p._isZoomDisabled||(p._mousedownZoomEnabled=!1,p._isZoomActive||$e.dom.root.attr("class",null))},this.enable=function(){p._isZoomDisabled=!1},this.disable=function(){p._isZoomDisabled=!0},this._zoom=(function(){var g,y,T,x=cd,R=J2,O=em,N=Lp,H=Cf,le=[0,1/0],se=[[-1/0,-1/0],[1/0,1/0]],Ae=250,qe=Af,Ue=cn("start","zoom","end"),gt=500,St=150,Nt=0,It=10;function Ye(at){at.property("__zoom",dh).on("wheel.zoom",Ni,{passive:!1}).on("mousedown.zoom",ai).on("dblclick.zoom",Ka).filter(H).on("touchstart.zoom",Pa).on("touchmove.zoom",pl).on("touchend.zoom touchcancel.zoom",ua).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function Dt(at,hr){return(hr=Math.max(le[0],Math.min(le[1],hr)))===at.k?at:new Ko(hr,at.x,at.y)}function er(at,hr,tr){var Gt=hr[0]-tr[0]*at.k,pr=hr[1]-tr[1]*at.k;return Gt===at.x&&pr===at.y?at:new Ko(at.k,Gt,pr)}function _r(at){return[(+at[0][0]+ +at[1][0])/2,(+at[0][1]+ +at[1][1])/2]}function Tr(at,hr,tr,Gt){at.on("start.zoom",(function(){Vr(this,arguments).event(Gt).start()})).on("interrupt.zoom end.zoom",(function(){Vr(this,arguments).event(Gt).end()})).tween("zoom",(function(){var pr=this,wr=arguments,li=Vr(pr,wr).event(Gt),Di=R.apply(pr,wr),Li=tr==null?_r(Di):typeof tr=="function"?tr.apply(pr,wr):tr,ku=Math.max(Di[1][0]-Di[0][0],Di[1][1]-Di[0][1]),$c=pr.__zoom,ph=typeof hr=="function"?hr.apply(pr,wr):hr,Of=qe($c.invert(Li).concat(ku/$c.k),ph.invert(Li).concat(ku/ph.k));return function(Lu){if(Lu===1)Lu=ph;else{var pd=Of(Lu),JE=ku/pd[2];Lu=new Ko(JE,Li[0]-pd[0]*JE,Li[1]-pd[1]*JE)}li.zoom(null,Lu)}}))}function Vr(at,hr,tr){return!tr&&at.__zooming||new Sn(at,hr)}function Sn(at,hr){this.that=at,this.args=hr,this.active=0,this.sourceEvent=null,this.extent=R.apply(at,hr),this.taps=0}function Ni(at,...hr){if(x.apply(this,arguments)){var tr=Vr(this,hr).event(at),Gt=this.__zoom,pr=Math.max(le[0],Math.min(le[1],Gt.k*Math.pow(2,N.apply(this,arguments)))),wr=yn(at);if(tr.wheel)tr.mouse[0][0]===wr[0]&&tr.mouse[0][1]===wr[1]||(tr.mouse[1]=Gt.invert(tr.mouse[0]=wr)),clearTimeout(tr.wheel);else{if(Gt.k===pr)return;tr.mouse=[wr,Gt.invert(wr)],ia(this),tr.start()}dl(at),tr.wheel=setTimeout((function(){tr.wheel=null,tr.end()}),St),tr.zoom("mouse",O(er(Dt(Gt,pr),tr.mouse[0],tr.mouse[1]),tr.extent,se))}}function ai(at,...hr){if(!T&&x.apply(this,arguments)){var tr=at.currentTarget,Gt=Vr(this,hr,!0).event(at),pr=Cr(at.view).on("mousemove.zoom",(function(Li){if(dl(Li),!Gt.moved){var ku=Li.clientX-li,$c=Li.clientY-Di;Gt.moved=ku*ku+$c*$c>Nt}Gt.event(Li).zoom("mouse",O(er(Gt.that.__zoom,Gt.mouse[0]=yn(Li,tr),Gt.mouse[1]),Gt.extent,se))}),!0).on("mouseup.zoom",(function(Li){pr.on("mousemove.zoom mouseup.zoom",null),Es(Li.view,Gt.moved),dl(Li),Gt.event(Li).end()}),!0),wr=yn(at,tr),li=at.clientX,Di=at.clientY;Ao(at.view),ch(at),Gt.mouse=[wr,this.__zoom.invert(wr)],ia(this),Gt.start()}}function Ka(at,...hr){if(x.apply(this,arguments)){var tr=this.__zoom,Gt=yn(at.changedTouches?at.changedTouches[0]:at,this),pr=tr.invert(Gt),wr=tr.k*(at.shiftKey?.5:2),li=O(er(Dt(tr,wr),Gt,pr),R.apply(this,hr),se);dl(at),Ae>0?Cr(this).transition().duration(Ae).call(Tr,li,Gt,at):Cr(this).call(Ye.transform,li,Gt,at)}}function Pa(at,...hr){if(x.apply(this,arguments)){var tr,Gt,pr,wr,li=at.touches,Di=li.length,Li=Vr(this,hr,at.changedTouches.length===Di).event(at);for(ch(at),Gt=0;Gtg&&p>g||f2){if(h2)return 2}return h}function Qz(h,f,p){var g=f[0]-p[0]*h.k,y=f[1]-p[1]*h.k;return g===h.x&&y===h.y?h:new Ko(h.k,g,y)}var DGe=(function(){function h(f){var p=this;this.dispose=function(){var g,y;(g=p._keydownEvents)===null||g===void 0||g.dispose(),(y=p._mouseEvents)===null||y===void 0||y.dispose()},this.nullableDrag=function(g){var y=Ia().on("drag",null);return g&&y.on("start",(function(){document.dispatchEvent(new MouseEvent("mousedown"))})),y},this._zoom=new NGe(f),this._keydownEvents=new mGe,a.isEditOrPreViewMode()&&(this._mouseEvents=new OGe(f))}return Object.defineProperty(h.prototype,"zoom",{get:function(){return this._zoom},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"keydown",{get:function(){return this._keydownEvents},enumerable:!1,configurable:!0}),h})(),Dp="branchElement",Kz=a.render.color.strokeAccent,VGe=a.render.color.strokeImageBorderAlpha,BGe=function(h){var f=Lf(h),p=ii("svg:path").attr("class",Dp);return p.attr("d",Ms({source:f.source.position.absolute,target:f.target.position.absolute})).attr("fill","none").attr("stroke",BE(h)).attr("stroke-width",a.render.strokeSize),p.node()},Jz=function(h){var f=Lf(h),p=ii("svg:path").attr("class",Dp),g=(function(y,T,x){if(arguments.length===2)for(var R,O=0,N=T.length;O0)&&!(R=N.next()).done;)H.push(R.value)}catch(le){O={error:le}}finally{try{R&&!R.done&&(x=N.return)&&x.call(N)}finally{if(O)throw O.error}}return H})(f.source.position.absolute),!1);return f.type===Ir.Flip&&(g[0]=g[0]-42),p.attr("d",Ms({source:g,target:f.target.position.absolute})).attr("fill","none").attr("stroke",BE(h))},UGe=function(h){var f=Jz(h);return f.attr("stroke-width",a.render.strokeSize+2),f.node()},FGe=function(h){var f=Jz(h);return f.attr("stroke-width",a.render.strokeSize+4),f.node()},zGe=function(h){var f=Lf(h),p=ii("svg:path").attr("class","shadowBranchElement");return p.attr("d",Ms({source:f.source.position.absolute,target:f.target.position.absolute})).attr("fill","none").attr("stroke","transparent").attr("stroke-width",a.render.strokeSize+5),p.node()},BE=function(h){var f=Lf(h);return a.isEditMode()?_t.selectedBranches.has(f.id)?Kz:a.render.color.strokeContrast:f.isAssociatedNodeLocked()?VGe:a.render.color.strokeContrast},UE=function(h,f){var p=this;this.clear=function(){p._layer.selectAll("*").remove()},this.allowReRendering=function(){return!0},this._layer=h.append("g").attr("id",f)},jGe=(function(){var h=function(f,p){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,y){g.__proto__=y}||function(g,y){for(var T in y)Object.prototype.hasOwnProperty.call(y,T)&&(g[T]=y[T])},h(f,p)};return function(f,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");function g(){this.constructor=f}h(f,p),f.prototype=p===null?Object.create(p):(g.prototype=p.prototype,new g)}})(),ej=function(h,f){var p=typeof Symbol=="function"&&h[Symbol.iterator];if(!p)return h;var g,y,T=p.call(h),x=[];try{for(;(f===void 0||f-- >0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},tj=function(h,f,p){if(arguments.length===2)for(var g,y=0,T=f.length;y0)&&!(H=se.next()).done;)Ae.push(H.value)}catch(qe){le={error:qe}}finally{try{H&&!H.done&&(N=se.return)&&N.call(se)}finally{if(le)throw le.error}}return Ae})(p,1)[0],y=Xa(g);if(!y)throw new Error("Can't get first selected graph node");var T=y.styles.x+y.render.width/2,x=y.styles.y-40;this._marker.attr("transform","translate(".concat(T,", ").concat(x,")")).style("display","inline").style("color",y.stylesWithDefaults.hover.borderColor)}else this._marker.style("display","none")},f})(UE),rj=function(h,f){var p=typeof Symbol=="function"&&h[Symbol.iterator];if(!p)return h;var g,y,T=p.call(h),x=[];try{for(;(f===void 0||f-- >0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},ij=a.render.node.headerHeight-8,nj=a.render.node.width-a.render.node.headerHeight,aj=a.render.iconSize+4,FE=function(h,f,p){var g=h.append("g").attr("class","header");qGe(g,p),WGe(g,f,p),a.isEditMode()&&(YGe(g,f,p),g.on("mouseenter",(function(){return(function(y){var T=Pi(y);if(um(T.id)&&!T.isDragged){var x=216,R=16*T.chapterErrors.reduce((function(Ue,gt){return Math.ceil(gt.message.length/33)+Ue}),0)+(30*(T.chapterErrors.length-1)+18)+16,O=T.chapterErrors.map((function(Ue){return"
".concat(Ue.title,"
").concat(Ue.message,"
")})).join(""),N=$e.dom.getClientBBox(),H=N.minX,le=N.maxX,se=N.minY,Ae=[T.styles.x-(x-a.render.node.width)/2,T.styles.y-R-10],qe="down";(Ae[0]le&&(Ae[0]=T.styles.x-x-10,Ae[1]=T.styles.y,qe="right-top"),$e.popups.position(Ae).show({text:O,width:"".concat(x,"px"),arrowType:qe})}})(p.id)})).on("mouseleave",(function(){return $e.popups.hide()})))},zE=function(h,f,p){if(um(h)){var g=a.render.color.backgroundSecondary;p&&(g=a.render.color.backgroundNegativeTint2),f&&(g=a.render.color.backgroundNegativeTint),Lc(h).select(".headerBg").attr("fill",g)}};function oj(h,f){if(a.isViewOrPreViewMode()){var p=f?h.stylesWithDefaults.hover.borderColor:h.stylesWithDefaults.header.backgroundColor;Lc(h.id).select(".headerBg").attr("fill",p)}zE(h.id,f,!1)}var WGe=function(h,f,p){var g=rj(f,2),y=g[0],T=g[1];h.append((function(){var x;return Rf({text:p.displayLockedContent?p.chapter.label:a.translation.node_not_visited,posX:y+12,posY:T+10,width:140,fontWeight:600,color:a.isViewOrPreViewMode()?(x=p.stylesWithDefaults.header)===null||x===void 0?void 0:x.textColor:void 0})}))},qGe=function(h,f){h.append("rect").attr("width",a.render.node.width).attr("height",a.render.node.headerHeight).attr("fill",a.render.color.backgroundContent),h.append("rect").attr("class","headerBg").attr("width",a.render.node.width).attr("height",a.render.node.headerHeight).attr("fill",a.isEditMode()?a.render.color.backgroundSecondary:f.stylesWithDefaults.header.backgroundColor)},YGe=function(h,f,p){var g=rj(f,2)[1],y="rgba(0,0,0,0)",T=function(){return um(p)&&_t.selectedNodes.has(p.id)?a.render.color.activeBackgroundSecondaryAlpha:a.render.color.hoverBackgroundTertiaryAlpha},x=h.append("g").attr("id","options").style("cursor","pointer").on("click",(function(R){R.preventDefault(),$e.inputs.keydown.shiftHold&&R.stopImmediatePropagation();var O=$e.inputs.zoom.getRelativeCoordinates([xc(p.id).x+p.render.width+5,xc(p.id).y],!0);$e.tools.use(an.NodeMenu).data(p).position(O).start(),Cr(this).selectChild().attr("fill",T())})).on("mousedown",(function(){Cr(this).selectChild().attr("fill",T())})).on("mouseenter",(function(){Cr(this).selectChild().attr("fill",T())})).on("mouseleave",(function(){Cr(this).selectChild().attr("fill",y)}));x.append("path").attr("d",Ei({x:nj+4,y:g+4,w:ij,h:ij,r:10})).attr("fill",y),x.append("use").style("color",a.render.color.iconsPrimaryDark).attr("x",nj+aj/2).attr("y",g+aj/2).attr("href","#".concat(s.Etc))},XGe=function(h){switch(h.chapter.order){case"start":return a.translation.tooltip_starting_chapter;case"end":return a.translation.tooltip_final_chapter;case"simple":return""}},jE=function(h){var f=Pi(h);if(f.chapter.order!=="simple"){var p=f.render.width-a.render.node.componentOrderRadius,g=-a.render.node.componentOrderRadius,y=ii("svg:g").attr("class","nodeOrder").attr("transform","translate(".concat(p,", ").concat(g,")")).style("color",a.render.color.iconsPrimaryLight);y.append("use").attr("href","#".concat(Qa.Order)),y.append("use").attr("y",a.render.node.componentOrderRadius-a.render.iconSize/2).attr("x",a.render.node.componentOrderRadius-a.render.iconSize/2).attr("href","#".concat((function(T){switch(T.chapter.order){case"start":return s.StartNode;case"end":return s.EndNode;case"simple":return s.Node}})(f))).raise(),y.on("mouseenter",(function(){var T=xc(f.id),x=[T.x+p+35,T.y+g-4],R="left",O=$e.dom.getClientBBox().maxX;x[0]+120>O&&(x[0]=T.x+p-15-120,R="right"),$e.popups.position(x).show({text:XGe(f),width:"".concat(120,"px"),arrowType:R})})).on("mouseleave",(function(){$e.popups.hide()})),Lc(f.id).append((function(){return y.node()}))}},es=function(h,f){var p=typeof Symbol=="function"&&h[Symbol.iterator];if(!p)return h;var g,y,T=p.call(h),x=[];try{for(;(f===void 0||f-- >0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},sj="previewControls",HE="previewBackground",lj=function(h,f,p){var g=es(f,2),y=g[0],T=g[1],x=h.append("g").attr("class","preview");x.append("rect").attr("class",HE).attr("x",y).attr("y",T-1).attr("width",a.render.node.width).attr("height",a.render.node.componentPreviewHeight+4).attr("fill",a.isViewOrPreViewMode()?p.stylesWithDefaults.header.backgroundColor:a.render.color.backgroundSecondary);var R=x.append("g").attr("class","previewContainer").attr("clip-path","url(#".concat(Qa.PreviewClipPath,")")),O=[y,T+1],N=R.append("g").attr("class","previewContent");QGe(N,O,p),a.isEditMode()&&KGe(R,O,p),x.on("mouseenter",(function(){!p.isDragged&&p.displayLockedContent&&(zz(p.id).node()||(function(H,le){var se,Ae,qe=(Ae=H.id,$e.dom.select(T6(Ae,"previewContainer")));a.isEditMode()?JGe(qe,le,H):a.isViewOrPreViewMode()&&(!((se=H.stylesWithDefaults.watchAgain)===null||se===void 0)&&se.enabled)&&eWe(qe,le,H)})(p,O))})).on("mouseleave",(function(){!p.isDragged&&p.displayLockedContent&&zz(p.id).remove()}))};function uj(h,f){a.isViewOrPreViewMode()&&Lc(h.id).select(".".concat(HE)).attr("fill",f?h.stylesWithDefaults.hover.borderColor:h.stylesWithDefaults.header.backgroundColor)}var ZE=function(h,f,p,g){var y=es(f,2),T=y[0],x=y[1];h.append("rect").attr("x",T).attr("y",x).attr("width",p.render.width-2).attr("height",a.render.node.componentPreviewHeight).attr("fill",g)},cj=function(h,f,p){var g=es(f,2)[1];h.append("svg").attr("x",a.render.node.width/2-10).attr("y",g+a.render.node.componentPreviewHeight/2-10).attr("width",a.render.iconSize+4).attr("height",a.render.iconSize+4).attr("viewBox","0 0 ".concat(a.render.iconSize," ").concat(a.render.iconSize)).append("use").style("color",p.stylesWithDefaults.preview.textColor).attr("href","#".concat(s.Lock))},dj=function(h,f,p){var g=es(f,2),y=g[0],T=g[1];if(!p.videoInfo)throw new Error("No video info to render cover");h.append("svg:image").attr("id","dropZone_".concat(p.id)).attr("x",y).attr("y",T).attr("width",p.render.width-2).attr("height",a.render.node.componentPreviewHeight).attr("preserveAspectRatio","xMidYMid slice").attr("href",p.videoInfo.cover).on("error",(function(x){Cr(x.target).attr("href",(function(){return Bo(521)}))}))},GE=function(h,f,p){var g=es(f,2),y=g[0],T=g[1];h.append("use").attr("id","dropZone_".concat(p.id)).attr("x",y).attr("y",T).attr("href","#".concat(Qa.PreviewPlaceholder))},QGe=function(h,f,p){var g=es(f,2),y=g[0],T=g[1];if(!p.displayLockedContent){var x=p.stylesWithDefaults.preview.backgroundColor;return ZE(h,[y,T],p,x),void cj(h,[y,T],p)}p.videoInfo?(x=a.render.color.backgroundContent,ZE(h,[y,T],p,x),dj(h,[y,T],p)):GE(h,[y,T],p)},hj=function(h,f,p){var g=es(f,2),y=g[0],T=g[1];if(!p.displayLockedContent){var x=p.stylesWithDefaults.preview.backgroundColor;return ZE(h,[y,T],p,x),void cj(h,[y,T],p)}p.videoInfo?dj(h,[y,T],p):GE(h,[y,T],p)},KGe=function(h,f,p){var g,y=es(f,2),T=y[0],x=y[1];!((g=p.videoInfo)===null||g===void 0)&&g.title&&(h.append("rect").attr("class","previewContentTitle").attr("x",T).attr("y",x+a.render.node.componentPreviewHeight-32).attr("width",p.render.width-2).attr("height",32).attr("fill",a.render.color.backgroundSecondaryAlpha),h.append((function(){var R;return Rf({text:((R=p.videoInfo)===null||R===void 0?void 0:R.title)||"",posX:T+8,posY:a.render.node.componentPreviewHeight+12,width:a.render.node.width-16,fontSize:14,fontWeight:600,lineHeight:1})})))},JGe=function(h,f,p){var g=es(f,2),y=g[0],T=g[1],x=h.append("g").attr("class",sj).attr("transform","translate(".concat(y,", ").concat(T,")"));x.append("rect").attr("width",p.render.width-2).attr("height",a.render.node.componentPreviewHeight).attr("fill",a.render.color.otherOverlayPrimary),x.append((function(){return WE(p.chapter.videoId?a.translation.node_video_change:a.translation.node_video_choose,a.render.color.backgroundContrastSecondaryAlpha,a.render.color.hoverBackgroundTertiaryAlpha,(R=p.id,function(){o.emit("control",{name:"changeVideo",chapterIds:[R]})})).attr("transform","translate(16, 25)").node();var R})),x.append((function(){return WE(a.translation.node_open_editor,a.render.color.backgroundAccent,a.render.color.backgroundAccentThemed,(R=p.id,function(){o.emit("control",{name:"openEditor",chapterId:R})})).attr("transform","translate(16, 61)").node();var R}))},eWe=function(h,f,p){var g=es(f,2),y=g[0],T=g[1],x=h.append("g").attr("class",sj).attr("transform","translate(".concat(y,", ").concat(T,")"));x.append("rect").attr("width",p.render.width-2).attr("height",a.render.node.componentPreviewHeight).attr("fill",a.render.color.otherOverlayPrimary),x.append((function(){return WE(a.translation.node_watch_again_from,p.stylesWithDefaults.watchAgain.backgroundColor,p.stylesWithDefaults.watchAgain.backgroundColor,(R=p.id,function(){o.emit("control",{name:"openPreview",chapterId:R})}),p.stylesWithDefaults.watchAgain.textColor,130,30,8).attr("transform","translate(28, 42)").node();var R}))},WE=function(h,f,p,g,y,T,x,R){y===void 0&&(y=a.render.color.textPrimaryDark),T===void 0&&(T=a.render.node.width-32),x===void 0&&(x=28),R===void 0&&(R=4);var O=ii("svg:g").attr("class","previewControlButton").on("mouseenter",(function(){Cr(this).select(".buttonBg").attr("fill",p)})).on("mouseleave",(function(){Cr(this).select(".buttonBg").attr("fill",f)})).on("mousedown",(function(){Cr(this).select(".buttonBg").attr("opacity",.8)})).on("click",(function(N){Cr(this).select(".buttonBg").attr("opacity",1),g(N)}));return O.append("path").attr("class","buttonBg").attr("d",Ei({x:0,y:0,w:T,h:x,r:R})).attr("fill",f).style("cursor","pointer"),O.append("text").text(h).attr("class","buttonText").attr("x",T/2).attr("y",x-10).attr("font-weight",500).attr("font-size",14).attr("text-anchor","middle").style("fill",y).attr("text-rendering","optimizeSpeed"),O},qE=function(h,f){var p=typeof Symbol=="function"&&h[Symbol.iterator];if(!p)return h;var g,y,T=p.call(h),x=[];try{for(;(f===void 0||f-- >0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},pj=a.render.color.backgroundContrastSecondaryAlpha,fj=function(h,f,p){var g=qE(f,2),y=g[0],T=g[1];h.append("path").attr("class","addActionRect").attr("d",(function(){return Ei({x:y+8,y:T+8,w:p.render.width-16,h:a.render.node.componentAddActionHeight-16,r:8})})).attr("fill",pj)},vj=function(h,f){var p=typeof Symbol=="function"&&h[Symbol.iterator];if(!p)return h;var g,y,T=p.call(h),x=[];try{for(;(f===void 0||f-- >0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},mj=function(h){var f=typeof Symbol=="function"&&Symbol.iterator,p=f&&h[f],g=0;if(p)return p.call(h);if(h&&typeof h.length=="number")return{next:function(){return h&&g>=h.length&&(h=void 0),{value:h&&h[g++],done:!h}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")},tWe=function(h){return h.label||h.type},gj=function(h,f){return kE({text:tWe(h),posX:a.render.iconSize+14,posY:a.render.node.componentControlHeight/2-8,width:a.render.node.width-(a.render.iconSize+30),color:f.stylesWithDefaults.controls.textColor,lineHeight:"16px"})},rWe=function(h,f){var p=ii("svg:g").append("g").attr("class","nodeControl").style("cursor","pointer");return(function(g,y,T){g.on("mouseenter",(function(){$e.dom.select(".control_add_link_button_".concat(y.id)).attr("display","inline"),Cr(this).select(".controlElementRect").attr("fill",Zt(T.stylesWithDefaults.controls.backgroundColor,a.render.color.percentDiff))})).on("mouseleave",(function(){$e.dom.select(".control_add_link_button_".concat(y.id)).attr("display","none"),Cr(this).select(".controlElementRect").attr("fill",T.stylesWithDefaults.controls.backgroundColor)})).on("contextmenu",(function(x){x.preventDefault(),x.stopImmediatePropagation();var R=$e.dom.getRelativeEventCoordinates(x,$e.dom.staticTools.node());$e.tools.use(an.ControlMenu).data(T,y).position(R).start()}))})(p,f,h),(function(g,y){g.append("rect").attr("class","controlElementRect").attr("width",a.render.node.width).attr("height",a.render.node.componentControlHeight).attr("fill",y.stylesWithDefaults.controls.backgroundColor).attr("stroke-width",a.render.strokeSize).attr("stroke",a.render.color.backgroundContent)})(p,h),(function(g,y){g.append("use").style("color",a.render.color.iconsPrimaryDark).attr("x",8).attr("y",a.render.node.componentControlHeight/2-a.render.iconSize/2).attr("href","#".concat((function(T){switch(T.type){case"Area":return s.ActionArea;case"Button":return s.ActionButton}})(y)))})(p,f),p.append((function(){return gj(f,h).node()})),p},iWe=function(h,f){return gj(f,h)},bj=function(h,f,p){var g,y,T=vj(f,2),x=T[0],R=T[1],O=h.append("g").attr("class","controls"),N=0;try{for(var H=mj(p.containers().reverse()),le=H.next();!le.done;le=H.next()){var se=le.value;p.getContainerControls(se.id).forEach((function(Ae){O.append((function(){var qe=R+a.render.node.componentControlHeight*N++;return rWe(p,Ae).attr("transform","translate(".concat(x,", ").concat(qe,")")).node()}))}))}}catch(Ae){g={error:Ae}}finally{try{le&&!le.done&&(y=H.return)&&y.call(H)}finally{if(g)throw g.error}}},YE=function(h,f){var p=typeof Symbol=="function"&&h[Symbol.iterator];if(!p)return h;var g,y,T=p.call(h),x=[];try{for(;(f===void 0||f-- >0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},_j=function(h,f,p){var g=YE(f,2),y=g[0],T=g[1],x=h.append("g").attr("class","eov");(function(R,O){R.style("cursor","pointer").on("mouseenter",(function(){Cr(this).select(".endOfVideoRect").attr("fill",Zt(O.stylesWithDefaults.flipTo.backgroundColor,a.render.color.percentDiff))})).on("mouseleave",(function(){Cr(this).select(".endOfVideoRect").attr("fill",O.stylesWithDefaults.flipTo.backgroundColor)}))})(x,p),(function(R,O,N){R.append("rect").attr("class","endOfVideoRect").attr("width",a.render.node.width).attr("height",a.render.node.componentControlHeight).attr("fill",N.stylesWithDefaults.flipTo.backgroundColor).attr("y",O)})(x,T,p),(function(R,O){var N=YE(O,2),H=N[0],le=N[1];R.append("use").style("color",a.render.color.iconsPrimaryDark).attr("x",H+8).attr("y",le+14).attr("href","#".concat(s.EndOfVideo))})(x,[y,T]),(function(R,O,N){var H=YE(O,2),le=H[0],se=H[1],Ae=kE({text:a.translation.node_eov,posX:le+8+a.render.iconSize+6,posY:se+14,width:a.render.node.width-(a.render.iconSize+30),color:N.stylesWithDefaults.flipTo.textColor,lineHeight:"16px"});R.append((function(){return Ae.node()}))})(x,[y,T],p)},XE=function(h,f,p){var g=RE(p);return h.attr("stroke-width",a.render.strokeSize+Number(f)).attr("stroke",g)},yj=function(h,f){var p=Pi(h);return ii("svg:path").attr("class","border").attr("id",a.render.prefix.nodeBorder+h).attr("d",(function(){return Ei({x:0,y:0,w:p.render.width,h:p.render.height,r:a.render.node.borderRadius})})).attr("fill","none").attr("stroke",f).attr("stroke-width","2").style("pointer-events","none")},Sj=function(h,f){f===void 0&&(f=!0);var p=Pi(h),g=RE(p),y=yj(h,g);return XE(y,f,p),y.node()},nWe=function(h){var f=Pi(h);if(f.hasErrors()){var p=_t.selectedNodes.has(f.id);Lc(h).append((function(){return Sj(f.id,p)}))}},aWe=function(h,f){FE(f,[0,0],h),(function(g,y,T){var x,R,O,N=es(y,2),H=N[0],le=N[1],se=g.append("g").attr("class","preview");se.append("rect").attr("class",HE).attr("x",H).attr("y",le-1).attr("width",a.render.node.width).attr("height",a.render.node.componentPreviewHeight+4).attr("fill",((x=T.stylesWithDefaults.header)===null||x===void 0?void 0:x.backgroundColor)||((O=(R=Cc.view.defaultChapter)===null||R===void 0?void 0:R.header)===null||O===void 0?void 0:O.backgroundColor));var Ae=se.append("g").attr("clip-path","url(#".concat(Qa.StatsPreviewClipPath,")")),qe=[H,le+1];T.videoInfo?(function(Ue,gt,St){var Nt=es(gt,2),It=Nt[0],Ye=Nt[1];if(!St.videoInfo)throw new Error("No video info to render cover");Ue.append("svg:image").attr("x",It).attr("y",Ye).attr("width",St.render.width).attr("height",a.render.node.componentPreviewHeight).attr("preserveAspectRatio","xMidYMid slice").attr("href",St.videoInfo.cover).on("error",(function(Dt){Cr(Dt.target).attr("href",(function(){return Bo(521)}))}))})(Ae,qe,T):GE(Ae,qe,T),(function(Ue,gt,St){var Nt=es(gt,2),It=Nt[0],Ye=Nt[1];Ue.append("rect").attr("class","headerBg").attr("x",It).attr("y",Ye).attr("width",St.render.width).attr("height",a.render.node.componentPreviewHeight).attr("fill",a.render.color.otherOverlayPrimary);var Dt=_t.projectStats[St.id];(function(er,_r,Tr){var Vr=es(_r,2),Sn=Vr[0],Ni=Vr[1];Tr===void 0&&(Tr=a.translation.node_views);var ai=Rf({text:Tr,posX:Sn,posY:Ni+28,width:186,textAlign:"center",fontWeight:400,color:a.render.color.textSecondary,fontSize:11});er.append((function(){return ai}))})(Ue,[It,Ye],Dt?.label),Dt?(function(er,_r,Tr){var Vr=es(_r,2),Sn=Vr[0],Ni=Vr[1],ai=Rf({text:hGe(Tr.value),posX:Sn,posY:Ni+44,width:186,textAlign:"center",fontWeight:600,color:a.render.color.textPrimaryDark,fontSize:19,height:24}),Ka=Rf({text:"(".concat(Tr.valueInPercents," %)"),posX:Sn,posY:Ni+88,width:186,fontWeight:600,color:Tr.color,fontSize:12,height:14,textAlign:"center"});er.append((function(){return ai})),er.append((function(){return Ka}))})(Ue,[It,Ye],Dt):(function(er,_r){var Tr=es(_r,2),Vr=Tr[0],Sn=Tr[1],Ni=Rf({text:a.translation.node_no_stats_data,posX:Vr,posY:Sn+44,width:186,textAlign:"center",color:a.render.color.textPrimaryDark,fontSize:19,height:24,fontWeight:600});er.append((function(){return Ni}))})(Ue,[It,Ye])})(Ae,qe,T)})(f,[0,a.render.node.headerHeight],h);var p=yj(h.id,a.render.color.strokeFieldBorderAlpha2);f.append((function(){return p.node()})),h.statistics||f.attr("opacity",.28)},oWe=function(h){var f=Pi(h),p=ii("svg:g");return a.isEditMode()?(function(g,y){var T=a.render.node.heightWithPreviewEov,x=T+a.render.node.componentAddActionHeight;FE(y,[0,0],g),lj(y,[0,a.render.node.headerHeight],g),g.isEndNode()||(_j(y,[0,a.render.node.heightWithPreview+1],g),(function(R,O,N){var H=R.append("g").attr("class","addAction").style("cursor","pointer");(function(le,se){le.on("click",(function(Ae){var qe=$e.dom.getRelativeEventCoordinates(Ae,$e.dom.staticTools.node());$e.tools.use(an.ControlTypeMenu).data(se).position(qe).start()})).on("mouseenter",(function(){Cr(this).select(".addActionRect").attr("fill",a.render.color.hoverBackgroundTertiaryAlpha)})).on("mouseleave",(function(){Cr(this).select(".addActionRect").attr("fill",pj)}))})(H,N),(function(le,se,Ae){var qe=qE(se,2),Ue=qe[0],gt=qe[1];le.append("rect").attr("x",Ue).attr("y",gt).attr("width",Ae.render.width).attr("height",a.render.node.componentAddActionHeight).attr("fill",a.render.color.backgroundSecondary).attr("stroke-width",a.render.strokeSize).attr("stroke",a.render.color.backgroundContent)})(H,O,N),fj(H,O,N),(function(le,se,Ae){var qe=qE(se,2)[1];le.append("text").text(a.translation.node_add_control).attr("font-weight",600).attr("text-anchor","middle").style("fill",a.render.color.textPrimaryDark).attr("x",Ae.render.width/2).attr("y",qe+24).attr("text-rendering","optimizeSpeed")})(H,O,N)})(y,[0,T],g),bj(y,[0,x],g))})(f,p):a.isViewMode()?(function(g,y){var T,x,R,O=!((T=g.stylesWithDefaults.flipTo)===null||T===void 0)&&T.enabled?a.render.node.heightWithPreviewEov:a.render.node.heightWithPreview+1;FE(y,[0,0],g),lj(y,[0,a.render.node.headerHeight],g),g.isEndNode()||(!((x=g.stylesWithDefaults.flipTo)===null||x===void 0)&&x.enabled&&_j(y,[0,a.render.node.heightWithPreview+1],g),!((R=g.stylesWithDefaults.controls)===null||R===void 0)&&R.enabled&&bj(y,[0,O],g))})(f,p):a.isStatsMode()&&aWe(f,p),(function(g,y){h6({id:g.id,width:g.render.width,height:g.render.height,element:y,r:a.render.node.borderRadius})})(f,p),p.node()},M6=a.render.iconSize/2,Ej=function(h,f){var p=$e.dom.getClientBBox().maxX,g="left";h[0]+200>p&&(h[0]=h[0]-32-200,g="right"),$e.popups.position(h).show({text:f,title:a.translation.tooltip_transition_not_available,width:"".concat(200,"px"),arrowType:g})},Tj=function(h){var f=ii("svg:g");return f.append("path").attr("fill","none").attr("stroke",a.render.color.strokeContrast).attr("d",Ms({source:[0,0],target:[23,0]})).attr("pointer-events","none"),f.append((function(){return As(h).attr("transform","translate(".concat(-a.render.node.control.connectorRadius,", ").concat(-a.render.node.control.connectorRadius,")")).node()})),f},C6=a.render.iconSize/2,x6=a.render.iconSize/2,wj=a.render.color.backgroundAccent,Aj=function(h){var f=h.render.width,p=a.render.node.heightWithPreview+a.render.node.componentControlHeight/2,g=h.getSuspenseActionType(),y=g==="setNextBranch"?2*a.render.tool.eov.size:a.render.tool.eov.size,T=ii("svg:g").attr("id",a.render.prefix.nodeEOV+h.id);return T.append("path").attr("class","eovTypeLine").attr("fill","none").attr("stroke",a.render.color.strokeContrast).attr("stroke-width",a.render.strokeSize).attr("d",Ms({source:[f,p],target:[f+y,p]})).attr("pointer-events","none").style("marker-start","url(#".concat(l.Circle)).style("marker-end",h.getSuspenseBranchId()?"":"url(#".concat(l.Circle)),g!=="setNextBranch"||h.getSuspenseBranchId()||T.append("rect").attr("fill","transparent").attr("stroke","none").attr("x",f+y-x6/2).attr("y",p-x6/2).attr("width",x6).attr("height",x6).on("mouseenter",(function(x){if(!x.buttons){var R=Pi(h.id);$e.tools.use(an.ShadowNodeLink).data(R,Ir.Flip).position([R.styles.x+f+y,p+R.styles.y]).start()}})).on("mouseleave",(function(){})),T.append((function(){return sWe(h,[f+11,p-16]).attr("transform","translate(".concat(f+12,", ").concat(p-12,")")).node()})),T.node()},sWe=function(h,f){var p=(function(x,R){var O=typeof Symbol=="function"&&x[Symbol.iterator];if(!O)return x;var N,H,le=O.call(x),se=[];try{for(;(R===void 0||R-- >0)&&!(N=le.next()).done;)se.push(N.value)}catch(Ae){H={error:Ae}}finally{try{N&&!N.done&&(O=le.return)&&O.call(le)}finally{if(H)throw H.error}}return se})(f,2),g=p[0],y=p[1],T=ii("svg:g");return T.on("click",(function(x){if(!a.isViewOrPreViewMode()){x.preventDefault();var R=Xa(h.id)||h,O=$e.inputs.zoom.getRelativeCoordinates([R.styles.x+g,R.styles.y+y],!0);$e.tools.use(an.EOVMenu).data(R).position(O).start(),Cr(this).select(".eovButtonBg").attr("stroke",a.render.color.strokeContrast).attr("fill",a.render.color.backgroundSecondary)}})).on("mouseenter",(function(){a.isViewOrPreViewMode()||Cr(this).select(".eovButtonBg").attr("stroke",wj).attr("fill",wj)})).on("mouseleave",(function(){a.isViewOrPreViewMode()||Cr(this).select(".eovButtonBg").attr("stroke",a.render.color.strokeContrast).attr("fill",a.render.color.backgroundSecondary)})).call($e.inputs.nullableDrag(!0)),T.append("path").attr("class","eovButtonBg").attr("stroke",a.render.color.strokeContrast).attr("fill",a.render.color.backgroundSecondary).attr("d",Ei({x:0,y:0,w:a.render.tool.eov.size,h:a.render.tool.eov.size,r:a.render.tool.eov.radius})),T.append("use").style("color",a.render.color.textPrimaryDark).attr("x",3).attr("y",3).attr("href","#".concat(lWe(h.getSuspenseActionType()))),T},lWe=function(h){switch(h){case"setNextBranch":return s.Node;case"setRandomBranch":return s.Random;default:return s.Add}},Mj=function(h){var f=typeof Symbol=="function"&&Symbol.iterator,p=f&&h[f],g=0;if(p)return p.call(h);if(h&&typeof h.length=="number")return{next:function(){return h&&g>=h.length&&(h=void 0),{value:h&&h[g++],done:!h}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")},Cj=function(h){var f,p;if(!a.isEditMode())return uWe(h);var g=Pi(h),y=ii("svg:g").attr("class","nodeTools");if(Gz(g,y),PE(g,y),NE(g,y),g.isEndNode())return y.node();y.append((function(){return Aj(g)}));var T=0,x=function(N){g.getContainerControls(N.id).forEach((function(H){var le,se,Ae=(le=H.events)===null||le===void 0?void 0:le.some((function(Ue){return Ue.type==="onClick"&&Ue.action.type==="setNextBranch"})),qe=(se=N.events)===null||se===void 0?void 0:se.some((function(Ue){return Ue.type==="onSuspense"&&Ue.action.type==="setNextBranch"}));Ae&&qe||y.append((function(){return(function(Ue,gt,St,Nt){var It,Ye,Dt,er,_r,Tr=!1,Vr=(It=gt.events)===null||It===void 0?void 0:It.some((function(wr){return wr.type==="onSuspense"&&wr.action.type==="setNextBranch"})),Sn=(Ye=St.events)===null||Ye===void 0?void 0:Ye.some((function(wr){return wr.type==="onClick"&&wr.action.type==="setNextBranch"})),Ni=(Dt=St.events)===null||Dt===void 0?void 0:Dt.some((function(wr){return wr.type==="onClick"&&wr.action.type==="openURI"}));_r=Vr||Sn?Sn?a.render.node.control.inactionLinkY:a.render.node.control.actionLinkY:(a.render.node.control.actionLinkY+a.render.node.control.inactionLinkY)/2;var ai=a.render.node.componentControlHeight*Nt,Ka=Ue.render.controlsContainerYCoordinate+ai,Pa=function(wr,li){var Di=xc(Ue.id);return[Di.x+Ue.render.width+40+wr,Di.y+Ka+li]},pl=ii("svg:g").attr("class","controlAddLinks").attr("transform","translate(".concat(Ue.render.width,", ").concat(Ka,")")).call($e.inputs.nullableDrag()),ua=ii("svg:g").attr("class","control_link_choice_".concat(gt.id)).attr("display","none").on("mouseenter",(function(){Cr(this).attr("display","inline"),Gt.attr("display","inline"),pr.attr("stroke",a.render.color.strokeContrast)})).on("mouseleave",(function(wr){wr.toElement.closest("#shadow-node-link")||(Cr(this).attr("display","none"),Gt.attr("display","none"),pr.attr("stroke",a.render.color.strokeImageBorderAlpha),$e.popups.hide(!0))}));if(ua.append("rect").attr("fill","transparent").attr("x",0).attr("y",0).attr("width",a.render.node.componentControlHeight).attr("height",a.render.node.componentControlHeight),!Sn){ua.append((function(){return As(s.Action,!1,Ni).attr("transform","translate(15, ".concat(a.render.node.control.actionLinkY-a.render.node.control.connectorRadius,")")).on("mouseleave",(function(){$e.popups.hide()})).on("mouseenter",(function(wr){if(Ni){var li=Pa(0,-20);Ej(li,a.translation.tooltip_cannot_add_action_to_uri)}else if(!wr.buttons){var Di=xc(Ue.id);$e.tools.use(an.ShadowNodeLink).data(Ue,Ir.Action,gt,St,!1,{coordinates:Pa(0,-4),text:a.translation.tooltip_is_interaction}).position([Di.x+Ue.render.width+23,Di.y+Ka+a.render.node.control.actionLinkY]).start()}})).node()})),ua.append("path").attr("fill","none").attr("stroke",a.render.color.strokeContrast).attr("d",Ms({source:[7,_r],target:[16,a.render.node.control.actionLinkY]})).attr("pointer-events","none");var at=Tj(s.Action).attr("class","start_link_".concat(St.id)).attr("transform","translate(0, ".concat(a.render.node.control.actionLinkY,")")).attr("display","none");pl.append((function(){return at.node()}))}if(!Vr){var hr=((er=nm("onSuspense",gt.events))===null||er===void 0?void 0:er.action.type)==="expect";ua.append((function(){return As(s.Inaction,!1,hr).attr("transform","translate(15, ".concat(a.render.node.control.inactionLinkY-a.render.node.control.connectorRadius,")")).on("mouseenter",(function(wr){if(hr&&!Tr)return Tr=!0,void Ej(Pa(0,0),a.translation.tooltip_inaction_not_available);if(!wr.buttons){var li=xc(Ue.id);$e.tools.use(an.ShadowNodeLink).data(Ue,Ir.Inaction,gt,St,!1,{coordinates:Pa(0,16),text:a.translation.tooltip_is_no_interaction}).position([li.x+Ue.render.width+23,li.y+Ka+a.render.node.control.inactionLinkY]).start()}})).on("mouseleave",(function(){Tr&&(Tr=!1,$e.popups.hide())})).node()})),ua.append("path").attr("fill","none").attr("stroke",a.render.color.strokeContrast).attr("d",Ms({source:[7,_r],target:[16,a.render.node.control.inactionLinkY]})).attr("pointer-events","none");var tr=Tj(s.Inaction).attr("class","start_link_".concat(gt.id)).attr("transform","translate(0, ".concat(a.render.node.control.inactionLinkY,")")).attr("display","none");pl.append((function(){return tr.node()}))}pl.append((function(){return ua.node()}));var Gt=As(s.Plus,!0).attr("transform","translate(".concat(-a.render.node.control.connectorRadius,", ").concat(_r-a.render.node.control.connectorRadius,")")).attr("class","control_add_link_button_".concat(St.id)).attr("display","none").on("mouseenter",(function(){Cr(this).attr("display","inline"),ua.attr("display","inline"),pr.attr("stroke",a.render.color.strokeContrast)})).on("mouseleave",(function(){Cr(this).attr("display","none"),ua.attr("display","none"),pr.attr("stroke",a.render.color.strokeImageBorderAlpha)})),pr=Gt.select(".connector_circle");return pr.attr("stroke",a.render.color.strokeImageBorderAlpha),pl.append((function(){return Gt.node()})),pl.node()})(g,N,H,T)})),Ae&&y.append((function(){return(function(Ue,gt,St,Nt){var It,Ye=a.render.node.componentControlHeight*Nt,Dt=Ue.render.controlsContainerYCoordinate+a.render.node.control.actionLinkY+Ye,er=!!(!((It=St.events)===null||It===void 0)&&It.some((function(Vr){return Vr.action.args.branchId}))),_r=ii("svg:g").attr("class","controlActionLink").attr("transform","translate(".concat(Ue.render.width,", ").concat(Dt,")"));_r.append((function(){return As(s.Action).attr("transform","translate(".concat(-a.render.node.control.connectorRadius,", ").concat(-a.render.node.control.connectorRadius,")")).on("mouseenter",(function(){er||Tr.style("display","inline")})).node()}));var Tr=As(s.Minus,!0).attr("transform","translate(".concat(-a.render.node.control.connectorRadius,", ").concat(-a.render.node.control.connectorRadius,")")).style("display","none").on("mouseleave",(function(){Tr.style("display","none")})).on("click",(function(){Ue.updateControlActionEvent(gt,St,"continuePlayback"),sm(Ue.chapter),$e.tools.use(an.ShadowNodeLink).stop()}));return _r.append((function(){return Tr.node()})),er||(_r.on("mouseenter",(function(Vr){Vr.buttons||$e.tools.use(an.ShadowNodeLink).data(Ue,Ir.Action,gt,St).position([Ue.styles.x+Ue.render.width+a.render.node.control.lineLength,Ue.styles.y+Dt]).start()})).on("mouseleave",(function(){})).call($e.inputs.nullableDrag()),_r.append("rect").attr("fill","transparent").attr("x",a.render.node.control.lineLength-M6/2).attr("y",-M6/2).attr("width",M6).attr("height",M6),_r.append("path").attr("fill","none").attr("stroke",a.render.color.strokeContrast).attr("d",Ms({source:[7,0],target:[a.render.node.control.lineLength,0]})).attr("pointer-events","none"),_r.append("use").attr("class","control_connector_".concat(St.id)).attr("x",a.render.node.control.lineLength).attr("y",0).attr("href","#".concat(Qa.Connector))),_r.node()})(g,N,H,T)})),qe&&y.append((function(){return(function(Ue,gt,St,Nt){var It,Ye=a.render.node.componentControlHeight*Nt,Dt=Ue.render.controlsContainerYCoordinate+a.render.node.control.inactionLinkY+Ye,er=!!(!((It=gt.events)===null||It===void 0)&&It.some((function(Vr){return Vr.action.args.branchId}))),_r=ii("svg:g").attr("class","controlInactionLink").attr("transform","translate(".concat(Ue.render.width,", ").concat(Dt,")"));_r.append((function(){return As(s.Inaction).attr("transform","translate(".concat(-a.render.node.control.connectorRadius,", ").concat(-a.render.node.control.connectorRadius,")")).on("mouseenter",(function(){er||Tr.style("display","inline")})).node()}));var Tr=As(s.Minus,!0).attr("transform","translate(".concat(-a.render.node.control.connectorRadius,", ").concat(-a.render.node.control.connectorRadius,")")).style("display","none").on("mouseleave",(function(){Tr.style("display","none")})).on("click",(function(){Ue.updateContainerSuspenseAction(gt,"continuePlayback"),sm(Ue.chapter),$e.tools.use(an.ShadowNodeLink).stop()}));return _r.append((function(){return Tr.node()})),er||(_r.on("mouseenter",(function(Vr){Vr.buttons||$e.tools.use(an.ShadowNodeLink).data(Ue,Ir.Inaction,gt,St).position([Ue.styles.x+Ue.render.width+a.render.node.control.lineLength,Ue.styles.y+Dt]).start()})).on("mouseleave",(function(){})).call($e.inputs.nullableDrag()),_r.append("rect").attr("fill","transparent").attr("x",a.render.node.control.lineLength-C6/2).attr("y",-C6/2).attr("width",C6).attr("height",C6),_r.append("path").attr("fill","none").attr("stroke",a.render.color.strokeContrast).attr("d",Ms({source:[7,0],target:[a.render.node.control.lineLength,0]})).attr("pointer-events","none"),_r.append("use").attr("class","control_connector_".concat(gt.id)).attr("x",a.render.node.control.lineLength).attr("y",0).attr("href","#".concat(Qa.Connector))),_r.node()})(g,N,H,T)})),T++}))};try{for(var R=Mj(g.containers().reverse()),O=R.next();!O.done;O=R.next())x(O.value)}catch(N){f={error:N}}finally{try{O&&!O.done&&(p=R.return)&&p.call(R)}finally{if(f)throw f.error}}return y.node()},uWe=function(h){var f,p,g,y,T,x,R,O=Pi(h),N=ii("svg:g").attr("class","nodeTools"),H=O.getIncomingConnectorsCoordinates();if(Object.keys(H).forEach((function(Ue){switch(Ue){case Ir.Flip:N.append((function(){return Zz(O,H[Ue])}));break;case Ir.Action:PE(O,N);break;case Ir.Inaction:NE(O,N)}})),((g=O.stylesWithDefaults.controls)===null||g===void 0?void 0:g.enabled)&&!O.isEndNode()){var le=0,se=function(Ue){O.getContainerControls(Ue.id).forEach((function(gt){var St,Nt,It=(St=gt.events)===null||St===void 0?void 0:St.some((function(Dt){return Dt.type==="onClick"&&Dt.action.type==="setNextBranch"})),Ye=(Nt=Ue.events)===null||Nt===void 0?void 0:Nt.some((function(Dt){return Dt.type==="onSuspense"&&Dt.action.type==="setNextBranch"}));It&&N.append((function(){return(function(Dt,er){var _r=a.render.node.componentControlHeight*er,Tr=Dt.render.controlsContainerYCoordinate+a.render.node.control.actionLinkY+_r,Vr=ii("svg:g").attr("transform","translate(".concat(Dt.render.width,", ").concat(Tr,")"));return Vr.append((function(){return As(s.Action).attr("transform","translate(".concat(-a.render.node.control.connectorRadius,", ").concat(-a.render.node.control.connectorRadius,")")).node()})),Vr.node()})(O,le)})),Ye&&N.append((function(){return(function(Dt,er){var _r=a.render.node.componentControlHeight*er,Tr=Dt.render.controlsContainerYCoordinate+a.render.node.control.inactionLinkY+_r,Vr=ii("svg:g").attr("transform","translate(".concat(Dt.render.width,", ").concat(Tr,")"));return Vr.append((function(){return As(s.Inaction).attr("transform","translate(".concat(-a.render.node.control.connectorRadius,", ").concat(-a.render.node.control.connectorRadius,")")).node()})),Vr.node()})(O,le)})),le++}))};try{for(var Ae=Mj(O.containers().reverse()),qe=Ae.next();!qe.done;qe=Ae.next())se(qe.value)}catch(Ue){f={error:Ue}}finally{try{qe&&!qe.done&&(p=Ae.return)&&p.call(Ae)}finally{if(f)throw f.error}}}return O.isEndNode()||((!(!((y=O.stylesWithDefaults.flipTo)===null||y===void 0)&&y.enabled)&&O.hasBranches(Ir.Flip)||!(!((T=O.stylesWithDefaults.controls)===null||T===void 0)&&T.enabled)&&O.hasBranches(Ir.Action)||!(!((x=O.stylesWithDefaults.controls)===null||x===void 0)&&x.enabled)&&O.hasBranches(Ir.Inaction))&&N.append((function(){return Zz(O,[O.render.width,O.render.previewMiddleYCoordinate])})),!((R=O.stylesWithDefaults.flipTo)===null||R===void 0)&&R.enabled&&N.append((function(){return Aj(O)}))),N.node()},xj=function(h,f,p){var g=(function(R,O){var N=typeof Symbol=="function"&&R[Symbol.iterator];if(!N)return R;var H,le,se=N.call(R),Ae=[];try{for(;(O===void 0||O-- >0)&&!(H=se.next()).done;)Ae.push(H.value)}catch(qe){le={error:qe}}finally{try{H&&!H.done&&(N=se.return)&&N.call(se)}finally{if(le)throw le.error}}return Ae})(p,2),y=g[0],T=g[1],x=h.append("rect").attr("width",a.render.node.width).attr("height",f.render.height-T).attr("fill",a.render.color.backgroundSecondary);(y||T)&&x.attr("x",y).attr("y",T)},cWe=function(h){var f=Pi(h),p=ii("svg:g"),g=a.render.node,y=g.headerHeight,T=g.heightWithPreviewEov,x=g.componentAddActionHeight;return xj(p,f,[0,0]),hj(p,[0,y+1],f),a.isEditMode()&&!f.isEndNode()&&((function(R,O,N){fj(R,O,N)})(p,[0,T],f),(function(R,O,N){var H,le,se=vj(O,2),Ae=se[0],qe=se[1],Ue=0;try{for(var gt=mj(N.containers().reverse()),St=gt.next();!St.done;St=gt.next()){var Nt=St.value;N.getContainerControls(Nt.id).forEach((function(It){R.append((function(){var Ye=qe+a.render.node.componentControlHeight*Ue++;return iWe(N,It).attr("transform","translate(".concat(Ae,", ").concat(Ye,")")).node()}))}))}}catch(It){H={error:It}}finally{try{St&&!St.done&&(le=gt.return)&&le.call(gt)}finally{if(H)throw H.error}}})(p,[0,T+x],f)),p.node()},dWe=function(h){var f=Pi(h),p=ii("svg:g"),g=a.render.node.headerHeight;return xj(p,f,[0,0]),hj(p,[0,g+1],f),p.node()},hWe=(function(){var h=function(f,p){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,y){g.__proto__=y}||function(g,y){for(var T in y)Object.prototype.hasOwnProperty.call(y,T)&&(g[T]=y[T])},h(f,p)};return function(f,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");function g(){this.constructor=f}h(f,p),f.prototype=p===null?Object.create(p):(g.prototype=p.prototype,new g)}})(),If=function(h,f){var p=typeof Symbol=="function"&&h[Symbol.iterator];if(!p)return h;var g,y,T=p.call(h),x=[];try{for(;(f===void 0||f-- >0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},hm=function(h,f,p){if(arguments.length===2)for(var g,y=0,T=f.length;y=h.length&&(h=void 0),{value:h&&h[g++],done:!h}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")},pWe=(function(h){function f(p,g){var y=h.call(this,p,g)||this;return y._needForRAF=!0,y.render=function(){var T=_t.layout.getChangedNodes(),x=T.deletedNodes,R=T.editedNodes;y.destroyNodes(hm(hm([],If(x),!1),If(R),!1)),R.length&&(y.renderNodes(R),y.updateSelected(hm([],If(_t.selectedNodes),!1),!0)),y.saveRenderResults()},y.clear=function(){y._layer.selectAll("*").remove(),_t.layout.renderedNodesData={}},y.updateSelected=function(T,x){var R,O,N,H;x===void 0&&(x=!1);var le=x?new Set:_t.selectedNodes,se=new Set(T);try{for(var Ae=k6(le),qe=Ae.next();!qe.done;qe=Ae.next()){var Ue=qe.value;(Nt=Xa(Ue))&&!se.has(Ue)&&(y.removeNodeHighlight(Ue),uj(Nt,!1),oj(Nt,!1))}}catch(It){R={error:It}}finally{try{qe&&!qe.done&&(O=Ae.return)&&O.call(Ae)}finally{if(R)throw R.error}}try{for(var gt=k6(se),St=gt.next();!St.done;St=gt.next()){var Nt;Ue=St.value,(Nt=Xa(Ue))&&!le.has(Nt.id)&&(y.createNodeHighlight(Nt),uj(Nt,!0),oj(Nt,!0))}}catch(It){N={error:It}}finally{try{St&&!St.done&&(H=gt.return)&&H.call(gt)}finally{if(N)throw N.error}}T.forEach((function(It){return Lc(It).raise()}))},y.setHovered=function(T){var x,R,O,N,H=new Set(T);try{for(var le=k6(_t.hoveredNodes.values()),se=le.next();!se.done;se=le.next()){var Ae=se.value,qe=Xa(Ae);qe&&!H.has(qe.id)&&y.onNodeMouseLeave(qe.id)}}catch(Nt){x={error:Nt}}finally{try{se&&!se.done&&(R=le.return)&&R.call(le)}finally{if(x)throw x.error}}try{for(var Ue=k6(H.values()),gt=Ue.next();!gt.done;gt=Ue.next()){var St=gt.value;_t.hoveredNodes.has(St)||y.onNodeMouseEnter(St)}}catch(Nt){O={error:Nt}}finally{try{gt&&!gt.done&&(N=Ue.return)&&N.call(Ue)}finally{if(O)throw O.error}}},y.createNodeCards=function(T){var x=T.map((function(R){return R.id}));return y._layer.selectAll("g.NotExistingClassName").data(x).join("g").attr("class",Vz).attr("id",(function(R){return"node-"+R})).attr("transform",(function(R){var O=xc(R);return"translate(".concat(Math.round(O.x),", ").concat(Math.round(O.y),")")}))},y.subscribeForZoomEvent(),y}return hWe(f,h),f.prototype.subscribeForZoomEvent=function(){var p=a.performance.renderAfterZoomThrottleInMs,g=Wz()((function(){$e.layers.update()}),p);o.on("zoom",g)},f.prototype.destroyNodes=function(p){p.forEach((function(g){return Lc(g.id).remove()}))},f.prototype.saveRenderResults=function(){var p=Fz().data().map(Pi);_t.layout.renderedNodesData=Pp(p),_t.layout.previousNodesToRenderCount=_t.manifest.nodes.length},f.prototype.renderNodeFullLayout=function(p){p.append(oWe),a.isEditMode()?(p.each(nWe),p.append(Cj),p.each((function(g){(function(y){var T,x=(function(H){return _t.chaptersTags[H]||uGe})(y);if(x.size!==0){var R=Pi(y),O=((T=R.stylesWithDefaults.hover)===null||T===void 0?void 0:T.borderColor)||a.render.color.backgroundAccent,N=ii("svg:g").attr("transform","translate(-9, -9)").on("mouseenter",(function(){var H=$e.dom.getClientBBox(),le=H.minX,se=H.minY,Ae=[R.styles.x-268,R.styles.y-22],qe="right";Ae[0]=h.length&&(h=void 0),{value:h&&h[g++],done:!h}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")},L6=function(h,f){var p=typeof Symbol=="function"&&h[Symbol.iterator];if(!p)return h;var g,y,T=p.call(h),x=[];try{for(;(f===void 0||f-- >0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},fWe=function(h){var f=this;this._editorMapElement=h,this.update=function(){var p,g;_t.sectors.updateSectors($e.dom.viewPosition);try{for(var y=QE(f._layers),T=y.next();!T.done;T=y.next()){var x=T.value;x.allowReRendering()&&x.render()}}catch(R){p={error:R}}finally{try{T&&!T.done&&(g=y.return)&&g.call(y)}finally{if(p)throw p.error}}},this.updateSelected=function(p,g){var y,T;g===void 0&&(g=!0);try{for(var x=QE(f._layers),R=x.next();!R.done;R=x.next())R.value.updateSelected(p)}catch(O){y={error:O}}finally{try{R&&!R.done&&(T=x.return)&&T.call(x)}finally{if(y)throw y.error}}_t.selectNodes(p,g)},this.updateHovered=function(p){var g,y;try{for(var T=QE(f._layers),x=T.next();!x.done;x=T.next())x.value.setHovered(p)}catch(R){g={error:R}}finally{try{x&&!x.done&&(y=T.return)&&y.call(T)}finally{if(g)throw g.error}}},this.clear=function(){f._layers.forEach((function(p){return p.clear()}))},this.dispose=function(){f._editorMapElement.selectAll("*").remove()},this.shiftLayersOnDragToEdge=function(p){var g=L6(p,2),y=L6(g[0],2),T=y[0],x=y[1],R=L6(g[1],2),O=R[0],N=R[1],H=30*Math.max($e.inputs.zoom.zoomFactor,.4);f.shiftNodesMapOnLeftBorderTouche(T,H),f.shiftNodesMapOnTopBorderTouche(x,H),f.shiftNodesMapOnRightBorderTouche(O,H),f.shiftNodesMapOnBottomBorderTouche(N,H)},this.shiftNodesMapOnLeftBorderTouche=function(p,g){var y=$e.inputs.zoom,T=y.zoomFactor,x=y.shiftTo;y.zoomPosition.x+p*T<40&&x([g,0])},this.shiftNodesMapOnTopBorderTouche=function(p,g){var y=$e.inputs.zoom,T=y.zoomFactor,x=y.shiftTo;y.zoomPosition.y+p*T<40&&x([0,g])},this.shiftNodesMapOnRightBorderTouche=function(p,g){var y=$e.inputs.zoom,T=y.zoomFactor,x=y.shiftTo,R=y.zoomPosition,O=$e.dom.getEditorWindowSize().width;R.x+p*T>O-40&&x([-g,0])},this.shiftNodesMapOnBottomBorderTouche=function(p,g){var y=$e.inputs.zoom,T=y.zoomFactor,x=y.shiftTo,R=y.zoomPosition,O=$e.dom.getEditorWindowSize().height;R.y+p*T>O-40&&x([0,-g])},this._layers=(function(p,g,y){if(arguments.length===2)for(var T,x=0,R=g.length;x0)&&!(g=T.next()).done;)x.push(g.value)}catch(R){y={error:R}}finally{try{g&&!g.done&&(p=T.return)&&p.call(T)}finally{if(y)throw y.error}}return x},kj=function(h,f,p){if(arguments.length===2)for(var g,y=0,T=f.length;ya.performance.enableSkeletonsOnNodesCount&&g.zoom($e.inputs.zoom.minZoomFactor),_t.reset(),_t.manifest.set(y),_t.setVisitedNodes([y.metadata.initChapterId]),g.reRenderAfterUpdate(T)},this.updateVideosInfo=function(y){try{_t.updateVideosInfo(y),_t.manifest.rebuildNodesAndBranches(),$e.layers.update()}catch{throw new Error("Argument type mismatch.")}},this.setGraphFrozen=function(y){_t.isGraphFrozen=y},this.dispose=function(){_t.reset(),_t.setNodeErrors({}),o.dispose(),$e.dispose()},this.zoom=function(y){CE(y)&&$e.inputs.zoom.update(y)},this.zoomTo=function(y,T,x){if(T===void 0&&(T=$e.inputs.zoom.zoomFactor),x===void 0&&(x={}),(function(O){return Array.isArray(O)&&CE(O[0])&&CE(O[1])})(y)){var R=x.isFromCenter;R!==void 0&&R?$e.inputs.zoom.translateToFromCenter(y,T):$e.inputs.zoom.translateToCoordinates(y,T)}},this.zoomConfig=function(){return $e.inputs.zoom.zoomConfig},this.zoomEnable=function(){$e.inputs.zoom.enable()},this.zoomDisable=function(){$e.inputs.zoom.disable()},this.selectChapter=function(y,T){T===void 0&&(T=!1);var x=typeof y=="string"?[y]:y;$e.layers.updateSelected(x,!1);var R=typeof y=="string"?y:y[0];T&&R&&g.focusChapter(R)},this.hoverOverChapters=function(y){var T=Array.isArray(y)?y:[y];$e.layers.updateHovered(T)},this.focusChapter=function(y,T){T===void 0&&(T=g.zoomConfig().max/2),$e.inputs.zoom.focusChapter(y,T)},this.recenterGraph=function(){if(_t.manifest.nodes.length){var y=$e.inputs.zoom.centeredZoom,T=y.x,x=y.y,R=y.scale;$e.inputs.zoom.translateToFromCenter([T,x],R)}},this.setChaptersValidationErrors=function(y){if(!a.isEditMode())throw new Error("Only applicable in 'edit' mode");_t.setNodeErrors(y),g.reRenderAfterUpdate()},this.toggleAddChapterTool=function(y){if(y===void 0&&(y=!0),!a.isEditMode())throw new Error("Only applicable in 'edit' mode");if(y){var T=$e.inputs.zoom.getRelativeCoordinates([100,100]);$e.tools.use(an.ShadowNode).position(T).start()}else $e.tools.disable()},this.toggleHandTool=function(y){$e.inputs.zoom.toggleMousedownZoom(),y($e.inputs.zoom.isMousedownZoomEnabled)},this.setVisitedChapters=function(y){if(!a.isViewMode())throw new Error("Only applicable in 'view' mode");_t.setVisitedNodes(y),$e.layers.update()},this.setProjectStatistics=function(y){_t.setProjectStats(y),a.isStatsMode()&&(_t.manifest.setAllNodesAsModified(),g.reRenderAfterUpdate())},this.setMode=function(y){if(!["edit","view","stats"].includes(y))throw new Error("Invalid mode = ".concat(y));a.switchMode(y),_t.manifest.rebuildNodesAndBranches(),g.reRenderAfterUpdate()},this.setCopiedNodes=function(y){_t.setCopiedNodes(y)},this.setChaptersTags=function(y){var T=Object.entries(y).map((function(x){var R=KE(x,2),O=R[0],N=R[1];return[O,new Set(N)]}));_t.chaptersTags=Object.fromEntries(T),Object.keys(y).forEach((function(x){var R;return(R=Xa(x))===null||R===void 0?void 0:R.setModified()})),g.reRenderAfterUpdate(kj([],KE(_t.selectedNodes),!1))},this.on=function(y,T){o.on(y,T)},a.init(p),$e.init(f),$e.layers.clear()}return h.prototype.reRenderAfterUpdate=function(f){f===void 0&&(f=[]),$e.dom.updateEditorBackgroundColor(),$e.grid.update(),$e.layers.update(),_t.updatedSelectedBranches();var p=f.filter((function(g){return Xa(g)}));$e.layers.updateSelected(p,!1)},h})()})();var gHe=nr.Wk,bHe=nr.CX,_He=nr.yP,yHe=nr.QS,SHe=nr.bc,EHe=nr.rQ,THe=nr.GM,wHe=nr.$D,AHe=nr.qc,MHe=nr.gS,CHe=nr.m6,xHe=nr.b1,kHe=nr.VJ,LHe=nr.l1,$He=nr.U0,RHe=nr.xi,IHe=nr.Ql,OHe=nr.Qf,PHe=nr.Db,NHe=nr.HU,DHe=nr.n4,VHe=nr.vW,BHe=nr.sY,UHe=nr.gH,FHe=nr.ZW,zHe=nr.vF,jHe=nr.q8,HHe=nr.I7,ZHe=nr.FF,GHe=nr.jU,WHe=nr.aP,qHe=nr.J1,YHe=nr.AE,XHe=nr.W,QHe=nr.eI,KHe=nr.KJ,JHe=nr.Zr,eZe=nr.C9,tZe=nr.sl,rZe=nr.TS,iZe=nr.eE,nZe=nr.ws,aZe=nr.U2,oZe=nr.jb,sZe=nr.S3,lZe=nr.sI,uZe=nr.CD,cZe=nr.sN,dZe=nr.E0,hZe=nr.B_,pZe=nr.jJ,fZe=nr.vR,vZe=nr.TT,mZe=nr.gR,gZe=nr.dy,bZe=nr.Y,_Ze=nr.jD,yZe=nr.ZM,SZe=nr.Vz,EZe=nr.Fv,TZe=nr.GP,wZe=nr.BZ,AZe=nr.Hi,MZe=nr.xf,CZe=nr.gO,xZe=nr.gu,kZe=nr.RW,LZe=nr.d0,$Ze=nr.ql,RZe=nr.Kh;const IZe=Object.freeze(Object.defineProperty({__proto__:null,ChapterError:gHe,ContainerTypes:bHe,ControlTypes:_He,DEFAULT_GRAPH_DESIGN:yHe,DEFAULT_MANIFEST_VERSION:SHe,EventActionTypes:EHe,EventTypes:THe,GraphEditor:wHe,MAX_MANIFEST_VERSION:AHe,MIN_MANIFEST_VERSION:MHe,MOCKED_CHAPTER:CHe,MOCKED_CHAPTER_CONTAINERS:xHe,MOCKED_CHAPTER_EVENT:kHe,MOCKED_CONTROL:LHe,ManifestParsingError:$He,TEST_VERSION_REGEX:RHe,addBranchToChapter:IHe,addControlToChapter:OHe,applyContainerTemplate:PHe,canBeEndNode:NHe,compareVersions:DHe,containersTemplateCreator:VHe,copyChapter:BHe,createChapter:UHe,createChapterBranch:FHe,createContainerEvent:zHe,createControl:jHe,createControlEvent:HHe,createDefaultGraphDesign:ZHe,createGraphChapter:GHe,createManifest:WHe,createMockedChapter:qHe,createMockedChapterContainer:YHe,createMockedChapterContainerWithLayoutParams:XHe,createMockedControl:QHe,createMockedControlLayoutParams:KHe,createMockedManifest:JHe,createMockedManifestVideo:eZe,createMockedManifest_3_0:tZe,createMockedManifest_3_1:rZe,createMockedManifest_3_2:iZe,getChapterSuspenseActionType:nZe,getCopiedChapterLabel:aZe,getEventByType:oZe,getEventIndexByType:sZe,getManifestJson:lZe,isSupportedManifest:uZe,manifestJson:cZe,manifest_3_0:dZe,manifest_3_1:hZe,manifest_3_2:pZe,migrateManifestToLatestVersion:fZe,mockedChapter:vZe,mockedChapterContainer:mZe,mockedChapterContainerWithLayoutParams:gZe,mockedControl:bZe,mockedControlLayoutParams:_Ze,mockedManifest:yZe,mockedManifestVideo:SZe,normalize:EZe,parseManifest:TZe,removeBranchesFromChapter:wZe,removeControlFromChapter:AZe,removeControlsFromContainers:MZe,replacers:CZe,toDict:xZe,updateChapterSuspenseAction:kZe,updateContainerSuspenseAction:LZe,updateControlActionEventLegacy:$Ze,validateChapter:RZe},Symbol.toStringTag,{value:"Module"}));return pm.app=iA,pm.start=ZG,Object.defineProperty(pm,Symbol.toStringTag,{value:"Module"}),pm})({}); __sveltekit_lpt777.app.start(element, { node_ids: [0, 145], data: [null,null], form: null, error: null }); }