pollcatch 2.5.3 → 2.5.5
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 +682 -743
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 xt = globalThis, Ft = xt.ShadowRoot && (xt.ShadyCSS === void 0 || xt.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Yt = Symbol(), te = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
let ke = class {
|
|
8
8
|
constructor(t, o, r) {
|
|
9
|
-
if (this._$cssResult$ = !0, r !==
|
|
9
|
+
if (this._$cssResult$ = !0, r !== Yt) 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 (Ft && 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,30 +22,30 @@ let Pe = class {
|
|
|
22
22
|
return this.cssText;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const
|
|
25
|
+
const Ke = (e) => new ke(typeof e == "string" ? e : e + "", void 0, Yt), B = (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 ke(o, e, Yt);
|
|
32
|
+
}, We = (e, t) => {
|
|
33
|
+
if (Ft) 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 = xt.litNonce;
|
|
36
36
|
s !== void 0 && r.setAttribute("nonce", s), r.textContent = o.cssText, e.appendChild(r);
|
|
37
37
|
}
|
|
38
|
-
},
|
|
38
|
+
}, ee = Ft ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((t) => {
|
|
39
39
|
let o = "";
|
|
40
40
|
for (const r of t.cssRules) o += r.cssText;
|
|
41
|
-
return
|
|
41
|
+
return Ke(o);
|
|
42
42
|
})(e) : e;
|
|
43
43
|
/**
|
|
44
44
|
* @license
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
47
|
*/
|
|
48
|
-
const { is: Ge, defineProperty: Ze, getOwnPropertyDescriptor: Xe, getOwnPropertyNames: Je, getOwnPropertySymbols: Qe, getPrototypeOf: to } = Object,
|
|
48
|
+
const { is: Ge, defineProperty: Ze, getOwnPropertyDescriptor: Xe, getOwnPropertyNames: Je, getOwnPropertySymbols: Qe, getPrototypeOf: to } = Object, j = globalThis, oe = j.trustedTypes, eo = oe ? oe.emptyScript : "", zt = j.reactiveElementPolyfillSupport, lt = (e, t) => e, $t = { toAttribute(e, t) {
|
|
49
49
|
switch (t) {
|
|
50
50
|
case Boolean:
|
|
51
51
|
e = e ? eo : null;
|
|
@@ -73,16 +73,16 @@ const { is: Ge, defineProperty: Ze, getOwnPropertyDescriptor: Xe, getOwnProperty
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
return o;
|
|
76
|
-
} },
|
|
77
|
-
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")),
|
|
78
|
-
let
|
|
76
|
+
} }, Kt = (e, t) => !Ge(e, t), re = { attribute: !0, type: String, converter: $t, reflect: !1, hasChanged: Kt };
|
|
77
|
+
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), j.litPropertyMetadata ?? (j.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
78
|
+
let et = 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
88
|
s !== void 0 && Ze(this.prototype, t, s);
|
|
@@ -102,16 +102,16 @@ let st = 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(
|
|
108
|
+
if (this.hasOwnProperty(lt("elementProperties"))) return;
|
|
109
109
|
const t = to(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(
|
|
113
|
+
if (this.hasOwnProperty(lt("finalized"))) return;
|
|
114
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(lt("properties"))) {
|
|
115
115
|
const o = this.properties, r = [...Je(o), ...Qe(o)];
|
|
116
116
|
for (const s of r) this.createProperty(s, o[s]);
|
|
117
117
|
}
|
|
@@ -131,8 +131,8 @@ let st = 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 st = class extends HTMLElement {
|
|
|
161
161
|
}
|
|
162
162
|
createRenderRoot() {
|
|
163
163
|
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
164
|
-
return
|
|
164
|
+
return We(t, this.constructor.elementStyles), t;
|
|
165
165
|
}
|
|
166
166
|
connectedCallback() {
|
|
167
167
|
var t;
|
|
@@ -186,7 +186,7 @@ let st = 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 : $t).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 st = 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 : $t;
|
|
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 ?? Kt)(this[t], o)) return;
|
|
204
204
|
this.P(t, o, r);
|
|
205
205
|
}
|
|
206
206
|
this.isUpdatePending === !1 && (this._$ES = this._$ET());
|
|
@@ -273,74 +273,74 @@ let st = class extends HTMLElement {
|
|
|
273
273
|
firstUpdated(t) {
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
|
-
|
|
276
|
+
et.elementStyles = [], et.shadowRootOptions = { mode: "open" }, et[lt("elementProperties")] = /* @__PURE__ */ new Map(), et[lt("finalized")] = /* @__PURE__ */ new Map(), zt == null || zt({ ReactiveElement: et }), (j.reactiveElementVersions ?? (j.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, St = ct.trustedTypes, se = St ? St.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, Ee = "$lit$", U = `lit$${Math.random().toFixed(9).slice(2)}$`, Ae = "?" + U, oo = `<${Ae}>`, G = document, pt = () => G.createComment(""), ut = (e) => e === null || typeof e != "object" && typeof e != "function", Wt = Array.isArray, ro = (e) => Wt(e) || typeof (e == null ? void 0 : e[Symbol.iterator]) == "function", Mt = `[
|
|
283
|
+
\f\r]`, at = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ie = /-->/g, ae = />/g, K = RegExp(`>|${Mt}(?:([^\\s"'>=/]+)(${Mt}*=${Mt}*(?:[^
|
|
284
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), ne = /'/g, le = /"/g, Pe = /^(?:script|style|textarea|title)$/i, so = (e) => (t, ...o) => ({ _$litType$: e, strings: t, values: o }), c = so(1), q = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), ce = /* @__PURE__ */ new WeakMap(), W = G.createTreeWalker(G, 129);
|
|
285
|
+
function Te(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
289
|
const io = (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 (; b < n.length && (a.lastIndex = b, p = a.exec(n), p !== null); ) b = a.lastIndex, a ===
|
|
296
|
-
const w = a ===
|
|
297
|
-
i += a ===
|
|
294
|
+
let d, p, h = -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 ? (Pe.test(p[2]) && (s = RegExp("</" + p[2], "g")), a = K) : p[3] !== void 0 && (a = K) : a === K ? p[0] === ">" ? (a = s ?? at, h = -1) : p[1] === void 0 ? h = -2 : (h = a.lastIndex - p[2].length, d = p[1], a = p[3] === void 0 ? K : p[3] === '"' ? le : ne) : a === le || a === ne ? a = K : a === ie || a === ae ? a = at : (a = K, s = void 0);
|
|
296
|
+
const w = a === K && e[l + 1].startsWith("/>") ? " " : "";
|
|
297
|
+
i += a === at ? n + oo : h >= 0 ? (r.push(d), n.slice(0, h) + Ee + n.slice(h) + U + w) : n + U + (h === -2 ? l : w);
|
|
298
298
|
}
|
|
299
|
-
return [
|
|
299
|
+
return [Te(e, i + (e[o] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
|
|
300
300
|
};
|
|
301
|
-
let
|
|
301
|
+
let Ht = class _e {
|
|
302
302
|
constructor({ strings: t, _$litType$: o }, r) {
|
|
303
303
|
let s;
|
|
304
304
|
this.parts = [];
|
|
305
305
|
let i = 0, a = 0;
|
|
306
306
|
const l = t.length - 1, n = this.parts, [d, p] = io(t, o);
|
|
307
|
-
if (this.el =
|
|
308
|
-
const
|
|
309
|
-
|
|
307
|
+
if (this.el = _e.createElement(d, r), W.currentNode = this.el.content, o === 2 || o === 3) {
|
|
308
|
+
const h = this.el.content.firstChild;
|
|
309
|
+
h.replaceWith(...h.childNodes);
|
|
310
310
|
}
|
|
311
|
-
for (; (s =
|
|
311
|
+
for (; (s = W.nextNode()) !== null && n.length < l; ) {
|
|
312
312
|
if (s.nodeType === 1) {
|
|
313
|
-
if (s.hasAttributes()) for (const
|
|
314
|
-
const b = p[a++], w = s.getAttribute(
|
|
315
|
-
n.push({ type: 1, index: i, name: E[2], strings: w, ctor: E[1] === "." ? no : E[1] === "?" ? lo : E[1] === "@" ? co :
|
|
316
|
-
} else
|
|
317
|
-
if (
|
|
318
|
-
const
|
|
313
|
+
if (s.hasAttributes()) for (const h of s.getAttributeNames()) if (h.endsWith(Ee)) {
|
|
314
|
+
const b = p[a++], w = s.getAttribute(h).split(U), E = /([.?@])?(.*)/.exec(b);
|
|
315
|
+
n.push({ type: 1, index: i, name: E[2], strings: w, ctor: E[1] === "." ? no : E[1] === "?" ? lo : E[1] === "@" ? co : At }), s.removeAttribute(h);
|
|
316
|
+
} else h.startsWith(U) && (n.push({ type: 6, index: i }), s.removeAttribute(h));
|
|
317
|
+
if (Pe.test(s.tagName)) {
|
|
318
|
+
const h = s.textContent.split(U), b = h.length - 1;
|
|
319
319
|
if (b > 0) {
|
|
320
|
-
s.textContent =
|
|
321
|
-
for (let w = 0; w < b; w++) s.append(
|
|
322
|
-
s.append(
|
|
320
|
+
s.textContent = St ? St.emptyScript : "";
|
|
321
|
+
for (let w = 0; w < b; w++) s.append(h[w], pt()), W.nextNode(), n.push({ type: 2, index: ++i });
|
|
322
|
+
s.append(h[b], pt());
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
-
} else if (s.nodeType === 8) if (s.data ===
|
|
325
|
+
} else if (s.nodeType === 8) if (s.data === Ae) n.push({ type: 2, index: i });
|
|
326
326
|
else {
|
|
327
|
-
let
|
|
328
|
-
for (; (
|
|
327
|
+
let h = -1;
|
|
328
|
+
for (; (h = s.data.indexOf(U, h + 1)) !== -1; ) n.push({ type: 7, index: i }), h += U.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 rt(e, t, o = e, r) {
|
|
339
339
|
var a, l;
|
|
340
|
-
if (t ===
|
|
340
|
+
if (t === q) 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 = rt(e, s._$AS(e, t.values), s, r)), t;
|
|
344
344
|
}
|
|
345
345
|
let ao = class {
|
|
346
346
|
constructor(t, o) {
|
|
@@ -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
|
+
W.currentNode = s;
|
|
358
|
+
let i = W.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 po(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 = W.nextNode(), a++);
|
|
365
365
|
}
|
|
366
|
-
return
|
|
366
|
+
return W.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 = rt(this, t, o), ut(t) ? t === u || t == null || t === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : t !== this._$AH && t !== q && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : ro(t) ? this.k(t) : this._(t);
|
|
394
394
|
}
|
|
395
395
|
O(t) {
|
|
396
396
|
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
@@ -399,11 +399,11 @@ 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 = Ht.createElement(Te(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
409
|
const a = new ao(s, this), l = a.u(this.options);
|
|
@@ -411,14 +411,14 @@ class vt {
|
|
|
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 Ht(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 At {
|
|
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 = rt(this, t, o, 0), a = !ut(t) || t !== this._$AH && t !== q, 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 = rt(this, l[r + n], o, n), d === q && (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 no = class extends
|
|
461
|
+
let no = class extends At {
|
|
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 lo extends
|
|
469
|
+
class lo extends At {
|
|
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 co extends
|
|
477
|
+
class co extends At {
|
|
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 = rt(this, t, o, 0) ?? u) === q) 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
|
}
|
|
@@ -496,17 +496,17 @@ class po {
|
|
|
496
496
|
return this._$AM._$AU;
|
|
497
497
|
}
|
|
498
498
|
_$AI(t) {
|
|
499
|
-
|
|
499
|
+
rt(this, t);
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
-
const
|
|
503
|
-
|
|
502
|
+
const Lt = ct.litHtmlPolyfillSupport;
|
|
503
|
+
Lt == null || Lt(Ht, ht), (ct.litHtmlVersions ?? (ct.litHtmlVersions = [])).push("3.2.1");
|
|
504
504
|
const uo = (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 D = class extends et {
|
|
519
519
|
constructor() {
|
|
520
520
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
521
521
|
}
|
|
@@ -537,20 +537,20 @@ let B = class extends st {
|
|
|
537
537
|
super.disconnectedCallback(), (t = this._$Do) == null || t.setConnected(!1);
|
|
538
538
|
}
|
|
539
539
|
render() {
|
|
540
|
-
return
|
|
540
|
+
return q;
|
|
541
541
|
}
|
|
542
542
|
};
|
|
543
|
-
var
|
|
544
|
-
|
|
543
|
+
var Ce;
|
|
544
|
+
D._$litElement$ = !0, D.finalized = !0, (Ce = globalThis.litElementHydrateSupport) == null || Ce.call(globalThis, { LitElement: D });
|
|
545
545
|
const Nt = globalThis.litElementPolyfillSupport;
|
|
546
|
-
Nt == null || Nt({ LitElement:
|
|
546
|
+
Nt == null || Nt({ LitElement: D });
|
|
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 ho = { attribute: !0, type: String, converter:
|
|
563
|
+
const ho = { attribute: !0, type: String, converter: $t, reflect: !1, hasChanged: Kt }, fo = (e = ho, 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,7 +581,7 @@ 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
|
|
584
|
+
function f(e) {
|
|
585
585
|
return (t, o) => typeof o == "object" ? fo(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;
|
|
@@ -592,8 +592,8 @@ function h(e) {
|
|
|
592
592
|
* Copyright 2017 Google LLC
|
|
593
593
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
594
594
|
*/
|
|
595
|
-
function
|
|
596
|
-
return
|
|
595
|
+
function k(e) {
|
|
596
|
+
return f({ ...e, state: !0, attribute: !1 });
|
|
597
597
|
}
|
|
598
598
|
/**
|
|
599
599
|
* @license
|
|
@@ -606,7 +606,7 @@ const go = (e, t, o) => (o.configurable = !0, o.enumerable = !0, Reflect.decorat
|
|
|
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;
|
|
@@ -617,8 +617,8 @@ function bt(e, t) {
|
|
|
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 Gt = c`
|
|
622
622
|
<svg
|
|
623
623
|
xmlns="http://www.w3.org/2000/svg"
|
|
624
624
|
height="24px"
|
|
@@ -628,7 +628,7 @@ const Jt = c`
|
|
|
628
628
|
>
|
|
629
629
|
<path d="M640-160v-280h160v280H640Zm-240 0v-640h160v640H400Zm-240 0v-440h160v440H160Z" />
|
|
630
630
|
</svg>
|
|
631
|
-
`,
|
|
631
|
+
`, Zt = c`
|
|
632
632
|
<svg
|
|
633
633
|
xmlns="http://www.w3.org/2000/svg"
|
|
634
634
|
height="24px"
|
|
@@ -640,7 +640,7 @@ const Jt = 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
|
+
`, Ct = c`
|
|
644
644
|
<svg
|
|
645
645
|
xmlns="http://www.w3.org/2000/svg"
|
|
646
646
|
height="24px"
|
|
@@ -652,7 +652,7 @@ const Jt = 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
|
+
`, Pt = c`
|
|
656
656
|
<svg
|
|
657
657
|
xmlns="http://www.w3.org/2000/svg"
|
|
658
658
|
width="16"
|
|
@@ -664,7 +664,7 @@ const Jt = 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
|
+
`, Oe = c`
|
|
668
668
|
<svg
|
|
669
669
|
xmlns="http://www.w3.org/2000/svg"
|
|
670
670
|
height="24px"
|
|
@@ -675,135 +675,135 @@ const Jt = c`
|
|
|
675
675
|
<path d="M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z" />
|
|
676
676
|
</svg>
|
|
677
677
|
`;
|
|
678
|
-
var mo = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) },
|
|
678
|
+
var mo = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, M = 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
|
+
}, A = 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
|
+
}, Ie = function(e) {
|
|
685
685
|
return (e = isFinite(e) ? e % 360 : 0) > 0 ? e : e + 360;
|
|
686
|
-
},
|
|
687
|
-
return { r:
|
|
688
|
-
},
|
|
686
|
+
}, de = function(e) {
|
|
687
|
+
return { r: A(e.r, 0, 255), g: A(e.g, 0, 255), b: A(e.b, 0, 255), a: A(e.a) };
|
|
688
|
+
}, Dt = function(e) {
|
|
689
689
|
return { r: S(e.r), g: S(e.g), b: S(e.b), a: S(e.a, 3) };
|
|
690
|
-
}, vo = /^#([0-9a-f]{3,8})$/i,
|
|
690
|
+
}, vo = /^#([0-9a-f]{3,8})$/i, bt = function(e) {
|
|
691
691
|
var t = e.toString(16);
|
|
692
692
|
return t.length < 2 ? "0" + t : t;
|
|
693
|
-
},
|
|
693
|
+
}, ze = 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
|
+
}, Me = 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
|
-
},
|
|
701
|
+
}, pe = function(e) {
|
|
702
|
+
return { h: Ie(e.h), s: A(e.s, 0, 100), l: A(e.l, 0, 100), a: A(e.a) };
|
|
703
|
+
}, ue = function(e) {
|
|
704
704
|
return { h: S(e.h), s: S(e.s), l: S(e.l), a: S(e.a, 3) };
|
|
705
|
-
},
|
|
706
|
-
return
|
|
705
|
+
}, he = function(e) {
|
|
706
|
+
return Me((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 = ze(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
|
-
}, bo = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, yo = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,
|
|
711
|
+
}, bo = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, yo = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, xo = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, wo = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, fe = { string: [[function(e) {
|
|
712
712
|
var t = vo.exec(e);
|
|
713
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 = xo.exec(e) || wo.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
718
|
var t = bo.exec(e) || yo.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) * (mo[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 M(t) && M(o) && M(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 (!M(t) || !M(o) || !M(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 (!M(t) || !M(o) || !M(r)) return null;
|
|
733
733
|
var a = function(l) {
|
|
734
|
-
return { h:
|
|
734
|
+
return { h: Ie(l.h), s: A(l.s, 0, 100), v: A(l.v, 0, 100), a: A(l.a) };
|
|
735
735
|
}({ h: Number(t), s: Number(o), v: Number(r), a: Number(i) });
|
|
736
|
-
return
|
|
737
|
-
}, "hsv"]] },
|
|
736
|
+
return Me(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
743
|
}, $o = function(e) {
|
|
744
|
-
return typeof e == "string" ?
|
|
745
|
-
},
|
|
746
|
-
var o =
|
|
747
|
-
return { h: o.h, s:
|
|
748
|
-
},
|
|
744
|
+
return typeof e == "string" ? ge(e.trim(), fe.string) : typeof e == "object" && e !== null ? ge(e, fe.object) : [null, void 0];
|
|
745
|
+
}, Rt = function(e, t) {
|
|
746
|
+
var o = dt(e);
|
|
747
|
+
return { h: o.h, s: A(o.s + 100 * t, 0, 100), l: o.l, a: o.a };
|
|
748
|
+
}, Bt = 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: A(o.l + 100 * t, 0, 100), a: o.a };
|
|
753
|
+
}, ve = function() {
|
|
754
754
|
function e(t) {
|
|
755
755
|
this.parsed = $o(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 S(
|
|
760
|
+
return S(Bt(this.rgba), 2);
|
|
761
761
|
}, e.prototype.isDark = function() {
|
|
762
|
-
return
|
|
762
|
+
return Bt(this.rgba) < 0.5;
|
|
763
763
|
}, e.prototype.isLight = function() {
|
|
764
|
-
return
|
|
764
|
+
return Bt(this.rgba) >= 0.5;
|
|
765
765
|
}, e.prototype.toHex = function() {
|
|
766
|
-
return t =
|
|
766
|
+
return t = Dt(this.rgba), o = t.r, r = t.g, s = t.b, a = (i = t.a) < 1 ? bt(S(255 * i)) : "", "#" + bt(o) + bt(r) + bt(s) + a;
|
|
767
767
|
var t, o, r, s, i, a;
|
|
768
768
|
}, e.prototype.toRgb = function() {
|
|
769
|
-
return
|
|
769
|
+
return Dt(this.rgba);
|
|
770
770
|
}, e.prototype.toRgbString = function() {
|
|
771
|
-
return t =
|
|
771
|
+
return t = Dt(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 = ze(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
782
|
return T({ 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), T(
|
|
785
|
+
return t === void 0 && (t = 0.1), T(Rt(this.rgba, t));
|
|
786
786
|
}, e.prototype.desaturate = function(t) {
|
|
787
|
-
return t === void 0 && (t = 0.1), T(
|
|
787
|
+
return t === void 0 && (t = 0.1), T(Rt(this.rgba, -t));
|
|
788
788
|
}, e.prototype.grayscale = function() {
|
|
789
|
-
return T(
|
|
789
|
+
return T(Rt(this.rgba, -1));
|
|
790
790
|
}, e.prototype.lighten = function(t) {
|
|
791
|
-
return t === void 0 && (t = 0.1), T(
|
|
791
|
+
return t === void 0 && (t = 0.1), T(me(this.rgba, t));
|
|
792
792
|
}, e.prototype.darken = function(t) {
|
|
793
|
-
return t === void 0 && (t = 0.1), T(
|
|
793
|
+
return t === void 0 && (t = 0.1), T(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
797
|
return typeof t == "number" ? T({ 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 =
|
|
800
|
+
var o = dt(this.rgba);
|
|
801
801
|
return typeof t == "number" ? T({ h: t, s: o.s, l: o.l, a: o.a }) : S(o.h);
|
|
802
802
|
}, e.prototype.isEqual = function(t) {
|
|
803
803
|
return this.toHex() === T(t).toHex();
|
|
804
804
|
}, e;
|
|
805
805
|
}(), T = function(e) {
|
|
806
|
-
return e instanceof
|
|
806
|
+
return e instanceof ve ? e : new ve(e);
|
|
807
807
|
};
|
|
808
808
|
const So = typeof process < "u" && (process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test");
|
|
809
809
|
function Vt() {
|
|
@@ -831,7 +831,7 @@ function Co(e) {
|
|
|
831
831
|
};
|
|
832
832
|
}
|
|
833
833
|
const g = Co("Pollcatch");
|
|
834
|
-
var
|
|
834
|
+
var Le = /* @__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))(Le || {});
|
|
835
835
|
const ko = {
|
|
836
836
|
black: "#000000",
|
|
837
837
|
white: "#ffffff",
|
|
@@ -853,11 +853,11 @@ function Eo(e) {
|
|
|
853
853
|
const t = e.toLowerCase().trim();
|
|
854
854
|
return ko[t] || null;
|
|
855
855
|
}
|
|
856
|
-
function
|
|
857
|
-
const o =
|
|
856
|
+
function Ut(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
|
|
860
|
+
function be(e) {
|
|
861
861
|
const t = Po(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
|
}
|
|
@@ -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 h = Ut(e, p);
|
|
879
|
+
h >= r && h > d && (d = h, n = p);
|
|
880
880
|
}
|
|
881
881
|
if (d === 0) {
|
|
882
|
-
const p =
|
|
882
|
+
const p = Ut(e, a);
|
|
883
883
|
n = a, d = p;
|
|
884
|
-
for (const
|
|
885
|
-
if (
|
|
886
|
-
const b =
|
|
887
|
-
b > d && (d = b, n =
|
|
884
|
+
for (const h of l) {
|
|
885
|
+
if (h === a) continue;
|
|
886
|
+
const b = Ut(e, h);
|
|
887
|
+
b > d && (d = b, n = h);
|
|
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.`
|
|
@@ -911,7 +911,7 @@ function O(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 jt(e, t = "1rem", o = 1) {
|
|
915
915
|
if (!e) return t;
|
|
916
916
|
const r = {
|
|
917
917
|
xs: 0.7,
|
|
@@ -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 L = /* @__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))(L || {});
|
|
954
|
+
function ot(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)) {
|
|
@@ -962,7 +962,7 @@ function it(e) {
|
|
|
962
962
|
return t;
|
|
963
963
|
}
|
|
964
964
|
function _o(e, t, o) {
|
|
965
|
-
return
|
|
965
|
+
return ot({
|
|
966
966
|
role: "button",
|
|
967
967
|
ariaLabel: e,
|
|
968
968
|
ariaPressed: t,
|
|
@@ -970,14 +970,14 @@ function _o(e, t, o) {
|
|
|
970
970
|
});
|
|
971
971
|
}
|
|
972
972
|
function Oo(e, t, o, r = !1) {
|
|
973
|
-
return
|
|
973
|
+
return ot({
|
|
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 qt(e, t, o) {
|
|
981
981
|
typeof o == "boolean" ? e.setAttribute(t, o ? "true" : "false") : e.setAttribute(t, o);
|
|
982
982
|
}
|
|
983
983
|
function Io(e) {
|
|
@@ -986,7 +986,7 @@ function Io(e) {
|
|
|
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
|
|
989
|
+
function tt(e) {
|
|
990
990
|
return Io(e) ? e.replace(/[<>"']/g, "").trim() : (g.warn("Invalid color value:", e), "#000000");
|
|
991
991
|
}
|
|
992
992
|
function zo(e) {
|
|
@@ -1001,14 +1001,14 @@ function Mo(e) {
|
|
|
1001
1001
|
(t, o, r, s, i) => s ? t : `${o}: ${r.trim()} !important${i}`
|
|
1002
1002
|
);
|
|
1003
1003
|
}
|
|
1004
|
-
const
|
|
1005
|
-
function
|
|
1004
|
+
const Lo = "https://jpxwfjorwcsrqraorpbj.supabase.co/functions/v1/data", No = "pc_session_id", Do = 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 Xt() {
|
|
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 Ne(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 De(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 xe() {
|
|
1036
|
+
const e = No, t = Do;
|
|
1037
|
+
if (Xt()) {
|
|
1038
|
+
const o = Ne(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 De(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 kt(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 Ro(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 Bo(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 Vo(e, t) {
|
|
1085
|
+
const o = t ? Bo(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 N() {
|
|
1095
1095
|
return {
|
|
1096
1096
|
count: 0,
|
|
1097
1097
|
sum: 0,
|
|
@@ -1101,26 +1101,26 @@ function R() {
|
|
|
1101
1101
|
updated: (/* @__PURE__ */ new Date()).toISOString()
|
|
1102
1102
|
};
|
|
1103
1103
|
}
|
|
1104
|
-
function
|
|
1105
|
-
if (!
|
|
1106
|
-
return
|
|
1104
|
+
function Uo(e) {
|
|
1105
|
+
if (!Xt())
|
|
1106
|
+
return N();
|
|
1107
1107
|
try {
|
|
1108
|
-
const t =
|
|
1109
|
-
return t ? { ...
|
|
1108
|
+
const t = Ne(e);
|
|
1109
|
+
return t ? { ...N(), ...t } : N();
|
|
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), N();
|
|
1112
1112
|
}
|
|
1113
1113
|
}
|
|
1114
|
-
function
|
|
1115
|
-
if (!
|
|
1114
|
+
function jo(e, t) {
|
|
1115
|
+
if (!Xt())
|
|
1116
1116
|
return !1;
|
|
1117
1117
|
try {
|
|
1118
|
-
return
|
|
1118
|
+
return De(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 qo(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 = kt((o == null ? void 0 : o.breakdown) || {}), o;
|
|
1137
1137
|
}
|
|
1138
|
-
function
|
|
1138
|
+
function Ho(e, t) {
|
|
1139
1139
|
if (!e.count && !t.count)
|
|
1140
|
-
return
|
|
1140
|
+
return N();
|
|
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 = kt((o == null ? void 0 : o.breakdown) || {}), o;
|
|
1158
1158
|
}
|
|
1159
|
-
function
|
|
1159
|
+
function Re(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 Tt(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 Be(e) {
|
|
1177
1177
|
if (!e || typeof e != "string")
|
|
1178
1178
|
return [];
|
|
1179
1179
|
const t = e.trim();
|
|
@@ -1188,53 +1188,83 @@ function qo(e) {
|
|
|
1188
1188
|
}
|
|
1189
1189
|
return t.split(",").map((o) => o.trim()).filter((o) => o !== "");
|
|
1190
1190
|
}
|
|
1191
|
-
function
|
|
1191
|
+
function Fo(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 Yo(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 Ko(e, t = 50) {
|
|
1206
1206
|
return e.length <= t ? e : e.substring(0, t).trim() + "...";
|
|
1207
1207
|
}
|
|
1208
|
-
const
|
|
1209
|
-
function
|
|
1210
|
-
|
|
1208
|
+
const Wo = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, we = 5;
|
|
1209
|
+
function Ve(e) {
|
|
1210
|
+
return e || Lo;
|
|
1211
1211
|
}
|
|
1212
|
-
function
|
|
1213
|
-
const
|
|
1214
|
-
return
|
|
1212
|
+
function Ue(e, t) {
|
|
1213
|
+
const o = Ve(t);
|
|
1214
|
+
return e.type === "registered" ? `${o}/widgets/${encodeURIComponent(e.widgetId)}` : `${o}/public-widgets/${encodeURIComponent(e.name)}`;
|
|
1215
1215
|
}
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1216
|
+
async function $e(e, t) {
|
|
1217
|
+
const o = Ue(e, t);
|
|
1218
|
+
g.debug("API GET", { url: o });
|
|
1219
|
+
const r = await fetch(o);
|
|
1220
|
+
if (!r.ok)
|
|
1221
|
+
throw new Error(`API request failed with status: ${r.status}`);
|
|
1222
|
+
const s = await r.json();
|
|
1223
|
+
if (!s.success)
|
|
1224
|
+
throw new Error("Backend returned unsuccessful response");
|
|
1225
|
+
return s;
|
|
1226
|
+
}
|
|
1227
|
+
async function Go(e, t, o) {
|
|
1228
|
+
const r = Ue(e, o);
|
|
1229
|
+
if (g.debug("API POST", { url: r }), typeof navigator < "u" && navigator.sendBeacon) {
|
|
1230
|
+
if (navigator.sendBeacon(r, t)) {
|
|
1231
|
+
g.debug("Successfully sent stats via sendBeacon");
|
|
1232
|
+
return;
|
|
1233
|
+
}
|
|
1234
|
+
g.debug("sendBeacon failed, falling back to fetch");
|
|
1235
|
+
}
|
|
1236
|
+
const s = await fetch(r, {
|
|
1237
|
+
body: t,
|
|
1238
|
+
method: "POST",
|
|
1239
|
+
keepalive: !0,
|
|
1240
|
+
headers: {
|
|
1241
|
+
"Content-Type": "application/json"
|
|
1242
|
+
}
|
|
1243
|
+
});
|
|
1244
|
+
if (!s.ok)
|
|
1245
|
+
throw new Error(`API request failed with status: ${s.status}`);
|
|
1246
|
+
g.debug("Successfully sent stats via fetch");
|
|
1247
|
+
}
|
|
1248
|
+
class Zo {
|
|
1249
|
+
// Set when a fatal error occurs (e.g. type mismatch for registered widget)
|
|
1219
1250
|
constructor(t) {
|
|
1220
|
-
this.stats =
|
|
1251
|
+
this.stats = N(), this.localStats = N(), this.prevLocalStats = N(), this.isLoading = !0, this.isLoadingConfig = !1, this.isSubmitting = !1, this.hasInteracted = !1, this.hasError = !1, (this.host = t).addController(this);
|
|
1221
1252
|
}
|
|
1222
1253
|
hostConnected() {
|
|
1223
1254
|
this.loadStats();
|
|
1224
1255
|
}
|
|
1225
1256
|
/**
|
|
1226
|
-
* Validates the widget identifier
|
|
1227
|
-
* Returns
|
|
1257
|
+
* Validates and returns the widget identifier.
|
|
1258
|
+
* Returns null (and logs the error) when validation fails.
|
|
1228
1259
|
*/
|
|
1229
|
-
|
|
1260
|
+
getWidgetIdentifier() {
|
|
1230
1261
|
const t = this.host;
|
|
1231
|
-
return t.widgetId ?
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
} : { type: "public" } : { type: "none", error: "Widget requires either widget-id or name attribute" };
|
|
1262
|
+
return t.widgetId ? Wo.test(t.widgetId) ? { type: "registered", widgetId: t.widgetId } : (g.error(`Invalid widget-id format: ${t.widgetId}`), null) : t.name ? t.name.length < we ? (g.error(
|
|
1263
|
+
`Widget name must be at least ${we} characters long. Got: "${t.name}"`
|
|
1264
|
+
), null) : { type: "public", name: t.name } : (g.error("Widget requires either widget-id or name attribute"), null);
|
|
1235
1265
|
}
|
|
1236
1266
|
async getLocalStatsKey() {
|
|
1237
|
-
const t = this.host, o = await
|
|
1267
|
+
const t = this.host, o = await xe(), r = t.widgetId || t.name || "unnamed";
|
|
1238
1268
|
return `pc-local-stats-${o}-${r}`;
|
|
1239
1269
|
}
|
|
1240
1270
|
/**
|
|
@@ -1250,100 +1280,84 @@ class Go {
|
|
|
1250
1280
|
*/
|
|
1251
1281
|
applyWidgetAttributes(t) {
|
|
1252
1282
|
if (!t) return;
|
|
1253
|
-
const r = this.host;
|
|
1254
|
-
for (const [
|
|
1255
|
-
if (
|
|
1256
|
-
|
|
1257
|
-
|
|
1283
|
+
const o = typeof t.attributes == "object" && t.attributes !== null && !Array.isArray(t.attributes) ? t.attributes : t, r = this.host, s = r;
|
|
1284
|
+
for (const [i, a] of Object.entries(o)) {
|
|
1285
|
+
if (a == null) continue;
|
|
1286
|
+
if (i === "options" && typeof a == "string") {
|
|
1287
|
+
const n = Be(a);
|
|
1288
|
+
r.options = n.map((d) => ({
|
|
1289
|
+
value: d,
|
|
1290
|
+
label: d,
|
|
1291
|
+
icon: r.type === $.reaction ? d : void 0
|
|
1292
|
+
})), g.debug("Applied widget options as property:", n);
|
|
1293
|
+
continue;
|
|
1294
|
+
}
|
|
1295
|
+
const l = i.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
1296
|
+
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
1297
|
}
|
|
1259
1298
|
}
|
|
1260
1299
|
/**
|
|
1261
1300
|
* Loads the stats for the widget.
|
|
1262
1301
|
*/
|
|
1263
1302
|
async loadServerStats() {
|
|
1264
|
-
var r, s, i;
|
|
1303
|
+
var r, s, i, a, l;
|
|
1265
1304
|
const t = this.host;
|
|
1266
1305
|
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
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1306
|
+
const o = this.getWidgetIdentifier();
|
|
1307
|
+
if (o)
|
|
1308
|
+
try {
|
|
1309
|
+
let n, d;
|
|
1310
|
+
if (o.type === "registered") {
|
|
1311
|
+
this.isLoadingConfig = !0, this.host.requestUpdate();
|
|
1312
|
+
const C = await $e(o), x = (s = (r = C.data) == null ? void 0 : r.config) == null ? void 0 : s.type;
|
|
1313
|
+
if (x && x !== t.type) {
|
|
1314
|
+
g.error(
|
|
1315
|
+
`Widget type mismatch: type="${t.type}" but server returned "${x}" for widget-id="${o.widgetId}"`
|
|
1316
|
+
), this.hasError = !0;
|
|
1317
|
+
return;
|
|
1318
|
+
}
|
|
1319
|
+
const P = ((a = (i = C.data) == null ? void 0 : i.config) == null ? void 0 : a.attributes) || null;
|
|
1320
|
+
n = ((l = C.data) == null ? void 0 : l.stats) || {}, this.applyWidgetAttributes(P);
|
|
1321
|
+
} else {
|
|
1322
|
+
let C;
|
|
1323
|
+
if (t.dataFunc && typeof window < "u") {
|
|
1324
|
+
const P = t.dataFunc.replace(/^window\./, "").split(".");
|
|
1325
|
+
let z = window;
|
|
1326
|
+
for (const It of P)
|
|
1327
|
+
if (z = z == null ? void 0 : z[It], z === void 0) break;
|
|
1328
|
+
C = z;
|
|
1329
|
+
}
|
|
1330
|
+
if (C && typeof C == "function") {
|
|
1331
|
+
d = this.getValidOptionKeys(t), g.debug(`Using data function for: ${t.widgetId || t.name}`, {
|
|
1332
|
+
dataFuncName: t.dataFunc,
|
|
1333
|
+
options: d
|
|
1334
|
+
});
|
|
1335
|
+
const x = await C(t.widgetId, t.name, d);
|
|
1336
|
+
if (x && typeof x == "object" && "success" in x && "data" in x) {
|
|
1337
|
+
if (!x.success)
|
|
1338
|
+
throw g.error("Custom data function returned unsuccessful response", x), new Error("Custom data function returned unsuccessful response");
|
|
1339
|
+
n = x.data || {};
|
|
1340
|
+
} else
|
|
1341
|
+
n = x || {};
|
|
1342
|
+
} else
|
|
1343
|
+
n = (await $e(o, t.dataEndpoint)).data || {};
|
|
1344
|
+
}
|
|
1345
|
+
d ?? (d = this.getValidOptionKeys(t));
|
|
1346
|
+
const p = Vo(n.breakdown ?? {}, d), h = p.count, b = p.sum, w = h > 0 ? Math.round(b / h * 10) / 10 : 0, E = h > 0 ? Math.round(b / h * 100) : 0;
|
|
1347
|
+
this.stats = {
|
|
1348
|
+
count: h,
|
|
1349
|
+
sum: b,
|
|
1350
|
+
avg: w,
|
|
1351
|
+
pct: E,
|
|
1352
|
+
nps: t.type === $.nps ? kt(p.breakdown) : 0,
|
|
1353
|
+
breakdown: p.breakdown,
|
|
1354
|
+
updated: n.updatedAt || n.updated_at || (/* @__PURE__ */ new Date()).toISOString()
|
|
1287
1355
|
};
|
|
1288
|
-
|
|
1289
|
-
|
|
1356
|
+
} catch (n) {
|
|
1357
|
+
throw g.error("Error loading stats:", n, this.localStats), n;
|
|
1358
|
+
} finally {
|
|
1359
|
+
this.isLoading = !1, this.isLoadingConfig = !1, this.host.requestUpdate();
|
|
1290
1360
|
}
|
|
1291
|
-
}
|
|
1292
|
-
try {
|
|
1293
|
-
const a = t.type;
|
|
1294
|
-
let l;
|
|
1295
|
-
if (t.dataFunc && typeof window < "u") {
|
|
1296
|
-
const $ = t.dataFunc.replace(/^window\./, "").split(".");
|
|
1297
|
-
let A = window;
|
|
1298
|
-
for (const Z of $)
|
|
1299
|
-
if (A = A == null ? void 0 : A[Z], A === void 0) break;
|
|
1300
|
-
l = A;
|
|
1301
|
-
}
|
|
1302
|
-
let n, d = null;
|
|
1303
|
-
if (l && typeof l == "function") {
|
|
1304
|
-
const k = this.getOptionsForDataFunc(t);
|
|
1305
|
-
g.debug(`Using data function for: ${t.widgetId || t.name}`, {
|
|
1306
|
-
dataFuncName: t.dataFunc,
|
|
1307
|
-
options: k
|
|
1308
|
-
});
|
|
1309
|
-
const $ = await l(t.widgetId, t.name, k);
|
|
1310
|
-
if ($ && typeof $ == "object" && "success" in $ && "data" in $) {
|
|
1311
|
-
if (!$.success)
|
|
1312
|
-
throw g.error("Custom data function returned unsuccessful response", $), new Error("Custom data function returned unsuccessful response");
|
|
1313
|
-
n = $.data || {};
|
|
1314
|
-
} else
|
|
1315
|
-
n = $ || {};
|
|
1316
|
-
} else {
|
|
1317
|
-
const k = t.dataEndpoint || Yt;
|
|
1318
|
-
let $;
|
|
1319
|
-
o.type === "registered" ? ($ = `${k}/widgets/${encodeURIComponent(t.widgetId)}`, this.isLoadingConfig = !0, this.host.requestUpdate()) : $ = `${k}/public-widgets/${encodeURIComponent(t.name)}`, g.debug("Fetching stats for widget", {
|
|
1320
|
-
endpoint: $,
|
|
1321
|
-
type: o.type
|
|
1322
|
-
});
|
|
1323
|
-
const A = await fetch($);
|
|
1324
|
-
if (!A.ok)
|
|
1325
|
-
throw new Error(`API request failed with status: ${A.status}`);
|
|
1326
|
-
const Z = await A.json();
|
|
1327
|
-
if (!Z.success)
|
|
1328
|
-
throw g.error("Backend returned unsuccessful response", Z), new Error("Backend returned unsuccessful response");
|
|
1329
|
-
o.type === "registered" ? (d = ((s = (r = Z.data) == null ? void 0 : r.config) == null ? void 0 : s.attributes) || null, n = ((i = Z.data) == null ? void 0 : i.stats) || {}) : n = Z.data || {};
|
|
1330
|
-
}
|
|
1331
|
-
d && !l && this.applyWidgetAttributes(d);
|
|
1332
|
-
const p = this.getOptionsForDataFunc(t), f = Ce(n.breakdown ?? {}, p), b = f.count, w = f.sum, E = b > 0 ? Math.round(w / b * 10) / 10 : 0, M = b > 0 ? Math.round(w / b * 100) : 0, L = {
|
|
1333
|
-
count: b,
|
|
1334
|
-
sum: w,
|
|
1335
|
-
avg: E,
|
|
1336
|
-
pct: M,
|
|
1337
|
-
nps: a === x.nps ? ft(f.breakdown) : 0,
|
|
1338
|
-
breakdown: f.breakdown,
|
|
1339
|
-
updated: n.updatedAt || n.updated_at || (/* @__PURE__ */ new Date()).toISOString()
|
|
1340
|
-
};
|
|
1341
|
-
this.stats = L;
|
|
1342
|
-
} catch (a) {
|
|
1343
|
-
throw g.error("Error loading stats:", a, this.localStats), a;
|
|
1344
|
-
} finally {
|
|
1345
|
-
this.isLoading = !1, this.isLoadingConfig = !1, this.host.requestUpdate();
|
|
1346
|
-
}
|
|
1347
1361
|
}
|
|
1348
1362
|
/**
|
|
1349
1363
|
* Gets the options array for the data function based on widget type.
|
|
@@ -1351,16 +1365,16 @@ class Go {
|
|
|
1351
1365
|
* - For stars: generates ['1', '2', ..., numStars]
|
|
1352
1366
|
* - For NPS: generates ['0', '1', '2', ..., '10']
|
|
1353
1367
|
*/
|
|
1354
|
-
|
|
1368
|
+
getValidOptionKeys(t) {
|
|
1355
1369
|
switch (t.type) {
|
|
1356
|
-
case
|
|
1370
|
+
case $.stars: {
|
|
1357
1371
|
const r = t.numStars || 5;
|
|
1358
1372
|
return Array.from({ length: r }, (s, i) => String(i + 1));
|
|
1359
1373
|
}
|
|
1360
|
-
case
|
|
1374
|
+
case $.nps:
|
|
1361
1375
|
return Array.from({ length: 11 }, (r, s) => String(s));
|
|
1362
|
-
case
|
|
1363
|
-
case
|
|
1376
|
+
case $.poll:
|
|
1377
|
+
case $.reaction:
|
|
1364
1378
|
default:
|
|
1365
1379
|
return t.options.map((r) => r.value);
|
|
1366
1380
|
}
|
|
@@ -1371,10 +1385,10 @@ class Go {
|
|
|
1371
1385
|
async loadLocalStats() {
|
|
1372
1386
|
const t = await this.getLocalStatsKey();
|
|
1373
1387
|
try {
|
|
1374
|
-
const o =
|
|
1388
|
+
const o = Uo(t);
|
|
1375
1389
|
g.debug("Loaded localStats from localStorage", o), this.localStats = o, o.submitted && (this.prevLocalStats = { ...o });
|
|
1376
1390
|
} catch (o) {
|
|
1377
|
-
g.warn("Failed to generate localStorage key for localStats", o), this.localStats =
|
|
1391
|
+
g.warn("Failed to generate localStorage key for localStats", o), this.localStats = N();
|
|
1378
1392
|
}
|
|
1379
1393
|
this.host.requestUpdate();
|
|
1380
1394
|
}
|
|
@@ -1384,7 +1398,7 @@ class Go {
|
|
|
1384
1398
|
async persistLocalStats() {
|
|
1385
1399
|
try {
|
|
1386
1400
|
const t = await this.getLocalStatsKey();
|
|
1387
|
-
|
|
1401
|
+
jo(t, this.localStats) || g.warn("Failed to save localStats to localStorage");
|
|
1388
1402
|
} catch (t) {
|
|
1389
1403
|
g.warn("Failed to save localStats to localStorage", t);
|
|
1390
1404
|
}
|
|
@@ -1398,7 +1412,7 @@ class Go {
|
|
|
1398
1412
|
* @param textValues
|
|
1399
1413
|
*/
|
|
1400
1414
|
updateStats(t, o) {
|
|
1401
|
-
if (this.hasInteracted = !0, this.stats && (this.stats =
|
|
1415
|
+
if (this.hasInteracted = !0, this.stats && (this.stats = qo(this.stats, this.localStats)), this.localStats = {
|
|
1402
1416
|
count: t > 0 || o.length > 0 ? 1 : 0,
|
|
1403
1417
|
sum: t,
|
|
1404
1418
|
// e.g. number of stars, nps value
|
|
@@ -1412,7 +1426,7 @@ class Go {
|
|
|
1412
1426
|
}, o && o.length > 0)
|
|
1413
1427
|
for (const r of o)
|
|
1414
1428
|
r && (this.localStats.breakdown[r] = 1);
|
|
1415
|
-
this.stats =
|
|
1429
|
+
this.stats = Ho(this.stats, this.localStats), g.debug("Stats updated - remote: ", this.stats), g.debug("Stats updated - local: ", this.stats), this.persistLocalStats(), this.host.requestUpdate();
|
|
1416
1430
|
}
|
|
1417
1431
|
async markStatsAsSubmitted() {
|
|
1418
1432
|
this.localStats.submitted = (/* @__PURE__ */ new Date()).toISOString(), this.prevLocalStats = { ...this.localStats }, await this.persistLocalStats(), this.host.requestUpdate();
|
|
@@ -1420,7 +1434,7 @@ class Go {
|
|
|
1420
1434
|
async submitStats() {
|
|
1421
1435
|
if (!this.hasLocalStats() && !this.hasInteracted)
|
|
1422
1436
|
throw g.warn("No local stats to submit"), new Error("No local stats to submit");
|
|
1423
|
-
const t = this.host, o = Math.floor(Date.now() / 1e3).toString(), r = await
|
|
1437
|
+
const t = this.host, o = Math.floor(Date.now() / 1e3).toString(), r = await xe(), s = this.localStats.sum, i = Object.keys(this.localStats.breakdown || {}), a = this.prevLocalStats.sum, l = Object.keys(this.prevLocalStats.breakdown || {});
|
|
1424
1438
|
this.isSubmitting = !0, this.host.requestUpdate();
|
|
1425
1439
|
const n = {
|
|
1426
1440
|
sessionId: r,
|
|
@@ -1434,7 +1448,7 @@ class Go {
|
|
|
1434
1448
|
prevTextValues: l,
|
|
1435
1449
|
metadata: t.metadata,
|
|
1436
1450
|
timestamp: o
|
|
1437
|
-
}, d =
|
|
1451
|
+
}, d = Yo(JSON.stringify(n), o);
|
|
1438
1452
|
try {
|
|
1439
1453
|
await this.sendStats({ ...n, hash: d }), await this.markStatsAsSubmitted(), this.dispatchSubmitEvent(n);
|
|
1440
1454
|
} catch (p) {
|
|
@@ -1445,38 +1459,18 @@ class Go {
|
|
|
1445
1459
|
return n;
|
|
1446
1460
|
}
|
|
1447
1461
|
async sendStats(t) {
|
|
1448
|
-
const o = this.host;
|
|
1449
|
-
if (
|
|
1462
|
+
const o = this.host, r = this.getWidgetIdentifier();
|
|
1463
|
+
if (!r) throw new Error("Invalid widget identifier");
|
|
1464
|
+
if (r.type !== "registered" && o.dataFunc) {
|
|
1450
1465
|
g.debug("Skip sending stats as data function is in use.");
|
|
1451
1466
|
return;
|
|
1452
1467
|
}
|
|
1453
|
-
const r =
|
|
1454
|
-
if (
|
|
1455
|
-
throw g.error(
|
|
1456
|
-
const s = o.dataEndpoint || Yt;
|
|
1457
|
-
if (!Ot(s))
|
|
1458
|
-
throw g.error("Invalid data endpoint", { dataEndpoint: s }), new Error(`Invalid data endpoint: ${s}`);
|
|
1459
|
-
let i;
|
|
1460
|
-
r.type === "registered" ? i = `${s}/widgets/${encodeURIComponent(o.widgetId)}` : i = `${s}/public-widgets/${encodeURIComponent(o.name)}`;
|
|
1468
|
+
const s = r.type === "registered" ? void 0 : o.dataEndpoint, i = Ve(s);
|
|
1469
|
+
if (!Tt(i))
|
|
1470
|
+
throw g.error("Invalid data endpoint", { dataEndpoint: i }), new Error(`Invalid data endpoint: ${i}`);
|
|
1461
1471
|
const a = JSON.stringify(t);
|
|
1462
1472
|
try {
|
|
1463
|
-
|
|
1464
|
-
if (navigator.sendBeacon(i, a)) {
|
|
1465
|
-
g.debug("Successfully sent stats via sendBeacon");
|
|
1466
|
-
return;
|
|
1467
|
-
} else
|
|
1468
|
-
g.debug("sendBeacon failed, falling back to fetch");
|
|
1469
|
-
const l = await fetch(i, {
|
|
1470
|
-
body: a,
|
|
1471
|
-
method: "POST",
|
|
1472
|
-
keepalive: !0,
|
|
1473
|
-
headers: {
|
|
1474
|
-
"Content-Type": "application/json"
|
|
1475
|
-
}
|
|
1476
|
-
});
|
|
1477
|
-
if (!l.ok)
|
|
1478
|
-
throw new Error(`API request failed with status: ${l.status}`);
|
|
1479
|
-
g.debug("Successfully sent stats via fetch");
|
|
1473
|
+
await Go(r, a, s);
|
|
1480
1474
|
} catch (l) {
|
|
1481
1475
|
throw g.error("Failed to send analytics:", l), l;
|
|
1482
1476
|
}
|
|
@@ -1493,9 +1487,9 @@ class Go {
|
|
|
1493
1487
|
sum: (o == null ? void 0 : o.sum) || 0,
|
|
1494
1488
|
avg: s,
|
|
1495
1489
|
pct: (o == null ? void 0 : o.pct) || 0,
|
|
1496
|
-
nps: r.type ===
|
|
1490
|
+
nps: r.type === $.nps ? kt((o == null ? void 0 : o.breakdown) || {}) : 0
|
|
1497
1491
|
};
|
|
1498
|
-
return g.debug("Stats data: ", this.stats),
|
|
1492
|
+
return g.debug("Stats data: ", this.stats), Fo(t, i);
|
|
1499
1493
|
}
|
|
1500
1494
|
/**
|
|
1501
1495
|
* Checks if a value is selected in the local stats
|
|
@@ -1521,7 +1515,7 @@ class Go {
|
|
|
1521
1515
|
toggleValueSelected(t, o) {
|
|
1522
1516
|
const r = Object.keys(this.localStats.breakdown || {}), s = r.includes(t), i = this.host;
|
|
1523
1517
|
let a = 1;
|
|
1524
|
-
if ((i.type ===
|
|
1518
|
+
if ((i.type === $.stars || i.type === $.nps) && (a = parseInt(t)), s)
|
|
1525
1519
|
if (o) {
|
|
1526
1520
|
const n = r.filter((d) => d !== t);
|
|
1527
1521
|
this.updateStats(n.length > 0 ? 1 : 0, n);
|
|
@@ -1582,7 +1576,7 @@ class Go {
|
|
|
1582
1576
|
return ((t = this.localStats) == null ? void 0 : t.submitted) !== void 0 && this.hasLocalStats();
|
|
1583
1577
|
}
|
|
1584
1578
|
}
|
|
1585
|
-
class
|
|
1579
|
+
class Xo {
|
|
1586
1580
|
constructor(t, o) {
|
|
1587
1581
|
this.isEditing = !0, this.isChartVisible = !1, this.isStatsVisible = !1, this.isThankYouVisible = !1, this.isReactionPopoverVisible = !1, this.initialized = !1, this.handleClickOutside = (r) => {
|
|
1588
1582
|
r.target !== this.host && (this.toggleThankYouVisibility(!1), this.toggleReactionPopoverVisibility(!1));
|
|
@@ -1670,7 +1664,7 @@ class Zo {
|
|
|
1670
1664
|
return !(this.host.readonly || !this.isEditing);
|
|
1671
1665
|
}
|
|
1672
1666
|
}
|
|
1673
|
-
var
|
|
1667
|
+
var Jt = /* @__PURE__ */ ((e) => (e.DECORATIVE = "decorative", e.FUNCTIONAL = "functional", e.STATUS = "status", e))(Jt || {});
|
|
1674
1668
|
function je(e, t = {}) {
|
|
1675
1669
|
const { type: o = "functional", alt: r, ariaLabel: s, isSelected: i } = t;
|
|
1676
1670
|
if (!e)
|
|
@@ -1680,20 +1674,20 @@ function je(e, t = {}) {
|
|
|
1680
1674
|
o === "functional" && !r && !s && console.warn(
|
|
1681
1675
|
"No alt text or aria-label provided for functional icon. This may cause accessibility issues."
|
|
1682
1676
|
);
|
|
1683
|
-
const a = i ? " (selected)" : "", l =
|
|
1677
|
+
const a = i ? " (selected)" : "", l = Tt(e) && !r ? "" : r || e, n = s || (l ? `${l}${a}` : a);
|
|
1684
1678
|
return {
|
|
1685
1679
|
alt: l,
|
|
1686
1680
|
ariaLabel: n,
|
|
1687
1681
|
ariaHidden: !1
|
|
1688
1682
|
};
|
|
1689
1683
|
}
|
|
1690
|
-
function
|
|
1684
|
+
function Jo(e, t = "polite") {
|
|
1691
1685
|
let o = document.getElementById("screen-reader-announcer");
|
|
1692
1686
|
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(() => {
|
|
1693
1687
|
o.textContent = e;
|
|
1694
1688
|
}, 50);
|
|
1695
1689
|
}
|
|
1696
|
-
function
|
|
1690
|
+
function Qo(e, t) {
|
|
1697
1691
|
return `${e}: ${t}`;
|
|
1698
1692
|
}
|
|
1699
1693
|
/**
|
|
@@ -1744,21 +1738,21 @@ const y = He(class extends Fe {
|
|
|
1744
1738
|
const a = !!t[i];
|
|
1745
1739
|
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)));
|
|
1746
1740
|
}
|
|
1747
|
-
return
|
|
1741
|
+
return q;
|
|
1748
1742
|
}
|
|
1749
1743
|
});
|
|
1750
|
-
var
|
|
1744
|
+
var tr = Object.defineProperty, v = (e, t, o, r) => {
|
|
1751
1745
|
for (var s = void 0, i = e.length - 1, a; i >= 0; i--)
|
|
1752
1746
|
(a = e[i]) && (s = a(t, o, s) || s);
|
|
1753
|
-
return s &&
|
|
1747
|
+
return s && tr(t, o, s), s;
|
|
1754
1748
|
};
|
|
1755
|
-
const
|
|
1749
|
+
const yt = {
|
|
1756
1750
|
mobile: "480px",
|
|
1757
1751
|
tablet: "768px",
|
|
1758
1752
|
desktop: "1024px"
|
|
1759
|
-
},
|
|
1753
|
+
}, Qt = class Qt extends D {
|
|
1760
1754
|
constructor() {
|
|
1761
|
-
super(...arguments), this.dataController = new
|
|
1755
|
+
super(...arguments), this.dataController = new Zo(this), this.displayController = new Xo(this, this.dataController), this.hasEditButton = !0, this.showStats = "never", this.showChart = !1, this.initialized = !1, this.ariaLabel = null, this.minContrast = Le.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) => {
|
|
1762
1756
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.handleEnterEditMode());
|
|
1763
1757
|
};
|
|
1764
1758
|
}
|
|
@@ -1790,7 +1784,7 @@ const $t = {
|
|
|
1790
1784
|
let o = `:host {
|
|
1791
1785
|
`;
|
|
1792
1786
|
if (this.primaryColor) {
|
|
1793
|
-
const i =
|
|
1787
|
+
const i = tt(this.primaryColor);
|
|
1794
1788
|
o += `--pc-primary-color: ${i} !important;
|
|
1795
1789
|
`;
|
|
1796
1790
|
const a = Ao(i, {
|
|
@@ -1801,40 +1795,40 @@ const $t = {
|
|
|
1801
1795
|
`;
|
|
1802
1796
|
}
|
|
1803
1797
|
if (this.muteColor) {
|
|
1804
|
-
const i =
|
|
1798
|
+
const i = tt(this.muteColor);
|
|
1805
1799
|
o += `--pc-mute-color: ${i} !important;
|
|
1806
1800
|
`;
|
|
1807
1801
|
}
|
|
1808
1802
|
if (this.textColor) {
|
|
1809
|
-
const i =
|
|
1803
|
+
const i = tt(this.textColor);
|
|
1810
1804
|
o += `--pc-text-color: ${i} !important;
|
|
1811
1805
|
`;
|
|
1812
1806
|
}
|
|
1813
1807
|
if (this.backgroundColor) {
|
|
1814
|
-
const i =
|
|
1808
|
+
const i = tt(this.backgroundColor);
|
|
1815
1809
|
o += `--pc-background-color: ${i} !important;
|
|
1816
1810
|
`;
|
|
1817
1811
|
}
|
|
1818
1812
|
const r = this.starColor || this.accentColor || this.primaryColor;
|
|
1819
1813
|
if (r) {
|
|
1820
|
-
const i =
|
|
1814
|
+
const i = tt(r);
|
|
1821
1815
|
o += `--pc-star-color: ${i} !important;
|
|
1822
1816
|
`;
|
|
1823
1817
|
}
|
|
1824
|
-
const s = this.starHoverColor || (r ? `color-mix(in srgb, ${
|
|
1818
|
+
const s = this.starHoverColor || (r ? `color-mix(in srgb, ${tt(r)} 80%, white)` : null);
|
|
1825
1819
|
if (s && (o += `--pc-star-hover-color: ${s} !important;
|
|
1826
1820
|
`), this.starSize) {
|
|
1827
|
-
const i =
|
|
1821
|
+
const i = jt(this.starSize, "1.5em", 1.5);
|
|
1828
1822
|
o += `--pc-stars-star-size: ${i} !important;
|
|
1829
1823
|
`;
|
|
1830
1824
|
}
|
|
1831
1825
|
if (this.reactionSize) {
|
|
1832
|
-
const i =
|
|
1826
|
+
const i = jt(this.reactionSize, "1em", 1);
|
|
1833
1827
|
o += `--pc-reaction-size: ${i} !important;
|
|
1834
1828
|
`;
|
|
1835
1829
|
}
|
|
1836
1830
|
if (this.size) {
|
|
1837
|
-
const i =
|
|
1831
|
+
const i = jt(this.size);
|
|
1838
1832
|
o += `font-size: ${i} !important;
|
|
1839
1833
|
`;
|
|
1840
1834
|
}
|
|
@@ -1850,24 +1844,24 @@ const $t = {
|
|
|
1850
1844
|
* Update ARIA attributes for accessibility
|
|
1851
1845
|
*/
|
|
1852
1846
|
updateAriaAttributes() {
|
|
1853
|
-
this.ariaLabel &&
|
|
1847
|
+
this.ariaLabel && qt(this, "aria-label", this.ariaLabel), this.ariaDescribedby && qt(this, "aria-describedby", this.ariaDescribedby), qt(this, "aria-busy", this.dataController.isLoading ? "true" : "false");
|
|
1854
1848
|
}
|
|
1855
1849
|
/**
|
|
1856
1850
|
* Update host CSS classes based on state
|
|
1857
1851
|
*/
|
|
1858
1852
|
updateHostClasses() {
|
|
1859
|
-
this.classList.toggle("is-loading", this.dataController.isLoading);
|
|
1853
|
+
this.classList.toggle("is-loading", this.dataController.isLoading), this.dataController.hasError && (this.style.display = "none");
|
|
1860
1854
|
}
|
|
1861
1855
|
/**
|
|
1862
1856
|
* Get responsive breakpoint utilities
|
|
1863
1857
|
*/
|
|
1864
1858
|
getBreakpointClasses() {
|
|
1865
1859
|
return {
|
|
1866
|
-
"pc-mobile": window.matchMedia(`(max-width: ${
|
|
1860
|
+
"pc-mobile": window.matchMedia(`(max-width: ${yt.mobile})`).matches,
|
|
1867
1861
|
"pc-tablet": window.matchMedia(
|
|
1868
|
-
`(min-width: ${
|
|
1862
|
+
`(min-width: ${yt.mobile}) and (max-width: ${yt.tablet})`
|
|
1869
1863
|
).matches,
|
|
1870
|
-
"pc-desktop": window.matchMedia(`(min-width: ${
|
|
1864
|
+
"pc-desktop": window.matchMedia(`(min-width: ${yt.desktop})`).matches
|
|
1871
1865
|
};
|
|
1872
1866
|
}
|
|
1873
1867
|
/**
|
|
@@ -1875,7 +1869,7 @@ const $t = {
|
|
|
1875
1869
|
*/
|
|
1876
1870
|
announceSelectionChange(t, o, r) {
|
|
1877
1871
|
const s = `Poll for "${t}"`, i = r ? `${o.label} selected` : `${o.label} unselected`;
|
|
1878
|
-
|
|
1872
|
+
Jo(Qo(s, i));
|
|
1879
1873
|
}
|
|
1880
1874
|
/** Common render methods */
|
|
1881
1875
|
renderLabel() {
|
|
@@ -1906,7 +1900,7 @@ const $t = {
|
|
|
1906
1900
|
tabindex="0"
|
|
1907
1901
|
aria-label="Edit vote"
|
|
1908
1902
|
@keydown="${this.handleEditToggleKeyDown}"
|
|
1909
|
-
>${
|
|
1903
|
+
>${Ct}</span
|
|
1910
1904
|
>
|
|
1911
1905
|
` : u;
|
|
1912
1906
|
}
|
|
@@ -1925,7 +1919,7 @@ const $t = {
|
|
|
1925
1919
|
tabindex="0"
|
|
1926
1920
|
aria-label="${this.displayController.isChartVisible ? "Hide chart" : "Show chart"}"
|
|
1927
1921
|
@keydown="${() => this.displayController.toggleChartVisibility()}"
|
|
1928
|
-
>${this.displayController.isChartVisible ?
|
|
1922
|
+
>${this.displayController.isChartVisible ? Zt : Gt}</span
|
|
1929
1923
|
>
|
|
1930
1924
|
` : u;
|
|
1931
1925
|
}
|
|
@@ -1952,7 +1946,7 @@ const $t = {
|
|
|
1952
1946
|
renderThankYouMessage() {
|
|
1953
1947
|
if (!this.displayController.shouldDisplayThankYouMsg())
|
|
1954
1948
|
return u;
|
|
1955
|
-
const t =
|
|
1949
|
+
const t = Ko(this.thankYouMsg || "");
|
|
1956
1950
|
return c`
|
|
1957
1951
|
<div class="pc-thank-you-overlay" data-testid="poll-thank-you-overlay">
|
|
1958
1952
|
<div class="pc-thank-you" data-testid="thank-you">
|
|
@@ -1964,7 +1958,7 @@ const $t = {
|
|
|
1964
1958
|
@click="${() => this.displayController.toggleThankYouVisibility(!1)}"
|
|
1965
1959
|
role="button"
|
|
1966
1960
|
aria-label="Close"
|
|
1967
|
-
>${
|
|
1961
|
+
>${Pt}</span
|
|
1968
1962
|
>
|
|
1969
1963
|
</div>
|
|
1970
1964
|
</div>
|
|
@@ -1972,8 +1966,8 @@ const $t = {
|
|
|
1972
1966
|
`;
|
|
1973
1967
|
}
|
|
1974
1968
|
};
|
|
1975
|
-
|
|
1976
|
-
|
|
1969
|
+
Qt.styles = [
|
|
1970
|
+
B`
|
|
1977
1971
|
:host {
|
|
1978
1972
|
/* Default values for CSS variables - can be overridden by external :root or parent definitions */
|
|
1979
1973
|
--default-font-size-base: 1rem;
|
|
@@ -2053,113 +2047,113 @@ oe.styles = [
|
|
|
2053
2047
|
}
|
|
2054
2048
|
`
|
|
2055
2049
|
];
|
|
2056
|
-
let m =
|
|
2050
|
+
let m = Qt;
|
|
2057
2051
|
v([
|
|
2058
|
-
|
|
2052
|
+
f({ type: String, attribute: "show-stats" })
|
|
2059
2053
|
], m.prototype, "showStats");
|
|
2060
2054
|
v([
|
|
2061
|
-
|
|
2055
|
+
f({ type: Boolean, attribute: "show-chart" })
|
|
2062
2056
|
], m.prototype, "showChart");
|
|
2063
2057
|
v([
|
|
2064
|
-
|
|
2058
|
+
f({ type: Boolean, attribute: "initialized" })
|
|
2065
2059
|
], m.prototype, "initialized");
|
|
2066
2060
|
v([
|
|
2067
|
-
|
|
2061
|
+
f({ type: String, attribute: "primary-color" })
|
|
2068
2062
|
], m.prototype, "primaryColor");
|
|
2069
2063
|
v([
|
|
2070
|
-
|
|
2064
|
+
f({ type: String, attribute: "mute-color" })
|
|
2071
2065
|
], m.prototype, "muteColor");
|
|
2072
2066
|
v([
|
|
2073
|
-
|
|
2067
|
+
f({ type: String, attribute: "text-color" })
|
|
2074
2068
|
], m.prototype, "textColor");
|
|
2075
2069
|
v([
|
|
2076
|
-
|
|
2070
|
+
f({ type: String, attribute: "background-color" })
|
|
2077
2071
|
], m.prototype, "backgroundColor");
|
|
2078
2072
|
v([
|
|
2079
|
-
|
|
2073
|
+
f({ type: String, attribute: "accent-color" })
|
|
2080
2074
|
], m.prototype, "accentColor");
|
|
2081
2075
|
v([
|
|
2082
|
-
|
|
2076
|
+
f({ type: String, attribute: "star-color" })
|
|
2083
2077
|
], m.prototype, "starColor");
|
|
2084
2078
|
v([
|
|
2085
|
-
|
|
2079
|
+
f({ type: String, attribute: "star-hover-color" })
|
|
2086
2080
|
], m.prototype, "starHoverColor");
|
|
2087
2081
|
v([
|
|
2088
|
-
|
|
2082
|
+
f({ type: String, attribute: "star-size" })
|
|
2089
2083
|
], m.prototype, "starSize");
|
|
2090
2084
|
v([
|
|
2091
|
-
|
|
2085
|
+
f({ type: String, attribute: "reaction-size" })
|
|
2092
2086
|
], m.prototype, "reactionSize");
|
|
2093
2087
|
v([
|
|
2094
|
-
|
|
2088
|
+
f({ type: String })
|
|
2095
2089
|
], m.prototype, "size");
|
|
2096
2090
|
v([
|
|
2097
|
-
|
|
2091
|
+
f({ type: String, attribute: "aria-label" })
|
|
2098
2092
|
], m.prototype, "ariaLabel");
|
|
2099
2093
|
v([
|
|
2100
|
-
|
|
2094
|
+
f({ type: String, attribute: "aria-describedby" })
|
|
2101
2095
|
], m.prototype, "ariaDescribedby");
|
|
2102
2096
|
v([
|
|
2103
|
-
|
|
2097
|
+
f({ type: Number, attribute: "min-contrast" })
|
|
2104
2098
|
], m.prototype, "minContrast");
|
|
2105
2099
|
v([
|
|
2106
|
-
|
|
2100
|
+
f({ type: String })
|
|
2107
2101
|
], m.prototype, "css");
|
|
2108
2102
|
v([
|
|
2109
|
-
|
|
2103
|
+
f({ type: Array })
|
|
2110
2104
|
], m.prototype, "options");
|
|
2111
2105
|
v([
|
|
2112
|
-
|
|
2106
|
+
f({ type: String, attribute: "widget-id" })
|
|
2113
2107
|
], m.prototype, "widgetId");
|
|
2114
2108
|
v([
|
|
2115
|
-
|
|
2109
|
+
f({ type: String, attribute: "name" })
|
|
2116
2110
|
], m.prototype, "name");
|
|
2117
2111
|
v([
|
|
2118
|
-
|
|
2112
|
+
f({ type: String })
|
|
2119
2113
|
], m.prototype, "metadata");
|
|
2120
2114
|
v([
|
|
2121
|
-
|
|
2115
|
+
f({ type: String, attribute: "data-func" })
|
|
2122
2116
|
], m.prototype, "dataFunc");
|
|
2123
2117
|
v([
|
|
2124
|
-
|
|
2118
|
+
f({ type: String, attribute: "data-endpoint" })
|
|
2125
2119
|
], m.prototype, "dataEndpoint");
|
|
2126
2120
|
v([
|
|
2127
|
-
|
|
2121
|
+
f({ type: String })
|
|
2128
2122
|
], m.prototype, "question");
|
|
2129
2123
|
v([
|
|
2130
|
-
|
|
2124
|
+
f({ type: String, attribute: "question-position" })
|
|
2131
2125
|
], m.prototype, "questionPosition");
|
|
2132
2126
|
v([
|
|
2133
|
-
|
|
2127
|
+
f({ type: String, attribute: "question-align" })
|
|
2134
2128
|
], m.prototype, "questionAlign");
|
|
2135
2129
|
v([
|
|
2136
|
-
|
|
2130
|
+
f({ type: String, attribute: "stats-text" })
|
|
2137
2131
|
], m.prototype, "statsText");
|
|
2138
2132
|
v([
|
|
2139
|
-
|
|
2133
|
+
f({ type: String, attribute: "stats-position" })
|
|
2140
2134
|
], m.prototype, "statsPosition");
|
|
2141
2135
|
v([
|
|
2142
|
-
|
|
2136
|
+
f({ type: String, attribute: "stats-align" })
|
|
2143
2137
|
], m.prototype, "statsAlign");
|
|
2144
2138
|
v([
|
|
2145
|
-
|
|
2139
|
+
f({ type: String, attribute: "button-text" })
|
|
2146
2140
|
], m.prototype, "buttonText");
|
|
2147
2141
|
v([
|
|
2148
|
-
|
|
2142
|
+
f({ type: String, attribute: "button-radius" })
|
|
2149
2143
|
], m.prototype, "buttonRadius");
|
|
2150
2144
|
v([
|
|
2151
|
-
|
|
2145
|
+
f({ type: String, attribute: "thank-you-msg" })
|
|
2152
2146
|
], m.prototype, "thankYouMsg");
|
|
2153
2147
|
v([
|
|
2154
|
-
|
|
2148
|
+
f({ type: Boolean, attribute: "multiple" })
|
|
2155
2149
|
], m.prototype, "multiple");
|
|
2156
2150
|
v([
|
|
2157
|
-
|
|
2151
|
+
f({ type: Boolean, reflect: !0 })
|
|
2158
2152
|
], m.prototype, "inline");
|
|
2159
2153
|
v([
|
|
2160
|
-
|
|
2154
|
+
f({ type: Boolean, reflect: !0 })
|
|
2161
2155
|
], m.prototype, "readonly");
|
|
2162
|
-
const
|
|
2156
|
+
const er = B`
|
|
2163
2157
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
2164
2158
|
|
|
2165
2159
|
.pc-body {
|
|
@@ -2610,7 +2604,7 @@ const tr = V`
|
|
|
2610
2604
|
animation: none;
|
|
2611
2605
|
}
|
|
2612
2606
|
}
|
|
2613
|
-
`,
|
|
2607
|
+
`, _t = B`
|
|
2614
2608
|
/* Default values for CSS variables - can be overridden by external :root or parent definitions */
|
|
2615
2609
|
:host {
|
|
2616
2610
|
--default-primary-color: #2196f3;
|
|
@@ -3329,7 +3323,7 @@ const tr = V`
|
|
|
3329
3323
|
opacity: 1;
|
|
3330
3324
|
}
|
|
3331
3325
|
}
|
|
3332
|
-
`,
|
|
3326
|
+
`, or = B`
|
|
3333
3327
|
:host {
|
|
3334
3328
|
--popover-bg: light-dark(#ffffff, #1a1a1a);
|
|
3335
3329
|
--popover-border: light-dark(#e0e0e0, #333333);
|
|
@@ -3451,17 +3445,17 @@ const tr = V`
|
|
|
3451
3445
|
max-width: 100%;
|
|
3452
3446
|
}
|
|
3453
3447
|
`;
|
|
3454
|
-
var
|
|
3455
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
3448
|
+
var rr = Object.defineProperty, sr = Object.getOwnPropertyDescriptor, V = (e, t, o, r) => {
|
|
3449
|
+
for (var s = r > 1 ? void 0 : r ? sr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
3456
3450
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
3457
|
-
return r && s &&
|
|
3451
|
+
return r && s && rr(t, o, s), s;
|
|
3458
3452
|
};
|
|
3459
|
-
let _ = class extends
|
|
3453
|
+
let _ = class extends D {
|
|
3460
3454
|
constructor() {
|
|
3461
3455
|
super(...arguments), this.open = !1, this.position = "auto", this.isClosing = !1, this.computedPosition = "bottom", this.popoverStyles = {}, this.arrowStyles = {}, this.updatePosition = () => {
|
|
3462
|
-
var
|
|
3456
|
+
var h;
|
|
3463
3457
|
if (!this.anchor || !this.open) return;
|
|
3464
|
-
const e = this.anchor.getBoundingClientRect(), t = window.innerWidth, o = window.innerHeight, r = 12, s = (
|
|
3458
|
+
const e = this.anchor.getBoundingClientRect(), t = window.innerWidth, o = window.innerHeight, r = 12, s = (h = this.popoverElement) == null ? void 0 : h.getBoundingClientRect(), i = (s == null ? void 0 : s.width) || 280, a = (s == null ? void 0 : s.height) || 200;
|
|
3465
3459
|
let l = this.position;
|
|
3466
3460
|
if (l === "auto") {
|
|
3467
3461
|
const b = o - e.bottom, w = e.top;
|
|
@@ -3545,35 +3539,35 @@ let _ = class extends B {
|
|
|
3545
3539
|
`;
|
|
3546
3540
|
}
|
|
3547
3541
|
};
|
|
3548
|
-
_.styles = [
|
|
3549
|
-
|
|
3550
|
-
|
|
3542
|
+
_.styles = [or];
|
|
3543
|
+
V([
|
|
3544
|
+
f({ type: Boolean, reflect: !0 })
|
|
3551
3545
|
], _.prototype, "open", 2);
|
|
3552
|
-
|
|
3553
|
-
|
|
3546
|
+
V([
|
|
3547
|
+
f({ type: String })
|
|
3554
3548
|
], _.prototype, "position", 2);
|
|
3555
|
-
|
|
3556
|
-
|
|
3549
|
+
V([
|
|
3550
|
+
f({ attribute: !1 })
|
|
3557
3551
|
], _.prototype, "anchor", 2);
|
|
3558
|
-
|
|
3559
|
-
|
|
3552
|
+
V([
|
|
3553
|
+
k()
|
|
3560
3554
|
], _.prototype, "isClosing", 2);
|
|
3561
|
-
|
|
3562
|
-
|
|
3555
|
+
V([
|
|
3556
|
+
k()
|
|
3563
3557
|
], _.prototype, "computedPosition", 2);
|
|
3564
|
-
|
|
3565
|
-
|
|
3558
|
+
V([
|
|
3559
|
+
k()
|
|
3566
3560
|
], _.prototype, "popoverStyles", 2);
|
|
3567
|
-
|
|
3568
|
-
|
|
3561
|
+
V([
|
|
3562
|
+
k()
|
|
3569
3563
|
], _.prototype, "arrowStyles", 2);
|
|
3570
|
-
|
|
3571
|
-
|
|
3564
|
+
V([
|
|
3565
|
+
ft(".pc-popover")
|
|
3572
3566
|
], _.prototype, "popoverElement", 2);
|
|
3573
|
-
_ =
|
|
3574
|
-
|
|
3567
|
+
_ = V([
|
|
3568
|
+
F("pc-popover")
|
|
3575
3569
|
], _);
|
|
3576
|
-
const
|
|
3570
|
+
const ir = B`
|
|
3577
3571
|
:host {
|
|
3578
3572
|
--sheet-bg: light-dark(#ffffff, #1a1a1a);
|
|
3579
3573
|
--sheet-border: light-dark(#e0e0e0, #333333);
|
|
@@ -3686,12 +3680,12 @@ const sr = V`
|
|
|
3686
3680
|
max-width: 100%;
|
|
3687
3681
|
}
|
|
3688
3682
|
`;
|
|
3689
|
-
var
|
|
3690
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
3683
|
+
var ar = Object.defineProperty, nr = Object.getOwnPropertyDescriptor, Q = (e, t, o, r) => {
|
|
3684
|
+
for (var s = r > 1 ? void 0 : r ? nr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
3691
3685
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
3692
|
-
return r && s &&
|
|
3686
|
+
return r && s && ar(t, o, s), s;
|
|
3693
3687
|
};
|
|
3694
|
-
let
|
|
3688
|
+
let R = class extends D {
|
|
3695
3689
|
constructor() {
|
|
3696
3690
|
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) => {
|
|
3697
3691
|
if (e.key === "Escape" && this.open && (e.preventDefault(), e.stopPropagation(), this.close()), e.key === "Tab" && this.open && this.sheetElement) {
|
|
@@ -3785,35 +3779,35 @@ let U = class extends B {
|
|
|
3785
3779
|
`;
|
|
3786
3780
|
}
|
|
3787
3781
|
};
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
],
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
],
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
],
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
],
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
],
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
],
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
],
|
|
3810
|
-
var
|
|
3811
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
3782
|
+
R.styles = [ir];
|
|
3783
|
+
Q([
|
|
3784
|
+
f({ type: Boolean, reflect: !0 })
|
|
3785
|
+
], R.prototype, "open", 2);
|
|
3786
|
+
Q([
|
|
3787
|
+
f({ type: Boolean, attribute: "drag-to-close" })
|
|
3788
|
+
], R.prototype, "dragToClose", 2);
|
|
3789
|
+
Q([
|
|
3790
|
+
k()
|
|
3791
|
+
], R.prototype, "isClosing", 2);
|
|
3792
|
+
Q([
|
|
3793
|
+
k()
|
|
3794
|
+
], R.prototype, "isDragging", 2);
|
|
3795
|
+
Q([
|
|
3796
|
+
k()
|
|
3797
|
+
], R.prototype, "dragOffset", 2);
|
|
3798
|
+
Q([
|
|
3799
|
+
ft(".pc-bottom-sheet")
|
|
3800
|
+
], R.prototype, "sheetElement", 2);
|
|
3801
|
+
R = Q([
|
|
3802
|
+
F("pc-bottom-sheet")
|
|
3803
|
+
], R);
|
|
3804
|
+
var lr = Object.defineProperty, cr = Object.getOwnPropertyDescriptor, gt = (e, t, o, r) => {
|
|
3805
|
+
for (var s = r > 1 ? void 0 : r ? cr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
3812
3806
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
3813
|
-
return r && s &&
|
|
3807
|
+
return r && s && lr(t, o, s), s;
|
|
3814
3808
|
};
|
|
3815
|
-
const
|
|
3816
|
-
let
|
|
3809
|
+
const dr = 768;
|
|
3810
|
+
let Z = class extends D {
|
|
3817
3811
|
constructor() {
|
|
3818
3812
|
super(...arguments), this.open = !1, this.position = "auto", this.isMobile = !1, this.handleMediaChange = (e) => {
|
|
3819
3813
|
this.isMobile = e.matches;
|
|
@@ -3829,7 +3823,7 @@ let tt = class extends B {
|
|
|
3829
3823
|
super.disconnectedCallback(), (e = this.mediaQuery) == null || e.removeEventListener("change", this.handleMediaChange);
|
|
3830
3824
|
}
|
|
3831
3825
|
setupMediaQuery() {
|
|
3832
|
-
this.mediaQuery = window.matchMedia(`(max-width: ${
|
|
3826
|
+
this.mediaQuery = window.matchMedia(`(max-width: ${dr - 1}px)`), this.isMobile = this.mediaQuery.matches, this.mediaQuery.addEventListener("change", this.handleMediaChange);
|
|
3833
3827
|
}
|
|
3834
3828
|
render() {
|
|
3835
3829
|
return this.isMobile ? c`
|
|
@@ -3848,34 +3842,34 @@ let tt = class extends B {
|
|
|
3848
3842
|
`;
|
|
3849
3843
|
}
|
|
3850
3844
|
};
|
|
3851
|
-
|
|
3845
|
+
Z.styles = B`
|
|
3852
3846
|
:host {
|
|
3853
3847
|
display: contents;
|
|
3854
3848
|
}
|
|
3855
3849
|
`;
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
],
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
],
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
],
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
],
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
],
|
|
3871
|
-
var
|
|
3872
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
3850
|
+
gt([
|
|
3851
|
+
f({ type: Boolean, reflect: !0 })
|
|
3852
|
+
], Z.prototype, "open", 2);
|
|
3853
|
+
gt([
|
|
3854
|
+
f({ type: String })
|
|
3855
|
+
], Z.prototype, "position", 2);
|
|
3856
|
+
gt([
|
|
3857
|
+
f({ attribute: !1 })
|
|
3858
|
+
], Z.prototype, "anchor", 2);
|
|
3859
|
+
gt([
|
|
3860
|
+
k()
|
|
3861
|
+
], Z.prototype, "isMobile", 2);
|
|
3862
|
+
Z = gt([
|
|
3863
|
+
F("pc-responsive-modal")
|
|
3864
|
+
], Z);
|
|
3865
|
+
var pr = Object.defineProperty, ur = Object.getOwnPropertyDescriptor, Y = (e, t, o, r) => {
|
|
3866
|
+
for (var s = r > 1 ? void 0 : r ? ur(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
3873
3867
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
3874
|
-
return r && s &&
|
|
3868
|
+
return r && s && pr(t, o, s), s;
|
|
3875
3869
|
};
|
|
3876
3870
|
let I = class extends m {
|
|
3877
3871
|
constructor() {
|
|
3878
|
-
super(), this.min = 0, this.max = 10, this.type =
|
|
3872
|
+
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 = () => {
|
|
3879
3873
|
this.hoverValue = -1;
|
|
3880
3874
|
}, this.handleKeyDown = (e) => {
|
|
3881
3875
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.hoverValue >= 0 && this.handleNumberClick(this.hoverValue));
|
|
@@ -3885,8 +3879,8 @@ let I = class extends m {
|
|
|
3885
3879
|
* Render NPS buttons for edit mode
|
|
3886
3880
|
*/
|
|
3887
3881
|
renderNpsButtons() {
|
|
3888
|
-
const e = Array.from({ length: this.max - this.min + 1 }, (s, i) => i + this.min), t = `nps-control-${this.name || this.type}`, o =
|
|
3889
|
-
role:
|
|
3882
|
+
const e = Array.from({ length: this.max - this.min + 1 }, (s, i) => i + this.min), t = `nps-control-${this.name || this.type}`, o = ot({
|
|
3883
|
+
role: L.GROUP,
|
|
3890
3884
|
ariaLabel: this.question || "NPS Rating",
|
|
3891
3885
|
ariaDescribedby: `${t}-description`
|
|
3892
3886
|
}), r = e.map((s) => {
|
|
@@ -3937,10 +3931,10 @@ let I = class extends m {
|
|
|
3937
3931
|
* NPS score displayed prominently in the middle
|
|
3938
3932
|
*/
|
|
3939
3933
|
renderChart() {
|
|
3940
|
-
const e = this.dataController.stats, t = (e == null ? void 0 : e.nps) ?? 0, o = 100, r = 100, s = 80, i = (
|
|
3941
|
-
x: o + s * Math.cos(
|
|
3942
|
-
y: r - s * Math.sin(
|
|
3943
|
-
}), a = i(Math.PI), l = i(Math.PI / 2), n = i(Math.PI / 4), d = i(0), p = (
|
|
3934
|
+
const e = this.dataController.stats, t = (e == null ? void 0 : e.nps) ?? 0, o = 100, r = 100, s = 80, i = (P) => ({
|
|
3935
|
+
x: o + s * Math.cos(P),
|
|
3936
|
+
y: r - s * Math.sin(P)
|
|
3937
|
+
}), a = i(Math.PI), l = i(Math.PI / 2), n = i(Math.PI / 4), d = i(0), p = (P, z, It = 0) => `M ${P.x} ${P.y} A ${s} ${s} 0 ${It} 1 ${z.x} ${z.y}`, h = p(a, l), b = p(l, n), w = p(n, d), C = ((P) => Math.PI - (P + 100) / 200 * Math.PI)(t), x = i(C);
|
|
3944
3938
|
return c`
|
|
3945
3939
|
<div class="nps-semicircle-gauge" data-testid="nps-semicircle-gauge">
|
|
3946
3940
|
<svg viewBox="0 0 200 115">
|
|
@@ -3951,12 +3945,12 @@ let I = class extends m {
|
|
|
3951
3945
|
/>
|
|
3952
3946
|
|
|
3953
3947
|
<!-- Colored segments -->
|
|
3954
|
-
<path class="gauge-arc gauge-arc-detractor" d="${
|
|
3948
|
+
<path class="gauge-arc gauge-arc-detractor" d="${h}" />
|
|
3955
3949
|
<path class="gauge-arc gauge-arc-passive" d="${b}" />
|
|
3956
3950
|
<path class="gauge-arc gauge-arc-promoter" d="${w}" />
|
|
3957
3951
|
|
|
3958
3952
|
<!-- Needle indicator -->
|
|
3959
|
-
<circle class="gauge-needle" cx="${
|
|
3953
|
+
<circle class="gauge-needle" cx="${x.x}" cy="${x.y}" r="5" />
|
|
3960
3954
|
|
|
3961
3955
|
<!-- Score display in center -->
|
|
3962
3956
|
<text class="gauge-score" x="${o}" y="${r - 15}">${t}</text>
|
|
@@ -4016,7 +4010,7 @@ let I = class extends m {
|
|
|
4016
4010
|
* Uses SVG with 3 colored segments for detractors/passives/promoters
|
|
4017
4011
|
*/
|
|
4018
4012
|
renderInlineGauge() {
|
|
4019
|
-
const e = this.dataController.stats, t = (e == null ? void 0 : e.breakdown) || {}, o = 8, r = 2 * Math.PI * o, s =
|
|
4013
|
+
const e = this.dataController.stats, t = (e == null ? void 0 : e.breakdown) || {}, o = 8, r = 2 * Math.PI * o, s = Ro(t), i = s.detractors + s.passives + s.promoters;
|
|
4020
4014
|
if (i === 0)
|
|
4021
4015
|
return c`
|
|
4022
4016
|
<div class="inline-nps-gauge">
|
|
@@ -4025,9 +4019,9 @@ let I = class extends m {
|
|
|
4025
4019
|
</svg>
|
|
4026
4020
|
</div>
|
|
4027
4021
|
`;
|
|
4028
|
-
const a = s.detractors / i * 100, l = s.passives / i * 100, n = s.promoters / i * 100, d = a / 100 * r, p = l / 100 * r,
|
|
4029
|
-
let
|
|
4030
|
-
return
|
|
4022
|
+
const a = s.detractors / i * 100, l = s.passives / i * 100, n = s.promoters / i * 100, d = a / 100 * r, p = l / 100 * r, h = n / 100 * r, b = 0, w = -d, E = -(d + p), C = this.getUserScore();
|
|
4023
|
+
let x = "gauge-bg";
|
|
4024
|
+
return C !== null && (C <= 6 ? x = "gauge-detractor" : C <= 8 ? x = "gauge-passive" : x = "gauge-promoter"), c`
|
|
4031
4025
|
<div class="inline-nps-gauge">
|
|
4032
4026
|
<svg viewBox="0 0 20 20">
|
|
4033
4027
|
<!-- Background circle -->
|
|
@@ -4056,11 +4050,11 @@ let I = class extends m {
|
|
|
4056
4050
|
cx="10"
|
|
4057
4051
|
cy="10"
|
|
4058
4052
|
r="${o}"
|
|
4059
|
-
stroke-dasharray="${
|
|
4053
|
+
stroke-dasharray="${h} ${r}"
|
|
4060
4054
|
stroke-dashoffset="${E}"
|
|
4061
4055
|
/>
|
|
4062
4056
|
<!-- Center dot showing user's score category -->
|
|
4063
|
-
<circle class="gauge-dot ${
|
|
4057
|
+
<circle class="gauge-dot ${x}" cx="10" cy="10" r="2" />
|
|
4064
4058
|
</svg>
|
|
4065
4059
|
</div>
|
|
4066
4060
|
`;
|
|
@@ -4071,7 +4065,7 @@ let I = class extends m {
|
|
|
4071
4065
|
* Shows add icon when no selection, edit icon when user has submitted
|
|
4072
4066
|
*/
|
|
4073
4067
|
renderInlineTrigger() {
|
|
4074
|
-
const t = this.displayController.shouldShowStats() && this.statsText ? this.dataController.formatStatsText(this.statsText) : "", r = this.dataController.hasLocalStats() ?
|
|
4068
|
+
const t = this.displayController.shouldShowStats() && this.statsText ? this.dataController.formatStatsText(this.statsText) : "", r = this.dataController.hasLocalStats() ? Ct : Oe;
|
|
4075
4069
|
return c`
|
|
4076
4070
|
<button
|
|
4077
4071
|
class="pc-inline-trigger"
|
|
@@ -4137,7 +4131,7 @@ let I = class extends m {
|
|
|
4137
4131
|
@keydown="${(e) => {
|
|
4138
4132
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.displayController.toggleChartVisibility());
|
|
4139
4133
|
}}"
|
|
4140
|
-
>${this.displayController.isChartVisible ?
|
|
4134
|
+
>${this.displayController.isChartVisible ? Zt : Gt}</span
|
|
4141
4135
|
>
|
|
4142
4136
|
`;
|
|
4143
4137
|
}
|
|
@@ -4156,7 +4150,7 @@ let I = class extends m {
|
|
|
4156
4150
|
aria-label="Close"
|
|
4157
4151
|
data-testid="popover-close-button"
|
|
4158
4152
|
>
|
|
4159
|
-
${
|
|
4153
|
+
${Pt}
|
|
4160
4154
|
</button>
|
|
4161
4155
|
${this.question ? c`<div class="pc-popover-question">${this.question}</div>` : u}
|
|
4162
4156
|
${this.renderPopoverNpsButtons()}
|
|
@@ -4229,32 +4223,32 @@ let I = class extends m {
|
|
|
4229
4223
|
return this.inline ? this.renderInlineMode() : this.readonly ? this.renderReadonlyMode() : this.renderStandardMode();
|
|
4230
4224
|
}
|
|
4231
4225
|
};
|
|
4232
|
-
I.styles = [...m.styles,
|
|
4233
|
-
|
|
4234
|
-
|
|
4226
|
+
I.styles = [...m.styles, _t, er];
|
|
4227
|
+
Y([
|
|
4228
|
+
f({ type: String, attribute: "min-label" })
|
|
4235
4229
|
], I.prototype, "minLabel", 2);
|
|
4236
|
-
|
|
4237
|
-
|
|
4230
|
+
Y([
|
|
4231
|
+
f({ type: String, attribute: "max-label" })
|
|
4238
4232
|
], I.prototype, "maxLabel", 2);
|
|
4239
|
-
|
|
4240
|
-
|
|
4233
|
+
Y([
|
|
4234
|
+
f({ type: String, attribute: "thank-you-msg" })
|
|
4241
4235
|
], I.prototype, "thankYouMsg", 2);
|
|
4242
|
-
|
|
4243
|
-
|
|
4236
|
+
Y([
|
|
4237
|
+
f({ type: String, attribute: "min-max-position" })
|
|
4244
4238
|
], I.prototype, "minMaxPosition", 2);
|
|
4245
|
-
|
|
4246
|
-
|
|
4239
|
+
Y([
|
|
4240
|
+
k()
|
|
4247
4241
|
], I.prototype, "hoverValue", 2);
|
|
4248
|
-
|
|
4249
|
-
|
|
4242
|
+
Y([
|
|
4243
|
+
k()
|
|
4250
4244
|
], I.prototype, "popoverOpen", 2);
|
|
4251
|
-
|
|
4252
|
-
|
|
4245
|
+
Y([
|
|
4246
|
+
ft(".pc-inline-trigger")
|
|
4253
4247
|
], I.prototype, "triggerElement", 2);
|
|
4254
|
-
I =
|
|
4255
|
-
|
|
4248
|
+
I = Y([
|
|
4249
|
+
F("pc-nps")
|
|
4256
4250
|
], I);
|
|
4257
|
-
const
|
|
4251
|
+
const hr = B`
|
|
4258
4252
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
4259
4253
|
|
|
4260
4254
|
.pc-container {
|
|
@@ -4639,14 +4633,14 @@ const ur = V`
|
|
|
4639
4633
|
opacity: 0.8;
|
|
4640
4634
|
}
|
|
4641
4635
|
`;
|
|
4642
|
-
var
|
|
4643
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
4636
|
+
var fr = Object.defineProperty, gr = Object.getOwnPropertyDescriptor, mt = (e, t, o, r) => {
|
|
4637
|
+
for (var s = r > 1 ? void 0 : r ? gr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
4644
4638
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
4645
|
-
return r && s &&
|
|
4639
|
+
return r && s && fr(t, o, s), s;
|
|
4646
4640
|
};
|
|
4647
|
-
let
|
|
4641
|
+
let X = class extends m {
|
|
4648
4642
|
constructor() {
|
|
4649
|
-
super(), this.type =
|
|
4643
|
+
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";
|
|
4650
4644
|
}
|
|
4651
4645
|
renderStatus() {
|
|
4652
4646
|
const t = {
|
|
@@ -4702,16 +4696,16 @@ let et = class extends m {
|
|
|
4702
4696
|
*/
|
|
4703
4697
|
renderOptionIcon(e) {
|
|
4704
4698
|
if (!(e != null && e.icon)) return "";
|
|
4705
|
-
const t =
|
|
4699
|
+
const t = Jt.DECORATIVE, o = (e == null ? void 0 : e.label) || "", r = e ? this.dataController.isValueSelected(e.value) : !1, s = je(e == null ? void 0 : e.icon, {
|
|
4706
4700
|
type: t,
|
|
4707
4701
|
alt: o,
|
|
4708
4702
|
isSelected: r
|
|
4709
4703
|
});
|
|
4710
|
-
return
|
|
4704
|
+
return Re(e == null ? void 0 : e.icon) ? c`<span
|
|
4711
4705
|
class="poll-option-icon"
|
|
4712
4706
|
aria-hidden="${s.ariaHidden ? "true" : "false"}"
|
|
4713
4707
|
>${e == null ? void 0 : e.icon}</span
|
|
4714
|
-
>` :
|
|
4708
|
+
>` : Tt(e == null ? void 0 : e.icon) ? c`<img
|
|
4715
4709
|
src="${e == null ? void 0 : e.icon}"
|
|
4716
4710
|
alt="${s.alt}"
|
|
4717
4711
|
class="poll-option-icon-img"
|
|
@@ -4727,7 +4721,7 @@ let et = class extends m {
|
|
|
4727
4721
|
* Renders the selection indicator (checkbox or radio button) with proper ARIA roles
|
|
4728
4722
|
*/
|
|
4729
4723
|
renderSelectionIndicator() {
|
|
4730
|
-
const e = this.multiple ?
|
|
4724
|
+
const e = this.multiple ? L.CHECKBOX : L.RADIO;
|
|
4731
4725
|
return this.multiple ? c`<span class="poll-checkbox" role="${e}"></span>` : c`<span class="poll-radio" role="${e}"></span>`;
|
|
4732
4726
|
}
|
|
4733
4727
|
/**
|
|
@@ -4773,7 +4767,7 @@ let et = class extends m {
|
|
|
4773
4767
|
*/
|
|
4774
4768
|
renderPollOptions() {
|
|
4775
4769
|
var s;
|
|
4776
|
-
const e = this.multiple ?
|
|
4770
|
+
const e = this.multiple ? L.GROUP : L.RADIOGROUP, t = this.question || this.name || "Options", o = ot({
|
|
4777
4771
|
role: e,
|
|
4778
4772
|
ariaLabel: t
|
|
4779
4773
|
});
|
|
@@ -4795,16 +4789,16 @@ let et = class extends m {
|
|
|
4795
4789
|
*/
|
|
4796
4790
|
renderBarChart() {
|
|
4797
4791
|
var n, d;
|
|
4798
|
-
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,
|
|
4792
|
+
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, h) => p + h, 0), r = this.options.map((p, h) => {
|
|
4799
4793
|
const b = e[p.value] || 0, w = o > 0 ? Math.round(b / o * 100) : 0, E = (t[p.value] || 0) > 0;
|
|
4800
4794
|
return {
|
|
4801
4795
|
option: p,
|
|
4802
|
-
index:
|
|
4796
|
+
index: h,
|
|
4803
4797
|
voteCount: b,
|
|
4804
4798
|
percentage: w,
|
|
4805
4799
|
isSelected: E
|
|
4806
4800
|
};
|
|
4807
|
-
}), s = this.multiple ?
|
|
4801
|
+
}), s = this.multiple ? L.GROUP : L.RADIOGROUP, i = this.question || this.name || "Options", a = ot({
|
|
4808
4802
|
role: s,
|
|
4809
4803
|
ariaLabel: i
|
|
4810
4804
|
});
|
|
@@ -4818,7 +4812,7 @@ let et = class extends m {
|
|
|
4818
4812
|
...=${a}
|
|
4819
4813
|
>
|
|
4820
4814
|
${r.map((p) => {
|
|
4821
|
-
const
|
|
4815
|
+
const h = {
|
|
4822
4816
|
"poll-option": !0,
|
|
4823
4817
|
"poll-option--compact": this.compact,
|
|
4824
4818
|
"poll-option--chart-view": !0,
|
|
@@ -4826,7 +4820,7 @@ let et = class extends m {
|
|
|
4826
4820
|
};
|
|
4827
4821
|
return c`
|
|
4828
4822
|
<div
|
|
4829
|
-
class="${y(
|
|
4823
|
+
class="${y(h)}"
|
|
4830
4824
|
data-testid="poll-chart-item-${p.index}"
|
|
4831
4825
|
role="listitem"
|
|
4832
4826
|
aria-label="${p.option.label}: ${p.percentage}% (${p.voteCount} votes)"
|
|
@@ -4897,7 +4891,7 @@ let et = class extends m {
|
|
|
4897
4891
|
* Shows add icon when no selection, edit icon when user has submitted
|
|
4898
4892
|
*/
|
|
4899
4893
|
renderInlineTrigger() {
|
|
4900
|
-
const t = this.displayController.shouldShowStats() && this.statsText ? this.dataController.formatStatsText(this.statsText) : "", r = this.dataController.hasLocalStats() ?
|
|
4894
|
+
const t = this.displayController.shouldShowStats() && this.statsText ? this.dataController.formatStatsText(this.statsText) : "", r = this.dataController.hasLocalStats() ? Ct : Oe;
|
|
4901
4895
|
return c`
|
|
4902
4896
|
<button
|
|
4903
4897
|
class="pc-inline-trigger"
|
|
@@ -4956,7 +4950,7 @@ let et = class extends m {
|
|
|
4956
4950
|
aria-label="Close"
|
|
4957
4951
|
data-testid="popover-close-button"
|
|
4958
4952
|
>
|
|
4959
|
-
${
|
|
4953
|
+
${Pt}
|
|
4960
4954
|
</button>
|
|
4961
4955
|
${this.question ? c`<div class="pc-popover-question">${this.question}</div>` : u}
|
|
4962
4956
|
${e ? this.renderBarChart() : this.renderPollOptions()}
|
|
@@ -4973,7 +4967,7 @@ let et = class extends m {
|
|
|
4973
4967
|
@keydown=${(s) => {
|
|
4974
4968
|
(s.key === "Enter" || s.key === " ") && (s.preventDefault(), this.handlePopoverEditClick());
|
|
4975
4969
|
}}
|
|
4976
|
-
>${
|
|
4970
|
+
>${Ct}</span
|
|
4977
4971
|
>` : u}
|
|
4978
4972
|
</div>` : u}
|
|
4979
4973
|
</div>
|
|
@@ -5037,8 +5031,8 @@ let et = class extends m {
|
|
|
5037
5031
|
"pc-body": !0,
|
|
5038
5032
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
5039
5033
|
[`pc-flex-align-${o}`]: !0
|
|
5040
|
-
}, s =
|
|
5041
|
-
role:
|
|
5034
|
+
}, s = ot({
|
|
5035
|
+
role: L.REGION,
|
|
5042
5036
|
ariaLabel: this.question || this.name || "Poll"
|
|
5043
5037
|
});
|
|
5044
5038
|
return c`
|
|
@@ -5059,23 +5053,23 @@ let et = class extends m {
|
|
|
5059
5053
|
return this.inline ? this.renderInlineMode() : this.readonly ? this.renderReadonlyMode() : this.renderStandardMode();
|
|
5060
5054
|
}
|
|
5061
5055
|
};
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
],
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
],
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
],
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
],
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
],
|
|
5078
|
-
const
|
|
5056
|
+
X.styles = [...m.styles, _t, hr];
|
|
5057
|
+
mt([
|
|
5058
|
+
f({ type: Boolean })
|
|
5059
|
+
], X.prototype, "multiple", 2);
|
|
5060
|
+
mt([
|
|
5061
|
+
f({ type: Boolean })
|
|
5062
|
+
], X.prototype, "compact", 2);
|
|
5063
|
+
mt([
|
|
5064
|
+
k()
|
|
5065
|
+
], X.prototype, "popoverOpen", 2);
|
|
5066
|
+
mt([
|
|
5067
|
+
ft(".pc-inline-trigger")
|
|
5068
|
+
], X.prototype, "triggerElement", 2);
|
|
5069
|
+
X = mt([
|
|
5070
|
+
F("pc-poll")
|
|
5071
|
+
], X);
|
|
5072
|
+
const mr = B`
|
|
5079
5073
|
/* CSS variables inherit from parent - defaults are specified at usage sites */
|
|
5080
5074
|
|
|
5081
5075
|
.pc-section {
|
|
@@ -5262,7 +5256,7 @@ const gr = V`
|
|
|
5262
5256
|
* Copyright 2018 Google LLC
|
|
5263
5257
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5264
5258
|
*/
|
|
5265
|
-
const Ye = "important",
|
|
5259
|
+
const Ye = "important", vr = " !" + Ye, br = He(class extends Fe {
|
|
5266
5260
|
constructor(e) {
|
|
5267
5261
|
var t;
|
|
5268
5262
|
if (super(e), e.type !== qe.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.");
|
|
@@ -5281,14 +5275,14 @@ const Ye = "important", mr = " !" + Ye, vr = He(class extends Fe {
|
|
|
5281
5275
|
const s = t[r];
|
|
5282
5276
|
if (s != null) {
|
|
5283
5277
|
this.ft.add(r);
|
|
5284
|
-
const i = typeof s == "string" && s.endsWith(
|
|
5278
|
+
const i = typeof s == "string" && s.endsWith(vr);
|
|
5285
5279
|
r.includes("-") || i ? o.setProperty(r, i ? s.slice(0, -11) : s, i ? Ye : "") : o[r] = s;
|
|
5286
5280
|
}
|
|
5287
5281
|
}
|
|
5288
|
-
return
|
|
5282
|
+
return q;
|
|
5289
5283
|
}
|
|
5290
5284
|
});
|
|
5291
|
-
function
|
|
5285
|
+
function wt(e, t = {}) {
|
|
5292
5286
|
if (!e || e.length === 0)
|
|
5293
5287
|
return c`<div class="pc-bar-chart pc-bar-chart--empty">No data available</div>`;
|
|
5294
5288
|
const o = Math.max(...e.map((i) => i.value)), s = { ...{
|
|
@@ -5317,7 +5311,7 @@ function Ct(e, t = {}) {
|
|
|
5317
5311
|
</div>
|
|
5318
5312
|
`;
|
|
5319
5313
|
}
|
|
5320
|
-
const
|
|
5314
|
+
const Se = {
|
|
5321
5315
|
// Faces
|
|
5322
5316
|
smile: "😊",
|
|
5323
5317
|
laugh: "😄",
|
|
@@ -5460,21 +5454,21 @@ const Ee = {
|
|
|
5460
5454
|
hiking: "🥾",
|
|
5461
5455
|
yoga: "🧘"
|
|
5462
5456
|
};
|
|
5463
|
-
function
|
|
5457
|
+
function Et(e) {
|
|
5464
5458
|
let t = "❓", o = !1;
|
|
5465
|
-
return e ? e in
|
|
5459
|
+
return e ? e in Se ? t = Se[e] : Re(e) ? t = e : Tt(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 = "❓", {
|
|
5466
5460
|
icon: t,
|
|
5467
5461
|
isRemoteImage: o
|
|
5468
5462
|
};
|
|
5469
5463
|
}
|
|
5470
|
-
var
|
|
5471
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
5464
|
+
var yr = Object.defineProperty, xr = Object.getOwnPropertyDescriptor, it = (e, t, o, r) => {
|
|
5465
|
+
for (var s = r > 1 ? void 0 : r ? xr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
5472
5466
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
5473
|
-
return r && s &&
|
|
5467
|
+
return r && s && yr(t, o, s), s;
|
|
5474
5468
|
};
|
|
5475
|
-
let
|
|
5469
|
+
let H = class extends m {
|
|
5476
5470
|
constructor() {
|
|
5477
|
-
super(), this.type =
|
|
5471
|
+
super(), this.type = $.stars, this.icon = "★", this.numStars = 5, this.hoverValue = -1, this.popoverOpen = !1, this.handleStarKeyDown = (e) => {
|
|
5478
5472
|
if (e.key === "Enter" || e.key === " ") {
|
|
5479
5473
|
e.preventDefault();
|
|
5480
5474
|
const t = e.target, o = parseInt(t.dataset.star || "0");
|
|
@@ -5495,14 +5489,14 @@ let Y = class extends m {
|
|
|
5495
5489
|
* Renders the star icon using resolveIcon for emoji, URL, or MDI support
|
|
5496
5490
|
*/
|
|
5497
5491
|
renderStarIcon() {
|
|
5498
|
-
const { icon: e, isRemoteImage: t } =
|
|
5492
|
+
const { icon: e, isRemoteImage: t } = Et(this.icon);
|
|
5499
5493
|
return t ? c`<img class="star-icon-img" src="${e}" alt="star" />` : e;
|
|
5500
5494
|
}
|
|
5501
5495
|
/**
|
|
5502
5496
|
* Gets the resolved icon string (for use in chart labels)
|
|
5503
5497
|
*/
|
|
5504
5498
|
getResolvedIconString() {
|
|
5505
|
-
const { icon: e, isRemoteImage: t } =
|
|
5499
|
+
const { icon: e, isRemoteImage: t } = Et(this.icon);
|
|
5506
5500
|
return t ? "★" : e;
|
|
5507
5501
|
}
|
|
5508
5502
|
/**
|
|
@@ -5513,22 +5507,22 @@ let Y = class extends m {
|
|
|
5513
5507
|
renderStars(e = !1) {
|
|
5514
5508
|
var n;
|
|
5515
5509
|
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) => {
|
|
5516
|
-
const p = e ? t || 0 : Math.floor(i),
|
|
5510
|
+
const p = e ? t || 0 : Math.floor(i), h = d <= p || d <= (this.hoverValue || 0), b = !e && !h && d === Math.ceil(i) && i % 1 !== 0, w = {
|
|
5517
5511
|
star: !0,
|
|
5518
|
-
selected:
|
|
5512
|
+
selected: h,
|
|
5519
5513
|
partial: b,
|
|
5520
5514
|
"view-mode": !a
|
|
5521
|
-
}, E = b ? { "--partial-fill": `${i % 1 * 100}%` } : {},
|
|
5515
|
+
}, E = b ? { "--partial-fill": `${i % 1 * 100}%` } : {}, C = e ? () => this.handlePopoverStarClick(d) : () => this.handleStarClick(d);
|
|
5522
5516
|
return c`
|
|
5523
5517
|
<div class="pc-section" data-testid="pc-section">
|
|
5524
5518
|
<span
|
|
5525
5519
|
data-testid="${e ? "popover" : "stars-view"}-star-${d}"
|
|
5526
5520
|
class=${y(w)}
|
|
5527
|
-
style=${
|
|
5521
|
+
style=${br(E)}
|
|
5528
5522
|
role="${a ? "button" : "presentation"}"
|
|
5529
5523
|
tabindex="${a ? "0" : ""}"
|
|
5530
5524
|
aria-label="${a ? `Rate ${d} star${d > 1 ? "s" : ""}` : ""}"
|
|
5531
|
-
@click="${
|
|
5525
|
+
@click="${C}"
|
|
5532
5526
|
@mouseenter="${() => this.handleStarHover(d)}"
|
|
5533
5527
|
@focus="${() => this.handleStarHover(d)}"
|
|
5534
5528
|
@mouseleave="${this.handleStarLeave}"
|
|
@@ -5552,7 +5546,7 @@ let Y = class extends m {
|
|
|
5552
5546
|
label: n,
|
|
5553
5547
|
value: d,
|
|
5554
5548
|
icon: r
|
|
5555
|
-
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l =
|
|
5549
|
+
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l = wt(s, {
|
|
5556
5550
|
barColor: a,
|
|
5557
5551
|
labelFormatter: (n) => `${n.label} ${n.icon}`,
|
|
5558
5552
|
valueFormatter: (n) => `${o > 0 ? Math.round(n.value / o * 100) : 0}%`
|
|
@@ -5652,7 +5646,7 @@ let Y = class extends m {
|
|
|
5652
5646
|
aria-label="Close"
|
|
5653
5647
|
data-testid="popover-close-button"
|
|
5654
5648
|
>
|
|
5655
|
-
${
|
|
5649
|
+
${Pt}
|
|
5656
5650
|
</button>
|
|
5657
5651
|
${this.question ? c`<div class="pc-popover-question">${this.question}</div>` : u}
|
|
5658
5652
|
${this.renderStars(!0)}
|
|
@@ -5675,7 +5669,7 @@ let Y = class extends m {
|
|
|
5675
5669
|
label: n,
|
|
5676
5670
|
value: d,
|
|
5677
5671
|
icon: r
|
|
5678
|
-
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l =
|
|
5672
|
+
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l = wt(s, {
|
|
5679
5673
|
barColor: a,
|
|
5680
5674
|
labelFormatter: (n) => `${n.label} ${n.icon}`,
|
|
5681
5675
|
valueFormatter: (n) => `${o > 0 ? Math.round(n.value / o * 100) : 0}%`
|
|
@@ -5701,7 +5695,7 @@ let Y = class extends m {
|
|
|
5701
5695
|
@keydown="${(e) => {
|
|
5702
5696
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.displayController.toggleChartVisibility());
|
|
5703
5697
|
}}"
|
|
5704
|
-
>${this.displayController.isChartVisible ?
|
|
5698
|
+
>${this.displayController.isChartVisible ? Zt : Gt}</span
|
|
5705
5699
|
>
|
|
5706
5700
|
`;
|
|
5707
5701
|
}
|
|
@@ -5744,7 +5738,7 @@ let Y = class extends m {
|
|
|
5744
5738
|
label: n,
|
|
5745
5739
|
value: d,
|
|
5746
5740
|
icon: r
|
|
5747
|
-
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l =
|
|
5741
|
+
})), a = getComputedStyle(this).getPropertyValue("--pc-accent-color").trim() || "#ffc107", l = wt(s, {
|
|
5748
5742
|
barColor: a,
|
|
5749
5743
|
labelFormatter: (n) => `${n.label} ${n.icon}`,
|
|
5750
5744
|
valueFormatter: (n) => `${o > 0 ? Math.round(n.value / o * 100) : 0}%`
|
|
@@ -5782,26 +5776,26 @@ let Y = class extends m {
|
|
|
5782
5776
|
return this.inline ? this.renderInlineMode() : this.readonly ? this.renderReadonlyMode() : this.renderStandardMode();
|
|
5783
5777
|
}
|
|
5784
5778
|
};
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
],
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
],
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
],
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
],
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
],
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
],
|
|
5804
|
-
const wr =
|
|
5779
|
+
H.styles = [...m.styles, _t, mr];
|
|
5780
|
+
it([
|
|
5781
|
+
f({ type: String })
|
|
5782
|
+
], H.prototype, "icon", 2);
|
|
5783
|
+
it([
|
|
5784
|
+
f({ type: Number, attribute: "num-stars" })
|
|
5785
|
+
], H.prototype, "numStars", 2);
|
|
5786
|
+
it([
|
|
5787
|
+
k()
|
|
5788
|
+
], H.prototype, "hoverValue", 2);
|
|
5789
|
+
it([
|
|
5790
|
+
k()
|
|
5791
|
+
], H.prototype, "popoverOpen", 2);
|
|
5792
|
+
it([
|
|
5793
|
+
ft(".pc-inline-trigger")
|
|
5794
|
+
], H.prototype, "triggerElement", 2);
|
|
5795
|
+
H = it([
|
|
5796
|
+
F("pc-stars")
|
|
5797
|
+
], H);
|
|
5798
|
+
const wr = B`
|
|
5805
5799
|
/* Adjust stats text for reactions */
|
|
5806
5800
|
.pc-stats-text {
|
|
5807
5801
|
font-size: var(--pc-font-size-small, var(--default-font-size-small));
|
|
@@ -6064,15 +6058,15 @@ const wr = V`
|
|
|
6064
6058
|
animation: none;
|
|
6065
6059
|
}
|
|
6066
6060
|
}
|
|
6067
|
-
`,
|
|
6068
|
-
var
|
|
6069
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
6061
|
+
`, $r = "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";
|
|
6062
|
+
var Sr = Object.defineProperty, Cr = Object.getOwnPropertyDescriptor, Ot = (e, t, o, r) => {
|
|
6063
|
+
for (var s = r > 1 ? void 0 : r ? Cr(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
6070
6064
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
6071
|
-
return r && s &&
|
|
6065
|
+
return r && s && Sr(t, o, s), s;
|
|
6072
6066
|
};
|
|
6073
|
-
let
|
|
6067
|
+
let st = class extends m {
|
|
6074
6068
|
constructor() {
|
|
6075
|
-
super(), this.type =
|
|
6069
|
+
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";
|
|
6076
6070
|
}
|
|
6077
6071
|
/**
|
|
6078
6072
|
* Get the display count for a specific reaction including local optimistic updates
|
|
@@ -6094,7 +6088,7 @@ let nt = class extends m {
|
|
|
6094
6088
|
* Renders the icon for a reaction
|
|
6095
6089
|
*/
|
|
6096
6090
|
renderReactionIcon(e, t) {
|
|
6097
|
-
const { icon: o, isRemoteImage: r } =
|
|
6091
|
+
const { icon: o, isRemoteImage: r } = Et(e), s = Jt.FUNCTIONAL, i = t.tooltip || `${t.value} reaction`, a = je(o, {
|
|
6098
6092
|
type: s,
|
|
6099
6093
|
alt: i,
|
|
6100
6094
|
ariaLabel: i,
|
|
@@ -6148,7 +6142,7 @@ let nt = class extends m {
|
|
|
6148
6142
|
aria-expanded="${this.displayController.shouldShowReactionPopover()}"
|
|
6149
6143
|
aria-haspopup="true"
|
|
6150
6144
|
>
|
|
6151
|
-
<img src="${
|
|
6145
|
+
<img src="${$r}" alt="" class="trigger-icon" />
|
|
6152
6146
|
</button>
|
|
6153
6147
|
`;
|
|
6154
6148
|
}
|
|
@@ -6238,7 +6232,7 @@ let nt = class extends m {
|
|
|
6238
6232
|
const e = this.dataController.getBreakdownInfo(), o = Object.entries(e.breakdownCount).filter(
|
|
6239
6233
|
([n, d]) => this.options.some((p) => p.value === n)
|
|
6240
6234
|
).map(([n, d]) => {
|
|
6241
|
-
const p = this.options.find((
|
|
6235
|
+
const p = this.options.find((h) => h.value === n);
|
|
6242
6236
|
return {
|
|
6243
6237
|
label: n,
|
|
6244
6238
|
// Use the reaction value as label
|
|
@@ -6246,7 +6240,7 @@ let nt = class extends m {
|
|
|
6246
6240
|
icon: (p == null ? void 0 : p.icon) || n
|
|
6247
6241
|
// Use the icon or fall back to reaction value
|
|
6248
6242
|
};
|
|
6249
|
-
}), r = getComputedStyle(this), s = r.getPropertyValue("--pc-primary-color").trim(), a = r.getPropertyValue("--pc-accent-color").trim() || s || "#ffc107", l =
|
|
6243
|
+
}), r = getComputedStyle(this), s = r.getPropertyValue("--pc-primary-color").trim(), a = r.getPropertyValue("--pc-accent-color").trim() || s || "#ffc107", l = wt(o, {
|
|
6250
6244
|
barColor: a,
|
|
6251
6245
|
labelFormatter: (n) => `${n.label}`,
|
|
6252
6246
|
valueFormatter: (n) => `${e.totalCount > 0 ? Math.round(n.value / e.totalCount * 100) : 0}%`
|
|
@@ -6310,36 +6304,35 @@ let nt = class extends m {
|
|
|
6310
6304
|
return this.readonly ? this.renderReadonlyMode() : this.renderStandardMode();
|
|
6311
6305
|
}
|
|
6312
6306
|
};
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
],
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
],
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
],
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
],
|
|
6326
|
-
function
|
|
6307
|
+
st.styles = [...m.styles, _t, wr];
|
|
6308
|
+
Ot([
|
|
6309
|
+
f({ type: Boolean, attribute: "show-counts" })
|
|
6310
|
+
], st.prototype, "showCounts", 2);
|
|
6311
|
+
Ot([
|
|
6312
|
+
f({ type: Boolean, reflect: !0 })
|
|
6313
|
+
], st.prototype, "compact", 2);
|
|
6314
|
+
Ot([
|
|
6315
|
+
f({ type: String, attribute: "popup-position" })
|
|
6316
|
+
], st.prototype, "popupPosition", 2);
|
|
6317
|
+
st = Ot([
|
|
6318
|
+
F("pc-reaction")
|
|
6319
|
+
], st);
|
|
6320
|
+
function nt(e, t, o = void 0) {
|
|
6327
6321
|
const r = e.getAttribute(t);
|
|
6328
6322
|
return r === null ? o : r == null ? void 0 : r.trim();
|
|
6329
6323
|
}
|
|
6330
|
-
function
|
|
6324
|
+
function kr(e, t = void 0) {
|
|
6331
6325
|
const o = e.textContent;
|
|
6332
6326
|
return o === "" || o === null ? t : o == null ? void 0 : o.trim();
|
|
6333
6327
|
}
|
|
6334
|
-
var
|
|
6335
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
6328
|
+
var Er = Object.defineProperty, Ar = Object.getOwnPropertyDescriptor, vt = (e, t, o, r) => {
|
|
6329
|
+
for (var s = r > 1 ? void 0 : r ? Ar(t, o) : t, i = e.length - 1, a; i >= 0; i--)
|
|
6336
6330
|
(a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
|
6337
|
-
return r && s &&
|
|
6331
|
+
return r && s && Er(t, o, s), s;
|
|
6338
6332
|
};
|
|
6339
|
-
|
|
6340
|
-
let z = class extends B {
|
|
6333
|
+
let J = class extends D {
|
|
6341
6334
|
constructor() {
|
|
6342
|
-
super(), this.options = "", this.parsedOptions = [],
|
|
6335
|
+
super(), this.options = "", this.parsedOptions = [], J.injectGlobalStyle();
|
|
6343
6336
|
}
|
|
6344
6337
|
/**
|
|
6345
6338
|
* Inject global style to hide poll-catch-option elements
|
|
@@ -6363,64 +6356,21 @@ let z = class extends B {
|
|
|
6363
6356
|
createRenderRoot() {
|
|
6364
6357
|
return this;
|
|
6365
6358
|
}
|
|
6366
|
-
connectedCallback() {
|
|
6367
|
-
super.connectedCallback(), this.widgetId && !this.type && !this.dataFunc && this.prefetchWidgetConfig();
|
|
6368
|
-
}
|
|
6369
6359
|
forceUpdate() {
|
|
6370
6360
|
this.forwardAttributesToWidget(), this.forwardOptionsToWidget();
|
|
6371
6361
|
}
|
|
6372
6362
|
/**
|
|
6373
|
-
*
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
*
|
|
6380
|
-
*
|
|
6381
|
-
*/
|
|
6382
|
-
attributeChangedCallback(e, t, o) {
|
|
6383
|
-
super.attributeChangedCallback(e, t, o), this.updateComplete.then(() => {
|
|
6384
|
-
this.forwardAttributesToWidget();
|
|
6385
|
-
});
|
|
6386
|
-
}
|
|
6387
|
-
/**
|
|
6388
|
-
* Prefetch widget config from the API to determine widget type
|
|
6363
|
+
* Runs synchronously after every render cycle.
|
|
6364
|
+
* Always forwards attributes so the child widget has them (especially widget-id)
|
|
6365
|
+
* BEFORE DataController's async loadStats() fires. This is critical because
|
|
6366
|
+
* loadStats() starts in hostConnected() and yields at its first await — if
|
|
6367
|
+
* attributes aren't set by then, validation fails.
|
|
6368
|
+
*
|
|
6369
|
+
* Options are only forwarded when type or options change to avoid an infinite
|
|
6370
|
+
* loop (forwardOptionsToWidget sets parsedOptions, a @state).
|
|
6389
6371
|
*/
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
if (!this.widgetId || !Ar.test(this.widgetId)) {
|
|
6393
|
-
g.warn(`poll-catch: Invalid widget-id format for prefetch: ${this.widgetId}`);
|
|
6394
|
-
return;
|
|
6395
|
-
}
|
|
6396
|
-
this.isPrefetching = !0;
|
|
6397
|
-
try {
|
|
6398
|
-
const r = `${this.dataEndpoint || Yt}/widgets/${encodeURIComponent(this.widgetId)}`;
|
|
6399
|
-
g.debug("poll-catch: Prefetching widget config", { url: r });
|
|
6400
|
-
const s = await fetch(r);
|
|
6401
|
-
if (!s.ok)
|
|
6402
|
-
throw new Error(`API request failed with status: ${s.status}`);
|
|
6403
|
-
const i = await s.json();
|
|
6404
|
-
if (!i.success)
|
|
6405
|
-
throw new Error("Backend returned unsuccessful response");
|
|
6406
|
-
const a = (e = i.data) == null ? void 0 : e.config, l = (t = i.data) == null ? void 0 : t.stats;
|
|
6407
|
-
if (!(a != null && a.type) || !Object.values(x).includes(a.type))
|
|
6408
|
-
throw new Error(`Invalid widget type from server: ${a == null ? void 0 : a.type}`);
|
|
6409
|
-
Wo(this.widgetId, {
|
|
6410
|
-
config: { type: a.type, attributes: a.attributes || null },
|
|
6411
|
-
stats: {
|
|
6412
|
-
count: (l == null ? void 0 : l.count) ?? 0,
|
|
6413
|
-
sum: (l == null ? void 0 : l.sum) ?? 0,
|
|
6414
|
-
breakdown: (l == null ? void 0 : l.breakdown) ?? {},
|
|
6415
|
-
updatedAt: (l == null ? void 0 : l.updatedAt) || (l == null ? void 0 : l.updated_at)
|
|
6416
|
-
}
|
|
6417
|
-
}), this.type = a.type;
|
|
6418
|
-
} catch (o) {
|
|
6419
|
-
g.warn("poll-catch: Failed to prefetch widget config", o);
|
|
6420
|
-
} finally {
|
|
6421
|
-
this.isPrefetching = !1;
|
|
6422
|
-
}
|
|
6423
|
-
this.requestUpdate(), await this.updateComplete, this.forwardAttributesToWidget(), this.forwardOptionsToWidget();
|
|
6372
|
+
updated(e) {
|
|
6373
|
+
this.forwardAttributesToWidget(), (e.has("type") || e.has("options")) && this.forwardOptionsToWidget();
|
|
6424
6374
|
}
|
|
6425
6375
|
/**
|
|
6426
6376
|
* Forward all attributes except 'type' to the child widget
|
|
@@ -6439,17 +6389,17 @@ let z = class extends B {
|
|
|
6439
6389
|
const e = this.querySelector("pc-poll, pc-reaction");
|
|
6440
6390
|
if (!e) return;
|
|
6441
6391
|
const t = this.querySelectorAll("poll-catch-option");
|
|
6442
|
-
let r =
|
|
6392
|
+
let r = Be(this.options).map((s) => ({
|
|
6443
6393
|
value: s,
|
|
6444
6394
|
label: s,
|
|
6445
6395
|
icon: e.tagName === "PC-REACTION" ? s : void 0
|
|
6446
6396
|
// REACTION widget uses options for the icon
|
|
6447
6397
|
}));
|
|
6448
6398
|
t && t.length > 0 && (r = Array.from(t).map((s) => {
|
|
6449
|
-
const i =
|
|
6399
|
+
const i = nt(s, "value", "") || "", a = nt(s, "label", kr(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 };
|
|
6450
6400
|
if (l !== void 0) {
|
|
6451
|
-
const
|
|
6452
|
-
p.icon =
|
|
6401
|
+
const h = Et(l);
|
|
6402
|
+
p.icon = h.icon;
|
|
6453
6403
|
}
|
|
6454
6404
|
return n !== void 0 && (p.tooltip = n), d !== void 0 && (p.disabled = !0), p;
|
|
6455
6405
|
})), this.parsedOptions = r;
|
|
@@ -6458,48 +6408,37 @@ let z = class extends B {
|
|
|
6458
6408
|
* Render the appropriate widget based on the type
|
|
6459
6409
|
*/
|
|
6460
6410
|
render() {
|
|
6461
|
-
if (this.isPrefetching)
|
|
6462
|
-
return u;
|
|
6463
6411
|
switch (this.type) {
|
|
6464
|
-
case
|
|
6412
|
+
case $.nps:
|
|
6465
6413
|
return c`<pc-nps></pc-nps>`;
|
|
6466
|
-
case
|
|
6414
|
+
case $.poll:
|
|
6467
6415
|
return c`<pc-poll .options=${this.parsedOptions}></pc-poll>`;
|
|
6468
|
-
case
|
|
6416
|
+
case $.stars:
|
|
6469
6417
|
return c`<pc-stars></pc-stars>`;
|
|
6470
|
-
case
|
|
6418
|
+
case $.reaction:
|
|
6471
6419
|
return c`<pc-reaction .options=${this.parsedOptions}></pc-reaction>`;
|
|
6472
6420
|
default:
|
|
6473
|
-
return
|
|
6421
|
+
return console.warn(
|
|
6474
6422
|
`poll-catch: Unknown widget type "${this.type}". Supported types: nps, poll, stars, reaction.`
|
|
6475
6423
|
), u;
|
|
6476
6424
|
}
|
|
6477
6425
|
}
|
|
6478
6426
|
};
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
],
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
],
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
],
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
],
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
],
|
|
6494
|
-
G([
|
|
6495
|
-
C()
|
|
6496
|
-
], z.prototype, "parsedOptions", 2);
|
|
6497
|
-
G([
|
|
6498
|
-
C()
|
|
6499
|
-
], z.prototype, "isPrefetching", 2);
|
|
6500
|
-
z = G([
|
|
6501
|
-
W("poll-catch")
|
|
6502
|
-
], z);
|
|
6427
|
+
vt([
|
|
6428
|
+
f({ type: String })
|
|
6429
|
+
], J.prototype, "type", 2);
|
|
6430
|
+
vt([
|
|
6431
|
+
f({ type: String })
|
|
6432
|
+
], J.prototype, "options", 2);
|
|
6433
|
+
vt([
|
|
6434
|
+
f({ type: String, attribute: "widget-id" })
|
|
6435
|
+
], J.prototype, "widgetId", 2);
|
|
6436
|
+
vt([
|
|
6437
|
+
k()
|
|
6438
|
+
], J.prototype, "parsedOptions", 2);
|
|
6439
|
+
J = vt([
|
|
6440
|
+
F("poll-catch")
|
|
6441
|
+
], J);
|
|
6503
6442
|
export {
|
|
6504
|
-
|
|
6443
|
+
J as PollCatch
|
|
6505
6444
|
};
|