"use client";
import { jsx } from 'react/jsx-runtime';
import { lazy } from 'react';
import { usePluginOverrides } from '@btst/stack/context';
import { ComposedRoute } from '@btst/stack/client/components';
import { DefaultError } from '../shared/default-error.mjs';
import { NotFoundPage } from './404-page.mjs';
import { ListSkeleton } from '../loading/list-skeleton.mjs';

const ContentListPageInternal = lazy(
  () => import('./content-list-page.internal.mjs').then((m) => ({
    default: m.ContentListPage
  }))
);
function ContentListPageComponent({
  typeSlug
}) {
  const { onRouteError } = usePluginOverrides("cms");
  return /* @__PURE__ */ jsx(
    ComposedRoute,
    {
      path: `/cms/${typeSlug}`,
      PageComponent: ContentListPageInternal,
      ErrorComponent: DefaultError,
      LoadingComponent: ListSkeleton,
      NotFoundComponent: NotFoundPage,
      props: { typeSlug },
      onError: (error) => {
        if (onRouteError) {
          onRouteError("contentList", error, {
            path: `/cms/${typeSlug}`,
            params: { typeSlug },
            isSSR: typeof window === "undefined"
          });
        }
      }
    }
  );
}

export { ContentListPageComponent };
