import { makeAutoObservable } from "mobx"; class DebugLabelsState { public labels = new Map>(); constructor() { makeAutoObservable(this); } public getAll(objectId: string): Record { return this.labels.get(objectId) ?? {}; } public getOne(objectId: string, key: string): string | undefined { return this.getAll(objectId)[key]; } public setOne(objectId: string, key: string, text: string) { if (!this.labels.has(objectId)) this.labels.set(objectId, {}); this.labels.get(objectId)![key] = text; } public deleteAll(objectId: string) { this.labels.delete(objectId); } public deleteOne(objectId: string, key: string) { if (this.labels.has(objectId)) { delete (this.labels.get(objectId)![key]); } } public clear() { this.labels.clear(); } } export const debugLabelsStore = new DebugLabelsState();