//!wrt $BSPEC:{"icn":"apps/logon","cpr":"Copyright (C) Windows 96 Team 2023.","dsc":"Login Program for Windows 96","frn":"logon","ver":1,"ssy":"gui"}

const{requiresCredentials:requiresCredentials,WinLogon:WinLogon,askSetPassword:askSetPassword,setSAMPath:setSAMPath,klog:klog,coverUtil:coverUtil}=current.boxedEnv,{WindowSystem:WindowSystem}=w96;class LoginApplication extends WApplication{constructor(){super()}async main(e){await super.main(e);const t=document.createElement("div");if(t.style.backgroundColor="rgb(0, 128, 128)",t.style.width="100vw",t.style.height="100vh",t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.zIndex="8",t.style.overflow="hidden",t.classList.add("w96-predesk-ui"),setSAMPath("c:/system/config/SAM.json"),await requiresCredentials()){klog.println("[desktop] Preparing log on system..."),document.body.appendChild(t),WindowSystem.setWindowContainer(t),await coverUtil.hideCover();if(!await WinLogon.displayLogonUIAsync())return void klog.error("Auth error -- refusing to boot.");await coverUtil.showCover(),t.remove()}w96.evt.sys.emit("logon"),this.terminate()}}

return await WApplication.execAsync(new LoginApplication(), this.boxedEnv.args, this);