"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GravityBlocksProvider = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const React = tslib_1.__importStar(require("react"));
const uikit_1 = require("@gravity-ui/uikit");
const constants_1 = require("../../components/constants.js");
const analyticsContext_1 = require("./analyticsContext/index.js");
const animateContext_1 = require("./animateContext/index.js");
const FormsContext_1 = require("./formsContext/FormsContext.js");
const imageContext_1 = require("./imageContext/index.js");
const localeContext_1 = require("./localeContext/index.js");
const locationContext_1 = require("./locationContext/index.js");
const mapsContext_1 = require("./mapsContext/mapsContext.js");
const microdataContext_1 = require("./microdataContext/index.js");
const mobileContext_1 = require("./mobileContext/index.js");
const projectSettingsContext_1 = require("./projectSettingsContext/index.js");
const ssrContext_1 = require("./ssrContext/index.js");
const theme_1 = require("./theme/index.js");
const windowWidthContext_1 = require("./windowWidthContext/index.js");
const GravityBlocksProvider = ({ children, ...props }) => {
    const { isMobile, mapsContext = mapsContext_1.initialMapValue, locale = {}, location = {}, analytics = {}, ssrConfig = {}, projectSettings = {}, theme = constants_1.DEFAULT_THEME, image = {}, forms = FormsContext_1.DEFAULT_FORMS_CONTEXT_VALUE, animated = true, microdata = {}, } = props;
    /* eslint-disable react/jsx-key */
    const context = [
        (0, jsx_runtime_1.jsx)(uikit_1.ThemeProvider, { theme: theme }),
        (0, jsx_runtime_1.jsx)(animateContext_1.AnimateContext.Provider, { value: { animated } }),
        (0, jsx_runtime_1.jsx)(theme_1.ThemeContext.Provider, { value: { theme } }),
        (0, jsx_runtime_1.jsx)(projectSettingsContext_1.ProjectSettingsContext.Provider, { value: projectSettings }),
        (0, jsx_runtime_1.jsx)(localeContext_1.LocaleContext.Provider, { value: locale }),
        (0, jsx_runtime_1.jsx)(imageContext_1.ImageContext.Provider, { value: image }),
        (0, jsx_runtime_1.jsx)(locationContext_1.LocationContext.Provider, { value: location }),
        (0, jsx_runtime_1.jsx)(mobileContext_1.MobileContext.Provider, { value: Boolean(isMobile) }),
        (0, jsx_runtime_1.jsx)(mapsContext_1.MapsContext.Provider, { value: mapsContext }),
        (0, jsx_runtime_1.jsx)(analyticsContext_1.AnalyticsContext.Provider, { value: analytics }),
        (0, jsx_runtime_1.jsx)(FormsContext_1.FormsContext.Provider, { value: forms }),
        (0, jsx_runtime_1.jsx)(ssrContext_1.SSRContext.Provider, { value: { isServer: ssrConfig?.isServer } }),
        (0, jsx_runtime_1.jsx)(microdataContext_1.MicrodataContext.Provider, { value: microdata }),
        (0, jsx_runtime_1.jsx)(windowWidthContext_1.WindowWidthProvider, {}),
    ].reduceRight((prev, provider) => React.cloneElement(provider, {}, prev), children);
    /* eslint-enable react/jsx-key */
    return (0, jsx_runtime_1.jsx)(React.Fragment, { children: context });
};
exports.GravityBlocksProvider = GravityBlocksProvider;
//# sourceMappingURL=GravityBlocksProvider.js.map
