/* Black Studio TinyMCE Widget */ var bstw;!function(c){bstw=function(t){var n=null;return"string"==typeof t?n=t:"object"==typeof t&&t instanceof jQuery&&(n=c("textarea[id^=widget-black-studio-tinymce][id$=text]",t.closest(bstw_data.container_selectors)).attr("id")),{activate:function(t){var i,e;return t=void 0===t||t,c("#"+n).hasClass("active")||(c("#"+n).hasClass("activating")||c("#"+n).addClass("activating"),this.is_quicktags_configured()||(tinyMCEPreInit.qtInit[n]=tinyMCEPreInit.qtInit["black-studio-tinymce-widget"],tinyMCEPreInit.qtInit[n].id=n),this.is_quicktags_active()||(e=QTags.instances,QTags.instances=[],quicktags(tinyMCEPreInit.qtInit[n]),QTags._buttonsInit(),i=QTags.instances[n],QTags.instances=e,QTags.instances[n]=i),this.is_tinymce_configured()||void 0!==tinyMCEPreInit.mceInit["black-studio-tinymce-widget"]&&(tinyMCEPreInit.mceInit[n]=tinyMCEPreInit.mceInit["black-studio-tinymce-widget"],tinyMCEPreInit.mceInit[n].selector="#"+n),this.is_tinymce_configured()&&(this.is_tinymce_active()||"visual"!==this.get_mode()||!c("#"+n).is(":visible")&&void 0===wp.blockEditor?this.is_tinymce_active()||"visual"!==this.get_mode()?c("#"+n).addClass("active").removeClass("activating"):setTimeout(function(){bstw(n).activate(t)},500):(tinyMCEPreInit.mceInit[n].setup=function(t){t.on("keyup change",function(){"visual"===bstw(n).get_mode()&&bstw(n).update_content(),c("#"+n).change()}),c("#"+n).addClass("active").removeClass("activating")},t?tinymce.init(tinyMCEPreInit.mceInit[n]):this.go()))),this},deactivate:function(){return c("#"+n).hasClass("activating")||(this.is_tinymce_active()&&tinymce.get(n).remove(),this.is_tinymce_configured()&&delete tinyMCEPreInit.mceInit[n],this.is_quicktags_active()&&(c(".quicktags-toolbar",this.get_widget_inside()).remove(),delete QTags.instances[n]),this.is_quicktags_configured()&&delete tinyMCEPreInit.qtInit[n],c("#"+n).removeClass("active")),this},update_content:function(){var t;return this.is_tinymce_configured()&&("visual"===this.get_mode()?(t=tinymce.get(n).save(),tinyMCEPreInit.mceInit[n].wpautop&&(t=window.switchEditors.pre_wpautop(t)),this.get_textarea().val(t)):this.is_tinymce_active()&&(t=this.get_textarea().val(),tinyMCEPreInit.mceInit[n].wpautop&&(t=window.switchEditors.wpautop(t)),tinymce.get(n).setContent(t))),this},go:function(t){return void 0===t&&(t=this.get_mode()),window.switchEditors.go(n,"visual"===t?"tmce":"html"),this},get_mode:function(){return c("input[id^=widget-black-studio-tinymce][id$=type]",this.get_container()).val()},set_mode:function(t){return c("input[id^=widget-black-studio-tinymce][id$=type]",this.get_container()).val(t),this},get_container:function(){return c("#"+n).closest(bstw_data.container_selectors)},get_widget:function(){return c("#"+n).closest("div.widget")},get_widget_inside:function(){return c("#"+n).closest("div.widget-inside")},get_textarea:function(){return c("#"+n)},is_tinymce_active:function(){return"object"==typeof tinymce&&"object"==typeof tinymce.get(n)&&null!==tinymce.get(n)},is_tinymce_configured:function(){return void 0!==tinyMCEPreInit.mceInit[n]},is_quicktags_active:function(){return"object"==typeof QTags.instances[n]},is_quicktags_configured:function(){return"object"==typeof tinyMCEPreInit.qtInit[n]},prepare:function(){return 1'+bstw_data.error_duplicate_id+""),this.get_widget().css("position","relative").css("z-index","100000"),c("#wpbody-content").css("overflow","visible"),this},responsive:function(){var t,i,e,n,s;return this.get_widget_inside().is(":visible")&&(t=parseInt(c("input[name=widget-width]",this.get_widget()).val(),10),i=c(window).width(),e=this.get_widget().parent().width(),n=parseInt(c("#wpcontent").css("margin-left"),10),s=!("undefined"==typeof isRtl||!isRtl),i'),c(this).closest(".widget").find(".bstw-loading").height(t).show(),bstw(c(this)).update_content()}))}),c(document).on("widget-added",function(t,i){(i.is("[id*=black-studio-tinymce]")||i.has("[id*=black-studio-tinymce]"))&&(t.preventDefault(),bstw(i).activate())}),c(document).on("widget-updated",function(t,i){i.is("[id*=black-studio-tinymce]")&&(t.preventDefault(),bstw(i).deactivate().activate())}),c(document).on("widget-synced",function(t,i){i.is("[id*=black-studio-tinymce]")&&(t.preventDefault(),"visual"===bstw(i).get_mode()&&bstw(i).update_content())}),c(document).on("click","[id^=widget-black-studio-tinymce][id$=tmce]",function(){bstw(c(this)).set_mode("visual")}),c(document).on("click","[id^=widget-black-studio-tinymce][id$=html]",function(){bstw(c(this)).set_mode("html")}),c(document).on("click.wp-editor",".wp-editor-wrap",function(){this.id&&(window.wpActiveEditor=this.id.slice(3,-5))}),c(document).on("sortstart",function(t,i){(c(i.item).is(".widget")||c(i.item).is(".customize-control"))&&(c(i.item).is(".ui-draggable")||(c(["body.wp-customizer .expanded > div[id*=black-studio-tinymce].widget",".widget-liquid-right div[id*=black-studio-tinymce].widget.open"].join(", ")).filter(":has(.widget-inside:visible)").each(function(){c(".widget-title",this).trigger("click"),bstw(c(this)).deactivate()}),i.item.is("[id*=black-studio-tinymce]")&&bstw(i.item.find("textarea[id^=widget-black-studio-tinymce]")).deactivate()))}),c(document).on("sortupdate",function(t,i){(null===t||c(i.item).is(".widget")&&!c(i.item).is(".ui-draggable"))&&(c("body").addClass("wait"),setTimeout(function(){c("textarea[id^=widget-black-studio-tinymce].active").each(function(){bstw(c(this)).deactivate()}),c("body").removeClass("wait")},1e3))}),c(document).on("click","body.wp-customizer div[id*=black-studio-tinymce].widget .move-widget-btn",function(){c("body").addClass("wait");var t=c(this);setTimeout(function(){c("textarea[id^=widget-black-studio-tinymce].active").each(function(){bstw(c(this)).deactivate()}),bstw(t).activate(),c("body").removeClass("wait")},1e3)}),"object"==typeof bstw_data.activate_events&&0