import { AppObjectPM, getSingletonComponent, } from "@vived/core";
import { BaseAppState } from "../Entity";
export class IsAuthoringPM extends AppObjectPM {
}
IsAuthoringPM.type = "IsAuthoringPM";
IsAuthoringPM.get = (appObjects) => getSingletonComponent(IsAuthoringPM.type, appObjects);
export function makeIsAuthoringPM(appObject) {
    return new IsAuthoringPMImp(appObject);
}
class IsAuthoringPMImp extends IsAuthoringPM {
    get baseAppState() {
        return this.getCachedSingleton(BaseAppState.type);
    }
    vmsAreEqual(a, b) {
        return a === b;
    }
    dispose() {
        super.dispose();
        this.baseAppState?.removeChangeObserver(this.onAppStateChange);
    }
    constructor(appObject) {
        super(appObject, IsAuthoringPM.type);
        this.onAppStateChange = () => {
            if (!this.baseAppState)
                return;
            this.doUpdateView(this.baseAppState.isAuthoring);
        };
        this.baseAppState?.addChangeObserver(this.onAppStateChange);
        this.onAppStateChange();
        this.appObjects.registerSingleton(this);
    }
}
//# sourceMappingURL=IsAuthoringPM.js.map