import { a2 as push, ao as ensure_array_like, ap as push_element, aq as attr, ar as pop_element, as as escape_html, a4 as pop, a0 as FILENAME } from './exports-5bDEyudc.js';
import './client-CmENaDmn.js';
import { a as formatNumber } from './utils2-BNPuf_o4.js';

_page[FILENAME] = "src/routes/+page.svelte";
function _page($$payload, $$props) {
  push(_page);
  let { data } = $$props;
  const cards = (() => {
    return data.cards.map((cardOffered) => {
      const isOwned = data.wallet.find((cardOwned) => {
        return cardOwned.nickname.toLowerCase() === cardOffered.title.toLowerCase();
      });
      return { ...cardOffered, isOwned };
    });
  })();
  const each_array = ensure_array_like(cards);
  $$payload.out.push(`<ul class="grid.4 gap.4">`);
  push_element($$payload, "ul", 23, 0);
  $$payload.out.push(`<!--[-->`);
  for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
    let card = each_array[$$index];
    const bonus = `${card.bonus_type === "cash" ? "$" : ""}${formatNumber(card.bonus_amount)}`;
    $$payload.out.push(`<div class="grid gap.4 radius p.4 bg.grey.2">`);
    push_element($$payload, "div", 26, 4);
    $$payload.out.push(`<img${attr("src", card.image)} alt="" role="presentation"/>`);
    push_element($$payload, "img", 27, 6);
    pop_element();
    $$payload.out.push(` ${escape_html(card.title)} <p>`);
    push_element($$payload, "p", 29, 6);
    $$payload.out.push(`Earn <b>`);
    push_element($$payload, "b", 30, 13);
    $$payload.out.push(`${escape_html(bonus)} ${escape_html(card.bonus_type)}</b>`);
    pop_element();
    $$payload.out.push(` if you spend <b>`);
    push_element($$payload, "b", 31, 8);
    $$payload.out.push(`$${escape_html(formatNumber(card.bonus_spend))}</b>`);
    pop_element();
    $$payload.out.push(` in <b>`);
    push_element($$payload, "b", 32, 11);
    $$payload.out.push(`${escape_html(card.bonus_period)}</b>`);
    pop_element();
    $$payload.out.push(`</p>`);
    pop_element();
    $$payload.out.push(` <p>`);
    push_element($$payload, "p", 35, 6);
    $$payload.out.push(`<small>`);
    push_element($$payload, "small", 36, 8);
    $$payload.out.push(`Annual fee: $${escape_html(card.annual_fee)} `);
    if (card.annual_fee && card.annual_fee_waived) {
      $$payload.out.push("<!--[-->");
      $$payload.out.push(`(after first year)`);
    } else {
      $$payload.out.push("<!--[!-->");
    }
    $$payload.out.push(`<!--]--></small>`);
    pop_element();
    $$payload.out.push(`</p>`);
    pop_element();
    $$payload.out.push(` <a${attr("href", card.application_url)} target="_blank">`);
    push_element($$payload, "a", 44, 6);
    $$payload.out.push(`Apply<span class="visually-hidden">`);
    push_element($$payload, "span", 53, 13);
    $$payload.out.push(`for ${escape_html(card.title)}</span>`);
    pop_element();
    $$payload.out.push(`</a>`);
    pop_element();
    $$payload.out.push(`</div>`);
    pop_element();
  }
  $$payload.out.push(`<!--]--></ul>`);
  pop_element();
  pop();
}
_page.render = function() {
  throw new Error("Component.render(...) is no longer valid in Svelte 5. See https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes for more information");
};

export { _page as default };
//# sourceMappingURL=_page.svelte-CIZBI-vh.js.map
