@luzmo/embed 5.0.10 → 5.0.12

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,3079 @@
1
+ (function (g, f) {
2
+ var hasExports = typeof exports === 'object';
3
+ if (typeof define === "function" && define.amd) {
4
+ define([], f);
5
+ } else if (typeof module === "object" && module.exports) {
6
+ module.exports = f();
7
+ } else {
8
+ var m = hasExports ? f() : f();
9
+ var root = hasExports ? exports : g;
10
+ for(var i in m) root[i] = m[i];
11
+ }}(typeof self !== 'undefined' ? self : this, () => {
12
+ var exports = {};
13
+ var module = { exports };
14
+ "use strict";
15
+ var __defProp = Object.defineProperty;
16
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
17
+ var __getOwnPropNames = Object.getOwnPropertyNames;
18
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
19
+ var __export = (target, all) => {
20
+ for (var name in all)
21
+ __defProp(target, name, { get: all[name], enumerable: true });
22
+ };
23
+ var __copyProps = (to, from, except, desc) => {
24
+ if (from && typeof from === "object" || typeof from === "function") {
25
+ for (let key of __getOwnPropNames(from))
26
+ if (!__hasOwnProp.call(to, key) && key !== except)
27
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
28
+ }
29
+ return to;
30
+ };
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+ var __decorateClass = (decorators, target, key, kind) => {
33
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
34
+ for (var i6 = decorators.length - 1, decorator; i6 >= 0; i6--)
35
+ if (decorator = decorators[i6])
36
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
37
+ if (kind && result)
38
+ __defProp(target, key, result);
39
+ return result;
40
+ };
41
+
42
+ // libs/embed-libs/embed/src/index.libs.ts
43
+ var index_libs_exports = {};
44
+ __export(index_libs_exports, {
45
+ LuzmoDashboardWebComponent: () => LuzmoDashboardWebComponent
46
+ });
47
+ module.exports = __toCommonJS(index_libs_exports);
48
+
49
+ // node_modules/@lit/reactive-element/decorators/custom-element.js
50
+ var t = (t5) => (e7, o6) => {
51
+ void 0 !== o6 ? o6.addInitializer(() => {
52
+ customElements.define(t5, e7);
53
+ }) : customElements.define(t5, e7);
54
+ };
55
+
56
+ // node_modules/@lit/reactive-element/css-tag.js
57
+ var t2 = globalThis;
58
+ var e = t2.ShadowRoot && (void 0 === t2.ShadyCSS || t2.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype;
59
+ var s = Symbol();
60
+ var o = /* @__PURE__ */ new WeakMap();
61
+ var n = class {
62
+ constructor(t5, e7, o6) {
63
+ if (this._$cssResult$ = true, o6 !== s)
64
+ throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
65
+ this.cssText = t5, this.t = e7;
66
+ }
67
+ get styleSheet() {
68
+ let t5 = this.o;
69
+ const s4 = this.t;
70
+ if (e && void 0 === t5) {
71
+ const e7 = void 0 !== s4 && 1 === s4.length;
72
+ e7 && (t5 = o.get(s4)), void 0 === t5 && ((this.o = t5 = new CSSStyleSheet()).replaceSync(this.cssText), e7 && o.set(s4, t5));
73
+ }
74
+ return t5;
75
+ }
76
+ toString() {
77
+ return this.cssText;
78
+ }
79
+ };
80
+ var r = (t5) => new n("string" == typeof t5 ? t5 : t5 + "", void 0, s);
81
+ var i = (t5, ...e7) => {
82
+ const o6 = 1 === t5.length ? t5[0] : e7.reduce((e8, s4, o7) => e8 + ((t6) => {
83
+ if (true === t6._$cssResult$)
84
+ return t6.cssText;
85
+ if ("number" == typeof t6)
86
+ return t6;
87
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + t6 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
88
+ })(s4) + t5[o7 + 1], t5[0]);
89
+ return new n(o6, t5, s);
90
+ };
91
+ var S = (s4, o6) => {
92
+ if (e)
93
+ s4.adoptedStyleSheets = o6.map((t5) => t5 instanceof CSSStyleSheet ? t5 : t5.styleSheet);
94
+ else
95
+ for (const e7 of o6) {
96
+ const o7 = document.createElement("style"), n6 = t2.litNonce;
97
+ void 0 !== n6 && o7.setAttribute("nonce", n6), o7.textContent = e7.cssText, s4.appendChild(o7);
98
+ }
99
+ };
100
+ var c = e ? (t5) => t5 : (t5) => t5 instanceof CSSStyleSheet ? ((t6) => {
101
+ let e7 = "";
102
+ for (const s4 of t6.cssRules)
103
+ e7 += s4.cssText;
104
+ return r(e7);
105
+ })(t5) : t5;
106
+
107
+ // node_modules/@lit/reactive-element/reactive-element.js
108
+ var { is: i2, defineProperty: e2, getOwnPropertyDescriptor: r2, getOwnPropertyNames: h, getOwnPropertySymbols: o2, getPrototypeOf: n2 } = Object;
109
+ var a = globalThis;
110
+ var c2 = a.trustedTypes;
111
+ var l = c2 ? c2.emptyScript : "";
112
+ var p = a.reactiveElementPolyfillSupport;
113
+ var d = (t5, s4) => t5;
114
+ var u = { toAttribute(t5, s4) {
115
+ switch (s4) {
116
+ case Boolean:
117
+ t5 = t5 ? l : null;
118
+ break;
119
+ case Object:
120
+ case Array:
121
+ t5 = null == t5 ? t5 : JSON.stringify(t5);
122
+ }
123
+ return t5;
124
+ }, fromAttribute(t5, s4) {
125
+ let i6 = t5;
126
+ switch (s4) {
127
+ case Boolean:
128
+ i6 = null !== t5;
129
+ break;
130
+ case Number:
131
+ i6 = null === t5 ? null : Number(t5);
132
+ break;
133
+ case Object:
134
+ case Array:
135
+ try {
136
+ i6 = JSON.parse(t5);
137
+ } catch (t6) {
138
+ i6 = null;
139
+ }
140
+ }
141
+ return i6;
142
+ } };
143
+ var f = (t5, s4) => !i2(t5, s4);
144
+ var y = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
145
+ Symbol.metadata ??= Symbol("metadata"), a.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
146
+ var b = class extends HTMLElement {
147
+ static addInitializer(t5) {
148
+ this._$Ei(), (this.l ??= []).push(t5);
149
+ }
150
+ static get observedAttributes() {
151
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
152
+ }
153
+ static createProperty(t5, s4 = y) {
154
+ if (s4.state && (s4.attribute = false), this._$Ei(), this.elementProperties.set(t5, s4), !s4.noAccessor) {
155
+ const i6 = Symbol(), r7 = this.getPropertyDescriptor(t5, i6, s4);
156
+ void 0 !== r7 && e2(this.prototype, t5, r7);
157
+ }
158
+ }
159
+ static getPropertyDescriptor(t5, s4, i6) {
160
+ const { get: e7, set: h3 } = r2(this.prototype, t5) ?? { get() {
161
+ return this[s4];
162
+ }, set(t6) {
163
+ this[s4] = t6;
164
+ } };
165
+ return { get() {
166
+ return e7?.call(this);
167
+ }, set(s5) {
168
+ const r7 = e7?.call(this);
169
+ h3.call(this, s5), this.requestUpdate(t5, r7, i6);
170
+ }, configurable: true, enumerable: true };
171
+ }
172
+ static getPropertyOptions(t5) {
173
+ return this.elementProperties.get(t5) ?? y;
174
+ }
175
+ static _$Ei() {
176
+ if (this.hasOwnProperty(d("elementProperties")))
177
+ return;
178
+ const t5 = n2(this);
179
+ t5.finalize(), void 0 !== t5.l && (this.l = [...t5.l]), this.elementProperties = new Map(t5.elementProperties);
180
+ }
181
+ static finalize() {
182
+ if (this.hasOwnProperty(d("finalized")))
183
+ return;
184
+ if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
185
+ const t6 = this.properties, s4 = [...h(t6), ...o2(t6)];
186
+ for (const i6 of s4)
187
+ this.createProperty(i6, t6[i6]);
188
+ }
189
+ const t5 = this[Symbol.metadata];
190
+ if (null !== t5) {
191
+ const s4 = litPropertyMetadata.get(t5);
192
+ if (void 0 !== s4)
193
+ for (const [t6, i6] of s4)
194
+ this.elementProperties.set(t6, i6);
195
+ }
196
+ this._$Eh = /* @__PURE__ */ new Map();
197
+ for (const [t6, s4] of this.elementProperties) {
198
+ const i6 = this._$Eu(t6, s4);
199
+ void 0 !== i6 && this._$Eh.set(i6, t6);
200
+ }
201
+ this.elementStyles = this.finalizeStyles(this.styles);
202
+ }
203
+ static finalizeStyles(s4) {
204
+ const i6 = [];
205
+ if (Array.isArray(s4)) {
206
+ const e7 = new Set(s4.flat(1 / 0).reverse());
207
+ for (const s5 of e7)
208
+ i6.unshift(c(s5));
209
+ } else
210
+ void 0 !== s4 && i6.push(c(s4));
211
+ return i6;
212
+ }
213
+ static _$Eu(t5, s4) {
214
+ const i6 = s4.attribute;
215
+ return false === i6 ? void 0 : "string" == typeof i6 ? i6 : "string" == typeof t5 ? t5.toLowerCase() : void 0;
216
+ }
217
+ constructor() {
218
+ super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
219
+ }
220
+ _$Ev() {
221
+ this._$ES = new Promise((t5) => this.enableUpdating = t5), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((t5) => t5(this));
222
+ }
223
+ addController(t5) {
224
+ (this._$EO ??= /* @__PURE__ */ new Set()).add(t5), void 0 !== this.renderRoot && this.isConnected && t5.hostConnected?.();
225
+ }
226
+ removeController(t5) {
227
+ this._$EO?.delete(t5);
228
+ }
229
+ _$E_() {
230
+ const t5 = /* @__PURE__ */ new Map(), s4 = this.constructor.elementProperties;
231
+ for (const i6 of s4.keys())
232
+ this.hasOwnProperty(i6) && (t5.set(i6, this[i6]), delete this[i6]);
233
+ t5.size > 0 && (this._$Ep = t5);
234
+ }
235
+ createRenderRoot() {
236
+ const t5 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
237
+ return S(t5, this.constructor.elementStyles), t5;
238
+ }
239
+ connectedCallback() {
240
+ this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach((t5) => t5.hostConnected?.());
241
+ }
242
+ enableUpdating(t5) {
243
+ }
244
+ disconnectedCallback() {
245
+ this._$EO?.forEach((t5) => t5.hostDisconnected?.());
246
+ }
247
+ attributeChangedCallback(t5, s4, i6) {
248
+ this._$AK(t5, i6);
249
+ }
250
+ _$EC(t5, s4) {
251
+ const i6 = this.constructor.elementProperties.get(t5), e7 = this.constructor._$Eu(t5, i6);
252
+ if (void 0 !== e7 && true === i6.reflect) {
253
+ const r7 = (void 0 !== i6.converter?.toAttribute ? i6.converter : u).toAttribute(s4, i6.type);
254
+ this._$Em = t5, null == r7 ? this.removeAttribute(e7) : this.setAttribute(e7, r7), this._$Em = null;
255
+ }
256
+ }
257
+ _$AK(t5, s4) {
258
+ const i6 = this.constructor, e7 = i6._$Eh.get(t5);
259
+ if (void 0 !== e7 && this._$Em !== e7) {
260
+ const t6 = i6.getPropertyOptions(e7), r7 = "function" == typeof t6.converter ? { fromAttribute: t6.converter } : void 0 !== t6.converter?.fromAttribute ? t6.converter : u;
261
+ this._$Em = e7, this[e7] = r7.fromAttribute(s4, t6.type), this._$Em = null;
262
+ }
263
+ }
264
+ requestUpdate(t5, s4, i6) {
265
+ if (void 0 !== t5) {
266
+ if (i6 ??= this.constructor.getPropertyOptions(t5), !(i6.hasChanged ?? f)(this[t5], s4))
267
+ return;
268
+ this.P(t5, s4, i6);
269
+ }
270
+ false === this.isUpdatePending && (this._$ES = this._$ET());
271
+ }
272
+ P(t5, s4, i6) {
273
+ this._$AL.has(t5) || this._$AL.set(t5, s4), true === i6.reflect && this._$Em !== t5 && (this._$Ej ??= /* @__PURE__ */ new Set()).add(t5);
274
+ }
275
+ async _$ET() {
276
+ this.isUpdatePending = true;
277
+ try {
278
+ await this._$ES;
279
+ } catch (t6) {
280
+ Promise.reject(t6);
281
+ }
282
+ const t5 = this.scheduleUpdate();
283
+ return null != t5 && await t5, !this.isUpdatePending;
284
+ }
285
+ scheduleUpdate() {
286
+ return this.performUpdate();
287
+ }
288
+ performUpdate() {
289
+ if (!this.isUpdatePending)
290
+ return;
291
+ if (!this.hasUpdated) {
292
+ if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
293
+ for (const [t7, s5] of this._$Ep)
294
+ this[t7] = s5;
295
+ this._$Ep = void 0;
296
+ }
297
+ const t6 = this.constructor.elementProperties;
298
+ if (t6.size > 0)
299
+ for (const [s5, i6] of t6)
300
+ true !== i6.wrapped || this._$AL.has(s5) || void 0 === this[s5] || this.P(s5, this[s5], i6);
301
+ }
302
+ let t5 = false;
303
+ const s4 = this._$AL;
304
+ try {
305
+ t5 = this.shouldUpdate(s4), t5 ? (this.willUpdate(s4), this._$EO?.forEach((t6) => t6.hostUpdate?.()), this.update(s4)) : this._$EU();
306
+ } catch (s5) {
307
+ throw t5 = false, this._$EU(), s5;
308
+ }
309
+ t5 && this._$AE(s4);
310
+ }
311
+ willUpdate(t5) {
312
+ }
313
+ _$AE(t5) {
314
+ this._$EO?.forEach((t6) => t6.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t5)), this.updated(t5);
315
+ }
316
+ _$EU() {
317
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
318
+ }
319
+ get updateComplete() {
320
+ return this.getUpdateComplete();
321
+ }
322
+ getUpdateComplete() {
323
+ return this._$ES;
324
+ }
325
+ shouldUpdate(t5) {
326
+ return true;
327
+ }
328
+ update(t5) {
329
+ this._$Ej &&= this._$Ej.forEach((t6) => this._$EC(t6, this[t6])), this._$EU();
330
+ }
331
+ updated(t5) {
332
+ }
333
+ firstUpdated(t5) {
334
+ }
335
+ };
336
+ b.elementStyles = [], b.shadowRootOptions = { mode: "open" }, b[d("elementProperties")] = /* @__PURE__ */ new Map(), b[d("finalized")] = /* @__PURE__ */ new Map(), p?.({ ReactiveElement: b }), (a.reactiveElementVersions ??= []).push("2.0.4");
337
+
338
+ // node_modules/@lit/reactive-element/decorators/property.js
339
+ var o3 = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
340
+ var r3 = (t5 = o3, e7, r7) => {
341
+ const { kind: n6, metadata: i6 } = r7;
342
+ let s4 = globalThis.litPropertyMetadata.get(i6);
343
+ if (void 0 === s4 && globalThis.litPropertyMetadata.set(i6, s4 = /* @__PURE__ */ new Map()), s4.set(r7.name, t5), "accessor" === n6) {
344
+ const { name: o6 } = r7;
345
+ return { set(r8) {
346
+ const n7 = e7.get.call(this);
347
+ e7.set.call(this, r8), this.requestUpdate(o6, n7, t5);
348
+ }, init(e8) {
349
+ return void 0 !== e8 && this.P(o6, void 0, t5), e8;
350
+ } };
351
+ }
352
+ if ("setter" === n6) {
353
+ const { name: o6 } = r7;
354
+ return function(r8) {
355
+ const n7 = this[o6];
356
+ e7.call(this, r8), this.requestUpdate(o6, n7, t5);
357
+ };
358
+ }
359
+ throw Error("Unsupported decorator location: " + n6);
360
+ };
361
+ function n3(t5) {
362
+ return (e7, o6) => "object" == typeof o6 ? r3(t5, e7, o6) : ((t6, e8, o7) => {
363
+ const r7 = e8.hasOwnProperty(o7);
364
+ return e8.constructor.createProperty(o7, r7 ? { ...t6, wrapped: true } : t6), r7 ? Object.getOwnPropertyDescriptor(e8, o7) : void 0;
365
+ })(t5, e7, o6);
366
+ }
367
+
368
+ // node_modules/@lit/reactive-element/decorators/state.js
369
+ function r4(r7) {
370
+ return n3({ ...r7, state: true, attribute: false });
371
+ }
372
+
373
+ // node_modules/@lit/reactive-element/decorators/base.js
374
+ var e3 = (e7, t5, c4) => (c4.configurable = true, c4.enumerable = true, Reflect.decorate && "object" != typeof t5 && Object.defineProperty(e7, t5, c4), c4);
375
+
376
+ // node_modules/@lit/reactive-element/decorators/query.js
377
+ function e4(e7, r7) {
378
+ return (n6, s4, i6) => {
379
+ const o6 = (t5) => t5.renderRoot?.querySelector(e7) ?? null;
380
+ if (r7) {
381
+ const { get: e8, set: r8 } = "object" == typeof s4 ? n6 : i6 ?? (() => {
382
+ const t5 = Symbol();
383
+ return { get() {
384
+ return this[t5];
385
+ }, set(e9) {
386
+ this[t5] = e9;
387
+ } };
388
+ })();
389
+ return e3(n6, s4, { get() {
390
+ let t5 = e8.call(this);
391
+ return void 0 === t5 && (t5 = o6(this), (null !== t5 || this.hasUpdated) && r8.call(this, t5)), t5;
392
+ } });
393
+ }
394
+ return e3(n6, s4, { get() {
395
+ return o6(this);
396
+ } });
397
+ };
398
+ }
399
+
400
+ // libs/embed-libs/shared-embed/src/lib/helpers/error.ts
401
+ var _handleError = (errorMessage, parameters) => {
402
+ let message = "The dashboard component encountered an error";
403
+ if (typeof parameters?.dashboardId === "string") {
404
+ message += ` for dashboard with id ${parameters.dashboardId}`;
405
+ }
406
+ if (typeof parameters?.dashboardSlug === "string") {
407
+ message += ` for dashboard with slug ${parameters.dashboardSlug}`;
408
+ }
409
+ if (typeof parameters?.container === "string") {
410
+ message += ` in container ${parameters.container}`;
411
+ }
412
+ if (errorMessage) {
413
+ message += `:
414
+ ${errorMessage}`;
415
+ console.error(message);
416
+ }
417
+ };
418
+
419
+ // libs/embed-libs/shared-embed/src/lib/helpers/browser-check.ts
420
+ var _browserCheck = (dashboardComponent) => {
421
+ let hasError = false;
422
+ let errorMessage = "";
423
+ const document_ = document.body || document.documentElement;
424
+ const style = document_.style;
425
+ const browserCheck = {
426
+ svg: !!("createElementNS" in document && document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGRect),
427
+ flexbox: style.webkitFlexWrap === "" || style.flexWrap === "",
428
+ postMessage: !!window.postMessage
429
+ };
430
+ const browserCheckKeys = ["svg", "flexbox", "postMessage"];
431
+ for (const key of browserCheckKeys) {
432
+ if (!browserCheck[key]) {
433
+ hasError = true;
434
+ dashboardComponent.browserNotSupported = dashboardComponent.browserNotSupported || [];
435
+ dashboardComponent.browserNotSupported.push(key);
436
+ errorMessage += `Your browser does not support: ${key}
437
+ `;
438
+ }
439
+ }
440
+ const ua = window.navigator.userAgent;
441
+ const msie = ua.includes("MSIE");
442
+ const trident = ua.includes("Trident/");
443
+ if (msie || trident) {
444
+ hasError = true;
445
+ errorMessage = "IE is not supported.";
446
+ }
447
+ if (hasError) {
448
+ _handleError(errorMessage);
449
+ }
450
+ };
451
+
452
+ // libs/embed-libs/shared-embed/src/lib/helpers/default-parameters.ts
453
+ var DEFAULT_PARAMETERS = {
454
+ appServer: "https://app.luzmo.com/",
455
+ apiHost: "https://api.luzmo.com/",
456
+ dashboardId: null,
457
+ dashboardSlug: null,
458
+ container: null,
459
+ key: null,
460
+ token: null,
461
+ language: "auto",
462
+ qeVersion: null,
463
+ editMode: null,
464
+ screenMode: null,
465
+ switchScreenModeOnResize: true,
466
+ itemId: null,
467
+ mainColor: "",
468
+ accentColor: "",
469
+ itemDimensions: {
470
+ width: "auto",
471
+ height: "auto"
472
+ },
473
+ loaderBackground: "#f9f9f9",
474
+ loaderFontColor: "#5a5a5a",
475
+ loaderSpinnerColor: "rgba(255, 165, 0, 0.7)",
476
+ loaderSpinnerBackground: "rgba(169, 169, 169, 0.14)",
477
+ timezoneId: null,
478
+ contextId: null
479
+ };
480
+
481
+ // libs/embed-libs/shared-embed/src/lib/helpers/extents.ts
482
+ var EXTENTS = [
483
+ { mode: "mobile", width: [150, 767] },
484
+ { mode: "tablet", width: [768, 1199] },
485
+ { mode: "desktop", width: [1200, 1599] },
486
+ { mode: "largeScreen", width: [1600, 9999] },
487
+ { mode: "fixed", width: [] }
488
+ ];
489
+
490
+ // libs/embed-libs/shared-embed/src/lib/helpers/translations.ts
491
+ var TRANSLATIONS = {
492
+ initializing: { en: "Initializing...", nl: "Laden...", fr: "Chargement..." },
493
+ errorDashboard: {
494
+ en: "Oops, we could not load this dashboard!",
495
+ nl: "Oeps, we konden het dashboard niet laden.",
496
+ fr: "Le chargement a echou\xE9."
497
+ },
498
+ errorItem: {
499
+ en: "Oops, we could not load this item!",
500
+ nl: "Oeps, we konden de grafiek niet laden.",
501
+ fr: "Le chargement a echou\xE9."
502
+ }
503
+ };
504
+ var translations_default = TRANSLATIONS;
505
+
506
+ // libs/embed-libs/shared-embed/src/lib/helpers/utils.ts
507
+ var addTrailingSlash = (serverUrl) => {
508
+ if (!serverUrl) {
509
+ return "";
510
+ }
511
+ return serverUrl.endsWith("/") ? serverUrl : `${serverUrl}/`;
512
+ };
513
+ var removeTrailingSlash = (serverUrl) => {
514
+ if (!serverUrl) {
515
+ return "";
516
+ }
517
+ return serverUrl.endsWith("/") ? serverUrl.slice(0, -1) : serverUrl;
518
+ };
519
+ var formatDashboardList = (dashboards, integrationId, user, dashboardComponent) => {
520
+ const combineRights = (securable, user2) => {
521
+ const matchingUser = securable.users.find((u3) => u3.id === user2.id);
522
+ const securableAccessRights = matchingUser && matchingUser.userAccessRight ? {
523
+ flagRead: matchingUser.userAccessRight.flagRead,
524
+ flagUse: matchingUser.userAccessRight.flagUse,
525
+ flagModify: matchingUser.userAccessRight.flagModify,
526
+ flagOwn: matchingUser.userAccessRight.flagOwn
527
+ } : {
528
+ flagRead: false,
529
+ flagUse: false,
530
+ flagModify: false,
531
+ flagOwn: false
532
+ };
533
+ const groups = securable.groups.filter(
534
+ (group) => user2.userGroups.includes(group.id) || group.public === true
535
+ );
536
+ const groupsAccess = groups.map((group) => {
537
+ if (group.groupAccessRight) {
538
+ return group.groupAccessRight;
539
+ }
540
+ });
541
+ for (const groupAccess of groupsAccess) {
542
+ if (!securableAccessRights.flagRead && groupAccess.flagRead) {
543
+ securableAccessRights.flagRead = groupAccess.flagRead;
544
+ }
545
+ if (!securableAccessRights.flagUse && groupAccess.flagUse) {
546
+ securableAccessRights.flagUse = groupAccess.flagUse;
547
+ }
548
+ if (!securableAccessRights.flagModify && groupAccess.flagModify) {
549
+ securableAccessRights.flagModify = groupAccess.flagModify;
550
+ }
551
+ if (!securableAccessRights.flagOwn && groupAccess.flagOwn) {
552
+ securableAccessRights.flagOwn = groupAccess.flagOwn;
553
+ }
554
+ }
555
+ const integrationsAccess = securable.integrations?.length > 0 ? securable.integrations.map((integration) => {
556
+ if (integration.integrationAccessRight) {
557
+ return integration.integrationAccessRight;
558
+ }
559
+ }) : [];
560
+ for (const integrationAccess of integrationsAccess) {
561
+ if (!securableAccessRights.flagRead && integrationAccess.flagRead) {
562
+ securableAccessRights.flagRead = integrationAccess.flagRead;
563
+ }
564
+ if (!securableAccessRights.flagUse && integrationAccess.flagUse) {
565
+ securableAccessRights.flagUse = integrationAccess.flagUse;
566
+ }
567
+ if (!securableAccessRights.flagModify && integrationAccess.flagModify) {
568
+ securableAccessRights.flagModify = integrationAccess.flagModify;
569
+ }
570
+ }
571
+ return securableAccessRights;
572
+ };
573
+ const localize = (item, locale) => {
574
+ if (item === null || item === void 0) {
575
+ return "";
576
+ }
577
+ if (typeof item !== "object" || Object.keys(item).length === 0) {
578
+ if (typeof item === "object" && Object.keys(item).length === 0) {
579
+ return "";
580
+ }
581
+ return item;
582
+ }
583
+ let localizedItem;
584
+ localizedItem = locale && item[locale] ? item[locale] : item[Object.keys(item)[0]];
585
+ if (localizedItem === void 0 || localizedItem === null) {
586
+ localizedItem = "";
587
+ }
588
+ return localizedItem;
589
+ };
590
+ const treatedDashboards = [];
591
+ for (const dashboard of dashboards) {
592
+ const treatedDashboard = {
593
+ accessibleBy: [],
594
+ accessRights: combineRights(dashboard, user),
595
+ id: dashboard.id,
596
+ modifiedAt: dashboard.modified_at,
597
+ name: localize(dashboard.name, dashboardComponent.language),
598
+ slug: null,
599
+ tags: dashboard.tags.map((t5) => t5.tag).sort((t1, t22) => t1.localeCompare(t22))
600
+ };
601
+ const currentIntegration = dashboard.integrations.find(
602
+ (i6) => i6.id === integrationId
603
+ );
604
+ if (currentIntegration?.integrationAccessRight?.slug) {
605
+ treatedDashboard.slug = currentIntegration.integrationAccessRight.slug;
606
+ }
607
+ const users = dashboard.users.map((u3) => ({
608
+ model: "User",
609
+ id: u3.id,
610
+ name: localize(u3.name, user.locale_id)
611
+ }));
612
+ const groups = dashboard.groups.map((g2) => ({
613
+ model: "Group",
614
+ id: g2.id,
615
+ name: localize(g2.name, user.locale_id) || {}
616
+ }));
617
+ const integrations = dashboard.integrations.map((i6) => ({
618
+ model: "Integration",
619
+ id: i6.id,
620
+ name: localize(i6.name, user.locale_id) || {}
621
+ }));
622
+ treatedDashboard.accessibleBy = [...users, ...groups, ...integrations];
623
+ treatedDashboards.push(treatedDashboard);
624
+ }
625
+ return treatedDashboards;
626
+ };
627
+ var VERSION = "0.0.0-shared-luzmo";
628
+ var sanitizeUrl = (url) => {
629
+ const invalidPrototcolRegex = /^(%20|\s)*(javascript|data)/im;
630
+ const ctrlCharactersRegex = /[^\u0020-\u007E]/gim;
631
+ const urlSchemeRegex = /^([^:]+):/gm;
632
+ const relativeFirstCharacters = /* @__PURE__ */ new Set([".", "/"]);
633
+ const isRelativeUrlWithoutProtocol = (relativeUrl) => relativeFirstCharacters.has(relativeUrl[0]);
634
+ if (!url) {
635
+ return "about:blank";
636
+ }
637
+ const sanitizedUrl = url.replaceAll(ctrlCharactersRegex, "").trim();
638
+ if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {
639
+ return sanitizedUrl;
640
+ }
641
+ const urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);
642
+ if (!urlSchemeParseResults) {
643
+ return sanitizedUrl;
644
+ }
645
+ const urlScheme = urlSchemeParseResults[0];
646
+ if (invalidPrototcolRegex.test(urlScheme)) {
647
+ return "about:blank";
648
+ }
649
+ return sanitizedUrl;
650
+ };
651
+ var cloneDeep = (obj) => JSON.parse(JSON.stringify(obj));
652
+ var isObject = (o6) => o6 && typeof o6 === "object";
653
+ var defaultsDeep = (target, defaults) => {
654
+ Object.entries(defaults).forEach(([k2, v2]) => {
655
+ if (k2 in target) {
656
+ if (target[k2] === void 0) {
657
+ target[k2] = v2;
658
+ } else {
659
+ target[k2] = isObject(v2) ? defaultsDeep(
660
+ target[k2],
661
+ v2
662
+ ) : target[k2];
663
+ }
664
+ } else {
665
+ target[k2] = v2;
666
+ }
667
+ });
668
+ return target;
669
+ };
670
+ var uuidv4 = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g, function(c4) {
671
+ const r7 = Math.random() * 16 | 0;
672
+ const v2 = c4 == "x" ? r7 : r7 & 3 | 8;
673
+ return v2.toString(16);
674
+ });
675
+
676
+ // libs/embed-libs/shared-embed/src/lib/helpers/iframe-url.ts
677
+ var createIframeUrl = (dashboardContent) => {
678
+ const searchString = [];
679
+ const {
680
+ appServer,
681
+ language,
682
+ qeVersion,
683
+ loaderBackground,
684
+ loaderSpinnerColor,
685
+ loaderSpinnerBackground,
686
+ loaderFontColor,
687
+ screenMode,
688
+ key,
689
+ token,
690
+ timezoneId,
691
+ itemEmbedding,
692
+ itemDimensions,
693
+ dashboardId,
694
+ dashboardSlug,
695
+ itemId,
696
+ mainColor,
697
+ accentColor,
698
+ editMode
699
+ } = dashboardContent.params;
700
+ if (language && language !== "auto") {
701
+ searchString.push("language=" + language);
702
+ }
703
+ if (qeVersion) {
704
+ searchString.push(`qe_version=${qeVersion}`);
705
+ }
706
+ if (loaderBackground) {
707
+ searchString.push(`ldrbg=${loaderBackground}`);
708
+ }
709
+ if (loaderFontColor) {
710
+ searchString.push(`ldrftclr=${loaderFontColor}`);
711
+ }
712
+ if (loaderSpinnerColor) {
713
+ searchString.push(`ldrspclr=${loaderSpinnerColor}`);
714
+ }
715
+ if (loaderSpinnerBackground) {
716
+ searchString.push(`ldrspbg=${loaderSpinnerBackground}`);
717
+ }
718
+ if (mainColor) {
719
+ searchString.push(`mainColor=${mainColor}`);
720
+ }
721
+ if (accentColor) {
722
+ searchString.push(`accentColor=${accentColor}`);
723
+ }
724
+ if (screenMode && screenMode !== "auto") {
725
+ searchString.push("screenMode=" + screenMode);
726
+ }
727
+ if (timezoneId) {
728
+ searchString.push("timezoneId=" + timezoneId);
729
+ }
730
+ if (itemEmbedding && itemDimensions && itemDimensions.width) {
731
+ searchString.push("width=" + itemDimensions.width);
732
+ }
733
+ if (itemEmbedding && itemDimensions && itemDimensions.height) {
734
+ searchString.push("height=" + itemDimensions.height);
735
+ }
736
+ if (editMode) {
737
+ searchString.push("editMode=" + editMode);
738
+ }
739
+ const keyTokenUrlAnchor = key && token ? "#" + key + ":" + token : "";
740
+ searchString.push("version=" + (dashboardContent.VERSION || VERSION));
741
+ const iframeUrl = itemEmbedding ? `${appServer}i/${dashboardId || dashboardSlug}/${itemId}?${encodeURIComponent(
742
+ searchString.join("&")
743
+ )}${keyTokenUrlAnchor}` : `${appServer}i/${dashboardId || dashboardSlug}?${encodeURIComponent(
744
+ searchString.join("&")
745
+ )}${keyTokenUrlAnchor}`;
746
+ return sanitizeUrl(iframeUrl);
747
+ };
748
+
749
+ // libs/embed-libs/shared-embed/src/lib/helpers/get-loader.ts
750
+ var getLoader = (dashboardComponent) => {
751
+ let errorMsg;
752
+ if (dashboardComponent.params.error || dashboardComponent.browserNotSupported.length > 0) {
753
+ dashboardComponent.params.error = true;
754
+ if (dashboardComponent.browserNotSupported) {
755
+ errorMsg = "Browser is not supported.";
756
+ }
757
+ }
758
+ const loadingMsg = translations_default.initializing[dashboardComponent.params.language] || translations_default.initializing.en;
759
+ return dashboardComponent.browserNotSupported || dashboardComponent.params.error ? { loadingMsg, errorMsg } : { loadingMsg, errorMsg: "" };
760
+ };
761
+
762
+ // libs/embed-libs/shared-embed/src/lib/helpers/promise-dispatch.ts
763
+ function resolvePromise(dashboardComponent, requestId, data) {
764
+ if (dashboardComponent.promises[requestId]) {
765
+ dashboardComponent.promises[requestId].resolve(data);
766
+ delete dashboardComponent.promises[requestId];
767
+ }
768
+ }
769
+ function rejectPromise(dashboardComponent, requestId, data) {
770
+ if (dashboardComponent.promises[requestId]) {
771
+ dashboardComponent.promises[requestId].reject(data);
772
+ delete dashboardComponent.promises[requestId];
773
+ }
774
+ }
775
+
776
+ // libs/embed-libs/shared-embed/src/lib/helpers/styles.ts
777
+ function containerStyles(dashboardComponent) {
778
+ const styles = {};
779
+ if (dashboardComponent.params.loaderBackground && !dashboardComponent.iframeLoaded) {
780
+ styles.background = dashboardComponent.params.loaderBackground;
781
+ }
782
+ return styles;
783
+ }
784
+ function containerLoaderStyles(dashboardComponent) {
785
+ const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
786
+ const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
787
+ const display = dashboardComponent.iframeLoaded ? "none" : "";
788
+ return {
789
+ display,
790
+ height: `${chartHeightDefined ? height : dashboardComponent.minHeight}px`
791
+ };
792
+ }
793
+ function loaderStyles(dashboardComponent) {
794
+ const background = dashboardComponent.params.loaderBackground || DEFAULT_PARAMETERS.loaderBackground;
795
+ if (dashboardComponent.params.itemEmbedding) {
796
+ dashboardComponent.loaderSize = 24;
797
+ dashboardComponent.borderWidth = 4;
798
+ dashboardComponent.minHeight = 200;
799
+ const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
800
+ const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
801
+ const chartWidthDefined = width !== "auto";
802
+ const chartHeightDefined = height !== "auto";
803
+ return {
804
+ background,
805
+ width: chartWidthDefined ? `${width}px` : "100%",
806
+ height: `${chartHeightDefined ? height : "200"}px`,
807
+ "min-height": chartHeightDefined ? "" : "200px"
808
+ };
809
+ }
810
+ return {
811
+ background
812
+ };
813
+ }
814
+ function plStyles(dashboardComponent) {
815
+ const {
816
+ loaderSpinnerColor: defaultSpinnerColor,
817
+ loaderSpinnerBackground: defaultSpinnerBackground
818
+ } = DEFAULT_PARAMETERS;
819
+ const spinnerColorBorder = generateBorderStyle(
820
+ dashboardComponent.borderWidth,
821
+ dashboardComponent.params.loaderSpinnerColor || defaultSpinnerColor
822
+ );
823
+ const spinnerBackgroundBorder = generateBorderStyle(
824
+ dashboardComponent.borderWidth,
825
+ dashboardComponent.params.loaderSpinnerBackground || defaultSpinnerBackground
826
+ );
827
+ const size = `${dashboardComponent.loaderSize}px`;
828
+ return {
829
+ "border-top": spinnerColorBorder,
830
+ "border-right": spinnerColorBorder,
831
+ "border-bottom": spinnerBackgroundBorder,
832
+ "border-left": spinnerBackgroundBorder,
833
+ width: size,
834
+ height: size
835
+ };
836
+ }
837
+ function lcStyles(dashboardComponent) {
838
+ const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
839
+ const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
840
+ const getPaddingStr = (value) => `${(value - dashboardComponent.loaderSize - 32) / 2}px`;
841
+ const verticalPadding = dashboardComponent.params.itemId ? chartHeightDefined ? getPaddingStr(Number.parseInt(`${height}`, 10)) : getPaddingStr(dashboardComponent.minHeight) : "128px";
842
+ return {
843
+ padding: `${verticalPadding} 16px`
844
+ };
845
+ }
846
+ function calculateIframeStyles(dashboardComponent) {
847
+ const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
848
+ const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
849
+ if (dashboardComponent.params.itemEmbedding && height !== "auto") {
850
+ dashboardComponent.iframeHeight = `${height}px`;
851
+ } else if (dashboardComponent.params.itemEmbedding) {
852
+ dashboardComponent.iframeHeight = "200px";
853
+ } else if (["editFull", "editLimited"].includes(dashboardComponent.params.editMode)) {
854
+ dashboardComponent.iframeHeight = "100%";
855
+ } else {
856
+ dashboardComponent.iframeHeight = "400px";
857
+ }
858
+ dashboardComponent.iframeWidth = dashboardComponent.params.itemEmbedding && width !== "auto" ? `${width}px` : "100%";
859
+ const styles = {
860
+ height: dashboardComponent.iframeHeight,
861
+ width: dashboardComponent.iframeWidth
862
+ };
863
+ if (dashboardComponent.iframeLoaded) {
864
+ styles.opacity = 1;
865
+ } else if (dashboardComponent.error) {
866
+ styles.opacity = 1;
867
+ styles.width = "100%";
868
+ styles.height = "400px";
869
+ } else {
870
+ styles.opacity = 0;
871
+ }
872
+ return styles;
873
+ }
874
+ function generateBorderStyle(borderWidth, color) {
875
+ return `${borderWidth}px solid ${color}`;
876
+ }
877
+
878
+ // libs/embed-libs/shared-embed/src/lib/helpers/update-iframe-url.ts
879
+ var updateIframeUrl = (iframe, iframeUrl) => {
880
+ if (iframe?.contentWindow) {
881
+ iframe.contentWindow.location.replace(iframeUrl);
882
+ }
883
+ };
884
+
885
+ // libs/embed-libs/shared-embed/src/lib/methods/export-dashboard.ts
886
+ var exportDashboard = (dashboardComponent, iframe, format) => {
887
+ const requestId = uuidv4();
888
+ if (iframe?.contentWindow) {
889
+ iframe.contentWindow.postMessage(
890
+ {
891
+ action: "exportDashboard",
892
+ format: format || "png",
893
+ _version: dashboardComponent.VERSION,
894
+ requestId
895
+ },
896
+ "*"
897
+ );
898
+ return new Promise((resolve, reject) => {
899
+ dashboardComponent.promises[requestId] = { resolve, reject };
900
+ setTimeout(() => {
901
+ if (dashboardComponent.promises[requestId]) {
902
+ const errorMessage = "exportDashboard request timed out.";
903
+ dashboardComponent.promises[requestId].reject(
904
+ new Error(errorMessage)
905
+ );
906
+ delete dashboardComponent.promises[requestId];
907
+ }
908
+ }, 12e5);
909
+ });
910
+ }
911
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
912
+ };
913
+
914
+ // libs/embed-libs/shared-embed/src/lib/methods/get-accessible-dashboards.ts
915
+ var getAccessibleDashboards = (dashboardComponent) => {
916
+ if ((dashboardComponent.currentAuthKey ?? dashboardComponent.authKey) && (dashboardComponent.currentAuthToken ?? dashboardComponent.authToken)) {
917
+ const fetchUser = new Promise((resolve, reject) => {
918
+ void (() => {
919
+ try {
920
+ const responsePromise = window.fetch(
921
+ `${String(dashboardComponent.params.apiHost)}0.1.0/authorization`,
922
+ {
923
+ method: "POST",
924
+ mode: "cors",
925
+ cache: "no-cache",
926
+ headers: { "Content-Type": "application/json" },
927
+ redirect: "follow",
928
+ body: JSON.stringify({
929
+ action: "get",
930
+ version: "0.1.0",
931
+ key: dashboardComponent.currentAuthKey ?? dashboardComponent.authKey,
932
+ token: dashboardComponent.currentAuthToken ?? dashboardComponent.authToken,
933
+ find: {
934
+ where: { id: dashboardComponent.authKey },
935
+ attributes: ["id", "integration_id"],
936
+ include: [
937
+ {
938
+ model: "User",
939
+ attributes: ["id", "name", "locale_id"],
940
+ include: [{ model: "Group" }]
941
+ }
942
+ ]
943
+ }
944
+ })
945
+ }
946
+ );
947
+ responsePromise.then((response) => response.json()).then((data) => {
948
+ if (!data || !data.rows || data.rows.length === 0 || !data.rows[0].user) {
949
+ reject("Authorization failed, please check authKey and authToken. If the problem persists, please contact support@luzmo.com.");
950
+ } else {
951
+ data.rows[0].user.userGroups = data.rows[0].user.groups.map(
952
+ (group) => group.id
953
+ );
954
+ delete data.rows[0].user.groups;
955
+ resolve({
956
+ integrationId: data.rows[0].integration_id,
957
+ user: data.rows[0].user
958
+ });
959
+ }
960
+ });
961
+ } catch (error) {
962
+ reject(error);
963
+ }
964
+ })();
965
+ });
966
+ return new Promise((resolve, reject) => void (() => {
967
+ try {
968
+ fetchUser.then((authorizationData) => {
969
+ const responsePromise = window.fetch(
970
+ `${String(dashboardComponent.params.apiHost)}0.1.0/securable`,
971
+ {
972
+ method: "POST",
973
+ mode: "cors",
974
+ cache: "no-cache",
975
+ headers: { "Content-Type": "application/json" },
976
+ redirect: "follow",
977
+ body: JSON.stringify({
978
+ action: "get",
979
+ version: "0.1.0",
980
+ key: dashboardComponent.currentAuthKey ?? dashboardComponent.authKey,
981
+ token: dashboardComponent.currentAuthToken ?? dashboardComponent.authToken,
982
+ find: {
983
+ where: { type: "dashboard", is_variant: false },
984
+ attributes: ["id", "name", "modified_at"],
985
+ order: [["modified_at", "desc"]],
986
+ include: [
987
+ { model: "Tag", attributes: ["tag"] },
988
+ { model: "User", attributes: ["id", "name"] },
989
+ {
990
+ model: "Group",
991
+ attributes: ["id", "name", "public"]
992
+ },
993
+ { model: "Integration", attributes: ["id", "name"] }
994
+ ]
995
+ }
996
+ })
997
+ }
998
+ );
999
+ responsePromise.then((response) => response.json()).then((data) => {
1000
+ const dashboardList = data.rows.length > 0 ? formatDashboardList(
1001
+ data.rows,
1002
+ authorizationData.integrationId,
1003
+ authorizationData.user,
1004
+ dashboardComponent
1005
+ ) : [];
1006
+ resolve(dashboardList);
1007
+ });
1008
+ }).catch((error) => {
1009
+ reject(error);
1010
+ });
1011
+ } catch (error) {
1012
+ reject(error);
1013
+ }
1014
+ })());
1015
+ }
1016
+ throw new Error("No authKey or authToken found in the luzmo-dashboard component.");
1017
+ };
1018
+
1019
+ // libs/embed-libs/shared-embed/src/lib/methods/get-data.ts
1020
+ var getData = (dashboardComponent, iframe, itemId) => {
1021
+ if (iframe?.contentWindow) {
1022
+ const requestId = uuidv4();
1023
+ iframe.contentWindow.postMessage(
1024
+ {
1025
+ action: "getData",
1026
+ id: itemId,
1027
+ _version: dashboardComponent.VERSION,
1028
+ requestId
1029
+ },
1030
+ "*"
1031
+ );
1032
+ return new Promise((resolve, reject) => {
1033
+ dashboardComponent.promises[requestId] = { resolve, reject };
1034
+ setTimeout(() => {
1035
+ if (dashboardComponent.promises[requestId]) {
1036
+ const errorMessage = "getData request timed out.";
1037
+ dashboardComponent.promises[requestId].reject(
1038
+ new Error(errorMessage)
1039
+ );
1040
+ delete dashboardComponent.promises[requestId];
1041
+ }
1042
+ }, 2e3);
1043
+ });
1044
+ }
1045
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1046
+ };
1047
+
1048
+ // libs/embed-libs/shared-embed/src/lib/methods/get-filters.ts
1049
+ var getFilters = (dashboardComponent, iframe) => {
1050
+ if (iframe?.contentWindow) {
1051
+ const requestId = uuidv4();
1052
+ iframe.contentWindow.postMessage(
1053
+ { action: "getFilters", _version: dashboardComponent.VERSION, requestId },
1054
+ "*"
1055
+ );
1056
+ return new Promise((resolve, reject) => {
1057
+ dashboardComponent.promises[requestId] = { resolve, reject };
1058
+ setTimeout(() => {
1059
+ if (dashboardComponent.promises[requestId]) {
1060
+ const errorMessage = "getFilters request timed out.";
1061
+ dashboardComponent.promises[requestId].reject(
1062
+ new Error(errorMessage)
1063
+ );
1064
+ delete dashboardComponent.promises[requestId];
1065
+ }
1066
+ }, 2e3);
1067
+ });
1068
+ }
1069
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1070
+ };
1071
+
1072
+ // libs/embed-libs/shared-embed/src/lib/methods/refresh-data.ts
1073
+ var refreshData = (dashboardComponent, iframe, itemId) => {
1074
+ if (iframe) {
1075
+ iframe.contentWindow.postMessage(
1076
+ {
1077
+ action: "refreshData",
1078
+ id: itemId ?? null,
1079
+ _version: dashboardComponent.VERSION
1080
+ },
1081
+ "*"
1082
+ );
1083
+ return Promise.resolve();
1084
+ }
1085
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1086
+ };
1087
+
1088
+ // libs/embed-libs/shared-embed/src/lib/methods/reload-dashboard.ts
1089
+ var reloadDashboard = (dashboardComponent, iframe) => {
1090
+ if (iframe) {
1091
+ iframe.contentWindow.postMessage(
1092
+ { action: "reloadDashboard", _version: dashboardComponent.VERSION },
1093
+ "*"
1094
+ );
1095
+ return Promise.resolve();
1096
+ }
1097
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1098
+ };
1099
+
1100
+ // libs/embed-libs/shared-embed/src/lib/methods/set-authorization.ts
1101
+ var setAuthorization = (dashboardComponent, iframe, key, token) => {
1102
+ if (iframe) {
1103
+ iframe.contentWindow.postMessage(
1104
+ {
1105
+ action: "setAuthorization",
1106
+ key,
1107
+ token,
1108
+ _version: dashboardComponent.VERSION
1109
+ },
1110
+ "*"
1111
+ );
1112
+ return Promise.resolve();
1113
+ }
1114
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1115
+ };
1116
+
1117
+ // libs/embed-libs/shared-embed/src/lib/methods/set-edit-mode.ts
1118
+ var setEditMode = (dashboardComponent, iframe, editMode) => {
1119
+ if (iframe && iframe.contentWindow) {
1120
+ const requestId = uuidv4();
1121
+ if (dashboardComponent.params.editMode === editMode) {
1122
+ return Promise.reject(
1123
+ new Error("editMode parameter is currently already set to " + editMode)
1124
+ );
1125
+ } else if (editMode !== "editFull" && editMode !== "editLimited" && editMode !== "view") {
1126
+ return Promise.reject(
1127
+ new Error(
1128
+ "The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'."
1129
+ )
1130
+ );
1131
+ }
1132
+ iframe.contentWindow.postMessage(
1133
+ {
1134
+ action: "setEditMode",
1135
+ editMode,
1136
+ _version: dashboardComponent.VERSION,
1137
+ requestId
1138
+ },
1139
+ "*"
1140
+ );
1141
+ return new Promise((resolve, reject) => {
1142
+ dashboardComponent.promises[requestId] = { resolve, reject };
1143
+ });
1144
+ }
1145
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1146
+ };
1147
+
1148
+ // libs/embed-libs/shared-embed/src/lib/methods/set-filters.ts
1149
+ var setFilters = (dashboardComponent, iframe, itemId, filters) => {
1150
+ if (iframe) {
1151
+ const requestId = uuidv4();
1152
+ iframe.contentWindow.postMessage(
1153
+ {
1154
+ action: "setFilters",
1155
+ itemId,
1156
+ filters,
1157
+ _version: dashboardComponent.VERSION,
1158
+ requestId
1159
+ },
1160
+ "*"
1161
+ );
1162
+ return new Promise((resolve, reject) => {
1163
+ dashboardComponent.promises[requestId] = { resolve, reject };
1164
+ setTimeout(() => {
1165
+ if (dashboardComponent.promises[requestId]) {
1166
+ const errorMessage = "setFilters request timed out.";
1167
+ dashboardComponent.promises[requestId].reject(
1168
+ new Error(errorMessage)
1169
+ );
1170
+ delete dashboardComponent.promises[requestId];
1171
+ }
1172
+ }, 2e3);
1173
+ });
1174
+ }
1175
+ return Promise.reject();
1176
+ };
1177
+
1178
+ // libs/embed-libs/shared-embed/src/lib/methods/set-preview.ts
1179
+ var setPreview = (dashboardComponent, iframe, preview) => {
1180
+ if (iframe) {
1181
+ const requestId = uuidv4();
1182
+ iframe.contentWindow.postMessage(
1183
+ {
1184
+ action: "setPreview",
1185
+ preview,
1186
+ requestId,
1187
+ _version: dashboardComponent.VERSION
1188
+ },
1189
+ "*"
1190
+ );
1191
+ return new Promise((resolve, reject) => {
1192
+ dashboardComponent.promises[requestId] = { resolve, reject };
1193
+ setTimeout(() => {
1194
+ if (dashboardComponent.promises[requestId]) {
1195
+ const errorMessage = "setPreview request timed out.";
1196
+ dashboardComponent.promises[requestId].reject(
1197
+ new Error(errorMessage)
1198
+ );
1199
+ delete dashboardComponent.promises[requestId];
1200
+ }
1201
+ }, 2e3);
1202
+ });
1203
+ }
1204
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
1205
+ };
1206
+
1207
+ // libs/embed-libs/shared-embed/src/lib/service/calculate-dimensions.ts
1208
+ var _setCalculatedDimensions = (dashboardComponent) => {
1209
+ if (!dashboardComponent.dimensions) {
1210
+ dashboardComponent.params.error = true;
1211
+ _handleError("Got no valid dimensions.", dashboardComponent.params);
1212
+ return;
1213
+ }
1214
+ const dashboardDimensionKeys = Object.keys(
1215
+ dashboardComponent.dimensions
1216
+ );
1217
+ const availableScreenModeExtents = [];
1218
+ let currentMode;
1219
+ let currentWidth = 0;
1220
+ let currentHeight = 0;
1221
+ if (!dashboardComponent.params.switchScreenModeOnResize && dashboardComponent.currentScreenMode) {
1222
+ dashboardComponent.params.screenMode = dashboardComponent.currentScreenMode;
1223
+ }
1224
+ if (dashboardComponent.dimensions && dashboardDimensionKeys?.[0] === "fixed") {
1225
+ currentMode = "fixed";
1226
+ currentWidth = dashboardComponent.dimensions.fixed[0];
1227
+ currentHeight = dashboardComponent.dimensions.fixed[1];
1228
+ } else {
1229
+ const screenModes = [
1230
+ "mobile",
1231
+ "tablet",
1232
+ "desktop",
1233
+ "largeScreen"
1234
+ ];
1235
+ if (dashboardComponent.params.itemEmbedding) {
1236
+ const [firstMatch] = dashboardDimensionKeys;
1237
+ let match = cloneDeep(firstMatch);
1238
+ for (const screenMode of screenModes) {
1239
+ const found = dashboardDimensionKeys.find((key) => key === screenMode);
1240
+ if (found) {
1241
+ match = cloneDeep(found);
1242
+ } else {
1243
+ dashboardComponent.dimensions[screenMode] = dashboardComponent.dimensions[match];
1244
+ }
1245
+ }
1246
+ }
1247
+ for (const key of dashboardDimensionKeys) {
1248
+ if (screenModes.includes(key)) {
1249
+ const screenMode = EXTENTS.find((extent) => extent.mode === key);
1250
+ availableScreenModeExtents.push({
1251
+ ...screenMode,
1252
+ height: dashboardComponent.dimensions[key][1] || 50
1253
+ });
1254
+ }
1255
+ }
1256
+ if (!availableScreenModeExtents.map((screenModeExtent) => screenModeExtent.mode).includes(dashboardComponent.params.screenMode)) {
1257
+ dashboardComponent.params.screenMode = "auto";
1258
+ }
1259
+ if (dashboardComponent.params.screenMode === "auto") {
1260
+ availableScreenModeExtents.sort(
1261
+ (a3, b3) => screenModes.indexOf(a3.mode) - screenModes.indexOf(b3.mode)
1262
+ );
1263
+ for (const screenModeExtent of availableScreenModeExtents) {
1264
+ const [screenModeExtentMinWidth, screenModeExtentMaxWidth] = screenModeExtent.width;
1265
+ if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
1266
+ if (screenModeExtentMinWidth < dashboardComponent.params.itemDimensions.width) {
1267
+ currentMode = screenModeExtent.mode;
1268
+ currentWidth = Number.parseInt(
1269
+ dashboardComponent.params.itemDimensions.width,
1270
+ 10
1271
+ );
1272
+ currentHeight = dashboardComponent.dimensions[currentMode][1];
1273
+ }
1274
+ } else {
1275
+ if (screenModeExtentMinWidth < dashboardComponent.containerWidth) {
1276
+ currentMode = screenModeExtent.mode;
1277
+ if (dashboardComponent.params.itemEmbedding) {
1278
+ currentWidth = dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto" ? Number.parseInt(
1279
+ dashboardComponent.params.itemDimensions.width,
1280
+ 10
1281
+ ) : Math.min(
1282
+ dashboardComponent.containerWidth,
1283
+ screenModeExtentMaxWidth
1284
+ );
1285
+ currentHeight = dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto" ? Number.parseInt(
1286
+ dashboardComponent.params.itemDimensions.height,
1287
+ 10
1288
+ ) : dashboardComponent.dimensions[currentMode][1];
1289
+ if (dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
1290
+ currentWidth = Number.parseInt(
1291
+ dashboardComponent.params.itemDimensions.width,
1292
+ 10
1293
+ );
1294
+ currentHeight = dashboardComponent.dimensions[currentMode][1];
1295
+ }
1296
+ } else {
1297
+ currentWidth = Math.max(
1298
+ Math.min(
1299
+ screenModeExtentMaxWidth,
1300
+ dashboardComponent.containerWidth
1301
+ ),
1302
+ screenModeExtentMinWidth
1303
+ );
1304
+ currentHeight = screenModeExtent.height;
1305
+ }
1306
+ }
1307
+ }
1308
+ }
1309
+ } else {
1310
+ const {
1311
+ height: chosenModeHeight,
1312
+ width: [chosenModeMinWidth, chosenModeMaxWidth]
1313
+ } = availableScreenModeExtents.find(
1314
+ (d3) => d3.mode === dashboardComponent.params.screenMode
1315
+ );
1316
+ currentMode = dashboardComponent.params.screenMode;
1317
+ currentWidth = Math.max(
1318
+ Math.min(chosenModeMaxWidth, dashboardComponent.containerWidth),
1319
+ chosenModeMinWidth
1320
+ );
1321
+ currentHeight = chosenModeHeight;
1322
+ if (dashboardComponent.params.itemEmbedding) {
1323
+ if (dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto") {
1324
+ currentWidth = Number.parseInt(
1325
+ dashboardComponent.params.itemDimensions.width,
1326
+ 10
1327
+ );
1328
+ }
1329
+ if (dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto") {
1330
+ currentHeight = Number.parseInt(
1331
+ dashboardComponent.params.itemDimensions.height,
1332
+ 10
1333
+ );
1334
+ }
1335
+ }
1336
+ }
1337
+ if (!currentMode && availableScreenModeExtents.length > 0) {
1338
+ const [lowestModeExtent] = availableScreenModeExtents;
1339
+ currentMode = lowestModeExtent.mode;
1340
+ currentWidth = lowestModeExtent.width[0];
1341
+ currentHeight = lowestModeExtent.height;
1342
+ }
1343
+ }
1344
+ dashboardComponent.currentScreenMode = currentMode;
1345
+ const style = {
1346
+ height: currentHeight === 0 ? "100%" : `${String(currentHeight)}px`,
1347
+ width: currentWidth === 0 ? "100%" : `${String(currentWidth)}px`,
1348
+ opacity: 1
1349
+ };
1350
+ const dashboardEditModes = ["editFull", "editLimited"];
1351
+ if (dashboardEditModes.includes(dashboardComponent.params.editMode)) {
1352
+ style.height = "100%";
1353
+ style.width = "100%";
1354
+ } else if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions) {
1355
+ style.height = dashboardComponent.params.itemDimensions.height === "auto" ? style.height : `${String(dashboardComponent.params.itemDimensions.height).replace(
1356
+ "px",
1357
+ ""
1358
+ )}px`;
1359
+ style.width = dashboardComponent.params.itemDimensions.width === "auto" ? style.width : `${String(dashboardComponent.params.itemDimensions.width).replace(
1360
+ "px",
1361
+ ""
1362
+ )}px`;
1363
+ } else {
1364
+ style.height = currentHeight === 0 ? "100%" : `${String(currentHeight)}px`;
1365
+ style.width = currentWidth === 0 ? "100%" : `${String(currentWidth)}px`;
1366
+ }
1367
+ dashboardComponent.currentScreenMode = currentMode;
1368
+ dashboardComponent.iframeStyle = style;
1369
+ };
1370
+
1371
+ // libs/embed-libs/shared-embed/src/lib/service/extend-and-validate.ts
1372
+ var _extendAndValidate = (dashboardContent) => {
1373
+ const defaultKeys = Object.keys(
1374
+ DEFAULT_PARAMETERS
1375
+ );
1376
+ const errorMessages = [];
1377
+ const requiredStringParams = [
1378
+ "appServer",
1379
+ "language",
1380
+ "apiHost"
1381
+ ];
1382
+ const requiredStringOrEmptyParams = [
1383
+ "key",
1384
+ "token",
1385
+ "screenMode",
1386
+ "timezoneId",
1387
+ "itemId",
1388
+ "container",
1389
+ "loaderBackground",
1390
+ "loaderFontColor",
1391
+ "loaderSpinnerColor",
1392
+ "loaderSpinnerBackground"
1393
+ ];
1394
+ const objectParams = ["itemDimensions"];
1395
+ const screenModes = [
1396
+ "mobile",
1397
+ "tablet",
1398
+ "desktop",
1399
+ "largeScreen",
1400
+ "fixed",
1401
+ "auto"
1402
+ ];
1403
+ for (const key of defaultKeys) {
1404
+ if (dashboardContent.params[key] === null) {
1405
+ delete dashboardContent.params[key];
1406
+ }
1407
+ }
1408
+ dashboardContent.params = defaultsDeep(
1409
+ dashboardContent.params,
1410
+ DEFAULT_PARAMETERS
1411
+ );
1412
+ if ((!dashboardContent.params.dashboardId || typeof dashboardContent.params.dashboardId !== "string") && (!dashboardContent.params.dashboardSlug || typeof dashboardContent.params.dashboardSlug !== "string")) {
1413
+ delete dashboardContent.params.dashboardId;
1414
+ delete dashboardContent.params.dashboardSlug;
1415
+ }
1416
+ for (const key of requiredStringParams) {
1417
+ if (typeof dashboardContent.params[key] !== "string") {
1418
+ delete dashboardContent.params[key];
1419
+ errorMessages.push(`${key} needs to be of type string.`);
1420
+ }
1421
+ }
1422
+ for (const key of requiredStringOrEmptyParams) {
1423
+ if (typeof dashboardContent.params[key] !== "string" && dashboardContent.params[key] !== null && dashboardContent.params[key] !== void 0) {
1424
+ delete dashboardContent.params[key];
1425
+ errorMessages.push(`${key} needs to be of type string or empty.`);
1426
+ }
1427
+ }
1428
+ if (dashboardContent.params.screenMode && !screenModes.includes(dashboardContent.params.screenMode)) {
1429
+ const validTypesString = screenModes.map((mode) => `"${mode}"`).join(", ");
1430
+ errorMessages.push(
1431
+ `"screenMode" needs should be one of these types: ${validTypesString}`
1432
+ );
1433
+ dashboardContent.params.screenMode = "auto";
1434
+ }
1435
+ if (dashboardContent.params.itemId) {
1436
+ dashboardContent.params.itemEmbedding = true;
1437
+ }
1438
+ for (const key of objectParams) {
1439
+ if (typeof dashboardContent.params[key] !== "object" && dashboardContent.params[key] !== null) {
1440
+ delete dashboardContent.params[key];
1441
+ errorMessages.push(`${key} needs to be of type object or empty.`);
1442
+ }
1443
+ }
1444
+ if (typeof dashboardContent.params.switchScreenModeOnResize !== "boolean") {
1445
+ errorMessages.push("switchScreenModeOnResize needs to be of type boolean.");
1446
+ dashboardContent.params.switchScreenModeOnResize = true;
1447
+ }
1448
+ if (dashboardContent.params.itemDimensions) {
1449
+ const itemDimensionsKeys = [
1450
+ "width",
1451
+ "height"
1452
+ ];
1453
+ for (const key of itemDimensionsKeys) {
1454
+ if (!["string", "number"].includes(
1455
+ typeof dashboardContent.params.itemDimensions[key]
1456
+ ) && dashboardContent.params.itemDimensions[key] !== null) {
1457
+ errorMessages.push(
1458
+ `itemDimensions ${key} needs to be of type string, number or empty.`
1459
+ );
1460
+ }
1461
+ }
1462
+ }
1463
+ dashboardContent.params = defaultsDeep(
1464
+ dashboardContent.params,
1465
+ DEFAULT_PARAMETERS
1466
+ );
1467
+ if (dashboardContent.params.screenMode && dashboardContent.params.screenMode !== "auto") {
1468
+ dashboardContent.params.switchScreenModeOnResize = false;
1469
+ }
1470
+ if (dashboardContent.params.itemDimensions.width !== "auto") {
1471
+ dashboardContent.params.itemDimensions.width = Number.parseInt(
1472
+ `${dashboardContent.params.itemDimensions.width}`.replace("px", ""),
1473
+ 10
1474
+ ) || "auto";
1475
+ }
1476
+ if (dashboardContent.params.itemDimensions.height !== "auto") {
1477
+ dashboardContent.params.itemDimensions.height = Number.parseInt(
1478
+ `${dashboardContent.params.itemDimensions.height}`.replace("px", ""),
1479
+ 10
1480
+ ) || "auto";
1481
+ }
1482
+ dashboardContent.params.itemEmbedding = !!dashboardContent.params.itemId;
1483
+ if (dashboardContent.params.error || errorMessages.length > 0) {
1484
+ _handleError(errorMessages.join("\n"), dashboardContent.params);
1485
+ }
1486
+ };
1487
+
1488
+ // libs/embed-libs/shared-embed/src/lib/constants/class-constants.ts
1489
+ var luzmoEmbedContainerClass = "luzmo-embed-container";
1490
+
1491
+ // libs/embed-libs/shared-embed/src/lib/helpers/remote-federation.ts
1492
+ var remotesMap = {
1493
+ // "remote_app": { url: "http://localhost:4201/remoteEntry.mjs", format: "esm", from: "vite" },
1494
+ };
1495
+ var loadJS = async (url, fn) => {
1496
+ const resolvedUrl = typeof url === "function" ? await url() : url;
1497
+ const script = document.createElement("script");
1498
+ script.type = "text/javascript";
1499
+ script.addEventListener("load", fn);
1500
+ script.src = resolvedUrl;
1501
+ document.querySelectorAll("head")[0].append(script);
1502
+ };
1503
+ var wrapShareModule = (remoteFrom) => ({});
1504
+ async function __federationMethodEnsure(remoteId) {
1505
+ const remote = remotesMap[remoteId];
1506
+ if (remote.inited) {
1507
+ return remote.lib;
1508
+ }
1509
+ if (remote.format === "var") {
1510
+ return new Promise((resolve) => {
1511
+ const callback = () => {
1512
+ if (!remote.inited) {
1513
+ remote.lib = window[remoteId];
1514
+ remote.lib.init(wrapShareModule(remote.from));
1515
+ remote.inited = true;
1516
+ }
1517
+ resolve(remote.lib);
1518
+ };
1519
+ return loadJS(remote.url, callback);
1520
+ });
1521
+ } else if (["esm", "systemjs"].includes(remote.format)) {
1522
+ return new Promise((resolve, reject) => {
1523
+ const getUrl = typeof remote.url === "function" ? remote.url : () => Promise.resolve(remote.url);
1524
+ getUrl().then((url) => {
1525
+ import(
1526
+ /* @vite-ignore */
1527
+ /* webpackIgnore: true */
1528
+ url
1529
+ ).then((lib) => {
1530
+ if (!remote.inited) {
1531
+ const shareScope = wrapShareModule(remote.from);
1532
+ lib.init(shareScope);
1533
+ remote.lib = lib;
1534
+ remote.lib.init(shareScope);
1535
+ remote.inited = true;
1536
+ }
1537
+ resolve(remote.lib);
1538
+ }).catch(reject);
1539
+ });
1540
+ });
1541
+ }
1542
+ }
1543
+ function __federationMethodWrapDefault(module2, need) {
1544
+ if (!(module2 == null ? void 0 : module2.default) && need) {
1545
+ const obj = /* @__PURE__ */ Object.create(null);
1546
+ obj.default = module2;
1547
+ obj.__esModule = true;
1548
+ return obj;
1549
+ }
1550
+ return module2;
1551
+ }
1552
+ async function __federationMethodGetRemote(remoteName, componentName) {
1553
+ return __federationMethodEnsure(remoteName).then((remote) => remote.get(componentName).then((factory) => factory()));
1554
+ }
1555
+
1556
+ // node_modules/lit-html/lit-html.js
1557
+ var t3 = globalThis;
1558
+ var i3 = t3.trustedTypes;
1559
+ var s2 = i3 ? i3.createPolicy("lit-html", { createHTML: (t5) => t5 }) : void 0;
1560
+ var e5 = "$lit$";
1561
+ var h2 = `lit$${(Math.random() + "").slice(9)}$`;
1562
+ var o4 = "?" + h2;
1563
+ var n4 = `<${o4}>`;
1564
+ var r5 = document;
1565
+ var l2 = () => r5.createComment("");
1566
+ var c3 = (t5) => null === t5 || "object" != typeof t5 && "function" != typeof t5;
1567
+ var a2 = Array.isArray;
1568
+ var u2 = (t5) => a2(t5) || "function" == typeof t5?.[Symbol.iterator];
1569
+ var d2 = "[ \n\f\r]";
1570
+ var f2 = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g;
1571
+ var v = /-->/g;
1572
+ var _ = />/g;
1573
+ var m = RegExp(`>|${d2}(?:([^\\s"'>=/]+)(${d2}*=${d2}*(?:[^
1574
+ \f\r"'\`<>=]|("|')|))|$)`, "g");
1575
+ var p2 = /'/g;
1576
+ var g = /"/g;
1577
+ var $ = /^(?:script|style|textarea|title)$/i;
1578
+ var y2 = (t5) => (i6, ...s4) => ({ _$litType$: t5, strings: i6, values: s4 });
1579
+ var x = y2(1);
1580
+ var b2 = y2(2);
1581
+ var w = Symbol.for("lit-noChange");
1582
+ var T = Symbol.for("lit-nothing");
1583
+ var A = /* @__PURE__ */ new WeakMap();
1584
+ var E = r5.createTreeWalker(r5, 129);
1585
+ function C(t5, i6) {
1586
+ if (!Array.isArray(t5) || !t5.hasOwnProperty("raw"))
1587
+ throw Error("invalid template strings array");
1588
+ return void 0 !== s2 ? s2.createHTML(i6) : i6;
1589
+ }
1590
+ var P = (t5, i6) => {
1591
+ const s4 = t5.length - 1, o6 = [];
1592
+ let r7, l3 = 2 === i6 ? "<svg>" : "", c4 = f2;
1593
+ for (let i7 = 0; i7 < s4; i7++) {
1594
+ const s5 = t5[i7];
1595
+ let a3, u3, d3 = -1, y3 = 0;
1596
+ for (; y3 < s5.length && (c4.lastIndex = y3, u3 = c4.exec(s5), null !== u3); )
1597
+ y3 = c4.lastIndex, c4 === f2 ? "!--" === u3[1] ? c4 = v : void 0 !== u3[1] ? c4 = _ : void 0 !== u3[2] ? ($.test(u3[2]) && (r7 = RegExp("</" + u3[2], "g")), c4 = m) : void 0 !== u3[3] && (c4 = m) : c4 === m ? ">" === u3[0] ? (c4 = r7 ?? f2, d3 = -1) : void 0 === u3[1] ? d3 = -2 : (d3 = c4.lastIndex - u3[2].length, a3 = u3[1], c4 = void 0 === u3[3] ? m : '"' === u3[3] ? g : p2) : c4 === g || c4 === p2 ? c4 = m : c4 === v || c4 === _ ? c4 = f2 : (c4 = m, r7 = void 0);
1598
+ const x2 = c4 === m && t5[i7 + 1].startsWith("/>") ? " " : "";
1599
+ l3 += c4 === f2 ? s5 + n4 : d3 >= 0 ? (o6.push(a3), s5.slice(0, d3) + e5 + s5.slice(d3) + h2 + x2) : s5 + h2 + (-2 === d3 ? i7 : x2);
1600
+ }
1601
+ return [C(t5, l3 + (t5[s4] || "<?>") + (2 === i6 ? "</svg>" : "")), o6];
1602
+ };
1603
+ var V = class _V {
1604
+ constructor({ strings: t5, _$litType$: s4 }, n6) {
1605
+ let r7;
1606
+ this.parts = [];
1607
+ let c4 = 0, a3 = 0;
1608
+ const u3 = t5.length - 1, d3 = this.parts, [f3, v2] = P(t5, s4);
1609
+ if (this.el = _V.createElement(f3, n6), E.currentNode = this.el.content, 2 === s4) {
1610
+ const t6 = this.el.content.firstChild;
1611
+ t6.replaceWith(...t6.childNodes);
1612
+ }
1613
+ for (; null !== (r7 = E.nextNode()) && d3.length < u3; ) {
1614
+ if (1 === r7.nodeType) {
1615
+ if (r7.hasAttributes())
1616
+ for (const t6 of r7.getAttributeNames())
1617
+ if (t6.endsWith(e5)) {
1618
+ const i6 = v2[a3++], s5 = r7.getAttribute(t6).split(h2), e7 = /([.?@])?(.*)/.exec(i6);
1619
+ d3.push({ type: 1, index: c4, name: e7[2], strings: s5, ctor: "." === e7[1] ? k : "?" === e7[1] ? H : "@" === e7[1] ? I : R }), r7.removeAttribute(t6);
1620
+ } else
1621
+ t6.startsWith(h2) && (d3.push({ type: 6, index: c4 }), r7.removeAttribute(t6));
1622
+ if ($.test(r7.tagName)) {
1623
+ const t6 = r7.textContent.split(h2), s5 = t6.length - 1;
1624
+ if (s5 > 0) {
1625
+ r7.textContent = i3 ? i3.emptyScript : "";
1626
+ for (let i6 = 0; i6 < s5; i6++)
1627
+ r7.append(t6[i6], l2()), E.nextNode(), d3.push({ type: 2, index: ++c4 });
1628
+ r7.append(t6[s5], l2());
1629
+ }
1630
+ }
1631
+ } else if (8 === r7.nodeType)
1632
+ if (r7.data === o4)
1633
+ d3.push({ type: 2, index: c4 });
1634
+ else {
1635
+ let t6 = -1;
1636
+ for (; -1 !== (t6 = r7.data.indexOf(h2, t6 + 1)); )
1637
+ d3.push({ type: 7, index: c4 }), t6 += h2.length - 1;
1638
+ }
1639
+ c4++;
1640
+ }
1641
+ }
1642
+ static createElement(t5, i6) {
1643
+ const s4 = r5.createElement("template");
1644
+ return s4.innerHTML = t5, s4;
1645
+ }
1646
+ };
1647
+ function N(t5, i6, s4 = t5, e7) {
1648
+ if (i6 === w)
1649
+ return i6;
1650
+ let h3 = void 0 !== e7 ? s4._$Co?.[e7] : s4._$Cl;
1651
+ const o6 = c3(i6) ? void 0 : i6._$litDirective$;
1652
+ return h3?.constructor !== o6 && (h3?._$AO?.(false), void 0 === o6 ? h3 = void 0 : (h3 = new o6(t5), h3._$AT(t5, s4, e7)), void 0 !== e7 ? (s4._$Co ??= [])[e7] = h3 : s4._$Cl = h3), void 0 !== h3 && (i6 = N(t5, h3._$AS(t5, i6.values), h3, e7)), i6;
1653
+ }
1654
+ var S2 = class {
1655
+ constructor(t5, i6) {
1656
+ this._$AV = [], this._$AN = void 0, this._$AD = t5, this._$AM = i6;
1657
+ }
1658
+ get parentNode() {
1659
+ return this._$AM.parentNode;
1660
+ }
1661
+ get _$AU() {
1662
+ return this._$AM._$AU;
1663
+ }
1664
+ u(t5) {
1665
+ const { el: { content: i6 }, parts: s4 } = this._$AD, e7 = (t5?.creationScope ?? r5).importNode(i6, true);
1666
+ E.currentNode = e7;
1667
+ let h3 = E.nextNode(), o6 = 0, n6 = 0, l3 = s4[0];
1668
+ for (; void 0 !== l3; ) {
1669
+ if (o6 === l3.index) {
1670
+ let i7;
1671
+ 2 === l3.type ? i7 = new M(h3, h3.nextSibling, this, t5) : 1 === l3.type ? i7 = new l3.ctor(h3, l3.name, l3.strings, this, t5) : 6 === l3.type && (i7 = new L(h3, this, t5)), this._$AV.push(i7), l3 = s4[++n6];
1672
+ }
1673
+ o6 !== l3?.index && (h3 = E.nextNode(), o6++);
1674
+ }
1675
+ return E.currentNode = r5, e7;
1676
+ }
1677
+ p(t5) {
1678
+ let i6 = 0;
1679
+ for (const s4 of this._$AV)
1680
+ void 0 !== s4 && (void 0 !== s4.strings ? (s4._$AI(t5, s4, i6), i6 += s4.strings.length - 2) : s4._$AI(t5[i6])), i6++;
1681
+ }
1682
+ };
1683
+ var M = class _M {
1684
+ get _$AU() {
1685
+ return this._$AM?._$AU ?? this._$Cv;
1686
+ }
1687
+ constructor(t5, i6, s4, e7) {
1688
+ this.type = 2, this._$AH = T, this._$AN = void 0, this._$AA = t5, this._$AB = i6, this._$AM = s4, this.options = e7, this._$Cv = e7?.isConnected ?? true;
1689
+ }
1690
+ get parentNode() {
1691
+ let t5 = this._$AA.parentNode;
1692
+ const i6 = this._$AM;
1693
+ return void 0 !== i6 && 11 === t5?.nodeType && (t5 = i6.parentNode), t5;
1694
+ }
1695
+ get startNode() {
1696
+ return this._$AA;
1697
+ }
1698
+ get endNode() {
1699
+ return this._$AB;
1700
+ }
1701
+ _$AI(t5, i6 = this) {
1702
+ t5 = N(this, t5, i6), c3(t5) ? t5 === T || null == t5 || "" === t5 ? (this._$AH !== T && this._$AR(), this._$AH = T) : t5 !== this._$AH && t5 !== w && this._(t5) : void 0 !== t5._$litType$ ? this.$(t5) : void 0 !== t5.nodeType ? this.T(t5) : u2(t5) ? this.k(t5) : this._(t5);
1703
+ }
1704
+ S(t5) {
1705
+ return this._$AA.parentNode.insertBefore(t5, this._$AB);
1706
+ }
1707
+ T(t5) {
1708
+ this._$AH !== t5 && (this._$AR(), this._$AH = this.S(t5));
1709
+ }
1710
+ _(t5) {
1711
+ this._$AH !== T && c3(this._$AH) ? this._$AA.nextSibling.data = t5 : this.T(r5.createTextNode(t5)), this._$AH = t5;
1712
+ }
1713
+ $(t5) {
1714
+ const { values: i6, _$litType$: s4 } = t5, e7 = "number" == typeof s4 ? this._$AC(t5) : (void 0 === s4.el && (s4.el = V.createElement(C(s4.h, s4.h[0]), this.options)), s4);
1715
+ if (this._$AH?._$AD === e7)
1716
+ this._$AH.p(i6);
1717
+ else {
1718
+ const t6 = new S2(e7, this), s5 = t6.u(this.options);
1719
+ t6.p(i6), this.T(s5), this._$AH = t6;
1720
+ }
1721
+ }
1722
+ _$AC(t5) {
1723
+ let i6 = A.get(t5.strings);
1724
+ return void 0 === i6 && A.set(t5.strings, i6 = new V(t5)), i6;
1725
+ }
1726
+ k(t5) {
1727
+ a2(this._$AH) || (this._$AH = [], this._$AR());
1728
+ const i6 = this._$AH;
1729
+ let s4, e7 = 0;
1730
+ for (const h3 of t5)
1731
+ e7 === i6.length ? i6.push(s4 = new _M(this.S(l2()), this.S(l2()), this, this.options)) : s4 = i6[e7], s4._$AI(h3), e7++;
1732
+ e7 < i6.length && (this._$AR(s4 && s4._$AB.nextSibling, e7), i6.length = e7);
1733
+ }
1734
+ _$AR(t5 = this._$AA.nextSibling, i6) {
1735
+ for (this._$AP?.(false, true, i6); t5 && t5 !== this._$AB; ) {
1736
+ const i7 = t5.nextSibling;
1737
+ t5.remove(), t5 = i7;
1738
+ }
1739
+ }
1740
+ setConnected(t5) {
1741
+ void 0 === this._$AM && (this._$Cv = t5, this._$AP?.(t5));
1742
+ }
1743
+ };
1744
+ var R = class {
1745
+ get tagName() {
1746
+ return this.element.tagName;
1747
+ }
1748
+ get _$AU() {
1749
+ return this._$AM._$AU;
1750
+ }
1751
+ constructor(t5, i6, s4, e7, h3) {
1752
+ this.type = 1, this._$AH = T, this._$AN = void 0, this.element = t5, this.name = i6, this._$AM = e7, this.options = h3, s4.length > 2 || "" !== s4[0] || "" !== s4[1] ? (this._$AH = Array(s4.length - 1).fill(new String()), this.strings = s4) : this._$AH = T;
1753
+ }
1754
+ _$AI(t5, i6 = this, s4, e7) {
1755
+ const h3 = this.strings;
1756
+ let o6 = false;
1757
+ if (void 0 === h3)
1758
+ t5 = N(this, t5, i6, 0), o6 = !c3(t5) || t5 !== this._$AH && t5 !== w, o6 && (this._$AH = t5);
1759
+ else {
1760
+ const e8 = t5;
1761
+ let n6, r7;
1762
+ for (t5 = h3[0], n6 = 0; n6 < h3.length - 1; n6++)
1763
+ r7 = N(this, e8[s4 + n6], i6, n6), r7 === w && (r7 = this._$AH[n6]), o6 ||= !c3(r7) || r7 !== this._$AH[n6], r7 === T ? t5 = T : t5 !== T && (t5 += (r7 ?? "") + h3[n6 + 1]), this._$AH[n6] = r7;
1764
+ }
1765
+ o6 && !e7 && this.j(t5);
1766
+ }
1767
+ j(t5) {
1768
+ t5 === T ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t5 ?? "");
1769
+ }
1770
+ };
1771
+ var k = class extends R {
1772
+ constructor() {
1773
+ super(...arguments), this.type = 3;
1774
+ }
1775
+ j(t5) {
1776
+ this.element[this.name] = t5 === T ? void 0 : t5;
1777
+ }
1778
+ };
1779
+ var H = class extends R {
1780
+ constructor() {
1781
+ super(...arguments), this.type = 4;
1782
+ }
1783
+ j(t5) {
1784
+ this.element.toggleAttribute(this.name, !!t5 && t5 !== T);
1785
+ }
1786
+ };
1787
+ var I = class extends R {
1788
+ constructor(t5, i6, s4, e7, h3) {
1789
+ super(t5, i6, s4, e7, h3), this.type = 5;
1790
+ }
1791
+ _$AI(t5, i6 = this) {
1792
+ if ((t5 = N(this, t5, i6, 0) ?? T) === w)
1793
+ return;
1794
+ const s4 = this._$AH, e7 = t5 === T && s4 !== T || t5.capture !== s4.capture || t5.once !== s4.once || t5.passive !== s4.passive, h3 = t5 !== T && (s4 === T || e7);
1795
+ e7 && this.element.removeEventListener(this.name, this, s4), h3 && this.element.addEventListener(this.name, this, t5), this._$AH = t5;
1796
+ }
1797
+ handleEvent(t5) {
1798
+ "function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t5) : this._$AH.handleEvent(t5);
1799
+ }
1800
+ };
1801
+ var L = class {
1802
+ constructor(t5, i6, s4) {
1803
+ this.element = t5, this.type = 6, this._$AN = void 0, this._$AM = i6, this.options = s4;
1804
+ }
1805
+ get _$AU() {
1806
+ return this._$AM._$AU;
1807
+ }
1808
+ _$AI(t5) {
1809
+ N(this, t5);
1810
+ }
1811
+ };
1812
+ var Z = t3.litHtmlPolyfillSupport;
1813
+ Z?.(V, M), (t3.litHtmlVersions ??= []).push("3.1.2");
1814
+ var j = (t5, i6, s4) => {
1815
+ const e7 = s4?.renderBefore ?? i6;
1816
+ let h3 = e7._$litPart$;
1817
+ if (void 0 === h3) {
1818
+ const t6 = s4?.renderBefore ?? null;
1819
+ e7._$litPart$ = h3 = new M(i6.insertBefore(l2(), t6), t6, void 0, s4 ?? {});
1820
+ }
1821
+ return h3._$AI(t5), h3;
1822
+ };
1823
+
1824
+ // node_modules/lit-element/lit-element.js
1825
+ var s3 = class extends b {
1826
+ constructor() {
1827
+ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
1828
+ }
1829
+ createRenderRoot() {
1830
+ const t5 = super.createRenderRoot();
1831
+ return this.renderOptions.renderBefore ??= t5.firstChild, t5;
1832
+ }
1833
+ update(t5) {
1834
+ const i6 = this.render();
1835
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t5), this._$Do = j(i6, this.renderRoot, this.renderOptions);
1836
+ }
1837
+ connectedCallback() {
1838
+ super.connectedCallback(), this._$Do?.setConnected(true);
1839
+ }
1840
+ disconnectedCallback() {
1841
+ super.disconnectedCallback(), this._$Do?.setConnected(false);
1842
+ }
1843
+ render() {
1844
+ return w;
1845
+ }
1846
+ };
1847
+ s3._$litElement$ = true, s3["finalized", "finalized"] = true, globalThis.litElementHydrateSupport?.({ LitElement: s3 });
1848
+ var r6 = globalThis.litElementPolyfillSupport;
1849
+ r6?.({ LitElement: s3 });
1850
+ (globalThis.litElementVersions ??= []).push("4.0.4");
1851
+
1852
+ // node_modules/lit-html/directive.js
1853
+ var t4 = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 };
1854
+ var e6 = (t5) => (...e7) => ({ _$litDirective$: t5, values: e7 });
1855
+ var i4 = class {
1856
+ constructor(t5) {
1857
+ }
1858
+ get _$AU() {
1859
+ return this._$AM._$AU;
1860
+ }
1861
+ _$AT(t5, e7, i6) {
1862
+ this._$Ct = t5, this._$AM = e7, this._$Ci = i6;
1863
+ }
1864
+ _$AS(t5, e7) {
1865
+ return this.update(t5, e7);
1866
+ }
1867
+ update(t5, e7) {
1868
+ return this.render(...e7);
1869
+ }
1870
+ };
1871
+
1872
+ // node_modules/lit-html/directives/style-map.js
1873
+ var n5 = "important";
1874
+ var i5 = " !" + n5;
1875
+ var o5 = e6(class extends i4 {
1876
+ constructor(t5) {
1877
+ if (super(t5), t5.type !== t4.ATTRIBUTE || "style" !== t5.name || t5.strings?.length > 2)
1878
+ throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
1879
+ }
1880
+ render(t5) {
1881
+ return Object.keys(t5).reduce((e7, r7) => {
1882
+ const s4 = t5[r7];
1883
+ return null == s4 ? e7 : e7 + `${r7 = r7.includes("-") ? r7 : r7.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase()}:${s4};`;
1884
+ }, "");
1885
+ }
1886
+ update(e7, [r7]) {
1887
+ const { style: s4 } = e7.element;
1888
+ if (void 0 === this.ft)
1889
+ return this.ft = new Set(Object.keys(r7)), this.render(r7);
1890
+ for (const t5 of this.ft)
1891
+ null == r7[t5] && (this.ft.delete(t5), t5.includes("-") ? s4.removeProperty(t5) : s4[t5] = null);
1892
+ for (const t5 in r7) {
1893
+ const e8 = r7[t5];
1894
+ if (null != e8) {
1895
+ this.ft.add(t5);
1896
+ const r8 = "string" == typeof e8 && e8.endsWith(i5);
1897
+ t5.includes("-") || r8 ? s4.setProperty(t5, r8 ? e8.slice(0, -11) : e8, r8 ? n5 : "") : s4[t5] = e8;
1898
+ }
1899
+ }
1900
+ return w;
1901
+ }
1902
+ });
1903
+
1904
+ // libs/embed-libs/embed/package.json
1905
+ var version = "5.0.12";
1906
+
1907
+ // libs/embed-libs/embed/src/lib/luzmo-service.ts
1908
+ var LuzmoService = class {
1909
+ constructor() {
1910
+ this._components = [];
1911
+ }
1912
+ };
1913
+ var luzmo_service_default = new LuzmoService();
1914
+
1915
+ // libs/embed-libs/embed/src/lib/helper/event-bus-handler.ts
1916
+ var _setEventHandler = () => {
1917
+ if (typeof window.__luzmoMessageHandler === "function") {
1918
+ return;
1919
+ }
1920
+ window.__luzmoMessageHandler = (event) => {
1921
+ const dashboardComponent = luzmo_service_default._components.find(
1922
+ (c4) => event.data.name === c4._iframeId
1923
+ );
1924
+ if (!dashboardComponent) {
1925
+ return;
1926
+ }
1927
+ switch (event.data?.type) {
1928
+ case "load": {
1929
+ dashboardComponent.dispatchEvent(
1930
+ new CustomEvent("load", { detail: { data: event.data } })
1931
+ );
1932
+ if (dashboardComponent._loadTimeoutHandle) {
1933
+ clearTimeout(dashboardComponent._loadTimeoutHandle);
1934
+ dashboardComponent._loadTimeoutHandle = void 0;
1935
+ }
1936
+ dashboardComponent.iframeLoaded = true;
1937
+ dashboardComponent.dimensions = event.data.dimensions;
1938
+ dashboardComponent._calculateDimAfterDashboardLoaded();
1939
+ break;
1940
+ }
1941
+ case "error": {
1942
+ dashboardComponent.dashboardError = true;
1943
+ if (dashboardComponent._loadTimeoutHandle) {
1944
+ clearTimeout(dashboardComponent._loadTimeoutHandle);
1945
+ dashboardComponent._loadTimeoutHandle = void 0;
1946
+ }
1947
+ dashboardComponent.iframeLoaded = true;
1948
+ dashboardComponent._displayError();
1949
+ break;
1950
+ }
1951
+ case "data": {
1952
+ resolvePromise(
1953
+ dashboardComponent,
1954
+ event.data.requestId,
1955
+ event.data.data
1956
+ );
1957
+ break;
1958
+ }
1959
+ case "filters": {
1960
+ resolvePromise(
1961
+ dashboardComponent,
1962
+ event.data.requestId,
1963
+ event.data.filters
1964
+ );
1965
+ break;
1966
+ }
1967
+ case "getAccessibleDashboards": {
1968
+ resolvePromise(
1969
+ dashboardComponent,
1970
+ event.data.requestId,
1971
+ event.data.accessibleDashboards
1972
+ );
1973
+ break;
1974
+ }
1975
+ case "dashboardAction": {
1976
+ dashboardComponent.dispatchEvent(
1977
+ new CustomEvent("dashboardAction", { detail: { data: event.data } })
1978
+ );
1979
+ break;
1980
+ }
1981
+ case "export": {
1982
+ if (event.data.error) {
1983
+ rejectPromise(
1984
+ dashboardComponent,
1985
+ event.data.requestId,
1986
+ event.data
1987
+ );
1988
+ } else {
1989
+ dashboardComponent.dispatchEvent(
1990
+ new CustomEvent("exported", { detail: { data: event.data } })
1991
+ );
1992
+ resolvePromise(
1993
+ dashboardComponent,
1994
+ event.data.requestId,
1995
+ event.data
1996
+ );
1997
+ }
1998
+ break;
1999
+ }
2000
+ case "changedFilters": {
2001
+ dashboardComponent.dispatchEvent(
2002
+ new CustomEvent("changedFilters", { detail: { data: event.data } })
2003
+ );
2004
+ break;
2005
+ }
2006
+ case "customEvent": {
2007
+ dashboardComponent.dispatchEvent(
2008
+ new CustomEvent("customEvent", { detail: { data: event.data } })
2009
+ );
2010
+ break;
2011
+ }
2012
+ case "chartsRendered":
2013
+ case "itemsRendered": {
2014
+ event.data.type = "itemsRendered";
2015
+ dashboardComponent.dispatchEvent(
2016
+ new CustomEvent("itemsRendered", { detail: { data: event.data } })
2017
+ );
2018
+ break;
2019
+ }
2020
+ case "setEditMode": {
2021
+ if (event.data.error) {
2022
+ rejectPromise(
2023
+ dashboardComponent,
2024
+ event.data.requestId,
2025
+ event.data
2026
+ );
2027
+ } else {
2028
+ resolvePromise(
2029
+ dashboardComponent,
2030
+ event.data.requestId,
2031
+ event.data
2032
+ );
2033
+ dashboardComponent.params.editMode = event.data.editMode;
2034
+ dashboardComponent._containerStyle = containerStyles(dashboardComponent);
2035
+ if (dashboardComponent.dimensions) {
2036
+ _setCalculatedDimensions(dashboardComponent);
2037
+ }
2038
+ }
2039
+ break;
2040
+ }
2041
+ case "setFilters": {
2042
+ event.data.error ? rejectPromise(
2043
+ dashboardComponent,
2044
+ event.data.requestId,
2045
+ event.data
2046
+ ) : resolvePromise(
2047
+ dashboardComponent,
2048
+ event.data.requestId,
2049
+ event.data
2050
+ );
2051
+ break;
2052
+ }
2053
+ case "setPreview": {
2054
+ event.data.error ? rejectPromise(
2055
+ dashboardComponent,
2056
+ event.data.requestId,
2057
+ event.data
2058
+ ) : resolvePromise(
2059
+ dashboardComponent,
2060
+ event.data.requestId,
2061
+ event.data
2062
+ );
2063
+ break;
2064
+ }
2065
+ }
2066
+ };
2067
+ window.addEventListener("message", window.__luzmoMessageHandler, false);
2068
+ };
2069
+
2070
+ // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-styles.ts
2071
+ var dashboardStyles = i`
2072
+ :host {
2073
+ display: block;
2074
+ }
2075
+
2076
+ @-webkit-keyframes spin {
2077
+ 0% {
2078
+ -webkit-transform: rotate(0deg);
2079
+ transform: rotate(0deg);
2080
+ }
2081
+ 100% {
2082
+ -webkit-transform: rotate(360deg);
2083
+ transform: rotate(360deg);
2084
+ }
2085
+ }
2086
+
2087
+ @keyframes spin {
2088
+ 0% {
2089
+ -webkit-transform: rotate(0deg);
2090
+ transform: rotate(0deg);
2091
+ }
2092
+ 100% {
2093
+ -webkit-transform: rotate(360deg);
2094
+ transform: rotate(360deg);
2095
+ }
2096
+ }
2097
+ :host {
2098
+ position: relative;
2099
+ width: 100%;
2100
+ }
2101
+
2102
+ .luzmo-embed-dashboard {
2103
+ background: transparent;
2104
+ padding: 0;
2105
+ border: 0;
2106
+ }
2107
+
2108
+ .luzmo-embed-container-ede {
2109
+ width: 100%;
2110
+ height: 100%;
2111
+ }
2112
+
2113
+ .luzmo-container-loader {
2114
+ width: 100%;
2115
+ position: relative;
2116
+ }
2117
+
2118
+ .luzmo-lc {
2119
+ margin: 0 auto;
2120
+ }
2121
+
2122
+ .luzmo-loading-message {
2123
+ width: 100%;
2124
+ height: 20px;
2125
+ text-align: center;
2126
+ margin-bottom: 16px;
2127
+ font-family: Helvetica, Arial, sans-serif;
2128
+ font-size: 14px;
2129
+ }
2130
+
2131
+ .luzmo-loading-circle {
2132
+ box-sizing: border-box;
2133
+ margin: 16px auto;
2134
+ position: relative;
2135
+ text-indent: -9999em;
2136
+ animation: spin 0.6s infinite linear;
2137
+ }
2138
+
2139
+ .luzmo-loading-circle,
2140
+ .luzmo-loading-circle:after {
2141
+ border-radius: 50%;
2142
+ width: 32px;
2143
+ height: 32px;
2144
+ }
2145
+
2146
+ .itemEmbedding:after {
2147
+ width: 24px;
2148
+ height: 24px;
2149
+ }
2150
+
2151
+ .luzmo-error {
2152
+ background: transparent;
2153
+ padding: 48px 0;
2154
+ margin: 0 auto;
2155
+ width: 80%;
2156
+ border: 0;
2157
+ text-align: center;
2158
+ min-height: 192px;
2159
+ }
2160
+
2161
+ .dashboard-error {
2162
+ font-size: 30px;
2163
+ background: transparent;
2164
+ padding: 48px 0;
2165
+ margin: 0 auto;
2166
+ width: 80%;
2167
+ border: 0;
2168
+ text-align: center;
2169
+ min-height: 192px;
2170
+ }
2171
+
2172
+ .luzmo-loader {
2173
+ top: 0;
2174
+ left: 0;
2175
+ width: 100%;
2176
+ min-height: 400px;
2177
+ position: absolute;
2178
+ transition-duration: 0.3s;
2179
+ }
2180
+ `;
2181
+
2182
+ // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-base.ts
2183
+ var LuzmoDashboard = class extends s3 {
2184
+ constructor(inputParameters) {
2185
+ super();
2186
+ this.language = "auto";
2187
+ this.screenMode = "auto";
2188
+ this.switchScreenModeOnResize = true;
2189
+ this.editMode = "view";
2190
+ this.experimental = false;
2191
+ this.iframeStyle = {};
2192
+ this._containerStyle = {};
2193
+ this._loaderStyle = {};
2194
+ this._lcStyle = {};
2195
+ this._loadingCircleStyle = {};
2196
+ this._containerLoaderStyle = {};
2197
+ this._loaderMsg = "";
2198
+ this._itemEmbedding = false;
2199
+ this.browserError = false;
2200
+ this.browserErrorMsg = "";
2201
+ this.dashboardError = false;
2202
+ this.browserNotSupported = [];
2203
+ this.VERSION = version + "-wc-luzmo";
2204
+ this.isLibraryLoaded = false;
2205
+ this.currentAuthKey = null;
2206
+ this.currentAuthToken = null;
2207
+ this.attributesMap = {
2208
+ dashboardId: "dashboard-id",
2209
+ dashboardSlug: "dashboard-slug",
2210
+ itemId: "item-id",
2211
+ language: "language",
2212
+ qeVersion: "qe-version",
2213
+ screenMode: "screen-mode",
2214
+ switchScreenModeOnResize: "switch-screen-mode-on-resize",
2215
+ authKey: "auth-key",
2216
+ authToken: "auth-token",
2217
+ editMode: "edit-mode",
2218
+ mainColor: "main-color",
2219
+ accentColor: "accent-color",
2220
+ loaderBackground: "loader-background",
2221
+ loaderFontColor: "loader-font-color",
2222
+ loaderSpinnerColor: "loader-spinner-color",
2223
+ loaderSpinnerBackground: "loader-spinner-background",
2224
+ appServer: "app-server",
2225
+ apiHost: "api-host",
2226
+ itemDimensions: "item-dimensions",
2227
+ timezoneId: "timezone-id"
2228
+ };
2229
+ this.loaderSize = 32;
2230
+ this.borderWidth = 3;
2231
+ this.minHeight = 400;
2232
+ this._containerId = uuidv4();
2233
+ this._iframeId = `luzmo-dashboard-${this._containerId}`;
2234
+ this.iframeLoaded = false;
2235
+ this.promises = {};
2236
+ this.setInputParameters(inputParameters);
2237
+ this.params = this._setOptions();
2238
+ this._onResize = () => {
2239
+ if (this.shadowRoot?.querySelector(".dashboard-container")) {
2240
+ this.containerWidth = this.luzmoEmbedContainer.offsetWidth;
2241
+ if (this.params.switchScreenModeOnResize && this.params.screenMode === "auto") {
2242
+ for (const d3 of EXTENTS) {
2243
+ if (d3.width[0] <= window.innerWidth && window.innerWidth <= d3.width[1]) {
2244
+ this.currentScreenMode = d3.mode;
2245
+ }
2246
+ }
2247
+ }
2248
+ if (this.iframeLoaded) {
2249
+ this._calculateDimAfterDashboardLoaded();
2250
+ } else {
2251
+ if (this.dimensions) {
2252
+ this.containerWidth = this.luzmoEmbedContainer.offsetWidth;
2253
+ _setCalculatedDimensions(this);
2254
+ }
2255
+ }
2256
+ }
2257
+ };
2258
+ this._resizeObserver = new ResizeObserver((entries) => {
2259
+ window.requestAnimationFrame(() => {
2260
+ if (!Array.isArray(entries) || entries.length === 0) {
2261
+ return;
2262
+ }
2263
+ this._onResize();
2264
+ });
2265
+ });
2266
+ }
2267
+ loadLibrary(appServer) {
2268
+ if (remotesMap[appServer]) {
2269
+ return Promise.resolve(remotesMap[appServer].module);
2270
+ }
2271
+ remotesMap[appServer] = {
2272
+ url: appServer?.startsWith("http://localhost") ? `${removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
2273
+ format: "esm",
2274
+ from: "vite",
2275
+ module: void 0
2276
+ };
2277
+ return __federationMethodGetRemote(appServer, "./DashboardApp").then((module2) => {
2278
+ const wrappedModule = __federationMethodWrapDefault(module2, true);
2279
+ remotesMap[appServer].module = wrappedModule;
2280
+ return wrappedModule;
2281
+ });
2282
+ }
2283
+ setInputParameters(inputParameters) {
2284
+ if (!inputParameters) {
2285
+ return;
2286
+ }
2287
+ const params = [
2288
+ "dashboardId",
2289
+ "dashboardSlug",
2290
+ "itemId",
2291
+ "language",
2292
+ "qeVersion",
2293
+ "screenMode",
2294
+ "switchScreenModeOnResize",
2295
+ "accentColor",
2296
+ "mainColor",
2297
+ "authToken",
2298
+ "authKey",
2299
+ "editMode",
2300
+ "loaderBackground",
2301
+ "loaderFontColor",
2302
+ "loaderSpinnerColor",
2303
+ "loaderSpinnerBackground",
2304
+ "timezoneId",
2305
+ "itemDimensions",
2306
+ "apiHost"
2307
+ ];
2308
+ for (const key of params) {
2309
+ const value = inputParameters[key];
2310
+ if (value) {
2311
+ this[key] = value;
2312
+ }
2313
+ }
2314
+ if (inputParameters.experimental) {
2315
+ this.experimental = inputParameters.experimental;
2316
+ }
2317
+ if (inputParameters.appServer) {
2318
+ this.appServer = addTrailingSlash(inputParameters.appServer);
2319
+ }
2320
+ }
2321
+ // Set resize event listener
2322
+ connectedCallback() {
2323
+ super.connectedCallback();
2324
+ }
2325
+ // Set resize event listener
2326
+ disconnectedCallback() {
2327
+ super.disconnectedCallback();
2328
+ this._resizeObserver.disconnect();
2329
+ for (const promiseKey of Object.keys(this.promises)) {
2330
+ this.promises[promiseKey].reject(
2331
+ new Error("Dashboard component was removed")
2332
+ );
2333
+ }
2334
+ }
2335
+ firstUpdated() {
2336
+ this._loaderMsg = getLoader(this)?.loadingMsg;
2337
+ this._loaderStyles();
2338
+ luzmo_service_default._components.push(this);
2339
+ this.initComponent();
2340
+ if (this.luzmoEmbedContainer) {
2341
+ this._resizeObserver.observe(this.luzmoEmbedContainer);
2342
+ }
2343
+ }
2344
+ initComponent() {
2345
+ this.params = this._setOptions();
2346
+ if (this.getIsViewMode()) {
2347
+ this.loadLibrary(this.params.appServer).then(async () => {
2348
+ this.isLibraryLoaded = true;
2349
+ await this.updateComplete;
2350
+ const oldReference = this.renderRoot.querySelector("dashboard-component");
2351
+ this.dashboardReference = oldReference.cloneNode(true);
2352
+ oldReference.replaceWith(this.dashboardReference);
2353
+ this.dashboardReference.addEventListener("load", (payload) => {
2354
+ this.containerWidth = this.dashboardReference.offsetWidth;
2355
+ this.dimensions = payload.detail.dimensions;
2356
+ _setCalculatedDimensions(this);
2357
+ window.dispatchEvent(new Event("resize"));
2358
+ this.dispatchEvent(new CustomEvent("load", payload));
2359
+ });
2360
+ this.dashboardReference.addEventListener("itemsRendered", (payload) => this.dispatchEvent(new CustomEvent("itemsRendered", payload)));
2361
+ this.dashboardReference.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
2362
+ this.dashboardReference.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
2363
+ this.dashboardReference.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload)));
2364
+ this.dashboardReference.addEventListener("export", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
2365
+ this.setAllAttributes();
2366
+ });
2367
+ } else {
2368
+ this.containerWidth = this.container?.clientWidth;
2369
+ _extendAndValidate(this);
2370
+ _browserCheck(this);
2371
+ this._setupLoader();
2372
+ if (!this.params.error) {
2373
+ this._loaderStyles();
2374
+ _setEventHandler();
2375
+ this._iframeUrl = createIframeUrl(this);
2376
+ this.iframe?.setAttribute("src", this._iframeUrl);
2377
+ this.iframeStyle = calculateIframeStyles(this);
2378
+ }
2379
+ }
2380
+ }
2381
+ setAllAttributes() {
2382
+ if (this.dashboardReference) {
2383
+ for (const key in this.attributesMap) {
2384
+ if (!["authKey", "authToken", "apiHost", "itemDimensions"].includes(key) && this.params[key]) {
2385
+ this.dashboardReference.setAttribute(this.attributesMap[key], this.params[key]);
2386
+ }
2387
+ if (this.params.itemDimensions) {
2388
+ this.dashboardReference.setAttribute("item-dimensions", JSON.stringify(this.params.itemDimensions));
2389
+ }
2390
+ if (this.params.apiHost) {
2391
+ this.dashboardReference.setAttribute("api-host", removeTrailingSlash(this.params.apiHost));
2392
+ }
2393
+ if (this.params.key) {
2394
+ this.dashboardReference.setAttribute("auth-key", this.params.key);
2395
+ }
2396
+ if (this.params.token) {
2397
+ this.dashboardReference.setAttribute("auth-token", this.params.token);
2398
+ }
2399
+ }
2400
+ }
2401
+ }
2402
+ // Reload dashboard when triggerproperty changes
2403
+ updated(changedProperties) {
2404
+ const triggerProperties = /* @__PURE__ */ new Set([
2405
+ "dashboardId",
2406
+ "dashboardSlug",
2407
+ "itemId",
2408
+ "language",
2409
+ "qeVersion",
2410
+ "editMode",
2411
+ "screenMode",
2412
+ "switchScreenModeOnResize",
2413
+ "authToken",
2414
+ "authKey",
2415
+ "appServer",
2416
+ "timezoneId",
2417
+ "itemDimensions"
2418
+ ]);
2419
+ if (this.getIsViewMode()) {
2420
+ if (this.dashboardReference) {
2421
+ for (const [propertyName] of changedProperties.entries()) {
2422
+ if (propertyName === "appSever") {
2423
+ this.loadLibrary(changedProperties[propertyName]).then(async () => {
2424
+ this.isLibraryLoaded = true;
2425
+ await this.updateComplete;
2426
+ this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
2427
+ this.setAllAttributes();
2428
+ });
2429
+ } else if (this.attributesMap[propertyName]) {
2430
+ const mappedAttributeName = this.attributesMap[propertyName] ?? propertyName;
2431
+ const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() || this[propertyName];
2432
+ this.dashboardReference.setAttribute(mappedAttributeName, attributeValue);
2433
+ }
2434
+ }
2435
+ }
2436
+ } else {
2437
+ for (const [propertyName] of changedProperties.entries()) {
2438
+ if (triggerProperties.has(propertyName) && propertyName !== "editMode") {
2439
+ this.iframeLoaded = false;
2440
+ if (this._loadTimeoutHandle) {
2441
+ clearTimeout(this._loadTimeoutHandle);
2442
+ }
2443
+ this._loadTimeoutHandle = setTimeout(() => {
2444
+ console.error(
2445
+ "Failed to load dashboard, appServer is likely down or unreachable."
2446
+ );
2447
+ }, 15 * 1e3);
2448
+ this.params = this._setOptions();
2449
+ _extendAndValidate(this);
2450
+ this._setupLoader();
2451
+ this._loaderStyles();
2452
+ this._iframeUrl = createIframeUrl(this);
2453
+ if (this.iframe) {
2454
+ this._updateIframeUrl();
2455
+ }
2456
+ this.iframeStyle = calculateIframeStyles(this);
2457
+ } else if (triggerProperties.has(propertyName) && propertyName === "editMode") {
2458
+ if (this.iframeLoaded) {
2459
+ this.setEditMode(this.editMode);
2460
+ }
2461
+ this.params = this._setOptions();
2462
+ }
2463
+ }
2464
+ }
2465
+ }
2466
+ // Set params
2467
+ _setOptions() {
2468
+ const defaultParameters = {
2469
+ dashboardId: this.dashboardId,
2470
+ dashboardSlug: this.dashboardSlug
2471
+ };
2472
+ if (this.itemId) {
2473
+ defaultParameters.itemId = this.itemId;
2474
+ this._itemEmbedding = true;
2475
+ } else {
2476
+ this._itemEmbedding = false;
2477
+ }
2478
+ if (this.language) {
2479
+ defaultParameters.language = this.language;
2480
+ }
2481
+ if (this.qeVersion) {
2482
+ defaultParameters.qeVersion = this.qeVersion;
2483
+ }
2484
+ if (this.screenMode) {
2485
+ defaultParameters.screenMode = this.screenMode;
2486
+ }
2487
+ defaultParameters.switchScreenModeOnResize = this.switchScreenModeOnResize;
2488
+ if (this.authToken) {
2489
+ defaultParameters.token = this.authToken;
2490
+ }
2491
+ if (this.authKey) {
2492
+ defaultParameters.key = this.authKey;
2493
+ }
2494
+ if (this.editMode) {
2495
+ defaultParameters.editMode = this.editMode;
2496
+ }
2497
+ if (this.mainColor) {
2498
+ defaultParameters.mainColor = this.mainColor;
2499
+ }
2500
+ if (this.accentColor) {
2501
+ defaultParameters.accentColor = this.accentColor;
2502
+ }
2503
+ if (this.loaderBackground) {
2504
+ defaultParameters.loaderBackground = this.loaderBackground;
2505
+ }
2506
+ if (this.loaderFontColor) {
2507
+ defaultParameters.loaderFontColor = this.loaderFontColor;
2508
+ }
2509
+ if (this.loaderSpinnerColor) {
2510
+ defaultParameters.loaderSpinnerColor = this.loaderSpinnerColor;
2511
+ }
2512
+ if (this.loaderSpinnerBackground) {
2513
+ defaultParameters.loaderSpinnerBackground = this.loaderSpinnerBackground;
2514
+ }
2515
+ if (this.timezoneId) {
2516
+ defaultParameters.timezoneId = this.timezoneId;
2517
+ }
2518
+ if (this.itemDimensions) {
2519
+ defaultParameters.itemDimensions = this.itemDimensions;
2520
+ }
2521
+ if (this.appServer) {
2522
+ this.appServer = this.getIsViewMode() ? removeTrailingSlash(this.appServer) : addTrailingSlash(this.appServer);
2523
+ defaultParameters.appServer = this.appServer;
2524
+ } else {
2525
+ this.appServer = addTrailingSlash(
2526
+ DEFAULT_PARAMETERS.appServer
2527
+ );
2528
+ defaultParameters.appServer = this.appServer;
2529
+ }
2530
+ if (this.apiHost) {
2531
+ this.apiHost = this.getIsViewMode() ? removeTrailingSlash(this.apiHost) : addTrailingSlash(this.apiHost);
2532
+ defaultParameters.apiHost = this.apiHost;
2533
+ } else {
2534
+ this.apiHost = this.appServer.includes("luzmo.com") ? this.appServer.replace("app", "api") : this.appServer;
2535
+ defaultParameters.apiHost = this.apiHost;
2536
+ }
2537
+ this.currentAuthKey = this.authKey;
2538
+ this.currentAuthToken = this.authToken;
2539
+ return defaultParameters;
2540
+ }
2541
+ _updateIframeUrl() {
2542
+ updateIframeUrl(this.iframe, this._iframeUrl);
2543
+ }
2544
+ // Setup loader / browser error
2545
+ _setupLoader() {
2546
+ const data = getLoader(this);
2547
+ this._loaderMsg = data.loadingMsg;
2548
+ if (data.errorMsg) {
2549
+ this.browserError = true;
2550
+ this.browserErrorMsg = data.errorMsg;
2551
+ this._displayError();
2552
+ }
2553
+ }
2554
+ _displayError() {
2555
+ if (this.dashboardError) {
2556
+ this._loaderStyles();
2557
+ this.iframeStyle.opacity = 1;
2558
+ }
2559
+ if (this.browserError) {
2560
+ this._containerStyle.display = "none";
2561
+ }
2562
+ }
2563
+ _calculateDimAfterDashboardLoaded() {
2564
+ this.dashboardError = false;
2565
+ this._loaderStyles();
2566
+ _setCalculatedDimensions(this);
2567
+ }
2568
+ // Set loader styles
2569
+ _loaderStyles() {
2570
+ this._containerStyle = containerStyles(this);
2571
+ this._loaderStyle = loaderStyles(this);
2572
+ this._loadingCircleStyle = plStyles(this);
2573
+ this._containerLoaderStyle = containerLoaderStyles(this);
2574
+ this._lcStyle = lcStyles(this);
2575
+ }
2576
+ static get styles() {
2577
+ return [dashboardStyles];
2578
+ }
2579
+ render() {
2580
+ let toBeRenderedHTML;
2581
+ const loader = x`
2582
+ <div
2583
+ class="luzmo-container-loader"
2584
+ id="luzmo-container-loader-${this._containerId}"
2585
+ style=${o5(
2586
+ this._containerLoaderStyle
2587
+ )}
2588
+ >
2589
+ <div
2590
+ class="luzmo-loader"
2591
+ id="luzmo-loader-${this._containerId}"
2592
+ style=${o5(this._loaderStyle)}
2593
+ >
2594
+ <div
2595
+ class="luzmo-lc"
2596
+ style=${o5(this._lcStyle)}
2597
+ >
2598
+ <div
2599
+ class="luzmo-loading-circle"
2600
+ style=${o5(
2601
+ this._loadingCircleStyle
2602
+ )}
2603
+ ></div>
2604
+ ${this._itemEmbedding ? "" : x`
2605
+ <div
2606
+ class="luzmo-loading-message"
2607
+ style=${o5({ color: this.loaderFontColor })}
2608
+ >
2609
+ ${this._loaderMsg}
2610
+ </div>
2611
+ `}
2612
+ </div>
2613
+ </div>
2614
+ </div>
2615
+ `;
2616
+ if (this.getIsViewMode()) {
2617
+ toBeRenderedHTML = this.isLibraryLoaded ? x`
2618
+ ${this.dashboardId || this.dashboardSlug ? x`
2619
+ <dashboard-component dashboard-id="${this.params.dashboardId}" app-server="${this.params.appServer}"
2620
+ api-host="${this.params.apiHost}"></dashboard-component>` : x`
2621
+ <div id="luzmo-error-${this._containerId}">
2622
+ <h3 class="luzmo-error">${this.browserErrorMsg}</h3>
2623
+ </div>
2624
+ `}
2625
+ ` : x`${loader}`;
2626
+ } else {
2627
+ toBeRenderedHTML = x`
2628
+ ${this.dashboardId || this.dashboardSlug ? x`
2629
+ ${loader}
2630
+ <iframe
2631
+ class="luzmo-embed-dashboard"
2632
+ id="${this._iframeId}"
2633
+ name="${this._iframeId}"
2634
+ style=${o5(this.iframeStyle)}
2635
+ src="${this._iframeUrl}"
2636
+ frameborder="0"
2637
+ ></iframe>
2638
+ ` : x`<!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId -->`}
2639
+ ${this.browserError ? x`
2640
+ <div id="luzmo-error-${this._containerId}">
2641
+ <h3 class="luzmo-error">${this.browserErrorMsg}</h3>
2642
+ </div>
2643
+ ` : ""}
2644
+ `;
2645
+ }
2646
+ return x`
2647
+ <div class="${luzmoEmbedContainerClass} ${!this.getIsViewMode() ? `${luzmoEmbedContainerClass}-ede` : ""}">
2648
+ <div
2649
+ class="dashboard-container"
2650
+ style=${o5(Object.assign({}, this._containerStyle, {
2651
+ width: this.iframeStyle.width ?? "100%",
2652
+ height: this.iframeStyle.height ?? "100%"
2653
+ }))}
2654
+ >
2655
+ ${toBeRenderedHTML}
2656
+ </div>
2657
+ </div>
2658
+
2659
+ `;
2660
+ }
2661
+ getDashboards() {
2662
+ return new Promise(
2663
+ (resolve) => resolve(luzmo_service_default._components)
2664
+ );
2665
+ }
2666
+ // Public methods
2667
+ getData(itemId) {
2668
+ if (this.getIsViewMode() && this.dashboardReference) {
2669
+ return this.dashboardReference.getData(itemId);
2670
+ }
2671
+ if (!this.getIsViewMode()) {
2672
+ return getData(this, this.iframe, itemId);
2673
+ }
2674
+ return Promise.reject();
2675
+ }
2676
+ getFilters() {
2677
+ if (this.getIsViewMode() && this.dashboardReference) {
2678
+ return this.dashboardReference.getFilters();
2679
+ }
2680
+ if (!this.getIsViewMode()) {
2681
+ return getFilters(this, this.iframe);
2682
+ }
2683
+ return Promise.reject();
2684
+ }
2685
+ setFilters(itemId, filters) {
2686
+ if (this.getIsViewMode() && this.dashboardReference) {
2687
+ return this.dashboardReference.setFilters(itemId, filters);
2688
+ }
2689
+ if (!this.getIsViewMode()) {
2690
+ return setFilters(this, this.iframe, itemId, filters);
2691
+ }
2692
+ return Promise.reject();
2693
+ }
2694
+ setAuthorization(key, token) {
2695
+ this.currentAuthKey = key;
2696
+ this.currentAuthToken = token;
2697
+ if (this.getIsViewMode() && this.dashboardReference) {
2698
+ return this.dashboardReference.setAuthorization(key, token);
2699
+ }
2700
+ if (!this.getIsViewMode()) {
2701
+ return setAuthorization(this, this.iframe, key, token);
2702
+ }
2703
+ return Promise.reject();
2704
+ }
2705
+ refreshData(itemId) {
2706
+ if (this.getIsViewMode() && this.dashboardReference) {
2707
+ return this.dashboardReference.refreshData(itemId);
2708
+ }
2709
+ if (!this.getIsViewMode()) {
2710
+ return itemId ? refreshData(this, this.iframe, itemId) : refreshData(this, this.iframe);
2711
+ }
2712
+ return Promise.reject();
2713
+ }
2714
+ reloadDashboard() {
2715
+ if (this.getIsViewMode() && this.dashboardReference) {
2716
+ return this.dashboardReference.reloadDashboard();
2717
+ }
2718
+ if (!this.getIsViewMode()) {
2719
+ return reloadDashboard(this, this.iframe);
2720
+ }
2721
+ return Promise.reject();
2722
+ }
2723
+ exportDashboard(format) {
2724
+ if (this.getIsViewMode() && this.dashboardReference) {
2725
+ return this.dashboardReference.exportDashboard(format);
2726
+ }
2727
+ if (!this.getIsViewMode()) {
2728
+ return format ? exportDashboard(this, this.iframe, format) : exportDashboard(this, this.iframe);
2729
+ }
2730
+ return Promise.reject();
2731
+ }
2732
+ getAccessibleDashboards() {
2733
+ return getAccessibleDashboards(this);
2734
+ }
2735
+ addFilters(itemId, filters) {
2736
+ return this.dashboardReference.addFilters(itemId, filters);
2737
+ }
2738
+ setEditMode(editMode) {
2739
+ if (this.dashboardReference && editMode === "view") {
2740
+ this.editMode = "view";
2741
+ this.params.editMode = "view";
2742
+ this.initComponent();
2743
+ return Promise.resolve({
2744
+ type: "setEditMode",
2745
+ editMode
2746
+ });
2747
+ }
2748
+ if (this.dashboardReference && ["editFull", "editLimited"].includes(editMode)) {
2749
+ this.editMode = editMode;
2750
+ this.params.editMode = editMode;
2751
+ this.initComponent();
2752
+ return Promise.resolve({
2753
+ type: "setEditMode",
2754
+ editMode
2755
+ });
2756
+ }
2757
+ if (this.getIsViewMode() && this.dashboardReference) {
2758
+ return this.dashboardReference.setEditMode(editMode);
2759
+ }
2760
+ if (!this.getIsViewMode()) {
2761
+ return setEditMode(this, this.iframe, editMode);
2762
+ }
2763
+ return Promise.reject();
2764
+ }
2765
+ setPreview(preview) {
2766
+ if (this.getIsViewMode() && this.dashboardReference) {
2767
+ return this.dashboardReference.setPreview(preview);
2768
+ }
2769
+ return setPreview(this, this.iframe, preview);
2770
+ }
2771
+ getIsViewMode() {
2772
+ return this.experimental && this.params.editMode === "view" || this.params.editMode === void 0;
2773
+ }
2774
+ };
2775
+ __decorateClass([
2776
+ e4(".dashboard-container")
2777
+ ], LuzmoDashboard.prototype, "container", 2);
2778
+ __decorateClass([
2779
+ e4(`.${luzmoEmbedContainerClass}`)
2780
+ ], LuzmoDashboard.prototype, "luzmoEmbedContainer", 2);
2781
+ __decorateClass([
2782
+ e4("iframe")
2783
+ ], LuzmoDashboard.prototype, "iframe", 2);
2784
+ __decorateClass([
2785
+ n3()
2786
+ ], LuzmoDashboard.prototype, "dashboardId", 2);
2787
+ __decorateClass([
2788
+ n3()
2789
+ ], LuzmoDashboard.prototype, "dashboardSlug", 2);
2790
+ __decorateClass([
2791
+ n3()
2792
+ ], LuzmoDashboard.prototype, "itemId", 2);
2793
+ __decorateClass([
2794
+ n3()
2795
+ ], LuzmoDashboard.prototype, "language", 2);
2796
+ __decorateClass([
2797
+ n3()
2798
+ ], LuzmoDashboard.prototype, "qeVersion", 2);
2799
+ __decorateClass([
2800
+ n3()
2801
+ ], LuzmoDashboard.prototype, "screenMode", 2);
2802
+ __decorateClass([
2803
+ n3({
2804
+ converter: {
2805
+ fromAttribute: (value) => value === "true",
2806
+ toAttribute: String
2807
+ }
2808
+ })
2809
+ ], LuzmoDashboard.prototype, "switchScreenModeOnResize", 2);
2810
+ __decorateClass([
2811
+ n3()
2812
+ ], LuzmoDashboard.prototype, "editMode", 2);
2813
+ __decorateClass([
2814
+ n3()
2815
+ ], LuzmoDashboard.prototype, "mainColor", 2);
2816
+ __decorateClass([
2817
+ n3()
2818
+ ], LuzmoDashboard.prototype, "accentColor", 2);
2819
+ __decorateClass([
2820
+ n3()
2821
+ ], LuzmoDashboard.prototype, "authToken", 2);
2822
+ __decorateClass([
2823
+ n3()
2824
+ ], LuzmoDashboard.prototype, "authKey", 2);
2825
+ __decorateClass([
2826
+ n3()
2827
+ ], LuzmoDashboard.prototype, "loaderBackground", 2);
2828
+ __decorateClass([
2829
+ n3()
2830
+ ], LuzmoDashboard.prototype, "loaderFontColor", 2);
2831
+ __decorateClass([
2832
+ n3()
2833
+ ], LuzmoDashboard.prototype, "loaderSpinnerColor", 2);
2834
+ __decorateClass([
2835
+ n3()
2836
+ ], LuzmoDashboard.prototype, "loaderSpinnerBackground", 2);
2837
+ __decorateClass([
2838
+ n3()
2839
+ ], LuzmoDashboard.prototype, "appServer", 2);
2840
+ __decorateClass([
2841
+ n3()
2842
+ ], LuzmoDashboard.prototype, "timezoneId", 2);
2843
+ __decorateClass([
2844
+ n3()
2845
+ ], LuzmoDashboard.prototype, "apiHost", 2);
2846
+ __decorateClass([
2847
+ n3({ type: Object })
2848
+ ], LuzmoDashboard.prototype, "itemDimensions", 2);
2849
+ __decorateClass([
2850
+ n3({
2851
+ converter: {
2852
+ fromAttribute: (value) => value === "true",
2853
+ toAttribute: String
2854
+ }
2855
+ })
2856
+ ], LuzmoDashboard.prototype, "experimental", 2);
2857
+ __decorateClass([
2858
+ n3({ attribute: false })
2859
+ ], LuzmoDashboard.prototype, "_containerId", 2);
2860
+ __decorateClass([
2861
+ n3({ attribute: false })
2862
+ ], LuzmoDashboard.prototype, "_iframeId", 2);
2863
+ __decorateClass([
2864
+ n3({ attribute: false })
2865
+ ], LuzmoDashboard.prototype, "params", 2);
2866
+ __decorateClass([
2867
+ n3({ attribute: false })
2868
+ ], LuzmoDashboard.prototype, "_iframeUrl", 2);
2869
+ __decorateClass([
2870
+ n3({ attribute: false })
2871
+ ], LuzmoDashboard.prototype, "iframeLoaded", 2);
2872
+ __decorateClass([
2873
+ n3({ attribute: false })
2874
+ ], LuzmoDashboard.prototype, "promises", 2);
2875
+ __decorateClass([
2876
+ n3({ attribute: false })
2877
+ ], LuzmoDashboard.prototype, "iframeStyle", 2);
2878
+ __decorateClass([
2879
+ n3({ attribute: false })
2880
+ ], LuzmoDashboard.prototype, "_containerStyle", 2);
2881
+ __decorateClass([
2882
+ n3({ attribute: false })
2883
+ ], LuzmoDashboard.prototype, "_loaderStyle", 2);
2884
+ __decorateClass([
2885
+ n3({ attribute: false })
2886
+ ], LuzmoDashboard.prototype, "_lcStyle", 2);
2887
+ __decorateClass([
2888
+ n3({ attribute: false })
2889
+ ], LuzmoDashboard.prototype, "_loadingCircleStyle", 2);
2890
+ __decorateClass([
2891
+ n3({ attribute: false })
2892
+ ], LuzmoDashboard.prototype, "_containerLoaderStyle", 2);
2893
+ __decorateClass([
2894
+ n3({ attribute: false })
2895
+ ], LuzmoDashboard.prototype, "_loaderMsg", 2);
2896
+ __decorateClass([
2897
+ n3({ attribute: false })
2898
+ ], LuzmoDashboard.prototype, "containerWidth", 2);
2899
+ __decorateClass([
2900
+ n3({ attribute: false })
2901
+ ], LuzmoDashboard.prototype, "dimensions", 2);
2902
+ __decorateClass([
2903
+ n3({ attribute: false })
2904
+ ], LuzmoDashboard.prototype, "currentScreenMode", 2);
2905
+ __decorateClass([
2906
+ n3({ attribute: false })
2907
+ ], LuzmoDashboard.prototype, "_itemEmbedding", 2);
2908
+ __decorateClass([
2909
+ n3({ attribute: false })
2910
+ ], LuzmoDashboard.prototype, "browserError", 2);
2911
+ __decorateClass([
2912
+ n3({ attribute: false })
2913
+ ], LuzmoDashboard.prototype, "browserErrorMsg", 2);
2914
+ __decorateClass([
2915
+ n3({ attribute: false })
2916
+ ], LuzmoDashboard.prototype, "dashboardError", 2);
2917
+ __decorateClass([
2918
+ n3({ attribute: false })
2919
+ ], LuzmoDashboard.prototype, "browserNotSupported", 2);
2920
+ __decorateClass([
2921
+ n3()
2922
+ ], LuzmoDashboard.prototype, "VERSION", 2);
2923
+ __decorateClass([
2924
+ r4()
2925
+ ], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
2926
+ __decorateClass([
2927
+ r4()
2928
+ ], LuzmoDashboard.prototype, "dashboardReference", 2);
2929
+ __decorateClass([
2930
+ r4()
2931
+ ], LuzmoDashboard.prototype, "currentAuthKey", 2);
2932
+ __decorateClass([
2933
+ r4()
2934
+ ], LuzmoDashboard.prototype, "currentAuthToken", 2);
2935
+
2936
+ // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-web-component.ts
2937
+ var LuzmoDashboardWebComponent = class extends LuzmoDashboard {
2938
+ };
2939
+ LuzmoDashboardWebComponent = __decorateClass([
2940
+ t("luzmo-dashboard-web-component")
2941
+ ], LuzmoDashboardWebComponent);
2942
+ /*! Bundled license information:
2943
+
2944
+ @lit/reactive-element/decorators/custom-element.js:
2945
+ (**
2946
+ * @license
2947
+ * Copyright 2017 Google LLC
2948
+ * SPDX-License-Identifier: BSD-3-Clause
2949
+ *)
2950
+
2951
+ @lit/reactive-element/css-tag.js:
2952
+ (**
2953
+ * @license
2954
+ * Copyright 2019 Google LLC
2955
+ * SPDX-License-Identifier: BSD-3-Clause
2956
+ *)
2957
+
2958
+ @lit/reactive-element/reactive-element.js:
2959
+ (**
2960
+ * @license
2961
+ * Copyright 2017 Google LLC
2962
+ * SPDX-License-Identifier: BSD-3-Clause
2963
+ *)
2964
+
2965
+ @lit/reactive-element/decorators/property.js:
2966
+ (**
2967
+ * @license
2968
+ * Copyright 2017 Google LLC
2969
+ * SPDX-License-Identifier: BSD-3-Clause
2970
+ *)
2971
+
2972
+ @lit/reactive-element/decorators/state.js:
2973
+ (**
2974
+ * @license
2975
+ * Copyright 2017 Google LLC
2976
+ * SPDX-License-Identifier: BSD-3-Clause
2977
+ *)
2978
+
2979
+ @lit/reactive-element/decorators/event-options.js:
2980
+ (**
2981
+ * @license
2982
+ * Copyright 2017 Google LLC
2983
+ * SPDX-License-Identifier: BSD-3-Clause
2984
+ *)
2985
+
2986
+ @lit/reactive-element/decorators/base.js:
2987
+ (**
2988
+ * @license
2989
+ * Copyright 2017 Google LLC
2990
+ * SPDX-License-Identifier: BSD-3-Clause
2991
+ *)
2992
+
2993
+ @lit/reactive-element/decorators/query.js:
2994
+ (**
2995
+ * @license
2996
+ * Copyright 2017 Google LLC
2997
+ * SPDX-License-Identifier: BSD-3-Clause
2998
+ *)
2999
+
3000
+ @lit/reactive-element/decorators/query-all.js:
3001
+ (**
3002
+ * @license
3003
+ * Copyright 2017 Google LLC
3004
+ * SPDX-License-Identifier: BSD-3-Clause
3005
+ *)
3006
+
3007
+ @lit/reactive-element/decorators/query-async.js:
3008
+ (**
3009
+ * @license
3010
+ * Copyright 2017 Google LLC
3011
+ * SPDX-License-Identifier: BSD-3-Clause
3012
+ *)
3013
+
3014
+ @lit/reactive-element/decorators/query-assigned-elements.js:
3015
+ (**
3016
+ * @license
3017
+ * Copyright 2021 Google LLC
3018
+ * SPDX-License-Identifier: BSD-3-Clause
3019
+ *)
3020
+
3021
+ @lit/reactive-element/decorators/query-assigned-nodes.js:
3022
+ (**
3023
+ * @license
3024
+ * Copyright 2017 Google LLC
3025
+ * SPDX-License-Identifier: BSD-3-Clause
3026
+ *)
3027
+
3028
+ lit-html/lit-html.js:
3029
+ (**
3030
+ * @license
3031
+ * Copyright 2017 Google LLC
3032
+ * SPDX-License-Identifier: BSD-3-Clause
3033
+ *)
3034
+
3035
+ lit-element/lit-element.js:
3036
+ (**
3037
+ * @license
3038
+ * Copyright 2017 Google LLC
3039
+ * SPDX-License-Identifier: BSD-3-Clause
3040
+ *)
3041
+
3042
+ lit-html/is-server.js:
3043
+ (**
3044
+ * @license
3045
+ * Copyright 2022 Google LLC
3046
+ * SPDX-License-Identifier: BSD-3-Clause
3047
+ *)
3048
+
3049
+ lit-html/directive.js:
3050
+ (**
3051
+ * @license
3052
+ * Copyright 2017 Google LLC
3053
+ * SPDX-License-Identifier: BSD-3-Clause
3054
+ *)
3055
+
3056
+ lit-html/directives/style-map.js:
3057
+ (**
3058
+ * @license
3059
+ * Copyright 2018 Google LLC
3060
+ * SPDX-License-Identifier: BSD-3-Clause
3061
+ *)
3062
+ */
3063
+ if (typeof module.exports == "object" && typeof exports == "object") {
3064
+ var __cp = (to, from, except, desc) => {
3065
+ if ((from && typeof from === "object") || typeof from === "function") {
3066
+ for (let key of Object.getOwnPropertyNames(from)) {
3067
+ if (!Object.prototype.hasOwnProperty.call(to, key) && key !== except)
3068
+ Object.defineProperty(to, key, {
3069
+ get: () => from[key],
3070
+ enumerable: !(desc = Object.getOwnPropertyDescriptor(from, key)) || desc.enumerable,
3071
+ });
3072
+ }
3073
+ }
3074
+ return to;
3075
+ };
3076
+ module.exports = __cp(module.exports, exports);
3077
+ }
3078
+ return module.exports;
3079
+ }))