!function(e,t,a){"use strict";a(document).ready((function(){var n;!function(){if(window.alpha_admin_vars&&alpha_admin_vars.page_links)for(const t in alpha_admin_vars.page_links)alpha_admin_vars.page_links[t].is_panel?e.panel(t)&&e.panel(t).expanded.bind((function(a){a&&alpha_admin_vars.page_links[t].url&&alpha_admin_vars.page_links[t].url!=e.previewer.previewUrl()&&e.previewer.previewUrl.set(alpha_admin_vars.page_links[t].url)})):e.section(t)&&e.section(t).expanded.bind((function(a){a&&alpha_admin_vars.page_links[t].url&&alpha_admin_vars.page_links[t].url!=e.previewer.previewUrl()&&e.previewer.previewUrl.set(alpha_admin_vars.page_links[t].url)}))}(),function(){function e(){var e=a("#customize-control-cs_menu_labels #label-select").children("option"),t={};e.length&&e.map((function(){t[a(this).text()]=a(this).val()}));var n=window.top.document.querySelector("#customize-control-menu_labels input"),o=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set;"{}"==JSON.stringify(t)?o.call(n,""):o.call(n,JSON.stringify(t));var i=new Event("input",{bubbles:!0});n.dispatchEvent(i)}a(document.body).on("click","#customize-control-cs_new_menu_label .btn-add-label",(function(t){t.preventDefault();var n=function(){var e=a("#customize-control-menu_labels input").val();return e?JSON.parse(e):{}}(),o=a("#customize-control-cs_new_menu_label .label-text").val(),i=a("#customize-control-cs_new_menu_label .alpha-color-picker").val();o&&i?null!=n[o]?alert("This label already exists. Please add another one."):(a("#customize-control-cs_menu_labels select").children().prop("selected",!1),a("#customize-control-cs_menu_labels select").append('"),e(),a("#customize-control-cs_new_menu_label .label-text, #customize-control-cs_new_menu_label .alpha-color-picker").val(""),a("#customize-control-cs_new_menu_label .wp-color-result").css("background-color",""),a("#customize-control-cs_menu_labels #label-select").trigger("change")):alert("Please input label text and label color")})).on("click","#customize-control-cs_menu_labels .btn-change-label",(function(t){t.preventDefault();var n=a("#customize-control-cs_menu_labels .menu-label .label-text").val(),o=a("#customize-control-cs_menu_labels .menu-label .alpha-color-picker").val();n&&o&&(a("#customize-control-cs_menu_labels select option:selected").val(o).text(n),e())})).on("click","#customize-control-cs_menu_labels .btn-remove-label",(function(t){t.preventDefault();var n=a("#customize-control-cs_menu_labels select option:selected").text(),o=a("#customize-control-cs_menu_labels select option:selected").val();n&&o&&(a("#customize-control-cs_menu_labels select option[value="+o+"]").remove(),e(),a("#customize-control-cs_menu_labels select option").eq(0).prop("selected",!0),a("#customize-control-cs_menu_labels #label-select").trigger("change"))})).on("change","#customize-control-cs_menu_labels #label-select",(function(e){e.preventDefault(),a("#customize-control-cs_menu_labels .label-text").val(a(this).find("option:selected").text()),a("#customize-control-cs_menu_labels .alpha-color-picker").val(a(this).val()),a("#customize-control-cs_menu_labels .wp-color-result").css("background-color",a(this).val())}))}(),a(document.body).on("input","#customize-control-import_src input, #customize-control-export_src input",(function(e){a(this).closest("li").next().find("button").attr("disabled",!a(this).val())})).on("click","#alpha-import-options",(function(e){if(e.preventDefault(),a("#customize-control-import_src input").val()){if(confirm("Are you sure to import another theme options? All current options will be overwritten.")){var t=a(this);a(this).attr("disabled","disabled");var n=new FormData;n.append("wp_customize","on"),n.append("action","alpha_import_theme_options"),n.append("nonce",alpha_customizer_vars.nonce),n.append("file",a("#customize-control-import_src input")[0].files[0]),a.ajax({url:alpha_customizer_vars.ajax_url,data:n,type:"post",contentType:!1,processData:!1,success:function(e){t.removeAttr("disabled"),alert("Theme options imported seccessfully."),window.location.reload()}}).fail((function(e){alert("Something went wrong while importing theme options."),console.log(e)}))}}else alert("Please input source file pathname.")})).on("click","#alpha-reset-options",(function(e){e.preventDefault(),confirm("Are you sure to reset all theme options?")&&(a(this).attr("disabled","disabled"),a.ajax({url:alpha_customizer_vars.ajax_url,data:{wp_customize:"on",action:"alpha_reset_theme_options",nonce:alpha_customizer_vars.nonce},type:"post",success:function(e){window.location.reload()}}).fail((function(e){console.log(e)})))})),a(".customize-pane-child .accordion-section-title .panel-title").add(".customize-pane-child .customize-section-title h3").append(''),a(".customizer-nav-item").each((function(){a("#sub-accordion-"+("section"==a(this).data("type")?"section":"panel")+"-"+a(this).data("target")+" .section-nav-status").addClass("active")})),a(document.body).on("click",".navigator-toggle",(function(e){e.preventDefault(),a(this).closest(".customizer-nav").toggleClass("active")})).on("click",".customizer-nav-item",(function(t){t.preventDefault(),e[a(this).data("type")](a(this).data("target")).focus()})).on("click",".section-nav-status",(function(t){var n=a(this);if(t.preventDefault(),!n.hasClass("disabled")){var o=n.closest(".customize-pane-child"),i="",c="",s="";if(o.hasClass("control-panel")?(c=o[0].id.replace("sub-accordion-panel-",""),s="panel"):(c=o[0].id.replace("sub-accordion-section-",""),s="section"),n.addClass("disabled").toggleClass("active"),n.hasClass("active")){if(n.closest(".customize-section-title").length){var l=n.closest(".customize-section-title"),r=l.find(".customize-action").text(),u=l.find("h3").text().replace(r,""),d=r.indexOf("▸");r=-1!=d?r.slice(d+1):""}else r="",u=n.closest(".panel-title").text();r&&(r+=" / "),i=r+u,a(".customizer-nav-items").append('
  • '+i+'
  • ')}else a('.customizer-nav-items .customizer-nav-item[data-target="'+c+'"]').parent().fadeOut(200).addClass("hidden");n.removeClass("disabled"),e.state("saved").get()&&e.state("saved").set(!1)}})).on("click",".customizer-nav-remove",(function(t){t.preventDefault();var n=a(this).closest("li"),o=n.children(".customizer-nav-item");n.fadeOut(200).addClass("hidden"),a("#sub-accordion-"+("section"==o.data("type")?"section":"panel")+"-"+o.data("target")+" .section-nav-status").removeClass("active"),e.state("saved").get()&&e.state("saved").set(!1)})),a("#customize-save-button-wrapper .save").on("click",(function(){var e={nav:{}};a(".customizer-nav-items li:not(.hidden) .customizer-nav-item").each((function(){e.nav[a(this).data("target")]=[a(this).text(),a(this).data("type")]})),setTimeout((function(){a.ajax({url:alpha_customizer_vars.ajax_url,data:{wp_customize:"on",action:"alpha_save_custom_options",nonce:alpha_customizer_vars.nonce,options:e},type:"post",dataType:"json",success:function(e){}})}),1e3)})),function(){var e=location.href,a=e.search("#");if(0",{class:"customize-controls-home dashicons dashicons-admin-home",html:'Home'}),a("#customize-header-actions").append(n),n.on("click",(function(){e.section.each((function(e){e.expanded()&&e.collapse()})),setTimeout((function(){e.panel.each((function(e){e.expanded()&&e.collapse()}))}),100)})),a("input.alpha-color-picker").wpColorPicker()})),e&&e.controlConstructor&&e.controlConstructor["kirki-background"]&&(e.controlConstructor["kirki-background"]=e.controlConstructor["kirki-background"].extend({initKirkiControl:function(){var e=this,a=e.setting._value,n=e.container.find(".kirki-color-control");_.isUndefined(a["background-image"])&&(e.setting._value={"background-attachment":"","background-color":"","background-image":"","background-position":"","background-repeat":"","background-size":""}),(_.isUndefined(a["background-image"])||""===a["background-image"])&&(e.container.find(".background-wrapper > .background-repeat").hide(),e.container.find(".background-wrapper > .background-position").hide(),e.container.find(".background-wrapper > .background-size").hide(),e.container.find(".background-wrapper > .background-attachment").hide()),_.isUndefined(e.params.choices)||n.wpColorPicker(e.params.choices),setTimeout((function(){e.container.find(".wp-picker-clear").on("click",(function(){e.saveValue("background-color","")}))}),200),n.wpColorPicker({change:function(){setTimeout((function(){e.saveValue("background-color",n.val())}),100)}}),e.container.on("change",".background-repeat select",(function(){e.saveValue("background-repeat",jQuery(this).val())})).on("change click",".background-size input",(function(){e.saveValue("background-size",jQuery(this).val())})).on("change",".background-position select",(function(){e.saveValue("background-position",jQuery(this).val())})).on("change click",".background-attachment input",(function(){e.saveValue("background-attachment",jQuery(this).val())})).on("click",".background-image-upload-button",(function(a){var n=t.media({multiple:!1}).open().on("select",(function(){var t,a,o,i=n.state().get("selection").first(),c=i.toJSON().sizes.full.url;_.isUndefined(i.toJSON().sizes.medium)?_.isUndefined(i.toJSON().sizes.thumbnail)||(c=i.toJSON().sizes.thumbnail.url):c=i.toJSON().sizes.medium.url,t=i.toJSON().sizes.full.url,i.toJSON().id,i.toJSON().width,i.toJSON().height,""!==t&&e.container.find(".background-wrapper > .background-repeat, .background-wrapper > .background-position, .background-wrapper > .background-size, .background-wrapper > .background-attachment").show(),e.saveValue("background-image",t),a=e.container.find(".placeholder, .thumbnail"),o=e.container.find(".background-image-upload-remove-button"),a.length&&a.removeClass().addClass("thumbnail thumbnail-image").html(''),o.length&&o.show()}));a.preventDefault()})).on("click",".background-image-upload-remove-button",(function(t){var a=e.container.find(".placeholder, .thumbnail"),n=e.container.find(".background-image-upload-remove-button");t.preventDefault(),e.saveValue("background-image",""),e.container.find(".background-wrapper > .background-repeat").hide(),e.container.find(".background-wrapper > .background-position").hide(),e.container.find(".background-wrapper > .background-size").hide(),e.container.find(".background-wrapper > .background-attachment").hide(),a.length&&a.removeClass().addClass("placeholder").html("No file selected"),n.length&&n.hide()}))}}))}(wp.customize,wp,jQuery);