"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConstructorBlock = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const React = tslib_1.__importStar(require("react"));
const innerContext_1 = require("../../../../context/innerContext/index.js");
const usePCEditorChildrenItemWrap_1 = require("../../../../hooks/usePCEditorChildrenItemWrap.js");
const ConstructorBlock = ({ index = 0, data, children, }) => {
    const { blockRef } = (0, usePCEditorChildrenItemWrap_1.usePCEditorChildrenItemWrap)(index);
    const { blockWrappers = [] } = React.useContext(innerContext_1.InnerContext);
    const wrappedContent = blockWrappers.reduce((content, { wrapper: Wrapper, props }) => ((0, jsx_runtime_1.jsx)(Wrapper, { type: data.type, props: props, content: data, index: index, children: content })), children);
    return (0, jsx_runtime_1.jsx)("div", { ref: blockRef, children: wrappedContent });
};
exports.ConstructorBlock = ConstructorBlock;
//# sourceMappingURL=ConstructorBlock.js.map
