document.addEventListener("alpine:init",()=>{Alpine.data("totosgp",()=>({pesanError:"",a1:"",a2:"",a3:"",a4:"",a5:"",a6:"",additional:"",hasil:["-","-","-","-"],init(){},validNumber(a){let s=a.target.getAttribute("x-model"),t=a.target.value.match(/\d/gm);t=t?t.join(""):"",a.target.value=t,this[s]=t},clear(){this.pesanError="",this.a1="",this.a2="",this.a3="",this.a4="",this.a5="",this.a6="",this.additional="",this.hasil=["-","-","-","-"]},proses(){this.pesanError="",this.hasil=["-","-","-","-"];let a=[this.a1,this.a2,this.a3,this.a4,this.a5,this.a6].map(s=>parseInt(s));switch(!0){case this.a1=="":this.pesanError="Angka 1 tidak boleh kosong";break;case this.a2=="":this.pesanError="Angka 2 tidak boleh kosong";break;case this.a3=="":this.pesanError="Angka 3 tidak boleh kosong";break;case this.a4=="":this.pesanError="Angka 4 tidak boleh kosong";break;case this.a5=="":this.pesanError="Angka 5 tidak boleh kosong";break;case this.a6=="":this.pesanError="Angka 6 tidak boleh kosong";break;case this.additional=="":this.pesanError="Angka tambahan tidak boleh kosong";break;default:this.hasil=hitungTotoSingapore(a,parseInt(this.additional)).split("");break}}}))});