pollcatch 1.0.6 → 1.0.8
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/README.md +4 -4
- package/package.json +1 -1
- package/pc.js +340 -388
package/pc.js
CHANGED
|
@@ -22,14 +22,14 @@ let de = class {
|
|
|
22
22
|
return this.cssText;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const
|
|
25
|
+
const Pe = (e) => new de(typeof e == "string" ? e : e + "", void 0, At), B = (e, ...t) => {
|
|
26
26
|
const s = e.length === 1 ? e[0] : t.reduce((i, o, r) => i + ((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
|
})(o) + e[r + 1], e[0]);
|
|
31
31
|
return new de(s, e, At);
|
|
32
|
-
},
|
|
32
|
+
}, Me = (e, t) => {
|
|
33
33
|
if (Et) e.adoptedStyleSheets = t.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet);
|
|
34
34
|
else for (const s of t) {
|
|
35
35
|
const i = document.createElement("style"), o = pt.litNonce;
|
|
@@ -38,14 +38,14 @@ const Oe = (e) => new de(typeof e == "string" ? e : e + "", void 0, At), B = (e,
|
|
|
38
38
|
}, Dt = Et ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((t) => {
|
|
39
39
|
let s = "";
|
|
40
40
|
for (const i of t.cssRules) s += i.cssText;
|
|
41
|
-
return
|
|
41
|
+
return Pe(s);
|
|
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:
|
|
48
|
+
const { is: Oe, defineProperty: ze, getOwnPropertyDescriptor: Ne, getOwnPropertyNames: Re, getOwnPropertySymbols: Ie, getPrototypeOf: Ue } = Object, D = globalThis, Vt = D.trustedTypes, Le = Vt ? Vt.emptyScript : "", gt = D.reactiveElementPolyfillSupport, st = (e, t) => e, ht = { toAttribute(e, t) {
|
|
49
49
|
switch (t) {
|
|
50
50
|
case Boolean:
|
|
51
51
|
e = e ? Le : null;
|
|
@@ -73,7 +73,7 @@ const { is: Me, defineProperty: ze, getOwnPropertyDescriptor: Ne, getOwnProperty
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
return s;
|
|
76
|
-
} }, _t = (e, t) => !
|
|
76
|
+
} }, _t = (e, t) => !Oe(e, t), Ht = { attribute: !0, type: String, converter: ht, reflect: !1, hasChanged: _t };
|
|
77
77
|
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), D.litPropertyMetadata ?? (D.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
78
78
|
let J = class extends HTMLElement {
|
|
79
79
|
static addInitializer(t) {
|
|
@@ -112,7 +112,7 @@ let J = class extends HTMLElement {
|
|
|
112
112
|
static finalize() {
|
|
113
113
|
if (this.hasOwnProperty(st("finalized"))) return;
|
|
114
114
|
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(st("properties"))) {
|
|
115
|
-
const s = this.properties, i = [...
|
|
115
|
+
const s = this.properties, i = [...Re(s), ...Ie(s)];
|
|
116
116
|
for (const o of i) this.createProperty(o, s[o]);
|
|
117
117
|
}
|
|
118
118
|
const t = this[Symbol.metadata];
|
|
@@ -161,7 +161,7 @@ let J = class extends HTMLElement {
|
|
|
161
161
|
}
|
|
162
162
|
createRenderRoot() {
|
|
163
163
|
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
164
|
-
return
|
|
164
|
+
return Me(t, this.constructor.elementStyles), t;
|
|
165
165
|
}
|
|
166
166
|
connectedCallback() {
|
|
167
167
|
var t;
|
|
@@ -273,17 +273,17 @@ let J = class extends HTMLElement {
|
|
|
273
273
|
firstUpdated(t) {
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
|
-
J.elementStyles = [], J.shadowRootOptions = { mode: "open" }, J[st("elementProperties")] = /* @__PURE__ */ new Map(), J[st("finalized")] = /* @__PURE__ */ new Map(),
|
|
276
|
+
J.elementStyles = [], J.shadowRootOptions = { mode: "open" }, J[st("elementProperties")] = /* @__PURE__ */ new Map(), J[st("finalized")] = /* @__PURE__ */ new Map(), gt == null || gt({ ReactiveElement: J }), (D.reactiveElementVersions ?? (D.reactiveElementVersions = [])).push("2.0.4");
|
|
277
277
|
/**
|
|
278
278
|
* @license
|
|
279
279
|
* Copyright 2017 Google LLC
|
|
280
280
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
281
281
|
*/
|
|
282
|
-
const it = globalThis, ut = it.trustedTypes, Bt = ut ? ut.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, pe = "$lit$", j = `lit$${Math.random().toFixed(9).slice(2)}$`, he = "?" + j, je = `<${he}>`,
|
|
283
|
-
\f\r]`, et = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
284
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), Kt = /'/g, Yt = /"/g, ue = /^(?:script|style|textarea|title)$/i, Ve = (e) => (t, ...s) => ({ _$litType$: e, strings: t, values: s }), l = Ve(1), H = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), Gt = /* @__PURE__ */ new WeakMap(), Y =
|
|
282
|
+
const it = globalThis, ut = it.trustedTypes, Bt = ut ? ut.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, pe = "$lit$", j = `lit$${Math.random().toFixed(9).slice(2)}$`, he = "?" + j, je = `<${he}>`, Z = document, rt = () => Z.createComment(""), at = (e) => e === null || typeof e != "object" && typeof e != "function", Tt = Array.isArray, De = (e) => Tt(e) || typeof (e == null ? void 0 : e[Symbol.iterator]) == "function", ft = `[
|
|
283
|
+
\f\r]`, et = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, qt = /-->/g, Ft = />/g, K = RegExp(`>|${ft}(?:([^\\s"'>=/]+)(${ft}*=${ft}*(?:[^
|
|
284
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), Kt = /'/g, Yt = /"/g, ue = /^(?:script|style|textarea|title)$/i, Ve = (e) => (t, ...s) => ({ _$litType$: e, strings: t, values: s }), l = Ve(1), H = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), Gt = /* @__PURE__ */ new WeakMap(), Y = Z.createTreeWalker(Z, 129);
|
|
285
285
|
function me(e, t) {
|
|
286
|
-
if (!
|
|
286
|
+
if (!Tt(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 He = (e, t) => {
|
|
@@ -292,7 +292,7 @@ const He = (e, t) => {
|
|
|
292
292
|
for (let n = 0; n < s; n++) {
|
|
293
293
|
const c = e[n];
|
|
294
294
|
let h, m, b = -1, S = 0;
|
|
295
|
-
for (; S < c.length && (a.lastIndex = S, m = a.exec(c), m !== null); ) S = a.lastIndex, a === et ? m[1] === "!--" ? a =
|
|
295
|
+
for (; S < c.length && (a.lastIndex = S, m = a.exec(c), m !== null); ) S = a.lastIndex, a === et ? m[1] === "!--" ? a = qt : m[1] !== void 0 ? a = Ft : m[2] !== void 0 ? (ue.test(m[2]) && (o = RegExp("</" + m[2], "g")), a = K) : m[3] !== void 0 && (a = K) : a === K ? m[0] === ">" ? (a = o ?? et, b = -1) : m[1] === void 0 ? b = -2 : (b = a.lastIndex - m[2].length, h = m[1], a = m[3] === void 0 ? K : m[3] === '"' ? Yt : Kt) : a === Yt || a === Kt ? a = K : a === qt || a === Ft ? a = et : (a = K, o = void 0);
|
|
296
296
|
const L = a === K && e[n + 1].startsWith("/>") ? " " : "";
|
|
297
297
|
r += a === et ? c + je : b >= 0 ? (i.push(h), c.slice(0, b) + pe + c.slice(b) + j + L) : c + j + (b === -2 ? n : L);
|
|
298
298
|
}
|
|
@@ -312,7 +312,7 @@ let kt = class be {
|
|
|
312
312
|
if (o.nodeType === 1) {
|
|
313
313
|
if (o.hasAttributes()) for (const b of o.getAttributeNames()) if (b.endsWith(pe)) {
|
|
314
314
|
const S = m[a++], L = o.getAttribute(b).split(j), ct = /([.?@])?(.*)/.exec(S);
|
|
315
|
-
c.push({ type: 1, index: r, name: ct[2], strings: L, ctor: ct[1] === "." ?
|
|
315
|
+
c.push({ type: 1, index: r, name: ct[2], strings: L, ctor: ct[1] === "." ? qe : ct[1] === "?" ? Fe : ct[1] === "@" ? Ke : mt }), o.removeAttribute(b);
|
|
316
316
|
} else b.startsWith(j) && (c.push({ type: 6, index: r }), o.removeAttribute(b));
|
|
317
317
|
if (ue.test(o.tagName)) {
|
|
318
318
|
const b = o.textContent.split(j), S = b.length - 1;
|
|
@@ -331,7 +331,7 @@ let kt = class be {
|
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
static createElement(t, s) {
|
|
334
|
-
const i =
|
|
334
|
+
const i = Z.createElement("template");
|
|
335
335
|
return i.innerHTML = t, i;
|
|
336
336
|
}
|
|
337
337
|
};
|
|
@@ -353,7 +353,7 @@ let Be = class {
|
|
|
353
353
|
return this._$AM._$AU;
|
|
354
354
|
}
|
|
355
355
|
u(t) {
|
|
356
|
-
const { el: { content: s }, parts: i } = this._$AD, o = ((t == null ? void 0 : t.creationScope) ??
|
|
356
|
+
const { el: { content: s }, parts: i } = this._$AD, o = ((t == null ? void 0 : t.creationScope) ?? Z).importNode(s, !0);
|
|
357
357
|
Y.currentNode = o;
|
|
358
358
|
let r = Y.nextNode(), a = 0, n = 0, c = i[0];
|
|
359
359
|
for (; c !== void 0; ) {
|
|
@@ -363,7 +363,7 @@ let Be = class {
|
|
|
363
363
|
}
|
|
364
364
|
a !== (c == null ? void 0 : c.index) && (r = Y.nextNode(), a++);
|
|
365
365
|
}
|
|
366
|
-
return Y.currentNode =
|
|
366
|
+
return Y.currentNode = Z, o;
|
|
367
367
|
}
|
|
368
368
|
p(t) {
|
|
369
369
|
let s = 0;
|
|
@@ -399,7 +399,7 @@ class nt {
|
|
|
399
399
|
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
400
400
|
}
|
|
401
401
|
_(t) {
|
|
402
|
-
this._$AH !== d && at(this._$AH) ? this._$AA.nextSibling.data = t : this.T(
|
|
402
|
+
this._$AH !== d && at(this._$AH) ? this._$AA.nextSibling.data = t : this.T(Z.createTextNode(t)), this._$AH = t;
|
|
403
403
|
}
|
|
404
404
|
$(t) {
|
|
405
405
|
var r;
|
|
@@ -415,7 +415,7 @@ class nt {
|
|
|
415
415
|
return s === void 0 && Gt.set(t.strings, s = new kt(t)), s;
|
|
416
416
|
}
|
|
417
417
|
k(t) {
|
|
418
|
-
|
|
418
|
+
Tt(this._$AH) || (this._$AH = [], this._$AR());
|
|
419
419
|
const s = this._$AH;
|
|
420
420
|
let i, o = 0;
|
|
421
421
|
for (const r of t) o === s.length ? s.push(i = new nt(this.O(rt()), this.O(rt()), this, this.options)) : i = s[o], i._$AI(r), o++;
|
|
@@ -458,7 +458,7 @@ class mt {
|
|
|
458
458
|
t === d ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
let
|
|
461
|
+
let qe = class extends mt {
|
|
462
462
|
constructor() {
|
|
463
463
|
super(...arguments), this.type = 3;
|
|
464
464
|
}
|
|
@@ -466,7 +466,7 @@ let Fe = class extends mt {
|
|
|
466
466
|
this.element[this.name] = t === d ? void 0 : t;
|
|
467
467
|
}
|
|
468
468
|
};
|
|
469
|
-
class
|
|
469
|
+
class Fe extends mt {
|
|
470
470
|
constructor() {
|
|
471
471
|
super(...arguments), this.type = 4;
|
|
472
472
|
}
|
|
@@ -550,7 +550,7 @@ vt == null || vt({ LitElement: V });
|
|
|
550
550
|
* Copyright 2017 Google LLC
|
|
551
551
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
552
552
|
*/
|
|
553
|
-
const
|
|
553
|
+
const q = (e) => (t, s) => {
|
|
554
554
|
s !== void 0 ? s.addInitializer(() => {
|
|
555
555
|
customElements.define(e, t);
|
|
556
556
|
}) : customElements.define(e, t);
|
|
@@ -560,7 +560,7 @@ const F = (e) => (t, s) => {
|
|
|
560
560
|
* Copyright 2017 Google LLC
|
|
561
561
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
562
562
|
*/
|
|
563
|
-
const
|
|
563
|
+
const Ze = { attribute: !0, type: String, converter: ht, reflect: !1, hasChanged: _t }, We = (e = Ze, t, s) => {
|
|
564
564
|
const { kind: i, metadata: o } = s;
|
|
565
565
|
let r = globalThis.litPropertyMetadata.get(o);
|
|
566
566
|
if (r === void 0 && globalThis.litPropertyMetadata.set(o, r = /* @__PURE__ */ new Map()), r.set(s.name, e), i === "accessor") {
|
|
@@ -582,7 +582,7 @@ const We = { attribute: !0, type: String, converter: ht, reflect: !1, hasChanged
|
|
|
582
582
|
throw Error("Unsupported decorator location: " + i);
|
|
583
583
|
};
|
|
584
584
|
function p(e) {
|
|
585
|
-
return (t, s) => typeof s == "object" ?
|
|
585
|
+
return (t, s) => typeof s == "object" ? We(e, t, s) : ((i, o, r) => {
|
|
586
586
|
const a = o.hasOwnProperty(r);
|
|
587
587
|
return o.constructor.createProperty(r, a ? { ...i, wrapped: !0 } : i), a ? Object.getOwnPropertyDescriptor(o, r) : void 0;
|
|
588
588
|
})(e, t, s);
|
|
@@ -624,6 +624,7 @@ const Je = B`
|
|
|
624
624
|
--pc-bar-height: clamp(0.5em, 0.6em, 0.8em);
|
|
625
625
|
--pc-font-size-small: clamp(0.6em, 0.7em, 0.8em);
|
|
626
626
|
--pc-font-size-medium: clamp(0.8em, 0.9em, 1em);
|
|
627
|
+
--pc-font-size-large: clamp(1em, 1.1em, 1.2em);
|
|
627
628
|
}
|
|
628
629
|
|
|
629
630
|
.pc-container {
|
|
@@ -902,7 +903,64 @@ const Je = B`
|
|
|
902
903
|
padding: 0.2em 0;
|
|
903
904
|
}
|
|
904
905
|
}
|
|
905
|
-
|
|
906
|
+
|
|
907
|
+
.thank-you-msg {
|
|
908
|
+
font-size: 0.8em;
|
|
909
|
+
color: var(--pc-text-color, #333);
|
|
910
|
+
background: white;
|
|
911
|
+
padding: 1em 1.5em;
|
|
912
|
+
border-radius: var(--pc-border-radius, 0.375em);
|
|
913
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
914
|
+
border: 1px solid var(--pc-mute-color, #ddd);
|
|
915
|
+
max-width: 300px;
|
|
916
|
+
font-style: normal;
|
|
917
|
+
white-space: normal;
|
|
918
|
+
word-wrap: break-word;
|
|
919
|
+
overflow-wrap: break-word;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/* Unified thank you overlay section and overlay */
|
|
923
|
+
.pc-thank-you-section-with-overlay {
|
|
924
|
+
position: relative;
|
|
925
|
+
}
|
|
926
|
+
.pc-thank-you-overlay {
|
|
927
|
+
position: absolute;
|
|
928
|
+
top: 0;
|
|
929
|
+
left: 0;
|
|
930
|
+
right: 0;
|
|
931
|
+
bottom: 0;
|
|
932
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
933
|
+
backdrop-filter: blur(2px);
|
|
934
|
+
display: flex;
|
|
935
|
+
align-items: center;
|
|
936
|
+
justify-content: center;
|
|
937
|
+
z-index: 10;
|
|
938
|
+
animation: fadeInOverlay 0.3s ease-out;
|
|
939
|
+
}
|
|
940
|
+
@keyframes fadeInOverlay {
|
|
941
|
+
from {
|
|
942
|
+
opacity: 0;
|
|
943
|
+
backdrop-filter: blur(0px);
|
|
944
|
+
}
|
|
945
|
+
to {
|
|
946
|
+
opacity: 1;
|
|
947
|
+
backdrop-filter: blur(2px);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
.pc-thank-you-overlay .thank-you-msg {
|
|
951
|
+
animation: slideInUp 0.4s ease-out;
|
|
952
|
+
}
|
|
953
|
+
@keyframes slideInUp {
|
|
954
|
+
from {
|
|
955
|
+
transform: translateY(20px);
|
|
956
|
+
opacity: 0;
|
|
957
|
+
}
|
|
958
|
+
to {
|
|
959
|
+
transform: translateY(0);
|
|
960
|
+
opacity: 1;
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
`, ge = "https://jpxwfjorwcsrqraorpbj.supabase.co/functions/v1/data", Xe = "pc_session_id", Qe = 24 * 60 * 60 * 1e3;
|
|
906
964
|
function ts(e) {
|
|
907
965
|
return {
|
|
908
966
|
debug: (t, ...s) => {
|
|
@@ -916,27 +974,27 @@ function ts(e) {
|
|
|
916
974
|
}
|
|
917
975
|
};
|
|
918
976
|
}
|
|
919
|
-
const
|
|
920
|
-
function
|
|
921
|
-
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : (
|
|
977
|
+
const g = ts("Pollcatch");
|
|
978
|
+
function Zt() {
|
|
979
|
+
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : (g.warn("crypto.randomUUID not available, using fallback UUID generator"), "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
|
|
922
980
|
const t = Math.random() * 16 | 0;
|
|
923
981
|
return (e === "x" ? t : t & 3 | 8).toString(16);
|
|
924
982
|
}));
|
|
925
983
|
}
|
|
926
|
-
function
|
|
984
|
+
function Pt() {
|
|
927
985
|
const e = "test-local-storage";
|
|
928
986
|
try {
|
|
929
987
|
return localStorage.setItem(e, e), localStorage.removeItem(e), !0;
|
|
930
988
|
} catch {
|
|
931
|
-
return
|
|
989
|
+
return g.warn("localStorage not available, session ID will not persist"), !1;
|
|
932
990
|
}
|
|
933
991
|
}
|
|
934
|
-
function
|
|
992
|
+
function fe(e) {
|
|
935
993
|
try {
|
|
936
994
|
const t = localStorage.getItem(e);
|
|
937
995
|
return t ? JSON.parse(t) : void 0;
|
|
938
996
|
} catch (t) {
|
|
939
|
-
|
|
997
|
+
g.warn(`Failed to get item from localStorage: ${e}`, t);
|
|
940
998
|
return;
|
|
941
999
|
}
|
|
942
1000
|
}
|
|
@@ -944,54 +1002,54 @@ function ye(e, t) {
|
|
|
944
1002
|
try {
|
|
945
1003
|
return localStorage.setItem(e, JSON.stringify(t)), !0;
|
|
946
1004
|
} catch (s) {
|
|
947
|
-
return
|
|
1005
|
+
return g.warn(`Failed to set item in localStorage: ${e}`, s), !1;
|
|
948
1006
|
}
|
|
949
1007
|
}
|
|
950
1008
|
async function es() {
|
|
951
1009
|
if (typeof window < "u") {
|
|
952
1010
|
if (window.pcProject !== void 0)
|
|
953
|
-
return
|
|
1011
|
+
return g.debug("Found project key in global variable"), window.pcProject;
|
|
954
1012
|
const e = document.querySelectorAll("script[pc-project]");
|
|
955
1013
|
if (e.length > 0) {
|
|
956
1014
|
const t = e[e.length - 1], s = t == null ? void 0 : t.getAttribute("pc-project");
|
|
957
1015
|
if (s)
|
|
958
|
-
return
|
|
1016
|
+
return g.debug("Found project key in script tag attribute"), s;
|
|
959
1017
|
}
|
|
960
1018
|
}
|
|
961
|
-
|
|
1019
|
+
g.warn("No project key found in global variable or script tags");
|
|
962
1020
|
}
|
|
963
|
-
async function
|
|
1021
|
+
async function Wt() {
|
|
964
1022
|
const e = Xe, t = Qe;
|
|
965
|
-
if (
|
|
966
|
-
const s =
|
|
1023
|
+
if (Pt()) {
|
|
1024
|
+
const s = fe(e);
|
|
967
1025
|
if (s && s.id && s.timestamp && Date.now() - s.timestamp < t)
|
|
968
|
-
return
|
|
969
|
-
|
|
1026
|
+
return g.debug("Using existing session ID from localStorage"), s.id;
|
|
1027
|
+
g.debug(
|
|
970
1028
|
s ? "Session ID expired" : "No session ID found",
|
|
971
1029
|
"generating new one"
|
|
972
1030
|
);
|
|
973
|
-
const i =
|
|
1031
|
+
const i = Zt();
|
|
974
1032
|
return ye(e, {
|
|
975
1033
|
id: i,
|
|
976
1034
|
timestamp: Date.now()
|
|
977
|
-
}) ?
|
|
1035
|
+
}) ? g.debug("Generated and stored new session ID") : g.warn("Generated session ID but failed to store it"), i;
|
|
978
1036
|
} else {
|
|
979
|
-
const s =
|
|
980
|
-
return
|
|
1037
|
+
const s = Zt();
|
|
1038
|
+
return g.debug("Generated non-persistent session ID"), s;
|
|
981
1039
|
}
|
|
982
1040
|
}
|
|
983
1041
|
async function ss(e, t) {
|
|
984
1042
|
try {
|
|
985
1043
|
if (!e)
|
|
986
1044
|
throw new Error("Name parameter is required");
|
|
987
|
-
const s = `${
|
|
988
|
-
|
|
1045
|
+
const s = `${ge}/${encodeURIComponent(t)}/${encodeURIComponent(e)}`;
|
|
1046
|
+
g.debug(`Fetching stats for: ${e}`, { projectKey: t });
|
|
989
1047
|
const i = await fetch(s);
|
|
990
1048
|
if (!i.ok)
|
|
991
1049
|
throw new Error(`API request failed with status: ${i.status}`);
|
|
992
1050
|
const o = await i.json();
|
|
993
1051
|
if (!o.success)
|
|
994
|
-
throw
|
|
1052
|
+
throw g.error("Backend returned unsuccessful response", o), new Error("Backend returned unsuccessful response");
|
|
995
1053
|
const r = o.data || {}, a = r.count > 0 ? Math.round(r.sum / r.count) : 0, n = Math.round(r.sum / r.count * 100);
|
|
996
1054
|
return {
|
|
997
1055
|
count: r.count ?? 0,
|
|
@@ -1002,18 +1060,18 @@ async function ss(e, t) {
|
|
|
1002
1060
|
updated: r.updated_at || (/* @__PURE__ */ new Date()).toISOString()
|
|
1003
1061
|
};
|
|
1004
1062
|
} catch (s) {
|
|
1005
|
-
throw
|
|
1063
|
+
throw g.error("Error loading stats:", s), s;
|
|
1006
1064
|
}
|
|
1007
1065
|
}
|
|
1008
1066
|
async function is(e) {
|
|
1009
|
-
const t = JSON.stringify(e), s = `${
|
|
1067
|
+
const t = JSON.stringify(e), s = `${ge}`;
|
|
1010
1068
|
try {
|
|
1011
|
-
if (
|
|
1069
|
+
if (g.debug("Sending stats", e), typeof navigator < "u" && navigator.sendBeacon)
|
|
1012
1070
|
if (navigator.sendBeacon(s, t)) {
|
|
1013
|
-
|
|
1071
|
+
g.debug("Successfully sent stats via sendBeacon");
|
|
1014
1072
|
return;
|
|
1015
1073
|
} else
|
|
1016
|
-
|
|
1074
|
+
g.debug("sendBeacon failed, falling back to fetch");
|
|
1017
1075
|
const i = await fetch(s, {
|
|
1018
1076
|
body: t,
|
|
1019
1077
|
method: "POST",
|
|
@@ -1024,15 +1082,15 @@ async function is(e) {
|
|
|
1024
1082
|
});
|
|
1025
1083
|
if (!i.ok)
|
|
1026
1084
|
throw new Error(`API request failed with status: ${i.status}`);
|
|
1027
|
-
|
|
1085
|
+
g.debug("Successfully sent stats via fetch");
|
|
1028
1086
|
} catch (i) {
|
|
1029
|
-
throw
|
|
1087
|
+
throw g.error("Failed to send analytics:", i), i;
|
|
1030
1088
|
}
|
|
1031
1089
|
}
|
|
1032
1090
|
function ve(e) {
|
|
1033
1091
|
return !e || typeof e != "string" ? !1 : /^[\p{Emoji}]$/u.test(e) ? !0 : new RegExp("^\\p{Emoji}(\\p{Emoji_Modifier}|\\u200D\\p{Emoji})*$", "u").test(e);
|
|
1034
1092
|
}
|
|
1035
|
-
function
|
|
1093
|
+
function Mt(e) {
|
|
1036
1094
|
if (!e || typeof e != "string")
|
|
1037
1095
|
return !1;
|
|
1038
1096
|
const t = e.trim();
|
|
@@ -1073,7 +1131,7 @@ function as(e, t) {
|
|
|
1073
1131
|
s ^= i.charCodeAt(o), s += (s << 1) + (s << 4) + (s << 7) + (s << 8) + (s << 24);
|
|
1074
1132
|
return (s >>> 0).toString(16).padStart(8, "0");
|
|
1075
1133
|
}
|
|
1076
|
-
var ns = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) },
|
|
1134
|
+
var ns = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, R = function(e) {
|
|
1077
1135
|
return typeof e == "string" ? e.length > 0 : typeof e == "number";
|
|
1078
1136
|
}, x = function(e, t, s) {
|
|
1079
1137
|
return t === void 0 && (t = 0), s === void 0 && (s = Math.pow(10, t)), Math.round(s * e) / s + 0;
|
|
@@ -1119,15 +1177,15 @@ var ns = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, I = function(e) {
|
|
|
1119
1177
|
return te(o);
|
|
1120
1178
|
}, "hsl"]], object: [[function(e) {
|
|
1121
1179
|
var t = e.r, s = e.g, i = e.b, o = e.a, r = o === void 0 ? 1 : o;
|
|
1122
|
-
return
|
|
1180
|
+
return R(t) && R(s) && R(i) ? Jt({ r: Number(t), g: Number(s), b: Number(i), a: Number(r) }) : null;
|
|
1123
1181
|
}, "rgb"], [function(e) {
|
|
1124
1182
|
var t = e.h, s = e.s, i = e.l, o = e.a, r = o === void 0 ? 1 : o;
|
|
1125
|
-
if (!
|
|
1183
|
+
if (!R(t) || !R(s) || !R(i)) return null;
|
|
1126
1184
|
var a = Xt({ h: Number(t), s: Number(s), l: Number(i), a: Number(r) });
|
|
1127
1185
|
return te(a);
|
|
1128
1186
|
}, "hsl"], [function(e) {
|
|
1129
1187
|
var t = e.h, s = e.s, i = e.v, o = e.a, r = o === void 0 ? 1 : o;
|
|
1130
|
-
if (!
|
|
1188
|
+
if (!R(t) || !R(s) || !R(i)) return null;
|
|
1131
1189
|
var a = function(n) {
|
|
1132
1190
|
return { h: xe(n.h), s: k(n.s, 0, 100), v: k(n.v, 0, 100), a: k(n.a) };
|
|
1133
1191
|
}({ h: Number(t), s: Number(s), v: Number(i), a: Number(r) });
|
|
@@ -1229,7 +1287,7 @@ function St(e, t) {
|
|
|
1229
1287
|
return (o + 0.05) / (r + 0.05);
|
|
1230
1288
|
}
|
|
1231
1289
|
function re(e) {
|
|
1232
|
-
const t =
|
|
1290
|
+
const t = gs(e), s = t.r / 255, i = t.g / 255, o = t.b / 255, r = s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4), a = i <= 0.03928 ? i / 12.92 : Math.pow((i + 0.055) / 1.055, 2.4), n = o <= 0.03928 ? o / 12.92 : Math.pow((o + 0.055) / 1.055, 2.4);
|
|
1233
1291
|
return 0.2126 * r + 0.7152 * a + 0.0722 * n;
|
|
1234
1292
|
}
|
|
1235
1293
|
function ae(e, t = {}) {
|
|
@@ -1263,17 +1321,17 @@ function ae(e, t = {}) {
|
|
|
1263
1321
|
}
|
|
1264
1322
|
return c;
|
|
1265
1323
|
}
|
|
1266
|
-
function
|
|
1324
|
+
function gs(e) {
|
|
1267
1325
|
const s = bs(e) || e, i = _(s);
|
|
1268
1326
|
if (!i.isValid())
|
|
1269
1327
|
return console.warn(`Invalid color provided: ${e}`), { r: 0, g: 0, b: 0 };
|
|
1270
1328
|
const { r: o, g: r, b: a } = i.toRgb();
|
|
1271
1329
|
return { r: o, g: r, b: a };
|
|
1272
1330
|
}
|
|
1273
|
-
function
|
|
1331
|
+
function I(e, t) {
|
|
1274
1332
|
return e === "left" || e === "right" ? t || "center" : e === "top" || e === "bottom" ? t || "start" : t || "center";
|
|
1275
1333
|
}
|
|
1276
|
-
function
|
|
1334
|
+
function fs(e, t = "1rem") {
|
|
1277
1335
|
if (!e) return t;
|
|
1278
1336
|
const s = {
|
|
1279
1337
|
xs: "0.75rem",
|
|
@@ -1323,22 +1381,22 @@ function G() {
|
|
|
1323
1381
|
};
|
|
1324
1382
|
}
|
|
1325
1383
|
function vs(e) {
|
|
1326
|
-
if (!
|
|
1384
|
+
if (!Pt())
|
|
1327
1385
|
return G();
|
|
1328
1386
|
try {
|
|
1329
|
-
const t =
|
|
1387
|
+
const t = fe(e);
|
|
1330
1388
|
return t ? { ...G(), ...t } : G();
|
|
1331
1389
|
} catch (t) {
|
|
1332
|
-
return
|
|
1390
|
+
return g.warn("Failed to load localStats from localStorage", t), G();
|
|
1333
1391
|
}
|
|
1334
1392
|
}
|
|
1335
1393
|
function xs(e, t) {
|
|
1336
|
-
if (!
|
|
1394
|
+
if (!Pt())
|
|
1337
1395
|
return !1;
|
|
1338
1396
|
try {
|
|
1339
|
-
return ye(e, t) ? (
|
|
1397
|
+
return ye(e, t) ? (g.debug("Saved localStats to localStorage", t), !0) : !1;
|
|
1340
1398
|
} catch (s) {
|
|
1341
|
-
return
|
|
1399
|
+
return g.warn("Failed to save localStats to localStorage", s), !1;
|
|
1342
1400
|
}
|
|
1343
1401
|
}
|
|
1344
1402
|
function $s(e, t) {
|
|
@@ -1390,7 +1448,7 @@ function Ss(e) {
|
|
|
1390
1448
|
const o = t / i * 100, r = s / i * 100;
|
|
1391
1449
|
return Math.round(o - r);
|
|
1392
1450
|
}
|
|
1393
|
-
var ks = Object.defineProperty,
|
|
1451
|
+
var ks = Object.defineProperty, f = (e, t, s, i) => {
|
|
1394
1452
|
for (var o = void 0, r = e.length - 1, a; r >= 0; r--)
|
|
1395
1453
|
(a = e[r]) && (o = a(t, s, o) || o);
|
|
1396
1454
|
return o && ks(t, s, o), o;
|
|
@@ -1410,7 +1468,7 @@ const Lt = class Lt extends V {
|
|
|
1410
1468
|
* Gets the localStorage key for this widget's localStats
|
|
1411
1469
|
*/
|
|
1412
1470
|
async getLocalStatsKey() {
|
|
1413
|
-
const t = await
|
|
1471
|
+
const t = await Wt(), s = await this.getProjectKey(), i = this.name || "unnamed";
|
|
1414
1472
|
return `pc-local-stats-${t}-${s}-${i}`;
|
|
1415
1473
|
}
|
|
1416
1474
|
/**
|
|
@@ -1419,9 +1477,9 @@ const Lt = class Lt extends V {
|
|
|
1419
1477
|
async loadLocalStatsFromStorage() {
|
|
1420
1478
|
try {
|
|
1421
1479
|
const t = await this.getLocalStatsKey();
|
|
1422
|
-
this.localStats = vs(t),
|
|
1480
|
+
this.localStats = vs(t), g.debug("Loaded localStats from localStorage", this.localStats);
|
|
1423
1481
|
} catch (t) {
|
|
1424
|
-
|
|
1482
|
+
g.warn("Failed to generate localStorage key for localStats", t), this.localStats = G();
|
|
1425
1483
|
}
|
|
1426
1484
|
}
|
|
1427
1485
|
/**
|
|
@@ -1430,9 +1488,9 @@ const Lt = class Lt extends V {
|
|
|
1430
1488
|
async saveLocalStatsToStorage() {
|
|
1431
1489
|
try {
|
|
1432
1490
|
const t = await this.getLocalStatsKey();
|
|
1433
|
-
xs(t, this.localStats) ||
|
|
1491
|
+
xs(t, this.localStats) || g.warn("Failed to save localStats to localStorage");
|
|
1434
1492
|
} catch (t) {
|
|
1435
|
-
|
|
1493
|
+
g.warn("Failed to save localStats to localStorage", t);
|
|
1436
1494
|
}
|
|
1437
1495
|
}
|
|
1438
1496
|
/**
|
|
@@ -1457,7 +1515,7 @@ const Lt = class Lt extends V {
|
|
|
1457
1515
|
* Undo the stats with the localStats
|
|
1458
1516
|
*/
|
|
1459
1517
|
async submitStats(t, s) {
|
|
1460
|
-
const i = Math.floor(Date.now() / 1e3).toString(), o = await
|
|
1518
|
+
const i = Math.floor(Date.now() / 1e3).toString(), o = await Wt(), r = await this.getProjectKey(), a = this.name || "", n = {
|
|
1461
1519
|
sessionId: o,
|
|
1462
1520
|
projectId: r,
|
|
1463
1521
|
widgetName: a,
|
|
@@ -1471,7 +1529,7 @@ const Lt = class Lt extends V {
|
|
|
1471
1529
|
try {
|
|
1472
1530
|
is({ ...n, hash: c });
|
|
1473
1531
|
} catch (h) {
|
|
1474
|
-
|
|
1532
|
+
g.warn("Failed to send stats event", h);
|
|
1475
1533
|
}
|
|
1476
1534
|
return n;
|
|
1477
1535
|
}
|
|
@@ -1522,7 +1580,7 @@ const Lt = class Lt extends V {
|
|
|
1522
1580
|
}
|
|
1523
1581
|
if (this.textColor && (s += `--pc-text-color: ${this.textColor} !important;
|
|
1524
1582
|
`), this.size) {
|
|
1525
|
-
const i =
|
|
1583
|
+
const i = fs(this.size);
|
|
1526
1584
|
s += `font-size: ${i} !important;
|
|
1527
1585
|
`;
|
|
1528
1586
|
}
|
|
@@ -1539,7 +1597,7 @@ const Lt = class Lt extends V {
|
|
|
1539
1597
|
const t = await this.getProjectKey();
|
|
1540
1598
|
this.stats = await ss(this.name, t);
|
|
1541
1599
|
} catch (t) {
|
|
1542
|
-
|
|
1600
|
+
g.debug("Error loading stats", t), this.stats = void 0;
|
|
1543
1601
|
} finally {
|
|
1544
1602
|
this.statsIsLoading = !1;
|
|
1545
1603
|
}
|
|
@@ -1554,7 +1612,7 @@ const Lt = class Lt extends V {
|
|
|
1554
1612
|
const i = await this.submitStats(t, s);
|
|
1555
1613
|
this.dispatchEvent(new CustomEvent("change", { detail: i }));
|
|
1556
1614
|
} else
|
|
1557
|
-
|
|
1615
|
+
g.warn("Widget name is not set, skipping data submission.");
|
|
1558
1616
|
}
|
|
1559
1617
|
// Common rendering for label
|
|
1560
1618
|
renderLabel() {
|
|
@@ -1574,79 +1632,79 @@ const Lt = class Lt extends V {
|
|
|
1574
1632
|
};
|
|
1575
1633
|
Lt.styles = [Je];
|
|
1576
1634
|
let u = Lt;
|
|
1577
|
-
|
|
1635
|
+
f([
|
|
1578
1636
|
p({ type: Boolean, reflect: !0 })
|
|
1579
1637
|
], u.prototype, "readonly");
|
|
1580
|
-
|
|
1638
|
+
f([
|
|
1581
1639
|
p({ type: String, attribute: "project" })
|
|
1582
1640
|
], u.prototype, "projectKey");
|
|
1583
|
-
|
|
1641
|
+
f([
|
|
1584
1642
|
p({ type: String })
|
|
1585
1643
|
], u.prototype, "tags");
|
|
1586
|
-
|
|
1644
|
+
f([
|
|
1587
1645
|
p({ type: String })
|
|
1588
1646
|
], u.prototype, "name");
|
|
1589
|
-
|
|
1647
|
+
f([
|
|
1590
1648
|
p({ type: Boolean, attribute: "show-stats" })
|
|
1591
1649
|
], u.prototype, "showStats");
|
|
1592
|
-
|
|
1650
|
+
f([
|
|
1593
1651
|
p({ type: Boolean, attribute: "show-counts" })
|
|
1594
1652
|
], u.prototype, "showCounts");
|
|
1595
|
-
|
|
1653
|
+
f([
|
|
1596
1654
|
p({ type: Boolean, attribute: "show-chart" })
|
|
1597
1655
|
], u.prototype, "showChart");
|
|
1598
|
-
|
|
1656
|
+
f([
|
|
1599
1657
|
p({ type: String, attribute: "stats-text" })
|
|
1600
1658
|
], u.prototype, "statsText");
|
|
1601
|
-
|
|
1659
|
+
f([
|
|
1602
1660
|
p({ type: String, attribute: "stats-position" })
|
|
1603
1661
|
], u.prototype, "statsPosition");
|
|
1604
|
-
|
|
1662
|
+
f([
|
|
1605
1663
|
p({ type: String, attribute: "stats-align" })
|
|
1606
1664
|
], u.prototype, "statsAlign");
|
|
1607
|
-
|
|
1665
|
+
f([
|
|
1608
1666
|
p({ type: String })
|
|
1609
1667
|
], u.prototype, "icon");
|
|
1610
|
-
|
|
1668
|
+
f([
|
|
1611
1669
|
p({ type: String, attribute: "icon-active" })
|
|
1612
1670
|
], u.prototype, "iconActive");
|
|
1613
|
-
|
|
1671
|
+
f([
|
|
1614
1672
|
p({ type: String, attribute: "primary-color" })
|
|
1615
1673
|
], u.prototype, "primaryColor");
|
|
1616
|
-
|
|
1674
|
+
f([
|
|
1617
1675
|
p({ type: String, attribute: "mute-color" })
|
|
1618
1676
|
], u.prototype, "muteColor");
|
|
1619
|
-
|
|
1677
|
+
f([
|
|
1620
1678
|
p({ type: String, attribute: "text-color" })
|
|
1621
1679
|
], u.prototype, "textColor");
|
|
1622
|
-
|
|
1680
|
+
f([
|
|
1623
1681
|
p({ type: String })
|
|
1624
1682
|
], u.prototype, "size");
|
|
1625
|
-
|
|
1683
|
+
f([
|
|
1626
1684
|
p({ type: String, attribute: "button-radius" })
|
|
1627
1685
|
], u.prototype, "buttonRadius");
|
|
1628
|
-
|
|
1686
|
+
f([
|
|
1629
1687
|
p({ type: Number, attribute: "min-contrast" })
|
|
1630
1688
|
], u.prototype, "minContrast");
|
|
1631
|
-
|
|
1689
|
+
f([
|
|
1632
1690
|
p({ type: String })
|
|
1633
1691
|
], u.prototype, "css");
|
|
1634
|
-
|
|
1692
|
+
f([
|
|
1635
1693
|
p({ type: String })
|
|
1636
1694
|
], u.prototype, "label");
|
|
1637
|
-
|
|
1695
|
+
f([
|
|
1638
1696
|
p({ type: String, attribute: "label-position" })
|
|
1639
1697
|
], u.prototype, "labelPosition");
|
|
1640
|
-
|
|
1698
|
+
f([
|
|
1641
1699
|
p({ type: String, attribute: "label-align" })
|
|
1642
1700
|
], u.prototype, "labelAlign");
|
|
1643
|
-
|
|
1701
|
+
f([
|
|
1644
1702
|
y()
|
|
1645
1703
|
], u.prototype, "statsIsLoading");
|
|
1646
|
-
|
|
1704
|
+
f([
|
|
1647
1705
|
y()
|
|
1648
1706
|
], u.prototype, "stats");
|
|
1649
|
-
|
|
1707
|
+
f([
|
|
1650
1708
|
y()
|
|
1651
1709
|
], u.prototype, "localStats");
|
|
1652
1710
|
const Cs = B`
|
|
@@ -1689,7 +1747,7 @@ const Cs = B`
|
|
|
1689
1747
|
gap: 0.5em;
|
|
1690
1748
|
}
|
|
1691
1749
|
|
|
1692
|
-
.thank-you-msg {
|
|
1750
|
+
.nps-thank-you-msg {
|
|
1693
1751
|
font-size: 0.8em;
|
|
1694
1752
|
color: var(--pc-text-color, #666);
|
|
1695
1753
|
font-style: italic;
|
|
@@ -1943,7 +2001,7 @@ const v = Ce(class extends Ee {
|
|
|
1943
2001
|
return H;
|
|
1944
2002
|
}
|
|
1945
2003
|
});
|
|
1946
|
-
function
|
|
2004
|
+
function Ot(e, t = {}) {
|
|
1947
2005
|
if (!e || e.length === 0)
|
|
1948
2006
|
return l`<div class="pc-bar-chart pc-bar-chart--empty">No data available</div>`;
|
|
1949
2007
|
const s = Math.max(...e.map((r) => r.value)), o = { ...{
|
|
@@ -1976,7 +2034,7 @@ function Mt(e, t = {}) {
|
|
|
1976
2034
|
`;
|
|
1977
2035
|
}
|
|
1978
2036
|
const lt = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='20'%20height='5'%20viewBox='0%200%2020%205'%20fill='currentColor'%3e%3ccircle%20cx='3'%20cy='2.5'%20r='1.5'%20opacity='0.3'%3e%3canimate%20attributeName='opacity'%20begin='0s'%20dur='1s'%20values='0.3;0.8;0.3'%20repeatCount='indefinite'/%3e%3c/circle%3e%3ccircle%20cx='10'%20cy='2.5'%20r='1.5'%20opacity='0.3'%3e%3canimate%20attributeName='opacity'%20begin='0.2s'%20dur='1s'%20values='0.3;0.8;0.3'%20repeatCount='indefinite'/%3e%3c/circle%3e%3ccircle%20cx='17'%20cy='2.5'%20r='1.5'%20opacity='0.3'%3e%3canimate%20attributeName='opacity'%20begin='0.4s'%20dur='1s'%20values='0.3;0.8;0.3'%20repeatCount='indefinite'/%3e%3c/circle%3e%3c/svg%3e", bt = "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", zt = "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", Nt = "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";
|
|
1979
|
-
var
|
|
2037
|
+
var Rt = /* @__PURE__ */ ((e) => (e.DECORATIVE = "decorative", e.FUNCTIONAL = "functional", e.STATUS = "status", e))(Rt || {});
|
|
1980
2038
|
function Ae(e, t = {}) {
|
|
1981
2039
|
const {
|
|
1982
2040
|
type: s = "functional",
|
|
@@ -1992,14 +2050,14 @@ function Ae(e, t = {}) {
|
|
|
1992
2050
|
s === "functional" && !i && !o && console.warn(
|
|
1993
2051
|
`No alt text or aria-label provided for functional icon in ${a}. This may cause accessibility issues.`
|
|
1994
2052
|
);
|
|
1995
|
-
const n = r ? " (selected)" : "", c =
|
|
2053
|
+
const n = r ? " (selected)" : "", c = Mt(e) && !i ? "" : i || e, h = o || (c ? `${c}${n}` : n);
|
|
1996
2054
|
return {
|
|
1997
2055
|
alt: c,
|
|
1998
2056
|
ariaLabel: h,
|
|
1999
2057
|
ariaHidden: !1
|
|
2000
2058
|
};
|
|
2001
2059
|
}
|
|
2002
|
-
function
|
|
2060
|
+
function It(e, t = "polite") {
|
|
2003
2061
|
let s = document.getElementById("screen-reader-announcer");
|
|
2004
2062
|
s ? s.setAttribute("aria-live", t) : (s = document.createElement("div"), s.id = "screen-reader-announcer", s.setAttribute("aria-live", t), s.setAttribute("role", "status"), s.setAttribute("aria-atomic", "true"), s.style.position = "absolute", s.style.width = "1px", s.style.height = "1px", s.style.margin = "-1px", s.style.padding = "0", s.style.overflow = "hidden", s.style.clip = "rect(0, 0, 0, 0)", s.style.whiteSpace = "nowrap", s.style.border = "0", document.body.appendChild(s)), s.textContent = "", setTimeout(() => {
|
|
2005
2063
|
s.textContent = e;
|
|
@@ -2009,7 +2067,7 @@ function Ut(e, t) {
|
|
|
2009
2067
|
return `${e}: ${t}`;
|
|
2010
2068
|
}
|
|
2011
2069
|
var w = /* @__PURE__ */ ((e) => (e.BUTTON = "button", e.CHECKBOX = "checkbox", e.RADIO = "radio", e.RADIOGROUP = "radiogroup", e.SWITCH = "switch", e.TAB = "tab", e.TABLIST = "tablist", e.TABPANEL = "tabpanel", e.MENU = "menu", e.MENUITEM = "menuitem", e.MENUITEMCHECKBOX = "menuitemcheckbox", e.MENUITEMRADIO = "menuitemradio", e.SLIDER = "slider", e.TEXTBOX = "textbox", e.COMBOBOX = "combobox", e.LISTBOX = "listbox", e.OPTION = "option", e.PROGRESSBAR = "progressbar", e.STATUS = "status", e.ALERT = "alert", e.DIALOG = "dialog", e.GROUP = "group", e.REGION = "region", e.NONE = "none", e.PRESENTATION = "presentation", e))(w || {});
|
|
2012
|
-
function
|
|
2070
|
+
function P(e) {
|
|
2013
2071
|
const t = {};
|
|
2014
2072
|
e.role !== void 0 && (t.role = e.role);
|
|
2015
2073
|
for (const [s, i] of Object.entries(e)) {
|
|
@@ -2020,7 +2078,7 @@ function O(e) {
|
|
|
2020
2078
|
return t;
|
|
2021
2079
|
}
|
|
2022
2080
|
function Es(e, t, s) {
|
|
2023
|
-
return
|
|
2081
|
+
return P({
|
|
2024
2082
|
role: "button",
|
|
2025
2083
|
ariaLabel: e,
|
|
2026
2084
|
ariaPressed: t,
|
|
@@ -2028,19 +2086,19 @@ function Es(e, t, s) {
|
|
|
2028
2086
|
});
|
|
2029
2087
|
}
|
|
2030
2088
|
function ne(e, t, s, i = !1) {
|
|
2031
|
-
return
|
|
2089
|
+
return P({
|
|
2032
2090
|
role: i ? "radio" : "checkbox",
|
|
2033
2091
|
ariaLabel: e,
|
|
2034
2092
|
ariaChecked: t,
|
|
2035
2093
|
ariaDisabled: s
|
|
2036
2094
|
});
|
|
2037
2095
|
}
|
|
2038
|
-
var As = Object.defineProperty, _s = Object.getOwnPropertyDescriptor,
|
|
2096
|
+
var As = Object.defineProperty, _s = Object.getOwnPropertyDescriptor, F = (e, t, s, i) => {
|
|
2039
2097
|
for (var o = i > 1 ? void 0 : i ? _s(t, s) : t, r = e.length - 1, a; r >= 0; r--)
|
|
2040
2098
|
(a = e[r]) && (o = (i ? a(t, s, o) : a(o)) || o);
|
|
2041
2099
|
return i && o && As(t, s, o), o;
|
|
2042
2100
|
};
|
|
2043
|
-
let
|
|
2101
|
+
let M = class extends u {
|
|
2044
2102
|
constructor() {
|
|
2045
2103
|
super(), this.min = 0, this.max = 10, this.minLabel = "Not at all", this.maxLabel = "Extremely", this.thankYouMsg = "Thank you for sharing your feedback!", this.minMaxPosition = "top", this.isChartVisible = !1, this.isEditMode = !0, this.hoverValue = -1, this.handleChartToggleKeyDown = (e) => {
|
|
2046
2104
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.toggleChart());
|
|
@@ -2089,7 +2147,7 @@ let T = class extends u {
|
|
|
2089
2147
|
* Render NPS buttons for edit mode
|
|
2090
2148
|
*/
|
|
2091
2149
|
renderEditNps() {
|
|
2092
|
-
const e = this.getCurrentScore(), t = this.hasUserScore(), s = Array.from({ length: this.max - this.min + 1 }, (a, n) => n + this.min), i = `nps-control-${this.name || this.widgetType}`, o =
|
|
2150
|
+
const e = this.getCurrentScore(), t = this.hasUserScore(), s = Array.from({ length: this.max - this.min + 1 }, (a, n) => n + this.min), i = `nps-control-${this.name || this.widgetType}`, o = P({
|
|
2093
2151
|
role: w.GROUP,
|
|
2094
2152
|
ariaLabel: this.label || "NPS Rating",
|
|
2095
2153
|
ariaDescribedby: `${i}-description`
|
|
@@ -2140,7 +2198,7 @@ let T = class extends u {
|
|
|
2140
2198
|
"nps-button": !0,
|
|
2141
2199
|
selected: !0,
|
|
2142
2200
|
"view-mode": !0
|
|
2143
|
-
}, i =
|
|
2201
|
+
}, i = P({
|
|
2144
2202
|
role: w.PRESENTATION
|
|
2145
2203
|
}), o = l`
|
|
2146
2204
|
<button
|
|
@@ -2168,11 +2226,11 @@ let T = class extends u {
|
|
|
2168
2226
|
label: c,
|
|
2169
2227
|
value: h
|
|
2170
2228
|
})
|
|
2171
|
-
), o = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", r =
|
|
2229
|
+
), o = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", r = Ot(s, {
|
|
2172
2230
|
barColor: o,
|
|
2173
2231
|
labelFormatter: (c) => `${c}`,
|
|
2174
2232
|
valueFormatter: (c) => `${t > 0 ? Math.round(c / t * 100) : 0}%`
|
|
2175
|
-
}), a =
|
|
2233
|
+
}), a = P({
|
|
2176
2234
|
role: w.REGION,
|
|
2177
2235
|
ariaLabel: `Results chart for ${this.label || "NPS Rating"}`
|
|
2178
2236
|
});
|
|
@@ -2231,7 +2289,7 @@ let T = class extends u {
|
|
|
2231
2289
|
const e = this.hasUserScore(), t = e ? "Edit rating" : "Add rating";
|
|
2232
2290
|
return l`
|
|
2233
2291
|
<div class="action-button-container">
|
|
2234
|
-
${e ? l`<span class="thank-you-msg" data-testid="nps-thank-you-msg"
|
|
2292
|
+
${e ? l`<span class="nps-thank-you-msg" data-testid="nps-thank-you-msg"
|
|
2235
2293
|
>${this.thankYouMsg}</span
|
|
2236
2294
|
>` : d}
|
|
2237
2295
|
<button
|
|
@@ -2258,7 +2316,7 @@ let T = class extends u {
|
|
|
2258
2316
|
if (this.readonly) return;
|
|
2259
2317
|
this.hoverValue = -1;
|
|
2260
2318
|
const t = this.label || "NPS", s = `Rated ${e} out of ${this.max}`;
|
|
2261
|
-
|
|
2319
|
+
It(Ut(t, s)), await this.handleChange(e, [String(e)]), this.isEditMode = !1;
|
|
2262
2320
|
}
|
|
2263
2321
|
/**
|
|
2264
2322
|
* Render min/max labels
|
|
@@ -2293,14 +2351,14 @@ let T = class extends u {
|
|
|
2293
2351
|
render() {
|
|
2294
2352
|
const e = {
|
|
2295
2353
|
[`pc-flex-pos-${this.labelPosition}`]: !0,
|
|
2296
|
-
[`pc-flex-align-${
|
|
2354
|
+
[`pc-flex-align-${I(this.labelPosition, this.labelAlign)}`]: !0,
|
|
2297
2355
|
"edit-mode": this.isEditMode,
|
|
2298
2356
|
"view-mode": !this.isEditMode
|
|
2299
2357
|
}, t = {
|
|
2300
2358
|
nps: !0,
|
|
2301
2359
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
2302
|
-
[`pc-flex-align-${
|
|
2303
|
-
}, s =
|
|
2360
|
+
[`pc-flex-align-${I(this.statsPosition, this.statsAlign)}`]: !0
|
|
2361
|
+
}, s = P({
|
|
2304
2362
|
role: w.REGION,
|
|
2305
2363
|
ariaLabel: this.label || "NPS Rating"
|
|
2306
2364
|
});
|
|
@@ -2320,32 +2378,32 @@ let T = class extends u {
|
|
|
2320
2378
|
`;
|
|
2321
2379
|
}
|
|
2322
2380
|
};
|
|
2323
|
-
|
|
2324
|
-
|
|
2381
|
+
M.styles = [...u.styles, Cs];
|
|
2382
|
+
F([
|
|
2325
2383
|
p({ type: String, attribute: "min-label" })
|
|
2326
|
-
],
|
|
2327
|
-
|
|
2384
|
+
], M.prototype, "minLabel", 2);
|
|
2385
|
+
F([
|
|
2328
2386
|
p({ type: String, attribute: "max-label" })
|
|
2329
|
-
],
|
|
2330
|
-
|
|
2387
|
+
], M.prototype, "maxLabel", 2);
|
|
2388
|
+
F([
|
|
2331
2389
|
p({ type: String, attribute: "thank-you-msg" })
|
|
2332
|
-
],
|
|
2333
|
-
|
|
2390
|
+
], M.prototype, "thankYouMsg", 2);
|
|
2391
|
+
F([
|
|
2334
2392
|
p({ type: String, attribute: "min-max-position" })
|
|
2335
|
-
],
|
|
2336
|
-
|
|
2393
|
+
], M.prototype, "minMaxPosition", 2);
|
|
2394
|
+
F([
|
|
2337
2395
|
y()
|
|
2338
|
-
],
|
|
2339
|
-
|
|
2396
|
+
], M.prototype, "isChartVisible", 2);
|
|
2397
|
+
F([
|
|
2340
2398
|
y()
|
|
2341
|
-
],
|
|
2342
|
-
|
|
2399
|
+
], M.prototype, "isEditMode", 2);
|
|
2400
|
+
F([
|
|
2343
2401
|
y()
|
|
2344
|
-
],
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
],
|
|
2348
|
-
const
|
|
2402
|
+
], M.prototype, "hoverValue", 2);
|
|
2403
|
+
M = F([
|
|
2404
|
+
q("pc-nps")
|
|
2405
|
+
], M);
|
|
2406
|
+
const Ts = B`
|
|
2349
2407
|
/* Add responsive sizing with CSS variables */
|
|
2350
2408
|
:host {
|
|
2351
2409
|
--pc-checkbox-size: clamp(1em, calc(0.8em + 0.3vw), 1.4em);
|
|
@@ -2648,17 +2706,6 @@ const Ps = B`
|
|
|
2648
2706
|
text-align: center;
|
|
2649
2707
|
}
|
|
2650
2708
|
|
|
2651
|
-
.thank-you-msg {
|
|
2652
|
-
font-size: 1em;
|
|
2653
|
-
color: var(--pc-text-color, #333);
|
|
2654
|
-
background: white;
|
|
2655
|
-
padding: 1em 1.5em;
|
|
2656
|
-
border-radius: var(--pc-border-radius, 0.375em);
|
|
2657
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
2658
|
-
border: 1px solid var(--pc-mute-color, #ddd);
|
|
2659
|
-
max-width: 300px;
|
|
2660
|
-
}
|
|
2661
|
-
|
|
2662
2709
|
/* Edit toggle icon styles */
|
|
2663
2710
|
.edit-toggle-icon {
|
|
2664
2711
|
width: 1em;
|
|
@@ -2715,52 +2762,6 @@ const Ps = B`
|
|
|
2715
2762
|
}
|
|
2716
2763
|
}
|
|
2717
2764
|
|
|
2718
|
-
/* Overlay styles */
|
|
2719
|
-
.poll-section-with-overlay {
|
|
2720
|
-
position: relative;
|
|
2721
|
-
}
|
|
2722
|
-
|
|
2723
|
-
.poll-thank-you-overlay {
|
|
2724
|
-
position: absolute;
|
|
2725
|
-
top: 0;
|
|
2726
|
-
left: 0;
|
|
2727
|
-
right: 0;
|
|
2728
|
-
bottom: 0;
|
|
2729
|
-
background-color: rgba(255, 255, 255, 0.2);
|
|
2730
|
-
backdrop-filter: blur(2px);
|
|
2731
|
-
display: flex;
|
|
2732
|
-
align-items: center;
|
|
2733
|
-
justify-content: center;
|
|
2734
|
-
z-index: 10;
|
|
2735
|
-
animation: fadeInOverlay 0.3s ease-out;
|
|
2736
|
-
}
|
|
2737
|
-
|
|
2738
|
-
@keyframes fadeInOverlay {
|
|
2739
|
-
from {
|
|
2740
|
-
opacity: 0;
|
|
2741
|
-
backdrop-filter: blur(0px);
|
|
2742
|
-
}
|
|
2743
|
-
to {
|
|
2744
|
-
opacity: 1;
|
|
2745
|
-
backdrop-filter: blur(2px);
|
|
2746
|
-
}
|
|
2747
|
-
}
|
|
2748
|
-
|
|
2749
|
-
.poll-thank-you-overlay .poll-thank-you {
|
|
2750
|
-
animation: slideInUp 0.4s ease-out;
|
|
2751
|
-
}
|
|
2752
|
-
|
|
2753
|
-
@keyframes slideInUp {
|
|
2754
|
-
from {
|
|
2755
|
-
transform: translateY(20px);
|
|
2756
|
-
opacity: 0;
|
|
2757
|
-
}
|
|
2758
|
-
to {
|
|
2759
|
-
transform: translateY(0);
|
|
2760
|
-
opacity: 1;
|
|
2761
|
-
}
|
|
2762
|
-
}
|
|
2763
|
-
|
|
2764
2765
|
/* Disabled poll options styles */
|
|
2765
2766
|
.poll-container--disabled {
|
|
2766
2767
|
filter: brightness(0.95);
|
|
@@ -2782,12 +2783,12 @@ const Ps = B`
|
|
|
2782
2783
|
gap: 0.5em;
|
|
2783
2784
|
}
|
|
2784
2785
|
`;
|
|
2785
|
-
var
|
|
2786
|
-
for (var o = i > 1 ? void 0 : i ?
|
|
2786
|
+
var Ps = Object.defineProperty, Ms = Object.getOwnPropertyDescriptor, Q = (e, t, s, i) => {
|
|
2787
|
+
for (var o = i > 1 ? void 0 : i ? Ms(t, s) : t, r = e.length - 1, a; r >= 0; r--)
|
|
2787
2788
|
(a = e[r]) && (o = (i ? a(t, s, o) : a(o)) || o);
|
|
2788
|
-
return i && o &&
|
|
2789
|
+
return i && o && Ps(t, s, o), o;
|
|
2789
2790
|
};
|
|
2790
|
-
let
|
|
2791
|
+
let T = class extends V {
|
|
2791
2792
|
constructor() {
|
|
2792
2793
|
super(...arguments), this.value = "", this.icon = "", this.tooltip = "", this.disabled = !1, this.selected = !1;
|
|
2793
2794
|
}
|
|
@@ -2806,33 +2807,33 @@ let P = class extends V {
|
|
|
2806
2807
|
return l` <slot></slot> `;
|
|
2807
2808
|
}
|
|
2808
2809
|
};
|
|
2809
|
-
|
|
2810
|
+
T.styles = B`
|
|
2810
2811
|
:host {
|
|
2811
2812
|
display: none;
|
|
2812
2813
|
}
|
|
2813
2814
|
`;
|
|
2814
2815
|
Q([
|
|
2815
2816
|
p({ type: String, reflect: !0 })
|
|
2816
|
-
],
|
|
2817
|
+
], T.prototype, "value", 2);
|
|
2817
2818
|
Q([
|
|
2818
2819
|
p({ type: String })
|
|
2819
|
-
],
|
|
2820
|
+
], T.prototype, "icon", 2);
|
|
2820
2821
|
Q([
|
|
2821
2822
|
p({ type: String })
|
|
2822
|
-
],
|
|
2823
|
+
], T.prototype, "tooltip", 2);
|
|
2823
2824
|
Q([
|
|
2824
2825
|
p({ type: Boolean, reflect: !0 })
|
|
2825
|
-
],
|
|
2826
|
+
], T.prototype, "disabled", 2);
|
|
2826
2827
|
Q([
|
|
2827
2828
|
p({ type: Boolean, reflect: !0 })
|
|
2828
|
-
],
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
],
|
|
2832
|
-
var
|
|
2829
|
+
], T.prototype, "selected", 2);
|
|
2830
|
+
T = Q([
|
|
2831
|
+
q("pc-poll-option")
|
|
2832
|
+
], T);
|
|
2833
|
+
var Os = Object.defineProperty, zs = Object.getOwnPropertyDescriptor, z = (e, t, s, i) => {
|
|
2833
2834
|
for (var o = i > 1 ? void 0 : i ? zs(t, s) : t, r = e.length - 1, a; r >= 0; r--)
|
|
2834
2835
|
(a = e[r]) && (o = (i ? a(t, s, o) : a(o)) || o);
|
|
2835
|
-
return i && o &&
|
|
2836
|
+
return i && o && Os(t, s, o), o;
|
|
2836
2837
|
};
|
|
2837
2838
|
let C = class extends u {
|
|
2838
2839
|
constructor() {
|
|
@@ -2862,7 +2863,7 @@ let C = class extends u {
|
|
|
2862
2863
|
getSlottedOptions() {
|
|
2863
2864
|
var s;
|
|
2864
2865
|
const e = (s = this.shadowRoot) == null ? void 0 : s.querySelector("slot");
|
|
2865
|
-
return e ? e.assignedElements().filter((i) => i instanceof
|
|
2866
|
+
return e ? e.assignedElements().filter((i) => i instanceof T).map((i) => {
|
|
2866
2867
|
var o, r;
|
|
2867
2868
|
return {
|
|
2868
2869
|
value: i.value || i.labelContent || ((o = i.textContent) == null ? void 0 : o.trim()) || "",
|
|
@@ -2943,7 +2944,7 @@ let C = class extends u {
|
|
|
2943
2944
|
if (!this.slotExists) return;
|
|
2944
2945
|
const e = (s = this.shadowRoot) == null ? void 0 : s.querySelector("slot");
|
|
2945
2946
|
if (!e) return;
|
|
2946
|
-
e.assignedElements().filter((i) => i instanceof
|
|
2947
|
+
e.assignedElements().filter((i) => i instanceof T).forEach((i) => {
|
|
2947
2948
|
i.selected = this.isSelected(i.value);
|
|
2948
2949
|
});
|
|
2949
2950
|
}
|
|
@@ -2955,7 +2956,7 @@ let C = class extends u {
|
|
|
2955
2956
|
if (!this.slotExists) return;
|
|
2956
2957
|
const e = (s = this.shadowRoot) == null ? void 0 : s.querySelector("slot");
|
|
2957
2958
|
if (!e) return;
|
|
2958
|
-
e.assignedElements().filter((i) => i instanceof
|
|
2959
|
+
e.assignedElements().filter((i) => i instanceof T).forEach((i) => {
|
|
2959
2960
|
i.selected = this.pendingSelections.includes(i.value);
|
|
2960
2961
|
});
|
|
2961
2962
|
}
|
|
@@ -2964,7 +2965,7 @@ let C = class extends u {
|
|
|
2964
2965
|
*/
|
|
2965
2966
|
renderOptionIcon(e, t) {
|
|
2966
2967
|
if (!e) return "";
|
|
2967
|
-
const s =
|
|
2968
|
+
const s = Rt.DECORATIVE, i = `Poll for: ${t == null ? void 0 : t.label}`, o = (t == null ? void 0 : t.label) || "", r = t ? this.isSelected(t.value) : !1, a = Ae(e, {
|
|
2968
2969
|
type: s,
|
|
2969
2970
|
alt: o,
|
|
2970
2971
|
isSelected: r,
|
|
@@ -2974,7 +2975,7 @@ let C = class extends u {
|
|
|
2974
2975
|
class="poll-option-icon"
|
|
2975
2976
|
aria-hidden="${a.ariaHidden ? "true" : "false"}"
|
|
2976
2977
|
>${e}</span
|
|
2977
|
-
>` :
|
|
2978
|
+
>` : Mt(e) ? l`<img
|
|
2978
2979
|
src="${e}"
|
|
2979
2980
|
alt="${a.alt}"
|
|
2980
2981
|
class="poll-option-icon-img"
|
|
@@ -3047,7 +3048,7 @@ let C = class extends u {
|
|
|
3047
3048
|
* Render poll options with proper grouping role
|
|
3048
3049
|
*/
|
|
3049
3050
|
renderPollOptions() {
|
|
3050
|
-
const e = this.multiple ? w.GROUP : w.RADIOGROUP, t = this.label || this.name || "Options", s =
|
|
3051
|
+
const e = this.multiple ? w.GROUP : w.RADIOGROUP, t = this.label || this.name || "Options", s = P({
|
|
3051
3052
|
role: e,
|
|
3052
3053
|
ariaLabel: t
|
|
3053
3054
|
});
|
|
@@ -3100,7 +3101,7 @@ let C = class extends u {
|
|
|
3100
3101
|
renderStats() {
|
|
3101
3102
|
if (!this.statsText) return d;
|
|
3102
3103
|
if (this.statsIsLoading) {
|
|
3103
|
-
const s =
|
|
3104
|
+
const s = P({
|
|
3104
3105
|
ariaLabel: "Loading poll statistics",
|
|
3105
3106
|
ariaBusy: !0
|
|
3106
3107
|
});
|
|
@@ -3185,7 +3186,7 @@ let C = class extends u {
|
|
|
3185
3186
|
* Render poll options with previous selections but disabled (for view mode)
|
|
3186
3187
|
*/
|
|
3187
3188
|
renderDisabledPollOptions() {
|
|
3188
|
-
const e = this.multiple ? w.GROUP : w.RADIOGROUP, t = this.label || this.name || "Options", s =
|
|
3189
|
+
const e = this.multiple ? w.GROUP : w.RADIOGROUP, t = this.label || this.name || "Options", s = P({
|
|
3189
3190
|
role: e,
|
|
3190
3191
|
ariaLabel: t
|
|
3191
3192
|
});
|
|
@@ -3235,9 +3236,9 @@ let C = class extends u {
|
|
|
3235
3236
|
*/
|
|
3236
3237
|
renderContent() {
|
|
3237
3238
|
return this.isEditMode ? l`<div class="pc-section">${this.renderPollOptions()}</div>` : this.showChart ? l`<div class="pc-section">${this.renderLinkedInChart()}</div>` : this.hasUserVote() ? l`
|
|
3238
|
-
<div class="pc-section
|
|
3239
|
+
<div class="pc-section pc-thank-you-section-with-overlay">
|
|
3239
3240
|
${this.renderDisabledPollOptions()}
|
|
3240
|
-
<div class="
|
|
3241
|
+
<div class="pc-thank-you-overlay" data-testid="poll-thank-you-overlay">
|
|
3241
3242
|
${this.renderThankYouMessage()}
|
|
3242
3243
|
</div>
|
|
3243
3244
|
</div>
|
|
@@ -3271,17 +3272,17 @@ let C = class extends u {
|
|
|
3271
3272
|
announceSelectionChange(e, t, s) {
|
|
3272
3273
|
const i = `Poll for: ${e.label}`;
|
|
3273
3274
|
let o = "";
|
|
3274
|
-
this.multiple ? o = (t == null ? void 0 : t.includes(e.value)) || !1 ? `${e.label} selected` : `${e.label} unselected` : o = t && t.length > 0 ? `${e.label} selected` : "Selection cleared",
|
|
3275
|
+
this.multiple ? o = (t == null ? void 0 : t.includes(e.value)) || !1 ? `${e.label} selected` : `${e.label} unselected` : o = t && t.length > 0 ? `${e.label} selected` : "Selection cleared", It(Ut(i, o));
|
|
3275
3276
|
}
|
|
3276
3277
|
render() {
|
|
3277
3278
|
const e = {
|
|
3278
3279
|
[`pc-flex-pos-${this.labelPosition}`]: !0,
|
|
3279
|
-
[`pc-flex-align-${
|
|
3280
|
+
[`pc-flex-align-${I(this.labelPosition, this.labelAlign)}`]: !0
|
|
3280
3281
|
}, t = "bottom", s = {
|
|
3281
3282
|
poll: !0,
|
|
3282
3283
|
[`pc-flex-pos-${t}`]: !0,
|
|
3283
|
-
[`pc-flex-align-${
|
|
3284
|
-
}, i =
|
|
3284
|
+
[`pc-flex-align-${I(t, this.statsAlign)}`]: !0
|
|
3285
|
+
}, i = P({
|
|
3285
3286
|
role: w.REGION,
|
|
3286
3287
|
ariaLabel: this.label || this.name || "Poll"
|
|
3287
3288
|
});
|
|
@@ -3301,7 +3302,7 @@ let C = class extends u {
|
|
|
3301
3302
|
`;
|
|
3302
3303
|
}
|
|
3303
3304
|
};
|
|
3304
|
-
C.styles = [...u.styles,
|
|
3305
|
+
C.styles = [...u.styles, Ts];
|
|
3305
3306
|
z([
|
|
3306
3307
|
p({ type: Array })
|
|
3307
3308
|
], C.prototype, "options", 2);
|
|
@@ -3330,7 +3331,7 @@ z([
|
|
|
3330
3331
|
y()
|
|
3331
3332
|
], C.prototype, "pendingSelections", 2);
|
|
3332
3333
|
C = z([
|
|
3333
|
-
|
|
3334
|
+
q("pc-poll")
|
|
3334
3335
|
], C);
|
|
3335
3336
|
const Ns = B`
|
|
3336
3337
|
.pc-container {
|
|
@@ -3458,17 +3459,6 @@ const Ns = B`
|
|
|
3458
3459
|
text-align: center;
|
|
3459
3460
|
}
|
|
3460
3461
|
|
|
3461
|
-
.thank-you-msg {
|
|
3462
|
-
font-size: 1em;
|
|
3463
|
-
color: var(--pc-text-color, #333);
|
|
3464
|
-
background: white;
|
|
3465
|
-
padding: 1em 1.5em;
|
|
3466
|
-
border-radius: var(--pc-border-radius, 0.375em);
|
|
3467
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
3468
|
-
border: 1px solid var(--pc-mute-color, #ddd);
|
|
3469
|
-
max-width: 300px;
|
|
3470
|
-
}
|
|
3471
|
-
|
|
3472
3462
|
/* Edit toggle icon styles */
|
|
3473
3463
|
.edit-toggle-icon {
|
|
3474
3464
|
width: 1em;
|
|
@@ -3489,52 +3479,6 @@ const Ns = B`
|
|
|
3489
3479
|
border-radius: 2px;
|
|
3490
3480
|
}
|
|
3491
3481
|
|
|
3492
|
-
/* Overlay styles */
|
|
3493
|
-
.text-section-with-overlay {
|
|
3494
|
-
position: relative;
|
|
3495
|
-
}
|
|
3496
|
-
|
|
3497
|
-
.text-thank-you-overlay {
|
|
3498
|
-
position: absolute;
|
|
3499
|
-
top: 0;
|
|
3500
|
-
left: 0;
|
|
3501
|
-
right: 0;
|
|
3502
|
-
bottom: 0;
|
|
3503
|
-
background-color: rgba(255, 255, 255, 0.2);
|
|
3504
|
-
backdrop-filter: blur(2px);
|
|
3505
|
-
display: flex;
|
|
3506
|
-
align-items: center;
|
|
3507
|
-
justify-content: center;
|
|
3508
|
-
z-index: 10;
|
|
3509
|
-
animation: fadeInOverlay 0.3s ease-out;
|
|
3510
|
-
}
|
|
3511
|
-
|
|
3512
|
-
@keyframes fadeInOverlay {
|
|
3513
|
-
from {
|
|
3514
|
-
opacity: 0;
|
|
3515
|
-
backdrop-filter: blur(0px);
|
|
3516
|
-
}
|
|
3517
|
-
to {
|
|
3518
|
-
opacity: 1;
|
|
3519
|
-
backdrop-filter: blur(2px);
|
|
3520
|
-
}
|
|
3521
|
-
}
|
|
3522
|
-
|
|
3523
|
-
.text-thank-you-overlay .text-thank-you {
|
|
3524
|
-
animation: slideInUp 0.4s ease-out;
|
|
3525
|
-
}
|
|
3526
|
-
|
|
3527
|
-
@keyframes slideInUp {
|
|
3528
|
-
from {
|
|
3529
|
-
transform: translateY(20px);
|
|
3530
|
-
opacity: 0;
|
|
3531
|
-
}
|
|
3532
|
-
to {
|
|
3533
|
-
transform: translateY(0);
|
|
3534
|
-
opacity: 1;
|
|
3535
|
-
}
|
|
3536
|
-
}
|
|
3537
|
-
|
|
3538
3482
|
/* Disabled text input styles */
|
|
3539
3483
|
.text-input-container--disabled {
|
|
3540
3484
|
filter: brightness(0.95);
|
|
@@ -3564,10 +3508,10 @@ const Ns = B`
|
|
|
3564
3508
|
}
|
|
3565
3509
|
}
|
|
3566
3510
|
`;
|
|
3567
|
-
var
|
|
3568
|
-
for (var o = i > 1 ? void 0 : i ?
|
|
3511
|
+
var Rs = Object.defineProperty, Is = Object.getOwnPropertyDescriptor, A = (e, t, s, i) => {
|
|
3512
|
+
for (var o = i > 1 ? void 0 : i ? Is(t, s) : t, r = e.length - 1, a; r >= 0; r--)
|
|
3569
3513
|
(a = e[r]) && (o = (i ? a(t, s, o) : a(o)) || o);
|
|
3570
|
-
return i && o &&
|
|
3514
|
+
return i && o && Rs(t, s, o), o;
|
|
3571
3515
|
};
|
|
3572
3516
|
let $ = class extends u {
|
|
3573
3517
|
constructor() {
|
|
@@ -3746,9 +3690,9 @@ let $ = class extends u {
|
|
|
3746
3690
|
*/
|
|
3747
3691
|
renderContent() {
|
|
3748
3692
|
return this.isEditMode ? l`<div class="pc-section">${this.renderTextarea()}</div>` : this.hasSubmitted() ? l`
|
|
3749
|
-
<div class="pc-section
|
|
3693
|
+
<div class="pc-section pc-thank-you-section-with-overlay">
|
|
3750
3694
|
${this.renderDisabledTextarea()}
|
|
3751
|
-
<div class="
|
|
3695
|
+
<div class="pc-thank-you-overlay" data-testid="text-thank-you-overlay">
|
|
3752
3696
|
${this.renderThankYouMessage()}
|
|
3753
3697
|
</div>
|
|
3754
3698
|
</div>
|
|
@@ -3766,7 +3710,7 @@ let $ = class extends u {
|
|
|
3766
3710
|
render() {
|
|
3767
3711
|
const e = {
|
|
3768
3712
|
[`pc-flex-pos-${this.labelPosition}`]: !0,
|
|
3769
|
-
[`pc-flex-align-${
|
|
3713
|
+
[`pc-flex-align-${I(this.labelPosition, this.labelAlign)}`]: !0
|
|
3770
3714
|
};
|
|
3771
3715
|
return l`
|
|
3772
3716
|
<div class="pc-container ${v(e)}" data-testid="text-container">
|
|
@@ -3811,7 +3755,7 @@ A([
|
|
|
3811
3755
|
y()
|
|
3812
3756
|
], $.prototype, "hasUserSubmitted", 2);
|
|
3813
3757
|
$ = A([
|
|
3814
|
-
|
|
3758
|
+
q("pc-text")
|
|
3815
3759
|
], $);
|
|
3816
3760
|
const Us = B`
|
|
3817
3761
|
/* Adjust stats text for reactions */
|
|
@@ -3833,6 +3777,7 @@ const Us = B`
|
|
|
3833
3777
|
/* Main reaction container */
|
|
3834
3778
|
.reaction {
|
|
3835
3779
|
display: flex;
|
|
3780
|
+
flex-direction: row;
|
|
3836
3781
|
gap: 0.5em;
|
|
3837
3782
|
align-items: center;
|
|
3838
3783
|
flex-wrap: wrap;
|
|
@@ -3857,19 +3802,21 @@ const Us = B`
|
|
|
3857
3802
|
background: var(--pc-background-color, white);
|
|
3858
3803
|
border-radius: var(--pc-button-radius, 1em);
|
|
3859
3804
|
cursor: pointer;
|
|
3860
|
-
transition:
|
|
3805
|
+
transition:
|
|
3806
|
+
background 0.2s,
|
|
3807
|
+
color 0.2s,
|
|
3808
|
+
border-color 0.2s;
|
|
3861
3809
|
position: relative;
|
|
3862
|
-
font-size: var(--pc-font-size-
|
|
3810
|
+
font-size: var(--pc-font-size-medium, 1em);
|
|
3863
3811
|
gap: 0.25em;
|
|
3864
|
-
min-height: 2em;
|
|
3865
3812
|
box-sizing: border-box;
|
|
3813
|
+
min-width: 2em;
|
|
3814
|
+
min-height: 2em;
|
|
3866
3815
|
}
|
|
3867
3816
|
|
|
3868
3817
|
/* Modifier class for reaction buttons without counts - creates circular appearance */
|
|
3869
3818
|
.reaction-btn.no-counts {
|
|
3870
3819
|
padding: 0.25em;
|
|
3871
|
-
min-height: 2em;
|
|
3872
|
-
min-width: 2em;
|
|
3873
3820
|
}
|
|
3874
3821
|
|
|
3875
3822
|
.reaction-btn.readonly {
|
|
@@ -3888,6 +3835,16 @@ const Us = B`
|
|
|
3888
3835
|
color: var(--pc-primary-color, #007bff);
|
|
3889
3836
|
}
|
|
3890
3837
|
|
|
3838
|
+
.reaction-btn:not(.readonly):hover {
|
|
3839
|
+
background: var(--pc-hover-color, #f5f5f5);
|
|
3840
|
+
color: var(--pc-primary-color, #007bff);
|
|
3841
|
+
transform: translateY(-1px);
|
|
3842
|
+
}
|
|
3843
|
+
|
|
3844
|
+
.reaction-btn.selected:not(.readonly):hover {
|
|
3845
|
+
background: var(--pc-primary-color-light, rgba(0, 123, 255, 0.2));
|
|
3846
|
+
}
|
|
3847
|
+
|
|
3891
3848
|
/* Trigger button for compact mode */
|
|
3892
3849
|
.trigger-btn {
|
|
3893
3850
|
display: flex;
|
|
@@ -3898,8 +3855,11 @@ const Us = B`
|
|
|
3898
3855
|
background: var(--pc-background-color, white);
|
|
3899
3856
|
border-radius: var(--pc-button-radius, 1em);
|
|
3900
3857
|
cursor: pointer;
|
|
3901
|
-
transition:
|
|
3902
|
-
|
|
3858
|
+
transition:
|
|
3859
|
+
background 0.2s,
|
|
3860
|
+
color 0.2s,
|
|
3861
|
+
border-color 0.2s;
|
|
3862
|
+
font-size: var(--pc-font-size-medium, 1em);
|
|
3903
3863
|
}
|
|
3904
3864
|
|
|
3905
3865
|
.trigger-btn:hover {
|
|
@@ -3914,11 +3874,13 @@ const Us = B`
|
|
|
3914
3874
|
/* Icon styling */
|
|
3915
3875
|
.icon {
|
|
3916
3876
|
display: inline-block;
|
|
3917
|
-
line-height: 1;
|
|
3918
|
-
transition:
|
|
3877
|
+
line-height: 1.2;
|
|
3878
|
+
transition:
|
|
3879
|
+
color 0.3s,
|
|
3880
|
+
transform 0.3s;
|
|
3919
3881
|
will-change: transform;
|
|
3920
3882
|
font-size: 1em;
|
|
3921
|
-
height:
|
|
3883
|
+
height: 1em;
|
|
3922
3884
|
}
|
|
3923
3885
|
|
|
3924
3886
|
.icon-img {
|
|
@@ -3928,9 +3890,10 @@ const Us = B`
|
|
|
3928
3890
|
}
|
|
3929
3891
|
|
|
3930
3892
|
.trigger-icon {
|
|
3931
|
-
width:
|
|
3932
|
-
height:
|
|
3933
|
-
|
|
3893
|
+
width: 1.5em;
|
|
3894
|
+
height: 1.5em;
|
|
3895
|
+
display: block;
|
|
3896
|
+
filter: brightness(2) contrast(1);
|
|
3934
3897
|
}
|
|
3935
3898
|
|
|
3936
3899
|
/* Count label */
|
|
@@ -3940,16 +3903,6 @@ const Us = B`
|
|
|
3940
3903
|
color: var(--pc-text-color, #333);
|
|
3941
3904
|
}
|
|
3942
3905
|
|
|
3943
|
-
/* Hover effects */
|
|
3944
|
-
/* .reaction-btn:not(.readonly):hover {
|
|
3945
|
-
background: var(--pc-hover-color, #f5f5f5);
|
|
3946
|
-
transform: translateY(-1px);
|
|
3947
|
-
} */
|
|
3948
|
-
|
|
3949
|
-
.reaction-btn.selected:not(.readonly):hover {
|
|
3950
|
-
background: var(--pc-primary-color-light, rgba(0, 123, 255, 0.2));
|
|
3951
|
-
}
|
|
3952
|
-
|
|
3953
3906
|
/* Popover styles */
|
|
3954
3907
|
.popover {
|
|
3955
3908
|
position: absolute;
|
|
@@ -4171,7 +4124,7 @@ const Us = B`
|
|
|
4171
4124
|
};
|
|
4172
4125
|
function Ls(e) {
|
|
4173
4126
|
let t = "❓", s = !1;
|
|
4174
|
-
return e ? e in le ? t = le[e] : ve(e) ? t = e :
|
|
4127
|
+
return e ? e in le ? t = le[e] : ve(e) ? t = e : Mt(e) ? (s = !0, t = e) : /^\w+@\w+$/.test(e) ? t = e : e.endsWith(".svg") ? (t = `https://cdn.jsdelivr.net/npm/@mdi/svg@7.4.47/svg/${e}`, s = !0) : t = e : t = "❓", {
|
|
4175
4128
|
icon: t,
|
|
4176
4129
|
isRemoteImage: s
|
|
4177
4130
|
};
|
|
@@ -4181,7 +4134,7 @@ var js = Object.defineProperty, Ds = Object.getOwnPropertyDescriptor, tt = (e, t
|
|
|
4181
4134
|
(a = e[r]) && (o = (i ? a(t, s, o) : a(o)) || o);
|
|
4182
4135
|
return i && o && js(t, s, o), o;
|
|
4183
4136
|
};
|
|
4184
|
-
let
|
|
4137
|
+
let O = class extends V {
|
|
4185
4138
|
constructor() {
|
|
4186
4139
|
super(...arguments), this.name = "", this.icon = "", this.tooltip = "", this.disabled = !1, this.selected = !1;
|
|
4187
4140
|
}
|
|
@@ -4200,38 +4153,38 @@ let M = class extends V {
|
|
|
4200
4153
|
return l` <slot></slot> `;
|
|
4201
4154
|
}
|
|
4202
4155
|
};
|
|
4203
|
-
|
|
4156
|
+
O.styles = B`
|
|
4204
4157
|
:host {
|
|
4205
4158
|
display: none;
|
|
4206
4159
|
}
|
|
4207
4160
|
`;
|
|
4208
4161
|
tt([
|
|
4209
4162
|
p({ type: String, reflect: !0 })
|
|
4210
|
-
],
|
|
4163
|
+
], O.prototype, "name", 2);
|
|
4211
4164
|
tt([
|
|
4212
4165
|
p({ type: String })
|
|
4213
|
-
],
|
|
4166
|
+
], O.prototype, "icon", 2);
|
|
4214
4167
|
tt([
|
|
4215
4168
|
p({ type: String })
|
|
4216
|
-
],
|
|
4169
|
+
], O.prototype, "tooltip", 2);
|
|
4217
4170
|
tt([
|
|
4218
4171
|
p({ type: Boolean, reflect: !0 })
|
|
4219
|
-
],
|
|
4172
|
+
], O.prototype, "disabled", 2);
|
|
4220
4173
|
tt([
|
|
4221
4174
|
p({ type: Boolean, reflect: !0 })
|
|
4222
|
-
],
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
],
|
|
4226
|
-
|
|
4227
|
-
|
|
4175
|
+
], O.prototype, "selected", 2);
|
|
4176
|
+
O = tt([
|
|
4177
|
+
q("pc-reaction-icon")
|
|
4178
|
+
], O);
|
|
4179
|
+
const Vs = "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='M480-480Zm0%20400q-83%200-156-31.5T197-197q-54-54-85.5-127T80-480q0-83%2031.5-156T197-763q54-54%20127-85.5T480-880q43%200%2083%208.5t77%2024.5v90q-35-20-75.5-31.5T480-800q-133%200-226.5%2093.5T160-480q0%20133%2093.5%20226.5T480-160q133%200%20226.5-93.5T800-480q0-32-6.5-62T776-600h86q9%2029%2013.5%2058.5T880-480q0%2083-31.5%20156T763-197q-54%2054-127%2085.5T480-80Zm320-600v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80ZM620-520q25%200%2042.5-17.5T680-580q0-25-17.5-42.5T620-640q-25%200-42.5%2017.5T560-580q0%2025%2017.5%2042.5T620-520Zm-280%200q25%200%2042.5-17.5T400-580q0-25-17.5-42.5T340-640q-25%200-42.5%2017.5T280-580q0%2025%2017.5%2042.5T340-520Zm140%20260q68%200%20123.5-38.5T684-400H276q25%2063%2080.5%20101.5T480-260Z'/%3e%3c/svg%3e";
|
|
4180
|
+
var Hs = Object.defineProperty, Bs = Object.getOwnPropertyDescriptor, N = (e, t, s, i) => {
|
|
4181
|
+
for (var o = i > 1 ? void 0 : i ? Bs(t, s) : t, r = e.length - 1, a; r >= 0; r--)
|
|
4228
4182
|
(a = e[r]) && (o = (i ? a(t, s, o) : a(o)) || o);
|
|
4229
|
-
return i && o &&
|
|
4183
|
+
return i && o && Hs(t, s, o), o;
|
|
4230
4184
|
};
|
|
4231
|
-
const Bs = "/src/images/emoji/add_reaction.svg";
|
|
4232
4185
|
let E = class extends u {
|
|
4233
4186
|
constructor() {
|
|
4234
|
-
super(), this.options = [], this.multiple = !1, this.
|
|
4187
|
+
super(), this.options = [], this.multiple = !1, this.compact = !1, this.popupPosition = "auto", this.buttonRadius = "999px", this.normalizedReactions = [], this.slotExists = !1, this.isPopoverVisible = !1, this.isChartVisible = !1, this.handleClickOutside = (e) => {
|
|
4235
4188
|
var o, r;
|
|
4236
4189
|
const t = e.target, s = (o = this.shadowRoot) == null ? void 0 : o.querySelector(".popover"), i = (r = this.shadowRoot) == null ? void 0 : r.querySelector(".trigger-btn");
|
|
4237
4190
|
s && !s.contains(t) && !(i != null && i.contains(t)) && (this.isPopoverVisible = !1);
|
|
@@ -4248,7 +4201,7 @@ let E = class extends u {
|
|
|
4248
4201
|
getSlottedReactions() {
|
|
4249
4202
|
var s;
|
|
4250
4203
|
const e = (s = this.shadowRoot) == null ? void 0 : s.querySelector("slot");
|
|
4251
|
-
return e ? e.assignedElements().filter((i) => i instanceof
|
|
4204
|
+
return e ? e.assignedElements().filter((i) => i instanceof O).map((i) => ({
|
|
4252
4205
|
name: i.name || i.labelContent || i.icon,
|
|
4253
4206
|
icon: i.icon,
|
|
4254
4207
|
tooltip: i.tooltip,
|
|
@@ -4304,7 +4257,7 @@ let E = class extends u {
|
|
|
4304
4257
|
return (((a = this.localStats.breakdown) == null ? void 0 : a[r]) || 0) > 0;
|
|
4305
4258
|
}
|
|
4306
4259
|
);
|
|
4307
|
-
this.multiple ? t ? s = i.filter((r) => r !== e.name) : s = [...i, e.name] : t ? s = [] : s = [e.name], this.updateSlottedElementsState(), this.
|
|
4260
|
+
this.multiple ? t ? s = i.filter((r) => r !== e.name) : s = [...i, e.name] : t ? s = [] : s = [e.name], this.updateSlottedElementsState(), this.compact && (this.isPopoverVisible = !1), this.announceReactionChange(e, !t);
|
|
4308
4261
|
const o = s.length;
|
|
4309
4262
|
await this.handleChange(o, s);
|
|
4310
4263
|
}
|
|
@@ -4316,7 +4269,7 @@ let E = class extends u {
|
|
|
4316
4269
|
if (!this.slotExists) return;
|
|
4317
4270
|
const e = (s = this.shadowRoot) == null ? void 0 : s.querySelector("slot");
|
|
4318
4271
|
if (!e) return;
|
|
4319
|
-
e.assignedElements().filter((i) => i instanceof
|
|
4272
|
+
e.assignedElements().filter((i) => i instanceof O).forEach((i) => {
|
|
4320
4273
|
i.selected = this.isSelected(i.name);
|
|
4321
4274
|
});
|
|
4322
4275
|
}
|
|
@@ -4330,7 +4283,7 @@ let E = class extends u {
|
|
|
4330
4283
|
* Renders the icon for a reaction
|
|
4331
4284
|
*/
|
|
4332
4285
|
renderReactionIcon(e, t) {
|
|
4333
|
-
const { icon: s, isRemoteImage: i } = Ls(e), o =
|
|
4286
|
+
const { icon: s, isRemoteImage: i } = Ls(e), o = Rt.FUNCTIONAL, r = "reaction", a = t.tooltip || `${t.name} reaction`, n = Ae(s, {
|
|
4334
4287
|
type: o,
|
|
4335
4288
|
alt: a,
|
|
4336
4289
|
ariaLabel: a,
|
|
@@ -4384,7 +4337,7 @@ let E = class extends u {
|
|
|
4384
4337
|
aria-expanded="${this.isPopoverVisible}"
|
|
4385
4338
|
aria-haspopup="menu"
|
|
4386
4339
|
>
|
|
4387
|
-
<img src="${
|
|
4340
|
+
<img src="${Vs}" alt="" class="trigger-icon" />
|
|
4388
4341
|
</button>
|
|
4389
4342
|
`;
|
|
4390
4343
|
}
|
|
@@ -4392,7 +4345,7 @@ let E = class extends u {
|
|
|
4392
4345
|
* Render the popover for compact mode
|
|
4393
4346
|
*/
|
|
4394
4347
|
renderPopover() {
|
|
4395
|
-
if (!this.isPopoverVisible || this.
|
|
4348
|
+
if (!this.isPopoverVisible || !this.compact) return d;
|
|
4396
4349
|
const e = {
|
|
4397
4350
|
popover: !0,
|
|
4398
4351
|
top: this.popupPosition === "top" || this.popupPosition === "auto" && this.shouldShowPopoverOnTop(),
|
|
@@ -4437,20 +4390,10 @@ let E = class extends u {
|
|
|
4437
4390
|
if (this.normalizedReactions.length === 0) return d;
|
|
4438
4391
|
const e = {
|
|
4439
4392
|
reaction: !0,
|
|
4440
|
-
expand: this.
|
|
4441
|
-
compact: this.
|
|
4393
|
+
expand: !this.compact,
|
|
4394
|
+
compact: this.compact
|
|
4442
4395
|
};
|
|
4443
|
-
if (this.
|
|
4444
|
-
return l`
|
|
4445
|
-
<div class="${v(e)}">
|
|
4446
|
-
<div class="reaction-list">
|
|
4447
|
-
${this.normalizedReactions.map(
|
|
4448
|
-
(t) => this.renderReactionButton(t, this.showCounts)
|
|
4449
|
-
)}
|
|
4450
|
-
</div>
|
|
4451
|
-
</div>
|
|
4452
|
-
`;
|
|
4453
|
-
{
|
|
4396
|
+
if (this.compact) {
|
|
4454
4397
|
const t = this.getActiveReactions();
|
|
4455
4398
|
return l`
|
|
4456
4399
|
<div class="${v(e)}">
|
|
@@ -4465,7 +4408,16 @@ let E = class extends u {
|
|
|
4465
4408
|
${this.renderPopover()}
|
|
4466
4409
|
</div>
|
|
4467
4410
|
`;
|
|
4468
|
-
}
|
|
4411
|
+
} else
|
|
4412
|
+
return l`
|
|
4413
|
+
<div class="${v(e)}">
|
|
4414
|
+
<div class="reaction-list">
|
|
4415
|
+
${this.normalizedReactions.map(
|
|
4416
|
+
(t) => this.renderReactionButton(t, this.showCounts)
|
|
4417
|
+
)}
|
|
4418
|
+
</div>
|
|
4419
|
+
</div>
|
|
4420
|
+
`;
|
|
4469
4421
|
}
|
|
4470
4422
|
/**
|
|
4471
4423
|
* Render chart for reaction stats
|
|
@@ -4483,7 +4435,7 @@ let E = class extends u {
|
|
|
4483
4435
|
icon: h && this.renderReactionIcon((h == null ? void 0 : h.icon) || "", h ?? {}) || ""
|
|
4484
4436
|
};
|
|
4485
4437
|
}
|
|
4486
|
-
), o = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", r =
|
|
4438
|
+
), o = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", r = Ot(s, {
|
|
4487
4439
|
barColor: o,
|
|
4488
4440
|
labelFormatter: (n) => `${n}`,
|
|
4489
4441
|
valueFormatter: (n) => `${t > 0 ? Math.round(n / t * 100) : 0}%`
|
|
@@ -4571,15 +4523,15 @@ let E = class extends u {
|
|
|
4571
4523
|
*/
|
|
4572
4524
|
announceReactionChange(e, t) {
|
|
4573
4525
|
const s = this.componentName, i = t ? `Added ${e.name} reaction` : `Removed ${e.name} reaction`;
|
|
4574
|
-
|
|
4526
|
+
It(Ut(s, i));
|
|
4575
4527
|
}
|
|
4576
4528
|
render() {
|
|
4577
4529
|
const e = {
|
|
4578
4530
|
[`pc-flex-pos-${this.labelPosition}`]: !0,
|
|
4579
|
-
[`pc-flex-align-${
|
|
4531
|
+
[`pc-flex-align-${I(this.labelPosition, this.labelAlign)}`]: !0
|
|
4580
4532
|
}, t = {
|
|
4581
4533
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
4582
|
-
[`pc-flex-align-${
|
|
4534
|
+
[`pc-flex-align-${I(this.statsPosition, this.statsAlign)}`]: !0
|
|
4583
4535
|
};
|
|
4584
4536
|
return l`
|
|
4585
4537
|
<div class="pc-container ${v(e)}" data-testid="reaction-container">
|
|
@@ -4601,10 +4553,10 @@ N([
|
|
|
4601
4553
|
p({ type: Boolean, reflect: !0 })
|
|
4602
4554
|
], E.prototype, "multiple", 2);
|
|
4603
4555
|
N([
|
|
4604
|
-
p({ type:
|
|
4605
|
-
], E.prototype, "
|
|
4556
|
+
p({ type: Boolean, reflect: !0 })
|
|
4557
|
+
], E.prototype, "compact", 2);
|
|
4606
4558
|
N([
|
|
4607
|
-
p({ type: String
|
|
4559
|
+
p({ type: String })
|
|
4608
4560
|
], E.prototype, "popupPosition", 2);
|
|
4609
4561
|
N([
|
|
4610
4562
|
p({ type: String, attribute: "button-radius" })
|
|
@@ -4622,9 +4574,9 @@ N([
|
|
|
4622
4574
|
y()
|
|
4623
4575
|
], E.prototype, "isChartVisible", 2);
|
|
4624
4576
|
E = N([
|
|
4625
|
-
|
|
4577
|
+
q("pc-reaction")
|
|
4626
4578
|
], E);
|
|
4627
|
-
const
|
|
4579
|
+
const qs = B`
|
|
4628
4580
|
/* Base variables */
|
|
4629
4581
|
:host {
|
|
4630
4582
|
--pc-stars-star-size: clamp(1.2em, calc(1.2em + 0.3vw), 2em);
|
|
@@ -4981,7 +4933,7 @@ const Fs = B`
|
|
|
4981
4933
|
* Copyright 2018 Google LLC
|
|
4982
4934
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
4983
4935
|
*/
|
|
4984
|
-
const _e = "important",
|
|
4936
|
+
const _e = "important", Fs = " !" + _e, Ks = Ce(class extends Ee {
|
|
4985
4937
|
constructor(e) {
|
|
4986
4938
|
var t;
|
|
4987
4939
|
if (super(e), e.type !== ke.ATTRIBUTE || e.name !== "style" || ((t = e.strings) == null ? void 0 : t.length) > 2) throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
|
|
@@ -5000,14 +4952,14 @@ const _e = "important", qs = " !" + _e, Ks = Ce(class extends Ee {
|
|
|
5000
4952
|
const o = t[i];
|
|
5001
4953
|
if (o != null) {
|
|
5002
4954
|
this.ft.add(i);
|
|
5003
|
-
const r = typeof o == "string" && o.endsWith(
|
|
4955
|
+
const r = typeof o == "string" && o.endsWith(Fs);
|
|
5004
4956
|
i.includes("-") || r ? s.setProperty(i, r ? o.slice(0, -11) : o, r ? _e : "") : s[i] = o;
|
|
5005
4957
|
}
|
|
5006
4958
|
}
|
|
5007
4959
|
return H;
|
|
5008
4960
|
}
|
|
5009
4961
|
});
|
|
5010
|
-
var Ys = Object.defineProperty, Gs = Object.getOwnPropertyDescriptor,
|
|
4962
|
+
var Ys = Object.defineProperty, Gs = Object.getOwnPropertyDescriptor, W = (e, t, s, i) => {
|
|
5011
4963
|
for (var o = i > 1 ? void 0 : i ? Gs(t, s) : t, r = e.length - 1, a; r >= 0; r--)
|
|
5012
4964
|
(a = e[r]) && (o = (i ? a(t, s, o) : a(o)) || o);
|
|
5013
4965
|
return i && o && Ys(t, s, o), o;
|
|
@@ -5186,7 +5138,7 @@ let U = class extends u {
|
|
|
5186
5138
|
value: c,
|
|
5187
5139
|
icon: "★"
|
|
5188
5140
|
})
|
|
5189
|
-
), o = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", r =
|
|
5141
|
+
), o = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", r = Ot(s, {
|
|
5190
5142
|
barColor: o,
|
|
5191
5143
|
labelFormatter: (n) => `${n}`,
|
|
5192
5144
|
valueFormatter: (n) => `${t > 0 ? Math.round(n / t * 100) : 0}%`
|
|
@@ -5230,13 +5182,13 @@ let U = class extends u {
|
|
|
5230
5182
|
render() {
|
|
5231
5183
|
const e = {
|
|
5232
5184
|
[`pc-flex-pos-${this.labelPosition}`]: !0,
|
|
5233
|
-
[`pc-flex-align-${
|
|
5185
|
+
[`pc-flex-align-${I(this.labelPosition, this.labelAlign)}`]: !0,
|
|
5234
5186
|
"edit-mode": this.isEditMode,
|
|
5235
5187
|
"view-mode": !this.isEditMode
|
|
5236
5188
|
}, t = {
|
|
5237
5189
|
stars: !0,
|
|
5238
5190
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
5239
|
-
[`pc-flex-align-${
|
|
5191
|
+
[`pc-flex-align-${I(this.statsPosition, this.statsAlign)}`]: !0
|
|
5240
5192
|
};
|
|
5241
5193
|
return l`
|
|
5242
5194
|
<div class="pc-container ${v(e)}" data-testid="stars-container">
|
|
@@ -5255,32 +5207,32 @@ let U = class extends u {
|
|
|
5255
5207
|
`;
|
|
5256
5208
|
}
|
|
5257
5209
|
};
|
|
5258
|
-
U.styles = [...u.styles,
|
|
5259
|
-
|
|
5210
|
+
U.styles = [...u.styles, qs];
|
|
5211
|
+
W([
|
|
5260
5212
|
p({ type: Number, attribute: "num-stars" })
|
|
5261
5213
|
], U.prototype, "numStars", 2);
|
|
5262
|
-
|
|
5214
|
+
W([
|
|
5263
5215
|
p({ type: String, attribute: "default-mode" })
|
|
5264
5216
|
], U.prototype, "defaultMode", 2);
|
|
5265
|
-
|
|
5217
|
+
W([
|
|
5266
5218
|
y()
|
|
5267
5219
|
], U.prototype, "isChartVisible", 2);
|
|
5268
|
-
|
|
5220
|
+
W([
|
|
5269
5221
|
y()
|
|
5270
5222
|
], U.prototype, "isEditMode", 2);
|
|
5271
|
-
|
|
5223
|
+
W([
|
|
5272
5224
|
y()
|
|
5273
5225
|
], U.prototype, "hoverValue", 2);
|
|
5274
|
-
|
|
5226
|
+
W([
|
|
5275
5227
|
y()
|
|
5276
5228
|
], U.prototype, "editValue", 2);
|
|
5277
|
-
U =
|
|
5278
|
-
|
|
5229
|
+
U = W([
|
|
5230
|
+
q("pc-stars")
|
|
5279
5231
|
], U);
|
|
5280
|
-
var
|
|
5281
|
-
for (var o = i > 1 ? void 0 : i ?
|
|
5232
|
+
var Zs = Object.defineProperty, Ws = Object.getOwnPropertyDescriptor, Te = (e, t, s, i) => {
|
|
5233
|
+
for (var o = i > 1 ? void 0 : i ? Ws(t, s) : t, r = e.length - 1, a; r >= 0; r--)
|
|
5282
5234
|
(a = e[r]) && (o = (i ? a(t, s, o) : a(o)) || o);
|
|
5283
|
-
return i && o &&
|
|
5235
|
+
return i && o && Zs(t, s, o), o;
|
|
5284
5236
|
};
|
|
5285
5237
|
let Ct = class extends V {
|
|
5286
5238
|
/**
|
|
@@ -5340,18 +5292,18 @@ let Ct = class extends V {
|
|
|
5340
5292
|
}
|
|
5341
5293
|
}
|
|
5342
5294
|
};
|
|
5343
|
-
|
|
5295
|
+
Te([
|
|
5344
5296
|
p({ type: String })
|
|
5345
5297
|
], Ct.prototype, "type", 2);
|
|
5346
|
-
Ct =
|
|
5347
|
-
|
|
5298
|
+
Ct = Te([
|
|
5299
|
+
q("poll-catch")
|
|
5348
5300
|
], Ct);
|
|
5349
5301
|
export {
|
|
5350
|
-
|
|
5302
|
+
M as PcNps,
|
|
5351
5303
|
C as PcPoll,
|
|
5352
|
-
|
|
5304
|
+
T as PcPollOption,
|
|
5353
5305
|
E as PcReaction,
|
|
5354
|
-
|
|
5306
|
+
O as PcReactionIcon,
|
|
5355
5307
|
U as PcStars,
|
|
5356
5308
|
$ as PcText,
|
|
5357
5309
|
Ct as PollCatch
|