import { MessageHandler } from "./MessageHandler";
import { MessageHandlerV2 } from "@foxglove/studio-base/panels/ThreeDeeRender/renderables/ImageMode/MessageHandlerV2";
export class ImageModeMessageHandlerFactory {
    static getMessageHandler(config, hud) {
        const messageHandlerVersion = ImageModeMessageHandlerFactory.getSupportedVersion();
        // TODO: Remove
        console.debug(`Using message handler ${messageHandlerVersion}`);
        return messageHandlerVersion === "v2"
            ? new MessageHandlerV2(config, hud)
            : new MessageHandler(config, hud);
    }
    static getSupportedVersion() {
        const localStorageString = localStorage.getItem("connectionConfig");
        if (!localStorageString) {
            return "v1";
        }
        const parsedConfig = JSON.parse(localStorageString);
        if (parsedConfig.messageHandlerVersion === "v2") {
            return "v2";
        }
        return "v1";
    }
}
//# sourceMappingURL=MessageHandlerFactory.js.map