import { a as q, $ as z, S as V, i as Z, s as Q, f as p, b as X, n as F, d as w, c as B, e as x, g as Y, h as J, j as K, o as W, k as $, p as f, x as E, y as v, v as k, q as tt, t as b, E as et, u as I, A as L, B as nt, C as ot, D as st } from "./PlayerAccountControllerNd-J1UPSSWX.js";
const it = (e, t = {}) => {
  const o = new CustomEvent("track-custom-event", {
    detail: {
      type: e,
      data: t
    },
    bubbles: !0,
    composed: !0
  });
  document.dispatchEvent(o);
};
function P(e, t) {
  q(e, t);
}
function lt(e) {
  z.set(e);
}
const S = {
  en: {
    logoutButton: "Logout"
  },
  "zh-hk": {
    logoutButton: "登出"
  },
  fr: {
    logoutButton: "Déconnexion"
  },
  tr: {
    logoutButton: "Çıkış Yap"
  },
  ro: {
    logoutButton: "Iesire"
  },
  es: {
    logoutButton: "Cerrar sesión"
  },
  pt: {
    logoutButton: "Sair"
  },
  hr: {
    logoutButton: "Odjava"
  },
  "pt-br": {
    logoutButton: "Fechar Sessão"
  },
  "es-mx": {
    logoutButton: "Cerrar sesión"
  },
  "en-us": {
    logoutButton: "Logout"
  }
};
function at(e) {
  X(e, "svelte-xtnqa3", "*,*::before,*::after{margin:0;padding:0;list-style:none;text-decoration:none;outline:none;box-sizing:border-box}.PlayerAccountMenuItemBox{padding:20px;font-size:16px;display:inline-flex;width:100%;box-sizing:border-box;align-items:center;cursor:pointer}.PlayerAccountMenuItemBox .PlayerLogoutText{margin-left:20px}.PlayerAccountMenuItemBox svg{fill:var(--emw--pam-typography-color-nav-bg, var(--emw--color-white, #FFFFFF))}.PlayerAccountMenuItemBoxMobile.PlayerAccountMenuItemBox{height:auto;justify-content:center;position:relative;display:flex;width:unset;padding:0}.PlayerAccountMenuItemBoxMobile.PlayerAccountMenuItemBox svg{fill:var(--emw--pam-typography-color-nav-bg, var(--emw--color-white, #FFFFFF))}");
}
function rt(e) {
  let t, o, l, n = (
    /*$_*/
    e[2]("logoutButton") + ""
  ), i, a, c;
  return {
    c() {
      t = x("div"), o = x("button"), l = x("span"), i = k(n), b(t, "class", "GeneralLogout");
    },
    m(r, d) {
      B(r, t, d), f(t, o), f(o, l), f(l, i), a || (c = E(
        o,
        "click",
        /*click_handler_1*/
        e[14]
      ), a = !0);
    },
    p(r, d) {
      d & /*$_*/
      4 && n !== (n = /*$_*/
      r[2]("logoutButton") + "") && I(i, n);
    },
    d(r) {
      r && w(t), a = !1, c();
    }
  };
}
function ut(e) {
  let t, o, l, n, i, a, c, r, d, h, _, g = !/*isMobile*/
  e[3] && ct(e);
  return {
    c() {
      t = x("p"), o = x("span"), l = v("svg"), n = v("defs"), i = v("style"), a = k(".a88316b4-2478-4a69-b2eb-d32a5fb419dd{fill:var(--emw--color-white, #FFFFFF);}"), c = v("path"), r = v("path"), d = tt(), g && g.c(), b(c, "class", "a88316b4-2478-4a69-b2eb-d32a5fb419dd"), b(c, "d", "M147.16,67.69,115.42,36a9.6,9.6,0,1,0-13.58,13.58l15.32,15.31H49.58a9.63,9.63,0,1,0,0,19.26h67.58L101.84,99.42a9.64,9.64,0,0,0,6.79,16.43,9.41,9.41,0,0,0,6.79-2.85l31.74-31.73a9.53,9.53,0,0,0,0-13.58Z"), b(r, "class", "a88316b4-2478-4a69-b2eb-d32a5fb419dd"), b(r, "d", "M45.16,122.16H19.26V26.79H45.32a9.63,9.63,0,1,0,0-19.26H9.63A9.56,9.56,0,0,0,0,17.16V131.63a9.57,9.57,0,0,0,9.63,9.64H45.32A9.57,9.57,0,0,0,55,131.63a9.78,9.78,0,0,0-9.79-9.47Z"), b(l, "id", "bbfaf345-72af-4296-bf4b-2fd41fc03d5d"), b(l, "data-name", "Layer 1"), b(l, "xmlns", "http://www.w3.org/2000/svg"), b(l, "viewBox", "0 0 150 150"), et(o, "width", /*isMobile*/
      e[3] ? (
        /*mediaQuery*/
        e[4].matches ? "20px" : "24px"
      ) : "20px"), b(t, "class", "PlayerAccountMenuItemBox " + /*isMobile*/
      (e[3] ? "PlayerAccountMenuItemBoxMobile" : "") + " " + /*mediaQuery*/
      (e[4].matches && /*isMobile*/
      e[3] ? "PlayerAccountMenuItemBoxTablet" : ""));
    },
    m(y, u) {
      B(y, t, u), f(t, o), f(o, l), f(l, n), f(n, i), f(i, a), f(l, c), f(l, r), f(t, d), g && g.m(t, null), h || (_ = E(
        t,
        "click",
        /*click_handler*/
        e[13]
      ), h = !0);
    },
    p(y, u) {
      /*isMobile*/
      y[3] || g.p(y, u);
    },
    d(y) {
      y && w(t), g && g.d(), h = !1, _();
    }
  };
}
function ct(e) {
  let t, o = (
    /*$_*/
    e[2]("logoutButton") + ""
  ), l;
  return {
    c() {
      t = x("span"), l = k(o), b(t, "class", "PlayerLogoutText");
    },
    m(n, i) {
      B(n, t, i), f(t, l);
    },
    p(n, i) {
      i & /*$_*/
      4 && o !== (o = /*$_*/
      n[2]("logoutButton") + "") && I(l, o);
    },
    d(n) {
      n && w(t);
    }
  };
}
function dt(e) {
  let t;
  function o(i, a) {
    return (
      /*buttonlocation*/
      i[0] === "PlayerAccountMenu" ? ut : rt
    );
  }
  let l = o(e), n = l(e);
  return {
    c() {
      t = x("div"), n.c();
    },
    m(i, a) {
      B(i, t, a), n.m(t, null), e[15](t);
    },
    p(i, [a]) {
      l === (l = o(i)) && n ? n.p(i, a) : (n.d(1), n = l(i), n && (n.c(), n.m(t, null)));
    },
    i: F,
    o: F,
    d(i) {
      i && w(t), n.d(), e[15](null);
    }
  };
}
function gt(e, t, o) {
  let l;
  Y(e, J, (s) => o(2, l = s));
  let { endpoint: n = "" } = t, { session: i = "" } = t, { buttonlocation: a = "" } = t, { lang: c = "" } = t, { mbsource: r } = t, { clientstyling: d = "" } = t, { clientstylingurl: h = "" } = t, { translationurl: _ = "" } = t, g = "", y = !1, u, C, T = window.navigator.userAgent, O = K(T) !== "PC";
  const j = window.matchMedia("(min-width: 768px)"), H = () => {
    fetch(_).then((m) => m.json()).then((m) => {
      Object.keys(m).forEach((A) => {
        P(A, m[A]);
      });
    }).catch((m) => {
      console.log(m);
    });
  };
  Object.keys(S).forEach((s) => {
    P(s, S[s]);
  });
  const M = () => {
    let s = new Headers();
    s.append("Content-type", "application/json"), s.append("X-SessionID", i);
    let m = { method: "DELETE", headers: s };
    fetch(`${n}/v1/player/session/player`, m).then((A) => {
      window.postMessage({ type: "LogoutSuccessfull" }, window.location.href), it("logged_out", {});
    });
  }, G = () => (n || (g = "GENERAL-LOGOUT - Endpoint is missing! Please provide a valid endpointURL.", y = !0, console.error(g)), i || (g = "GENERAL-LOGOUT - Session is missing! Please provide a valid session.", y = !0, console.error(g)), y), D = () => {
    lt(c);
  };
  W(() => () => {
  });
  const N = () => M(), R = () => M();
  function U(s) {
    $[s ? "unshift" : "push"](() => {
      u = s, o(1, u);
    });
  }
  return e.$$set = (s) => {
    "endpoint" in s && o(6, n = s.endpoint), "session" in s && o(7, i = s.session), "buttonlocation" in s && o(0, a = s.buttonlocation), "lang" in s && o(8, c = s.lang), "mbsource" in s && o(9, r = s.mbsource), "clientstyling" in s && o(10, d = s.clientstyling), "clientstylingurl" in s && o(11, h = s.clientstylingurl), "translationurl" in s && o(12, _ = s.translationurl);
  }, e.$$.update = () => {
    e.$$.dirty & /*endpoint, session, buttonlocation*/
    193 && n && i && a && G(), e.$$.dirty & /*lang*/
    256 && c && D(), e.$$.dirty & /*clientstyling, customStylingContainer*/
    1026 && d && u && L(), e.$$.dirty & /*clientstyling, customStylingContainer*/
    1026 && d && u && L(u, d), e.$$.dirty & /*clientstylingurl, customStylingContainer*/
    2050 && h && u && nt(u, h), e.$$.dirty & /*mbsource, customStylingContainer*/
    514 && r && u && ot(u, `${r}.Style`, C), e.$$.dirty & /*translationurl*/
    4096 && _ && H();
  }, [
    a,
    u,
    l,
    O,
    j,
    M,
    n,
    i,
    c,
    r,
    d,
    h,
    _,
    N,
    R,
    U
  ];
}
class ft extends V {
  constructor(t) {
    super(), Z(
      this,
      t,
      gt,
      dt,
      Q,
      {
        endpoint: 6,
        session: 7,
        buttonlocation: 0,
        lang: 8,
        mbsource: 9,
        clientstyling: 10,
        clientstylingurl: 11,
        translationurl: 12
      },
      at
    );
  }
  get endpoint() {
    return this.$$.ctx[6];
  }
  set endpoint(t) {
    this.$$set({ endpoint: t }), p();
  }
  get session() {
    return this.$$.ctx[7];
  }
  set session(t) {
    this.$$set({ session: t }), p();
  }
  get buttonlocation() {
    return this.$$.ctx[0];
  }
  set buttonlocation(t) {
    this.$$set({ buttonlocation: t }), p();
  }
  get lang() {
    return this.$$.ctx[8];
  }
  set lang(t) {
    this.$$set({ lang: t }), p();
  }
  get mbsource() {
    return this.$$.ctx[9];
  }
  set mbsource(t) {
    this.$$set({ mbsource: t }), p();
  }
  get clientstyling() {
    return this.$$.ctx[10];
  }
  set clientstyling(t) {
    this.$$set({ clientstyling: t }), p();
  }
  get clientstylingurl() {
    return this.$$.ctx[11];
  }
  set clientstylingurl(t) {
    this.$$set({ clientstylingurl: t }), p();
  }
  get translationurl() {
    return this.$$.ctx[12];
  }
  set translationurl(t) {
    this.$$set({ translationurl: t }), p();
  }
}
st(ft, { endpoint: {}, session: {}, buttonlocation: {}, lang: {}, mbsource: {}, clientstyling: {}, clientstylingurl: {}, translationurl: {} }, [], [], !0);
export {
  ft as default
};
