live-quiz 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/live-quiz.js CHANGED
@@ -1251,10 +1251,10 @@ function Jt(i, e) {
1251
1251
  encoder: d,
1252
1252
  lazy: f,
1253
1253
  monitor: h,
1254
- pingInterval: E,
1255
- reconnectStrategy: b,
1254
+ pingInterval: w,
1255
+ reconnectStrategy: m,
1256
1256
  maxMissingPings: T,
1257
- maxReconnectAttempts: w,
1257
+ maxReconnectAttempts: b,
1258
1258
  subprotocol: P,
1259
1259
  tokenRefresher: _,
1260
1260
  historyTimestamp: v,
@@ -1266,10 +1266,10 @@ function Jt(i, e) {
1266
1266
  } = e;
1267
1267
  if (u = u || new H(a), typeof t == "string") {
1268
1268
  P = P || t;
1269
- let S = t.substring(0, t.lastIndexOf("-")), y = t.substring(t.lastIndexOf("-") + 1);
1270
- if (N = N || {}, S === "actioncable-v1")
1269
+ let E = t.substring(0, t.lastIndexOf("-")), S = t.substring(t.lastIndexOf("-") + 1);
1270
+ if (N = N || {}, E === "actioncable-v1")
1271
1271
  t = new pt({ logger: u, ...N });
1272
- else if (S === "actioncable-v1-ext")
1272
+ else if (E === "actioncable-v1-ext")
1273
1273
  t = new Ft({
1274
1274
  logger: u,
1275
1275
  historyTimestamp: v,
@@ -1277,14 +1277,14 @@ function Jt(i, e) {
1277
1277
  });
1278
1278
  else
1279
1279
  throw Error(`Protocol is not supported yet: ${t}`);
1280
- if (y === "json")
1280
+ if (S === "json")
1281
1281
  d = d || new Ut(), s = s || "text";
1282
- else if (y === "msgpack") {
1282
+ else if (S === "msgpack") {
1283
1283
  if (s = "binary", !d)
1284
1284
  throw Error(
1285
1285
  "Msgpack encoder must be specified explicitly. Use `@anycable/msgpack-encoder` package or build your own"
1286
1286
  );
1287
- } else if (y === "protobuf") {
1287
+ } else if (S === "protobuf") {
1288
1288
  if (s = s || "binary", !d)
1289
1289
  throw Error(
1290
1290
  "Protobuf encoder must be specified explicitly. Use `@anycable/protobuf-encoder` package or build your own"
@@ -1299,14 +1299,14 @@ function Jt(i, e) {
1299
1299
  subprotocol: P,
1300
1300
  authStrategy: o,
1301
1301
  format: s
1302
- }), c && (l = new Vt([l, ...c], { logger: u })), g && g.token && l.setToken(g.token, g.param || "jid"), b = b || bt(E), h !== !1 && (h = h || new yt({
1303
- pingInterval: E,
1304
- reconnectStrategy: b,
1302
+ }), c && (l = new Vt([l, ...c], { logger: u })), g && g.token && l.setToken(g.token, g.param || "jid"), m = m || bt(w), h !== !1 && (h = h || new yt({
1303
+ pingInterval: w,
1304
+ reconnectStrategy: m,
1305
1305
  maxMissingPings: T,
1306
- maxReconnectAttempts: w,
1306
+ maxReconnectAttempts: b,
1307
1307
  logger: u
1308
1308
  }));
1309
- let q = { concurrentSubscribes: p }, m = new xt({
1309
+ let q = { concurrentSubscribes: p }, y = new xt({
1310
1310
  protocol: t,
1311
1311
  transport: l,
1312
1312
  encoder: d,
@@ -1316,15 +1316,15 @@ function Jt(i, e) {
1316
1316
  performFailures: I,
1317
1317
  transportConfigurator: C
1318
1318
  });
1319
- return h && (h.watch(m), m.monitor = h), _ && Ht(m, async () => {
1319
+ return h && (h.watch(y), y.monitor = h), _ && Ht(y, async () => {
1320
1320
  try {
1321
1321
  await _(l);
1322
- } catch (S) {
1323
- return u.error("Failed to refresh authentication token: " + S), !1;
1322
+ } catch (E) {
1323
+ return u.error("Failed to refresh authentication token: " + E), !1;
1324
1324
  }
1325
- return m.connect().catch(() => {
1325
+ return y.connect().catch(() => {
1326
1326
  }), !0;
1327
- }), m;
1327
+ }), y;
1328
1328
  }
1329
1329
  function Ht(i, e) {
1330
1330
  let t = !1;
@@ -1429,7 +1429,7 @@ function on(i) {
1429
1429
  }
1430
1430
  class St {
1431
1431
  constructor(e) {
1432
- this.resultsChannel = null, this.activeQuizId = null, this.results = {}, this.voters = {}, this.online = 0, this.submitted = {}, this.listeners = [], this.syncTimer = null, this.syncPending = !1, this.incomingSyncTimer = null, this.incomingSyncData = null, this.role = e.role, this.quizGroupId = e.quizGroupId, this.sessionId = e.sessionId || this.getOrCreateSessionId(), this.endpoints = { ...sn, ...e.endpoints };
1432
+ this.resultsChannel = null, this.activeQuizId = null, this.results = {}, this.voters = {}, this.online = 0, this.submitted = {}, this.questions = [], this.listeners = [], this.syncTimer = null, this.syncPending = !1, this.incomingSyncTimer = null, this.incomingSyncData = null, this.role = e.role, this.quizGroupId = e.quizGroupId, this.sessionId = e.sessionId || this.getOrCreateSessionId(), this.endpoints = { ...sn, ...e.endpoints };
1433
1433
  const t = e.role === "participant" ? 6e4 : 3e5;
1434
1434
  this.cable = nn(e.wsUrl, {
1435
1435
  protocol: "actioncable-v1-ext-json",
@@ -1472,7 +1472,8 @@ class St {
1472
1472
  activeQuizId: this.activeQuizId,
1473
1473
  results: structuredClone(this.results),
1474
1474
  online: this.online,
1475
- submitted: { ...this.submitted }
1475
+ submitted: { ...this.submitted },
1476
+ questions: structuredClone(this.questions)
1476
1477
  };
1477
1478
  }
1478
1479
  getQuizState(e) {
@@ -1484,6 +1485,10 @@ class St {
1484
1485
  getVotedAnswer(e) {
1485
1486
  return this.submitted[e] ?? null;
1486
1487
  }
1488
+ /** Presenter: set the full list of questions (broadcast to participants via sync) */
1489
+ setQuestions(e) {
1490
+ this.questions = e;
1491
+ }
1487
1492
  /** Presenter: set the active quiz (called when slide enters viewport) */
1488
1493
  setActiveQuiz(e) {
1489
1494
  this.role === "presenter" && this.activeQuizId !== e && (this.activeQuizId = e, this.saveState(), this.sendSync());
@@ -1526,7 +1531,7 @@ class St {
1526
1531
  }
1527
1532
  applySync(e) {
1528
1533
  var t;
1529
- this.activeQuizId = e.activeQuizId, this.results = e.results;
1534
+ this.activeQuizId = e.activeQuizId, this.results = e.results, e.questions && (this.questions = e.questions);
1530
1535
  for (const n of Object.keys(this.submitted))
1531
1536
  (((t = e.results[n]) == null ? void 0 : t.total) ?? 0) === 0 && this.clearVotedAnswer(n);
1532
1537
  this.notifyStateChange();
@@ -1565,7 +1570,8 @@ class St {
1565
1570
  activeQuizId: this.activeQuizId,
1566
1571
  sessionId: this.sessionId,
1567
1572
  quizGroupId: this.quizGroupId,
1568
- results: this.results
1573
+ results: this.results,
1574
+ questions: this.questions
1569
1575
  })
1570
1576
  });
1571
1577
  } catch {
@@ -2497,36 +2503,36 @@ var Ze;
2497
2503
  function wn() {
2498
2504
  return Ze || (Ze = 1, (function(i) {
2499
2505
  const e = F(), t = Et(), n = Te(), s = O(), r = Ct(), o = 7973, c = e.getBCHDigit(o);
2500
- function a(f, h, E) {
2501
- for (let b = 1; b <= 40; b++)
2502
- if (h <= i.getCapacity(b, E, f))
2503
- return b;
2506
+ function a(f, h, w) {
2507
+ for (let m = 1; m <= 40; m++)
2508
+ if (h <= i.getCapacity(m, w, f))
2509
+ return m;
2504
2510
  }
2505
2511
  function u(f, h) {
2506
2512
  return s.getCharCountIndicator(f, h) + 4;
2507
2513
  }
2508
2514
  function l(f, h) {
2509
- let E = 0;
2510
- return f.forEach(function(b) {
2511
- const T = u(b.mode, h);
2512
- E += T + b.getBitsLength();
2513
- }), E;
2515
+ let w = 0;
2516
+ return f.forEach(function(m) {
2517
+ const T = u(m.mode, h);
2518
+ w += T + m.getBitsLength();
2519
+ }), w;
2514
2520
  }
2515
2521
  function d(f, h) {
2516
- for (let E = 1; E <= 40; E++)
2517
- if (l(f, E) <= i.getCapacity(E, h, s.MIXED))
2518
- return E;
2522
+ for (let w = 1; w <= 40; w++)
2523
+ if (l(f, w) <= i.getCapacity(w, h, s.MIXED))
2524
+ return w;
2519
2525
  }
2520
- i.from = function(h, E) {
2521
- return r.isValid(h) ? parseInt(h, 10) : E;
2522
- }, i.getCapacity = function(h, E, b) {
2526
+ i.from = function(h, w) {
2527
+ return r.isValid(h) ? parseInt(h, 10) : w;
2528
+ }, i.getCapacity = function(h, w, m) {
2523
2529
  if (!r.isValid(h))
2524
2530
  throw new Error("Invalid QR Code version");
2525
- typeof b > "u" && (b = s.BYTE);
2526
- const T = e.getSymbolTotalCodewords(h), w = t.getTotalCodewordsCount(h, E), P = (T - w) * 8;
2527
- if (b === s.MIXED) return P;
2528
- const _ = P - u(b, h);
2529
- switch (b) {
2531
+ typeof m > "u" && (m = s.BYTE);
2532
+ const T = e.getSymbolTotalCodewords(h), b = t.getTotalCodewordsCount(h, w), P = (T - b) * 8;
2533
+ if (m === s.MIXED) return P;
2534
+ const _ = P - u(m, h);
2535
+ switch (m) {
2530
2536
  case s.NUMERIC:
2531
2537
  return Math.floor(_ / 10 * 3);
2532
2538
  case s.ALPHANUMERIC:
@@ -2537,25 +2543,25 @@ function wn() {
2537
2543
  default:
2538
2544
  return Math.floor(_ / 8);
2539
2545
  }
2540
- }, i.getBestVersionForData = function(h, E) {
2541
- let b;
2542
- const T = n.from(E, n.M);
2546
+ }, i.getBestVersionForData = function(h, w) {
2547
+ let m;
2548
+ const T = n.from(w, n.M);
2543
2549
  if (Array.isArray(h)) {
2544
2550
  if (h.length > 1)
2545
2551
  return d(h, T);
2546
2552
  if (h.length === 0)
2547
2553
  return 1;
2548
- b = h[0];
2554
+ m = h[0];
2549
2555
  } else
2550
- b = h;
2551
- return a(b.mode, b.getLength(), T);
2556
+ m = h;
2557
+ return a(m.mode, m.getLength(), T);
2552
2558
  }, i.getEncodedBits = function(h) {
2553
2559
  if (!r.isValid(h) || h < 7)
2554
2560
  throw new Error("Invalid QR Code version");
2555
- let E = h << 12;
2556
- for (; e.getBCHDigit(E) - c >= 0; )
2557
- E ^= o << e.getBCHDigit(E) - c;
2558
- return h << 12 | E;
2561
+ let w = h << 12;
2562
+ for (; e.getBCHDigit(w) - c >= 0; )
2563
+ w ^= o << e.getBCHDigit(w) - c;
2564
+ return h << 12 | w;
2559
2565
  };
2560
2566
  })(pe)), pe;
2561
2567
  }
@@ -2722,14 +2728,14 @@ function qn() {
2722
2728
  o[n] = 0;
2723
2729
  var c = e.PriorityQueue.make();
2724
2730
  c.push(n, 0);
2725
- for (var a, u, l, d, f, h, E, b, T; !c.empty(); ) {
2731
+ for (var a, u, l, d, f, h, w, m, T; !c.empty(); ) {
2726
2732
  a = c.pop(), u = a.value, d = a.cost, f = t[u] || {};
2727
2733
  for (l in f)
2728
- f.hasOwnProperty(l) && (h = f[l], E = d + h, b = o[l], T = typeof o[l] > "u", (T || b > E) && (o[l] = E, c.push(l, E), r[l] = u));
2734
+ f.hasOwnProperty(l) && (h = f[l], w = d + h, m = o[l], T = typeof o[l] > "u", (T || m > w) && (o[l] = w, c.push(l, w), r[l] = u));
2729
2735
  }
2730
2736
  if (typeof s < "u" && typeof o[s] > "u") {
2731
- var w = ["Could not find a path from ", n, " to ", s, "."].join("");
2732
- throw new Error(w);
2737
+ var b = ["Could not find a path from ", n, " to ", s, "."].join("");
2738
+ throw new Error(b);
2733
2739
  }
2734
2740
  return r;
2735
2741
  },
@@ -2785,13 +2791,13 @@ var rt;
2785
2791
  function _n() {
2786
2792
  return rt || (rt = 1, (function(i) {
2787
2793
  const e = O(), t = En(), n = Cn(), s = In(), r = vn(), o = It(), c = F(), a = qn();
2788
- function u(w) {
2789
- return unescape(encodeURIComponent(w)).length;
2794
+ function u(b) {
2795
+ return unescape(encodeURIComponent(b)).length;
2790
2796
  }
2791
- function l(w, P, _) {
2797
+ function l(b, P, _) {
2792
2798
  const v = [];
2793
2799
  let N;
2794
- for (; (N = w.exec(_)) !== null; )
2800
+ for (; (N = b.exec(_)) !== null; )
2795
2801
  v.push({
2796
2802
  data: N[0],
2797
2803
  index: N.index,
@@ -2800,10 +2806,10 @@ function _n() {
2800
2806
  });
2801
2807
  return v;
2802
2808
  }
2803
- function d(w) {
2804
- const P = l(o.NUMERIC, e.NUMERIC, w), _ = l(o.ALPHANUMERIC, e.ALPHANUMERIC, w);
2809
+ function d(b) {
2810
+ const P = l(o.NUMERIC, e.NUMERIC, b), _ = l(o.ALPHANUMERIC, e.ALPHANUMERIC, b);
2805
2811
  let v, N;
2806
- return c.isKanjiModeEnabled() ? (v = l(o.BYTE, e.BYTE, w), N = l(o.KANJI, e.KANJI, w)) : (v = l(o.BYTE_KANJI, e.BYTE, w), N = []), P.concat(_, v, N).sort(function(I, C) {
2812
+ return c.isKanjiModeEnabled() ? (v = l(o.BYTE, e.BYTE, b), N = l(o.KANJI, e.KANJI, b)) : (v = l(o.BYTE_KANJI, e.BYTE, b), N = []), P.concat(_, v, N).sort(function(I, C) {
2807
2813
  return I.index - C.index;
2808
2814
  }).map(function(I) {
2809
2815
  return {
@@ -2813,28 +2819,28 @@ function _n() {
2813
2819
  };
2814
2820
  });
2815
2821
  }
2816
- function f(w, P) {
2822
+ function f(b, P) {
2817
2823
  switch (P) {
2818
2824
  case e.NUMERIC:
2819
- return t.getBitsLength(w);
2825
+ return t.getBitsLength(b);
2820
2826
  case e.ALPHANUMERIC:
2821
- return n.getBitsLength(w);
2827
+ return n.getBitsLength(b);
2822
2828
  case e.KANJI:
2823
- return r.getBitsLength(w);
2829
+ return r.getBitsLength(b);
2824
2830
  case e.BYTE:
2825
- return s.getBitsLength(w);
2831
+ return s.getBitsLength(b);
2826
2832
  }
2827
2833
  }
2828
- function h(w) {
2829
- return w.reduce(function(P, _) {
2834
+ function h(b) {
2835
+ return b.reduce(function(P, _) {
2830
2836
  const v = P.length - 1 >= 0 ? P[P.length - 1] : null;
2831
2837
  return v && v.mode === _.mode ? (P[P.length - 1].data += _.data, P) : (P.push(_), P);
2832
2838
  }, []);
2833
2839
  }
2834
- function E(w) {
2840
+ function w(b) {
2835
2841
  const P = [];
2836
- for (let _ = 0; _ < w.length; _++) {
2837
- const v = w[_];
2842
+ for (let _ = 0; _ < b.length; _++) {
2843
+ const v = b[_];
2838
2844
  switch (v.mode) {
2839
2845
  case e.NUMERIC:
2840
2846
  P.push([
@@ -2863,17 +2869,17 @@ function _n() {
2863
2869
  }
2864
2870
  return P;
2865
2871
  }
2866
- function b(w, P) {
2872
+ function m(b, P) {
2867
2873
  const _ = {}, v = { start: {} };
2868
2874
  let N = ["start"];
2869
- for (let p = 0; p < w.length; p++) {
2870
- const I = w[p], C = [];
2875
+ for (let p = 0; p < b.length; p++) {
2876
+ const I = b[p], C = [];
2871
2877
  for (let g = 0; g < I.length; g++) {
2872
- const q = I[g], m = "" + p + g;
2873
- C.push(m), _[m] = { node: q, lastCount: 0 }, v[m] = {};
2874
- for (let S = 0; S < N.length; S++) {
2875
- const y = N[S];
2876
- _[y] && _[y].node.mode === q.mode ? (v[y][m] = f(_[y].lastCount + q.length, q.mode) - f(_[y].lastCount, q.mode), _[y].lastCount += q.length) : (_[y] && (_[y].lastCount = q.length), v[y][m] = f(q.length, q.mode) + 4 + e.getCharCountIndicator(q.mode, P));
2878
+ const q = I[g], y = "" + p + g;
2879
+ C.push(y), _[y] = { node: q, lastCount: 0 }, v[y] = {};
2880
+ for (let E = 0; E < N.length; E++) {
2881
+ const S = N[E];
2882
+ _[S] && _[S].node.mode === q.mode ? (v[S][y] = f(_[S].lastCount + q.length, q.mode) - f(_[S].lastCount, q.mode), _[S].lastCount += q.length) : (_[S] && (_[S].lastCount = q.length), v[S][y] = f(q.length, q.mode) + 4 + e.getCharCountIndicator(q.mode, P));
2877
2883
  }
2878
2884
  }
2879
2885
  N = C;
@@ -2882,21 +2888,21 @@ function _n() {
2882
2888
  v[N[p]].end = 0;
2883
2889
  return { map: v, table: _ };
2884
2890
  }
2885
- function T(w, P) {
2891
+ function T(b, P) {
2886
2892
  let _;
2887
- const v = e.getBestModeForData(w);
2893
+ const v = e.getBestModeForData(b);
2888
2894
  if (_ = e.from(P, v), _ !== e.BYTE && _.bit < v.bit)
2889
- throw new Error('"' + w + '" cannot be encoded with mode ' + e.toString(_) + `.
2895
+ throw new Error('"' + b + '" cannot be encoded with mode ' + e.toString(_) + `.
2890
2896
  Suggested mode is: ` + e.toString(v));
2891
2897
  switch (_ === e.KANJI && !c.isKanjiModeEnabled() && (_ = e.BYTE), _) {
2892
2898
  case e.NUMERIC:
2893
- return new t(w);
2899
+ return new t(b);
2894
2900
  case e.ALPHANUMERIC:
2895
- return new n(w);
2901
+ return new n(b);
2896
2902
  case e.KANJI:
2897
- return new r(w);
2903
+ return new r(b);
2898
2904
  case e.BYTE:
2899
- return new s(w);
2905
+ return new s(b);
2900
2906
  }
2901
2907
  }
2902
2908
  i.fromArray = function(P) {
@@ -2904,7 +2910,7 @@ function _n() {
2904
2910
  return typeof v == "string" ? _.push(T(v, null)) : v.data && _.push(T(v.data, v.mode)), _;
2905
2911
  }, []);
2906
2912
  }, i.fromString = function(P, _) {
2907
- const v = d(P, c.isKanjiModeEnabled()), N = E(v), p = b(N, _), I = a.find_path(p.map, "start", "end"), C = [];
2913
+ const v = d(P, c.isKanjiModeEnabled()), N = w(v), p = m(N, _), I = a.find_path(p.map, "start", "end"), C = [];
2908
2914
  for (let g = 1; g < I.length - 1; g++)
2909
2915
  C.push(p.table[I[g]].node);
2910
2916
  return i.fromArray(h(C));
@@ -2923,51 +2929,51 @@ function Pn() {
2923
2929
  function h(p, I) {
2924
2930
  const C = p.size, g = r.getPositions(I);
2925
2931
  for (let q = 0; q < g.length; q++) {
2926
- const m = g[q][0], S = g[q][1];
2927
- for (let y = -1; y <= 7; y++)
2928
- if (!(m + y <= -1 || C <= m + y))
2932
+ const y = g[q][0], E = g[q][1];
2933
+ for (let S = -1; S <= 7; S++)
2934
+ if (!(y + S <= -1 || C <= y + S))
2929
2935
  for (let R = -1; R <= 7; R++)
2930
- S + R <= -1 || C <= S + R || (y >= 0 && y <= 6 && (R === 0 || R === 6) || R >= 0 && R <= 6 && (y === 0 || y === 6) || y >= 2 && y <= 4 && R >= 2 && R <= 4 ? p.set(m + y, S + R, !0, !0) : p.set(m + y, S + R, !1, !0));
2936
+ E + R <= -1 || C <= E + R || (S >= 0 && S <= 6 && (R === 0 || R === 6) || R >= 0 && R <= 6 && (S === 0 || S === 6) || S >= 2 && S <= 4 && R >= 2 && R <= 4 ? p.set(y + S, E + R, !0, !0) : p.set(y + S, E + R, !1, !0));
2931
2937
  }
2932
2938
  }
2933
- function E(p) {
2939
+ function w(p) {
2934
2940
  const I = p.size;
2935
2941
  for (let C = 8; C < I - 8; C++) {
2936
2942
  const g = C % 2 === 0;
2937
2943
  p.set(C, 6, g, !0), p.set(6, C, g, !0);
2938
2944
  }
2939
2945
  }
2940
- function b(p, I) {
2946
+ function m(p, I) {
2941
2947
  const C = s.getPositions(I);
2942
2948
  for (let g = 0; g < C.length; g++) {
2943
- const q = C[g][0], m = C[g][1];
2944
- for (let S = -2; S <= 2; S++)
2945
- for (let y = -2; y <= 2; y++)
2946
- S === -2 || S === 2 || y === -2 || y === 2 || S === 0 && y === 0 ? p.set(q + S, m + y, !0, !0) : p.set(q + S, m + y, !1, !0);
2949
+ const q = C[g][0], y = C[g][1];
2950
+ for (let E = -2; E <= 2; E++)
2951
+ for (let S = -2; S <= 2; S++)
2952
+ E === -2 || E === 2 || S === -2 || S === 2 || E === 0 && S === 0 ? p.set(q + E, y + S, !0, !0) : p.set(q + E, y + S, !1, !0);
2947
2953
  }
2948
2954
  }
2949
2955
  function T(p, I) {
2950
2956
  const C = p.size, g = u.getEncodedBits(I);
2951
- let q, m, S;
2952
- for (let y = 0; y < 18; y++)
2953
- q = Math.floor(y / 3), m = y % 3 + C - 8 - 3, S = (g >> y & 1) === 1, p.set(q, m, S, !0), p.set(m, q, S, !0);
2957
+ let q, y, E;
2958
+ for (let S = 0; S < 18; S++)
2959
+ q = Math.floor(S / 3), y = S % 3 + C - 8 - 3, E = (g >> S & 1) === 1, p.set(q, y, E, !0), p.set(y, q, E, !0);
2954
2960
  }
2955
- function w(p, I, C) {
2961
+ function b(p, I, C) {
2956
2962
  const g = p.size, q = l.getEncodedBits(I, C);
2957
- let m, S;
2958
- for (m = 0; m < 15; m++)
2959
- S = (q >> m & 1) === 1, m < 6 ? p.set(m, 8, S, !0) : m < 8 ? p.set(m + 1, 8, S, !0) : p.set(g - 15 + m, 8, S, !0), m < 8 ? p.set(8, g - m - 1, S, !0) : m < 9 ? p.set(8, 15 - m - 1 + 1, S, !0) : p.set(8, 15 - m - 1, S, !0);
2963
+ let y, E;
2964
+ for (y = 0; y < 15; y++)
2965
+ E = (q >> y & 1) === 1, y < 6 ? p.set(y, 8, E, !0) : y < 8 ? p.set(y + 1, 8, E, !0) : p.set(g - 15 + y, 8, E, !0), y < 8 ? p.set(8, g - y - 1, E, !0) : y < 9 ? p.set(8, 15 - y - 1 + 1, E, !0) : p.set(8, 15 - y - 1, E, !0);
2960
2966
  p.set(g - 8, 8, 1, !0);
2961
2967
  }
2962
2968
  function P(p, I) {
2963
2969
  const C = p.size;
2964
- let g = -1, q = C - 1, m = 7, S = 0;
2965
- for (let y = C - 1; y > 0; y -= 2)
2966
- for (y === 6 && y--; ; ) {
2970
+ let g = -1, q = C - 1, y = 7, E = 0;
2971
+ for (let S = C - 1; S > 0; S -= 2)
2972
+ for (S === 6 && S--; ; ) {
2967
2973
  for (let R = 0; R < 2; R++)
2968
- if (!p.isReserved(q, y - R)) {
2974
+ if (!p.isReserved(q, S - R)) {
2969
2975
  let z = !1;
2970
- S < I.length && (z = (I[S] >>> m & 1) === 1), p.set(q, y - R, z), m--, m === -1 && (S++, m = 7);
2976
+ E < I.length && (z = (I[E] >>> y & 1) === 1), p.set(q, S - R, z), y--, y === -1 && (E++, y = 7);
2971
2977
  }
2972
2978
  if (q += g, q < 0 || C <= q) {
2973
2979
  q -= g, g = -g;
@@ -2980,31 +2986,31 @@ function Pn() {
2980
2986
  C.forEach(function(R) {
2981
2987
  g.put(R.mode.bit, 4), g.put(R.getLength(), d.getCharCountIndicator(R.mode, p)), R.write(g);
2982
2988
  });
2983
- const q = i.getSymbolTotalCodewords(p), m = c.getTotalCodewordsCount(p, I), S = (q - m) * 8;
2984
- for (g.getLengthInBits() + 4 <= S && g.put(0, 4); g.getLengthInBits() % 8 !== 0; )
2989
+ const q = i.getSymbolTotalCodewords(p), y = c.getTotalCodewordsCount(p, I), E = (q - y) * 8;
2990
+ for (g.getLengthInBits() + 4 <= E && g.put(0, 4); g.getLengthInBits() % 8 !== 0; )
2985
2991
  g.putBit(0);
2986
- const y = (S - g.getLengthInBits()) / 8;
2987
- for (let R = 0; R < y; R++)
2992
+ const S = (E - g.getLengthInBits()) / 8;
2993
+ for (let R = 0; R < S; R++)
2988
2994
  g.put(R % 2 ? 17 : 236, 8);
2989
2995
  return v(g, p, I);
2990
2996
  }
2991
2997
  function v(p, I, C) {
2992
- const g = i.getSymbolTotalCodewords(I), q = c.getTotalCodewordsCount(I, C), m = g - q, S = c.getBlocksCount(I, C), y = g % S, R = S - y, z = Math.floor(g / S), V = Math.floor(m / S), qt = V + 1, Ne = z - V, _t = new a(Ne);
2998
+ const g = i.getSymbolTotalCodewords(I), q = c.getTotalCodewordsCount(I, C), y = g - q, E = c.getBlocksCount(I, C), S = g % E, R = E - S, z = Math.floor(g / E), V = Math.floor(y / E), qt = V + 1, Ne = z - V, _t = new a(Ne);
2993
2999
  let ee = 0;
2994
- const K = new Array(S), Ae = new Array(S);
3000
+ const K = new Array(E), Ae = new Array(E);
2995
3001
  let te = 0;
2996
3002
  const Pt = new Uint8Array(p.buffer);
2997
- for (let j = 0; j < S; j++) {
3003
+ for (let j = 0; j < E; j++) {
2998
3004
  const se = j < R ? V : qt;
2999
3005
  K[j] = Pt.slice(ee, ee + se), Ae[j] = _t.encode(K[j]), ee += se, te = Math.max(te, se);
3000
3006
  }
3001
3007
  const ne = new Uint8Array(g);
3002
3008
  let Me = 0, B, k;
3003
3009
  for (B = 0; B < te; B++)
3004
- for (k = 0; k < S; k++)
3010
+ for (k = 0; k < E; k++)
3005
3011
  B < K[k].length && (ne[Me++] = K[k][B]);
3006
3012
  for (B = 0; B < Ne; B++)
3007
- for (k = 0; k < S; k++)
3013
+ for (k = 0; k < E; k++)
3008
3014
  ne[Me++] = Ae[k][B];
3009
3015
  return ne;
3010
3016
  }
@@ -3021,23 +3027,23 @@ function Pn() {
3021
3027
  q = f.fromString(p, z || 40);
3022
3028
  } else
3023
3029
  throw new Error("Invalid data");
3024
- const m = u.getBestVersionForData(q, C);
3025
- if (!m)
3030
+ const y = u.getBestVersionForData(q, C);
3031
+ if (!y)
3026
3032
  throw new Error("The amount of data is too big to be stored in a QR Code");
3027
3033
  if (!I)
3028
- I = m;
3029
- else if (I < m)
3034
+ I = y;
3035
+ else if (I < y)
3030
3036
  throw new Error(
3031
3037
  `
3032
3038
  The chosen QR Code version cannot contain this amount of data.
3033
- Minimum version required to store current data is: ` + m + `.
3039
+ Minimum version required to store current data is: ` + y + `.
3034
3040
  `
3035
3041
  );
3036
- const S = _(I, C, q), y = i.getSymbolSize(I), R = new n(y);
3037
- return h(R, I), E(R), b(R, I), w(R, C, 0), I >= 7 && T(R, I), P(R, S), isNaN(g) && (g = o.getBestMask(
3042
+ const E = _(I, C, q), S = i.getSymbolSize(I), R = new n(S);
3043
+ return h(R, I), w(R), m(R, I), b(R, C, 0), I >= 7 && T(R, I), P(R, E), isNaN(g) && (g = o.getBestMask(
3038
3044
  R,
3039
- w.bind(null, R, C)
3040
- )), o.applyMask(g, R), w(R, C, g), {
3045
+ b.bind(null, R, C)
3046
+ )), o.applyMask(g, R), b(R, C, g), {
3041
3047
  modules: R,
3042
3048
  version: I,
3043
3049
  errorCorrectionLevel: C,
@@ -3048,8 +3054,8 @@ Minimum version required to store current data is: ` + m + `.
3048
3054
  return oe.create = function(I, C) {
3049
3055
  if (typeof I > "u" || I === "")
3050
3056
  throw new Error("No input text");
3051
- let g = e.M, q, m;
3052
- return typeof C < "u" && (g = e.from(C.errorCorrectionLevel, e.M), q = u.from(C.version), m = o.from(C.maskPattern), C.toSJISFunc && i.setToSJISFunction(C.toSJISFunc)), N(I, q, g, m);
3057
+ let g = e.M, q, y;
3058
+ return typeof C < "u" && (g = e.from(C.errorCorrectionLevel, e.M), q = u.from(C.version), y = o.from(C.maskPattern), C.toSJISFunc && i.setToSJISFunction(C.toSJISFunc)), N(I, q, g, y);
3053
3059
  }, oe;
3054
3060
  }
3055
3061
  var qe = {}, _e = {}, ct;
@@ -3096,12 +3102,12 @@ function vt() {
3096
3102
  const o = s.modules.size, c = s.modules.data, a = i.getScale(o, r), u = Math.floor((o + r.margin * 2) * a), l = r.margin * a, d = [r.color.light, r.color.dark];
3097
3103
  for (let f = 0; f < u; f++)
3098
3104
  for (let h = 0; h < u; h++) {
3099
- let E = (f * u + h) * 4, b = r.color.light;
3105
+ let w = (f * u + h) * 4, m = r.color.light;
3100
3106
  if (f >= l && h >= l && f < u - l && h < u - l) {
3101
- const T = Math.floor((f - l) / a), w = Math.floor((h - l) / a);
3102
- b = d[c[T * o + w] ? 1 : 0];
3107
+ const T = Math.floor((f - l) / a), b = Math.floor((h - l) / a);
3108
+ m = d[c[T * o + b] ? 1 : 0];
3103
3109
  }
3104
- n[E++] = b.r, n[E++] = b.g, n[E++] = b.b, n[E] = b.a;
3110
+ n[w++] = m.r, n[w++] = m.g, n[w++] = m.b, n[w] = m.a;
3105
3111
  }
3106
3112
  };
3107
3113
  })(_e)), _e;
@@ -3155,7 +3161,7 @@ function Tn() {
3155
3161
  return c;
3156
3162
  }
3157
3163
  return Pe.render = function(r, o, c) {
3158
- const a = i.getOptions(o), u = r.modules.size, l = r.modules.data, d = u + a.margin * 2, f = a.color.light.a ? "<path " + e(a.color.light, "fill") + ' d="M0 0h' + d + "v" + d + 'H0z"/>' : "", h = "<path " + e(a.color.dark, "stroke") + ' d="' + n(l, u, a.margin) + '"/>', E = 'viewBox="0 0 ' + d + " " + d + '"', T = '<svg xmlns="http://www.w3.org/2000/svg" ' + (a.width ? 'width="' + a.width + '" height="' + a.width + '" ' : "") + E + ' shape-rendering="crispEdges">' + f + h + `</svg>
3164
+ const a = i.getOptions(o), u = r.modules.size, l = r.modules.data, d = u + a.margin * 2, f = a.color.light.a ? "<path " + e(a.color.light, "fill") + ' d="M0 0h' + d + "v" + d + 'H0z"/>' : "", h = "<path " + e(a.color.dark, "stroke") + ' d="' + n(l, u, a.margin) + '"/>', w = 'viewBox="0 0 ' + d + " " + d + '"', T = '<svg xmlns="http://www.w3.org/2000/svg" ' + (a.width ? 'width="' + a.width + '" height="' + a.width + '" ' : "") + w + ' shape-rendering="crispEdges">' + f + h + `</svg>
3159
3165
  `;
3160
3166
  return typeof c == "function" && c(null, T), T;
3161
3167
  }, Pe;
@@ -3176,12 +3182,12 @@ function Nn() {
3176
3182
  } else {
3177
3183
  if (d < 1)
3178
3184
  throw new Error("Too few arguments provided");
3179
- return d === 1 ? (c = o, o = a = void 0) : d === 2 && !o.getContext && (a = c, c = o, o = void 0), new Promise(function(h, E) {
3185
+ return d === 1 ? (c = o, o = a = void 0) : d === 2 && !o.getContext && (a = c, c = o, o = void 0), new Promise(function(h, w) {
3180
3186
  try {
3181
- const b = e.create(c, a);
3182
- h(r(b, o, a));
3183
- } catch (b) {
3184
- E(b);
3187
+ const m = e.create(c, a);
3188
+ h(r(m, o, a));
3189
+ } catch (m) {
3190
+ w(m);
3185
3191
  }
3186
3192
  });
3187
3193
  }
@@ -3232,12 +3238,12 @@ async function zn(i, e, t = "Pop quiz!") {
3232
3238
  c.className = "lq-question__title", c.textContent = t, o.appendChild(c);
3233
3239
  const a = document.createElement("div");
3234
3240
  if (a.className = "lq-question__body", e) {
3235
- const b = document.createElement("div");
3236
- b.className = "lq-question__qr-side";
3241
+ const m = document.createElement("div");
3242
+ m.className = "lq-question__qr-side";
3237
3243
  const T = await kn(e);
3238
- b.appendChild(T);
3239
- const w = document.createElement("p");
3240
- w.className = "lq-question__url", w.textContent = e.replace(/^https?:\/\//, ""), b.appendChild(w), a.appendChild(b);
3244
+ m.appendChild(T);
3245
+ const b = document.createElement("p");
3246
+ b.className = "lq-question__url", b.textContent = e.replace(/^https?:\/\//, ""), m.appendChild(b), a.appendChild(m);
3241
3247
  }
3242
3248
  const u = document.createElement("div");
3243
3249
  u.className = "lq-question__content";
@@ -3245,21 +3251,21 @@ async function zn(i, e, t = "Pop quiz!") {
3245
3251
  l.className = "lq-question__text", l.textContent = s, u.appendChild(l);
3246
3252
  const d = document.createElement("div");
3247
3253
  d.className = "lq-question__options";
3248
- for (const b of r) {
3254
+ for (const m of r) {
3249
3255
  const T = document.createElement("div");
3250
3256
  T.className = "lq-question__option";
3251
- const w = document.createElement("span");
3252
- w.className = "lq-question__option-label", w.textContent = b.label;
3257
+ const b = document.createElement("span");
3258
+ b.className = "lq-question__option-label", b.textContent = m.label;
3253
3259
  const P = document.createElement("span");
3254
- P.className = "lq-question__option-text", P.textContent = b.text, T.appendChild(w), T.appendChild(P), d.appendChild(T);
3260
+ P.className = "lq-question__option-text", P.textContent = m.text, T.appendChild(b), T.appendChild(P), d.appendChild(T);
3255
3261
  }
3256
3262
  u.appendChild(d);
3257
3263
  const f = document.createElement("div");
3258
3264
  f.className = "lq-question__counter";
3259
3265
  const h = document.createElement("span");
3260
3266
  h.className = "lq-online", h.dataset.lqQuiz = n, h.textContent = "0";
3261
- const E = document.createElement("span");
3262
- E.className = "lq-answered", E.dataset.lqQuiz = n, E.textContent = "0", f.append(h, " online · ", E, " answered"), u.appendChild(f), a.appendChild(u), o.appendChild(a), i.appendChild(o);
3267
+ const w = document.createElement("span");
3268
+ w.className = "lq-answered", w.dataset.lqQuiz = n, w.textContent = "0", f.append(h, " online · ", w, " answered"), u.appendChild(f), a.appendChild(u), o.appendChild(a), i.appendChild(o);
3263
3269
  }
3264
3270
  function Ln(i) {
3265
3271
  const e = i.dataset.quizResults, t = i.dataset.quizQuestion || "";
@@ -3292,10 +3298,10 @@ function Ln(i) {
3292
3298
  f.className = "lq-result-bar__fill", f.style.width = "0%", d.appendChild(f);
3293
3299
  const h = document.createElement("div");
3294
3300
  h.className = "lq-result-bar__stats";
3295
- const E = document.createElement("span");
3296
- E.className = "lq-result-bar__pct", E.textContent = "0%";
3297
- const b = document.createElement("span");
3298
- b.className = "lq-result-bar__count", b.textContent = "0", h.append(E, b), c.append(a, d, h), r.appendChild(c);
3301
+ const w = document.createElement("span");
3302
+ w.className = "lq-result-bar__pct", w.textContent = "0%";
3303
+ const m = document.createElement("span");
3304
+ m.className = "lq-result-bar__count", m.textContent = "0", h.append(w, m), c.append(a, d, h), r.appendChild(c);
3299
3305
  }
3300
3306
  s.appendChild(r), i.appendChild(s);
3301
3307
  }
@@ -3368,17 +3374,31 @@ function Qn() {
3368
3374
  });
3369
3375
  const a = i.getRevealElement(), u = a.querySelectorAll(
3370
3376
  "section[data-quiz-id]"
3371
- ), l = [];
3372
- for (const d of u) {
3373
- const f = zn(d, e.quizUrl, e.titleText).catch(
3374
- (h) => console.warn("[live-quiz] Failed to render question slide:", h)
3377
+ ), l = [], d = [];
3378
+ for (const f of u) {
3379
+ const h = zn(f, e.quizUrl, e.titleText).catch(
3380
+ (T) => console.warn("[live-quiz] Failed to render question slide:", T)
3375
3381
  );
3376
- l.push(f);
3382
+ l.push(h);
3383
+ const w = f.dataset.quizId, m = f.dataset.quizQuestion || "";
3384
+ try {
3385
+ const T = JSON.parse(f.dataset.quizOptions || "[]");
3386
+ d.push({
3387
+ quizId: w,
3388
+ question: m,
3389
+ options: T.map((b) => ({
3390
+ label: b.label,
3391
+ text: b.text
3392
+ }))
3393
+ });
3394
+ } catch {
3395
+ }
3377
3396
  }
3378
- for (const d of a.querySelectorAll(
3397
+ t.setQuestions(d);
3398
+ for (const f of a.querySelectorAll(
3379
3399
  "section[data-quiz-results]"
3380
3400
  ))
3381
- Ln(d);
3401
+ Ln(f);
3382
3402
  await Promise.all(l), n = t.subscribe(o), i.on("slidechanged", r);
3383
3403
  },
3384
3404
  destroy: () => {