Current Path : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/ui/tutor/dist/ |
Current File : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/ui/tutor/dist/tutor.bundle.min.js |
this.BX=this.BX||{};this.BX.UI=this.BX.UI||{};(function(t,e,i,s){"use strict";class o extends e.Event.EventEmitter{constructor(t){super();this.setEventNamespace("BX.UI.Tutor.Step");t=e.Type.isPlainObject(t)?t:{};this.id=t.id||null;this.title=t.title||null;this.description=t.description||null;this.url=t.url||"";this.isCompleted=t.isCompleted||false;this.video=t.video||null;this.helpLink=t.helpLink||null;this.highlight=t.highlight||null;this.isActive=t.isActive===true;this.isShownForSlider=t.isShownForSlider||false;this.initOptions=t;this.videoObj=null}getTitle(){return this.title}getVideoObj(){return this.videoObj}getHighlightOptions(){return this.highlight}getDescription(){return this.description}getUrl(){return this.url}getCompleted(){return this.isCompleted}getVideo(){return this.video}getHelpLink(){return this.helpLink}getId(){return this.id}getInitOptions(){return this.initOptions}activate(){this.isActive=true}getShownForSlider(){return this.isShownForSlider}deactivate(){this.isActive=false}static getFullEventName(t){return t}}let n=t=>t,r,p,l,a,u,h,c,d,m,g,f;class S extends e.Event.EventEmitter{constructor(){super();this.setEventNamespace("BX.UI.Tutor.Manager")}setOptions(t,i,s){t=t||{};this.tutorialData=t.tutorialData||{};this.eventService=t.eventService||{};this.lastCheckTime=t.lastCheckTime||0;this.domain=t.domain||"";this.feedbackFormId=t.feedbackFormId||"";if(e.Type.isString(i)&&i.length>0){this.domain=i}if(e.Type.isString(s)&&s.length>0){this.feedbackFormId=s}}getDomain(){return this.domain}getCurrentTutorialData(){return this.tutorialData}getCurrentEventService(){return this.eventService}getCurrentLastCheckTime(){return this.lastCheckTime}static getInstance(){return this.instance}static getScenarioInstance(){return this.scenarioInstance}static init(t,e,i){let s=this.getInstance();if(!(s instanceof S)){this.instance=new S;s=this.getInstance();this.emit("onInitManager")}else{s=this.getInstance()}s.setOptions(t,e,i);return s}static initScenario(t){let e=this.getScenarioInstance();if(!(e instanceof j)){this.scenarioInstance=new j;e=this.getScenarioInstance();this.emit("onInitScenario")}else{e=this.getScenarioInstance()}e.setOptions(t);return e}static showButton(t){return this.getImButton(t)}static getRootImButton(){return document.getElementById("ui-tutor-btn-wrap")}static hasImButton(){return!!this.getRootImButton()}static getImButton(t){if(!this.layout.imButton){let i=this.getRootImButton();if(i){let s=e.Tag.render(r||(r=n` <div class="ui-tutor-btn"></div> `));if(t){e.Dom.addClass(i,"ui-tutor-btn-wrap-animate")}e.Dom.append(s,i);e.Dom.addClass(i,"ui-tutor-btn-wrap-show");this.layout.imButton=i;e.Event.bind(this.layout.imButton,"click",(()=>{this.emit("clickImButton")}));let o=document.querySelector(".bx-im-users-wrap");if(document.querySelector("#bx-im-btn-call")){o.style.bottom="175px"}else{o.style.bottom="120px"}}}return this.layout.imButton}static showSmallPopup(t){this.smallPopupText=t;this.getSmallPopup().style.display="block";this.smallPopupText="";if(e.Dom.hasClass(this.getSmallPopup(),"ui-tutor-popup-welcome-hide")){e.Dom.removeClass(this.getSmallPopup(),"ui-tutor-popup-welcome-hide")}}static hideSmallPopup(t){t=t===true;const i=function(){e.Dom.remove(this.getSmallPopup());if(this.hasOwnProperty("smallPopup")){delete this.smallPopup}this.emit("onCompleteHideSmallPopup")}.bind(this);e.Dom.removeClass(this.getSmallPopup(),"ui-tutor-popup-welcome-show");e.Dom.addClass(this.getSmallPopup(),"ui-tutor-popup-welcome-hide");if(t){i()}else{setTimeout(i,300)}}static showWelcomePopup(t){this.emit("onShowWelcomePopup");this.showSmallPopup(t)}static hideWelcomePopup(){this.emit("onBeforeHideWelcomePopup");this.hideSmallPopup();this.emit("onAfterHideWelcomePopup")}static showNoticePopup(t){this.emit("onShowNoticePopup");this.showSmallPopup(t)}static hideNoticePopup(){this.emit("onBeforeHideNoticePopup");this.hideSmallPopup();this.emit("onAfterHideNoticePopup")}static getSmallPopup(){const t=()=>{this.emit("onClickSmallPopupBtn")};if(!this.smallPopup){this.smallPopup=e.Tag.render(p||(p=n` <div class="ui-tutor-popup" onclick="${0}"> <div class="ui-tutor-popup-header"> <span class="ui-tutor-popup-header-icon"></span> <span class="ui-tutor-popup-header-title-wrap"> <span class="ui-tutor-popup-header-title">${0}</span> </span> </div> <div class="ui-tutor-popup-content"> <div class="ui-tutor-popup-text">${0}</div> </div> <div class="ui-tutor-popup-icon-angle"></div> </div> `),t.bind(this),e.Loc.getMessage("JS_UI_TUTOR_TITLE"),this.smallPopupText);this.emit("onCreateSmallPopupNode");e.Dom.addClass(this.smallPopup,"ui-tutor-popup-welcome-show");this.emit("onBeforeAppendSmallPopupNode");e.Dom.append(this.smallPopup,document.body);this.emit("onAfterAppendSmallPopupNode")}return this.smallPopup}static showStartPopup(t,i){this.emit("onShowStartPopup");this.startTitle=t;this.startText=i;e.Dom.addClass(this.getStartPopup(),"ui-tutor-popup-show");this.startPopup.style.display="flex";this.startTitle="";this.startText=""}static closeStartPopup(){e.Dom.remove(this.getStartPopup());delete this.startPopup}static getStartPopup(){if(!this.startPopup){this.startPopup=e.Tag.render(l||(l=n` <div class="ui-tutor-popup ui-tutor-popup-start"> <div class="ui-tutor-popup-header"> <span class="ui-tutor-popup-header-icon"></span> <span class="ui-tutor-popup-header-title-wrap"> <span class="ui-tutor-popup-header-title">${0}</span> </span> </div> <div class="ui-tutor-popup-content"> <div class="ui-tutor-popup-title">${0}</div> <div class="ui-tutor-popup-text">${0}</div> </div> <div class="ui-tutor-popup-footer"> <div class="ui-tutor-popup-btn"> ${0} ${0} </div> </div> <div class="ui-tutor-popup-icon-angle"></div> </div> `),e.Loc.getMessage("JS_UI_TUTOR_TITLE"),this.startTitle,this.startText,this.getBeginBtn(),this.getDeferBtn());this.emit("onCreateStartPopupNode");e.Dom.append(this.startPopup,document.body);this.emit("onAfterAppendStartPopupNode")}return this.startPopup}static getBeginBtn(){if(!this.beginBtn){this.beginBtn=e.Tag.render(a||(a=n` <button class="ui-btn ui-btn-primary ui-btn-round"> ${0} </button> `),e.Loc.getMessage("JS_UI_TUTOR_BTN_BEGIN"));e.Event.bind(this.beginBtn,"click",(()=>{this.emit("clickBeginBtn")}))}return this.beginBtn}static getDeferBtn(){if(!this.deferBtn){this.deferBtn=e.Tag.render(u||(u=n` <button class="ui-btn ui-btn-link"> ${0} </button> `),e.Loc.getMessage("JS_UI_TUTOR_CLOSE_POPUP_BTN"));e.Event.bind(this.deferBtn,"click",(()=>{this.emit("clickDeferBtn")}))}return this.deferBtn}static getFullEventName(t){return t}static getInformer(){if(!this.informer){this.informer=e.Tag.render(h||(h=n` <div class="ui-tutor-informer" id="ui-tutor-informer"></div> `));let t=this.getImButton();if(this.isCollapsedShow){t=this.getCollapseBlock()}if(t){e.Dom.append(this.informer,t)}}return this.informer}static setCount(t){this.emit("onBeforeSetCount");if(t<1){this.removeInformer();delete this.informer;this.isInformerShow=false}else{this.getInformer().textContent=t;this.isInformerShow=true}this.emit("onAfterSetCount")}static removeInformer(){if(this.isInformerShow){e.Dom.remove(this.getInformer())}}static showCollapsedBlock(t,i,s){i=i!==false;s=s!==false;this.emit("onBeforeShowCollapsedBlock");if(!this.isCollapsedShow){this.emit("onStartShowCollapsedBlock");if(!(t instanceof o)){t=new o(t)}this.collapsedStep=t;let i=this.getCollapseBlock();let n=function(){i.style.display="flex"};if(s){setTimeout(n.bind(this),300)}else{n.call(this)}this.getCollapseTitle().innerHTML=t.getTitle();if(this.isInformerShow){e.Dom.append(this.getInformer(),i)}this.isCollapsedShow=true;this.emit("onShowCollapsedBlock")}if(i){this.showGuide()}else{this.checkButtonsState()}}static setCollapsedInvisible(){this.hideNode(this.getCollapseBlock())}static setCollapsedVisible(){this.showNode(this.getCollapseBlock())}static checkButtonsState(){this.emit("onCheckButtonsState");let t=this.collapsedStep;if(!t){return}if(t.getCompleted()){if(this.activeGuide){this.hideNode(this.getRepeatBtn())}else{this.showNode(this.getRepeatBtn())}this.hideNode(this.getCompletedBtn());this.hideNode(this.getStartBtn())}else if(t.isActive){this.showNode(this.getCompletedBtn());if(this.activeGuide||!this.isShowRepeatWithCompleted){this.hideNode(this.getRepeatBtn())}else{this.showNode(this.getRepeatBtn())}this.hideNode(this.getStartBtn())}else{this.showNode(this.getStartBtn());this.hideNode(this.getRepeatBtn());this.hideNode(this.getCompletedBtn())}}static showGuide(){this.emit("onBeforeShowGuide");let t=this.collapsedStep;if(!this.activeGuide&&t){this.emit("onStartShowGuide");this.activeGuide=new i.Guide({simpleMode:true,steps:[t.getHighlightOptions()]});this.activeGuide.subscribe(i.Guide.getFullEventName("onFinish"),this.finishGuide.bind(this));this.activeGuide.start();e.Dom.remove(this.activeGuide.getPopup().closeIcon);this.emit("showCollapseWithGuide");this.checkButtonsState()}}static closeGuide(){if(this.activeGuide instanceof i.Guide){this.activeGuide.close();this.emit("onAfterGuide")}}static getCollapseBlock(){if(!this.layout.collapseBlock){this.layout.collapseBlock=e.Tag.render(c||(c=n` <div class="ui-tutor-popup ui-tutor-popup-collapse" onclick="${0}"> <div class="ui-tutor-popup-content"> <div class="ui-tutor-popup-step-subject">${0}</div> ${0} <div class="ui-tutor-popup-collapse-btn"> ${0} ${0} ${0} </div> </div> </div> `),this.clickCollapseBlockHandler.bind(this),e.Loc.getMessage("JS_UI_TUTOR_STEP_TITLE"),this.getCollapseTitle(),this.getStartBtn(),this.getRepeatBtn(),this.getCompletedBtn());this.emit("onCreateCollapsedBlockNode");e.Dom.append(this.layout.collapseBlock,document.body);this.emit("onAfterAppendCollapsedBlockNode")}return this.layout.collapseBlock}static getStartBtn(){if(!this.startBtn){this.startBtn=e.Tag.render(d||(d=n` <button class="ui-btn ui-btn-primary ui-btn-round ui-btn-xs"> ${0} </button> `),e.Loc.getMessage("JS_UI_TUTOR_BTN_START"));e.Event.bind(this.startBtn,"click",(t=>{t.stopPropagation();this.emit("clickStartBtn")}))}return this.startBtn}static getRepeatBtn(){if(!this.repeatBtn){this.repeatBtn=e.Tag.render(m||(m=n` <button class="ui-btn ui-btn-primary ui-btn-round ui-btn-xs"> ${0} </button> `),e.Loc.getMessage("JS_UI_TUTOR_BTN_REPEAT"));e.Event.bind(this.repeatBtn,"click",(t=>{t.stopPropagation();this.emit("clickRepeatBtn")}))}return this.repeatBtn}static getCompletedBtn(){if(!this.completedBtn){this.completedBtn=e.Tag.render(g||(g=n` <button class="ui-btn ui-btn-success ui-btn-round ui-btn-xs"> ${0} </button> `),e.Loc.getMessage("JS_UI_TUTOR_BTN_COMPLETED_SHORT"));e.Event.bind(this.completedBtn,"click",(t=>{t.stopPropagation();this.emit("clickCompletedBtn")}))}return this.completedBtn}static getCollapseTitle(){if(!this.layout.collapseTitle){this.layout.collapseTitle=e.Tag.render(f||(f=n` <div class="ui-tutor-popup-step-title"></div> `))}return this.layout.collapseTitle}static closeCollapsePopup(t){this.closeCollapseEntity();this.emit("clickCloseCollapseBlock")}static clickCollapseBlockHandler(){this.emit("clickCollapseBlock")}static finishGuide(){delete this.activeGuide;this.checkButtonsState();this.emit("completeCloseGuide")}static closeCollapseEntity(){this.emit("onBeforeHideCollapsedBlock");this.getCollapseBlock().style.display="none";this.getImButton().style.display="block";if(this.activeGuide instanceof i.Guide){this.activeGuide.close()}if(this.isInformerShow){e.Dom.append(this.getInformer(),this.getImButton())}delete this.collapsedStep;this.isCollapsedShow=false;this.emit("onHideCollapsedBlock")}static showLoader(){this.emit("onBeforeShowLoader");this.startTitle="";this.startText="";this.layout.loader=new s.Loader({target:this.getStartPopup(),size:85});this.layout.loader.show();this.getStartPopup().style.display="flex";e.Dom.addClass(this.getStartPopup(),"ui-tutor-popup-load");this.emit("onAfterShowLoader")}static hideLoader(){if(this.layout.loader){this.layout.loader.destroy();this.getStartPopup().style.display="none"}}static showCollapsedLoader(){this.emit("onBeforeShowCollapsedLoader");this.layout.collapseLoader=new s.Loader({target:this.getCollapseBlock(),size:34});this.layout.collapseLoader.show();this.getCollapseBlock().style.display="flex";e.Dom.addClass(this.getCollapseBlock(),"ui-tutor-popup-collapse-load");this.emit("onAfterShowCollapsedLoader")}static hideCollapsedLoader(){this.emit("onBeforeHideCollapsedLoader");if(this.layout.collapseLoader){this.layout.collapseLoader.destroy();e.Dom.removeClass(this.getCollapseBlock(),"ui-tutor-popup-collapse-load");this.getCollapseBlock().style.display="none"}this.emit("onAfterHideCollapsedLoader")}static showNode(t){t.style.display="block"}static hideNode(t){t.style.display="none"}static checkFollowLink(t,i){this.emit("onStartCheckFollowLink");t=t||this.collapsedStep;if(t instanceof o){i=i||{};if(!(window.location.pathname===t.getUrl())){let s="onBeforeRedirectToActionPage";if(i instanceof j){e.Dom.addClass(i.getStartBtn(),"ui-btn-wait");i.fireCurrentStepEvent(s)}else{e.Dom.addClass(this.getStartBtn(),"ui-btn-wait");this.emit(s,{step:t})}window.location=t.getUrl()}else{if(i instanceof j){i.showCollapseBlock(t)}else{t.activate();this.showCollapsedBlock(t)}}}this.emit("onFinishCheckFollowLink")}static fireEvent(t){this.emit(t)}}S.instance=null;S.scenarioInstance=null;S.activeGuide=null;S.isShowRepeatWithCompleted=true;S.layout={imButton:null,collapseBlock:null,collapseTitle:null};let v=t=>t,B,C,T,w,y,k,b,I,L,D,E,P,N,_,A,x,O,U,R,F,$,M,W,H,V,G,J,Y,X;class j extends e.Event.EventEmitter{constructor(t={}){super();this.setEventNamespace("BX.UI.Tutor.Scenario");this.stepPopup=null;this.arrowTimer=null;this.guide=null;this.loader=null;this.arrowWrap=null;this.prevArrow=null;this.nextArrow=null;this.currentStepIndex=0;this.currentStep=null;this.isAddedSteps=false;this.hasArrows=false;this.isLoading=true;this.setOptions(t);this.btn=document.getElementById("ui-tutor-btn-wrap");this.informer=document.getElementById("ui-tutor-informer");this.layout={stepBlock:null,progress:null,counter:null,counterContainer:null,title:null,description:null,collapseBlock:null,collapseTitle:null,collapseDescription:null,content:null,contentInner:null,contentBlock:null,url:null,target:null,startBtn:null,nextBtn:null,repeatBtn:null,deferBtn:null,help:null,completedBtn:null,completedBlock:null,finishedBlock:null,supportLink:null};this.sections=["settings","scenario","work"];this.loadYoutubeApiScript();this.subscribe("onYouTubeReady",(()=>{this.setVideoItems()}))}loadYoutubeApiScript(){const t=function(){this.emit("onYouTubeReady",{scenario:this})}.bind(this);if(!window.YT){let i=true;const s=document.createElement("script");s.src="https://www.youtube.com/iframe_api";const o=document.getElementsByTagName("script")[0];o.parentNode.insertBefore(s,o);let n=setInterval((function(){if(i){if(window.YT&&e.Type.isFunction(window.YT.Player)){clearInterval(n);t()}}}),200);setTimeout((function(){clearInterval(n);i=false}),2e3)}else{setTimeout(function(){t()}.bind(this),100)}}setOptions(t){this.fireCurrentStepEvent("onBeforeSetOptions",false);t=e.Type.isPlainObject(t)?t:{};let i=this.getCurrentStep();this.steps=[];if(Array.isArray(t.steps)){t.steps.forEach((t=>{this.steps.push(new o(t))}))}if(i instanceof o){let t=this.findStepById(i.getId());if(t){i=t}}else if(e.Type.isString(t.currentStepId)&&t.currentStepId.length>0){let e=this.findStepById(t.currentStepId);if(e){i=e;if(t.currentStepIsActive===true){i.activate()}}}if(!i){let t=this.getFirstUncompletedStep();if(t){i=t}}if(!i&&this.steps&&this.steps[0]){i=this.steps[0]}this.setCurrentStep(i);if(t){this.isLoading=false}this.title=t.title||"";this.supportLink=t.supportLink||"";this.isFinished=t.isFinished||false;this.fireCurrentStepEvent("onAfterSetOptions",false)}setCurrentStep(t){if(t instanceof o){this.currentStep=t;let i=this.steps;if(e.Type.isArray(i)){this.currentStepIndex=i.indexOf(t)}this.fireCurrentStepEvent("onStartStep")}}start(t){this.emit("onStart",{scenario:this});if(t){this.complexAnimation=true}this.showPopup(this.getStepPopup());this.toggleCompletedState();this.toggleNavBtn();this.setPopupData();if(this.isAddedSteps){this.hideFinalState()}if(!this.hasArrows){this.initArrows()}this.complexAnimation=false;this.fireCurrentStepEvent("onShowComplete")}findStepById(t){for(let e=0;e<this.steps.length;e++){const i=this.steps[e];if(i.getId()===t){return i}}return null}getStepPopup(){const t=()=>{this.emit("onClickOnCloseIcon",{scenario:this})};if(!this.stepPopup){this.stepPopup=e.Tag.render(B||(B=v` <div class="ui-tutor-popup ui-tutor-popup-step"> <div class="ui-tutor-popup-header"> <span class="ui-tutor-popup-header-icon"></span> <span class="ui-tutor-popup-header-title"> <span class="ui-tutor-popup-header-counter"> ${0}. ${0} </span> <span class="ui-tutor-popup-header-subtitle">${0}</span> </span> ${0} </div> <div class="ui-tutor-popup-content"> ${0} </div> <div class="ui-tutor-popup-step-wrap"> <div class="ui-tutor-popup-step-inner"> <div class="ui-tutor-popup-arrow-wrap"></div> <div class="ui-tutor-popup-step-list-wrap"> ${0} </div> </div> </div> <div class="ui-tutor-popup-icon-close" onclick="${0}"></div> <div class="ui-tutor-popup-icon-angle"></div> </div> `),e.Loc.getMessage("JS_UI_TUTOR_TITLE"),this.getCounterContainer(),this.title,this.getDeferLink(),this.getContentBlock(),this.getStepBlock(),t.bind(this));this.fireCurrentStepEvent("onCreateStepPopupNode");e.Dom.append(this.stepPopup,document.body);this.fireCurrentStepEvent("onAfterAppendStepPopupNode")}return this.stepPopup}getContentBlock(){if(!this.layout.contentBlock){this.layout.contentBlock=e.Tag.render(C||(C=v` <div class="ui-tutor-popup-content-block"> ${0} ${0} </div> `),this.getContentInner(),this.getFooter())}return this.layout.contentBlock}getFooter(){if(!this.layout.footer){this.layout.footer=e.Tag.render(T||(T=v` <div class="ui-tutor-popup-footer"> ${0} ${0} </div> `),this.getNavigation(),this.getBtnContainer());if(S.getInstance()&&S.getInstance().feedbackFormId){e.Dom.append(this.getSupportLink(),this.layout.footer)}}return this.layout.footer}getContentInner(){if(!this.layout.contentInner){this.layout.contentInner=e.Tag.render(w||(w=v` <div class="ui-tutor-popup-content-inner"> ${0} ${0} ${0} </div> `),this.getTitle(),this.getDescription(),this.getHelpBlock())}return this.layout.contentInner}getBtnContainer(){if(!this.layout.btnContainer){this.layout.btnContainer=e.Tag.render(y||(y=v` <div class="ui-tutor-popup-btn"> ${0} ${0} ${0} </div> `),this.getStartBtn(),this.getRepeatBtn(),this.getCompletedBtn())}return this.layout.btnContainer}getNavigation(){if(!this.layout.navigation){this.layout.navigation=e.Tag.render(k||(k=v` <div class="ui-tutor-popup-nav"></div> `));this.layout.backBtn=e.Tag.render(b||(b=v` <span class="ui-tutor-popup-nav-item ui-tutor-popup-nav-item-prev" onclick="${0}"></span> `),this.clickOnBackBtn.bind(this));this.layout.nextBtn=e.Tag.render(I||(I=v` <span class="ui-tutor-popup-nav-item ui-tutor-popup-nav-item-next" onclick="${0}"></span> `),this.clickOnNextBtn.bind(this));e.Dom.append(this.layout.backBtn,this.layout.navigation);e.Dom.append(this.layout.nextBtn,this.layout.navigation)}return this.layout.navigation}setInformer(t){this.setInformerCount(this.steps.length-this.getCompletedSteps())}setInformerExternal(t){this.setInformerCount(t)}setInformerCount(t){S.setCount(t)}closeStepPopup(t,e){if(!this.stepPopup){return}if(t){t.stopPropagation()}this.fireCurrentStepEvent("onCloseStepPopup");if(e){this.complexAnimation=true}this.fadeAnimation(this.getStepPopup());setTimeout(function(){this.hideNode(this.getStepPopup())}.bind(this),310);this.complexAnimation=false}getCompletedSteps(){let t=0;for(let e=0;e<this.steps.length;e+=1){if(this.steps[e].isCompleted){t+=1}}return t}setStepCounter(){this.getCounter().textContent=e.Loc.getMessage("JS_UI_TUTOR_COUNTER_NUMBER").replace("#NUMBER#",this.steps.indexOf(this.getCurrentStep())+1).replace("#NUMBER_TOTAL#",this.steps.length)}getCounterContainer(){if(!this.layout.counterContainer){this.layout.counterContainer=e.Tag.render(L||(L=v` <span class="ui-tutor-popup-header-counter-step"> ${0} </span> `),this.getCounter())}return this.layout.counterContainer}getCounter(){if(!this.layout.counter){this.layout.counter=e.Tag.render(D||(D=v` <span class="ui-tutor-popup-header-counter-number"></span> `))}return this.layout.counter}getDeferLink(){if(!this.layout.deferLink){this.layout.deferLink=e.Tag.render(E||(E=v` <span class="ui-tutor-popup-defer-link"> ${0} </span> `),e.Loc.getMessage("JS_UI_TUTOR_BTN_DEFER"));const t=new BX.PopupMenuWindow({angle:true,offsetLeft:15,className:"ui-tutor-popup-defer-menu",bindElement:this.layout.deferLink,items:[{text:e.Loc.getMessage("JS_UI_TUTOR_DEFER_MENU_HOUR"),onclick:function(){this.emit("onDeferOneHour",{scenario:this});t.close()}.bind(this)},{text:e.Loc.getMessage("JS_UI_TUTOR_DEFER_MENU_TOMORROW"),onclick:function(){this.emit("onDeferTomorrow",{scenario:this});t.close()}.bind(this)},{text:e.Loc.getMessage("JS_UI_TUTOR_DEFER_MENU_WEEK"),onclick:function(){this.emit("onDeferWeek",{scenario:this});t.close()}.bind(this)},{text:e.Loc.getMessage("JS_UI_TUTOR_DEFER_MENU_FOREVER"),onclick:function(){this.emit("onDeferForever",{scenario:this});t.close()}.bind(this)}]});e.Event.bind(this.layout.deferLink,"click",(()=>{t.show()}))}return this.layout.deferLink}getStartBtn(){if(!this.layout.startBtn){this.layout.startBtn=e.Tag.render(P||(P=v` <button class="ui-btn ui-btn-primary ui-btn-round" onclick="${0}"> ${0} </button> `),this.clickStartHandler.bind(this),e.Loc.getMessage("JS_UI_TUTOR_BTN_START"))}return this.layout.startBtn}getCompletedBtn(){if(!this.layout.completedBtn){this.layout.completedBtn=e.Tag.render(N||(N=v` <button class="ui-btn ui-btn-success ui-btn-round" onclick="${0}"> ${0} </button> `),this.showSuccessState.bind(this),e.Loc.getMessage("JS_UI_TUTOR_BTN_COMPLETED"))}return this.layout.completedBtn}getRepeatBtn(){if(!this.layout.repeatBtn){this.layout.repeatBtn=e.Tag.render(_||(_=v` <button class="ui-btn ui-btn-primary ui-btn-round" onclick="${0}"> ${0} </button> `),this.repeatStep.bind(this),e.Loc.getMessage("JS_UI_TUTOR_BTN_REPEAT"))}return this.layout.repeatBtn}getDeferBtn(){if(!this.layout.deferBtn){this.layout.deferBtn=e.Tag.render(A||(A=v` <button class="ui-btn ui-btn-link ui-btn-round" onclick="${0}"> ${0} </button> `),this.closeStepPopup.bind(this),e.Loc.getMessage("JS_UI_TUTOR_BTN_DEFER"))}return this.layout.deferBtn}getCompletedBLock(){if(!this.layout.completedBlock){this.layout.completedBlock=e.Tag.render(x||(x=v` <div class="ui-tutor-popup-completed"> <div class="ui-tutor-popup-completed-icon"></div> <div class="ui-tutor-popup-completed-text">${0}</div> </div> `),e.Loc.getMessage("JS_UI_TUTOR_STEP_COMPLETED"))}return this.layout.completedBlock}getTitle(){if(!this.layout.title){this.layout.title=e.Tag.render(O||(O=v` <div class="ui-tutor-popup-step-title"></div> `))}return this.layout.title}getDescription(){if(!this.layout.description){this.layout.description=e.Tag.render(U||(U=v` <div class="ui-tutor-popup-step-decs"></div> `))}return this.layout.description}getSupportLink(){if(!this.layout.supportLink){this.layout.supportLink=e.Tag.render(R||(R=v` <a class="ui-tutor-popup-support-link" onclick="${0}"> ${0} </a> `),this.supportLinkHandler.bind(this),e.Loc.getMessage("JS_UI_TUTOR_BTN_SUPPORT"))}return this.layout.supportLink}setInvisible(){this.hideNode(this.getStepPopup())}setVisible(){this.showNode(this.getStepPopup())}supportLinkHandler(){this.emit("supportLinkClick")}getStepBlock(){if(!this.layout.stepBlock){this.layout.stepBlock=e.Tag.render(F||(F=v` <div class="ui-tutor-popup-step-list"></div> `));this.layout.stepItems=[];for(let t=0;t<this.steps.length;t+=1){const i=e.Tag.render($||($=v` <span class="ui-tutor-popup-step-item" data-step=${0} onclick="${0}"> <span class="ui-tutor-popup-step-item-number">${0}</span> </span> `),t,this.switchStep.bind(this),t+1);this.layout.stepItems.push(i);e.Dom.append(i,this.layout.stepBlock)}this.setStepItems()}return this.layout.stepBlock}setStepItems(){if(this.layout&&this.layout.stepItems){for(let t=0;t<this.steps.length;t+=1){if(this.layout.stepItems[t]){e.Dom.removeClass(this.layout.stepItems[t],"ui-tutor-popup-step-item-current");if(t===this.currentStepIndex){e.Dom.addClass(this.layout.stepItems[t],"ui-tutor-popup-step-item-current")}if(this.steps[t].isCompleted){e.Dom.addClass(this.layout.stepItems[t],"ui-tutor-popup-step-item-completed")}}}}}getHelpBlock(){if(!this.layout.help){this.layout.help=e.Tag.render(M||(M=v` <div class="ui-tutor-popup-help"> ${0} </div> `),this.getHelpLink())}return this.layout.help}setVideoItems(){for(let t=0;t<this.steps.length;t+=1){const i=e.Tag.render(W||(W=v` <div class="ui-tutor-popup-video" data-step=${0}></div> `),t);e.Dom.prepend(i,this.getHelpBlock());if(window.YT&&e.Type.isObject(window.YT)&&e.Type.isFunction(window.YT.Player)&&this.steps[t].video!==null){const s={videoId:this.steps[t].video,events:{onReady:function(t){t.target.mute();t.target.pauseVideo();t.target.setPlaybackQuality("hd720");if(+t.target.getIframe().getAttribute("data-step")===this.currentStepIndex){e.Dom.addClass(t.target.getIframe(),"ui-tutor-popup-video-show");t.target.playVideo()}}.bind(this)},playerVars:{cc_load_policy:1,cc_lang_pref:"ru",rel:0}};this.fireCurrentStepEvent("onBeforeCreateVideo",true,{playerData:s});this.steps[t].videoObj=new YT.Player(i,s);this.fireCurrentStepEvent("onAfterCreateVideo")}}}pauseCurrentVideo(){let t=this.getCurrentStep();if(window.YT&&t instanceof o){let i=t.getVideoObj();if(e.Type.isObject(i)&&i.pauseVideo){i.pauseVideo()}}}playCurrentVideo(){let t=this.getCurrentStep();if(window.YT&&t instanceof o){let i=t.getVideoObj();if(e.Type.isObject(i)&&i.playVideo){i.playVideo()}}}getHelpLink(){if(!this.layout.link){this.layout.link=e.Tag.render(H||(H=v` <span class="ui-tutor-popup-help-link" onclick="${0}"> <span class="ui-tutor-popup-help-link-text">${0}</span> </span> `),this.handleClickLinkHandler.bind(this),e.Loc.getMessage("JS_UI_TUTOR_ARTICLE_HELP_TOPIC"))}return this.layout.link}handleClickLinkHandler(){this.emit("helpLinkClick")}showPopup(t){this.showAnimation(t);t.style.display="block"}showNode(t){t.style.display="block"}hideNode(t){t.style.display="none"}removePopup(t){e.Dom.remove(t)}clickOnNextBtn(){this.fireCurrentStepEvent("onBeforeClickNavNextBtn");if(this.getCompletedSteps()===this.steps.length&&!this.isFinished){this.isAddedSteps=false;e.Dom.remove(this.getNewStepsSection());e.Dom.removeClass(this.getFinishedBlock(),"ui-tutor-popup-finished-new");this.showFinalState();return}if(this.getCompletedSteps()===this.steps.length&&this.currentStepIndex+1===this.steps.length){this.currentStepIndex=-1}e.Dom.removeClass(this.getStartBtn(),"ui-btn-wait");this.increaseCurrentIndex();this.showStep();this.toggleNavBtn();this.fireCurrentStepEvent("onAfterClickNavNextBtn")}clickOnBackBtn(){this.fireCurrentStepEvent("onBeforeClickNavBackBtn");this.reduceCurrentIndex();this.toggleNavBtn();this.showStep();this.fireCurrentStepEvent("onAfterClickNavBackBtn")}toggleNavBtn(){e.Dom.removeClass(this.layout.backBtn,"ui-tutor-popup-nav-item-disabled");e.Dom.removeClass(this.layout.nextBtn,"ui-tutor-popup-nav-item-disabled");if(this.currentStepIndex===0){e.Dom.addClass(this.layout.backBtn,"ui-tutor-popup-nav-item-disabled")}if(this.currentStepIndex+1===this.steps.length){e.Dom.addClass(this.layout.nextBtn,"ui-tutor-popup-nav-item-disabled")}}showStep(){if(this.clickOnCompletedBtn&&this.currentStepIndex===this.steps.length){let t=this.getFirstUncompletedStep();if(t){this.setCurrentStep(t)}}this.scrollToStep();this.toggleCompletedState();this.setPopupData();this.clickOnCompletedBtn=false;this.fireCurrentStepEvent("onAfterShowStep")}switchStep(){this.fireCurrentStepEvent("onBeforeSwitchStep");this.setCurrentStep(this.steps[+window.event.target.getAttribute("data-step")]);this.fireCurrentStepEvent("onAfterSwitchStep");if(this.layout.finishedBlock){this.hideFinalState()}this.showStep();this.toggleNavBtn();this.fireCurrentStepEvent("onEndSwitchStep")}getFirstUncompletedStep(){for(let t=0;t<this.steps.length;t+=1){if(!this.steps[t].isCompleted){return this.steps[t]}}return null}toggleCompletedState(){const t=this.getCurrentStep();if(t){if(t.getCompleted()){this.showNode(this.getRepeatBtn());this.hideNode(this.getStartBtn());this.hideNode(this.getCompletedBtn())}else if(t.isActive){this.showNode(this.getCompletedBtn());this.hideNode(this.getStartBtn());this.showNode(this.getRepeatBtn())}else{this.showNode(this.getStartBtn());this.hideNode(this.getCompletedBtn());this.hideNode(this.getRepeatBtn())}}}setPopupData(){this.fireCurrentStepEvent("onBeforeSetPopupData");const t=this.getCurrentStep();if(t){this.getTitle().innerHTML=t.getTitle();this.getDescription().innerHTML=t.getDescription();S.getCollapseTitle().innerHTML=t.getTitle();if(this.getCurrentStep().getVideo()&&window.YT){this.setCurrentVideo()}this.setStepCounter();this.setStepItems()}this.fireCurrentStepEvent("onAfterSetPopupData")}setCurrentVideo(){this.fireCurrentStepEvent("onSetCurrentVideo");for(let t=0;t<this.steps.length;t+=1){let i=this.steps[t].getVideoObj();if(window.YT&&t===this.currentStepIndex&&i&&i.playVideo){e.Dom.addClass(i.getIframe(),"ui-tutor-popup-video-show");i.playVideo()}else{if(i){e.Dom.removeClass(i.getIframe(),"ui-tutor-popup-video-show");if(i.pauseVideo){i.pauseVideo()}}}}}getCurrentStep(){return this.currentStep}increaseCurrentIndex(){if(this.currentStepIndex===this.steps.length){return}this.currentStepIndex+=1;this.setCurrentStep(this.steps[this.currentStepIndex])}reduceCurrentIndex(){if(this.currentStepIndex===0){return}this.currentStepIndex-=1;this.setCurrentStep(this.steps[this.currentStepIndex])}showCollapseBlock(t,e){e=e!==false;this.closeStepPopup(null,true);S.showCollapsedBlock(t,e)}minimize(){this.pauseCurrentVideo();this.fireCurrentStepEvent("onMinimize");this.showCollapseBlock(this.getCurrentStep(),false)}repeatStep(){this.followLink()}clickStartHandler(){this.followLink()}followLink(t){let e=this.getCurrentStep();if(t instanceof o){e=t}this.pauseCurrentVideo();this.setActiveStep(e);S.checkFollowLink(e,this)}setActiveStep(t){this.fireCurrentStepEvent("onBeforeSetActiveStep");if(this.currentActiveStep instanceof o){this.currentActiveStep.deactivate()}t.activate();this.currentActiveStep=t;this.fireCurrentStepEvent("onAfterSetActiveStep")}showSuccessState(){const t=this.getCurrentStep();this.clickOnCompletedBtn=true;t.isCompleted=true;this.fireCurrentStepEvent("onFinishStep");if(t.getCompleted()){e.Dom.addClass(this.layout.stepItems[this.currentStepIndex],"ui-tutor-popup-step-item-completed")}e.Dom.addClass(this.getContentBlock(),"ui-tutor-popup-content-block-animate");setTimeout(function(){e.Dom.replace(this.getHelpBlock(),this.getCompletedBLock());this.getFooter().style.display="none";this.getDescription().style.display="none";this.getTitle().style.display="none"}.bind(this),300);setTimeout(function(){e.Dom.addClass(this.getCompletedBLock(),"ui-tutor-popup-completed-animate")}.bind(this),800);setTimeout(function(){e.Dom.replace(this.getCompletedBLock(),this.getHelpBlock());this.getTitle().style.display="block";this.getDescription().style.display="block";this.getFooter().style.display="flex";this.clickOnNextBtn()}.bind(this),1500);setTimeout(function(){e.Dom.removeClass(this.getCompletedBLock(),"ui-tutor-popup-completed-animate");e.Dom.removeClass(this.getContentBlock(),"ui-tutor-popup-content-block-animate");let t=this.stepPopup.querySelector(".ui-tutor-popup-header-counter-number");t.innerHTML=e.Loc.getMessage("JS_UI_TUTOR_COUNTER_NUMBER").replace("#NUMBER#",this.steps.indexOf(this.getCurrentStep())+1).replace("#NUMBER_TOTAL#",this.steps.length);this.fireCurrentStepEvent("onAfterShowSuccessState")}.bind(this),1700)}fireCurrentStepEvent(t,e,i){e=e!==false;const s=this.getCurrentStep();const o={step:s,scenario:this};if(i){o.extra=i}if(s&&e){s.emit(t,o)}this.emit(t,o)}showFinalState(){this.fireCurrentStepEvent("onFinalState");if(this.layout.stepItems){e.Dom.removeClass(this.layout.stepItems[this.currentStepIndex],"ui-tutor-popup-step-item-current")}e.Dom.append(this.getFinishedBlock(),this.getContentInner());e.Dom.replace(this.getStartBtn(),this.getFinishedNotice());e.Dom.remove(this.getCompletedBtn());e.Dom.remove(this.getSupportLink());e.Dom.remove(this.getNavigation());e.Dom.remove(this.getHelpBlock());e.Dom.remove(this.getRepeatBtn());e.Dom.remove(this.getTitle());e.Dom.remove(this.getDescription());e.Dom.remove(this.getDeferLink());this.isFinished=true;this.fireCurrentStepEvent("onAfterFinalState")}hideFinalState(){this.fireCurrentStepEvent("onBeforeHideFinalState");if(this.getCurrentStep().getCompleted()){e.Dom.replace(this.getFinishedNotice(),this.getRepeatBtn())}else{e.Dom.replace(this.getFinishedNotice(),this.getStartBtn())}e.Dom.replace(this.getFinishedBlock(),this.getHelpBlock());if(S.getInstance().feedbackFormId){e.Dom.append(this.getSupportLink(),this.getFooter())}e.Dom.prepend(this.getNavigation(),this.getFooter());e.Dom.prepend(this.getDescription(),this.getContentInner());e.Dom.prepend(this.getTitle(),this.getContentInner());if(this.layout.deferBtn){e.Dom.remove(this.getDeferBtn());e.Dom.prepend(this.getStartBtn(),this.getBtnContainer())}const t=this.getStepPopup().querySelector(".ui-tutor-popup-header");e.Dom.append(this.getDeferLink(),t);this.fireCurrentStepEvent("onAfterHideFinalState")}getFinishedBlock(){if(!this.layout.finishedBlock){this.layout.finishedBlock=e.Tag.render(V||(V=v` <div class="ui-tutor-popup-finished"> <div class="ui-tutor-popup-finished-title">${0}</div> <div class="ui-tutor-popup-finished-icon"></div> <div class="ui-tutor-popup-finished-text">${0}</div> </div> `),e.Loc.getMessage("JS_UI_TUTOR_FINAL_CONGRATULATIONS"),e.Loc.getMessage("JS_UI_TUTOR_FINAL_TEXT"))}return this.layout.finishedBlock}getFinishedNotice(){if(!this.layout.finishedNotice){this.layout.finishedNotice=e.Tag.render(G||(G=v` <div class="ui-tutor-popup-finished-notice">${0}</div> `),e.Loc.getMessage("JS_UI_TUTOR_FINAL_NOTICE"))}return this.layout.finishedNotice}getNewStepsSection(){if(!this.layout.newStepsSection){this.layout.newStepsSection=e.Tag.render(J||(J=v` <div class="ui-tutor-popup-new-text">${0}</div> `),e.Loc.getMessage("JS_UI_TUTOR_STEP_NEW"))}return this.layout.newStepsSection}showNewSteps(){e.Dom.addClass(this.getFinishedBlock(),"ui-tutor-popup-finished-new");this.showPopup(this.getStepPopup());this.showFinalState();e.Dom.append(this.getNewStepsSection(),this.getFinishedBlock());e.Dom.replace(this.getFinishedNotice(),S.getBeginBtn());e.Dom.append(this.getDeferBtn(),this.getBtnContainer());this.setStepCounter();this.initArrows();this.scrollToStep();this.isAddedSteps=true;this.isFinished=false}initArrows(){this.stepListWrap=document.querySelector(".ui-tutor-popup-step-list-wrap");this.arrowWrap=document.querySelector(".ui-tutor-popup-arrow-wrap");if(this.stepListWrap&&this.stepListWrap.scrollWidth>this.stepListWrap.offsetWidth){e.Dom.append(this.getPrevArrow(),this.arrowWrap);e.Dom.append(this.getNextArrow(),this.arrowWrap);this.stepListWrap.addEventListener("scroll",this.toggleArrows.bind(this));this.prevArrow.addEventListener("mouseenter",this.scrollToLeft.bind(this));this.prevArrow.addEventListener("mouseleave",this.stopAutoScroll.bind(this));this.nextArrow.addEventListener("mouseenter",this.scrollToRight.bind(this));this.nextArrow.addEventListener("mouseleave",this.stopAutoScroll.bind(this));this.toggleNextArrow();this.getStepBlock().classList.add("ui-tutor-popup-step-list-wide");this.hasArrows=true}}getPrevArrow(){if(!this.prevArrow){this.prevArrow=e.Tag.render(Y||(Y=v` <div class="ui-tutor-popup-arrow ui-tutor-popup-arrow-prev"></div> `))}return this.prevArrow}getNextArrow(){if(!this.nextArrow){this.nextArrow=e.Tag.render(X||(X=v` <div class="ui-tutor-popup-arrow ui-tutor-popup-arrow-next"></div> `))}return this.nextArrow}scrollToLeft(){this.arrowTimer=setInterval(function(){this.stepListWrap.scrollLeft-=5}.bind(this),20)}scrollToRight(){this.arrowTimer=setInterval(function(){this.stepListWrap.scrollLeft+=5}.bind(this),20)}stopAutoScroll(){clearInterval(this.arrowTimer)}toggleArrows(){this.togglePrevArrow();this.toggleNextArrow()}toggleNextArrow(){if(this.stepListWrap.scrollWidth>this.stepListWrap.offsetWidth&&this.stepListWrap.offsetWidth+this.stepListWrap.scrollLeft<this.stepListWrap.scrollWidth){e.Dom.addClass(this.nextArrow,"ui-tutor-popup-arrow-show")}else{e.Dom.removeClass(this.nextArrow,"ui-tutor-popup-arrow-show")}}togglePrevArrow(){if(this.stepListWrap.scrollLeft>0){e.Dom.addClass(this.prevArrow,"ui-tutor-popup-arrow-show")}else{e.Dom.removeClass(this.prevArrow,"ui-tutor-popup-arrow-show")}}showAnimation(t){e.Dom.removeClass(t,"ui-tutor-popup-hide-complex");e.Dom.removeClass(t,"ui-tutor-popup-hide");if(this.complexAnimation){e.Dom.addClass(t,"ui-tutor-popup-show-complex")}else{e.Dom.addClass(t,"ui-tutor-popup-show")}}fadeAnimation(t){e.Dom.removeClass(t,"ui-tutor-popup-show-complex");e.Dom.removeClass(t,"ui-tutor-popup-show");if(this.complexAnimation){e.Dom.addClass(t,"ui-tutor-popup-hide-complex")}else{e.Dom.addClass(t,"ui-tutor-popup-hide")}}scrollToStep(){let t=null;let i=null;if(this.stepListWrap){t=e.Dom.getPosition(this.stepListWrap);i=e.Dom.getPosition(this.stepListWrap.querySelector('[data-step="'+this.currentStepIndex+'"]'))}const s=7;if(!e.Type.isNull(i)&&i.left+i.width>t.left+t.width){this.stepListWrap.scrollLeft+=i.left-(t.left+t.width)+i.width+s}if(!e.Type.isNull(i)&&i.left<t.left){this.stepListWrap.scrollLeft-=t.left-i.left+s}}static getFullEventName(t){return t}static getInstance(){return S.getScenarioInstance()}static init(t){return S.initScenario(t)}}t.Scenario=j;t.Manager=S;t.Step=o})(this.BX.UI.Tutor=this.BX.UI.Tutor||{},BX,BX.UI.Tour,BX); //# sourceMappingURL=tutor.bundle.map.js