"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.RightPanelContainer=exports.SectionContainer=void 0,exports.SectionContent=SectionContent;const jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),theme_1=require("@redocly/theme"),jotai_1=require("jotai"),styled_components_1=__importDefault(require("styled-components")),PageFooter_1=require("../PageFooter"),store_1=require("../../jotai/store"),RenderHook_1=require("../RenderHook"),RightPanel_1=require("../RightPanel"),app_1=require("../../jotai/app"),common_1=require("../common"),Items_1=require("../ContentItems/Items"),ContentItem_1=require("../ContentItem");function SectionContent({items:e,hideFooterAndHeader:t}){const{unstable_hooks:{MiddlePanelHeader:n},routingBasePath:r}=(0,jotai_1.useAtomValue)(store_1.globalOptionsAtom),i=(0,jotai_1.useAtomValue)(app_1.layoutAtom),o=i===theme_1.LayoutVariant.STACKED,a=(0,react_1.useMemo)((()=>t?null:(0,jsx_runtime_1.jsx)(MiddlePanelWrapper,{isStacked:o,children:(0,jsx_runtime_1.jsx)(PageFooter_1.PageFooter,{})})),[t,o]),s=(0,react_1.useMemo)((()=>t||!theme_1.OpenApiHeader&&!n?null:(0,jsx_runtime_1.jsx)(MiddlePanelWrapper,{isStacked:o,children:n?(0,jsx_runtime_1.jsx)(RenderHook_1.RenderHook,{Hook:n,props:void 0}):(0,jsx_runtime_1.jsx)(theme_1.OpenApiHeader,{})})),[n,t,o]);return 0===e.length?null:(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[s,(0,jsx_runtime_1.jsxs)(common_1.Row,{layout:i,children:[(0,jsx_runtime_1.jsx)(exports.SectionContainer,{layout:i,children:e.filter((({type:e})=>"section"===e)).map((e=>(0,jsx_runtime_1.jsx)(ContentItem_1.ContentItem,{item:e,routingBasePath:r,children:(0,jsx_runtime_1.jsx)(Items_1.Items,{items:e.items,routingBasePath:r})},e.id)))}),(0,jsx_runtime_1.jsx)(exports.RightPanelContainer,{isStacked:o,tabIndex:0,children:(0,jsx_runtime_1.jsx)(RightPanel_1.RightPanel,{item:e[0]})})]}),e.filter((({type:e})=>"section"!==e)).map((e=>(0,jsx_runtime_1.jsx)(ContentItem_1.ContentItem,{item:e,routingBasePath:r,children:(0,jsx_runtime_1.jsx)(Items_1.Items,{items:e.items,routingBasePath:r})},e.id))),a]})}const MiddlePanelWrapper=(0,styled_components_1.default)(common_1.SamplesMiddlePanel)`
  align-self: flex-start;
  padding-top: var(--panel-gap-vertical);
  padding-bottom: var(--panel-gap-vertical);
`;exports.SectionContainer=styled_components_1.default.div`
  width: 100%;

  @media screen and (min-width: ${theme_1.breakpoints.large}) {
    width: ${({layout:e})=>e===theme_1.LayoutVariant.STACKED?"100%":"calc(100% - var(--panel-samples-width))"};
  }
`,exports.RightPanelContainer=(0,styled_components_1.default)(common_1.SamplesPanel)`
  margin: var(--spacing-base) 0;
`;
//# sourceMappingURL=SectionContent.js.map