UNPKG

@adyen/adyen-platform-experience-web

Version:

![Platform Experience header](https://github.com/Adyen/adyen-platform-experience-web/assets/7926613/18094965-9e01-450e-8dc9-ea84e6b22c2b)

34 lines (33 loc) 1.2 kB
const x = /* @__PURE__ */ (() => { let t = []; const s = (e) => { const n = e.reduce((o, i) => { const c = i instanceof Node ? t.findIndex((u) => { const g = u.element.getAttribute("id"), b = i && (i != null && i.getAttribute) ? i == null ? void 0 : i.getAttribute("id") : null; return g === b; }) : -1; return o === -1 && c !== -1 ? c : o; }, -1); n === -1 ? l(0) : n + 1 <= t.length - 1 && l(n + 1); }, d = (e) => { const n = t.findIndex((o) => o.element.getAttribute("id") === e.getAttribute("id")); n >= 0 && t.splice(n, 1); }, r = (e, n) => { t.findIndex((i) => i.element.getAttribute("id") === e.getAttribute("id")) >= 0 || t.push({ element: e, callback: n }); }, l = (e) => { var o, i; const n = t.length; for (let c = e; c < n; c++) (i = (o = t == null ? void 0 : t[c]) == null ? void 0 : o.callback) == null || i.call(o); t.splice(e); }; return { add: r, remove: d, closeAll: () => { t.forEach((e) => { var n; return (n = e == null ? void 0 : e.callback) == null ? void 0 : n.call(e); }), t = []; }, closePopoversOutsideOfClick: s }; })(); export { x as popoverUtil };