"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConstructorHeader = exports.ConstructorItem = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const React = tslib_1.__importStar(require("react"));
const blockIdContext_1 = require("../../../../context/blockIdContext/index.js");
const innerContext_1 = require("../../../../context/innerContext/index.js");
const BlockDecoration_1 = require("../../../../customization/BlockDecoration.js");
const ConstructorItem = ({ data, blockKey, children, }) => {
    const { itemMap } = React.useContext(innerContext_1.InnerContext);
    const { type, ...rest } = data;
    const Component = itemMap[type];
    return ((0, jsx_runtime_1.jsx)(blockIdContext_1.BlockIdContext.Provider, { value: blockKey, children: (0, jsx_runtime_1.jsx)(Component, { ...rest, children: children }) }));
};
exports.ConstructorItem = ConstructorItem;
const ConstructorHeader = ({ data, blockKey, }) => ((0, jsx_runtime_1.jsx)(BlockDecoration_1.BlockDecoration, { type: data.type, children: (0, jsx_runtime_1.jsx)(exports.ConstructorItem, { data: data, blockKey: blockKey }, data.type) }));
exports.ConstructorHeader = ConstructorHeader;
//# sourceMappingURL=ConstructorItem.js.map
