UNPKG

@utahdts/utah-design-system-header

Version:
3,252 lines 114 kB
const R = {
  FLYOUT: (
    /** @type {ChildrenMenuTypes} */
    "flyout"
  ),
  INLINE: (
    /** @type {ChildrenMenuTypes} */
    "inline"
  ),
  MEGA_MENU: (
    /** @type {ChildrenMenuTypes} */
    "mega-menu"
  ),
  PLAIN: (
    /** @type {ChildrenMenuTypes} */
    "plain"
  )
}, Ie = {
  BOTTOM: (
    /** @type {PopupPlacementType} */
    "bottom"
  ),
  BOTTOM_START: (
    /** @type {PopupPlacementType} */
    "bottom-start"
  ),
  BOTTOM_END: (
    /** @type {PopupPlacementType} */
    "bottom-end"
  ),
  LEFT: (
    /** @type {PopupPlacementType} */
    "left"
  ),
  LEFT_START: (
    /** @type {PopupPlacementType} */
    "left-start"
  ),
  LEFT_END: (
    /** @type {PopupPlacementType} */
    "left-end"
  ),
  RIGHT: (
    /** @type {PopupPlacementType} */
    "right"
  ),
  RIGHT_START: (
    /** @type {PopupPlacementType} */
    "right-start"
  ),
  RIGHT_END: (
    /** @type {PopupPlacementType} */
    "right-end"
  ),
  TOP: (
    /** @type {PopupPlacementType} */
    "top"
  ),
  TOP_START: (
    /** @type {PopupPlacementType} */
    "top-start"
  ),
  TOP_END: (
    /** @type {PopupPlacementType} */
    "top-end"
  )
}, Mt = {
  // Fired when the utah header is first loaded (setUtahHeaderSettings does not trigger this)
  HEADER_LOADED: (
    /** @type {Events} */
    "utahHeaderLoaded"
  ),
  // Fired when the header unloads by code calling the function removeHeader() (not when settings updated)
  HEADER_UNLOADED: (
    /** @type {Events} */
    "utahHeaderUnloaded"
  )
}, me = {
  SMALL: (
    /** @type {Size} */
    "SMALL"
  ),
  MEDIUM: (
    /** @type {Size} */
    "MEDIUM"
  ),
  LARGE: (
    /** @type {Size} */
    "LARGE"
  )
}, en = `/* @media is never in scope for --variables, so this is the only way to solve this. :-( */

@media screen and (max-width: media-size__tablet-landscape__PLACEHOLDER) {
  /* put your media query here for tablet landscape */
  .utah-design-system .search-modal__input[type=text] {
    width: 75vw;
  }
}

@media screen and (max-width: media-size__tablet-portrait__PLACEHOLDER) {
  .utds-header-desktop--hidden {
    display: flex !important;
  }
  .utds-header-mobile--hidden {
    display: none !important;
  }
  .utds-header {
    height: 60px;
    padding: var(--spacing-xs) var(--spacing);
  }
  .utds-title-wrapper {
    font-size: var(--font-size-xl);
  }
  .utds-citizen-experience-wrapper {
    display: none;
  }
  .utds-citizen-experience-wrapper--mobile {
    display: flex;
  }
  .utah-design-system .main-menu__wrapper {
    padding: 0 var(--spacing);
    /* The utah id button is this tall, but without it, the menu doesn't fill the space up to the mobile menu content popup */
    min-height: 46px;
  }
  .utah-design-system .main-menu__nav {
    display: none;
  }
  .utah-design-system.utds-header-mobile-menu,
  .utah-design-system .utds-header-mobile__utah-id-wrapper {
    display: block;
  }
  .utah-design-system .icon-button.main-menu__hamburger,
  .utah-design-system .utds-header-mobile__vip-action-items--left,
  .utah-design-system .utds-header-mobile__vip-action-items--right,
  .utah-design-system .main-menu__search-placeholder {
    display: flex;
  }

  .utah-design-system .search-modal__input[type=text] {
    width: 80vw;
    padding: var(--spacing) var(--spacing) var(--spacing) var(--spacing-3xl);
  }
  .utah-design-system .search-modal__button-wrapper {
    right: unset;
    left: 50%;
    transform: translateX(-50%) translateY(110%);
  }
  .utah-design-system .search-modal__button.button--solid.button--primary-color {
    border-color: white;
    width: max-content;
  }

  .utah-design-system .utds-official-website-popup__content {
    flex-wrap: wrap;
    gap: var(--spacing-l);
  }
  .utah-design-system .utds-official-website-popup__col {
    width: 100%;
  }
  .utah-design-system .utds-official-website-popup__address-bar {
    width: auto;
    background-size: contain;
    background-repeat: no-repeat;
  }

  .color-example {
    flex-direction: column;
  }
  .color-example > div:not(:last-child) {
    margin-bottom: var(--spacing-l);
  }

  .search-page {
    .search-modal__form {
      margin-bottom: var(--spacing-4xl);
    }
    .search-modal__input[type=text] {
      padding: var(--spacing) var(--spacing) var(--spacing) var(--spacing-3xl);
    }
  }
}

@media screen and (max-width: media-size__mobile__PLACEHOLDER) {
  /* put your media query here for mobile */
}
`;
function f(e) {
  return `.${(Array.isArray(e) ? e : [e]).join(".")}`;
}
const r = {
  // Global Information
  UTAH_DESIGN_SYSTEM: "utah-design-system",
  HEADER: "utds-header",
  FOOTER: "utds-footer",
  // HTML elements
  ICON_BUTTON: "icon-button",
  // IDs
  CSS_HEADER_MEDIA_TAG_ID: "cssHeaderMediaTag",
  // Modifiers
  IS_CLOSED: "is-closed",
  IS_OPEN: "is-open",
  VISUALLY_HIDDEN: "visually-hidden",
  // Replacement Placeholders
  MEDIA_SIZE__MOBILE__PLACEHOLDER: "media-size__mobile__PLACEHOLDER",
  MEDIA_SIZE__TABLET_LANDSCAPE__PLACEHOLDER: "media-size__tablet-landscape__PLACEHOLDER",
  MEDIA_SIZE__TABLET_PORTRAIT__PLACEHOLDER: "media-size__tablet-portrait__PLACEHOLDER",
  // Header Components
  ACTION_ITEM: "utds-header-action-item",
  ACTION_ITEM__ICON_BUTTON: "utds-header-action-item__icon-button",
  ACTION_ITEM__ICON_BUTTON_TITLE: "utds-header-action-item__icon-button--has-title",
  ACTION_ITEM__TITLE: "utds-header-action-item__title",
  BADGE__LABEL: "utds-badge__label",
  BADGE__VALUE: "utds-badge__value",
  BADGE_WRAPPER__SMALL: "utds-badge__wrapper--small",
  BADGE_WRAPPER__ACTION_ITEM: "utds-badge__wrapper--action-item",
  CITIZEN_EXPERIENCE: "utds-citizen-experience-wrapper",
  CITIZEN_EXPERIENCE_MOBILE: "utds-citizen-experience-wrapper--mobile",
  FOOTER_COPYRIGHT_YEAR: "utds-footer__copyright-year",
  FOOTER_HORIZONTAL_DIVIDER: "utds-footer__horizontal-divider",
  FOOTER_LINK_PRIVACY_ID: "utds-footer-privacy-link",
  FOOTER_LINK_TERMS_ID: "utds-footer-terms-link",
  FOOTER_LINKS: "utds-footer__links",
  LOGO: "utds-logo-wrapper",
  LOGO_OFFICIAL_CLOSE_BUTTON: "utds-official-website-popup__close-button",
  LOGO_OFFICIAL_WRAPPER: "utds-official-website-popup__wrapper",
  LOGO_SVG: "utah-logo-svg",
  MAIN_MENU: "main-menu__wrapper",
  MAIN_MENU__HAMBURGER_ID: "utds-main-menu__hamburger",
  MAIN_MENU__HAMBURGER_ICON_ID: "utds-main-menu__hamburger-icon",
  MAIN_MENU__MENU_TOP: "main-menu__menu-top",
  MAIN_MENU__NAV: "main-menu__nav",
  MAIN_MENU__OUTER: "main-menu__outer",
  MAIN_MENU__REMOVED: "main-menu-is-removed",
  MAIN_MENU__SEARCH: "main-menu__search",
  MAIN_MENU__TITLE: "main-menu__title",
  MENU_ITEM__ARROW: "menu-item__menu-arrow",
  MENU_ITEM__BUTTON_TITLE: "menu-item__button-title",
  MENU_ITEM__LINK_TITLE: "menu-item__link-title",
  MENU_ITEM__LINK_TITLE_SPAN: "menu-item__link-title-span",
  MENU_ITEM__SELECTED: "menu-item--selected",
  MENU_ITEM__SELECTED_PARENT: "menu-item--selected_parent",
  MENU_ITEM__TITLE: "menu-item__title",
  MENU_ITEM__FLY_OUT: "menu-item--fly_out",
  MENU_ITEM__INLINE: "menu-item--inline",
  MENU_ITEM__MEGA_MENU: "menu-item--mega-menu",
  DESKTOP__HIDDEN: "utds-header-desktop--hidden",
  MOBILE__HIDDEN: "utds-header-mobile--hidden",
  MOBILE__UTAH_ID: "utds-header-mobile__utah-id-wrapper",
  ACTION_ITEM__SELECTED: "utds-header-mobile-menu__action-item--selected",
  MOBILE_MENU: "utds-header-mobile-menu",
  MOBILE_MENU__ACTION_BAR: "utds-header-mobile-menu__action-bar",
  MOBILE_MENU__BACKDROP: "utds-header-mobile-menu__backdrop",
  MOBILE_MENU__CONTENT: "utds-header-mobile-menu__content",
  MOBILE_MENU__CONTENT_ITEM: "utds-header-mobile-menu__content-item",
  MOBILE_MENU__LAST_FOCUSABLE: "utds-header-mobile-menu__hidden-last-focusable",
  MOBILE_MENU__WRAPPER: "utds-header-mobile-menu__wrapper",
  MOBILE_MENU_ACTON_BAR__HOME_ID: "utds-header-mobile-menu_action-bar__home",
  MOBILE_MENU_ACTON_BAR__PROFILE_ID: "utds-header-mobile-menu_action-bar__profile",
  MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER: "utds-header-mobile-menu__action-item",
  VERTICAL_MENU__BUTTON_TITLE: "vertical-menu__button-title",
  VERTICAL_MENU__CHEVRON: "vertical-menu__chevron",
  VERTICAL_MENU__DIVIDER: "vertical-menu__divider",
  VERTICAL_MENU__LINK_TEXT: "vertical-menu__link-text",
  VERTICAL_MENU__LINK_TITLE: "vertical-menu__link-title",
  VERTICAL_MENU__PLAIN_TITLE: "vertical-menu__plain-title",
  VERTICAL_MENU__TITLE: "vertical-menu__title",
  VERTICAL_MENU_WRAPPER__WRAPPER_TITLE: "vertical-menu__wrapper-title",
  POPUP__HIDDEN: "popup__wrapper--hidden",
  POPUP__VISIBLE: "popup__wrapper--visible",
  POPUP_ARROW: "popup__arrow",
  POPUP_CONTENT_WRAPPER: "popup__content",
  POPUP_WRAPPER: "popup__wrapper",
  SEARCH__SEARCH_BACKDROP: "search-backdrop",
  SEARCH__SEARCH_CLOSE_BUTTON: "search-modal__close-button",
  SEARCH__SEARCH_BUTTON: "search-modal__button",
  SEARCH__SEARCH_BUTTON_WRAPPER: "search-modal__button-wrapper",
  SEARCH__SEARCH_INPUT: "search-modal__input",
  SEARCH__SEARCH_MODAL: "search-modal",
  SKIP_LINK_LINK: "skip-link__link",
  SKIP_LINK_WRAPPER: "skip-link__wrapper",
  TITLE__LOGO: "utds-title-wrapper__logo",
  TITLE__TITLE: "utds-title-wrapper__title",
  TOOLTIP__ARROW: "tooltip__arrow",
  TOOLTIP__CONTENT: "tooltip__content",
  TOOLTIP__WRAPPER: "tooltip__wrapper",
  TOOLTIP__WRAPPER__HIDDEN: "tooltip__wrapper--hidden",
  TOOLTIP__WRAPPER__VISIBLE: "tooltip__wrapper--visible",
  UTAH_ID: "utds-utah-id-wrapper",
  UTAH_ID__BUTTON: "utds-utah-id__button"
};
function x(e, t) {
  if (e)
    throw new Error(t);
}
function T(e, t) {
  if (e == null)
    throw new Error(t);
  return e;
}
function at(e) {
  return typeof e == "string" || e instanceof String;
}
function tn(e) {
  const t = new DOMParser();
  let n;
  if (at(e)) {
    const o = (
      /** @type {Document} */
      at(e) ? t.parseFromString(e, "text/html") : e
    ), i = o.body.children.length > 1 ? o.body.children : o.body.children.item(0);
    if (!i)
      throw console.error(e), new Error("renderDOM: nothing rendered");
    n = i;
  } else if (
    /** @type {unknown} */
    e instanceof Element
  )
    n = e;
  else throw e ? (console.error(e), new Error(`renderDOM: str is not a string nor a DOM Element : '${e}'`)) : new Error("renderDOM: falsy string passed; cannot render nothing");
  return n;
}
function I(e) {
  const t = typeof e == "string" ? tn(e) : e;
  if (t instanceof HTMLCollection && t.length > 1)
    throw new Error("renderDOMSingle: must render a single element");
  const n = (
    /** @type {HTMLElement | null} */
    t instanceof HTMLCollection ? t[0] : t
  );
  if (!n)
    throw console.error(e), new Error("renderDOMSingle: nothing rendered");
  return n;
}
const Oe = {
  // @ts-expect-error a blank string is not a valid value; applicationType needs set in the header settings by the application
  applicationType: "",
  onSearch: !1,
  mainMenu: !1,
  mediaSizes: {
    mobile: 640,
    tabletPortrait: 768,
    tabletLandscape: 1024
  },
  showTitle: !0,
  size: me.MEDIUM,
  skipLinkUrl: "#main-content",
  title: "My Utah.gov Site",
  titleUrl: "/",
  utahId: !1
};
function nn(e) {
  if (!e.showTitle && !e.logo)
    throw new Error("validateSettings: A title must be shown if there is no logo. Please change the `showTitle` setting to be `true` or provide a logo image.");
}
class on {
  constructor() {
    this.settings = { ...Oe };
  }
  /**
   * @param {SettingsInput} settings
   */
  setSettings(t) {
    const n = { ...Oe, ...this.settings, ...t };
    nn(n), this.settings = n;
  }
  /**
   * @returns {Settings}
   */
  getSettings() {
    return this.settings;
  }
  /**
   * Mainly for testing purposes? since tests will want a fresh slate every time, and calling
   * setUtahHeaderSettings() does a merge of the settings, this puts settings back to blank
   * starting settings
   */
  clearSettings() {
    this.settings = { ...Oe };
  }
}
const ye = new on();
function M() {
  return ye.getSettings();
}
function w() {
  return (
    // @ts-expect-error this is some funky shtuff
    ("10000000-1000-4000-8000" + -1e11).replace(
      /[018]/g,
      /**
       * @param {number} c
       * @returns {string}
       */
      // eslint-disable-next-line no-bitwise
      (e) => (e ^ T(crypto.getRandomValues(new Uint8Array(1))[0], "uuidv4: crypto") & (15 >> e) / 4).toString(16)
    )
  );
}
const rn = `<div class="utds-header-mobile-menu__content-item" role="tabpanel">
</div>
`;
function Ye(e) {
  const t = document.querySelector(f(r.MOBILE_MENU__WRAPPER));
  if (!t)
    throw new Error("addMobileMenuContentItem: mobileMenuWrapper not found");
  const n = t.querySelector(f(r.MOBILE_MENU__CONTENT));
  if (!n)
    throw new Error("addMobileMenuContentItem: mobileContentWrapper not found");
  const o = I(rn);
  return o.appendChild(e), n.appendChild(o), o.setAttribute("id", w()), o;
}
function W(e) {
  return e instanceof Function ? e() : e;
}
function ge(e) {
  const t = (
    /** @type {HTMLElement} */
    T(
      document.querySelector(f(r.MOBILE_MENU)),
      `${e}: mobileMenu not found`
    )
  ), n = document.getElementById(r.MAIN_MENU__HAMBURGER_ID), o = document.getElementById(r.MAIN_MENU__HAMBURGER_ICON_ID);
  return {
    hamburger: n,
    hamburgerIcon: o,
    mobileMenu: t
  };
}
function Re() {
  const { hamburger: e, hamburgerIcon: t, mobileMenu: n } = ge("hideMobileMenu");
  e?.setAttribute("aria-expanded", "false"), n.classList.remove(r.IS_OPEN), e?.setAttribute("aria-label", "Open the mobile menu"), t?.classList.add("utds-icon-before-hamburger"), t?.classList.remove("utds-icon-before-x-icon"), document.body.style.position = "";
}
function sn() {
  document.querySelector(f(r.MAIN_MENU))?.classList.contains(r.MOBILE__HIDDEN) && document.querySelector(`${f(r.UTAH_DESIGN_SYSTEM)}${f(r.MOBILE_MENU)}`)?.classList.add(r.MAIN_MENU__REMOVED);
  const { hamburger: t, hamburgerIcon: n, mobileMenu: o } = ge("showMobileMenu");
  t?.setAttribute("aria-expanded", "true"), o.classList.add(r.IS_OPEN), t?.setAttribute("aria-label", "Close the mobile menu"), n?.classList.remove("utds-icon-before-hamburger"), n?.classList.add("utds-icon-before-x-icon"), document.body.style.position = "relative";
}
function ke(e, t) {
  e.querySelectorAll(f(r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER)).forEach((o) => {
    o.classList.remove(r.ACTION_ITEM__SELECTED);
    const i = o.querySelector("button");
    if (!i)
      throw new Error("showActionItem: actionWrapper does not have actionItem A");
    i.setAttribute("aria-selected", "false"), i.setAttribute("tabIndex", "-1");
  }), t.classList.add(r.ACTION_ITEM__SELECTED);
  const n = t.querySelector("button");
  if (!n)
    throw new Error("showActionItem: actionWrapper does not have actionItem B");
  n.setAttribute("aria-selected", "true"), n.removeAttribute("tabIndex"), n.focus();
}
function ct(e, t) {
  e.querySelectorAll(f(r.MOBILE_MENU__CONTENT_ITEM)).forEach((n) => n.classList.remove(r.IS_OPEN)), t.classList.add(r.IS_OPEN);
}
function Ke(e, t, n, {
  ariaHasPopupType: o,
  additionalOnClick: i,
  onClickHandler: s,
  shouldOnClickCloseMenu: l
}) {
  if (t && !o)
    throw new Error("mobileMenuInteractionHandler: there is content, but the aria type is not given");
  const c = (
    /** @type {HTMLElement} */
    document.querySelector(f(r.MOBILE_MENU))
  );
  if (!c)
    throw new Error("mobileMenuInteractionHandler: mobileMenu not found");
  const a = (
    /** @type {HTMLElement} */
    document.querySelector(f(r.MOBILE_MENU__WRAPPER))
  );
  if (!a)
    throw new Error("mobileMenuInteractionHandler: mobileMenuWrapper not found");
  const d = (
    /** @type {HTMLElement} */
    a.querySelector(f(r.MOBILE_MENU__CONTENT))
  );
  if (!d)
    throw new Error("mobileMenuInteractionHandler: mobileContentWrapper not found");
  const _ = W(n), p = W(n)?.querySelector?.("button"), m = (p || e).getAttribute("id");
  if (!m)
    throw new Error("mobileMenuInteractionHandler: interactiveElementId not found");
  if (t) {
    const u = W(t);
    if (u) {
      const h = u.getAttribute("id");
      if (!h)
        throw new Error("mobileMenuInteractionHandler: mobileMenuContentId not found");
      (p || e).setAttribute("aria-controls", h), u.setAttribute("aria-labelledby", m);
    }
  }
  if (e.onclick)
    throw new Error("mobileMenuInteractionHandler: interactiveElement already has onclick");
  if (e.onclick = (u) => {
    if (!s?.(u))
      if (i?.(u), c.classList.contains(r.IS_OPEN))
        l && Re();
      else {
        sn();
        const E = W(t);
        E && ct(d, E), ke(a, W(n));
      }
  }, t) {
    if (_ !== e && _.onclick)
      throw new Error("mobileMenuInteractionHandler: actionItemWrapperValue already has onclick");
    _.onclick = (u) => {
      if (!s?.(u)) {
        const h = W(t);
        h && ct(d, h), ke(a, W(n));
      }
    };
  }
}
function j(e) {
  return !e.closest(".menu-item__title") && !e.closest(".vertical-menu__title");
}
function We(e, t, n) {
  let o = !1;
  return e && (Array.isArray(e) ? o = e.some((i) => We(i, t, n)) : (o = n(e), o || (o = !!t?.filter((i) => e[i])?.some((i) => We(e[i], t, n))))), o;
}
const se = Math.min, te = Math.max, Ne = Math.round, Le = Math.floor, F = (e) => ({
  x: e,
  y: e
}), an = {
  left: "right",
  right: "left",
  bottom: "top",
  top: "bottom"
}, cn = {
  start: "end",
  end: "start"
};
function Fe(e, t, n) {
  return te(e, se(t, n));
}
function Ae(e, t) {
  return typeof e == "function" ? e(t) : e;
}
function ne(e) {
  return e.split("-")[0];
}
function ve(e) {
  return e.split("-")[1];
}
function Lt(e) {
  return e === "x" ? "y" : "x";
}
function Ze(e) {
  return e === "y" ? "height" : "width";
}
const ln = /* @__PURE__ */ new Set(["top", "bottom"]);
function Z(e) {
  return ln.has(ne(e)) ? "y" : "x";
}
function je(e) {
  return Lt(Z(e));
}
function un(e, t, n) {
  n === void 0 && (n = !1);
  const o = ve(e), i = je(e), s = Ze(i);
  let l = i === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
  return t.reference[s] > t.floating[s] && (l = Se(l)), [l, Se(l)];
}
function dn(e) {
  const t = Se(e);
  return [Ve(e), t, Ve(t)];
}
function Ve(e) {
  return e.replace(/start|end/g, (t) => cn[t]);
}
const lt = ["left", "right"], ut = ["right", "left"], fn = ["top", "bottom"], pn = ["bottom", "top"];
function _n(e, t, n) {
  switch (e) {
    case "top":
    case "bottom":
      return n ? t ? ut : lt : t ? lt : ut;
    case "left":
    case "right":
      return t ? fn : pn;
    default:
      return [];
  }
}
function hn(e, t, n, o) {
  const i = ve(e);
  let s = _n(ne(e), n === "start", o);
  return i && (s = s.map((l) => l + "-" + i), t && (s = s.concat(s.map(Ve)))), s;
}
function Se(e) {
  return e.replace(/left|right|bottom|top/g, (t) => an[t]);
}
function mn(e) {
  return {
    top: 0,
    right: 0,
    bottom: 0,
    left: 0,
    ...e
  };
}
function wt(e) {
  return typeof e != "number" ? mn(e) : {
    top: e,
    right: e,
    bottom: e,
    left: e
  };
}
function Pe(e) {
  const {
    x: t,
    y: n,
    width: o,
    height: i
  } = e;
  return {
    width: o,
    height: i,
    top: n,
    left: t,
    right: t + o,
    bottom: n + i,
    x: t,
    y: n
  };
}
function dt(e, t, n) {
  let {
    reference: o,
    floating: i
  } = e;
  const s = Z(t), l = je(t), c = Ze(l), a = ne(t), d = s === "y", _ = o.x + o.width / 2 - i.width / 2, p = o.y + o.height / 2 - i.height / 2, m = o[c] / 2 - i[c] / 2;
  let u;
  switch (a) {
    case "top":
      u = {
        x: _,
        y: o.y - i.height
      };
      break;
    case "bottom":
      u = {
        x: _,
        y: o.y + o.height
      };
      break;
    case "right":
      u = {
        x: o.x + o.width,
        y: p
      };
      break;
    case "left":
      u = {
        x: o.x - i.width,
        y: p
      };
      break;
    default:
      u = {
        x: o.x,
        y: o.y
      };
  }
  switch (ve(t)) {
    case "start":
      u[l] -= m * (n && d ? -1 : 1);
      break;
    case "end":
      u[l] += m * (n && d ? -1 : 1);
      break;
  }
  return u;
}
const En = async (e, t, n) => {
  const {
    placement: o = "bottom",
    strategy: i = "absolute",
    middleware: s = [],
    platform: l
  } = n, c = s.filter(Boolean), a = await (l.isRTL == null ? void 0 : l.isRTL(t));
  let d = await l.getElementRects({
    reference: e,
    floating: t,
    strategy: i
  }), {
    x: _,
    y: p
  } = dt(d, o, a), m = o, u = {}, h = 0;
  for (let E = 0; E < c.length; E++) {
    const {
      name: b,
      fn: g
    } = c[E], {
      x: A,
      y: v,
      data: O,
      reset: L
    } = await g({
      x: _,
      y: p,
      initialPlacement: o,
      placement: m,
      strategy: i,
      middlewareData: u,
      rects: d,
      platform: l,
      elements: {
        reference: e,
        floating: t
      }
    });
    _ = A ?? _, p = v ?? p, u = {
      ...u,
      [b]: {
        ...u[b],
        ...O
      }
    }, L && h <= 50 && (h++, typeof L == "object" && (L.placement && (m = L.placement), L.rects && (d = L.rects === !0 ? await l.getElementRects({
      reference: e,
      floating: t,
      strategy: i
    }) : L.rects), {
      x: _,
      y: p
    } = dt(d, m, a)), E = -1);
  }
  return {
    x: _,
    y: p,
    placement: m,
    strategy: i,
    middlewareData: u
  };
};
async function Ot(e, t) {
  var n;
  t === void 0 && (t = {});
  const {
    x: o,
    y: i,
    platform: s,
    rects: l,
    elements: c,
    strategy: a
  } = e, {
    boundary: d = "clippingAncestors",
    rootBoundary: _ = "viewport",
    elementContext: p = "floating",
    altBoundary: m = !1,
    padding: u = 0
  } = Ae(t, e), h = wt(u), b = c[m ? p === "floating" ? "reference" : "floating" : p], g = Pe(await s.getClippingRect({
    element: (n = await (s.isElement == null ? void 0 : s.isElement(b))) == null || n ? b : b.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(c.floating)),
    boundary: d,
    rootBoundary: _,
    strategy: a
  })), A = p === "floating" ? {
    x: o,
    y: i,
    width: l.floating.width,
    height: l.floating.height
  } : l.reference, v = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(c.floating)), O = await (s.isElement == null ? void 0 : s.isElement(v)) ? await (s.getScale == null ? void 0 : s.getScale(v)) || {
    x: 1,
    y: 1
  } : {
    x: 1,
    y: 1
  }, L = Pe(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
    elements: c,
    rect: A,
    offsetParent: v,
    strategy: a
  }) : A);
  return {
    top: (g.top - L.top + h.top) / O.y,
    bottom: (L.bottom - g.bottom + h.bottom) / O.y,
    left: (g.left - L.left + h.left) / O.x,
    right: (L.right - g.right + h.right) / O.x
  };
}
const In = (e) => ({
  name: "arrow",
  options: e,
  async fn(t) {
    const {
      x: n,
      y: o,
      placement: i,
      rects: s,
      platform: l,
      elements: c,
      middlewareData: a
    } = t, {
      element: d,
      padding: _ = 0
    } = Ae(e, t) || {};
    if (d == null)
      return {};
    const p = wt(_), m = {
      x: n,
      y: o
    }, u = je(i), h = Ze(u), E = await l.getDimensions(d), b = u === "y", g = b ? "top" : "left", A = b ? "bottom" : "right", v = b ? "clientHeight" : "clientWidth", O = s.reference[h] + s.reference[u] - m[u] - s.floating[h], L = m[u] - s.reference[u], $ = await (l.getOffsetParent == null ? void 0 : l.getOffsetParent(d));
    let C = $ ? $[v] : 0;
    (!C || !await (l.isElement == null ? void 0 : l.isElement($))) && (C = c.floating[v] || s.floating[h]);
    const ue = O / 2 - L / 2, J = C / 2 - E[h] / 2 - 1, G = se(p[g], J), de = se(p[A], J), Q = G, fe = C - E[h] - de, y = C / 2 - E[h] / 2 + ue, ee = Fe(Q, y, fe), z = !a.arrow && ve(i) != null && y !== ee && s.reference[h] / 2 - (y < Q ? G : de) - E[h] / 2 < 0, U = z ? y < Q ? y - Q : y - fe : 0;
    return {
      [u]: m[u] + U,
      data: {
        [u]: ee,
        centerOffset: y - ee - U,
        ...z && {
          alignmentOffset: U
        }
      },
      reset: z
    };
  }
}), gn = function(e) {
  return e === void 0 && (e = {}), {
    name: "flip",
    options: e,
    async fn(t) {
      var n, o;
      const {
        placement: i,
        middlewareData: s,
        rects: l,
        initialPlacement: c,
        platform: a,
        elements: d
      } = t, {
        mainAxis: _ = !0,
        crossAxis: p = !0,
        fallbackPlacements: m,
        fallbackStrategy: u = "bestFit",
        fallbackAxisSideDirection: h = "none",
        flipAlignment: E = !0,
        ...b
      } = Ae(e, t);
      if ((n = s.arrow) != null && n.alignmentOffset)
        return {};
      const g = ne(i), A = Z(c), v = ne(c) === c, O = await (a.isRTL == null ? void 0 : a.isRTL(d.floating)), L = m || (v || !E ? [Se(c)] : dn(c)), $ = h !== "none";
      !m && $ && L.push(...hn(c, E, h, O));
      const C = [c, ...L], ue = await Ot(t, b), J = [];
      let G = ((o = s.flip) == null ? void 0 : o.overflows) || [];
      if (_ && J.push(ue[g]), p) {
        const y = un(i, l, O);
        J.push(ue[y[0]], ue[y[1]]);
      }
      if (G = [...G, {
        placement: i,
        overflows: J
      }], !J.every((y) => y <= 0)) {
        var de, Q;
        const y = (((de = s.flip) == null ? void 0 : de.index) || 0) + 1, ee = C[y];
        if (ee && (!(p === "alignment" ? A !== Z(ee) : !1) || // We leave the current main axis only if every placement on that axis
        // overflows the main axis.
        G.every((D) => Z(D.placement) === A ? D.overflows[0] > 0 : !0)))
          return {
            data: {
              index: y,
              overflows: G
            },
            reset: {
              placement: ee
            }
          };
        let z = (Q = G.filter((U) => U.overflows[0] <= 0).sort((U, D) => U.overflows[1] - D.overflows[1])[0]) == null ? void 0 : Q.placement;
        if (!z)
          switch (u) {
            case "bestFit": {
              var fe;
              const U = (fe = G.filter((D) => {
                if ($) {
                  const K = Z(D.placement);
                  return K === A || // Create a bias to the `y` side axis due to horizontal
                  // reading directions favoring greater width.
                  K === "y";
                }
                return !0;
              }).map((D) => [D.placement, D.overflows.filter((K) => K > 0).reduce((K, Qt) => K + Qt, 0)]).sort((D, K) => D[1] - K[1])[0]) == null ? void 0 : fe[0];
              U && (z = U);
              break;
            }
            case "initialPlacement":
              z = c;
              break;
          }
        if (i !== z)
          return {
            reset: {
              placement: z
            }
          };
      }
      return {};
    }
  };
}, bn = /* @__PURE__ */ new Set(["left", "top"]);
async function Tn(e, t) {
  const {
    placement: n,
    platform: o,
    elements: i
  } = e, s = await (o.isRTL == null ? void 0 : o.isRTL(i.floating)), l = ne(n), c = ve(n), a = Z(n) === "y", d = bn.has(l) ? -1 : 1, _ = s && a ? -1 : 1, p = Ae(t, e);
  let {
    mainAxis: m,
    crossAxis: u,
    alignmentAxis: h
  } = typeof p == "number" ? {
    mainAxis: p,
    crossAxis: 0,
    alignmentAxis: null
  } : {
    mainAxis: p.mainAxis || 0,
    crossAxis: p.crossAxis || 0,
    alignmentAxis: p.alignmentAxis
  };
  return c && typeof h == "number" && (u = c === "end" ? h * -1 : h), a ? {
    x: u * _,
    y: m * d
  } : {
    x: m * d,
    y: u * _
  };
}
const An = function(e) {
  return e === void 0 && (e = 0), {
    name: "offset",
    options: e,
    async fn(t) {
      var n, o;
      const {
        x: i,
        y: s,
        placement: l,
        middlewareData: c
      } = t, a = await Tn(t, e);
      return l === ((n = c.offset) == null ? void 0 : n.placement) && (o = c.arrow) != null && o.alignmentOffset ? {} : {
        x: i + a.x,
        y: s + a.y,
        data: {
          ...a,
          placement: l
        }
      };
    }
  };
}, vn = function(e) {
  return e === void 0 && (e = {}), {
    name: "shift",
    options: e,
    async fn(t) {
      const {
        x: n,
        y: o,
        placement: i
      } = t, {
        mainAxis: s = !0,
        crossAxis: l = !1,
        limiter: c = {
          fn: (b) => {
            let {
              x: g,
              y: A
            } = b;
            return {
              x: g,
              y: A
            };
          }
        },
        ...a
      } = Ae(e, t), d = {
        x: n,
        y: o
      }, _ = await Ot(t, a), p = Z(ne(i)), m = Lt(p);
      let u = d[m], h = d[p];
      if (s) {
        const b = m === "y" ? "top" : "left", g = m === "y" ? "bottom" : "right", A = u + _[b], v = u - _[g];
        u = Fe(A, u, v);
      }
      if (l) {
        const b = p === "y" ? "top" : "left", g = p === "y" ? "bottom" : "right", A = h + _[b], v = h - _[g];
        h = Fe(A, h, v);
      }
      const E = c.fn({
        ...t,
        [m]: u,
        [p]: h
      });
      return {
        ...E,
        data: {
          x: E.x - n,
          y: E.y - o,
          enabled: {
            [m]: s,
            [p]: l
          }
        }
      };
    }
  };
};
function Ue() {
  return typeof window < "u";
}
function le(e) {
  return yt(e) ? (e.nodeName || "").toLowerCase() : "#document";
}
function P(e) {
  var t;
  return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
}
function q(e) {
  var t;
  return (t = (yt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
}
function yt(e) {
  return Ue() ? e instanceof Node || e instanceof P(e).Node : !1;
}
function H(e) {
  return Ue() ? e instanceof Element || e instanceof P(e).Element : !1;
}
function V(e) {
  return Ue() ? e instanceof HTMLElement || e instanceof P(e).HTMLElement : !1;
}
function ft(e) {
  return !Ue() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof P(e).ShadowRoot;
}
const Mn = /* @__PURE__ */ new Set(["inline", "contents"]);
function Me(e) {
  const {
    overflow: t,
    overflowX: n,
    overflowY: o,
    display: i
  } = B(e);
  return /auto|scroll|overlay|hidden|clip/.test(t + o + n) && !Mn.has(i);
}
const Ln = /* @__PURE__ */ new Set(["table", "td", "th"]);
function wn(e) {
  return Ln.has(le(e));
}
const On = [":popover-open", ":modal"];
function De(e) {
  return On.some((t) => {
    try {
      return e.matches(t);
    } catch {
      return !1;
    }
  });
}
const yn = ["transform", "translate", "scale", "rotate", "perspective"], Nn = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Sn = ["paint", "layout", "strict", "content"];
function Xe(e) {
  const t = Je(), n = H(e) ? B(e) : e;
  return yn.some((o) => n[o] ? n[o] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || Nn.some((o) => (n.willChange || "").includes(o)) || Sn.some((o) => (n.contain || "").includes(o));
}
function Pn(e) {
  let t = X(e);
  for (; V(t) && !ae(t); ) {
    if (Xe(t))
      return t;
    if (De(t))
      return null;
    t = X(t);
  }
  return null;
}
function Je() {
  return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
}
const Cn = /* @__PURE__ */ new Set(["html", "body", "#document"]);
function ae(e) {
  return Cn.has(le(e));
}
function B(e) {
  return P(e).getComputedStyle(e);
}
function xe(e) {
  return H(e) ? {
    scrollLeft: e.scrollLeft,
    scrollTop: e.scrollTop
  } : {
    scrollLeft: e.scrollX,
    scrollTop: e.scrollY
  };
}
function X(e) {
  if (le(e) === "html")
    return e;
  const t = (
    // Step into the shadow DOM of the parent of a slotted node.
    e.assignedSlot || // DOM Element detected.
    e.parentNode || // ShadowRoot detected.
    ft(e) && e.host || // Fallback.
    q(e)
  );
  return ft(t) ? t.host : t;
}
function Nt(e) {
  const t = X(e);
  return ae(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : V(t) && Me(t) ? t : Nt(t);
}
function be(e, t, n) {
  var o;
  t === void 0 && (t = []), n === void 0 && (n = !0);
  const i = Nt(e), s = i === ((o = e.ownerDocument) == null ? void 0 : o.body), l = P(i);
  if (s) {
    const c = qe(l);
    return t.concat(l, l.visualViewport || [], Me(i) ? i : [], c && n ? be(c) : []);
  }
  return t.concat(i, be(i, [], n));
}
function qe(e) {
  return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
}
function St(e) {
  const t = B(e);
  let n = parseFloat(t.width) || 0, o = parseFloat(t.height) || 0;
  const i = V(e), s = i ? e.offsetWidth : n, l = i ? e.offsetHeight : o, c = Ne(n) !== s || Ne(o) !== l;
  return c && (n = s, o = l), {
    width: n,
    height: o,
    $: c
  };
}
function Qe(e) {
  return H(e) ? e : e.contextElement;
}
function re(e) {
  const t = Qe(e);
  if (!V(t))
    return F(1);
  const n = t.getBoundingClientRect(), {
    width: o,
    height: i,
    $: s
  } = St(t);
  let l = (s ? Ne(n.width) : n.width) / o, c = (s ? Ne(n.height) : n.height) / i;
  return (!l || !Number.isFinite(l)) && (l = 1), (!c || !Number.isFinite(c)) && (c = 1), {
    x: l,
    y: c
  };
}
const Rn = /* @__PURE__ */ F(0);
function Pt(e) {
  const t = P(e);
  return !Je() || !t.visualViewport ? Rn : {
    x: t.visualViewport.offsetLeft,
    y: t.visualViewport.offsetTop
  };
}
function Un(e, t, n) {
  return t === void 0 && (t = !1), !n || t && n !== P(e) ? !1 : t;
}
function oe(e, t, n, o) {
  t === void 0 && (t = !1), n === void 0 && (n = !1);
  const i = e.getBoundingClientRect(), s = Qe(e);
  let l = F(1);
  t && (o ? H(o) && (l = re(o)) : l = re(e));
  const c = Un(s, n, o) ? Pt(s) : F(0);
  let a = (i.left + c.x) / l.x, d = (i.top + c.y) / l.y, _ = i.width / l.x, p = i.height / l.y;
  if (s) {
    const m = P(s), u = o && H(o) ? P(o) : o;
    let h = m, E = qe(h);
    for (; E && o && u !== h; ) {
      const b = re(E), g = E.getBoundingClientRect(), A = B(E), v = g.left + (E.clientLeft + parseFloat(A.paddingLeft)) * b.x, O = g.top + (E.clientTop + parseFloat(A.paddingTop)) * b.y;
      a *= b.x, d *= b.y, _ *= b.x, p *= b.y, a += v, d += O, h = P(E), E = qe(h);
    }
  }
  return Pe({
    width: _,
    height: p,
    x: a,
    y: d
  });
}
function et(e, t) {
  const n = xe(e).scrollLeft;
  return t ? t.left + n : oe(q(e)).left + n;
}
function Ct(e, t, n) {
  n === void 0 && (n = !1);
  const o = e.getBoundingClientRect(), i = o.left + t.scrollLeft - (n ? 0 : (
    // RTL <body> scrollbar.
    et(e, o)
  )), s = o.top + t.scrollTop;
  return {
    x: i,
    y: s
  };
}
function Dn(e) {
  let {
    elements: t,
    rect: n,
    offsetParent: o,
    strategy: i
  } = e;
  const s = i === "fixed", l = q(o), c = t ? De(t.floating) : !1;
  if (o === l || c && s)
    return n;
  let a = {
    scrollLeft: 0,
    scrollTop: 0
  }, d = F(1);
  const _ = F(0), p = V(o);
  if ((p || !p && !s) && ((le(o) !== "body" || Me(l)) && (a = xe(o)), V(o))) {
    const u = oe(o);
    d = re(o), _.x = u.x + o.clientLeft, _.y = u.y + o.clientTop;
  }
  const m = l && !p && !s ? Ct(l, a, !0) : F(0);
  return {
    width: n.width * d.x,
    height: n.height * d.y,
    x: n.x * d.x - a.scrollLeft * d.x + _.x + m.x,
    y: n.y * d.y - a.scrollTop * d.y + _.y + m.y
  };
}
function xn(e) {
  return Array.from(e.getClientRects());
}
function Hn(e) {
  const t = q(e), n = xe(e), o = e.ownerDocument.body, i = te(t.scrollWidth, t.clientWidth, o.scrollWidth, o.clientWidth), s = te(t.scrollHeight, t.clientHeight, o.scrollHeight, o.clientHeight);
  let l = -n.scrollLeft + et(e);
  const c = -n.scrollTop;
  return B(o).direction === "rtl" && (l += te(t.clientWidth, o.clientWidth) - i), {
    width: i,
    height: s,
    x: l,
    y: c
  };
}
function Bn(e, t) {
  const n = P(e), o = q(e), i = n.visualViewport;
  let s = o.clientWidth, l = o.clientHeight, c = 0, a = 0;
  if (i) {
    s = i.width, l = i.height;
    const d = Je();
    (!d || d && t === "fixed") && (c = i.offsetLeft, a = i.offsetTop);
  }
  return {
    width: s,
    height: l,
    x: c,
    y: a
  };
}
const kn = /* @__PURE__ */ new Set(["absolute", "fixed"]);
function Wn(e, t) {
  const n = oe(e, !0, t === "fixed"), o = n.top + e.clientTop, i = n.left + e.clientLeft, s = V(e) ? re(e) : F(1), l = e.clientWidth * s.x, c = e.clientHeight * s.y, a = i * s.x, d = o * s.y;
  return {
    width: l,
    height: c,
    x: a,
    y: d
  };
}
function pt(e, t, n) {
  let o;
  if (t === "viewport")
    o = Bn(e, n);
  else if (t === "document")
    o = Hn(q(e));
  else if (H(t))
    o = Wn(t, n);
  else {
    const i = Pt(e);
    o = {
      x: t.x - i.x,
      y: t.y - i.y,
      width: t.width,
      height: t.height
    };
  }
  return Pe(o);
}
function Rt(e, t) {
  const n = X(e);
  return n === t || !H(n) || ae(n) ? !1 : B(n).position === "fixed" || Rt(n, t);
}
function Fn(e, t) {
  const n = t.get(e);
  if (n)
    return n;
  let o = be(e, [], !1).filter((c) => H(c) && le(c) !== "body"), i = null;
  const s = B(e).position === "fixed";
  let l = s ? X(e) : e;
  for (; H(l) && !ae(l); ) {
    const c = B(l), a = Xe(l);
    !a && c.position === "fixed" && (i = null), (s ? !a && !i : !a && c.position === "static" && !!i && kn.has(i.position) || Me(l) && !a && Rt(e, l)) ? o = o.filter((_) => _ !== l) : i = c, l = X(l);
  }
  return t.set(e, o), o;
}
function Vn(e) {
  let {
    element: t,
    boundary: n,
    rootBoundary: o,
    strategy: i
  } = e;
  const l = [...n === "clippingAncestors" ? De(t) ? [] : Fn(t, this._c) : [].concat(n), o], c = l[0], a = l.reduce((d, _) => {
    const p = pt(t, _, i);
    return d.top = te(p.top, d.top), d.right = se(p.right, d.right), d.bottom = se(p.bottom, d.bottom), d.left = te(p.left, d.left), d;
  }, pt(t, c, i));
  return {
    width: a.right - a.left,
    height: a.bottom - a.top,
    x: a.left,
    y: a.top
  };
}
function qn(e) {
  const {
    width: t,
    height: n
  } = St(e);
  return {
    width: t,
    height: n
  };
}
function $n(e, t, n) {
  const o = V(t), i = q(t), s = n === "fixed", l = oe(e, !0, s, t);
  let c = {
    scrollLeft: 0,
    scrollTop: 0
  };
  const a = F(0);
  function d() {
    a.x = et(i);
  }
  if (o || !o && !s)
    if ((le(t) !== "body" || Me(i)) && (c = xe(t)), o) {
      const u = oe(t, !0, s, t);
      a.x = u.x + t.clientLeft, a.y = u.y + t.clientTop;
    } else i && d();
  s && !o && i && d();
  const _ = i && !o && !s ? Ct(i, c) : F(0), p = l.left + c.scrollLeft - a.x - _.x, m = l.top + c.scrollTop - a.y - _.y;
  return {
    x: p,
    y: m,
    width: l.width,
    height: l.height
  };
}
function He(e) {
  return B(e).position === "static";
}
function _t(e, t) {
  if (!V(e) || B(e).position === "fixed")
    return null;
  if (t)
    return t(e);
  let n = e.offsetParent;
  return q(e) === n && (n = n.ownerDocument.body), n;
}
function Ut(e, t) {
  const n = P(e);
  if (De(e))
    return n;
  if (!V(e)) {
    let i = X(e);
    for (; i && !ae(i); ) {
      if (H(i) && !He(i))
        return i;
      i = X(i);
    }
    return n;
  }
  let o = _t(e, t);
  for (; o && wn(o) && He(o); )
    o = _t(o, t);
  return o && ae(o) && He(o) && !Xe(o) ? n : o || Pn(e) || n;
}
const Gn = async function(e) {
  const t = this.getOffsetParent || Ut, n = this.getDimensions, o = await n(e.floating);
  return {
    reference: $n(e.reference, await t(e.floating), e.strategy),
    floating: {
      x: 0,
      y: 0,
      width: o.width,
      height: o.height
    }
  };
};
function zn(e) {
  return B(e).direction === "rtl";
}
const Yn = {
  convertOffsetParentRelativeRectToViewportRelativeRect: Dn,
  getDocumentElement: q,
  getClippingRect: Vn,
  getOffsetParent: Ut,
  getElementRects: Gn,
  getClientRects: xn,
  getDimensions: qn,
  getScale: re,
  isElement: H,
  isRTL: zn
};
function Dt(e, t) {
  return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
}
function Kn(e, t) {
  let n = null, o;
  const i = q(e);
  function s() {
    var c;
    clearTimeout(o), (c = n) == null || c.disconnect(), n = null;
  }
  function l(c, a) {
    c === void 0 && (c = !1), a === void 0 && (a = 1), s();
    const d = e.getBoundingClientRect(), {
      left: _,
      top: p,
      width: m,
      height: u
    } = d;
    if (c || t(), !m || !u)
      return;
    const h = Le(p), E = Le(i.clientWidth - (_ + m)), b = Le(i.clientHeight - (p + u)), g = Le(_), v = {
      rootMargin: -h + "px " + -E + "px " + -b + "px " + -g + "px",
      threshold: te(0, se(1, a)) || 1
    };
    let O = !0;
    function L($) {
      const C = $[0].intersectionRatio;
      if (C !== a) {
        if (!O)
          return l();
        C ? l(!1, C) : o = setTimeout(() => {
          l(!1, 1e-7);
        }, 1e3);
      }
      C === 1 && !Dt(d, e.getBoundingClientRect()) && l(), O = !1;
    }
    try {
      n = new IntersectionObserver(L, {
        ...v,
        // Handle <iframe>s
        root: i.ownerDocument
      });
    } catch {
      n = new IntersectionObserver(L, v);
    }
    n.observe(e);
  }
  return l(!0), s;
}
function Zn(e, t, n, o) {
  o === void 0 && (o = {});
  const {
    ancestorScroll: i = !0,
    ancestorResize: s = !0,
    elementResize: l = typeof ResizeObserver == "function",
    layoutShift: c = typeof IntersectionObserver == "function",
    animationFrame: a = !1
  } = o, d = Qe(e), _ = i || s ? [...d ? be(d) : [], ...be(t)] : [];
  _.forEach((g) => {
    i && g.addEventListener("scroll", n, {
      passive: !0
    }), s && g.addEventListener("resize", n);
  });
  const p = d && c ? Kn(d, n) : null;
  let m = -1, u = null;
  l && (u = new ResizeObserver((g) => {
    let [A] = g;
    A && A.target === d && u && (u.unobserve(t), cancelAnimationFrame(m), m = requestAnimationFrame(() => {
      var v;
      (v = u) == null || v.observe(t);
    })), n();
  }), d && !a && u.observe(d), u.observe(t));
  let h, E = a ? oe(e) : null;
  a && b();
  function b() {
    const g = oe(e);
    E && !Dt(E, g) && n(), E = g, h = requestAnimationFrame(b);
  }
  return n(), () => {
    var g;
    _.forEach((A) => {
      i && A.removeEventListener("scroll", n), s && A.removeEventListener("resize", n);
    }), p?.(), (g = u) == null || g.disconnect(), u = null, a && cancelAnimationFrame(h);
  };
}
const xt = An, Ht = vn, Bt = gn, kt = In, Wt = (e, t, n) => {
  const o = /* @__PURE__ */ new Map(), i = {
    platform: Yn,
    ...n
  }, s = {
    ...i.platform,
    _c: o
  };
  return En(e, t, {
    ...i,
    platform: s
  });
};
function $e(e, t, n, o) {
  t ? (e.classList.remove(o), e.classList.add(n)) : (e.classList.add(o), e.classList.remove(n));
}
let S;
const _e = {}, Ge = {
  SHIFT: "shift-key"
};
function Ft() {
  S && (document.removeEventListener("click", S.globalOnClick), document.removeEventListener("keyup", S.globalOnKeyup), document.removeEventListener("keydown", S.globalOnKeydown), S = null);
}
function ze() {
  const e = [
    `${f(r.UTAH_DESIGN_SYSTEM)} ${f(r.HEADER)} ${f(r.POPUP_WRAPPER)}`,
    `${f(r.UTAH_DESIGN_SYSTEM)} ${f(r.MAIN_MENU)} ${f(r.POPUP_WRAPPER)}`
  ], t = document.querySelectorAll(e.join(","));
  Array.from(t).filter((n) => !n.classList.contains(r.POPUP__HIDDEN)).forEach((n) => {
    const o = n.getAttribute("id");
    if (o) {
      const i = document.querySelector(`[aria-controls="${o}"]`);
      i && j(i) && i.setAttribute("aria-expanded", "false");
    }
    $e(n, !1, r.POPUP__VISIBLE, r.POPUP__HIDDEN);
  });
}
function jn() {
  S && Ft(), S = {
    // eslint-disable-next-line @typescript-eslint/no-empty-function
    globalOnClick: () => {
    },
    // eslint-disable-next-line @typescript-eslint/no-empty-function
    globalOnKeyup: () => {
    },
    // eslint-disable-next-line @typescript-eslint/no-empty-function
    globalOnKeydown: () => {
    }
  }, S.globalOnClick = ze, document.addEventListener("click", S.globalOnClick), S.globalOnKeyup = /** @param {KeyboardEvent} e */
  ((e) => {
    e.key === "Escape" && ze(), e.shiftKey || (_e[Ge.SHIFT] = !1), _e[e.key] = !1;
  }), document.addEventListener("keyup", S.globalOnKeyup), S.globalOnKeydown = (e) => {
    e.shiftKey && (_e[Ge.SHIFT] = !0), _e[e.key] = !0;
  }, document.addEventListener("keydown", S.globalOnKeydown);
}
function Xn() {
  return "ontouchstart" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
}
function Te(e, t, n, o, i) {
  let s = NaN, l = NaN;
  const c = 350, a = 150, d = 50;
  j(t) && t.setAttribute("aria-expanded", "false"), t.setAttribute("aria-haspopup", o);
  function _(m) {
    clearTimeout(s), clearTimeout(l), (!i?.isPerformPopup || i?.isPerformPopup()) && (s = window.setTimeout(
      () => {
        const u = n.querySelector(f(r.POPUP_ARROW)), h = [
          xt(11),
          Bt(),
          Ht()
        ];
        u && h.push(kt({ element: u })), Wt(
          t,
          n,
          {
            placement: i?.popupPlacement || Ie.BOTTOM,
            middleware: h
          }
        ).then(({ x: E, y: b, middlewareData: g }) => {
          n.setAttribute("data-popup-placement", i?.popupPlacement || Ie.BOTTOM), Object.assign(n.style, {
            left: `${E}px`,
            top: `${b}px`
          }), u && Object.assign(u.style, {
            left: E != null ? `${g?.arrow?.x}px` : "",
            top: b != null ? `${g?.arrow?.y}px` : ""
          });
        }), $e(n, !0, r.POPUP__VISIBLE, r.POPUP__HIDDEN), j(t) && t.setAttribute("aria-expanded", "true"), document.querySelectorAll(f(r.TOOLTIP__WRAPPER)).forEach((E) => E.classList.add(r.TOOLTIP__WRAPPER__HIDDEN));
      },
      m
    ));
  }
  function p(m) {
    clearTimeout(s), clearTimeout(l), (!i?.isPerformPopup || i.isPerformPopup()) && (l = window.setTimeout(
      () => {
        $e(n, !1, r.POPUP__VISIBLE, r.POPUP__HIDDEN), j(t) && t.setAttribute("aria-expanded", "false");
      },
      m
    ));
  }
  if (i?.preventOnClickHandling && (x(!!e.onclick, "popupFocusHandler: wrapper already has an onclick"), e.onclick = (m) => {
    m.stopPropagation();
  }), e.addEventListener("focusin", () => _(a)), e.addEventListener("focusout", () => p(a)), i?.shouldFocusOnHover && (e.addEventListener("mouseenter", () => _(c)), e.addEventListener("mouseleave", () => p(c))), !i?.preventOnClickHandling) {
    if (t.onclick)
      throw new Error("popupFocusHandler: button already has onclick");
    t.onclick = (m) => {
      const u = t.getAttribute("aria-expanded") === "true";
      (!i?.isPerformPopup || i.isPerformPopup()) && (m.stopPropagation(), m.preventDefault(), u && t.getAttribute("aria-expanded") === "true" ? i?.doNotClosePopupOnClick || (p(d), document.activeElement?.blur()) : (Xn() && ze(), _(d))), i?.onClick && i.onClick(m);
    };
  }
}
const tt = `<span class="utds-new-tab-link-a11y">
  <span class="visually-hidden">, opens in a new tab</span>
  <span class="utds-icon-after-external-link" aria-hidden="true"></span>
</span>
`, Jn = `<span class="utds-icon-before-chevron-right vertical-menu__chevron" aria-hidden="true"></span>
`;
function Vt(e, t) {
  let n;
  return typeof t == "function" ? n = t(e) : n = t ?? "Overview", ` ${n}`;
}
const Qn = `<div class="popup__wrapper popup__wrapper--hidden">
  <div class="popup__content">
    <div class="popup__arrow"></div>
  </div>
</div>
`;
function nt(e, t) {
  const n = e.getAttribute("id");
  if (!n)
    throw new Error("renderPopup: labelledByElement does not have an `id` attribute");
  const o = w();
  e.setAttribute("aria-controls", o);
  const i = I(Qn);
  if (i.setAttribute("id", o), i.setAttribute("aria-labelledby", n), t?.removePopupArrow) {
    const s = i.querySelector(f(r.POPUP_ARROW));
    if (!s)
      throw new Error("renderPopup(): popup arrow missing (I wanted to remove it!!)");
    s.remove();
  }
  return i;
}
const eo = `<ul class="vertical-menu" />
`, to = `<li class="vertical-menu__item">
  <span class="vertical-menu__title">
    <span class="vertical-menu__plain-title"></span>
    <a href="#" class="vertical-menu__link-title">
      <span class="vertical-menu__link-text"></span>
    </a>
    <button class="vertical-menu__button-title">
      <span class="vertical-menu__link-text"></span>
    </button>
  </span>
  <span class="vertical-menu__divider" />
</li>
`;
function qt(e) {
  const t = e.closest("li");
  if (!t)
    throw console.error("element", e), new Error("toggleChildMenuExpansion: parent not found for child");
  t.querySelectorAll(":scope > ul").forEach((n) => {
    const o = n.closest("li")?.querySelector(f(r.VERTICAL_MENU__BUTTON_TITLE));
    if (!o)
      throw new Error("toggleChildMenuExpansion: button not found");
    const i = o.querySelector(`:scope > ${f(r.VERTICAL_MENU__CHEVRON)}`);
    if (!i)
      throw new Error("toggleChildMenuExpansion: chevron not found");
    n.classList.toggle(r.VISUALLY_HIDDEN), n.classList.contains(r.VISUALLY_HIDDEN) ? (j(o) && o.setAttribute("aria-expanded", "false"), i.classList.add(r.IS_CLOSED), i.classList.remove(r.IS_OPEN)) : (j(o) && o.setAttribute("aria-expanded", "true"), i.classList.remove(r.IS_CLOSED), i.classList.add(r.IS_OPEN));
  });
}
function no(e) {
  return (t) => {
    t.preventDefault(), t.stopPropagation(), qt(e);
  };
}
function ht() {
  const e = I(Jn);
  return e.classList.add(r.IS_CLOSED), e;
}
function we() {
  setTimeout(() => {
    document.activeElement?.blur();
  }, 0);
}
function oo(e, t, n) {
  const o = I(to), i = o.querySelector(f(r.VERTICAL_MENU__TITLE));
  if (!i)
    throw new Error("renderPopupMenuItem: menuItemTitleWrapper not found");
  const s = (
    /** @type {HTMLElement | null} */
    o.querySelector(f(r.VERTICAL_MENU__BUTTON_TITLE))
  );
  if (!s)
    throw new Error("renderPopupMenuItem: menuButton not found");
  const l = (
    /** @type {HTMLElement | null} */
    o.querySelector(f(r.VERTICAL_MENU__LINK_TITLE))
  );
  if (!l)
    throw new Error("renderPopupMenuItem: aHref not found");
  const c = (
    /** @type {HTMLElement | null} */
    o.querySelector(f(r.VERTICAL_MENU__PLAIN_TITLE))
  );
  if (!c)
    throw new Error("renderPopupMenuItem: plainTitle not found");
  const a = o.querySelector(f(r.VERTICAL_MENU__DIVIDER));
  if (!a)
    throw new Error("renderPopupMenuItem: menuDivider not found");
  const d = o.querySelector(`button ${f(r.VERTICAL_MENU__LINK_TEXT)}`);
  if (!d)
    throw new Error("renderPopupMenuItem: titleSpanButton not found");
  const _ = o.querySelector(`a ${f(r.VERTICAL_MENU__LINK_TEXT)}`);
  if (!_)
    throw new Error("renderPopupMenuItem: titleSpanLink not found");
  const p = t.actionMenu && [...t.actionMenu];
  if (p && (t.actionFunction || t.actionUrl || t.actionFunctionUrl) && !t.isOverviewHidden && p.unshift({
    actionFunction: t.actionFunction,
    actionFunctionUrl: t.actionFunctionUrl,
    actionUrl: t.actionUrl,
    className: t.className,
    icon: t.icon,
    title: `${t.title}${Vt(t, n.parentMenuLinkSuffix)}`
  }), p?.length || (l.onclick = we, s.onclick = we), p) {
    let u;
    switch (n.childrenMenuType) {
      case R.FLYOUT: {
        u = ht(), s.appendChild(u), s.setAttribute("id", w());
        const h = ot(
          {
            menuItems: p,
            title: t.title
          },
          s,
          {
            ...n,
            removePopupArrow: !0
          }
        );
        o.appendChild(h), Te(
          o,
          s,
          h,
          "menu",
          {
            popupPlacement: Ie.RIGHT_START,
            preventOnClickHandling: !0,
            shouldFocusOnHover: !0
          }
        ), l.remove(), c.remove();
        break;
      }
      case R.INLINE: {
        const h = ce(
          p,
          n
        ), E = w();
        h.setAttribute("id", E), h.classList.add(r.VISUALLY_HIDDEN), o.appendChild(h), s.onclick = no(s), j(s) && s.setAttribute("aria-expanded", "false"), s.setAttribute("aria-controls", E), u = ht(), s.appendChild(u), l.remove(), c.remove(), o.addEventListener("focusin", (b) => {
          for (let g = (
            /** @type {Element | null | undefined} */
            b.target?.closest("ul")
          ); g; g = g.parentElement?.closest("ul"))
            g.classList.remove(r.VISUALLY_HIDDEN), j(s) && s.setAttribute("aria-expanded", "true"), b.target !== s && (u?.classList?.remove(r.IS_CLOSED), u?.classList?.add(r.IS_OPEN));
        });
        break;
      }
      case R.MEGA_MENU: {
        const h = ce(
          p,
          n
        ), E = w();
        h.setAttribute("id", E), o.appendChild(h), l.remove(), s.remove(), c.appendChild(document.createTextNode(t.title));
        break;
      }
      default:
        throw new Error(`renderPopupMenuItem: childrenMenuType unknown '${n.childrenMenuType}'`);
    }
    a.remove();
  } else if (t.actionFunction)
    s.onclick = (u) => {
      t.actionFunction?.(u), we();
    }, l.remove(), a.remove(), c.remove();
  else if (t.actionUrl)
    l.setAttribute("href", t.actionUrl.url), s.remove(), a.remove(), c.remove();
  else if (t.actionFunctionUrl)
    l.setAttribute("href", t.actionFunctionUrl.url), l.onclick = (u) => {
      t.actionFunctionUrl?.skipHandleEvent || (u.stopPropagation(), u.preventDefault()), t.actionFunctionUrl?.actionFunction(u), we();
    }, s.remove(), a.remove(), c.remove();
  else if (t.isDivider)
    i.remove(), o.setAttribute("aria-hidden", "true"), o.setAttribute("role", "separator");
  else
    throw console.error(t), new Error("renderPopupMenuItem: popupMenuItem must have either actionMenu, actionFunction, actionUrl, or isDivider (popupMenuItem.title)");
  if (!t.isDivider) {
    if (t.icon) {
      const u = I(t.icon);
      u.setAttribute("role", "presentation"), d.appendChild(u), _.appendChild(u);
    }
    if (d.appendChild(document.createTextNode(t.title)), _.appendChild(document.createTextNode(t.title)), t.actionUrl?.openInNewTab || t.actionFunctionUrl?.openInNewTab) {
      l.setAttribute("target", "_blank");
      const u = I(tt);
      d.appendChild(u), _.appendChild(u);
    }
  }
  const m = t.actionMenu?.length ? r.MENU_ITEM__SELECTED_PARENT : r.MENU_ITEM__SELECTED;
  return (t.isSelected || t.actionMenu && We(t.actionMenu, ["actionMenu"], (u) => !!u.isSelected)) && (s.classList.add(m), l.classList.add(m)), n.childrenMenuType !== R.MEGA_MENU && (t.isSelected ? (qt(o), o.classList.add(m)) : o.classList.remove(m)), t.className && o.classList.add(t.className), e.appendChild(o), o;
}
function ce(e, t) {
  const n = I(eo);
  return e?.forEach((o) => oo(n, o, t)), n;
}
function ot(e, t, n) {
  const o = nt(t, { removePopupArrow: n.removePopupArrow }), i = o.querySelector(f(r.POPUP_CONTENT_WRAPPER));
  if (!i)
    throw new Error("renderPopupMenu: contentWrapper not found");
  const s = ce(e.menuItems, n);
  return s.setAttribute("aria-label", e.title), i.appendChild(s), o;
}
const io = `<div class="utds-header-action-item-menu">
  <div class="vertical-menu__wrapper-title"></div>
</div>
`, ro = `<div class="utds-header-mobile-menu__action-item" role="tab">
  <button type="button" class="icon-button icon-button--borderless utds-header-action-item__icon-button">
    <div class="utds-header-action-item__title visually-hidden"></div>
    <span aria-hidden="true" role="presentation">
  </button>
  <span class="menu-chiclet"></span>
</div>
`, so = `<div class="utds-badge__wrapper">
  <span class="utds-badge__value"></span>
  <span class="utds-badge__label visually-hidden"></span>
</div>
`;
function it(e) {
  let t = null;
  if (e) {
    t = /** @type {HTMLElement} */
    I(so), t.classList.add(r.BADGE_WRAPPER__ACTION_ITEM);
    const n = t.querySelector(f(r.BADGE__LABEL));
    if (!n)
      throw new Error("renderActionItemBadge: badgeLabel not found");
    if (n.appendChild(document.createTextNode(e.label)), e.value || e.value === 0) {
      const o = t.querySelector(f(r.BADGE__VALUE));
      if (!o)
        throw new Error("renderActionItemBadge: badgeValue not found");
      o.appendChild(document.createTextNode(`${e.value}`));
    } else
      t.classList.add(r.BADGE_WRAPPER__SMALL);
    e.className && t.classList.add(e.className);
  }
  return t;
}
function ao(e) {
  const t = I(ro);
  t.getAttribute("id") || t.setAttribute("id", w());
  const n = document.createTextNode(e.title), o = (
    /** @type {HTMLElement} */
    t instanceof HTMLCollection ? t[0] : t
  );
  e.showTitle && o.classList.add(r.ACTION_ITEM__ICON_BUTTON_TITLE), o.classList.add(r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER), o.classList.remove(r.ACTION_ITEM);
  const i = o.querySelector(f(r.ACTION_ITEM__TITLE));
  if (!i)
    throw new Error("renderActionItem: titleDiv not found");
  i.appendChild(n), e.showTitle ? i.classList.remove(r.VISUALLY_HIDDEN) : i.classList.add(r.VISUALLY_HIDDEN);
  const s = (
    /** @type {HTMLElement} */
    t.querySelector(f(r.ACTION_ITEM__ICON_BUTTON))
  );
  if (!s)
    throw new Error("renderActionItem: iconButton not found");
  e.className && s.classList.add(e.className);
  const l = it(e.badge);
  l && s.appendChild(l);
  const c = I(e.icon);
  c.setAttribute("role", "presentation"), s.appendChild(c);
  let a = null;
  if (e.actionFunction)
    s.onclick = e.actionFunction;
  else if (e.actionDom) {
    const d = w();
    s.setAttribute("id", d), a = I(typeof e.actionDom == "function" ? e.actionDom() : e.actionDom);
  } else if (e.actionPopupMenu) {
    const d = w();
    s.setAttribute("id", d), a = I(io);
    const _ = a.querySelector(f(r.VERTICAL_MENU_WRAPPER__WRAPPER_TITLE));
    if (!_)
      throw new Error("renderMobileActionItem: actionItemContentTitle not found");
    _.appendChild(document.createTextNode(e.actionPopupMenu.title));
    const p = ce(
      e.actionPopupMenu.menuItems,
      {
        childrenMenuType: R.INLINE,
        parentMenuLinkSuffix: e.actionPopupMenu.parentMenuLinkSuffix
      }
    );
    a.appendChild(p);
  } else
    throw console.error(e), new Error("Action Item: no defined action; must have either actionFunction, actionDom, or actionPopupMenu");
  return { actionItemElement: t, actionItemContent: a };
}
function co() {
  const e = document.getElementById(r.MOBILE_MENU_ACTON_BAR__HOME_ID);
  if (!e)
    throw new Error("renderMobileActionItems: homeActionItem not found");
  const t = (
    /** @type {HTMLElement} */
    e.closest(f(r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER))
  );
  if (!t)
    throw new Error("renderMobileActionItems: homeActionItemWrapper not found");
  const i = (
    /** @type {HTMLElement} */
    (!!M().utahId ? document.getElementById(r.MOBILE_MENU_ACTON_BAR__PROFILE_ID) : null)?.closest?.(f(r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER))
  );
  [...M().actionItems || []].reverse()?.map((l) => ({ actionItem: l, ...ao(l) }))?.forEach(({ actionItem: l, actionItemContent: c, actionItemElement: a }) => {
    let d;
    switch (l.mobileMenuLocation) {
      case "left":
        d = t;
        break;
      case "none":
        d = null;
        break;
      case "right":
      default:
        d = i || t;
        break;
    }
    if (d && (d.after(a), c)) {
      const _ = Ye(c);
      let p = null;
      l.actionDom ? p = "dialog" : l.actionPopupMenu && (p = "menu"), Ke(
        a,
        _,
        a,
        { ariaHasPopupType: p, shouldOnClickCloseMenu: !1 }
      );
    }
  }), M().mainMenu || (e.remove(), t.remove());
}
const lo = `<div class="utds-footer utah-design-system">
  <div class="utds-footer__horizontal-divider">
    <hr />
  </div>
  <div class="utds-footer__utah-logo-wrapper">
    <div class="utah-logo-svg" id="utah-logo-svg">
      <svg viewBox="0 0 107 30.51" role="img">
        <g>
          <path
            d="m12.44,30.51c-4.21,0-7.33-1.22-9.38-3.66C1.02,24.4,0,20.61,0,15.48V0h7.93v16.4c0,2.67.36,4.55,1.08,5.65.77,1.12,2.08,1.74,3.43,1.64,1.36.1,2.68-.52,3.48-1.63.75-1.09,1.13-2.97,1.13-5.65V0h7.65v15.48c0,5.13-1,8.92-3,11.36-2,2.44-5.09,3.66-9.26,3.66Zm24.42-.56V6.64h-7.93V0h23.78v6.64h-7.93v23.31h-7.92Zm26.17-14.56l-.51,2.07h5.53l-.51-2.07c-.37-1.44-.74-3.01-1.11-4.7-.37-1.69-.74-3.29-1.11-4.79h-.18c-.34,1.53-.68,3.14-1.04,4.82-.35,1.68-.71,3.24-1.08,4.68Zm-11.52,14.56L60.64,0h9.58l9.12,29.95h-8.39l-1.48-6.36h-8.38l-1.47,6.36h-8.11Zm30.69,0V0h7.93v11.15h8.94V0h7.93v29.95h-7.93v-11.89h-8.94v11.89h-7.93Z" />
        </g>
      </svg>
    </div>
    <div class="utds-footer__vertical-divider" role="separator" aria-orientation="vertical"></div>
    <div class="utds-footer__official-site-wrapper">
      <div class="utds-footer__official-site">An official website of the <span class="whitespace-no-wrap">state of Utah</span></div>
      <div class="utds-footer__copyright">&copy;<span class="utds-footer__copyright-year">2024</span> State of Utah</div>
    </div>
  </div>
  <div class="utds-footer__links">
    <ul>
      <li>
        <a href="https://www.utah.gov/index.html" target="__blank" rel="noreferrer">Utah.gov Home</a>
      </li>
      <li>
        <a href="https://www.utah.gov/support/disclaimer.html" target="__blank" rel="noreferrer" id="utds-footer-terms-link">Terms of Use</a>
      </li>
      <li>
        <a href="https://www.utah.gov/support/privacypolicy.html" target="__blank" rel="noreferrer" id="utds-footer-privacy-link">Privacy
          Policy</a>
      </li>
      <li>
        <a href="https://www.utah.gov/support/accessibility.html" target="__blank" rel="noreferrer">Accessibility</a>
      </li>
      <li>
        <a href="https://www.utah.gov/support/translate.html" target="__blank" rel="noreferrer">Translate</a>
      </li>
    </ul>
  </div>
</div>
`;
function uo(e, t) {
  const n = T(
    e.querySelector(f(r.FOOTER_COPYRIGHT_YEAR)),
    "renderFooterCopyrightYear: copyrightYearSpan not found"
  );
  n.innerHTML = t ?? "";
}
const k = {
  copyrightYear: void 0,
  domLocationTarget: {
    cssSelector: void 0,
    element: void 0,
    elementFunction: void 0
  },
  showHorizontalRule: !1
};
function fo() {
  const e = M(), t = document.querySelector(f(r.FOOTER));
  let n = t;
  if (e.footer === null)
    t?.remove();
  else if (k.domLocationTarget.cssSelector !== e?.footer?.domLocationTarget?.cssSelector || k.domLocationTarget.element !== e?.footer?.domLocationTarget?.element || k.domLocationTarget.elementFunction !== e?.footer?.domLocationTarget?.elementFunction || k.showHorizontalRule !== e?.footer?.showHorizontalRule || k.copyrightYear !== e?.footer?.copyrightYear || !t) {
    t && t.remove(), n = I(lo);
    let i = document.body;
    if (e?.footer?.domLocationTarget) {
      const c = [
        e?.footer?.domLocationTarget.cssSelector,
        e?.footer?.domLocationTarget.element,
        e?.footer?.domLocationTarget.elementFunction
      ].filter((a) => a);
      if (x(c.length < 1, "renderFooter: footer.domLocationTarget must either have a value for one of its properties or not be specified at all"), x(c.length > 1, "renderFooter: footer.domLocationTarget must only have one target specified"), e?.footer?.domLocationTarget.cssSelector)
        i = document.querySelector(e?.footer?.domLocationTarget.cssSelector), x(!i, `renderFooter: element not found for domLocationTarget.cssSelector ${e?.footer?.domLocationTarget.cssSelector}`);
      else if (e?.footer?.domLocationTarget.element)
        i = e?.footer?.domLocationTarget.element;
      else if (e?.footer?.domLocationTarget.elementFunction)
        i = e?.footer?.domLocationTarget.elementFunction(), x(!i, "renderFooter: element not returned from domLocationTarget.elementFunction");
      else
        throw new Error("renderFooter: domLocationTarget must have at least one field set");
    }
    if (i?.appendChild(n), !e?.footer?.showHorizontalRule) {
      const c = document.querySelector(f(r.FOOTER_HORIZONTAL_DIVIDER));
      x(!c, "renderFooter: cannot remove horizontal rule; not found"), c?.remove();
    }
    if (e?.footer?.linkPrivacyPolicy) {
      const c = document.getElementById(r.FOOTER_LINK_PRIVACY_ID);
      x(!c, "renderFooter: cannot find privacy policy link"), c?.setAttribute("href", e.footer.linkPrivacyPolicy);
    }
    if (e?.footer?.linkTermsOfUse) {
      const c = document.getElementById(r.FOOTER_LINK_TERMS_ID);
      x(!c, "renderFooter: cannot find terms of use link"), c?.setAttribute("href", e.footer.linkTermsOfUse);
    }
    T(document.querySelector(f(r.FOOTER_LINKS)), "renderFooter: footer links not found").querySelectorAll("a").forEach((c) => {
      c.appendChild(I(tt));
    }), uo(n, e?.footer?.copyrightYear), k.copyrightYear = e?.footer?.copyrightYear, k.domLocationTarget.cssSelector = e?.footer?.domLocationTarget?.cssSelector, k.domLocationTarget.element = e?.footer?.domLocationTarget?.element, k.domLocationTarget.elementFunction = e?.footer?.domLocationTarget?.elementFunction, k.showHorizontalRule = e?.footer?.showHorizontalRule;
  }
  return n;
}
const po = `<div class="utds-action-items-wrapper"></div>
`, _o = `<div class="tooltip__wrapper tooltip__wrapper--hidden" aria-hidden="true">
  <div class="tooltip__content">
    <div class="tooltip__arrow"></div>
  </div>
</div>
`;
let ie = NaN;
function Ee(e, t) {
  const n = I(_o), o = n.querySelector(f(r.TOOLTIP__CONTENT)), i = n.querySelector(f(r.TOOLTIP__ARROW));
  let s;
  if (!o)
    throw new Error("hookupTooltip: tooltipContent not found");
  o.appendChild(t), e.appendChild(n);
  const l = [
    xt(5),
    Bt(),
    Ht()
  ];
  i && l.push(kt({ element: i }));
  const c = () => Wt(
    e,
    n,
    {
      placement: Ie.BOTTOM,
      middleware: l
    }
  ).then(({ x: d, y: _, middlewareData: p }) => {
    n.setAttribute("data-popup-placement", Ie.BOTTOM), Object.assign(n.style, {
      left: `${d}px`,
      top: `${_}px`
    }), i && Object.assign(i?.style, {
      left: `${p.arrow?.x}px`,
      top: `${p?.arrow?.y}px`
    });
  });
  if (e.onmouseenter || e.onmouseleave)
    throw new Error("hookupTooltip: element already has an onmouseenter and/or onmouseleave event");
  let a = NaN;
  e.onmouseenter = () => {
    clearTimeout(a), a = window.setTimeout(
      () => {
        clearTimeout(ie), ie = -1;
        const d = e.querySelector(f(r.POPUP_WRAPPER));
        (!d || d.classList.contains(r.POPUP__HIDDEN)) && (n.classList.remove(r.TOOLTIP__WRAPPER__HIDDEN), n.classList.add(r.TOOLTIP__WRAPPER__VISIBLE), s = Zn(
          e,
          n,
          c
        ));
      },
      // tooltip was already opened on another item, so instantly open tooltip
      ie ? 0 : 500
    );
  }, e.onmouseleave = () => {
    clearTimeout(a), n.classList.add(r.TOOLTIP__WRAPPER__HIDDEN), n.classList.remove(r.TOOLTIP__WRAPPER__VISIBLE), typeof s == "function" && s(), clearTimeout(ie), ie = window.setTimeout(
      () => {
        ie = NaN;
      },
      500
    );
  };
}
const ho = `<div class="utds-header-action-item">
  <button type="button" class="icon-button utds-header-action-item__icon-button">
    <div class="utds-header-action-item__title visually-hidden"></div>
  </button>
</div>
`;
function mo(e) {
  const t = I(ho), n = document.createTextNode(e.title), o = (
    /** @type {HTMLElement} */
    t instanceof HTMLCollection ? t[0] : t
  );
  e.showTitle && o.classList.add(r.ACTION_ITEM__ICON_BUTTON_TITLE);
  const i = o.querySelector(f(r.ACTION_ITEM__TITLE));
  if (!i)
    throw new Error("renderActionItem: titleDiv not found");
  i.appendChild(n), e.showTitle ? i.classList.remove(r.VISUALLY_HIDDEN) : i.classList.add(r.VISUALLY_HIDDEN);
  const s = t.querySelector(f(r.ACTION_ITEM__ICON_BUTTON));
  if (!s)
    throw new Error("renderActionItem: iconButton not found");
  e.className && s.classList.add(e.className);
  const l = it(e.badge);
  l && s.appendChild(l);
  const c = I(e.icon);
  if (c.setAttribute("role", "presentation"), s.appendChild(c), !(s instanceof HTMLElement))
    throw new Error("renderActionItem: iconButton is not an HTMLElement");
  if (e.actionFunction)
    s.onclick = e.actionFunction;
  else if (e.actionDom) {
    const a = w();
    s.setAttribute("id", a);
    const d = nt(s), _ = (
      /** @type {HTMLElement} */
      d.querySelector(f(r.POPUP_CONTENT_WRAPPER))
    );
    if (!_)
      throw new Error("renderPopupMenu: contentWrapper not found");
    _.appendChild(I(typeof e.actionDom == "function" ? e.actionDom() : e.actionDom)), t.appendChild(d), Te(o, s, d, "dialog", void 0);
  } else if (e.actionPopupMenu) {
    const a = w();
    s.setAttribute("id", a);
    const d = ot(
      /** @type {PopupMenu} */
      e.actionPopupMenu,
      s,
      {
        childrenMenuType: R.INLINE,
        parentMenuLinkSuffix: e.actionPopupMenu.parentMenuLinkSuffix
      }
    );
    t.appendChild(d), Te(o, s, d, "menu", void 0);
  } else
    throw console.error(e), new Error("Action Item: no defined action; must have either actionFunction, actionDom, or actionPopupMenu");
  return Ee(t, document.createTextNode(e.title)), t;
}
function Eo() {
  const { actionItems: e } = M();
  let t = null;
  return e?.length && (t = I(po), M().actionItems?.map((n) => mo(n))?.forEach((n) => t?.appendChild(n))), t;
}
const Ce = {
  PROFILE: "https://id.utah.gov",
  SIGN_IN: `https://id.utah.gov/login?goto=${window.location}`,
  SIGN_OUT: `https://id.utah.gov/logout?goto=${window.location}`,
  USER_INFO: "https://id.utah.gov/api/userInfo"
}, he = {
  AUTOMATIC: (
    /** @type {UtahIdFetchStyle} */
    "Automatic"
  ),
  NONE: (
    /** @type {UtahIdFetchStyle} */
    "None"
  ),
  PROVIDED: (
    /** @type {UtahIdFetchStyle} */
    "Provided"
  )
};
let mt = he.NONE;
function Io(e) {
  let t;
  if (e === !0)
    t = he.AUTOMATIC;
  else if (e === !1)
    t = he.NONE;
  else if (e === void 0 || e.currentUser === void 0)
    t = he.AUTOMATIC;
  else if (e.currentUser === null || e.currentUser)
    t = he.PROVIDED;
  else
    throw new Error("determineFetchStyle: Unknown utah id fetch style");
  return t;
}
const N = {
  // null = not yet loaded, false = ajaxing, true = have a result (may be error or user data)
  isDefinitive: null,
  lastError: null,
  userInfo: null
};
function Et(e) {
  if (e.isDefinitive) {
    Kt(e);
    const t = M()?.utahId;
    typeof t == "object" && t.onAuthChanged?.(e);
  }
}
let It = !0;
const go = 500;
let gt = NaN;
async function $t() {
  let e = Promise.resolve(N);
  const t = M(), n = Io(t.utahId);
  if (N.isDefinitive === !1)
    e = Promise.resolve(N);
  else if (It)
    clearTimeout(gt), e = new Promise((o) => {
      gt = window.setTimeout(
        () => {
          It = !1, $t().then((i) => o(i)).catch((i) => console.error(i));
        },
        go
      );
    });
  else if (t.utahId === !1)
    e = Promise.resolve({
      isDefinitive: !0,
      lastError: "Utah ID is off",
      userInfo: null
    });
  else if (t.utahId === !0 || t.utahId?.currentUser === void 0)
    (n !== mt || N.isDefinitive === null) && (N.isDefinitive = !1, e = fetch(Ce.USER_INFO, { credentials: "include" }).then((o) => o.json()).then((o) => {
      if (o.status === 200)
        N.lastError = null, N.userInfo = /** @type {UserInfo} */
        o.data;
      else
        throw new Error(o.err);
      return N;
    }).catch((o) => (N.lastError = o, N.userInfo = null, N)).finally(() => (N.isDefinitive = !0, Et(N), N)));
  else {
    const o = {
      isDefinitive: !0,
      lastError: null,
      userInfo: t.utahId?.currentUser
    };
    e = Promise.resolve(o), Et(o);
  }
  return mt = n, e;
}
function bo() {
  return N;
}
function bt(e) {
  e.preventDefault(), e.stopPropagation(), window.location.href = Ce.SIGN_IN;
}
function To() {
  let e;
  const t = M();
  return t.utahId === !1 ? e = null : t.utahId === !0 ? e = bt : e = t.utahId?.onSignIn ?? bt, e;
}
function Ao() {
  const e = bo(), t = M(), n = t.utahId !== !1 && t.utahId !== !0 && !!t.utahId?.currentUser, o = typeof t.utahId == "object" ? t.utahId.currentUser ?? null : e.userInfo;
  return n ? o : e.userInfo;
}
function Gt(e) {
  const t = Ao();
  (!t || !t.authenticated) && To()?.(e);
}
const vo = `<div class="vertical-menu__wrapper">
  <div class="vertical-menu__wrapper-title"></div>
</div>
`;
function zt(e, t) {
  const n = I(vo), o = n.querySelector(f(r.VERTICAL_MENU_WRAPPER__WRAPPER_TITLE));
  if (!o)
    throw new Error("renderMenuWithTitle: menuTitleDiv not found");
  return o.appendChild(document.createTextNode(t)), n.appendChild(e), n;
}
const Mo = `<button class="utds-utah-id__button button--solid" type="button">UtahID Sign In</button>
`, Yt = `<div class="utds-utah-id-wrapper"></div>
`;
let Y = null;
function Kt(e) {
  Y = e, document.querySelectorAll(f(r.UTAH_ID__BUTTON)).forEach((n) => {
    if (n) {
      if (n.innerHTML = "", Y?.userInfo?.authenticated) {
        const s = document.createElement("span");
        s.appendChild(document.createTextNode("UtahID Account:")), s.classList.add(r.VISUALLY_HIDDEN), n.appendChild(s), n.appendChild(document.createTextNode(`Hello, ${Y.userInfo.first || ""}`));
      } else
        n.appendChild(document.createTextNode("UtahID Sign In"));
      const o = n.getAttribute("aria-controls");
      if (!o)
        throw new Error(`authChangedEventHandler: popup id for button not found - ${o}`);
      const i = document.getElementById(o);
      i && rt(n, i);
    }
  });
}
function rt(e, t) {
  e && t && (!!Y?.isDefinitive && !!Y?.userInfo?.authenticated ? (e.setAttribute("aria-haspopup", "menu"), e.setAttribute("aria-expanded", "false"), t.removeAttribute("aria-hidden")) : (e.removeAttribute("aria-haspopup"), e.removeAttribute("aria-expanded"), t.setAttribute("aria-hidden", "true")));
}
function Zt() {
  const e = I(Mo);
  return e.setAttribute("id", w()), Y && Kt(Y), e;
}
function jt(e) {
  const t = M(), n = t.utahId !== !1 && t.utahId !== !0 && t.utahId?.onProfile, o = t.utahId !== !1 && t.utahId !== !0 && t.utahId?.onSignOut, i = [...t.utahId !== !0 && t.utahId !== !1 && t.utahId?.menuItems || []];
  i.length && i.push({
    isDivider: !0,
    title: "--divider--"
  });
  const s = [
    ...i,
    {
      actionUrl: n ? void 0 : { url: Ce.PROFILE, openInNewTab: !0 },
      actionFunction: n || void 0,
      title: "UtahID Profile"
    },
    {
      actionUrl: o ? void 0 : { url: Ce.SIGN_OUT },
      actionFunction: o || void 0,
      title: "Sign Out"
    }
  ], l = ce(s, { childrenMenuType: R.INLINE }), c = e ? zt(l, "Utah ID Menu") : l;
  return c.setAttribute("aria-label", "Utah Id Menu"), c.setAttribute("id", w()), c;
}
function Lo() {
  const e = I(Yt), t = Zt();
  t.setAttribute("id", w()), e.appendChild(t);
  const n = jt(!1), o = nt(t), i = (
    /** @type {HTMLElement} */
    o.querySelector(f(r.POPUP_CONTENT_WRAPPER))
  );
  if (!i)
    throw new Error("renderUtahIdForDesktop: contentWrapper not found");
  return i.appendChild(n), e.appendChild(o), rt(t, o), Te(
    e,
    t,
    o,
    "menu",
    {
      isPerformPopup: () => !!Y?.isDefinitive && !!Y?.userInfo?.authenticated,
      onClick: (s) => Gt(s)
    }
  ), e;
}
function wo() {
  const e = I(Yt), t = Zt(), n = t.getAttribute("id");
  if (!n)
    throw new Error("renderUtahIdForMobile: utahIdButton has no id");
  e.appendChild(t);
  const o = jt(!0), i = o.getAttribute("id");
  if (!i)
    throw new Error("renderUtahIdForMobile: utahIdPopupMenu has no id");
  return e.appendChild(o), t.setAttribute("aria-controls", i), o.setAttribute("aria-labelledby", n), rt(t, o), { button: t, menu: o };
}
const Oo = `<div class="utds-citizen-experience-wrapper"></div>
`;
function yo() {
  const e = I(Oo), t = Eo();
  return t && e.appendChild(t), M().utahId !== !1 && e.appendChild(Lo()), e;
}
const No = `<div class="utds-citizen-experience-wrapper--mobile"></div>
`, So = `<div class="utds-title-wrapper">
  <div class="utds-title-wrapper__logo"></div>
  <div class="utds-title-wrapper__title"></div>
</div>
`, Po = `<a class="utds-title-wrapper">
  <div class="utds-title-wrapper__logo"></div>
  <div class="utds-title-wrapper__title"></div>
</a>
`;
function Co() {
  const e = M(), t = e.titleUrl || /** @type {string | undefined} */
  e.titleURL, n = I(t ? Po : So);
  if (!n)
    throw new Error("LogoTitle: titleWrapper is null");
  if (t && n.setAttribute("href", t), e.titleFunction) {
    if (n.onclick)
      throw new Error("LogoTitle: logoTitleWrapper already has an onclick");
    n.onclick = e.titleFunction;
  }
  const o = n.querySelector(f(r.TITLE__LOGO));
  if (!o)
    throw new Error("LogoTitle: logoWrapper is null");
  const i = e.logo, s = e.showTitle, l = e.title;
  if (i) {
    let d;
    if (i.htmlString)
      d = I(W(i.htmlString));
    else if (i.element)
      d = W(i.element);
    else if (i.imageUrl)
      d = I(`<img src=${W(i.imageUrl)}  id="design-system-logo" />`);
    else
      throw new Error("LogoTitle: logo set but has no settings");
    d.setAttribute("role", "presentation"), o.appendChild(d);
  } else
    n.removeChild(o);
  const c = document.createTextNode(l), a = n.querySelector(f(r.TITLE__TITLE));
  return a?.appendChild(c), !s && i && a?.classList.add(r.VISUALLY_HIDDEN), n;
}
const Ro = `{
  "name": "@utahdts/utah-design-system-header",
  "version": "4.1.0",
  "description": "Utah Header for the Utah Design System",
  "exports": {
    ".": {
      "development-local": "./src/index.js",
      "development": "./dist/utah-design-system-header.es.js",
      "production": "./dist/utah-design-system-header.es.js",
      "import": {
        "types": "./dist/index.d.ts",
        "default": "./dist/utah-design-system-header.es.js"
      },
      "types": "./dist/index.d.ts",
      "require": "./dist/utah-design-system-header.umd.js",
      "default": [
        "./dist/utah-design-system-header.es.js",
        "./dist/utah-design-system-header.umd.js",
        "./src/index.js"
      ]
    },
    "./css": "./dist/style.css",
    "./dist/*": "./dist/*"
  },
  "main": "./src/index.js",
  "types": "./dist/index.d.ts",
  "files": [
    "src/css",
    "dist"
  ],
  "scripts": {
    "build": "vite build",
    "buildw": "vite build --watch",
    "buildTypes": "mkdir -p dist && cp ./artifacts/index.d.ts ./dist/",
    "generateTypes": "npx tsc",
    "clean": "run-s cleanPackageLock cleanDist cleanNodeModules",
    "cleani": "run-s clean npmi",
    "cleanDist": "rimraf ./dist",
    "cleanNodeModules": "rimraf ./node_modules",
    "cleanPackageLock": "rimraf package-lock.json",
    "npmi": "npm i",
    "preview": "vite preview",
    "publishHeader": "npm publish --access public",
    "test-publish": "npm publish --dry-run",
    "test": "vitest",
    "testw": "vitest",
    "testc": "vitest run --coverage",
    "testOnce": "vitest run",
    "testui": "vitest --ui",
    "tsc": "tsc",
    "tscw": "tsc --watch --skipLibCheck",
    "watch": "vite build --watch"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/utahdts/utah-design-system.git"
  },
  "keywords": [
    "design system",
    "dts",
    "utah",
    "utah header",
    "components"
  ],
  "license": "Apache 2.0",
  "bugs": {
    "url": "https://github.com/utahdts/utah-design-system/issues"
  },
  "homepage": "https://github.com/utahdts/utah-design-system#readme",
  "dependencies": {
    "@floating-ui/dom": "1.7.3"
  },
  "devDependencies": {
    "@vitest/ui": "3.2.4",
    "jsdom": "26.1.0",
    "replace": "1.2.2",
    "sass": "1.90.0",
    "tslib": "2.8.1",
    "typescript": "5.9.2",
    "vite": "7.1.3",
    "vitest": "3.2.4"
  },
  "type": "module"
}
`, Uo = `<div class="utah-logo-wrapper">
  <button class="utah-logo-svg" id="utah-logo-svg" aria-haspopup="dialog">
    <span class="visually-hidden" id="utah-logo-description">An official website of the state of Utah. Click to learn
      more.</span>
    <svg viewBox="0 0 137.363 56.6959" role="img">
      <g>
        <g>
          <path
            d="M15.972,39.161c-5.4,0-9.4127-1.5667-12.038-4.7C1.3087,31.3277-.0027,26.466,0,19.876V0H10.175V21.06c0,3.4313,.4633,5.847,1.39,7.247,.9909,1.434,2.669,2.2337,4.407,2.1,1.7525,.124,3.4436-.6712,4.466-2.1,.966-1.4,1.449-3.8157,1.449-7.247V0h9.82V19.876c0,6.586-1.2817,11.4467-3.845,14.582-2.5633,3.1353-6.5267,4.703-11.89,4.703Zm31.353-.711V8.518h-10.175V0h30.525V8.518h-10.175v29.932h-10.175Zm33.6-18.693l-.651,2.662h7.1l-.651-2.662c-.4733-1.8533-.9467-3.8647-1.42-6.034-.4733-2.1693-.945-4.2197-1.415-6.151h-.237c-.434,1.972-.8777,4.0327-1.331,6.182s-.918,4.1507-1.394,6.004l-.001-.001Zm-14.788,18.693L77.85,0h12.3l11.717,38.45h-10.767l-1.893-8.162h-10.766l-1.893,8.162h-10.411Zm39.4,0V0h10.175V14.316h11.476V0h10.175V38.45h-10.175v-15.261h-11.479v15.261h-10.172Z" />
        </g>
        <text transform="translate(.0419 52.5939)" aria-hidden="true">
          <tspan x="0" y="0">An official state website</tspan>
        </text>
      </g>
    </svg>
  </button>
</div>
`, Do = `<div class="utah-logo-wrapper">
  <button class="utah-logo-svg" id="utah-logo-svg" aria-haspopup="dialog">
    <span class="visually-hidden" id="utah-logo-description">An official website of the state of Utah. Click to learn
      more.</span>
    <svg viewBox="0 0 105.9496 47.6226" role="img">
      <g>
        <g>
          <path
            d="M12.2714,30.0877c-4.1489,0-7.2318-1.2037-9.2489-3.611C1.0055,24.0693-.002,20.334,0,15.2709V0H7.8175V16.1806c0,2.6363,.356,4.4923,1.0679,5.5679,.7613,1.1018,2.0506,1.7162,3.3859,1.6134,1.3465,.0953,2.6458-.5157,3.4313-1.6134,.7422-1.0756,1.1133-2.9316,1.1133-5.5679V0h7.5448V15.2709c0,5.0601-.9847,8.7946-2.9541,11.2035-1.9694,2.4089-5.0145,3.6133-9.1352,3.6133Zm24.0887-.5463V6.5444h-7.8175V0h23.4526V6.5444h-7.8175V29.5414h-7.8175Zm25.8151-14.362l-.5002,2.0452h5.455l-.5002-2.0452c-.3637-1.4239-.7273-2.9693-1.091-4.636-.3637-1.6667-.7261-3.242-1.0871-4.7259h-.1821c-.3334,1.5151-.6743,3.0983-1.0226,4.7497s-.7053,3.189-1.071,4.6129l-.0008-.0008Zm-11.3617,14.362L59.8127,0h9.4502l9.0023,29.5414h-8.2724l-1.4544-6.2709h-8.2716l-1.4544,6.2709h-7.9988Zm30.2713,0V0h7.8175V10.9991h8.8171V0h7.8175V29.5414h-7.8175v-11.7251h-8.8194v11.7251h-7.8152Z" />
        </g>
        <text transform="translate(.0419 43.5205)" aria-hidden="true">
          <tspan x="0" y="0">An official website</tspan>
        </text>
      </g>
    </svg>
  </button>
</div>
`, xo = `<div class="utds-official-website-hover__wrapper">
  How do I know it's official?<br />
  Learn more.
</div>
`, Ho = (
  /** @type {{version: string}} */
  /** @type {unknown} */
  Ro
);
let Tt = !1;
function Bo() {
  const e = M();
  let t;
  switch (e.size) {
    case me.LARGE:
      t = Uo;
      break;
    case me.SMALL:
    case me.MEDIUM:
      t = Do;
      break;
    default:
      throw new Error(`Unknown settings size: '${M().size}'`);
  }
  const n = I(t);
  if (!/** @type {HTMLElement} */
  n.querySelector(f(r.LOGO_SVG)))
    throw new Error("UtahLogo: logoButton not found");
  if (n.setAttribute("id", w()), Ee(n, I(xo)), !Tt && (!window.location.hostname || !["localhost", "127.0.0.1", "::1", ".local"].find((i) => window.location.hostname.includes(i)))) {
    Tt = !0;
    const i = document.createElement("img");
    i.classList.add("utah-logo-wrapper__data"), i.classList.add("hidden"), i.ariaHidden = "true", i.src = `https://uds-data-a234spjofq-wm.a.run.app/${Ho.version}.png?applicationType=${encodeURIComponent(e.applicationType || "unspecified")}`, n.appendChild(i);
  }
  return n;
}
const ko = `<h1 class="utds-logo-wrapper"></h1>
`, Wo = `<header class="utah-design-system utds-header" aria-label="Utah.gov Header"></header>
`, Fo = `<span class="utds-logo-vert-line"></span>
`;
function Vo() {
  const e = I(Wo);
  e.classList.add(`utds-header--${M().size?.toLowerCase() || me.MEDIUM}`);
  const t = I(ko);
  return e.appendChild(t), t.appendChild(Bo()), t.appendChild(I(Fo)), t.appendChild(Co()), e.appendChild(yo()), e.appendChild(I(No)), e;
}
const qo = `<div class="utah-design-system visually-hidden" id="search-modal">
  <div class="search-modal__close-button-wrapper">
    <button type="button" class="search-modal__close-button button icon-button icon-button--borderless">
      <span class="utds-icon-before-x-icon" aria-hidden="true"></span>
      <span class="visually-hidden">Close search modal</span>
    </button>
  </div>
  <div class="search-modal">
    <form class="search-modal__form hcenter" role="search" aria-label="Sitewide" autocomplete="off">
      <span class="utds-icon-before-search search-modal__icon-search search-input__icon-search vcenter" aria-hidden="true"></span>
      <label for="search-modal-input-id" class="search-modal__input-label visually-hidden">Enter your search
        terms</label>
      <input type="text" id="search-modal-input-id" placeholder="Search" class="search-modal__input">
      <div class="search-modal__button-wrapper vcenter visually-hidden">
        <button type="submit" class="search-modal__button button button--solid button--primary-color">
          Search Now
        </button>
      </div>
      <div aria-hidden tabindex="0" class="search-modal__hidden-last-focusable visually-hidden">
        end of search form
      </div>
    </form>
  </div>
  <div class="search-backdrop modal-backdrop backdrop-dark"></div>
</div>
`;
function st(e) {
  const t = T(e || document.getElementById(r.SEARCH__SEARCH_MODAL), `setupSearchModal: '#${r.SEARCH__SEARCH_MODAL}' not found`), n = (
    /** @type {HTMLElement} */
    T(t.querySelector(f(r.SEARCH__SEARCH_BACKDROP)), "setupSearchModal: backdrop not found")
  ), o = (
    /** @type {HTMLElement} */
    T(t.querySelector(f(r.SEARCH__SEARCH_CLOSE_BUTTON)), "setupSearchModal: closeButton not found")
  ), i = (
    /** @type {HTMLElement} */
    T(t.querySelector(f(r.SEARCH__SEARCH_BUTTON)), "setupSearchModal: searchButton not found")
  ), s = (
    /** @type {HTMLElement} */
    T(t.querySelector(f(r.SEARCH__SEARCH_BUTTON_WRAPPER)), "setupSearchModal: searchButtonWrapper not found")
  ), l = (
    /** @type {HTMLInputElement} */
    T(t.querySelector(f(r.SEARCH__SEARCH_INPUT)), "setupSearchModal: searchInput not found")
  ), c = (
    /** @type {HTMLElement} */
    T(t.querySelector(".search-modal__hidden-last-focusable"), "setupSearchModal: hiddenLastFocusableButton not found")
  );
  return {
    backdrop: n,
    closeButton: o,
    hiddenLastFocusableButton: c,
    searchButton: i,
    searchButtonWrapper: s,
    searchInput: l,
    searchModal: t
  };
}
function pe() {
  T(document.getElementById(r.SEARCH__SEARCH_MODAL), "closeSearchModal: search modal not found").classList.add(r.VISUALLY_HIDDEN);
  const { closeButton: t, hiddenLastFocusableButton: n } = st(), o = (
    /** @type {HTMLElement} */
    document.querySelector(f(r.MAIN_MENU__SEARCH))
  );
  o && document.activeElement?.closest(`#${r.SEARCH__SEARCH_MODAL}`) && o.focus(), t.tabIndex = -1, n.tabIndex = -1;
}
function Be() {
  T(document.getElementById(r.SEARCH__SEARCH_MODAL), "showSearchModal: search modal not found").classList.remove(r.VISUALLY_HIDDEN);
  const { searchInput: t, closeButton: n, hiddenLastFocusableButton: o } = st();
  t.focus(), n.tabIndex = 0, o.tabIndex = 0;
}
function $o() {
  const e = I(qo), {
    backdrop: t,
    closeButton: n,
    hiddenLastFocusableButton: o,
    searchButton: i,
    searchButtonWrapper: s,
    searchInput: l
  } = st(e);
  i.onclick = (c) => {
    c.preventDefault(), c.stopPropagation(), pe();
    const { onSearch: a } = M();
    a && a?.(l.value);
  }, n.onclick = (c) => {
    c.preventDefault(), c.stopPropagation(), pe();
  }, t.onclick = (c) => {
    c.preventDefault(), c.stopPropagation(), pe();
  }, document.body.appendChild(e), l.oninput = () => {
    s.classList.remove(r.VISUALLY_HIDDEN);
  }, i.onfocus = () => {
    s.classList.remove(r.VISUALLY_HIDDEN);
  }, e.onkeyup = (c) => {
    (c.code === "Escape" || c.key === "Escape") && (c.preventDefault(), c.stopPropagation(), pe());
  }, n.addEventListener("focusout", (c) => {
    c.preventDefault(), c.stopPropagation(), e.classList.contains(r.VISUALLY_HIDDEN) || (_e[Ge.SHIFT] ? i.focus() : l.focus());
  }), o.addEventListener("focusin", (c) => {
    c.preventDefault(), c.stopPropagation(), e.classList.contains(r.VISUALLY_HIDDEN) || n.focus();
  }), pe();
}
const Go = `<li class="menu-item">
  <span class="menu-item__title">
    <button class="menu-item__button-title" type="button">
      <span class="menu-item__link-title-span"></span>
      <span class="menu-item__menu-arrow utds-icon-before-chevron-down" aria-hidden="true"></span>
    </button>
    <a class="menu-item__link-title">
      <span class="menu-item__link-title-span"></span>
      <span class="menu-item__menu-arrow utds-icon-before-chevron-down" aria-hidden="true"></span>
    </a>
    <span class="menu-chiclet"></span>
  </span>
</li>
`, zo = `<div class="utah-design-system main-menu__outer">
  <div class="main-menu__wrapper">
    <nav class="horizontal-menu main-menu__nav">
      <h2 class="main-menu__title visually-hidden"></h2>
      <ul class="main-menu__menu-top"></ul>
    </nav>
    <div class="main-menu__search">
      <button type="button" class="button icon-button icon-button--borderless">
        <div>
          <span class="utds-icon-before-search" aria-hidden="true"></span>
          <span class="visually-hidden">search</span>
        </div>
      </button>
    </div>
    <div class="utds-header-mobile__vip-action-items--left">
    </div>
    <div class="utds-header-mobile__utah-id-wrapper">
    </div>
    <div class="utds-header-mobile__vip-action-items--right">
    </div>
    <button type="button" class="button icon-button icon-button--borderless main-menu__hamburger"
      id="utds-main-menu__hamburger">
      <div>
        <span class="utds-icon-before-hamburger" id="utds-main-menu__hamburger-icon" aria-hidden="true"></span>
      </div>
    </button>
  </div>
</div>
`;
function Yo() {
  const e = M(), t = I(zo);
  let n = t.querySelector(f(r.MAIN_MENU__NAV));
  if (!n)
    throw new Error("renderMainMenu(): mainMenu not created");
  const o = n.querySelector(f(r.MAIN_MENU__TITLE));
  if (!o)
    throw new Error("renderMainMenu(): titleTag not found");
  const i = "main-menu__nav";
  if (n.setAttribute("aria-labelledby", i), o.setAttribute("id", i), e.mainMenu ? o.innerHTML = e.mainMenu.title || "Main Menu" : (n.remove(), n = null), e.mainMenu) {
    const c = n?.querySelector(f(r.MAIN_MENU__MENU_TOP));
    if (!c)
      throw new Error("renderMainMenu(): mainMenuTop not found");
    e.mainMenu.menuItems.forEach((a) => {
      const d = I(Go);
      c.appendChild(d);
      const _ = T(
        d.querySelector(f(r.MENU_ITEM__TITLE)),
        `renderMainMenu(): sub menu title not found for ${a.title}`
      ), p = T(
        /** @type {HTMLElement} */
        _.querySelector(f(r.MENU_ITEM__BUTTON_TITLE)),
        `renderMainMenu(): button title not found for ${a.title}`
      );
      p.setAttribute("id", `${r.MENU_ITEM__BUTTON_TITLE}__${a.title.replaceAll(" ", "")}-${w()}`), a.className && p.classList.add(a.className);
      const m = T(
        /** @type {HTMLElement} */
        _.querySelector(f(r.MENU_ITEM__LINK_TITLE)),
        `renderMainMenu(): link title not found for ${a.title}`
      );
      m.setAttribute("id", `${r.MENU_ITEM__LINK_TITLE}__${a.title.replaceAll(" ", "")}-${w()}`), a.className && m.classList.add(a.className);
      let u;
      if (a.actionMenu || a.actionFunction)
        u = p, m.remove();
      else if (a.actionFunctionUrl || a.actionUrl)
        u = m, p.remove();
      else
        throw new Error(`renderMainMenu(): menuItem is missing an action: ${a.title}`);
      const h = T(
        u.querySelector(f(r.MENU_ITEM__LINK_TITLE_SPAN)),
        `renderMainMenu(): main menu item title span not found for: ${a.title}`
      );
      if (a.isSelected && u.classList.add(r.MENU_ITEM__SELECTED), a.actionMenu) {
        const E = (
          /** @type {MainMenu} */
          e.mainMenu
        );
        h.innerHTML = a.title;
        const b = [...a.actionMenu];
        (a.actionFunction || a.actionUrl || a.actionFunctionUrl) && !a.isOverviewHidden && b.unshift({
          actionFunction: a.actionFunction,
          actionFunctionUrl: a.actionFunctionUrl,
          actionUrl: a.actionUrl,
          className: a.className,
          icon: a.icon,
          title: `${a.title}${Vt(a, E.parentMenuLinkSuffix)}`
        });
        const g = { menuItems: b, title: a.title }, A = ot(
          g,
          u,
          {
            childrenMenuType: a.childrenMenuType || R.FLYOUT,
            parentMenuLinkSuffix: E.parentMenuLinkSuffix
          }
        );
        d.appendChild(A), Te(d, u, A, "menu", { shouldFocusOnHover: !0, doNotClosePopupOnClick: !0 });
        let v;
        switch (a.childrenMenuType) {
          case R.INLINE:
            v = r.MENU_ITEM__INLINE;
            break;
          case R.MEGA_MENU:
            v = r.MENU_ITEM__MEGA_MENU;
            break;
          case R.FLYOUT:
          default:
            v = r.MENU_ITEM__FLY_OUT;
            break;
        }
        d.classList.add(v);
      } else
        T(
          u.querySelector(f(r.MENU_ITEM__ARROW)),
          `renderMainMenu(): menu arrow not found for ${a.title}`
        ).remove();
      if (a.actionFunction ? (h.innerHTML = a.title, a.actionMenu || (u.onclick = a.actionFunction)) : a.actionFunctionUrl ? (h.innerHTML = a.title, u.setAttribute("href", a.actionFunctionUrl.url), a.actionMenu || (u.onclick = (E) => {
        a.actionFunctionUrl?.skipHandleEvent || (E.stopPropagation(), E.preventDefault()), a.actionFunctionUrl?.actionFunction(E);
      })) : a.actionUrl && (h.innerHTML = a.title, u.setAttribute("href", a.actionUrl.url)), !a.actionMenu && (a.actionUrl?.openInNewTab || a.actionFunctionUrl?.openInNewTab) && (u.setAttribute("target", "_blank"), u.appendChild(I(tt))), a.icon) {
        const E = I(a.icon);
        E.setAttribute("role", "presentation"), u.insertBefore(E, h);
      }
    });
  }
  let s = null;
  if (e.utahId) {
    const { button: c, menu: a } = wo();
    s = a, T(
      t.querySelector(f(r.MOBILE__UTAH_ID)),
      "renderMainMenu: utahIdButtonWrapper not found"
    ).appendChild(c);
  }
  const l = T(
    /** @type {HTMLElement} */
    t.querySelector(f(r.MAIN_MENU__SEARCH)),
    "renderMainMenu: searchIcon not found"
  );
  if (e.onSearch) {
    if ($o(), Ee(l, document.createTextNode("Search")), l.onclick)
      throw new Error("searchIcon already has onclick");
    if (l.onclick = () => Be(), !e.mainMenu) {
      const c = T(
        document.querySelector(f(r.CITIZEN_EXPERIENCE)),
        "renderMainMenu: citizen experience wrapper not found"
      ), a = I(l.outerHTML);
      if (Ee(a, document.createTextNode("Search")), a.onclick = () => Be(), l.classList.add(r.DESKTOP__HIDDEN), e.utahId !== !1) {
        const d = T(document.querySelector(f(r.UTAH_ID)), "renderMainMenu: utahId wrapper not found");
        c.insertBefore(a, d);
      } else
        c.appendChild(a);
    }
    if (!e.mainMenu && !e.actionItems && e.utahId === !1) {
      const c = I(
        /** @type {HTMLElement} */
        l.outerHTML
      );
      if (Ee(c, document.createTextNode("Search")), c.onclick)
        throw new Error("searchIconMobile already has onclick");
      c.onclick = () => Be(), T(
        document.querySelector(f(r.CITIZEN_EXPERIENCE_MOBILE)),
        "renderMainMenu: citizen-experience--mobile not found"
      ).appendChild(c);
    }
  }
  return e.onSearch || ((e.mainMenu || !e.mainMenu && e.utahId) && l.parentElement?.insertBefore(I('<div class="main-menu__search-placeholder">'), l), l.remove()), { mainMenuWrapper: t, utahIdPopup: s };
}
const Ko = `<div class="utah-design-system utds-official-website-popup__wrapper visually-hidden" tabindex="-1">
  <h2 class="utds-official-website-popup__heading">
    An official website of the state of Utah. Here's how you know:
  </h2>
  <div class="utds-official-website-popup__content">
    <div class="utds-official-website-popup__col">
      <div class="utds-icon-before-verified big-icon" aria-hidden="true"></div>
      <div>
        <strong>Official Utah websites use utah.gov in the browser&#39;s address bar.</strong><br />
        A Utah.gov website belongs to an official government organization in the state of Utah.
        <div class="utds-official-website-popup__address-bar"></div>
      </div>
    </div>
    <div class="utds-official-website-popup__col">
      <div class="utds-icon-before-lock big-icon" aria-hidden="true"></div>
      <div>
        <strong>Be careful when sharing sensitive information.</strong><br />
        Share sensitive information only on secure official Utah.gov websites.
      </div>
    </div>
    <div>
      <svg class="utds-official-website-popup__official-image" viewBox="0 0 105.9496 47.6226" role="img">
        <g>
          <g>
            <path
              d="M12.2714,30.0877c-4.1489,0-7.2318-1.2037-9.2489-3.611C1.0055,24.0693-.002,20.334,0,15.2709V0H7.8175V16.1806c0,2.6363,.356,4.4923,1.0679,5.5679,.7613,1.1018,2.0506,1.7162,3.3859,1.6134,1.3465,.0953,2.6458-.5157,3.4313-1.6134,.7422-1.0756,1.1133-2.9316,1.1133-5.5679V0h7.5448V15.2709c0,5.0601-.9847,8.7946-2.9541,11.2035-1.9694,2.4089-5.0145,3.6133-9.1352,3.6133Zm24.0887-.5463V6.5444h-7.8175V0h23.4526V6.5444h-7.8175V29.5414h-7.8175Zm25.8151-14.362l-.5002,2.0452h5.455l-.5002-2.0452c-.3637-1.4239-.7273-2.9693-1.091-4.636-.3637-1.6667-.7261-3.242-1.0871-4.7259h-.1821c-.3334,1.5151-.6743,3.0983-1.0226,4.7497s-.7053,3.189-1.071,4.6129l-.0008-.0008Zm-11.3617,14.362L59.8127,0h9.4502l9.0023,29.5414h-8.2724l-1.4544-6.2709h-8.2716l-1.4544,6.2709h-7.9988Zm30.2713,0V0h7.8175V10.9991h8.8171V0h7.8175V29.5414h-7.8175v-11.7251h-8.8194v11.7251h-7.8152Z" />
          </g>
          <text transform="translate(.0419 43.5205)" aria-hidden="true">
            <tspan x="0" y="0">An official website</tspan>
          </text>
        </g>
      </svg>
      <div class="utds-official-website-popup__copyright">&copy; State of Utah</div>
    </div>
  </div>
  <button type="button" class="utds-official-website-popup__close-button button icon-button icon-button--borderless"
    tabIndex="-1">
    <span class="utds-icon-before-x-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Close official website popup</span>
  </button>
</div>
`;
function Xt() {
  const e = T(
    document.querySelector(f(r.LOGO_OFFICIAL_WRAPPER)),
    "openOfficialWebsite: official wrapper not found"
  ), t = T(
    document.querySelector(f(r.LOGO)),
    "openOfficialWebsite: logoWrapper not found"
  ), n = T(
    t.querySelector(f(r.LOGO_SVG)),
    "openOfficialWebsite: logoButton not found"
  ), o = T(
    e.querySelector(f(r.LOGO_OFFICIAL_CLOSE_BUTTON)),
    "openOfficialWebsite: official close button not found"
  );
  e.classList.add(r.VISUALLY_HIDDEN), n.setAttribute("aria-expanded", "false"), e.setAttribute("aria-hidden", "true"), o.setAttribute("tabIndex", "-1"), e.setAttribute("tabIndex", "-1"), document.querySelectorAll(f(r.TOOLTIP__WRAPPER))?.forEach((s) => {
    s.classList.add(r.TOOLTIP__WRAPPER__HIDDEN), s.classList.remove(r.TOOLTIP__WRAPPER__VISIBLE);
  });
}
function Zo() {
  const e = T(
    document.querySelector(f(r.LOGO_OFFICIAL_WRAPPER)),
    "openOfficialWebsite: official wrapper not found"
  ), t = T(
    document.querySelector(f(r.LOGO)),
    "openOfficialWebsite: logoWrapper not found"
  ), n = T(
    t.querySelector(f(r.LOGO_SVG)),
    "openOfficialWebsite: logoButton not found"
  ), o = T(
    e.querySelector(f(r.LOGO_OFFICIAL_CLOSE_BUTTON)),
    "openOfficialWebsite: official close button not found"
  );
  e.classList.remove(r.VISUALLY_HIDDEN), o.removeAttribute("tabIndex"), e.removeAttribute("tabIndex"), n.setAttribute("aria-expanded", "true"), e.setAttribute("aria-hidden", "false"), e.focus(), document.querySelectorAll(f(r.TOOLTIP__WRAPPER))?.forEach((s) => {
    s.classList.add(r.TOOLTIP__WRAPPER__HIDDEN), s.classList.remove(r.TOOLTIP__WRAPPER__VISIBLE);
  }), Re();
}
function jo() {
  const e = I(Ko), n = (
    /** @type {HTMLElement} */
    document.querySelector(f(r.LOGO))?.querySelector(f(r.LOGO_SVG))
  );
  if (!n)
    throw new Error("renderOfficialWebsite: logoButton not found");
  if (n.onclick)
    throw new Error("renderOfficialWebsite: logoButton already has an onclick");
  const o = e.querySelector(f(r.LOGO_OFFICIAL_CLOSE_BUTTON));
  if (!o)
    throw new Error("renderOfficialWebsite: closeButton not found");
  return n.onclick = () => {
    e.classList.toggle(r.VISUALLY_HIDDEN), e.classList.contains(r.VISUALLY_HIDDEN) ? Xt() : Zo(), document.querySelectorAll(f(r.TOOLTIP__WRAPPER))?.forEach((s) => {
      s.classList.add(r.TOOLTIP__WRAPPER__HIDDEN), s.classList.remove(r.TOOLTIP__WRAPPER__VISIBLE);
    });
  }, o.onclick = () => {
    e.classList.toggle(r.VISUALLY_HIDDEN), n.focus(), n.setAttribute("aria-expanded", "false"), e.setAttribute("aria-hidden", "true");
  }, o.id || (o.id = w()), e.id || (e.id = w()), n.setAttribute("aria-controls", e.id), n.setAttribute("aria-expanded", "false"), e.setAttribute("aria-hidden", "true"), e.setAttribute("aria-labelledby", n.id), e;
}
function Xo(e) {
  const { hamburger: t } = ge("hookupHamburger"), n = (
    /**
     * @param {string} context
     * @returns {HTMLElement}
     */
    ((d) => T(t, `hookupHamburger: hamburger required but is null: ${d}`))
  ), o = M();
  if (o.actionItems?.some((d) => !!d.badge)) {
    const d = it({ label: "Home Badge" });
    d && n("home badge").appendChild(d);
  }
  Re();
  function s() {
    const d = T(
      /** @type {HTMLElement} */
      document.querySelectorAll(`.${r.MOBILE_MENU__ACTION_BAR} .${r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER}`)[0],
      "hookupHamburger: no action items to select on mobile hamburger open"
    ), p = d.querySelector("button")?.getAttribute("aria-controls");
    return { actionItem: d, actionItemWrapper: p ? document.getElementById(p) : null };
  }
  const l = T(
    /** @type {HTMLElement} */
    document.querySelectorAll(`.${r.MOBILE_MENU__ACTION_BAR} .${r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER}`)[0],
    "hookupHamburger: no action items to select on mobile hamburger open"
  ), c = l.querySelector?.("button"), a = (c || l).getAttribute("id");
  if (!a)
    throw new Error("mobileMenuInteractionHandler: actionItemId not found");
  if (e) {
    const d = e.getAttribute("id");
    if (!d)
      throw new Error("mobileMenuInteractionHandler: mobileMainMenuContentItemId not found");
    (c || l).setAttribute("aria-controls", d), e.setAttribute("aria-labelledby", a);
  }
  t && Ke(
    t,
    () => s().actionItemWrapper,
    () => s().actionItem,
    {
      additionalOnClick: () => Xt(),
      ariaHasPopupType: "menu",
      shouldOnClickCloseMenu: !0
    }
  ), t && (x(!!t.onblur, "hookupHamburger: hamburger already has an onblur event"), t.onblur = () => {
    const { mobileMenu: d } = ge("showMobileMenu");
    if (d.classList.contains(r.IS_OPEN)) {
      const _ = f(r.MOBILE_MENU__ACTION_BAR), p = f(r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER), m = f(r.ICON_BUTTON);
      /** @type {HTMLElement | null} */
      document.querySelector(`${_} ${p}:first-child ${m}`)?.focus();
    }
  }), (o.mainMenu || o.actionItems) && !o.onSearch && o.utahId === !1 && (T(
    document.querySelector(f(r.CITIZEN_EXPERIENCE_MOBILE)),
    "hookupHamburger: citizen experience mobile not found"
  ).appendChild(n("adding to citizen experience")), T(
    document.querySelector(f(r.MAIN_MENU)),
    "hookupHamburger: main menu not found"
  ).classList.add(r.MOBILE__HIDDEN)), o.onSearch && !o.mainMenu && T(
    document.querySelector(f(r.MAIN_MENU)),
    "renderMainMenu: main menu not found"
  ).classList.add(r.DESKTOP__HIDDEN);
}
function Jo() {
  const e = document.getElementById(r.MOBILE_MENU_ACTON_BAR__PROFILE_ID);
  if (!e)
    throw new Error("removeUtahIdInMobileMenu: profileActionItem not found");
  const t = (
    /** @type {HTMLElement} */
    e.closest(f(r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER))
  );
  if (!t)
    throw new Error("removeUtahIdInMobileMenu: profileActionItemWrapper not found");
  t.remove();
}
function Qo(e, t) {
  const n = document.querySelector(f(r.MOBILE__UTAH_ID));
  if (!n)
    throw new Error("hookupUtahIdInMobileMenu: utahIdWrapper not found");
  const o = (
    /** @type {HTMLElement} */
    n.querySelector(f(r.UTAH_ID__BUTTON))
  );
  if (!o)
    throw new Error("hookupUtahIdInMobileMenu: utahIdButton not found");
  if (!e.querySelector(f(r.MOBILE_MENU__CONTENT)))
    throw new Error("hookupUtahIdInMobileMenu: mobileContentWrapper not found");
  const s = document.getElementById(r.MOBILE_MENU_ACTON_BAR__PROFILE_ID);
  if (!s)
    throw new Error("hookupUtahIdInMobileMenu: profileActionItem not found");
  const l = (
    /** @type {HTMLElement} */
    s.closest(f(r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER))
  );
  if (!l)
    throw new Error("hookupHamburger: profileActionItemWrapper not found");
  const c = Ye(t);
  Ke(
    o,
    c,
    l,
    {
      ariaHasPopupType: "menu",
      onClickHandler: (a) => (Gt(a), !1),
      shouldOnClickCloseMenu: !0
    }
  );
}
const ei = `<div class="utah-design-system utds-header-mobile-menu" id="utds-header-mobile-menu">
  <div class="utds-header-mobile-menu__backdrop" aria-hidden></div>
  <div class="utds-header-mobile-menu__wrapper">
    <div class="utds-header-mobile-menu__action-bar" role="tablist">

      <div class="utds-header-mobile-menu__action-item" role="tab">
        <button type="button" class="icon-button icon-button--borderless utds-header-action-item__icon-button icon-home"
          id="utds-header-mobile-menu_action-bar__home">
          <div class="utds-header-action-item__title visually-hidden">Main Menu</div>
          <span class="utds-icon-before-home-menu" aria-hidden="true" role="presentation">
          </span>
        </button>
        <span class="menu-chiclet"></span>
      </div>
      <div class="utds-header-mobile-menu__action-item" role="tab">
        <button type="button"
          class="icon-button icon-button--borderless utds-header-action-item__icon-button icon-profile"
          id="utds-header-mobile-menu_action-bar__profile">
          <div class="utds-header-action-item__title visually-hidden">Profile</div>
          <span class="utds-icon-before-account" aria-hidden="true" role="presentation">
          </span>
        </button>
        <span class="menu-chiclet"></span>
      </div>

    </div>
    <div class="utds-header-mobile-menu__content"> </div>
    <div aria-hidden tabindex="0" class="utds-header-mobile-menu__hidden-last-focusable visually-hidden">
      end of mobile content form
    </div>
  </div>
</div>
`;
function ti() {
  const e = M();
  return ce(
    e.mainMenu && e.mainMenu?.menuItems || void 0,
    {
      childrenMenuType: R.INLINE,
      parentMenuLinkSuffix: typeof e.mainMenu == "object" ? e.mainMenu.parentMenuLinkSuffix : void 0,
      removePopupArrow: !0
    }
  );
}
const ni = `<div class="utah-design-system skip-link__wrapper">
  <div class="skip-link__tab">
    <a href="#" class="skip-link__link button button--solid button--primary-color" id="skip-link">Skip to main content</a>
  </div>
</div>
`;
function oi() {
  const { skipLinkUrl: e } = M();
  let t;
  if (e) {
    t = I(ni);
    const n = t.querySelector(f(r.SKIP_LINK_LINK));
    if (!n)
      throw new Error("Skip Link Link is null");
    n.setAttribute("href", e);
  } else
    t = null, console.warn("Utah Design System: It is best practice to provide a skip link url (skipLinkUrl). See: https://designsystem.utah.gov/library/components/navigationLinks/skipLink");
  return t;
}
function ii() {
  const t = [...document.querySelectorAll(`
      ${f(r.MOBILE_MENU__ACTION_BAR)}
      ${f(r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER)}
      ${f(r.ACTION_ITEM__ICON_BUTTON)}
    `)];
  t.forEach(
    (i) => {
      i.onkeydown = /** @param {KeyboardEvent} draftE */
      ((s) => {
        (s.code === "Home" || s.code === "End" || s.code === "ArrowRight" || s.code === "ArrowLeft") && s.preventDefault();
      }), i.onkeyup = /** @param {KeyboardEvent} e */
      ((s) => {
        const l = t.indexOf(i);
        let c = NaN;
        if (s.code === "Home" ? c = 0 : s.code === "End" ? c = t.length - 1 : s.code === "ArrowRight" ? c = (l + 1) % t.length : s.code === "ArrowLeft" && (c = (t.length + l - 1) % t.length), !Number.isNaN(c)) {
          s.preventDefault(), s.stopPropagation();
          const a = t[c], d = (
            /** @type {HTMLElement} */
            a?.closest(
              f(r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER)
            )
          );
          if (!d)
            throw new Error("hookupMobileActionItemKeyboarding: newWrapper not found... how in the blazes?!");
          const _ = a?.getAttribute("aria-controls");
          if (_ && document.getElementById(_))
            a?.click();
          else {
            const u = (
              /** @type {HTMLElement} */
              document.querySelector(f(r.MOBILE_MENU__WRAPPER))
            );
            if (!u)
              throw new Error("hookupMobileActionItemKeyboarding: mobileMenuWrapper not found");
            const h = (
              /** @type {HTMLElement} */
              u.querySelector(f(r.MOBILE_MENU__CONTENT))
            );
            if (!h)
              throw new Error("hookupMobileActionItemKeyboarding: mobileContentWrapper not found");
            h.querySelectorAll(f(r.MOBILE_MENU__CONTENT_ITEM)).forEach((E) => E.classList.remove(r.IS_OPEN));
          }
          const m = (
            /** @type {HTMLElement} */
            document.querySelector(f(r.MOBILE_MENU__WRAPPER))
          );
          if (!m)
            throw new Error("hookupMobileActionItemKeyboarding: mobileMenuWrapper not found");
          ke(m, d);
        }
      });
    }
  );
  const n = T(
    document.querySelector(f(r.MOBILE_MENU__LAST_FOCUSABLE)),
    "hookupMobileActionItemKeyboarding: hiddenLastFocusableButton not found"
  ), { hamburger: o } = ge("hookupMobileActionItemKeyboarding");
  n.addEventListener("focusin", (i) => {
    i.preventDefault(), i.stopPropagation(), o?.focus();
  });
}
function ri() {
  const e = en.replace(r.MEDIA_SIZE__TABLET_PORTRAIT__PLACEHOLDER, `${M().mediaSizes.tabletPortrait}px`).replace(r.MEDIA_SIZE__TABLET_LANDSCAPE__PLACEHOLDER, `${M().mediaSizes.tabletLandscape}px`).replace(r.MEDIA_SIZE__MOBILE__PLACEHOLDER, `${M().mediaSizes.mobile}px`);
  let t = document.getElementById(r.CSS_HEADER_MEDIA_TAG_ID);
  t || (t = document.createElement("style"), t.id = r.CSS_HEADER_MEDIA_TAG_ID), t.innerHTML = e, document.body.appendChild(t);
}
function si() {
  const e = M();
  let t = document.body;
  if (e.domLocationTarget) {
    const n = [
      e.domLocationTarget.cssSelector,
      e.domLocationTarget.element,
      e.domLocationTarget.elementFunction
    ].filter((o) => o);
    if (n.length < 1)
      throw new Error("loadHeader: domLocationTarget must either have a value for one of its properties or not be specified at all");
    if (n.length > 1)
      throw new Error("loadHeader: domLocationTarget must only have one target specified");
    if (e.domLocationTarget.cssSelector)
      t = document.querySelector(e.domLocationTarget.cssSelector), x(!t, `loadHeader: element not found for domLocationTarget.cssSelector ${e.domLocationTarget.cssSelector}`);
    else if (e.domLocationTarget.element)
      t = e.domLocationTarget.element;
    else if (e.domLocationTarget.elementFunction)
      t = e.domLocationTarget.elementFunction(), x(!t, "loadHeader: element not returned from domLocationTarget.elementFunction");
    else
      throw new Error("loadHeader: domLocationTarget must have at least one field set");
  }
  return T(t, "loadHeader: domTarget is null (how?!)");
}
function ai() {
  if (!document.querySelector(f([r.UTAH_DESIGN_SYSTEM, r.HEADER]))) {
    const t = Vo(), n = si();
    n.insertBefore(t, n.firstChild);
    const o = jo();
    t.after(o);
    const i = oi(), s = document.body;
    i && s && s.insertBefore(i, s.firstChild);
    const { mainMenuWrapper: l, utahIdPopup: c } = Yo();
    l && o.after(l);
    const a = I(ei);
    o.after(a);
    const d = (
      /** @type {HTMLElement} */
      document.querySelector(f(r.MOBILE_MENU__BACKDROP))
    );
    if (!d)
      throw new Error("mobileMenuInteractionHandler: mobileMenuBackdrop not found");
    if (d.onclick)
      throw new Error("mobileMenuInteractionHandler: mobileMenuBackdrop already has onclick");
    d.onclick = () => Re();
    const _ = ti(), p = zt(_, "Main Menu");
    p.appendChild(_);
    const m = Ye(p);
    Xo(m), c ? (c.closest("div")?.removeAttribute("aria-labelledby"), Qo(a, c)) : Jo(), co(), ii(), jn(), ri(), $t().catch((h) => console.error(h));
    const u = M();
    (!u.mainMenu && !u.actionItems && u.utahId === !1 && !u.onSearch || !u.mainMenu && !u.actionItems && u.utahId === !1 && u.onSearch || !u.mainMenu && u.actionItems && u.utahId === !1 && !u.onSearch) && (a.classList.add(r.MAIN_MENU__REMOVED), l.remove()), (!u.mainMenu && !u.actionItems && u.utahId && !u.onSearch || !u.mainMenu && u.actionItems && u.utahId && !u.onSearch || !u.mainMenu && u.actionItems && !u.utahId && u.onSearch) && l.classList.add(r.DESKTOP__HIDDEN);
  }
  fo();
}
function ci(e) {
  document.querySelector(f([r.UTAH_DESIGN_SYSTEM, r.SKIP_LINK_WRAPPER]))?.remove(), document.querySelector(f([r.UTAH_DESIGN_SYSTEM, r.HEADER]))?.remove(), document.querySelector(f([r.UTAH_DESIGN_SYSTEM, r.MAIN_MENU__OUTER]))?.remove(), document.querySelector(f([r.UTAH_DESIGN_SYSTEM, r.MOBILE_MENU]))?.remove(), document.querySelector(f([r.UTAH_DESIGN_SYSTEM, r.LOGO_OFFICIAL_WRAPPER]))?.remove(), document.getElementById(r.SEARCH__SEARCH_MODAL)?.remove(), Ft(), e && setTimeout(() => document.dispatchEvent(new Event(Mt.HEADER_UNLOADED)), 0);
}
function At() {
  ci(!1), ai();
}
const li = 15e3;
let vt = 0;
const Jt = setInterval(
  () => {
    vt += 1, vt >= li || typeof window > "u" || window["@utahdts/utah-design-system-header"]?.isSetUtahHeaderSettingsCalled ? clearInterval(Jt) : document.dispatchEvent(new Event(Mt.HEADER_LOADED));
  },
  2
);
window.addEventListener("unload", () => {
  clearInterval(Jt);
});
function ui(e) {
  return ye.setSettings(e), window["@utahdts/utah-design-system-header"] && (window["@utahdts/utah-design-system-header"].isSetUtahHeaderSettingsCalled = !0), document?.body ? At() : window.addEventListener("load", () => At()), ye.getSettings();
}
function di(e) {
  return ui({ ...Oe, ...ye.getSettings(), footer: e });
}
export {
  Ie as PopupPlacement,
  R as childrenMenuTypes,
  Oe as defaultSettings,
  Mt as events,
  M as getUtahHeaderSettings,
  ai as loadHeader,
  Te as popupFocusHandler,
  ci as removeHeader,
  I as renderDOMSingle,
  di as setUtahFooterSettings,
  ui as setUtahHeaderSettings,
  me as sizes
};