"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createBoard = void 0;
const react_1 = __importDefault(require("react"));
const board_core_1 = require("@wixc3/board-core");
const react_error_handled_render_1 = require("./react-error-handled-render");
function createBoard(input) {
    const res = (0, board_core_1.createRenderableBase)(Object.assign(Object.assign({}, input), { render(target) {
            return (0, board_core_1.baseRender)(res, async () => {
                var _a;
                let element = react_1.default.createElement(res.Board, null);
                const wrapRenderPlugins = (0, board_core_1.getPluginsWithHooks)(res, 'wrapRender');
                for (const plugin of wrapRenderPlugins) {
                    if ((_a = plugin.key.plugin) === null || _a === void 0 ? void 0 : _a.wrapRender) {
                        const el = plugin.key.plugin.wrapRender(plugin.props, res, element, target);
                        element = el || element;
                    }
                }
                return (0, react_error_handled_render_1.reactErrorHandledRendering)(element, target);
            }, target);
        } }));
    return res;
}
exports.createBoard = createBoard;
//# sourceMappingURL=create-board.js.map