var j = (e, t, n) => new Promise((o, r) => {
  var i = (a) => {
    try {
      l(n.next(a));
    } catch (u) {
      r(u);
    }
  }, s = (a) => {
    try {
      l(n.throw(a));
    } catch (u) {
      r(u);
    }
  }, l = (a) => a.done ? o(a.value) : Promise.resolve(a.value).then(i, s);
  l((n = n.apply(e, t)).next());
});
import { a as Wt, $ as Xt, S as Zt, i as xt, s as $t, f as F, b as te, n as ht, d as nt, t as mt, c as rt, m as P, w as ee, e as U, u as wt, p as It, r as _, g as ne, I as re, j as oe, y as Nt, z as ie, A as se, B as ae, C as le, D as ue } from "./PlayerAccountControllerNd-yeUlo8Jv.js";
function Rt(e, t) {
  Wt(e, t);
}
function ce(e) {
  Xt.set(e);
}
const Mt = {
  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.",
    second: "s"
  },
  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.",
    second: "s"
  }
};
var q = {}, fe = function() {
  return typeof Promise == "function" && Promise.prototype && Promise.prototype.then;
}, Ut = {}, I = {};
let Bt;
const de = [
  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
];
I.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;
};
I.getSymbolTotalCodewords = function(t) {
  return de[t];
};
I.getBCHDigit = function(e) {
  let t = 0;
  for (; e !== 0; )
    t++, e >>>= 1;
  return t;
};
I.setToSJISFunction = function(t) {
  if (typeof t != "function")
    throw new Error('"toSJISFunc" is not a valid function.');
  Bt = t;
};
I.isKanjiModeEnabled = function() {
  return typeof Bt != "undefined";
};
I.toSJIS = function(t) {
  return Bt(t);
};
var ot = {};
(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 != "undefined" && o.bit >= 0 && o.bit < 4;
  }, e.from = function(o, r) {
    if (e.isValid(o))
      return o;
    try {
      return t(o);
    } catch (i) {
      return r;
    }
  };
})(ot);
function Dt() {
  this.buffer = [], this.length = 0;
}
Dt.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 ge = Dt;
function W(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);
}
W.prototype.set = function(e, t, n, o) {
  const r = e * this.size + t;
  this.data[r] = n, o && (this.reservedBit[r] = !0);
};
W.prototype.get = function(e, t) {
  return this.data[e * this.size + t];
};
W.prototype.xor = function(e, t, n) {
  this.data[e * this.size + t] ^= n;
};
W.prototype.isReserved = function(e, t) {
  return this.reservedBit[e * this.size + t];
};
var he = W, kt = {};
(function(e) {
  const t = I.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, l = [i - 7];
    for (let a = 1; a < r - 1; a++)
      l[a] = l[a - 1] - s;
    return l.push(6), l.reverse();
  }, e.getPositions = function(o) {
    const r = [], i = e.getRowColCoords(o), s = i.length;
    for (let l = 0; l < s; l++)
      for (let a = 0; a < s; a++)
        l === 0 && a === 0 || // top-left
        l === 0 && a === s - 1 || // bottom-left
        l === s - 1 && a === 0 || r.push([i[l], i[a]]);
    return r;
  };
})(kt);
var Ft = {};
const me = I.getSymbolSize, Pt = 7;
Ft.getPositions = function(t) {
  const n = me(t);
  return [
    // top-left
    [0, 0],
    // top-right
    [n - Pt, 0],
    // bottom-left
    [0, n - Pt]
  ];
};
var zt = {};
(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, l = 0, a = 0, u = null, f = null;
    for (let B = 0; B < i; B++) {
      l = a = 0, u = f = null;
      for (let d = 0; d < i; d++) {
        let g = r.get(B, d);
        g === u ? l++ : (l >= 5 && (s += t.N1 + (l - 5)), u = g, l = 1), g = r.get(d, B), g === f ? a++ : (a >= 5 && (s += t.N1 + (a - 5)), f = g, a = 1);
      }
      l >= 5 && (s += t.N1 + (l - 5)), a >= 5 && (s += t.N1 + (a - 5));
    }
    return s;
  }, e.getPenaltyN2 = function(r) {
    const i = r.size;
    let s = 0;
    for (let l = 0; l < i - 1; l++)
      for (let a = 0; a < i - 1; a++) {
        const u = r.get(l, a) + r.get(l, a + 1) + r.get(l + 1, a) + r.get(l + 1, a + 1);
        (u === 4 || u === 0) && s++;
      }
    return s * t.N2;
  }, e.getPenaltyN3 = function(r) {
    const i = r.size;
    let s = 0, l = 0, a = 0;
    for (let u = 0; u < i; u++) {
      l = a = 0;
      for (let f = 0; f < i; f++)
        l = l << 1 & 2047 | r.get(u, f), f >= 10 && (l === 1488 || l === 93) && s++, a = a << 1 & 2047 | r.get(f, u), f >= 10 && (a === 1488 || a === 93) && s++;
    }
    return s * t.N3;
  }, e.getPenaltyN4 = function(r) {
    let i = 0;
    const s = r.data.length;
    for (let a = 0; a < s; a++)
      i += r.data[a];
    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 l = 0; l < s; l++)
      for (let a = 0; a < s; a++)
        i.isReserved(a, l) || i.xor(a, l, n(r, a, l));
  }, e.getBestMask = function(r, i) {
    const s = Object.keys(e.Patterns).length;
    let l = 0, a = 1 / 0;
    for (let u = 0; u < s; u++) {
      i(u), e.applyMask(u, r);
      const f = e.getPenaltyN1(r) + e.getPenaltyN2(r) + e.getPenaltyN3(r) + e.getPenaltyN4(r);
      e.applyMask(u, r), f < a && (a = f, l = u);
    }
    return l;
  };
})(zt);
var it = {};
const D = ot, Z = [
  // 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
], x = [
  // 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
];
it.getBlocksCount = function(t, n) {
  switch (n) {
    case D.L:
      return Z[(t - 1) * 4 + 0];
    case D.M:
      return Z[(t - 1) * 4 + 1];
    case D.Q:
      return Z[(t - 1) * 4 + 2];
    case D.H:
      return Z[(t - 1) * 4 + 3];
    default:
      return;
  }
};
it.getTotalCodewordsCount = function(t, n) {
  switch (n) {
    case D.L:
      return x[(t - 1) * 4 + 0];
    case D.M:
      return x[(t - 1) * 4 + 1];
    case D.Q:
      return x[(t - 1) * 4 + 2];
    case D.H:
      return x[(t - 1) * 4 + 3];
    default:
      return;
  }
};
var vt = {}, st = {};
const G = new Uint8Array(512), tt = new Uint8Array(256);
(function() {
  let t = 1;
  for (let n = 0; n < 255; n++)
    G[n] = t, tt[t] = n, t <<= 1, t & 256 && (t ^= 285);
  for (let n = 255; n < 512; n++)
    G[n] = G[n - 255];
})();
st.log = function(t) {
  if (t < 1)
    throw new Error("log(" + t + ")");
  return tt[t];
};
st.exp = function(t) {
  return G[t];
};
st.mul = function(t, n) {
  return t === 0 || n === 0 ? 0 : G[tt[t] + tt[n]];
};
(function(e) {
  const t = st;
  e.mul = function(o, r) {
    const i = new Uint8Array(o.length + r.length - 1);
    for (let s = 0; s < o.length; s++)
      for (let l = 0; l < r.length; l++)
        i[s + l] ^= t.mul(o[s], r[l]);
    return i;
  }, e.mod = function(o, r) {
    let i = new Uint8Array(o);
    for (; i.length - r.length >= 0; ) {
      const s = i[0];
      for (let a = 0; a < r.length; a++)
        i[a] ^= t.mul(r[a], s);
      let l = 0;
      for (; l < i.length && i[l] === 0; )
        l++;
      i = i.slice(l);
    }
    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;
  };
})(vt);
const Vt = vt;
function bt(e) {
  this.genPoly = void 0, this.degree = e, this.degree && this.initialize(this.degree);
}
bt.prototype.initialize = function(t) {
  this.degree = t, this.genPoly = Vt.generateECPolynomial(this.degree);
};
bt.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 = Vt.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 we = bt, Ht = {}, k = {}, St = {};
St.isValid = function(t) {
  return !isNaN(t) && t >= 1 && t <= 40;
};
var M = {};
const Ot = "[0-9]+", ye = "[A-Z $%*+\\-./:]+";
let Y = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
Y = Y.replace(/u/g, "\\u");
const Ee = "(?:(?![A-Z0-9 $%*+\\-./:]|" + Y + `)(?:.|[\r
]))+`;
M.KANJI = new RegExp(Y, "g");
M.BYTE_KANJI = new RegExp("[^A-Z0-9 $%*+\\-./:]+", "g");
M.BYTE = new RegExp(Ee, "g");
M.NUMERIC = new RegExp(Ot, "g");
M.ALPHANUMERIC = new RegExp(ye, "g");
const pe = new RegExp("^" + Y + "$"), Ce = new RegExp("^" + Ot + "$"), Be = new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
M.testKanji = function(t) {
  return pe.test(t);
};
M.testNumeric = function(t) {
  return Ce.test(t);
};
M.testAlphanumeric = function(t) {
  return Be.test(t);
};
(function(e) {
  const t = St, n = M;
  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 (l) {
      return s;
    }
  };
})(k);
(function(e) {
  const t = I, n = it, o = ot, r = k, i = St, s = 7973, l = t.getBCHDigit(s);
  function a(d, g, h) {
    for (let m = 1; m <= 40; m++)
      if (g <= e.getCapacity(m, h, d))
        return m;
  }
  function u(d, g) {
    return r.getCharCountIndicator(d, g) + 4;
  }
  function f(d, g) {
    let h = 0;
    return d.forEach(function(m) {
      const C = u(m.mode, g);
      h += C + m.getBitsLength();
    }), h;
  }
  function B(d, g) {
    for (let h = 1; h <= 40; h++)
      if (f(d, h) <= e.getCapacity(h, g, r.MIXED))
        return h;
  }
  e.from = function(g, h) {
    return i.isValid(g) ? parseInt(g, 10) : h;
  }, e.getCapacity = function(g, h, m) {
    if (!i.isValid(g))
      throw new Error("Invalid QR Code version");
    typeof m == "undefined" && (m = r.BYTE);
    const C = t.getSymbolTotalCodewords(g), c = n.getTotalCodewordsCount(g, h), w = (C - c) * 8;
    if (m === r.MIXED)
      return w;
    const E = w - u(m, g);
    switch (m) {
      case r.NUMERIC:
        return Math.floor(E / 10 * 3);
      case r.ALPHANUMERIC:
        return Math.floor(E / 11 * 2);
      case r.KANJI:
        return Math.floor(E / 13);
      case r.BYTE:
      default:
        return Math.floor(E / 8);
    }
  }, e.getBestVersionForData = function(g, h) {
    let m;
    const C = o.from(h, o.M);
    if (Array.isArray(g)) {
      if (g.length > 1)
        return B(g, C);
      if (g.length === 0)
        return 1;
      m = g[0];
    } else
      m = g;
    return a(m.mode, m.getLength(), C);
  }, e.getEncodedBits = function(g) {
    if (!i.isValid(g) || g < 7)
      throw new Error("Invalid QR Code version");
    let h = g << 12;
    for (; t.getBCHDigit(h) - l >= 0; )
      h ^= s << t.getBCHDigit(h) - l;
    return g << 12 | h;
  };
})(Ht);
var Qt = {};
const yt = I, Kt = 1335, be = 21522, _t = yt.getBCHDigit(Kt);
Qt.getEncodedBits = function(t, n) {
  const o = t.bit << 3 | n;
  let r = o << 10;
  for (; yt.getBCHDigit(r) - _t >= 0; )
    r ^= Kt << yt.getBCHDigit(r) - _t;
  return (o << 10 | r) ^ be;
};
var Jt = {};
const Se = k;
function z(e) {
  this.mode = Se.NUMERIC, this.data = e.toString();
}
z.getBitsLength = function(t) {
  return 10 * Math.floor(t / 3) + (t % 3 ? t % 3 * 3 + 1 : 0);
};
z.prototype.getLength = function() {
  return this.data.length;
};
z.prototype.getBitsLength = function() {
  return z.getBitsLength(this.data.length);
};
z.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 Ae = z;
const Te = k, ut = [
  "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 = Te.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 = ut.indexOf(this.data[n]) * 45;
    o += ut.indexOf(this.data[n + 1]), t.put(o, 11);
  }
  this.data.length % 2 && t.put(ut.indexOf(this.data[n]), 6);
};
var Ie = v;
const Ne = k;
function V(e) {
  this.mode = Ne.BYTE, typeof e == "string" ? this.data = new TextEncoder().encode(e) : this.data = new Uint8Array(e);
}
V.getBitsLength = function(t) {
  return t * 8;
};
V.prototype.getLength = function() {
  return this.data.length;
};
V.prototype.getBitsLength = function() {
  return V.getBitsLength(this.data.length);
};
V.prototype.write = function(e) {
  for (let t = 0, n = this.data.length; t < n; t++)
    e.put(this.data[t], 8);
};
var Re = V;
const Me = k, Pe = I;
function H(e) {
  this.mode = Me.KANJI, this.data = e;
}
H.getBitsLength = function(t) {
  return t * 13;
};
H.prototype.getLength = function() {
  return this.data.length;
};
H.prototype.getBitsLength = function() {
  return H.getBitsLength(this.data.length);
};
H.prototype.write = function(e) {
  let t;
  for (t = 0; t < this.data.length; t++) {
    let n = Pe.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 _e = H, jt = { exports: {} };
(function(e) {
  var t = {
    single_source_shortest_paths: function(n, o, r) {
      var i = {}, s = {};
      s[o] = 0;
      var l = t.PriorityQueue.make();
      l.push(o, 0);
      for (var a, u, f, B, d, g, h, m, C; !l.empty(); ) {
        a = l.pop(), u = a.value, B = a.cost, d = n[u] || {};
        for (f in d)
          d.hasOwnProperty(f) && (g = d[f], h = B + g, m = s[f], C = typeof s[f] == "undefined", (C || m > h) && (s[f] = h, l.push(f, h), i[f] = u));
      }
      if (typeof r != "undefined" && typeof s[r] == "undefined") {
        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;
})(jt);
var Le = jt.exports;
(function(e) {
  const t = k, n = Ae, o = Ie, r = Re, i = _e, s = M, l = I, a = Le;
  function u(c) {
    return unescape(encodeURIComponent(c)).length;
  }
  function f(c, w, E) {
    const y = [];
    let b;
    for (; (b = c.exec(E)) !== null; )
      y.push({
        data: b[0],
        index: b.index,
        mode: w,
        length: b[0].length
      });
    return y;
  }
  function B(c) {
    const w = f(s.NUMERIC, t.NUMERIC, c), E = f(s.ALPHANUMERIC, t.ALPHANUMERIC, c);
    let y, b;
    return l.isKanjiModeEnabled() ? (y = f(s.BYTE, t.BYTE, c), b = f(s.KANJI, t.KANJI, c)) : (y = f(s.BYTE_KANJI, t.BYTE, c), b = []), w.concat(E, y, b).sort(function(A, T) {
      return A.index - T.index;
    }).map(function(A) {
      return {
        data: A.data,
        mode: A.mode,
        length: A.length
      };
    });
  }
  function d(c, w) {
    switch (w) {
      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(w, E) {
      const y = w.length - 1 >= 0 ? w[w.length - 1] : null;
      return y && y.mode === E.mode ? (w[w.length - 1].data += E.data, w) : (w.push(E), w);
    }, []);
  }
  function h(c) {
    const w = [];
    for (let E = 0; E < c.length; E++) {
      const y = c[E];
      switch (y.mode) {
        case t.NUMERIC:
          w.push([
            y,
            { data: y.data, mode: t.ALPHANUMERIC, length: y.length },
            { data: y.data, mode: t.BYTE, length: y.length }
          ]);
          break;
        case t.ALPHANUMERIC:
          w.push([
            y,
            { data: y.data, mode: t.BYTE, length: y.length }
          ]);
          break;
        case t.KANJI:
          w.push([
            y,
            { data: y.data, mode: t.BYTE, length: u(y.data) }
          ]);
          break;
        case t.BYTE:
          w.push([
            { data: y.data, mode: t.BYTE, length: u(y.data) }
          ]);
      }
    }
    return w;
  }
  function m(c, w) {
    const E = {}, y = { start: {} };
    let b = ["start"];
    for (let S = 0; S < c.length; S++) {
      const A = c[S], T = [];
      for (let N = 0; N < A.length; N++) {
        const R = A[N], L = "" + S + N;
        T.push(L), E[L] = { node: R, lastCount: 0 }, y[L] = {};
        for (let O = 0; O < b.length; O++) {
          const p = b[O];
          E[p] && E[p].node.mode === R.mode ? (y[p][L] = d(E[p].lastCount + R.length, R.mode) - d(E[p].lastCount, R.mode), E[p].lastCount += R.length) : (E[p] && (E[p].lastCount = R.length), y[p][L] = d(R.length, R.mode) + 4 + t.getCharCountIndicator(R.mode, w));
        }
      }
      b = T;
    }
    for (let S = 0; S < b.length; S++)
      y[b[S]].end = 0;
    return { map: y, table: E };
  }
  function C(c, w) {
    let E;
    const y = t.getBestModeForData(c);
    if (E = t.from(w, y), E !== t.BYTE && E.bit < y.bit)
      throw new Error('"' + c + '" cannot be encoded with mode ' + t.toString(E) + `.
 Suggested mode is: ` + t.toString(y));
    switch (E === t.KANJI && !l.isKanjiModeEnabled() && (E = t.BYTE), E) {
      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(w) {
    return w.reduce(function(E, y) {
      return typeof y == "string" ? E.push(C(y, null)) : y.data && E.push(C(y.data, y.mode)), E;
    }, []);
  }, e.fromString = function(w, E) {
    const y = B(w, l.isKanjiModeEnabled()), b = h(y), S = m(b, E), A = a.find_path(S.map, "start", "end"), T = [];
    for (let N = 1; N < A.length - 1; N++)
      T.push(S.table[A[N]].node);
    return e.fromArray(g(T));
  }, e.rawSplit = function(w) {
    return e.fromArray(
      B(w, l.isKanjiModeEnabled())
    );
  };
})(Jt);
const at = I, ct = ot, Ue = ge, De = he, ke = kt, Fe = Ft, Et = zt, pt = it, ze = we, et = Ht, ve = Qt, Ve = k, ft = Jt;
function He(e, t) {
  const n = e.size, o = Fe.getPositions(t);
  for (let r = 0; r < o.length; r++) {
    const i = o[r][0], s = o[r][1];
    for (let l = -1; l <= 7; l++)
      if (!(i + l <= -1 || n <= i + l))
        for (let a = -1; a <= 7; a++)
          s + a <= -1 || n <= s + a || (l >= 0 && l <= 6 && (a === 0 || a === 6) || a >= 0 && a <= 6 && (l === 0 || l === 6) || l >= 2 && l <= 4 && a >= 2 && a <= 4 ? e.set(i + l, s + a, !0, !0) : e.set(i + l, s + a, !1, !0));
  }
}
function Oe(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 Qe(e, t) {
  const n = ke.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 l = -2; l <= 2; l++)
        s === -2 || s === 2 || l === -2 || l === 2 || s === 0 && l === 0 ? e.set(r + s, i + l, !0, !0) : e.set(r + s, i + l, !1, !0);
  }
}
function Ke(e, t) {
  const n = e.size, o = et.getEncodedBits(t);
  let r, i, s;
  for (let l = 0; l < 18; l++)
    r = Math.floor(l / 3), i = l % 3 + n - 8 - 3, s = (o >> l & 1) === 1, e.set(r, i, s, !0), e.set(i, r, s, !0);
}
function dt(e, t, n) {
  const o = e.size, r = ve.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 Je(e, t) {
  const n = e.size;
  let o = -1, r = n - 1, i = 7, s = 0;
  for (let l = n - 1; l > 0; l -= 2)
    for (l === 6 && l--; ; ) {
      for (let a = 0; a < 2; a++)
        if (!e.isReserved(r, l - a)) {
          let u = !1;
          s < t.length && (u = (t[s] >>> i & 1) === 1), e.set(r, l - a, u), i--, i === -1 && (s++, i = 7);
        }
      if (r += o, r < 0 || n <= r) {
        r -= o, o = -o;
        break;
      }
    }
}
function je(e, t, n) {
  const o = new Ue();
  n.forEach(function(a) {
    o.put(a.mode.bit, 4), o.put(a.getLength(), Ve.getCharCountIndicator(a.mode, e)), a.write(o);
  });
  const r = at.getSymbolTotalCodewords(e), i = pt.getTotalCodewordsCount(e, t), s = (r - i) * 8;
  for (o.getLengthInBits() + 4 <= s && o.put(0, 4); o.getLengthInBits() % 8 !== 0; )
    o.putBit(0);
  const l = (s - o.getLengthInBits()) / 8;
  for (let a = 0; a < l; a++)
    o.put(a % 2 ? 17 : 236, 8);
  return Ge(o, e, t);
}
function Ge(e, t, n) {
  const o = at.getSymbolTotalCodewords(t), r = pt.getTotalCodewordsCount(t, n), i = o - r, s = pt.getBlocksCount(t, n), l = o % s, a = s - l, u = Math.floor(o / s), f = Math.floor(i / s), B = f + 1, d = u - f, g = new ze(d);
  let h = 0;
  const m = new Array(s), C = new Array(s);
  let c = 0;
  const w = new Uint8Array(e.buffer);
  for (let A = 0; A < s; A++) {
    const T = A < a ? f : B;
    m[A] = w.slice(h, h + T), C[A] = g.encode(m[A]), h += T, c = Math.max(c, T);
  }
  const E = new Uint8Array(o);
  let y = 0, b, S;
  for (b = 0; b < c; b++)
    for (S = 0; S < s; S++)
      b < m[S].length && (E[y++] = m[S][b]);
  for (b = 0; b < d; b++)
    for (S = 0; S < s; S++)
      E[y++] = C[S][b];
  return E;
}
function Ye(e, t, n, o) {
  let r;
  if (Array.isArray(e))
    r = ft.fromArray(e);
  else if (typeof e == "string") {
    let u = t;
    if (!u) {
      const f = ft.rawSplit(e);
      u = et.getBestVersionForData(f, n);
    }
    r = ft.fromString(e, u || 40);
  } else
    throw new Error("Invalid data");
  const i = et.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 = je(t, n, r), l = at.getSymbolSize(t), a = new De(l);
  return He(a, t), Oe(a), Qe(a, t), dt(a, n, 0), t >= 7 && Ke(a, t), Je(a, s), isNaN(o) && (o = Et.getBestMask(
    a,
    dt.bind(null, a, n)
  )), Et.applyMask(o, a), dt(a, n, o), {
    modules: a,
    version: t,
    errorCorrectionLevel: n,
    maskPattern: o,
    segments: r
  };
}
Ut.create = function(t, n) {
  if (typeof t == "undefined" || t === "")
    throw new Error("No input text");
  let o = ct.M, r, i;
  return typeof n != "undefined" && (o = ct.from(n.errorCorrectionLevel, ct.M), r = et.from(n.version), i = Et.from(n.maskPattern), n.toSJISFunc && at.setToSJISFunction(n.toSJISFunc)), Ye(t, r, o, i);
};
var Gt = {}, At = {};
(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 == "undefined" || 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, l = r.modules.data, a = e.getScale(s, i), u = Math.floor((s + i.margin * 2) * a), f = i.margin * a, B = [i.color.light, i.color.dark];
    for (let d = 0; d < u; d++)
      for (let g = 0; g < u; g++) {
        let h = (d * u + g) * 4, m = i.color.light;
        if (d >= f && g >= f && d < u - f && g < u - f) {
          const C = Math.floor((d - f) / a), c = Math.floor((g - f) / a);
          m = B[l[C * s + c] ? 1 : 0];
        }
        o[h++] = m.r, o[h++] = m.g, o[h++] = m.b, o[h] = m.a;
      }
  };
})(At);
(function(e) {
  const t = At;
  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 (r) {
      throw new Error("You need to specify a canvas element");
    }
  }
  e.render = function(i, s, l) {
    let a = l, u = s;
    typeof a == "undefined" && (!s || !s.getContext) && (a = s, s = void 0), s || (u = o()), a = t.getOptions(a);
    const f = t.getImageWidth(i.modules.size, a), B = u.getContext("2d"), d = B.createImageData(f, f);
    return t.qrToImageData(d.data, i, a), n(B, u, f), B.putImageData(d, 0, 0), u;
  }, e.renderToDataURL = function(i, s, l) {
    let a = l;
    typeof a == "undefined" && (!s || !s.getContext) && (a = s, s = void 0), a || (a = {});
    const u = e.render(i, s, a), f = a.type || "image/png", B = a.rendererOpts || {};
    return u.toDataURL(f, B.quality);
  };
})(Gt);
var Yt = {};
const qe = At;
function Lt(e, t) {
  const n = e.a / 255, o = t + '="' + e.hex + '"';
  return n < 1 ? o + " " + t + '-opacity="' + n.toFixed(2).slice(1) + '"' : o;
}
function gt(e, t, n) {
  let o = e + t;
  return typeof n != "undefined" && (o += " " + n), o;
}
function We(e, t, n) {
  let o = "", r = 0, i = !1, s = 0;
  for (let l = 0; l < e.length; l++) {
    const a = Math.floor(l % t), u = Math.floor(l / t);
    !a && !i && (i = !0), e[l] ? (s++, l > 0 && a > 0 && e[l - 1] || (o += i ? gt("M", a + n, 0.5 + u + n) : gt("m", r, 0), r = 0, i = !1), a + 1 < t && e[l + 1] || (o += gt("h", s), s = 0)) : r++;
  }
  return o;
}
Yt.render = function(t, n, o) {
  const r = qe.getOptions(n), i = t.modules.size, s = t.modules.data, l = i + r.margin * 2, a = r.color.light.a ? "<path " + Lt(r.color.light, "fill") + ' d="M0 0h' + l + "v" + l + 'H0z"/>' : "", u = "<path " + Lt(r.color.dark, "stroke") + ' d="' + We(s, i, r.margin) + '"/>', f = 'viewBox="0 0 ' + l + " " + l + '"', d = '<svg xmlns="http://www.w3.org/2000/svg" ' + (r.width ? 'width="' + r.width + '" height="' + r.width + '" ' : "") + f + ' shape-rendering="crispEdges">' + a + u + `</svg>
`;
  return typeof o == "function" && o(null, d), d;
};
const Xe = fe, Ct = Ut, qt = Gt, Ze = Yt;
function Tt(e, t, n, o, r) {
  const i = [].slice.call(arguments, 1), s = i.length, l = typeof i[s - 1] == "function";
  if (!l && !Xe())
    throw new Error("Callback required as last argument");
  if (l) {
    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 == "undefined" ? (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(a, u) {
      try {
        const f = Ct.create(n, o);
        a(e(f, t, o));
      } catch (f) {
        u(f);
      }
    });
  }
  try {
    const a = Ct.create(n, o);
    r(null, e(a, t, o));
  } catch (a) {
    r(a);
  }
}
q.create = Ct.create;
q.toCanvas = Tt.bind(null, qt.render);
q.toDataURL = Tt.bind(null, qt.renderToDataURL);
q.toString = Tt.bind(null, function(e, t, n) {
  return Ze.render(e, n);
});
var $ = /* @__PURE__ */ ((e) => (e.unauthorizedError = "unauthorized", e.unexpectedError = "unexpectedError", e.failedToFetch = "failedToFetch", e))($ || {});
function xe(e) {
  te(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 $e(e) {
  let t, n, o;
  return {
    c() {
      t = U("div"), n = U("img"), _(n, "class", "qr-image"), Nt(n.src, o = /*qrImageUrl*/
      e[3]) || _(n, "src", o), _(n, "alt", "qr-session-login"), _(t, "class", "qr-section");
    },
    m(r, i) {
      rt(r, t, i), P(t, n);
    },
    p(r, i) {
      i & /*qrImageUrl*/
      8 && !Nt(n.src, o = /*qrImageUrl*/
      r[3]) && _(n, "src", o);
    },
    d(r) {
      r && nt(t);
    }
  };
}
function tn(e) {
  let t;
  return {
    c() {
      t = U("div"), _(t, "class", "LoadingSpinner");
    },
    m(n, o) {
      rt(n, t, o);
    },
    p: ht,
    d(n) {
      n && nt(t);
    }
  };
}
function en(e) {
  let t, n = (
    /*$_*/
    e[5](
      /*errorCode*/
      e[4]
    ) + ""
  ), o;
  return {
    c() {
      t = U("p"), o = wt(n), _(t, "class", "generate-qr-error-message");
    },
    m(r, i) {
      rt(r, t, i), P(t, o);
    },
    p(r, i) {
      i & /*$_, errorCode*/
      48 && n !== (n = /*$_*/
      r[5](
        /*errorCode*/
        r[4]
      ) + "") && mt(o, n);
    },
    d(r) {
      r && nt(t);
    }
  };
}
function nn(e) {
  let t, n, o, r = (
    /*$_*/
    e[5]("titleQRSessionGenerator") + ""
  ), i, s, l, a = (
    /*remaining*/
    (e[1] > 0 ? `${/*remaining*/
    e[1]}${/*$_*/
    e[5]("second")}` : (
      /*$_*/
      e[5]("generateQRButton")
    )) + ""
  ), u, f, B, d, g;
  function h(c, w) {
    if (
      /*errorCode*/
      c[4]
    )
      return en;
    if (
      /*isGenerating*/
      c[2]
    )
      return tn;
    if (
      /*qrImageUrl*/
      c[3]
    )
      return $e;
  }
  let m = h(e), C = m && m(e);
  return {
    c() {
      t = U("div"), n = U("div"), o = U("p"), i = wt(r), s = It(), l = U("button"), u = wt(a), B = It(), C && C.c(), _(l, "class", "generate-qr-btn"), l.disabled = f = /*isGenerating*/
      e[2] || /*remaining*/
      e[1] > 0, _(n, "class", "qr-session-generator");
    },
    m(c, w) {
      rt(c, t, w), P(t, n), P(n, o), P(o, i), P(n, s), P(n, l), P(l, u), P(n, B), C && C.m(n, null), e[14](t), d || (g = ee(
        l,
        "click",
        /*onGenerateQRClick*/
        e[6]
      ), d = !0);
    },
    p(c, [w]) {
      w & /*$_*/
      32 && r !== (r = /*$_*/
      c[5]("titleQRSessionGenerator") + "") && mt(i, r), w & /*remaining, $_*/
      34 && a !== (a = /*remaining*/
      (c[1] > 0 ? `${/*remaining*/
      c[1]}${/*$_*/
      c[5]("second")}` : (
        /*$_*/
        c[5]("generateQRButton")
      )) + "") && mt(u, a), w & /*isGenerating, remaining*/
      6 && f !== (f = /*isGenerating*/
      c[2] || /*remaining*/
      c[1] > 0) && (l.disabled = f), m === (m = h(c)) && C ? C.p(c, w) : (C && C.d(1), C = m && m(c), C && (C.c(), C.m(n, null)));
    },
    i: ht,
    o: ht,
    d(c) {
      c && nt(t), C && C.d(), e[14](null), d = !1, g();
    }
  };
}
const rn = 60, on = 1e3;
function sn(e, t, n) {
  let o;
  ne(e, ue, (p) => n(5, o = p));
  let { clientstyling: r = "" } = t, { clientstylingurl: i = "" } = t, { mbsource: s } = t, { lang: l = "en" } = t, { endpoint: a = "" } = t, { sessionid: u } = t, { translationurl: f } = t;
  const B = {
    "gm.norway.unauthorized": $.unauthorizedError
  };
  let d, g, h = 0, m = !1, C = null, c = null, w = null;
  const E = () => j(this, null, function* () {
    const p = f;
    try {
      const X = yield (yield fetch(p)).json();
      Object.keys(X).forEach((K) => {
        Rt(K, X[K]);
      });
    } catch (Q) {
      console.error(Q);
    }
  });
  Object.keys(Mt).forEach((p) => {
    Rt(p, Mt[p]);
  });
  const y = () => {
    ce(l);
  }, b = (p) => j(this, null, function* () {
    n(3, c = yield q.toDataURL(p));
  }), S = (p) => {
    n(4, w = p), L();
  }, A = () => j(this, null, function* () {
    var K;
    const p = new URL(`${a}/api/pam/v1/qr/authenticate`), Q = new Headers();
    Q.append("X-SessionID", u);
    const X = { method: "POST", headers: Q };
    try {
      const J = yield fetch(p.href, X);
      if (J.ok) {
        const lt = yield J.json();
        yield b(JSON.stringify(lt));
      } else {
        const lt = yield J.json();
        S((K = B[lt.Code]) != null ? K : $.unexpectedError);
      }
    } catch (J) {
      console.error(J), S($.failedToFetch);
    } finally {
      n(2, m = !1);
    }
  }), T = () => j(this, null, function* () {
    m || h > 0 || (n(2, m = !0), n(4, w = null), n(3, c = null), n(1, h = rn), R(), yield A());
  });
  function N() {
    C !== null && clearInterval(C);
  }
  function R() {
    N(), C = setInterval(
      () => {
        h > 1 ? n(1, h -= 1) : (n(1, h = 0), n(2, m = !1), n(3, c = null), L());
      },
      on
    );
  }
  function L() {
    N(), C = null, n(1, h = 0);
  }
  re(() => {
    N();
  });
  function O(p) {
    oe[p ? "unshift" : "push"](() => {
      d = p, n(0, d);
    });
  }
  return e.$$set = (p) => {
    "clientstyling" in p && n(7, r = p.clientstyling), "clientstylingurl" in p && n(8, i = p.clientstylingurl), "mbsource" in p && n(9, s = p.mbsource), "lang" in p && n(10, l = p.lang), "endpoint" in p && n(11, a = p.endpoint), "sessionid" in p && n(12, u = p.sessionid), "translationurl" in p && n(13, f = p.translationurl);
  }, e.$$.update = () => {
    e.$$.dirty & /*clientstyling, customStylingContainer*/
    129 && r && d && ie(d, r), e.$$.dirty & /*clientstylingurl, customStylingContainer*/
    257 && i && d && se(d, i), e.$$.dirty & /*mbsource, customStylingContainer*/
    513 && s && d && ae(d, `${s}.Style`, g), e.$$.dirty & /*lang*/
    1024 && l && y(), e.$$.dirty & /*translationurl*/
    8192 && f && E();
  }, [
    d,
    h,
    m,
    c,
    w,
    o,
    T,
    r,
    i,
    s,
    l,
    a,
    u,
    f,
    O
  ];
}
class an extends Zt {
  constructor(t) {
    super(), xt(
      this,
      t,
      sn,
      nn,
      $t,
      {
        clientstyling: 7,
        clientstylingurl: 8,
        mbsource: 9,
        lang: 10,
        endpoint: 11,
        sessionid: 12,
        translationurl: 13
      },
      xe
    );
  }
  get clientstyling() {
    return this.$$.ctx[7];
  }
  set clientstyling(t) {
    this.$$set({ clientstyling: t }), F();
  }
  get clientstylingurl() {
    return this.$$.ctx[8];
  }
  set clientstylingurl(t) {
    this.$$set({ clientstylingurl: t }), F();
  }
  get mbsource() {
    return this.$$.ctx[9];
  }
  set mbsource(t) {
    this.$$set({ mbsource: t }), F();
  }
  get lang() {
    return this.$$.ctx[10];
  }
  set lang(t) {
    this.$$set({ lang: t }), F();
  }
  get endpoint() {
    return this.$$.ctx[11];
  }
  set endpoint(t) {
    this.$$set({ endpoint: t }), F();
  }
  get sessionid() {
    return this.$$.ctx[12];
  }
  set sessionid(t) {
    this.$$set({ sessionid: t }), F();
  }
  get translationurl() {
    return this.$$.ctx[13];
  }
  set translationurl(t) {
    this.$$set({ translationurl: t }), F();
  }
}
le(an, { clientstyling: {}, clientstylingurl: {}, mbsource: {}, lang: {}, endpoint: {}, sessionid: {}, translationurl: {} }, [], [], !0);
export {
  an as default
};
