import { a as Kt, $ as Qt, S as Jt, i as Gt, s as jt, f as z, b as Yt, n as at, d as X, u as lt, e as Z, p as _, x as qt, g as U, v as ut, q as pt, t as L, h as Wt, o as Xt, I as Zt, k as xt, z as Et, B as $t, C as te, D as ee, c as ne, A as re } from "./PlayerAccountController-DG3KbTWa.js";
function Bt(e, t) {
  Kt(e, t);
}
function oe(e) {
  Qt.set(e);
}
const bt = {
  en: {
    titleQRSessionGenerator: "Scan the QR Code to access your account on retail devices.",
    generateQRButton: "Generate QR",
    unauthorized: "Authentication failed.",
    failedToFetch: "Cannot generate QR, Please try again.",
    unexpectedError: "Unexpected error occurred. Please try again later."
  },
  fr: {
    titleQRSessionGenerator: "Scannez le code QR pour accéder à votre compte sur les appareils en magasin.",
    generateQRButton: "Générer des QR",
    unauthorized: "L'authentification a échoué.",
    failedToFetch: "Impossible de générer le code QR, veuillez réessayer.",
    unexpectedError: "Une erreur inattendue s'est produite. Veuillez réessayer plus tard."
  }
};
var J = {}, ie = function() {
  return typeof Promise == "function" && Promise.prototype && Promise.prototype.then;
}, Tt = {}, R = {};
let ht;
const se = [
  0,
  // Not used
  26,
  44,
  70,
  100,
  134,
  172,
  196,
  242,
  292,
  346,
  404,
  466,
  532,
  581,
  655,
  733,
  815,
  901,
  991,
  1085,
  1156,
  1258,
  1364,
  1474,
  1588,
  1706,
  1828,
  1921,
  2051,
  2185,
  2323,
  2465,
  2611,
  2761,
  2876,
  3034,
  3196,
  3362,
  3532,
  3706
];
R.getSymbolSize = function(t) {
  if (!t)
    throw new Error('"version" cannot be null or undefined');
  if (t < 1 || t > 40)
    throw new Error('"version" should be in range from 1 to 40');
  return t * 4 + 17;
};
R.getSymbolTotalCodewords = function(t) {
  return se[t];
};
R.getBCHDigit = function(e) {
  let t = 0;
  for (; e !== 0; )
    t++, e >>>= 1;
  return t;
};
R.setToSJISFunction = function(t) {
  if (typeof t != "function")
    throw new Error('"toSJISFunc" is not a valid function.');
  ht = t;
};
R.isKanjiModeEnabled = function() {
  return typeof ht < "u";
};
R.toSJIS = function(t) {
  return ht(t);
};
var x = {};
(function(e) {
  e.L = { bit: 1 }, e.M = { bit: 0 }, e.Q = { bit: 3 }, e.H = { bit: 2 };
  function t(n) {
    if (typeof n != "string")
      throw new Error("Param is not a string");
    switch (n.toLowerCase()) {
      case "l":
      case "low":
        return e.L;
      case "m":
      case "medium":
        return e.M;
      case "q":
      case "quartile":
        return e.Q;
      case "h":
      case "high":
        return e.H;
      default:
        throw new Error("Unknown EC Level: " + n);
    }
  }
  e.isValid = function(o) {
    return o && typeof o.bit < "u" && o.bit >= 0 && o.bit < 4;
  }, e.from = function(o, r) {
    if (e.isValid(o))
      return o;
    try {
      return t(o);
    } catch {
      return r;
    }
  };
})(x);
function Nt() {
  this.buffer = [], this.length = 0;
}
Nt.prototype = {
  get: function(e) {
    const t = Math.floor(e / 8);
    return (this.buffer[t] >>> 7 - e % 8 & 1) === 1;
  },
  put: function(e, t) {
    for (let n = 0; n < t; n++)
      this.putBit((e >>> t - n - 1 & 1) === 1);
  },
  getLengthInBits: function() {
    return this.length;
  },
  putBit: function(e) {
    const t = Math.floor(this.length / 8);
    this.buffer.length <= t && this.buffer.push(0), e && (this.buffer[t] |= 128 >>> this.length % 8), this.length++;
  }
};
var ae = Nt;
function G(e) {
  if (!e || e < 1)
    throw new Error("BitMatrix size must be defined and greater than 0");
  this.size = e, this.data = new Uint8Array(e * e), this.reservedBit = new Uint8Array(e * e);
}
G.prototype.set = function(e, t, n, o) {
  const r = e * this.size + t;
  this.data[r] = n, o && (this.reservedBit[r] = !0);
};
G.prototype.get = function(e, t) {
  return this.data[e * this.size + t];
};
G.prototype.xor = function(e, t, n) {
  this.data[e * this.size + t] ^= n;
};
G.prototype.isReserved = function(e, t) {
  return this.reservedBit[e * this.size + t];
};
var le = G, Rt = {};
(function(e) {
  const t = R.getSymbolSize;
  e.getRowColCoords = function(o) {
    if (o === 1)
      return [];
    const r = Math.floor(o / 7) + 2, i = t(o), s = i === 145 ? 26 : Math.ceil((i - 13) / (2 * r - 2)) * 2, a = [i - 7];
    for (let l = 1; l < r - 1; l++)
      a[l] = a[l - 1] - s;
    return a.push(6), a.reverse();
  }, e.getPositions = function(o) {
    const r = [], i = e.getRowColCoords(o), s = i.length;
    for (let a = 0; a < s; a++)
      for (let l = 0; l < s; l++)
        a === 0 && l === 0 || // top-left
        a === 0 && l === s - 1 || // bottom-left
        a === s - 1 && l === 0 || r.push([i[a], i[l]]);
    return r;
  };
})(Rt);
var Mt = {};
const ue = R.getSymbolSize, St = 7;
Mt.getPositions = function(t) {
  const n = ue(t);
  return [
    // top-left
    [0, 0],
    // top-right
    [n - St, 0],
    // bottom-left
    [0, n - St]
  ];
};
var Pt = {};
(function(e) {
  e.Patterns = {
    PATTERN000: 0,
    PATTERN001: 1,
    PATTERN010: 2,
    PATTERN011: 3,
    PATTERN100: 4,
    PATTERN101: 5,
    PATTERN110: 6,
    PATTERN111: 7
  };
  const t = {
    N1: 3,
    N2: 3,
    N3: 40,
    N4: 10
  };
  e.isValid = function(r) {
    return r != null && r !== "" && !isNaN(r) && r >= 0 && r <= 7;
  }, e.from = function(r) {
    return e.isValid(r) ? parseInt(r, 10) : void 0;
  }, e.getPenaltyN1 = function(r) {
    const i = r.size;
    let s = 0, a = 0, l = 0, f = null, u = null;
    for (let B = 0; B < i; B++) {
      a = l = 0, f = u = null;
      for (let d = 0; d < i; d++) {
        let g = r.get(B, d);
        g === f ? a++ : (a >= 5 && (s += t.N1 + (a - 5)), f = g, a = 1), g = r.get(d, B), g === u ? l++ : (l >= 5 && (s += t.N1 + (l - 5)), u = g, l = 1);
      }
      a >= 5 && (s += t.N1 + (a - 5)), l >= 5 && (s += t.N1 + (l - 5));
    }
    return s;
  }, e.getPenaltyN2 = function(r) {
    const i = r.size;
    let s = 0;
    for (let a = 0; a < i - 1; a++)
      for (let l = 0; l < i - 1; l++) {
        const f = r.get(a, l) + r.get(a, l + 1) + r.get(a + 1, l) + r.get(a + 1, l + 1);
        (f === 4 || f === 0) && s++;
      }
    return s * t.N2;
  }, e.getPenaltyN3 = function(r) {
    const i = r.size;
    let s = 0, a = 0, l = 0;
    for (let f = 0; f < i; f++) {
      a = l = 0;
      for (let u = 0; u < i; u++)
        a = a << 1 & 2047 | r.get(f, u), u >= 10 && (a === 1488 || a === 93) && s++, l = l << 1 & 2047 | r.get(u, f), u >= 10 && (l === 1488 || l === 93) && s++;
    }
    return s * t.N3;
  }, e.getPenaltyN4 = function(r) {
    let i = 0;
    const s = r.data.length;
    for (let l = 0; l < s; l++)
      i += r.data[l];
    return Math.abs(Math.ceil(i * 100 / s / 5) - 10) * t.N4;
  };
  function n(o, r, i) {
    switch (o) {
      case e.Patterns.PATTERN000:
        return (r + i) % 2 === 0;
      case e.Patterns.PATTERN001:
        return r % 2 === 0;
      case e.Patterns.PATTERN010:
        return i % 3 === 0;
      case e.Patterns.PATTERN011:
        return (r + i) % 3 === 0;
      case e.Patterns.PATTERN100:
        return (Math.floor(r / 2) + Math.floor(i / 3)) % 2 === 0;
      case e.Patterns.PATTERN101:
        return r * i % 2 + r * i % 3 === 0;
      case e.Patterns.PATTERN110:
        return (r * i % 2 + r * i % 3) % 2 === 0;
      case e.Patterns.PATTERN111:
        return (r * i % 3 + (r + i) % 2) % 2 === 0;
      default:
        throw new Error("bad maskPattern:" + o);
    }
  }
  e.applyMask = function(r, i) {
    const s = i.size;
    for (let a = 0; a < s; a++)
      for (let l = 0; l < s; l++)
        i.isReserved(l, a) || i.xor(l, a, n(r, l, a));
  }, e.getBestMask = function(r, i) {
    const s = Object.keys(e.Patterns).length;
    let a = 0, l = 1 / 0;
    for (let f = 0; f < s; f++) {
      i(f), e.applyMask(f, r);
      const u = e.getPenaltyN1(r) + e.getPenaltyN2(r) + e.getPenaltyN3(r) + e.getPenaltyN4(r);
      e.applyMask(f, r), u < l && (l = u, a = f);
    }
    return a;
  };
})(Pt);
var $ = {};
const D = x, j = [
  // L  M  Q  H
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  2,
  2,
  1,
  2,
  2,
  4,
  1,
  2,
  4,
  4,
  2,
  4,
  4,
  4,
  2,
  4,
  6,
  5,
  2,
  4,
  6,
  6,
  2,
  5,
  8,
  8,
  4,
  5,
  8,
  8,
  4,
  5,
  8,
  11,
  4,
  8,
  10,
  11,
  4,
  9,
  12,
  16,
  4,
  9,
  16,
  16,
  6,
  10,
  12,
  18,
  6,
  10,
  17,
  16,
  6,
  11,
  16,
  19,
  6,
  13,
  18,
  21,
  7,
  14,
  21,
  25,
  8,
  16,
  20,
  25,
  8,
  17,
  23,
  25,
  9,
  17,
  23,
  34,
  9,
  18,
  25,
  30,
  10,
  20,
  27,
  32,
  12,
  21,
  29,
  35,
  12,
  23,
  34,
  37,
  12,
  25,
  34,
  40,
  13,
  26,
  35,
  42,
  14,
  28,
  38,
  45,
  15,
  29,
  40,
  48,
  16,
  31,
  43,
  51,
  17,
  33,
  45,
  54,
  18,
  35,
  48,
  57,
  19,
  37,
  51,
  60,
  19,
  38,
  53,
  63,
  20,
  40,
  56,
  66,
  21,
  43,
  59,
  70,
  22,
  45,
  62,
  74,
  24,
  47,
  65,
  77,
  25,
  49,
  68,
  81
], Y = [
  // L  M  Q  H
  7,
  10,
  13,
  17,
  10,
  16,
  22,
  28,
  15,
  26,
  36,
  44,
  20,
  36,
  52,
  64,
  26,
  48,
  72,
  88,
  36,
  64,
  96,
  112,
  40,
  72,
  108,
  130,
  48,
  88,
  132,
  156,
  60,
  110,
  160,
  192,
  72,
  130,
  192,
  224,
  80,
  150,
  224,
  264,
  96,
  176,
  260,
  308,
  104,
  198,
  288,
  352,
  120,
  216,
  320,
  384,
  132,
  240,
  360,
  432,
  144,
  280,
  408,
  480,
  168,
  308,
  448,
  532,
  180,
  338,
  504,
  588,
  196,
  364,
  546,
  650,
  224,
  416,
  600,
  700,
  224,
  442,
  644,
  750,
  252,
  476,
  690,
  816,
  270,
  504,
  750,
  900,
  300,
  560,
  810,
  960,
  312,
  588,
  870,
  1050,
  336,
  644,
  952,
  1110,
  360,
  700,
  1020,
  1200,
  390,
  728,
  1050,
  1260,
  420,
  784,
  1140,
  1350,
  450,
  812,
  1200,
  1440,
  480,
  868,
  1290,
  1530,
  510,
  924,
  1350,
  1620,
  540,
  980,
  1440,
  1710,
  570,
  1036,
  1530,
  1800,
  570,
  1064,
  1590,
  1890,
  600,
  1120,
  1680,
  1980,
  630,
  1204,
  1770,
  2100,
  660,
  1260,
  1860,
  2220,
  720,
  1316,
  1950,
  2310,
  750,
  1372,
  2040,
  2430
];
$.getBlocksCount = function(t, n) {
  switch (n) {
    case D.L:
      return j[(t - 1) * 4 + 0];
    case D.M:
      return j[(t - 1) * 4 + 1];
    case D.Q:
      return j[(t - 1) * 4 + 2];
    case D.H:
      return j[(t - 1) * 4 + 3];
    default:
      return;
  }
};
$.getTotalCodewordsCount = function(t, n) {
  switch (n) {
    case D.L:
      return Y[(t - 1) * 4 + 0];
    case D.M:
      return Y[(t - 1) * 4 + 1];
    case D.Q:
      return Y[(t - 1) * 4 + 2];
    case D.H:
      return Y[(t - 1) * 4 + 3];
    default:
      return;
  }
};
var _t = {}, tt = {};
const K = new Uint8Array(512), q = new Uint8Array(256);
(function() {
  let t = 1;
  for (let n = 0; n < 255; n++)
    K[n] = t, q[t] = n, t <<= 1, t & 256 && (t ^= 285);
  for (let n = 255; n < 512; n++)
    K[n] = K[n - 255];
})();
tt.log = function(t) {
  if (t < 1)
    throw new Error("log(" + t + ")");
  return q[t];
};
tt.exp = function(t) {
  return K[t];
};
tt.mul = function(t, n) {
  return t === 0 || n === 0 ? 0 : K[q[t] + q[n]];
};
(function(e) {
  const t = tt;
  e.mul = function(o, r) {
    const i = new Uint8Array(o.length + r.length - 1);
    for (let s = 0; s < o.length; s++)
      for (let a = 0; a < r.length; a++)
        i[s + a] ^= t.mul(o[s], r[a]);
    return i;
  }, e.mod = function(o, r) {
    let i = new Uint8Array(o);
    for (; i.length - r.length >= 0; ) {
      const s = i[0];
      for (let l = 0; l < r.length; l++)
        i[l] ^= t.mul(r[l], s);
      let a = 0;
      for (; a < i.length && i[a] === 0; )
        a++;
      i = i.slice(a);
    }
    return i;
  }, e.generateECPolynomial = function(o) {
    let r = new Uint8Array([1]);
    for (let i = 0; i < o; i++)
      r = e.mul(r, new Uint8Array([1, t.exp(i)]));
    return r;
  };
})(_t);
const Lt = _t;
function mt(e) {
  this.genPoly = void 0, this.degree = e, this.degree && this.initialize(this.degree);
}
mt.prototype.initialize = function(t) {
  this.degree = t, this.genPoly = Lt.generateECPolynomial(this.degree);
};
mt.prototype.encode = function(t) {
  if (!this.genPoly)
    throw new Error("Encoder not initialized");
  const n = new Uint8Array(t.length + this.degree);
  n.set(t);
  const o = Lt.mod(n, this.genPoly), r = this.degree - o.length;
  if (r > 0) {
    const i = new Uint8Array(this.degree);
    return i.set(o, r), i;
  }
  return o;
};
var ce = mt, Ut = {}, k = {}, wt = {};
wt.isValid = function(t) {
  return !isNaN(t) && t >= 1 && t <= 40;
};
var P = {};
const Dt = "[0-9]+", fe = "[A-Z $%*+\\-./:]+";
let Q = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
Q = Q.replace(/u/g, "\\u");
const de = "(?:(?![A-Z0-9 $%*+\\-./:]|" + Q + `)(?:.|[\r
]))+`;
P.KANJI = new RegExp(Q, "g");
P.BYTE_KANJI = new RegExp("[^A-Z0-9 $%*+\\-./:]+", "g");
P.BYTE = new RegExp(de, "g");
P.NUMERIC = new RegExp(Dt, "g");
P.ALPHANUMERIC = new RegExp(fe, "g");
const ge = new RegExp("^" + Q + "$"), he = new RegExp("^" + Dt + "$"), me = new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
P.testKanji = function(t) {
  return ge.test(t);
};
P.testNumeric = function(t) {
  return he.test(t);
};
P.testAlphanumeric = function(t) {
  return me.test(t);
};
(function(e) {
  const t = wt, n = P;
  e.NUMERIC = {
    id: "Numeric",
    bit: 1,
    ccBits: [10, 12, 14]
  }, e.ALPHANUMERIC = {
    id: "Alphanumeric",
    bit: 2,
    ccBits: [9, 11, 13]
  }, e.BYTE = {
    id: "Byte",
    bit: 4,
    ccBits: [8, 16, 16]
  }, e.KANJI = {
    id: "Kanji",
    bit: 8,
    ccBits: [8, 10, 12]
  }, e.MIXED = {
    bit: -1
  }, e.getCharCountIndicator = function(i, s) {
    if (!i.ccBits)
      throw new Error("Invalid mode: " + i);
    if (!t.isValid(s))
      throw new Error("Invalid version: " + s);
    return s >= 1 && s < 10 ? i.ccBits[0] : s < 27 ? i.ccBits[1] : i.ccBits[2];
  }, e.getBestModeForData = function(i) {
    return n.testNumeric(i) ? e.NUMERIC : n.testAlphanumeric(i) ? e.ALPHANUMERIC : n.testKanji(i) ? e.KANJI : e.BYTE;
  }, e.toString = function(i) {
    if (i && i.id)
      return i.id;
    throw new Error("Invalid mode");
  }, e.isValid = function(i) {
    return i && i.bit && i.ccBits;
  };
  function o(r) {
    if (typeof r != "string")
      throw new Error("Param is not a string");
    switch (r.toLowerCase()) {
      case "numeric":
        return e.NUMERIC;
      case "alphanumeric":
        return e.ALPHANUMERIC;
      case "kanji":
        return e.KANJI;
      case "byte":
        return e.BYTE;
      default:
        throw new Error("Unknown mode: " + r);
    }
  }
  e.from = function(i, s) {
    if (e.isValid(i))
      return i;
    try {
      return o(i);
    } catch {
      return s;
    }
  };
})(k);
(function(e) {
  const t = R, n = $, o = x, r = k, i = wt, s = 7973, a = t.getBCHDigit(s);
  function l(d, g, m) {
    for (let w = 1; w <= 40; w++)
      if (g <= e.getCapacity(w, m, d))
        return w;
  }
  function f(d, g) {
    return r.getCharCountIndicator(d, g) + 4;
  }
  function u(d, g) {
    let m = 0;
    return d.forEach(function(w) {
      const p = f(w.mode, g);
      m += p + w.getBitsLength();
    }), m;
  }
  function B(d, g) {
    for (let m = 1; m <= 40; m++)
      if (u(d, m) <= e.getCapacity(m, g, r.MIXED))
        return m;
  }
  e.from = function(g, m) {
    return i.isValid(g) ? parseInt(g, 10) : m;
  }, e.getCapacity = function(g, m, w) {
    if (!i.isValid(g))
      throw new Error("Invalid QR Code version");
    typeof w > "u" && (w = r.BYTE);
    const p = t.getSymbolTotalCodewords(g), c = n.getTotalCodewordsCount(g, m), h = (p - c) * 8;
    if (w === r.MIXED)
      return h;
    const C = h - f(w, g);
    switch (w) {
      case r.NUMERIC:
        return Math.floor(C / 10 * 3);
      case r.ALPHANUMERIC:
        return Math.floor(C / 11 * 2);
      case r.KANJI:
        return Math.floor(C / 13);
      case r.BYTE:
      default:
        return Math.floor(C / 8);
    }
  }, e.getBestVersionForData = function(g, m) {
    let w;
    const p = o.from(m, o.M);
    if (Array.isArray(g)) {
      if (g.length > 1)
        return B(g, p);
      if (g.length === 0)
        return 1;
      w = g[0];
    } else
      w = g;
    return l(w.mode, w.getLength(), p);
  }, e.getEncodedBits = function(g) {
    if (!i.isValid(g) || g < 7)
      throw new Error("Invalid QR Code version");
    let m = g << 12;
    for (; t.getBCHDigit(m) - a >= 0; )
      m ^= s << t.getBCHDigit(m) - a;
    return g << 12 | m;
  };
})(Ut);
var kt = {};
const ct = R, Ft = 1335, we = 21522, At = ct.getBCHDigit(Ft);
kt.getEncodedBits = function(t, n) {
  const o = t.bit << 3 | n;
  let r = o << 10;
  for (; ct.getBCHDigit(r) - At >= 0; )
    r ^= Ft << ct.getBCHDigit(r) - At;
  return (o << 10 | r) ^ we;
};
var zt = {};
const ye = k;
function v(e) {
  this.mode = ye.NUMERIC, this.data = e.toString();
}
v.getBitsLength = function(t) {
  return 10 * Math.floor(t / 3) + (t % 3 ? t % 3 * 3 + 1 : 0);
};
v.prototype.getLength = function() {
  return this.data.length;
};
v.prototype.getBitsLength = function() {
  return v.getBitsLength(this.data.length);
};
v.prototype.write = function(t) {
  let n, o, r;
  for (n = 0; n + 3 <= this.data.length; n += 3)
    o = this.data.substr(n, 3), r = parseInt(o, 10), t.put(r, 10);
  const i = this.data.length - n;
  i > 0 && (o = this.data.substr(n), r = parseInt(o, 10), t.put(r, i * 3 + 1));
};
var Ce = v;
const pe = k, nt = [
  "0",
  "1",
  "2",
  "3",
  "4",
  "5",
  "6",
  "7",
  "8",
  "9",
  "A",
  "B",
  "C",
  "D",
  "E",
  "F",
  "G",
  "H",
  "I",
  "J",
  "K",
  "L",
  "M",
  "N",
  "O",
  "P",
  "Q",
  "R",
  "S",
  "T",
  "U",
  "V",
  "W",
  "X",
  "Y",
  "Z",
  " ",
  "$",
  "%",
  "*",
  "+",
  "-",
  ".",
  "/",
  ":"
];
function V(e) {
  this.mode = pe.ALPHANUMERIC, this.data = e;
}
V.getBitsLength = function(t) {
  return 11 * Math.floor(t / 2) + 6 * (t % 2);
};
V.prototype.getLength = function() {
  return this.data.length;
};
V.prototype.getBitsLength = function() {
  return V.getBitsLength(this.data.length);
};
V.prototype.write = function(t) {
  let n;
  for (n = 0; n + 2 <= this.data.length; n += 2) {
    let o = nt.indexOf(this.data[n]) * 45;
    o += nt.indexOf(this.data[n + 1]), t.put(o, 11);
  }
  this.data.length % 2 && t.put(nt.indexOf(this.data[n]), 6);
};
var Ee = V;
const Be = k;
function H(e) {
  this.mode = Be.BYTE, typeof e == "string" ? this.data = new TextEncoder().encode(e) : this.data = new Uint8Array(e);
}
H.getBitsLength = function(t) {
  return t * 8;
};
H.prototype.getLength = function() {
  return this.data.length;
};
H.prototype.getBitsLength = function() {
  return H.getBitsLength(this.data.length);
};
H.prototype.write = function(e) {
  for (let t = 0, n = this.data.length; t < n; t++)
    e.put(this.data[t], 8);
};
var be = H;
const Se = k, Ae = R;
function O(e) {
  this.mode = Se.KANJI, this.data = e;
}
O.getBitsLength = function(t) {
  return t * 13;
};
O.prototype.getLength = function() {
  return this.data.length;
};
O.prototype.getBitsLength = function() {
  return O.getBitsLength(this.data.length);
};
O.prototype.write = function(e) {
  let t;
  for (t = 0; t < this.data.length; t++) {
    let n = Ae.toSJIS(this.data[t]);
    if (n >= 33088 && n <= 40956)
      n -= 33088;
    else if (n >= 57408 && n <= 60351)
      n -= 49472;
    else
      throw new Error(
        "Invalid SJIS character: " + this.data[t] + `
Make sure your charset is UTF-8`
      );
    n = (n >>> 8 & 255) * 192 + (n & 255), e.put(n, 13);
  }
};
var Ie = O, vt = { exports: {} };
(function(e) {
  var t = {
    single_source_shortest_paths: function(n, o, r) {
      var i = {}, s = {};
      s[o] = 0;
      var a = t.PriorityQueue.make();
      a.push(o, 0);
      for (var l, f, u, B, d, g, m, w, p; !a.empty(); ) {
        l = a.pop(), f = l.value, B = l.cost, d = n[f] || {};
        for (u in d)
          d.hasOwnProperty(u) && (g = d[u], m = B + g, w = s[u], p = typeof s[u] > "u", (p || w > m) && (s[u] = m, a.push(u, m), i[u] = f));
      }
      if (typeof r < "u" && typeof s[r] > "u") {
        var c = ["Could not find a path from ", o, " to ", r, "."].join("");
        throw new Error(c);
      }
      return i;
    },
    extract_shortest_path_from_predecessor_list: function(n, o) {
      for (var r = [], i = o; i; )
        r.push(i), n[i], i = n[i];
      return r.reverse(), r;
    },
    find_path: function(n, o, r) {
      var i = t.single_source_shortest_paths(n, o, r);
      return t.extract_shortest_path_from_predecessor_list(
        i,
        r
      );
    },
    /**
     * A very naive priority queue implementation.
     */
    PriorityQueue: {
      make: function(n) {
        var o = t.PriorityQueue, r = {}, i;
        n = n || {};
        for (i in o)
          o.hasOwnProperty(i) && (r[i] = o[i]);
        return r.queue = [], r.sorter = n.sorter || o.default_sorter, r;
      },
      default_sorter: function(n, o) {
        return n.cost - o.cost;
      },
      /**
       * Add a new item to the queue and ensure the highest priority element
       * is at the front of the queue.
       */
      push: function(n, o) {
        var r = { value: n, cost: o };
        this.queue.push(r), this.queue.sort(this.sorter);
      },
      /**
       * Return the highest priority element in the queue.
       */
      pop: function() {
        return this.queue.shift();
      },
      empty: function() {
        return this.queue.length === 0;
      }
    }
  };
  e.exports = t;
})(vt);
var Te = vt.exports;
(function(e) {
  const t = k, n = Ce, o = Ee, r = be, i = Ie, s = P, a = R, l = Te;
  function f(c) {
    return unescape(encodeURIComponent(c)).length;
  }
  function u(c, h, C) {
    const y = [];
    let b;
    for (; (b = c.exec(C)) !== null; )
      y.push({
        data: b[0],
        index: b.index,
        mode: h,
        length: b[0].length
      });
    return y;
  }
  function B(c) {
    const h = u(s.NUMERIC, t.NUMERIC, c), C = u(s.ALPHANUMERIC, t.ALPHANUMERIC, c);
    let y, b;
    return a.isKanjiModeEnabled() ? (y = u(s.BYTE, t.BYTE, c), b = u(s.KANJI, t.KANJI, c)) : (y = u(s.BYTE_KANJI, t.BYTE, c), b = []), h.concat(C, y, b).sort(function(A, N) {
      return A.index - N.index;
    }).map(function(A) {
      return {
        data: A.data,
        mode: A.mode,
        length: A.length
      };
    });
  }
  function d(c, h) {
    switch (h) {
      case t.NUMERIC:
        return n.getBitsLength(c);
      case t.ALPHANUMERIC:
        return o.getBitsLength(c);
      case t.KANJI:
        return i.getBitsLength(c);
      case t.BYTE:
        return r.getBitsLength(c);
    }
  }
  function g(c) {
    return c.reduce(function(h, C) {
      const y = h.length - 1 >= 0 ? h[h.length - 1] : null;
      return y && y.mode === C.mode ? (h[h.length - 1].data += C.data, h) : (h.push(C), h);
    }, []);
  }
  function m(c) {
    const h = [];
    for (let C = 0; C < c.length; C++) {
      const y = c[C];
      switch (y.mode) {
        case t.NUMERIC:
          h.push([
            y,
            { data: y.data, mode: t.ALPHANUMERIC, length: y.length },
            { data: y.data, mode: t.BYTE, length: y.length }
          ]);
          break;
        case t.ALPHANUMERIC:
          h.push([
            y,
            { data: y.data, mode: t.BYTE, length: y.length }
          ]);
          break;
        case t.KANJI:
          h.push([
            y,
            { data: y.data, mode: t.BYTE, length: f(y.data) }
          ]);
          break;
        case t.BYTE:
          h.push([
            { data: y.data, mode: t.BYTE, length: f(y.data) }
          ]);
      }
    }
    return h;
  }
  function w(c, h) {
    const C = {}, y = { start: {} };
    let b = ["start"];
    for (let S = 0; S < c.length; S++) {
      const A = c[S], N = [];
      for (let E = 0; E < A.length; E++) {
        const I = A[E], M = "" + S + E;
        N.push(M), C[M] = { node: I, lastCount: 0 }, y[M] = {};
        for (let F = 0; F < b.length; F++) {
          const T = b[F];
          C[T] && C[T].node.mode === I.mode ? (y[T][M] = d(C[T].lastCount + I.length, I.mode) - d(C[T].lastCount, I.mode), C[T].lastCount += I.length) : (C[T] && (C[T].lastCount = I.length), y[T][M] = d(I.length, I.mode) + 4 + t.getCharCountIndicator(I.mode, h));
        }
      }
      b = N;
    }
    for (let S = 0; S < b.length; S++)
      y[b[S]].end = 0;
    return { map: y, table: C };
  }
  function p(c, h) {
    let C;
    const y = t.getBestModeForData(c);
    if (C = t.from(h, y), C !== t.BYTE && C.bit < y.bit)
      throw new Error('"' + c + '" cannot be encoded with mode ' + t.toString(C) + `.
 Suggested mode is: ` + t.toString(y));
    switch (C === t.KANJI && !a.isKanjiModeEnabled() && (C = t.BYTE), C) {
      case t.NUMERIC:
        return new n(c);
      case t.ALPHANUMERIC:
        return new o(c);
      case t.KANJI:
        return new i(c);
      case t.BYTE:
        return new r(c);
    }
  }
  e.fromArray = function(h) {
    return h.reduce(function(C, y) {
      return typeof y == "string" ? C.push(p(y, null)) : y.data && C.push(p(y.data, y.mode)), C;
    }, []);
  }, e.fromString = function(h, C) {
    const y = B(h, a.isKanjiModeEnabled()), b = m(y), S = w(b, C), A = l.find_path(S.map, "start", "end"), N = [];
    for (let E = 1; E < A.length - 1; E++)
      N.push(S.table[A[E]].node);
    return e.fromArray(g(N));
  }, e.rawSplit = function(h) {
    return e.fromArray(
      B(h, a.isKanjiModeEnabled())
    );
  };
})(zt);
const et = R, rt = x, Ne = ae, Re = le, Me = Rt, Pe = Mt, ft = Pt, dt = $, _e = ce, W = Ut, Le = kt, Ue = k, ot = zt;
function De(e, t) {
  const n = e.size, o = Pe.getPositions(t);
  for (let r = 0; r < o.length; r++) {
    const i = o[r][0], s = o[r][1];
    for (let a = -1; a <= 7; a++)
      if (!(i + a <= -1 || n <= i + a))
        for (let l = -1; l <= 7; l++)
          s + l <= -1 || n <= s + l || (a >= 0 && a <= 6 && (l === 0 || l === 6) || l >= 0 && l <= 6 && (a === 0 || a === 6) || a >= 2 && a <= 4 && l >= 2 && l <= 4 ? e.set(i + a, s + l, !0, !0) : e.set(i + a, s + l, !1, !0));
  }
}
function ke(e) {
  const t = e.size;
  for (let n = 8; n < t - 8; n++) {
    const o = n % 2 === 0;
    e.set(n, 6, o, !0), e.set(6, n, o, !0);
  }
}
function Fe(e, t) {
  const n = Me.getPositions(t);
  for (let o = 0; o < n.length; o++) {
    const r = n[o][0], i = n[o][1];
    for (let s = -2; s <= 2; s++)
      for (let a = -2; a <= 2; a++)
        s === -2 || s === 2 || a === -2 || a === 2 || s === 0 && a === 0 ? e.set(r + s, i + a, !0, !0) : e.set(r + s, i + a, !1, !0);
  }
}
function ze(e, t) {
  const n = e.size, o = W.getEncodedBits(t);
  let r, i, s;
  for (let a = 0; a < 18; a++)
    r = Math.floor(a / 3), i = a % 3 + n - 8 - 3, s = (o >> a & 1) === 1, e.set(r, i, s, !0), e.set(i, r, s, !0);
}
function it(e, t, n) {
  const o = e.size, r = Le.getEncodedBits(t, n);
  let i, s;
  for (i = 0; i < 15; i++)
    s = (r >> i & 1) === 1, i < 6 ? e.set(i, 8, s, !0) : i < 8 ? e.set(i + 1, 8, s, !0) : e.set(o - 15 + i, 8, s, !0), i < 8 ? e.set(8, o - i - 1, s, !0) : i < 9 ? e.set(8, 15 - i - 1 + 1, s, !0) : e.set(8, 15 - i - 1, s, !0);
  e.set(o - 8, 8, 1, !0);
}
function ve(e, t) {
  const n = e.size;
  let o = -1, r = n - 1, i = 7, s = 0;
  for (let a = n - 1; a > 0; a -= 2)
    for (a === 6 && a--; ; ) {
      for (let l = 0; l < 2; l++)
        if (!e.isReserved(r, a - l)) {
          let f = !1;
          s < t.length && (f = (t[s] >>> i & 1) === 1), e.set(r, a - l, f), i--, i === -1 && (s++, i = 7);
        }
      if (r += o, r < 0 || n <= r) {
        r -= o, o = -o;
        break;
      }
    }
}
function Ve(e, t, n) {
  const o = new Ne();
  n.forEach(function(l) {
    o.put(l.mode.bit, 4), o.put(l.getLength(), Ue.getCharCountIndicator(l.mode, e)), l.write(o);
  });
  const r = et.getSymbolTotalCodewords(e), i = dt.getTotalCodewordsCount(e, t), s = (r - i) * 8;
  for (o.getLengthInBits() + 4 <= s && o.put(0, 4); o.getLengthInBits() % 8 !== 0; )
    o.putBit(0);
  const a = (s - o.getLengthInBits()) / 8;
  for (let l = 0; l < a; l++)
    o.put(l % 2 ? 17 : 236, 8);
  return He(o, e, t);
}
function He(e, t, n) {
  const o = et.getSymbolTotalCodewords(t), r = dt.getTotalCodewordsCount(t, n), i = o - r, s = dt.getBlocksCount(t, n), a = o % s, l = s - a, f = Math.floor(o / s), u = Math.floor(i / s), B = u + 1, d = f - u, g = new _e(d);
  let m = 0;
  const w = new Array(s), p = new Array(s);
  let c = 0;
  const h = new Uint8Array(e.buffer);
  for (let A = 0; A < s; A++) {
    const N = A < l ? u : B;
    w[A] = h.slice(m, m + N), p[A] = g.encode(w[A]), m += N, c = Math.max(c, N);
  }
  const C = new Uint8Array(o);
  let y = 0, b, S;
  for (b = 0; b < c; b++)
    for (S = 0; S < s; S++)
      b < w[S].length && (C[y++] = w[S][b]);
  for (b = 0; b < d; b++)
    for (S = 0; S < s; S++)
      C[y++] = p[S][b];
  return C;
}
function Oe(e, t, n, o) {
  let r;
  if (Array.isArray(e))
    r = ot.fromArray(e);
  else if (typeof e == "string") {
    let f = t;
    if (!f) {
      const u = ot.rawSplit(e);
      f = W.getBestVersionForData(u, n);
    }
    r = ot.fromString(e, f || 40);
  } else
    throw new Error("Invalid data");
  const i = W.getBestVersionForData(r, n);
  if (!i)
    throw new Error("The amount of data is too big to be stored in a QR Code");
  if (!t)
    t = i;
  else if (t < i)
    throw new Error(
      `
The chosen QR Code version cannot contain this amount of data.
Minimum version required to store current data is: ` + i + `.
`
    );
  const s = Ve(t, n, r), a = et.getSymbolSize(t), l = new Re(a);
  return De(l, t), ke(l), Fe(l, t), it(l, n, 0), t >= 7 && ze(l, t), ve(l, s), isNaN(o) && (o = ft.getBestMask(
    l,
    it.bind(null, l, n)
  )), ft.applyMask(o, l), it(l, n, o), {
    modules: l,
    version: t,
    errorCorrectionLevel: n,
    maskPattern: o,
    segments: r
  };
}
Tt.create = function(t, n) {
  if (typeof t > "u" || t === "")
    throw new Error("No input text");
  let o = rt.M, r, i;
  return typeof n < "u" && (o = rt.from(n.errorCorrectionLevel, rt.M), r = W.from(n.version), i = ft.from(n.maskPattern), n.toSJISFunc && et.setToSJISFunction(n.toSJISFunc)), Oe(t, r, o, i);
};
var Vt = {}, yt = {};
(function(e) {
  function t(n) {
    if (typeof n == "number" && (n = n.toString()), typeof n != "string")
      throw new Error("Color should be defined as hex string");
    let o = n.slice().replace("#", "").split("");
    if (o.length < 3 || o.length === 5 || o.length > 8)
      throw new Error("Invalid hex color: " + n);
    (o.length === 3 || o.length === 4) && (o = Array.prototype.concat.apply([], o.map(function(i) {
      return [i, i];
    }))), o.length === 6 && o.push("F", "F");
    const r = parseInt(o.join(""), 16);
    return {
      r: r >> 24 & 255,
      g: r >> 16 & 255,
      b: r >> 8 & 255,
      a: r & 255,
      hex: "#" + o.slice(0, 6).join("")
    };
  }
  e.getOptions = function(o) {
    o || (o = {}), o.color || (o.color = {});
    const r = typeof o.margin > "u" || o.margin === null || o.margin < 0 ? 4 : o.margin, i = o.width && o.width >= 21 ? o.width : void 0, s = o.scale || 4;
    return {
      width: i,
      scale: i ? 4 : s,
      margin: r,
      color: {
        dark: t(o.color.dark || "#000000ff"),
        light: t(o.color.light || "#ffffffff")
      },
      type: o.type,
      rendererOpts: o.rendererOpts || {}
    };
  }, e.getScale = function(o, r) {
    return r.width && r.width >= o + r.margin * 2 ? r.width / (o + r.margin * 2) : r.scale;
  }, e.getImageWidth = function(o, r) {
    const i = e.getScale(o, r);
    return Math.floor((o + r.margin * 2) * i);
  }, e.qrToImageData = function(o, r, i) {
    const s = r.modules.size, a = r.modules.data, l = e.getScale(s, i), f = Math.floor((s + i.margin * 2) * l), u = i.margin * l, B = [i.color.light, i.color.dark];
    for (let d = 0; d < f; d++)
      for (let g = 0; g < f; g++) {
        let m = (d * f + g) * 4, w = i.color.light;
        if (d >= u && g >= u && d < f - u && g < f - u) {
          const p = Math.floor((d - u) / l), c = Math.floor((g - u) / l);
          w = B[a[p * s + c] ? 1 : 0];
        }
        o[m++] = w.r, o[m++] = w.g, o[m++] = w.b, o[m] = w.a;
      }
  };
})(yt);
(function(e) {
  const t = yt;
  function n(r, i, s) {
    r.clearRect(0, 0, i.width, i.height), i.style || (i.style = {}), i.height = s, i.width = s, i.style.height = s + "px", i.style.width = s + "px";
  }
  function o() {
    try {
      return document.createElement("canvas");
    } catch {
      throw new Error("You need to specify a canvas element");
    }
  }
  e.render = function(i, s, a) {
    let l = a, f = s;
    typeof l > "u" && (!s || !s.getContext) && (l = s, s = void 0), s || (f = o()), l = t.getOptions(l);
    const u = t.getImageWidth(i.modules.size, l), B = f.getContext("2d"), d = B.createImageData(u, u);
    return t.qrToImageData(d.data, i, l), n(B, f, u), B.putImageData(d, 0, 0), f;
  }, e.renderToDataURL = function(i, s, a) {
    let l = a;
    typeof l > "u" && (!s || !s.getContext) && (l = s, s = void 0), l || (l = {});
    const f = e.render(i, s, l), u = l.type || "image/png", B = l.rendererOpts || {};
    return f.toDataURL(u, B.quality);
  };
})(Vt);
var Ht = {};
const Ke = yt;
function It(e, t) {
  const n = e.a / 255, o = t + '="' + e.hex + '"';
  return n < 1 ? o + " " + t + '-opacity="' + n.toFixed(2).slice(1) + '"' : o;
}
function st(e, t, n) {
  let o = e + t;
  return typeof n < "u" && (o += " " + n), o;
}
function Qe(e, t, n) {
  let o = "", r = 0, i = !1, s = 0;
  for (let a = 0; a < e.length; a++) {
    const l = Math.floor(a % t), f = Math.floor(a / t);
    !l && !i && (i = !0), e[a] ? (s++, a > 0 && l > 0 && e[a - 1] || (o += i ? st("M", l + n, 0.5 + f + n) : st("m", r, 0), r = 0, i = !1), l + 1 < t && e[a + 1] || (o += st("h", s), s = 0)) : r++;
  }
  return o;
}
Ht.render = function(t, n, o) {
  const r = Ke.getOptions(n), i = t.modules.size, s = t.modules.data, a = i + r.margin * 2, l = r.color.light.a ? "<path " + It(r.color.light, "fill") + ' d="M0 0h' + a + "v" + a + 'H0z"/>' : "", f = "<path " + It(r.color.dark, "stroke") + ' d="' + Qe(s, i, r.margin) + '"/>', u = 'viewBox="0 0 ' + a + " " + a + '"', d = '<svg xmlns="http://www.w3.org/2000/svg" ' + (r.width ? 'width="' + r.width + '" height="' + r.width + '" ' : "") + u + ' shape-rendering="crispEdges">' + l + f + `</svg>
`;
  return typeof o == "function" && o(null, d), d;
};
const Je = ie, gt = Tt, Ot = Vt, Ge = Ht;
function Ct(e, t, n, o, r) {
  const i = [].slice.call(arguments, 1), s = i.length, a = typeof i[s - 1] == "function";
  if (!a && !Je())
    throw new Error("Callback required as last argument");
  if (a) {
    if (s < 2)
      throw new Error("Too few arguments provided");
    s === 2 ? (r = n, n = t, t = o = void 0) : s === 3 && (t.getContext && typeof r > "u" ? (r = o, o = void 0) : (r = o, o = n, n = t, t = void 0));
  } else {
    if (s < 1)
      throw new Error("Too few arguments provided");
    return s === 1 ? (n = t, t = o = void 0) : s === 2 && !t.getContext && (o = n, n = t, t = void 0), new Promise(function(l, f) {
      try {
        const u = gt.create(n, o);
        l(e(u, t, o));
      } catch (u) {
        f(u);
      }
    });
  }
  try {
    const l = gt.create(n, o);
    r(null, e(l, t, o));
  } catch (l) {
    r(l);
  }
}
J.create = gt.create;
J.toCanvas = Ct.bind(null, Ot.render);
J.toDataURL = Ct.bind(null, Ot.renderToDataURL);
J.toString = Ct.bind(null, function(e, t, n) {
  return Ge.render(e, n);
});
function je(e) {
  Yt(e, "svelte-ty0b2n", '*,*::before,*::after{margin:0;padding:0;list-style:none;text-decoration:none;outline:none;box-sizing:border-box;font-family:inherit}.LoadingSpinner{display:block;width:80px;height:80px;margin:0 auto 0 0}.LoadingSpinner:after{content:" ";display:block;width:64px;height:64px;margin:8px;border-radius:50%;border:6px solid var(--emw--casino-color-primary, var(--emw--color-primary, #22b04e));border-color:var(--emw--casino-color-primary, var(--emw--color-primary, #22b04e)) transparent var(--emw--casino-color-primary, var(--emw--color-primary, #22b04e)) transparent;animation:LoadingSpinner 1.2s linear infinite}@keyframes LoadingSpinner{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}');
}
function Ye(e) {
  let t, n, o;
  return {
    c() {
      t = U("div"), n = U("img"), L(n, "class", "qr-image"), Et(n.src, o = /*qrImageUrl*/
      e[3]) || L(n, "src", o), L(n, "alt", "qr-session-login"), L(t, "class", "qr-section");
    },
    m(r, i) {
      Z(r, t, i), _(t, n);
    },
    p(r, i) {
      i & /*qrImageUrl*/
      8 && !Et(n.src, o = /*qrImageUrl*/
      r[3]) && L(n, "src", o);
    },
    d(r) {
      r && X(t);
    }
  };
}
function qe(e) {
  let t;
  return {
    c() {
      t = U("div"), L(t, "class", "LoadingSpinner");
    },
    m(n, o) {
      Z(n, t, o);
    },
    p: at,
    d(n) {
      n && X(t);
    }
  };
}
function We(e) {
  let t, n = (
    /*$_*/
    e[5](
      /*errorCode*/
      e[4]
    ) + ""
  ), o;
  return {
    c() {
      t = U("p"), o = ut(n), L(t, "class", "generate-qr-error-message");
    },
    m(r, i) {
      Z(r, t, i), _(t, o);
    },
    p(r, i) {
      i & /*$_, errorCode*/
      48 && n !== (n = /*$_*/
      r[5](
        /*errorCode*/
        r[4]
      ) + "") && lt(o, n);
    },
    d(r) {
      r && X(t);
    }
  };
}
function Xe(e) {
  let t, n, o, r = (
    /*$_*/
    e[5]("titleQRSessionGenerator") + ""
  ), i, s, a, l = (
    /*remaining*/
    (e[1] > 0 ? `${/*remaining*/
    e[1]}s` : (
      /*$_*/
      e[5]("generateQRButton")
    )) + ""
  ), f, u, B, d, g;
  function m(c, h) {
    if (
      /*errorCode*/
      c[4]
    )
      return We;
    if (
      /*isGenerating*/
      c[2]
    )
      return qe;
    if (
      /*qrImageUrl*/
      c[3]
    )
      return Ye;
  }
  let w = m(e), p = w && w(e);
  return {
    c() {
      t = U("div"), n = U("div"), o = U("p"), i = ut(r), s = pt(), a = U("button"), f = ut(l), B = pt(), p && p.c(), L(a, "class", "generate-qr-btn"), a.disabled = u = /*isGenerating*/
      e[2] || /*remaining*/
      e[1] > 0, L(n, "class", "qr-session-generator");
    },
    m(c, h) {
      Z(c, t, h), _(t, n), _(n, o), _(o, i), _(n, s), _(n, a), _(a, f), _(n, B), p && p.m(n, null), e[14](t), d || (g = qt(
        a,
        "click",
        /*onGenerateQRClick*/
        e[6]
      ), d = !0);
    },
    p(c, [h]) {
      h & /*$_*/
      32 && r !== (r = /*$_*/
      c[5]("titleQRSessionGenerator") + "") && lt(i, r), h & /*remaining, $_*/
      34 && l !== (l = /*remaining*/
      (c[1] > 0 ? `${/*remaining*/
      c[1]}s` : (
        /*$_*/
        c[5]("generateQRButton")
      )) + "") && lt(f, l), h & /*isGenerating, remaining*/
      6 && u !== (u = /*isGenerating*/
      c[2] || /*remaining*/
      c[1] > 0) && (a.disabled = u), w === (w = m(c)) && p ? p.p(c, h) : (p && p.d(1), p = w && w(c), p && (p.c(), p.m(n, null)));
    },
    i: at,
    o: at,
    d(c) {
      c && X(t), p && p.d(), e[14](null), d = !1, g();
    }
  };
}
const Ze = 60;
function xe(e, t, n) {
  let o;
  Wt(e, re, (E) => n(5, o = E));
  let { clientstyling: r = "" } = t, { clientstylingurl: i = "" } = t, { mbsource: s } = t, { lang: a = "en" } = t, { endpoint: l = "" } = t, { sessionid: f } = t, { translationurl: u } = t;
  const B = {
    "gm.norway.unauthorized": "unauthorizedError"
  };
  let d, g, m = 0, w = !1, p = null, c = null, h = null;
  Xt(() => () => {
  });
  const C = () => {
    fetch(u).then((I) => I.json()).then((I) => {
      Object.keys(I).forEach((M) => {
        Bt(M, I[M]);
      });
    }).catch((I) => {
      console.error(I);
    });
  };
  Object.keys(bt).forEach((E) => {
    Bt(E, bt[E]);
  });
  const y = () => {
    oe(a);
  }, b = async () => {
    if (w || m > 0)
      return;
    n(2, w = !0), n(4, h = null), n(3, c = null), n(1, m = Ze), S();
    const E = new URL(`${l}/api/pam/v1/qr/authenticate`), I = new Headers();
    I.append("X-SessionID", f);
    const M = { method: "POST", headers: I };
    n(4, h = null);
    const F = await fetch(E.href, M);
    try {
      if (F.ok) {
        const T = await F.json();
        n(3, c = await J.toDataURL(JSON.stringify(T)));
      } else {
        const T = await F.json();
        n(4, h = B[T.Code] ?? "unexpectedError"), A();
      }
    } catch (T) {
      console.error(T), n(4, h = "failedToFetch"), A();
    } finally {
      n(2, w = !1);
    }
  };
  function S() {
    p !== null && clearInterval(p), p = setInterval(
      () => {
        m > 1 ? n(1, m -= 1) : (n(1, m = 0), n(2, w = !1), n(3, c = null), A());
      },
      1e3
    );
  }
  function A() {
    p !== null && (clearInterval(p), p = null), n(1, m = 0);
  }
  Zt(() => {
    p !== null && clearInterval(p);
  });
  function N(E) {
    xt[E ? "unshift" : "push"](() => {
      d = E, n(0, d);
    });
  }
  return e.$$set = (E) => {
    "clientstyling" in E && n(7, r = E.clientstyling), "clientstylingurl" in E && n(8, i = E.clientstylingurl), "mbsource" in E && n(9, s = E.mbsource), "lang" in E && n(10, a = E.lang), "endpoint" in E && n(11, l = E.endpoint), "sessionid" in E && n(12, f = E.sessionid), "translationurl" in E && n(13, u = E.translationurl);
  }, e.$$.update = () => {
    e.$$.dirty & /*clientstyling, customStylingContainer*/
    129 && r && d && $t(d, r), e.$$.dirty & /*clientstylingurl, customStylingContainer*/
    257 && i && d && te(d, i), e.$$.dirty & /*mbsource, customStylingContainer*/
    513 && s && d && ee(d, `${s}.Style`, g), e.$$.dirty & /*lang*/
    1024 && a && y(), e.$$.dirty & /*translationurl*/
    8192 && u && C();
  }, [
    d,
    m,
    w,
    c,
    h,
    o,
    b,
    r,
    i,
    s,
    a,
    l,
    f,
    u,
    N
  ];
}
class $e extends Jt {
  constructor(t) {
    super(), Gt(
      this,
      t,
      xe,
      Xe,
      jt,
      {
        clientstyling: 7,
        clientstylingurl: 8,
        mbsource: 9,
        lang: 10,
        endpoint: 11,
        sessionid: 12,
        translationurl: 13
      },
      je
    );
  }
  get clientstyling() {
    return this.$$.ctx[7];
  }
  set clientstyling(t) {
    this.$$set({ clientstyling: t }), z();
  }
  get clientstylingurl() {
    return this.$$.ctx[8];
  }
  set clientstylingurl(t) {
    this.$$set({ clientstylingurl: t }), z();
  }
  get mbsource() {
    return this.$$.ctx[9];
  }
  set mbsource(t) {
    this.$$set({ mbsource: t }), z();
  }
  get lang() {
    return this.$$.ctx[10];
  }
  set lang(t) {
    this.$$set({ lang: t }), z();
  }
  get endpoint() {
    return this.$$.ctx[11];
  }
  set endpoint(t) {
    this.$$set({ endpoint: t }), z();
  }
  get sessionid() {
    return this.$$.ctx[12];
  }
  set sessionid(t) {
    this.$$set({ sessionid: t }), z();
  }
  get translationurl() {
    return this.$$.ctx[13];
  }
  set translationurl(t) {
    this.$$set({ translationurl: t }), z();
  }
}
ne($e, { clientstyling: {}, clientstylingurl: {}, mbsource: {}, lang: {}, endpoint: {}, sessionid: {}, translationurl: {} }, [], [], !0);
export {
  $e as default
};
