import { c as F, b as q, S as O, D, R as V, v as H, f as X, K as E, r as M, Z as L, F as S, e as g, s as v, a1 as C, a4 as x, g as d, k as Z, a as G, y as J, N as K, J as Q, a3 as b, h as Y, a2 as W, V as $, W as tt, X as et, n as it } from "./PlayerAccountControllerNd-NUeaPDxp.js";
function z(i, t) {
  F(i, t);
}
function rt(i) {
  q.set(i);
}
const A = {
  en: {
    titleTransactionHistory: "Transaction History",
    loading: "Loading, please wait ..."
  },
  "zh-hk": {
    titleTransactionHistory: "交易記錄",
    loading: "加載請稍候…"
  },
  fr: {
    titleTransactionHistory: "Historique des transactions",
    loading: "Chargement, veuillez patienter ..."
  },
  ro: {
    titleTransactionHistory: "Istoric tranzacții",
    loading: "Se încarcă..."
  },
  es: {
    titleTransactionHistory: "Historial de transacciones",
    loading: "Cargando ... Por favor espere ..."
  },
  pt: {
    titleTransactionHistory: "Histórico de transações",
    loading: "Carregando, por favor espere ..."
  },
  hr: {
    titleTransactionHistory: "Povijest transakcija",
    loading: "Učitavanje"
  },
  "pt-br": {
    titleTransactionHistory: "Histórico de transações",
    Loading: "Carregando, por favor espere..."
  },
  "es-mx": {
    titleTransactionHistory: "Historial de transacciones",
    Loading: "Cargando, por favor espere..."
  },
  "en-us": {
    titleTransactionHistory: "Transaction History",
    loading: "Loading, please wait ..."
  }
};
function nt(i) {
  X(i, "svelte-1v10tii", ".TransactionHistoryWrapper{background-color:var(--emw--color-pale, var(--emw--color-gray-50, #F1F1F1));border-radius:var(--emw--border-radius-large, 10px);color:var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));padding:50px 50px 30px 50px;max-width:100%}.TransactionHistoryWrapper.TransactionHistoryWrapperMobile{padding:20px 15px;max-width:unset;border-radius:0}.MenuReturnButton{color:var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));display:inline-flex;align-items:center;column-gap:10px;margin-bottom:10px}.MenuReturnButton svg{fill:var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E))}.TransactionHistoryTitle{font-size:var(--emw--font-size-x-large, 26px);color:var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));font-weight:var(--emw--font-weigh-normal, 400)}.TransactionHistoryTitleMobile{font-size:var(--emw--size-standard, 16px)}.TransactionHistoryTitleNone{display:none}.TransactionHistoryIframeWrapper iframe{border:none;width:100%;height:85vh}");
}
function at(i) {
  let t, e, s, n, c, f, u, y, m, o, a = (
    /*$_*/
    i[3]("titleTransactionHistory") + ""
  ), l, _, k;
  return {
    c() {
      t = v("div"), e = b("svg"), s = b("defs"), n = b("style"), c = x(".aaa{fill:var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));}"), f = b("g"), u = b("g"), y = b("path"), m = C(), o = v("h2"), l = x(a), d(y, "class", "aaa"), d(y, "d", "M7.5,0,6.136,1.364,11.3,6.526H0V8.474H11.3L6.136,13.636,7.5,15,15,7.5Z"), d(y, "transform", "translate(15 15) rotate(180)"), d(u, "transform", "translate(20 158)"), d(f, "transform", "translate(-20 -158)"), d(e, "xmlns", "http://www.w3.org/2000/svg"), d(e, "width", "15"), d(e, "height", "15"), d(e, "viewBox", "0 0 15 15"), d(o, "class", "TransactionHistoryTitleMobile"), d(t, "class", "MenuReturnButton");
    },
    m(p, w) {
      S(p, t, w), g(t, e), g(e, s), g(s, n), g(n, c), g(e, f), g(f, u), g(u, y), g(t, m), g(t, o), g(o, l), _ || (k = Q(
        t,
        "click",
        /*click_handler*/
        i[14]
      ), _ = !0);
    },
    p(p, w) {
      w & /*$_*/
      8 && a !== (a = /*$_*/
      p[3]("titleTransactionHistory") + "") && L(l, a);
    },
    d(p) {
      p && M(t), _ = !1, k();
    }
  };
}
function st(i) {
  let t, e, s;
  return {
    c() {
      t = v("div"), e = v("iframe"), W(e.src, s = /*iframeUrl*/
      i[2]) || d(e, "src", s), d(e, "title", "Transaction History Iframe"), d(t, "class", "TransactionHistoryIframeWrapper");
    },
    m(n, c) {
      S(n, t, c), g(t, e);
    },
    p(n, c) {
      c & /*iframeUrl*/
      4 && !W(e.src, s = /*iframeUrl*/
      n[2]) && d(e, "src", s);
    },
    d(n) {
      n && M(t);
    }
  };
}
function ot(i) {
  let t, e = (
    /*$_*/
    i[3]("loading") + ""
  ), s;
  return {
    c() {
      t = v("p"), s = x(e);
    },
    m(n, c) {
      S(n, t, c), g(t, s);
    },
    p(n, c) {
      c & /*$_*/
      8 && e !== (e = /*$_*/
      n[3]("loading") + "") && L(s, e);
    },
    d(n) {
      n && M(t);
    }
  };
}
function lt(i) {
  let t, e, s, n = (
    /*$_*/
    i[3]("titleTransactionHistory") + ""
  ), c, f, u = (
    /*isMobile*/
    i[4] && at(i)
  );
  function y(a, l) {
    return (
      /*isLoading*/
      a[1] ? ot : st
    );
  }
  let m = y(i), o = m(i);
  return {
    c() {
      t = v("div"), u && u.c(), e = C(), s = v("h2"), c = x(n), f = C(), o.c(), d(s, "class", "TransactionHistoryTitle " + /*isMobile*/
      (i[4] ? "TransactionHistoryTitleNone" : "")), d(t, "class", "TransactionHistoryWrapper " + /*isMobile*/
      (i[4] ? "TransactionHistoryWrapperMobile" : ""));
    },
    m(a, l) {
      S(a, t, l), u && u.m(t, null), g(t, e), g(t, s), g(s, c), g(t, f), o.m(t, null), i[15](t);
    },
    p(a, [l]) {
      /*isMobile*/
      a[4] && u.p(a, l), l & /*$_*/
      8 && n !== (n = /*$_*/
      a[3]("titleTransactionHistory") + "") && L(c, n), m === (m = y(a)) && o ? o.p(a, l) : (o.d(1), o = m(a), o && (o.c(), o.m(t, null)));
    },
    i: E,
    o: E,
    d(a) {
      a && M(t), u && u.d(), o.d(), i[15](null);
    }
  };
}
function ct(i, t, e) {
  let s;
  Z(i, G, (r) => e(3, s = r));
  let { endpoint: n = "" } = t, { session: c = "" } = t, { playerid: f = "" } = t, { lang: u = "en" } = t, { clientstyling: y = "" } = t, { clientstylingurl: m = "" } = t, { mbsource: o } = t, { translationurl: a = "" } = t, l, _, k = window.navigator.userAgent, p = J(k) !== "PC", w = !0, B = "";
  const I = () => {
    fetch(a).then((h) => h.json()).then((h) => {
      Object.keys(h).forEach((T) => {
        z(T, h[T]);
      });
    }).catch((h) => {
      console.log(h);
    });
  };
  Object.keys(A).forEach((r) => {
    z(r, A[r]);
  });
  const j = () => {
    window.postMessage(
      {
        type: "PlayerAccountMenuActive",
        isMobile: p
      },
      window.location.href
    );
  }, R = () => {
    let r = new URL(`${n}/v1/player/${f}/hostedcashier/customertransactionhistoryurl`);
    r.searchParams.append("language", u);
    let h = {
      method: "GET",
      headers: {
        "X-SessionId": c,
        accept: "application/json"
      }
    };
    fetch(r.href, h).then((T) => T.json()).then(
      (T) => {
        e(1, w = !1), e(2, B = T.CashierUrl);
      },
      (T) => {
        console.error(T);
      }
    );
  }, N = () => {
    rt(u);
  };
  K(() => () => {
  });
  const P = () => j();
  function U(r) {
    Y[r ? "unshift" : "push"](() => {
      l = r, e(0, l);
    });
  }
  return i.$$set = (r) => {
    "endpoint" in r && e(6, n = r.endpoint), "session" in r && e(7, c = r.session), "playerid" in r && e(8, f = r.playerid), "lang" in r && e(9, u = r.lang), "clientstyling" in r && e(10, y = r.clientstyling), "clientstylingurl" in r && e(11, m = r.clientstylingurl), "mbsource" in r && e(12, o = r.mbsource), "translationurl" in r && e(13, a = r.translationurl);
  }, i.$$.update = () => {
    i.$$.dirty & /*lang*/
    512 && u && N(), i.$$.dirty & /*session, playerid, endpoint, lang*/
    960 && c && f && n && u && R(), i.$$.dirty & /*clientstyling, customStylingContainer*/
    1025 && y && l && $(l, y), i.$$.dirty & /*clientstylingurl, customStylingContainer*/
    2049 && m && l && tt(l, m), i.$$.dirty & /*mbsource, customStylingContainer*/
    4097 && o && l && et(l, `${o}.Style`, _), i.$$.dirty & /*translationurl*/
    8192 && a && I();
  }, [
    l,
    w,
    B,
    s,
    p,
    j,
    n,
    c,
    f,
    u,
    y,
    m,
    o,
    a,
    P,
    U
  ];
}
class ut extends O {
  constructor(t) {
    super(), D(
      this,
      t,
      ct,
      lt,
      V,
      {
        endpoint: 6,
        session: 7,
        playerid: 8,
        lang: 9,
        clientstyling: 10,
        clientstylingurl: 11,
        mbsource: 12,
        translationurl: 13
      },
      nt
    );
  }
  get endpoint() {
    return this.$$.ctx[6];
  }
  set endpoint(t) {
    this.$$set({ endpoint: t }), H();
  }
  get session() {
    return this.$$.ctx[7];
  }
  set session(t) {
    this.$$set({ session: t }), H();
  }
  get playerid() {
    return this.$$.ctx[8];
  }
  set playerid(t) {
    this.$$set({ playerid: t }), H();
  }
  get lang() {
    return this.$$.ctx[9];
  }
  set lang(t) {
    this.$$set({ lang: t }), H();
  }
  get clientstyling() {
    return this.$$.ctx[10];
  }
  set clientstyling(t) {
    this.$$set({ clientstyling: t }), H();
  }
  get clientstylingurl() {
    return this.$$.ctx[11];
  }
  set clientstylingurl(t) {
    this.$$set({ clientstylingurl: t }), H();
  }
  get mbsource() {
    return this.$$.ctx[12];
  }
  set mbsource(t) {
    this.$$set({ mbsource: t }), H();
  }
  get translationurl() {
    return this.$$.ctx[13];
  }
  set translationurl(t) {
    this.$$set({ translationurl: t }), H();
  }
}
it(ut, { endpoint: {}, session: {}, playerid: {}, lang: {}, clientstyling: {}, clientstylingurl: {}, mbsource: {}, translationurl: {} }, [], [], !0);
export {
  ut as default
};
