"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExamComponentWrapper = void 0;
const react_1 = __importDefault(require("react"));
const react_redux_1 = require("react-redux");
const react_i18next_1 = require("react-i18next");
const store_1 = require("../../../src/store");
const parseExamStructure_1 = require("../../../src/parser/parseExamStructure");
const useCached_1 = require("../../../src/useCached");
const examServerApi_1 = require("../../examServerApi");
const i18n_1 = require("../../../src/i18n");
const CommonExamContext_1 = require("../../../src/components/context/CommonExamContext");
const ExamContext_1 = require("../../../src/components/context/ExamContext");
require("../../../src/css/main.less");
const WrappedComponent = ({ doc, children }) => {
    const i18n = (0, useCached_1.useCached)(() => (0, i18n_1.initI18n)('fi-FI'));
    const store = (0, useCached_1.useCached)(() => (0, store_1.initializeExamStore)((0, parseExamStructure_1.parseExamStructure)(doc), 'allowed', [], [], examServerApi_1.examServerApi));
    return (react_1.default.createElement(react_redux_1.Provider, { store: store },
        react_1.default.createElement(react_i18next_1.I18nextProvider, { i18n: i18n },
            react_1.default.createElement("div", { className: "e-exam" }, children))));
};
exports.ExamComponentWrapper = (0, ExamContext_1.withExamContext)((0, CommonExamContext_1.withCommonExamContext)(WrappedComponent));
//# sourceMappingURL=ExamComponentWrapper.js.map