import React from "react";
import "~/assets/styles/old-tailwind.css";
import { useTranslation } from "react-i18next";
import { Content } from "./components/Content";
import { Footer } from "./components/Footer";
import { NeighborhoodDemographicsProvider } from "./context";
import { schema } from "./schema";
import { TrackingProvider, initializeAnalytics } from "~/tracking";
import ResizeWrapper from "~/components/ResizeWrapper";
import { ValidateOptions } from "~/components/ValidateOptions";
import { LocalLogicProvider } from "~/context/LocalLogicProvider";
import { useStateManagerContext } from "~/context/stateManager";
import useIsMobile from "~/hooks/useIsMobile";
import { ProductNames } from "~/types";
import { ANALYTICS_SETTINGS } from "~/constants/analytics";
import { TitleHeader } from "~/components/TitleHeader";
initializeAnalytics(ANALYTICS_SETTINGS.neighborhoodWrap.key);
const NeighborhoodDemographics = () => {
    var _a, _b, _c, _d, _e, _f, _g, _h, _j;
    const { t } = useTranslation("neighborhoodDemographics");
    const { sdkState } = useStateManagerContext();
    const isMobile = useIsMobile();
    const locale = ((_a = sdkState.globalOptions) === null || _a === void 0 ? void 0 : _a.locale) || "en";
    return (React.createElement(ResizeWrapper, null,
        React.createElement(ValidateOptions, { sdk: "Neighborhood Demographics", schema: schema, options: sdkState.options },
            React.createElement(LocalLogicProvider, { environment: (_c = (_b = sdkState.globalOptions) === null || _b === void 0 ? void 0 : _b.environment) === null || _c === void 0 ? void 0 : _c.api, apiKey: sdkState.apiKey, appearance: (_d = sdkState.globalOptions) === null || _d === void 0 ? void 0 : _d.appearance, locale: (_e = sdkState.globalOptions) === null || _e === void 0 ? void 0 : _e.locale, product: ProductNames.NEIGHBORHOOD_DEMOGRAPHICS },
                React.createElement(TrackingProvider, { trackingPipelineSettings: {
                        apiKey: sdkState.apiKey || "",
                    }, analyticsSettings: ANALYTICS_SETTINGS.neighborhoodWrap, meta: {
                        clientId: sdkState.clientId,
                        productName: ProductNames.NEIGHBORHOOD_DEMOGRAPHICS,
                        productVersion: FULL_APP_VERSION,
                    }, attributes: {
                        location: {
                            lat: (_f = sdkState.options) === null || _f === void 0 ? void 0 : _f.lat,
                            lng: (_g = sdkState.options) === null || _g === void 0 ? void 0 : _g.lng,
                        },
                        host: sdkState.location,
                        host_url: document.referrer,
                        locale,
                        isMobile,
                    }, flags: {
                        isDebugMode: import.meta.env.VITE_TRACKING_PIPELINE_DEBUG === "true",
                    } },
                    React.createElement(NeighborhoodDemographicsProvider, null,
                        React.createElement(TitleHeader, { title: typeof ((_h = sdkState.options) === null || _h === void 0 ? void 0 : _h.title) === "string" ||
                                ((_j = sdkState.options) === null || _j === void 0 ? void 0 : _j.title) === false
                                ? sdkState.options.title
                                : t("title") }),
                        React.createElement(Content, null),
                        React.createElement(Footer, null)))))));
};
export default NeighborhoodDemographics;
//# sourceMappingURL=index.js.map