var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import * as React from "react";
import { cn } from "@utils";
import { EmptyStateContent } from "./emptyStateContent";
import { EmptyStateCTA } from "./emptyStateCta";
import { emptyStateVariants, contentWrapperVariants } from "./emptyStateVariants";
// Import all SVGs for light mode
import analyticsLight from "./svgs/analytics.svg";
import dashboardLight from "./svgs/dashboard.svg";
import dataUploadLight from "./svgs/dataUpload.svg";
import workspacesLight from "./svgs/workspaces.svg";
import waitingLight from "./svgs/waiting.svg";
import otpLight from "./svgs/otp.svg";
import searchingLight from "./svgs/searching.svg";
import notificationLight from "./svgs/notification.svg";
import noFilesLight from "./svgs/noFiles.svg";
import noAccessLight from "./svgs/noAccess.svg";
import noConnectionsLight from "./svgs/noConnections.svg";
import forgotPasswordLight from "./svgs/forgotPassword.svg";
import favoriteLight from "./svgs/favorite.svg";
import loginLight from "./svgs/login.svg";
import fileUploadLight from "./svgs/fileUpload.svg";
import emptyDataLight from "./svgs/emptyData.svg";
import emptyData2Light from "./svgs/emptyData2.svg";
import emptyData3Light from "./svgs/emptyData3.svg";
import emptyData4Light from "./svgs/emptyData4.svg";
import datapipelineLight from "./svgs/datapipeline.svg";
// Import all SVGs for dark mode
import analyticsDark from "./darkModeSvgs/analytics_dark.svg";
import dashboardDark from "./darkModeSvgs/dashboard_dark.svg";
import dataUploadDark from "./darkModeSvgs/dataupload_dark.svg";
import workspacesDark from "./darkModeSvgs/workspace_dark.svg";
import searchingDark from "./darkModeSvgs/searching_dark.svg";
import notificationDark from "./darkModeSvgs/notification_dark.svg";
import noAccessDark from "./darkModeSvgs/noaccess_dark.svg";
import noConnectionsDark from "./darkModeSvgs/noConnection_dark.svg";
import forgotPasswordDark from "./darkModeSvgs/forgotPassword_dark.svg";
import loginDark from "./darkModeSvgs/login_dark.svg";
import favoriteDark from "./darkModeSvgs/favorite_dark.svg";
import fileUploadDark from "./darkModeSvgs/fileUpload_dark.svg";
import emptyDark from "./darkModeSvgs/empty_dark.svg";
import otpDark from "./darkModeSvgs/OTP_dark.svg";
const lightSvgs = {
    analytics: analyticsLight,
    dashboard: dashboardLight,
    "data-upload": dataUploadLight,
    workspaces: workspacesLight,
    waiting: waitingLight,
    otp: otpLight,
    searching: searchingLight,
    notification: notificationLight,
    "no-files": noFilesLight,
    "no-access": noAccessLight,
    "no-connections": noConnectionsLight,
    "forgot-password": forgotPasswordLight,
    favorite: favoriteLight,
    login: loginLight,
    "file-upload": fileUploadLight,
    "empty-data": emptyDataLight,
    "empty-data-2": emptyData2Light,
    "empty-data-3": emptyData3Light,
    "empty-data-4": emptyData4Light,
    datapipeline: datapipelineLight
};
const darkSvgs = {
    analytics: analyticsDark,
    dashboard: dashboardDark,
    "data-upload": dataUploadDark,
    workspaces: workspacesDark,
    searching: searchingDark,
    notification: notificationDark,
    "no-access": noAccessDark,
    "no-connections": noConnectionsDark,
    "forgot-password": forgotPasswordDark,
    login: loginDark,
    favorite: favoriteDark,
    "file-upload": fileUploadDark,
    "empty-data": emptyDark,
    otp: otpDark
};
// Main EmptyState component
export const EmptyState = React.forwardRef((_a, ref) => {
    var _b;
    var { className, imageVariant = "analytics", imageAltText = "", customImage, children } = _a, props = __rest(_a, ["className", "imageVariant", "imageAltText", "customImage", "children"]);
    const [content, setContent] = React.useState(null);
    const [cta, setCta] = React.useState(null);
    React.useEffect(() => {
        setContent(null);
        setCta(null);
        React.Children.forEach(children, (child) => {
            if (React.isValidElement(child) && child.type === EmptyStateContent) {
                setContent(child);
            }
            else if (React.isValidElement(child) && child.type === EmptyStateCTA) {
                setCta(child);
            }
        });
    }, [children]);
    // Resolve SVG srcs for given variant, fallback to analytics
    const key = imageVariant in lightSvgs ? imageVariant : "analytics";
    const srcLight = lightSvgs[key];
    const srcDark = (_b = darkSvgs[key]) !== null && _b !== void 0 ? _b : srcLight;
    return (_jsxs("div", Object.assign({ ref: ref, className: cn(emptyStateVariants(), className) }, props, { children: [customImage ? (customImage) : (_jsxs("picture", { children: [_jsx("source", { srcSet: srcDark, media: "(prefers-color-scheme: dark)" }), _jsx("img", { className: "empty-state-image", src: srcLight, alt: content ? "" : imageAltText })] })), _jsxs("section", { className: cn(contentWrapperVariants()), children: [content, cta] })] })));
});
EmptyState.displayName = "EmptyState";
EmptyState.Content = EmptyStateContent;
EmptyState.CTA = EmptyStateCTA;
//# sourceMappingURL=emptyState.js.map