import { AppObjectPM, getSingletonComponent, } from "@vived/core";
import { ZSpaceEntity } from "../Entities/ZSpaceEntity";
export class ZSpaceIsEnabledPM extends AppObjectPM {
}
ZSpaceIsEnabledPM.type = "ZSpaceIsEnabledPM";
ZSpaceIsEnabledPM.get = (appObjects) => getSingletonComponent(ZSpaceIsEnabledPM.type, appObjects);
export function makeZSpaceIsEnabledPM(appObject) {
    return new ZSpaceIsEnabledPMImp(appObject);
}
class ZSpaceIsEnabledPMImp extends ZSpaceIsEnabledPM {
    get zSpace() {
        return this.getCachedSingleton(ZSpaceEntity.type);
    }
    vmsAreEqual(a, b) {
        return a === b;
    }
    constructor(appObject) {
        super(appObject, ZSpaceIsEnabledPM.type);
        this.onZSpaceChange = () => {
            if (!this.zSpace)
                return;
            this.doUpdateView(this.zSpace.enabled);
        };
        this.zSpace?.addChangeObserver(this.onZSpaceChange);
        this.onZSpaceChange();
        this.appObjects.registerSingleton(this);
    }
}
//# sourceMappingURL=ZSpaceIsEnabledPM.js.map