pollcatch 2.1.4 → 2.1.6

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/pc.js +140 -139
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pollcatch",
3
3
  "private": false,
4
- "version": "2.1.4",
4
+ "version": "2.1.6",
5
5
  "type": "module",
6
6
  "main": "pc.js",
7
7
  "module": "pc.js",
package/pc.js CHANGED
@@ -281,7 +281,7 @@ U.elementStyles = [], U.shadowRootOptions = { mode: "open" }, U[K("elementProper
281
281
  */
282
282
  const W = globalThis, nt = W.trustedTypes, Bt = nt ? nt.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, ne = "$lit$", P = `lit$${Math.random().toFixed(9).slice(2)}$`, le = "?" + P, Ne = `<${le}>`, L = document, X = () => L.createComment(""), Q = (e) => e === null || typeof e != "object" && typeof e != "function", Pt = Array.isArray, Me = (e) => Pt(e) || typeof (e == null ? void 0 : e[Symbol.iterator]) == "function", bt = `[
283
283
  \f\r]`, Z = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Dt = /-->/g, Vt = />/g, N = RegExp(`>|${bt}(?:([^\\s"'>=/]+)(${bt}*=${bt}*(?:[^
284
- \f\r"'\`<>=]|("|')|))|$)`, "g"), qt = /'/g, Ht = /"/g, ce = /^(?:script|style|textarea|title)$/i, Le = (e) => (t, ...o) => ({ _$litType$: e, strings: t, values: o }), d = Le(1), z = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), Ft = /* @__PURE__ */ new WeakMap(), M = L.createTreeWalker(L, 129);
284
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), qt = /'/g, Ht = /"/g, ce = /^(?:script|style|textarea|title)$/i, Le = (e) => (t, ...o) => ({ _$litType$: e, strings: t, values: o }), d = Le(1), z = Symbol.for("lit-noChange"), h = Symbol.for("lit-nothing"), Ft = /* @__PURE__ */ new WeakMap(), M = L.createTreeWalker(L, 129);
285
285
  function de(e, t) {
286
286
  if (!Pt(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
287
287
  return Bt !== void 0 ? Bt.createHTML(t) : t;
@@ -291,10 +291,10 @@ const Re = (e, t) => {
291
291
  let s, i = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", a = Z;
292
292
  for (let n = 0; n < o; n++) {
293
293
  const l = e[n];
294
- let p, c, h = -1, w = 0;
295
- for (; w < l.length && (a.lastIndex = w, c = a.exec(l), c !== null); ) w = a.lastIndex, a === Z ? c[1] === "!--" ? a = Dt : c[1] !== void 0 ? a = Vt : c[2] !== void 0 ? (ce.test(c[2]) && (s = RegExp("</" + c[2], "g")), a = N) : c[3] !== void 0 && (a = N) : a === N ? c[0] === ">" ? (a = s ?? Z, h = -1) : c[1] === void 0 ? h = -2 : (h = a.lastIndex - c[2].length, p = c[1], a = c[3] === void 0 ? N : c[3] === '"' ? Ht : qt) : a === Ht || a === qt ? a = N : a === Dt || a === Vt ? a = Z : (a = N, s = void 0);
296
- const v = a === N && e[n + 1].startsWith("/>") ? " " : "";
297
- i += a === Z ? l + Ne : h >= 0 ? (r.push(p), l.slice(0, h) + ne + l.slice(h) + P + v) : l + P + (h === -2 ? n : v);
294
+ let u, c, p = -1, v = 0;
295
+ for (; v < l.length && (a.lastIndex = v, c = a.exec(l), c !== null); ) v = a.lastIndex, a === Z ? c[1] === "!--" ? a = Dt : c[1] !== void 0 ? a = Vt : c[2] !== void 0 ? (ce.test(c[2]) && (s = RegExp("</" + c[2], "g")), a = N) : c[3] !== void 0 && (a = N) : a === N ? c[0] === ">" ? (a = s ?? Z, p = -1) : c[1] === void 0 ? p = -2 : (p = a.lastIndex - c[2].length, u = c[1], a = c[3] === void 0 ? N : c[3] === '"' ? Ht : qt) : a === Ht || a === qt ? a = N : a === Dt || a === Vt ? a = Z : (a = N, s = void 0);
296
+ const y = a === N && e[n + 1].startsWith("/>") ? " " : "";
297
+ i += a === Z ? l + Ne : p >= 0 ? (r.push(u), l.slice(0, p) + ne + l.slice(p) + P + y) : l + P + (p === -2 ? n : y);
298
298
  }
299
299
  return [de(e, i + (e[o] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
300
300
  };
@@ -303,29 +303,29 @@ let kt = class pe {
303
303
  let s;
304
304
  this.parts = [];
305
305
  let i = 0, a = 0;
306
- const n = t.length - 1, l = this.parts, [p, c] = Re(t, o);
307
- if (this.el = pe.createElement(p, r), M.currentNode = this.el.content, o === 2 || o === 3) {
308
- const h = this.el.content.firstChild;
309
- h.replaceWith(...h.childNodes);
306
+ const n = t.length - 1, l = this.parts, [u, c] = Re(t, o);
307
+ if (this.el = pe.createElement(u, r), M.currentNode = this.el.content, o === 2 || o === 3) {
308
+ const p = this.el.content.firstChild;
309
+ p.replaceWith(...p.childNodes);
310
310
  }
311
311
  for (; (s = M.nextNode()) !== null && l.length < n; ) {
312
312
  if (s.nodeType === 1) {
313
- if (s.hasAttributes()) for (const h of s.getAttributeNames()) if (h.endsWith(ne)) {
314
- const w = c[a++], v = s.getAttribute(h).split(P), E = /([.?@])?(.*)/.exec(w);
315
- l.push({ type: 1, index: i, name: E[2], strings: v, ctor: E[1] === "." ? je : E[1] === "?" ? Be : E[1] === "@" ? De : ct }), s.removeAttribute(h);
316
- } else h.startsWith(P) && (l.push({ type: 6, index: i }), s.removeAttribute(h));
313
+ if (s.hasAttributes()) for (const p of s.getAttributeNames()) if (p.endsWith(ne)) {
314
+ const v = c[a++], y = s.getAttribute(p).split(P), E = /([.?@])?(.*)/.exec(v);
315
+ l.push({ type: 1, index: i, name: E[2], strings: y, ctor: E[1] === "." ? je : E[1] === "?" ? Be : E[1] === "@" ? De : ct }), s.removeAttribute(p);
316
+ } else p.startsWith(P) && (l.push({ type: 6, index: i }), s.removeAttribute(p));
317
317
  if (ce.test(s.tagName)) {
318
- const h = s.textContent.split(P), w = h.length - 1;
319
- if (w > 0) {
318
+ const p = s.textContent.split(P), v = p.length - 1;
319
+ if (v > 0) {
320
320
  s.textContent = nt ? nt.emptyScript : "";
321
- for (let v = 0; v < w; v++) s.append(h[v], X()), M.nextNode(), l.push({ type: 2, index: ++i });
322
- s.append(h[w], X());
321
+ for (let y = 0; y < v; y++) s.append(p[y], X()), M.nextNode(), l.push({ type: 2, index: ++i });
322
+ s.append(p[v], X());
323
323
  }
324
324
  }
325
325
  } else if (s.nodeType === 8) if (s.data === le) l.push({ type: 2, index: i });
326
326
  else {
327
- let h = -1;
328
- for (; (h = s.data.indexOf(P, h + 1)) !== -1; ) l.push({ type: 7, index: i }), h += P.length - 1;
327
+ let p = -1;
328
+ for (; (p = s.data.indexOf(P, p + 1)) !== -1; ) l.push({ type: 7, index: i }), p += P.length - 1;
329
329
  }
330
330
  i++;
331
331
  }
@@ -358,8 +358,8 @@ let Ue = class {
358
358
  let i = M.nextNode(), a = 0, n = 0, l = r[0];
359
359
  for (; l !== void 0; ) {
360
360
  if (a === l.index) {
361
- let p;
362
- l.type === 2 ? p = new et(i, i.nextSibling, this, t) : l.type === 1 ? p = new l.ctor(i, l.name, l.strings, this, t) : l.type === 6 && (p = new Ve(i, this, t)), this._$AV.push(p), l = r[++n];
361
+ let u;
362
+ l.type === 2 ? u = new et(i, i.nextSibling, this, t) : l.type === 1 ? u = new l.ctor(i, l.name, l.strings, this, t) : l.type === 6 && (u = new Ve(i, this, t)), this._$AV.push(u), l = r[++n];
363
363
  }
364
364
  a !== (l == null ? void 0 : l.index) && (i = M.nextNode(), a++);
365
365
  }
@@ -376,7 +376,7 @@ class et {
376
376
  return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
377
377
  }
378
378
  constructor(t, o, r, s) {
379
- this.type = 2, this._$AH = u, this._$AN = void 0, this._$AA = t, this._$AB = o, this._$AM = r, this.options = s, this._$Cv = (s == null ? void 0 : s.isConnected) ?? !0;
379
+ this.type = 2, this._$AH = h, this._$AN = void 0, this._$AA = t, this._$AB = o, this._$AM = r, this.options = s, this._$Cv = (s == null ? void 0 : s.isConnected) ?? !0;
380
380
  }
381
381
  get parentNode() {
382
382
  let t = this._$AA.parentNode;
@@ -390,7 +390,7 @@ class et {
390
390
  return this._$AB;
391
391
  }
392
392
  _$AI(t, o = this) {
393
- t = D(this, t, o), Q(t) ? t === u || t == null || t === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : t !== this._$AH && t !== z && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Me(t) ? this.k(t) : this._(t);
393
+ t = D(this, t, o), Q(t) ? t === h || t == null || t === "" ? (this._$AH !== h && this._$AR(), this._$AH = h) : t !== this._$AH && t !== z && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Me(t) ? this.k(t) : this._(t);
394
394
  }
395
395
  O(t) {
396
396
  return this._$AA.parentNode.insertBefore(t, this._$AB);
@@ -399,7 +399,7 @@ class et {
399
399
  this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
400
400
  }
401
401
  _(t) {
402
- this._$AH !== u && Q(this._$AH) ? this._$AA.nextSibling.data = t : this.T(L.createTextNode(t)), this._$AH = t;
402
+ this._$AH !== h && Q(this._$AH) ? this._$AA.nextSibling.data = t : this.T(L.createTextNode(t)), this._$AH = t;
403
403
  }
404
404
  $(t) {
405
405
  var i;
@@ -441,7 +441,7 @@ class ct {
441
441
  return this._$AM._$AU;
442
442
  }
443
443
  constructor(t, o, r, s, i) {
444
- this.type = 1, this._$AH = u, this._$AN = void 0, this.element = t, this.name = o, this._$AM = s, this.options = i, r.length > 2 || r[0] !== "" || r[1] !== "" ? (this._$AH = Array(r.length - 1).fill(new String()), this.strings = r) : this._$AH = u;
444
+ this.type = 1, this._$AH = h, this._$AN = void 0, this.element = t, this.name = o, this._$AM = s, this.options = i, r.length > 2 || r[0] !== "" || r[1] !== "" ? (this._$AH = Array(r.length - 1).fill(new String()), this.strings = r) : this._$AH = h;
445
445
  }
446
446
  _$AI(t, o = this, r, s) {
447
447
  const i = this.strings;
@@ -449,13 +449,13 @@ class ct {
449
449
  if (i === void 0) t = D(this, t, o, 0), a = !Q(t) || t !== this._$AH && t !== z, a && (this._$AH = t);
450
450
  else {
451
451
  const n = t;
452
- let l, p;
453
- for (t = i[0], l = 0; l < i.length - 1; l++) p = D(this, n[r + l], o, l), p === z && (p = this._$AH[l]), a || (a = !Q(p) || p !== this._$AH[l]), p === u ? t = u : t !== u && (t += (p ?? "") + i[l + 1]), this._$AH[l] = p;
452
+ let l, u;
453
+ for (t = i[0], l = 0; l < i.length - 1; l++) u = D(this, n[r + l], o, l), u === z && (u = this._$AH[l]), a || (a = !Q(u) || u !== this._$AH[l]), u === h ? t = h : t !== h && (t += (u ?? "") + i[l + 1]), this._$AH[l] = u;
454
454
  }
455
455
  a && !s && this.j(t);
456
456
  }
457
457
  j(t) {
458
- t === u ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
458
+ t === h ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
459
459
  }
460
460
  }
461
461
  let je = class extends ct {
@@ -463,7 +463,7 @@ let je = class extends ct {
463
463
  super(...arguments), this.type = 3;
464
464
  }
465
465
  j(t) {
466
- this.element[this.name] = t === u ? void 0 : t;
466
+ this.element[this.name] = t === h ? void 0 : t;
467
467
  }
468
468
  };
469
469
  class Be extends ct {
@@ -471,7 +471,7 @@ class Be extends ct {
471
471
  super(...arguments), this.type = 4;
472
472
  }
473
473
  j(t) {
474
- this.element.toggleAttribute(this.name, !!t && t !== u);
474
+ this.element.toggleAttribute(this.name, !!t && t !== h);
475
475
  }
476
476
  }
477
477
  class De extends ct {
@@ -479,8 +479,8 @@ class De extends ct {
479
479
  super(t, o, r, s, i), this.type = 5;
480
480
  }
481
481
  _$AI(t, o = this) {
482
- if ((t = D(this, t, o, 0) ?? u) === z) return;
483
- const r = this._$AH, s = t === u && r !== u || t.capture !== r.capture || t.once !== r.once || t.passive !== r.passive, i = t !== u && (r === u || s);
482
+ if ((t = D(this, t, o, 0) ?? h) === z) return;
483
+ const r = this._$AH, s = t === h && r !== h || t.capture !== r.capture || t.once !== r.once || t.passive !== r.passive, i = t !== h && (r === h || s);
484
484
  s && this.element.removeEventListener(this.name, this, r), i && this.element.addEventListener(this.name, this, t), this._$AH = t;
485
485
  }
486
486
  handleEvent(t) {
@@ -618,8 +618,8 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, A = function(e) {
618
618
  }, fe = function(e) {
619
619
  var t = e.h, o = e.s, r = e.v, s = e.a;
620
620
  t = t / 360 * 6, o /= 100, r /= 100;
621
- var i = Math.floor(t), a = r * (1 - o), n = r * (1 - (t - i) * o), l = r * (1 - (1 - t + i) * o), p = i % 6;
622
- return { r: 255 * [r, n, a, a, l, r][p], g: 255 * [l, r, r, n, a, a][p], b: 255 * [a, a, l, r, r, n][p], a: s };
621
+ var i = Math.floor(t), a = r * (1 - o), n = r * (1 - (t - i) * o), l = r * (1 - (1 - t + i) * o), u = i % 6;
622
+ return { r: 255 * [r, n, a, a, l, r][u], g: 255 * [l, r, r, n, a, a][u], b: 255 * [a, a, l, r, r, n][u], a: s };
623
623
  }, Zt = function(e) {
624
624
  return { h: ue(e.h), s: S(e.s, 0, 100), l: S(e.l, 0, 100), a: S(e.a) };
625
625
  }, Gt = function(e) {
@@ -787,21 +787,21 @@ function ao(e, t = {}) {
787
787
  },
788
788
  fallback: a = "white"
789
789
  } = t, n = s.map((c) => c === "black" ? "#000000" : c === "white" ? "#ffffff" : c === "light" ? i.light || "#f8f9fa" : c === "dark" ? i.dark || "#343a40" : c);
790
- let l = a, p = 0;
790
+ let l = a, u = 0;
791
791
  for (const c of n) {
792
- const h = St(e, c);
793
- h >= r && h > p && (p = h, l = c);
792
+ const p = St(e, c);
793
+ p >= r && p > u && (u = p, l = c);
794
794
  }
795
- if (p === 0) {
795
+ if (u === 0) {
796
796
  const c = St(e, a);
797
- l = a, p = c;
798
- for (const h of n) {
799
- if (h === a) continue;
800
- const w = St(e, h);
801
- w > p && (p = w, l = h);
797
+ l = a, u = c;
798
+ for (const p of n) {
799
+ if (p === a) continue;
800
+ const v = St(e, p);
801
+ v > u && (u = v, l = p);
802
802
  }
803
803
  m.warn(
804
- `No color option met the minimum contrast ratio of ${r}:1 against ${e}. Using ${l} with contrast ratio ${p.toFixed(2)}:1 instead.`
804
+ `No color option met the minimum contrast ratio of ${r}:1 against ${e}. Using ${l} with contrast ratio ${u.toFixed(2)}:1 instead.`
805
805
  );
806
806
  }
807
807
  return l;
@@ -1129,41 +1129,43 @@ class Ao {
1129
1129
  const o = await this.getProjectId(), r = t.name, s = t.type;
1130
1130
  let i;
1131
1131
  if (t.dataFunc && typeof window < "u") {
1132
- const w = t.dataFunc.replace(/^window\./, "").split(".");
1133
- let v = window;
1134
- for (const E of w)
1135
- if (v = v == null ? void 0 : v[E], v === void 0) break;
1136
- i = v;
1132
+ const v = t.dataFunc.replace(/^window\./, "").split(".");
1133
+ let y = window;
1134
+ for (const E of v)
1135
+ if (y = y == null ? void 0 : y[E], y === void 0) break;
1136
+ i = y;
1137
1137
  }
1138
1138
  let a, n;
1139
- if (i && typeof i == "function")
1139
+ if (i && typeof i == "function") {
1140
+ const p = t.options.map((v) => v.value);
1140
1141
  if (m.debug(`Using data function for: ${r}`, {
1141
1142
  dataFuncName: t.dataFunc,
1142
- projectKey: o
1143
- }), a = await i(o, r), a && typeof a == "object" && "success" in a && "data" in a) {
1143
+ projectKey: o,
1144
+ options: p
1145
+ }), a = await i(o, r, p), a && typeof a == "object" && "success" in a && "data" in a) {
1144
1146
  if (!a.success)
1145
1147
  throw m.error("Custom data function returned unsuccessful response", a), new Error("Custom data function returned unsuccessful response");
1146
1148
  n = a.data || {};
1147
1149
  } else
1148
1150
  n = a || {};
1149
- else {
1150
- const h = t.dataEndpoint || ee;
1151
+ } else {
1152
+ const p = t.dataEndpoint || ee;
1151
1153
  if (!r)
1152
1154
  throw new Error("Name parameter is required");
1153
- const w = `${h}/${encodeURIComponent(o)}/${encodeURIComponent(r)}`;
1154
- m.debug(`Fetching stats for: ${r}`, { endpoint: h, projectKey: o });
1155
- const v = await fetch(w);
1156
- if (!v.ok)
1157
- throw new Error(`API request failed with status: ${v.status}`);
1158
- if (a = await v.json(), !a.success)
1155
+ const v = `${p}/${encodeURIComponent(o)}/${encodeURIComponent(r)}`;
1156
+ m.debug(`Fetching stats for: ${r}`, { endpoint: p, projectKey: o });
1157
+ const y = await fetch(v);
1158
+ if (!y.ok)
1159
+ throw new Error(`API request failed with status: ${y.status}`);
1160
+ if (a = await y.json(), !a.success)
1159
1161
  throw m.error("Backend returned unsuccessful response", a), new Error("Backend returned unsuccessful response");
1160
1162
  n = a.data || {};
1161
1163
  }
1162
- const l = n.count > 0 ? Math.round(n.sum / n.count) : 0, p = Math.round(n.sum / n.count * 100), c = {
1164
+ const l = n.count > 0 ? Math.round(n.sum / n.count) : 0, u = Math.round(n.sum / n.count * 100), c = {
1163
1165
  count: n.count ?? 0,
1164
1166
  sum: n.sum,
1165
1167
  avg: l,
1166
- pct: p,
1168
+ pct: u,
1167
1169
  nps: s === x.nps ? lt((n == null ? void 0 : n.breakdown) || {}) : 0,
1168
1170
  breakdown: n.breakdown ?? {},
1169
1171
  updated: n.updated_at || (/* @__PURE__ */ new Date()).toISOString()
@@ -1244,9 +1246,9 @@ class Ao {
1244
1246
  textValues: n,
1245
1247
  metadata: t.metadata,
1246
1248
  timestamp: o
1247
- }, p = Co(JSON.stringify(l), o);
1249
+ }, u = Co(JSON.stringify(l), o);
1248
1250
  try {
1249
- await this.sendStats({ ...l, hash: p }), await this.markStatsAsSubmitted(), this.dispatchSubmitEvent(l);
1251
+ await this.sendStats({ ...l, hash: u }), await this.markStatsAsSubmitted(), this.dispatchSubmitEvent(l);
1250
1252
  } catch (c) {
1251
1253
  m.warn("Failed to send stats event", c);
1252
1254
  } finally {
@@ -1326,7 +1328,7 @@ class Ao {
1326
1328
  let a = 1;
1327
1329
  if ((i.type === x.stars || i.type === x.nps) && (a = parseInt(t)), s)
1328
1330
  if (o) {
1329
- const l = r.filter((p) => p !== t);
1331
+ const l = r.filter((u) => u !== t);
1330
1332
  this.updateStats(l.length > 0 ? 1 : 0, l);
1331
1333
  } else
1332
1334
  this.updateStats(0, []);
@@ -1522,7 +1524,7 @@ let xe = class {
1522
1524
  * Copyright 2018 Google LLC
1523
1525
  * SPDX-License-Identifier: BSD-3-Clause
1524
1526
  */
1525
- const y = $e(class extends xe {
1527
+ const w = $e(class extends xe {
1526
1528
  constructor(e) {
1527
1529
  var t;
1528
1530
  if (super(e), e.type !== we.ATTRIBUTE || e.name !== "class" || ((t = e.strings) == null ? void 0 : t.length) > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
@@ -1668,13 +1670,13 @@ const st = {
1668
1670
  }
1669
1671
  /** Common render methods */
1670
1672
  renderLabel() {
1671
- return this.question ? d`<label class="pc-label" data-testid="pc-label">${this.question}</label>` : u;
1673
+ return this.question ? d`<label class="pc-label" data-testid="pc-label">${this.question}</label>` : h;
1672
1674
  }
1673
1675
  renderLabelAtStart() {
1674
- return this.questionPosition === "left" || this.questionPosition === "top" ? this.renderLabel() : u;
1676
+ return this.questionPosition === "left" || this.questionPosition === "top" ? this.renderLabel() : h;
1675
1677
  }
1676
1678
  renderLabelAtEnd() {
1677
- return this.questionPosition === "right" || this.questionPosition === "bottom" ? this.renderLabel() : u;
1679
+ return this.questionPosition === "right" || this.questionPosition === "bottom" ? this.renderLabel() : h;
1678
1680
  }
1679
1681
  /**
1680
1682
  * Handle edit button click - switch to edit mode
@@ -1697,10 +1699,10 @@ const st = {
1697
1699
  tabindex="0"
1698
1700
  @keydown="${this.handleEditToggleKeyDown}"
1699
1701
  />
1700
- ` : u;
1702
+ ` : h;
1701
1703
  }
1702
1704
  renderStatsText() {
1703
- if (!this.displayController.shouldShowStats()) return u;
1705
+ if (!this.displayController.shouldShowStats()) return h;
1704
1706
  const t = this.dataController.formatStatsText(this.statsText || "");
1705
1707
  return d`<span class="pc-stats-text">${t}</span>`;
1706
1708
  }
@@ -1716,31 +1718,31 @@ const st = {
1716
1718
  tabindex="0"
1717
1719
  @keydown="${() => this.displayController.toggleChartVisibility()}"
1718
1720
  />
1719
- ` : u;
1721
+ ` : h;
1720
1722
  }
1721
1723
  renderStatus() {
1722
1724
  if (!this.displayController.shouldShowStats() && !this.displayController.shouldShowChartToggle() && !this.displayController.shouldShowEditButton())
1723
- return u;
1725
+ return h;
1724
1726
  const o = {
1725
1727
  "pc-status": !0,
1726
1728
  [`pc-flex-content-${k(this.statsPosition, this.statsAlign)}`]: !0
1727
1729
  };
1728
- return d`<div class="${y(o)}" data-testid="pc-status">
1730
+ return d`<div class="${w(o)}" data-testid="pc-status">
1729
1731
  ${this.renderStatsText()} ${this.renderChartToggle()} ${this.renderEditToggleIcon()}
1730
1732
  </div>`;
1731
1733
  }
1732
1734
  renderStatusAtStart() {
1733
- return this.statsPosition === "left" || this.statsPosition === "top" ? this.renderStatus() : u;
1735
+ return this.statsPosition === "left" || this.statsPosition === "top" ? this.renderStatus() : h;
1734
1736
  }
1735
1737
  renderStatusAtEnd() {
1736
- return this.statsPosition === "right" || this.statsPosition === "bottom" ? this.renderStatus() : u;
1738
+ return this.statsPosition === "right" || this.statsPosition === "bottom" ? this.renderStatus() : h;
1737
1739
  }
1738
1740
  /**
1739
1741
  * Renders the thank you message with edit button (new overlay style)
1740
1742
  */
1741
1743
  renderThankYouMessage() {
1742
1744
  if (!this.displayController.shouldDisplayThankYouMsg())
1743
- return u;
1745
+ return h;
1744
1746
  const t = ko(this.thankYouMsg || "");
1745
1747
  return d`
1746
1748
  <div class="pc-thank-you-overlay" data-testid="poll-thank-you-overlay">
@@ -2592,10 +2594,10 @@ function It(e, t = {}) {
2592
2594
  const n = `
2593
2595
  width: ${o > 0 ? i.value / o * s.maxWidth : 0}%;
2594
2596
  background-color: ${s.barColor};
2595
- `, l = s.labelFormatter(i), p = i.label ? d`<span class="pc-bar-label-text">${l}</span>` : u, c = !i.label && i.icon ? d`<span class="pc-bar-label-icon">${i.icon}</span>` : u;
2597
+ `, l = s.labelFormatter(i), u = i.label ? d`<span class="pc-bar-label-text">${l}</span>` : h, c = !i.label && i.icon ? d`<span class="pc-bar-label-icon">${i.icon}</span>` : h;
2596
2598
  return d`
2597
2599
  <div class="pc-bar-row">
2598
- <div class="pc-bar-label">${p} ${c}</div>
2600
+ <div class="pc-bar-label">${u} ${c}</div>
2599
2601
  <div class="pc-bar-container">
2600
2602
  <div class="pc-bar" style="${n}"></div>
2601
2603
  <div class="pc-bar-value">${s.valueFormatter(i)}</div>
@@ -2636,7 +2638,7 @@ let I = class extends b {
2636
2638
  <button
2637
2639
  data-testid="nps-button-${s}"
2638
2640
  ?disabled=${!this.displayController.allowEdit()}
2639
- class=${y(a)}
2641
+ class=${w(a)}
2640
2642
  @click="${() => this.handleNumberClick(s)}"
2641
2643
  @mouseenter="${() => this.handleNumberHover(s)}"
2642
2644
  @focus="${() => this.handleNumberHover(s)}"
@@ -2653,7 +2655,7 @@ let I = class extends b {
2653
2655
  });
2654
2656
  return d`
2655
2657
  <div class="nps-container" data-testid="nps-edit-container">
2656
- ${this.minMaxPosition === "top" ? this.renderMinMaxLabels() : u}
2658
+ ${this.minMaxPosition === "top" ? this.renderMinMaxLabels() : h}
2657
2659
  <div
2658
2660
  class="nps-buttons-container"
2659
2661
  id="${t}"
@@ -2662,7 +2664,7 @@ let I = class extends b {
2662
2664
  >
2663
2665
  ${r}
2664
2666
  </div>
2665
- ${this.minMaxPosition === "bottom" ? this.renderMinMaxLabels() : u}
2667
+ ${this.minMaxPosition === "bottom" ? this.renderMinMaxLabels() : h}
2666
2668
  <div id="${t}-description" class="sr-only" data-testid="nps-description">
2667
2669
  Rate from ${this.min} (${this.minLabel}) to ${this.max} (${this.maxLabel})
2668
2670
  </div>
@@ -2674,7 +2676,7 @@ let I = class extends b {
2674
2676
  */
2675
2677
  renderChart() {
2676
2678
  var a;
2677
- if (!this.displayController.shouldShowChart()) return u;
2679
+ if (!this.displayController.shouldShowChart()) return h;
2678
2680
  const e = ((a = this.dataController.stats) == null ? void 0 : a.breakdown) || {}, t = Object.values(e).reduce((n, l) => n + l, 0), o = Object.entries(e).map(([n, l]) => ({
2679
2681
  label: n,
2680
2682
  value: l
@@ -2729,9 +2731,9 @@ let I = class extends b {
2729
2731
  [`pc-flex-align-${k(this.statsPosition, this.statsAlign)}`]: !0
2730
2732
  };
2731
2733
  return d`
2732
- <div class="pc-container ${y(e)}" data-testid="nps-container">
2734
+ <div class="pc-container ${w(e)}" data-testid="nps-container">
2733
2735
  ${this.renderLabelAtStart()}
2734
- <div class="pc-body ${y(t)}" data-testid="nps-body">
2736
+ <div class="pc-body ${w(t)}" data-testid="nps-body">
2735
2737
  ${this.renderStatusAtStart()} ${this.renderContent()} ${this.renderStatusAtEnd()}
2736
2738
  </div>
2737
2739
  ${this.renderLabelAtEnd()}
@@ -3029,7 +3031,7 @@ let tt = class extends b {
3029
3031
  "pc-status": !0,
3030
3032
  [`pc-flex-content-${k("bottom", this.statsAlign)}`]: !0
3031
3033
  };
3032
- return d`<div class="${y(t)}" data-testid="pc-status">
3034
+ return d`<div class="${w(t)}" data-testid="pc-status">
3033
3035
  <span>${this.renderStatsText()} ${this.renderEditToggleIcon("stats-edit-button")}</span>
3034
3036
  </div>`;
3035
3037
  }
@@ -3037,14 +3039,14 @@ let tt = class extends b {
3037
3039
  * Render submit button for any selection type
3038
3040
  */
3039
3041
  renderSubmitButton() {
3040
- if (!this.displayController.isEditing) return u;
3042
+ if (!this.displayController.isEditing) return h;
3041
3043
  const e = {
3042
3044
  "pc-submit-button": !0,
3043
3045
  "pc-submit-button--compact": this.compact
3044
3046
  }, t = this.displayController.shouldDisableSubmitButton();
3045
3047
  return d`
3046
3048
  <button
3047
- class="${y(e)}"
3049
+ class="${w(e)}"
3048
3050
  data-testid="pc-submit-button"
3049
3051
  @click="${this.handleSubmit}"
3050
3052
  ?disabled="${t}"
@@ -3059,7 +3061,7 @@ let tt = class extends b {
3059
3061
  <div class="pc-footer" data-testid="pc-footer">
3060
3062
  ${this.renderStatus()} ${this.renderSubmitButton()}
3061
3063
  </div>
3062
- ` : u;
3064
+ ` : h;
3063
3065
  }
3064
3066
  /**
3065
3067
  * Handle click on an option with optimistic updates
@@ -3091,7 +3093,7 @@ let tt = class extends b {
3091
3093
  src="${e == null ? void 0 : e.icon}"
3092
3094
  alt="${s.alt}"
3093
3095
  class="poll-option-icon-img"
3094
- aria-label="${s.ariaLabel || u}"
3096
+ aria-label="${s.ariaLabel || h}"
3095
3097
  aria-hidden="${s.ariaHidden ? "true" : "false"}"
3096
3098
  />` : d`<span
3097
3099
  class="poll-option-icon"
@@ -3125,7 +3127,7 @@ let tt = class extends b {
3125
3127
  return d`
3126
3128
  <button
3127
3129
  data-testid="poll-option-i${t}"
3128
- class="${y(s)}"
3130
+ class="${w(s)}"
3129
3131
  @click="${() => this.handleClick(e)}"
3130
3132
  ?disabled="${r}"
3131
3133
  id="${a}-option-${t}"
@@ -3152,7 +3154,7 @@ let tt = class extends b {
3152
3154
  });
3153
3155
  return d`
3154
3156
  <div
3155
- class="${y({
3157
+ class="${w({
3156
3158
  "poll-container": !0
3157
3159
  })}"
3158
3160
  data-testid="poll-option-container"
@@ -3167,14 +3169,14 @@ let tt = class extends b {
3167
3169
  * Render chart that replaces poll options when showing
3168
3170
  */
3169
3171
  renderBarChart() {
3170
- var l, p;
3171
- const e = ((l = this.dataController.stats) == null ? void 0 : l.breakdown) || {}, t = ((p = this.dataController.localStats) == null ? void 0 : p.breakdown) || {}, o = Object.values(e).reduce((c, h) => c + h, 0), r = this.options.map((c, h) => {
3172
- const w = e[c.value] || 0, v = o > 0 ? Math.round(w / o * 100) : 0, E = (t[c.value] || 0) > 0;
3172
+ var l, u;
3173
+ const e = ((l = this.dataController.stats) == null ? void 0 : l.breakdown) || {}, t = ((u = this.dataController.localStats) == null ? void 0 : u.breakdown) || {}, o = Object.values(e).reduce((c, p) => c + p, 0), r = this.options.map((c, p) => {
3174
+ const v = e[c.value] || 0, y = o > 0 ? Math.round(v / o * 100) : 0, E = (t[c.value] || 0) > 0;
3173
3175
  return {
3174
3176
  option: c,
3175
- index: h,
3176
- voteCount: w,
3177
- percentage: v,
3177
+ index: p,
3178
+ voteCount: v,
3179
+ percentage: y,
3178
3180
  isSelected: E
3179
3181
  };
3180
3182
  }), s = this.multiple ? _.GROUP : _.RADIOGROUP, i = this.question || this.name || "Options", a = B({
@@ -3183,7 +3185,7 @@ let tt = class extends b {
3183
3185
  });
3184
3186
  return d`
3185
3187
  <div
3186
- class="${y({
3188
+ class="${w({
3187
3189
  "poll-container": !0
3188
3190
  })}"
3189
3191
  data-testid="poll-chart-container"
@@ -3191,7 +3193,7 @@ let tt = class extends b {
3191
3193
  ...=${a}
3192
3194
  >
3193
3195
  ${r.map((c) => {
3194
- const h = {
3196
+ const p = {
3195
3197
  "poll-option": !0,
3196
3198
  "poll-option--compact": this.compact,
3197
3199
  "poll-option--chart-view": !0,
@@ -3199,11 +3201,11 @@ let tt = class extends b {
3199
3201
  };
3200
3202
  return d`
3201
3203
  <div
3202
- class="${y(h)}"
3204
+ class="${w(p)}"
3203
3205
  data-testid="poll-chart-item-${c.index}"
3204
3206
  role="listitem"
3205
3207
  aria-label="${c.option.label}: ${c.percentage}% (${c.voteCount} votes)"
3206
- @click="${this.multiple ? () => this.handleClick(c.option) : u}"
3208
+ @click="${this.multiple ? () => this.handleClick(c.option) : h}"
3207
3209
  >
3208
3210
  <div
3209
3211
  class="poll-option-bar"
@@ -3270,12 +3272,12 @@ let tt = class extends b {
3270
3272
  });
3271
3273
  return d`
3272
3274
  <div
3273
- class="pc-container ${y(t)}"
3275
+ class="pc-container ${w(t)}"
3274
3276
  data-testid="poll-container"
3275
3277
  ...=${s}
3276
3278
  >
3277
3279
  ${this.renderLabelAtStart()}
3278
- <div class="${y(r)}" data-testid="poll-body">
3280
+ <div class="${w(r)}" data-testid="poll-body">
3279
3281
  ${this.renderContent()} ${this.renderFooter()}
3280
3282
  </div>
3281
3283
  ${this.renderLabelAtEnd()}
@@ -3430,20 +3432,20 @@ let V = class extends b {
3430
3432
  */
3431
3433
  renderStars() {
3432
3434
  var i, a;
3433
- if (this.displayController.shouldShowChart()) return u;
3435
+ if (this.displayController.shouldShowChart()) return h;
3434
3436
  const e = ((i = this.dataController.stats) == null ? void 0 : i.avg) || 0, t = ((a = this.dataController.localStats) == null ? void 0 : a.avg) || 0, o = this.readOnly ? e : t, r = this.displayController.allowEdit(), s = Array.from({ length: this.numStars }, (n, l) => l + 1).map((n) => {
3435
- const l = n <= Math.floor(o) || n <= (this.hoverValue || 0), p = !l && n === Math.ceil(o) && o % 1 !== 0, c = {
3437
+ const l = n <= Math.floor(o) || n <= (this.hoverValue || 0), u = !l && n === Math.ceil(o) && o % 1 !== 0, c = {
3436
3438
  star: !0,
3437
3439
  selected: l,
3438
- partial: p,
3440
+ partial: u,
3439
3441
  "view-mode": !r
3440
- }, h = p ? { "--partial-fill": `${o % 1 * 100}%` } : {};
3442
+ }, p = u ? { "--partial-fill": `${o % 1 * 100}%` } : {};
3441
3443
  return d`
3442
3444
  <div class="pc-section" data-testid="pc-section">
3443
3445
  <span
3444
3446
  data-testid="stars-view-star-${n}"
3445
- class=${y(c)}
3446
- style=${jo(h)}
3447
+ class=${w(c)}
3448
+ style=${jo(p)}
3447
3449
  role="${r ? "button" : "presentation"}"
3448
3450
  tabindex="${r ? "0" : ""}"
3449
3451
  aria-label="${r ? `Rate ${n} star${n > 1 ? "s" : ""}` : ""}"
@@ -3466,7 +3468,7 @@ let V = class extends b {
3466
3468
  */
3467
3469
  renderChart() {
3468
3470
  var a;
3469
- if (!this.displayController.shouldShowChart()) return u;
3471
+ if (!this.displayController.shouldShowChart()) return h;
3470
3472
  const e = ((a = this.dataController.stats) == null ? void 0 : a.breakdown) || {}, t = Object.values(e).reduce((n, l) => n + l, 0), o = Object.entries(e).map(([n, l]) => ({
3471
3473
  label: n,
3472
3474
  value: l,
@@ -3492,9 +3494,9 @@ let V = class extends b {
3492
3494
  [`pc-flex-align-${o}`]: !0
3493
3495
  };
3494
3496
  return d`
3495
- <div class="pc-container ${y(t)}" data-testid="pc-container">
3497
+ <div class="pc-container ${w(t)}" data-testid="pc-container">
3496
3498
  ${this.renderLabelAtStart()}
3497
- <div class="${y(r)}" data-testid="stars-body">
3499
+ <div class="${w(r)}" data-testid="stars-body">
3498
3500
  ${this.renderStatusAtStart()} ${this.renderChart()} ${this.renderStars()}
3499
3501
  ${this.renderStatusAtEnd()}
3500
3502
  </div>
@@ -3873,9 +3875,8 @@ let q = class extends b {
3873
3875
  * Get the display count for a specific reaction including local optimistic updates
3874
3876
  */
3875
3877
  getReactionCount(e) {
3876
- var r, s, i;
3877
- const t = ((r = this.dataController.localStats.breakdown) == null ? void 0 : r[e]) || 0, o = ((i = (s = this.dataController.stats) == null ? void 0 : s.breakdown) == null ? void 0 : i[e]) || 0;
3878
- return t > 0 ? t : o;
3878
+ var t, o;
3879
+ return ((o = (t = this.dataController.stats) == null ? void 0 : t.breakdown) == null ? void 0 : o[e]) || 0;
3879
3880
  }
3880
3881
  /**
3881
3882
  * Handle trigger button click (compact mode)
@@ -3900,7 +3901,7 @@ let q = class extends b {
3900
3901
  class="icon-img"
3901
3902
  src="${o}"
3902
3903
  alt="${a.alt}"
3903
- aria-label="${a.ariaLabel || u}"
3904
+ aria-label="${a.ariaLabel || h}"
3904
3905
  aria-hidden="${a.ariaHidden}"
3905
3906
  />` : d`<span class="icon" aria-hidden="${a.ariaHidden}"
3906
3907
  >${o}</span
@@ -3917,7 +3918,7 @@ let q = class extends b {
3917
3918
  }, n = `${e.tooltip || e.value} reaction${o ? ", selected" : ""}${t ? `, ${r} votes` : ""}`;
3918
3919
  return d`
3919
3920
  <button
3920
- class="${y(a)}"
3921
+ class="${w(a)}"
3921
3922
  @click="${() => this.handleReactionClick(e)}"
3922
3923
  ?disabled="${s}"
3923
3924
  aria-pressed="${o}"
@@ -3925,8 +3926,8 @@ let q = class extends b {
3925
3926
  title="${e.tooltip || ""}"
3926
3927
  data-testid="reaction-button-${i}"
3927
3928
  >
3928
- ${e.icon ? this.renderReactionIcon(e.icon, e) : u}
3929
- ${t ? d`<span class="count-label">${r}</span>` : u}
3929
+ ${e.icon ? this.renderReactionIcon(e.icon, e) : h}
3930
+ ${t ? d`<span class="count-label">${r}</span>` : h}
3930
3931
  </button>
3931
3932
  `;
3932
3933
  }
@@ -3952,14 +3953,14 @@ let q = class extends b {
3952
3953
  * Render the popover for compact mode
3953
3954
  */
3954
3955
  renderPopover() {
3955
- if (!this.displayController.shouldShowReactionPopover() || !this.compact) return u;
3956
+ if (!this.displayController.shouldShowReactionPopover() || !this.compact) return h;
3956
3957
  const e = {
3957
3958
  popover: !0,
3958
3959
  top: this.popupPosition === "top" || this.popupPosition === "auto" && this.shouldShowPopoverOnTop(),
3959
3960
  bottom: this.popupPosition === "bottom" || this.popupPosition === "auto" && !this.shouldShowPopoverOnTop()
3960
3961
  };
3961
3962
  return d`
3962
- <div class="${y(e)}" role="menu">
3963
+ <div class="${w(e)}" role="menu">
3963
3964
  <div class="popover-content">
3964
3965
  ${this.options.map((t) => {
3965
3966
  const o = this.displayController.shouldDisableOption(t);
@@ -3972,7 +3973,7 @@ let q = class extends b {
3972
3973
  aria-label="${t.tooltip || t.value} reaction"
3973
3974
  title="${t.tooltip || ""}"
3974
3975
  >
3975
- ${t.icon ? this.renderReactionIcon(t.icon, t) : u}
3976
+ ${t.icon ? this.renderReactionIcon(t.icon, t) : h}
3976
3977
  </button>
3977
3978
  `;
3978
3979
  })}
@@ -3995,7 +3996,7 @@ let q = class extends b {
3995
3996
  * Render reactions based on mode
3996
3997
  */
3997
3998
  renderReactions() {
3998
- if (this.displayController.shouldShowChart() || this.options.length === 0) return u;
3999
+ if (this.displayController.shouldShowChart() || this.options.length === 0) return h;
3999
4000
  const e = {
4000
4001
  reaction: !0,
4001
4002
  expand: !this.compact,
@@ -4006,7 +4007,7 @@ let q = class extends b {
4006
4007
  (o) => this.getReactionCount(o.value) > 0
4007
4008
  );
4008
4009
  return d`
4009
- <div class="${y(e)}">
4010
+ <div class="${w(e)}">
4010
4011
  ${this.renderTriggerButton()}
4011
4012
  ${t.length > 0 ? d`
4012
4013
  <div class="reaction-list">
@@ -4014,13 +4015,13 @@ let q = class extends b {
4014
4015
  (o) => this.renderReactionButton(o, this.showCounts)
4015
4016
  )}
4016
4017
  </div>
4017
- ` : u}
4018
+ ` : h}
4018
4019
  ${this.renderPopover()}
4019
4020
  </div>
4020
4021
  `;
4021
4022
  } else
4022
4023
  return d`
4023
- <div class="${y(e)}">
4024
+ <div class="${w(e)}">
4024
4025
  <div class="reaction-list">
4025
4026
  ${this.options.map((t) => this.renderReactionButton(t, this.showCounts))}
4026
4027
  </div>
@@ -4031,15 +4032,15 @@ let q = class extends b {
4031
4032
  * Render chart for reaction stats - simplified approach similar to pc-stars
4032
4033
  */
4033
4034
  renderChart() {
4034
- if (!this.displayController.shouldShowChart()) return u;
4035
+ if (!this.displayController.shouldShowChart()) return h;
4035
4036
  const e = this.dataController.getBreakdownInfo(), o = Object.entries(e.breakdownCount).filter(
4036
- ([l, p]) => this.options.some((c) => c.value === l)
4037
- ).map(([l, p]) => {
4038
- const c = this.options.find((h) => h.value === l);
4037
+ ([l, u]) => this.options.some((c) => c.value === l)
4038
+ ).map(([l, u]) => {
4039
+ const c = this.options.find((p) => p.value === l);
4039
4040
  return {
4040
4041
  label: l,
4041
4042
  // Use the reaction value as label
4042
- value: p,
4043
+ value: u,
4043
4044
  icon: (c == null ? void 0 : c.icon) || l
4044
4045
  // Use the icon or fall back to reaction value
4045
4046
  };
@@ -4064,9 +4065,9 @@ let q = class extends b {
4064
4065
  [`pc-flex-align-${o}`]: !0
4065
4066
  };
4066
4067
  return d`
4067
- <div class="${y(t)}" data-testid="reaction-container">
4068
+ <div class="${w(t)}" data-testid="reaction-container">
4068
4069
  ${this.renderLabelAtStart()}
4069
- <div class="${y(r)}" data-testid="reaction-body">
4070
+ <div class="${w(r)}" data-testid="reaction-body">
4070
4071
  ${this.renderStatusAtStart()} ${this.renderChart()} ${this.renderReactions()}
4071
4072
  ${this.renderStatusAtEnd()}
4072
4073
  </div>
@@ -4169,12 +4170,12 @@ let H = class extends j {
4169
4170
  // REACTION widget uses options for the icon
4170
4171
  }));
4171
4172
  t && t.length > 0 && (r = Array.from(t).map((s) => {
4172
- const i = G(s, "value", "") || "", a = G(s, "label", Yo(s, i)) || "", n = G(s, "icon", void 0), l = G(s, "tooltip", void 0), p = G(s, "disabled", void 0), c = { value: i, label: a };
4173
+ const i = G(s, "value", "") || "", a = G(s, "label", Yo(s, i)) || "", n = G(s, "icon", void 0), l = G(s, "tooltip", void 0), u = G(s, "disabled", void 0), c = { value: i, label: a };
4173
4174
  if (n !== void 0) {
4174
- const h = Ce(n);
4175
- c.icon = h.icon;
4175
+ const p = Ce(n);
4176
+ c.icon = p.icon;
4176
4177
  }
4177
- return l !== void 0 && (c.tooltip = l), p !== void 0 && (c.disabled = !0), c;
4178
+ return l !== void 0 && (c.tooltip = l), u !== void 0 && (c.disabled = !0), c;
4178
4179
  })), this.parsedOptions = r;
4179
4180
  }
4180
4181
  /**
@@ -4193,7 +4194,7 @@ let H = class extends j {
4193
4194
  default:
4194
4195
  return console.warn(
4195
4196
  `poll-catch: Unknown widget type "${this.type}". Supported types: nps, poll, stars, reaction.`
4196
- ), u;
4197
+ ), h;
4197
4198
  }
4198
4199
  }
4199
4200
  };