@record-evolution/widget-gauge 1.5.21

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.
@@ -0,0 +1,1280 @@
1
+ /* @license Copyright (c) 2023 Record Evolution GmbH. All rights reserved.*/
2
+ /******************************************************************************
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
+ PERFORMANCE OF THIS SOFTWARE.
15
+ ***************************************************************************** */
16
+ /* global Reflect, Promise, SuppressedError, Symbol */
17
+
18
+ function __decorate(decorators, target, key, desc) {
19
+ var c = arguments.length,
20
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
21
+ d;
22
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
23
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
24
+ }
25
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
26
+ var e = new Error(message);
27
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
28
+ };
29
+
30
+ /**
31
+ * @license
32
+ * Copyright 2019 Google LLC
33
+ * SPDX-License-Identifier: BSD-3-Clause
34
+ */
35
+ const t$3 = globalThis,
36
+ e$3 = t$3.ShadowRoot && (void 0 === t$3.ShadyCSS || t$3.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype,
37
+ s$3 = Symbol(),
38
+ o$3 = new WeakMap();
39
+ let n$3 = class n {
40
+ constructor(t, e, o) {
41
+ if (this._$cssResult$ = !0, o !== s$3) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
42
+ this.cssText = t, this.t = e;
43
+ }
44
+ get styleSheet() {
45
+ let t = this.o;
46
+ const s = this.t;
47
+ if (e$3 && void 0 === t) {
48
+ const e = void 0 !== s && 1 === s.length;
49
+ e && (t = o$3.get(s)), void 0 === t && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), e && o$3.set(s, t));
50
+ }
51
+ return t;
52
+ }
53
+ toString() {
54
+ return this.cssText;
55
+ }
56
+ };
57
+ const r$6 = t => new n$3("string" == typeof t ? t : t + "", void 0, s$3),
58
+ i$3 = (t, ...e) => {
59
+ const o = 1 === t.length ? t[0] : e.reduce((e, s, o) => e + (t => {
60
+ if (!0 === t._$cssResult$) return t.cssText;
61
+ if ("number" == typeof t) return t;
62
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + t + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
63
+ })(s) + t[o + 1], t[0]);
64
+ return new n$3(o, t, s$3);
65
+ },
66
+ S$1 = (s, o) => {
67
+ if (e$3) s.adoptedStyleSheets = o.map(t => t instanceof CSSStyleSheet ? t : t.styleSheet);else for (const e of o) {
68
+ const o = document.createElement("style"),
69
+ n = t$3.litNonce;
70
+ void 0 !== n && o.setAttribute("nonce", n), o.textContent = e.cssText, s.appendChild(o);
71
+ }
72
+ },
73
+ c$3 = e$3 ? t => t : t => t instanceof CSSStyleSheet ? (t => {
74
+ let e = "";
75
+ for (const s of t.cssRules) e += s.cssText;
76
+ return r$6(e);
77
+ })(t) : t;
78
+
79
+ /**
80
+ * @license
81
+ * Copyright 2017 Google LLC
82
+ * SPDX-License-Identifier: BSD-3-Clause
83
+ */
84
+ const {
85
+ is: i$2,
86
+ defineProperty: e$2,
87
+ getOwnPropertyDescriptor: r$5,
88
+ getOwnPropertyNames: h$2,
89
+ getOwnPropertySymbols: o$2,
90
+ getPrototypeOf: n$2
91
+ } = Object,
92
+ a$1 = globalThis,
93
+ c$2 = a$1.trustedTypes,
94
+ l$1 = c$2 ? c$2.emptyScript : "",
95
+ p$2 = a$1.reactiveElementPolyfillSupport,
96
+ d$1 = (t, s) => t,
97
+ u$3 = {
98
+ toAttribute(t, s) {
99
+ switch (s) {
100
+ case Boolean:
101
+ t = t ? l$1 : null;
102
+ break;
103
+ case Object:
104
+ case Array:
105
+ t = null == t ? t : JSON.stringify(t);
106
+ }
107
+ return t;
108
+ },
109
+ fromAttribute(t, s) {
110
+ let i = t;
111
+ switch (s) {
112
+ case Boolean:
113
+ i = null !== t;
114
+ break;
115
+ case Number:
116
+ i = null === t ? null : Number(t);
117
+ break;
118
+ case Object:
119
+ case Array:
120
+ try {
121
+ i = JSON.parse(t);
122
+ } catch (t) {
123
+ i = null;
124
+ }
125
+ }
126
+ return i;
127
+ }
128
+ },
129
+ f$1 = (t, s) => !i$2(t, s),
130
+ y$1 = {
131
+ attribute: !0,
132
+ type: String,
133
+ converter: u$3,
134
+ reflect: !1,
135
+ hasChanged: f$1
136
+ };
137
+ Symbol.metadata ??= Symbol("metadata"), a$1.litPropertyMetadata ??= new WeakMap();
138
+ class b extends HTMLElement {
139
+ static addInitializer(t) {
140
+ this._$Ei(), (this.l ??= []).push(t);
141
+ }
142
+ static get observedAttributes() {
143
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
144
+ }
145
+ static createProperty(t, s = y$1) {
146
+ if (s.state && (s.attribute = !1), this._$Ei(), this.elementProperties.set(t, s), !s.noAccessor) {
147
+ const i = Symbol(),
148
+ r = this.getPropertyDescriptor(t, i, s);
149
+ void 0 !== r && e$2(this.prototype, t, r);
150
+ }
151
+ }
152
+ static getPropertyDescriptor(t, s, i) {
153
+ const {
154
+ get: e,
155
+ set: h
156
+ } = r$5(this.prototype, t) ?? {
157
+ get() {
158
+ return this[s];
159
+ },
160
+ set(t) {
161
+ this[s] = t;
162
+ }
163
+ };
164
+ return {
165
+ get() {
166
+ return e?.call(this);
167
+ },
168
+ set(s) {
169
+ const r = e?.call(this);
170
+ h.call(this, s), this.requestUpdate(t, r, i);
171
+ },
172
+ configurable: !0,
173
+ enumerable: !0
174
+ };
175
+ }
176
+ static getPropertyOptions(t) {
177
+ return this.elementProperties.get(t) ?? y$1;
178
+ }
179
+ static _$Ei() {
180
+ if (this.hasOwnProperty(d$1("elementProperties"))) return;
181
+ const t = n$2(this);
182
+ t.finalize(), void 0 !== t.l && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
183
+ }
184
+ static finalize() {
185
+ if (this.hasOwnProperty(d$1("finalized"))) return;
186
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(d$1("properties"))) {
187
+ const t = this.properties,
188
+ s = [...h$2(t), ...o$2(t)];
189
+ for (const i of s) this.createProperty(i, t[i]);
190
+ }
191
+ const t = this[Symbol.metadata];
192
+ if (null !== t) {
193
+ const s = litPropertyMetadata.get(t);
194
+ if (void 0 !== s) for (const [t, i] of s) this.elementProperties.set(t, i);
195
+ }
196
+ this._$Eh = new Map();
197
+ for (const [t, s] of this.elementProperties) {
198
+ const i = this._$Eu(t, s);
199
+ void 0 !== i && this._$Eh.set(i, t);
200
+ }
201
+ this.elementStyles = this.finalizeStyles(this.styles);
202
+ }
203
+ static finalizeStyles(s) {
204
+ const i = [];
205
+ if (Array.isArray(s)) {
206
+ const e = new Set(s.flat(1 / 0).reverse());
207
+ for (const s of e) i.unshift(c$3(s));
208
+ } else void 0 !== s && i.push(c$3(s));
209
+ return i;
210
+ }
211
+ static _$Eu(t, s) {
212
+ const i = s.attribute;
213
+ return !1 === i ? void 0 : "string" == typeof i ? i : "string" == typeof t ? t.toLowerCase() : void 0;
214
+ }
215
+ constructor() {
216
+ super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
217
+ }
218
+ _$Ev() {
219
+ this._$Eg = new Promise(t => this.enableUpdating = t), this._$AL = new Map(), this._$ES(), this.requestUpdate(), this.constructor.l?.forEach(t => t(this));
220
+ }
221
+ addController(t) {
222
+ (this._$E_ ??= new Set()).add(t), void 0 !== this.renderRoot && this.isConnected && t.hostConnected?.();
223
+ }
224
+ removeController(t) {
225
+ this._$E_?.delete(t);
226
+ }
227
+ _$ES() {
228
+ const t = new Map(),
229
+ s = this.constructor.elementProperties;
230
+ for (const i of s.keys()) this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]);
231
+ t.size > 0 && (this._$Ep = t);
232
+ }
233
+ createRenderRoot() {
234
+ const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
235
+ return S$1(t, this.constructor.elementStyles), t;
236
+ }
237
+ connectedCallback() {
238
+ this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$E_?.forEach(t => t.hostConnected?.());
239
+ }
240
+ enableUpdating(t) {}
241
+ disconnectedCallback() {
242
+ this._$E_?.forEach(t => t.hostDisconnected?.());
243
+ }
244
+ attributeChangedCallback(t, s, i) {
245
+ this._$AK(t, i);
246
+ }
247
+ _$EO(t, s) {
248
+ const i = this.constructor.elementProperties.get(t),
249
+ e = this.constructor._$Eu(t, i);
250
+ if (void 0 !== e && !0 === i.reflect) {
251
+ const r = (void 0 !== i.converter?.toAttribute ? i.converter : u$3).toAttribute(s, i.type);
252
+ this._$Em = t, null == r ? this.removeAttribute(e) : this.setAttribute(e, r), this._$Em = null;
253
+ }
254
+ }
255
+ _$AK(t, s) {
256
+ const i = this.constructor,
257
+ e = i._$Eh.get(t);
258
+ if (void 0 !== e && this._$Em !== e) {
259
+ const t = i.getPropertyOptions(e),
260
+ r = "function" == typeof t.converter ? {
261
+ fromAttribute: t.converter
262
+ } : void 0 !== t.converter?.fromAttribute ? t.converter : u$3;
263
+ this._$Em = e, this[e] = r.fromAttribute(s, t.type), this._$Em = null;
264
+ }
265
+ }
266
+ requestUpdate(t, s, i, e = !1, r) {
267
+ if (void 0 !== t) {
268
+ if (i ??= this.constructor.getPropertyOptions(t), !(i.hasChanged ?? f$1)(e ? r : this[t], s)) return;
269
+ this.C(t, s, i);
270
+ }
271
+ !1 === this.isUpdatePending && (this._$Eg = this._$EP());
272
+ }
273
+ C(t, s, i) {
274
+ this._$AL.has(t) || this._$AL.set(t, s), !0 === i.reflect && this._$Em !== t && (this._$Ej ??= new Set()).add(t);
275
+ }
276
+ async _$EP() {
277
+ this.isUpdatePending = !0;
278
+ try {
279
+ await this._$Eg;
280
+ } catch (t) {
281
+ Promise.reject(t);
282
+ }
283
+ const t = this.scheduleUpdate();
284
+ return null != t && (await t), !this.isUpdatePending;
285
+ }
286
+ scheduleUpdate() {
287
+ return this.performUpdate();
288
+ }
289
+ performUpdate() {
290
+ if (!this.isUpdatePending) return;
291
+ if (!this.hasUpdated) {
292
+ if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
293
+ for (const [t, s] of this._$Ep) this[t] = s;
294
+ this._$Ep = void 0;
295
+ }
296
+ const t = this.constructor.elementProperties;
297
+ if (t.size > 0) for (const [s, i] of t) !0 !== i.wrapped || this._$AL.has(s) || void 0 === this[s] || this.C(s, this[s], i);
298
+ }
299
+ let t = !1;
300
+ const s = this._$AL;
301
+ try {
302
+ t = this.shouldUpdate(s), t ? (this.willUpdate(s), this._$E_?.forEach(t => t.hostUpdate?.()), this.update(s)) : this._$ET();
303
+ } catch (s) {
304
+ throw t = !1, this._$ET(), s;
305
+ }
306
+ t && this._$AE(s);
307
+ }
308
+ willUpdate(t) {}
309
+ _$AE(t) {
310
+ this._$E_?.forEach(t => t.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
311
+ }
312
+ _$ET() {
313
+ this._$AL = new Map(), this.isUpdatePending = !1;
314
+ }
315
+ get updateComplete() {
316
+ return this.getUpdateComplete();
317
+ }
318
+ getUpdateComplete() {
319
+ return this._$Eg;
320
+ }
321
+ shouldUpdate(t) {
322
+ return !0;
323
+ }
324
+ update(t) {
325
+ this._$Ej &&= this._$Ej.forEach(t => this._$EO(t, this[t])), this._$ET();
326
+ }
327
+ updated(t) {}
328
+ firstUpdated(t) {}
329
+ }
330
+ b.elementStyles = [], b.shadowRootOptions = {
331
+ mode: "open"
332
+ }, b[d$1("elementProperties")] = new Map(), b[d$1("finalized")] = new Map(), p$2?.({
333
+ ReactiveElement: b
334
+ }), (a$1.reactiveElementVersions ??= []).push("2.0.2");
335
+
336
+ /**
337
+ * @license
338
+ * Copyright 2017 Google LLC
339
+ * SPDX-License-Identifier: BSD-3-Clause
340
+ */
341
+ const t$2 = globalThis,
342
+ i$1 = t$2.trustedTypes,
343
+ s$2 = i$1 ? i$1.createPolicy("lit-html", {
344
+ createHTML: t => t
345
+ }) : void 0,
346
+ e$1 = "$lit$",
347
+ h$1 = `lit$${(Math.random() + "").slice(9)}$`,
348
+ o$1 = "?" + h$1,
349
+ n$1 = `<${o$1}>`,
350
+ r$4 = document,
351
+ l = () => r$4.createComment(""),
352
+ c$1 = t => null === t || "object" != typeof t && "function" != typeof t,
353
+ a = Array.isArray,
354
+ u$2 = t => a(t) || "function" == typeof t?.[Symbol.iterator],
355
+ d = "[ \t\n\f\r]",
356
+ f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
357
+ v$1 = /-->/g,
358
+ _ = />/g,
359
+ m$1 = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"),
360
+ p$1 = /'/g,
361
+ g = /"/g,
362
+ $ = /^(?:script|style|textarea|title)$/i,
363
+ y = t => (i, ...s) => ({
364
+ _$litType$: t,
365
+ strings: i,
366
+ values: s
367
+ }),
368
+ x = y(1),
369
+ w = Symbol.for("lit-noChange"),
370
+ T = Symbol.for("lit-nothing"),
371
+ A = new WeakMap(),
372
+ E = r$4.createTreeWalker(r$4, 129);
373
+ function C(t, i) {
374
+ if (!Array.isArray(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array");
375
+ return void 0 !== s$2 ? s$2.createHTML(i) : i;
376
+ }
377
+ const P = (t, i) => {
378
+ const s = t.length - 1,
379
+ o = [];
380
+ let r,
381
+ l = 2 === i ? "<svg>" : "",
382
+ c = f;
383
+ for (let i = 0; i < s; i++) {
384
+ const s = t[i];
385
+ let a,
386
+ u,
387
+ d = -1,
388
+ y = 0;
389
+ for (; y < s.length && (c.lastIndex = y, u = c.exec(s), null !== u);) y = c.lastIndex, c === f ? "!--" === u[1] ? c = v$1 : void 0 !== u[1] ? c = _ : void 0 !== u[2] ? ($.test(u[2]) && (r = RegExp("</" + u[2], "g")), c = m$1) : void 0 !== u[3] && (c = m$1) : c === m$1 ? ">" === u[0] ? (c = r ?? f, d = -1) : void 0 === u[1] ? d = -2 : (d = c.lastIndex - u[2].length, a = u[1], c = void 0 === u[3] ? m$1 : '"' === u[3] ? g : p$1) : c === g || c === p$1 ? c = m$1 : c === v$1 || c === _ ? c = f : (c = m$1, r = void 0);
390
+ const x = c === m$1 && t[i + 1].startsWith("/>") ? " " : "";
391
+ l += c === f ? s + n$1 : d >= 0 ? (o.push(a), s.slice(0, d) + e$1 + s.slice(d) + h$1 + x) : s + h$1 + (-2 === d ? i : x);
392
+ }
393
+ return [C(t, l + (t[s] || "<?>") + (2 === i ? "</svg>" : "")), o];
394
+ };
395
+ class V {
396
+ constructor({
397
+ strings: t,
398
+ _$litType$: s
399
+ }, n) {
400
+ let r;
401
+ this.parts = [];
402
+ let c = 0,
403
+ a = 0;
404
+ const u = t.length - 1,
405
+ d = this.parts,
406
+ [f, v] = P(t, s);
407
+ if (this.el = V.createElement(f, n), E.currentNode = this.el.content, 2 === s) {
408
+ const t = this.el.content.firstChild;
409
+ t.replaceWith(...t.childNodes);
410
+ }
411
+ for (; null !== (r = E.nextNode()) && d.length < u;) {
412
+ if (1 === r.nodeType) {
413
+ if (r.hasAttributes()) for (const t of r.getAttributeNames()) if (t.endsWith(e$1)) {
414
+ const i = v[a++],
415
+ s = r.getAttribute(t).split(h$1),
416
+ e = /([.?@])?(.*)/.exec(i);
417
+ d.push({
418
+ type: 1,
419
+ index: c,
420
+ name: e[2],
421
+ strings: s,
422
+ ctor: "." === e[1] ? k : "?" === e[1] ? H : "@" === e[1] ? I : R
423
+ }), r.removeAttribute(t);
424
+ } else t.startsWith(h$1) && (d.push({
425
+ type: 6,
426
+ index: c
427
+ }), r.removeAttribute(t));
428
+ if ($.test(r.tagName)) {
429
+ const t = r.textContent.split(h$1),
430
+ s = t.length - 1;
431
+ if (s > 0) {
432
+ r.textContent = i$1 ? i$1.emptyScript : "";
433
+ for (let i = 0; i < s; i++) r.append(t[i], l()), E.nextNode(), d.push({
434
+ type: 2,
435
+ index: ++c
436
+ });
437
+ r.append(t[s], l());
438
+ }
439
+ }
440
+ } else if (8 === r.nodeType) if (r.data === o$1) d.push({
441
+ type: 2,
442
+ index: c
443
+ });else {
444
+ let t = -1;
445
+ for (; -1 !== (t = r.data.indexOf(h$1, t + 1));) d.push({
446
+ type: 7,
447
+ index: c
448
+ }), t += h$1.length - 1;
449
+ }
450
+ c++;
451
+ }
452
+ }
453
+ static createElement(t, i) {
454
+ const s = r$4.createElement("template");
455
+ return s.innerHTML = t, s;
456
+ }
457
+ }
458
+ function N(t, i, s = t, e) {
459
+ if (i === w) return i;
460
+ let h = void 0 !== e ? s._$Co?.[e] : s._$Cl;
461
+ const o = c$1(i) ? void 0 : i._$litDirective$;
462
+ return h?.constructor !== o && (h?._$AO?.(!1), void 0 === o ? h = void 0 : (h = new o(t), h._$AT(t, s, e)), void 0 !== e ? (s._$Co ??= [])[e] = h : s._$Cl = h), void 0 !== h && (i = N(t, h._$AS(t, i.values), h, e)), i;
463
+ }
464
+ class S {
465
+ constructor(t, i) {
466
+ this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = i;
467
+ }
468
+ get parentNode() {
469
+ return this._$AM.parentNode;
470
+ }
471
+ get _$AU() {
472
+ return this._$AM._$AU;
473
+ }
474
+ u(t) {
475
+ const {
476
+ el: {
477
+ content: i
478
+ },
479
+ parts: s
480
+ } = this._$AD,
481
+ e = (t?.creationScope ?? r$4).importNode(i, !0);
482
+ E.currentNode = e;
483
+ let h = E.nextNode(),
484
+ o = 0,
485
+ n = 0,
486
+ l = s[0];
487
+ for (; void 0 !== l;) {
488
+ if (o === l.index) {
489
+ let i;
490
+ 2 === l.type ? i = new M(h, h.nextSibling, this, t) : 1 === l.type ? i = new l.ctor(h, l.name, l.strings, this, t) : 6 === l.type && (i = new L(h, this, t)), this._$AV.push(i), l = s[++n];
491
+ }
492
+ o !== l?.index && (h = E.nextNode(), o++);
493
+ }
494
+ return E.currentNode = r$4, e;
495
+ }
496
+ p(t) {
497
+ let i = 0;
498
+ for (const s of this._$AV) void 0 !== s && (void 0 !== s.strings ? (s._$AI(t, s, i), i += s.strings.length - 2) : s._$AI(t[i])), i++;
499
+ }
500
+ }
501
+ class M {
502
+ get _$AU() {
503
+ return this._$AM?._$AU ?? this._$Cv;
504
+ }
505
+ constructor(t, i, s, e) {
506
+ this.type = 2, this._$AH = T, this._$AN = void 0, this._$AA = t, this._$AB = i, this._$AM = s, this.options = e, this._$Cv = e?.isConnected ?? !0;
507
+ }
508
+ get parentNode() {
509
+ let t = this._$AA.parentNode;
510
+ const i = this._$AM;
511
+ return void 0 !== i && 11 === t?.nodeType && (t = i.parentNode), t;
512
+ }
513
+ get startNode() {
514
+ return this._$AA;
515
+ }
516
+ get endNode() {
517
+ return this._$AB;
518
+ }
519
+ _$AI(t, i = this) {
520
+ t = N(this, t, i), c$1(t) ? t === T || null == t || "" === t ? (this._$AH !== T && this._$AR(), this._$AH = T) : t !== this._$AH && t !== w && this._(t) : void 0 !== t._$litType$ ? this.g(t) : void 0 !== t.nodeType ? this.$(t) : u$2(t) ? this.T(t) : this._(t);
521
+ }
522
+ k(t) {
523
+ return this._$AA.parentNode.insertBefore(t, this._$AB);
524
+ }
525
+ $(t) {
526
+ this._$AH !== t && (this._$AR(), this._$AH = this.k(t));
527
+ }
528
+ _(t) {
529
+ this._$AH !== T && c$1(this._$AH) ? this._$AA.nextSibling.data = t : this.$(r$4.createTextNode(t)), this._$AH = t;
530
+ }
531
+ g(t) {
532
+ const {
533
+ values: i,
534
+ _$litType$: s
535
+ } = t,
536
+ e = "number" == typeof s ? this._$AC(t) : (void 0 === s.el && (s.el = V.createElement(C(s.h, s.h[0]), this.options)), s);
537
+ if (this._$AH?._$AD === e) this._$AH.p(i);else {
538
+ const t = new S(e, this),
539
+ s = t.u(this.options);
540
+ t.p(i), this.$(s), this._$AH = t;
541
+ }
542
+ }
543
+ _$AC(t) {
544
+ let i = A.get(t.strings);
545
+ return void 0 === i && A.set(t.strings, i = new V(t)), i;
546
+ }
547
+ T(t) {
548
+ a(this._$AH) || (this._$AH = [], this._$AR());
549
+ const i = this._$AH;
550
+ let s,
551
+ e = 0;
552
+ for (const h of t) e === i.length ? i.push(s = new M(this.k(l()), this.k(l()), this, this.options)) : s = i[e], s._$AI(h), e++;
553
+ e < i.length && (this._$AR(s && s._$AB.nextSibling, e), i.length = e);
554
+ }
555
+ _$AR(t = this._$AA.nextSibling, i) {
556
+ for (this._$AP?.(!1, !0, i); t && t !== this._$AB;) {
557
+ const i = t.nextSibling;
558
+ t.remove(), t = i;
559
+ }
560
+ }
561
+ setConnected(t) {
562
+ void 0 === this._$AM && (this._$Cv = t, this._$AP?.(t));
563
+ }
564
+ }
565
+ class R {
566
+ get tagName() {
567
+ return this.element.tagName;
568
+ }
569
+ get _$AU() {
570
+ return this._$AM._$AU;
571
+ }
572
+ constructor(t, i, s, e, h) {
573
+ this.type = 1, this._$AH = T, this._$AN = void 0, this.element = t, this.name = i, this._$AM = e, this.options = h, s.length > 2 || "" !== s[0] || "" !== s[1] ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = T;
574
+ }
575
+ _$AI(t, i = this, s, e) {
576
+ const h = this.strings;
577
+ let o = !1;
578
+ if (void 0 === h) t = N(this, t, i, 0), o = !c$1(t) || t !== this._$AH && t !== w, o && (this._$AH = t);else {
579
+ const e = t;
580
+ let n, r;
581
+ for (t = h[0], n = 0; n < h.length - 1; n++) r = N(this, e[s + n], i, n), r === w && (r = this._$AH[n]), o ||= !c$1(r) || r !== this._$AH[n], r === T ? t = T : t !== T && (t += (r ?? "") + h[n + 1]), this._$AH[n] = r;
582
+ }
583
+ o && !e && this.O(t);
584
+ }
585
+ O(t) {
586
+ t === T ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
587
+ }
588
+ }
589
+ class k extends R {
590
+ constructor() {
591
+ super(...arguments), this.type = 3;
592
+ }
593
+ O(t) {
594
+ this.element[this.name] = t === T ? void 0 : t;
595
+ }
596
+ }
597
+ class H extends R {
598
+ constructor() {
599
+ super(...arguments), this.type = 4;
600
+ }
601
+ O(t) {
602
+ this.element.toggleAttribute(this.name, !!t && t !== T);
603
+ }
604
+ }
605
+ class I extends R {
606
+ constructor(t, i, s, e, h) {
607
+ super(t, i, s, e, h), this.type = 5;
608
+ }
609
+ _$AI(t, i = this) {
610
+ if ((t = N(this, t, i, 0) ?? T) === w) return;
611
+ const s = this._$AH,
612
+ e = t === T && s !== T || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive,
613
+ h = t !== T && (s === T || e);
614
+ e && this.element.removeEventListener(this.name, this, s), h && this.element.addEventListener(this.name, this, t), this._$AH = t;
615
+ }
616
+ handleEvent(t) {
617
+ "function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t);
618
+ }
619
+ }
620
+ class L {
621
+ constructor(t, i, s) {
622
+ this.element = t, this.type = 6, this._$AN = void 0, this._$AM = i, this.options = s;
623
+ }
624
+ get _$AU() {
625
+ return this._$AM._$AU;
626
+ }
627
+ _$AI(t) {
628
+ N(this, t);
629
+ }
630
+ }
631
+ const z = {
632
+ j: e$1,
633
+ P: h$1,
634
+ A: o$1,
635
+ C: 1,
636
+ M: P,
637
+ L: S,
638
+ R: u$2,
639
+ V: N,
640
+ D: M,
641
+ I: R,
642
+ H,
643
+ N: I,
644
+ U: k,
645
+ B: L
646
+ },
647
+ Z = t$2.litHtmlPolyfillSupport;
648
+ Z?.(V, M), (t$2.litHtmlVersions ??= []).push("3.1.0");
649
+ const j = (t, i, s) => {
650
+ const e = s?.renderBefore ?? i;
651
+ let h = e._$litPart$;
652
+ if (void 0 === h) {
653
+ const t = s?.renderBefore ?? null;
654
+ e._$litPart$ = h = new M(i.insertBefore(l(), t), t, void 0, s ?? {});
655
+ }
656
+ return h._$AI(t), h;
657
+ };
658
+
659
+ /**
660
+ * @license
661
+ * Copyright 2017 Google LLC
662
+ * SPDX-License-Identifier: BSD-3-Clause
663
+ */
664
+ let s$1 = class s extends b {
665
+ constructor() {
666
+ super(...arguments), this.renderOptions = {
667
+ host: this
668
+ }, this._$Do = void 0;
669
+ }
670
+ createRenderRoot() {
671
+ const t = super.createRenderRoot();
672
+ return this.renderOptions.renderBefore ??= t.firstChild, t;
673
+ }
674
+ update(t) {
675
+ const i = this.render();
676
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = j(i, this.renderRoot, this.renderOptions);
677
+ }
678
+ connectedCallback() {
679
+ super.connectedCallback(), this._$Do?.setConnected(!0);
680
+ }
681
+ disconnectedCallback() {
682
+ super.disconnectedCallback(), this._$Do?.setConnected(!1);
683
+ }
684
+ render() {
685
+ return w;
686
+ }
687
+ };
688
+ s$1._$litElement$ = !0, s$1[("finalized")] = !0, globalThis.litElementHydrateSupport?.({
689
+ LitElement: s$1
690
+ });
691
+ const r$3 = globalThis.litElementPolyfillSupport;
692
+ r$3?.({
693
+ LitElement: s$1
694
+ });
695
+ (globalThis.litElementVersions ??= []).push("4.0.2");
696
+
697
+ /**
698
+ * @license
699
+ * Copyright 2017 Google LLC
700
+ * SPDX-License-Identifier: BSD-3-Clause
701
+ */
702
+ const t$1 = {
703
+ ATTRIBUTE: 1,
704
+ CHILD: 2,
705
+ PROPERTY: 3,
706
+ BOOLEAN_ATTRIBUTE: 4,
707
+ EVENT: 5,
708
+ ELEMENT: 6
709
+ },
710
+ e = t => (...e) => ({
711
+ _$litDirective$: t,
712
+ values: e
713
+ });
714
+ class i {
715
+ constructor(t) {}
716
+ get _$AU() {
717
+ return this._$AM._$AU;
718
+ }
719
+ _$AT(t, e, i) {
720
+ this._$Ct = t, this._$AM = e, this._$Ci = i;
721
+ }
722
+ _$AS(t, e) {
723
+ return this.update(t, e);
724
+ }
725
+ update(t, e) {
726
+ return this.render(...e);
727
+ }
728
+ }
729
+
730
+ /**
731
+ * @license
732
+ * Copyright 2020 Google LLC
733
+ * SPDX-License-Identifier: BSD-3-Clause
734
+ */
735
+ const {
736
+ D: t
737
+ } = z,
738
+ s = () => document.createComment(""),
739
+ r$2 = (o, i, n) => {
740
+ const e = o._$AA.parentNode,
741
+ l = void 0 === i ? o._$AB : i._$AA;
742
+ if (void 0 === n) {
743
+ const i = e.insertBefore(s(), l),
744
+ c = e.insertBefore(s(), l);
745
+ n = new t(i, c, o, o.options);
746
+ } else {
747
+ const t = n._$AB.nextSibling,
748
+ i = n._$AM,
749
+ c = i !== o;
750
+ if (c) {
751
+ let t;
752
+ n._$AQ?.(o), n._$AM = o, void 0 !== n._$AP && (t = o._$AU) !== i._$AU && n._$AP(t);
753
+ }
754
+ if (t !== l || c) {
755
+ let o = n._$AA;
756
+ for (; o !== t;) {
757
+ const t = o.nextSibling;
758
+ e.insertBefore(o, l), o = t;
759
+ }
760
+ }
761
+ }
762
+ return n;
763
+ },
764
+ v = (o, t, i = o) => (o._$AI(t, i), o),
765
+ u$1 = {},
766
+ m = (o, t = u$1) => o._$AH = t,
767
+ p = o => o._$AH,
768
+ h = o => {
769
+ o._$AP?.(!1, !0);
770
+ let t = o._$AA;
771
+ const i = o._$AB.nextSibling;
772
+ for (; t !== i;) {
773
+ const o = t.nextSibling;
774
+ t.remove(), t = o;
775
+ }
776
+ };
777
+
778
+ /**
779
+ * @license
780
+ * Copyright 2017 Google LLC
781
+ * SPDX-License-Identifier: BSD-3-Clause
782
+ */
783
+ const u = (e, s, t) => {
784
+ const r = new Map();
785
+ for (let l = s; l <= t; l++) r.set(e[l], l);
786
+ return r;
787
+ },
788
+ c = e(class extends i {
789
+ constructor(e) {
790
+ if (super(e), e.type !== t$1.CHILD) throw Error("repeat() can only be used in text expressions");
791
+ }
792
+ ht(e, s, t) {
793
+ let r;
794
+ void 0 === t ? t = s : void 0 !== s && (r = s);
795
+ const l = [],
796
+ o = [];
797
+ let i = 0;
798
+ for (const s of e) l[i] = r ? r(s, i) : i, o[i] = t(s, i), i++;
799
+ return {
800
+ values: o,
801
+ keys: l
802
+ };
803
+ }
804
+ render(e, s, t) {
805
+ return this.ht(e, s, t).values;
806
+ }
807
+ update(s, [t, r, c]) {
808
+ const d = p(s),
809
+ {
810
+ values: p$1,
811
+ keys: a
812
+ } = this.ht(t, r, c);
813
+ if (!Array.isArray(d)) return this.dt = a, p$1;
814
+ const h$1 = this.dt ??= [],
815
+ v$1 = [];
816
+ let m$1,
817
+ y,
818
+ x = 0,
819
+ j = d.length - 1,
820
+ k = 0,
821
+ w$1 = p$1.length - 1;
822
+ for (; x <= j && k <= w$1;) if (null === d[x]) x++;else if (null === d[j]) j--;else if (h$1[x] === a[k]) v$1[k] = v(d[x], p$1[k]), x++, k++;else if (h$1[j] === a[w$1]) v$1[w$1] = v(d[j], p$1[w$1]), j--, w$1--;else if (h$1[x] === a[w$1]) v$1[w$1] = v(d[x], p$1[w$1]), r$2(s, v$1[w$1 + 1], d[x]), x++, w$1--;else if (h$1[j] === a[k]) v$1[k] = v(d[j], p$1[k]), r$2(s, d[x], d[j]), j--, k++;else if (void 0 === m$1 && (m$1 = u(a, k, w$1), y = u(h$1, x, j)), m$1.has(h$1[x])) {
823
+ if (m$1.has(h$1[j])) {
824
+ const e = y.get(a[k]),
825
+ t = void 0 !== e ? d[e] : null;
826
+ if (null === t) {
827
+ const e = r$2(s, d[x]);
828
+ v(e, p$1[k]), v$1[k] = e;
829
+ } else v$1[k] = v(t, p$1[k]), r$2(s, d[x], t), d[e] = null;
830
+ k++;
831
+ } else h(d[j]), j--;
832
+ } else h(d[x]), x++;
833
+ for (; k <= w$1;) {
834
+ const e = r$2(s, v$1[w$1 + 1]);
835
+ v(e, p$1[k]), v$1[k++] = e;
836
+ }
837
+ for (; x <= j;) {
838
+ const e = d[x++];
839
+ null !== e && h(e);
840
+ }
841
+ return this.dt = a, m(s, v$1), w;
842
+ }
843
+ });
844
+
845
+ /**
846
+ * @license
847
+ * Copyright 2017 Google LLC
848
+ * SPDX-License-Identifier: BSD-3-Clause
849
+ */
850
+ const o = {
851
+ attribute: !0,
852
+ type: String,
853
+ converter: u$3,
854
+ reflect: !1,
855
+ hasChanged: f$1
856
+ },
857
+ r$1 = (t = o, e, r) => {
858
+ const {
859
+ kind: n,
860
+ metadata: i
861
+ } = r;
862
+ let s = globalThis.litPropertyMetadata.get(i);
863
+ if (void 0 === s && globalThis.litPropertyMetadata.set(i, s = new Map()), s.set(r.name, t), "accessor" === n) {
864
+ const {
865
+ name: o
866
+ } = r;
867
+ return {
868
+ set(r) {
869
+ const n = e.get.call(this);
870
+ e.set.call(this, r), this.requestUpdate(o, n, t);
871
+ },
872
+ init(e) {
873
+ return void 0 !== e && this.C(o, void 0, t), e;
874
+ }
875
+ };
876
+ }
877
+ if ("setter" === n) {
878
+ const {
879
+ name: o
880
+ } = r;
881
+ return function (r) {
882
+ const n = this[o];
883
+ e.call(this, r), this.requestUpdate(o, n, t);
884
+ };
885
+ }
886
+ throw Error("Unsupported decorator location: " + n);
887
+ };
888
+ function n(t) {
889
+ return (e, o) => "object" == typeof o ? r$1(t, e, o) : ((t, e, o) => {
890
+ const r = e.hasOwnProperty(o);
891
+ return e.constructor.createProperty(o, r ? {
892
+ ...t,
893
+ wrapped: !0
894
+ } : t), r ? Object.getOwnPropertyDescriptor(e, o) : void 0;
895
+ })(t, e, o);
896
+ }
897
+
898
+ /**
899
+ * @license
900
+ * Copyright 2017 Google LLC
901
+ * SPDX-License-Identifier: BSD-3-Clause
902
+ */
903
+ function r(r) {
904
+ return n({
905
+ ...r,
906
+ state: !0,
907
+ attribute: !1
908
+ });
909
+ }
910
+
911
+ // echarts.use([GaugeChart, CanvasRenderer]);
912
+ class WidgetGauge extends s$1 {
913
+ constructor() {
914
+ super();
915
+ this.inputData = undefined;
916
+ this.dataSets = [];
917
+ this.canvasList = {};
918
+ this.origWidth = 0;
919
+ this.origHeight = 0;
920
+ this.modifier = 1;
921
+ this.version = '1.5.21';
922
+ this.resizeObserver = new ResizeObserver(this.adjustSizes.bind(this));
923
+ this.template = {
924
+ title: {
925
+ text: 'Gauge',
926
+ left: 'center',
927
+ textStyle: {
928
+ fontSize: 10
929
+ }
930
+ },
931
+ series: [
932
+ {
933
+ type: 'gauge',
934
+ startAngle: 180,
935
+ endAngle: 0,
936
+ min: 33,
937
+ max: 99,
938
+ radius: '120%',
939
+ center: ['50%', '90%'],
940
+ progress: {
941
+ show: true,
942
+ clip: true,
943
+ width: 50,
944
+ roundCap: false,
945
+ itemStyle: {
946
+ color: 'auto'
947
+ }
948
+ },
949
+ axisLine: { show: false },
950
+ axisTick: { show: false },
951
+ splitLine: { show: false },
952
+ axisLabel: { show: false },
953
+ anchor: { show: false },
954
+ pointer: { show: false },
955
+ detail: {
956
+ valueAnimation: false,
957
+ fontSize: 25,
958
+ offsetCenter: [0, '-7%'],
959
+ color: 'inherit',
960
+ formatter: (val) => isNaN(val) ? '-' : val.toFixed()
961
+ },
962
+ title: {
963
+ offsetCenter: [0, '-35%'],
964
+ fontSize: 20
965
+ },
966
+ data: [
967
+ {
968
+ value: 70,
969
+ }
970
+ ]
971
+ },
972
+ {
973
+ type: 'gauge',
974
+ startAngle: 180,
975
+ endAngle: 0,
976
+ min: 33,
977
+ max: 99,
978
+ radius: '125%',
979
+ center: ['50%', '90%'],
980
+ axisLine: {
981
+ lineStyle: {
982
+ width: 20,
983
+ color: [
984
+ [0.2, '#67e0e3'],
985
+ [0.8, '#37a2da'],
986
+ [1, '#fd666d']
987
+ ]
988
+ }
989
+ },
990
+ axisTick: { show: false },
991
+ splitLine: {
992
+ length: 15,
993
+ distance: -25,
994
+ lineStyle: {
995
+ width: 2,
996
+ color: 'auto',
997
+ }
998
+ },
999
+ axisLabel: {
1000
+ distance: -20,
1001
+ color: '#999',
1002
+ rotate: 'tangential',
1003
+ fontSize: 12,
1004
+ },
1005
+ },
1006
+ ]
1007
+ };
1008
+ }
1009
+ update(changedProperties) {
1010
+ changedProperties.forEach((oldValue, propName) => {
1011
+ if (propName === 'inputData') {
1012
+ this.transformData();
1013
+ this.applyData();
1014
+ }
1015
+ });
1016
+ super.update(changedProperties);
1017
+ }
1018
+ firstUpdated(_changedProperties) {
1019
+ var _a;
1020
+ this.resizeObserver.observe((_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.wrapper'));
1021
+ this.sizingSetup();
1022
+ this.transformData();
1023
+ this.adjustSizes();
1024
+ this.applyData();
1025
+ }
1026
+ sizingSetup() {
1027
+ var _a, _b, _c, _d, _e;
1028
+ if (this.origWidth !== 0 && this.origHeight !== 0)
1029
+ return;
1030
+ this.boxes = Array.from((_a = this === null || this === void 0 ? void 0 : this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.chart'));
1031
+ if (!this.boxes.length)
1032
+ return;
1033
+ this.origWidth = (_c = (_b = this.boxes) === null || _b === void 0 ? void 0 : _b.map(b => b.getBoundingClientRect().width).reduce((p, c) => c > p ? c : p, 0)) !== null && _c !== void 0 ? _c : 0;
1034
+ this.origHeight = (_e = (_d = this.boxes) === null || _d === void 0 ? void 0 : _d.map(b => b.getBoundingClientRect().height).reduce((p, c) => c > p ? c : p, 0)) !== null && _e !== void 0 ? _e : 0;
1035
+ if (this.origWidth > 0)
1036
+ this.origWidth += 16;
1037
+ if (this.origHeight > 0)
1038
+ this.origHeight += 16;
1039
+ // console.log('OrigWidth', this.origWidth, this.origHeight)
1040
+ }
1041
+ adjustSizes() {
1042
+ var _a, _b, _c;
1043
+ // if (!this.origHeight) return
1044
+ const container = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.gauge-container');
1045
+ if (!container)
1046
+ return;
1047
+ const userWidth = container.getBoundingClientRect().width;
1048
+ const userHeight = container.getBoundingClientRect().height;
1049
+ const count = this.dataSets.length;
1050
+ const width = this.origWidth;
1051
+ const height = this.origHeight;
1052
+ if (!userHeight || !userWidth || !width || !height)
1053
+ return;
1054
+ const fits = [];
1055
+ for (let c = 1; c <= count; c++) {
1056
+ const r = Math.ceil(count / c);
1057
+ const uwgap = (userWidth - 12 * (c - 1));
1058
+ const uhgap = (userHeight - 12 * (r - 1));
1059
+ const m = uwgap / width / c;
1060
+ const size = m * m * width * height * count;
1061
+ if (r * m * height < uhgap)
1062
+ fits.push({ c, m, size, width, height, userWidth, userHeight });
1063
+ }
1064
+ for (let r = 1; r <= count; r++) {
1065
+ const c = Math.ceil(count / r);
1066
+ const uwgap = (userWidth - 12 * (c - 1));
1067
+ const uhgap = (userHeight - 12 * (r - 1));
1068
+ const m = uhgap / height / r;
1069
+ const size = m * m * width * height * count;
1070
+ if (c * m * width < uwgap)
1071
+ fits.push({ r, m, size, width, height, userWidth, userHeight });
1072
+ }
1073
+ const maxSize = fits.reduce((p, c) => c.size < p ? p : c.size, 0);
1074
+ const fit = fits.find(f => f.size === maxSize);
1075
+ const modifier = ((_b = fit === null || fit === void 0 ? void 0 : fit.m) !== null && _b !== void 0 ? _b : 0);
1076
+ // console.log('FITS count', count, userWidth, userHeight, 'modifier', modifier, 'cols',fit?.c, 'rows', fit?.r, 'new size', fit?.size.toFixed(0), 'total space', (userWidth* userHeight).toFixed(0))
1077
+ (_c = this.boxes) === null || _c === void 0 ? void 0 : _c.forEach(box => box.setAttribute("style", `width:${modifier * width}px; height:${modifier * height}px`));
1078
+ this.modifier = modifier;
1079
+ for (const canvas in this.canvasList) {
1080
+ this.canvasList[canvas].resize();
1081
+ }
1082
+ this.applyData();
1083
+ }
1084
+ async transformData() {
1085
+ var _a;
1086
+ if (!(this === null || this === void 0 ? void 0 : this.inputData))
1087
+ return;
1088
+ this.dataSets = [];
1089
+ (_a = this.inputData.dataseries) === null || _a === void 0 ? void 0 : _a.forEach(ds => {
1090
+ // pivot data
1091
+ const distincts = [...new Set(ds.data.map((d) => d.pivot))];
1092
+ if (distincts.length > 1) {
1093
+ distincts.forEach((piv) => {
1094
+ const pds = {
1095
+ label: `${ds.label} ${piv}`,
1096
+ unit: ds.unit,
1097
+ averageLatest: ds.averageLatest,
1098
+ valueColor: ds.valueColor,
1099
+ sections: ds.sections,
1100
+ backgroundColors: ds.backgroundColors,
1101
+ data: ds.data.filter(d => d.pivot === piv)
1102
+ };
1103
+ this.dataSets.push(pds);
1104
+ });
1105
+ }
1106
+ else {
1107
+ this.dataSets.push(ds);
1108
+ }
1109
+ });
1110
+ // console.log('Gauge Datasets', this.dataSets)
1111
+ }
1112
+ applyData() {
1113
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
1114
+ const modifier = this.modifier;
1115
+ this.setupCharts();
1116
+ for (const ds of this.dataSets) {
1117
+ // compute derivative values
1118
+ // filter latest values and calculate average
1119
+ if (typeof ds.averageLatest !== 'number' || !isNaN(ds.averageLatest))
1120
+ ds.averageLatest = 1;
1121
+ ds.data = ds.data.splice(-ds.averageLatest || -1);
1122
+ ds.needleValue = (_a = ds.data.map(d => d.value).reduce((p, c) => p + c, 0) / ds.data.length) !== null && _a !== void 0 ? _a : (_b = ds.sections) === null || _b === void 0 ? void 0 : _b[0];
1123
+ ds.range = (_f = ((_c = ds.sections) === null || _c === void 0 ? void 0 : _c[((_d = ds.sections) === null || _d === void 0 ? void 0 : _d.length) - 1]) - ((_e = ds.sections) === null || _e === void 0 ? void 0 : _e[0])) !== null && _f !== void 0 ? _f : 100;
1124
+ if (isNaN(ds.range))
1125
+ ds.range = 100;
1126
+ ds.ranges = (_h = (_g = ds.sections) === null || _g === void 0 ? void 0 : _g.map((v, i, a) => { var _a; return v - ((_a = a === null || a === void 0 ? void 0 : a[i - 1]) !== null && _a !== void 0 ? _a : 0); }).slice(1)) !== null && _h !== void 0 ? _h : [];
1127
+ // const option = this.canvasList[ds.label].getOption()
1128
+ const option = JSON.parse(JSON.stringify(this.template));
1129
+ const ga = option.series[0], ga2 = option.series[1];
1130
+ // Title
1131
+ option.title.text = ds.label;
1132
+ option.title.textStyle.fontSize = 22 * modifier;
1133
+ // Needle
1134
+ ga.data[0].value = ds.needleValue;
1135
+ ga.data[0].name = ds.unit;
1136
+ ga.title.fontSize = 20 * modifier;
1137
+ ga.title.color = (_j = ds.valueColor) !== null && _j !== void 0 ? _j : 'black';
1138
+ ga.detail.color = (_k = ds.valueColor) !== null && _k !== void 0 ? _k : 'black';
1139
+ ga.detail.fontSize = 40 * modifier;
1140
+ ga.detail.formatter = (val) => isNaN(val) ? '-' : val.toFixed(0);
1141
+ // ga.anchor.itemStyle.color = ds.valueColor
1142
+ // ga.pointer.itemStyle.color = ds.valueColor
1143
+ // Axis
1144
+ ga2.min = ((_l = ds.sections) === null || _l === void 0 ? void 0 : _l.length) ? Math.min(...ds.sections) : 0;
1145
+ ga2.max = ((_m = ds.sections) === null || _m === void 0 ? void 0 : _m.length) ? Math.max(...ds.sections) : 100;
1146
+ ga.min = ga2.min;
1147
+ ga.max = ga2.max;
1148
+ // @ts-ignore
1149
+ const colorSections = (_o = ds.backgroundColors) === null || _o === void 0 ? void 0 : _o.map((b, i) => { var _a; return [(((_a = ds.sections) === null || _a === void 0 ? void 0 : _a[i + 1]) - ga.min) / ds.range, b]; }).filter(([s]) => !isNaN(s));
1150
+ ga2.axisLine.lineStyle.width = 8 * modifier;
1151
+ ga2.axisLine.lineStyle.color = (colorSections === null || colorSections === void 0 ? void 0 : colorSections.length) ? colorSections : ga2.axisLine.lineStyle.color;
1152
+ ga2.axisLabel.fontSize = 20 * modifier;
1153
+ // ga2.axisLabel.color = ds.valueColor
1154
+ ga2.axisLabel.distance = -24 * modifier;
1155
+ ga2.splitLine.length = 16 * modifier;
1156
+ ga2.splitLine.distance = -16 * modifier;
1157
+ // Progress
1158
+ let progressColor = (_q = (_p = ds.backgroundColors) === null || _p === void 0 ? void 0 : _p[ds.backgroundColors.length - 1]) !== null && _q !== void 0 ? _q : 'green';
1159
+ for (const [i, s] of (_s = (_r = ds.sections) === null || _r === void 0 ? void 0 : _r.entries()) !== null && _s !== void 0 ? _s : []) {
1160
+ if (s > ds.needleValue) {
1161
+ progressColor = (_t = ds.backgroundColors[i - 1]) !== null && _t !== void 0 ? _t : ds.backgroundColors[0];
1162
+ break;
1163
+ }
1164
+ }
1165
+ ga.progress.itemStyle.color = progressColor;
1166
+ ga.progress.width = 80 * modifier;
1167
+ // Apply
1168
+ (_u = this.canvasList[ds.label]) === null || _u === void 0 ? void 0 : _u.setOption(option);
1169
+ }
1170
+ }
1171
+ setupCharts() {
1172
+ // remove the gauge canvases of non provided data series
1173
+ for (const label in this.canvasList) {
1174
+ const ex = this.dataSets.find(ds => ds.label === label);
1175
+ if (!ex)
1176
+ delete this.canvasList[label];
1177
+ }
1178
+ this.dataSets.forEach(ds => {
1179
+ var _a;
1180
+ if (this.canvasList[ds.label])
1181
+ return;
1182
+ const canvas = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(`[name="${ds.label}"]`);
1183
+ if (!canvas)
1184
+ return;
1185
+ // @ts-ignore
1186
+ this.canvasList[ds.label] = echarts.init(canvas);
1187
+ this.canvasList[ds.label].setOption(JSON.parse(JSON.stringify(this.template)));
1188
+ });
1189
+ }
1190
+ render() {
1191
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1192
+ return x `
1193
+ <div class="wrapper">
1194
+ <header>
1195
+ <h3 class="paging" ?active=${(_b = (_a = this.inputData) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? void 0 : _b.title}>${(_d = (_c = this.inputData) === null || _c === void 0 ? void 0 : _c.settings) === null || _d === void 0 ? void 0 : _d.title}</h3>
1196
+ <p class="paging" ?active=${(_f = (_e = this.inputData) === null || _e === void 0 ? void 0 : _e.settings) === null || _f === void 0 ? void 0 : _f.subTitle}>${(_h = (_g = this.inputData) === null || _g === void 0 ? void 0 : _g.settings) === null || _h === void 0 ? void 0 : _h.subTitle}</p>
1197
+ </header>
1198
+ <div class="gauge-container">
1199
+ ${c(this.dataSets, ds => ds.label, ds => x `
1200
+ <div name="${ds.label}" class="chart" style="min-width: 600px; min-height: 300px; width: 600px; height: 300px;"></div>
1201
+ `)}
1202
+ </div>
1203
+ </div>
1204
+ `;
1205
+ }
1206
+ }
1207
+ WidgetGauge.styles = i$3 `
1208
+ :host {
1209
+ display: block;
1210
+ color: var(--re-text-color, #000);
1211
+ font-family: sans-serif;
1212
+ box-sizing: border-box;
1213
+ position: relative;
1214
+ margin: auto;
1215
+ }
1216
+
1217
+ .paging:not([active]) { display: none !important; }
1218
+
1219
+ .wrapper {
1220
+ display: flex;
1221
+ flex-direction: column;
1222
+ height: 100%;
1223
+ width: 100%;
1224
+ padding: 16px;
1225
+ box-sizing: border-box;
1226
+ }
1227
+ .gauge-container {
1228
+ display: flex;
1229
+ flex: 1;
1230
+ justify-content: center;
1231
+ align-items: center;
1232
+ flex-wrap: wrap;
1233
+ overflow: hidden;
1234
+ position: relative;
1235
+ gap: 12px;
1236
+ }
1237
+
1238
+ header {
1239
+ display: flex;
1240
+ flex-direction: column;
1241
+ margin: 0 0 16px 0;
1242
+ }
1243
+ h3 {
1244
+ margin: 0;
1245
+ max-width: 300px;
1246
+ overflow: hidden;
1247
+ text-overflow: ellipsis;
1248
+ white-space: nowrap;
1249
+ color: var(--re-text-color, #000) !important;
1250
+ }
1251
+ p {
1252
+ margin: 10px 0 0 0;
1253
+ max-width: 300px;
1254
+ font-size: 14px;
1255
+ line-height: 17px;
1256
+ overflow: hidden;
1257
+ text-overflow: ellipsis;
1258
+ white-space: nowrap;
1259
+ color: var(--re-text-color, #000) !important;
1260
+ }
1261
+
1262
+ .chart {
1263
+ width: 600px; /* will be overriden by adjustSizes */
1264
+ height: 300px;
1265
+ }
1266
+
1267
+ `;
1268
+ __decorate([
1269
+ n({ type: Object })
1270
+ ], WidgetGauge.prototype, "inputData", void 0);
1271
+ __decorate([
1272
+ r()
1273
+ ], WidgetGauge.prototype, "dataSets", void 0);
1274
+ __decorate([
1275
+ r()
1276
+ ], WidgetGauge.prototype, "canvasList", void 0);
1277
+ window.customElements.define('widget-gauge-1.5.21', WidgetGauge);
1278
+
1279
+ export { WidgetGauge };
1280
+ //# sourceMappingURL=widget-gauge.js.map