var r = [], s = []; function c(i) { return /* @__PURE__ */ React.createElement(u, { link_groups: r, links: s }); } function u(i) { let n = []; return Object.keys(r).map((e) => { var t = []; s.forEach((a) => { a.groups.find((o) => o == r[e]) && t.push(a); }), n.push( /* @__PURE__ */ React.createElement("h4", { key: e }, r[e]) ), n.push( /* @__PURE__ */ React.createElement("ul", null, /* @__PURE__ */ React.createElement(l, { key: e + "_sub", sublinks: t, group_id: e, group_title: r[e] })) ); }), [n]; } function l(i) { var n = i.sublinks.map((e, t) => /* @__PURE__ */ React.createElement("li", { key: "link" + t }, /* @__PURE__ */ React.createElement("a", { className: "dropdown-item", href: e.url, "data-id": "click_login", "data-item": e.title }, e.title))); return [n]; } function d() { function i(n) { var e = document.querySelectorAll(".sign-in-wrapper .dropdown-menu"); e.forEach(function(t, a) { var o = ReactDOM.createRoot(t, { identifierPrefix: "quurSignInLinks" + a.toString() + "Ids" }); o.render( /* @__PURE__ */ React.createElement(c, { link_groups: r, links: n }) ); }); } fetch( "/contentapi/jsonapi/node/sign_in_links?include=field_link_group&sort=field_order" ).then((n) => { n.json().then((e) => { e.included.forEach((t) => { r[t.id] = t.attributes.name; }), e.data.forEach((t) => { let a = []; t.relationships.field_link_group.data.forEach((o) => { a.push(r[o.id]); }), s.push({ title: t.attributes.title, order: t.attributes.field_order, url: t.attributes.field_url.uri, groups: a }); }), i(s); }); }).catch((n) => { console.log(n); }); } function f() { function i() { typeof React < "u" && typeof ReactDOM < "u" && (clearInterval(n), d()); } const n = setInterval(i, 5); } function p() { document.addEventListener("DOMContentLoaded", f); } const h = p(); export { h as default };