"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const BaseContentEventHandler_1 = require("./BaseContentEventHandler");
const domUtils_1 = require("../../sharedUtils/domUtils");
const pdfUtils_1 = require("../../sharedUtils/pdfUtils");
const EmbeddedPdfHandler_1 = require("@mabl/pdf-viewer/dist/EmbeddedPdfHandler");
const stateUtils_1 = require("../stateUtils");
const mablscriptFind_1 = require("@mablhq/test-model/mablscriptFind");
class PdfEventHandler extends BaseContentEventHandler_1.BaseContentEventHandler {
    constructor(store) {
        super(EmbeddedPdfHandler_1.PDFEventType, 'PDF Handler', store, new mablscriptFind_1.ElementFullSelectorCache());
        this.shouldHandle = () => {
            const state = this.store.getState();
            return (0, stateUtils_1.isRecordingActive)(state) || (0, stateUtils_1.isReplayActive)(state);
        };
        this.embeddedPdfHandler = new EmbeddedPdfHandler_1.EmbeddedPdfHandler(pdfUtils_1.PDFViewerBaseUrl, domUtils_1.createIgnoredDomElement, this.shouldHandle);
        this.handle = this.embeddedPdfHandler.handle;
        this.register = this.embeddedPdfHandler.register;
        this.unregister = this.embeddedPdfHandler.unregister;
    }
}
exports.default = PdfEventHandler;
