jQuery(document).ready(function(e){"use strict";function i(e,i){a(i)}var t=e("body"),a=function(e){blockchain_lite_colorpicker_init(e),blockchain_lite_alpha_colorpicker_init(e),blockchain_lite_collapsible_init(e)};a(),e(document).on("widget-added",i),e(document).ajaxSuccess(function(i,t,n){if(-1!=n.data.search("action=save-widget")){var o;if(null!==(o=n.data.match(/widget-id=(ci-.*?-\d+)\b/))){var r=e("input[name='widget-id'][value='"+o[1]+"']").parent();a(r)}}}),t.on("click",".ci-collapsible legend",function(){var i=e(this).find("i");i.hasClass("dashicons-arrow-down")?(i.removeClass("dashicons-arrow-down").addClass("dashicons-arrow-right"),e(this).siblings(".elements").slideUp()):(i.removeClass("dashicons-arrow-right").addClass("dashicons-arrow-down"),e(this).siblings(".elements").slideDown())}),t.on("change",".ci-repeating-fields .posts_dropdown",function(){e(this).parent().data("value",e(this).val())}),t.on("change",':has(input.id_base[value="ci-home-post-type-items"]) .blockchain-lite-post-type-select',function(){var i=e(this).parent().parent(),t=e(this),a=t.parent().data("ajaxposts");e.ajax({type:"post",url:ThemeWidget.ajaxurl,data:{action:a,post_type_name:t.val(),name_field:t.attr("name")},dataType:"text",beforeSend:function(){i.find(".post-field").addClass("loading"),i.find(".ci-repeating-fields .posts_dropdown").prop("disabled","disabled").css("opacity","0.5")},success:function(t){var a=i.find(".ci-repeating-fields .posts_dropdown");""!=t?(a.html(t),a.each(function(){e(this).val(e(this).parent().data("value"))}),a.removeAttr("disabled").css("opacity","1")):a.html("").prop("disabled","disabled").css("opacity","0.5"),i.find(".post-field").removeClass("loading")}})})});var blockchain_lite_collapsible_init=function(e){void 0===e?(jQuery(".ci-collapsible .elements").hide(),jQuery(".ci-collapsible legend i").removeClass("dashicons-arrow-down").addClass("dashicons-arrow-right")):(jQuery(".ci-collapsible .elements",e).hide(),jQuery(".ci-collapsible legend i",e).removeClass("dashicons-arrow-down").addClass("dashicons-arrow-right"))},blockchain_lite_alpha_colorpicker_init=function(e){if(void 0===e){jQuery("#widgets-right .blockchain-lite-alpha-color-picker, #wp_inactive_widgets .blockchain-lite-alpha-color-picker").filter(function(){return!jQuery(this).parents(".field-prototype").length}).each(function(){jQuery(this).alphaColorPicker({change:_.throttle(function(){jQuery(this).trigger("change")},1e3,{leading:!1})})})}else jQuery(".blockchain-lite-alpha-color-picker",e).each(function(){jQuery(this).alphaColorPicker({change:_.throttle(function(){jQuery(this).trigger("change")},1e3,{leading:!1})})})},blockchain_lite_colorpicker_init=function(e){if(void 0===e){jQuery("#widgets-right .blockchain-lite-color-picker, #wp_inactive_widgets .blockchain-lite-color-picker").filter(function(){return!jQuery(this).parents(".field-prototype").length}).each(function(){jQuery(this).wpColorPicker({change:_.throttle(function(){jQuery(this).trigger("change")},1e3,{leading:!1})})})}else jQuery(".blockchain-lite-color-picker",e).each(function(){jQuery(this).wpColorPicker({change:_.throttle(function(){jQuery(this).trigger("change")},1e3,{leading:!1})})})};