var callback=[],mySettinPage={uiSettings:{},load:function(){mySettinPage.addEvents()},addEvents:function(){$(document).on("submit","#user-contact-form",(function(e){e.preventDefault();var t=$(this).closest("form");t.find(".error-msg").html("").closest(".f-form-input-group").removeClass("has-error");var n=showLoading();$.ajax({type:"POST",dataType:"JSON",processData:!1,contentType:!1,url:t.attr("action"),data:new FormData(t[0]),success:function(e){if(loadingOut(n),1==e.success)Swal({type:"success",title:"Requested!",html:e.message,showCancelButton:!1,showConfirmButton:!0,confirmButtonText:"OK",timer:3e3}),$("#user-contact-form").trigger("reset");else if(0==e.success){e.error;for(var o in e.error_info){var a=e.error_info[o];t.find("#"+o).next(".error-msg").html(a),t.find("#"+o).focus(),t.find("#"+o).addClass("has-error")}e&&null!=e.message&&Swal({type:"error",title:"Oops!...",text:e.message,showCancelButton:!1,showConfirmButton:!1,timer:5e3})}},error:function(e){loadingOut(n),Swal({type:"error",title:"Oops!...",text:"Something went wrong! Please try again later",showCancelButton:!1,showConfirmButton:!1,timer:5e3})}})}))}};function sendMessage(e,t){null!=t&&(callback.push(t),e.callback="yes"),chrome.runtime.sendMessage(e,t)}function handleMessage(e,t){if(e.command,void 0!==e.data&&void 0!==e.callback&&"yes"==e.callback)callback.pop()}function getSettings(e){return new Promise((async(e,t)=>{const n=await chrome.storage.local.get("uiSettings");e({uiSettings:JSON.parse(n.uiSettings)})}))}window.addEventListener("load",(function(){chrome.runtime.onMessage.addListener(handleMessage),mySettinPage.load()}));