import { SvelteMap } from 'svelte/reactivity'; export class User { static equal(a, b) { return a.id === b.id && a.name === b.name; } static boot({ id, name }) { return new User(id, name); } constructor(id, name) { this.id = id; this.name = name; } } export class Users { all = $state(); static boot(users) { const all = new SvelteMap(users.map((user) => [user.id, User.boot(user)])); return new Users({ all }); } constructor({ all }) { this.all = all; } add({ id, name }) { this.all.set(id, new User(id, name)); } }