(function(a){"use strict";window.define=window.define||ace.define,ace.config.set("basePath",window.aceEditorBase),ace.require("ace/ext/language_tools"),a("#global-choose-all").click(function(){a(this).prop("checked")?a(".wyp-global-group ul li .wyp-checkbox input").prop("checked",!0):a(".wyp-global-group ul li .wyp-checkbox input").prop("checked",!1)}),a("#template-choose-all").click(function(){a(this).prop("checked")?a(".wyp-template-group ul li .wyp-checkbox input").prop("checked",!0):a(".wyp-template-group ul li .wyp-checkbox input").prop("checked",!1)}),a("#single-choose-all").click(function(){a(this).prop("checked")?a(".wyp-single-group ul li .wyp-checkbox input").prop("checked",!0):a(".wyp-single-group ul li .wyp-checkbox input").prop("checked",!1)}),a("#animation-choose-all").click(function(){a(this).prop("checked")?a(".wyp-animations-code-group > ul li .wyp-checkbox input").prop("checked",!0):a(".wyp-animations-code-group > ul li .wyp-checkbox input").prop("checked",!1)}),a(".wyp-code-group li").click(function(b){if("LI"==a(b.target)[0].tagName||a(b.target).hasClass("wyp-edited-page-title")){var c=a(this);if(c.hasClass("wyp-data-deleted"))return!1;var d=c.next(".wyp-inline-css");if(c.toggleClass("active"),d.toggleClass("active"),d.next("li").toggleClass("wyp-border-top"),!1==d.hasClass("ace_editor")){var e=ace.edit(d.attr("id"));e.setTheme("ace/theme/dawn"),e.getSession().setMode("ace/mode/css"),e.getSession().setUseWorker(!1),e.setOptions({enableBasicAutocompletion:!0,enableSnippets:!1,enableLiveAutocompletion:!0}),e.setOptions({fontSize:"14px"}),e.$blockScrolling=1/0,e.setShowPrintMargin(!1),e.setReadOnly(!0)}}}),a(".wyp-button-reset").click(function(){a(this);confirm("Are you sure to want to reset defined CSS comments and all plugin options? (This action does not delete any customizations)")&&a.post(ajaxurl,{action:"wyp_delete_stylesheet_live",wyp_reset_options:!0,_wpnonce:window.wyp_live_styles_delete_nonce}).complete(function(){a("#wyp-reset-form").submit()})}),a(".wyp-delete-page-edits").click(function(){var b,c,d=a(this).parent("li"),e=a(this).parent("li").attr("data-delete-value");if(-1==e.indexOf("|")){b="Are you sure you want to delete this animation?";var c=e}else{b="Are you sure you want to delete the customization?";var c=e.split("|")[1]}("lostpassword"==c||"register"==c||"login"==c||"home"==c)&&(e="TYPE|"+c),confirm(b)&&(d.addClass("wyp-data-deleted"),-1==e.indexOf("GLOBAL|")?-1==e.indexOf("TYPE|")?-1==e.indexOf("ID|")?a.post(ajaxurl,{action:"wyp_delete_stylesheet_live",wyp_delete_animate:c,_wpnonce:window.wyp_live_styles_delete_nonce}).complete(function(){d.css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),d.next().css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),setTimeout(function(){d.next().remove(),d.remove()},600)}):a.post(ajaxurl,{action:"wyp_delete_stylesheet_live",wyp_reset_id:c,_wpnonce:window.wyp_live_styles_delete_nonce}).complete(function(){0==a(".wyp-single-group li:not(.wyp-data-deleted)").length&&a(".wyp-single-group").fadeOut("slow"),d.css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),d.next().css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),setTimeout(function(){d.next().remove(),d.remove()},600)}):a.post(ajaxurl,{action:"wyp_delete_stylesheet_live",wyp_reset_type:c,_wpnonce:window.wyp_live_styles_delete_nonce}).complete(function(){0==a(".wyp-template-group li:not(.wyp-data-deleted)").length&&a(".wyp-template-group").fadeOut("slow"),d.css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),d.next().css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),setTimeout(function(){d.next().remove(),d.remove()},600)}):a.post(ajaxurl,{action:"wyp_delete_stylesheet_live",wyp_reset_global:c,_wpnonce:window.wyp_live_styles_delete_nonce}).complete(function(){0==a(".wyp-global-group li:not(.wyp-data-deleted)").length&&a(".wyp-global-group").fadeOut("slow"),d.css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),d.next().css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),setTimeout(function(){d.next().remove(),d.remove()},600)}),0==a(".wyp-code-group ul li:not(.wyp-data-deleted)").length&&(a(".wyp-tab-section").hide(),a(".wyp-no-code,.wyp-no-animation").fadeIn(300)))}),a(".wyp-disable-license").click(function(){var b=a(this),c=b.attr("data-href"),d=b.attr("data-site"),e=b.attr("data-code");b.addClass("wyp-deactivating"),b.text("Processing..."),a.get("https://waspthemes.com/yellow-pencil/auto-update/",{action:"deactivate",site:d,purchase_code:e}).fail(function(){alert("Something went wrong. Please try again.")}).success(function(){window.location.href=c})})})(jQuery);