pollcatch 2.0.1 → 2.0.3
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 +244 -222
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, At = it.ShadowRoot && (it.ShadyCSS === void 0 || it.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, kt = 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 !== kt) 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 (At && 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 Ae = (e) => new ae(typeof e == "string" ? e : e + "", void 0, kt), 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, kt);
|
|
32
|
+
}, ke = (e, t) => {
|
|
33
|
+
if (At) 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 = At ? (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 Ae(o);
|
|
42
42
|
})(e) : e;
|
|
43
43
|
/**
|
|
44
44
|
* @license
|
|
@@ -97,8 +97,8 @@ let U = class extends HTMLElement {
|
|
|
97
97
|
return { get() {
|
|
98
98
|
return s == null ? void 0 : s.call(this);
|
|
99
99
|
}, set(a) {
|
|
100
|
-
const
|
|
101
|
-
i.call(this, a), this.requestUpdate(t,
|
|
100
|
+
const n = s == null ? void 0 : s.call(this);
|
|
101
|
+
i.call(this, a), this.requestUpdate(t, n, r);
|
|
102
102
|
}, configurable: !0, enumerable: !0 };
|
|
103
103
|
}
|
|
104
104
|
static getPropertyOptions(t) {
|
|
@@ -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 ke(t, this.constructor.elementStyles), t;
|
|
165
165
|
}
|
|
166
166
|
connectedCallback() {
|
|
167
167
|
var t;
|
|
@@ -194,8 +194,8 @@ let U = class extends HTMLElement {
|
|
|
194
194
|
var i;
|
|
195
195
|
const r = this.constructor, s = r._$Eh.get(t);
|
|
196
196
|
if (s !== void 0 && this._$Em !== s) {
|
|
197
|
-
const a = r.getPropertyOptions(s),
|
|
198
|
-
this._$Em = s, this[s] =
|
|
197
|
+
const a = r.getPropertyOptions(s), n = typeof a.converter == "function" ? { fromAttribute: a.converter } : ((i = a.converter) == null ? void 0 : i.fromAttribute) !== void 0 ? a.converter : at;
|
|
198
|
+
this._$Em = s, this[s] = n.fromAttribute(o, a.type), this._$Em = null;
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
requestUpdate(t, o, r) {
|
|
@@ -279,8 +279,8 @@ U.elementStyles = [], U.shadowRootOptions = { mode: "open" }, U[K("elementProper
|
|
|
279
279
|
* Copyright 2017 Google LLC
|
|
280
280
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
281
281
|
*/
|
|
282
|
-
const
|
|
283
|
-
\f\r]`,
|
|
282
|
+
const W = globalThis, nt = W.trustedTypes, Bt = nt ? nt.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, ne = "$lit$", E = `lit$${Math.random().toFixed(9).slice(2)}$`, le = "?" + E, Ne = `<${le}>`, M = document, X = () => M.createComment(""), Q = (e) => e === null || typeof e != "object" && typeof e != "function", Et = Array.isArray, Me = (e) => Et(e) || typeof (e == null ? void 0 : e[Symbol.iterator]) == "function", mt = `[
|
|
283
|
+
\f\r]`, Z = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Dt = /-->/g, Vt = />/g, I = RegExp(`>|${mt}(?:([^\\s"'>=/]+)(${mt}*=${mt}*(?:[^
|
|
284
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), T = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), Ft = /* @__PURE__ */ new WeakMap(), N = M.createTreeWalker(M, 129);
|
|
285
285
|
function de(e, t) {
|
|
286
286
|
if (!Et(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
@@ -288,13 +288,13 @@ function de(e, t) {
|
|
|
288
288
|
}
|
|
289
289
|
const Re = (e, t) => {
|
|
290
290
|
const o = e.length - 1, r = [];
|
|
291
|
-
let s, i = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", a =
|
|
292
|
-
for (let
|
|
293
|
-
const
|
|
294
|
-
let p, c, h = -1,
|
|
295
|
-
for (;
|
|
296
|
-
const C = a === I && e[
|
|
297
|
-
i += a ===
|
|
291
|
+
let s, i = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", a = Z;
|
|
292
|
+
for (let n = 0; n < o; n++) {
|
|
293
|
+
const l = e[n];
|
|
294
|
+
let p, c, h = -1, y = 0;
|
|
295
|
+
for (; y < l.length && (a.lastIndex = y, c = a.exec(l), c !== null); ) y = 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 C = 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 + C) : l + E + (h === -2 ? n : C);
|
|
298
298
|
}
|
|
299
299
|
return [de(e, i + (e[o] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
|
|
300
300
|
};
|
|
@@ -303,29 +303,29 @@ let Ct = class pe {
|
|
|
303
303
|
let s;
|
|
304
304
|
this.parts = [];
|
|
305
305
|
let i = 0, a = 0;
|
|
306
|
-
const
|
|
306
|
+
const n = t.length - 1, l = this.parts, [p, c] = Re(t, o);
|
|
307
307
|
if (this.el = pe.createElement(p, r), N.currentNode = this.el.content, o === 2 || o === 3) {
|
|
308
308
|
const h = this.el.content.firstChild;
|
|
309
309
|
h.replaceWith(...h.childNodes);
|
|
310
310
|
}
|
|
311
|
-
for (; (s = N.nextNode()) !== null &&
|
|
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
|
-
|
|
316
|
-
} else h.startsWith(E) && (
|
|
314
|
+
const y = c[a++], C = s.getAttribute(h).split(E), L = /([.?@])?(.*)/.exec(y);
|
|
315
|
+
l.push({ type: 1, index: i, name: L[2], strings: C, ctor: L[1] === "." ? je : L[1] === "?" ? Be : L[1] === "@" ? De : ct }), s.removeAttribute(h);
|
|
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), y = h.length - 1;
|
|
319
|
+
if (y > 0) {
|
|
320
320
|
s.textContent = nt ? nt.emptyScript : "";
|
|
321
|
-
for (let C = 0; C <
|
|
322
|
-
s.append(h[
|
|
321
|
+
for (let C = 0; C < y; C++) s.append(h[C], X()), N.nextNode(), l.push({ type: 2, index: ++i });
|
|
322
|
+
s.append(h[y], X());
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
-
} else if (s.nodeType === 8) if (s.data === le)
|
|
325
|
+
} else if (s.nodeType === 8) if (s.data === le) l.push({ type: 2, index: i });
|
|
326
326
|
else {
|
|
327
327
|
let h = -1;
|
|
328
|
-
for (; (h = s.data.indexOf(E, h + 1)) !== -1; )
|
|
328
|
+
for (; (h = s.data.indexOf(E, h + 1)) !== -1; ) l.push({ type: 7, index: i }), h += E.length - 1;
|
|
329
329
|
}
|
|
330
330
|
i++;
|
|
331
331
|
}
|
|
@@ -336,11 +336,11 @@ let Ct = class pe {
|
|
|
336
336
|
}
|
|
337
337
|
};
|
|
338
338
|
function D(e, t, o = e, r) {
|
|
339
|
-
var a,
|
|
339
|
+
var a, n;
|
|
340
340
|
if (t === T) return t;
|
|
341
341
|
let s = r !== void 0 ? (a = o._$Co) == null ? void 0 : a[r] : o._$Cl;
|
|
342
|
-
const i =
|
|
343
|
-
return (s == null ? void 0 : s.constructor) !== i && ((
|
|
342
|
+
const i = Q(t) ? void 0 : t._$litDirective$;
|
|
343
|
+
return (s == null ? void 0 : s.constructor) !== i && ((n = s == null ? void 0 : s._$AO) == null || n.call(s, !1), i === void 0 ? s = void 0 : (s = new i(e), s._$AT(e, o, r)), r !== void 0 ? (o._$Co ?? (o._$Co = []))[r] = s : o._$Cl = s), s !== void 0 && (t = D(e, s._$AS(e, t.values), s, r)), t;
|
|
344
344
|
}
|
|
345
345
|
let Ue = class {
|
|
346
346
|
constructor(t, o) {
|
|
@@ -355,13 +355,13 @@ let Ue = class {
|
|
|
355
355
|
u(t) {
|
|
356
356
|
const { el: { content: o }, parts: r } = this._$AD, s = ((t == null ? void 0 : t.creationScope) ?? M).importNode(o, !0);
|
|
357
357
|
N.currentNode = s;
|
|
358
|
-
let i = N.nextNode(), a = 0,
|
|
359
|
-
for (;
|
|
360
|
-
if (a ===
|
|
358
|
+
let i = N.nextNode(), a = 0, n = 0, l = r[0];
|
|
359
|
+
for (; l !== void 0; ) {
|
|
360
|
+
if (a === l.index) {
|
|
361
361
|
let p;
|
|
362
|
-
|
|
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];
|
|
363
363
|
}
|
|
364
|
-
a !== (
|
|
364
|
+
a !== (l == null ? void 0 : l.index) && (i = N.nextNode(), a++);
|
|
365
365
|
}
|
|
366
366
|
return N.currentNode = M, s;
|
|
367
367
|
}
|
|
@@ -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),
|
|
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 !== T && 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,15 +399,15 @@ class et {
|
|
|
399
399
|
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
400
400
|
}
|
|
401
401
|
_(t) {
|
|
402
|
-
this._$AH !== u &&
|
|
402
|
+
this._$AH !== u && Q(this._$AH) ? this._$AA.nextSibling.data = t : this.T(M.createTextNode(t)), this._$AH = t;
|
|
403
403
|
}
|
|
404
404
|
$(t) {
|
|
405
405
|
var i;
|
|
406
406
|
const { values: o, _$litType$: r } = t, s = typeof r == "number" ? this._$AC(t) : (r.el === void 0 && (r.el = Ct.createElement(de(r.h, r.h[0]), this.options)), r);
|
|
407
407
|
if (((i = this._$AH) == null ? void 0 : i._$AD) === s) this._$AH.p(o);
|
|
408
408
|
else {
|
|
409
|
-
const a = new Ue(s, this),
|
|
410
|
-
a.p(o), this.T(
|
|
409
|
+
const a = new Ue(s, this), n = a.u(this.options);
|
|
410
|
+
a.p(o), this.T(n), this._$AH = a;
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
_$AC(t) {
|
|
@@ -418,7 +418,7 @@ class et {
|
|
|
418
418
|
Et(this._$AH) || (this._$AH = [], this._$AR());
|
|
419
419
|
const o = this._$AH;
|
|
420
420
|
let r, s = 0;
|
|
421
|
-
for (const i of t) s === o.length ? o.push(r = new et(this.O(
|
|
421
|
+
for (const i of t) s === o.length ? o.push(r = new et(this.O(X()), this.O(X()), this, this.options)) : r = o[s], r._$AI(i), s++;
|
|
422
422
|
s < o.length && (this._$AR(r && r._$AB.nextSibling, s), o.length = s);
|
|
423
423
|
}
|
|
424
424
|
_$AR(t = this._$AA.nextSibling, o) {
|
|
@@ -446,11 +446,11 @@ class ct {
|
|
|
446
446
|
_$AI(t, o = this, r, s) {
|
|
447
447
|
const i = this.strings;
|
|
448
448
|
let a = !1;
|
|
449
|
-
if (i === void 0) t = D(this, t, o, 0), a = !
|
|
449
|
+
if (i === void 0) t = D(this, t, o, 0), a = !Q(t) || t !== this._$AH && t !== T, a && (this._$AH = t);
|
|
450
450
|
else {
|
|
451
|
-
const
|
|
452
|
-
let
|
|
453
|
-
for (t = i[0],
|
|
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 === T && (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;
|
|
454
454
|
}
|
|
455
455
|
a && !s && this.j(t);
|
|
456
456
|
}
|
|
@@ -499,14 +499,14 @@ class Ve {
|
|
|
499
499
|
D(this, t);
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
-
const bt =
|
|
503
|
-
bt == null || bt(Ct, et), (
|
|
502
|
+
const bt = W.litHtmlPolyfillSupport;
|
|
503
|
+
bt == null || bt(Ct, et), (W.litHtmlVersions ?? (W.litHtmlVersions = [])).push("3.2.1");
|
|
504
504
|
const qe = (e, t, o) => {
|
|
505
505
|
const r = (o == null ? void 0 : o.renderBefore) ?? t;
|
|
506
506
|
let s = r._$litPart$;
|
|
507
507
|
if (s === void 0) {
|
|
508
508
|
const i = (o == null ? void 0 : o.renderBefore) ?? null;
|
|
509
|
-
r._$litPart$ = s = new et(t.insertBefore(
|
|
509
|
+
r._$litPart$ = s = new et(t.insertBefore(X(), i), i, void 0, o ?? {});
|
|
510
510
|
}
|
|
511
511
|
return s._$AI(e), s;
|
|
512
512
|
};
|
|
@@ -565,18 +565,18 @@ const He = { attribute: !0, type: String, converter: at, reflect: !1, hasChanged
|
|
|
565
565
|
let i = globalThis.litPropertyMetadata.get(s);
|
|
566
566
|
if (i === void 0 && globalThis.litPropertyMetadata.set(s, i = /* @__PURE__ */ new Map()), i.set(o.name, e), r === "accessor") {
|
|
567
567
|
const { name: a } = o;
|
|
568
|
-
return { set(
|
|
569
|
-
const
|
|
570
|
-
t.set.call(this,
|
|
571
|
-
}, init(
|
|
572
|
-
return
|
|
568
|
+
return { set(n) {
|
|
569
|
+
const l = t.get.call(this);
|
|
570
|
+
t.set.call(this, n), this.requestUpdate(a, l, e);
|
|
571
|
+
}, init(n) {
|
|
572
|
+
return n !== void 0 && this.P(a, void 0, e), n;
|
|
573
573
|
} };
|
|
574
574
|
}
|
|
575
575
|
if (r === "setter") {
|
|
576
576
|
const { name: a } = o;
|
|
577
|
-
return function(
|
|
578
|
-
const
|
|
579
|
-
t.call(this,
|
|
577
|
+
return function(n) {
|
|
578
|
+
const l = this[a];
|
|
579
|
+
t.call(this, n), this.requestUpdate(a, l, e);
|
|
580
580
|
};
|
|
581
581
|
}
|
|
582
582
|
throw Error("Unsupported decorator location: " + r);
|
|
@@ -596,10 +596,10 @@ function Pt(e) {
|
|
|
596
596
|
return f({ ...e, state: !0, attribute: !1 });
|
|
597
597
|
}
|
|
598
598
|
var $ = /* @__PURE__ */ ((e) => (e.reaction = "reaction", e.stars = "stars", e.poll = "poll", e.text = "text", e.nps = "nps", e))($ || {});
|
|
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",
|
|
600
|
-
var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) },
|
|
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) }, k = function(e) {
|
|
601
601
|
return typeof e == "string" ? e.length > 0 : typeof e == "number";
|
|
602
|
-
},
|
|
602
|
+
}, w = 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
|
}, x = function(e, t, o) {
|
|
605
605
|
return t === void 0 && (t = 0), o === void 0 && (o = 1), e > o ? o : e > t ? e : t;
|
|
@@ -608,31 +608,31 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, A = function(e) {
|
|
|
608
608
|
}, Yt = function(e) {
|
|
609
609
|
return { r: x(e.r, 0, 255), g: x(e.g, 0, 255), b: x(e.b, 0, 255), a: x(e.a) };
|
|
610
610
|
}, vt = function(e) {
|
|
611
|
-
return { r:
|
|
611
|
+
return { r: w(e.r), g: w(e.g), b: w(e.b), a: w(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;
|
|
615
615
|
}, he = function(e) {
|
|
616
|
-
var t = e.r, o = e.g, r = e.b, s = e.a, i = Math.max(t, o, r), a = i - Math.min(t, o, r),
|
|
617
|
-
return { h: 60 * (
|
|
616
|
+
var t = e.r, o = e.g, r = e.b, s = e.a, i = Math.max(t, o, r), a = i - Math.min(t, o, r), n = a ? i === t ? (o - r) / a : i === o ? 2 + (r - t) / a : 4 + (t - o) / a : 0;
|
|
617
|
+
return { h: 60 * (n < 0 ? n + 6 : n), s: i ? a / i * 100 : 0, v: i / 255 * 100, a: s };
|
|
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),
|
|
622
|
-
return { r: 255 * [r,
|
|
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 };
|
|
623
623
|
}, Zt = function(e) {
|
|
624
624
|
return { h: ue(e.h), s: x(e.s, 0, 100), l: x(e.l, 0, 100), a: x(e.a) };
|
|
625
|
-
}, Kt = function(e) {
|
|
626
|
-
return { h: y(e.h), s: y(e.s), l: y(e.l), a: y(e.a, 3) };
|
|
627
625
|
}, Gt = function(e) {
|
|
626
|
+
return { h: w(e.h), s: w(e.s), l: w(e.l), a: w(e.a, 3) };
|
|
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;
|
|
630
|
-
},
|
|
630
|
+
}, J = function(e) {
|
|
631
631
|
return { h: (t = he(e)).h, s: (s = (200 - (o = t.s)) * (r = t.v) / 100) > 0 && s < 200 ? o * r / 100 / (s <= 100 ? s : 200 - s) * 100 : 0, l: s / 2, a: t.a };
|
|
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 ? w(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 ? w(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;
|
|
@@ -640,20 +640,20 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, A = function(e) {
|
|
|
640
640
|
var t = Xe.exec(e) || Qe.exec(e);
|
|
641
641
|
if (!t) return null;
|
|
642
642
|
var o, r, s = Zt({ h: (o = t[1], r = t[2], r === void 0 && (r = "deg"), Number(o) * (We[r] || 1)), s: Number(t[3]), l: Number(t[4]), a: t[5] === void 0 ? 1 : Number(t[5]) / (t[6] ? 100 : 1) });
|
|
643
|
-
return
|
|
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 k(t) && k(o) && k(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 (!k(t) || !k(o) || !k(r)) return null;
|
|
650
650
|
var a = Zt({ h: Number(t), s: Number(o), l: Number(r), a: Number(i) });
|
|
651
|
-
return
|
|
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 (!
|
|
655
|
-
var a = function(
|
|
656
|
-
return { h: ue(
|
|
654
|
+
if (!k(t) || !k(o) || !k(r)) return null;
|
|
655
|
+
var a = function(n) {
|
|
656
|
+
return { h: ue(n.h), s: x(n.s, 0, 100), v: x(n.v, 0, 100), a: x(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) {
|
|
@@ -665,12 +665,12 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, A = function(e) {
|
|
|
665
665
|
}, oo = 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
|
-
var o =
|
|
668
|
+
var o = J(e);
|
|
669
669
|
return { h: o.h, s: x(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
|
-
var o =
|
|
673
|
+
var o = J(e);
|
|
674
674
|
return { h: o.h, s: o.s, l: x(o.l + 100 * t, 0, 100), a: o.a };
|
|
675
675
|
}, Qt = function() {
|
|
676
676
|
function e(t) {
|
|
@@ -679,13 +679,13 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, A = 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 w(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(w(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);
|
|
@@ -693,12 +693,12 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, A = function(e) {
|
|
|
693
693
|
return t = vt(this.rgba), o = t.r, r = t.g, s = t.b, (i = t.a) < 1 ? "rgba(" + o + ", " + r + ", " + s + ", " + i + ")" : "rgb(" + o + ", " + r + ", " + s + ")";
|
|
694
694
|
var t, o, r, s, i;
|
|
695
695
|
}, e.prototype.toHsl = function() {
|
|
696
|
-
return
|
|
696
|
+
return Gt(J(this.rgba));
|
|
697
697
|
}, e.prototype.toHslString = function() {
|
|
698
|
-
return t =
|
|
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: w(t.h), s: w(t.s), v: w(t.v), a: w(t.a, 3) };
|
|
702
702
|
var t;
|
|
703
703
|
}, e.prototype.invert = function() {
|
|
704
704
|
return S({ r: 255 - (t = this.rgba).r, g: 255 - t.g, b: 255 - t.b, a: t.a });
|
|
@@ -716,11 +716,11 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, A = function(e) {
|
|
|
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" ? S({ r: (o = this.rgba).r, g: o.g, b: o.b, a: t }) :
|
|
719
|
+
return typeof t == "number" ? S({ r: (o = this.rgba).r, g: o.g, b: o.b, a: t }) : w(this.rgba.a, 3);
|
|
720
720
|
var o;
|
|
721
721
|
}, e.prototype.hue = function(t) {
|
|
722
|
-
var o =
|
|
723
|
-
return typeof t == "number" ? S({ h: t, s: o.s, l: o.l, a: o.a }) :
|
|
722
|
+
var o = J(this.rgba);
|
|
723
|
+
return typeof t == "number" ? S({ h: t, s: o.s, l: o.l, a: o.a }) : w(o.h);
|
|
724
724
|
}, e.prototype.isEqual = function(t) {
|
|
725
725
|
return this.toHex() === S(t).toHex();
|
|
726
726
|
}, e;
|
|
@@ -772,8 +772,8 @@ function xt(e, t) {
|
|
|
772
772
|
return (s + 0.05) / (i + 0.05);
|
|
773
773
|
}
|
|
774
774
|
function te(e) {
|
|
775
|
-
const t = no(e), o = t.r / 255, r = t.g / 255, s = t.b / 255, i = o <= 0.03928 ? o / 12.92 : Math.pow((o + 0.055) / 1.055, 2.4), a = r <= 0.03928 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4),
|
|
776
|
-
return 0.2126 * i + 0.7152 * a + 0.0722 *
|
|
775
|
+
const t = no(e), o = t.r / 255, r = t.g / 255, s = t.b / 255, i = o <= 0.03928 ? o / 12.92 : Math.pow((o + 0.055) / 1.055, 2.4), a = r <= 0.03928 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4), n = s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4);
|
|
776
|
+
return 0.2126 * i + 0.7152 * a + 0.0722 * n;
|
|
777
777
|
}
|
|
778
778
|
function ao(e, t = {}) {
|
|
779
779
|
if (!S(e).isValid())
|
|
@@ -786,25 +786,25 @@ function ao(e, t = {}) {
|
|
|
786
786
|
dark: "#343a40"
|
|
787
787
|
},
|
|
788
788
|
fallback: a = "white"
|
|
789
|
-
} = t,
|
|
790
|
-
let
|
|
791
|
-
for (const c of
|
|
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;
|
|
791
|
+
for (const c of n) {
|
|
792
792
|
const h = xt(e, c);
|
|
793
|
-
h >= r && h > p && (p = h,
|
|
793
|
+
h >= r && h > p && (p = h, l = c);
|
|
794
794
|
}
|
|
795
795
|
if (p === 0) {
|
|
796
796
|
const c = xt(e, a);
|
|
797
|
-
|
|
798
|
-
for (const h of
|
|
797
|
+
l = a, p = c;
|
|
798
|
+
for (const h of n) {
|
|
799
799
|
if (h === a) continue;
|
|
800
|
-
const
|
|
801
|
-
|
|
800
|
+
const y = xt(e, h);
|
|
801
|
+
y > p && (p = y, l = h);
|
|
802
802
|
}
|
|
803
803
|
b.warn(
|
|
804
|
-
`No color option met the minimum contrast ratio of ${r}:1 against ${e}. Using ${
|
|
804
|
+
`No color option met the minimum contrast ratio of ${r}:1 against ${e}. Using ${l} with contrast ratio ${p.toFixed(2)}:1 instead.`
|
|
805
805
|
);
|
|
806
806
|
}
|
|
807
|
-
return
|
|
807
|
+
return l;
|
|
808
808
|
}
|
|
809
809
|
function no(e) {
|
|
810
810
|
const o = io(e) || e, r = S(o);
|
|
@@ -813,7 +813,7 @@ function no(e) {
|
|
|
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 A(e, t) {
|
|
817
817
|
const r = t ? {
|
|
818
818
|
left: "start",
|
|
819
819
|
right: "end",
|
|
@@ -978,8 +978,8 @@ function lt(e) {
|
|
|
978
978
|
return 0;
|
|
979
979
|
let t = 0, o = 0, r = 0;
|
|
980
980
|
for (let a = 0; a <= 10; a++) {
|
|
981
|
-
const
|
|
982
|
-
r +=
|
|
981
|
+
const n = a.toString(), l = Math.max(0, e[n] || 0);
|
|
982
|
+
r += l, a >= 9 ? t += l : a >= 7 || (o += l);
|
|
983
983
|
}
|
|
984
984
|
if (r === 0)
|
|
985
985
|
return 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 Ao(e, t = 50) {
|
|
1099
1099
|
return e.length <= t ? e : e.substring(0, t).trim() + "...";
|
|
1100
1100
|
}
|
|
1101
|
-
class
|
|
1101
|
+
class ko {
|
|
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,24 +1129,30 @@ class Ao {
|
|
|
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
|
-
const i =
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1132
|
+
const i = typeof window < "u" && window.PC_DATA_FUNC;
|
|
1133
|
+
let a;
|
|
1134
|
+
if (i && typeof i == "function")
|
|
1135
|
+
b.debug(`Using PC_DATA_FUNC for: ${r}`, { projectKey: o }), a = await i(o, r);
|
|
1136
|
+
else {
|
|
1137
|
+
const h = `${ee}/${encodeURIComponent(o)}/${encodeURIComponent(r)}`;
|
|
1138
|
+
b.debug(`Fetching stats for: ${r}`, { projectKey: o });
|
|
1139
|
+
const y = await fetch(h);
|
|
1140
|
+
if (!y.ok)
|
|
1141
|
+
throw new Error(`API request failed with status: ${y.status}`);
|
|
1142
|
+
a = await y.json();
|
|
1143
|
+
}
|
|
1144
|
+
if (!a.success)
|
|
1145
|
+
throw b.error("Backend returned unsuccessful response", a), new Error("Backend returned unsuccessful response");
|
|
1146
|
+
const n = a.data || {}, l = n.count > 0 ? Math.round(n.sum / n.count) : 0, p = Math.round(n.sum / n.count * 100), c = {
|
|
1141
1147
|
count: n.count ?? 0,
|
|
1142
1148
|
sum: n.sum,
|
|
1143
|
-
avg:
|
|
1144
|
-
pct:
|
|
1149
|
+
avg: l,
|
|
1150
|
+
pct: p,
|
|
1145
1151
|
nps: s === $.nps ? lt((n == null ? void 0 : n.breakdown) || {}) : 0,
|
|
1146
1152
|
breakdown: n.breakdown ?? {},
|
|
1147
1153
|
updated: n.updated_at || (/* @__PURE__ */ new Date()).toISOString()
|
|
1148
1154
|
};
|
|
1149
|
-
this.stats =
|
|
1155
|
+
this.stats = c;
|
|
1150
1156
|
} catch (o) {
|
|
1151
1157
|
throw b.error("Error loading stats:", o, this.localStats), o;
|
|
1152
1158
|
} finally {
|
|
@@ -1210,27 +1216,27 @@ class Ao {
|
|
|
1210
1216
|
async submitStats() {
|
|
1211
1217
|
if (!this.hasLocalStats())
|
|
1212
1218
|
throw b.warn("No local stats to submit"), new Error("No local stats to submit");
|
|
1213
|
-
const t = this.host, o = Math.floor(Date.now() / 1e3).toString(), r = await re(), s = await this.getProjectId(), i = t.name || "", a = this.localStats.sum,
|
|
1219
|
+
const t = this.host, o = Math.floor(Date.now() / 1e3).toString(), r = await re(), s = await this.getProjectId(), i = t.name || "", a = this.localStats.sum, n = Object.keys(this.localStats.breakdown || {});
|
|
1214
1220
|
this.isSubmitting = !0, this.host.requestUpdate();
|
|
1215
|
-
const
|
|
1221
|
+
const l = {
|
|
1216
1222
|
sessionId: r,
|
|
1217
1223
|
projectId: s,
|
|
1218
1224
|
widgetName: i,
|
|
1219
1225
|
widgetType: t.type,
|
|
1220
1226
|
url: window.location.href,
|
|
1221
1227
|
numericValue: a,
|
|
1222
|
-
textValues:
|
|
1228
|
+
textValues: n,
|
|
1223
1229
|
tags: t.tags,
|
|
1224
1230
|
timestamp: o
|
|
1225
|
-
}, p = Co(JSON.stringify(
|
|
1231
|
+
}, p = Co(JSON.stringify(l), o);
|
|
1226
1232
|
try {
|
|
1227
|
-
await this.sendStats({ ...
|
|
1233
|
+
await this.sendStats({ ...l, hash: p }), await this.markStatsAsSubmitted();
|
|
1228
1234
|
} catch (c) {
|
|
1229
1235
|
b.warn("Failed to send stats event", c);
|
|
1230
1236
|
} finally {
|
|
1231
1237
|
this.isSubmitting = !1, this.host.requestUpdate();
|
|
1232
1238
|
}
|
|
1233
|
-
return
|
|
1239
|
+
return l;
|
|
1234
1240
|
}
|
|
1235
1241
|
async sendStats(t) {
|
|
1236
1242
|
const o = JSON.stringify(t), r = `${ee}`;
|
|
@@ -1283,8 +1289,8 @@ class Ao {
|
|
|
1283
1289
|
}
|
|
1284
1290
|
getBreakdownInfo() {
|
|
1285
1291
|
var i;
|
|
1286
|
-
const t = ((i = this.stats) == null ? void 0 : i.breakdown) || {}, o = Object.values(t).reduce((a,
|
|
1287
|
-
Object.entries(t).map(([a,
|
|
1292
|
+
const t = ((i = this.stats) == null ? void 0 : i.breakdown) || {}, o = Object.values(t).reduce((a, n) => a + n, 0), r = t, s = Object.fromEntries(
|
|
1293
|
+
Object.entries(t).map(([a, n]) => [a, n / o * 100])
|
|
1288
1294
|
);
|
|
1289
1295
|
return { totalCount: o, breakdownCount: r, breakdownPercentage: s };
|
|
1290
1296
|
}
|
|
@@ -1298,16 +1304,16 @@ class Ao {
|
|
|
1298
1304
|
let a = 1;
|
|
1299
1305
|
if ((i.type === $.stars || i.type === $.nps) && (a = parseInt(t)), s)
|
|
1300
1306
|
if (o) {
|
|
1301
|
-
const
|
|
1302
|
-
this.updateStats(
|
|
1307
|
+
const l = r.filter((p) => p !== t);
|
|
1308
|
+
this.updateStats(l.length > 0 ? 1 : 0, l);
|
|
1303
1309
|
} else
|
|
1304
1310
|
this.updateStats(0, []);
|
|
1305
1311
|
else
|
|
1306
1312
|
o ? this.updateStats(a, [...r, t]) : this.updateStats(a, [t]);
|
|
1307
|
-
const
|
|
1308
|
-
|
|
1313
|
+
const n = i.options.find((l) => l.value === t);
|
|
1314
|
+
n && i.announceSelectionChange(
|
|
1309
1315
|
i.question || i.name || i.type || "PollCatch Widget",
|
|
1310
|
-
|
|
1316
|
+
n,
|
|
1311
1317
|
this.isValueSelected(t)
|
|
1312
1318
|
);
|
|
1313
1319
|
}
|
|
@@ -1418,10 +1424,10 @@ function ye(e, t = {}) {
|
|
|
1418
1424
|
o === "functional" && !r && !s && console.warn(
|
|
1419
1425
|
"No alt text or aria-label provided for functional icon. This may cause accessibility issues."
|
|
1420
1426
|
);
|
|
1421
|
-
const a = i ? " (selected)" : "",
|
|
1427
|
+
const a = i ? " (selected)" : "", n = Tt(e) && !r ? "" : r || e, l = s || (n ? `${n}${a}` : a);
|
|
1422
1428
|
return {
|
|
1423
|
-
alt:
|
|
1424
|
-
ariaLabel:
|
|
1429
|
+
alt: n,
|
|
1430
|
+
ariaLabel: l,
|
|
1425
1431
|
ariaHidden: !1
|
|
1426
1432
|
};
|
|
1427
1433
|
}
|
|
@@ -1496,7 +1502,7 @@ const st = {
|
|
|
1496
1502
|
desktop: "1024px"
|
|
1497
1503
|
}, Mt = class Mt extends j {
|
|
1498
1504
|
constructor() {
|
|
1499
|
-
super(...arguments), this.dataController = new
|
|
1505
|
+
super(...arguments), this.dataController = new ko(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) => {
|
|
1500
1506
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.handleEnterEditMode());
|
|
1501
1507
|
};
|
|
1502
1508
|
}
|
|
@@ -1627,7 +1633,7 @@ const st = {
|
|
|
1627
1633
|
renderEditToggleIcon(t = "edit-toggle-button") {
|
|
1628
1634
|
return this.displayController.shouldShowEditButton() ? d`
|
|
1629
1635
|
<img
|
|
1630
|
-
src="${
|
|
1636
|
+
src="${Ge}"
|
|
1631
1637
|
alt="Edit vote"
|
|
1632
1638
|
class="edit-toggle-icon"
|
|
1633
1639
|
data-testid="${t}"
|
|
@@ -1662,7 +1668,7 @@ const st = {
|
|
|
1662
1668
|
return u;
|
|
1663
1669
|
const o = {
|
|
1664
1670
|
"pc-status": !0,
|
|
1665
|
-
[`pc-flex-content-${
|
|
1671
|
+
[`pc-flex-content-${A(this.statsPosition, this.statsAlign)}`]: !0
|
|
1666
1672
|
};
|
|
1667
1673
|
return d`<div class="${v(o)}" data-testid="pc-status">
|
|
1668
1674
|
${this.renderStatsText()} ${this.renderChartToggle()} ${this.renderEditToggleIcon()}
|
|
@@ -1680,14 +1686,14 @@ const st = {
|
|
|
1680
1686
|
renderThankYouMessage() {
|
|
1681
1687
|
if (!this.displayController.shouldDisplayThankYouMsg())
|
|
1682
1688
|
return u;
|
|
1683
|
-
const t =
|
|
1689
|
+
const t = Ao(this.thankYouMsg || "");
|
|
1684
1690
|
return d`
|
|
1685
1691
|
<div class="pc-thank-you-overlay" data-testid="poll-thank-you-overlay">
|
|
1686
1692
|
<div class="pc-thank-you" data-testid="thank-you">
|
|
1687
1693
|
<div class="pc-thank-you-msg" data-testid="thank-you-msg">
|
|
1688
1694
|
${t}
|
|
1689
1695
|
<img
|
|
1690
|
-
src="${
|
|
1696
|
+
src="${Ke}"
|
|
1691
1697
|
alt="Close"
|
|
1692
1698
|
class="thank-you-close-icon"
|
|
1693
1699
|
data-testid="close-thank-you-button"
|
|
@@ -1701,7 +1707,7 @@ const st = {
|
|
|
1701
1707
|
}
|
|
1702
1708
|
};
|
|
1703
1709
|
Mt.styles = [
|
|
1704
|
-
|
|
1710
|
+
F`
|
|
1705
1711
|
:host {
|
|
1706
1712
|
/* Default values for CSS variables - can be overridden by external :root or parent definitions */
|
|
1707
1713
|
--default-font-size-base: 1rem;
|
|
@@ -1884,7 +1890,7 @@ g([
|
|
|
1884
1890
|
g([
|
|
1885
1891
|
f({ type: Boolean, attribute: "read-only" })
|
|
1886
1892
|
], m.prototype, "readOnly");
|
|
1887
|
-
const To =
|
|
1893
|
+
const To = F`
|
|
1888
1894
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
1889
1895
|
|
|
1890
1896
|
.pc-body {
|
|
@@ -2030,7 +2036,7 @@ const To = H`
|
|
|
2030
2036
|
}
|
|
2031
2037
|
|
|
2032
2038
|
/* Removed unused responsive styles for action buttons */
|
|
2033
|
-
`, dt =
|
|
2039
|
+
`, dt = F`
|
|
2034
2040
|
/* Default values for CSS variables - can be overridden by external :root or parent definitions */
|
|
2035
2041
|
:host {
|
|
2036
2042
|
--default-primary-color: #2196f3;
|
|
@@ -2522,15 +2528,15 @@ function It(e, t = {}) {
|
|
|
2522
2528
|
return d`
|
|
2523
2529
|
<div class="pc-bar-chart">
|
|
2524
2530
|
${e.map((i) => {
|
|
2525
|
-
const
|
|
2531
|
+
const n = `
|
|
2526
2532
|
width: ${o > 0 ? i.value / o * s.maxWidth : 0}%;
|
|
2527
2533
|
background-color: ${s.barColor};
|
|
2528
|
-
`,
|
|
2534
|
+
`, 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;
|
|
2529
2535
|
return d`
|
|
2530
2536
|
<div class="pc-bar-row">
|
|
2531
2537
|
<div class="pc-bar-label">${p} ${c}</div>
|
|
2532
2538
|
<div class="pc-bar-container">
|
|
2533
|
-
<div class="pc-bar" style="${
|
|
2539
|
+
<div class="pc-bar" style="${n}"></div>
|
|
2534
2540
|
<div class="pc-bar-value">${s.valueFormatter(i)}</div>
|
|
2535
2541
|
</div>
|
|
2536
2542
|
</div>
|
|
@@ -2539,7 +2545,7 @@ function It(e, t = {}) {
|
|
|
2539
2545
|
</div>
|
|
2540
2546
|
`;
|
|
2541
2547
|
}
|
|
2542
|
-
var zo = Object.defineProperty, Io = Object.getOwnPropertyDescriptor,
|
|
2548
|
+
var zo = Object.defineProperty, Io = Object.getOwnPropertyDescriptor, Y = (e, t, o, r) => {
|
|
2543
2549
|
for (var s = r > 1 ? void 0 : r ? Io(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
2544
2550
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
2545
2551
|
return r && s && zo(t, o, s), s;
|
|
@@ -2564,7 +2570,7 @@ let z = class extends m {
|
|
|
2564
2570
|
const i = this.dataController.isValueSelected(String(s)), a = {
|
|
2565
2571
|
"nps-button": !0,
|
|
2566
2572
|
selected: i
|
|
2567
|
-
},
|
|
2573
|
+
}, n = po(`Rate ${s}`, i, !1);
|
|
2568
2574
|
return d`
|
|
2569
2575
|
<button
|
|
2570
2576
|
data-testid="nps-button-${s}"
|
|
@@ -2578,7 +2584,7 @@ let z = class extends m {
|
|
|
2578
2584
|
@keydown="${this.handleKeyDown}"
|
|
2579
2585
|
tabindex="0"
|
|
2580
2586
|
id="${t}-option-${s}"
|
|
2581
|
-
...=${
|
|
2587
|
+
...=${n}
|
|
2582
2588
|
>
|
|
2583
2589
|
${s}
|
|
2584
2590
|
</button>
|
|
@@ -2608,13 +2614,13 @@ let z = class extends m {
|
|
|
2608
2614
|
renderChart() {
|
|
2609
2615
|
var a;
|
|
2610
2616
|
if (!this.displayController.shouldShowChart()) return u;
|
|
2611
|
-
const e = ((a = this.dataController.stats) == null ? void 0 : a.breakdown) || {}, t = Object.values(e).reduce((
|
|
2612
|
-
label:
|
|
2613
|
-
value:
|
|
2617
|
+
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]) => ({
|
|
2618
|
+
label: n,
|
|
2619
|
+
value: l
|
|
2614
2620
|
})), s = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", i = It(o, {
|
|
2615
2621
|
barColor: s,
|
|
2616
|
-
labelFormatter: (
|
|
2617
|
-
valueFormatter: (
|
|
2622
|
+
labelFormatter: (n) => `${n.label}`,
|
|
2623
|
+
valueFormatter: (n) => `${t > 0 ? Math.round(n.value / t * 100) : 0}%`
|
|
2618
2624
|
});
|
|
2619
2625
|
return d`
|
|
2620
2626
|
<div class="pc-stats-chart pc-stats-chart-inline visible" data-testid="stars-chart">
|
|
@@ -2655,11 +2661,11 @@ let z = class extends m {
|
|
|
2655
2661
|
render() {
|
|
2656
2662
|
const e = {
|
|
2657
2663
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
2658
|
-
[`pc-flex-align-${
|
|
2664
|
+
[`pc-flex-align-${A(this.questionPosition, this.questionAlign)}`]: !0
|
|
2659
2665
|
}, t = {
|
|
2660
2666
|
nps: !0,
|
|
2661
2667
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
2662
|
-
[`pc-flex-align-${
|
|
2668
|
+
[`pc-flex-align-${A(this.statsPosition, this.statsAlign)}`]: !0
|
|
2663
2669
|
};
|
|
2664
2670
|
return d`
|
|
2665
2671
|
<div class="pc-container ${v(e)}" data-testid="nps-container">
|
|
@@ -2673,25 +2679,25 @@ let z = class extends m {
|
|
|
2673
2679
|
}
|
|
2674
2680
|
};
|
|
2675
2681
|
z.styles = [...m.styles, dt, To];
|
|
2676
|
-
|
|
2682
|
+
Y([
|
|
2677
2683
|
f({ type: String, attribute: "min-label" })
|
|
2678
2684
|
], z.prototype, "minLabel", 2);
|
|
2679
|
-
|
|
2685
|
+
Y([
|
|
2680
2686
|
f({ type: String, attribute: "max-label" })
|
|
2681
2687
|
], z.prototype, "maxLabel", 2);
|
|
2682
|
-
|
|
2688
|
+
Y([
|
|
2683
2689
|
f({ type: String, attribute: "thank-you-msg" })
|
|
2684
2690
|
], z.prototype, "thankYouMsg", 2);
|
|
2685
|
-
|
|
2691
|
+
Y([
|
|
2686
2692
|
f({ type: String, attribute: "min-max-position" })
|
|
2687
2693
|
], z.prototype, "minMaxPosition", 2);
|
|
2688
|
-
|
|
2694
|
+
Y([
|
|
2689
2695
|
Pt()
|
|
2690
2696
|
], z.prototype, "hoverValue", 2);
|
|
2691
|
-
z =
|
|
2697
|
+
z = Y([
|
|
2692
2698
|
ot("pc-nps")
|
|
2693
2699
|
], z);
|
|
2694
|
-
const No =
|
|
2700
|
+
const No = F`
|
|
2695
2701
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
2696
2702
|
|
|
2697
2703
|
.pc-container {
|
|
@@ -2953,14 +2959,14 @@ var Mo = Object.defineProperty, Lo = Object.getOwnPropertyDescriptor, Nt = (e, t
|
|
|
2953
2959
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
2954
2960
|
return r && s && Mo(t, o, s), s;
|
|
2955
2961
|
};
|
|
2956
|
-
let
|
|
2962
|
+
let tt = class extends m {
|
|
2957
2963
|
constructor() {
|
|
2958
2964
|
super(), this.type = $.poll, this.multiple = !1, this.compact = !1, this.hasEditButton = !0, this.statsText = "{count} votes", this.questionPosition = "top", this.statsPosition = "bottom", this.showStats = "after-vote";
|
|
2959
2965
|
}
|
|
2960
2966
|
renderStatus() {
|
|
2961
2967
|
const t = {
|
|
2962
2968
|
"pc-status": !0,
|
|
2963
|
-
[`pc-flex-content-${
|
|
2969
|
+
[`pc-flex-content-${A("bottom", this.statsAlign)}`]: !0
|
|
2964
2970
|
};
|
|
2965
2971
|
return d`<div class="${v(t)}" data-testid="pc-status">
|
|
2966
2972
|
<span>${this.renderStatsText()} ${this.renderEditToggleIcon("stats-edit-button")}</span>
|
|
@@ -3048,7 +3054,7 @@ let Q = class extends m {
|
|
|
3048
3054
|
selected: o,
|
|
3049
3055
|
"poll-option--compact": this.compact,
|
|
3050
3056
|
"poll-option--disabled": r
|
|
3051
|
-
}, i = t + 1, a = `poll-${this.type}-${i}`,
|
|
3057
|
+
}, i = t + 1, a = `poll-${this.type}-${i}`, n = uo(
|
|
3052
3058
|
e.label,
|
|
3053
3059
|
o,
|
|
3054
3060
|
r,
|
|
@@ -3063,7 +3069,7 @@ let Q = class extends m {
|
|
|
3063
3069
|
?disabled="${r}"
|
|
3064
3070
|
id="${a}-option-${t}"
|
|
3065
3071
|
title="${e.tooltip || ""}"
|
|
3066
|
-
...=${
|
|
3072
|
+
...=${n}
|
|
3067
3073
|
>
|
|
3068
3074
|
<div class="poll-option-content">
|
|
3069
3075
|
${this.renderSelectionIndicator()} ${this.renderOptionIcon(e)}
|
|
@@ -3100,13 +3106,13 @@ let Q = class extends m {
|
|
|
3100
3106
|
* Render chart that replaces poll options when showing
|
|
3101
3107
|
*/
|
|
3102
3108
|
renderBarChart() {
|
|
3103
|
-
var
|
|
3104
|
-
const e = ((
|
|
3105
|
-
const
|
|
3109
|
+
var l, p;
|
|
3110
|
+
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 y = e[c.value] || 0, C = o > 0 ? Math.round(y / o * 100) : 0, L = (t[c.value] || 0) > 0;
|
|
3106
3112
|
return {
|
|
3107
3113
|
option: c,
|
|
3108
3114
|
index: h,
|
|
3109
|
-
voteCount:
|
|
3115
|
+
voteCount: y,
|
|
3110
3116
|
percentage: C,
|
|
3111
3117
|
isSelected: L
|
|
3112
3118
|
};
|
|
@@ -3190,10 +3196,10 @@ let Q = class extends m {
|
|
|
3190
3196
|
` : this.displayController.shouldShowChart() ? d`<div class="pc-section">${this.renderBarChart()}</div>` : d`<div class="pc-section">${this.renderPollOptions()}</div>`;
|
|
3191
3197
|
}
|
|
3192
3198
|
render() {
|
|
3193
|
-
const e =
|
|
3199
|
+
const e = A(this.questionPosition, this.questionAlign), t = {
|
|
3194
3200
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
3195
3201
|
[`pc-flex-align-${e}`]: !0
|
|
3196
|
-
}, o =
|
|
3202
|
+
}, o = A(this.statsPosition, this.statsAlign), r = {
|
|
3197
3203
|
"pc-body": !0,
|
|
3198
3204
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
3199
3205
|
[`pc-flex-align-${o}`]: !0
|
|
@@ -3216,17 +3222,17 @@ let Q = class extends m {
|
|
|
3216
3222
|
`;
|
|
3217
3223
|
}
|
|
3218
3224
|
};
|
|
3219
|
-
|
|
3225
|
+
tt.styles = [...m.styles, dt, No];
|
|
3220
3226
|
Nt([
|
|
3221
3227
|
f({ type: Boolean })
|
|
3222
|
-
],
|
|
3228
|
+
], tt.prototype, "multiple", 2);
|
|
3223
3229
|
Nt([
|
|
3224
3230
|
f({ type: Boolean })
|
|
3225
|
-
],
|
|
3226
|
-
|
|
3231
|
+
], tt.prototype, "compact", 2);
|
|
3232
|
+
tt = Nt([
|
|
3227
3233
|
ot("pc-poll")
|
|
3228
|
-
],
|
|
3229
|
-
const Ro =
|
|
3234
|
+
], tt);
|
|
3235
|
+
const Ro = F`
|
|
3230
3236
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
3231
3237
|
|
|
3232
3238
|
.pc-section {
|
|
@@ -3364,25 +3370,25 @@ let V = class extends m {
|
|
|
3364
3370
|
renderStars() {
|
|
3365
3371
|
var i, a;
|
|
3366
3372
|
if (this.displayController.shouldShowChart()) return u;
|
|
3367
|
-
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 }, (
|
|
3368
|
-
const
|
|
3373
|
+
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) => {
|
|
3374
|
+
const l = n <= Math.floor(o) || n <= (this.hoverValue || 0), p = !l && n === Math.ceil(o) && o % 1 !== 0, c = {
|
|
3369
3375
|
star: !0,
|
|
3370
|
-
selected:
|
|
3376
|
+
selected: l,
|
|
3371
3377
|
partial: p,
|
|
3372
3378
|
"view-mode": !r
|
|
3373
3379
|
}, h = p ? { "--partial-fill": `${o % 1 * 100}%` } : {};
|
|
3374
3380
|
return d`
|
|
3375
3381
|
<div class="pc-section" data-testid="pc-section">
|
|
3376
3382
|
<span
|
|
3377
|
-
data-testid="stars-view-star-${
|
|
3383
|
+
data-testid="stars-view-star-${n}"
|
|
3378
3384
|
class=${v(c)}
|
|
3379
3385
|
style=${jo(h)}
|
|
3380
3386
|
role="${r ? "button" : "presentation"}"
|
|
3381
3387
|
tabindex="${r ? "0" : ""}"
|
|
3382
|
-
aria-label="${r ? `Rate ${
|
|
3383
|
-
@click="${() => this.handleStarClick(
|
|
3384
|
-
@mouseenter="${() => this.handleStarHover(
|
|
3385
|
-
@focus="${() => this.handleStarHover(
|
|
3388
|
+
aria-label="${r ? `Rate ${n} star${n > 1 ? "s" : ""}` : ""}"
|
|
3389
|
+
@click="${() => this.handleStarClick(n)}"
|
|
3390
|
+
@mouseenter="${() => this.handleStarHover(n)}"
|
|
3391
|
+
@focus="${() => this.handleStarHover(n)}"
|
|
3386
3392
|
@mouseleave="${this.handleStarLeave}"
|
|
3387
3393
|
@blur="${this.handleStarLeave}"
|
|
3388
3394
|
@keydown="${this.handleStarKeyDown}"
|
|
@@ -3400,14 +3406,14 @@ let V = class extends m {
|
|
|
3400
3406
|
renderChart() {
|
|
3401
3407
|
var a;
|
|
3402
3408
|
if (!this.displayController.shouldShowChart()) return u;
|
|
3403
|
-
const e = ((a = this.dataController.stats) == null ? void 0 : a.breakdown) || {}, t = Object.values(e).reduce((
|
|
3404
|
-
label:
|
|
3405
|
-
value:
|
|
3409
|
+
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]) => ({
|
|
3410
|
+
label: n,
|
|
3411
|
+
value: l,
|
|
3406
3412
|
icon: "★"
|
|
3407
3413
|
})), s = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", i = It(o, {
|
|
3408
3414
|
barColor: s,
|
|
3409
|
-
labelFormatter: (
|
|
3410
|
-
valueFormatter: (
|
|
3415
|
+
labelFormatter: (n) => `${n.label} ${n.icon}`,
|
|
3416
|
+
valueFormatter: (n) => `${t > 0 ? Math.round(n.value / t * 100) : 0}%`
|
|
3411
3417
|
});
|
|
3412
3418
|
return d`
|
|
3413
3419
|
<div class="pc-stats-chart pc-stats-chart-inline visible" data-testid="stars-chart">
|
|
@@ -3416,10 +3422,10 @@ let V = class extends m {
|
|
|
3416
3422
|
`;
|
|
3417
3423
|
}
|
|
3418
3424
|
render() {
|
|
3419
|
-
const e =
|
|
3425
|
+
const e = A(this.questionPosition, this.questionAlign), t = {
|
|
3420
3426
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
3421
3427
|
[`pc-flex-align-${e}`]: !0
|
|
3422
|
-
}, o =
|
|
3428
|
+
}, o = A(this.statsPosition, this.statsAlign), r = {
|
|
3423
3429
|
"pc-body": !0,
|
|
3424
3430
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
3425
3431
|
[`pc-flex-align-${o}`]: !0
|
|
@@ -3449,7 +3455,7 @@ pt([
|
|
|
3449
3455
|
V = pt([
|
|
3450
3456
|
ot("pc-stars")
|
|
3451
3457
|
], V);
|
|
3452
|
-
const Vo =
|
|
3458
|
+
const Vo = F`
|
|
3453
3459
|
/* Adjust stats text for reactions */
|
|
3454
3460
|
.pc-stats-text {
|
|
3455
3461
|
font-size: var(--pc-font-size-small, var(--default-font-size-small));
|
|
@@ -3965,32 +3971,32 @@ let q = class extends m {
|
|
|
3965
3971
|
renderChart() {
|
|
3966
3972
|
if (!this.displayController.shouldShowChart()) return u;
|
|
3967
3973
|
const e = this.dataController.getBreakdownInfo(), o = Object.entries(e.breakdownCount).filter(
|
|
3968
|
-
([
|
|
3969
|
-
).map(([
|
|
3970
|
-
const c = this.options.find((h) => h.value ===
|
|
3974
|
+
([l, p]) => this.options.some((c) => c.value === l)
|
|
3975
|
+
).map(([l, p]) => {
|
|
3976
|
+
const c = this.options.find((h) => h.value === l);
|
|
3971
3977
|
return {
|
|
3972
|
-
label:
|
|
3978
|
+
label: l,
|
|
3973
3979
|
// Use the reaction value as label
|
|
3974
3980
|
value: p,
|
|
3975
|
-
icon: (c == null ? void 0 : c.icon) ||
|
|
3981
|
+
icon: (c == null ? void 0 : c.icon) || l
|
|
3976
3982
|
// Use the icon or fall back to reaction value
|
|
3977
3983
|
};
|
|
3978
|
-
}), r = getComputedStyle(this), s = r.getPropertyValue("--pc-primary-color").trim(), a = r.getPropertyValue("--pc-accent-color").trim() || s || "#ffc107",
|
|
3984
|
+
}), r = getComputedStyle(this), s = r.getPropertyValue("--pc-primary-color").trim(), a = r.getPropertyValue("--pc-accent-color").trim() || s || "#ffc107", n = It(o, {
|
|
3979
3985
|
barColor: a,
|
|
3980
|
-
labelFormatter: (
|
|
3981
|
-
valueFormatter: (
|
|
3986
|
+
labelFormatter: (l) => `${l.label}`,
|
|
3987
|
+
valueFormatter: (l) => `${e.totalCount > 0 ? Math.round(l.value / e.totalCount * 100) : 0}%`
|
|
3982
3988
|
});
|
|
3983
3989
|
return d`
|
|
3984
3990
|
<div class="pc-stats-chart pc-stats-chart-inline visible" data-testid="reaction-chart">
|
|
3985
|
-
<div class="pc-chart-container" data-testid="reaction-chart-container">${
|
|
3991
|
+
<div class="pc-chart-container" data-testid="reaction-chart-container">${n}</div>
|
|
3986
3992
|
</div>
|
|
3987
3993
|
`;
|
|
3988
3994
|
}
|
|
3989
3995
|
render() {
|
|
3990
|
-
const e =
|
|
3996
|
+
const e = A(this.questionPosition, this.questionAlign), t = {
|
|
3991
3997
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
3992
3998
|
[`pc-flex-align-${e}`]: !0
|
|
3993
|
-
}, o =
|
|
3999
|
+
}, o = A(this.statsPosition, this.statsAlign), r = {
|
|
3994
4000
|
"pc-body": !0,
|
|
3995
4001
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
3996
4002
|
[`pc-flex-align-${o}`]: !0
|
|
@@ -4020,7 +4026,7 @@ ut([
|
|
|
4020
4026
|
q = ut([
|
|
4021
4027
|
ot("pc-reaction")
|
|
4022
4028
|
], q);
|
|
4023
|
-
function
|
|
4029
|
+
function G(e, t, o = void 0) {
|
|
4024
4030
|
const r = e.getAttribute(t);
|
|
4025
4031
|
return r === null ? o : r == null ? void 0 : r.trim();
|
|
4026
4032
|
}
|
|
@@ -4028,14 +4034,30 @@ function Yo(e, t = void 0) {
|
|
|
4028
4034
|
const o = e.textContent;
|
|
4029
4035
|
return o === "" || o === null ? t : o == null ? void 0 : o.trim();
|
|
4030
4036
|
}
|
|
4031
|
-
var Zo = Object.defineProperty,
|
|
4032
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
4037
|
+
var Zo = Object.defineProperty, Go = Object.getOwnPropertyDescriptor, ht = (e, t, o, r) => {
|
|
4038
|
+
for (var s = r > 1 ? void 0 : r ? Go(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
4033
4039
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
4034
4040
|
return r && s && Zo(t, o, s), s;
|
|
4035
4041
|
};
|
|
4036
|
-
let
|
|
4042
|
+
let H = class extends j {
|
|
4037
4043
|
constructor() {
|
|
4038
|
-
super(
|
|
4044
|
+
super(), this.options = "", this.parsedOptions = [], H.injectGlobalStyle();
|
|
4045
|
+
}
|
|
4046
|
+
/**
|
|
4047
|
+
* Inject global style to hide poll-catch-option elements
|
|
4048
|
+
* This is necessary because poll-catch-option is not a web component,
|
|
4049
|
+
* just an unknown tag that browsers will render as inline elements
|
|
4050
|
+
*/
|
|
4051
|
+
static injectGlobalStyle() {
|
|
4052
|
+
const e = "poll-catch-global-style";
|
|
4053
|
+
if (document.getElementById(e))
|
|
4054
|
+
return;
|
|
4055
|
+
const t = document.createElement("style");
|
|
4056
|
+
t.id = e, t.textContent = `
|
|
4057
|
+
poll-catch-option {
|
|
4058
|
+
display: none;
|
|
4059
|
+
}
|
|
4060
|
+
`, document.head.appendChild(t);
|
|
4039
4061
|
}
|
|
4040
4062
|
/**
|
|
4041
4063
|
* Disable shadow DOM for PollCatch
|
|
@@ -4085,12 +4107,12 @@ let tt = class extends j {
|
|
|
4085
4107
|
// REACTION widget uses options for the icon
|
|
4086
4108
|
}));
|
|
4087
4109
|
t && t.length > 0 && (r = Array.from(t).map((s) => {
|
|
4088
|
-
const i =
|
|
4089
|
-
if (
|
|
4090
|
-
const h = Ce(
|
|
4110
|
+
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 };
|
|
4111
|
+
if (n !== void 0) {
|
|
4112
|
+
const h = Ce(n);
|
|
4091
4113
|
c.icon = h.icon;
|
|
4092
4114
|
}
|
|
4093
|
-
return
|
|
4115
|
+
return l !== void 0 && (c.tooltip = l), p !== void 0 && (c.disabled = !0), c;
|
|
4094
4116
|
})), this.parsedOptions = r;
|
|
4095
4117
|
}
|
|
4096
4118
|
/**
|
|
@@ -4115,16 +4137,16 @@ let tt = class extends j {
|
|
|
4115
4137
|
};
|
|
4116
4138
|
ht([
|
|
4117
4139
|
f({ type: String })
|
|
4118
|
-
],
|
|
4140
|
+
], H.prototype, "type", 2);
|
|
4119
4141
|
ht([
|
|
4120
4142
|
f({ type: String })
|
|
4121
|
-
],
|
|
4143
|
+
], H.prototype, "options", 2);
|
|
4122
4144
|
ht([
|
|
4123
4145
|
Pt()
|
|
4124
|
-
],
|
|
4125
|
-
|
|
4146
|
+
], H.prototype, "parsedOptions", 2);
|
|
4147
|
+
H = ht([
|
|
4126
4148
|
ot("poll-catch")
|
|
4127
|
-
],
|
|
4149
|
+
], H);
|
|
4128
4150
|
export {
|
|
4129
|
-
|
|
4151
|
+
H as PollCatch
|
|
4130
4152
|
};
|