@luzmo/embed 5.0.2 → 5.0.3

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