!function(t){function e(e,i,n){var a=!0;if("string"==typeof i){":radio"==i.substr(0,6)&&(i+=":checked");for(var n=n.split(","),o=0;o"),t(this).parent().children("span").replaceWith(""+e+"")};if(t(".plugin-option .select_wrapper select").not(".chosen").each(i).change(i),t(".plugin-option .select_wrapper").click(function(e){e.stopPropagation(),t(this).find("select[multiple]").not(".chosen").toggle()}),t(".plugin-option .select_wrapper select[multiple]").not(".chosen").click(function(t){t.stopPropagation()}),t(window).click(function(){t(".plugin-option .select_wrapper select[multiple]").not(".chosen").hide()}),t(".plugin-option .chosen .select_wrapper select").chosen(),t(".plugin-option .onoff_container span").on("click",function(){var e=t(this).prev("input"),i=e.prop("checked");i?e.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):e.prop("checked",!0).attr("value","yes").addClass("onoffchecked"),e.change()}),t(".plugin-option .panel-colorpicker").wpColorPicker({onInit:function(){},change:function(t,e){},clear:function(){var e=t(this);e.val(e.data("default-color")),e.change()}}),t(".plugin-option .slider_container .ui-slider-horizontal").each(function(){var e=t(this).data("val"),i=t(this).data("min"),n=t(this).data("max"),a=t(this).data("step"),o=t(this).data("labels");t(this).slider({value:e,min:i,max:n,range:"min",step:a,slide:function(e,i){t(this).find("input").val(i.value),t(this).siblings(".feedback").find("strong").text(i.value+o)}})}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media){var n=!0;wp.media.editor.send.attachment;t(".plugin-option .upload_img_url").change(function(){var e=t(this).val(),i=new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico)"),n=t(this).parents().siblings(".upload_img_preview");i.test(e)?n.html(''):n.html("")}).trigger("change"),t(document).on("click",".plugin-option .upload_button",function(e){e.preventDefault();var i,n=t(this),a=n.attr("id").replace(/-button$/,"");if(i)return void i.open();var o=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];i=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:o}),i.on("select",function(){var e=i.state().get("selection").first().toJSON();t("#"+a).val(e.url),t("#"+a+"-yith-attachment-id")&&t("#"+a+"-yith-attachment-id").val(e.id),t(".plugin-option .upload_img_url").trigger("change")}),i.open()}),t(document).on("click",".plugin-option .upload_button_reset",function(e){var i=t(this),n=i.attr("id"),a=i.attr("id").replace(/-button_reset$/,""),o=t("#"+n).data("default");t("#"+a).val(o),t(".plugin-option .upload_img_url").trigger("change")})}t(".plugin-option .add_media").on("click",function(){n=!1}),t("[data-field]").each(function(){var i=t(this),n="#"+i.data("field"),a="#"+i.data("dep"),o=i.data("value");t(a).on("change",function(){e(n,a,o.toString())}).change()}),t(".rm_connectedlist").each(function(){var e=t(this).find("ul"),i=t(this).find(":hidden");e.sortable({connectWith:e,update:function(n,a){var o={};e.each(function(){var e={};t(this).children().each(function(){e[t(this).data("option")]=t(this).text()}),o[t(this).data("list")]=e}),i.val(JSON.stringify(o).replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()}),t(document).ready(function(){t(".yith-video-link").click(function(e){e.preventDefault();var i=t(this).data("video-id");t("."+i).dialog({dialogClass:"wp-dialog yit-dialog yit-video-dialog",modal:!0,closeOnEscape:!0,width:"auto",resizable:!1,draggable:!1,create:function(e,i){t(this).css("maxWidth","853px")},open:function(e,i){t(".ui-widget-overlay").bind("click",function(){t(this).siblings(".ui-dialog").find(".ui-dialog-content").dialog("close")})}}),t(".ui-dialog :button").blur()})}),t(document).ready(function(){t(".codemirror").each(function(e,i){var n=CodeMirror.fromTextArea(i,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});t(i).data("codemirrorInstance",n)})}),t(document).ready(function(){t(".google-analytic-generate").click(function(){var e=t("#"+t(this).data("textarea")).data("codemirrorInstance"),i=t("#"+t(this).data("input")).val(),n=t(this).data("basename"),a="(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n";a+="(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\n",a+="m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n",a+="})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n",a+="ga('create', '"+i+"', '"+n+"');\n",a+="ga('send', 'pageview');\n",e.replaceRange(a,e.getCursor("start"),e.getCursor("end"))})})}(jQuery);