!function(e){window._wpEditor={init:function(t,i,n){var o="__wp_mce_editor__",r=e("#_wp-mce-editor-tpl").html();if(void 0===i&&(i=""),void 0!==window.tinyMCEPreInit.mceInit[o]){var a=_.clone(window.tinyMCEPreInit.mceInit[o]),d=_.clone(window.tinyMCEPreInit.qtInit[o]);a=e.extend(a,n.tinymce),d=e.extend(d,n.qtag);var c=r.replace(new RegExp(o,"g"),t),s=e(c);s.find("textarea").removeAttr("rows").removeAttr("cols"),e("#"+t).replaceWith(s),e("#"+t).val(i),$wrap=tinymce.$("#wp-"+t+"-wrap"),a.body_class=a.body_class.replace(new RegExp(o,"g"),t),a.selector=a.selector.replace(new RegExp(o,"g"),t),a.cache_suffix="",$wrap.removeClass("html-active").addClass("tmce-active"),a.init_instance_callback=function(i){"object"==typeof n&&("string"==typeof n.mod&&"html"===n.mod&&switchEditors.go(t,n.mod),"function"==typeof n.init_instance_callback&&n.init_instance_callback(i),""!==n.sync_id&&("string"==typeof n.sync_id?i.on("keyup change",function(t){var o=i.getContent({format:"raw"});o=_wpEditor.removep(o),e("#"+n.sync_id).val(o).trigger("change")}):i.on("keyup change",function(e){var t=i.getContent({format:"raw"});t=_wpEditor.removep(t),n.sync_id.val(t).trigger("change")}),e("textarea#"+t).on("keyup change",function(){var t=e(this).val();"string"==typeof n.sync_id?e("#"+n.sync_id).val(t).trigger("change"):n.sync_id.val(t).trigger("change")})))},a.plugins=a.plugins.replace("fullscreen,",""),tinyMCEPreInit.mceInit[t]=a,d.id=t,tinyMCEPreInit.qtInit[t]=d,!$wrap.hasClass("tmce-active")&&tinyMCEPreInit.qtInit.hasOwnProperty(t)||(tinymce.init(a),window.wpActiveEditor||(window.wpActiveEditor=t)),"undefined"!=typeof quicktags&&(QTags.instances[0]&&(QTags.instances[0]=!1),quicktags(d),window.wpActiveEditor||(window.wpActiveEditor=t))}},removep:function(e){return window.switchEditors._wp_Nop(e)},sync:function(){},remove:function(t){var i="",n=!1;(n=tinymce.get(t))?(i=n.getContent({format:"raw"}),i=_wpEditor.removep(i),n.remove()):i=e("#"+t).val(),e("#wp-"+t+"-wrap").length>0&&(window._wpEditorBackUp=window._wpEditorBackUp||{},void 0!==window._wpEditorBackUp[t]&&e("#wp-"+t+"-wrap").replaceWith(window._wpEditorBackUp[t])),e("#"+t).val(i)}},e.fn.wp_js_editor=function(t){return t="remove"!==t?e.extend({sync_id:"",tinymce:{},qtag:{},mod:"",init_instance_callback:function(){}},t):"remove",this.each(function(){var i=e(this);i.uniqueId();var n=i.attr("id")||"";""!==n&&("remove"!==t?(t.mod||(t.mod=i.attr("data-editor-mod")||""),window._wpEditorBackUp=window._wpEditorBackUp||{},window._wpEditorBackUp[n]=i,window._wpEditor.init(n,i.val(),t)):window._wpEditor.remove(n))})}}(jQuery),function(e,t){function i(e){({editor_added:!1,ready:function(e){var i=this;if(i.container=e,i.container.addClass("bloghash-editor-added"),i.editing_area=t("textarea",i.container),i.editing_area.hasClass("wp-editor-added"))return!1;if(i.editing_area.uniqueId(),i.editing_area.addClass("wp-editor-added"),i.editing_id=i.editing_area.attr("id")||!1,!i.editing_id)return!1;i.editor_id="wpe-for-"+i.editing_id,i.preview=t('
'),i.editing_editor=t('');var n=i.editing_area.val();t("textarea",i.editing_editor).val(n);try{i.preview.html(window.switchEditors._wp_Autop(n))}catch(e){}t("body").on("click","#customize-controls, .customize-section-back",function(e){t(e.target).is(i.preview)||(i.editing_editor.removeClass("wpe-active"),t(".wp-js-editor-preview").removeClass("wpe-focus"))}),i.container.find(".wp-js-editor").addClass("wp-js-editor-active"),i.preview.insertBefore(i.editing_area),i._init(),t(window).on("resize",function(){i._resize()})},_add_editor:function(){var e=this;this.editor_added||(this.editor_added=!0,t("body .wp-full-overlay").append(e.editing_editor),t("textarea",e.editing_editor).attr("data-editor-mod",e.editing_area.attr("data-editor-mod")||"").wp_js_editor({sync_id:e.editing_area,init_instance_callback:function(i){var n=t("#wp-"+e.editor_id+"-wrap");t(".wp-editor-tabs",n).append(''),t(".wp-editor-tabs",n).append(''),t(".wp-editor-tabs",n).append(''),n.on("click",".close-wp-editor",function(i){i.preventDefault(),e.editing_editor.removeClass("wpe-active"),t(".wp-js-editor-preview").removeClass("wpe-focus")}),t(".preview-wp-editor",n).hover(function(){n.closest(".modal-wp-js-editor").css({opacity:0})},function(){n.closest(".modal-wp-js-editor").css({opacity:1})}),n.on("click",".fullscreen-wp-editor",function(e){e.preventDefault(),n.closest(".modal-wp-js-editor").toggleClass("fullscreen"),setTimeout(function(){t(window).resize()},600)})}}))},_init:function(){var e=this;e.editing_area.on("change",function(){e.preview.html(window.switchEditors._wp_Autop(t(this).val()))}),e.preview.on("click",function(t){return e._add_editor(),e.editing_editor.toggleClass("wpe-active"),tinyMCE.get(e.editor_id).focus(),e.preview.addClass("wpe-focus"),e._resize(),!1}),e.container.on("click",".wp-js-editor-preview",function(e){e.preventDefault()})},_resize:function(){var e=t("#wp-"+this.editor_id+"-wrap"),i=e.innerHeight(),n=e.find(".mce-toolbar-grp").eq(0).height();n+=e.find(".wp-editor-tools").eq(0).height(),n+=50;var o=tinymce.get(this.editor_id);o&&(this.editing_editor.width(""),o.theme.resizeTo("100%",i-n),e.find("textarea.wp-editor-area").height(i-n))}}).ready(e)}var n={};e.bind("ready",function(e,o){if(t("#customize-theme-controls .accordion-section").each(function(){var e=t(this),o=e.attr("id")||"";o&&void 0===n[o]&&(n[o]=!0,setTimeout(function(){t(".wp-js-editor",e).length>0&&t(".wp-js-editor",e).each(function(){i(t(this))}),t(".repeatable-customize-control:not(.no-changeable) .item-editor",e).length>0&&t(".repeatable-customize-control:not(.no-changeable) .item-editor",e).each(function(){i(t(this))})},10))}),_wpCustomizeSettings.autofocus)if(_wpCustomizeSettings.autofocus.section){var r="sub-accordion-section-"+_wpCustomizeSettings.autofocus.section;n[r]=!0;var a=t("#"+r);setTimeout(function(){t(".wp-js-editor",a).length>0&&t(".wp-js-editor",a).each(function(){i(t(this))}),t(".repeatable-customize-control:not(.no-changeable) .item-editor",a).length>0&&t(".repeatable-customize-control:not(.no-changeable) .item-editor",a).each(function(){i(t(this))})},1e3)}else _wpCustomizeSettings.autofocus.panel;t("body").on("repeater-control-init-item",function(e,n){t(".item-editor",n).each(function(){i(t(this))})}),t("body").on("repeat-control-remove-item",function(e,i){t("textarea",i).each(function(){var e=t(this).attr("id")||"",i="wpe-for-"+e;try{var n=tinymce.get(i);n&&n.remove(),t("#wrap-"+i).remove(),t("#wrap-"+e).remove(),void 0!==tinyMCEPreInit.mceInit[i]&&delete tinyMCEPreInit.mceInit[i],void 0!==tinyMCEPreInit.qtInit[i]&&delete tinyMCEPreInit.qtInit[i]}catch(e){}})})})}(wp.customize,jQuery);