pollcatch 2.0.2 → 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 +237 -177
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,33 +22,33 @@ 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
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
47
|
*/
|
|
48
|
-
const { is: _e, defineProperty: Ee, getOwnPropertyDescriptor: Pe, getOwnPropertyNames: Oe, getOwnPropertySymbols: Te, getPrototypeOf: ze } = Object, O = globalThis, Ut = O.trustedTypes,
|
|
48
|
+
const { is: _e, defineProperty: Ee, getOwnPropertyDescriptor: Pe, getOwnPropertyNames: Oe, getOwnPropertySymbols: Te, getPrototypeOf: ze } = Object, O = globalThis, Ut = O.trustedTypes, Ie = Ut ? Ut.emptyScript : "", ft = O.reactiveElementPolyfillSupport, K = (e, t) => e, at = { toAttribute(e, t) {
|
|
49
49
|
switch (t) {
|
|
50
50
|
case Boolean:
|
|
51
|
-
e = e ?
|
|
51
|
+
e = e ? Ie : null;
|
|
52
52
|
break;
|
|
53
53
|
case Object:
|
|
54
54
|
case Array:
|
|
@@ -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;
|
|
@@ -279,22 +279,22 @@ 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]`,
|
|
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(),
|
|
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
|
+
\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");
|
|
287
287
|
return Bt !== void 0 ? Bt.createHTML(t) : 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 =
|
|
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 ===
|
|
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
|
};
|
|
@@ -304,22 +304,22 @@ let Ct = class pe {
|
|
|
304
304
|
this.parts = [];
|
|
305
305
|
let i = 0, a = 0;
|
|
306
306
|
const n = t.length - 1, l = this.parts, [p, c] = Re(t, o);
|
|
307
|
-
if (this.el = pe.createElement(p, r),
|
|
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 =
|
|
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 });
|
|
@@ -339,7 +339,7 @@ function D(e, t, o = e, r) {
|
|
|
339
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 =
|
|
342
|
+
const i = Q(t) ? void 0 : t._$litDirective$;
|
|
343
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 {
|
|
@@ -354,16 +354,16 @@ let Ue = class {
|
|
|
354
354
|
}
|
|
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
|
-
|
|
358
|
-
let i =
|
|
357
|
+
N.currentNode = s;
|
|
358
|
+
let i = N.nextNode(), a = 0, n = 0, l = r[0];
|
|
359
359
|
for (; l !== void 0; ) {
|
|
360
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 !== (l == null ? void 0 : l.index) && (i =
|
|
364
|
+
a !== (l == null ? void 0 : l.index) && (i = N.nextNode(), a++);
|
|
365
365
|
}
|
|
366
|
-
return
|
|
366
|
+
return N.currentNode = M, s;
|
|
367
367
|
}
|
|
368
368
|
p(t) {
|
|
369
369
|
let o = 0;
|
|
@@ -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,7 +399,7 @@ class et {
|
|
|
399
399
|
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
400
400
|
}
|
|
401
401
|
_(t) {
|
|
402
|
-
this._$AH !== u &&
|
|
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;
|
|
@@ -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
451
|
const n = t;
|
|
452
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 = !
|
|
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
|
};
|
|
@@ -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
|
|
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) },
|
|
598
|
+
var x = /* @__PURE__ */ ((e) => (e.reaction = "reaction", e.stars = "stars", e.poll = "poll", e.text = "text", e.nps = "nps", e))(x || {});
|
|
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) }, 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,18 +621,18 @@ 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:
|
|
625
|
-
}, Kt = function(e) {
|
|
626
|
-
return { h: w(e.h), s: w(e.s), l: w(e.l), a: w(e.a, 3) };
|
|
624
|
+
return { h: ue(e.h), s: S(e.s, 0, 100), l: S(e.l, 0, 100), a: S(e.a) };
|
|
627
625
|
}, Gt = function(e) {
|
|
626
|
+
return { h: y(e.h), s: y(e.s), l: y(e.l), a: y(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 ? 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;
|
|
@@ -640,20 +640,20 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, k = 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 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
|
-
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 (!
|
|
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) {
|
|
@@ -665,13 +665,13 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, k = 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 =
|
|
669
|
-
return { h: o.h, s:
|
|
668
|
+
var o = J(e);
|
|
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
|
-
var o =
|
|
674
|
-
return { h: o.h, s: o.s, l:
|
|
673
|
+
var o = J(e);
|
|
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);
|
|
@@ -693,38 +693,38 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, k = 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: 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
|
-
var o =
|
|
723
|
-
return typeof t == "number" ?
|
|
722
|
+
var o = J(this.rgba);
|
|
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
|
}
|
|
@@ -1633,7 +1670,7 @@ const st = {
|
|
|
1633
1670
|
renderEditToggleIcon(t = "edit-toggle-button") {
|
|
1634
1671
|
return this.displayController.shouldShowEditButton() ? d`
|
|
1635
1672
|
<img
|
|
1636
|
-
src="${
|
|
1673
|
+
src="${Ge}"
|
|
1637
1674
|
alt="Edit vote"
|
|
1638
1675
|
class="edit-toggle-icon"
|
|
1639
1676
|
data-testid="${t}"
|
|
@@ -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,14 +1723,14 @@ 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">
|
|
1693
1730
|
<div class="pc-thank-you-msg" data-testid="thank-you-msg">
|
|
1694
1731
|
${t}
|
|
1695
1732
|
<img
|
|
1696
|
-
src="${
|
|
1733
|
+
src="${Ke}"
|
|
1697
1734
|
alt="Close"
|
|
1698
1735
|
class="thank-you-close-icon"
|
|
1699
1736
|
data-testid="close-thank-you-button"
|
|
@@ -1707,7 +1744,7 @@ const st = {
|
|
|
1707
1744
|
}
|
|
1708
1745
|
};
|
|
1709
1746
|
Mt.styles = [
|
|
1710
|
-
|
|
1747
|
+
F`
|
|
1711
1748
|
:host {
|
|
1712
1749
|
/* Default values for CSS variables - can be overridden by external :root or parent definitions */
|
|
1713
1750
|
--default-font-size-base: 1rem;
|
|
@@ -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");
|
|
@@ -1890,7 +1933,7 @@ g([
|
|
|
1890
1933
|
g([
|
|
1891
1934
|
f({ type: Boolean, attribute: "read-only" })
|
|
1892
1935
|
], m.prototype, "readOnly");
|
|
1893
|
-
const To =
|
|
1936
|
+
const To = F`
|
|
1894
1937
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
1895
1938
|
|
|
1896
1939
|
.pc-body {
|
|
@@ -2036,7 +2079,7 @@ const To = H`
|
|
|
2036
2079
|
}
|
|
2037
2080
|
|
|
2038
2081
|
/* Removed unused responsive styles for action buttons */
|
|
2039
|
-
`, dt =
|
|
2082
|
+
`, dt = F`
|
|
2040
2083
|
/* Default values for CSS variables - can be overridden by external :root or parent definitions */
|
|
2041
2084
|
:host {
|
|
2042
2085
|
--default-primary-color: #2196f3;
|
|
@@ -2516,7 +2559,7 @@ const To = H`
|
|
|
2516
2559
|
}
|
|
2517
2560
|
}
|
|
2518
2561
|
`;
|
|
2519
|
-
function
|
|
2562
|
+
function It(e, t = {}) {
|
|
2520
2563
|
if (!e || e.length === 0)
|
|
2521
2564
|
return d`<div class="pc-bar-chart pc-bar-chart--empty">No data available</div>`;
|
|
2522
2565
|
const o = Math.max(...e.map((i) => i.value)), s = { ...{
|
|
@@ -2545,14 +2588,14 @@ function Nt(e, t = {}) {
|
|
|
2545
2588
|
</div>
|
|
2546
2589
|
`;
|
|
2547
2590
|
}
|
|
2548
|
-
var zo = Object.defineProperty,
|
|
2549
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
2591
|
+
var zo = Object.defineProperty, Io = Object.getOwnPropertyDescriptor, Y = (e, t, o, r) => {
|
|
2592
|
+
for (var s = r > 1 ? void 0 : r ? Io(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
2550
2593
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
2551
2594
|
return r && s && zo(t, o, s), s;
|
|
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));
|
|
@@ -2617,7 +2660,7 @@ let z = class extends m {
|
|
|
2617
2660
|
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
2661
|
label: n,
|
|
2619
2662
|
value: l
|
|
2620
|
-
})), s = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", i =
|
|
2663
|
+
})), s = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", i = It(o, {
|
|
2621
2664
|
barColor: s,
|
|
2622
2665
|
labelFormatter: (n) => `${n.label}`,
|
|
2623
2666
|
valueFormatter: (n) => `${t > 0 ? Math.round(n.value / t * 100) : 0}%`
|
|
@@ -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">
|
|
@@ -2679,25 +2722,25 @@ let z = class extends m {
|
|
|
2679
2722
|
}
|
|
2680
2723
|
};
|
|
2681
2724
|
z.styles = [...m.styles, dt, To];
|
|
2682
|
-
|
|
2725
|
+
Y([
|
|
2683
2726
|
f({ type: String, attribute: "min-label" })
|
|
2684
2727
|
], z.prototype, "minLabel", 2);
|
|
2685
|
-
|
|
2728
|
+
Y([
|
|
2686
2729
|
f({ type: String, attribute: "max-label" })
|
|
2687
2730
|
], z.prototype, "maxLabel", 2);
|
|
2688
|
-
|
|
2731
|
+
Y([
|
|
2689
2732
|
f({ type: String, attribute: "thank-you-msg" })
|
|
2690
2733
|
], z.prototype, "thankYouMsg", 2);
|
|
2691
|
-
|
|
2734
|
+
Y([
|
|
2692
2735
|
f({ type: String, attribute: "min-max-position" })
|
|
2693
2736
|
], z.prototype, "minMaxPosition", 2);
|
|
2694
|
-
|
|
2737
|
+
Y([
|
|
2695
2738
|
Pt()
|
|
2696
2739
|
], z.prototype, "hoverValue", 2);
|
|
2697
|
-
z =
|
|
2740
|
+
z = Y([
|
|
2698
2741
|
ot("pc-nps")
|
|
2699
2742
|
], z);
|
|
2700
|
-
const
|
|
2743
|
+
const No = F`
|
|
2701
2744
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
2702
2745
|
|
|
2703
2746
|
.pc-container {
|
|
@@ -2954,19 +2997,19 @@ const Io = H`
|
|
|
2954
2997
|
visibility: hidden;
|
|
2955
2998
|
}
|
|
2956
2999
|
`;
|
|
2957
|
-
var Mo = Object.defineProperty, Lo = Object.getOwnPropertyDescriptor,
|
|
3000
|
+
var Mo = Object.defineProperty, Lo = Object.getOwnPropertyDescriptor, Nt = (e, t, o, r) => {
|
|
2958
3001
|
for (var s = r > 1 ? void 0 : r ? Lo(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
2959
3002
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
2960
3003
|
return r && s && Mo(t, o, s), s;
|
|
2961
3004
|
};
|
|
2962
|
-
let
|
|
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 Q = 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 Q = 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
|
|
@@ -3222,17 +3265,17 @@ let Q = class extends m {
|
|
|
3222
3265
|
`;
|
|
3223
3266
|
}
|
|
3224
3267
|
};
|
|
3225
|
-
|
|
3226
|
-
|
|
3268
|
+
tt.styles = [...m.styles, dt, No];
|
|
3269
|
+
Nt([
|
|
3227
3270
|
f({ type: Boolean })
|
|
3228
|
-
],
|
|
3229
|
-
|
|
3271
|
+
], tt.prototype, "multiple", 2);
|
|
3272
|
+
Nt([
|
|
3230
3273
|
f({ type: Boolean })
|
|
3231
|
-
],
|
|
3232
|
-
|
|
3274
|
+
], tt.prototype, "compact", 2);
|
|
3275
|
+
tt = Nt([
|
|
3233
3276
|
ot("pc-poll")
|
|
3234
|
-
],
|
|
3235
|
-
const Ro =
|
|
3277
|
+
], tt);
|
|
3278
|
+
const Ro = F`
|
|
3236
3279
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
3237
3280
|
|
|
3238
3281
|
.pc-section {
|
|
@@ -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");
|
|
@@ -3410,7 +3453,7 @@ let V = class extends m {
|
|
|
3410
3453
|
label: n,
|
|
3411
3454
|
value: l,
|
|
3412
3455
|
icon: "★"
|
|
3413
|
-
})), s = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", i =
|
|
3456
|
+
})), s = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", i = It(o, {
|
|
3414
3457
|
barColor: s,
|
|
3415
3458
|
labelFormatter: (n) => `${n.label} ${n.icon}`,
|
|
3416
3459
|
valueFormatter: (n) => `${t > 0 ? Math.round(n.value / t * 100) : 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
|
|
@@ -3455,7 +3498,7 @@ pt([
|
|
|
3455
3498
|
V = pt([
|
|
3456
3499
|
ot("pc-stars")
|
|
3457
3500
|
], V);
|
|
3458
|
-
const Vo =
|
|
3501
|
+
const Vo = F`
|
|
3459
3502
|
/* Adjust stats text for reactions */
|
|
3460
3503
|
.pc-stats-text {
|
|
3461
3504
|
font-size: var(--pc-font-size-small, var(--default-font-size-small));
|
|
@@ -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}
|
|
@@ -3981,7 +4025,7 @@ let q = class extends m {
|
|
|
3981
4025
|
icon: (c == null ? void 0 : c.icon) || l
|
|
3982
4026
|
// Use the icon or fall back to reaction value
|
|
3983
4027
|
};
|
|
3984
|
-
}), r = getComputedStyle(this), s = r.getPropertyValue("--pc-primary-color").trim(), a = r.getPropertyValue("--pc-accent-color").trim() || s || "#ffc107", n =
|
|
4028
|
+
}), r = getComputedStyle(this), s = r.getPropertyValue("--pc-primary-color").trim(), a = r.getPropertyValue("--pc-accent-color").trim() || s || "#ffc107", n = It(o, {
|
|
3985
4029
|
barColor: a,
|
|
3986
4030
|
labelFormatter: (l) => `${l.label}`,
|
|
3987
4031
|
valueFormatter: (l) => `${e.totalCount > 0 ? Math.round(l.value / e.totalCount * 100) : 0}%`
|
|
@@ -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
|
|
@@ -4026,7 +4070,7 @@ ut([
|
|
|
4026
4070
|
q = ut([
|
|
4027
4071
|
ot("pc-reaction")
|
|
4028
4072
|
], q);
|
|
4029
|
-
function
|
|
4073
|
+
function G(e, t, o = void 0) {
|
|
4030
4074
|
const r = e.getAttribute(t);
|
|
4031
4075
|
return r === null ? o : r == null ? void 0 : r.trim();
|
|
4032
4076
|
}
|
|
@@ -4034,14 +4078,30 @@ function Yo(e, t = void 0) {
|
|
|
4034
4078
|
const o = e.textContent;
|
|
4035
4079
|
return o === "" || o === null ? t : o == null ? void 0 : o.trim();
|
|
4036
4080
|
}
|
|
4037
|
-
var Zo = Object.defineProperty,
|
|
4038
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
4081
|
+
var Zo = Object.defineProperty, Go = Object.getOwnPropertyDescriptor, ht = (e, t, o, r) => {
|
|
4082
|
+
for (var s = r > 1 ? void 0 : r ? Go(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
4039
4083
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
4040
4084
|
return r && s && Zo(t, o, s), s;
|
|
4041
4085
|
};
|
|
4042
|
-
let
|
|
4086
|
+
let H = class extends j {
|
|
4043
4087
|
constructor() {
|
|
4044
|
-
super(
|
|
4088
|
+
super(), this.options = "", this.parsedOptions = [], H.injectGlobalStyle();
|
|
4089
|
+
}
|
|
4090
|
+
/**
|
|
4091
|
+
* Inject global style to hide poll-catch-option elements
|
|
4092
|
+
* This is necessary because poll-catch-option is not a web component,
|
|
4093
|
+
* just an unknown tag that browsers will render as inline elements
|
|
4094
|
+
*/
|
|
4095
|
+
static injectGlobalStyle() {
|
|
4096
|
+
const e = "poll-catch-global-style";
|
|
4097
|
+
if (document.getElementById(e))
|
|
4098
|
+
return;
|
|
4099
|
+
const t = document.createElement("style");
|
|
4100
|
+
t.id = e, t.textContent = `
|
|
4101
|
+
poll-catch-option {
|
|
4102
|
+
display: none;
|
|
4103
|
+
}
|
|
4104
|
+
`, document.head.appendChild(t);
|
|
4045
4105
|
}
|
|
4046
4106
|
/**
|
|
4047
4107
|
* Disable shadow DOM for PollCatch
|
|
@@ -4091,7 +4151,7 @@ let tt = class extends j {
|
|
|
4091
4151
|
// REACTION widget uses options for the icon
|
|
4092
4152
|
}));
|
|
4093
4153
|
t && t.length > 0 && (r = Array.from(t).map((s) => {
|
|
4094
|
-
const i =
|
|
4154
|
+
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 };
|
|
4095
4155
|
if (n !== void 0) {
|
|
4096
4156
|
const h = Ce(n);
|
|
4097
4157
|
c.icon = h.icon;
|
|
@@ -4104,13 +4164,13 @@ let tt = class extends j {
|
|
|
4104
4164
|
*/
|
|
4105
4165
|
render() {
|
|
4106
4166
|
switch (this.type) {
|
|
4107
|
-
case
|
|
4167
|
+
case x.nps:
|
|
4108
4168
|
return d`<pc-nps></pc-nps>`;
|
|
4109
|
-
case
|
|
4169
|
+
case x.poll:
|
|
4110
4170
|
return d`<pc-poll .options=${this.parsedOptions}></pc-poll>`;
|
|
4111
|
-
case
|
|
4171
|
+
case x.stars:
|
|
4112
4172
|
return d`<pc-stars></pc-stars>`;
|
|
4113
|
-
case
|
|
4173
|
+
case x.reaction:
|
|
4114
4174
|
return d`<pc-reaction .options=${this.parsedOptions}></pc-reaction>`;
|
|
4115
4175
|
default:
|
|
4116
4176
|
return console.warn(
|
|
@@ -4121,16 +4181,16 @@ let tt = class extends j {
|
|
|
4121
4181
|
};
|
|
4122
4182
|
ht([
|
|
4123
4183
|
f({ type: String })
|
|
4124
|
-
],
|
|
4184
|
+
], H.prototype, "type", 2);
|
|
4125
4185
|
ht([
|
|
4126
4186
|
f({ type: String })
|
|
4127
|
-
],
|
|
4187
|
+
], H.prototype, "options", 2);
|
|
4128
4188
|
ht([
|
|
4129
4189
|
Pt()
|
|
4130
|
-
],
|
|
4131
|
-
|
|
4190
|
+
], H.prototype, "parsedOptions", 2);
|
|
4191
|
+
H = ht([
|
|
4132
4192
|
ot("poll-catch")
|
|
4133
|
-
],
|
|
4193
|
+
], H);
|
|
4134
4194
|
export {
|
|
4135
|
-
|
|
4195
|
+
H as PollCatch
|
|
4136
4196
|
};
|