pollcatch 2.0.3 → 2.1.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/package.json +1 -1
- package/pc.js +149 -105
package/package.json
CHANGED
package/pc.js
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
const it = globalThis,
|
|
6
|
+
const it = globalThis, kt = it.ShadowRoot && (it.ShadyCSS === void 0 || it.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, At = Symbol(), Lt = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
let ae = class {
|
|
8
8
|
constructor(t, o, r) {
|
|
9
|
-
if (this._$cssResult$ = !0, r !==
|
|
9
|
+
if (this._$cssResult$ = !0, r !== At) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
10
10
|
this.cssText = t, this.t = o;
|
|
11
11
|
}
|
|
12
12
|
get styleSheet() {
|
|
13
13
|
let t = this.o;
|
|
14
14
|
const o = this.t;
|
|
15
|
-
if (
|
|
15
|
+
if (kt && t === void 0) {
|
|
16
16
|
const r = o !== void 0 && o.length === 1;
|
|
17
17
|
r && (t = Lt.get(o)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), r && Lt.set(o, t));
|
|
18
18
|
}
|
|
@@ -22,23 +22,23 @@ let ae = class {
|
|
|
22
22
|
return this.cssText;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const
|
|
25
|
+
const ke = (e) => new ae(typeof e == "string" ? e : e + "", void 0, At), F = (e, ...t) => {
|
|
26
26
|
const o = e.length === 1 ? e[0] : t.reduce((r, s, i) => r + ((a) => {
|
|
27
27
|
if (a._$cssResult$ === !0) return a.cssText;
|
|
28
28
|
if (typeof a == "number") return a;
|
|
29
29
|
throw Error("Value passed to 'css' function must be a 'css' function result: " + a + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
30
30
|
})(s) + e[i + 1], e[0]);
|
|
31
|
-
return new ae(o, e,
|
|
32
|
-
},
|
|
33
|
-
if (
|
|
31
|
+
return new ae(o, e, At);
|
|
32
|
+
}, Ae = (e, t) => {
|
|
33
|
+
if (kt) e.adoptedStyleSheets = t.map((o) => o instanceof CSSStyleSheet ? o : o.styleSheet);
|
|
34
34
|
else for (const o of t) {
|
|
35
35
|
const r = document.createElement("style"), s = it.litNonce;
|
|
36
36
|
s !== void 0 && r.setAttribute("nonce", s), r.textContent = o.cssText, e.appendChild(r);
|
|
37
37
|
}
|
|
38
|
-
}, Rt =
|
|
38
|
+
}, Rt = kt ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((t) => {
|
|
39
39
|
let o = "";
|
|
40
40
|
for (const r of t.cssRules) o += r.cssText;
|
|
41
|
-
return
|
|
41
|
+
return ke(o);
|
|
42
42
|
})(e) : e;
|
|
43
43
|
/**
|
|
44
44
|
* @license
|
|
@@ -161,7 +161,7 @@ let U = class extends HTMLElement {
|
|
|
161
161
|
}
|
|
162
162
|
createRenderRoot() {
|
|
163
163
|
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
164
|
-
return
|
|
164
|
+
return Ae(t, this.constructor.elementStyles), t;
|
|
165
165
|
}
|
|
166
166
|
connectedCallback() {
|
|
167
167
|
var 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,
|
|
295
|
-
for (;
|
|
296
|
-
const
|
|
297
|
-
i += a === Z ? l + Ne : h >= 0 ? (r.push(p), l.slice(0, h) + ne + l.slice(h) + E +
|
|
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 = I) : c[3] !== void 0 && (a = I) : a === I ? 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 ? I : c[3] === '"' ? Ht : qt) : a === Ht || a === qt ? a = I : a === Dt || a === Vt ? a = Z : (a = I, s = void 0);
|
|
296
|
+
const $ = a === I && e[n + 1].startsWith("/>") ? " " : "";
|
|
297
|
+
i += a === Z ? l + Ne : h >= 0 ? (r.push(p), l.slice(0, h) + ne + l.slice(h) + E + $) : l + E + (h === -2 ? n : $);
|
|
298
298
|
}
|
|
299
299
|
return [de(e, i + (e[o] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
|
|
300
300
|
};
|
|
@@ -311,15 +311,15 @@ let Ct = class pe {
|
|
|
311
311
|
for (; (s = N.nextNode()) !== null && l.length < n; ) {
|
|
312
312
|
if (s.nodeType === 1) {
|
|
313
313
|
if (s.hasAttributes()) for (const h of s.getAttributeNames()) if (h.endsWith(ne)) {
|
|
314
|
-
const
|
|
315
|
-
l.push({ type: 1, index: i, name: L[2], strings:
|
|
314
|
+
const w = c[a++], $ = s.getAttribute(h).split(E), L = /([.?@])?(.*)/.exec(w);
|
|
315
|
+
l.push({ type: 1, index: i, name: L[2], strings: $, ctor: L[1] === "." ? je : L[1] === "?" ? Be : L[1] === "@" ? De : ct }), s.removeAttribute(h);
|
|
316
316
|
} else h.startsWith(E) && (l.push({ type: 6, index: i }), s.removeAttribute(h));
|
|
317
317
|
if (ce.test(s.tagName)) {
|
|
318
|
-
const h = s.textContent.split(E),
|
|
319
|
-
if (
|
|
318
|
+
const h = s.textContent.split(E), w = h.length - 1;
|
|
319
|
+
if (w > 0) {
|
|
320
320
|
s.textContent = nt ? nt.emptyScript : "";
|
|
321
|
-
for (let
|
|
322
|
-
s.append(h[
|
|
321
|
+
for (let $ = 0; $ < w; $++) s.append(h[$], X()), N.nextNode(), l.push({ type: 2, index: ++i });
|
|
322
|
+
s.append(h[w], X());
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
} else if (s.nodeType === 8) if (s.data === le) l.push({ type: 2, index: i });
|
|
@@ -595,20 +595,20 @@ function f(e) {
|
|
|
595
595
|
function Pt(e) {
|
|
596
596
|
return f({ ...e, state: !0, attribute: !1 });
|
|
597
597
|
}
|
|
598
|
-
var
|
|
598
|
+
var x = /* @__PURE__ */ ((e) => (e.reaction = "reaction", e.stars = "stars", e.poll = "poll", e.text = "text", e.nps = "nps", e))(x || {});
|
|
599
599
|
const Ye = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24px'%20viewBox='0%20-960%20960%20960'%20width='24px'%20fill='%23434343'%3e%3cpath%20d='M640-160v-280h160v280H640Zm-240%200v-640h160v640H400Zm-240%200v-440h160v440H160Z'/%3e%3c/svg%3e", Ze = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24px'%20viewBox='0%20-960%20960%20960'%20width='24px'%20fill='%23434343'%3e%3cpath%20d='M160-160v-440h160v440H160Zm240%200v-400l160%20160v240H400Zm160-354L400-674v-126h160v286Zm240%20240L640-434v-6h160v166Zm-9%20219L55-791l57-57%20736%20736-57%2057Z'/%3e%3c/svg%3e", Ge = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24px'%20viewBox='0%20-960%20960%20960'%20width='24px'%20fill='currentColor'%3e%3cpath%20d='M200-200h57l391-391-57-57-391%20391v57Zm-80%2080v-170l528-527q12-11%2026.5-17t30.5-6q16%200%2031%206t26%2018l55%2056q12%2011%2017.5%2026t5.5%2030q0%2016-5.5%2030.5T817-647L290-120H120Zm640-584-56-56%2056%2056Zm-141%2085-28-29%2057%2057-29-28Z'/%3e%3c/svg%3e", Ke = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20fill='%23666666'%20class='bi%20bi-x'%20viewBox='0%200%2016%2016'%3e%3cpath%20d='M4.646%204.646a.5.5%200%200%201%20.708%200L8%207.293l2.646-2.647a.5.5%200%200%201%20.708.708L8.707%208l2.647%202.646a.5.5%200%200%201-.708.708L8%208.707l-2.646%202.647a.5.5%200%200%201-.708-.708L7.293%208%204.646%205.354a.5.5%200%200%201%200-.708'/%3e%3c/svg%3e";
|
|
600
|
-
var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) },
|
|
600
|
+
var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, A = function(e) {
|
|
601
601
|
return typeof e == "string" ? e.length > 0 : typeof e == "number";
|
|
602
|
-
},
|
|
602
|
+
}, y = function(e, t, o) {
|
|
603
603
|
return t === void 0 && (t = 0), o === void 0 && (o = Math.pow(10, t)), Math.round(o * e) / o + 0;
|
|
604
|
-
},
|
|
604
|
+
}, S = function(e, t, o) {
|
|
605
605
|
return t === void 0 && (t = 0), o === void 0 && (o = 1), e > o ? o : e > t ? e : t;
|
|
606
606
|
}, ue = function(e) {
|
|
607
607
|
return (e = isFinite(e) ? e % 360 : 0) > 0 ? e : e + 360;
|
|
608
608
|
}, Yt = function(e) {
|
|
609
|
-
return { r:
|
|
609
|
+
return { r: S(e.r, 0, 255), g: S(e.g, 0, 255), b: S(e.b, 0, 255), a: S(e.a) };
|
|
610
610
|
}, vt = function(e) {
|
|
611
|
-
return { r:
|
|
611
|
+
return { r: y(e.r), g: y(e.g), b: y(e.b), a: y(e.a, 3) };
|
|
612
612
|
}, Je = /^#([0-9a-f]{3,8})$/i, rt = function(e) {
|
|
613
613
|
var t = e.toString(16);
|
|
614
614
|
return t.length < 2 ? "0" + t : t;
|
|
@@ -621,9 +621,9 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, k = function(e) {
|
|
|
621
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
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 };
|
|
623
623
|
}, Zt = function(e) {
|
|
624
|
-
return { h: ue(e.h), s:
|
|
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) {
|
|
626
|
-
return { h:
|
|
626
|
+
return { h: y(e.h), s: y(e.s), l: y(e.l), a: y(e.a, 3) };
|
|
627
627
|
}, Kt = function(e) {
|
|
628
628
|
return fe((o = (t = e).s, { h: t.h, s: (o *= ((r = t.l) < 50 ? r : 100 - r) / 100) > 0 ? 2 * o / (r + o) * 100 : 0, v: r + o, a: t.a }));
|
|
629
629
|
var t, o, r;
|
|
@@ -632,7 +632,7 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, k = function(e) {
|
|
|
632
632
|
var t, o, r, s;
|
|
633
633
|
}, Xe = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Qe = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, to = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, eo = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Wt = { string: [[function(e) {
|
|
634
634
|
var t = Je.exec(e);
|
|
635
|
-
return t ? (e = t[1]).length <= 4 ? { r: parseInt(e[0] + e[0], 16), g: parseInt(e[1] + e[1], 16), b: parseInt(e[2] + e[2], 16), a: e.length === 4 ?
|
|
635
|
+
return t ? (e = t[1]).length <= 4 ? { r: parseInt(e[0] + e[0], 16), g: parseInt(e[1] + e[1], 16), b: parseInt(e[2] + e[2], 16), a: e.length === 4 ? y(parseInt(e[3] + e[3], 16) / 255, 2) : 1 } : e.length === 6 || e.length === 8 ? { r: parseInt(e.substr(0, 2), 16), g: parseInt(e.substr(2, 2), 16), b: parseInt(e.substr(4, 2), 16), a: e.length === 8 ? y(parseInt(e.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
|
|
636
636
|
}, "hex"], [function(e) {
|
|
637
637
|
var t = to.exec(e) || eo.exec(e);
|
|
638
638
|
return t ? t[2] !== t[4] || t[4] !== t[6] ? null : Yt({ r: Number(t[1]) / (t[2] ? 100 / 255 : 1), g: Number(t[3]) / (t[4] ? 100 / 255 : 1), b: Number(t[5]) / (t[6] ? 100 / 255 : 1), a: t[7] === void 0 ? 1 : Number(t[7]) / (t[8] ? 100 : 1) }) : null;
|
|
@@ -643,17 +643,17 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, k = function(e) {
|
|
|
643
643
|
return Kt(s);
|
|
644
644
|
}, "hsl"]], object: [[function(e) {
|
|
645
645
|
var t = e.r, o = e.g, r = e.b, s = e.a, i = s === void 0 ? 1 : s;
|
|
646
|
-
return
|
|
646
|
+
return A(t) && A(o) && A(r) ? Yt({ r: Number(t), g: Number(o), b: Number(r), a: Number(i) }) : null;
|
|
647
647
|
}, "rgb"], [function(e) {
|
|
648
648
|
var t = e.h, o = e.s, r = e.l, s = e.a, i = s === void 0 ? 1 : s;
|
|
649
|
-
if (!
|
|
649
|
+
if (!A(t) || !A(o) || !A(r)) return null;
|
|
650
650
|
var a = Zt({ h: Number(t), s: Number(o), l: Number(r), a: Number(i) });
|
|
651
651
|
return Kt(a);
|
|
652
652
|
}, "hsl"], [function(e) {
|
|
653
653
|
var t = e.h, o = e.s, r = e.v, s = e.a, i = s === void 0 ? 1 : s;
|
|
654
|
-
if (!
|
|
654
|
+
if (!A(t) || !A(o) || !A(r)) return null;
|
|
655
655
|
var a = function(n) {
|
|
656
|
-
return { h: ue(n.h), s:
|
|
656
|
+
return { h: ue(n.h), s: S(n.s, 0, 100), v: S(n.v, 0, 100), a: S(n.a) };
|
|
657
657
|
}({ h: Number(t), s: Number(o), v: Number(r), a: Number(i) });
|
|
658
658
|
return fe(a);
|
|
659
659
|
}, "hsv"]] }, Jt = function(e, t) {
|
|
@@ -666,12 +666,12 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, k = function(e) {
|
|
|
666
666
|
return typeof e == "string" ? Jt(e.trim(), Wt.string) : typeof e == "object" && e !== null ? Jt(e, Wt.object) : [null, void 0];
|
|
667
667
|
}, yt = function(e, t) {
|
|
668
668
|
var o = J(e);
|
|
669
|
-
return { h: o.h, s:
|
|
669
|
+
return { h: o.h, s: S(o.s + 100 * t, 0, 100), l: o.l, a: o.a };
|
|
670
670
|
}, wt = function(e) {
|
|
671
671
|
return (299 * e.r + 587 * e.g + 114 * e.b) / 1e3 / 255;
|
|
672
672
|
}, Xt = function(e, t) {
|
|
673
673
|
var o = J(e);
|
|
674
|
-
return { h: o.h, s: o.s, l:
|
|
674
|
+
return { h: o.h, s: o.s, l: S(o.l + 100 * t, 0, 100), a: o.a };
|
|
675
675
|
}, Qt = function() {
|
|
676
676
|
function e(t) {
|
|
677
677
|
this.parsed = oo(t)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
|
|
@@ -679,13 +679,13 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, k = function(e) {
|
|
|
679
679
|
return e.prototype.isValid = function() {
|
|
680
680
|
return this.parsed !== null;
|
|
681
681
|
}, e.prototype.brightness = function() {
|
|
682
|
-
return
|
|
682
|
+
return y(wt(this.rgba), 2);
|
|
683
683
|
}, e.prototype.isDark = function() {
|
|
684
684
|
return wt(this.rgba) < 0.5;
|
|
685
685
|
}, e.prototype.isLight = function() {
|
|
686
686
|
return wt(this.rgba) >= 0.5;
|
|
687
687
|
}, e.prototype.toHex = function() {
|
|
688
|
-
return t = vt(this.rgba), o = t.r, r = t.g, s = t.b, a = (i = t.a) < 1 ? rt(
|
|
688
|
+
return t = vt(this.rgba), o = t.r, r = t.g, s = t.b, a = (i = t.a) < 1 ? rt(y(255 * i)) : "", "#" + rt(o) + rt(r) + rt(s) + a;
|
|
689
689
|
var t, o, r, s, i, a;
|
|
690
690
|
}, e.prototype.toRgb = function() {
|
|
691
691
|
return vt(this.rgba);
|
|
@@ -698,33 +698,33 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, k = function(e) {
|
|
|
698
698
|
return t = Gt(J(this.rgba)), o = t.h, r = t.s, s = t.l, (i = t.a) < 1 ? "hsla(" + o + ", " + r + "%, " + s + "%, " + i + ")" : "hsl(" + o + ", " + r + "%, " + s + "%)";
|
|
699
699
|
var t, o, r, s, i;
|
|
700
700
|
}, e.prototype.toHsv = function() {
|
|
701
|
-
return t = he(this.rgba), { h:
|
|
701
|
+
return t = he(this.rgba), { h: y(t.h), s: y(t.s), v: y(t.v), a: y(t.a, 3) };
|
|
702
702
|
var t;
|
|
703
703
|
}, e.prototype.invert = function() {
|
|
704
|
-
return
|
|
704
|
+
return C({ r: 255 - (t = this.rgba).r, g: 255 - t.g, b: 255 - t.b, a: t.a });
|
|
705
705
|
var t;
|
|
706
706
|
}, e.prototype.saturate = function(t) {
|
|
707
|
-
return t === void 0 && (t = 0.1),
|
|
707
|
+
return t === void 0 && (t = 0.1), C(yt(this.rgba, t));
|
|
708
708
|
}, e.prototype.desaturate = function(t) {
|
|
709
|
-
return t === void 0 && (t = 0.1),
|
|
709
|
+
return t === void 0 && (t = 0.1), C(yt(this.rgba, -t));
|
|
710
710
|
}, e.prototype.grayscale = function() {
|
|
711
|
-
return
|
|
711
|
+
return C(yt(this.rgba, -1));
|
|
712
712
|
}, e.prototype.lighten = function(t) {
|
|
713
|
-
return t === void 0 && (t = 0.1),
|
|
713
|
+
return t === void 0 && (t = 0.1), C(Xt(this.rgba, t));
|
|
714
714
|
}, e.prototype.darken = function(t) {
|
|
715
|
-
return t === void 0 && (t = 0.1),
|
|
715
|
+
return t === void 0 && (t = 0.1), C(Xt(this.rgba, -t));
|
|
716
716
|
}, e.prototype.rotate = function(t) {
|
|
717
717
|
return t === void 0 && (t = 15), this.hue(this.hue() + t);
|
|
718
718
|
}, e.prototype.alpha = function(t) {
|
|
719
|
-
return typeof t == "number" ?
|
|
719
|
+
return typeof t == "number" ? C({ r: (o = this.rgba).r, g: o.g, b: o.b, a: t }) : y(this.rgba.a, 3);
|
|
720
720
|
var o;
|
|
721
721
|
}, e.prototype.hue = function(t) {
|
|
722
722
|
var o = J(this.rgba);
|
|
723
|
-
return typeof t == "number" ?
|
|
723
|
+
return typeof t == "number" ? C({ h: t, s: o.s, l: o.l, a: o.a }) : y(o.h);
|
|
724
724
|
}, e.prototype.isEqual = function(t) {
|
|
725
|
-
return this.toHex() ===
|
|
725
|
+
return this.toHex() === C(t).toHex();
|
|
726
726
|
}, e;
|
|
727
|
-
}(),
|
|
727
|
+
}(), C = function(e) {
|
|
728
728
|
return e instanceof Qt ? e : new Qt(e);
|
|
729
729
|
};
|
|
730
730
|
const $t = process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
@@ -776,7 +776,7 @@ function te(e) {
|
|
|
776
776
|
return 0.2126 * i + 0.7152 * a + 0.0722 * n;
|
|
777
777
|
}
|
|
778
778
|
function ao(e, t = {}) {
|
|
779
|
-
if (!
|
|
779
|
+
if (!C(e).isValid())
|
|
780
780
|
return b.warn(`Invalid color provided: ${e}`), "black";
|
|
781
781
|
const {
|
|
782
782
|
minContrast: r = 4.5,
|
|
@@ -797,8 +797,8 @@ function ao(e, t = {}) {
|
|
|
797
797
|
l = a, p = c;
|
|
798
798
|
for (const h of n) {
|
|
799
799
|
if (h === a) continue;
|
|
800
|
-
const
|
|
801
|
-
|
|
800
|
+
const w = xt(e, h);
|
|
801
|
+
w > p && (p = w, l = h);
|
|
802
802
|
}
|
|
803
803
|
b.warn(
|
|
804
804
|
`No color option met the minimum contrast ratio of ${r}:1 against ${e}. Using ${l} with contrast ratio ${p.toFixed(2)}:1 instead.`
|
|
@@ -807,13 +807,13 @@ function ao(e, t = {}) {
|
|
|
807
807
|
return l;
|
|
808
808
|
}
|
|
809
809
|
function no(e) {
|
|
810
|
-
const o = io(e) || e, r =
|
|
810
|
+
const o = io(e) || e, r = C(o);
|
|
811
811
|
if (!r.isValid())
|
|
812
812
|
return b.warn(`Invalid color provided: ${e}`), { r: 0, g: 0, b: 0 };
|
|
813
813
|
const { r: s, g: i, b: a } = r.toRgb();
|
|
814
814
|
return { r: s, g: i, b: a };
|
|
815
815
|
}
|
|
816
|
-
function
|
|
816
|
+
function k(e, t) {
|
|
817
817
|
const r = t ? {
|
|
818
818
|
left: "start",
|
|
819
819
|
right: "end",
|
|
@@ -909,7 +909,7 @@ function fo(e) {
|
|
|
909
909
|
let t = e;
|
|
910
910
|
return t = t.replace(/@import[^;]+;/gi, "").replace(/expression\s*\([^)]*\)/gi, "").replace(/javascript:\s*[^"'\s;]*/gi, "").replace(/url\s*\(\s*["']?data:(?!image\/[^;]+;base64,)[^"')]*["']?\s*\)/gi, "").replace(/-moz-binding\s*:[^;]+;/gi, "").replace(/behavior\s*:[^;]+;/gi, ""), t;
|
|
911
911
|
}
|
|
912
|
-
const ee =
|
|
912
|
+
const ee = "https://jpxwfjorwcsrqraorpbj.supabase.co/functions/v1/data", mo = "pc_session_id", bo = 24 * 60 * 60 * 1e3;
|
|
913
913
|
function oe() {
|
|
914
914
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : (b.warn("crypto.randomUUID not available, using fallback UUID generator"), "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
|
|
915
915
|
const t = Math.random() * 16 | 0;
|
|
@@ -1095,10 +1095,10 @@ function Co(e, t) {
|
|
|
1095
1095
|
o ^= r.charCodeAt(s), o += (o << 1) + (o << 4) + (o << 7) + (o << 8) + (o << 24);
|
|
1096
1096
|
return (o >>> 0).toString(16).padStart(8, "0");
|
|
1097
1097
|
}
|
|
1098
|
-
function
|
|
1098
|
+
function ko(e, t = 50) {
|
|
1099
1099
|
return e.length <= t ? e : e.substring(0, t).trim() + "...";
|
|
1100
1100
|
}
|
|
1101
|
-
class
|
|
1101
|
+
class Ao {
|
|
1102
1102
|
constructor(t) {
|
|
1103
1103
|
this.stats = P(), this.localStats = P(), this.isLoading = !0, this.isSubmitting = !1, (this.host = t).addController(this);
|
|
1104
1104
|
}
|
|
@@ -1129,17 +1129,21 @@ class ko {
|
|
|
1129
1129
|
const o = await this.getProjectId(), r = t.name, s = t.type;
|
|
1130
1130
|
if (!r)
|
|
1131
1131
|
throw new Error("Name parameter is required");
|
|
1132
|
-
|
|
1132
|
+
let i;
|
|
1133
|
+
t.dataFunc && typeof window < "u" && (i = window[t.dataFunc]);
|
|
1133
1134
|
let a;
|
|
1134
1135
|
if (i && typeof i == "function")
|
|
1135
|
-
b.debug(`Using
|
|
1136
|
+
b.debug(`Using data function for: ${r}`, {
|
|
1137
|
+
dataFuncName: t.dataFunc,
|
|
1138
|
+
projectKey: o
|
|
1139
|
+
}), a = await i(o, r);
|
|
1136
1140
|
else {
|
|
1137
|
-
const h = `${
|
|
1138
|
-
b.debug(`Fetching stats for: ${r}`, { projectKey: o });
|
|
1139
|
-
const
|
|
1140
|
-
if (
|
|
1141
|
-
throw new Error(`API request failed with status: ${
|
|
1142
|
-
a = await
|
|
1141
|
+
const h = t.dataEndpoint || ee, w = `${h}/${encodeURIComponent(o)}/${encodeURIComponent(r)}`;
|
|
1142
|
+
b.debug(`Fetching stats for: ${r}`, { endpoint: h, projectKey: o });
|
|
1143
|
+
const $ = await fetch(w);
|
|
1144
|
+
if (!$.ok)
|
|
1145
|
+
throw new Error(`API request failed with status: ${$.status}`);
|
|
1146
|
+
a = await $.json();
|
|
1143
1147
|
}
|
|
1144
1148
|
if (!a.success)
|
|
1145
1149
|
throw b.error("Backend returned unsuccessful response", a), new Error("Backend returned unsuccessful response");
|
|
@@ -1148,7 +1152,7 @@ class ko {
|
|
|
1148
1152
|
sum: n.sum,
|
|
1149
1153
|
avg: l,
|
|
1150
1154
|
pct: p,
|
|
1151
|
-
nps: s ===
|
|
1155
|
+
nps: s === x.nps ? lt((n == null ? void 0 : n.breakdown) || {}) : 0,
|
|
1152
1156
|
breakdown: n.breakdown ?? {},
|
|
1153
1157
|
updated: n.updated_at || (/* @__PURE__ */ new Date()).toISOString()
|
|
1154
1158
|
};
|
|
@@ -1194,7 +1198,7 @@ class ko {
|
|
|
1194
1198
|
updateStats(t, o) {
|
|
1195
1199
|
const r = this.host;
|
|
1196
1200
|
if (this.stats && (this.stats = wo(this.stats, this.localStats)), this.localStats = {
|
|
1197
|
-
count: t > 0 || r.type ===
|
|
1201
|
+
count: t > 0 || r.type === x.nps ? 1 : 0,
|
|
1198
1202
|
// always 1 or 0
|
|
1199
1203
|
sum: t,
|
|
1200
1204
|
// e.g. number of stars, nps value
|
|
@@ -1230,7 +1234,7 @@ class ko {
|
|
|
1230
1234
|
timestamp: o
|
|
1231
1235
|
}, p = Co(JSON.stringify(l), o);
|
|
1232
1236
|
try {
|
|
1233
|
-
await this.sendStats({ ...l, hash: p }), await this.markStatsAsSubmitted();
|
|
1237
|
+
await this.sendStats({ ...l, hash: p }), await this.markStatsAsSubmitted(), this.dispatchSubmitEvent(l);
|
|
1234
1238
|
} catch (c) {
|
|
1235
1239
|
b.warn("Failed to send stats event", c);
|
|
1236
1240
|
} finally {
|
|
@@ -1239,15 +1243,15 @@ class ko {
|
|
|
1239
1243
|
return l;
|
|
1240
1244
|
}
|
|
1241
1245
|
async sendStats(t) {
|
|
1242
|
-
const o = JSON.stringify(t),
|
|
1246
|
+
const o = JSON.stringify(t), s = this.host.dataEndpoint || ee;
|
|
1243
1247
|
try {
|
|
1244
|
-
if (b.debug("Sending stats", t), typeof navigator < "u" && navigator.sendBeacon)
|
|
1245
|
-
if (navigator.sendBeacon(
|
|
1248
|
+
if (b.debug("Sending stats", { endpoint: s, event: t }), typeof navigator < "u" && navigator.sendBeacon)
|
|
1249
|
+
if (navigator.sendBeacon(s, o)) {
|
|
1246
1250
|
b.debug("Successfully sent stats via sendBeacon");
|
|
1247
1251
|
return;
|
|
1248
1252
|
} else
|
|
1249
1253
|
b.debug("sendBeacon failed, falling back to fetch");
|
|
1250
|
-
const
|
|
1254
|
+
const i = await fetch(s, {
|
|
1251
1255
|
body: o,
|
|
1252
1256
|
method: "POST",
|
|
1253
1257
|
keepalive: !0,
|
|
@@ -1255,11 +1259,11 @@ class ko {
|
|
|
1255
1259
|
"Content-Type": "application/json"
|
|
1256
1260
|
}
|
|
1257
1261
|
});
|
|
1258
|
-
if (!
|
|
1259
|
-
throw new Error(`API request failed with status: ${
|
|
1262
|
+
if (!i.ok)
|
|
1263
|
+
throw new Error(`API request failed with status: ${i.status}`);
|
|
1260
1264
|
b.debug("Successfully sent stats via fetch");
|
|
1261
|
-
} catch (
|
|
1262
|
-
throw b.error("Failed to send analytics:",
|
|
1265
|
+
} catch (i) {
|
|
1266
|
+
throw b.error("Failed to send analytics:", i), i;
|
|
1263
1267
|
}
|
|
1264
1268
|
}
|
|
1265
1269
|
/**
|
|
@@ -1274,7 +1278,7 @@ class ko {
|
|
|
1274
1278
|
sum: (o == null ? void 0 : o.sum) || 0,
|
|
1275
1279
|
avg: (o == null ? void 0 : o.avg) || 0,
|
|
1276
1280
|
pct: (o == null ? void 0 : o.pct) || 0,
|
|
1277
|
-
nps: r.type ===
|
|
1281
|
+
nps: r.type === x.nps ? lt((o == null ? void 0 : o.breakdown) || {}) : 0
|
|
1278
1282
|
};
|
|
1279
1283
|
return b.debug("Stats data: ", this.stats), So(t, s);
|
|
1280
1284
|
}
|
|
@@ -1302,7 +1306,7 @@ class ko {
|
|
|
1302
1306
|
toggleValueSelected(t, o) {
|
|
1303
1307
|
const r = Object.keys(this.localStats.breakdown || {}), s = r.includes(t), i = this.host;
|
|
1304
1308
|
let a = 1;
|
|
1305
|
-
if ((i.type ===
|
|
1309
|
+
if ((i.type === x.stars || i.type === x.nps) && (a = parseInt(t)), s)
|
|
1306
1310
|
if (o) {
|
|
1307
1311
|
const l = r.filter((p) => p !== t);
|
|
1308
1312
|
this.updateStats(l.length > 0 ? 1 : 0, l);
|
|
@@ -1315,7 +1319,40 @@ class ko {
|
|
|
1315
1319
|
i.question || i.name || i.type || "PollCatch Widget",
|
|
1316
1320
|
n,
|
|
1317
1321
|
this.isValueSelected(t)
|
|
1318
|
-
);
|
|
1322
|
+
), this.dispatchChangeEvent();
|
|
1323
|
+
}
|
|
1324
|
+
/**
|
|
1325
|
+
* Dispatches a 'change' CustomEvent on the host element
|
|
1326
|
+
* This event fires whenever the user's selection changes
|
|
1327
|
+
*/
|
|
1328
|
+
dispatchChangeEvent() {
|
|
1329
|
+
const t = this.host, o = this.localStats.sum, r = Object.keys(this.localStats.breakdown || {}), s = {
|
|
1330
|
+
projectId: t.project,
|
|
1331
|
+
widgetType: t.type,
|
|
1332
|
+
widgetName: t.name,
|
|
1333
|
+
numericValue: o,
|
|
1334
|
+
textValues: r,
|
|
1335
|
+
tags: t.tags,
|
|
1336
|
+
url: typeof window < "u" ? window.location.href : "",
|
|
1337
|
+
timestamp: Math.floor(Date.now() / 1e3).toString()
|
|
1338
|
+
}, i = new CustomEvent("change", {
|
|
1339
|
+
detail: s,
|
|
1340
|
+
bubbles: !0,
|
|
1341
|
+
composed: !0
|
|
1342
|
+
});
|
|
1343
|
+
t.dispatchEvent(i), b.debug("Dispatched change event", s);
|
|
1344
|
+
}
|
|
1345
|
+
/**
|
|
1346
|
+
* Dispatches a 'submit' CustomEvent on the host element
|
|
1347
|
+
* This event fires when data is successfully sent to the backend
|
|
1348
|
+
*/
|
|
1349
|
+
dispatchSubmitEvent(t) {
|
|
1350
|
+
const o = this.host, r = new CustomEvent("submit", {
|
|
1351
|
+
detail: t,
|
|
1352
|
+
bubbles: !0,
|
|
1353
|
+
composed: !0
|
|
1354
|
+
});
|
|
1355
|
+
o.dispatchEvent(r), b.debug("Dispatched submit event", t);
|
|
1319
1356
|
}
|
|
1320
1357
|
hasLocalStats() {
|
|
1321
1358
|
var t;
|
|
@@ -1502,7 +1539,7 @@ const st = {
|
|
|
1502
1539
|
desktop: "1024px"
|
|
1503
1540
|
}, Mt = class Mt extends j {
|
|
1504
1541
|
constructor() {
|
|
1505
|
-
super(...arguments), this.dataController = new
|
|
1542
|
+
super(...arguments), this.dataController = new Ao(this), this.displayController = new _o(this, this.dataController), this.hasEditButton = !0, this.showStats = "never", this.showChart = !1, this.initialized = !1, this.lockAnswer = !1, this.ariaLabel = null, this.minContrast = me.AA_NORMAL, this.options = [], this.project = "public", this.questionPosition = "top", this.statsText = "{count} votes", this.buttonText = "Submit", this.buttonRadius = "sm", this.multiple = !1, this.readOnly = !1, this.handleEditToggleKeyDown = (t) => {
|
|
1506
1543
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.handleEnterEditMode());
|
|
1507
1544
|
};
|
|
1508
1545
|
}
|
|
@@ -1668,7 +1705,7 @@ const st = {
|
|
|
1668
1705
|
return u;
|
|
1669
1706
|
const o = {
|
|
1670
1707
|
"pc-status": !0,
|
|
1671
|
-
[`pc-flex-content-${
|
|
1708
|
+
[`pc-flex-content-${k(this.statsPosition, this.statsAlign)}`]: !0
|
|
1672
1709
|
};
|
|
1673
1710
|
return d`<div class="${v(o)}" data-testid="pc-status">
|
|
1674
1711
|
${this.renderStatsText()} ${this.renderChartToggle()} ${this.renderEditToggleIcon()}
|
|
@@ -1686,7 +1723,7 @@ const st = {
|
|
|
1686
1723
|
renderThankYouMessage() {
|
|
1687
1724
|
if (!this.displayController.shouldDisplayThankYouMsg())
|
|
1688
1725
|
return u;
|
|
1689
|
-
const t =
|
|
1726
|
+
const t = ko(this.thankYouMsg || "");
|
|
1690
1727
|
return d`
|
|
1691
1728
|
<div class="pc-thank-you-overlay" data-testid="poll-thank-you-overlay">
|
|
1692
1729
|
<div class="pc-thank-you" data-testid="thank-you">
|
|
@@ -1857,6 +1894,12 @@ g([
|
|
|
1857
1894
|
g([
|
|
1858
1895
|
f({ type: String })
|
|
1859
1896
|
], m.prototype, "tags");
|
|
1897
|
+
g([
|
|
1898
|
+
f({ type: String, attribute: "data-func" })
|
|
1899
|
+
], m.prototype, "dataFunc");
|
|
1900
|
+
g([
|
|
1901
|
+
f({ type: String, attribute: "data-endpoint" })
|
|
1902
|
+
], m.prototype, "dataEndpoint");
|
|
1860
1903
|
g([
|
|
1861
1904
|
f({ type: String })
|
|
1862
1905
|
], m.prototype, "question");
|
|
@@ -2552,7 +2595,7 @@ var zo = Object.defineProperty, Io = Object.getOwnPropertyDescriptor, Y = (e, t,
|
|
|
2552
2595
|
};
|
|
2553
2596
|
let z = class extends m {
|
|
2554
2597
|
constructor() {
|
|
2555
|
-
super(), this.min = 0, this.max = 10, this.type =
|
|
2598
|
+
super(), this.min = 0, this.max = 10, this.type = x.nps, this.minLabel = "Not at all", this.maxLabel = "Extremely", this.minMaxPosition = "top", this.hoverValue = -1, this.handleNumberLeave = () => {
|
|
2556
2599
|
this.hoverValue = -1;
|
|
2557
2600
|
}, this.handleKeyDown = (e) => {
|
|
2558
2601
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.hoverValue >= 0 && this.handleNumberClick(this.hoverValue));
|
|
@@ -2661,11 +2704,11 @@ let z = class extends m {
|
|
|
2661
2704
|
render() {
|
|
2662
2705
|
const e = {
|
|
2663
2706
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
2664
|
-
[`pc-flex-align-${
|
|
2707
|
+
[`pc-flex-align-${k(this.questionPosition, this.questionAlign)}`]: !0
|
|
2665
2708
|
}, t = {
|
|
2666
2709
|
nps: !0,
|
|
2667
2710
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
2668
|
-
[`pc-flex-align-${
|
|
2711
|
+
[`pc-flex-align-${k(this.statsPosition, this.statsAlign)}`]: !0
|
|
2669
2712
|
};
|
|
2670
2713
|
return d`
|
|
2671
2714
|
<div class="pc-container ${v(e)}" data-testid="nps-container">
|
|
@@ -2961,12 +3004,12 @@ var Mo = Object.defineProperty, Lo = Object.getOwnPropertyDescriptor, Nt = (e, t
|
|
|
2961
3004
|
};
|
|
2962
3005
|
let tt = class extends m {
|
|
2963
3006
|
constructor() {
|
|
2964
|
-
super(), this.type =
|
|
3007
|
+
super(), this.type = x.poll, this.multiple = !1, this.compact = !1, this.hasEditButton = !0, this.statsText = "{count} votes", this.questionPosition = "top", this.statsPosition = "bottom", this.showStats = "after-vote";
|
|
2965
3008
|
}
|
|
2966
3009
|
renderStatus() {
|
|
2967
3010
|
const t = {
|
|
2968
3011
|
"pc-status": !0,
|
|
2969
|
-
[`pc-flex-content-${
|
|
3012
|
+
[`pc-flex-content-${k("bottom", this.statsAlign)}`]: !0
|
|
2970
3013
|
};
|
|
2971
3014
|
return d`<div class="${v(t)}" data-testid="pc-status">
|
|
2972
3015
|
<span>${this.renderStatsText()} ${this.renderEditToggleIcon("stats-edit-button")}</span>
|
|
@@ -3108,12 +3151,12 @@ let tt = class extends m {
|
|
|
3108
3151
|
renderBarChart() {
|
|
3109
3152
|
var l, p;
|
|
3110
3153
|
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) => {
|
|
3111
|
-
const
|
|
3154
|
+
const w = e[c.value] || 0, $ = o > 0 ? Math.round(w / o * 100) : 0, L = (t[c.value] || 0) > 0;
|
|
3112
3155
|
return {
|
|
3113
3156
|
option: c,
|
|
3114
3157
|
index: h,
|
|
3115
|
-
voteCount:
|
|
3116
|
-
percentage:
|
|
3158
|
+
voteCount: w,
|
|
3159
|
+
percentage: $,
|
|
3117
3160
|
isSelected: L
|
|
3118
3161
|
};
|
|
3119
3162
|
}), s = this.multiple ? _.GROUP : _.RADIOGROUP, i = this.question || this.name || "Options", a = B({
|
|
@@ -3196,10 +3239,10 @@ let tt = class extends m {
|
|
|
3196
3239
|
` : this.displayController.shouldShowChart() ? d`<div class="pc-section">${this.renderBarChart()}</div>` : d`<div class="pc-section">${this.renderPollOptions()}</div>`;
|
|
3197
3240
|
}
|
|
3198
3241
|
render() {
|
|
3199
|
-
const e =
|
|
3242
|
+
const e = k(this.questionPosition, this.questionAlign), t = {
|
|
3200
3243
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
3201
3244
|
[`pc-flex-align-${e}`]: !0
|
|
3202
|
-
}, o =
|
|
3245
|
+
}, o = k(this.statsPosition, this.statsAlign), r = {
|
|
3203
3246
|
"pc-body": !0,
|
|
3204
3247
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
3205
3248
|
[`pc-flex-align-${o}`]: !0
|
|
@@ -3347,7 +3390,7 @@ var Bo = Object.defineProperty, Do = Object.getOwnPropertyDescriptor, pt = (e, t
|
|
|
3347
3390
|
};
|
|
3348
3391
|
let V = class extends m {
|
|
3349
3392
|
constructor() {
|
|
3350
|
-
super(), this.type =
|
|
3393
|
+
super(), this.type = x.stars, this.numStars = 5, this.hoverValue = -1, this.handleStarKeyDown = (e) => {
|
|
3351
3394
|
if (e.key === "Enter" || e.key === " ") {
|
|
3352
3395
|
e.preventDefault();
|
|
3353
3396
|
const t = e.target, o = parseInt(t.dataset.star || "0");
|
|
@@ -3422,10 +3465,10 @@ let V = class extends m {
|
|
|
3422
3465
|
`;
|
|
3423
3466
|
}
|
|
3424
3467
|
render() {
|
|
3425
|
-
const e =
|
|
3468
|
+
const e = k(this.questionPosition, this.questionAlign), t = {
|
|
3426
3469
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
3427
3470
|
[`pc-flex-align-${e}`]: !0
|
|
3428
|
-
}, o =
|
|
3471
|
+
}, o = k(this.statsPosition, this.statsAlign), r = {
|
|
3429
3472
|
"pc-body": !0,
|
|
3430
3473
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
3431
3474
|
[`pc-flex-align-${o}`]: !0
|
|
@@ -3806,7 +3849,7 @@ var Ho = Object.defineProperty, Fo = Object.getOwnPropertyDescriptor, ut = (e, t
|
|
|
3806
3849
|
};
|
|
3807
3850
|
let q = class extends m {
|
|
3808
3851
|
constructor() {
|
|
3809
|
-
super(), this.type =
|
|
3852
|
+
super(), this.type = x.reaction, this.showCounts = !1, this.compact = !1, this.popupPosition = "auto", this.hasEditButton = !1, this.statsText = "{count} votes", this.buttonRadius = "990px", this.muteColor = "#cccccc", this.questionPosition = "top", this.statsPosition = "right", this.popupPosition = "auto";
|
|
3810
3853
|
}
|
|
3811
3854
|
/**
|
|
3812
3855
|
* Get the display count for a specific reaction including local optimistic updates
|
|
@@ -3849,19 +3892,20 @@ let q = class extends m {
|
|
|
3849
3892
|
* Render a single reaction button
|
|
3850
3893
|
*/
|
|
3851
3894
|
renderReactionButton(e, t = !0) {
|
|
3852
|
-
const o = this.dataController.isValueSelected(e.value), r = this.getReactionCount(e.value), s = this.displayController.shouldDisableOption(e), i = {
|
|
3895
|
+
const o = this.dataController.isValueSelected(e.value), r = this.getReactionCount(e.value), s = this.displayController.shouldDisableOption(e), i = this.options.findIndex((l) => l.value === e.value), a = {
|
|
3853
3896
|
"reaction-btn": !0,
|
|
3854
3897
|
"no-counts": !t,
|
|
3855
3898
|
selected: o
|
|
3856
|
-
},
|
|
3899
|
+
}, n = `${e.tooltip || e.value} reaction${o ? ", selected" : ""}${t ? `, ${r} votes` : ""}`;
|
|
3857
3900
|
return d`
|
|
3858
3901
|
<button
|
|
3859
|
-
class="${v(
|
|
3902
|
+
class="${v(a)}"
|
|
3860
3903
|
@click="${() => this.handleReactionClick(e)}"
|
|
3861
3904
|
?disabled="${s}"
|
|
3862
3905
|
aria-pressed="${o}"
|
|
3863
|
-
aria-label="${
|
|
3906
|
+
aria-label="${n}"
|
|
3864
3907
|
title="${e.tooltip || ""}"
|
|
3908
|
+
data-testid="reaction-button-${i}"
|
|
3865
3909
|
>
|
|
3866
3910
|
${e.icon ? this.renderReactionIcon(e.icon, e) : u}
|
|
3867
3911
|
${t ? d`<span class="count-label">${r}</span>` : u}
|
|
@@ -3993,10 +4037,10 @@ let q = class extends m {
|
|
|
3993
4037
|
`;
|
|
3994
4038
|
}
|
|
3995
4039
|
render() {
|
|
3996
|
-
const e =
|
|
4040
|
+
const e = k(this.questionPosition, this.questionAlign), t = {
|
|
3997
4041
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
3998
4042
|
[`pc-flex-align-${e}`]: !0
|
|
3999
|
-
}, o =
|
|
4043
|
+
}, o = k(this.statsPosition, this.statsAlign), r = {
|
|
4000
4044
|
"pc-body": !0,
|
|
4001
4045
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
4002
4046
|
[`pc-flex-align-${o}`]: !0
|
|
@@ -4120,13 +4164,13 @@ let H = class extends j {
|
|
|
4120
4164
|
*/
|
|
4121
4165
|
render() {
|
|
4122
4166
|
switch (this.type) {
|
|
4123
|
-
case
|
|
4167
|
+
case x.nps:
|
|
4124
4168
|
return d`<pc-nps></pc-nps>`;
|
|
4125
|
-
case
|
|
4169
|
+
case x.poll:
|
|
4126
4170
|
return d`<pc-poll .options=${this.parsedOptions}></pc-poll>`;
|
|
4127
|
-
case
|
|
4171
|
+
case x.stars:
|
|
4128
4172
|
return d`<pc-stars></pc-stars>`;
|
|
4129
|
-
case
|
|
4173
|
+
case x.reaction:
|
|
4130
4174
|
return d`<pc-reaction .options=${this.parsedOptions}></pc-reaction>`;
|
|
4131
4175
|
default:
|
|
4132
4176
|
return console.warn(
|