import { AppObjectPM } from "@vived/core";
import { CalloutEntity } from "../Entities/CalloutEntity";
export class CalloutSizePM extends AppObjectPM {
    static get(id, appObjects) {
        return appObjects.get(id)?.getComponent(CalloutSizePM.type);
    }
}
CalloutSizePM.type = "CalloutSizePM";
export function makeCalloutSizePM(appObject) {
    return new CalloutSizePMImp(appObject);
}
class CalloutSizePMImp extends CalloutSizePM {
    get calloutEntity() {
        return this.getCachedLocalComponent(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