I've been trying for quite some time and I don't think it's possible to fit it in a single tweet :(
Maybe someone will be able to 🤔
<script>
let t,d,o,q=1,w=2,r=3,a=[{k:1,l:0,s:q}],s=(a,q)=>a.filter(x=>x.s==q),u=(z,n)=>a[a.findIndex(h=>h.k==z)].s=n
$:{t=s(a,q),d=s(a,w),o=s(a,r)}
</script>