!function(o){"use strict";var n={activeSection:null,modal:!1,init:function(){elementor.channels.editor.on("section:activated",n.onAuthSectionActivated),elementor.channels.editor.on("section:activated",n.onSearchSectionActivated),elementor.channels.editor.on("section:activated",n.onCartSectionActivated),window.elementor.on("preview:loaded",function(){(elementor.$preview[0].contentWindow.JetBlocksEditor=n).onPreviewLoaded()})},onCartSectionActivated:function(e,t){var i=t.getOption("editedElementView");"jet-blocks-cart"===i.model.get("widgetType")&&(window.JetBlocksEditor.activeSection=e,-1!==["cart_list_style","cart_list_items_style","cart_buttons_style"].indexOf(e)?i.$el.find(".jet-blocks-cart").addClass("jet-cart-hover"):i.$el.find(".jet-blocks-cart").removeClass("jet-cart-hover"))},onSearchSectionActivated:function(e,t){var i=t.getOption("editedElementView");"jet-search"===i.model.get("widgetType")&&(window.JetBlocksEditor.activeSection=e,-1!==["section_popup_style","section_popup_close_style","section_form_style"].indexOf(e)?i.$el.find(".jet-search").addClass("jet-search-popup-active"):i.$el.find(".jet-search").removeClass("jet-search-popup-active"))},onAuthSectionActivated:function(e,t){var i=t.getOption("editedElementView");if("jet-auth-links"===i.model.get("widgetType")){window.JetBlocksEditor.activeSection=e;var o=-1!==["section_logout_link","section_logout_link_style"].indexOf(e),n=-1!==["section_registered_link","section_registered_link_style"].indexOf(e);o?(i.$el.find(".jet-auth-links__logout").css("display","flex"),i.$el.find(".jet-auth-links__login").css("display","none")):(i.$el.find(".jet-auth-links__logout").css("display","none"),i.$el.find(".jet-auth-links__login").css("display","flex")),n?(i.$el.find(".jet-auth-links__registered").css("display","flex"),i.$el.find(".jet-auth-links__register").css("display","none")):(i.$el.find(".jet-auth-links__registered").css("display","none"),i.$el.find(".jet-auth-links__register").css("display","flex"))}},onPreviewLoaded:function(){window.elementor.$previewContents;o("#elementor-preview-iframe")[0].contentWindow.elementorFrontend.hooks.addAction("frontend/element_ready/jet-hamburger-panel.default",function(e){e.find(".jet-blocks__edit-cover").on("click",n.showTemplatesModal),e.find(".jet-blocks-new-template-link").on("click",function(e){window.open(o(this).attr("href"))})}),n.getModal().on("hide",function(){window.elementor.reloadPreview()})},showTemplatesModal:function(){var e=o(this).data("template-edit-link");n.showModal(e)},showModal:function(e){var t,i;n.getModal().show(),o("#jet-blocks-edit-template-modal .dialog-message").html('<iframe src="'+e+'" id="jet-blocks-edit-frame" width="100%" height="100%"></iframe>'),o("#jet-blocks-edit-template-modal .dialog-message").append('<div id="jet-blocks-loading"><div class="elementor-loader-wrapper"><div class="elementor-loader"><div class="elementor-loader-boxes"><div class="elementor-loader-box"></div><div class="elementor-loader-box"></div><div class="elementor-loader-box"></div><div class="elementor-loader-box"></div></div></div><div class="elementor-loading-title">Loading</div></div></div>'),t=o("#jet-blocks-edit-frame"),i=o("#jet-blocks-loading"),t.on("load",function(){i.fadeOut(300)})},getModal:function(){return n.modal||(this.modal=elementor.dialogsManager.createWidget("lightbox",{id:"jet-blocks-edit-template-modal",closeButton:!0,closeButtonClass:"eicon-close",hide:{onBackgroundClick:!1}})),n.modal}};o(window).on("elementor:init",n.init),window.JetBlocksEditor=n}(jQuery);