"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ContentItems=void 0;const jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),react_router_dom_1=require("react-router-dom"),helpers_1=require("./helpers"),SectionContent_1=require("../SectionContent");function ContentItemsComponent({items:e,root:t=!1}){const r="/",{rootItem:n}=(0,helpers_1.getItemsByType)(e),o=!t||n?r:(0,helpers_1.getFirstPageLink)(e,r),_=(0,react_1.useMemo)((()=>(0,jsx_runtime_1.jsxs)(react_router_dom_1.Routes,{children:[n&&(0,jsx_runtime_1.jsx)(react_router_dom_1.Route,{path:`${n.href||r}*`,element:(0,jsx_runtime_1.jsx)(SectionContent_1.SectionContent,{items:e})}),(0,jsx_runtime_1.jsx)(react_router_dom_1.Route,{path:"*",element:(0,jsx_runtime_1.jsx)(react_router_dom_1.Navigate,{to:o,replace:!0})})]})),[n,r,e,o]);return t&&!e.length?(0,jsx_runtime_1.jsx)(react_router_dom_1.Routes,{children:(0,jsx_runtime_1.jsx)(react_router_dom_1.Route,{path:"*",element:(0,jsx_runtime_1.jsx)(SectionContent_1.SectionContent,{items:e})})}):e.length?(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:_}):null}exports.ContentItems=(0,react_1.memo)(ContentItemsComponent);
//# sourceMappingURL=ContentItems.js.map