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