"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CalloutSizePM = void 0;
exports.makeCalloutSizePM = makeCalloutSizePM;
const core_1 = require("@vived/core");
const CalloutEntity_1 = require("../Entities/CalloutEntity");
class CalloutSizePM extends core_1.AppObjectPM {
    static get(id, appObjects) {
        return appObjects.get(id)?.getComponent(CalloutSizePM.type);
    }
}
exports.CalloutSizePM = CalloutSizePM;
CalloutSizePM.type = "CalloutSizePM";
function makeCalloutSizePM(appObject) {
    return new CalloutSizePMImp(appObject);
}
class CalloutSizePMImp extends CalloutSizePM {
    get calloutEntity() {
        return this.getCachedLocalComponent(CalloutEntity_1.CalloutEntity.type);
    }
    vmsAreEqual(a, b) {
        return a === b;
    }
    constructor(appObject) {
        super(appObject, CalloutSizePM.type);
        this.onEntityChange = () => {
            if (!this.calloutEntity)
                return;
            this.doUpdateView(this.calloutEntity.size);
        };
        this.dispose = () => {
            super.dispose();
            this.calloutEntity?.removeChangeObserver(this.onEntityChange);
        };
        this.calloutEntity?.addChangeObserver(this.onEntityChange);
        this.onEntityChange();
    }
}
//# sourceMappingURL=CalloutSizePM.js.map