//! add object called __clubEmbed with all the variables inside
let e = null, S = !1, y = null;
const P = ["lovehoney", "twopagescurtains"];
let p = null, g = "drawer", h = null;
const U = () => {
  const t = document.createElement("style");
  t.textContent = `
    .club-badge {
      display: flex;
      align-items: center;
      gap: 4px;
      padding: 12px;
      border-radius: 8px;
      cursor: pointer;
      font-weight: 500;
      transition: background-color 0.3s ease;
      border:none;
      width: 100%;
    }

    .club-badge-text {
      flex: 1;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .club-badge.dark {
      background-color: black;
      color: white;
    }
    .club-badge.light {
      background-color: white;
      color: black;
      border: 1px solid #ddd;
    }
    .club-badge.xSmall {
      height: 28px;
      font-size: 12px;
    }
    .club-badge.small {
      height: 32px;
      font-size: 14px;
    }
    .club-badge.medium {
      height: 40px;
      font-size: 14px;
    }
    .club-badge.large {
      height: 48px;
      font-size: 16px;
    }
    .club-drawer-backdrop {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(16, 24, 40, 0.50);
      z-index: 2147483647;
      transition: opacity 0.3s ease;
      opacity: 0;
      display: none;
    }
    .club-drawer-backdrop.open {
      display: block;
    }
    .club-drawer-backdrop.open.slide-in {
      opacity: 1;
    }
    .club-drawer {
      position: fixed;
      border-radius: 24px;
      overflow: hidden;
      top: 24px;
      right: 24px;
      width: 450px;
      height: calc(100% - 48px);
      background: white;
      box-shadow: -4px 0 6px rgba(0, 0, 0, 0.1);
      transition: transform 0.3s ease;
      z-index: 1;
      transform: translateX(100%);
      display: flex;
      flex-direction: column;

      @media (max-width: 540px) {
        top: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
      }
    }
    .club-drawer-backdrop.open.slide-in .club-drawer {
      transform: translateX(0);
    }

    /* Modal view — centered overlay instead of right-side drawer */
    .club-drawer-backdrop.modal .club-drawer {
      top: 50%;
      left: 50%;
      right: auto;
      transform: translate(-50%, -50%) scale(0.95);
      opacity: 0;
      transition: transform 0.25s ease, opacity 0.25s ease;
      width: 750px;
      height: min(550px, calc(100% - 48px));
      border-radius: 24px;

      @media (max-width: 750px) {
        width: calc(100% - 20px);
        max-height: calc(100% - 20px);
        border-radius: 24px;
      }
    }
    .club-drawer-backdrop.modal.open.slide-in .club-drawer {
      transform: translate(-50%, -50%) scale(1);
      opacity: 1;

      @media (max-width: 750px) {
        transform: translate(-50%, -50%) scale(1);
      }
    }

    /* Modal view: hide native drawer header and close button */
    .club-drawer-backdrop.modal .club-drawer-header {
      display: none !important;
    }
    .club-drawer-backdrop.modal .club-close-drawer {
      display: none !important;
    }

    /* Fullscreen modal — desktop only. Mobile keeps the standard modal styling. */
    @media (min-width: 668px) {
      .club-drawer-backdrop.modal.fullscreen .club-drawer {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        transform: scale(0.98);
      }
      .club-drawer-backdrop.modal.fullscreen.open.slide-in .club-drawer {
        transform: scale(1);
      }
    }

    /* Instant switch from modal to drawer — no animation */
    .club-drawer-backdrop.no-animate .club-drawer {
      transition: none !important;
    }
    .club-drawer-backdrop.no-animate {
      transition: none !important;
    }
    .club-close-drawer {
      position: absolute;
      top: 43px;
      right: calc(24px + 19px + 450px);
      width: 40px;
      height: 40px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 24px;
      background: rgba(255, 255, 255, 0.60);
      border: none;
      color: black;
      cursor: pointer;
      z-index: 2;
      padding: 0 !important;

      @media (max-width: 540px) {
        display: none;
      }

    }

    .club-drawer-header {
      height: 44px;
      display: none;
      align-items: center;
      justify-content: center;
      background-color: white;
      color: #060708;
      position: relative;

      @media (max-width: 540px) {
        display: flex;
      }
    }

    .club-close-drawer-header {
      position: absolute;
      width: 40px;
      height: 40px;
      top: 0px;
      right: 5px;
      font-size: 24px;
      border: none;
      color: #060708;
      cursor: pointer;
      background: transparent;
    }

    #club-iframe-container {
      flex: 1;
    }

    .club-drawer .club-drawer-content{
      height: 100%;
      display: flex;
      flex-direction: column;
    }

    .club-drawer .club-drawer-content .club-modal-container {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      align-items: center;
      justify-content: center;
      background: rgba(16, 24, 40, 0.50);
      z-index: 2;
      display: none;
    }

    .club-drawer .club-drawer-content .club-modal-container.open {
      display: flex;
    }

    .club-modal-container .club-modal{
      border-radius: 16px;
      background: white;
      box-shadow: 0px 0px 1px 0px rgba(16, 18, 20, 0.20), 0px 8px 12px 0px rgba(16, 18, 20, 0.15);
      padding: 32px;
      padding-top: 24px;
      display: flex;
      flex-direction: column;
      align-items: center;
      box-sizing: border-box;
    }

    .club-modal-container .club-modal h4 {
      font-size: 24px;
      font-weight: 600;
      line-height: 28px;
      letter-spacing: 0.25px;
      font-family: 'Inter Tight', sans-serif;
      margin:0px;
    }

    .club-button {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      font-family: 'Inter Tight', sans-serif;
      font-size: 14px;
      font-weight: 500;
      line-height: 16px;
      letter-spacing: 0.25px;
      padding: 12px 16px;
      border: none;
      cursor: pointer;
      flex:1;
      text-decoration: none;
    }

    .club-button.primary {
      background-color: #6131C4;
      color: white;
      border-radius: 12px;
    }

    .club-button.subtle {
      background-color: transparent;
      color: #69727A;
    }

    .club-tabs {
      padding: 4px;
      border-radius: 8px;
      border: 1px solid #DDE4EC;
      background-color: white;
      display: flex;
      gap: 4px;
    }

    .club-tabs .club-tab {
      color:#475059;
      padding: 8px;
      background-color: transparent;
    }

    .club-tabs .club-tab.selected {
      color: #6131C4;
      background-color: #F7F8F9;
    }

    .club-links-container {
      background-color: white ;
      border-radius: 16px;
      box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.04);
      }

    .club-links-container .club-links {
      display: none;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 4px;
     }

    .club-links-container .club-links.visible {
      display: flex;
    }

    .club-links-container .club-links .club-qr-code{
       @media (max-width: 540px) {
        display: none;
      }
    }

    #club-download-app-box .club-modal{
      @media (max-width: 540px) {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
      }
    }

      `, document.head.appendChild(t);
  const o = document.createElement("link");
  o.rel = "stylesheet", o.href = "https://fonts.googleapis.com/css2?family=Inter+Tight:wght@100;200;300;400;500;600;700;800;900&display=swap", document.head.appendChild(o);
}, D = () => {
  var t, o, i;
  try {
    const a = new URL("https://react-club-app.club.co/").origin, l = document.createElement("link");
    l.rel = "preconnect", l.href = a, l.crossOrigin = "anonymous";
    const n = document.createElement("link");
    n.rel = "dns-prefetch", n.href = a;
    const r = (t = document.head) == null ? void 0 : t.firstChild;
    r ? (document.head.insertBefore(l, r), document.head.insertBefore(n, r)) : ((o = document.head) == null || o.appendChild(l), (i = document.head) == null || i.appendChild(n));
  } catch {
  }
}, z = (t) => {
  switch (t) {
    case "xSmall":
    case "small":
      return "16px";
    case "medium":
      return "18px";
    case "large":
      return "20px";
    default:
      return "18px";
  }
}, H = (t) => {
  const o = (t == null ? void 0 : t.getAttribute("data-brand-name")) || "", i = t == null ? void 0 : t.getAttribute("data-badge-size"), a = t == null ? void 0 : t.getAttribute("data-badge-color"), l = (t == null ? void 0 : t.getAttribute("data-badge-text")) || "Join our community", n = z(i), r = `
    <svg width="${n}" height="${n}" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" style="min-width: ${n};">
      <path d="M12.9504 8.91661L12.9307 9.02483L12.9143 9.10354C12.406 11.4287 10.235 13.1799 7.85737 13.1799C7.51302 13.1799 7.16868 13.1438 6.82106 13.0717C5.49944 12.8388 4.2762 12.0124 3.46618 10.8089C2.63975 9.57578 2.33149 8.08363 2.62336 6.70954C3.06936 4.15484 5.42729 2.23308 8.11316 2.23308C9.18227 2.23308 10.2055 2.55119 11.0647 3.15461C12.1698 3.89577 12.6946 5.10261 12.406 6.22418C12.1338 6.97845 11.2188 7.37199 10.4514 7.37199C9.32328 7.37199 8.36896 6.32912 8.36896 5.09605C8.36896 4.83697 8.16236 4.62708 7.90984 4.62708C7.65732 4.62708 7.45071 4.83697 7.45071 5.09605C7.45071 6.35864 6.43736 7.38183 5.19445 7.38183C4.94193 7.38183 4.73533 7.59171 4.73533 7.85079C4.73533 8.10987 4.94193 8.31975 5.19445 8.31975C6.44064 8.31975 7.45071 9.34294 7.45071 10.6383C7.45071 10.8974 7.65732 11.1073 7.90984 11.1073C8.16236 11.1073 8.36896 10.8974 8.36896 10.6088C8.36896 9.34622 9.38231 8.32303 10.6252 8.32303C11.8681 8.32303 13.2717 7.52284 13.4685 6.18483C13.9244 3.68588 11.6648 1.6231 9.31344 1.1443C8.86088 1.04592 8.39192 1.00001 7.92624 1.00001C5.67653 0.996728 3.50881 2.1183 2.26918 3.92856C0.744229 6.24058 0.586815 8.89693 1.83301 11.2188C3.06608 13.5177 5.48304 15 7.99838 15C9.29705 15 10.5662 14.6229 11.773 13.8883C13.4357 12.8454 14.6262 11.0745 14.9607 9.14617L14.9803 9.02811L15 8.91989H12.9504V8.91661Z" fill="#9667F7"/>
    </svg>
  `;
  return { brandName: o, badgeText: l, badgeSize: i, badgeColor: a, badgeIcon: r };
}, f = (t, o, i, a) => {
  if (!S || y !== t) {
    const l = e == null ? void 0 : e.querySelector("#club-iframe-container");
    if (l) {
      l.innerHTML = "", h = document.createElement("iframe");
      let n = `https://react-club-app.club.co/?func=embed&alias=${encodeURIComponent(t)}`;
      o && (n += `&intent_id=${encodeURIComponent(o)}`), a && (n += `&token=${encodeURIComponent(a)}`), i && (n += `&mode=${encodeURIComponent(i.mode)}`, i.discountCode && (n += `&discount_code=${encodeURIComponent(i.discountCode)}`), n += `&discount_pct=${i.discountPct}`, i.phoneRequired && (n += "&phone_required=1"), i.privacyPolicyUrl && (n += `&privacy_policy_url=${encodeURIComponent(i.privacyPolicyUrl)}`), i.scratchToReveal && (n += "&scratch_to_reveal=1"), i.coverOffset && (n += `&cover_offset=${encodeURIComponent(i.coverOffset)}`), i.fullscreen && (n += "&fullscreen=1"), i.designMode && (n += "&design_mode=1")), h.src = n, h.style.cssText = "width: 100%; height: 100%; border: none;", h.allow = "clipboard-read; clipboard-write", l.appendChild(h), S = !0, y = t;
    }
  }
}, F = () => {
  var o;
  p = document.querySelector('meta[name="viewport"]');
  const t = document.createElement("meta");
  t.name = "viewport", t.content = "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no", t.id = "club-viewport-meta-tag", document.head.appendChild(t), p && ((o = p.parentNode) == null || o.removeChild(p));
}, O = () => {
  var o;
  const t = document.querySelector('meta[name="viewport"]');
  t && ((o = t.parentNode) == null || o.removeChild(t)), p && document.head.appendChild(p);
}, j = (t) => {
  const o = t.getAttribute("data-custom") === "true", i = H(t);
  let a;
  if (o) {
    if (a = t.querySelector(":first-child"), !a) {
      console.error("Embed Script: Missing custom button element.");
      return;
    }
  } else
    a = document.createElement("button"), a.className = `club-badge ${i.badgeColor} ${i.badgeSize}`, a.innerHTML = `${i.badgeIcon} <span class="club-badge-text">${i.badgeText}</span>`, a.setAttribute("title", i.badgeText), t.appendChild(a);
  a.addEventListener("click", () => {
    w(), k();
    const l = t.getAttribute("data-intentid"), n = new URL(window.location.href);
    n.searchParams.set("club", i.brandName), l && n.searchParams.set("intentid", l), window.history.pushState({}, "", n), f(i.brandName, l);
  });
}, w = () => {
  if (e) return e;
  e = document.createElement("div"), e.className = "club-drawer-backdrop";
  const t = `
  <div id="club-close-confirmation-box" class="club-modal-container">
    <div class="club-modal" style="width: calc(100% - 64px);position: relative;">

       <button id="club-close-confirmation-modal-button" style="position:absolute;top:24px;right:24px;border:none;background:transparent;cursor:pointer;">
          <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M15.8334 4.16675L10 10.0001M10 10.0001L4.16669 15.8334M10 10.0001L4.16669 4.16675M10 10.0001L15.8334 15.8334" stroke="#475059" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
          </svg>
        </button>

      <div style="margin-bottom: 16px">
        <svg width="57" height="56" viewBox="0 0 57 56" fill="none" xmlns="http://www.w3.org/2000/svg">
          <path fill-rule="evenodd" clip-rule="evenodd" d="M28.5029 53.9768C19.1511 53.9768 10.1603 48.4885 5.61075 40.0032C0.979952 31.3735 1.53958 21.5342 7.15431 13.0218C11.8302 6.19747 19.9003 2 28.2592 2C30.0826 2 31.8339 2.18052 33.5039 2.55063C42.7654 4.43725 51.6569 12.9135 49.8154 23.3215C49.68 24.2242 49.4363 25.0727 49.1203 25.867H49.5988C51.0521 25.867 52.4242 26.508 53.363 27.6274C54.3018 28.7467 54.6809 30.209 54.4191 31.6443L54.3108 32.2582C53.0651 39.4436 48.6419 46.0241 42.4765 49.8876C37.9902 52.6227 33.3052 53.9858 28.5029 53.9858V53.9768Z" fill="#B593F9"/>
          <path fill-rule="evenodd" clip-rule="evenodd" d="M43.3521 31.0755L43.4153 30.7506H49.5897L49.5266 31.0846L49.4633 31.4366C48.4523 37.25 44.8686 42.5848 39.8587 45.7262C36.2208 47.9378 32.4025 49.0752 28.4848 49.0752C20.9022 49.0752 13.6266 44.6069 9.90751 37.6833C6.15233 30.6875 6.63072 22.6805 11.2254 15.7208C14.9625 10.2686 21.489 6.88345 28.2682 6.89247C29.6673 6.89247 31.0846 7.02797 32.4476 7.32586C39.5337 8.77016 46.34 14.9806 44.9679 22.509C44.3722 26.5441 40.1476 28.9543 36.4014 28.9543C32.6553 28.9543 29.6041 32.0415 29.6041 35.8418C29.6041 36.7084 28.9814 37.3403 28.2231 37.3403C27.4649 37.3403 26.842 36.7083 26.842 35.923C26.842 32.0234 23.7999 28.9362 20.0447 28.9362C19.2864 28.9362 18.6636 28.3043 18.6636 27.519C18.6636 26.7337 19.2864 26.1017 20.0447 26.1017C23.7909 26.1017 26.842 23.0145 26.842 19.2142C26.842 18.4379 27.4649 17.797 28.2231 17.797C28.9814 17.797 29.6041 18.4289 29.6041 19.2142C29.6041 22.9333 32.4838 26.0746 35.8779 26.0746C38.1888 26.0746 40.951 24.8921 41.7634 22.6174C42.63 19.2413 41.0502 15.6035 37.7193 13.3648C35.1286 11.5504 32.0504 10.5846 28.8278 10.5846C20.7307 10.5846 13.6266 16.3707 12.2906 24.0707C11.415 28.214 12.3357 32.7095 14.8271 36.4195C17.2644 40.0483 20.9565 42.5397 24.9373 43.2347C25.9844 43.4514 27.0225 43.5597 28.0606 43.5597C35.2279 43.5597 41.7634 38.279 43.298 31.2741L43.3432 31.0394L43.3521 31.0755Z" fill="#060708"/>
        </svg>
      </div>

      <h4 style="margin-bottom: 48px; color: #060708;">Boost rewards &<br/> enable payouts</h4>

      <div style="display: flex; flex-direction: column; gap: 12px; width: 100%;">
        <Button id="club-download-app" class="club-button primary" >
          <svg width="20" height="18" viewBox="0 0 20 18" xmlns="http://www.w3.org/2000/svg" style="fill:none!important;">
          <path d="M9 13.125H9.0075M6.15 16.5H11.85C12.6901 16.5 13.1101 16.5 13.431 16.3365C13.7132 16.1927 13.9427 15.9632 14.0865 15.681C14.25 15.3601 14.25 14.9401 14.25 14.1V3.9C14.25 3.05992 14.25 2.63988 14.0865 2.31901C13.9427 2.03677 13.7132 1.8073 13.431 1.66349C13.1101 1.5 12.6901 1.5 11.85 1.5H6.15C5.30992 1.5 4.88988 1.5 4.56901 1.66349C4.28677 1.8073 4.0573 2.03677 3.91349 2.31901C3.75 2.63988 3.75 3.05992 3.75 3.9V14.1C3.75 14.9401 3.75 15.3601 3.91349 15.681C4.0573 15.9632 4.28677 16.1927 4.56901 16.3365C4.88988 16.5 5.30992 16.5 6.15 16.5ZM9.375 13.125C9.375 13.3321 9.20711 13.5 9 13.5C8.79289 13.5 8.625 13.3321 8.625 13.125C8.625 12.9179 8.79289 12.75 9 12.75C9.20711 12.75 9.375 12.9179 9.375 13.125Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
          </svg>

          <span>Download the Club app</span>
       </Button>

        <Button id="club-back-to-website" class="club-button subtle">
          <span>Back to ${window.origin.replace("https://", "").replace("http://", "")}</span>
        </Button>
      </div>

    </div>
  </div>
  `, o = `
  <div id="club-download-app-box" class="club-modal-container" style="flex-direction: column;">
    <div id="club-download-app-close-box" style="flex:1; width:100%; display:block;"></div>
    <div class="club-modal" style="width: 100%;background-color: #F7F8F9;">
      <div style="width:100%;">
        <div style="margin-bottom: 16px;">
          <svg width="56" height="56" viewBox="0 0 56 56" fill="none" xmlns="http://www.w3.org/2000/svg">
            <rect width="56" height="56" rx="12" fill="#060708"/>
            <path d="M42.6963 30.7212L42.6379 31.0424L42.5892 31.2761C41.0802 38.1788 34.635 43.3778 27.5765 43.3778C26.5543 43.3778 25.532 43.2707 24.5 43.0565C20.5764 42.3653 16.945 39.9118 14.5402 36.3388C12.0868 32.6781 11.1716 28.2482 12.0381 24.1689C13.3622 16.5847 20.3623 10.8795 28.3359 10.8795C31.5098 10.8795 34.5474 11.8238 37.0982 13.6152C40.3792 15.8155 41.9369 19.3983 41.0802 22.728C40.2721 24.9673 37.5558 26.1356 35.2776 26.1356C31.9285 26.1356 29.0953 23.0396 29.0953 19.3789C29.0953 18.6097 28.482 17.9866 27.7323 17.9866C26.9826 17.9866 26.3693 18.6097 26.3693 19.3789C26.3693 23.1272 23.3609 26.1648 19.671 26.1648C18.9213 26.1648 18.308 26.7879 18.308 27.557C18.308 28.3261 18.9213 28.9492 19.671 28.9492C23.3706 28.9492 26.3693 31.9868 26.3693 35.8325C26.3693 36.6016 26.9826 37.2247 27.7323 37.2247C28.482 37.2247 29.0953 36.6016 29.0953 35.7449C29.0953 31.9966 32.1037 28.959 35.7936 28.959C39.4835 28.959 43.6504 26.5834 44.2346 22.6112C45.5879 15.1924 38.8799 9.06859 31.8993 7.64715C30.5557 7.35507 29.1635 7.21877 27.781 7.21877C21.1022 7.20904 14.6668 10.5387 10.9866 15.9129C6.45943 22.7767 5.99211 30.6627 9.69174 37.5557C13.3524 44.3806 20.5278 48.7812 27.9952 48.7812C31.8506 48.7812 35.6184 47.6616 39.2012 45.4807C44.1372 42.3847 47.6714 37.1274 48.6644 31.4027L48.7228 31.0522L48.7812 30.7309H42.6963V30.7212Z" fill="#9667F7"/>
          </svg>
        </div>

        <h4 style="margin-bottom: 16px;font-weight:700;">Download the Club app!</h4>

        <div class="club-tabs" style="margin-bottom: 10px;">
          <Button id="club-ios-app-tab" class="club-button club-tab selected" >
            <span>IOS</span>
        </Button>

          <Button id="club-android-app-tab" class="club-button club-tab" >
             <span>Android</span>
          </Button>
        </div>

        <div class="club-links-container" style="padding:16px 52px;">
            <div id="club-ios-links" class="club-links visible">
              <img class="club-qr-code" width="223px" src="https://storage.googleapis.com/shared_distribution_bucket/images/80a9cea5-c69c-42f2-a3c8-1aa1286b5386" alt="Club iOS Qr" />
              <a href="https://apps.apple.com/no/app/club/id1639349320" target="_blank" rel="noopener noreferrer">
                <img width="120px" style="border-radius:8px;" src="https://storage.googleapis.com/shared_distribution_bucket/images/5ec7094d-e756-4fc8-ad61-fc36d68a9a38" alt="Club iOS link" />
              </a>
            </div>

            <div id="club-android-links" class="club-links">
              <img class="club-qr-code" width="223px" src="https://storage.googleapis.com/shared_distribution_bucket/images/f4802de5-b987-4166-a35e-1dcc376f6297" alt="Club android Qr" />
              <a href="https://play.google.com/store/apps/details?id=com.club.mobile.android" target="_blank" rel="noopener noreferrer">
                <img width="120px" style="border-radius:8px;" src="https://storage.googleapis.com/shared_distribution_bucket/images/aaf5274b-b539-4dc9-8d10-8b86d65f7710" alt="Club android link" />
              </a>
          </div>
        </div>

      </div>
    </div>
  </div>
  `;
  function i() {
    const d = navigator.userAgent || navigator.vendor;
    return /android/i.test(d) ? "android" : /iPad|iPhone|iPod/.test(d) ? "ios" : "other";
  }
  e.innerHTML = `
    <button id="club-close-drawer" class="club-close-drawer">
      <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
        <path d="M15.8334 4.16675L10 10.0001M10 10.0001L4.16669 15.8334M10 10.0001L4.16669 4.16675M10 10.0001L15.8334 15.8334" stroke="#060708" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
      </svg>
    </button>
    <div class="club-drawer">
      <div class="club-drawer-header">
        <a href="${i() === "ios" ? "https://apps.apple.com/no/app/club/id1639349320" : "https://play.google.com/store/apps/details?id=com.club.mobile.android"}" target="_blank" class="club-button subtle">Download App</a>

        <button id="club-close-drawer-header" class="club-close-drawer-header">
          <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M15.8334 4.16675L10 10.0001M10 10.0001L4.16669 15.8334M10 10.0001L4.16669 4.16675M10 10.0001L15.8334 15.8334" stroke="#060708" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
          </svg>
        </button>
      </div>
      <div class="club-drawer-content">
        ${t}
        ${o}

        <div id="club-iframe-container"></div>
      </div>
    </div>
  `, document.body.appendChild(e), e.querySelector("#club-close-drawer").addEventListener("click", _), e.querySelector("#club-close-drawer-header").addEventListener("click", _), e.querySelector(
    "#club-close-confirmation-modal-button"
  ).addEventListener("click", () => {
    const d = e == null ? void 0 : e.querySelector(
      "#club-close-confirmation-box"
    );
    d == null || d.classList.remove("open");
  });
  const r = e.querySelector("#club-download-app"), s = e == null ? void 0 : e.querySelector("#club-download-app-box");
  r.addEventListener("click", () => {
    s.classList.add("open");
  }), (e == null ? void 0 : e.querySelector(
    "#club-download-app-close-box"
  )).addEventListener("click", () => {
    s.classList.remove("open");
  }), e.querySelector("#club-back-to-website").addEventListener("click", M);
  const b = e.querySelector("#club-ios-app-tab"), m = e.querySelector("#club-android-app-tab"), C = e == null ? void 0 : e.querySelector("#club-ios-links"), v = e == null ? void 0 : e.querySelector("#club-android-links");
  return b.addEventListener("click", () => {
    b.classList.add("selected"), m.classList.remove("selected"), C.classList.add("visible"), v.classList.remove("visible");
  }), m.addEventListener("click", () => {
    m.classList.add("selected"), b.classList.remove("selected"), C.classList.remove("visible"), v.classList.add("visible");
  }), e;
}, _ = () => {
  if (y && P.includes(y)) {
    M();
    return;
  }
  const t = e == null ? void 0 : e.querySelector(
    "#club-close-confirmation-box"
  );
  t && t.classList.add("open");
}, I = (t) => {
  var i, a, l;
  const o = (i = t.data) == null ? void 0 : i.event;
  if (o === "clubAppDiscountCode") {
    const n = (a = t.data) == null ? void 0 : a.discountCode;
    n && (document.cookie = `discount_code=${encodeURIComponent(n)}; path=/; max-age=${60 * 60 * 24 * 30}`);
  } else if (o === "clubAppSwitchView") {
    const n = (l = t.data) == null ? void 0 : l.view;
    (n === "drawer" || n === "modal") && V(n);
  } else if (o === "clubAppClose")
    M();
  else if (o === "clubRequestParentUrl") {
    const n = t.source;
    n == null || n.postMessage({ event: "clubParentUrl", url: window.location.href }, "*");
  }
}, V = (t) => {
  !e || g === t || (e.classList.add("no-animate"), e.classList.remove("slide-in"), g === "modal" && e.classList.remove("modal"), t === "modal" ? e.classList.add("modal") : e.classList.remove("fullscreen"), g = t, e.offsetHeight, e.classList.add("slide-in"), requestAnimationFrame(() => {
    e == null || e.classList.remove("no-animate");
  }));
}, M = () => {
  window.removeEventListener("message", I);
  const t = e == null ? void 0 : e.querySelector(
    "#club-close-confirmation-box"
  );
  t == null || t.classList.remove("open"), e == null || e.classList.remove("slide-in");
  const o = new URL(window.location.href);
  o.searchParams.delete("club"), o.searchParams.delete("intentid"), window.history.pushState({}, "", o), window.innerWidth < 540 && O(), setTimeout(() => {
    e && (e.classList.remove("open"), e.classList.remove("modal"), e.classList.remove("fullscreen"), g = "drawer"), S = !1;
  }, 300);
}, k = (t = "drawer", o) => {
  e && (g = t, t === "modal" ? (e.classList.add("modal"), e.classList.toggle("fullscreen", (o == null ? void 0 : o.fullscreen) === !0)) : (e.classList.remove("modal"), e.classList.remove("fullscreen")), window.innerWidth < 540 && F(), e.classList.add("open"), setTimeout(() => {
    e == null || e.classList.add("slide-in");
  }, 100), window.addEventListener("message", I));
}, R = () => {
  U(), document.querySelectorAll('[data-club-embed="true"]').forEach((c) => {
    if (!c.getAttribute("data-brand-name")) {
      console.error('Embed Script: Missing "data-brand-name" attribute on container.');
      return;
    }
    j(c);
  });
  const o = new URL(window.location.href), i = o.searchParams.get("club"), a = o.searchParams.get("intentid"), n = window.location.hash.match(/(?:^|[#&])token=([^&]+)/), r = n ? decodeURIComponent(n[1]) : null;
  r && window.history.replaceState({}, "", o.pathname + o.search), i && (w(), k(), f(i, a, void 0, r));
  const s = document.querySelector("#club-signup-config");
  if (s) {
    const c = s.getAttribute("data-brand-name") || "", x = s.getAttribute("data-intentid") || null, b = s.getAttribute("data-signup-discount-code") || null, m = parseInt(
      s.getAttribute("data-signup-discount-pct") || "10",
      10
    ), C = s.getAttribute("data-signup-phone-required") === "true", v = s.getAttribute("data-signup-privacy-policy-url"), d = s.getAttribute("data-signup-scratch-to-reveal") === "true", $ = s.getAttribute("data-signup-cover-offset") || null, B = s.getAttribute("data-signup-fullscreen") === "true", L = s.getAttribute("data-signup-design-mode") === "true", A = `club_signup_shown_${c}`;
    if (c && (L || !localStorage.getItem(A))) {
      const q = {
        mode: "signup",
        discountCode: b,
        discountPct: m,
        phoneRequired: C,
        privacyPolicyUrl: v,
        scratchToReveal: d,
        coverOffset: $,
        fullscreen: B,
        designMode: L
      }, T = () => {
        e != null && e.classList.contains("open") || (w(), f(c, x, q));
      }, u = navigator.connection;
      if (!(u != null && u.saveData || (u == null ? void 0 : u.effectiveType) === "slow-2g")) {
        const E = () => {
          "requestIdleCallback" in window ? requestIdleCallback(T, { timeout: 2e3 }) : setTimeout(T, 200);
        };
        document.readyState === "complete" ? E() : window.addEventListener("load", E, { once: !0 });
      }
      setTimeout(() => {
        e != null && e.classList.contains("open") || (L || localStorage.setItem(A, "1"), w(), f(c, x, q), k("modal", { fullscreen: B }));
      }, 5e3);
    }
  }
}, N = (t, o) => {
  if (!t) {
    console.error("openClubDrawer: brand name is required.");
    return;
  }
  w(), k();
  const i = new URL(window.location.href);
  i.searchParams.set("club", t), o ? i.searchParams.set("intentid", o) : i.searchParams.delete("intentid"), window.history.pushState({}, "", i), f(t, o);
};
D();
window.setupClubEmbed = R;
window.openClubDrawer = N;
document.addEventListener("DOMContentLoaded", R);
export {
  R as setupClubEmbed
};
