import*as t from"react";import{useMemo as m}from"react";import{QueryClientProvider as c,QueryClient as a}from"@tanstack/react-query";import{RedocSchema as u,StoreProvider as f}from"@redocly/openapi-docs";import{buildSchema as d}from"graphql";import{TypeView as s,FieldView as y,AppProviders as h}from"@redocly/graphql-docs";import{Catalog as E}from"@redocly/theme/components/Catalog/Catalog";import{CatalogEntity as p}from"@redocly/theme/components/Catalog/CatalogEntity/CatalogEntity";import{NotFound as w}from"@redocly/theme/layouts/NotFound";const C=new a({defaultOptions:{queries:{refetchOnWindowFocus:!1}}});function S({pageProps:e}){if(e.status==="notFound")return t.createElement(w,null);const o=({sdl:r,typeName:l})=>{const i=m(()=>{try{return d(r)}catch{return null}},[r]);if(!i)return null;const n=i.getType(l);return n?t.createElement(h,{schema:i},t.createElement(s,{type:n,fieldExpandLevel:1,renderField:y})):null};return t.createElement(c,{client:C},"entities"in e&&t.createElement(E,{entitiesTypes:e.entitiesTypes,catalogConfig:e.catalogConfig,filters:e.filters,initialEntitiesList:e.entities,catalogSwitcherItems:e.catalogSwitcherItems,initialViewMode:e.initialViewMode}),"entity"in e&&t.createElement(t.Fragment,null,t.createElement(p,{RedocSchema:u,StoreProvider:f,GraphqlTypeRenderer:o})))}export{S as default};
