pollcatch 2.5.2 → 2.5.4
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 +2 -2
- package/pc.js +861 -858
package/pc.js
CHANGED
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
const
|
|
7
|
-
let
|
|
6
|
+
const yt = globalThis, Ht = yt.ShadowRoot && (yt.ShadyCSS === void 0 || yt.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Ft = Symbol(), te = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
let Ce = class {
|
|
8
8
|
constructor(t, o, r) {
|
|
9
|
-
if (this._$cssResult$ = !0, r !==
|
|
9
|
+
if (this._$cssResult$ = !0, r !== Ft) 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 (Ht && t === void 0) {
|
|
16
16
|
const r = o !== void 0 && o.length === 1;
|
|
17
|
-
r && (t =
|
|
17
|
+
r && (t = te.get(o)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), r && te.set(o, t));
|
|
18
18
|
}
|
|
19
19
|
return t;
|
|
20
20
|
}
|
|
@@ -22,33 +22,33 @@ let Pe = class {
|
|
|
22
22
|
return this.cssText;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const
|
|
25
|
+
const Ge = (e) => new Ce(typeof e == "string" ? e : e + "", void 0, Ft), R = (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
|
|
32
|
-
},
|
|
33
|
-
if (
|
|
31
|
+
return new Ce(o, e, Ft);
|
|
32
|
+
}, Ze = (e, t) => {
|
|
33
|
+
if (Ht) e.adoptedStyleSheets = t.map((o) => o instanceof CSSStyleSheet ? o : o.styleSheet);
|
|
34
34
|
else for (const o of t) {
|
|
35
|
-
const r = document.createElement("style"), s =
|
|
35
|
+
const r = document.createElement("style"), s = yt.litNonce;
|
|
36
36
|
s !== void 0 && r.setAttribute("nonce", s), r.textContent = o.cssText, e.appendChild(r);
|
|
37
37
|
}
|
|
38
|
-
},
|
|
38
|
+
}, ee = Ht ? (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 Ge(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:
|
|
48
|
+
const { is: Xe, defineProperty: Je, getOwnPropertyDescriptor: Qe, getOwnPropertyNames: to, getOwnPropertySymbols: eo, getPrototypeOf: oo } = Object, U = globalThis, oe = U.trustedTypes, ro = oe ? oe.emptyScript : "", Ot = U.reactiveElementPolyfillSupport, lt = (e, t) => e, xt = { toAttribute(e, t) {
|
|
49
49
|
switch (t) {
|
|
50
50
|
case Boolean:
|
|
51
|
-
e = e ?
|
|
51
|
+
e = e ? ro : null;
|
|
52
52
|
break;
|
|
53
53
|
case Object:
|
|
54
54
|
case Array:
|
|
@@ -73,23 +73,23 @@ const { is: Ge, defineProperty: Ze, getOwnPropertyDescriptor: Je, getOwnProperty
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
return o;
|
|
76
|
-
} },
|
|
77
|
-
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")),
|
|
78
|
-
let
|
|
76
|
+
} }, Yt = (e, t) => !Xe(e, t), re = { attribute: !0, type: String, converter: xt, reflect: !1, hasChanged: Yt };
|
|
77
|
+
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), U.litPropertyMetadata ?? (U.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
78
|
+
let tt = class extends HTMLElement {
|
|
79
79
|
static addInitializer(t) {
|
|
80
80
|
this._$Ei(), (this.l ?? (this.l = [])).push(t);
|
|
81
81
|
}
|
|
82
82
|
static get observedAttributes() {
|
|
83
83
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
84
84
|
}
|
|
85
|
-
static createProperty(t, o =
|
|
85
|
+
static createProperty(t, o = re) {
|
|
86
86
|
if (o.state && (o.attribute = !1), this._$Ei(), this.elementProperties.set(t, o), !o.noAccessor) {
|
|
87
87
|
const r = Symbol(), s = this.getPropertyDescriptor(t, r, o);
|
|
88
|
-
s !== void 0 &&
|
|
88
|
+
s !== void 0 && Je(this.prototype, t, s);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
static getPropertyDescriptor(t, o, r) {
|
|
92
|
-
const { get: s, set: i } =
|
|
92
|
+
const { get: s, set: i } = Qe(this.prototype, t) ?? { get() {
|
|
93
93
|
return this[o];
|
|
94
94
|
}, set(a) {
|
|
95
95
|
this[o] = a;
|
|
@@ -102,17 +102,17 @@ let rt = class extends HTMLElement {
|
|
|
102
102
|
}, configurable: !0, enumerable: !0 };
|
|
103
103
|
}
|
|
104
104
|
static getPropertyOptions(t) {
|
|
105
|
-
return this.elementProperties.get(t) ??
|
|
105
|
+
return this.elementProperties.get(t) ?? re;
|
|
106
106
|
}
|
|
107
107
|
static _$Ei() {
|
|
108
|
-
if (this.hasOwnProperty(
|
|
109
|
-
const t =
|
|
108
|
+
if (this.hasOwnProperty(lt("elementProperties"))) return;
|
|
109
|
+
const t = oo(this);
|
|
110
110
|
t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
|
111
111
|
}
|
|
112
112
|
static finalize() {
|
|
113
|
-
if (this.hasOwnProperty(
|
|
114
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(
|
|
115
|
-
const o = this.properties, r = [...
|
|
113
|
+
if (this.hasOwnProperty(lt("finalized"))) return;
|
|
114
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(lt("properties"))) {
|
|
115
|
+
const o = this.properties, r = [...to(o), ...eo(o)];
|
|
116
116
|
for (const s of r) this.createProperty(s, o[s]);
|
|
117
117
|
}
|
|
118
118
|
const t = this[Symbol.metadata];
|
|
@@ -131,8 +131,8 @@ let rt = class extends HTMLElement {
|
|
|
131
131
|
const o = [];
|
|
132
132
|
if (Array.isArray(t)) {
|
|
133
133
|
const r = new Set(t.flat(1 / 0).reverse());
|
|
134
|
-
for (const s of r) o.unshift(
|
|
135
|
-
} else t !== void 0 && o.push(
|
|
134
|
+
for (const s of r) o.unshift(ee(s));
|
|
135
|
+
} else t !== void 0 && o.push(ee(t));
|
|
136
136
|
return o;
|
|
137
137
|
}
|
|
138
138
|
static _$Eu(t, o) {
|
|
@@ -161,7 +161,7 @@ let rt = class extends HTMLElement {
|
|
|
161
161
|
}
|
|
162
162
|
createRenderRoot() {
|
|
163
163
|
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
164
|
-
return
|
|
164
|
+
return Ze(t, this.constructor.elementStyles), t;
|
|
165
165
|
}
|
|
166
166
|
connectedCallback() {
|
|
167
167
|
var t;
|
|
@@ -186,7 +186,7 @@ let rt = class extends HTMLElement {
|
|
|
186
186
|
var i;
|
|
187
187
|
const r = this.constructor.elementProperties.get(t), s = this.constructor._$Eu(t, r);
|
|
188
188
|
if (s !== void 0 && r.reflect === !0) {
|
|
189
|
-
const a = (((i = r.converter) == null ? void 0 : i.toAttribute) !== void 0 ? r.converter :
|
|
189
|
+
const a = (((i = r.converter) == null ? void 0 : i.toAttribute) !== void 0 ? r.converter : xt).toAttribute(o, r.type);
|
|
190
190
|
this._$Em = t, a == null ? this.removeAttribute(s) : this.setAttribute(s, a), this._$Em = null;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
@@ -194,13 +194,13 @@ let rt = class extends HTMLElement {
|
|
|
194
194
|
var i;
|
|
195
195
|
const r = this.constructor, s = r._$Eh.get(t);
|
|
196
196
|
if (s !== void 0 && this._$Em !== s) {
|
|
197
|
-
const a = r.getPropertyOptions(s), l = typeof a.converter == "function" ? { fromAttribute: a.converter } : ((i = a.converter) == null ? void 0 : i.fromAttribute) !== void 0 ? a.converter :
|
|
197
|
+
const a = r.getPropertyOptions(s), l = typeof a.converter == "function" ? { fromAttribute: a.converter } : ((i = a.converter) == null ? void 0 : i.fromAttribute) !== void 0 ? a.converter : xt;
|
|
198
198
|
this._$Em = s, this[s] = l.fromAttribute(o, a.type), this._$Em = null;
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
requestUpdate(t, o, r) {
|
|
202
202
|
if (t !== void 0) {
|
|
203
|
-
if (r ?? (r = this.constructor.getPropertyOptions(t)), !(r.hasChanged ??
|
|
203
|
+
if (r ?? (r = this.constructor.getPropertyOptions(t)), !(r.hasChanged ?? Yt)(this[t], o)) return;
|
|
204
204
|
this.P(t, o, r);
|
|
205
205
|
}
|
|
206
206
|
this.isUpdatePending === !1 && (this._$ES = this._$ET());
|
|
@@ -273,76 +273,76 @@ let rt = class extends HTMLElement {
|
|
|
273
273
|
firstUpdated(t) {
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
|
-
|
|
276
|
+
tt.elementStyles = [], tt.shadowRootOptions = { mode: "open" }, tt[lt("elementProperties")] = /* @__PURE__ */ new Map(), tt[lt("finalized")] = /* @__PURE__ */ new Map(), Ot == null || Ot({ ReactiveElement: tt }), (U.reactiveElementVersions ?? (U.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
|
|
283
|
-
\f\r]`,
|
|
284
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"),
|
|
285
|
-
function
|
|
286
|
-
if (!
|
|
287
|
-
return
|
|
282
|
+
const ct = globalThis, $t = ct.trustedTypes, se = $t ? $t.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, ke = "$lit$", V = `lit$${Math.random().toFixed(9).slice(2)}$`, Ee = "?" + V, so = `<${Ee}>`, G = document, pt = () => G.createComment(""), ut = (e) => e === null || typeof e != "object" && typeof e != "function", Wt = Array.isArray, io = (e) => Wt(e) || typeof (e == null ? void 0 : e[Symbol.iterator]) == "function", It = `[
|
|
283
|
+
\f\r]`, at = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ie = /-->/g, ae = />/g, W = RegExp(`>|${It}(?:([^\\s"'>=/]+)(${It}*=${It}*(?:[^
|
|
284
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), ne = /'/g, le = /"/g, Ae = /^(?:script|style|textarea|title)$/i, ao = (e) => (t, ...o) => ({ _$litType$: e, strings: t, values: o }), c = ao(1), j = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), ce = /* @__PURE__ */ new WeakMap(), K = G.createTreeWalker(G, 129);
|
|
285
|
+
function Pe(e, t) {
|
|
286
|
+
if (!Wt(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
287
|
+
return se !== void 0 ? se.createHTML(t) : t;
|
|
288
288
|
}
|
|
289
|
-
const
|
|
289
|
+
const no = (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 = at;
|
|
292
292
|
for (let l = 0; l < o; l++) {
|
|
293
293
|
const n = e[l];
|
|
294
|
-
let d, p,
|
|
295
|
-
for (;
|
|
296
|
-
const
|
|
297
|
-
i += a ===
|
|
294
|
+
let d, p, f = -1, b = 0;
|
|
295
|
+
for (; b < n.length && (a.lastIndex = b, p = a.exec(n), p !== null); ) b = a.lastIndex, a === at ? p[1] === "!--" ? a = ie : p[1] !== void 0 ? a = ae : p[2] !== void 0 ? (Ae.test(p[2]) && (s = RegExp("</" + p[2], "g")), a = W) : p[3] !== void 0 && (a = W) : a === W ? p[0] === ">" ? (a = s ?? at, f = -1) : p[1] === void 0 ? f = -2 : (f = a.lastIndex - p[2].length, d = p[1], a = p[3] === void 0 ? W : p[3] === '"' ? le : ne) : a === le || a === ne ? a = W : a === ie || a === ae ? a = at : (a = W, s = void 0);
|
|
296
|
+
const y = a === W && e[l + 1].startsWith("/>") ? " " : "";
|
|
297
|
+
i += a === at ? n + so : f >= 0 ? (r.push(d), n.slice(0, f) + ke + n.slice(f) + V + y) : n + V + (f === -2 ? l : y);
|
|
298
298
|
}
|
|
299
|
-
return [
|
|
299
|
+
return [Pe(e, i + (e[o] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
|
|
300
300
|
};
|
|
301
|
-
let
|
|
301
|
+
let jt = class Te {
|
|
302
302
|
constructor({ strings: t, _$litType$: o }, r) {
|
|
303
303
|
let s;
|
|
304
304
|
this.parts = [];
|
|
305
305
|
let i = 0, a = 0;
|
|
306
|
-
const l = t.length - 1, n = this.parts, [d, p] =
|
|
307
|
-
if (this.el =
|
|
308
|
-
const
|
|
309
|
-
|
|
306
|
+
const l = t.length - 1, n = this.parts, [d, p] = no(t, o);
|
|
307
|
+
if (this.el = Te.createElement(d, r), K.currentNode = this.el.content, o === 2 || o === 3) {
|
|
308
|
+
const f = this.el.content.firstChild;
|
|
309
|
+
f.replaceWith(...f.childNodes);
|
|
310
310
|
}
|
|
311
|
-
for (; (s =
|
|
311
|
+
for (; (s = K.nextNode()) !== null && n.length < l; ) {
|
|
312
312
|
if (s.nodeType === 1) {
|
|
313
|
-
if (s.hasAttributes()) for (const
|
|
314
|
-
const
|
|
315
|
-
n.push({ type: 1, index: i, name:
|
|
316
|
-
} else
|
|
317
|
-
if (
|
|
318
|
-
const
|
|
319
|
-
if (
|
|
320
|
-
s.textContent =
|
|
321
|
-
for (let
|
|
322
|
-
s.append(
|
|
313
|
+
if (s.hasAttributes()) for (const f of s.getAttributeNames()) if (f.endsWith(ke)) {
|
|
314
|
+
const b = p[a++], y = s.getAttribute(f).split(V), x = /([.?@])?(.*)/.exec(b);
|
|
315
|
+
n.push({ type: 1, index: i, name: x[2], strings: y, ctor: x[1] === "." ? co : x[1] === "?" ? po : x[1] === "@" ? uo : Et }), s.removeAttribute(f);
|
|
316
|
+
} else f.startsWith(V) && (n.push({ type: 6, index: i }), s.removeAttribute(f));
|
|
317
|
+
if (Ae.test(s.tagName)) {
|
|
318
|
+
const f = s.textContent.split(V), b = f.length - 1;
|
|
319
|
+
if (b > 0) {
|
|
320
|
+
s.textContent = $t ? $t.emptyScript : "";
|
|
321
|
+
for (let y = 0; y < b; y++) s.append(f[y], pt()), K.nextNode(), n.push({ type: 2, index: ++i });
|
|
322
|
+
s.append(f[b], pt());
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
-
} else if (s.nodeType === 8) if (s.data ===
|
|
325
|
+
} else if (s.nodeType === 8) if (s.data === Ee) n.push({ type: 2, index: i });
|
|
326
326
|
else {
|
|
327
|
-
let
|
|
328
|
-
for (; (
|
|
327
|
+
let f = -1;
|
|
328
|
+
for (; (f = s.data.indexOf(V, f + 1)) !== -1; ) n.push({ type: 7, index: i }), f += V.length - 1;
|
|
329
329
|
}
|
|
330
330
|
i++;
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
static createElement(t, o) {
|
|
334
|
-
const r =
|
|
334
|
+
const r = G.createElement("template");
|
|
335
335
|
return r.innerHTML = t, r;
|
|
336
336
|
}
|
|
337
337
|
};
|
|
338
|
-
function
|
|
338
|
+
function ot(e, t, o = e, r) {
|
|
339
339
|
var a, l;
|
|
340
|
-
if (t ===
|
|
340
|
+
if (t === j) return t;
|
|
341
341
|
let s = r !== void 0 ? (a = o._$Co) == null ? void 0 : a[r] : o._$Cl;
|
|
342
|
-
const i =
|
|
343
|
-
return (s == null ? void 0 : s.constructor) !== i && ((l = s == null ? void 0 : s._$AO) == null || l.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 =
|
|
342
|
+
const i = ut(t) ? void 0 : t._$litDirective$;
|
|
343
|
+
return (s == null ? void 0 : s.constructor) !== i && ((l = s == null ? void 0 : s._$AO) == null || l.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 = ot(e, s._$AS(e, t.values), s, r)), t;
|
|
344
344
|
}
|
|
345
|
-
let
|
|
345
|
+
let lo = class {
|
|
346
346
|
constructor(t, o) {
|
|
347
347
|
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = o;
|
|
348
348
|
}
|
|
@@ -353,24 +353,24 @@ let ao = class {
|
|
|
353
353
|
return this._$AM._$AU;
|
|
354
354
|
}
|
|
355
355
|
u(t) {
|
|
356
|
-
const { el: { content: o }, parts: r } = this._$AD, s = ((t == null ? void 0 : t.creationScope) ??
|
|
357
|
-
|
|
358
|
-
let i =
|
|
356
|
+
const { el: { content: o }, parts: r } = this._$AD, s = ((t == null ? void 0 : t.creationScope) ?? G).importNode(o, !0);
|
|
357
|
+
K.currentNode = s;
|
|
358
|
+
let i = K.nextNode(), a = 0, l = 0, n = r[0];
|
|
359
359
|
for (; n !== void 0; ) {
|
|
360
360
|
if (a === n.index) {
|
|
361
361
|
let d;
|
|
362
|
-
n.type === 2 ? d = new
|
|
362
|
+
n.type === 2 ? d = new ht(i, i.nextSibling, this, t) : n.type === 1 ? d = new n.ctor(i, n.name, n.strings, this, t) : n.type === 6 && (d = new ho(i, this, t)), this._$AV.push(d), n = r[++l];
|
|
363
363
|
}
|
|
364
|
-
a !== (n == null ? void 0 : n.index) && (i =
|
|
364
|
+
a !== (n == null ? void 0 : n.index) && (i = K.nextNode(), a++);
|
|
365
365
|
}
|
|
366
|
-
return
|
|
366
|
+
return K.currentNode = G, s;
|
|
367
367
|
}
|
|
368
368
|
p(t) {
|
|
369
369
|
let o = 0;
|
|
370
370
|
for (const r of this._$AV) r !== void 0 && (r.strings !== void 0 ? (r._$AI(t, r, o), o += r.strings.length - 2) : r._$AI(t[o])), o++;
|
|
371
371
|
}
|
|
372
372
|
};
|
|
373
|
-
class
|
|
373
|
+
class ht {
|
|
374
374
|
get _$AU() {
|
|
375
375
|
var t;
|
|
376
376
|
return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
|
|
@@ -390,7 +390,7 @@ class vt {
|
|
|
390
390
|
return this._$AB;
|
|
391
391
|
}
|
|
392
392
|
_$AI(t, o = this) {
|
|
393
|
-
t =
|
|
393
|
+
t = ot(this, t, o), ut(t) ? t === u || t == null || t === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : t !== this._$AH && t !== j && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : io(t) ? this.k(t) : this._(t);
|
|
394
394
|
}
|
|
395
395
|
O(t) {
|
|
396
396
|
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
@@ -399,26 +399,26 @@ class vt {
|
|
|
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 && ut(this._$AH) ? this._$AA.nextSibling.data = t : this.T(G.createTextNode(t)), this._$AH = t;
|
|
403
403
|
}
|
|
404
404
|
$(t) {
|
|
405
405
|
var i;
|
|
406
|
-
const { values: o, _$litType$: r } = t, s = typeof r == "number" ? this._$AC(t) : (r.el === void 0 && (r.el =
|
|
406
|
+
const { values: o, _$litType$: r } = t, s = typeof r == "number" ? this._$AC(t) : (r.el === void 0 && (r.el = jt.createElement(Pe(r.h, r.h[0]), this.options)), r);
|
|
407
407
|
if (((i = this._$AH) == null ? void 0 : i._$AD) === s) this._$AH.p(o);
|
|
408
408
|
else {
|
|
409
|
-
const a = new
|
|
409
|
+
const a = new lo(s, this), l = a.u(this.options);
|
|
410
410
|
a.p(o), this.T(l), this._$AH = a;
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
_$AC(t) {
|
|
414
|
-
let o =
|
|
415
|
-
return o === void 0 &&
|
|
414
|
+
let o = ce.get(t.strings);
|
|
415
|
+
return o === void 0 && ce.set(t.strings, o = new jt(t)), o;
|
|
416
416
|
}
|
|
417
417
|
k(t) {
|
|
418
|
-
|
|
418
|
+
Wt(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
|
|
421
|
+
for (const i of t) s === o.length ? o.push(r = new ht(this.O(pt()), this.O(pt()), 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) {
|
|
@@ -433,7 +433,7 @@ class vt {
|
|
|
433
433
|
this._$AM === void 0 && (this._$Cv = t, (o = this._$AP) == null || o.call(this, t));
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
|
-
class
|
|
436
|
+
class Et {
|
|
437
437
|
get tagName() {
|
|
438
438
|
return this.element.tagName;
|
|
439
439
|
}
|
|
@@ -446,11 +446,11 @@ class Tt {
|
|
|
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 =
|
|
449
|
+
if (i === void 0) t = ot(this, t, o, 0), a = !ut(t) || t !== this._$AH && t !== j, a && (this._$AH = t);
|
|
450
450
|
else {
|
|
451
451
|
const l = t;
|
|
452
452
|
let n, d;
|
|
453
|
-
for (t = i[0], n = 0; n < i.length - 1; n++) d =
|
|
453
|
+
for (t = i[0], n = 0; n < i.length - 1; n++) d = ot(this, l[r + n], o, n), d === j && (d = this._$AH[n]), a || (a = !ut(d) || d !== this._$AH[n]), d === u ? t = u : t !== u && (t += (d ?? "") + i[n + 1]), this._$AH[n] = d;
|
|
454
454
|
}
|
|
455
455
|
a && !s && this.j(t);
|
|
456
456
|
}
|
|
@@ -458,7 +458,7 @@ class Tt {
|
|
|
458
458
|
t === u ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
let
|
|
461
|
+
let co = class extends Et {
|
|
462
462
|
constructor() {
|
|
463
463
|
super(...arguments), this.type = 3;
|
|
464
464
|
}
|
|
@@ -466,7 +466,7 @@ let no = class extends Tt {
|
|
|
466
466
|
this.element[this.name] = t === u ? void 0 : t;
|
|
467
467
|
}
|
|
468
468
|
};
|
|
469
|
-
class
|
|
469
|
+
class po extends Et {
|
|
470
470
|
constructor() {
|
|
471
471
|
super(...arguments), this.type = 4;
|
|
472
472
|
}
|
|
@@ -474,12 +474,12 @@ class lo extends Tt {
|
|
|
474
474
|
this.element.toggleAttribute(this.name, !!t && t !== u);
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
|
-
class
|
|
477
|
+
class uo extends Et {
|
|
478
478
|
constructor(t, o, r, s, i) {
|
|
479
479
|
super(t, o, r, s, i), this.type = 5;
|
|
480
480
|
}
|
|
481
481
|
_$AI(t, o = this) {
|
|
482
|
-
if ((t =
|
|
482
|
+
if ((t = ot(this, t, o, 0) ?? u) === j) return;
|
|
483
483
|
const r = this._$AH, s = t === u && r !== u || t.capture !== r.capture || t.once !== r.once || t.passive !== r.passive, i = t !== u && (r === u || s);
|
|
484
484
|
s && this.element.removeEventListener(this.name, this, r), i && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
485
485
|
}
|
|
@@ -488,7 +488,7 @@ class co extends Tt {
|
|
|
488
488
|
typeof this._$AH == "function" ? this._$AH.call(((o = this.options) == null ? void 0 : o.host) ?? this.element, t) : this._$AH.handleEvent(t);
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
|
-
class
|
|
491
|
+
class ho {
|
|
492
492
|
constructor(t, o, r) {
|
|
493
493
|
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = o, this.options = r;
|
|
494
494
|
}
|
|
@@ -496,17 +496,17 @@ class po {
|
|
|
496
496
|
return this._$AM._$AU;
|
|
497
497
|
}
|
|
498
498
|
_$AI(t) {
|
|
499
|
-
|
|
499
|
+
ot(this, t);
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
-
const
|
|
503
|
-
|
|
504
|
-
const
|
|
502
|
+
const zt = ct.litHtmlPolyfillSupport;
|
|
503
|
+
zt == null || zt(jt, ht), (ct.litHtmlVersions ?? (ct.litHtmlVersions = [])).push("3.2.1");
|
|
504
|
+
const fo = (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
|
|
509
|
+
r._$litPart$ = s = new ht(t.insertBefore(pt(), i), i, void 0, o ?? {});
|
|
510
510
|
}
|
|
511
511
|
return s._$AI(e), s;
|
|
512
512
|
};
|
|
@@ -515,7 +515,7 @@ const uo = (e, t, o) => {
|
|
|
515
515
|
* Copyright 2017 Google LLC
|
|
516
516
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
517
517
|
*/
|
|
518
|
-
let
|
|
518
|
+
let N = class extends tt {
|
|
519
519
|
constructor() {
|
|
520
520
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
521
521
|
}
|
|
@@ -526,7 +526,7 @@ let R = class extends rt {
|
|
|
526
526
|
}
|
|
527
527
|
update(t) {
|
|
528
528
|
const o = this.render();
|
|
529
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do =
|
|
529
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = fo(o, this.renderRoot, this.renderOptions);
|
|
530
530
|
}
|
|
531
531
|
connectedCallback() {
|
|
532
532
|
var t;
|
|
@@ -537,20 +537,20 @@ let R = class extends rt {
|
|
|
537
537
|
super.disconnectedCallback(), (t = this._$Do) == null || t.setConnected(!1);
|
|
538
538
|
}
|
|
539
539
|
render() {
|
|
540
|
-
return
|
|
540
|
+
return j;
|
|
541
541
|
}
|
|
542
542
|
};
|
|
543
|
-
var
|
|
544
|
-
|
|
545
|
-
const
|
|
546
|
-
|
|
543
|
+
var Se;
|
|
544
|
+
N._$litElement$ = !0, N.finalized = !0, (Se = globalThis.litElementHydrateSupport) == null || Se.call(globalThis, { LitElement: N });
|
|
545
|
+
const Mt = globalThis.litElementPolyfillSupport;
|
|
546
|
+
Mt == null || Mt({ LitElement: N });
|
|
547
547
|
(globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.1.1");
|
|
548
548
|
/**
|
|
549
549
|
* @license
|
|
550
550
|
* Copyright 2017 Google LLC
|
|
551
551
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
552
552
|
*/
|
|
553
|
-
const
|
|
553
|
+
const F = (e) => (t, o) => {
|
|
554
554
|
o !== void 0 ? o.addInitializer(() => {
|
|
555
555
|
customElements.define(e, t);
|
|
556
556
|
}) : customElements.define(e, t);
|
|
@@ -560,7 +560,7 @@ const W = (e) => (t, o) => {
|
|
|
560
560
|
* Copyright 2017 Google LLC
|
|
561
561
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
562
562
|
*/
|
|
563
|
-
const
|
|
563
|
+
const go = { attribute: !0, type: String, converter: xt, reflect: !1, hasChanged: Yt }, mo = (e = go, t, o) => {
|
|
564
564
|
const { kind: r, metadata: s } = o;
|
|
565
565
|
let i = globalThis.litPropertyMetadata.get(s);
|
|
566
566
|
if (i === void 0 && globalThis.litPropertyMetadata.set(s, i = /* @__PURE__ */ new Map()), i.set(o.name, e), r === "accessor") {
|
|
@@ -581,8 +581,8 @@ const ho = { attribute: !0, type: String, converter: kt, reflect: !1, hasChanged
|
|
|
581
581
|
}
|
|
582
582
|
throw Error("Unsupported decorator location: " + r);
|
|
583
583
|
};
|
|
584
|
-
function
|
|
585
|
-
return (t, o) => typeof o == "object" ?
|
|
584
|
+
function h(e) {
|
|
585
|
+
return (t, o) => typeof o == "object" ? mo(e, t, o) : ((r, s, i) => {
|
|
586
586
|
const a = s.hasOwnProperty(i);
|
|
587
587
|
return s.constructor.createProperty(i, a ? { ...r, wrapped: !0 } : r), a ? Object.getOwnPropertyDescriptor(s, i) : void 0;
|
|
588
588
|
})(e, t, o);
|
|
@@ -592,33 +592,33 @@ function f(e) {
|
|
|
592
592
|
* Copyright 2017 Google LLC
|
|
593
593
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
594
594
|
*/
|
|
595
|
-
function
|
|
596
|
-
return
|
|
595
|
+
function C(e) {
|
|
596
|
+
return h({ ...e, state: !0, attribute: !1 });
|
|
597
597
|
}
|
|
598
598
|
/**
|
|
599
599
|
* @license
|
|
600
600
|
* Copyright 2017 Google LLC
|
|
601
601
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
602
602
|
*/
|
|
603
|
-
const
|
|
603
|
+
const vo = (e, t, o) => (o.configurable = !0, o.enumerable = !0, Reflect.decorate && typeof t != "object" && Object.defineProperty(e, t, o), o);
|
|
604
604
|
/**
|
|
605
605
|
* @license
|
|
606
606
|
* Copyright 2017 Google LLC
|
|
607
607
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
608
608
|
*/
|
|
609
|
-
function
|
|
609
|
+
function ft(e, t) {
|
|
610
610
|
return (o, r, s) => {
|
|
611
611
|
const i = (a) => {
|
|
612
612
|
var l;
|
|
613
613
|
return ((l = a.renderRoot) == null ? void 0 : l.querySelector(e)) ?? null;
|
|
614
614
|
};
|
|
615
|
-
return
|
|
615
|
+
return vo(o, r, { get() {
|
|
616
616
|
return i(this);
|
|
617
617
|
} });
|
|
618
618
|
};
|
|
619
619
|
}
|
|
620
|
-
var
|
|
621
|
-
const
|
|
620
|
+
var $ = /* @__PURE__ */ ((e) => (e.reaction = "reaction", e.stars = "stars", e.poll = "poll", e.text = "text", e.nps = "nps", e))($ || {});
|
|
621
|
+
const Kt = c`
|
|
622
622
|
<svg
|
|
623
623
|
xmlns="http://www.w3.org/2000/svg"
|
|
624
624
|
height="24px"
|
|
@@ -628,7 +628,7 @@ const Xt = c`
|
|
|
628
628
|
>
|
|
629
629
|
<path d="M640-160v-280h160v280H640Zm-240 0v-640h160v640H400Zm-240 0v-440h160v440H160Z" />
|
|
630
630
|
</svg>
|
|
631
|
-
`,
|
|
631
|
+
`, Gt = c`
|
|
632
632
|
<svg
|
|
633
633
|
xmlns="http://www.w3.org/2000/svg"
|
|
634
634
|
height="24px"
|
|
@@ -640,7 +640,7 @@ const Xt = c`
|
|
|
640
640
|
d="M160-160v-440h160v440H160Zm240 0v-400l160 160v240H400Zm160-354L400-674v-126h160v286Zm240 240L640-434v-6h160v166Zm-9 219L55-791l57-57 736 736-57 57Z"
|
|
641
641
|
/>
|
|
642
642
|
</svg>
|
|
643
|
-
`,
|
|
643
|
+
`, St = c`
|
|
644
644
|
<svg
|
|
645
645
|
xmlns="http://www.w3.org/2000/svg"
|
|
646
646
|
height="24px"
|
|
@@ -652,7 +652,7 @@ const Xt = c`
|
|
|
652
652
|
d="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z"
|
|
653
653
|
/>
|
|
654
654
|
</svg>
|
|
655
|
-
`,
|
|
655
|
+
`, At = c`
|
|
656
656
|
<svg
|
|
657
657
|
xmlns="http://www.w3.org/2000/svg"
|
|
658
658
|
width="16"
|
|
@@ -664,7 +664,7 @@ const Xt = c`
|
|
|
664
664
|
d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"
|
|
665
665
|
/>
|
|
666
666
|
</svg>
|
|
667
|
-
`,
|
|
667
|
+
`, _e = c`
|
|
668
668
|
<svg
|
|
669
669
|
xmlns="http://www.w3.org/2000/svg"
|
|
670
670
|
height="24px"
|
|
@@ -675,164 +675,164 @@ const Xt = c`
|
|
|
675
675
|
<path d="M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z" />
|
|
676
676
|
</svg>
|
|
677
677
|
`;
|
|
678
|
-
var
|
|
678
|
+
var bo = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, z = function(e) {
|
|
679
679
|
return typeof e == "string" ? e.length > 0 : typeof e == "number";
|
|
680
|
-
},
|
|
680
|
+
}, S = function(e, t, o) {
|
|
681
681
|
return t === void 0 && (t = 0), o === void 0 && (o = Math.pow(10, t)), Math.round(o * e) / o + 0;
|
|
682
|
-
},
|
|
682
|
+
}, E = function(e, t, o) {
|
|
683
683
|
return t === void 0 && (t = 0), o === void 0 && (o = 1), e > o ? o : e > t ? e : t;
|
|
684
|
-
},
|
|
684
|
+
}, Oe = function(e) {
|
|
685
685
|
return (e = isFinite(e) ? e % 360 : 0) > 0 ? e : e + 360;
|
|
686
|
-
},
|
|
687
|
-
return { r:
|
|
688
|
-
},
|
|
689
|
-
return { r:
|
|
690
|
-
},
|
|
686
|
+
}, de = function(e) {
|
|
687
|
+
return { r: E(e.r, 0, 255), g: E(e.g, 0, 255), b: E(e.b, 0, 255), a: E(e.a) };
|
|
688
|
+
}, Lt = function(e) {
|
|
689
|
+
return { r: S(e.r), g: S(e.g), b: S(e.b), a: S(e.a, 3) };
|
|
690
|
+
}, yo = /^#([0-9a-f]{3,8})$/i, vt = function(e) {
|
|
691
691
|
var t = e.toString(16);
|
|
692
692
|
return t.length < 2 ? "0" + t : t;
|
|
693
|
-
},
|
|
693
|
+
}, Ie = function(e) {
|
|
694
694
|
var t = e.r, o = e.g, r = e.b, s = e.a, i = Math.max(t, o, r), a = i - Math.min(t, o, r), l = a ? i === t ? (o - r) / a : i === o ? 2 + (r - t) / a : 4 + (t - o) / a : 0;
|
|
695
695
|
return { h: 60 * (l < 0 ? l + 6 : l), s: i ? a / i * 100 : 0, v: i / 255 * 100, a: s };
|
|
696
|
-
},
|
|
696
|
+
}, ze = function(e) {
|
|
697
697
|
var t = e.h, o = e.s, r = e.v, s = e.a;
|
|
698
698
|
t = t / 360 * 6, o /= 100, r /= 100;
|
|
699
699
|
var i = Math.floor(t), a = r * (1 - o), l = r * (1 - (t - i) * o), n = r * (1 - (1 - t + i) * o), d = i % 6;
|
|
700
700
|
return { r: 255 * [r, l, a, a, n, r][d], g: 255 * [n, r, r, l, a, a][d], b: 255 * [a, a, n, r, r, l][d], a: s };
|
|
701
|
-
},
|
|
702
|
-
return { h:
|
|
703
|
-
},
|
|
704
|
-
return { h:
|
|
705
|
-
},
|
|
706
|
-
return
|
|
701
|
+
}, pe = function(e) {
|
|
702
|
+
return { h: Oe(e.h), s: E(e.s, 0, 100), l: E(e.l, 0, 100), a: E(e.a) };
|
|
703
|
+
}, ue = function(e) {
|
|
704
|
+
return { h: S(e.h), s: S(e.s), l: S(e.l), a: S(e.a, 3) };
|
|
705
|
+
}, he = function(e) {
|
|
706
|
+
return ze((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 }));
|
|
707
707
|
var t, o, r;
|
|
708
|
-
},
|
|
709
|
-
return { h: (t =
|
|
708
|
+
}, dt = function(e) {
|
|
709
|
+
return { h: (t = Ie(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 };
|
|
710
710
|
var t, o, r, s;
|
|
711
|
-
},
|
|
712
|
-
var t =
|
|
713
|
-
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 ?
|
|
711
|
+
}, wo = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, xo = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, $o = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, So = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, fe = { string: [[function(e) {
|
|
712
|
+
var t = yo.exec(e);
|
|
713
|
+
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 ? S(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 ? S(parseInt(e.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
|
|
714
714
|
}, "hex"], [function(e) {
|
|
715
|
-
var t =
|
|
716
|
-
return t ? t[2] !== t[4] || t[4] !== t[6] ? null :
|
|
715
|
+
var t = $o.exec(e) || So.exec(e);
|
|
716
|
+
return t ? t[2] !== t[4] || t[4] !== t[6] ? null : de({ 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;
|
|
717
717
|
}, "rgb"], [function(e) {
|
|
718
|
-
var t =
|
|
718
|
+
var t = wo.exec(e) || xo.exec(e);
|
|
719
719
|
if (!t) return null;
|
|
720
|
-
var o, r, s =
|
|
721
|
-
return
|
|
720
|
+
var o, r, s = pe({ h: (o = t[1], r = t[2], r === void 0 && (r = "deg"), Number(o) * (bo[r] || 1)), s: Number(t[3]), l: Number(t[4]), a: t[5] === void 0 ? 1 : Number(t[5]) / (t[6] ? 100 : 1) });
|
|
721
|
+
return he(s);
|
|
722
722
|
}, "hsl"]], object: [[function(e) {
|
|
723
723
|
var t = e.r, o = e.g, r = e.b, s = e.a, i = s === void 0 ? 1 : s;
|
|
724
|
-
return
|
|
724
|
+
return z(t) && z(o) && z(r) ? de({ r: Number(t), g: Number(o), b: Number(r), a: Number(i) }) : null;
|
|
725
725
|
}, "rgb"], [function(e) {
|
|
726
726
|
var t = e.h, o = e.s, r = e.l, s = e.a, i = s === void 0 ? 1 : s;
|
|
727
|
-
if (!
|
|
728
|
-
var a =
|
|
729
|
-
return
|
|
727
|
+
if (!z(t) || !z(o) || !z(r)) return null;
|
|
728
|
+
var a = pe({ h: Number(t), s: Number(o), l: Number(r), a: Number(i) });
|
|
729
|
+
return he(a);
|
|
730
730
|
}, "hsl"], [function(e) {
|
|
731
731
|
var t = e.h, o = e.s, r = e.v, s = e.a, i = s === void 0 ? 1 : s;
|
|
732
|
-
if (!
|
|
732
|
+
if (!z(t) || !z(o) || !z(r)) return null;
|
|
733
733
|
var a = function(l) {
|
|
734
|
-
return { h:
|
|
734
|
+
return { h: Oe(l.h), s: E(l.s, 0, 100), v: E(l.v, 0, 100), a: E(l.a) };
|
|
735
735
|
}({ h: Number(t), s: Number(o), v: Number(r), a: Number(i) });
|
|
736
|
-
return
|
|
737
|
-
}, "hsv"]] },
|
|
736
|
+
return ze(a);
|
|
737
|
+
}, "hsv"]] }, ge = function(e, t) {
|
|
738
738
|
for (var o = 0; o < t.length; o++) {
|
|
739
739
|
var r = t[o][0](e);
|
|
740
740
|
if (r) return [r, t[o][1]];
|
|
741
741
|
}
|
|
742
742
|
return [null, void 0];
|
|
743
|
-
},
|
|
744
|
-
return typeof e == "string" ?
|
|
745
|
-
},
|
|
746
|
-
var o =
|
|
747
|
-
return { h: o.h, s:
|
|
748
|
-
},
|
|
743
|
+
}, Co = function(e) {
|
|
744
|
+
return typeof e == "string" ? ge(e.trim(), fe.string) : typeof e == "object" && e !== null ? ge(e, fe.object) : [null, void 0];
|
|
745
|
+
}, Nt = function(e, t) {
|
|
746
|
+
var o = dt(e);
|
|
747
|
+
return { h: o.h, s: E(o.s + 100 * t, 0, 100), l: o.l, a: o.a };
|
|
748
|
+
}, Dt = function(e) {
|
|
749
749
|
return (299 * e.r + 587 * e.g + 114 * e.b) / 1e3 / 255;
|
|
750
|
-
},
|
|
751
|
-
var o =
|
|
752
|
-
return { h: o.h, s: o.s, l:
|
|
753
|
-
},
|
|
750
|
+
}, me = function(e, t) {
|
|
751
|
+
var o = dt(e);
|
|
752
|
+
return { h: o.h, s: o.s, l: E(o.l + 100 * t, 0, 100), a: o.a };
|
|
753
|
+
}, ve = function() {
|
|
754
754
|
function e(t) {
|
|
755
|
-
this.parsed =
|
|
755
|
+
this.parsed = Co(t)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
|
|
756
756
|
}
|
|
757
757
|
return e.prototype.isValid = function() {
|
|
758
758
|
return this.parsed !== null;
|
|
759
759
|
}, e.prototype.brightness = function() {
|
|
760
|
-
return
|
|
760
|
+
return S(Dt(this.rgba), 2);
|
|
761
761
|
}, e.prototype.isDark = function() {
|
|
762
|
-
return
|
|
762
|
+
return Dt(this.rgba) < 0.5;
|
|
763
763
|
}, e.prototype.isLight = function() {
|
|
764
|
-
return
|
|
764
|
+
return Dt(this.rgba) >= 0.5;
|
|
765
765
|
}, e.prototype.toHex = function() {
|
|
766
|
-
return t =
|
|
766
|
+
return t = Lt(this.rgba), o = t.r, r = t.g, s = t.b, a = (i = t.a) < 1 ? vt(S(255 * i)) : "", "#" + vt(o) + vt(r) + vt(s) + a;
|
|
767
767
|
var t, o, r, s, i, a;
|
|
768
768
|
}, e.prototype.toRgb = function() {
|
|
769
|
-
return
|
|
769
|
+
return Lt(this.rgba);
|
|
770
770
|
}, e.prototype.toRgbString = function() {
|
|
771
|
-
return t =
|
|
771
|
+
return t = Lt(this.rgba), o = t.r, r = t.g, s = t.b, (i = t.a) < 1 ? "rgba(" + o + ", " + r + ", " + s + ", " + i + ")" : "rgb(" + o + ", " + r + ", " + s + ")";
|
|
772
772
|
var t, o, r, s, i;
|
|
773
773
|
}, e.prototype.toHsl = function() {
|
|
774
|
-
return
|
|
774
|
+
return ue(dt(this.rgba));
|
|
775
775
|
}, e.prototype.toHslString = function() {
|
|
776
|
-
return t =
|
|
776
|
+
return t = ue(dt(this.rgba)), o = t.h, r = t.s, s = t.l, (i = t.a) < 1 ? "hsla(" + o + ", " + r + "%, " + s + "%, " + i + ")" : "hsl(" + o + ", " + r + "%, " + s + "%)";
|
|
777
777
|
var t, o, r, s, i;
|
|
778
778
|
}, e.prototype.toHsv = function() {
|
|
779
|
-
return t =
|
|
779
|
+
return t = Ie(this.rgba), { h: S(t.h), s: S(t.s), v: S(t.v), a: S(t.a, 3) };
|
|
780
780
|
var t;
|
|
781
781
|
}, e.prototype.invert = function() {
|
|
782
|
-
return
|
|
782
|
+
return P({ r: 255 - (t = this.rgba).r, g: 255 - t.g, b: 255 - t.b, a: t.a });
|
|
783
783
|
var t;
|
|
784
784
|
}, e.prototype.saturate = function(t) {
|
|
785
|
-
return t === void 0 && (t = 0.1),
|
|
785
|
+
return t === void 0 && (t = 0.1), P(Nt(this.rgba, t));
|
|
786
786
|
}, e.prototype.desaturate = function(t) {
|
|
787
|
-
return t === void 0 && (t = 0.1),
|
|
787
|
+
return t === void 0 && (t = 0.1), P(Nt(this.rgba, -t));
|
|
788
788
|
}, e.prototype.grayscale = function() {
|
|
789
|
-
return
|
|
789
|
+
return P(Nt(this.rgba, -1));
|
|
790
790
|
}, e.prototype.lighten = function(t) {
|
|
791
|
-
return t === void 0 && (t = 0.1),
|
|
791
|
+
return t === void 0 && (t = 0.1), P(me(this.rgba, t));
|
|
792
792
|
}, e.prototype.darken = function(t) {
|
|
793
|
-
return t === void 0 && (t = 0.1),
|
|
793
|
+
return t === void 0 && (t = 0.1), P(me(this.rgba, -t));
|
|
794
794
|
}, e.prototype.rotate = function(t) {
|
|
795
795
|
return t === void 0 && (t = 15), this.hue(this.hue() + t);
|
|
796
796
|
}, e.prototype.alpha = function(t) {
|
|
797
|
-
return typeof t == "number" ?
|
|
797
|
+
return typeof t == "number" ? P({ r: (o = this.rgba).r, g: o.g, b: o.b, a: t }) : S(this.rgba.a, 3);
|
|
798
798
|
var o;
|
|
799
799
|
}, e.prototype.hue = function(t) {
|
|
800
|
-
var o =
|
|
801
|
-
return typeof t == "number" ?
|
|
800
|
+
var o = dt(this.rgba);
|
|
801
|
+
return typeof t == "number" ? P({ h: t, s: o.s, l: o.l, a: o.a }) : S(o.h);
|
|
802
802
|
}, e.prototype.isEqual = function(t) {
|
|
803
|
-
return this.toHex() ===
|
|
803
|
+
return this.toHex() === P(t).toHex();
|
|
804
804
|
}, e;
|
|
805
|
-
}(),
|
|
806
|
-
return e instanceof
|
|
805
|
+
}(), P = function(e) {
|
|
806
|
+
return e instanceof ve ? e : new ve(e);
|
|
807
807
|
};
|
|
808
|
-
const
|
|
809
|
-
function
|
|
810
|
-
if (
|
|
808
|
+
const ko = typeof process < "u" && (process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test");
|
|
809
|
+
function Rt() {
|
|
810
|
+
if (ko) return !0;
|
|
811
811
|
try {
|
|
812
812
|
return typeof localStorage < "u" && localStorage.getItem("pc-mode") === "development";
|
|
813
813
|
} catch {
|
|
814
814
|
return !1;
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
|
-
function
|
|
817
|
+
function Eo(e) {
|
|
818
818
|
return {
|
|
819
819
|
debug: (t, ...o) => {
|
|
820
|
-
|
|
820
|
+
Rt() && console.debug(`[${e}]`, t, ...o);
|
|
821
821
|
},
|
|
822
822
|
info: (t, ...o) => {
|
|
823
|
-
|
|
823
|
+
Rt() && console.info(`[${e}]`, t, ...o);
|
|
824
824
|
},
|
|
825
825
|
warn: (t, ...o) => {
|
|
826
|
-
|
|
826
|
+
Rt() && console.warn(`[${e}]`, t, ...o);
|
|
827
827
|
},
|
|
828
828
|
error: (t, ...o) => {
|
|
829
829
|
console.error(`[${e}]`, t, ...o);
|
|
830
830
|
}
|
|
831
831
|
};
|
|
832
832
|
}
|
|
833
|
-
const g =
|
|
834
|
-
var
|
|
835
|
-
const
|
|
833
|
+
const g = Eo("Pollcatch");
|
|
834
|
+
var Me = /* @__PURE__ */ ((e) => (e[e.AA_NORMAL = 4.5] = "AA_NORMAL", e[e.AA_LARGE = 3] = "AA_LARGE", e[e.AAA_NORMAL = 7] = "AAA_NORMAL", e[e.AAA_LARGE = 4.5] = "AAA_LARGE", e))(Me || {});
|
|
835
|
+
const Ao = {
|
|
836
836
|
black: "#000000",
|
|
837
837
|
white: "#ffffff",
|
|
838
838
|
red: "#ff0000",
|
|
@@ -849,20 +849,20 @@ const ko = {
|
|
|
849
849
|
teal: "#008080",
|
|
850
850
|
navy: "#000080"
|
|
851
851
|
};
|
|
852
|
-
function
|
|
852
|
+
function Po(e) {
|
|
853
853
|
const t = e.toLowerCase().trim();
|
|
854
|
-
return
|
|
854
|
+
return Ao[t] || null;
|
|
855
855
|
}
|
|
856
|
-
function
|
|
857
|
-
const o =
|
|
856
|
+
function Bt(e, t) {
|
|
857
|
+
const o = be(e), r = be(t), s = Math.max(o, r), i = Math.min(o, r);
|
|
858
858
|
return (s + 0.05) / (i + 0.05);
|
|
859
859
|
}
|
|
860
|
-
function
|
|
861
|
-
const t =
|
|
860
|
+
function be(e) {
|
|
861
|
+
const t = _o(e), o = t.r / 255, r = t.g / 255, s = t.b / 255, i = o <= 0.03928 ? o / 12.92 : Math.pow((o + 0.055) / 1.055, 2.4), a = r <= 0.03928 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4), l = s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4);
|
|
862
862
|
return 0.2126 * i + 0.7152 * a + 0.0722 * l;
|
|
863
863
|
}
|
|
864
|
-
function
|
|
865
|
-
if (!
|
|
864
|
+
function To(e, t = {}) {
|
|
865
|
+
if (!P(e).isValid())
|
|
866
866
|
return g.warn(`Invalid color provided: ${e}`), "black";
|
|
867
867
|
const {
|
|
868
868
|
minContrast: r = 4.5,
|
|
@@ -875,16 +875,16 @@ function Ao(e, t = {}) {
|
|
|
875
875
|
} = t, l = s.map((p) => p === "black" ? "#000000" : p === "white" ? "#ffffff" : p === "light" ? i.light || "#f8f9fa" : p === "dark" ? i.dark || "#343a40" : p);
|
|
876
876
|
let n = a, d = 0;
|
|
877
877
|
for (const p of l) {
|
|
878
|
-
const
|
|
879
|
-
|
|
878
|
+
const f = Bt(e, p);
|
|
879
|
+
f >= r && f > d && (d = f, n = p);
|
|
880
880
|
}
|
|
881
881
|
if (d === 0) {
|
|
882
|
-
const p =
|
|
882
|
+
const p = Bt(e, a);
|
|
883
883
|
n = a, d = p;
|
|
884
|
-
for (const
|
|
885
|
-
if (
|
|
886
|
-
const
|
|
887
|
-
|
|
884
|
+
for (const f of l) {
|
|
885
|
+
if (f === a) continue;
|
|
886
|
+
const b = Bt(e, f);
|
|
887
|
+
b > d && (d = b, n = f);
|
|
888
888
|
}
|
|
889
889
|
g.warn(
|
|
890
890
|
`No color option met the minimum contrast ratio of ${r}:1 against ${e}. Using ${n} with contrast ratio ${d.toFixed(2)}:1 instead.`
|
|
@@ -892,14 +892,14 @@ function Ao(e, t = {}) {
|
|
|
892
892
|
}
|
|
893
893
|
return n;
|
|
894
894
|
}
|
|
895
|
-
function
|
|
896
|
-
const o =
|
|
895
|
+
function _o(e) {
|
|
896
|
+
const o = Po(e) || e, r = P(o);
|
|
897
897
|
if (!r.isValid())
|
|
898
898
|
return g.warn(`Invalid color provided: ${e}`), { r: 0, g: 0, b: 0 };
|
|
899
899
|
const { r: s, g: i, b: a } = r.toRgb();
|
|
900
900
|
return { r: s, g: i, b: a };
|
|
901
901
|
}
|
|
902
|
-
function
|
|
902
|
+
function _(e, t) {
|
|
903
903
|
const r = t ? {
|
|
904
904
|
left: "start",
|
|
905
905
|
right: "end",
|
|
@@ -911,7 +911,7 @@ function z(e, t) {
|
|
|
911
911
|
}[t] : void 0;
|
|
912
912
|
return e === "left" || e === "right" ? r || "center" : e === "top" || e === "bottom" ? r || "start" : r || "center";
|
|
913
913
|
}
|
|
914
|
-
function
|
|
914
|
+
function Vt(e, t = "1rem", o = 1) {
|
|
915
915
|
if (!e) return t;
|
|
916
916
|
const r = {
|
|
917
917
|
xs: 0.7,
|
|
@@ -930,7 +930,7 @@ function qt(e, t = "1rem", o = 1) {
|
|
|
930
930
|
const l = parseFloat(i);
|
|
931
931
|
return isNaN(l) ? t : `${l}rem`;
|
|
932
932
|
}
|
|
933
|
-
function
|
|
933
|
+
function Oo(e, t = "4px") {
|
|
934
934
|
if (!e) return t;
|
|
935
935
|
const o = {
|
|
936
936
|
xs: "2px",
|
|
@@ -950,8 +950,8 @@ function To(e, t = "4px") {
|
|
|
950
950
|
const a = parseFloat(s);
|
|
951
951
|
return isNaN(a) ? t : `${a}px`;
|
|
952
952
|
}
|
|
953
|
-
var
|
|
954
|
-
function
|
|
953
|
+
var M = /* @__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))(M || {});
|
|
954
|
+
function et(e) {
|
|
955
955
|
const t = {};
|
|
956
956
|
e.role !== void 0 && (t.role = e.role);
|
|
957
957
|
for (const [o, r] of Object.entries(e)) {
|
|
@@ -961,54 +961,54 @@ function st(e) {
|
|
|
961
961
|
}
|
|
962
962
|
return t;
|
|
963
963
|
}
|
|
964
|
-
function
|
|
965
|
-
return
|
|
964
|
+
function Io(e, t, o) {
|
|
965
|
+
return et({
|
|
966
966
|
role: "button",
|
|
967
967
|
ariaLabel: e,
|
|
968
968
|
ariaPressed: t,
|
|
969
969
|
ariaDisabled: o
|
|
970
970
|
});
|
|
971
971
|
}
|
|
972
|
-
function
|
|
973
|
-
return
|
|
972
|
+
function zo(e, t, o, r = !1) {
|
|
973
|
+
return et({
|
|
974
974
|
role: r ? "radio" : "checkbox",
|
|
975
975
|
ariaLabel: e,
|
|
976
976
|
ariaChecked: t,
|
|
977
977
|
ariaDisabled: o
|
|
978
978
|
});
|
|
979
979
|
}
|
|
980
|
-
function
|
|
980
|
+
function Ut(e, t, o) {
|
|
981
981
|
typeof o == "boolean" ? e.setAttribute(t, o ? "true" : "false") : e.setAttribute(t, o);
|
|
982
982
|
}
|
|
983
|
-
function
|
|
983
|
+
function Mo(e) {
|
|
984
984
|
if (typeof e != "string")
|
|
985
985
|
return !1;
|
|
986
986
|
const t = e.replace(/[<>"']/g, "").trim();
|
|
987
987
|
return /^(#[0-9a-fA-F]{3,8}|rgb\([^)]+\)|rgba\([^)]+\)|hsl\([^)]+\)|hsla\([^)]+\)|[a-zA-Z]+)$/.test(t);
|
|
988
988
|
}
|
|
989
|
-
function
|
|
990
|
-
return
|
|
989
|
+
function Q(e) {
|
|
990
|
+
return Mo(e) ? e.replace(/[<>"']/g, "").trim() : (g.warn("Invalid color value:", e), "#000000");
|
|
991
991
|
}
|
|
992
|
-
function
|
|
992
|
+
function Lo(e) {
|
|
993
993
|
if (typeof e != "string")
|
|
994
994
|
return g.warn("Non-string value passed to sanitizeCSS:", typeof e), "";
|
|
995
995
|
let t = e;
|
|
996
996
|
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;
|
|
997
997
|
}
|
|
998
|
-
function
|
|
998
|
+
function No(e) {
|
|
999
999
|
return typeof e != "string" || !e.trim() ? "" : e.replace(
|
|
1000
1000
|
/([^{}:;]+):\s*([^;{}!]+)(\s*!important)?\s*(;|})/gi,
|
|
1001
1001
|
(t, o, r, s, i) => s ? t : `${o}: ${r.trim()} !important${i}`
|
|
1002
1002
|
);
|
|
1003
1003
|
}
|
|
1004
|
-
const
|
|
1005
|
-
function
|
|
1004
|
+
const Do = "https://jpxwfjorwcsrqraorpbj.supabase.co/functions/v1/data", Ro = "pc_session_id", Bo = 24 * 60 * 60 * 1e3;
|
|
1005
|
+
function ye() {
|
|
1006
1006
|
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) {
|
|
1007
1007
|
const t = Math.random() * 16 | 0;
|
|
1008
1008
|
return (e === "x" ? t : t & 3 | 8).toString(16);
|
|
1009
1009
|
}));
|
|
1010
1010
|
}
|
|
1011
|
-
function
|
|
1011
|
+
function Zt() {
|
|
1012
1012
|
const e = "test-local-storage";
|
|
1013
1013
|
try {
|
|
1014
1014
|
return localStorage.setItem(e, e), localStorage.removeItem(e), !0;
|
|
@@ -1016,7 +1016,7 @@ function te() {
|
|
|
1016
1016
|
return g.warn("localStorage not available, session ID will not persist"), !1;
|
|
1017
1017
|
}
|
|
1018
1018
|
}
|
|
1019
|
-
function
|
|
1019
|
+
function Le(e) {
|
|
1020
1020
|
try {
|
|
1021
1021
|
const t = localStorage.getItem(e);
|
|
1022
1022
|
return t ? JSON.parse(t) : void 0;
|
|
@@ -1025,34 +1025,34 @@ function Be(e) {
|
|
|
1025
1025
|
return;
|
|
1026
1026
|
}
|
|
1027
1027
|
}
|
|
1028
|
-
function
|
|
1028
|
+
function Ne(e, t) {
|
|
1029
1029
|
try {
|
|
1030
1030
|
return localStorage.setItem(e, JSON.stringify(t)), !0;
|
|
1031
1031
|
} catch (o) {
|
|
1032
1032
|
return g.warn(`Failed to set item in localStorage: ${e}`, o), !1;
|
|
1033
1033
|
}
|
|
1034
1034
|
}
|
|
1035
|
-
async function
|
|
1036
|
-
const e =
|
|
1037
|
-
if (
|
|
1038
|
-
const o =
|
|
1035
|
+
async function we() {
|
|
1036
|
+
const e = Ro, t = Bo;
|
|
1037
|
+
if (Zt()) {
|
|
1038
|
+
const o = Le(e);
|
|
1039
1039
|
if (o && o.id && o.timestamp && Date.now() - o.timestamp < t)
|
|
1040
1040
|
return g.debug("Using existing session ID from localStorage"), o.id;
|
|
1041
1041
|
g.debug(
|
|
1042
1042
|
o ? "Session ID expired" : "No session ID found",
|
|
1043
1043
|
"generating new one"
|
|
1044
1044
|
);
|
|
1045
|
-
const r =
|
|
1046
|
-
return
|
|
1045
|
+
const r = ye();
|
|
1046
|
+
return Ne(e, {
|
|
1047
1047
|
id: r,
|
|
1048
1048
|
timestamp: Date.now()
|
|
1049
1049
|
}) ? g.debug("Generated and stored new session ID") : g.warn("Generated session ID but failed to store it"), r;
|
|
1050
1050
|
} else {
|
|
1051
|
-
const o =
|
|
1051
|
+
const o = ye();
|
|
1052
1052
|
return g.debug("Generated non-persistent session ID"), o;
|
|
1053
1053
|
}
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1055
|
+
function Ct(e) {
|
|
1056
1056
|
if (!e || typeof e != "object")
|
|
1057
1057
|
return 0;
|
|
1058
1058
|
let t = 0, o = 0, r = 0;
|
|
@@ -1065,7 +1065,7 @@ function ft(e) {
|
|
|
1065
1065
|
const s = t / r * 100, i = o / r * 100;
|
|
1066
1066
|
return Math.round(s - i);
|
|
1067
1067
|
}
|
|
1068
|
-
function
|
|
1068
|
+
function Vo(e) {
|
|
1069
1069
|
if (!e || typeof e != "object")
|
|
1070
1070
|
return { promoters: 0, passives: 0, detractors: 0 };
|
|
1071
1071
|
let t = 0, o = 0, r = 0;
|
|
@@ -1075,14 +1075,14 @@ function No(e) {
|
|
|
1075
1075
|
}
|
|
1076
1076
|
return { promoters: t, passives: o, detractors: r };
|
|
1077
1077
|
}
|
|
1078
|
-
function
|
|
1078
|
+
function Uo(e, t) {
|
|
1079
1079
|
const o = {};
|
|
1080
1080
|
for (const r of t)
|
|
1081
1081
|
o[r] = e[r] || 0;
|
|
1082
1082
|
return o;
|
|
1083
1083
|
}
|
|
1084
|
-
function
|
|
1085
|
-
const o = t ?
|
|
1084
|
+
function jo(e, t) {
|
|
1085
|
+
const o = t ? Uo(e, t) : e;
|
|
1086
1086
|
let r = 0, s = 0;
|
|
1087
1087
|
for (const [a, l] of Object.entries(o)) {
|
|
1088
1088
|
s += l;
|
|
@@ -1091,7 +1091,7 @@ function Ce(e, t) {
|
|
|
1091
1091
|
}
|
|
1092
1092
|
return { avg: s > 0 ? Math.round(r / s * 10) / 10 : 0, count: s, sum: r, breakdown: o };
|
|
1093
1093
|
}
|
|
1094
|
-
function
|
|
1094
|
+
function L() {
|
|
1095
1095
|
return {
|
|
1096
1096
|
count: 0,
|
|
1097
1097
|
sum: 0,
|
|
@@ -1101,26 +1101,26 @@ function N() {
|
|
|
1101
1101
|
updated: (/* @__PURE__ */ new Date()).toISOString()
|
|
1102
1102
|
};
|
|
1103
1103
|
}
|
|
1104
|
-
function
|
|
1105
|
-
if (!
|
|
1106
|
-
return
|
|
1104
|
+
function qo(e) {
|
|
1105
|
+
if (!Zt())
|
|
1106
|
+
return L();
|
|
1107
1107
|
try {
|
|
1108
|
-
const t =
|
|
1109
|
-
return t ? { ...
|
|
1108
|
+
const t = Le(e);
|
|
1109
|
+
return t ? { ...L(), ...t } : L();
|
|
1110
1110
|
} catch (t) {
|
|
1111
|
-
return g.warn("Failed to load localStats from localStorage", t),
|
|
1111
|
+
return g.warn("Failed to load localStats from localStorage", t), L();
|
|
1112
1112
|
}
|
|
1113
1113
|
}
|
|
1114
|
-
function
|
|
1115
|
-
if (!
|
|
1114
|
+
function Ho(e, t) {
|
|
1115
|
+
if (!Zt())
|
|
1116
1116
|
return !1;
|
|
1117
1117
|
try {
|
|
1118
|
-
return
|
|
1118
|
+
return Ne(e, t) ? (g.debug("Saved localStats to localStorage", t), !0) : !1;
|
|
1119
1119
|
} catch (o) {
|
|
1120
1120
|
return g.warn("Failed to save localStats to localStorage", o), !1;
|
|
1121
1121
|
}
|
|
1122
1122
|
}
|
|
1123
|
-
function
|
|
1123
|
+
function Fo(e, t) {
|
|
1124
1124
|
const o = {
|
|
1125
1125
|
count: Math.max(0, e.count - t.count),
|
|
1126
1126
|
sum: (e.sum || 0) - (t.sum || 0),
|
|
@@ -1133,11 +1133,11 @@ function Vo(e, t) {
|
|
|
1133
1133
|
if (o.count > 0 && o.sum !== void 0 ? o.avg = Math.round(o.sum / o.count * 100) / 100 : o.avg = 0, t.breakdown && o.breakdown)
|
|
1134
1134
|
for (const [r, s] of Object.entries(t.breakdown))
|
|
1135
1135
|
o.breakdown[r] && (o.breakdown[r] = Math.max(0, o.breakdown[r] - s), o.breakdown[r] === 0 && delete o.breakdown[r]);
|
|
1136
|
-
return o.nps =
|
|
1136
|
+
return o.nps = Ct((o == null ? void 0 : o.breakdown) || {}), o;
|
|
1137
1137
|
}
|
|
1138
|
-
function
|
|
1138
|
+
function Yo(e, t) {
|
|
1139
1139
|
if (!e.count && !t.count)
|
|
1140
|
-
return
|
|
1140
|
+
return L();
|
|
1141
1141
|
if (!e.count)
|
|
1142
1142
|
return { ...t };
|
|
1143
1143
|
const o = {
|
|
@@ -1154,12 +1154,12 @@ function jo(e, t) {
|
|
|
1154
1154
|
for (const [r, s] of Object.entries(t.breakdown))
|
|
1155
1155
|
o.breakdown[r] = (o.breakdown[r] || 0) + s;
|
|
1156
1156
|
}
|
|
1157
|
-
return o.nps =
|
|
1157
|
+
return o.nps = Ct((o == null ? void 0 : o.breakdown) || {}), o;
|
|
1158
1158
|
}
|
|
1159
|
-
function
|
|
1159
|
+
function De(e) {
|
|
1160
1160
|
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);
|
|
1161
1161
|
}
|
|
1162
|
-
function
|
|
1162
|
+
function Pt(e) {
|
|
1163
1163
|
if (!e || typeof e != "string")
|
|
1164
1164
|
return !1;
|
|
1165
1165
|
const t = e.trim();
|
|
@@ -1173,7 +1173,7 @@ function Ot(e) {
|
|
|
1173
1173
|
return !1;
|
|
1174
1174
|
}
|
|
1175
1175
|
}
|
|
1176
|
-
function
|
|
1176
|
+
function Re(e) {
|
|
1177
1177
|
if (!e || typeof e != "string")
|
|
1178
1178
|
return [];
|
|
1179
1179
|
const t = e.trim();
|
|
@@ -1188,53 +1188,91 @@ function qo(e) {
|
|
|
1188
1188
|
}
|
|
1189
1189
|
return t.split(",").map((o) => o.trim()).filter((o) => o !== "");
|
|
1190
1190
|
}
|
|
1191
|
-
function
|
|
1191
|
+
function Wo(e, t) {
|
|
1192
1192
|
const o = /{([^{}]+)}/g;
|
|
1193
1193
|
return e.replace(o, (r, s) => {
|
|
1194
1194
|
const i = s.trim(), a = t[i];
|
|
1195
1195
|
return a !== void 0 ? String(a) : r;
|
|
1196
1196
|
});
|
|
1197
1197
|
}
|
|
1198
|
-
function
|
|
1198
|
+
function Ko(e, t) {
|
|
1199
1199
|
let o = 2166136261;
|
|
1200
1200
|
const r = e + ":" + t;
|
|
1201
1201
|
for (let s = 0; s < r.length; s++)
|
|
1202
1202
|
o ^= r.charCodeAt(s), o += (o << 1) + (o << 4) + (o << 7) + (o << 8) + (o << 24);
|
|
1203
1203
|
return (o >>> 0).toString(16).padStart(8, "0");
|
|
1204
1204
|
}
|
|
1205
|
-
function
|
|
1205
|
+
function Go(e, t = 50) {
|
|
1206
1206
|
return e.length <= t ? e : e.substring(0, t).trim() + "...";
|
|
1207
1207
|
}
|
|
1208
|
-
const
|
|
1209
|
-
function
|
|
1210
|
-
|
|
1208
|
+
const qt = /* @__PURE__ */ new Map();
|
|
1209
|
+
function Zo(e, t) {
|
|
1210
|
+
qt.set(e, t);
|
|
1211
1211
|
}
|
|
1212
|
-
function
|
|
1213
|
-
const t =
|
|
1214
|
-
return t &&
|
|
1212
|
+
function Xo(e) {
|
|
1213
|
+
const t = qt.get(e);
|
|
1214
|
+
return t && qt.delete(e), t;
|
|
1215
1215
|
}
|
|
1216
|
-
const
|
|
1217
|
-
|
|
1216
|
+
const Be = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, xe = 5;
|
|
1217
|
+
function Ve(e) {
|
|
1218
|
+
return e || Do;
|
|
1219
|
+
}
|
|
1220
|
+
function Ue(e, t) {
|
|
1221
|
+
const o = Ve(t);
|
|
1222
|
+
return e.type === "registered" ? `${o}/widgets/${encodeURIComponent(e.widgetId)}` : `${o}/public-widgets/${encodeURIComponent(e.name)}`;
|
|
1223
|
+
}
|
|
1224
|
+
async function je(e, t) {
|
|
1225
|
+
const o = Ue(e, t);
|
|
1226
|
+
g.debug("API GET", { url: o });
|
|
1227
|
+
const r = await fetch(o);
|
|
1228
|
+
if (!r.ok)
|
|
1229
|
+
throw new Error(`API request failed with status: ${r.status}`);
|
|
1230
|
+
const s = await r.json();
|
|
1231
|
+
if (!s.success)
|
|
1232
|
+
throw new Error("Backend returned unsuccessful response");
|
|
1233
|
+
return s;
|
|
1234
|
+
}
|
|
1235
|
+
async function Jo(e, t, o) {
|
|
1236
|
+
const r = Ue(e, o);
|
|
1237
|
+
if (g.debug("API POST", { url: r }), typeof navigator < "u" && navigator.sendBeacon) {
|
|
1238
|
+
if (navigator.sendBeacon(r, t)) {
|
|
1239
|
+
g.debug("Successfully sent stats via sendBeacon");
|
|
1240
|
+
return;
|
|
1241
|
+
}
|
|
1242
|
+
g.debug("sendBeacon failed, falling back to fetch");
|
|
1243
|
+
}
|
|
1244
|
+
const s = await fetch(r, {
|
|
1245
|
+
body: t,
|
|
1246
|
+
method: "POST",
|
|
1247
|
+
keepalive: !0,
|
|
1248
|
+
headers: {
|
|
1249
|
+
"Content-Type": "application/json"
|
|
1250
|
+
}
|
|
1251
|
+
});
|
|
1252
|
+
if (!s.ok)
|
|
1253
|
+
throw new Error(`API request failed with status: ${s.status}`);
|
|
1254
|
+
g.debug("Successfully sent stats via fetch");
|
|
1255
|
+
}
|
|
1256
|
+
class Qo {
|
|
1218
1257
|
// Tracks if user has ever made a selection (even if later deselected)
|
|
1219
1258
|
constructor(t) {
|
|
1220
|
-
this.stats =
|
|
1259
|
+
this.stats = L(), this.localStats = L(), this.prevLocalStats = L(), this.isLoading = !0, this.isLoadingConfig = !1, this.isSubmitting = !1, this.hasInteracted = !1, (this.host = t).addController(this);
|
|
1221
1260
|
}
|
|
1222
1261
|
hostConnected() {
|
|
1223
1262
|
this.loadStats();
|
|
1224
1263
|
}
|
|
1225
1264
|
/**
|
|
1226
|
-
* Validates the widget identifier
|
|
1227
|
-
* Returns
|
|
1265
|
+
* Validates and returns the widget identifier.
|
|
1266
|
+
* Returns null (and logs the error) when validation fails.
|
|
1228
1267
|
*/
|
|
1229
|
-
|
|
1268
|
+
getWidgetIdentifier() {
|
|
1230
1269
|
const t = this.host;
|
|
1231
|
-
return t.widgetId ?
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
} : { type: "public" } : { type: "none", error: "Widget requires either widget-id or name attribute" };
|
|
1270
|
+
return t.widgetId ? Be.test(t.widgetId) ? { type: "registered", widgetId: t.widgetId } : (g.error(`Invalid widget-id format: ${t.widgetId}`), null) : t.name ? t.name.length < xe ? (g.error(
|
|
1271
|
+
`Widget name must be at least ${xe} characters long. Got: "${t.name}"`
|
|
1272
|
+
), null) : { type: "public", name: t.name } : (g.error("Widget requires either widget-id or name attribute"), null);
|
|
1235
1273
|
}
|
|
1236
1274
|
async getLocalStatsKey() {
|
|
1237
|
-
const t = this.host, o = await
|
|
1275
|
+
const t = this.host, o = await we(), r = t.widgetId || t.name || "unnamed";
|
|
1238
1276
|
return `pc-local-stats-${o}-${r}`;
|
|
1239
1277
|
}
|
|
1240
1278
|
/**
|
|
@@ -1250,11 +1288,20 @@ class Go {
|
|
|
1250
1288
|
*/
|
|
1251
1289
|
applyWidgetAttributes(t) {
|
|
1252
1290
|
if (!t) return;
|
|
1253
|
-
const r = this.host;
|
|
1254
|
-
for (const [
|
|
1255
|
-
if (
|
|
1256
|
-
|
|
1257
|
-
|
|
1291
|
+
const o = typeof t.attributes == "object" && t.attributes !== null && !Array.isArray(t.attributes) ? t.attributes : t, r = this.host, s = r;
|
|
1292
|
+
for (const [i, a] of Object.entries(o)) {
|
|
1293
|
+
if (a == null) continue;
|
|
1294
|
+
if (i === "options" && typeof a == "string") {
|
|
1295
|
+
const n = Re(a);
|
|
1296
|
+
r.options = n.map((d) => ({
|
|
1297
|
+
value: d,
|
|
1298
|
+
label: d,
|
|
1299
|
+
icon: r.type === $.reaction ? d : void 0
|
|
1300
|
+
})), g.debug("Applied widget options as property:", n);
|
|
1301
|
+
continue;
|
|
1302
|
+
}
|
|
1303
|
+
const l = i.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
1304
|
+
typeof a == "boolean" ? a ? s.setAttribute(l, "") : s.removeAttribute(l) : typeof a == "object" ? s.setAttribute(l, JSON.stringify(a)) : s.setAttribute(l, String(a)), g.debug(`Applied widget attribute: ${l}=${a}`);
|
|
1258
1305
|
}
|
|
1259
1306
|
}
|
|
1260
1307
|
/**
|
|
@@ -1264,83 +1311,66 @@ class Go {
|
|
|
1264
1311
|
var r, s, i;
|
|
1265
1312
|
const t = this.host;
|
|
1266
1313
|
this.isLoading = !1, this.stats = this.localStats, this.host.requestUpdate();
|
|
1267
|
-
const o = this.
|
|
1268
|
-
if (o
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1314
|
+
const o = this.getWidgetIdentifier();
|
|
1315
|
+
if (o)
|
|
1316
|
+
try {
|
|
1317
|
+
let a, l;
|
|
1318
|
+
if (o.type === "registered") {
|
|
1319
|
+
const y = Xo(o.widgetId);
|
|
1320
|
+
y && (g.debug("Using prefetched widget config from cache", {
|
|
1321
|
+
widgetId: o.widgetId
|
|
1322
|
+
}), this.applyWidgetAttributes(y.config.attributes), a = y.stats);
|
|
1323
|
+
}
|
|
1324
|
+
if (!a) {
|
|
1325
|
+
let y;
|
|
1326
|
+
if (o.type !== "registered" && t.dataFunc && typeof window < "u") {
|
|
1327
|
+
const A = t.dataFunc.replace(/^window\./, "").split(".");
|
|
1328
|
+
let k = window;
|
|
1329
|
+
for (const I of A)
|
|
1330
|
+
if (k = k == null ? void 0 : k[I], k === void 0) break;
|
|
1331
|
+
y = k;
|
|
1332
|
+
}
|
|
1333
|
+
if (y && typeof y == "function") {
|
|
1334
|
+
l = this.getValidOptionKeys(t), g.debug(`Using data function for: ${t.widgetId || t.name}`, {
|
|
1335
|
+
dataFuncName: t.dataFunc,
|
|
1336
|
+
options: l
|
|
1337
|
+
});
|
|
1338
|
+
const x = await y(t.widgetId, t.name, l);
|
|
1339
|
+
if (x && typeof x == "object" && "success" in x && "data" in x) {
|
|
1340
|
+
if (!x.success)
|
|
1341
|
+
throw g.error("Custom data function returned unsuccessful response", x), new Error("Custom data function returned unsuccessful response");
|
|
1342
|
+
a = x.data || {};
|
|
1343
|
+
} else
|
|
1344
|
+
a = x || {};
|
|
1345
|
+
} else {
|
|
1346
|
+
o.type === "registered" && (this.isLoadingConfig = !0, this.host.requestUpdate());
|
|
1347
|
+
const x = await je(
|
|
1348
|
+
o,
|
|
1349
|
+
o.type === "registered" ? void 0 : t.dataEndpoint
|
|
1350
|
+
);
|
|
1351
|
+
if (o.type === "registered") {
|
|
1352
|
+
const A = ((s = (r = x.data) == null ? void 0 : r.config) == null ? void 0 : s.attributes) || null;
|
|
1353
|
+
a = ((i = x.data) == null ? void 0 : i.stats) || {}, this.applyWidgetAttributes(A);
|
|
1354
|
+
} else
|
|
1355
|
+
a = x.data || {};
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
l ?? (l = this.getValidOptionKeys(t));
|
|
1359
|
+
const n = jo(a.breakdown ?? {}, l), d = n.count, p = n.sum, f = d > 0 ? Math.round(p / d * 10) / 10 : 0, b = d > 0 ? Math.round(p / d * 100) : 0;
|
|
1277
1360
|
this.stats = {
|
|
1278
1361
|
count: d,
|
|
1279
1362
|
sum: p,
|
|
1280
|
-
avg:
|
|
1281
|
-
pct:
|
|
1282
|
-
nps: t.type ===
|
|
1363
|
+
avg: f,
|
|
1364
|
+
pct: b,
|
|
1365
|
+
nps: t.type === $.nps ? Ct(n.breakdown) : 0,
|
|
1283
1366
|
breakdown: n.breakdown,
|
|
1284
|
-
updated: a.
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1367
|
+
updated: a.updatedAt || a.updated_at || (/* @__PURE__ */ new Date()).toISOString()
|
|
1368
|
+
};
|
|
1369
|
+
} catch (a) {
|
|
1370
|
+
throw g.error("Error loading stats:", a, this.localStats), a;
|
|
1371
|
+
} finally {
|
|
1372
|
+
this.isLoading = !1, this.isLoadingConfig = !1, this.host.requestUpdate();
|
|
1287
1373
|
}
|
|
1288
|
-
}
|
|
1289
|
-
try {
|
|
1290
|
-
const a = t.type;
|
|
1291
|
-
let l;
|
|
1292
|
-
if (t.dataFunc && typeof window < "u") {
|
|
1293
|
-
const y = t.dataFunc.replace(/^window\./, "").split(".");
|
|
1294
|
-
let E = window;
|
|
1295
|
-
for (const G of y)
|
|
1296
|
-
if (E = E == null ? void 0 : E[G], E === void 0) break;
|
|
1297
|
-
l = E;
|
|
1298
|
-
}
|
|
1299
|
-
let n, d = null;
|
|
1300
|
-
if (l && typeof l == "function") {
|
|
1301
|
-
const $ = this.getOptionsForDataFunc(t);
|
|
1302
|
-
g.debug(`Using data function for: ${t.widgetId || t.name}`, {
|
|
1303
|
-
dataFuncName: t.dataFunc,
|
|
1304
|
-
options: $
|
|
1305
|
-
});
|
|
1306
|
-
const y = await l(t.widgetId, t.name, $);
|
|
1307
|
-
if (y && typeof y == "object" && "success" in y && "data" in y) {
|
|
1308
|
-
if (!y.success)
|
|
1309
|
-
throw g.error("Custom data function returned unsuccessful response", y), new Error("Custom data function returned unsuccessful response");
|
|
1310
|
-
n = y.data || {};
|
|
1311
|
-
} else
|
|
1312
|
-
n = y || {};
|
|
1313
|
-
} else {
|
|
1314
|
-
const $ = t.dataEndpoint || Yt;
|
|
1315
|
-
let y;
|
|
1316
|
-
o.type === "registered" ? (y = `${$}/widgets/${encodeURIComponent(t.widgetId)}`, this.isLoadingConfig = !0, this.host.requestUpdate()) : y = `${$}/public-widgets/${encodeURIComponent(t.name)}`, g.debug("Fetching stats for widget", {
|
|
1317
|
-
endpoint: y,
|
|
1318
|
-
type: o.type
|
|
1319
|
-
});
|
|
1320
|
-
const E = await fetch(y);
|
|
1321
|
-
if (!E.ok)
|
|
1322
|
-
throw new Error(`API request failed with status: ${E.status}`);
|
|
1323
|
-
const G = await E.json();
|
|
1324
|
-
if (!G.success)
|
|
1325
|
-
throw g.error("Backend returned unsuccessful response", G), new Error("Backend returned unsuccessful response");
|
|
1326
|
-
o.type === "registered" ? (d = ((s = (r = G.data) == null ? void 0 : r.config) == null ? void 0 : s.attributes) || null, n = ((i = G.data) == null ? void 0 : i.stats) || {}) : n = G.data || {};
|
|
1327
|
-
}
|
|
1328
|
-
d && !l && this.applyWidgetAttributes(d);
|
|
1329
|
-
const p = this.getOptionsForDataFunc(t), h = Ce(n.breakdown ?? {}, p), v = h.count, x = h.sum, k = v > 0 ? Math.round(x / v * 10) / 10 : 0, P = v > 0 ? Math.round(x / v * 100) : 0, _ = {
|
|
1330
|
-
count: v,
|
|
1331
|
-
sum: x,
|
|
1332
|
-
avg: k,
|
|
1333
|
-
pct: P,
|
|
1334
|
-
nps: a === S.nps ? ft(h.breakdown) : 0,
|
|
1335
|
-
breakdown: h.breakdown,
|
|
1336
|
-
updated: n.updatedAt || n.updated_at || (/* @__PURE__ */ new Date()).toISOString()
|
|
1337
|
-
};
|
|
1338
|
-
this.stats = _;
|
|
1339
|
-
} catch (a) {
|
|
1340
|
-
throw g.error("Error loading stats:", a, this.localStats), a;
|
|
1341
|
-
} finally {
|
|
1342
|
-
this.isLoading = !1, this.isLoadingConfig = !1, this.host.requestUpdate();
|
|
1343
|
-
}
|
|
1344
1374
|
}
|
|
1345
1375
|
/**
|
|
1346
1376
|
* Gets the options array for the data function based on widget type.
|
|
@@ -1348,16 +1378,16 @@ class Go {
|
|
|
1348
1378
|
* - For stars: generates ['1', '2', ..., numStars]
|
|
1349
1379
|
* - For NPS: generates ['0', '1', '2', ..., '10']
|
|
1350
1380
|
*/
|
|
1351
|
-
|
|
1381
|
+
getValidOptionKeys(t) {
|
|
1352
1382
|
switch (t.type) {
|
|
1353
|
-
case
|
|
1383
|
+
case $.stars: {
|
|
1354
1384
|
const r = t.numStars || 5;
|
|
1355
1385
|
return Array.from({ length: r }, (s, i) => String(i + 1));
|
|
1356
1386
|
}
|
|
1357
|
-
case
|
|
1387
|
+
case $.nps:
|
|
1358
1388
|
return Array.from({ length: 11 }, (r, s) => String(s));
|
|
1359
|
-
case
|
|
1360
|
-
case
|
|
1389
|
+
case $.poll:
|
|
1390
|
+
case $.reaction:
|
|
1361
1391
|
default:
|
|
1362
1392
|
return t.options.map((r) => r.value);
|
|
1363
1393
|
}
|
|
@@ -1368,10 +1398,10 @@ class Go {
|
|
|
1368
1398
|
async loadLocalStats() {
|
|
1369
1399
|
const t = await this.getLocalStatsKey();
|
|
1370
1400
|
try {
|
|
1371
|
-
const o =
|
|
1401
|
+
const o = qo(t);
|
|
1372
1402
|
g.debug("Loaded localStats from localStorage", o), this.localStats = o, o.submitted && (this.prevLocalStats = { ...o });
|
|
1373
1403
|
} catch (o) {
|
|
1374
|
-
g.warn("Failed to generate localStorage key for localStats", o), this.localStats =
|
|
1404
|
+
g.warn("Failed to generate localStorage key for localStats", o), this.localStats = L();
|
|
1375
1405
|
}
|
|
1376
1406
|
this.host.requestUpdate();
|
|
1377
1407
|
}
|
|
@@ -1381,7 +1411,7 @@ class Go {
|
|
|
1381
1411
|
async persistLocalStats() {
|
|
1382
1412
|
try {
|
|
1383
1413
|
const t = await this.getLocalStatsKey();
|
|
1384
|
-
|
|
1414
|
+
Ho(t, this.localStats) || g.warn("Failed to save localStats to localStorage");
|
|
1385
1415
|
} catch (t) {
|
|
1386
1416
|
g.warn("Failed to save localStats to localStorage", t);
|
|
1387
1417
|
}
|
|
@@ -1395,7 +1425,7 @@ class Go {
|
|
|
1395
1425
|
* @param textValues
|
|
1396
1426
|
*/
|
|
1397
1427
|
updateStats(t, o) {
|
|
1398
|
-
if (this.hasInteracted = !0, this.stats && (this.stats =
|
|
1428
|
+
if (this.hasInteracted = !0, this.stats && (this.stats = Fo(this.stats, this.localStats)), this.localStats = {
|
|
1399
1429
|
count: t > 0 || o.length > 0 ? 1 : 0,
|
|
1400
1430
|
sum: t,
|
|
1401
1431
|
// e.g. number of stars, nps value
|
|
@@ -1409,7 +1439,7 @@ class Go {
|
|
|
1409
1439
|
}, o && o.length > 0)
|
|
1410
1440
|
for (const r of o)
|
|
1411
1441
|
r && (this.localStats.breakdown[r] = 1);
|
|
1412
|
-
this.stats =
|
|
1442
|
+
this.stats = Yo(this.stats, this.localStats), g.debug("Stats updated - remote: ", this.stats), g.debug("Stats updated - local: ", this.stats), this.persistLocalStats(), this.host.requestUpdate();
|
|
1413
1443
|
}
|
|
1414
1444
|
async markStatsAsSubmitted() {
|
|
1415
1445
|
this.localStats.submitted = (/* @__PURE__ */ new Date()).toISOString(), this.prevLocalStats = { ...this.localStats }, await this.persistLocalStats(), this.host.requestUpdate();
|
|
@@ -1417,7 +1447,7 @@ class Go {
|
|
|
1417
1447
|
async submitStats() {
|
|
1418
1448
|
if (!this.hasLocalStats() && !this.hasInteracted)
|
|
1419
1449
|
throw g.warn("No local stats to submit"), new Error("No local stats to submit");
|
|
1420
|
-
const t = this.host, o = Math.floor(Date.now() / 1e3).toString(), r = await
|
|
1450
|
+
const t = this.host, o = Math.floor(Date.now() / 1e3).toString(), r = await we(), s = this.localStats.sum, i = Object.keys(this.localStats.breakdown || {}), a = this.prevLocalStats.sum, l = Object.keys(this.prevLocalStats.breakdown || {});
|
|
1421
1451
|
this.isSubmitting = !0, this.host.requestUpdate();
|
|
1422
1452
|
const n = {
|
|
1423
1453
|
sessionId: r,
|
|
@@ -1431,7 +1461,7 @@ class Go {
|
|
|
1431
1461
|
prevTextValues: l,
|
|
1432
1462
|
metadata: t.metadata,
|
|
1433
1463
|
timestamp: o
|
|
1434
|
-
}, d =
|
|
1464
|
+
}, d = Ko(JSON.stringify(n), o);
|
|
1435
1465
|
try {
|
|
1436
1466
|
await this.sendStats({ ...n, hash: d }), await this.markStatsAsSubmitted(), this.dispatchSubmitEvent(n);
|
|
1437
1467
|
} catch (p) {
|
|
@@ -1442,38 +1472,18 @@ class Go {
|
|
|
1442
1472
|
return n;
|
|
1443
1473
|
}
|
|
1444
1474
|
async sendStats(t) {
|
|
1445
|
-
const o = this.host;
|
|
1446
|
-
if (
|
|
1475
|
+
const o = this.host, r = this.getWidgetIdentifier();
|
|
1476
|
+
if (!r) throw new Error("Invalid widget identifier");
|
|
1477
|
+
if (r.type !== "registered" && o.dataFunc) {
|
|
1447
1478
|
g.debug("Skip sending stats as data function is in use.");
|
|
1448
1479
|
return;
|
|
1449
1480
|
}
|
|
1450
|
-
const r =
|
|
1451
|
-
if (
|
|
1452
|
-
throw g.error(
|
|
1453
|
-
const s = o.dataEndpoint || Yt;
|
|
1454
|
-
if (!Ot(s))
|
|
1455
|
-
throw g.error("Invalid data endpoint", { dataEndpoint: s }), new Error(`Invalid data endpoint: ${s}`);
|
|
1456
|
-
let i;
|
|
1457
|
-
r.type === "registered" ? i = `${s}/widgets/${encodeURIComponent(o.widgetId)}` : i = `${s}/public-widgets/${encodeURIComponent(o.name)}`;
|
|
1481
|
+
const s = r.type === "registered" ? void 0 : o.dataEndpoint, i = Ve(s);
|
|
1482
|
+
if (!Pt(i))
|
|
1483
|
+
throw g.error("Invalid data endpoint", { dataEndpoint: i }), new Error(`Invalid data endpoint: ${i}`);
|
|
1458
1484
|
const a = JSON.stringify(t);
|
|
1459
1485
|
try {
|
|
1460
|
-
|
|
1461
|
-
if (navigator.sendBeacon(i, a)) {
|
|
1462
|
-
g.debug("Successfully sent stats via sendBeacon");
|
|
1463
|
-
return;
|
|
1464
|
-
} else
|
|
1465
|
-
g.debug("sendBeacon failed, falling back to fetch");
|
|
1466
|
-
const l = await fetch(i, {
|
|
1467
|
-
body: a,
|
|
1468
|
-
method: "POST",
|
|
1469
|
-
keepalive: !0,
|
|
1470
|
-
headers: {
|
|
1471
|
-
"Content-Type": "application/json"
|
|
1472
|
-
}
|
|
1473
|
-
});
|
|
1474
|
-
if (!l.ok)
|
|
1475
|
-
throw new Error(`API request failed with status: ${l.status}`);
|
|
1476
|
-
g.debug("Successfully sent stats via fetch");
|
|
1486
|
+
await Jo(r, a, s);
|
|
1477
1487
|
} catch (l) {
|
|
1478
1488
|
throw g.error("Failed to send analytics:", l), l;
|
|
1479
1489
|
}
|
|
@@ -1490,9 +1500,9 @@ class Go {
|
|
|
1490
1500
|
sum: (o == null ? void 0 : o.sum) || 0,
|
|
1491
1501
|
avg: s,
|
|
1492
1502
|
pct: (o == null ? void 0 : o.pct) || 0,
|
|
1493
|
-
nps: r.type ===
|
|
1503
|
+
nps: r.type === $.nps ? Ct((o == null ? void 0 : o.breakdown) || {}) : 0
|
|
1494
1504
|
};
|
|
1495
|
-
return g.debug("Stats data: ", this.stats),
|
|
1505
|
+
return g.debug("Stats data: ", this.stats), Wo(t, i);
|
|
1496
1506
|
}
|
|
1497
1507
|
/**
|
|
1498
1508
|
* Checks if a value is selected in the local stats
|
|
@@ -1518,7 +1528,7 @@ class Go {
|
|
|
1518
1528
|
toggleValueSelected(t, o) {
|
|
1519
1529
|
const r = Object.keys(this.localStats.breakdown || {}), s = r.includes(t), i = this.host;
|
|
1520
1530
|
let a = 1;
|
|
1521
|
-
if ((i.type ===
|
|
1531
|
+
if ((i.type === $.stars || i.type === $.nps) && (a = parseInt(t)), s)
|
|
1522
1532
|
if (o) {
|
|
1523
1533
|
const n = r.filter((d) => d !== t);
|
|
1524
1534
|
this.updateStats(n.length > 0 ? 1 : 0, n);
|
|
@@ -1579,7 +1589,7 @@ class Go {
|
|
|
1579
1589
|
return ((t = this.localStats) == null ? void 0 : t.submitted) !== void 0 && this.hasLocalStats();
|
|
1580
1590
|
}
|
|
1581
1591
|
}
|
|
1582
|
-
class
|
|
1592
|
+
class tr {
|
|
1583
1593
|
constructor(t, o) {
|
|
1584
1594
|
this.isEditing = !0, this.isChartVisible = !1, this.isStatsVisible = !1, this.isThankYouVisible = !1, this.isReactionPopoverVisible = !1, this.initialized = !1, this.handleClickOutside = (r) => {
|
|
1585
1595
|
r.target !== this.host && (this.toggleThankYouVisibility(!1), this.toggleReactionPopoverVisibility(!1));
|
|
@@ -1667,8 +1677,8 @@ class Zo {
|
|
|
1667
1677
|
return !(this.host.readonly || !this.isEditing);
|
|
1668
1678
|
}
|
|
1669
1679
|
}
|
|
1670
|
-
var
|
|
1671
|
-
function
|
|
1680
|
+
var Xt = /* @__PURE__ */ ((e) => (e.DECORATIVE = "decorative", e.FUNCTIONAL = "functional", e.STATUS = "status", e))(Xt || {});
|
|
1681
|
+
function qe(e, t = {}) {
|
|
1672
1682
|
const { type: o = "functional", alt: r, ariaLabel: s, isSelected: i } = t;
|
|
1673
1683
|
if (!e)
|
|
1674
1684
|
return { alt: "", ariaHidden: !0 };
|
|
@@ -1677,20 +1687,20 @@ function je(e, t = {}) {
|
|
|
1677
1687
|
o === "functional" && !r && !s && console.warn(
|
|
1678
1688
|
"No alt text or aria-label provided for functional icon. This may cause accessibility issues."
|
|
1679
1689
|
);
|
|
1680
|
-
const a = i ? " (selected)" : "", l =
|
|
1690
|
+
const a = i ? " (selected)" : "", l = Pt(e) && !r ? "" : r || e, n = s || (l ? `${l}${a}` : a);
|
|
1681
1691
|
return {
|
|
1682
1692
|
alt: l,
|
|
1683
1693
|
ariaLabel: n,
|
|
1684
1694
|
ariaHidden: !1
|
|
1685
1695
|
};
|
|
1686
1696
|
}
|
|
1687
|
-
function
|
|
1697
|
+
function er(e, t = "polite") {
|
|
1688
1698
|
let o = document.getElementById("screen-reader-announcer");
|
|
1689
1699
|
o ? o.setAttribute("aria-live", t) : (o = document.createElement("div"), o.id = "screen-reader-announcer", o.setAttribute("aria-live", t), o.setAttribute("role", "status"), o.setAttribute("aria-atomic", "true"), o.style.position = "absolute", o.style.width = "1px", o.style.height = "1px", o.style.margin = "-1px", o.style.padding = "0", o.style.overflow = "hidden", o.style.clip = "rect(0, 0, 0, 0)", o.style.whiteSpace = "nowrap", o.style.border = "0", document.body.appendChild(o)), o.textContent = "", setTimeout(() => {
|
|
1690
1700
|
o.textContent = e;
|
|
1691
1701
|
}, 50);
|
|
1692
1702
|
}
|
|
1693
|
-
function
|
|
1703
|
+
function or(e, t) {
|
|
1694
1704
|
return `${e}: ${t}`;
|
|
1695
1705
|
}
|
|
1696
1706
|
/**
|
|
@@ -1698,8 +1708,8 @@ function Xo(e, t) {
|
|
|
1698
1708
|
* Copyright 2017 Google LLC
|
|
1699
1709
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1700
1710
|
*/
|
|
1701
|
-
const
|
|
1702
|
-
let
|
|
1711
|
+
const He = { ATTRIBUTE: 1 }, Fe = (e) => (...t) => ({ _$litDirective$: e, values: t });
|
|
1712
|
+
let Ye = class {
|
|
1703
1713
|
constructor(t) {
|
|
1704
1714
|
}
|
|
1705
1715
|
get _$AU() {
|
|
@@ -1720,10 +1730,10 @@ let Fe = class {
|
|
|
1720
1730
|
* Copyright 2018 Google LLC
|
|
1721
1731
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1722
1732
|
*/
|
|
1723
|
-
const w =
|
|
1733
|
+
const w = Fe(class extends Ye {
|
|
1724
1734
|
constructor(e) {
|
|
1725
1735
|
var t;
|
|
1726
|
-
if (super(e), e.type !==
|
|
1736
|
+
if (super(e), e.type !== He.ATTRIBUTE || e.name !== "class" || ((t = e.strings) == null ? void 0 : t.length) > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
|
|
1727
1737
|
}
|
|
1728
1738
|
render(e) {
|
|
1729
1739
|
return " " + Object.keys(e).filter((t) => e[t]).join(" ") + " ";
|
|
@@ -1741,21 +1751,21 @@ const w = He(class extends Fe {
|
|
|
1741
1751
|
const a = !!t[i];
|
|
1742
1752
|
a === this.st.has(i) || (s = this.nt) != null && s.has(i) || (a ? (o.add(i), this.st.add(i)) : (o.remove(i), this.st.delete(i)));
|
|
1743
1753
|
}
|
|
1744
|
-
return
|
|
1754
|
+
return j;
|
|
1745
1755
|
}
|
|
1746
1756
|
});
|
|
1747
|
-
var
|
|
1757
|
+
var rr = Object.defineProperty, v = (e, t, o, r) => {
|
|
1748
1758
|
for (var s = void 0, i = e.length - 1, a; i >= 0; i--)
|
|
1749
1759
|
(a = e[i]) && (s = a(t, o, s) || s);
|
|
1750
|
-
return s &&
|
|
1760
|
+
return s && rr(t, o, s), s;
|
|
1751
1761
|
};
|
|
1752
|
-
const
|
|
1762
|
+
const bt = {
|
|
1753
1763
|
mobile: "480px",
|
|
1754
1764
|
tablet: "768px",
|
|
1755
1765
|
desktop: "1024px"
|
|
1756
|
-
},
|
|
1766
|
+
}, Jt = class Jt extends N {
|
|
1757
1767
|
constructor() {
|
|
1758
|
-
super(...arguments), this.dataController = new
|
|
1768
|
+
super(...arguments), this.dataController = new Qo(this), this.displayController = new tr(this, this.dataController), this.hasEditButton = !0, this.showStats = "never", this.showChart = !1, this.initialized = !1, this.ariaLabel = null, this.minContrast = Me.AA_NORMAL, this.options = [], this.questionPosition = "top", this.statsText = "{count} votes", this.buttonText = "Submit", this.buttonRadius = "sm", this.multiple = !1, this.inline = !1, this.readonly = !1, this.handleEditToggleKeyDown = (t) => {
|
|
1759
1769
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.handleEnterEditMode());
|
|
1760
1770
|
};
|
|
1761
1771
|
}
|
|
@@ -1787,10 +1797,10 @@ const $t = {
|
|
|
1787
1797
|
let o = `:host {
|
|
1788
1798
|
`;
|
|
1789
1799
|
if (this.primaryColor) {
|
|
1790
|
-
const i =
|
|
1800
|
+
const i = Q(this.primaryColor);
|
|
1791
1801
|
o += `--pc-primary-color: ${i} !important;
|
|
1792
1802
|
`;
|
|
1793
|
-
const a =
|
|
1803
|
+
const a = To(i, {
|
|
1794
1804
|
minContrast: this.minContrast,
|
|
1795
1805
|
colorOptions: ["black", "white", "light", "dark"]
|
|
1796
1806
|
});
|
|
@@ -1798,56 +1808,56 @@ const $t = {
|
|
|
1798
1808
|
`;
|
|
1799
1809
|
}
|
|
1800
1810
|
if (this.muteColor) {
|
|
1801
|
-
const i =
|
|
1811
|
+
const i = Q(this.muteColor);
|
|
1802
1812
|
o += `--pc-mute-color: ${i} !important;
|
|
1803
1813
|
`;
|
|
1804
1814
|
}
|
|
1805
1815
|
if (this.textColor) {
|
|
1806
|
-
const i =
|
|
1816
|
+
const i = Q(this.textColor);
|
|
1807
1817
|
o += `--pc-text-color: ${i} !important;
|
|
1808
1818
|
`;
|
|
1809
1819
|
}
|
|
1810
1820
|
if (this.backgroundColor) {
|
|
1811
|
-
const i =
|
|
1821
|
+
const i = Q(this.backgroundColor);
|
|
1812
1822
|
o += `--pc-background-color: ${i} !important;
|
|
1813
1823
|
`;
|
|
1814
1824
|
}
|
|
1815
1825
|
const r = this.starColor || this.accentColor || this.primaryColor;
|
|
1816
1826
|
if (r) {
|
|
1817
|
-
const i =
|
|
1827
|
+
const i = Q(r);
|
|
1818
1828
|
o += `--pc-star-color: ${i} !important;
|
|
1819
1829
|
`;
|
|
1820
1830
|
}
|
|
1821
|
-
const s = this.starHoverColor || (r ? `color-mix(in srgb, ${
|
|
1831
|
+
const s = this.starHoverColor || (r ? `color-mix(in srgb, ${Q(r)} 80%, white)` : null);
|
|
1822
1832
|
if (s && (o += `--pc-star-hover-color: ${s} !important;
|
|
1823
1833
|
`), this.starSize) {
|
|
1824
|
-
const i =
|
|
1834
|
+
const i = Vt(this.starSize, "1.5em", 1.5);
|
|
1825
1835
|
o += `--pc-stars-star-size: ${i} !important;
|
|
1826
1836
|
`;
|
|
1827
1837
|
}
|
|
1828
1838
|
if (this.reactionSize) {
|
|
1829
|
-
const i =
|
|
1839
|
+
const i = Vt(this.reactionSize, "1em", 1);
|
|
1830
1840
|
o += `--pc-reaction-size: ${i} !important;
|
|
1831
1841
|
`;
|
|
1832
1842
|
}
|
|
1833
1843
|
if (this.size) {
|
|
1834
|
-
const i =
|
|
1844
|
+
const i = Vt(this.size);
|
|
1835
1845
|
o += `font-size: ${i} !important;
|
|
1836
1846
|
`;
|
|
1837
1847
|
}
|
|
1838
1848
|
if (this.buttonRadius) {
|
|
1839
|
-
const i =
|
|
1849
|
+
const i = Oo(this.buttonRadius);
|
|
1840
1850
|
o += `--pc-button-radius: ${i} !important;
|
|
1841
1851
|
`;
|
|
1842
1852
|
}
|
|
1843
1853
|
o += `}
|
|
1844
|
-
`, this.css && (o +=
|
|
1854
|
+
`, this.css && (o += No(Lo(this.css))), t.textContent = o;
|
|
1845
1855
|
}
|
|
1846
1856
|
/**
|
|
1847
1857
|
* Update ARIA attributes for accessibility
|
|
1848
1858
|
*/
|
|
1849
1859
|
updateAriaAttributes() {
|
|
1850
|
-
this.ariaLabel &&
|
|
1860
|
+
this.ariaLabel && Ut(this, "aria-label", this.ariaLabel), this.ariaDescribedby && Ut(this, "aria-describedby", this.ariaDescribedby), Ut(this, "aria-busy", this.dataController.isLoading ? "true" : "false");
|
|
1851
1861
|
}
|
|
1852
1862
|
/**
|
|
1853
1863
|
* Update host CSS classes based on state
|
|
@@ -1860,11 +1870,11 @@ const $t = {
|
|
|
1860
1870
|
*/
|
|
1861
1871
|
getBreakpointClasses() {
|
|
1862
1872
|
return {
|
|
1863
|
-
"pc-mobile": window.matchMedia(`(max-width: ${
|
|
1873
|
+
"pc-mobile": window.matchMedia(`(max-width: ${bt.mobile})`).matches,
|
|
1864
1874
|
"pc-tablet": window.matchMedia(
|
|
1865
|
-
`(min-width: ${
|
|
1875
|
+
`(min-width: ${bt.mobile}) and (max-width: ${bt.tablet})`
|
|
1866
1876
|
).matches,
|
|
1867
|
-
"pc-desktop": window.matchMedia(`(min-width: ${
|
|
1877
|
+
"pc-desktop": window.matchMedia(`(min-width: ${bt.desktop})`).matches
|
|
1868
1878
|
};
|
|
1869
1879
|
}
|
|
1870
1880
|
/**
|
|
@@ -1872,7 +1882,7 @@ const $t = {
|
|
|
1872
1882
|
*/
|
|
1873
1883
|
announceSelectionChange(t, o, r) {
|
|
1874
1884
|
const s = `Poll for "${t}"`, i = r ? `${o.label} selected` : `${o.label} unselected`;
|
|
1875
|
-
|
|
1885
|
+
er(or(s, i));
|
|
1876
1886
|
}
|
|
1877
1887
|
/** Common render methods */
|
|
1878
1888
|
renderLabel() {
|
|
@@ -1903,7 +1913,7 @@ const $t = {
|
|
|
1903
1913
|
tabindex="0"
|
|
1904
1914
|
aria-label="Edit vote"
|
|
1905
1915
|
@keydown="${this.handleEditToggleKeyDown}"
|
|
1906
|
-
>${
|
|
1916
|
+
>${St}</span
|
|
1907
1917
|
>
|
|
1908
1918
|
` : u;
|
|
1909
1919
|
}
|
|
@@ -1922,7 +1932,7 @@ const $t = {
|
|
|
1922
1932
|
tabindex="0"
|
|
1923
1933
|
aria-label="${this.displayController.isChartVisible ? "Hide chart" : "Show chart"}"
|
|
1924
1934
|
@keydown="${() => this.displayController.toggleChartVisibility()}"
|
|
1925
|
-
>${this.displayController.isChartVisible ?
|
|
1935
|
+
>${this.displayController.isChartVisible ? Gt : Kt}</span
|
|
1926
1936
|
>
|
|
1927
1937
|
` : u;
|
|
1928
1938
|
}
|
|
@@ -1931,7 +1941,7 @@ const $t = {
|
|
|
1931
1941
|
return u;
|
|
1932
1942
|
const o = {
|
|
1933
1943
|
"pc-status": !0,
|
|
1934
|
-
[`pc-flex-content-${
|
|
1944
|
+
[`pc-flex-content-${_(this.statsPosition, this.statsAlign)}`]: !0
|
|
1935
1945
|
};
|
|
1936
1946
|
return c`<div class="${w(o)}" data-testid="pc-status">
|
|
1937
1947
|
${this.renderStatsText()} ${this.renderChartToggle()} ${this.renderEditToggleIcon()}
|
|
@@ -1949,7 +1959,7 @@ const $t = {
|
|
|
1949
1959
|
renderThankYouMessage() {
|
|
1950
1960
|
if (!this.displayController.shouldDisplayThankYouMsg())
|
|
1951
1961
|
return u;
|
|
1952
|
-
const t =
|
|
1962
|
+
const t = Go(this.thankYouMsg || "");
|
|
1953
1963
|
return c`
|
|
1954
1964
|
<div class="pc-thank-you-overlay" data-testid="poll-thank-you-overlay">
|
|
1955
1965
|
<div class="pc-thank-you" data-testid="thank-you">
|
|
@@ -1961,7 +1971,7 @@ const $t = {
|
|
|
1961
1971
|
@click="${() => this.displayController.toggleThankYouVisibility(!1)}"
|
|
1962
1972
|
role="button"
|
|
1963
1973
|
aria-label="Close"
|
|
1964
|
-
>${
|
|
1974
|
+
>${At}</span
|
|
1965
1975
|
>
|
|
1966
1976
|
</div>
|
|
1967
1977
|
</div>
|
|
@@ -1969,8 +1979,8 @@ const $t = {
|
|
|
1969
1979
|
`;
|
|
1970
1980
|
}
|
|
1971
1981
|
};
|
|
1972
|
-
|
|
1973
|
-
|
|
1982
|
+
Jt.styles = [
|
|
1983
|
+
R`
|
|
1974
1984
|
:host {
|
|
1975
1985
|
/* Default values for CSS variables - can be overridden by external :root or parent definitions */
|
|
1976
1986
|
--default-font-size-base: 1rem;
|
|
@@ -2050,113 +2060,113 @@ oe.styles = [
|
|
|
2050
2060
|
}
|
|
2051
2061
|
`
|
|
2052
2062
|
];
|
|
2053
|
-
let m =
|
|
2054
|
-
|
|
2055
|
-
|
|
2063
|
+
let m = Jt;
|
|
2064
|
+
v([
|
|
2065
|
+
h({ type: String, attribute: "show-stats" })
|
|
2056
2066
|
], m.prototype, "showStats");
|
|
2057
|
-
|
|
2058
|
-
|
|
2067
|
+
v([
|
|
2068
|
+
h({ type: Boolean, attribute: "show-chart" })
|
|
2059
2069
|
], m.prototype, "showChart");
|
|
2060
|
-
|
|
2061
|
-
|
|
2070
|
+
v([
|
|
2071
|
+
h({ type: Boolean, attribute: "initialized" })
|
|
2062
2072
|
], m.prototype, "initialized");
|
|
2063
|
-
|
|
2064
|
-
|
|
2073
|
+
v([
|
|
2074
|
+
h({ type: String, attribute: "primary-color" })
|
|
2065
2075
|
], m.prototype, "primaryColor");
|
|
2066
|
-
|
|
2067
|
-
|
|
2076
|
+
v([
|
|
2077
|
+
h({ type: String, attribute: "mute-color" })
|
|
2068
2078
|
], m.prototype, "muteColor");
|
|
2069
|
-
|
|
2070
|
-
|
|
2079
|
+
v([
|
|
2080
|
+
h({ type: String, attribute: "text-color" })
|
|
2071
2081
|
], m.prototype, "textColor");
|
|
2072
|
-
|
|
2073
|
-
|
|
2082
|
+
v([
|
|
2083
|
+
h({ type: String, attribute: "background-color" })
|
|
2074
2084
|
], m.prototype, "backgroundColor");
|
|
2075
|
-
|
|
2076
|
-
|
|
2085
|
+
v([
|
|
2086
|
+
h({ type: String, attribute: "accent-color" })
|
|
2077
2087
|
], m.prototype, "accentColor");
|
|
2078
|
-
|
|
2079
|
-
|
|
2088
|
+
v([
|
|
2089
|
+
h({ type: String, attribute: "star-color" })
|
|
2080
2090
|
], m.prototype, "starColor");
|
|
2081
|
-
|
|
2082
|
-
|
|
2091
|
+
v([
|
|
2092
|
+
h({ type: String, attribute: "star-hover-color" })
|
|
2083
2093
|
], m.prototype, "starHoverColor");
|
|
2084
|
-
|
|
2085
|
-
|
|
2094
|
+
v([
|
|
2095
|
+
h({ type: String, attribute: "star-size" })
|
|
2086
2096
|
], m.prototype, "starSize");
|
|
2087
|
-
|
|
2088
|
-
|
|
2097
|
+
v([
|
|
2098
|
+
h({ type: String, attribute: "reaction-size" })
|
|
2089
2099
|
], m.prototype, "reactionSize");
|
|
2090
|
-
|
|
2091
|
-
|
|
2100
|
+
v([
|
|
2101
|
+
h({ type: String })
|
|
2092
2102
|
], m.prototype, "size");
|
|
2093
|
-
|
|
2094
|
-
|
|
2103
|
+
v([
|
|
2104
|
+
h({ type: String, attribute: "aria-label" })
|
|
2095
2105
|
], m.prototype, "ariaLabel");
|
|
2096
|
-
|
|
2097
|
-
|
|
2106
|
+
v([
|
|
2107
|
+
h({ type: String, attribute: "aria-describedby" })
|
|
2098
2108
|
], m.prototype, "ariaDescribedby");
|
|
2099
|
-
|
|
2100
|
-
|
|
2109
|
+
v([
|
|
2110
|
+
h({ type: Number, attribute: "min-contrast" })
|
|
2101
2111
|
], m.prototype, "minContrast");
|
|
2102
|
-
|
|
2103
|
-
|
|
2112
|
+
v([
|
|
2113
|
+
h({ type: String })
|
|
2104
2114
|
], m.prototype, "css");
|
|
2105
|
-
|
|
2106
|
-
|
|
2115
|
+
v([
|
|
2116
|
+
h({ type: Array })
|
|
2107
2117
|
], m.prototype, "options");
|
|
2108
|
-
|
|
2109
|
-
|
|
2118
|
+
v([
|
|
2119
|
+
h({ type: String, attribute: "widget-id" })
|
|
2110
2120
|
], m.prototype, "widgetId");
|
|
2111
|
-
|
|
2112
|
-
|
|
2121
|
+
v([
|
|
2122
|
+
h({ type: String, attribute: "name" })
|
|
2113
2123
|
], m.prototype, "name");
|
|
2114
|
-
|
|
2115
|
-
|
|
2124
|
+
v([
|
|
2125
|
+
h({ type: String })
|
|
2116
2126
|
], m.prototype, "metadata");
|
|
2117
|
-
|
|
2118
|
-
|
|
2127
|
+
v([
|
|
2128
|
+
h({ type: String, attribute: "data-func" })
|
|
2119
2129
|
], m.prototype, "dataFunc");
|
|
2120
|
-
|
|
2121
|
-
|
|
2130
|
+
v([
|
|
2131
|
+
h({ type: String, attribute: "data-endpoint" })
|
|
2122
2132
|
], m.prototype, "dataEndpoint");
|
|
2123
|
-
|
|
2124
|
-
|
|
2133
|
+
v([
|
|
2134
|
+
h({ type: String })
|
|
2125
2135
|
], m.prototype, "question");
|
|
2126
|
-
|
|
2127
|
-
|
|
2136
|
+
v([
|
|
2137
|
+
h({ type: String, attribute: "question-position" })
|
|
2128
2138
|
], m.prototype, "questionPosition");
|
|
2129
|
-
|
|
2130
|
-
|
|
2139
|
+
v([
|
|
2140
|
+
h({ type: String, attribute: "question-align" })
|
|
2131
2141
|
], m.prototype, "questionAlign");
|
|
2132
|
-
|
|
2133
|
-
|
|
2142
|
+
v([
|
|
2143
|
+
h({ type: String, attribute: "stats-text" })
|
|
2134
2144
|
], m.prototype, "statsText");
|
|
2135
|
-
|
|
2136
|
-
|
|
2145
|
+
v([
|
|
2146
|
+
h({ type: String, attribute: "stats-position" })
|
|
2137
2147
|
], m.prototype, "statsPosition");
|
|
2138
|
-
|
|
2139
|
-
|
|
2148
|
+
v([
|
|
2149
|
+
h({ type: String, attribute: "stats-align" })
|
|
2140
2150
|
], m.prototype, "statsAlign");
|
|
2141
|
-
|
|
2142
|
-
|
|
2151
|
+
v([
|
|
2152
|
+
h({ type: String, attribute: "button-text" })
|
|
2143
2153
|
], m.prototype, "buttonText");
|
|
2144
|
-
|
|
2145
|
-
|
|
2154
|
+
v([
|
|
2155
|
+
h({ type: String, attribute: "button-radius" })
|
|
2146
2156
|
], m.prototype, "buttonRadius");
|
|
2147
|
-
|
|
2148
|
-
|
|
2157
|
+
v([
|
|
2158
|
+
h({ type: String, attribute: "thank-you-msg" })
|
|
2149
2159
|
], m.prototype, "thankYouMsg");
|
|
2150
|
-
|
|
2151
|
-
|
|
2160
|
+
v([
|
|
2161
|
+
h({ type: Boolean, attribute: "multiple" })
|
|
2152
2162
|
], m.prototype, "multiple");
|
|
2153
|
-
|
|
2154
|
-
|
|
2163
|
+
v([
|
|
2164
|
+
h({ type: Boolean, reflect: !0 })
|
|
2155
2165
|
], m.prototype, "inline");
|
|
2156
|
-
|
|
2157
|
-
|
|
2166
|
+
v([
|
|
2167
|
+
h({ type: Boolean, reflect: !0 })
|
|
2158
2168
|
], m.prototype, "readonly");
|
|
2159
|
-
const
|
|
2169
|
+
const sr = R`
|
|
2160
2170
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
2161
2171
|
|
|
2162
2172
|
.pc-body {
|
|
@@ -2607,7 +2617,7 @@ const tr = U`
|
|
|
2607
2617
|
animation: none;
|
|
2608
2618
|
}
|
|
2609
2619
|
}
|
|
2610
|
-
`,
|
|
2620
|
+
`, Tt = R`
|
|
2611
2621
|
/* Default values for CSS variables - can be overridden by external :root or parent definitions */
|
|
2612
2622
|
:host {
|
|
2613
2623
|
--default-primary-color: #2196f3;
|
|
@@ -3326,7 +3336,7 @@ const tr = U`
|
|
|
3326
3336
|
opacity: 1;
|
|
3327
3337
|
}
|
|
3328
3338
|
}
|
|
3329
|
-
`,
|
|
3339
|
+
`, ir = R`
|
|
3330
3340
|
:host {
|
|
3331
3341
|
--popover-bg: light-dark(#ffffff, #1a1a1a);
|
|
3332
3342
|
--popover-border: light-dark(#e0e0e0, #333333);
|
|
@@ -3448,21 +3458,21 @@ const tr = U`
|
|
|
3448
3458
|
max-width: 100%;
|
|
3449
3459
|
}
|
|
3450
3460
|
`;
|
|
3451
|
-
var
|
|
3452
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
3461
|
+
var ar = Object.defineProperty, nr = Object.getOwnPropertyDescriptor, B = (e, t, o, r) => {
|
|
3462
|
+
for (var s = r > 1 ? void 0 : r ? nr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
3453
3463
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
3454
|
-
return r && s &&
|
|
3464
|
+
return r && s && ar(t, o, s), s;
|
|
3455
3465
|
};
|
|
3456
|
-
let
|
|
3466
|
+
let T = class extends N {
|
|
3457
3467
|
constructor() {
|
|
3458
3468
|
super(...arguments), this.open = !1, this.position = "auto", this.isClosing = !1, this.computedPosition = "bottom", this.popoverStyles = {}, this.arrowStyles = {}, this.updatePosition = () => {
|
|
3459
|
-
var
|
|
3469
|
+
var f;
|
|
3460
3470
|
if (!this.anchor || !this.open) return;
|
|
3461
|
-
const e = this.anchor.getBoundingClientRect(), t = window.innerWidth, o = window.innerHeight, r = 12, s = (
|
|
3471
|
+
const e = this.anchor.getBoundingClientRect(), t = window.innerWidth, o = window.innerHeight, r = 12, s = (f = this.popoverElement) == null ? void 0 : f.getBoundingClientRect(), i = (s == null ? void 0 : s.width) || 280, a = (s == null ? void 0 : s.height) || 200;
|
|
3462
3472
|
let l = this.position;
|
|
3463
3473
|
if (l === "auto") {
|
|
3464
|
-
const
|
|
3465
|
-
l =
|
|
3474
|
+
const b = o - e.bottom, y = e.top;
|
|
3475
|
+
l = b >= a + r || b >= y ? "bottom" : "top";
|
|
3466
3476
|
}
|
|
3467
3477
|
this.computedPosition = l;
|
|
3468
3478
|
let n, d;
|
|
@@ -3542,35 +3552,35 @@ let I = class extends R {
|
|
|
3542
3552
|
`;
|
|
3543
3553
|
}
|
|
3544
3554
|
};
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
],
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
],
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
],
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
],
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
],
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
],
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
],
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
],
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
],
|
|
3573
|
-
const
|
|
3555
|
+
T.styles = [ir];
|
|
3556
|
+
B([
|
|
3557
|
+
h({ type: Boolean, reflect: !0 })
|
|
3558
|
+
], T.prototype, "open", 2);
|
|
3559
|
+
B([
|
|
3560
|
+
h({ type: String })
|
|
3561
|
+
], T.prototype, "position", 2);
|
|
3562
|
+
B([
|
|
3563
|
+
h({ attribute: !1 })
|
|
3564
|
+
], T.prototype, "anchor", 2);
|
|
3565
|
+
B([
|
|
3566
|
+
C()
|
|
3567
|
+
], T.prototype, "isClosing", 2);
|
|
3568
|
+
B([
|
|
3569
|
+
C()
|
|
3570
|
+
], T.prototype, "computedPosition", 2);
|
|
3571
|
+
B([
|
|
3572
|
+
C()
|
|
3573
|
+
], T.prototype, "popoverStyles", 2);
|
|
3574
|
+
B([
|
|
3575
|
+
C()
|
|
3576
|
+
], T.prototype, "arrowStyles", 2);
|
|
3577
|
+
B([
|
|
3578
|
+
ft(".pc-popover")
|
|
3579
|
+
], T.prototype, "popoverElement", 2);
|
|
3580
|
+
T = B([
|
|
3581
|
+
F("pc-popover")
|
|
3582
|
+
], T);
|
|
3583
|
+
const lr = R`
|
|
3574
3584
|
:host {
|
|
3575
3585
|
--sheet-bg: light-dark(#ffffff, #1a1a1a);
|
|
3576
3586
|
--sheet-border: light-dark(#e0e0e0, #333333);
|
|
@@ -3683,12 +3693,12 @@ const sr = U`
|
|
|
3683
3693
|
max-width: 100%;
|
|
3684
3694
|
}
|
|
3685
3695
|
`;
|
|
3686
|
-
var
|
|
3687
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
3696
|
+
var cr = Object.defineProperty, dr = Object.getOwnPropertyDescriptor, J = (e, t, o, r) => {
|
|
3697
|
+
for (var s = r > 1 ? void 0 : r ? dr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
3688
3698
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
3689
|
-
return r && s &&
|
|
3699
|
+
return r && s && cr(t, o, s), s;
|
|
3690
3700
|
};
|
|
3691
|
-
let
|
|
3701
|
+
let D = class extends N {
|
|
3692
3702
|
constructor() {
|
|
3693
3703
|
super(...arguments), this.open = !1, this.dragToClose = !0, this.isClosing = !1, this.isDragging = !1, this.dragOffset = 0, this.dragStartY = 0, this.sheetHeight = 0, this.handleKeyDown = (e) => {
|
|
3694
3704
|
if (e.key === "Escape" && this.open && (e.preventDefault(), e.stopPropagation(), this.close()), e.key === "Tab" && this.open && this.sheetElement) {
|
|
@@ -3782,35 +3792,35 @@ let B = class extends R {
|
|
|
3782
3792
|
`;
|
|
3783
3793
|
}
|
|
3784
3794
|
};
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
],
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
],
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
],
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
],
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
],
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
],
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
],
|
|
3807
|
-
var
|
|
3808
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
3795
|
+
D.styles = [lr];
|
|
3796
|
+
J([
|
|
3797
|
+
h({ type: Boolean, reflect: !0 })
|
|
3798
|
+
], D.prototype, "open", 2);
|
|
3799
|
+
J([
|
|
3800
|
+
h({ type: Boolean, attribute: "drag-to-close" })
|
|
3801
|
+
], D.prototype, "dragToClose", 2);
|
|
3802
|
+
J([
|
|
3803
|
+
C()
|
|
3804
|
+
], D.prototype, "isClosing", 2);
|
|
3805
|
+
J([
|
|
3806
|
+
C()
|
|
3807
|
+
], D.prototype, "isDragging", 2);
|
|
3808
|
+
J([
|
|
3809
|
+
C()
|
|
3810
|
+
], D.prototype, "dragOffset", 2);
|
|
3811
|
+
J([
|
|
3812
|
+
ft(".pc-bottom-sheet")
|
|
3813
|
+
], D.prototype, "sheetElement", 2);
|
|
3814
|
+
D = J([
|
|
3815
|
+
F("pc-bottom-sheet")
|
|
3816
|
+
], D);
|
|
3817
|
+
var pr = Object.defineProperty, ur = Object.getOwnPropertyDescriptor, gt = (e, t, o, r) => {
|
|
3818
|
+
for (var s = r > 1 ? void 0 : r ? ur(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
3809
3819
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
3810
|
-
return r && s &&
|
|
3820
|
+
return r && s && pr(t, o, s), s;
|
|
3811
3821
|
};
|
|
3812
|
-
const
|
|
3813
|
-
let
|
|
3822
|
+
const hr = 768;
|
|
3823
|
+
let Z = class extends N {
|
|
3814
3824
|
constructor() {
|
|
3815
3825
|
super(...arguments), this.open = !1, this.position = "auto", this.isMobile = !1, this.handleMediaChange = (e) => {
|
|
3816
3826
|
this.isMobile = e.matches;
|
|
@@ -3826,7 +3836,7 @@ let Q = class extends R {
|
|
|
3826
3836
|
super.disconnectedCallback(), (e = this.mediaQuery) == null || e.removeEventListener("change", this.handleMediaChange);
|
|
3827
3837
|
}
|
|
3828
3838
|
setupMediaQuery() {
|
|
3829
|
-
this.mediaQuery = window.matchMedia(`(max-width: ${
|
|
3839
|
+
this.mediaQuery = window.matchMedia(`(max-width: ${hr - 1}px)`), this.isMobile = this.mediaQuery.matches, this.mediaQuery.addEventListener("change", this.handleMediaChange);
|
|
3830
3840
|
}
|
|
3831
3841
|
render() {
|
|
3832
3842
|
return this.isMobile ? c`
|
|
@@ -3845,34 +3855,34 @@ let Q = class extends R {
|
|
|
3845
3855
|
`;
|
|
3846
3856
|
}
|
|
3847
3857
|
};
|
|
3848
|
-
|
|
3858
|
+
Z.styles = R`
|
|
3849
3859
|
:host {
|
|
3850
3860
|
display: contents;
|
|
3851
3861
|
}
|
|
3852
3862
|
`;
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
],
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
],
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
],
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
],
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
],
|
|
3868
|
-
var
|
|
3869
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
3863
|
+
gt([
|
|
3864
|
+
h({ type: Boolean, reflect: !0 })
|
|
3865
|
+
], Z.prototype, "open", 2);
|
|
3866
|
+
gt([
|
|
3867
|
+
h({ type: String })
|
|
3868
|
+
], Z.prototype, "position", 2);
|
|
3869
|
+
gt([
|
|
3870
|
+
h({ attribute: !1 })
|
|
3871
|
+
], Z.prototype, "anchor", 2);
|
|
3872
|
+
gt([
|
|
3873
|
+
C()
|
|
3874
|
+
], Z.prototype, "isMobile", 2);
|
|
3875
|
+
Z = gt([
|
|
3876
|
+
F("pc-responsive-modal")
|
|
3877
|
+
], Z);
|
|
3878
|
+
var fr = Object.defineProperty, gr = Object.getOwnPropertyDescriptor, Y = (e, t, o, r) => {
|
|
3879
|
+
for (var s = r > 1 ? void 0 : r ? gr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
3870
3880
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
3871
|
-
return r && s &&
|
|
3881
|
+
return r && s && fr(t, o, s), s;
|
|
3872
3882
|
};
|
|
3873
|
-
let
|
|
3883
|
+
let O = class extends m {
|
|
3874
3884
|
constructor() {
|
|
3875
|
-
super(), this.min = 0, this.max = 10, this.type =
|
|
3885
|
+
super(), this.min = 0, this.max = 10, this.type = $.nps, this.minLabel = "Not at all", this.maxLabel = "Extremely", this.minMaxPosition = "top", this.hoverValue = -1, this.popoverOpen = !1, this.handleNumberLeave = () => {
|
|
3876
3886
|
this.hoverValue = -1;
|
|
3877
3887
|
}, this.handleKeyDown = (e) => {
|
|
3878
3888
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.hoverValue >= 0 && this.handleNumberClick(this.hoverValue));
|
|
@@ -3882,15 +3892,15 @@ let M = class extends m {
|
|
|
3882
3892
|
* Render NPS buttons for edit mode
|
|
3883
3893
|
*/
|
|
3884
3894
|
renderNpsButtons() {
|
|
3885
|
-
const e = Array.from({ length: this.max - this.min + 1 }, (s, i) => i + this.min), t = `nps-control-${this.name || this.type}`, o =
|
|
3886
|
-
role:
|
|
3895
|
+
const e = Array.from({ length: this.max - this.min + 1 }, (s, i) => i + this.min), t = `nps-control-${this.name || this.type}`, o = et({
|
|
3896
|
+
role: M.GROUP,
|
|
3887
3897
|
ariaLabel: this.question || "NPS Rating",
|
|
3888
3898
|
ariaDescribedby: `${t}-description`
|
|
3889
3899
|
}), r = e.map((s) => {
|
|
3890
3900
|
const i = this.dataController.isValueSelected(String(s)), a = {
|
|
3891
3901
|
"nps-button": !0,
|
|
3892
3902
|
selected: i
|
|
3893
|
-
}, l =
|
|
3903
|
+
}, l = Io(`Rate ${s}`, i, !1);
|
|
3894
3904
|
return c`
|
|
3895
3905
|
<button
|
|
3896
3906
|
data-testid="nps-button-${s}"
|
|
@@ -3934,10 +3944,10 @@ let M = class extends m {
|
|
|
3934
3944
|
* NPS score displayed prominently in the middle
|
|
3935
3945
|
*/
|
|
3936
3946
|
renderChart() {
|
|
3937
|
-
const e = this.dataController.stats, t = (e == null ? void 0 : e.nps) ?? 0, o = 100, r = 100, s = 80, i = (
|
|
3938
|
-
x: o + s * Math.cos(
|
|
3939
|
-
y: r - s * Math.sin(
|
|
3940
|
-
}), a = i(Math.PI), l = i(Math.PI / 2), n = i(Math.PI / 4), d = i(0), p = (
|
|
3947
|
+
const e = this.dataController.stats, t = (e == null ? void 0 : e.nps) ?? 0, o = 100, r = 100, s = 80, i = (I) => ({
|
|
3948
|
+
x: o + s * Math.cos(I),
|
|
3949
|
+
y: r - s * Math.sin(I)
|
|
3950
|
+
}), a = i(Math.PI), l = i(Math.PI / 2), n = i(Math.PI / 4), d = i(0), p = (I, Qt, Ke = 0) => `M ${I.x} ${I.y} A ${s} ${s} 0 ${Ke} 1 ${Qt.x} ${Qt.y}`, f = p(a, l), b = p(l, n), y = p(n, d), A = ((I) => Math.PI - (I + 100) / 200 * Math.PI)(t), k = i(A);
|
|
3941
3951
|
return c`
|
|
3942
3952
|
<div class="nps-semicircle-gauge" data-testid="nps-semicircle-gauge">
|
|
3943
3953
|
<svg viewBox="0 0 200 115">
|
|
@@ -3948,12 +3958,12 @@ let M = class extends m {
|
|
|
3948
3958
|
/>
|
|
3949
3959
|
|
|
3950
3960
|
<!-- Colored segments -->
|
|
3951
|
-
<path class="gauge-arc gauge-arc-detractor" d="${
|
|
3952
|
-
<path class="gauge-arc gauge-arc-passive" d="${
|
|
3953
|
-
<path class="gauge-arc gauge-arc-promoter" d="${
|
|
3961
|
+
<path class="gauge-arc gauge-arc-detractor" d="${f}" />
|
|
3962
|
+
<path class="gauge-arc gauge-arc-passive" d="${b}" />
|
|
3963
|
+
<path class="gauge-arc gauge-arc-promoter" d="${y}" />
|
|
3954
3964
|
|
|
3955
3965
|
<!-- Needle indicator -->
|
|
3956
|
-
<circle class="gauge-needle" cx="${
|
|
3966
|
+
<circle class="gauge-needle" cx="${k.x}" cy="${k.y}" r="5" />
|
|
3957
3967
|
|
|
3958
3968
|
<!-- Score display in center -->
|
|
3959
3969
|
<text class="gauge-score" x="${o}" y="${r - 15}">${t}</text>
|
|
@@ -4013,7 +4023,7 @@ let M = class extends m {
|
|
|
4013
4023
|
* Uses SVG with 3 colored segments for detractors/passives/promoters
|
|
4014
4024
|
*/
|
|
4015
4025
|
renderInlineGauge() {
|
|
4016
|
-
const e = this.dataController.stats, t = (e == null ? void 0 : e.breakdown) || {}, o = 8, r = 2 * Math.PI * o, s =
|
|
4026
|
+
const e = this.dataController.stats, t = (e == null ? void 0 : e.breakdown) || {}, o = 8, r = 2 * Math.PI * o, s = Vo(t), i = s.detractors + s.passives + s.promoters;
|
|
4017
4027
|
if (i === 0)
|
|
4018
4028
|
return c`
|
|
4019
4029
|
<div class="inline-nps-gauge">
|
|
@@ -4022,9 +4032,9 @@ let M = class extends m {
|
|
|
4022
4032
|
</svg>
|
|
4023
4033
|
</div>
|
|
4024
4034
|
`;
|
|
4025
|
-
const a = s.detractors / i * 100, l = s.passives / i * 100, n = s.promoters / i * 100, d = a / 100 * r, p = l / 100 * r,
|
|
4026
|
-
let
|
|
4027
|
-
return
|
|
4035
|
+
const a = s.detractors / i * 100, l = s.passives / i * 100, n = s.promoters / i * 100, d = a / 100 * r, p = l / 100 * r, f = n / 100 * r, b = 0, y = -d, x = -(d + p), A = this.getUserScore();
|
|
4036
|
+
let k = "gauge-bg";
|
|
4037
|
+
return A !== null && (A <= 6 ? k = "gauge-detractor" : A <= 8 ? k = "gauge-passive" : k = "gauge-promoter"), c`
|
|
4028
4038
|
<div class="inline-nps-gauge">
|
|
4029
4039
|
<svg viewBox="0 0 20 20">
|
|
4030
4040
|
<!-- Background circle -->
|
|
@@ -4036,7 +4046,7 @@ let M = class extends m {
|
|
|
4036
4046
|
cy="10"
|
|
4037
4047
|
r="${o}"
|
|
4038
4048
|
stroke-dasharray="${d} ${r}"
|
|
4039
|
-
stroke-dashoffset="${
|
|
4049
|
+
stroke-dashoffset="${b}"
|
|
4040
4050
|
/>
|
|
4041
4051
|
<!-- Passive segment (yellow) -->
|
|
4042
4052
|
<circle
|
|
@@ -4045,7 +4055,7 @@ let M = class extends m {
|
|
|
4045
4055
|
cy="10"
|
|
4046
4056
|
r="${o}"
|
|
4047
4057
|
stroke-dasharray="${p} ${r}"
|
|
4048
|
-
stroke-dashoffset="${
|
|
4058
|
+
stroke-dashoffset="${y}"
|
|
4049
4059
|
/>
|
|
4050
4060
|
<!-- Promoter segment (green) -->
|
|
4051
4061
|
<circle
|
|
@@ -4053,11 +4063,11 @@ let M = class extends m {
|
|
|
4053
4063
|
cx="10"
|
|
4054
4064
|
cy="10"
|
|
4055
4065
|
r="${o}"
|
|
4056
|
-
stroke-dasharray="${
|
|
4057
|
-
stroke-dashoffset="${
|
|
4066
|
+
stroke-dasharray="${f} ${r}"
|
|
4067
|
+
stroke-dashoffset="${x}"
|
|
4058
4068
|
/>
|
|
4059
4069
|
<!-- Center dot showing user's score category -->
|
|
4060
|
-
<circle class="gauge-dot ${
|
|
4070
|
+
<circle class="gauge-dot ${k}" cx="10" cy="10" r="2" />
|
|
4061
4071
|
</svg>
|
|
4062
4072
|
</div>
|
|
4063
4073
|
`;
|
|
@@ -4068,7 +4078,7 @@ let M = class extends m {
|
|
|
4068
4078
|
* Shows add icon when no selection, edit icon when user has submitted
|
|
4069
4079
|
*/
|
|
4070
4080
|
renderInlineTrigger() {
|
|
4071
|
-
const t = this.displayController.shouldShowStats() && this.statsText ? this.dataController.formatStatsText(this.statsText) : "", r = this.dataController.hasLocalStats() ?
|
|
4081
|
+
const t = this.displayController.shouldShowStats() && this.statsText ? this.dataController.formatStatsText(this.statsText) : "", r = this.dataController.hasLocalStats() ? St : _e;
|
|
4072
4082
|
return c`
|
|
4073
4083
|
<button
|
|
4074
4084
|
class="pc-inline-trigger"
|
|
@@ -4134,7 +4144,7 @@ let M = class extends m {
|
|
|
4134
4144
|
@keydown="${(e) => {
|
|
4135
4145
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.displayController.toggleChartVisibility());
|
|
4136
4146
|
}}"
|
|
4137
|
-
>${this.displayController.isChartVisible ?
|
|
4147
|
+
>${this.displayController.isChartVisible ? Gt : Kt}</span
|
|
4138
4148
|
>
|
|
4139
4149
|
`;
|
|
4140
4150
|
}
|
|
@@ -4153,7 +4163,7 @@ let M = class extends m {
|
|
|
4153
4163
|
aria-label="Close"
|
|
4154
4164
|
data-testid="popover-close-button"
|
|
4155
4165
|
>
|
|
4156
|
-
${
|
|
4166
|
+
${At}
|
|
4157
4167
|
</button>
|
|
4158
4168
|
${this.question ? c`<div class="pc-popover-question">${this.question}</div>` : u}
|
|
4159
4169
|
${this.renderPopoverNpsButtons()}
|
|
@@ -4203,11 +4213,11 @@ let M = class extends m {
|
|
|
4203
4213
|
renderStandardMode() {
|
|
4204
4214
|
const e = {
|
|
4205
4215
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
4206
|
-
[`pc-flex-align-${
|
|
4216
|
+
[`pc-flex-align-${_(this.questionPosition, this.questionAlign)}`]: !0
|
|
4207
4217
|
}, t = {
|
|
4208
4218
|
nps: !0,
|
|
4209
4219
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
4210
|
-
[`pc-flex-align-${
|
|
4220
|
+
[`pc-flex-align-${_(this.statsPosition, this.statsAlign)}`]: !0
|
|
4211
4221
|
};
|
|
4212
4222
|
return c`
|
|
4213
4223
|
<div class="pc-container ${w(e)}" data-testid="nps-container">
|
|
@@ -4226,32 +4236,32 @@ let M = class extends m {
|
|
|
4226
4236
|
return this.inline ? this.renderInlineMode() : this.readonly ? this.renderReadonlyMode() : this.renderStandardMode();
|
|
4227
4237
|
}
|
|
4228
4238
|
};
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
],
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
],
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
],
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
],
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
],
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
],
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
],
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
],
|
|
4254
|
-
const
|
|
4239
|
+
O.styles = [...m.styles, Tt, sr];
|
|
4240
|
+
Y([
|
|
4241
|
+
h({ type: String, attribute: "min-label" })
|
|
4242
|
+
], O.prototype, "minLabel", 2);
|
|
4243
|
+
Y([
|
|
4244
|
+
h({ type: String, attribute: "max-label" })
|
|
4245
|
+
], O.prototype, "maxLabel", 2);
|
|
4246
|
+
Y([
|
|
4247
|
+
h({ type: String, attribute: "thank-you-msg" })
|
|
4248
|
+
], O.prototype, "thankYouMsg", 2);
|
|
4249
|
+
Y([
|
|
4250
|
+
h({ type: String, attribute: "min-max-position" })
|
|
4251
|
+
], O.prototype, "minMaxPosition", 2);
|
|
4252
|
+
Y([
|
|
4253
|
+
C()
|
|
4254
|
+
], O.prototype, "hoverValue", 2);
|
|
4255
|
+
Y([
|
|
4256
|
+
C()
|
|
4257
|
+
], O.prototype, "popoverOpen", 2);
|
|
4258
|
+
Y([
|
|
4259
|
+
ft(".pc-inline-trigger")
|
|
4260
|
+
], O.prototype, "triggerElement", 2);
|
|
4261
|
+
O = Y([
|
|
4262
|
+
F("pc-nps")
|
|
4263
|
+
], O);
|
|
4264
|
+
const mr = R`
|
|
4255
4265
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
4256
4266
|
|
|
4257
4267
|
.pc-container {
|
|
@@ -4636,19 +4646,19 @@ const ur = U`
|
|
|
4636
4646
|
opacity: 0.8;
|
|
4637
4647
|
}
|
|
4638
4648
|
`;
|
|
4639
|
-
var
|
|
4640
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
4649
|
+
var vr = Object.defineProperty, br = Object.getOwnPropertyDescriptor, mt = (e, t, o, r) => {
|
|
4650
|
+
for (var s = r > 1 ? void 0 : r ? br(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
4641
4651
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
4642
|
-
return r && s &&
|
|
4652
|
+
return r && s && vr(t, o, s), s;
|
|
4643
4653
|
};
|
|
4644
|
-
let
|
|
4654
|
+
let X = class extends m {
|
|
4645
4655
|
constructor() {
|
|
4646
|
-
super(), this.type =
|
|
4656
|
+
super(), this.type = $.poll, this.multiple = !1, this.compact = !1, this.popoverOpen = !1, this.hasEditButton = !0, this.statsText = "{count} votes", this.questionPosition = "top", this.statsPosition = "bottom", this.showStats = "after-vote";
|
|
4647
4657
|
}
|
|
4648
4658
|
renderStatus() {
|
|
4649
4659
|
const t = {
|
|
4650
4660
|
"pc-status": !0,
|
|
4651
|
-
[`pc-flex-content-${
|
|
4661
|
+
[`pc-flex-content-${_("bottom", this.statsAlign)}`]: !0
|
|
4652
4662
|
};
|
|
4653
4663
|
return c`<div class="${w(t)}" data-testid="pc-status">
|
|
4654
4664
|
<span>${this.renderStatsText()} ${this.renderEditToggleIcon("stats-edit-button")}</span>
|
|
@@ -4699,16 +4709,16 @@ let tt = class extends m {
|
|
|
4699
4709
|
*/
|
|
4700
4710
|
renderOptionIcon(e) {
|
|
4701
4711
|
if (!(e != null && e.icon)) return "";
|
|
4702
|
-
const t =
|
|
4712
|
+
const t = Xt.DECORATIVE, o = (e == null ? void 0 : e.label) || "", r = e ? this.dataController.isValueSelected(e.value) : !1, s = qe(e == null ? void 0 : e.icon, {
|
|
4703
4713
|
type: t,
|
|
4704
4714
|
alt: o,
|
|
4705
4715
|
isSelected: r
|
|
4706
4716
|
});
|
|
4707
|
-
return
|
|
4717
|
+
return De(e == null ? void 0 : e.icon) ? c`<span
|
|
4708
4718
|
class="poll-option-icon"
|
|
4709
4719
|
aria-hidden="${s.ariaHidden ? "true" : "false"}"
|
|
4710
4720
|
>${e == null ? void 0 : e.icon}</span
|
|
4711
|
-
>` :
|
|
4721
|
+
>` : Pt(e == null ? void 0 : e.icon) ? c`<img
|
|
4712
4722
|
src="${e == null ? void 0 : e.icon}"
|
|
4713
4723
|
alt="${s.alt}"
|
|
4714
4724
|
class="poll-option-icon-img"
|
|
@@ -4724,7 +4734,7 @@ let tt = class extends m {
|
|
|
4724
4734
|
* Renders the selection indicator (checkbox or radio button) with proper ARIA roles
|
|
4725
4735
|
*/
|
|
4726
4736
|
renderSelectionIndicator() {
|
|
4727
|
-
const e = this.multiple ?
|
|
4737
|
+
const e = this.multiple ? M.CHECKBOX : M.RADIO;
|
|
4728
4738
|
return this.multiple ? c`<span class="poll-checkbox" role="${e}"></span>` : c`<span class="poll-radio" role="${e}"></span>`;
|
|
4729
4739
|
}
|
|
4730
4740
|
/**
|
|
@@ -4736,7 +4746,7 @@ let tt = class extends m {
|
|
|
4736
4746
|
selected: o,
|
|
4737
4747
|
"poll-option--compact": this.compact,
|
|
4738
4748
|
"poll-option--disabled": r
|
|
4739
|
-
}, i = t + 1, a = `poll-${this.type}-${i}`, l =
|
|
4749
|
+
}, i = t + 1, a = `poll-${this.type}-${i}`, l = zo(
|
|
4740
4750
|
e.label,
|
|
4741
4751
|
o,
|
|
4742
4752
|
r,
|
|
@@ -4770,7 +4780,7 @@ let tt = class extends m {
|
|
|
4770
4780
|
*/
|
|
4771
4781
|
renderPollOptions() {
|
|
4772
4782
|
var s;
|
|
4773
|
-
const e = this.multiple ?
|
|
4783
|
+
const e = this.multiple ? M.GROUP : M.RADIOGROUP, t = this.question || this.name || "Options", o = et({
|
|
4774
4784
|
role: e,
|
|
4775
4785
|
ariaLabel: t
|
|
4776
4786
|
});
|
|
@@ -4792,16 +4802,16 @@ let tt = class extends m {
|
|
|
4792
4802
|
*/
|
|
4793
4803
|
renderBarChart() {
|
|
4794
4804
|
var n, d;
|
|
4795
|
-
const e = ((n = this.dataController.stats) == null ? void 0 : n.breakdown) || {}, t = ((d = this.dataController.localStats) == null ? void 0 : d.breakdown) || {}, o = Object.values(e).reduce((p,
|
|
4796
|
-
const
|
|
4805
|
+
const e = ((n = this.dataController.stats) == null ? void 0 : n.breakdown) || {}, t = ((d = this.dataController.localStats) == null ? void 0 : d.breakdown) || {}, o = Object.values(e).reduce((p, f) => p + f, 0), r = this.options.map((p, f) => {
|
|
4806
|
+
const b = e[p.value] || 0, y = o > 0 ? Math.round(b / o * 100) : 0, x = (t[p.value] || 0) > 0;
|
|
4797
4807
|
return {
|
|
4798
4808
|
option: p,
|
|
4799
|
-
index:
|
|
4800
|
-
voteCount:
|
|
4801
|
-
percentage:
|
|
4802
|
-
isSelected:
|
|
4809
|
+
index: f,
|
|
4810
|
+
voteCount: b,
|
|
4811
|
+
percentage: y,
|
|
4812
|
+
isSelected: x
|
|
4803
4813
|
};
|
|
4804
|
-
}), s = this.multiple ?
|
|
4814
|
+
}), s = this.multiple ? M.GROUP : M.RADIOGROUP, i = this.question || this.name || "Options", a = et({
|
|
4805
4815
|
role: s,
|
|
4806
4816
|
ariaLabel: i
|
|
4807
4817
|
});
|
|
@@ -4815,7 +4825,7 @@ let tt = class extends m {
|
|
|
4815
4825
|
...=${a}
|
|
4816
4826
|
>
|
|
4817
4827
|
${r.map((p) => {
|
|
4818
|
-
const
|
|
4828
|
+
const f = {
|
|
4819
4829
|
"poll-option": !0,
|
|
4820
4830
|
"poll-option--compact": this.compact,
|
|
4821
4831
|
"poll-option--chart-view": !0,
|
|
@@ -4823,7 +4833,7 @@ let tt = class extends m {
|
|
|
4823
4833
|
};
|
|
4824
4834
|
return c`
|
|
4825
4835
|
<div
|
|
4826
|
-
class="${w(
|
|
4836
|
+
class="${w(f)}"
|
|
4827
4837
|
data-testid="poll-chart-item-${p.index}"
|
|
4828
4838
|
role="listitem"
|
|
4829
4839
|
aria-label="${p.option.label}: ${p.percentage}% (${p.voteCount} votes)"
|
|
@@ -4894,7 +4904,7 @@ let tt = class extends m {
|
|
|
4894
4904
|
* Shows add icon when no selection, edit icon when user has submitted
|
|
4895
4905
|
*/
|
|
4896
4906
|
renderInlineTrigger() {
|
|
4897
|
-
const t = this.displayController.shouldShowStats() && this.statsText ? this.dataController.formatStatsText(this.statsText) : "", r = this.dataController.hasLocalStats() ?
|
|
4907
|
+
const t = this.displayController.shouldShowStats() && this.statsText ? this.dataController.formatStatsText(this.statsText) : "", r = this.dataController.hasLocalStats() ? St : _e;
|
|
4898
4908
|
return c`
|
|
4899
4909
|
<button
|
|
4900
4910
|
class="pc-inline-trigger"
|
|
@@ -4953,7 +4963,7 @@ let tt = class extends m {
|
|
|
4953
4963
|
aria-label="Close"
|
|
4954
4964
|
data-testid="popover-close-button"
|
|
4955
4965
|
>
|
|
4956
|
-
${
|
|
4966
|
+
${At}
|
|
4957
4967
|
</button>
|
|
4958
4968
|
${this.question ? c`<div class="pc-popover-question">${this.question}</div>` : u}
|
|
4959
4969
|
${e ? this.renderBarChart() : this.renderPollOptions()}
|
|
@@ -4970,7 +4980,7 @@ let tt = class extends m {
|
|
|
4970
4980
|
@keydown=${(s) => {
|
|
4971
4981
|
(s.key === "Enter" || s.key === " ") && (s.preventDefault(), this.handlePopoverEditClick());
|
|
4972
4982
|
}}
|
|
4973
|
-
>${
|
|
4983
|
+
>${St}</span
|
|
4974
4984
|
>` : u}
|
|
4975
4985
|
</div>` : u}
|
|
4976
4986
|
</div>
|
|
@@ -5027,15 +5037,15 @@ let tt = class extends m {
|
|
|
5027
5037
|
* Render standard mode - original behavior
|
|
5028
5038
|
*/
|
|
5029
5039
|
renderStandardMode() {
|
|
5030
|
-
const e =
|
|
5040
|
+
const e = _(this.questionPosition, this.questionAlign), t = {
|
|
5031
5041
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
5032
5042
|
[`pc-flex-align-${e}`]: !0
|
|
5033
|
-
}, o =
|
|
5043
|
+
}, o = _(this.statsPosition, this.statsAlign), r = {
|
|
5034
5044
|
"pc-body": !0,
|
|
5035
5045
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
5036
5046
|
[`pc-flex-align-${o}`]: !0
|
|
5037
|
-
}, s =
|
|
5038
|
-
role:
|
|
5047
|
+
}, s = et({
|
|
5048
|
+
role: M.REGION,
|
|
5039
5049
|
ariaLabel: this.question || this.name || "Poll"
|
|
5040
5050
|
});
|
|
5041
5051
|
return c`
|
|
@@ -5056,23 +5066,23 @@ let tt = class extends m {
|
|
|
5056
5066
|
return this.inline ? this.renderInlineMode() : this.readonly ? this.renderReadonlyMode() : this.renderStandardMode();
|
|
5057
5067
|
}
|
|
5058
5068
|
};
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
],
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
],
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
],
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
],
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
],
|
|
5075
|
-
const
|
|
5069
|
+
X.styles = [...m.styles, Tt, mr];
|
|
5070
|
+
mt([
|
|
5071
|
+
h({ type: Boolean })
|
|
5072
|
+
], X.prototype, "multiple", 2);
|
|
5073
|
+
mt([
|
|
5074
|
+
h({ type: Boolean })
|
|
5075
|
+
], X.prototype, "compact", 2);
|
|
5076
|
+
mt([
|
|
5077
|
+
C()
|
|
5078
|
+
], X.prototype, "popoverOpen", 2);
|
|
5079
|
+
mt([
|
|
5080
|
+
ft(".pc-inline-trigger")
|
|
5081
|
+
], X.prototype, "triggerElement", 2);
|
|
5082
|
+
X = mt([
|
|
5083
|
+
F("pc-poll")
|
|
5084
|
+
], X);
|
|
5085
|
+
const yr = R`
|
|
5076
5086
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
5077
5087
|
|
|
5078
5088
|
.pc-section {
|
|
@@ -5259,10 +5269,10 @@ const gr = U`
|
|
|
5259
5269
|
* Copyright 2018 Google LLC
|
|
5260
5270
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5261
5271
|
*/
|
|
5262
|
-
const
|
|
5272
|
+
const We = "important", wr = " !" + We, xr = Fe(class extends Ye {
|
|
5263
5273
|
constructor(e) {
|
|
5264
5274
|
var t;
|
|
5265
|
-
if (super(e), e.type !==
|
|
5275
|
+
if (super(e), e.type !== He.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.");
|
|
5266
5276
|
}
|
|
5267
5277
|
render(e) {
|
|
5268
5278
|
return Object.keys(e).reduce((t, o) => {
|
|
@@ -5278,14 +5288,14 @@ const Ye = "important", mr = " !" + Ye, vr = He(class extends Fe {
|
|
|
5278
5288
|
const s = t[r];
|
|
5279
5289
|
if (s != null) {
|
|
5280
5290
|
this.ft.add(r);
|
|
5281
|
-
const i = typeof s == "string" && s.endsWith(
|
|
5282
|
-
r.includes("-") || i ? o.setProperty(r, i ? s.slice(0, -11) : s, i ?
|
|
5291
|
+
const i = typeof s == "string" && s.endsWith(wr);
|
|
5292
|
+
r.includes("-") || i ? o.setProperty(r, i ? s.slice(0, -11) : s, i ? We : "") : o[r] = s;
|
|
5283
5293
|
}
|
|
5284
5294
|
}
|
|
5285
|
-
return
|
|
5295
|
+
return j;
|
|
5286
5296
|
}
|
|
5287
5297
|
});
|
|
5288
|
-
function
|
|
5298
|
+
function wt(e, t = {}) {
|
|
5289
5299
|
if (!e || e.length === 0)
|
|
5290
5300
|
return c`<div class="pc-bar-chart pc-bar-chart--empty">No data available</div>`;
|
|
5291
5301
|
const o = Math.max(...e.map((i) => i.value)), s = { ...{
|
|
@@ -5314,7 +5324,7 @@ function Ct(e, t = {}) {
|
|
|
5314
5324
|
</div>
|
|
5315
5325
|
`;
|
|
5316
5326
|
}
|
|
5317
|
-
const
|
|
5327
|
+
const $e = {
|
|
5318
5328
|
// Faces
|
|
5319
5329
|
smile: "😊",
|
|
5320
5330
|
laugh: "😄",
|
|
@@ -5457,21 +5467,21 @@ const Ee = {
|
|
|
5457
5467
|
hiking: "🥾",
|
|
5458
5468
|
yoga: "🧘"
|
|
5459
5469
|
};
|
|
5460
|
-
function
|
|
5470
|
+
function kt(e) {
|
|
5461
5471
|
let t = "❓", o = !1;
|
|
5462
|
-
return e ? e in
|
|
5472
|
+
return e ? e in $e ? t = $e[e] : De(e) ? t = e : Pt(e) ? (o = !0, t = e) : /^\w+@\w+$/.test(e) ? t = e : e.endsWith(".svg") && !e.includes("/") ? (t = `https://cdn.jsdelivr.net/npm/@mdi/svg@7.4.47/svg/${e}`, o = !0) : t = e : t = "❓", {
|
|
5463
5473
|
icon: t,
|
|
5464
5474
|
isRemoteImage: o
|
|
5465
5475
|
};
|
|
5466
5476
|
}
|
|
5467
|
-
var
|
|
5468
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
5477
|
+
var $r = Object.defineProperty, Sr = Object.getOwnPropertyDescriptor, st = (e, t, o, r) => {
|
|
5478
|
+
for (var s = r > 1 ? void 0 : r ? Sr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
5469
5479
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
5470
|
-
return r && s &&
|
|
5480
|
+
return r && s && $r(t, o, s), s;
|
|
5471
5481
|
};
|
|
5472
|
-
let
|
|
5482
|
+
let q = class extends m {
|
|
5473
5483
|
constructor() {
|
|
5474
|
-
super(), this.type =
|
|
5484
|
+
super(), this.type = $.stars, this.icon = "★", this.numStars = 5, this.hoverValue = -1, this.popoverOpen = !1, this.handleStarKeyDown = (e) => {
|
|
5475
5485
|
if (e.key === "Enter" || e.key === " ") {
|
|
5476
5486
|
e.preventDefault();
|
|
5477
5487
|
const t = e.target, o = parseInt(t.dataset.star || "0");
|
|
@@ -5492,14 +5502,14 @@ let F = class extends m {
|
|
|
5492
5502
|
* Renders the star icon using resolveIcon for emoji, URL, or MDI support
|
|
5493
5503
|
*/
|
|
5494
5504
|
renderStarIcon() {
|
|
5495
|
-
const { icon: e, isRemoteImage: t } =
|
|
5505
|
+
const { icon: e, isRemoteImage: t } = kt(this.icon);
|
|
5496
5506
|
return t ? c`<img class="star-icon-img" src="${e}" alt="star" />` : e;
|
|
5497
5507
|
}
|
|
5498
5508
|
/**
|
|
5499
5509
|
* Gets the resolved icon string (for use in chart labels)
|
|
5500
5510
|
*/
|
|
5501
5511
|
getResolvedIconString() {
|
|
5502
|
-
const { icon: e, isRemoteImage: t } =
|
|
5512
|
+
const { icon: e, isRemoteImage: t } = kt(this.icon);
|
|
5503
5513
|
return t ? "★" : e;
|
|
5504
5514
|
}
|
|
5505
5515
|
/**
|
|
@@ -5510,22 +5520,22 @@ let F = class extends m {
|
|
|
5510
5520
|
renderStars(e = !1) {
|
|
5511
5521
|
var n;
|
|
5512
5522
|
const t = this.getUserVotePosition(), o = this.dataController.stats, r = (o == null ? void 0 : o.avg) ?? 0, s = ((n = this.dataController.localStats) == null ? void 0 : n.avg) ?? 0, i = this.readonly ? r : s, a = this.displayController.allowEdit(), l = Array.from({ length: this.numStars }, (d, p) => p + 1).map((d) => {
|
|
5513
|
-
const p = e ? t || 0 : Math.floor(i),
|
|
5523
|
+
const p = e ? t || 0 : Math.floor(i), f = d <= p || d <= (this.hoverValue || 0), b = !e && !f && d === Math.ceil(i) && i % 1 !== 0, y = {
|
|
5514
5524
|
star: !0,
|
|
5515
|
-
selected:
|
|
5516
|
-
partial:
|
|
5525
|
+
selected: f,
|
|
5526
|
+
partial: b,
|
|
5517
5527
|
"view-mode": !a
|
|
5518
|
-
},
|
|
5528
|
+
}, x = b ? { "--partial-fill": `${i % 1 * 100}%` } : {}, A = e ? () => this.handlePopoverStarClick(d) : () => this.handleStarClick(d);
|
|
5519
5529
|
return c`
|
|
5520
5530
|
<div class="pc-section" data-testid="pc-section">
|
|
5521
5531
|
<span
|
|
5522
5532
|
data-testid="${e ? "popover" : "stars-view"}-star-${d}"
|
|
5523
|
-
class=${w(
|
|
5524
|
-
style=${
|
|
5533
|
+
class=${w(y)}
|
|
5534
|
+
style=${xr(x)}
|
|
5525
5535
|
role="${a ? "button" : "presentation"}"
|
|
5526
5536
|
tabindex="${a ? "0" : ""}"
|
|
5527
5537
|
aria-label="${a ? `Rate ${d} star${d > 1 ? "s" : ""}` : ""}"
|
|
5528
|
-
@click="${
|
|
5538
|
+
@click="${A}"
|
|
5529
5539
|
@mouseenter="${() => this.handleStarHover(d)}"
|
|
5530
5540
|
@focus="${() => this.handleStarHover(d)}"
|
|
5531
5541
|
@mouseleave="${this.handleStarLeave}"
|
|
@@ -5549,7 +5559,7 @@ let F = class extends m {
|
|
|
5549
5559
|
label: n,
|
|
5550
5560
|
value: d,
|
|
5551
5561
|
icon: r
|
|
5552
|
-
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l =
|
|
5562
|
+
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l = wt(s, {
|
|
5553
5563
|
barColor: a,
|
|
5554
5564
|
labelFormatter: (n) => `${n.label} ${n.icon}`,
|
|
5555
5565
|
valueFormatter: (n) => `${o > 0 ? Math.round(n.value / o * 100) : 0}%`
|
|
@@ -5649,7 +5659,7 @@ let F = class extends m {
|
|
|
5649
5659
|
aria-label="Close"
|
|
5650
5660
|
data-testid="popover-close-button"
|
|
5651
5661
|
>
|
|
5652
|
-
${
|
|
5662
|
+
${At}
|
|
5653
5663
|
</button>
|
|
5654
5664
|
${this.question ? c`<div class="pc-popover-question">${this.question}</div>` : u}
|
|
5655
5665
|
${this.renderStars(!0)}
|
|
@@ -5672,7 +5682,7 @@ let F = class extends m {
|
|
|
5672
5682
|
label: n,
|
|
5673
5683
|
value: d,
|
|
5674
5684
|
icon: r
|
|
5675
|
-
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l =
|
|
5685
|
+
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l = wt(s, {
|
|
5676
5686
|
barColor: a,
|
|
5677
5687
|
labelFormatter: (n) => `${n.label} ${n.icon}`,
|
|
5678
5688
|
valueFormatter: (n) => `${o > 0 ? Math.round(n.value / o * 100) : 0}%`
|
|
@@ -5698,7 +5708,7 @@ let F = class extends m {
|
|
|
5698
5708
|
@keydown="${(e) => {
|
|
5699
5709
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.displayController.toggleChartVisibility());
|
|
5700
5710
|
}}"
|
|
5701
|
-
>${this.displayController.isChartVisible ?
|
|
5711
|
+
>${this.displayController.isChartVisible ? Gt : Kt}</span
|
|
5702
5712
|
>
|
|
5703
5713
|
`;
|
|
5704
5714
|
}
|
|
@@ -5741,7 +5751,7 @@ let F = class extends m {
|
|
|
5741
5751
|
label: n,
|
|
5742
5752
|
value: d,
|
|
5743
5753
|
icon: r
|
|
5744
|
-
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l =
|
|
5754
|
+
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l = wt(s, {
|
|
5745
5755
|
barColor: a,
|
|
5746
5756
|
labelFormatter: (n) => `${n.label} ${n.icon}`,
|
|
5747
5757
|
valueFormatter: (n) => `${o > 0 ? Math.round(n.value / o * 100) : 0}%`
|
|
@@ -5756,10 +5766,10 @@ let F = class extends m {
|
|
|
5756
5766
|
* Render standard mode - original behavior
|
|
5757
5767
|
*/
|
|
5758
5768
|
renderStandardMode() {
|
|
5759
|
-
const e =
|
|
5769
|
+
const e = _(this.questionPosition, this.questionAlign), t = {
|
|
5760
5770
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
5761
5771
|
[`pc-flex-align-${e}`]: !0
|
|
5762
|
-
}, o =
|
|
5772
|
+
}, o = _(this.statsPosition, this.statsAlign), r = {
|
|
5763
5773
|
"pc-body": !0,
|
|
5764
5774
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
5765
5775
|
[`pc-flex-align-${o}`]: !0
|
|
@@ -5779,26 +5789,26 @@ let F = class extends m {
|
|
|
5779
5789
|
return this.inline ? this.renderInlineMode() : this.readonly ? this.renderReadonlyMode() : this.renderStandardMode();
|
|
5780
5790
|
}
|
|
5781
5791
|
};
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
],
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
],
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
],
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
],
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
],
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
],
|
|
5801
|
-
const
|
|
5792
|
+
q.styles = [...m.styles, Tt, yr];
|
|
5793
|
+
st([
|
|
5794
|
+
h({ type: String })
|
|
5795
|
+
], q.prototype, "icon", 2);
|
|
5796
|
+
st([
|
|
5797
|
+
h({ type: Number, attribute: "num-stars" })
|
|
5798
|
+
], q.prototype, "numStars", 2);
|
|
5799
|
+
st([
|
|
5800
|
+
C()
|
|
5801
|
+
], q.prototype, "hoverValue", 2);
|
|
5802
|
+
st([
|
|
5803
|
+
C()
|
|
5804
|
+
], q.prototype, "popoverOpen", 2);
|
|
5805
|
+
st([
|
|
5806
|
+
ft(".pc-inline-trigger")
|
|
5807
|
+
], q.prototype, "triggerElement", 2);
|
|
5808
|
+
q = st([
|
|
5809
|
+
F("pc-stars")
|
|
5810
|
+
], q);
|
|
5811
|
+
const Cr = R`
|
|
5802
5812
|
/* Adjust stats text for reactions */
|
|
5803
5813
|
.pc-stats-text {
|
|
5804
5814
|
font-size: var(--pc-font-size-small, var(--default-font-size-small));
|
|
@@ -6061,15 +6071,15 @@ const wr = U`
|
|
|
6061
6071
|
animation: none;
|
|
6062
6072
|
}
|
|
6063
6073
|
}
|
|
6064
|
-
`,
|
|
6065
|
-
var
|
|
6066
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
6074
|
+
`, kr = "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";
|
|
6075
|
+
var Er = Object.defineProperty, Ar = Object.getOwnPropertyDescriptor, _t = (e, t, o, r) => {
|
|
6076
|
+
for (var s = r > 1 ? void 0 : r ? Ar(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
6067
6077
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
6068
|
-
return r && s &&
|
|
6078
|
+
return r && s && Er(t, o, s), s;
|
|
6069
6079
|
};
|
|
6070
|
-
let
|
|
6080
|
+
let rt = class extends m {
|
|
6071
6081
|
constructor() {
|
|
6072
|
-
super(), this.type =
|
|
6082
|
+
super(), this.type = $.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";
|
|
6073
6083
|
}
|
|
6074
6084
|
/**
|
|
6075
6085
|
* Get the display count for a specific reaction including local optimistic updates
|
|
@@ -6091,7 +6101,7 @@ let at = class extends m {
|
|
|
6091
6101
|
* Renders the icon for a reaction
|
|
6092
6102
|
*/
|
|
6093
6103
|
renderReactionIcon(e, t) {
|
|
6094
|
-
const { icon: o, isRemoteImage: r } =
|
|
6104
|
+
const { icon: o, isRemoteImage: r } = kt(e), s = Xt.FUNCTIONAL, i = t.tooltip || `${t.value} reaction`, a = qe(o, {
|
|
6095
6105
|
type: s,
|
|
6096
6106
|
alt: i,
|
|
6097
6107
|
ariaLabel: i,
|
|
@@ -6145,7 +6155,7 @@ let at = class extends m {
|
|
|
6145
6155
|
aria-expanded="${this.displayController.shouldShowReactionPopover()}"
|
|
6146
6156
|
aria-haspopup="true"
|
|
6147
6157
|
>
|
|
6148
|
-
<img src="${
|
|
6158
|
+
<img src="${kr}" alt="" class="trigger-icon" />
|
|
6149
6159
|
</button>
|
|
6150
6160
|
`;
|
|
6151
6161
|
}
|
|
@@ -6235,7 +6245,7 @@ let at = class extends m {
|
|
|
6235
6245
|
const e = this.dataController.getBreakdownInfo(), o = Object.entries(e.breakdownCount).filter(
|
|
6236
6246
|
([n, d]) => this.options.some((p) => p.value === n)
|
|
6237
6247
|
).map(([n, d]) => {
|
|
6238
|
-
const p = this.options.find((
|
|
6248
|
+
const p = this.options.find((f) => f.value === n);
|
|
6239
6249
|
return {
|
|
6240
6250
|
label: n,
|
|
6241
6251
|
// Use the reaction value as label
|
|
@@ -6243,7 +6253,7 @@ let at = class extends m {
|
|
|
6243
6253
|
icon: (p == null ? void 0 : p.icon) || n
|
|
6244
6254
|
// Use the icon or fall back to reaction value
|
|
6245
6255
|
};
|
|
6246
|
-
}), r = getComputedStyle(this), s = r.getPropertyValue("--pc-primary-color").trim(), a = r.getPropertyValue("--pc-accent-color").trim() || s || "#ffc107", l =
|
|
6256
|
+
}), r = getComputedStyle(this), s = r.getPropertyValue("--pc-primary-color").trim(), a = r.getPropertyValue("--pc-accent-color").trim() || s || "#ffc107", l = wt(o, {
|
|
6247
6257
|
barColor: a,
|
|
6248
6258
|
labelFormatter: (n) => `${n.label}`,
|
|
6249
6259
|
valueFormatter: (n) => `${e.totalCount > 0 ? Math.round(n.value / e.totalCount * 100) : 0}%`
|
|
@@ -6284,10 +6294,10 @@ let at = class extends m {
|
|
|
6284
6294
|
* (Reactions are inherently inline, so inline mode = standard mode)
|
|
6285
6295
|
*/
|
|
6286
6296
|
renderStandardMode() {
|
|
6287
|
-
const e =
|
|
6297
|
+
const e = _(this.questionPosition, this.questionAlign), t = {
|
|
6288
6298
|
[`pc-flex-pos-${this.questionPosition}`]: !0,
|
|
6289
6299
|
[`pc-flex-align-${e}`]: !0
|
|
6290
|
-
}, o =
|
|
6300
|
+
}, o = _(this.statsPosition, this.statsAlign), r = {
|
|
6291
6301
|
"pc-body": !0,
|
|
6292
6302
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
6293
6303
|
[`pc-flex-align-${o}`]: !0
|
|
@@ -6307,35 +6317,35 @@ let at = class extends m {
|
|
|
6307
6317
|
return this.readonly ? this.renderReadonlyMode() : this.renderStandardMode();
|
|
6308
6318
|
}
|
|
6309
6319
|
};
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
],
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
],
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
],
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
],
|
|
6323
|
-
function
|
|
6320
|
+
rt.styles = [...m.styles, Tt, Cr];
|
|
6321
|
+
_t([
|
|
6322
|
+
h({ type: Boolean, attribute: "show-counts" })
|
|
6323
|
+
], rt.prototype, "showCounts", 2);
|
|
6324
|
+
_t([
|
|
6325
|
+
h({ type: Boolean, reflect: !0 })
|
|
6326
|
+
], rt.prototype, "compact", 2);
|
|
6327
|
+
_t([
|
|
6328
|
+
h({ type: String, attribute: "popup-position" })
|
|
6329
|
+
], rt.prototype, "popupPosition", 2);
|
|
6330
|
+
rt = _t([
|
|
6331
|
+
F("pc-reaction")
|
|
6332
|
+
], rt);
|
|
6333
|
+
function nt(e, t, o = void 0) {
|
|
6324
6334
|
const r = e.getAttribute(t);
|
|
6325
6335
|
return r === null ? o : r == null ? void 0 : r.trim();
|
|
6326
6336
|
}
|
|
6327
|
-
function
|
|
6337
|
+
function Pr(e, t = void 0) {
|
|
6328
6338
|
const o = e.textContent;
|
|
6329
6339
|
return o === "" || o === null ? t : o == null ? void 0 : o.trim();
|
|
6330
6340
|
}
|
|
6331
|
-
var
|
|
6332
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
6341
|
+
var Tr = Object.defineProperty, _r = Object.getOwnPropertyDescriptor, it = (e, t, o, r) => {
|
|
6342
|
+
for (var s = r > 1 ? void 0 : r ? _r(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
6333
6343
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
6334
|
-
return r && s &&
|
|
6344
|
+
return r && s && Tr(t, o, s), s;
|
|
6335
6345
|
};
|
|
6336
|
-
let
|
|
6346
|
+
let H = class extends N {
|
|
6337
6347
|
constructor() {
|
|
6338
|
-
super(), this.options = "", this.parsedOptions = [], this.
|
|
6348
|
+
super(), this.options = "", this.parsedOptions = [], this.isPrefetching = !1, H.injectGlobalStyle();
|
|
6339
6349
|
}
|
|
6340
6350
|
/**
|
|
6341
6351
|
* Inject global style to hide poll-catch-option elements
|
|
@@ -6360,59 +6370,52 @@ let Y = class extends R {
|
|
|
6360
6370
|
return this;
|
|
6361
6371
|
}
|
|
6362
6372
|
connectedCallback() {
|
|
6363
|
-
super.connectedCallback(), this.
|
|
6364
|
-
}
|
|
6365
|
-
async maybeFetchType() {
|
|
6366
|
-
var t, o, r, s, i, a, l, n, d, p, h, v, x, k;
|
|
6367
|
-
if (this.type || !this.widgetId) return;
|
|
6368
|
-
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(this.widgetId)) {
|
|
6369
|
-
g.error(`poll-catch: Invalid widget-id format: ${this.widgetId}`);
|
|
6370
|
-
return;
|
|
6371
|
-
}
|
|
6372
|
-
this.isLoadingType = !0;
|
|
6373
|
-
try {
|
|
6374
|
-
const _ = `${this.getAttribute("data-endpoint") || Yt}/widgets/${encodeURIComponent(this.widgetId)}`, $ = await fetch(_);
|
|
6375
|
-
if (!$.ok)
|
|
6376
|
-
throw new Error(`API request failed with status: ${$.status}`);
|
|
6377
|
-
const y = await $.json();
|
|
6378
|
-
if (!y.success)
|
|
6379
|
-
throw new Error("Backend returned unsuccessful response");
|
|
6380
|
-
const E = (o = (t = y.data) == null ? void 0 : t.config) == null ? void 0 : o.type;
|
|
6381
|
-
if (!E)
|
|
6382
|
-
throw new Error("Backend response missing widget type");
|
|
6383
|
-
Wo(this.widgetId, {
|
|
6384
|
-
type: E,
|
|
6385
|
-
attributes: ((s = (r = y.data) == null ? void 0 : r.config) == null ? void 0 : s.attributes) || null,
|
|
6386
|
-
stats: {
|
|
6387
|
-
count: ((a = (i = y.data) == null ? void 0 : i.stats) == null ? void 0 : a.count) ?? 0,
|
|
6388
|
-
sum: ((n = (l = y.data) == null ? void 0 : l.stats) == null ? void 0 : n.sum) ?? 0,
|
|
6389
|
-
breakdown: ((p = (d = y.data) == null ? void 0 : d.stats) == null ? void 0 : p.breakdown) ?? {},
|
|
6390
|
-
updatedAt: ((v = (h = y.data) == null ? void 0 : h.stats) == null ? void 0 : v.updatedAt) || ((k = (x = y.data) == null ? void 0 : x.stats) == null ? void 0 : k.updated_at)
|
|
6391
|
-
}
|
|
6392
|
-
}), this.type = E, this.isLoadingType = !1, await this.updateComplete, this.forceUpdate();
|
|
6393
|
-
} catch (P) {
|
|
6394
|
-
g.error("poll-catch: Failed to fetch widget config", P);
|
|
6395
|
-
} finally {
|
|
6396
|
-
this.isLoadingType = !1;
|
|
6397
|
-
}
|
|
6373
|
+
super.connectedCallback(), this.widgetId && (this.type = void 0, this.prefetchWidgetConfig());
|
|
6398
6374
|
}
|
|
6399
6375
|
forceUpdate() {
|
|
6400
6376
|
this.forwardAttributesToWidget(), this.forwardOptionsToWidget();
|
|
6401
6377
|
}
|
|
6402
6378
|
/**
|
|
6403
|
-
*
|
|
6379
|
+
* Runs synchronously after every render cycle.
|
|
6380
|
+
* Always forwards attributes so the child widget has them (especially widget-id)
|
|
6381
|
+
* BEFORE DataController's async loadStats() fires. This is critical because
|
|
6382
|
+
* loadStats() starts in hostConnected() and yields at its first await — if
|
|
6383
|
+
* attributes aren't set by then, validation fails.
|
|
6384
|
+
*
|
|
6385
|
+
* Options are only forwarded when type or options change to avoid an infinite
|
|
6386
|
+
* loop (forwardOptionsToWidget sets parsedOptions, a @state).
|
|
6404
6387
|
*/
|
|
6405
|
-
|
|
6406
|
-
this.
|
|
6388
|
+
updated(e) {
|
|
6389
|
+
this.forwardAttributesToWidget(), (e.has("type") || e.has("options")) && this.forwardOptionsToWidget();
|
|
6407
6390
|
}
|
|
6408
6391
|
/**
|
|
6409
|
-
*
|
|
6410
|
-
* This handles cases where attributes are modified via DOM manipulation
|
|
6392
|
+
* Prefetch widget config from the API to determine widget type
|
|
6411
6393
|
*/
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6394
|
+
async prefetchWidgetConfig() {
|
|
6395
|
+
var e, t;
|
|
6396
|
+
if (!this.widgetId || !Be.test(this.widgetId)) {
|
|
6397
|
+
g.warn(`poll-catch: Invalid widget-id format for prefetch: ${this.widgetId}`);
|
|
6398
|
+
return;
|
|
6399
|
+
}
|
|
6400
|
+
this.isPrefetching = !0;
|
|
6401
|
+
try {
|
|
6402
|
+
const o = await je({ type: "registered", widgetId: this.widgetId }), r = (e = o.data) == null ? void 0 : e.config, s = (t = o.data) == null ? void 0 : t.stats;
|
|
6403
|
+
if (!(r != null && r.type) || !Object.values($).includes(r.type))
|
|
6404
|
+
throw new Error(`Invalid widget type from server: ${r == null ? void 0 : r.type}`);
|
|
6405
|
+
Zo(this.widgetId, {
|
|
6406
|
+
config: { type: r.type, attributes: r.attributes || null },
|
|
6407
|
+
stats: {
|
|
6408
|
+
count: (s == null ? void 0 : s.count) ?? 0,
|
|
6409
|
+
sum: (s == null ? void 0 : s.sum) ?? 0,
|
|
6410
|
+
breakdown: (s == null ? void 0 : s.breakdown) ?? {},
|
|
6411
|
+
updatedAt: (s == null ? void 0 : s.updatedAt) || (s == null ? void 0 : s.updated_at)
|
|
6412
|
+
}
|
|
6413
|
+
}), this.type = r.type;
|
|
6414
|
+
} catch (o) {
|
|
6415
|
+
g.warn("poll-catch: Failed to prefetch widget config", o);
|
|
6416
|
+
} finally {
|
|
6417
|
+
this.isPrefetching = !1;
|
|
6418
|
+
}
|
|
6416
6419
|
}
|
|
6417
6420
|
/**
|
|
6418
6421
|
* Forward all attributes except 'type' to the child widget
|
|
@@ -6431,17 +6434,17 @@ let Y = class extends R {
|
|
|
6431
6434
|
const e = this.querySelector("pc-poll, pc-reaction");
|
|
6432
6435
|
if (!e) return;
|
|
6433
6436
|
const t = this.querySelectorAll("poll-catch-option");
|
|
6434
|
-
let r =
|
|
6437
|
+
let r = Re(this.options).map((s) => ({
|
|
6435
6438
|
value: s,
|
|
6436
6439
|
label: s,
|
|
6437
6440
|
icon: e.tagName === "PC-REACTION" ? s : void 0
|
|
6438
6441
|
// REACTION widget uses options for the icon
|
|
6439
6442
|
}));
|
|
6440
6443
|
t && t.length > 0 && (r = Array.from(t).map((s) => {
|
|
6441
|
-
const i =
|
|
6444
|
+
const i = nt(s, "value", "") || "", a = nt(s, "label", Pr(s, i)) || "", l = nt(s, "icon", void 0), n = nt(s, "tooltip", void 0), d = nt(s, "disabled", void 0), p = { value: i, label: a };
|
|
6442
6445
|
if (l !== void 0) {
|
|
6443
|
-
const
|
|
6444
|
-
p.icon =
|
|
6446
|
+
const f = kt(l);
|
|
6447
|
+
p.icon = f.icon;
|
|
6445
6448
|
}
|
|
6446
6449
|
return n !== void 0 && (p.tooltip = n), d !== void 0 && (p.disabled = !0), p;
|
|
6447
6450
|
})), this.parsedOptions = r;
|
|
@@ -6450,16 +6453,16 @@ let Y = class extends R {
|
|
|
6450
6453
|
* Render the appropriate widget based on the type
|
|
6451
6454
|
*/
|
|
6452
6455
|
render() {
|
|
6453
|
-
if (this.
|
|
6456
|
+
if (this.isPrefetching)
|
|
6454
6457
|
return u;
|
|
6455
6458
|
switch (this.type) {
|
|
6456
|
-
case
|
|
6459
|
+
case $.nps:
|
|
6457
6460
|
return c`<pc-nps></pc-nps>`;
|
|
6458
|
-
case
|
|
6461
|
+
case $.poll:
|
|
6459
6462
|
return c`<pc-poll .options=${this.parsedOptions}></pc-poll>`;
|
|
6460
|
-
case
|
|
6463
|
+
case $.stars:
|
|
6461
6464
|
return c`<pc-stars></pc-stars>`;
|
|
6462
|
-
case
|
|
6465
|
+
case $.reaction:
|
|
6463
6466
|
return c`<pc-reaction .options=${this.parsedOptions}></pc-reaction>`;
|
|
6464
6467
|
default:
|
|
6465
6468
|
return this.widgetId || console.warn(
|
|
@@ -6468,24 +6471,24 @@ let Y = class extends R {
|
|
|
6468
6471
|
}
|
|
6469
6472
|
}
|
|
6470
6473
|
};
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
],
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
],
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
],
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
],
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
],
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
],
|
|
6474
|
+
it([
|
|
6475
|
+
h({ type: String })
|
|
6476
|
+
], H.prototype, "type", 2);
|
|
6477
|
+
it([
|
|
6478
|
+
h({ type: String })
|
|
6479
|
+
], H.prototype, "options", 2);
|
|
6480
|
+
it([
|
|
6481
|
+
h({ type: String, attribute: "widget-id" })
|
|
6482
|
+
], H.prototype, "widgetId", 2);
|
|
6483
|
+
it([
|
|
6484
|
+
C()
|
|
6485
|
+
], H.prototype, "parsedOptions", 2);
|
|
6486
|
+
it([
|
|
6487
|
+
C()
|
|
6488
|
+
], H.prototype, "isPrefetching", 2);
|
|
6489
|
+
H = it([
|
|
6490
|
+
F("poll-catch")
|
|
6491
|
+
], H);
|
|
6489
6492
|
export {
|
|
6490
|
-
|
|
6493
|
+
H as PollCatch
|
|
6491
6494
|
};
|