import { a as X, $ as Z, S as J, i as K, s as $, f as y, b as ee, n as P, d as S, t as L, E as U, c as x, m as h, e as M, p as E, u as C, r as u, g as te, h as ie, o as se, w as ae, x as k, j as re, y as F, z as ne, A as oe, B as le, C as ce, D as ue } from "./PlayerAccountController-DQUfjs7n.js";
function W(s, e) {
  X(s, e);
}
function de(s) {
  Z.set(s);
}
const H = {
  en: {
    titleDeposit: "Deposit",
    loading: "Loading, please wait ..."
  },
  "zh-hk": {
    titleDeposit: "訂金",
    loading: "加載請稍候…"
  },
  fr: {
    titleDeposit: "Dépôt",
    loading: "Chargement, veuillez patienter ..."
  },
  tr: {
    titleDeposit: "PARA YATIR",
    loading: "Yükleniyor ..."
  },
  ro: {
    titleDeposit: "Depunere",
    loading: "Se încarcă..."
  },
  es: {
    titleDeposit: "Deposita",
    loading: "Cargando ..."
  },
  pt: {
    titleDeposit: "Depósito",
    loading: "Carregando, por favor espere ..."
  },
  hr: {
    titleDeposit: "Uplata",
    loading: "Učitavanje"
  },
  "pt-br": {
    titleDeposit: "Depositar",
    Loading: "Carregando, por favor espere..."
  },
  "es-mx": {
    titleDeposit: "Depositar",
    Loading: "Cargando, por favor espere..."
  }
};
function he(s) {
  ee(s, "svelte-1hczjj2", "button{font-family:var(--emw--button-typography)}input,select,option{font-family:inherit}.DepositWrapper{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%;height:var(--dynamic-height)}.DepositWrapper.DepositWrapperMobile{padding:20px 15px;max-width:unset;height:var(--dynamic-height)}.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))}.DepositTitle{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)}.DepositTitleMobile{font-size:var(--emw--size-standard, 16px)}.DepositTitleNone{display:none}.DepositIframeWrapper iframe{border:none;width:100%;height:85vh;border-radius:var(--emw--border-radius-large, 10px)}");
}
function pe(s) {
  let e, i, n, a, l, m, c, p, w, o, r = (
    /*$_*/
    s[4]("titleDeposit") + ""
  ), d, b, _;
  return {
    c() {
      e = M("div"), i = k("svg"), n = k("defs"), a = k("style"), l = C(".aaa{fill:var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));}"), m = k("g"), c = k("g"), p = k("path"), w = E(), o = M("h2"), d = C(r), u(p, "class", "aaa"), u(p, "d", "M7.5,0,6.136,1.364,11.3,6.526H0V8.474H11.3L6.136,13.636,7.5,15,15,7.5Z"), u(p, "transform", "translate(15 15) rotate(180)"), u(c, "transform", "translate(20 158)"), u(m, "transform", "translate(-20 -158)"), u(i, "xmlns", "http://www.w3.org/2000/svg"), u(i, "width", "15"), u(i, "height", "15"), u(i, "viewBox", "0 0 15 15"), u(o, "class", "DepositTitleMobile"), u(e, "class", "MenuReturnButton");
    },
    m(f, g) {
      x(f, e, g), h(e, i), h(i, n), h(n, a), h(a, l), h(i, m), h(m, c), h(c, p), h(e, w), h(e, o), h(o, d), b || (_ = ae(
        e,
        "click",
        /*click_handler*/
        s[18]
      ), b = !0);
    },
    p(f, g) {
      g & /*$_*/
      16 && r !== (r = /*$_*/
      f[4]("titleDeposit") + "") && L(d, r);
    },
    d(f) {
      f && S(e), b = !1, _();
    }
  };
}
function ge(s) {
  let e, i, n;
  return {
    c() {
      e = M("div"), i = M("iframe"), F(i.src, n = /*iframeUrl*/
      s[3]) || u(i, "src", n), u(i, "title", "Deposit Iframe"), u(e, "class", "DepositIframeWrapper");
    },
    m(a, l) {
      x(a, e, l), h(e, i);
    },
    p(a, l) {
      l & /*iframeUrl*/
      8 && !F(i.src, n = /*iframeUrl*/
      a[3]) && u(i, "src", n);
    },
    d(a) {
      a && S(e);
    }
  };
}
function me(s) {
  let e, i = (
    /*$_*/
    s[4]("loading") + ""
  ), n;
  return {
    c() {
      e = M("p"), n = C(i);
    },
    m(a, l) {
      x(a, e, l), h(e, n);
    },
    p(a, l) {
      l & /*$_*/
      16 && i !== (i = /*$_*/
      a[4]("loading") + "") && L(n, i);
    },
    d(a) {
      a && S(e);
    }
  };
}
function fe(s) {
  let e, i, n, a = (
    /*$_*/
    s[4]("titleDeposit") + ""
  ), l, m, c = (
    /*isMobile*/
    s[5] && pe(s)
  );
  function p(r, d) {
    return (
      /*isLoading*/
      r[1] ? me : ge
    );
  }
  let w = p(s), o = w(s);
  return {
    c() {
      e = M("div"), c && c.c(), i = E(), n = M("h2"), l = C(a), m = E(), o.c(), u(n, "class", "DepositTitle " + /*isMobile*/
      (s[5] ? "DepositTitleNone" : "")), u(e, "class", "DepositWrapper " + /*isMobile*/
      (s[5] ? "DepositWrapperMobile" : "")), U(
        e,
        "--dynamic-height",
        /*dynamicHeight*/
        s[2]
      );
    },
    m(r, d) {
      x(r, e, d), c && c.m(e, null), h(e, i), h(e, n), h(n, l), h(e, m), o.m(e, null), s[19](e);
    },
    p(r, [d]) {
      /*isMobile*/
      r[5] && c.p(r, d), d & /*$_*/
      16 && a !== (a = /*$_*/
      r[4]("titleDeposit") + "") && L(l, a), w === (w = p(r)) && o ? o.p(r, d) : (o.d(1), o = w(r), o && (o.c(), o.m(e, null))), d & /*dynamicHeight*/
      4 && U(
        e,
        "--dynamic-height",
        /*dynamicHeight*/
        r[2]
      );
    },
    i: P,
    o: P,
    d(r) {
      r && S(e), c && c.d(), o.d(), s[19](null);
    }
  };
}
function we(s, e, i) {
  let n, a;
  te(s, ue, (t) => i(4, a = t));
  let { endpoint: l = "" } = e, { session: m = "" } = e, { playerid: c = "" } = e, { lang: p = "en" } = e, { hasdefaultamount: w = "" } = e, { clientstyling: o = "" } = e, { clientstylingurl: r = "" } = e, { translationurl: d = "" } = e, { currency: b = "" } = e, { mbsource: _ } = e, { shortcashierenabled: f = "false" } = e, g, G = window.navigator.userAgent, R = ie(G) !== "PC", B = !0, j, N, T = 0, z = "";
  const O = () => {
    fetch(d).then((D) => D.json()).then((D) => {
      Object.keys(D).forEach((v) => {
        W(v, D[v]);
      });
    }).catch((D) => {
      console.log(D);
    });
  };
  Object.keys(H).forEach((t) => {
    W(t, H[t]);
  });
  const A = () => {
    window.postMessage({ type: "GoToPreviousRoute", isMobile: R }, window.location.href);
  }, I = (t) => {
    if (t.data) {
      switch (t.data.type) {
        case "ProfileDetailsData":
          i(7, b = t.data.profileDetails.currency);
          break;
      }
      switch (t.data["MMFE:setQuickDepositHeight"] && i(2, j = t.data["MMFE:setQuickDepositHeight"].toString() + "px"), t.data["MMFE:openFullCashier"] === "true" && (window.postMessage({ type: "GoToDeposit" }, window.location.href), window.postMessage({ type: "CloseShortCashier" }, window.location.href)), t.data.redirect) {
        case "mm-hc-casino":
          window.postMessage({ type: "GoToCasino" }, window.location.href);
          break;
        case "mm-hc-sports":
          window.postMessage({ type: "GoToSports" }, window.location.href);
          break;
        case "mm-hc-contact":
          window.postMessage({ type: "GoToCustomerSupport" }, window.location.href), window.postMessage({ type: "CloseShortCashier" }, window.location.href);
          break;
        case "mm-hc-back-to-merchant":
          window.postMessage({ type: "GoToHomepage" }, window.location.href);
          break;
        case "mm-wm-hc-init-deposit":
          window.postMessage(
            {
              type: "RedirectWithdrawDepositCloseModal"
            },
            window.location.href
          );
          break;
        case "mm-wm-hc-init-deposit-quick":
          window.postMessage({ type: "CloseShortCashier" }, window.location.href);
          break;
      }
    }
  }, q = () => {
    let t = new URL(`${l}/v1/player/${c}/hostedcashier/initializedeposit?showBonusSelectionInput=true`);
    if (t.searchParams.append("language", p), n && t.searchParams.append("isShortCashier", f), w)
      switch (b) {
        case "USD":
          T = 0.4;
          break;
        case "CDF":
          T = 1e3;
          break;
      }
    let D = {
      method: "POST",
      headers: {
        "X-SessionId": m,
        currency: b || "EUR",
        amount: T,
        cashierMode: "Default",
        IsShortCashier: f,
        accept: "application/json"
      }
    };
    fetch(t.href, D).then((v) => v.json()).then(
      (v) => {
        i(1, B = !1), i(3, z = v.CashierUrl);
      },
      (v) => {
        console.error(v);
      }
    );
  }, Q = () => {
    de(p);
  };
  se(() => (window.addEventListener("message", I, !1), () => {
    window.removeEventListener("message", I);
  }));
  const Y = () => A();
  function V(t) {
    re[t ? "unshift" : "push"](() => {
      g = t, i(0, g);
    });
  }
  return s.$$set = (t) => {
    "endpoint" in t && i(8, l = t.endpoint), "session" in t && i(9, m = t.session), "playerid" in t && i(10, c = t.playerid), "lang" in t && i(11, p = t.lang), "hasdefaultamount" in t && i(12, w = t.hasdefaultamount), "clientstyling" in t && i(13, o = t.clientstyling), "clientstylingurl" in t && i(14, r = t.clientstylingurl), "translationurl" in t && i(15, d = t.translationurl), "currency" in t && i(7, b = t.currency), "mbsource" in t && i(16, _ = t.mbsource), "shortcashierenabled" in t && i(17, f = t.shortcashierenabled);
  }, s.$$.update = () => {
    s.$$.dirty & /*lang*/
    2048 && p && Q(), s.$$.dirty & /*shortcashierenabled*/
    131072 && (n = f.toLocaleLowerCase() === "true"), s.$$.dirty & /*clientstyling, customStylingContainer*/
    8193 && o && g && ne(g, o), s.$$.dirty & /*clientstylingurl, customStylingContainer*/
    16385 && r && g && oe(g, r), s.$$.dirty & /*mbsource, customStylingContainer*/
    65537 && _ && g && le(g, `${_}.Style`, N), s.$$.dirty & /*translationurl*/
    32768 && d && O(), s.$$.dirty & /*session, playerid, endpoint, currency, lang, shortcashierenabled*/
    135040 && m && c && l && b && p && f && q();
  }, [
    g,
    B,
    j,
    z,
    a,
    R,
    A,
    b,
    l,
    m,
    c,
    p,
    w,
    o,
    r,
    d,
    _,
    f,
    Y,
    V
  ];
}
class ye extends J {
  constructor(e) {
    super(), K(
      this,
      e,
      we,
      fe,
      $,
      {
        endpoint: 8,
        session: 9,
        playerid: 10,
        lang: 11,
        hasdefaultamount: 12,
        clientstyling: 13,
        clientstylingurl: 14,
        translationurl: 15,
        currency: 7,
        mbsource: 16,
        shortcashierenabled: 17
      },
      he
    );
  }
  get endpoint() {
    return this.$$.ctx[8];
  }
  set endpoint(e) {
    this.$$set({ endpoint: e }), y();
  }
  get session() {
    return this.$$.ctx[9];
  }
  set session(e) {
    this.$$set({ session: e }), y();
  }
  get playerid() {
    return this.$$.ctx[10];
  }
  set playerid(e) {
    this.$$set({ playerid: e }), y();
  }
  get lang() {
    return this.$$.ctx[11];
  }
  set lang(e) {
    this.$$set({ lang: e }), y();
  }
  get hasdefaultamount() {
    return this.$$.ctx[12];
  }
  set hasdefaultamount(e) {
    this.$$set({ hasdefaultamount: e }), y();
  }
  get clientstyling() {
    return this.$$.ctx[13];
  }
  set clientstyling(e) {
    this.$$set({ clientstyling: e }), y();
  }
  get clientstylingurl() {
    return this.$$.ctx[14];
  }
  set clientstylingurl(e) {
    this.$$set({ clientstylingurl: e }), y();
  }
  get translationurl() {
    return this.$$.ctx[15];
  }
  set translationurl(e) {
    this.$$set({ translationurl: e }), y();
  }
  get currency() {
    return this.$$.ctx[7];
  }
  set currency(e) {
    this.$$set({ currency: e }), y();
  }
  get mbsource() {
    return this.$$.ctx[16];
  }
  set mbsource(e) {
    this.$$set({ mbsource: e }), y();
  }
  get shortcashierenabled() {
    return this.$$.ctx[17];
  }
  set shortcashierenabled(e) {
    this.$$set({ shortcashierenabled: e }), y();
  }
}
ce(ye, { endpoint: {}, session: {}, playerid: {}, lang: {}, hasdefaultamount: {}, clientstyling: {}, clientstylingurl: {}, translationurl: {}, currency: {}, mbsource: {}, shortcashierenabled: {} }, [], [], !0);
export {
  ye as default
};
