var X = (t, e, i) => new Promise((n, s) => {
  var c = (l) => {
    try {
      a(i.next(l));
    } catch (d) {
      s(d);
    }
  }, r = (l) => {
    try {
      a(i.throw(l));
    } catch (d) {
      s(d);
    }
  }, a = (l) => l.done ? n(l.value) : Promise.resolve(l.value).then(c, r);
  a((i = i.apply(t, e)).next());
});
import { c as J, b as V, S as Z, D as Q, R as Y, v as u, f as $, K as z, r as k, F as E, t as ee, k as ie, N as te, s as w, h as se, Z as ne, e as C, J as j, a4 as oe, g as S, a7 as h, V as ae, W as re, X as ce, n as le, a as be } from "./PlayerAccountControllerNd-D1zDXBBo.js";
function me(t, e) {
  J(t, e);
}
function ue(t) {
  V.set(t);
}
const de = {
  en: {
    btnEnableBiometrics: "Enable biometrics",
    btnDisableBiometrics: "Disable biometrics",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  },
  "zh-hk": {
    btnEnableBiometrics: "Enable biometrics",
    btnDisableBiometrics: "Disable biometrics",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  },
  fr: {
    btnEnableBiometrics: "Enable biometrics",
    btnDisableBiometrics: "Disable biometrics",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  },
  tr: {
    btnEnableBiometrics: "Enable biometrics",
    btnDisableBiometrics: "Disable biometrics",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  },
  ro: {
    btnEnableBiometrics: "Enable biometrics",
    btnDisableBiometrics: "Disable biometrics",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  },
  es: {
    btnEnableBiometrics: "Enable biometrics",
    btnDisableBiometrics: "Disable biometrics",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  },
  pt: {
    btnEnableBiometrics: "Enable biometrics",
    btnDisableBiometrics: "Disable biometrics",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  },
  hr: {
    btnEnableBiometrics: "Omogući biometriju",
    btnDisableBiometrics: "Onemogući biometriju",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  },
  "pt-br": {
    btnEnableBiometrics: "Enable biometrics",
    btnDisableBiometrics: "Disable biometrics",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  },
  "es-mx": {
    btnEnableBiometrics: "Enable biometrics",
    btnDisableBiometrics: "Disable biometrics",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  },
  "en-us": {
    btnEnableBiometrics: "Enable biometrics",
    btnDisableBiometrics: "Disable biometrics",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  }
};
function ge(t, e, i) {
  return window.emMessageBus && (e = window.emMessageBus.subscribe(t, i)), e;
}
function fe(t) {
  $(t, "svelte-4r3z7g", '*,*::before,*::after{margin:0;padding:0;list-style:none;text-decoration:none;outline:none;box-sizing:border-box;font-family:inherit}.toggle-content{display:flex;flex-direction:row;align-items:center;justify-content:center;background-color:transparent;border:none;border-radius:20px;cursor:pointer;gap:10px}.toggle-content:disabled{cursor:not-allowed}.toggle-content .skip-switch{display:inline-flex;align-items:center;position:relative;height:20px;vertical-align:middle;transition:opacity 0.2s}.toggle-content .skip-switch.disabled{opacity:0.5;cursor:not-allowed;pointer-events:none}.toggle-content .skip-switch.checked .skip-switch-core{border-color:var(--emw--color-primary, #22b04e);background:var(--emw--color-primary, #22b04e)}.toggle-content .skip-switch.checked .skip-switch-core::after{transform:translateX(14px)}.toggle-content .skip-switch .skip-switch-input{position:absolute;width:0;height:0;opacity:0;margin:0}.toggle-content .skip-switch .skip-switch-core{width:34px;height:20px;border-radius:20px;border:1px solid var(--emw--color-gray-300, #ababab);background:var(--emw--color-gray-300, #ababab);position:relative;cursor:pointer;transition:background-color 0.25s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.25s cubic-bezier(0.22, 1, 0.36, 1)}.toggle-content .skip-switch .skip-switch-core::after{content:"";position:absolute;top:2px;left:2px;width:14px;height:14px;background:#fff;border-radius:50%;transform:translateX(0);transition:transform 0.25s cubic-bezier(0.22, 1, 0.36, 1)}.skip-switch.shake{animation:shake 0.4s ease}@keyframes shake{0%{transform:translateX(0)}20%{transform:translateX(-3px)}40%{transform:translateX(3px)}60%{transform:translateX(-3px)}80%{transform:translateX(3px)}100%{transform:translateX(0)}}.BiometricsToggle{background:var(--emw--pam-color-primary, var(--emw--color-primary, #22b04e));border:1px solid var(--emw--pam-color-primary, var(--emw--color-primary, #22b04e));color:var(--emw--button-typography, var(--emw--color-white, #ffffff));cursor:pointer;border-radius:5px;width:100%;height:50px;display:flex;align-items:center;justify-content:center;font-size:16px;text-transform:uppercase;transition-duration:0.3s;box-sizing:border-box}.BiometricsToggle:disabled{opacity:0.6;cursor:not-allowed}');
}
function F(t) {
  let e;
  function i(c, r) {
    if (
      /*mode*/
      c[1] === "button"
    )
      return Be;
    if (
      /*mode*/
      c[1] === "switch"
    )
      return he;
  }
  let n = i(t), s = n && n(t);
  return {
    c() {
      e = w("div"), s && s.c();
    },
    m(c, r) {
      E(c, e, r), s && s.m(e, null), t[17](e);
    },
    p(c, r) {
      n === (n = i(c)) && s ? s.p(c, r) : (s && s.d(1), s = n && n(c), s && (s.c(), s.m(e, null)));
    },
    d(c) {
      c && k(e), s && s.d(), t[17](null);
    }
  };
}
function he(t) {
  let e, i, n, s, c;
  return {
    c() {
      e = w("button"), i = w("div"), i.innerHTML = '<input type="checkbox" class="skip-switch-input"/> <span class="skip-switch-core"></span>', S(i, "class", "skip-switch"), h(
        i,
        "checked",
        /*biometricsEnabled*/
        t[4]
      ), h(
        i,
        "disabled",
        /*isUpdatingBiometrics*/
        t[5] || /*isLoading*/
        t[2]
      ), h(
        i,
        "shake",
        /*shake*/
        t[6]
      ), S(e, "class", "toggle-content"), e.disabled = n = /*isUpdatingBiometrics*/
      t[5] || /*isLoading*/
      t[2];
    },
    m(r, a) {
      E(r, e, a), C(e, i), s || (c = j(
        e,
        "click",
        /*toggleBiometrics*/
        t[8]
      ), s = !0);
    },
    p(r, a) {
      a & /*biometricsEnabled*/
      16 && h(
        i,
        "checked",
        /*biometricsEnabled*/
        r[4]
      ), a & /*isUpdatingBiometrics, isLoading*/
      36 && h(
        i,
        "disabled",
        /*isUpdatingBiometrics*/
        r[5] || /*isLoading*/
        r[2]
      ), a & /*shake*/
      64 && h(
        i,
        "shake",
        /*shake*/
        r[6]
      ), a & /*isUpdatingBiometrics, isLoading*/
      36 && n !== (n = /*isUpdatingBiometrics*/
      r[5] || /*isLoading*/
      r[2]) && (e.disabled = n);
    },
    d(r) {
      r && k(e), s = !1, c();
    }
  };
}
function Be(t) {
  let e, i = (
    /*biometricsEnabled*/
    (t[4] ? (
      /*$_*/
      t[7]("btnDisableBiometrics")
    ) : (
      /*$_*/
      t[7]("btnEnableBiometrics")
    )) + ""
  ), n, s, c, r;
  return {
    c() {
      e = w("button"), n = oe(i), S(e, "class", "BiometricsToggle"), e.disabled = s = /*isUpdatingBiometrics*/
      t[5] || /*isLoading*/
      t[2];
    },
    m(a, l) {
      E(a, e, l), C(e, n), c || (r = j(
        e,
        "click",
        /*click_handler*/
        t[16]
      ), c = !0);
    },
    p(a, l) {
      l & /*biometricsEnabled, $_*/
      144 && i !== (i = /*biometricsEnabled*/
      (a[4] ? (
        /*$_*/
        a[7]("btnDisableBiometrics")
      ) : (
        /*$_*/
        a[7]("btnEnableBiometrics")
      )) + "") && ne(n, i), l & /*isUpdatingBiometrics, isLoading*/
      36 && s !== (s = /*isUpdatingBiometrics*/
      a[5] || /*isLoading*/
      a[2]) && (e.disabled = s);
    },
    d(a) {
      a && k(e), c = !1, r();
    }
  };
}
function pe(t) {
  let e, i = (
    /*isNativeApp*/
    t[0] && F(t)
  );
  return {
    c() {
      i && i.c(), e = ee();
    },
    m(n, s) {
      i && i.m(n, s), E(n, e, s);
    },
    p(n, [s]) {
      /*isNativeApp*/
      n[0] ? i ? i.p(n, s) : (i = F(n), i.c(), i.m(e.parentNode, e)) : i && (i.d(1), i = null);
    },
    i: z,
    o: z,
    d(n) {
      n && k(e), i && i.d(n);
    }
  };
}
function ye(t, e, i) {
  let n;
  ie(t, be, (o) => i(7, n = o));
  let { lang: s = "en" } = e, { clientstyling: c = "" } = e, { clientstylingurl: r = "" } = e, { mbsource: a } = e, { translationurl: l = "" } = e, { isNativeApp: d = !1 } = e, { mode: T = "button" } = e, { isFromLogin: p = !1 } = e, { isLoading: L = !1 } = e, m, U, B, g = null, y = !1, f = !1, _ = !1;
  const D = (o) => {
    Object.keys(o).forEach((b) => {
      me(b, o[b]);
    });
  }, H = () => {
    fetch(l).then((b) => b.json()).then((b) => {
      D(b);
    }).catch((b) => {
      console.log(b);
    });
  };
  D(de);
  const K = () => {
    ue(s);
  }, N = {
    BIOMETRICS_RESPONSE: 3e3,
    SHAKE_DURATION: 500
  };
  let M = !1;
  const P = () => {
    i(6, M = !0), setTimeout(
      () => {
        i(6, M = !1);
      },
      N.SHAKE_DURATION
    );
  }, v = () => {
    g && clearTimeout(g), g = setTimeout(
      () => {
        i(5, f = !1), P(), R("error", n("errorMessage"));
      },
      N.BIOMETRICS_RESPONSE
    );
  }, A = () => X(this, null, function* () {
    f || (i(5, f = !0), _ = !0, window.postMessage({
      type: "ToggleBiometrics",
      data: `${!y}`,
      isFromLogin: p
    }), v());
  }), x = (o) => {
    var b, I;
    ((b = o.data) == null ? void 0 : b.type) === "NativeAppReady" && (i(0, d = !0), O()), ((I = o.data) == null ? void 0 : I.type) === "BiometricsStatus" && (i(4, y = o.data.status || !1), i(5, f = !1), g && (clearTimeout(g), g = null), _ && (p || R("success", n(y ? "successEnableBiometrics" : "successDisableBiometrics"))), _ = !1);
  }, O = () => {
    i(5, f = !0), window.postMessage({ type: "GetBiometricsStatus" }), v();
  }, W = () => {
    window.postMessage({ type: "CheckNativeApp" });
  }, R = (o, b) => {
    window.postMessage(
      {
        type: "WidgetNotification",
        data: {
          type: o,
          message: b,
          config: { clearBefore: !0 }
        }
      },
      window.location.href
    );
  };
  te(() => (window.addEventListener("message", x), d === !0 ? O() : W(), () => {
    window.removeEventListener("message", x), B && B.unsubscribe(), g && clearTimeout(g);
  }));
  const q = () => A();
  function G(o) {
    se[o ? "unshift" : "push"](() => {
      m = o, i(3, m);
    });
  }
  return t.$$set = (o) => {
    "lang" in o && i(9, s = o.lang), "clientstyling" in o && i(10, c = o.clientstyling), "clientstylingurl" in o && i(11, r = o.clientstylingurl), "mbsource" in o && i(12, a = o.mbsource), "translationurl" in o && i(13, l = o.translationurl), "isNativeApp" in o && i(0, d = o.isNativeApp), "mode" in o && i(1, T = o.mode), "isFromLogin" in o && i(14, p = o.isFromLogin), "isLoading" in o && i(2, L = o.isLoading);
  }, t.$$.update = () => {
    t.$$.dirty & /*lang*/
    512 && s && K(), t.$$.dirty & /*clientstyling, customStylingContainer*/
    1032 && c && m && ae(m, c), t.$$.dirty & /*clientstylingurl, customStylingContainer*/
    2056 && r && m && re(m, r), t.$$.dirty & /*mbsource, customStylingContainer*/
    4104 && a && m && ce(m, `${a}.Style`, U), t.$$.dirty & /*translationurl*/
    8192 && l && H(), t.$$.dirty & /*mbsource, translationurl, translationSubscription*/
    45056 && a && !l && i(15, B = ge(`${a}.Translation`, B, D));
  }, [
    d,
    T,
    L,
    m,
    y,
    f,
    M,
    n,
    A,
    s,
    c,
    r,
    a,
    l,
    p,
    B,
    q,
    G
  ];
}
class we extends Z {
  constructor(e) {
    super(), Q(
      this,
      e,
      ye,
      pe,
      Y,
      {
        lang: 9,
        clientstyling: 10,
        clientstylingurl: 11,
        mbsource: 12,
        translationurl: 13,
        isNativeApp: 0,
        mode: 1,
        isFromLogin: 14,
        isLoading: 2
      },
      fe
    );
  }
  get lang() {
    return this.$$.ctx[9];
  }
  set lang(e) {
    this.$$set({ lang: e }), u();
  }
  get clientstyling() {
    return this.$$.ctx[10];
  }
  set clientstyling(e) {
    this.$$set({ clientstyling: e }), u();
  }
  get clientstylingurl() {
    return this.$$.ctx[11];
  }
  set clientstylingurl(e) {
    this.$$set({ clientstylingurl: e }), u();
  }
  get mbsource() {
    return this.$$.ctx[12];
  }
  set mbsource(e) {
    this.$$set({ mbsource: e }), u();
  }
  get translationurl() {
    return this.$$.ctx[13];
  }
  set translationurl(e) {
    this.$$set({ translationurl: e }), u();
  }
  get isNativeApp() {
    return this.$$.ctx[0];
  }
  set isNativeApp(e) {
    this.$$set({ isNativeApp: e }), u();
  }
  get mode() {
    return this.$$.ctx[1];
  }
  set mode(e) {
    this.$$set({ mode: e }), u();
  }
  get isFromLogin() {
    return this.$$.ctx[14];
  }
  set isFromLogin(e) {
    this.$$set({ isFromLogin: e }), u();
  }
  get isLoading() {
    return this.$$.ctx[2];
  }
  set isLoading(e) {
    this.$$set({ isLoading: e }), u();
  }
}
le(we, { lang: {}, clientstyling: {}, clientstylingurl: {}, mbsource: {}, translationurl: {}, isNativeApp: { type: "Boolean" }, mode: {}, isFromLogin: { type: "Boolean" }, isLoading: { type: "Boolean" } }, [], [], !0);
export {
  we as default
};
