//!wrt $BSPEC:{"icn":null,"cpr":"Copyright (C) Windows 96 Team 2023.","dsc":"","frn":"Windows 96 Credits","ver":1,"ssy":"gui"}

const{WindowParams:WindowParams}=w96,{DialogCreator:DialogCreator}=w96.ui,{escapeHtml:escapeHtml}=w96.util,people=[{avatar:"url(https://cdn.windows96.net/credits/ctrlz2.png)",name:"ctrlz",position:"PROJECT CREATOR + LEAD DEVELOPER",background:"linear-gradient(1deg, rgb(0 0 0), rgb(19, 104, 154))",socials:[{type:"twitter",url:"https://twitter.com/ctrlz40961"}]},{avatar:"url(https://cdn.ziad87.net/z-av-256.png)",name:"ziad87",position:"LEAD DEVELOPER + SYSADMIN",background:"linear-gradient(315deg, #000, #00ddfd)",socials:[{type:"github",url:"https://github.com/ziad8727"},{type:"site",url:"https://ziad87.net"}]},{avatar:"url(https://cdn.windows96.net/credits/h.gif)",name:"utf-4096",position:"LEAD DEVELOPER",background:"url(https://cdn.windows96.net/credits/utf_bg.png), #005",backgroundSize:"cover",socials:[{type:"gitlab",url:"https://git.sys36.net/utf-4096"},{type:"site",url:"https://penguins.win"}]},{avatar:"url(https://cdn.windows96.net/credits/darkok/avatar.jpg)",name:"DarkOK",position:"DEVELOPER + KFC MAN",background:"url(https://cdn.windows96.net/credits/darkok/bg.jpg), #005",backgroundSize:"cover",socials:[{type:"github",url:"https://github.com/dakrk"}]},{avatar:"url(https://cdn.windows96.net/credits/2048/avatar.gif)",name:"2048",position:"DEVELOPER + CRITTER ENJOYER",background:"#030",backgroundSize:"cover",socials:[{type:"twitter",url:"https://twitter.com/1024x2"},{type:"gitlab",url:"https://gitlab.com/1024x2"},{type:"site",url:"https://1024x2.xyz/"}]}];class CreditsUIApplication extends WApplication{constructor(){super()}main(e){super.main(e);const t=new WindowParams;t.resizable=!1,t.title="WINDOWS 96 CREDITS",t.initialWidth=500,t.initialHeight=420,t.mobResize=!0;const i=this.createWindow(t,!0);i.registerWindow(),i.setControlBoxStyle("WS_CBX_CLOSE"),i.setHtml('\n            <div class="bg" tabindex="1">\n                <div class="avatar"></div>\n                <div class="name"></div>\n                <div class="position"></div>\n                <div class="socials">\n\n                </div>\n                <div class="buttons">\n                    <button class="previous">Previous</button>\n                    <button class="next">Next</button>\n                </div>\n            </div>\n        ');const s=i.getBodyContainer();s.classList.add("credits-ui");const r=s.querySelector(".bg");r.addEventListener("keyup",(e=>{if(e.altKey&&"Enter"==e.key)r.requestFullscreen();else switch(e.key){case"R":this.showProfile(Math.floor(Math.random()*people.length));break;case"S":w96.urlopen("http://sys36.net");break;case"B":DialogCreator.alert(`CSS Code for profile:<br> ${escapeHtml(people[this.currentIndex].background)}`,{title:"Credits",icon:"info"});break;case"K":DialogCreator.alert("ALT+ENTER - Fullscreen mode.<br> SHIFT + B - Display background CSS string.<br> SHIFT + R - Random profile<br> SHIFT + S - Open sys36 site.",{title:"KEYBINDS",icon:"info"})}})),i.show(),i.center(),this.mainwnd=i,r.focus(),this.currentIndex=0;const n=s.querySelector(".previous"),a=s.querySelector(".next");n.addEventListener("click",(()=>{this.showProfile(--this.currentIndex)})),a.addEventListener("click",(()=>{this.showProfile(++this.currentIndex)})),this.showProfile()}showProfile(e=0){const t=this.mainwnd.getBodyContainer(),i=t.querySelector(".socials"),s=t.querySelector(".previous"),r=t.querySelector(".next");s.className="previous",r.className="next",i.innerHTML="",t.querySelector(".avatar").style.backgroundImage=people[e].avatar,t.querySelector(".bg").style.background=people[e].background,t.querySelector(".bg").style.backgroundSize=people[e].backgroundSize,t.querySelector(".name").innerText=people[e].name,t.querySelector(".position").innerText=people[e].position;for(let t of people[e].socials){const e=document.createElement("a");e.classList.add(t.type),e.href=t.url,i.appendChild(e)}e<1&&(s.className="previous disabled"),e+1>=people.length&&(r.className="next disabled")}}

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