"use strict";
exports.__esModule = true;
exports.ContentBuilderTemplate = void 0;
var tslib_1 = require("tslib");
// @ts-nocheck
require("./ContentBuilderTemplate.css");
var react_1 = (0, tslib_1.__importDefault)(require("react"));
var react_router_1 = require("react-router");
var PropsWithAsAttributes_1 = require("../../../utils/types/PropsWithAsAttributes");
var usePropsHandler_1 = require("../../EventInterceptor/usePropsHandler");
var index_1 = require("./index");
var Slider_1 = require("../../Slider/Slider");
var Grid_1 = require("../../Grid/Grid");
var Typography_1 = require("../../Typography/Typography");
var NewsCard_1 = require("../../NewsCard/NewsCard");
exports.ContentBuilderTemplate = (0, PropsWithAsAttributes_1.forwardRefWithAs)(function (props, ref) {
    var _a = (0, usePropsHandler_1.usePropsHandler)((0, index_1.cnContentBuilderTemplate)(), props), type = _a.type, newsTitle = _a.newsTitle, news = _a.news, mediaTitle = _a.mediaTitle, media = _a.media, aliases = _a.aliases;
    var typeNumber = type.toString();
    return (react_1["default"].createElement("div", { className: (0, index_1.cnContentBuilderTemplate)({ type: typeNumber }) },
        react_1["default"].createElement(Grid_1.Grid, { breakpoints: {
                desktop: { cols: 12, colGap: '5xl' },
                tablet: { rowGap: 'xxl' },
                mobile: { rowGap: 'xxl' }
            } },
            (news === null || news === void 0 ? void 0 : news.length) > 0 && (react_1["default"].createElement(Grid_1.GridItem, { breakpoints: { desktop: { col: 4, order: 2 } }, className: "News" },
                newsTitle && (react_1["default"].createElement(Typography_1.Typography.Text, { size: "xs", weight: "bold", transform: "uppercase", className: "News-Title" }, newsTitle)),
                react_1["default"].createElement("div", { className: (0, index_1.cnContentBuilderTemplate)('ListSlider') },
                    react_1["default"].createElement(Slider_1.Slider, { navigation: true, watchOverflow: true, autoHeight: true, spaceBetween: 1000 }, news.map(function (itemsPress) { return (react_1["default"].createElement(Slider_1.SliderItem, null,
                        react_1["default"].createElement(Grid_1.Grid, { cols: "1", gap: "3xl" }, itemsPress.map(function (item) { return (react_1["default"].createElement(Grid_1.GridItem, { col: "1", key: item.id },
                            react_1["default"].createElement(NewsCard_1.NewsCard, (0, tslib_1.__assign)({}, item, { size: "s", path: item.parentSlug && item.slug
                                    ? (0, react_router_1.generatePath)(aliases.NEWSROOM_PAGE, {
                                        parentSlug: item.parentSlug,
                                        slug: item.slug
                                    })
                                    : null, picture: false })))); })))); }))))),
            (media === null || media === void 0 ? void 0 : media.length) > 0 && (react_1["default"].createElement(Grid_1.GridItem, { breakpoints: { desktop: { col: 8, order: -1 } } },
                mediaTitle && (react_1["default"].createElement(Typography_1.Typography.Text, { size: "xs", weight: "bold", transform: "uppercase" }, mediaTitle)),
                react_1["default"].createElement(Slider_1.Slider, { navigation: true, watchOverflow: true, autoHeight: true, spaceBetween: 1000 }, media.map(function (group, index) { return (react_1["default"].createElement(Slider_1.SliderItem, { key: index },
                    react_1["default"].createElement(Grid_1.Grid, { cols: "1", className: (0, index_1.cnContentBuilderTemplate)('ListBorder') }, group.map(function (item) { return (react_1["default"].createElement(Grid_1.GridItem, { col: "1", key: item.id },
                        react_1["default"].createElement(NewsCard_1.NewsCard, (0, tslib_1.__assign)({}, item, { labelButton: 'Read more', path: item.parentSlug && item.slug
                                ? (0, react_router_1.generatePath)(aliases.NEWSROOM_PAGE, {
                                    parentSlug: item.parentSlug,
                                    slug: item.slug
                                })
                                : null })))); })))); })))))));
});
exports["default"] = exports.ContentBuilderTemplate;
