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