function h(e){const n=new Map,s=[];return e.linkset?.length?(e.linkset[0].item.forEach(t=>{const a=t.hierarchy.join("|");n.set(a,{...t,id:a,_children:[],_hasSubmenu:!1})}),e.linkset[0].item.forEach(t=>{const a=t.hierarchy.join("|"),i=n.get(a);if(t.hierarchy.length===1)s.push(i);else{const c=t.hierarchy.slice(0,-1).join("|"),r=n.get(c);r&&(r._children.push(i),r._hasSubmenu=!0)}}),s):[]}const u=()=>{const e={pageTitle:window.drupalSettings?.xbData?.v0?.pageTitle||"",breadcrumbs:window.drupalSettings?.xbData?.v0?.breadcrumbs||[]};return window.parent.postMessage({type:"_xb_useswr_data_fetch",id:"getPageData()",data:e}),e},d=()=>{const e={branding:window.drupalSettings?.xbData?.v0?.branding||{homeUrl:"",siteName:"",siteSlogan:""},baseUrl:window.drupalSettings?.xbData?.v0?.baseUrl||"/"};return window.parent.postMessage({type:"_xb_useswr_data_fetch",id:"getSiteData()",data:e}),e};export{u as getPageData,d as getSiteData,h as sortMenu};
