export class PlayModeBridge {
    adapter;
    snapshot;
    constructor(adapter) {
        this.adapter = adapter;
    }
    enter() {
        if (this.snapshot !== undefined) {
            throw new Error("Play mode is already active");
        }
        this.snapshot = this.adapter.capture();
    }
    exit({ restore = true } = {}) {
        if (this.snapshot === undefined) {
            return;
        }
        if (restore) {
            this.adapter.restore(this.snapshot);
        }
        this.snapshot = undefined;
    }
}
//# sourceMappingURL=PlayModeBridge.js.map