import { grid as i, grouped as c, list as m } from "@universityofmaryland/web-feeds-library/events";
import { Attributes as o, Register as r } from "@universityofmaryland/web-model-library";
import { featured as d, grid as l, list as f } from "@universityofmaryland/web-feeds-library/news";
const s = ({ element: e }) => {
  const t = o.getValue.feedToken({ element: e });
  if (!t) {
    console.error("Feed events requires a token to be set");
    return;
  }
  const n = o.getValue.feedFilterIds({ element: e });
  return {
    token: t,
    isThemeDark: o.isTheme.dark({ element: e }),
    isLazyLoad: o.includesFeature.lazyLoad({ element: e }),
    ...n && { categories: n.split(",") }
  };
}, g = "umd-feed-events", C = (e) => {
  const t = s({ element: e });
  if (!t)
    return console.error("Feed events requires a token to be set"), { element: document.createElement("div"), styles: "" };
  const n = Number(o.getValue.layoutColumnCount({ element: e })) || 3, a = Number(o.getValue.layoutRowCount({ element: e })) || 1;
  return i({
    ...t,
    numberOfColumnsToShow: Math.min(Math.max(n, 1), 4),
    numberOfRowsToStart: Math.min(Math.max(a, 1), 2),
    isTransparent: o.isVisual.transparent({ element: e })
  });
}, b = r.webComponent({
  tagName: g,
  createComponent: C,
  afterConnect: (e, t) => {
    e?.events?.callback(t);
  }
});
var _ = b;
const p = "umd-feed-events-grouped", v = (e) => {
  const t = s({ element: e });
  return t ? c({
    ...t,
    isLazyLoad: !0,
    numberOfRowsToStart: 10
  }) : (console.error("Feed events requires a token to be set"), { element: document.createElement("div"), styles: "" });
}, w = r.webComponent({
  tagName: p,
  createComponent: v,
  afterConnect: (e, t) => {
    e?.events?.callback(t);
  }
});
var q = w;
const y = "umd-feed-events-list", k = (e) => {
  const t = s({ element: e });
  if (!t)
    return console.error("Feed events requires a token to be set"), { element: document.createElement("div"), styles: "" };
  const n = Number(o.getValue.layoutRowCount({ element: e })) || 5;
  return m({
    ...t,
    numberOfRowsToStart: Math.min(Math.max(n, 1), 10)
  });
}, T = r.webComponent({
  tagName: y,
  createComponent: k,
  afterConnect: (e, t) => {
    e?.events?.callback(t);
  }
});
var z = T;
const u = ({ element: e }) => {
  const t = o.getValue.feedToken({ element: e });
  if (!t) {
    console.error("Feed news requires a token to be set");
    return;
  }
  const n = o.getValue.feedFilterIds({ element: e }), a = o.getValue.feedEntryRemoveIds({ element: e });
  return {
    token: t,
    isThemeDark: o.isTheme.dark({ element: e }),
    isLazyLoad: o.includesFeature.lazyLoad({ element: e }),
    isUnion: o.isData.union({ element: e }),
    ...n && { categories: n.split(",") },
    ...a && { entriesToRemove: a.split(",") }
  };
}, $ = "umd-feed-news-featured", h = o.handler.combine(
  o.handler.observe.visuallyPosition({
    callback: (e, t) => e.events?.setPosition(t)
  })
), N = (e) => {
  const t = u({ element: e });
  if (!t)
    return { element: document.createElement("div"), styles: "" };
  const n = o.getValue.topPosition({ element: e });
  return d({
    ...t,
    numberOfRowsToStart: 1,
    isTransparent: o.isVisual.transparent({ element: e }),
    isLayoutReversed: o.isLayout.reverse({ element: e }),
    overwriteStickyPosition: n ? parseInt(n) : void 0
  });
}, R = r.webComponent({
  tagName: $,
  attributes: h,
  createComponent: N,
  afterConnect: (e, t) => {
    e?.events?.callback(t);
  }
});
var P = R;
const V = "umd-feed-news", F = (e) => {
  const t = u({ element: e });
  if (!t)
    return { element: document.createElement("div"), styles: "" };
  const n = Number(o.getValue.layoutColumnCount({ element: e })) || 3, a = Number(o.getValue.layoutRowCount({ element: e })) || 1;
  return l({
    ...t,
    numberOfColumnsToShow: Math.min(Math.max(n, 1), 4),
    numberOfRowsToStart: Math.min(Math.max(a, 1), 2),
    isTransparent: o.isVisual.transparent({ element: e }),
    isTypeOverlay: o.isDisplay.overlay({ element: e })
  });
}, L = r.webComponent({
  tagName: V,
  createComponent: F,
  afterConnect: (e, t) => {
    e?.events?.callback(t);
  }
});
var I = L;
const M = "umd-feed-news-list", O = (e) => {
  const t = u({ element: e });
  if (!t)
    return { element: document.createElement("div"), styles: "" };
  const n = Number(o.getValue.layoutRowCount({ element: e })) || 5;
  return f({
    ...t,
    numberOfRowsToStart: n >= 1 && n <= 10 ? n : 5
  });
}, S = r.webComponent({
  tagName: M,
  createComponent: O,
  afterConnect: (e, t) => {
    e?.events?.callback(t);
  }
});
var A = S;
export {
  q as a,
  I as b,
  A as c,
  P as f,
  _ as g,
  z as l
};
//# sourceMappingURL=list--1BnmUBS.js.map
