var TB_Help;((t,e,i)=>{"use strict";TB_Help={el:null,async init(){try{const s=t.isFrontend?window.top.document:window.document,a=await t.LocalFetch({action:"tb_help"},"html");s.body.appendChild(a);const r=s.tfId("tmpl-help_lightbox"),n=i("",{id:"tb_help_lightbox_root",class:"tf_abs_t tf_w tf_h tf_hide"}),l=t.ToolBar.el.getRootNode().querySelector("#tf_base");n.attachShadow({mode:"open"}).appendChild(r.content),n.shadowRoot.prepend(l.cloneNode(!0)),this.el=n.shadowRoot.tfId("lightbox"),this.el.tfOn(e.click,(t=>{const e=t.target.closest(".nav,.player_btn,.tf_close,.menu");if(e){t.preventDefault(),t.stopPropagation();const i=e.classList;e.closest(".nav")?this.mainTabs(t):i.contains("player_btn")?this.play(t):i.contains("tf_close")?this.close(t):e.closest(".menu")&&"A"===t.target.tagName&&this.tabs(t)}else t.target===t.currentTarget&&this.close(t)})),r.replaceWith(n),n.classList.remove("tf_hide"),requestAnimationFrame((()=>{this.el.style.maxHeight="100%",this.el.classList.remove("tf_opacity")}))}catch(e){await t.Spinner.showLoader("error")}t.Spinner.showLoader("spinhide")},play(t){const e=t.target.closest("a"),s=e.getAttribute("href");e.replaceWith(i("iframe",{class:"tf_h tf_w tf_abs_t",frameborder:"0",allow:"autoplay;fullscreen",src:s+"?rel=0&autoplay=1&enablejsapi=1"}))},tabs(t){const i=t.target,s=this.el.tfClass("video_wrapper")[0],a=s.querySelector(i.getAttribute("href")),r=s.tfClass("current")[0],n=i.closest("li"),l=a.tfClass("player_btn")[0];r.classList.remove("current"),a.classList.add("current"),n.parentNode.tfClass("current")[0].classList.remove("current"),n.classList.add("current"),this.stopPlay(),l?e.triggerEvent(l,t.type):this.startPlay()},execute(t,e){t.contentWindow.postMessage('{"event":"command","func":"'+e+'"}',"*")},stopPlay(){for(let t=this.el.tfClass("player"),e=t.length-1;e>-1;--e)if(!t[e].classList.contains("current")){let i=t[e].querySelector("iframe");i&&this.execute(i,"pauseVideo")}},startPlay(){const t=this.el.querySelector(".player.current ");t&&this.execute(t,"playVideo")},close(t){this.el.tfOn("transitionend",(()=>{this.el.getRootNode().host.remove(),this.el=null}),{passive:!0,once:!0}).style.maxHeight=0,this.el.classList.add("tf_opacity")},mainTabs(t){if(t.target.classList.contains("active"))return;const e=t.target.dataset.type;for(let i=t.target.parentNode.children,s=i.length-1;s>-1;--s){let t=i[s].dataset.type;this.el.classList.remove(t),i[s].classList.toggle("active",t===e)}this.el.classList.add(e)}}})(tb_app,Themify,tb_createElement);