"use client";
'use strict';

const jsxRuntime = require('react/jsx-runtime');
const React = require('react');
const context = require('@btst/stack/context');
const components = require('@btst/stack/client/components');
const defaultError = require('../shared/default-error.cjs');
const index = require('../loading/index.cjs');
const _404Page = require('./404-page.cjs');

const HomePage = React.lazy(
  () => import('./home-page.internal.cjs').then((m) => ({ default: m.HomePage }))
);
function HomePageComponent({
  published = true
}) {
  const { onRouteError } = context.usePluginOverrides("blog");
  return /* @__PURE__ */ jsxRuntime.jsx(
    components.ComposedRoute,
    {
      path: published ? "/blog" : "/blog/drafts",
      PageComponent: HomePage,
      ErrorComponent: defaultError.DefaultError,
      LoadingComponent: index.PostsLoading,
      NotFoundComponent: _404Page.NotFoundPage,
      props: { published },
      onError: (error) => {
        if (onRouteError) {
          onRouteError("posts", error, {
            path: published ? "/blog" : "/blog/drafts",
            isSSR: typeof window === "undefined",
            published
          });
        }
      }
    }
  );
}

exports.HomePageComponent = HomePageComponent;
