import { a as q, $ as V, S as X, i as Z, s as J, f as p, b as K, n as A, d as x, t as R, c as P, m as u, e as _, p as T, u as S, r as d, g as Q, h as Y, o as $, w as ee, x as k, j as te, y as I, z as ae, A as re, B as ie, C as le, D as ne } from "./PlayerAccountController-DQUfjs7n.js";
function U(r, e) {
  q(r, e);
}
function se(r) {
  V.set(r);
}
const j = {
  en: {
    titlePlayerWithdrawal: "Withdrawal",
    loading: "Loading, please wait ..."
  },
  "zh-hk": {
    titlePlayerWithdrawal: "退出",
    loading: "加載請稍候…"
  },
  fr: {
    titlePlayerWithdrawal: "Retrait",
    loading: "Chargement, veuillez patienter ..."
  },
  ro: {
    titlePlayerWithdrawal: "Retragere",
    loading: "Se încarcă..."
  },
  es: {
    titlePlayerWithdrawal: "Retirar",
    loading: "Cargando..."
  },
  pt: {
    titlePlayerWithdrawal: "Retirada",
    loading: "Carregando, por favor espere ..."
  },
  hr: {
    titlePlayerWithdrawal: "Isplata",
    loading: "Učitavanje"
  },
  "en-us": {
    titlePlayerWithdrawal: "Withdrawal",
    loading: "Loading, please wait ..."
  }
};
function oe(r) {
  K(r, "svelte-19p9ovb", "button{font-family:var(--emw--button-typography)}input,select,option{font-family:inherit}.WithdrawalWrapper{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%}.WithdrawalWrapper.WithdrawalWrapperMobile{padding:20px 15px;max-width:unset}.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))}.WithdrawalTitle{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)}.WithdrawalTitleMobile{font-size:var(--emw--size-standard, 16px)}.WithdrawalTitleNone{display:none}.WithdrawalIframeWrapper iframe{border:none;width:100%;height:85vh;border-radius:var(--emw--border-radius-large, 10px)}");
}
function ce(r) {
  let e, t, n, i, o, m, c, g, f, s, l = (
    /*$_*/
    r[3]("titlePlayerWithdrawal") + ""
  ), h, y, w;
  return {
    c() {
      e = _("div"), t = k("svg"), n = k("defs"), i = k("style"), o = S(".aaa{fill:var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));}"), m = k("g"), c = k("g"), g = k("path"), f = T(), s = _("h2"), h = S(l), d(g, "class", "aaa"), d(g, "d", "M7.5,0,6.136,1.364,11.3,6.526H0V8.474H11.3L6.136,13.636,7.5,15,15,7.5Z"), d(g, "transform", "translate(15 15) rotate(180)"), d(c, "transform", "translate(20 158)"), d(m, "transform", "translate(-20 -158)"), d(t, "xmlns", "http://www.w3.org/2000/svg"), d(t, "width", "15"), d(t, "height", "15"), d(t, "viewBox", "0 0 15 15"), d(s, "class", "WithdrawalTitleMobile"), d(e, "class", "MenuReturnButton"), d(e, "part", "MenuReturnButton");
    },
    m(v, M) {
      P(v, e, M), u(e, t), u(t, n), u(n, i), u(i, o), u(t, m), u(m, c), u(c, g), u(e, f), u(e, s), u(s, h), y || (w = ee(
        e,
        "click",
        /*click_handler*/
        r[16]
      ), y = !0);
    },
    p(v, M) {
      M & /*$_*/
      8 && l !== (l = /*$_*/
      v[3]("titlePlayerWithdrawal") + "") && R(h, l);
    },
    d(v) {
      v && x(e), y = !1, w();
    }
  };
}
function de(r) {
  let e, t, n;
  return {
    c() {
      e = _("div"), t = _("iframe"), I(t.src, n = /*iframeUrl*/
      r[2]) || d(t, "src", n), d(t, "title", "Withdrawal Iframe"), d(e, "class", "WithdrawalIframeWrapper");
    },
    m(i, o) {
      P(i, e, o), u(e, t);
    },
    p(i, o) {
      o & /*iframeUrl*/
      4 && !I(t.src, n = /*iframeUrl*/
      i[2]) && d(t, "src", n);
    },
    d(i) {
      i && x(e);
    }
  };
}
function ue(r) {
  let e, t = (
    /*$_*/
    r[3]("loading") + ""
  ), n;
  return {
    c() {
      e = _("p"), n = S(t);
    },
    m(i, o) {
      P(i, e, o), u(e, n);
    },
    p(i, o) {
      o & /*$_*/
      8 && t !== (t = /*$_*/
      i[3]("loading") + "") && R(n, t);
    },
    d(i) {
      i && x(e);
    }
  };
}
function he(r) {
  let e, t, n, i = (
    /*$_*/
    r[3]("titlePlayerWithdrawal") + ""
  ), o, m, c = (
    /*isMobile*/
    r[4] && ce(r)
  );
  function g(l, h) {
    return (
      /*isLoading*/
      l[1] ? ue : de
    );
  }
  let f = g(r), s = f(r);
  return {
    c() {
      e = _("div"), c && c.c(), t = T(), n = _("h2"), o = S(i), m = T(), s.c(), d(n, "class", "WithdrawalTitle " + /*isMobile*/
      (r[4] ? "WithdrawalTitleNone" : "")), d(e, "class", "WithdrawalWrapper " + /*isMobile*/
      (r[4] ? "WithdrawalWrapperMobile" : ""));
    },
    m(l, h) {
      P(l, e, h), c && c.m(e, null), u(e, t), u(e, n), u(n, o), u(e, m), s.m(e, null), r[17](e);
    },
    p(l, [h]) {
      /*isMobile*/
      l[4] && c.p(l, h), h & /*$_*/
      8 && i !== (i = /*$_*/
      l[3]("titlePlayerWithdrawal") + "") && R(o, i), f === (f = g(l)) && s ? s.p(l, h) : (s.d(1), s = f(l), s && (s.c(), s.m(e, null)));
    },
    i: A,
    o: A,
    d(l) {
      l && x(e), c && c.d(), s.d(), r[17](null);
    }
  };
}
function me(r, e, t) {
  let n;
  Q(r, ne, (a) => t(3, n = a));
  let { endpoint: i = "" } = e, { session: o = "" } = e, { playerid: m = "" } = e, { lang: c = "en" } = e, { hasdefaultamount: g = "" } = e, { clientstyling: f = "" } = e, { clientstylingurl: s = "" } = e, { mbsource: l } = e, { translationurl: h = "" } = e, { currency: y = "" } = e, w, v, M = window.navigator.userAgent, B = Y(M) !== "PC", L = !0, C = 0, E = "";
  const N = () => {
    fetch(h).then((b) => b.json()).then((b) => {
      Object.keys(b).forEach((W) => {
        U(W, b[W]);
      });
    }).catch((b) => {
      console.log(b);
    });
  };
  Object.keys(j).forEach((a) => {
    U(a, j[a]);
  });
  const D = () => {
    window.postMessage(
      {
        type: "PlayerAccountMenuActive",
        isMobile: B
      },
      window.location.href
    );
  }, z = (a) => {
    if (a.data) {
      switch (a.data.type) {
        case "ProfileDetailsData":
          t(6, y = a.data.profileDetails.currency);
          break;
      }
      switch (a.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);
          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;
      }
    }
  }, F = () => {
    let a = new URL(`${i}/v1/player/${m}/hostedcashier/initializewithdraw`);
    if (a.searchParams.append("language", c), g)
      switch (y) {
        case "USD":
          C = 0.4;
          break;
        case "CDF":
          C = 1e3;
          break;
      }
    let b = {
      method: "POST",
      headers: {
        "X-SessionId": o,
        currency: y || "EUR",
        amount: C,
        cashierMode: "Default",
        IsShortCashier: !1,
        accept: "application/json"
      }
    };
    fetch(a.href, b).then((W) => W.json()).then(
      (W) => {
        t(1, L = !1), t(2, E = W.CashierUrl);
      },
      (W) => {
        console.error(W);
      }
    );
  }, G = () => {
    se(c);
  };
  $(() => (window.addEventListener("message", z, !1), () => {
    window.removeEventListener("message", z);
  }));
  const H = () => D();
  function O(a) {
    te[a ? "unshift" : "push"](() => {
      w = a, t(0, w);
    });
  }
  return r.$$set = (a) => {
    "endpoint" in a && t(7, i = a.endpoint), "session" in a && t(8, o = a.session), "playerid" in a && t(9, m = a.playerid), "lang" in a && t(10, c = a.lang), "hasdefaultamount" in a && t(11, g = a.hasdefaultamount), "clientstyling" in a && t(12, f = a.clientstyling), "clientstylingurl" in a && t(13, s = a.clientstylingurl), "mbsource" in a && t(14, l = a.mbsource), "translationurl" in a && t(15, h = a.translationurl), "currency" in a && t(6, y = a.currency);
  }, r.$$.update = () => {
    r.$$.dirty & /*lang*/
    1024 && c && G(), r.$$.dirty & /*clientstyling, customStylingContainer*/
    4097 && f && w && ae(w, f), r.$$.dirty & /*clientstylingurl, customStylingContainer*/
    8193 && s && w && re(w, s), r.$$.dirty & /*mbsource, customStylingContainer*/
    16385 && l && w && ie(w, `${l}.Style`, v), r.$$.dirty & /*translationurl*/
    32768 && h && N(), r.$$.dirty & /*session, playerid, endpoint, currency, lang*/
    1984 && o && m && i && y && c && F();
  }, [
    w,
    L,
    E,
    n,
    B,
    D,
    y,
    i,
    o,
    m,
    c,
    g,
    f,
    s,
    l,
    h,
    H,
    O
  ];
}
class ge extends X {
  constructor(e) {
    super(), Z(
      this,
      e,
      me,
      he,
      J,
      {
        endpoint: 7,
        session: 8,
        playerid: 9,
        lang: 10,
        hasdefaultamount: 11,
        clientstyling: 12,
        clientstylingurl: 13,
        mbsource: 14,
        translationurl: 15,
        currency: 6
      },
      oe
    );
  }
  get endpoint() {
    return this.$$.ctx[7];
  }
  set endpoint(e) {
    this.$$set({ endpoint: e }), p();
  }
  get session() {
    return this.$$.ctx[8];
  }
  set session(e) {
    this.$$set({ session: e }), p();
  }
  get playerid() {
    return this.$$.ctx[9];
  }
  set playerid(e) {
    this.$$set({ playerid: e }), p();
  }
  get lang() {
    return this.$$.ctx[10];
  }
  set lang(e) {
    this.$$set({ lang: e }), p();
  }
  get hasdefaultamount() {
    return this.$$.ctx[11];
  }
  set hasdefaultamount(e) {
    this.$$set({ hasdefaultamount: e }), p();
  }
  get clientstyling() {
    return this.$$.ctx[12];
  }
  set clientstyling(e) {
    this.$$set({ clientstyling: e }), p();
  }
  get clientstylingurl() {
    return this.$$.ctx[13];
  }
  set clientstylingurl(e) {
    this.$$set({ clientstylingurl: e }), p();
  }
  get mbsource() {
    return this.$$.ctx[14];
  }
  set mbsource(e) {
    this.$$set({ mbsource: e }), p();
  }
  get translationurl() {
    return this.$$.ctx[15];
  }
  set translationurl(e) {
    this.$$set({ translationurl: e }), p();
  }
  get currency() {
    return this.$$.ctx[6];
  }
  set currency(e) {
    this.$$set({ currency: e }), p();
  }
}
le(ge, { endpoint: {}, session: {}, playerid: {}, lang: {}, hasdefaultamount: {}, clientstyling: {}, clientstylingurl: {}, mbsource: {}, translationurl: {}, currency: {} }, [], [], !0);
export {
  ge as default
};
