"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IsReviewingPM = void 0;
exports.makeIsReviewingPM = makeIsReviewingPM;
const core_1 = require("@vived/core");
const Entity_1 = require("../Entity");
class IsReviewingPM extends core_1.AppObjectPM {
}
exports.IsReviewingPM = IsReviewingPM;
IsReviewingPM.type = "IsReviewingPM";
IsReviewingPM.get = (appObjects) => (0, core_1.getSingletonComponent)(IsReviewingPM.type, appObjects);
function makeIsReviewingPM(appObject) {
    return new IsReviewingPMImp(appObject);
}
class IsReviewingPMImp extends IsReviewingPM {
    get baseAppState() {
        return this.getCachedSingleton(Entity_1.BaseAppState.type);
    }
    vmsAreEqual(a, b) {
        return a === b;
    }
    dispose() {
        super.dispose();
        this.baseAppState?.removeChangeObserver(this.onAppStateChange);
    }
    constructor(appObject) {
        super(appObject, IsReviewingPM.type);
        this.onAppStateChange = () => {
            if (!this.baseAppState)
                return;
            this.doUpdateView(this.baseAppState.isReviewing);
        };
        this.baseAppState?.addChangeObserver(this.onAppStateChange);
        this.onAppStateChange();
        this.appObjects.registerSingleton(this);
    }
}
//# sourceMappingURL=IsReviewingPM.js.map