function checkForUserCountry(){""!=getUserCountry()&&setWhatsAppCountryFlag()}function getUserCountry(){var e=chatyGetCookie("cht_country_code");return e||setClientCountry(),e}function setClientCountry(){if(!chatyGetCookie("cht_country_code")){jQuery.get("https://www.cloudflare.com/cdn-cgi/trace",(function(e){if(e){var t="-",a=e.match("loc=(.*)");a.length>1&&(a=a[1])&&""==(t=a.toUpperCase())&&(t="-")}chatySetCookie("cht_country_code",t,720),setWhatsAppCountryFlag()}))}}function setWhatsAppCountryFlag(){if(jQuery("#channel_input_Whatsapp").length){cht_settings.channel_settings.Whatsapp=document.querySelector("#channel_input_Whatsapp"),cht_settings.channel_settings.Whatsapp_Country=window.intlTelInput(cht_settings.channel_settings.Whatsapp,{formatOnDisplay:!1,hiddenInput:"full_number",initialCountry:"auto",nationalMode:!1,autoHideDialCode:!1,utilsScript:cht_settings.plugin_url+"admin/assets/js/utils.js"});var e=getUserCountry();"-"!=e&&""==jQuery("#channel_input_Whatsapp").val()?setTimeout((function(){cht_settings.channel_settings.Whatsapp_Country.setCountry(e),jQuery("#channel_input_Whatsapp").trigger("keyup")}),200):""!=jQuery("#channel_input_Whatsapp").val()&&setTimeout((function(){jQuery("#channel_input_Whatsapp").trigger("keyup")}),200)}jQuery(".custom-channel-Whatsapp:not(#channel_input_Whatsapp)").length&&jQuery(".custom-channel-Whatsapp:not(#channel_input_Whatsapp)").each((function(){var e=jQuery(this).closest("li.chaty-channel").data("id");null!=e&&jQuery("#channel_input_"+e).length&&(cht_settings.channel_settings[e]=document.querySelector("#channel_input_"+e),window.intlTelInput(cht_settings.channel_settings[e],{dropdownContainer:document.body,formatOnDisplay:!0,hiddenInput:"full_number",initialCountry:"auto",nationalMode:!1,utilsScript:cht_settings.plugin_url+"admin/assets/js/utils.js"}))}))}function check_for_number_chaty(e,t){return!(""==e||("+"==e[0]&&(e=e.substr(1,e.length)),"Phone"==t&&"*"==e[0]&&(e=e.substr(1,e.length)),!isNaN(e)))}function check_for_preview_pos(){if(jQuery(".chaty-setting-form").length)if(jQuery(window).width()>1179){var e=parseInt(jQuery(".chaty-setting-form").offset().top);jQuery(".btn-save-sticky").css("top",e+58),jQuery(".btn-help, .preview-help-btn").css("top",e+58+145),jQuery("a.remove-chaty-widget-sticky").css("top",e+58+145+119)}else jQuery(".btn-save-sticky").attr("style",""),jQuery(".btn-help, .preview-help-btn").attr("style",""),jQuery("a.remove-chaty-widget-sticky").attr("style","")}jQuery((function(e){"use strict";var t=!1,a=!1,n=!1,c=!1,o=!1,i=!1,s=!1;function l(){if(e(".chaty-popup").hide(),0==e("#cht-form .js-chanel-desktop").length||0==e("#cht-form .js-chanel-mobile").length)return e("#no-device-popup").show(),!1;if(0==e("#cht-form .js-chanel-desktop:checked").length&&0==e("#cht-form .js-chanel-mobile:checked").length)return e("#device-popup").show(),!1;var t=0;return e("#channels-selected-list > li:not(#chaty-social-close)").find(".channels__input").each((function(){(""==jQuery.trim(e(this).val())||jQuery(this).hasClass("custom-channel-Whatsapp")&&-1==jQuery.trim(e(this).val()).indexOf("-"))&&t++})),t!=e("#channels-selected-list > li:not(#chaty-social-close)").find(".channels__input").length||e("#chaty-social-Contact_Us").length||e("#chaty-social-Chatway").length?u():(e("#no-device-value").show(),!1)}function r(){e.ajax({type:"POST",url:ajaxurl,data:{action:"get_chatway_status"},success:function(t){"completed"==t?(e(".chatway--notice--info").addClass("hidden"),e(".chatway--notice").addClass("hidden")):(e(".chatway--notice").removeClass("hidden"),e(".chatway--notice--info").addClass("hidden"),e(".plugin-"+t).removeClass("hidden")),"not-installed"==t||"not-activated"==t?e(".chaty-widget-tab").removeClass("chatway--active"):e(".chaty-widget-tab").addClass("chatway--active")}})}function u(){return e(".chaty-popup").hide(),e("#trigger_on_time").is(":checked")||e("#chaty_trigger_on_exit").is(":checked")||e("#chaty_trigger_on_scroll").is(":checked")?h():(e("#trigger-popup").show(),!1)}function h(){return e(".chaty-popup").hide(),e(".cht_active").is(":checked")?(t=!0,e("#cht-form").trigger("submit"),!0):(e("#status-popup").show(),!1)}function d(){if(p=!0,a){if(n){if(c){if(o){if(i)s||(s=!0,e("#channels-selected-list .phone-number").length&&e("#channels-selected-list .phone-number").each((function(){if(""!=jQuery.trim(e(this).val())&&jQuery.trim(e(this).val()).length>13)return e("#custom-message-popup .chaty-popup-header").text(e(this).data("label")+" number is not valid"),e("#custom-message-popup .chaty-popup-body").text("Seems like the "+e(this).data("label")+" number you're trying to enter isn't valid. Would you like to publish it anyway?"),e("#custom-message-popup").show(),!1})));else if(i=!0,e("#cht-form #Viber").length&&""!=e("#cht-form #Viber").val()){t=jQuery.trim(e("#cht-form #Viber").val());if(check_for_number_chaty(t,"Viber"))return e("#custom-message-popup .chaty-popup-header").text("Viber number is not valid"),e("#custom-message-popup .chaty-popup-body").text("Seems like the Viber number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?"),e("#custom-message-popup").show(),!1}}else if(o=!0,e("#cht-form #SMS").length&&""!=e("#cht-form #SMS").val()){t=jQuery.trim(e("#cht-form #SMS").val());if(check_for_number_chaty(t,"SMS"))return e("#custom-message-popup .chaty-popup-header").text("SMS number is not valid"),e("#custom-message-popup .chaty-popup-body").text("Seems like the SMS number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?"),e("#custom-message-popup").show(),!1}}else if(c=!0,e("#cht-form #Facebook_Messenger").length&&""!=e("#cht-form #Facebook_Messenger").val()){var t=jQuery.trim(e("#Facebook_Messenger").val());if(e("#cht-form #Facebook_Messenger").val(t),!/(?:http:\/\/)?facebook\.com\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-]*)/.test(t)&&!/(?:http:\/\/)?m\.me\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-]*)/.test(t))return e("#custom-message-popup .chaty-popup-header").text("Facebook page's URL is not valid"),e("#custom-message-popup .chaty-popup-body").text("Please make sure your Facebook page's URL looks like, https://m.me/YOURPAGE"),e("#custom-message-popup").show(),!1}}else if(n=!0,e("#cht-form #Phone").length&&""!=e("#cht-form #Phone").val()){var t=jQuery.trim(e("#cht-form #Phone").val());if(check_for_number_chaty(t,"Phone"))return e("#custom-message-popup .chaty-popup-header").text("Phone number is not valid"),e("#custom-message-popup .chaty-popup-body").text("Seems like the phone number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?"),e("#custom-message-popup").show(),!1}}else{a=!0;if(e("#cht-form #Whatsapp").length&&""!=e("#cht-form #Whatsapp").val()){var t=jQuery.trim(e("#cht-form #Whatsapp").val());if(check_for_number_chaty(t,"Whatsapp"))return e("#custom-message-popup .chaty-popup-header").text("Whatsapp number is not valid"),e("#custom-message-popup .chaty-popup-body").text("Seems like the WhatsApp number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?"),e("#custom-message-popup").show(),!1}}return l()}e(document).on("change",'input[name="cht_social_Chatway[chatway_position]"]:checked',(function(t){e("#chaty-social-Chatway").removeClass(["above-chaty","inside-chaty","outside-chaty"]),e("#chaty-social-Chatway").addClass(e(this).val()),change_custom_preview()})),e(window).on("load",(function(){setTimeout((()=>{e(".wp-editor-container iframe").contents().find("body").css({backgroundColor:"#fff",margin:0,padding:"0px 10px"})}),500)}));let p=!0;e(document).ready((function(){e(document).on("click",".btn-cancel.is-chatway, .icon.chat-channel-Chatway",(function(t){t.preventDefault(),e("#remove-chatway-channel").show()})),e(document).on("click",".btn-cancel.is-chatway",(function(t){t.preventDefault(),e("#remove-chatway-channel").show()})),e(document).on("click","#chatway-view-button",(function(t){let a="free";e("section").is("#pro")&&(a="pro"),e("#chatyway-info-popup .chaty-popup-inner").removeClass(["step-1","step-2","step-3"]),e("#chatyway-info-popup .chaty-popup-inner").addClass("step-3");const n=e('input[name="chatway_position"]:checked').val();if(e("#chaty_widget_url").length)return e("#chatyway-info-popup").hide(),void(window.location=e("#chaty_widget_url").val()+"&chatway_position="+n);e.ajax({type:"POST",dataType:"json",url:ajaxurl,data:{action:"choose_social",social:"Chatway",position:n,nonce_code:cht_nonce_ajax.cht_nonce,version:a,widget_index:e("#widget_index").val()},beforeSend:function(e){},success:function(t){e("#channels-selected-list").prepend(t);let a="Chatway";var n={material:{regular:{"list-icon":"","icon-style":"mt-regular",icons:["some","some2"]}}};e("#icon-picker-"+a).length&&e("#select-icon-"+a).length&&AestheticIconPicker({selector:"#icon-picker-"+a,onClick:"#select-icon-"+a,iconLibrary:n}),e("#icon-picker-agent-"+a).length&&e("#select-icon-agent-"+a).length&&AestheticIconPicker({selector:"#icon-picker-agent-"+a,onClick:"#select-icon-agent-"+a,iconLibrary:n}),e(document).trigger("chatyColorPicker/trigger",[{$scope:e("#chaty-social-Chatway"),element:".chaty-color-field"}]);const c=[];e(".channels-icons > .icon.active").each(((e,t)=>{c.push(t.dataset.social)})),wp.hooks.doAction("chaty.channel_update",{channel:c,target:"Chatway",action:"added",isExceeded:!1}),e("#chaty-chatway").hasClass("completed")&&e("#chaty-social-channel").trigger("click"),r(),change_custom_preview()}})})),document.addEventListener("visibilitychange",(function(){e("#chaty-social-Chatway").length&&"visible"===document.visibilityState&&r()})),e(".add-live-chat-btn").on("click",(function(){e("#chatyway-info-popup").hide()})),e(document).on("change",'input[name="cht_social_Chatway[chatway_icon]"]:checked',(function(){let t=e('label[for="icon-'+e(this).val()+'"] .chatway-icon').html(),a=e('input[name="cht_social_Chatway[bg_color]"]').val(),n="Chatway";e("#chaty-social-Chatway .chaty-main-svg").html(t),e("#chaty-social-Chatway .chaty-main-svg .color-element").css({fill:a}),jQuery("#cht_social_image_"+n).val(""),jQuery("#cht_social_image_src_"+n).attr("src",default_image),jQuery("#chaty_image_"+n).removeClass("icon-active").removeClass("img-active"),jQuery("#chaty_image_"+n+" .fa-icon").val(""),change_custom_preview()})),e(document).on("click","#chatway-custom-image",(function(t){t.preventDefault();let a="Chatway";var n=wp.media({title:"Upload Image",multiple:!1,library:{type:"image"}}).open().on("select",(function(t){let c=n.state().get("selection").first().toJSON();e("#cht_social_image_"+a).val(c.id),e(".custom-image-"+a+" img").attr("src",c.url),e(".chatway-custom-image img").attr("src",c.url),e("#chaty_image_"+a).addClass("img-active").removeClass("icon-active"),e("#chaty_image_"+a+" .fa-icon").val(""),e(".chatway-custom-image").addClass("img-active"),change_custom_preview(),e("#chatway-custom-image").prop("checked",!0)}))})),e(document).on("click","#chatway-remove-custom-image",(function(t){e(".chatway-custom-image").removeClass("img-active"),e("#chaty_image_Chatway").removeClass("img-active").removeClass("icon-active"),e("#chaty_image_Chatway .fa-icon").val(""),e("#cht_social_image_Chatway").val("")})),e(document).on("click",".remove--chatway",(function(t){t.preventDefault(),e("#chaty-social-Chatway").remove(),e(".chat-channel-Chatway").removeClass("active"),change_custom_preview(),e("#remove-chatway-channel").hide();const a=[];jQuery(".channels-icons > .icon.active").each(((e,t)=>{a.push(t.dataset.social)})),wp.hooks.doAction("chaty.channel_update",{channel:a,target:"Chatway",action:"removed",isExceeded:!1})})),e(document).on("change","input[name='cht_position']:checked",(function(){"custom"==e(this).val()?e("#positionPro").show():e("#positionPro").hide(),change_custom_preview()})),jQuery(".add-live-chat-btn").on("click",(function(){jQuery("#chatyway-info-popup").hide()}));var m=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))?1:0;e(document).on("change","input[name='cta_type']:checked",(function(){"simple-view"==e(this).val()?(e("#simple-view").removeClass("hide-it"),e("#chat-view").addClass("hide-it"),e(".chaty-chat-view-option").removeClass("hide-option"),e("#cta-header-color-setting").addClass("hide-it")):(e("#simple-view").addClass("hide-it"),e("#chat-view").removeClass("hide-it"),e(".chaty-chat-view-option").addClass("hide-option"),e("#cta-header-color-setting").removeClass("hide-it")),change_custom_preview()})),e(document).on("click",".add-properties",(function(t){t.preventDefault(),e(this).closest(".properties-box").toggleClass("active")})),e(document).on("click",".properties-list a",(function(t){t.preventDefault();var a=e.trim(e(this).data("txt"));if(e(this).closest(".form-horizontal__item").hasClass("has-iframe")){var n=e(this).closest(".form-horizontal__item").find("iframe");n.contents().find("p").length?n.contents().find("p:last-child").append(" "+a):n.contents().find(".mce-content-body").append(" "+a)}else a=e.trim(e.trim(e(this).closest(".form-horizontal__item").find(".add-properties").val())+" "+a),e(this).closest(".form-horizontal__item").find(".add-properties").val(a);change_custom_preview()})),e(document).on("click","#cta_woocommerce_status",(function(){e(this).is(":checked")?e(".woocommerce-settings").addClass("active"):e(".woocommerce-settings").removeClass("active")})),e(".form-fonts").SumoSelect({placeholder:"Select font family",csvDispCount:3}),e(".url-options, .url-select, .country-list").SumoSelect(),e("#chaty_attention_effect, #chaty_default_state").SumoSelect({placeholder:"Select font family",csvDispCount:3}),e(document).on("click","#chaty-social-channel",(function(){e("#current_step").val(0)})),e(document).on("click","#chaty-app-customize-widget",(function(){e("#current_step").val(1)})),e(document).on("click","#chaty-triger-targeting",(function(){e("#current_step").val(2)})),jQuery(document).on("click","#update-chaty-traffic-source-rule",(function(e){jQuery(".traffic-options-box").addClass("active"),jQuery("#chaty_traffic_source").val("yes")})),jQuery(document).on("click","#remove-traffic-rules",(function(e){jQuery(".traffic-options-box").removeClass("active"),jQuery("#chaty_traffic_source").val("no")})),jQuery(document).on("click",".remove-traffic-option",(function(e){jQuery(this).closest(".custom-traffic-rule").remove()})),e(document).on("click",".field-setting-col:not(.hide-label-setting) .field-label",(function(t){t.preventDefault(),e(this).closest(".label-flex").toggleClass("input-active")})),e(document).on("click",".chaty-switch-toggle",(function(){setTimeout((function(){e(".chaty-field-setting").each((function(){e(this).is(":checked")?(e(this).closest(".field-setting-col").find(".field-settings").addClass("active"),e(this).closest(".field-setting-col").removeClass("hide-label-setting")):(e(this).closest(".field-setting-col").find(".field-settings").removeClass("active"),e(this).closest(".field-setting-col").addClass("hide-label-setting"))}))}),100)})),e(document).on("change",".chaty-close_form_after-setting",(function(){setTimeout((function(){e(".chaty-close_form_after-setting").each((function(){e(this).is(":checked")?e(this).closest(".form-field-setting-col").find(".close_form_after-settings").addClass("active"):e(this).closest(".form-field-setting-col").find(".close_form_after-settings").removeClass("active")}))}),100)})),e(document).on("click",".agent-button-action, .add-agent-btn",(function(e){e.preventDefault(),jQuery("#agent-popup").show()})),e(document).on("keyup","#channel_input_Whatsapp",(function(){if(""!=e.trim(e(this).val())){var t=cht_settings.channel_settings.Whatsapp_Country.getSelectedCountryData(),a=e.trim(e(this).val());if("+"!=a[0]&&(a="+"+a,e(this).val(a),e(this).trigger("change")),Reflect.has(t,"dialCode")){var n=t.dialCode;if(a.length>n.length+1&&!a.includes("-")&&a.startsWith(`+${n}`)){var c=a.replace(`+${n}`,"");c=c.replaceAll(" ",""),e(this).val("+"+n+"-"+c)}}t.dialCode&&(a.length<=t.dialCode.length+1?e(this).closest(".test-btn").find(".wf-test-button").removeClass("active"):e(this).closest(".test-btn").find(".wf-test-button").addClass("active")),a.length>0&&!t.dialCode&&e(this).closest(".test-btn").find(".wf-test-button").removeClass("active"),"+"==a[0]&&1==e(this).val().length&&(e(this).closest(".channels__input-box").find(".iti__selected-flag").find(".iti__flag").attr("class","iti__flag"),e(this).closest(".channels__input-box").find(".iti__selected-flag").attr("title",""))}else""==e.trim(e(this).val())&&(e(this).closest(".channels__input-box").find(".iti__selected-flag").find(".iti__flag").attr("class","iti__flag"),e(this).closest(".channels__input-box").find(".iti__selected-flag").attr("title",""))})),e(document).on("click",".remove-zero-btn",(function(){let t=e("#channel_input_Whatsapp").val();t=t.replace(/-0+/,"-"),e("#channel_input_Whatsapp").val(t),e(".chaty-popup").hide(),p=!0,d()})),e(document).on("change",".custom-channel-Whatsapp",(function(){p=!1})),e(document).on("change",".chaty-redirect-setting",(function(){setTimeout((function(){e(".chaty-redirect-setting").each((function(){e(this).is(":checked")?e(this).closest(".form-field-setting-col").find(".redirect_action-settings").addClass("active"):e(this).closest(".form-field-setting-col").find(".redirect_action-settings").removeClass("active")}))}),100)})),e(document).on("click",".email-setting",(function(){setTimeout((function(){e(".email-setting-field").each((function(){e(this).is(":checked")?e(this).closest(".form-field-setting-col").find(".email-settings").addClass("active"):e(this).closest(".form-field-setting-col").find(".email-settings").removeClass("active")}))}),100)}));const y=[];jQuery(".channels-icons > .icon.active").each(((e,t)=>{y.push(t.dataset.social)})),wp.hooks.doAction("chaty.channel_update",{channel:y,target:null,action:"added",isExceeded:!1}),setTimeout((()=>{e(".whatsapp-welcome-message iframe").contents().find("body").css({backgroundColor:"#fff"})}),100),e(document).on("click",".chaty-embedded-window",(function(){setTimeout((function(){e(".embedded_window-checkbox").each((function(){if(e(this).is(":checked")){e(this).closest("li.chaty-channel").find(".whatsapp-welcome-message").addClass("active");e(this).closest("li.chaty-channel").find(".whatsapp-welcome-message iframe").contents().find("body").css({backgroundColor:"#fff"});var t=e(".csaas-widget").find(".csaas-cta-close").find("button").html();e("#"+(a="csaas-form-0-Whatsapp")).addClass("is-active"),e(".csaas-widget").removeClass("csaas-open"),e(".csaas").addClass("form-open"),e("#"+a).addClass("active"),e(".csaas-widget").find(".open-csaas-channel").html(t)}else{var a;e(this).closest("li.chaty-channel").find(".whatsapp-welcome-message").removeClass("active"),e("#"+(a="csaas-form-0-Whatsapp")).removeClass("is-active"),e(".csaas-widget").addClass("csaas-open"),e(".csaas").removeClass("form-open"),e("#"+a).removeClass("active")}}))}),300)})),jQuery("input[name='switchPreview']:checked").trigger("change"),e(document).on("change","#cht-form input",(function(){a=!1,n=!1,c=!1,o=!1,i=!1,s=!1})),e(document).on("click",".remove-js-script",(function(t){t.preventDefault(),e(this).closest(".channels__input-box").find("input").val(""),e(this).closest(".channels__input-box").find("input").removeClass("cht-input-error").removeClass("cht-js-error"),e(this).closest(".channels__input-box").find(".cht-error-message").remove(),e(this).remove()})),e("#cht-form").on("submit",(function(){if(t)return!0;e(this).find(".cht-input-error").removeClass("cht-input-error"),e(this).find(".cht-js-error").removeClass("cht-input-error"),e(this).find(".cht-error-message").remove(),e(this).find(".remove-js-script").remove(),set_social_channel_order();var a=0;return e("#chaty-page-options .cht-required").length&&e("#chaty-page-options .cht-required").each((function(){""==jQuery.trim(e(this).val())&&(e(this).addClass("cht-input-error"),a++)})),e(".chaty-data-and-time-rules .cht-required").length&&e(".chaty-data-and-time-rules .cht-required").each((function(){""==jQuery.trim(e(this).val())&&(e(this).addClass("cht-input-error"),a++)})),cht_nonce_ajax.has_js_access||e("#channels-selected-list .channels__input").each((function(){""!=e.trim(e(this).val())&&-1!=e.trim(e(this).val()).toLowerCase().indexOf("javascript")&&(e("body, html").scrollTop(0),e("#chaty-social-channel").trigger("click"),e(this).addClass("cht-input-error cht-js-error"),e(this).after(""+cht_nonce_ajax.js_message+""+cht_nonce_ajax.remove+""),a++)})),0==a?function(){if(p)return d();if(e(".phone-number-list").html(""),e("#channel_input_Whatsapp").length&&""!=e("#channel_input_Whatsapp").val()&&-1!=e("#channel_input_Whatsapp").val().indexOf("-0")){let t=e("#channel_input_Whatsapp").val(),a=`