function isInputForAccNumber(n,t){switch(n){case 8:case 16:case 17:case 32:case 46:case 109:case 110:case 189:case 190:return!0}return n>=35&&n<=40||n>=96&&n<=105?!0:!t&&n>=48&&n<=57}function initRegForm(n){SGARegister.init($('[data-name="registercontainer"]'));SGAString.isNullOrWhitespace(n)||(SGARegister.refcode=n)}function login(n,t){if(SGACommon.lock($(n),!0,getStrRes("msg_login_to_xxx")+". "+getStrRes("msg_please_wait")+"..")){let i=function(t){SGACommon.releaseLock($(n),t)};SGALogin.login(function(){SGACommon.gotoUrl(/Contents/Scripts/htmlbody/state/loggedout/theme/robotic/t/index.html)},function(n,t){i(!0);let r=getStrRes("login");SGAString.isNullOrWhitespace(SGALogin.$username.val())?SGADialog.show(r,getStrRes("msg_please_enter_your_username"),"err","ok",null,null,function(){SGALogin.$username.focus()}):SGAString.isNullOrWhitespace(SGALogin.$password.val())?SGADialog.show(r,getStrRes("msg_please_enter_your_password"),"err","ok",null,null,function(){SGALogin.$password.focus()}):SGALogin.$captcha!==null&&SGAString.isNullOrWhitespace(SGALogin.$captcha.val())?SGADialog.show(r,getStrRes("msg_please_enter_verification_letters"),"err","ok",null,null,function(){SGALogin.$captcha.focus()}):SGACommon.isNullOrUndefined(t)?SGADialog.show(r,getStrRes("msg_invalid_username_or_password"),"err","ok",null,null,function(){$('[data-name="username"]').focus()}):SGADialog.show(r,getStrRes("msg_your_account_has_been_locked")+"

"+getStrRes("msg_please_contact_your_support_team_for_further_help"),"err","ok")},function(n){i(!n)})}}function openLoginDlg(){SGADialog.show(getStrRes("play_game"),getStrRes("msg_please_login_to_your_member_account_to_play_this_game"),"info","ok")}function openRegDlg(){SGARegister.resetForm();SGACommon.showDlg($("#dlgRegister"))}function regUser(n,t){SGARegister.register(function(){SGADlgProg.setLabel("").hideBtn().show();$(n).prop("disabled",!0)},function(){SGACommon.gotoUrl(/Contents/Scripts/htmlbody/state/loggedout/theme/robotic/t/index.html)},function(){$(n).prop("disabled",!1);SGADlgProg.hide()})}(function(n){typeof define=="function"&&define.amd?define(["jquery"],n):typeof exports=="object"?module.exports=n(require("jquery")):n(jQuery)})(function(n){function i(n){return t.raw?n:encodeURIComponent(n)}function f(n){return t.raw?n:decodeURIComponent(n)}function e(n){return i(t.json?JSON.stringify(n):String(n))}function o(n){n.indexOf('"')===0&&(n=n.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return n=decodeURIComponent(n.replace(u," ")),t.json?JSON.parse(n):n}catch(i){}}function r(i,r){var u=t.raw?i:o(i);return n.isFunction(r)?r(u):u}var u=/\+/g,t=n.cookie=function(u,o,s){var v,c;if(arguments.length>1&&!n.isFunction(o))return s=n.extend({},t.defaults,s),typeof s.expires=="number"&&(v=s.expires,c=s.expires=new Date,c.setMilliseconds(c.getMilliseconds()+v*864e5)),document.cookie=[i(u),"=",e(o),s.expires?"; expires="+s.expires.toUTCString():"",s.path?"; path="+s.path:"",s.domain?"; domain="+s.domain:"",s.secure?"; secure":""].join("");for(var l=u?undefined:{},y=document.cookie?document.cookie.split("; "):[],a=0,b=y.length;a=48&&n<=57||n>=65&&n<=90||n>=97&&n<=122||n===95;return t&&$(this).parent().removeClass("error").siblings(".errmsg").hide(),t}),t.$firstname=n.find('[data-name="firstname"]'),t.$lastname=n.find('[data-name="lastname"]'),t.$password=n.find('[data-name="password"]'),t.$passwordconfirm=n.find('[data-name="confirmpassword"]'),t.$countries=n.find('[data-name="countries"]').on("change",function(){t.updateBanks();t.updatePhoneCode()}),t.$banks=n.find('[data-name="banks"]'),t.$accname=n.find('[data-name="accname"]').bind("paste",function(){t.isChar(this)}).on("drop",function(){t.isChar(this)}).on("keyup blur",function(){$(this).val($(this).val().replace(/[^A-Za-z ]/g,""))}),t.$accnumber=n.find('[data-name="accnumber"]').bind("paste",function(){t.isNum(this)}).on("drop",function(){t.isNum(this)}).on("keypress keyup blur",function(n){$(this).val($(this).val().replace(/[^0-9]/g,""));(n.which<48||n.which>57)&&n.preventDefault()}),t.$email=n.find('[data-name="email"]'),t.$mobile=n.find('[data-name="mobile"]').bind("paste",function(){t.isNum(this)}).on("drop",function(){t.isNum(this)}).on("keydown",function(n){let t=window.event?n.keyCode:n.which,i=n.ctrlKey?n.ctrlKey:t===17?!0:!1;return t==86&&i||isInputForAccNumber(t,n.shiftKey)?!0:($(this).parent().removeClass("error").siblings(".errmsg").hide(),fnPreventDefault(n))}).off("blur").on("blur",function(){$(this).attr("placeholder",getStrRes("dyn_mobile_example")+" ("+getStrRes("mobile_number")+")")}).on("keypress keyup blur",function(n){$(this).val($(this).val().replace(/[^0-9]/g,""));(n.which<48||n.which>57)&&n.preventDefault()}),t.$mobileprefix=n.find('[data-name="mobileprefix"]'),t.$referral=n.find('[data-name="referral"]'),t.$captcha=n.find('[data-name="captcha"]').on("keypress",function(){let n=window.event?event.keyCode:event.which,t=n>=48&&n<=57;return t&&$(this).parent().removeClass("error").siblings(".errmsg").hide(),t}),t.$firstname.closest(".row").hide(),t},register:function(n,t,i){let r=SGARegister,u=getStrRes("registration");if(r.validate()){if(r.xhrRegister!==null)return E_ErrCode.showDlg(E_ErrCode.OperationBusy,u),i&&i(),!1}else return i&&i(),!1;let o=r.$banks,s=r.$accname,e=r.$accnumber,f=r.$countries,h=r.$captcha,c={UserName:r.$username.val(),FirstName:r.$firstname.val(),LastName:r.$lastname.val(),Password:r.$password.val(),CountryId:f===null||f.length===0?-1:SGANumber.tryParseInt(f.val(),-1),BankId:o.val(),AccountName:s.val().trim(),AccountNumber:e.val().trim(),Email:r.$email.val().trim(),Mobile:SGAString.isNullOrWhitespace(r.$mobile.val())?"":r.$mobileprefix.val()+r.$mobile.val().trim(),ReferralCode:r.$referral.val().trim(),Captcha:h.val(),CaptchaKey:h.data("key"),ScreenWidth:SGABrowser.getScreenWidth(),ScreenHeight:SGABrowser.getScreenHeight()};n&&n();let l=r.xhrRegister=SGAAjax.post("/Account/NewRegistration",c,null,function(n){if(l===r.xhrRegister){r.xhrRegister=null;switch(n.ErrCode){case 0:t&&t();return;case 17:SGADialog.show(u,getStrRes("msg_username_already_exists_please_select_another_username"),"err","ok");break;case 18:SGADialog.show(u,getStrRes("msg_email_already_in_use_please_enter_another_email"),"err","ok");break;case 36:SGADialog.show(u,getStrRes("msg_phone_number_already_in_use_please_enter_another_phone_number"),"err","ok");break;case 19:SGADialog.show(u,getStrRes("msg_html_internal_error_has_occurred_when_trying_to_register_your_account_please_contact_the_support_team_for_further_help_with_the_registration"),"err","ok");break;case 10:n.FieldId===1?r.$username.parent().addClass("error").focus():n.FieldId===2?r.$password.parent().addClass("error").focus():n.FieldId===3?f.parent().addClass("error").focus():n.FieldId===4?o.parent().addClass("error").focus():n.FieldId===5?s.parent().addClass("error").focus():n.FieldId===6&&e.parent().addClass("error").focus();E_ErrCode.showDlg(n.ErrCode,u);break;case 22:r.$referral.parent().addClass("error").focus();SGADialog.show(u,getStrRes("msg_invalid_referral_code"),"warn","ok");break;case 40:SGADialog.show(u,getStrRes("msg_the_verification_letters_entered_is_not_valid"),"err","ok");r.$captcha.parent().addClass("error").focus();break;case 41:SGADialog.show(u,getStrRes("msg_html_membership_level_is_not_available_for_this_website_please_contact_customer_support_team_to_report_this_problem"),"err","ok");break;case 95:e.parent().addClass("error").focus();SGADialog.show(u,getStrRes("msg_the_bank_account_is_already_registered")+"
"+getStrRes("msg_please_use_another_bank_account"),"warn","ok");break;case 133:r.$referral.parent().addClass("error").focus();SGADialog.show(u,getStrRes("msg_the_referral_code_xxx_can_be_used_for_currency_xxx_only").replace("{0}",c.ReferralCode).replace("{1}",n.Currency),"warn","ok");break;default:E_ErrCode.showDlg(n.ErrCode,u)}i&&i()}},function(n,t){if(t!=="abort"&&n===r.xhrRegister){if(r.xhrRegister=null,!E_ErrCode.showAjaxDlg(u,n))return;i&&i()}});return!0},resetForm:function(){let t=SGARegister.$ct,n=SGARegister.$referral,i=SGARegister.refcode,r=SGAString.isNullOrWhitespace;t!==null&&t.find(".error").each(function(){$(this).removeClass("error").siblings(".errmsg").hide()});n!==null&&r(n.val())&&!r(i)&&n.val(i)},updateBanks:function(n,t){let i=SGARegister,r=i.$countries,u=getStrRes("update_bank_options");if(r.val()!==""){i.xhrBank!==null&&(i.xhrBank.abort(),i.xhrBank=null);SGACommon.isNullOrUndefined(n)&&(n=function(n){var r=i.$banks,t;for(r.find("option").not(":first").remove(),t=0;t",{value:n[t].BankId,text:n[t].Name}))});let f=i.xhrBank=SGAAjax.post("/Shared/GetBanks",{CountryId:r.val()},null,function(t){if(f===i.xhrBank){if(i.xhrBank=null,t.ErrCode===0){r.val()===String(t.CountryId)&&n(t.Recs);return}E_ErrCode.showDlg(t.ErrCode,u)}},function(n,r,f){if(r!=="abort"&&n===i.xhrBank){if(i.xhrBank=null,!E_ErrCode.showAjaxDlg(u,n))return;t&&t(n,r,f)}})}},updatePhoneCode:function(n,t){let i=SGARegister,r=i.$countries,u=getStrRes("update_phone_code");if(r.val()!==""){i.xhrPhoneCode!==null&&(i.xhrPhoneCode.abort(),i.xhrPhoneCode=null);SGACommon.isNullOrUndefined(n)&&(n=function(n,t){t=SGAString.isNullOrWhitespace(t)?null:t;addStrRes("dyn_mobile_example",t);i.$mobile.attr("placeholder",t);i.$mobileprefix.val("+"+n)});var f=i.xhrPhoneCode=SGAAjax.post("/Shared/GetPhoneCode",{CountryId:r.val()},null,function(t){if(f===i.xhrPhoneCode){if(i.xhrPhoneCode=null,t.ErrCode===0){r.val()===String(t.CountryId)&&n(t.PhoneCode,t.MobilePlaceHolder);return}E_ErrCode.showDlg(t.ErrCode,u)}},function(n,r){if(r!=="abort"&&n===i.xhrPhoneCode){if(i.xhrPhoneCode=null,!E_ErrCode.showAjaxDlg(u,n))return;t&&t()}})}},validate:function(){let r=SGARegister,i=[],f=RegExp(/[)(!@#$%^&*]/),u=SGAString.isNullOrWhitespace,n=r.$username,t=n.parent();if(n.data("duplicate")||(t.removeClass("error").siblings(".errmsg").hide(),r.isValidUserName(n)||(i.push(n),t.addClass("error").siblings(".errmsg").html(n.val().trim().length<3?getStrRes("msg_username_must_between_3_and_8_characters"):getStrRes("msg_username_must_contain_only_alphabets_and_numbers")).show())),n=r.$password,t=n.parent().removeClass("error"),r.isValidPassword(n)){t.siblings(".errmsg").hide();let u=r.$passwordconfirm;t=u.parent().removeClass("error");n.val()===u.val()?t.siblings(".errmsg").hide():(i.push(u),t.addClass("error").siblings(".errmsg").html(getStrRes("msg_confirm_password_is_not_match")).show())}else i.push(n),t.addClass("error").siblings(".errmsg").html(n.val().trim().length<6?getStrRes("msg_password_must_between_6_and_12_characters"):getStrRes("msg_password_must_not_contain_spaces")).show();return n=r.$countries,t=n.parent().removeClass("error"),n.length>0&&(u(n.val())?(i.push(n),t.addClass("error").siblings(".errmsg").html(getStrRes("msg_please_select_your_country")).show()):t.siblings(".errmsg").hide()),n=r.$banks,t=n.parent().removeClass("error"),u(n.val())?(i.push(n),t.addClass("error").siblings(".errmsg").html(getStrRes("msg_please_select_your_bank")).show()):t.siblings(".errmsg").hide(),n=r.$accname,t=n.parent().removeClass("error"),u(n.val())?(i.push(n),t.addClass("error").siblings(".errmsg").html(getStrRes("msg_please_enter_your_account_name")).show()):t.siblings(".errmsg").hide(),n=r.$accnumber,t=n.parent().removeClass("error"),u(n.val())?(i.push(n),t.addClass("error").siblings(".errmsg").html(getStrRes("msg_please_enter_your_account_number")).show()):f.test(n.val())?(i.push(n),t.addClass("error").siblings(".errmsg").html(getStrRes("msg_account_numbers_must_contain_only_numbers")).show()):t.siblings(".errmsg").hide(),n=r.$email,t=n.parent().removeClass("error"),u(n.val())?CHKEMAIL&&(i.push(n),t.addClass("error").siblings(".errmsg").html(getStrRes("msg_please_enter_a_valid_email")).show()):SGAString.isValidEmail(n.val())?t.siblings(".errmsg").hide():(i.push(n),t.addClass("error").siblings(".errmsg").html(getStrRes("msg_please_enter_a_valid_email")).show()),n=r.$mobile,t=n.parent().removeClass("error"),u(n.val())?CHKPHONE&&(i.push(n),t.addClass("error").siblings(".errmsg").html(getStrRes("msg_please_enter_your_mobile_number")).show()):f.test(n.val())?(i.push(n),t.addClass("error").siblings(".errmsg").html(getStrRes("msg_mobile_numbers_must_contain_only_numbers")).show()):t.siblings(".errmsg").hide(),n=r.$captcha,SGACommon.isJQueryObject(n)&&(t=n.parent().removeClass("error"),u(n.val())?(i.push(n),t.addClass("error").closest(".input-captcha").siblings(".errmsg").html(getStrRes("msg_please_enter_verification_letters")).show()):t.siblings(".errmsg").hide()),i.length>0&&i[0].focus(),i.length===0}};$(document).ready(function(){let e=$('[data-name="logincontainer"]'),r=SGALogin.init(e),n=r.$password,t=r.$username,u=SGACommon.isJQueryObject,i=SGAString.isNullOrWhitespace,f=function(r){r===13&&(!i(t.val())&&i(n.val())?n.focus():i(t.val())&&!i(n.val())?t.focus():i(t.val())||i(n.val())||e.find("button.btn.login").trigger("click"))};if(u(t))t.on("keypress",function(n){f(n.which)});if(u(n))n.on("keypress",function(n){f(n.which)});if(u(r.$captcha))r.$captcha.on("keypress",function(n){f(n.which)});$('[data-name="playnow"]').on("click",function(){SGADialog.show(getStrRes("play_game"),getStrRes("msg_please_login_to_your_member_account_to_play_this_game"),"info","ok")});initRegForm();$(".toggle-password-desktop").on("click",function(){$(this).toggleClass("fa-eye-slash fa-eye");SGAString.isEqual($(this).prev(".form-control").attr("type"),"password")?$(this).prev(".form-control").prop("type","text"):$(this).prev(".form-control").prop("type","password")})})